@twelvehart/orcats 0.0.0-seed.0 → 0.2.3

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 (275) hide show
  1. package/LICENSE +48 -0
  2. package/NOTICE +5 -0
  3. package/README.md +399 -0
  4. package/bin/orcats +4 -0
  5. package/dist/backends/acp-client.d.ts +74 -0
  6. package/dist/backends/acp-client.d.ts.map +1 -0
  7. package/dist/backends/acp-run.d.ts +31 -0
  8. package/dist/backends/acp-run.d.ts.map +1 -0
  9. package/dist/backends/claude-run.d.ts +35 -0
  10. package/dist/backends/claude-run.d.ts.map +1 -0
  11. package/dist/backends/claude-stream-json.d.ts +15 -0
  12. package/dist/backends/claude-stream-json.d.ts.map +1 -0
  13. package/dist/backends/codex-jsonl.d.ts +34 -0
  14. package/dist/backends/codex-jsonl.d.ts.map +1 -0
  15. package/dist/backends/codex-run.d.ts +40 -0
  16. package/dist/backends/codex-run.d.ts.map +1 -0
  17. package/dist/backends/codex.d.ts +5 -0
  18. package/dist/backends/codex.d.ts.map +1 -0
  19. package/dist/backends/conversation-config.d.ts +12 -0
  20. package/dist/backends/conversation-config.d.ts.map +1 -0
  21. package/dist/backends/index.d.ts +14 -0
  22. package/dist/backends/index.d.ts.map +1 -0
  23. package/dist/backends/opencode-run.d.ts +48 -0
  24. package/dist/backends/opencode-run.d.ts.map +1 -0
  25. package/dist/backends/opencode-sse.d.ts +35 -0
  26. package/dist/backends/opencode-sse.d.ts.map +1 -0
  27. package/dist/backends/pi-rpc.d.ts +21 -0
  28. package/dist/backends/pi-rpc.d.ts.map +1 -0
  29. package/dist/backends/pi-run.d.ts +21 -0
  30. package/dist/backends/pi-run.d.ts.map +1 -0
  31. package/dist/backends/select.d.ts +17 -0
  32. package/dist/backends/select.d.ts.map +1 -0
  33. package/dist/backends/subprocess-run.d.ts +68 -0
  34. package/dist/backends/subprocess-run.d.ts.map +1 -0
  35. package/dist/backends/types.d.ts +17 -0
  36. package/dist/backends/types.d.ts.map +1 -0
  37. package/dist/backends/unsupported.d.ts +9 -0
  38. package/dist/backends/unsupported.d.ts.map +1 -0
  39. package/dist/baseline/index.d.ts +56 -0
  40. package/dist/baseline/index.d.ts.map +1 -0
  41. package/dist/cli/args.d.ts +22 -0
  42. package/dist/cli/args.d.ts.map +1 -0
  43. package/dist/cli/embedded.d.ts +7 -0
  44. package/dist/cli/embedded.d.ts.map +1 -0
  45. package/dist/cli/main.d.ts +6 -0
  46. package/dist/cli/main.d.ts.map +1 -0
  47. package/dist/cli/version.d.ts +2 -0
  48. package/dist/cli/version.d.ts.map +1 -0
  49. package/dist/conversation/ask-user.d.ts +17 -0
  50. package/dist/conversation/ask-user.d.ts.map +1 -0
  51. package/dist/conversation/conversation.d.ts +46 -0
  52. package/dist/conversation/conversation.d.ts.map +1 -0
  53. package/dist/conversation/harness.d.ts +14 -0
  54. package/dist/conversation/harness.d.ts.map +1 -0
  55. package/dist/conversation/index.d.ts +5 -0
  56. package/dist/conversation/index.d.ts.map +1 -0
  57. package/dist/conversation/queue.d.ts +15 -0
  58. package/dist/conversation/queue.d.ts.map +1 -0
  59. package/dist/flow/accessors.d.ts +13 -0
  60. package/dist/flow/accessors.d.ts.map +1 -0
  61. package/dist/flow/approvals.d.ts +6 -0
  62. package/dist/flow/approvals.d.ts.map +1 -0
  63. package/dist/flow/args.d.ts +4 -0
  64. package/dist/flow/args.d.ts.map +1 -0
  65. package/dist/flow/context.d.ts +36 -0
  66. package/dist/flow/context.d.ts.map +1 -0
  67. package/dist/flow/index.d.ts +5 -0
  68. package/dist/flow/index.d.ts.map +1 -0
  69. package/dist/index.d.ts +16 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/loop/builder/index.d.ts +17 -0
  72. package/dist/loop/builder/index.d.ts.map +1 -0
  73. package/dist/loop/builder/types.d.ts +97 -0
  74. package/dist/loop/builder/types.d.ts.map +1 -0
  75. package/dist/loop/context/compaction.d.ts +38 -0
  76. package/dist/loop/context/compaction.d.ts.map +1 -0
  77. package/dist/loop/context/index.d.ts +4 -0
  78. package/dist/loop/context/index.d.ts.map +1 -0
  79. package/dist/loop/context/offload.d.ts +34 -0
  80. package/dist/loop/context/offload.d.ts.map +1 -0
  81. package/dist/loop/context/types.d.ts +13 -0
  82. package/dist/loop/context/types.d.ts.map +1 -0
  83. package/dist/loop/engine/bridge.d.ts +21 -0
  84. package/dist/loop/engine/bridge.d.ts.map +1 -0
  85. package/dist/loop/engine/index.d.ts +73 -0
  86. package/dist/loop/engine/index.d.ts.map +1 -0
  87. package/dist/loop/execution.d.ts +68 -0
  88. package/dist/loop/execution.d.ts.map +1 -0
  89. package/dist/loop/fanout.d.ts +148 -0
  90. package/dist/loop/fanout.d.ts.map +1 -0
  91. package/dist/loop/firing.d.ts +54 -0
  92. package/dist/loop/firing.d.ts.map +1 -0
  93. package/dist/loop/graph/analyze.d.ts +8 -0
  94. package/dist/loop/graph/analyze.d.ts.map +1 -0
  95. package/dist/loop/graph/index.d.ts +3 -0
  96. package/dist/loop/graph/index.d.ts.map +1 -0
  97. package/dist/loop/graph/types.d.ts +35 -0
  98. package/dist/loop/graph/types.d.ts.map +1 -0
  99. package/dist/loop/index.d.ts +7 -0
  100. package/dist/loop/index.d.ts.map +1 -0
  101. package/dist/loop/io/index.d.ts +4 -0
  102. package/dist/loop/io/index.d.ts.map +1 -0
  103. package/dist/loop/io/linear.d.ts +142 -0
  104. package/dist/loop/io/linear.d.ts.map +1 -0
  105. package/dist/loop/io/sink.d.ts +47 -0
  106. package/dist/loop/io/sink.d.ts.map +1 -0
  107. package/dist/loop/io/source.d.ts +64 -0
  108. package/dist/loop/io/source.d.ts.map +1 -0
  109. package/dist/loop/serve.d.ts +97 -0
  110. package/dist/loop/serve.d.ts.map +1 -0
  111. package/dist/loop/state/index.d.ts +5 -0
  112. package/dist/loop/state/index.d.ts.map +1 -0
  113. package/dist/loop/state/manifest.d.ts +36 -0
  114. package/dist/loop/state/manifest.d.ts.map +1 -0
  115. package/dist/loop/state/port.d.ts +33 -0
  116. package/dist/loop/state/port.d.ts.map +1 -0
  117. package/dist/loop/state/snapshot.d.ts +15 -0
  118. package/dist/loop/state/snapshot.d.ts.map +1 -0
  119. package/dist/loop/state/sqlite.d.ts +31 -0
  120. package/dist/loop/state/sqlite.d.ts.map +1 -0
  121. package/dist/loop/termination-contract.d.ts +28 -0
  122. package/dist/loop/termination-contract.d.ts.map +1 -0
  123. package/dist/loop/termination.d.ts +33 -0
  124. package/dist/loop/termination.d.ts.map +1 -0
  125. package/dist/model/backend-config.d.ts +30 -0
  126. package/dist/model/backend-config.d.ts.map +1 -0
  127. package/dist/model/brand.d.ts +9 -0
  128. package/dist/model/brand.d.ts.map +1 -0
  129. package/dist/model/errors.d.ts +11 -0
  130. package/dist/model/errors.d.ts.map +1 -0
  131. package/dist/model/index.d.ts +8 -0
  132. package/dist/model/index.d.ts.map +1 -0
  133. package/dist/model/json-schema.d.ts +4 -0
  134. package/dist/model/json-schema.d.ts.map +1 -0
  135. package/dist/model/result.d.ts +3 -0
  136. package/dist/model/result.d.ts.map +1 -0
  137. package/dist/model/schemas.d.ts +435 -0
  138. package/dist/model/schemas.d.ts.map +1 -0
  139. package/dist/model/structured.d.ts +9 -0
  140. package/dist/model/structured.d.ts.map +1 -0
  141. package/dist/monitor/index.d.ts +139 -0
  142. package/dist/monitor/index.d.ts.map +1 -0
  143. package/dist/plan/index.d.ts +3 -0
  144. package/dist/plan/index.d.ts.map +1 -0
  145. package/dist/plan/persistent.d.ts +23 -0
  146. package/dist/plan/persistent.d.ts.map +1 -0
  147. package/dist/plan/verdict.d.ts +9 -0
  148. package/dist/plan/verdict.d.ts.map +1 -0
  149. package/dist/review/index.d.ts +4 -0
  150. package/dist/review/index.d.ts.map +1 -0
  151. package/dist/review/loop.d.ts +117 -0
  152. package/dist/review/loop.d.ts.map +1 -0
  153. package/dist/review/reviewers.d.ts +13 -0
  154. package/dist/review/reviewers.d.ts.map +1 -0
  155. package/dist/review/tool.d.ts +20 -0
  156. package/dist/review/tool.d.ts.map +1 -0
  157. package/dist/run-output/index.d.ts +112 -0
  158. package/dist/run-output/index.d.ts.map +1 -0
  159. package/dist/runner/index.d.ts +2 -0
  160. package/dist/runner/index.d.ts.map +1 -0
  161. package/dist/runner/typecheck.d.ts +23 -0
  162. package/dist/runner/typecheck.d.ts.map +1 -0
  163. package/dist/test-utils/fakes.d.ts +76 -0
  164. package/dist/test-utils/fakes.d.ts.map +1 -0
  165. package/dist/test-utils/fixtures.d.ts +4 -0
  166. package/dist/test-utils/fixtures.d.ts.map +1 -0
  167. package/dist/test-utils/index.d.ts +4 -0
  168. package/dist/test-utils/index.d.ts.map +1 -0
  169. package/dist/test-utils/tier2.d.ts +8 -0
  170. package/dist/test-utils/tier2.d.ts.map +1 -0
  171. package/dist/tools/fs.d.ts +11 -0
  172. package/dist/tools/fs.d.ts.map +1 -0
  173. package/dist/tools/git.d.ts +10 -0
  174. package/dist/tools/git.d.ts.map +1 -0
  175. package/dist/tools/github.d.ts +13 -0
  176. package/dist/tools/github.d.ts.map +1 -0
  177. package/dist/tools/index.d.ts +7 -0
  178. package/dist/tools/index.d.ts.map +1 -0
  179. package/dist/tools/linear.d.ts +117 -0
  180. package/dist/tools/linear.d.ts.map +1 -0
  181. package/dist/tools/process.d.ts +40 -0
  182. package/dist/tools/process.d.ts.map +1 -0
  183. package/dist/tools/terminal.d.ts +23 -0
  184. package/dist/tools/terminal.d.ts.map +1 -0
  185. package/package.json +89 -9
  186. package/src/backends/acp-client.ts +324 -0
  187. package/src/backends/acp-run.ts +636 -0
  188. package/src/backends/claude-run.ts +226 -0
  189. package/src/backends/claude-stream-json.ts +273 -0
  190. package/src/backends/codex-jsonl.ts +339 -0
  191. package/src/backends/codex-run.ts +177 -0
  192. package/src/backends/codex.ts +84 -0
  193. package/src/backends/conversation-config.ts +26 -0
  194. package/src/backends/index.ts +13 -0
  195. package/src/backends/opencode-run.ts +432 -0
  196. package/src/backends/opencode-sse.ts +360 -0
  197. package/src/backends/pi-rpc.ts +242 -0
  198. package/src/backends/pi-run.ts +154 -0
  199. package/src/backends/select.ts +77 -0
  200. package/src/backends/subprocess-run.ts +305 -0
  201. package/src/backends/types.ts +29 -0
  202. package/src/backends/unsupported.ts +48 -0
  203. package/src/baseline/index.ts +437 -0
  204. package/src/cli/args.ts +109 -0
  205. package/src/cli/embedded.ts +206 -0
  206. package/src/cli/main.ts +332 -0
  207. package/src/cli/version.ts +1 -0
  208. package/src/conversation/ask-user.ts +105 -0
  209. package/src/conversation/conversation.ts +109 -0
  210. package/src/conversation/harness.ts +39 -0
  211. package/src/conversation/index.ts +4 -0
  212. package/src/conversation/queue.ts +86 -0
  213. package/src/flow/accessors.ts +43 -0
  214. package/src/flow/approvals.ts +10 -0
  215. package/src/flow/args.ts +26 -0
  216. package/src/flow/context.ts +106 -0
  217. package/src/flow/index.ts +4 -0
  218. package/src/index.ts +17 -0
  219. package/src/loop/builder/index.ts +346 -0
  220. package/src/loop/builder/types.ts +131 -0
  221. package/src/loop/context/compaction.ts +175 -0
  222. package/src/loop/context/index.ts +3 -0
  223. package/src/loop/context/offload.ts +79 -0
  224. package/src/loop/context/types.ts +17 -0
  225. package/src/loop/engine/bridge.ts +61 -0
  226. package/src/loop/engine/index.ts +166 -0
  227. package/src/loop/execution.ts +453 -0
  228. package/src/loop/fanout.ts +444 -0
  229. package/src/loop/firing.ts +188 -0
  230. package/src/loop/graph/analyze.ts +128 -0
  231. package/src/loop/graph/index.ts +2 -0
  232. package/src/loop/graph/types.ts +45 -0
  233. package/src/loop/index.ts +11 -0
  234. package/src/loop/io/index.ts +3 -0
  235. package/src/loop/io/linear.ts +714 -0
  236. package/src/loop/io/sink.ts +170 -0
  237. package/src/loop/io/source.ts +255 -0
  238. package/src/loop/serve.ts +307 -0
  239. package/src/loop/state/index.ts +4 -0
  240. package/src/loop/state/manifest.ts +56 -0
  241. package/src/loop/state/port.ts +43 -0
  242. package/src/loop/state/snapshot.ts +129 -0
  243. package/src/loop/state/sqlite.ts +265 -0
  244. package/src/loop/termination-contract.ts +89 -0
  245. package/src/loop/termination.ts +156 -0
  246. package/src/model/backend-config.ts +34 -0
  247. package/src/model/brand.ts +11 -0
  248. package/src/model/errors.ts +28 -0
  249. package/src/model/index.ts +7 -0
  250. package/src/model/json-schema.ts +14 -0
  251. package/src/model/result.ts +28 -0
  252. package/src/model/schemas.ts +218 -0
  253. package/src/model/structured.ts +26 -0
  254. package/src/monitor/index.ts +367 -0
  255. package/src/plan/index.ts +2 -0
  256. package/src/plan/persistent.ts +98 -0
  257. package/src/plan/verdict.ts +3 -0
  258. package/src/review/index.ts +3 -0
  259. package/src/review/loop.ts +365 -0
  260. package/src/review/reviewers.ts +92 -0
  261. package/src/review/tool.ts +41 -0
  262. package/src/run-output/index.ts +319 -0
  263. package/src/runner/index.ts +1 -0
  264. package/src/runner/typecheck.ts +72 -0
  265. package/src/test-utils/fakes.ts +260 -0
  266. package/src/test-utils/fixtures.ts +33 -0
  267. package/src/test-utils/index.ts +3 -0
  268. package/src/test-utils/tier2.ts +12 -0
  269. package/src/tools/fs.ts +44 -0
  270. package/src/tools/git.ts +34 -0
  271. package/src/tools/github.ts +25 -0
  272. package/src/tools/index.ts +6 -0
  273. package/src/tools/linear.ts +428 -0
  274. package/src/tools/process.ts +156 -0
  275. package/src/tools/terminal.ts +116 -0
@@ -0,0 +1,34 @@
1
+ import type { z } from "zod";
2
+ import { StreamConversation, type ConversationCapture } from "../conversation/index.ts";
3
+ import { type BackendApprovalPolicy, type BackendSandboxMode } from "../model/index.ts";
4
+ export type CodexParseResult = ConversationCapture<"codex">;
5
+ export interface CodexExecArgs {
6
+ readonly model?: string;
7
+ readonly approvalPolicy?: BackendApprovalPolicy;
8
+ readonly sandbox?: BackendSandboxMode;
9
+ readonly readOnly?: boolean;
10
+ readonly ignoreUserConfig?: boolean;
11
+ readonly outputSchemaPath?: string;
12
+ readonly resumeSessionId?: string;
13
+ readonly mcpServerUrl?: string;
14
+ readonly prompt?: string;
15
+ }
16
+ export declare function codexExecJsonlArgs(args?: CodexExecArgs): readonly string[];
17
+ export interface CodexJsonlOptions<Output = unknown> {
18
+ readonly schema?: z.ZodType<Output>;
19
+ /** Interactive conversations surface the agent's `ask_user` call as a
20
+ * `user_question` event for the renderer. The answer is NOT routed here — Codex
21
+ * obtains it from the Orcats MCP HTTP bridge and re-emits it on the matching
22
+ * `item.completed`, which the tool-result branch turns into a `tool_result`.
23
+ * Autonomous conversations leave this false and reject `ask_user` explicitly. */
24
+ readonly interactive?: boolean;
25
+ }
26
+ export declare function collectCodexJsonl<Output = unknown>(lines: readonly string[], options?: CodexJsonlOptions<Output>): Promise<CodexParseResult>;
27
+ export declare function consumeCodexJsonl<Output = unknown>(lines: readonly string[], conversation: StreamConversation<"codex">, options?: CodexJsonlOptions<Output>): Promise<void>;
28
+ export interface CodexJsonlConsumer {
29
+ readonly signal: AbortSignal;
30
+ consume(raw: string): Promise<void>;
31
+ finish(): void;
32
+ }
33
+ export declare function createCodexJsonlConsumer<Output = unknown>(conversation: StreamConversation<"codex">, options?: CodexJsonlOptions<Output>): CodexJsonlConsumer;
34
+ //# sourceMappingURL=codex-jsonl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-jsonl.d.ts","sourceRoot":"","sources":["../../src/backends/codex-jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAEL,kBAAkB,EAClB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAML,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAGxB,MAAM,mBAAmB,CAAC;AA6B3B,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,CAA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GAAG,OAAO,EACvD,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACzC,OAAO,GAAE,iBAAiB,CAAC,MAAM,CAAM,GACtC,kBAAkB,CAgHpB"}
@@ -0,0 +1,40 @@
1
+ import type { z } from "zod";
2
+ import { type CodexExecArgs } from "./codex-jsonl.ts";
3
+ import { type SubprocessProcess, type SubprocessSpawner } from "./subprocess-run.ts";
4
+ import type { AutonomousRequest } from "./types.ts";
5
+ import { type AskUserMcpServer, type AskUserMcpServerOptions, type AskUserResponder, type StreamConversation } from "../conversation/index.ts";
6
+ import { type BackendApprovalPolicy, type BackendConfig, type BackendSandboxMode } from "../model/index.ts";
7
+ export interface CodexBackendOptions extends Omit<CodexExecArgs, "prompt" | "outputSchemaPath" | "resumeSessionId" | "mcpServerUrl"> {
8
+ readonly command?: string;
9
+ readonly cwd?: string;
10
+ readonly env?: NodeJS.ProcessEnv;
11
+ readonly capacity?: number;
12
+ readonly spawnProcess?: CodexProcessSpawner;
13
+ readonly config?: BackendConfig<"codex">;
14
+ readonly askUser?: AskUserResponder;
15
+ readonly createAskUserServer?: (options: AskUserMcpServerOptions) => AskUserMcpServer;
16
+ readonly inactivityTimeoutMs?: number;
17
+ readonly wallClockTimeoutMs?: number;
18
+ }
19
+ /** Codex's subprocess handle is the shared {@link SubprocessProcess}; the alias
20
+ * is kept for the public API (tests and flow code import `CodexProcess`). */
21
+ export type CodexProcess = SubprocessProcess;
22
+ export type CodexProcessSpawner = SubprocessSpawner;
23
+ export interface ResolvedCodexConfig<Output> {
24
+ model?: string;
25
+ systemPrompt?: string;
26
+ approvalPolicy?: BackendApprovalPolicy;
27
+ sandbox?: BackendSandboxMode;
28
+ readOnly?: boolean;
29
+ ignoreUserConfig?: boolean;
30
+ selfManagedGit?: boolean;
31
+ retryAttempts?: number;
32
+ schema?: z.ZodType<Output>;
33
+ outputSchemaPath?: string;
34
+ resumeSessionId?: string;
35
+ interactive?: boolean;
36
+ mcpServerUrl?: string;
37
+ }
38
+ export declare function runCodexConversation<Output>(request: AutonomousRequest<Output, "codex">, options: CodexBackendOptions, conversation: StreamConversation<"codex">, setProcess: (process: CodexProcess) => void): Promise<void>;
39
+ export declare function resolveCodexConfig<Output>(request: AutonomousRequest<Output, "codex">, options: CodexBackendOptions): ResolvedCodexConfig<Output>;
40
+ //# sourceMappingURL=codex-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-run.d.ts","sourceRoot":"","sources":["../../src/backends/codex-run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,cAAc,CAAC;IAC/F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CA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iB,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3C,OAAO,EAAE,mBAAmB,GAC3B,mBAAmB,CAAC,MAAM,CAAC,CA8B7B"}
@@ -0,0 +1,5 @@
1
+ import type { LlmBackend } from "./types.ts";
2
+ import { type CodexBackendOptions } from "./codex-run.ts";
3
+ export type { CodexBackendOptions, CodexProcess, CodexProcessSpawner } from "./codex-run.ts";
4
+ export declare function codex(options?: CodexBackendOptions): LlmBackend<"codex">;
5
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/backends/codex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,YAAY,CAAC;AAMhE,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,KAAK,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAAC,OAAO,CAAC,CA+D5E"}
@@ -0,0 +1,12 @@
1
+ import type { z } from "zod";
2
+ export interface SharedBackendConfig<Output> {
3
+ model?: string;
4
+ systemPrompt?: string;
5
+ readOnly?: boolean;
6
+ selfManagedGit?: boolean;
7
+ retryAttempts?: number;
8
+ schema?: z.ZodType<Output>;
9
+ resumeSessionId?: string;
10
+ }
11
+ export declare function composeBackendPrompt(prompt: string, config: SharedBackendConfig<unknown>): string;
12
+ //# sourceMappingURL=conversation-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-config.d.ts","sourceRoot":"","sources":["../../src/backends/conversation-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAAG,MAAM,CAajG"}
@@ -0,0 +1,14 @@
1
+ export * from "./claude-run.ts";
2
+ export * from "./conversation-config.ts";
3
+ export * from "./claude-stream-json.ts";
4
+ export * from "./codex.ts";
5
+ export * from "./codex-jsonl.ts";
6
+ export * from "./opencode-run.ts";
7
+ export * from "./opencode-sse.ts";
8
+ export * from "./pi-rpc.ts";
9
+ export * from "./pi-run.ts";
10
+ export * from "./select.ts";
11
+ export * from "./subprocess-run.ts";
12
+ export * from "./types.ts";
13
+ export * from "./unsupported.ts";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/backends/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type OpenCodeServerManager, type OpenCodeServerProcess } from "./opencode-sse.ts";
2
+ import type { AutonomousRequest, LlmBackend } from "./types.ts";
3
+ import { StreamConversation } from "../conversation/index.ts";
4
+ import { type BackendConfig } from "../model/index.ts";
5
+ /** HTTP/SSE surface the driver needs from an `opencode serve` instance (Scala
6
+ * `OpencodeHttp`). The default is `fetch`-backed (integration only); unit tests
7
+ * inject a scripted fake. `openEvents` resolves once the SSE connection is open
8
+ * so the turn-starting POST can't race ahead of the stream. */
9
+ export interface OpenCodeHttp {
10
+ postJson(path: string, body: string, signal?: AbortSignal): Promise<string>;
11
+ openEvents(signal: AbortSignal): Promise<AsyncIterable<string>>;
12
+ }
13
+ export interface OpenCodeBackend extends LlmBackend<"opencode"> {
14
+ /** Stop the shared `opencode serve` process. Caller-invoked at runtime end —
15
+ * the package has no global scope hook, so the backend owner drives teardown. */
16
+ shutdown(signal?: NodeJS.Signals): Promise<void>;
17
+ }
18
+ export interface OpenCodeBackendOptions {
19
+ readonly command?: string;
20
+ readonly cwd?: string;
21
+ readonly env?: NodeJS.ProcessEnv;
22
+ readonly capacity?: number;
23
+ readonly config?: BackendConfig<"opencode">;
24
+ /** Fail the turn if the `/event` stream delivers nothing for this many ms.
25
+ * opencode 1.16.2 can stop emitting events entirely (no `session.idle`, no
26
+ * heartbeat) — e.g. when a structured-output turn follows tool use — which
27
+ * would otherwise hang the driver forever. Defaults to 120s; an actively
28
+ * streaming turn resets the timer on every event, so legitimate slow turns are
29
+ * unaffected. */
30
+ readonly inactivityTimeoutMs?: number;
31
+ /** Absolute per-turn wall-clock cap. Unlike the inactivity watchdog, this
32
+ * never resets — it fires regardless of SSE activity, guarding against agents
33
+ * that loop indefinitely while still emitting events. Defaults to 600s. */
34
+ readonly wallClockTimeoutMs?: number;
35
+ /** Fail `opencode serve` startup if no listening URL appears before this many ms. Defaults to 30s. */
36
+ readonly startupTimeoutMs?: number;
37
+ /** Seam: start (or reuse) the serve process. Defaults to spawning `opencode serve`. */
38
+ readonly startServer?: () => Promise<OpenCodeServerProcess>;
39
+ /** Seam: build an HTTP/SSE client for a started server. Defaults to `fetch`. */
40
+ readonly connect?: (server: OpenCodeServerProcess) => OpenCodeHttp;
41
+ }
42
+ export declare function runOpenCodeConversation<Output>(request: AutonomousRequest<Output, "opencode">, options: OpenCodeBackendOptions, manager: OpenCodeServerManager, connect: (server: OpenCodeServerProcess) => OpenCodeHttp, conversation: StreamConversation<"opencode">): Promise<void>;
43
+ export declare function opencode(options?: OpenCodeBackendOptions): OpenCodeBackend;
44
+ /** Default `fetch`-backed transport (Scala `JavaNetOpencodeHttp`). Sends the
45
+ * server's preemptive `Authorization` header on every request and surfaces
46
+ * non-2xx responses as errors instead of returning the body as success. */
47
+ export declare function createFetchOpenCodeHttp(server: OpenCodeServerProcess): OpenCodeHttp;
48
+ //# sourceMappingURL=opencode-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-run.d.ts","sourceRoot":"","sources":["../../src/backends/opencode-run.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEzF;;;+DAG+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU,CAAC,UAAU,CAAC;IAC7D;qFACiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACl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eParseResult = ConversationCapture<"opencode">;
3
+ export interface OpenCodeServerProcess {
4
+ readonly url: string;
5
+ /** Preemptive `Authorization` header value the server requires (Basic auth from
6
+ * the `OPENCODE_SERVER_PASSWORD` the spawn set). Absent for transports that
7
+ * don't authenticate. */
8
+ readonly authHeader?: string;
9
+ stop(signal?: NodeJS.Signals): Promise<void>;
10
+ }
11
+ export interface OpenCodeServerManager {
12
+ get(): Promise<OpenCodeServerProcess>;
13
+ shutdown(signal?: NodeJS.Signals): Promise<void>;
14
+ }
15
+ export declare function collectOpenCodeSse(lines: readonly string[]): Promise<OpenCodeParseResult>;
16
+ /** opencode wraps errors as `{name, data: {message}}` and sometimes as a bare
17
+ * `{message}` (Scala `OpencodeEvent.errorMessage`); fall back to the raw JSON so
18
+ * the failure is never silently empty. */
19
+ export declare function extractOpenCodeErrorMessage(error: unknown): string;
20
+ export declare function consumeOpenCodeSse(lines: readonly string[], conversation: StreamConversation<"opencode">, session?: string): Promise<void>;
21
+ export interface OpenCodeSseConsumer {
22
+ readonly completed: boolean;
23
+ /** Returns whether the line was relevant to this turn's session (activity
24
+ * signal for the inactivity watchdog). */
25
+ consume(raw: string): Promise<boolean>;
26
+ finish(): void;
27
+ }
28
+ /** Incremental consumer for the live driver: feeds SSE lines off the wire,
29
+ * scoped to `session`, and fails cleanly if the stream ends before a terminal
30
+ * `session.idle`/`error`. */
31
+ export declare function createOpenCodeSseConsumer(conversation: StreamConversation<"opencode">, session: string): OpenCodeSseConsumer;
32
+ export declare function createOpenCodeServerManager(args: {
33
+ start: () => Promise<OpenCodeServerProcess>;
34
+ }): OpenCodeServerManager;
35
+ //# sourceMappingURL=opencode-sse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-sse.d.ts","sourceRoot":"","sources":["../../src/backends/opencode-sse.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAClB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAgDlC,MAAM,MAAM,mBA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AG,qBAAqB,CAcxB"}
@@ -0,0 +1,21 @@
1
+ import type { z } from "zod";
2
+ import { StreamConversation, type ConversationCapture } from "../conversation/index.ts";
3
+ export type PiParseResult = ConversationCapture<"pi">;
4
+ export declare function piRpcArgs(sessionDir: string): readonly string[];
5
+ export declare function piPromptCommand(message: string): string;
6
+ export declare function collectPiRpc(lines: readonly string[], piSessionId?: string): Promise<PiParseResult>;
7
+ export interface PiRpcOptions<Output = unknown> {
8
+ readonly schema?: z.ZodType<Output>;
9
+ }
10
+ export declare function consumePiRpc(lines: readonly string[], conversation: StreamConversation<"pi">, piSessionId?: string): Promise<void>;
11
+ export interface PiRpcConsumer {
12
+ readonly signal: AbortSignal;
13
+ consume(raw: string): Promise<void>;
14
+ finish(): void;
15
+ }
16
+ /** Incremental consumer for the live driver: tolerates malformed JSON, validates
17
+ * structured output against a supplied schema (Pi has no native schema flag, so
18
+ * this is post-hoc text validation), and fails cleanly if the stream ends before
19
+ * `agent_end`. */
20
+ export declare function createPiRpcConsumer<Output = unknown>(conversation: StreamConversation<"pi">, piSessionId: string, options?: PiRpcOptions<Output>): PiRpcConsumer;
21
+ //# sourceMappingURL=pi-rpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-rpc.d.ts","sourceRoot":"","sources":["../../src/backends/pi-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,OAAO,EAEL,kBAAkB,EAClB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAsBlC,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAEtD,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAE/D;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,WAAW,SAAe,GACzB,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED,MAAM,WAAW,YAAY,CAAC,MAAM,GAAG,OAAO;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;CACrC;AAqFD,wBAAsB,YAAY,CAChC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,YAAY,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACtC,WAAW,SAAe,GACzB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;kBAGkB;AAClB,wBAAgB,mBAAmB,CAAC,MAAM,GAAG,OAAO,EAClD,YAAY,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACtC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,YAAY,CAAC,MAAM,CAAM,GACjC,aAAa,CAmCf"}
@@ -0,0 +1,21 @@
1
+ import { type SubprocessProcess, type SubprocessSpawner } from "./subprocess-run.ts";
2
+ import type { AutonomousRequest, LlmBackend } from "./types.ts";
3
+ import { StreamConversation } from "../conversation/index.ts";
4
+ import { type BackendConfig } from "../model/index.ts";
5
+ export type PiProcess = SubprocessProcess;
6
+ export type PiProcessSpawner = SubprocessSpawner;
7
+ export interface PiBackendOptions {
8
+ readonly command?: string;
9
+ readonly cwd?: string;
10
+ readonly env?: NodeJS.ProcessEnv;
11
+ readonly capacity?: number;
12
+ readonly spawnProcess?: PiProcessSpawner;
13
+ readonly config?: BackendConfig<"pi">;
14
+ readonly inactivityTimeoutMs?: number;
15
+ readonly wallClockTimeoutMs?: number;
16
+ /** Base directory for per-session Pi `--session-dir`s. Defaults to the OS temp dir. */
17
+ readonly sessionsDir?: string;
18
+ }
19
+ export declare function runPiConversation<Output>(request: AutonomousRequest<Output, "pi">, options: PiBackendOptions, conversation: StreamConversation<"pi">, setProcess: (process: PiProcess) => void): Promise<void>;
20
+ export declare function pi(options?: PiBackendOptions): LlmBackend<"pi">;
21
+ //# sourceMappingURL=pi-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-run.d.ts","sourceRoot":"","sources":["../../src/backends/pi-run.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,uFAAuF;IACvF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2BD,wBAAsB,iBAAiB,CAAC,MAAM,EAC5C,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,EACxC,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACtC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,GACvC,OAAO,CAAC,IAAI,CAAC,CAuCf;AA6BD,wBAAgB,EAAE,CAAC,OAAO,GAAE,gBAAqB,GAAG,UAAU,CAAC,IAAI,CAAC,CAuBnE"}
@@ -0,0 +1,17 @@
1
+ import { type BackendConfig, type BackendTag } from "../model/index.ts";
2
+ import type { LlmBackend } from "./types.ts";
3
+ export type PortableBackendConfig = Omit<BackendConfig, "resumeSessionId" | "structuredOutput">;
4
+ export interface SelectBackendOptions {
5
+ readonly default: BackendTag;
6
+ readonly config?: PortableBackendConfig;
7
+ readonly perBackend?: Partial<Record<BackendTag, PortableBackendConfig>>;
8
+ readonly env?: NodeJS.ProcessEnv;
9
+ }
10
+ export interface SelectedBackend {
11
+ readonly tag: BackendTag;
12
+ readonly backend: LlmBackend;
13
+ readonly model?: string;
14
+ readonly shutdown?: () => Promise<void>;
15
+ }
16
+ export declare function selectBackend(options: SelectBackendOptions): SelectedBackend;
17
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/backends/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,CAAC;AAEhG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CAqD5E"}
@@ -0,0 +1,68 @@
1
+ import { type BackendTag } from "../model/index.ts";
2
+ import type { StreamConversation } from "../conversation/index.ts";
3
+ /** A spawned agent subprocess: a stdout (and optional stderr) line/byte stream,
4
+ * an exit promise, a kill signal, and — for backends that feed their prompt over
5
+ * stdin (claude, pi) — an optional write/end pair. Codex leaves stdin ignored and
6
+ * never touches these. */
7
+ export interface SubprocessProcess {
8
+ readonly stdout: AsyncIterable<string | Uint8Array>;
9
+ readonly stderr?: AsyncIterable<string | Uint8Array>;
10
+ readonly exit: Promise<number | null>;
11
+ kill(signal?: NodeJS.Signals): void;
12
+ write?(data: string): void;
13
+ endStdin?(): void;
14
+ }
15
+ export interface SubprocessSpawnOptions {
16
+ readonly cwd?: string;
17
+ readonly env?: NodeJS.ProcessEnv;
18
+ /** Whether stdin is wired. Defaults to "ignore" so codex stays byte-identical;
19
+ * claude/pi pass "pipe" to write the opening user turn. */
20
+ readonly stdin?: "ignore" | "pipe";
21
+ }
22
+ export type SubprocessSpawner = (command: string, args: readonly string[], options: SubprocessSpawnOptions) => SubprocessProcess;
23
+ /** The per-line consumer half a backend supplies: incremental `consume(line)`
24
+ * plus a `finish()` that the helper calls after a clean (zero-exit) stream end.
25
+ * `signal` aborts once the turn is settled — required for persistent processes
26
+ * (pi rpc) that don't exit after a turn. */
27
+ export interface SubprocessConsumer {
28
+ readonly signal: AbortSignal;
29
+ consume(raw: string): Promise<void>;
30
+ finish(): void;
31
+ }
32
+ export interface RunSubprocessOptions<B extends BackendTag> {
33
+ readonly backend: B;
34
+ readonly command: string;
35
+ readonly args: readonly string[];
36
+ readonly conversation: StreamConversation<B>;
37
+ readonly createConsumer: () => SubprocessConsumer;
38
+ readonly cwd?: string;
39
+ readonly env?: NodeJS.ProcessEnv;
40
+ readonly stdin?: "ignore" | "pipe";
41
+ readonly spawnProcess?: SubprocessSpawner;
42
+ /** Fail when stdout produces no line for this many ms. Defaults to 120s. */
43
+ readonly inactivityTimeoutMs?: number;
44
+ /** Fail after this absolute turn duration even if stdout stays active. Defaults to 600s. */
45
+ readonly wallClockTimeoutMs?: number;
46
+ /** Records the spawned process so the accessor can `kill` it on cancellation. */
47
+ readonly setProcess?: (process: SubprocessProcess) => void;
48
+ /** Runs right after spawn (before the read loop) — claude/pi write the opening
49
+ * user turn to stdin and close it here. */
50
+ readonly onStart?: (process: SubprocessProcess) => void | Promise<void>;
51
+ }
52
+ /** Shared spawn → stdout-line-stream → consumer → outcome plumbing for
53
+ * subprocess-stream backends (codex, claude, pi). Owns process spawn, line
54
+ * splitting, stderr capture, non-zero-exit failure, cancellation checks, and
55
+ * timeout settlement; the per-backend command/args builder and line consumer
56
+ * plug in.
57
+ *
58
+ * The helper deliberately does NOT catch spawn / stream / consumer exceptions —
59
+ * each driver wraps the call in its own try/catch/finally so spawn-error→fail and
60
+ * resource teardown stay synchronous with the failure (matters for deterministic
61
+ * cleanup ordering; see codex's ask_user bridge). Use {@link errorMessage} +
62
+ * {@link backendFailed} in that catch. */
63
+ export declare function runSubprocessConversation<B extends BackendTag>(options: RunSubprocessOptions<B>): Promise<void>;
64
+ export declare function spawnSubprocess(command: string, args: readonly string[], options: SubprocessSpawnOptions): SubprocessProcess;
65
+ export declare function splitLines(chunks: AsyncIterable<string | Uint8Array>): AsyncIterable<string>;
66
+ export declare function collectText(chunks: AsyncIterable<string | Uint8Array> | undefined): Promise<string>;
67
+ export declare function errorMessage(error: unknown): string;
68
+ //# sourceMappingURL=subprocess-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess-run.d.ts","sourceRoot":"","sources":["../../src/backends/subprocess-run.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAWnE;;;0BAG0B;AAC1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC;+DAC2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,sBAAsB,KAC5B,iBAAiB,CAAC;AAEvB;;;4CAG4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,OA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AE,EACvB,OAAO,EAAE,sBAAsB,GAC9B,iBAAiB,CA8BnB;AAED,wBAAuB,UAAU,CAC/B,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,GACzC,aAAa,CAAC,MAAM,CAAC,CAmBvB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,SAAS,GACrD,OAAO,CAAC,MAAM,CAAC,CAYjB;AA2BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,17 @@
1
+ import type { z } from "zod";
2
+ import type { Conversation } from "../conversation/index.ts";
3
+ import type { BackendConfig, BackendTag } from "../model/index.ts";
4
+ export type { BackendApprovalPolicy, BackendConfig, BackendResult, BackendRetryConfig, BackendSandboxMode, StructuredOutputConfig } from "../model/index.ts";
5
+ export interface AutonomousRequest<Output = unknown, B extends BackendTag = BackendTag> {
6
+ readonly prompt: string;
7
+ readonly schema?: z.ZodType<Output>;
8
+ readonly config?: BackendConfig<B, Output>;
9
+ }
10
+ export interface LlmBackend<B extends BackendTag = BackendTag> {
11
+ readonly tag: B;
12
+ autonomous<Output = unknown>(request: AutonomousRequest<Output, B>): Conversation<B>;
13
+ }
14
+ export interface LlmTool {
15
+ autonomous<B extends BackendTag, Output = unknown>(backend: LlmBackend<B>, request: AutonomousRequest<Output, B>): Conversation<B>;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/backends/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC3D,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;IAChB,UAAU,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;CACtF;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,GAAG,OAAO,EAC/C,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,GACpC,YAAY,CAAC,CAAC,CAAC,CAAC;CACpB"}
@@ -0,0 +1,9 @@
1
+ import type { LlmBackend } from "./types.ts";
2
+ import { type BackendTag, type SessionId } from "../model/index.ts";
3
+ export declare function unsupportedBackend<B extends BackendTag>(tag: B): LlmBackend<B>;
4
+ export declare function fakeResult<B extends BackendTag>(backend: B, output: string): {
5
+ readonly backend: B;
6
+ readonly sessionId: SessionId<B>;
7
+ readonly output: string;
8
+ };
9
+ //# sourceMappingURL=unsupported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported.d.ts","sourceRoot":"","sources":["../../src/backends/unsupported.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEhE,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CA0B9E;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAC7C,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,MAAM,GACb;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAMpF"}
@@ -0,0 +1,56 @@
1
+ import type { Usage } from "../model/index.ts";
2
+ import type { CommandLog, WorkflowMonitor } from "../monitor/index.ts";
3
+ import type { CommandTool, VerificationCommand } from "../tools/index.ts";
4
+ export declare const BaselinePolicies: readonly ["repair", "strict", "accept-dirty"];
5
+ export type BaselinePolicy = (typeof BaselinePolicies)[number];
6
+ export interface BaselinePolicyResolution {
7
+ readonly policy: BaselinePolicy;
8
+ readonly args: readonly string[];
9
+ readonly source: "args" | "env" | "default";
10
+ }
11
+ export interface BaselinePolicyParseOptions {
12
+ readonly args?: readonly string[];
13
+ readonly env?: Record<string, string | undefined>;
14
+ readonly defaultPolicy?: BaselinePolicy;
15
+ }
16
+ export interface BaselineGateIssue {
17
+ readonly message: string;
18
+ readonly fixable: true;
19
+ }
20
+ export interface BaselineRepairResult {
21
+ readonly usage?: Usage | undefined;
22
+ }
23
+ type BaselineRepairOutput<T = void> = BaselineRepairResult | T;
24
+ export interface BaselineGateResult {
25
+ readonly policy: BaselinePolicy;
26
+ readonly status: "clean" | "repaired";
27
+ readonly validation: readonly CommandLog[];
28
+ readonly iterations: number;
29
+ readonly snapshotPath?: string;
30
+ readonly usage?: Usage;
31
+ }
32
+ export interface RunBaselineGateOptions {
33
+ readonly commands: readonly VerificationCommand[];
34
+ readonly policy?: BaselinePolicy;
35
+ readonly commandTool?: CommandTool;
36
+ readonly repair?: (issues: readonly BaselineGateIssue[]) => Promise<BaselineRepairOutput>;
37
+ readonly monitor?: Pick<WorkflowMonitor, "stage" | "recordOutcome" | "recordFailure">;
38
+ readonly snapshotDir?: string;
39
+ readonly maxIterations?: number;
40
+ readonly wallClockMs?: number;
41
+ readonly tokenBudget?: number;
42
+ readonly stalled?: (issues: readonly BaselineGateIssue[]) => boolean;
43
+ readonly now?: () => number;
44
+ }
45
+ export interface DirtyBaselineSnapshotOptions {
46
+ readonly commands: readonly VerificationCommand[];
47
+ readonly commandTool?: CommandTool;
48
+ readonly snapshotDir?: string;
49
+ readonly now?: () => number;
50
+ }
51
+ export declare function resolveBaselinePolicy(options?: BaselinePolicyParseOptions): BaselinePolicyResolution;
52
+ export declare function parseBaselinePolicy(value: string | undefined): BaselinePolicy;
53
+ export declare function runBaselineGate(options: RunBaselineGateOptions): Promise<BaselineGateResult>;
54
+ export declare function captureDirtyBaselineSnapshot(options: DirtyBaselineSnapshotOptions): Promise<string | undefined>;
55
+ export {};
56
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/baseline/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAmB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAExF,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAA6B,MAAM,mBAAmB,CAAC;AAErG,eAAO,MAAM,gBAAgB,+CAAgD,CAAC;AAC9E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC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AAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC1F,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,eAAe,GAAG,eAAe,CAAC,CAAC;IACtF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,KAAK,OAAO,CAAC;IACrE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAiBD,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,0BAA+B,GAAG,wBAAwB,CAsCxG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAE7E;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAGlG;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7B"}
@@ -0,0 +1,22 @@
1
+ import { type BackendTag } from "../model/index.ts";
2
+ /** Loop verbs (spec distribution). Absent => the legacy `orcats <flow.ts>` script path. */
3
+ export type LoopCommand = "run" | "serve" | "loops";
4
+ export interface CliArgs {
5
+ /** A loop verb when the first positional is `run`/`serve`/`loops`; otherwise undefined (legacy). */
6
+ readonly command?: LoopCommand;
7
+ /** The loop module path or registered name for `run`/`serve`. */
8
+ readonly loop?: string;
9
+ /** The legacy flow-script path (no loop verb). */
10
+ readonly script?: string;
11
+ readonly backend?: BackendTag;
12
+ readonly skipTypecheck: boolean;
13
+ readonly help: boolean;
14
+ readonly version: boolean;
15
+ /** Deferred durable-mode flags (spec distribution / design D5) — rejected by `main`. */
16
+ readonly durable?: true;
17
+ readonly postgresUrl?: string;
18
+ readonly stateAdapter?: string;
19
+ readonly flowArgs: readonly string[];
20
+ }
21
+ export declare function parseCliArgs(argv: readonly string[]): CliArgs;
22
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGtE,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,OAAO;IACtB,oGAAoG;IACpG,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAkF7D"}
@@ -0,0 +1,7 @@
1
+ interface EnsureOrcaResolvableOptions {
2
+ readonly cleanup?: boolean;
3
+ }
4
+ export declare function ensureOrcaResolvable(scriptPath: string, options?: EnsureOrcaResolvableOptions): boolean;
5
+ export declare function canResolveOrca(scriptPath: string): boolean;
6
+ export {};
7
+ //# sourceMappingURL=embedded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../../src/cli/embedded.ts"],"names":[],"mappings":"AAcA,UAAU,2BAA2B;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,2BAAgC,GAAG,OAAO,CAa3G;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG1D"}
@@ -0,0 +1,6 @@
1
+ import { type RuntimeError } from "../model/index.ts";
2
+ import { type CliArgs } from "./args.ts";
3
+ /** Durable DBOS mode is not selectable in this change (spec distribution; design D5). */
4
+ export declare function deferredDurableError(args: CliArgs): RuntimeError | undefined;
5
+ export declare function main(argv?: readonly string[]): Promise<void>;
6
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAgB1E,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BvD,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAK5E;AAED,wBAAsB,IAAI,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDzF"}
@@ -0,0 +1,2 @@
1
+ export declare const ORCA_VERSION = "0.2.3";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface AskUserRequest {
2
+ readonly question: string;
3
+ readonly rawInput?: unknown;
4
+ }
5
+ export type AskUserResponder = (request: AskUserRequest) => Promise<string> | string;
6
+ export interface AskUserMcpServer {
7
+ readonly url: string;
8
+ ask(request: AskUserRequest): Promise<string>;
9
+ close(): Promise<void>;
10
+ }
11
+ export interface AskUserMcpServerOptions {
12
+ readonly responder: AskUserResponder;
13
+ }
14
+ /** The tool name Codex's MCP client discovers and calls (namespaced `orcats.ask_user`). */
15
+ export declare const ASK_USER_TOOL_NAME = "ask_user";
16
+ export declare function createAskUserMcpServer(options: AskUserMcpServerOptions): AskUserMcpServer;
17
+ //# sourceMappingURL=ask-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-user.d.ts","sourceRoot":"","sources":["../../src/conversation/ask-user.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAErF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;CACtC;AAED,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAY7C,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CA0EzF"}