@sema-agent/server 5.1.2 → 5.3.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.
@@ -253,7 +253,10 @@ export async function openStores(ctx) {
253
253
  mailboxStore = new TiDBMailboxStore(mysqlPool);
254
254
  }
255
255
  else if (backend?.kind === "local") {
256
- mailboxStore = new FileMailboxStore(config.localDataRoot ?? localRoot);
256
+ // #113([2399]③→[2408] core 5.2.0 补座):腐读披露——照 roster 同形;torn-tail 静默=core 有意边界。
257
+ mailboxStore = new FileMailboxStore(config.localDataRoot ?? localRoot, {
258
+ onCorruptRead: (info) => logger.warn("mailbox_corrupt_read", { path: info.path, reason: info.reason }),
259
+ });
257
260
  }
258
261
  if (mailboxStore)
259
262
  logger.info("mailbox_store_enabled", { backend: pgPool ? "pg" : mysqlPool ? "tidb" : "file" });
@@ -668,7 +668,10 @@ export function fleetBackgroundChildPublisher(bus, log) {
668
668
  // 现状 core 只在 terminal 事件带此键(三发射点亲核)⇒ 本透传对旧 core 惰性;core 停 spawn/tick
669
669
  // 源头补上即通,tick 臂(下方 :78x)早已同姿。server 不自行以 sessionId 推导——fork lane 的
670
670
  // forkTranscriptId 与 sessionId 的等价关系归 core 所有,不在消费端烙死。
671
- bus.publishTask({ id: e.taskId, name: redactSecrets(e.description ?? e.name ?? e.taskId), ...(e.agentType ? { agentType: redactSecrets(e.agentType) } : {}), ...rowTags(m), status: "running", tokens: 0, ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
671
+ // [2400] FLEET-WORKFLOWS-7:[2070]③「名不铸」的第四处——spawn 双缺 description/name 时此前 `?? e.taskId`
672
+ // 拿 a* handle 冒充显示名;tick 臂只在 name 在场才发 + 总线 MERGE ⇒ 假名永久留行。缺席不铸,与其余三处同判。
673
+ const spawnName = e.description ?? e.name;
674
+ bus.publishTask({ id: e.taskId, ...(spawnName !== undefined ? { name: redactSecrets(spawnName) } : {}), ...(e.agentType ? { agentType: redactSecrets(e.agentType) } : {}), ...rowTags(m), status: "running", tokens: 0, ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
672
675
  dlog("bg_child_event", { kind: "spawn", taskId: e.taskId, sessionScoped: e.sessionScoped, scope: m.tenantScope, hostSessionId: m.hostSessionId ?? null, parentTaskId: m.parentTaskId ?? null });
673
676
  };
674
677
  const handleTick = (e, m) => {
@@ -127,12 +127,13 @@ async function handleCapabilitiesBody(req, res, url, ctx, miss) {
127
127
  subagentResume: Boolean(deps.subagentSteerRegistry) && Boolean(deps.runStore),
128
128
  // TaskRequest.settings (client per-request SemaSettings stamp) → projected into the engine TIGHTEN-ONLY
129
129
  // (deny-wins, after the deployment + operator baseline). v1 wires permissions + permissionMode (default/
130
- // acceptEdits/plan — `bypassPermissions` is NEVER honored from settings) + model + outputStyle. `env` is
131
- // DEFERRED (TaskSpec deliberately has no per-task env injection) advertised here so the client never
132
- // silently loses a setting (it can warn the user / withhold those fields).
130
+ // acceptEdits/plan — `bypassPermissions` is NEVER honored from settings) + model + outputStyle.
131
+ // `env`([2400] X-8):与真消费点同谓词——resolve-spec setSessionShellEnv 只在 cwdHonored
132
+ // (单用户 host lane)注入 shell env;其余 lane 收到即警告忽略。此前硬编码 false 是「TaskSpec
133
+ // per-task env 注入」时代的陈旧断言(R-survey shellEnv seam 落地后失真=说没有但其实有,活能力被藏)。
133
134
  // `hooks`(hook-runner 阶段一):TRUE 当本部署会真跑 hook 命令 = 单用户闸(hook 命令跑在
134
135
  // worker host,class ② 能力授予;resolveSpec 的 taskHooks 装配同一谓词)。多租户 = false(收到警告忽略)。
135
- taskSettings: { permissions: true, permissionMode: true, model: true, outputStyle: true, env: false, hooks: deps.config.requirePrincipal !== true },
136
+ taskSettings: { permissions: true, permissionMode: true, model: true, outputStyle: true, env: cwdHonored(deps.config), hooks: deps.config.requirePrincipal !== true },
136
137
  // [1476] R1 / [1478] R2: TaskRequest.appendSystemPrompt is accepted top-level → TaskSpec.appendSystemPrompt
137
138
  // (first-class lane for the shell's product-knowledge block). A shell probes THIS flag: false/absent ⇒ fall
138
139
  // back to the settings.outputStyle ride-along (older servers fold that into the same spec field).
@@ -10,6 +10,10 @@ import type { AgentDefinition, McpServerSpec } from "@sema-agent/core";
10
10
  export interface TaskRequestBody {
11
11
  objective: string;
12
12
  sessionId?: string;
13
+ /** dispatch-gateway failover 幂等第二级:caller-minted 任务 id(uuidv7)。同 owner 重放同 id ⇒ 幂等重放;
14
+ * 异 owner ⇒ 409 `conflict.run_exists`;非 uuidv7 ⇒ 400 `request.id_invalid`(routes/runs.ts:192-208 真验收)。
15
+ * [2400] TR-16 连带:此键此前只活在 runs.ts 读点,导出类型漏declared——CAPS-OPS-13 同族第 9 键。 */
16
+ taskId?: string;
13
17
  images?: Array<{
14
18
  data: string;
15
19
  mimeType: string;
@@ -159,17 +163,30 @@ export interface TaskRequestBody {
159
163
  timeoutSec?: number;
160
164
  maxOutputTokens?: number;
161
165
  maxTurns?: number;
166
+ deadlineNudge?: false;
167
+ callCapByDeadline?: false;
168
+ gracefulFinalize?: false;
162
169
  };
163
170
  /** design/133 (core 1.251) + G1 (core 1.253): turn-boundary attachment reminders (todo / changed-files /
164
- * plan-mode) + one-shot boundary notices (post-compaction background-task recap / deferred-tools delta). */
171
+ * plan-mode) + one-shot boundary notices (post-compaction background-task recap / deferred-tools delta).
172
+ * [2400] CAPS-OPS-13:本类型经 src/index.ts 导出给 embedder——键集必须与真验收面(spec-fields.ts
173
+ * normalizeAttachments 10 键 / normalizeLimits 6 键)同源;此前少 8 键 ⇒ agentListing:false(唯一能关
174
+ * core 默认开列表注入的通道)与三个 deadline opt-out 在类型面失踪。agentListing/skillsListing 是
175
+ * boolean 透传(core DEFAULT-ON,explicit false 才关);budgetUsd/mcpInstructions 只认 literal true;
176
+ * limits 三个 opt-out 只认 literal false(normalizer 同判)。 */
165
177
  attachments?: {
166
178
  todoReminder?: boolean;
179
+ todoReminderMode?: "baseline" | "off";
167
180
  changedFiles?: boolean | {
168
181
  maxFiles?: number;
169
182
  };
170
183
  planModeReminder?: boolean;
184
+ budgetUsd?: true;
171
185
  backgroundTasks?: boolean;
172
186
  toolsDelta?: boolean;
187
+ mcpInstructions?: true;
188
+ agentListing?: boolean;
189
+ skillsListing?: boolean;
173
190
  };
174
191
  /** C1 (core 1.219, subagent viewing pane): opt-in — forward a delegated child's live CONTENT events
175
192
  * (text_delta/reasoning_delta/tool_start/tool_end, each stamped `parentToolCallId`) onto this run's stream/durable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "5.1.2",
3
+ "version": "5.3.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.1.0",
57
+ "@sema-agent/core": "^5.2.0",
58
58
  "@sema-agent/registry-core": "^0.13.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": "^4.1.0",
71
+ "@sema-agent/sdk": "^4.2.0",
72
72
  "@types/libsodium-wrappers": "^0.7.14",
73
73
  "@types/node": "22.10.2",
74
74
  "@types/pg": "^8.20.0",