@ycodium-ai/agent-acp 0.2.3766 → 0.2.3799
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 +43 -30
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -26016,6 +26016,7 @@ function createExecutorPrompt({
|
|
|
26016
26016
|
promptResults,
|
|
26017
26017
|
settleToolSubagents
|
|
26018
26018
|
}) {
|
|
26019
|
+
const ownOutcomes = /* @__PURE__ */ new Map();
|
|
26019
26020
|
const settleTurn = (input2) => {
|
|
26020
26021
|
if (!isLive(input2.expectedGeneration) || input2.record.finished) {
|
|
26021
26022
|
return false;
|
|
@@ -26032,14 +26033,22 @@ function createExecutorPrompt({
|
|
|
26032
26033
|
}
|
|
26033
26034
|
closeActiveAssistantSegment(input2.turnId);
|
|
26034
26035
|
shared.promptsInFlight = Math.max(0, shared.promptsInFlight - 1);
|
|
26035
|
-
if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId)
|
|
26036
|
+
if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId) {
|
|
26037
|
+
if (input2.foldedIn !== true) ownOutcomes.set(input2.turnId, input2);
|
|
26038
|
+
return false;
|
|
26039
|
+
}
|
|
26040
|
+
const outcome = (input2.foldedIn === true ? ownOutcomes.get(input2.turnId) : void 0) ?? input2;
|
|
26041
|
+
ownOutcomes.delete(input2.turnId);
|
|
26036
26042
|
shared.activeTurnId = void 0;
|
|
26037
26043
|
if (shared.status !== "disposed") {
|
|
26038
26044
|
shared.status = "ready";
|
|
26039
26045
|
}
|
|
26040
26046
|
const interrupted = promptResults.hasInterrupted(input2.turnId);
|
|
26041
26047
|
settleToolSubagents(
|
|
26042
|
-
toolSubagentSettlementOfTurn(
|
|
26048
|
+
toolSubagentSettlementOfTurn(
|
|
26049
|
+
interrupted ? "cancelled" : outcome.state,
|
|
26050
|
+
outcome.failureCategory
|
|
26051
|
+
),
|
|
26043
26052
|
input2.turnId
|
|
26044
26053
|
);
|
|
26045
26054
|
emit({
|
|
@@ -26049,10 +26058,10 @@ function createExecutorPrompt({
|
|
|
26049
26058
|
threadId: options.threadId,
|
|
26050
26059
|
turnId: input2.turnId,
|
|
26051
26060
|
payload: {
|
|
26052
|
-
state: interrupted ? "cancelled" :
|
|
26053
|
-
stopReason: interrupted ? "cancelled" :
|
|
26054
|
-
...
|
|
26055
|
-
...
|
|
26061
|
+
state: interrupted ? "cancelled" : outcome.state,
|
|
26062
|
+
stopReason: interrupted ? "cancelled" : outcome.stopReason,
|
|
26063
|
+
...outcome.errorMessage === void 0 ? {} : { errorMessage: outcome.errorMessage },
|
|
26064
|
+
...outcome.state === "failed" ? failureCategoryField(outcome.failureCategory) : {}
|
|
26056
26065
|
}
|
|
26057
26066
|
});
|
|
26058
26067
|
interruptedTurnIds.delete(input2.turnId);
|
|
@@ -26077,7 +26086,7 @@ function createExecutorPrompt({
|
|
|
26077
26086
|
return await promptRpc;
|
|
26078
26087
|
} else {
|
|
26079
26088
|
const { promise: early, resolve: settleEarly } = Promise.withResolvers();
|
|
26080
|
-
shared.
|
|
26089
|
+
shared.pendingSettlements.set(promptKey, {
|
|
26081
26090
|
promptKey,
|
|
26082
26091
|
sessionId,
|
|
26083
26092
|
settle: settleEarly,
|
|
@@ -26086,7 +26095,7 @@ function createExecutorPrompt({
|
|
|
26086
26095
|
onError: () => promptResults.reject(record2.promptId),
|
|
26087
26096
|
hasResult: () => record2.response !== void 0
|
|
26088
26097
|
}
|
|
26089
|
-
};
|
|
26098
|
+
});
|
|
26090
26099
|
try {
|
|
26091
26100
|
const outcome = await Promise.race([
|
|
26092
26101
|
promptRpc.then((value) => {
|
|
@@ -26099,7 +26108,7 @@ function createExecutorPrompt({
|
|
|
26099
26108
|
if (outcome.error !== void 0) throw outcome.error;
|
|
26100
26109
|
return outcome.response;
|
|
26101
26110
|
} finally {
|
|
26102
|
-
shared.
|
|
26111
|
+
shared.pendingSettlements.delete(promptKey);
|
|
26103
26112
|
void promptRpc.catch(() => void 0);
|
|
26104
26113
|
}
|
|
26105
26114
|
}
|
|
@@ -26249,7 +26258,9 @@ function createExecutorPrompt({
|
|
|
26249
26258
|
settle2({
|
|
26250
26259
|
turnId,
|
|
26251
26260
|
stopReason,
|
|
26252
|
-
state: response2.stopReason === "cancelled" ? "cancelled" : "completed"
|
|
26261
|
+
state: response2.stopReason === "cancelled" ? "cancelled" : "completed",
|
|
26262
|
+
// 立刻写出的插话没被打断却应答 cancelled:agent 把它并进了这一轮(grok 的 removedFromQueue)。
|
|
26263
|
+
foldedIn: response2.stopReason === "cancelled" && input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true
|
|
26253
26264
|
});
|
|
26254
26265
|
return {
|
|
26255
26266
|
threadId: options.threadId,
|
|
@@ -26258,7 +26269,8 @@ function createExecutorPrompt({
|
|
|
26258
26269
|
...response2.usage !== void 0 && response2.usage !== null ? { usage: response2.usage } : {}
|
|
26259
26270
|
};
|
|
26260
26271
|
};
|
|
26261
|
-
|
|
26272
|
+
const writesWhileRunning = input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true;
|
|
26273
|
+
if (!writesWhileRunning) await promptMutex.acquire();
|
|
26262
26274
|
let response;
|
|
26263
26275
|
try {
|
|
26264
26276
|
failIfDisposed();
|
|
@@ -26340,7 +26352,7 @@ function createExecutorPrompt({
|
|
|
26340
26352
|
await options.beforeApplyResult();
|
|
26341
26353
|
}
|
|
26342
26354
|
} finally {
|
|
26343
|
-
promptMutex.release();
|
|
26355
|
+
if (!writesWhileRunning) promptMutex.release();
|
|
26344
26356
|
notifyPromptSettled();
|
|
26345
26357
|
}
|
|
26346
26358
|
if (!isLive(started.generation)) {
|
|
@@ -27436,28 +27448,29 @@ function createExecutorSettlement({
|
|
|
27436
27448
|
if (settledPromptKeys.length > SETTLED_PROMPT_KEY_LIMIT) settledPromptKeys.shift();
|
|
27437
27449
|
};
|
|
27438
27450
|
const abortPendingSettlement = (reason, failureCategory) => {
|
|
27439
|
-
const waiting
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
)
|
|
27448
|
-
}
|
|
27451
|
+
for (const [key, waiting] of shared.pendingSettlements) {
|
|
27452
|
+
if (waiting.hasResult?.()) continue;
|
|
27453
|
+
shared.pendingSettlements.delete(key);
|
|
27454
|
+
waiting.settle({
|
|
27455
|
+
error: withFailureCategory(
|
|
27456
|
+
new AcpExecutorRequestError("session/prompt", reason),
|
|
27457
|
+
failureCategory
|
|
27458
|
+
)
|
|
27459
|
+
});
|
|
27460
|
+
}
|
|
27449
27461
|
};
|
|
27450
27462
|
const settleFromNotification = (method, params) => {
|
|
27451
27463
|
const hook = hooks.promptSettlement;
|
|
27452
|
-
if (hook === void 0 || shared.
|
|
27464
|
+
if (hook === void 0 || shared.pendingSettlements.size === 0) return false;
|
|
27453
27465
|
const signal = hook.fromNotification(method, params);
|
|
27454
27466
|
if (signal === void 0) return false;
|
|
27455
|
-
const waiting = shared.
|
|
27456
|
-
|
|
27457
|
-
|
|
27458
|
-
|
|
27467
|
+
const waiting = signal.promptKey === void 0 ? [...shared.pendingSettlements.values()].find(
|
|
27468
|
+
(candidate) => candidate.sessionId === signal.sessionId
|
|
27469
|
+
) : shared.pendingSettlements.get(signal.promptKey);
|
|
27470
|
+
if (waiting === void 0 || waiting.sessionId !== signal.sessionId) {
|
|
27471
|
+
return signal.promptKey !== void 0 && settledPromptKeys.includes(signal.promptKey);
|
|
27459
27472
|
}
|
|
27460
|
-
shared.
|
|
27473
|
+
shared.pendingSettlements.delete(waiting.promptKey);
|
|
27461
27474
|
rememberSettledPromptKey(waiting.promptKey);
|
|
27462
27475
|
if (signal.outcome === "error") {
|
|
27463
27476
|
waiting.onError?.();
|
|
@@ -28051,7 +28064,7 @@ function createAcpExecutor(options) {
|
|
|
28051
28064
|
startInFlight: void 0,
|
|
28052
28065
|
activeTurnId: void 0,
|
|
28053
28066
|
promptsInFlight: 0,
|
|
28054
|
-
|
|
28067
|
+
pendingSettlements: /* @__PURE__ */ new Map(),
|
|
28055
28068
|
manualCompaction: void 0,
|
|
28056
28069
|
assistantSegment: { nextSegmentIndex: 0 },
|
|
28057
28070
|
modeState: void 0,
|
|
@@ -29331,7 +29344,7 @@ var executors = [
|
|
|
29331
29344
|
];
|
|
29332
29345
|
var index_default = definePlugin({
|
|
29333
29346
|
id: "agent-acp",
|
|
29334
|
-
apiVersion:
|
|
29347
|
+
apiVersion: 60,
|
|
29335
29348
|
executors,
|
|
29336
29349
|
activate(ctx) {
|
|
29337
29350
|
ctx.log.info("generic ACP executor ready");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-acp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3799",
|
|
4
4
|
"description": "Generic ACP executor: user-supplied 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-
|
|
25
|
-
"
|
|
26
|
-
"ycodium-executor
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.3799",
|
|
25
|
+
"ycodium-executor-testing": "0.0.0",
|
|
26
|
+
"ycodium-acp-executor": "0.2.3799"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|