@wrongstack/webui 0.265.1 → 0.267.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.
@@ -1,6 +1,7 @@
1
1
  import { WebSocket } from 'ws';
2
- import { Agent, EventBus, SessionStore, ToolRegistry, ModelsRegistry, ConfigStore, SecretVault, JournalEntry, Logger, MemoryStore, Config, MCPRegistryHandle, ProviderConfig, ProviderApiKey, Context, SkillLoader } from '@wrongstack/core';
2
+ import { Agent, EventBus, SessionStore, ToolRegistry, ModelsRegistry, ConfigStore, SecretVault, JournalEntry, Logger, MemoryStore, ProviderConfig, ProviderApiKey, Context, SkillLoader } from '@wrongstack/core';
3
3
  import * as http from 'node:http';
4
+ import { MCPRegistry } from '@wrongstack/mcp';
4
5
  import { SkillInstaller } from '@wrongstack/core/skills';
5
6
 
6
7
  interface WSServerMessage {
@@ -402,6 +403,25 @@ declare function handleFilesList(ws: WebSocket, msg: unknown, projectRoot: strin
402
403
  * directory yields an empty-but-valid payload.
403
404
  */
404
405
  declare function handleGitInfo(ws: WebSocket, projectRoot: string): Promise<void>;
406
+ /**
407
+ * Read the working-tree change set (everything that differs from HEAD:
408
+ * staged, unstaged, and untracked) and broadcast a `git.changes` message.
409
+ *
410
+ * The file list comes from `git status --porcelain -z` (NUL-delimited so
411
+ * paths with spaces/unicode survive intact, and renames are unambiguous).
412
+ * Per-file line counts come from `--numstat` of both the unstaged and the
413
+ * staged diff, summed; untracked files count their own lines as additions.
414
+ * Never throws — a non-repo yields an empty list.
415
+ */
416
+ declare function handleGitChanges(ws: WebSocket, projectRoot: string): Promise<void>;
417
+ /**
418
+ * Resolve the before/after text for a single file and broadcast a `git.diff`
419
+ * message. `oldText` is the file at HEAD (`git show HEAD:<path>`), `newText`
420
+ * is the current working-tree content. New/untracked files have empty
421
+ * `oldText`; deleted files have empty `newText`. Binary or oversized files
422
+ * are reported with a flag instead of content so the client can show a notice.
423
+ */
424
+ declare function handleGitDiff(ws: WebSocket, projectRoot: string, path: string): Promise<void>;
405
425
 
406
426
  /**
407
427
  * Shared memory-operation WebSocket handlers for both the standalone WebUI
@@ -431,30 +451,36 @@ declare function handleMemoryRemember(ws: WebSocket, msg: unknown, memoryStore:
431
451
  declare function handleMemoryForget(ws: WebSocket, msg: unknown, memoryStore: MemoryStore): Promise<void>;
432
452
 
433
453
  /**
434
- * MCP management handlers for the WebUI server.
435
- * Handles MCP-related WS messages from the browser client.
454
+ * MCP management handlers for the WebUI server (both the standalone
455
+ * `wrongstack webui` server and the CLI's embedded `--webui` server).
456
+ *
457
+ * These are thin WebSocket translators over the shared, surface-agnostic
458
+ * management core in `@wrongstack/mcp` (`manage.ts`) — the SAME core the REPL
459
+ * `/mcp` command writes against (same config.json, same MCPRegistry). All the
460
+ * config IO, url/header persistence, and live registry start/stop logic lives
461
+ * there; here we only map structured results to WS events the browser expects.
436
462
  */
437
463
 
438
- /** Handle mcp.list — return all configured MCP servers */
439
- declare function handleMcpList(ws: WebSocket, _msg: WSClientMessage, config: Config, _globalConfigPath: string, mcpRegistry?: MCPRegistryHandle): Promise<void>;
440
- /** Handle mcp.add — add a new MCP server configuration */
441
- declare function handleMcpAdd(ws: WebSocket, msg: WSClientMessage, config: Config, globalConfigPath: string, mcpRegistry?: MCPRegistryHandle): Promise<void>;
442
- /** Handle mcp.removeremove an MCP server configuration */
443
- declare function handleMcpRemove(ws: WebSocket, msg: WSClientMessage, _config: Config, globalConfigPath: string, mcpRegistry?: MCPRegistryHandle): Promise<void>;
444
- /** Handle mcp.updateupdate an existing MCP server configuration */
445
- declare function handleMcpUpdate(ws: WebSocket, msg: WSClientMessage, _config: Config, globalConfigPath: string): Promise<void>;
446
- /** Handle mcp.wakewake a sleeping MCP server (restart it) */
447
- declare function handleMcpWake(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string, mcpRegistry?: MCPRegistryHandle): Promise<void>;
448
- /** Handle mcp.sleepput an MCP server to sleep (stop it) */
449
- declare function handleMcpSleep(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string, mcpRegistry?: MCPRegistryHandle): Promise<void>;
450
- /** Handle mcp.discoverperform one-time tool discovery on an MCP server */
451
- declare function handleMcpDiscover(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string, _mcpRegistry?: MCPRegistryHandle): Promise<void>;
452
- /** Handle mcp.enableenable an MCP server */
453
- declare function handleMcpEnable(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string): Promise<void>;
454
- /** Handle mcp.disabledisable an MCP server */
455
- declare function handleMcpDisable(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string): Promise<void>;
456
- /** Handle mcp.restartrestart an MCP server */
457
- declare function handleMcpRestart(ws: WebSocket, msg: WSClientMessage, _config: Config, _globalConfigPath: string): Promise<void>;
464
+ /** mcp.list — configured servers merged with live registry status + tools. */
465
+ declare function handleMcpList(ws: WebSocket, _msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
466
+ /** mcp.add — persist a new server (incl. url/headers) and start it if enabled. */
467
+ declare function handleMcpAdd(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
468
+ /** mcp.updatere-persist config (incl. url/headers) and re-apply to registry. */
469
+ declare function handleMcpUpdate(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
470
+ /** mcp.removestop the server and delete it from config. */
471
+ declare function handleMcpRemove(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
472
+ /** mcp.enableflip enabled:true in config and start the server. */
473
+ declare function handleMcpEnable(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
474
+ /** mcp.disablestop the server and flip enabled:false in config. */
475
+ declare function handleMcpDisable(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
476
+ /** mcp.sleepstop a running server (config stays enabled). */
477
+ declare function handleMcpSleep(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
478
+ /** mcp.wakerestart a sleeping/stopped server from config. */
479
+ declare function handleMcpWake(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
480
+ /** mcp.restartstop + start a server. */
481
+ declare function handleMcpRestart(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
482
+ /** mcp.discoverensure the server is running and report its live tools. */
483
+ declare function handleMcpDiscover(ws: WebSocket, msg: WSClientMessage, globalConfigPath: string, mcpRegistry?: MCPRegistry): Promise<void>;
458
484
 
459
485
  /**
460
486
  * Custom context modes — user-defined presets that are loaded from disk,
@@ -754,4 +780,4 @@ declare function startWebUI(opts?: WebUIOptions & {
754
780
  open?: boolean | undefined;
755
781
  }): Promise<void>;
756
782
 
757
- export { AutoPhaseWebSocketHandler, type BackendServices, type ConnectedClient, type ContextBreakdown, type CreateHttpServerOptions, type CustomContextMode, type CustomModeStore, type EternalBroadcast, type EternalSubscribe, type EternalSubscription, type KeyOpResult, type MessageTokenEntry, type ProvidersRecord, type ShellOpenRequest, type ShellOpenResult, type ShellOpenTarget, type SkillsContext, type ToolTokenEntry, type VerifyClientInput, type WSClientMessage, type WSServerMessage, type WebUIInstanceRecord, type WebUIOptions, addProvider, broadcast, browserOpenCommand, buildCspHeader, createCustomModeStore, createEternalSubscription, createHttpServer, createProviderConfigIO, defaultBaseDir, deleteKey, errMessage, estimateTokens, extractToken, findFreePort, formatInstances, generateAuthToken, handleFilesList, handleFilesRead, handleFilesTree, handleFilesWrite, handleGitInfo, handleMcpAdd, handleMcpDisable, handleMcpDiscover, handleMcpEnable, handleMcpList, handleMcpRemove, handleMcpRestart, handleMcpSleep, handleMcpUpdate, handleMcpWake, handleMemoryForget, handleMemoryList, handleMemoryRemember, handleShellOpen, handleSkillsContent, handleSkillsCreate, handleSkillsEdit, handleSkillsExport, handleSkillsInstall, handleSkillsUninstall, handleSkillsUpdate, hostHeaderOk, injectWsPort, isLoopbackBind, isLoopbackHostname, isPortFree, listInstances, loadSavedProviders, maskedKey, messagePreview, messageTokens, normalizeKeys, openBrowser, registerInstance, registryPath, removeProvider, saveProviders, send, sendResult, setActiveKey, startWebUI, stringifyContent, tokenMatches, unregisterInstance, upsertKey, verifyClient, writeKeysBack };
783
+ export { AutoPhaseWebSocketHandler, type BackendServices, type ConnectedClient, type ContextBreakdown, type CreateHttpServerOptions, type CustomContextMode, type CustomModeStore, type EternalBroadcast, type EternalSubscribe, type EternalSubscription, type KeyOpResult, type MessageTokenEntry, type ProvidersRecord, type ShellOpenRequest, type ShellOpenResult, type ShellOpenTarget, type SkillsContext, type ToolTokenEntry, type VerifyClientInput, type WSClientMessage, type WSServerMessage, type WebUIInstanceRecord, type WebUIOptions, addProvider, broadcast, browserOpenCommand, buildCspHeader, createCustomModeStore, createEternalSubscription, createHttpServer, createProviderConfigIO, defaultBaseDir, deleteKey, errMessage, estimateTokens, extractToken, findFreePort, formatInstances, generateAuthToken, handleFilesList, handleFilesRead, handleFilesTree, handleFilesWrite, handleGitChanges, handleGitDiff, handleGitInfo, handleMcpAdd, handleMcpDisable, handleMcpDiscover, handleMcpEnable, handleMcpList, handleMcpRemove, handleMcpRestart, handleMcpSleep, handleMcpUpdate, handleMcpWake, handleMemoryForget, handleMemoryList, handleMemoryRemember, handleShellOpen, handleSkillsContent, handleSkillsCreate, handleSkillsEdit, handleSkillsExport, handleSkillsInstall, handleSkillsUninstall, handleSkillsUpdate, hostHeaderOk, injectWsPort, isLoopbackBind, isLoopbackHostname, isPortFree, listInstances, loadSavedProviders, maskedKey, messagePreview, messageTokens, normalizeKeys, openBrowser, registerInstance, registryPath, removeProvider, saveProviders, send, sendResult, setActiveKey, startWebUI, stringifyContent, tokenMatches, unregisterInstance, upsertKey, verifyClient, writeKeysBack };