@wrongstack/webui 0.89.1 → 0.89.3

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,4 +1,5 @@
1
1
  // src/server/index.ts
2
+ import { expectDefined as expectDefined2 } from "@wrongstack/core";
2
3
  import * as fs4 from "fs/promises";
3
4
  import * as path4 from "path";
4
5
 
@@ -163,7 +164,7 @@ import {
163
164
  collabPauseMiddleware,
164
165
  collabInjectMiddleware,
165
166
  estimateRequestTokensCalibrated,
166
- EventBus,
167
+ EventBus as EventBus2,
167
168
  HybridCompactor as HybridCompactor2,
168
169
  ProviderRegistry,
169
170
  TOKENS as TOKENS2,
@@ -179,7 +180,7 @@ import {
179
180
  } from "@wrongstack/core";
180
181
  import { ToolExecutor } from "@wrongstack/core/execution";
181
182
  import { buildProviderFactoriesFromRegistry, makeProviderFromConfig } from "@wrongstack/providers";
182
- import { builtinToolsPack, forgetTool, rememberTool } from "@wrongstack/tools";
183
+ import { builtinToolsPack, forgetTool, rememberTool, searchMemoryTool, relatedMemoryTool } from "@wrongstack/tools";
183
184
  import { WebSocketServer } from "ws";
184
185
 
185
186
  // ../runtime/src/container.ts
@@ -224,7 +225,7 @@ function createDefaultContainer(opts) {
224
225
  secretScrubber: container.resolve(TOKENS.SecretScrubber)
225
226
  })
226
227
  );
227
- const memoryStore = new DefaultMemoryStore({ paths: wpaths });
228
+ const memoryStore = new DefaultMemoryStore({ paths: wpaths, events: opts.events });
228
229
  container.bind(TOKENS.MemoryStore, () => memoryStore);
229
230
  const skillLoader = new DefaultSkillLoader({ paths: wpaths, bundledDir: opts.bundledSkillsDir });
230
231
  container.bind(TOKENS.SkillLoader, () => skillLoader);
@@ -1693,12 +1694,7 @@ function createProviderConfigIO(configPath) {
1693
1694
  }
1694
1695
 
1695
1696
  // src/server/provider-keys.ts
1696
- function expectDefined(value) {
1697
- if (value === null || value === void 0) {
1698
- throw new Error("Expected value to be defined");
1699
- }
1700
- return value;
1701
- }
1697
+ import { expectDefined } from "@wrongstack/core";
1702
1698
  function normalizeKeys(cfg) {
1703
1699
  if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
1704
1700
  return cfg.apiKeys.map((k) => ({ ...k }));
@@ -1830,7 +1826,10 @@ function createProviderHandlers(deps) {
1830
1826
  return loadSavedProviders(globalConfigPath, vault);
1831
1827
  }
1832
1828
  async function saveConfigProviders(providers) {
1833
- const next = configWriteLock.then(() => saveProviders(globalConfigPath, vault, providers));
1829
+ const next = configWriteLock.then(() => saveProviders(globalConfigPath, vault, providers)).catch((err) => {
1830
+ const msg = err instanceof Error ? err.message : String(err);
1831
+ console.error(`[ProviderHandlers] saveProviders failed: ${msg}`);
1832
+ });
1834
1833
  configWriteLock = next;
1835
1834
  deps.setConfigWriteLock(next);
1836
1835
  await next;
@@ -2004,12 +2003,6 @@ function estimateContextBreakdown(input) {
2004
2003
  }
2005
2004
 
2006
2005
  // src/server/index.ts
2007
- function expectDefined2(value) {
2008
- if (value === null || value === void 0) {
2009
- throw new Error("Expected value to be defined");
2010
- }
2011
- return value;
2012
- }
2013
2006
  async function startWebUI(opts = {}) {
2014
2007
  const requestedWsPort = opts.wsPort ?? 3457;
2015
2008
  const wsHost = opts.wsHost ?? "127.0.0.1";
@@ -2062,9 +2055,11 @@ async function startWebUI(opts = {}) {
2062
2055
  if (config.features.memory) {
2063
2056
  toolRegistry.register(rememberTool(memoryStore));
2064
2057
  toolRegistry.register(forgetTool(memoryStore));
2058
+ toolRegistry.register(searchMemoryTool(memoryStore));
2059
+ toolRegistry.register(relatedMemoryTool(memoryStore));
2065
2060
  }
2066
2061
  console.log("[WebUI] Tool registry loaded:", toolRegistry.list().length, "tools");
2067
- const events = new EventBus();
2062
+ const events = new EventBus2();
2068
2063
  events.setLogger(logger);
2069
2064
  const sessionStore = new DefaultSessionStore2({ dir: wpaths.projectSessions });
2070
2065
  sessionStore.prune(DEFAULT_SESSION_PRUNE_DAYS).then((count) => {