import { type MemoryBackend, type MemorySyncClientResult, type MemorySyncTransport } from "@sema-agent/core"; /** 结构化日志面(src/observability/logger.ts Logger 的结构子集——测试可注入捕获器)。 */ export interface MemorySyncLog { info(msg: string, fields?: Record): void; warn(msg: string, fields?: Record): void; } /** 缺省对端名(core `syncMemoryScope` 同款缺省;cursor 按 (scope,peer) 分区)。 */ export declare const DEFAULT_MEMORY_SYNC_PEER = "central"; /** * fetch transport(core `MemorySyncTransport` 的部署实现)。`url` = 中心 server 基址(尾斜杠剥除, * core 传来的 path 以 `/` 开头);`token` 走 Authorization: Bearer(与中心侧 gatedPrincipal 的 * verified-principal 门对齐)。非 2xx throw(status + body 前 200 字节——中心 4xx/5xx 的 typed error * body 就是最好的诊断线索);2xx 返回解码后的 JSON(形状校验在 core parseMemorySyncResponse,职责 * 不重复)。`timeoutMs`(缺省 60s,AbortSignal.timeout)是活性保护:fire-and-forget 轮挂死会把 * inflight 节流永久卡住(undici 默认 headers 超时 300s 太钝)。 */ export declare function createMemorySyncTransport(opts: { url: string; token: string; timeoutMs?: number; fetchImpl?: typeof fetch; }): MemorySyncTransport; /** cursor 文件路径:`memoryRoot`(= RunnerDeps.memoryEngineDir 的 resolved config root,memory/ 目录 * 旁)下的 per-peer sidecar。peer 段走 core encodeScopeSegment(文件名安全字符纪律与 scope 目录同)。 */ export declare function memorySyncCursorPath(memoryRoot: string, peer: string): string; export interface MemorySyncRunner { /** 一轮同步(串行:排在上一轮之后)。返回 core 结构化结果供调用方记 metrics/日志;transport/ * 协议错误向上 throw(本地零副作用,core 契约)。cursor 读写、conflicts warn 都在轮内完成。 */ syncOnce(reason: string): Promise; /** fire-and-forget 一轮:上一轮在飞(排队/执行中)则跳过(inflight 节流);失败 warn 不上抛。 */ trigger(reason: string): void; /** cursor sidecar 的落盘路径(boot 日志/测试可见性)。 */ readonly cursorPath: string; /** 排队+在飞的轮数(测试的确定性等待面;0 = 完全空闲)。 */ pending(): number; } /** * 组装一个 per-(scope,peer) 的同步执行器:cursor 持久化 + core `syncMemoryScope` + conflicts 上报 + * 串行化/节流。`backend` = 本地 File authority plane(memoryEngineBackendFor 的产物);`memoryRoot` = * resolved config root(cursor sidecar 落在 memory/ 目录旁)。 */ /** S2.5 分批 loop 的轮数上限(fail-loud 警戒,防协议异常时死循环;正常收敛远低于此)。 */ export declare const MAX_SYNC_ROUNDS = 32; export declare function createMemorySyncRunner(opts: { backend: MemoryBackend; scope: string; memoryRoot: string; transport: MemorySyncTransport; log: MemorySyncLog; peer?: string; now?: () => number; /** S2.5 分批(core 1.284 两 seam):push 集/pull 集单轮上限。未设=不分批(wire 字节不变)。 */ maxPushEntries?: number; maxPullEntries?: number; }): MemorySyncRunner; //# sourceMappingURL=memory-sync-client.d.ts.map