claude-memory-layer 1.0.34 → 1.0.35

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
@@ -3580,6 +3580,16 @@ var SQLiteEventStore = class {
3580
3580
  getDatabase() {
3581
3581
  return this.db;
3582
3582
  }
3583
+ hasTableColumn(tableName, columnName) {
3584
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(tableName))
3585
+ return false;
3586
+ try {
3587
+ const rows = sqliteAll(this.db, `PRAGMA table_info("${tableName}")`, []);
3588
+ return rows.some((row) => row.name === columnName);
3589
+ } catch {
3590
+ return false;
3591
+ }
3592
+ }
3583
3593
  async recordRetrievalTrace(input) {
3584
3594
  await this.initialize();
3585
3595
  const traceId = randomUUID5();
@@ -3645,17 +3655,18 @@ var SQLiteEventStore = class {
3645
3655
  async getRetrievalTraceStats() {
3646
3656
  await this.initialize();
3647
3657
  try {
3658
+ const rewrittenQueryRewriteKindSql = this.hasTableColumn("retrieval_traces", "query_rewrite_kind") ? REWRITTEN_QUERY_REWRITE_KIND_SQL : "0";
3648
3659
  const row = sqliteGet(
3649
3660
  this.db,
3650
3661
  `SELECT
3651
3662
  COUNT(*) as total_queries,
3652
3663
  AVG(candidate_count) as avg_candidate_count,
3653
3664
  AVG(selected_count) as avg_selected_count,
3654
- SUM(CASE WHEN ${REWRITTEN_QUERY_REWRITE_KIND_SQL} THEN 1 ELSE 0 END) as rewritten_queries,
3655
- SUM(CASE WHEN ${REWRITTEN_QUERY_REWRITE_KIND_SQL} AND selected_count > 0 THEN 1 ELSE 0 END) as rewritten_queries_with_selection,
3656
- SUM(CASE WHEN NOT (${REWRITTEN_QUERY_REWRITE_KIND_SQL}) AND selected_count > 0 THEN 1 ELSE 0 END) as raw_queries_with_selection,
3657
- AVG(CASE WHEN ${REWRITTEN_QUERY_REWRITE_KIND_SQL} THEN selected_count END) as avg_selected_count_for_rewritten_queries,
3658
- AVG(CASE WHEN NOT (${REWRITTEN_QUERY_REWRITE_KIND_SQL}) THEN selected_count END) as avg_selected_count_for_raw_queries,
3665
+ SUM(CASE WHEN ${rewrittenQueryRewriteKindSql} THEN 1 ELSE 0 END) as rewritten_queries,
3666
+ SUM(CASE WHEN ${rewrittenQueryRewriteKindSql} AND selected_count > 0 THEN 1 ELSE 0 END) as rewritten_queries_with_selection,
3667
+ SUM(CASE WHEN NOT (${rewrittenQueryRewriteKindSql}) AND selected_count > 0 THEN 1 ELSE 0 END) as raw_queries_with_selection,
3668
+ AVG(CASE WHEN ${rewrittenQueryRewriteKindSql} THEN selected_count END) as avg_selected_count_for_rewritten_queries,
3669
+ AVG(CASE WHEN NOT (${rewrittenQueryRewriteKindSql}) THEN selected_count END) as avg_selected_count_for_raw_queries,
3659
3670
  CASE
3660
3671
  WHEN SUM(candidate_count) > 0 THEN (SUM(selected_count) * 1.0 / SUM(candidate_count))
3661
3672
  ELSE 0
@@ -13971,7 +13982,7 @@ async function runMarketContextCommand(options) {
13971
13982
  }
13972
13983
  }
13973
13984
  var program = new Command();
13974
- program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.34");
13985
+ program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.35");
13975
13986
  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) => {
13976
13987
  try {
13977
13988
  await runMarketContextCommand(options);