@sema-agent/server 7.137.0 → 7.139.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 (328) hide show
  1. package/MIGRATION.md +600 -142
  2. package/README.md +7 -3
  3. package/README.zh-CN.md +6 -3
  4. package/USAGE.md +132 -41
  5. package/deploy/sema-up/README.md +1 -1
  6. package/deploy/sema-up/lib/lanes.json +3 -2
  7. package/dist/adoption/wire.d.ts +3 -3
  8. package/dist/approval-card.d.ts +23 -16
  9. package/dist/approval-card.js +1 -0
  10. package/dist/audit.js +1 -0
  11. package/dist/background-agent-name.d.ts +5 -0
  12. package/dist/background-agent-name.js +5 -0
  13. package/dist/bench/s1/arms.d.ts +1 -1
  14. package/dist/bench/s1/arms.js +1 -3
  15. package/dist/bench/s1/run-firm.js +2 -2
  16. package/dist/boot/budget-tracing.d.ts +1 -12
  17. package/dist/boot/deployment-mods.d.ts +46 -16
  18. package/dist/boot/deployment-mods.js +82 -6
  19. package/dist/boot/device-lane.d.ts +8 -3
  20. package/dist/boot/device-lane.js +7 -2
  21. package/dist/boot/execution-env.d.ts +4 -2
  22. package/dist/boot/execution-env.js +16 -24
  23. package/dist/boot/execution-lane.d.ts +1 -1
  24. package/dist/boot/governance-seams.d.ts +12 -18
  25. package/dist/boot/governance-seams.js +10 -24
  26. package/dist/boot/leader.d.ts +3 -0
  27. package/dist/boot/leader.js +1 -0
  28. package/dist/boot/memory-consolidation.js +2 -2
  29. package/dist/boot/org-delivery.js +15 -2
  30. package/dist/boot/resolve-spec.d.ts +4 -1
  31. package/dist/boot/resolve-spec.js +29 -19
  32. package/dist/boot/retention-lane.d.ts +14 -8
  33. package/dist/boot/retention-lane.js +2 -8
  34. package/dist/boot/runner-deps.d.ts +10 -4
  35. package/dist/boot/runner-deps.js +2 -0
  36. package/dist/boot/session-faces.d.ts +0 -3
  37. package/dist/boot/session-faces.js +15 -8
  38. package/dist/boot/stage-02-web-admin-pull.js +2 -2
  39. package/dist/boot/stage-04-stores.d.ts +1 -12
  40. package/dist/boot/stage-05-execution-env.d.ts +3 -12
  41. package/dist/boot/stage-05-execution-env.js +8 -5
  42. package/dist/boot/stage-06-runners.d.ts +3 -12
  43. package/dist/boot/stage-06-runners.js +5 -3
  44. package/dist/boot/stage-07-capability-layer.d.ts +3 -12
  45. package/dist/boot/stage-07-capability-layer.js +2 -2
  46. package/dist/boot/stage-08-reapers.d.ts +3 -12
  47. package/dist/boot/stage-09-leader.d.ts +3 -12
  48. package/dist/boot/stage-09-leader.js +2 -3
  49. package/dist/boot/stage-10-http-server.d.ts +3 -12
  50. package/dist/boot/stage-10-http-server.js +5 -3
  51. package/dist/boot/stores.js +4 -4
  52. package/dist/boot/web-admin.d.ts +5 -2
  53. package/dist/boot/web-admin.js +5 -5
  54. package/dist/brain.js +5 -5
  55. package/dist/budget.d.ts +17 -15
  56. package/dist/budget.js +2 -2
  57. package/dist/capabilities/mcp-probe.d.ts +36 -11
  58. package/dist/capabilities/mcp-probe.js +44 -5
  59. package/dist/capabilities/scenarios.d.ts +1 -1
  60. package/dist/capability-facts.d.ts +21 -7
  61. package/dist/capability-facts.js +13 -3
  62. package/dist/checkpoint-identity.d.ts +13 -6
  63. package/dist/config-catalog.js +14 -8
  64. package/dist/config-invariants.d.ts +23 -3
  65. package/dist/config-invariants.js +42 -0
  66. package/dist/config-provider.d.ts +19 -24
  67. package/dist/config-provider.js +27 -12
  68. package/dist/config-types.d.ts +25 -12
  69. package/dist/config.d.ts +33 -0
  70. package/dist/config.js +52 -20
  71. package/dist/delegated-session-owner.d.ts +2 -2
  72. package/dist/deployment-shape.d.ts +7 -7
  73. package/dist/device-enrollment.d.ts +41 -2
  74. package/dist/device-enrollment.js +27 -12
  75. package/dist/device-store.d.ts +58 -85
  76. package/dist/device-store.js +19 -49
  77. package/dist/device-ws-hub.js +2 -1
  78. package/dist/env-name-allowlist-knobs.d.ts +5 -4
  79. package/dist/exec-cut.d.ts +60 -0
  80. package/dist/exec-cut.js +36 -0
  81. package/dist/execution-lane-caps.d.ts +19 -0
  82. package/dist/execution-lane-caps.js +10 -0
  83. package/dist/execution-placement.d.ts +259 -0
  84. package/dist/execution-placement.js +199 -0
  85. package/dist/field-conflict.d.ts +3 -2
  86. package/dist/field-conflict.js +1 -0
  87. package/dist/gate-settlement.d.ts +71 -0
  88. package/dist/gate-settlement.js +40 -0
  89. package/dist/hooks/classic-stations.d.ts +1 -0
  90. package/dist/hooks/classic-stations.js +1 -0
  91. package/dist/hooks/command-spawn.d.ts +2 -2
  92. package/dist/hooks/hook-runner.js +14 -14
  93. package/dist/hosted-posture.d.ts +2 -2
  94. package/dist/http/admission.js +10 -19
  95. package/dist/http/checkpoint-ctx.d.ts +21 -12
  96. package/dist/http/checkpoint-ctx.js +4 -2
  97. package/dist/http/claimed-run.d.ts +1 -1
  98. package/dist/http/dispatch.d.ts +4 -0
  99. package/dist/http/dispatch.js +3 -0
  100. package/dist/http/durable-run-leg.js +12 -6
  101. package/dist/http/execution-context.d.ts +218 -0
  102. package/dist/http/execution-context.js +330 -0
  103. package/dist/http/memory-compliance-failure-reply.js +3 -0
  104. package/dist/http/resume-legs.d.ts +5 -11
  105. package/dist/http/resume-legs.js +179 -104
  106. package/dist/http/route-ctx.d.ts +44 -59
  107. package/dist/http/route-ctx.js +2 -5
  108. package/dist/http/routes/a2a-serve.js +10 -4
  109. package/dist/http/routes/agents-roster.d.ts +1 -1
  110. package/dist/http/routes/agents-roster.js +5 -1
  111. package/dist/http/routes/approvals-assistant.js +6 -6
  112. package/dist/http/routes/background.d.ts +29 -1
  113. package/dist/http/routes/background.js +29 -2
  114. package/dist/http/routes/capabilities.js +12 -10
  115. package/dist/http/routes/devices.d.ts +13 -19
  116. package/dist/http/routes/devices.js +21 -26
  117. package/dist/http/routes/mcp-reconnect.d.ts +3 -2
  118. package/dist/http/routes/mcp-reconnect.js +7 -5
  119. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  120. package/dist/http/routes/memory-origin.d.ts +1 -1
  121. package/dist/http/routes/rules.js +3 -3
  122. package/dist/http/routes/runs.js +11 -7
  123. package/dist/http/routes/session-sync.js +110 -15
  124. package/dist/http/routes/sessions.d.ts +6 -0
  125. package/dist/http/routes/sessions.js +119 -13
  126. package/dist/http/routes/side-query.d.ts +12 -4
  127. package/dist/http/routes/side-query.js +6 -8
  128. package/dist/http/routes/tasks.js +800 -782
  129. package/dist/http/server.d.ts +61 -39
  130. package/dist/http/server.js +11 -0
  131. package/dist/http/session-inherit-env.d.ts +3 -4
  132. package/dist/http/session-inherit-env.js +1 -1
  133. package/dist/http/wire-types.d.ts +22 -18
  134. package/dist/identity-source.d.ts +1 -1
  135. package/dist/index.d.ts +3 -0
  136. package/dist/index.js +1 -0
  137. package/dist/leader/wire.d.ts +7 -0
  138. package/dist/leader/wire.js +5 -4
  139. package/dist/mcp-assertion-header.d.ts +51 -40
  140. package/dist/mcp-assertion-header.js +10 -11
  141. package/dist/mcp-authorization-face.d.ts +27 -0
  142. package/dist/mcp-authorization-face.js +15 -0
  143. package/dist/memory-operator-faces.d.ts +13 -4
  144. package/dist/memory-operator-faces.js +1 -17
  145. package/dist/memory-sync-client.d.ts +53 -14
  146. package/dist/memory-sync-client.js +187 -92
  147. package/dist/memory-sync.d.ts +1 -1
  148. package/dist/memory-sync.js +3 -2
  149. package/dist/model-route-gap.d.ts +6 -22
  150. package/dist/model-route-gap.js +7 -5
  151. package/dist/mods-declaration.d.ts +110 -0
  152. package/dist/mods-declaration.js +109 -0
  153. package/dist/observability/cost-taxonomy.d.ts +2 -2
  154. package/dist/observability/err-text.d.ts +5 -0
  155. package/dist/observability/err-text.js +9 -0
  156. package/dist/observability/fail-open.d.ts +17 -1
  157. package/dist/observability/fail-open.js +17 -1
  158. package/dist/observability/run-terminal.js +0 -1
  159. package/dist/observability/secret-env-scrub.d.ts +1 -1
  160. package/dist/observability/secret-env-scrub.js +1 -1
  161. package/dist/orchestration/workflow-notify-journal.js +4 -4
  162. package/dist/org-memory-admission.d.ts +4 -3
  163. package/dist/org-memory-admission.js +6 -6
  164. package/dist/parked-decide.d.ts +49 -11
  165. package/dist/parked-decide.js +25 -26
  166. package/dist/parked-revive-surface.d.ts +12 -15
  167. package/dist/parked-revive-surface.js +3 -6
  168. package/dist/peer-seat.d.ts +156 -0
  169. package/dist/peer-seat.js +273 -0
  170. package/dist/permission-rule-vocab.d.ts +7 -7
  171. package/dist/permission-rule-vocab.js +3 -3
  172. package/dist/plain-string-record.d.ts +38 -0
  173. package/dist/plain-string-record.js +38 -0
  174. package/dist/plugins/approval-ask-store-file.d.ts +7 -0
  175. package/dist/plugins/approval-ask-store-file.js +11 -0
  176. package/dist/plugins/approval-ask-store-memory.d.ts +6 -0
  177. package/dist/plugins/approval-ask-store-memory.js +12 -0
  178. package/dist/plugins/approval-ask-store-sql.d.ts +22 -5
  179. package/dist/plugins/approval-ask-store-sql.js +30 -12
  180. package/dist/plugins/background-agent-store-sql.js +6 -3
  181. package/dist/plugins/caching-session-store.d.ts +11 -2
  182. package/dist/plugins/caching-session-store.js +15 -3
  183. package/dist/plugins/checkpoint-store-sql.d.ts +21 -25
  184. package/dist/plugins/checkpoint-store-sql.js +13 -15
  185. package/dist/plugins/device-store-sql.d.ts +25 -51
  186. package/dist/plugins/device-store-sql.js +49 -103
  187. package/dist/plugins/execution-placement-sql.d.ts +151 -0
  188. package/dist/plugins/execution-placement-sql.js +223 -0
  189. package/dist/plugins/file-history-store-sql.d.ts +7 -6
  190. package/dist/plugins/file-history-store-sql.js +8 -7
  191. package/dist/plugins/file-run-store.d.ts +6 -1
  192. package/dist/plugins/file-run-store.js +4 -0
  193. package/dist/plugins/fork-routing-session-store.d.ts +6 -0
  194. package/dist/plugins/fork-routing-session-store.js +16 -0
  195. package/dist/plugins/k8s-pod-reaper.d.ts +2 -8
  196. package/dist/plugins/k8s-pod-reaper.js +3 -3
  197. package/dist/plugins/local-checkpoint-store.d.ts +1 -11
  198. package/dist/plugins/local-checkpoint-store.js +0 -1
  199. package/dist/plugins/local-session-store.d.ts +183 -45
  200. package/dist/plugins/local-session-store.js +412 -105
  201. package/dist/plugins/mailbox-store-sql.d.ts +11 -3
  202. package/dist/plugins/mailbox-store-sql.js +103 -15
  203. package/dist/plugins/memory-key-guards.d.ts +4 -0
  204. package/dist/plugins/memory-key-guards.js +1 -0
  205. package/dist/plugins/memory-run-store.d.ts +1 -1
  206. package/dist/plugins/memory-sync-store-pg.d.ts +16 -5
  207. package/dist/plugins/memory-sync-store-tidb.d.ts +3 -3
  208. package/dist/plugins/one-time-migrations.d.ts +117 -6
  209. package/dist/plugins/one-time-migrations.js +383 -14
  210. package/dist/plugins/outcome-ledger-sql.d.ts +2 -2
  211. package/dist/plugins/permission-rule-store-sql.d.ts +13 -15
  212. package/dist/plugins/permission-rule-store-sql.js +34 -29
  213. package/dist/plugins/pg-pool.d.ts +7 -3
  214. package/dist/plugins/pg-session-storage.d.ts +41 -22
  215. package/dist/plugins/pg-session-storage.js +136 -55
  216. package/dist/plugins/remote-env-adb.d.ts +22 -4
  217. package/dist/plugins/remote-env-adb.js +70 -62
  218. package/dist/plugins/remote-env-device.d.ts +32 -12
  219. package/dist/plugins/remote-env-device.js +18 -17
  220. package/dist/plugins/remote-env-e2b.d.ts +19 -3
  221. package/dist/plugins/remote-env-e2b.js +41 -42
  222. package/dist/plugins/remote-env-file-error.d.ts +2 -0
  223. package/dist/plugins/remote-env-file-error.js +1 -1
  224. package/dist/plugins/remote-env-host.d.ts +23 -8
  225. package/dist/plugins/remote-env-host.js +66 -70
  226. package/dist/plugins/remote-env-k8s.d.ts +13 -16
  227. package/dist/plugins/remote-env-k8s.js +61 -54
  228. package/dist/plugins/remote-env-local-docker.d.ts +30 -5
  229. package/dist/plugins/remote-env-local-docker.js +46 -59
  230. package/dist/plugins/remote-env-ssh.d.ts +18 -4
  231. package/dist/plugins/remote-env-ssh.js +72 -56
  232. package/dist/plugins/remote-shell.d.ts +100 -3
  233. package/dist/plugins/remote-shell.js +166 -2
  234. package/dist/plugins/retention-store-sql.d.ts +23 -8
  235. package/dist/plugins/retention-store-sql.js +13 -1
  236. package/dist/plugins/run-store-sql.d.ts +13 -3
  237. package/dist/plugins/run-store-sql.js +5 -0
  238. package/dist/plugins/schema-consistency.d.ts +15 -5
  239. package/dist/plugins/schema-consistency.js +14 -8
  240. package/dist/plugins/schema-drift-sentence.d.ts +27 -0
  241. package/dist/plugins/schema-drift-sentence.js +38 -0
  242. package/dist/plugins/session-fork.d.ts +63 -12
  243. package/dist/plugins/session-fork.js +38 -21
  244. package/dist/plugins/session-ownership.d.ts +7 -0
  245. package/dist/plugins/session-ownership.js +5 -0
  246. package/dist/plugins/session-row-sql.d.ts +22 -0
  247. package/dist/plugins/session-row-sql.js +81 -0
  248. package/dist/plugins/session-store.d.ts +1 -1
  249. package/dist/plugins/session-workspace-cell.d.ts +17 -0
  250. package/dist/plugins/session-workspace-cell.js +38 -0
  251. package/dist/plugins/store-backend.d.ts +1 -1
  252. package/dist/plugins/store-backend.js +26 -14
  253. package/dist/plugins/store-contracts.d.ts +25 -5
  254. package/dist/plugins/tidb-pool.d.ts +12 -7
  255. package/dist/plugins/tidb-pool.js +15 -3
  256. package/dist/plugins/tidb-session-store.d.ts +74 -28
  257. package/dist/plugins/tidb-session-store.js +132 -53
  258. package/dist/plugins/tool-result-store-sql.d.ts +16 -8
  259. package/dist/plugins/tool-result-store-sql.js +26 -17
  260. package/dist/plugins/worktree-isolation.d.ts +3 -2
  261. package/dist/plugins/worktree-isolation.js +1 -7
  262. package/dist/project-identity.d.ts +1 -14
  263. package/dist/project-identity.js +0 -4
  264. package/dist/project-memory.d.ts +9 -15
  265. package/dist/project-memory.js +5 -4
  266. package/dist/request-key-closure.js +1 -1
  267. package/dist/request-value-closure.d.ts +6 -7
  268. package/dist/request-value-closure.js +1 -3
  269. package/dist/rules-consent.js +6 -4
  270. package/dist/run-local.d.ts +6 -0
  271. package/dist/run-local.js +36 -26
  272. package/dist/runs.d.ts +9 -2
  273. package/dist/runs.js +9 -2
  274. package/dist/sandbox-git-plane.d.ts +2 -2
  275. package/dist/security.d.ts +38 -12
  276. package/dist/security.js +8 -2
  277. package/dist/server-secret-env.d.ts +15 -8
  278. package/dist/server-secret-env.js +4 -2
  279. package/dist/session-children-retire.d.ts +27 -9
  280. package/dist/session-children-retire.js +9 -5
  281. package/dist/session-incarnation.d.ts +19 -10
  282. package/dist/session-incarnation.js +5 -3
  283. package/dist/session-row.d.ts +114 -5
  284. package/dist/session-row.js +55 -5
  285. package/dist/session-titler.d.ts +2 -2
  286. package/dist/session-workspace.d.ts +130 -0
  287. package/dist/session-workspace.js +83 -0
  288. package/dist/spec-fields.d.ts +1 -1
  289. package/dist/standing-answer-grant.d.ts +2 -13
  290. package/dist/standing-answer-grant.js +0 -7
  291. package/dist/task-a2a.d.ts +44 -14
  292. package/dist/task-a2a.js +46 -20
  293. package/dist/task-cwd.d.ts +6 -1
  294. package/dist/task-mcp.d.ts +33 -20
  295. package/dist/task-mcp.js +46 -22
  296. package/dist/tool-approval.d.ts +38 -8
  297. package/dist/tool-approval.js +57 -13
  298. package/dist/trace/core-keyset-guard.d.ts +33 -18
  299. package/dist/trace/engine-notice-wire.d.ts +1 -1
  300. package/dist/trace/engine-notice-wire.js +2 -0
  301. package/dist/trace/exit-seat.d.ts +20 -1
  302. package/dist/trace/exit-seat.js +3 -0
  303. package/dist/trace/extension-call-face.d.ts +33 -0
  304. package/dist/trace/extension-call-face.js +39 -0
  305. package/dist/trace/project.d.ts +26 -7
  306. package/dist/trace/project.js +30 -3
  307. package/dist/trace/redact.js +42 -13
  308. package/dist/trace/self-minted-wire.d.ts +240 -12
  309. package/dist/trace/self-minted-wire.js +100 -4
  310. package/dist/trace/wire-projection-faces.d.ts +6 -6
  311. package/dist/trace/wire-projection-faces.js +6 -5
  312. package/dist/url-refusal.d.ts +1 -1
  313. package/dist/user-authored-text.d.ts +2 -2
  314. package/dist/user-authored-text.js +16 -1
  315. package/dist/web-admin-client/apply-effective.d.ts +17 -3
  316. package/dist/web-admin-client/apply-effective.js +20 -10
  317. package/dist/web-admin-client/center-request.d.ts +3 -2
  318. package/dist/web-admin-client/center-request.js +2 -3
  319. package/dist/web-admin-client/skills-mcp.d.ts +8 -4
  320. package/dist/web-admin-client/skills-mcp.js +32 -18
  321. package/dist/web-admin-client/types.d.ts +11 -0
  322. package/package.json +3 -3
  323. package/wire-changes/server@7.138.0.json +446 -0
  324. package/wire-changes/server@7.139.0.json +348 -0
  325. package/dist/http/device-placement.d.ts +0 -175
  326. package/dist/http/device-placement.js +0 -145
  327. package/dist/http/mcp-remote-text.d.ts +0 -5
  328. package/dist/http/mcp-remote-text.js +0 -7
@@ -25,7 +25,7 @@
25
25
  * 依赖纪律:本文件是**叶**(只 type-import config-types + 值引 deployment-governance 的守卫集编译门),
26
26
  * 不引 config.ts,故 config.ts / runs.ts 都可以安全引它。
27
27
  */
28
- import type { ServiceConfigFlat } from "./config-types.js";
28
+ import type { ConfigProviderWord, ServiceConfigFlat } from "./config-types.js";
29
29
  /**
30
30
  * 活体心跳周期(ms)——`runs.ts` 的 `HEARTBEAT_MS` 就是它(那边 re-export,单源在此)。
31
31
  *
@@ -34,9 +34,9 @@ import type { ServiceConfigFlat } from "./config-types.js";
34
34
  */
35
35
  export declare const LIVENESS_HEARTBEAT_MS = 30000;
36
36
  /** 闭集:新增一条不变量必须在这里加词(拼错 = 编译红,而不是运行期悄悄不判)。 */
37
- export type CrossInvariantId = "run-stale-heartbeat" | "bind-posture" | "bake-runner-credential" | "direct-door-anchors" | "operator-principals-required" | "operator-single-user" | "bake-operator-principals" | "sensitive-write-patterns" | "leader-host-lane" | "multi-tenant-shared-lane" | "leader-durable-store" | "device-durable-store" | "device-durable-approval" | "model-provider-word" | "gateway-url-userinfo" | "anthropic-credential-exclusive" | "model-route-endpoint" | "default-model-resolvable" | "refused-names-not-minted" | "require-execution-lane" | "center-one-identity" | "workflow-park-decision-domain";
37
+ export type CrossInvariantId = "run-stale-heartbeat" | "bind-posture" | "bake-runner-credential" | "direct-door-anchors" | "operator-principals-required" | "operator-single-user" | "bake-operator-principals" | "sensitive-write-patterns" | "leader-host-lane" | "multi-tenant-shared-lane" | "leader-durable-store" | "device-durable-store" | "device-durable-approval" | "model-provider-word" | "gateway-url-userinfo" | "anthropic-credential-exclusive" | "model-route-endpoint" | "default-model-resolvable" | "refused-names-not-minted" | "require-execution-lane" | "center-one-identity" | "workflow-park-decision-domain" | "remote-config-provider-url" | "retention-lane-complete";
38
38
  /** 表读的键集(取自平铺配置型 ⇒ 键名/类型永不与真配置漂)。 */
39
- export type CrossInvariantView = Readonly<Pick<ServiceConfigFlat, "runStaleSec" | "authToken" | "authTokens" | "allowUnauthedWrites" | "imageBakes" | "directApprovalDoor" | "durableApproval" | "approvalHmacKeys" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "requirePrincipal" | "operatorPrincipals" | "operatorSingleUser" | "sensitiveWritePatterns" | "leaderEnabled" | "selfOrchestrationEnabled" | "workflowRunStoreBackend" | "remoteExec" | "requireExecutionLane" | "dbBackend" | "tidb" | "pg" | "envModel" | "gatewayBaseUrl" | "gatewayFallbackUrls" | "anthropic" | "models" | "modelRefusals" | "tiers" | "authBridgeIssuer" | "webAdmin">>;
39
+ export type CrossInvariantView = Readonly<Pick<ServiceConfigFlat, "runStaleSec" | "authToken" | "authTokens" | "allowUnauthedWrites" | "imageBakes" | "directApprovalDoor" | "durableApproval" | "approvalHmacKeys" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "requirePrincipal" | "operatorPrincipals" | "operatorSingleUser" | "sensitiveWritePatterns" | "leaderEnabled" | "selfOrchestrationEnabled" | "workflowRunStoreBackend" | "remoteExec" | "requireExecutionLane" | "dbBackend" | "tidb" | "pg" | "envModel" | "gatewayBaseUrl" | "gatewayFallbackUrls" | "anthropic" | "models" | "modelRefusals" | "tiers" | "authBridgeIssuer" | "webAdmin" | "configProvider" | "retentionPolicy" | "retentionSweep">>;
40
40
  export interface CrossInvariantInput {
41
41
  /** 现役配置(boot 期 = 候选自身)。 */
42
42
  readonly live: CrossInvariantView;
@@ -107,6 +107,26 @@ export declare function workflowParkDecisionDomainRefusal(v: Pick<CrossInvariant
107
107
  * 标准部署形。没有 web 基址 ⇒ 无可互证,过。
108
108
  */
109
109
  export declare function centerIdentityRefusal(v: Pick<CrossInvariantView, "authBridgeIssuer" | "webAdmin">): string | undefined;
110
+ /**
111
+ * `remote-config-provider-url` —— **配置源的词要么兑现、要么拒,从不被读成另一种源**。`CONFIG_PROVIDER=remote` 说的是「这台 worker 的配置来自中心」,
112
+ * 中心就是 `WEB_ADMIN_ENV.url` 那一只;没有它,这句话无处兑现 —— 不建配置源(服务端)或读本地 `config.d`(run-local)都是把它读成了另一种源,
113
+ * 多租部署的 entitlement / 模型目录 / 治理整份缺席而进程照起。判据与拒句的唯一属主;配置源判官(`config-provider.ts` 的 `configSourceKind`)
114
+ * 收到这一组合时抛的也是这一句(到得了那里 = 有人绕过了 `loadConfig`)。状态型:两只键都只来自 env、运行期无写点 ⇒ 热路径上恒与 boot 同答。
115
+ */
116
+ export declare function remoteConfigProviderUrlRefusal(v: {
117
+ readonly configProvider?: ConfigProviderWord | undefined;
118
+ readonly webAdmin?: unknown;
119
+ }): string | undefined;
120
+ /**
121
+ * `retention-lane-complete` —— **被要的扫车道必须齐**。要车道的旋钮有两根:节律(`RETENTION_SWEEP_INTERVAL_SEC > 0`)与灰度档
122
+ * `RETENTION_MODE=enforce`(「按策略删」);齐 = 有视界(`RETENTION_MAX_AGE_DAYS`,算 cutoff)且节律 > 0(车道真在跑)。缺一 ⇒ 拒:
123
+ * enforce 而车道不跑 / 没有视界,运维以为在删而什么都没删(能力位 `retention` 只在车道齐时在场);节律在而没有视界,车道每拍枚举域、什么都算不出。
124
+ * 一条规则两种要法,拒句按要法说出路(enforce:补缺的键,或改回 audit-only —— 节律在而天数缺时连节律一起设 0;只给节律:补天数或节律设 0),
125
+ * 每条出路照做都落在本律之内(起得来)。audit-only 下「天数在、车道关」不在律内 ——
126
+ * 那只是一份声明,起服 warn `retention_policy_not_executed` 说出来(`boot/governance-seams.ts`)。车道的**接线**(执行器 / 方法 / 店声明)不是配置事实,
127
+ * 留在扫车道自持门(`boot/retention-lane.ts`)。状态型:三键都只来自 env、运行期无写点 ⇒ 热路径上恒与 boot 同答。
128
+ */
129
+ export declare function retentionLaneRefusal(v: Pick<CrossInvariantView, "retentionPolicy" | "retentionSweep">): string | undefined;
110
130
  export declare const CONFIG_CROSS_INVARIANTS: readonly CrossInvariant[];
111
131
  /**
112
132
  * 按 id 取**一条**([ref]②:boot 面的单源化出口)。
@@ -103,6 +103,34 @@ export function centerIdentityRefusal(v) {
103
103
  `the same web-admin: same host and port (http and https on one host count as one). Set ${WEB_ADMIN_ENV.webUrl} to that web-admin's console, set ` +
104
104
  `AUTH_BRIDGE_ISSUER to the web-admin's public origin, or unset ${WEB_ADMIN_ENV.webUrl}. Refusing to boot.`);
105
105
  }
106
+ export function remoteConfigProviderUrlRefusal(v) {
107
+ return v.configProvider === "remote" && v.webAdmin === undefined
108
+ ? `CONFIG_PROVIDER=remote names the web-admin center as this worker's config source, but ${WEB_ADMIN_ENV.url} is not set — there is no center to pull ` +
109
+ "from, so this worker would run without the center's configuration (tenant entitlements, model catalog, governance) while it is declared centrally managed. " +
110
+ `Set ${WEB_ADMIN_ENV.url} to the center's base URL, or set CONFIG_PROVIDER=local to read the local config directory (unset CONFIG_PROVIDER for an env-only worker). ` +
111
+ "Refusing to boot."
112
+ : undefined;
113
+ }
114
+ export function retentionLaneRefusal(v) {
115
+ const { mode, intervalSec } = v.retentionSweep;
116
+ const cadence = intervalSec > 0;
117
+ const horizon = v.retentionPolicy !== undefined;
118
+ if ((mode !== "enforce" && !cadence) || (cadence && horizon))
119
+ return undefined;
120
+ const gaps = [
121
+ ...(horizon ? [] : ["RETENTION_MAX_AGE_DAYS is unset (no horizon to compute a cutoff from)"]),
122
+ ...(cadence ? [] : ["RETENTION_SWEEP_INTERVAL_SEC is unset or 0 (the sweep lane does not run)"]),
123
+ ].join(" and ");
124
+ if (mode === "enforce") {
125
+ const needs = [...(horizon ? [] : ["RETENTION_MAX_AGE_DAYS"]), ...(cadence ? [] : ["RETENTION_SWEEP_INTERVAL_SEC above 0"])].join(" and ");
126
+ const declareOnly = cadence && !horizon ? "set RETENTION_MODE=audit-only (or unset it) and RETENTION_SWEEP_INTERVAL_SEC=0" : "set RETENTION_MODE=audit-only (or unset it)";
127
+ return (`RETENTION_MODE=enforce declares that the retention sweep lane deletes data older than the policy horizon, but ${gaps} — nothing would be deleted ` +
128
+ `while the deployment declares that it deletes. Set ${needs} (the sweep lane runs on a SQL backend), or ${declareOnly} ` +
129
+ "if this deployment is not to delete. Refusing to boot.");
130
+ }
131
+ return (`RETENTION_SWEEP_INTERVAL_SEC=${intervalSec} arms the retention sweep lane, but ${gaps} — the lane would enumerate domains every tick and compute nothing. ` +
132
+ "Set RETENTION_MAX_AGE_DAYS, or set RETENTION_SWEEP_INTERVAL_SEC=0 to leave the lane off. Refusing to boot.");
133
+ }
106
134
  export const CONFIG_CROSS_INVARIANTS = [
107
135
  {
108
136
  id: "run-stale-heartbeat",
@@ -297,6 +325,20 @@ export const CONFIG_CROSS_INVARIANTS = [
297
325
  bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:center-one-identity" },
298
326
  check: ({ next }) => centerIdentityRefusal(next),
299
327
  },
328
+ {
329
+ id: "remote-config-provider-url",
330
+ keys: ["configProvider", "webAdmin"],
331
+ restartReason: "config-source",
332
+ bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:remote-config-provider-url" },
333
+ check: ({ next }) => remoteConfigProviderUrlRefusal(next),
334
+ },
335
+ {
336
+ id: "retention-lane-complete",
337
+ keys: ["retentionPolicy", "retentionSweep"],
338
+ restartReason: "retention-lane",
339
+ bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:retention-lane-complete" },
340
+ check: ({ next }) => retentionLaneRefusal(next),
341
+ },
300
342
  ];
301
343
  export function crossInvariant(id) {
302
344
  const inv = CONFIG_CROSS_INVARIANTS.find((i) => i.id === id);
@@ -120,12 +120,12 @@ export interface ConfigProviderInput {
120
120
  };
121
121
  /** `CONFIG_PROVIDER` —— 闭集 `local` | `remote` | 缺席([ref]:词表属主 `CONFIG_PROVIDER_WORDS`,认不出的词在
122
122
  * `loadConfig` 就拒启,本层**不可能**再收到第三个词 —— 修前那条「认不出 ⇒ 当 local + warn」的臂随之删除)。
123
- * `local` forces the local backend; `remote` selects the center (falls through to local if no URL). */
123
+ * 读法只有 {@link configSourceKind} 一只:`local` 建本地源;`remote` 建中心源(没有 `webAdmin` ⇒ 抛,起服本应已拒);缺席 ⇒ 有中心建中心源、没有 ⇒ 抛(纯 env 部署不建配置源)。 */
124
124
  provider?: ConfigProviderWord;
125
125
  /** 本地配置源的根(持有 `config.d/<domain>.json`;FileConfigStore 吃根、读 `<root>/config.d`)。🔴 [ref]:**必填**,
126
126
  * 值恒来自 {@link configLocalRoot}(入口算一次,工厂与执行车道合成步读同一个)—— 修前是可选、缺席回落
127
127
  * `process.cwd()`,而工厂只在 `CONFIG_PROVIDER === "local"` 字面上递它 ⇒ 另一条走到 local 的路上配置源读 cwd、
128
- * 合成步读 localRoot,两个根分家。一个远程源也收它:`remote` 而无中心 URL 的形照样落回 local。 */
128
+ * 合成步读 localRoot,两个根分家。远程源也收它(入参形一份),只有本地源读它。 */
129
129
  localDir: string;
130
130
  /** [ref]:本地配置源的属主声明(`CONFIG_LOCAL_OWNER_UID`,配置席 `configLocalOwnerUid`)—— 每拍读 `config.d` 之前的目录信任判官与起服那一次判同一个值。
131
131
  * **必填**(值可以是 `undefined` = 没声明):两个生产构造点都必须递,漏递 = 起服判过、每拍却按「没声明」判 ⇒ 每一拍都拒(tsc 在这里挡)。 */
@@ -186,15 +186,11 @@ export declare class LocalConfigProvider implements ConfigProvider {
186
186
  */
187
187
  export declare function mapToServiceEffective(eff: AgentConfigEffective, version: number): EffectiveConfig;
188
188
  /**
189
- * Pick the backend off a CLOSED `provider` enum (`local` | `remote` | undefined): LOCAL when
190
- * `CONFIG_PROVIDER=local`, OR when no web-admin URL is configured (a lone box with config.d/ on disk
191
- * and no control plane). REMOTE otherwise (a configured center URL, the default fleet posture). A
192
- * `CONFIG_PROVIDER=remote` with no URL is a misconfiguration — we fall through to local rather than
193
- * constructing a remote provider with no endpoint (the caller would have skipped the remote pull entirely
194
- * under the old code path; local-with-empty-config.d degrades to env the same way). An UNRECOGNIZED value
195
- * never reaches this function: `loadConfig` refuses to boot on it ([ref]), so a fat-fingered knob can
196
- * neither source config from an unintended network endpoint nor be read as "local" here while the
197
- * execution-lane default reads it as "not local".
189
+ * 建判官 {@link configSourceKind} 答出来的那一种配置源:`local` ⇒ {@link LocalConfigProvider}(根 = 递进来的 `localDir`);`remote` ⇒
190
+ * {@link RemoteConfigProvider}(中心 = `webAdmin`)。判官答「无配置源」(没写词、没配中心 = 纯 env 部署)⇒ 抛:调用方只在判官答 local / remote 时建
191
+ * (服务端第 2 段先问判官;run-local 在入口只放过 `local` 的词)。没有第三种读法 —— 「remote 而没有中心 ⇒ 落回本地」那一臂已删(配置源的词要么兑现、要么拒;
192
+ * 起服在 `loadConfig` 的配置不变量段拒这一组合,到得了这里 = 绕过了 `loadConfig`,判官抛起服拒的同一句)。认不出的词同样到不了这里:
193
+ * `loadConfig` 拒启([ref]),入参型是闭集。
198
194
  */
199
195
  export declare function createConfigProvider(input: ConfigProviderInput): ConfigProvider;
200
196
  /**
@@ -209,21 +205,20 @@ export declare function createConfigProvider(input: ConfigProviderInput): Config
209
205
  export declare function configLocalRoot(config: {
210
206
  readonly configLocalDir?: string | undefined;
211
207
  }): string;
208
+ /** 配置源的两种形态(纯 env 部署没有配置源 —— 判官答 `undefined`)。 */
209
+ export type ConfigSourceKind = "local" | "remote";
212
210
  /**
213
- * {@link createConfigProvider} 会造出**哪一种**配置源 —— 判据的唯一属主(构造器与执行车道合成步读同一只:
214
- * local 形 `config.d/remote-exec.json` 的 file-wins 覆写只在配置源是 local 时生效,车PI 修复轮 ①)。
215
- * `local` 或没配中心 ⇒ local;其余 ⇒ remote。([ref] 起入参是闭集:「认不出的词 ⇒ local」那一臂随拒启删除。)
211
+ * 这台进程的配置源是**哪一种** —— 判据的唯一属主(一个问题一个读者):HTTP 服务第 2 段(目录信任 + 一次性迁移、执行车道合成步)、
212
+ * web-admin 工厂与 {@link createConfigProvider}(run-local 经它;run-local 在入口只放过 `local` 的词)都问这一只。规则一条 —— 配置源的词要么兑现、要么拒:
213
+ * · `CONFIG_PROVIDER=local` ⇒ `local`(配没配中心都是;中心照样管 fleet 面);
214
+ * · `CONFIG_PROVIDER=remote` ⇒ `remote`;没有中心 ⇒ **抛**起服拒的同一句(`remoteConfigProviderUrlRefusal`;`loadConfig` 的配置不变量段本应已拒,
215
+ * 到得了这里 = 绕过了它)—— 修前这一形在两只判官里各被读成一种别的源(服务端「无配置源」、构造器「local」),零句;
216
+ * · 不写词 ⇒ 有中心 `remote`、没有 `undefined`(纯 env 部署,不建配置源)。
217
+ * 修前是两只判官(`configProviderKind` 答 local | remote、`serviceConfigSourceKind` 包一层答 local | remote | 无),对「不写词、没配中心」一只答 local、
218
+ * 一只答无;收成这一只,两名删除。
216
219
  */
217
- export declare function configProviderKind(input: {
218
- readonly provider?: ConfigProviderWord | undefined;
219
- readonly webAdmin?: unknown;
220
- }): "local" | "remote";
221
- /**
222
- * HTTP 服务这一侧的配置源:web-admin 工厂**建不建** provider(`CONFIG_PROVIDER=local` 或配了中心才建)、建出来是哪一种。
223
- * `undefined` = 纯 env 部署(没有配置源)。工厂与执行车道合成步读这同一只(车PI 修复轮 ①:合成步排在工厂之前)。
224
- */
225
- export declare function serviceConfigSourceKind(config: {
220
+ export declare function configSourceKind(config: {
226
221
  readonly configProvider?: ConfigProviderWord | undefined;
227
222
  readonly webAdmin?: unknown;
228
- }): "local" | "remote" | undefined;
223
+ }): ConfigSourceKind | undefined;
229
224
  //# sourceMappingURL=config-provider.d.ts.map
@@ -6,6 +6,7 @@ import { assertLocalConfigDirTrusted } from "./config-dir-trust.js";
6
6
  import { danglingRefs, emptyEffective, findSkillContent, promptArtifactFor, renderRefIssue, skillContentHash, } from "@sema-agent/settings-schema";
7
7
  import { redactSecrets } from "./trace/redact.js";
8
8
  import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, skillToolListsOf, WebAdminHttpError, } from "./web-admin-client/facade.js";
9
+ import { remoteConfigProviderUrlRefusal } from "./config-invariants.js";
9
10
  import { homedir } from "node:os";
10
11
  import { join } from "node:path";
11
12
  const OPERAND_FINGERPRINT_KEY = randomBytes(16);
@@ -205,6 +206,8 @@ export function mapToServiceEffective(eff, version) {
205
206
  ...readMcpSourceLabel(s.name, s.source),
206
207
  ...(s.toolFaces !== undefined ? { toolFaces: s.toolFaces } : {}),
207
208
  ...(s.toolAxes !== undefined ? { toolAxes: s.toolAxes } : {}),
209
+ ...(s.sessionMetaKey !== undefined ? { sessionMetaKey: s.sessionMetaKey } : {}),
210
+ ...(s.startupTimeoutMs !== undefined ? { startupTimeoutMs: s.startupTimeoutMs } : {}),
208
211
  ...(s.authForm !== undefined ? { authForm: s.authForm } : {}),
209
212
  ...(s.entryKind !== undefined ? { entryKind: s.entryKind } : {}),
210
213
  };
@@ -248,21 +251,33 @@ export function mapToServiceEffective(eff, version) {
248
251
  };
249
252
  }
250
253
  export function createConfigProvider(input) {
251
- return configProviderKind(input) === "remote" && input.webAdmin !== undefined
252
- ? new RemoteConfigProvider(input.webAdmin, {}, input.skillBodyCacheDir)
253
- : new LocalConfigProvider(input.localDir, undefined, { declaredOwnerUid: input.localOwnerUid });
254
+ const kind = configSourceKind({ configProvider: input.provider, webAdmin: input.webAdmin });
255
+ if (kind === "local")
256
+ return new LocalConfigProvider(input.localDir, undefined, { declaredOwnerUid: input.localOwnerUid });
257
+ if (kind === "remote" && input.webAdmin !== undefined)
258
+ return new RemoteConfigProvider(input.webAdmin, {}, input.skillBodyCacheDir);
259
+ throw new Error(`createConfigProvider: no config source to build (CONFIG_PROVIDER is unset and no center is configured — an env-only deployment). ` +
260
+ `Build a provider only when configSourceKind answers "local" or "remote".`);
254
261
  }
255
262
  export function configLocalRoot(config) {
256
263
  return config.configLocalDir ?? process.env.AGENT_DATA_DIR ?? join(homedir(), ".ai-agent");
257
264
  }
258
- export function configProviderKind(input) {
259
- if (input.provider === "local" || input.webAdmin === undefined)
260
- return "local";
261
- return "remote";
262
- }
263
- export function serviceConfigSourceKind(config) {
264
- if (config.webAdmin === undefined && config.configProvider !== "local")
265
- return undefined;
266
- return configProviderKind({ provider: config.configProvider, webAdmin: config.webAdmin });
265
+ export function configSourceKind(config) {
266
+ switch (config.configProvider) {
267
+ case "local":
268
+ return "local";
269
+ case "remote": {
270
+ const refusal = remoteConfigProviderUrlRefusal(config);
271
+ if (refusal !== undefined)
272
+ throw new Error(refusal);
273
+ return "remote";
274
+ }
275
+ case undefined:
276
+ return config.webAdmin !== undefined ? "remote" : undefined;
277
+ default: {
278
+ const unreachable = config.configProvider;
279
+ throw new Error(`configSourceKind: CONFIG_PROVIDER word outside the closed set: ${String(unreachable)}`);
280
+ }
281
+ }
267
282
  }
268
283
  //# sourceMappingURL=config-provider.js.map
@@ -23,6 +23,7 @@ import type { CustomPkgSource } from "./sandbox-pkg-source.js";
23
23
  import type { MemoryEngineBackend, StoreBackend as StoreBackendWord } from "@sema-agent/settings-schema/execution-lanes";
24
24
  import { DRAIN_GRACE_FLOOR_MS } from "@sema-agent/settings-schema/fleet";
25
25
  import type { AtMention } from "@sema-agent/settings-schema";
26
+ import type { ModsDeclaration } from "./mods-declaration.js";
26
27
  /** [ref]:记忆向量面的 embedder 坐标(env `MEMORY_EMBEDDER_*` 解析结果;单一属主 = 本类型,
27
28
  * `plugins/memory-embedder.ts` 的工厂直接消费它,不复制形状)。语义与三问见
28
29
  * {@link ServiceConfigFlat.memoryEmbedder}。纯数据 —— 端点原文照存(拼 `/embeddings` 是 transport
@@ -130,7 +131,7 @@ export declare const DRAIN_SECOND_SIGNAL_MIN_GAP_DEFAULT_MS = 250;
130
131
  * 住在本叶(而不在 `fleet/drain-entry.ts`):`config.ts` 读它,而 drain-entry 值引 `plugins/store-contracts.ts`,config 不值引 plugins 层。
131
132
  */
132
133
  export declare function fleetScopeOf(raw: string | undefined): string;
133
- /** 中心基址三席(`SEMA_WEB_ADMIN_URL` / `SEMA_WEB_ADMIN_LIVE_URL` / `SEMA_WEB_ADMIN_WEB_URL`)与公告地址的形句 —— 判官 `web-admin-client/center-request.ts` `pathBaseUrlRefusal` 一只(形判 = settings-schema `httpUrlFlaws`),配置目录四行同读这一句。 */
134
+ /** 中心基址三席(`SEMA_WEB_ADMIN_URL` / `SEMA_WEB_ADMIN_LIVE_URL` / `SEMA_WEB_ADMIN_WEB_URL`)与公告地址的形句 —— 判官 `web-admin-client/center-request.ts` `pathBaseUrlRefusal` 一只(形判 = settings-schema `pathBaseUrlFlaws`,14.7.0 起),配置目录四行同读这一句。 */
134
135
  export declare const CENTER_BASE_URL_RULE = "\u8BBE\u4E86\u5C31\u5FC5\u987B\u662F\u53EF\u89E3\u6790\u7684 http(s) URL,\u4E14\u4E0D\u5E26\u51ED\u636E / query / fragment(\u57FA\u5740\u540E\u9762\u8981\u62FC\u8DEF\u5F84);\u574F\u5F62\u62D2\u542F(\u6CA1\u63A5\u4E2D\u5FC3\u4E5F\u62D2),\u62D2\u53E5\u53EA\u70B9\u540D\u89C4\u5219,\u4E0D\u56DE\u663E scheme";
135
136
  /** 编排器片 2:`FLEET_LEASE_OUTAGE_MAX_MS` 的缺省(24 h)—— 中心 / 库故障、中心降级在今天都靠 LKG 无限期容忍,10 分钟级的窗会把它们变成数据面停服。 */
136
137
  export declare const FLEET_LEASE_OUTAGE_MAX_DEFAULT_MS = 86400000;
@@ -266,7 +267,7 @@ export interface MemoryConsolidationDriverConfig {
266
267
  * ①恰好一条时 = 两个 admin 口省略 `scope` 的**唯一**缺省(两条及以上恒不猜——在两个库之间猜一个
267
268
  * 去花钱是本设计要消灭的形);②周期腿落地时的 scope 源(设计稿 D2)。
268
269
  * 🔴 **不是授权边界**:本仓今天没有任何授权源能对一个 operator 收窄 scope(理由与亲读依据逐字见
269
- * `src/memory-operator-faces.ts` 的 `erasureEnvelopeRefusal` 头注),在本层拿它当白名单就是**发明
270
+ * `src/memory-operator-faces.ts` `MemoryComplianceFaces.erase` 的「授权座只有一只」段),在本层拿它当白名单就是**发明
270
271
  * 第二套授权语义**。显式传的 scope 照跑,表只管缺省。 */
271
272
  scopes: readonly string[];
272
273
  /**
@@ -297,7 +298,8 @@ export interface MemoryConsolidationDriverConfig {
297
298
  */
298
299
  autoRunOnRecommendation?: boolean;
299
300
  }
300
- /** A web-admin MCP server resolved to a core spec (env-NAME refs already → real values) plus the
301
+ /** A web-admin MCP server resolved to a core spec (env-NAME refs already read and registered on the peer desk under the
302
+ * roster lease: the spec carries the minted reference, never the values) plus the
301
303
  * scenarios it applies to (empty = all). `resolveSpec` filters by scenario and passes `spec` to core. */
302
304
  export interface ScopedMcpServer {
303
305
  scenarios: string[];
@@ -312,7 +314,8 @@ export interface CenterMcp {
312
314
  servers: ScopedMcpServer[];
313
315
  reservedNames: readonly string[];
314
316
  }
315
- /** DESIGN-269 §2.1 —— an A2A PEER resolved to a core spec (header-NAME refs already → real values) plus
317
+ /** DESIGN-269 §2.1 —— an A2A PEER resolved to a core spec (header-NAME refs already read and registered on the peer desk
318
+ * under the roster lease: the spec carries the minted reference, never the values) plus
316
319
  * the scenarios it applies to (empty = all). Exact sibling of {@link ScopedMcpServer}: `resolveSpec`
317
320
  * filters by scenario (`a2aForScenario`) and passes `spec` to core as `TaskSpec.a2a`.
318
321
  *
@@ -510,8 +513,10 @@ export interface ServiceConfigFlat {
510
513
  gatewayFallbackUrls: string[];
511
514
  /** `GATEWAY_MAX_RETRIES` —— openai 兼容腿的**每次调用**重试上限。
512
515
  *
513
- * 🔴 **缺席 = 不传给引擎**(不是"传个默认值"):此前这里是硬编码 `maxRetries: 2`,而显式传参**压过**
514
- * 引擎默认 ⇒ core 抬默认对 server 部署一点效果都没有。缺席不传之后,引擎默认当家、core 抬默认自动继承。
516
+ * 🔴 **配置层缺席 = 本字段 `undefined`**(不是"传个默认值"):此前这里是硬编码 `maxRetries: 2`,而显式传参**压过**
517
+ * 引擎默认 ⇒ core 抬默认对 server 部署一点效果都没有。缺席之后由 `brain.ts` 按**外层拓扑**分两态(启动日志 `gatewayRetryCap` 回显):
518
+ * 外层有快切层(备用网关 / 断路器开关 / 反应式降级 —— 后者须配着 `MODEL_DEGRADE_TO`)⇒ 网关各路传 `FAST_FAIL_MAX_RETRIES`(2)并遮蔽引擎的 `SEMA_MAX_RETRIES`;
519
+ * 没有快切层 ⇒ 不传,引擎默认当家、core 抬默认自动继承。降级兜底腿不吃这条收窄(只吃显式值)。设了恒赢(原样传、同样遮蔽 `SEMA_MAX_RETRIES`)。
515
520
  * (五报清查 R1① 的 server 半场,黑板 [ref]/[ref];anthropic 腿早有 `ANTHROPIC_MAX_RETRIES` 出口,
516
521
  * 这条只是把同样的出口补给限流 provider 真正走的那条腿。) */
517
522
  gatewayMaxRetries?: number;
@@ -931,7 +936,9 @@ export interface ServiceConfigFlat {
931
936
  token?: string;
932
937
  caCert?: string;
933
938
  insecureTls?: boolean;
934
- namespace?: string;
939
+ /** `K8S_NAMESPACE` — the namespace the sandbox pods live in. REQUIRED, no default: the loader refuses to start when `REMOTE_EXEC=k8s` names the
940
+ * lane without it, so this arm never carries an absent namespace and no consumer needs a fallback of its own. */
941
+ namespace: string;
935
942
  runtimeClass?: string;
936
943
  mountPath?: string;
937
944
  timeoutMs?: number;
@@ -1307,15 +1314,16 @@ export interface ServiceConfigFlat {
1307
1314
  *
1308
1315
  * 🔴 语义边界(成文,别当成"数据会被删"):core **只**拿它做启动期能力校验(锁着 + 店未声明
1309
1316
  * `retention:"managed"` ⇒ 拒启),引擎自己在任务路径上从不删数据;真执行(调度/重试/副本协调/审计)
1310
- * 是部署侧的活,本仓**尚未**建([ref] §5.2「server 半场四件皆新建」)。所以配了策略而没有任何
1311
- * managed 店时,启动会打一条 `retention_policy_not_executed` 的响亮 warn。
1317
+ * 是部署侧的活 —— 扫车道(`retentionSweep`,`boot/retention-lane.ts`)。配了策略而扫车道关着(只可能在 `audit-only` 档:
1318
+ * `enforce` 而车道不齐起服拒,配置不变量 `retention-lane-complete`)时,启动会打一条 `retention_policy_not_executed` 的响亮 warn。
1312
1319
  */
1313
1320
  retentionPolicy?: RetentionPolicy;
1314
1321
  /**
1315
1322
  * [ref] 车2 —— 托管留存 **sweep lane** 的两个旋钮(设计稿 `DESIGN-270-retention-lane.md` §3/§4)。
1316
1323
  * `retentionPolicy` 说的是「保留多久」(一句声明),本格说的是「谁在什么节律上按那句话删」。
1317
1324
  * **恒在场**(不是可选块):两根都有文档化的缺省,而缺省本身是一条要能被读出来的姿态 ——
1318
- * `{mode:"audit-only", intervalSec:0}` = 「lane 关着,真开起来也先只记账」。
1325
+ * `{mode:"audit-only", intervalSec:0}` = 「lane 关着,真开起来也先只记账」。被要的车道必须齐(`intervalSec > 0` 或 `mode:"enforce"` ⇒
1326
+ * 视界与 > 0 的节律都在,否则起服拒 —— 配置不变量 `retention-lane-complete`)。
1319
1327
  */
1320
1328
  retentionSweep: RetentionSweepConfig;
1321
1329
  /** Tool names that require operator approval before running (F4). Empty = no approval gate. */
@@ -2205,6 +2213,9 @@ export interface ServiceConfigFlat {
2205
2213
  defaultScenario: string;
2206
2214
  /** Directory of baked-in skill Markdown files, loaded once at startup. */
2207
2215
  skillsDir: string;
2216
+ /** 运维声明的 mod 包(`MODS_ROOT` + `MODS_PACKAGES`;`loadConfig` 读一次,唯一读法 `mods-declaration.ts` 的 `parseModsDeclaration`)。两只起服入口的部署座装配
2217
+ * (`boot/deployment-mods.ts` 的 `assembleDeploymentMods`)都读这一份;没声明 = 没有 `packages` 这一席(`{}` / 单设根时 `{ root }`;部署座只有本仓自铸的注册)。起服装配一次,配置刷新不重载。 */
2218
+ modsDeclaration: ModsDeclaration;
2208
2219
  /** Central web-admin (web-admin). When set, the service pulls the effective config
2209
2220
  * on boot (and refreshes) and applies it OVER the env defaults — env is the fallback. Logical config
2210
2221
  * only (model roster/roles/teams); secrets/gateways stay in this service's env.
@@ -2259,8 +2270,10 @@ export interface ServiceConfigFlat {
2259
2270
  * 传输上界)与 `CENTER_CREDENTIAL_RENEW_LEAD_MAX_MS`(访问令牌寿命之半)之间,坏值拒启(解析口 `parseCenterCredentialRenewLeadMs`)。
2260
2271
  * 裸行文件 / `SEMA_WEB_ADMIN_TOKEN` 值形不受它影响(不续签)。`CENTER_CREDENTIAL_RENEW_LEAD_MS`。 */
2261
2272
  centerCredentialRenewLeadMs: number;
2262
- /** Dual-mode config SOURCE (DUAL-MODE-DESIGN §4): "remote" (web-admin HTTP) | "local" (.env + config.d
2273
+ /** Dual-mode config SOURCE (DUAL-MODE-DESIGN §4): "remote" (web-admin HTTP; needs SEMA_WEB_ADMIN_URL — remote without it
2274
+ * refuses to boot, cross-invariant `remote-config-provider-url`) | "local" (.env + config.d
2263
2275
  * via @sema-agent/settings-schema FileConfigStore) | unset → remote if SEMA_WEB_ADMIN_URL is set, else pure-env.
2276
+ * One reader: `configSourceKind` (config-provider.ts).
2264
2277
  * Env: CONFIG_PROVIDER —— [ref] 起闭集 {@link CONFIG_PROVIDER_WORDS}(认不出的词拒启;空串 = 未设)。
2265
2278
  * The same resolver/EffectiveConfig either way (can't drift). */
2266
2279
  configProvider?: ConfigProviderWord;
@@ -2294,7 +2307,7 @@ export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachme
2294
2307
  /** 组:observability(可观测)。 */
2295
2308
  export type ServiceObservabilityConfig = Pick<ServiceConfigFlat, "metricsToken" | "traceToken" | "toolTrace" | "traceThinking" | "logLevel" | "otel">;
2296
2309
  /** 组:integrations(外部集成)。`mcpServers` / `a2aPeers` 由 web-admin 适配器填(无 env 腿),归本组。 */
2297
- export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "centerCredentialRenewLeadMs" | "webAdmin" | "fleetLeaseFailClosed" | "fleetGeneration" | "fleetScope" | "fleetAdvertiseAddress" | "fleetLeaseOutageMaxMs" | "configProvider" | "configLocalDir" | "configLocalOwnerUid">;
2310
+ export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "modsDeclaration" | "centerCredentialRenewLeadMs" | "webAdmin" | "fleetLeaseFailClosed" | "fleetGeneration" | "fleetScope" | "fleetAdvertiseAddress" | "fleetLeaseOutageMaxMs" | "configProvider" | "configLocalDir" | "configLocalOwnerUid">;
2298
2311
  /** 九个组槽。每组恒在场(`loadConfig` / `attachConfigGroups` 装好才交出配置),故不可选——新代码写
2299
2312
  * `config.modelPlane.model` 不需要 `?.`(可选组会把 `Model` 污染成 `Model | undefined`)。 */
2300
2313
  export interface ServiceConfigGroups {
package/dist/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type Model, type PathRuleBases, type PermissionRule } from "@sema-agent/core";
2
+ import { type ConfigProviderWord } from "./config-types.js";
2
3
  import { type CenterEndpoint } from "./web-admin-client/center-request.js";
3
4
  import { type Autonomy } from "./runtime-governance.js";
4
5
  import { type RunnerEnvNameAllowlistKnob, type ServerEnvNameAllowlistKnob } from "./env-name-allowlist-knobs.js";
@@ -106,6 +107,19 @@ export interface ConfigNotice {
106
107
  fields: Record<string, string>;
107
108
  }
108
109
  export declare function drainConfigNotices(): ConfigNotice[];
110
+ /**
111
+ * [ref] —— `CONFIG_PROVIDER` 的**唯一**读点。闭集 {@link CONFIG_PROVIDER_WORDS};缺席 / 空串 ⇒ 未表态(`undefined`);
112
+ * 其余一律**拒启**,拒因句列合法词。逐字比较(不 trim、不折大小写)—— 与本仓其余闭集 env 同律([ref]:认不出的词
113
+ * 不许被悄悄猜成某一种意思)。
114
+ *
115
+ * 修前这根旋钮是开放词,而一个认不出的词在同一进程里被读成两种意思:配置源判官(`configProviderKind`)把它当 `local`
116
+ * (读 `config.d/`、执行车道合成步照读 `remote-exec.json`),这里的隐式 host 臂与车道落点披露却按字面 `=== "local"`
117
+ * 判它**不是** local;web-admin 工厂同样按字面只在 `"local"` 上递本地根,于是配置源的根落回 `process.cwd()`、
118
+ * 合成步读的是 `localRoot` —— 两个根分家。收成闭集 + 一个读点之后,这三处读的是同一个值。
119
+ * 调用方两处、读的是同一张闭集:`loadConfig` 开头一次;`run-local` 在 `loadConfig` 之前一次(本入口只装本地配置源,词是 `remote` 就在这里拒 ——
120
+ * 配没配中心地址都一样)。
121
+ */
122
+ export declare function parseConfigProvider(): ConfigProviderWord | undefined;
109
123
  /** F10 (codex audit): drain + log BOTH pre-logger diagnostic collectors (S20 soft-knob warnings + [ref]④ boot
110
124
  * notices) in one place. EVERY entrypoint that calls loadConfig() then builds a logger must call this right
111
125
  * after (main.ts, run-local.ts) — a new entry that forgets it would silently drop operator-facing diagnostics
@@ -212,6 +226,25 @@ export declare function configKnobTable(): ConfigKnobRecord[];
212
226
  export declare const hostBackgroundShellEnabled: () => boolean;
213
227
  /** The `host` exec lane's spool-file stdio form; false ⇒ the pre-1.226 pipe fallback (read per exec). */
214
228
  export declare const hostExecSpoolEnabled: () => boolean;
229
+ /** 名单在活配置里的落点(服务进程四只旋钮;bake-runner 那只在它自己的进程里,不在 `ServiceConfig`)。 */
230
+ export type EnvNameAllowlistSeats = Pick<ServiceConfig, "lspEnvAllow" | "remoteExec">;
231
+ /**
232
+ * 沙箱名单(表列 `channel: "sandbox-grant"` 的服务侧旋钮,表派生)此刻交出去的名 —— 起服行 `remote_exec_enabled.sandboxEnvKeys` 读它(`boot/execution-env.ts`,
233
+ * 排序后只出键名)。只有被选中车道的那一只有落点;e2b / k8s 报的是名单点到的键,不含 `SANDBOX_PKG_SOURCE` 推导出的包源变量(那一组是区域常量,装配点另并)。
234
+ */
235
+ export declare function sandboxEnvNamesInForce(seats: EnvNameAllowlistSeats): readonly string[];
236
+ /** 声明增长后重判的一处命中:哪只旋钮、它交出去的哪个名、判官的拒因({@link ownCredentialNameProblem} 那一句,只回显名)。 */
237
+ export interface OwnCredentialInForce {
238
+ readonly knob: ServerEnvNameAllowlistKnob;
239
+ readonly name: string;
240
+ readonly problem: string;
241
+ }
242
+ /**
243
+ * 解析器头注 ② 那条不变量在**声明增长**那一刻的半边:对活配置里每只名单此刻交出去的名问**同一只**判官({@link ownCredentialNameProblem} → 引擎
244
+ * `inheritEnvPolicyProblem`,读引擎此刻的声明)。读活配置的落点,不重读 env(名单是起服输入;解析那一刻已判过形与当时的声明)。返回每一处命中,空 = 不相交。
245
+ * 调用点只有一处 = 声明增长的那一处(`apply-effective.ts` 的换代声明,真声明之后、席位换装之前)。
246
+ */
247
+ export declare function ownCredentialHitsInForce(seats: EnvNameAllowlistSeats): OwnCredentialInForce[];
215
248
  /** 名单型 env 旋钮的**唯一**解析器(规则全文见上方 `ENV_NAME_ALLOWLIST_KNOBS` 头注)。`undefined` = 没配(未设 / 空串)。
216
249
  * 服务侧旋钮要交本进程的姿态(③);runner 旋钮没有姿态,签名上就不收 —— 读者与行形由叶表的类型一起定,传错是编译红。 */
217
250
  export declare function parseEnvNameAllowlist(knob: ServerEnvNameAllowlistKnob, singleUserTurnkey: boolean): readonly string[] | undefined;