@sema-agent/server 7.51.0 → 7.52.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 (198) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/USAGE.md +83 -20
  4. package/dist/adoption/plan.d.ts +4 -4
  5. package/dist/adoption/plan.js +11 -0
  6. package/dist/approval-card.d.ts +26 -2
  7. package/dist/approval-card.js +9 -0
  8. package/dist/approval-hmac.d.ts +1 -1
  9. package/dist/approval-reconciler.d.ts +2 -2
  10. package/dist/approval-reconciler.js +1 -1
  11. package/dist/bench/l8/artifact.d.ts +1 -1
  12. package/dist/bench/s1/arms.d.ts +1 -1
  13. package/dist/bench/s1/live-deps.d.ts +1 -1
  14. package/dist/bench/s1/oracle.d.ts +1 -1
  15. package/dist/bench/s1/row.d.ts +1 -1
  16. package/dist/boot/budget-tracing.d.ts +1 -1
  17. package/dist/boot/budget-tracing.js +2 -5
  18. package/dist/boot/coordinators.js +3 -1
  19. package/dist/boot/deferred-sandbox-path-env.d.ts +1 -1
  20. package/dist/boot/engine-lease.d.ts +1 -1
  21. package/dist/boot/execution-env.d.ts +1 -1
  22. package/dist/boot/governance-seams.d.ts +2 -2
  23. package/dist/boot/leader.d.ts +1 -1
  24. package/dist/boot/memory-boundary.d.ts +2 -2
  25. package/dist/boot/memory-consolidation.d.ts +6 -6
  26. package/dist/boot/org-memory.d.ts +1 -1
  27. package/dist/boot/parked-revive-gate.d.ts +3 -3
  28. package/dist/boot/reapers.d.ts +2 -2
  29. package/dist/boot/reapers.js +17 -4
  30. package/dist/boot/resolve-spec.d.ts +12 -0
  31. package/dist/boot/resolve-spec.js +29 -7
  32. package/dist/boot/retention-lane.d.ts +2 -2
  33. package/dist/boot/runner-deps.d.ts +17 -7
  34. package/dist/boot/runner-deps.js +4 -2
  35. package/dist/boot/runtime-caps.d.ts +23 -0
  36. package/dist/boot/runtime-caps.js +24 -2
  37. package/dist/boot/session-faces.d.ts +1 -1
  38. package/dist/boot/session-faces.js +14 -3
  39. package/dist/boot/stores.js +31 -1
  40. package/dist/boot/task-list-lane.d.ts +2 -2
  41. package/dist/brain.js +51 -31
  42. package/dist/budget.d.ts +2 -2
  43. package/dist/capabilities/center-plugins.d.ts +1 -1
  44. package/dist/capabilities/collab-workflows.d.ts +1 -1
  45. package/dist/capabilities/hands-lane.d.ts +3 -3
  46. package/dist/capabilities/scenarios.d.ts +3 -3
  47. package/dist/capabilities/skills.d.ts +1 -1
  48. package/dist/config-center/hot-keys-registry.js +5 -0
  49. package/dist/config-center/http-client.d.ts +2 -2
  50. package/dist/config-center/read-face.d.ts +1 -1
  51. package/dist/config-center/restart-signal.d.ts +1 -1
  52. package/dist/config-types.d.ts +78 -18
  53. package/dist/config.js +45 -10
  54. package/dist/deployment-governance.d.ts +1 -1
  55. package/dist/device-enrollment.d.ts +2 -2
  56. package/dist/device-store.d.ts +3 -3
  57. package/dist/device-ws-protocol.d.ts +2 -2
  58. package/dist/env-facts.d.ts +1 -1
  59. package/dist/execution-lane-caps.d.ts +1 -1
  60. package/dist/fleet/fleet-bus.d.ts +1 -1
  61. package/dist/fleet/fleet-reconciler.d.ts +1 -1
  62. package/dist/fleet/fleet-terminal-window.d.ts +1 -1
  63. package/dist/http/active-run-conflict.d.ts +2 -2
  64. package/dist/http/principal-gate.d.ts +1 -1
  65. package/dist/http/route-ctx.d.ts +24 -4
  66. package/dist/http/routes/admin-memory-optout.d.ts +48 -0
  67. package/dist/http/routes/admin-memory-optout.js +75 -0
  68. package/dist/http/routes/agents-roster.d.ts +1 -1
  69. package/dist/http/routes/approvals-assistant.js +21 -21
  70. package/dist/http/routes/capabilities.js +20 -9
  71. package/dist/http/routes/diagnostics.d.ts +1 -1
  72. package/dist/http/routes/leader.d.ts +1 -1
  73. package/dist/http/routes/memory-bundle.d.ts +1 -1
  74. package/dist/http/routes/memory-bundle.js +3 -1
  75. package/dist/http/routes/memory-compliance.d.ts +4 -4
  76. package/dist/http/routes/memory-origin.d.ts +4 -4
  77. package/dist/http/routes/memory-origin.js +3 -1
  78. package/dist/http/routes/memory-policy.js +6 -2
  79. package/dist/http/routes/retention-ops.d.ts +1 -1
  80. package/dist/http/routes/rules.d.ts +5 -2
  81. package/dist/http/routes/rules.js +84 -5
  82. package/dist/http/routes/run-memory-capture.d.ts +34 -0
  83. package/dist/http/routes/run-memory-capture.js +97 -0
  84. package/dist/http/routes/runs.d.ts +1 -0
  85. package/dist/http/routes/runs.js +212 -6
  86. package/dist/http/routes/session-sync.d.ts +4 -6
  87. package/dist/http/routes/session-sync.js +60 -47
  88. package/dist/http/routes/sessions.js +61 -188
  89. package/dist/http/routes/shared-memory.d.ts +1 -1
  90. package/dist/http/routes/tasks.js +1 -1
  91. package/dist/http/routes/workflows.js +19 -0
  92. package/dist/http/server.d.ts +35 -13
  93. package/dist/http/server.js +105 -12
  94. package/dist/http/verify-rounds.d.ts +1 -1
  95. package/dist/http/wire-types.d.ts +41 -8
  96. package/dist/leader/endpoint.d.ts +1 -1
  97. package/dist/leader/leader.d.ts +1 -1
  98. package/dist/leader/repair-oracle.d.ts +2 -2
  99. package/dist/leader/repair-oracle.js +1 -1
  100. package/dist/main.js +13 -6
  101. package/dist/memory-bundle-engine.d.ts +1 -1
  102. package/dist/memory-operator-faces.d.ts +5 -5
  103. package/dist/memory-origin-fence.d.ts +50 -0
  104. package/dist/memory-origin-fence.js +15 -0
  105. package/dist/memory-posture.d.ts +13 -1
  106. package/dist/memory-posture.js +1 -0
  107. package/dist/memory-scope.d.ts +6 -1
  108. package/dist/memory-scope.js +3 -2
  109. package/dist/model-select.d.ts +2 -2
  110. package/dist/observability/fail-open.d.ts +17 -5
  111. package/dist/observability/fail-open.js +17 -5
  112. package/dist/orchestration/hardened-vm-runner.d.ts +2 -2
  113. package/dist/orchestration/workflow-completion-inbox.d.ts +2 -2
  114. package/dist/plugins/background-shell-support.d.ts +2 -2
  115. package/dist/plugins/blob-backend.d.ts +7 -2
  116. package/dist/plugins/blob-backend.js +22 -18
  117. package/dist/plugins/caching-session-store.d.ts +7 -3
  118. package/dist/plugins/checkpoint-store-sql.d.ts +2 -2
  119. package/dist/plugins/file-history-store-sql.d.ts +170 -0
  120. package/dist/plugins/file-history-store-sql.js +827 -0
  121. package/dist/plugins/file-run-store.d.ts +44 -5
  122. package/dist/plugins/file-run-store.js +85 -13
  123. package/dist/plugins/fork-routing-session-store.d.ts +1 -1
  124. package/dist/plugins/fork-routing-session-store.js +2 -2
  125. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  126. package/dist/plugins/local-session-store.d.ts +9 -1
  127. package/dist/plugins/memory-embedder-fingerprint.d.ts +1 -1
  128. package/dist/plugins/memory-optout-grant-store-sql.d.ts +139 -0
  129. package/dist/plugins/memory-optout-grant-store-sql.js +157 -0
  130. package/dist/plugins/memory-origin-law.d.ts +2 -2
  131. package/dist/plugins/memory-run-store.d.ts +4 -3
  132. package/dist/plugins/memory-run-store.js +2 -1
  133. package/dist/plugins/permission-rule-store-file.d.ts +16 -6
  134. package/dist/plugins/permission-rule-store-file.js +77 -13
  135. package/dist/plugins/permission-rule-store-sql.d.ts +156 -8
  136. package/dist/plugins/permission-rule-store-sql.js +123 -21
  137. package/dist/plugins/pg-pool.js +59 -0
  138. package/dist/plugins/pg-safe-json.d.ts +1 -1
  139. package/dist/plugins/remote-env-device.d.ts +1 -1
  140. package/dist/plugins/remote-env-k8s.d.ts +1 -1
  141. package/dist/plugins/retention-lane-store-sql.d.ts +3 -3
  142. package/dist/plugins/retention-store-sql.d.ts +7 -7
  143. package/dist/plugins/retention-store-sql.js +6 -0
  144. package/dist/plugins/run-store-sql.d.ts +9 -3
  145. package/dist/plugins/run-store-sql.js +2 -2
  146. package/dist/plugins/send-user-file.d.ts +1 -1
  147. package/dist/plugins/session-placement.d.ts +1 -1
  148. package/dist/plugins/sql-errors.d.ts +1 -1
  149. package/dist/plugins/store-backend.d.ts +59 -29
  150. package/dist/plugins/store-backend.js +75 -15
  151. package/dist/plugins/store-contracts.d.ts +5 -3
  152. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  153. package/dist/plugins/tidb-pool.js +59 -0
  154. package/dist/plugins/web-search.d.ts +1 -1
  155. package/dist/prompts-domain-validate.js +1 -1
  156. package/dist/resource-suspend.d.ts +1 -1
  157. package/dist/resource-window.d.ts +3 -3
  158. package/dist/rules-consent.d.ts +231 -9
  159. package/dist/rules-consent.js +411 -13
  160. package/dist/run-local.js +1 -0
  161. package/dist/runs.d.ts +15 -1
  162. package/dist/runs.js +19 -0
  163. package/dist/runtime-caps-resolver.d.ts +36 -1
  164. package/dist/runtime-caps-resolver.js +25 -0
  165. package/dist/runtime-governance.d.ts +1 -1
  166. package/dist/security.d.ts +5 -5
  167. package/dist/security.js +1 -1
  168. package/dist/session-sync.d.ts +52 -37
  169. package/dist/session-sync.js +19 -16
  170. package/dist/shared-memory-scope-authorizer.d.ts +1 -1
  171. package/dist/sighup-idle.d.ts +1 -1
  172. package/dist/spec-fields.d.ts +22 -1
  173. package/dist/spec-fields.js +11 -0
  174. package/dist/store-live-probe.d.ts +2 -2
  175. package/dist/task-a2a.d.ts +1 -1
  176. package/dist/task-cwd.d.ts +1 -1
  177. package/dist/task-mcp.d.ts +3 -3
  178. package/dist/task-settings.d.ts +3 -3
  179. package/dist/task-workflow.d.ts +1 -1
  180. package/dist/text-bidi.d.ts +2 -2
  181. package/dist/tool-approval.d.ts +191 -9
  182. package/dist/tool-approval.js +248 -29
  183. package/dist/trace/core-keyset-guard.d.ts +1 -1
  184. package/dist/trace/engine-notice-wire.d.ts +6 -4
  185. package/dist/trace/engine-notice-wire.js +2 -0
  186. package/dist/trace/ledger-events.d.ts +1 -1
  187. package/dist/trace/ledger-sink.d.ts +2 -2
  188. package/dist/trace/project.d.ts +3 -2
  189. package/dist/trace/project.js +1 -0
  190. package/dist/turn-activity.d.ts +1 -1
  191. package/dist/wall-clock-jump-guard.d.ts +3 -3
  192. package/package.json +2 -2
  193. package/dist/http/tar.d.ts +0 -17
  194. package/dist/http/tar.js +0 -53
  195. package/dist/http/workspace-content.d.ts +0 -11
  196. package/dist/http/workspace-content.js +0 -20
  197. package/dist/plugins/file-snapshot-store-sql.d.ts +0 -170
  198. package/dist/plugins/file-snapshot-store-sql.js +0 -213
@@ -0,0 +1,170 @@
1
+ import type { Pool as MySqlPool } from "mysql2/promise";
2
+ import type { Pool as PgPool } from "pg";
3
+ import { type FileHistoryRetentionPolicy, type ExecutionEnv, type FileHistoryStore, type FileHistoryResult, type FileHistoryTrackResult, type FileHistoryRestoreResult, type FileHistoryExport } from "@sema-agent/core";
4
+ import { type BlobBackend } from "./blob-backend.js";
5
+ import { type SqlDriver } from "./sql-driver.js";
6
+ /** The file-history blob domain's SQL table (BlobBackend `table`/MinIO index binding + the A7 assert). */
7
+ export declare const FILE_HISTORY_BLOB_TABLE = "file_history_blob";
8
+ /** MinIO object-key prefix for this domain (snapshot epoch used "blobs/"; a separate prefix keeps the
9
+ * two domains' objects disjoint so neither sweep can see the other's keys). */
10
+ export declare const FILE_HISTORY_BLOB_KEY_PREFIX = "file-history/";
11
+ /**
12
+ * S-15 twin 保留条款(core 7.0.0 design/381 §片2 的 SQL 孪生)—— 构造期旋钮,键形与 core 内置后端
13
+ * `FileFileHistoryStoreOptions.retention` / `FileStorageBackendOptions.fileHistory.retention` **同域同名**。
14
+ * 解析与校验**直调** core 的 `resolveFileHistoryRetention`(缺省 100 / `"unbounded"` 唯一不剪拼法 / 坏值
15
+ * 同码 `config.retention_policy_invalid` 响亮拒),本店零第二套语义。
16
+ */
17
+ export interface SqlFileHistoryStoreOptions {
18
+ retention?: FileHistoryRetentionPolicy;
19
+ }
20
+ /** Dual-dialect durable FileHistoryStore. See the file header for posture + dialect-delta ledger. */
21
+ export declare class SqlFileHistoryStore implements FileHistoryStore {
22
+ protected readonly db: SqlDriver;
23
+ /** RAW native pool — handed to blob-backend.ts (outside the SqlDriver seam, dialect-switches on
24
+ * its own string). Not used for this class's own statements (those go through `db`). */
25
+ protected readonly pool: MySqlPool | PgPool;
26
+ /** 2c sync blob-face MARKER (codex R2-high): the route/caps predicates gate on THIS, never on a
27
+ * `typeof putBlob` duck-probe — core's local FileFileHistoryStore carries a PRIVATE synchronous
28
+ * `putBlob(hash, bytes): void` helper whose name collides with the service face; a name probe
29
+ * passes there, mutates core-owned blob storage out of contract, then dereferences `.ok` on
30
+ * undefined. Presence of this literal = the full typed putBlob/getBlob/hasBlobs face exists. */
31
+ readonly syncBlobFaces: true;
32
+ protected readonly blobs: BlobBackend;
33
+ /** §10 S-6 in-process lease state (design v1 D2: NOT persisted). Keys = `${scope}\x00${entryId}`. */
34
+ private readonly spentAttempts;
35
+ private readonly activeAttempts;
36
+ /** S-15 twin 保留条款:每 scope 存活的最新 boundary 数;`null` = `"unbounded"`(自剪关闭,GC 归宿主 `reap`)。
37
+ * 由 core 的 `resolveFileHistoryRetention` 在构造期裁定 —— 与两只内置后端同一道门、同一句拒绝。 */
38
+ private readonly boundaryKeep;
39
+ constructor(db: SqlDriver,
40
+ /** RAW native pool — handed to blob-backend.ts (outside the SqlDriver seam, dialect-switches on
41
+ * its own string). Not used for this class's own statements (those go through `db`). */
42
+ pool: MySqlPool | PgPool, blobBackend?: BlobBackend, opts?: SqlFileHistoryStoreOptions);
43
+ /** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
44
+ private q;
45
+ private bool;
46
+ private leaseKey;
47
+ /** PROTECTED RACE SEAM (fault/race-injectable, test-only override): runs between trackEdit's
48
+ * repeat-touch pre-check and the conditional mint INSERT. Production body is empty. */
49
+ protected beforeMint(_scope: string, _keyHash: string): Promise<void>;
50
+ /** PROTECTED RACE SEAM: runs between trackEdit's repeat-touch pre-check and the observed_later
51
+ * UPDATE (the annul-vs-observe window codex R1-high named). Production body is empty. */
52
+ protected beforeObserve(_scope: string, _keyHash: string): Promise<void>;
53
+ /** PROTECTED RACE SEAM: runs between snapshot's staging pass (tracked/versions loaded, blobs staged,
54
+ * publish verdict green) and the publish tx — the capture window another replica's annul/re-mint
55
+ * can land in (codex R2 ABA case). Production body is empty. */
56
+ protected beforePublish(_scope: string): Promise<void>;
57
+ /**
58
+ * Per-scope WRITE-SERIALIZATION lock (codex R1-critical): `SELECT … FOR UPDATE` over an EMPTY result
59
+ * locks nothing on PG, so neither the empty-target law (import/adopt) nor a multi-statement graph
60
+ * write can be serialized by the data rows alone. Every graph-mutating tx therefore first ensures +
61
+ * row-locks the scope's sentinel row — one lock, both dialects, and disjoint-key writers can no
62
+ * longer interleave into a merged/torn graph. The ensure+lock loops because deleteBySession removes
63
+ * the sentinel: a waiter woken by that delete sees zero rows and must re-ensure.
64
+ */
65
+ private lockScope;
66
+ /** Returns the UPDATE's affected count — 0 = the record is gone (annulled) or was already observed;
67
+ * the caller disambiguates by re-reading (codex R1-high: answering minted:false after the baseline
68
+ * vanished would let a later touch mint already-modified bytes as pristine). */
69
+ private markObserved;
70
+ trackEdit(scope: string, absPath: string, env: ExecutionEnv, root: string, signal?: AbortSignal): Promise<FileHistoryTrackResult>;
71
+ /** Why (scope,keyHash) is currently NOT a retractable mint, or undefined when it still is. */
72
+ private annulIneligibleReason;
73
+ annulTrack(scope: string, absPath: string, root: string, verify?: {
74
+ env: ExecutionEnv;
75
+ signal?: AbortSignal;
76
+ }): Promise<FileHistoryResult>;
77
+ private loadTracked;
78
+ private loadVersions;
79
+ /** S-15 twin 保留条款:这个 entry 的键是否**已花掉**(被 reap 剪过)。台账 `file_history_reaped_entry`。
80
+ * `forUpdate`(r3-①连带):发布 tx 内的复核必须是**锁定读**——TiDB 悲观事务的普通 SELECT 按文档读
81
+ * start_ts,锁等待窗内提交的墓碑会被漏看(池上的预检无此虑:单语句即当前)。 */
82
+ private entryReaped;
83
+ /** adoptScope 的台账携带(InMemory 参照:正常臂 = 源∪目标,空源臂也带)。目标已有的行原样保留。 */
84
+ private copyReapedEntries;
85
+ /**
86
+ * S-15 twin 保留条款 —— boundary 提交后的自剪 pass(core InMemory `applyBoundaryRetention` 的 SQL 形)。
87
+ *
88
+ * 选择半场**共享** core 的 `fileHistoryBoundariesToKeep`(两只内置后端与本孪生不许在「哪个 boundary 死」上
89
+ * 分家;刚提交者恒 pin):本店的 oldest-first 序 = `published_at_ms, entry_id`(发布戳来自各副本 `Date.now()`,
90
+ * 同毫秒/时钟回拨用 entry_id 破平 —— 引擎铸的 uuidv7 即提交序;core 明写这只影响「剪哪一个同样合法的
91
+ * boundary」,pin 保证永远不会剪掉本轮的)。`null` = 未超界 ⇒ 零 reap,一轮只付一次 SELECT。
92
+ *
93
+ * 在**提交之后、连接归还之后**跑(reap 自取第二条连接与 scope 锁):自剪失败不失败本轮 —— boundary 已
94
+ * 提交、rewind 座照常,只是这一轮没剪;下一次提交的 pass 按当前全集重算,不累积欠账。参照是无声
95
+ * `reap(...).catch(() => {})`,本仓走 `recordFailOpen` 留痕三件套(F 类,普查档 §1 第 50 行)。
96
+ */
97
+ /** PROTECTED RACE SEAM (test-only override): runs at the start of the retention pass, before any of its
98
+ * reads. Production body is empty. */
99
+ protected beforeRetentionPass(_scope: string): Promise<void>;
100
+ /** PROTECTED RACE SEAM (test-only override): runs after the retention pass has chosen its survivors and
101
+ * before it deletes. Production body is empty. */
102
+ protected duringRetentionPass(_scope: string): Promise<void>;
103
+ /** PROTECTED RACE SEAM (test-only override): runs inside `restore` between the boundary-header check and
104
+ * the mapping read. Production body is empty. */
105
+ protected duringRestorePlan(_scope: string, _entryId: string): Promise<void>;
106
+ /** PROTECTED RACE SEAM (test-only override): runs inside the publish tx AFTER `beginPessimistic` and
107
+ * BEFORE the scope lock — the window where another replica's publish can commit while this tx's
108
+ * snapshot is already pinned (TiDB snapshot-reads plain SELECTs, D2). Production body is empty. */
109
+ protected beforePublishLock(_scope: string): Promise<void>;
110
+ /** PROTECTED RACE SEAM (test-only override): runs inside `exportOf` between the boundary-header read and
111
+ * the mapping read. Production body is empty. */
112
+ protected duringExportGraph(_scope: string): Promise<void>;
113
+ private applyBoundaryRetention;
114
+ private boundaryExists;
115
+ snapshot(scope: string, entryId: string, env: ExecutionEnv, root: string, signal?: AbortSignal): Promise<FileHistoryResult>;
116
+ restore(scope: string, entryId: string, env: ExecutionEnv, root: string, signal?: AbortSignal): Promise<FileHistoryRestoreResult>;
117
+ /** `restore` 的不可变计划:头存在性 + tracked + 版本链 + 边界映射,**scope 锁内一事务**读齐后 COMMIT。
118
+ * `null` = 锁内复核发现 boundary 已不在(与预检之间被 reap)。 */
119
+ private restorePlan;
120
+ canRestore(scope: string, entryId: string): Promise<boolean>;
121
+ reap(scope: string, keepEntryIds: string[]): Promise<number>;
122
+ /** The reap BODY, shared by the host-facing `reap` verb and the retention pass — both call it under the
123
+ * scope lock in the SAME tx that listed `present` (codex r1 [high]: a survivor set chosen outside the lock
124
+ * is stale by the time it deletes, and a boundary another replica committed in the window would die
125
+ * under it). Ledger row first, then the drop, then the version cascade — one tx, atomic. */
126
+ private reapWithin;
127
+ /** E21 purge — drop the WHOLE scope (tracked set incl. v1 baselines + markers + boundaries), unlike
128
+ * `reap(scope, [])` which retains baselines while the scope lives. Blob bytes become orphans and are
129
+ * collected by the async grace-window sweep (never a synchronous external-store delete on the purge
130
+ * path). Also the overwrite-dst session-sync wipe seam (import requires an EMPTY target graph). */
131
+ deleteBySession(scope: string): Promise<number>;
132
+ /** Async byte-GC: blobs referenced by NO version row (any scope), past the created_at grace window.
133
+ * Domain-isolated by construction (this store's blob table only — S-15 D1). Reaper-driven. */
134
+ sweepOrphanBlobs(): Promise<number>;
135
+ /** Upload ONE content-addressed blob ahead of an importHistory (§5 streamed negotiation). Store-level
136
+ * integrity re-check (the route pre-verifies too — the internal caller might not). Never-throw. */
137
+ putBlob(hash: string, bytes: Uint8Array): Promise<FileHistoryResult>;
138
+ getBlob(hash: string): Promise<Uint8Array | undefined>;
139
+ /** The subset of `hashes` already present — one SQL INDEX probe (the import presence pre-check). */
140
+ hasBlobs(hashes: string[]): Promise<Set<string>>;
141
+ adoptScope(fromScope: string, toScope: string): Promise<FileHistoryResult>;
142
+ private scopeEmpty;
143
+ private exportOf;
144
+ exportHistory(scope: string): Promise<FileHistoryExport | null>;
145
+ importHistory(scope: string, data: FileHistoryExport, srcGetBlob: (hash: string) => Promise<Uint8Array | undefined>): Promise<FileHistoryResult>;
146
+ }
147
+ /** MySQL-protocol (TiDB) binding. */
148
+ export declare class TiDBFileHistoryStore extends SqlFileHistoryStore {
149
+ constructor(pool: MySqlPool, blobBackend?: BlobBackend, opts?: SqlFileHistoryStoreOptions);
150
+ }
151
+ /** PostgreSQL binding. */
152
+ export declare class PgFileHistoryStore extends SqlFileHistoryStore {
153
+ constructor(pool: PgPool, blobBackend?: BlobBackend, opts?: SqlFileHistoryStoreOptions);
154
+ }
155
+ /**
156
+ * S-15 D1② — A7-recipe upgrade precondition assert (**refuse to start**, never a warn; the form and
157
+ * rationale follow `assertPermissionRuleTicketSchema` verbatim: this repo ships no ALTER TABLE, and
158
+ * `CREATE TABLE IF NOT EXISTS` is a no-op on an existing table whose columns predate this build).
159
+ *
160
+ * The probe is one always-empty `WHERE 1=0` read per table naming every column this build references.
161
+ * ONLY a provable missing-column error gets the destructive recreate guidance — everything else
162
+ * (timeout / reset / permission / missing table) rethrows untouched: advising `DROP TABLE` for a
163
+ * connection blip is more expensive than the defect this gate exists to stop. Honest cost statement:
164
+ * dropping these tables loses per-file REWIND history (working-tree convenience state) — session
165
+ * transcripts and every other durable subsystem are untouched.
166
+ */
167
+ export declare function assertFileHistorySchema(query: (sql: string) => Promise<{
168
+ rows: Record<string, unknown>[];
169
+ }>, dialect: "tidb" | "pg"): Promise<void>;
170
+ //# sourceMappingURL=file-history-store-sql.d.ts.map