@rasputin-ai/node 0.4.1 → 0.5.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -162
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts +2 -37
- package/dist/auto-instrumentation/collect-instrumentation-delta.d.ts.map +1 -1
- package/dist/auto-instrumentation/instrument-compiled-esm.d.ts +19 -0
- package/dist/auto-instrumentation/instrument-compiled-esm.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts +41 -0
- package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +5 -2
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -1
- package/dist/auto-instrumentation/transform-source.d.ts +7 -1
- package/dist/auto-instrumentation/transform-source.d.ts.map +1 -1
- package/dist/auto-instrumentation/warn-production-runtime-transform.d.ts +8 -0
- package/dist/auto-instrumentation/warn-production-runtime-transform.d.ts.map +1 -0
- package/dist/derivation/analyze-function.d.ts +42 -0
- package/dist/derivation/analyze-function.d.ts.map +1 -0
- package/dist/derivation/build-dependency-graph.d.ts +21 -0
- package/dist/derivation/build-dependency-graph.d.ts.map +1 -0
- package/dist/derivation/derivation-ir.d.ts +33 -0
- package/dist/derivation/derivation-ir.d.ts.map +1 -0
- package/dist/derivation/derivation-proof.d.ts +14 -0
- package/dist/derivation/derivation-proof.d.ts.map +1 -0
- package/dist/derivation/emit-capture-plan.d.ts +8 -0
- package/dist/derivation/emit-capture-plan.d.ts.map +1 -0
- package/dist/execution-recorder/automatic-runtime.d.ts +21 -10
- package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -1
- package/dist/execution-recorder/execution-journal.d.ts +84 -0
- package/dist/execution-recorder/execution-journal.d.ts.map +1 -0
- package/dist/execution-recorder/execution-recorder-types.d.ts +36 -0
- 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/function-plan.d.ts +26 -0
- package/dist/execution-recorder/function-plan.d.ts.map +1 -0
- package/dist/execution-recorder/recorder-memory-budget.d.ts +8 -1
- package/dist/execution-recorder/recorder-memory-budget.d.ts.map +1 -1
- package/dist/execution-recorder/safe-serialize.d.ts +8 -0
- package/dist/execution-recorder/safe-serialize.d.ts.map +1 -1
- package/dist/index.js +1432 -418
- package/dist/instrument/build.d.ts +2 -0
- package/dist/instrument/build.d.ts.map +1 -0
- package/dist/instrument/build.js +1430 -0
- package/dist/instrument/bun.js +825 -82
- package/dist/instrument/node.js +825 -82
- package/dist/rasputin-init.d.ts +5 -5
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +1 -1
- package/dist/sdk-meta.d.ts.map +1 -1
- package/package.json +10 -2
- package/dist/execution-recorder/call-aware-event-buffer.d.ts +0 -23
- package/dist/execution-recorder/call-aware-event-buffer.d.ts.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DerivationBinaryOp, DerivationExpression, DerivationPlan, DerivationUnaryOp, PrimitiveConst } from '@rasputin-ai/core';
|
|
2
|
+
export declare class DerivationIrBuilder {
|
|
3
|
+
readonly expressions: DerivationExpression[];
|
|
4
|
+
private nextId;
|
|
5
|
+
constValue(value: PrimitiveConst): number;
|
|
6
|
+
param(index: number): number;
|
|
7
|
+
root(rootId: number): number;
|
|
8
|
+
alias(from: number): number;
|
|
9
|
+
binary(op: DerivationBinaryOp, left: number, right: number, guard: 'numeric' | 'primitive' | 'none'): number;
|
|
10
|
+
unary(op: DerivationUnaryOp, operand: number): number;
|
|
11
|
+
logical(op: 'and' | 'or' | 'nullish', left: number, right: number): number;
|
|
12
|
+
cond(test: number, consequent: number, alternate: number): number;
|
|
13
|
+
object(properties: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
value: number;
|
|
16
|
+
}>): number;
|
|
17
|
+
array(elements: Array<number | {
|
|
18
|
+
kind: 'hole';
|
|
19
|
+
}>): number;
|
|
20
|
+
prop(object: number, key: string): number;
|
|
21
|
+
index(array: number, index: number): number;
|
|
22
|
+
pureCall(calleeFunctionId: string, args: number[]): number;
|
|
23
|
+
template(parts: Array<{
|
|
24
|
+
kind: 'lit';
|
|
25
|
+
value: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'expr';
|
|
28
|
+
expressionId: number;
|
|
29
|
+
}>): number;
|
|
30
|
+
private add;
|
|
31
|
+
}
|
|
32
|
+
export declare const emptyPlan: (functionId: string) => DerivationPlan;
|
|
33
|
+
//# sourceMappingURL=derivation-ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation-ir.d.ts","sourceRoot":"","sources":["../../src/derivation/derivation-ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,mBAAmB;IAC/B,QAAQ,CAAC,WAAW,EAAE,oBAAoB,EAAE,CAAM;IAClD,OAAO,CAAC,MAAM,CAAK;IAEnB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAIzC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI5B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3B,MAAM,CACL,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GACrC,MAAM;IAIT,KAAK,CAAC,EAAE,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAIrD,OAAO,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI1E,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAIjE,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,MAAM;IAIjE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,MAAM;IAIzD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIzC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM;IAI1D,QAAQ,CACP,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,GACnF,MAAM;IAIT,OAAO,CAAC,GAAG;CAIX;AAED,eAAO,MAAM,SAAS,GAAI,YAAY,MAAM,KAAG,cAO7C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DerivationFallbackReason, DerivationPlan } from '@rasputin-ai/core';
|
|
2
|
+
export type Derivability = {
|
|
3
|
+
kind: 'exact';
|
|
4
|
+
expressionId: number;
|
|
5
|
+
shape: 'primitive' | 'object' | 'array' | 'unknown';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'capture_root';
|
|
8
|
+
reason: import('@rasputin-ai/core').CaptureReason;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'fallback_function';
|
|
11
|
+
reason: DerivationFallbackReason;
|
|
12
|
+
};
|
|
13
|
+
export declare const functionIsExact: (plan: DerivationPlan) => boolean;
|
|
14
|
+
//# sourceMappingURL=derivation-proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation-proof.d.ts","sourceRoot":"","sources":["../../src/derivation/derivation-proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,MAAM,YAAY,GACrB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,GAC5F;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,OAAO,mBAAmB,EAAE,aAAa,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,KAAG,OAGxB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CaptureWrap } from './analyze-function';
|
|
2
|
+
export type SourceEdit = {
|
|
3
|
+
position: number;
|
|
4
|
+
text: string;
|
|
5
|
+
order: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const captureWrapEdits: (wraps: CaptureWrap[], capName: string) => SourceEdit[];
|
|
8
|
+
//# sourceMappingURL=emit-capture-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-capture-plan.d.ts","sourceRoot":"","sources":["../../src/derivation/emit-capture-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,eAAO,MAAM,gBAAgB,GAAI,OAAO,WAAW,EAAE,EAAE,SAAS,MAAM,KAAG,UAAU,EAgBlF,CAAC"}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compiler-instrumented functions and the initialized SDK can live in separate bundles. This
|
|
3
3
|
* versioned global registry joins them without generated code importing a physical SDK file. Source
|
|
4
|
-
*
|
|
4
|
+
* identity is encoded once per module as a compact plan table so call sites pass only a numeric index.
|
|
5
5
|
*/
|
|
6
|
-
import { type RuntimeFunctionDefinition } from '@rasputin-ai/core';
|
|
7
6
|
import type { RasputinExecution } from './execution-recorder-types';
|
|
7
|
+
import type { EncodedFunctionPlan } from './function-plan';
|
|
8
8
|
export declare const AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v2";
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
line: number;
|
|
13
|
-
column: number;
|
|
9
|
+
type ModuleRunner = <T>(planIndex: number, args: ArrayLike<unknown>, callback: () => T, omitValues?: boolean) => T;
|
|
10
|
+
type DispatchCell = {
|
|
11
|
+
run: ModuleRunner;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type RegisteredModule = {
|
|
14
|
+
plans: readonly EncodedFunctionPlan[];
|
|
15
|
+
cell: DispatchCell;
|
|
16
|
+
};
|
|
17
|
+
type AutomaticRuntime = {
|
|
18
|
+
bind: (module: RegisteredModule) => void;
|
|
19
|
+
captureRoot: (rootId: number, value: unknown) => unknown;
|
|
20
|
+
};
|
|
21
|
+
type AutomaticRuntimeRegistry = {
|
|
22
|
+
runtimes: AutomaticRuntime[];
|
|
23
|
+
modules: RegisteredModule[];
|
|
24
|
+
register: (plans: readonly EncodedFunctionPlan[]) => ModuleRunner;
|
|
25
|
+
captureRoot: (rootId: number, value: unknown) => unknown;
|
|
26
|
+
};
|
|
27
|
+
export declare const getAutomaticRuntimeRegistry: () => AutomaticRuntimeRegistry;
|
|
28
|
+
export declare const resetAutomaticExecutionRuntime: () => void;
|
|
18
29
|
/** Connect transformed application functions to this SDK instance. */
|
|
19
30
|
export declare const installAutomaticExecutionRuntime: (execution: RasputinExecution) => (() => void);
|
|
20
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automatic-runtime.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/automatic-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"automatic-runtime.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/automatic-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AAIxE,KAAK,YAAY,GAAG,CAAC,CAAC,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,EACxB,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,CAAC,EAAE,OAAO,KAChB,CAAC,CAAC;AAEP,KAAK,YAAY,GAAG;IACnB,GAAG,EAAE,YAAY,CAAC;CAClB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACvB,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACtC,IAAI,EAAE,YAAY,CAAC;CACnB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACvB,IAAI,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACzD,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC/B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,KAAK,YAAY,CAAC;IAClE,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACzD,CAAC;AAqCF,eAAO,MAAM,2BAA2B,QAAO,wBAY9C,CAAC;AAEF,eAAO,MAAM,8BAA8B,QAAO,IAEjD,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,GAAI,WAAW,iBAAiB,KAAG,CAAC,MAAM,IAAI,CAsB1F,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Successful requests must not allocate one JavaScript object per enter/exit. This structure-of-arrays
|
|
3
|
+
* journal keeps fixed fields in typed arrays and materializes public events only when error state is
|
|
4
|
+
* requested. Pooled storage is bounded and drops every application-value reference before reuse.
|
|
5
|
+
*/
|
|
6
|
+
import type { RuntimeFunctionDefinition } from '@rasputin-ai/core';
|
|
7
|
+
import type { ExecutionEvent } from './execution-recorder-types';
|
|
8
|
+
import type { PreparedFunctionPlan } from './function-plan';
|
|
9
|
+
export declare const KIND_EXIT = 2;
|
|
10
|
+
export declare const KIND_THROW = 3;
|
|
11
|
+
export type CompactSuppression = {
|
|
12
|
+
count: number;
|
|
13
|
+
firstTimestampNs: bigint;
|
|
14
|
+
lastTimestampNs: bigint;
|
|
15
|
+
totalDurationNs: bigint;
|
|
16
|
+
functionId: string;
|
|
17
|
+
runtimePlanId: number;
|
|
18
|
+
parentCallId?: number;
|
|
19
|
+
storageIndex: number;
|
|
20
|
+
retainedIndex: number;
|
|
21
|
+
};
|
|
22
|
+
type MaterializedJournal = {
|
|
23
|
+
events: ExecutionEvent[];
|
|
24
|
+
functions: RuntimeFunctionDefinition[];
|
|
25
|
+
};
|
|
26
|
+
export declare const sanitizeJournalCapacity: (value: number | undefined) => number;
|
|
27
|
+
export declare class ExecutionJournal {
|
|
28
|
+
dropped: number;
|
|
29
|
+
allocatedBytes: number;
|
|
30
|
+
onGrow?: (deltaBytes: number) => boolean;
|
|
31
|
+
private length;
|
|
32
|
+
private kind;
|
|
33
|
+
private planId;
|
|
34
|
+
private callId;
|
|
35
|
+
private parentCallId;
|
|
36
|
+
private timestampNs;
|
|
37
|
+
private durationNs;
|
|
38
|
+
private suppressionIndex;
|
|
39
|
+
private readonly payloads;
|
|
40
|
+
private readonly suppressions;
|
|
41
|
+
private readonly openCallIds;
|
|
42
|
+
private readonly notedPlanIds;
|
|
43
|
+
private readonly notedPlanSet;
|
|
44
|
+
private readonly maxCapacity;
|
|
45
|
+
constructor(capacity: number);
|
|
46
|
+
get capacity(): number;
|
|
47
|
+
get hasOpenCalls(): boolean;
|
|
48
|
+
get eventCount(): number;
|
|
49
|
+
get payloadSlotCount(): number;
|
|
50
|
+
canStartCall(): boolean;
|
|
51
|
+
notePlan(runtimePlanId: number): void;
|
|
52
|
+
private registerSuppression;
|
|
53
|
+
startCall(runtimePlanId: number, callId: number, parentCallId: number | undefined, timestampNs: bigint, args: unknown[]): void;
|
|
54
|
+
finishCall(kind: typeof KIND_EXIT | typeof KIND_THROW, callId: number, timestampNs: bigint, durationNs: bigint, payload: unknown): void;
|
|
55
|
+
dropCall(): void;
|
|
56
|
+
appendSuppressed(group: CompactSuppression): boolean;
|
|
57
|
+
forceCompletedCall(runtimePlanId: number, callId: number, parentCallId: number | undefined, enterTimestampNs: bigint, args: unknown[], terminalKind: typeof KIND_EXIT | typeof KIND_THROW, terminalTimestampNs: bigint, durationNs: bigint, payload: unknown): boolean;
|
|
58
|
+
materialize(plansByRuntimeId: Array<PreparedFunctionPlan | undefined>, executionStartedAtNs: bigint): MaterializedJournal;
|
|
59
|
+
clear(): void;
|
|
60
|
+
private eventAt;
|
|
61
|
+
private write;
|
|
62
|
+
private ensureCapacity;
|
|
63
|
+
private reallocate;
|
|
64
|
+
private evictCompletedLeafOrSummary;
|
|
65
|
+
private removeAt;
|
|
66
|
+
}
|
|
67
|
+
export declare class ExecutionJournalPool {
|
|
68
|
+
private readonly capacity;
|
|
69
|
+
private readonly maxPooled;
|
|
70
|
+
hits: number;
|
|
71
|
+
misses: number;
|
|
72
|
+
private readonly available;
|
|
73
|
+
constructor(capacity: number, maxPooled?: number);
|
|
74
|
+
acquire(): ExecutionJournal;
|
|
75
|
+
release(journal: ExecutionJournal): void;
|
|
76
|
+
stats(): {
|
|
77
|
+
journalPoolHits: number;
|
|
78
|
+
journalPoolMisses: number;
|
|
79
|
+
journalPoolSize: number;
|
|
80
|
+
journalAllocatedCapacity: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=execution-journal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-journal.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-journal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,UAAU,IAAI,CAAC;AAiB5B,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,mBAAmB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AAO,UAAU,EAC1C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO;IAMjB,QAAQ;IAIR,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;IA2BpD,kBAAkB,CACjB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,OAAO,EAAE,EACf,YAAY,EAAE,OAAO,SAAS,GAAG,OAAO,UAAU,EAClD,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACd,OAAO;IAoCV,WAAW,CACV,gBAAgB,EAAE,KAAK,CAAC,oBAAoB,GAAG,SAAS,CAAC,EACzD,oBAAoB,EAAE,MAAM,GAC1B,mBAAmB;IA0BtB,KAAK;IAgBL,OAAO,CAAC,OAAO;IAsDf,OAAO,CAAC,KAAK;IAwBb,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,2BAA2B;IA4CnC,OAAO,CAAC,QAAQ;CAqBhB;AAED,qBAAa,oBAAoB;IAM/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN3B,IAAI,SAAK;IACT,MAAM,SAAK;IACX,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;gBAGlC,QAAQ,EAAE,MAAM,EAChB,SAAS,SAAsB;IAGjD,OAAO,IAAI,gBAAgB;IAU3B,OAAO,CAAC,OAAO,EAAE,gBAAgB;IAYjC,KAAK;;;;;;CAQL"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* work, and future serverless invocations without coupling the recorder to one framework lifecycle.
|
|
5
5
|
*/
|
|
6
6
|
import type { RuntimeExecutionEvent, RuntimeExecutionKind, RuntimeExecutionMetadata, RuntimeExecutionState, RuntimeFunctionCallsSuppressedEvent, RuntimeFunctionDefinition, RuntimeFunctionEnterEvent, SourcePosition } from '@rasputin-ai/core';
|
|
7
|
+
import type { EncodedFunctionPlan, PreparedFunctionPlan } from './function-plan';
|
|
7
8
|
export type ExecutionSourceExclusion = string | RegExp;
|
|
8
9
|
export type ExecutionRecorderOptions = {
|
|
9
10
|
/** Disable runtime-state capture explicitly. It is enabled by SDK initializers by default. */
|
|
@@ -42,6 +43,18 @@ export type ExecutionFunctionDescriptor = {
|
|
|
42
43
|
source?: SourcePosition;
|
|
43
44
|
};
|
|
44
45
|
export type ExecutionRecorderStats = {
|
|
46
|
+
/** Function hooks observed while an active execution scope exists. */
|
|
47
|
+
functionCallsObserved: number;
|
|
48
|
+
/** Observed calls for which a complete enter/terminal pair was captured. */
|
|
49
|
+
functionCallsCaptured: number;
|
|
50
|
+
/** Observed calls omitted because their source or parent subtree was excluded. */
|
|
51
|
+
functionCallsExcluded: number;
|
|
52
|
+
/** Values actually traversed by the bounded serializer. */
|
|
53
|
+
serializedValues: number;
|
|
54
|
+
/** Application value nodes visited while producing bounded snapshots. */
|
|
55
|
+
serializedValueNodes: number;
|
|
56
|
+
/** Bounded serialized bytes produced before values are stored in recorder events. */
|
|
57
|
+
serializedValueBytes: number;
|
|
45
58
|
errorSnapshots: number;
|
|
46
59
|
successfulExecutionsDiscarded: number;
|
|
47
60
|
truncatedEvents: number;
|
|
@@ -58,6 +71,21 @@ export type ExecutionRecorderStats = {
|
|
|
58
71
|
measuredExecutions: number;
|
|
59
72
|
totalInlineWallTimeMs: number;
|
|
60
73
|
maxInlineWallTimeMs: number;
|
|
74
|
+
journalPoolHits: number;
|
|
75
|
+
journalPoolMisses: number;
|
|
76
|
+
journalPoolSize: number;
|
|
77
|
+
journalAllocatedCapacity: number;
|
|
78
|
+
phaseAlsNs?: number;
|
|
79
|
+
phaseMaterializeNs?: number;
|
|
80
|
+
derivationCandidateFunctions: number;
|
|
81
|
+
derivationElidedFunctionCalls: number;
|
|
82
|
+
derivationRootsCaptured: number;
|
|
83
|
+
derivationControlFactsCaptured: number;
|
|
84
|
+
derivationValuesAvoided: number;
|
|
85
|
+
derivationFallbackFunctions: number;
|
|
86
|
+
derivationFallbackExpressions: number;
|
|
87
|
+
derivationFallbackReasons: Record<string, number>;
|
|
88
|
+
derivationRootBytes: number;
|
|
61
89
|
};
|
|
62
90
|
export type ExecutionScope = {
|
|
63
91
|
run: <T>(callback: () => T) => T;
|
|
@@ -71,8 +99,16 @@ export type RasputinExecution = {
|
|
|
71
99
|
getErrorState: (error: unknown, metadata?: Partial<ExecutionMetadata>) => ExecutionState | undefined;
|
|
72
100
|
/** Internal primitive used by SDK-owned source instrumentation. */
|
|
73
101
|
runFunction: <T>(definition: RuntimeFunctionDefinition | string, args: ArrayLike<unknown>, callback: () => T) => T;
|
|
102
|
+
/** Internal prepared-plan path used by automatic instrumentation. */
|
|
103
|
+
runFunctionPlans: <T>(plans: readonly EncodedFunctionPlan[], planIndex: number, args: ArrayLike<unknown>, callback: () => T, omitValues?: boolean) => T;
|
|
104
|
+
/** Resolve a module plan table once so generated wrappers can bind to prepared plans. */
|
|
105
|
+
prepareFunctionPlans: (plans: readonly EncodedFunctionPlan[]) => PreparedFunctionPlan[];
|
|
106
|
+
/** Internal primitive used after a module's function plans have been resolved. */
|
|
107
|
+
runPreparedFunction: <T>(plan: PreparedFunctionPlan, args: ArrayLike<unknown>, callback: () => T, omitValues?: boolean) => T;
|
|
74
108
|
/** Manual fallback for runtimes/build systems without automatic instrumentation. */
|
|
75
109
|
trace: <TThis, TArgs extends unknown[], TResult>(definition: string | ExecutionFunctionDescriptor, fn: (this: TThis, ...args: TArgs) => TResult) => (this: TThis, ...args: TArgs) => TResult;
|
|
76
110
|
getStats: () => ExecutionRecorderStats;
|
|
111
|
+
/** Snapshot a derivation capture-boundary value immediately. Pass-through the live value. */
|
|
112
|
+
captureDerivationRoot: (rootId: number, value: unknown) => unknown;
|
|
77
113
|
};
|
|
78
114
|
//# 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,yBAAyB,EACzB,cAAc,EACd,MAAM,mBAAmB,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;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,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,EAA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"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":"AA2BA,OAAO,KAAK,EAGX,wBAAwB,EAExB,iBAAiB,EACjB,MAAM,4BAA4B,CAAC;AAgRpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,iBA4yBF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type RuntimeFunctionDefinition } from '@rasputin-ai/core';
|
|
2
|
+
export type EncodedFunctionPlan = readonly [
|
|
3
|
+
functionId: string,
|
|
4
|
+
name: string,
|
|
5
|
+
packageName: string | null,
|
|
6
|
+
packageRelativePath: string | null,
|
|
7
|
+
line: number | null,
|
|
8
|
+
column: number | null
|
|
9
|
+
];
|
|
10
|
+
export type PreparedFunctionPlan = {
|
|
11
|
+
runtimePlanId: number;
|
|
12
|
+
definition: RuntimeFunctionDefinition;
|
|
13
|
+
functionId: string;
|
|
14
|
+
excluded: boolean;
|
|
15
|
+
estimatedCallBytes: number;
|
|
16
|
+
};
|
|
17
|
+
export type AutomaticFunctionSource = {
|
|
18
|
+
filePath: string;
|
|
19
|
+
name: string;
|
|
20
|
+
line: number;
|
|
21
|
+
column: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const encodeFunctionPlan: (source: AutomaticFunctionSource) => EncodedFunctionPlan;
|
|
24
|
+
export declare const definitionFromEncodedPlan: (plan: EncodedFunctionPlan) => RuntimeFunctionDefinition;
|
|
25
|
+
export declare const estimatedCallBytesFor: (functionId: string) => number;
|
|
26
|
+
//# sourceMappingURL=function-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-plan.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/function-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,yBAAyB,EAG9B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,mBAAmB,GAAG,SAAS;IAC1C,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAClC,IAAI,EAAE,MAAM,GAAG,IAAI;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,yBAAyB,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,uBAAuB,KAAG,mBAcpE,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,MAAM,mBAAmB,KAAG,yBAerE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,MACiB,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-execution limits are insufficient when many requests overlap. This process-wide estimator
|
|
3
|
+
* bounds recorder-owned live memory and degrades snapshots explicitly under pressure so an error can
|
|
4
|
+
* still be reported without risking an application OOM. Telemetry completeness is intentionally
|
|
5
|
+
* sacrificed before application health.
|
|
6
|
+
*/
|
|
1
7
|
import type { SafeSerializedValue } from './safe-serialize';
|
|
2
8
|
type CaptureMode = 'full' | 'structure-only' | 'metadata-only';
|
|
3
9
|
export type RecorderMemoryAllocation = {
|
|
@@ -24,8 +30,9 @@ export declare class RecorderMemoryBudget {
|
|
|
24
30
|
constructor(maximumBytes: number, maximumSerializedValueBytes: number);
|
|
25
31
|
startExecution(): RecorderMemoryAllocation;
|
|
26
32
|
captureValue(allocation: RecorderMemoryAllocation, serialize: () => SafeSerializedValue): unknown;
|
|
27
|
-
reserveCall(allocation: RecorderMemoryAllocation,
|
|
33
|
+
reserveCall(allocation: RecorderMemoryAllocation, estimatedBytes: number): boolean;
|
|
28
34
|
reserveStandaloneEvent(allocation: RecorderMemoryAllocation): boolean;
|
|
35
|
+
reserveStorage(allocation: RecorderMemoryAllocation, bytes: number): boolean;
|
|
29
36
|
release(allocation: RecorderMemoryAllocation): void;
|
|
30
37
|
getStats(): RecorderMemoryStats;
|
|
31
38
|
private reserve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder-memory-budget.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/recorder-memory-budget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recorder-memory-budget.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/recorder-memory-budget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAU5D,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,cAAc,EAAE,MAAM,GAAG,OAAO;IAalF,sBAAsB,CAAC,UAAU,EAAE,wBAAwB,GAAG,OAAO;IAarE,cAAc,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAO5E,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"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { ExecutionRecorderOptions } from './execution-recorder-types';
|
|
2
|
+
export declare const jsonLiteralUtf8Bytes: (value: unknown) => number;
|
|
2
3
|
export type SafeSerializedValue = {
|
|
3
4
|
value: unknown;
|
|
4
5
|
bytes: number;
|
|
6
|
+
/** User-value nodes visited by the bounded traversal; synthetic markers are not counted. */
|
|
7
|
+
visitedNodes: number;
|
|
5
8
|
};
|
|
9
|
+
export type SafeSerializer = {
|
|
10
|
+
serialize: (value: unknown) => unknown;
|
|
11
|
+
serializeWithBytes: (value: unknown) => SafeSerializedValue;
|
|
12
|
+
};
|
|
13
|
+
export declare const createSafeSerializer: (options?: ExecutionRecorderOptions) => SafeSerializer;
|
|
6
14
|
/** Safely converts an arbitrary value and reports its bounded JSON byte size. */
|
|
7
15
|
export declare const safeSerializeWithBytes: (value: unknown, options?: ExecutionRecorderOptions) => SafeSerializedValue;
|
|
8
16
|
/** Safely converts an arbitrary value to bounded JSON-compatible data. */
|
|
@@ -1 +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;
|
|
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;AAoG3E,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,MAkCrD,CAAC;AA4EF,MAAM,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IACvC,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,mBAAmB,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAS,wBAA6B,KAAG,cAuU7E,CAAC;AAYF,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,GAClC,OAAO,OAAO,EACd,UAAS,wBAA6B,KACpC,mBAIyB,CAAC;AAE7B,0EAA0E;AAC1E,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,EAAE,UAAS,wBAA6B,KAAG,OAC1C,CAAC"}
|