@wrongstack/webui-server 0.284.1 → 0.285.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.
- package/dist/index.d.ts +11 -2300
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1019 -277
- package/dist/index.js.map +7 -1
- package/dist/server/autophase-routes.d.ts +10 -0
- package/dist/server/autophase-routes.d.ts.map +1 -0
- package/dist/server/autophase-ws-handler.d.ts +87 -0
- package/dist/server/autophase-ws-handler.d.ts.map +1 -0
- package/dist/server/backend-services.d.ts +114 -0
- package/dist/server/backend-services.d.ts.map +1 -0
- package/dist/server/boot.d.ts +19 -0
- package/dist/server/boot.d.ts.map +1 -0
- package/dist/server/brain-routes.d.ts +9 -0
- package/dist/server/brain-routes.d.ts.map +1 -0
- package/dist/server/codebase-indexing.d.ts +15 -0
- package/dist/server/codebase-indexing.d.ts.map +1 -0
- package/dist/server/collaboration-ws-handler.d.ts +159 -0
- package/dist/server/collaboration-ws-handler.d.ts.map +1 -0
- package/dist/server/completion-handlers.d.ts +39 -0
- package/dist/server/completion-handlers.d.ts.map +1 -0
- package/dist/server/connection-handler.d.ts +72 -0
- package/dist/server/connection-handler.d.ts.map +1 -0
- package/dist/server/context-meta.d.ts +28 -0
- package/dist/server/context-meta.d.ts.map +1 -0
- package/dist/server/custom-context-modes.d.ts +43 -0
- package/dist/server/custom-context-modes.d.ts.map +1 -0
- package/dist/server/design-handlers.d.ts +40 -0
- package/dist/server/design-handlers.d.ts.map +1 -0
- package/dist/server/discover-mailbox-bridge.d.ts +26 -0
- package/dist/server/discover-mailbox-bridge.d.ts.map +1 -0
- package/dist/server/entry.d.ts +2 -2
- package/dist/server/entry.d.ts.map +1 -0
- package/dist/server/entry.js +811 -300
- package/dist/server/entry.js.map +7 -1
- package/dist/server/eternal-iteration-broadcast.d.ts +11 -0
- package/dist/server/eternal-iteration-broadcast.d.ts.map +1 -0
- package/dist/server/file-handlers.d.ts +45 -0
- package/dist/server/file-handlers.d.ts.map +1 -0
- package/dist/server/file-picker.d.ts +26 -0
- package/dist/server/file-picker.d.ts.map +1 -0
- package/dist/server/git-handlers.d.ts +55 -0
- package/dist/server/git-handlers.d.ts.map +1 -0
- package/dist/server/goal-handlers.d.ts +19 -0
- package/dist/server/goal-handlers.d.ts.map +1 -0
- package/dist/server/handlers/index.d.ts +12 -0
- package/dist/server/handlers/index.d.ts.map +1 -0
- package/dist/server/handlers/worklist-handlers.d.ts +49 -0
- package/dist/server/handlers/worklist-handlers.d.ts.map +1 -0
- package/dist/server/handlers.d.ts +1 -51
- package/dist/server/handlers.js +17 -8
- package/dist/server/handlers.js.map +7 -1
- package/dist/server/http-server/analytics-handler.d.ts +35 -0
- package/dist/server/http-server/analytics-handler.d.ts.map +1 -0
- package/dist/server/http-server/api-handlers.d.ts +44 -0
- package/dist/server/http-server/api-handlers.d.ts.map +1 -0
- package/dist/server/http-server.d.ts +108 -0
- package/dist/server/http-server.d.ts.map +1 -0
- package/dist/server/index.d.ts +93 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/instance-registry.d.ts +63 -0
- package/dist/server/instance-registry.d.ts.map +1 -0
- package/dist/server/kanban-routes.d.ts +7 -0
- package/dist/server/kanban-routes.d.ts.map +1 -0
- package/dist/server/lifecycle.d.ts +51 -0
- package/dist/server/lifecycle.d.ts.map +1 -0
- package/dist/server/mailbox-handlers.d.ts +51 -0
- package/dist/server/mailbox-handlers.d.ts.map +1 -0
- package/dist/server/mailbox-routes.d.ts +10 -0
- package/dist/server/mailbox-routes.d.ts.map +1 -0
- package/dist/server/mcp-handlers.d.ts +46 -0
- package/dist/server/mcp-handlers.d.ts.map +1 -0
- package/dist/server/mcp-routes.d.ts +37 -0
- package/dist/server/mcp-routes.d.ts.map +1 -0
- package/dist/server/memory-handlers.d.ts +28 -0
- package/dist/server/memory-handlers.d.ts.map +1 -0
- package/dist/server/message-dispatcher.d.ts +41 -0
- package/dist/server/message-dispatcher.d.ts.map +1 -0
- package/dist/server/mode-handlers.d.ts +50 -0
- package/dist/server/mode-handlers.d.ts.map +1 -0
- package/dist/server/mode-routes.d.ts +8 -0
- package/dist/server/mode-routes.d.ts.map +1 -0
- package/dist/server/model-auto-discovery.d.ts +9 -0
- package/dist/server/model-auto-discovery.d.ts.map +1 -0
- package/dist/server/model-catalog.d.ts +16 -0
- package/dist/server/model-catalog.d.ts.map +1 -0
- package/dist/server/open-browser.d.ts +16 -0
- package/dist/server/open-browser.d.ts.map +1 -0
- package/dist/server/path-containment.d.ts +3 -0
- package/dist/server/path-containment.d.ts.map +1 -0
- package/dist/server/pending-confirms.d.ts +14 -0
- package/dist/server/pending-confirms.d.ts.map +1 -0
- package/dist/server/port-utils.d.ts +28 -0
- package/dist/server/port-utils.d.ts.map +1 -0
- package/dist/server/pre-context-services.d.ts +58 -0
- package/dist/server/pre-context-services.d.ts.map +1 -0
- package/dist/server/pref-helpers.d.ts +43 -0
- package/dist/server/pref-helpers.d.ts.map +1 -0
- package/dist/server/prefs-routes.d.ts +27 -0
- package/dist/server/prefs-routes.d.ts.map +1 -0
- package/dist/server/process-handlers.d.ts +20 -0
- package/dist/server/process-handlers.d.ts.map +1 -0
- package/dist/server/project-handlers.d.ts +53 -0
- package/dist/server/project-handlers.d.ts.map +1 -0
- package/dist/server/project-routes.d.ts +10 -0
- package/dist/server/project-routes.d.ts.map +1 -0
- package/dist/server/projects-manifest.d.ts +18 -0
- package/dist/server/projects-manifest.d.ts.map +1 -0
- package/dist/server/prompts-handlers.d.ts +38 -0
- package/dist/server/prompts-handlers.d.ts.map +1 -0
- package/dist/server/provider-config-io.d.ts +15 -0
- package/dist/server/provider-config-io.d.ts.map +1 -0
- package/dist/server/provider-config-standalone.d.ts +13 -0
- package/dist/server/provider-config-standalone.d.ts.map +1 -0
- package/dist/server/provider-handlers.d.ts +74 -0
- package/dist/server/provider-handlers.d.ts.map +1 -0
- package/dist/server/provider-keys.d.ts +53 -0
- package/dist/server/provider-keys.d.ts.map +1 -0
- package/dist/server/provider-routes.d.ts +13 -0
- package/dist/server/provider-routes.d.ts.map +1 -0
- package/dist/server/provider-store.d.ts +26 -0
- package/dist/server/provider-store.d.ts.map +1 -0
- package/dist/server/routes.d.ts +182 -0
- package/dist/server/routes.d.ts.map +1 -0
- package/dist/server/sdd-board-routes.d.ts +11 -0
- package/dist/server/sdd-board-routes.d.ts.map +1 -0
- package/dist/server/sdd-board-ws-handler.d.ts +57 -0
- package/dist/server/sdd-board-ws-handler.d.ts.map +1 -0
- package/dist/server/sdd-wizard-routes.d.ts +16 -0
- package/dist/server/sdd-wizard-routes.d.ts.map +1 -0
- package/dist/server/sdd-wizard-wiring.d.ts +26 -0
- package/dist/server/sdd-wizard-wiring.d.ts.map +1 -0
- package/dist/server/sdd-wizard-ws-handler.d.ts +66 -0
- package/dist/server/sdd-wizard-ws-handler.d.ts.map +1 -0
- package/dist/server/server-runtime.d.ts +118 -0
- package/dist/server/server-runtime.d.ts.map +1 -0
- package/dist/server/session-handlers.d.ts +44 -0
- package/dist/server/session-handlers.d.ts.map +1 -0
- package/dist/server/session-routes.d.ts +23 -0
- package/dist/server/session-routes.d.ts.map +1 -0
- package/dist/server/setup-events.d.ts +67 -0
- package/dist/server/setup-events.d.ts.map +1 -0
- package/dist/server/setup-screen.d.ts +44 -0
- package/dist/server/setup-screen.d.ts.map +1 -0
- package/dist/server/shell-git-routes.d.ts +10 -0
- package/dist/server/shell-git-routes.d.ts.map +1 -0
- package/dist/server/shell-open.d.ts +12 -0
- package/dist/server/shell-open.d.ts.map +1 -0
- package/dist/server/skills-handlers.d.ts +77 -0
- package/dist/server/skills-handlers.d.ts.map +1 -0
- package/dist/server/specs-routes.d.ts +11 -0
- package/dist/server/specs-routes.d.ts.map +1 -0
- package/dist/server/specs-ws-handler.d.ts +34 -0
- package/dist/server/specs-ws-handler.d.ts.map +1 -0
- package/dist/server/start-webui.d.ts +29 -0
- package/dist/server/start-webui.d.ts.map +1 -0
- package/dist/server/terminal-ws-handler.d.ts +70 -0
- package/dist/server/terminal-ws-handler.d.ts.map +1 -0
- package/dist/server/token-estimator.d.ts +66 -0
- package/dist/server/token-estimator.d.ts.map +1 -0
- package/dist/server/types.d.ts +143 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/usage-cost.d.ts +39 -0
- package/dist/server/usage-cost.d.ts.map +1 -0
- package/dist/server/worktree-ws-handler.d.ts +67 -0
- package/dist/server/worktree-ws-handler.d.ts.map +1 -0
- package/dist/server/ws-auth.d.ts +83 -0
- package/dist/server/ws-auth.d.ts.map +1 -0
- package/dist/server/ws-payload-validation.d.ts +122 -0
- package/dist/server/ws-payload-validation.d.ts.map +1 -0
- package/dist/server/ws-utils.d.ts +38 -0
- package/dist/server/ws-utils.d.ts.map +1 -0
- package/dist/server/zip.d.ts +9 -0
- package/dist/server/zip.d.ts.map +1 -0
- package/package.json +11 -12
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { WebSocket, WebSocketServer } from 'ws';
|
|
2
|
+
import type { Agent, AgentPipelines, Context, MemoryStore, DefaultModeStore, EventBus, ModelsRegistry, ObservableBrainArbiter, PermissionPolicy, Provider, ProviderConfig, ProviderRegistry, SkillInstaller, SkillLoader, ToolRegistry } from '@wrongstack/core';
|
|
3
|
+
import type { DefaultTokenCounter } from '@wrongstack/core/infrastructure';
|
|
4
|
+
import type { AutoCompactionMiddleware, BrainAutoRisk, Compactor, ConfigStore, Logger, SecretVault } from '@wrongstack/core';
|
|
5
|
+
import type { SessionStore } from '@wrongstack/core';
|
|
6
|
+
type Session = Awaited<ReturnType<SessionStore['create']>>;
|
|
7
|
+
import type { Config } from '@wrongstack/core/types';
|
|
8
|
+
import type { MCPRegistry } from '@wrongstack/mcp';
|
|
9
|
+
import type { AutoPhaseWebSocketHandler } from './autophase-ws-handler.js';
|
|
10
|
+
import type { SpecsWebSocketHandler } from './specs-ws-handler.js';
|
|
11
|
+
import type { SddBoardWebSocketHandler } from './sdd-board-ws-handler.js';
|
|
12
|
+
import type { SddWizardWebSocketHandler } from './sdd-wizard-ws-handler.js';
|
|
13
|
+
import type { WorktreeWebSocketHandler } from './worktree-ws-handler.js';
|
|
14
|
+
import type { CollaborationWebSocketHandler } from './collaboration-ws-handler.js';
|
|
15
|
+
import type { TerminalWebSocketHandler } from './terminal-ws-handler.js';
|
|
16
|
+
import type { ProviderRouteHandlers } from './provider-routes.js';
|
|
17
|
+
import type { SessionRouteHandlers } from './session-routes.js';
|
|
18
|
+
import type { ProjectRouteHandlers } from './project-routes.js';
|
|
19
|
+
import type { ModeRouteHandlers } from './mode-routes.js';
|
|
20
|
+
import type { PrefsRouteHandlers } from './prefs-routes.js';
|
|
21
|
+
import type { ShellGitRouteHandlers } from './shell-git-routes.js';
|
|
22
|
+
import type { MailboxRouteHandlers } from './mailbox-routes.js';
|
|
23
|
+
import type { McpRouteHandlers } from './mcp-routes.js';
|
|
24
|
+
import type { BrainRouteHandlers } from './brain-routes.js';
|
|
25
|
+
import type { AutoPhaseRouteHandlers } from './autophase-routes.js';
|
|
26
|
+
import type { SpecsRouteHandlers } from './specs-routes.js';
|
|
27
|
+
import type { SddBoardRouteHandlers } from './sdd-board-routes.js';
|
|
28
|
+
import type { SddWizardRouteHandlers } from './sdd-wizard-routes.js';
|
|
29
|
+
import type { ConnectedClient } from './types.js';
|
|
30
|
+
import type { CustomModeStore } from './custom-context-modes.js';
|
|
31
|
+
import { type PendingConfirm } from './pending-confirms.js';
|
|
32
|
+
/**
|
|
33
|
+
* Mutable session-scoped state. Handlers always read LIVE values through
|
|
34
|
+
* these getters and write through setters — same closure semantics as
|
|
35
|
+
* the original code captured by direct reference, but reachable through
|
|
36
|
+
* an interface so the route construction can live outside `startWebUI`.
|
|
37
|
+
*/
|
|
38
|
+
export interface WebuiMutableState {
|
|
39
|
+
getConfig(): Config;
|
|
40
|
+
setConfig(next: Config): void;
|
|
41
|
+
getProjectRoot(): string;
|
|
42
|
+
setProjectRoot(next: string): void;
|
|
43
|
+
getWorkingDir(): string;
|
|
44
|
+
setWorkingDir(next: string): void;
|
|
45
|
+
getSession(): Session;
|
|
46
|
+
setSession(next: Session): void;
|
|
47
|
+
getSessionStartedAt(): number;
|
|
48
|
+
setSessionStartedAt(next: number): void;
|
|
49
|
+
getSessionStore(): SessionStore;
|
|
50
|
+
setSessionStore(next: SessionStore): void;
|
|
51
|
+
getModeId(): string;
|
|
52
|
+
setModeId(next: string): void;
|
|
53
|
+
/** Snapshot of current model capabilities (refreshed on model switch). */
|
|
54
|
+
getModelCapabilities(): unknown;
|
|
55
|
+
getConfigWriteLock(): Promise<void>;
|
|
56
|
+
setConfigWriteLock(next: Promise<void>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Abort and clear any in-flight agent run. Routes shouldn't normally
|
|
59
|
+
* touch runLock directly. The
|
|
60
|
+
* refactor moves that into the projectHandlers setter chain so the
|
|
61
|
+
* route layer just calls a single hook.
|
|
62
|
+
*/
|
|
63
|
+
abortRunLock: () => void;
|
|
64
|
+
/** Read-only reference to the live WS clients map. */
|
|
65
|
+
getClients(): Map<WebSocket, ConnectedClient>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Services + WS-subsystem handlers, bootstrapped once. Immutable for
|
|
69
|
+
* the duration of a session (the mutable ones live in `WebuiMutableState`).
|
|
70
|
+
*/
|
|
71
|
+
export interface WebuiDeps {
|
|
72
|
+
agent: Agent;
|
|
73
|
+
context: Context;
|
|
74
|
+
container: import('@wrongstack/core').Container;
|
|
75
|
+
toolRegistry: ToolRegistry;
|
|
76
|
+
modelsRegistry: ModelsRegistry;
|
|
77
|
+
providerRegistry: ProviderRegistry;
|
|
78
|
+
provider: Provider;
|
|
79
|
+
mcpRegistry: MCPRegistry;
|
|
80
|
+
vault: SecretVault;
|
|
81
|
+
globalConfigPath: string;
|
|
82
|
+
/** Per-project layout — expose only the bits the route layer touches. */
|
|
83
|
+
wpaths: {
|
|
84
|
+
globalRoot: string;
|
|
85
|
+
globalSkills: string;
|
|
86
|
+
};
|
|
87
|
+
configStore: ConfigStore;
|
|
88
|
+
tokenCounter: DefaultTokenCounter;
|
|
89
|
+
permissionPolicy: PermissionPolicy;
|
|
90
|
+
pendingConfirms: Map<string, PendingConfirm>;
|
|
91
|
+
pipelines: AgentPipelines;
|
|
92
|
+
logger: Logger;
|
|
93
|
+
memoryStore: MemoryStore;
|
|
94
|
+
modeStore: DefaultModeStore;
|
|
95
|
+
skillLoader: SkillLoader | undefined;
|
|
96
|
+
skillInstaller: SkillInstaller | undefined;
|
|
97
|
+
customModeStore: CustomModeStore;
|
|
98
|
+
compactor: Compactor;
|
|
99
|
+
autoCompactor: AutoCompactionMiddleware | undefined;
|
|
100
|
+
events: EventBus;
|
|
101
|
+
wsHost: string;
|
|
102
|
+
requireToken: boolean;
|
|
103
|
+
publicUrl: string | undefined;
|
|
104
|
+
publicWsUrl: string | undefined;
|
|
105
|
+
wsPort: number;
|
|
106
|
+
httpPort: number;
|
|
107
|
+
wssPrimary: WebSocketServer;
|
|
108
|
+
wssSecondary: WebSocketServer | null;
|
|
109
|
+
/** Per-feature WS handlers (autophase, specs, sdd-board, sdd-wizard, …). */
|
|
110
|
+
autoPhaseHandler: AutoPhaseWebSocketHandler;
|
|
111
|
+
specsHandler: SpecsWebSocketHandler;
|
|
112
|
+
sddBoardHandler: SddBoardWebSocketHandler;
|
|
113
|
+
sddWizardHandler: SddWizardWebSocketHandler;
|
|
114
|
+
worktreeHandler: WorktreeWebSocketHandler;
|
|
115
|
+
collabHandler: CollaborationWebSocketHandler;
|
|
116
|
+
terminalHandler: TerminalWebSocketHandler;
|
|
117
|
+
/** Brain monitoring + last-20 decision log. */
|
|
118
|
+
brain: ObservableBrainArbiter;
|
|
119
|
+
brainSettings: {
|
|
120
|
+
maxAutoRisk: BrainAutoRisk;
|
|
121
|
+
};
|
|
122
|
+
brainLog: Array<{
|
|
123
|
+
at: number;
|
|
124
|
+
kind: string;
|
|
125
|
+
question: string;
|
|
126
|
+
outcome: string;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Closures the routes call back into `startWebUI` for. These weren't
|
|
131
|
+
* worth lifting into `WebuiMutableState` because they need write access
|
|
132
|
+
* to internals (config persistence, autofill, …) that only the boot
|
|
133
|
+
* context has. The route layer treats them as opaque side-effects and
|
|
134
|
+
* delegates without storing state of its own.
|
|
135
|
+
*/
|
|
136
|
+
export interface WebuiCallbacks {
|
|
137
|
+
sessionStartPayload: () => Promise<{
|
|
138
|
+
sessionId: string;
|
|
139
|
+
model: string;
|
|
140
|
+
provider: string;
|
|
141
|
+
maxContext: number;
|
|
142
|
+
inputCost: number;
|
|
143
|
+
outputCost: number;
|
|
144
|
+
cacheReadCost: number;
|
|
145
|
+
projectName: string;
|
|
146
|
+
projectRoot: string;
|
|
147
|
+
cwd: string;
|
|
148
|
+
mode: string;
|
|
149
|
+
contextMode: string;
|
|
150
|
+
}>;
|
|
151
|
+
/** Re-build the AutoCompaction middleware denominator on model switch. */
|
|
152
|
+
updateAutoCompactionMaxContext: (newProvider: Provider, providerId?: string, providerCfg?: ProviderConfig | undefined) => Promise<void>;
|
|
153
|
+
/** Unified, serialized, decrypt→mutate→encrypt→write helper for globalConfigPath. */
|
|
154
|
+
updateGlobalConfig: (mutate: (config: Record<string, unknown>) => void, errorLabel: string) => Promise<void>;
|
|
155
|
+
/** Persist the durable subset of context.meta prefs to config.json. */
|
|
156
|
+
persistPrefsToConfig: (payload: Record<string, unknown>) => Promise<void>;
|
|
157
|
+
/** Snapshot of every pref the standalone server exposes. */
|
|
158
|
+
prefSnapshot: () => Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
export interface AllRoutes {
|
|
161
|
+
providerRoutes: ProviderRouteHandlers;
|
|
162
|
+
sessionRoutes: SessionRouteHandlers;
|
|
163
|
+
projectRoutes: ProjectRouteHandlers;
|
|
164
|
+
modeRoutes: ModeRouteHandlers;
|
|
165
|
+
prefsRoutes: PrefsRouteHandlers;
|
|
166
|
+
shellGitRoutes: ShellGitRouteHandlers;
|
|
167
|
+
mailboxRoutes: MailboxRouteHandlers;
|
|
168
|
+
mcpRoutes: McpRouteHandlers;
|
|
169
|
+
brainRoutes: BrainRouteHandlers;
|
|
170
|
+
autoPhaseRoutes: AutoPhaseRouteHandlers;
|
|
171
|
+
specsRoutes: SpecsRouteHandlers;
|
|
172
|
+
sddBoardRoutes: SddBoardRouteHandlers;
|
|
173
|
+
sddWizardRoutes: SddWizardRouteHandlers;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Build the 13 route records referenced by `handleProviderRoute`,
|
|
177
|
+
* `handleSessionRoute`, … `handleSddWizardRoute`. The construction is a
|
|
178
|
+
* direct lift from `startWebUI`; behaviour is unchanged.
|
|
179
|
+
*/
|
|
180
|
+
export declare function buildRoutes(state: WebuiMutableState, deps: WebuiDeps, cb: WebuiCallbacks): AllRoutes;
|
|
181
|
+
export {};
|
|
182
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/server/routes.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErD,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACd,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAO3E,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACb,SAAS,EACT,WAAW,EACX,MAAM,EACN,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,KAAK,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AC;IACnB,qFAAqF;IACrF,kBAAkB,EAAE,CAClB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EACjD,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,uEAAuE;IACvE,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,4DAA4D;IAC5D,YAAY,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,qBAAqB,CAAC;IACtC,aAAa,EAAE,oBAAoB,CAAC;IACpC,aAAa,EAAE,oBAAoB,CAAC;IACpC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,EAAE,qBAAqB,CAAC;IACtC,aAAa,EAAE,oBAAoB,CAAC;IACpC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,eAAe,EAAE,sBAAsB,CAAC;IACxC,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,EAAE,qBAAqB,CAAC;IACtC,eAAe,EAAE,sBAAsB,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,cAAc,GACjB,SAAS,CA4hBX"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { WSClientMessage } from './types.js';
|
|
3
|
+
export interface SddBoardRouteHandlers {
|
|
4
|
+
handleMessage: (msg: {
|
|
5
|
+
type: string;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/** Forward any `sdd.board.*` message to the SddBoardWebSocketHandler. */
|
|
10
|
+
export declare function handleSddBoardRoute(_ws: WebSocket, msg: WSClientMessage, handlers: SddBoardRouteHandlers): Promise<boolean>;
|
|
11
|
+
//# sourceMappingURL=sdd-board-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdd-board-routes.d.ts","sourceRoot":"","sources":["../../src/server/sdd-board-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,qBAAqB;IACpC,aAAa,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F;AAED,yEAAyE;AACzE,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { EventBus } from '@wrongstack/core';
|
|
3
|
+
interface SddBoardWSMessage {
|
|
4
|
+
type: string;
|
|
5
|
+
payload?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/** Project paths the handler needs to apply lifecycle ops directly. */
|
|
8
|
+
export interface SddBoardLifecycleDeps {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
paths: {
|
|
11
|
+
projectSpecs: string;
|
|
12
|
+
projectTaskGraphs: string;
|
|
13
|
+
projectSddSession: string;
|
|
14
|
+
projectSddBoards: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* SddBoardWebSocketHandler — streams the live SDD multi-agent board to clients
|
|
19
|
+
* and relays control commands back to the CLI-owned run.
|
|
20
|
+
*
|
|
21
|
+
* Two observe modes (one class, shared by both webui servers):
|
|
22
|
+
* • in-process (CLI-hosted): subscribe the shared EventBus `sdd.board.snapshot`
|
|
23
|
+
* for instant updates;
|
|
24
|
+
* • standalone (separate process): poll the on-disk snapshot store (the CLI
|
|
25
|
+
* run persists JSON every change).
|
|
26
|
+
*
|
|
27
|
+
* Control is uniform + cross-process: every command is appended to the run's
|
|
28
|
+
* `<runId>.control.jsonl`, which the CLI run drains and applies — so the run
|
|
29
|
+
* stays the single driver and nothing races on shared state.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SddBoardWebSocketHandler {
|
|
32
|
+
private readonly store;
|
|
33
|
+
private readonly clients;
|
|
34
|
+
private readonly lifecycle?;
|
|
35
|
+
private latest;
|
|
36
|
+
private poll;
|
|
37
|
+
private unsub;
|
|
38
|
+
constructor(boardsDir: string, events?: EventBus, lifecycle?: SddBoardLifecycleDeps);
|
|
39
|
+
addClient(ws: WebSocket): void;
|
|
40
|
+
handleMessage(msg: SddBoardWSMessage): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Apply a cleanup/rollback/destroy from disk and broadcast a structured
|
|
43
|
+
* `sdd.board.lifecycle_result`. Refuses (no-op) while a run is still active —
|
|
44
|
+
* the user must stop it first; the UI gates the buttons on `!active` and the
|
|
45
|
+
* Destroy flow auto-stops then waits before sending `destroy`.
|
|
46
|
+
*/
|
|
47
|
+
private applyLifecycle;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
private pollLatest;
|
|
50
|
+
private sendCurrent;
|
|
51
|
+
private broadcastCurrent;
|
|
52
|
+
private loadLatestFromDisk;
|
|
53
|
+
private broadcast;
|
|
54
|
+
private send;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=sdd-board-ws-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AGb"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { WSClientMessage } from './types.js';
|
|
3
|
+
export interface SddWizardRouteHandlers {
|
|
4
|
+
handleMessage: (msg: {
|
|
5
|
+
type: string;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Forward the SDD wizard messages (`sdd.spec.*` and `sdd.run.start`) to the
|
|
11
|
+
* SddWizardWebSocketHandler. Note `sdd.board.*` is handled separately by the
|
|
12
|
+
* board route — the wizard owns spec-building + run kickoff, the board owns
|
|
13
|
+
* live observation/control.
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleSddWizardRoute(_ws: WebSocket, msg: WSClientMessage, handlers: SddWizardRouteHandlers): Promise<boolean>;
|
|
16
|
+
//# sourceMappingURL=sdd-wizard-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdd-wizard-routes.d.ts","sourceRoot":"","sources":["../../src/server/sdd-wizard-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,sBAAsB;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Agent, type AgentFactory, type BrainArbiter, type EventBus } from '@wrongstack/core';
|
|
2
|
+
import type { SddWizardDeps } from './sdd-wizard-ws-handler.js';
|
|
3
|
+
export interface SddWizardWiringOptions {
|
|
4
|
+
/** Leader agent — seeds the run's default factory + project context. */
|
|
5
|
+
agent: Agent;
|
|
6
|
+
/** Shared EventBus — the board projector emits sdd.board.snapshot on it. */
|
|
7
|
+
events: EventBus;
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
/** Per-task agent factory: CLI's director-backed one, or the runtime light one. */
|
|
10
|
+
subagentFactory: AgentFactory;
|
|
11
|
+
/**
|
|
12
|
+
* Decision authority for the failure supervisor (the server's bound
|
|
13
|
+
* TOKENS.BrainArbiter). Omit to run without a supervisor (plain terminal-fail,
|
|
14
|
+
* matching a bare run) — but parity with the CLI wants it wired.
|
|
15
|
+
*/
|
|
16
|
+
brain?: BrainArbiter | undefined;
|
|
17
|
+
/** Persisted-store directories (from resolveWstackPaths). */
|
|
18
|
+
paths: {
|
|
19
|
+
projectSpecs: string;
|
|
20
|
+
projectTaskGraphs: string;
|
|
21
|
+
projectSddBoards: string;
|
|
22
|
+
projectDir: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare function buildSddWizardDeps(opts: SddWizardWiringOptions): SddWizardDeps;
|
|
26
|
+
//# sourceMappingURL=sdd-wizard-wiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdd-wizard-wiring.d.ts","sourceRoot":"","sources":["../../src/server/sdd-wizard-wiring.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,QAAQ,EAGd,MAAM,kBAAkB,CAAC;AAa1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,KAAK,EAAE,KAAK,CAAC;IACb,4EAA4E;IAC5E,MAAM,EAAE,QAAQ,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,eAAe,EAAE,YAAY,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACjC,6DAA6D;IAC7D,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAqBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,aAAa,CA0I9E"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { SddInterviewDriver } from '@wrongstack/sdd';
|
|
3
|
+
interface WizardMessage {
|
|
4
|
+
type: string;
|
|
5
|
+
payload?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Dependencies each webui server supplies. The handler is deliberately
|
|
9
|
+
* agent-agnostic: every surface decides how to build a driver, how to run an
|
|
10
|
+
* interview turn (on an isolated agent, off the main chat bus), and how to
|
|
11
|
+
* start the real multi-agent run (CLI's director-backed factory vs the runtime
|
|
12
|
+
* light factory). This keeps the wizard protocol identical across both servers.
|
|
13
|
+
*/
|
|
14
|
+
export interface SddWizardDeps {
|
|
15
|
+
/** Build a fresh interview driver (disk spec/graph stores + session path). */
|
|
16
|
+
makeDriver: () => SddInterviewDriver;
|
|
17
|
+
/**
|
|
18
|
+
* Run one interview turn: feed the AI prompt to an isolated agent and return
|
|
19
|
+
* its final text. MUST NOT run on the main chat agent's bus — the wizard owns
|
|
20
|
+
* this conversation, separate from the user's chat.
|
|
21
|
+
*/
|
|
22
|
+
runInterviewTurn: (prompt: string) => Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Start the real multi-agent SDD run for the driver's task graph. Returns the
|
|
25
|
+
* runId; the live board flows through the existing board handler.
|
|
26
|
+
*/
|
|
27
|
+
startRun: (driver: SddInterviewDriver, opts: {
|
|
28
|
+
parallelSlots?: number | undefined;
|
|
29
|
+
defaultModel?: string | undefined;
|
|
30
|
+
defaultProvider?: string | undefined;
|
|
31
|
+
fallbackModels?: string[] | undefined;
|
|
32
|
+
/** Per-run worktree-isolation override; undefined → env default. */
|
|
33
|
+
worktrees?: boolean | undefined;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
runId: string;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* SddWizardWebSocketHandler — drives the interactive "New SDD Project" wizard
|
|
40
|
+
* (goal → Q&A → spec → task graph → start run) over WebSocket. Shared by both
|
|
41
|
+
* webui servers; server-specific construction (agent, factory) is injected via
|
|
42
|
+
* {@link SddWizardDeps}.
|
|
43
|
+
*/
|
|
44
|
+
export declare class SddWizardWebSocketHandler {
|
|
45
|
+
private readonly deps;
|
|
46
|
+
private readonly clients;
|
|
47
|
+
private driver;
|
|
48
|
+
/** The agent's most recent question — paired with the next user answer. */
|
|
49
|
+
private lastAgentText;
|
|
50
|
+
/** Guards against overlapping interview turns (one in flight at a time). */
|
|
51
|
+
private busy;
|
|
52
|
+
constructor(deps: SddWizardDeps);
|
|
53
|
+
addClient(ws: WebSocket): void;
|
|
54
|
+
handleMessage(msg: WizardMessage): Promise<void>;
|
|
55
|
+
private onStart;
|
|
56
|
+
private onMessage;
|
|
57
|
+
private onApprove;
|
|
58
|
+
private onRunStart;
|
|
59
|
+
/** Run one interview turn against the isolated agent, then ingest + broadcast. */
|
|
60
|
+
private runTurn;
|
|
61
|
+
private snapshotMsg;
|
|
62
|
+
private broadcast;
|
|
63
|
+
private send;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=sdd-wizard-ws-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdd-wizard-ws-handler.d.ts","sourceRoot":"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K,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCrD;YAIa,OAAO;YAcP,SAAS;YAYT,SAAS;YAWT,UAAU;IA2BxB,kFAAkF;YACpE,OAAO;IAcrB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,IAAI;CAGb"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Config, ModelsRegistry } from '@wrongstack/core';
|
|
2
|
+
import { WebSocketServer, type WebSocket } from 'ws';
|
|
3
|
+
import { setupEvents, type FileWatcherMetrics } from './setup-events.js';
|
|
4
|
+
import type { ConnectedClient } from './types.js';
|
|
5
|
+
export interface ResolvedPorts {
|
|
6
|
+
wsHost: string;
|
|
7
|
+
wsPort: number;
|
|
8
|
+
httpPort: number;
|
|
9
|
+
publicUrl: string | undefined;
|
|
10
|
+
publicWsUrl: string | undefined;
|
|
11
|
+
requireToken: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve bind host, HTTP/WS ports, public URLs, and the token-required flag
|
|
15
|
+
* from CLI opts + env vars. Auto-advances past taken ports unless
|
|
16
|
+
* `WEBUI_STRICT_PORT` is set.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePorts(opts: {
|
|
19
|
+
wsPort?: number | undefined;
|
|
20
|
+
wsHost?: string | undefined;
|
|
21
|
+
httpPort?: number | undefined;
|
|
22
|
+
webuiPort?: number | undefined;
|
|
23
|
+
port?: number | undefined;
|
|
24
|
+
publicUrl?: string | undefined;
|
|
25
|
+
publicWsUrl?: string | undefined;
|
|
26
|
+
requireToken?: boolean | undefined;
|
|
27
|
+
}): Promise<ResolvedPorts>;
|
|
28
|
+
export interface SessionStartPayloadGetters {
|
|
29
|
+
getConfig(): Config;
|
|
30
|
+
getSessionId(): string;
|
|
31
|
+
getProjectRoot(): string;
|
|
32
|
+
getWorkingDir(): string;
|
|
33
|
+
getModeId(): string;
|
|
34
|
+
getContextMode(): string;
|
|
35
|
+
getNeedsSetup(): boolean;
|
|
36
|
+
modelsRegistry: ModelsRegistry;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build a factory that produces the rich session.start payload from current
|
|
40
|
+
* runtime state. Reads live values through getters so post-/new, post-resume,
|
|
41
|
+
* and post-model.switch all broadcast the same shape.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createSessionStartPayload(g: SessionStartPayloadGetters): () => Promise<{
|
|
44
|
+
sessionId: string;
|
|
45
|
+
model: string;
|
|
46
|
+
provider: string;
|
|
47
|
+
maxContext: number;
|
|
48
|
+
inputCost: number;
|
|
49
|
+
outputCost: number;
|
|
50
|
+
cacheReadCost: number;
|
|
51
|
+
projectName: string;
|
|
52
|
+
projectRoot: string;
|
|
53
|
+
cwd: string;
|
|
54
|
+
mode: string;
|
|
55
|
+
contextMode: string;
|
|
56
|
+
needsSetup?: boolean | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export interface WsServerResult {
|
|
59
|
+
wssPrimary: WebSocketServer;
|
|
60
|
+
wssSecondary: WebSocketServer | null;
|
|
61
|
+
wsToken: string;
|
|
62
|
+
clients: Map<WebSocket, ConnectedClient>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create the primary (+ optional IPv6 secondary) WebSocket servers with
|
|
66
|
+
* CSWSH token auth. Returns the servers + the shared clients map.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createWsServers(ports: ResolvedPorts, accessToken: string | undefined): WsServerResult;
|
|
69
|
+
export interface EventArmingResult {
|
|
70
|
+
disposeEvents: () => void;
|
|
71
|
+
fleetBroadcast: () => Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Wire setupEvents (the once-only event→WS-broadcast bridge) behind a
|
|
75
|
+
* listening-callback guard, and attach WS server error handlers. Returns
|
|
76
|
+
* the dispose + fleet-broadcast functions.
|
|
77
|
+
*/
|
|
78
|
+
export declare function armEvents(wssPrimary: WebSocketServer, wssSecondary: WebSocketServer | null, wsHost: string, wsPort: number, setupInput: Parameters<typeof setupEvents>[0], watcherMetrics: FileWatcherMetrics): {
|
|
79
|
+
arm: (label: string) => void;
|
|
80
|
+
getDispose: () => (() => void) | null;
|
|
81
|
+
getFleetBroadcast: () => (() => Promise<void>) | null;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the directory containing the built WebUI frontend assets.
|
|
85
|
+
*
|
|
86
|
+
* The standalone webui-server package does not bundle the React frontend;
|
|
87
|
+
* it lives in the separate `@wrongstack/webui` package. Callers can pass an
|
|
88
|
+
* explicit `distDir`; when they don't, we try to resolve the frontend package
|
|
89
|
+
* relative to the server entry that is asking. This lets the standalone
|
|
90
|
+
* `wstackui` binary serve the webui assets when both packages are installed,
|
|
91
|
+
* while also allowing embedded callers (e.g. the desktop app) to pass an exact
|
|
92
|
+
* path so they don't depend on module-resolution layout.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveWebuiDistDir(fromUrl: string, explicitDistDir?: string | undefined): string;
|
|
95
|
+
export declare function startHttpServer(opts: {
|
|
96
|
+
wsHost: string;
|
|
97
|
+
httpPort: number;
|
|
98
|
+
wsPort: number;
|
|
99
|
+
wsToken: string;
|
|
100
|
+
publicWsUrl: string | undefined;
|
|
101
|
+
publicUrl: string | undefined;
|
|
102
|
+
requireToken: boolean;
|
|
103
|
+
globalRoot: string;
|
|
104
|
+
globalConfigPath: string;
|
|
105
|
+
projectRoot: string;
|
|
106
|
+
openBrowser: boolean;
|
|
107
|
+
watcherMetrics: FileWatcherMetrics;
|
|
108
|
+
onFleetPing: () => void;
|
|
109
|
+
distDir?: string | undefined;
|
|
110
|
+
}): import('node:http').Server;
|
|
111
|
+
export interface ShutdownDeps {
|
|
112
|
+
flushSession: () => Promise<void>;
|
|
113
|
+
clients: () => IterableIterator<WebSocket>;
|
|
114
|
+
servers: Array<import('node:http').Server | WebSocketServer>;
|
|
115
|
+
onShutdown: () => Promise<void> | void;
|
|
116
|
+
}
|
|
117
|
+
export declare function registerShutdown(deps: ShutdownDeps): void;
|
|
118
|
+
//# sourceMappingURL=server-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-runtime.d.ts","sourceRoot":"","sources":["../../src/server/server-runtime.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,IAAI,CAAC;AAQrD,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACpC,GAAG,OAAO,CAAC,aAAa,CAAC,CAyBzB;AAID,MAAM,WAAW,0BAA0B;IACzC,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AAC,CAAC;IAC3C,OAAO,EAAE,KAAK,CAAC,OAAO,WAAW,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC;IAC7D,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAOzD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import { type Context, type SessionStore, type ToolRegistry, type createStrategyCompactor } from '@wrongstack/core';
|
|
3
|
+
import type { DefaultTokenCounter } from '@wrongstack/core/infrastructure';
|
|
4
|
+
import type { ConnectedClient } from './types.js';
|
|
5
|
+
import type { SessionRouteHandlers } from './session-routes.js';
|
|
6
|
+
import type { CustomModeStore } from './custom-context-modes.js';
|
|
7
|
+
type Session = Awaited<ReturnType<SessionStore['create']>>;
|
|
8
|
+
type SessionStartPayload = {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
model: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
maxContext: number;
|
|
13
|
+
inputCost: number;
|
|
14
|
+
outputCost: number;
|
|
15
|
+
cacheReadCost: number;
|
|
16
|
+
projectName: string;
|
|
17
|
+
projectRoot: string;
|
|
18
|
+
cwd: string;
|
|
19
|
+
mode: string;
|
|
20
|
+
contextMode: string;
|
|
21
|
+
};
|
|
22
|
+
export interface SessionHandlersContext {
|
|
23
|
+
config: {
|
|
24
|
+
provider: string;
|
|
25
|
+
model: string;
|
|
26
|
+
};
|
|
27
|
+
clients: Map<WebSocket, ConnectedClient>;
|
|
28
|
+
context: Context;
|
|
29
|
+
toolRegistry: ToolRegistry;
|
|
30
|
+
compactor: ReturnType<typeof createStrategyCompactor>;
|
|
31
|
+
customModeStore: CustomModeStore;
|
|
32
|
+
tokenCounter: DefaultTokenCounter;
|
|
33
|
+
/** Live reads of the mutable startWebUI bindings. */
|
|
34
|
+
getProjectRoot: () => string;
|
|
35
|
+
getSession: () => Session;
|
|
36
|
+
getSessionStore: () => SessionStore;
|
|
37
|
+
/** Mutations of the startWebUI bindings. */
|
|
38
|
+
setSession: (s: Session) => void;
|
|
39
|
+
setSessionStartedAt: (t: number) => void;
|
|
40
|
+
sessionStartPayload: () => Promise<SessionStartPayload>;
|
|
41
|
+
}
|
|
42
|
+
export declare function createSessionHandlers(ctx: SessionHandlersContext): SessionRouteHandlers;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=session-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-handlers.d.ts","sourceRoot":"","sources":["../../src/server/session-handlers.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAG7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAUjE,KAAK,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE3D,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;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACtD,eAAe,EAAE,eAAe,CAAC;IACjC,YAAY,EAAE,mBAAmB,CAAC;IAClC,qDAAqD;IACrD,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,YAAY,CAAC;IACpC,4CAA4C;IAC5C,UAAU,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,mBAAmB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,mBAAmB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,sBAAsB,GAAG,oBAAoB,CAsYvF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { WSClientMessage } from './types.js';
|
|
3
|
+
export interface SessionRouteHandlers {
|
|
4
|
+
newSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
5
|
+
clearContext: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
6
|
+
debugContext: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
7
|
+
compactContext: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
8
|
+
repairContext: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
9
|
+
listContextModes: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
10
|
+
switchContextMode: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
11
|
+
createContextMode: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
12
|
+
updateContextMode: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
13
|
+
deleteContextMode: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
14
|
+
listSessions: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
15
|
+
renameSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
16
|
+
deleteSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
17
|
+
resumeSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
18
|
+
saveSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
19
|
+
listCheckpoints: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
20
|
+
rewindSession: (ws: WebSocket, msg: WSClientMessage) => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare function handleSessionRoute(ws: WebSocket, msg: WSClientMessage, handlers: SessionRouteHandlers): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=session-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-routes.d.ts","sourceRoot":"","sources":["../../src/server/session-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,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,YAAY,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,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