@wrongstack/acp 1.0.28 → 1.0.29
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 +2 -1
- package/dist/client.js +2 -10
- package/dist/index.js +4 -11
- package/dist/wrongstack-acp-agent.js +2 -1
- package/package.json +4 -3
package/dist/agent.js
CHANGED
|
@@ -294,7 +294,7 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
|
|
|
294
294
|
await ctx.sendError(id, -32602, `cwd must be an absolute path to an existing directory`);
|
|
295
295
|
return false;
|
|
296
296
|
}
|
|
297
|
-
const candidateCwd = persisted.cwd ??
|
|
297
|
+
const candidateCwd = loadCwd ?? persisted.cwd ?? ctx.defaultCwd;
|
|
298
298
|
const restoredCwd = await resolveSessionCwd(candidateCwd) ?? ctx.defaultCwd;
|
|
299
299
|
const restored = {
|
|
300
300
|
id: sessionId,
|
|
@@ -475,6 +475,7 @@ async function handleSessionPromptOp(ctx, id, params) {
|
|
|
475
475
|
let result;
|
|
476
476
|
const pendingNotifications = [];
|
|
477
477
|
const emit = (update) => {
|
|
478
|
+
if (ctx.sessions.get(sessionId) !== session) return;
|
|
478
479
|
const notifPromise = ctx.sendNotification({ sessionId, update });
|
|
479
480
|
pendingNotifications.push(notifPromise.catch(() => {
|
|
480
481
|
}));
|
package/dist/client.js
CHANGED
|
@@ -2199,10 +2199,6 @@ var ACPSession = class _ACPSession {
|
|
|
2199
2199
|
createPromise,
|
|
2200
2200
|
new Promise((_, reject) => {
|
|
2201
2201
|
rejectCreate = reject;
|
|
2202
|
-
if (signal.aborted) {
|
|
2203
|
-
reject(new ACPSessionError("aborted", "prompt was aborted by the parent"));
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
2202
|
signal.addEventListener("abort", onCreateAbort, { once: true });
|
|
2207
2203
|
})
|
|
2208
2204
|
]);
|
|
@@ -2220,12 +2216,6 @@ var ACPSession = class _ACPSession {
|
|
|
2220
2216
|
}
|
|
2221
2217
|
signal.removeEventListener("abort", onCreateAbort);
|
|
2222
2218
|
rejectCreate = void 0;
|
|
2223
|
-
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
2224
|
-
signal.removeEventListener("abort", onAbort);
|
|
2225
|
-
this.promptCallbackAbort?.abort();
|
|
2226
|
-
this.promptCallbackAbort = null;
|
|
2227
|
-
throw new ACPSessionError("protocol_error", "session/new returned no session id");
|
|
2228
|
-
}
|
|
2229
2219
|
this.sessionId = sessionId;
|
|
2230
2220
|
}
|
|
2231
2221
|
if (signal.aborted) {
|
|
@@ -2436,6 +2426,8 @@ var ACPSession = class _ACPSession {
|
|
|
2436
2426
|
return;
|
|
2437
2427
|
}
|
|
2438
2428
|
if (msg.method === "session/update") {
|
|
2429
|
+
const updateSessionId = msg.params?.sessionId;
|
|
2430
|
+
if (typeof updateSessionId === "string" && updateSessionId !== this.sessionId) return;
|
|
2439
2431
|
handleAcpSessionUpdate(msg, this.scratch, (event) => this.emitProgress(event));
|
|
2440
2432
|
return;
|
|
2441
2433
|
}
|
package/dist/index.js
CHANGED
|
@@ -297,7 +297,7 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
|
|
|
297
297
|
await ctx.sendError(id, -32602, `cwd must be an absolute path to an existing directory`);
|
|
298
298
|
return false;
|
|
299
299
|
}
|
|
300
|
-
const candidateCwd = persisted.cwd ??
|
|
300
|
+
const candidateCwd = loadCwd ?? persisted.cwd ?? ctx.defaultCwd;
|
|
301
301
|
const restoredCwd = await resolveSessionCwd(candidateCwd) ?? ctx.defaultCwd;
|
|
302
302
|
const restored = {
|
|
303
303
|
id: sessionId,
|
|
@@ -478,6 +478,7 @@ async function handleSessionPromptOp(ctx, id, params) {
|
|
|
478
478
|
let result;
|
|
479
479
|
const pendingNotifications = [];
|
|
480
480
|
const emit = (update) => {
|
|
481
|
+
if (ctx.sessions.get(sessionId) !== session) return;
|
|
481
482
|
const notifPromise = ctx.sendNotification({ sessionId, update });
|
|
482
483
|
pendingNotifications.push(notifPromise.catch(() => {
|
|
483
484
|
}));
|
|
@@ -3723,10 +3724,6 @@ var ACPSession = class _ACPSession {
|
|
|
3723
3724
|
createPromise,
|
|
3724
3725
|
new Promise((_, reject) => {
|
|
3725
3726
|
rejectCreate = reject;
|
|
3726
|
-
if (signal.aborted) {
|
|
3727
|
-
reject(new ACPSessionError("aborted", "prompt was aborted by the parent"));
|
|
3728
|
-
return;
|
|
3729
|
-
}
|
|
3730
3727
|
signal.addEventListener("abort", onCreateAbort, { once: true });
|
|
3731
3728
|
})
|
|
3732
3729
|
]);
|
|
@@ -3744,12 +3741,6 @@ var ACPSession = class _ACPSession {
|
|
|
3744
3741
|
}
|
|
3745
3742
|
signal.removeEventListener("abort", onCreateAbort);
|
|
3746
3743
|
rejectCreate = void 0;
|
|
3747
|
-
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
3748
|
-
signal.removeEventListener("abort", onAbort);
|
|
3749
|
-
this.promptCallbackAbort?.abort();
|
|
3750
|
-
this.promptCallbackAbort = null;
|
|
3751
|
-
throw new ACPSessionError("protocol_error", "session/new returned no session id");
|
|
3752
|
-
}
|
|
3753
3744
|
this.sessionId = sessionId;
|
|
3754
3745
|
}
|
|
3755
3746
|
if (signal.aborted) {
|
|
@@ -3960,6 +3951,8 @@ var ACPSession = class _ACPSession {
|
|
|
3960
3951
|
return;
|
|
3961
3952
|
}
|
|
3962
3953
|
if (msg.method === "session/update") {
|
|
3954
|
+
const updateSessionId = msg.params?.sessionId;
|
|
3955
|
+
if (typeof updateSessionId === "string" && updateSessionId !== this.sessionId) return;
|
|
3963
3956
|
handleAcpSessionUpdate(msg, this.scratch, (event) => this.emitProgress(event));
|
|
3964
3957
|
return;
|
|
3965
3958
|
}
|
|
@@ -301,7 +301,7 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
|
|
|
301
301
|
await ctx.sendError(id, -32602, `cwd must be an absolute path to an existing directory`);
|
|
302
302
|
return false;
|
|
303
303
|
}
|
|
304
|
-
const candidateCwd = persisted.cwd ??
|
|
304
|
+
const candidateCwd = loadCwd ?? persisted.cwd ?? ctx.defaultCwd;
|
|
305
305
|
const restoredCwd = await resolveSessionCwd(candidateCwd) ?? ctx.defaultCwd;
|
|
306
306
|
const restored = {
|
|
307
307
|
id: sessionId,
|
|
@@ -482,6 +482,7 @@ async function handleSessionPromptOp(ctx, id, params) {
|
|
|
482
482
|
let result;
|
|
483
483
|
const pendingNotifications = [];
|
|
484
484
|
const emit = (update) => {
|
|
485
|
+
if (ctx.sessions.get(sessionId) !== session) return;
|
|
485
486
|
const notifPromise = ctx.sendNotification({ sessionId, update });
|
|
486
487
|
pendingNotifications.push(notifPromise.catch(() => {
|
|
487
488
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
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.29",
|
|
56
|
+
"@wrongstack/primitives": "1.0.29"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^26.5.1",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "node ../../scripts/build-package.mjs",
|
|
68
68
|
"typecheck": "tsc --noEmit",
|
|
69
|
+
"typecheck:tests": "tsc --noEmit -p tsconfig.test.json",
|
|
69
70
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
70
71
|
"test": "vitest run",
|
|
71
72
|
"smoke": "pnpm build && node --experimental-strip-types ../../scripts/acp-smoke-test.mts"
|