@usewhisper/sdk 3.10.1 → 3.11.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.
@@ -1082,6 +1082,27 @@ interface RunContext {
1082
1082
  sessionId?: string;
1083
1083
  traceId?: string;
1084
1084
  }
1085
+ interface RememberParams {
1086
+ messages: Array<{
1087
+ role: string;
1088
+ content: string;
1089
+ timestamp?: string;
1090
+ }>;
1091
+ userId?: string;
1092
+ sessionId?: string;
1093
+ project?: string;
1094
+ }
1095
+ interface IngestParams {
1096
+ url: string;
1097
+ name?: string;
1098
+ token?: string;
1099
+ project?: string;
1100
+ }
1101
+ type QueryInput = Omit<QueryParams, "query"> & {
1102
+ query?: string;
1103
+ q?: string;
1104
+ userId?: string;
1105
+ };
1085
1106
  declare class WhisperClient {
1086
1107
  private readonly config;
1087
1108
  readonly diagnostics: {
@@ -1169,7 +1190,14 @@ declare class WhisperClient {
1169
1190
  project?: string;
1170
1191
  requireIdentity?: boolean;
1171
1192
  }): Promise<WhisperPreflightResult>;
1172
- query(params: QueryParams): Promise<QueryResult>;
1193
+ query(params: QueryInput): Promise<QueryResult>;
1194
+ remember(params: RememberParams): Promise<LearnResult>;
1195
+ ingest(params: IngestParams): Promise<LearnResult>;
1196
+ userProfile(userId: string): Promise<{
1197
+ user_id: string;
1198
+ memories: unknown[];
1199
+ count: number;
1200
+ }>;
1173
1201
  ingestSession(params: {
1174
1202
  project?: string;
1175
1203
  session_id: string;
@@ -2431,4 +2459,4 @@ declare class WhisperContext {
2431
2459
  };
2432
2460
  }
2433
2461
 
2434
- export { type WhisperEnvironment as $, type AgentRunContext as A, type MemoryKind as B, type CanonicalSourceCreateParams as C, type MemoryLatencyBreakdown as D, type ExtractedMemory as E, type MemorySearchResponse as F, type MemoryWriteAck as G, type MemoryWriteResult as H, type Project as I, type QueryResult as J, type TurnInput as K, LangChainMemoryAdapter as L, type MemoryRouterConfig as M, type VideoSourceMetadata as N, Whisper as O, type PreparedTurn as P, type QueryParams as Q, type RunContext as R, type Source as S, type TurnCaptureResult as T, WhisperAgentMiddleware as U, type VideoIngestionStatus as V, type WhisperToolDefinition as W, type WithWhisperOptions, WhisperClient as X, type WhisperClientConfig as Y, type WhisperConfig as Z, WhisperContext as _, type WhisperToolsOptions as a, WhisperError as a0, type WhisperErrorCode as a1, type WhisperIdentityMode as a2, type WhisperPreflightCheck as a3, type WhisperPreflightResult as a4, type WhisperResolvedIdentity as a5, type WorkEvent as a6, type WorkEventKind as a7, type WorkEventSalience as a8, createAgentMiddleware as a9, createLangChainMemoryAdapter as aa, createLangGraphCheckpointAdapter as ab, memoryGraphToMermaid as ac, type MemoryRouterFallbackReason as b, type MemoryRouterResult as c, type MemoryRouterTrace as d, WhisperMemoryRouter as e, createMemoryRouter as f, type AgentRuntimeOptions as g, type AgentRuntimeRankWeights as h, type AgentRuntimeRetrievalOptions as i, type AgentRuntimeSourceActivityOptions as j, type AgentRuntimeStatus as k, type CanonicalSourceCreateResult as l, type CanonicalSourceType as m, LangGraphCheckpointAdapter as n, type LearnConversationInput as o, type LearnConversationResult as p, type LearnInput as q, type LearnResult as r, type LearnSourceInput as s, type LearnSourceResult as t, type LearnSourceType as u, type LearnTextInput as v, whisperTools as w, withWhisper, type LearnTextResult as x, type Memory as y, type MemoryExtractionResult as z };
2462
+ export { type WhisperClientConfig as $, type AgentRunContext as A, type MemoryKind as B, type CanonicalSourceCreateParams as C, type MemoryLatencyBreakdown as D, type ExtractedMemory as E, type MemorySearchResponse as F, type MemoryWriteAck as G, type MemoryWriteResult as H, type IngestParams as I, type Project as J, type QueryParams as K, LangChainMemoryAdapter as L, type MemoryRouterConfig as M, type QueryResult as N, type RunContext as O, type PreparedTurn as P, type QueryInput as Q, type RememberParams as R, type Source as S, type TurnCaptureResult as T, type TurnInput as U, type VideoIngestionStatus as V, type WhisperToolDefinition as W, type WithWhisperOptions, type VideoSourceMetadata as X, Whisper as Y, WhisperAgentMiddleware as Z, WhisperClient as _, type WhisperToolsOptions as a, type WhisperConfig as a0, WhisperContext as a1, type WhisperEnvironment as a2, WhisperError as a3, type WhisperErrorCode as a4, type WhisperIdentityMode as a5, type WhisperPreflightCheck as a6, type WhisperPreflightResult as a7, type WhisperResolvedIdentity as a8, type WorkEvent as a9, type WorkEventKind as aa, type WorkEventSalience as ab, createAgentMiddleware as ac, createLangChainMemoryAdapter as ad, createLangGraphCheckpointAdapter as ae, memoryGraphToMermaid as af, type MemoryRouterFallbackReason as b, type MemoryRouterResult as c, type MemoryRouterTrace as d, WhisperMemoryRouter as e, createMemoryRouter as f, type AgentRuntimeOptions as g, type AgentRuntimeRankWeights as h, type AgentRuntimeRetrievalOptions as i, type AgentRuntimeSourceActivityOptions as j, type AgentRuntimeStatus as k, type CanonicalSourceCreateResult as l, type CanonicalSourceType as m, LangGraphCheckpointAdapter as n, type LearnConversationInput as o, type LearnConversationResult as p, type LearnInput as q, type LearnResult as r, type LearnSourceInput as s, type LearnSourceResult as t, type LearnSourceType as u, type LearnTextInput as v, whisperTools as w, withWhisper, type LearnTextResult as x, type Memory as y, type MemoryExtractionResult as z };
@@ -1082,6 +1082,27 @@ interface RunContext {
1082
1082
  sessionId?: string;
1083
1083
  traceId?: string;
1084
1084
  }
1085
+ interface RememberParams {
1086
+ messages: Array<{
1087
+ role: string;
1088
+ content: string;
1089
+ timestamp?: string;
1090
+ }>;
1091
+ userId?: string;
1092
+ sessionId?: string;
1093
+ project?: string;
1094
+ }
1095
+ interface IngestParams {
1096
+ url: string;
1097
+ name?: string;
1098
+ token?: string;
1099
+ project?: string;
1100
+ }
1101
+ type QueryInput = Omit<QueryParams, "query"> & {
1102
+ query?: string;
1103
+ q?: string;
1104
+ userId?: string;
1105
+ };
1085
1106
  declare class WhisperClient {
1086
1107
  private readonly config;
1087
1108
  readonly diagnostics: {
@@ -1169,7 +1190,14 @@ declare class WhisperClient {
1169
1190
  project?: string;
1170
1191
  requireIdentity?: boolean;
1171
1192
  }): Promise<WhisperPreflightResult>;
1172
- query(params: QueryParams): Promise<QueryResult>;
1193
+ query(params: QueryInput): Promise<QueryResult>;
1194
+ remember(params: RememberParams): Promise<LearnResult>;
1195
+ ingest(params: IngestParams): Promise<LearnResult>;
1196
+ userProfile(userId: string): Promise<{
1197
+ user_id: string;
1198
+ memories: unknown[];
1199
+ count: number;
1200
+ }>;
1173
1201
  ingestSession(params: {
1174
1202
  project?: string;
1175
1203
  session_id: string;
@@ -2431,4 +2459,4 @@ declare class WhisperContext {
2431
2459
  };
2432
2460
  }
2433
2461
 
2434
- export { type WhisperEnvironment as $, type AgentRunContext as A, type MemoryKind as B, type CanonicalSourceCreateParams as C, type MemoryLatencyBreakdown as D, type ExtractedMemory as E, type MemorySearchResponse as F, type MemoryWriteAck as G, type MemoryWriteResult as H, type Project as I, type QueryResult as J, type TurnInput as K, LangChainMemoryAdapter as L, type MemoryRouterConfig as M, type VideoSourceMetadata as N, Whisper as O, type PreparedTurn as P, type QueryParams as Q, type RunContext as R, type Source as S, type TurnCaptureResult as T, WhisperAgentMiddleware as U, type VideoIngestionStatus as V, type WhisperToolDefinition as W, type WithWhisperOptions, WhisperClient as X, type WhisperClientConfig as Y, type WhisperConfig as Z, WhisperContext as _, type WhisperToolsOptions as a, WhisperError as a0, type WhisperErrorCode as a1, type WhisperIdentityMode as a2, type WhisperPreflightCheck as a3, type WhisperPreflightResult as a4, type WhisperResolvedIdentity as a5, type WorkEvent as a6, type WorkEventKind as a7, type WorkEventSalience as a8, createAgentMiddleware as a9, createLangChainMemoryAdapter as aa, createLangGraphCheckpointAdapter as ab, memoryGraphToMermaid as ac, type MemoryRouterFallbackReason as b, type MemoryRouterResult as c, type MemoryRouterTrace as d, WhisperMemoryRouter as e, createMemoryRouter as f, type AgentRuntimeOptions as g, type AgentRuntimeRankWeights as h, type AgentRuntimeRetrievalOptions as i, type AgentRuntimeSourceActivityOptions as j, type AgentRuntimeStatus as k, type CanonicalSourceCreateResult as l, type CanonicalSourceType as m, LangGraphCheckpointAdapter as n, type LearnConversationInput as o, type LearnConversationResult as p, type LearnInput as q, type LearnResult as r, type LearnSourceInput as s, type LearnSourceResult as t, type LearnSourceType as u, type LearnTextInput as v, whisperTools as w, withWhisper, type LearnTextResult as x, type Memory as y, type MemoryExtractionResult as z };
2462
+ export { type WhisperClientConfig as $, type AgentRunContext as A, type MemoryKind as B, type CanonicalSourceCreateParams as C, type MemoryLatencyBreakdown as D, type ExtractedMemory as E, type MemorySearchResponse as F, type MemoryWriteAck as G, type MemoryWriteResult as H, type IngestParams as I, type Project as J, type QueryParams as K, LangChainMemoryAdapter as L, type MemoryRouterConfig as M, type QueryResult as N, type RunContext as O, type PreparedTurn as P, type QueryInput as Q, type RememberParams as R, type Source as S, type TurnCaptureResult as T, type TurnInput as U, type VideoIngestionStatus as V, type WhisperToolDefinition as W, type WithWhisperOptions, type VideoSourceMetadata as X, Whisper as Y, WhisperAgentMiddleware as Z, WhisperClient as _, type WhisperToolsOptions as a, type WhisperConfig as a0, WhisperContext as a1, type WhisperEnvironment as a2, WhisperError as a3, type WhisperErrorCode as a4, type WhisperIdentityMode as a5, type WhisperPreflightCheck as a6, type WhisperPreflightResult as a7, type WhisperResolvedIdentity as a8, type WorkEvent as a9, type WorkEventKind as aa, type WorkEventSalience as ab, createAgentMiddleware as ac, createLangChainMemoryAdapter as ad, createLangGraphCheckpointAdapter as ae, memoryGraphToMermaid as af, type MemoryRouterFallbackReason as b, type MemoryRouterResult as c, type MemoryRouterTrace as d, WhisperMemoryRouter as e, createMemoryRouter as f, type AgentRuntimeOptions as g, type AgentRuntimeRankWeights as h, type AgentRuntimeRetrievalOptions as i, type AgentRuntimeSourceActivityOptions as j, type AgentRuntimeStatus as k, type CanonicalSourceCreateResult as l, type CanonicalSourceType as m, LangGraphCheckpointAdapter as n, type LearnConversationInput as o, type LearnConversationResult as p, type LearnInput as q, type LearnResult as r, type LearnSourceInput as s, type LearnSourceResult as t, type LearnSourceType as u, type LearnTextInput as v, whisperTools as w, withWhisper, type LearnTextResult as x, type Memory as y, type MemoryExtractionResult as z };
@@ -2272,6 +2272,16 @@ function classifyRuntimeErrorCode(error) {
2272
2272
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
2273
2273
  return "REQUEST_FAILED";
2274
2274
  }
2275
+ function detectSourceType(url) {
2276
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
2277
+ if (ghMatch) {
2278
+ const [, owner, repo] = ghMatch;
2279
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
2280
+ }
2281
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
2282
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
2283
+ return { type: "web" };
2284
+ }
2275
2285
  var WhisperClient = class _WhisperClient {
2276
2286
  constructor(config) {
2277
2287
  this.config = config;
@@ -2798,7 +2808,14 @@ var WhisperClient = class _WhisperClient {
2798
2808
  }
2799
2809
  async query(params) {
2800
2810
  return this.runOrThrow(async () => {
2801
- const identityParams = await this.withIdentity(params);
2811
+ const { q, userId, ...rest } = params;
2812
+ const normalized = {
2813
+ ...rest,
2814
+ query: rest.query ?? q ?? "",
2815
+ user_id: rest.user_id ?? userId,
2816
+ include_memories: rest.include_memories ?? true
2817
+ };
2818
+ const identityParams = await this.withIdentity(normalized);
2802
2819
  const project = (await this.resolveProject(identityParams.project)).id;
2803
2820
  const response = await this.runtimeClient.request({
2804
2821
  endpoint: "/v1/context/query",
@@ -2813,6 +2830,40 @@ var WhisperClient = class _WhisperClient {
2813
2830
  return response.data;
2814
2831
  });
2815
2832
  }
2833
+ async remember(params) {
2834
+ if (!params.userId && !this.getIdentity) {
2835
+ throw new WhisperError({
2836
+ code: "AUTH_IDENTITY_REQUIRED",
2837
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
2838
+ retryable: false,
2839
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
2840
+ });
2841
+ }
2842
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
2843
+ return this.learn({
2844
+ mode: "conversation",
2845
+ project: params.project,
2846
+ user_id: params.userId,
2847
+ session_id: sessionId,
2848
+ messages: params.messages
2849
+ });
2850
+ }
2851
+ async ingest(params) {
2852
+ const detected = detectSourceType(params.url);
2853
+ return this.learn({
2854
+ mode: "source",
2855
+ project: params.project,
2856
+ type: detected.type,
2857
+ url: params.url,
2858
+ name: params.name,
2859
+ token: params.token,
2860
+ ...detected.owner ? { owner: detected.owner } : {},
2861
+ ...detected.repo ? { repo: detected.repo } : {}
2862
+ });
2863
+ }
2864
+ async userProfile(userId) {
2865
+ return this.memory.getUserProfile({ user_id: userId });
2866
+ }
2816
2867
  async ingestSession(params) {
2817
2868
  return this.runOrThrow(async () => {
2818
2869
  const identityParams = await this.withIdentity(params);
@@ -2236,6 +2236,16 @@ function classifyRuntimeErrorCode(error) {
2236
2236
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
2237
2237
  return "REQUEST_FAILED";
2238
2238
  }
2239
+ function detectSourceType(url) {
2240
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
2241
+ if (ghMatch) {
2242
+ const [, owner, repo] = ghMatch;
2243
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
2244
+ }
2245
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
2246
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
2247
+ return { type: "web" };
2248
+ }
2239
2249
  var WhisperClient = class _WhisperClient {
2240
2250
  constructor(config) {
2241
2251
  this.config = config;
@@ -2762,7 +2772,14 @@ var WhisperClient = class _WhisperClient {
2762
2772
  }
2763
2773
  async query(params) {
2764
2774
  return this.runOrThrow(async () => {
2765
- const identityParams = await this.withIdentity(params);
2775
+ const { q, userId, ...rest } = params;
2776
+ const normalized = {
2777
+ ...rest,
2778
+ query: rest.query ?? q ?? "",
2779
+ user_id: rest.user_id ?? userId,
2780
+ include_memories: rest.include_memories ?? true
2781
+ };
2782
+ const identityParams = await this.withIdentity(normalized);
2766
2783
  const project = (await this.resolveProject(identityParams.project)).id;
2767
2784
  const response = await this.runtimeClient.request({
2768
2785
  endpoint: "/v1/context/query",
@@ -2777,6 +2794,40 @@ var WhisperClient = class _WhisperClient {
2777
2794
  return response.data;
2778
2795
  });
2779
2796
  }
2797
+ async remember(params) {
2798
+ if (!params.userId && !this.getIdentity) {
2799
+ throw new WhisperError({
2800
+ code: "AUTH_IDENTITY_REQUIRED",
2801
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
2802
+ retryable: false,
2803
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
2804
+ });
2805
+ }
2806
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
2807
+ return this.learn({
2808
+ mode: "conversation",
2809
+ project: params.project,
2810
+ user_id: params.userId,
2811
+ session_id: sessionId,
2812
+ messages: params.messages
2813
+ });
2814
+ }
2815
+ async ingest(params) {
2816
+ const detected = detectSourceType(params.url);
2817
+ return this.learn({
2818
+ mode: "source",
2819
+ project: params.project,
2820
+ type: detected.type,
2821
+ url: params.url,
2822
+ name: params.name,
2823
+ token: params.token,
2824
+ ...detected.owner ? { owner: detected.owner } : {},
2825
+ ...detected.repo ? { repo: detected.repo } : {}
2826
+ });
2827
+ }
2828
+ async userProfile(userId) {
2829
+ return this.memory.getUserProfile({ user_id: userId });
2830
+ }
2780
2831
  async ingestSession(params) {
2781
2832
  return this.runOrThrow(async () => {
2782
2833
  const identityParams = await this.withIdentity(params);
package/adapters/tools.js CHANGED
@@ -6313,6 +6313,16 @@ function classifyRuntimeErrorCode(error) {
6313
6313
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
6314
6314
  return "REQUEST_FAILED";
6315
6315
  }
6316
+ function detectSourceType(url) {
6317
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
6318
+ if (ghMatch) {
6319
+ const [, owner, repo] = ghMatch;
6320
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
6321
+ }
6322
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
6323
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
6324
+ return { type: "web" };
6325
+ }
6316
6326
  var WhisperClient = class _WhisperClient {
6317
6327
  constructor(config) {
6318
6328
  this.config = config;
@@ -6839,7 +6849,14 @@ var WhisperClient = class _WhisperClient {
6839
6849
  }
6840
6850
  async query(params) {
6841
6851
  return this.runOrThrow(async () => {
6842
- const identityParams = await this.withIdentity(params);
6852
+ const { q, userId, ...rest } = params;
6853
+ const normalized = {
6854
+ ...rest,
6855
+ query: rest.query ?? q ?? "",
6856
+ user_id: rest.user_id ?? userId,
6857
+ include_memories: rest.include_memories ?? true
6858
+ };
6859
+ const identityParams = await this.withIdentity(normalized);
6843
6860
  const project = (await this.resolveProject(identityParams.project)).id;
6844
6861
  const response = await this.runtimeClient.request({
6845
6862
  endpoint: "/v1/context/query",
@@ -6854,6 +6871,40 @@ var WhisperClient = class _WhisperClient {
6854
6871
  return response.data;
6855
6872
  });
6856
6873
  }
6874
+ async remember(params) {
6875
+ if (!params.userId && !this.getIdentity) {
6876
+ throw new WhisperError({
6877
+ code: "AUTH_IDENTITY_REQUIRED",
6878
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
6879
+ retryable: false,
6880
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
6881
+ });
6882
+ }
6883
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
6884
+ return this.learn({
6885
+ mode: "conversation",
6886
+ project: params.project,
6887
+ user_id: params.userId,
6888
+ session_id: sessionId,
6889
+ messages: params.messages
6890
+ });
6891
+ }
6892
+ async ingest(params) {
6893
+ const detected = detectSourceType(params.url);
6894
+ return this.learn({
6895
+ mode: "source",
6896
+ project: params.project,
6897
+ type: detected.type,
6898
+ url: params.url,
6899
+ name: params.name,
6900
+ token: params.token,
6901
+ ...detected.owner ? { owner: detected.owner } : {},
6902
+ ...detected.repo ? { repo: detected.repo } : {}
6903
+ });
6904
+ }
6905
+ async userProfile(userId) {
6906
+ return this.memory.getUserProfile({ user_id: userId });
6907
+ }
6857
6908
  async ingestSession(params) {
6858
6909
  return this.runOrThrow(async () => {
6859
6910
  const identityParams = await this.withIdentity(params);
@@ -6283,6 +6283,16 @@ function classifyRuntimeErrorCode(error) {
6283
6283
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
6284
6284
  return "REQUEST_FAILED";
6285
6285
  }
6286
+ function detectSourceType(url) {
6287
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
6288
+ if (ghMatch) {
6289
+ const [, owner, repo] = ghMatch;
6290
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
6291
+ }
6292
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
6293
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
6294
+ return { type: "web" };
6295
+ }
6286
6296
  var WhisperClient = class _WhisperClient {
6287
6297
  constructor(config) {
6288
6298
  this.config = config;
@@ -6809,7 +6819,14 @@ var WhisperClient = class _WhisperClient {
6809
6819
  }
6810
6820
  async query(params) {
6811
6821
  return this.runOrThrow(async () => {
6812
- const identityParams = await this.withIdentity(params);
6822
+ const { q, userId, ...rest } = params;
6823
+ const normalized = {
6824
+ ...rest,
6825
+ query: rest.query ?? q ?? "",
6826
+ user_id: rest.user_id ?? userId,
6827
+ include_memories: rest.include_memories ?? true
6828
+ };
6829
+ const identityParams = await this.withIdentity(normalized);
6813
6830
  const project = (await this.resolveProject(identityParams.project)).id;
6814
6831
  const response = await this.runtimeClient.request({
6815
6832
  endpoint: "/v1/context/query",
@@ -6824,6 +6841,40 @@ var WhisperClient = class _WhisperClient {
6824
6841
  return response.data;
6825
6842
  });
6826
6843
  }
6844
+ async remember(params) {
6845
+ if (!params.userId && !this.getIdentity) {
6846
+ throw new WhisperError({
6847
+ code: "AUTH_IDENTITY_REQUIRED",
6848
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
6849
+ retryable: false,
6850
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
6851
+ });
6852
+ }
6853
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
6854
+ return this.learn({
6855
+ mode: "conversation",
6856
+ project: params.project,
6857
+ user_id: params.userId,
6858
+ session_id: sessionId,
6859
+ messages: params.messages
6860
+ });
6861
+ }
6862
+ async ingest(params) {
6863
+ const detected = detectSourceType(params.url);
6864
+ return this.learn({
6865
+ mode: "source",
6866
+ project: params.project,
6867
+ type: detected.type,
6868
+ url: params.url,
6869
+ name: params.name,
6870
+ token: params.token,
6871
+ ...detected.owner ? { owner: detected.owner } : {},
6872
+ ...detected.repo ? { repo: detected.repo } : {}
6873
+ });
6874
+ }
6875
+ async userProfile(userId) {
6876
+ return this.memory.getUserProfile({ user_id: userId });
6877
+ }
6827
6878
  async ingestSession(params) {
6828
6879
  return this.runOrThrow(async () => {
6829
6880
  const identityParams = await this.withIdentity(params);
package/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AgentRunContext, g as AgentRuntimeOptions, h as AgentRuntimeRankWeights, i as AgentRuntimeRetrievalOptions, j as AgentRuntimeSourceActivityOptions, k as AgentRuntimeStatus, C as CanonicalSourceCreateParams, l as CanonicalSourceCreateResult, m as CanonicalSourceType, E as ExtractedMemory, L as LangChainMemoryAdapter, n as LangGraphCheckpointAdapter, o as LearnConversationInput, p as LearnConversationResult, q as LearnInput, r as LearnResult, s as LearnSourceInput, t as LearnSourceResult, u as LearnSourceType, v as LearnTextInput, x as LearnTextResult, y as Memory, z as MemoryExtractionResult, B as MemoryKind, D as MemoryLatencyBreakdown, M as MemoryRouterConfig, b as MemoryRouterFallbackReason, c as MemoryRouterResult, d as MemoryRouterTrace, F as MemorySearchResponse, G as MemoryWriteAck, H as MemoryWriteResult, P as PreparedTurn, I as Project, Q as QueryParams, J as QueryResult, R as RunContext, S as Source, T as TurnCaptureResult, K as TurnInput, V as VideoIngestionStatus, N as VideoSourceMetadata, O as Whisper, U as WhisperAgentMiddleware, X as WhisperClient, Y as WhisperClientConfig, Z as WhisperConfig, _ as WhisperContext, O as WhisperDefault, $ as WhisperEnvironment, a0 as WhisperError, a1 as WhisperErrorCode, a2 as WhisperIdentityMode, e as WhisperMemoryRouter, a3 as WhisperPreflightCheck, a4 as WhisperPreflightResult, a5 as WhisperResolvedIdentity, X as WhisperRuntimeClient, W as WhisperToolDefinition, a as WhisperToolsOptions, WithWhisperOptions, a6 as WorkEvent, a7 as WorkEventKind, a8 as WorkEventSalience, a9 as createAgentMiddleware, aa as createLangChainMemoryAdapter, ab as createLangGraphCheckpointAdapter, f as createMemoryRouter, _ as default, ac as memoryGraphToMermaid, w as whisperTools, withWhisper } from './adapters/ai-sdk.mjs';
1
+ export { A as AgentRunContext, g as AgentRuntimeOptions, h as AgentRuntimeRankWeights, i as AgentRuntimeRetrievalOptions, j as AgentRuntimeSourceActivityOptions, k as AgentRuntimeStatus, C as CanonicalSourceCreateParams, l as CanonicalSourceCreateResult, m as CanonicalSourceType, E as ExtractedMemory, I as IngestParams, L as LangChainMemoryAdapter, n as LangGraphCheckpointAdapter, o as LearnConversationInput, p as LearnConversationResult, q as LearnInput, r as LearnResult, s as LearnSourceInput, t as LearnSourceResult, u as LearnSourceType, v as LearnTextInput, x as LearnTextResult, y as Memory, z as MemoryExtractionResult, B as MemoryKind, D as MemoryLatencyBreakdown, M as MemoryRouterConfig, b as MemoryRouterFallbackReason, c as MemoryRouterResult, d as MemoryRouterTrace, F as MemorySearchResponse, G as MemoryWriteAck, H as MemoryWriteResult, P as PreparedTurn, J as Project, Q as QueryInput, K as QueryParams, N as QueryResult, R as RememberParams, O as RunContext, S as Source, T as TurnCaptureResult, U as TurnInput, V as VideoIngestionStatus, X as VideoSourceMetadata, Y as Whisper, Z as WhisperAgentMiddleware, _ as WhisperClient, $ as WhisperClientConfig, a0 as WhisperConfig, a1 as WhisperContext, Y as WhisperDefault, a2 as WhisperEnvironment, a3 as WhisperError, a4 as WhisperErrorCode, a5 as WhisperIdentityMode, e as WhisperMemoryRouter, a6 as WhisperPreflightCheck, a7 as WhisperPreflightResult, a8 as WhisperResolvedIdentity, _ as WhisperRuntimeClient, W as WhisperToolDefinition, a as WhisperToolsOptions, WithWhisperOptions, a9 as WorkEvent, aa as WorkEventKind, ab as WorkEventSalience, ac as createAgentMiddleware, ad as createLangChainMemoryAdapter, ae as createLangGraphCheckpointAdapter, f as createMemoryRouter, a1 as default, af as memoryGraphToMermaid, w as whisperTools, withWhisper } from './adapters/ai-sdk.mjs';
2
2
  import 'zod';
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AgentRunContext, g as AgentRuntimeOptions, h as AgentRuntimeRankWeights, i as AgentRuntimeRetrievalOptions, j as AgentRuntimeSourceActivityOptions, k as AgentRuntimeStatus, C as CanonicalSourceCreateParams, l as CanonicalSourceCreateResult, m as CanonicalSourceType, E as ExtractedMemory, L as LangChainMemoryAdapter, n as LangGraphCheckpointAdapter, o as LearnConversationInput, p as LearnConversationResult, q as LearnInput, r as LearnResult, s as LearnSourceInput, t as LearnSourceResult, u as LearnSourceType, v as LearnTextInput, x as LearnTextResult, y as Memory, z as MemoryExtractionResult, B as MemoryKind, D as MemoryLatencyBreakdown, M as MemoryRouterConfig, b as MemoryRouterFallbackReason, c as MemoryRouterResult, d as MemoryRouterTrace, F as MemorySearchResponse, G as MemoryWriteAck, H as MemoryWriteResult, P as PreparedTurn, I as Project, Q as QueryParams, J as QueryResult, R as RunContext, S as Source, T as TurnCaptureResult, K as TurnInput, V as VideoIngestionStatus, N as VideoSourceMetadata, O as Whisper, U as WhisperAgentMiddleware, X as WhisperClient, Y as WhisperClientConfig, Z as WhisperConfig, _ as WhisperContext, O as WhisperDefault, $ as WhisperEnvironment, a0 as WhisperError, a1 as WhisperErrorCode, a2 as WhisperIdentityMode, e as WhisperMemoryRouter, a3 as WhisperPreflightCheck, a4 as WhisperPreflightResult, a5 as WhisperResolvedIdentity, X as WhisperRuntimeClient, W as WhisperToolDefinition, a as WhisperToolsOptions, WithWhisperOptions, a6 as WorkEvent, a7 as WorkEventKind, a8 as WorkEventSalience, a9 as createAgentMiddleware, aa as createLangChainMemoryAdapter, ab as createLangGraphCheckpointAdapter, f as createMemoryRouter, _ as default, ac as memoryGraphToMermaid, w as whisperTools, withWhisper } from './adapters/ai-sdk.js';
1
+ export { A as AgentRunContext, g as AgentRuntimeOptions, h as AgentRuntimeRankWeights, i as AgentRuntimeRetrievalOptions, j as AgentRuntimeSourceActivityOptions, k as AgentRuntimeStatus, C as CanonicalSourceCreateParams, l as CanonicalSourceCreateResult, m as CanonicalSourceType, E as ExtractedMemory, I as IngestParams, L as LangChainMemoryAdapter, n as LangGraphCheckpointAdapter, o as LearnConversationInput, p as LearnConversationResult, q as LearnInput, r as LearnResult, s as LearnSourceInput, t as LearnSourceResult, u as LearnSourceType, v as LearnTextInput, x as LearnTextResult, y as Memory, z as MemoryExtractionResult, B as MemoryKind, D as MemoryLatencyBreakdown, M as MemoryRouterConfig, b as MemoryRouterFallbackReason, c as MemoryRouterResult, d as MemoryRouterTrace, F as MemorySearchResponse, G as MemoryWriteAck, H as MemoryWriteResult, P as PreparedTurn, J as Project, Q as QueryInput, K as QueryParams, N as QueryResult, R as RememberParams, O as RunContext, S as Source, T as TurnCaptureResult, U as TurnInput, V as VideoIngestionStatus, X as VideoSourceMetadata, Y as Whisper, Z as WhisperAgentMiddleware, _ as WhisperClient, $ as WhisperClientConfig, a0 as WhisperConfig, a1 as WhisperContext, Y as WhisperDefault, a2 as WhisperEnvironment, a3 as WhisperError, a4 as WhisperErrorCode, a5 as WhisperIdentityMode, e as WhisperMemoryRouter, a6 as WhisperPreflightCheck, a7 as WhisperPreflightResult, a8 as WhisperResolvedIdentity, _ as WhisperRuntimeClient, W as WhisperToolDefinition, a as WhisperToolsOptions, WithWhisperOptions, a9 as WorkEvent, aa as WorkEventKind, ab as WorkEventSalience, ac as createAgentMiddleware, ad as createLangChainMemoryAdapter, ae as createLangGraphCheckpointAdapter, f as createMemoryRouter, a1 as default, af as memoryGraphToMermaid, w as whisperTools, withWhisper } from './adapters/ai-sdk.js';
2
2
  import 'zod';
package/index.js CHANGED
@@ -2289,6 +2289,16 @@ function classifyRuntimeErrorCode(error) {
2289
2289
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
2290
2290
  return "REQUEST_FAILED";
2291
2291
  }
2292
+ function detectSourceType(url) {
2293
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
2294
+ if (ghMatch) {
2295
+ const [, owner, repo] = ghMatch;
2296
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
2297
+ }
2298
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
2299
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
2300
+ return { type: "web" };
2301
+ }
2292
2302
  var WhisperClient = class _WhisperClient {
2293
2303
  constructor(config) {
2294
2304
  this.config = config;
@@ -2815,7 +2825,14 @@ var WhisperClient = class _WhisperClient {
2815
2825
  }
2816
2826
  async query(params) {
2817
2827
  return this.runOrThrow(async () => {
2818
- const identityParams = await this.withIdentity(params);
2828
+ const { q, userId, ...rest } = params;
2829
+ const normalized = {
2830
+ ...rest,
2831
+ query: rest.query ?? q ?? "",
2832
+ user_id: rest.user_id ?? userId,
2833
+ include_memories: rest.include_memories ?? true
2834
+ };
2835
+ const identityParams = await this.withIdentity(normalized);
2819
2836
  const project = (await this.resolveProject(identityParams.project)).id;
2820
2837
  const response = await this.runtimeClient.request({
2821
2838
  endpoint: "/v1/context/query",
@@ -2830,6 +2847,40 @@ var WhisperClient = class _WhisperClient {
2830
2847
  return response.data;
2831
2848
  });
2832
2849
  }
2850
+ async remember(params) {
2851
+ if (!params.userId && !this.getIdentity) {
2852
+ throw new WhisperError({
2853
+ code: "AUTH_IDENTITY_REQUIRED",
2854
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
2855
+ retryable: false,
2856
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
2857
+ });
2858
+ }
2859
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
2860
+ return this.learn({
2861
+ mode: "conversation",
2862
+ project: params.project,
2863
+ user_id: params.userId,
2864
+ session_id: sessionId,
2865
+ messages: params.messages
2866
+ });
2867
+ }
2868
+ async ingest(params) {
2869
+ const detected = detectSourceType(params.url);
2870
+ return this.learn({
2871
+ mode: "source",
2872
+ project: params.project,
2873
+ type: detected.type,
2874
+ url: params.url,
2875
+ name: params.name,
2876
+ token: params.token,
2877
+ ...detected.owner ? { owner: detected.owner } : {},
2878
+ ...detected.repo ? { repo: detected.repo } : {}
2879
+ });
2880
+ }
2881
+ async userProfile(userId) {
2882
+ return this.memory.getUserProfile({ user_id: userId });
2883
+ }
2833
2884
  async ingestSession(params) {
2834
2885
  return this.runOrThrow(async () => {
2835
2886
  const identityParams = await this.withIdentity(params);
package/index.mjs CHANGED
@@ -2242,6 +2242,16 @@ function classifyRuntimeErrorCode(error) {
2242
2242
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
2243
2243
  return "REQUEST_FAILED";
2244
2244
  }
2245
+ function detectSourceType(url) {
2246
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
2247
+ if (ghMatch) {
2248
+ const [, owner, repo] = ghMatch;
2249
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
2250
+ }
2251
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
2252
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
2253
+ return { type: "web" };
2254
+ }
2245
2255
  var WhisperClient = class _WhisperClient {
2246
2256
  constructor(config) {
2247
2257
  this.config = config;
@@ -2768,7 +2778,14 @@ var WhisperClient = class _WhisperClient {
2768
2778
  }
2769
2779
  async query(params) {
2770
2780
  return this.runOrThrow(async () => {
2771
- const identityParams = await this.withIdentity(params);
2781
+ const { q, userId, ...rest } = params;
2782
+ const normalized = {
2783
+ ...rest,
2784
+ query: rest.query ?? q ?? "",
2785
+ user_id: rest.user_id ?? userId,
2786
+ include_memories: rest.include_memories ?? true
2787
+ };
2788
+ const identityParams = await this.withIdentity(normalized);
2772
2789
  const project = (await this.resolveProject(identityParams.project)).id;
2773
2790
  const response = await this.runtimeClient.request({
2774
2791
  endpoint: "/v1/context/query",
@@ -2783,6 +2800,40 @@ var WhisperClient = class _WhisperClient {
2783
2800
  return response.data;
2784
2801
  });
2785
2802
  }
2803
+ async remember(params) {
2804
+ if (!params.userId && !this.getIdentity) {
2805
+ throw new WhisperError({
2806
+ code: "AUTH_IDENTITY_REQUIRED",
2807
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
2808
+ retryable: false,
2809
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
2810
+ });
2811
+ }
2812
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
2813
+ return this.learn({
2814
+ mode: "conversation",
2815
+ project: params.project,
2816
+ user_id: params.userId,
2817
+ session_id: sessionId,
2818
+ messages: params.messages
2819
+ });
2820
+ }
2821
+ async ingest(params) {
2822
+ const detected = detectSourceType(params.url);
2823
+ return this.learn({
2824
+ mode: "source",
2825
+ project: params.project,
2826
+ type: detected.type,
2827
+ url: params.url,
2828
+ name: params.name,
2829
+ token: params.token,
2830
+ ...detected.owner ? { owner: detected.owner } : {},
2831
+ ...detected.repo ? { repo: detected.repo } : {}
2832
+ });
2833
+ }
2834
+ async userProfile(userId) {
2835
+ return this.memory.getUserProfile({ user_id: userId });
2836
+ }
2786
2837
  async ingestSession(params) {
2787
2838
  return this.runOrThrow(async () => {
2788
2839
  const identityParams = await this.withIdentity(params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usewhisper/sdk",
3
- "version": "3.10.1",
3
+ "version": "3.11.0",
4
4
  "whisperContractVersion": "2026.03.11",
5
5
  "scripts": {
6
6
  "build": "tsup ../src/sdk/index.ts ../src/sdk/adapters/ai-sdk.ts ../src/sdk/adapters/tools.ts ../src/sdk/router/memory-router.ts --format esm,cjs --dts --splitting false --out-dir .",
@@ -2273,6 +2273,16 @@ function classifyRuntimeErrorCode(error) {
2273
2273
  if (error.code === "PROJECT_NOT_FOUND" || error.code === "NOT_FOUND") return "PROJECT_NOT_FOUND";
2274
2274
  return "REQUEST_FAILED";
2275
2275
  }
2276
+ function detectSourceType(url) {
2277
+ const ghMatch = url.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);
2278
+ if (ghMatch) {
2279
+ const [, owner, repo] = ghMatch;
2280
+ return { type: "github", owner, repo: repo.replace(/\.git$/, "") };
2281
+ }
2282
+ if (/youtube\.com|youtu\.be|loom\.com/.test(url)) return { type: "video" };
2283
+ if (/\.pdf(\?|$)/.test(url)) return { type: "pdf" };
2284
+ return { type: "web" };
2285
+ }
2276
2286
  var WhisperClient = class _WhisperClient {
2277
2287
  constructor(config) {
2278
2288
  this.config = config;
@@ -2799,7 +2809,14 @@ var WhisperClient = class _WhisperClient {
2799
2809
  }
2800
2810
  async query(params) {
2801
2811
  return this.runOrThrow(async () => {
2802
- const identityParams = await this.withIdentity(params);
2812
+ const { q, userId, ...rest } = params;
2813
+ const normalized = {
2814
+ ...rest,
2815
+ query: rest.query ?? q ?? "",
2816
+ user_id: rest.user_id ?? userId,
2817
+ include_memories: rest.include_memories ?? true
2818
+ };
2819
+ const identityParams = await this.withIdentity(normalized);
2803
2820
  const project = (await this.resolveProject(identityParams.project)).id;
2804
2821
  const response = await this.runtimeClient.request({
2805
2822
  endpoint: "/v1/context/query",
@@ -2814,6 +2831,40 @@ var WhisperClient = class _WhisperClient {
2814
2831
  return response.data;
2815
2832
  });
2816
2833
  }
2834
+ async remember(params) {
2835
+ if (!params.userId && !this.getIdentity) {
2836
+ throw new WhisperError({
2837
+ code: "AUTH_IDENTITY_REQUIRED",
2838
+ message: "remember() requires userId or a getIdentity() resolver on the client.",
2839
+ retryable: false,
2840
+ hint: "Pass userId in the call or configure getIdentity() in WhisperClient."
2841
+ });
2842
+ }
2843
+ const sessionId = params.sessionId ?? (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `session_${Math.random().toString(36).slice(2, 11)}`);
2844
+ return this.learn({
2845
+ mode: "conversation",
2846
+ project: params.project,
2847
+ user_id: params.userId,
2848
+ session_id: sessionId,
2849
+ messages: params.messages
2850
+ });
2851
+ }
2852
+ async ingest(params) {
2853
+ const detected = detectSourceType(params.url);
2854
+ return this.learn({
2855
+ mode: "source",
2856
+ project: params.project,
2857
+ type: detected.type,
2858
+ url: params.url,
2859
+ name: params.name,
2860
+ token: params.token,
2861
+ ...detected.owner ? { owner: detected.owner } : {},
2862
+ ...detected.repo ? { repo: detected.repo } : {}
2863
+ });
2864
+ }
2865
+ async userProfile(userId) {
2866
+ return this.memory.getUserProfile({ user_id: userId });
2867
+ }
2817
2868
  async ingestSession(params) {
2818
2869
  return this.runOrThrow(async () => {
2819
2870
  const identityParams = await this.withIdentity(params);