@wrongstack/acp 1.0.10 → 1.0.12
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/agent.js +1 -1
- package/dist/client.js +36 -6
- package/dist/index.js +36 -6
- package/package.json +3 -3
package/dist/agent.js
CHANGED
|
@@ -1369,7 +1369,7 @@ var ACPSessionStore = class {
|
|
|
1369
1369
|
*/
|
|
1370
1370
|
sessionFile(sessionId) {
|
|
1371
1371
|
if (!isSafePathSegment(sessionId)) return null;
|
|
1372
|
-
if (RESERVED_SESSION_IDS.has(sessionId)) return null;
|
|
1372
|
+
if (RESERVED_SESSION_IDS.has(sessionId.toLowerCase())) return null;
|
|
1373
1373
|
return resolveContainedPath(this.dir, `${sessionId}.json`);
|
|
1374
1374
|
}
|
|
1375
1375
|
/** Ensure the store directory exists. Memoized — only mkdirs once. */
|
package/dist/client.js
CHANGED
|
@@ -2399,13 +2399,9 @@ async function makeACPSubagentRunnerWithStop(options) {
|
|
|
2399
2399
|
} catch {
|
|
2400
2400
|
}
|
|
2401
2401
|
};
|
|
2402
|
+
let result;
|
|
2402
2403
|
try {
|
|
2403
|
-
|
|
2404
|
-
return {
|
|
2405
|
-
result: result.text,
|
|
2406
|
-
iterations: 1,
|
|
2407
|
-
toolCalls: result.toolCalls.length
|
|
2408
|
-
};
|
|
2404
|
+
result = await session.prompt([textContent(task.description)], ctx.signal, onProgress);
|
|
2409
2405
|
} catch (err) {
|
|
2410
2406
|
throw acpErrorToSubagentError(err, options.role ?? "acp-subagent");
|
|
2411
2407
|
} finally {
|
|
@@ -2416,6 +2412,13 @@ async function makeACPSubagentRunnerWithStop(options) {
|
|
|
2416
2412
|
}
|
|
2417
2413
|
}
|
|
2418
2414
|
}
|
|
2415
|
+
const failure = acpTurnFailure(result, options.role ?? "acp-subagent");
|
|
2416
|
+
if (failure) throw failure;
|
|
2417
|
+
return {
|
|
2418
|
+
result: result.text,
|
|
2419
|
+
iterations: 1,
|
|
2420
|
+
toolCalls: result.toolCalls.length
|
|
2421
|
+
};
|
|
2419
2422
|
};
|
|
2420
2423
|
const stop = async () => {
|
|
2421
2424
|
if (shared) {
|
|
@@ -2455,6 +2458,33 @@ function acpErrorToSubagentError(err, subagentId) {
|
|
|
2455
2458
|
}
|
|
2456
2459
|
};
|
|
2457
2460
|
}
|
|
2461
|
+
function acpTurnFailure(result, subagentId) {
|
|
2462
|
+
const fail = (kind, detail) => ({
|
|
2463
|
+
kind,
|
|
2464
|
+
message: `${subagentId}: ${detail}`,
|
|
2465
|
+
retryable: false
|
|
2466
|
+
});
|
|
2467
|
+
switch (result.stopReason) {
|
|
2468
|
+
case "cancelled":
|
|
2469
|
+
return fail("aborted_by_parent", "prompt turn was cancelled before the task completed");
|
|
2470
|
+
case "refusal":
|
|
2471
|
+
return fail("unknown", "agent refused the task (stopReason=refusal)");
|
|
2472
|
+
case "max_tokens":
|
|
2473
|
+
return fail(
|
|
2474
|
+
"budget_tokens",
|
|
2475
|
+
"agent hit its token limit before finishing (stopReason=max_tokens)"
|
|
2476
|
+
);
|
|
2477
|
+
case "max_turn_requests":
|
|
2478
|
+
return fail(
|
|
2479
|
+
"budget_iterations",
|
|
2480
|
+
"agent hit its turn-request limit before finishing (stopReason=max_turn_requests)"
|
|
2481
|
+
);
|
|
2482
|
+
}
|
|
2483
|
+
if (!result.hasText && result.toolCalls.length === 0) {
|
|
2484
|
+
return fail("empty_response", "agent ended its turn with no text and no tool calls");
|
|
2485
|
+
}
|
|
2486
|
+
return null;
|
|
2487
|
+
}
|
|
2458
2488
|
function mapACPKind(acpKind) {
|
|
2459
2489
|
switch (acpKind) {
|
|
2460
2490
|
case "spawn_failed":
|
package/dist/index.js
CHANGED
|
@@ -4350,13 +4350,9 @@ async function makeACPSubagentRunnerWithStop(options) {
|
|
|
4350
4350
|
} catch {
|
|
4351
4351
|
}
|
|
4352
4352
|
};
|
|
4353
|
+
let result;
|
|
4353
4354
|
try {
|
|
4354
|
-
|
|
4355
|
-
return {
|
|
4356
|
-
result: result.text,
|
|
4357
|
-
iterations: 1,
|
|
4358
|
-
toolCalls: result.toolCalls.length
|
|
4359
|
-
};
|
|
4355
|
+
result = await session.prompt([textContent(task.description)], ctx.signal, onProgress);
|
|
4360
4356
|
} catch (err) {
|
|
4361
4357
|
throw acpErrorToSubagentError(err, options.role ?? "acp-subagent");
|
|
4362
4358
|
} finally {
|
|
@@ -4367,6 +4363,13 @@ async function makeACPSubagentRunnerWithStop(options) {
|
|
|
4367
4363
|
}
|
|
4368
4364
|
}
|
|
4369
4365
|
}
|
|
4366
|
+
const failure = acpTurnFailure(result, options.role ?? "acp-subagent");
|
|
4367
|
+
if (failure) throw failure;
|
|
4368
|
+
return {
|
|
4369
|
+
result: result.text,
|
|
4370
|
+
iterations: 1,
|
|
4371
|
+
toolCalls: result.toolCalls.length
|
|
4372
|
+
};
|
|
4370
4373
|
};
|
|
4371
4374
|
const stop = async () => {
|
|
4372
4375
|
if (shared) {
|
|
@@ -4406,6 +4409,33 @@ function acpErrorToSubagentError(err, subagentId) {
|
|
|
4406
4409
|
}
|
|
4407
4410
|
};
|
|
4408
4411
|
}
|
|
4412
|
+
function acpTurnFailure(result, subagentId) {
|
|
4413
|
+
const fail = (kind, detail) => ({
|
|
4414
|
+
kind,
|
|
4415
|
+
message: `${subagentId}: ${detail}`,
|
|
4416
|
+
retryable: false
|
|
4417
|
+
});
|
|
4418
|
+
switch (result.stopReason) {
|
|
4419
|
+
case "cancelled":
|
|
4420
|
+
return fail("aborted_by_parent", "prompt turn was cancelled before the task completed");
|
|
4421
|
+
case "refusal":
|
|
4422
|
+
return fail("unknown", "agent refused the task (stopReason=refusal)");
|
|
4423
|
+
case "max_tokens":
|
|
4424
|
+
return fail(
|
|
4425
|
+
"budget_tokens",
|
|
4426
|
+
"agent hit its token limit before finishing (stopReason=max_tokens)"
|
|
4427
|
+
);
|
|
4428
|
+
case "max_turn_requests":
|
|
4429
|
+
return fail(
|
|
4430
|
+
"budget_iterations",
|
|
4431
|
+
"agent hit its turn-request limit before finishing (stopReason=max_turn_requests)"
|
|
4432
|
+
);
|
|
4433
|
+
}
|
|
4434
|
+
if (!result.hasText && result.toolCalls.length === 0) {
|
|
4435
|
+
return fail("empty_response", "agent ended its turn with no text and no tool calls");
|
|
4436
|
+
}
|
|
4437
|
+
return null;
|
|
4438
|
+
}
|
|
4409
4439
|
function mapACPKind(acpKind) {
|
|
4410
4440
|
switch (acpKind) {
|
|
4411
4441
|
case "spawn_failed":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ACP (Agent Client Protocol) integration for WrongStack — client + agent support",
|
|
6
6
|
"keywords": [
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
55
|
-
"@wrongstack/core": "1.0.
|
|
56
|
-
"@wrongstack/primitives": "1.0.
|
|
55
|
+
"@wrongstack/core": "1.0.12",
|
|
56
|
+
"@wrongstack/primitives": "1.0.12"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^26.5.1",
|