@wrongstack/cli 0.285.0 → 0.287.0

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 (139) hide show
  1. package/dist/arg-parser.d.ts.map +1 -1
  2. package/dist/auth-menu/add-provider.d.ts.map +1 -1
  3. package/dist/boot/dispatch-webui.d.ts +7 -0
  4. package/dist/boot/dispatch-webui.d.ts.map +1 -1
  5. package/dist/boot/short-circuit-hq.d.ts.map +1 -1
  6. package/dist/boot/simpleui-full-auto.d.ts +21 -0
  7. package/dist/boot/simpleui-full-auto.d.ts.map +1 -0
  8. package/dist/boot/system-prompt-builder.d.ts.map +1 -1
  9. package/dist/boot/tool-registry.d.ts.map +1 -1
  10. package/dist/boot/tui-settings-adapter.d.ts +2 -1
  11. package/dist/boot/tui-settings-adapter.d.ts.map +1 -1
  12. package/dist/boot.d.ts +14 -0
  13. package/dist/boot.d.ts.map +1 -1
  14. package/dist/brain-menu/panel-service.d.ts +15 -0
  15. package/dist/brain-menu/panel-service.d.ts.map +1 -0
  16. package/dist/cli-eternal-flag.d.ts +3 -1
  17. package/dist/cli-eternal-flag.d.ts.map +1 -1
  18. package/dist/cli-main.d.ts.map +1 -1
  19. package/dist/config-doctor.d.ts.map +1 -1
  20. package/dist/execute-deps.d.ts +19 -0
  21. package/dist/execute-deps.d.ts.map +1 -1
  22. package/dist/execution.d.ts +4 -1
  23. package/dist/execution.d.ts.map +1 -1
  24. package/dist/fleet/host.d.ts +15 -45
  25. package/dist/fleet/host.d.ts.map +1 -1
  26. package/dist/hq-dashboard-html.d.ts.map +1 -1
  27. package/dist/hq-server/auth.d.ts +53 -0
  28. package/dist/hq-server/auth.d.ts.map +1 -0
  29. package/dist/hq-server/snapshot.d.ts +14 -0
  30. package/dist/hq-server/snapshot.d.ts.map +1 -0
  31. package/dist/hq-server/types.d.ts +67 -0
  32. package/dist/hq-server/types.d.ts.map +1 -0
  33. package/dist/hq-server/utils.d.ts +70 -0
  34. package/dist/hq-server/utils.d.ts.map +1 -0
  35. package/dist/hq-server/ws.d.ts +14 -0
  36. package/dist/hq-server/ws.d.ts.map +1 -0
  37. package/dist/hq-server.d.ts +4 -0
  38. package/dist/hq-server.d.ts.map +1 -1
  39. package/dist/index.js +8865 -3967
  40. package/dist/index.js.map +4 -4
  41. package/dist/launch-hints.d.ts.map +1 -1
  42. package/dist/mcp-serve.d.ts +7 -9
  43. package/dist/mcp-serve.d.ts.map +1 -1
  44. package/dist/next-task-predictor.d.ts.map +1 -1
  45. package/dist/pre-launch/launch-prompts.d.ts +1 -4
  46. package/dist/pre-launch/launch-prompts.d.ts.map +1 -1
  47. package/dist/provider-id.d.ts +13 -0
  48. package/dist/provider-id.d.ts.map +1 -0
  49. package/dist/repl.d.ts +2 -0
  50. package/dist/repl.d.ts.map +1 -1
  51. package/dist/services/project-facts.d.ts.map +1 -1
  52. package/dist/simpleui-dist.d.ts +7 -0
  53. package/dist/simpleui-dist.d.ts.map +1 -0
  54. package/dist/slash-commands/agents.d.ts +2 -0
  55. package/dist/slash-commands/agents.d.ts.map +1 -1
  56. package/dist/slash-commands/brain.d.ts.map +1 -1
  57. package/dist/slash-commands/delegate.d.ts +1 -1
  58. package/dist/slash-commands/fallback.d.ts.map +1 -1
  59. package/dist/slash-commands/git.d.ts +16 -0
  60. package/dist/slash-commands/git.d.ts.map +1 -0
  61. package/dist/slash-commands/goal-refiner.d.ts +72 -2
  62. package/dist/slash-commands/goal-refiner.d.ts.map +1 -1
  63. package/dist/slash-commands/goal.d.ts.map +1 -1
  64. package/dist/slash-commands/health.d.ts +4 -0
  65. package/dist/slash-commands/health.d.ts.map +1 -0
  66. package/dist/slash-commands/index.d.ts +21 -2
  67. package/dist/slash-commands/index.d.ts.map +1 -1
  68. package/dist/slash-commands/mcp.d.ts +8 -0
  69. package/dist/slash-commands/mcp.d.ts.map +1 -1
  70. package/dist/slash-commands/memory.d.ts.map +1 -1
  71. package/dist/slash-commands/metrics.d.ts +4 -0
  72. package/dist/slash-commands/metrics.d.ts.map +1 -0
  73. package/dist/slash-commands/plan.d.ts +4 -0
  74. package/dist/slash-commands/plan.d.ts.map +1 -0
  75. package/dist/slash-commands/refiner.d.ts +15 -0
  76. package/dist/slash-commands/refiner.d.ts.map +1 -0
  77. package/dist/slash-commands/security.d.ts.map +1 -1
  78. package/dist/slash-commands/settings.d.ts.map +1 -1
  79. package/dist/slash-commands/spawn-agents.d.ts.map +1 -1
  80. package/dist/slash-commands/suggest.d.ts.map +1 -1
  81. package/dist/slash-commands/tuneup.d.ts +1 -1
  82. package/dist/subcommands/handlers/mailbox-serve.d.ts.map +1 -1
  83. package/dist/subcommands/handlers/per-subcommand-help.d.ts.map +1 -1
  84. package/dist/subcommands/handlers/version-help.d.ts.map +1 -1
  85. package/dist/tuneup.d.ts.map +1 -1
  86. package/dist/webui-server/client-registration.d.ts.map +1 -1
  87. package/dist/webui-server/connection-handler.d.ts +1 -1
  88. package/dist/webui-server/kanban-run-mirror.d.ts +77 -0
  89. package/dist/webui-server/kanban-run-mirror.d.ts.map +1 -0
  90. package/dist/webui-server/kanban-supervisor.d.ts +36 -0
  91. package/dist/webui-server/kanban-supervisor.d.ts.map +1 -0
  92. package/dist/webui-server/lifecycle.d.ts +5 -1
  93. package/dist/webui-server/lifecycle.d.ts.map +1 -1
  94. package/dist/webui-server/message-router.d.ts +7 -1
  95. package/dist/webui-server/message-router.d.ts.map +1 -1
  96. package/dist/webui-server/prefs-seeding.d.ts +1 -1
  97. package/dist/webui-server/prefs-seeding.d.ts.map +1 -1
  98. package/dist/webui-server/provider-config.d.ts +1 -1
  99. package/dist/webui-server/setup-events.d.ts +1 -1
  100. package/dist/webui-server/static-serve.d.ts +5 -3
  101. package/dist/webui-server/static-serve.d.ts.map +1 -1
  102. package/dist/webui-server/ws-handlers/agent-config.d.ts +25 -2
  103. package/dist/webui-server/ws-handlers/agent-config.d.ts.map +1 -1
  104. package/dist/webui-server/ws-handlers/brain.d.ts +8 -1
  105. package/dist/webui-server/ws-handlers/brain.d.ts.map +1 -1
  106. package/dist/webui-server/ws-handlers/connection.d.ts +8 -1
  107. package/dist/webui-server/ws-handlers/connection.d.ts.map +1 -1
  108. package/dist/webui-server/ws-handlers/context.d.ts +1 -1
  109. package/dist/webui-server/ws-handlers/index.d.ts +3 -3
  110. package/dist/webui-server/ws-handlers/index.d.ts.map +1 -1
  111. package/dist/webui-server/ws-handlers/kanban.d.ts +5 -0
  112. package/dist/webui-server/ws-handlers/kanban.d.ts.map +1 -1
  113. package/dist/webui-server/ws-handlers/mailbox.d.ts +9 -0
  114. package/dist/webui-server/ws-handlers/mailbox.d.ts.map +1 -1
  115. package/dist/webui-server/ws-handlers/prefs.d.ts.map +1 -1
  116. package/dist/webui-server/ws-handlers/providers.d.ts +10 -0
  117. package/dist/webui-server/ws-handlers/providers.d.ts.map +1 -1
  118. package/dist/webui-server/ws-handlers/sessions.d.ts.map +1 -1
  119. package/dist/webui-server/ws-handlers/worklist.d.ts +1 -1
  120. package/dist/webui-server.d.ts +15 -4
  121. package/dist/webui-server.d.ts.map +1 -1
  122. package/dist/wiring/brain-and-orchestration.d.ts +22 -5
  123. package/dist/wiring/brain-and-orchestration.d.ts.map +1 -1
  124. package/dist/wiring/controllers.d.ts +7 -2
  125. package/dist/wiring/controllers.d.ts.map +1 -1
  126. package/dist/wiring/hq-telemetry.d.ts +4 -2
  127. package/dist/wiring/hq-telemetry.d.ts.map +1 -1
  128. package/dist/wiring/lifecycle-plugins.d.ts +10 -7
  129. package/dist/wiring/lifecycle-plugins.d.ts.map +1 -1
  130. package/dist/wiring/metrics.d.ts +20 -1
  131. package/dist/wiring/metrics.d.ts.map +1 -1
  132. package/dist/wiring/plugins.d.ts +2 -1
  133. package/dist/wiring/plugins.d.ts.map +1 -1
  134. package/dist/wiring/session.d.ts +2 -0
  135. package/dist/wiring/session.d.ts.map +1 -1
  136. package/dist/wiring/slash-commands.d.ts +2 -0
  137. package/dist/wiring/slash-commands.d.ts.map +1 -1
  138. package/dist/wiring/tools.d.ts.map +1 -1
  139. package/package.json +20 -18
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Shared types for the HQ server modules.
3
+ *
4
+ * @module hq-server/types
5
+ */
6
+ import type { WebSocket } from 'ws';
7
+ import type { HqClientCapability, HqClientRecord, HqEventEnvelope, HqFleetSnapshotPayload, HqMailboxSnapshotPayload, HqMcpServerHealth, HqPersistence, HqProjectIdentity, HqProjectRecord, HqQueuedCommand, HqRedactionPolicy, HqSessionSnapshotPayload, HqToken, HqTranscriptEntry } from '@wrongstack/core';
8
+ import type { HqBrowserMessage } from '@wrongstack/core';
9
+ export type { HqClientCapability, HqClientRecord, HqEventEnvelope, HqFleetSnapshotPayload, HqMailboxSnapshotPayload, HqMcpServerHealth, HqPersistence, HqProjectIdentity, HqProjectRecord, HqQueuedCommand, HqRedactionPolicy, HqSessionSnapshotPayload, HqToken, HqTranscriptEntry, HqBrowserMessage, };
10
+ export interface TrackedSessionSnapshot {
11
+ payload: HqSessionSnapshotPayload;
12
+ /** Epoch ms of the last `session.snapshot` refresh — freshness authority for the cleanup timer. */
13
+ receivedAt: number;
14
+ }
15
+ export interface TrackedFleetSnapshot {
16
+ payload: HqFleetSnapshotPayload;
17
+ /** Owning session, when the publisher supplied one. */
18
+ sessionId?: string;
19
+ receivedAt: number;
20
+ }
21
+ export interface ConnectedClient {
22
+ ws: WebSocket;
23
+ clientId: string;
24
+ projectId: string;
25
+ project: HqProjectIdentity;
26
+ kind: string;
27
+ connectedAt: string;
28
+ lastSeenAt: string;
29
+ hostname?: string;
30
+ pid?: number;
31
+ version?: string;
32
+ capabilities: readonly string[];
33
+ /** Auth token used for this socket; absent only in explicit open mode. */
34
+ authToken?: HqToken;
35
+ /** Client-declared privacy policy; operator overrides are clamped dynamically. */
36
+ declaredRedactionPolicy: HqRedactionPolicy;
37
+ /** Highest accepted event sequence for replay/duplicate protection. */
38
+ lastEventSeq: number;
39
+ /** Per-client mailbox snapshots, keyed by projectId:mailboxId. */
40
+ mailboxes: Map<string, HqMailboxSnapshotPayload>;
41
+ /** Stable machine identifier — used for machine-level aggregation. */
42
+ machineId?: string;
43
+ /** Per-client session snapshots (the spine of the fleet tree). */
44
+ sessions: Map<string, TrackedSessionSnapshot>;
45
+ /** Per-client coordinator fleet snapshots, keyed by runId and owned by a session when known. */
46
+ fleets: Map<string, TrackedFleetSnapshot>;
47
+ /** Per-session MCP health snapshots, keyed by sessionId. */
48
+ mcpSnapshots: Map<string, HqMcpServerHealth[]>;
49
+ /** Pending outbound commands (Phase 3 — control plane). */
50
+ commandQueue: HqQueuedCommand[];
51
+ }
52
+ export interface TranscriptRing {
53
+ entries: HqTranscriptEntry[];
54
+ machineId?: string;
55
+ }
56
+ export interface HqSnapshotBroadcaster {
57
+ currentSerialized(): string;
58
+ broadcast(): void;
59
+ close(): void;
60
+ }
61
+ export interface ProjectDetail {
62
+ generatedAt: string;
63
+ project: HqProjectRecord;
64
+ clients: readonly HqClientRecord[];
65
+ mailboxes: readonly HqMailboxSnapshotPayload[];
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hq-server/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,OAAO,EACP,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB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AiB,EAAE,CAAC,CAAC;IAC/C,2DAA2D;IAC3D,YAAY,EAAE,eAAe,EAAE,CAAC;CACjC;AAID,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,IAAI,MAAM,CAAC;IAC5B,SAAS,IAAI,IAAI,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;CACf;AAID,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,SAAS,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAChD"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * HQ server — general utility functions.
3
+ *
4
+ * @module hq-server/utils
5
+ */
6
+ import type * as http from 'node:http';
7
+ import type { HqEventEnvelope, HqPersistence, HqTranscriptEntry } from '@wrongstack/core';
8
+ export declare const TRANSCRIPT_RING_MAX = 4000;
9
+ export declare const MAX_TRANSCRIPT_SESSIONS = 400;
10
+ export declare const MAX_AGENT_RINGS = 800;
11
+ /**
12
+ * Evict oldest entries from a Map until its size ≤ max.
13
+ * Maps are insertion-ordered, so iterating keys() gives the oldest first.
14
+ */
15
+ export declare function evictOldest(map: Map<string, unknown>, max: number): void;
16
+ /**
17
+ * Ring key for one subagent's transcript. Scoped by session so same-named
18
+ * agents in different sessions (every leader is id 'leader') stay separate.
19
+ * Falls back to the bare subId when no session id is known (legacy clients).
20
+ */
21
+ export declare function agentRingKey(sessionId: string | undefined, subId: string): string;
22
+ /**
23
+ * Convert an `agent.message` payload record into a `HqTranscriptEntry` that
24
+ * is compact and viewable in the HQ session timeline. Mirrors the mapping the
25
+ * TUI-side buffered-transcript writer applies so the HQ stream looks
26
+ * identically to the live stream (thinking→thinking, system/status→system).
27
+ */
28
+ export declare function agentMessageToEntry(p: Record<string, unknown>): HqTranscriptEntry;
29
+ /**
30
+ * Read one local subagent's FULL conversation from disk. The agent monitor
31
+ * writes every timeline entry to
32
+ * <projectSessions>/<sessionId>/subagents/transcripts/<subId>/transcript.jsonl
33
+ * so for sessions on THIS machine we can serve the complete history — not
34
+ * just the ≤4000-entry live ring. Returns null when the session isn't local
35
+ * or the file is absent (caller falls back to the ring).
36
+ */
37
+ export declare function readLocalSubagentTranscript(sessionId: string, subagentId: string): Promise<HqTranscriptEntry[] | null>;
38
+ /** Safe URL-decoding — returns null on malformed input. */
39
+ export declare function decodePathSegment(value: string): string | null;
40
+ /** Normalize display host — "0.0.0.0" prints as "127.0.0.1" for user-facing URLs. */
41
+ export declare function displayHost(host: string): string;
42
+ /** Read the full body of an HTTP request as a UTF-8 string (capped at 1 MB). */
43
+ export declare function readRequestBody(req: http.IncomingMessage, maxBytes?: number): Promise<string>;
44
+ export declare function writeInvalidBody(res: http.ServerResponse, error: unknown): void;
45
+ export declare function buildHttpUrl(host: string, port: number, token?: string): string;
46
+ export declare function buildClientWsUrl(host: string, port: number, token?: string): string;
47
+ export declare function hqRuntimeMarkerPath(dataDir: string): string;
48
+ /** Non-internal IPv4 addresses, so we can print URLs reachable from other machines. */
49
+ export declare function lanIPv4Addresses(): string[];
50
+ export declare function truncateHqSummary(value: unknown, maxLength: number): string | undefined;
51
+ /**
52
+ * Stable per-machine key. Prefers hostname so the same physical computer maps
53
+ * to one machine even when clients report different per-process machineIds
54
+ * (older builds hashed `hostname:pid`). Falls back to machineId.
55
+ */
56
+ export declare function hqMachineKey(hostname: string | undefined, machineId: string | undefined): string;
57
+ /**
58
+ * Fold a cost/tool signal from an event envelope into the timeseries store.
59
+ * Recognizes `session.usage` (cost/tokens, plus model/provider/cache
60
+ * dimensions) and `tool.completed` (tool call). Best-effort, never throws.
61
+ */
62
+ export declare function recordTimeseriesSignal(persistence: HqPersistence, event: HqEventEnvelope): void;
63
+ /**
64
+ * Coerce a thrown error into a safe, opaque message for HTTP/JSON API
65
+ * responses. Raw error strings (file paths, environment details, stack
66
+ * fragments) are never forwarded to the browser — only a stable category.
67
+ * The original error is logged server-side by the caller.
68
+ */
69
+ export declare function sanitizeApiError(err: unknown): string;
70
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/hq-server/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAGvC,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAK1F,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,eAAe,MAAM,CAAC;AAInC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAMxE;AAID;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAmBjF;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,CA4BrC;AAID,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAED,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAMD,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,SAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBhG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAI/E;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAI/E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAInF;AAID,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAID,uFAAuF;AACvF,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAa3C;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIvF;AAID;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGhG;AAID;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CA+B/F;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAerD"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * HQ server — WebSocket handlers for browser and client connections.
3
+ *
4
+ * @module hq-server/ws
5
+ */
6
+ import { WebSocket } from 'ws';
7
+ import { type HqCommandAuditLog, type HqEventEnvelope, type HqPersistence, type HqRedactionPolicy, type HqToken, type HqTranscriptEntry } from '@wrongstack/core';
8
+ import type { ConnectedClient, HqSnapshotBroadcaster, TranscriptRing } from './types.js';
9
+ export declare function handleBrowser(ws: WebSocket, snapshotBroadcaster: HqSnapshotBroadcaster, browsers: Set<WebSocket>): void;
10
+ export declare function handleClient(ws: WebSocket, clients: Map<WebSocket, ConnectedClient>, browsers: Set<WebSocket>, eventLog: HqEventEnvelope[], auth: {
11
+ token?: HqToken | undefined;
12
+ getOperatorPolicy: () => Partial<HqRedactionPolicy> | undefined;
13
+ }, snapshotBroadcaster: HqSnapshotBroadcaster, transcripts: Map<string, TranscriptRing>, agentMessages: Map<string, HqTranscriptEntry[]>, persistence?: HqPersistence, auditLog?: HqCommandAuditLog): void;
14
+ //# sourceMappingURL=ws.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/hq-server/ws.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EASL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAKpB,KAAK,aAAa,EAElB,KAAK,iBAAiB,EAGtB,KAAK,OAAO,EAEZ,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmBzF,wBAAgB,aAAa,CAC3B,EAAE,EAAE,SAAS,EACb,mBAAmB,EAAE,qBAAqB,EAC1C,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,GACvB,IAAI,CAsBN;AAID,wBAAgB,YAAY,CAC1B,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,EACxC,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,EACxB,QAAQ,EAAE,eAAe,EAAE,EAC3B,IAAI,EAAE;IACJ,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,iBAAiB,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;CACjE,EACD,mBAAmB,EAAE,qBAAqB,EAC1C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACxC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAC/C,WAAW,CAAC,EAAE,aAAa,EAC3B,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,IAAI,CA+ZN"}
@@ -23,6 +23,10 @@ export interface HqServerOptions {
23
23
  clientTtlMs?: number;
24
24
  /** Stale-client scan interval. Primarily exposed for deterministic integration tests. */
25
25
  clientCleanupIntervalMs?: number;
26
+ /** Session-snapshot freshness timeout. Primarily exposed for deterministic integration tests. */
27
+ sessionSnapshotTtlMs?: number;
28
+ /** Optional browser password login. When provided on first-run, the auth file stores a scrypt hash. */
29
+ password?: string;
26
30
  }
27
31
  export interface HqStartupConnectionInfo {
28
32
  dataDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"hq-server.d.ts","sourceRoot":"","sources":["../src/hq-server.ts"],"names":[],"mappings":"AAuBA,OAAO,EAyBL,KAAK,iBAAiB,EAqBvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EA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