Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@agentclientprotocol/sdk": "^0.21.0",
"@openai/codex": "^0.128.0",
"@openai/codex": "^0.131.0",
"diff": "^8.0.3",
"open": "^11.0.0",
"vscode-jsonrpc": "^8.2.1"
Expand Down
17 changes: 0 additions & 17 deletions src/CodexAcpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,9 @@ export class CodexAcpClient {
if (!cwd) {
return;
}
const additionalRoots = readAdditionalRoots(meta);
await this.codexClient.listSkills({
cwds: [cwd],
forceReload: true,
perCwdExtraUserRoots: [{
cwd: cwd,
extraUserRoots: additionalRoots
}]
});
}

Expand Down Expand Up @@ -659,18 +654,6 @@ interface GatewayConfig {
}
}

function readAdditionalRoots(meta: Record<string, unknown> | null | undefined): string[] {
const rawRoots = meta?.["additionalRoots"];
if (!Array.isArray(rawRoots)) {
return [];
}

return Array.from(new Set(rawRoots
.filter((value): value is string => typeof value === "string")
.map(value => value.trim())
.filter(value => value.length > 0)));
}

function mergeGatewayConfig(config: JsonObject, gatewayConfig: GatewayConfig | null): JsonObject {
if (gatewayConfig !== null) {
const newConfig = {...config};
Expand Down
2 changes: 2 additions & 0 deletions src/CodexEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export class CodexEventHandler {
return this.handleFuzzyFileSearchSessionCompleted(notification.params);
// ignored events
case "command/exec/outputDelta":
case "process/outputDelta":
case "process/exited":
case "item/autoApprovalReview/started":
case "item/autoApprovalReview/completed":
case "hook/started":
Expand Down
39 changes: 16 additions & 23 deletions src/__tests__/CodexACPAgent/CodexAcpClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
expect(logoutSpy).toHaveBeenCalledWith({});
});

it('prefetches session additional skill roots before thread start', async () => {
it('prefetches skills before thread start', async () => {
const mockFixture = createCodexMockTestFixture();
const codexAcpClient = mockFixture.getCodexAcpClient();
const codexAppServerClient = mockFixture.getCodexAppServerClient();
Expand Down Expand Up @@ -240,6 +240,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
inputModalities: ["text"],
supportsPersonality: false,
additionalSpeedTiers: [],
serviceTiers: [],
isDefault: true
}],
nextCursor: null
Expand All @@ -248,18 +249,11 @@ describe('ACP server test', { timeout: 40_000 }, () => {
await codexAcpClient.newSession({
cwd: "/workspace",
mcpServers: [],
_meta: {
additionalRoots: ["/skills/one", " /skills/two ", 7]
}
});

expect(listSkillsSpy).toHaveBeenCalledWith({
cwds: ["/workspace"],
forceReload: true,
perCwdExtraUserRoots: [{
cwd: "/workspace",
extraUserRoots: ["/skills/one", "/skills/two"]
}]
});
expect(listSkillsSpy.mock.invocationCallOrder[0]!).toBeLessThan(threadStartSpy.mock.invocationCallOrder[0]!);
});
Expand Down Expand Up @@ -353,18 +347,18 @@ describe('ACP server test', { timeout: 40_000 }, () => {
expect(session.sessionId).toBe("thread-id");
});

it('prefetches session additional skill roots before turn start', async () => {
it('prefetches skills before turn start', async () => {
const mockFixture = createCodexMockTestFixture();
const codexAcpAgent = mockFixture.getCodexAcpAgent();
const codexAppServerClient = mockFixture.getCodexAppServerClient();

const listSkillsSpy = vi.spyOn(codexAppServerClient, "listSkills").mockResolvedValue({ data: [] });
const turnStartSpy = vi.spyOn(codexAppServerClient, "turnStart").mockResolvedValue({
turn: { id: "turn-id", items: [], status: "inProgress", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "inProgress", error: null }
} as any);
vi.spyOn(codexAppServerClient, "awaitTurnCompleted").mockResolvedValue({
threadId: "session-id",
turn: { id: "turn-id", items: [], status: "completed", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "completed", error: null }
} as any);

vi.spyOn(codexAcpAgent, "getSessionState").mockReturnValue(createTestSessionState({
Expand All @@ -375,19 +369,12 @@ describe('ACP server test', { timeout: 40_000 }, () => {
const promptRequest: acp.PromptRequest = {
sessionId: "session-id",
prompt: [{ type: "text", text: "Hello" }],
_meta: {
additionalRoots: ["/skills/one", " /skills/two ", 7]
}
};
await codexAcpAgent.prompt(promptRequest);

expect(listSkillsSpy).toHaveBeenCalledWith({
cwds: ["/workspace"],
forceReload: true,
perCwdExtraUserRoots: [{
cwd: "/workspace",
extraUserRoots: ["/skills/one", "/skills/two"]
}]
});
expect(listSkillsSpy.mock.invocationCallOrder[0]!).toBeLessThan(turnStartSpy.mock.invocationCallOrder[0]!);
});
Expand All @@ -411,6 +398,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
return {
id,
items: [],
itemsView: "full" as const,
status,
error: null,
startedAt: null,
Expand Down Expand Up @@ -440,11 +428,11 @@ describe('ACP server test', { timeout: 40_000 }, () => {

fixture.getCodexAppServerClient().listSkills = vi.fn().mockResolvedValue({ data: [] });
fixture.getCodexAppServerClient().turnStart = vi.fn().mockResolvedValue({
turn: { id: "turn-id", items: [], status: "inProgress", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "inProgress", error: null }
});
fixture.getCodexAppServerClient().awaitTurnCompleted = vi.fn().mockResolvedValue({
threadId: "id",
turn: { id: "turn-id", items: [], status: "completed", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "completed", error: null }
});
const sessionState: SessionState = createTestSessionState({
sessionId: "id",
Expand All @@ -464,11 +452,11 @@ describe('ACP server test', { timeout: 40_000 }, () => {
const codexAcpAgent = mockFixture.getCodexAcpAgent();

mockFixture.getCodexAppServerClient().turnStart = vi.fn().mockResolvedValue({
turn: { id: "turn-id", items: [], status: "inProgress", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "inProgress", error: null }
});
mockFixture.getCodexAppServerClient().awaitTurnCompleted = vi.fn().mockResolvedValue({
threadId: "id",
turn: { id: "turn-id", items: [], status: "completed", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "completed", error: null }
});

const sessionState: SessionState = createTestSessionState({
Expand Down Expand Up @@ -510,7 +498,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
const codexAcpAgent = mockFixture.getCodexAcpAgent();

mockFixture.getCodexAppServerClient().turnStart = vi.fn().mockResolvedValue({
turn: { id: "turn-id", items: [], status: "inProgress", error: null }
turn: { id: "turn-id", items: [], itemsView: "full", status: "inProgress", error: null }
});

const sessionState1: SessionState = createTestSessionState({
Expand Down Expand Up @@ -652,6 +640,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
turn: {
id: "turn-id",
items: [],
itemsView: "full",
status: "completed",
error: null,
startedAt: null,
Expand Down Expand Up @@ -829,6 +818,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
defaultReasoningEffort: 'medium',
supportsPersonality: false,
additionalSpeedTiers: [],
serviceTiers: [],
isDefault: false,
inputModalities: []
},
Expand All @@ -847,6 +837,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
defaultReasoningEffort: 'low',
supportsPersonality: false,
additionalSpeedTiers: [],
serviceTiers: [],
isDefault: true,
inputModalities: []
}
Expand All @@ -873,6 +864,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
turn: {
id: "turn-id",
items: [],
itemsView: "full",
status: "inProgress",
error: null,
startedAt: null,
Expand All @@ -885,6 +877,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
turn: {
id: "turn-id",
items: [],
itemsView: "full",
status: "completed",
error: null,
startedAt: null,
Expand Down
Loading
Loading