sepia-mcp 0.1.0 → 0.3.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 +256 -289
  2. package/package.json +8 -5
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
- // @bun
2
- var __require = import.meta.require;
1
+ #!/usr/bin/env node
3
2
 
4
3
  // src/index.ts
5
4
  import { McpServer } from "tmcp";
@@ -587,65 +586,65 @@ class ValibotJsonSchemaAdapter extends JsonSchemaAdapter {
587
586
 
588
587
  // ../shared/src/types.ts
589
588
  var DEFAULT_NAMESPACE = "personal";
590
- var MEMORY_CONTRACT = `SEPIA MEMORY \u2014 MANDATORY. You are connected to the user's personal memory server
589
+ var MEMORY_CONTRACT = `SEPIA MEMORY — MANDATORY. You are connected to the user's personal memory server
591
590
  (sepia) over MCP at /mcp. It stores a knowledge graph in namespaces (default "personal"):
592
591
  entities (people, projects, tools, concepts, repos), relations (typed, weighted edges),
593
592
  memories (facts/observations/preferences/instructions with importance 0-1).
594
593
 
595
- TYPES \u2014 use the canonical values, never invent new ones:
594
+ TYPES — use the canonical values, never invent new ones:
596
595
  - Entity type (manage_entity): person | project | tool | concept | repo. Unknown types
597
596
  are auto-normalized to concept + tag, so prefer the canonical list.
598
597
  - Memory type (manage_memory): fact (verified/decided) | observation (what you saw
599
598
  happen) | preference (user's stated or observed choice) | instruction (how to behave).
600
599
  - Tags (both): short lowercase hyphenated topical labels (e.g. user-experience, auth,
601
- performance) for discovery \u2014 add 1-4 per write when the topic is recurring.
600
+ performance) for discovery — add 1-4 per write when the topic is recurring.
602
601
 
603
- RULE 0 \u2014 THIS IS NOT OPTIONAL. If you skip memory, you WILL hallucinate preferences,
604
- repeat questions, and contradict past decisions. Using sepia is not a suggestion \u2014 it is
602
+ RULE 0 — THIS IS NOT OPTIONAL. If you skip memory, you WILL hallucinate preferences,
603
+ repeat questions, and contradict past decisions. Using sepia is not a suggestion — it is
605
604
  your first tool call.
606
605
 
607
- MANDATORY \u2014 ALMOST EVERY MESSAGE: Default to using Sepia on every turn \u2014 search BEFORE
606
+ MANDATORY — ALMOST EVERY MESSAGE: Default to using Sepia on every turn — search BEFORE
608
607
  you answer and persist AFTER you answer. Only skip for trivial chitchat ("hi", "thanks",
609
608
  "bye") with zero durable content. If in doubt, call Sepia. Skipping memory = hallucinating.
610
609
 
611
- MANDATORY WORKFLOW \u2014 do this on ALMOST EVERY turn:
610
+ MANDATORY WORKFLOW — do this on ALMOST EVERY turn:
612
611
 
613
612
  BEFORE you answer (every turn except trivial chitchat):
614
613
  1. Call "search" with 2-5 keywords from the user's current message + task (e.g. query="auth rate limiting"). If sparse, also call "traverse_graph" from the top entity.
615
- 2. Weave hits into your answer ("From your memory: ..."). If nothing, say so \u2014 never fabricate.
614
+ 2. Weave hits into your answer ("From your memory: ..."). If nothing, say so — never fabricate.
616
615
 
617
616
  AFTER you answer (every turn where you learned something):
618
- 1. If you learned a durable fact \u2014 preference, decision + why, project fact, stack/tool choice, person/role, convention, user correction \u2014 persist IMMEDIATELY in the same turn after your response:
619
- - ensure entity exists (manage_entity find \u2192 create with summary if missing)
617
+ 1. If you learned a durable fact — preference, decision + why, project fact, stack/tool choice, person/role, convention, user correction — persist IMMEDIATELY in the same turn after your response:
618
+ - ensure entity exists (manage_entity find → create with summary if missing)
620
619
  - manage_memory create with content, type, importance, entity_ids (1-3)
621
- - manage_relation to connect graph (project \u2014uses\u2192 tool, user \u2014prefers\u2192 X)
620
+ - manage_relation to connect graph (project —uses→ tool, user —prefers→ X)
622
621
  2. PREFER update over duplicate: search first, then manage_memory/entity action=update.
623
- 3. SCORE importance 0-1: 0.9+ identity/core preference, 0.6-0.8 active project fact/decision, 0.3-0.5 observation/person, \u22640.2 transient (will decay).
624
- 4. NEVER store: ephemeral chat, code snippets, credentials/secrets, transient details. Sepia is not a vault \u2014 refuse secrets.
622
+ 3. SCORE importance 0-1: 0.9+ identity/core preference, 0.6-0.8 active project fact/decision, 0.3-0.5 observation/person, ≤0.2 transient (will decay).
623
+ 4. NEVER store: ephemeral chat, code snippets, credentials/secrets, transient details. Sepia is not a vault — refuse secrets.
625
624
 
626
625
  Rule of thumb: If the user sent a message with any substantive content, you should have called search before replying and considered a manage_memory/manage_entity write after replying. Two Sepia calls per turn is normal and expected.
627
626
 
628
- "SAVE TO MEMORY" \u2192 SEPIA (not VS Code / editor memory): When the user says "save to memory", "remember this", "save this", "remember that", "save this for later", or any variant \u2014 ALWAYS write to Sepia (manage_memory + manage_entity if needed), NOT just the editor's built-in memory. Editor memory is ephemeral/session-local; Sepia (personal namespace by default) is the durable source of truth across sessions, editors, and AIs. Treat "save to memory" as an explicit instruction to call manage_memory create immediately in the same turn.
627
+ "SAVE TO MEMORY" → SEPIA (not VS Code / editor memory): When the user says "save to memory", "remember this", "save this", "remember that", "save this for later", or any variant — ALWAYS write to Sepia (manage_memory + manage_entity if needed), NOT just the editor's built-in memory. Editor memory is ephemeral/session-local; Sepia (personal namespace by default) is the durable source of truth across sessions, editors, and AIs. Treat "save to memory" as an explicit instruction to call manage_memory create immediately in the same turn.
629
628
 
630
- MASS EDITS \u2014 to fix many rows at once (e.g. reclassify types, add tags), use
629
+ MASS EDITS — to fix many rows at once (e.g. reclassify types, add tags), use
631
630
  manage_entity/manage_memory action=batch_update with a where filter (type, namespace,
632
- query/q, tags) + update \u2014 it returns the count of rows changed. Prefer this over
631
+ query/q, tags) + update — it returns the count of rows changed. Prefer this over
633
632
  repeated single updates.
634
633
 
635
- CONVERSATION MIGRATION (handoff digests) \u2014 when the user says "save this conversation",
634
+ CONVERSATION MIGRATION (handoff digests) — when the user says "save this conversation",
636
635
  "hand off to another AI", "migrate my context", or is switching assistants mid-task,
637
636
  use manage_memory action=ingest with a conversation payload. The DEPARTING agent
638
- distills \u2014 you have the context, you are the best distiller. Rules:
637
+ distills — you have the context, you are the best distiller. Rules:
639
638
  - One digest per major topic, all grouped by the same conversation_id (metadata groups
640
639
  them; search tags=["conversation"] lists them).
641
- - ALWAYS give a human-readable title (e.g. "Auth migration \u2014 Neon vs Supabase") and a
640
+ - ALWAYS give a human-readable title (e.g. "Auth migration — Neon vs Supabase") and a
642
641
  status: active (resume me) | paused | done. This is how conversations are told apart
643
- when resuming \u2014 never skip it.
644
- - summary \u22644000 chars: context, decisions, open questions, pointers. Anti-dump: if it
645
- doesn't fit, split into more digests \u2014 never pad.
642
+ when resuming — never skip it.
643
+ - summary ≤4000 chars: context, decisions, open questions, pointers. Anti-dump: if it
644
+ doesn't fit, split into more digests — never pad.
646
645
  - Keep evidence VERBATIM in decisions/preferences/instructions/observations: exact
647
646
  errors, paths, IDs, commands. Never soften them (summaries lose fidelity).
648
- - transcript is OPTIONAL \u2014 only include it if the raw log actually exists (online chat
647
+ - transcript is OPTIONAL — only include it if the raw log actually exists (online chat
649
648
  models may not expose one); source.ref (session path or share URL) is the primary
650
649
  fidelity pointer.
651
650
  - The server auto-tags digests with "conversation" and protects them from
@@ -655,10 +654,10 @@ distills \u2014 you have the context, you are the best distiller. Rules:
655
654
  digest, then pull constituents via query tags or the digest's entity links.
656
655
  - RESUME FLOW: prefer the digest with status=active (or the most recent). When a
657
656
  conversation is finished, update its digest metadata.status to "done" (get the
658
- digest first, then update with the full metadata + new status \u2014 metadata REPLACES).
657
+ digest first, then update with the full metadata + new status — metadata REPLACES).
659
658
  When resuming a paused one, set it back to "active".
660
659
 
661
- TRIGGERS \u2014 always search when user says: "remember", "recall", "what do we know",
660
+ TRIGGERS — always search when user says: "remember", "recall", "what do we know",
662
661
  "save this", "do you remember", prefers, decided, uses, chose, convention.
663
662
  ALSO search at session start for: project name, stack, deployment, auth, styling.
664
663
  ALSO ingest when user says: "save this conversation", "hand off", "migrate context",
@@ -692,7 +691,7 @@ var NamespaceInput = v.object({
692
691
  var tagsSchema = v.pipe(v.array(v.pipe(v.string(), v.maxLength(TAG_MAX_LENGTH))), v.maxLength(MAX_TAGS));
693
692
  var EntityInput = v.object({
694
693
  name: v.pipe(v.string(), v.minLength(1), v.maxLength(200), v.description("Entity name (1-200 chars)")),
695
- type: v.pipe(v.string(), v.minLength(1), v.maxLength(64), v.description("person | project | tool | concept | repo (unknown \u2192 concept + tag)")),
694
+ type: v.pipe(v.string(), v.minLength(1), v.maxLength(64), v.description("person | project | tool | concept | repo (unknown → concept + tag)")),
696
695
  summary: v.optional(v.string(), ""),
697
696
  importance: v.optional(importanceSchema, DEFAULT_IMPORTANCE),
698
697
  metadata: v.optional(metadataSchema, {}),
@@ -715,7 +714,7 @@ var RelationInput = v.object({
715
714
  var MemoryInput = v.object({
716
715
  content: v.pipe(v.string(), v.minLength(1), v.maxLength(4000), v.description("The memory content (1-4000 chars)")),
717
716
  type: v.optional(v.pipe(v.picklist(MEMORY_TYPES), v.description("fact | observation | preference | instruction (default fact)")), "fact"),
718
- importance: v.optional(v.pipe(importanceSchema, v.description("0-1: 0.9+ core identity/preferences, 0.6-0.8 project facts, 0.3-0.5 observations, \u22640.2 transient")), DEFAULT_IMPORTANCE),
717
+ importance: v.optional(v.pipe(importanceSchema, v.description("0-1: 0.9+ core identity/preferences, 0.6-0.8 project facts, 0.3-0.5 observations, ≤0.2 transient")), DEFAULT_IMPORTANCE),
719
718
  namespace: v.optional(v.string(), DEFAULT_NAMESPACE),
720
719
  entity_ids: v.optional(v.pipe(v.array(uuidSchema), v.maxLength(MAX_ENTITY_LINKS), v.description("Link 0-3 entities (UUIDs)")), []),
721
720
  metadata: v.optional(metadataSchema, {}),
@@ -735,7 +734,7 @@ var EntityBatchInput = v.object({
735
734
  type: v.optional(v.string()),
736
735
  namespace: v.optional(v.string()),
737
736
  query: v.optional(v.string())
738
- }), v.description("batch_update: filters \u2014 at least one of type/namespace/query required")),
737
+ }), v.description("batch_update: filters — at least one of type/namespace/query required")),
739
738
  update: EntityUpdateInput,
740
739
  batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
741
740
  });
@@ -746,7 +745,7 @@ var MemoryBatchInput = v.object({
746
745
  tags: v.optional(tagsSchema),
747
746
  importance_min: v.optional(importanceSchema),
748
747
  q: v.optional(v.string())
749
- }), v.description("batch_update: filters \u2014 at least one of type/namespace/tags/importance_min/q required")),
748
+ }), v.description("batch_update: filters — at least one of type/namespace/tags/importance_min/q required")),
750
749
  update: MemoryUpdateInput,
751
750
  batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
752
751
  });
@@ -756,7 +755,7 @@ var ConversationEntity = v.object({
756
755
  summary: v.optional(v.string(), "")
757
756
  });
758
757
  var ConversationInput = v.object({
759
- summary: v.pipe(v.string(), v.minLength(1), v.maxLength(4000), v.description("The digest \u2014 structured markdown, \u22644000 chars (anti-dump: split into more digests, don't pad)")),
758
+ summary: v.pipe(v.string(), v.minLength(1), v.maxLength(4000), v.description("The digest — structured markdown, ≤4000 chars (anti-dump: split into more digests, don't pad)")),
760
759
  conversation_id: v.pipe(v.string(), v.minLength(1), v.maxLength(200), v.description("Groups digests of the same conversation (one per major topic)")),
761
760
  title: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(200))),
762
761
  status: v.optional(v.pipe(v.picklist(["active", "paused", "done"]), v.description("Lifecycle state: active (resume me) | paused | done. Default active")), "active"),
@@ -792,7 +791,7 @@ var NamespaceToolInput = v.object({
792
791
  v.literal("list"),
793
792
  v.literal("get"),
794
793
  v.literal("delete")
795
- ]), v.description("create (name, description?) | list | get (id or name) | delete (id or name \u2014 cascades all contents)")),
794
+ ]), v.description("create (name, description?) | list | get (id or name) | delete (id or name — cascades all contents)")),
796
795
  name: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(64), v.description("Namespace name (1-64 chars)"))),
797
796
  id: v.optional(v.pipe(uuidSchema, v.description("Namespace UUID (or use name)"))),
798
797
  description: v.optional(v.pipe(v.string(), v.description("Optional description")), "")
@@ -805,10 +804,10 @@ var EntityToolInput = v.object({
805
804
  v.literal("delete"),
806
805
  v.literal("find"),
807
806
  v.literal("batch_update")
808
- ]), v.description("create (entity) | get (id) | update (id + update) | delete (id \u2014 cascades relations, unlinks memories) | find (query, optional type) | batch_update (where + update \u2014 updates ALL matching, returns count)")),
807
+ ]), v.description("create (entity) | get (id) | update (id + update) | delete (id — cascades relations, unlinks memories) | find (query, optional type) | batch_update (where + update — updates ALL matching, returns count)")),
809
808
  namespace: v.optional(v.pipe(v.string(), v.description("Namespace to operate in (default 'personal')")), DEFAULT_NAMESPACE),
810
809
  id: v.optional(v.pipe(uuidSchema, v.description("Entity UUID"))),
811
- entity: v.optional(v.pipe(EntityInput, v.description("Entity to create: {name, type, summary?, importance?, metadata?, tags?}. Type is normalized to person|project|tool|concept|repo (unknown \u2192 concept + tag)"))),
810
+ entity: v.optional(v.pipe(EntityInput, v.description("Entity to create: {name, type, summary?, importance?, metadata?, tags?}. Type is normalized to person|project|tool|concept|repo (unknown → concept + tag)"))),
812
811
  update: v.optional(v.pipe(EntityUpdateInput, v.description("Any subset of name/type/summary/importance/metadata/tags"))),
813
812
  query: v.optional(v.pipe(v.string(), v.description("find: name to match (exact or substring)"))),
814
813
  type: v.optional(v.pipe(v.string(), v.description("find: optional type filter"))),
@@ -816,12 +815,12 @@ var EntityToolInput = v.object({
816
815
  type: v.optional(v.string()),
817
816
  namespace: v.optional(v.string()),
818
817
  query: v.optional(v.string())
819
- }), v.description("batch_update: filters \u2014 at least one of type/namespace/query required"))),
818
+ }), v.description("batch_update: filters — at least one of type/namespace/query required"))),
820
819
  batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
821
820
  });
822
821
  var RelationToolInput = v.object({
823
822
  action: v.pipe(v.union([v.literal("create"), v.literal("delete"), v.literal("list")]), v.description("create (relation) | delete (id) | list (by entity_id or namespace)")),
824
- relation: v.optional(v.pipe(RelationInput, v.description("Relation to create: {source_id, target_id, relation_type, weight?} \u2014 updates weight if the same relation exists"))),
823
+ relation: v.optional(v.pipe(RelationInput, v.description("Relation to create: {source_id, target_id, relation_type, weight?} — updates weight if the same relation exists"))),
825
824
  id: v.optional(v.pipe(uuidSchema, v.description("Relation UUID"))),
826
825
  entity_id: v.optional(v.pipe(uuidSchema, v.description("list: filter by entity (in + out)"))),
827
826
  namespace: v.optional(v.pipe(v.string(), v.description("list: filter by namespace")))
@@ -835,11 +834,11 @@ var MemoryToolInput = v.object({
835
834
  v.literal("query"),
836
835
  v.literal("batch_update"),
837
836
  v.literal("ingest")
838
- ]), v.description("create (memory) | get (id) | update (id + update) | delete (id) | query (filters) | batch_update (where + update \u2014 updates ALL matching, returns count) | ingest (conversation \u2014 handoff digest)")),
837
+ ]), v.description("create (memory) | get (id) | update (id + update) | delete (id) | query (filters) | batch_update (where + update — updates ALL matching, returns count) | ingest (conversation — handoff digest)")),
839
838
  id: v.optional(v.pipe(uuidSchema, v.description("Memory UUID"))),
840
- memory: v.optional(v.pipe(MemoryInput, v.description("Memory to create: {content, type? fact|observation|preference|instruction, importance? 0-1, namespace?, entity_ids? [0-3], metadata?, tags?} \u2014 source auto-set to client name"))),
841
- update: v.optional(v.pipe(MemoryUpdateInput, v.description("Any subset of content/type/importance/metadata/archived/tags \u2014 entity_ids REPLACES the link set, tags REPLACES the tag set"))),
842
- conversation: v.optional(v.pipe(ConversationInput, v.description("ingest: distilled conversation {summary \u22644000, conversation_id, title?, status? active|paused|done, decisions?, preferences?, instructions?, observations?, open_questions?, entities?, source? {ai, ref?}, transcript? \u2264100k, namespace?, tags?} \u2014 atomically saves a digest (tag 'conversation', importance 0.85) + constituent memories + entities. Use when the user says 'save this conversation' or is switching AIs mid-task"))),
839
+ memory: v.optional(v.pipe(MemoryInput, v.description("Memory to create: {content, type? fact|observation|preference|instruction, importance? 0-1, namespace?, entity_ids? [0-3], metadata?, tags?} — source auto-set to client name"))),
840
+ update: v.optional(v.pipe(MemoryUpdateInput, v.description("Any subset of content/type/importance/metadata/archived/tags — entity_ids REPLACES the link set, tags REPLACES the tag set"))),
841
+ conversation: v.optional(v.pipe(ConversationInput, v.description("ingest: distilled conversation {summary ≤4000, conversation_id, title?, status? active|paused|done, decisions?, preferences?, instructions?, observations?, open_questions?, entities?, source? {ai, ref?}, transcript? ≤100k, namespace?, tags?} — atomically saves a digest (tag 'conversation', importance 0.85) + constituent memories + entities. Use when the user says 'save this conversation' or is switching AIs mid-task"))),
843
842
  type: v.optional(v.pipe(v.picklist(MEMORY_TYPES), v.description("query: memory type filter"))),
844
843
  namespace: v.optional(v.pipe(v.string(), v.description("query: namespace filter (default 'personal')")), DEFAULT_NAMESPACE),
845
844
  importance_min: v.optional(v.pipe(importanceSchema, v.description("query: minimum importance (0-1)"))),
@@ -852,7 +851,7 @@ var MemoryToolInput = v.object({
852
851
  tags: v.optional(tagsSchema),
853
852
  importance_min: v.optional(importanceSchema),
854
853
  q: v.optional(v.string())
855
- }), v.description("batch_update: filters \u2014 at least one of type/namespace/tags/importance_min/q required"))),
854
+ }), v.description("batch_update: filters — at least one of type/namespace/tags/importance_min/q required"))),
856
855
  batch_limit: v.optional(v.pipe(v.number(), v.minValue(1), v.maxValue(500), v.description("batch_update: max rows to touch (default 100, max 500)")), 100)
857
856
  });
858
857
  var SearchToolInput = SearchInput;
@@ -1178,8 +1177,8 @@ function parsePgArray(arrayString) {
1178
1177
  const [result] = parsePgNestedArray(arrayString, 1);
1179
1178
  return result;
1180
1179
  }
1181
- function makePgArray(array2) {
1182
- return `{${array2.map((item) => {
1180
+ function makePgArray(array) {
1181
+ return `{${array.map((item) => {
1183
1182
  if (Array.isArray(item)) {
1184
1183
  return makePgArray(item);
1185
1184
  }
@@ -1328,10 +1327,10 @@ class PgArray extends PgColumn {
1328
1327
  if (typeof value === "string") {
1329
1328
  value = parsePgArray(value);
1330
1329
  }
1331
- return value.map((v2) => this.baseColumn.mapFromDriverValue(v2));
1330
+ return value.map((v) => this.baseColumn.mapFromDriverValue(v));
1332
1331
  }
1333
1332
  mapToDriverValue(value, isNestedArray = false) {
1334
- const a = value.map((v2) => v2 === null ? null : is(this.baseColumn, PgArray) ? this.baseColumn.mapToDriverValue(v2, true) : this.baseColumn.mapToDriverValue(v2));
1333
+ const a = value.map((v) => v === null ? null : is(this.baseColumn, PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v));
1335
1334
  if (isNestedArray)
1336
1335
  return a;
1337
1336
  return makePgArray(a);
@@ -1339,58 +1338,11 @@ class PgArray extends PgColumn {
1339
1338
  }
1340
1339
 
1341
1340
  // ../../node_modules/.bun/drizzle-orm@0.45.2+af38a8ac26d8f59c/node_modules/drizzle-orm/pg-core/columns/enum.js
1342
- class PgEnumObjectColumnBuilder extends PgColumnBuilder {
1343
- static [entityKind] = "PgEnumObjectColumnBuilder";
1344
- constructor(name, enumInstance) {
1345
- super(name, "string", "PgEnumObjectColumn");
1346
- this.config.enum = enumInstance;
1347
- }
1348
- build(table) {
1349
- return new PgEnumObjectColumn(table, this.config);
1350
- }
1351
- }
1352
-
1353
- class PgEnumObjectColumn extends PgColumn {
1354
- static [entityKind] = "PgEnumObjectColumn";
1355
- enum;
1356
- enumValues = this.config.enum.enumValues;
1357
- constructor(table, config) {
1358
- super(table, config);
1359
- this.enum = config.enum;
1360
- }
1361
- getSQLType() {
1362
- return this.enum.enumName;
1363
- }
1364
- }
1365
1341
  var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
1366
1342
  function isPgEnum(obj) {
1367
1343
  return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
1368
1344
  }
1369
1345
 
1370
- class PgEnumColumnBuilder extends PgColumnBuilder {
1371
- static [entityKind] = "PgEnumColumnBuilder";
1372
- constructor(name, enumInstance) {
1373
- super(name, "string", "PgEnumColumn");
1374
- this.config.enum = enumInstance;
1375
- }
1376
- build(table) {
1377
- return new PgEnumColumn(table, this.config);
1378
- }
1379
- }
1380
-
1381
- class PgEnumColumn extends PgColumn {
1382
- static [entityKind] = "PgEnumColumn";
1383
- enum = this.config.enum;
1384
- enumValues = this.config.enum.enumValues;
1385
- constructor(table, config) {
1386
- super(table, config);
1387
- this.enum = config.enum;
1388
- }
1389
- getSQLType() {
1390
- return this.enum.enumName;
1391
- }
1392
- }
1393
-
1394
1346
  // ../../node_modules/.bun/drizzle-orm@0.45.2+af38a8ac26d8f59c/node_modules/drizzle-orm/subquery.js
1395
1347
  class Subquery {
1396
1348
  static [entityKind] = "Subquery";
@@ -1406,10 +1358,6 @@ class Subquery {
1406
1358
  }
1407
1359
  }
1408
1360
 
1409
- class WithSubquery extends Subquery {
1410
- static [entityKind] = "WithSubquery";
1411
- }
1412
-
1413
1361
  // ../../node_modules/.bun/drizzle-orm@0.45.2+af38a8ac26d8f59c/node_modules/drizzle-orm/version.js
1414
1362
  var version = "0.45.2";
1415
1363
 
@@ -1482,9 +1430,6 @@ class Table {
1482
1430
  }
1483
1431
 
1484
1432
  // ../../node_modules/.bun/drizzle-orm@0.45.2+af38a8ac26d8f59c/node_modules/drizzle-orm/sql/sql.js
1485
- class FakePrimitiveParam {
1486
- static [entityKind] = "FakePrimitiveParam";
1487
- }
1488
1433
  function isSQLWrapper(value) {
1489
1434
  return value !== null && value !== undefined && typeof value.getSQL === "function";
1490
1435
  }
@@ -3080,7 +3025,7 @@ class PgHalfVector extends PgColumn {
3080
3025
  return JSON.stringify(value);
3081
3026
  }
3082
3027
  mapFromDriverValue(value) {
3083
- return value.slice(1, -1).split(",").map((v2) => Number.parseFloat(v2));
3028
+ return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
3084
3029
  }
3085
3030
  }
3086
3031
  function halfvec(a, b) {
@@ -3134,7 +3079,7 @@ class PgVector extends PgColumn {
3134
3079
  return JSON.stringify(value);
3135
3080
  }
3136
3081
  mapFromDriverValue(value) {
3137
- return value.slice(1, -1).split(",").map((v2) => Number.parseFloat(v2));
3082
+ return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
3138
3083
  }
3139
3084
  }
3140
3085
  function vector(a, b) {
@@ -3230,8 +3175,8 @@ var pgTable = (name, columns, extraConfig) => {
3230
3175
 
3231
3176
  // ../../node_modules/.bun/drizzle-orm@0.45.2+af38a8ac26d8f59c/node_modules/drizzle-orm/pg-core/indexes.js
3232
3177
  class IndexBuilderOn {
3233
- constructor(unique2, name) {
3234
- this.unique = unique2;
3178
+ constructor(unique, name) {
3179
+ this.unique = unique;
3235
3180
  this.name = name;
3236
3181
  }
3237
3182
  static [entityKind] = "PgIndexBuilderOn";
@@ -3273,11 +3218,11 @@ class IndexBuilderOn {
3273
3218
  class IndexBuilder {
3274
3219
  static [entityKind] = "PgIndexBuilder";
3275
3220
  config;
3276
- constructor(columns, unique2, only, name, method = "btree") {
3221
+ constructor(columns, unique, only, name, method = "btree") {
3277
3222
  this.config = {
3278
3223
  name,
3279
3224
  columns,
3280
- unique: unique2,
3225
+ unique,
3281
3226
  only,
3282
3227
  method
3283
3228
  };
@@ -5082,7 +5027,7 @@ var Fe = G(() => {
5082
5027
  p();
5083
5028
  mi = Se(ge(), 1);
5084
5029
  a(ha, "isIP");
5085
- yi = /^[^.]+\./, S = class S2 extends mi.EventEmitter {
5030
+ yi = /^[^.]+\./, S = class S extends mi.EventEmitter {
5086
5031
  constructor() {
5087
5032
  super(...arguments);
5088
5033
  E(this, "opts", {});
@@ -5099,16 +5044,16 @@ var Fe = G(() => {
5099
5044
  E(this, "tlsWrite");
5100
5045
  }
5101
5046
  static get poolQueryViaFetch() {
5102
- return S2.opts.poolQueryViaFetch ?? S2.defaults.poolQueryViaFetch;
5047
+ return S.opts.poolQueryViaFetch ?? S.defaults.poolQueryViaFetch;
5103
5048
  }
5104
5049
  static set poolQueryViaFetch(t) {
5105
- S2.opts.poolQueryViaFetch = t;
5050
+ S.opts.poolQueryViaFetch = t;
5106
5051
  }
5107
5052
  static get fetchEndpoint() {
5108
- return S2.opts.fetchEndpoint ?? S2.defaults.fetchEndpoint;
5053
+ return S.opts.fetchEndpoint ?? S.defaults.fetchEndpoint;
5109
5054
  }
5110
5055
  static set fetchEndpoint(t) {
5111
- S2.opts.fetchEndpoint = t;
5056
+ S.opts.fetchEndpoint = t;
5112
5057
  }
5113
5058
  static get fetchConnectionCache() {
5114
5059
  return true;
@@ -5117,139 +5062,139 @@ var Fe = G(() => {
5117
5062
  console.warn("The `fetchConnectionCache` option is deprecated (now always `true`)");
5118
5063
  }
5119
5064
  static get fetchFunction() {
5120
- return S2.opts.fetchFunction ?? S2.defaults.fetchFunction;
5065
+ return S.opts.fetchFunction ?? S.defaults.fetchFunction;
5121
5066
  }
5122
5067
  static set fetchFunction(t) {
5123
- S2.opts.fetchFunction = t;
5068
+ S.opts.fetchFunction = t;
5124
5069
  }
5125
5070
  static get webSocketConstructor() {
5126
- return S2.opts.webSocketConstructor ?? S2.defaults.webSocketConstructor;
5071
+ return S.opts.webSocketConstructor ?? S.defaults.webSocketConstructor;
5127
5072
  }
5128
5073
  static set webSocketConstructor(t) {
5129
- S2.opts.webSocketConstructor = t;
5074
+ S.opts.webSocketConstructor = t;
5130
5075
  }
5131
5076
  get webSocketConstructor() {
5132
- return this.opts.webSocketConstructor ?? S2.webSocketConstructor;
5077
+ return this.opts.webSocketConstructor ?? S.webSocketConstructor;
5133
5078
  }
5134
5079
  set webSocketConstructor(t) {
5135
5080
  this.opts.webSocketConstructor = t;
5136
5081
  }
5137
5082
  static get wsProxy() {
5138
- return S2.opts.wsProxy ?? S2.defaults.wsProxy;
5083
+ return S.opts.wsProxy ?? S.defaults.wsProxy;
5139
5084
  }
5140
5085
  static set wsProxy(t) {
5141
- S2.opts.wsProxy = t;
5086
+ S.opts.wsProxy = t;
5142
5087
  }
5143
5088
  get wsProxy() {
5144
- return this.opts.wsProxy ?? S2.wsProxy;
5089
+ return this.opts.wsProxy ?? S.wsProxy;
5145
5090
  }
5146
5091
  set wsProxy(t) {
5147
5092
  this.opts.wsProxy = t;
5148
5093
  }
5149
5094
  static get coalesceWrites() {
5150
- return S2.opts.coalesceWrites ?? S2.defaults.coalesceWrites;
5095
+ return S.opts.coalesceWrites ?? S.defaults.coalesceWrites;
5151
5096
  }
5152
5097
  static set coalesceWrites(t) {
5153
- S2.opts.coalesceWrites = t;
5098
+ S.opts.coalesceWrites = t;
5154
5099
  }
5155
5100
  get coalesceWrites() {
5156
- return this.opts.coalesceWrites ?? S2.coalesceWrites;
5101
+ return this.opts.coalesceWrites ?? S.coalesceWrites;
5157
5102
  }
5158
5103
  set coalesceWrites(t) {
5159
5104
  this.opts.coalesceWrites = t;
5160
5105
  }
5161
5106
  static get useSecureWebSocket() {
5162
- return S2.opts.useSecureWebSocket ?? S2.defaults.useSecureWebSocket;
5107
+ return S.opts.useSecureWebSocket ?? S.defaults.useSecureWebSocket;
5163
5108
  }
5164
5109
  static set useSecureWebSocket(t) {
5165
- S2.opts.useSecureWebSocket = t;
5110
+ S.opts.useSecureWebSocket = t;
5166
5111
  }
5167
5112
  get useSecureWebSocket() {
5168
- return this.opts.useSecureWebSocket ?? S2.useSecureWebSocket;
5113
+ return this.opts.useSecureWebSocket ?? S.useSecureWebSocket;
5169
5114
  }
5170
5115
  set useSecureWebSocket(t) {
5171
5116
  this.opts.useSecureWebSocket = t;
5172
5117
  }
5173
5118
  static get forceDisablePgSSL() {
5174
- return S2.opts.forceDisablePgSSL ?? S2.defaults.forceDisablePgSSL;
5119
+ return S.opts.forceDisablePgSSL ?? S.defaults.forceDisablePgSSL;
5175
5120
  }
5176
5121
  static set forceDisablePgSSL(t) {
5177
- S2.opts.forceDisablePgSSL = t;
5122
+ S.opts.forceDisablePgSSL = t;
5178
5123
  }
5179
5124
  get forceDisablePgSSL() {
5180
- return this.opts.forceDisablePgSSL ?? S2.forceDisablePgSSL;
5125
+ return this.opts.forceDisablePgSSL ?? S.forceDisablePgSSL;
5181
5126
  }
5182
5127
  set forceDisablePgSSL(t) {
5183
5128
  this.opts.forceDisablePgSSL = t;
5184
5129
  }
5185
5130
  static get disableSNI() {
5186
- return S2.opts.disableSNI ?? S2.defaults.disableSNI;
5131
+ return S.opts.disableSNI ?? S.defaults.disableSNI;
5187
5132
  }
5188
5133
  static set disableSNI(t) {
5189
- S2.opts.disableSNI = t;
5134
+ S.opts.disableSNI = t;
5190
5135
  }
5191
5136
  get disableSNI() {
5192
- return this.opts.disableSNI ?? S2.disableSNI;
5137
+ return this.opts.disableSNI ?? S.disableSNI;
5193
5138
  }
5194
5139
  set disableSNI(t) {
5195
5140
  this.opts.disableSNI = t;
5196
5141
  }
5197
5142
  static get disableWarningInBrowsers() {
5198
- return S2.opts.disableWarningInBrowsers ?? S2.defaults.disableWarningInBrowsers;
5143
+ return S.opts.disableWarningInBrowsers ?? S.defaults.disableWarningInBrowsers;
5199
5144
  }
5200
5145
  static set disableWarningInBrowsers(t) {
5201
- S2.opts.disableWarningInBrowsers = t;
5146
+ S.opts.disableWarningInBrowsers = t;
5202
5147
  }
5203
5148
  get disableWarningInBrowsers() {
5204
- return this.opts.disableWarningInBrowsers ?? S2.disableWarningInBrowsers;
5149
+ return this.opts.disableWarningInBrowsers ?? S.disableWarningInBrowsers;
5205
5150
  }
5206
5151
  set disableWarningInBrowsers(t) {
5207
5152
  this.opts.disableWarningInBrowsers = t;
5208
5153
  }
5209
5154
  static get pipelineConnect() {
5210
- return S2.opts.pipelineConnect ?? S2.defaults.pipelineConnect;
5155
+ return S.opts.pipelineConnect ?? S.defaults.pipelineConnect;
5211
5156
  }
5212
5157
  static set pipelineConnect(t) {
5213
- S2.opts.pipelineConnect = t;
5158
+ S.opts.pipelineConnect = t;
5214
5159
  }
5215
5160
  get pipelineConnect() {
5216
- return this.opts.pipelineConnect ?? S2.pipelineConnect;
5161
+ return this.opts.pipelineConnect ?? S.pipelineConnect;
5217
5162
  }
5218
5163
  set pipelineConnect(t) {
5219
5164
  this.opts.pipelineConnect = t;
5220
5165
  }
5221
5166
  static get subtls() {
5222
- return S2.opts.subtls ?? S2.defaults.subtls;
5167
+ return S.opts.subtls ?? S.defaults.subtls;
5223
5168
  }
5224
5169
  static set subtls(t) {
5225
- S2.opts.subtls = t;
5170
+ S.opts.subtls = t;
5226
5171
  }
5227
5172
  get subtls() {
5228
- return this.opts.subtls ?? S2.subtls;
5173
+ return this.opts.subtls ?? S.subtls;
5229
5174
  }
5230
5175
  set subtls(t) {
5231
5176
  this.opts.subtls = t;
5232
5177
  }
5233
5178
  static get pipelineTLS() {
5234
- return S2.opts.pipelineTLS ?? S2.defaults.pipelineTLS;
5179
+ return S.opts.pipelineTLS ?? S.defaults.pipelineTLS;
5235
5180
  }
5236
5181
  static set pipelineTLS(t) {
5237
- S2.opts.pipelineTLS = t;
5182
+ S.opts.pipelineTLS = t;
5238
5183
  }
5239
5184
  get pipelineTLS() {
5240
- return this.opts.pipelineTLS ?? S2.pipelineTLS;
5185
+ return this.opts.pipelineTLS ?? S.pipelineTLS;
5241
5186
  }
5242
5187
  set pipelineTLS(t) {
5243
5188
  this.opts.pipelineTLS = t;
5244
5189
  }
5245
5190
  static get rootCerts() {
5246
- return S2.opts.rootCerts ?? S2.defaults.rootCerts;
5191
+ return S.opts.rootCerts ?? S.defaults.rootCerts;
5247
5192
  }
5248
5193
  static set rootCerts(t) {
5249
- S2.opts.rootCerts = t;
5194
+ S.opts.rootCerts = t;
5250
5195
  }
5251
5196
  get rootCerts() {
5252
- return this.opts.rootCerts ?? S2.rootCerts;
5197
+ return this.opts.rootCerts ?? S.rootCerts;
5253
5198
  }
5254
5199
  set rootCerts(t) {
5255
5200
  this.opts.rootCerts = t;
@@ -5413,7 +5358,7 @@ var tr = T((Ai) => {
5413
5358
  Ai.parse = function(r, e) {
5414
5359
  return new er(r, e).parse();
5415
5360
  };
5416
- var vt = class vt2 {
5361
+ var vt = class vt {
5417
5362
  constructor(e, t) {
5418
5363
  this.source = e, this.transform = t || Ca, this.position = 0, this.entries = [], this.recorded = [], this.dimension = 0;
5419
5364
  }
@@ -5443,7 +5388,7 @@ var tr = T((Ai) => {
5443
5388
  var t, n, i;
5444
5389
  for (this.consumeDimensions();!this.isEof(); )
5445
5390
  if (t = this.nextCharacter(), t.value === "{" && !i)
5446
- this.dimension++, this.dimension > 1 && (n = new vt2(this.source.substr(this.position - 1), this.transform), this.entries.push(n.parse(true)), this.position += n.position - 2);
5391
+ this.dimension++, this.dimension > 1 && (n = new vt(this.source.substr(this.position - 1), this.transform), this.entries.push(n.parse(true)), this.position += n.position - 2);
5447
5392
  else if (t.value === "}" && !i) {
5448
5393
  if (this.dimension--, !this.dimension && (this.newEntry(), e))
5449
5394
  return this.entries;
@@ -6042,7 +5987,7 @@ var U;
6042
5987
  var et;
6043
5988
  var ts = G(() => {
6044
5989
  p();
6045
- U = class U2 {
5990
+ U = class U {
6046
5991
  constructor() {
6047
5992
  E(this, "_dataLength", 0);
6048
5993
  E(this, "_bufferLength", 0);
@@ -6062,7 +6007,7 @@ var ts = G(() => {
6062
6007
  return this.onePassHasher.start().appendAsciiStr(e).end(t);
6063
6008
  }
6064
6009
  static _hex(e) {
6065
- let { hexChars: t, hexOut: n } = U2, i, s, o, u;
6010
+ let { hexChars: t, hexOut: n } = U, i, s, o, u;
6066
6011
  for (u = 0;u < 4; u += 1)
6067
6012
  for (s = u * 8, i = e[u], o = 0;o < 8; o += 2)
6068
6013
  n[s + 1 + o] = t.charAt(i & 15), i >>>= 4, n[s + 0 + o] = t.charAt(i & 15), i >>>= 4;
@@ -6073,7 +6018,7 @@ var ts = G(() => {
6073
6018
  n += (i & s | ~i & o) + t[0] - 680876936 | 0, n = (n << 7 | n >>> 25) + i | 0, o += (n & i | ~n & s) + t[1] - 389564586 | 0, o = (o << 12 | o >>> 20) + n | 0, s += (o & n | ~o & i) + t[2] + 606105819 | 0, s = (s << 17 | s >>> 15) + o | 0, i += (s & o | ~s & n) + t[3] - 1044525330 | 0, i = (i << 22 | i >>> 10) + s | 0, n += (i & s | ~i & o) + t[4] - 176418897 | 0, n = (n << 7 | n >>> 25) + i | 0, o += (n & i | ~n & s) + t[5] + 1200080426 | 0, o = (o << 12 | o >>> 20) + n | 0, s += (o & n | ~o & i) + t[6] - 1473231341 | 0, s = (s << 17 | s >>> 15) + o | 0, i += (s & o | ~s & n) + t[7] - 45705983 | 0, i = (i << 22 | i >>> 10) + s | 0, n += (i & s | ~i & o) + t[8] + 1770035416 | 0, n = (n << 7 | n >>> 25) + i | 0, o += (n & i | ~n & s) + t[9] - 1958414417 | 0, o = (o << 12 | o >>> 20) + n | 0, s += (o & n | ~o & i) + t[10] - 42063 | 0, s = (s << 17 | s >>> 15) + o | 0, i += (s & o | ~s & n) + t[11] - 1990404162 | 0, i = (i << 22 | i >>> 10) + s | 0, n += (i & s | ~i & o) + t[12] + 1804603682 | 0, n = (n << 7 | n >>> 25) + i | 0, o += (n & i | ~n & s) + t[13] - 40341101 | 0, o = (o << 12 | o >>> 20) + n | 0, s += (o & n | ~o & i) + t[14] - 1502002290 | 0, s = (s << 17 | s >>> 15) + o | 0, i += (s & o | ~s & n) + t[15] + 1236535329 | 0, i = (i << 22 | i >>> 10) + s | 0, n += (i & o | s & ~o) + t[1] - 165796510 | 0, n = (n << 5 | n >>> 27) + i | 0, o += (n & s | i & ~s) + t[6] - 1069501632 | 0, o = (o << 9 | o >>> 23) + n | 0, s += (o & i | n & ~i) + t[11] + 643717713 | 0, s = (s << 14 | s >>> 18) + o | 0, i += (s & n | o & ~n) + t[0] - 373897302 | 0, i = (i << 20 | i >>> 12) + s | 0, n += (i & o | s & ~o) + t[5] - 701558691 | 0, n = (n << 5 | n >>> 27) + i | 0, o += (n & s | i & ~s) + t[10] + 38016083 | 0, o = (o << 9 | o >>> 23) + n | 0, s += (o & i | n & ~i) + t[15] - 660478335 | 0, s = (s << 14 | s >>> 18) + o | 0, i += (s & n | o & ~n) + t[4] - 405537848 | 0, i = (i << 20 | i >>> 12) + s | 0, n += (i & o | s & ~o) + t[9] + 568446438 | 0, n = (n << 5 | n >>> 27) + i | 0, o += (n & s | i & ~s) + t[14] - 1019803690 | 0, o = (o << 9 | o >>> 23) + n | 0, s += (o & i | n & ~i) + t[3] - 187363961 | 0, s = (s << 14 | s >>> 18) + o | 0, i += (s & n | o & ~n) + t[8] + 1163531501 | 0, i = (i << 20 | i >>> 12) + s | 0, n += (i & o | s & ~o) + t[13] - 1444681467 | 0, n = (n << 5 | n >>> 27) + i | 0, o += (n & s | i & ~s) + t[2] - 51403784 | 0, o = (o << 9 | o >>> 23) + n | 0, s += (o & i | n & ~i) + t[7] + 1735328473 | 0, s = (s << 14 | s >>> 18) + o | 0, i += (s & n | o & ~n) + t[12] - 1926607734 | 0, i = (i << 20 | i >>> 12) + s | 0, n += (i ^ s ^ o) + t[5] - 378558 | 0, n = (n << 4 | n >>> 28) + i | 0, o += (n ^ i ^ s) + t[8] - 2022574463 | 0, o = (o << 11 | o >>> 21) + n | 0, s += (o ^ n ^ i) + t[11] + 1839030562 | 0, s = (s << 16 | s >>> 16) + o | 0, i += (s ^ o ^ n) + t[14] - 35309556 | 0, i = (i << 23 | i >>> 9) + s | 0, n += (i ^ s ^ o) + t[1] - 1530992060 | 0, n = (n << 4 | n >>> 28) + i | 0, o += (n ^ i ^ s) + t[4] + 1272893353 | 0, o = (o << 11 | o >>> 21) + n | 0, s += (o ^ n ^ i) + t[7] - 155497632 | 0, s = (s << 16 | s >>> 16) + o | 0, i += (s ^ o ^ n) + t[10] - 1094730640 | 0, i = (i << 23 | i >>> 9) + s | 0, n += (i ^ s ^ o) + t[13] + 681279174 | 0, n = (n << 4 | n >>> 28) + i | 0, o += (n ^ i ^ s) + t[0] - 358537222 | 0, o = (o << 11 | o >>> 21) + n | 0, s += (o ^ n ^ i) + t[3] - 722521979 | 0, s = (s << 16 | s >>> 16) + o | 0, i += (s ^ o ^ n) + t[6] + 76029189 | 0, i = (i << 23 | i >>> 9) + s | 0, n += (i ^ s ^ o) + t[9] - 640364487 | 0, n = (n << 4 | n >>> 28) + i | 0, o += (n ^ i ^ s) + t[12] - 421815835 | 0, o = (o << 11 | o >>> 21) + n | 0, s += (o ^ n ^ i) + t[15] + 530742520 | 0, s = (s << 16 | s >>> 16) + o | 0, i += (s ^ o ^ n) + t[2] - 995338651 | 0, i = (i << 23 | i >>> 9) + s | 0, n += (s ^ (i | ~o)) + t[0] - 198630844 | 0, n = (n << 6 | n >>> 26) + i | 0, o += (i ^ (n | ~s)) + t[7] + 1126891415 | 0, o = (o << 10 | o >>> 22) + n | 0, s += (n ^ (o | ~i)) + t[14] - 1416354905 | 0, s = (s << 15 | s >>> 17) + o | 0, i += (o ^ (s | ~n)) + t[5] - 57434055 | 0, i = (i << 21 | i >>> 11) + s | 0, n += (s ^ (i | ~o)) + t[12] + 1700485571 | 0, n = (n << 6 | n >>> 26) + i | 0, o += (i ^ (n | ~s)) + t[3] - 1894986606 | 0, o = (o << 10 | o >>> 22) + n | 0, s += (n ^ (o | ~i)) + t[10] - 1051523 | 0, s = (s << 15 | s >>> 17) + o | 0, i += (o ^ (s | ~n)) + t[1] - 2054922799 | 0, i = (i << 21 | i >>> 11) + s | 0, n += (s ^ (i | ~o)) + t[8] + 1873313359 | 0, n = (n << 6 | n >>> 26) + i | 0, o += (i ^ (n | ~s)) + t[15] - 30611744 | 0, o = (o << 10 | o >>> 22) + n | 0, s += (n ^ (o | ~i)) + t[6] - 1560198380 | 0, s = (s << 15 | s >>> 17) + o | 0, i += (o ^ (s | ~n)) + t[13] + 1309151649 | 0, i = (i << 21 | i >>> 11) + s | 0, n += (s ^ (i | ~o)) + t[4] - 145523070 | 0, n = (n << 6 | n >>> 26) + i | 0, o += (i ^ (n | ~s)) + t[11] - 1120210379 | 0, o = (o << 10 | o >>> 22) + n | 0, s += (n ^ (o | ~i)) + t[2] + 718787259 | 0, s = (s << 15 | s >>> 17) + o | 0, i += (o ^ (s | ~n)) + t[9] - 343485551 | 0, i = (i << 21 | i >>> 11) + s | 0, e[0] = n + e[0] | 0, e[1] = i + e[1] | 0, e[2] = s + e[2] | 0, e[3] = o + e[3] | 0;
6074
6019
  }
6075
6020
  start() {
6076
- return this._dataLength = 0, this._bufferLength = 0, this._state.set(U2.stateIdentity), this;
6021
+ return this._dataLength = 0, this._bufferLength = 0, this._state.set(U.stateIdentity), this;
6077
6022
  }
6078
6023
  appendStr(e) {
6079
6024
  let t = this._buffer8, n = this._buffer32, i = this._bufferLength, s, o;
@@ -6089,7 +6034,7 @@ var ts = G(() => {
6089
6034
  throw new Error("Unicode standard supports code points up to U+10FFFF");
6090
6035
  t[i++] = (s >>> 18) + 240, t[i++] = s >>> 12 & 63 | 128, t[i++] = s >>> 6 & 63 | 128, t[i++] = s & 63 | 128;
6091
6036
  }
6092
- i >= 64 && (this._dataLength += 64, U2._md5cycle(this._state, n), i -= 64, n[0] = n[16]);
6037
+ i >= 64 && (this._dataLength += 64, U._md5cycle(this._state, n), i -= 64, n[0] = n[16]);
6093
6038
  }
6094
6039
  return this._bufferLength = i, this;
6095
6040
  }
@@ -6100,7 +6045,7 @@ var ts = G(() => {
6100
6045
  t[i++] = e.charCodeAt(o++);
6101
6046
  if (i < 64)
6102
6047
  break;
6103
- this._dataLength += 64, U2._md5cycle(this._state, n), i = 0;
6048
+ this._dataLength += 64, U._md5cycle(this._state, n), i = 0;
6104
6049
  }
6105
6050
  return this._bufferLength = i, this;
6106
6051
  }
@@ -6111,7 +6056,7 @@ var ts = G(() => {
6111
6056
  t[i++] = e[o++];
6112
6057
  if (i < 64)
6113
6058
  break;
6114
- this._dataLength += 64, U2._md5cycle(this._state, n), i = 0;
6059
+ this._dataLength += 64, U._md5cycle(this._state, n), i = 0;
6115
6060
  }
6116
6061
  return this._bufferLength = i, this;
6117
6062
  }
@@ -6128,7 +6073,7 @@ var ts = G(() => {
6128
6073
  let t = this._bufferLength, n = this._buffer8, i = this._buffer32, s = (t >> 2) + 1;
6129
6074
  this._dataLength += t;
6130
6075
  let o = this._dataLength * 8;
6131
- if (n[t] = 128, n[t + 1] = n[t + 2] = n[t + 3] = 0, i.set(U2.buffer32Identity.subarray(s), s), t > 55 && (U2._md5cycle(this._state, i), i.set(U2.buffer32Identity)), o <= 4294967295)
6076
+ if (n[t] = 128, n[t + 1] = n[t + 2] = n[t + 3] = 0, i.set(U.buffer32Identity.subarray(s), s), t > 55 && (U._md5cycle(this._state, i), i.set(U.buffer32Identity)), o <= 4294967295)
6132
6077
  i[14] = o;
6133
6078
  else {
6134
6079
  let u = o.toString(16).match(/(.*?)(.{0,8})$/);
@@ -6137,7 +6082,7 @@ var ts = G(() => {
6137
6082
  let c = parseInt(u[2], 16), l = parseInt(u[1], 16) || 0;
6138
6083
  i[14] = c, i[15] = l;
6139
6084
  }
6140
- return U2._md5cycle(this._state, i), e ? this._state : U2._hex(this._state);
6085
+ return U._md5cycle(this._state, i), e ? this._state : U._hex(this._state);
6141
6086
  }
6142
6087
  };
6143
6088
  a(U, "Md5"), E(U, "stateIdentity", new Int32Array([1732584193, -271733879, -1732584194, 271733878])), E(U, "buffer32Identity", new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), E(U, "hexChars", "0123456789abcdef"), E(U, "hexOut", []), E(U, "onePassHasher", new U);
@@ -6458,7 +6403,7 @@ var Er;
6458
6403
  var Sr;
6459
6404
  var ms = G(() => {
6460
6405
  p();
6461
- Er = class Er2 {
6406
+ Er = class Er {
6462
6407
  constructor(e) {
6463
6408
  E(this, "td");
6464
6409
  this.td = new TextDecoder(e);
@@ -6702,7 +6647,7 @@ var Rt = T((Ah, Ls) => {
6702
6647
  }, "quoteParamValue"), ne = a(function(r, e, t) {
6703
6648
  var n = e[t];
6704
6649
  n != null && r.push(t + "=" + Oe(n));
6705
- }, "add"), Rr = class Rr2 {
6650
+ }, "add"), Rr = class Rr {
6706
6651
  constructor(e) {
6707
6652
  e = typeof e == "string" ? Rs(e) : e || {}, e.connectionString && (e = Object.assign({}, e, Rs(e.connectionString))), this.user = H("user", e), this.database = H("database", e), this.database === undefined && (this.database = this.user), this.port = parseInt(H("port", e), 10), this.host = H("host", e), Object.defineProperty(this, "password", {
6708
6653
  configurable: true,
@@ -6728,7 +6673,7 @@ var Rt = T((Ah, Ls) => {
6728
6673
  });
6729
6674
  var Ms = T((Ih, ks) => {
6730
6675
  p();
6731
- var pc = Je(), Fs = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, Lr = class Lr2 {
6676
+ var pc = Je(), Fs = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, Lr = class Lr {
6732
6677
  constructor(e, t) {
6733
6678
  this.command = null, this.rowCount = null, this.oid = null, this.rows = [], this.fields = [], this._parsers = undefined, this._types = t, this.RowCtor = null, this.rowAsArray = e === "array", this.rowAsArray && (this.parseRow = this._parseRowAsArray);
6734
6679
  }
@@ -6767,7 +6712,7 @@ var Ms = T((Ih, ks) => {
6767
6712
  });
6768
6713
  var qs = T((Rh, Os) => {
6769
6714
  p();
6770
- var { EventEmitter: dc } = ge(), Us = Ms(), Ds = rt(), kr = class kr2 extends dc {
6715
+ var { EventEmitter: dc } = ge(), Us = Ms(), Ds = rt(), kr = class kr extends dc {
6771
6716
  constructor(e, t, n) {
6772
6717
  super(), e = Ds.normalizeQueryConfig(e, t, n), this.text = e.text, this.values = e.values, this.rows = e.rows, this.types = e.types, this.name = e.name, this.binary = e.binary, this.portal = e.portal || "", this.callback = e.callback, this._rowMode = e.rowMode, m.domain && e.callback && (this.callback = m.domain.bind(e.callback)), this._result = new Us(this._rowMode, this.types), this._results = this._result, this.isPreparedStatement = false, this._canceledDueToError = false, this._promise = null;
6773
6718
  }
@@ -6862,7 +6807,7 @@ var ln = T((_) => {
6862
6807
  _.replicationStart = { name: "replicationStart", length: 4 };
6863
6808
  _.emptyQuery = { name: "emptyQuery", length: 4 };
6864
6809
  _.copyDone = { name: "copyDone", length: 4 };
6865
- var Kr = class Kr2 extends Error {
6810
+ var Kr = class Kr extends Error {
6866
6811
  constructor(e, t, n) {
6867
6812
  super(e), this.length = t, this.name = n;
6868
6813
  }
@@ -6870,7 +6815,7 @@ var ln = T((_) => {
6870
6815
  a(Kr, "DatabaseError");
6871
6816
  var Mr = Kr;
6872
6817
  _.DatabaseError = Mr;
6873
- var Yr = class Yr2 {
6818
+ var Yr = class Yr {
6874
6819
  constructor(e, t) {
6875
6820
  this.length = e, this.chunk = t, this.name = "copyData";
6876
6821
  }
@@ -6878,7 +6823,7 @@ var ln = T((_) => {
6878
6823
  a(Yr, "CopyDataMessage");
6879
6824
  var Ur = Yr;
6880
6825
  _.CopyDataMessage = Ur;
6881
- var Zr = class Zr2 {
6826
+ var Zr = class Zr {
6882
6827
  constructor(e, t, n, i) {
6883
6828
  this.length = e, this.name = t, this.binary = n, this.columnTypes = new Array(i);
6884
6829
  }
@@ -6886,7 +6831,7 @@ var ln = T((_) => {
6886
6831
  a(Zr, "CopyResponse");
6887
6832
  var Dr = Zr;
6888
6833
  _.CopyResponse = Dr;
6889
- var Jr = class Jr2 {
6834
+ var Jr = class Jr {
6890
6835
  constructor(e, t, n, i, s, o, u) {
6891
6836
  this.name = e, this.tableID = t, this.columnID = n, this.dataTypeID = i, this.dataTypeSize = s, this.dataTypeModifier = o, this.format = u;
6892
6837
  }
@@ -6894,7 +6839,7 @@ var ln = T((_) => {
6894
6839
  a(Jr, "Field");
6895
6840
  var Or = Jr;
6896
6841
  _.Field = Or;
6897
- var Xr = class Xr2 {
6842
+ var Xr = class Xr {
6898
6843
  constructor(e, t) {
6899
6844
  this.length = e, this.fieldCount = t, this.name = "rowDescription", this.fields = new Array(this.fieldCount);
6900
6845
  }
@@ -6902,7 +6847,7 @@ var ln = T((_) => {
6902
6847
  a(Xr, "RowDescriptionMessage");
6903
6848
  var qr = Xr;
6904
6849
  _.RowDescriptionMessage = qr;
6905
- var en = class en2 {
6850
+ var en = class en {
6906
6851
  constructor(e, t) {
6907
6852
  this.length = e, this.parameterCount = t, this.name = "parameterDescription", this.dataTypeIDs = new Array(this.parameterCount);
6908
6853
  }
@@ -6910,7 +6855,7 @@ var ln = T((_) => {
6910
6855
  a(en, "ParameterDescriptionMessage");
6911
6856
  var Qr = en;
6912
6857
  _.ParameterDescriptionMessage = Qr;
6913
- var tn = class tn2 {
6858
+ var tn = class tn {
6914
6859
  constructor(e, t, n) {
6915
6860
  this.length = e, this.parameterName = t, this.parameterValue = n, this.name = "parameterStatus";
6916
6861
  }
@@ -6918,7 +6863,7 @@ var ln = T((_) => {
6918
6863
  a(tn, "ParameterStatusMessage");
6919
6864
  var Nr = tn;
6920
6865
  _.ParameterStatusMessage = Nr;
6921
- var rn = class rn2 {
6866
+ var rn = class rn {
6922
6867
  constructor(e, t) {
6923
6868
  this.length = e, this.salt = t, this.name = "authenticationMD5Password";
6924
6869
  }
@@ -6926,7 +6871,7 @@ var ln = T((_) => {
6926
6871
  a(rn, "AuthenticationMD5Password");
6927
6872
  var Wr = rn;
6928
6873
  _.AuthenticationMD5Password = Wr;
6929
- var nn = class nn2 {
6874
+ var nn = class nn {
6930
6875
  constructor(e, t, n) {
6931
6876
  this.length = e, this.processID = t, this.secretKey = n, this.name = "backendKeyData";
6932
6877
  }
@@ -6934,7 +6879,7 @@ var ln = T((_) => {
6934
6879
  a(nn, "BackendKeyDataMessage");
6935
6880
  var jr = nn;
6936
6881
  _.BackendKeyDataMessage = jr;
6937
- var sn = class sn2 {
6882
+ var sn = class sn {
6938
6883
  constructor(e, t, n, i) {
6939
6884
  this.length = e, this.processId = t, this.channel = n, this.payload = i, this.name = "notification";
6940
6885
  }
@@ -6942,7 +6887,7 @@ var ln = T((_) => {
6942
6887
  a(sn, "NotificationResponseMessage");
6943
6888
  var Hr = sn;
6944
6889
  _.NotificationResponseMessage = Hr;
6945
- var on = class on2 {
6890
+ var on = class on {
6946
6891
  constructor(e, t) {
6947
6892
  this.length = e, this.status = t, this.name = "readyForQuery";
6948
6893
  }
@@ -6950,7 +6895,7 @@ var ln = T((_) => {
6950
6895
  a(on, "ReadyForQueryMessage");
6951
6896
  var $r = on;
6952
6897
  _.ReadyForQueryMessage = $r;
6953
- var an = class an2 {
6898
+ var an = class an {
6954
6899
  constructor(e, t) {
6955
6900
  this.length = e, this.text = t, this.name = "commandComplete";
6956
6901
  }
@@ -6958,7 +6903,7 @@ var ln = T((_) => {
6958
6903
  a(an, "CommandCompleteMessage");
6959
6904
  var Gr = an;
6960
6905
  _.CommandCompleteMessage = Gr;
6961
- var un = class un2 {
6906
+ var un = class un {
6962
6907
  constructor(e, t) {
6963
6908
  this.length = e, this.fields = t, this.name = "dataRow", this.fieldCount = t.length;
6964
6909
  }
@@ -6966,7 +6911,7 @@ var ln = T((_) => {
6966
6911
  a(un, "DataRowMessage");
6967
6912
  var Vr = un;
6968
6913
  _.DataRowMessage = Vr;
6969
- var cn = class cn2 {
6914
+ var cn = class cn {
6970
6915
  constructor(e, t) {
6971
6916
  this.length = e, this.message = t, this.name = "notice";
6972
6917
  }
@@ -6979,7 +6924,7 @@ var Qs = T((Bt) => {
6979
6924
  p();
6980
6925
  Object.defineProperty(Bt, "__esModule", { value: true });
6981
6926
  Bt.Writer = undefined;
6982
- var hn = class hn2 {
6927
+ var hn = class hn {
6983
6928
  constructor(e = 256) {
6984
6929
  this.size = e, this.offset = 5, this.headerPosition = 0, this.buffer = d.allocUnsafe(e);
6985
6930
  }
@@ -7101,7 +7046,7 @@ var js = T((kt) => {
7101
7046
  p();
7102
7047
  Object.defineProperty(kt, "__esModule", { value: true });
7103
7048
  kt.BufferReader = undefined;
7104
- var Oc = d.allocUnsafe(0), mn = class mn2 {
7049
+ var Oc = d.allocUnsafe(0), mn = class mn {
7105
7050
  constructor(e = 0) {
7106
7051
  this.offset = e, this.buffer = Oc, this.encoding = "utf-8";
7107
7052
  }
@@ -7147,7 +7092,7 @@ var Gs = T((Mt) => {
7147
7092
  p();
7148
7093
  Object.defineProperty(Mt, "__esModule", { value: true });
7149
7094
  Mt.Parser = undefined;
7150
- var k = ln(), qc = js(), wn = 1, Qc = 4, Hs = wn + Qc, $s = d.allocUnsafe(0), bn = class bn2 {
7095
+ var k = ln(), qc = js(), wn = 1, Qc = 4, Hs = wn + Qc, $s = d.allocUnsafe(0), bn = class bn {
7151
7096
  constructor(e) {
7152
7097
  if (this.buffer = $s, this.bufferLength = 0, this.bufferOffset = 0, this.reader = new qc.BufferReader, e?.mode === "binary")
7153
7098
  throw new Error("Binary mode not supported yet");
@@ -7387,7 +7332,7 @@ var zs = G(() => {
7387
7332
  });
7388
7333
  var En = T((Xh, Zs) => {
7389
7334
  p();
7390
- var Ks = (Fe(), O(wi)), Gc = ge().EventEmitter, { parse: Vc, serialize: Q } = vn(), Ys = Q.flush(), zc = Q.sync(), Kc = Q.end(), Sn = class Sn2 extends Gc {
7335
+ var Ks = (Fe(), O(wi)), Gc = ge().EventEmitter, { parse: Vc, serialize: Q } = vn(), Ys = Q.flush(), zc = Q.sync(), Kc = Q.end(), Sn = class Sn extends Gc {
7391
7336
  constructor(e) {
7392
7337
  super(), e = e || {}, this.stream = e.stream || new Ks.Socket, this._keepAlive = e.keepAlive, this._keepAliveInitialDelayMillis = e.keepAliveInitialDelayMillis, this.lastBuffer = false, this.parsedStatements = {}, this.ssl = e.ssl || false, this._ending = false, this._emitMessage = false;
7393
7338
  var t = this;
@@ -7512,7 +7457,7 @@ var En = T((Xh, Zs) => {
7512
7457
  });
7513
7458
  var eo = T((np, Xs) => {
7514
7459
  p();
7515
- var Yc = ge().EventEmitter, rp = (it(), O(nt)), Zc = rt(), An = ds(), Jc = Cs(), Xc = At(), el = Rt(), Js = qs(), tl = tt(), rl = En(), Cn = class Cn2 extends Yc {
7460
+ var Yc = ge().EventEmitter, rp = (it(), O(nt)), Zc = rt(), An = ds(), Jc = Cs(), Xc = At(), el = Rt(), Js = qs(), tl = tt(), rl = En(), Cn = class Cn extends Yc {
7516
7461
  constructor(e) {
7517
7462
  super(), this.connectionParameters = new el(e), this.user = this.connectionParameters.user, this.database = this.connectionParameters.database, this.port = this.connectionParameters.port, this.host = this.connectionParameters.host, Object.defineProperty(this, "password", { configurable: true, enumerable: false, writable: true, value: this.connectionParameters.password }), this.replication = this.connectionParameters.replication;
7518
7463
  var t = e || {};
@@ -7753,13 +7698,13 @@ var io = T((op, no) => {
7753
7698
  var nl = ge().EventEmitter, to = a(function() {}, "NOOP"), ro = a((r, e) => {
7754
7699
  let t = r.findIndex(e);
7755
7700
  return t === -1 ? undefined : r.splice(t, 1)[0];
7756
- }, "removeWhere"), Tn = class Tn2 {
7701
+ }, "removeWhere"), Tn = class Tn {
7757
7702
  constructor(e, t, n) {
7758
7703
  this.client = e, this.idleListener = t, this.timeoutId = n;
7759
7704
  }
7760
7705
  };
7761
7706
  a(Tn, "IdleItem");
7762
- var _n = Tn, Pn = class Pn2 {
7707
+ var _n = Tn, Pn = class Pn {
7763
7708
  constructor(e) {
7764
7709
  this.callback = e;
7765
7710
  }
@@ -7791,7 +7736,7 @@ var io = T((op, no) => {
7791
7736
  }, "idleListener");
7792
7737
  }
7793
7738
  a(sl, "makeIdleListener");
7794
- var Rn = class Rn2 extends nl {
7739
+ var Rn = class Rn extends nl {
7795
7740
  constructor(e, t) {
7796
7741
  super(), this.options = Object.assign({}, e), e != null && "password" in e && Object.defineProperty(this.options, "password", {
7797
7742
  configurable: true,
@@ -8267,7 +8212,7 @@ function Ei(r, e = {}) {
8267
8212
  }
8268
8213
  a(Ei, "toHex");
8269
8214
  p();
8270
- var gt = class gt2 {
8215
+ var gt = class gt {
8271
8216
  constructor(e, t) {
8272
8217
  this.strings = e;
8273
8218
  this.values = t;
@@ -8280,7 +8225,7 @@ var gt = class gt2 {
8280
8225
  if (o instanceof Ge)
8281
8226
  e.query += o.sql;
8282
8227
  else if (o instanceof Ce)
8283
- if (o.queryData instanceof gt2)
8228
+ if (o.queryData instanceof gt)
8284
8229
  o.queryData.toParameterizedQuery(e);
8285
8230
  else {
8286
8231
  if (o.queryData.params?.length)
@@ -8297,7 +8242,7 @@ var gt = class gt2 {
8297
8242
  };
8298
8243
  a(gt, "SqlTemplate");
8299
8244
  var $e = gt;
8300
- var Xt = class Xt2 {
8245
+ var Xt = class Xt {
8301
8246
  constructor(e) {
8302
8247
  this.sql = e;
8303
8248
  }
@@ -8327,7 +8272,7 @@ a(bt, "warnIfBrowser");
8327
8272
  Fe();
8328
8273
  var as = Se(At());
8329
8274
  var us = Se(rt());
8330
- var _t = class _t2 extends Error {
8275
+ var _t = class _t extends Error {
8331
8276
  constructor(t) {
8332
8277
  super(t);
8333
8278
  E(this, "name", "NeonDbError");
@@ -8348,7 +8293,7 @@ var _t = class _t2 extends Error {
8348
8293
  E(this, "line");
8349
8294
  E(this, "routine");
8350
8295
  E(this, "sourceError");
8351
- "captureStackTrace" in Error && typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, _t2);
8296
+ "captureStackTrace" in Error && typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, _t);
8352
8297
  }
8353
8298
  };
8354
8299
  a(_t, "NeonDbError");
@@ -8444,7 +8389,7 @@ function cs(r, {
8444
8389
  return a(Y, "execute"), D;
8445
8390
  }
8446
8391
  a(cs, "neon");
8447
- var dr = class dr2 {
8392
+ var dr = class dr {
8448
8393
  constructor(e, t, n) {
8449
8394
  this.execute = e;
8450
8395
  this.queryData = t;
@@ -8487,7 +8432,7 @@ p();
8487
8432
  var go = Se(ot());
8488
8433
  p();
8489
8434
  var wo = Se(ot());
8490
- var kn = class kn2 extends wo.Client {
8435
+ var kn = class kn extends wo.Client {
8491
8436
  constructor(t) {
8492
8437
  super(t);
8493
8438
  this.config = t;
@@ -8525,7 +8470,7 @@ var kn = class kn2 extends wo.Client {
8525
8470
  throw new Error("SASL: Invalid attribute pair entry");
8526
8471
  let $ = M[0], me = M.substring(2);
8527
8472
  return [$, me];
8528
- })), c = u.r, l = u.s, f = u.i;
8473
+ })), { r: c, s: l, i: f } = u;
8529
8474
  if (!c || !/^[!-+--~]+$/.test(c))
8530
8475
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable");
8531
8476
  if (!l || !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(l))
@@ -8561,7 +8506,7 @@ function vl(r, e) {
8561
8506
  return { callback: i, result: s };
8562
8507
  }
8563
8508
  a(vl, "promisify");
8564
- var Un = class Un2 extends go.Pool {
8509
+ var Un = class Un extends go.Pool {
8565
8510
  constructor() {
8566
8511
  super(...arguments);
8567
8512
  E(this, "Client", ut);
@@ -8660,10 +8605,10 @@ class SepiaClient {
8660
8605
  listNamespaces() {
8661
8606
  return this.request("GET", "/api/namespaces");
8662
8607
  }
8663
- createNamespace(name, description2) {
8608
+ createNamespace(name, description) {
8664
8609
  return this.request("POST", "/api/namespaces", {
8665
8610
  name,
8666
- description: description2
8611
+ description
8667
8612
  });
8668
8613
  }
8669
8614
  getNamespace(idOrName) {
@@ -8673,16 +8618,16 @@ class SepiaClient {
8673
8618
  return this.request("DELETE", `/api/namespaces/${encodeURIComponent(idOrName)}`);
8674
8619
  }
8675
8620
  findEntities(params) {
8676
- const qs2 = new URLSearchParams;
8621
+ const qs = new URLSearchParams;
8677
8622
  if (params.namespace !== undefined)
8678
- qs2.set("namespace", params.namespace);
8623
+ qs.set("namespace", params.namespace);
8679
8624
  if (params.q !== undefined)
8680
- qs2.set("q", params.q);
8625
+ qs.set("q", params.q);
8681
8626
  if (params.type !== undefined)
8682
- qs2.set("type", params.type);
8627
+ qs.set("type", params.type);
8683
8628
  if (params.limit !== undefined)
8684
- qs2.set("limit", String(params.limit));
8685
- const suffix = qs2.size ? `?${qs2.toString()}` : "";
8629
+ qs.set("limit", String(params.limit));
8630
+ const suffix = qs.size ? `?${qs.toString()}` : "";
8686
8631
  return this.request("GET", `/api/entities${suffix}`);
8687
8632
  }
8688
8633
  createEntity(namespace, entity) {
@@ -8708,20 +8653,20 @@ class SepiaClient {
8708
8653
  });
8709
8654
  }
8710
8655
  queryMemories(params) {
8711
- const qs2 = new URLSearchParams;
8656
+ const qs = new URLSearchParams;
8712
8657
  if (params.type !== undefined)
8713
- qs2.set("type", params.type);
8658
+ qs.set("type", params.type);
8714
8659
  if (params.namespace !== undefined)
8715
- qs2.set("namespace", params.namespace);
8660
+ qs.set("namespace", params.namespace);
8716
8661
  if (params.importance_min !== undefined)
8717
- qs2.set("importance_min", String(params.importance_min));
8662
+ qs.set("importance_min", String(params.importance_min));
8718
8663
  if (params.archived !== undefined)
8719
- qs2.set("archived", String(params.archived));
8664
+ qs.set("archived", String(params.archived));
8720
8665
  if (params.tags !== undefined && params.tags.length)
8721
- qs2.set("tags", params.tags.join(","));
8666
+ qs.set("tags", params.tags.join(","));
8722
8667
  if (params.limit !== undefined)
8723
- qs2.set("limit", String(params.limit));
8724
- const suffix = qs2.size ? `?${qs2.toString()}` : "";
8668
+ qs.set("limit", String(params.limit));
8669
+ const suffix = qs.size ? `?${qs.toString()}` : "";
8725
8670
  return this.request("GET", `/api/memories${suffix}`);
8726
8671
  }
8727
8672
  createMemory(memory) {
@@ -8747,18 +8692,18 @@ class SepiaClient {
8747
8692
  return this.request("POST", "/api/conversations", conversation);
8748
8693
  }
8749
8694
  getConversation(conversationId, namespace) {
8750
- const qs2 = new URLSearchParams({ conversation_id: conversationId });
8695
+ const qs = new URLSearchParams({ conversation_id: conversationId });
8751
8696
  if (namespace !== undefined)
8752
- qs2.set("namespace", namespace);
8753
- return this.request("GET", `/api/conversations?${qs2.toString()}`);
8697
+ qs.set("namespace", namespace);
8698
+ return this.request("GET", `/api/conversations?${qs.toString()}`);
8754
8699
  }
8755
8700
  listRelations(params) {
8756
- const qs2 = new URLSearchParams;
8701
+ const qs = new URLSearchParams;
8757
8702
  if (params.entity_id !== undefined)
8758
- qs2.set("entity_id", params.entity_id);
8703
+ qs.set("entity_id", params.entity_id);
8759
8704
  if (params.namespace !== undefined)
8760
- qs2.set("namespace", params.namespace);
8761
- const suffix = qs2.size ? `?${qs2.toString()}` : "";
8705
+ qs.set("namespace", params.namespace);
8706
+ const suffix = qs.size ? `?${qs.toString()}` : "";
8762
8707
  return this.request("GET", `/api/relations${suffix}`);
8763
8708
  }
8764
8709
  createRelation(relation) {
@@ -8768,22 +8713,22 @@ class SepiaClient {
8768
8713
  return this.request("DELETE", `/api/relations/${id}`);
8769
8714
  }
8770
8715
  search(params) {
8771
- const qs2 = new URLSearchParams({ q: params.q });
8716
+ const qs = new URLSearchParams({ q: params.q });
8772
8717
  if (params.namespace !== undefined)
8773
- qs2.set("namespace", params.namespace);
8718
+ qs.set("namespace", params.namespace);
8774
8719
  if (params.type !== undefined)
8775
- qs2.set("type", params.type);
8720
+ qs.set("type", params.type);
8776
8721
  if (params.tags !== undefined && params.tags.length)
8777
- qs2.set("tags", params.tags.join(","));
8722
+ qs.set("tags", params.tags.join(","));
8778
8723
  if (params.limit !== undefined)
8779
- qs2.set("limit", String(params.limit));
8780
- return this.request("GET", `/api/search?${qs2.toString()}`);
8724
+ qs.set("limit", String(params.limit));
8725
+ return this.request("GET", `/api/search?${qs.toString()}`);
8781
8726
  }
8782
8727
  traverseGraph(startId, depth) {
8783
- const qs2 = new URLSearchParams({ root: startId });
8728
+ const qs = new URLSearchParams({ root: startId });
8784
8729
  if (depth !== undefined)
8785
- qs2.set("depth", String(depth));
8786
- return this.request("GET", `/api/graph?${qs2.toString()}`);
8730
+ qs.set("depth", String(depth));
8731
+ return this.request("GET", `/api/graph?${qs.toString()}`);
8787
8732
  }
8788
8733
  consolidate() {
8789
8734
  return this.request("POST", "/api/consolidate");
@@ -8816,11 +8761,11 @@ function safe(handler) {
8816
8761
  }
8817
8762
 
8818
8763
  // src/tools/namespace.ts
8819
- function registerNamespaceTools(server, client2) {
8764
+ function registerNamespaceTools(server, client) {
8820
8765
  server.tool({
8821
8766
  name: "manage_namespace",
8822
8767
  title: "Manage Namespaces",
8823
- description: "Create, list, get, or delete namespaces \u2014 isolated memory containers.",
8768
+ description: "Create, list, get, or delete namespaces — isolated memory containers.",
8824
8769
  icons: [SEPIA_ICON],
8825
8770
  schema: NamespaceToolInput
8826
8771
  }, safe(async (args) => {
@@ -8830,13 +8775,13 @@ function registerNamespaceTools(server, client2) {
8830
8775
  throw new Error("action=create requires name");
8831
8776
  return {
8832
8777
  action: "create",
8833
- namespace: await client2.createNamespace(args.name, args.description)
8778
+ namespace: await client.createNamespace(args.name, args.description)
8834
8779
  };
8835
8780
  }
8836
8781
  case "list":
8837
8782
  return {
8838
8783
  action: "list",
8839
- namespaces: (await client2.listNamespaces()).namespaces
8784
+ namespaces: (await client.listNamespaces()).namespaces
8840
8785
  };
8841
8786
  case "get": {
8842
8787
  const idOrName = args.id ?? args.name;
@@ -8844,7 +8789,7 @@ function registerNamespaceTools(server, client2) {
8844
8789
  throw new Error("action=get requires id or name");
8845
8790
  return {
8846
8791
  action: "get",
8847
- namespace: await client2.getNamespace(idOrName)
8792
+ namespace: await client.getNamespace(idOrName)
8848
8793
  };
8849
8794
  }
8850
8795
  case "delete": {
@@ -8853,7 +8798,7 @@ function registerNamespaceTools(server, client2) {
8853
8798
  throw new Error("action=delete requires id or name");
8854
8799
  return {
8855
8800
  action: "delete",
8856
- deleted: await client2.deleteNamespace(idOrName)
8801
+ deleted: await client.deleteNamespace(idOrName)
8857
8802
  };
8858
8803
  }
8859
8804
  }
@@ -8861,11 +8806,11 @@ function registerNamespaceTools(server, client2) {
8861
8806
  }
8862
8807
 
8863
8808
  // src/tools/entity.ts
8864
- function registerEntityTools(server, client2) {
8809
+ function registerEntityTools(server, client) {
8865
8810
  server.tool({
8866
8811
  name: "manage_entity",
8867
8812
  title: "Manage Entities",
8868
- description: "Create, get, update, delete, find, or batch-update entities \u2014 knowledge graph nodes (people, projects, tools, concepts, repos).",
8813
+ description: "Create, get, update, delete, find, or batch-update entities — knowledge graph nodes (people, projects, tools, concepts, repos).",
8869
8814
  icons: [SEPIA_ICON],
8870
8815
  schema: EntityToolInput
8871
8816
  }, safe(async (args) => {
@@ -8875,7 +8820,7 @@ function registerEntityTools(server, client2) {
8875
8820
  throw new Error("action=create requires entity");
8876
8821
  return {
8877
8822
  action: "create",
8878
- entity: await client2.createEntity(args.namespace ?? "personal", args.entity)
8823
+ entity: await client.createEntity(args.namespace ?? "personal", args.entity)
8879
8824
  };
8880
8825
  }
8881
8826
  case "get": {
@@ -8883,7 +8828,7 @@ function registerEntityTools(server, client2) {
8883
8828
  throw new Error("action=get requires id");
8884
8829
  return {
8885
8830
  action: "get",
8886
- entity: await client2.getEntity(args.id)
8831
+ entity: await client.getEntity(args.id)
8887
8832
  };
8888
8833
  }
8889
8834
  case "update": {
@@ -8893,7 +8838,7 @@ function registerEntityTools(server, client2) {
8893
8838
  throw new Error("action=update requires update");
8894
8839
  return {
8895
8840
  action: "update",
8896
- entity: await client2.updateEntity(args.id, args.update)
8841
+ entity: await client.updateEntity(args.id, args.update)
8897
8842
  };
8898
8843
  }
8899
8844
  case "delete": {
@@ -8901,16 +8846,16 @@ function registerEntityTools(server, client2) {
8901
8846
  throw new Error("action=delete requires id");
8902
8847
  return {
8903
8848
  action: "delete",
8904
- deleted: await client2.deleteEntity(args.id)
8849
+ deleted: await client.deleteEntity(args.id)
8905
8850
  };
8906
8851
  }
8907
8852
  case "find": {
8908
- const { count, entities: entities3 } = await client2.findEntities({
8853
+ const { count, entities } = await client.findEntities({
8909
8854
  namespace: args.namespace,
8910
8855
  q: args.query,
8911
8856
  type: args.type
8912
8857
  });
8913
- return { action: "find", count, entities: entities3 };
8858
+ return { action: "find", count, entities };
8914
8859
  }
8915
8860
  case "batch_update": {
8916
8861
  if (!args.where)
@@ -8919,7 +8864,7 @@ function registerEntityTools(server, client2) {
8919
8864
  throw new Error("action=batch_update requires update");
8920
8865
  return {
8921
8866
  action: "batch_update",
8922
- ...await client2.batchUpdateEntities(args.where, args.update, args.batch_limit)
8867
+ ...await client.batchUpdateEntities(args.where, args.update, args.batch_limit)
8923
8868
  };
8924
8869
  }
8925
8870
  }
@@ -8927,11 +8872,11 @@ function registerEntityTools(server, client2) {
8927
8872
  }
8928
8873
 
8929
8874
  // src/tools/relation.ts
8930
- function registerRelationTools(server, client2) {
8875
+ function registerRelationTools(server, client) {
8931
8876
  server.tool({
8932
8877
  name: "manage_relation",
8933
8878
  title: "Manage Relations",
8934
- description: "Create, delete, or list relations \u2014 directed, weighted edges between entities.",
8879
+ description: "Create, delete, or list relations — directed, weighted edges between entities.",
8935
8880
  icons: [SEPIA_ICON],
8936
8881
  schema: RelationToolInput
8937
8882
  }, safe(async (args) => {
@@ -8941,7 +8886,7 @@ function registerRelationTools(server, client2) {
8941
8886
  throw new Error("action=create requires relation");
8942
8887
  return {
8943
8888
  action: "create",
8944
- relation: await client2.createRelation(args.relation)
8889
+ relation: await client.createRelation(args.relation)
8945
8890
  };
8946
8891
  }
8947
8892
  case "delete": {
@@ -8949,13 +8894,13 @@ function registerRelationTools(server, client2) {
8949
8894
  throw new Error("action=delete requires id");
8950
8895
  return {
8951
8896
  action: "delete",
8952
- deleted: await client2.deleteRelation(args.id)
8897
+ deleted: await client.deleteRelation(args.id)
8953
8898
  };
8954
8899
  }
8955
8900
  case "list":
8956
8901
  return {
8957
8902
  action: "list",
8958
- relations: (await client2.listRelations({
8903
+ relations: (await client.listRelations({
8959
8904
  entity_id: args.entity_id,
8960
8905
  namespace: args.namespace
8961
8906
  })).relations
@@ -8965,11 +8910,11 @@ function registerRelationTools(server, client2) {
8965
8910
  }
8966
8911
 
8967
8912
  // src/tools/memory.ts
8968
- function registerMemoryTools(server, client2) {
8913
+ function registerMemoryTools(server, client) {
8969
8914
  server.tool({
8970
8915
  name: "manage_memory",
8971
8916
  title: "Manage Memories",
8972
- description: "Create, get, update, delete, query, batch-update, or ingest memories \u2014 knowledge fragments with importance scoring, plus conversation handoff digests.",
8917
+ description: "Create, get, update, delete, query, batch-update, or ingest memories — knowledge fragments with importance scoring, plus conversation handoff digests.",
8973
8918
  icons: [SEPIA_ICON],
8974
8919
  schema: MemoryToolInput
8975
8920
  }, safe(async (args) => {
@@ -8979,7 +8924,7 @@ function registerMemoryTools(server, client2) {
8979
8924
  throw new Error("action=create requires memory");
8980
8925
  return {
8981
8926
  action: "create",
8982
- memory: await client2.createMemory(args.memory)
8927
+ memory: await client.createMemory(args.memory)
8983
8928
  };
8984
8929
  }
8985
8930
  case "get": {
@@ -8987,7 +8932,7 @@ function registerMemoryTools(server, client2) {
8987
8932
  throw new Error("action=get requires id");
8988
8933
  return {
8989
8934
  action: "get",
8990
- memory: await client2.getMemory(args.id)
8935
+ memory: await client.getMemory(args.id)
8991
8936
  };
8992
8937
  }
8993
8938
  case "update": {
@@ -8997,7 +8942,7 @@ function registerMemoryTools(server, client2) {
8997
8942
  throw new Error("action=update requires update");
8998
8943
  return {
8999
8944
  action: "update",
9000
- memory: await client2.updateMemory(args.id, args.update)
8945
+ memory: await client.updateMemory(args.id, args.update)
9001
8946
  };
9002
8947
  }
9003
8948
  case "delete": {
@@ -9005,11 +8950,11 @@ function registerMemoryTools(server, client2) {
9005
8950
  throw new Error("action=delete requires id");
9006
8951
  return {
9007
8952
  action: "delete",
9008
- deleted: await client2.deleteMemory(args.id)
8953
+ deleted: await client.deleteMemory(args.id)
9009
8954
  };
9010
8955
  }
9011
8956
  case "query": {
9012
- const { count, memories: memories3 } = await client2.queryMemories({
8957
+ const { count, memories } = await client.queryMemories({
9013
8958
  type: args.type,
9014
8959
  namespace: args.namespace,
9015
8960
  importance_min: args.importance_min,
@@ -9017,7 +8962,7 @@ function registerMemoryTools(server, client2) {
9017
8962
  tags: args.tags,
9018
8963
  limit: args.limit
9019
8964
  });
9020
- return { action: "query", count, memories: memories3 };
8965
+ return { action: "query", count, memories };
9021
8966
  }
9022
8967
  case "batch_update": {
9023
8968
  if (!args.where)
@@ -9026,7 +8971,7 @@ function registerMemoryTools(server, client2) {
9026
8971
  throw new Error("action=batch_update requires update");
9027
8972
  return {
9028
8973
  action: "batch_update",
9029
- ...await client2.batchUpdateMemories(args.where, args.update, args.batch_limit)
8974
+ ...await client.batchUpdateMemories(args.where, args.update, args.batch_limit)
9030
8975
  };
9031
8976
  }
9032
8977
  case "ingest": {
@@ -9035,7 +8980,7 @@ function registerMemoryTools(server, client2) {
9035
8980
  }
9036
8981
  return {
9037
8982
  action: "ingest",
9038
- ...await client2.ingestConversation(args.conversation)
8983
+ ...await client.ingestConversation(args.conversation)
9039
8984
  };
9040
8985
  }
9041
8986
  }
@@ -9043,7 +8988,7 @@ function registerMemoryTools(server, client2) {
9043
8988
  }
9044
8989
 
9045
8990
  // src/tools/search.ts
9046
- function registerSearchTools(server, client2) {
8991
+ function registerSearchTools(server, client) {
9047
8992
  server.tool({
9048
8993
  name: "search",
9049
8994
  title: "Search Memory",
@@ -9052,7 +8997,7 @@ function registerSearchTools(server, client2) {
9052
8997
  schema: SearchToolInput,
9053
8998
  annotations: { readOnlyHint: true }
9054
8999
  }, safe(async (args) => {
9055
- const { count, results } = await client2.search({
9000
+ const { count, results } = await client.search({
9056
9001
  q: args.q,
9057
9002
  namespace: args.namespace,
9058
9003
  type: args.type,
@@ -9064,7 +9009,7 @@ function registerSearchTools(server, client2) {
9064
9009
  }
9065
9010
 
9066
9011
  // src/tools/traverse.ts
9067
- function registerTraverseTools(server, client2) {
9012
+ function registerTraverseTools(server, client) {
9068
9013
  server.tool({
9069
9014
  name: "traverse_graph",
9070
9015
  title: "Traverse Graph",
@@ -9073,25 +9018,25 @@ function registerTraverseTools(server, client2) {
9073
9018
  schema: TraverseToolInput,
9074
9019
  annotations: { readOnlyHint: true }
9075
9020
  }, safe(async (args) => {
9076
- const graph2 = await client2.traverseGraph(args.start_id, args.depth);
9021
+ const graph = await client.traverseGraph(args.start_id, args.depth);
9077
9022
  return {
9078
9023
  start_id: args.start_id,
9079
- ...graph2
9024
+ ...graph
9080
9025
  };
9081
9026
  }));
9082
9027
  }
9083
9028
 
9084
9029
  // src/tools/consolidate.ts
9085
- function registerConsolidateTools(server, client2) {
9030
+ function registerConsolidateTools(server, client) {
9086
9031
  server.tool({
9087
9032
  name: "consolidate",
9088
9033
  title: "Consolidate Memory",
9089
- description: "Idempotent maintenance sweep \u2014 pure SQL, no LLM calls. Scoped to your namespaces only.",
9034
+ description: "Idempotent maintenance sweep — pure SQL, no LLM calls. Scoped to your namespaces only.",
9090
9035
  icons: [SEPIA_ICON],
9091
9036
  schema: ConsolidateToolInput,
9092
9037
  annotations: { destructiveHint: true }
9093
9038
  }, safe(async () => {
9094
- return (await client2.consolidate()).result;
9039
+ return (await client.consolidate()).result;
9095
9040
  }));
9096
9041
  }
9097
9042
 
@@ -9100,9 +9045,9 @@ function createSepiaServer(opts = {}) {
9100
9045
  const baseUrl = opts.baseUrl ?? process.env.SEPIA_URL ?? "https://sepia.fly.dev";
9101
9046
  const apiKey = opts.apiKey ?? process.env.SEPIA_API_KEY ?? "";
9102
9047
  if (!apiKey) {
9103
- throw new Error("SEPIA_API_KEY is required \u2014 set it in the environment (the server's MCP_BEARER_TOKEN or an API key).");
9048
+ throw new Error("SEPIA_API_KEY is required — set it in the environment (the server's MCP_BEARER_TOKEN or an API key).");
9104
9049
  }
9105
- const client2 = new SepiaClient({
9050
+ const client = new SepiaClient({
9106
9051
  baseUrl,
9107
9052
  apiKey,
9108
9053
  source: opts.source ?? process.env.SEPIA_SOURCE ?? "sepia-mcp"
@@ -9110,23 +9055,23 @@ function createSepiaServer(opts = {}) {
9110
9055
  const server = new McpServer({
9111
9056
  name: "sepia",
9112
9057
  version: "1.0.0",
9113
- description: "Sepia \u2014 personal knowledge-graph memory server (remote REST client). Entities, relations, memories in namespaces, with search, traversal, and consolidation."
9058
+ description: "Sepia — personal knowledge-graph memory server (remote REST client). Entities, relations, memories in namespaces, with search, traversal, and consolidation."
9114
9059
  }, {
9115
9060
  adapter: new ValibotJsonSchemaAdapter,
9116
9061
  capabilities: { tools: {} },
9117
9062
  instructions: MEMORY_CONTRACT
9118
9063
  });
9119
- registerNamespaceTools(server, client2);
9120
- registerEntityTools(server, client2);
9121
- registerRelationTools(server, client2);
9122
- registerMemoryTools(server, client2);
9123
- registerSearchTools(server, client2);
9124
- registerTraverseTools(server, client2);
9125
- registerConsolidateTools(server, client2);
9126
- return { server, client: client2 };
9064
+ registerNamespaceTools(server, client);
9065
+ registerEntityTools(server, client);
9066
+ registerRelationTools(server, client);
9067
+ registerMemoryTools(server, client);
9068
+ registerSearchTools(server, client);
9069
+ registerTraverseTools(server, client);
9070
+ registerConsolidateTools(server, client);
9071
+ return { server, client };
9127
9072
  }
9128
9073
  async function startStdio(server) {
9129
- const readline = (await import("readline")).createInterface({
9074
+ const readline = (await import("node:readline")).createInterface({
9130
9075
  input: process.stdin,
9131
9076
  crlfDelay: Infinity
9132
9077
  });
@@ -9136,12 +9081,12 @@ async function startStdio(server) {
9136
9081
  if (closed && pending === 0)
9137
9082
  process.exit(0);
9138
9083
  };
9139
- readline.on("line", (line2) => {
9140
- if (!line2.trim())
9084
+ readline.on("line", (line) => {
9085
+ if (!line.trim())
9141
9086
  return;
9142
9087
  let message;
9143
9088
  try {
9144
- message = JSON.parse(line2);
9089
+ message = JSON.parse(line);
9145
9090
  } catch {
9146
9091
  return;
9147
9092
  }
@@ -9174,21 +9119,43 @@ async function startStdio(server) {
9174
9119
  async function startHttp(server, port) {
9175
9120
  const { HttpTransport } = await import("@tmcp/transport-http");
9176
9121
  const transport = new HttpTransport(server, { path: "/mcp" });
9177
- const bun = await Promise.resolve(globalThis.Bun);
9178
- bun.serve({
9179
- port,
9180
- async fetch(request) {
9181
- const url = new URL(request.url);
9182
- if (url.pathname === "/mcp") {
9183
- const response = await transport.respond(request, {});
9184
- if (response != null)
9185
- return response;
9186
- return new Response("no response", { status: 202 });
9187
- }
9188
- return new Response("not found", { status: 404 });
9122
+ const http = await import("node:http");
9123
+ http.createServer(async (req, res) => {
9124
+ const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
9125
+ if (url.pathname !== "/mcp") {
9126
+ res.writeHead(404);
9127
+ res.end("not found");
9128
+ return;
9129
+ }
9130
+ const body = await new Promise((resolve) => {
9131
+ const chunks = [];
9132
+ req.on("data", (c) => chunks.push(c));
9133
+ req.on("end", () => resolve(Buffer.concat(chunks).toString()));
9134
+ });
9135
+ const request = new Request(url.toString(), {
9136
+ method: req.method,
9137
+ headers: req.headers,
9138
+ body: body || undefined
9139
+ });
9140
+ try {
9141
+ const response = await transport.respond(request, {});
9142
+ if (response != null) {
9143
+ res.writeHead(response.status, Object.fromEntries(response.headers));
9144
+ const responseBody = await response.text();
9145
+ res.end(responseBody);
9146
+ } else {
9147
+ res.writeHead(202);
9148
+ res.end("no response");
9149
+ }
9150
+ } catch (err) {
9151
+ const msg = err instanceof Error ? err.message : String(err);
9152
+ console.error("[sepia-mcp] error:", msg);
9153
+ res.writeHead(500);
9154
+ res.end(msg);
9189
9155
  }
9156
+ }).listen(port, () => {
9157
+ console.error(`[sepia-mcp] HTTP transport listening on :${port}/mcp`);
9190
9158
  });
9191
- console.error(`[sepia-mcp] HTTP transport listening on :${port}/mcp`);
9192
9159
  }
9193
9160
  var isHttp = process.argv.includes("--http") || process.argv.includes("--http-transport") || process.env.SEPIA_HTTP === "1";
9194
9161
  var { server } = createSepiaServer();