@sema-agent/server 7.36.0 → 7.37.0

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 (51) hide show
  1. package/USAGE.md +9 -0
  2. package/dist/boot/resolve-spec.js +6 -1
  3. package/dist/boot/runner-deps.d.ts +21 -3
  4. package/dist/boot/runner-deps.js +31 -4
  5. package/dist/boot/session-faces.d.ts +3 -0
  6. package/dist/boot/session-faces.js +11 -2
  7. package/dist/boot/side-query-lane.d.ts +77 -54
  8. package/dist/boot/side-query-lane.js +102 -66
  9. package/dist/boot/stores.d.ts +1 -0
  10. package/dist/boot/stores.js +19 -1
  11. package/dist/boot/task-list-lane.d.ts +92 -0
  12. package/dist/boot/task-list-lane.js +63 -0
  13. package/dist/bounded-session-map.d.ts +3 -0
  14. package/dist/bounded-session-map.js +5 -0
  15. package/dist/capabilities/scenarios.d.ts +30 -2
  16. package/dist/capabilities/scenarios.js +16 -3
  17. package/dist/config-types.d.ts +21 -1
  18. package/dist/config.js +8 -1
  19. package/dist/hooks/branch-transcript.d.ts +3 -2
  20. package/dist/hooks/branch-transcript.js +7 -1
  21. package/dist/http/active-run-conflict.d.ts +43 -0
  22. package/dist/http/active-run-conflict.js +8 -0
  23. package/dist/http/route-ctx.d.ts +22 -1
  24. package/dist/http/routes/approvals-assistant.js +13 -1
  25. package/dist/http/routes/notify-wake.js +6 -0
  26. package/dist/http/routes/runs.js +1 -1
  27. package/dist/http/routes/tasks.js +30 -2
  28. package/dist/http/server.js +103 -7
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.js +5 -0
  31. package/dist/main.js +11 -3
  32. package/dist/memory-posture.d.ts +12 -1
  33. package/dist/memory-posture.js +2 -0
  34. package/dist/observability/fail-open.d.ts +9 -1
  35. package/dist/observability/fail-open.js +9 -1
  36. package/dist/plugins/memory-engine-pg.js +42 -4
  37. package/dist/plugins/memory-engine-tidb.js +38 -4
  38. package/dist/plugins/memory-origin-law.d.ts +69 -0
  39. package/dist/plugins/memory-origin-law.js +98 -0
  40. package/dist/plugins/retention-store-sql.d.ts +7 -0
  41. package/dist/plugins/retention-store-sql.js +24 -0
  42. package/dist/plugins/task-list-store-sql.d.ts +36 -25
  43. package/dist/plugins/task-list-store-sql.js +102 -0
  44. package/dist/run-local.js +14 -5
  45. package/dist/runs.js +17 -0
  46. package/dist/trace/engine-notice-wire.d.ts +128 -0
  47. package/dist/trace/engine-notice-wire.js +256 -0
  48. package/dist/trace/ledger-events.d.ts +11 -1
  49. package/dist/trace/ledger-sink.d.ts +17 -0
  50. package/dist/trace/ledger-sink.js +25 -0
  51. package/package.json +2 -2
@@ -1,6 +1,31 @@
1
1
  import { redactSecrets } from "./redact.js";
2
2
  import { toolStartEventData, toolEndEventData, taskProgressEventData, taskNotificationEventData, compactedEventData, diagnosticsEventData, brainStatusEventData, steeringInjectedEventData, compactionOutcomeEventData, workspaceChangedEventData, wiringManifestEventData, humanInputEventData, turnEndEventData, contextUsageEventData } from "./project.js";
3
3
  import { NotifiedKeys, taskNotificationStreamKey } from "../orchestration/workflow-completion-inbox.js";
4
+ /**
5
+ * **单写串行链**的可复用形(#310 codex 对抗复审 R1-[high],验真后修)—— `seq` 的**分配发生在链步内**,
6
+ * 于是「分配序 == 发起序 == 提交序」。
7
+ *
8
+ * 病(实测形,`LedgerSink` 内部早有这条纪律的内联版、其顶注 [1.211 codex H2] 逐字记着它):裸写口
9
+ * (`(type, data) => rs.appendEvent(taskId, ++seq, type, data)`)在**同步分配 seq、立刻发起 insert**。
10
+ * 主循环 await 自己的写,所以主循环内部有序;但只要有**一个 fire-and-forget 写者**(子代 forward 帧、
11
+ * #310 的通告口),它的 N 号 insert 可能在池化 SQL 后端上晚于后发的 N+1 号提交。events tail 的读法是
12
+ * `getEvents(id, afterSeq)` —— 读到 N+1 就把游标推过 N,**那一行此后永远不会被投递**(重连也不会,
13
+ * 游标只前进)。行在库里,消费端结构性看不见。
14
+ *
15
+ * 药:所有写口共用一条 promise 链,`++seq` 在链步内取。链上一步失败**不断链**(catch → undefined),
16
+ * 调用方仍拿到自己那一步的真实结果(await 者照常收到 reject)——与 `LedgerSink` 内联版逐字同语义。
17
+ *
18
+ * ⚠️ 用它的前提是**这条腿的全部写口都走它**(混用一个绕开链的写口 = 病灶原样保留)。
19
+ */
20
+ export function createSerialLedgerAppend(appendEvent, startSeq) {
21
+ let seq = startSeq;
22
+ let chain = Promise.resolve();
23
+ return (type, data) => {
24
+ const step = chain.then(() => appendEvent(++seq, type, data));
25
+ chain = step.then(() => undefined, () => undefined);
26
+ return step;
27
+ };
28
+ }
4
29
  export function createLedgerSink(opts) {
5
30
  const keys = opts.notifiedKeys ?? new NotifiedKeys();
6
31
  let seq = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "7.36.0",
3
+ "version": "7.37.0",
4
4
  "description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -54,7 +54,7 @@
54
54
  "build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
55
55
  },
56
56
  "dependencies": {
57
- "@sema-agent/core": "^5.45.0",
57
+ "@sema-agent/core": "^5.46.0",
58
58
  "@sema-agent/registry-core": "^0.18.0",
59
59
  "e2b": "^2.28.0",
60
60
  "libsodium-wrappers": "^0.8.4",