@ycodium-ai/agent-acp 0.2.2984 → 0.2.2990
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 +27 -18
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -23419,6 +23419,12 @@ var AcpExecutorDisposedError = class extends AcpExecutorError {
|
|
|
23419
23419
|
this.name = "AcpExecutorDisposedError";
|
|
23420
23420
|
}
|
|
23421
23421
|
};
|
|
23422
|
+
var AcpExecutorTurnEndedError = class extends AcpExecutorError {
|
|
23423
|
+
constructor(message = "The target turn has ended. The message was not sent.") {
|
|
23424
|
+
super("provider-rejected", message);
|
|
23425
|
+
this.name = "AcpExecutorTurnEndedError";
|
|
23426
|
+
}
|
|
23427
|
+
};
|
|
23422
23428
|
var AcpExecutorNotStartedError = class extends AcpExecutorError {
|
|
23423
23429
|
constructor(message = "ACP session has not been started") {
|
|
23424
23430
|
super("not-started", message);
|
|
@@ -24184,6 +24190,12 @@ function asTrimmedString(value) {
|
|
|
24184
24190
|
const trimmed = value.trim();
|
|
24185
24191
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
24186
24192
|
}
|
|
24193
|
+
var selectPromptTurnId = (input2, activeTurnId, freshTurnId) => {
|
|
24194
|
+
const target = input2.expectedActiveTurnId;
|
|
24195
|
+
if (target === void 0) return input2.turnId ?? activeTurnId ?? freshTurnId();
|
|
24196
|
+
if (activeTurnId !== target) throw new AcpExecutorTurnEndedError();
|
|
24197
|
+
return target;
|
|
24198
|
+
};
|
|
24187
24199
|
|
|
24188
24200
|
// ../../packages/ycodium-acp-executor/src/tool-presentation.ts
|
|
24189
24201
|
function normalizeCommandValue(value) {
|
|
@@ -26353,7 +26365,7 @@ function createAcpExecutor(options) {
|
|
|
26353
26365
|
await threadMutex.acquire();
|
|
26354
26366
|
try {
|
|
26355
26367
|
failIfDisposed();
|
|
26356
|
-
turnId = input2
|
|
26368
|
+
turnId = selectPromptTurnId(input2, promptsInFlight > 0 ? activeTurnId : void 0, randomId);
|
|
26357
26369
|
promptsInFlight += 1;
|
|
26358
26370
|
activeTurnId = turnId;
|
|
26359
26371
|
status = "running";
|
|
@@ -26375,20 +26387,20 @@ function createAcpExecutor(options) {
|
|
|
26375
26387
|
let response;
|
|
26376
26388
|
try {
|
|
26377
26389
|
failIfDisposed();
|
|
26378
|
-
|
|
26390
|
+
const queuedTurnId = turnId;
|
|
26391
|
+
const isStale = () => interruptedTurnIds.has(queuedTurnId) || input2.expectedActiveTurnId !== void 0 && activeTurnId !== queuedTurnId;
|
|
26392
|
+
if (!isStale()) {
|
|
26393
|
+
modelSelectionState = await applyRequestedModel({
|
|
26394
|
+
state: modelSelectionState,
|
|
26395
|
+
acpSessionId: started.sessionId,
|
|
26396
|
+
requestedModelId: input2.requestedModelId,
|
|
26397
|
+
expectedGeneration: started.generation
|
|
26398
|
+
});
|
|
26399
|
+
}
|
|
26400
|
+
if (isStale()) {
|
|
26379
26401
|
settle2({ turnId, stopReason: "cancelled", state: "cancelled" });
|
|
26380
|
-
return {
|
|
26381
|
-
threadId: options.threadId,
|
|
26382
|
-
turnId,
|
|
26383
|
-
stopReason: "cancelled"
|
|
26384
|
-
};
|
|
26402
|
+
return { threadId: options.threadId, turnId, stopReason: "cancelled" };
|
|
26385
26403
|
}
|
|
26386
|
-
modelSelectionState = await applyRequestedModel({
|
|
26387
|
-
state: modelSelectionState,
|
|
26388
|
-
acpSessionId: started.sessionId,
|
|
26389
|
-
requestedModelId: input2.requestedModelId,
|
|
26390
|
-
expectedGeneration: started.generation
|
|
26391
|
-
});
|
|
26392
26404
|
closeActiveAssistantSegment(turnId);
|
|
26393
26405
|
let written = false;
|
|
26394
26406
|
try {
|
|
@@ -26518,10 +26530,7 @@ function createAcpExecutor(options) {
|
|
|
26518
26530
|
provider: options.provider,
|
|
26519
26531
|
threadId: options.threadId,
|
|
26520
26532
|
turnId: targetTurnId,
|
|
26521
|
-
payload: {
|
|
26522
|
-
state: "cancelled",
|
|
26523
|
-
stopReason: "cancelled"
|
|
26524
|
-
}
|
|
26533
|
+
payload: { state: "cancelled", stopReason: "cancelled" }
|
|
26525
26534
|
});
|
|
26526
26535
|
interruptedTurnIds.delete(targetTurnId);
|
|
26527
26536
|
}
|
|
@@ -27400,7 +27409,7 @@ var createAcpInstance = (config2, host) => {
|
|
|
27400
27409
|
const requestedModelId = modelIdFromSelection(input2.modelSelection);
|
|
27401
27410
|
const turn = await dispatchAcpPrompt(booked.executor, {
|
|
27402
27411
|
text: input2.input ?? "",
|
|
27403
|
-
|
|
27412
|
+
expectedActiveTurnId: input2.expectedTurnId,
|
|
27404
27413
|
...requestedModelId === void 0 ? {} : { requestedModelId }
|
|
27405
27414
|
});
|
|
27406
27415
|
booked.turns.push({ id: turn.turnId, items: [] });
|
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.2990",
|
|
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
|
-
"
|
|
25
|
-
"ycodium-
|
|
26
|
-
"ycodium-executor
|
|
24
|
+
"ycodium-executor-testing": "0.0.0",
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.2990",
|
|
26
|
+
"ycodium-acp-executor": "0.2.2990"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|