| 49 | status print bridge state` |
| 50 | |
| 51 | const call: LocalCommandCall = async args => { |
| 52 | const h = getBridgeDebugHandle() |
| 53 | if (!h) { |
| 54 | return { |
| 55 | type: 'text', |
| 56 | value: |
| 57 | 'No bridge debug handle registered. Remote Control must be connected (USER_TYPE=ant).', |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | const [sub, a, b] = args.trim().split(/\s+/) |
| 62 | |
| 63 | switch (sub) { |
| 64 | case 'close': { |
| 65 | const code = Number(a) |
| 66 | if (!Number.isFinite(code)) { |
| 67 | return { type: 'text', value: `close: need a numeric code\n${USAGE}` } |
| 68 | } |
| 69 | h.fireClose(code) |
| 70 | return { |
| 71 | type: 'text', |
| 72 | value: `Fired transport close(${code}). Watch debug.log for [bridge:repl] recovery.`, |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | case 'poll': { |
| 77 | if (a === 'transient') { |
| 78 | h.injectFault({ |
| 79 | method: 'pollForWork', |
| 80 | kind: 'transient', |
| 81 | status: 503, |
| 82 | count: 1, |
| 83 | }) |
| 84 | h.wakePollLoop() |
| 85 | return { |
| 86 | type: 'text', |
| 87 | value: |
| 88 | 'Next poll will throw a transient (axios rejection). Poll loop woken.', |
| 89 | } |
| 90 | } |
| 91 | const status = Number(a) |
| 92 | if (!Number.isFinite(status)) { |
| 93 | return { |
| 94 | type: 'text', |
| 95 | value: `poll: need 'transient' or a status code\n${USAGE}`, |
| 96 | } |
| 97 | } |
| 98 | // Default to what the server ACTUALLY sends for 404 (BQ-verified), |
| 99 | // so `/bridge-kick poll 404` reproduces the real 147K/week state. |
| 100 | const errorType = |
| 101 | b ?? (status === 404 ? 'not_found_error' : 'authentication_error') |
| 102 | h.injectFault({ |
| 103 | method: 'pollForWork', |
| 104 | kind: 'fatal', |
| 105 | status, |
| 106 | errorType, |
| 107 | count: 1, |
| 108 | }) |
nothing calls this directly
no test coverage detected