@agentclientprotocol/codex-acp 1.10.0 → 1.10.1-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/index.js +74 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,16 @@ The npm package includes a compatible `@openai/codex` dependency. Set `CODEX_PAT
|
|
|
40
40
|
CODEX_PATH=/path/to/codex npx -y @agentclientprotocol/codex-acp
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
To try changes that have landed on `main` but are not released yet, install from the
|
|
44
|
+
`preview` channel. Pushes to `main` trigger preview publishing without waiting
|
|
45
|
+
for CI or release-please; release commits are excluded, and newer pushes can
|
|
46
|
+
replace queued previews. See
|
|
47
|
+
[docs/RELEASES.md](docs/RELEASES.md#preview-releases).
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx -y @agentclientprotocol/codex-acp@preview
|
|
51
|
+
```
|
|
52
|
+
|
|
43
53
|
## Authentication
|
|
44
54
|
|
|
45
55
|
The adapter advertises ACP auth methods during initialization. Clients can authenticate with:
|
package/dist/index.js
CHANGED
|
@@ -25956,8 +25956,9 @@ function buildMcpPermissionRequest(sessionId, params, context, nextStandaloneToo
|
|
|
25956
25956
|
toolCallId: nextStandaloneToolCallId(),
|
|
25957
25957
|
kind: context.isToolApproval ? "execute" : "other",
|
|
25958
25958
|
status: "pending",
|
|
25959
|
+
title: context.isToolApproval ? "MCP tool call approval" : "Question from MCP server",
|
|
25959
25960
|
content: [messageContent],
|
|
25960
|
-
rawInput: { serverName: params.serverName, schema: params.requestedSchema }
|
|
25961
|
+
rawInput: { serverName: params.serverName, description: params.message, schema: params.requestedSchema }
|
|
25961
25962
|
},
|
|
25962
25963
|
...context.isToolApproval ? { _meta: { is_mcp_tool_approval: true } } : {},
|
|
25963
25964
|
options
|
|
@@ -25975,8 +25976,9 @@ function buildMcpPermissionRequest(sessionId, params, context, nextStandaloneToo
|
|
|
25975
25976
|
toolCallId: `elicitation-${params.elicitationId}`,
|
|
25976
25977
|
kind: "fetch",
|
|
25977
25978
|
status: "pending",
|
|
25979
|
+
title: "MCP server requests to open a URL",
|
|
25978
25980
|
content: [messageContent],
|
|
25979
|
-
rawInput: { serverName: params.serverName, url: params.url }
|
|
25981
|
+
rawInput: { serverName: params.serverName, description: params.message, url: params.url }
|
|
25980
25982
|
},
|
|
25981
25983
|
options
|
|
25982
25984
|
},
|
|
@@ -26158,11 +26160,29 @@ var CodexElicitationHandler = class {
|
|
|
26158
26160
|
context.isToolApproval,
|
|
26159
26161
|
context.persistOptions
|
|
26160
26162
|
);
|
|
26161
|
-
if (correlatedCallId !== void 0
|
|
26162
|
-
|
|
26163
|
-
|
|
26164
|
-
|
|
26165
|
-
|
|
26163
|
+
if (correlatedCallId !== void 0) {
|
|
26164
|
+
if (result.action === "accept") {
|
|
26165
|
+
await this.connection.notify(methods.client.session.update, {
|
|
26166
|
+
sessionId: params.threadId,
|
|
26167
|
+
update: { sessionUpdate: "tool_call_update", toolCallId: correlatedCallId, status: "in_progress" }
|
|
26168
|
+
});
|
|
26169
|
+
}
|
|
26170
|
+
} else {
|
|
26171
|
+
try {
|
|
26172
|
+
await this.connection.notify(methods.client.session.update, {
|
|
26173
|
+
sessionId: params.threadId,
|
|
26174
|
+
update: {
|
|
26175
|
+
sessionUpdate: "tool_call_update",
|
|
26176
|
+
toolCallId: request.toolCall.toolCallId,
|
|
26177
|
+
status: "completed",
|
|
26178
|
+
title: request.toolCall.title,
|
|
26179
|
+
content: request.toolCall.content,
|
|
26180
|
+
rawOutput: { action: result.action }
|
|
26181
|
+
}
|
|
26182
|
+
});
|
|
26183
|
+
} catch (error51) {
|
|
26184
|
+
logger.error("Failed to finalize standalone MCP elicitation tool call", error51);
|
|
26185
|
+
}
|
|
26166
26186
|
}
|
|
26167
26187
|
return result;
|
|
26168
26188
|
} catch (error51) {
|
|
@@ -27319,7 +27339,7 @@ var package_default = {
|
|
|
27319
27339
|
publishConfig: {
|
|
27320
27340
|
access: "public"
|
|
27321
27341
|
},
|
|
27322
|
-
version: "1.10.
|
|
27342
|
+
version: "1.10.1-preview.1",
|
|
27323
27343
|
description: "",
|
|
27324
27344
|
main: "dist/index.js",
|
|
27325
27345
|
bin: {
|
|
@@ -27889,6 +27909,7 @@ async function forkSession(request, additionalDirectories, dependencies) {
|
|
|
27889
27909
|
await dependencies.refreshSkills(request.cwd, additionalDirectories);
|
|
27890
27910
|
const lastTurnId = await resolveForkTurnId(request, dependencies.codexClient);
|
|
27891
27911
|
const response = await dependencies.codexClient.threadFork({
|
|
27912
|
+
excludeTurns: true,
|
|
27892
27913
|
config: await dependencies.createSessionConfig(
|
|
27893
27914
|
request.cwd,
|
|
27894
27915
|
additionalDirectories,
|
|
@@ -27914,10 +27935,7 @@ async function forkSession(request, additionalDirectories, dependencies) {
|
|
|
27914
27935
|
async function resolveForkTurnId(request, codexClient) {
|
|
27915
27936
|
const forkPoint = readAirForkPoint(request._meta);
|
|
27916
27937
|
if (!forkPoint) return void 0;
|
|
27917
|
-
const history = await codexClient.
|
|
27918
|
-
threadId: request.sessionId,
|
|
27919
|
-
includeTurns: true
|
|
27920
|
-
});
|
|
27938
|
+
const history = await codexClient.threadReadWithHistory(request.sessionId);
|
|
27921
27939
|
const candidateIds = airForkMessageIdCandidates(forkPoint.messageId);
|
|
27922
27940
|
const itemTurnId = candidateIds.map((candidateId) => history.thread.turns.find((turn) => turn.items.some((item) => item.id === candidateId))?.id).find((turnId) => turnId !== void 0);
|
|
27923
27941
|
if (itemTurnId) return itemTurnId;
|
|
@@ -28340,6 +28358,7 @@ var CodexAcpClient = class {
|
|
|
28340
28358
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
28341
28359
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
28342
28360
|
const response = await this.codexClient.threadResume({
|
|
28361
|
+
excludeTurns: true,
|
|
28343
28362
|
config: await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []),
|
|
28344
28363
|
cwd: request.cwd,
|
|
28345
28364
|
modelProvider: await this.getResumeModelProvider(),
|
|
@@ -28374,16 +28393,17 @@ var CodexAcpClient = class {
|
|
|
28374
28393
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
28375
28394
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
28376
28395
|
const response = await this.codexClient.threadResume({
|
|
28396
|
+
excludeTurns: true,
|
|
28377
28397
|
config: await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []),
|
|
28378
28398
|
cwd: request.cwd,
|
|
28379
28399
|
modelProvider: await this.getResumeModelProvider(),
|
|
28380
28400
|
threadId: request.sessionId
|
|
28381
28401
|
});
|
|
28382
28402
|
onSubscribed?.();
|
|
28383
|
-
const
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
});
|
|
28403
|
+
const thread = response.thread.historyMode === "paginated" ? {
|
|
28404
|
+
...response.thread,
|
|
28405
|
+
turns: response.turnsBackwardsCursor === null ? [] : await this.codexClient.threadReadHistory(response.thread.id, response.turnsBackwardsCursor)
|
|
28406
|
+
} : (await this.codexClient.threadReadWithHistory(response.thread.id)).thread;
|
|
28387
28407
|
const codexModels = await this.fetchAvailableModels();
|
|
28388
28408
|
const currentModelId = this.createModelId(codexModels, response.model, response.reasoningEffort).toString();
|
|
28389
28409
|
return {
|
|
@@ -28393,15 +28413,12 @@ var CodexAcpClient = class {
|
|
|
28393
28413
|
collaborationMode: this.getCollaborationMode(response.thread.id),
|
|
28394
28414
|
modelProvider: response.modelProvider,
|
|
28395
28415
|
currentServiceTier: response.serviceTier ?? null,
|
|
28396
|
-
thread
|
|
28416
|
+
thread,
|
|
28397
28417
|
additionalDirectories
|
|
28398
28418
|
};
|
|
28399
28419
|
}
|
|
28400
28420
|
async readSessionThread(sessionId) {
|
|
28401
|
-
return (await this.codexClient.
|
|
28402
|
-
threadId: sessionId,
|
|
28403
|
-
includeTurns: true
|
|
28404
|
-
})).thread;
|
|
28421
|
+
return (await this.codexClient.threadReadWithHistory(sessionId)).thread;
|
|
28405
28422
|
}
|
|
28406
28423
|
async newSession(request) {
|
|
28407
28424
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
@@ -28682,6 +28699,7 @@ var CodexAcpClient = class {
|
|
|
28682
28699
|
let lateStopReason = null;
|
|
28683
28700
|
try {
|
|
28684
28701
|
const forkPromise = this.codexClient.threadFork({
|
|
28702
|
+
excludeTurns: true,
|
|
28685
28703
|
threadId: params.sessionId,
|
|
28686
28704
|
lastTurnId: params.turnId,
|
|
28687
28705
|
cwd: params.workspace.cwd,
|
|
@@ -29516,6 +29534,41 @@ var CodexAppServerClient = class {
|
|
|
29516
29534
|
async threadRead(params) {
|
|
29517
29535
|
return await this.sendRequest({ method: "thread/read", params });
|
|
29518
29536
|
}
|
|
29537
|
+
async threadTurnsList(params) {
|
|
29538
|
+
return await this.sendRequest({ method: "thread/turns/list", params });
|
|
29539
|
+
}
|
|
29540
|
+
async threadReadWithHistory(threadId) {
|
|
29541
|
+
const response = await this.threadRead({ threadId });
|
|
29542
|
+
if (response.thread.historyMode === "legacy") {
|
|
29543
|
+
return await this.threadRead({ threadId, includeTurns: true });
|
|
29544
|
+
}
|
|
29545
|
+
const turns = await this.threadReadHistory(threadId);
|
|
29546
|
+
return { ...response, thread: { ...response.thread, turns } };
|
|
29547
|
+
}
|
|
29548
|
+
async threadReadHistory(threadId, initialCursor = null) {
|
|
29549
|
+
const turns = [];
|
|
29550
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
29551
|
+
if (initialCursor !== null) seenCursors.add(initialCursor);
|
|
29552
|
+
let cursor = initialCursor;
|
|
29553
|
+
do {
|
|
29554
|
+
const page = await this.threadTurnsList({
|
|
29555
|
+
threadId,
|
|
29556
|
+
cursor,
|
|
29557
|
+
limit: 50,
|
|
29558
|
+
sortDirection: "desc",
|
|
29559
|
+
itemsView: "full"
|
|
29560
|
+
});
|
|
29561
|
+
turns.push(...page.data);
|
|
29562
|
+
cursor = page.nextCursor;
|
|
29563
|
+
if (cursor !== null) {
|
|
29564
|
+
if (seenCursors.has(cursor)) {
|
|
29565
|
+
throw new Error("Codex returned a repeated thread history cursor");
|
|
29566
|
+
}
|
|
29567
|
+
seenCursors.add(cursor);
|
|
29568
|
+
}
|
|
29569
|
+
} while (cursor !== null);
|
|
29570
|
+
return turns.reverse();
|
|
29571
|
+
}
|
|
29519
29572
|
async threadArchive(params) {
|
|
29520
29573
|
return await this.sendRequest({ method: "thread/archive", params });
|
|
29521
29574
|
}
|