@agentdeck/bridge 1.0.20 → 1.0.22

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 (211) hide show
  1. package/dist/adapters/openclaw.d.ts +55 -1
  2. package/dist/adapters/openclaw.d.ts.map +1 -1
  3. package/dist/adapters/openclaw.js +278 -45
  4. package/dist/adapters/openclaw.js.map +1 -1
  5. package/dist/adb-reverse.d.ts +26 -3
  6. package/dist/adb-reverse.d.ts.map +1 -1
  7. package/dist/adb-reverse.js +26 -5
  8. package/dist/adb-reverse.js.map +1 -1
  9. package/dist/apme/adapters/openclaw-hook.d.ts +45 -1
  10. package/dist/apme/adapters/openclaw-hook.d.ts.map +1 -1
  11. package/dist/apme/adapters/openclaw-hook.js +84 -4
  12. package/dist/apme/adapters/openclaw-hook.js.map +1 -1
  13. package/dist/apme/claude-transcript-reader.d.ts +54 -0
  14. package/dist/apme/claude-transcript-reader.d.ts.map +1 -1
  15. package/dist/apme/claude-transcript-reader.js +77 -0
  16. package/dist/apme/claude-transcript-reader.js.map +1 -1
  17. package/dist/apme/collector.d.ts +63 -5
  18. package/dist/apme/collector.d.ts.map +1 -1
  19. package/dist/apme/collector.js +147 -10
  20. package/dist/apme/collector.js.map +1 -1
  21. package/dist/apme/store.d.ts +23 -1
  22. package/dist/apme/store.d.ts.map +1 -1
  23. package/dist/apme/store.js +81 -2
  24. package/dist/apme/store.js.map +1 -1
  25. package/dist/apme/types.d.ts +1 -1
  26. package/dist/apme/types.d.ts.map +1 -1
  27. package/dist/apme/types.js.map +1 -1
  28. package/dist/auth.d.ts +37 -0
  29. package/dist/auth.d.ts.map +1 -1
  30. package/dist/auth.js +23 -0
  31. package/dist/auth.js.map +1 -1
  32. package/dist/ble-sync-spawn.d.ts +27 -0
  33. package/dist/ble-sync-spawn.d.ts.map +1 -1
  34. package/dist/ble-sync-spawn.js +32 -0
  35. package/dist/ble-sync-spawn.js.map +1 -1
  36. package/dist/bridge-core.d.ts +21 -4
  37. package/dist/bridge-core.d.ts.map +1 -1
  38. package/dist/bridge-core.js +52 -23
  39. package/dist/bridge-core.js.map +1 -1
  40. package/dist/claude-interrupt-marker.d.ts +31 -0
  41. package/dist/claude-interrupt-marker.d.ts.map +1 -0
  42. package/dist/claude-interrupt-marker.js +58 -0
  43. package/dist/claude-interrupt-marker.js.map +1 -0
  44. package/dist/claude-turn-watchdog.d.ts +23 -0
  45. package/dist/claude-turn-watchdog.d.ts.map +1 -1
  46. package/dist/claude-turn-watchdog.js +30 -4
  47. package/dist/claude-turn-watchdog.js.map +1 -1
  48. package/dist/cli.d.ts +6 -0
  49. package/dist/cli.d.ts.map +1 -1
  50. package/dist/cli.js +411 -115
  51. package/dist/cli.js.map +1 -1
  52. package/dist/codex-rate-limits-live.d.ts +58 -9
  53. package/dist/codex-rate-limits-live.d.ts.map +1 -1
  54. package/dist/codex-rate-limits-live.js +64 -15
  55. package/dist/codex-rate-limits-live.js.map +1 -1
  56. package/dist/codex-rate-limits.d.ts +2 -2
  57. package/dist/codex-rate-limits.d.ts.map +1 -1
  58. package/dist/codex-rate-limits.js +34 -16
  59. package/dist/codex-rate-limits.js.map +1 -1
  60. package/dist/daemon-port.d.ts +90 -0
  61. package/dist/daemon-port.d.ts.map +1 -0
  62. package/dist/daemon-port.js +119 -0
  63. package/dist/daemon-port.js.map +1 -0
  64. package/dist/daemon-server.d.ts +60 -3
  65. package/dist/daemon-server.d.ts.map +1 -1
  66. package/dist/daemon-server.js +362 -109
  67. package/dist/daemon-server.js.map +1 -1
  68. package/dist/daemon-settings.d.ts +46 -0
  69. package/dist/daemon-settings.d.ts.map +1 -0
  70. package/dist/daemon-settings.js +85 -0
  71. package/dist/daemon-settings.js.map +1 -0
  72. package/dist/daemon-takeover.d.ts +75 -0
  73. package/dist/daemon-takeover.d.ts.map +1 -0
  74. package/dist/daemon-takeover.js +137 -0
  75. package/dist/daemon-takeover.js.map +1 -0
  76. package/dist/daemon.js +1 -1
  77. package/dist/hook-server.d.ts.map +1 -1
  78. package/dist/hook-server.js +17 -0
  79. package/dist/hook-server.js.map +1 -1
  80. package/dist/idotmatrix/idotmatrix-daemon-sync.d.ts.map +1 -1
  81. package/dist/idotmatrix/idotmatrix-daemon-sync.js +13 -1
  82. package/dist/idotmatrix/idotmatrix-daemon-sync.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +34 -12
  86. package/dist/index.js.map +1 -1
  87. package/dist/kiro-diagnostics.d.ts +90 -0
  88. package/dist/kiro-diagnostics.d.ts.map +1 -0
  89. package/dist/kiro-diagnostics.js +278 -0
  90. package/dist/kiro-diagnostics.js.map +1 -0
  91. package/dist/kiro-session.d.ts +113 -0
  92. package/dist/kiro-session.d.ts.map +1 -0
  93. package/dist/kiro-session.js +688 -0
  94. package/dist/kiro-session.js.map +1 -0
  95. package/dist/kiro-timeline-feed.d.ts +45 -0
  96. package/dist/kiro-timeline-feed.d.ts.map +1 -0
  97. package/dist/kiro-timeline-feed.js +116 -0
  98. package/dist/kiro-timeline-feed.js.map +1 -0
  99. package/dist/kiro-transcript-timeline.d.ts +57 -0
  100. package/dist/kiro-transcript-timeline.d.ts.map +1 -0
  101. package/dist/kiro-transcript-timeline.js +183 -0
  102. package/dist/kiro-transcript-timeline.js.map +1 -0
  103. package/dist/linux-service.d.ts +2 -1
  104. package/dist/linux-service.d.ts.map +1 -1
  105. package/dist/linux-service.js +8 -3
  106. package/dist/linux-service.js.map +1 -1
  107. package/dist/mdns-discover.d.ts +27 -0
  108. package/dist/mdns-discover.d.ts.map +1 -1
  109. package/dist/mdns-discover.js +60 -7
  110. package/dist/mdns-discover.js.map +1 -1
  111. package/dist/mdns.d.ts.map +1 -1
  112. package/dist/mdns.js +16 -3
  113. package/dist/mdns.js.map +1 -1
  114. package/dist/modules/adb-module.d.ts.map +1 -1
  115. package/dist/modules/adb-module.js +5 -2
  116. package/dist/modules/adb-module.js.map +1 -1
  117. package/dist/modules/index.d.ts +2 -1
  118. package/dist/modules/index.d.ts.map +1 -1
  119. package/dist/modules/index.js +1 -0
  120. package/dist/modules/index.js.map +1 -1
  121. package/dist/modules/types.d.ts +34 -9
  122. package/dist/modules/types.d.ts.map +1 -1
  123. package/dist/modules/types.js +34 -1
  124. package/dist/modules/types.js.map +1 -1
  125. package/dist/network-posture.d.ts +67 -0
  126. package/dist/network-posture.d.ts.map +1 -0
  127. package/dist/network-posture.js +100 -0
  128. package/dist/network-posture.js.map +1 -0
  129. package/dist/observed-steering.d.ts +14 -0
  130. package/dist/observed-steering.d.ts.map +1 -1
  131. package/dist/observed-steering.js +18 -0
  132. package/dist/observed-steering.js.map +1 -1
  133. package/dist/observed-turn-watchdogs.d.ts +84 -0
  134. package/dist/observed-turn-watchdogs.d.ts.map +1 -0
  135. package/dist/observed-turn-watchdogs.js +134 -0
  136. package/dist/observed-turn-watchdogs.js.map +1 -0
  137. package/dist/openclaw-session.d.ts +10 -0
  138. package/dist/openclaw-session.d.ts.map +1 -1
  139. package/dist/openclaw-session.js +12 -0
  140. package/dist/openclaw-session.js.map +1 -1
  141. package/dist/passive-observer.d.ts +19 -0
  142. package/dist/passive-observer.d.ts.map +1 -1
  143. package/dist/passive-observer.js +208 -24
  144. package/dist/passive-observer.js.map +1 -1
  145. package/dist/pixoo/micro-glyphs.d.ts +1 -1
  146. package/dist/pixoo/micro-glyphs.d.ts.map +1 -1
  147. package/dist/pixoo/micro-glyphs.js +2 -0
  148. package/dist/pixoo/micro-glyphs.js.map +1 -1
  149. package/dist/pixoo/official-dot-glyphs.generated.d.ts +1 -1
  150. package/dist/pixoo/official-dot-glyphs.generated.d.ts.map +1 -1
  151. package/dist/pixoo/official-dot-glyphs.generated.js +47 -0
  152. package/dist/pixoo/official-dot-glyphs.generated.js.map +1 -1
  153. package/dist/pixoo/pixoo-discover.d.ts +8 -1
  154. package/dist/pixoo/pixoo-discover.d.ts.map +1 -1
  155. package/dist/pixoo/pixoo-discover.js +15 -8
  156. package/dist/pixoo/pixoo-discover.js.map +1 -1
  157. package/dist/pixoo/pixoo-renderer.d.ts +4 -2
  158. package/dist/pixoo/pixoo-renderer.d.ts.map +1 -1
  159. package/dist/pixoo/pixoo-renderer.js +105 -36
  160. package/dist/pixoo/pixoo-renderer.js.map +1 -1
  161. package/dist/pixoo/pixoo-settings.d.ts +19 -2
  162. package/dist/pixoo/pixoo-settings.d.ts.map +1 -1
  163. package/dist/pixoo/pixoo-settings.js +22 -4
  164. package/dist/pixoo/pixoo-settings.js.map +1 -1
  165. package/dist/pixoo/pixoo-sprites.d.ts.map +1 -1
  166. package/dist/pixoo/pixoo-sprites.js +2 -0
  167. package/dist/pixoo/pixoo-sprites.js.map +1 -1
  168. package/dist/python-ble-runtime.d.ts +2 -0
  169. package/dist/python-ble-runtime.d.ts.map +1 -1
  170. package/dist/python-ble-runtime.js +101 -7
  171. package/dist/python-ble-runtime.js.map +1 -1
  172. package/dist/session-aggregator.d.ts +9 -1
  173. package/dist/session-aggregator.d.ts.map +1 -1
  174. package/dist/session-aggregator.js +1 -1
  175. package/dist/session-aggregator.js.map +1 -1
  176. package/dist/session-registry.d.ts +71 -3
  177. package/dist/session-registry.d.ts.map +1 -1
  178. package/dist/session-registry.js +126 -19
  179. package/dist/session-registry.js.map +1 -1
  180. package/dist/subagent-timeline.d.ts +38 -7
  181. package/dist/subagent-timeline.d.ts.map +1 -1
  182. package/dist/subagent-timeline.js +154 -23
  183. package/dist/subagent-timeline.js.map +1 -1
  184. package/dist/timebox/timebox-daemon-sync.d.ts.map +1 -1
  185. package/dist/timebox/timebox-daemon-sync.js +11 -1
  186. package/dist/timebox/timebox-daemon-sync.js.map +1 -1
  187. package/dist/timeline-store.d.ts.map +1 -1
  188. package/dist/timeline-store.js +26 -1
  189. package/dist/timeline-store.js.map +1 -1
  190. package/dist/tui/renderer.d.ts.map +1 -1
  191. package/dist/tui/renderer.js +13 -1
  192. package/dist/tui/renderer.js.map +1 -1
  193. package/dist/tui/terrarium.d.ts.map +1 -1
  194. package/dist/tui/terrarium.js +10 -5
  195. package/dist/tui/terrarium.js.map +1 -1
  196. package/dist/usage-api.d.ts +28 -1
  197. package/dist/usage-api.d.ts.map +1 -1
  198. package/dist/usage-api.js +74 -33
  199. package/dist/usage-api.js.map +1 -1
  200. package/dist/usage-event.d.ts.map +1 -1
  201. package/dist/usage-event.js +2 -17
  202. package/dist/usage-event.js.map +1 -1
  203. package/dist/utils/redact-secrets.d.ts +3 -0
  204. package/dist/utils/redact-secrets.d.ts.map +1 -0
  205. package/dist/utils/redact-secrets.js +29 -0
  206. package/dist/utils/redact-secrets.js.map +1 -0
  207. package/dist/windows-service.d.ts +2 -1
  208. package/dist/windows-service.d.ts.map +1 -1
  209. package/dist/windows-service.js +6 -3
  210. package/dist/windows-service.js.map +1 -1
  211. package/package.json +3 -3
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The CLI daemon's **preferred port** — the port it intends to serve, as
3
+ * opposed to the port it ended up on.
4
+ *
5
+ * Roadmap item 11 (docs/ENTERPRISE-ROADMAP.md §1.5) asks for a persistent
6
+ * `daemonPort` for the CLI to match the macOS app's `AppPreferences.daemonPort`.
7
+ * The reason it matters is not configurability for its own sake — it is that
8
+ * without a recorded intent, a daemon that landed on a fallback port has no way
9
+ * to know it is on the wrong one.
10
+ *
11
+ * ## Intent is persisted; the outcome never is
12
+ *
13
+ * This is the rule the whole module exists to enforce. `daemon.json` records
14
+ * where the daemon *is*, and every client resolves through it. This setting
15
+ * records where the daemon *wants to be*. Persisting the outcome instead would
16
+ * be self-reinforcing: a daemon bumped to 9121 by a transient hold would write
17
+ * 9121 down and start there forever, turning a 14-second kernel reservation
18
+ * into a permanent move. So nothing in the daemon's startup path ever writes
19
+ * this value — only the user does, via `agentdeck daemon port <n>`.
20
+ *
21
+ * ## Sources
22
+ *
23
+ * `-p/--port` › `AGENTDECK_DAEMON_PORT` › `settings.json` `daemonPort` › 9120.
24
+ * All four are statements of intent; they differ only in precedence and in how
25
+ * long they last. The resolved `source` is carried alongside the number because
26
+ * one caller needs it: `daemon start` treats a port the user typed on THIS
27
+ * invocation differently from one it merely defaulted to (an explicit choice
28
+ * fails loudly rather than quietly binding a different port).
29
+ */
30
+ import { loadDaemonSettings } from './daemon-settings.js';
31
+ import { DAEMON_DEFAULT_PORT } from './session-registry.js';
32
+ /** `settings.json` key. Same name as the macOS app's `prefs.daemonPort`. */
33
+ export const DAEMON_PORT_SETTING_KEY = 'daemonPort';
34
+ /** Environment override, for a shell or MDM profile that cannot edit files. */
35
+ export const DAEMON_PORT_ENV_VAR = 'AGENTDECK_DAEMON_PORT';
36
+ /**
37
+ * Accepted range, mirroring `AppPreferences.clampPort` (1024–65535). Below 1024
38
+ * needs root on every platform we support, which the daemon never has.
39
+ */
40
+ export const DAEMON_PORT_MIN = 1024;
41
+ export const DAEMON_PORT_MAX = 65535;
42
+ /**
43
+ * How long the daemon waits for its preferred port to come free before
44
+ * conceding to a fallback, when nothing answers `/health` on it.
45
+ *
46
+ * Sized from a measurement, not a guess: cancelling a listener on macOS leaves
47
+ * a NECP reservation on the port for ~14s (bindable at ~17s, measured
48
+ * 2026-08-06 — `lsof` shows zero sockets for the whole interval and `bind()`
49
+ * still returns EADDRINUSE). 20s clears that with margin.
50
+ *
51
+ * The wait polls, so it costs only as long as the port is actually held. The
52
+ * full budget is paid only when something outside AgentDeck really is
53
+ * listening there — once per daemon start, with a log line saying so.
54
+ */
55
+ export const PREFERRED_PORT_RECLAIM_MS = 20_000;
56
+ /** True when `value` is a port this daemon may be asked to bind. */
57
+ export function isValidDaemonPort(value) {
58
+ return typeof value === 'number'
59
+ && Number.isInteger(value)
60
+ && value >= DAEMON_PORT_MIN
61
+ && value <= DAEMON_PORT_MAX;
62
+ }
63
+ /**
64
+ * Parse a port written as text (a flag value, an env var). Returns null for
65
+ * anything that is not a valid port — including `"9120abc"`, which `parseInt`
66
+ * would happily read as 9120.
67
+ */
68
+ export function parseDaemonPort(raw) {
69
+ const text = raw?.trim();
70
+ if (!text || !/^\d+$/.test(text))
71
+ return null;
72
+ const value = Number(text);
73
+ return isValidDaemonPort(value) ? value : null;
74
+ }
75
+ /**
76
+ * The persisted preference, or null when absent or unusable.
77
+ *
78
+ * Lenient on purpose: a malformed `daemonPort` must fall through to the
79
+ * default rather than stop the daemon from starting. The *setter* is the strict
80
+ * half — it rejects out-of-range input with a message, so a typo is caught
81
+ * where the user can see it instead of silently reverting six weeks later.
82
+ */
83
+ export function preferredDaemonPortFrom(settings) {
84
+ const value = settings[DAEMON_PORT_SETTING_KEY];
85
+ if (isValidDaemonPort(value))
86
+ return value;
87
+ // A port stored as a string is a plausible hand-edit of settings.json.
88
+ if (typeof value === 'string')
89
+ return parseDaemonPort(value);
90
+ return null;
91
+ }
92
+ /**
93
+ * Resolve the preferred port and where it came from. Pure — every input is
94
+ * injectable so the precedence order can be pinned without touching the real
95
+ * environment or the real settings file.
96
+ */
97
+ export function resolveDaemonPort(input = {}) {
98
+ const flag = typeof input.flag === 'number' ? input.flag : parseDaemonPort(input.flag ?? undefined);
99
+ if (isValidDaemonPort(flag))
100
+ return { port: flag, source: 'flag' };
101
+ const env = input.env ?? process.env;
102
+ const fromEnv = parseDaemonPort(env[DAEMON_PORT_ENV_VAR]);
103
+ if (fromEnv !== null)
104
+ return { port: fromEnv, source: 'env' };
105
+ const fromSettings = preferredDaemonPortFrom(input.settings ?? loadDaemonSettings());
106
+ if (fromSettings !== null)
107
+ return { port: fromSettings, source: 'settings' };
108
+ return { port: DAEMON_DEFAULT_PORT, source: 'default' };
109
+ }
110
+ /** Human-readable provenance, for `daemon port` and the startup log. */
111
+ export function describeDaemonPortSource(source) {
112
+ switch (source) {
113
+ case 'flag': return '--port';
114
+ case 'env': return DAEMON_PORT_ENV_VAR;
115
+ case 'settings': return `settings.json ${DAEMON_PORT_SETTING_KEY}`;
116
+ case 'default': return 'built-in default';
117
+ }
118
+ }
119
+ //# sourceMappingURL=daemon-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"da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,KAAK,UAAU,CAAC,CAAC,OAAO,iBAAiB,uBAAuB,EAAE,CAAC;QACnE,KAAK,SAAS,CAAC,CAAC,OAAO,kBAAkB,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -12,7 +12,47 @@
12
12
  */
13
13
  import WebSocket from 'ws';
14
14
  import { BridgeCore } from './bridge-core.js';
15
- import { type ApiUsageData } from './usage-api.js';
15
+ import { type DaemonPortSource } from './daemon-port.js';
16
+ import { type UsageFetchResult } from './usage-api.js';
17
+ import { FeedPullTracker } from './card-feed.js';
18
+ /** Resolve a stage target (canonical board, registry key, or IP) to the board
19
+ * string the advert is keyed on.
20
+ *
21
+ * This map is read back by `stagedFwAdvert(device_info.board)`, so anything
22
+ * else stored as the key is an advert that can never fire. Staging with an IP
23
+ * is not a misuse to reject — it is the documented way to name one unit when
24
+ * two share a `board` string (see esp32-ota's ambiguity error) — so normalize
25
+ * it here instead. Consequence worth stating: the feed pull carries only a
26
+ * board, so a stage aimed at one unit adverts to every unit of that board.
27
+ * They run the same image, so that is correct rather than merely tolerable.
28
+ *
29
+ * Unlike `findWifiOtaTarget` this must NOT require an open socket: a
30
+ * wake-sync-sleep board holds none by design, which is the entire reason
31
+ * staging exists. An unrecognized target is kept verbatim — staging for a
32
+ * board this daemon has not met yet is legitimate. */
33
+ declare function resolveStagedFwBoard(target: string): string;
34
+ /** Stage a build for a board. Reads the file once to fingerprint it; the file
35
+ * itself is re-read at device download time (a rebuild at the same path is
36
+ * re-fingerprinted by re-staging).
37
+ *
38
+ * `pullSeen` reports whether this daemon has actually observed a feed pull
39
+ * from the board, because "staged" proves neither transfer nor install and a
40
+ * bare success reads as if it did. Only pull-sync firmware fetches a staged
41
+ * image; a board that holds a live WS never asks, so its stage sits forever
42
+ * while the CLI says it is handled. It is daemon-lifetime state, so `false`
43
+ * means "not seen since this daemon started" — not "cannot pull". */
44
+ declare function stageEsp32Fw(target: string, firmwarePath: string): {
45
+ board: string;
46
+ bytes: number;
47
+ md5: string;
48
+ pullSeen: boolean;
49
+ };
50
+ /** The staged advert for a feed response, re-validated against the file on
51
+ * disk so a rebuilt-in-place binary never adverts a stale md5. */
52
+ declare function stagedFwAdvert(board: string | undefined): {
53
+ size: number;
54
+ md5: string;
55
+ } | undefined;
16
56
  /**
17
57
  * Single-path transport dedup. A physical ESP32 can be reachable over BOTH a
18
58
  * USB serial connection and a WiFi WebSocket at once (e.g. inkdeck/ttgo/tc001
@@ -50,10 +90,15 @@ export declare const __wifiOtaTestApi: {
50
90
  unregisterWifiEsp32Socket: typeof unregisterWifiEsp32Socket;
51
91
  handleEsp32OtaReply: typeof handleEsp32OtaReply;
52
92
  performWifiEsp32Ota: typeof performWifiEsp32Ota;
93
+ resolveStagedFwBoard: typeof resolveStagedFwBoard;
94
+ stageEsp32Fw: typeof stageEsp32Fw;
95
+ stagedFwAdvert: typeof stagedFwAdvert;
96
+ feedPulls: FeedPullTracker;
97
+ clearStagedFwForTest: () => void;
53
98
  };
54
99
  declare function performWifiEsp32Ota(core: BridgeCore, target: string, firmwarePath: string): Promise<Record<string, unknown>>;
55
100
  /** @internal Exported for the relay-fallback regression test. */
56
- export declare function fetchUsageRelayed(selfPort: number): Promise<ApiUsageData | null>;
101
+ export declare function fetchUsageRelayed(selfPort: number): Promise<UsageFetchResult | null>;
57
102
  /**
58
103
  * Stamp OpenClaw origin onto a timeline entry emitted by the Gateway adapter.
59
104
  *
@@ -96,12 +141,24 @@ export declare function enrichGatewayTimelineEntry<T extends {
96
141
  */
97
142
  export declare function classifyObservedHookEvent(eventName: string, mapped: string): {
98
143
  boundary: string;
99
- agentType: 'claude-code' | 'codex-cli' | 'opencode' | 'antigravity';
144
+ agentType: 'claude-code' | 'codex-cli' | 'opencode' | 'antigravity' | 'kiro-cli' | 'kiro-ide';
100
145
  };
101
146
  export interface DaemonOptions {
147
+ /** The preferred port — already resolved by the caller when present. */
102
148
  port?: number;
149
+ /**
150
+ * Where `port` came from. Carried so the fallback log can name the real
151
+ * source: the CLI resolves the port itself (so the parent's singleton guard
152
+ * and the forked child cannot aim at different ports), which would otherwise
153
+ * make every port look like it was typed as `--port`.
154
+ */
155
+ portSource?: DaemonPortSource;
103
156
  debug?: boolean;
104
157
  wakeWord?: boolean;
158
+ /** `--local`: every device module off, USB serial included. */
159
+ local?: boolean;
160
+ /** `--loopback`: bind 127.0.0.1 and emit nothing onto the LAN. */
161
+ loopback?: boolean;
105
162
  }
106
163
  export declare function startDaemon(opts: DaemonOptions): Promise<void>;
107
164
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"daemon-server.d.ts","sourceRoot":"","sources":["../src/daemon-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,UAAU,EAA8B,MAAM,kBAAkB,CAAC;AAwH1E,OAAO,EAA8D,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAqQ/G;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAC5C,YAAY,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAClD,OAAO,CAST;AAkBD,iBAAS,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,CA+C1E;AAYD,iBAAS,yBAAyB,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAStD;AAED,iBAAS,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAsBlE;AA6ED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC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