@hexis-ai/engram-sdk 0.16.0 → 0.17.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 { AliasInfo, AliasUpsert, EventBatch, IdentityInfo, IdentityUpsert, MessageContentBlock, PersonCreate, PersonInfo, PersonMap, PersonUpdate, SessionEvent, SessionInit, SessionUpdate } from "./types";
3
+ import type { AliasInfo, AliasUpsert, EventBatch, IdentityInfo, IdentityUpsert, MessageContentBlock, PersonCreate, PersonInfo, PersonMap, PersonMemory, PersonMemoryCreate, PersonUpdate, SessionEvent, SessionInit, SessionUpdate } from "./types";
4
4
  import { type TelemetryAlias, type TelemetryEvent, type TelemetryIdentity, type TelemetryMessage, type TelemetryPerson, type TelemetrySession } from "./buffered";
5
5
  /**
6
6
  * Envelope returned by session endpoints. The persons map is deduped
@@ -205,6 +205,12 @@ export declare class Engram {
205
205
  upsert: (id: string, input: PersonCreate) => Promise<PersonInfo>;
206
206
  /** Patch profile fields. Returns 404 if id is unknown. */
207
207
  update: (id: string, patch: PersonUpdate) => Promise<PersonInfo>;
208
+ /**
209
+ * Hard-delete a person; cascades to aliases / identities / memories.
210
+ * Throws on 404 when the id is unknown — callers that want
211
+ * idempotent semantics should catch and ignore.
212
+ */
213
+ delete: (id: string) => Promise<void>;
208
214
  get: (id: string) => Promise<PersonInfo>;
209
215
  /** Free-text search (substring across id + display_name). */
210
216
  list: (opts?: {
@@ -224,6 +230,12 @@ export declare class Engram {
224
230
  * case-insensitive — writing `Yuuri` and `YUURI` hits the same row.
225
231
  */
226
232
  upsertAlias: (id: string, name: string, input: AliasUpsert) => Promise<AliasInfo>;
233
+ /**
234
+ * Remove an alias by (person, name). Name match is
235
+ * case-insensitive, mirroring the upsert key. 404s when the alias
236
+ * isn't there — catch and ignore for idempotent cleanup.
237
+ */
238
+ removeAlias: (id: string, name: string) => Promise<void>;
227
239
  /** This person's aliases, newest-used-first. */
228
240
  aliases: (id: string) => Promise<{
229
241
  aliases: AliasInfo[];
@@ -232,6 +244,31 @@ export declare class Engram {
232
244
  identities: (id: string) => Promise<{
233
245
  identities: IdentityInfo[];
234
246
  }>;
247
+ /**
248
+ * Per-person memory surface — the ChatGPT/Claude-style "things to
249
+ * remember about this person". Reads are hot path (the host agent
250
+ * pulls every participant's memories on each turn) so the server
251
+ * keeps `(workspace, person, created_at DESC)` indexed; writes are
252
+ * ack'd synchronously, unlike the fire-and-forget telemetry calls.
253
+ */
254
+ memories: {
255
+ /** Newest-first; honours `?limit=` server-side. */
256
+ list: (id: string, opts?: {
257
+ limit?: number;
258
+ }) => Promise<{
259
+ memories: PersonMemory[];
260
+ }>;
261
+ /**
262
+ * Append a memory. Returns the stored row (with allocated `id`)
263
+ * so callers that want to immediately echo "saved: <content>"
264
+ * back to the user don't have to re-fetch. Throws on 404 when
265
+ * the person doesn't exist.
266
+ */
267
+ add: (id: string, input: PersonMemoryCreate) => Promise<PersonMemory>;
268
+ /** Remove by memory id. Idempotent — second call 404s, callers
269
+ * can choose to ignore. */
270
+ remove: (id: string, memoryId: string) => Promise<void>;
271
+ };
235
272
  };
236
273
  /** Identity operations — resolve a global ref (`slack:U…`, `email:…`)
237
274
  * to its identity record + person id. */
package/dist/client.js CHANGED
@@ -191,6 +191,12 @@ export class Engram {
191
191
  upsert: (id, input) => this.request("PUT", `/v1/persons/${encodeURIComponent(id)}`, input),
192
192
  /** Patch profile fields. Returns 404 if id is unknown. */
193
193
  update: (id, patch) => this.request("PATCH", `/v1/persons/${encodeURIComponent(id)}`, patch),
194
+ /**
195
+ * Hard-delete a person; cascades to aliases / identities / memories.
196
+ * Throws on 404 when the id is unknown — callers that want
197
+ * idempotent semantics should catch and ignore.
198
+ */
199
+ delete: (id) => this.request("DELETE", `/v1/persons/${encodeURIComponent(id)}`),
194
200
  get: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}`),
195
201
  /** Free-text search (substring across id + display_name). */
196
202
  list: (opts = {}) => {
@@ -219,10 +225,43 @@ export class Engram {
219
225
  * case-insensitive — writing `Yuuri` and `YUURI` hits the same row.
220
226
  */
221
227
  upsertAlias: (id, name, input) => this.request("PUT", `/v1/persons/${encodeURIComponent(id)}/aliases/${encodeURIComponent(name)}`, input),
228
+ /**
229
+ * Remove an alias by (person, name). Name match is
230
+ * case-insensitive, mirroring the upsert key. 404s when the alias
231
+ * isn't there — catch and ignore for idempotent cleanup.
232
+ */
233
+ removeAlias: (id, name) => this.request("DELETE", `/v1/persons/${encodeURIComponent(id)}/aliases/${encodeURIComponent(name)}`),
222
234
  /** This person's aliases, newest-used-first. */
223
235
  aliases: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}/aliases`),
224
236
  /** This person's identities, newest-linked-first. */
225
237
  identities: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}/identities`),
238
+ /**
239
+ * Per-person memory surface — the ChatGPT/Claude-style "things to
240
+ * remember about this person". Reads are hot path (the host agent
241
+ * pulls every participant's memories on each turn) so the server
242
+ * keeps `(workspace, person, created_at DESC)` indexed; writes are
243
+ * ack'd synchronously, unlike the fire-and-forget telemetry calls.
244
+ */
245
+ memories: {
246
+ /** Newest-first; honours `?limit=` server-side. */
247
+ list: (id, opts = {}) => {
248
+ const qs = new URLSearchParams();
249
+ if (opts.limit !== undefined)
250
+ qs.set("limit", String(opts.limit));
251
+ const tail = qs.toString();
252
+ return this.request("GET", `/v1/persons/${encodeURIComponent(id)}/memories${tail ? `?${tail}` : ""}`);
253
+ },
254
+ /**
255
+ * Append a memory. Returns the stored row (with allocated `id`)
256
+ * so callers that want to immediately echo "saved: <content>"
257
+ * back to the user don't have to re-fetch. Throws on 404 when
258
+ * the person doesn't exist.
259
+ */
260
+ add: (id, input) => this.request("POST", `/v1/persons/${encodeURIComponent(id)}/memories`, input),
261
+ /** Remove by memory id. Idempotent — second call 404s, callers
262
+ * can choose to ignore. */
263
+ remove: (id, memoryId) => this.request("DELETE", `/v1/persons/${encodeURIComponent(id)}/memories/${encodeURIComponent(memoryId)}`),
264
+ },
226
265
  };
227
266
  /** Identity operations — resolve a global ref (`slack:U…`, `email:…`)
228
267
  * to its identity record + person id. */
package/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export { parseToolName, type ParsedToolName } from "./tool-name";
4
4
  export { BufferedTelemetry, type TelemetrySession, type TelemetryMessage, type TelemetryEvent, type TelemetryPerson, type TelemetryIdentity, type TelemetryAlias, } from "./buffered";
5
5
  export { fetchIdToken, cloudRunIdTokenAuth } from "./id-token";
6
6
  export { EngramAdmin, createAdminClient, type AdminClientOptions, type CreateWorkspaceInput, type CreateWorkspaceResult, type Workspace as AdminWorkspace, type ApiKey as AdminApiKey, type IssuedKey as AdminIssuedKey, type Org, type OrgMembership, type CreateOrgInput, type UpsertMemberInput, type OrgWorkspace, } from "./admin";
7
- export type { SessionInit, SessionUpdate, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, MessageContentBlock, MessageEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, } from "./types";
7
+ export type { SessionInit, SessionUpdate, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, MessageContentBlock, MessageEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, PersonMemory, PersonMemoryCreate, } from "./types";
package/dist/types.d.ts CHANGED
@@ -264,6 +264,37 @@ export interface IdentityUpsert {
264
264
  */
265
265
  unlinked_at?: string | null;
266
266
  }
267
+ /**
268
+ * One free-form fact about a person — the building block of the
269
+ * ChatGPT/Claude-style "memory" surface. The host agent loads a
270
+ * person's recent memories into context at conversation start and
271
+ * appends new ones (via `save_person_memory`) as it learns. Content
272
+ * is intentionally unstructured: representing a fact like "prefers
273
+ * morning meetings" as plain text keeps the surface symmetric with
274
+ * how an LLM thinks about a person.
275
+ */
276
+ export interface PersonMemory {
277
+ id: string;
278
+ person_id: string;
279
+ content: string;
280
+ /**
281
+ * Where the memory came from:
282
+ * - `agent` — saved by the LLM via the host's save tool.
283
+ * - `manual` — entered by a human via the engram-web UI.
284
+ * - `auto` — derived by a downstream pipeline.
285
+ * Server-side defaults to `agent` when omitted.
286
+ */
287
+ source: string;
288
+ /** Session the memory was extracted from, when the writer knew one. */
289
+ source_session_id: string | null;
290
+ created_at: string;
291
+ updated_at: string;
292
+ }
293
+ export interface PersonMemoryCreate {
294
+ content: string;
295
+ source?: string;
296
+ source_session_id?: string | null;
297
+ }
267
298
  /**
268
299
  * Map of person_id → PersonInfo, deduped across whatever `Session`s the
269
300
  * 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.16.0",
3
+ "version": "0.17.0",
4
4
  "author": "hexis ltd.",
5
5
  "repository": {
6
6
  "type": "git",