claude-memory-layer 1.0.33 → 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
@@ -9813,7 +9824,8 @@ var HermesSessionHistoryImporter = class {
9813
9824
  source: "hermes",
9814
9825
  hermesSource: session.source,
9815
9826
  sourceSessionId: session.id,
9816
- sourceSessionHash: hashLabel(session.id)
9827
+ sourceSessionHash: hashLabel(session.id),
9828
+ projectPath: effectiveProjectPath
9817
9829
  }
9818
9830
  );
9819
9831
  if (appendResult.success && appendResult.isDuplicate) {
@@ -9850,7 +9862,8 @@ var HermesSessionHistoryImporter = class {
9850
9862
  source: "hermes",
9851
9863
  hermesSource: session.source,
9852
9864
  sourceSessionId: session.id,
9853
- sourceSessionHash: hashLabel(session.id)
9865
+ sourceSessionHash: hashLabel(session.id),
9866
+ projectPath: effectiveProjectPath
9854
9867
  }
9855
9868
  );
9856
9869
  if (appendResult.success && appendResult.isDuplicate) {
@@ -13969,7 +13982,7 @@ async function runMarketContextCommand(options) {
13969
13982
  }
13970
13983
  }
13971
13984
  var program = new Command();
13972
- program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.33");
13985
+ program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.35");
13973
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) => {
13974
13987
  try {
13975
13988
  await runMarketContextCommand(options);