@wrongstack/webui-server 0.292.1 → 0.295.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 (236) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +18753 -14274
  4. package/dist/index.js.map +4 -4
  5. package/dist/protocol/client-conversation.d.ts +3 -0
  6. package/dist/protocol/client-conversation.d.ts.map +1 -0
  7. package/dist/protocol/client-integrations.d.ts +3 -0
  8. package/dist/protocol/client-integrations.d.ts.map +1 -0
  9. package/dist/protocol/client-operations.d.ts +3 -0
  10. package/dist/protocol/client-operations.d.ts.map +1 -0
  11. package/dist/protocol/client-workspace.d.ts +3 -0
  12. package/dist/protocol/client-workspace.d.ts.map +1 -0
  13. package/dist/protocol/connection-fsm.d.ts +39 -0
  14. package/dist/protocol/connection-fsm.d.ts.map +1 -0
  15. package/dist/protocol/decoder.d.ts +6 -0
  16. package/dist/protocol/decoder.d.ts.map +1 -0
  17. package/dist/protocol/index.d.ts +7 -0
  18. package/dist/protocol/index.d.ts.map +1 -0
  19. package/dist/protocol/index.js +842 -0
  20. package/dist/protocol/index.js.map +7 -0
  21. package/dist/protocol/projections.d.ts +111 -0
  22. package/dist/protocol/projections.d.ts.map +1 -0
  23. package/dist/protocol/registry.d.ts +6 -0
  24. package/dist/protocol/registry.d.ts.map +1 -0
  25. package/dist/protocol/server-conversation.d.ts +3 -0
  26. package/dist/protocol/server-conversation.d.ts.map +1 -0
  27. package/dist/protocol/server-integrations.d.ts +3 -0
  28. package/dist/protocol/server-integrations.d.ts.map +1 -0
  29. package/dist/protocol/server-operations.d.ts +4 -0
  30. package/dist/protocol/server-operations.d.ts.map +1 -0
  31. package/dist/protocol/server-workspace.d.ts +3 -0
  32. package/dist/protocol/server-workspace.d.ts.map +1 -0
  33. package/dist/protocol/types.d.ts +24 -0
  34. package/dist/protocol/types.d.ts.map +1 -0
  35. package/dist/protocol/version.d.ts +20 -0
  36. package/dist/protocol/version.d.ts.map +1 -0
  37. package/dist/server/agent-roster-handlers.d.ts +27 -0
  38. package/dist/server/agent-roster-handlers.d.ts.map +1 -0
  39. package/dist/server/agent-roster-routes.d.ts +8 -0
  40. package/dist/server/agent-roster-routes.d.ts.map +1 -0
  41. package/dist/server/autonomy-routes.d.ts +9 -0
  42. package/dist/server/autonomy-routes.d.ts.map +1 -0
  43. package/dist/server/backend-services.d.ts +19 -6
  44. package/dist/server/backend-services.d.ts.map +1 -1
  45. package/dist/server/boot.d.ts +4 -1
  46. package/dist/server/boot.d.ts.map +1 -1
  47. package/dist/server/brain-handlers.d.ts +47 -0
  48. package/dist/server/brain-handlers.d.ts.map +1 -0
  49. package/dist/server/chronicle-routes.d.ts +12 -0
  50. package/dist/server/chronicle-routes.d.ts.map +1 -0
  51. package/dist/server/client-presence.d.ts +26 -0
  52. package/dist/server/client-presence.d.ts.map +1 -0
  53. package/dist/server/client-transport-routes.d.ts +8 -0
  54. package/dist/server/client-transport-routes.d.ts.map +1 -0
  55. package/dist/server/codebase-indexing.d.ts +3 -1
  56. package/dist/server/codebase-indexing.d.ts.map +1 -1
  57. package/dist/server/codemap-telemetry.d.ts.map +1 -1
  58. package/dist/server/collaboration-ws-handler.d.ts +3 -1
  59. package/dist/server/collaboration-ws-handler.d.ts.map +1 -1
  60. package/dist/server/completion-handlers.d.ts +2 -1
  61. package/dist/server/completion-handlers.d.ts.map +1 -1
  62. package/dist/server/completion-routes.d.ts +7 -0
  63. package/dist/server/completion-routes.d.ts.map +1 -0
  64. package/dist/server/config-doctor.d.ts +11 -0
  65. package/dist/server/config-doctor.d.ts.map +1 -0
  66. package/dist/server/connection-handler.d.ts +8 -46
  67. package/dist/server/connection-handler.d.ts.map +1 -1
  68. package/dist/server/connection-lifecycle.d.ts +43 -0
  69. package/dist/server/connection-lifecycle.d.ts.map +1 -0
  70. package/dist/server/content-routes.d.ts +15 -0
  71. package/dist/server/content-routes.d.ts.map +1 -0
  72. package/dist/server/conversation-operations.d.ts +28 -0
  73. package/dist/server/conversation-operations.d.ts.map +1 -0
  74. package/dist/server/conversation-routes.d.ts +10 -0
  75. package/dist/server/conversation-routes.d.ts.map +1 -0
  76. package/dist/server/custom-context-modes.d.ts +1 -1
  77. package/dist/server/custom-context-modes.d.ts.map +1 -1
  78. package/dist/server/design-handlers.d.ts +8 -0
  79. package/dist/server/design-handlers.d.ts.map +1 -1
  80. package/dist/server/discover-mailbox-bridge.d.ts.map +1 -1
  81. package/dist/server/embedded-host-adapters.d.ts +96 -0
  82. package/dist/server/embedded-host-adapters.d.ts.map +1 -0
  83. package/dist/server/embedded-lifecycle.d.ts +113 -0
  84. package/dist/server/embedded-lifecycle.d.ts.map +1 -0
  85. package/dist/server/embedded-message-router.d.ts +64 -0
  86. package/dist/server/embedded-message-router.d.ts.map +1 -0
  87. package/dist/server/entry.js +16641 -14023
  88. package/dist/server/entry.js.map +4 -4
  89. package/dist/server/eternal-iteration-broadcast.d.ts +1 -1
  90. package/dist/server/eternal-iteration-broadcast.d.ts.map +1 -1
  91. package/dist/server/file-handlers.d.ts.map +1 -1
  92. package/dist/server/frontend-static-serve.d.ts +133 -0
  93. package/dist/server/frontend-static-serve.d.ts.map +1 -0
  94. package/dist/server/git-process.d.ts +4 -0
  95. package/dist/server/git-process.d.ts.map +1 -0
  96. package/dist/server/goal-snapshot-routes.d.ts +7 -0
  97. package/dist/server/goal-snapshot-routes.d.ts.map +1 -0
  98. package/dist/server/goal-ws-handler.d.ts +3 -1
  99. package/dist/server/goal-ws-handler.d.ts.map +1 -1
  100. package/dist/server/handlers/worklist-handlers.d.ts +14 -20
  101. package/dist/server/handlers/worklist-handlers.d.ts.map +1 -1
  102. package/dist/server/handlers.js +150 -121
  103. package/dist/server/handlers.js.map +3 -3
  104. package/dist/server/host-routes.d.ts +7 -0
  105. package/dist/server/host-routes.d.ts.map +1 -0
  106. package/dist/server/http-server/analytics-handler.d.ts +2 -0
  107. package/dist/server/http-server/analytics-handler.d.ts.map +1 -1
  108. package/dist/server/http-server/api-handlers.d.ts.map +1 -1
  109. package/dist/server/http-server.d.ts +20 -23
  110. package/dist/server/http-server.d.ts.map +1 -1
  111. package/dist/server/index.d.ts +55 -22
  112. package/dist/server/index.d.ts.map +1 -1
  113. package/dist/server/instance-registry.d.ts +1 -3
  114. package/dist/server/instance-registry.d.ts.map +1 -1
  115. package/dist/server/introspection-routes.d.ts +19 -0
  116. package/dist/server/introspection-routes.d.ts.map +1 -0
  117. package/dist/server/kanban-dispatch.d.ts +41 -0
  118. package/dist/server/kanban-dispatch.d.ts.map +1 -0
  119. package/dist/server/kanban-host-routes.d.ts +10 -0
  120. package/dist/server/kanban-host-routes.d.ts.map +1 -0
  121. package/dist/server/kanban-routes.d.ts +5 -3
  122. package/dist/server/kanban-routes.d.ts.map +1 -1
  123. package/dist/server/kanban-run-mirror.d.ts +76 -0
  124. package/dist/server/kanban-run-mirror.d.ts.map +1 -0
  125. package/dist/server/kanban-supervisor.d.ts +47 -0
  126. package/dist/server/kanban-supervisor.d.ts.map +1 -0
  127. package/dist/server/mailbox-handlers.d.ts +12 -4
  128. package/dist/server/mailbox-handlers.d.ts.map +1 -1
  129. package/dist/server/mailbox-routes.d.ts +8 -0
  130. package/dist/server/mailbox-routes.d.ts.map +1 -1
  131. package/dist/server/mcp-handlers.d.ts +4 -0
  132. package/dist/server/mcp-handlers.d.ts.map +1 -1
  133. package/dist/server/memory-handlers.d.ts +54 -46
  134. package/dist/server/memory-handlers.d.ts.map +1 -1
  135. package/dist/server/memory-routes.d.ts +11 -0
  136. package/dist/server/memory-routes.d.ts.map +1 -0
  137. package/dist/server/message-dispatcher.d.ts +3 -4
  138. package/dist/server/message-dispatcher.d.ts.map +1 -1
  139. package/dist/server/mode-handlers.d.ts +6 -15
  140. package/dist/server/mode-handlers.d.ts.map +1 -1
  141. package/dist/server/mode-operations.d.ts +24 -0
  142. package/dist/server/mode-operations.d.ts.map +1 -0
  143. package/dist/server/mode-routes.d.ts +2 -0
  144. package/dist/server/mode-routes.d.ts.map +1 -1
  145. package/dist/server/model-auto-discovery.d.ts +1 -1
  146. package/dist/server/model-auto-discovery.d.ts.map +1 -1
  147. package/dist/server/model-catalog.d.ts +1 -1
  148. package/dist/server/model-catalog.d.ts.map +1 -1
  149. package/dist/server/model-operations.d.ts +29 -0
  150. package/dist/server/model-operations.d.ts.map +1 -0
  151. package/dist/server/path-containment.d.ts.map +1 -1
  152. package/dist/server/port-utils.d.ts +18 -25
  153. package/dist/server/port-utils.d.ts.map +1 -1
  154. package/dist/server/pre-context-services.d.ts +32 -5
  155. package/dist/server/pre-context-services.d.ts.map +1 -1
  156. package/dist/server/pref-helpers.d.ts +2 -4
  157. package/dist/server/pref-helpers.d.ts.map +1 -1
  158. package/dist/server/prefs-handlers.d.ts +22 -0
  159. package/dist/server/prefs-handlers.d.ts.map +1 -0
  160. package/dist/server/prefs-routes.d.ts +5 -0
  161. package/dist/server/prefs-routes.d.ts.map +1 -1
  162. package/dist/server/privileged-actions.d.ts +16 -0
  163. package/dist/server/privileged-actions.d.ts.map +1 -0
  164. package/dist/server/process-handlers.d.ts +8 -6
  165. package/dist/server/process-handlers.d.ts.map +1 -1
  166. package/dist/server/process-routes.d.ts +9 -0
  167. package/dist/server/process-routes.d.ts.map +1 -0
  168. package/dist/server/project-handlers.d.ts +25 -33
  169. package/dist/server/project-handlers.d.ts.map +1 -1
  170. package/dist/server/projects-manifest.d.ts +8 -0
  171. package/dist/server/projects-manifest.d.ts.map +1 -1
  172. package/dist/server/prompts-handlers.d.ts +2 -1
  173. package/dist/server/prompts-handlers.d.ts.map +1 -1
  174. package/dist/server/provider-config-io.d.ts +2 -2
  175. package/dist/server/provider-config-io.d.ts.map +1 -1
  176. package/dist/server/provider-config-standalone.d.ts +5 -3
  177. package/dist/server/provider-config-standalone.d.ts.map +1 -1
  178. package/dist/server/provider-handlers.d.ts +63 -6
  179. package/dist/server/provider-handlers.d.ts.map +1 -1
  180. package/dist/server/provider-keys.d.ts +1 -1
  181. package/dist/server/provider-keys.d.ts.map +1 -1
  182. package/dist/server/provider-routes.d.ts +28 -2
  183. package/dist/server/provider-routes.d.ts.map +1 -1
  184. package/dist/server/provider-store.d.ts +5 -4
  185. package/dist/server/provider-store.d.ts.map +1 -1
  186. package/dist/server/route-family-dispatcher.d.ts +71 -0
  187. package/dist/server/route-family-dispatcher.d.ts.map +1 -0
  188. package/dist/server/routes.d.ts +17 -7
  189. package/dist/server/routes.d.ts.map +1 -1
  190. package/dist/server/sdd-board-ws-handler.d.ts +5 -1
  191. package/dist/server/sdd-board-ws-handler.d.ts.map +1 -1
  192. package/dist/server/sdd-wizard-wiring.d.ts +8 -3
  193. package/dist/server/sdd-wizard-wiring.d.ts.map +1 -1
  194. package/dist/server/sdd-wizard-ws-handler.d.ts.map +1 -1
  195. package/dist/server/server-runtime.d.ts +16 -12
  196. package/dist/server/server-runtime.d.ts.map +1 -1
  197. package/dist/server/session-handlers.d.ts +30 -11
  198. package/dist/server/session-handlers.d.ts.map +1 -1
  199. package/dist/server/session-history.d.ts +1 -1
  200. package/dist/server/session-history.d.ts.map +1 -1
  201. package/dist/server/setup-event-projection.d.ts +10 -0
  202. package/dist/server/setup-event-projection.d.ts.map +1 -0
  203. package/dist/server/setup-events-watcher.d.ts +13 -0
  204. package/dist/server/setup-events-watcher.d.ts.map +1 -0
  205. package/dist/server/setup-events.d.ts +11 -21
  206. package/dist/server/setup-events.d.ts.map +1 -1
  207. package/dist/server/setup-screen.d.ts +2 -1
  208. package/dist/server/setup-screen.d.ts.map +1 -1
  209. package/dist/server/shell-open.d.ts +26 -2
  210. package/dist/server/shell-open.d.ts.map +1 -1
  211. package/dist/server/skills-handlers.d.ts +2 -2
  212. package/dist/server/skills-handlers.d.ts.map +1 -1
  213. package/dist/server/specs-ws-handler.d.ts.map +1 -1
  214. package/dist/server/standalone-session-identity.d.ts +3 -2
  215. package/dist/server/standalone-session-identity.d.ts.map +1 -1
  216. package/dist/server/start-webui.d.ts +9 -1
  217. package/dist/server/start-webui.d.ts.map +1 -1
  218. package/dist/server/stream-coalescer.d.ts +49 -0
  219. package/dist/server/stream-coalescer.d.ts.map +1 -0
  220. package/dist/server/techstack-handlers.d.ts +12 -2
  221. package/dist/server/techstack-handlers.d.ts.map +1 -1
  222. package/dist/server/terminal-ws-handler.d.ts +5 -3
  223. package/dist/server/terminal-ws-handler.d.ts.map +1 -1
  224. package/dist/server/types.d.ts +10 -3
  225. package/dist/server/types.d.ts.map +1 -1
  226. package/dist/server/worklist-routes.d.ts +21 -0
  227. package/dist/server/worklist-routes.d.ts.map +1 -0
  228. package/dist/server/worktree-routes.d.ts +10 -0
  229. package/dist/server/worktree-routes.d.ts.map +1 -0
  230. package/dist/server/worktree-ws-handler.d.ts +2 -1
  231. package/dist/server/worktree-ws-handler.d.ts.map +1 -1
  232. package/dist/server/ws-payload-validation.d.ts +11 -0
  233. package/dist/server/ws-payload-validation.d.ts.map +1 -1
  234. package/dist/server/ws-utils.d.ts +8 -0
  235. package/dist/server/ws-utils.d.ts.map +1 -1
  236. package/package.json +14 -10
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import type { WebSocket } from 'ws';
20
20
  import type { PendingConfirm } from './pending-confirms.js';
21
- import type { AllRoutes, WebuiCallbacks, WebuiDeps, WebuiMutableState } from './routes.js';
21
+ import type { AllRoutes, WebuiDeps, WebuiMutableState } from './routes.js';
22
22
  import type { ConnectedClient, WSClientMessage } from './types.js';
23
23
  /**
24
24
  * Shared run-lock control. `user_message` acquires/releases it around
@@ -33,7 +33,6 @@ interface RunLockControl {
33
33
  interface MessageDispatcherOptions {
34
34
  state: WebuiMutableState;
35
35
  deps: WebuiDeps;
36
- cb: WebuiCallbacks;
37
36
  routes: AllRoutes;
38
37
  /** Prompt-library context ({ promptLoader, promptUsage }). */
39
38
  promptsCtx: {
@@ -52,8 +51,8 @@ interface MessageDispatcherOptions {
52
51
  /**
53
52
  * Build the inbound message dispatcher. Mirrors the `handleMessage` closure
54
53
  * that lived inline in `startWebUI`. Reads live config/session/projectRoot
55
- * through `state`, services through `deps`, and the boot-local closures
56
- * through `cb` — same reference semantics, no behaviour change.
54
+ * through `state` and services through `deps` same reference semantics,
55
+ * no behaviour change.
57
56
  */
58
57
  export declare function createMessageDispatcher(opts: MessageDispatcherOptions): (ws: WebSocket, _client: ConnectedClient, msg: WSClientMessage) => Promise<void>;
59
58
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"message-dispatcher.d.ts","sourceRoot":"","sources":["../../src/server/message-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAuBH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AA2CpC,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAc7E,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgB3F,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKnE;;;;;GAKG;AACH,UAAU,cAAc;IACtB,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;CACzC;AACD,UAAU,wBAAwB;IAChC,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,8DAA8D;IAC9D,UAAU,EAAE;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5D,6EAA6E;IAC7E,gBAAgB,EAAE;QAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;IAChE,6DAA6D;IAC7D,OAAO,EAAE,cAAc,CAAC;IACxB,2EAA2E;IAC3E,eAAe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;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,wBAAwB,GAC7B,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CA6PlF"}
@@ -1,16 +1,9 @@
1
- /**
2
- * Mode route handlers — extracted from the startWebUI closure in index.ts.
3
- * Mirrors createProviderHandlers: a factory that closes the handler bodies over
4
- * an explicit context object instead of the giant startWebUI scope. The one
5
- * piece of outer mutable state (the `modeId` let) is threaded in as a setter so
6
- * the factory stays a pure function of its context.
7
- */
1
+ import { DefaultSystemPromptBuilder, type Context } from '@wrongstack/core/agent';
2
+ import type { DefaultModeStore } from '@wrongstack/core/models';
3
+ import type { ToolRegistry } from '@wrongstack/core/registry';
4
+ import type { MemoryPort, SkillLoader } from '@wrongstack/core/types';
8
5
  import type { WebSocket } from 'ws';
9
- import { type Context, DefaultSystemPromptBuilder, type MemoryStore, type DefaultModeStore, type SkillLoader, type ToolRegistry } from '@wrongstack/core';
10
6
  import type { ConnectedClient } from './types.js';
11
- import type { ModeRouteHandlers } from './mode-routes.js';
12
- /** The rich payload startWebUI's sessionStartPayload() resolves to. Matches the
13
- * WSSessionStart wire shape; broadcast() accepts it for a 'session.start' msg. */
14
7
  type SessionStartPayload = {
15
8
  sessionId: string;
16
9
  model: string;
@@ -28,7 +21,7 @@ type SessionStartPayload = {
28
21
  type ModelCapabilities = NonNullable<ConstructorParameters<typeof DefaultSystemPromptBuilder>[0]>['modelCapabilities'];
29
22
  export interface ModeHandlersContext {
30
23
  modeStore: DefaultModeStore;
31
- memoryStore: MemoryStore;
24
+ memoryStore: MemoryPort;
32
25
  skillLoader: SkillLoader | undefined;
33
26
  modelCapabilities: ModelCapabilities;
34
27
  context: Context;
@@ -40,11 +33,9 @@ export interface ModeHandlersContext {
40
33
  projectRoot: string;
41
34
  globalRoot: string;
42
35
  clients: Map<WebSocket, ConnectedClient>;
43
- /** Update the outer `modeId` binding on a successful switch. */
44
36
  setModeId: (id: string) => void;
45
- /** Rebuilds the rich session.start payload broadcast after a mode switch. */
46
37
  sessionStartPayload: () => Promise<SessionStartPayload>;
47
38
  }
48
- export declare function createModeHandlers(ctx: ModeHandlersContext): ModeRouteHandlers;
39
+ export declare function createModeHandlers(context: ModeHandlersContext): import("./mode-routes.js").ModeRouteHandlers;
49
40
  export {};
50
41
  //# sourceMappingURL=mode-handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mode-handlers.d.ts","sourceRoot":"","sources":["../../src/server/mode-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EACL,KAAK,OAAO,EACZ,0BAA0B,EAE1B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI1D;mFACmF;AACnF,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AACF,KAAK,iBAAiB,GAAG,WAAW,CAClC,qBAAqB,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC,mBAAm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,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AACF,KAAK,iBAAiB,GAAG,WAAW,CAClC,qBAAqB,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC,mBAAmB,CAAC,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACzC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,mBAAmB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,gDAuC9D"}
@@ -0,0 +1,24 @@
1
+ import type { ModeStore } from '@wrongstack/core/types';
2
+ import type { WebSocket } from 'ws';
3
+ import type { WSServerMessage } from './types.js';
4
+ interface ModeSession {
5
+ append(event: {
6
+ type: 'mode_changed';
7
+ ts: string;
8
+ from: string;
9
+ to: string;
10
+ }): Promise<unknown>;
11
+ }
12
+ export interface ModeOperationsContext {
13
+ modeStore?: ModeStore | undefined;
14
+ getSession?: (() => ModeSession | null | undefined) | undefined;
15
+ applyModeId: (id: string) => void;
16
+ afterSwitch?: ((id: string) => void | Promise<void>) | undefined;
17
+ send: (ws: WebSocket, message: WSServerMessage) => void;
18
+ }
19
+ export declare function createModeOperations(context: ModeOperationsContext): {
20
+ listModes(ws: WebSocket): Promise<void>;
21
+ switchMode(ws: WebSocket, id: string): Promise<void>;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=mode-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mode-operations.d.ts","sourceRoot":"","sources":["../../src/server/mode-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,UAAU,WAAW;IACnB,MAAM,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjG;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAChE,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACjE,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CACzD;AAWD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB;IAEzD,SAAS,KAAK,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BvC,UAAU,KAAK,SAAS,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;EAkC7D"}
@@ -1,8 +1,10 @@
1
1
  import type { WebSocket } from 'ws';
2
+ import { type ModeOperationsContext } from './mode-operations.js';
2
3
  import type { WSClientMessage } from './types.js';
3
4
  export interface ModeRouteHandlers {
4
5
  listModes: (ws: WebSocket) => Promise<void>;
5
6
  switchMode: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
6
7
  }
8
+ export declare function createModeRouteHandlers(context: ModeOperationsContext): ModeRouteHandlers;
7
9
  export declare function handleModeRoute(ws: WebSocket, msg: WSClientMessage, handlers: ModeRouteHandlers): Promise<boolean>;
8
10
  //# sourceMappingURL=mode-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mode-routes.d.ts","sourceRoot":"","sources":["../../src/server/mode-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,wBAAsB,eAAe,CACnC,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAWlB"}
1
+ {"version":3,"file":"mode-routes.d.ts","sourceRoot":"","sources":["../../src/server/mode-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAgBzF;AAED,wBAAsB,eAAe,CACnC,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAWlB"}
@@ -1,4 +1,4 @@
1
- import type { Config, Logger } from '@wrongstack/core';
1
+ import type { Config, Logger } from '@wrongstack/core/types';
2
2
  export declare function discoverAndMergeWebuiProviders(opts: {
3
3
  config: Config;
4
4
  registry: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"model-auto-discovery.d.ts","sourceRoot":"","sources":["../../src/server/model-auto-discovery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAIP,MAAM,kBAAkB,CAAC;AAmD1B,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAC7D,SAAS,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;CACtC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDhB"}
1
+ {"version":3,"file":"model-auto-discovery.d.ts","sourceRoot":"","sources":["../../src/server/model-auto-discovery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAIP,MAAM,wBAAwB,CAAC;AAmDhC,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAC7D,SAAS,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;CACtC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDhB"}
@@ -1,4 +1,4 @@
1
- import type { ModelsRegistry, ProviderConfig, ResolvedModel, ResolvedProvider } from '@wrongstack/core';
1
+ import type { ModelsRegistry, ProviderConfig, ResolvedModel, ResolvedProvider } from '@wrongstack/core/types';
2
2
  export declare const SIBLING_CATALOG: Record<string, string>;
3
3
  /**
4
4
  * Resolve the catalog entry to use for a saved provider's WebUI model list.
@@ -1 +1 @@
1
- {"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../src/server/model-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIlD,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,+BAA+B,CACnD,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EACnD,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,SAAS,GAC5C,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,C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,CAuCpC"}
@@ -0,0 +1,29 @@
1
+ import type { Context } from '@wrongstack/core/agent';
2
+ import type { Config, MemoryPort, ModelsRegistry, Provider, ProviderConfig } from '@wrongstack/core/types';
3
+ import type { WebSocket } from 'ws';
4
+ import type { WSServerMessage } from './types.js';
5
+ export interface ModelRefinePayload {
6
+ text: string;
7
+ timeoutMs?: number | undefined;
8
+ provider?: string | undefined;
9
+ model?: string | undefined;
10
+ previousRefined?: string | undefined;
11
+ previousEnglish?: string | undefined;
12
+ retryFeedback?: string | undefined;
13
+ }
14
+ export interface ModelOperationsContext {
15
+ context: Context;
16
+ memoryStore?: MemoryPort | undefined;
17
+ modelsRegistry?: ModelsRegistry | undefined;
18
+ getConfig: () => Config | undefined;
19
+ getLiveProviderId: () => string;
20
+ buildProvider: (providerId: string, config: ProviderConfig) => Provider | Promise<Provider>;
21
+ applyModelSwitch: (providerId: string, modelId: string) => Promise<void>;
22
+ send: (ws: WebSocket, message: WSServerMessage) => void;
23
+ log?: ((message: string) => void) | undefined;
24
+ }
25
+ export declare function createModelOperations(context: ModelOperationsContext): {
26
+ switchModel: (ws: WebSocket, input: unknown) => Promise<void>;
27
+ refineModel: (ws: WebSocket, payload: ModelRefinePayload) => Promise<void>;
28
+ };
29
+ //# sourceMappingURL=model-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-operations.d.ts","sourceRoot":"","sources":["../../src/server/model-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,QAAQ,EACR,cAAc,EACf,MAAM,wBAAwB,CAAC;AAWhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS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AE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED,wBAAsB,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC5G"}
1
+ {"version":3,"file":"path-containment.d.ts","sourceRoot":"","sources":["../../src/server/path-containment.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED,wBAAsB,8BAA8B,CAClD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAyCjB"}
@@ -1,54 +1,47 @@
1
1
  /**
2
- * Free-port discovery for the WebUI / SimpleUI servers.
2
+ * Port constants for the WebUI / SimpleUI servers.
3
3
  *
4
4
  * Design:
5
- * - **Surface-aware port ranges.** WebUI defaults to 3456 (HTTP) / 3457 (WS);
6
- * SimpleUI defaults to 3466 / 3467. These ranges are disjoint, so a WebUI
7
- * instance never accidentally claims a SimpleUI slot and vice versa.
8
- * - **Auto-advance.** When a port is taken, the server probes upward and binds
9
- * the first free one (see `findFreePort`). The actual port is stamped into
10
- * the served HTML and the instance registry so the user sees the real URL.
5
+ * - **Single port shared HTTP + WebSocket.** The WebSocket server attaches
6
+ * to the HTTP server (`new WebSocketServer({ server: httpServer })`), so
7
+ * both protocols share one port. No separate WS port is needed.
8
+ * - **Auto-advance.** When a port is taken the server probes upward WebUI
9
+ * starts at 3456, SimpleUI at 3466. Set `WEBUI_STRICT_PORT=1` to disable.
10
+ * - **TOCTOU window.** The probe in `findFreePort` binds a throwaway
11
+ * `net.Server` then closes it, so there is a tiny race between "found free"
12
+ * and "real server binds". For local multi-instance use that race is
13
+ * negligible; if it ever loses, the real bind fails loudly with EADDRINUSE
14
+ * exactly as before.
11
15
  * - **Instance registry.** Every live process records itself in
12
- * `~/.wrongstack/webui-instances.json` with its PID, surface, ports, and
16
+ * `~/.wrongstack/webui-instances.json` with its PID, surface, port, and
13
17
  * project root. A crashed instance is pruned on the next registry read
14
18
  * (`process.kill(pid, 0)` probe), so ghosts don't accumulate.
15
- * - **TOCTOU window.** The probe binds a throwaway `net.Server` then closes
16
- * it, so there is a tiny race between "found free" and "real server binds".
17
- * For local multi-instance use that race is negligible; if it ever loses,
18
- * the real bind fails loudly with EADDRINUSE exactly as before.
19
19
  */
20
20
  /**
21
- * Surface-specific default port ranges.
21
+ * Surface-specific default single port.
22
22
  *
23
- * These bases are intentionally spaced so the auto-advance window of one
24
- * surface (typically a few ports up) never reaches the other surface's base:
23
+ * WebSocket shares the HTTP port (single-port design), so only one port
24
+ * number is specified per surface:
25
25
  *
26
- * WebUI: HTTP 3456-3465, WS 3457-3466 (10-port window)
27
- * SimpleUI: HTTP 3466-3475, WS 3467-3476 (10-port window)
28
- *
29
- * This keeps the ranges visually distinct and prevents accidental overlap
30
- * when both surfaces run multiple instances in the same project.
26
+ * WebUI: 3456
27
+ * SimpleUI: 3466
31
28
  */
32
29
  export declare const SURFACE_DEFAULT_PORTS: {
33
30
  readonly webui: {
34
31
  readonly http: 3456;
35
- readonly ws: 3457;
36
32
  };
37
33
  readonly simpleui: {
38
34
  readonly http: 3466;
39
- readonly ws: 3467;
40
35
  };
41
36
  };
42
37
  export type SurfaceKind = keyof typeof SURFACE_DEFAULT_PORTS;
43
38
  /** Human-readable label for surfaces. */
44
39
  export declare function surfaceLabel(surface: SurfaceKind): string;
45
40
  /**
46
- * Return the surface-specific default port pair (HTTP + WS).
47
- * Freezes the returned object so callers can't mutate the constant table.
41
+ * Return the surface-specific default HTTP port.
48
42
  */
49
43
  export declare function getSurfaceDefaultPorts(surface: SurfaceKind): {
50
44
  http: number;
51
- ws: number;
52
45
  };
53
46
  /** Resolve true when `port` can be bound on `host`, false on EADDRINUSE/EACCES. */
54
47
  export declare function isPortFree(host: string, port: number): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"port-utils.d.ts","sourceRoot":"","sources":["../../src/server/port-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;;iBACrB,IAAI,EAAE,IAAI;iBAAE,EAAE,EAAE,IAAI;;;iBACnB,IAAI,EAAE,IAAI;iBAAE,EAAE,EAAE,IAAI;;CAC+B,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAE7D,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAEA;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAavE;AAED,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
1
+ {"version":3,"file":"port-utils.d.ts","sourceRoot":"","sources":["../../src/server/port-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;iBACrB,IAAI,EAAE,IAAI;;;iBACT,IAAI,EAAE,IAAI;;CAC6B,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAE7D,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd,CAEA;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAavE;AAED,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
@@ -1,10 +1,37 @@
1
- import type { Config, Logger, MemoryStore } from '@wrongstack/core';
1
+ /**
2
+ * Pre-context backend service construction for the standalone WebUI server.
3
+ *
4
+ * Phase 1f of the god-module split. `startWebUI` previously inlined ~370
5
+ * lines of construction that runs BEFORE `context` exists: modelsRegistry,
6
+ * container, providerRegistry, toolRegistry (+ memory/mailbox tools),
7
+ * MCPRegistry, sessionStore, session, sessionReader, annotationsStore,
8
+ * cross-surface discovery (session registry + fleet notifier + HQ
9
+ * telemetry), tokenCounter, modeStore, customModeStore, skillInstaller,
10
+ * promptLoader, systemPromptBuilder, systemPrompt, provider resolution,
11
+ * and context creation + meta seeding.
12
+ *
13
+ * All of that moves into `createPreContextServices()`. The block is deeply
14
+ * interleaved with the `opts.services?` injection contract (5 injection
15
+ * points) and mutable `let` bindings the route layer swaps at runtime
16
+ * (session, sessionStore, sessionStartedAt, modeId). The factory returns
17
+ * all of these; `startWebUI` keeps the mutable bindings and wraps them
18
+ * into the `state` object exactly as before.
19
+ *
20
+ * No behaviour change.
21
+ */
22
+ import { Context } from '@wrongstack/core/agent';
23
+ import { DefaultPromptLoader, DefaultSkillLoader } from '@wrongstack/core/execution';
24
+ import { Container, EventBus } from '@wrongstack/core/kernel';
2
25
  import { DefaultTokenCounter } from '@wrongstack/core/infrastructure';
3
- import { type AgentStatusTracker, AnnotationsStore, DefaultModeStore, DefaultPromptLoader, DefaultSessionReader, DefaultSessionStore, DefaultSkillLoader, EventBus, PromptUsageStore, ProviderRegistry, SkillInstaller, ToolRegistry, Context, type Container, type ConfigStore, type ModelsRegistry, type Provider, type SecretVault, type SessionStore } from '@wrongstack/core';
4
- import type { WstackPaths } from '@wrongstack/core/utils';
5
- import type { WebUIOptions } from './types.js';
26
+ import { DefaultModeStore } from '@wrongstack/core/models';
27
+ import { ProviderRegistry, ToolRegistry } from '@wrongstack/core/registry';
28
+ import { SkillInstaller } from '@wrongstack/core/skills';
29
+ import { type AgentStatusTracker, AnnotationsStore, DefaultSessionReader, DefaultSessionStore, PromptUsageStore } from '@wrongstack/core/storage';
30
+ import { type Config, type ConfigStore, type Logger, type MemoryPort, type ModelsRegistry, type Provider, type SecretVault, type SessionStore } from '@wrongstack/core/types';
31
+ import { type WstackPaths } from '@wrongstack/core/utils';
6
32
  import type { CustomModeStore } from './custom-context-modes.js';
7
33
  import { type StandaloneSessionIdentityLifecycle } from './standalone-session-identity.js';
34
+ import type { WebUIOptions } from './types.js';
8
35
  interface PreContextServicesInput {
9
36
  config: Config;
10
37
  wpaths: WstackPaths;
@@ -24,7 +51,7 @@ interface PreContextServices {
24
51
  configStore: ConfigStore;
25
52
  providerRegistry: ProviderRegistry;
26
53
  toolRegistry: ToolRegistry;
27
- memoryStore: MemoryStore;
54
+ memoryStore: MemoryPort;
28
55
  events: EventBus;
29
56
  mcpRegistry: import('@wrongstack/mcp').MCPRegistry;
30
57
  sessionStore: SessionStore;
@@ -1 +1 @@
1
- {"version":3,"file":"pre-context-services.d.ts","sourceRoot":"","sources":["../../src/server/pre-context-services.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACL,KAAK,kBAAkB,EACvB,gBAAgB,EAGhB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAElB,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EAEd,YAAY,EACZ,OAAO,EAUP,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AA0B1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,kCAAkC,CAAC;AAK1C,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,UAAU,kBAAkB;IAC1B,cAAc,EAAE,c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;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAiW7B"}
@@ -15,12 +15,10 @@
15
15
  * two take explicit args. No behaviour change — the mutation ladder,
16
16
  * the FEATURE_MAP, and the touch-flags are preserved verbatim.
17
17
  */
18
- import type { SecretVault } from '@wrongstack/core';
18
+ import type { SecretVault } from '@wrongstack/core/types';
19
19
  /** Pref keys exposed to the settings panel via prefs.get / prefs.updated. */
20
- export declare const PREF_KEYS: readonly ['autonomy', 'autonomyDelayMs', 'autoProceedMaxIterations', 'yolo', 'maxIterations', 'chime', 'confirmExit', 'streamFleet', 'nextPrediction', 'enhanceEnabled', 'enhanceDelayMs', 'enhanceLanguage', 'featureMcp', 'featurePlugins', 'featureMemory', 'featureSkills', 'featureModelsRegistry', 'indexOnStart', 'contextAutoCompact', 'contextStrategy', 'contextMode', 'tokenSavingTier', 'maxConcurrent', 'titleAnimation', 'uiLocale', 'logLevel', 'auditLevel', 'hqEnabled', 'hqUrl', 'hqToken', 'hqRawContent', 'tgConfigured', 'tgSessionEnd', 'tgDelegate', 'tgLongToolMs', 'reasoningMode', 'reasoningEffort', 'reasoningPreserve', 'cacheTtl', 'fallbackModels', 'fallbackProfiles', 'favoriteModels', 'favoriteModelsOnly', 'modelAvailabilitySchedule', 'modelMatrix', 'fallbackAuto', 'refinerProvider', 'refinerModel', 'refinerFallbackProfile', 'thinkingWord', 'statuslineMode', 'animationStyle', 'showModelReasoning', 'breakerEnabled', 'breakerAutoKillResetMs', 'fsAccess', 'debugStream', 'chimeraEnabled', 'chimeraProvider', 'chimeraModel', 'chimeraMaxFiles', 'chimeraAutoFix', 'autoReviewEnabled', 'autoReviewProvider', 'autoReviewModel', 'autoReviewFallbackProfile', 'autoReviewFallbackModels', 'autoReviewDebounceMs', 'autoReviewMaxFilesPerBatch', 'autoReviewMaxConcurrentReviews', 'autoReviewCascadeOn', 'pluginsEnabled'];
20
+ export declare const PREF_KEYS: readonly ['autonomy', 'autonomyDelayMs', 'autoProceedMaxIterations', 'yolo', 'maxIterations', 'chime', 'confirmExit', 'nextPrediction', 'enhanceEnabled', 'enhanceDelayMs', 'enhanceLanguage', 'featureMcp', 'featurePlugins', 'featureMemory', 'featureSkills', 'featureModelsRegistry', 'indexOnStart', 'contextAutoCompact', 'contextStrategy', 'contextMode', 'tokenSavingTier', 'maxConcurrent', 'titleAnimation', 'uiLocale', 'logLevel', 'auditLevel', 'hqEnabled', 'hqUrl', 'hqToken', 'hqRawContent', 'tgConfigured', 'tgSessionEnd', 'tgDelegate', 'tgLongToolMs', 'reasoningMode', 'reasoningEffort', 'reasoningPreserve', 'cacheTtl', 'fallbackModels', 'fallbackProfiles', 'favoriteModels', 'favoriteModelsOnly', 'modelAvailabilitySchedule', 'modelMatrix', 'fallbackAuto', 'refinerProvider', 'refinerModel', 'refinerFallbackProfile', 'thinkingWord', 'statuslineMode', 'animationStyle', 'showModelReasoning', 'breakerEnabled', 'breakerAutoKillResetMs', 'fsAccess', 'debugStream', 'chimeraEnabled', 'chimeraProvider', 'chimeraModel', 'chimeraMaxFiles', 'chimeraAutoFix', 'autoReviewEnabled', 'autoReviewProvider', 'autoReviewModel', 'autoReviewFallbackProfile', 'autoReviewFallbackModels', 'autoReviewDebounceMs', 'autoReviewMaxFilesPerBatch', 'autoReviewMaxConcurrentReviews', 'autoReviewCascadeOn', 'pluginsEnabled', 'fleetChatVerbosity'];
21
21
  export interface PrefHelperDeps {
22
- /** Root bootstrap path. Never a settings mutation target. */
23
- globalConfigPath: string;
24
22
  /** Path to the active profile config; the sole settings mutation target. */
25
23
  profileConfigPath: string;
26
24
  vault: SecretVault;
@@ -1 +1 @@
1
- {"version":3,"file":"pref-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pref-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,6EAA6E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ACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1F;AAED;;;;;;;kBAOkB;AAClB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB;AAyCD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EACjD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CA8Wf"}
1
+ {"version":3,"file":"pref-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pref-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,6EAA6E;AAC7E,eAAO,MAAM,SAAS,YACpB,UAAU,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,MAAM,EACN,eAAe,EACf,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAA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AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAkXf"}
@@ -0,0 +1,22 @@
1
+ import type { ConfigStore } from '@wrongstack/core/types';
2
+ import type { WebSocket } from 'ws';
3
+ import { type PendingConfirm } from './pending-confirms.js';
4
+ import type { WSServerMessage } from './types.js';
5
+ export interface PrefsHandlerContext {
6
+ meta: Record<string, unknown>;
7
+ snapshot: () => Record<string, unknown>;
8
+ persist: (payload: Record<string, unknown>) => Promise<void>;
9
+ pendingConfirms: Map<string, PendingConfirm>;
10
+ configStore?: ConfigStore | undefined;
11
+ setYolo?: ((enabled: boolean) => void) | undefined;
12
+ setAutonomy?: ((mode: string) => void) | undefined;
13
+ applyConfigPrefs?: ((payload: Record<string, unknown>) => void) | undefined;
14
+ setAutoCompact?: ((enabled: boolean) => void) | undefined;
15
+ setLogLevel?: ((level: 'debug' | 'info' | 'warn' | 'error') => void) | undefined;
16
+ send: (ws: WebSocket, message: WSServerMessage) => void;
17
+ broadcast: (message: WSServerMessage) => void;
18
+ }
19
+ export declare function handlePrefsGet(ctx: PrefsHandlerContext, ws: WebSocket): void;
20
+ export declare function handlePrefsUpdate(ctx: PrefsHandlerContext, ws: WebSocket, input: Record<string, unknown>): void;
21
+ export declare function handleAutonomySwitch(ctx: PrefsHandlerContext, ws: WebSocket, mode: string): void;
22
+ //# sourceMappingURL=prefs-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefs-handlers.d.ts","sourceRoot":"","sources":["../../src/server/prefs-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,KAAK,cAAc,EAAsC,MAAM,uBAAu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GAAG,EAAE,mBAAmB,EACxB,EAAE,EAAE,SAAS,EACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,IAAI,CA+CN;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMhG"}
@@ -1,4 +1,5 @@
1
1
  import type { WebSocket } from 'ws';
2
+ import { type PrefsHandlerContext } from './prefs-handlers.js';
2
3
  import type { WSClientMessage } from './types.js';
3
4
  export interface PrefsRouteHandlers {
4
5
  /** Respond to the WS client with the current pref snapshot. */
@@ -10,7 +11,10 @@ export interface PrefsRouteHandlers {
10
11
  * logger.level), then broadcast the full current snapshot to all clients.
11
12
  */
12
13
  updatePrefs: (ws: WebSocket, payload: Record<string, unknown>) => Promise<void>;
14
+ /** Preview/apply canonical defaults in the active profile config. */
15
+ doctorConfig?: ((ws: WebSocket, apply: boolean) => Promise<void>) | undefined;
13
16
  }
17
+ export declare function createPrefsRouteHandlers(ctx: PrefsHandlerContext, doctorConfig?: PrefsRouteHandlers['doctorConfig']): PrefsRouteHandlers;
14
18
  /**
15
19
  * Chain-of-responsibility dispatcher for the `prefs.*` WS message family.
16
20
  * Returns `true` if the message was handled by this layer (so the caller's
@@ -20,6 +24,7 @@ export interface PrefsRouteHandlers {
20
24
  * Owned prefixes:
21
25
  * - `prefs.get`
22
26
  * - `prefs.update`
27
+ * - `config.doctor`
23
28
  *
24
29
  * Regression-tested by packages/webui/tests/server/dispatcher-routing.test.ts.
25
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"prefs-routes.d.ts","sourceRoot":"","sources":["../../src/server/prefs-routes.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IA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B,CACpC,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAmClB"}
@@ -0,0 +1,16 @@
1
+ import type { Logger } from '@wrongstack/core/types';
2
+ import { type TrustBoundary, type TrustBoundaryRequest, type TrustRisk, type TrustSubject } from '@wrongstack/core/security';
3
+ export interface WebUIPrivilegedAction {
4
+ capability: string;
5
+ subject: TrustSubject;
6
+ risk: TrustRisk;
7
+ cwd?: string | undefined;
8
+ sessionId?: string | undefined;
9
+ metadata?: TrustBoundaryRequest['metadata'] | undefined;
10
+ }
11
+ export declare function authorizeWebUIAction(boundary: TrustBoundary, action: WebUIPrivilegedAction, logger?: Logger | undefined): Promise<{
12
+ allowed: boolean;
13
+ reason: string;
14
+ request: TrustBoundaryRequest;
15
+ }>;
16
+ //# sourceMappingURL=privileged-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privileged-actions.d.ts","sourceRoot":"","sources":["../../src/server/privileged-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;CACzD;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,qBAAqB,EAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,CAAC,CAwB9E"}
@@ -6,15 +6,17 @@
6
6
  * case 'process.kill': return handleProcessKill(ws, msg.payload);
7
7
  * case 'process.killAll': return handleProcessKillAll(ws);
8
8
  *
9
- * All three reach the registry via a dynamic `@wrongstack/tools` import so the
10
- * server starts even when that package is unavailable, and never throw — a
11
- * failure is reported back over the socket instead.
9
+ * Registry failures never escape the handler; they are reported over the
10
+ * socket using the existing protocol envelopes.
12
11
  */
12
+ import type { Logger } from '@wrongstack/core/types';
13
+ import { type TrustBoundary } from '@wrongstack/core/security';
13
14
  import type { WebSocket } from 'ws';
15
+ import { type WebUIPrivilegedAction } from './privileged-actions.js';
14
16
  /** Broadcast the tracked-process list; an empty list on any registry failure. */
15
- export declare function handleProcessList(ws: WebSocket): Promise<void>;
17
+ export declare function handleProcessList(ws: WebSocket): void;
16
18
  /** Kill one tracked PID. Rejects invalid payloads and protected processes. */
17
- export declare function handleProcessKill(ws: WebSocket, payload: unknown): Promise<void>;
19
+ export declare function handleProcessKill(ws: WebSocket, payload: unknown, trustBoundary?: TrustBoundary, logger?: Logger | undefined, metadata?: WebUIPrivilegedAction['metadata'] | undefined): Promise<void>;
18
20
  /** Kill every tracked process. */
19
- export declare function handleProcessKillAll(ws: WebSocket): Promise<void>;
21
+ export declare function handleProcessKillAll(ws: WebSocket, trustBoundary?: TrustBoundary, logger?: Logger | undefined, metadata?: WebUIPrivilegedAction['metadata'] | undefined): Promise<void>;
20
22
  //# sourceMappingURL=process-handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-handlers.d.ts","sourceRoot":"","sources":["../../src/server/process-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAIpC,iFAAiF;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ebSocket } from 'ws';
2
+ import type { WSClientMessage } from './types.js';
3
+ export interface ProcessRouteHandlers {
4
+ list: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
5
+ kill: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
6
+ killAll: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
7
+ }
8
+ export declare function handleProcessRoute(ws: WebSocket, msg: WSClientMessage, handlers: ProcessRouteHandlers): Promise<boolean>;
9
+ //# sourceMappingURL=process-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-routes.d.ts","sourceRoot":"","sources":["../../src/server/process-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpE,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxE;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAclB"}
@@ -1,52 +1,44 @@
1
+ import { DefaultSessionStore } from '@wrongstack/core/storage';
2
+ import type { Context } from '@wrongstack/core/agent';
3
+ import type { SessionStore, TokenCounter } from '@wrongstack/core/types';
1
4
  import type { WebSocket } from 'ws';
2
- import type { Context, DefaultSessionStore, MemoryStore, DefaultModeStore, SkillLoader, ToolRegistry } from '@wrongstack/core';
3
- import type { DefaultTokenCounter } from '@wrongstack/core/infrastructure';
4
- import type { ConnectedClient } from './types.js';
5
5
  import type { ProjectRouteHandlers } from './project-routes.js';
6
- type Session = Awaited<ReturnType<DefaultSessionStore['create']>>;
7
- type SessionStartPayload = {
8
- sessionId: string;
9
- model: string;
10
- provider: string;
11
- maxContext: number;
12
- inputCost: number;
13
- outputCost: number;
14
- cacheReadCost: number;
15
- projectName: string;
16
- projectRoot: string;
17
- cwd: string;
18
- mode: string;
19
- contextMode: string;
6
+ import type { ConnectedClient } from './types.js';
7
+ type Session = Awaited<ReturnType<SessionStore['create']>>;
8
+ type OutboundMessage = {
9
+ type: string;
10
+ payload: unknown;
20
11
  };
21
- type ModelCapabilities = unknown;
22
12
  export interface ProjectHandlersContext {
23
13
  globalConfigPath: string;
24
14
  wpaths: {
25
15
  globalRoot: string;
26
16
  };
27
- clients: Map<WebSocket, ConnectedClient>;
17
+ clients?: Map<WebSocket, ConnectedClient>;
18
+ sendMessage?: (ws: WebSocket, message: OutboundMessage) => void;
19
+ broadcastMessage?: (message: OutboundMessage) => void;
28
20
  context: Context;
29
- modeStore: DefaultModeStore;
30
- memoryStore: MemoryStore;
31
- skillLoader: SkillLoader | undefined;
32
- modelCapabilities: ModelCapabilities;
33
- toolRegistry: ToolRegistry;
34
- tokenCounter: DefaultTokenCounter;
21
+ tokenCounter: TokenCounter;
35
22
  config: {
36
23
  provider: string;
37
24
  model: string;
38
25
  };
39
- getModeId: () => string;
26
+ getConfig?: () => {
27
+ provider: string;
28
+ model: string;
29
+ };
40
30
  getProjectRoot: () => string;
41
31
  getSession: () => Session;
42
- setProjectRoot: (p: string) => void;
43
- setWorkingDir: (p: string) => void;
44
- setSession: (s: Session) => void;
45
- setSessionStore: (s: DefaultSessionStore) => void;
46
- setSessionStartedAt: (t: number) => void;
47
- /** Abort + clear any in-flight runLock before switching projects. */
32
+ setProjectRoot: (projectRoot: string) => void;
33
+ setWorkingDir: (workingDir: string) => void;
34
+ setSession: (session: Session) => void;
35
+ setSessionStore: (store: DefaultSessionStore) => void;
36
+ setSessionStartedAt?: (startedAt: number) => void;
48
37
  abortRunLock: () => void;
49
- sessionStartPayload: () => Promise<SessionStartPayload>;
38
+ abortAllRuns?: () => void;
39
+ onSessionSwapped?: (sessionId: string) => void | Promise<void>;
40
+ allowProjectMutations?: boolean;
41
+ sessionStartPayload: (overrides?: Record<string, unknown>) => Promise<unknown>;
50
42
  }
51
43
  export declare function createProjectHandlers(ctx: ProjectHandlersContext): ProjectRouteHandlers;
52
44
  export {};