@anuma/sdk 3.6.2 → 3.7.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.
Files changed (27) hide show
  1. package/dist/expo/{chunk-7TATXBC5.mjs → chunk-AAB7OG7Q.mjs} +810 -4
  2. package/dist/{react/chunk-DFVCS3QQ.mjs → expo/chunk-BOY27A2C.mjs} +30 -3
  3. package/dist/expo/{consolidate-3QQPUWD6.mjs → consolidate-J5PHQKKY.mjs} +1 -1
  4. package/dist/expo/index.cjs +931 -825
  5. package/dist/expo/index.d.mts +9 -0
  6. package/dist/expo/index.d.ts +9 -0
  7. package/dist/expo/index.mjs +14 -817
  8. package/dist/{react/recall-OPKHWKZX.mjs → expo/recall-YVU7OSSJ.mjs} +2 -2
  9. package/dist/react/{chunk-DDHTJGZN.mjs → chunk-3VPEZDYL.mjs} +896 -4
  10. package/dist/{expo/chunk-DFVCS3QQ.mjs → react/chunk-BOY27A2C.mjs} +30 -3
  11. package/dist/react/{consolidate-3MXZV3G7.mjs → consolidate-PWJCAPZA.mjs} +1 -1
  12. package/dist/react/index.cjs +2021 -1907
  13. package/dist/react/index.d.mts +9 -0
  14. package/dist/react/index.d.ts +9 -0
  15. package/dist/react/index.mjs +29 -888
  16. package/dist/{expo/recall-IO4KJ5W7.mjs → react/recall-Z7BWJ67X.mjs} +2 -2
  17. package/dist/server/{chunk-V7SVKIXQ.mjs → chunk-LSKFJNLF.mjs} +795 -4
  18. package/dist/server/{chunk-AHJT66EO.mjs → chunk-MIXEASUP.mjs} +30 -3
  19. package/dist/server/{consolidate-CN2GQV4D.mjs → consolidate-PCHO3D3G.mjs} +1 -1
  20. package/dist/server/index.cjs +925 -163
  21. package/dist/server/index.d.mts +36 -0
  22. package/dist/server/index.d.ts +36 -0
  23. package/dist/server/index.mjs +9 -147
  24. package/dist/server/{recall-IWY2MYHR.mjs → recall-XEOLXA6P.mjs} +2 -2
  25. package/dist/tools/selection/index.cjs +793 -3
  26. package/dist/tools/selection/index.mjs +791 -3
  27. package/package.json +2 -2
@@ -32,6 +32,7 @@ import {
32
32
  createLlmNeighborRefiner,
33
33
  createMemoryVaultSearchTool,
34
34
  createMessageOp,
35
+ createSseClient,
35
36
  createSupersedingMemoryOp,
36
37
  createVaultEmbeddingCache,
37
38
  createVaultMemoriesBatchOp,
@@ -54,6 +55,9 @@ import {
54
55
  generateEmbeddings,
55
56
  getAllVaultMemoriesOp,
56
57
  getAllVaultMemoryContentsOp,
58
+ getApiV1CreditsBalance,
59
+ getApiV1CreditsPacks,
60
+ getApiV1Models,
57
61
  getConversationOp,
58
62
  getConversationsByProjectLazyOp,
59
63
  getConversationsLazyOp,
@@ -79,6 +83,7 @@ import {
79
83
  makeSyntheticStoredMessage,
80
84
  onClearAllEncryptionState,
81
85
  onKeyAvailable,
86
+ postApiV1CreditsPurchase,
82
87
  preEmbedVaultMemories,
83
88
  recall,
84
89
  replaceMemoryEntitiesGuardedOp,
@@ -103,7 +108,7 @@ import {
103
108
  upsertMessageOp,
104
109
  useEncryption,
105
110
  vaultMemoryToStored
106
- } from "./chunk-7TATXBC5.mjs";
111
+ } from "./chunk-AAB7OG7Q.mjs";
107
112
  import {
108
113
  PII_PATTERNS,
109
114
  PiiRedactor,
@@ -119,13 +124,13 @@ import {
119
124
  noopLogger,
120
125
  resolvePortalAuthHeaders,
121
126
  setLogger,
122
- supportsResponseFormat
123
- } from "./chunk-DFVCS3QQ.mjs";
127
+ supportsResponseFormat,
128
+ validateEndpointOverride
129
+ } from "./chunk-BOY27A2C.mjs";
124
130
  import {
125
131
  BASE_URL,
126
132
  MCP_R2_DOMAIN,
127
- __decorateClass,
128
- createClientConfig
133
+ __decorateClass
129
134
  } from "./chunk-GYKJOWEO.mjs";
130
135
 
131
136
  // src/lib/chat/cryptoPriceCentroids.ts
@@ -295,133 +300,6 @@ function createWebSearchPreProcessor(options = {}) {
295
300
  };
296
301
  }
297
302
 
298
- // src/client/core/serverSentEvents.gen.ts
299
- function createSseClient({
300
- onRequest,
301
- onSseError,
302
- onSseEvent,
303
- responseTransformer,
304
- responseValidator,
305
- sseDefaultRetryDelay,
306
- sseMaxRetryAttempts,
307
- sseMaxRetryDelay,
308
- sseSleepFn,
309
- url,
310
- ...options
311
- }) {
312
- let lastEventId;
313
- const sleep3 = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
314
- const createStream = async function* () {
315
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
316
- let attempt = 0;
317
- const signal = options.signal ?? new AbortController().signal;
318
- while (true) {
319
- if (signal.aborted) break;
320
- attempt++;
321
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
322
- if (lastEventId !== void 0) {
323
- headers.set("Last-Event-ID", lastEventId);
324
- }
325
- try {
326
- const requestInit = {
327
- redirect: "follow",
328
- ...options,
329
- body: options.serializedBody,
330
- headers,
331
- signal
332
- };
333
- let request = new Request(url, requestInit);
334
- if (onRequest) {
335
- request = await onRequest(url, requestInit);
336
- }
337
- const _fetch = options.fetch ?? globalThis.fetch;
338
- const response = await _fetch(request);
339
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
340
- if (!response.body) throw new Error("No body in SSE response");
341
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
342
- let buffer = "";
343
- const abortHandler = () => {
344
- try {
345
- reader.cancel();
346
- } catch {
347
- }
348
- };
349
- signal.addEventListener("abort", abortHandler);
350
- try {
351
- while (true) {
352
- const { done, value } = await reader.read();
353
- if (done) break;
354
- buffer += value;
355
- buffer = buffer.replace(/\r\n?/g, "\n");
356
- const chunks = buffer.split("\n\n");
357
- buffer = chunks.pop() ?? "";
358
- for (const chunk of chunks) {
359
- const lines = chunk.split("\n");
360
- const dataLines = [];
361
- let eventName;
362
- for (const line of lines) {
363
- if (line.startsWith("data:")) {
364
- dataLines.push(line.replace(/^data:\s*/, ""));
365
- } else if (line.startsWith("event:")) {
366
- eventName = line.replace(/^event:\s*/, "");
367
- } else if (line.startsWith("id:")) {
368
- lastEventId = line.replace(/^id:\s*/, "");
369
- } else if (line.startsWith("retry:")) {
370
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
371
- if (!Number.isNaN(parsed)) {
372
- retryDelay = parsed;
373
- }
374
- }
375
- }
376
- let data;
377
- let parsedJson = false;
378
- if (dataLines.length) {
379
- const rawData = dataLines.join("\n");
380
- try {
381
- data = JSON.parse(rawData);
382
- parsedJson = true;
383
- } catch {
384
- data = rawData;
385
- }
386
- }
387
- if (parsedJson) {
388
- if (responseValidator) {
389
- await responseValidator(data);
390
- }
391
- if (responseTransformer) {
392
- data = await responseTransformer(data);
393
- }
394
- }
395
- onSseEvent?.({
396
- data,
397
- event: eventName,
398
- id: lastEventId,
399
- retry: retryDelay
400
- });
401
- if (dataLines.length) {
402
- yield data;
403
- }
404
- }
405
- }
406
- } finally {
407
- signal.removeEventListener("abort", abortHandler);
408
- reader.releaseLock();
409
- }
410
- break;
411
- } catch (error) {
412
- onSseError?.(error);
413
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
414
- break;
415
- }
416
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
417
- await sleep3(backoff);
418
- }
419
- }
420
- };
421
- const stream = createStream();
422
- return { stream };
423
- }
424
-
425
303
  // src/lib/chat/runHooks.ts
426
304
  function composeHooks(hooks) {
427
305
  const handlers = hooks.filter((h) => h !== void 0 && h !== null);
@@ -2596,22 +2474,6 @@ function linkAbortSignals(a, b) {
2596
2474
  }
2597
2475
  };
2598
2476
  }
2599
- function validateEndpointOverride(override) {
2600
- const trimmed = override.trim();
2601
- if (trimmed === "") {
2602
- return {
2603
- valid: false,
2604
- message: 'endpointOverride must be a non-empty, root-relative path (e.g. "/api/v1/utility/responses"); received an empty or whitespace-only string'
2605
- };
2606
- }
2607
- if (trimmed.startsWith("//") || trimmed.includes("://")) {
2608
- return {
2609
- valid: false,
2610
- message: `endpointOverride must be a root-relative path (e.g. "/api/v1/utility/responses"), not a protocol-relative or absolute URL; received "${trimmed}"`
2611
- };
2612
- }
2613
- return { valid: true, endpoint: trimmed.startsWith("/") ? trimmed : `/${trimmed}` };
2614
- }
2615
2477
  async function runToolLoop(options) {
2616
2478
  const {
2617
2479
  model,
@@ -3866,674 +3728,6 @@ var xhrTransport = (options) => {
3866
3728
 
3867
3729
  // src/react/useCredits.ts
3868
3730
  import { useCallback, useEffect, useRef, useState } from "react";
3869
-
3870
- // src/client/core/bodySerializer.gen.ts
3871
- var jsonBodySerializer = {
3872
- bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
3873
- };
3874
-
3875
- // src/client/core/pathSerializer.gen.ts
3876
- var separatorArrayExplode = (style) => {
3877
- switch (style) {
3878
- case "label":
3879
- return ".";
3880
- case "matrix":
3881
- return ";";
3882
- case "simple":
3883
- return ",";
3884
- default:
3885
- return "&";
3886
- }
3887
- };
3888
- var separatorArrayNoExplode = (style) => {
3889
- switch (style) {
3890
- case "form":
3891
- return ",";
3892
- case "pipeDelimited":
3893
- return "|";
3894
- case "spaceDelimited":
3895
- return "%20";
3896
- default:
3897
- return ",";
3898
- }
3899
- };
3900
- var separatorObjectExplode = (style) => {
3901
- switch (style) {
3902
- case "label":
3903
- return ".";
3904
- case "matrix":
3905
- return ";";
3906
- case "simple":
3907
- return ",";
3908
- default:
3909
- return "&";
3910
- }
3911
- };
3912
- var serializeArrayParam = ({
3913
- allowReserved,
3914
- explode,
3915
- name,
3916
- style,
3917
- value
3918
- }) => {
3919
- if (!explode) {
3920
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
3921
- switch (style) {
3922
- case "label":
3923
- return `.${joinedValues2}`;
3924
- case "matrix":
3925
- return `;${name}=${joinedValues2}`;
3926
- case "simple":
3927
- return joinedValues2;
3928
- default:
3929
- return `${name}=${joinedValues2}`;
3930
- }
3931
- }
3932
- const separator = separatorArrayExplode(style);
3933
- const joinedValues = value.map((v) => {
3934
- if (style === "label" || style === "simple") {
3935
- return allowReserved ? v : encodeURIComponent(v);
3936
- }
3937
- return serializePrimitiveParam({
3938
- allowReserved,
3939
- name,
3940
- value: v
3941
- });
3942
- }).join(separator);
3943
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3944
- };
3945
- var serializePrimitiveParam = ({
3946
- allowReserved,
3947
- name,
3948
- value
3949
- }) => {
3950
- if (value === void 0 || value === null) {
3951
- return "";
3952
- }
3953
- if (typeof value === "object") {
3954
- throw new Error(
3955
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
3956
- );
3957
- }
3958
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
3959
- };
3960
- var serializeObjectParam = ({
3961
- allowReserved,
3962
- explode,
3963
- name,
3964
- style,
3965
- value,
3966
- valueOnly
3967
- }) => {
3968
- if (value instanceof Date) {
3969
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
3970
- }
3971
- if (style !== "deepObject" && !explode) {
3972
- let values = [];
3973
- Object.entries(value).forEach(([key, v]) => {
3974
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
3975
- });
3976
- const joinedValues2 = values.join(",");
3977
- switch (style) {
3978
- case "form":
3979
- return `${name}=${joinedValues2}`;
3980
- case "label":
3981
- return `.${joinedValues2}`;
3982
- case "matrix":
3983
- return `;${name}=${joinedValues2}`;
3984
- default:
3985
- return joinedValues2;
3986
- }
3987
- }
3988
- const separator = separatorObjectExplode(style);
3989
- const joinedValues = Object.entries(value).map(
3990
- ([key, v]) => serializePrimitiveParam({
3991
- allowReserved,
3992
- name: style === "deepObject" ? `${name}[${key}]` : key,
3993
- value: v
3994
- })
3995
- ).join(separator);
3996
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3997
- };
3998
-
3999
- // src/client/core/utils.gen.ts
4000
- function getValidRequestBody(options) {
4001
- const hasBody = options.body !== void 0;
4002
- const isSerializedBody = hasBody && options.bodySerializer;
4003
- if (isSerializedBody) {
4004
- if ("serializedBody" in options) {
4005
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
4006
- return hasSerializedBody ? options.serializedBody : null;
4007
- }
4008
- return options.body !== "" ? options.body : null;
4009
- }
4010
- if (hasBody) {
4011
- return options.body;
4012
- }
4013
- return void 0;
4014
- }
4015
-
4016
- // src/client/core/auth.gen.ts
4017
- var getAuthToken = async (auth, callback) => {
4018
- const token = typeof callback === "function" ? await callback(auth) : callback;
4019
- if (!token) {
4020
- return;
4021
- }
4022
- if (auth.scheme === "bearer") {
4023
- return `Bearer ${token}`;
4024
- }
4025
- if (auth.scheme === "basic") {
4026
- return `Basic ${btoa(token)}`;
4027
- }
4028
- return token;
4029
- };
4030
-
4031
- // src/client/client/utils.gen.ts
4032
- var PATH_PARAM_RE = /\{[^{}]+\}/g;
4033
- var defaultPathSerializer = ({ path, url: _url }) => {
4034
- let url = _url;
4035
- const matches = _url.match(PATH_PARAM_RE);
4036
- if (matches) {
4037
- for (const match of matches) {
4038
- let explode = false;
4039
- let name = match.substring(1, match.length - 1);
4040
- let style = "simple";
4041
- if (name.endsWith("*")) {
4042
- explode = true;
4043
- name = name.substring(0, name.length - 1);
4044
- }
4045
- if (name.startsWith(".")) {
4046
- name = name.substring(1);
4047
- style = "label";
4048
- } else if (name.startsWith(";")) {
4049
- name = name.substring(1);
4050
- style = "matrix";
4051
- }
4052
- const value = path[name];
4053
- if (value === void 0 || value === null) {
4054
- continue;
4055
- }
4056
- if (Array.isArray(value)) {
4057
- url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
4058
- continue;
4059
- }
4060
- if (typeof value === "object") {
4061
- url = url.replace(
4062
- match,
4063
- serializeObjectParam({
4064
- explode,
4065
- name,
4066
- style,
4067
- value,
4068
- valueOnly: true
4069
- })
4070
- );
4071
- continue;
4072
- }
4073
- if (style === "matrix") {
4074
- url = url.replace(
4075
- match,
4076
- `;${serializePrimitiveParam({
4077
- name,
4078
- value
4079
- })}`
4080
- );
4081
- continue;
4082
- }
4083
- const replaceValue = encodeURIComponent(
4084
- style === "label" ? `.${value}` : value
4085
- );
4086
- url = url.replace(match, replaceValue);
4087
- }
4088
- }
4089
- return url;
4090
- };
4091
- var createQuerySerializer = ({
4092
- parameters = {},
4093
- ...args
4094
- } = {}) => {
4095
- const querySerializer = (queryParams) => {
4096
- const search = [];
4097
- if (queryParams && typeof queryParams === "object") {
4098
- for (const name in queryParams) {
4099
- const value = queryParams[name];
4100
- if (value === void 0 || value === null) {
4101
- continue;
4102
- }
4103
- const options = parameters[name] || args;
4104
- if (Array.isArray(value)) {
4105
- const serializedArray = serializeArrayParam({
4106
- allowReserved: options.allowReserved,
4107
- explode: true,
4108
- name,
4109
- style: "form",
4110
- value,
4111
- ...options.array
4112
- });
4113
- if (serializedArray) search.push(serializedArray);
4114
- } else if (typeof value === "object") {
4115
- const serializedObject = serializeObjectParam({
4116
- allowReserved: options.allowReserved,
4117
- explode: true,
4118
- name,
4119
- style: "deepObject",
4120
- value,
4121
- ...options.object
4122
- });
4123
- if (serializedObject) search.push(serializedObject);
4124
- } else {
4125
- const serializedPrimitive = serializePrimitiveParam({
4126
- allowReserved: options.allowReserved,
4127
- name,
4128
- value
4129
- });
4130
- if (serializedPrimitive) search.push(serializedPrimitive);
4131
- }
4132
- }
4133
- }
4134
- return search.join("&");
4135
- };
4136
- return querySerializer;
4137
- };
4138
- var getParseAs = (contentType) => {
4139
- if (!contentType) {
4140
- return "stream";
4141
- }
4142
- const cleanContent = contentType.split(";")[0]?.trim();
4143
- if (!cleanContent) {
4144
- return;
4145
- }
4146
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
4147
- return "json";
4148
- }
4149
- if (cleanContent === "multipart/form-data") {
4150
- return "formData";
4151
- }
4152
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
4153
- return "blob";
4154
- }
4155
- if (cleanContent.startsWith("text/")) {
4156
- return "text";
4157
- }
4158
- return;
4159
- };
4160
- var checkForExistence = (options, name) => {
4161
- if (!name) {
4162
- return false;
4163
- }
4164
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
4165
- return true;
4166
- }
4167
- return false;
4168
- };
4169
- async function setAuthParams(options) {
4170
- for (const auth of options.security ?? []) {
4171
- if (checkForExistence(options, auth.name)) {
4172
- continue;
4173
- }
4174
- const token = await getAuthToken(auth, options.auth);
4175
- if (!token) {
4176
- continue;
4177
- }
4178
- const name = auth.name ?? "Authorization";
4179
- switch (auth.in) {
4180
- case "query":
4181
- if (!options.query) {
4182
- options.query = {};
4183
- }
4184
- options.query[name] = token;
4185
- break;
4186
- case "cookie":
4187
- options.headers.append("Cookie", `${name}=${token}`);
4188
- break;
4189
- case "header":
4190
- default:
4191
- options.headers.set(name, token);
4192
- break;
4193
- }
4194
- }
4195
- }
4196
- var buildUrl = (options) => {
4197
- const url = getUrl({
4198
- baseUrl: options.baseUrl,
4199
- path: options.path,
4200
- query: options.query,
4201
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
4202
- url: options.url
4203
- });
4204
- return url;
4205
- };
4206
- var getUrl = ({
4207
- baseUrl,
4208
- path,
4209
- query,
4210
- querySerializer,
4211
- url: _url
4212
- }) => {
4213
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
4214
- let url = (baseUrl ?? "") + pathUrl;
4215
- if (path) {
4216
- url = defaultPathSerializer({ path, url });
4217
- }
4218
- let search = query ? querySerializer(query) : "";
4219
- if (search.startsWith("?")) {
4220
- search = search.substring(1);
4221
- }
4222
- if (search) {
4223
- url += `?${search}`;
4224
- }
4225
- return url;
4226
- };
4227
- var mergeConfigs = (a, b) => {
4228
- const config = { ...a, ...b };
4229
- if (config.baseUrl?.endsWith("/")) {
4230
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
4231
- }
4232
- config.headers = mergeHeaders(a.headers, b.headers);
4233
- return config;
4234
- };
4235
- var headersEntries = (headers) => {
4236
- const entries = [];
4237
- headers.forEach((value, key) => {
4238
- entries.push([key, value]);
4239
- });
4240
- return entries;
4241
- };
4242
- var mergeHeaders = (...headers) => {
4243
- const mergedHeaders = new Headers();
4244
- for (const header of headers) {
4245
- if (!header || typeof header !== "object") {
4246
- continue;
4247
- }
4248
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
4249
- for (const [key, value] of iterator) {
4250
- if (value === null) {
4251
- mergedHeaders.delete(key);
4252
- } else if (Array.isArray(value)) {
4253
- for (const v of value) {
4254
- mergedHeaders.append(key, v);
4255
- }
4256
- } else if (value !== void 0) {
4257
- mergedHeaders.set(
4258
- key,
4259
- typeof value === "object" ? JSON.stringify(value) : value
4260
- );
4261
- }
4262
- }
4263
- }
4264
- return mergedHeaders;
4265
- };
4266
- var Interceptors = class {
4267
- constructor() {
4268
- this.fns = [];
4269
- }
4270
- clear() {
4271
- this.fns = [];
4272
- }
4273
- eject(id) {
4274
- const index = this.getInterceptorIndex(id);
4275
- if (this.fns[index]) {
4276
- this.fns[index] = null;
4277
- }
4278
- }
4279
- exists(id) {
4280
- const index = this.getInterceptorIndex(id);
4281
- return Boolean(this.fns[index]);
4282
- }
4283
- getInterceptorIndex(id) {
4284
- if (typeof id === "number") {
4285
- return this.fns[id] ? id : -1;
4286
- }
4287
- return this.fns.indexOf(id);
4288
- }
4289
- update(id, fn) {
4290
- const index = this.getInterceptorIndex(id);
4291
- if (this.fns[index]) {
4292
- this.fns[index] = fn;
4293
- return id;
4294
- }
4295
- return false;
4296
- }
4297
- use(fn) {
4298
- this.fns.push(fn);
4299
- return this.fns.length - 1;
4300
- }
4301
- };
4302
- var createInterceptors = () => ({
4303
- error: new Interceptors(),
4304
- request: new Interceptors(),
4305
- response: new Interceptors()
4306
- });
4307
- var defaultQuerySerializer = createQuerySerializer({
4308
- allowReserved: false,
4309
- array: {
4310
- explode: true,
4311
- style: "form"
4312
- },
4313
- object: {
4314
- explode: true,
4315
- style: "deepObject"
4316
- }
4317
- });
4318
- var defaultHeaders = {
4319
- "Content-Type": "application/json"
4320
- };
4321
- var createConfig = (override = {}) => ({
4322
- ...jsonBodySerializer,
4323
- headers: defaultHeaders,
4324
- parseAs: "auto",
4325
- querySerializer: defaultQuerySerializer,
4326
- ...override
4327
- });
4328
-
4329
- // src/client/client/client.gen.ts
4330
- var createClient = (config = {}) => {
4331
- let _config = mergeConfigs(createConfig(), config);
4332
- const getConfig = () => ({ ..._config });
4333
- const setConfig = (config2) => {
4334
- _config = mergeConfigs(_config, config2);
4335
- return getConfig();
4336
- };
4337
- const interceptors = createInterceptors();
4338
- const beforeRequest = async (options) => {
4339
- const opts = {
4340
- ..._config,
4341
- ...options,
4342
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
4343
- headers: mergeHeaders(_config.headers, options.headers),
4344
- serializedBody: void 0
4345
- };
4346
- if (opts.security) {
4347
- await setAuthParams(opts);
4348
- }
4349
- if (opts.requestValidator) {
4350
- await opts.requestValidator(opts);
4351
- }
4352
- if (opts.body !== void 0 && opts.bodySerializer) {
4353
- opts.serializedBody = opts.bodySerializer(opts.body);
4354
- }
4355
- if (opts.body === void 0 || opts.serializedBody === "") {
4356
- opts.headers.delete("Content-Type");
4357
- }
4358
- const resolvedOpts = opts;
4359
- const url = buildUrl(resolvedOpts);
4360
- return { opts: resolvedOpts, url };
4361
- };
4362
- const request = async (options) => {
4363
- const throwOnError = options.throwOnError ?? _config.throwOnError;
4364
- let response;
4365
- try {
4366
- const { opts, url } = await beforeRequest(options);
4367
- for (const fn of interceptors.request.fns) {
4368
- if (fn) {
4369
- await fn(opts);
4370
- }
4371
- }
4372
- const _fetch = opts.fetch;
4373
- const requestInit = {
4374
- ...opts,
4375
- body: getValidRequestBody(opts)
4376
- };
4377
- response = await _fetch(url, requestInit);
4378
- for (const fn of interceptors.response.fns) {
4379
- if (fn) {
4380
- response = await fn(response, opts);
4381
- }
4382
- }
4383
- const result = {
4384
- response
4385
- };
4386
- if (response.ok) {
4387
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
4388
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
4389
- let emptyData;
4390
- switch (parseAs) {
4391
- case "arrayBuffer":
4392
- case "blob":
4393
- case "text":
4394
- emptyData = await response[parseAs]();
4395
- break;
4396
- case "formData":
4397
- emptyData = new FormData();
4398
- break;
4399
- case "stream":
4400
- emptyData = response.body;
4401
- break;
4402
- case "json":
4403
- default:
4404
- emptyData = {};
4405
- break;
4406
- }
4407
- return {
4408
- data: emptyData,
4409
- ...result
4410
- };
4411
- }
4412
- let data;
4413
- switch (parseAs) {
4414
- case "arrayBuffer":
4415
- case "blob":
4416
- case "formData":
4417
- case "text":
4418
- data = await response[parseAs]();
4419
- break;
4420
- case "json": {
4421
- const text12 = await response.text();
4422
- data = text12 ? JSON.parse(text12) : {};
4423
- break;
4424
- }
4425
- case "stream":
4426
- return {
4427
- data: response.body,
4428
- ...result
4429
- };
4430
- }
4431
- if (parseAs === "json") {
4432
- if (opts.responseValidator) {
4433
- await opts.responseValidator(data);
4434
- }
4435
- if (opts.responseTransformer) {
4436
- data = await opts.responseTransformer(data);
4437
- }
4438
- }
4439
- return {
4440
- data,
4441
- ...result
4442
- };
4443
- }
4444
- const textError = await response.text();
4445
- let jsonError;
4446
- try {
4447
- jsonError = JSON.parse(textError);
4448
- } catch {
4449
- }
4450
- throw jsonError ?? textError;
4451
- } catch (error) {
4452
- let finalError = error;
4453
- for (const fn of interceptors.error.fns) {
4454
- if (fn) {
4455
- finalError = await fn(finalError, response, options);
4456
- }
4457
- }
4458
- finalError = finalError || {};
4459
- if (throwOnError) {
4460
- throw finalError;
4461
- }
4462
- return {
4463
- error: finalError,
4464
- response
4465
- };
4466
- }
4467
- };
4468
- const makeMethodFn = (method) => (options) => request({ ...options, method });
4469
- const makeSseFn = (method) => async (options) => {
4470
- const { opts, url } = await beforeRequest(options);
4471
- return createSseClient({
4472
- ...opts,
4473
- body: opts.body,
4474
- method,
4475
- onRequest: async (url2, init) => {
4476
- let request2 = new Request(url2, init);
4477
- const requestInit = { ...init, url: url2 };
4478
- for (const fn of interceptors.request.fns) {
4479
- if (fn) {
4480
- await fn(requestInit);
4481
- request2 = new Request(requestInit.url, requestInit);
4482
- }
4483
- }
4484
- return request2;
4485
- },
4486
- serializedBody: getValidRequestBody(opts),
4487
- url
4488
- });
4489
- };
4490
- const _buildUrl = (options) => buildUrl({ ..._config, ...options });
4491
- return {
4492
- buildUrl: _buildUrl,
4493
- connect: makeMethodFn("CONNECT"),
4494
- delete: makeMethodFn("DELETE"),
4495
- get: makeMethodFn("GET"),
4496
- getConfig,
4497
- head: makeMethodFn("HEAD"),
4498
- interceptors,
4499
- options: makeMethodFn("OPTIONS"),
4500
- patch: makeMethodFn("PATCH"),
4501
- post: makeMethodFn("POST"),
4502
- put: makeMethodFn("PUT"),
4503
- request,
4504
- setConfig,
4505
- sse: {
4506
- connect: makeSseFn("CONNECT"),
4507
- delete: makeSseFn("DELETE"),
4508
- get: makeSseFn("GET"),
4509
- head: makeSseFn("HEAD"),
4510
- options: makeSseFn("OPTIONS"),
4511
- patch: makeSseFn("PATCH"),
4512
- post: makeSseFn("POST"),
4513
- put: makeSseFn("PUT"),
4514
- trace: makeSseFn("TRACE")
4515
- },
4516
- trace: makeMethodFn("TRACE")
4517
- };
4518
- };
4519
-
4520
- // src/client/client.gen.ts
4521
- var client = createClient(createClientConfig(createConfig()));
4522
-
4523
- // src/client/sdk.gen.ts
4524
- var getApiV1CreditsBalance = (options) => (options?.client ?? client).get({ url: "/api/v1/credits/balance", ...options });
4525
- var getApiV1CreditsPacks = (options) => (options?.client ?? client).get({ url: "/api/v1/credits/packs", ...options });
4526
- var postApiV1CreditsPurchase = (options) => (options.client ?? client).post({
4527
- url: "/api/v1/credits/purchase",
4528
- ...options,
4529
- headers: {
4530
- "Content-Type": "application/json",
4531
- ...options.headers
4532
- }
4533
- });
4534
- var getApiV1Models = (options) => (options?.client ?? client).get({ url: "/api/v1/models", ...options });
4535
-
4536
- // src/react/useCredits.ts
4537
3731
  function useCredits(options = {}) {
4538
3732
  const { getToken, baseUrl = BASE_URL, autoFetch = true, onError } = options;
4539
3733
  const [balance, setBalance] = useState(null);
@@ -7221,7 +6415,7 @@ async function tryConsolidate(trimmed, ctx, options) {
7221
6415
  content: m.content,
7222
6416
  similarity: m.similarity
7223
6417
  }));
7224
- const { consolidateMemory: doConsolidate } = await import("./consolidate-3QQPUWD6.mjs");
6418
+ const { consolidateMemory: doConsolidate } = await import("./consolidate-J5PHQKKY.mjs");
7225
6419
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
7226
6420
  if (decision.action === "create") return null;
7227
6421
  if (decision.action === "supersede" && decision.targetId && decision.content) {
@@ -8964,6 +8158,9 @@ When a memory refers to one of these, reuse the EXACT existing name (same spelli
8964
8158
  ...options.apiKey !== void 0 && { apiKey: options.apiKey },
8965
8159
  ...options.getToken !== void 0 && { getToken: options.getToken },
8966
8160
  ...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
8161
+ ...options.endpointOverride !== void 0 && {
8162
+ endpointOverride: options.endpointOverride
8163
+ },
8967
8164
  model: options.model ?? DEFAULT_EXTRACTION_MODEL,
8968
8165
  systemPrompt: SYSTEM_PROMPT4,
8969
8166
  userMessage: `${vocabularyNote}Memories: