@ycodium-ai/agent-grok 0.2.5891 → 0.2.5921
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 +658 -125
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
9
|
|
|
10
10
|
// ../../packages/plugin-api/src/version.ts
|
|
11
|
-
var PLUGIN_API_VERSION =
|
|
11
|
+
var PLUGIN_API_VERSION = 187;
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import { registerEffectiveHomeCommand } from "@ycodium-ai/plugin-api/instance-config";
|
|
@@ -884,6 +884,17 @@ function canonicalItemTypeFromAcpToolKind(kind) {
|
|
|
884
884
|
}
|
|
885
885
|
|
|
886
886
|
// ../../packages/ycodium-acp-executor/src/tool-call-state.ts
|
|
887
|
+
var clearedIdentityFields = /* @__PURE__ */ new WeakMap();
|
|
888
|
+
function readToolCallIdentityFields(state, options) {
|
|
889
|
+
const cleared = clearedIdentityFields.get(state);
|
|
890
|
+
return {
|
|
891
|
+
name: cleared?.name === null ? null : state.data["name"],
|
|
892
|
+
kind: options?.kindFromData ? state.data["kind"] : state.kind,
|
|
893
|
+
mcpServer: cleared?.mcpServer === null ? null : state.data["mcpServer"],
|
|
894
|
+
mcpTool: cleared?.mcpTool === null ? null : state.data["mcpTool"],
|
|
895
|
+
negativeMcp: cleared?.negativeMcp === true
|
|
896
|
+
};
|
|
897
|
+
}
|
|
887
898
|
function normalizeToolCallStatus(raw, fallback) {
|
|
888
899
|
switch (raw) {
|
|
889
900
|
case "pending":
|
|
@@ -1016,6 +1027,13 @@ function makeToolCallState(input2, options) {
|
|
|
1016
1027
|
if (!toolCallId) {
|
|
1017
1028
|
return void 0;
|
|
1018
1029
|
}
|
|
1030
|
+
const explicitNullMcp = input2.mcpServer === null || input2.mcpTool === null;
|
|
1031
|
+
const reqMetaFlag = isRecord3(input2._meta) && typeof input2._meta["is_mcp_tool_call"] === "boolean" ? input2._meta["is_mcp_tool_call"] : void 0;
|
|
1032
|
+
const parentMetaFlag = isRecord3(input2.parentMeta) && typeof input2.parentMeta["is_mcp_tool_call"] === "boolean" ? input2.parentMeta["is_mcp_tool_call"] : void 0;
|
|
1033
|
+
const metaFlag = reqMetaFlag === false || parentMetaFlag === false ? false : reqMetaFlag === true || parentMetaFlag === true ? true : void 0;
|
|
1034
|
+
const explicitPositiveMcp = !explicitNullMcp && metaFlag !== false && (metaFlag === true || readAcpText(input2, "mcpServer") !== void 0 && readAcpText(input2, "mcpTool") !== void 0);
|
|
1035
|
+
const explicitNegativeMcp = explicitNullMcp || metaFlag === false;
|
|
1036
|
+
const negativeMcp = explicitNegativeMcp || !explicitPositiveMcp && options?.inheritedNegativeMcp === true;
|
|
1019
1037
|
const title = typeof input2.title === "string" ? input2.title.trim() || void 0 : void 0;
|
|
1020
1038
|
const command = extractToolCallCommand(input2.rawInput, title);
|
|
1021
1039
|
const extractedContent = extractTextContentFromToolCallContent(input2.content);
|
|
@@ -1029,6 +1047,12 @@ function makeToolCallState(input2, options) {
|
|
|
1029
1047
|
const name = readAcpText(input2, "name");
|
|
1030
1048
|
if (name) {
|
|
1031
1049
|
data["name"] = name;
|
|
1050
|
+
const mcpServer = readAcpText(input2, "mcpServer");
|
|
1051
|
+
const mcpTool = readAcpText(input2, "mcpTool");
|
|
1052
|
+
if (!negativeMcp && mcpServer !== void 0 && mcpTool !== void 0) {
|
|
1053
|
+
data["mcpServer"] = mcpServer;
|
|
1054
|
+
data["mcpTool"] = mcpTool;
|
|
1055
|
+
}
|
|
1032
1056
|
}
|
|
1033
1057
|
if (command) {
|
|
1034
1058
|
data["command"] = command;
|
|
@@ -1055,7 +1079,7 @@ function makeToolCallState(input2, options) {
|
|
|
1055
1079
|
fallbackSummary: title ?? "Tool"
|
|
1056
1080
|
}) : void 0;
|
|
1057
1081
|
const status = normalizeToolCallStatus(input2.status, options?.fallbackStatus);
|
|
1058
|
-
|
|
1082
|
+
const state = {
|
|
1059
1083
|
toolCallId,
|
|
1060
1084
|
...kind ? { kind } : {},
|
|
1061
1085
|
...presentation?.summary ? { title: presentation.summary } : {},
|
|
@@ -1065,8 +1089,50 @@ function makeToolCallState(input2, options) {
|
|
|
1065
1089
|
...textContent ? { contentText: textContent } : {},
|
|
1066
1090
|
data
|
|
1067
1091
|
};
|
|
1092
|
+
if (input2.name === null || input2.mcpServer === null || input2.mcpTool === null || negativeMcp || explicitPositiveMcp) {
|
|
1093
|
+
clearedIdentityFields.set(state, {
|
|
1094
|
+
...input2.name === null ? { name: null } : {},
|
|
1095
|
+
...input2.mcpServer === null ? { mcpServer: null } : {},
|
|
1096
|
+
...input2.mcpTool === null ? { mcpTool: null } : {},
|
|
1097
|
+
...negativeMcp ? { negativeMcp: true } : {},
|
|
1098
|
+
...explicitPositiveMcp ? { positiveMcp: true } : {}
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
return state;
|
|
1102
|
+
}
|
|
1103
|
+
function toolCallIdentityChanged(previous, next) {
|
|
1104
|
+
const prevName = readAcpText(previous, "name");
|
|
1105
|
+
const nextName = readAcpText(next, "name");
|
|
1106
|
+
const prevKind = normalizeToolKind(previous.kind);
|
|
1107
|
+
const nextKind = normalizeToolKind(next.kind);
|
|
1108
|
+
const prevServer = readAcpText(previous, "mcpServer");
|
|
1109
|
+
const nextServer = readAcpText(next, "mcpServer");
|
|
1110
|
+
const prevTool = readAcpText(previous, "mcpTool");
|
|
1111
|
+
const nextTool = readAcpText(next, "mcpTool");
|
|
1112
|
+
const clearedName = prevName !== void 0 && next.name === null;
|
|
1113
|
+
const clearedServer = prevServer !== void 0 && next.mcpServer === null;
|
|
1114
|
+
const clearedTool = prevTool !== void 0 && next.mcpTool === null;
|
|
1115
|
+
return clearedName || clearedServer || clearedTool || prevName !== void 0 && nextName !== void 0 && prevName !== nextName || prevKind !== void 0 && nextKind !== void 0 && prevKind !== nextKind || prevServer !== void 0 && nextServer !== void 0 && prevServer !== nextServer || prevTool !== void 0 && nextTool !== void 0 && prevTool !== nextTool;
|
|
1068
1116
|
}
|
|
1069
1117
|
function mergeToolCallState(previous, next) {
|
|
1118
|
+
if (previous !== void 0 && toolCallIdentityChanged(
|
|
1119
|
+
{
|
|
1120
|
+
name: previous.data["name"],
|
|
1121
|
+
kind: previous.kind,
|
|
1122
|
+
mcpServer: previous.data["mcpServer"],
|
|
1123
|
+
mcpTool: previous.data["mcpTool"]
|
|
1124
|
+
},
|
|
1125
|
+
readToolCallIdentityFields(next, { kindFromData: true })
|
|
1126
|
+
)) {
|
|
1127
|
+
const status2 = next.status ?? previous.status;
|
|
1128
|
+
if (status2 === void 0 || status2 === next.status) {
|
|
1129
|
+
return next;
|
|
1130
|
+
}
|
|
1131
|
+
const replaced = { ...next, status: status2 };
|
|
1132
|
+
const nextCleared2 = clearedIdentityFields.get(next);
|
|
1133
|
+
if (nextCleared2 !== void 0) clearedIdentityFields.set(replaced, nextCleared2);
|
|
1134
|
+
return replaced;
|
|
1135
|
+
}
|
|
1070
1136
|
const nextKind = typeof next.data["kind"] === "string" ? next.data["kind"] : void 0;
|
|
1071
1137
|
const kind = nextKind ?? previous?.kind;
|
|
1072
1138
|
const title = next.title ?? previous?.title;
|
|
@@ -1074,7 +1140,18 @@ function mergeToolCallState(previous, next) {
|
|
|
1074
1140
|
const command = next.command ?? previous?.command;
|
|
1075
1141
|
const detail = next.detail ?? previous?.detail;
|
|
1076
1142
|
const contentText = "content" in next.data ? next.contentText : previous?.contentText;
|
|
1077
|
-
|
|
1143
|
+
const prevCleared = previous === void 0 ? void 0 : clearedIdentityFields.get(previous);
|
|
1144
|
+
const nextCleared = clearedIdentityFields.get(next);
|
|
1145
|
+
const nextPositiveMcp = typeof next.data["mcpServer"] === "string" && typeof next.data["mcpTool"] === "string" || nextCleared?.positiveMcp === true;
|
|
1146
|
+
const mergedNegativeMcp = nextCleared?.negativeMcp === true || !nextPositiveMcp && prevCleared?.negativeMcp === true;
|
|
1147
|
+
const clearPreviousMcp = previous !== void 0 && (mergedNegativeMcp || next.data["name"] !== void 0 && next.data["mcpServer"] === void 0);
|
|
1148
|
+
const previousData = clearPreviousMcp ? Object.fromEntries(
|
|
1149
|
+
Object.entries(previous.data).filter(([key]) => key !== "mcpServer" && key !== "mcpTool")
|
|
1150
|
+
) : previous?.data;
|
|
1151
|
+
const nextData = mergedNegativeMcp ? Object.fromEntries(
|
|
1152
|
+
Object.entries(next.data).filter(([key]) => key !== "mcpServer" && key !== "mcpTool")
|
|
1153
|
+
) : next.data;
|
|
1154
|
+
const merged = {
|
|
1078
1155
|
toolCallId: next.toolCallId,
|
|
1079
1156
|
...kind ? { kind } : {},
|
|
1080
1157
|
...title ? { title } : {},
|
|
@@ -1083,10 +1160,16 @@ function mergeToolCallState(previous, next) {
|
|
|
1083
1160
|
...detail ? { detail } : {},
|
|
1084
1161
|
...contentText ? { contentText } : {},
|
|
1085
1162
|
data: {
|
|
1086
|
-
...
|
|
1087
|
-
...
|
|
1163
|
+
...previousData,
|
|
1164
|
+
...nextData
|
|
1088
1165
|
}
|
|
1089
1166
|
};
|
|
1167
|
+
if (mergedNegativeMcp) {
|
|
1168
|
+
clearedIdentityFields.set(merged, { negativeMcp: true });
|
|
1169
|
+
} else if (nextPositiveMcp || prevCleared?.positiveMcp === true) {
|
|
1170
|
+
clearedIdentityFields.set(merged, { positiveMcp: true });
|
|
1171
|
+
}
|
|
1172
|
+
return merged;
|
|
1090
1173
|
}
|
|
1091
1174
|
var TOOL_CALL_UPDATE_MIN_DETAIL_GROWTH_CHARS = 256;
|
|
1092
1175
|
var TOOL_CALL_UPDATE_COALESCE_LIMIT = 10;
|
|
@@ -1241,20 +1324,47 @@ function parseAvailableCommandsUpdate(params) {
|
|
|
1241
1324
|
}
|
|
1242
1325
|
function parsePermissionRequest(params, known) {
|
|
1243
1326
|
const request = params.toolCall;
|
|
1327
|
+
const requestFields = request;
|
|
1244
1328
|
const earlier = known?.state.data;
|
|
1329
|
+
const identityChanged = known !== void 0 && toolCallIdentityChanged(
|
|
1330
|
+
{
|
|
1331
|
+
name: earlier?.["name"],
|
|
1332
|
+
kind: known.state.kind,
|
|
1333
|
+
mcpServer: earlier?.["mcpServer"],
|
|
1334
|
+
mcpTool: earlier?.["mcpTool"]
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
name: requestFields.name,
|
|
1338
|
+
kind: request.kind,
|
|
1339
|
+
mcpServer: requestFields.mcpServer,
|
|
1340
|
+
mcpTool: requestFields.mcpTool
|
|
1341
|
+
}
|
|
1342
|
+
);
|
|
1343
|
+
const prior = identityChanged ? void 0 : known;
|
|
1344
|
+
const priorData = identityChanged ? void 0 : earlier;
|
|
1345
|
+
const priorNegativeMcp = prior !== void 0 ? readToolCallIdentityFields(prior.state).negativeMcp : false;
|
|
1346
|
+
const reqMeta = request._meta;
|
|
1347
|
+
const parentMeta = params._meta;
|
|
1348
|
+
const requestNegativeMcp = requestFields.mcpServer === null || requestFields.mcpTool === null || isRecord3(reqMeta) && reqMeta["is_mcp_tool_call"] === false || isRecord3(parentMeta) && parentMeta["is_mcp_tool_call"] === false;
|
|
1349
|
+
const allowPriorMcpFields = !priorNegativeMcp && !requestNegativeMcp && requestFields.name === void 0;
|
|
1350
|
+
const inheritedRawTitle = prior?.rawTitle !== void 0 && !((priorNegativeMcp || requestNegativeMcp) && /^(?:(?:Running|Run)\s+)?mcp_/u.test(prior.rawTitle.trim())) ? prior.rawTitle : void 0;
|
|
1245
1351
|
const toolCall = makeToolCallState(
|
|
1246
1352
|
{
|
|
1247
1353
|
toolCallId: request.toolCallId,
|
|
1248
|
-
name:
|
|
1249
|
-
|
|
1250
|
-
|
|
1354
|
+
name: requestFields.name !== void 0 ? requestFields.name : priorData?.["name"],
|
|
1355
|
+
mcpServer: requestFields.mcpServer !== void 0 ? requestFields.mcpServer : allowPriorMcpFields ? priorData?.["mcpServer"] : void 0,
|
|
1356
|
+
mcpTool: requestFields.mcpTool !== void 0 ? requestFields.mcpTool : allowPriorMcpFields ? priorData?.["mcpTool"] : void 0,
|
|
1357
|
+
title: request.title ?? inheritedRawTitle,
|
|
1358
|
+
kind: request.kind ?? priorData?.["kind"],
|
|
1251
1359
|
status: request.status ?? known?.state.status,
|
|
1252
|
-
rawInput: request.rawInput !== void 0 ? request.rawInput :
|
|
1253
|
-
rawOutput: request.rawOutput !== void 0 ? request.rawOutput :
|
|
1254
|
-
content: request.content !== void 0 ? request.content :
|
|
1255
|
-
locations: request.locations !== void 0 ? request.locations :
|
|
1360
|
+
rawInput: request.rawInput !== void 0 ? request.rawInput : priorData?.["rawInput"],
|
|
1361
|
+
rawOutput: request.rawOutput !== void 0 ? request.rawOutput : priorData?.["rawOutput"],
|
|
1362
|
+
content: request.content !== void 0 ? request.content : priorData?.["content"],
|
|
1363
|
+
locations: request.locations !== void 0 ? request.locations : priorData?.["locations"],
|
|
1364
|
+
_meta: reqMeta,
|
|
1365
|
+
parentMeta
|
|
1256
1366
|
},
|
|
1257
|
-
{ fallbackStatus: "pending" }
|
|
1367
|
+
{ fallbackStatus: "pending", ...priorNegativeMcp ? { inheritedNegativeMcp: true } : {} }
|
|
1258
1368
|
);
|
|
1259
1369
|
const kind = toolCall?.kind ?? "unknown";
|
|
1260
1370
|
const content = toolCall?.data["content"];
|
|
@@ -1264,7 +1374,7 @@ function parsePermissionRequest(params, known) {
|
|
|
1264
1374
|
const block = entry["content"];
|
|
1265
1375
|
return block["type"] === "text" && typeof block["text"] === "string" && block["text"].trim() ? [block["text"]] : [];
|
|
1266
1376
|
})[0] : void 0;
|
|
1267
|
-
const originalTitle = (request.title ??
|
|
1377
|
+
const originalTitle = (request.title ?? inheritedRawTitle)?.trim() || void 0;
|
|
1268
1378
|
const detail = toolCall?.command ?? firstText ?? originalTitle;
|
|
1269
1379
|
return {
|
|
1270
1380
|
kind,
|
|
@@ -1335,13 +1445,17 @@ function parseSessionUpdateEvent(params) {
|
|
|
1335
1445
|
{
|
|
1336
1446
|
toolCallId: upd["toolCallId"],
|
|
1337
1447
|
name: upd["name"],
|
|
1448
|
+
mcpServer: upd["mcpServer"],
|
|
1449
|
+
mcpTool: upd["mcpTool"],
|
|
1338
1450
|
title: typeof upd["title"] === "string" ? upd["title"] : void 0,
|
|
1339
1451
|
kind: upd["kind"],
|
|
1340
1452
|
status: upd["status"],
|
|
1341
1453
|
rawInput: upd["rawInput"],
|
|
1342
1454
|
rawOutput: upd["rawOutput"],
|
|
1343
1455
|
content: upd["content"],
|
|
1344
|
-
locations: upd["locations"]
|
|
1456
|
+
locations: upd["locations"],
|
|
1457
|
+
_meta: upd["_meta"],
|
|
1458
|
+
parentMeta: params._meta
|
|
1345
1459
|
},
|
|
1346
1460
|
kind === "tool_call" ? { fallbackStatus: "pending" } : void 0
|
|
1347
1461
|
);
|
|
@@ -1450,6 +1564,38 @@ function canonicalRequestTypeFromAcpKind(kind) {
|
|
|
1450
1564
|
return "dynamic_tool_call";
|
|
1451
1565
|
}
|
|
1452
1566
|
}
|
|
1567
|
+
var MAX_ACP_FILE_CHANGES = 256;
|
|
1568
|
+
var MAX_ACP_FILE_CHANGE_PATH_CHARS = 4096;
|
|
1569
|
+
var MAX_DISPLAY_FILE_CHANGES = 20;
|
|
1570
|
+
var isValidAcpFilePath = (value) => typeof value === "string" && value.trim().length > 0 && value.length <= MAX_ACP_FILE_CHANGE_PATH_CHARS;
|
|
1571
|
+
var isTruncatedFileChangesMarker = (value) => value !== null && typeof value === "object" && value["ycodiumFileChangesTruncated"] === true;
|
|
1572
|
+
var clippedDiffBlocks = /* @__PURE__ */ new WeakMap();
|
|
1573
|
+
function readAcpDiffTooLarge(block) {
|
|
1574
|
+
return block !== null && typeof block === "object" ? clippedDiffBlocks.get(block) : void 0;
|
|
1575
|
+
}
|
|
1576
|
+
function acpFileChangeFromDiffBlock(block, path) {
|
|
1577
|
+
const oldText = typeof block["oldText"] === "string" ? block["oldText"] : void 0;
|
|
1578
|
+
const changeKind = oldText === void 0 ? "add" : "modify";
|
|
1579
|
+
const clipped = readAcpDiffTooLarge(block);
|
|
1580
|
+
if (clipped !== void 0) {
|
|
1581
|
+
return {
|
|
1582
|
+
path,
|
|
1583
|
+
changeKind,
|
|
1584
|
+
additions: clipped.additions,
|
|
1585
|
+
deletions: clipped.deletions,
|
|
1586
|
+
omitted: "too-large"
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
return {
|
|
1590
|
+
path,
|
|
1591
|
+
changeKind,
|
|
1592
|
+
content: {
|
|
1593
|
+
kind: "replace",
|
|
1594
|
+
...oldText !== void 0 ? { oldText } : {},
|
|
1595
|
+
newText: block["newText"]
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1453
1599
|
function fileChangesFromAcpPermission(permissionRequest) {
|
|
1454
1600
|
const content = permissionRequest.toolCall?.data["content"];
|
|
1455
1601
|
const changes = Array.isArray(content) ? content.flatMap((entry) => {
|
|
@@ -1457,34 +1603,106 @@ function fileChangesFromAcpPermission(permissionRequest) {
|
|
|
1457
1603
|
return [];
|
|
1458
1604
|
}
|
|
1459
1605
|
const block = entry;
|
|
1460
|
-
if (block["type"] !== "diff" ||
|
|
1606
|
+
if (block["type"] !== "diff" || !isValidAcpFilePath(block["path"]) || typeof block["newText"] !== "string") {
|
|
1461
1607
|
return [];
|
|
1462
1608
|
}
|
|
1463
|
-
|
|
1464
|
-
return [
|
|
1465
|
-
{
|
|
1466
|
-
path: block["path"],
|
|
1467
|
-
changeKind: oldText === void 0 ? "add" : "modify",
|
|
1468
|
-
content: {
|
|
1469
|
-
kind: "replace",
|
|
1470
|
-
...oldText !== void 0 ? { oldText } : {},
|
|
1471
|
-
newText: block["newText"]
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
];
|
|
1609
|
+
return [acpFileChangeFromDiffBlock(block, block["path"])];
|
|
1475
1610
|
}) : [];
|
|
1476
|
-
|
|
1477
|
-
|
|
1611
|
+
const boundedChanges = changes.length > MAX_ACP_FILE_CHANGES ? changes.slice(0, MAX_ACP_FILE_CHANGES) : changes;
|
|
1612
|
+
const requestType = canonicalRequestTypeFromAcpKind(permissionRequest.kind);
|
|
1613
|
+
if (boundedChanges.length > 0 || requestType === "file_change_approval" || requestType === "file_read_approval") {
|
|
1614
|
+
const locations = permissionRequest.toolCall?.data["locations"];
|
|
1615
|
+
const seenPaths = new Set(boundedChanges.map((change) => change.path));
|
|
1616
|
+
if (Array.isArray(locations)) {
|
|
1617
|
+
for (const entry of locations) {
|
|
1618
|
+
if (boundedChanges.length >= MAX_ACP_FILE_CHANGES) break;
|
|
1619
|
+
const rawPath = entry?.["path"];
|
|
1620
|
+
if (!isValidAcpFilePath(rawPath)) continue;
|
|
1621
|
+
if (!seenPaths.has(rawPath)) {
|
|
1622
|
+
seenPaths.add(rawPath);
|
|
1623
|
+
boundedChanges.push({ path: rawPath, omitted: "unavailable" });
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
return boundedChanges.length > 0 ? boundedChanges : void 0;
|
|
1629
|
+
}
|
|
1630
|
+
function inspectAcpPermissionFileChanges(permissionRequest, inputFileChanges) {
|
|
1631
|
+
const merged = [];
|
|
1632
|
+
let fileChangesTruncated = false;
|
|
1633
|
+
for (const entry of inputFileChanges ?? []) {
|
|
1634
|
+
if (!isValidAcpFilePath(entry.path) || merged.length >= MAX_ACP_FILE_CHANGES) {
|
|
1635
|
+
fileChangesTruncated = true;
|
|
1636
|
+
continue;
|
|
1637
|
+
}
|
|
1638
|
+
merged.push(entry);
|
|
1478
1639
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1640
|
+
const seenPaths = new Set(merged.map((change) => change.path));
|
|
1641
|
+
const content = permissionRequest.toolCall?.data["content"];
|
|
1642
|
+
if (Array.isArray(content)) {
|
|
1643
|
+
let diffCount = 0;
|
|
1644
|
+
for (const entry of content) {
|
|
1645
|
+
if (isTruncatedFileChangesMarker(entry)) {
|
|
1646
|
+
fileChangesTruncated = true;
|
|
1647
|
+
continue;
|
|
1648
|
+
}
|
|
1649
|
+
if (entry === null || typeof entry !== "object") continue;
|
|
1650
|
+
const block = entry;
|
|
1651
|
+
if (block["type"] !== "diff") continue;
|
|
1652
|
+
diffCount += 1;
|
|
1653
|
+
const diffPath = block["path"];
|
|
1654
|
+
const newText = block["newText"];
|
|
1655
|
+
if (diffCount > MAX_ACP_FILE_CHANGES || !isValidAcpFilePath(diffPath) || typeof newText !== "string") {
|
|
1656
|
+
fileChangesTruncated = true;
|
|
1657
|
+
continue;
|
|
1658
|
+
}
|
|
1659
|
+
if (!seenPaths.has(diffPath)) {
|
|
1660
|
+
if (merged.length >= MAX_ACP_FILE_CHANGES) {
|
|
1661
|
+
fileChangesTruncated = true;
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
seenPaths.add(diffPath);
|
|
1665
|
+
merged.push(acpFileChangeFromDiffBlock(block, diffPath));
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1481
1668
|
}
|
|
1669
|
+
const requestType = canonicalRequestTypeFromAcpKind(permissionRequest.kind);
|
|
1482
1670
|
const locations = permissionRequest.toolCall?.data["locations"];
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1671
|
+
const hasLocationTruncationMarker = Array.isArray(locations) && locations.some(isTruncatedFileChangesMarker);
|
|
1672
|
+
if (Array.isArray(locations) && (merged.length > 0 || requestType === "file_change_approval" || requestType === "file_read_approval" || hasLocationTruncationMarker)) {
|
|
1673
|
+
let locationEntries = 0;
|
|
1674
|
+
for (const entry of locations) {
|
|
1675
|
+
if (isTruncatedFileChangesMarker(entry)) {
|
|
1676
|
+
fileChangesTruncated = true;
|
|
1677
|
+
continue;
|
|
1678
|
+
}
|
|
1679
|
+
locationEntries += 1;
|
|
1680
|
+
if (locationEntries > MAX_ACP_FILE_CHANGES) {
|
|
1681
|
+
fileChangesTruncated = true;
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
const rawPath = entry !== null && typeof entry === "object" ? entry["path"] : void 0;
|
|
1685
|
+
if (!isValidAcpFilePath(rawPath)) {
|
|
1686
|
+
fileChangesTruncated = true;
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
if (!seenPaths.has(rawPath)) {
|
|
1690
|
+
if (merged.length >= MAX_ACP_FILE_CHANGES) {
|
|
1691
|
+
fileChangesTruncated = true;
|
|
1692
|
+
continue;
|
|
1693
|
+
}
|
|
1694
|
+
seenPaths.add(rawPath);
|
|
1695
|
+
merged.push({ path: rawPath, omitted: "unavailable" });
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (merged.length > MAX_DISPLAY_FILE_CHANGES) {
|
|
1700
|
+
fileChangesTruncated = true;
|
|
1701
|
+
}
|
|
1702
|
+
return {
|
|
1703
|
+
fileChanges: merged.length > 0 ? merged : void 0,
|
|
1704
|
+
fileChangesTruncated
|
|
1705
|
+
};
|
|
1488
1706
|
}
|
|
1489
1707
|
function runtimeItemStatusFromAcpToolStatus(status) {
|
|
1490
1708
|
switch (status) {
|
|
@@ -1501,7 +1719,19 @@ function runtimeItemStatusFromAcpToolStatus(status) {
|
|
|
1501
1719
|
}
|
|
1502
1720
|
function makeAcpRequestOpenedEvent(input2) {
|
|
1503
1721
|
const requestType = canonicalRequestTypeFromAcpKind(input2.permissionRequest.kind);
|
|
1504
|
-
const
|
|
1722
|
+
const isDynamicToolKind = input2.permissionRequest.kind === "other" || input2.permissionRequest.kind === "unknown";
|
|
1723
|
+
const cleared = input2.permissionRequest.toolCall ? readToolCallIdentityFields(input2.permissionRequest.toolCall) : void 0;
|
|
1724
|
+
const rawRecord = input2.rawPayload !== null && typeof input2.rawPayload === "object" ? input2.rawPayload : void 0;
|
|
1725
|
+
const rawToolCall = rawRecord !== void 0 && rawRecord["toolCall"] !== null && typeof rawRecord["toolCall"] === "object" ? rawRecord["toolCall"] : void 0;
|
|
1726
|
+
const rawToolMeta = rawToolCall !== void 0 && rawToolCall["_meta"] !== null && typeof rawToolCall["_meta"] === "object" ? rawToolCall["_meta"] : void 0;
|
|
1727
|
+
const rawParentMeta = rawRecord !== void 0 && rawRecord["_meta"] !== null && typeof rawRecord["_meta"] === "object" ? rawRecord["_meta"] : void 0;
|
|
1728
|
+
const negativeMcp = cleared?.negativeMcp === true || cleared?.mcpServer === null || cleared?.mcpTool === null || rawToolCall?.["mcpServer"] === null || rawToolCall?.["mcpTool"] === null || rawToolMeta?.["is_mcp_tool_call"] === false || rawParentMeta?.["is_mcp_tool_call"] === false;
|
|
1729
|
+
const candidateToolName = requestType === "dynamic_tool_call" && isDynamicToolKind && typeof input2.permissionRequest.toolCall?.data["name"] === "string" ? input2.permissionRequest.toolCall.data["name"] : void 0;
|
|
1730
|
+
const toolName = candidateToolName !== void 0 && !(negativeMcp && /^(?:(?:Running|Run)\s+)?mcp_/u.test(candidateToolName.trim())) ? candidateToolName : void 0;
|
|
1731
|
+
const { fileChanges, fileChangesTruncated } = inspectAcpPermissionFileChanges(
|
|
1732
|
+
input2.permissionRequest,
|
|
1733
|
+
input2.fileChanges
|
|
1734
|
+
);
|
|
1505
1735
|
return {
|
|
1506
1736
|
type: "request.opened",
|
|
1507
1737
|
...input2.stamp,
|
|
@@ -1516,7 +1746,8 @@ function makeAcpRequestOpenedEvent(input2) {
|
|
|
1516
1746
|
args: input2.args,
|
|
1517
1747
|
...input2.statement !== void 0 ? { statement: input2.statement } : {},
|
|
1518
1748
|
...input2.options ? { options: input2.options } : {},
|
|
1519
|
-
...
|
|
1749
|
+
...fileChanges ? { fileChanges } : {},
|
|
1750
|
+
...fileChangesTruncated ? { fileChangesTruncated: true } : {},
|
|
1520
1751
|
declineReasonRelay: "queued"
|
|
1521
1752
|
},
|
|
1522
1753
|
raw: {
|
|
@@ -1558,7 +1789,8 @@ function makeAcpPlanUpdatedEvent(input2) {
|
|
|
1558
1789
|
}
|
|
1559
1790
|
function makeAcpToolCallEvent(input2) {
|
|
1560
1791
|
const runtimeStatus = runtimeItemStatusFromAcpToolStatus(input2.toolCall.status);
|
|
1561
|
-
const
|
|
1792
|
+
const rawData = input2.toolCall.data;
|
|
1793
|
+
const data = readToolCallIdentityFields(input2.toolCall).negativeMcp ? { ...rawData, mcpServer: null, mcpTool: null } : rawData;
|
|
1562
1794
|
return {
|
|
1563
1795
|
type: input2.toolCall.status === "completed" || input2.toolCall.status === "failed" ? "item.completed" : "item.updated",
|
|
1564
1796
|
...input2.stamp,
|
|
@@ -1613,29 +1845,45 @@ function makeAcpContentDeltaEvent(input2) {
|
|
|
1613
1845
|
}
|
|
1614
1846
|
};
|
|
1615
1847
|
}
|
|
1848
|
+
function toolCallTrackingKey(sessionId, toolCallId) {
|
|
1849
|
+
return sessionId === void 0 ? toolCallId : `${sessionId}\0${toolCallId}`;
|
|
1850
|
+
}
|
|
1616
1851
|
function retainToolCallUpdate(toolCalls, next, seen) {
|
|
1617
|
-
const
|
|
1618
|
-
const
|
|
1852
|
+
const key = toolCallTrackingKey(seen.sessionId, next.toolCallId);
|
|
1853
|
+
const tracked = toolCalls.get(key);
|
|
1854
|
+
const identityChanged = tracked !== void 0 && toolCallIdentityChanged(
|
|
1855
|
+
{
|
|
1856
|
+
name: tracked.state.data["name"],
|
|
1857
|
+
kind: tracked.state.kind,
|
|
1858
|
+
mcpServer: tracked.state.data["mcpServer"],
|
|
1859
|
+
mcpTool: tracked.state.data["mcpTool"]
|
|
1860
|
+
},
|
|
1861
|
+
readToolCallIdentityFields(next)
|
|
1862
|
+
);
|
|
1863
|
+
const reset = seen.isNewCall === true || identityChanged;
|
|
1864
|
+
const effectiveTracked = reset ? void 0 : tracked;
|
|
1865
|
+
const previous = effectiveTracked?.state;
|
|
1619
1866
|
const nextToolCall = mergeToolCallState(previous, next);
|
|
1620
1867
|
const decision = decideToolCallUpdateEmission({
|
|
1621
1868
|
previous,
|
|
1622
1869
|
next: nextToolCall,
|
|
1623
|
-
lastEmittedDetailLength:
|
|
1624
|
-
skippedSinceEmit:
|
|
1870
|
+
lastEmittedDetailLength: effectiveTracked?.lastEmittedDetailLength,
|
|
1871
|
+
skippedSinceEmit: effectiveTracked?.skippedSinceEmit ?? 0
|
|
1625
1872
|
});
|
|
1626
1873
|
if (nextToolCall.status === "completed" || nextToolCall.status === "failed") {
|
|
1627
|
-
toolCalls.delete(
|
|
1874
|
+
toolCalls.delete(key);
|
|
1628
1875
|
} else {
|
|
1629
|
-
toolCalls.set(
|
|
1876
|
+
toolCalls.set(key, {
|
|
1630
1877
|
state: nextToolCall,
|
|
1631
|
-
lastEmittedDetailLength: decision.emit ? nextToolCall.detail?.length :
|
|
1878
|
+
lastEmittedDetailLength: decision.emit ? nextToolCall.detail?.length : effectiveTracked?.lastEmittedDetailLength,
|
|
1632
1879
|
skippedSinceEmit: decision.skippedSinceEmit,
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1880
|
+
sessionId: seen.sessionId ?? effectiveTracked?.sessionId,
|
|
1881
|
+
turnId: effectiveTracked === void 0 ? seen.turnId : effectiveTracked.turnId,
|
|
1882
|
+
startedAtMs: effectiveTracked?.startedAtMs ?? (nextToolCall.status === "inProgress" ? seen.nowMs() : void 0),
|
|
1883
|
+
rawTitle: typeof seen.rawTitle === "string" ? seen.rawTitle : readToolCallIdentityFields(nextToolCall).negativeMcp && effectiveTracked?.rawTitle !== void 0 && /^(?:(?:Running|Run)\s+)?mcp_/u.test(effectiveTracked.rawTitle.trim()) ? void 0 : effectiveTracked?.rawTitle
|
|
1636
1884
|
});
|
|
1637
1885
|
}
|
|
1638
|
-
return { nextToolCall, decision };
|
|
1886
|
+
return { nextToolCall, decision, reset };
|
|
1639
1887
|
}
|
|
1640
1888
|
|
|
1641
1889
|
// ../../packages/ycodium-acp-executor/src/executor/child-sessions.ts
|
|
@@ -25922,8 +26170,15 @@ function parseAcpResumeCursor(raw, schemaVersion) {
|
|
|
25922
26170
|
function acpPromptSettlementBelongsToContext(input2) {
|
|
25923
26171
|
return input2.liveAcpSessionId === input2.expectedAcpSessionId && (input2.liveActiveTurnId === input2.turnId || input2.liveSessionActiveTurnId === input2.turnId);
|
|
25924
26172
|
}
|
|
26173
|
+
function isAcpPermissionOption(value) {
|
|
26174
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
26175
|
+
return false;
|
|
26176
|
+
}
|
|
26177
|
+
const option = value;
|
|
26178
|
+
return typeof option["optionId"] === "string" && typeof option["name"] === "string" && typeof option["kind"] === "string";
|
|
26179
|
+
}
|
|
25925
26180
|
function isAcpRequestPermissionParams(value) {
|
|
25926
|
-
if (typeof value !== "object" || value === null) {
|
|
26181
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
25927
26182
|
return false;
|
|
25928
26183
|
}
|
|
25929
26184
|
const record4 = value;
|
|
@@ -25931,13 +26186,13 @@ function isAcpRequestPermissionParams(value) {
|
|
|
25931
26186
|
return false;
|
|
25932
26187
|
}
|
|
25933
26188
|
const toolCall = record4["toolCall"];
|
|
25934
|
-
if (typeof toolCall !== "object" || toolCall === null) {
|
|
26189
|
+
if (typeof toolCall !== "object" || toolCall === null || Array.isArray(toolCall)) {
|
|
25935
26190
|
return false;
|
|
25936
26191
|
}
|
|
25937
26192
|
if (typeof toolCall["toolCallId"] !== "string") {
|
|
25938
26193
|
return false;
|
|
25939
26194
|
}
|
|
25940
|
-
return Array.isArray(record4["options"]);
|
|
26195
|
+
return Array.isArray(record4["options"]) && record4["options"].every(isAcpPermissionOption);
|
|
25941
26196
|
}
|
|
25942
26197
|
|
|
25943
26198
|
// ../../packages/ycodium-acp-executor/src/apply-effort.ts
|
|
@@ -26863,15 +27118,123 @@ function createExecutorRequests({
|
|
|
26863
27118
|
})
|
|
26864
27119
|
);
|
|
26865
27120
|
};
|
|
27121
|
+
const permissionMutationsByKey = /* @__PURE__ */ new Map();
|
|
27122
|
+
const trackingKeyByRequestId = /* @__PURE__ */ new Map();
|
|
27123
|
+
let nextSettlementSeq = 0;
|
|
27124
|
+
const readCommittedBaseline = (trackingKey) => {
|
|
27125
|
+
const pendingList = permissionMutationsByKey.get(trackingKey);
|
|
27126
|
+
if (pendingList !== void 0 && pendingList.length > 0) {
|
|
27127
|
+
return pendingList[0].previousTracked;
|
|
27128
|
+
}
|
|
27129
|
+
return toolCalls.get(trackingKey);
|
|
27130
|
+
};
|
|
27131
|
+
const recordPermissionMutation = (entry) => {
|
|
27132
|
+
const list = permissionMutationsByKey.get(entry.trackingKey);
|
|
27133
|
+
if (list !== void 0) list.push(entry);
|
|
27134
|
+
else permissionMutationsByKey.set(entry.trackingKey, [entry]);
|
|
27135
|
+
trackingKeyByRequestId.set(entry.requestId, entry.trackingKey);
|
|
27136
|
+
};
|
|
27137
|
+
const supersedePermissionTrackedState = (trackingKey, supersedeOptions) => {
|
|
27138
|
+
const list = permissionMutationsByKey.get(trackingKey);
|
|
27139
|
+
if (list === void 0) return;
|
|
27140
|
+
if (supersedeOptions?.restoreCommitted && list.length > 0) {
|
|
27141
|
+
restoreTrackedState(trackingKey, list[0].hadPrevious, list[0].previousTracked);
|
|
27142
|
+
}
|
|
27143
|
+
for (const item of list) trackingKeyByRequestId.delete(item.requestId);
|
|
27144
|
+
permissionMutationsByKey.delete(trackingKey);
|
|
27145
|
+
};
|
|
27146
|
+
const restoreTrackedState = (trackingKey, hadPrevious, previousTracked) => {
|
|
27147
|
+
if (hadPrevious && previousTracked !== void 0) {
|
|
27148
|
+
toolCalls.set(trackingKey, previousTracked);
|
|
27149
|
+
} else {
|
|
27150
|
+
toolCalls.delete(trackingKey);
|
|
27151
|
+
}
|
|
27152
|
+
};
|
|
27153
|
+
const runWithCommittedPermissionBaseline = (trackingKey, applyUpdate, passiveNextState, rawTitle) => {
|
|
27154
|
+
const list = permissionMutationsByKey.get(trackingKey);
|
|
27155
|
+
if (list === void 0 || list.length === 0) {
|
|
27156
|
+
return applyUpdate();
|
|
27157
|
+
}
|
|
27158
|
+
const baseEntry = list[0];
|
|
27159
|
+
restoreTrackedState(trackingKey, baseEntry.hadPrevious, baseEntry.previousTracked);
|
|
27160
|
+
const result = applyUpdate();
|
|
27161
|
+
if (result.reset) {
|
|
27162
|
+
for (const item of list) trackingKeyByRequestId.delete(item.requestId);
|
|
27163
|
+
permissionMutationsByKey.delete(trackingKey);
|
|
27164
|
+
return result;
|
|
27165
|
+
}
|
|
27166
|
+
baseEntry.hadPrevious = toolCalls.has(trackingKey);
|
|
27167
|
+
baseEntry.previousTracked = toolCalls.get(trackingKey);
|
|
27168
|
+
for (const item of list) {
|
|
27169
|
+
if (!item.hadApplied || item.appliedTracked === void 0) continue;
|
|
27170
|
+
const mergedApplied = mergeToolCallState(item.appliedTracked.state, passiveNextState);
|
|
27171
|
+
item.appliedTracked = {
|
|
27172
|
+
...item.appliedTracked,
|
|
27173
|
+
state: mergedApplied,
|
|
27174
|
+
...typeof rawTitle === "string" ? { rawTitle } : {}
|
|
27175
|
+
};
|
|
27176
|
+
}
|
|
27177
|
+
const tail = list[list.length - 1];
|
|
27178
|
+
restoreTrackedState(trackingKey, tail.hadApplied, tail.appliedTracked);
|
|
27179
|
+
return result;
|
|
27180
|
+
};
|
|
27181
|
+
const releasePermissionTrackedState = (requestId, accepted) => {
|
|
27182
|
+
const trackingKey = trackingKeyByRequestId.get(requestId);
|
|
27183
|
+
trackingKeyByRequestId.delete(requestId);
|
|
27184
|
+
if (trackingKey === void 0) return;
|
|
27185
|
+
const list = permissionMutationsByKey.get(trackingKey);
|
|
27186
|
+
if (list === void 0) return;
|
|
27187
|
+
const idx = list.findIndex((item) => item.requestId === requestId);
|
|
27188
|
+
if (idx < 0) return;
|
|
27189
|
+
if (!accepted || !list[idx].hasOwnMutation) {
|
|
27190
|
+
const [removed] = list.splice(idx, 1);
|
|
27191
|
+
if (removed === void 0) return;
|
|
27192
|
+
if (idx < list.length) {
|
|
27193
|
+
list[idx].hadPrevious = removed.hadPrevious;
|
|
27194
|
+
list[idx].previousTracked = removed.previousTracked;
|
|
27195
|
+
return;
|
|
27196
|
+
}
|
|
27197
|
+
if (list.length === 0) {
|
|
27198
|
+
permissionMutationsByKey.delete(trackingKey);
|
|
27199
|
+
}
|
|
27200
|
+
restoreTrackedState(trackingKey, removed.hadPrevious, removed.previousTracked);
|
|
27201
|
+
return;
|
|
27202
|
+
}
|
|
27203
|
+
const acceptedEntry = list[idx];
|
|
27204
|
+
const committed = list.splice(0, idx + 1);
|
|
27205
|
+
for (const item of committed) trackingKeyByRequestId.delete(item.requestId);
|
|
27206
|
+
if (list.length === 0) {
|
|
27207
|
+
permissionMutationsByKey.delete(trackingKey);
|
|
27208
|
+
restoreTrackedState(trackingKey, acceptedEntry.hadApplied, acceptedEntry.appliedTracked);
|
|
27209
|
+
} else {
|
|
27210
|
+
list[0].hadPrevious = acceptedEntry.hadApplied;
|
|
27211
|
+
list[0].previousTracked = acceptedEntry.appliedTracked;
|
|
27212
|
+
}
|
|
27213
|
+
};
|
|
26866
27214
|
const settleApproval = (pending, outcome, decision, reason) => {
|
|
26867
27215
|
if (!approvals.settle(pending, outcome)) {
|
|
26868
27216
|
return false;
|
|
26869
27217
|
}
|
|
27218
|
+
const accepted = outcome.outcome === "selected" && (decision === "accept" || decision === "acceptForSession" || decision === "acceptAlways");
|
|
27219
|
+
releasePermissionTrackedState(pending.requestId, accepted);
|
|
27220
|
+
hooks.onPermissionRequestSettled?.({
|
|
27221
|
+
sessionId: pending.request.sessionId,
|
|
27222
|
+
toolCallId: pending.request.toolCall.toolCallId,
|
|
27223
|
+
accepted,
|
|
27224
|
+
...pending.settlementId === void 0 ? {} : { requestId: pending.settlementId }
|
|
27225
|
+
});
|
|
26870
27226
|
emitResolved(pending, decision, reason);
|
|
26871
27227
|
return true;
|
|
26872
27228
|
};
|
|
26873
27229
|
const settleAllApprovals = (decision) => {
|
|
26874
27230
|
for (const entry of approvals.settleAll({ outcome: "cancelled" })) {
|
|
27231
|
+
releasePermissionTrackedState(entry.requestId, false);
|
|
27232
|
+
hooks.onPermissionRequestSettled?.({
|
|
27233
|
+
sessionId: entry.request.sessionId,
|
|
27234
|
+
toolCallId: entry.request.toolCall.toolCallId,
|
|
27235
|
+
accepted: false,
|
|
27236
|
+
...entry.settlementId === void 0 ? {} : { requestId: entry.settlementId }
|
|
27237
|
+
});
|
|
26875
27238
|
emitResolved(entry, decision);
|
|
26876
27239
|
}
|
|
26877
27240
|
};
|
|
@@ -26949,62 +27312,189 @@ function createExecutorRequests({
|
|
|
26949
27312
|
outcome: optionId !== void 0 ? { outcome: "selected", optionId } : { outcome: "cancelled" }
|
|
26950
27313
|
};
|
|
26951
27314
|
};
|
|
26952
|
-
const handlePermissionRequest = async (
|
|
26953
|
-
if (!isAcpRequestPermissionParams(
|
|
27315
|
+
const handlePermissionRequest = async (rawParams) => {
|
|
27316
|
+
if (!isAcpRequestPermissionParams(rawParams)) {
|
|
26954
27317
|
throw RequestError.invalidParams({ detail: "Malformed session/request_permission" });
|
|
26955
27318
|
}
|
|
26956
|
-
const userInputOutcome = await handlePermissionAsUserInput(
|
|
27319
|
+
const userInputOutcome = await handlePermissionAsUserInput(rawParams);
|
|
26957
27320
|
if (userInputOutcome !== void 0) return userInputOutcome;
|
|
26958
|
-
|
|
26959
|
-
const
|
|
26960
|
-
const
|
|
26961
|
-
|
|
26962
|
-
|
|
26963
|
-
|
|
26964
|
-
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
|
|
26969
|
-
return { outcome: { outcome: "selected", optionId } };
|
|
26970
|
-
}
|
|
27321
|
+
failIfDisposed();
|
|
27322
|
+
const settlementId = `perm-${++nextSettlementSeq}`;
|
|
27323
|
+
const transformed = hooks.transformPermissionRequest ? hooks.transformPermissionRequest(rawParams, { requestId: settlementId }) : rawParams;
|
|
27324
|
+
if (!isAcpRequestPermissionParams(transformed)) {
|
|
27325
|
+
hooks.onPermissionRequestSettled?.({
|
|
27326
|
+
sessionId: rawParams.sessionId,
|
|
27327
|
+
toolCallId: rawParams.toolCall.toolCallId,
|
|
27328
|
+
accepted: false,
|
|
27329
|
+
requestId: settlementId
|
|
27330
|
+
});
|
|
27331
|
+
throw RequestError.invalidParams({ detail: "Malformed session/request_permission" });
|
|
26971
27332
|
}
|
|
26972
|
-
const
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
|
|
26977
|
-
const
|
|
26978
|
-
const
|
|
26979
|
-
const
|
|
26980
|
-
const
|
|
26981
|
-
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
27333
|
+
const params = transformed;
|
|
27334
|
+
const trackingKey = toolCallTrackingKey(params.sessionId, params.toolCall.toolCallId);
|
|
27335
|
+
const immediateHadPrevious = toolCalls.has(trackingKey);
|
|
27336
|
+
const immediatePrevious = toolCalls.get(trackingKey);
|
|
27337
|
+
let mutatedToolCall = false;
|
|
27338
|
+
const hasTextField = (record4, key) => typeof record4[key] === "string" && record4[key].trim().length > 0;
|
|
27339
|
+
const rawToolCallRecord = rawParams.toolCall;
|
|
27340
|
+
const rawReqMeta = rawToolCallRecord["_meta"];
|
|
27341
|
+
const rawParentMeta = rawParams["_meta"];
|
|
27342
|
+
const transformedToolCallRecord = params.toolCall;
|
|
27343
|
+
const transformedReqMeta = transformedToolCallRecord["_meta"];
|
|
27344
|
+
const transformedParentMeta = params["_meta"];
|
|
27345
|
+
const hasExplicitNegativeMeta = isRecord3(rawReqMeta) && rawReqMeta["is_mcp_tool_call"] === false || isRecord3(rawParentMeta) && rawParentMeta["is_mcp_tool_call"] === false || isRecord3(transformedReqMeta) && transformedReqMeta["is_mcp_tool_call"] === false || isRecord3(transformedParentMeta) && transformedParentMeta["is_mcp_tool_call"] === false;
|
|
27346
|
+
let hasOwnMutation = false;
|
|
27347
|
+
const prepared = (() => {
|
|
27348
|
+
try {
|
|
27349
|
+
const existingPendingList = permissionMutationsByKey.get(trackingKey);
|
|
27350
|
+
const hasPendingSibling = existingPendingList !== void 0 && existingPendingList.length > 0;
|
|
27351
|
+
const tracked = readCommittedBaseline(trackingKey);
|
|
27352
|
+
const requestFields = params.toolCall;
|
|
27353
|
+
const identityChanged = tracked !== void 0 && toolCallIdentityChanged(
|
|
27354
|
+
{
|
|
27355
|
+
name: tracked.state.data["name"],
|
|
27356
|
+
kind: tracked.state.kind,
|
|
27357
|
+
mcpServer: tracked.state.data["mcpServer"],
|
|
27358
|
+
mcpTool: tracked.state.data["mcpTool"]
|
|
27359
|
+
},
|
|
27360
|
+
{
|
|
27361
|
+
name: requestFields.name,
|
|
27362
|
+
kind: params.toolCall.kind,
|
|
27363
|
+
mcpServer: requestFields.mcpServer,
|
|
27364
|
+
mcpTool: requestFields.mcpTool
|
|
27365
|
+
}
|
|
27366
|
+
);
|
|
27367
|
+
const effectiveTracked = identityChanged ? void 0 : tracked;
|
|
27368
|
+
const parsed = parsePermissionRequest(params, effectiveTracked);
|
|
27369
|
+
const trackedNegativeMcp = tracked !== void 0 && readToolCallIdentityFields(tracked.state).negativeMcp;
|
|
27370
|
+
const parsedNegativeMcp = parsed.toolCall !== void 0 && readToolCallIdentityFields(parsed.toolCall).negativeMcp;
|
|
27371
|
+
const introducedTransformedIdentity = typeof requestFields.name === "string" && requestFields.name.trim().length > 0 && requestFields.name !== tracked?.state.data["name"] || typeof requestFields.mcpServer === "string" && requestFields.mcpServer.trim().length > 0 && requestFields.mcpServer !== tracked?.state.data["mcpServer"] || typeof requestFields.mcpTool === "string" && requestFields.mcpTool.trim().length > 0 && requestFields.mcpTool !== tracked?.state.data["mcpTool"];
|
|
27372
|
+
hasOwnMutation = identityChanged || hasExplicitNegativeMeta || trackedNegativeMcp !== parsedNegativeMcp || introducedTransformedIdentity || hasTextField(rawToolCallRecord, "name") || rawToolCallRecord["name"] === null || requestFields.name === null || hasTextField(rawToolCallRecord, "mcpServer") || rawToolCallRecord["mcpServer"] === null || requestFields.mcpServer === null || hasTextField(rawToolCallRecord, "mcpTool") || rawToolCallRecord["mcpTool"] === null || requestFields.mcpTool === null || hasTextField(rawToolCallRecord, "title") || hasTextField(rawToolCallRecord, "kind") && rawToolCallRecord["kind"].trim() !== "other" || rawToolCallRecord["status"] !== void 0 && rawToolCallRecord["status"] !== null || rawToolCallRecord["rawInput"] !== void 0 || rawToolCallRecord["rawOutput"] !== void 0 || rawToolCallRecord["content"] !== void 0 || rawToolCallRecord["locations"] !== void 0;
|
|
27373
|
+
const retainedRawTitle = typeof params.toolCall.title === "string" ? params.toolCall.title : parsedNegativeMcp && effectiveTracked?.rawTitle !== void 0 && /^(?:(?:Running|Run)\s+)?mcp_/u.test(effectiveTracked.rawTitle.trim()) ? void 0 : effectiveTracked?.rawTitle;
|
|
27374
|
+
if (hasOwnMutation || !hasPendingSibling) {
|
|
27375
|
+
if (parsed.toolCall === void 0) {
|
|
27376
|
+
if (identityChanged && toolCalls.delete(trackingKey)) {
|
|
27377
|
+
mutatedToolCall = true;
|
|
27378
|
+
}
|
|
27379
|
+
} else {
|
|
27380
|
+
if (parsed.toolCall.status === "completed" || parsed.toolCall.status === "failed") {
|
|
27381
|
+
if (toolCalls.delete(trackingKey)) {
|
|
27382
|
+
mutatedToolCall = true;
|
|
27383
|
+
}
|
|
27384
|
+
} else {
|
|
27385
|
+
mutatedToolCall = true;
|
|
27386
|
+
toolCalls.set(trackingKey, {
|
|
27387
|
+
state: parsed.toolCall,
|
|
27388
|
+
lastEmittedDetailLength: effectiveTracked?.lastEmittedDetailLength,
|
|
27389
|
+
skippedSinceEmit: effectiveTracked?.skippedSinceEmit ?? 0,
|
|
27390
|
+
sessionId: params.sessionId,
|
|
27391
|
+
turnId: effectiveTracked?.turnId ?? shared.activeTurnId,
|
|
27392
|
+
startedAtMs: effectiveTracked?.startedAtMs,
|
|
27393
|
+
rawTitle: retainedRawTitle
|
|
27394
|
+
});
|
|
27395
|
+
}
|
|
27396
|
+
}
|
|
27397
|
+
}
|
|
27398
|
+
const overriddenKind = hooks.permissionRequestKind?.({
|
|
27399
|
+
title: retainedRawTitle,
|
|
27400
|
+
kind: parsed.kind,
|
|
27401
|
+
rawInput: parsed.toolCall?.data["rawInput"]
|
|
27402
|
+
});
|
|
27403
|
+
const permissionRequest2 = overriddenKind === void 0 ? parsed : { ...parsed, kind: overriddenKind };
|
|
27404
|
+
if (options.autoApprove?.(permissionRequest2) === true) {
|
|
27405
|
+
const optionId = selectAutoApprovedAcpPermissionOption(params);
|
|
27406
|
+
if (optionId !== void 0) {
|
|
27407
|
+
if (hasOwnMutation) {
|
|
27408
|
+
supersedePermissionTrackedState(trackingKey);
|
|
27409
|
+
}
|
|
27410
|
+
hooks.onPermissionRequestSettled?.({
|
|
27411
|
+
sessionId: params.sessionId,
|
|
27412
|
+
toolCallId: params.toolCall.toolCallId,
|
|
27413
|
+
accepted: true,
|
|
27414
|
+
requestId: settlementId
|
|
27415
|
+
});
|
|
27416
|
+
return { autoApprovedOptionId: optionId };
|
|
27417
|
+
}
|
|
27418
|
+
}
|
|
27419
|
+
const permissionContext = {
|
|
27420
|
+
request: params,
|
|
27421
|
+
permissionRequest: permissionRequest2,
|
|
27422
|
+
previousToolCall: effectiveTracked?.state
|
|
27423
|
+
};
|
|
27424
|
+
const statement = hooks.permissionStatement?.(permissionContext) ?? defaultPermissionStatement(permissionRequest2);
|
|
27425
|
+
const fileChanges = hooks.permissionFileChanges?.(permissionContext) ?? fileChangesFromAcpPermission(permissionRequest2);
|
|
27426
|
+
const requestId2 = randomId();
|
|
27427
|
+
const openedEvent2 = makeAcpRequestOpenedEvent({
|
|
26992
27428
|
stamp: stamp(),
|
|
26993
27429
|
provider: options.provider,
|
|
26994
27430
|
threadId: options.threadId,
|
|
26995
27431
|
turnId: shared.activeTurnId,
|
|
26996
|
-
requestId,
|
|
26997
|
-
permissionRequest,
|
|
26998
|
-
detail: statement.command ??
|
|
26999
|
-
args:
|
|
27432
|
+
requestId: requestId2,
|
|
27433
|
+
permissionRequest: permissionRequest2,
|
|
27434
|
+
detail: statement.command ?? permissionRequest2.detail,
|
|
27435
|
+
args: permissionRequest2.toolCall?.data["rawInput"] ?? params.toolCall.rawInput,
|
|
27000
27436
|
statement,
|
|
27001
27437
|
options: acpApprovalOptions(params),
|
|
27002
27438
|
fileChanges,
|
|
27003
27439
|
source: "acp.jsonrpc",
|
|
27004
27440
|
method: "session/request_permission",
|
|
27005
27441
|
rawPayload: params
|
|
27006
|
-
})
|
|
27007
|
-
|
|
27442
|
+
});
|
|
27443
|
+
return { requestId: requestId2, permissionRequest: permissionRequest2, openedEvent: openedEvent2 };
|
|
27444
|
+
} catch (error62) {
|
|
27445
|
+
if (mutatedToolCall) {
|
|
27446
|
+
restoreTrackedState(trackingKey, immediateHadPrevious, immediatePrevious);
|
|
27447
|
+
}
|
|
27448
|
+
hooks.onPermissionRequestSettled?.({
|
|
27449
|
+
sessionId: params.sessionId,
|
|
27450
|
+
toolCallId: params.toolCall.toolCallId,
|
|
27451
|
+
accepted: false,
|
|
27452
|
+
requestId: settlementId
|
|
27453
|
+
});
|
|
27454
|
+
throw error62;
|
|
27455
|
+
}
|
|
27456
|
+
})();
|
|
27457
|
+
if ("autoApprovedOptionId" in prepared) {
|
|
27458
|
+
return { outcome: { outcome: "selected", optionId: prepared.autoApprovedOptionId } };
|
|
27459
|
+
}
|
|
27460
|
+
const hadApplied = toolCalls.has(trackingKey);
|
|
27461
|
+
const appliedTracked = toolCalls.get(trackingKey);
|
|
27462
|
+
const { requestId, permissionRequest, openedEvent } = prepared;
|
|
27463
|
+
const outcome = await new Promise((resolve2, reject) => {
|
|
27464
|
+
const pending = {
|
|
27465
|
+
requestId,
|
|
27466
|
+
settlementId,
|
|
27467
|
+
request: params,
|
|
27468
|
+
permissionRequest,
|
|
27469
|
+
turnId: shared.activeTurnId,
|
|
27470
|
+
settled: false,
|
|
27471
|
+
resolve: resolve2
|
|
27472
|
+
};
|
|
27473
|
+
if (mutatedToolCall) {
|
|
27474
|
+
recordPermissionMutation({
|
|
27475
|
+
requestId,
|
|
27476
|
+
trackingKey,
|
|
27477
|
+
hasOwnMutation,
|
|
27478
|
+
hadPrevious: immediateHadPrevious,
|
|
27479
|
+
previousTracked: immediatePrevious,
|
|
27480
|
+
hadApplied,
|
|
27481
|
+
appliedTracked
|
|
27482
|
+
});
|
|
27483
|
+
}
|
|
27484
|
+
approvals.add(pending);
|
|
27485
|
+
try {
|
|
27486
|
+
emit(openedEvent);
|
|
27487
|
+
} catch (error62) {
|
|
27488
|
+
reject(error62);
|
|
27489
|
+
approvals.settle(pending, { outcome: "cancelled" });
|
|
27490
|
+
releasePermissionTrackedState(requestId, false);
|
|
27491
|
+
hooks.onPermissionRequestSettled?.({
|
|
27492
|
+
sessionId: params.sessionId,
|
|
27493
|
+
toolCallId: params.toolCall.toolCallId,
|
|
27494
|
+
accepted: false,
|
|
27495
|
+
requestId: settlementId
|
|
27496
|
+
});
|
|
27497
|
+
}
|
|
27008
27498
|
});
|
|
27009
27499
|
return { outcome };
|
|
27010
27500
|
};
|
|
@@ -27062,7 +27552,9 @@ function createExecutorRequests({
|
|
|
27062
27552
|
makeExtensionContext,
|
|
27063
27553
|
handlePermissionRequest,
|
|
27064
27554
|
respondToRequest,
|
|
27065
|
-
respondToUserInput
|
|
27555
|
+
respondToUserInput,
|
|
27556
|
+
supersedePermissionTrackedState,
|
|
27557
|
+
runWithCommittedPermissionBaseline
|
|
27066
27558
|
};
|
|
27067
27559
|
}
|
|
27068
27560
|
|
|
@@ -27964,7 +28456,9 @@ function createExecutorUpdates({
|
|
|
27964
28456
|
emitArtifacts,
|
|
27965
28457
|
closeActiveAssistantSegment,
|
|
27966
28458
|
ensureActiveAssistantSegment,
|
|
27967
|
-
shared
|
|
28459
|
+
shared,
|
|
28460
|
+
supersedePermissionTrackedState,
|
|
28461
|
+
runWithCommittedPermissionBaseline
|
|
27968
28462
|
}) {
|
|
27969
28463
|
const shownToolCallIds = /* @__PURE__ */ new Set();
|
|
27970
28464
|
const markChildSession = shared.childSessions.mark;
|
|
@@ -28105,7 +28599,7 @@ function createExecutorUpdates({
|
|
|
28105
28599
|
sessionId: shared.sessionId,
|
|
28106
28600
|
markChildSession
|
|
28107
28601
|
});
|
|
28108
|
-
const handleSessionUpdate = (params) => {
|
|
28602
|
+
const handleSessionUpdate = (params, rawWireUpdate) => {
|
|
28109
28603
|
const update = params.update;
|
|
28110
28604
|
const reportedOptions = update["configOptions"];
|
|
28111
28605
|
if (update["sessionUpdate"] === "config_option_update" && Array.isArray(reportedOptions)) {
|
|
@@ -28141,11 +28635,45 @@ function createExecutorUpdates({
|
|
|
28141
28635
|
}
|
|
28142
28636
|
for (const event of parsed.events) {
|
|
28143
28637
|
if (event._tag === "ToolCallUpdated") {
|
|
28144
|
-
const
|
|
28638
|
+
const isNewCall = params.update.sessionUpdate === "tool_call";
|
|
28639
|
+
const shownKey = toolCallTrackingKey(params.sessionId, event.toolCall.toolCallId);
|
|
28640
|
+
const wireRecord = isRecord3(rawWireUpdate) ? rawWireUpdate : void 0;
|
|
28641
|
+
const wireMeta = wireRecord !== void 0 && isRecord3(wireRecord["_meta"]) ? wireRecord["_meta"] : void 0;
|
|
28642
|
+
const wireParentMeta = isRecord3(params._meta) ? params._meta : void 0;
|
|
28643
|
+
const hasWireIdentity = wireRecord !== void 0 && (typeof wireRecord["name"] === "string" && wireRecord["name"].trim().length > 0 || wireRecord["name"] === null || typeof wireRecord["mcpServer"] === "string" && wireRecord["mcpServer"].trim().length > 0 || wireRecord["mcpServer"] === null || typeof wireRecord["mcpTool"] === "string" && wireRecord["mcpTool"].trim().length > 0 || wireRecord["mcpTool"] === null || typeof wireRecord["kind"] === "string" && wireRecord["kind"].trim().length > 0 && wireRecord["kind"].trim() !== "other" || wireMeta?.["is_mcp_tool_call"] === false || wireParentMeta?.["is_mcp_tool_call"] === false);
|
|
28644
|
+
const rawTitle = params.update.title;
|
|
28645
|
+
const supersedesPendingPermission = isNewCall || event.toolCall.status === "completed" || event.toolCall.status === "failed" || hasWireIdentity;
|
|
28646
|
+
if (supersedesPendingPermission) {
|
|
28647
|
+
supersedePermissionTrackedState?.(shownKey, { restoreCommitted: true });
|
|
28648
|
+
}
|
|
28649
|
+
const runRetain = () => retainToolCallUpdate(toolCalls, event.toolCall, {
|
|
28650
|
+
sessionId: params.sessionId,
|
|
28145
28651
|
turnId: shared.activeTurnId,
|
|
28146
|
-
rawTitle
|
|
28652
|
+
rawTitle,
|
|
28653
|
+
isNewCall,
|
|
28147
28654
|
nowMs
|
|
28148
28655
|
});
|
|
28656
|
+
const updateRecord = params.update;
|
|
28657
|
+
const passiveRawTitle = wireRecord !== void 0 ? wireRecord["title"] : updateRecord["title"];
|
|
28658
|
+
const passiveWireState = !supersedesPendingPermission && runWithCommittedPermissionBaseline !== void 0 ? makeToolCallState({
|
|
28659
|
+
toolCallId: event.toolCall.toolCallId,
|
|
28660
|
+
title: typeof passiveRawTitle === "string" ? passiveRawTitle : void 0,
|
|
28661
|
+
status: updateRecord["status"],
|
|
28662
|
+
rawInput: updateRecord["rawInput"],
|
|
28663
|
+
rawOutput: updateRecord["rawOutput"],
|
|
28664
|
+
content: updateRecord["content"],
|
|
28665
|
+
locations: updateRecord["locations"]
|
|
28666
|
+
}) : void 0;
|
|
28667
|
+
const { nextToolCall, decision, reset } = !supersedesPendingPermission && runWithCommittedPermissionBaseline !== void 0 ? runWithCommittedPermissionBaseline(
|
|
28668
|
+
shownKey,
|
|
28669
|
+
runRetain,
|
|
28670
|
+
passiveWireState ?? event.toolCall,
|
|
28671
|
+
rawTitle
|
|
28672
|
+
) : runRetain();
|
|
28673
|
+
if (reset) {
|
|
28674
|
+
supersedePermissionTrackedState?.(shownKey);
|
|
28675
|
+
shownToolCallIds.delete(shownKey);
|
|
28676
|
+
}
|
|
28149
28677
|
const hasToolHooks = toolSubagents !== void 0 || hooks.onToolCallUpdated !== void 0;
|
|
28150
28678
|
const toolName = typeof nextToolCall.data["name"] === "string" ? nextToolCall.data["name"] : void 0;
|
|
28151
28679
|
const call = !hasToolHooks ? void 0 : {
|
|
@@ -28171,8 +28699,8 @@ function createExecutorUpdates({
|
|
|
28171
28699
|
continue;
|
|
28172
28700
|
}
|
|
28173
28701
|
const toolTurnId = (hookResult !== void 0 && "events" in hookResult ? hookResult.turnId : void 0) ?? shared.activeTurnId;
|
|
28174
|
-
if (!shownToolCallIds.has(
|
|
28175
|
-
rememberShownToolCall(
|
|
28702
|
+
if (isNewCall || !shownToolCallIds.has(shownKey)) {
|
|
28703
|
+
rememberShownToolCall(shownKey);
|
|
28176
28704
|
if (toolTurnId === shared.activeTurnId) closeActiveAssistantSegment(shared.activeTurnId);
|
|
28177
28705
|
}
|
|
28178
28706
|
emit(
|
|
@@ -28268,7 +28796,7 @@ function createExecutorUpdates({
|
|
|
28268
28796
|
}
|
|
28269
28797
|
}
|
|
28270
28798
|
};
|
|
28271
|
-
const receiveSessionUpdate = (params) => {
|
|
28799
|
+
const receiveSessionUpdate = (params, rawWireUpdate) => {
|
|
28272
28800
|
const foreign = !shared.ownSessionIds.has(params.sessionId) && (shared.childSessions.has(params.sessionId) || shared.sessionOpensInFlight === 0 && shared.ownSessionIds.size > 0);
|
|
28273
28801
|
emitHookEvents(
|
|
28274
28802
|
subagentSessions?.observe(params, {
|
|
@@ -28283,7 +28811,7 @@ function createExecutorUpdates({
|
|
|
28283
28811
|
emitHookEvents(hooks.onSessionUpdate(params, { ...observeContext(), foreign }));
|
|
28284
28812
|
}
|
|
28285
28813
|
}
|
|
28286
|
-
if (!foreign) handleSessionUpdate(params);
|
|
28814
|
+
if (!foreign) handleSessionUpdate(params, rawWireUpdate);
|
|
28287
28815
|
};
|
|
28288
28816
|
const receiveExtensionNotification = (method, params) => {
|
|
28289
28817
|
if (shared.sessionLoadInFlight || !hooks.onExtensionNotification) return;
|
|
@@ -28482,6 +29010,27 @@ function createAcpExecutor(options) {
|
|
|
28482
29010
|
promptMutex,
|
|
28483
29011
|
shared
|
|
28484
29012
|
});
|
|
29013
|
+
const {
|
|
29014
|
+
settleAllApprovals,
|
|
29015
|
+
settleAllUserInputs,
|
|
29016
|
+
makeExtensionContext,
|
|
29017
|
+
handlePermissionRequest,
|
|
29018
|
+
respondToRequest,
|
|
29019
|
+
respondToUserInput,
|
|
29020
|
+
supersedePermissionTrackedState,
|
|
29021
|
+
runWithCommittedPermissionBaseline
|
|
29022
|
+
} = createExecutorRequests({
|
|
29023
|
+
emit,
|
|
29024
|
+
stamp,
|
|
29025
|
+
options,
|
|
29026
|
+
approvals,
|
|
29027
|
+
pendingUserInputs,
|
|
29028
|
+
failIfDisposed,
|
|
29029
|
+
randomId,
|
|
29030
|
+
hooks,
|
|
29031
|
+
shared,
|
|
29032
|
+
toolCalls
|
|
29033
|
+
});
|
|
28485
29034
|
const {
|
|
28486
29035
|
emitCompactionState,
|
|
28487
29036
|
receiveSessionUpdate,
|
|
@@ -28501,26 +29050,9 @@ function createAcpExecutor(options) {
|
|
|
28501
29050
|
emitArtifacts,
|
|
28502
29051
|
closeActiveAssistantSegment,
|
|
28503
29052
|
ensureActiveAssistantSegment,
|
|
28504
|
-
shared
|
|
28505
|
-
});
|
|
28506
|
-
const {
|
|
28507
|
-
settleAllApprovals,
|
|
28508
|
-
settleAllUserInputs,
|
|
28509
|
-
makeExtensionContext,
|
|
28510
|
-
handlePermissionRequest,
|
|
28511
|
-
respondToRequest,
|
|
28512
|
-
respondToUserInput
|
|
28513
|
-
} = createExecutorRequests({
|
|
28514
|
-
emit,
|
|
28515
|
-
stamp,
|
|
28516
|
-
options,
|
|
28517
|
-
approvals,
|
|
28518
|
-
pendingUserInputs,
|
|
28519
|
-
failIfDisposed,
|
|
28520
|
-
randomId,
|
|
28521
|
-
hooks,
|
|
28522
29053
|
shared,
|
|
28523
|
-
|
|
29054
|
+
supersedePermissionTrackedState,
|
|
29055
|
+
runWithCommittedPermissionBaseline
|
|
28524
29056
|
});
|
|
28525
29057
|
const { rememberSettledPromptKey, abortPendingSettlement, settleFromNotification } = createExecutorSettlement({ hooks, shared });
|
|
28526
29058
|
const promptResults = createPromptResults({ options, shared });
|
|
@@ -28551,8 +29083,9 @@ function createAcpExecutor(options) {
|
|
|
28551
29083
|
onNotification: (notification) => {
|
|
28552
29084
|
if (notification.method === "session/update") {
|
|
28553
29085
|
const params = notification.params;
|
|
29086
|
+
const rawUpdate = params.update;
|
|
28554
29087
|
const transformed = hooks.transformSessionUpdate ? hooks.transformSessionUpdate(params) : params;
|
|
28555
|
-
if (transformed !== void 0) receiveSessionUpdate(transformed);
|
|
29088
|
+
if (transformed !== void 0) receiveSessionUpdate(transformed, rawUpdate);
|
|
28556
29089
|
return;
|
|
28557
29090
|
}
|
|
28558
29091
|
if (settleFromNotification(notification.method, notification.params)) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-grok",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5921",
|
|
4
4
|
"description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@types/node": "24.12.4",
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.5921",
|
|
25
|
+
"ycodium-acp-executor": "0.2.5921",
|
|
25
26
|
"ycodium-credential-account": "0.0.0",
|
|
26
|
-
"ycodium-acp-executor": "0.2.0",
|
|
27
27
|
"ycodium-executor-testing": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|