@rasputin-ai/node 0.8.0 → 0.9.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/dist/execution-recorder/execution-recorder-types.d.ts +0 -10
- 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/runtime-state-size-budget.d.ts +3 -5
- package/dist/execution-recorder/runtime-state-size-budget.d.ts.map +1 -1
- package/dist/index.js +13 -25
- package/dist/instrument/bun.js +1 -1
- package/dist/instrument/node.js +1 -1
- package/dist/internal.js +12 -24
- package/dist/sdk-meta.d.ts +1 -1
- package/package.json +2 -2
|
@@ -47,16 +47,6 @@ export type ExecutionRecorderOptions = {
|
|
|
47
47
|
maxStringLength?: number;
|
|
48
48
|
/** Maximum size of one captured value after serialization. Default: 16 KiB. */
|
|
49
49
|
maxSerializedValueBytes?: number;
|
|
50
|
-
/**
|
|
51
|
-
* Soft size goal for the whole snapshot sent with an error. Extra reconstruction
|
|
52
|
-
* data is dropped first to stay near this. Default: 256 KiB.
|
|
53
|
-
*/
|
|
54
|
-
runtimeStateTargetBytes?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Hard size limit for that snapshot. Values are dropped before call history.
|
|
57
|
-
* Default: 512 KiB.
|
|
58
|
-
*/
|
|
59
|
-
maxRuntimeStateBytes?: number;
|
|
60
50
|
/**
|
|
61
51
|
* How long a recording may hold process-wide memory budget, in milliseconds.
|
|
62
52
|
* Covers unfinished work and finished work that still has in-flight instrumented
|
|
@@ -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,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,2FAA2F;AAC3F,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACtC,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC5C,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC
|
|
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,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE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,EAAE,MAAM,CAAC,EACjB,UAAU,CAAC,EAAE,OAAO,KAChB,CAAC,CAAC;IACP,qBAAqB,EAAE,CACtB,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,EACxB,UAAU,CAAC,EAAE,OAAO,KAChB,kBAAkB,CAAC;CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-recorder.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-recorder.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAGX,wBAAwB,EACxB,gBAAgB,EAGhB,MAAM,4BAA4B,CAAC;AA2OpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,
|
|
1
|
+
{"version":3,"file":"execution-recorder.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/execution-recorder.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAGX,wBAAwB,EACxB,gBAAgB,EAGhB,MAAM,4BAA4B,CAAC;AA2OpC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GACnC,SAAS,wBAAwB,GAAG,SAAS,KAC3C,gBA2/CF,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type RuntimeExecutionState } from '@rasputin-ai/core';
|
|
2
|
+
export declare const MAX_RUNTIME_STATE_BYTES: number;
|
|
2
3
|
/**
|
|
3
4
|
* Bound the complete compact-JSON runtime state after materialization. Captured function values
|
|
4
|
-
* are
|
|
5
|
+
* are omitted above 256 KiB; call boundaries and timings remain until a final
|
|
5
6
|
* pathological-metadata fallback is required.
|
|
6
7
|
*/
|
|
7
|
-
export declare const enforceRuntimeStateSizeBudget: (input: RuntimeExecutionState
|
|
8
|
-
targetBytes?: number;
|
|
9
|
-
maximumBytes?: number;
|
|
10
|
-
}) => RuntimeExecutionState;
|
|
8
|
+
export declare const enforceRuntimeStateSizeBudget: (input: RuntimeExecutionState) => RuntimeExecutionState;
|
|
11
9
|
export declare const runtimeStateEncodedBytes: (value: unknown) => number;
|
|
12
10
|
//# sourceMappingURL=runtime-state-size-budget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-state-size-budget.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/runtime-state-size-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAG1B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-state-size-budget.d.ts","sourceRoot":"","sources":["../../src/execution-recorder/runtime-state-size-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAG1B,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAuHlD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACzC,OAAO,qBAAqB,KAC1B,qBAwEF,CAAC;AAEF,eAAO,MAAM,wBAAwB,UApMR,OAAO,WAoMgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1239,17 +1239,14 @@ var RecorderMemoryBudget = class {
|
|
|
1239
1239
|
import {
|
|
1240
1240
|
rasputinUnavailable
|
|
1241
1241
|
} from "@rasputin-ai/core";
|
|
1242
|
-
var
|
|
1243
|
-
var DEFAULT_MAX_RUNTIME_STATE_BYTES = 512 * 1024;
|
|
1242
|
+
var MAX_RUNTIME_STATE_BYTES = 256 * 1024;
|
|
1244
1243
|
var VALUE_OMITTED_REASON = "runtime_state_size_budget";
|
|
1245
1244
|
var encodedBytes = (value) => Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
1246
|
-
var
|
|
1247
|
-
var sizeMetadata = (originalBytes, targetBytes, maximumBytes) => ({
|
|
1245
|
+
var sizeMetadata = (originalBytes) => ({
|
|
1248
1246
|
reason: "runtime_state_size_budget",
|
|
1249
1247
|
originalBytes,
|
|
1250
1248
|
finalBytes: 0,
|
|
1251
|
-
|
|
1252
|
-
maximumBytes,
|
|
1249
|
+
maximumBytes: MAX_RUNTIME_STATE_BYTES,
|
|
1253
1250
|
eventValuesDropped: 0,
|
|
1254
1251
|
eventsDropped: 0,
|
|
1255
1252
|
functionDefinitionsDropped: 0
|
|
@@ -1340,18 +1337,13 @@ var minimalState = (state, size) => {
|
|
|
1340
1337
|
size
|
|
1341
1338
|
);
|
|
1342
1339
|
};
|
|
1343
|
-
var enforceRuntimeStateSizeBudget = (input
|
|
1344
|
-
const maximumBytes = boundedLimit(options.maximumBytes, DEFAULT_MAX_RUNTIME_STATE_BYTES);
|
|
1345
|
-
const targetBytes = Math.min(
|
|
1346
|
-
maximumBytes,
|
|
1347
|
-
boundedLimit(options.targetBytes, DEFAULT_RUNTIME_STATE_TARGET_BYTES)
|
|
1348
|
-
);
|
|
1340
|
+
var enforceRuntimeStateSizeBudget = (input) => {
|
|
1349
1341
|
const initialBytes = encodedBytes(input);
|
|
1350
1342
|
const existingSize = input.truncated?.size;
|
|
1351
|
-
if (existingSize && initialBytes <=
|
|
1352
|
-
if (initialBytes <=
|
|
1343
|
+
if (existingSize && initialBytes <= MAX_RUNTIME_STATE_BYTES) return settleFinalBytes(input);
|
|
1344
|
+
if (initialBytes <= MAX_RUNTIME_STATE_BYTES) return input;
|
|
1353
1345
|
const originalBytes = existingSize?.originalBytes ?? initialBytes;
|
|
1354
|
-
const size = sizeMetadata(originalBytes
|
|
1346
|
+
const size = sizeMetadata(originalBytes);
|
|
1355
1347
|
let state = input;
|
|
1356
1348
|
const stripped = dropEventValues(state.events);
|
|
1357
1349
|
size.eventValuesDropped += stripped.dropped;
|
|
@@ -1368,7 +1360,7 @@ var enforceRuntimeStateSizeBudget = (input, options = {}) => {
|
|
|
1368
1360
|
size
|
|
1369
1361
|
)
|
|
1370
1362
|
);
|
|
1371
|
-
if (encodedBytes(state) <=
|
|
1363
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1372
1364
|
size.eventsDropped += state.events.length;
|
|
1373
1365
|
size.functionDefinitionsDropped += state.functions.length;
|
|
1374
1366
|
state = settleFinalBytes(
|
|
@@ -1391,9 +1383,9 @@ var enforceRuntimeStateSizeBudget = (input, options = {}) => {
|
|
|
1391
1383
|
size
|
|
1392
1384
|
)
|
|
1393
1385
|
);
|
|
1394
|
-
if (encodedBytes(state) <=
|
|
1386
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1395
1387
|
state = settleFinalBytes(minimalState(state, size));
|
|
1396
|
-
if (encodedBytes(state) <=
|
|
1388
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1397
1389
|
const emergency = {
|
|
1398
1390
|
version: 4,
|
|
1399
1391
|
captureProfile: {
|
|
@@ -2834,10 +2826,6 @@ var createExecutionRecorder = (options) => {
|
|
|
2834
2826
|
});
|
|
2835
2827
|
const excludesSource = createSourceExclusionMatcher(options.excludeSources);
|
|
2836
2828
|
const journalPool = new ExecutionJournalPool(maxEventsPerExecution);
|
|
2837
|
-
const runtimeStateSizeBudget = {
|
|
2838
|
-
targetBytes: options.runtimeStateTargetBytes,
|
|
2839
|
-
maximumBytes: options.maxRuntimeStateBytes
|
|
2840
|
-
};
|
|
2841
2829
|
const plansByRuntimeId = [];
|
|
2842
2830
|
let executionCounter = 0;
|
|
2843
2831
|
let nextRuntimePlanId = 1;
|
|
@@ -3074,12 +3062,12 @@ var createExecutionRecorder = (options) => {
|
|
|
3074
3062
|
state.recorder = {
|
|
3075
3063
|
inlineWallTimeMs: roundedMilliseconds2(recording.inlineRecorderTimeNs)
|
|
3076
3064
|
};
|
|
3077
|
-
const boundedState = enforceRuntimeStateSizeBudget(state
|
|
3065
|
+
const boundedState = enforceRuntimeStateSizeBudget(state);
|
|
3078
3066
|
addRecorderTime(recording, process.hrtime.bigint() - sizeBudgetStartedAtNs);
|
|
3079
3067
|
boundedState.recorder = {
|
|
3080
3068
|
inlineWallTimeMs: roundedMilliseconds2(recording.inlineRecorderTimeNs)
|
|
3081
3069
|
};
|
|
3082
|
-
return boundedState.truncated?.size ? enforceRuntimeStateSizeBudget(boundedState
|
|
3070
|
+
return boundedState.truncated?.size ? enforceRuntimeStateSizeBudget(boundedState) : boundedState;
|
|
3083
3071
|
};
|
|
3084
3072
|
const forgetDiscardedRecording = (recording) => {
|
|
3085
3073
|
if (recording.hasError || recording.retainedForError) return;
|
|
@@ -4280,7 +4268,7 @@ var installGlobalHandlers = (client, options = {}) => {
|
|
|
4280
4268
|
|
|
4281
4269
|
// src/sdk-meta.ts
|
|
4282
4270
|
var SDK_NAME = "@rasputin-ai/node";
|
|
4283
|
-
var SDK_VERSION = "0.
|
|
4271
|
+
var SDK_VERSION = "0.9.0";
|
|
4284
4272
|
|
|
4285
4273
|
// src/rasputin-init.ts
|
|
4286
4274
|
var publicExecution = (runtime) => ({
|
package/dist/instrument/bun.js
CHANGED
|
@@ -1606,7 +1606,7 @@ import ts14 from "typescript";
|
|
|
1606
1606
|
import { originalPositionFor as originalPositionFor2, TraceMap as TraceMap3 } from "@jridgewell/trace-mapping";
|
|
1607
1607
|
|
|
1608
1608
|
// src/sdk-meta.ts
|
|
1609
|
-
var SDK_VERSION = "0.
|
|
1609
|
+
var SDK_VERSION = "0.9.0";
|
|
1610
1610
|
|
|
1611
1611
|
// src/auto-instrumentation/source-map-locations.ts
|
|
1612
1612
|
import { readFileSync } from "node:fs";
|
package/dist/instrument/node.js
CHANGED
|
@@ -1668,7 +1668,7 @@ import ts14 from "typescript";
|
|
|
1668
1668
|
import { originalPositionFor as originalPositionFor3, TraceMap as TraceMap4 } from "@jridgewell/trace-mapping";
|
|
1669
1669
|
|
|
1670
1670
|
// src/sdk-meta.ts
|
|
1671
|
-
var SDK_VERSION = "0.
|
|
1671
|
+
var SDK_VERSION = "0.9.0";
|
|
1672
1672
|
|
|
1673
1673
|
// src/auto-instrumentation/transform-disk-cache.ts
|
|
1674
1674
|
var projectCacheDir = () => {
|
package/dist/internal.js
CHANGED
|
@@ -1210,17 +1210,14 @@ var RecorderMemoryBudget = class {
|
|
|
1210
1210
|
import {
|
|
1211
1211
|
rasputinUnavailable
|
|
1212
1212
|
} from "@rasputin-ai/core";
|
|
1213
|
-
var
|
|
1214
|
-
var DEFAULT_MAX_RUNTIME_STATE_BYTES = 512 * 1024;
|
|
1213
|
+
var MAX_RUNTIME_STATE_BYTES = 256 * 1024;
|
|
1215
1214
|
var VALUE_OMITTED_REASON = "runtime_state_size_budget";
|
|
1216
1215
|
var encodedBytes = (value) => Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
1217
|
-
var
|
|
1218
|
-
var sizeMetadata = (originalBytes, targetBytes, maximumBytes) => ({
|
|
1216
|
+
var sizeMetadata = (originalBytes) => ({
|
|
1219
1217
|
reason: "runtime_state_size_budget",
|
|
1220
1218
|
originalBytes,
|
|
1221
1219
|
finalBytes: 0,
|
|
1222
|
-
|
|
1223
|
-
maximumBytes,
|
|
1220
|
+
maximumBytes: MAX_RUNTIME_STATE_BYTES,
|
|
1224
1221
|
eventValuesDropped: 0,
|
|
1225
1222
|
eventsDropped: 0,
|
|
1226
1223
|
functionDefinitionsDropped: 0
|
|
@@ -1311,18 +1308,13 @@ var minimalState = (state, size) => {
|
|
|
1311
1308
|
size
|
|
1312
1309
|
);
|
|
1313
1310
|
};
|
|
1314
|
-
var enforceRuntimeStateSizeBudget = (input
|
|
1315
|
-
const maximumBytes = boundedLimit(options.maximumBytes, DEFAULT_MAX_RUNTIME_STATE_BYTES);
|
|
1316
|
-
const targetBytes = Math.min(
|
|
1317
|
-
maximumBytes,
|
|
1318
|
-
boundedLimit(options.targetBytes, DEFAULT_RUNTIME_STATE_TARGET_BYTES)
|
|
1319
|
-
);
|
|
1311
|
+
var enforceRuntimeStateSizeBudget = (input) => {
|
|
1320
1312
|
const initialBytes = encodedBytes(input);
|
|
1321
1313
|
const existingSize = input.truncated?.size;
|
|
1322
|
-
if (existingSize && initialBytes <=
|
|
1323
|
-
if (initialBytes <=
|
|
1314
|
+
if (existingSize && initialBytes <= MAX_RUNTIME_STATE_BYTES) return settleFinalBytes(input);
|
|
1315
|
+
if (initialBytes <= MAX_RUNTIME_STATE_BYTES) return input;
|
|
1324
1316
|
const originalBytes = existingSize?.originalBytes ?? initialBytes;
|
|
1325
|
-
const size = sizeMetadata(originalBytes
|
|
1317
|
+
const size = sizeMetadata(originalBytes);
|
|
1326
1318
|
let state = input;
|
|
1327
1319
|
const stripped = dropEventValues(state.events);
|
|
1328
1320
|
size.eventValuesDropped += stripped.dropped;
|
|
@@ -1339,7 +1331,7 @@ var enforceRuntimeStateSizeBudget = (input, options = {}) => {
|
|
|
1339
1331
|
size
|
|
1340
1332
|
)
|
|
1341
1333
|
);
|
|
1342
|
-
if (encodedBytes(state) <=
|
|
1334
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1343
1335
|
size.eventsDropped += state.events.length;
|
|
1344
1336
|
size.functionDefinitionsDropped += state.functions.length;
|
|
1345
1337
|
state = settleFinalBytes(
|
|
@@ -1362,9 +1354,9 @@ var enforceRuntimeStateSizeBudget = (input, options = {}) => {
|
|
|
1362
1354
|
size
|
|
1363
1355
|
)
|
|
1364
1356
|
);
|
|
1365
|
-
if (encodedBytes(state) <=
|
|
1357
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1366
1358
|
state = settleFinalBytes(minimalState(state, size));
|
|
1367
|
-
if (encodedBytes(state) <=
|
|
1359
|
+
if (encodedBytes(state) <= MAX_RUNTIME_STATE_BYTES) return state;
|
|
1368
1360
|
const emergency = {
|
|
1369
1361
|
version: 4,
|
|
1370
1362
|
captureProfile: {
|
|
@@ -2805,10 +2797,6 @@ var createExecutionRecorder = (options) => {
|
|
|
2805
2797
|
});
|
|
2806
2798
|
const excludesSource = createSourceExclusionMatcher(options.excludeSources);
|
|
2807
2799
|
const journalPool = new ExecutionJournalPool(maxEventsPerExecution);
|
|
2808
|
-
const runtimeStateSizeBudget = {
|
|
2809
|
-
targetBytes: options.runtimeStateTargetBytes,
|
|
2810
|
-
maximumBytes: options.maxRuntimeStateBytes
|
|
2811
|
-
};
|
|
2812
2800
|
const plansByRuntimeId = [];
|
|
2813
2801
|
let executionCounter = 0;
|
|
2814
2802
|
let nextRuntimePlanId = 1;
|
|
@@ -3045,12 +3033,12 @@ var createExecutionRecorder = (options) => {
|
|
|
3045
3033
|
state.recorder = {
|
|
3046
3034
|
inlineWallTimeMs: roundedMilliseconds2(recording.inlineRecorderTimeNs)
|
|
3047
3035
|
};
|
|
3048
|
-
const boundedState = enforceRuntimeStateSizeBudget(state
|
|
3036
|
+
const boundedState = enforceRuntimeStateSizeBudget(state);
|
|
3049
3037
|
addRecorderTime(recording, process.hrtime.bigint() - sizeBudgetStartedAtNs);
|
|
3050
3038
|
boundedState.recorder = {
|
|
3051
3039
|
inlineWallTimeMs: roundedMilliseconds2(recording.inlineRecorderTimeNs)
|
|
3052
3040
|
};
|
|
3053
|
-
return boundedState.truncated?.size ? enforceRuntimeStateSizeBudget(boundedState
|
|
3041
|
+
return boundedState.truncated?.size ? enforceRuntimeStateSizeBudget(boundedState) : boundedState;
|
|
3054
3042
|
};
|
|
3055
3043
|
const forgetDiscardedRecording = (recording) => {
|
|
3056
3044
|
if (recording.hasError || recording.retainedForError) return;
|
package/dist/sdk-meta.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasputin-ai/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Official Rasputin AI SDK for Node and Bun.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
52
|
-
"@rasputin-ai/core": "0.
|
|
52
|
+
"@rasputin-ai/core": "0.9.0",
|
|
53
53
|
"typescript": "5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|