@wrongstack/webui-server 0.309.1 → 0.310.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 +1 -1
- package/dist/index.js +18031 -18795
- package/dist/server/collab/annotations.d.ts +26 -0
- package/dist/server/collab/broadcast-scheduler.d.ts +30 -0
- package/dist/server/collab/collab-context.d.ts +60 -0
- package/dist/server/collab/controller.d.ts +25 -0
- package/dist/server/collab/dispatcher.d.ts +27 -0
- package/dist/server/collab/injection.d.ts +26 -0
- package/dist/server/collab/membership.d.ts +20 -0
- package/dist/server/collab/mirror.d.ts +14 -0
- package/dist/server/collab/replay.d.ts +20 -0
- package/dist/server/collab/session-registry.d.ts +74 -0
- package/dist/server/collaboration-ws-handler.d.ts +28 -149
- package/dist/server/embedded-host-adapters.d.ts +4 -4
- package/dist/server/entry.js +16332 -16840
- package/dist/server/frontend-static-serve.d.ts +2 -0
- package/dist/server/index.d.ts +25 -25
- package/dist/server/pre-context-services.d.ts +2 -1
- package/dist/server/provider/catalog.d.ts +15 -0
- package/dist/server/provider/custom-models.d.ts +13 -0
- package/dist/server/provider/keys-records.d.ts +2 -0
- package/dist/server/provider/keys.d.ts +36 -0
- package/dist/server/provider/mutations.d.ts +34 -0
- package/dist/server/provider/oauth.d.ts +17 -0
- package/dist/server/provider/probe.d.ts +9 -0
- package/dist/server/provider/projection.d.ts +50 -0
- package/dist/server/provider-handlers.d.ts +38 -87
- package/dist/server/standalone-session-identity.d.ts +2 -1
- package/dist/server/token-estimator.d.ts +19 -8
- package/package.json +13 -16
- package/dist/protocol/client-conversation.d.ts +0 -3
- package/dist/protocol/client-integrations.d.ts +0 -3
- package/dist/protocol/client-operations.d.ts +0 -3
- package/dist/protocol/client-workspace.d.ts +0 -3
- package/dist/protocol/connection-fsm.d.ts +0 -39
- package/dist/protocol/decoder.d.ts +0 -6
- package/dist/protocol/index.d.ts +0 -8
- package/dist/protocol/index.js +0 -960
- package/dist/protocol/projections.d.ts +0 -131
- package/dist/protocol/registry.d.ts +0 -6
- package/dist/protocol/replay-payload.d.ts +0 -41
- package/dist/protocol/server-conversation.d.ts +0 -3
- package/dist/protocol/server-integrations.d.ts +0 -3
- package/dist/protocol/server-operations.d.ts +0 -4
- package/dist/protocol/server-workspace.d.ts +0 -3
- package/dist/protocol/types.d.ts +0 -24
- package/dist/protocol/version.d.ts +0 -26
|
@@ -26,6 +26,8 @@ export interface StaticServeHandle {
|
|
|
26
26
|
server: Server;
|
|
27
27
|
port: number;
|
|
28
28
|
}
|
|
29
|
+
/** Bun-compatible replacement for Node's newer `module.findPackageJSON`. */
|
|
30
|
+
export declare function findInstalledPackageJson(specifier: string, baseUrl?: string | URL): string | undefined;
|
|
29
31
|
export interface StaticServeOptions {
|
|
30
32
|
host: string;
|
|
31
33
|
httpPort: number;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -10,28 +10,34 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { type AutonomyRouteHandlers, createAutonomyRouteHandlers, handleAutonomyRoute, } from './autonomy-routes.js';
|
|
12
12
|
export { bootConfig, patchConfig } from './boot.js';
|
|
13
|
-
export {
|
|
14
|
-
export { deleteWebUISession } from './session-deletion.js';
|
|
13
|
+
export { type BrainHandlerContext, type BrainLogEntry, type BrainTransportContext, handleBrainAsk, handleBrainConfigGet, handleBrainConfigSet, handleBrainRisk, handleBrainStatus, } from './brain-handlers.js';
|
|
15
14
|
export type { BrainRouteHandlers } from './brain-routes.js';
|
|
16
15
|
export { handleBrainRoute } from './brain-routes.js';
|
|
17
16
|
export { type ChronicleRouteContext, handleChronicleRoute, } from './chronicle-routes.js';
|
|
17
|
+
export { createWebuiClientPresence, type WebuiClientPresence, type WebuiClientPresenceDeps, type WebuiHqConnection, type WebuiHqConnectionOptions, } from './client-presence.js';
|
|
18
18
|
export { type ClientTransportRouteHandlers, handleClientTransportRoute, } from './client-transport-routes.js';
|
|
19
19
|
export { setupWebUICodebaseIndexing } from './codebase-indexing.js';
|
|
20
20
|
export { type CodeMapFileTarget, type CodeMapOperation, extractCodeMapFileTargets, normalizeCodeMapFileTarget, } from './codemap-telemetry.js';
|
|
21
21
|
export { type CollaborationHandlerOptions, CollaborationWebSocketHandler, } from './collaboration-ws-handler.js';
|
|
22
22
|
export { type CompletionHandlerOptions, type CompletionItemKind, type CompletionSuggestion, createToolLspCompletionSource, handleCompletionRequest, type LspCompletionSource, type LspCompletionSourceRequest, } from './completion-handlers.js';
|
|
23
23
|
export { type CompletionRouteHandlers, handleCompletionRoute } from './completion-routes.js';
|
|
24
|
+
export { type ConfigDoctorDeps, handleConfigDoctor, } from './config-doctor.js';
|
|
25
|
+
export { type ConnectionLifecycleOptions, createConnectionLifecycle, } from './connection-lifecycle.js';
|
|
26
|
+
export { type ConnectionHealthService, type ConnectionsHealthContext, type ConnectionsHealthReport, collectConnectionsHealth, handleConnectionsHealthRoute, } from './connections-health-route.js';
|
|
24
27
|
export { type ContentRouteContext, handleContentRoute } from './content-routes.js';
|
|
28
|
+
export { applyContextEditorProposal, buildContextEditorSnapshot, type ContextEditorAppliedResult, type ContextEditorBlock, type ContextEditorConflict, type ContextEditorDiagnostics, type ContextEditorMessage, type ContextEditorMetrics, type ContextEditorRepairPreview, type ContextEditorSnapshot, type ContextEditorValidationError, type ContextEditorValidationResult, type ContextEditorWarning, contextEditorRevision, validateContextEditorMessages, validateContextEditorProposal, } from './context-editor.js';
|
|
29
|
+
export { seedContextMeta } from './context-meta.js';
|
|
30
|
+
export { type ConversationOperationsContext, type ConversationRunControl, createConversationOperations, } from './conversation-operations.js';
|
|
25
31
|
export { type ConversationRouteHandlers, handleConversationRoute, } from './conversation-routes.js';
|
|
26
|
-
export { createConversationOperations, type ConversationOperationsContext, type ConversationRunControl, } from './conversation-operations.js';
|
|
27
|
-
export { applyContextEditorProposal, buildContextEditorSnapshot, contextEditorRevision, validateContextEditorMessages, validateContextEditorProposal, type ContextEditorAppliedResult, type ContextEditorBlock, type ContextEditorConflict, type ContextEditorDiagnostics, type ContextEditorMessage, type ContextEditorMetrics, type ContextEditorRepairPreview, type ContextEditorSnapshot, type ContextEditorValidationError, type ContextEditorValidationResult, type ContextEditorWarning, } from './context-editor.js';
|
|
28
|
-
export { createConnectionLifecycle, type ConnectionLifecycleOptions, } from './connection-lifecycle.js';
|
|
29
|
-
export { collectConnectionsHealth, type ConnectionHealthService, type ConnectionsHealthContext, type ConnectionsHealthReport, handleConnectionsHealthRoute, } from './connections-health-route.js';
|
|
30
32
|
export { type CustomContextMode, type CustomModeStore, createCustomModeStore, } from './custom-context-modes.js';
|
|
31
33
|
export { type DesignContext, handleDesignList, handleDesignMaterialize, handleDesignSet, handleDesignState, handleDesignSwap, handleDesignTune, handleDesignUse, handleDesignVerify, } from './design-handlers.js';
|
|
34
|
+
export { applyEmbeddedModelSwitch, broadcastEmbeddedGoalSnapshot, createEmbeddedConversationRoutes, createEmbeddedProjectRoutes, createEmbeddedProviderOperations, createEmbeddedSessionRoutes, type EmbeddedAgentConfigContext, type EmbeddedConversationContext, type EmbeddedHostTransport, type EmbeddedProjectContext, type EmbeddedProviderContext, type EmbeddedProviderStore, type EmbeddedSessionContext, type EmbeddedSessionOptions, } from './embedded-host-adapters.js';
|
|
35
|
+
export { type AnnounceWebuiReadyParams, announceWebuiReady, createWebuiShutdown, type RegisterWebuiInstanceDeps, type RegisterWebuiInstanceParams, registerWebuiInstance, registerWebuiSignalHandlers, type WebuiShutdownResources, } from './embedded-lifecycle.js';
|
|
36
|
+
export { createEmbeddedMessageRouter, type EmbeddedMessageRouter, type EmbeddedMessageRouterDeps, type EmbeddedMessageRouterOptions, } from './embedded-message-router.js';
|
|
32
37
|
export { createEternalSubscription, type EternalBroadcast, type EternalSubscribe, type EternalSubscription, } from './eternal-iteration-broadcast.js';
|
|
33
38
|
export { handleFilesCreate, handleFilesDelete, handleFilesList, handleFilesMove, handleFilesRead, handleFilesRename, handleFilesSkeleton, handleFilesTree, handleFilesWrite, } from './file-handlers.js';
|
|
34
39
|
export { isHiddenEntry, rankFiles, SKIP_DIRS } from './file-picker.js';
|
|
40
|
+
export { type EnsureDistDeps, ensureDistDir, findInstalledPackageJson, type ResolveDistOptions, resolveDistDir, type StaticServeDeps, type StaticServeHandle, type StaticServeOptions, startStaticServe, } from './frontend-static-serve.js';
|
|
35
41
|
export { handleGitChanges, handleGitDiff, handleGitInfo } from './git-handlers.js';
|
|
36
42
|
export { handleGoalGet } from './goal-handlers.js';
|
|
37
43
|
export type { GoalRouteHandlers } from './goal-routes.js';
|
|
@@ -46,13 +52,14 @@ export type { CreateHttpServerOptions } from './http-server.js';
|
|
|
46
52
|
export { buildCspHeader, createHttpServer, decodeSessionId, injectWsConfig, isInsideDist, } from './http-server.js';
|
|
47
53
|
export { defaultBaseDir, formatInstances, isPidAlive, joinSessionRegistryWithWebUIInstances, listInstances, registerInstance, registryPath, unregisterInstance, type WebUIInstanceAuthInfo, type WebUIInstanceRecord, type WebUIInstanceRole, type WebUISessionAttachCandidate, type WebUISessionAttachDegradedReason, type WebUISessionAttachEndpoint, } from './instance-registry.js';
|
|
48
54
|
export { handleIntrospectionRoute, type IntrospectionRouteContext, } from './introspection-routes.js';
|
|
55
|
+
export { watchKanbanBoards } from './kanban-board-watcher.js';
|
|
49
56
|
export { handleKanbanTaskDispatch, type KanbanDispatchContext, type KanbanDispatchResult, type KanbanTaskDispatcher, parseResolvedDispatchRoute, type ResolvedDispatchRoute, } from './kanban-dispatch.js';
|
|
50
57
|
export { handleKanbanHostRoute, type KanbanHostRouteHandlers } from './kanban-host-routes.js';
|
|
51
58
|
export type { KanbanBoardPage, KanbanRouteContext } from './kanban-routes.js';
|
|
52
59
|
export { handleKanbanRoute, KANBAN_CLIENT_MESSAGE_TYPES, paginateKanbanBoards, } from './kanban-routes.js';
|
|
53
|
-
export {
|
|
60
|
+
export { buildTaskGraphFromGoalPhase, buildTaskGraphFromSddSnapshot, createKanbanRunMirror, type KanbanRunMirror, type KanbanRunMirrorDeps, } from './kanban-run-mirror.js';
|
|
61
|
+
export { createKanbanSupervisor, type KanbanSupervisor, type KanbanSupervisorDeps, type KanbanSupervisorDispatchOptions, } from './kanban-supervisor.js';
|
|
54
62
|
export { createShutdown, registerShutdownHandlers } from './lifecycle.js';
|
|
55
|
-
export { handleConfigDoctor, type ConfigDoctorDeps, } from './config-doctor.js';
|
|
56
63
|
export { getMailboxForDeps, handleMailboxAgents, handleMailboxClear, handleMailboxCompact, handleMailboxMessages, handleMailboxPurge, type MailboxHandlerDeps, } from './mailbox-handlers.js';
|
|
57
64
|
export { createMailboxRouteHandlers, handleMailboxRoute, type MailboxRouteContext, type MailboxRouteHandlers, } from './mailbox-routes.js';
|
|
58
65
|
export { handleMcpAdd, handleMcpDisable, handleMcpDiscover, handleMcpEnable, handleMcpList, handleMcpPromptGet, handleMcpPrompts, handleMcpRemove, handleMcpResourceRead, handleMcpResources, handleMcpRestart, handleMcpSleep, handleMcpUpdate, handleMcpWake, } from './mcp-handlers.js';
|
|
@@ -65,30 +72,21 @@ export type { ModeRouteHandlers } from './mode-routes.js';
|
|
|
65
72
|
export { createModeRouteHandlers, handleModeRoute } from './mode-routes.js';
|
|
66
73
|
export { resolveProviderCatalogForModels, resolveProviderModelMetadata } from './model-catalog.js';
|
|
67
74
|
export { createModelOperations, type ModelOperationsContext, type ModelRefinePayload, } from './model-operations.js';
|
|
75
|
+
export { formatExternalAccessUrls, getExternalAddresses, type NetworkAddress, } from './network-info.js';
|
|
68
76
|
export { browserOpenCommand, openBrowser } from './open-browser.js';
|
|
69
77
|
export { isPathInside, resolveWorkingDirInsideProject } from './path-containment.js';
|
|
70
78
|
export type { ConfirmDecision, PendingConfirm } from './pending-confirms.js';
|
|
71
79
|
export { isDestructivePendingConfirm, resolveAllPendingConfirms, resolveYoloEligiblePendingConfirms, } from './pending-confirms.js';
|
|
72
80
|
export { findFreePort, getSurfaceDefaultPorts, isPortFree, isStrictPort, listenWithRetry, SURFACE_DEFAULT_PORTS, type SurfaceKind, surfaceLabel, } from './port-utils.js';
|
|
73
|
-
export {
|
|
74
|
-
export { announceWebuiReady, createWebuiShutdown, registerWebuiInstance, registerWebuiSignalHandlers, type AnnounceWebuiReadyParams, type RegisterWebuiInstanceDeps, type RegisterWebuiInstanceParams, type WebuiShutdownResources, } from './embedded-lifecycle.js';
|
|
75
|
-
export { createStreamCoalescer, type StreamCoalescer, type StreamCoalescerDeps, type ToolProgressPayload, } from './stream-coalescer.js';
|
|
76
|
-
export { createWebuiClientPresence, type WebuiClientPresence, type WebuiClientPresenceDeps, type WebuiHqConnection, type WebuiHqConnectionOptions, } from './client-presence.js';
|
|
77
|
-
export { handleBrainAsk, handleBrainConfigGet, handleBrainConfigSet, handleBrainRisk, handleBrainStatus, type BrainHandlerContext, type BrainLogEntry, type BrainTransportContext, } from './brain-handlers.js';
|
|
78
|
-
export { buildTaskGraphFromGoalPhase, buildTaskGraphFromSddSnapshot, createKanbanRunMirror, type KanbanRunMirror, type KanbanRunMirrorDeps, } from './kanban-run-mirror.js';
|
|
79
|
-
export { createKanbanSupervisor, type KanbanSupervisor, type KanbanSupervisorDeps, type KanbanSupervisorDispatchOptions, } from './kanban-supervisor.js';
|
|
80
|
-
export { seedContextMeta } from './context-meta.js';
|
|
81
|
-
export { type ConfigWriteLockHolder, type PrefHelperDeps, PREF_KEYS, persistPrefsToConfig, prefSnapshot, } from './pref-helpers.js';
|
|
81
|
+
export { type ConfigWriteLockHolder, PREF_KEYS, type PrefHelperDeps, persistPrefsToConfig, prefSnapshot, } from './pref-helpers.js';
|
|
82
82
|
export { handleAutonomySwitch, handlePrefsGet, handlePrefsUpdate, type PrefsHandlerContext, } from './prefs-handlers.js';
|
|
83
83
|
export { createPrefsRouteHandlers, handlePrefsRoute, type PrefsRouteHandlers, } from './prefs-routes.js';
|
|
84
84
|
export { handleProcessKill, handleProcessKillAll, handleProcessList, } from './process-handlers.js';
|
|
85
85
|
export { handleProcessRoute, type ProcessRouteHandlers } from './process-routes.js';
|
|
86
|
-
export {
|
|
87
|
-
export { createEmbeddedMessageRouter, type EmbeddedMessageRouter, type EmbeddedMessageRouterDeps, type EmbeddedMessageRouterOptions, } from './embedded-message-router.js';
|
|
88
|
-
export { createRouteFamilyDispatcher, type RouteFamilyDispatcher, type RouteFamilyDispatcherOptions, type RouteFamilyTable, } from './route-family-dispatcher.js';
|
|
86
|
+
export { createProjectHandlers, type ProjectHandlersContext } from './project-handlers.js';
|
|
89
87
|
export type { ProjectRouteHandlers } from './project-routes.js';
|
|
90
88
|
export { handleProjectRoute } from './project-routes.js';
|
|
91
|
-
export {
|
|
89
|
+
export { startProjectWatcher } from './project-watcher.js';
|
|
92
90
|
export { ensureProjectDataDir, loadManifest, projectsJsonPath, saveManifest, touchProjectInManifest, } from './projects-manifest.js';
|
|
93
91
|
export { handlePromptsContent, handlePromptsCreate, handlePromptsFavorite, handlePromptsJournal, handlePromptsList, handlePromptsRecent, handlePromptsSearch, handlePromptsUsed, type PromptsContext, } from './prompts-handlers.js';
|
|
94
92
|
export { loadSavedProviders, saveProviders } from './provider-config-io.js';
|
|
@@ -99,15 +97,18 @@ export type { ProviderMutationHandlers, ProviderRouteHandlers } from './provider
|
|
|
99
97
|
export { handleProviderRoute } from './provider-routes.js';
|
|
100
98
|
export type { ProviderStore } from './provider-store.js';
|
|
101
99
|
export { createConfigWriteLock, createProviderStore } from './provider-store.js';
|
|
100
|
+
export { createRouteFamilyDispatcher, type RouteFamilyDispatcher, type RouteFamilyDispatcherOptions, type RouteFamilyTable, } from './route-family-dispatcher.js';
|
|
102
101
|
export { handleSddBoardRoute, type SddBoardRouteHandlers } from './sdd-board-routes.js';
|
|
103
102
|
export { SddBoardWebSocketHandler } from './sdd-board-ws-handler.js';
|
|
104
103
|
export { handleSddWizardRoute, type SddWizardRouteHandlers } from './sdd-wizard-routes.js';
|
|
105
104
|
export { buildSddWizardDeps, type SddWizardWiringOptions, type StartSddRunFromGraphConfig, type StartSddRunFromGraphDeps, startSddRunFromGraph, } from './sdd-wizard-wiring.js';
|
|
106
105
|
export { type SddWizardDeps, SddWizardWebSocketHandler } from './sdd-wizard-ws-handler.js';
|
|
106
|
+
export { cleanupOwnerlessEmptySessions, DEFAULT_EMPTY_SESSION_CLEANUP_INTERVAL_MS, EMPTY_SESSION_CLEANUP_INTERVAL_ENV, resolveEmptySessionCleanupInterval, scheduleOwnerlessEmptySessionCleanup, } from './session-cleanup-scheduler.js';
|
|
107
|
+
export { deleteWebUISession } from './session-deletion.js';
|
|
108
|
+
export { createSessionHandlers, type SessionHandlersContext } from './session-handlers.js';
|
|
107
109
|
export { type SessionHistoryWireEntry, toSessionHistoryEntries, toSessionHistoryEntry, } from './session-history.js';
|
|
108
110
|
export type { SessionRouteHandlers } from './session-routes.js';
|
|
109
111
|
export { handleSessionRoute } from './session-routes.js';
|
|
110
|
-
export { createSessionHandlers, type SessionHandlersContext } from './session-handlers.js';
|
|
111
112
|
export { setupEvents, statusProjectHashFromWatchFilename } from './setup-events.js';
|
|
112
113
|
export type { ShellGitRouteHandlers } from './shell-git-routes.js';
|
|
113
114
|
export { handleShellGitRoute } from './shell-git-routes.js';
|
|
@@ -115,18 +116,17 @@ export { handleShellOpen, type ShellOpenOptions, type ShellOpenRequest, type She
|
|
|
115
116
|
export { handleSkillsContent, handleSkillsCreate, handleSkillsEdit, handleSkillsExport, handleSkillsInstall, handleSkillsList, handleSkillsUninstall, handleSkillsUpdate, type SkillsContext, } from './skills-handlers.js';
|
|
116
117
|
export { handleSpecsRoute, type SpecsRouteHandlers } from './specs-routes.js';
|
|
117
118
|
export { SpecsWebSocketHandler } from './specs-ws-handler.js';
|
|
118
|
-
export { startProjectWatcher } from './project-watcher.js';
|
|
119
119
|
export { startWebUI } from './start-webui.js';
|
|
120
|
+
export { createStreamCoalescer, type StreamCoalescer, type StreamCoalescerDeps, type ToolProgressPayload, } from './stream-coalescer.js';
|
|
120
121
|
export { TerminalWebSocketHandler } from './terminal-ws-handler.js';
|
|
121
122
|
export { type ContextBreakdown, estimateContextBreakdown, estimateTokens, type MessageTokenEntry, messagePreview, messageTokens, stringifyContent, type ToolTokenEntry, } from './token-estimator.js';
|
|
122
123
|
export type { BackendServices, ConnectedClient, WebUIOptions, WSClientMessage, WSServerMessage, } from './types.js';
|
|
123
|
-
export { computeUsageCost, getCostRates, type
|
|
124
|
+
export { type CostRates, computeUsageCost, getCostRates, type TokenUsage, } from './usage-cost.js';
|
|
124
125
|
export { createWorklistRouteHandlers, handleWorklistRoute, type WorklistRouteContext, type WorklistRouteHandlers, } from './worklist-routes.js';
|
|
125
126
|
export { handleWorktreeRoute, type WorktreeRouteHandlers } from './worktree-routes.js';
|
|
126
127
|
export { WorktreeWebSocketHandler } from './worktree-ws-handler.js';
|
|
127
128
|
export { extractToken, extractTokenFromCookie, hostHeaderOk, isLoopbackBind, isLoopbackHostname, isWildcardBind, tokenMatches, type VerifyClientInput, verifyClient, } from './ws-auth.js';
|
|
128
129
|
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';
|
|
129
130
|
export { broadcast, buildWebUIAccessUrl, envFlag, errMessage, generateAuthToken, hostForBrowserUrl, resolveAuthToken, send, sendResult, sendSerialized, WEBUI_WS_MAX_BUFFERED_BYTES, } from './ws-utils.js';
|
|
130
|
-
export { formatExternalAccessUrls, getExternalAddresses, type NetworkAddress } from './network-info.js';
|
|
131
131
|
export { createZipBuffer, readZipEntries, type ZipEntryInput } from './zip.js';
|
|
132
132
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -26,7 +26,8 @@ import { type Container, EventBus } from '@wrongstack/core/kernel';
|
|
|
26
26
|
import { DefaultModeStore } from '@wrongstack/core/models';
|
|
27
27
|
import { ProviderRegistry, ToolRegistry } from '@wrongstack/core/registry';
|
|
28
28
|
import { SkillInstaller } from '@wrongstack/core/skills';
|
|
29
|
-
import {
|
|
29
|
+
import { AnnotationsStore, DefaultSessionReader, DefaultSessionStore, PromptUsageStore } from '@wrongstack/core/storage';
|
|
30
|
+
import type { AgentStatusTracker } from '@wrongstack/core/coordination';
|
|
30
31
|
import { type Config, type ConfigStore, type Logger, type MemoryPort, type ModelsRegistry, type Provider, type SecretVault, type SessionStore } from '@wrongstack/core/types';
|
|
31
32
|
import { type WstackPaths } from '@wrongstack/core/utils';
|
|
32
33
|
import type { CustomModeStore } from './custom-context-modes.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { ProviderServiceContext } from './mutations.js';
|
|
3
|
+
/**
|
|
4
|
+
* Catalog + model-resolution surface (6B-2). Moved verbatim from
|
|
5
|
+
* provider-handlers.ts: list/saved/search/models handlers plus the
|
|
6
|
+
* default-provider adoption flow.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCatalogHandlers(ctx: ProviderServiceContext): {
|
|
9
|
+
handleProvidersList: (ws: WebSocket) => Promise<void>;
|
|
10
|
+
handleProvidersSaved: (ws: WebSocket) => Promise<void>;
|
|
11
|
+
handleProviderModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
12
|
+
handleProviderModelsSearch: (ws: WebSocket, query: string, limit?: number | undefined) => Promise<void>;
|
|
13
|
+
adoptDefaultProviderIfUnset: (providerId: string) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProviderConfig } from '@wrongstack/core/types';
|
|
2
|
+
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { ProviderServiceContext } from './mutations.js';
|
|
4
|
+
/**
|
|
5
|
+
* Custom model definition CRUD (ME-3, 6B-2). Moved verbatim from
|
|
6
|
+
* provider-handlers.ts: own-property lookups (Object.hasOwn — prototype
|
|
7
|
+
* pollution guard) and the models[] allowlist sync semantics.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createCustomModelHandlers(ctx: ProviderServiceContext): {
|
|
10
|
+
handleCustomModelSet: (ws: WebSocket, providerId: string, modelId: string, definition: NonNullable<ProviderConfig['customModels']>[string]) => Promise<void>;
|
|
11
|
+
handleCustomModelRemove: (ws: WebSocket, providerId: string, modelId: string) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=custom-models.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { addProvider as addProviderRecord, deleteKey as deleteKeyRecord, maskedKey, normalizeKeys, removeProvider as removeProviderRecord, setActiveKey as setActiveKeyRecord, upsertKey as upsertKeyRecord, writeKeysBack, } from '../provider-keys.js';
|
|
2
|
+
//# sourceMappingURL=keys-records.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProviderConfig } from '@wrongstack/core/types';
|
|
2
|
+
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { ProviderServiceContext } from './mutations.js';
|
|
4
|
+
/**
|
|
5
|
+
* API-key + provider CRUD surface (6B-2). Moved verbatim from
|
|
6
|
+
* provider-handlers.ts: every handler keeps the load → mutate → save →
|
|
7
|
+
* broadcast ordering and the exact operation_result messages.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createKeyHandlers(ctx: ProviderServiceContext): {
|
|
10
|
+
handleKeyUpsert: (ws: WebSocket, providerId: string, label: string, apiKey: string) => Promise<void>;
|
|
11
|
+
handleKeyDelete: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
12
|
+
handleKeySetActive: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
/** Provider-level CRUD (add/remove/update/clear/undo-clear). */
|
|
15
|
+
export declare function createProviderCrudHandlers(ctx: ProviderServiceContext): {
|
|
16
|
+
handleProviderAdd: (ws: WebSocket, payload: {
|
|
17
|
+
id: string;
|
|
18
|
+
family: string;
|
|
19
|
+
baseUrl?: string | undefined;
|
|
20
|
+
apiKey?: string | undefined;
|
|
21
|
+
models?: string[] | undefined;
|
|
22
|
+
customModels?: ProviderConfig['customModels'] | undefined;
|
|
23
|
+
}) => Promise<boolean>;
|
|
24
|
+
handleProviderRemove: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
25
|
+
handleProviderClearModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
26
|
+
handleProviderUndoClear: (ws: WebSocket, providerId: string, previousModels: string[]) => Promise<void>;
|
|
27
|
+
handleProviderUpdate: (ws: WebSocket, payload: {
|
|
28
|
+
id: string;
|
|
29
|
+
family?: string | undefined;
|
|
30
|
+
baseUrl?: string | undefined;
|
|
31
|
+
envVars?: string[] | undefined;
|
|
32
|
+
models?: string[] | undefined;
|
|
33
|
+
customModels?: ProviderConfig['customModels'] | undefined;
|
|
34
|
+
}) => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ModelsRegistry, ProviderConfig } from '@wrongstack/core/types';
|
|
2
|
+
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { WSServerMessage } from '../types.js';
|
|
4
|
+
export interface ProviderPersistence {
|
|
5
|
+
load(): Promise<Record<string, ProviderConfig>>;
|
|
6
|
+
save(providers: Record<string, ProviderConfig>): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface ProviderOperationsDeps {
|
|
9
|
+
providerStore: ProviderPersistence;
|
|
10
|
+
broadcast: (message: WSServerMessage) => void;
|
|
11
|
+
send?: ((ws: WebSocket, message: WSServerMessage) => void) | undefined;
|
|
12
|
+
modelsRegistry?: ModelsRegistry | undefined;
|
|
13
|
+
log?: ((message: string) => void) | undefined;
|
|
14
|
+
hasActiveModel?: (() => boolean) | undefined;
|
|
15
|
+
onProvidersLoaded?: ((providers: Record<string, ProviderConfig>) => void | Promise<void>) | undefined;
|
|
16
|
+
applyModelSwitch?: ((providerId: string, modelId: string) => Promise<void>) | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Shared service context for every provider/ domain module (6B-1).
|
|
20
|
+
* Owns the load → mutate → save → broadcast plumbing each handler repeated,
|
|
21
|
+
* so domain modules stay verbatim handlers with no boilerplate of their own.
|
|
22
|
+
*/
|
|
23
|
+
export interface ProviderServiceContext {
|
|
24
|
+
readonly deps: ProviderOperationsDeps;
|
|
25
|
+
sendMessage(ws: WebSocket, message: WSServerMessage): void;
|
|
26
|
+
sendOperationResult(ws: WebSocket, success: boolean, message: string): void;
|
|
27
|
+
loadConfigProviders(): Promise<Record<string, ProviderConfig>>;
|
|
28
|
+
saveConfigProviders(providers: Record<string, ProviderConfig>): Promise<void>;
|
|
29
|
+
/** Broadcast the current saved-provider list to every connected client. */
|
|
30
|
+
broadcastSaved(providers: Record<string, ProviderConfig>): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function createProviderServiceContext(deps: ProviderOperationsDeps): ProviderServiceContext;
|
|
33
|
+
export type { ProviderServiceContext as ProviderMutationsContext };
|
|
34
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type OAuthKind } from '@wrongstack/providers/oauth';
|
|
2
|
+
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { ProviderServiceContext } from './mutations.js';
|
|
4
|
+
/**
|
|
5
|
+
* Subscription OAuth login state machine (ChatGPT / Claude / Copilot) — 6B-2.
|
|
6
|
+
* Moved verbatim from provider-handlers.ts:
|
|
7
|
+
*
|
|
8
|
+
* One in-flight session per kind, shared across clients (single-user). A
|
|
9
|
+
* second start for the same kind closes the prior one. The engine
|
|
10
|
+
* (@wrongstack/providers/oauth) is IO-free — persistence is local below.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createOauthHandlers(ctx: ProviderServiceContext): {
|
|
13
|
+
handleOAuthStart: (ws: WebSocket, kind: OAuthKind, customProviderId?: string) => Promise<void>;
|
|
14
|
+
handleOAuthCode: (ws: WebSocket, kind: OAuthKind, input: string) => Promise<void>;
|
|
15
|
+
handleOAuthCancel: (ws: WebSocket, kind: OAuthKind) => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WebSocket } from 'ws';
|
|
2
|
+
import type { ProviderServiceContext } from './mutations.js';
|
|
3
|
+
/**
|
|
4
|
+
* Health probing (6B-2). Moved verbatim from provider-handlers.ts.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createProbeHandlers(ctx: ProviderServiceContext): {
|
|
7
|
+
handleProviderProbe: (ws: WebSocket, providerId: string, timeoutMs?: number) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=probe.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DefaultSecretScrubber } from '@wrongstack/core/security';
|
|
2
|
+
import type { ProviderConfig } from '@wrongstack/core/types';
|
|
3
|
+
/**
|
|
4
|
+
* Wire shape of one saved provider as broadcast over `providers.saved`.
|
|
5
|
+
* The WebUI's `<ProviderModelsPanel>` consumes this — when
|
|
6
|
+
* `pickedModelId` / `models` is missing, the panel renders the empty
|
|
7
|
+
* state.
|
|
8
|
+
*/
|
|
9
|
+
export interface SavedProviderView {
|
|
10
|
+
id: string;
|
|
11
|
+
family?: string | undefined;
|
|
12
|
+
baseUrl?: string | undefined;
|
|
13
|
+
/** Saved model allowlist, verbatim (undefined / [] both possible). */
|
|
14
|
+
models?: string[] | undefined;
|
|
15
|
+
/** Per-model metadata (display name, output limits, capability overrides). */
|
|
16
|
+
customModels?: ProviderConfig['customModels'] | undefined;
|
|
17
|
+
/** First entry of `models`, or undefined when the list is empty/unset. */
|
|
18
|
+
pickedModelId?: string | undefined;
|
|
19
|
+
apiKeys: Array<{
|
|
20
|
+
label: string;
|
|
21
|
+
maskedKey: string;
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Canonical projection from in-memory `ProviderConfig` to the
|
|
28
|
+
* `providers.saved` wire shape. Pure (no I/O) so it's unit-tested in
|
|
29
|
+
* isolation — see `tests/server/provider-handlers-projection.test.ts`.
|
|
30
|
+
*
|
|
31
|
+
* Secrets never leave: every key is run through `maskedKey` before it
|
|
32
|
+
* reaches the wire.
|
|
33
|
+
*/
|
|
34
|
+
export declare function projectSavedProviders(providers: Record<string, ProviderConfig>): SavedProviderView[];
|
|
35
|
+
/** Shared scrubber for probe error/body redaction. */
|
|
36
|
+
export declare const probeScrubber: DefaultSecretScrubber;
|
|
37
|
+
/**
|
|
38
|
+
* Probe a saved provider's OpenAI-compatible `/v1/models` and map the
|
|
39
|
+
* discovered ids into the minimal model-descriptor shape the WebUI dropdown
|
|
40
|
+
* needs. Used as a fallback when a config-only custom provider (no saved
|
|
41
|
+
* `models` allowlist, absent from models.dev) would otherwise resolve to an
|
|
42
|
+
* empty list. Returns `[]` on any failure — the caller treats that as "no
|
|
43
|
+
* models" (unchanged behaviour).
|
|
44
|
+
*/
|
|
45
|
+
export declare function probeModelDescriptors(cfg: ProviderConfig): Promise<Array<{
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
capabilities: [];
|
|
49
|
+
}>>;
|
|
50
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -1,90 +1,25 @@
|
|
|
1
1
|
import type { ModelsRegistry, ProviderConfig } from '@wrongstack/core/types';
|
|
2
|
-
import { type OAuthKind } from '@wrongstack/providers/oauth';
|
|
3
2
|
import type { WebSocket } from 'ws';
|
|
3
|
+
import { type ProviderOperationsDeps, type ProviderPersistence } from './provider/mutations.js';
|
|
4
|
+
import { probeModelDescriptors, projectSavedProviders, type SavedProviderView } from './provider/projection.js';
|
|
4
5
|
import type { ConnectedClient, WSServerMessage } from './types.js';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Per-concern split of the former 827-line provider-handlers.ts (card #6B).
|
|
8
|
+
* This module is the thin composition shell: every handler body moved
|
|
9
|
+
* verbatim into `./provider/*` domain modules; the public surface below is
|
|
10
|
+
* unchanged, so `routes.ts`, the embedded/standalone adapters, the barrel
|
|
11
|
+
* and every test keep importing from here.
|
|
10
12
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
family?: string | undefined;
|
|
14
|
-
baseUrl?: string | undefined;
|
|
15
|
-
/** Saved model allowlist, verbatim (undefined / [] both possible). */
|
|
16
|
-
models?: string[] | undefined;
|
|
17
|
-
/** Per-model metadata (display name, output limits, capability overrides). */
|
|
18
|
-
customModels?: ProviderConfig['customModels'] | undefined;
|
|
19
|
-
/** First entry of `models`, or undefined when the list is empty/unset. */
|
|
20
|
-
pickedModelId?: string | undefined;
|
|
21
|
-
apiKeys: Array<{
|
|
22
|
-
label: string;
|
|
23
|
-
maskedKey: string;
|
|
24
|
-
isActive: boolean;
|
|
25
|
-
createdAt: string;
|
|
26
|
-
}>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Canonical projection from in-memory `ProviderConfig` to the
|
|
30
|
-
* `providers.saved` wire shape. Pure (no I/O) so it's unit-tested in
|
|
31
|
-
* isolation — see `tests/server/provider-handlers-projection.test.ts`.
|
|
32
|
-
*
|
|
33
|
-
* Secrets never leave: every key is run through `maskedKey` before it
|
|
34
|
-
* reaches the wire.
|
|
35
|
-
*/
|
|
36
|
-
export declare function projectSavedProviders(providers: Record<string, ProviderConfig>): SavedProviderView[];
|
|
37
|
-
/**
|
|
38
|
-
* Probe a saved provider's OpenAI-compatible `/v1/models` and map the
|
|
39
|
-
* discovered ids into the minimal model-descriptor shape the WebUI dropdown
|
|
40
|
-
* needs. Used as a fallback when a config-only custom provider (no saved
|
|
41
|
-
* `models` allowlist, absent from models.dev) would otherwise resolve to an
|
|
42
|
-
* empty list. Returns `[]` on any failure — the caller treats that as "no
|
|
43
|
-
* models" (unchanged behaviour).
|
|
44
|
-
*/
|
|
45
|
-
export declare function probeModelDescriptors(cfg: ProviderConfig): Promise<Array<{
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
capabilities: [];
|
|
49
|
-
}>>;
|
|
50
|
-
export interface ProviderHandlerDeps {
|
|
51
|
-
/** Path to the active profile config; the only provider mutation target. */
|
|
52
|
-
profileConfigPath: string;
|
|
53
|
-
vault: import('@wrongstack/core/types').SecretVault;
|
|
54
|
-
/** Shared config write lock — serialized via chained promises */
|
|
55
|
-
setConfigWriteLock: (lock: Promise<void>) => void;
|
|
56
|
-
getConfigWriteLock: () => Promise<void>;
|
|
57
|
-
/** Broadcast a message to all connected WebUI clients */
|
|
58
|
-
broadcast: (clients: Map<WebSocket, ConnectedClient>, msg: WSServerMessage) => void;
|
|
59
|
-
/** Connected WebUI clients map */
|
|
60
|
-
clients: Map<WebSocket, ConnectedClient>;
|
|
61
|
-
/** Used by the ChatGPT OAuth flow's tier-2 model lookup (best-effort). */
|
|
62
|
-
modelsRegistry?: ModelsRegistry | undefined;
|
|
63
|
-
hasActiveModel?: (() => boolean) | undefined;
|
|
64
|
-
onProvidersLoaded?: ((providers: Record<string, ProviderConfig>) => void | Promise<void>) | undefined;
|
|
65
|
-
applyModelSwitch?: ((providerId: string, modelId: string) => Promise<void>) | undefined;
|
|
66
|
-
}
|
|
67
|
-
export interface ProviderPersistence {
|
|
68
|
-
load(): Promise<Record<string, ProviderConfig>>;
|
|
69
|
-
save(providers: Record<string, ProviderConfig>): Promise<void>;
|
|
70
|
-
}
|
|
71
|
-
export interface ProviderOperationsDeps {
|
|
72
|
-
providerStore: ProviderPersistence;
|
|
73
|
-
broadcast: (message: WSServerMessage) => void;
|
|
74
|
-
send?: ((ws: WebSocket, message: WSServerMessage) => void) | undefined;
|
|
75
|
-
modelsRegistry?: ModelsRegistry | undefined;
|
|
76
|
-
log?: ((message: string) => void) | undefined;
|
|
77
|
-
hasActiveModel?: (() => boolean) | undefined;
|
|
78
|
-
onProvidersLoaded?: ((providers: Record<string, ProviderConfig>) => void | Promise<void>) | undefined;
|
|
79
|
-
applyModelSwitch?: ((providerId: string, modelId: string) => Promise<void>) | undefined;
|
|
80
|
-
}
|
|
13
|
+
export type { ProviderOperationsDeps, ProviderPersistence, SavedProviderView };
|
|
14
|
+
export { probeModelDescriptors, projectSavedProviders };
|
|
81
15
|
export declare function createProviderOperations(deps: ProviderOperationsDeps): {
|
|
82
16
|
handleProvidersList: (ws: WebSocket) => Promise<void>;
|
|
83
17
|
handleProvidersSaved: (ws: WebSocket) => Promise<void>;
|
|
84
18
|
handleProviderModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
85
19
|
handleProviderModelsSearch: (ws: WebSocket, query: string, limit?: number | undefined) => Promise<void>;
|
|
86
20
|
adoptDefaultProviderIfUnset: (providerId: string) => Promise<void>;
|
|
87
|
-
|
|
21
|
+
handleCustomModelSet: (ws: WebSocket, providerId: string, modelId: string, definition: NonNullable<ProviderConfig['customModels']>[string]) => Promise<void>;
|
|
22
|
+
handleCustomModelRemove: (ws: WebSocket, providerId: string, modelId: string) => Promise<void>;
|
|
88
23
|
handleKeyUpsert: (ws: WebSocket, providerId: string, label: string, apiKey: string) => Promise<void>;
|
|
89
24
|
handleKeyDelete: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
90
25
|
handleKeySetActive: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
@@ -98,8 +33,6 @@ export declare function createProviderOperations(deps: ProviderOperationsDeps):
|
|
|
98
33
|
}) => Promise<boolean>;
|
|
99
34
|
handleProviderRemove: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
100
35
|
handleProviderClearModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
101
|
-
handleCustomModelSet: (ws: WebSocket, providerId: string, modelId: string, definition: NonNullable<ProviderConfig['customModels']>[string]) => Promise<void>;
|
|
102
|
-
handleCustomModelRemove: (ws: WebSocket, providerId: string, modelId: string) => Promise<void>;
|
|
103
36
|
handleProviderUndoClear: (ws: WebSocket, providerId: string, previousModels: string[]) => Promise<void>;
|
|
104
37
|
handleProviderUpdate: (ws: WebSocket, payload: {
|
|
105
38
|
id: string;
|
|
@@ -109,12 +42,30 @@ export declare function createProviderOperations(deps: ProviderOperationsDeps):
|
|
|
109
42
|
models?: string[] | undefined;
|
|
110
43
|
customModels?: ProviderConfig['customModels'] | undefined;
|
|
111
44
|
}) => Promise<void>;
|
|
45
|
+
handleOAuthStart: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind, customProviderId?: string) => Promise<void>;
|
|
46
|
+
handleOAuthCode: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind, input: string) => Promise<void>;
|
|
47
|
+
handleOAuthCancel: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind) => void;
|
|
112
48
|
handleProviderProbe: (ws: WebSocket, providerId: string, timeoutMs?: number) => Promise<void>;
|
|
113
|
-
|
|
114
|
-
handleOAuthCode: (ws: WebSocket, kind: OAuthKind, input: string) => Promise<void>;
|
|
115
|
-
handleOAuthCancel: (ws: WebSocket, kind: OAuthKind) => void;
|
|
49
|
+
broadcastSaved: (providers: Record<string, ProviderConfig>) => void;
|
|
116
50
|
loadConfigProviders: () => Promise<Record<string, ProviderConfig>>;
|
|
117
51
|
};
|
|
52
|
+
export interface ProviderHandlerDeps {
|
|
53
|
+
/** Path to the active profile config; the only provider mutation target. */
|
|
54
|
+
profileConfigPath: string;
|
|
55
|
+
vault: import('@wrongstack/core/types').SecretVault;
|
|
56
|
+
/** Shared config write lock — serialized via chained promises */
|
|
57
|
+
setConfigWriteLock: (lock: Promise<void>) => void;
|
|
58
|
+
getConfigWriteLock: () => Promise<void>;
|
|
59
|
+
/** Broadcast a message to all connected WebUI clients */
|
|
60
|
+
broadcast: (clients: Map<WebSocket, ConnectedClient>, msg: WSServerMessage) => void;
|
|
61
|
+
/** Connected WebUI clients map */
|
|
62
|
+
clients: Map<WebSocket, ConnectedClient>;
|
|
63
|
+
/** Used by the ChatGPT OAuth flow's tier-2 model lookup (best-effort). */
|
|
64
|
+
modelsRegistry?: ModelsRegistry | undefined;
|
|
65
|
+
hasActiveModel?: (() => boolean) | undefined;
|
|
66
|
+
onProvidersLoaded?: ((providers: Record<string, ProviderConfig>) => void | Promise<void>) | undefined;
|
|
67
|
+
applyModelSwitch?: ((providerId: string, modelId: string) => Promise<void>) | undefined;
|
|
68
|
+
}
|
|
118
69
|
/**
|
|
119
70
|
* Standalone-host adapter. It preserves the existing serialized profile-file
|
|
120
71
|
* persistence while delegating all provider and OAuth behavior to the
|
|
@@ -126,7 +77,8 @@ export declare function createProviderHandlers(deps: ProviderHandlerDeps): {
|
|
|
126
77
|
handleProviderModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
127
78
|
handleProviderModelsSearch: (ws: WebSocket, query: string, limit?: number | undefined) => Promise<void>;
|
|
128
79
|
adoptDefaultProviderIfUnset: (providerId: string) => Promise<void>;
|
|
129
|
-
|
|
80
|
+
handleCustomModelSet: (ws: WebSocket, providerId: string, modelId: string, definition: NonNullable<ProviderConfig['customModels']>[string]) => Promise<void>;
|
|
81
|
+
handleCustomModelRemove: (ws: WebSocket, providerId: string, modelId: string) => Promise<void>;
|
|
130
82
|
handleKeyUpsert: (ws: WebSocket, providerId: string, label: string, apiKey: string) => Promise<void>;
|
|
131
83
|
handleKeyDelete: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
132
84
|
handleKeySetActive: (ws: WebSocket, providerId: string, label: string) => Promise<void>;
|
|
@@ -140,8 +92,6 @@ export declare function createProviderHandlers(deps: ProviderHandlerDeps): {
|
|
|
140
92
|
}) => Promise<boolean>;
|
|
141
93
|
handleProviderRemove: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
142
94
|
handleProviderClearModels: (ws: WebSocket, providerId: string) => Promise<void>;
|
|
143
|
-
handleCustomModelSet: (ws: WebSocket, providerId: string, modelId: string, definition: NonNullable<ProviderConfig['customModels']>[string]) => Promise<void>;
|
|
144
|
-
handleCustomModelRemove: (ws: WebSocket, providerId: string, modelId: string) => Promise<void>;
|
|
145
95
|
handleProviderUndoClear: (ws: WebSocket, providerId: string, previousModels: string[]) => Promise<void>;
|
|
146
96
|
handleProviderUpdate: (ws: WebSocket, payload: {
|
|
147
97
|
id: string;
|
|
@@ -151,10 +101,11 @@ export declare function createProviderHandlers(deps: ProviderHandlerDeps): {
|
|
|
151
101
|
models?: string[] | undefined;
|
|
152
102
|
customModels?: ProviderConfig['customModels'] | undefined;
|
|
153
103
|
}) => Promise<void>;
|
|
104
|
+
handleOAuthStart: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind, customProviderId?: string) => Promise<void>;
|
|
105
|
+
handleOAuthCode: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind, input: string) => Promise<void>;
|
|
106
|
+
handleOAuthCancel: (ws: WebSocket, kind: import("@wrongstack/providers/oauth").OAuthKind) => void;
|
|
154
107
|
handleProviderProbe: (ws: WebSocket, providerId: string, timeoutMs?: number) => Promise<void>;
|
|
155
|
-
|
|
156
|
-
handleOAuthCode: (ws: WebSocket, kind: OAuthKind, input: string) => Promise<void>;
|
|
157
|
-
handleOAuthCancel: (ws: WebSocket, kind: OAuthKind) => void;
|
|
108
|
+
broadcastSaved: (providers: Record<string, ProviderConfig>) => void;
|
|
158
109
|
loadConfigProviders: () => Promise<Record<string, ProviderConfig>>;
|
|
159
110
|
};
|
|
160
111
|
//# sourceMappingURL=provider-handlers.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EventBus } from '@wrongstack/core/kernel';
|
|
2
|
-
import { AgentStatusTracker
|
|
2
|
+
import { AgentStatusTracker } from '@wrongstack/core/coordination';
|
|
3
|
+
import { getSessionRegistry } from '@wrongstack/core/storage';
|
|
3
4
|
import type { Config, Logger } from '@wrongstack/core/types';
|
|
4
5
|
export interface StandaloneSessionIdentityPaths {
|
|
5
6
|
globalRoot: string;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Per-section context-window token estimate for the `context.debug` command.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Since card #5 (slice 5g) this module delegates the actual token math to
|
|
5
|
+
* the canonical calibrated estimator in `@wrongstack/core/utils`
|
|
6
|
+
* (3.5 chars/token basis + per-model-family EWM calibration — see
|
|
7
|
+
* `core/src/utils/token-estimate.ts`). Before this, the WebUI computed a
|
|
8
|
+
* private 4-chars/token estimate, so the number in the browser's context
|
|
9
|
+
* debug view diverged from what compaction and the TUI context bar were
|
|
10
|
+
* actually deciding on (~14% for typical mixed content). Delegating means
|
|
11
|
+
* the user sees the same number the system acts on.
|
|
9
12
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* User-visible shift (intentional): all token figures shown by the WebUI
|
|
14
|
+
* context breakdown now match the CLI/TUI estimator — mixed-content
|
|
15
|
+
* conversations read ~14% HIGHER than the old 4-chars/token figures
|
|
16
|
+
* (3.5 chars/token is a more conservative, over-estimating basis by
|
|
17
|
+
* design, so compaction triggers are consistent rather than optimistic).
|
|
18
|
+
* Previews, block walking, and the `ContextBreakdown` shape are unchanged.
|
|
19
|
+
*
|
|
20
|
+
* `stringifyContent` stays local: its circular-reference fallback and the
|
|
21
|
+
* duck-typed block walk below are presentation-side concerns the canonical
|
|
22
|
+
* estimator does not share (it walks typed `Message` content).
|
|
12
23
|
*/
|
|
13
|
-
/**
|
|
24
|
+
/** Calibrated token estimate for a string — delegates to the shared basis. */
|
|
14
25
|
export declare function estimateTokens(s: string): number;
|
|
15
26
|
/** Stringify arbitrary content for length estimation (JSON, with fallbacks). */
|
|
16
27
|
export declare function stringifyContent(c: unknown): string;
|