@nathanstephenson/flow 0.1.10-beta.5 → 0.1.10-beta.6
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/build/backend-worker-chunks/{chunk-JOI2POLP.mjs → chunk-U73G6KK4.mjs} +18 -0
- package/build/backend-worker-chunks/{claude-GY27HBAY.mjs → claude-THGSOTC2.mjs} +7 -1
- package/build/backend-worker-chunks/{pi-JV6MWPW7.mjs → pi-5LAWIJNE.mjs} +82 -3
- package/build/backend-worker.mjs +7 -3
- package/dist/backend/claude/index.js +6 -0
- package/dist/backend/fake/index.js +6 -0
- package/dist/backend/pi/index.js +34 -2
- package/dist/backend/pi/plan-limits.js +41 -0
- package/dist/backend/plan-limits.js +17 -0
- package/dist/backend/worker/entry.js +4 -1
- package/dist/backend/worker/index.js +5 -0
- package/dist/backend/worker/protocol.js +2 -1
- package/dist/build-id +1 -1
- package/dist/cli/bootstrap.js +1 -1
- package/dist/client/context-usage.js +1 -1
- package/dist/client/markdown.js +3 -2
- package/dist/daemon/config-store.js +1 -0
- package/dist/daemon/config.js +31 -2
- package/dist/daemon/github-image.js +18 -0
- package/dist/daemon/host.js +147 -6
- package/dist/daemon/runtime.js +1 -1
- package/dist/daemon/server.js +26 -0
- package/dist/daemon/skills.js +24 -0
- package/dist/daemon/spend-ledger.js +118 -0
- package/dist/daemon/summariser.js +11 -4
- package/dist/daemon/tour.js +42 -0
- package/dist/daemon/workflow-builder.js +3 -1
- package/dist/daemon/workflow-execution-resources.js +1 -1
- package/dist/daemon/workflow-routes.js +19 -0
- package/dist/daemon/workflow-schedules.js +6 -5
- package/dist/protocol/plan-limits.js +1 -0
- package/dist/protocol/spend.js +2 -0
- package/dist/workflows/scheduler.js +26 -14
- package/dist/workflows/store.js +16 -2
- package/package.json +1 -1
- package/web/dist/assets/index-BhfJhrVJ.js +51 -0
- package/web/dist/assets/index-BvkM2cWL.css +2 -0
- package/web/dist/assets/{settings-mcp-BwOPXAfH.js → settings-mcp-3cgqQB28.js} +1 -1
- package/web/dist/assets/{settings-workflows-DocTa31_.js → settings-workflows-Cutm8isB.js} +1 -1
- package/web/dist/assets/{workflows-DJqUuGyg.js → workflows-D6oEUUhj.js} +3 -3
- package/web/dist/assets/{workflows-pane-oM1fO_BC.js → workflows-pane-KIdSDKJB.js} +1 -1
- package/web/dist/index.html +3 -3
- package/web/dist/assets/index-BqZ_iUmY.css +0 -2
- package/web/dist/assets/index-CxdSb7k0.js +0 -51
|
@@ -254,15 +254,16 @@ export class WorkflowScheduleService {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
create(settings, enabled) {
|
|
258
|
-
|
|
257
|
+
async create(settings, enabled) {
|
|
258
|
+
await this.driver.validate(settings);
|
|
259
|
+
return this.serial(() => { const saved = createSchedule(settings, this.now(), enabled); this.store.saveSchedule(saved); return saved; });
|
|
259
260
|
}
|
|
260
|
-
update(id, revision, settings, enabled) {
|
|
261
|
-
|
|
261
|
+
async update(id, revision, settings, enabled) {
|
|
262
|
+
await this.driver.validate(settings);
|
|
263
|
+
return this.serial(() => {
|
|
262
264
|
const current = this.store.getSchedule(id);
|
|
263
265
|
if (current.revision !== revision)
|
|
264
266
|
throw new ScheduleRevisionConflict();
|
|
265
|
-
await this.driver.validate(settings);
|
|
266
267
|
const saved = editSchedule(current, settings, enabled, this.now());
|
|
267
268
|
this.store.saveSchedule(saved, revision);
|
|
268
269
|
return saved;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,7 +27,15 @@ export class WorkflowScheduler {
|
|
|
27
27
|
this.executors = executors;
|
|
28
28
|
this.onResume = onResume;
|
|
29
29
|
for (const owner of store.listOwners()) {
|
|
30
|
-
|
|
30
|
+
let records;
|
|
31
|
+
try {
|
|
32
|
+
records = store.listOwnedExecutions(owner);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
console.error('Workflow Execution owner records are invalid. Files retained for manual review.');
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
for (const record of records) {
|
|
31
39
|
if (!occupied(record))
|
|
32
40
|
continue;
|
|
33
41
|
if (this.slots.has(executionOwnerKey(owner)))
|
|
@@ -320,20 +328,22 @@ export class WorkflowScheduler {
|
|
|
320
328
|
}
|
|
321
329
|
}
|
|
322
330
|
reconcile(active) {
|
|
331
|
+
if (occupied(active.record)) {
|
|
332
|
+
for (const [id, state] of Object.entries(active.record.steps)) {
|
|
333
|
+
if (state.status !== 'running' || active.calls.has(id))
|
|
334
|
+
continue;
|
|
335
|
+
state.status = 'interrupted';
|
|
336
|
+
const attempt = state.attempts.at(-1);
|
|
337
|
+
attempt.error = { kind: 'interrupted', message: 'Execution was interrupted; effects may already have occurred' };
|
|
338
|
+
attempt.finishedAt ??= Date.now();
|
|
339
|
+
}
|
|
340
|
+
active.record.status = 'recovery-required';
|
|
341
|
+
active.stopped = !!active.parent?.stopped || Object.values(active.record.steps).some(state => state.status === 'interrupted');
|
|
342
|
+
for (const id of active.calls.keys())
|
|
343
|
+
this.armCall(active, id);
|
|
344
|
+
}
|
|
323
345
|
for (const call of active.calls.values())
|
|
324
346
|
this.reconcile(call.child);
|
|
325
|
-
if (!occupied(active.record))
|
|
326
|
-
return;
|
|
327
|
-
for (const [id, state] of Object.entries(active.record.steps)) {
|
|
328
|
-
if (state.status !== 'running' || active.calls.has(id))
|
|
329
|
-
continue;
|
|
330
|
-
state.status = 'interrupted';
|
|
331
|
-
const attempt = state.attempts.at(-1);
|
|
332
|
-
attempt.error = { kind: 'interrupted', message: 'Execution was interrupted; effects may already have occurred' };
|
|
333
|
-
attempt.finishedAt ??= Date.now();
|
|
334
|
-
}
|
|
335
|
-
active.record.status = 'recovery-required';
|
|
336
|
-
active.stopped = true;
|
|
337
347
|
}
|
|
338
348
|
releaseCancelledCall(active, stepId) {
|
|
339
349
|
const call = active.calls.get(stepId);
|
|
@@ -617,7 +627,9 @@ export class WorkflowScheduler {
|
|
|
617
627
|
else {
|
|
618
628
|
const terminals = active.graph.order.filter(step => active.record.steps[step.id].status === 'completed' && (active.record.testStepId || !active.graph.outgoing.get(step.id).some(edge => this.edgeState(active, edge) === 'selected')));
|
|
619
629
|
active.record.result = terminals.length === 1 ? active.record.steps[terminals[0].id].output : Object.fromEntries(terminals.map(step => [step.name, active.record.steps[step.id].output]));
|
|
620
|
-
|
|
630
|
+
const invocations = (active.root ?? active).record.invocations ?? {};
|
|
631
|
+
const descends = (id) => id !== undefined && (id === active.record.id || descends(invocations[id].parentInvocationId));
|
|
632
|
+
active.record.status = Object.values(active.record.loops ?? {}).some(loop => loop.grants.length) || Object.values(invocations).some(invocation => invocation.status === 'completed-with-recovery' && (!active.parent || descends(invocation.parentInvocationId))) || states.some(([, state]) => state.attempts.some(attempt => attempt.error || attempt.action !== 'execute')) ? 'completed-with-recovery' : 'completed';
|
|
621
633
|
active.record.finishedAt = Date.now();
|
|
622
634
|
}
|
|
623
635
|
this.persist(active);
|
package/dist/workflows/store.js
CHANGED
|
@@ -63,9 +63,23 @@ export class WorkflowStore {
|
|
|
63
63
|
const directory = join(stateRoot, 'workflow-schedules', 'executions');
|
|
64
64
|
const occurrences = existsSync(directory) ? readdirSync(directory, { withFileTypes: true }).filter(entry => entry.isDirectory()).map(entry => ({ kind: 'occurrence', occurrenceId: entry.name })) : [];
|
|
65
65
|
for (const owner of [...this.listSessionIds().map(sessionId => ({ kind: 'session', sessionId })), ...occurrences]) {
|
|
66
|
+
let history;
|
|
67
|
+
try {
|
|
68
|
+
history = this.historyPath(owner);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
console.error('Workflow Execution owner directory is invalid. Directory retained for manual review.');
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
66
74
|
this.owners.set(this.ownerIndexKey(owner), owner);
|
|
67
|
-
for (const id of ids(
|
|
68
|
-
|
|
75
|
+
for (const id of ids(history)) {
|
|
76
|
+
try {
|
|
77
|
+
this.index(this.readExecution(owner, id));
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
console.error('Workflow Execution checkpoint is invalid. File retained for manual review.');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
69
83
|
}
|
|
70
84
|
}
|
|
71
85
|
saveDefinition(definition) {
|