niceeval 0.14.2 → 0.14.3-canary.53
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.
- package/INDEX.md +13 -6
- package/dist/agents/sdk-streams.cjs +6 -1
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/sdk-streams.d.cts +3 -2
- package/dist/agents/sdk-streams.d.mts +3 -2
- package/dist/agents/sdk-streams.d.ts +3 -2
- package/dist/agents/ui-message-stream.cjs +3 -1
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/experiment/host/cli/debug-protocol.cjs +257 -0
- package/dist/experiment/host/cli/debug-protocol.cjs.map +1 -0
- package/dist/experiment/host/cli/debug-protocol.d.cts +13 -0
- package/dist/experiment/host/cli/debug-protocol.d.mts +13 -0
- package/dist/experiment/host/cli/debug-protocol.d.ts +13 -0
- package/dist/experiment/host/cli/debug-protocol.js +8 -0
- package/dist/experiment/host/cli/debug-protocol.js.map +1 -0
- package/dist/experiment/host/cli/session-protocol.cjs +78 -0
- package/dist/experiment/host/cli/session-protocol.cjs.map +1 -0
- package/dist/experiment/host/cli/session-protocol.d.cts +10 -0
- package/dist/experiment/host/cli/session-protocol.d.mts +10 -0
- package/dist/experiment/host/cli/session-protocol.d.ts +10 -0
- package/dist/experiment/host/cli/session-protocol.js +12 -0
- package/dist/experiment/host/cli/session-protocol.js.map +1 -0
- package/dist/experiment/host/index.cjs +9 -1
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +2 -0
- package/dist/experiment/host/index.d.mts +2 -0
- package/dist/experiment/host/index.d.ts +2 -0
- package/dist/experiment/host/index.js +28 -16
- package/dist/experiment/host/index.mjs +28 -16
- package/dist/run/cli/contribution.cjs +5 -5
- package/dist/run/cli/contribution.cjs.map +1 -1
- package/dist/run/host/index.cjs +14 -3
- package/dist/run/host/index.cjs.map +1 -1
- package/dist/run/host/index.d.cts +2 -2
- package/dist/run/host/index.d.mts +2 -2
- package/dist/run/host/index.d.ts +2 -2
- package/dist/run/host/lifecycle-adapter.cjs +12 -12
- package/dist/run/host/lifecycle-adapter.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +22 -22
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/host/runtime.d.cts +11 -2
- package/dist/run/host/runtime.d.mts +11 -2
- package/dist/run/host/runtime.d.ts +11 -2
- package/dist/run/host/runtime.js +2 -2
- package/dist/run/host/types.cjs.map +1 -1
- package/dist/run/host/types.d.cts +4 -5
- package/dist/run/host/types.d.mts +4 -5
- package/dist/run/host/types.d.ts +4 -5
- package/dist/runner/assert-first-bridge.cjs +78 -3
- package/dist/runner/assert-first-bridge.cjs.map +1 -1
- package/dist/runner/assert-first-bridge.d.cts +11 -1
- package/dist/runner/assert-first-bridge.d.mts +11 -1
- package/dist/runner/assert-first-bridge.d.ts +11 -1
- package/dist/runner/attempt.cjs +77 -67
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +2 -2
- package/dist/sandbox/backend.d.mts +2 -2
- package/dist/sandbox/backend.d.ts +2 -2
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -0
- package/dist/sandbox/index.d.mts +1 -0
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/sandbox/layer.d.cts +3 -3
- package/dist/sandbox/layer.d.mts +3 -3
- package/dist/sandbox/layer.d.ts +3 -3
- package/dist/sandbox/runtime.cjs.map +1 -1
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +2 -0
- package/dist/sandbox/types.d.mts +2 -0
- package/dist/sandbox/types.d.ts +2 -0
- package/dist/show/render.cjs +1 -0
- package/dist/show/render.cjs.map +1 -1
- package/dist/terminal/blocks.cjs +3 -5
- package/dist/terminal/blocks.cjs.map +1 -1
- package/dist/view/app-dist/.vite/manifest.json +3 -76
- package/dist/view/app-dist/assets/index-C6GQwHEF.js +63 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-B5wDa_F1.js → quality-cost-scatter-CSiMLelf.js} +5 -5
- package/dist/view/app-dist/index.html +1 -2
- package/dist/view/server.cjs +4 -3
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/zh/README.md +2 -2
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +8 -5
- package/docs-site/zh/tutorials/agent-onboarding.mdx +5 -3
- package/package.json +1 -1
- package/dist/view/app-dist/assets/AttemptDialog-76dX1VQq.js +0 -41
- package/dist/view/app-dist/assets/AttemptRoute-DRHVh2JA.js +0 -4
- package/dist/view/app-dist/assets/ResultsPage-9CSI8dvZ.js +0 -2
- package/dist/view/app-dist/assets/RunPage-BUF0REv7.js +0 -1
- package/dist/view/app-dist/assets/TableContentView-_Sbg5wDr.js +0 -3
- package/dist/view/app-dist/assets/index-BGr_6pGY.js +0 -19
- package/dist/view/app-dist/assets/jsx-runtime-BnHLaUks.js +0 -1
- package/dist/view/app-dist/assets/useSuspenseQuery-D3W8Uy33.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-message-stream.js","sourceRoot":"","sources":["ui-message-stream.ts"],"names":[],"mappings":";;AAwiBA,oDAQC;AAhjBD,iFAAiF;AACjF,EAAE;AACF,8EAA8E;AAC9E,qEAAqE;AACrE,+DAA+D;AAC/D,EAAE;AACF,kDAAkD;AAClD,qEAAqE;AACrE,iEAAiE;AACjE,oFAAoF;AACpF,6BAA6B;AAC7B,kDAAkD;AAClD,gFAAgF;AAChF,0EAA0E;AAC1E,mEAAmE;AACnE,yEAAyE;AACzE,wDAAwD;AACxD,gEAAgE;AAChE,wEAAwE;AACxE,4DAA4D;AAC5D,oBAAoB;AACpB,EAAE;AACF,+DAA+D;AAC/D,eAAe;AACf,6CAAyC;AACzC,mCAAgC;AAChC,4CAA+C;AAC/C,kEAA8D;AAC9D,mEAAqE;AACrE,2DAAqE;AA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,CAAC,QAAQ,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,WAAqB;oBAC3E,MAAM,EAAE,WAAW;oBACnB,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC;iBAClE,CAAC;YACN,CAAC;YACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;SAC1B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;;;;;;;;;;;;GAaG;AACH,SAAgB,oBAAoB,CAAC,OAAoC;IACrE,OAAO,IAAA,2BAAe,EAAC;QACnB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAmB;QACzC,gBAAgB,EAAE,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC;KACvE,CAAC,CAAC;AACP,CAAC","sourcesContent":["// uiMessageStreamAgent():AI SDK UI Message Stream Protocol 的无侵入 HTTP adapter 工厂。\n//\n// 协议:https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol —— `useChat` 后端的标准 SSE\n// (`data: {UIMessageChunk}\\n\\n`,以 `data: [DONE]\\n\\n` 收尾)。这是「对着一个已部署的\n// AI SDK 应用的 HTTP 接口无侵入接入」:adapter 只 fetch,不 import 被测应用的任何代码。\n//\n// · 会话:协议是服务端零状态、「客户端带全量历史」——工厂用 typed slot 存整份\n// UIMessage[],每轮原样重放;ctx.session.id 未记录时开新 chat id 并 capture 回写。\n// · 事件流:从归约后的 assistant 消息 parts 直构(text → message,tool part 的\n// approval-requested → operation.started,output-available / output-error / 审批拒绝\n// → operation.finished),\n// 不要求应用接 OTel;跨 resume 轮次按 callId / 已报文本长度去重。\n// · HITL:v7 tool approval(`needsApproval` 工具)——part 停在 `approval-requested` 时\n// 整轮 `waiting` + `input.requested`;下一轮输入(approve / yes / 同意 / 批准 开头 =\n// 批准,其余拒绝)翻译成 `approval-responded` 原地改写该 part、原样重发 messages 触发\n// 服务端续跑 —— 和真实前端 `addToolApprovalResponse()` + `sendMessage()` 的协议行为\n// 完全一致,没有单独的 approve 端点。拒绝的调用协议里不会有任何 tool-output 帧\n// (从没真正执行),由工厂合成 `status: \"rejected\"` 的 operation.finished。\n// · chunk 归约用 `ai` 包官方导出的框架无关 reducer `readUIMessageStream`(`useChat`\n// 内部同款),保证重放回服务端的 UIMessage 形状协议正确 —— `ai` 是可选 peer 依赖,\n// 只在用到本工厂时需要安装。\n//\n// tracing / spanMapper 原样透传:应用有 OTel 时接上拿瀑布图(span 只进瀑布图,不喂断言),\n// 事件流始终从协议帧直构。\nimport { randomUUID } from \"node:crypto\";\nimport { Effect } from \"effect\";\nimport { makeDirectAgent } from \"../define.ts\";\nimport { makeSendFailure } from \"../context/send-failures.ts\";\nimport { normalizeExternalCause } from \"../shared/external-cause.ts\";\nimport { completeEvidenceCoverage } from \"../assertions/coverage.ts\";\nimport type { Agent, AgentContext, AgentTracing, CommandProjection, EvidenceCoverage, InputResponse, JsonValue, SpanMapper, StreamEvent, TurnInput } from \"../types.ts\";\nimport { createSessionSlot } from \"./session-slot.ts\";\nimport { unclassifiedToolActionsCoverage } from \"../o11y/command-projection.ts\";\n// UI Message Stream 帧里没有 usage(协议本身不带 token 计数,见 docs/engineering/testing/e2e/README.md\n// 第 2 节);events/actions/messages/status 都直接来自完整归约的协议帧,和 turnFromAiSdk/aiSdkAgent\n// 同等完整——官方 SDK 适配器应声明全通道 complete(docs/feature/adapters/architecture/evidence.md),\n// 这里唯一的例外是协议本身没有的 usage 通道,如实标 unavailable 而不是留成 unknown。\nconst COVERAGE: EvidenceCoverage = Object.freeze({\n ...completeEvidenceCoverage,\n usage: { status: \"unavailable\" as const, reason: \"UI Message Stream frames carry no token usage\" },\n});\n// ───────────────────────── 协议的结构化类型(structural,不依赖 ai 包的类型) ─────────────────────────\n/** UIMessage 的最小结构面:只声明工厂真正要读的字段,其余原样透传。 */\nexport interface UIMessageLike {\n id: string;\n role: string;\n parts: UIMessagePartLike[];\n [key: string]: JsonValue | UIMessagePartLike[] | undefined;\n}\nexport interface UIMessagePartLike {\n type: string;\n state?: string;\n text?: string;\n toolCallId?: string;\n toolName?: string;\n input?: JsonValue;\n output?: JsonValue;\n errorText?: string;\n approval?: {\n id: string;\n approved?: boolean;\n reason?: string;\n };\n [key: string]: JsonValue | undefined;\n}\ninterface UIMessageChunkLike {\n type: string;\n errorText?: string;\n [key: string]: JsonValue | undefined;\n}\ninterface UiMessageSessionState {\n chatId?: string;\n reported?: ReportedState;\n}\nconst historySlot = createSessionSlot<UIMessageLike[]>(\"ui-message-stream/history\");\nconst sessionStateSlot = createSessionSlot<UiMessageSessionState>(\"ui-message-stream/state\");\ntype ReadUIMessageStream = (options: {\n message?: UIMessageLike;\n stream: ReadableStream<UIMessageChunkLike>;\n}) => AsyncIterable<UIMessageLike>;\n// ai 是可选 peer 依赖:动态 import,缺了就把「装什么」直接说清楚。\n// 说明符经变量传入,避免 TS 对字面量模块名做安装检查(niceeval 自身不依赖 ai)。\nlet aiModule: Promise<{\n readUIMessageStream: ReadUIMessageStream;\n}> | undefined;\nfunction missingAiModule(): Error {\n return new Error(\"uiMessageStreamAgent 需要 `ai` 包(AI SDK v5+,协议 reducer readUIMessageStream 来自它)。在你的 eval 项目里安装:npm install -D ai\");\n}\n/** Dynamic import is an SDK Promise boundary; a rejected load is never cached. */\nfunction loadAiEffect(): Effect.Effect<{\n readUIMessageStream: ReadUIMessageStream;\n}, Error> {\n const pending = aiModule;\n return Effect.tryPromise({\n try: () => {\n if (pending !== undefined)\n return pending;\n const specifier = \"ai\";\n const loading = __niceevalDynamicImport(specifier) as Promise<{\n readUIMessageStream: ReadUIMessageStream;\n }>;\n aiModule = loading;\n return loading;\n },\n catch: () => missingAiModule(),\n }).pipe(Effect.tapError(() => Effect.sync(() => {\n aiModule = undefined;\n })));\n}\n// ───────────────────────── SSE 解析 ─────────────────────────\nfunction drainSseEvents(buffer: string, controller: TransformStreamDefaultController<UIMessageChunkLike>, onChunk: (chunk: UIMessageChunkLike) => void, onDone: () => void): string {\n for (;;) {\n const sepIndex = buffer.indexOf(\"\\n\\n\");\n if (sepIndex === -1)\n return buffer;\n const rawEvent = buffer.slice(0, sepIndex);\n buffer = buffer.slice(sepIndex + 2);\n const line = rawEvent.split(\"\\n\").find((candidate) => candidate.startsWith(\"data: \"));\n if (!line)\n continue;\n const payload = line.slice(\"data: \".length);\n if (payload === \"[DONE]\") {\n onDone();\n // `[DONE]` is the protocol terminal, not an advisory event. Closing the\n // reducer input here prevents frames later in the same network chunk (or\n // later chunks) from manufacturing a successful Turn after termination.\n controller.terminate();\n return \"\";\n }\n const chunk = JSON.parse(payload) as UIMessageChunkLike;\n onChunk(chunk);\n controller.enqueue(chunk);\n }\n}\n/**\n * Build the AI SDK reducer input with native stream composition rather than a hand-owned reader.\n * Scope finalization below aborts/cancels this pipeline, so an interrupted reducer cannot retain a\n * body reader or live HTTP transport.\n */\nfunction toChunkStream(body: ReadableStream<Uint8Array>, onChunk: (c: UIMessageChunkLike) => void, onDone: () => void): ReadableStream<UIMessageChunkLike> {\n const decoder = new TextDecoder();\n let buffer = \"\";\n return body.pipeThrough(new TransformStream<Uint8Array, UIMessageChunkLike>({\n transform(value, controller) {\n buffer += decoder.decode(value, { stream: true });\n buffer = drainSseEvents(buffer, controller, onChunk, onDone);\n },\n flush(controller) {\n // Keep the original protocol rule: only a completed `\\n\\n` record is observable.\n buffer = drainSseEvents(buffer, controller, onChunk, onDone);\n },\n }));\n}\n// ───────────────────────── parts → 事件 ─────────────────────────\nfunction isToolPart(part: UIMessagePartLike): boolean {\n return part.type === \"dynamic-tool\" || part.type.startsWith(\"tool-\");\n}\nfunction toolNameOf(part: UIMessagePartLike): string {\n if (part.type === \"dynamic-tool\")\n return part.toolName ?? \"dynamic-tool\";\n return part.type.slice(\"tool-\".length);\n}\nfunction isApprovalRequested(part: UIMessagePartLike): boolean {\n return isToolPart(part) && part.state === \"approval-requested\";\n}\n/** 和 aiSdkAgent 同一词法(t.respond 的自由文本回答):approve / yes / 同意 / 批准 开头 = 批准。 */\nfunction isApproved(text: string): boolean {\n return /^(approve|yes|同意|批准)/i.test(text.trim());\n}\n/** 按 requestId 从 input.responses 对位取裁决;optionId 优先,自由文本走 isApproved,没答到直接报错。 */\nfunction approvalDecision(responses: readonly InputResponse[] | undefined, requestId: string | undefined): boolean {\n const matched = responses?.find((r) => r.requestId === requestId);\n if (!matched) {\n throw new Error(`No response for pending approval \"${requestId ?? \"unknown\"}\". Answer approval requests with t.respond(...).`);\n }\n if (matched.optionId !== undefined)\n return matched.optionId === \"approve\";\n return isApproved(matched.text ?? \"\");\n}\n/** 已报告的进度:resume 续跑的是同一条 assistant 消息,跨轮去重靠它。 */\ninterface ReportedState {\n startedCalls: Set<string>;\n finishedCalls: Set<string>;\n liveProgressCalls: Set<string>;\n textLen: number;\n}\nconst COMPLETE_TOOL_INPUT_STATES = new Set([\n \"input-available\",\n \"approval-requested\",\n \"approval-responded\",\n \"output-available\",\n \"output-error\",\n \"output-denied\",\n]);\n/** Project only reducer-owned messages whose tool input is already complete. */\nfunction reportLiveToolProgress(message: UIMessageLike, reported: ReportedState, ctx: AgentContext): void {\n for (const part of message.parts) {\n if (!isToolPart(part) ||\n !COMPLETE_TOOL_INPUT_STATES.has(part.state ?? \"\") ||\n typeof part.toolCallId !== \"string\" || part.toolCallId === \"\" ||\n !Object.prototype.hasOwnProperty.call(part, \"input\") ||\n reported.liveProgressCalls.has(part.toolCallId))\n continue;\n const name = toolNameOf(part);\n if (name === \"\")\n continue;\n let input: string | undefined;\n try {\n input = JSON.stringify(part.input);\n }\n catch {\n continue;\n }\n if (input === undefined)\n continue;\n reported.liveProgressCalls.add(part.toolCallId);\n ctx.progress({ message: `tool: ${name} ${input}` });\n }\n}\n/**\n * 从归约后的最终消息派生本轮事件。工具事件按 part 顺序;文本合并成一条 message 事件\n * (resume 轮只报新增的后缀)。停在 approval-requested 的调用先报 started,\n * 因此它在审批轮是 pending;裁决后的续跑轮只补 finished,落成 completed 或 rejected。\n */\nfunction deriveTurnEvents(message: UIMessageLike, reported: ReportedState, projectToolCommand: UiMessageStreamAgentOptions[\"projectToolCommand\"]): StreamEvent[] {\n const events: StreamEvent[] = [];\n let fullText = \"\";\n for (const part of message.parts) {\n if (part.type === \"text\") {\n fullText += part.text ?? \"\";\n continue;\n }\n if (!isToolPart(part))\n continue;\n const callId = part.toolCallId ?? \"\";\n if (!callId || reported.finishedCalls.has(callId))\n continue;\n const name = toolNameOf(part);\n const input = (part.input ?? null) as JsonValue;\n const start = () => {\n if (reported.startedCalls.has(callId))\n return;\n const command = projectToolCommand?.({ name, input });\n events.push({\n type: \"operation.started\",\n operationId: callId,\n operation: {\n kind: \"tool\",\n name,\n input,\n ...(command === undefined ? {} : { command }),\n },\n });\n reported.startedCalls.add(callId);\n };\n if (part.state === \"output-available\") {\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", output: part.output as JsonValue, status: \"completed\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"output-error\") {\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", output: part.errorText, status: \"failed\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"output-denied\" ||\n (part.state === \"approval-responded\" && part.approval?.approved === false)) {\n // 拒绝的调用从没真正执行,协议里不会再有它的任何帧 —— 在裁决落地的这一轮合成。\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", status: \"rejected\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"approval-requested\") {\n start();\n }\n // input-* 中间态还没有可信的完整入参,等 approval-requested 或终态再报。\n }\n const newText = fullText.slice(reported.textLen);\n if (newText.trim())\n events.push({ type: \"message\", role: \"assistant\", text: newText });\n reported.textLen = fullText.length;\n return events;\n}\n// ───────────────────────── 工厂 ─────────────────────────\nexport interface UiMessageStreamAgentOptions {\n /** agent 名(报告 / 结果聚合的身份)。默认 \"ui-message-stream\"。 */\n name?: string;\n /** 被测应用的 chat 端点(完整 URL,应用在哪部署就指哪);函数形式每轮解析。 */\n url: string | ((ctx: AgentContext) => string | Promise<string>);\n /** 附加请求头(鉴权等);`ctx.telemetry.headers`(traceparent)总会自动并入。 */\n headers?: globalThis.Record<string, string> | ((ctx: AgentContext) => globalThis.Record<string, string>);\n /** 除 `messages` 外并入请求体的字段,如 `(ctx) => ({ model: ctx.model })`(undefined 字段序列化时自动丢弃)。 */\n body?: (ctx: AgentContext) => globalThis.Record<string, JsonValue | undefined>;\n /**\n * 由 endpoint owner 逐笔把逻辑工具调用分类为 command 或 not-command。\n * 未知调用返回 undefined 并保持 actions coverage partial;NiceEval 不按名称或 input 猜测。\n */\n projectToolCommand?: (tool: Readonly<{\n name: string;\n input: JsonValue;\n }>) => CommandProjection | undefined;\n /**\n * 拒绝审批时随 `approval-responded` 带出的理由。应用/SDK 会把它作为模型看到的工具结果\n * 文本 —— 写清楚「不要重试」能明显降低模型原样重发同一调用的概率(实测)。\n */\n denyReason?: string;\n /** 流结束后再等这么久才返回(毫秒),给应用侧的观测导出(如 BatchSpanProcessor)留时间。 */\n settleMs?: number;\n /** 应用有 OTel 时的端点投递方式(拿瀑布图);事件流不依赖它。 */\n tracing?: AgentTracing;\n /** 应用有 OTel 时的 span 归一函数(拿瀑布图);事件流不依赖它。 */\n spanMapper?: SpanMapper;\n}\nconst DEFAULT_DENY_REASON = \"用户拒绝了这次调用,不要重试,直接告知用户操作未执行。\";\ninterface PreparedUiMessageStreamSend {\n readonly bookkeeping: UiMessageSessionState;\n readonly messagesToSend: UIMessageLike[];\n readonly resumeFrom: UIMessageLike | undefined;\n}\n/** External SDK / transport Promise boundary. */\nfunction promiseEffect<Value>(run: (signal: AbortSignal) => PromiseLike<Value>): Effect.Effect<Value, unknown> {\n return Effect.tryPromise({ try: run, catch: (cause) => cause });\n}\nfunction resolveUrlEffect(options: UiMessageStreamAgentOptions, ctx: AgentContext): Effect.Effect<string, unknown> {\n const url = options.url;\n return typeof url === \"function\"\n ? promiseEffect(() => Promise.resolve(url(ctx)))\n : Effect.succeed(url);\n}\nfunction resolveHeadersEffect(options: UiMessageStreamAgentOptions, ctx: AgentContext): Effect.Effect<globalThis.Record<string, string>, unknown> {\n return Effect.try({\n try: () => typeof options.headers === \"function\" ? options.headers(ctx) : (options.headers ?? {}),\n catch: (cause) => cause,\n });\n}\nfunction transportController() {\n return Effect.acquireRelease(Effect.sync(() => new AbortController()), (controller) => Effect.sync(() => controller.abort()));\n}\nfunction cancelReadableStreamEffect<Value>(stream: ReadableStream<Value>): Effect.Effect<void> {\n return promiseEffect(() => stream.cancel()).pipe(Effect.catch(() => Effect.void), Effect.asVoid);\n}\nfunction prepareMessages(options: UiMessageStreamAgentOptions, input: TurnInput, ctx: AgentContext): PreparedUiMessageStreamSend {\n // 会话续接是「客户端带全量历史」模式:历史与协议簿记各用一个 typed slot,\n // 新线自然两者都为空;相同名字不会让其它 Adapter 的 slot 与它们碰撞。\n const priorMessages = ctx.session.get(historySlot) ?? [];\n const bookkeeping = ctx.session.get(sessionStateSlot) ?? {};\n ctx.session.set(sessionStateSlot, bookkeeping);\n let id = bookkeeping.chatId;\n if (!id) {\n id = `uims-${randomUUID()}`;\n bookkeeping.chatId = id;\n ctx.session.capture(id); // 镜像:t.sessionId / 报告可见\n }\n const lastMessage = priorMessages.at(-1);\n const pendingPart = lastMessage?.role === \"assistant\" ? lastMessage.parts.find(isApprovalRequested) : undefined;\n if (pendingPart && lastMessage) {\n // HITL 续跑:不追加新 user 消息 —— 把停在 approval-requested 的 part 原地改成\n // approval-responded,原样重发,服务端续跑同一条被打断的 assistant 消息。\n // 裁决按 requestId 从 input.responses 对位读取(t.respond 的结构化回答)。\n const requestId = pendingPart.approval?.id ?? pendingPart.toolCallId;\n const approved = approvalDecision(input.responses, requestId);\n const mutatedParts = lastMessage.parts.map((part) => isApprovalRequested(part) && part.approval?.id === pendingPart.approval?.id\n ? {\n ...part,\n state: \"approval-responded\",\n approval: {\n id: pendingPart.approval!.id,\n approved,\n ...(approved ? {} : { reason: options.denyReason ?? DEFAULT_DENY_REASON }),\n },\n }\n : part);\n const resumeFrom = { ...lastMessage, parts: mutatedParts };\n return {\n bookkeeping,\n resumeFrom,\n messagesToSend: [...priorMessages.slice(0, -1), resumeFrom],\n };\n }\n const parts: UIMessagePartLike[] = [{ type: \"text\", text: input.text }];\n for (const file of input.files ?? []) {\n parts.push({ type: \"file\", mediaType: file.mimeType, url: `data:${file.mimeType};base64,${file.dataBase64}` });\n }\n return {\n bookkeeping,\n resumeFrom: undefined,\n messagesToSend: [...priorMessages, { id: randomUUID(), role: \"user\", parts }],\n };\n}\n/** Consume the SDK's native async iterator only inside its named Effect Promise boundary. */\nfunction reduceUiMessageStreamEffect(readUIMessageStream: ReadUIMessageStream, resumeFrom: UIMessageLike | undefined, stream: ReadableStream<UIMessageChunkLike>, transport: AbortController, onMessage: (message: UIMessageLike) => void): Effect.Effect<UIMessageLike | undefined, unknown> {\n return promiseEffect(async (signal) => {\n const onAbort = () => transport.abort(signal.reason);\n signal.addEventListener(\"abort\", onAbort, { once: true });\n if (signal.aborted)\n onAbort();\n try {\n let finalMessage: UIMessageLike | undefined;\n for await (const message of readUIMessageStream({ message: resumeFrom, stream })) {\n finalMessage = message;\n onMessage(message);\n }\n return finalMessage;\n }\n finally {\n signal.removeEventListener(\"abort\", onAbort);\n }\n });\n}\nfunction uiMessageStreamSendEffect(options: UiMessageStreamAgentOptions, input: TurnInput, ctx: AgentContext): Effect.Effect<import(\"../types.ts\").Turn, unknown> {\n return Effect.scoped(Effect.gen(function* () {\n const { readUIMessageStream } = yield* loadAiEffect();\n const prepared = yield* Effect.try({\n try: () => prepareMessages(options, input, ctx),\n catch: (cause) => cause,\n });\n const url = yield* resolveUrlEffect(options, ctx);\n const extraHeaders = yield* resolveHeadersEffect(options, ctx);\n const transport = yield* transportController();\n const res = yield* Effect.tryPromise({\n try: (signal) => fetch(url, {\n method: \"POST\",\n // traceparent 随请求带过去:应用埋点支持 context 传播时,span 归属精确到本轮。\n headers: { \"content-type\": \"application/json\", ...extraHeaders, ...ctx.telemetry?.headers },\n body: JSON.stringify({ ...options.body?.(ctx), messages: prepared.messagesToSend }),\n signal: AbortSignal.any([ctx.signal, signal, transport.signal]),\n }),\n catch: (err) => {\n if (ctx.signal.aborted)\n return err;\n const cause = err instanceof Error\n ? (err.cause instanceof Error ? err.cause.message : err.message)\n : String(err);\n return makeSendFailure({\n acceptance: \"unknown\",\n message: `Could not connect to ${url} (${cause}). Is the app under test running? Start it yourself first, or point url at a deployed instance via config.`,\n cause: normalizeExternalCause(err),\n });\n },\n });\n const responseBody = res.body;\n if (!res.ok || !responseBody) {\n const responseText = yield* promiseEffect(() => res.text()).pipe(Effect.catch(() => Effect.succeed(\"\")));\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: `POST ${url} failed: ${res.status} ${responseText}. Confirm the app is running and the endpoint speaks the UI Message Stream protocol (the backend useChat expects).`,\n cause: normalizeExternalCause({ status: res.status }),\n }));\n }\n const streamState: {\n sawDone: boolean;\n sawError: string | undefined;\n } = {\n sawDone: false,\n sawError: undefined,\n };\n const chunkStream = toChunkStream(responseBody, (chunk) => {\n if (chunk.type === \"error\")\n streamState.sawError = chunk.errorText;\n }, () => {\n streamState.sawDone = true;\n });\n yield* Effect.addFinalizer(() => Effect.sync(() => transport.abort()).pipe(Effect.andThen(cancelReadableStreamEffect(chunkStream))));\n const reported: ReportedState = prepared.resumeFrom && prepared.bookkeeping.reported\n ? prepared.bookkeeping.reported\n : { startedCalls: new Set(), finishedCalls: new Set(), liveProgressCalls: new Set(), textLen: 0 };\n prepared.bookkeeping.reported = reported;\n const finalMessage = yield* reduceUiMessageStreamEffect(readUIMessageStream, prepared.resumeFrom, chunkStream, transport, (message) => reportLiveToolProgress(message, reported, ctx));\n if (!streamState.sawDone) {\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: `POST ${url} ended before the UI Message Stream [DONE] marker. The response was truncated or the endpoint does not speak the complete UI Message Stream protocol.`,\n }));\n }\n if (!finalMessage) {\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: `POST ${url} 的流结束了但一条 assistant 消息都没归约出来 —— 端点吐的不是 UI Message Stream 帧?`,\n }));\n }\n const derived = yield* Effect.try({\n try: () => {\n // 续跑轮:finalMessage 是同一条消息的完整版,替换末尾半成品;全新轮:追加。\n ctx.session.set(historySlot, prepared.resumeFrom\n ? [...prepared.messagesToSend.slice(0, -1), finalMessage]\n : [...prepared.messagesToSend, finalMessage]);\n return {\n events: deriveTurnEvents(finalMessage, reported, options.projectToolCommand),\n request: finalMessage.parts.find(isApprovalRequested),\n };\n },\n catch: (cause) => cause,\n });\n const request = derived.request;\n if (request) {\n return yield* Effect.try({\n try: () => {\n const waitingEvents = [\n ...derived.events,\n {\n type: \"input.requested\" as const,\n request: {\n id: request.approval?.id ?? request.toolCallId,\n action: toolNameOf(request),\n input: (request.input ?? null) as JsonValue,\n options: [{ id: \"approve\" }, { id: \"deny\" }],\n },\n },\n ];\n const evidenceCoverage = unclassifiedToolActionsCoverage(waitingEvents);\n return {\n status: \"waiting\" as const,\n events: waitingEvents,\n ...(evidenceCoverage === undefined ? {} : { evidenceCoverage }),\n };\n },\n catch: (cause) => cause,\n });\n }\n if (options.settleMs)\n yield* Effect.sleep(options.settleMs);\n return yield* Effect.try({\n try: () => {\n const finalEvents = [\n ...derived.events,\n ...(streamState.sawError ? [{ type: \"error\" as const, message: streamState.sawError }] : []),\n ];\n const evidenceCoverage = unclassifiedToolActionsCoverage(finalEvents);\n return {\n status: streamState.sawError ? (\"failed\" as const) : (\"completed\" as const),\n events: finalEvents,\n ...(evidenceCoverage === undefined ? {} : { evidenceCoverage }),\n };\n },\n catch: (cause) => cause,\n });\n }));\n}\n/**\n * UI Message Stream Protocol(AI SDK `useChat` 后端的标准 SSE 协议)的内置无侵入 adapter。\n * 对着已部署应用的 HTTP 端点收发,不 import 应用代码:\n *\n * ```typescript\n * import { uiMessageStreamAgent } from \"niceeval/adapter\";\n *\n * export default uiMessageStreamAgent({\n * name: \"my-assistant\",\n * url: \"https://my-app.example.com/api/chat\",\n * body: (ctx) => ({ model: ctx.model }), // 应用支持请求级选模型时,模型对比零改动\n * });\n * ```\n */\nexport function uiMessageStreamAgent(options: UiMessageStreamAgentOptions): Agent {\n return makeDirectAgent({\n name: options.name ?? \"ui-message-stream\",\n evidenceCoverage: COVERAGE,\n tracing: options.tracing,\n spanMapper: options.spanMapper,\n send: (input, ctx) => uiMessageStreamSendEffect(options, input, ctx),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ui-message-stream.js","sourceRoot":"","sources":["ui-message-stream.ts"],"names":[],"mappings":";;AA0iBA,oDAQC;AAljBD,iFAAiF;AACjF,EAAE;AACF,8EAA8E;AAC9E,qEAAqE;AACrE,+DAA+D;AAC/D,EAAE;AACF,kDAAkD;AAClD,qEAAqE;AACrE,iEAAiE;AACjE,oFAAoF;AACpF,6BAA6B;AAC7B,kDAAkD;AAClD,gFAAgF;AAChF,0EAA0E;AAC1E,mEAAmE;AACnE,yEAAyE;AACzE,wDAAwD;AACxD,gEAAgE;AAChE,wEAAwE;AACxE,4DAA4D;AAC5D,oBAAoB;AACpB,EAAE;AACF,+DAA+D;AAC/D,eAAe;AACf,6CAAyC;AACzC,mCAAgC;AAChC,4CAA+C;AAC/C,kEAA8D;AAC9D,mEAAqE;AACrE,2DAAqE;AAErE,uDAAsD;AACtD,yEAAgF;AAChF,wFAAwF;AACxF,iFAAiF;AACjF,mFAAmF;AACnF,0DAA0D;AAC1D,MAAM,QAAQ,GAAqB,MAAM,CAAC,MAAM,CAAC;IAC7C,GAAG,sCAAwB;IAC3B,KAAK,EAAE,EA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AAkB,CAAC,CAAC,CAAE,WAAqB;oBAC3E,MAAM,EAAE,WAAW;oBACnB,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC;iBAClE,CAAC;YACN,CAAC;YACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;SAC1B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;;;;;;;;;;;;GAaG;AACH,SAAgB,oBAAoB,CAAC,OAAoC;IACrE,OAAO,IAAA,2BAAe,EAAC;QACnB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAmB;QACzC,gBAAgB,EAAE,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC;KACvE,CAAC,CAAC;AACP,CAAC","sourcesContent":["// uiMessageStreamAgent():AI SDK UI Message Stream Protocol 的无侵入 HTTP adapter 工厂。\n//\n// 协议:https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol —— `useChat` 后端的标准 SSE\n// (`data: {UIMessageChunk}\\n\\n`,以 `data: [DONE]\\n\\n` 收尾)。这是「对着一个已部署的\n// AI SDK 应用的 HTTP 接口无侵入接入」:adapter 只 fetch,不 import 被测应用的任何代码。\n//\n// · 会话:协议是服务端零状态、「客户端带全量历史」——工厂用 typed slot 存整份\n// UIMessage[],每轮原样重放;ctx.session.id 未记录时开新 chat id 并 capture 回写。\n// · 事件流:从归约后的 assistant 消息 parts 直构(text → message,tool part 的\n// approval-requested → operation.started,output-available / output-error / 审批拒绝\n// → operation.finished),\n// 不要求应用接 OTel;跨 resume 轮次按 callId / 已报文本长度去重。\n// · HITL:v7 tool approval(`needsApproval` 工具)——part 停在 `approval-requested` 时\n// 整轮 `waiting` + `input.requested`;下一轮输入(approve / yes / 同意 / 批准 开头 =\n// 批准,其余拒绝)翻译成 `approval-responded` 原地改写该 part、原样重发 messages 触发\n// 服务端续跑 —— 和真实前端 `addToolApprovalResponse()` + `sendMessage()` 的协议行为\n// 完全一致,没有单独的 approve 端点。拒绝的调用协议里不会有任何 tool-output 帧\n// (从没真正执行),由工厂合成 `status: \"rejected\"` 的 operation.finished。\n// · chunk 归约用 `ai` 包官方导出的框架无关 reducer `readUIMessageStream`(`useChat`\n// 内部同款),保证重放回服务端的 UIMessage 形状协议正确 —— `ai` 是可选 peer 依赖,\n// 只在用到本工厂时需要安装。\n//\n// tracing / spanMapper 原样透传:应用有 OTel 时接上拿瀑布图(span 只进瀑布图,不喂断言),\n// 事件流始终从协议帧直构。\nimport { randomUUID } from \"node:crypto\";\nimport { Effect } from \"effect\";\nimport { makeDirectAgent } from \"../define.ts\";\nimport { makeSendFailure } from \"../context/send-failures.ts\";\nimport { normalizeExternalCause } from \"../shared/external-cause.ts\";\nimport { completeEvidenceCoverage } from \"../assertions/coverage.ts\";\nimport type { Agent, AgentContext, AgentTracing, CommandProjection, EvidenceCoverage, InputResponse, JsonValue, SpanMapper, StreamEvent, TurnInput } from \"../types.ts\";\nimport { createSessionSlot } from \"./session-slot.ts\";\nimport { unclassifiedToolActionsCoverage } from \"../o11y/command-projection.ts\";\n// UI Message Stream 帧里没有 usage(协议本身不带 token 计数,见 docs/engineering/testing/e2e/README.md\n// 第 2 节);events/actions/messages/status 都直接来自完整归约的协议帧,和 turnFromAiSdk/aiSdkAgent\n// 同等完整——官方 SDK 适配器应声明全通道 complete(docs/feature/adapters/architecture/evidence.md),\n// 这里唯一的例外是协议本身没有的 usage 通道,如实标 unavailable 而不是留成 unknown。\nconst COVERAGE: EvidenceCoverage = Object.freeze({\n ...completeEvidenceCoverage,\n usage: { status: \"unavailable\" as const, reason: \"UI Message Stream frames carry no token usage\" },\n});\n// ───────────────────────── 协议的结构化类型(structural,不依赖 ai 包的类型) ─────────────────────────\n/** UIMessage 的最小结构面:只声明工厂真正要读的字段,其余原样透传。 */\nexport interface UIMessageLike {\n id: string;\n role: string;\n parts: UIMessagePartLike[];\n [key: string]: JsonValue | UIMessagePartLike[] | undefined;\n}\nexport interface UIMessagePartLike {\n type: string;\n state?: string;\n text?: string;\n toolCallId?: string;\n toolName?: string;\n input?: JsonValue;\n output?: JsonValue;\n errorText?: string;\n approval?: {\n id: string;\n approved?: boolean;\n reason?: string;\n };\n [key: string]: JsonValue | undefined;\n}\ninterface UIMessageChunkLike {\n type: string;\n errorText?: string;\n [key: string]: JsonValue | undefined;\n}\ninterface UiMessageSessionState {\n chatId?: string;\n reported?: ReportedState;\n}\nconst historySlot = createSessionSlot<UIMessageLike[]>(\"ui-message-stream/history\");\nconst sessionStateSlot = createSessionSlot<UiMessageSessionState>(\"ui-message-stream/state\");\ntype ReadUIMessageStream = (options: {\n message?: UIMessageLike;\n stream: ReadableStream<UIMessageChunkLike>;\n}) => AsyncIterable<UIMessageLike>;\n// ai 是可选 peer 依赖:动态 import,缺了就把「装什么」直接说清楚。\n// 说明符经变量传入,避免 TS 对字面量模块名做安装检查(niceeval 自身不依赖 ai)。\nlet aiModule: Promise<{\n readUIMessageStream: ReadUIMessageStream;\n}> | undefined;\nfunction missingAiModule(): Error {\n return new Error(\"uiMessageStreamAgent 需要 `ai` 包(AI SDK v5+,协议 reducer readUIMessageStream 来自它)。在你的 eval 项目里安装:npm install -D ai\");\n}\n/** Dynamic import is an SDK Promise boundary; a rejected load is never cached. */\nfunction loadAiEffect(): Effect.Effect<{\n readUIMessageStream: ReadUIMessageStream;\n}, Error> {\n const pending = aiModule;\n return Effect.tryPromise({\n try: () => {\n if (pending !== undefined)\n return pending;\n const specifier = \"ai\";\n const loading = __niceevalDynamicImport(specifier) as Promise<{\n readUIMessageStream: ReadUIMessageStream;\n }>;\n aiModule = loading;\n return loading;\n },\n catch: () => missingAiModule(),\n }).pipe(Effect.tapError(() => Effect.sync(() => {\n aiModule = undefined;\n })));\n}\n// ───────────────────────── SSE 解析 ─────────────────────────\nfunction drainSseEvents(buffer: string, controller: TransformStreamDefaultController<UIMessageChunkLike>, onChunk: (chunk: UIMessageChunkLike) => void, onDone: () => void): string {\n for (;;) {\n const sepIndex = buffer.indexOf(\"\\n\\n\");\n if (sepIndex === -1)\n return buffer;\n const rawEvent = buffer.slice(0, sepIndex);\n buffer = buffer.slice(sepIndex + 2);\n const line = rawEvent.split(\"\\n\").find((candidate) => candidate.startsWith(\"data: \"));\n if (!line)\n continue;\n const payload = line.slice(\"data: \".length);\n if (payload === \"[DONE]\") {\n onDone();\n // `[DONE]` is the protocol terminal, not an advisory event. Closing the\n // reducer input here prevents frames later in the same network chunk (or\n // later chunks) from manufacturing a successful Turn after termination.\n controller.terminate();\n return \"\";\n }\n const chunk = JSON.parse(payload) as UIMessageChunkLike;\n onChunk(chunk);\n controller.enqueue(chunk);\n }\n}\n/**\n * Build the AI SDK reducer input with native stream composition rather than a hand-owned reader.\n * Scope finalization below aborts/cancels this pipeline, so an interrupted reducer cannot retain a\n * body reader or live HTTP transport.\n */\nfunction toChunkStream(body: ReadableStream<Uint8Array>, onChunk: (c: UIMessageChunkLike) => void, onDone: () => void): ReadableStream<UIMessageChunkLike> {\n const decoder = new TextDecoder();\n let buffer = \"\";\n return body.pipeThrough(new TransformStream<Uint8Array, UIMessageChunkLike>({\n transform(value, controller) {\n buffer += decoder.decode(value, { stream: true });\n buffer = drainSseEvents(buffer, controller, onChunk, onDone);\n },\n flush(controller) {\n // Keep the original protocol rule: only a completed `\\n\\n` record is observable.\n buffer = drainSseEvents(buffer, controller, onChunk, onDone);\n },\n }));\n}\n// ───────────────────────── parts → 事件 ─────────────────────────\nfunction isToolPart(part: UIMessagePartLike): boolean {\n return part.type === \"dynamic-tool\" || part.type.startsWith(\"tool-\");\n}\nfunction toolNameOf(part: UIMessagePartLike): string {\n if (part.type === \"dynamic-tool\")\n return part.toolName ?? \"dynamic-tool\";\n return part.type.slice(\"tool-\".length);\n}\nfunction isApprovalRequested(part: UIMessagePartLike): boolean {\n return isToolPart(part) && part.state === \"approval-requested\";\n}\n/** 和 aiSdkAgent 同一词法(t.respond 的自由文本回答):approve / yes / 同意 / 批准 开头 = 批准。 */\nfunction isApproved(text: string): boolean {\n return /^(approve|yes|同意|批准)/i.test(text.trim());\n}\n/** 按 requestId 从 input.responses 对位取裁决;optionId 优先,自由文本走 isApproved,没答到直接报错。 */\nfunction approvalDecision(responses: readonly InputResponse[] | undefined, requestId: string | undefined): boolean {\n const matched = responses?.find((r) => r.requestId === requestId);\n if (!matched) {\n throw new Error(`No response for pending approval \"${requestId ?? \"unknown\"}\". Answer approval requests with t.respond(...).`);\n }\n if (matched.optionId !== undefined)\n return matched.optionId === \"approve\";\n return isApproved(matched.text ?? \"\");\n}\n/** 已报告的进度:resume 续跑的是同一条 assistant 消息,跨轮去重靠它。 */\ninterface ReportedState {\n startedCalls: Set<string>;\n finishedCalls: Set<string>;\n liveProgressCalls: Set<string>;\n textLen: number;\n}\nconst COMPLETE_TOOL_INPUT_STATES = new Set([\n \"input-available\",\n \"approval-requested\",\n \"approval-responded\",\n \"output-available\",\n \"output-error\",\n \"output-denied\",\n]);\n/** Project only reducer-owned messages whose tool input is already complete. */\nfunction reportLiveToolProgress(message: UIMessageLike, reported: ReportedState, ctx: AgentContext): void {\n for (const part of message.parts) {\n if (!isToolPart(part) ||\n !COMPLETE_TOOL_INPUT_STATES.has(part.state ?? \"\") ||\n typeof part.toolCallId !== \"string\" || part.toolCallId === \"\" ||\n !Object.prototype.hasOwnProperty.call(part, \"input\") ||\n reported.liveProgressCalls.has(part.toolCallId))\n continue;\n const name = toolNameOf(part);\n if (name === \"\")\n continue;\n let input: string | undefined;\n try {\n input = JSON.stringify(part.input);\n }\n catch {\n continue;\n }\n if (input === undefined)\n continue;\n reported.liveProgressCalls.add(part.toolCallId);\n ctx.progress({ message: `tool: ${name} ${input}` });\n }\n}\n/**\n * 从归约后的最终消息派生本轮事件。工具事件按 part 顺序;文本合并成一条 message 事件\n * (resume 轮只报新增的后缀)。停在 approval-requested 的调用先报 started,\n * 因此它在审批轮是 pending;裁决后的续跑轮只补 finished,落成 completed 或 rejected。\n */\nfunction deriveTurnEvents(message: UIMessageLike, reported: ReportedState, projectToolCommand: UiMessageStreamAgentOptions[\"projectToolCommand\"]): StreamEvent[] {\n const events: StreamEvent[] = [];\n let fullText = \"\";\n for (const part of message.parts) {\n if (part.type === \"text\") {\n fullText += part.text ?? \"\";\n continue;\n }\n if (!isToolPart(part))\n continue;\n const callId = part.toolCallId ?? \"\";\n if (!callId || reported.finishedCalls.has(callId))\n continue;\n const name = toolNameOf(part);\n const input = (part.input ?? null) as JsonValue;\n const start = () => {\n if (reported.startedCalls.has(callId))\n return;\n const command = projectToolCommand?.({ name, input });\n events.push({\n type: \"operation.started\",\n operationId: callId,\n operation: {\n kind: \"tool\",\n name,\n input,\n ...(command === undefined ? {} : { command }),\n },\n });\n reported.startedCalls.add(callId);\n };\n if (part.state === \"output-available\") {\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", output: part.output as JsonValue, status: \"completed\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"output-error\") {\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", output: part.errorText, status: \"failed\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"output-denied\" ||\n (part.state === \"approval-responded\" && part.approval?.approved === false)) {\n // 拒绝的调用从没真正执行,协议里不会再有它的任何帧 —— 在裁决落地的这一轮合成。\n start();\n events.push({ type: \"operation.finished\", operationId: callId, kind: \"tool\", status: \"rejected\" });\n reported.finishedCalls.add(callId);\n }\n else if (part.state === \"approval-requested\") {\n start();\n }\n // input-* 中间态还没有可信的完整入参,等 approval-requested 或终态再报。\n }\n const newText = fullText.slice(reported.textLen);\n if (newText.trim())\n events.push({ type: \"message\", role: \"assistant\", text: newText });\n reported.textLen = fullText.length;\n return events;\n}\n// ───────────────────────── 工厂 ─────────────────────────\nexport interface UiMessageStreamAgentOptions {\n /** agent 名(报告 / 结果聚合的身份)。默认 \"ui-message-stream\"。 */\n name?: string;\n /** 被测应用的 chat 端点(完整 URL,应用在哪部署就指哪);函数形式每轮解析。 */\n url: string | ((ctx: AgentContext) => string | Promise<string>);\n /** 附加请求头(鉴权等);`ctx.telemetry.headers`(traceparent)总会自动并入。 */\n headers?: globalThis.Record<string, string> | ((ctx: AgentContext) => globalThis.Record<string, string>);\n /** 除 `messages` 外并入请求体的字段,如 `(ctx) => ({ model: ctx.model })`(undefined 字段序列化时自动丢弃)。 */\n body?: (ctx: AgentContext) => globalThis.Record<string, JsonValue | undefined>;\n /**\n * 由 endpoint owner 逐笔把逻辑工具调用分类为 command 或 not-command。\n * 未知调用返回 undefined 并保持 actions coverage partial;NiceEval 不按名称或 input 猜测。\n */\n projectToolCommand?: (tool: Readonly<{\n name: string;\n input: JsonValue;\n }>) => CommandProjection | undefined;\n /**\n * 拒绝审批时随 `approval-responded` 带出的理由。应用/SDK 会把它作为模型看到的工具结果\n * 文本 —— 写清楚「不要重试」能明显降低模型原样重发同一调用的概率(实测)。\n */\n denyReason?: string;\n /** 流结束后再等这么久才返回(毫秒),给应用侧的观测导出(如 BatchSpanProcessor)留时间。 */\n settleMs?: number;\n /** 应用有 OTel 时的端点投递方式(拿瀑布图);事件流不依赖它。 */\n tracing?: AgentTracing;\n /** 应用有 OTel 时的 span 归一函数(拿瀑布图);事件流不依赖它。 */\n spanMapper?: SpanMapper;\n}\nconst DEFAULT_DENY_REASON = \"用户拒绝了这次调用,不要重试,直接告知用户操作未执行。\";\ninterface PreparedUiMessageStreamSend {\n readonly bookkeeping: UiMessageSessionState;\n readonly messagesToSend: UIMessageLike[];\n readonly resumeFrom: UIMessageLike | undefined;\n}\n/** External SDK / transport Promise boundary. */\nfunction promiseEffect<Value>(run: (signal: AbortSignal) => PromiseLike<Value>): Effect.Effect<Value, unknown> {\n return Effect.tryPromise({ try: run, catch: (cause) => cause });\n}\nfunction resolveUrlEffect(options: UiMessageStreamAgentOptions, ctx: AgentContext): Effect.Effect<string, unknown> {\n const url = options.url;\n return typeof url === \"function\"\n ? promiseEffect(() => Promise.resolve(url(ctx)))\n : Effect.succeed(url);\n}\nfunction resolveHeadersEffect(options: UiMessageStreamAgentOptions, ctx: AgentContext): Effect.Effect<globalThis.Record<string, string>, unknown> {\n return Effect.try({\n try: () => typeof options.headers === \"function\" ? options.headers(ctx) : (options.headers ?? {}),\n catch: (cause) => cause,\n });\n}\nfunction transportController() {\n return Effect.acquireRelease(Effect.sync(() => new AbortController()), (controller) => Effect.sync(() => controller.abort()));\n}\nfunction cancelReadableStreamEffect<Value>(stream: ReadableStream<Value>): Effect.Effect<void> {\n return promiseEffect(() => stream.cancel()).pipe(Effect.catch(() => Effect.void), Effect.asVoid);\n}\nfunction prepareMessages(options: UiMessageStreamAgentOptions, input: TurnInput, ctx: AgentContext): PreparedUiMessageStreamSend {\n // 会话续接是「客户端带全量历史」模式:历史与协议簿记各用一个 typed slot,\n // 新线自然两者都为空;相同名字不会让其它 Adapter 的 slot 与它们碰撞。\n const priorMessages = ctx.session.get(historySlot) ?? [];\n const bookkeeping = ctx.session.get(sessionStateSlot) ?? {};\n ctx.session.set(sessionStateSlot, bookkeeping);\n let id = bookkeeping.chatId;\n if (!id) {\n id = `uims-${randomUUID()}`;\n bookkeeping.chatId = id;\n ctx.session.capture(id); // 镜像:t.sessionId / 报告可见\n }\n const lastMessage = priorMessages.at(-1);\n const pendingPart = lastMessage?.role === \"assistant\" ? lastMessage.parts.find(isApprovalRequested) : undefined;\n if (pendingPart && lastMessage) {\n // HITL 续跑:不追加新 user 消息 —— 把停在 approval-requested 的 part 原地改成\n // approval-responded,原样重发,服务端续跑同一条被打断的 assistant 消息。\n // 裁决按 requestId 从 input.responses 对位读取(t.respond 的结构化回答)。\n const requestId = pendingPart.approval?.id ?? pendingPart.toolCallId;\n const approved = approvalDecision(input.responses, requestId);\n const mutatedParts = lastMessage.parts.map((part) => isApprovalRequested(part) && part.approval?.id === pendingPart.approval?.id\n ? {\n ...part,\n state: \"approval-responded\",\n approval: {\n id: pendingPart.approval!.id,\n approved,\n ...(approved ? {} : { reason: options.denyReason ?? DEFAULT_DENY_REASON }),\n },\n }\n : part);\n const resumeFrom = { ...lastMessage, parts: mutatedParts };\n return {\n bookkeeping,\n resumeFrom,\n messagesToSend: [...priorMessages.slice(0, -1), resumeFrom],\n };\n }\n const parts: UIMessagePartLike[] = [{ type: \"text\", text: input.text }];\n for (const file of input.files ?? []) {\n parts.push({ type: \"file\", mediaType: file.mimeType, url: `data:${file.mimeType};base64,${file.dataBase64}` });\n }\n return {\n bookkeeping,\n resumeFrom: undefined,\n messagesToSend: [...priorMessages, { id: randomUUID(), role: \"user\", parts }],\n };\n}\n/** Consume the SDK's native async iterator only inside its named Effect Promise boundary. */\nfunction reduceUiMessageStreamEffect(readUIMessageStream: ReadUIMessageStream, resumeFrom: UIMessageLike | undefined, stream: ReadableStream<UIMessageChunkLike>, transport: AbortController, onMessage: (message: UIMessageLike) => void): Effect.Effect<UIMessageLike | undefined, unknown> {\n return promiseEffect(async (signal) => {\n const onAbort = () => transport.abort(signal.reason);\n signal.addEventListener(\"abort\", onAbort, { once: true });\n if (signal.aborted)\n onAbort();\n try {\n let finalMessage: UIMessageLike | undefined;\n for await (const message of readUIMessageStream({ message: resumeFrom, stream })) {\n finalMessage = message;\n onMessage(message);\n }\n return finalMessage;\n }\n finally {\n signal.removeEventListener(\"abort\", onAbort);\n }\n });\n}\nfunction uiMessageStreamSendEffect(options: UiMessageStreamAgentOptions, input: TurnInput, ctx: AgentContext): Effect.Effect<import(\"../types.ts\").Turn, unknown> {\n return Effect.scoped(Effect.gen(function* () {\n const { readUIMessageStream } = yield* loadAiEffect();\n const prepared = yield* Effect.try({\n try: () => prepareMessages(options, input, ctx),\n catch: (cause) => cause,\n });\n const url = yield* resolveUrlEffect(options, ctx);\n const extraHeaders = yield* resolveHeadersEffect(options, ctx);\n const transport = yield* transportController();\n const res = yield* Effect.tryPromise({\n try: (signal) => fetch(url, {\n method: \"POST\",\n // traceparent 随请求带过去:应用埋点支持 context 传播时,span 归属精确到本轮。\n headers: { \"content-type\": \"application/json\", ...extraHeaders, ...ctx.telemetry?.headers },\n body: JSON.stringify({ ...options.body?.(ctx), messages: prepared.messagesToSend }),\n signal: AbortSignal.any([ctx.signal, signal, transport.signal]),\n }),\n catch: (err) => {\n if (ctx.signal.aborted)\n return err;\n const cause = err instanceof Error\n ? (err.cause instanceof Error ? err.cause.message : err.message)\n : String(err);\n return makeSendFailure({\n acceptance: \"unknown\",\n message: `Could not connect to ${url} (${cause}). Is the app under test running? Start it yourself first, or point url at a deployed instance via config.`,\n cause: normalizeExternalCause(err),\n });\n },\n });\n const responseBody = res.body;\n if (!res.ok || !responseBody) {\n const responseText = yield* promiseEffect(() => res.text()).pipe(Effect.catch(() => Effect.succeed(\"\")));\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: `POST ${url} failed: ${res.status} ${responseText}. Confirm the app is running and the endpoint speaks the UI Message Stream protocol (the backend useChat expects).`,\n cause: normalizeExternalCause({ status: res.status }),\n }));\n }\n const streamState: {\n sawDone: boolean;\n sawError: string | undefined;\n } = {\n sawDone: false,\n sawError: undefined,\n };\n const chunkStream = toChunkStream(responseBody, (chunk) => {\n if (chunk.type === \"error\")\n streamState.sawError = chunk.errorText;\n }, () => {\n streamState.sawDone = true;\n });\n yield* Effect.addFinalizer(() => Effect.sync(() => transport.abort()).pipe(Effect.andThen(cancelReadableStreamEffect(chunkStream))));\n const reported: ReportedState = prepared.resumeFrom && prepared.bookkeeping.reported\n ? prepared.bookkeeping.reported\n : { startedCalls: new Set(), finishedCalls: new Set(), liveProgressCalls: new Set(), textLen: 0 };\n prepared.bookkeeping.reported = reported;\n const finalMessage = yield* reduceUiMessageStreamEffect(readUIMessageStream, prepared.resumeFrom, chunkStream, transport, (message) => reportLiveToolProgress(message, reported, ctx));\n if (!streamState.sawDone) {\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: `POST ${url} ended before the UI Message Stream [DONE] marker. The response was truncated or the endpoint does not speak the complete UI Message Stream protocol.`,\n }));\n }\n if (!finalMessage) {\n return yield* Effect.fail(makeSendFailure({\n acceptance: \"unknown\",\n message: streamState.sawError !== undefined && streamState.sawError.trim() !== \"\"\n ? streamState.sawError\n : `POST ${url} ended without producing an assistant message. Confirm the endpoint speaks the complete UI Message Stream protocol.`,\n }));\n }\n const derived = yield* Effect.try({\n try: () => {\n // 续跑轮:finalMessage 是同一条消息的完整版,替换末尾半成品;全新轮:追加。\n ctx.session.set(historySlot, prepared.resumeFrom\n ? [...prepared.messagesToSend.slice(0, -1), finalMessage]\n : [...prepared.messagesToSend, finalMessage]);\n return {\n events: deriveTurnEvents(finalMessage, reported, options.projectToolCommand),\n request: finalMessage.parts.find(isApprovalRequested),\n };\n },\n catch: (cause) => cause,\n });\n const request = derived.request;\n if (request) {\n return yield* Effect.try({\n try: () => {\n const waitingEvents = [\n ...derived.events,\n {\n type: \"input.requested\" as const,\n request: {\n id: request.approval?.id ?? request.toolCallId,\n action: toolNameOf(request),\n input: (request.input ?? null) as JsonValue,\n options: [{ id: \"approve\" }, { id: \"deny\" }],\n },\n },\n ];\n const evidenceCoverage = unclassifiedToolActionsCoverage(waitingEvents);\n return {\n status: \"waiting\" as const,\n events: waitingEvents,\n ...(evidenceCoverage === undefined ? {} : { evidenceCoverage }),\n };\n },\n catch: (cause) => cause,\n });\n }\n if (options.settleMs)\n yield* Effect.sleep(options.settleMs);\n return yield* Effect.try({\n try: () => {\n const finalEvents = [\n ...derived.events,\n ...(streamState.sawError ? [{ type: \"error\" as const, message: streamState.sawError }] : []),\n ];\n const evidenceCoverage = unclassifiedToolActionsCoverage(finalEvents);\n return {\n status: streamState.sawError ? (\"failed\" as const) : (\"completed\" as const),\n events: finalEvents,\n ...(evidenceCoverage === undefined ? {} : { evidenceCoverage }),\n };\n },\n catch: (cause) => cause,\n });\n }));\n}\n/**\n * UI Message Stream Protocol(AI SDK `useChat` 后端的标准 SSE 协议)的内置无侵入 adapter。\n * 对着已部署应用的 HTTP 端点收发,不 import 应用代码:\n *\n * ```typescript\n * import { uiMessageStreamAgent } from \"niceeval/adapter\";\n *\n * export default uiMessageStreamAgent({\n * name: \"my-assistant\",\n * url: \"https://my-app.example.com/api/chat\",\n * body: (ctx) => ({ model: ctx.model }), // 应用支持请求级选模型时,模型对比零改动\n * });\n * ```\n */\nexport function uiMessageStreamAgent(options: UiMessageStreamAgentOptions): Agent {\n return makeDirectAgent({\n name: options.name ?? \"ui-message-stream\",\n evidenceCoverage: COVERAGE,\n tracing: options.tracing,\n spanMapper: options.spanMapper,\n send: (input, ctx) => uiMessageStreamSendEffect(options, input, ctx),\n });\n}\n"]}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DebugPlanDocumentSchema = void 0;
|
|
4
|
+
exports.decodeDebugPlanDocument = decodeDebugPlanDocument;
|
|
5
|
+
const effect_1 = require("effect");
|
|
6
|
+
const json_value_ts_1 = require("../../../shared/json-value.cjs");
|
|
7
|
+
const OwnerSchema = effect_1.Schema.Struct({
|
|
8
|
+
kind: effect_1.Schema.Literals(["eval", "eval-group", "experiment", "agent", "provider"]),
|
|
9
|
+
id: effect_1.Schema.String,
|
|
10
|
+
index: effect_1.Schema.optional(effect_1.Schema.Number),
|
|
11
|
+
});
|
|
12
|
+
const ScheduleOwnerSchema = effect_1.Schema.Union([
|
|
13
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literals(["eval", "eval-group", "experiment"]), id: effect_1.Schema.String }),
|
|
14
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("agent"), id: effect_1.Schema.String }),
|
|
15
|
+
]);
|
|
16
|
+
const ReasonSchema = effect_1.Schema.Struct({ code: effect_1.Schema.String, summary: effect_1.Schema.String });
|
|
17
|
+
const ConditionSchema = ReasonSchema;
|
|
18
|
+
const ActionStateSchema = effect_1.Schema.Literals(["all", "dockerData"]);
|
|
19
|
+
const JsonValueSchema = effect_1.Schema.declare(json_value_ts_1.isJsonValue);
|
|
20
|
+
const LocatorFieldNameSchema = effect_1.Schema.Literals([
|
|
21
|
+
"image",
|
|
22
|
+
"context",
|
|
23
|
+
"file",
|
|
24
|
+
"target",
|
|
25
|
+
"workspaceService",
|
|
26
|
+
"template",
|
|
27
|
+
"snapshotId",
|
|
28
|
+
"dir",
|
|
29
|
+
]);
|
|
30
|
+
const LocatorFieldSchema = effect_1.Schema.Struct({ name: LocatorFieldNameSchema, value: effect_1.Schema.String });
|
|
31
|
+
const LocatorSchema = effect_1.Schema.Union([
|
|
32
|
+
effect_1.Schema.Struct({ _tag: effect_1.Schema.Literal("Exact"), fields: effect_1.Schema.NonEmptyArray(LocatorFieldSchema) }),
|
|
33
|
+
effect_1.Schema.Struct({
|
|
34
|
+
_tag: effect_1.Schema.Literal("Redacted"),
|
|
35
|
+
fields: effect_1.Schema.NonEmptyArray(LocatorFieldSchema),
|
|
36
|
+
redactions: effect_1.Schema.Array(effect_1.Schema.Struct({
|
|
37
|
+
field: LocatorFieldNameSchema,
|
|
38
|
+
parts: effect_1.Schema.Array(effect_1.Schema.Literals(["userinfo", "query", "fragment"])),
|
|
39
|
+
})),
|
|
40
|
+
}),
|
|
41
|
+
effect_1.Schema.Struct({ _tag: effect_1.Schema.Literal("Opaque"), reason: ReasonSchema }),
|
|
42
|
+
]);
|
|
43
|
+
const CommandSchema = effect_1.Schema.Union([
|
|
44
|
+
effect_1.Schema.Struct({
|
|
45
|
+
kind: effect_1.Schema.Literal("argv"),
|
|
46
|
+
executable: effect_1.Schema.String,
|
|
47
|
+
args: effect_1.Schema.Array(effect_1.Schema.String),
|
|
48
|
+
cwd: effect_1.Schema.optional(effect_1.Schema.String),
|
|
49
|
+
user: effect_1.Schema.optional(effect_1.Schema.String),
|
|
50
|
+
timeoutMs: effect_1.Schema.optional(effect_1.Schema.Number),
|
|
51
|
+
envKeys: effect_1.Schema.optional(effect_1.Schema.Array(effect_1.Schema.String)),
|
|
52
|
+
}),
|
|
53
|
+
effect_1.Schema.Struct({
|
|
54
|
+
kind: effect_1.Schema.Literal("shell"),
|
|
55
|
+
script: effect_1.Schema.String,
|
|
56
|
+
cwd: effect_1.Schema.optional(effect_1.Schema.String),
|
|
57
|
+
user: effect_1.Schema.optional(effect_1.Schema.String),
|
|
58
|
+
timeoutMs: effect_1.Schema.optional(effect_1.Schema.Number),
|
|
59
|
+
envKeys: effect_1.Schema.optional(effect_1.Schema.Array(effect_1.Schema.String)),
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
const ActionStepSchema = effect_1.Schema.Union([
|
|
63
|
+
effect_1.Schema.Struct({
|
|
64
|
+
kind: effect_1.Schema.Literal("exec"),
|
|
65
|
+
executable: effect_1.Schema.String,
|
|
66
|
+
args: effect_1.Schema.Array(effect_1.Schema.String),
|
|
67
|
+
cwd: effect_1.Schema.optional(effect_1.Schema.String),
|
|
68
|
+
user: effect_1.Schema.optional(effect_1.Schema.String),
|
|
69
|
+
timeoutMs: effect_1.Schema.optional(effect_1.Schema.Number),
|
|
70
|
+
envKeys: effect_1.Schema.optional(effect_1.Schema.Array(effect_1.Schema.String)),
|
|
71
|
+
stdinDigest: effect_1.Schema.optional(effect_1.Schema.String),
|
|
72
|
+
stdinBytes: effect_1.Schema.optional(effect_1.Schema.Number),
|
|
73
|
+
}),
|
|
74
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("putText"), path: effect_1.Schema.String, digest: effect_1.Schema.String, bytes: effect_1.Schema.Number }),
|
|
75
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("putBytes"), path: effect_1.Schema.String, digest: effect_1.Schema.String, bytes: effect_1.Schema.Number }),
|
|
76
|
+
effect_1.Schema.Struct({
|
|
77
|
+
kind: effect_1.Schema.Literals(["transferFile", "transferDirectory"]),
|
|
78
|
+
source: effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("content"), digest: effect_1.Schema.String }),
|
|
79
|
+
to: effect_1.Schema.String,
|
|
80
|
+
}),
|
|
81
|
+
effect_1.Schema.Struct({
|
|
82
|
+
kind: effect_1.Schema.Literal("checkoutGit"),
|
|
83
|
+
repository: effect_1.Schema.String,
|
|
84
|
+
ref: effect_1.Schema.String,
|
|
85
|
+
to: effect_1.Schema.String,
|
|
86
|
+
sparse: effect_1.Schema.optional(effect_1.Schema.Struct({ include: effect_1.Schema.Array(effect_1.Schema.String), exclude: effect_1.Schema.Array(effect_1.Schema.String) })),
|
|
87
|
+
}),
|
|
88
|
+
]);
|
|
89
|
+
const ActionSchema = effect_1.Schema.Union([
|
|
90
|
+
effect_1.Schema.Struct({
|
|
91
|
+
id: effect_1.Schema.String,
|
|
92
|
+
family: effect_1.Schema.String,
|
|
93
|
+
state: ActionStateSchema,
|
|
94
|
+
input: JsonValueSchema,
|
|
95
|
+
steps: effect_1.Schema.Array(ActionStepSchema),
|
|
96
|
+
fingerprint: effect_1.Schema.Struct({ automatic: effect_1.Schema.String, supplemental: effect_1.Schema.String, combined: effect_1.Schema.String }),
|
|
97
|
+
kind: effect_1.Schema.optional(effect_1.Schema.Literals(["action", "command"])),
|
|
98
|
+
}),
|
|
99
|
+
effect_1.Schema.Struct({ id: effect_1.Schema.String, kind: effect_1.Schema.Literals(["command", "callback"]) }),
|
|
100
|
+
]);
|
|
101
|
+
const CacheEligibilitySchema = effect_1.Schema.Union([
|
|
102
|
+
effect_1.Schema.Struct({ status: effect_1.Schema.Literal("eligible") }),
|
|
103
|
+
effect_1.Schema.Struct({
|
|
104
|
+
status: effect_1.Schema.Literal("ineligible"),
|
|
105
|
+
reason: effect_1.Schema.Struct({
|
|
106
|
+
code: effect_1.Schema.Literals([
|
|
107
|
+
"opaque-action",
|
|
108
|
+
"opaque-ancestor",
|
|
109
|
+
"provider-unsupported",
|
|
110
|
+
"unsupported-state",
|
|
111
|
+
"unsupported-state-ancestor",
|
|
112
|
+
]),
|
|
113
|
+
}),
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
const CacheSchema = effect_1.Schema.Struct({
|
|
117
|
+
lookup: effect_1.Schema.Literal("not-probed"),
|
|
118
|
+
capability: effect_1.Schema.Literals(["persistent", "invocation-local", "unsupported"]),
|
|
119
|
+
prefixIdentity: effect_1.Schema.optional(effect_1.Schema.String),
|
|
120
|
+
capabilityReason: effect_1.Schema.optional(effect_1.Schema.String),
|
|
121
|
+
runtime: effect_1.Schema.Struct({ status: effect_1.Schema.Literal("pending"), finalKey: effect_1.Schema.Literal("not-probed") }),
|
|
122
|
+
eligibility: CacheEligibilitySchema,
|
|
123
|
+
state: effect_1.Schema.Struct({
|
|
124
|
+
declared: effect_1.Schema.Union([ActionStateSchema, effect_1.Schema.Literal("opaque")]),
|
|
125
|
+
cumulative: effect_1.Schema.Union([ActionStateSchema, effect_1.Schema.Literal("opaque")]),
|
|
126
|
+
providerCoverage: effect_1.Schema.Union([ActionStateSchema, effect_1.Schema.Literal("unsupported")]),
|
|
127
|
+
barrier: effect_1.Schema.Literals([
|
|
128
|
+
"none",
|
|
129
|
+
"opaque-action",
|
|
130
|
+
"opaque-ancestor",
|
|
131
|
+
"provider-unsupported",
|
|
132
|
+
"unsupported-state",
|
|
133
|
+
"unsupported-state-ancestor",
|
|
134
|
+
]),
|
|
135
|
+
barrierActionId: effect_1.Schema.optional(effect_1.Schema.String),
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
const CommandPlanStepSchema = effect_1.Schema.suspend(() => effect_1.Schema.Struct({
|
|
139
|
+
phase: effect_1.Schema.String,
|
|
140
|
+
label: effect_1.Schema.optional(effect_1.Schema.String),
|
|
141
|
+
owner: effect_1.Schema.optional(OwnerSchema),
|
|
142
|
+
truth: effect_1.Schema.Literals(["exact", "conditional", "opaque", "known-no-command"]),
|
|
143
|
+
condition: effect_1.Schema.optional(ConditionSchema),
|
|
144
|
+
reason: effect_1.Schema.optional(ReasonSchema),
|
|
145
|
+
template: effect_1.Schema.optional(effect_1.Schema.Struct({
|
|
146
|
+
owner: OwnerSchema,
|
|
147
|
+
provider: effect_1.Schema.String,
|
|
148
|
+
kind: effect_1.Schema.String,
|
|
149
|
+
locator: LocatorSchema,
|
|
150
|
+
})),
|
|
151
|
+
redactions: effect_1.Schema.optional(effect_1.Schema.Array(effect_1.Schema.Literals([
|
|
152
|
+
"env-values",
|
|
153
|
+
"header-values",
|
|
154
|
+
"stdin",
|
|
155
|
+
"sensitive-values",
|
|
156
|
+
"command",
|
|
157
|
+
]))),
|
|
158
|
+
command: effect_1.Schema.optional(CommandSchema),
|
|
159
|
+
children: effect_1.Schema.optional(effect_1.Schema.Array(CommandPlanStepSchema)),
|
|
160
|
+
action: effect_1.Schema.optional(ActionSchema),
|
|
161
|
+
declarationOrder: effect_1.Schema.optional(effect_1.Schema.Struct({ owner: ScheduleOwnerSchema, ordinal: effect_1.Schema.Number })),
|
|
162
|
+
executionOrder: effect_1.Schema.optional(effect_1.Schema.Struct({
|
|
163
|
+
topologicalOrdinal: effect_1.Schema.Number,
|
|
164
|
+
occurrencePath: effect_1.Schema.Array(effect_1.Schema.String),
|
|
165
|
+
})),
|
|
166
|
+
changeFrequency: effect_1.Schema.optional(effect_1.Schema.Struct({
|
|
167
|
+
value: effect_1.Schema.Number,
|
|
168
|
+
source: effect_1.Schema.Literals(["explicit", "defaulted"]),
|
|
169
|
+
preset: effect_1.Schema.optional(effect_1.Schema.Literals(["rare", "normal", "frequent"])),
|
|
170
|
+
})),
|
|
171
|
+
schedulingReason: effect_1.Schema.optional(effect_1.Schema.String),
|
|
172
|
+
dependencies: effect_1.Schema.optional(effect_1.Schema.Array(effect_1.Schema.Struct({
|
|
173
|
+
id: effect_1.Schema.String,
|
|
174
|
+
source: effect_1.Schema.Literals(["explicit", "capability"]),
|
|
175
|
+
capability: effect_1.Schema.optional(effect_1.Schema.String),
|
|
176
|
+
}))),
|
|
177
|
+
occurrence: effect_1.Schema.optional(effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("attempt") })),
|
|
178
|
+
cache: effect_1.Schema.optional(CacheSchema),
|
|
179
|
+
}));
|
|
180
|
+
const SlotSchema = effect_1.Schema.Struct({
|
|
181
|
+
evalId: effect_1.Schema.String,
|
|
182
|
+
attempt: effect_1.Schema.Number,
|
|
183
|
+
action: effect_1.Schema.Literals(["carried", "dispatch"]),
|
|
184
|
+
activation: effect_1.Schema.optional(ConditionSchema),
|
|
185
|
+
steps: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
186
|
+
});
|
|
187
|
+
const PhysicalLifecycleTemplateSchema = effect_1.Schema.Struct({
|
|
188
|
+
appliesTo: effect_1.Schema.Literal("each-physical-instance"),
|
|
189
|
+
enter: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
190
|
+
exit: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
191
|
+
});
|
|
192
|
+
const LaneSchema = effect_1.Schema.Union([
|
|
193
|
+
effect_1.Schema.Struct({
|
|
194
|
+
id: effect_1.Schema.String,
|
|
195
|
+
kind: effect_1.Schema.Literal("eval"),
|
|
196
|
+
ordering: effect_1.Schema.Literal("independent"),
|
|
197
|
+
slots: effect_1.Schema.Array(SlotSchema),
|
|
198
|
+
}),
|
|
199
|
+
effect_1.Schema.Struct({
|
|
200
|
+
id: effect_1.Schema.String,
|
|
201
|
+
kind: effect_1.Schema.Literal("sandbox-reuse"),
|
|
202
|
+
ordering: effect_1.Schema.Literal("independent"),
|
|
203
|
+
scope: effect_1.Schema.Union([
|
|
204
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("shared") }),
|
|
205
|
+
effect_1.Schema.Struct({ kind: effect_1.Schema.Literal("eval"), evalId: effect_1.Schema.String }),
|
|
206
|
+
]),
|
|
207
|
+
physicalLifecycleTemplate: effect_1.Schema.optional(PhysicalLifecycleTemplateSchema),
|
|
208
|
+
slots: effect_1.Schema.Array(SlotSchema),
|
|
209
|
+
}),
|
|
210
|
+
effect_1.Schema.Struct({
|
|
211
|
+
id: effect_1.Schema.String,
|
|
212
|
+
kind: effect_1.Schema.Literal("eval-group"),
|
|
213
|
+
ordering: effect_1.Schema.Literal("serial-normalized-eval-id"),
|
|
214
|
+
beforeSlots: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
215
|
+
afterSlots: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
216
|
+
physicalLifecycleTemplate: effect_1.Schema.optional(PhysicalLifecycleTemplateSchema),
|
|
217
|
+
slots: effect_1.Schema.Array(SlotSchema),
|
|
218
|
+
}),
|
|
219
|
+
]);
|
|
220
|
+
const CommandPlanSchema = effect_1.Schema.Struct({
|
|
221
|
+
completeness: effect_1.Schema.Literals(["complete", "partial"]),
|
|
222
|
+
opaqueCount: effect_1.Schema.Number,
|
|
223
|
+
redactedCount: effect_1.Schema.Number,
|
|
224
|
+
experiments: effect_1.Schema.Array(effect_1.Schema.Struct({
|
|
225
|
+
experimentId: effect_1.Schema.String,
|
|
226
|
+
activation: effect_1.Schema.Literals(["conditional", "inactive"]),
|
|
227
|
+
beforeLanes: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
228
|
+
lanes: effect_1.Schema.Array(LaneSchema),
|
|
229
|
+
afterLanes: effect_1.Schema.Array(CommandPlanStepSchema),
|
|
230
|
+
})),
|
|
231
|
+
});
|
|
232
|
+
const SetupPrefixPlanSchema = effect_1.Schema.Struct({
|
|
233
|
+
lookup: effect_1.Schema.Literal("not-probed"),
|
|
234
|
+
nodes: effect_1.Schema.Array(effect_1.Schema.Struct({
|
|
235
|
+
prefixIdentity: effect_1.Schema.String,
|
|
236
|
+
lookup: effect_1.Schema.Literal("not-probed"),
|
|
237
|
+
capability: effect_1.Schema.Literals(["persistent", "invocation-local", "unsupported"]),
|
|
238
|
+
eligibility: CacheEligibilitySchema,
|
|
239
|
+
consumers: effect_1.Schema.Array(effect_1.Schema.Struct({ experimentId: effect_1.Schema.String, evalId: effect_1.Schema.String })),
|
|
240
|
+
})),
|
|
241
|
+
});
|
|
242
|
+
/** Current-candidate machine document emitted by `niceeval debug --json`; it intentionally has no version envelope. */
|
|
243
|
+
exports.DebugPlanDocumentSchema = effect_1.Schema.Struct({
|
|
244
|
+
experimentId: effect_1.Schema.String,
|
|
245
|
+
evalId: effect_1.Schema.optional(effect_1.Schema.String),
|
|
246
|
+
evalIds: effect_1.Schema.Array(effect_1.Schema.String),
|
|
247
|
+
setupPrefixPlan: SetupPrefixPlanSchema,
|
|
248
|
+
commandPlan: CommandPlanSchema,
|
|
249
|
+
});
|
|
250
|
+
/** Strictly decode the current candidate's sole `niceeval debug --json` document. */
|
|
251
|
+
function decodeDebugPlanDocument(input) {
|
|
252
|
+
return effect_1.Schema.decodeUnknownSync(exports.DebugPlanDocumentSchema, {
|
|
253
|
+
errors: "all",
|
|
254
|
+
onExcessProperty: "error",
|
|
255
|
+
})(input);
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=debug-protocol.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-protocol.js","sourceRoot":"","sources":["debug-protocol.ts"],"names":[],"mappings":";;;AAyPA,0DAKC;AA9PD,mCAAgC;AAEhC,iEAA4D;AAE5D,MAAM,WAAW,GAAG,eAAM,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,eAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAChF,EAAE,EAAE,eAAM,CAAC,MAAM;IACjB,KAAK,EAAE,eAAM,CAAC,QAAQ,CAAC,eAAM,CAAC,MAAM,CAAC;CACxC,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,eAAM,CAAC,KAAK,CAAC;IACrC,eAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAM,CAAC,QAAQ,CAAC,CAAC,MAAM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,eAAe,EAAE,qBAAqB;IACtC,WAAW,EAAE,iBAAiB;CACjC,CAAC,CAAC;AAEH,qFAAqF;AACrF,SAAgB,uBAAuB,CAAC,KAAc;IAClD,OAAO,eAAM,CAAC,iBAAiB,CAAC,+BAAuB,EAAE;QACrD,MAAM,EAAE,KAAK;QACb,gBAAgB,EAAE,OAAO;KAC5B,CAAC,CAAC,KAAK,CAAC,CAAC;AACd,CAAC","sourcesContent":["import { Schema } from \"effect\";\nimport type { CommandPlan, CommandPlanStep, SetupPrefixPlan, } from \"../../../runner/command-plan.ts\";\nimport { isJsonValue } from \"../../../shared/json-value.ts\";\nimport type { JsonValue } from \"../../../shared/types.ts\";\nconst OwnerSchema = Schema.Struct({\n kind: Schema.Literals([\"eval\", \"eval-group\", \"experiment\", \"agent\", \"provider\"]),\n id: Schema.String,\n index: Schema.optional(Schema.Number),\n});\nconst ScheduleOwnerSchema = Schema.Union([\n Schema.Struct({ kind: Schema.Literals([\"eval\", \"eval-group\", \"experiment\"]), id: Schema.String }),\n Schema.Struct({ kind: Schema.Literal(\"agent\"), id: Schema.String }),\n]);\nconst ReasonSchema = Schema.Struct({ code: Schema.String, summary: Schema.String });\nconst ConditionSchema = ReasonSchema;\nconst ActionStateSchema = Schema.Literals([\"all\", \"dockerData\"]);\nconst JsonValueSchema = Schema.declare<JsonValue>(isJsonValue);\nconst LocatorFieldNameSchema = Schema.Literals([\n \"image\",\n \"context\",\n \"file\",\n \"target\",\n \"workspaceService\",\n \"template\",\n \"snapshotId\",\n \"dir\",\n]);\nconst LocatorFieldSchema = Schema.Struct({ name: LocatorFieldNameSchema, value: Schema.String });\nconst LocatorSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Exact\"), fields: Schema.NonEmptyArray(LocatorFieldSchema) }),\n Schema.Struct({\n _tag: Schema.Literal(\"Redacted\"),\n fields: Schema.NonEmptyArray(LocatorFieldSchema),\n redactions: Schema.Array(Schema.Struct({\n field: LocatorFieldNameSchema,\n parts: Schema.Array(Schema.Literals([\"userinfo\", \"query\", \"fragment\"])),\n })),\n }),\n Schema.Struct({ _tag: Schema.Literal(\"Opaque\"), reason: ReasonSchema }),\n]);\nconst CommandSchema = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"argv\"),\n executable: Schema.String,\n args: Schema.Array(Schema.String),\n cwd: Schema.optional(Schema.String),\n user: Schema.optional(Schema.String),\n timeoutMs: Schema.optional(Schema.Number),\n envKeys: Schema.optional(Schema.Array(Schema.String)),\n }),\n Schema.Struct({\n kind: Schema.Literal(\"shell\"),\n script: Schema.String,\n cwd: Schema.optional(Schema.String),\n user: Schema.optional(Schema.String),\n timeoutMs: Schema.optional(Schema.Number),\n envKeys: Schema.optional(Schema.Array(Schema.String)),\n }),\n]);\nconst ActionStepSchema = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"exec\"),\n executable: Schema.String,\n args: Schema.Array(Schema.String),\n cwd: Schema.optional(Schema.String),\n user: Schema.optional(Schema.String),\n timeoutMs: Schema.optional(Schema.Number),\n envKeys: Schema.optional(Schema.Array(Schema.String)),\n stdinDigest: Schema.optional(Schema.String),\n stdinBytes: Schema.optional(Schema.Number),\n }),\n Schema.Struct({ kind: Schema.Literal(\"putText\"), path: Schema.String, digest: Schema.String, bytes: Schema.Number }),\n Schema.Struct({ kind: Schema.Literal(\"putBytes\"), path: Schema.String, digest: Schema.String, bytes: Schema.Number }),\n Schema.Struct({\n kind: Schema.Literals([\"transferFile\", \"transferDirectory\"]),\n source: Schema.Struct({ kind: Schema.Literal(\"content\"), digest: Schema.String }),\n to: Schema.String,\n }),\n Schema.Struct({\n kind: Schema.Literal(\"checkoutGit\"),\n repository: Schema.String,\n ref: Schema.String,\n to: Schema.String,\n sparse: Schema.optional(Schema.Struct({ include: Schema.Array(Schema.String), exclude: Schema.Array(Schema.String) })),\n }),\n]);\nconst ActionSchema = Schema.Union([\n Schema.Struct({\n id: Schema.String,\n family: Schema.String,\n state: ActionStateSchema,\n input: JsonValueSchema,\n steps: Schema.Array(ActionStepSchema),\n fingerprint: Schema.Struct({ automatic: Schema.String, supplemental: Schema.String, combined: Schema.String }),\n kind: Schema.optional(Schema.Literals([\"action\", \"command\"])),\n }),\n Schema.Struct({ id: Schema.String, kind: Schema.Literals([\"command\", \"callback\"]) }),\n]);\nconst CacheEligibilitySchema = Schema.Union([\n Schema.Struct({ status: Schema.Literal(\"eligible\") }),\n Schema.Struct({\n status: Schema.Literal(\"ineligible\"),\n reason: Schema.Struct({\n code: Schema.Literals([\n \"opaque-action\",\n \"opaque-ancestor\",\n \"provider-unsupported\",\n \"unsupported-state\",\n \"unsupported-state-ancestor\",\n ]),\n }),\n }),\n]);\nconst CacheSchema = Schema.Struct({\n lookup: Schema.Literal(\"not-probed\"),\n capability: Schema.Literals([\"persistent\", \"invocation-local\", \"unsupported\"]),\n prefixIdentity: Schema.optional(Schema.String),\n capabilityReason: Schema.optional(Schema.String),\n runtime: Schema.Struct({ status: Schema.Literal(\"pending\"), finalKey: Schema.Literal(\"not-probed\") }),\n eligibility: CacheEligibilitySchema,\n state: Schema.Struct({\n declared: Schema.Union([ActionStateSchema, Schema.Literal(\"opaque\")]),\n cumulative: Schema.Union([ActionStateSchema, Schema.Literal(\"opaque\")]),\n providerCoverage: Schema.Union([ActionStateSchema, Schema.Literal(\"unsupported\")]),\n barrier: Schema.Literals([\n \"none\",\n \"opaque-action\",\n \"opaque-ancestor\",\n \"provider-unsupported\",\n \"unsupported-state\",\n \"unsupported-state-ancestor\",\n ]),\n barrierActionId: Schema.optional(Schema.String),\n }),\n});\nconst CommandPlanStepSchema: Schema.Codec<CommandPlanStep> = Schema.suspend(() => Schema.Struct({\n phase: Schema.String,\n label: Schema.optional(Schema.String),\n owner: Schema.optional(OwnerSchema),\n truth: Schema.Literals([\"exact\", \"conditional\", \"opaque\", \"known-no-command\"]),\n condition: Schema.optional(ConditionSchema),\n reason: Schema.optional(ReasonSchema),\n template: Schema.optional(Schema.Struct({\n owner: OwnerSchema,\n provider: Schema.String,\n kind: Schema.String,\n locator: LocatorSchema,\n })),\n redactions: Schema.optional(Schema.Array(Schema.Literals([\n \"env-values\",\n \"header-values\",\n \"stdin\",\n \"sensitive-values\",\n \"command\",\n ]))),\n command: Schema.optional(CommandSchema),\n children: Schema.optional(Schema.Array(CommandPlanStepSchema)),\n action: Schema.optional(ActionSchema),\n declarationOrder: Schema.optional(Schema.Struct({ owner: ScheduleOwnerSchema, ordinal: Schema.Number })),\n executionOrder: Schema.optional(Schema.Struct({\n topologicalOrdinal: Schema.Number,\n occurrencePath: Schema.Array(Schema.String),\n })),\n changeFrequency: Schema.optional(Schema.Struct({\n value: Schema.Number,\n source: Schema.Literals([\"explicit\", \"defaulted\"]),\n preset: Schema.optional(Schema.Literals([\"rare\", \"normal\", \"frequent\"])),\n })),\n schedulingReason: Schema.optional(Schema.String),\n dependencies: Schema.optional(Schema.Array(Schema.Struct({\n id: Schema.String,\n source: Schema.Literals([\"explicit\", \"capability\"]),\n capability: Schema.optional(Schema.String),\n }))),\n occurrence: Schema.optional(Schema.Struct({ kind: Schema.Literal(\"attempt\") })),\n cache: Schema.optional(CacheSchema),\n}));\nconst SlotSchema = Schema.Struct({\n evalId: Schema.String,\n attempt: Schema.Number,\n action: Schema.Literals([\"carried\", \"dispatch\"]),\n activation: Schema.optional(ConditionSchema),\n steps: Schema.Array(CommandPlanStepSchema),\n});\nconst PhysicalLifecycleTemplateSchema = Schema.Struct({\n appliesTo: Schema.Literal(\"each-physical-instance\"),\n enter: Schema.Array(CommandPlanStepSchema),\n exit: Schema.Array(CommandPlanStepSchema),\n});\nconst LaneSchema = Schema.Union([\n Schema.Struct({\n id: Schema.String,\n kind: Schema.Literal(\"eval\"),\n ordering: Schema.Literal(\"independent\"),\n slots: Schema.Array(SlotSchema),\n }),\n Schema.Struct({\n id: Schema.String,\n kind: Schema.Literal(\"sandbox-reuse\"),\n ordering: Schema.Literal(\"independent\"),\n scope: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"shared\") }),\n Schema.Struct({ kind: Schema.Literal(\"eval\"), evalId: Schema.String }),\n ]),\n physicalLifecycleTemplate: Schema.optional(PhysicalLifecycleTemplateSchema),\n slots: Schema.Array(SlotSchema),\n }),\n Schema.Struct({\n id: Schema.String,\n kind: Schema.Literal(\"eval-group\"),\n ordering: Schema.Literal(\"serial-normalized-eval-id\"),\n beforeSlots: Schema.Array(CommandPlanStepSchema),\n afterSlots: Schema.Array(CommandPlanStepSchema),\n physicalLifecycleTemplate: Schema.optional(PhysicalLifecycleTemplateSchema),\n slots: Schema.Array(SlotSchema),\n }),\n]);\nconst CommandPlanSchema: Schema.Codec<CommandPlan> = Schema.Struct({\n completeness: Schema.Literals([\"complete\", \"partial\"]),\n opaqueCount: Schema.Number,\n redactedCount: Schema.Number,\n experiments: Schema.Array(Schema.Struct({\n experimentId: Schema.String,\n activation: Schema.Literals([\"conditional\", \"inactive\"]),\n beforeLanes: Schema.Array(CommandPlanStepSchema),\n lanes: Schema.Array(LaneSchema),\n afterLanes: Schema.Array(CommandPlanStepSchema),\n })),\n});\nconst SetupPrefixPlanSchema: Schema.Codec<SetupPrefixPlan> = Schema.Struct({\n lookup: Schema.Literal(\"not-probed\"),\n nodes: Schema.Array(Schema.Struct({\n prefixIdentity: Schema.String,\n lookup: Schema.Literal(\"not-probed\"),\n capability: Schema.Literals([\"persistent\", \"invocation-local\", \"unsupported\"]),\n eligibility: CacheEligibilitySchema,\n consumers: Schema.Array(Schema.Struct({ experimentId: Schema.String, evalId: Schema.String })),\n })),\n});\n/** Current-candidate machine document emitted by `niceeval debug --json`; it intentionally has no version envelope. */\nexport const DebugPlanDocumentSchema = Schema.Struct({\n experimentId: Schema.String,\n evalId: Schema.optional(Schema.String),\n evalIds: Schema.Array(Schema.String),\n setupPrefixPlan: SetupPrefixPlanSchema,\n commandPlan: CommandPlanSchema,\n});\nexport type DebugPlanDocument = Schema.Schema.Type<typeof DebugPlanDocumentSchema>;\n/** Strictly decode the current candidate's sole `niceeval debug --json` document. */\nexport function decodeDebugPlanDocument(input: unknown): DebugPlanDocument {\n return Schema.decodeUnknownSync(DebugPlanDocumentSchema, {\n errors: \"all\",\n onExcessProperty: \"error\",\n })(input);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { CommandPlan, SetupPrefixPlan } from "../../../runner/command-plan.cjs";
|
|
3
|
+
/** Current-candidate machine document emitted by `niceeval debug --json`; it intentionally has no version envelope. */
|
|
4
|
+
export declare const DebugPlanDocumentSchema: Schema.Struct<{
|
|
5
|
+
readonly experimentId: Schema.String;
|
|
6
|
+
readonly evalId: Schema.optional<Schema.String>;
|
|
7
|
+
readonly evalIds: Schema.$Array<Schema.String>;
|
|
8
|
+
readonly setupPrefixPlan: Schema.Codec<SetupPrefixPlan, SetupPrefixPlan, never, never>;
|
|
9
|
+
readonly commandPlan: Schema.Codec<CommandPlan, CommandPlan, never, never>;
|
|
10
|
+
}>;
|
|
11
|
+
export type DebugPlanDocument = Schema.Schema.Type<typeof DebugPlanDocumentSchema>;
|
|
12
|
+
/** Strictly decode the current candidate's sole `niceeval debug --json` document. */
|
|
13
|
+
export declare function decodeDebugPlanDocument(input: unknown): DebugPlanDocument;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { CommandPlan, SetupPrefixPlan } from "../../../runner/command-plan.mjs";
|
|
3
|
+
/** Current-candidate machine document emitted by `niceeval debug --json`; it intentionally has no version envelope. */
|
|
4
|
+
export declare const DebugPlanDocumentSchema: Schema.Struct<{
|
|
5
|
+
readonly experimentId: Schema.String;
|
|
6
|
+
readonly evalId: Schema.optional<Schema.String>;
|
|
7
|
+
readonly evalIds: Schema.$Array<Schema.String>;
|
|
8
|
+
readonly setupPrefixPlan: Schema.Codec<SetupPrefixPlan, SetupPrefixPlan, never, never>;
|
|
9
|
+
readonly commandPlan: Schema.Codec<CommandPlan, CommandPlan, never, never>;
|
|
10
|
+
}>;
|
|
11
|
+
export type DebugPlanDocument = Schema.Schema.Type<typeof DebugPlanDocumentSchema>;
|
|
12
|
+
/** Strictly decode the current candidate's sole `niceeval debug --json` document. */
|
|
13
|
+
export declare function decodeDebugPlanDocument(input: unknown): DebugPlanDocument;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { CommandPlan, SetupPrefixPlan } from "../../../runner/command-plan.js";
|
|
3
|
+
/** Current-candidate machine document emitted by `niceeval debug --json`; it intentionally has no version envelope. */
|
|
4
|
+
export declare const DebugPlanDocumentSchema: Schema.Struct<{
|
|
5
|
+
readonly experimentId: Schema.String;
|
|
6
|
+
readonly evalId: Schema.optional<Schema.String>;
|
|
7
|
+
readonly evalIds: Schema.$Array<Schema.String>;
|
|
8
|
+
readonly setupPrefixPlan: Schema.Codec<SetupPrefixPlan, SetupPrefixPlan, never, never>;
|
|
9
|
+
readonly commandPlan: Schema.Codec<CommandPlan, CommandPlan, never, never>;
|
|
10
|
+
}>;
|
|
11
|
+
export type DebugPlanDocument = Schema.Schema.Type<typeof DebugPlanDocumentSchema>;
|
|
12
|
+
/** Strictly decode the current candidate's sole `niceeval debug --json` document. */
|
|
13
|
+
export declare function decodeDebugPlanDocument(input: unknown): DebugPlanDocument;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __niceevalCreateRequire } from "node:module";
|
|
2
|
+
const __niceevalRequire = __niceevalCreateRequire(import.meta.url);
|
|
3
|
+
const __niceevalCanonical = __niceevalRequire("./debug-protocol.cjs");
|
|
4
|
+
const __niceevalExport0 = __niceevalCanonical["DebugPlanDocumentSchema"];
|
|
5
|
+
export { __niceevalExport0 as DebugPlanDocumentSchema };
|
|
6
|
+
const __niceevalExport1 = __niceevalCanonical["decodeDebugPlanDocument"];
|
|
7
|
+
export { __niceevalExport1 as decodeDebugPlanDocument };
|
|
8
|
+
//# sourceMappingURL=debug-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-protocol.js","sources":[],"names":[],"mappings":""}
|