@hexis-ai/engram-sdk 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 } from "./types";
3
+ import type { AliasInfo, AliasUpsert, EventBatch, IdentityInfo, IdentityUpsert, MessageContentBlock, PersonCreate, PersonInfo, PersonMap, PersonUpdate, SessionEvent, SessionInit, SessionUpdate } 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
@@ -111,10 +111,21 @@ export declare class Engram {
111
111
  getSessionEvents(id: string): Promise<{
112
112
  events: SessionEvent[];
113
113
  }>;
114
- /** List recent sessions plus the deduped persons map across them. */
114
+ /**
115
+ * Patch session-level metadata (title / channel / status / summary /
116
+ * model / trigger_*). `undefined` fields are left alone; explicit
117
+ * `null` clears. Returns the materialized session post-update.
118
+ */
119
+ updateSession(id: string, patch: SessionUpdate): Promise<SessionEnvelope>;
120
+ /**
121
+ * List recent sessions plus the deduped persons map across them.
122
+ * Sorted by `updated_at` desc (most recent activity first); pass
123
+ * `status` to filter by lifecycle state.
124
+ */
115
125
  listSessions(opts?: {
116
126
  limit?: number;
117
127
  channel?: string;
128
+ status?: "active" | "idle" | "completed";
118
129
  }): Promise<SessionListEnvelope>;
119
130
  /** Run a search. */
120
131
  search(req: SearchRequest): Promise<SearchEnvelope>;
package/dist/client.js CHANGED
@@ -49,13 +49,27 @@ export class Engram {
49
49
  async getSessionEvents(id) {
50
50
  return this.request("GET", `/v1/sessions/${encodeURIComponent(id)}/events`);
51
51
  }
52
- /** List recent sessions plus the deduped persons map across them. */
52
+ /**
53
+ * Patch session-level metadata (title / channel / status / summary /
54
+ * model / trigger_*). `undefined` fields are left alone; explicit
55
+ * `null` clears. Returns the materialized session post-update.
56
+ */
57
+ async updateSession(id, patch) {
58
+ return this.request("PATCH", `/v1/sessions/${encodeURIComponent(id)}`, patch);
59
+ }
60
+ /**
61
+ * List recent sessions plus the deduped persons map across them.
62
+ * Sorted by `updated_at` desc (most recent activity first); pass
63
+ * `status` to filter by lifecycle state.
64
+ */
53
65
  async listSessions(opts = {}) {
54
66
  const qs = new URLSearchParams();
55
67
  if (opts.limit !== undefined)
56
68
  qs.set("limit", String(opts.limit));
57
69
  if (opts.channel)
58
70
  qs.set("channel", opts.channel);
71
+ if (opts.status)
72
+ qs.set("status", opts.status);
59
73
  const tail = qs.toString();
60
74
  return this.request("GET", `/v1/sessions${tail ? `?${tail}` : ""}`);
61
75
  }
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, MessageContentBlock, MessageEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, } from "./types";
6
+ export type { SessionInit, SessionUpdate, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, MessageContentBlock, MessageEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, } from "./types";
package/dist/types.d.ts CHANGED
@@ -25,6 +25,30 @@ export interface SessionInit {
25
25
  * `participants ⊆ viewable_by`.
26
26
  */
27
27
  viewable_by?: string[];
28
+ /**
29
+ * Lifecycle state. `active` (default) → in progress; `idle` →
30
+ * inactive but resumable; `completed` → terminal. Pass at create time
31
+ * or update later with `updateSession`.
32
+ */
33
+ status?: "active" | "idle" | "completed";
34
+ /** LLM-generated summary of the session's outcome. */
35
+ summary?: string | null;
36
+ /** Model the host used for this session (e.g. `claude-opus-4-7`). */
37
+ model?: string | null;
38
+ /** Causal lineage — the conversation that triggered this one. */
39
+ trigger_conversation_id?: string | null;
40
+ /** Causal lineage — an external event (e.g. calendar event id). */
41
+ trigger_event_id?: string | null;
42
+ }
43
+ /** Patch for `updateSession`. */
44
+ export interface SessionUpdate {
45
+ title?: string | null;
46
+ channel?: string | null;
47
+ status?: "active" | "idle" | "completed";
48
+ summary?: string | null;
49
+ model?: string | null;
50
+ trigger_conversation_id?: string | null;
51
+ trigger_event_id?: string | null;
28
52
  }
29
53
  export interface SessionAck {
30
54
  id: string;
@@ -116,22 +140,41 @@ export interface EventBatch {
116
140
  events: SessionEvent[];
117
141
  }
118
142
  /**
119
- * Minimal representation engram-server returns for any person. Hosts cache
120
- * `display_name` for UI rendering; richer profile attributes (role, team,
121
- * etc.) are intentionally NOT herethose belong to HR / source-of-truth
122
- * systems the host integrates with.
143
+ * The canonical record for one person in a workspace. Now that engram
144
+ * is the host's primary memory store, this carries the organizational
145
+ * facts (role / team / source) too not just the minimal display
146
+ * surface earlier versions exposed. Older fields stay, new fields are
147
+ * additive and optional so existing clients aren't disturbed.
123
148
  */
124
149
  export interface PersonInfo {
125
150
  id: string;
126
151
  display_name: string | null;
152
+ /** Free-form job title, e.g. "engineer", "designer". */
153
+ role?: string | null;
154
+ /** Free-form team name, e.g. "engineering", "design". */
155
+ team?: string | null;
156
+ /**
157
+ * How this row was authored. Mirrors monet's enum:
158
+ * - `user_provided` — entered by a human via the UI.
159
+ * - `auto` — synthesised by identity-resolver from an external
160
+ * identity (slack profile, gcal attendee, …).
161
+ * Server-side defaults to `auto` when omitted.
162
+ */
163
+ source?: string;
127
164
  created_at: string;
128
165
  updated_at: string;
129
166
  }
130
167
  export interface PersonCreate {
131
168
  display_name?: string;
169
+ role?: string | null;
170
+ team?: string | null;
171
+ source?: string;
132
172
  }
133
173
  export interface PersonUpdate {
134
174
  display_name?: string | null;
175
+ role?: string | null;
176
+ team?: string | null;
177
+ source?: string;
135
178
  }
136
179
  /**
137
180
  * One alias (alternate name) for a person, mirrored from monet's
@@ -178,8 +221,16 @@ export interface IdentityInfo {
178
221
  source: string | null;
179
222
  is_primary: boolean | null;
180
223
  picture: string | null;
181
- /** `YYYY-MM-DD`. */
224
+ /** ISO 8601 timestamp (post-migration 0004) or `YYYY-MM-DD` from
225
+ * pre-migration rows. Treat as a parseable date string either way. */
182
226
  linked_at: string;
227
+ /**
228
+ * ISO 8601 timestamp of when the link was revoked. Null while the
229
+ * identity is active; non-null means callers should not treat it as
230
+ * an authoritative source for this person → external mapping.
231
+ * Available only after migration 0004.
232
+ */
233
+ unlinked_at?: string | null;
183
234
  created_at: string;
184
235
  updated_at: string;
185
236
  }
@@ -191,8 +242,14 @@ export interface IdentityUpsert {
191
242
  source?: string | null;
192
243
  is_primary?: boolean | null;
193
244
  picture?: string | null;
194
- /** `YYYY-MM-DD`. */
245
+ /** ISO 8601 timestamp or `YYYY-MM-DD`. */
195
246
  linked_at: string;
247
+ /**
248
+ * Setting non-null marks the identity as revoked. Most upsert calls
249
+ * leave this undefined (no change); pass `null` to explicitly clear
250
+ * a previous revoke.
251
+ */
252
+ unlinked_at?: string | null;
196
253
  }
197
254
  /**
198
255
  * Map of person_id → PersonInfo, deduped across whatever `Session`s the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexis-ai/engram-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.8.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",