claude-memory-layer 1.0.35 → 1.0.36

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/cli/index.js CHANGED
@@ -10371,7 +10371,7 @@ var sessionsRouter = new Hono();
10371
10371
  sessionsRouter.get("/", async (c) => {
10372
10372
  const page = parseInt(c.req.query("page") || "1", 10);
10373
10373
  const pageSize = parseInt(c.req.query("pageSize") || "20", 10);
10374
- const memoryService = getServiceFromQuery(c);
10374
+ const memoryService = getLightweightServiceFromQuery(c);
10375
10375
  try {
10376
10376
  await memoryService.initialize();
10377
10377
  const recentEvents = await memoryService.getRecentEvents(1e3);
@@ -10415,7 +10415,7 @@ sessionsRouter.get("/", async (c) => {
10415
10415
  });
10416
10416
  sessionsRouter.get("/:id", async (c) => {
10417
10417
  const { id } = c.req.param();
10418
- const memoryService = getServiceFromQuery(c);
10418
+ const memoryService = getLightweightServiceFromQuery(c);
10419
10419
  try {
10420
10420
  await memoryService.initialize();
10421
10421
  const events = await memoryService.getSessionHistory(id);
@@ -10461,7 +10461,7 @@ eventsRouter.get("/", async (c) => {
10461
10461
  const q = (c.req.query("q") || "").trim().toLowerCase();
10462
10462
  const limit = parseInt(c.req.query("limit") || "100", 10);
10463
10463
  const offset = parseInt(c.req.query("offset") || "0", 10);
10464
- const memoryService = getServiceFromQuery(c);
10464
+ const memoryService = getLightweightServiceFromQuery(c);
10465
10465
  try {
10466
10466
  await memoryService.initialize();
10467
10467
  let events;
@@ -10517,7 +10517,7 @@ eventsRouter.get("/", async (c) => {
10517
10517
  });
10518
10518
  eventsRouter.get("/:id", async (c) => {
10519
10519
  const { id } = c.req.param();
10520
- const memoryService = getServiceFromQuery(c);
10520
+ const memoryService = getLightweightServiceFromQuery(c);
10521
10521
  try {
10522
10522
  await memoryService.initialize();
10523
10523
  const recentEvents = await memoryService.getRecentEvents(1e4);
@@ -10556,6 +10556,10 @@ eventsRouter.get("/:id", async (c) => {
10556
10556
  // src/apps/server/api/search.ts
10557
10557
  import { Hono as Hono3 } from "hono";
10558
10558
  var searchRouter = new Hono3();
10559
+ function isEmbeddingBackendUnavailable(error) {
10560
+ const message = error instanceof Error ? error.message : String(error);
10561
+ return /model file path or buffer|onnxruntime|transformers|embedding backend/i.test(message);
10562
+ }
10559
10563
  searchRouter.post("/", async (c) => {
10560
10564
  const memoryService = getServiceFromQuery(c);
10561
10565
  try {
@@ -10597,15 +10601,41 @@ searchRouter.post("/", async (c) => {
10597
10601
  });
10598
10602
  searchRouter.post("/disclosure", async (c) => {
10599
10603
  let memoryService;
10604
+ let body;
10600
10605
  try {
10601
- const body = await c.req.json();
10606
+ body = await c.req.json();
10602
10607
  if (!body.query) {
10603
10608
  return c.json({ error: "Query is required" }, 400);
10604
10609
  }
10605
- memoryService = body.options?.strategy === "fast" ? getLightweightServiceFromQuery(c) : getServiceFromQuery(c);
10606
- await memoryService.initialize();
10607
- const result = await memoryService.searchDisclosure(body.query, body.options);
10608
- return c.json(result);
10610
+ const useFastStrategy = body.options?.strategy === "fast";
10611
+ memoryService = useFastStrategy ? getLightweightServiceFromQuery(c) : getServiceFromQuery(c);
10612
+ try {
10613
+ await memoryService.initialize();
10614
+ const result = await memoryService.searchDisclosure(body.query, body.options);
10615
+ return c.json(result);
10616
+ } catch (error) {
10617
+ if (!useFastStrategy && isEmbeddingBackendUnavailable(error)) {
10618
+ await memoryService.shutdown();
10619
+ memoryService = getLightweightServiceFromQuery(c);
10620
+ await memoryService.initialize();
10621
+ const result = await memoryService.searchDisclosure(body.query, {
10622
+ ...body.options,
10623
+ strategy: "fast"
10624
+ });
10625
+ return c.json({
10626
+ ...result,
10627
+ meta: {
10628
+ ...result.meta,
10629
+ fallbackApplied: true,
10630
+ fallbackTrace: [
10631
+ ...result.meta.fallbackTrace || [],
10632
+ "fallback:embedding-backend-unavailable:fast"
10633
+ ]
10634
+ }
10635
+ });
10636
+ }
10637
+ throw error;
10638
+ }
10609
10639
  } catch (error) {
10610
10640
  return c.json({ error: error.message }, 500);
10611
10641
  } finally {
@@ -10613,7 +10643,7 @@ searchRouter.post("/disclosure", async (c) => {
10613
10643
  }
10614
10644
  });
10615
10645
  searchRouter.get("/disclosure/:resultId/expand", async (c) => {
10616
- const memoryService = getServiceFromQuery(c);
10646
+ const memoryService = getLightweightServiceFromQuery(c);
10617
10647
  try {
10618
10648
  const resultId = c.req.param("resultId");
10619
10649
  const rawWindowSize = c.req.query("windowSize");
@@ -10633,7 +10663,7 @@ searchRouter.get("/disclosure/:resultId/expand", async (c) => {
10633
10663
  }
10634
10664
  });
10635
10665
  searchRouter.get("/disclosure/:resultId/source", async (c) => {
10636
- const memoryService = getServiceFromQuery(c);
10666
+ const memoryService = getLightweightServiceFromQuery(c);
10637
10667
  try {
10638
10668
  const resultId = c.req.param("resultId");
10639
10669
  const result = await memoryService.sourceDisclosure(resultId);
@@ -13982,7 +14012,7 @@ async function runMarketContextCommand(options) {
13982
14012
  }
13983
14013
  }
13984
14014
  var program = new Command();
13985
- program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.35");
14015
+ program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.36");
13986
14016
  program.command("market-context").description("Fetch read-only DART/FRED/Finnhub context with structured MarketContextSnapshot bull/bear/risk/catalyst analysis").option("--company <name>", "Company name for DART fallback search and report subject").option("--dart-corp-code <code>", "Exact DART corp_code for issuer-specific filings").option("--symbol <ticker>", "Listed ticker for Finnhub company profile").option("--providers <list>", "Comma-separated providers: dart,fred,finnhub").option("--fred-series <list>", "Comma-separated FRED series IDs").option("--json", "Print structured JSON including analysis.marketSnapshot").option("--no-snapshot", "Disable MarketContextSnapshot and DART company snapshot analysis").action(async (options) => {
13987
14017
  try {
13988
14018
  await runMarketContextCommand(options);