@rasputin-ai/node 0.1.4 → 0.3.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.
- package/README.md +129 -14
- package/dist/auto-instrumentation/bun-plugin.d.ts +23 -0
- package/dist/auto-instrumentation/bun-plugin.d.ts.map +1 -0
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts +58 -0
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +11 -0
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -0
- package/dist/auto-instrumentation/node-hooks.d.ts +6 -0
- package/dist/auto-instrumentation/node-hooks.d.ts.map +1 -0
- package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts +16 -0
- package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts.map +1 -0
- package/dist/auto-instrumentation/sdk-source-boundary.d.ts +7 -0
- package/dist/auto-instrumentation/sdk-source-boundary.d.ts.map +1 -0
- package/dist/auto-instrumentation/source-classification.d.ts +10 -0
- package/dist/auto-instrumentation/source-classification.d.ts.map +1 -0
- package/dist/auto-instrumentation/source-map-locations.d.ts +3 -0
- package/dist/auto-instrumentation/source-map-locations.d.ts.map +1 -0
- package/dist/auto-instrumentation/transform-source.d.ts +18 -0
- package/dist/auto-instrumentation/transform-source.d.ts.map +1 -0
- package/dist/execution-recorder/automatic-runtime.d.ts +18 -0
- package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -0
- package/dist/execution-recorder/call-aware-event-buffer.d.ts +23 -0
- package/dist/execution-recorder/call-aware-event-buffer.d.ts.map +1 -0
- package/dist/execution-recorder/execution-recorder-types.d.ts +71 -0
- package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -0
- package/dist/execution-recorder/execution-recorder.d.ts +4 -0
- package/dist/execution-recorder/execution-recorder.d.ts.map +1 -0
- package/dist/execution-recorder/index.d.ts +3 -0
- package/dist/execution-recorder/index.d.ts.map +1 -0
- package/dist/execution-recorder/recorder-memory-budget.d.ts +37 -0
- package/dist/execution-recorder/recorder-memory-budget.d.ts.map +1 -0
- package/dist/execution-recorder/safe-serialize.d.ts +10 -0
- package/dist/execution-recorder/safe-serialize.d.ts.map +1 -0
- package/dist/execution-recorder/source-exclusions.d.ts +9 -0
- package/dist/execution-recorder/source-exclusions.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1201 -8
- package/dist/install-global-handlers.d.ts.map +1 -1
- package/dist/instrument/bun.d.ts +2 -0
- package/dist/instrument/bun.d.ts.map +1 -0
- package/dist/instrument/bun.js +477 -0
- package/dist/instrument/node.d.ts +2 -0
- package/dist/instrument/node.d.ts.map +1 -0
- package/dist/instrument/node.js +532 -0
- package/dist/rasputin-init.d.ts +29 -2
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +1 -1
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,33 +1,148 @@
|
|
|
1
|
-
# Official Rasputin AI SDK for Node
|
|
1
|
+
# Official Rasputin AI SDK for Node and Bun
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
16
|
+
enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
|
|
17
|
+
moduleUrl: import.meta.url,
|
|
12
18
|
});
|
|
19
|
+
```
|
|
13
20
|
|
|
21
|
+
Uncaught exceptions and unhandled rejections are reported automatically.
|
|
22
|
+
|
|
23
|
+
## Capture handled errors
|
|
24
|
+
|
|
25
|
+
```ts
|
|
14
26
|
try {
|
|
15
|
-
|
|
27
|
+
await processPayment();
|
|
16
28
|
} catch (error) {
|
|
17
29
|
rasputin.captureException(error);
|
|
18
30
|
}
|
|
19
31
|
```
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
For short-lived processes (scripts, serverless), call `await rasputin.flush()` before exit.
|
|
24
|
-
|
|
25
|
-
## Options
|
|
33
|
+
## Configuration
|
|
26
34
|
|
|
27
35
|
| Field | Required | Description |
|
|
28
36
|
| --- | --- | --- |
|
|
29
37
|
| `projectApiKey` | yes | Project API key from the Rasputin dashboard |
|
|
30
|
-
| `environment` | yes |
|
|
31
|
-
| `release` |
|
|
32
|
-
| `enabled` | no |
|
|
33
|
-
| `
|
|
38
|
+
| `environment` | yes | Environment such as `production`, `staging`, or `preview` |
|
|
39
|
+
| `release` | yes | Git commit SHA for the deployed version |
|
|
40
|
+
| `enabled` | no | Enables or disables the SDK; defaults to `true` |
|
|
41
|
+
| `moduleUrl` | one of these two | `import.meta.url` from the initialization file |
|
|
42
|
+
| `repoRoot` | one of these two | Explicit source root for deployments with a different filesystem layout |
|
|
43
|
+
|
|
44
|
+
## Shutdown
|
|
45
|
+
|
|
46
|
+
Events are sent in the background. Flush before a short-lived process exits:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
await rasputin.flush();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Call `await rasputin.close()` during graceful shutdown when the process stays alive afterward.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
# Runtime recorder
|
|
57
|
+
|
|
58
|
+
Optionally attach the runtime state that led to an error — arguments, return values, and call history from the failing execution.
|
|
59
|
+
|
|
60
|
+
## Automatic instrumentation
|
|
61
|
+
|
|
62
|
+
Start your process with the adapter for your runtime so Rasputin can instrument application functions as they load:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"scripts": {
|
|
67
|
+
"start:node": "node --import @rasputin-ai/node/instrument/node dist/app.js",
|
|
68
|
+
"start:bun": "bun --preload @rasputin-ai/node/instrument/bun src/app.ts"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Runtime state is retained only inside an active execution and attached when that execution throws.
|
|
74
|
+
|
|
75
|
+
## Manual capture
|
|
76
|
+
|
|
77
|
+
Wrap each meaningful unit of work — an HTTP request, background job, scheduled task, or worker iteration — in an execution:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
await rasputin.execution.run({ kind: 'job', name: 'sync-invoices' }, async () => {
|
|
81
|
+
await syncInvoices();
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
When automatic instrumentation is unavailable, mark individual functions explicitly:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const syncInvoices = rasputin.execution.trace(
|
|
89
|
+
'src/jobs/sync-invoices.ts:syncInvoices',
|
|
90
|
+
async () => {
|
|
91
|
+
// ...
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Framework packages such as `@rasputin-ai/elysia` create HTTP executions automatically.
|
|
97
|
+
|
|
98
|
+
## Runtime support
|
|
99
|
+
|
|
100
|
+
| Environment | Support |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| Bun 1.3.x | Supported for directly loaded JavaScript and TypeScript using `instrument/bun` |
|
|
103
|
+
| Node.js 22.15 or newer | Supported for unbundled ESM/CJS JavaScript using `instrument/node`; Node 22 and 24 are the supported LTS lines |
|
|
104
|
+
| TypeScript compiled to multiple JavaScript files | Supported on Node; emit adjacent source maps to retain original TypeScript locations |
|
|
105
|
+
| Single-file bundles (esbuild, tsup, webpack, Vite SSR, Next.js) | Automatic instrumentation not supported |
|
|
106
|
+
| `tsx`, custom Node loader stacks, and Node's native TypeScript execution | Automatic instrumentation not supported |
|
|
107
|
+
| Deno and edge runtimes | Not supported |
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
## Recorder configuration
|
|
112
|
+
|
|
113
|
+
Defaults work for most apps. Customize to exclude noisy sources, redact fields, or retain less state:
|
|
114
|
+
|
|
115
|
+
| Field | Default | Description |
|
|
116
|
+
| --- | ---: | --- |
|
|
117
|
+
| `enabled` | `true` | Enables runtime-state capture |
|
|
118
|
+
| `maxEventsPerExecution` | `500` | Maximum events retained for one execution |
|
|
119
|
+
| `maxCapturedCallsPerFunction` | `3` | Detailed successful calls retained before similar calls are summarized |
|
|
120
|
+
| `maxActiveMemoryBytes` | `64 MiB` | Maximum recorder memory shared across active executions |
|
|
121
|
+
| `maxDepth` | `3` | Maximum captured value depth |
|
|
122
|
+
| `maxObjectKeys` | `30` | Maximum properties retained from one object |
|
|
123
|
+
| `maxArrayElements` | `20` | Maximum items retained from one array, map, or set |
|
|
124
|
+
| `maxStringLength` | `500` | Maximum characters retained from one string |
|
|
125
|
+
| `maxSerializedValueBytes` | `8 KiB` | Maximum retained size of one captured value |
|
|
126
|
+
| `redactKeys` | `[]` | Additional case-insensitive property names to redact |
|
|
127
|
+
| `excludeSources` | `[]` | Source globs or function-ID patterns to exclude |
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
const rasputin = RasputinInit({
|
|
131
|
+
// ...required options
|
|
132
|
+
executionRecorder: {
|
|
133
|
+
excludeSources: ['src/logger/**', 'packages/shared-logger/**'],
|
|
134
|
+
redactKeys: ['customerEmail'],
|
|
135
|
+
maxEventsPerExecution: 200,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Runtime state can include application data. Use `redactKeys` for sensitive fields.
|
|
141
|
+
|
|
142
|
+
## Diagnostics
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
const { recorder, transport } = rasputin.getStats();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
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,58 @@
|
|
|
1
|
+
import type { InstrumentationArgIdentifier, InstrumentationParamBinding } from '@rasputin-ai/core';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
type SourceLocation = {
|
|
4
|
+
filePath: string;
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
};
|
|
8
|
+
type SourceLocationMapper = (location: SourceLocation) => SourceLocation | undefined;
|
|
9
|
+
type RawManifestCallSite = {
|
|
10
|
+
callerSourceToken: string;
|
|
11
|
+
calleeName: string;
|
|
12
|
+
calleeText: string;
|
|
13
|
+
filePath: string;
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
endLine: number;
|
|
17
|
+
endColumn: number;
|
|
18
|
+
resultBinding: string | null;
|
|
19
|
+
argIdentifiers: InstrumentationArgIdentifier[];
|
|
20
|
+
};
|
|
21
|
+
type RawManifestDestructure = {
|
|
22
|
+
callerSourceToken: string;
|
|
23
|
+
sourceParam: string;
|
|
24
|
+
filePath: string;
|
|
25
|
+
line: number;
|
|
26
|
+
column: number;
|
|
27
|
+
binding: InstrumentationParamBinding;
|
|
28
|
+
};
|
|
29
|
+
type CollectContext = {
|
|
30
|
+
sourceFile: ts.SourceFile;
|
|
31
|
+
mapLocation?: SourceLocationMapper;
|
|
32
|
+
absolutePath: string;
|
|
33
|
+
};
|
|
34
|
+
export type RawManifestFunction = {
|
|
35
|
+
sourceToken: string;
|
|
36
|
+
filePath: string;
|
|
37
|
+
name: string;
|
|
38
|
+
startLine: number;
|
|
39
|
+
startColumn: number;
|
|
40
|
+
endLine: number;
|
|
41
|
+
endColumn: number;
|
|
42
|
+
params: InstrumentationParamBinding[];
|
|
43
|
+
paramNames: Set<string>;
|
|
44
|
+
};
|
|
45
|
+
export type InstrumentationManifestDelta = {
|
|
46
|
+
functions: RawManifestFunction[];
|
|
47
|
+
callSites: RawManifestCallSite[];
|
|
48
|
+
destructures: RawManifestDestructure[];
|
|
49
|
+
};
|
|
50
|
+
export declare const collectFunctionParams: (node: ts.FunctionLikeDeclaration, sourceFile: ts.SourceFile) => {
|
|
51
|
+
params: InstrumentationParamBinding[];
|
|
52
|
+
paramNames: Set<string>;
|
|
53
|
+
};
|
|
54
|
+
export declare const mappedLocation: (sourceFile: ts.SourceFile, position: number, absolutePath: string, mapLocation?: SourceLocationMapper) => SourceLocation | undefined;
|
|
55
|
+
export declare const collectCallSite: (call: ts.CallExpression | ts.NewExpression, caller: RawManifestFunction, context: CollectContext) => RawManifestCallSite | null;
|
|
56
|
+
export declare const collectParamDestructure: (declaration: ts.VariableDeclaration, caller: RawManifestFunction, context: CollectContext) => RawManifestDestructure | null;
|
|
57
|
+
export {};
|
|
58
|
+
//# 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,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,11 @@
|
|
|
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.v1";
|
|
4
|
+
export declare const recordInstrumentationManifestDelta: (filePath: string, delta: InstrumentationManifestDelta) => void;
|
|
5
|
+
export declare const isInstrumentationManifestDirty: () => boolean;
|
|
6
|
+
export declare const instrumentationManifestGeneration: () => number;
|
|
7
|
+
export declare const snapshotInstrumentationManifest: (repoRoot: string) => InstrumentationManifestContent | undefined;
|
|
8
|
+
export declare const markInstrumentationManifestUploaded: (generation: number) => void;
|
|
9
|
+
export declare const setInstrumentationManifestOnDirty: (onDirty?: () => void) => void;
|
|
10
|
+
export declare const resetInstrumentationManifestRegistry: () => void;
|
|
11
|
+
//# 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":"AAKA,OAAO,KAAK,EAEX,8BAA8B,EAG9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAEpF,eAAO,MAAM,+BAA+B,yCAAyC,CAAC;AA2CtF,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,+BAA+B,GAC3C,UAAU,MAAM,KACd,8BAA8B,GAAG,SAmEnC,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAAI,YAAY,MAAM,KAAG,IAKxE,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,16 @@
|
|
|
1
|
+
type ScheduleInstrumentationManifestUploadOptions = {
|
|
2
|
+
projectApiKey: string;
|
|
3
|
+
release?: string;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
repoRoot?: string;
|
|
6
|
+
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
type InstrumentationManifestUploadHandle = {
|
|
10
|
+
flushSoon: () => void;
|
|
11
|
+
wait: () => Promise<void>;
|
|
12
|
+
disconnect: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const scheduleInstrumentationManifestUpload: (options: ScheduleInstrumentationManifestUploadOptions) => InstrumentationManifestUploadHandle;
|
|
15
|
+
export {};
|
|
16
|
+
//# 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,KAAK,4CAA4C,GAAG;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,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;CACvB,CAAC;AAQF,eAAO,MAAM,qCAAqC,GACjD,SAAS,4CAA4C,KACnD,mCA4CF,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 @@
|
|
|
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,18 @@
|
|
|
1
|
+
import type { RasputinExecution } from './execution-recorder-types';
|
|
2
|
+
export declare const AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v1";
|
|
3
|
+
type AutomaticFunctionSource = {
|
|
4
|
+
filePath: string;
|
|
5
|
+
name: string;
|
|
6
|
+
line: number;
|
|
7
|
+
column: number;
|
|
8
|
+
};
|
|
9
|
+
type AutomaticExecutionRuntimeOptions = {
|
|
10
|
+
repoRoot?: string;
|
|
11
|
+
};
|
|
12
|
+
/** Encode source metadata once at transform time without allocating an object per function call. */
|
|
13
|
+
export declare const encodeAutomaticFunctionSource: (source: AutomaticFunctionSource) => string;
|
|
14
|
+
export declare const normalizeAutomaticFunctionId: (sourceToken: string, repoRoot: string) => string | undefined;
|
|
15
|
+
/** Connect compiler-instrumented application functions to this SDK instance. */
|
|
16
|
+
export declare const installAutomaticExecutionRuntime: (execution: RasputinExecution, options?: AutomaticExecutionRuntimeOptions) => (() => void);
|
|
17
|
+
export {};
|
|
18
|
+
//# 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":"AAOA,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;AAEF,KAAK,gCAAgC,GAAG;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAWF,oGAAoG;AACpG,eAAO,MAAM,6BAA6B,GAAI,QAAQ,uBAAuB,KAAG,MAG9E,CAAC;AAEH,eAAO,MAAM,4BAA4B,GACxC,aAAa,MAAM,EACnB,UAAU,MAAM,KACd,MAAM,GAAG,SAWX,CAAC;AA0BF,gFAAgF;AAChF,eAAO,MAAM,gCAAgC,GAC5C,WAAW,iBAAiB,EAC5B,UAAS,gCAAqC,KAC5C,CAAC,MAAM,IAAI,CAwBb,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,71 @@
|
|
|
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, RuntimeFunctionEnterEvent } 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 ExecutionRecorderStats = {
|
|
41
|
+
errorSnapshots: number;
|
|
42
|
+
successfulExecutionsDiscarded: number;
|
|
43
|
+
truncatedEvents: number;
|
|
44
|
+
repeatedCallsSuppressed: number;
|
|
45
|
+
activeExecutions: number;
|
|
46
|
+
peakActiveExecutions: number;
|
|
47
|
+
activeEstimatedBytes: number;
|
|
48
|
+
peakActiveEstimatedBytes: number;
|
|
49
|
+
memoryPressureExecutions: number;
|
|
50
|
+
memoryPressureDegradations: number;
|
|
51
|
+
valuesDroppedByMemoryBudget: number;
|
|
52
|
+
eventsDroppedByMemoryBudget: number;
|
|
53
|
+
partialErrorSnapshots: number;
|
|
54
|
+
};
|
|
55
|
+
export type ExecutionScope = {
|
|
56
|
+
run: <T>(callback: () => T) => T;
|
|
57
|
+
getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
|
|
58
|
+
finish: (metadata?: Partial<ExecutionMetadata>) => void;
|
|
59
|
+
};
|
|
60
|
+
export type RasputinExecution = {
|
|
61
|
+
createScope: (metadata: ExecutionMetadata) => ExecutionScope;
|
|
62
|
+
/** Define a logical non-HTTP execution such as a job, worker cycle, or scheduled task. */
|
|
63
|
+
run: <T>(metadata: ExecutionMetadata, callback: () => T) => T;
|
|
64
|
+
getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
|
|
65
|
+
/** Internal primitive used by SDK-owned source instrumentation. */
|
|
66
|
+
runFunction: <T>(functionId: string, args: ArrayLike<unknown>, callback: () => T) => T;
|
|
67
|
+
/** Manual fallback for runtimes/build systems without automatic instrumentation. */
|
|
68
|
+
trace: <TThis, TArgs extends unknown[], TResult>(functionId: string, fn: (this: TThis, ...args: TArgs) => TResult) => (this: TThis, ...args: TArgs) => TResult;
|
|
69
|
+
getStats: () => ExecutionRecorderStats;
|
|
70
|
+
};
|
|
71
|
+
//# 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":"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"}
|
|
@@ -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":"AASA,OAAO,KAAK,EAKX,wBAAwB,EAExB,iBAAiB,EACjB,MAAM,4BAA4B,CAAC;AAwKpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,iBA+bF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createExecutionRecorder } from './execution-recorder';
|
|
2
|
+
export type { 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,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExecutionRecorderOptions } from './execution-recorder-types';
|
|
2
|
+
export type SafeSerializedValue = {
|
|
3
|
+
value: unknown;
|
|
4
|
+
bytes: number;
|
|
5
|
+
};
|
|
6
|
+
/** Safely converts an arbitrary value and reports its bounded JSON byte size. */
|
|
7
|
+
export declare const safeSerializeWithBytes: (value: unknown, options?: ExecutionRecorderOptions) => SafeSerializedValue;
|
|
8
|
+
/** Safely converts an arbitrary value to bounded JSON-compatible data. */
|
|
9
|
+
export declare const safeSerialize: (value: unknown, options?: ExecutionRecorderOptions) => unknown;
|
|
10
|
+
//# sourceMappingURL=safe-serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-serialize.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/safe-serialize.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AA4K3E,MAAM,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,GAClC,OAAO,OAAO,EACd,UAAS,wBAA6B,KACpC,mBA+BF,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,EAAE,UAAS,wBAA6B,KAAG,OAC1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source exclusions remove known-noisy utility subtrees before values are serialized. Doing this at
|
|
3
|
+
* capture time avoids both CPU work and accidental retention of redundant logger/framework state,
|
|
4
|
+
* while compiling patterns once keeps the exclusion feature off the hot path.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExecutionSourceExclusion } from './execution-recorder-types';
|
|
7
|
+
/** Compile exclusions once so skipped calls avoid serialization and repeated pattern work. */
|
|
8
|
+
export declare const createSourceExclusionMatcher: (exclusions: ExecutionSourceExclusion[] | undefined) => ((functionId: string) => boolean);
|
|
9
|
+
//# sourceMappingURL=source-exclusions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-exclusions.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/source-exclusions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAsC3E,8FAA8F;AAC9F,eAAO,MAAM,4BAA4B,GACxC,YAAY,wBAAwB,EAAE,GAAG,SAAS,KAChD,CAAC,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CA8BlC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type { CaptureContext, RasputinClient, RasputinOptions } from '@rasputin-ai/core';
|
|
2
|
+
export { scheduleInstrumentationManifestUpload } from './auto-instrumentation/schedule-instrumentation-manifest-upload';
|
|
3
|
+
export type { ExecutionKind, ExecutionMetadata, ExecutionRecorderOptions, ExecutionRecorderStats, ExecutionScope, ExecutionSourceExclusion, ExecutionState, RasputinExecution, } from './execution-recorder';
|
|
4
|
+
export { createExecutionRecorder } from './execution-recorder';
|
|
5
|
+
export { installAutomaticExecutionRuntime } from './execution-recorder/automatic-runtime';
|
|
2
6
|
export type { InstallGlobalHandlersOptions } from './install-global-handlers';
|
|
3
7
|
export { installGlobalHandlers } from './install-global-handlers';
|
|
8
|
+
export type { RasputinNodeClient, RasputinNodeClientStats, RasputinNodeOptions, } from './rasputin-init';
|
|
4
9
|
export { RasputinInit } from './rasputin-init';
|
|
5
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzF,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,iEAAiE,CAAC;AACxH,YAAY,EACX,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,iBAAiB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EACX,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|