@sema-agent/server 3.13.0 → 3.14.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.
@@ -42,6 +42,15 @@ async function handleCapabilitiesBody(req, res, url, ctx, miss) {
42
42
  // AskUserQuestion-suspend + the approval center + resumable checkpoints, independent of whether any
43
43
  // TOOL is gated (APPROVAL_REQUIRE = the additive F4 layer). Legacy poll-gate approvalStore does NOT
44
44
  // count: alone it can't suspend (the P2-preflight lie).
45
+ //
46
+ // 🔴 **辖域比名字宽**(2026-08-01,web [C33]③.3 踩出来的):这个谓词同时是 `/v1/assistant/*`
47
+ // 整条车道的挂载条件 —— `routes/approvals-assistant.ts` 的分支头逐字是
48
+ // `if (deps.checkpointStore && (url.startsWith("/v1/approvals") || url.startsWith("/v1/assistant")))`。
49
+ // 所以 **`GET /v1/assistant/tasks`(计划运行/调度视图)也由这个键判**,而不是由 `scheduler`
50
+ // (那个键说的是 host 腿的自唤醒 cron 工具,与本视图无关)。
51
+ // web 因为按名字猜、用 `scheduler` 判这个面,在 local 部署形上永久渲「不可达」——名字窄、谓词宽
52
+ // 就是这么伤人的。键名不改(改名是 wire 破坏性变更),改成把辖域写在这里 + 附录 A,
53
+ // 让「says yes ⟺ route works」这句话对**读文档的人**也成立,而不只对写代码的人。
45
54
  approvals: Boolean(deps.checkpointStore),
46
55
  sessions: Boolean(deps.sessionAudit),
47
56
  // [1196] session 级 SSE 订阅面:与 /v1/sessions/:id/events 的 501 谓词同源(sessionWatch 只在
@@ -2547,9 +2547,20 @@ function cors(res, req, origins, principalHeader) {
2547
2547
  if (allow === undefined)
2548
2548
  return;
2549
2549
  res.setHeader("access-control-allow-origin", allow);
2550
- res.setHeader("access-control-allow-methods", "GET, POST, OPTIONS");
2550
+ // 🔴 这三行自 2026-07-14 公开快照起逐字未动,而这期间进来的路由与请求头它一个都不认
2551
+ // (2026-08-01 缝合审)。浏览器前端撞的不是"请求失败"而是**请求根本发不出去** —— OPTIONS 预检就被拒。
2552
+ // 维护纪律:**新增 PUT/DELETE 路由、或新读一个自定义请求头时,这里必须同步**;
2553
+ // `test/cors-v2.test.ts` 的三条钉逐个断言方法与头名,漏一个当场红。
2554
+ res.setHeader("access-control-allow-methods", "GET, POST, PUT, DELETE, OPTIONS");
2551
2555
  // Include the principal header so a browser front-end that sends it isn't rejected by the OPTIONS preflight
2552
2556
  // (which would otherwise drop identity → an owner=null session under requirePrincipal=false).
2553
- res.setHeader("access-control-allow-headers", `content-type, authorization, last-event-id, ${principalHeader}`);
2557
+ // 后五项都是**真被 handler 读**的自定义头:`idempotency-key`(tasks/runs/images)
2558
+ // `x-detach-on-disconnect`(tasks 断连不中止)、direct-door 决策证明三件套(approvals /decide 的
2559
+ // crypto 绑定腿 —— 缺了它,direct-door worker 上的 web 审批面在浏览器里根本用不了)。
2560
+ res.setHeader("access-control-allow-headers", `content-type, authorization, last-event-id, ${principalHeader}, idempotency-key, x-detach-on-disconnect, x-approval-principal-token, x-approval-mac, x-approval-mac-kid`);
2561
+ // 🔴 expose-headers 此前**整个缺席** ⇒ fetch 类客户端读不到 `X-Task-Id`(routes/tasks.ts 经 sseHeaders
2562
+ // 下发的 durable rewind handle)。tasks.ts 的 G15 meta 帧注释把这归因为「EventSource 与部分代理读不到
2563
+ // 响应头」—— 对 EventSource 成立,但对 fetch 客户端真因是这里缺 expose,meta 帧只是绕过。
2564
+ res.setHeader("access-control-expose-headers", "x-task-id, retry-after");
2554
2565
  }
2555
2566
  //# sourceMappingURL=server.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "3.13.0",
3
+ "version": "3.14.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": "^2.9.0",
57
+ "@sema-agent/core": "^2.10.0",
58
58
  "@sema-agent/registry-core": "^0.11.0",
59
59
  "e2b": "^2.28.0",
60
60
  "libsodium-wrappers": "^0.8.4",