@sema-agent/cli 1.0.26 → 1.0.28

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.
Files changed (3) hide show
  1. package/npm-shrinkwrap.json +14 -14
  2. package/package.json +5 -5
  3. package/sema.js +131 -26
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sema-agent/cli",
9
- "version": "1.0.26",
9
+ "version": "1.0.28",
10
10
  "license": "BUSL-1.1",
11
11
  "dependencies": {
12
- "@sema-agent/sdk": "0.0.57",
13
- "@sema-agent/server": "1.228.0"
12
+ "@sema-agent/sdk": "0.0.58",
13
+ "@sema-agent/server": "1.230.0"
14
14
  },
15
15
  "bin": {
16
16
  "sema": "sema.js"
@@ -629,9 +629,9 @@
629
629
  }
630
630
  },
631
631
  "node_modules/@sema-agent/core": {
632
- "version": "1.330.0",
633
- "resolved": "https://registry.npmjs.org/@sema-agent/core/-/core-1.330.0.tgz",
634
- "integrity": "sha512-G5TY7YsaLzI96MYssnKLRGIUxvSGqGSVW+mutnQ0R6UdNSFgkiZjr5xZF6yqqvxS2gC0A5LS/7k8gMgmX24YMw==",
632
+ "version": "1.333.0",
633
+ "resolved": "https://registry.npmjs.org/@sema-agent/core/-/core-1.333.0.tgz",
634
+ "integrity": "sha512-tZBdXwFo4pLz7NbsOMEGp4ilm+zIX9s4lD/T67aBkEYm8l38vl+fR5Ht2yJbaT6HOMBWyhSZNEU8mVD+N5K/ww==",
635
635
  "license": "BUSL-1.1",
636
636
  "dependencies": {
637
637
  "@modelcontextprotocol/sdk": "1.29.0",
@@ -669,21 +669,21 @@
669
669
  }
670
670
  },
671
671
  "node_modules/@sema-agent/sdk": {
672
- "version": "0.0.57",
673
- "resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.57.tgz",
674
- "integrity": "sha512-fHNaPVooeYA5CTDUWbX5kjId09nDxSq7OcelW7OmFH3qJwRssdIFiU9GKhYao037v/KOCwF2ommWxQBllgNm7w==",
672
+ "version": "0.0.58",
673
+ "resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.58.tgz",
674
+ "integrity": "sha512-F9y2lgmaNImqHKfYNUd7jIM1TnRrnHcRAOn+aJhP3u3556jL2yVYUepAMExFd9ioq06Eyqg4cZF+aaok94bPLw==",
675
675
  "license": "BUSL-1.1",
676
676
  "engines": {
677
677
  "node": ">=20"
678
678
  }
679
679
  },
680
680
  "node_modules/@sema-agent/server": {
681
- "version": "1.228.0",
682
- "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.228.0.tgz",
683
- "integrity": "sha512-d+uwN/eV1XLCidFJ8cbT0wxSH6iINag8nZXEV6e+0y5cE69YbXbI6uii0ICysfYoVyZ6YXLcQ71n8fVfypdRfA==",
681
+ "version": "1.230.0",
682
+ "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.230.0.tgz",
683
+ "integrity": "sha512-Thg7T8GxxdaNAX4SdhVtK3qPQNyxlROUlboX/tgTFcQGgo67t+EbvXeOYbOqQTart9gwFd4cyCDnm9OohwZi5Q==",
684
684
  "license": "BUSL-1.1",
685
685
  "dependencies": {
686
- "@sema-agent/core": "^1.329.0",
686
+ "@sema-agent/core": "^1.330.0",
687
687
  "@sema-agent/registry-core": "^0.10.16",
688
688
  "e2b": "^2.28.0",
689
689
  "libsodium-wrappers": "^0.8.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "Sema — your own Claude Code-grade coding agent, in the terminal.",
5
5
  "license": "BUSL-1.1",
6
6
  "bin": {
@@ -21,14 +21,14 @@
21
21
  "sema"
22
22
  ],
23
23
  "dependencies": {
24
- "@sema-agent/sdk": "0.0.57",
25
- "@sema-agent/server": "1.228.0"
24
+ "@sema-agent/sdk": "0.0.58",
25
+ "@sema-agent/server": "1.230.0"
26
26
  },
27
27
  "overrides": {
28
- "@sema-agent/core": "1.330.0",
28
+ "@sema-agent/core": "1.333.0",
29
29
  "@sema-agent/registry-core": "0.10.19"
30
30
  },
31
- "semaEngineVersion": "server 1.228.0 / core 1.330.0 / registry-core 0.10.19",
31
+ "semaEngineVersion": "server 1.230.0 / core 1.333.0 / registry-core 0.10.19",
32
32
  "engines": {
33
33
  "node": ">=18"
34
34
  }
package/sema.js CHANGED
@@ -479612,8 +479612,8 @@ var init_sema_brand = __esm({
479612
479612
  "Slash-command gating wired to the fleet capability handshake"
479613
479613
  ]
479614
479614
  },
479615
- productVersion: "1.0.26",
479616
- announcement: "sema 1.0.26 \u2014 the simple prompt profile now truly swaps in its short-form sections end to end (no more legacy stacking), thinking models stop burning their final write-out window on reasoning, and --debug-file takes its path argument correctly."
479615
+ productVersion: "1.0.28",
479616
+ announcement: "sema 1.0.28 \u2014 sub-agent notifications close their last delivery gap (no message lost in the final teardown window), and the engine ships live per-session event subscriptions for connected clients."
479617
479617
  };
479618
479618
  }
479619
479619
  });
@@ -482547,8 +482547,8 @@ var require_sema_brand = __commonJS({
482547
482547
  "Slash-command gating wired to the fleet capability handshake"
482548
482548
  ]
482549
482549
  },
482550
- productVersion: "1.0.26",
482551
- announcement: "sema 1.0.26 \u2014 the simple prompt profile now truly swaps in its short-form sections end to end (no more legacy stacking), thinking models stop burning their final write-out window on reasoning, and --debug-file takes its path argument correctly."
482550
+ productVersion: "1.0.28",
482551
+ announcement: "sema 1.0.28 \u2014 sub-agent notifications close their last delivery gap (no message lost in the final teardown window), and the engine ships live per-session event subscriptions for connected clients."
482552
482552
  };
482553
482553
  }
482554
482554
  });
@@ -554628,6 +554628,7 @@ var init_task_registry = __esm({
554628
554628
  ...input.description !== void 0 ? { description: input.description } : {},
554629
554629
  ...input.name !== void 0 ? { name: input.name } : {},
554630
554630
  ...input.deliveryChannel !== void 0 ? { channelState: input.deliveryChannel } : {},
554631
+ ...input.retainedContinuation !== void 0 ? { retainedContinuation: input.retainedContinuation } : {},
554631
554632
  ...input.owner !== void 0 ? { owner: input.owner } : {},
554632
554633
  ...input.scope !== void 0 ? { scope: input.scope } : {},
554633
554634
  ...input.toolUseId !== void 0 ? { toolUseId: input.toolUseId } : {},
@@ -554726,7 +554727,12 @@ var init_task_registry = __esm({
554726
554727
  }
554727
554728
  handle.status = outcome.status;
554728
554729
  handle.notify = void 0;
554730
+ for (const [, , qResolve] of handle.preAttachQueue ?? [])
554731
+ qResolve?.({ ok: false, reason: "not_running" });
554729
554732
  handle.preAttachQueue = void 0;
554733
+ for (const r of [...handle.inFlightDirect ?? []])
554734
+ r({ ok: false, reason: "not_running" });
554735
+ handle.inFlightDirect = void 0;
554730
554736
  if (outcome.status === "killed" && handle.stoppedBy === void 0) {
554731
554737
  handle.stoppedBy = outcome.stoppedBy ?? handle.stopSource ?? "system";
554732
554738
  }
@@ -555502,44 +555508,137 @@ var init_task_registry = __esm({
555502
555508
  const closest = closestName(key, byKey.keys());
555503
555509
  return { status: "not_found", ...closest !== void 0 ? { suggestion: byKey.get(closest) } : {} };
555504
555510
  }
555505
- attachAgentNotify(id, notify4) {
555511
+ markRetainedContinuation(id) {
555512
+ const handle = this.handles.get(id);
555513
+ if (handle && handle.type === "background_agent")
555514
+ handle.retainedContinuation = true;
555515
+ }
555516
+ reviveBackgroundAgent(id, access7, abort) {
555517
+ const handle = this.handles.get(id);
555518
+ if (!handle || handle.type !== "background_agent" || !canAccess(handle, access7))
555519
+ return { ok: false, reason: "not_found" };
555520
+ if (handle.status === "running" || handle.status === "pending")
555521
+ return { ok: false, reason: "still_running" };
555522
+ handle.status = "running";
555523
+ handle.channelState = "attaching";
555524
+ handle.notify = void 0;
555525
+ if (abort !== void 0)
555526
+ handle.abort = abort;
555527
+ handle.result = void 0;
555528
+ handle.error = void 0;
555529
+ handle.resultIsPartial = void 0;
555530
+ handle.stopSource = void 0;
555531
+ handle.reviveCycle = (handle.reviveCycle ?? 0) + 1;
555532
+ handle.updatedAt = Date.now();
555533
+ return { ok: true, cycle: handle.reviveCycle };
555534
+ }
555535
+ settleRevivedAgent(id, cycle, outcome) {
555536
+ const handle = this.handles.get(id);
555537
+ if (!handle || handle.type !== "background_agent")
555538
+ return void 0;
555539
+ if ((handle.reviveCycle ?? 0) !== cycle)
555540
+ return void 0;
555541
+ return this.settleBackgroundAgent(id, outcome);
555542
+ }
555543
+ unmarkRetainedContinuation(id) {
555544
+ const handle = this.handles.get(id);
555545
+ if (handle && handle.type === "background_agent")
555546
+ handle.retainedContinuation = false;
555547
+ }
555548
+ attachAgentNotify(id, notify4, cycle) {
555506
555549
  const handle = this.handles.get(id);
555507
555550
  if (!handle || handle.type !== "background_agent" || handle.status !== "running")
555508
555551
  return;
555552
+ if (cycle !== void 0 && (handle.reviveCycle ?? 0) !== cycle)
555553
+ return;
555509
555554
  handle.notify = notify4;
555510
- handle.channelState = "attached";
555511
- const queued = handle.preAttachQueue;
555512
- handle.preAttachQueue = void 0;
555513
- if (queued !== void 0) {
555514
- for (const [qPayload, qOpts] of queued) {
555515
- try {
555516
- notify4(qPayload, qOpts);
555517
- } catch {
555555
+ handle.channelState = "attaching";
555556
+ const live = handle.preAttachQueue;
555557
+ if (live !== void 0 && live.length > 0) {
555558
+ void (async () => {
555559
+ while (handle.preAttachQueue === live && live.length > 0) {
555560
+ const [qPayload, qOpts, qResolve] = live[0];
555561
+ let result;
555562
+ try {
555563
+ const d4 = await notify4(qPayload, qOpts);
555564
+ result = d4 === "parked" && handle.retainedContinuation !== true ? { ok: false, reason: "not_running" } : d4 === "parked" ? { ok: true, disposition: "parked" } : { ok: true, disposition: "queued" };
555565
+ } catch {
555566
+ result = { ok: false, reason: "not_running" };
555567
+ }
555568
+ if (handle.preAttachQueue !== live)
555569
+ return;
555570
+ live.shift();
555571
+ qResolve?.(result);
555518
555572
  }
555519
- }
555573
+ if (handle.preAttachQueue === live) {
555574
+ handle.preAttachQueue = void 0;
555575
+ handle.channelState = "attached";
555576
+ }
555577
+ })();
555578
+ } else {
555579
+ handle.preAttachQueue = void 0;
555580
+ handle.channelState = "attached";
555520
555581
  }
555521
555582
  }
555522
- deliverToRunningAgent(id, access7, notification, opts) {
555583
+ async deliverToRunningAgent(id, access7, notification, opts) {
555523
555584
  const handle = this.handles.get(id);
555524
555585
  if (!handle || handle.type !== "background_agent" || !canAccess(handle, access7))
555525
555586
  return { ok: false, reason: "not_found" };
555526
555587
  if (handle.status !== "running")
555527
555588
  return { ok: false, reason: "not_running" };
555528
- if (handle.notify === void 0) {
555589
+ const bounded = (p, fallback, onTimeout) => new Promise((resolve53) => {
555590
+ const t2 = setTimeout(() => {
555591
+ try {
555592
+ onTimeout?.();
555593
+ } catch {
555594
+ }
555595
+ resolve53(fallback);
555596
+ }, this.deliverConfirmTimeoutMs);
555597
+ t2.unref?.();
555598
+ void p.then((v2) => {
555599
+ clearTimeout(t2);
555600
+ resolve53(v2);
555601
+ }, () => {
555602
+ clearTimeout(t2);
555603
+ resolve53(fallback);
555604
+ });
555605
+ });
555606
+ if (handle.notify === void 0 || handle.channelState === "attaching") {
555529
555607
  if (handle.channelState !== "attaching")
555530
555608
  return { ok: false, reason: "no_channel" };
555531
555609
  const q2 = handle.preAttachQueue ??= [];
555532
555610
  if (q2.length >= 8)
555533
555611
  return { ok: false, reason: "no_channel" };
555534
- q2.push([notification, opts]);
555535
- return { ok: true };
555536
- }
555537
- try {
555538
- handle.notify(notification, opts);
555539
- return { ok: true };
555540
- } catch {
555541
- return { ok: false, reason: "not_running" };
555542
- }
555612
+ return bounded(new Promise((resolve53) => {
555613
+ q2.push([notification, opts, resolve53]);
555614
+ }), { ok: true, disposition: "pending" });
555615
+ }
555616
+ let detachOnTimeout;
555617
+ return await bounded(new Promise((resolve53) => {
555618
+ const inflight4 = handle.inFlightDirect ??= /* @__PURE__ */ new Set();
555619
+ const settleOnce = (r) => {
555620
+ if (!inflight4.has(settleOnce))
555621
+ return;
555622
+ inflight4.delete(settleOnce);
555623
+ resolve53(r);
555624
+ };
555625
+ inflight4.add(settleOnce);
555626
+ detachOnTimeout = () => inflight4.delete(settleOnce);
555627
+ void (async () => {
555628
+ let result;
555629
+ try {
555630
+ const d4 = await handle.notify?.(notification, opts);
555631
+ if (d4 === "parked") {
555632
+ result = handle.retainedContinuation === true ? { ok: true, disposition: "parked" } : { ok: false, reason: "not_running" };
555633
+ } else {
555634
+ result = { ok: true, disposition: "queued" };
555635
+ }
555636
+ } catch {
555637
+ result = { ok: false, reason: "not_running" };
555638
+ }
555639
+ settleOnce(result);
555640
+ })();
555641
+ }), { ok: true, disposition: "pending" }, () => detachOnTimeout?.());
555543
555642
  }
555544
555643
  runningBackgroundAgentLabels(access7) {
555545
555644
  const out6 = [];
@@ -555551,6 +555650,7 @@ var init_task_registry = __esm({
555551
555650
  }
555552
555651
  return out6;
555553
555652
  }
555653
+ deliverConfirmTimeoutMs = 1e4;
555554
555654
  lastGcAt = 0;
555555
555655
  list(access7, opts = {}) {
555556
555656
  const limit2 = Math.min(500, Math.max(1, Math.floor(opts.limit ?? 50)));
@@ -555977,7 +556077,12 @@ ${clipTaskOutput(handle.result, handle.outputFile)}` : "(no result text)"}`;
555977
556077
  handle.stoppedBy = handle.stopSource ?? "parent";
555978
556078
  handle.updatedAt = Date.now();
555979
556079
  handle.notify = void 0;
556080
+ for (const [, , qResolve] of handle.preAttachQueue ?? [])
556081
+ qResolve?.({ ok: false, reason: "not_running" });
555980
556082
  handle.preAttachQueue = void 0;
556083
+ for (const r of [...handle.inFlightDirect ?? []])
556084
+ r({ ok: false, reason: "not_running" });
556085
+ handle.inFlightDirect = void 0;
555981
556086
  this.pokeBgQuiescence(handle.owner);
555982
556087
  }
555983
556088
  return {
@@ -654084,7 +654189,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
654084
654189
  pendingHookMessages
654085
654190
  }, renderAndRun);
654086
654191
  }
654087
- }).version("sema 1.0.26", "-v, --version", "Output the version number");
654192
+ }).version("sema 1.0.28", "-v, --version", "Output the version number");
654088
654193
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
654089
654194
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
654090
654195
  if (canUserConfigureAdvisor()) {