@rulvar/testing 1.26.0 → 1.28.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/index.d.ts +2 -1
- package/dist/index.js +22 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ interface VcrRow {
|
|
|
139
139
|
caps: ModelCaps;
|
|
140
140
|
model: string;
|
|
141
141
|
}
|
|
142
|
+
/** The first line of every cassette file: format and hash provenance. */
|
|
142
143
|
interface VcrHeader {
|
|
143
144
|
v: 1;
|
|
144
145
|
kind: "rulvar-vcr";
|
|
@@ -191,4 +192,4 @@ declare function replay(options: {
|
|
|
191
192
|
adapters?: ProviderAdapter[];
|
|
192
193
|
}): ProviderAdapter[];
|
|
193
194
|
//#endregion
|
|
194
|
-
export { type CreateTestEngineOptions, DEFAULT_LIVE_SMOKE_ATTEMPTS, FAKE_MODEL, FAKE_MODEL_REF, FakeAdapter, type FakeAdapterOptions, type FakeCall, type FakeResponder, type FakeToolCallsValue, type FakeWireErrorValue, type LiveSmokeOutcome, MAX_LIVE_SMOKE_ATTEMPTS, MAX_LIVE_SMOKE_DELAY_MS, RedactFn, type ReplayRunOptions, type RunLiveSmokeOptions, type TestEngine, type TestRunHandle, VcrCassette, VcrMissError, VcrRow, createTestEngine, defaultRedact, fakeToolCalls, fakeWireError, liveTestEnabled, readCassette, record, replay, replayRun, requestHash, runLiveSmoke };
|
|
195
|
+
export { type CreateTestEngineOptions, DEFAULT_LIVE_SMOKE_ATTEMPTS, FAKE_MODEL, FAKE_MODEL_REF, FakeAdapter, type FakeAdapterOptions, type FakeCall, type FakeResponder, type FakeToolCallsValue, type FakeWireErrorValue, type LiveSmokeOutcome, MAX_LIVE_SMOKE_ATTEMPTS, MAX_LIVE_SMOKE_DELAY_MS, RedactFn, type ReplayRunOptions, type RunLiveSmokeOptions, type TestEngine, type TestRunHandle, VcrCassette, VcrHeader, VcrMissError, VcrRow, createTestEngine, defaultRedact, fakeToolCalls, fakeWireError, liveTestEnabled, readCassette, record, replay, replayRun, requestHash, runLiveSmoke };
|
package/dist/index.js
CHANGED
|
@@ -340,20 +340,29 @@ function record(options) {
|
|
|
340
340
|
caps: (model) => adapter.caps(model),
|
|
341
341
|
async *stream(req, signal) {
|
|
342
342
|
const events = [];
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
let thrown = false;
|
|
344
|
+
try {
|
|
345
|
+
for await (const event of adapter.stream(req, signal)) {
|
|
346
|
+
events.push(event);
|
|
347
|
+
yield event;
|
|
348
|
+
}
|
|
349
|
+
} catch (error) {
|
|
350
|
+
thrown = true;
|
|
351
|
+
throw error;
|
|
352
|
+
} finally {
|
|
353
|
+
if (!thrown) {
|
|
354
|
+
const row = {
|
|
355
|
+
adapterId: adapter.id,
|
|
356
|
+
...adapter.provider === void 0 ? {} : { provider: adapter.provider },
|
|
357
|
+
requestHash: requestHash(req),
|
|
358
|
+
request: walkStrings(JSON.parse(JSON.stringify(req)), redact),
|
|
359
|
+
events: walkStrings(JSON.parse(JSON.stringify(events)), redact),
|
|
360
|
+
caps: adapter.caps(req.model),
|
|
361
|
+
model: req.model
|
|
362
|
+
};
|
|
363
|
+
appendFileSync(options.cassette, `${JSON.stringify(row)}\n`, "utf8");
|
|
364
|
+
}
|
|
346
365
|
}
|
|
347
|
-
const row = {
|
|
348
|
-
adapterId: adapter.id,
|
|
349
|
-
...adapter.provider === void 0 ? {} : { provider: adapter.provider },
|
|
350
|
-
requestHash: requestHash(req),
|
|
351
|
-
request: walkStrings(JSON.parse(JSON.stringify(req)), redact),
|
|
352
|
-
events: walkStrings(JSON.parse(JSON.stringify(events)), redact),
|
|
353
|
-
caps: adapter.caps(req.model),
|
|
354
|
-
model: req.model
|
|
355
|
-
};
|
|
356
|
-
appendFileSync(options.cassette, `${JSON.stringify(row)}\n`, "utf8");
|
|
357
366
|
}
|
|
358
367
|
}));
|
|
359
368
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/testing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Rulvar test harness: createTestEngine, FakeAdapter, VCR cassettes, replay-strict runs, matchers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rulvar/core": "1.
|
|
29
|
+
"@rulvar/core": "1.28.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.20.0",
|