@wrongstack/webui-server 0.313.1 → 0.316.2
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 +4717 -1291
- 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 +4301 -1075
- 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 +16 -15
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* case 'files.tree': return handleFilesTree(ws, msg, projectRoot);
|
|
10
10
|
*/
|
|
11
11
|
import type { WebSocket } from 'ws';
|
|
12
|
-
|
|
12
|
+
interface FilesWriteOptions {
|
|
13
13
|
onWritten?: ((filePath: string) => void | Promise<void>) | undefined;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
@@ -23,7 +23,9 @@ export declare function handleFilesTree(ws: WebSocket, msg: unknown, projectRoot
|
|
|
23
23
|
/**
|
|
24
24
|
* Read a file's content for the Monaco editor.
|
|
25
25
|
*
|
|
26
|
-
* Guards against path traversal (`../` escapes)
|
|
26
|
+
* Guards against path traversal (`../` escapes) and, mirroring
|
|
27
|
+
* handleGitDiff, refuses oversized (over 2 MB) and binary files by replying
|
|
28
|
+
* with a `tooLarge` / `binary` flag instead of content. Responds with
|
|
27
29
|
* `{ type: 'files.read', payload: { filePath, content } }`.
|
|
28
30
|
*/
|
|
29
31
|
export declare function handleFilesRead(ws: WebSocket, msg: unknown, projectRoot: string): Promise<void>;
|
|
@@ -79,4 +81,5 @@ export declare function handleFilesRename(ws: WebSocket, msg: unknown, projectRo
|
|
|
79
81
|
* Responds with `{ type: 'files.moved', payload: { srcPath, destPath, success } }`.
|
|
80
82
|
*/
|
|
81
83
|
export declare function handleFilesMove(ws: WebSocket, msg: unknown, projectRoot: string): Promise<void>;
|
|
84
|
+
export {};
|
|
82
85
|
//# sourceMappingURL=file-handlers.d.ts.map
|
|
@@ -31,6 +31,21 @@ export interface GitChangedFile {
|
|
|
31
31
|
/** True when the change is at least partly staged. */
|
|
32
32
|
staged: boolean;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Compute the repo-relative prefix for a project root, normalized to
|
|
36
|
+
* forward slashes with a trailing separator ('' when the project root IS
|
|
37
|
+
* the repo root, or either side is unknown/escapes the repo).
|
|
38
|
+
*
|
|
39
|
+
* `git status --porcelain` always reports paths relative to the REPOSITORY
|
|
40
|
+
* root, while `files.tree` node paths are relative to the PROJECT root.
|
|
41
|
+
* When a subdirectory of the repo is opened as the project (e.g.
|
|
42
|
+
* `packages/webui`), git paths like `packages/webui/src/a.ts` carry a
|
|
43
|
+
* prefix the tree never emits — every explorer git badge would silently
|
|
44
|
+
* miss. Prepending this prefix to tree-relative paths aligns the two
|
|
45
|
+
* bases; separator normalization keeps it valid on Windows where
|
|
46
|
+
* `rev-parse --show-toplevel` may print either separator style.
|
|
47
|
+
*/
|
|
48
|
+
export declare function repoRelativePrefix(repoRoot: string, projectRoot: string): string;
|
|
34
49
|
/**
|
|
35
50
|
* Read the working-tree change set (everything that differs from HEAD:
|
|
36
51
|
* staged, unstaged, and untracked) and broadcast a `git.changes` message.
|
|
@@ -52,4 +67,8 @@ export declare function handleGitChanges(ws: WebSocket, projectRoot: string): Pr
|
|
|
52
67
|
* are reported with a flag instead of content so the client can show a notice.
|
|
53
68
|
*/
|
|
54
69
|
export declare function handleGitDiff(ws: WebSocket, projectRoot: string, path: string): Promise<void>;
|
|
70
|
+
export declare function handleGitStage(ws: WebSocket, projectRoot: string, paths: string[]): Promise<void>;
|
|
71
|
+
export declare function handleGitUnstage(ws: WebSocket, projectRoot: string, paths: string[]): Promise<void>;
|
|
72
|
+
export declare function handleGitDiscard(ws: WebSocket, projectRoot: string, paths: string[]): Promise<void>;
|
|
73
|
+
export declare function handleGitCommit(ws: WebSocket, projectRoot: string, message: string): Promise<void>;
|
|
55
74
|
//# sourceMappingURL=git-handlers.d.ts.map
|
|
@@ -11,7 +11,7 @@ interface WebUiGovernanceDependencies {
|
|
|
11
11
|
readonly load: () => Promise<GovernanceBootstrapModule>;
|
|
12
12
|
readonly createMutationBridge: typeof createGovernanceMutationSnapshotBridge;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
interface WebUiGovernanceRuntimeHandle {
|
|
15
15
|
installToolBoundary(pipelines: AgentPipelines): void;
|
|
16
16
|
close(): Promise<GovernanceRuntimeBootstrapCloseResult>;
|
|
17
17
|
}
|
package/dist/server/handlers.js
CHANGED
|
@@ -214,12 +214,6 @@ async function handleTaskUpdate(ctx, ws, payload) {
|
|
|
214
214
|
}
|
|
215
215
|
async function handlePlanGet(ctx, ws) {
|
|
216
216
|
const planPath = planPathOf(ctx);
|
|
217
|
-
const emptySnapshot = () => ({
|
|
218
|
-
version: 1,
|
|
219
|
-
sessionId: currentSessionId(ctx),
|
|
220
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
221
|
-
items: []
|
|
222
|
-
});
|
|
223
217
|
if (!planPath) {
|
|
224
218
|
ctx.send(ws, {
|
|
225
219
|
type: "plan.updated",
|
|
@@ -231,15 +225,18 @@ async function handlePlanGet(ctx, ws) {
|
|
|
231
225
|
return;
|
|
232
226
|
}
|
|
233
227
|
try {
|
|
234
|
-
|
|
228
|
+
let plan = await loadPlan(planPath);
|
|
229
|
+
if (!plan) {
|
|
230
|
+
plan = await mutatePlan(planPath, currentSessionId(ctx), (current) => current);
|
|
231
|
+
}
|
|
235
232
|
ctx.send(ws, {
|
|
236
233
|
type: "plan.updated",
|
|
237
|
-
payload: sessionPayload(ctx, { plan
|
|
234
|
+
payload: sessionPayload(ctx, { plan })
|
|
238
235
|
});
|
|
239
236
|
} catch {
|
|
240
237
|
ctx.send(ws, {
|
|
241
238
|
type: "plan.updated",
|
|
242
|
-
payload: sessionPayload(ctx, { plan:
|
|
239
|
+
payload: sessionPayload(ctx, { plan: emptyPlan(currentSessionId(ctx)) })
|
|
243
240
|
});
|
|
244
241
|
}
|
|
245
242
|
}
|
|
@@ -22,8 +22,6 @@ export interface AnalyticsEvent {
|
|
|
22
22
|
sessionId?: string | undefined;
|
|
23
23
|
userAgent?: string | undefined;
|
|
24
24
|
}
|
|
25
|
-
export declare const ANALYTICS_MAX_BODY_BYTES: number;
|
|
26
|
-
export declare const ANALYTICS_MAX_EVENT_BYTES: number;
|
|
27
25
|
/** POST /api/analytics — ingest a batch of events from the frontend. */
|
|
28
26
|
export declare function handleApiAnalyticsPost(res: http.ServerResponse, req: http.IncomingMessage): Promise<void>;
|
|
29
27
|
/** GET /api/analytics — retrieve the last N events (debug/export). */
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import type * as http from 'node:http';
|
|
2
2
|
export declare const MIME_TYPES: Record<string, string>;
|
|
3
|
-
export declare function escapeHtmlAttr(value: string): string;
|
|
4
3
|
export declare function injectWsConfig(html: string, opts: {
|
|
5
4
|
publicWsUrl?: string | undefined;
|
|
6
5
|
}): string;
|
|
7
|
-
export declare function firstHeader(value: string | string[] | undefined): string | undefined;
|
|
8
6
|
export declare const WS_TOKEN_COOKIE = "ws_token";
|
|
9
7
|
export declare const WS_TOKEN_COOKIE_SECURE = "__Host-ws_token";
|
|
10
|
-
export declare function wsTokenCookie(token: string, secure: boolean): string;
|
|
11
8
|
export declare function setAuthCookieHeaders(res: http.ServerResponse, token: string, secure: boolean): void;
|
|
12
9
|
export declare function setStaticSecurityHeaders(res: http.ServerResponse): void;
|
|
13
10
|
export declare function requestToken(req: http.IncomingMessage, url: URL, opts?: {
|
|
14
11
|
allowQuery?: boolean;
|
|
15
12
|
}): string | undefined;
|
|
16
13
|
export declare function isLoopbackPeer(req: http.IncomingMessage): boolean;
|
|
17
|
-
export declare function formatCspHostname(hostname: string): string;
|
|
18
|
-
export declare function cspSourceFromUrl(rawUrl: string): string | undefined;
|
|
19
|
-
export declare const EXTRA_SCRIPT_SOURCES: readonly string[];
|
|
20
14
|
export declare function buildCspHeader(publicWsUrl?: string | undefined, host?: string, port?: number): string;
|
|
21
15
|
export declare function isInsideDist(candidate: string, distDir: string): boolean;
|
|
22
16
|
export declare function decodeSessionId(segment: string): string;
|
|
@@ -8,24 +8,7 @@
|
|
|
8
8
|
import type * as http from 'node:http';
|
|
9
9
|
import type { VectorMemoryStore } from '@wrongstack/vector-memory';
|
|
10
10
|
import type { MemoryPort } from '@wrongstack/core/types';
|
|
11
|
-
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
storePath?: string | undefined;
|
|
14
|
-
modelCacheDir?: string | undefined;
|
|
15
|
-
providerId?: string | undefined;
|
|
16
|
-
modelId?: string | undefined;
|
|
17
|
-
dimensions?: number | undefined;
|
|
18
|
-
entries?: number | undefined;
|
|
19
|
-
vectors?: number | undefined;
|
|
20
|
-
providers?: string[] | undefined;
|
|
21
|
-
cache?: {
|
|
22
|
-
entries: number;
|
|
23
|
-
providers: number;
|
|
24
|
-
totalUseCount: number;
|
|
25
|
-
oldestLastUsedAt: string | null;
|
|
26
|
-
} | undefined;
|
|
27
|
-
}
|
|
28
|
-
export interface VectorMemorySearchHit {
|
|
11
|
+
interface VectorMemorySearchHit {
|
|
29
12
|
id: string;
|
|
30
13
|
score: number;
|
|
31
14
|
text: string;
|
|
@@ -44,18 +27,6 @@ export interface VectorMemorySearchResponse {
|
|
|
44
27
|
*/
|
|
45
28
|
similarity?: number[][] | undefined;
|
|
46
29
|
}
|
|
47
|
-
/** Shape the store exposes. Kept narrow so we don't leak the full class. */
|
|
48
|
-
export interface VectorMemorySnapshot {
|
|
49
|
-
storePath?: string | undefined;
|
|
50
|
-
modelCacheDir?: string | undefined;
|
|
51
|
-
stats: {
|
|
52
|
-
entries: number;
|
|
53
|
-
vectors: number;
|
|
54
|
-
providers: string[];
|
|
55
|
-
modelId: string;
|
|
56
|
-
dimensions: number;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
30
|
/** Handle `GET /api/vector-memory/status`. */
|
|
60
31
|
export declare function handleVectorMemoryStatus(res: http.ServerResponse, getStore: () => VectorMemoryStore | undefined, opts?: {
|
|
61
32
|
projectRoot?: string;
|
|
@@ -67,32 +38,6 @@ export declare function handleVectorMemorySearch(res: http.ServerResponse, url:
|
|
|
67
38
|
export declare function handleVectorMemoryStore(res: http.ServerResponse, req: http.IncomingMessage, getStore: () => VectorMemoryStore | undefined): Promise<void>;
|
|
68
39
|
/** Handle `DELETE /api/vector-memory/store/:id`. */
|
|
69
40
|
export declare function handleVectorMemoryForget(res: http.ServerResponse, url: URL, getStore: () => VectorMemoryStore | undefined): Promise<void>;
|
|
70
|
-
export interface MemorySearchHit {
|
|
71
|
-
id: string;
|
|
72
|
-
text: string;
|
|
73
|
-
kind: string;
|
|
74
|
-
status: string;
|
|
75
|
-
tags: string[];
|
|
76
|
-
/** Per-channel score breakdown — null on the side that didn't contribute. */
|
|
77
|
-
lexicalScore: number | null;
|
|
78
|
-
vectorScore: number | null;
|
|
79
|
-
/** RRF-style combined score, monotonically higher = better. */
|
|
80
|
-
finalScore: number;
|
|
81
|
-
/** Which channel(s) produced this hit. */
|
|
82
|
-
source: 'lexical' | 'vector' | 'both';
|
|
83
|
-
}
|
|
84
|
-
export interface MemorySearchResponse {
|
|
85
|
-
hits: MemorySearchHit[];
|
|
86
|
-
count: number;
|
|
87
|
-
/**
|
|
88
|
-
* Where the score breakdown came from. `breakdown` means the rich
|
|
89
|
-
* variant was used (vector channel was wired); `lexical` means the
|
|
90
|
-
* fallback synthesized a position-derived score because the surface
|
|
91
|
-
* doesn't ship `searchSageWithBreakdown`. The UI branches on this to
|
|
92
|
-
* decide whether to show a dual-column score card or a single column.
|
|
93
|
-
*/
|
|
94
|
-
channel: 'breakdown' | 'lexical';
|
|
95
|
-
}
|
|
96
41
|
/**
|
|
97
42
|
* Handle `GET /api/memory/search?q=…&limit=…&explain=1`.
|
|
98
43
|
*
|
|
@@ -105,4 +50,5 @@ export interface MemorySearchResponse {
|
|
|
105
50
|
* `channel: 'lexical'` so the caller can branch.
|
|
106
51
|
*/
|
|
107
52
|
export declare function handleMemorySearch(res: http.ServerResponse, url: URL, getStore: () => MemoryPort | undefined): Promise<void>;
|
|
53
|
+
export {};
|
|
108
54
|
//# sourceMappingURL=vector-memory-handlers.d.ts.map
|
package/dist/server/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { bootConfig, patchConfig } from './boot.js';
|
|
|
13
13
|
export { type BrainHandlerContext, type BrainLogEntry, type BrainTransportContext, handleBrainAsk, handleBrainConfigGet, handleBrainConfigSet, handleBrainRisk, handleBrainStatus, } from './brain-handlers.js';
|
|
14
14
|
export type { BrainRouteHandlers } from './brain-routes.js';
|
|
15
15
|
export { handleBrainRoute } from './brain-routes.js';
|
|
16
|
+
export { type ChimeraReportDetail, type ChimeraReportSummary, type ChimeraRouteHandlers, createChimeraRouteHandlers, type FindingWithEvents, handleChimeraRoute, listChimeraReportsForSession, queryAllChimeraReports, } from './chimera-routes.js';
|
|
16
17
|
export { type ChronicleRouteContext, handleChronicleRoute, } from './chronicle-routes.js';
|
|
17
18
|
export { createWebuiClientPresence, type WebuiClientPresence, type WebuiClientPresenceDeps, type WebuiHqConnection, type WebuiHqConnectionOptions, } from './client-presence.js';
|
|
18
19
|
export { type ClientTransportRouteHandlers, handleClientTransportRoute, } from './client-transport-routes.js';
|
|
@@ -38,7 +39,7 @@ export { createEternalSubscription, type EternalBroadcast, type EternalSubscribe
|
|
|
38
39
|
export { handleFilesCreate, handleFilesDelete, handleFilesList, handleFilesMove, handleFilesRead, handleFilesRename, handleFilesSkeleton, handleFilesTree, handleFilesWrite, } from './file-handlers.js';
|
|
39
40
|
export { isHiddenEntry, rankFiles, SKIP_DIRS } from './file-picker.js';
|
|
40
41
|
export { type EnsureDistDeps, ensureDistDir, findInstalledPackageJson, type ResolveDistOptions, resolveDistDir, type StaticServeDeps, type StaticServeHandle, type StaticServeOptions, startStaticServe, } from './frontend-static-serve.js';
|
|
41
|
-
export { handleGitChanges, handleGitDiff, handleGitInfo } from './git-handlers.js';
|
|
42
|
+
export { handleGitChanges, handleGitCommit, handleGitDiff, handleGitDiscard, handleGitInfo, handleGitStage, handleGitUnstage, repoRelativePrefix, } from './git-handlers.js';
|
|
42
43
|
export { handleGoalGet } from './goal-handlers.js';
|
|
43
44
|
export type { GoalRouteHandlers } from './goal-routes.js';
|
|
44
45
|
export { handleGoalRoute } from './goal-routes.js';
|
|
@@ -76,10 +77,10 @@ export { formatExternalAccessUrls, getExternalAddresses, type NetworkAddress, }
|
|
|
76
77
|
export { browserOpenCommand, openBrowser } from './open-browser.js';
|
|
77
78
|
export { isPathInside, resolveWorkingDirInsideProject } from './path-containment.js';
|
|
78
79
|
export type { ConfirmDecision, PendingConfirm } from './pending-confirms.js';
|
|
79
|
-
export { isDestructivePendingConfirm, resolveAllPendingConfirms, resolveYoloEligiblePendingConfirms, } from './pending-confirms.js';
|
|
80
|
+
export { isDestructivePendingConfirm, resolveAllPendingConfirms, resolvePendingConfirmsForSession, resolveYoloEligiblePendingConfirms, } from './pending-confirms.js';
|
|
80
81
|
export { findFreePort, getSurfaceDefaultPorts, isPortFree, isStrictPort, listenWithRetry, SURFACE_DEFAULT_PORTS, type SurfaceKind, surfaceLabel, } from './port-utils.js';
|
|
81
82
|
export { type ConfigWriteLockHolder, PREF_KEYS, type PrefHelperDeps, persistPrefsToConfig, prefSnapshot, } from './pref-helpers.js';
|
|
82
|
-
export { handleAutonomySwitch, handlePrefsGet, handlePrefsUpdate, type PrefsHandlerContext, } from './prefs-handlers.js';
|
|
83
|
+
export { handleAutonomySwitch, handlePrefsGet, handlePrefsUpdate, handleSystemPromptGet, type PrefsHandlerContext, SESSION_SCOPED_PREF_KEYS, } from './prefs-handlers.js';
|
|
83
84
|
export { createPrefsRouteHandlers, handlePrefsRoute, type PrefsRouteHandlers, } from './prefs-routes.js';
|
|
84
85
|
export { handleProcessKill, handleProcessKillAll, handleProcessList, } from './process-handlers.js';
|
|
85
86
|
export { handleProcessRoute, type ProcessRouteHandlers } from './process-routes.js';
|
|
@@ -103,9 +104,11 @@ export { SddBoardWebSocketHandler } from './sdd-board-ws-handler.js';
|
|
|
103
104
|
export { handleSddWizardRoute, type SddWizardRouteHandlers } from './sdd-wizard-routes.js';
|
|
104
105
|
export { buildSddWizardDeps, type SddWizardWiringOptions, type StartSddRunFromGraphConfig, type StartSddRunFromGraphDeps, startSddRunFromGraph, } from './sdd-wizard-wiring.js';
|
|
105
106
|
export { type SddWizardDeps, SddWizardWebSocketHandler } from './sdd-wizard-ws-handler.js';
|
|
107
|
+
export { createSessionAgentRegistry, type SessionAgentRegistry, type SessionAgentRegistryOptions, } from './session-agent-registry.js';
|
|
106
108
|
export { cleanupOwnerlessEmptySessions, DEFAULT_EMPTY_SESSION_CLEANUP_INTERVAL_MS, EMPTY_SESSION_CLEANUP_INTERVAL_ENV, resolveEmptySessionCleanupInterval, scheduleOwnerlessEmptySessionCleanup, } from './session-cleanup-scheduler.js';
|
|
107
109
|
export { deleteWebUISession } from './session-deletion.js';
|
|
108
|
-
export { createSessionHandlers, type SessionHandlersContext } from './session-handlers.js';
|
|
110
|
+
export { collectDisplayedSessionIds, createSessionHandlers, createSessionTransitionGate, type SessionHandlersContext, } from './session-handlers.js';
|
|
111
|
+
export { type AgentSessionPayload, type AgentVirtualSessionLike, buildAgentSessionsPayload, type LoadAgentSessions, } from './session-agent-sessions.js';
|
|
109
112
|
export { type SessionHistoryWireEntry, toSessionHistoryEntries, toSessionHistoryEntry, } from './session-history.js';
|
|
110
113
|
export type { SessionRouteHandlers } from './session-routes.js';
|
|
111
114
|
export { handleSessionRoute } from './session-routes.js';
|
|
@@ -118,15 +121,19 @@ export { handleSpecsRoute, type SpecsRouteHandlers } from './specs-routes.js';
|
|
|
118
121
|
export { SpecsWebSocketHandler } from './specs-ws-handler.js';
|
|
119
122
|
export { startWebUI } from './start-webui.js';
|
|
120
123
|
export { createStreamCoalescer, type StreamCoalescer, type StreamCoalescerDeps, type ToolProgressPayload, } from './stream-coalescer.js';
|
|
124
|
+
export { buildSystemPromptInfo, type SystemPromptInfoPayload, type SystemPromptSurface, type SystemPromptVariantInfo, unavailableSystemPromptInfo, } from './system-prompt-handlers.js';
|
|
125
|
+
export { rebuildSystemPrompt, type SystemPromptRebuildDeps, } from './system-prompt-rebuild.js';
|
|
126
|
+
export { type DashboardConsoleTarget, type DashboardSessionRow, type DashboardStdout, isWebUIVerboseEnv, prettifyStructuredLine, renderSessionPanelLines, startTerminalDashboard, type TerminalDashboard, type TerminalDashboardOptions, } from './terminal-dashboard.js';
|
|
121
127
|
export { TerminalWebSocketHandler } from './terminal-ws-handler.js';
|
|
122
128
|
export { type ContextBreakdown, estimateContextBreakdown, estimateTokens, type MessageTokenEntry, messagePreview, messageTokens, stringifyContent, type ToolTokenEntry, } from './token-estimator.js';
|
|
123
129
|
export type { BackendServices, ConnectedClient, WebUIOptions, WSClientMessage, WSServerMessage, } from './types.js';
|
|
124
130
|
export { type CostRates, computeUsageCost, getCostRates, type TokenUsage, } from './usage-cost.js';
|
|
131
|
+
export { buildSessionRows, formatSessionRowsBlock, type StatusSessionInfo, startWebUILiveStatusLogger, type WebUILiveStatusLoggerOptions, } from './webui-status-logger.js';
|
|
125
132
|
export { createWorklistRouteHandlers, handleWorklistRoute, type WorklistRouteContext, type WorklistRouteHandlers, } from './worklist-routes.js';
|
|
126
133
|
export { handleWorktreeRoute, type WorktreeRouteHandlers } from './worktree-routes.js';
|
|
127
134
|
export { WorktreeWebSocketHandler } from './worktree-ws-handler.js';
|
|
128
135
|
export { extractToken, extractTokenFromCookie, hostHeaderOk, isLoopbackBind, isLoopbackHostname, isWildcardBind, tokenMatches, type VerifyClientInput, verifyClient, } from './ws-auth.js';
|
|
129
136
|
export { validateAutonomySwitchPayload, validateBrainAskPayload, validateBrainRiskPayload, validateContextModeCreatePayload, validateContextModeDeletePayload, validateContextModeSwitchPayload, validateContextModeUpdatePayload, validateGitDiffPayload, validateMailboxAgentsPayload, validateMailboxMessagesPayload, validateMailboxPurgePayload, validateModelSwitchPayload, validateModeSwitchPayload, validatePlanTemplateUsePayload, validatePrefsUpdatePayload, validateProcessKillPayload, validateProjectsAddPayload, validateProjectsSelectPayload, validateShellOpenPayload, validateSkillsCreatePayload, validateSkillsEditPayload, validateWorkingDirSetPayload, } from './ws-payload-validation.js';
|
|
130
|
-
export { broadcast, buildWebUIAccessUrl, envFlag, errMessage, generateAuthToken, hostForBrowserUrl, resolveAuthToken, send, sendResult, sendSerialized, WEBUI_WS_MAX_BUFFERED_BYTES, } from './ws-utils.js';
|
|
137
|
+
export { broadcast, buildWebUIAccessUrl, clientWantsSession, envFlag, errMessage, generateAuthToken, hostForBrowserUrl, resolveAuthToken, send, sendResult, sendSerialized, WEBUI_WS_MAX_BUFFERED_BYTES, } from './ws-utils.js';
|
|
131
138
|
export { createZipBuffer, readZipEntries, type ZipEntryInput } from './zip.js';
|
|
132
139
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,7 +3,23 @@ import type { Config, ConfigStore, ModelsRegistry } from '@wrongstack/core/types
|
|
|
3
3
|
import type { WebSocket } from 'ws';
|
|
4
4
|
import type { WSClientMessage, WSServerMessage } from './types.js';
|
|
5
5
|
export interface IntrospectionRouteContext {
|
|
6
|
+
/** The runtime's agent — the fallback when the host has no registry. */
|
|
6
7
|
agent: Agent;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the agent that owns ONE session.
|
|
10
|
+
*
|
|
11
|
+
* `diag.get`, `stats.get` and `side_effects.list` describe a single
|
|
12
|
+
* conversation: its token counter, its message count, its side effects. The
|
|
13
|
+
* runtime's `agent` is the session it last SWITCHED to, which with four tabs
|
|
14
|
+
* open is a different tab from the asking one as often as not — so a
|
|
15
|
+
* background tab asking for its stats was answered with the foreground's
|
|
16
|
+
* numbers, stamped with the foreground's id (and then dropped by the
|
|
17
|
+
* browser's own session filter, leaving the panel blank).
|
|
18
|
+
*
|
|
19
|
+
* Hosts with a per-session agent registry pass this; single-session hosts
|
|
20
|
+
* omit it and keep exactly their old behaviour.
|
|
21
|
+
*/
|
|
22
|
+
getAgent?: ((sessionId?: string) => Agent | undefined) | undefined;
|
|
7
23
|
modelsRegistry?: ModelsRegistry | undefined;
|
|
8
24
|
configStore?: ConfigStore | undefined;
|
|
9
25
|
getConfig: () => Config;
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket routes for the card contract map.
|
|
3
|
+
*
|
|
4
|
+
* The three WebUI contract panels (`KanbanContractGraphPanel`,
|
|
5
|
+
* `KanbanContractGraphDashboard`, `KanbanContractGraphView`) render
|
|
6
|
+
* `board.contractGraph` and have always shown the empty state, because no
|
|
7
|
+
* surface could write one: the domain API existed and sat on the IPC wire
|
|
8
|
+
* allowlist, but nothing called it. These routes are the human half of closing
|
|
9
|
+
* that; `packages/tools/src/kanban-contract-actions.ts` is the agent half.
|
|
10
|
+
*
|
|
11
|
+
* Every mutation broadcasts the updated board so the open panels repaint,
|
|
12
|
+
* matching how the other kanban write routes behave.
|
|
13
|
+
*/
|
|
14
|
+
import type { Context } from '@wrongstack/core/agent';
|
|
1
15
|
import type { WebSocket } from 'ws';
|
|
2
16
|
import type { WSServerMessage } from './types.js';
|
|
3
|
-
|
|
17
|
+
interface KanbanContractRouteContext {
|
|
4
18
|
projectRoot: string;
|
|
19
|
+
context?: Context | undefined;
|
|
20
|
+
/** Tab that sent the request — the session every emitted event belongs to. */
|
|
21
|
+
requestSessionId?: string | undefined;
|
|
5
22
|
broadcast?: ((msg: WSServerMessage) => void) | undefined;
|
|
6
23
|
}
|
|
7
24
|
export declare function handleKanbanContractRoute(ws: WebSocket, type: string, payload: Record<string, unknown> | undefined, ctx: KanbanContractRouteContext): Promise<boolean>;
|
|
25
|
+
export {};
|
|
8
26
|
//# sourceMappingURL=kanban-contract-routes.d.ts.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Context } from '@wrongstack/core/agent';
|
|
2
2
|
import type { WebSocket } from 'ws';
|
|
3
3
|
import type { WSServerMessage } from './types.js';
|
|
4
|
-
|
|
4
|
+
interface KanbanDecompositionRouteContext {
|
|
5
5
|
projectRoot: string;
|
|
6
6
|
context?: Context | undefined;
|
|
7
|
+
/** Tab that sent the request — the session every emitted event belongs to. */
|
|
8
|
+
requestSessionId?: string | undefined;
|
|
7
9
|
broadcast?: ((msg: WSServerMessage) => void) | undefined;
|
|
8
10
|
}
|
|
9
11
|
export declare function handleKanbanDecompositionRoute(ws: WebSocket, type: string, payload: Record<string, unknown> | undefined, ctx: KanbanDecompositionRouteContext): Promise<boolean>;
|
|
12
|
+
export {};
|
|
10
13
|
//# sourceMappingURL=kanban-decomposition-routes.d.ts.map
|
|
@@ -28,6 +28,8 @@ export type KanbanTaskDispatcher = (description: string, opts?: {
|
|
|
28
28
|
export interface KanbanDispatchContext {
|
|
29
29
|
projectRoot: string;
|
|
30
30
|
context?: Context | undefined;
|
|
31
|
+
/** Tab that asked for the dispatch — the session that owns the work. */
|
|
32
|
+
requestSessionId?: string | undefined;
|
|
31
33
|
broadcast?: ((message: WSServerMessage) => void) | undefined;
|
|
32
34
|
dispatchTask?: KanbanTaskDispatcher | undefined;
|
|
33
35
|
}
|
|
@@ -6,11 +6,32 @@ export interface KanbanRouteHelperContext {
|
|
|
6
6
|
projectRoot: string;
|
|
7
7
|
context?: Context | undefined;
|
|
8
8
|
broadcast?: ((msg: WSServerMessage) => void) | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The session of the tab that sent THIS message.
|
|
11
|
+
*
|
|
12
|
+
* Board contents are addressed by `boardId`, so they never crossed tabs —
|
|
13
|
+
* but every activity entry and presence ping was stamped with
|
|
14
|
+
* `context.session`, the session the runtime last switched to. With four
|
|
15
|
+
* tabs open, tab 3 moving a card was recorded as tab 1's work. Set per
|
|
16
|
+
* message by `handleKanbanRoute`; absent on single-session hosts, where the
|
|
17
|
+
* runtime session is the only answer there is.
|
|
18
|
+
*/
|
|
19
|
+
requestSessionId?: string | undefined;
|
|
9
20
|
}
|
|
21
|
+
/** Who is acting: the tab that asked, falling back to the runtime session. */
|
|
22
|
+
export declare function actingSessionId(ctx: KanbanRouteHelperContext): string | undefined;
|
|
10
23
|
export declare function syncSessionSource(ctx: KanbanRouteHelperContext, task: KanbanTask, remove?: boolean): Promise<void>;
|
|
11
24
|
export declare function ok(ws: WebSocket, type: string, data?: unknown): void;
|
|
12
25
|
export declare function fail(ws: WebSocket, type: string, message: string): void;
|
|
13
26
|
export declare function has(payload: Record<string, unknown> | undefined, key: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Event context for a board mutation requested over the WebUI socket.
|
|
29
|
+
*
|
|
30
|
+
* Throws when no acting session can be resolved. Every WebUI board mutation
|
|
31
|
+
* arrives on a tab's socket, so a missing session is a wiring bug in the route
|
|
32
|
+
* (a handler that dropped `requestSessionId`), not a state to write an
|
|
33
|
+
* unattributed event from.
|
|
34
|
+
*/
|
|
14
35
|
export declare function activityContext(ctx: KanbanRouteHelperContext, actor?: string, note?: string): KanbanEventContext;
|
|
15
36
|
export declare function touchTaskPresence(ctx: KanbanRouteHelperContext, boardId: string, taskId: string): Promise<KanbanBoard | null>;
|
|
16
37
|
export declare function findTask(tasks: KanbanTask[], taskId: string): KanbanTask | undefined;
|
|
@@ -8,6 +8,16 @@ export { KANBAN_CLIENT_MESSAGE_TYPES } from './kanban-route-protocol.js';
|
|
|
8
8
|
export interface KanbanRouteContext {
|
|
9
9
|
projectRoot: string;
|
|
10
10
|
context?: Context | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Every session a tab is currently displaying.
|
|
13
|
+
*
|
|
14
|
+
* `context.session` is only the one the runtime last switched to. With four
|
|
15
|
+
* tabs open, guarding `kanban.delete` on that alone protected ONE live board
|
|
16
|
+
* and left the other three deletable out from under the tabs showing them.
|
|
17
|
+
* Hosts that track displayed tabs pass this; single-session hosts omit it
|
|
18
|
+
* and the runtime session remains the whole set.
|
|
19
|
+
*/
|
|
20
|
+
getDisplayedSessionIds?: (() => string[]) | undefined;
|
|
11
21
|
broadcast?: ((msg: WSServerMessage) => void) | undefined;
|
|
12
22
|
dispatchTask?: KanbanTaskDispatcher | undefined;
|
|
13
23
|
/**
|
|
@@ -17,6 +27,8 @@ export interface KanbanRouteContext {
|
|
|
17
27
|
* double-audit that happens when both paths refresh the same board concurrently.
|
|
18
28
|
*/
|
|
19
29
|
supervisor?: KanbanSupervisor | undefined;
|
|
30
|
+
/** Set per message by `handleKanbanRoute` — see `KanbanRouteHelperContext`. */
|
|
31
|
+
requestSessionId?: string | undefined;
|
|
20
32
|
}
|
|
21
|
-
export declare function handleKanbanRoute(ws: WebSocket, msg: WSClientMessage,
|
|
33
|
+
export declare function handleKanbanRoute(ws: WebSocket, msg: WSClientMessage, rawCtx: KanbanRouteContext): Promise<boolean>;
|
|
22
34
|
//# sourceMappingURL=kanban-routes.d.ts.map
|
|
@@ -4,6 +4,8 @@ export interface KanbanSupervisorDispatchOptions {
|
|
|
4
4
|
model?: string | undefined;
|
|
5
5
|
fallbackProfile?: string | undefined;
|
|
6
6
|
fallbackModels?: string[] | undefined;
|
|
7
|
+
/** Named cost level; resolved against `modelTiers` at dispatch time. */
|
|
8
|
+
tier?: string | undefined;
|
|
7
9
|
skills?: string[] | undefined;
|
|
8
10
|
name?: string | undefined;
|
|
9
11
|
/**
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Context } from '@wrongstack/core/agent';
|
|
2
2
|
import type { WebSocket } from 'ws';
|
|
3
3
|
import type { WSServerMessage } from './types.js';
|
|
4
|
-
|
|
4
|
+
interface KanbanTaskRouteContext {
|
|
5
5
|
projectRoot: string;
|
|
6
6
|
context?: Context | undefined;
|
|
7
|
+
/** Tab that sent the request — the session every emitted event belongs to. */
|
|
8
|
+
requestSessionId?: string | undefined;
|
|
7
9
|
broadcast?: ((msg: WSServerMessage) => void) | undefined;
|
|
8
10
|
}
|
|
9
11
|
export declare function handleKanbanTaskRoute(ws: WebSocket, type: string, payload: Record<string, unknown> | undefined, ctx: KanbanTaskRouteContext): Promise<boolean>;
|
|
12
|
+
export {};
|
|
10
13
|
//# sourceMappingURL=kanban-task-routes.d.ts.map
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* sequence can be unit tested without a real process signal, server, or
|
|
12
12
|
* `process.exit` — `log` and `exit` are injectable seams.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
interface LifecycleResources {
|
|
15
15
|
/** Persist + close the active session (best-effort; errors are logged). */
|
|
16
16
|
flushSession: () => Promise<void>;
|
|
17
17
|
/**
|
|
@@ -61,4 +61,5 @@ export declare function createShutdown(res: LifecycleResources): () => Promise<v
|
|
|
61
61
|
* function that detaches both listeners (useful for tests and clean restarts).
|
|
62
62
|
*/
|
|
63
63
|
export declare function registerShutdownHandlers(res: LifecycleResources): () => void;
|
|
64
|
+
export {};
|
|
64
65
|
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -13,7 +13,7 @@ import type { TrustBoundary } from '@wrongstack/core/security';
|
|
|
13
13
|
import type { WebSocket } from 'ws';
|
|
14
14
|
import type { WSClientMessage } from './types.js';
|
|
15
15
|
/** Wire view of a server as the browser MCP panel consumes it. */
|
|
16
|
-
|
|
16
|
+
interface MCPServerView {
|
|
17
17
|
name: string;
|
|
18
18
|
transport: string;
|
|
19
19
|
status: 'stopped' | 'connecting' | 'connected' | 'sleeping' | 'discovering' | 'error';
|
|
@@ -59,4 +59,5 @@ export declare function handleMcpPrompts(ws: WebSocket, msg: WSClientMessage, _g
|
|
|
59
59
|
export declare function handleMcpResourceRead(ws: WebSocket, msg: WSClientMessage, _globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
|
|
60
60
|
/** mcp.prompt.get — explicit user selection; prompt argument values stay out of provenance. */
|
|
61
61
|
export declare function handleMcpPromptGet(ws: WebSocket, msg: WSClientMessage, _globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
|
|
62
|
+
export {};
|
|
62
63
|
//# sourceMappingURL=mcp-handlers.d.ts.map
|
|
@@ -26,12 +26,26 @@ import type { ConnectedClient, WSClientMessage } from './types.js';
|
|
|
26
26
|
* so a second user_message while running is rejected and a project swap can
|
|
27
27
|
* tear down the in-flight run.
|
|
28
28
|
*/
|
|
29
|
+
/**
|
|
30
|
+
* Run locks, one per conversation.
|
|
31
|
+
*
|
|
32
|
+
* There is no "the run" and no current session: this server can be driving
|
|
33
|
+
* four tabs at once, and every one of them owns its own controller. Both
|
|
34
|
+
* accessors REQUIRE the session id for that reason — the optional forms
|
|
35
|
+
* (and the "most recent run" pointer that answered them) were the shape
|
|
36
|
+
* that let a zero-argument caller abort, or fail to register, somebody
|
|
37
|
+
* else's run.
|
|
38
|
+
*/
|
|
29
39
|
interface RunLockControl {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
/** Controller for this conversation's run, if one is in flight. */
|
|
41
|
+
get(sessionId: string): AbortController | null;
|
|
42
|
+
/** Register (or release, with `null`) this conversation's controller. */
|
|
43
|
+
set(ctrl: AbortController | null, sessionId: string): void;
|
|
44
|
+
has(sessionId: string): boolean;
|
|
45
|
+
hasAny(): boolean;
|
|
46
|
+
delete(sessionId: string): void;
|
|
47
|
+
/** Snapshot of every session id that currently holds a run lock. */
|
|
48
|
+
sessionIds(): string[];
|
|
35
49
|
}
|
|
36
50
|
interface MessageDispatcherOptions {
|
|
37
51
|
state: WebuiMutableState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Context, DefaultSystemPromptBuilder } from '@wrongstack/core/agent';
|
|
2
2
|
import type { DefaultModeStore } from '@wrongstack/core/models';
|
|
3
3
|
import type { ToolRegistry } from '@wrongstack/core/registry';
|
|
4
4
|
import type { Config, MemoryPort, SkillLoader } from '@wrongstack/core/types';
|
|
@@ -19,7 +19,7 @@ type SessionStartPayload = {
|
|
|
19
19
|
contextMode: string;
|
|
20
20
|
};
|
|
21
21
|
type ModelCapabilities = NonNullable<ConstructorParameters<typeof DefaultSystemPromptBuilder>[0]>['modelCapabilities'];
|
|
22
|
-
|
|
22
|
+
interface ModeHandlersContext {
|
|
23
23
|
modeStore: DefaultModeStore;
|
|
24
24
|
memoryStore: MemoryPort;
|
|
25
25
|
skillLoader: SkillLoader | undefined;
|
|
@@ -31,8 +31,10 @@ export interface ModeHandlersContext {
|
|
|
31
31
|
projectRoot: string;
|
|
32
32
|
globalRoot: string;
|
|
33
33
|
clients: Map<WebSocket, ConnectedClient>;
|
|
34
|
-
setModeId: (id: string) => void;
|
|
35
|
-
sessionStartPayload: () => Promise<SessionStartPayload>;
|
|
34
|
+
setModeId: (id: string, sessionId?: string) => void;
|
|
35
|
+
sessionStartPayload: (overrides?: Record<string, unknown>) => Promise<SessionStartPayload>;
|
|
36
|
+
/** Resolve a session's own Context so the rebuild targets the right tab. */
|
|
37
|
+
getSessionContext?: ((sessionId?: string) => Context | undefined) | undefined;
|
|
36
38
|
}
|
|
37
39
|
export declare function createModeHandlers(context: ModeHandlersContext): import("./mode-routes.js").ModeRouteHandlers;
|
|
38
40
|
export {};
|
|
@@ -11,14 +11,25 @@ interface ModeSession {
|
|
|
11
11
|
}
|
|
12
12
|
export interface ModeOperationsContext {
|
|
13
13
|
modeStore?: ModeStore | undefined;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The journal that should record the switch. `sessionId` names the tab that
|
|
16
|
+
* switched: the `mode_changed` entry belongs in ITS transcript, not in
|
|
17
|
+
* whichever session the runtime happens to be pointing at. Hosts with one
|
|
18
|
+
* session ignore the argument.
|
|
19
|
+
*/
|
|
20
|
+
getSession?: ((sessionId?: string) => ModeSession | null | undefined) | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Record the active mode. `sessionId` names the tab that switched — each
|
|
23
|
+
* WebUI tab carries its own mode, so the process-wide value is only the
|
|
24
|
+
* default a newly opened tab inherits.
|
|
25
|
+
*/
|
|
26
|
+
applyModeId: (id: string, sessionId?: string) => void;
|
|
27
|
+
afterSwitch?: ((id: string, sessionId?: string) => void | Promise<void>) | undefined;
|
|
17
28
|
send: (ws: WebSocket, message: WSServerMessage) => void;
|
|
18
29
|
}
|
|
19
30
|
export declare function createModeOperations(context: ModeOperationsContext): {
|
|
20
31
|
listModes(ws: WebSocket): Promise<void>;
|
|
21
|
-
switchMode(ws: WebSocket, id: string): Promise<void>;
|
|
32
|
+
switchMode(ws: WebSocket, id: string, sessionId?: string): Promise<void>;
|
|
22
33
|
};
|
|
23
34
|
export {};
|
|
24
35
|
//# sourceMappingURL=mode-operations.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelsRegistry } from '@wrongstack/core/types';
|
|
2
|
-
|
|
2
|
+
interface CatalogModelMatch {
|
|
3
3
|
providerId: string;
|
|
4
4
|
providerName: string;
|
|
5
5
|
modelId: string;
|
|
@@ -14,4 +14,5 @@ export interface CatalogModelMatch {
|
|
|
14
14
|
}
|
|
15
15
|
/** Search the loaded models.dev registry without sending the full catalog to the browser. */
|
|
16
16
|
export declare function searchCatalogModels(registry: Pick<ModelsRegistry, 'listProviders'>, rawQuery: string, limit?: number): Promise<CatalogModelMatch[]>;
|
|
17
|
+
export {};
|
|
17
18
|
//# sourceMappingURL=model-catalog-search.d.ts.map
|
|
@@ -3,6 +3,8 @@ import type { Config, MemoryPort, ModelsRegistry, Provider, ProviderConfig } fro
|
|
|
3
3
|
import type { WebSocket } from 'ws';
|
|
4
4
|
import type { WSServerMessage } from './types.js';
|
|
5
5
|
export interface ModelRefinePayload {
|
|
6
|
+
/** The asking tab's session, stamped by `withSession` on the client. */
|
|
7
|
+
sessionId?: string | undefined;
|
|
6
8
|
text: string;
|
|
7
9
|
timeoutMs?: number | undefined;
|
|
8
10
|
provider?: string | undefined;
|
|
@@ -18,8 +20,10 @@ export interface ModelOperationsContext {
|
|
|
18
20
|
getConfig: () => Config | undefined;
|
|
19
21
|
getLiveProviderId: () => string;
|
|
20
22
|
buildProvider: (providerId: string, config: ProviderConfig) => Provider | Promise<Provider>;
|
|
21
|
-
applyModelSwitch: (providerId: string, modelId: string) => Promise<void>;
|
|
22
|
-
isRunActive?: (() => boolean) | undefined;
|
|
23
|
+
applyModelSwitch: (providerId: string, modelId: string, sessionId?: string) => Promise<void>;
|
|
24
|
+
isRunActive?: ((sessionId?: string) => boolean) | undefined;
|
|
25
|
+
/** Resolve a session's own Context; falls back to the root when unknown. */
|
|
26
|
+
getSessionContext?: ((sessionId?: string) => Context | undefined) | undefined;
|
|
23
27
|
send: (ws: WebSocket, message: WSServerMessage) => void;
|
|
24
28
|
broadcast?: ((message: WSServerMessage) => void) | undefined;
|
|
25
29
|
log?: ((message: string) => void) | undefined;
|