@nodetool-ai/execution 0.8.1

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 (231) hide show
  1. package/README.md +129 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/app-debug/app-spec.d.ts +94 -0
  4. package/dist/app-debug/app-spec.d.ts.map +1 -0
  5. package/dist/app-debug/app-spec.js +710 -0
  6. package/dist/app-debug/app-spec.js.map +1 -0
  7. package/dist/app-debug/application-target.d.ts +53 -0
  8. package/dist/app-debug/application-target.d.ts.map +1 -0
  9. package/dist/app-debug/application-target.js +126 -0
  10. package/dist/app-debug/application-target.js.map +1 -0
  11. package/dist/app-debug/bundle-target.d.ts +21 -0
  12. package/dist/app-debug/bundle-target.d.ts.map +1 -0
  13. package/dist/app-debug/bundle-target.js +51 -0
  14. package/dist/app-debug/bundle-target.js.map +1 -0
  15. package/dist/app-debug/graph-shape.d.ts +14 -0
  16. package/dist/app-debug/graph-shape.d.ts.map +1 -0
  17. package/dist/app-debug/graph-shape.js +23 -0
  18. package/dist/app-debug/graph-shape.js.map +1 -0
  19. package/dist/app-debug/index.d.ts +26 -0
  20. package/dist/app-debug/index.d.ts.map +1 -0
  21. package/dist/app-debug/index.js +19 -0
  22. package/dist/app-debug/index.js.map +1 -0
  23. package/dist/app-debug/markdown.d.ts +6 -0
  24. package/dist/app-debug/markdown.d.ts.map +1 -0
  25. package/dist/app-debug/markdown.js +133 -0
  26. package/dist/app-debug/markdown.js.map +1 -0
  27. package/dist/app-debug/runtime.d.ts +267 -0
  28. package/dist/app-debug/runtime.d.ts.map +1 -0
  29. package/dist/app-debug/runtime.js +633 -0
  30. package/dist/app-debug/runtime.js.map +1 -0
  31. package/dist/app-debug/script-operation.d.ts +58 -0
  32. package/dist/app-debug/script-operation.d.ts.map +1 -0
  33. package/dist/app-debug/script-operation.js +44 -0
  34. package/dist/app-debug/script-operation.js.map +1 -0
  35. package/dist/app-debug/simulate.d.ts +85 -0
  36. package/dist/app-debug/simulate.d.ts.map +1 -0
  37. package/dist/app-debug/simulate.js +991 -0
  38. package/dist/app-debug/simulate.js.map +1 -0
  39. package/dist/app-debug/summarize.d.ts +64 -0
  40. package/dist/app-debug/summarize.d.ts.map +1 -0
  41. package/dist/app-debug/summarize.js +65 -0
  42. package/dist/app-debug/summarize.js.map +1 -0
  43. package/dist/app-debug/types.d.ts +343 -0
  44. package/dist/app-debug/types.d.ts.map +1 -0
  45. package/dist/app-debug/types.js +2 -0
  46. package/dist/app-debug/types.js.map +1 -0
  47. package/dist/cost-ledger.d.ts +147 -0
  48. package/dist/cost-ledger.d.ts.map +1 -0
  49. package/dist/cost-ledger.js +288 -0
  50. package/dist/cost-ledger.js.map +1 -0
  51. package/dist/debug/collector.d.ts +28 -0
  52. package/dist/debug/collector.d.ts.map +1 -0
  53. package/dist/debug/collector.js +284 -0
  54. package/dist/debug/collector.js.map +1 -0
  55. package/dist/debug/index.d.ts +15 -0
  56. package/dist/debug/index.d.ts.map +1 -0
  57. package/dist/debug/index.js +16 -0
  58. package/dist/debug/index.js.map +1 -0
  59. package/dist/debug/types.d.ts +179 -0
  60. package/dist/debug/types.d.ts.map +1 -0
  61. package/dist/debug/types.js +11 -0
  62. package/dist/debug/types.js.map +1 -0
  63. package/dist/debug/verdict.d.ts +27 -0
  64. package/dist/debug/verdict.d.ts.map +1 -0
  65. package/dist/debug/verdict.js +51 -0
  66. package/dist/debug/verdict.js.map +1 -0
  67. package/dist/executor-resolver.d.ts +13 -0
  68. package/dist/executor-resolver.d.ts.map +1 -0
  69. package/dist/executor-resolver.js +13 -0
  70. package/dist/executor-resolver.js.map +1 -0
  71. package/dist/fal-output-decoder.d.ts +36 -0
  72. package/dist/fal-output-decoder.d.ts.map +1 -0
  73. package/dist/fal-output-decoder.js +129 -0
  74. package/dist/fal-output-decoder.js.map +1 -0
  75. package/dist/generation-lifecycle.d.ts +54 -0
  76. package/dist/generation-lifecycle.d.ts.map +1 -0
  77. package/dist/generation-lifecycle.js +431 -0
  78. package/dist/generation-lifecycle.js.map +1 -0
  79. package/dist/generation-recovery-worker.d.ts +100 -0
  80. package/dist/generation-recovery-worker.d.ts.map +1 -0
  81. package/dist/generation-recovery-worker.js +995 -0
  82. package/dist/generation-recovery-worker.js.map +1 -0
  83. package/dist/generation-tracker.d.ts +83 -0
  84. package/dist/generation-tracker.d.ts.map +1 -0
  85. package/dist/generation-tracker.js +436 -0
  86. package/dist/generation-tracker.js.map +1 -0
  87. package/dist/index.d.ts +28 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +21 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/js-script-debug/index.d.ts +13 -0
  92. package/dist/js-script-debug/index.d.ts.map +1 -0
  93. package/dist/js-script-debug/index.js +12 -0
  94. package/dist/js-script-debug/index.js.map +1 -0
  95. package/dist/js-script-debug/markdown.d.ts +6 -0
  96. package/dist/js-script-debug/markdown.d.ts.map +1 -0
  97. package/dist/js-script-debug/markdown.js +62 -0
  98. package/dist/js-script-debug/markdown.js.map +1 -0
  99. package/dist/js-script-debug/outputs.d.ts +20 -0
  100. package/dist/js-script-debug/outputs.d.ts.map +1 -0
  101. package/dist/js-script-debug/outputs.js +30 -0
  102. package/dist/js-script-debug/outputs.js.map +1 -0
  103. package/dist/js-script-debug/report.d.ts +15 -0
  104. package/dist/js-script-debug/report.d.ts.map +1 -0
  105. package/dist/js-script-debug/report.js +90 -0
  106. package/dist/js-script-debug/report.js.map +1 -0
  107. package/dist/js-script-debug/types.d.ts +63 -0
  108. package/dist/js-script-debug/types.d.ts.map +1 -0
  109. package/dist/js-script-debug/types.js +10 -0
  110. package/dist/js-script-debug/types.js.map +1 -0
  111. package/dist/js-script-debug/validate.d.ts +38 -0
  112. package/dist/js-script-debug/validate.d.ts.map +1 -0
  113. package/dist/js-script-debug/validate.js +137 -0
  114. package/dist/js-script-debug/validate.js.map +1 -0
  115. package/dist/message-stream.d.ts +33 -0
  116. package/dist/message-stream.d.ts.map +1 -0
  117. package/dist/message-stream.js +58 -0
  118. package/dist/message-stream.js.map +1 -0
  119. package/dist/normalize-graph.d.ts +13 -0
  120. package/dist/normalize-graph.d.ts.map +1 -0
  121. package/dist/normalize-graph.js +63 -0
  122. package/dist/normalize-graph.js.map +1 -0
  123. package/dist/output-names.d.ts +13 -0
  124. package/dist/output-names.d.ts.map +1 -0
  125. package/dist/output-names.js +13 -0
  126. package/dist/output-names.js.map +1 -0
  127. package/dist/predicates.d.ts +6 -0
  128. package/dist/predicates.d.ts.map +1 -0
  129. package/dist/predicates.js +6 -0
  130. package/dist/predicates.js.map +1 -0
  131. package/dist/preflight.d.ts +87 -0
  132. package/dist/preflight.d.ts.map +1 -0
  133. package/dist/preflight.js +139 -0
  134. package/dist/preflight.js.map +1 -0
  135. package/dist/provider-secret-key.d.ts +3 -0
  136. package/dist/provider-secret-key.d.ts.map +1 -0
  137. package/dist/provider-secret-key.js +7 -0
  138. package/dist/provider-secret-key.js.map +1 -0
  139. package/dist/service/app-debug-service.d.ts +78 -0
  140. package/dist/service/app-debug-service.d.ts.map +1 -0
  141. package/dist/service/app-debug-service.js +201 -0
  142. package/dist/service/app-debug-service.js.map +1 -0
  143. package/dist/service/app-run-server.d.ts +28 -0
  144. package/dist/service/app-run-server.d.ts.map +1 -0
  145. package/dist/service/app-run-server.js +104 -0
  146. package/dist/service/app-run-server.js.map +1 -0
  147. package/dist/service/debug-sessions.d.ts +158 -0
  148. package/dist/service/debug-sessions.d.ts.map +1 -0
  149. package/dist/service/debug-sessions.js +358 -0
  150. package/dist/service/debug-sessions.js.map +1 -0
  151. package/dist/service/index.d.ts +22 -0
  152. package/dist/service/index.d.ts.map +1 -0
  153. package/dist/service/index.js +17 -0
  154. package/dist/service/index.js.map +1 -0
  155. package/dist/service/job-progress.d.ts +40 -0
  156. package/dist/service/job-progress.d.ts.map +1 -0
  157. package/dist/service/job-progress.js +53 -0
  158. package/dist/service/job-progress.js.map +1 -0
  159. package/dist/service/workflow-run.d.ts +279 -0
  160. package/dist/service/workflow-run.d.ts.map +1 -0
  161. package/dist/service/workflow-run.js +598 -0
  162. package/dist/service/workflow-run.js.map +1 -0
  163. package/dist/service/workflow-workspace.d.ts +89 -0
  164. package/dist/service/workflow-workspace.d.ts.map +1 -0
  165. package/dist/service/workflow-workspace.js +160 -0
  166. package/dist/service/workflow-workspace.js.map +1 -0
  167. package/dist/session.d.ts +62 -0
  168. package/dist/session.d.ts.map +1 -0
  169. package/dist/session.js +353 -0
  170. package/dist/session.js.map +1 -0
  171. package/dist/sketch-debug/index.d.ts +11 -0
  172. package/dist/sketch-debug/index.d.ts.map +1 -0
  173. package/dist/sketch-debug/index.js +10 -0
  174. package/dist/sketch-debug/index.js.map +1 -0
  175. package/dist/sketch-debug/markdown.d.ts +6 -0
  176. package/dist/sketch-debug/markdown.d.ts.map +1 -0
  177. package/dist/sketch-debug/markdown.js +93 -0
  178. package/dist/sketch-debug/markdown.js.map +1 -0
  179. package/dist/sketch-debug/report.d.ts +15 -0
  180. package/dist/sketch-debug/report.d.ts.map +1 -0
  181. package/dist/sketch-debug/report.js +98 -0
  182. package/dist/sketch-debug/report.js.map +1 -0
  183. package/dist/sketch-debug/types.d.ts +62 -0
  184. package/dist/sketch-debug/types.d.ts.map +1 -0
  185. package/dist/sketch-debug/types.js +10 -0
  186. package/dist/sketch-debug/types.js.map +1 -0
  187. package/dist/sketch-debug/validate.d.ts +14 -0
  188. package/dist/sketch-debug/validate.d.ts.map +1 -0
  189. package/dist/sketch-debug/validate.js +478 -0
  190. package/dist/sketch-debug/validate.js.map +1 -0
  191. package/dist/supervisor.d.ts +45 -0
  192. package/dist/supervisor.d.ts.map +1 -0
  193. package/dist/supervisor.js +97 -0
  194. package/dist/supervisor.js.map +1 -0
  195. package/dist/timeline-debug/index.d.ts +11 -0
  196. package/dist/timeline-debug/index.d.ts.map +1 -0
  197. package/dist/timeline-debug/index.js +10 -0
  198. package/dist/timeline-debug/index.js.map +1 -0
  199. package/dist/timeline-debug/legibility.d.ts +23 -0
  200. package/dist/timeline-debug/legibility.d.ts.map +1 -0
  201. package/dist/timeline-debug/legibility.js +240 -0
  202. package/dist/timeline-debug/legibility.js.map +1 -0
  203. package/dist/timeline-debug/markdown.d.ts +6 -0
  204. package/dist/timeline-debug/markdown.d.ts.map +1 -0
  205. package/dist/timeline-debug/markdown.js +103 -0
  206. package/dist/timeline-debug/markdown.js.map +1 -0
  207. package/dist/timeline-debug/motion.d.ts +20 -0
  208. package/dist/timeline-debug/motion.d.ts.map +1 -0
  209. package/dist/timeline-debug/motion.js +362 -0
  210. package/dist/timeline-debug/motion.js.map +1 -0
  211. package/dist/timeline-debug/report.d.ts +16 -0
  212. package/dist/timeline-debug/report.d.ts.map +1 -0
  213. package/dist/timeline-debug/report.js +100 -0
  214. package/dist/timeline-debug/report.js.map +1 -0
  215. package/dist/timeline-debug/showcase.d.ts +7 -0
  216. package/dist/timeline-debug/showcase.d.ts.map +1 -0
  217. package/dist/timeline-debug/showcase.js +347 -0
  218. package/dist/timeline-debug/showcase.js.map +1 -0
  219. package/dist/timeline-debug/types.d.ts +64 -0
  220. package/dist/timeline-debug/types.d.ts.map +1 -0
  221. package/dist/timeline-debug/types.js +10 -0
  222. package/dist/timeline-debug/types.js.map +1 -0
  223. package/dist/timeline-debug/validate.d.ts +24 -0
  224. package/dist/timeline-debug/validate.d.ts.map +1 -0
  225. package/dist/timeline-debug/validate.js +1432 -0
  226. package/dist/timeline-debug/validate.js.map +1 -0
  227. package/dist/types.d.ts +211 -0
  228. package/dist/types.d.ts.map +1 -0
  229. package/dist/types.js +2 -0
  230. package/dist/types.js.map +1 -0
  231. package/package.json +103 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Script operations for the app simulator.
3
+ *
4
+ * The contract itself — the synthesized message stream and the port surface
5
+ * that stands in for a graph — lives in `@nodetool-ai/app-runtime`
6
+ * (`script-run.ts`), because the browser runs script operations too and cannot
7
+ * depend on this package. What is left here is the part that needs a parser:
8
+ * binding the pinned Zod document and deciding, from the body, whether the
9
+ * mapped values are staged as streams.
10
+ */
11
+ import { type ScriptRunResult } from "@nodetool-ai/app-runtime";
12
+ import { type JsScriptDocument } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
13
+ import type { AppIO } from "./types.js";
14
+ /** What one script run returned — the shape `POST /api/js-scripts/:id/run` answers with. */
15
+ export type JsScriptRunResult = ScriptRunResult;
16
+ /** Run one pinned script's document with the given inputs. */
17
+ export type JsScriptOperationRunner = (input: {
18
+ scriptId: string;
19
+ scriptVersion: number;
20
+ name: string;
21
+ document: JsScriptDocument;
22
+ inputs: Record<string, unknown>;
23
+ /** Items staged per handle for a body that reads `stream`. */
24
+ inputStreams?: Record<string, unknown[]>;
25
+ timeoutMs?: number;
26
+ }) => Promise<JsScriptRunResult>;
27
+ /** How one invocation's mapped values reach the body. */
28
+ interface JsScriptInvocation {
29
+ inputs: Record<string, unknown>;
30
+ inputStreams?: Record<string, unknown[]>;
31
+ }
32
+ /**
33
+ * Split an operation's mapped values the way the body reads them — staged as
34
+ * one-item streams when the body reads `stream`, untouched otherwise.
35
+ */
36
+ export declare function scriptOperationInvocation(document: JsScriptDocument, inputs: Record<string, unknown>): JsScriptInvocation;
37
+ /** Resolve a pinned script target to its document. */
38
+ export type JsScriptOperationLoader = (scriptId: string, scriptVersion: number) => Promise<{
39
+ name: string;
40
+ document: JsScriptDocument;
41
+ } | null>;
42
+ /**
43
+ * Parse a document carried loosely (a bundle's structural shape) into the
44
+ * pinned contract, or null when it is not one. A bundle is untrusted input.
45
+ */
46
+ export declare function parseCarriedScriptDocument(value: unknown): JsScriptDocument | null;
47
+ /**
48
+ * A script's bindable surface. Port names stand in for node ids: a script
49
+ * declares no nodes, and its port names are what every mapping already keys on.
50
+ */
51
+ export declare function scriptAppIO(document: JsScriptDocument): AppIO;
52
+ /**
53
+ * The message stream a script run would have produced: its emits in order,
54
+ * then its final outputs, then the job's terminal status.
55
+ */
56
+ export declare function jsScriptRunMessages(result: JsScriptRunResult): Array<Record<string, unknown>>;
57
+ export {};
58
+ //# sourceMappingURL=script-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-operation.d.ts","sourceRoot":"","sources":["../../src/app-debug/script-operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEjC,yDAAyD;AACzD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,kBAAkB,CAEpB;AAED,sDAAsD;AACtD,MAAM,MAAM,uBAAuB,GAAG,CACpC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,KAClB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,gBAAgB,GAAG,IAAI,CAGzB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,KAAK,CAG7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,GACxB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEhC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Script operations for the app simulator.
3
+ *
4
+ * The contract itself — the synthesized message stream and the port surface
5
+ * that stands in for a graph — lives in `@nodetool-ai/app-runtime`
6
+ * (`script-run.ts`), because the browser runs script operations too and cannot
7
+ * depend on this package. What is left here is the part that needs a parser:
8
+ * binding the pinned Zod document and deciding, from the body, whether the
9
+ * mapped values are staged as streams.
10
+ */
11
+ import { scriptInvocationInput, scriptPortIO, scriptRunMessages } from "@nodetool-ai/app-runtime";
12
+ import { jsScriptDocument } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
13
+ import { usesStreamInputContract } from "@nodetool-ai/node-sdk/code-body";
14
+ /**
15
+ * Split an operation's mapped values the way the body reads them — staged as
16
+ * one-item streams when the body reads `stream`, untouched otherwise.
17
+ */
18
+ export function scriptOperationInvocation(document, inputs) {
19
+ return scriptInvocationInput(inputs, usesStreamInputContract(document.code));
20
+ }
21
+ /**
22
+ * Parse a document carried loosely (a bundle's structural shape) into the
23
+ * pinned contract, or null when it is not one. A bundle is untrusted input.
24
+ */
25
+ export function parseCarriedScriptDocument(value) {
26
+ const parsed = jsScriptDocument.safeParse(value);
27
+ return parsed.success ? parsed.data : null;
28
+ }
29
+ /**
30
+ * A script's bindable surface. Port names stand in for node ids: a script
31
+ * declares no nodes, and its port names are what every mapping already keys on.
32
+ */
33
+ export function scriptAppIO(document) {
34
+ const io = scriptPortIO(document);
35
+ return { ...io, variables: [] };
36
+ }
37
+ /**
38
+ * The message stream a script run would have produced: its emits in order,
39
+ * then its final outputs, then the job's terminal status.
40
+ */
41
+ export function jsScriptRunMessages(result) {
42
+ return scriptRunMessages(result);
43
+ }
44
+ //# sourceMappingURL=script-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-operation.js","sourceRoot":"","sources":["../../src/app-debug/script-operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gBAAgB,EAEjB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAwB1E;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA0B,EAC1B,MAA+B;IAE/B,OAAO,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/E,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAA0B;IACpD,MAAM,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAyB;IAEzB,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The app simulator: runs a resolved mini app headlessly.
3
+ *
4
+ * Parses the app document into a widget spec and a set of operations,
5
+ * statically validates the wiring, then simulates the app the way the web and
6
+ * mobile runtimes do: seed input and variable defaults, apply params, attach
7
+ * the resource collections the script seeds, execute the interaction script
8
+ * (each `run` action is a full workflow run on the injected server runner,
9
+ * subject to the operation's policy and timeout), fold the message stream into
10
+ * the app's reactive values, and re-evaluate every widget's conditions — a step
11
+ * no user could perform, because the widget is hidden or disabled, fails.
12
+ *
13
+ * Nothing here touches a database or a filesystem. The host resolves the target
14
+ * (`ResolvedAppTarget`), supplies the workflow runner, and writes whatever
15
+ * bundle it wants; the returned `AppDebugReport` is the whole result.
16
+ */
17
+ import type { ProcessingMessage } from "@nodetool-ai/protocol";
18
+ import type { DebugGraph, ServerRunReport } from "../debug/types.js";
19
+ import { type InputSlot } from "@nodetool-ai/app-runtime";
20
+ import { type JsScriptOperationLoader, type JsScriptOperationRunner } from "./script-operation.js";
21
+ import type { AppDebugOptions, AppDebugReport, AppSpec, InteractionStep, ResolvedAppTarget } from "./types.js";
22
+ /** What the simulator hands a host's workflow runner. */
23
+ export interface AppServerRunInput {
24
+ graph: DebugGraph;
25
+ workflowId: string | null;
26
+ params: Record<string, unknown>;
27
+ timeoutMs?: number;
28
+ }
29
+ /** What it needs back: the run's report and the raw stream to fold. */
30
+ export interface AppServerRunOutcome {
31
+ report: ServerRunReport;
32
+ rawMessages: ProcessingMessage[];
33
+ }
34
+ export interface AppSimulationDeps {
35
+ /** Load a workflow by DB id — an operation may name one the target lacks. */
36
+ loadFromDb: (id: string) => Promise<{
37
+ graph: DebugGraph;
38
+ app_doc?: unknown;
39
+ } | null>;
40
+ /** Execute one operation's workflow. */
41
+ runOnServer: (input: AppServerRunInput) => Promise<AppServerRunOutcome>;
42
+ /**
43
+ * Resolve a pinned script version a script operation targets and the target
44
+ * itself does not carry. Absent on a host with no script store, where such an
45
+ * operation reports as unresolvable instead of running something else.
46
+ */
47
+ loadScript?: JsScriptOperationLoader;
48
+ /**
49
+ * Execute one script operation. Absent on a host that cannot run a sandbox
50
+ * body, with the same consequence.
51
+ */
52
+ runScript?: JsScriptOperationRunner;
53
+ /** Progress/log sink. */
54
+ onLog?: (line: string) => void;
55
+ /**
56
+ * Persist one run's raw message stream, returning the path to record on the
57
+ * run report. Hosts that write no bundle omit it.
58
+ */
59
+ onRunMessages?: (runIndex: number, messages: ProcessingMessage[]) => Promise<string | null>;
60
+ }
61
+ /**
62
+ * The app's natural run trigger, mirroring what a user would do first: click
63
+ * the first `click`→`run` widget (a Run button), else touch the first
64
+ * `change`→`run` write widget.
65
+ */
66
+ export declare function defaultInteractions(spec: AppSpec): InteractionStep[];
67
+ /**
68
+ * Overlay the live values of node-property bindings onto the graph, the way the
69
+ * web runtime does before every run (`collectNodePropertyOverlays` →
70
+ * `withNodeProperties` in `web/src/components/appbuilder/nodeBinding.ts`).
71
+ *
72
+ * A widget bound `op:main/prop:node7#strength` writes an input slot keyed by
73
+ * node and property, which no input node reads — the value only reaches the run
74
+ * as a property of the node it names. The web helpers take ReactFlow nodes, so
75
+ * the mapping is repeated here against the kernel shape (`node.properties`);
76
+ * `parseInputStateKey` — the shared inverse of the state key — is what both
77
+ * sides actually agree on.
78
+ *
79
+ * Only the running operation's slots apply: two operations can bind the same
80
+ * node id in different workflows, so an unscoped merge would let one
81
+ * operation's slider drive the other's run.
82
+ */
83
+ export declare function withNodePropertyOverlays(graph: DebugGraph, inputs: Record<string, InputSlot>, operationId: string): DebugGraph;
84
+ export declare function simulateApp(resolved: ResolvedAppTarget, options: AppDebugOptions, deps: AppSimulationDeps): Promise<AppDebugReport>;
85
+ //# sourceMappingURL=simulate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/app-debug/simulate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,K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