@sema-agent/server 6.1.0 → 6.2.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.
@@ -129,7 +129,6 @@ export declare function semaIdentityProvider(): PromptProvider;
129
129
  * 无 systemPrompt 且无品牌时原样返回 core 常量(测试以引用比对锁 bench 同源,不做字符串快照)。
130
130
  */
131
131
  export declare function codePromptProvider(brand: boolean): PromptProvider;
132
- /** @deprecated [891] 改名 code——一版过渡期保留旧符号(与场景名 alias 同窗退役)。 */
133
132
  export declare function buildScenarios(deps: ScenarioDeps): Record<string, Scenario>;
134
133
  /** Resolve the scenario for a request (falls back to `default`). */
135
134
  export declare function selectScenario(scenarios: Record<string, Scenario>, name: string | undefined): Scenario;
@@ -85,8 +85,9 @@ export function codePromptProvider(brand) {
85
85
  ],
86
86
  };
87
87
  }
88
- /** @deprecated [891] 改名 code——一版过渡期保留旧符号(与场景名 alias 同窗退役)。 */
89
88
  // [2400] CAPS-OPS-11:autonomousPromptProvider 别名导出已随场景退役删除(真身=codePromptProvider)。
89
+ // 其 `@deprecated` JSDoc 曾残留于此,被 tsc 误挂到下方 buildScenarios(三处调用点全告 deprecated
90
+ // ——TODO-3 立案的「迁移」实为孤儿注释,随删除清账;buildScenarios 本身非退役面)。
90
91
  export function buildScenarios(deps) {
91
92
  // The default scenario filters skills by "default" — NOT by req.scenario (which may be an unknown name
92
93
  // that fell back here): the bundle must be a coherent "default" set, matching how main.ts resolves an
@@ -6,7 +6,7 @@
6
6
  * `POST /v1/assistant/tasks/:id/resume`) instead of FAILING; absent ⇒ a limit still FAILS.
7
7
  *
8
8
  * 🔴 EXCLUDE verify/cascade tasks. Core runs their implementation via `runWithVerification`/`runCascade`, which
9
- * map an inner durable suspend to a FAILED result (`errorCode: "unexpected.suspended"`). The service would then
9
+ * map an inner durable suspend to a FAILED result (`errorCode: "suspended.awaiting_approval"`,core 5.9.0 W1 改名). The service would then
10
10
  * `setTerminal(failed)` while core had already minted a pending `resource_limit` checkpoint + suspended the
11
11
  * remote VM — ORPHANING both (the run row is terminal, so nothing resumes them). So a resource-limit hit on a
12
12
  * verify/cascade task must FAIL CLEANLY (no suspend), exactly as before the flag. This exclusion is the SAME
@@ -6,7 +6,7 @@
6
6
  * `POST /v1/assistant/tasks/:id/resume`) instead of FAILING; absent ⇒ a limit still FAILS.
7
7
  *
8
8
  * 🔴 EXCLUDE verify/cascade tasks. Core runs their implementation via `runWithVerification`/`runCascade`, which
9
- * map an inner durable suspend to a FAILED result (`errorCode: "unexpected.suspended"`). The service would then
9
+ * map an inner durable suspend to a FAILED result (`errorCode: "suspended.awaiting_approval"`,core 5.9.0 W1 改名). The service would then
10
10
  * `setTerminal(failed)` while core had already minted a pending `resource_limit` checkpoint + suspended the
11
11
  * remote VM — ORPHANING both (the run row is terminal, so nothing resumes them). So a resource-limit hit on a
12
12
  * verify/cascade task must FAIL CLEANLY (no suspend), exactly as before the flag. This exclusion is the SAME
package/dist/runs.d.ts CHANGED
@@ -168,7 +168,7 @@ export declare class TurnAnchorCapture {
168
168
  * Strip the durable-resume capability token from a result before it is persisted to the replayable event
169
169
  * log / run row or returned to the submitter. The token IS the resume credential (token-as-auth, search
170
170
  * [18] Q1b) and must never leave the service. Safe on any result (no-op when absent) — notably core maps a
171
- * NESTED suspend under verify/cascade to status:"failed" + errorCode "unexpected.suspended" while still
171
+ * NESTED suspend under verify/cascade to status:"failed" + errorCode "suspended.awaiting_approval"(core 5.9.0 W1 改名)while still
172
172
  * spreading `checkpointToken`, so that "failed" path (unlike the stream path's explicit suspend handling)
173
173
  * would otherwise leak it into task_event / task_run.result / the sync 200 response. `checkpointGate` is
174
174
  * non-secret and intentionally kept.
package/dist/runs.js CHANGED
@@ -237,7 +237,7 @@ export class TurnAnchorCapture {
237
237
  * Strip the durable-resume capability token from a result before it is persisted to the replayable event
238
238
  * log / run row or returned to the submitter. The token IS the resume credential (token-as-auth, search
239
239
  * [18] Q1b) and must never leave the service. Safe on any result (no-op when absent) — notably core maps a
240
- * NESTED suspend under verify/cascade to status:"failed" + errorCode "unexpected.suspended" while still
240
+ * NESTED suspend under verify/cascade to status:"failed" + errorCode "suspended.awaiting_approval"(core 5.9.0 W1 改名)while still
241
241
  * spreading `checkpointToken`, so that "failed" path (unlike the stream path's explicit suspend handling)
242
242
  * would otherwise leak it into task_event / task_run.result / the sync 200 response. `checkpointGate` is
243
243
  * non-secret and intentionally kept.
@@ -26,6 +26,14 @@ export interface ToolApprovalFrame {
26
26
  /** [1550] 展示身份(子代 agent 名)——UNTRUSTED-for-display(core 未做秘密脱敏)→ redactSecrets 后渲。
27
27
  * 仅子代 ask 上可能在场(core 未必总能解析出名字)。 */
28
28
  sourceAgentName?: string;
29
+ /** core 5.9.0 W1([2535]):审批上浮的出处链——{parentToolCallId, depth, agentName?}(孙代最内层帧
30
+ * 胜出)。只读展示增强(cli [2516] 验收形=审批卡带子代出处);agentName UNTRUSTED → redactSecrets。
31
+ * 只在子代 ask 上在场(与 fromSubagent 同门)。 */
32
+ delegation?: {
33
+ parentToolCallId: string;
34
+ depth: number;
35
+ agentName?: string;
36
+ };
29
37
  message?: string;
30
38
  /** "tool_approval" only: the tool call's args, secret-redacted, UNTRUSTED-for-display. Absent (with
31
39
  * `argsOmitted: true`) when over the byte cap or unserializable. */
@@ -329,6 +329,16 @@ export class ToolApprovalCoordinator {
329
329
  sourceTaskId: req.sourceTaskId,
330
330
  fromSubagent: true,
331
331
  ...(typeof req.sourceAgentName === "string" ? { sourceAgentName: redactSecrets(req.sourceAgentName) } : {}),
332
+ // core 5.9.0 W1:出处链透传(agentName 同 sourceAgentName 待遇 redact;其余为 core-mint 标识非内容)。
333
+ ...(req.delegation
334
+ ? {
335
+ delegation: {
336
+ parentToolCallId: req.delegation.parentToolCallId,
337
+ depth: req.delegation.depth,
338
+ ...(typeof req.delegation.agentName === "string" ? { agentName: redactSecrets(req.delegation.agentName) } : {}),
339
+ },
340
+ }
341
+ : {}),
332
342
  }
333
343
  : {}),
334
344
  message: typeof req.message === "string" ? redactDeep(req.message) : "",
@@ -25,7 +25,7 @@ type BgNotifExcluded = "kind" | "sessionScoped" | "owner" | "scope" | "descripti
25
25
  type _GuardBgNotif = AssertAllKeysHandled<Exclude<keyof BackgroundChildEvent, BgNotifProjected | BgNotifExcluded>>;
26
26
  type RosterProjected = "name" | "agentId" | "sessionId" | "toolUseId" | "owner" | "scope" | "sessionScoped" | "rootSessionId" | "model" | "createdAt";
27
27
  type _GuardRoster = AssertAllKeysHandled<Exclude<keyof RosterEntry, RosterProjected>>;
28
- type AskProjected = "toolName" | "args" | "message" | "sourceTaskId" | "fromSubagent" | "sourceAgentName";
28
+ type AskProjected = "toolName" | "args" | "message" | "sourceTaskId" | "fromSubagent" | "sourceAgentName" | "delegation";
29
29
  type AskExcluded = "toolCallId" | "preview" | "principal" | "requiresRealApproval";
30
30
  type _GuardAsk = AssertAllKeysHandled<Exclude<keyof AskRequest, AskProjected | AskExcluded>>;
31
31
  type TaskEventHandled = "text_delta" | "reasoning_delta" | "tool_start" | "tool_end" | "turn_end" | "compacted" | "diagnostics" | "message_committed" | "status" | "task_notification" | "task_progress" | "steering_injected" | "workspace_changed" | "done" | "context_usage" | "compaction_outcome";
@@ -129,6 +129,7 @@ export declare function toolEndEventData(ev: {
129
129
  truncated?: boolean;
130
130
  totalChars?: number;
131
131
  structured?: unknown;
132
+ errorCode?: string;
132
133
  eventId?: string;
133
134
  parentToolCallId?: string;
134
135
  }): Record<string, unknown>;
@@ -156,6 +156,9 @@ export function toolEndEventData(ev) {
156
156
  // core 1.442([1898] RB-210):截断诚实体量(各 block 真实大小之和,不含 JSON 包装开销)。
157
157
  ...(Number.isFinite(ev.totalChars) ? { totalChars: ev.totalChars } : {}),
158
158
  ...(ev.structured !== undefined ? { structured: redactDeep(ev.structured) } : {}),
159
+ // core 5.9.0 W3([2535]):park/死投影结构化标记(引擎闭词表 `gate.parked`/`tool.not_found`,只在
160
+ // isError 时在场)——verbatim 透传,壳按它判别 park 毒化帧而不锚 abort 文案字面。
161
+ ...(typeof ev.errorCode === "string" ? { errorCode: ev.errorCode } : {}),
159
162
  ...identityFields(ev),
160
163
  };
161
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "6.1.0",
3
+ "version": "6.2.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.8.0",
57
+ "@sema-agent/core": "^5.9.0",
58
58
  "@sema-agent/registry-core": "^0.14.0",
59
59
  "e2b": "^2.28.0",
60
60
  "libsodium-wrappers": "^0.8.4",
@@ -68,7 +68,7 @@
68
68
  "sharp": "^0.35.3"
69
69
  },
70
70
  "devDependencies": {
71
- "@sema-agent/sdk": "^6.0.0",
71
+ "@sema-agent/sdk": "^6.1.0",
72
72
  "@types/libsodium-wrappers": "^0.7.14",
73
73
  "@types/node": "22.10.2",
74
74
  "@types/pg": "^8.20.0",