@wrongstack/acp 1.0.28 → 1.0.32
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 +54 -24
- package/dist/client/acp-session-messages.d.ts +24 -0
- package/dist/client/acp-session.d.ts +1 -0
- package/dist/client.js +258 -187
- package/dist/index.js +287 -191
- package/dist/wrongstack-acp-agent.js +24 -1
- package/package.json +4 -3
|
@@ -243,6 +243,10 @@ async function handleSessionNewOp(ctx, id, params) {
|
|
|
243
243
|
}
|
|
244
244
|
const skipped = [];
|
|
245
245
|
const mcpServers = parseMcpServers(p.mcpServers, (reason) => skipped.push(reason));
|
|
246
|
+
if (ctx.sessions.size >= ctx.maxSessions) {
|
|
247
|
+
await ctx.sendError(id, -32e3, `active session limit reached (${ctx.maxSessions})`);
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
246
250
|
const sessionId = `sess_${ctx.allocId()}`;
|
|
247
251
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
248
252
|
const state = {
|
|
@@ -293,6 +297,9 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
|
|
|
293
297
|
if (!existing && sessionId && ctx.store) {
|
|
294
298
|
const persisted = await ctx.store.load(sessionId);
|
|
295
299
|
if (persisted) {
|
|
300
|
+
if (ctx.sessions.has(sessionId)) {
|
|
301
|
+
return handleSessionLoadOp(ctx, id, params, replayHistory);
|
|
302
|
+
}
|
|
296
303
|
if (ctx.sessions.size >= ctx.maxSessions) {
|
|
297
304
|
await ctx.sendError(id, -32e3, `active session limit reached (${ctx.maxSessions})`);
|
|
298
305
|
return false;
|
|
@@ -301,8 +308,15 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
|
|
|
301
308
|
await ctx.sendError(id, -32602, `cwd must be an absolute path to an existing directory`);
|
|
302
309
|
return false;
|
|
303
310
|
}
|
|
304
|
-
const candidateCwd = persisted.cwd ??
|
|
311
|
+
const candidateCwd = loadCwd ?? persisted.cwd ?? ctx.defaultCwd;
|
|
305
312
|
const restoredCwd = await resolveSessionCwd(candidateCwd) ?? ctx.defaultCwd;
|
|
313
|
+
if (ctx.sessions.has(sessionId)) {
|
|
314
|
+
return handleSessionLoadOp(ctx, id, params, replayHistory);
|
|
315
|
+
}
|
|
316
|
+
if (ctx.sessions.size >= ctx.maxSessions) {
|
|
317
|
+
await ctx.sendError(id, -32e3, `active session limit reached (${ctx.maxSessions})`);
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
306
320
|
const restored = {
|
|
307
321
|
id: sessionId,
|
|
308
322
|
cwd: restoredCwd,
|
|
@@ -406,9 +420,17 @@ async function handleSessionForkOp(ctx, id, params) {
|
|
|
406
420
|
}
|
|
407
421
|
forkCwd = resolved;
|
|
408
422
|
}
|
|
423
|
+
if (ctx.sessions.get(sourceId) !== source) {
|
|
424
|
+
await ctx.sendError(id, -32e3, `session not found: ${sourceId}`);
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
409
427
|
const forkSkipped = [];
|
|
410
428
|
const forkRequested = parseMcpServers(p.mcpServers, (reason) => forkSkipped.push(reason));
|
|
411
429
|
const forkMcpServers = forkRequested.length > 0 ? forkRequested : source.mcpServers;
|
|
430
|
+
if (ctx.sessions.size >= ctx.maxSessions) {
|
|
431
|
+
await ctx.sendError(id, -32e3, `active session limit reached (${ctx.maxSessions})`);
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
412
434
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
413
435
|
const sessionId = `sess_${ctx.allocId()}`;
|
|
414
436
|
const forked = {
|
|
@@ -482,6 +504,7 @@ async function handleSessionPromptOp(ctx, id, params) {
|
|
|
482
504
|
let result;
|
|
483
505
|
const pendingNotifications = [];
|
|
484
506
|
const emit = (update) => {
|
|
507
|
+
if (ctx.sessions.get(sessionId) !== session) return;
|
|
485
508
|
const notifPromise = ctx.sendNotification({ sessionId, update });
|
|
486
509
|
pendingNotifications.push(notifPromise.catch(() => {
|
|
487
510
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
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.32",
|
|
56
|
+
"@wrongstack/primitives": "1.0.32"
|
|
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"
|