Skip to content

Commit 64b472f

Browse files
egor-baranovslapoguzov
authored andcommitted
Don't require cwd in meta
1 parent 2ffe20f commit 64b472f

5 files changed

Lines changed: 28 additions & 5 deletions

File tree

src/CodexAcpClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,16 @@ export class CodexAcpClient {
338338
agentMode: AgentMode,
339339
modelId: ModelId,
340340
disableSummary: boolean,
341+
cwd: string,
341342
): Promise<TurnCompletedNotification> {
342343
const input = buildPromptItems(request.prompt);
343344
const effort = modelId.effort as ReasoningEffort | null; //TODO remove unsafe conversion
344345

345-
await this.additionalRootsProvider.refreshSkills(request);
346+
const refreshSkillsRequest: { _meta?: Record<string, unknown> | null, cwd?: string } = { cwd: cwd };
347+
if (request._meta !== undefined) {
348+
refreshSkillsRequest._meta = request._meta;
349+
}
350+
await this.additionalRootsProvider.refreshSkills(refreshSkillsRequest);
346351
await this.codexClient.turnStart({
347352
outputSchema: null,
348353
threadId: request.sessionId,

src/CodexAcpServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ export class CodexAcpServer implements acp.Agent {
637637
}
638638
const agentMode = sessionState.agentMode;
639639
const turnCompleted = await this.runWithProcessCheck(
640-
() => this.codexAcpClient.sendPrompt(params, agentMode, modelId, disableSummary));
640+
() => this.codexAcpClient.sendPrompt(params, agentMode, modelId, disableSummary, sessionState.cwd));
641641

642642
// Check if turn was interrupted (cancelled)
643643
if (turnCompleted.turn.status === "interrupted") {

src/CodexAdditionalRootsProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class CodexAdditionalRootsProvider {
55

66
async refreshSkills(request: { _meta?: Record<string, unknown> | null, cwd?: string }): Promise<void> {
77
const additionalRoots = this.readAdditionalRoots(request._meta);
8-
const cwd = this.nonEmpty(request.cwd) ?? this.nonEmpty(request._meta?.["cwd"]);
8+
const cwd = this.nonEmpty(request.cwd);
99
if (!cwd) {
1010
return;
1111
}

src/__tests__/CodexACPAgent/CodexAcpClient.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
178178
sessionId: "session-id",
179179
prompt: [{ type: "text", text: "Hello" }],
180180
_meta: {
181-
additionalRoots: ["/skills/one", " /skills/two ", 7],
182-
cwd: "/workspace"
181+
additionalRoots: ["/skills/one", " /skills/two ", 7]
183182
}
184183
};
185184
await codexAcpAgent.prompt(promptRequest);

src/__tests__/CodexACPAgent/data/send-attachments-turn-start.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
{
2+
"eventType": "request",
3+
"method": "skills/list",
4+
"params": {
5+
"cwds": [
6+
"/test/cwd"
7+
],
8+
"forceReload": true,
9+
"perCwdExtraUserRoots": [
10+
{
11+
"cwd": "cwd",
12+
"extraUserRoots": []
13+
}
14+
]
15+
}
16+
}
17+
{
18+
"eventType": "response"
19+
}
120
{
221
"eventType": "request",
322
"method": "turn/start",

0 commit comments

Comments
 (0)