/** * [ref] §2.1 / §3.4 S-8①(server [ref];[ref] 认领)—— **中途翻转 verb** 的 wire 面: * * `POST /v1/runs/:id/memory/capture-optout` body `{ reason?: string }` * → 200 `{ taskId, sessionId, outcome: "created" | "existed" }` * * 语义 = core `TaskStream.optOutMemoryCapture()`(「聊着聊着发现不该记」):从这一刻起本会话**零提交**长期记忆、 * 已提交贡献退出整理候选(回溯 A2 臂)、写根残留边界隔离清扫。**单向**(无反向动词;重复调用幂等 `existed`), * 回到采集只能开新会话。 * * ── 权限法条(steer 车道逐字)──────────────────────────────────────────────────────────────────── * core 不认证:持有活流句柄即能力。**本面拥有 verified-principal / 会话所有权判定**:裸 sessionId 中继会让任何人 * 关掉任何人的记忆(可用性攻击)。所以:身份来自 `gatedPrincipal`(验证过的身份,不是可自造的头),run 属主不符 * ⇒ 404 `not_found.run` **同串反枚举**(与 steer/interrupt 同判)。core 在翻转时刻**重新裁决** per-principal * entitlement(`RuntimeCaps.allowMemoryOptOut` under `memoryCapturePolicy`,fresh resolve)—— 被拒 ⇒ typed * `memory.capture_optout_denied` + 零记录残留;server 不复刻那条裁决。 * * ── 四臂(steer 车道同形,但**没有 park 腿**)────────────────────────────────────────────────────── * (a) 本副本活流在场 ⇒ 调 verb,200 `{outcome}`;core 的 typed 拒闭集逐码转发(见 switch); * (b) 非 live(parked / 他副本 / 无活流 / 终态)⇒ 409 `steering.not_running` + 指路**声明形**:opt-out 的持久 * 形是 `TaskSpec.memory.capture:"off"`(wire `memoryCapture:"off"`),下一次 resume/新会话提交时带上即可 —— * core 明写声明与 verb 是同一条记录的两个 ingress,**不存在**「park 一个翻转等 resume 再翻」的形(记录是 * 一次性单向的,resume 时带声明就是幂等重写),所以本面刻意不铸 park 腿。 * * ── 计费/门 ───────────────────────────────────────────────────────────────────────────────────── * 零模型工作(不进 billable;不吃 drain / roster-pending);mutating ⇒ `rateLimited`。**不进** `isCredentialGatedRewrite`: * 有属主门兜底(run.owner),爆炸半径 = 本人会话。能力位 `runMemoryCaptureOptOut`(= 持久 run 账面在场,与 * `sessionBackgroundable` 同谓词):老 worker 键缺席 ⇒ 壳不渲入口(假 affordance 纪律)。 */ import type { IncomingMessage, ServerResponse } from "node:http"; import { type RouteCtx, type RouteMatch, type RouteIdsOf } from "../route-ctx.js"; export declare function handleRunMemoryCapture(req: IncomingMessage, res: ServerResponse, match: RouteMatch, ctx: RouteCtx): Promise; export declare const RUN_MEMORY_CAPTURE_ROUTES: readonly [{ readonly id: "run-memory-capture-optout"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/memory/capture-optout"; readonly methods: readonly ["POST"]; }]; /** 本域可分派行的 `id` 闭集 —— handler 的 `switch` 按它判穷尽(漏一口 = 编译红)。 */ export type RunMemoryCaptureRouteId = RouteIdsOf; //# sourceMappingURL=run-memory-capture.d.ts.map