@wrongstack/acp 1.0.29 → 1.0.33

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.
@@ -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;
@@ -303,6 +310,13 @@ async function handleSessionLoadOp(ctx, id, params, replayHistory = true) {
303
310
  }
304
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/acp",
3
- "version": "1.0.29",
3
+ "version": "1.0.33",
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.29",
56
- "@wrongstack/primitives": "1.0.29"
55
+ "@wrongstack/core": "1.0.33",
56
+ "@wrongstack/primitives": "1.0.33"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node": "^26.5.1",