@osolmaz/pi-workflows 0.16.1 → 0.16.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/dist/client/view.d.ts +6 -0
- package/dist/client/view.js +1 -0
- package/dist/client/view.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +8 -0
- package/dist/controllers/sqlite.js +54 -1
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/extension/index.js +34 -15
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/workflow-message-coordinator.d.ts +3 -2
- package/dist/extension/workflow-message-coordinator.js +78 -26
- package/dist/extension/workflow-message-coordinator.js.map +1 -1
- package/dist/host/runner.d.ts +8 -1
- package/dist/host/runner.js +231 -176
- package/dist/host/runner.js.map +1 -1
- package/dist/host/view.js +6 -2
- package/dist/host/view.js.map +1 -1
- package/dist/host/worker-entry.d.ts +4 -1
- package/dist/host/worker-entry.js +23 -24
- package/dist/host/worker-entry.js.map +1 -1
- package/dist/host/worker-protocol.d.ts +15 -0
- package/dist/host/worker-protocol.js.map +1 -1
- package/dist/state/workflow-messages.d.ts +2 -0
- package/dist/state/workflow-messages.js +31 -0
- package/dist/state/workflow-messages.js.map +1 -1
- package/dist/workflows/composition.js +0 -4
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/definition.js +0 -8
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.js +4 -5
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/schema.js +0 -4
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +15 -0
- package/dist/workflows/store.js +42 -0
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +1 -3
- package/docs/2026-09-04-workflow-run-state-plan.md +363 -0
- package/docs/SQLITE_STATE.md +8 -4
- package/docs/WORKFLOW_HOST.md +14 -5
- package/docs/workflows.md +10 -1
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/src/client/view.ts +8 -0
- package/src/controllers/sqlite.ts +83 -1
- package/src/extension/index.ts +37 -19
- package/src/extension/workflow-message-coordinator.ts +91 -27
- package/src/host/runner.ts +277 -228
- package/src/host/view.ts +6 -2
- package/src/host/worker-entry.ts +38 -30
- package/src/host/worker-protocol.ts +11 -0
- package/src/state/workflow-messages.ts +51 -0
- package/src/workflows/composition.ts +0 -5
- package/src/workflows/definition.ts +0 -8
- package/src/workflows/engine.ts +4 -6
- package/src/workflows/schema.ts +0 -6
- package/src/workflows/store.ts +64 -0
- package/src/workflows/types.ts +1 -3
package/dist/workflows/store.js
CHANGED
|
@@ -1262,6 +1262,48 @@ export class WorkflowRunStore {
|
|
|
1262
1262
|
lastEventSeq: segment?.eventCount ?? 0,
|
|
1263
1263
|
};
|
|
1264
1264
|
}
|
|
1265
|
+
readRunInput(runId) {
|
|
1266
|
+
const row = this.readRunRow(runId);
|
|
1267
|
+
return row === undefined ? null : this.state.readJson(row.inputHash);
|
|
1268
|
+
}
|
|
1269
|
+
readRunFinalOutput(runId) {
|
|
1270
|
+
const row = this.readRunRow(runId);
|
|
1271
|
+
return row?.finalOutputHash == null ? null : this.state.readJson(row.finalOutputHash);
|
|
1272
|
+
}
|
|
1273
|
+
readRunError(runId) {
|
|
1274
|
+
const row = this.readRunRow(runId);
|
|
1275
|
+
return row?.errorHash == null ? null : this.readText(row.errorHash);
|
|
1276
|
+
}
|
|
1277
|
+
readPresentationInstructions(runId) {
|
|
1278
|
+
const row = this.state.connection
|
|
1279
|
+
.prepare("SELECT presentation_prompt_hash AS hash FROM runs WHERE run_id = ?")
|
|
1280
|
+
.get(runId);
|
|
1281
|
+
if (row?.hash == null) {
|
|
1282
|
+
return "Explain the final workflow result to the user in a normal response.";
|
|
1283
|
+
}
|
|
1284
|
+
return this.readText(row.hash);
|
|
1285
|
+
}
|
|
1286
|
+
readTerminalData(runId) {
|
|
1287
|
+
const row = this.state.connection
|
|
1288
|
+
.prepare(`SELECT status, status_detail AS statusDetail, restart_number AS restartNumber
|
|
1289
|
+
FROM runs WHERE run_id = ?`)
|
|
1290
|
+
.get(runId);
|
|
1291
|
+
if (row === undefined ||
|
|
1292
|
+
!["completed", "failed", "timed_out", "cancelled"].includes(String(row.status)) ||
|
|
1293
|
+
typeof row.restartNumber !== "number") {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
return {
|
|
1297
|
+
runId,
|
|
1298
|
+
status: row.status,
|
|
1299
|
+
statusDetail: typeof row.statusDetail === "string" ? row.statusDetail : null,
|
|
1300
|
+
input: this.readRunInput(runId),
|
|
1301
|
+
finalOutput: this.readRunFinalOutput(runId),
|
|
1302
|
+
error: this.readRunError(runId),
|
|
1303
|
+
presentationInstructions: this.readPresentationInstructions(runId),
|
|
1304
|
+
restartNumber: row.restartNumber,
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1265
1307
|
readRun(runId, options = {}) {
|
|
1266
1308
|
const row = this.readRunRow(runId);
|
|
1267
1309
|
if (row === undefined)
|