@rasputin-ai/node 0.4.1 → 0.5.0-alpha.10

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 (49) hide show
  1. package/README.md +188 -162
  2. package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts +2 -37
  3. package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts.map +1 -1
  4. package/dist/auto-instrumentation/instrument-compiled-esm.d.ts +19 -0
  5. package/dist/auto-instrumentation/instrument-compiled-esm.d.ts.map +1 -0
  6. package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts +41 -0
  7. package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts.map +1 -0
  8. package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +5 -2
  9. package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -1
  10. package/dist/auto-instrumentation/transform-source.d.ts +7 -1
  11. package/dist/auto-instrumentation/transform-source.d.ts.map +1 -1
  12. package/dist/auto-instrumentation/warn-production-runtime-transform.d.ts +8 -0
  13. package/dist/auto-instrumentation/warn-production-runtime-transform.d.ts.map +1 -0
  14. package/dist/derivation/analyze-function.d.ts +42 -0
  15. package/dist/derivation/analyze-function.d.ts.map +1 -0
  16. package/dist/derivation/build-dependency-graph.d.ts +21 -0
  17. package/dist/derivation/build-dependency-graph.d.ts.map +1 -0
  18. package/dist/derivation/derivation-ir.d.ts +33 -0
  19. package/dist/derivation/derivation-ir.d.ts.map +1 -0
  20. package/dist/derivation/derivation-proof.d.ts +14 -0
  21. package/dist/derivation/derivation-proof.d.ts.map +1 -0
  22. package/dist/derivation/emit-capture-plan.d.ts +8 -0
  23. package/dist/derivation/emit-capture-plan.d.ts.map +1 -0
  24. package/dist/execution-recorder/automatic-runtime.d.ts +21 -10
  25. package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -1
  26. package/dist/execution-recorder/execution-journal.d.ts +84 -0
  27. package/dist/execution-recorder/execution-journal.d.ts.map +1 -0
  28. package/dist/execution-recorder/execution-recorder-types.d.ts +36 -0
  29. package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -1
  30. package/dist/execution-recorder/execution-recorder.d.ts.map +1 -1
  31. package/dist/execution-recorder/function-plan.d.ts +26 -0
  32. package/dist/execution-recorder/function-plan.d.ts.map +1 -0
  33. package/dist/execution-recorder/recorder-memory-budget.d.ts +8 -1
  34. package/dist/execution-recorder/recorder-memory-budget.d.ts.map +1 -1
  35. package/dist/execution-recorder/safe-serialize.d.ts +8 -0
  36. package/dist/execution-recorder/safe-serialize.d.ts.map +1 -1
  37. package/dist/index.js +1432 -418
  38. package/dist/instrument/build.d.ts +2 -0
  39. package/dist/instrument/build.d.ts.map +1 -0
  40. package/dist/instrument/build.js +1430 -0
  41. package/dist/instrument/bun.js +825 -82
  42. package/dist/instrument/node.js +825 -82
  43. package/dist/rasputin-init.d.ts +5 -5
  44. package/dist/rasputin-init.d.ts.map +1 -1
  45. package/dist/sdk-meta.d.ts +1 -1
  46. package/dist/sdk-meta.d.ts.map +1 -1
  47. package/package.json +10 -2
  48. package/dist/execution-recorder/call-aware-event-buffer.d.ts +0 -23
  49. package/dist/execution-recorder/call-aware-event-buffer.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,162 +1,188 @@
1
- # Official Rasputin AI SDK for Node and Bun
2
-
3
- Report application errors to Rasputin.
4
-
5
- ## Setup
6
-
7
- Initialize once when your application starts:
8
-
9
- ```ts
10
- import { RasputinInit } from '@rasputin-ai/node';
11
-
12
- export const rasputin = RasputinInit({
13
- projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
14
- release: process.env.RASPUTIN_RELEASE!,
15
- environment: process.env.NODE_ENV ?? 'development',
16
- enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
17
- });
18
- ```
19
-
20
- Uncaught exceptions and unhandled rejections are reported automatically.
21
-
22
- ## Capture handled errors
23
-
24
- ```ts
25
- try {
26
- await processPayment();
27
- } catch (error) {
28
- rasputin.captureException(error);
29
- }
30
- ```
31
-
32
- ## Configuration
33
-
34
- | Field | Required | Description |
35
- | --- | --- | --- |
36
- | `projectApiKey` | yes | Project API key from the Rasputin dashboard |
37
- | `environment` | yes | Environment such as `production`, `staging`, or `preview` |
38
- | `release` | yes | Git commit SHA for the deployed version |
39
- | `enabled` | no | Enables or disables the SDK; defaults to `true` |
40
- | `logSuccess` | no | Prints a configuration summary when setup succeeds; defaults to `true`. Failures always log. |
41
- | `moduleUrl` | no | `import.meta.url` from the initialization file; helps normalize local stack paths |
42
- | `sourceRoot` | no | Git repository folder for a single-package service, such as `apps/api` |
43
- | `sourceRoots` | no | Package-name to Git-folder mappings for ambiguous monorepos |
44
- | `repoRoot` | no | Local filesystem display root; it does not control instrumentation or Git identity |
45
-
46
- Rasputin normally identifies source from the nearest `package.json` and verifies it against the exact release on the server. Filesystem paths such as `/container` are never used as source identity.
47
-
48
- For deployment checks, call:
49
-
50
- ```ts
51
- const verification = await rasputin.verifyConfiguration();
52
- ```
53
-
54
- `verified` means every instrumented source file maps uniquely to the configured Git release. If a monorepo is ambiguous, set `sourceRoot` or `sourceRoots` using repository-relative folders, never Docker paths.
55
-
56
- Rasputin also prints a configuration summary after the instrumentation manifest is uploaded. Set `logSuccess: false` if you do not want that banner in production logs. Mapping failures still warn.
57
-
58
- ## Shutdown
59
-
60
- Events are sent in the background. Flush before a short-lived process exits:
61
-
62
- ```ts
63
- await rasputin.flush();
64
- ```
65
-
66
- Call `await rasputin.close()` during graceful shutdown when the process stays alive afterward.
67
-
68
- ---
69
-
70
- # Runtime recorder
71
-
72
- Optionally attach the runtime state that led to an error — arguments, return values, and call history from the failing execution.
73
-
74
- ## Automatic instrumentation
75
-
76
- Start your process with the adapter for your runtime so Rasputin can instrument application functions as they load:
77
-
78
- ```json
79
- {
80
- "scripts": {
81
- "start:node": "node --import @rasputin-ai/node/instrument/node dist/app.js",
82
- "start:bun": "bun --preload @rasputin-ai/node/instrument/bun src/app.ts"
83
- }
84
- }
85
- ```
86
-
87
- Runtime state is retained only inside an active execution and attached when that execution throws.
88
-
89
- ## Manual capture
90
-
91
- Wrap each meaningful unit of work — an HTTP request, background job, scheduled task, or worker iteration — in an execution:
92
-
93
- ```ts
94
- await rasputin.execution.run({ kind: 'job', name: 'sync-invoices' }, async () => {
95
- await syncInvoices();
96
- });
97
- ```
98
-
99
- When automatic instrumentation is unavailable, mark individual functions explicitly:
100
-
101
- ```ts
102
- const syncInvoices = rasputin.execution.trace(
103
- 'src/jobs/sync-invoices.ts:syncInvoices',
104
- async () => {
105
- // ...
106
- },
107
- );
108
- ```
109
-
110
- Framework packages such as `@rasputin-ai/elysia` create HTTP executions automatically.
111
-
112
- ## Runtime support
113
-
114
- | Environment | Support |
115
- | --- | --- |
116
- | Bun 1.3.x | Supported for directly loaded JavaScript and TypeScript using `instrument/bun` |
117
- | Node.js 22.15 or newer | Supported for unbundled ESM/CJS JavaScript using `instrument/node`; Node 22 and 24 are the supported LTS lines |
118
- | TypeScript compiled to multiple JavaScript files | Supported on Node; emit adjacent source maps to retain original TypeScript locations |
119
- | Single-file bundles (esbuild, tsup, webpack, Vite SSR, Next.js) | Automatic instrumentation not supported |
120
- | `tsx`, custom Node loader stacks, and Node's native TypeScript execution | Automatic instrumentation not supported |
121
- | Deno and edge runtimes | Not supported |
122
-
123
- Tested on Bun 1.3.13, Node.js 24.19.0. Node.js 22.15.0 is the minimum for automatic instrumentation (synchronous module hooks). Use `execution.run()` and `execution.trace()` when automatic instrumentation is not available.
124
-
125
- ## Recorder configuration
126
-
127
- Defaults work for most apps. Customize to exclude noisy sources, redact fields, or retain less state:
128
-
129
- | Field | Default | Description |
130
- | --- | ---: | --- |
131
- | `enabled` | `true` | Enables runtime-state capture |
132
- | `maxEventsPerExecution` | `500` | Maximum events retained for one execution |
133
- | `maxCapturedCallsPerFunction` | `3` | Detailed successful calls retained before similar calls are summarized |
134
- | `maxActiveMemoryBytes` | `64 MiB` | Maximum recorder memory shared across active executions |
135
- | `maxDepth` | `3` | Maximum captured value depth |
136
- | `maxObjectKeys` | `30` | Maximum properties retained from one object |
137
- | `maxArrayElements` | `20` | Maximum items retained from one array, map, or set |
138
- | `maxStringLength` | `500` | Maximum characters retained from one string |
139
- | `maxSerializedValueBytes` | `8 KiB` | Maximum retained size of one captured value |
140
- | `redactKeys` | `[]` | Additional case-insensitive property names to redact |
141
- | `excludeSources` | `[]` | Source globs or function-name patterns to exclude |
142
-
143
- ```ts
144
- const rasputin = RasputinInit({
145
- // ...required options
146
- executionRecorder: {
147
- excludeSources: ['src/logger/**', 'packages/shared-logger/**'],
148
- redactKeys: ['customerEmail'],
149
- maxEventsPerExecution: 200,
150
- },
151
- });
152
- ```
153
-
154
- Runtime state can include application data. Use `redactKeys` for sensitive fields.
155
-
156
- ## Diagnostics
157
-
158
- ```ts
159
- const { recorder, transport } = rasputin.getStats();
160
- ```
161
-
162
- Counters are local to the current process and reset on restart.
1
+ # Official Rasputin AI SDK for Node and Bun
2
+
3
+ Report application errors to Rasputin.
4
+
5
+ ## Setup
6
+
7
+ Initialize once when your application starts:
8
+
9
+ ```ts
10
+ import { RasputinInit } from '@rasputin-ai/node';
11
+
12
+ export const rasputin = RasputinInit({
13
+ projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
14
+ release: process.env.RASPUTIN_RELEASE!,
15
+ environment: process.env.NODE_ENV ?? 'development',
16
+ enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
17
+ });
18
+ ```
19
+
20
+ Uncaught exceptions and unhandled rejections are reported automatically.
21
+
22
+ ## Capture handled errors
23
+
24
+ ```ts
25
+ try {
26
+ await processPayment();
27
+ } catch (error) {
28
+ rasputin.captureException(error);
29
+ }
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ | Field | Required | Description |
35
+ | --- | --- | --- |
36
+ | `projectApiKey` | yes | Project API key from the Rasputin dashboard |
37
+ | `environment` | yes | Environment such as `production`, `staging`, or `preview` |
38
+ | `release` | yes | Git commit SHA for the deployed version |
39
+ | `enabled` | no | Enables or disables the SDK; defaults to `true` |
40
+ | `logSuccess` | no | Prints a configuration summary when setup succeeds; defaults to `true`. Failures always log. |
41
+ | `moduleUrl` | no | `import.meta.url` from the initialization file; helps normalize local stack paths |
42
+ | `sourceRoot` | no | Git repository folder for a single-package service, such as `apps/api` |
43
+ | `sourceRoots` | no | Package-name to Git-folder mappings for ambiguous monorepos |
44
+ | `repoRoot` | no | Local filesystem display root; it does not control instrumentation or Git identity |
45
+
46
+ Rasputin normally identifies source from the nearest `package.json` and verifies it against the exact release on the server. Filesystem paths such as `/container` are never used as source identity.
47
+
48
+ For deployment checks, call:
49
+
50
+ ```ts
51
+ const verification = await rasputin.verifyConfiguration();
52
+ ```
53
+
54
+ `verified` means every instrumented source file maps uniquely to the configured Git release. If a monorepo is ambiguous, set `sourceRoot` or `sourceRoots` using repository-relative folders, never Docker paths.
55
+
56
+ Rasputin also prints a configuration summary after the instrumentation manifest is uploaded. Set `logSuccess: false` if you do not want that banner in production logs. Mapping failures still warn.
57
+
58
+ ## Shutdown
59
+
60
+ Events are sent in the background. Flush before a short-lived process exits:
61
+
62
+ ```ts
63
+ await rasputin.flush();
64
+ ```
65
+
66
+ Call `await rasputin.close()` during graceful shutdown when the process stays alive afterward.
67
+
68
+ ---
69
+
70
+ # Runtime recorder
71
+
72
+ Optionally attach the runtime state that led to an error — arguments, return values, and call history from the failing execution.
73
+
74
+ ## Automatic instrumentation
75
+
76
+ Build-time instrumentation is the production default. Transform compiled unbundled JavaScript after `tsc` so the running process never loads the TypeScript compiler:
77
+
78
+ ```json
79
+ {
80
+ "scripts": {
81
+ "build": "tsc && rasputin-instrument dist",
82
+ "start:node": "node dist/app.js",
83
+ "start:bun": "bun dist/app.js"
84
+ }
85
+ }
86
+ ```
87
+
88
+ Emit adjacent source maps from TypeScript so function identities stay pointed at the original files. The instrumenter writes `.rasputin/instrumentation-manifest.json` next to the output. RasputinInit loads that file automatically, or from `RASPUTIN_INSTRUMENTATION_MANIFEST`.
89
+
90
+ Node `--import` and Bun `--preload` remain compatibility and development fallbacks. They transform application source as it loads, which pulls compiler infrastructure into the process and has materially higher RSS. Do not use those loader measurements in low-overhead comparisons. In `NODE_ENV=production` the loaders print a one-time warning recommending `rasputin-instrument`. Set `RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING=1` to hide it.
91
+
92
+ ```json
93
+ {
94
+ "scripts": {
95
+ "start:node": "node --import @rasputin-ai/node/instrument/node dist/app.js",
96
+ "start:bun": "bun --preload @rasputin-ai/node/instrument/bun src/app.ts"
97
+ }
98
+ }
99
+ ```
100
+
101
+ Runtime state is retained only inside an active execution and attached when that execution throws.
102
+
103
+ ## Manual capture
104
+
105
+ Wrap each meaningful unit of work — an HTTP request, background job, scheduled task, or worker iteration — in an execution:
106
+
107
+ ```ts
108
+ await rasputin.execution.run({ kind: 'job', name: 'sync-invoices' }, async () => {
109
+ await syncInvoices();
110
+ });
111
+ ```
112
+
113
+ When automatic instrumentation is unavailable, mark individual functions explicitly:
114
+
115
+ ```ts
116
+ const syncInvoices = rasputin.execution.trace(
117
+ 'src/jobs/sync-invoices.ts:syncInvoices',
118
+ async () => {
119
+ // ...
120
+ },
121
+ );
122
+ ```
123
+
124
+ Framework packages such as `@rasputin-ai/elysia` create HTTP executions automatically.
125
+
126
+ ## Runtime support
127
+
128
+ | Environment | Support |
129
+ | --- | --- |
130
+ | TypeScript compiled to multiple JavaScript files | Preferred: `rasputin-instrument dist` after `tsc`, with adjacent source maps |
131
+ | Bun 1.3.x loading application source directly | Supported using `instrument/bun` as a compatibility fallback |
132
+ | Node.js 22.15 or newer loading unbundled ESM/CJS | Supported using `instrument/node` as a compatibility fallback; Node 22 and 24 are the supported LTS lines |
133
+ | Single-file bundles (esbuild, tsup, webpack, Vite SSR, Next.js) | Automatic instrumentation not supported |
134
+ | `tsx`, custom Node loader stacks, and Node's native TypeScript execution | Automatic instrumentation not supported |
135
+ | Deno and edge runtimes | Not supported |
136
+
137
+ Tested on Bun 1.3.13, Node.js 24.19.0. Node.js 22.15.0 is the minimum for automatic instrumentation (synchronous module hooks). Use `execution.run()` and `execution.trace()` when automatic instrumentation is not available.
138
+
139
+ ## Recorder configuration
140
+
141
+ Defaults work for most apps. Customize to exclude noisy sources, redact fields, or retain less state:
142
+
143
+ | Field | Default | Description |
144
+ | --- | ---: | --- |
145
+ | `enabled` | `true` | Enables runtime-state capture |
146
+ | `maxEventsPerExecution` | `500` | Maximum events retained for one execution |
147
+ | `maxCapturedCallsPerFunction` | `3` | Detailed successful calls retained before similar calls are summarized |
148
+ | `maxActiveMemoryBytes` | `64 MiB` | Maximum recorder memory shared across active executions |
149
+ | `maxDepth` | `3` | Maximum captured value depth |
150
+ | `maxObjectKeys` | `30` | Maximum properties retained from one object |
151
+ | `maxArrayElements` | `20` | Maximum items retained from one array, map, or set |
152
+ | `maxStringLength` | `500` | Maximum characters retained from one string |
153
+ | `maxSerializedValueBytes` | `8 KiB` | Maximum retained size of one captured value |
154
+ | `redactKeys` | `[]` | Additional case-insensitive property names to redact |
155
+ | `excludeSources` | `[]` | Source globs or function-name patterns to exclude |
156
+
157
+ ```ts
158
+ const rasputin = RasputinInit({
159
+ // ...required options
160
+ executionRecorder: {
161
+ excludeSources: ['src/logger/**', 'packages/shared-logger/**'],
162
+ redactKeys: ['customerEmail'],
163
+ maxEventsPerExecution: 200,
164
+ },
165
+ });
166
+ ```
167
+
168
+ Runtime state can include application data. Use `redactKeys` for sensitive fields.
169
+
170
+ ## Diagnostics
171
+
172
+ ```ts
173
+ const { recorder, transport } = rasputin.getStats();
174
+ ```
175
+
176
+ Counters are local to the current process and reset on restart.
177
+
178
+ Recorder work counters support performance diagnosis without retaining successful execution state:
179
+
180
+ - `functionCallsObserved` counts hooks reached inside active execution scopes.
181
+ - `functionCallsCaptured` counts complete enter/terminal pairs recorded before any later eviction.
182
+ - `functionCallsExcluded` counts hooks omitted by source or excluded-subtree rules.
183
+ - `repeatedCallsSuppressed` counts successful repetitions represented by suppression summaries.
184
+ - `serializedValues`, `serializedValueNodes`, and `serializedValueBytes` describe bounded value
185
+ capture work. Redacted subtrees are not traversed or included in the node count.
186
+
187
+ All counters are cumulative. Compare before/after snapshots for a measurement window rather than
188
+ dividing the process-lifetime totals by a single request count.
@@ -4,55 +4,20 @@
4
4
  * bindings. transform-source calls these collectors and passes the delta to the manifest
5
5
  * registry so the server can map runtime locations back to Git.
6
6
  */
7
- import type { InstrumentationArgIdentifier, InstrumentationParamBinding } from '@rasputin-ai/core';
7
+ import type { InstrumentationParamBinding } from '@rasputin-ai/core';
8
8
  import ts from 'typescript';
9
+ import type { RawManifestCallSite, RawManifestDestructure, RawManifestFunction } from './instrumentation-manifest-delta';
9
10
  type SourceLocation = {
10
11
  filePath: string;
11
12
  line: number;
12
13
  column: number;
13
14
  };
14
15
  type SourceLocationMapper = (location: SourceLocation) => SourceLocation | undefined;
15
- type RawManifestCallSite = {
16
- callerSourceToken: string;
17
- calleeName: string;
18
- calleeText: string;
19
- filePath: string;
20
- line: number;
21
- column: number;
22
- endLine: number;
23
- endColumn: number;
24
- resultBinding: string | null;
25
- argIdentifiers: InstrumentationArgIdentifier[];
26
- };
27
- type RawManifestDestructure = {
28
- callerSourceToken: string;
29
- sourceParam: string;
30
- filePath: string;
31
- line: number;
32
- column: number;
33
- binding: InstrumentationParamBinding;
34
- };
35
16
  type CollectContext = {
36
17
  sourceFile: ts.SourceFile;
37
18
  mapLocation?: SourceLocationMapper;
38
19
  absolutePath: string;
39
20
  };
40
- export type RawManifestFunction = {
41
- sourceToken: string;
42
- filePath: string;
43
- name: string;
44
- startLine: number;
45
- startColumn: number;
46
- endLine: number;
47
- endColumn: number;
48
- params: InstrumentationParamBinding[];
49
- paramNames: Set<string>;
50
- };
51
- export type InstrumentationManifestDelta = {
52
- functions: RawManifestFunction[];
53
- callSites: RawManifestCallSite[];
54
- destructures: RawManifestDestructure[];
55
- };
56
21
  export declare const collectFunctionParams: (node: ts.FunctionLikeDeclaration, sourceFile: ts.SourceFile) => {
57
22
  params: InstrumentationParamBinding[];
58
23
  paramNames: Set<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"collect-instrumentation-delta.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/collect-instrumentation-delta.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,KAAK,cAAc,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AAErF,KAAK,mBAAmB,GAAG;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,4BAA4B,EAAE,CAAC;CAC/C,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,2BAA2B,CAAC;CACrC,CAAC;AAEF,KAAK,cAAc,GAAG;IACrB,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,2BAA2B,EAAE,CAAC;IACtC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IAC1C,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACvC,CAAC;AAqCF,eAAO,MAAM,qBAAqB,GACjC,MAAM,EAAE,CAAC,uBAAuB,EAChC,YAAY,EAAE,CAAC,UAAU,KACvB;IAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC;IAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAQlE,CAAC;AA2BF,eAAO,MAAM,cAAc,GAC1B,YAAY,EAAE,CAAC,UAAU,EACzB,UAAU,MAAM,EAChB,cAAc,MAAM,EACpB,cAAc,oBAAoB,+BASlC,CAAC;AAuEF,eAAO,MAAM,eAAe,GAC3B,MAAM,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,aAAa,EAC1C,QAAQ,mBAAmB,EAC3B,SAAS,cAAc,KACrB,mBAAmB,GAAG,IA4BxB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACnC,aAAa,EAAE,CAAC,mBAAmB,EACnC,QAAQ,mBAAmB,EAC3B,SAAS,cAAc,KACrB,sBAAsB,GAAG,IAsB3B,CAAC"}
1
+ {"version":3,"file":"collect-instrumentation-delta.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/collect-instrumentation-delta.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAgC,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EACX,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,MAAM,kCAAkC,CAAC;AAE1C,KAAK,cAAc,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AAErF,KAAK,cAAc,GAAG;IACrB,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAqCF,eAAO,MAAM,qBAAqB,GACjC,MAAM,EAAE,CAAC,uBAAuB,EAChC,YAAY,EAAE,CAAC,UAAU,KACvB;IAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC;IAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAQlE,CAAC;AA2BF,eAAO,MAAM,cAAc,GAC1B,YAAY,EAAE,CAAC,UAAU,EACzB,UAAU,MAAM,EAChB,cAAc,MAAM,EACpB,cAAc,oBAAoB,+BASlC,CAAC;AAuEF,eAAO,MAAM,eAAe,GAC3B,MAAM,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,aAAa,EAC1C,QAAQ,mBAAmB,EAC3B,SAAS,cAAc,KACrB,mBAAmB,GAAG,IA4BxB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACnC,aAAa,EAAE,CAAC,mBAAmB,EACnC,QAAQ,mBAAmB,EAC3B,SAAS,cAAc,KACrB,sBAAsB,GAAG,IAsB3B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { InstrumentationManifestContent } from '@rasputin-ai/core';
2
+ import { type DerivationCaptureMode } from './transform-source';
3
+ export type InstrumentCompiledDirectoryOptions = {
4
+ inputDir: string;
5
+ outputDir?: string;
6
+ manifestPath?: string;
7
+ excludedRoots?: readonly string[];
8
+ sourceRoot?: string;
9
+ sourceRoots?: Record<string, string>;
10
+ derivationMode?: DerivationCaptureMode;
11
+ };
12
+ export type InstrumentCompiledDirectoryResult = {
13
+ transformedFiles: string[];
14
+ manifest: InstrumentationManifestContent | undefined;
15
+ manifestPath: string;
16
+ };
17
+ /** Instrument compiled unbundled ESM/CJS and emit the source manifest next to the output. */
18
+ export declare const instrumentCompiledDirectory: (options: InstrumentCompiledDirectoryOptions) => InstrumentCompiledDirectoryResult;
19
+ //# sourceMappingURL=instrument-compiled-esm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrument-compiled-esm.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/instrument-compiled-esm.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAQxE,OAAO,EAAE,KAAK,qBAAqB,EAAmB,MAAM,oBAAoB,CAAC;AAIjF,MAAM,MAAM,kCAAkC,GAAG;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC/C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,8BAA8B,GAAG,SAAS,CAAC;IACrD,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAuBF,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,GACvC,SAAS,kCAAkC,KACzC,iCA4CF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { DerivationPlan, InstrumentationArgIdentifier, InstrumentationParamBinding } from '@rasputin-ai/core';
2
+ import type { EncodedFunctionPlan } from '../execution-recorder/function-plan';
3
+ export type RawManifestCallSite = {
4
+ callerFunctionId: string;
5
+ calleeName: string;
6
+ calleeText: string;
7
+ filePath: string;
8
+ line: number;
9
+ column: number;
10
+ endLine: number;
11
+ endColumn: number;
12
+ resultBinding: string | null;
13
+ argIdentifiers: InstrumentationArgIdentifier[];
14
+ };
15
+ export type RawManifestDestructure = {
16
+ callerFunctionId: string;
17
+ sourceParam: string;
18
+ filePath: string;
19
+ line: number;
20
+ column: number;
21
+ binding: InstrumentationParamBinding;
22
+ };
23
+ export type RawManifestFunction = {
24
+ plan: EncodedFunctionPlan;
25
+ functionId: string;
26
+ filePath: string;
27
+ name: string;
28
+ startLine: number;
29
+ startColumn: number;
30
+ endLine: number;
31
+ endColumn: number;
32
+ params: InstrumentationParamBinding[];
33
+ paramNames: Set<string>;
34
+ };
35
+ export type InstrumentationManifestDelta = {
36
+ functions: RawManifestFunction[];
37
+ callSites: RawManifestCallSite[];
38
+ destructures: RawManifestDestructure[];
39
+ derivationPlans: DerivationPlan[];
40
+ };
41
+ //# sourceMappingURL=instrumentation-manifest-delta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation-manifest-delta.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/instrumentation-manifest-delta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,4BAA4B,EAC5B,2BAA2B,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,MAAM,MAAM,mBAAmB,GAAG;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,4BAA4B,EAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,2BAA2B,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,2BAA2B,EAAE,CAAC;IACtC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IAC1C,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,eAAe,EAAE,cAAc,EAAE,CAAC;CAClC,CAAC"}
@@ -1,11 +1,14 @@
1
1
  import { type InstrumentationManifestContent } from '@rasputin-ai/core';
2
- import type { InstrumentationManifestDelta } from './collect-instrumentation-delta';
3
- export declare const INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.v2";
2
+ import type { InstrumentationManifestDelta } from './instrumentation-manifest-delta';
3
+ export declare const INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.v3";
4
4
  type SnapshotOptions = {
5
5
  sourceRoot?: string;
6
6
  sourceRoots?: Record<string, string>;
7
7
  };
8
8
  export declare const recordInstrumentationManifestDelta: (filePath: string, delta: InstrumentationManifestDelta) => void;
9
+ export declare const recordPrebuiltInstrumentationManifest: (manifest: InstrumentationManifestContent) => void;
10
+ export declare const loadInstrumentationManifestFile: (path: string) => boolean;
11
+ export declare const loadInstrumentationManifestIfPresent: (path: string | undefined) => void;
9
12
  export declare const isInstrumentationManifestDirty: () => boolean;
10
13
  export declare const instrumentationManifestGeneration: () => number;
11
14
  export declare const instrumentationManifestModuleCount: () => number;
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation-manifest-registry.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/instrumentation-manifest-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAGN,KAAK,8BAA8B,EAKnC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAEpF,eAAO,MAAM,+BAA+B,yCAAyC,CAAC;AAYtF,KAAK,eAAe,GAAG;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAiCF,eAAO,MAAM,kCAAkC,GAC9C,UAAU,MAAM,EAChB,OAAO,4BAA4B,KACjC,IAKF,CAAC;AAEF,eAAO,MAAM,8BAA8B,QAAO,OAGjD,CAAC;AAEF,eAAO,MAAM,iCAAiC,QAAO,MAAkC,CAAC;AAExF,eAAO,MAAM,kCAAkC,QAAO,MAAkC,CAAC;AAEzF,eAAO,MAAM,+BAA+B,GAC3C,UAAS,eAAoB,KAC3B,8BAA8B,GAAG,SAiFnC,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAAI,YAAY,MAAM,KAAG,IAGxE,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,UAAU,MAAM,IAAI,KAAG,IAExE,CAAC;AAEF,eAAO,MAAM,oCAAoC,QAAO,IAEvD,CAAC"}
1
+ {"version":3,"file":"instrumentation-manifest-registry.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/instrumentation-manifest-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAIN,KAAK,8BAA8B,EAKnC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAErF,eAAO,MAAM,+BAA+B,yCAAyC,CAAC;AAatF,KAAK,eAAe,GAAG;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAiCF,eAAO,MAAM,kCAAkC,GAC9C,UAAU,MAAM,EAChB,OAAO,4BAA4B,KACjC,IAKF,CAAC;AAEF,eAAO,MAAM,qCAAqC,GACjD,UAAU,8BAA8B,KACtC,IAKF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,MAAM,MAAM,KAAG,OAU9D,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,IAG/E,CAAC;AAEF,eAAO,MAAM,8BAA8B,QAAO,OAMjD,CAAC;AAEF,eAAO,MAAM,iCAAiC,QAAO,MAAkC,CAAC;AAExF,eAAO,MAAM,kCAAkC,QAAO,MAKrD,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC3C,UAAS,eAAoB,KAC3B,8BAA8B,GAAG,SAgGnC,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAAI,YAAY,MAAM,KAAG,IAGxE,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,UAAU,MAAM,IAAI,KAAG,IAExE,CAAC;AAEF,eAAO,MAAM,oCAAoC,QAAO,IAEvD,CAAC"}
@@ -1,7 +1,13 @@
1
- import { type InstrumentationManifestDelta } from './collect-instrumentation-delta';
1
+ import type { InstrumentationManifestDelta } from './instrumentation-manifest-delta';
2
+ export type DerivationCaptureMode = 'analysis' | 'selective';
2
3
  export type TransformSourceOptions = {
3
4
  filePath: string;
4
5
  mapLocation?: SourceLocationMapper;
6
+ /**
7
+ * analysis (default): full call capture plus derivation.
8
+ * selective (experimental): omit argument/return serialization for exact helpers.
9
+ */
10
+ derivationMode?: DerivationCaptureMode;
5
11
  };
6
12
  export type TransformedSource = {
7
13
  code: string;
@@ -1 +1 @@
1
- {"version":3,"file":"transform-source.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/transform-source.ts"],"names":[],"mappings":"AAWA,OAAO,EAIN,KAAK,4BAA4B,EAGjC,MAAM,iCAAiC,CAAC;AAIzC,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AAuH5F,6FAA6F;AAC7F,eAAO,MAAM,eAAe,GAC3B,QAAQ,MAAM,EACd,SAAS,sBAAsB,KAC7B,iBAAiB,GAAG,SAiFtB,CAAC"}
1
+ {"version":3,"file":"transform-source.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/transform-source.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACX,4BAA4B,EAE5B,MAAM,kCAAkC,CAAC;AAI1C,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AA6J5F,6FAA6F;AAC7F,eAAO,MAAM,eAAe,GAC3B,QAAQ,MAAM,EACd,SAAS,sBAAsB,KAC7B,iBAAiB,GAAG,SAqItB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Load-time transformation pulls the TypeScript compiler into the application process. Production
3
+ * should prefer `rasputin-instrument` at build time; this warning exists so that fallback stays
4
+ * available without being mistaken for the low-overhead path.
5
+ */
6
+ export declare const RUNTIME_TRANSFORM_WARNING_SUPPRESS_ENV = "RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING";
7
+ export declare const warnIfProductionRuntimeTransform: () => void;
8
+ //# sourceMappingURL=warn-production-runtime-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn-production-runtime-transform.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/warn-production-runtime-transform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,gDAAgD,CAAC;AAIpG,eAAO,MAAM,gCAAgC,QAAO,IAQnD,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { CaptureReason, DerivationPlan } from '@rasputin-ai/core';
2
+ import ts from 'typescript';
3
+ import { type FunctionCallEdge } from './build-dependency-graph';
4
+ export type CaptureWrap = {
5
+ rootId: number;
6
+ reason: CaptureReason;
7
+ start: number;
8
+ end: number;
9
+ line: number;
10
+ column: number;
11
+ expressionId: number;
12
+ /** Object-literal shorthand must be expanded before its value can be wrapped. */
13
+ shorthandPropertyName?: string;
14
+ };
15
+ type NumericBinaryOp = 'add' | 'sub' | 'mul' | 'div' | 'mod';
16
+ export type GuardWrap = {
17
+ fallbackRootId: number;
18
+ start: number;
19
+ end: number;
20
+ op: NumericBinaryOp;
21
+ };
22
+ export type AnalyzedFunction = {
23
+ functionId: string;
24
+ name: string;
25
+ node: ts.FunctionLikeDeclaration;
26
+ plan: DerivationPlan;
27
+ captureWraps: CaptureWrap[];
28
+ guardWraps: GuardWrap[];
29
+ callEdges: FunctionCallEdge[];
30
+ hasThrow: boolean;
31
+ hasCoercionGuard: boolean;
32
+ };
33
+ export type ModuleFunctionTarget = {
34
+ functionId: string;
35
+ name: string;
36
+ node: ts.FunctionLikeDeclaration & {
37
+ body: ts.ConciseBody;
38
+ };
39
+ };
40
+ export declare const analyzeModuleFunctions: (sourceFile: ts.SourceFile, targets: ModuleFunctionTarget[]) => AnalyzedFunction[];
41
+ export {};
42
+ //# sourceMappingURL=analyze-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-function.d.ts","sourceRoot":"","sources":["../../src/derivation/analyze-function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EAGb,cAAc,EAGd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAEN,KAAK,gBAAgB,EAErB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,KAAK,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,eAAe,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,EAAE,CAAC,uBAAuB,CAAC;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC1B,CAAC;AAojBF,MAAM,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,EAAE,CAAC,uBAAuB,GAAG;QAAE,IAAI,EAAE,EAAE,CAAC,WAAW,CAAA;KAAE,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAClC,YAAY,EAAE,CAAC,UAAU,EACzB,SAAS,oBAAoB,EAAE,KAC7B,gBAAgB,EA2ClB,CAAC"}
@@ -0,0 +1,21 @@
1
+ export type FunctionCallEdge = {
2
+ callerFunctionId: string;
3
+ calleeName: string;
4
+ calleeFunctionId?: string;
5
+ };
6
+ export type FunctionDependencyGraph = {
7
+ functions: string[];
8
+ edges: FunctionCallEdge[];
9
+ calleesByCaller: Map<string, string[]>;
10
+ };
11
+ /** Same-module identifier calls only. Anything else is treated as opaque at the call site. */
12
+ export declare const buildDependencyGraph: (functions: Array<{
13
+ functionId: string;
14
+ name: string;
15
+ }>, edges: FunctionCallEdge[]) => FunctionDependencyGraph;
16
+ /** Callees before callers so purity proofs can be reused at call sites. */
17
+ export declare const topologicalFunctionOrder: (functions: Array<{
18
+ functionId: string;
19
+ name: string;
20
+ }>, graph: FunctionDependencyGraph) => string[];
21
+ //# sourceMappingURL=build-dependency-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-dependency-graph.d.ts","sourceRoot":"","sources":["../../src/derivation/build-dependency-graph.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,oBAAoB,GAChC,WAAW,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,OAAO,gBAAgB,EAAE,KACvB,uBAcF,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,GACpC,WAAW,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,OAAO,uBAAuB,KAC5B,MAAM,EA8CR,CAAC"}