@agentclientprotocol/codex-acp 1.11.1-preview.2 → 1.11.1-preview.4
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/dist/index.js +111 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -22824,6 +22824,23 @@ function createContextCompactionMeta(metadata = {}) {
|
|
|
22824
22824
|
};
|
|
22825
22825
|
}
|
|
22826
22826
|
|
|
22827
|
+
// src/ToolCallName.ts
|
|
22828
|
+
function functionToolName(name, namespace) {
|
|
22829
|
+
return `${namespace ?? ""}${name}`;
|
|
22830
|
+
}
|
|
22831
|
+
function commandToolName(source) {
|
|
22832
|
+
switch (source) {
|
|
22833
|
+
case "unifiedExecStartup":
|
|
22834
|
+
return "exec_command";
|
|
22835
|
+
case "unifiedExecInteraction":
|
|
22836
|
+
return "write_stdin";
|
|
22837
|
+
// These sources do not identify a unique model tool.
|
|
22838
|
+
case "agent":
|
|
22839
|
+
case "userShell":
|
|
22840
|
+
return void 0;
|
|
22841
|
+
}
|
|
22842
|
+
}
|
|
22843
|
+
|
|
22827
22844
|
// src/CodexToolCallMapper.ts
|
|
22828
22845
|
var CONTEXT_COMPACTION_META = createContextCompactionMeta();
|
|
22829
22846
|
function toAcpStatus(status) {
|
|
@@ -22854,14 +22871,19 @@ async function createFileChangeUpdate(item) {
|
|
|
22854
22871
|
};
|
|
22855
22872
|
}
|
|
22856
22873
|
async function createCommandExecutionUpdate(item) {
|
|
22874
|
+
const name = commandToolName(item.source);
|
|
22857
22875
|
const commandAction = item.commandActions.length === 1 ? item.commandActions[0] : void 0;
|
|
22858
22876
|
if (commandAction) {
|
|
22859
|
-
return
|
|
22877
|
+
return {
|
|
22878
|
+
...createCommandActionEvent(item.id, item.status, item.cwd, commandAction),
|
|
22879
|
+
...name === void 0 ? {} : { name }
|
|
22880
|
+
};
|
|
22860
22881
|
}
|
|
22861
22882
|
const command = stripShellPrefix(item.command);
|
|
22862
22883
|
return createTerminalCommandEvent({
|
|
22863
22884
|
sessionUpdate: "tool_call",
|
|
22864
22885
|
toolCallId: item.id,
|
|
22886
|
+
...name === void 0 ? {} : { name },
|
|
22865
22887
|
kind: "execute",
|
|
22866
22888
|
title: command,
|
|
22867
22889
|
status: toAcpStatus(item.status),
|
|
@@ -22916,7 +22938,10 @@ async function createMcpToolCallUpdate(item) {
|
|
|
22916
22938
|
};
|
|
22917
22939
|
}
|
|
22918
22940
|
async function createDynamicToolCallUpdate(item) {
|
|
22919
|
-
return
|
|
22941
|
+
return {
|
|
22942
|
+
...await createExecuteToolCallUpdate(item, item.tool, { arguments: item.arguments }),
|
|
22943
|
+
name: functionToolName(item.tool, item.namespace)
|
|
22944
|
+
};
|
|
22920
22945
|
}
|
|
22921
22946
|
function createImageViewUpdate(item) {
|
|
22922
22947
|
const displayPath = item.path;
|
|
@@ -22924,6 +22949,7 @@ function createImageViewUpdate(item) {
|
|
|
22924
22949
|
sessionUpdate: "tool_call",
|
|
22925
22950
|
toolCallId: item.id,
|
|
22926
22951
|
kind: "read",
|
|
22952
|
+
name: "view_image",
|
|
22927
22953
|
title: `View Image ${displayPath}`,
|
|
22928
22954
|
status: "completed",
|
|
22929
22955
|
content: [createContent({
|
|
@@ -24705,10 +24731,16 @@ ${event.details}` : event.summary;
|
|
|
24705
24731
|
async completeItemEvent(event) {
|
|
24706
24732
|
switch (event.item.type) {
|
|
24707
24733
|
case "fileChange":
|
|
24734
|
+
return {
|
|
24735
|
+
sessionUpdate: "tool_call_update",
|
|
24736
|
+
toolCallId: event.item.id,
|
|
24737
|
+
status: event.item.status === "completed" ? "completed" : "failed"
|
|
24738
|
+
};
|
|
24708
24739
|
case "dynamicToolCall":
|
|
24709
24740
|
return {
|
|
24710
24741
|
sessionUpdate: "tool_call_update",
|
|
24711
24742
|
toolCallId: event.item.id,
|
|
24743
|
+
name: functionToolName(event.item.tool, event.item.namespace),
|
|
24712
24744
|
status: event.item.status === "completed" ? "completed" : "failed"
|
|
24713
24745
|
};
|
|
24714
24746
|
case "mcpToolCall":
|
|
@@ -24920,9 +24952,11 @@ ${event.stdin}
|
|
|
24920
24952
|
return `mcp_startup.${encodeURIComponent(serverName)}`;
|
|
24921
24953
|
}
|
|
24922
24954
|
completeCommandExecutionEvent(item) {
|
|
24955
|
+
const name = commandToolName(item.source);
|
|
24923
24956
|
const update = {
|
|
24924
24957
|
sessionUpdate: "tool_call_update",
|
|
24925
24958
|
toolCallId: item.id,
|
|
24959
|
+
...name === void 0 ? {} : { name },
|
|
24926
24960
|
status: item.status === "completed" ? "completed" : "failed",
|
|
24927
24961
|
rawOutput: {
|
|
24928
24962
|
formatted_output: item.aggregatedOutput ?? "",
|
|
@@ -25538,7 +25572,8 @@ function nonBlank(value) {
|
|
|
25538
25572
|
}
|
|
25539
25573
|
|
|
25540
25574
|
// src/permissions/presentation.ts
|
|
25541
|
-
function commandToolCall(params) {
|
|
25575
|
+
function commandToolCall(params, permissionContext) {
|
|
25576
|
+
const name = permissionContext.commandName(params.threadId, params.itemId);
|
|
25542
25577
|
const network = params.networkApprovalContext;
|
|
25543
25578
|
const rawInput = {
|
|
25544
25579
|
...params.command ? { command: stripShellPrefix(params.command) } : {},
|
|
@@ -25549,6 +25584,7 @@ function commandToolCall(params) {
|
|
|
25549
25584
|
const additionalPermissionContent = params.additionalPermissions ? permissionProfileContent(params.additionalPermissions) : [];
|
|
25550
25585
|
return {
|
|
25551
25586
|
toolCallId: params.itemId,
|
|
25587
|
+
...name !== void 0 ? { name } : {},
|
|
25552
25588
|
kind: "execute",
|
|
25553
25589
|
status: "pending",
|
|
25554
25590
|
title: network ? `${network.protocol} network access to ${network.host}` : commandTitle(params.commandActions),
|
|
@@ -25574,6 +25610,7 @@ function additionalPermissionsToolCall(itemId, cwd, environmentId, permissions)
|
|
|
25574
25610
|
const content = permissionProfileContent(permissions);
|
|
25575
25611
|
return {
|
|
25576
25612
|
toolCallId: itemId,
|
|
25613
|
+
name: "request_permissions",
|
|
25577
25614
|
kind: "other",
|
|
25578
25615
|
status: "pending",
|
|
25579
25616
|
title: "Additional sandbox permissions",
|
|
@@ -25670,7 +25707,7 @@ var CodexApprovalHandler = class {
|
|
|
25670
25707
|
try {
|
|
25671
25708
|
const response = await this.requestPermission({
|
|
25672
25709
|
sessionId: params.threadId,
|
|
25673
|
-
toolCall: commandToolCall(authoritativeParams),
|
|
25710
|
+
toolCall: commandToolCall(authoritativeParams, this.permissionContext),
|
|
25674
25711
|
options: decisions.map(({ option }) => option),
|
|
25675
25712
|
_meta: requestPermissionMeta(
|
|
25676
25713
|
params.networkApprovalContext ? CODEX_NETWORK_PERMISSION_TITLE : CODEX_COMMAND_PERMISSION_TITLE,
|
|
@@ -25777,6 +25814,7 @@ var PermissionPromptContext = class {
|
|
|
25777
25814
|
this.nextStandaloneId = nextStandaloneId;
|
|
25778
25815
|
}
|
|
25779
25816
|
nextStandaloneId;
|
|
25817
|
+
commandNames = /* @__PURE__ */ new Map();
|
|
25780
25818
|
fileChanges = /* @__PURE__ */ new Map();
|
|
25781
25819
|
pendingMcpApprovals = /* @__PURE__ */ new Map();
|
|
25782
25820
|
handleNotification(notification) {
|
|
@@ -25800,6 +25838,9 @@ var PermissionPromptContext = class {
|
|
|
25800
25838
|
fileChange(threadId, itemId) {
|
|
25801
25839
|
return this.fileChanges.get(threadId)?.get(itemId);
|
|
25802
25840
|
}
|
|
25841
|
+
commandName(threadId, itemId) {
|
|
25842
|
+
return this.commandNames.get(threadId)?.get(itemId);
|
|
25843
|
+
}
|
|
25803
25844
|
popPendingMcpApproval(threadId, serverName) {
|
|
25804
25845
|
const byServer = this.pendingMcpApprovals.get(threadId);
|
|
25805
25846
|
if (!byServer) return void 0;
|
|
@@ -25814,6 +25855,15 @@ var PermissionPromptContext = class {
|
|
|
25814
25855
|
return this.nextStandaloneId(serverName);
|
|
25815
25856
|
}
|
|
25816
25857
|
handleItemStarted(threadId, item) {
|
|
25858
|
+
if (item.type === "commandExecution") {
|
|
25859
|
+
const name = commandToolName(item.source);
|
|
25860
|
+
if (name !== void 0) {
|
|
25861
|
+
const byItem = this.commandNames.get(threadId) ?? /* @__PURE__ */ new Map();
|
|
25862
|
+
byItem.set(item.id, name);
|
|
25863
|
+
this.commandNames.set(threadId, byItem);
|
|
25864
|
+
}
|
|
25865
|
+
return;
|
|
25866
|
+
}
|
|
25817
25867
|
if (item.type === "fileChange") {
|
|
25818
25868
|
const byItem = this.fileChanges.get(threadId) ?? /* @__PURE__ */ new Map();
|
|
25819
25869
|
byItem.set(item.id, item);
|
|
@@ -25828,6 +25878,12 @@ var PermissionPromptContext = class {
|
|
|
25828
25878
|
this.pendingMcpApprovals.set(threadId, byServer);
|
|
25829
25879
|
}
|
|
25830
25880
|
handleItemCompleted(threadId, item) {
|
|
25881
|
+
if (item.type === "commandExecution") {
|
|
25882
|
+
const byItem = this.commandNames.get(threadId);
|
|
25883
|
+
byItem?.delete(item.id);
|
|
25884
|
+
if (byItem?.size === 0) this.commandNames.delete(threadId);
|
|
25885
|
+
return;
|
|
25886
|
+
}
|
|
25831
25887
|
if (item.type === "fileChange") {
|
|
25832
25888
|
const byItem = this.fileChanges.get(threadId);
|
|
25833
25889
|
byItem?.delete(item.id);
|
|
@@ -25845,6 +25901,7 @@ var PermissionPromptContext = class {
|
|
|
25845
25901
|
if (byServer.size === 0) this.pendingMcpApprovals.delete(threadId);
|
|
25846
25902
|
}
|
|
25847
25903
|
clearTransientState(threadId) {
|
|
25904
|
+
this.commandNames.delete(threadId);
|
|
25848
25905
|
this.fileChanges.delete(threadId);
|
|
25849
25906
|
this.pendingMcpApprovals.delete(threadId);
|
|
25850
25907
|
}
|
|
@@ -26033,7 +26090,9 @@ function cancelledResponse() {
|
|
|
26033
26090
|
}
|
|
26034
26091
|
|
|
26035
26092
|
// src/CodexElicitationHandler.ts
|
|
26036
|
-
var
|
|
26093
|
+
var USER_INPUT_NOTE_FIELD_SUFFIX = "_note";
|
|
26094
|
+
var USER_INPUT_OTHER_OPTION = "None of the above";
|
|
26095
|
+
var USER_INPUT_NOTE_PREFIX = "user_note: ";
|
|
26037
26096
|
function normalizeElicitationSchema(value) {
|
|
26038
26097
|
const normalized = normalizeElicitationSchemaValue(value);
|
|
26039
26098
|
if (!isRecord2(normalized)) {
|
|
@@ -26090,16 +26149,14 @@ function elicitationResponseMeta(response, context, persist = void 0) {
|
|
|
26090
26149
|
}
|
|
26091
26150
|
return Object.keys(meta3).length === 0 ? null : meta3;
|
|
26092
26151
|
}
|
|
26093
|
-
function
|
|
26094
|
-
const base = `${questionId}${
|
|
26095
|
-
|
|
26096
|
-
return base;
|
|
26097
|
-
}
|
|
26152
|
+
function userInputNoteFieldId(questionId, questionIds) {
|
|
26153
|
+
const base = `${questionId}${USER_INPUT_NOTE_FIELD_SUFFIX}`;
|
|
26154
|
+
let fieldId = base;
|
|
26098
26155
|
let index = 1;
|
|
26099
|
-
while (questionIds.has(
|
|
26100
|
-
|
|
26156
|
+
while (questionIds.has(fieldId)) {
|
|
26157
|
+
fieldId = `${base}${index++}`;
|
|
26101
26158
|
}
|
|
26102
|
-
return
|
|
26159
|
+
return fieldId;
|
|
26103
26160
|
}
|
|
26104
26161
|
function userInputResponseValue(content, fieldId) {
|
|
26105
26162
|
const value = content[fieldId];
|
|
@@ -26338,8 +26395,8 @@ var CodexElicitationHandler = class {
|
|
|
26338
26395
|
const hasOptions = options.length > 0;
|
|
26339
26396
|
const hasOtherAnswer = question.isOther && hasOptions;
|
|
26340
26397
|
const base = {
|
|
26341
|
-
title: question.header || question.id,
|
|
26342
|
-
description: question.
|
|
26398
|
+
title: question.question || question.header || question.id,
|
|
26399
|
+
...question.header ? { description: question.header } : {},
|
|
26343
26400
|
_meta: {
|
|
26344
26401
|
codex: {
|
|
26345
26402
|
isOther: question.isOther,
|
|
@@ -26347,42 +26404,45 @@ var CodexElicitationHandler = class {
|
|
|
26347
26404
|
}
|
|
26348
26405
|
}
|
|
26349
26406
|
};
|
|
26350
|
-
|
|
26351
|
-
required2.push(question.id);
|
|
26352
|
-
}
|
|
26407
|
+
required2.push(question.id);
|
|
26353
26408
|
properties[question.id] = hasOptions ? {
|
|
26354
26409
|
...base,
|
|
26355
26410
|
type: "string",
|
|
26356
|
-
oneOf:
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26411
|
+
oneOf: [
|
|
26412
|
+
...options.map((option) => ({
|
|
26413
|
+
const: option.label,
|
|
26414
|
+
title: option.label,
|
|
26415
|
+
...option.description ? { description: option.description } : {}
|
|
26416
|
+
})),
|
|
26417
|
+
...hasOtherAnswer && !options.some((option) => option.label === USER_INPUT_OTHER_OPTION) ? [{
|
|
26418
|
+
const: USER_INPUT_OTHER_OPTION,
|
|
26419
|
+
title: USER_INPUT_OTHER_OPTION,
|
|
26420
|
+
description: "Provide a different answer in the note field."
|
|
26421
|
+
}] : []
|
|
26422
|
+
]
|
|
26361
26423
|
} : {
|
|
26362
26424
|
...base,
|
|
26363
26425
|
type: "string"
|
|
26364
26426
|
};
|
|
26365
26427
|
if (hasOtherAnswer) {
|
|
26366
|
-
properties[
|
|
26428
|
+
properties[userInputNoteFieldId(question.id, questionIds)] = {
|
|
26367
26429
|
type: "string",
|
|
26368
|
-
title: "
|
|
26369
|
-
description: "Type your own answer instead of choosing an option above.",
|
|
26430
|
+
title: "Additional answer or note",
|
|
26370
26431
|
_meta: {
|
|
26371
26432
|
codex: {
|
|
26372
26433
|
questionId: question.id,
|
|
26373
|
-
|
|
26434
|
+
role: "user_note",
|
|
26374
26435
|
isSecret: question.isSecret
|
|
26375
26436
|
}
|
|
26376
26437
|
}
|
|
26377
26438
|
};
|
|
26378
26439
|
}
|
|
26379
26440
|
}
|
|
26380
|
-
const firstQuestion = params.questions[0];
|
|
26381
26441
|
return {
|
|
26382
26442
|
sessionId: params.threadId,
|
|
26383
26443
|
toolCallId: params.itemId,
|
|
26384
26444
|
mode: "form",
|
|
26385
|
-
message:
|
|
26445
|
+
message: "Codex needs your input to continue.",
|
|
26386
26446
|
requestedSchema: {
|
|
26387
26447
|
type: "object",
|
|
26388
26448
|
properties,
|
|
@@ -26433,12 +26493,23 @@ var CodexElicitationHandler = class {
|
|
|
26433
26493
|
const content = contentRecord(response.content);
|
|
26434
26494
|
const questionIds = new Set(params.questions.map((question) => question.id));
|
|
26435
26495
|
for (const question of params.questions) {
|
|
26436
|
-
const
|
|
26437
|
-
|
|
26496
|
+
const answerValues = [];
|
|
26497
|
+
const value = userInputResponseValue(content, question.id);
|
|
26498
|
+
if (value !== void 0) {
|
|
26499
|
+
answerValues.push(...Array.isArray(value) ? value.map(String) : [String(value)]);
|
|
26500
|
+
}
|
|
26501
|
+
if (question.isOther && question.options != null && question.options.length > 0) {
|
|
26502
|
+
const note = userInputResponseValue(content, userInputNoteFieldId(question.id, questionIds));
|
|
26503
|
+
if (note !== void 0) {
|
|
26504
|
+
const notes = Array.isArray(note) ? note : [note];
|
|
26505
|
+
answerValues.push(...notes.map((item) => `${USER_INPUT_NOTE_PREFIX}${String(item).trim()}`));
|
|
26506
|
+
}
|
|
26507
|
+
}
|
|
26508
|
+
if (answerValues.length === 0) {
|
|
26438
26509
|
continue;
|
|
26439
26510
|
}
|
|
26440
26511
|
answers[question.id] = {
|
|
26441
|
-
answers:
|
|
26512
|
+
answers: answerValues
|
|
26442
26513
|
};
|
|
26443
26514
|
}
|
|
26444
26515
|
return { answers };
|
|
@@ -27360,7 +27431,7 @@ var package_default = {
|
|
|
27360
27431
|
publishConfig: {
|
|
27361
27432
|
access: "public"
|
|
27362
27433
|
},
|
|
27363
|
-
version: "1.11.1-preview.
|
|
27434
|
+
version: "1.11.1-preview.4",
|
|
27364
27435
|
description: "",
|
|
27365
27436
|
main: "dist/index.js",
|
|
27366
27437
|
bin: {
|
|
@@ -27423,7 +27494,7 @@ var package_default = {
|
|
|
27423
27494
|
},
|
|
27424
27495
|
dependencies: {
|
|
27425
27496
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
27426
|
-
"@openai/codex": "^0.
|
|
27497
|
+
"@openai/codex": "^0.154.0",
|
|
27427
27498
|
diff: "^9.0.0",
|
|
27428
27499
|
open: "^11.0.1",
|
|
27429
27500
|
"vscode-jsonrpc": "^9.0.1",
|
|
@@ -30920,6 +30991,7 @@ function createFunctionCallUpdate(item) {
|
|
|
30920
30991
|
if (!toolCallId || !name) {
|
|
30921
30992
|
return null;
|
|
30922
30993
|
}
|
|
30994
|
+
const toolName = functionToolName(name, stringValue(item["namespace"]));
|
|
30923
30995
|
const isExecCommand = name === "exec_command";
|
|
30924
30996
|
const args = parseFunctionArguments(item["arguments"]);
|
|
30925
30997
|
const command = isExecCommand ? commandFromFunctionArguments(args) : null;
|
|
@@ -30927,7 +30999,10 @@ function createFunctionCallUpdate(item) {
|
|
|
30927
30999
|
const commandAction = command ? inferCommandAction(command, cwd) : null;
|
|
30928
31000
|
if (commandAction) {
|
|
30929
31001
|
return {
|
|
30930
|
-
update:
|
|
31002
|
+
update: {
|
|
31003
|
+
...createCommandActionEvent(toolCallId, "inProgress", cwd, commandAction),
|
|
31004
|
+
name: toolName
|
|
31005
|
+
},
|
|
30931
31006
|
usesTerminal: false,
|
|
30932
31007
|
isExecCommand
|
|
30933
31008
|
};
|
|
@@ -30935,6 +31010,7 @@ function createFunctionCallUpdate(item) {
|
|
|
30935
31010
|
const update = {
|
|
30936
31011
|
sessionUpdate: "tool_call",
|
|
30937
31012
|
toolCallId,
|
|
31013
|
+
name: toolName,
|
|
30938
31014
|
kind: toolKindForFunctionCall(name),
|
|
30939
31015
|
title: titleForFunctionCall(name, args),
|
|
30940
31016
|
status: "in_progress",
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.11.1-preview.
|
|
6
|
+
"version": "1.11.1-preview.4",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"bin": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
69
|
-
"@openai/codex": "^0.
|
|
69
|
+
"@openai/codex": "^0.154.0",
|
|
70
70
|
"diff": "^9.0.0",
|
|
71
71
|
"open": "^11.0.1",
|
|
72
72
|
"vscode-jsonrpc": "^9.0.1",
|