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.
Files changed (116) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +20 -0
  3. package/abort-turn-barrier.mjs +1 -23
  4. package/account.mjs +1 -1437
  5. package/acp-client.mjs +1 -140
  6. package/agent-detect.mjs +1 -28
  7. package/agent-notify.mjs +1 -142
  8. package/agent-visibility.mjs +1 -67
  9. package/auth-store.mjs +1 -120
  10. package/bridge.mjs +1 -6266
  11. package/byok-detect.mjs +1 -126
  12. package/claude-command-catalog.mjs +1 -91
  13. package/claude-session.mjs +1 -1519
  14. package/code-event-contract.mjs +1 -118
  15. package/codex-app-server.mjs +1 -340
  16. package/codex-commands.mjs +1 -83
  17. package/codex-event-mapper.mjs +1 -232
  18. package/codex-images.mjs +1 -69
  19. package/codex-mcp-http.mjs +1 -131
  20. package/codex-session.mjs +1 -1295
  21. package/command-catalog.mjs +1 -118
  22. package/command-guidance.mjs +1 -8
  23. package/context-contract.mjs +1 -95
  24. package/context-windows.mjs +1 -107
  25. package/cross-terminal.mjs +1 -789
  26. package/cumulative-event-relay.mjs +1 -53
  27. package/design-edit.mjs +1 -424
  28. package/design-source-contract.mjs +1 -4
  29. package/direct-pair-room.mjs +1 -57
  30. package/dispatch-lease.mjs +1 -37
  31. package/dispatch-permission-cleanup.mjs +1 -86
  32. package/edit-diff.mjs +1 -136
  33. package/error-recovery.mjs +1 -50
  34. package/event-bounds.mjs +1 -121
  35. package/event-delivery-queue.mjs +1 -60
  36. package/event-id.mjs +1 -549
  37. package/evidence-citations.mjs +1 -50
  38. package/evidence-compact.mjs +1 -11
  39. package/flow-assembly.mjs +1 -196
  40. package/flow-budget.mjs +1 -84
  41. package/flow-conductor.mjs +1 -259
  42. package/flow-context-store.mjs +1 -387
  43. package/flow-host-revert.mjs +1 -42
  44. package/flow-models.mjs +1 -139
  45. package/flow-preview.mjs +1 -148
  46. package/flow-receipt.mjs +1 -122
  47. package/flow-redispatch.mjs +1 -72
  48. package/flow-review-gate.mjs +1 -402
  49. package/flow-review-reflect.mjs +1 -115
  50. package/flow-review.mjs +1 -152
  51. package/flow-scope-evidence.mjs +1 -117
  52. package/flow-skill-registry.mjs +1 -140
  53. package/flow-task-graph.mjs +1 -562
  54. package/flow-worktree.mjs +1 -71
  55. package/git-diff-report.mjs +1 -121
  56. package/hermes-delegation-guard.mjs +1 -14
  57. package/hermes-event-mapper.mjs +1 -194
  58. package/hermes-isolation.mjs +1 -61
  59. package/hermes-model-cache.mjs +1 -54
  60. package/hermes-policy.mjs +1 -92
  61. package/hermes-probe.mjs +1 -57
  62. package/hermes-session.mjs +1 -683
  63. package/hermes-setup.mjs +1 -167
  64. package/host-memory.mjs +1 -116
  65. package/interrupted-resume.mjs +1 -95
  66. package/keep-awake.mjs +1 -148
  67. package/key-shape.mjs +1 -49
  68. package/lane-continuation.mjs +1 -83
  69. package/lane-lifecycle.mjs +1 -189
  70. package/lane-worktree.mjs +1 -77
  71. package/launcher.mjs +1 -354
  72. package/mcp-flight-recorder.mjs +1 -79
  73. package/mockup-delivery.mjs +1 -57
  74. package/model-prices.mjs +1 -113
  75. package/package.json +13 -4
  76. package/pair-bus.mjs +1 -98
  77. package/pair-control-authority.mjs +1 -89
  78. package/past-work-search.mjs +1 -105
  79. package/plan-meters.mjs +1 -144
  80. package/presence.mjs +1 -191
  81. package/privacy-report.mjs +1 -108
  82. package/provider-resilience.mjs +1 -356
  83. package/provider.mjs +1 -133
  84. package/providers.mjs +1 -491
  85. package/publish-guard.mjs +2 -0
  86. package/publish-manifest.json +129 -0
  87. package/question-response.mjs +1 -58
  88. package/reap-terminal.mjs +1 -68
  89. package/recap.mjs +1 -297
  90. package/replay-transport.mjs +1 -64
  91. package/repo-search.mjs +1 -190
  92. package/review-check.mjs +1 -182
  93. package/runtime-contract.mjs +1 -93
  94. package/runtime-registry.mjs +1 -64
  95. package/runtime-session.mjs +1 -20
  96. package/scheduled-run-admission.mjs +1 -364
  97. package/scheduled-runs.mjs +1 -268
  98. package/sdk-admission.mjs +1 -9
  99. package/sdk-smoke.mjs +1 -61
  100. package/serve-consent.mjs +1 -118
  101. package/serve-dir.mjs +1 -40
  102. package/service.mjs +1 -877
  103. package/session-store.mjs +1 -484
  104. package/side-lane.mjs +1 -63
  105. package/supabase-key.mjs +1 -176
  106. package/supervisor-ready.mjs +1 -57
  107. package/switch-provider.mjs +1 -84
  108. package/terminal-name.mjs +1 -359
  109. package/terminal-row-reconcile.mjs +1 -70
  110. package/thinkpool-prompt-contracts.mjs +1 -85
  111. package/thinkpool-room-prompt.mjs +1 -187
  112. package/transcript-sanitize.mjs +1 -332
  113. package/turn-stall.mjs +1 -61
  114. package/update-gate.mjs +1 -53
  115. package/viewport.mjs +1 -810
  116. package/worker-completion.mjs +1 -57
package/update-gate.mjs CHANGED
@@ -1,53 +1 @@
1
- /* update-gate.mjs pure predicates for the between-turns update apply (Slice 3
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"}