@sema-agent/server 3.4.2 → 3.5.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.
@@ -22,7 +22,6 @@ export declare const THINK_MS: {
22
22
  /** A pre-action plan review (`CheckpointGate.kind === "plan_review"`). */
23
23
  readonly plan_review: 45000;
24
24
  };
25
- export type GateKind = keyof typeof THINK_MS;
26
25
  /** Look up the fixed modeled think-time for a gate kind (defaults to the `human` rubric for an unknown kind). */
27
26
  export declare function thinkMsForGate(gateKind: string): number;
28
27
  /** The trap slice the reviewer needs to apply its rubric (kept narrow to avoid a circular import on tasks.ts). */
@@ -357,6 +357,10 @@ export interface ServiceConfigFlat {
357
357
  * `BIND_HOST`(兼容 `HOST`)。显式值恒生效;缺省见 {@link resolveBindHost}——**无鉴权写面
358
358
  * (allowUnauthedWrites 且零凭证)自动收窄到 127.0.0.1**,其余维持全接口(既有部署零影响)。 */
359
359
  bindHost?: string;
360
+ /** [2062]③ `bindHost` 的取值来源(BIND_HOST 显式 / HOST 兼容名 / 未设)。`"HOST"` 时 main.ts 打一行
361
+ * 启动告警:zsh 常把 HOST 设成机器名,`{...process.env}` 起底的壳会静默继承给引擎——bind 面被 shell
362
+ * 环境暗配而部署者不知情(HOST=机器名解析到 LAN 口时=静默扩暴露面)。 */
363
+ bindHostSource?: "BIND_HOST" | "HOST";
360
364
  /** D-1 附件孤儿对象 GC 的 grace(毫秒;`ATTACHMENT_ORPHAN_GRACE_MS`,默认 1h,**0=关掉本腿**)。
361
365
  * 复审 F10:同 tick 邻居(workflowOrphanGraceMs/attachmentUnboundTtlMs/scratchpadSweepTtlMs)都有
362
366
  * 旋钮——存量对象巨大的部署要调慢/停掉,不该被迫取消 MinIO 配置(那会连带关掉整个附件面)。 */
@@ -864,7 +868,7 @@ export type ServiceApprovalConfig = Pick<ServiceConfigFlat, "approvalRequire" |
864
868
  export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled" | "memoryEngineDir" | "memoryEngineRemoteLaneAllowed" | "memoryEngineBackend" | "memoryScope" | "memorySync" | "projectMemoryEnabled" | "syncImportLeaseStaleSec">;
865
869
  /** 组:auth(鉴权 / 身份 / 治理棒)。`commandPolicy` 只有 sema-registry 腿(无 env 标量形),故 env 解析
866
870
  * 函数不产出它,但它与 `autonomy` 是同一根治理棒的两半,归本组。 */
867
- export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "operatorPrincipals" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "principalJwtMaxTtlSec" | "bindHost">;
871
+ export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "operatorPrincipals" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
868
872
  /** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
869
873
  export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerStorePath" | "planModeEnabled" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "rosterRetentionMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sessionAutoTitle" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "imageBakes">;
870
874
  /** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
package/dist/config.js CHANGED
@@ -873,6 +873,9 @@ function parseAuthDomain(ctx) {
873
873
  return {
874
874
  // 绑址([1934]):BIND_HOST 优先,HOST 兼容(cli/桌面传的就是它);空串=未设。
875
875
  bindHost: process.env.BIND_HOST || process.env.HOST || undefined,
876
+ // [2062]③ 来源记账:HOST 是 zsh 会替用户设的名字(HOST=机器名),{...process.env} 起底的壳会把它
877
+ // 静默继承给引擎——bind 面被 shell 环境暗配而部署者不知情。main.ts 对 "HOST" 来源打一行启动告警。
878
+ bindHostSource: process.env.BIND_HOST ? "BIND_HOST" : process.env.HOST ? "HOST" : undefined,
876
879
  authToken: process.env.SERVICE_AUTH_TOKEN,
877
880
  authTokens,
878
881
  allowUnauthedWrites: boolEnv("ALLOW_UNAUTHED_WRITES", false),
@@ -1224,7 +1227,7 @@ const MEMORY_GROUP_KEYS = [
1224
1227
  const AUTH_GROUP_KEYS = [
1225
1228
  "authToken", "authTokens", "allowUnauthedWrites", "corsOrigins", "principalHeader", "requirePrincipal", "autonomy",
1226
1229
  "commandPolicy", "operatorPrincipals", "principalJwtPubkeys", "principalJwtIss", "principalJwtAud",
1227
- "principalJwtMaxTtlSec", "bindHost",
1230
+ "principalJwtMaxTtlSec", "bindHost", "bindHostSource",
1228
1231
  ];
1229
1232
  const ORCHESTRATION_GROUP_KEYS = [
1230
1233
  "remoteExec", "worktreeIsolation", "leaderEnabled", "leaderFanoutEnabled", "routerEnabled", "selfOrchestrationEnabled",
@@ -25,9 +25,6 @@ export interface ElicitationRunContext {
25
25
  emit: (frame: ElicitationFrame) => void | Promise<void>;
26
26
  abortSignal?: AbortSignal;
27
27
  }
28
- /** @deprecated design/158 N22: the root word got truncated at naming time — `ElicitationFrame` / `ElicitationThrottle` /
29
- * `ElicitationCoordinator` all spell it out; this alias was the odd one. Use {@link ElicitationRunContext}. */
30
- export type ElicitRunContext = ElicitationRunContext;
31
28
  export interface ElicitationThrottle {
32
29
  /** Max concurrent in-flight elicitations per run leg (parallel tool calls can each elicit). Breach ⇒ decline. */
33
30
  maxConcurrentPerRun: number;
@@ -49,10 +46,6 @@ export declare function parseElicitationResponse(body: unknown): {
49
46
  ok: false;
50
47
  error: string;
51
48
  };
52
- /** @deprecated design/158 N22: renamed to {@link parseElicitationResponse} — unifies the HITL trio's parse-fn
53
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
54
- * human's reply body"). Kept as a compat alias. */
55
- export declare const parseElicitResponse: typeof parseElicitationResponse;
56
49
  /**
57
50
  * Coordinates inbound MCP elicitations for one server instance. Process-local + same-replica (the pending map is in
58
51
  * memory, like `steerableRuns`): a respond that lands on another replica finds nothing → 404. Present (passed into
@@ -65,10 +65,6 @@ export function parseElicitationResponse(body) {
65
65
  }
66
66
  return { ok: true, value: { action: b.action } };
67
67
  }
68
- /** @deprecated design/158 N22: renamed to {@link parseElicitationResponse} — unifies the HITL trio's parse-fn
69
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
70
- * human's reply body"). Kept as a compat alias. */
71
- export const parseElicitResponse = parseElicitationResponse;
72
68
  /** redactDeep + size-bound an UNTRUSTED `requestedSchema` before it is persisted to the durable log / streamed
73
69
  * (the same redact-at-write contract every other untrusted structured field honors, e.g. tool_end.output). A JSON
74
70
  * Schema's free-text carriers (description/title/default/enum) can smuggle a secret. Over the byte cap ⇒ undefined
@@ -466,4 +466,6 @@ export declare function clampVerifyRounds(v: unknown): number;
466
466
  export declare function createHttpServer(rawDeps: ServiceDeps): http.Server & {
467
467
  denyExpiredApprovals: (now: number) => Promise<void>;
468
468
  };
469
+ /** Stable, low-cardinality route label for metrics/logs (ids collapsed to `:id`). */
470
+ export declare function routeLabel(_method: string, url: string): string;
469
471
  //# sourceMappingURL=server.d.ts.map
@@ -35,15 +35,15 @@ import { handleFleet } from "./routes/fleet.js";
35
35
  import { handleTraceUsage } from "./routes/trace-usage.js";
36
36
  import { handleWorkflows, handleWorkflowAgentSteer } from "./routes/workflows.js";
37
37
  import { handleNotifyWake } from "./routes/notify-wake.js";
38
- import { handleApprovalsAssistant, streamApprovals, isQuestionAnswer, ASSISTANT_PREEMPT_RE, ASSISTANT_RESUME_RE, ASSISTANT_PLAN_REVIEW_RE } from "./routes/approvals-assistant.js";
38
+ import { handleApprovalsAssistant, streamApprovals, isQuestionAnswer, ASSISTANT_RESUME_RE, ASSISTANT_PLAN_REVIEW_RE } from "./routes/approvals-assistant.js";
39
39
  export { streamApprovals, isQuestionAnswer };
40
- import { handleRuns, handleRunVerbs, RUN_CANCEL_RE, RUN_STEER_RE, RUN_DETACH_RE, RUN_SUBAGENT_RESUME_RE } from "./routes/runs.js";
40
+ import { handleRuns, handleRunVerbs, RUN_SUBAGENT_RESUME_RE } from "./routes/runs.js";
41
41
  import { handleSideQuery } from "./routes/side-query.js";
42
42
  import { handleTasks } from "./routes/tasks.js";
43
43
  import { handleLeader } from "./routes/leader.js";
44
44
  import { cascadeConfig } from "./run-meta.js";
45
45
  export { cascadeConfig };
46
- import { handleImages, createImagesLocal, coarseStatusForState, errorCodeForExit, BAKE_ID_RE, BAKE_EVENTS_RE, BAKE_CANCEL_RE, BAKE_CLAIM_RE, BAKE_INGEST_RE } from "./routes/images.js";
46
+ import { handleImages, createImagesLocal, coarseStatusForState, errorCodeForExit } from "./routes/images.js";
47
47
  export { coarseStatusForState, errorCodeForExit };
48
48
  // design/158 A9:装配器缝——发送器/身份门下沉到 http/ 叶子模块,routes/* 与 server.ts 共用同一实现
49
49
  // (routes/* 绝不可值 import server.ts:那条边会闭合运行时环,见 test/module-cycle-gate.test.ts)。
@@ -2452,50 +2452,65 @@ function isBillableSubmitPath(url) {
2452
2452
  // ⚠️ SSE 帧纪律(2026-07-12):center BFF 中继凭「data 无 type 字段」识别心跳帧并吞掉
2453
2453
  // (AgentEvent 是 closed oneof 全带 type,故可控)。**未来新增任何 SSE data 帧必须带 type 字段**,否则会被
2454
2454
  // 中继当心跳吞掉、永远到不了前端。heartbeat 帧(`event: heartbeat` + `data: {}`)是唯一豁免。
2455
+ /** 路由标签表(表驱动;[2061] 批1 层A 重写)。顺序=具体先于泛化。
2456
+ * 🔴 本表由 `test/route-shape-roster.test.ts` 棘轮看守:门机器枚举源码全部路由模式并断言每条都映射到
2457
+ * 非 "other"——新路由不补此表该门当场红(census 抓获本表曾漂掉 56 条模式:session-sync/workspace/
2458
+ * workflows/subagents/attachments/images/leader 等整族全折 "other",metrics 不可分桶)。 */
2459
+ const ROUTE_LABEL_PATTERNS = [
2460
+ [/^\/v1\/runs\/[^/]+\/steer$/, "/v1/runs/:id/steer"],
2461
+ [/^\/v1\/runs\/[^/]+\/detach$/, "/v1/runs/:id/detach"],
2462
+ [/^\/v1\/runs\/[^/]+\/cancel$/, "/v1/runs/:id/cancel"],
2463
+ [/^\/v1\/runs\/[^/]+\/compact$/, "/v1/runs/:id/compact"],
2464
+ [/^\/v1\/runs\/[^/]+\/events$/, "/v1/runs/:id/events"],
2465
+ [/^\/v1\/runs\/[^/]+\/subagents\/[^/]+\/(steer|resume|output|stream)$/, "/v1/runs/:id/subagents/:sub/*"],
2466
+ [/^\/v1\/runs\/[^/]+\/tasks\/[^/]+\/(output|stop)$/, "/v1/runs/:id/tasks/:tid/*"],
2467
+ [/^\/v1\/runs\/[^/]+$/, "/v1/runs/:id"],
2468
+ [/^\/v1\/images\/bakes\/[^/]+\/events$/, "/v1/images/bakes/:id/events"],
2469
+ [/^\/v1\/images\/bakes\/[^/]+\/cancel$/, "/v1/images/bakes/:id/cancel"],
2470
+ [/^\/v1\/images\/bakes\/[^/]+\/claim$/, "/v1/images/bakes/:id/claim"],
2471
+ [/^\/v1\/images\/bakes\/[^/]+\/ingest$/, "/v1/images/bakes/:id/ingest"],
2472
+ [/^\/v1\/images\/bakes\/[^/]+$/, "/v1/images/bakes/:id"],
2473
+ [/^\/v1\/images\/digests\/[^/]+$/, "/v1/images/digests/:digest"],
2474
+ [/^\/v1\/images\/[^/]+$/, "/v1/images/:profile"],
2475
+ [/^\/v1\/approvals\/[^/]+\/decide$/, "/v1/approvals/:id/decide"],
2476
+ [/^\/v1\/approvals\/[^/]+\/exemptions(\/[^/]+)?$/, "/v1/approvals/:id/exemptions"],
2477
+ [/^\/v1\/approvals\/[^/]+$/, "/v1/approvals/:id"],
2478
+ [/^\/v1\/sessions\/[^/]+\/(wake|fork|init|notify|events|head|mcp|policy|settings)$/, "/v1/sessions/:id/$verb"],
2479
+ [/^\/v1\/sessions\/[^/]+\/sync\/(manifest|entries|plan)$/, "/v1/sessions/:id/sync/$verb"],
2480
+ [/^\/v1\/sessions\/[^/]+\/sync\/import(\/[^/]+\/entries)?$/, "/v1/sessions/:id/sync/import"],
2481
+ [/^\/v1\/sessions\/[^/]+\/sync\/blobs(\/[^/]+)?$/, "/v1/sessions/:id/sync/blobs"],
2482
+ [/^\/v1\/sessions\/[^/]+\/sync\/snapshots\/[^/]+\/blobs\/[^/]+$/, "/v1/sessions/:id/sync/snapshots/:key/blobs/:hash"],
2483
+ [/^\/v1\/sessions\/[^/]+\/workspace(\/[^/]+(\/(tree|file|archive))?)?$/, "/v1/sessions/:id/workspace"],
2484
+ [/^\/v1\/sessions\/[^/]+$/, "/v1/sessions/:id"],
2485
+ [/^\/v1\/assistant\/tasks\/[^/]+\/preempt$/, "/v1/assistant/tasks/:id/preempt"],
2486
+ [/^\/v1\/assistant\/tasks\/[^/]+\/resume$/, "/v1/assistant/tasks/:id/resume"],
2487
+ [/^\/v1\/assistant\/tasks\/[^/]+\/plan_review$/, "/v1/assistant/tasks/:id/plan_review"],
2488
+ [/^\/v1\/(elicitations|questions|tool-approvals)\/[^/]+\/respond$/, "/v1/$hitl/:id/respond"],
2489
+ [/^\/v1\/workflows\/[^/]+\/agents\/[^/]+\/steer$/, "/v1/workflows/:id/agents/:aid/steer"],
2490
+ [/^\/v1\/workflows\/[^/]+\/(stream|journal)$/, "/v1/workflows/:id/$sub"],
2491
+ [/^\/v1\/workflows\/[^/]+$/, "/v1/workflows/:id"],
2492
+ [/^\/v1\/tasks\/[^/]+\/(turns|stream|artifacts)$/, "/v1/tasks/:id/$sub"],
2493
+ [/^\/v1\/leader\/[^/]+$/, "/v1/leader/:id"],
2494
+ [/^\/v1\/attachments\/[^/]+$/, "/v1/attachments/:id"],
2495
+ [/^\/v1\/capabilities\/scenarios\/[^/]+$/, "/v1/capabilities/scenarios/:name"],
2496
+ [/^\/v1\/memory\/sync\/[^/]+$/, "/v1/memory/sync/:scope"],
2497
+ [/^\/v1\/usage\/(summary|series|breakdown)$/, "/v1/usage/$sub"],
2498
+ ];
2499
+ const ROUTE_LABEL_LITERALS = new Set([
2500
+ "/health", "/metrics", "/metrics/summary", "/metrics/plan-cache",
2501
+ "/v1/models", "/v1/tasks", "/v1/tasks/stream", "/v1/tasks/source-summary",
2502
+ "/v1/runs", "/v1/sessions", "/v1/approvals", "/v1/approvals/stream",
2503
+ "/v1/assistant/inbox", "/v1/assistant/tasks", "/v1/usage", "/v1/policy", "/v1/capabilities",
2504
+ "/v1/images", "/v1/images/bakes", "/v1/images/bakes/claim", "/v1/images/select", "/v1/images/register",
2505
+ "/v1/workflows", "/v1/attachments", "/v1/leader", "/v1/outcomes", "/v1/side-query",
2506
+ "/v1/memory/export", "/v1/sendfile-links",
2507
+ ]);
2455
2508
  /** Stable, low-cardinality route label for metrics/logs (ids collapsed to `:id`). */
2456
- function routeLabel(_method, url) {
2457
- if (RUN_STEER_RE.test(url))
2458
- return "/v1/runs/:id/steer";
2459
- if (RUN_DETACH_RE.test(url))
2460
- return "/v1/runs/:id/detach";
2461
- if (RUN_CANCEL_RE.test(url))
2462
- return "/v1/runs/:id/cancel";
2463
- if (/^\/v1\/runs\/[^/]+\/events$/.test(url))
2464
- return "/v1/runs/:id/events";
2465
- if (/^\/v1\/runs\/[^/]+$/.test(url))
2466
- return "/v1/runs/:id";
2467
- if (url === "/v1/images/bakes")
2468
- return "/v1/images/bakes";
2469
- if (BAKE_EVENTS_RE.test(url))
2470
- return "/v1/images/bakes/:id/events";
2471
- if (BAKE_CANCEL_RE.test(url))
2472
- return "/v1/images/bakes/:id/cancel";
2473
- if (BAKE_CLAIM_RE.test(url))
2474
- return "/v1/images/bakes/:id/claim";
2475
- if (BAKE_INGEST_RE.test(url))
2476
- return "/v1/images/bakes/:id/ingest";
2477
- if (BAKE_ID_RE.test(url))
2478
- return "/v1/images/bakes/:id";
2479
- if (url === "/v1/approvals/stream")
2480
- return "/v1/approvals/stream"; // native-push SSE — distinct from a /:id decide
2481
- if (/^\/v1\/approvals\/[^/]+$/.test(url))
2482
- return "/v1/approvals/:id";
2483
- if (/^\/v1\/sessions\/[^/]+\/wake$/.test(url))
2484
- return "/v1/sessions/:id/wake";
2485
- if (/^\/v1\/sessions\/[^/]+\/fork$/.test(url))
2486
- return "/v1/sessions/:id/fork";
2487
- if (/^\/v1\/sessions\/[^/]+\/init$/.test(url))
2488
- return "/v1/sessions/:id/init";
2489
- if (/^\/v1\/sessions\/[^/]+$/.test(url))
2490
- return "/v1/sessions/:id";
2491
- if (ASSISTANT_PREEMPT_RE.test(url))
2492
- return "/v1/assistant/tasks/:id/preempt";
2493
- if (ASSISTANT_RESUME_RE.test(url))
2494
- return "/v1/assistant/tasks/:id/resume";
2495
- if (ASSISTANT_PLAN_REVIEW_RE.test(url))
2496
- return "/v1/assistant/tasks/:id/plan_review";
2497
- const known = ["/health", "/metrics", "/v1/models", "/v1/tasks", "/v1/tasks/stream", "/v1/runs", "/v1/sessions", "/v1/approvals", "/v1/assistant/inbox", "/v1/assistant/tasks", "/v1/usage", "/v1/policy", "/v1/capabilities"];
2498
- if (known.includes(url))
2509
+ export function routeLabel(_method, url) {
2510
+ for (const [re, label] of ROUTE_LABEL_PATTERNS)
2511
+ if (re.test(url))
2512
+ return label;
2513
+ if (ROUTE_LABEL_LITERALS.has(url))
2499
2514
  return url;
2500
2515
  return "other";
2501
2516
  }
@@ -8,5 +8,5 @@
8
8
  * `LspTransport` IMPLEMENTATION (`WsLspTransport` in ws-transport.ts) — core has no WebSocket transport (raw TCP
9
9
  * doesn't traverse E2B's HTTP proxy; WS does). "1:1-copy-CC" is the protocol; the WS transport is ours.
10
10
  */
11
- export type { LspOperation, LspRequestParams, LspResult, LspLocation, LspSymbolInfo, LspServerManager, LspSession, LspTransport, LspReadText, } from "@sema-agent/core";
11
+ export type { LspOperation, LspRequestParams, LspResult, LspServerManager, LspSession, LspTransport, LspReadText, } from "@sema-agent/core";
12
12
  //# sourceMappingURL=types.d.ts.map
package/dist/main.js CHANGED
@@ -816,6 +816,14 @@ async function main() {
816
816
  ? { note: "auto-narrowed to loopback: write face is unauthenticated (ALLOW_UNAUTHED_WRITES with no service token). Set BIND_HOST explicitly to override." }
817
817
  : {}),
818
818
  });
819
+ // [2062]③ HOST 继承暗通道告警:zsh 常把 HOST 设成机器名,`{...process.env}` 起底的壳会静默继承给
820
+ // 引擎——bind 面被 shell 环境暗配而部署者不知情(HOST=机器名解析到 LAN 口时=静默扩暴露面)。
821
+ if (config.bindHostSource === "HOST") {
822
+ logger.warn("bind_host_from_HOST_env", {
823
+ bindHost,
824
+ note: "the bind address came from the HOST env var (not BIND_HOST). Shells like zsh commonly set HOST to the machine name — if you did not set it yourself, this may be an inherited shell variable silently configuring the bind face. Set BIND_HOST explicitly to silence this warning.",
825
+ });
826
+ }
819
827
  // fleet worker 接线(announce/heartbeat + usage 批报;lease 消费后一拍):boot 完成后
820
828
  // 注册(=首次心跳)。门 = center lane 配置 ∧ FLEET_ADVERTISE_ADDRESS 显式声明(不自猜可达地址);任一缺 → undefined
821
829
  // = 非 fleet 部署零行为。draining 翻转的即刻 announce 在 drainThenShutdown;退出 DELETE 在 hardShutdown。
@@ -62,8 +62,6 @@ export interface HardenedVmLimits {
62
62
  * A script exceeding it OOMs the WORKER (killed), never the shared main process. Default 128. */
63
63
  maxHeapMb?: number;
64
64
  }
65
- /** Optional observability hook for contained script-realm rejections (e.g. wire to the deployment logger). */
66
- export declare function setScriptRealmRejectionObserver(observer: (summary: string) => void): void;
67
65
  export declare function installScriptRealmRejectionGuard(): void;
68
66
  /**
69
67
  * The membrane handed to a surface's `buildGlobals` callback to construct the CONTEXT-LOCAL bindings the
@@ -48,11 +48,6 @@ function scrubProtoDeep(value) {
48
48
  * their global posture, and only then is the hazard live. Idempotent.
49
49
  */
50
50
  let rejectionGuardInstalled = false;
51
- let onScriptRealmRejection;
52
- /** Optional observability hook for contained script-realm rejections (e.g. wire to the deployment logger). */
53
- export function setScriptRealmRejectionObserver(observer) {
54
- onScriptRealmRejection = observer;
55
- }
56
51
  export function installScriptRealmRejectionGuard() {
57
52
  if (rejectionGuardInstalled)
58
53
  return;
@@ -62,7 +57,7 @@ export function installScriptRealmRejectionGuard() {
62
57
  // cross-realm ⇒ minted in a vm context ⇒ an un-awaited rejection inside an untrusted script. Contain.
63
58
  const summary = reason instanceof Error ? `${reason.name}: ${reason.message}` : String(reason);
64
59
  try {
65
- (onScriptRealmRejection ?? ((s) => console.warn(`hardened-vm: un-awaited script rejection contained: ${s}`)))(summary);
60
+ console.warn(`hardened-vm: un-awaited script rejection contained: ${summary}`);
66
61
  }
67
62
  catch {
68
63
  /* the guard must never become a crash source itself */
@@ -39,10 +39,6 @@ export declare function parseQuestionResponse(body: unknown): {
39
39
  ok: false;
40
40
  error: string;
41
41
  };
42
- /** @deprecated design/158 N22: renamed to {@link parseQuestionResponse} — unifies the HITL trio's parse-fn
43
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
44
- * human's reply body"). Kept as a compat alias. */
45
- export declare const parseQuestionAnswer: typeof parseQuestionResponse;
46
42
  /**
47
43
  * Coordinates AskUserQuestion HITL for the singleton runner. Process-local + same-replica (the pending map is in memory,
48
44
  * like ElicitationCoordinator / steerableRuns): a respond that lands on another replica finds nothing → 404. Present
package/dist/question.js CHANGED
@@ -63,10 +63,6 @@ export function parseQuestionResponse(body) {
63
63
  }
64
64
  return { ok: true, value: { answers: out } };
65
65
  }
66
- /** @deprecated design/158 N22: renamed to {@link parseQuestionResponse} — unifies the HITL trio's parse-fn
67
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
68
- * human's reply body"). Kept as a compat alias. */
69
- export const parseQuestionAnswer = parseQuestionResponse;
70
66
  /** redactDeep + size-bound the UNTRUSTED model-authored questions before they are persisted/streamed (a question's
71
67
  * free-text — question/header/option label+description — can echo a secret from the model's context). Over the byte
72
68
  * cap OR unserializable ⇒ undefined (drop; the ask headless-defaults). */
@@ -53,11 +53,6 @@ export declare function parseToolApprovalResponse(body: unknown): {
53
53
  ok: false;
54
54
  error: string;
55
55
  };
56
- /** @deprecated design/158 N22: renamed to {@link parseToolApprovalResponse} — unifies the HITL trio's parse-fn
57
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
58
- * human's reply body"; `ToolApprovalDecision` itself is unchanged — it names the allow/deny VALUE, not the
59
- * parse function). Kept as a compat alias. */
60
- export declare const parseToolApprovalDecision: typeof parseToolApprovalResponse;
61
56
  /**
62
57
  * Coordinates the live tool-approval HITL for the singleton runner. Process-local + same-replica (the pending map is
63
58
  * in memory, like QuestionCoordinator): a respond that lands on another replica finds nothing → 404. Present (passed
@@ -85,11 +85,6 @@ export function parseToolApprovalResponse(body) {
85
85
  }
86
86
  return { ok: false, error: 'decision must be one of "allow" | "allow_session" | "deny"' };
87
87
  }
88
- /** @deprecated design/158 N22: renamed to {@link parseToolApprovalResponse} — unifies the HITL trio's parse-fn
89
- * vocabulary (`parseQuestionResponse` / `parseElicitationResponse` / `parseToolApprovalResponse`, all "the
90
- * human's reply body"; `ToolApprovalDecision` itself is unchanged — it names the allow/deny VALUE, not the
91
- * parse function). Kept as a compat alias. */
92
- export const parseToolApprovalDecision = parseToolApprovalResponse;
93
88
  /** [1550] RB-39② 兑现:判别式换 core 1.378 显式键 `fromSubagent`(委派子代 gate 发起的 ask 恒带,受信
94
89
  * internals 事实——worker 不可伪造/不可抑制)。取代 [1546] MED-1 的「在场 ∧ ≠ 宿主 sessionId」权宜式
95
90
  * (旧判别式靠 ctx.sessionId 参与推导,sessionless adhoc 场景无法区分;显式键不依赖 ctx,恒定准确)。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "3.4.2",
3
+ "version": "3.5.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",