@hexis-ai/engram-server 0.3.0 → 0.5.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.
package/dist/storage.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Session } from "@hexis-ai/engram-core";
2
- import type { PersonCreate, PersonInfo, PersonUpdate, SessionEvent, SessionInit } from "@hexis-ai/engram-sdk";
2
+ import type { AliasInfo, AliasUpsert, PersonCreate, PersonInfo, PersonUpdate, SessionEvent, SessionInit } from "@hexis-ai/engram-sdk";
3
3
  /**
4
4
  * Storage adapter interface. Each implementation owns persistence for
5
5
  * a single workspace's sessions and persons. Multi-tenancy is the host's
@@ -18,6 +18,14 @@ export interface StorageAdapter {
18
18
  appendEvents(sessionId: string, events: SessionEvent[]): Promise<void>;
19
19
  /** Materialize a session (events folded into Session shape). */
20
20
  getSession(sessionId: string): Promise<Session | null>;
21
+ /**
22
+ * Raw event log for a session, ordered by `seq`. Unlike `getSession`,
23
+ * this does not fold events — callers get per-event timestamps and the
24
+ * participant / title / end events as recorded. Returns `null` when the
25
+ * session doesn't exist (distinct from an existing session with no
26
+ * events, which returns `[]`).
27
+ */
28
+ getSessionEvents(sessionId: string): Promise<SessionEvent[] | null>;
21
29
  /** List recent sessions. */
22
30
  listSessions(opts: {
23
31
  limit: number;
@@ -52,6 +60,23 @@ export interface StorageAdapter {
52
60
  channel?: string;
53
61
  scope?: "participant" | "viewable";
54
62
  }): Promise<Session[]>;
63
+ /**
64
+ * Upsert a name → person mapping. Names collapse case-insensitively
65
+ * (the row is keyed by `(person_id, lower(name))`).
66
+ *
67
+ * - `increment: true` (default): if the alias already exists, bump
68
+ * `usage_count` by 1 and replace `caller` / `last_used` with the
69
+ * input values.
70
+ * - `increment: false`: if the row already exists, do not touch it.
71
+ *
72
+ * Returns `null` if `personId` does not exist (engram_aliases FKs into
73
+ * engram_persons).
74
+ */
75
+ upsertAlias(personId: string, input: {
76
+ name: string;
77
+ } & AliasUpsert): Promise<AliasInfo | null>;
78
+ /** A person's aliases, ordered newest-used-first. */
79
+ listAliases(personId: string): Promise<AliasInfo[]>;
55
80
  }
56
81
  /**
57
82
  * Pure fold of an event log into the parts a Session needs. Used by adapters