@goah/cli 0.13.0 → 0.13.2

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 (236) hide show
  1. package/dist/LICENSE +201 -0
  2. package/dist/THIRD-PARTY-NOTICES.md +2319 -0
  3. package/dist/anthropic-messages-WBFOHES5.js +7214 -0
  4. package/dist/azure-openai-responses-NZFH3PO6.js +253 -0
  5. package/dist/chunk-25XSBFX6.js +639 -0
  6. package/dist/chunk-2QBQZGXF.js +110 -0
  7. package/dist/chunk-2ZP2NBW3.js +345 -0
  8. package/dist/chunk-4KA63VNZ.js +2 -0
  9. package/dist/chunk-4M6TXTT5.js +86 -0
  10. package/dist/chunk-4US7ZHT3.js +20 -0
  11. package/dist/chunk-6M3OOCKO.js +11809 -0
  12. package/dist/chunk-7AXAFDPG.js +17 -0
  13. package/dist/chunk-7E7V6OIU.js +920 -0
  14. package/dist/chunk-BXA47DTF.js +548 -0
  15. package/dist/chunk-D2DVAH37.js +25 -0
  16. package/dist/chunk-FSBUS2BI.js +26 -0
  17. package/dist/chunk-GKDRAHLI.js +4787 -0
  18. package/dist/chunk-H462EFJP.js +89 -0
  19. package/dist/chunk-IIJQ3DW4.js +35 -0
  20. package/dist/chunk-JQD5EWJY.js +34 -0
  21. package/dist/chunk-K26BVR6O.js +61 -0
  22. package/dist/chunk-KAO7WIXG.js +31 -0
  23. package/dist/chunk-KJ4HJCTK.js +1178 -0
  24. package/dist/chunk-LBKI23CC.js +9810 -0
  25. package/dist/chunk-LKBKZEHT.js +41 -0
  26. package/dist/chunk-MD7TLTXZ.js +18 -0
  27. package/dist/chunk-MPXK7QBL.js +868 -0
  28. package/dist/chunk-NRLGWZJC.js +11 -0
  29. package/dist/chunk-QBD6EJ2Z.js +1746 -0
  30. package/dist/chunk-R6I3VKME.js +132 -0
  31. package/dist/chunk-TJON22J4.js +87 -0
  32. package/dist/chunk-ULY36ME4.js +33097 -0
  33. package/dist/chunk-XALZLRYK.js +9221 -0
  34. package/dist/chunk-XPQKM3L7.js +57 -0
  35. package/dist/chunk-YH6YJ2IB.js +1773 -0
  36. package/dist/cli.d.ts +0 -2
  37. package/dist/cli.js +13716 -580
  38. package/dist/console/assets/{index-Rtc_B7cs.js → index-B1vGMXKr.js} +11 -11
  39. package/dist/console/assets/{index-Rtc_B7cs.js.map → index-B1vGMXKr.js.map} +1 -1
  40. package/dist/console/index.html +1 -1
  41. package/dist/dist-65MDQA4Q.js +1126 -0
  42. package/dist/dist-KNR2XL6J.js +39 -0
  43. package/dist/execution.d.ts +557 -2
  44. package/dist/execution.js +37 -2
  45. package/dist/faux-runner-worker.js +128 -0
  46. package/dist/google-generative-ai-YMHXZSFE.js +422 -0
  47. package/dist/google-vertex-X6DB3ZQ6.js +471 -0
  48. package/dist/index.d.ts +853 -25
  49. package/dist/index.js +84 -385
  50. package/dist/kernel.d.ts +39 -2
  51. package/dist/kernel.js +21 -2
  52. package/dist/mistral-conversations-TY3MMD6G.js +718 -0
  53. package/dist/multipart-parser-F6M4NJZU.js +373 -0
  54. package/dist/openai-codex-responses-BRDUMLN5.js +1374 -0
  55. package/dist/openai-completions-CX634XN3.js +1139 -0
  56. package/dist/openai-responses-HMCXJIHT.js +300 -0
  57. package/dist/openrouter-images-KTWET2H2.js +148 -0
  58. package/dist/pi-messages-XL5OEC4K.js +307 -0
  59. package/dist/pi-worker.js +671 -0
  60. package/dist/runner-pi.d.ts +342 -2
  61. package/dist/runner-pi.js +46 -2
  62. package/dist/runner-registry-GD4BYCQC.js +22 -0
  63. package/dist/sqlite.d.ts +446 -2
  64. package/dist/sqlite.js +15 -2
  65. package/dist/src-F2KBSV4T.js +1398 -0
  66. package/dist/supervisor.d.ts +625 -2
  67. package/dist/supervisor.js +39 -2
  68. package/dist/testkit.d.ts +564 -2
  69. package/dist/testkit.js +127 -2
  70. package/dist/transcript.d.ts +84 -2
  71. package/dist/transcript.js +25 -2
  72. package/dist/verification-worker.js +72 -0
  73. package/package.json +2 -26
  74. package/dist/cli.d.ts.map +0 -1
  75. package/dist/cli.js.map +0 -1
  76. package/dist/control.d.ts +0 -106
  77. package/dist/control.d.ts.map +0 -1
  78. package/dist/control.js +0 -242
  79. package/dist/control.js.map +0 -1
  80. package/dist/execution.d.ts.map +0 -1
  81. package/dist/execution.js.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/index.js.map +0 -1
  84. package/dist/kernel.d.ts.map +0 -1
  85. package/dist/kernel.js.map +0 -1
  86. package/dist/live-config.d.ts +0 -10
  87. package/dist/live-config.d.ts.map +0 -1
  88. package/dist/live-config.js +0 -44
  89. package/dist/live-config.js.map +0 -1
  90. package/dist/prompt-queue.d.ts +0 -13
  91. package/dist/prompt-queue.d.ts.map +0 -1
  92. package/dist/prompt-queue.js +0 -35
  93. package/dist/prompt-queue.js.map +0 -1
  94. package/dist/runner-pi.d.ts.map +0 -1
  95. package/dist/runner-pi.js.map +0 -1
  96. package/dist/runner-registry.d.ts +0 -8
  97. package/dist/runner-registry.d.ts.map +0 -1
  98. package/dist/runner-registry.js +0 -12
  99. package/dist/runner-registry.js.map +0 -1
  100. package/dist/searchable-select.d.ts +0 -24
  101. package/dist/searchable-select.d.ts.map +0 -1
  102. package/dist/searchable-select.js +0 -61
  103. package/dist/searchable-select.js.map +0 -1
  104. package/dist/secret-input.d.ts +0 -8
  105. package/dist/secret-input.d.ts.map +0 -1
  106. package/dist/secret-input.js +0 -14
  107. package/dist/secret-input.js.map +0 -1
  108. package/dist/setup-wizard.d.ts +0 -22
  109. package/dist/setup-wizard.d.ts.map +0 -1
  110. package/dist/setup-wizard.js +0 -154
  111. package/dist/setup-wizard.js.map +0 -1
  112. package/dist/sqlite.d.ts.map +0 -1
  113. package/dist/sqlite.js.map +0 -1
  114. package/dist/supervisor.d.ts.map +0 -1
  115. package/dist/supervisor.js.map +0 -1
  116. package/dist/testkit.d.ts.map +0 -1
  117. package/dist/testkit.js.map +0 -1
  118. package/dist/thread-inspect.d.ts +0 -47
  119. package/dist/thread-inspect.d.ts.map +0 -1
  120. package/dist/thread-inspect.js +0 -78
  121. package/dist/thread-inspect.js.map +0 -1
  122. package/dist/transcript.d.ts.map +0 -1
  123. package/dist/transcript.js.map +0 -1
  124. package/dist/tui-theme.d.ts +0 -17
  125. package/dist/tui-theme.d.ts.map +0 -1
  126. package/dist/tui-theme.js +0 -19
  127. package/dist/tui-theme.js.map +0 -1
  128. package/dist/tui.d.ts +0 -24
  129. package/dist/tui.d.ts.map +0 -1
  130. package/dist/tui.js +0 -784
  131. package/dist/tui.js.map +0 -1
  132. package/dist/update.d.ts +0 -16
  133. package/dist/update.d.ts.map +0 -1
  134. package/dist/update.js +0 -67
  135. package/dist/update.js.map +0 -1
  136. package/dist/web-console.d.ts +0 -33
  137. package/dist/web-console.d.ts.map +0 -1
  138. package/dist/web-console.js +0 -242
  139. package/dist/web-console.js.map +0 -1
  140. package/dist/welcome.d.ts +0 -30
  141. package/dist/welcome.d.ts.map +0 -1
  142. package/dist/welcome.js +0 -69
  143. package/dist/welcome.js.map +0 -1
  144. package/node_modules/goah-ledger-contract/dist/execution.d.ts +0 -544
  145. package/node_modules/goah-ledger-contract/dist/execution.d.ts.map +0 -1
  146. package/node_modules/goah-ledger-contract/dist/execution.js +0 -52
  147. package/node_modules/goah-ledger-contract/dist/execution.js.map +0 -1
  148. package/node_modules/goah-ledger-contract/dist/index.d.ts +0 -4
  149. package/node_modules/goah-ledger-contract/dist/index.d.ts.map +0 -1
  150. package/node_modules/goah-ledger-contract/dist/index.js +0 -4
  151. package/node_modules/goah-ledger-contract/dist/index.js.map +0 -1
  152. package/node_modules/goah-ledger-contract/dist/kernel.d.ts +0 -37
  153. package/node_modules/goah-ledger-contract/dist/kernel.d.ts.map +0 -1
  154. package/node_modules/goah-ledger-contract/dist/kernel.js +0 -8
  155. package/node_modules/goah-ledger-contract/dist/kernel.js.map +0 -1
  156. package/node_modules/goah-ledger-contract/dist/transcript.d.ts +0 -63
  157. package/node_modules/goah-ledger-contract/dist/transcript.d.ts.map +0 -1
  158. package/node_modules/goah-ledger-contract/dist/transcript.js +0 -115
  159. package/node_modules/goah-ledger-contract/dist/transcript.js.map +0 -1
  160. package/node_modules/goah-ledger-contract/package.json +0 -28
  161. package/node_modules/goah-ledger-sqlite/dist/index.d.ts +0 -86
  162. package/node_modules/goah-ledger-sqlite/dist/index.d.ts.map +0 -1
  163. package/node_modules/goah-ledger-sqlite/dist/index.js +0 -1254
  164. package/node_modules/goah-ledger-sqlite/dist/index.js.map +0 -1
  165. package/node_modules/goah-ledger-sqlite/package.json +0 -26
  166. package/node_modules/goah-runner-pi/dist/configurator.d.ts +0 -20
  167. package/node_modules/goah-runner-pi/dist/configurator.d.ts.map +0 -1
  168. package/node_modules/goah-runner-pi/dist/configurator.js +0 -423
  169. package/node_modules/goah-runner-pi/dist/configurator.js.map +0 -1
  170. package/node_modules/goah-runner-pi/dist/credential-store.d.ts +0 -14
  171. package/node_modules/goah-runner-pi/dist/credential-store.d.ts.map +0 -1
  172. package/node_modules/goah-runner-pi/dist/credential-store.js +0 -163
  173. package/node_modules/goah-runner-pi/dist/credential-store.js.map +0 -1
  174. package/node_modules/goah-runner-pi/dist/env-spec.d.ts +0 -17
  175. package/node_modules/goah-runner-pi/dist/env-spec.d.ts.map +0 -1
  176. package/node_modules/goah-runner-pi/dist/env-spec.js +0 -95
  177. package/node_modules/goah-runner-pi/dist/env-spec.js.map +0 -1
  178. package/node_modules/goah-runner-pi/dist/index.d.ts +0 -76
  179. package/node_modules/goah-runner-pi/dist/index.d.ts.map +0 -1
  180. package/node_modules/goah-runner-pi/dist/index.js +0 -326
  181. package/node_modules/goah-runner-pi/dist/index.js.map +0 -1
  182. package/node_modules/goah-runner-pi/dist/model-provider.d.ts +0 -30
  183. package/node_modules/goah-runner-pi/dist/model-provider.d.ts.map +0 -1
  184. package/node_modules/goah-runner-pi/dist/model-provider.js +0 -96
  185. package/node_modules/goah-runner-pi/dist/model-provider.js.map +0 -1
  186. package/node_modules/goah-runner-pi/dist/pi-worker.d.ts +0 -31
  187. package/node_modules/goah-runner-pi/dist/pi-worker.d.ts.map +0 -1
  188. package/node_modules/goah-runner-pi/dist/pi-worker.js +0 -579
  189. package/node_modules/goah-runner-pi/dist/pi-worker.js.map +0 -1
  190. package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts +0 -2
  191. package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts.map +0 -1
  192. package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js +0 -3
  193. package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js.map +0 -1
  194. package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts +0 -2
  195. package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts.map +0 -1
  196. package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js +0 -5
  197. package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js.map +0 -1
  198. package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts +0 -2
  199. package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts.map +0 -1
  200. package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js +0 -5
  201. package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js.map +0 -1
  202. package/node_modules/goah-runner-pi/dist/test-helpers.d.ts +0 -4
  203. package/node_modules/goah-runner-pi/dist/test-helpers.d.ts.map +0 -1
  204. package/node_modules/goah-runner-pi/dist/test-helpers.js +0 -13
  205. package/node_modules/goah-runner-pi/dist/test-helpers.js.map +0 -1
  206. package/node_modules/goah-runner-pi/dist/verification-worker.d.ts +0 -2
  207. package/node_modules/goah-runner-pi/dist/verification-worker.d.ts.map +0 -1
  208. package/node_modules/goah-runner-pi/dist/verification-worker.js +0 -46
  209. package/node_modules/goah-runner-pi/dist/verification-worker.js.map +0 -1
  210. package/node_modules/goah-runner-pi/package.json +0 -28
  211. package/node_modules/goah-supervisor/dist/context-view.d.ts +0 -30
  212. package/node_modules/goah-supervisor/dist/context-view.d.ts.map +0 -1
  213. package/node_modules/goah-supervisor/dist/context-view.js +0 -58
  214. package/node_modules/goah-supervisor/dist/context-view.js.map +0 -1
  215. package/node_modules/goah-supervisor/dist/index.d.ts +0 -96
  216. package/node_modules/goah-supervisor/dist/index.d.ts.map +0 -1
  217. package/node_modules/goah-supervisor/dist/index.js +0 -1075
  218. package/node_modules/goah-supervisor/dist/index.js.map +0 -1
  219. package/node_modules/goah-supervisor/dist/roles.d.ts +0 -4
  220. package/node_modules/goah-supervisor/dist/roles.d.ts.map +0 -1
  221. package/node_modules/goah-supervisor/dist/roles.js +0 -29
  222. package/node_modules/goah-supervisor/dist/roles.js.map +0 -1
  223. package/node_modules/goah-supervisor/dist/verification.d.ts +0 -61
  224. package/node_modules/goah-supervisor/dist/verification.d.ts.map +0 -1
  225. package/node_modules/goah-supervisor/dist/verification.js +0 -135
  226. package/node_modules/goah-supervisor/dist/verification.js.map +0 -1
  227. package/node_modules/goah-supervisor/package.json +0 -26
  228. package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts +0 -2
  229. package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts.map +0 -1
  230. package/node_modules/goah-testkit/dist/faux-runner-worker.js +0 -82
  231. package/node_modules/goah-testkit/dist/faux-runner-worker.js.map +0 -1
  232. package/node_modules/goah-testkit/dist/index.d.ts +0 -49
  233. package/node_modules/goah-testkit/dist/index.d.ts.map +0 -1
  234. package/node_modules/goah-testkit/dist/index.js +0 -96
  235. package/node_modules/goah-testkit/dist/index.js.map +0 -1
  236. package/node_modules/goah-testkit/package.json +0 -29
@@ -1,37 +0,0 @@
1
- export declare const CONTRACT_VERSION: "0.13.0";
2
- export declare const CONTRACT_STABILITY: "experimental";
3
- export type JsonPrimitive = string | number | boolean | null;
4
- export type JsonValue = JsonPrimitive | JsonValue[] | {
5
- [key: string]: JsonValue;
6
- };
7
- /** One append request. Sequence numbers are assigned by the ledger. */
8
- export interface EventInput {
9
- streamId: string;
10
- ts: string;
11
- actor: string;
12
- type: string;
13
- data: JsonValue;
14
- /** An unfamiliar reader may skip this event without changing replay semantics. */
15
- ignorable?: true;
16
- }
17
- /** One immutable fact in the global ledger and in one logical stream. */
18
- export interface EventRecord extends EventInput {
19
- seq: number;
20
- streamSeq: number;
21
- }
22
- export interface EventStore {
23
- appendEvent(input: EventInput): EventRecord;
24
- appendEvents(inputs: EventInput[]): EventRecord[];
25
- readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
26
- eventsSince(seq: number, types?: string[]): EventRecord[];
27
- events(): EventRecord[];
28
- }
29
- export interface Clock {
30
- now(): Date;
31
- }
32
- export declare function wakeStream(wakeId: string): string;
33
- export declare function controlStream(actor?: string): string;
34
- export declare function goalStream(goalId: string): string;
35
- export declare function workRecordStream(goalId: string): string;
36
- export declare function memoryStream(agent: string): string;
37
- //# sourceMappingURL=kernel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,QAAiB,CAAC;AAClD,eAAO,MAAM,kBAAkB,EAAG,cAAuB,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEnF,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,kFAAkF;IAClF,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,yEAAyE;AACzE,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;IAC5C,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;IAClD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IACpE,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAC1D,MAAM,IAAI,WAAW,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,KAAK;IAAG,GAAG,IAAI,IAAI,CAAA;CAAE;AAEtC,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAA6B;AAC/E,wBAAgB,aAAa,CAAC,KAAK,SAAe,GAAG,MAAM,CAA+B;AAC1F,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAA6B;AAC/E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAoC;AAC5F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAA8B"}
@@ -1,8 +0,0 @@
1
- export const CONTRACT_VERSION = "0.13.0";
2
- export const CONTRACT_STABILITY = "experimental";
3
- export function wakeStream(wakeId) { return `wake:${wakeId}`; }
4
- export function controlStream(actor = "supervisor") { return `control:${actor}`; }
5
- export function goalStream(goalId) { return `goal:${goalId}`; }
6
- export function workRecordStream(goalId) { return `work-record:${goalId}`; }
7
- export function memoryStream(agent) { return `memory:${agent}`; }
8
- //# sourceMappingURL=kernel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAuB,CAAC;AAgC1D,MAAM,UAAU,UAAU,CAAC,MAAc,IAAY,OAAO,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/E,MAAM,UAAU,aAAa,CAAC,KAAK,GAAG,YAAY,IAAY,OAAO,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC;AAC1F,MAAM,UAAU,UAAU,CAAC,MAAc,IAAY,OAAO,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/E,MAAM,UAAU,gBAAgB,CAAC,MAAc,IAAY,OAAO,eAAe,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5F,MAAM,UAAU,YAAY,CAAC,KAAa,IAAY,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC"}
@@ -1,63 +0,0 @@
1
- import type { EventInput, EventRecord, JsonValue } from "./kernel.js";
2
- export declare const TRANSCRIPT_FORMAT_VERSION = 1;
3
- export declare const TRANSCRIPT_MIN_READABLE_VERSION = 0;
4
- export type TranscriptEventType = "transcript.started" | "request.prepared" | "turn.started" | "message.user" | "message.assistant.delta" | "message.assistant.completed" | "tool.called" | "tool.completed" | "context.compacted" | "turn.completed" | "transcript.completed" | "transcript.interrupted";
5
- export interface TranscriptStarted {
6
- formatVersion: typeof TRANSCRIPT_FORMAT_VERSION;
7
- provider: string;
8
- model: string;
9
- runner: string;
10
- contextWindowTokens: number;
11
- maxOutputTokensPerTurn: number;
12
- }
13
- export interface TranscriptMessage {
14
- id: string;
15
- role: "user" | "assistant" | "tool";
16
- content: JsonValue;
17
- toolCallId?: string;
18
- usage?: JsonValue;
19
- stopReason?: string;
20
- errorMessage?: string;
21
- }
22
- export interface RequestSnapshot {
23
- provider: string;
24
- model: string;
25
- systemPrompt: string;
26
- activeContext: string;
27
- messages: JsonValue[];
28
- tools: JsonValue[];
29
- modelConfig: JsonValue;
30
- sourceSeqs: number[];
31
- }
32
- export interface ReplayedTranscript {
33
- messages: TranscriptMessage[];
34
- status: "running" | "completed" | "interrupted";
35
- openToolCalls: Array<{
36
- callId: string;
37
- name: string;
38
- arguments: JsonValue;
39
- }>;
40
- lastRequest: RequestSnapshot | null;
41
- }
42
- export declare function isTranscriptEvent(event: Pick<EventRecord, "type">): event is EventRecord & {
43
- type: TranscriptEventType;
44
- };
45
- export declare class TranscriptFormatUnsupportedError extends Error {
46
- readonly foundVersion: number;
47
- readonly supportedVersion: number;
48
- constructor(foundVersion: number, supportedVersion?: number);
49
- }
50
- export declare class TranscriptEventUnsupportedError extends Error {
51
- readonly eventType: string;
52
- constructor(eventType: string);
53
- }
54
- export declare class TranscriptCorruptionError extends Error {
55
- constructor(message: string);
56
- }
57
- /** Import supported legacy records without rewriting the append-only source log. */
58
- export declare function upgradeTranscriptEvents(source: readonly EventRecord[]): EventRecord[];
59
- /** Rebuild the model-visible transcript from canonical, normalized transcript events. */
60
- export declare function replayTranscript(events: readonly EventRecord[]): ReplayedTranscript;
61
- /** Synthetic facts that close an interrupted Turn transcript without hiding unknown tool outcomes. */
62
- export declare function interruptedTranscriptEvents(events: readonly EventRecord[], ts: string, actor: string): EventInput[];
63
- //# sourceMappingURL=transcript.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtE,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,cAAc,GAAG,cAAc,GAAG,yBAAyB,GAAG,6BAA6B,GAAG,aAAa,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,wBAAwB,CAAC;AAC1S,MAAM,WAAW,iBAAiB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A;CAAE,CAAoE;AAE7L,qBAAa,gCAAiC,SAAQ,KAAK;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,gBAAgB;gBAA/C,YAAY,EAAE,MAAM,EAAW,gBAAgB,SAA4B;CACjG;AACD,qBAAa,+BAAgC,SAAQ,KAAK;IAAe,QAAQ,CAAC,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM;CAAmI;AACtO,qBAAa,yBAA0B,SAAQ,KAAK;gBAAe,OAAO,EAAE,MAAM;CAAgE;AAElJ,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAuBrF;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,kBAAkB,CA2BnF;AAED,sGAAsG;AACtG,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAOnH"}
@@ -1,115 +0,0 @@
1
- export const TRANSCRIPT_FORMAT_VERSION = 1;
2
- export const TRANSCRIPT_MIN_READABLE_VERSION = 0;
3
- const TRANSCRIPT_TYPES = new Set(["transcript.started", "request.prepared", "turn.started", "message.user", "message.assistant.delta", "message.assistant.completed", "tool.called", "tool.completed", "context.compacted", "turn.completed", "transcript.completed", "transcript.interrupted"]);
4
- export function isTranscriptEvent(event) { return TRANSCRIPT_TYPES.has(event.type); }
5
- export class TranscriptFormatUnsupportedError extends Error {
6
- foundVersion;
7
- supportedVersion;
8
- constructor(foundVersion, supportedVersion = TRANSCRIPT_FORMAT_VERSION) {
9
- super(`transcript format ${foundVersion} is unsupported by this harness (supports ${supportedVersion}); upgrade the harness`);
10
- this.foundVersion = foundVersion;
11
- this.supportedVersion = supportedVersion;
12
- this.name = "TranscriptFormatUnsupportedError";
13
- }
14
- }
15
- export class TranscriptEventUnsupportedError extends Error {
16
- eventType;
17
- constructor(eventType) {
18
- super(`required transcript event is unknown to this harness: ${eventType}`);
19
- this.eventType = eventType;
20
- this.name = "TranscriptEventUnsupportedError";
21
- }
22
- }
23
- export class TranscriptCorruptionError extends Error {
24
- constructor(message) { super(message); this.name = "TranscriptCorruptionError"; }
25
- }
26
- /** Import supported legacy records without rewriting the append-only source log. */
27
- export function upgradeTranscriptEvents(source) {
28
- assertContiguous(source);
29
- const starts = source.filter((event) => event.type === "transcript.started");
30
- if (starts.length === 0) {
31
- if (source.some((event) => isTranscriptNamespace(event.type)))
32
- throw new TranscriptCorruptionError("transcript events exist without transcript.started");
33
- return [...source];
34
- }
35
- if (starts.length !== 1)
36
- throw new TranscriptCorruptionError("turn transcript stream contains multiple transcript.started events");
37
- const rawVersion = field(starts[0].data, "formatVersion");
38
- let version = rawVersion === undefined ? 0 : Number(rawVersion);
39
- if (!Number.isSafeInteger(version) || version < TRANSCRIPT_MIN_READABLE_VERSION)
40
- throw new TranscriptCorruptionError(`invalid transcript format version: ${String(rawVersion)}`);
41
- if (version > TRANSCRIPT_FORMAT_VERSION)
42
- throw new TranscriptFormatUnsupportedError(version);
43
- let events = [...source];
44
- while (version < TRANSCRIPT_FORMAT_VERSION) {
45
- if (version === 0) {
46
- events = events.map((event) => event.type === "transcript.started" ? { ...event, data: { ...event.data, formatVersion: 1 } } : event);
47
- version = 1;
48
- }
49
- else
50
- throw new TranscriptFormatUnsupportedError(version);
51
- }
52
- for (const event of events) {
53
- if (!isTranscriptEvent(event) && isTranscriptNamespace(event.type) && event.ignorable !== true)
54
- throw new TranscriptEventUnsupportedError(event.type);
55
- }
56
- return events;
57
- }
58
- /** Rebuild the model-visible transcript from canonical, normalized transcript events. */
59
- export function replayTranscript(events) {
60
- const upgraded = upgradeTranscriptEvents(events);
61
- const messages = [];
62
- const calls = new Map();
63
- let status = "running";
64
- let lastRequest = null;
65
- for (const event of upgraded) {
66
- if (!isTranscriptEvent(event))
67
- continue;
68
- const data = event.data;
69
- if (event.type === "message.user" || event.type === "message.assistant.completed")
70
- messages.push(data.message);
71
- else if (event.type === "tool.called") {
72
- const call = { callId: String(data.callId), name: String(data.name), arguments: (data.arguments ?? null) };
73
- calls.set(call.callId, call);
74
- }
75
- else if (event.type === "tool.completed") {
76
- const callId = String(data.callId);
77
- calls.delete(callId);
78
- messages.push({ id: String(data.messageId ?? `tool:${callId}`), role: "tool", toolCallId: callId, content: (data.result ?? null) });
79
- }
80
- else if (event.type === "context.compacted") {
81
- const replaced = new Set(Array.isArray(data.replacedMessageIds) ? data.replacedMessageIds.map(String) : []);
82
- const kept = messages.filter((message) => !replaced.has(message.id));
83
- messages.splice(0, messages.length, ...kept);
84
- messages.unshift({ id: String(data.summaryMessageId), role: "user", content: String(data.summary) });
85
- }
86
- else if (event.type === "request.prepared")
87
- lastRequest = event.data;
88
- else if (event.type === "transcript.completed")
89
- status = "completed";
90
- else if (event.type === "transcript.interrupted")
91
- status = "interrupted";
92
- }
93
- return { messages, status, openToolCalls: [...calls.values()], lastRequest };
94
- }
95
- /** Synthetic facts that close an interrupted Turn transcript without hiding unknown tool outcomes. */
96
- export function interruptedTranscriptEvents(events, ts, actor) {
97
- const replayed = replayTranscript(events);
98
- if (replayed.status !== "running" || !events.some((event) => event.type === "transcript.started"))
99
- return [];
100
- const streamId = events[0].streamId;
101
- const repairs = replayed.openToolCalls.map((call) => ({ streamId, ts, actor, type: "tool.completed", data: { callId: call.callId, messageId: `repair:${call.callId}`, result: { outcome: "unknown", synthetic: true, reason: "runner interrupted before a durable result" } } }));
102
- repairs.push({ streamId, ts, actor, type: "transcript.interrupted", data: { reason: "runner interrupted" } });
103
- return repairs;
104
- }
105
- function assertContiguous(events) {
106
- let expected = events[0]?.streamSeq ?? 1;
107
- for (const event of events) {
108
- if (event.streamSeq !== expected)
109
- throw new TranscriptCorruptionError(`turn transcript stream gap: expected ${expected}, got ${event.streamSeq}`);
110
- expected += 1;
111
- }
112
- }
113
- function isTranscriptNamespace(type) { return ["transcript.", "request.", "turn.", "message.", "tool.", "context."].some((prefix) => type.startsWith(prefix)); }
114
- function field(value, key) { return value && typeof value === "object" && !Array.isArray(value) ? value[key] : undefined; }
115
- //# sourceMappingURL=transcript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcript.js","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAOjD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAsB,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,CAAC,CAAC,CAAC;AACtT,MAAM,UAAU,iBAAiB,CAAC,KAAgC,IAA0D,OAAO,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAA2B,CAAC,CAAC,CAAC,CAAC;AAE7L,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IACpC;IAA+B;IAApD,YAAqB,YAAoB,EAAW,mBAAmB,yBAAyB;QAAI,KAAK,CAAC,qBAAqB,YAAY,6CAA6C,gBAAgB,wBAAwB,CAAC,CAAC;QAA7M,iBAAY,GAAZ,YAAY,CAAQ;QAAW,qBAAgB,GAAhB,gBAAgB,CAA4B;QAAmI,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IAAC,CAAC;CACrR;AACD,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAAwB;IAArB,YAAqB,SAAiB;QAAI,KAAK,CAAC,yDAAyD,SAAS,EAAE,CAAC,CAAC;QAAjG,cAAS,GAAT,SAAS,CAAQ;QAAiF,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAAC,CAAC;CAAE;AACtO,MAAM,OAAO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C,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- {
2
- "name": "goah-ledger-contract",
3
- "private": true,
4
- "version": "0.13.0",
5
- "license": "Apache-2.0",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/billc8128/opengoah.git",
9
- "directory": "packages/ledger-contract"
10
- },
11
- "engines": {
12
- "node": ">=24.0.0"
13
- },
14
- "files": [
15
- "dist",
16
- "!dist/**/*.test.*",
17
- "!dist/.tsbuildinfo"
18
- ],
19
- "type": "module",
20
- "main": "./dist/index.js",
21
- "types": "./dist/index.d.ts",
22
- "exports": {
23
- ".": "./dist/index.js",
24
- "./kernel": "./dist/kernel.js",
25
- "./transcript": "./dist/transcript.js",
26
- "./execution": "./dist/execution.js"
27
- }
28
- }
@@ -1,86 +0,0 @@
1
- import { DatabaseSync } from "node:sqlite";
2
- import { type Clock, type DelegationRequest, type DelegationResult, type EventInput, type EventRecord, type GoalChangeMetadata, type GoalSnapshot, type GoalCompletionRequest, type HandoffCommit, type JsonValue, type Ledger, type MailSnapshot, type ReassignmentRequest, type ReassignmentResult, type ScheduleSnapshot, type ThreadSnapshot, type TurnSnapshot, type TurnItemSnapshot, type WakeSnapshot, type WakeTriggerSnapshot, type WorkRecordSnapshot, type WorkRecordDiff, type WorkRecordUpdateRequest } from "goah-ledger-contract";
3
- type FaultPoint = "after_event_before_projection" | "after_delegation_event" | "after_reassignment_event";
4
- type FaultInjector = (point: FaultPoint) => void;
5
- export declare const SQLITE_SCHEMA_VERSION = 24;
6
- export interface SqliteLedgerOptions {
7
- faultInjector?: FaultInjector;
8
- clock?: Clock;
9
- busyTimeoutMs?: number;
10
- }
11
- export declare class SqliteLedger implements Ledger {
12
- #private;
13
- readonly db: DatabaseSync;
14
- constructor(path?: string, options?: SqliteLedgerOptions);
15
- close(): void;
16
- appendEvent(input: EventInput): EventRecord;
17
- appendEvents(inputs: EventInput[]): EventRecord[];
18
- readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
19
- putThread(thread: ThreadSnapshot, actor: string): EventRecord;
20
- putTurn(turn: TurnSnapshot, actor: string): EventRecord;
21
- putTurnItem(item: TurnItemSnapshot, actor: string): EventRecord;
22
- thread(id: string): ThreadSnapshot | null;
23
- threads(): ThreadSnapshot[];
24
- turn(id: string): TurnSnapshot | null;
25
- turns(threadId?: string): TurnSnapshot[];
26
- turnItems(turnId: string): TurnItemSnapshot[];
27
- activeTurn(threadId: string): TurnSnapshot | null;
28
- putGoal(goal: GoalSnapshot, actor: string, wakeId?: string, change?: GoalChangeMetadata): EventRecord;
29
- updateWorkRecord(request: WorkRecordUpdateRequest, actor: string): WorkRecordSnapshot;
30
- commitDelegation(request: DelegationRequest, actor: string, wakeId?: string): DelegationResult;
31
- commitReassignment(request: ReassignmentRequest, actor: string, wakeId?: string): ReassignmentResult;
32
- completeGoal(request: GoalCompletionRequest, actor: string, wakeId?: string): GoalSnapshot;
33
- putSchedule(value: ScheduleSnapshot, actor: string, wakeId?: string): EventRecord;
34
- consumeSchedule(id: string, wake: WakeSnapshot, now: string): {
35
- schedule: ScheduleSnapshot;
36
- wake: WakeSnapshot;
37
- };
38
- cancelSchedule(id: string, now: string): ScheduleSnapshot;
39
- supersedeSchedule(id: string, now: string): ScheduleSnapshot;
40
- enqueueWake(input: WakeSnapshot, actor: string): {
41
- event: EventRecord;
42
- created: boolean;
43
- };
44
- addWakeTrigger(wakeId: string, triggerRef: string, actor: string): WakeTriggerSnapshot;
45
- claimNextWake(now: string): WakeSnapshot | null;
46
- startTurnFromWake(id: string, turn: TurnSnapshot, now: string): WakeSnapshot;
47
- releaseWake(id: string, now: string): WakeSnapshot;
48
- cancelWake(id: string, now: string): WakeSnapshot;
49
- attachTurnProcess(id: string, leaseToken: string, pid: number): TurnSnapshot;
50
- renewTurnLease(id: string, leaseToken: string, leaseUntil: string, now: string): TurnSnapshot;
51
- appendTurnEvent(input: EventInput, leaseToken: string): EventRecord;
52
- repairTurnAttempt(id: string, reason: string, now: string, actor: string): TurnItemSnapshot[];
53
- finishTurn(id: string, status: "completed" | "failed" | "interrupted", error: JsonValue | null, now: string, actor: string, mailIds?: string[]): TurnSnapshot;
54
- putMail(mail: MailSnapshot, actor: string, wakeId?: string): EventRecord;
55
- putMails(mails: MailSnapshot[], actor: string, wakeId?: string): EventRecord[];
56
- commitHandoff(commit: HandoffCommit): EventRecord;
57
- dueSchedules(now: string): ScheduleSnapshot[];
58
- unreadMail(agent: string): MailSnapshot[];
59
- lastEvent(actor: string, type: string): EventRecord | null;
60
- lastGoalHandoff(goalId: string): EventRecord | null;
61
- latestEvent(): EventRecord | null;
62
- eventsForWake(wakeId: string): EventRecord[];
63
- wake(id: string): WakeSnapshot | null;
64
- wakeByTrigger(agent: string, triggerRef: string): WakeSnapshot | null;
65
- wakeTriggers(wakeId: string): WakeTriggerSnapshot[];
66
- wakeTriggersForAgent(agent: string): WakeTriggerSnapshot[];
67
- queuedWakeForAgent(agent: string): WakeSnapshot | null;
68
- goalsForOwner(owner: string): GoalSnapshot[];
69
- goal(id: string): GoalSnapshot | null;
70
- workRecord(goalId: string): WorkRecordSnapshot | null;
71
- workRecordHistory(goalId: string): WorkRecordSnapshot[];
72
- workRecordDiff(goalId: string, fromRevision: number, toRevision: number): WorkRecordDiff;
73
- searchWorkRecords(query: string, limit?: number): WorkRecordSnapshot[];
74
- triggeringMail(): MailSnapshot[];
75
- eventsSince(seq: number, types?: string[]): EventRecord[];
76
- searchEvents(query: string, limit?: number): EventRecord[];
77
- events(): EventRecord[];
78
- goals(): GoalSnapshot[];
79
- workRecords(): WorkRecordSnapshot[];
80
- schedules(): ScheduleSnapshot[];
81
- wakes(): WakeSnapshot[];
82
- mailbox(): MailSnapshot[];
83
- rebuildProjections(): void;
84
- }
85
- export {};
86
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE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