sepia-mcp 0.6.1 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +57 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -817,7 +817,8 @@ var SearchInput = v.object({
817
817
  namespace: v.optional(v.pipe(v.string(), v.description("Restrict to a namespace"))),
818
818
  type: v.optional(v.pipe(v.string(), v.maxLength(64), v.description("Memory type (fact/observation/preference/instruction) OR entity type (person/project/tool/concept/repo)"))),
819
819
  tags: v.optional(v.pipe(tagsSchema, v.description("Match memories/entities carrying ALL of these tags"))),
820
- limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(SEARCH_LIMIT_MAX), v.description("Max results (default 10, max 25)")), 10)
820
+ limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(SEARCH_LIMIT_MAX), v.description("Max results (default 10, max 25)")), 10),
821
+ min_terms: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(50), v.description("Drop hits covering fewer than this many query terms (precision dial; absent = best-effort recall). Too high returns 0 with `terms` present — that is the filter, not a missing memory.")))
821
822
  });
822
823
  var TraverseInput = v.object({
823
824
  start_id: v.pipe(uuidSchema, v.description("Entity UUID to start the BFS walk from")),
@@ -3693,6 +3694,52 @@ var memoryEntityLinks = pgTable("memory_entity_links", {
3693
3694
  name: "memory_entity_links_pkey"
3694
3695
  })
3695
3696
  ]);
3697
+ var telemetrySettings = pgTable("telemetry_settings", {
3698
+ ownerId: uuid2("owner_id").primaryKey().notNull(),
3699
+ tier: text().notNull().default("off"),
3700
+ ttlDays: integer("ttl_days").notNull().default(30),
3701
+ enabledAt: timestamp("enabled_at", { withTimezone: true, mode: "string" }),
3702
+ updatedAt: timestamp("updated_at", {
3703
+ withTimezone: true,
3704
+ mode: "string"
3705
+ }).defaultNow()
3706
+ }, (table) => [
3707
+ foreignKey({
3708
+ columns: [table.ownerId],
3709
+ foreignColumns: [users.id],
3710
+ name: "telemetry_settings_owner_id_fkey"
3711
+ }).onDelete("cascade"),
3712
+ check("telemetry_settings_tier_check", sql`${table.tier} IN ('off', 'signals', 'transcripts')`),
3713
+ check("telemetry_settings_ttl_check", sql`${table.ttlDays} >= 1 AND ${table.ttlDays} <= 365`)
3714
+ ]);
3715
+ var telemetryEvents = pgTable("telemetry_events", {
3716
+ id: uuid2().defaultRandom().primaryKey().notNull(),
3717
+ ownerId: uuid2("owner_id").notNull(),
3718
+ createdAt: timestamp("created_at", {
3719
+ withTimezone: true,
3720
+ mode: "string"
3721
+ }).defaultNow(),
3722
+ sessionHash: text("session_hash"),
3723
+ tool: text().notNull(),
3724
+ action: text(),
3725
+ engine: text(),
3726
+ queryFingerprint: text("query_fingerprint"),
3727
+ terms: integer(),
3728
+ bestMatchedTerms: integer("best_matched_terms"),
3729
+ hitCount: integer("hit_count"),
3730
+ latencyMs: integer("latency_ms"),
3731
+ resultChars: integer("result_chars"),
3732
+ queryText: text("query_text"),
3733
+ hitIds: uuid2("hit_ids").array()
3734
+ }, (table) => [
3735
+ index("idx_telemetry_events_owner").using("btree", table.ownerId.asc().nullsLast().op("uuid_ops")),
3736
+ index("idx_telemetry_events_session").using("btree", table.sessionHash.asc().nullsLast().op("text_ops")),
3737
+ foreignKey({
3738
+ columns: [table.ownerId],
3739
+ foreignColumns: [users.id],
3740
+ name: "telemetry_events_owner_id_fkey"
3741
+ }).onDelete("cascade")
3742
+ ]);
3696
3743
  // ../../node_modules/.bun/@neondatabase+serverless@1.1.0/node_modules/@neondatabase/serverless/index.mjs
3697
3744
  var So = Object.create;
3698
3745
  var Ie = Object.defineProperty;
@@ -8596,6 +8643,8 @@ buffer/index.js:
8596
8643
  * @license MIT
8597
8644
  *)
8598
8645
  */
8646
+ // ../shared/src/db/lib/telemetry.ts
8647
+ var tierCache = new Map;
8599
8648
  // src/client.ts
8600
8649
  class SepiaApiError extends Error {
8601
8650
  status;
@@ -8777,6 +8826,8 @@ class SepiaClient {
8777
8826
  qs.set("tags", params.tags.join(","));
8778
8827
  if (params.limit !== undefined)
8779
8828
  qs.set("limit", String(params.limit));
8829
+ if (params.min_terms !== undefined)
8830
+ qs.set("min_terms", String(params.min_terms));
8780
8831
  return this.request("GET", `/api/search?${qs.toString()}`);
8781
8832
  }
8782
8833
  traverseGraph(startId, depth) {
@@ -9057,19 +9108,20 @@ function registerSearchTools(server, client) {
9057
9108
  server.tool({
9058
9109
  name: "search",
9059
9110
  title: "Search Memory",
9060
- description: "Unified keyword + metadata search across memories, entity names, and entity summaries. Multi-word queries are best-effort: rows matching more of your words rank first, and results are never emptied by one absent word. `partial: true` in the result means no single row covered the whole query.",
9111
+ description: "Unified keyword + metadata search across memories, entity names, and entity summaries. Multi-word queries are best-effort: rows matching more of your words rank first, and results are never emptied by one absent word. `partial: true` means no single row covered the whole query, and `best_matched_terms` reports the best coverage achieved — pass it back as `min_terms` when you want precision instead of recall.",
9061
9112
  icons: [SEPIA_ICON],
9062
9113
  schema: SearchToolInput,
9063
9114
  annotations: { readOnlyHint: true }
9064
9115
  }, safe(async (args) => {
9065
- const { count, results, terms, partial } = await client.search({
9116
+ const { count, results, terms, best_matched_terms, partial } = await client.search({
9066
9117
  q: args.q,
9067
9118
  namespace: args.namespace,
9068
9119
  type: args.type,
9069
9120
  tags: args.tags,
9070
- limit: args.limit
9121
+ limit: args.limit,
9122
+ min_terms: args.min_terms
9071
9123
  });
9072
- return { count, terms, partial, hits: results };
9124
+ return { count, terms, best_matched_terms, partial, hits: results };
9073
9125
  }));
9074
9126
  }
9075
9127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sepia-mcp",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "description": "Self-contained MCP server for Sepia — a personal knowledge-graph memory server. Talks to the Sepia REST API (SEPIA_URL + SEPIA_API_KEY); stdio or HTTP transport.",
5
5
  "type": "module",
6
6
  "repository": {