@hexis-ai/engram-sdk 0.3.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, SessionEvent, 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
@@ -142,6 +142,15 @@ export declare class Engram {
142
142
  channel?: string;
143
143
  scope?: "participant" | "viewable";
144
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
+ }>;
145
154
  };
146
155
  /** Internal: ship an event batch to the server. */
147
156
  sendBatch(sessionId: string, batch: EventBatch): Promise<void>;
package/dist/client.js CHANGED
@@ -97,6 +97,13 @@ export class Engram {
97
97
  const tail = qs.toString();
98
98
  return this.request("GET", `/v1/persons/${encodeURIComponent(id)}/sessions${tail ? `?${tail}` : ""}`);
99
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`),
100
107
  };
101
108
  /** Internal: ship an event batch to the server. */
102
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.3.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",