@hexis-ai/engram-sdk 0.4.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/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, PersonCreate, PersonInfo, PersonMap, PersonUpdate, SessionEvent, SessionInit } from "./types";
3
+ import type { AliasInfo, AliasUpsert, EventBatch, IdentityInfo, IdentityUpsert, 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
@@ -151,6 +151,20 @@ export declare class Engram {
151
151
  aliases: (id: string) => Promise<{
152
152
  aliases: AliasInfo[];
153
153
  }>;
154
+ /** This person's identities, newest-linked-first. */
155
+ identities: (id: string) => Promise<{
156
+ identities: IdentityInfo[];
157
+ }>;
158
+ };
159
+ /** Identity operations — resolve a global ref (`slack:U…`, `email:…`)
160
+ * to its identity record + person id. */
161
+ readonly identities: {
162
+ /** Upsert by ref. Refs are reassignable — writing with a new
163
+ * `person_id` reroutes the ref. Returns 404 if `person_id` is
164
+ * unknown. */
165
+ upsert: (ref: string, input: IdentityUpsert) => Promise<IdentityInfo>;
166
+ /** Look up by ref. Returns 404 if the ref is unknown. */
167
+ get: (ref: string) => Promise<IdentityInfo>;
154
168
  };
155
169
  /** Internal: ship an event batch to the server. */
156
170
  sendBatch(sessionId: string, batch: EventBatch): Promise<void>;
package/dist/client.js CHANGED
@@ -104,6 +104,18 @@ export class Engram {
104
104
  upsertAlias: (id, name, input) => this.request("PUT", `/v1/persons/${encodeURIComponent(id)}/aliases/${encodeURIComponent(name)}`, input),
105
105
  /** This person's aliases, newest-used-first. */
106
106
  aliases: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}/aliases`),
107
+ /** This person's identities, newest-linked-first. */
108
+ identities: (id) => this.request("GET", `/v1/persons/${encodeURIComponent(id)}/identities`),
109
+ };
110
+ /** Identity operations — resolve a global ref (`slack:U…`, `email:…`)
111
+ * to its identity record + person id. */
112
+ identities = {
113
+ /** Upsert by ref. Refs are reassignable — writing with a new
114
+ * `person_id` reroutes the ref. Returns 404 if `person_id` is
115
+ * unknown. */
116
+ upsert: (ref, input) => this.request("PUT", `/v1/identities/${encodeURIComponent(ref)}`, input),
117
+ /** Look up by ref. Returns 404 if the ref is unknown. */
118
+ get: (ref) => this.request("GET", `/v1/identities/${encodeURIComponent(ref)}`),
107
119
  };
108
120
  /** Internal: ship an event batch to the server. */
109
121
  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, AliasInfo, AliasUpsert, } from "./types";
6
+ export type { SessionInit, SessionAck, SessionEvent, StepEvent, ParticipantEvent, TitleEvent, EndEvent, EventBatch, PersonInfo, PersonCreate, PersonUpdate, PersonMap, AliasInfo, AliasUpsert, IdentityInfo, IdentityUpsert, } from "./types";
package/dist/types.d.ts CHANGED
@@ -105,6 +105,38 @@ export interface AliasUpsert {
105
105
  */
106
106
  increment?: boolean;
107
107
  }
108
+ /**
109
+ * One external identity mapped to an engram person. Hosts (monet) use
110
+ * the same ref convention they always have — `slack:U12345`,
111
+ * `email:foo@bar.com`, `google:1234567890` — so engram can serve as
112
+ * the resolver for any system that already speaks that vocabulary.
113
+ */
114
+ export interface IdentityInfo {
115
+ /** Stable global handle, e.g. `slack:U12345`. */
116
+ ref: string;
117
+ person_id: string;
118
+ service: string;
119
+ external_id: string;
120
+ display_name: string | null;
121
+ source: string | null;
122
+ is_primary: boolean | null;
123
+ picture: string | null;
124
+ /** `YYYY-MM-DD`. */
125
+ linked_at: string;
126
+ created_at: string;
127
+ updated_at: string;
128
+ }
129
+ export interface IdentityUpsert {
130
+ person_id: string;
131
+ service: string;
132
+ external_id: string;
133
+ display_name?: string | null;
134
+ source?: string | null;
135
+ is_primary?: boolean | null;
136
+ picture?: string | null;
137
+ /** `YYYY-MM-DD`. */
138
+ linked_at: string;
139
+ }
108
140
  /**
109
141
  * Map of person_id → PersonInfo, deduped across whatever `Session`s the
110
142
  * 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.4.0",
3
+ "version": "0.5.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",