@songsid/agend 2.4.0-beta.27 → 2.4.0-beta.29
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/agent-cli-instructions.md +2 -1
- package/dist/agent-cli.js +6 -0
- package/dist/agent-cli.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/discord.d.ts +13 -1
- package/dist/channel/adapters/discord.js +51 -21
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-turn-boundaries.d.ts +15 -0
- package/dist/claude-turn-boundaries.js +88 -0
- package/dist/claude-turn-boundaries.js.map +1 -0
- package/dist/contact-auth-service.js +3 -0
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +16 -0
- package/dist/contact-auth-store.js +61 -1
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/daemon.d.ts +12 -1
- package/dist/daemon.js +130 -19
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +38 -0
- package/dist/delivery-outbox.js +81 -1
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +17 -1
- package/dist/fleet-manager.js +239 -16
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
- package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +1 -1
- package/dist/host-memory.d.ts +21 -1
- package/dist/host-memory.js +30 -4
- package/dist/host-memory.js.map +1 -1
- package/dist/host-monitoring/linux/interpretation.js +1 -1
- package/dist/host-monitoring/linux/interpretation.js.map +1 -1
- package/dist/host-monitoring/wsl/interpretation.js +1 -1
- package/dist/host-monitoring/wsl/interpretation.js.map +1 -1
- package/dist/host-monitoring.d.ts +3 -1
- package/dist/hub/compose/server.js +1 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.js +100 -56
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +2 -0
- package/dist/hub/http/core.js +17 -7
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/policy.js +56 -27
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +1 -1
- package/dist/hub/roles/clock.js +8 -6
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
- package/dist/hub/roles/cutover-clock-facts.js +25 -0
- package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
- package/dist/hub/roles/read.d.ts +2 -0
- package/dist/hub/roles/read.js +15 -6
- package/dist/hub/roles/read.js.map +1 -1
- package/dist/hub/rooms.d.ts +8 -4
- package/dist/hub/rooms.js +18 -5
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/send-timing.d.ts +6 -0
- package/dist/hub/send-timing.js +39 -0
- package/dist/hub/send-timing.js.map +1 -0
- package/dist/hub/settings-directory-decision.js +11 -5
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +1 -1
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/store.d.ts +4 -0
- package/dist/hub/store.js +19 -4
- package/dist/hub/store.js.map +1 -1
- package/dist/locale.js +19 -1
- package/dist/locale.js.map +1 -1
- package/dist/memory-pressure.js +8 -1
- package/dist/memory-pressure.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -0
- package/dist/outbound-schemas.js +4 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/request-context-activation.js +14 -3
- package/dist/request-context-activation.js.map +1 -1
- package/dist/request-context-call.d.ts +1 -0
- package/dist/request-context-call.js.map +1 -1
- package/dist/request-context-compatibility.js +10 -2
- package/dist/request-context-compatibility.js.map +1 -1
- package/dist/request-context-control-api.d.ts +18 -0
- package/dist/request-context-control-api.js +4 -2
- package/dist/request-context-control-api.js.map +1 -1
- package/dist/request-context-drain-projection.d.ts +8 -0
- package/dist/request-context-drain-projection.js +40 -0
- package/dist/request-context-drain-projection.js.map +1 -0
- package/dist/request-context-drain.d.ts +9 -0
- package/dist/request-context-drain.js +63 -4
- package/dist/request-context-drain.js.map +1 -1
- package/dist/request-context-human.d.ts +6 -0
- package/dist/request-context-human.js +24 -1
- package/dist/request-context-human.js.map +1 -1
- package/dist/request-context-migration.d.ts +11 -0
- package/dist/request-context-migration.js +16 -3
- package/dist/request-context-migration.js.map +1 -1
- package/dist/request-context-reply-pending.d.ts +16 -0
- package/dist/request-context-reply-pending.js +77 -0
- package/dist/request-context-reply-pending.js.map +1 -0
- package/dist/request-context-resolution.d.ts +35 -0
- package/dist/request-context-resolution.js +86 -0
- package/dist/request-context-resolution.js.map +1 -0
- package/dist/request-context-retirement.d.ts +2 -0
- package/dist/request-context-retirement.js.map +1 -1
- package/dist/runtime-build-info.js +1 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/scheduler/db.js +9 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +3 -6
- package/dist/scheduler/task-board-text.js +15 -10
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board-unread.d.ts +90 -0
- package/dist/scheduler/task-board-unread.js +192 -0
- package/dist/scheduler/task-board-unread.js.map +1 -0
- package/dist/scheduler/task-board.d.ts +324 -6
- package/dist/scheduler/task-board.js +786 -47
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-effect.js +17 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/task-board-tool.js +24 -3
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +53 -2
- package/dist/task-board-waker.js +183 -12
- package/dist/task-board-waker.js.map +1 -1
- package/dist/transcript-monitor.d.ts +6 -1
- package/dist/transcript-monitor.js +59 -4
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-turns.d.ts +3 -0
- package/dist/transcript-turns.js +5 -0
- package/dist/transcript-turns.js.map +1 -1
- package/dist/ui/fleet-task-activity.js +164 -24
- package/dist/ui/fleet-task-card.js +77 -13
- package/dist/ui/fleet-task-common.js +14 -0
- package/dist/ui/fleet-task-flow.js +353 -0
- package/dist/ui/fleet-task-md.js +1 -1
- package/dist/ui/fleet-task-run.js +98 -22
- package/dist/ui/fleet-task-thread.js +245 -0
- package/dist/ui/fleet-task-unread.js +100 -0
- package/dist/ui/fleet-task-view.js +6 -5
- package/dist/ui/fleet-task-wake.js +140 -0
- package/dist/ui/fleet-tasks.js +13 -6
- package/dist/ui/host-health.js +3 -3
- package/dist/ui/host-monitoring-linux.js +2 -2
- package/dist/ui/host-monitoring-wsl.js +2 -2
- package/dist/ui/panel-windows-cli.js +2 -2
- package/dist/ui/request-context-control.js +51 -13
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +4 -1
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app.css +8 -2
- package/dist/ui/shared/app.js +3 -0
- package/dist/ui/shared/task-board.css +164 -0
- package/dist/ui/shared/ui-icons.js +3 -0
- package/dist/ui/task-unread.js +70 -0
- package/dist/ui/windows-cli-catalog.js +33 -6
- package/dist/update-goback.js +3 -1
- package/dist/update-goback.js.map +1 -1
- package/dist/web-api.d.ts +45 -1
- package/dist/web-api.js +184 -6
- package/dist/web-api.js.map +1 -1
- package/dist/windows-cli-api.js +4 -2
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli.d.ts +40 -1
- package/dist/windows-cli.js +93 -11
- package/dist/windows-cli.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +3 -22
- package/dist/windows-shortcuts.js +5 -45
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workflow-templates/default.md +3 -2
- package/dist/wsl-host.d.ts +52 -0
- package/dist/wsl-host.js +97 -0
- package/dist/wsl-host.js.map +1 -0
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { RequestContextPendingReplies } from "./request-context-reply-pending.js";
|
|
2
|
+
import { expandCompositeCall as expandReplyWaitCall } from "./channel/mcp-tools.js";
|
|
1
3
|
import { RequestContextHelperAdmission } from "./request-context-helper.js";
|
|
2
4
|
import { requestContextDigest } from "./request-context-store.js";
|
|
3
5
|
import { RequestContextPendingWork } from "./request-context-pending-work.js";
|
|
@@ -2392,6 +2394,8 @@ export class Daemon extends EventEmitter {
|
|
|
2392
2394
|
requestContextQueuedWork = new RequestContextReferenceMap(row => row.root, (_row, id) => `queued-recovery:${id}`);
|
|
2393
2395
|
get requestContextQueuedWorkDrainRevision() { return this.requestContextQueuedWork.revision; }
|
|
2394
2396
|
requestContextQueuedWorkDrainView(rootId) { return this.requestContextQueuedWork.view(rootId); }
|
|
2397
|
+
requestContextPendingReplies = new RequestContextPendingReplies();
|
|
2398
|
+
requestContextHumanReplies = new Map();
|
|
2395
2399
|
requestContextInterruptedLaunch;
|
|
2396
2400
|
requestContextLaunch() { return JSON.stringify([this.bootId, this.spawnGeneration, this.nativePaneLifecycle?.snapshot?.()?.launchId ?? null]); }
|
|
2397
2401
|
/** First local owned hop only. No lookup at a later Fleet receipt may retag this call. */
|
|
@@ -2406,13 +2410,30 @@ export class Daemon extends EventEmitter {
|
|
|
2406
2410
|
const admission = snapshot && reason !== "interrupted-launch"
|
|
2407
2411
|
? { coverage: "covered", lease: captureRequestContextCall(snapshot, captured => this.requestContextTurnCurrent(captured)) }
|
|
2408
2412
|
: { coverage: "not-covered", reason };
|
|
2413
|
+
const reply = this.requestContextCapturedReply(admission);
|
|
2409
2414
|
const call = Object.freeze({ id: randomUUID(), admission: Object.freeze(admission),
|
|
2410
|
-
|
|
2411
|
-
current: () => !this.deliveryWritesStopping && this.requestContextLaunch() === launch
|
|
2415
|
+
get replyRoute() { return reply.route(); }, waitForReplyRoute: reply.wait,
|
|
2416
|
+
current: () => reply.current() && !this.deliveryWritesStopping && this.requestContextLaunch() === launch
|
|
2412
2417
|
&& (admission.coverage !== "covered" || admission.lease.current()) });
|
|
2413
2418
|
this.requestContextCalls.set(call.id, call);
|
|
2414
2419
|
return call;
|
|
2415
2420
|
}
|
|
2421
|
+
/** Capture the scheduling record now; waiting never looks up a newer input. */
|
|
2422
|
+
requestContextCapturedReply(admission) {
|
|
2423
|
+
const snapshot = admission.coverage === "covered" ? admission.lease.snapshot : null;
|
|
2424
|
+
let deadline = Infinity;
|
|
2425
|
+
let route = snapshot ? this.captureRequestContextReplyRoute(snapshot) : undefined;
|
|
2426
|
+
const pending = snapshot && !route ? this.requestContextPendingReplies.capture(snapshot) : undefined;
|
|
2427
|
+
return { route: () => route, current: () => performance.now() < deadline, wait: pending ? async (budgetMs) => {
|
|
2428
|
+
deadline = Math.min(deadline, performance.now() + budgetMs);
|
|
2429
|
+
const confirmed = await pending.wait(budgetMs);
|
|
2430
|
+
if (confirmed && snapshot && performance.now() < deadline && admission.coverage === "covered" && admission.lease.current()) {
|
|
2431
|
+
const checked = this.captureRequestContextReplyRoute(snapshot);
|
|
2432
|
+
if (checked && checked.generation === confirmed.generation && requestContextDigest(checked.target) === requestContextDigest(confirmed.target))
|
|
2433
|
+
route = Object.freeze({ ...checked, current: () => performance.now() < deadline && checked.current() });
|
|
2434
|
+
}
|
|
2435
|
+
} : undefined };
|
|
2436
|
+
}
|
|
2416
2437
|
/** Bind the original call to a delivered target, with the original human admission rechecked at commit. */
|
|
2417
2438
|
captureRequestContextReplyRoute(snapshot) {
|
|
2418
2439
|
const route = this.turnReplyGuard?.captureReplyRoute(snapshot.token);
|
|
@@ -2437,8 +2458,21 @@ export class Daemon extends EventEmitter {
|
|
|
2437
2458
|
requestContextCallsRequired() { return this.requestContextLifecycle !== undefined; }
|
|
2438
2459
|
get requestContextCallDrainRevision() { return this.requestContextCalls.revision; }
|
|
2439
2460
|
requestContextCallDrainView(rootId) { return this.requestContextCalls.view(rootId); }
|
|
2440
|
-
requestContextTurnDrainView(rootId) {
|
|
2441
|
-
|
|
2461
|
+
requestContextTurnDrainView(rootId) {
|
|
2462
|
+
const view = this.requestContextLifecycle?.turns.drainView(rootId);
|
|
2463
|
+
if (!view)
|
|
2464
|
+
return null;
|
|
2465
|
+
const write = this.requestContextWrite;
|
|
2466
|
+
return { ...view, revision: this.requestContextTurnDrainRevision, references: [...view.references,
|
|
2467
|
+
...(write?.unknownEnd && write.snapshot.context.ref.rootContextId === rootId
|
|
2468
|
+
? [`unknown-end:${this.name}:${write.unknownEnd}`] : [])] };
|
|
2469
|
+
}
|
|
2470
|
+
get requestContextTurnDrainRevision() {
|
|
2471
|
+
return JSON.stringify([
|
|
2472
|
+
this.requestContextLifecycle?.turns.drainRevision ?? "unavailable",
|
|
2473
|
+
this.requestContextWrite?.unknownEnd ?? null
|
|
2474
|
+
]);
|
|
2475
|
+
}
|
|
2442
2476
|
handleOwnedToolCall(message, socket) {
|
|
2443
2477
|
let call;
|
|
2444
2478
|
try {
|
|
@@ -2575,16 +2609,32 @@ export class Daemon extends EventEmitter {
|
|
|
2575
2609
|
if (!owned() || !native && (!panePid || !Number.isSafeInteger(panePid) || panePid <= 1)
|
|
2576
2610
|
|| native && (!captured || captured.instance !== this.name || captured.paneId !== windowId))
|
|
2577
2611
|
throw Error("Owned launch changed during retirement capture");
|
|
2578
|
-
|
|
2612
|
+
let observedRetired = false;
|
|
2613
|
+
const retiredCurrent = () => {
|
|
2614
|
+
if (!observedRetired || !owned() || ipc && !ipc.retired())
|
|
2615
|
+
return false;
|
|
2616
|
+
if (native) {
|
|
2617
|
+
const now = native.snapshot?.();
|
|
2618
|
+
return !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]);
|
|
2619
|
+
}
|
|
2620
|
+
return requestContextProcessGroupGone(panePid);
|
|
2621
|
+
};
|
|
2622
|
+
return Object.freeze({ daemonBootId, spawnGeneration, launchFenceEpoch, windowId, panePid, retiredCurrent, retired: async () => {
|
|
2579
2623
|
try {
|
|
2580
2624
|
if (!owned() || ipc && !ipc.retired())
|
|
2581
2625
|
return false;
|
|
2582
2626
|
if (native) {
|
|
2583
2627
|
const now = native.snapshot?.();
|
|
2584
|
-
|
|
2628
|
+
const gone = !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]) && owned();
|
|
2629
|
+
if (gone)
|
|
2630
|
+
observedRetired = true;
|
|
2631
|
+
return gone;
|
|
2585
2632
|
}
|
|
2586
2633
|
const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
|
|
2587
|
-
|
|
2634
|
+
const gone = owned() && (!ipc || ipc.retired()) && !windows.some(w => w.id === windowId) && requestContextProcessGroupGone(panePid);
|
|
2635
|
+
if (gone)
|
|
2636
|
+
observedRetired = true;
|
|
2637
|
+
return gone;
|
|
2588
2638
|
}
|
|
2589
2639
|
catch {
|
|
2590
2640
|
return false;
|
|
@@ -2609,6 +2659,8 @@ export class Daemon extends EventEmitter {
|
|
|
2609
2659
|
if (owner && previous)
|
|
2610
2660
|
lifecycle.turns.ended(previous, owner);
|
|
2611
2661
|
this.requestContextWrite = undefined;
|
|
2662
|
+
this.requestContextPendingReplies.clear();
|
|
2663
|
+
this.requestContextHumanReplies.clear();
|
|
2612
2664
|
}
|
|
2613
2665
|
requestContextOwner() {
|
|
2614
2666
|
const lifecycle = this.requestContextLifecycle;
|
|
@@ -2660,9 +2712,25 @@ export class Daemon extends EventEmitter {
|
|
|
2660
2712
|
this.requestContextWrite = { snapshot, text, at: Date.now(), ledger: new TranscriptTurnLedger(), endAnchor };
|
|
2661
2713
|
}
|
|
2662
2714
|
}
|
|
2715
|
+
/** A reset withdraws proof; it never silently retires C or admits the next root. */
|
|
2716
|
+
observeRequestContextTranscript(events) {
|
|
2717
|
+
const write = this.requestContextWrite;
|
|
2718
|
+
if (!write)
|
|
2719
|
+
return;
|
|
2720
|
+
for (const event of events) {
|
|
2721
|
+
if (event.kind !== "retract")
|
|
2722
|
+
continue;
|
|
2723
|
+
// Ask before withdrawing the row. A foreign transcript turn cannot turn
|
|
2724
|
+
// this owned input into an unknown-end blocker.
|
|
2725
|
+
if (write.ledger.matchesInputTurn(event.turnId, write.text, write.at))
|
|
2726
|
+
write.unknownEnd = event.reason ?? "reset";
|
|
2727
|
+
}
|
|
2728
|
+
write.ledger.observe(events, performance.now());
|
|
2729
|
+
this.settleRequestContextFromTranscript();
|
|
2730
|
+
}
|
|
2663
2731
|
settleRequestContextFromTranscript() {
|
|
2664
2732
|
const write = this.requestContextWrite, owner = this.requestContextOwner();
|
|
2665
|
-
if (!write || !write.endAnchor || !owner || !this.requestContextLifecycle.turns.isCurrent(write.snapshot, owner))
|
|
2733
|
+
if (!write || write.unknownEnd || !write.endAnchor || !owner || !this.requestContextLifecycle.turns.isCurrent(write.snapshot, owner))
|
|
2666
2734
|
return;
|
|
2667
2735
|
const verdict = write.ledger.verdict(write.text, write.at);
|
|
2668
2736
|
if (verdict === "ended" || verdict === "aborted" || verdict === "error") {
|
|
@@ -2670,6 +2738,7 @@ export class Daemon extends EventEmitter {
|
|
|
2670
2738
|
this.requestContextInterruptedLaunch = this.requestContextLaunch();
|
|
2671
2739
|
this.requestContextLifecycle.turns.ended(write.snapshot, owner);
|
|
2672
2740
|
this.requestContextWrite = undefined;
|
|
2741
|
+
this.requestContextPendingReplies.clear();
|
|
2673
2742
|
}
|
|
2674
2743
|
}
|
|
2675
2744
|
/** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
|
|
@@ -2913,7 +2982,13 @@ export class Daemon extends EventEmitter {
|
|
|
2913
2982
|
// not — a pre-write failure never gets here; it is retried before begin.
|
|
2914
2983
|
if (outcome !== "failed")
|
|
2915
2984
|
this.noteWorkActivity();
|
|
2916
|
-
this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
|
|
2985
|
+
const accepted = this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
|
|
2986
|
+
if (verdict?.pendingReply) {
|
|
2987
|
+
if (accepted && outcome === "delivered" && !["unverified", "output-edge", "unverifiable"].includes(verdict.proof ?? ""))
|
|
2988
|
+
verdict.pendingReply.confirm();
|
|
2989
|
+
else
|
|
2990
|
+
verdict.pendingReply.refuse();
|
|
2991
|
+
}
|
|
2917
2992
|
if (verdict && outcome !== "failed")
|
|
2918
2993
|
this.startConsumedWatch(delivery, verdict, outcome);
|
|
2919
2994
|
}
|
|
@@ -7327,7 +7402,7 @@ export class Daemon extends EventEmitter {
|
|
|
7327
7402
|
* message can arrive mid-turn and sit queued, and marking at arrival would let
|
|
7328
7403
|
* the PREVIOUS turn's idle edge consume (and reset) the new turn's state.
|
|
7329
7404
|
*/
|
|
7330
|
-
markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false) {
|
|
7405
|
+
markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false, verdict) {
|
|
7331
7406
|
// Cancel may have interrupted an in-flight paste before its promise settled.
|
|
7332
7407
|
// Its late success must not re-arm the turn that the user just cancelled.
|
|
7333
7408
|
if (!this.isDeliveryEpochCurrent(deliveryEpoch))
|
|
@@ -7369,6 +7444,13 @@ export class Daemon extends EventEmitter {
|
|
|
7369
7444
|
deliveredText,
|
|
7370
7445
|
deliveredAt,
|
|
7371
7446
|
}, this.pendingWork.lastInboundTimestamp(), requestContext && ownedReplyTarget ? { binding: requestContext.token, target: ownedReplyTarget } : undefined);
|
|
7447
|
+
if (requestContext && verdict?.pendingReply) {
|
|
7448
|
+
const route = this.captureRequestContextReplyRoute(requestContext);
|
|
7449
|
+
if (route)
|
|
7450
|
+
verdict.pendingReply.arm(route);
|
|
7451
|
+
else
|
|
7452
|
+
verdict.pendingReply.refuse();
|
|
7453
|
+
}
|
|
7372
7454
|
const armed = this.turnReplyGuard.snapshot();
|
|
7373
7455
|
this.workingTurnDelivery = { generation: armed.generation, deliveryId: meta.delivery_id || null };
|
|
7374
7456
|
this.workingTurnRequestContext = requestContext ? { generation: armed.generation, snapshot: requestContext } : null;
|
|
@@ -7892,7 +7974,7 @@ export class Daemon extends EventEmitter {
|
|
|
7892
7974
|
this.followLog.reset();
|
|
7893
7975
|
this.replyDraft.reset();
|
|
7894
7976
|
const modelLaunch = this.backend?.modelObservationLaunch?.();
|
|
7895
|
-
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch);
|
|
7977
|
+
const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch, !!this.requestContextLifecycle);
|
|
7896
7978
|
let savedModel;
|
|
7897
7979
|
try {
|
|
7898
7980
|
const path = join(this.instanceDir, "claude-model-observation.json");
|
|
@@ -7959,8 +8041,11 @@ export class Daemon extends EventEmitter {
|
|
|
7959
8041
|
});
|
|
7960
8042
|
for (const event of ["reset", "workspace_reset", "context_reset"])
|
|
7961
8043
|
monitor.on(event, () => {
|
|
7962
|
-
if (this.transcriptMonitor === monitor)
|
|
8044
|
+
if (this.transcriptMonitor === monitor) {
|
|
7963
8045
|
this.replyDraft.reset();
|
|
8046
|
+
if (event !== "workspace_reset" && this.requestContextWrite)
|
|
8047
|
+
this.requestContextWrite.unknownEnd = "reset";
|
|
8048
|
+
}
|
|
7964
8049
|
});
|
|
7965
8050
|
this.transcriptTurns.reset();
|
|
7966
8051
|
this.transcriptActivityAt = 0;
|
|
@@ -7970,8 +8055,7 @@ export class Daemon extends EventEmitter {
|
|
|
7970
8055
|
this.transcriptTurns.observe(turns, performance.now());
|
|
7971
8056
|
touch();
|
|
7972
8057
|
if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
|
|
7973
|
-
this.
|
|
7974
|
-
this.settleRequestContextFromTranscript();
|
|
8058
|
+
this.observeRequestContextTranscript(turns);
|
|
7975
8059
|
}
|
|
7976
8060
|
});
|
|
7977
8061
|
// #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
|
|
@@ -9280,10 +9364,22 @@ export class Daemon extends EventEmitter {
|
|
|
9280
9364
|
if (meta.human_prepare_token)
|
|
9281
9365
|
this.humanPreparations.delete(meta.human_prepare_token);
|
|
9282
9366
|
this.humanReminderAttempts.delete(meta.human_receipt_id);
|
|
9367
|
+
const pending = this.requestContextHumanReplies?.get(meta.human_receipt_id);
|
|
9368
|
+
if (pending && !pending.accepted)
|
|
9369
|
+
pending.pending.refuse();
|
|
9370
|
+
this.requestContextHumanReplies?.delete(meta.human_receipt_id);
|
|
9283
9371
|
}
|
|
9284
9372
|
}
|
|
9285
9373
|
/** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
|
|
9286
9374
|
noteHumanReceiptSettlement(id, positive) {
|
|
9375
|
+
const pending = this.requestContextHumanReplies?.get(id);
|
|
9376
|
+
if (pending) {
|
|
9377
|
+
pending.accepted = positive;
|
|
9378
|
+
if (positive)
|
|
9379
|
+
pending.pending.confirm();
|
|
9380
|
+
else
|
|
9381
|
+
pending.pending.refuse();
|
|
9382
|
+
}
|
|
9287
9383
|
const stamp = this.humanReminderAttempts?.get(id);
|
|
9288
9384
|
if (!stamp || !positive || !this.humanReminders.current(stamp))
|
|
9289
9385
|
return;
|
|
@@ -9400,7 +9496,7 @@ export class Daemon extends EventEmitter {
|
|
|
9400
9496
|
})) {
|
|
9401
9497
|
delivered = true;
|
|
9402
9498
|
this.finishDurableSubmission(durableAttempt, verdict);
|
|
9403
|
-
this.markTurnStarted(meta, formatted, deliveryEpoch);
|
|
9499
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
|
|
9404
9500
|
}
|
|
9405
9501
|
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
9406
9502
|
this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
@@ -9486,7 +9582,7 @@ export class Daemon extends EventEmitter {
|
|
|
9486
9582
|
})) {
|
|
9487
9583
|
delivered = true;
|
|
9488
9584
|
this.finishDurableSubmission(durableAttempt, verdict);
|
|
9489
|
-
this.markTurnStarted(meta, formatted, deliveryEpoch);
|
|
9585
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
|
|
9490
9586
|
}
|
|
9491
9587
|
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
9492
9588
|
this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
@@ -9674,7 +9770,7 @@ export class Daemon extends EventEmitter {
|
|
|
9674
9770
|
if (sent) {
|
|
9675
9771
|
delivered = true;
|
|
9676
9772
|
this.finishDurableSubmission(durable, verdict);
|
|
9677
|
-
this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff);
|
|
9773
|
+
this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff, verdict);
|
|
9678
9774
|
}
|
|
9679
9775
|
else if (durableAttempt && verdict.paneWriteStarted) {
|
|
9680
9776
|
this.finishDurableDelivery(durable, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
|
|
@@ -10006,6 +10102,12 @@ export class Daemon extends EventEmitter {
|
|
|
10006
10102
|
const after = this.requestContextTurnSnapshot();
|
|
10007
10103
|
if (after && after !== prior)
|
|
10008
10104
|
newlyBound = after;
|
|
10105
|
+
if (after && inputId && (/^human:hmsg-/.test(inputId) || /^delivery:/.test(inputId))) {
|
|
10106
|
+
verdict.pendingReply = this.requestContextPendingReplies.stage(after, inputId, deliveryContentDigest(wireText), () => this.requestContextTurnCurrent(after));
|
|
10107
|
+
const humanId = opts?.humanMeta?.human_receipt_id;
|
|
10108
|
+
if (humanId && verdict.pendingReply)
|
|
10109
|
+
this.requestContextHumanReplies.set(humanId, { pending: verdict.pendingReply, accepted: false });
|
|
10110
|
+
}
|
|
10009
10111
|
if (!handingOffToNativeQueue)
|
|
10010
10112
|
this.hubAnswerTurnBegins(opts?.hubQuestion, opts?.hubContactLimit !== false);
|
|
10011
10113
|
opts?.beforePaneWrite?.();
|
|
@@ -13722,7 +13824,8 @@ export class Daemon extends EventEmitter {
|
|
|
13722
13824
|
const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
|
|
13723
13825
|
timer.unref?.();
|
|
13724
13826
|
try {
|
|
13725
|
-
|
|
13827
|
+
const reply = lease.requestContext ? this.requestContextCapturedReply(lease.requestContext) : undefined;
|
|
13828
|
+
call = lease.requestContext ? Object.freeze({ id: randomUUID(), admission: lease.requestContext, get replyRoute() { return reply?.route(); }, waitForReplyRoute: reply?.wait, current: () => current() && (!reply || reply.current()) }) : undefined;
|
|
13726
13829
|
if (call)
|
|
13727
13830
|
this.requestContextCalls.set(call.id, call);
|
|
13728
13831
|
this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
|
|
@@ -13759,8 +13862,16 @@ export class Daemon extends EventEmitter {
|
|
|
13759
13862
|
}
|
|
13760
13863
|
handleToolCall(msg, socket, peer, originatingCall) {
|
|
13761
13864
|
const finish = this.requestContextPendingWork?.begin(this.name);
|
|
13865
|
+
const dispatch = () => Daemon.prototype.handleTrackedToolCall.call(this, msg, socket, peer, originatingCall, finish);
|
|
13866
|
+
const expanded = originatingCall?.waitForReplyRoute ? expandReplyWaitCall(String(msg.tool), (msg.args ?? {})) : null;
|
|
13867
|
+
if (originatingCall?.waitForReplyRoute && expanded && !("error" in expanded) && ["reply", "edit_message", "react"].includes(expanded.name)) {
|
|
13868
|
+
// Submission proof progresses independently. No policy, adapter effect or
|
|
13869
|
+
// Fleet forward runs before this original call's delivery and arm settle.
|
|
13870
|
+
void originatingCall.waitForReplyRoute(daemonBudgetMs(expanded.name)).then(dispatch, dispatch).catch(() => finish?.());
|
|
13871
|
+
return;
|
|
13872
|
+
}
|
|
13762
13873
|
try {
|
|
13763
|
-
|
|
13874
|
+
dispatch();
|
|
13764
13875
|
}
|
|
13765
13876
|
catch (error) {
|
|
13766
13877
|
finish?.();
|