@wrongstack/webui 0.89.1 → 0.104.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,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // src/server/index.ts
3
+ import { expectDefined as expectDefined2 } from "@wrongstack/core";
3
4
  import * as fs4 from "fs/promises";
4
5
  import * as path4 from "path";
5
6
 
@@ -164,7 +165,7 @@ import {
164
165
  collabPauseMiddleware,
165
166
  collabInjectMiddleware,
166
167
  estimateRequestTokensCalibrated,
167
- EventBus,
168
+ EventBus as EventBus2,
168
169
  HybridCompactor as HybridCompactor2,
169
170
  ProviderRegistry,
170
171
  TOKENS as TOKENS2,
@@ -180,7 +181,7 @@ import {
180
181
  } from "@wrongstack/core";
181
182
  import { ToolExecutor } from "@wrongstack/core/execution";
182
183
  import { buildProviderFactoriesFromRegistry, makeProviderFromConfig } from "@wrongstack/providers";
183
- import { builtinToolsPack, forgetTool, rememberTool } from "@wrongstack/tools";
184
+ import { builtinToolsPack, forgetTool, rememberTool, searchMemoryTool, relatedMemoryTool } from "@wrongstack/tools";
184
185
  import { WebSocketServer } from "ws";
185
186
 
186
187
  // ../runtime/src/container.ts
@@ -225,7 +226,7 @@ function createDefaultContainer(opts) {
225
226
  secretScrubber: container.resolve(TOKENS.SecretScrubber)
226
227
  })
227
228
  );
228
- const memoryStore = new DefaultMemoryStore({ paths: wpaths });
229
+ const memoryStore = new DefaultMemoryStore({ paths: wpaths, events: opts.events });
229
230
  container.bind(TOKENS.MemoryStore, () => memoryStore);
230
231
  const skillLoader = new DefaultSkillLoader({ paths: wpaths, bundledDir: opts.bundledSkillsDir });
231
232
  container.bind(TOKENS.SkillLoader, () => skillLoader);
@@ -1686,12 +1687,7 @@ async function saveProviders(configPath, vault, providers) {
1686
1687
  }
1687
1688
 
1688
1689
  // src/server/provider-keys.ts
1689
- function expectDefined(value) {
1690
- if (value === null || value === void 0) {
1691
- throw new Error("Expected value to be defined");
1692
- }
1693
- return value;
1694
- }
1690
+ import { expectDefined } from "@wrongstack/core";
1695
1691
  function normalizeKeys(cfg) {
1696
1692
  if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
1697
1693
  return cfg.apiKeys.map((k) => ({ ...k }));
@@ -1823,7 +1819,10 @@ function createProviderHandlers(deps) {
1823
1819
  return loadSavedProviders(globalConfigPath, vault);
1824
1820
  }
1825
1821
  async function saveConfigProviders(providers) {
1826
- const next = configWriteLock.then(() => saveProviders(globalConfigPath, vault, providers));
1822
+ const next = configWriteLock.then(() => saveProviders(globalConfigPath, vault, providers)).catch((err) => {
1823
+ const msg = err instanceof Error ? err.message : String(err);
1824
+ console.error(`[ProviderHandlers] saveProviders failed: ${msg}`);
1825
+ });
1827
1826
  configWriteLock = next;
1828
1827
  deps.setConfigWriteLock(next);
1829
1828
  await next;
@@ -1997,12 +1996,6 @@ function estimateContextBreakdown(input) {
1997
1996
  }
1998
1997
 
1999
1998
  // src/server/index.ts
2000
- function expectDefined2(value) {
2001
- if (value === null || value === void 0) {
2002
- throw new Error("Expected value to be defined");
2003
- }
2004
- return value;
2005
- }
2006
1999
  async function startWebUI(opts = {}) {
2007
2000
  const requestedWsPort = opts.wsPort ?? 3457;
2008
2001
  const wsHost = opts.wsHost ?? "127.0.0.1";
@@ -2055,9 +2048,11 @@ async function startWebUI(opts = {}) {
2055
2048
  if (config.features.memory) {
2056
2049
  toolRegistry.register(rememberTool(memoryStore));
2057
2050
  toolRegistry.register(forgetTool(memoryStore));
2051
+ toolRegistry.register(searchMemoryTool(memoryStore));
2052
+ toolRegistry.register(relatedMemoryTool(memoryStore));
2058
2053
  }
2059
2054
  console.log("[WebUI] Tool registry loaded:", toolRegistry.list().length, "tools");
2060
- const events = new EventBus();
2055
+ const events = new EventBus2();
2061
2056
  events.setLogger(logger);
2062
2057
  const sessionStore = new DefaultSessionStore2({ dir: wpaths.projectSessions });
2063
2058
  sessionStore.prune(DEFAULT_SESSION_PRUNE_DAYS).then((count) => {