@reinsjs/core 0.11.0 → 0.12.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/core-h3S4jFh-.d.ts +1256 -0
- package/dist/index.d.ts +10 -572
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types-CFO8uTd0.d.ts +0 -682
package/dist/index.js
CHANGED
|
@@ -917,6 +917,17 @@ function assertRunStateShape(raw) {
|
|
|
917
917
|
const ok = typeof s === "object" && s !== null && s.v === 1 && typeof s.sessionId === "string" && Number.isInteger(s.lastSeq) && Array.isArray(s.pendingToolCallIds) && s.pendingToolCallIds.every((id) => typeof id === "string") && typeof s.configHash === "string" && typeof s.pendingDigest === "string" && (s.modelDigest === void 0 || typeof s.modelDigest === "string") && (s.pendingToolsDigest === void 0 || typeof s.pendingToolsDigest === "string") && (s.sig === void 0 || typeof s.sig === "string");
|
|
918
918
|
if (!ok) throw new RunStateError("malformed", "run state is not in the v1 shape");
|
|
919
919
|
}
|
|
920
|
+
function pausedStateOf(event) {
|
|
921
|
+
if (event?.type !== "core.run_paused") return void 0;
|
|
922
|
+
const state = event.payload.state;
|
|
923
|
+
if (state === void 0) return void 0;
|
|
924
|
+
try {
|
|
925
|
+
assertRunStateShape(state);
|
|
926
|
+
} catch {
|
|
927
|
+
return void 0;
|
|
928
|
+
}
|
|
929
|
+
return state;
|
|
930
|
+
}
|
|
920
931
|
async function validateResume(input) {
|
|
921
932
|
const { state } = input;
|
|
922
933
|
assertRunStateShape(state);
|
|
@@ -1291,20 +1302,20 @@ async function* runLoop(cfg) {
|
|
|
1291
1302
|
const reason = texts ? "host" : requested;
|
|
1292
1303
|
const interruptions = texts ? [{ kind: "host", note: texts.note }] : requestedInterruptions;
|
|
1293
1304
|
const settled = texts ? await settleStopped(texts) : [];
|
|
1294
|
-
const events = [
|
|
1295
|
-
...settled,
|
|
1296
|
-
...await append([{ type: "core.run_paused", actor: "system", payload: { reason } }])
|
|
1297
|
-
];
|
|
1298
1305
|
const pending = pendingToolCalls(await readTimeline(log, sessionId, { registry }));
|
|
1299
1306
|
const state = await serializeRunState({
|
|
1300
1307
|
sessionId,
|
|
1301
|
-
lastSeq,
|
|
1308
|
+
lastSeq: lastSeq + 1,
|
|
1302
1309
|
pending,
|
|
1303
1310
|
configHash,
|
|
1304
1311
|
model,
|
|
1305
1312
|
tools: baseTools,
|
|
1306
1313
|
...cfg.secret !== void 0 ? { secret: cfg.secret } : {}
|
|
1307
1314
|
});
|
|
1315
|
+
const events = [
|
|
1316
|
+
...settled,
|
|
1317
|
+
...await append([{ type: "core.run_paused", actor: "system", payload: { reason, state } }])
|
|
1318
|
+
];
|
|
1308
1319
|
return { events, result: { status: "paused", sessionId, lastSeq, reason, interruptions, state } };
|
|
1309
1320
|
};
|
|
1310
1321
|
const spendInto = (ctx) => (usage) => {
|
|
@@ -2183,7 +2194,7 @@ function memoryStore() {
|
|
|
2183
2194
|
}
|
|
2184
2195
|
|
|
2185
2196
|
// src/index.ts
|
|
2186
|
-
var REINS_VERSION = "0.
|
|
2197
|
+
var REINS_VERSION = "0.12.0";
|
|
2187
2198
|
export {
|
|
2188
2199
|
BUILTIN_APPROVAL_POLICY,
|
|
2189
2200
|
CORE_SCHEMAS,
|
|
@@ -2262,6 +2273,7 @@ export {
|
|
|
2262
2273
|
memoryStore,
|
|
2263
2274
|
needsUntrustedMark,
|
|
2264
2275
|
normalizeToolOutput,
|
|
2276
|
+
pausedStateOf,
|
|
2265
2277
|
pendingToolCalls,
|
|
2266
2278
|
project,
|
|
2267
2279
|
readEvents,
|