@sema-agent/server 7.82.1 → 7.84.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 (84) hide show
  1. package/dist/bench/s1/arms.d.ts +4 -4
  2. package/dist/bench/s1/arms.js +1 -2
  3. package/dist/bench/s1/live-deps.js +0 -1
  4. package/dist/bench/s1/runner-ctx.d.ts +3 -3
  5. package/dist/bench/s1/tasks.d.ts +8 -4
  6. package/dist/boot/resolve-spec.js +9 -5
  7. package/dist/capabilities/memory-notice.d.ts +6 -4
  8. package/dist/capabilities/memory-notice.js +1 -1
  9. package/dist/config-catalog.js +0 -1
  10. package/dist/config.js +1 -0
  11. package/dist/http/admission.js +7 -3
  12. package/dist/http/wire-types.d.ts +22 -0
  13. package/dist/leader/endpoint.js +2 -0
  14. package/dist/leader/leader.d.ts +33 -6
  15. package/dist/leader/leader.js +54 -45
  16. package/dist/leader/merge.d.ts +38 -29
  17. package/dist/leader/merge.js +45 -38
  18. package/dist/leader/wire.d.ts +2 -17
  19. package/dist/leader/wire.js +5 -58
  20. package/dist/memory-scope.d.ts +33 -5
  21. package/dist/memory-scope.js +10 -4
  22. package/dist/observability/fail-open.d.ts +5 -5
  23. package/dist/observability/fail-open.js +5 -2
  24. package/dist/observability/run-terminal-log.d.ts +2 -7
  25. package/dist/observability/run-terminal-log.js +119 -21
  26. package/dist/plugins/adoption-log-sql.d.ts +3 -0
  27. package/dist/plugins/adoption-log-sql.js +5 -1
  28. package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
  29. package/dist/plugins/approval-ask-store-sql.js +9 -5
  30. package/dist/plugins/background-agent-store-sql.d.ts +3 -0
  31. package/dist/plugins/background-agent-store-sql.js +7 -2
  32. package/dist/plugins/device-store-sql.d.ts +3 -0
  33. package/dist/plugins/device-store-sql.js +9 -4
  34. package/dist/plugins/ensure-index.d.ts +42 -0
  35. package/dist/plugins/ensure-index.js +81 -0
  36. package/dist/plugins/ensure-schema-lock-policy.d.ts +29 -0
  37. package/dist/plugins/ensure-schema-lock-policy.js +31 -0
  38. package/dist/plugins/image-bake-store-sql.d.ts +3 -0
  39. package/dist/plugins/image-bake-store-sql.js +6 -2
  40. package/dist/plugins/image-index-sql.d.ts +3 -0
  41. package/dist/plugins/image-index-sql.js +8 -4
  42. package/dist/plugins/leader-run-store-sql.d.ts +3 -0
  43. package/dist/plugins/leader-run-store-sql.js +6 -2
  44. package/dist/plugins/mailbox-store-sql.d.ts +3 -0
  45. package/dist/plugins/mailbox-store-sql.js +6 -1
  46. package/dist/plugins/memory-engine-pg.d.ts +4 -0
  47. package/dist/plugins/memory-engine-pg.js +6 -6
  48. package/dist/plugins/memory-engine-tidb.js +5 -0
  49. package/dist/plugins/memory-sync-store-pg.d.ts +5 -0
  50. package/dist/plugins/memory-sync-store-pg.js +9 -2
  51. package/dist/plugins/memory-sync-store-tidb.js +6 -0
  52. package/dist/plugins/one-time-migrations.d.ts +1 -1
  53. package/dist/plugins/one-time-migrations.js +7 -14
  54. package/dist/plugins/outcome-ledger-sql.d.ts +3 -0
  55. package/dist/plugins/outcome-ledger-sql.js +7 -3
  56. package/dist/plugins/permission-rule-store-sql.d.ts +3 -0
  57. package/dist/plugins/permission-rule-store-sql.js +9 -5
  58. package/dist/plugins/pg-cost-quota.d.ts +3 -0
  59. package/dist/plugins/pg-cost-quota.js +5 -1
  60. package/dist/plugins/pg-pool.d.ts +23 -2
  61. package/dist/plugins/pg-pool.js +22 -37
  62. package/dist/plugins/pg-rate-limiter.d.ts +3 -0
  63. package/dist/plugins/pg-rate-limiter.js +5 -1
  64. package/dist/plugins/pg-session-storage.d.ts +3 -0
  65. package/dist/plugins/pg-session-storage.js +8 -4
  66. package/dist/plugins/retention-store-sql.d.ts +3 -0
  67. package/dist/plugins/retention-store-sql.js +7 -3
  68. package/dist/plugins/roster-store-sql.d.ts +3 -0
  69. package/dist/plugins/roster-store-sql.js +6 -1
  70. package/dist/plugins/schema-indexes.d.ts +21 -0
  71. package/dist/plugins/schema-indexes.js +25 -0
  72. package/dist/plugins/task-attachment-store.d.ts +3 -0
  73. package/dist/plugins/task-attachment-store.js +7 -2
  74. package/dist/plugins/tidb-pool.d.ts +15 -3
  75. package/dist/plugins/tidb-pool.js +38 -15
  76. package/dist/plugins/tool-result-store-sql.d.ts +3 -0
  77. package/dist/plugins/tool-result-store-sql.js +5 -1
  78. package/dist/request-key-closure.d.ts +7 -0
  79. package/dist/request-key-closure.js +1 -1
  80. package/dist/request-value-closure.d.ts +31 -0
  81. package/dist/request-value-closure.js +18 -0
  82. package/dist/trace/project.d.ts +2 -1
  83. package/dist/trace/redact.d.ts +6 -0
  84. package/package.json +1 -1
@@ -19,6 +19,13 @@ export declare function scanKeyClosure(bag: object, prefix: string, accepted: Re
19
19
  }): void;
20
20
  /** 一张分类表的文案片段(封顶后只报数)。 */
21
21
  export declare function keyClosureClause(names: string[], label: string): string;
22
+ /** 剥掉索引签名,只留**具名**键 —— `TaskRequestBody` 上那条 `[k: string]: unknown` 会让
23
+ * `keyof` 退化成 `string`,双向门就永远恒真(零判别力)。
24
+ * 🔴 **导出**(S-405):姊妹门 `request-value-closure.ts` 的双向钉要同一个剥法 —— 抄第二份 = 两处哪天
25
+ * 分岔(一边看得见索引签名、一边看不见)谁都发现不了,而两边的判别力都建立在「剥干净了」这句话上。 */
26
+ export type NamedKeysOf<T> = {
27
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
28
+ };
22
29
  /**
23
30
  * FRESH 提交面的**顶层**键闭集裁决:受理集之外的键 ⇒ 返回拒体(调用方 400 `request.body_shape`);
24
31
  * 全部受理 ⇒ `null`。
@@ -22,7 +22,7 @@ const TASK_BODY_DECLARED_KEYS = [
22
22
  "appendSystemPrompt", "attachmentIds", "attachments", "capabilitiesNeeded", "cascade", "clientContext",
23
23
  "compaction", "compactionModel", "council", "cwd", "debate", "deferTools", "enableFork", "excludeTools",
24
24
  "finalVerification", "forwardSubagentEvents", "images", "interactiveTools", "jobId", "limits", "maxCostUsd",
25
- "maxTokens", "mcpServers", "memoryCapture", "memoryWrite", "model", "objective", "oneShot", "outputRetries",
25
+ "maxTokens", "mcpServers", "memory", "memoryCapture", "memoryWrite", "model", "objective", "oneShot", "outputRetries",
26
26
  "outputSchema", "permissionMode", "projectId", "promptProfile", "reasoningEffort", "requireExistingSession",
27
27
  "resilience", "restoreFiles", "resumeAt", "resumeAtMode", "retainBackgroundProcesses", "retainSubagentSessions",
28
28
  "rewindFiles", "rewindFilesTo", "sandboxImageProfile", "scenario", "scratchpadDir", "selfOrchestration",
@@ -0,0 +1,31 @@
1
+ /** [ref] §2.1([ref]):`memoryCapture` 的拼写门文案。**wire 可见文本** —— 改一个字就是对端契约漂移
2
+ * (SDK/壳/文档锚它),字节冻结在 `test/api-error-text-freeze.test.ts` 的常量锚格。 */
3
+ export declare const MEMORY_CAPTURE_SPELLING_MESSAGE = "memoryCapture must be the string 'off' when present (the session-level memory-capture opt-out declaration; absent = capture as usual \u2014 there is no 'on' spelling)";
4
+ /** core [ref] r5 §5 W3(S-405):请求级「记忆整面关」`memory` 的拼写门文案。同上,wire 可见、字节冻结。
5
+ * 文案刻意点明 capture 的分工 —— 两个键都在记忆轴上、形又一模一样,拿错的人要在同一条回执里读到该用哪个。 */
6
+ export declare const MEMORY_OFF_SPELLING_MESSAGE = "memory must be the string 'off' when present (the request-level declaration that this run mounts no memory face at all; absent = memory as usual \u2014 there is no 'on' spelling; to keep memory mounted but stop this session's content from entering long-term memory, send memoryCapture: 'off' instead)";
7
+ /**
8
+ * **单成员闭集键表** —— 合法值只有 `"off"`,缺席=照常,没有 `"on"`。
9
+ *
10
+ * 🔴 顺序 = **裁决顺序**,且是**既存键在前**:一个两键都畸形的存量体,判决与加 `memory` 之前逐字节相同
11
+ * (新键不许改写既有体的回执)。新增同形键一律**追加在尾部**。
12
+ */
13
+ declare const SINGLE_MEMBER_OFF_FIELDS: readonly [{
14
+ readonly field: "memoryCapture";
15
+ readonly message: "memoryCapture must be the string 'off' when present (the session-level memory-capture opt-out declaration; absent = capture as usual — there is no 'on' spelling)";
16
+ }, {
17
+ readonly field: "memory";
18
+ readonly message: "memory must be the string 'off' when present (the request-level declaration that this run mounts no memory face at all; absent = memory as usual — there is no 'on' spelling; to keep memory mounted but stop this session's content from entering long-term memory, send memoryCapture: 'off' instead)";
19
+ }];
20
+ /** 一次值闭集裁决的产物:出问题的键名(机读)+ 一句 wire 文案。 */
21
+ export interface SingleMemberOffFieldIssue {
22
+ field: (typeof SINGLE_MEMBER_OFF_FIELDS)[number]["field"];
23
+ message: string;
24
+ }
25
+ /**
26
+ * 单成员闭集键的值形裁决:表内任一键在场且不是字面 `"off"` ⇒ 返回拒体(调用方 400 `request.field_invalid`);
27
+ * 全部合法或全部缺席 ⇒ `null`。**两腿(fresh admission / resume 重放)共用这一只**。
28
+ */
29
+ export declare function singleMemberOffFieldIssue(raw: unknown): SingleMemberOffFieldIssue | null;
30
+ export {};
31
+ //# sourceMappingURL=request-value-closure.d.ts.map
@@ -0,0 +1,18 @@
1
+ export const MEMORY_CAPTURE_SPELLING_MESSAGE = "memoryCapture must be the string 'off' when present (the session-level memory-capture opt-out declaration; absent = capture as usual — there is no 'on' spelling)";
2
+ export const MEMORY_OFF_SPELLING_MESSAGE = "memory must be the string 'off' when present (the request-level declaration that this run mounts no memory face at all; absent = memory as usual — there is no 'on' spelling; to keep memory mounted but stop this session's content from entering long-term memory, send memoryCapture: 'off' instead)";
3
+ const SINGLE_MEMBER_OFF_FIELDS = [
4
+ { field: "memoryCapture", message: MEMORY_CAPTURE_SPELLING_MESSAGE },
5
+ { field: "memory", message: MEMORY_OFF_SPELLING_MESSAGE },
6
+ ];
7
+ export function singleMemberOffFieldIssue(raw) {
8
+ if (raw === null || raw === undefined || typeof raw !== "object" || Array.isArray(raw))
9
+ return null;
10
+ const body = raw;
11
+ for (const { field, message } of SINGLE_MEMBER_OFF_FIELDS) {
12
+ const value = body[field];
13
+ if (value !== undefined && value !== "off")
14
+ return { field, message };
15
+ }
16
+ return null;
17
+ }
18
+ //# sourceMappingURL=request-value-closure.js.map
@@ -190,7 +190,8 @@ export declare function screenedStoredEventData(type: string, data: unknown): un
190
190
  /** `text_end` 段末帧的**唯一**铸点(三腿共用:top stream / 转发子代腿 / 子代 tail 面)。content = 段权威全文 ⇒ 与
191
191
  * durable 面(`result` / 账本 `text` 行)同一只 {@link redactModelText}(认出才改写、抛则占位、不设上限)。
192
192
  * 此前三处各自逐字透传 —— 同一份文本毫秒后在 `done.result.result` 上已脱,live 面却在凭据生成瞬间明文(B-114)。
193
- * `text_delta` 仍逐字:跨 chunk 的凭据无法就地判,流式脱敏是独立设计件(S-270)。
193
+ * `text_delta` 仍逐字:跨 chunk 的凭据无法就地判;clay [ref] ②(2026-09-18)裁定**维持逐字成文**(S-270 U-3 关票),
194
+ * 权威段 `text_end.content` 已脱敏、消费端段末整段替换即得脱敏读法。
194
195
  * 坏形(content 非串/空串)⇒ null(丢帧,不铸「权威空段」:core 契约明言空段不发本帧,消费端收到空段会清掉已攒 delta)。
195
196
  * 身份**四键**随行(live 现状带全四键,消费端可能已依赖);值经 {@link identityKey} —— 非空 string 才上 wire
196
197
  * (S-334 起不再逐字透传:坏形身份键会在 live 写口上铸出假游标)。 */
@@ -77,6 +77,12 @@ export declare function resetPpkScanBytesForTest(): void;
77
77
  * (亲读 `@sema-agent/core/dist/agents/subagent-steps.js:9-11`),截过与天生就短在 wire 上不可区分。
78
78
  * 所以一个 `arm="fragment"` 计数可能来自残片,也可能来自一个恰好落在阈值之上的 look-alike;
79
79
  * core [ref] 落地后这一支**趋零是证据、不归零不是证明**。别把它当截断事实的度量用。 */
80
+ /**
81
+ * 🔴 **词名 = 表归属,不是语义**(clay 裁 [ref] ①,2026-09-18,关 S-307):`"full"` = 强证据表(`SECRET_PATTERNS` 一族,
82
+ * 含 7.76.2 起改判进来的 PEM/ppk 体)命中的臂,`"fragment"` = 弱证据表({@link FRAGMENT_SECRET_PATTERNS})命中的臂。
83
+ * 7.76.2 起两档语义已是「强证据 / 弱证据」,词名**刻意保留**:它是 Prometheus 标签 `redactions_applied_total{arm}` 的
84
+ * 标签值,改名 = 硬 breaking 的标签值漂移(面板与告警按值匹配),而语义只在这一段注释里说全即可。判据是 {@link armOfToken}。
85
+ */
80
86
  export type RedactionArm = "full" | "fragment";
81
87
  export interface RedactionHitMeta {
82
88
  /** 命中臂的**判别力档位**(闭集两词,S-303):`"fragment"` = {@link FRAGMENT_SECRET_PATTERNS} 那一族
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "7.82.1",
3
+ "version": "7.84.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",