@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,46 @@
1
+ import { type Result } from "neverthrow";
2
+ import { type BackendResult, type BackendTag, type ConversationEvent, type RuntimeError } from "../model/index.ts";
3
+ export type Outcome<B extends BackendTag = BackendTag> = {
4
+ readonly type: "success";
5
+ readonly result: BackendResult<B>;
6
+ } | {
7
+ readonly type: "cancelled";
8
+ readonly reason?: string;
9
+ } | {
10
+ readonly type: "failed";
11
+ readonly error: RuntimeError;
12
+ };
13
+ export interface Conversation<B extends BackendTag = BackendTag> {
14
+ readonly backend: B;
15
+ readonly canAskUser: boolean;
16
+ readonly signal: AbortSignal;
17
+ events(): AsyncIterable<ConversationEvent>;
18
+ awaitResult(): Promise<Outcome<B>>;
19
+ cancel(reason?: string): Promise<void>;
20
+ }
21
+ export interface StreamConversationOptions<B extends BackendTag> {
22
+ readonly backend: B;
23
+ readonly capacity?: number;
24
+ readonly canAskUser?: boolean;
25
+ readonly onCancel?: (reason?: string) => Promise<void> | void;
26
+ }
27
+ export declare class StreamConversation<B extends BackendTag> implements Conversation<B> {
28
+ private readonly options;
29
+ private readonly abortController;
30
+ readonly canAskUser: boolean;
31
+ readonly signal: AbortSignal;
32
+ private readonly queue;
33
+ private readonly outcome;
34
+ private settle;
35
+ private settled;
36
+ constructor(options: StreamConversationOptions<B>);
37
+ get backend(): B;
38
+ events(): AsyncIterable<ConversationEvent>;
39
+ awaitResult(): Promise<Outcome<B>>;
40
+ emit(event: ConversationEvent): Promise<Result<void, RuntimeError>>;
41
+ succeed(result: BackendResult<B>): void;
42
+ fail(error: RuntimeError): void;
43
+ cancel(reason?: string): Promise<void>;
44
+ private complete;
45
+ }
46
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/conversation/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,Q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I,CAAC,CAEf;IAED,MAAM,IAAI,aAAa,CAAC,iBAAiB,CAAC;IAI1C,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAI5B,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAmBzE,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI;IAIvC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAIzB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5C,OAAO,CAAC,QAAQ;CASjB"}
@@ -0,0 +1,14 @@
1
+ import { type BackendTag, type ConversationEvent } from "../model/index.ts";
2
+ import { StreamConversation, type Outcome } from "./conversation.ts";
3
+ export interface ConversationCapture<B extends BackendTag> {
4
+ readonly events: readonly ConversationEvent[];
5
+ readonly outcome: Outcome<B>;
6
+ }
7
+ export interface ConversationHarnessOptions<B extends BackendTag> {
8
+ readonly backend: B;
9
+ readonly capacity?: number;
10
+ readonly canAskUser?: boolean;
11
+ readonly consume: (conversation: StreamConversation<B>) => Promise<void> | void;
12
+ }
13
+ export declare function collectConversation<B extends BackendTag>(options: ConversationHarnessOptions<B>): Promise<ConversationCapture<B>>;
14
+ //# sourceMappingURL=harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/conversation/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,UAAU;IACvD,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,UAAU;IAC9D,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjF;AAED,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAiBjC"}
@@ -0,0 +1,5 @@
1
+ export * from "./ask-user.ts";
2
+ export * from "./conversation.ts";
3
+ export * from "./harness.ts";
4
+ export * from "./queue.ts";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare class BoundedAsyncQueue<T> implements AsyncIterable<T> {
2
+ private readonly capacity;
3
+ private readonly items;
4
+ private readonly takers;
5
+ private readonly pushWaiters;
6
+ private closed;
7
+ private iteratorStarted;
8
+ constructor(capacity: number);
9
+ push(item: T): Promise<void>;
10
+ close(): void;
11
+ [Symbol.asyncIterator](): AsyncIterator<T>;
12
+ private next;
13
+ private ensureOpen;
14
+ }
15
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/conversation/queue.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAO/C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;IACxE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyB;IACrD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,CAAS;gBAEH,QAAQ,EAAE,MAAM;IAMvC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBlC,KAAK,IAAI,IAAI;IAgBb,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;YAY5B,IAAI;IAelB,OAAO,CAAC,UAAU;CAKnB"}
@@ -0,0 +1,13 @@
1
+ import { currentFlowContext } from "./context.ts";
2
+ export declare const flowContext: typeof currentFlowContext;
3
+ export declare function fs(): import("../index.ts").FsTool;
4
+ export declare function git(): import("../index.ts").GitTool;
5
+ export declare function gh(): import("../index.ts").GitHubTool;
6
+ export declare function linear(): import("../index.ts").LinearTool;
7
+ export declare function terminal(): import("../index.ts").TerminalTool;
8
+ export declare function command(): import("../index.ts").CommandTool;
9
+ export declare function llm(): import("../index.ts").LlmTool;
10
+ export declare function plan(): import("./context.ts").PlanTool;
11
+ export declare function review(): import("../index.ts").ReviewTool;
12
+ export declare function reporter(): import("../index.ts").RunReporter;
13
+ //# sourceMappingURL=accessors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessors.d.ts","sourceRoot":"","sources":["../../src/flow/accessors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW,2BAAqB,CAAC;AAE9C,wBAAgB,EAAE,iCAEjB;AAED,wBAAgB,GAAG,kCAElB;AAED,wBAAgB,EAAE,qCAEjB;AAED,wBAAgB,MAAM,qCAErB;AAED,wBAAgB,QAAQ,uCAEvB;AAED,wBAAgB,OAAO,sCAEtB;AAED,wBAAgB,GAAG,kCAElB;AAED,wBAAgB,IAAI,oCAEnB;AAED,wBAAgB,MAAM,qCAErB;AAED,wBAAgB,QAAQ,sCAEvB"}
@@ -0,0 +1,6 @@
1
+ export interface ToolApprovalRequest {
2
+ readonly toolName: string;
3
+ readonly input: unknown;
4
+ }
5
+ export declare function requestToolApproval(request: ToolApprovalRequest): never;
6
+ //# sourceMappingURL=approvals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/flow/approvals.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,KAAK,CAIvE"}
@@ -0,0 +1,4 @@
1
+ export declare const FLOW_ARGS_ENV = "ORCA_FLOW_ARGS";
2
+ export declare function extractFlowArgs(argv: readonly string[]): string[];
3
+ export declare function flowArgs(): string[];
4
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/flow/args.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAI9C,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAGjE;AAKD,wBAAgB,QAAQ,IAAI,MAAM,EAAE,CAanC"}
@@ -0,0 +1,36 @@
1
+ import { type FsTool } from "../tools/fs.ts";
2
+ import { type GitTool } from "../tools/git.ts";
3
+ import { type GitHubTool } from "../tools/github.ts";
4
+ import { type LinearTool } from "../tools/linear.ts";
5
+ import { type CommandTool } from "../tools/process.ts";
6
+ import { type TerminalTool } from "../tools/terminal.ts";
7
+ import type { LlmTool } from "../backends/index.ts";
8
+ import { defaultPlanPath, implementTaskLoop, recoverPlan, writePlan } from "../plan/index.ts";
9
+ import { type ReviewTool } from "../review/index.ts";
10
+ import { type RunReporter } from "../run-output/index.ts";
11
+ export interface PlanTool {
12
+ readonly defaultPath: typeof defaultPlanPath;
13
+ readonly write: typeof writePlan;
14
+ readonly recover: typeof recoverPlan;
15
+ readonly implementTaskLoop: typeof implementTaskLoop;
16
+ interactive(): never;
17
+ }
18
+ export interface FlowContext {
19
+ readonly args: readonly string[];
20
+ readonly cwd: string;
21
+ readonly fs: FsTool;
22
+ readonly git: GitTool;
23
+ readonly gh: GitHubTool;
24
+ readonly linear: LinearTool;
25
+ readonly terminal: TerminalTool;
26
+ readonly command: CommandTool;
27
+ readonly llm: LlmTool;
28
+ readonly plan: PlanTool;
29
+ readonly review: ReviewTool;
30
+ readonly reporter: RunReporter;
31
+ }
32
+ export type FlowOverrides = Partial<Omit<FlowContext, "args">>;
33
+ export declare function flow<T>(args?: readonly string[], overrides?: FlowOverrides): (fn: () => Promise<T> | T) => Promise<T>;
34
+ export declare function currentFlowContext(): FlowContext;
35
+ export declare function createDefaultFlowContext(args: readonly string[], overrides?: FlowOverrides): FlowContext;
36
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/flow/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAsB,KAAK,YA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,CAAC,CAAC,EACpB,IAAI,GAAE,SAAS,MAAM,EAAO,EAC5B,SAAS,GAAE,aAAkB,GAC5B,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG1C;AAED,wBAAgB,kBAAkB,IAAI,WAAW,CAMhD;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,GAAE,aAAkB,GAC5B,WAAW,CAkBb"}
@@ -0,0 +1,5 @@
1
+ export * from "./accessors.ts";
2
+ export * from "./approvals.ts";
3
+ export * from "./args.ts";
4
+ export * from "./context.ts";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flow/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,16 @@
1
+ export * from "./backends/index.ts";
2
+ export * from "./baseline/index.ts";
3
+ export * from "./conversation/index.ts";
4
+ export * from "./flow/index.ts";
5
+ export * from "./loop/index.ts";
6
+ export * from "./model/index.ts";
7
+ export * from "./monitor/index.ts";
8
+ export * from "./plan/index.ts";
9
+ export * from "./review/index.ts";
10
+ export * from "./runner/index.ts";
11
+ export * from "./run-output/index.ts";
12
+ export * from "./tools/index.ts";
13
+ export { z } from "zod";
14
+ export { err, ok } from "neverthrow";
15
+ export type { Result } from "neverthrow";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type TaskManifest } from "../state/index.ts";
2
+ import type { ConfidenceState, GatesState, LoopBuilder, TerminationPreset } from "./types.ts";
3
+ export * from "./types.ts";
4
+ /** Entry point for the declarative loop builder (task 5.1). */
5
+ export declare function loop<S = unknown>(name: string): LoopBuilder<S>;
6
+ /** TDD / compiler loop: drive failing tests/gates to zero. */
7
+ export declare function untilGatesGreen(): TerminationPreset<GatesState>;
8
+ /** The "Ralph" case: drive the manifest's pending-task count to zero (variant from L05 projection). */
9
+ export declare function untilManifestComplete(): TerminationPreset<TaskManifest>;
10
+ /** Today's review/fix loop: drive the open-issue count to zero. */
11
+ export declare function untilNoIssues(): TerminationPreset<readonly unknown[]>;
12
+ /** Confidence loop: drive `1 − confidence` to the threshold floor. */
13
+ export declare function untilConfident(threshold: number): TerminationPreset<ConfidenceState>;
14
+ /** Bounded-count escape hatch: the variant is the remaining iterations; converges after `n`. */
15
+ export declare function times(n: number): TerminationPreset;
16
+ export * from "../fanout.ts";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loop/builder/index.ts"],"names":[],"mappings":"AASA,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,WAAW,EAMX,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,cAAc,YAAY,CAAC;AAwR3B,+DAA+D;AAC/D,wBAAgB,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAE9D;AAKD,8DAA8D;AAC9D,wBAAgB,eAAe,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAE/D;AAED,uGAAuG;AACvG,wBAAgB,qBAAqB,IAAI,iBAAiB,CAAC,YAAY,CAAC,CAEvE;AAED,mEAAmE;AACnE,wBAAgB,aAAa,IAAI,iBAAiB,CAAC,SAAS,OAAO,EAAE,CAAC,CAErE;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAEpF;AAED,gGAAgG;AAChG,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAOlD;AAMD,cAAc,cAAc,CAAC"}
@@ -0,0 +1,97 @@
1
+ import type { Result } from "neverthrow";
2
+ import type { AutonomousRequest, LlmBackend } from "../../backends/index.ts";
3
+ import type { FlowOverrides } from "../../flow/index.ts";
4
+ import type { BackendTag, RuntimeError, Usage } from "../../model/index.ts";
5
+ import type { LoopExecutionContextOptions, LoopContextPressure } from "../execution.ts";
6
+ import type { TerminationContractError } from "../termination-contract.ts";
7
+ /** Surfaced from the internal contract module so callers can discriminate a build failure. */
8
+ export type { TerminationContractError } from "../termination-contract.ts";
9
+ /**
10
+ * A loop variant (design D3): a measure bounded below — floor `0` by convention — that the
11
+ * loop drives toward zero. `.measure(fn)` supplies one directly; presets bundle one.
12
+ */
13
+ export interface LoopVariant<S = unknown> {
14
+ /** Current measure; the loop converges when this reaches `0`. */
15
+ measure(state: S): Promise<number> | number;
16
+ }
17
+ export type PresetKind = "untilGatesGreen" | "untilManifestComplete" | "untilNoIssues" | "untilConfident" | "times";
18
+ /**
19
+ * A preset termination archetype (design D3). Choosing one satisfies the termination contract
20
+ * without the author authoring variant math. The bundled `measure` is the loop variant (floor
21
+ * `0`); `cycle` is the completed-iteration count, needed by count-based presets like `times`.
22
+ * `guards` are sane default seatbelts the preset contributes; an explicit `.guard()` overrides.
23
+ */
24
+ export interface TerminationPreset<S = unknown> {
25
+ readonly kind: PresetKind;
26
+ readonly measure: (state: S, cycle: number) => number;
27
+ readonly guards?: LoopGuards;
28
+ }
29
+ /** Fan-in join policies — all four ship in v1 (design D9). Wired by L07 `fanIn`. */
30
+ export type JoinPolicy = "barrier" | "race" | "quorum" | "reduce";
31
+ /** Seatbelt guards layered under the variant (design D3): ceiling, wall-clock, token budget. */
32
+ export interface LoopGuards {
33
+ readonly maxIterations?: number;
34
+ readonly wallClockMs?: number;
35
+ readonly tokenBudget?: number;
36
+ }
37
+ /** Discriminated stop reason; extends the fixLoop stops with `budget-exhausted`/`cancelled` (design D3). */
38
+ export type LoopStopReason = "converged" | "unfixable" | "stuck" | "timeout" | "ceiling" | "budget-exhausted" | "cancelled";
39
+ /** Outcome of a completed loop run. */
40
+ export interface LoopOutcome<S = unknown> {
41
+ readonly state: S;
42
+ readonly stopReason: LoopStopReason;
43
+ readonly iterations: number;
44
+ }
45
+ /**
46
+ * Per-cycle observability report emitted after each completed cycle when `onCycle` is set. The
47
+ * `measure` comes from the loop variant (the L05 manifest projection), so a record fed straight to
48
+ * `WorkflowMonitor.recordCycle` stays consistent with the termination variant (spec
49
+ * execution-observability). `usage` omitted ⇒ the backend reported none this cycle.
50
+ */
51
+ export interface LoopCycleReport {
52
+ readonly iteration: number;
53
+ readonly measure: number;
54
+ readonly usage?: Usage;
55
+ readonly contextPressure?: LoopContextPressure;
56
+ }
57
+ /** Flow setup supplied to a run; `overrides` is how tests inject fake accessors (flow-runtime spec). */
58
+ export interface LoopRunOptions {
59
+ readonly args?: readonly string[];
60
+ readonly overrides?: FlowOverrides;
61
+ readonly context?: LoopExecutionContextOptions;
62
+ /** Optional observability hook; receives a {@link LoopCycleReport} after each completed cycle. */
63
+ readonly onCycle?: (cycle: LoopCycleReport) => void;
64
+ }
65
+ /** A `.run()` fails either at build (unguarded back-edge) or at runtime (a step/reason error). */
66
+ export type LoopRunError = RuntimeError | TerminationContractError;
67
+ /**
68
+ * Chainable loop builder. The single-cycle case reads like a guarded `while` and needs no
69
+ * graph/fan-out/Effect knowledge. `.reason()` is the single LLM verb; `.step()` is a
70
+ * deterministic transform; `.measure()`/`.until()` set the termination variant; `.guard()`
71
+ * adds seatbelts. `.run()` lowers to `flow()` + loop execution.
72
+ */
73
+ export interface LoopBuilder<S = unknown> {
74
+ /** The single LLM verb. Drives a backend autonomously each cycle; hides the conversation. */
75
+ reason<B extends BackendTag, Output = unknown>(backend: LlmBackend<B>, request: AutonomousRequest<Output, B>): LoopBuilder<S>;
76
+ /** A deterministic step that transforms the threaded loop state. */
77
+ step(name: string, body: (state: S) => Promise<S> | S): LoopBuilder<S>;
78
+ /** Power-user variant override (design D3); takes precedence over a preset. */
79
+ measure(fn: (state: S) => Promise<number> | number): LoopBuilder<S>;
80
+ /** Set the termination variant from a preset archetype or a custom variant. */
81
+ until(termination: TerminationPreset<S> | LoopVariant<S>): LoopBuilder<S>;
82
+ /** Layer seatbelt guards under the variant. */
83
+ guard(opts: LoopGuards): LoopBuilder<S>;
84
+ /** Build (enforcing the termination contract) then run; returns the outcome and a stop reason. */
85
+ run(initial?: S, options?: LoopRunOptions): Promise<Result<LoopOutcome<S>, LoopRunError>>;
86
+ }
87
+ /** State projection read by the `untilGatesGreen` preset. */
88
+ export interface GatesState {
89
+ /** Failing tests/gates remaining; the loop converges as this reaches `0`. */
90
+ readonly failingGates: number;
91
+ }
92
+ /** State projection read by the `untilConfident` preset. */
93
+ export interface ConfidenceState {
94
+ /** Confidence in `[0, 1]`; the loop converges once it reaches the threshold. */
95
+ readonly confidence: number;
96
+ }
97
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/loop/builder/types.ts"],"names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,CAAC,GACpC,WAAW,CAAC,CAAC,CAAC,CAAC;IAClB,oEAAoE;IACpE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACvE,+EAA+E;IAC/E,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACpE,+EAA+E;IAC/E,KAAK,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC1E,+CAA+C;IAC/C,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACxC,kGAAkG;IAClG,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;CAC3F;AAED,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1,38 @@
1
+ import type { CompactionConfig } from "./types.ts";
2
+ /**
3
+ * Aggressive defaults applied once managed context is enabled (design D10): a small working window
4
+ * and an aggressive offload threshold. Authors MAY raise these, but enabled context gets tight
5
+ * defaults out of the box.
6
+ */
7
+ export declare const DEFAULT_COMPACTION_CONFIG: CompactionConfig;
8
+ /** The escalating compaction stages, lowest pressure first. */
9
+ export type CompactionStage = "mask" | "prune" | "summarize";
10
+ /** One unit of loop context — a tool/step observation the agent may later read. */
11
+ export interface Observation {
12
+ /** Stable identifier, preserved through masking so the record of the step survives. */
13
+ readonly id: string;
14
+ /** The observation body; what masking and summarization compress. */
15
+ readonly content: string;
16
+ /** Pinned observations (goal, manifest) are never compacted. */
17
+ readonly pinned?: boolean;
18
+ /** Precise token cost; defaults to a ~4-chars-per-token estimate of `content`. */
19
+ readonly tokens?: number;
20
+ }
21
+ export interface CompactionResult {
22
+ /** The compacted context: pinned, then the compacted history span, then the verbatim recent tail. */
23
+ readonly observations: readonly Observation[];
24
+ /** Stages applied, in order — empty when there was no pressure, up to all three under heavy load. */
25
+ readonly stagesApplied: readonly CompactionStage[];
26
+ readonly tokensBefore: number;
27
+ readonly tokensAfter: number;
28
+ }
29
+ /** Crude token estimate from character length; shared so masking/summary budgets stay consistent. */
30
+ export declare function estimateTokens(text: string): number;
31
+ /**
32
+ * Compact `observations` to fit the small working window, escalating mask → prune → summarize only
33
+ * as far as the token pressure requires. Pure: returns a new context plus the stages it applied. The
34
+ * result is kept within `config.workingWindowTokens` except when a single un-offloaded recent
35
+ * observation alone exceeds the window — offload oversized outputs (see ./offload.ts) to avoid that.
36
+ */
37
+ export declare function compact(observations: readonly Observation[], config?: CompactionConfig): CompactionResult;
38
+ //# sourceMappingURL=compaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../../src/loop/context/compaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA+BnD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAGvC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AAE7D,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,qGAAqG;IACrG,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,SAAS,eAAe,EAAE,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,qGAAqG;AACrG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAUD;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,GAAE,gBAA4C,GACnD,gBAAgB,CA+BlB"}
@@ -0,0 +1,4 @@
1
+ export * from "./types.ts";
2
+ export * from "./compaction.ts";
3
+ export * from "./offload.ts";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loop/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type Result } from "neverthrow";
2
+ import type { RuntimeError } from "../../model/index.ts";
3
+ import { type FsTool } from "../../tools/index.ts";
4
+ import type { OffloadPointer } from "./types.ts";
5
+ export interface OffloadOptions {
6
+ /** Working root; scratch payloads land under `<root>/.orca/scratch/`. */
7
+ readonly root: string;
8
+ /** Char length above which an output is offloaded; defaults to the aggressive D10 default. */
9
+ readonly thresholdChars?: number;
10
+ /** Injectable filesystem for tests; defaults to the real adapter. */
11
+ readonly fsTool?: FsTool;
12
+ }
13
+ /**
14
+ * What interception did to one output: either it stayed inline (under threshold), or its body was
15
+ * offloaded and replaced by a short `ref` string plus the structured `pointer` to resolve later.
16
+ */
17
+ export type OffloadOutcome = {
18
+ readonly offloaded: false;
19
+ readonly content: string;
20
+ } | {
21
+ readonly offloaded: true;
22
+ readonly ref: string;
23
+ readonly pointer: OffloadPointer;
24
+ };
25
+ export interface OffloadStore {
26
+ /** Route one output: offload + return a pointer ref when oversized, otherwise pass it through. */
27
+ intercept(output: string): Promise<Result<OffloadOutcome, RuntimeError>>;
28
+ /** Resolve a pointer back to the full payload written at offload time. */
29
+ resolve(pointer: OffloadPointer): Promise<Result<string, RuntimeError>>;
30
+ }
31
+ /** The short reference injected into context in place of an offloaded payload. */
32
+ export declare function offloadRef(pointer: OffloadPointer): string;
33
+ export declare function createOffloadStore(options: OffloadOptions): OffloadStore;
34
+ //# sourceMappingURL=offload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offload.d.ts","sourceRoot":"","sources":["../../../src/loop/context/offload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQjD,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAEzF,MAAM,WAAW,YAAY;IAC3B,kGAAkG;IAClG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;IACzE,0EAA0E;IAC1E,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACzE;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,CAwBxE"}
@@ -0,0 +1,13 @@
1
+ /** Tunable thresholds; aggressive defaults apply once managed context is enabled (design D10). */
2
+ export interface CompactionConfig {
3
+ /** Small working-memory window: token pressure above which staged compaction begins. */
4
+ readonly workingWindowTokens: number;
5
+ /** Char length above which an output is offloaded to a scratch file + pointer. */
6
+ readonly offloadThresholdChars: number;
7
+ }
8
+ /** Pointer to an offloaded oversized output; resolves back to the full payload (see ./offload.ts). */
9
+ export interface OffloadPointer {
10
+ readonly path: string;
11
+ readonly bytes: number;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/loop/context/types.ts"],"names":[],"mappings":"AAIA,kGAAkG;AAClG,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,kFAAkF;IAClF,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC;AAED,sGAAsG;AACtG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,21 @@
1
+ import { Effect } from "effect";
2
+ import { type Result } from "neverthrow";
3
+ /** Inward bridge: lift a neverthrow `Result` into the Effect world. */
4
+ export declare function fromResult<A, E>(result: Result<A, E>): Effect.Effect<A, E>;
5
+ /** Outward bridge: collapse an Effect's typed failure channel into a `Result`, still inside Effect. */
6
+ export declare function toResult<A, E>(effect: Effect.Effect<A, E>): Effect.Effect<Result<A, E>>;
7
+ export interface RunOptions {
8
+ /** When provided, aborting the signal interrupts the run; the resulting interruption becomes `err`. */
9
+ readonly signal?: AbortSignal;
10
+ }
11
+ /**
12
+ * Boundary runner — the single place an engine Effect is executed. Returns a `Result` and never
13
+ * throws an Effect, `Cause`, or interruption: typed failures become `err`, and interruption /
14
+ * defects are squashed into `err`, so no Effect type or `Cause` escapes the facade.
15
+ *
16
+ * Note on cancellation: engine work that wants a graceful `cancelled` outcome wires its own
17
+ * `AbortSignal` through `runCancellable` (which converts cancellation into a success value).
18
+ * The `signal` here is the blunt alternative — hard interruption surfaced as `err`.
19
+ */
20
+ export declare function runToResult<A, E>(effect: Effect.Effect<A, E>, options?: RunOptions): Promise<Result<A, E | Error>>;
21
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../src/loop/engine/bridge.ts"],"names":[],"mappings":"AAQA,OAAO,EAAS,MAAM,EAAgB,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAElD,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAK1E;AAED,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAIvF;AAED,MAAM,WAAW,UAAU;IACzB,uGAAuG;IACvG,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,CAAC,EACpC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAS/B"}
@@ -0,0 +1,73 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import type { LoopStopReason } from "../builder/types.ts";
3
+ import type { Result } from "neverthrow";
4
+ import { type FlowContext } from "../../flow/context.ts";
5
+ export * from "./bridge.ts";
6
+ /** Engine-internal outcome; the builder (L06) maps this to the public Effect-free `LoopOutcome`. */
7
+ export interface EngineOutcome<S> {
8
+ readonly state: S;
9
+ readonly stopReason: LoopStopReason;
10
+ readonly iterations: number;
11
+ readonly measure: number;
12
+ }
13
+ /** One loop iteration as an internal Effect; the builder bridges plain step bodies inward via `fromResult`. */
14
+ export type IterationStep<S, R = never> = (state: S, iteration: number) => Effect.Effect<S, Error, R>;
15
+ export interface RecurrenceSpec<S, R = never> {
16
+ readonly initial: S;
17
+ readonly iterate: IterationStep<S, R>;
18
+ /** Loop variant (design D3): a measure bounded below that the loop drives toward `floor`. */
19
+ readonly measure: (state: S) => number;
20
+ /** Convergence floor; default 0. */
21
+ readonly floor?: number;
22
+ /** Iteration-ceiling seatbelt; default unbounded (termination then rests on the variant). */
23
+ readonly maxIterations?: number;
24
+ }
25
+ /**
26
+ * Drive a stateful loop to convergence. The body runs at least once; the variant measure is
27
+ * checked after each iteration against the convergence floor and iteration ceiling, so whichever
28
+ * limit trips first stops the loop — `converged` when the measure won, `ceiling` otherwise.
29
+ */
30
+ export declare function runRecurrence<S, R = never>(spec: RecurrenceSpec<S, R>): Effect.Effect<EngineOutcome<S>, Error, R>;
31
+ export interface BranchesSpec<A> {
32
+ readonly branches: readonly Effect.Effect<A, Error>[];
33
+ /** Bounded fan-out width (design D2/D8: in-process, ~3-10). */
34
+ readonly concurrency: number;
35
+ }
36
+ /**
37
+ * Run branches with bounded structured concurrency. This is the single concurrency primitive
38
+ * L07's `fanOut`/`fanIn` build on: interrupting the parent fiber interrupts every in-flight
39
+ * branch automatically (Effect structured concurrency), which is what `runCancellable` exploits.
40
+ */
41
+ export declare function runBranches<A>(spec: BranchesSpec<A>): Effect.Effect<readonly A[], Error>;
42
+ /**
43
+ * Plain-boundary bounded fan-out — the Effect-free seam L07's `fanOut` builds on (design D2). Each
44
+ * thunk is a self-contained unit of branch work that resolves to its own outcome value and MUST
45
+ * NOT reject: the caller captures branch success/failure AS DATA so a partial-failure policy can
46
+ * weigh it, and a thunk that throws anyway is squashed into the outer `err`. Branches run with the
47
+ * given concurrency cap (`runBranches` ⇒ `Effect.all { concurrency }`); an aborted `signal` hard-
48
+ * interrupts every in-flight branch via structured concurrency and surfaces as `err`. Returning a
49
+ * `Result` here means `src/loop/fanout.ts` never names an Effect type — Effect stays in the engine.
50
+ */
51
+ export declare function runBoundedBranches<A>(thunks: readonly (() => Promise<A>)[], concurrency: number, signal?: AbortSignal): Promise<Result<readonly A[], Error>>;
52
+ /**
53
+ * Make a unit of engine work cancellable by an `AbortSignal`. When the signal fires, the cancel
54
+ * branch wins the race and the `work` fiber — together with any in-flight fan-out children under
55
+ * it — is interrupted via structured concurrency; `onCancel()` then produces a `cancelled`
56
+ * outcome (it is a thunk so the caller can fold in last-known/partial state). With no signal the
57
+ * work runs unchanged.
58
+ */
59
+ export declare function runCancellable<S>(work: Effect.Effect<EngineOutcome<S>, Error>, onCancel: () => EngineOutcome<S>, signal?: AbortSignal): Effect.Effect<EngineOutcome<S>, Error>;
60
+ /** Engine-internal DI tag carrying the plain `FlowContext` snapshot. */
61
+ export declare const FlowContextTag: Context.Tag<FlowContext, FlowContext>;
62
+ /** Build a Layer providing a captured `FlowContext` snapshot to engine effects. */
63
+ export declare function flowContextLayer(context: FlowContext): Layer.Layer<FlowContext>;
64
+ /**
65
+ * Provide the ambient flow context to an engine effect. The snapshot is read with the plain,
66
+ * Effect-free `currentFlowContext()` accessor at the boundary and handed to the engine as a
67
+ * Layer — so DI is Effect `Layer` internally while the authoring accessors stay plain.
68
+ */
69
+ export declare function withAmbientFlowContext<A, E>(effect: Effect.Effect<A, E, FlowContext>): Effect.Effect<A, E>;
70
+ export declare const engineFs: Effect.Effect<import("../../index.ts").FsTool, never, FlowContext>;
71
+ export declare const engineGit: Effect.Effect<import("../../index.ts").GitTool, never, FlowContext>;
72
+ export declare const engineLlm: Effect.Effect<import("../../index.ts").LlmTool, never, FlowContext>;
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loop/engine/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG7E,cAAc,aAAa,CAAC;AAE5B,oGAAoG;AACpG,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;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