@rasputin-ai/node 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts +6 -0
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts.map +1 -1
- package/dist/auto-instrumentation/format-configuration-report.d.ts +14 -0
- package/dist/auto-instrumentation/format-configuration-report.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +9 -3
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -1
- package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts +11 -1
- package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts.map +1 -1
- package/dist/execution-recorder/automatic-runtime.d.ts +11 -8
- package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recorder-types.d.ts +10 -3
- package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recorder.d.ts.map +1 -1
- package/dist/execution-recorder/index.d.ts +1 -1
- package/dist/execution-recorder/index.d.ts.map +1 -1
- package/dist/execution-recorder/source-exclusions.d.ts +2 -1
- package/dist/execution-recorder/source-exclusions.d.ts.map +1 -1
- package/dist/index.js +322 -113
- package/dist/instrument/bun.js +33 -21
- package/dist/instrument/node.js +32 -20
- package/dist/rasputin-init.d.ts +3 -2
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +2 -2
- package/dist/sdk-meta.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,6 @@ export const rasputin = RasputinInit({
|
|
|
14
14
|
release: process.env.RASPUTIN_RELEASE!,
|
|
15
15
|
environment: process.env.NODE_ENV ?? 'development',
|
|
16
16
|
enabled: ['staging', 'production'].includes(process.env.NODE_ENV ?? 'development'),
|
|
17
|
-
moduleUrl: import.meta.url,
|
|
18
17
|
});
|
|
19
18
|
```
|
|
20
19
|
|
|
@@ -38,8 +37,23 @@ try {
|
|
|
38
37
|
| `environment` | yes | Environment such as `production`, `staging`, or `preview` |
|
|
39
38
|
| `release` | yes | Git commit SHA for the deployed version |
|
|
40
39
|
| `enabled` | no | Enables or disables the SDK; defaults to `true` |
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
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.
|
|
43
57
|
|
|
44
58
|
## Shutdown
|
|
45
59
|
|
|
@@ -124,7 +138,7 @@ Defaults work for most apps. Customize to exclude noisy sources, redact fields,
|
|
|
124
138
|
| `maxStringLength` | `500` | Maximum characters retained from one string |
|
|
125
139
|
| `maxSerializedValueBytes` | `8 KiB` | Maximum retained size of one captured value |
|
|
126
140
|
| `redactKeys` | `[]` | Additional case-insensitive property names to redact |
|
|
127
|
-
| `excludeSources` | `[]` | Source globs or function-
|
|
141
|
+
| `excludeSources` | `[]` | Source globs or function-name patterns to exclude |
|
|
128
142
|
|
|
129
143
|
```ts
|
|
130
144
|
const rasputin = RasputinInit({
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
*/
|
|
1
7
|
import type { InstrumentationArgIdentifier, InstrumentationParamBinding } from '@rasputin-ai/core';
|
|
2
8
|
import ts from 'typescript';
|
|
3
9
|
type SourceLocation = {
|
|
@@ -1 +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,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Ac,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,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,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AAG,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"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InstrumentationManifestContent } from '@rasputin-ai/core';
|
|
2
2
|
import type { InstrumentationManifestDelta } from './collect-instrumentation-delta';
|
|
3
|
-
export declare const INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.
|
|
3
|
+
export declare const INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.v2";
|
|
4
|
+
type SnapshotOptions = {
|
|
5
|
+
sourceRoot?: string;
|
|
6
|
+
sourceRoots?: Record<string, string>;
|
|
7
|
+
};
|
|
4
8
|
export declare const recordInstrumentationManifestDelta: (filePath: string, delta: InstrumentationManifestDelta) => void;
|
|
5
9
|
export declare const isInstrumentationManifestDirty: () => boolean;
|
|
6
10
|
export declare const instrumentationManifestGeneration: () => number;
|
|
7
|
-
export declare const
|
|
11
|
+
export declare const instrumentationManifestModuleCount: () => number;
|
|
12
|
+
export declare const snapshotInstrumentationManifest: (options?: SnapshotOptions) => InstrumentationManifestContent | undefined;
|
|
8
13
|
export declare const markInstrumentationManifestUploaded: (generation: number) => void;
|
|
9
14
|
export declare const setInstrumentationManifestOnDirty: (onDirty?: () => void) => void;
|
|
10
15
|
export declare const resetInstrumentationManifestRegistry: () => void;
|
|
16
|
+
export {};
|
|
11
17
|
//# sourceMappingURL=instrumentation-manifest-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation-manifest-registry.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/instrumentation-manifest-registry.ts"],"names":[],"mappings":"
|
|
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,8 +1,17 @@
|
|
|
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';
|
|
1
8
|
type ScheduleInstrumentationManifestUploadOptions = {
|
|
2
9
|
projectApiKey: string;
|
|
3
10
|
release?: string;
|
|
4
11
|
apiUrl?: string;
|
|
5
|
-
|
|
12
|
+
sourceRoot?: string;
|
|
13
|
+
sourceRoots?: Record<string, string>;
|
|
14
|
+
logSuccess?: boolean;
|
|
6
15
|
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
7
16
|
enabled: boolean;
|
|
8
17
|
};
|
|
@@ -10,6 +19,7 @@ type InstrumentationManifestUploadHandle = {
|
|
|
10
19
|
flushSoon: () => void;
|
|
11
20
|
wait: () => Promise<void>;
|
|
12
21
|
disconnect: () => void;
|
|
22
|
+
verify: () => Promise<SourceVerification>;
|
|
13
23
|
};
|
|
14
24
|
export declare const scheduleInstrumentationManifestUpload: (options: ScheduleInstrumentationManifestUploadOptions) => InstrumentationManifestUploadHandle;
|
|
15
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-instrumentation-manifest-upload.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/schedule-instrumentation-manifest-upload.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,18 +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';
|
|
1
7
|
import type { RasputinExecution } from './execution-recorder-types';
|
|
2
|
-
export declare const AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.
|
|
8
|
+
export declare const AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v2";
|
|
3
9
|
type AutomaticFunctionSource = {
|
|
4
10
|
filePath: string;
|
|
5
11
|
name: string;
|
|
6
12
|
line: number;
|
|
7
13
|
column: number;
|
|
8
14
|
};
|
|
9
|
-
|
|
10
|
-
repoRoot?: string;
|
|
11
|
-
};
|
|
12
|
-
/** Encode source metadata once at transform time without allocating an object per function call. */
|
|
15
|
+
/** Resolve package ownership at transform time, never on the user's request hot path. */
|
|
13
16
|
export declare const encodeAutomaticFunctionSource: (source: AutomaticFunctionSource) => string;
|
|
14
|
-
export declare const
|
|
15
|
-
/** Connect
|
|
16
|
-
export declare const installAutomaticExecutionRuntime: (execution: RasputinExecution
|
|
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);
|
|
17
20
|
export {};
|
|
18
21
|
//# sourceMappingURL=automatic-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automatic-runtime.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/automatic-runtime.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* event model explicit allows the same bounded state to represent HTTP requests, jobs, scheduled
|
|
4
4
|
* work, and future serverless invocations without coupling the recorder to one framework lifecycle.
|
|
5
5
|
*/
|
|
6
|
-
import type { RuntimeExecutionEvent, RuntimeExecutionKind, RuntimeExecutionMetadata, RuntimeExecutionState, RuntimeFunctionCallsSuppressedEvent, RuntimeFunctionEnterEvent } from '@rasputin-ai/core';
|
|
6
|
+
import type { RuntimeExecutionEvent, RuntimeExecutionKind, RuntimeExecutionMetadata, RuntimeExecutionState, RuntimeFunctionCallsSuppressedEvent, RuntimeFunctionDefinition, RuntimeFunctionEnterEvent, SourcePosition } from '@rasputin-ai/core';
|
|
7
7
|
export type ExecutionSourceExclusion = string | RegExp;
|
|
8
8
|
export type ExecutionRecorderOptions = {
|
|
9
9
|
/** Disable runtime-state capture explicitly. It is enabled by SDK initializers by default. */
|
|
@@ -37,6 +37,10 @@ export type ExecutionFunctionEnterEvent = RuntimeFunctionEnterEvent;
|
|
|
37
37
|
export type ExecutionFunctionCallsSuppressedEvent = RuntimeFunctionCallsSuppressedEvent;
|
|
38
38
|
export type ExecutionEvent = RuntimeExecutionEvent;
|
|
39
39
|
export type ExecutionState = RuntimeExecutionState;
|
|
40
|
+
export type ExecutionFunctionDescriptor = {
|
|
41
|
+
name: string;
|
|
42
|
+
source?: SourcePosition;
|
|
43
|
+
};
|
|
40
44
|
export type ExecutionRecorderStats = {
|
|
41
45
|
errorSnapshots: number;
|
|
42
46
|
successfulExecutionsDiscarded: number;
|
|
@@ -51,6 +55,9 @@ export type ExecutionRecorderStats = {
|
|
|
51
55
|
valuesDroppedByMemoryBudget: number;
|
|
52
56
|
eventsDroppedByMemoryBudget: number;
|
|
53
57
|
partialErrorSnapshots: number;
|
|
58
|
+
measuredExecutions: number;
|
|
59
|
+
totalInlineWallTimeMs: number;
|
|
60
|
+
maxInlineWallTimeMs: number;
|
|
54
61
|
};
|
|
55
62
|
export type ExecutionScope = {
|
|
56
63
|
run: <T>(callback: () => T) => T;
|
|
@@ -63,9 +70,9 @@ export type RasputinExecution = {
|
|
|
63
70
|
run: <T>(metadata: ExecutionMetadata, callback: () => T) => T;
|
|
64
71
|
getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
|
|
65
72
|
/** Internal primitive used by SDK-owned source instrumentation. */
|
|
66
|
-
runFunction: <T>(
|
|
73
|
+
runFunction: <T>(definition: RuntimeFunctionDefinition | string, args: ArrayLike<unknown>, callback: () => T) => T;
|
|
67
74
|
/** Manual fallback for runtimes/build systems without automatic instrumentation. */
|
|
68
|
-
trace: <TThis, TArgs extends unknown[], TResult>(
|
|
75
|
+
trace: <TThis, TArgs extends unknown[], TResult>(definition: string | ExecutionFunctionDescriptor, fn: (this: TThis, ...args: TArgs) => TResult) => (this: TThis, ...args: TArgs) => TResult;
|
|
69
76
|
getStats: () => ExecutionRecorderStats;
|
|
70
77
|
};
|
|
71
78
|
//# sourceMappingURL=execution-recorder-types.d.ts.map
|
|
@@ -1 +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,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,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;
|
|
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,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C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-recorder.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-recorder.ts"],"names":[],"mappings":"
|
|
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;AAiMpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,iBA8dF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createExecutionRecorder } from './execution-recorder';
|
|
2
|
-
export type { ExecutionKind, ExecutionMetadata, ExecutionRecorderOptions, ExecutionRecorderStats, ExecutionScope, ExecutionSourceExclusion, ExecutionState, RasputinExecution, } from './execution-recorder-types';
|
|
2
|
+
export type { ExecutionFunctionDescriptor, ExecutionKind, ExecutionMetadata, ExecutionRecorderOptions, ExecutionRecorderStats, ExecutionScope, ExecutionSourceExclusion, ExecutionState, RasputinExecution, } from './execution-recorder-types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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"}
|
|
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"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* capture time avoids both CPU work and accidental retention of redundant logger/framework state,
|
|
4
4
|
* while compiling patterns once keeps the exclusion feature off the hot path.
|
|
5
5
|
*/
|
|
6
|
+
import type { RuntimeFunctionDefinition } from '@rasputin-ai/core';
|
|
6
7
|
import type { ExecutionSourceExclusion } from './execution-recorder-types';
|
|
7
8
|
/** Compile exclusions once so skipped calls avoid serialization and repeated pattern work. */
|
|
8
|
-
export declare const createSourceExclusionMatcher: (exclusions: ExecutionSourceExclusion[] | undefined) => ((
|
|
9
|
+
export declare const createSourceExclusionMatcher: (exclusions: ExecutionSourceExclusion[] | undefined) => ((definition: RuntimeFunctionDefinition) => boolean);
|
|
9
10
|
//# sourceMappingURL=source-exclusions.d.ts.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"source-exclusions.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/source-exclusions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AA2C3E,8FAA8F;AAC9F,eAAO,MAAM,4BAA4B,GACxC,YAAY,wBAAwB,EAAE,GAAG,SAAS,KAChD,CAAC,CAAC,UAAU,EAAE,yBAAyB,KAAK,OAAO,CAgCrD,CAAC"}
|