import type { IncomingMessage, ServerResponse } from "node:http"; import { ActorAssertionWire } from "@sema-agent/settings-schema"; import type { RouteCtx, PreparedTaskSubmission, RouteMatch, RouteIdsOf } from "../route-ctx.js"; /** 行上的 `decision_actor`(裸 JSON)投成回显形;形不认 ⇒ undefined(调用点省略该键,不 500)。 * 导出仅为契约门(`test/ask-decision-actor-contract.test.ts` 钉「键集同源包版 + 严格度刻意宽读」两条) * —— 导出的是**行为**而不是 schema 对象:schema 的推断类型会牵出 registry-core 内嵌的 zod 路径 * (TS2742,不可移植),而这道门要钉的本来就是行为。非 wire 面。 */ export declare function projectDecisionActor(raw: unknown): ActorAssertionWire | undefined; /** 子代理 / 任务句柄 / HITL 应答段——`handle()` 里它在 SVC-5 workflow steer **之后**,故是独立的域入口。 */ /** 路由体 = 从 `server.ts` 的 `handle()` 里**整段剪切**过来的原文(唯一改动:统一去缩进两格)。裸 `return;` * = 「本域已应答」;走到函数尾才是「没匹配上」。跨域的东西一律在首行解构出来。 */ export declare function handleRuns(req: IncomingMessage, res: ServerResponse, match: RouteMatch, ctx: RouteCtx): Promise; /** 同上纪律(子代理 / 任务句柄 / HITL 应答段)。 */ export declare function handleRunVerbs(req: IncomingMessage, res: ServerResponse, match: RouteMatch, ctx: RouteCtx): Promise; /** * DESIGN-269 车2 件2 —— `POST /v1/runs` 的**建行 + 驱动**段,从路由体里原样搬出来的具名腿。 * * 🔴 为什么提取:A2A 的 `message/send`(routes/a2a-serve.ts)必须走**同一条**提交链 —— 第二条提交 * 路径就是第二个写者,而这条链上挂着 durable taskId 幂等重放、lease/治理窗 pre-admission、 * `createRun` 的会话 claim、checkpoint ctx 落库、fleet 行发布、resume/rewind 锚点捕获、审批 ALS…… * 手抄一份就是把这十来件事复制成两份会漂的实现(而漂开的那天没有任何东西会说话)。 * * **纯搬运**:函数体逐字来自搬走前的路由体(唯一改动=统一去缩进两格 + 三个「已应答」的裸 `return;` * 写成 `return null;`,语义一字未变 —— 调用方拿到 `null` 就是「腿已经自己应答了」)。 * * 契约: * · 返回 `null` = **已应答**(400 `body.taskId` 坏形 / 409 foreign owner / 202 durable 重放 / * lease·治理窗拒),调用方立即 return,不得再写响应体。 * · 返回 `{status, body}` = 本次提交的收据(202 = 新行已建并在跑;409 = 会话占用冲突,**没有**建行)。 * 调用方自己决定怎么发(HTTP 路由 `sendJson`;A2A 腿翻成协议对象或具名 RPC 错误)。 * · 调用前必须先过 `prepareSpec`(本腿吃它的产物)与 `deps.runStore` 在场判据 —— 后者本腿内另有 * 防御性复检(缺席 ⇒ 501),但两个调用方都在自己的入口先判过,那才是各自面上的正确错误形。 */ export declare function createDurableRun(req: IncomingMessage, res: ServerResponse, ctx: RouteCtx, prepared: PreparedTaskSubmission, /** in-memory 幂等键(`POST /v1/runs` = `Idempotency-Key` 头派生;A2A = `message.messageId` 派生)。 * undefined = 本次提交不参与 in-memory 去重(durable `body.taskId` 重放是独立的第二道)。 */ idemKey: string | undefined): Promise<{ status: number; body: unknown; } | null>; export declare const RUNS_ROUTES: readonly [{ readonly id: "runs-submit"; readonly path: "/v1/runs"; readonly billable: true; readonly methods: readonly ["POST"]; }, { readonly id: "run-steer"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/steer"; readonly methods: readonly ["POST"]; }, { readonly id: "run-interrupt"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/interrupt"; readonly methods: readonly ["POST"]; }, { readonly id: "run-detach"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/detach"; readonly methods: readonly ["POST"]; }, { readonly id: "run-cancel"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/cancel"; readonly methods: readonly ["POST"]; }, { readonly id: "run-compact"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/compact"; readonly methods: readonly ["POST"]; }, { readonly id: "run-events"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/events"; readonly methods: readonly ["GET"]; }, { readonly id: "run-detail"; readonly pattern: RegExp; readonly label: "/v1/runs/:id"; readonly methods: readonly ["GET"]; }]; /** 本域可分派行的 `id` 闭集 —— handler 的收尾按它判穷尽(漏一口 = 编译红)。 */ export type RunsRouteId = RouteIdsOf; export declare const RUN_VERBS_ROUTES: readonly [{ readonly id: "run-subagent-output"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/subagents/:sub/*"; readonly methods: readonly ["GET"]; }, { readonly id: "run-subagent-stream"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/subagents/:sub/*"; readonly methods: readonly ["GET"]; }, { readonly id: "run-subagent-steer"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/subagents/:sub/*"; readonly methods: readonly ["POST"]; }, { readonly id: "run-subagent-resume"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/subagents/:sub/*"; readonly billable: true; readonly methods: readonly ["POST"]; }, { readonly id: "run-task-output"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/tasks/:tid/*"; readonly methods: readonly ["GET"]; }, { readonly id: "run-task-stop"; readonly pattern: RegExp; readonly label: "/v1/runs/:id/tasks/:tid/*"; readonly methods: readonly ["POST"]; }, { readonly id: "elicitation-respond"; readonly pattern: RegExp; readonly label: "/v1/elicitations/:id/respond"; readonly methods: readonly ["POST"]; }, { readonly id: "question-respond"; readonly pattern: RegExp; readonly label: "/v1/questions/:id/respond"; readonly methods: readonly ["POST"]; }, { readonly id: "tool-approval-respond"; readonly pattern: RegExp; readonly label: "/v1/tool-approvals/:id/respond"; readonly methods: readonly ["POST"]; }, { readonly id: "task-ask-decision"; readonly pattern: RegExp; readonly label: "/v1/tasks/:id/asks/:askId/decision"; readonly methods: readonly ["POST"]; }]; export type RunVerbsRouteId = RouteIdsOf; //# sourceMappingURL=runs.d.ts.map