switchroom 0.18.31 → 0.18.33
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-scheduler/index.js +4 -2
- package/dist/auth-broker/index.js +21 -3
- package/dist/cli/notion-write-pretool.mjs +4 -2
- package/dist/cli/switchroom.js +1410 -852
- package/dist/host-control/main.js +22 -4
- package/dist/vault/approvals/kernel-server.js +21 -3
- package/dist/vault/broker/server.js +48 -4
- package/package.json +4 -3
- package/profiles/_base/start.sh.hbs +148 -23
- package/telegram-plugin/dist/gateway/gateway.js +62726 -58282
- package/telegram-plugin/gateway/agent-button-callback-handler.ts +237 -0
- package/telegram-plugin/gateway/ask-callback-handler.ts +92 -0
- package/telegram-plugin/gateway/attachment-message-handlers.ts +152 -0
- package/telegram-plugin/gateway/backstop-delivery.ts +223 -23
- package/telegram-plugin/gateway/boot-card.ts +169 -1
- package/telegram-plugin/gateway/bot-commands-model-effort.ts +209 -0
- package/telegram-plugin/gateway/bot-commands-start-info.ts +108 -0
- package/telegram-plugin/gateway/callback-query-handlers.ts +124 -0
- package/telegram-plugin/gateway/captured-answer-resume.ts +259 -0
- package/telegram-plugin/gateway/card-approval-keyboards.test.ts +28 -0
- package/telegram-plugin/gateway/card-tool-handlers.ts +639 -0
- package/telegram-plugin/gateway/checklist-message-handler.ts +107 -0
- package/telegram-plugin/gateway/delivery-confirm-wiring.ts +133 -0
- package/telegram-plugin/gateway/disconnect-flush.ts +6 -44
- package/telegram-plugin/gateway/gateway-import-clean.test.ts +188 -0
- package/telegram-plugin/gateway/gateway.ts +6403 -13456
- package/telegram-plugin/gateway/inbound-delivery-machine-dispatch.ts +7 -15
- package/telegram-plugin/gateway/inbound-delivery-machine-shadow.ts +35 -68
- package/telegram-plugin/gateway/inbound-interceptors.ts +1133 -0
- package/telegram-plugin/gateway/inbound-router.ts +400 -0
- package/telegram-plugin/gateway/liveness-wiring.ts +440 -0
- package/telegram-plugin/gateway/media-message-handlers.ts +256 -0
- package/telegram-plugin/gateway/mental-model-propose-card.ts +16 -0
- package/telegram-plugin/gateway/model-command.ts +23 -0
- package/telegram-plugin/gateway/narrative-lane.ts +865 -0
- package/telegram-plugin/gateway/obligation-ledger.ts +42 -0
- package/telegram-plugin/gateway/obligation-store.ts +37 -1
- package/telegram-plugin/gateway/obligation-wiring.ts +333 -0
- package/telegram-plugin/gateway/outbound-send-path.ts +2012 -0
- package/telegram-plugin/gateway/photo-message-handler.ts +80 -0
- package/telegram-plugin/gateway/pinned-message-handler.ts +86 -0
- package/telegram-plugin/gateway/secret-request-card.test.ts +46 -0
- package/telegram-plugin/gateway/secret-request-card.ts +45 -0
- package/telegram-plugin/gateway/stream-render.ts +2166 -0
- package/telegram-plugin/gateway/turn-end.ts +606 -0
- package/telegram-plugin/gateway/turn-start-surfaces.ts +298 -0
- package/telegram-plugin/gateway/vault-request-access-card.ts +16 -0
- package/telegram-plugin/gateway/vault-request-save-card.test.ts +49 -0
- package/telegram-plugin/gateway/vault-request-save-card.ts +52 -0
- package/telegram-plugin/gateway/voice-message-handler.ts +123 -0
- package/telegram-plugin/gateway/voice-ondemand-callback-handler.ts +204 -0
- package/telegram-plugin/gateway/worker-feed-dispatch.ts +40 -0
- package/telegram-plugin/narrative-dedup.ts +24 -1
- package/telegram-plugin/narrative-flush.ts +2 -2
- package/telegram-plugin/pending-user-notice.ts +59 -13
- package/telegram-plugin/render/render.ts +25 -1
- package/telegram-plugin/status-no-truncate.ts +13 -0
- package/telegram-plugin/subagent-watcher.ts +297 -31
- package/telegram-plugin/tests/activity-card-wiring.test.ts +8 -3
- package/telegram-plugin/tests/activity-ever-opened-sticky.test.ts +18 -3
- package/telegram-plugin/tests/agent-button-callback-handler.test.ts +149 -0
- package/telegram-plugin/tests/ask-callback-handler.test.ts +118 -0
- package/telegram-plugin/tests/attachment-message-handlers.test.ts +135 -0
- package/telegram-plugin/tests/backstop-delivery.test.ts +167 -0
- package/telegram-plugin/tests/backstop-readback-probe.test.ts +144 -0
- package/telegram-plugin/tests/boot-card-routing.test.ts +139 -0
- package/telegram-plugin/tests/bot-commands-model-effort.test.ts +189 -0
- package/telegram-plugin/tests/bot-commands-start-info.test.ts +240 -0
- package/telegram-plugin/tests/buffer-gate-broadened.test.ts +28 -9
- package/telegram-plugin/tests/busy-ack-wiring.test.ts +6 -1
- package/telegram-plugin/tests/button-tap-turn-gated.test.ts +21 -12
- package/telegram-plugin/tests/callback-query-handlers.test.ts +101 -0
- package/telegram-plugin/tests/captured-answer-resume.test.ts +358 -0
- package/telegram-plugin/tests/card-tool-handlers.test.ts +497 -0
- package/telegram-plugin/tests/catch-all-unhandled-message.test.ts +5 -2
- package/telegram-plugin/tests/checklist-message-handler.test.ts +160 -0
- package/telegram-plugin/tests/emission-authority-facade.test.ts +76 -29
- package/telegram-plugin/tests/emission-authority-ping-gate.test.ts +4 -1
- package/telegram-plugin/tests/emission-determinism-wiring.test.ts +45 -16
- package/telegram-plugin/tests/feed-heartbeat-liveness-open.test.ts +30 -7
- package/telegram-plugin/tests/gateway-boot-side-effect-gating.test.ts +270 -0
- package/telegram-plugin/tests/gateway-boot-smoke.test.ts +150 -0
- package/telegram-plugin/tests/gateway-bot-construction-deferral.test.ts +251 -0
- package/telegram-plugin/tests/gateway-disconnect-flush.test.ts +5 -128
- package/telegram-plugin/tests/gateway-handler-registration-wiring.test.ts +299 -0
- package/telegram-plugin/tests/gateway-loopback-paste-redact.test.ts +44 -29
- package/telegram-plugin/tests/gateway-outbound-redact.test.ts +18 -5
- package/telegram-plugin/tests/gateway-request-secret.test.ts +7 -3
- package/telegram-plugin/tests/gateway-secret-detect.test.ts +20 -10
- package/telegram-plugin/tests/gateway-session-model-relaunch.test.ts +8 -2
- package/telegram-plugin/tests/inbound-delivery-cutover-flip.test.ts +54 -150
- package/telegram-plugin/tests/inbound-delivery-cutover-gate.test.ts +10 -14
- package/telegram-plugin/tests/inbound-delivery-dispatch-equivalence.test.ts +6 -7
- package/telegram-plugin/tests/inbound-delivery-machine-dispatch.test.ts +0 -16
- package/telegram-plugin/tests/inbound-emit-after-intercepts.test.ts +18 -7
- package/telegram-plugin/tests/inbound-message-types.test.ts +52 -16
- package/telegram-plugin/tests/litellm-proxy-auth-misconfig.test.ts +69 -14
- package/telegram-plugin/tests/media-message-handlers.test.ts +276 -0
- package/telegram-plugin/tests/mental-model-propose-callback-gate.test.ts +8 -4
- package/telegram-plugin/tests/model-command.test.ts +30 -0
- package/telegram-plugin/tests/multitopic-routing-wiring.test.ts +36 -12
- package/telegram-plugin/tests/narrative-dedup.test.ts +32 -0
- package/telegram-plugin/tests/narrative-flush.test.ts +6 -2
- package/telegram-plugin/tests/narrative-lane-golden.test.ts +458 -0
- package/telegram-plugin/tests/no-reply-bounded-drain.test.ts +14 -3
- package/telegram-plugin/tests/obligation-ledger.test.ts +40 -0
- package/telegram-plugin/tests/obligation-store.test.ts +43 -0
- package/telegram-plugin/tests/pending-card-durability-wiring.test.ts +18 -8
- package/telegram-plugin/tests/per-topic-current-turn.test.ts +32 -8
- package/telegram-plugin/tests/permission-no-repeat-wiring.test.ts +9 -6
- package/telegram-plugin/tests/photo-message-handler.test.ts +114 -0
- package/telegram-plugin/tests/photo-reroute-wiring.test.ts +5 -2
- package/telegram-plugin/tests/pinned-message-handler.test.ts +108 -0
- package/telegram-plugin/tests/render/render.test.ts +42 -0
- package/telegram-plugin/tests/reply-terminal-reaction.test.ts +6 -2
- package/telegram-plugin/tests/secret-detect-delete-must-surface-failures.test.ts +8 -4
- package/telegram-plugin/tests/secret-detect-fail-closed.test.ts +38 -28
- package/telegram-plugin/tests/secret-detect-oauth-code.test.ts +31 -20
- package/telegram-plugin/tests/send-reply-golden.test.ts +571 -0
- package/telegram-plugin/tests/silence-liveness-wiring.test.ts +22 -8
- package/telegram-plugin/tests/status-pin-service-message-suppression.test.ts +42 -49
- package/telegram-plugin/tests/stop-command.test.ts +22 -12
- package/telegram-plugin/tests/stream-render-golden.test.ts +424 -0
- package/telegram-plugin/tests/subagent-watcher-boot-skip-dead.test.ts +218 -0
- package/telegram-plugin/tests/subagent-watcher-resume-reregister.test.ts +305 -0
- package/telegram-plugin/tests/subagent-watcher-resurrection.test.ts +32 -0
- package/telegram-plugin/tests/subagent-watcher.test.ts +35 -3
- package/telegram-plugin/tests/turn-end-gate-backstop.test.ts +8 -12
- package/telegram-plugin/tests/turn-flush-safety.test.ts +191 -11
- package/telegram-plugin/tests/turn-flush-suppression-wiring.test.ts +117 -0
- package/telegram-plugin/tests/vault-approval-posture.test.ts +8 -2
- package/telegram-plugin/tests/vault-grant-inbound-builders.test.ts +2 -2
- package/telegram-plugin/tests/vault-grant-union.test.ts +4 -1
- package/telegram-plugin/tests/vault-key-regex-allows-slash.test.ts +16 -5
- package/telegram-plugin/tests/vault-request-access-tool.test.ts +10 -5
- package/telegram-plugin/tests/vault-request-access-unlock-resume.test.ts +4 -1
- package/telegram-plugin/tests/vault-subcommands.test.ts +6 -1
- package/telegram-plugin/tests/voice-message-handler.test.ts +111 -0
- package/telegram-plugin/tests/voice-ondemand-callback-handler.test.ts +140 -0
- package/telegram-plugin/tests/worker-activity-feed.test.ts +86 -19
- package/telegram-plugin/tests/worker-feed-coalesce.test.ts +236 -20
- package/telegram-plugin/tests/worker-feed-resume-guard.test.ts +86 -0
- package/telegram-plugin/tool-activity-summary.ts +110 -38
- package/telegram-plugin/turn-flush-safety.ts +80 -14
- package/telegram-plugin/uat/restart-capability.ts +76 -0
- package/telegram-plugin/uat/scenarios/bg-sub-agent-dispatch-dm.test.ts +14 -4
- package/telegram-plugin/uat/scenarios/bridge-flap-resilience-dm.test.ts +11 -1
- package/telegram-plugin/uat/scenarios/cross-turn-pending-progress-dm.test.ts +19 -2
- package/telegram-plugin/uat/scenarios/jtbd-always-on-after-restart-dm.test.ts +6 -12
- package/telegram-plugin/uat/scenarios/jtbd-deliberate-restart-resumes-dm.test.ts +6 -12
- package/telegram-plugin/uat/scenarios/jtbd-interrupted-turn-resumes-dm.test.ts +6 -12
- package/telegram-plugin/uat/scenarios/jtbd-multipart-render-dm.test.ts +47 -13
- package/telegram-plugin/worker-activity-feed.ts +34 -4
- package/telegram-plugin/gateway/busy-key-reaper.ts +0 -113
- package/telegram-plugin/gateway/gate-parity-probe.ts +0 -102
- package/telegram-plugin/tests/busy-key-reaper.test.ts +0 -192
- package/telegram-plugin/tests/fixtures/cutover-killswitch-probe.ts +0 -75
- package/telegram-plugin/tests/gate-parity-probe.test.ts +0 -171
- package/telegram-plugin/tests/parallel-turns-deadlock-fix.test.ts +0 -217
|
@@ -38,14 +38,13 @@
|
|
|
38
38
|
*
|
|
39
39
|
* The gateway-internal turn/poke effects (setTurnStarted,
|
|
40
40
|
* clearTurnStarted, noteOutbound, firePoke) map to gateway-scope state
|
|
41
|
-
* (
|
|
41
|
+
* (the silence-poke ladder, turn markers) that this decoupled module
|
|
42
42
|
* cannot reach directly, so they are dispatched through OPTIONAL
|
|
43
43
|
* callbacks on the ctx. When a callback is absent the effect logs an
|
|
44
44
|
* `unwired` trace rather than silently no-opping — the trace is the gate.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* Default is ON — this PR is the cutover.
|
|
46
|
+
* The `SWITCHROOM_DELIVERY_MACHINE_CUTOVER` kill switch was removed in
|
|
47
|
+
* #2996 P1 after the cutover baked — the dispatcher always executes.
|
|
49
48
|
*/
|
|
50
49
|
|
|
51
50
|
import type {
|
|
@@ -80,10 +79,10 @@ export interface DispatchCtx {
|
|
|
80
79
|
*/
|
|
81
80
|
readonly onUserInboundDelivered?: (merged: InboundMessage) => void
|
|
82
81
|
// ── Gateway-internal turn/poke effect callbacks ──────────────────
|
|
83
|
-
// These effects map to gateway-scope state (
|
|
84
|
-
//
|
|
85
|
-
// gateway supplies them
|
|
86
|
-
//
|
|
82
|
+
// These effects map to gateway-scope state (the silence-poke ladder,
|
|
83
|
+
// turn markers) that this decoupled module cannot reach. The
|
|
84
|
+
// gateway supplies them at the live inbound call site. Absent → the
|
|
85
|
+
// effect logs an `unwired` trace.
|
|
87
86
|
readonly onSetTurnStarted?: (key: ChatKey, at: number) => void
|
|
88
87
|
/**
|
|
89
88
|
* Optional: observe the outcome of a `deliverToBridge` effect. The
|
|
@@ -101,12 +100,6 @@ export interface DispatchCtx {
|
|
|
101
100
|
readonly onFirePoke?: (key: ChatKey, level: 'soft' | 'firm' | 'fallback') => void
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
const enabled = process.env.SWITCHROOM_DELIVERY_MACHINE_CUTOVER !== '0'
|
|
105
|
-
|
|
106
|
-
export function isDispatchEnabled(): boolean {
|
|
107
|
-
return enabled
|
|
108
|
-
}
|
|
109
|
-
|
|
110
103
|
/**
|
|
111
104
|
* Execute the effects returned by `transition()`. Pure imperative
|
|
112
105
|
* driver: side-effects only, no machine state held here.
|
|
@@ -117,7 +110,6 @@ export function isDispatchEnabled(): boolean {
|
|
|
117
110
|
* already up).
|
|
118
111
|
*/
|
|
119
112
|
export function dispatchEffects(effects: readonly Effect[], ctx: DispatchCtx): void {
|
|
120
|
-
if (!enabled) return
|
|
121
113
|
for (const effect of effects) {
|
|
122
114
|
dispatchOne(effect, ctx)
|
|
123
115
|
}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* InboundDeliveryStateMachine —
|
|
2
|
+
* InboundDeliveryStateMachine — live machine state + event driver.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Historically the "shadow mode" wiring (RFC
|
|
5
|
+
* `reference/rfcs/inbound-delivery-state-machine.md` Phase 2b PR 2): the
|
|
6
|
+
* machine ran ALONGSIDE the imperative gateway code, predicting effects
|
|
7
|
+
* to a structured trace. The #3012 cutover made this state AUTHORITATIVE
|
|
8
|
+
* for the turn-in-flight gate and the deliver-vs-buffer inbound routing,
|
|
9
|
+
* and #2996 P1 removed the kill switches (`SWITCHROOM_DELIVERY_MACHINE_SHADOW`,
|
|
10
|
+
* `SWITCHROOM_DELIVERY_MACHINE_CUTOVER`) — the machine is now the sole
|
|
11
|
+
* delivery authority. (The `shadowEmit` name is kept for its ~15 gateway
|
|
12
|
+
* call sites; the `gw-trace shadow` trace prefix is kept for log-parser
|
|
13
|
+
* continuity.) This module's job:
|
|
9
14
|
*
|
|
10
15
|
* 1. Own the module-scope machine state.
|
|
11
|
-
* 2. Expose `shadowEmit(event)` that runs `transition()
|
|
12
|
-
*
|
|
13
|
-
*
|
|
16
|
+
* 2. Expose `shadowEmit(event)` that runs `transition()`, advances the
|
|
17
|
+
* state, logs via `gw-trace shadow ...` stderr lines, and RETURNS
|
|
18
|
+
* the effects for the gateway to execute (`dispatchEffects`).
|
|
19
|
+
* 3. Expose `isMachineInTurn()` — the authoritative gate read.
|
|
20
|
+
* 4. Provide test hooks for resetting + inspecting state.
|
|
14
21
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* imperative paths get deleted in PR 4.
|
|
18
|
-
*
|
|
19
|
-
* Telemetry approach: each `shadowEmit` writes a single stderr line
|
|
20
|
-
* with the event kind + emitted effect kinds. Operators can then:
|
|
22
|
+
* Telemetry: each `shadowEmit` writes a single stderr line with the
|
|
23
|
+
* event kind + emitted effect kinds. Operators can then:
|
|
21
24
|
*
|
|
22
25
|
* docker exec switchroom-<agent> sh -lc 'grep "gw-trace shadow" \
|
|
23
26
|
* /var/log/switchroom/gateway-supervisor.log | tail -50'
|
|
24
27
|
*
|
|
25
|
-
* to see what the state machine PREDICTS the gateway should do for
|
|
26
|
-
* each event. Comparing against the actual log lines (`pending-inbound-
|
|
27
|
-
* buffer: agent=X buffered ...` etc.) is the validation that the
|
|
28
|
-
* machine is bit-identical with reality.
|
|
29
|
-
*
|
|
30
28
|
* Trace verbosity (#3025): the TTL `tick` event fires every ~30s and on a
|
|
31
29
|
* healthy idle agent emits a zero-signal `event=tick effects=[]
|
|
32
30
|
* global=bridge_alive_idle` line. Those no-op ticks are SUPPRESSED by
|
|
@@ -36,10 +34,6 @@
|
|
|
36
34
|
* in `../shared/gw-trace-gate.ts` and also governs the `tg-post` poll
|
|
37
35
|
* heartbeats. Real events, turn-expiring ticks, and in-turn ticks always
|
|
38
36
|
* log regardless of the flag.
|
|
39
|
-
*
|
|
40
|
-
* Toggle off via `SWITCHROOM_DELIVERY_MACHINE_SHADOW=0` — a kill
|
|
41
|
-
* switch for the case where the shadow emits prove problematic
|
|
42
|
-
* (e.g., trace volume too high). The default is ON.
|
|
43
37
|
*/
|
|
44
38
|
|
|
45
39
|
import {
|
|
@@ -52,58 +46,36 @@ import {
|
|
|
52
46
|
import { shouldEmitShadowTrace } from '../shared/gw-trace-gate.js'
|
|
53
47
|
|
|
54
48
|
let state: State = initialState()
|
|
55
|
-
const enabled = process.env.SWITCHROOM_DELIVERY_MACHINE_SHADOW !== '0'
|
|
56
|
-
|
|
57
|
-
// Phase 2b PR 3 — STAGED CUTOVER. When enabled, the gateway's
|
|
58
|
-
// "is a turn in flight?" gate reads this machine's global state
|
|
59
|
-
// instead of the PR3b `claudeBusyKeys` set. The machine tracks ONE
|
|
60
|
-
// `activeTurn` (single bridge) plus TTL `tick` expiry, so — unlike a
|
|
61
|
-
// per-delivery key set — it cannot accumulate orphan keys and wedge
|
|
62
|
-
// the gate "in-flight forever" (the gymbro/clerk 5-min dangle of
|
|
63
|
-
// 2026-05-28). Scope is the turn-in-flight GATE only; the poke ladder
|
|
64
|
-
// and perm-verdict effects stay imperative for a follow-up PR.
|
|
65
|
-
//
|
|
66
|
-
// Kill switch: `SWITCHROOM_DELIVERY_MACHINE_CUTOVER=0` reverts every
|
|
67
|
-
// gate to the legacy claudeBusyKeys read (zero behaviour change).
|
|
68
|
-
// Requires shadow mode ON — with shadow off the machine state is
|
|
69
|
-
// frozen and must NOT be read as authoritative.
|
|
70
|
-
const cutoverEnabled = enabled && process.env.SWITCHROOM_DELIVERY_MACHINE_CUTOVER !== '0'
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* True when the kill-switch leaves the delivery machine authoritative
|
|
74
|
-
* for the turn-in-flight gate. Gateway gate sites branch on this.
|
|
75
|
-
*/
|
|
76
|
-
export function isDeliveryCutoverEnabled(): boolean {
|
|
77
|
-
return cutoverEnabled
|
|
78
|
-
}
|
|
79
49
|
|
|
80
50
|
/**
|
|
81
51
|
* Authoritative "is a turn currently in flight?" read for the gate.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
52
|
+
* The machine tracks ONE `activeTurn` (single bridge) plus TTL `tick`
|
|
53
|
+
* expiry, so — unlike the deleted per-delivery `claudeBusyKeys` set —
|
|
54
|
+
* it cannot accumulate orphan keys and wedge the gate "in-flight
|
|
55
|
+
* forever" (the gymbro/clerk 5-min dangle of 2026-05-28). `bridge_dead`
|
|
56
|
+
* and `bridge_alive_idle` are both "not in flight".
|
|
85
57
|
*/
|
|
86
58
|
export function isMachineInTurn(): boolean {
|
|
87
59
|
return state.global.kind === 'bridge_alive_in_turn'
|
|
88
60
|
}
|
|
89
61
|
|
|
90
62
|
/**
|
|
91
|
-
* Run an event through the state machine
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
63
|
+
* Run an event through the state machine: the machine state advances,
|
|
64
|
+
* the effects are logged and RETURNED for the caller to execute
|
|
65
|
+
* (`dispatchEffects` at the live inbound/bridgeUp call sites; the
|
|
66
|
+
* lifecycle emits — turnStart/turnEnd/modelOutbound/tick — advance state
|
|
67
|
+
* only and ignore the return, their real-world work still being
|
|
68
|
+
* imperative per the RFC's open PR3b checklist).
|
|
97
69
|
*/
|
|
98
70
|
export function shadowEmit(event: Event): readonly Effect[] {
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
// pure (no I/O, no async) and property-tested over 5000 schedules,
|
|
71
|
+
// The machine driver MUST NEVER break the gateway. The state machine
|
|
72
|
+
// is pure (no I/O, no async) and property-tested over 5000 schedules,
|
|
102
73
|
// so transition() won't throw on well-formed input. But event
|
|
103
74
|
// construction at the call site could mis-shape inputs; the
|
|
104
|
-
// try/catch is belt-and-braces so a
|
|
105
|
-
// turn. The catch logs and bails — the
|
|
106
|
-
//
|
|
75
|
+
// try/catch is belt-and-braces so a driver bug never wedges a real
|
|
76
|
+
// turn. The catch logs and bails — the gateway code below the emit
|
|
77
|
+
// point still runs (falling back to the buffer-everything semantics
|
|
78
|
+
// of an un-advanced machine).
|
|
107
79
|
try {
|
|
108
80
|
const result = transition(state, event)
|
|
109
81
|
state = result.state
|
|
@@ -164,8 +136,3 @@ export function __shadowResetForTests(): void {
|
|
|
164
136
|
export function __shadowGetStateForTests(): State {
|
|
165
137
|
return state
|
|
166
138
|
}
|
|
167
|
-
|
|
168
|
-
/** Test hook: check if shadow mode is enabled (mirrors the env-var). */
|
|
169
|
-
export function __shadowEnabledForTests(): boolean {
|
|
170
|
-
return enabled
|
|
171
|
-
}
|