@hexis-ai/engram-sdk 0.2.0 → 0.4.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/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ScoredSession, SearchOptions, Session, SessionStep } from "@hexis-ai/engram-core";
2
2
  import { type RefCandidate } from "./extract";
3
- import type { EventBatch, PersonCreate, PersonInfo, PersonMap, PersonUpdate, SessionInit } from "./types";
3
+ import type { AliasInfo, AliasUpsert, EventBatch, PersonCreate, PersonInfo, PersonMap, PersonUpdate, SessionEvent, SessionInit } from "./types";
4
4
  /**
5
5
  * Envelope returned by session endpoints. The persons map is deduped
6
6
  * across whatever sessions the response carries so display info isn't
@@ -102,6 +102,15 @@ export declare class Engram {
102
102
  startSession(init?: SessionInit): Promise<EngramSession>;
103
103
  /** Fetch a single session by id, plus the persons map for its participants/viewers. */
104
104
  getSession(id: string): Promise<SessionEnvelope>;
105
+ /**
106
+ * Fetch the raw, ordered event log for a session. Unlike `getSession`
107
+ * (which folds events into a `Session`), this returns each recorded
108
+ * event with its timestamp — step / participant / title / end — for a
109
+ * timeline view. Throws if the session id is unknown.
110
+ */
111
+ getSessionEvents(id: string): Promise<{
112
+ events: SessionEvent[];
113
+ }>;
105
114
  /** List recent sessions plus the deduped persons map across them. */
106
115
  listSessions(opts?: {
107
116
  limit?: number;
@@ -133,6 +142,15 @@ export declare class Engram {
133
142
  channel?: string;
134
143
  scope?: "participant" | "viewable";
135
144
  }) => Promise<SessionListEnvelope>;
145
+ /**
146
+ * Upsert an alias for this person. Name comparisons are
147
+ * case-insensitive — writing `Yuuri` and `YUURI` hits the same row.
148
+ */
149
+ upsertAlias: (id: string, name: string, input: AliasUpsert) => Promise<AliasInfo>;
150
+ /** This person's aliases, newest-used-first. */
151
+ aliases: (id: string) => Promise<{
152
+ aliases: AliasInfo[];
153
+ }>;
136
154
  };
137
155
  /** Internal: ship an event batch to the server. */
138
156
  sendBatch(sessionId: string, batch: EventBatch): Promise<void>;
package/dist/client.js CHANGED
@@ -40,6 +40,15 @@ export class Engram {
40
40
  async getSession(id) {
41
41
  return this.request("GET", `/v1/sessions/${encodeURIComponent(id)}`);
42
42
  }
43
+ /**
44
+ * Fetch the raw, ordered event log for a session. Unlike `getSession`
45
+ * (which folds events into a `Session`), this returns each recorded
46
+ * event with its timestamp — step / participant / title / end — for a
47
+ * timeline view. Throws if the session id is unknown.
48
+ */
49
+ async getSessionEvents(id) {
50
+ return this.request("GET", `/v1/sessions/${encodeURIComponent(id)}/events`);
51
+ }
43
52
  /** List recent sessions plus the deduped persons map across them. */
44
53
  async listSessions(opts = {}) {
45
54
  const qs = new URLSearchParams();
@@ -88,6 +97,13 @@ export class Engram {
88
97
  const tail = qs.toString();
89
98
  return this.request("GET", `/v1/persons/${encodeURIComponent(id)}/sessions${tail ? `?${tail}` : ""}`);
90
99
  },
100
+ /**
101
+ * Upsert an alias for this person. Name comparisons are
102
+ * case-insensitive — writing `Yuuri` and `YUURI` hits the same row.
103
+ */
104
+ upsertAlias: (id, name, input) => this.request("PUT", `/v1/persons/${encodeURIComponent(id)}/aliases/${encodeURIComponent(name)}`, input),
105
+ /** This person's aliases, newest-used-first. */
106
+ aliases: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}/aliases`),
91
107
  };
92
108
  /** Internal: ship an event batch to the server. */
93
109
  async sendBatch(sessionId, batch) {
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { extractReferences, encodeResourceId, type RefCandidate, type ReferenceS
3
3
  export { parseToolName, type ParsedToolName } from "./tool-name";
4
4
  export { fetchIdToken, cloudRunIdTokenAuth } from "./id-token";
5
5
  export { EngramAdmin, createAdminClient, type AdminClientOptions, type CreateWorkspaceInput, type CreateWorkspaceResult, type Workspace as AdminWorkspace, type ApiKey as AdminApiKey, type IssuedKey as AdminIssuedKey, } from "./admin";
6
- export type { SessionInit, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, } from "./types";
6
+ export type { SessionInit, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, } from "./types";
package/dist/types.d.ts CHANGED
@@ -76,6 +76,35 @@ export interface PersonCreate {
76
76
  export interface PersonUpdate {
77
77
  display_name?: string | null;
78
78
  }
79
+ /**
80
+ * One alias (alternate name) for a person, mirrored from monet's
81
+ * identity-resolution layer. Names are stored case-sensitively for
82
+ * display but compared lowercase, so writing "Yuuri" and "YUURI" hits
83
+ * the same row.
84
+ */
85
+ export interface AliasInfo {
86
+ person_id: string;
87
+ name: string;
88
+ /** Provenance tag — e.g. `slack-resolver`, `manual`, `gcal-attendee`. */
89
+ caller: string;
90
+ usage_count: number;
91
+ /** Calendar date (`YYYY-MM-DD`) of the most recent use. */
92
+ last_used: string;
93
+ created_at: string;
94
+ updated_at: string;
95
+ }
96
+ export interface AliasUpsert {
97
+ caller: string;
98
+ /** `YYYY-MM-DD`. */
99
+ last_used: string;
100
+ /**
101
+ * When the alias already exists, bump `usage_count` by 1 and replace
102
+ * `caller` / `last_used` with the new values. Default true. Pass
103
+ * `false` for idempotent backfills where you want the existing row
104
+ * untouched if it already exists.
105
+ */
106
+ increment?: boolean;
107
+ }
79
108
  /**
80
109
  * Map of person_id → PersonInfo, deduped across whatever `Session`s the
81
110
  * response contains. Returned at the envelope level so list responses
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexis-ai/engram-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Host SDK for engram. Records agent session steps and ships them to an engram server.",
5
5
  "keywords": [
6
6
  "engram",
@@ -41,7 +41,6 @@
41
41
  ],
42
42
  "scripts": {
43
43
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
44
- "prepack": "bun run build",
45
44
  "pack": "bun run build && bun pm pack",
46
45
  "test": "bun test",
47
46
  "type-check": "tsc --noEmit"