pi-durable-subagents 1.0.40 → 1.0.42
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 +51 -0
- package/README.md +52 -2
- package/dist/agent/child.js +65 -22
- package/dist/agent/main.js +1 -1
- package/dist/cli/main.js +18 -5
- package/dist/compat/model.js +12 -0
- package/dist/events/pump.js +6 -2
- package/dist/events/waiting.js +3 -0
- package/dist/kernel/journal.js +189 -36
- package/dist/kernel/mailbox.js +2 -0
- package/dist/orchestrator/config.js +6 -1
- package/dist/orchestrator/engine.js +154 -18
- package/dist/orchestrator/executor/effects/gate.js +10 -3
- package/dist/orchestrator/executor/effects/index.js +2 -1
- package/dist/orchestrator/executor/hibernate.js +11 -0
- package/dist/orchestrator/executor/index.js +316 -62
- package/dist/orchestrator/executor/indexes.js +34 -0
- package/dist/orchestrator/executor/observe.js +25 -4
- package/dist/orchestrator/executor/pool.js +39 -0
- package/dist/orchestrator/executor/recovered.js +85 -0
- package/dist/orchestrator/executor/session.js +8 -0
- package/dist/orchestrator/executor/sweep.js +17 -1
- package/dist/orchestrator/ledger.js +8 -3
- package/dist/orchestrator/main.js +5 -2
- package/dist/orchestrator/settled.js +134 -0
- package/dist/orchestrator/snapshot.js +191 -15
- package/dist/orchestrator/store.js +131 -22
- package/dist/types.js +2 -0
- package/dist/ui/tool.js +5 -3
- package/dist/ui/view.js +22 -10
- package/package.json +1 -1
|
@@ -20,7 +20,8 @@ export default function createEffects(ledgers, containment = serialContainment()
|
|
|
20
20
|
return { cwd };
|
|
21
21
|
}),
|
|
22
22
|
beforeSeal: (t, exec, result, ctl) => serial(t.callId, async () => {
|
|
23
|
-
|
|
23
|
+
// A refused call did no work: no gate, no output (the executor does not call this for one either).
|
|
24
|
+
if (t.refusal !== undefined || ctl.signal.aborted || ["stopped", "timeout", "budget"].includes(result.status))
|
|
24
25
|
return result;
|
|
25
26
|
const intent = t.journal.entries().find(e => e.type === "wt-intent" && e.call === t.callId);
|
|
26
27
|
const gated = await runGate(t, ledgers.home, intent ? String(intent.path) : t.cwd, exec, result, ctl.signal, containment);
|
|
@@ -37,6 +37,17 @@ export function openAsked(entries, call, qid, rev) {
|
|
|
37
37
|
return items.some(e => e.item.rev === rev) && !items.some(e => e.item.rev > rev) &&
|
|
38
38
|
!entries.some(e => e.type === JT.attentionResolved && e.id === id && e.rev === rev) && !supersededByBinding(entries, call, qid, rev);
|
|
39
39
|
}
|
|
40
|
+
/** An answer already forwarded to any open question prevents a planned hibernation, even while its receipt is
|
|
41
|
+
* unconfirmed. Read this inside the serial section that commits the hibernation, never from a prior snapshot. */
|
|
42
|
+
export function answerInFlight(entries, call) {
|
|
43
|
+
return entries.some(e => {
|
|
44
|
+
if (e.type !== "forward" || e.dest !== call)
|
|
45
|
+
return false;
|
|
46
|
+
const env = e.envelope;
|
|
47
|
+
return env?.kind === "answer" && openAsked(entries, call, env.cond?.qid, env.cond?.rev) &&
|
|
48
|
+
!entries.some(r => r.type === "forward-retired" && r.rid2 === e.rid2);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
40
51
|
/** D2: qid@rev of `call` was superseded by a durable binding: an `answer-bound` names it in `superseded`. The binding is
|
|
41
52
|
* the source of truth; the attention resolution `superseded` is derived from it (and may lag it across a crash). */
|
|
42
53
|
export function supersededByBinding(entries, call, qid, rev) {
|