@wrongstack/webui-server 0.313.0 → 0.316.1
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.js +4739 -1302
- package/dist/server/agent-roster-handlers.d.ts +3 -2
- package/dist/server/backend-services.d.ts +33 -1
- package/dist/server/boot.d.ts +2 -1
- package/dist/server/brain-handlers.d.ts +21 -4
- package/dist/server/chimera-routes.d.ts +88 -0
- package/dist/server/codebase-index-server-control.d.ts +2 -1
- package/dist/server/codebase-indexing.d.ts +3 -2
- package/dist/server/codemap-cache.d.ts +0 -5
- package/dist/server/codemap-handlers.d.ts +2 -1
- package/dist/server/collab/controller.d.ts +0 -2
- package/dist/server/collab/session-registry.d.ts +2 -1
- package/dist/server/connection-handler.d.ts +2 -1
- package/dist/server/connections/auto-healer.d.ts +5 -6
- package/dist/server/connections/collector.d.ts +0 -3
- package/dist/server/connections/helpers.d.ts +0 -2
- package/dist/server/connections/service-actions.d.ts +0 -4
- package/dist/server/content-routes.d.ts +6 -1
- package/dist/server/conversation-operations.d.ts +18 -2
- package/dist/server/deadcode-handlers.d.ts +2 -1
- package/dist/server/design-handlers.d.ts +6 -0
- package/dist/server/discover-mailbox-bridge.d.ts +2 -1
- package/dist/server/embedded-host-adapters.d.ts +120 -2
- package/dist/server/embedded-message-router.d.ts +15 -1
- package/dist/server/entry.js +4323 -1086
- package/dist/server/file-handlers.d.ts +5 -2
- package/dist/server/git-handlers.d.ts +19 -0
- package/dist/server/governance-runtime.d.ts +1 -1
- package/dist/server/handlers.js +6 -9
- package/dist/server/http-server/analytics-handler.d.ts +0 -2
- package/dist/server/http-server/security-helpers.d.ts +0 -6
- package/dist/server/http-server/vector-memory-handlers.d.ts +2 -56
- package/dist/server/index.d.ts +12 -5
- package/dist/server/introspection-routes.d.ts +16 -0
- package/dist/server/kanban-contract-routes.d.ts +19 -1
- package/dist/server/kanban-decomposition-routes.d.ts +4 -1
- package/dist/server/kanban-dispatch.d.ts +2 -0
- package/dist/server/kanban-route-helpers.d.ts +21 -0
- package/dist/server/kanban-routes.d.ts +13 -1
- package/dist/server/kanban-supervisor.d.ts +2 -0
- package/dist/server/kanban-task-routes.d.ts +4 -1
- package/dist/server/lifecycle.d.ts +2 -1
- package/dist/server/mcp-handlers.d.ts +2 -1
- package/dist/server/message-dispatcher.d.ts +19 -5
- package/dist/server/mode-handlers.d.ts +6 -4
- package/dist/server/mode-operations.d.ts +15 -4
- package/dist/server/model-catalog-search.d.ts +2 -1
- package/dist/server/model-operations.d.ts +6 -2
- package/dist/server/pending-confirms.d.ts +27 -1
- package/dist/server/port-utils.d.ts +16 -2
- package/dist/server/pref-helpers.d.ts +1 -1
- package/dist/server/prefs-handlers.d.ts +43 -6
- package/dist/server/prefs-routes.d.ts +11 -2
- package/dist/server/process-handlers.d.ts +12 -5
- package/dist/server/project-handlers.d.ts +12 -0
- package/dist/server/project-watcher.d.ts +19 -10
- package/dist/server/provider/mutations.d.ts +0 -1
- package/dist/server/provider-fanout.d.ts +46 -0
- package/dist/server/provider-handlers.d.ts +6 -2
- package/dist/server/provider-routes.d.ts +3 -0
- package/dist/server/provider-store.d.ts +2 -1
- package/dist/server/requirement-intake-handlers.d.ts +0 -2
- package/dist/server/route-family-dispatcher.d.ts +2 -0
- package/dist/server/routes.d.ts +41 -5
- package/dist/server/sdd-board-ws-handler.d.ts +2 -2
- package/dist/server/server-runtime.d.ts +23 -6
- package/dist/server/session-agent-registry.d.ts +145 -0
- package/dist/server/session-agent-sessions.d.ts +49 -0
- package/dist/server/session-cleanup-scheduler.d.ts +3 -2
- package/dist/server/session-deletion.d.ts +1 -0
- package/dist/server/session-handlers.d.ts +82 -1
- package/dist/server/session-history.d.ts +4 -3
- package/dist/server/session-routes.d.ts +2 -0
- package/dist/server/session-scoped-prefs.d.ts +28 -0
- package/dist/server/setup-events-core-watchers.d.ts +7 -2
- package/dist/server/setup-events-fleet-broadcaster.d.ts +7 -2
- package/dist/server/setup-events-pattern-handlers.d.ts +5 -1
- package/dist/server/setup-events-provider-handlers.d.ts +1 -1
- package/dist/server/setup-events-session-helpers.d.ts +14 -1
- package/dist/server/setup-events-status-watcher.d.ts +7 -2
- package/dist/server/setup-events-subagent-handlers.d.ts +5 -1
- package/dist/server/setup-events-tool-handlers.d.ts +14 -1
- package/dist/server/setup-events.d.ts +21 -1
- package/dist/server/setup-screen.d.ts +3 -2
- package/dist/server/shell-git-routes.d.ts +4 -0
- package/dist/server/standalone-session-identity.d.ts +3 -3
- package/dist/server/start-webui-proxy-apply.d.ts +2 -1
- package/dist/server/start-webui-shutdown.d.ts +15 -0
- package/dist/server/system-prompt-handlers.d.ts +67 -0
- package/dist/server/system-prompt-rebuild.d.ts +45 -0
- package/dist/server/terminal-dashboard.d.ts +145 -0
- package/dist/server/types.d.ts +33 -4
- package/dist/server/webui-status-logger.d.ts +61 -0
- package/dist/server/worklist-routes.d.ts +8 -2
- package/dist/server/worklist-session-context.d.ts +44 -0
- package/dist/server/worktree-ws-handler.d.ts +2 -1
- package/dist/server/ws-payload-validation.d.ts +27 -2
- package/dist/server/ws-utils.d.ts +29 -4
- package/package.json +15 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Agent } from '@wrongstack/core/agent';
|
|
1
|
+
import type { Agent, Context } from '@wrongstack/core/agent';
|
|
2
2
|
import { type EventBus } from '@wrongstack/core/kernel';
|
|
3
3
|
import type { Config, MemoryPort, ModelsRegistry, ModeStore, ProviderConfig, SessionStore, SessionWriter } from '@wrongstack/core/types';
|
|
4
4
|
import type { WebSocket } from 'ws';
|
|
@@ -6,6 +6,7 @@ import type { ConversationRouteHandlers } from './conversation-routes.js';
|
|
|
6
6
|
import type { CustomModeStore } from './custom-context-modes.js';
|
|
7
7
|
import type { PendingConfirm } from './pending-confirms.js';
|
|
8
8
|
import type { ProjectRouteHandlers } from './project-routes.js';
|
|
9
|
+
import type { LoadAgentSessions } from './session-agent-sessions.js';
|
|
9
10
|
import type { SessionRouteHandlers } from './session-routes.js';
|
|
10
11
|
import type { SessionIdentityTarget } from './standalone-session-identity.js';
|
|
11
12
|
import type { WSServerMessage } from './types.js';
|
|
@@ -33,7 +34,16 @@ export interface EmbeddedAgentConfigContext extends EmbeddedHostTransport {
|
|
|
33
34
|
onMaxContextResolved?: ((providerId: string, modelId: string, maxContext: number) => void) | undefined;
|
|
34
35
|
persistPrefs?: ((payload: Record<string, unknown>) => Promise<void>) | undefined;
|
|
35
36
|
}
|
|
36
|
-
export declare function applyEmbeddedModelSwitch(ctx: EmbeddedAgentConfigContext, providerId: string, modelId: string
|
|
37
|
+
export declare function applyEmbeddedModelSwitch(ctx: EmbeddedAgentConfigContext, providerId: string, modelId: string,
|
|
38
|
+
/**
|
|
39
|
+
* The tab that asked. A model switch rebuilds the provider, the model, the
|
|
40
|
+
* context ceiling and the price table OF ONE CONVERSATION; applying it to
|
|
41
|
+
* `ctx.agent.ctx` — the leader, i.e. the boot tab's runtime — meant that
|
|
42
|
+
* choosing a model in ANY tab re-pointed the boot tab instead, and left the
|
|
43
|
+
* asking tab still running the model it had. Resolved through the caller so
|
|
44
|
+
* hosts without a registry keep the single-context behaviour.
|
|
45
|
+
*/
|
|
46
|
+
targetContext?: Context | undefined): Promise<void>;
|
|
37
47
|
export declare function createEmbeddedProviderOperations(ctx: EmbeddedProviderContext): {
|
|
38
48
|
handleProvidersList: (ws: WebSocket) => Promise<void>;
|
|
39
49
|
handleProvidersSaved: (ws: WebSocket) => Promise<void>;
|
|
@@ -73,9 +83,47 @@ export declare function createEmbeddedProviderOperations(ctx: EmbeddedProviderCo
|
|
|
73
83
|
};
|
|
74
84
|
export interface EmbeddedConversationContext extends EmbeddedHostTransport {
|
|
75
85
|
agent: Agent;
|
|
86
|
+
/**
|
|
87
|
+
* The Agent that owns ONE session's runs.
|
|
88
|
+
*
|
|
89
|
+
* Without this every tab was handed `ctx.agent`, the single leader instance,
|
|
90
|
+
* and the second tab to start a run walked straight into `Agent.run()`'s
|
|
91
|
+
* concurrency guard — "already in progress on this instance". The guard is
|
|
92
|
+
* correct; one Agent for four tabs was not. Hosts supply a per-session
|
|
93
|
+
* registry (see `session-agent-registry.ts`); omitting it keeps the old
|
|
94
|
+
* single-agent behaviour for hosts that genuinely have one session.
|
|
95
|
+
*/
|
|
96
|
+
getAgent?: ((sessionId?: string | undefined) => Agent) | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Non-creating registry lookup for session-ownership checks. `getAgent`
|
|
99
|
+
* CREATES on read, so using it to ask "does this host serve session X?"
|
|
100
|
+
* materialised an agent for every id a client ever typed; `peekAgent`
|
|
101
|
+
* answers the same question without side effects. Optional: hosts without
|
|
102
|
+
* a registry omit it and keep the single-session behaviour.
|
|
103
|
+
*/
|
|
104
|
+
peekAgent?: ((sessionId?: string | undefined) => Agent | undefined) | undefined;
|
|
76
105
|
/** Session-keyed abort controllers — one active run per session. */
|
|
77
106
|
abortControllers: Map<string, AbortController>;
|
|
78
107
|
pendingConfirms: Map<string, PendingConfirm>;
|
|
108
|
+
/**
|
|
109
|
+
* Stop the subagents a session spawned. Called when that session's run is
|
|
110
|
+
* aborted: killing the leader's controller only unwinds workers it is
|
|
111
|
+
* blocked on, so async ones keep running unless someone asks them to stop.
|
|
112
|
+
*/
|
|
113
|
+
stopSessionFleet?: ((sessionId: string) => void | Promise<void>) | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* The host's session-transition serialiser, SHARED with the session routes.
|
|
116
|
+
*
|
|
117
|
+
* `user_message` setup reads and mutates the target agent's context, so it
|
|
118
|
+
* must not interleave with a `session.new` / `session.resume` that is
|
|
119
|
+
* halfway through re-pointing writers and contexts. The standalone host has
|
|
120
|
+
* always passed its gate here; this one passed nothing, so
|
|
121
|
+
* `createConversationOperations` fell back to a pass-through and the CLI
|
|
122
|
+
* host — the one people actually run — serialised transitions against each
|
|
123
|
+
* other but never against turn setup. Only the SETUP is gated; runs proceed
|
|
124
|
+
* outside it so four tabs still stream concurrently.
|
|
125
|
+
*/
|
|
126
|
+
withSessionTransition?: (<T>(operation: () => Promise<T>) => Promise<T>) | undefined;
|
|
79
127
|
}
|
|
80
128
|
export declare function createEmbeddedConversationRoutes(ctx: EmbeddedConversationContext): ConversationRouteHandlers;
|
|
81
129
|
export interface EmbeddedSessionOptions {
|
|
@@ -93,10 +141,66 @@ export interface EmbeddedSessionContext extends EmbeddedHostTransport {
|
|
|
93
141
|
opts: EmbeddedSessionOptions;
|
|
94
142
|
buildSessionStart: (overrides?: Record<string, unknown>) => Promise<unknown>;
|
|
95
143
|
getCustomModeStore: () => Promise<CustomModeStore>;
|
|
144
|
+
/**
|
|
145
|
+
* The Agent that owns one session — the same registry the conversation
|
|
146
|
+
* routes use. Session transitions re-point a CONTEXT (writer, messages,
|
|
147
|
+
* todos, plan/task paths); without this they re-point the leader's, so
|
|
148
|
+
* resuming tab 2 rewrote the context tab 1 was running in.
|
|
149
|
+
*/
|
|
150
|
+
getAgent?: ((sessionId?: string | undefined) => Agent) | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Non-creating registry lookup for session-ownership checks — same reason
|
|
153
|
+
* as `EmbeddedConversationContext.peekAgent`: asking "can this host serve
|
|
154
|
+
* session X?" through the creating `getAgent` materialised agents for ids
|
|
155
|
+
* no client ever opened.
|
|
156
|
+
*/
|
|
157
|
+
peekAgent?: ((sessionId?: string | undefined) => Agent | undefined) | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* The host's own "which tab is in front" pointer, and its setter.
|
|
160
|
+
*
|
|
161
|
+
* Multi-session hosts MUST supply both. Without them the pointer is the
|
|
162
|
+
* leader agent's `ctx.session` — but the leader agent is simultaneously the
|
|
163
|
+
* RUNTIME of the boot tab, so re-pointing it to another tab's writer made
|
|
164
|
+
* the boot tab write into that tab's journal, and did so mid-run if the boot
|
|
165
|
+
* tab was busy. With them, the pointer moves and no agent's context is
|
|
166
|
+
* touched except the one that owns the session.
|
|
167
|
+
*/
|
|
168
|
+
getForegroundSession?: (() => SessionWriter) | undefined;
|
|
169
|
+
setForegroundSession?: ((next: SessionWriter) => void) | undefined;
|
|
170
|
+
/** Does this host already hold an open writer for that session? */
|
|
171
|
+
isSessionLive?: ((sessionId: string) => boolean) | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Read back NAMED subagents' transcripts, so a replayed session brings its
|
|
174
|
+
* fleet panel back with it. See `session-agent-sessions.ts`.
|
|
175
|
+
*/
|
|
176
|
+
loadAgentSessions?: LoadAgentSessions | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Per-connection display registry, so `session.subscribe` is honoured and
|
|
179
|
+
* "which sessions are on screen right now" has an answer.
|
|
180
|
+
*
|
|
181
|
+
* Only the two session fields are read through this path (the embedded host
|
|
182
|
+
* supplies its own send/broadcast), so a host may keep a leaner client
|
|
183
|
+
* record than the standalone server's `ConnectedClient`. Without it a
|
|
184
|
+
* background tab's session is invisible to the delete guard and to agent
|
|
185
|
+
* eviction — both then treat an open tab as abandoned.
|
|
186
|
+
*/
|
|
187
|
+
clients?: Map<WebSocket, {
|
|
188
|
+
sessionId: string | null;
|
|
189
|
+
sessionIds?: Set<string> | undefined;
|
|
190
|
+
}> | undefined;
|
|
191
|
+
/** Sessions no connection is displaying any more — retire their agents. */
|
|
192
|
+
onSessionsUndisplayed?: ((sessionIds: string[]) => void) | undefined;
|
|
96
193
|
/** When sessionId is provided, abort only that session's run; otherwise abort all. */
|
|
97
194
|
abortActiveRun?: ((sessionId?: string) => void) | undefined;
|
|
98
195
|
/** True while an embedded agent run is active. */
|
|
99
196
|
isRunActive?: ((sessionId?: string) => boolean) | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* The host's session-transition serialiser, SHARED with the conversation
|
|
199
|
+
* routes. Omitting it leaves the session handlers to create a PRIVATE gate,
|
|
200
|
+
* which orders transitions against each other but not against turn setup —
|
|
201
|
+
* see the note on `EmbeddedConversationContext.withSessionTransition`.
|
|
202
|
+
*/
|
|
203
|
+
withSessionTransition?: (<T>(operation: () => Promise<T>) => Promise<T>) | undefined;
|
|
100
204
|
}
|
|
101
205
|
export declare function createEmbeddedSessionRoutes(ctx: EmbeddedSessionContext): SessionRouteHandlers;
|
|
102
206
|
export declare function broadcastEmbeddedGoalSnapshot(ctx: EmbeddedSessionContext): Promise<void>;
|
|
@@ -108,6 +212,20 @@ export interface EmbeddedProjectContext extends EmbeddedHostTransport {
|
|
|
108
212
|
abortControllers: Map<string, AbortController>;
|
|
109
213
|
abortLegacyRun: () => void;
|
|
110
214
|
buildSessionStart: (overrides?: Record<string, unknown>) => Promise<unknown>;
|
|
215
|
+
/**
|
|
216
|
+
* The host's foreground-session pointer — the same one the session routes
|
|
217
|
+
* move. A project switch retires every session in the process, so the
|
|
218
|
+
* pointer has to follow it here too or the host keeps naming a session that
|
|
219
|
+
* belongs to the previous project.
|
|
220
|
+
*/
|
|
221
|
+
getForegroundSession?: (() => SessionWriter) | undefined;
|
|
222
|
+
setForegroundSession?: ((next: SessionWriter) => void) | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Deliver to every connection regardless of what it displays. The project
|
|
225
|
+
* switch needs it: `broadcast` routes on the payload's session, and the
|
|
226
|
+
* switch announces one no client has had a chance to subscribe to.
|
|
227
|
+
*/
|
|
228
|
+
broadcastEveryone?: ((message: WSServerMessage) => void) | undefined;
|
|
111
229
|
}
|
|
112
230
|
export declare function createEmbeddedProjectRoutes(ctx: EmbeddedProjectContext): ProjectRouteHandlers;
|
|
113
231
|
//# sourceMappingURL=embedded-host-adapters.d.ts.map
|
|
@@ -5,6 +5,7 @@ import type { Logger, MemoryPort } from '@wrongstack/core/types';
|
|
|
5
5
|
import type { MCPRegistry } from '@wrongstack/mcp';
|
|
6
6
|
import type { WebSocket } from 'ws';
|
|
7
7
|
import { type BrainHandlerContext } from './brain-handlers.js';
|
|
8
|
+
import type { ChimeraRouteHandlers } from './chimera-routes.js';
|
|
8
9
|
import type { DesignContext } from './design-handlers.js';
|
|
9
10
|
import { type EmbeddedAgentConfigContext, type EmbeddedConversationContext, type EmbeddedProjectContext, type EmbeddedProviderContext, type EmbeddedSessionContext } from './embedded-host-adapters.js';
|
|
10
11
|
import type { GoalWebSocketHandler } from './goal-ws-handler.js';
|
|
@@ -53,13 +54,23 @@ export interface EmbeddedMessageRouterDeps {
|
|
|
53
54
|
introspectionCtx: IntrospectionRouteContext;
|
|
54
55
|
skillsCtx: SkillsContext;
|
|
55
56
|
promptsCtx: PromptsContext;
|
|
56
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Built per tab: the active design kit is pinned on the picking session's
|
|
59
|
+
* own meta, so the CLI host resolves that session's context here.
|
|
60
|
+
*/
|
|
61
|
+
designCtx: DesignContext | ((sessionId?: string | undefined) => DesignContext);
|
|
57
62
|
agentConfigCtx: EmbeddedAgentConfigContext;
|
|
58
63
|
prefsCtx: PrefsHandlerContext;
|
|
59
64
|
projectCtx: EmbeddedProjectContext;
|
|
60
65
|
sessionCtx: EmbeddedSessionContext;
|
|
61
66
|
conversationCtx: EmbeddedConversationContext;
|
|
62
67
|
mailboxRoutes: MailboxRouteHandlers;
|
|
68
|
+
/**
|
|
69
|
+
* Chimera review-report routes. Optional so an older CLI host (built before
|
|
70
|
+
* this family existed) can still construct the router — the tab then just
|
|
71
|
+
* never receives report-list answers instead of failing to boot.
|
|
72
|
+
*/
|
|
73
|
+
chimeraRoutes?: ChimeraRouteHandlers | undefined;
|
|
63
74
|
goalHandler: GoalWebSocketHandler;
|
|
64
75
|
specsHandler: SpecsWebSocketHandler;
|
|
65
76
|
sddBoardHandler: SddBoardWebSocketHandler;
|
|
@@ -70,6 +81,9 @@ export interface EmbeddedMessageRouterDeps {
|
|
|
70
81
|
/** Shared provider/model health tracker for the WebUI waiting-room panel.
|
|
71
82
|
* Undefined when the host has not wired one (e.g. test harnesses). */
|
|
72
83
|
statusTracker?: ProviderModelStatusTracker | undefined;
|
|
84
|
+
/** Durable block/open audit trail (JSONL) next to the profile config.
|
|
85
|
+
* Undefined when the host did not provide a profile path (test harnesses). */
|
|
86
|
+
providerAuditFile?: string | undefined;
|
|
73
87
|
}
|
|
74
88
|
export type EmbeddedMessageRouter = (ws: WebSocket, client: unknown, message: WSClientMessage) => Promise<void>;
|
|
75
89
|
export declare function createEmbeddedMessageRouter(deps: EmbeddedMessageRouterDeps): EmbeddedMessageRouter;
|