@rasputin-ai/node 0.2.0 → 0.4.0

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 (51) hide show
  1. package/README.md +143 -16
  2. package/dist/auto-instrumentation/bun-plugin.d.ts +23 -0
  3. package/dist/auto-instrumentation/bun-plugin.d.ts.map +1 -0
  4. package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts +64 -0
  5. package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts.map +1 -0
  6. package/dist/auto-instrumentation/format-configuration-report.d.ts +14 -0
  7. package/dist/auto-instrumentation/format-configuration-report.d.ts.map +1 -0
  8. package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +17 -0
  9. package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -0
  10. package/dist/auto-instrumentation/node-hooks.d.ts +6 -0
  11. package/dist/auto-instrumentation/node-hooks.d.ts.map +1 -0
  12. package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts +26 -0
  13. package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts.map +1 -0
  14. package/dist/auto-instrumentation/sdk-source-boundary.d.ts +7 -0
  15. package/dist/auto-instrumentation/sdk-source-boundary.d.ts.map +1 -0
  16. package/dist/auto-instrumentation/source-classification.d.ts +10 -0
  17. package/dist/auto-instrumentation/source-classification.d.ts.map +1 -0
  18. package/dist/auto-instrumentation/source-map-locations.d.ts +3 -0
  19. package/dist/auto-instrumentation/source-map-locations.d.ts.map +1 -0
  20. package/dist/auto-instrumentation/transform-source.d.ts +18 -0
  21. package/dist/auto-instrumentation/transform-source.d.ts.map +1 -0
  22. package/dist/execution-recorder/automatic-runtime.d.ts +21 -0
  23. package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -0
  24. package/dist/execution-recorder/call-aware-event-buffer.d.ts +23 -0
  25. package/dist/execution-recorder/call-aware-event-buffer.d.ts.map +1 -0
  26. package/dist/execution-recorder/execution-recorder-types.d.ts +75 -0
  27. package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -0
  28. package/dist/execution-recorder/execution-recorder.d.ts +4 -0
  29. package/dist/execution-recorder/execution-recorder.d.ts.map +1 -0
  30. package/dist/execution-recorder/index.d.ts +3 -0
  31. package/dist/execution-recorder/index.d.ts.map +1 -0
  32. package/dist/execution-recorder/recorder-memory-budget.d.ts +37 -0
  33. package/dist/execution-recorder/recorder-memory-budget.d.ts.map +1 -0
  34. package/dist/execution-recorder/safe-serialize.d.ts +10 -0
  35. package/dist/execution-recorder/safe-serialize.d.ts.map +1 -0
  36. package/dist/execution-recorder/source-exclusions.d.ts +10 -0
  37. package/dist/execution-recorder/source-exclusions.d.ts.map +1 -0
  38. package/dist/index.d.ts +5 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1393 -5
  41. package/dist/instrument/bun.d.ts +2 -0
  42. package/dist/instrument/bun.d.ts.map +1 -0
  43. package/dist/instrument/bun.js +489 -0
  44. package/dist/instrument/node.d.ts +2 -0
  45. package/dist/instrument/node.d.ts.map +1 -0
  46. package/dist/instrument/node.js +544 -0
  47. package/dist/rasputin-init.d.ts +24 -4
  48. package/dist/rasputin-init.d.ts.map +1 -1
  49. package/dist/sdk-meta.d.ts +2 -2
  50. package/dist/sdk-meta.d.ts.map +1 -1
  51. package/package.json +15 -4
package/README.md CHANGED
@@ -1,35 +1,162 @@
1
- # Official Rasputin AI SDK for Node
1
+ # Official Rasputin AI SDK for Node and Bun
2
2
 
3
- ## Usage
3
+ Report application errors to Rasputin.
4
+
5
+ ## Setup
6
+
7
+ Initialize once when your application starts:
4
8
 
5
9
  ```ts
6
10
  import { RasputinInit } from '@rasputin-ai/node';
7
11
 
8
- const rasputin = RasputinInit({
12
+ export const rasputin = RasputinInit({
9
13
  projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY!,
14
+ release: process.env.RASPUTIN_RELEASE!,
10
15
  environment: process.env.NODE_ENV ?? 'development',
11
- release: process.env.RASPUTIN_RELEASE,
12
- moduleUrl: import.meta.url,
16
+ enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
13
17
  });
18
+ ```
14
19
 
20
+ Uncaught exceptions and unhandled rejections are reported automatically.
21
+
22
+ ## Capture handled errors
23
+
24
+ ```ts
15
25
  try {
16
- // ...
26
+ await processPayment();
17
27
  } catch (error) {
18
28
  rasputin.captureException(error);
19
29
  }
20
30
  ```
21
31
 
22
- Call `RasputinInit` once at process startup. Uncaught errors and unhandled rejections are captured automatically.
23
-
24
- For short-lived processes (scripts, serverless), call `await rasputin.flush()` before exit.
25
-
26
- ## Options
32
+ ## Configuration
27
33
 
28
34
  | Field | Required | Description |
29
35
  | --- | --- | --- |
30
36
  | `projectApiKey` | yes | Project API key from the Rasputin dashboard |
31
- | `environment` | yes | Where errors occur, e.g. `production`, `staging` |
32
- | `release` | no | Git commit SHA. Prefer `process.env.RASPUTIN_RELEASE`; auto-detected from platform env / `.git` when omitted |
33
- | `enabled` | no | Master switch. Default `true` |
34
- | `moduleUrl` | one of these two | `import.meta.url` from the file where you call `RasputinInit`. Lets Rasputin find your project folder. |
35
- | `repoRoot` | one of these two | Your project folder — the one you open in your editor. Use this when `moduleUrl` isn't enough (for example in Docker). |
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.
@@ -0,0 +1,23 @@
1
+ import type { BunPlugin, Loader } from 'bun';
2
+ export type RasputinBunInstrumentationOptions = {
3
+ /** Optional explicit source boundary. By default, all loaded local source is considered. */
4
+ rootDir?: string;
5
+ /** Further restrict loaded local source using its absolute runtime path. */
6
+ include?: RegExp;
7
+ /** Exclude loaded source using its absolute runtime path. */
8
+ exclude?: RegExp;
9
+ /** Internal package roots that must never be transformed, including workspace-linked SDKs. */
10
+ excludedRoots?: readonly string[];
11
+ debug?: boolean;
12
+ };
13
+ type InstrumentationLoadResult = {
14
+ contents: string;
15
+ loader: Loader;
16
+ transformed: boolean;
17
+ };
18
+ export declare const isLoadedApplicationSource: (filePath: string, options?: RasputinBunInstrumentationOptions) => boolean;
19
+ /** Bun's runtime plugin loader requires an object even when a file is intentionally unchanged. */
20
+ export declare const loadSourceForInstrumentation: (filePath: string, options?: RasputinBunInstrumentationOptions) => Promise<InstrumentationLoadResult>;
21
+ export declare const createRasputinBunPlugin: (options?: RasputinBunInstrumentationOptions) => BunPlugin;
22
+ export {};
23
+ //# sourceMappingURL=bun-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-plugin.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/bun-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAK7C,MAAM,MAAM,iCAAiC,GAAG;IAC/C,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACrB,CAAC;AAcF,eAAO,MAAM,yBAAyB,GACrC,UAAU,MAAM,EAChB,UAAS,iCAAsC,KAC7C,OAAmF,CAAC;AAEvF,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,GACxC,UAAU,MAAM,EAChB,UAAS,iCAAsC,KAC7C,OAAO,CAAC,yBAAyB,CAqBnC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACnC,UAAS,iCAAsC,KAC7C,SAsBF,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Walks the TypeScript AST while a module is being transformed and records the static facts
3
+ * Rasputin needs for replay: instrumented functions, call sites, and parameter destructuring
4
+ * bindings. transform-source calls these collectors and passes the delta to the manifest
5
+ * registry so the server can map runtime locations back to Git.
6
+ */
7
+ import type { InstrumentationArgIdentifier, InstrumentationParamBinding } from '@rasputin-ai/core';
8
+ import ts from 'typescript';
9
+ type SourceLocation = {
10
+ filePath: string;
11
+ line: number;
12
+ column: number;
13
+ };
14
+ 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
+ type CollectContext = {
36
+ sourceFile: ts.SourceFile;
37
+ mapLocation?: SourceLocationMapper;
38
+ absolutePath: string;
39
+ };
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
+ export declare const collectFunctionParams: (node: ts.FunctionLikeDeclaration, sourceFile: ts.SourceFile) => {
57
+ params: InstrumentationParamBinding[];
58
+ paramNames: Set<string>;
59
+ };
60
+ export declare const mappedLocation: (sourceFile: ts.SourceFile, position: number, absolutePath: string, mapLocation?: SourceLocationMapper) => SourceLocation | undefined;
61
+ export declare const collectCallSite: (call: ts.CallExpression | ts.NewExpression, caller: RawManifestFunction, context: CollectContext) => RawManifestCallSite | null;
62
+ export declare const collectParamDestructure: (declaration: ts.VariableDeclaration, caller: RawManifestFunction, context: CollectContext) => RawManifestDestructure | null;
63
+ export {};
64
+ //# sourceMappingURL=collect-instrumentation-delta.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,14 @@
1
+ import type { SourceVerification } from '@rasputin-ai/core';
2
+ type ConfigurationReportInput = {
3
+ release: string;
4
+ runtime: string;
5
+ modules: number;
6
+ functions: number;
7
+ packageNames: string[];
8
+ verification: SourceVerification;
9
+ uploaded: boolean;
10
+ };
11
+ export declare const formatConfigurationReport: (input: ConfigurationReportInput) => string;
12
+ export declare const runtimeLabel: () => string;
13
+ export {};
14
+ //# sourceMappingURL=format-configuration-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-configuration-report.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/format-configuration-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,KAAK,wBAAwB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,kBAAkB,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;CAClB,CAAC;AA2CF,eAAO,MAAM,yBAAyB,GAAI,OAAO,wBAAwB,KAAG,MAkE3E,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,MAI/B,CAAC"}
@@ -0,0 +1,17 @@
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";
4
+ type SnapshotOptions = {
5
+ sourceRoot?: string;
6
+ sourceRoots?: Record<string, string>;
7
+ };
8
+ export declare const recordInstrumentationManifestDelta: (filePath: string, delta: InstrumentationManifestDelta) => void;
9
+ export declare const isInstrumentationManifestDirty: () => boolean;
10
+ export declare const instrumentationManifestGeneration: () => number;
11
+ export declare const instrumentationManifestModuleCount: () => number;
12
+ export declare const snapshotInstrumentationManifest: (options?: SnapshotOptions) => InstrumentationManifestContent | undefined;
13
+ export declare const markInstrumentationManifestUploaded: (generation: number) => void;
14
+ export declare const setInstrumentationManifestOnDirty: (onDirty?: () => void) => void;
15
+ export declare const resetInstrumentationManifestRegistry: () => void;
16
+ export {};
17
+ //# sourceMappingURL=instrumentation-manifest-registry.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
1
+ export type RasputinNodeInstrumentationOptions = {
2
+ /** Internal package roots that must never be transformed, including workspace-linked SDKs. */
3
+ excludedRoots?: readonly string[];
4
+ };
5
+ export declare const registerRasputinNodeHooks: (options?: RasputinNodeInstrumentationOptions) => void;
6
+ //# sourceMappingURL=node-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-hooks.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/node-hooks.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,kCAAkC,GAAG;IAChD,8FAA8F;IAC9F,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AA6BF,eAAO,MAAM,yBAAyB,GACrC,UAAS,kCAAuC,KAC9C,IA8CF,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The manifest registry accumulates instrumentation facts as modules load, but Rasputin only
3
+ * learns about them after an upload. This schedules that upload after startup without blocking
4
+ * the process, debounces on registry changes, prints the configuration report once, and exposes
5
+ * verifyConfiguration().
6
+ */
7
+ import { type SourceVerification } from '@rasputin-ai/core';
8
+ type ScheduleInstrumentationManifestUploadOptions = {
9
+ projectApiKey: string;
10
+ release?: string;
11
+ apiUrl?: string;
12
+ sourceRoot?: string;
13
+ sourceRoots?: Record<string, string>;
14
+ logSuccess?: boolean;
15
+ fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
16
+ enabled: boolean;
17
+ };
18
+ type InstrumentationManifestUploadHandle = {
19
+ flushSoon: () => void;
20
+ wait: () => Promise<void>;
21
+ disconnect: () => void;
22
+ verify: () => Promise<SourceVerification>;
23
+ };
24
+ export declare const scheduleInstrumentationManifestUpload: (options: ScheduleInstrumentationManifestUploadOptions) => InstrumentationManifestUploadHandle;
25
+ export {};
26
+ //# sourceMappingURL=schedule-instrumentation-manifest-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-instrumentation-manifest-upload.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/schedule-instrumentation-manifest-upload.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAGN,KAAK,kBAAkB,EAEvB,MAAM,mBAAmB,CAAC;AAW3B,KAAK,4CAA4C,GAAG;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjF,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,mCAAmC,GAAG;IAC1C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC1C,CAAC;AAkBF,eAAO,MAAM,qCAAqC,GACjD,SAAS,4CAA4C,KACnD,mCAwGF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The source and built preload entries both live two directories below the Node package root.
3
+ * Excluding its parent protects every sibling Rasputin package when package managers resolve a
4
+ * workspace/link to physical source paths instead of a conventional node_modules/dist location.
5
+ */
6
+ export declare const sdkPackageScopeRootFrom: (instrumentEntryUrl: string) => string;
7
+ //# sourceMappingURL=sdk-source-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-source-boundary.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/sdk-source-boundary.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,oBAAoB,MAAM,KAAG,MACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type ApplicationSourceOptions = {
2
+ rootDir?: string;
3
+ include?: RegExp;
4
+ exclude?: RegExp;
5
+ /** Physical package roots owned by the instrumentation runtime itself. */
6
+ excludedRoots?: readonly string[];
7
+ includeBuildOutput?: boolean;
8
+ };
9
+ export declare const isApplicationSource: (filePath: string, options?: ApplicationSourceOptions) => boolean;
10
+ //# sourceMappingURL=source-classification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-classification.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/source-classification.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAsBF,eAAO,MAAM,mBAAmB,GAC/B,UAAU,MAAM,EAChB,UAAS,wBAA6B,KACpC,OAcF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SourceLocationMapper } from './transform-source';
2
+ export declare const createSourceMapLocationMapper: (generatedPath: string, source: string) => SourceLocationMapper | undefined;
3
+ //# sourceMappingURL=source-map-locations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-locations.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/source-map-locations.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAkB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAgC/E,eAAO,MAAM,6BAA6B,GACzC,eAAe,MAAM,EACrB,QAAQ,MAAM,KACZ,oBAAoB,GAAG,SA8BzB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type InstrumentationManifestDelta } from './collect-instrumentation-delta';
2
+ export type TransformSourceOptions = {
3
+ filePath: string;
4
+ mapLocation?: SourceLocationMapper;
5
+ };
6
+ export type TransformedSource = {
7
+ code: string;
8
+ delta: InstrumentationManifestDelta;
9
+ };
10
+ export type SourceLocation = {
11
+ filePath: string;
12
+ line: number;
13
+ column: number;
14
+ };
15
+ export type SourceLocationMapper = (location: SourceLocation) => SourceLocation | undefined;
16
+ /** Add low-overhead function-boundary hooks while preserving the customer's source lines. */
17
+ export declare const transformSource: (source: string, options: TransformSourceOptions) => TransformedSource | undefined;
18
+ //# sourceMappingURL=transform-source.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Compiler-instrumented functions and the initialized SDK can live in separate bundles. This
3
+ * versioned global registry joins them without generated code importing a physical SDK file. Source
4
+ * tokens contain only package-relative identity, so Docker paths never leak into runtime events.
5
+ */
6
+ import { type RuntimeFunctionDefinition } from '@rasputin-ai/core';
7
+ import type { RasputinExecution } from './execution-recorder-types';
8
+ export declare const AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v2";
9
+ type AutomaticFunctionSource = {
10
+ filePath: string;
11
+ name: string;
12
+ line: number;
13
+ column: number;
14
+ };
15
+ /** Resolve package ownership at transform time, never on the user's request hot path. */
16
+ export declare const encodeAutomaticFunctionSource: (source: AutomaticFunctionSource) => string;
17
+ export declare const decodeAutomaticFunctionSource: (sourceToken: string) => RuntimeFunctionDefinition | undefined;
18
+ /** Connect transformed application functions to this SDK instance. */
19
+ export declare const installAutomaticExecutionRuntime: (execution: RasputinExecution) => (() => void);
20
+ export {};
21
+ //# sourceMappingURL=automatic-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automatic-runtime.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/automatic-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,KAAK,yBAAyB,EAG9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AAKxE,KAAK,uBAAuB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAaF,yFAAyF;AACzF,eAAO,MAAM,6BAA6B,GAAI,QAAQ,uBAAuB,KAAG,MAO/E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACzC,aAAa,MAAM,KACjB,yBAAyB,GAAG,SAe9B,CAAC;AAuBF,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,GAAI,WAAW,iBAAiB,KAAG,CAAC,MAAM,IAAI,CAkB1F,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A plain capped array can retain only half of a call and produce a misleading tree. This buffer
3
+ * preserves enter/terminal pairs and valid parent links while evicting older completed leaves, which
4
+ * keeps truncated snapshots usable by investigations and source-addressable debugging UIs.
5
+ */
6
+ import type { ExecutionEvent, ExecutionFunctionEnterEvent } from './execution-recorder-types';
7
+ export declare class CallAwareEventBuffer {
8
+ private readonly capacity;
9
+ private readonly items;
10
+ private readonly openCallIds;
11
+ dropped: number;
12
+ constructor(capacity: number);
13
+ canStartCall(): boolean;
14
+ startCall(event: ExecutionFunctionEnterEvent): void;
15
+ finishCall(event: ExecutionEvent): void;
16
+ dropCall(): void;
17
+ append(event: ExecutionEvent): boolean;
18
+ forceCompletedCall(enter: ExecutionFunctionEnterEvent, terminal: ExecutionEvent): boolean;
19
+ values(): ExecutionEvent[];
20
+ contains(target: ExecutionEvent): boolean;
21
+ private evictCompletedLeafOrSummary;
22
+ }
23
+ //# sourceMappingURL=call-aware-event-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-aware-event-buffer.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/call-aware-event-buffer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAE9F,qBAAa,oBAAoB;IAMpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IALrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAC9C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD,OAAO,SAAK;gBAEiB,QAAQ,EAAE,MAAM;IAE7C,YAAY,IAAI,OAAO;IAIvB,SAAS,CAAC,KAAK,EAAE,2BAA2B;IAK5C,UAAU,CAAC,KAAK,EAAE,cAAc;IAMhC,QAAQ;IAIR,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO;IAUtC,kBAAkB,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO;IAYzF,MAAM,IAAI,cAAc,EAAE;IAI1B,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAIzC,OAAO,CAAC,2BAA2B;CA+CnC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Public recorder contracts shared by runtime integrations and consumers. Keeping the execution and
3
+ * event model explicit allows the same bounded state to represent HTTP requests, jobs, scheduled
4
+ * work, and future serverless invocations without coupling the recorder to one framework lifecycle.
5
+ */
6
+ import type { RuntimeExecutionEvent, RuntimeExecutionKind, RuntimeExecutionMetadata, RuntimeExecutionState, RuntimeFunctionCallsSuppressedEvent, RuntimeFunctionDefinition, RuntimeFunctionEnterEvent, SourcePosition } from '@rasputin-ai/core';
7
+ export type ExecutionSourceExclusion = string | RegExp;
8
+ export type ExecutionRecorderOptions = {
9
+ /** Disable runtime-state capture explicitly. It is enabled by SDK initializers by default. */
10
+ enabled?: boolean;
11
+ /** Maximum recent runtime events retained per active execution. Default: 500. */
12
+ maxEventsPerExecution?: number;
13
+ /** Successful calls retained per function and parent before repetitions are aggregated. Default: 3. */
14
+ maxCapturedCallsPerFunction?: number;
15
+ /**
16
+ * Process-wide estimated memory available to active execution recordings. Default: 64 MiB.
17
+ * When exhausted, capture degrades from values to call structure and finally metadata-only;
18
+ * the application is never blocked or crashed to preserve recorder completeness.
19
+ */
20
+ maxActiveMemoryBytes?: number;
21
+ /**
22
+ * Repo-relative files/directories to omit from runtime state. Strings support `*` and `**` globs;
23
+ * regular expressions match the complete function ID. Excluded calls suppress their nested subtree.
24
+ */
25
+ excludeSources?: ExecutionSourceExclusion[];
26
+ /** Additional object keys whose values should be redacted before capture. */
27
+ redactKeys?: string[];
28
+ maxDepth?: number;
29
+ maxObjectKeys?: number;
30
+ maxArrayElements?: number;
31
+ maxStringLength?: number;
32
+ maxSerializedValueBytes?: number;
33
+ };
34
+ export type ExecutionMetadata = RuntimeExecutionMetadata;
35
+ export type ExecutionKind = RuntimeExecutionKind;
36
+ export type ExecutionFunctionEnterEvent = RuntimeFunctionEnterEvent;
37
+ export type ExecutionFunctionCallsSuppressedEvent = RuntimeFunctionCallsSuppressedEvent;
38
+ export type ExecutionEvent = RuntimeExecutionEvent;
39
+ export type ExecutionState = RuntimeExecutionState;
40
+ export type ExecutionFunctionDescriptor = {
41
+ name: string;
42
+ source?: SourcePosition;
43
+ };
44
+ export type ExecutionRecorderStats = {
45
+ errorSnapshots: number;
46
+ successfulExecutionsDiscarded: number;
47
+ truncatedEvents: number;
48
+ repeatedCallsSuppressed: number;
49
+ activeExecutions: number;
50
+ peakActiveExecutions: number;
51
+ activeEstimatedBytes: number;
52
+ peakActiveEstimatedBytes: number;
53
+ memoryPressureExecutions: number;
54
+ memoryPressureDegradations: number;
55
+ valuesDroppedByMemoryBudget: number;
56
+ eventsDroppedByMemoryBudget: number;
57
+ partialErrorSnapshots: number;
58
+ };
59
+ export type ExecutionScope = {
60
+ run: <T>(callback: () => T) => T;
61
+ getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
62
+ finish: (metadata?: Partial<ExecutionMetadata>) => void;
63
+ };
64
+ export type RasputinExecution = {
65
+ createScope: (metadata: ExecutionMetadata) => ExecutionScope;
66
+ /** Define a logical non-HTTP execution such as a job, worker cycle, or scheduled task. */
67
+ run: <T>(metadata: ExecutionMetadata, callback: () => T) => T;
68
+ getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
69
+ /** Internal primitive used by SDK-owned source instrumentation. */
70
+ runFunction: <T>(definition: RuntimeFunctionDefinition | string, args: ArrayLike<unknown>, callback: () => T) => T;
71
+ /** Manual fallback for runtimes/build systems without automatic instrumentation. */
72
+ trace: <TThis, TArgs extends unknown[], TResult>(definition: string | ExecutionFunctionDescriptor, fn: (this: TThis, ...args: TArgs) => TResult) => (this: TThis, ...args: TArgs) => TResult;
73
+ getStats: () => ExecutionRecorderStats;
74
+ };
75
+ //# sourceMappingURL=execution-recorder-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-recorder-types.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-recorder-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,mCAAmC,EACnC,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,wBAAwB,GAAG;IACtC,8FAA8F;IAC9F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uGAAuG;IACvG,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC5C,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC;AACjD,MAAM,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACpE,MAAM,MAAM,qCAAqC,GAAG,mCAAmC,CAAC;AACxF,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AACnD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEnD,MAAM,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,6BAA6B,EAAE,MAAM,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,2BAA2B,EAAE,MAAM,CAAC;IACpC,2BAA2B,EAAE,MAAM,CAAC;IACpC,qBAAqB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,aAAa,EAAE,CACd,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KACjC,cAAc,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,cAAc,CAAC;IAC7D,0FAA0F;IAC1F,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9D,aAAa,EAAE,CACd,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KACjC,cAAc,GAAG,SAAS,CAAC;IAChC,mEAAmE;IACnE,WAAW,EAAE,CAAC,CAAC,EACd,UAAU,EAAE,yBAAyB,GAAG,MAAM,EAC9C,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,EACxB,QAAQ,EAAE,MAAM,CAAC,KACb,CAAC,CAAC;IACP,oFAAoF;IACpF,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EAC9C,UAAU,EAAE,MAAM,GAAG,2BAA2B,EAChD,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,KACxC,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;IAC9C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;CACvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ExecutionRecorderOptions, RasputinExecution } from './execution-recorder-types';
2
+ /** Bounded, error-only execution recorder for application functions. */
3
+ export declare const createExecutionRecorder: (options: ExecutionRecorderOptions | undefined) => RasputinExecution;
4
+ //# sourceMappingURL=execution-recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-recorder.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-recorder.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAKX,wBAAwB,EAExB,iBAAiB,EACjB,MAAM,4BAA4B,CAAC;AA8LpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,iBAkdF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createExecutionRecorder } from './execution-recorder';
2
+ export type { ExecutionFunctionDescriptor, ExecutionKind, ExecutionMetadata, ExecutionRecorderOptions, ExecutionRecorderStats, ExecutionScope, ExecutionSourceExclusion, ExecutionState, RasputinExecution, } from './execution-recorder-types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EACX,2BAA2B,EAC3B,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,iBAAiB,GACjB,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { SafeSerializedValue } from './safe-serialize';
2
+ type CaptureMode = 'full' | 'structure-only' | 'metadata-only';
3
+ export type RecorderMemoryAllocation = {
4
+ mode: CaptureMode;
5
+ estimatedBytes: number;
6
+ released: boolean;
7
+ underPressure: boolean;
8
+ valuesDropped: number;
9
+ eventsDropped: number;
10
+ };
11
+ export type RecorderMemoryStats = {
12
+ activeEstimatedBytes: number;
13
+ peakActiveEstimatedBytes: number;
14
+ memoryPressureExecutions: number;
15
+ memoryPressureDegradations: number;
16
+ valuesDroppedByMemoryBudget: number;
17
+ eventsDroppedByMemoryBudget: number;
18
+ };
19
+ export declare class RecorderMemoryBudget {
20
+ private readonly maximumBytes;
21
+ private readonly maximumSerializedValueBytes;
22
+ private activeEstimatedBytes;
23
+ private readonly stats;
24
+ constructor(maximumBytes: number, maximumSerializedValueBytes: number);
25
+ startExecution(): RecorderMemoryAllocation;
26
+ captureValue(allocation: RecorderMemoryAllocation, serialize: () => SafeSerializedValue): unknown;
27
+ reserveCall(allocation: RecorderMemoryAllocation, functionId: string): boolean;
28
+ reserveStandaloneEvent(allocation: RecorderMemoryAllocation): boolean;
29
+ release(allocation: RecorderMemoryAllocation): void;
30
+ getStats(): RecorderMemoryStats;
31
+ private reserve;
32
+ private markPressure;
33
+ private dropValues;
34
+ private dropEvents;
35
+ }
36
+ export {};
37
+ //# sourceMappingURL=recorder-memory-budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorder-memory-budget.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/recorder-memory-budget.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAW5D,KAAK,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE/D,MAAM,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,2BAA2B,EAAE,MAAM,CAAC;IACpC,2BAA2B,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,qBAAa,oBAAoB;IAY/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAZ7C,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAOpB;gBAGgB,YAAY,EAAE,MAAM,EACpB,2BAA2B,EAAE,MAAM;IAGrD,cAAc,IAAI,wBAAwB;IAwB1C,YAAY,CACX,UAAU,EAAE,wBAAwB,EACpC,SAAS,EAAE,MAAM,mBAAmB,GAClC,OAAO;IAuBV,WAAW,CAAC,UAAU,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAe9E,sBAAsB,CAAC,UAAU,EAAE,wBAAwB,GAAG,OAAO;IAarE,OAAO,CAAC,UAAU,EAAE,wBAAwB;IAQ5C,QAAQ,IAAI,mBAAmB;IAI/B,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;CAIlB"}