thinkpool-pair 0.7.364 → 0.7.366
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/LICENSE +18 -0
- package/README.md +20 -0
- package/abort-turn-barrier.mjs +1 -23
- package/account.mjs +1 -1437
- package/acp-client.mjs +1 -140
- package/agent-detect.mjs +1 -28
- package/agent-notify.mjs +1 -142
- package/agent-visibility.mjs +1 -67
- package/auth-store.mjs +1 -120
- package/bridge.mjs +1 -6266
- package/byok-detect.mjs +1 -126
- package/claude-command-catalog.mjs +1 -91
- package/claude-session.mjs +1 -1519
- package/code-event-contract.mjs +1 -118
- package/codex-app-server.mjs +1 -340
- package/codex-commands.mjs +1 -83
- package/codex-event-mapper.mjs +1 -232
- package/codex-images.mjs +1 -69
- package/codex-mcp-http.mjs +1 -131
- package/codex-session.mjs +1 -1295
- package/command-catalog.mjs +1 -118
- package/command-guidance.mjs +1 -8
- package/context-contract.mjs +1 -95
- package/context-windows.mjs +1 -107
- package/cross-terminal.mjs +1 -789
- package/cumulative-event-relay.mjs +1 -53
- package/design-edit.mjs +1 -424
- package/design-source-contract.mjs +1 -4
- package/direct-pair-room.mjs +1 -57
- package/dispatch-lease.mjs +1 -37
- package/dispatch-permission-cleanup.mjs +1 -86
- package/edit-diff.mjs +1 -136
- package/error-recovery.mjs +1 -50
- package/event-bounds.mjs +1 -121
- package/event-delivery-queue.mjs +1 -60
- package/event-id.mjs +1 -549
- package/evidence-citations.mjs +1 -50
- package/evidence-compact.mjs +1 -11
- package/flow-assembly.mjs +1 -196
- package/flow-budget.mjs +1 -84
- package/flow-conductor.mjs +1 -259
- package/flow-context-store.mjs +1 -387
- package/flow-host-revert.mjs +1 -42
- package/flow-models.mjs +1 -139
- package/flow-preview.mjs +1 -148
- package/flow-receipt.mjs +1 -122
- package/flow-redispatch.mjs +1 -72
- package/flow-review-gate.mjs +1 -402
- package/flow-review-reflect.mjs +1 -115
- package/flow-review.mjs +1 -152
- package/flow-scope-evidence.mjs +1 -117
- package/flow-skill-registry.mjs +1 -140
- package/flow-task-graph.mjs +1 -562
- package/flow-worktree.mjs +1 -71
- package/git-diff-report.mjs +1 -121
- package/hermes-delegation-guard.mjs +1 -14
- package/hermes-event-mapper.mjs +1 -194
- package/hermes-isolation.mjs +1 -61
- package/hermes-model-cache.mjs +1 -54
- package/hermes-policy.mjs +1 -92
- package/hermes-probe.mjs +1 -57
- package/hermes-session.mjs +1 -683
- package/hermes-setup.mjs +1 -167
- package/host-memory.mjs +1 -116
- package/interrupted-resume.mjs +1 -95
- package/keep-awake.mjs +1 -148
- package/key-shape.mjs +1 -49
- package/lane-continuation.mjs +1 -83
- package/lane-lifecycle.mjs +1 -189
- package/lane-worktree.mjs +1 -77
- package/launcher.mjs +1 -354
- package/mcp-flight-recorder.mjs +1 -79
- package/mockup-delivery.mjs +1 -57
- package/model-prices.mjs +1 -113
- package/package.json +13 -4
- package/pair-bus.mjs +1 -98
- package/pair-control-authority.mjs +1 -89
- package/past-work-search.mjs +1 -105
- package/plan-meters.mjs +1 -144
- package/presence.mjs +1 -191
- package/privacy-report.mjs +1 -108
- package/provider-resilience.mjs +1 -356
- package/provider.mjs +1 -133
- package/providers.mjs +1 -491
- package/publish-guard.mjs +2 -0
- package/publish-manifest.json +129 -0
- package/question-response.mjs +1 -58
- package/reap-terminal.mjs +1 -68
- package/recap.mjs +1 -297
- package/replay-transport.mjs +1 -64
- package/repo-search.mjs +1 -190
- package/review-check.mjs +1 -182
- package/runtime-contract.mjs +1 -93
- package/runtime-registry.mjs +1 -64
- package/runtime-session.mjs +1 -20
- package/scheduled-run-admission.mjs +1 -364
- package/scheduled-runs.mjs +1 -268
- package/sdk-admission.mjs +1 -9
- package/sdk-smoke.mjs +1 -61
- package/serve-consent.mjs +1 -118
- package/serve-dir.mjs +1 -40
- package/service.mjs +1 -877
- package/session-store.mjs +1 -484
- package/side-lane.mjs +1 -63
- package/supabase-key.mjs +1 -176
- package/supervisor-ready.mjs +1 -57
- package/switch-provider.mjs +1 -84
- package/terminal-name.mjs +1 -359
- package/terminal-row-reconcile.mjs +1 -70
- package/thinkpool-prompt-contracts.mjs +1 -85
- package/thinkpool-room-prompt.mjs +1 -187
- package/transcript-sanitize.mjs +1 -332
- package/turn-stall.mjs +1 -61
- package/update-gate.mjs +1 -53
- package/viewport.mjs +1 -810
- package/worker-completion.mjs +1 -57
package/update-gate.mjs
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
|
|
2
|
-
nudge protocol, spec docs/specs/2026-06-19-bridge-unified-launcher.md Part 2).
|
|
3
|
-
|
|
4
|
-
Extracted import-safe so the "safe to restart now" rule is unit-tested and can't
|
|
5
|
-
drift. Contract #1: an update only applies at idle / between turns — never mid-turn.
|
|
6
|
-
bridge.mjs runs the bridge on import (can't be imported by a test), so the gate
|
|
7
|
-
lives here. */
|
|
8
|
-
|
|
9
|
-
// Supervisor side: is it safe to restart the account bridge to apply a pending
|
|
10
|
-
// update? True iff a pending update exists, we're not already stopping, EVERY served
|
|
11
|
-
// child is idle (a child reports idle=false while a turn is in flight — that's what
|
|
12
|
-
// keeps Contract #1), AND either a user requested apply (clicked the chip) OR — the
|
|
13
|
-
// unattended fallback — no child has a web peer present (nobody is there to click).
|
|
14
|
-
export function isSafeToRestart({ pendingUpdate, stopping = false, childIdle, childBetween, childPeer, requested = false }) {
|
|
15
|
-
if (!pendingUpdate || stopping) return false
|
|
16
|
-
if (requested) {
|
|
17
|
-
// Explicit "apply" → restart at the next BETWEEN-TURNS gap (no turn in flight),
|
|
18
|
-
// NOT the full quiet window — in an active room that 90s of silence never comes,
|
|
19
|
-
// so the click would otherwise do nothing. Fall back to childIdle when a child
|
|
20
|
-
// doesn't report `between` (older child during the mixed-version update itself).
|
|
21
|
-
const gate = childBetween instanceof Map ? childBetween : childIdle
|
|
22
|
-
for (const ready of gate.values()) if (!ready) return false // any busy child → wait (Contract #1)
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
for (const idle of childIdle.values()) if (!idle) return false // unattended: full idle window
|
|
26
|
-
for (const present of childPeer.values()) if (present) return false // someone's watching, no click → wait
|
|
27
|
-
return true // unattended: idle + nobody watching → auto-apply
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Child/standalone side: is any structured session mid-turn? Used both to gate a
|
|
31
|
-
// local apply and to make the idle heartbeat honest (idle=false while a turn runs).
|
|
32
|
-
// Accepts a sessions Map whose entries expose turnActive directly or via .session.
|
|
33
|
-
export function turnInFlight(sessions) {
|
|
34
|
-
for (const s of (sessions?.values?.() || [])) {
|
|
35
|
-
const ta = s && (typeof s.session?.turnActive === 'boolean' ? s.session.turnActive : s.turnActive)
|
|
36
|
-
// A permission / question resolver is process-local. Restarting while one is
|
|
37
|
-
// pending destroys the only promise the eventual durable decision can wake,
|
|
38
|
-
// even when the runtime has temporarily reported turnActive=false.
|
|
39
|
-
if (ta || Number(s?.pending?.size || 0) > 0) return true
|
|
40
|
-
}
|
|
41
|
-
return false
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Restarting a room process helps only when the HTTP control plane is reachable and
|
|
45
|
-
// Realtime alone is wedged. During a total network outage it destroys healthy local
|
|
46
|
-
// agent processes and cannot improve connectivity; a live turn or permission decision
|
|
47
|
-
// is likewise a hard hold even when HTTP is healthy.
|
|
48
|
-
export function realtimeRecoveryDecision({ brokenSince, now, httpHealthy, activeTurn, graceMs = 60_000 }) {
|
|
49
|
-
if (!brokenSince || now - brokenSince < graceMs) return 'wait'
|
|
50
|
-
if (!httpHealthy) return 'hold-offline'
|
|
51
|
-
if (activeTurn) return 'hold-active'
|
|
52
|
-
return 'restart'
|
|
53
|
-
}
|
|
1
|
+
export function isSafeToRestart({pendingUpdate:e,stopping:t=!1,childIdle:n,childBetween:r,childPeer:o,requested:i=!1}){if(!e||t)return!1;if(i){const e=r instanceof Map?r:n;for(const t of e.values())if(!t)return!1;return!0}for(const e of n.values())if(!e)return!1;for(const e of o.values())if(e)return!1;return!0}export function turnInFlight(e){for(const t of e?.values?.()||[])if(t&&("boolean"==typeof t.session?.turnActive?t.session.turnActive:t.turnActive)||Number(t?.pending?.size||0)>0)return!0;return!1}export function realtimeRecoveryDecision({brokenSince:e,now:t,httpHealthy:n,activeTurn:r,graceMs:o=6e4}){return!e||t-e<o?"wait":n?r?"hold-active":"restart":"hold-offline"}
|