@agentclientprotocol/codex-acp 1.11.1-preview.2 → 1.11.1-preview.3
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 +68 -6
- package/package.json +1 -1
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
|
}
|
|
@@ -27360,7 +27417,7 @@ var package_default = {
|
|
|
27360
27417
|
publishConfig: {
|
|
27361
27418
|
access: "public"
|
|
27362
27419
|
},
|
|
27363
|
-
version: "1.11.1-preview.
|
|
27420
|
+
version: "1.11.1-preview.3",
|
|
27364
27421
|
description: "",
|
|
27365
27422
|
main: "dist/index.js",
|
|
27366
27423
|
bin: {
|
|
@@ -30920,6 +30977,7 @@ function createFunctionCallUpdate(item) {
|
|
|
30920
30977
|
if (!toolCallId || !name) {
|
|
30921
30978
|
return null;
|
|
30922
30979
|
}
|
|
30980
|
+
const toolName = functionToolName(name, stringValue(item["namespace"]));
|
|
30923
30981
|
const isExecCommand = name === "exec_command";
|
|
30924
30982
|
const args = parseFunctionArguments(item["arguments"]);
|
|
30925
30983
|
const command = isExecCommand ? commandFromFunctionArguments(args) : null;
|
|
@@ -30927,7 +30985,10 @@ function createFunctionCallUpdate(item) {
|
|
|
30927
30985
|
const commandAction = command ? inferCommandAction(command, cwd) : null;
|
|
30928
30986
|
if (commandAction) {
|
|
30929
30987
|
return {
|
|
30930
|
-
update:
|
|
30988
|
+
update: {
|
|
30989
|
+
...createCommandActionEvent(toolCallId, "inProgress", cwd, commandAction),
|
|
30990
|
+
name: toolName
|
|
30991
|
+
},
|
|
30931
30992
|
usesTerminal: false,
|
|
30932
30993
|
isExecCommand
|
|
30933
30994
|
};
|
|
@@ -30935,6 +30996,7 @@ function createFunctionCallUpdate(item) {
|
|
|
30935
30996
|
const update = {
|
|
30936
30997
|
sessionUpdate: "tool_call",
|
|
30937
30998
|
toolCallId,
|
|
30999
|
+
name: toolName,
|
|
30938
31000
|
kind: toolKindForFunctionCall(name),
|
|
30939
31001
|
title: titleForFunctionCall(name, args),
|
|
30940
31002
|
status: "in_progress",
|