@nodetool-ai/node-sdk 0.7.0-rc.23 → 0.8.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 (158) hide show
  1. package/README.md +34 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/base-node.d.ts +285 -14
  4. package/dist/base-node.d.ts.map +1 -1
  5. package/dist/base-node.js +359 -49
  6. package/dist/base-node.js.map +1 -1
  7. package/dist/class-name-to-title.d.ts +26 -0
  8. package/dist/class-name-to-title.d.ts.map +1 -0
  9. package/dist/class-name-to-title.js +59 -0
  10. package/dist/class-name-to-title.js.map +1 -0
  11. package/dist/code-analysis.d.ts +234 -0
  12. package/dist/code-analysis.d.ts.map +1 -0
  13. package/dist/code-analysis.js +919 -0
  14. package/dist/code-analysis.js.map +1 -0
  15. package/dist/code-body.d.ts +61 -0
  16. package/dist/code-body.d.ts.map +1 -0
  17. package/dist/code-body.js +288 -0
  18. package/dist/code-body.js.map +1 -0
  19. package/dist/code-node-validation.d.ts +67 -0
  20. package/dist/code-node-validation.d.ts.map +1 -0
  21. package/dist/code-node-validation.js +540 -0
  22. package/dist/code-node-validation.js.map +1 -0
  23. package/dist/content-card.d.ts +30 -0
  24. package/dist/content-card.d.ts.map +1 -0
  25. package/dist/content-card.js +68 -0
  26. package/dist/content-card.js.map +1 -0
  27. package/dist/correlation-validation.d.ts +19 -0
  28. package/dist/correlation-validation.d.ts.map +1 -0
  29. package/dist/correlation-validation.js +101 -0
  30. package/dist/correlation-validation.js.map +1 -0
  31. package/dist/cost-estimate.d.ts +244 -0
  32. package/dist/cost-estimate.d.ts.map +1 -0
  33. package/dist/cost-estimate.js +637 -0
  34. package/dist/cost-estimate.js.map +1 -0
  35. package/dist/decorators.d.ts.map +1 -1
  36. package/dist/decorators.js +4 -1
  37. package/dist/decorators.js.map +1 -1
  38. package/dist/docs/nodes.d.ts.map +1 -1
  39. package/dist/docs/nodes.js +3 -2
  40. package/dist/docs/nodes.js.map +1 -1
  41. package/dist/docs/overview.d.ts.map +1 -1
  42. package/dist/docs/overview.js +4 -3
  43. package/dist/docs/overview.js.map +1 -1
  44. package/dist/docs/workflows.d.ts.map +1 -1
  45. package/dist/docs/workflows.js +10 -9
  46. package/dist/docs/workflows.js.map +1 -1
  47. package/dist/field-classification.d.ts +31 -0
  48. package/dist/field-classification.d.ts.map +1 -0
  49. package/dist/field-classification.js +58 -0
  50. package/dist/field-classification.js.map +1 -0
  51. package/dist/graph-validation.d.ts +239 -0
  52. package/dist/graph-validation.d.ts.map +1 -0
  53. package/dist/graph-validation.js +1174 -0
  54. package/dist/graph-validation.js.map +1 -0
  55. package/dist/index.d.ts +27 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +29 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/js-script-link.d.ts +53 -0
  60. package/dist/js-script-link.d.ts.map +1 -0
  61. package/dist/js-script-link.js +58 -0
  62. package/dist/js-script-link.js.map +1 -0
  63. package/dist/js-script-materialize.d.ts +52 -0
  64. package/dist/js-script-materialize.d.ts.map +1 -0
  65. package/dist/js-script-materialize.js +24 -0
  66. package/dist/js-script-materialize.js.map +1 -0
  67. package/dist/manifest-node-values.d.ts +106 -0
  68. package/dist/manifest-node-values.d.ts.map +1 -0
  69. package/dist/manifest-node-values.js +195 -0
  70. package/dist/manifest-node-values.js.map +1 -0
  71. package/dist/metadata.d.ts +75 -3
  72. package/dist/metadata.d.ts.map +1 -1
  73. package/dist/metadata.js +132 -49
  74. package/dist/metadata.js.map +1 -1
  75. package/dist/node-metadata.d.ts.map +1 -1
  76. package/dist/node-metadata.js +61 -56
  77. package/dist/node-metadata.js.map +1 -1
  78. package/dist/node-type-inventory.d.ts +51 -0
  79. package/dist/node-type-inventory.d.ts.map +1 -0
  80. package/dist/node-type-inventory.js +121 -0
  81. package/dist/node-type-inventory.js.map +1 -0
  82. package/dist/nodes/test-nodes.d.ts +77 -30
  83. package/dist/nodes/test-nodes.d.ts.map +1 -1
  84. package/dist/nodes/test-nodes.js +2 -34
  85. package/dist/nodes/test-nodes.js.map +1 -1
  86. package/dist/pack-loader.d.ts +202 -0
  87. package/dist/pack-loader.d.ts.map +1 -0
  88. package/dist/pack-loader.js +529 -0
  89. package/dist/pack-loader.js.map +1 -0
  90. package/dist/port-types.d.ts +15 -0
  91. package/dist/port-types.d.ts.map +1 -0
  92. package/dist/port-types.js +72 -0
  93. package/dist/port-types.js.map +1 -0
  94. package/dist/pricing-bundle.d.ts +83 -0
  95. package/dist/pricing-bundle.d.ts.map +1 -0
  96. package/dist/pricing-bundle.js +82 -0
  97. package/dist/pricing-bundle.js.map +1 -0
  98. package/dist/pricing-params.d.ts +59 -0
  99. package/dist/pricing-params.d.ts.map +1 -0
  100. package/dist/pricing-params.js +282 -0
  101. package/dist/pricing-params.js.map +1 -0
  102. package/dist/python-package-scan.d.ts +8 -0
  103. package/dist/python-package-scan.d.ts.map +1 -1
  104. package/dist/python-package-scan.js +21 -8
  105. package/dist/python-package-scan.js.map +1 -1
  106. package/dist/registry.d.ts +105 -2
  107. package/dist/registry.d.ts.map +1 -1
  108. package/dist/registry.js +403 -30
  109. package/dist/registry.js.map +1 -1
  110. package/dist/sandbox-bridge-packs.d.ts +39 -0
  111. package/dist/sandbox-bridge-packs.d.ts.map +1 -0
  112. package/dist/sandbox-bridge-packs.js +249 -0
  113. package/dist/sandbox-bridge-packs.js.map +1 -0
  114. package/dist/sandbox-catalog-host.d.ts +31 -0
  115. package/dist/sandbox-catalog-host.d.ts.map +1 -0
  116. package/dist/sandbox-catalog-host.js +78 -0
  117. package/dist/sandbox-catalog-host.js.map +1 -0
  118. package/dist/sandbox-module-catalog.d.ts +14 -0
  119. package/dist/sandbox-module-catalog.d.ts.map +1 -0
  120. package/dist/sandbox-module-catalog.js +402 -0
  121. package/dist/sandbox-module-catalog.js.map +1 -0
  122. package/dist/sandbox-npm-artifacts.d.ts +56 -0
  123. package/dist/sandbox-npm-artifacts.d.ts.map +1 -0
  124. package/dist/sandbox-npm-artifacts.js +17 -0
  125. package/dist/sandbox-npm-artifacts.js.map +1 -0
  126. package/dist/sandbox-pack-discovery.d.ts +93 -0
  127. package/dist/sandbox-pack-discovery.d.ts.map +1 -0
  128. package/dist/sandbox-pack-discovery.js +807 -0
  129. package/dist/sandbox-pack-discovery.js.map +1 -0
  130. package/dist/search.d.ts +29 -1
  131. package/dist/search.d.ts.map +1 -1
  132. package/dist/search.js +136 -9
  133. package/dist/search.js.map +1 -1
  134. package/dist/type-compat.d.ts +36 -0
  135. package/dist/type-compat.d.ts.map +1 -0
  136. package/dist/type-compat.js +98 -0
  137. package/dist/type-compat.js.map +1 -0
  138. package/dist/type-predicates.d.ts +25 -0
  139. package/dist/type-predicates.d.ts.map +1 -0
  140. package/dist/type-predicates.js +31 -0
  141. package/dist/type-predicates.js.map +1 -0
  142. package/dist/validation.d.ts +18 -0
  143. package/dist/validation.d.ts.map +1 -1
  144. package/dist/validation.js +70 -11
  145. package/dist/validation.js.map +1 -1
  146. package/dist/workflow-document-tools.d.ts +35 -0
  147. package/dist/workflow-document-tools.d.ts.map +1 -0
  148. package/dist/workflow-document-tools.js +402 -0
  149. package/dist/workflow-document-tools.js.map +1 -0
  150. package/dist/workflow-interface.d.ts +62 -0
  151. package/dist/workflow-interface.d.ts.map +1 -0
  152. package/dist/workflow-interface.js +351 -0
  153. package/dist/workflow-interface.js.map +1 -0
  154. package/package.json +67 -10
  155. package/dist/package-registry-client.d.ts +0 -12
  156. package/dist/package-registry-client.d.ts.map +0 -1
  157. package/dist/package-registry-client.js +0 -40
  158. package/dist/package-registry-client.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Convert a node className (e.g. "GPT_4_1_Nano", "StableDiffusionXL",
3
+ * "Ideogram_V3_Balanced") into a human-readable title shown in the node
4
+ * menu.
5
+ *
6
+ * Rules:
7
+ * - "_" is treated as a word separator (so "Imagen_4_Ultra" yields three
8
+ * chunks: "Imagen", "4", "Ultra").
9
+ * - camelCase / PascalCase boundaries are split, while uppercase runs are
10
+ * kept together — so "StableDiffusionXL" becomes "Stable Diffusion XL"
11
+ * rather than "Stable Diffusion X L", and "SDXL_Ad_Inpaint" stays as
12
+ * "SDXL Ad Inpaint" rather than "S D X L Ad Inpaint".
13
+ * - Consecutive purely-numeric tokens are joined with a "." — this
14
+ * reconstructs the version numbers in the original model slugs (so
15
+ * "GPT_4_1_Nano" → "GPT 4.1 Nano", "Flux_1_1_Pro_Ultra" →
16
+ * "Flux 1.1 Pro Ultra", "Veo_3_1_Lite" → "Veo 3.1 Lite").
17
+ *
18
+ * @example
19
+ * classNameToTitle("GPT_4_1_Nano") // "GPT 4.1 Nano"
20
+ * classNameToTitle("Imagen_4_Ultra") // "Imagen 4 Ultra"
21
+ * classNameToTitle("Ideogram_V3_Balanced") // "Ideogram V3 Balanced"
22
+ * classNameToTitle("StableDiffusionXL") // "Stable Diffusion XL"
23
+ * classNameToTitle("Recraft_20B_SVG") // "Recraft 20B SVG"
24
+ */
25
+ export function classNameToTitle(className) {
26
+ // Stryker disable next-line ConditionalExpression,BlockStatement: fast-path for "" — the general path below also yields "" for "" (split → filtered to [] → join → ""), so removing it changes nothing (equivalent).
27
+ if (!className) {
28
+ return "";
29
+ }
30
+ // 1) Split on underscores AND camelCase / acronym boundaries.
31
+ // The regex passes are applied per underscore-delimited chunk so
32
+ // purely-numeric tokens stay intact for the merge step below.
33
+ const splitWordBoundaries = (part) => {
34
+ // "fooBar" → "foo Bar", "foo4" → "foo 4"
35
+ let spaced = part.replace(/([a-z])([A-Z0-9])/g, "$1 $2");
36
+ // Stryker disable next-line Regex: collapsing the [A-Z]+ run to a single [A-Z] is equivalent — the space always lands right before the final Cap-lower pair ("XLLightning" → "XL Lightning"), so the leading caps stay glued either way.
37
+ spaced = spaced.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2");
38
+ return spaced.split(" ");
39
+ };
40
+ const tokens = className
41
+ .split("_")
42
+ .flatMap(splitWordBoundaries)
43
+ .filter((tok) => tok.length > 0);
44
+ // 2) Merge consecutive purely-numeric tokens with "." so the version
45
+ // numbers in slugs like "gpt-4.1-nano" round-trip ("4_1" → "4.1").
46
+ const merged = [];
47
+ for (const tok of tokens) {
48
+ const last = merged[merged.length - 1];
49
+ // Stryker disable next-line ConditionalExpression: forcing `last !== undefined` true is equivalent — the digit regexes still gate the merge (/^\d+$/.test(undefined) is false), so a non-numeric or first token never merges either way.
50
+ if (last !== undefined && /^\d+$/.test(last) && /^\d+$/.test(tok)) {
51
+ merged[merged.length - 1] = `${last}.${tok}`;
52
+ }
53
+ else {
54
+ merged.push(tok);
55
+ }
56
+ }
57
+ return merged.join(" ");
58
+ }
59
+ //# sourceMappingURL=class-name-to-title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-name-to-title.js","sourceRoot":"","sources":["../src/class-name-to-title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,qNAAqN;IACrN,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,8DAA8D;IAC9D,oEAAoE;IACpE,iEAAiE;IACjE,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAY,EAAE;QACrD,yCAAyC;QACzC,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QACzD,yOAAyO;QACzO,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,SAAS;SACrB,KAAK,CAAC,GAAG,CAAC;SACV,OAAO,CAAC,mBAAmB,CAAC;SAC5B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEnC,qEAAqE;IACrE,sEAAsE;IACtE,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvC,yOAAyO;QACzO,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAClE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * AST primitives for the body of a Code node (`nodetool.code.Code`).
3
+ *
4
+ * A Code node's `code` property is the body of one async function: declared
5
+ * dynamic inputs arrive on an `inputs` object, and outputs leave through
6
+ * `emit(name, value)` / `output(name, value)` — or, for a body that calls
7
+ * neither, through the legacy returned object's keys. Everything a checker
8
+ * needs to say about such a body —
9
+ * does it parse, what does it return, which names does it invent — is derived
10
+ * here, so the graph validator, the code-generation planner and the editor all
11
+ * read the same AST rather than three approximations of it.
12
+ *
13
+ * Pure functions, no I/O: the parser is the only dependency.
14
+ */
15
+ import * as acorn from "acorn";
16
+ /** A top-level entry of a parsed body: a statement or an import/export. */
17
+ export type CodeBodyStatement = acorn.Statement | acorn.ModuleDeclaration;
18
+ export interface ParsedCodeBody {
19
+ statements: CodeBodyStatement[];
20
+ }
21
+ export interface CodeParseError {
22
+ /** Acorn's message, already prefixed with the position it points at. */
23
+ error: string;
24
+ /** 1-based line the parser stopped on, when it reported one. */
25
+ line?: number;
26
+ }
27
+ /**
28
+ * Parse a Code node body into its top-level statement list.
29
+ *
30
+ * The body is a bare statement list with `return` at the top level, which most
31
+ * of the time parses directly. Anything the direct parse rejects gets a second
32
+ * pass wrapped in an async function, so `await` in odd positions doesn't read
33
+ * as a syntax error.
34
+ */
35
+ export declare function parseCodeBody(code: string): ParsedCodeBody | CodeParseError;
36
+ /** `"import"` / `"export"` for every module declaration at the top level. */
37
+ export declare function moduleDeclarationKinds(statements: readonly CodeBodyStatement[]): string[];
38
+ /**
39
+ * Specifiers of the top-level static `import` declarations, in source order.
40
+ *
41
+ * These are the only imports the guest loader can serve: it resolves a
42
+ * specifier the run declared, and nothing else.
43
+ */
44
+ export declare function staticImportSpecifiers(statements: readonly CodeBodyStatement[]): string[];
45
+ /** One static import declaration's specifier and the names it pulls off it. */
46
+ export interface StaticImportBinding {
47
+ readonly specifier: string;
48
+ /**
49
+ * Names in `import { a, b as c }` — the exported names, not the local
50
+ * aliases, so they can be checked against what the module declares.
51
+ * A default or namespace import contributes nothing: it names no export.
52
+ */
53
+ readonly named: readonly string[];
54
+ }
55
+ /**
56
+ * Specifier plus imported names for every top-level static `import`, in source
57
+ * order.
58
+ *
59
+ * {@link staticImportSpecifiers} answers which modules a body wants;
60
+ * this answers which of their exports it wants, so a loader can refuse a
61
+ * misspelled name with the module's own export list instead of leaving the
62
+ * guest to report "Could not find export".
63
+ */
64
+ export declare function staticImportBindings(statements: readonly CodeBodyStatement[]): StaticImportBinding[];
65
+ /**
66
+ * The names a module's source exports, or `null` when they cannot be decided.
67
+ *
68
+ * `null` means "do not check": the source did not parse, or it carries an
69
+ * `export * from …` whose names live in another file. A caller that refuses an
70
+ * import on this list must treat `null` as permission, never as an empty
71
+ * module.
72
+ *
73
+ * Used to turn QuickJS's "Could not find export 'websearch'" — which names
74
+ * neither the module's exports nor the near miss — into a refusal made before
75
+ * the guest starts, with both.
76
+ */
77
+ export declare function exportedNames(source: string): string[] | null;
78
+ /** Module access the loader refuses outright, anywhere in the body. */
79
+ export interface DynamicModuleAccess {
80
+ /** `import(...)` — the loader denies every dynamic resolution. */
81
+ dynamicImport: boolean;
82
+ /** `require(...)` — CommonJS does not exist in the guest. */
83
+ require: boolean;
84
+ }
85
+ export declare function dynamicModuleAccess(statements: readonly CodeBodyStatement[]): DynamicModuleAccess;
86
+ /** Outcome of inspecting one `return` argument. */
87
+ export interface ReturnShape {
88
+ /** Keys the returned object literal definitely carries. */
89
+ keys: Set<string>;
90
+ /** A spread or a computed key hides the real key set. */
91
+ opaque: boolean;
92
+ /** The expression cannot be an object with named keys (`return 5`). */
93
+ notAnObject: boolean;
94
+ }
95
+ /**
96
+ * Shapes a return argument can take. A ternary splits into one shape per
97
+ * branch, so `return cond ? {a, b} : {a}` is caught on the branch that drops
98
+ * `b` instead of passing on the union.
99
+ */
100
+ export declare function returnShapes(argument: acorn.Expression | null | undefined): ReturnShape[];
101
+ export interface CodeBodyFacts {
102
+ /** Every `return` belonging to the body itself. */
103
+ returns: acorn.ReturnStatement[];
104
+ /** Control can reach the end of the statement list without returning. */
105
+ fallsThrough: boolean;
106
+ }
107
+ /** The body's own `return` statements, and whether control can fall past them. */
108
+ export declare function analyzeCodeBody(statements: readonly CodeBodyStatement[]): CodeBodyFacts;
109
+ /** The two host bridges a body delivers outputs through. */
110
+ export declare const CODE_OUTPUT_CALLEES: readonly string[];
111
+ /** Output handles a body names through `emit`/`output` calls. */
112
+ export interface OutputCallNames {
113
+ /** Literal handle names, in source order, deduplicated. */
114
+ names: string[];
115
+ /** A call whose first argument is not a string literal hides its handle. */
116
+ nonLiteral: boolean;
117
+ }
118
+ /**
119
+ * Handles the body delivers to via `emit(name, …)` / `output(name, …)`.
120
+ *
121
+ * Presence in the AST is the whole rule: a call inside a branch, a loop or a
122
+ * helper function counts, because the contract is per-handle existence rather
123
+ * than per-path coverage. `x.output(…)` is a method on something else and is
124
+ * not counted.
125
+ */
126
+ export declare function outputCallNames(statements: readonly CodeBodyStatement[]): OutputCallNames;
127
+ /** The global a body reads its input streams through. */
128
+ export declare const CODE_STREAM_GLOBAL = "stream";
129
+ /** Input handles a body names through `stream` calls. */
130
+ export interface StreamCallNames {
131
+ /** Literal handle names, in source order, deduplicated. */
132
+ names: string[];
133
+ /** A call whose first argument is not a string literal hides its handle. */
134
+ nonLiteral: boolean;
135
+ /** The body iterates every connected handle via `stream.any()`. */
136
+ usesAny: boolean;
137
+ }
138
+ /**
139
+ * Handles the body takes from via `stream(name)`, `stream.first(name)` and
140
+ * `stream.open(name)`, plus whether it also uses `stream.any()`.
141
+ *
142
+ * Presence in the AST is the whole rule, as for {@link outputCallNames}: a call
143
+ * inside a branch or a loop counts. `x.stream(…)` is a method on something else,
144
+ * and a body that binds `stream` itself reports nothing — the calls are that
145
+ * binding's, not the sandbox's.
146
+ */
147
+ export declare function streamCallNames(statements: readonly CodeBodyStatement[]): StreamCallNames;
148
+ /**
149
+ * Every name the code itself binds — variables, functions, classes, parameters,
150
+ * catch clauses, and undeclared assignment targets. A reference to anything
151
+ * else has to come from the sandbox or from a dynamic input, so this is the
152
+ * allowlist a caller subtracts before deciding a name was invented.
153
+ */
154
+ export declare function collectBoundNames(code: string): string[];
155
+ /**
156
+ * Names the code tests with `typeof`. `typeof x` is the one read that never
157
+ * throws on a missing binding, so a name guarded anywhere in the body is one
158
+ * the author already treats as optional — a caller deciding whether a name is
159
+ * undefined has to subtract these.
160
+ */
161
+ export declare function typeofGuardedNames(statements: readonly CodeBodyStatement[]): Set<string>;
162
+ /** The global every declared input of a Code node arrives on. */
163
+ export declare const CODE_INPUTS_GLOBAL = "inputs";
164
+ /**
165
+ * Input names the body reads off the `inputs` global, and whether it also
166
+ * reaches for the object in a way this analysis cannot resolve to names.
167
+ *
168
+ * `inputs.text` and `inputs["text"]` both count. A dynamic read
169
+ * (`inputs[key]`), a spread, or passing `inputs` somewhere sets `opaque`:
170
+ * the body uses inputs the reader cannot enumerate, so a caller must not
171
+ * conclude an undeclared slot is unused. A body that shadows `inputs` with
172
+ * its own binding reports nothing — the reads are that binding's, not the
173
+ * node's.
174
+ */
175
+ export declare function inputsMemberReads(statements: readonly CodeBodyStatement[]): {
176
+ names: string[];
177
+ opaque: boolean;
178
+ };
179
+ /**
180
+ * Identifiers the code reads without binding them. Property names, object
181
+ * keys and labels are excluded: none of them resolve against the scope chain,
182
+ * so none of them can throw a ReferenceError.
183
+ */
184
+ export declare function freeIdentifiers(statements: readonly CodeBodyStatement[]): string[];
185
+ /**
186
+ * Rewrite a pre-`inputs` Code node body: every free read of a declared input
187
+ * becomes `inputs.<name>`.
188
+ *
189
+ * Inputs used to arrive as globals of their own name. Bodies written that way
190
+ * throw a ReferenceError now, so this is the mechanical half of that move —
191
+ * offsets come from the AST, so a name inside a string or a comment, an object
192
+ * key, or a locally shadowed binding is left alone.
193
+ *
194
+ * Returns the rewritten source and the names it touched. `changed` is false
195
+ * when there was nothing to do, when the body does not parse, or when it binds
196
+ * `inputs` itself — rewriting into a shadowed name would silently change which
197
+ * object is read.
198
+ */
199
+ export declare function migrateCodeBodyToInputs(code: string, inputNames: readonly string[]): {
200
+ code: string;
201
+ changed: boolean;
202
+ rewritten: string[];
203
+ };
204
+ /**
205
+ * Property names the Code node itself owns. A body that reads `inputs.code`
206
+ * is not naming a user handle — it is colliding with the editor field.
207
+ */
208
+ export declare const CODE_NODE_OWN_PROPERTIES: ReadonlySet<string>;
209
+ /**
210
+ * Input handle names the body itself names: `inputs.foo` / `inputs["foo"]`
211
+ * and `stream("foo")` / `stream.first("foo")` / `stream.open("foo")`.
212
+ *
213
+ * A named read is a handle. The editor shows it and an agent can connect to
214
+ * it without a separate "add dynamic input" step.
215
+ */
216
+ export declare function inferredCodeInputNames(code: string): string[];
217
+ /**
218
+ * Output handle names the body itself names: `emit("foo")` / `output("foo")`,
219
+ * or — when the body uses neither — the keys of the last `return { … }`.
220
+ */
221
+ export declare function inferredCodeOutputNames(code: string): string[];
222
+ /**
223
+ * What would make a Code step the workflow planner wrote fail or pass nothing
224
+ * on, checked before anything runs.
225
+ *
226
+ * `inputs` are the handles the build connects, `output` the handle the next
227
+ * step reads. Each problem is a sentence the planner can act on: the repair
228
+ * round sends them back verbatim.
229
+ */
230
+ export declare function plannedCodeStepProblems(code: string, handles: {
231
+ inputs: readonly string[];
232
+ output: string;
233
+ }): string[];
234
+ //# sourceMappingURL=code-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-analysis.d.ts","sourceRoot":"","sources":["../src/code-analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,iBAAiB,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAuBD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CA2B3E;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,MAAM,EAAE,CAQV;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,MAAM,EAAE,CAQV;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,mBAAmB,E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