@rasputin-ai/node 0.4.1 → 0.5.0-alpha.2
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 +17 -0
- package/dist/auto-instrumentation/instrument-compiled-esm.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts +40 -0
- package/dist/auto-instrumentation/instrumentation-manifest-delta.d.ts.map +1 -0
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts +4 -1
- package/dist/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -1
- package/dist/auto-instrumentation/transform-source.d.ts +1 -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/execution-recorder/automatic-runtime.d.ts +19 -10
- package/dist/execution-recorder/automatic-runtime.d.ts.map +1 -1
- package/dist/execution-recorder/call-aware-event-buffer.d.ts +17 -3
- package/dist/execution-recorder/call-aware-event-buffer.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recorder-types.d.ts +19 -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 +7 -1
- package/dist/execution-recorder/recorder-memory-budget.d.ts.map +1 -1
- package/dist/execution-recorder/safe-serialize.d.ts +7 -0
- package/dist/execution-recorder/safe-serialize.d.ts.map +1 -1
- package/dist/index.js +546 -294
- package/dist/instrument/build.d.ts +2 -0
- package/dist/instrument/build.d.ts.map +1 -0
- package/dist/instrument/build.js +707 -0
- package/dist/instrument/bun.js +55 -21
- package/dist/instrument/node.js +55 -21
- 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/instrument/bun.js
CHANGED
|
@@ -12,21 +12,25 @@ import {
|
|
|
12
12
|
sourceLocatorFromFile as sourceLocatorFromFile2
|
|
13
13
|
} from "@rasputin-ai/core";
|
|
14
14
|
|
|
15
|
-
// src/execution-recorder/
|
|
15
|
+
// src/execution-recorder/function-plan.ts
|
|
16
16
|
import {
|
|
17
17
|
runtimeFunctionId,
|
|
18
18
|
sourceLocatorFromFile
|
|
19
19
|
} from "@rasputin-ai/core";
|
|
20
|
-
var
|
|
21
|
-
var AUTOMATIC_SOURCE_PREFIX = "rasputin-source-v2:";
|
|
22
|
-
var runtimeSymbol = Symbol.for(AUTOMATIC_RUNTIME_SYMBOL);
|
|
23
|
-
var encodeAutomaticFunctionSource = (source) => {
|
|
20
|
+
var encodeFunctionPlan = (source) => {
|
|
24
21
|
const locator = sourceLocatorFromFile(source.filePath);
|
|
25
|
-
const
|
|
22
|
+
const definition = {
|
|
26
23
|
name: source.name,
|
|
27
24
|
...locator ? { source: { ...locator, line: source.line, column: source.column } } : {}
|
|
28
25
|
};
|
|
29
|
-
return
|
|
26
|
+
return [
|
|
27
|
+
runtimeFunctionId(definition),
|
|
28
|
+
source.name,
|
|
29
|
+
locator?.packageName ?? null,
|
|
30
|
+
locator?.packageRelativePath ?? null,
|
|
31
|
+
source.line,
|
|
32
|
+
source.column
|
|
33
|
+
];
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
// src/auto-instrumentation/instrumentation-manifest-registry.ts
|
|
@@ -86,6 +90,10 @@ var isApplicationSource = (filePath, options = {}) => {
|
|
|
86
90
|
import { resolve as resolve3 } from "node:path";
|
|
87
91
|
import ts2 from "typescript";
|
|
88
92
|
|
|
93
|
+
// src/execution-recorder/automatic-runtime.ts
|
|
94
|
+
var AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v2";
|
|
95
|
+
var runtimeSymbol = Symbol.for(AUTOMATIC_RUNTIME_SYMBOL);
|
|
96
|
+
|
|
89
97
|
// src/auto-instrumentation/collect-instrumentation-delta.ts
|
|
90
98
|
import ts from "typescript";
|
|
91
99
|
var paramBindingFromName = (name, sourceFile) => {
|
|
@@ -227,7 +235,7 @@ var collectCallSite = (call, caller, context) => {
|
|
|
227
235
|
);
|
|
228
236
|
if (!start || !end) return null;
|
|
229
237
|
return {
|
|
230
|
-
|
|
238
|
+
callerFunctionId: caller.functionId,
|
|
231
239
|
calleeName: callee.calleeName,
|
|
232
240
|
calleeText: callee.calleeText,
|
|
233
241
|
filePath: start.filePath,
|
|
@@ -254,7 +262,7 @@ var collectParamDestructure = (declaration, caller, context) => {
|
|
|
254
262
|
);
|
|
255
263
|
if (!start) return null;
|
|
256
264
|
return {
|
|
257
|
-
|
|
265
|
+
callerFunctionId: caller.functionId,
|
|
258
266
|
sourceParam,
|
|
259
267
|
filePath: start.filePath,
|
|
260
268
|
line: start.line,
|
|
@@ -320,7 +328,12 @@ var isSupportedFunction = (node) => {
|
|
|
320
328
|
if (!node.body || "asteriskToken" in node && node.asteriskToken) return false;
|
|
321
329
|
return true;
|
|
322
330
|
};
|
|
323
|
-
var
|
|
331
|
+
var uniqueName = (source, base) => {
|
|
332
|
+
let name = base;
|
|
333
|
+
while (source.includes(name)) name += "_";
|
|
334
|
+
return name;
|
|
335
|
+
};
|
|
336
|
+
var modulePreamble = (runName, plansName, plansJson) => `const ${plansName}=${plansJson};const ${runName}=((g,k)=>{const r=g[k]??(g[k]={runtimes:[],modules:[],register(p){const d={run:(i,a,c)=>c()};const m={plans:p,cell:d};this.modules.push(m);const n=this.runtimes.at(-1);if(n)n.bind(m);return(i,a,c)=>d.run(i,a,c)}});return r.register(${plansName})})(globalThis,Symbol.for(${JSON.stringify(AUTOMATIC_RUNTIME_SYMBOL)}));`;
|
|
324
337
|
var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
|
|
325
338
|
const start = mappedLocation(
|
|
326
339
|
sourceFile,
|
|
@@ -332,13 +345,15 @@ var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
|
|
|
332
345
|
const end = mappedLocation(sourceFile, node.end, absolutePath, mapLocation) ?? start;
|
|
333
346
|
const name = functionName(node, sourceFile).replace(/@\d+:\d+$/, "");
|
|
334
347
|
const { params, paramNames } = collectFunctionParams(node, sourceFile);
|
|
348
|
+
const plan = encodeFunctionPlan({
|
|
349
|
+
filePath: start.filePath,
|
|
350
|
+
name,
|
|
351
|
+
line: start.line,
|
|
352
|
+
column: start.column
|
|
353
|
+
});
|
|
335
354
|
return {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
name,
|
|
339
|
-
line: start.line,
|
|
340
|
-
column: start.column
|
|
341
|
-
}),
|
|
355
|
+
plan,
|
|
356
|
+
functionId: plan[0],
|
|
342
357
|
filePath: start.filePath,
|
|
343
358
|
name,
|
|
344
359
|
startLine: start.line,
|
|
@@ -358,8 +373,8 @@ var transformSource = (source, options) => {
|
|
|
358
373
|
true,
|
|
359
374
|
scriptKindFor(options.filePath)
|
|
360
375
|
);
|
|
361
|
-
|
|
362
|
-
|
|
376
|
+
const runName = uniqueName(source, "__rasputinRun__");
|
|
377
|
+
const plansName = uniqueName(source, "__rasputinPlans__");
|
|
363
378
|
const absolutePath = resolve3(options.filePath);
|
|
364
379
|
const edits = [];
|
|
365
380
|
let order = 0;
|
|
@@ -380,6 +395,7 @@ var transformSource = (source, options) => {
|
|
|
380
395
|
ts2.forEachChild(node, (child) => visit(child, caller));
|
|
381
396
|
return;
|
|
382
397
|
}
|
|
398
|
+
const planIndex = delta.functions.length;
|
|
383
399
|
delta.functions.push(collected);
|
|
384
400
|
const args = ts2.isArrowFunction(node) ? arrowArguments(node) : "arguments";
|
|
385
401
|
const asyncCallback = node.modifiers?.some(
|
|
@@ -388,14 +404,14 @@ var transformSource = (source, options) => {
|
|
|
388
404
|
if (ts2.isBlock(node.body)) {
|
|
389
405
|
edits.push({
|
|
390
406
|
position: node.body.getStart(sourceFile) + 1,
|
|
391
|
-
text: `return ${
|
|
407
|
+
text: `return ${runName}(${planIndex},${args},${asyncCallback}()=>{`,
|
|
392
408
|
order: order++
|
|
393
409
|
});
|
|
394
410
|
edits.push({ position: node.body.end - 1, text: "});", order: order++ });
|
|
395
411
|
} else {
|
|
396
412
|
edits.push({
|
|
397
413
|
position: node.body.getStart(sourceFile),
|
|
398
|
-
text: `${
|
|
414
|
+
text: `${runName}(${planIndex},${args},${asyncCallback}()=>(`,
|
|
399
415
|
order: order++
|
|
400
416
|
});
|
|
401
417
|
edits.push({ position: node.body.end, text: "))", order: order++ });
|
|
@@ -416,7 +432,11 @@ var transformSource = (source, options) => {
|
|
|
416
432
|
visit(sourceFile);
|
|
417
433
|
if (edits.length === 0) return void 0;
|
|
418
434
|
const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
|
|
419
|
-
edits.push({
|
|
435
|
+
edits.push({
|
|
436
|
+
position: shebangEnd,
|
|
437
|
+
text: modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan))),
|
|
438
|
+
order: -1
|
|
439
|
+
});
|
|
420
440
|
edits.sort((left, right) => right.position - left.position || right.order - left.order);
|
|
421
441
|
let transformed = source;
|
|
422
442
|
for (const edit of edits) {
|
|
@@ -481,7 +501,21 @@ import { dirname, resolve as resolve5 } from "node:path";
|
|
|
481
501
|
import { fileURLToPath } from "node:url";
|
|
482
502
|
var sdkPackageScopeRootFrom = (instrumentEntryUrl) => resolve5(dirname(fileURLToPath(instrumentEntryUrl)), "../../..");
|
|
483
503
|
|
|
504
|
+
// src/auto-instrumentation/warn-production-runtime-transform.ts
|
|
505
|
+
var RUNTIME_TRANSFORM_WARNING_SUPPRESS_ENV = "RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING";
|
|
506
|
+
var warnedSymbol = Symbol.for("rasputin.runtimeTransformWarning");
|
|
507
|
+
var warnIfProductionRuntimeTransform = () => {
|
|
508
|
+
if (process.env.NODE_ENV !== "production") return;
|
|
509
|
+
if (process.env[RUNTIME_TRANSFORM_WARNING_SUPPRESS_ENV] === "1") return;
|
|
510
|
+
if (Reflect.get(globalThis, warnedSymbol)) return;
|
|
511
|
+
Reflect.set(globalThis, warnedSymbol, true);
|
|
512
|
+
console.warn(
|
|
513
|
+
"[rasputin] Production is using load-time source transformation (`--import` / `--preload`). Prefer build-time `rasputin-instrument` so the process does not load the TypeScript compiler. Set RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING=1 to hide this warning."
|
|
514
|
+
);
|
|
515
|
+
};
|
|
516
|
+
|
|
484
517
|
// src/instrument/bun.ts
|
|
518
|
+
warnIfProductionRuntimeTransform();
|
|
485
519
|
plugin(
|
|
486
520
|
createRasputinBunPlugin({
|
|
487
521
|
excludedRoots: [sdkPackageScopeRootFrom(import.meta.url)]
|
package/dist/instrument/node.js
CHANGED
|
@@ -9,21 +9,25 @@ import {
|
|
|
9
9
|
sourceLocatorFromFile as sourceLocatorFromFile2
|
|
10
10
|
} from "@rasputin-ai/core";
|
|
11
11
|
|
|
12
|
-
// src/execution-recorder/
|
|
12
|
+
// src/execution-recorder/function-plan.ts
|
|
13
13
|
import {
|
|
14
14
|
runtimeFunctionId,
|
|
15
15
|
sourceLocatorFromFile
|
|
16
16
|
} from "@rasputin-ai/core";
|
|
17
|
-
var
|
|
18
|
-
var AUTOMATIC_SOURCE_PREFIX = "rasputin-source-v2:";
|
|
19
|
-
var runtimeSymbol = Symbol.for(AUTOMATIC_RUNTIME_SYMBOL);
|
|
20
|
-
var encodeAutomaticFunctionSource = (source) => {
|
|
17
|
+
var encodeFunctionPlan = (source) => {
|
|
21
18
|
const locator = sourceLocatorFromFile(source.filePath);
|
|
22
|
-
const
|
|
19
|
+
const definition = {
|
|
23
20
|
name: source.name,
|
|
24
21
|
...locator ? { source: { ...locator, line: source.line, column: source.column } } : {}
|
|
25
22
|
};
|
|
26
|
-
return
|
|
23
|
+
return [
|
|
24
|
+
runtimeFunctionId(definition),
|
|
25
|
+
source.name,
|
|
26
|
+
locator?.packageName ?? null,
|
|
27
|
+
locator?.packageRelativePath ?? null,
|
|
28
|
+
source.line,
|
|
29
|
+
source.column
|
|
30
|
+
];
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
// src/auto-instrumentation/instrumentation-manifest-registry.ts
|
|
@@ -141,6 +145,10 @@ var createSourceMapLocationMapper = (generatedPath, source) => {
|
|
|
141
145
|
import { resolve as resolve4 } from "node:path";
|
|
142
146
|
import ts2 from "typescript";
|
|
143
147
|
|
|
148
|
+
// src/execution-recorder/automatic-runtime.ts
|
|
149
|
+
var AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v2";
|
|
150
|
+
var runtimeSymbol = Symbol.for(AUTOMATIC_RUNTIME_SYMBOL);
|
|
151
|
+
|
|
144
152
|
// src/auto-instrumentation/collect-instrumentation-delta.ts
|
|
145
153
|
import ts from "typescript";
|
|
146
154
|
var paramBindingFromName = (name, sourceFile) => {
|
|
@@ -282,7 +290,7 @@ var collectCallSite = (call, caller, context) => {
|
|
|
282
290
|
);
|
|
283
291
|
if (!start || !end) return null;
|
|
284
292
|
return {
|
|
285
|
-
|
|
293
|
+
callerFunctionId: caller.functionId,
|
|
286
294
|
calleeName: callee.calleeName,
|
|
287
295
|
calleeText: callee.calleeText,
|
|
288
296
|
filePath: start.filePath,
|
|
@@ -309,7 +317,7 @@ var collectParamDestructure = (declaration, caller, context) => {
|
|
|
309
317
|
);
|
|
310
318
|
if (!start) return null;
|
|
311
319
|
return {
|
|
312
|
-
|
|
320
|
+
callerFunctionId: caller.functionId,
|
|
313
321
|
sourceParam,
|
|
314
322
|
filePath: start.filePath,
|
|
315
323
|
line: start.line,
|
|
@@ -375,7 +383,12 @@ var isSupportedFunction = (node) => {
|
|
|
375
383
|
if (!node.body || "asteriskToken" in node && node.asteriskToken) return false;
|
|
376
384
|
return true;
|
|
377
385
|
};
|
|
378
|
-
var
|
|
386
|
+
var uniqueName = (source, base) => {
|
|
387
|
+
let name = base;
|
|
388
|
+
while (source.includes(name)) name += "_";
|
|
389
|
+
return name;
|
|
390
|
+
};
|
|
391
|
+
var modulePreamble = (runName, plansName, plansJson) => `const ${plansName}=${plansJson};const ${runName}=((g,k)=>{const r=g[k]??(g[k]={runtimes:[],modules:[],register(p){const d={run:(i,a,c)=>c()};const m={plans:p,cell:d};this.modules.push(m);const n=this.runtimes.at(-1);if(n)n.bind(m);return(i,a,c)=>d.run(i,a,c)}});return r.register(${plansName})})(globalThis,Symbol.for(${JSON.stringify(AUTOMATIC_RUNTIME_SYMBOL)}));`;
|
|
379
392
|
var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
|
|
380
393
|
const start = mappedLocation(
|
|
381
394
|
sourceFile,
|
|
@@ -387,13 +400,15 @@ var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
|
|
|
387
400
|
const end = mappedLocation(sourceFile, node.end, absolutePath, mapLocation) ?? start;
|
|
388
401
|
const name = functionName(node, sourceFile).replace(/@\d+:\d+$/, "");
|
|
389
402
|
const { params, paramNames } = collectFunctionParams(node, sourceFile);
|
|
403
|
+
const plan = encodeFunctionPlan({
|
|
404
|
+
filePath: start.filePath,
|
|
405
|
+
name,
|
|
406
|
+
line: start.line,
|
|
407
|
+
column: start.column
|
|
408
|
+
});
|
|
390
409
|
return {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
name,
|
|
394
|
-
line: start.line,
|
|
395
|
-
column: start.column
|
|
396
|
-
}),
|
|
410
|
+
plan,
|
|
411
|
+
functionId: plan[0],
|
|
397
412
|
filePath: start.filePath,
|
|
398
413
|
name,
|
|
399
414
|
startLine: start.line,
|
|
@@ -413,8 +428,8 @@ var transformSource = (source, options) => {
|
|
|
413
428
|
true,
|
|
414
429
|
scriptKindFor(options.filePath)
|
|
415
430
|
);
|
|
416
|
-
|
|
417
|
-
|
|
431
|
+
const runName = uniqueName(source, "__rasputinRun__");
|
|
432
|
+
const plansName = uniqueName(source, "__rasputinPlans__");
|
|
418
433
|
const absolutePath = resolve4(options.filePath);
|
|
419
434
|
const edits = [];
|
|
420
435
|
let order = 0;
|
|
@@ -435,6 +450,7 @@ var transformSource = (source, options) => {
|
|
|
435
450
|
ts2.forEachChild(node, (child) => visit(child, caller));
|
|
436
451
|
return;
|
|
437
452
|
}
|
|
453
|
+
const planIndex = delta.functions.length;
|
|
438
454
|
delta.functions.push(collected);
|
|
439
455
|
const args = ts2.isArrowFunction(node) ? arrowArguments(node) : "arguments";
|
|
440
456
|
const asyncCallback = node.modifiers?.some(
|
|
@@ -443,14 +459,14 @@ var transformSource = (source, options) => {
|
|
|
443
459
|
if (ts2.isBlock(node.body)) {
|
|
444
460
|
edits.push({
|
|
445
461
|
position: node.body.getStart(sourceFile) + 1,
|
|
446
|
-
text: `return ${
|
|
462
|
+
text: `return ${runName}(${planIndex},${args},${asyncCallback}()=>{`,
|
|
447
463
|
order: order++
|
|
448
464
|
});
|
|
449
465
|
edits.push({ position: node.body.end - 1, text: "});", order: order++ });
|
|
450
466
|
} else {
|
|
451
467
|
edits.push({
|
|
452
468
|
position: node.body.getStart(sourceFile),
|
|
453
|
-
text: `${
|
|
469
|
+
text: `${runName}(${planIndex},${args},${asyncCallback}()=>(`,
|
|
454
470
|
order: order++
|
|
455
471
|
});
|
|
456
472
|
edits.push({ position: node.body.end, text: "))", order: order++ });
|
|
@@ -471,7 +487,11 @@ var transformSource = (source, options) => {
|
|
|
471
487
|
visit(sourceFile);
|
|
472
488
|
if (edits.length === 0) return void 0;
|
|
473
489
|
const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
|
|
474
|
-
edits.push({
|
|
490
|
+
edits.push({
|
|
491
|
+
position: shebangEnd,
|
|
492
|
+
text: modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan))),
|
|
493
|
+
order: -1
|
|
494
|
+
});
|
|
475
495
|
edits.sort((left, right) => right.position - left.position || right.order - left.order);
|
|
476
496
|
let transformed = source;
|
|
477
497
|
for (const edit of edits) {
|
|
@@ -538,7 +558,21 @@ import { dirname as dirname2, resolve as resolve5 } from "node:path";
|
|
|
538
558
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
539
559
|
var sdkPackageScopeRootFrom = (instrumentEntryUrl) => resolve5(dirname2(fileURLToPath3(instrumentEntryUrl)), "../../..");
|
|
540
560
|
|
|
561
|
+
// src/auto-instrumentation/warn-production-runtime-transform.ts
|
|
562
|
+
var RUNTIME_TRANSFORM_WARNING_SUPPRESS_ENV = "RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING";
|
|
563
|
+
var warnedSymbol = Symbol.for("rasputin.runtimeTransformWarning");
|
|
564
|
+
var warnIfProductionRuntimeTransform = () => {
|
|
565
|
+
if (process.env.NODE_ENV !== "production") return;
|
|
566
|
+
if (process.env[RUNTIME_TRANSFORM_WARNING_SUPPRESS_ENV] === "1") return;
|
|
567
|
+
if (Reflect.get(globalThis, warnedSymbol)) return;
|
|
568
|
+
Reflect.set(globalThis, warnedSymbol, true);
|
|
569
|
+
console.warn(
|
|
570
|
+
"[rasputin] Production is using load-time source transformation (`--import` / `--preload`). Prefer build-time `rasputin-instrument` so the process does not load the TypeScript compiler. Set RASPUTIN_SUPPRESS_RUNTIME_TRANSFORM_WARNING=1 to hide this warning."
|
|
571
|
+
);
|
|
572
|
+
};
|
|
573
|
+
|
|
541
574
|
// src/instrument/node.ts
|
|
575
|
+
warnIfProductionRuntimeTransform();
|
|
542
576
|
registerRasputinNodeHooks({
|
|
543
577
|
excludedRoots: [sdkPackageScopeRootFrom(import.meta.url)]
|
|
544
578
|
});
|
package/dist/rasputin-init.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node/Bun composition root for error transport, process handlers, and the bounded execution
|
|
3
|
-
* recorder. Centralizing this wiring keeps initialization fail-safe and ensures every capture path
|
|
4
|
-
* attaches runtime state using the same limits and lifecycle rules.
|
|
5
|
-
*/
|
|
6
1
|
import { type RasputinClient, type RasputinClientStats, type RasputinOptions, type SourceVerification } from '@rasputin-ai/core';
|
|
7
2
|
import { type ExecutionRecorderOptions, type ExecutionRecorderStats, type RasputinExecution } from './execution-recorder';
|
|
8
3
|
export type RasputinNodeOptions = RasputinOptions & {
|
|
9
4
|
/** Bounded runtime-state capture. Enabled by default; successful executions are discarded. */
|
|
10
5
|
executionRecorder?: ExecutionRecorderOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Path to a build-time instrumentation manifest. Defaults to RASPUTIN_INSTRUMENTATION_MANIFEST
|
|
8
|
+
* or `.rasputin/instrumentation-manifest.json` in the current working directory.
|
|
9
|
+
*/
|
|
10
|
+
instrumentationManifestPath?: string;
|
|
11
11
|
};
|
|
12
12
|
export type RasputinNodeClientStats = RasputinClientStats & {
|
|
13
13
|
/** Process-local recorder safety, truncation, and memory-pressure counters. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rasputin-init.d.ts","sourceRoot":"","sources":["../src/rasputin-init.ts"],"names":[],"mappings":"AAMA,OAAO,EAIN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEN,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,MAAM,sBAAsB,CAAC;AAK9B,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG;IACnD,8FAA8F;IAC9F,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IAC7C;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC3D,+EAA+E;IAC/E,QAAQ,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IACnE,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,MAAM,uBAAuB,CAAC;IACxC,8FAA8F;IAC9F,mBAAmB,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvD,CAAC;AAgDF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,mBAAmB,KAAG,kBAiD3D,CAAC"}
|
package/dist/sdk-meta.d.ts
CHANGED
package/dist/sdk-meta.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-meta.d.ts","sourceRoot":"","sources":["../src/sdk-meta.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"sdk-meta.d.ts","sourceRoot":"","sources":["../src/sdk-meta.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C,eAAO,MAAM,WAAW,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasputin-ai/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-alpha.2",
|
|
4
4
|
"description": "Official Rasputin AI SDK for Node and Bun.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,8 +18,16 @@
|
|
|
18
18
|
"types": "./dist/instrument/node.d.ts",
|
|
19
19
|
"import": "./dist/instrument/node.js",
|
|
20
20
|
"default": "./dist/instrument/node.js"
|
|
21
|
+
},
|
|
22
|
+
"./instrument/build": {
|
|
23
|
+
"types": "./dist/instrument/build.d.ts",
|
|
24
|
+
"import": "./dist/instrument/build.js",
|
|
25
|
+
"default": "./dist/instrument/build.js"
|
|
21
26
|
}
|
|
22
27
|
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"rasputin-instrument": "./dist/instrument/build.js"
|
|
30
|
+
},
|
|
23
31
|
"files": [
|
|
24
32
|
"dist"
|
|
25
33
|
],
|
|
@@ -36,7 +44,7 @@
|
|
|
36
44
|
},
|
|
37
45
|
"dependencies": {
|
|
38
46
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
39
|
-
"@rasputin-ai/core": "0.
|
|
47
|
+
"@rasputin-ai/core": "0.5.0-alpha.2",
|
|
40
48
|
"typescript": "5"
|
|
41
49
|
},
|
|
42
50
|
"devDependencies": {
|