@anuma/sdk 3.0.0 → 3.1.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/expo/{chunk-IY7NNIYM.mjs → chunk-22CSPJLL.mjs} +16 -850
- package/dist/expo/index.cjs +1663 -1071
- package/dist/expo/index.d.mts +179 -10
- package/dist/expo/index.d.ts +179 -10
- package/dist/expo/index.mjs +1556 -68
- package/dist/expo/{recall-DJ5LD5WJ.mjs → recall-LICO3TJ7.mjs} +1 -1
- package/dist/index.cjs +415 -394
- package/dist/index.mjs +412 -391
- package/dist/react/{chunk-OSDVRDLI.mjs → chunk-FD5MB73N.mjs} +8 -987
- package/dist/react/index.cjs +1687 -1712
- package/dist/react/index.d.mts +103 -12
- package/dist/react/index.d.ts +103 -12
- package/dist/react/index.mjs +1209 -219
- package/dist/react/{recall-3BDCIEQF.mjs → recall-FPACUZGD.mjs} +1 -1
- package/dist/server/{chunk-QQOIC37O.mjs → chunk-RKUNGNBF.mjs} +7 -817
- package/dist/server/index.cjs +223 -941
- package/dist/server/index.d.mts +95 -12
- package/dist/server/index.d.ts +95 -12
- package/dist/server/index.mjs +182 -23
- package/dist/server/{recall-6QLUEYB7.mjs → recall-WT5HY2IA.mjs} +1 -1
- package/dist/tools/selection/chunk-4ETHWSXJ.mjs +25 -0
- package/dist/tools/selection/clientConfig-WITO4T6L.mjs +12 -0
- package/dist/tools/selection/index.cjs +1977 -0
- package/dist/tools/selection/index.d.mts +1380 -0
- package/dist/tools/selection/index.d.ts +1380 -0
- package/dist/tools/selection/index.mjs +1859 -0
- package/package.json +8 -1
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
getLogger
|
|
4
4
|
} from "./chunk-DFVCS3QQ.mjs";
|
|
5
5
|
import {
|
|
6
|
-
BASE_URL
|
|
7
|
-
createClientConfig
|
|
6
|
+
BASE_URL
|
|
8
7
|
} from "./chunk-GYKJOWEO.mjs";
|
|
9
8
|
|
|
10
9
|
// src/lib/db/chat/operations.ts
|
|
@@ -2780,967 +2779,6 @@ async function updateVaultMemoryEmbeddingOp(ctx, id, embedding, embeddingModel)
|
|
|
2780
2779
|
// src/lib/memoryEngine/constants.ts
|
|
2781
2780
|
var DEFAULT_API_EMBEDDING_MODEL = "qwen/qwen3-embedding-8b";
|
|
2782
2781
|
|
|
2783
|
-
// src/client/core/bodySerializer.gen.ts
|
|
2784
|
-
var jsonBodySerializer = {
|
|
2785
|
-
bodySerializer: (body) => JSON.stringify(
|
|
2786
|
-
body,
|
|
2787
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
2788
|
-
)
|
|
2789
|
-
};
|
|
2790
|
-
|
|
2791
|
-
// src/client/core/serverSentEvents.gen.ts
|
|
2792
|
-
var createSseClient = ({
|
|
2793
|
-
onRequest,
|
|
2794
|
-
onSseError,
|
|
2795
|
-
onSseEvent,
|
|
2796
|
-
responseTransformer,
|
|
2797
|
-
responseValidator,
|
|
2798
|
-
sseDefaultRetryDelay,
|
|
2799
|
-
sseMaxRetryAttempts,
|
|
2800
|
-
sseMaxRetryDelay,
|
|
2801
|
-
sseSleepFn,
|
|
2802
|
-
url,
|
|
2803
|
-
...options
|
|
2804
|
-
}) => {
|
|
2805
|
-
let lastEventId;
|
|
2806
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
2807
|
-
const createStream = async function* () {
|
|
2808
|
-
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
2809
|
-
let attempt = 0;
|
|
2810
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
2811
|
-
while (true) {
|
|
2812
|
-
if (signal.aborted) break;
|
|
2813
|
-
attempt++;
|
|
2814
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
2815
|
-
if (lastEventId !== void 0) {
|
|
2816
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
2817
|
-
}
|
|
2818
|
-
try {
|
|
2819
|
-
const requestInit = {
|
|
2820
|
-
redirect: "follow",
|
|
2821
|
-
...options,
|
|
2822
|
-
body: options.serializedBody,
|
|
2823
|
-
headers,
|
|
2824
|
-
signal
|
|
2825
|
-
};
|
|
2826
|
-
let request = new Request(url, requestInit);
|
|
2827
|
-
if (onRequest) {
|
|
2828
|
-
request = await onRequest(url, requestInit);
|
|
2829
|
-
}
|
|
2830
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
2831
|
-
const response = await _fetch(request);
|
|
2832
|
-
if (!response.ok)
|
|
2833
|
-
throw new Error(
|
|
2834
|
-
`SSE failed: ${response.status} ${response.statusText}`
|
|
2835
|
-
);
|
|
2836
|
-
if (!response.body) throw new Error("No body in SSE response");
|
|
2837
|
-
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
2838
|
-
let buffer = "";
|
|
2839
|
-
const abortHandler = () => {
|
|
2840
|
-
try {
|
|
2841
|
-
reader.cancel();
|
|
2842
|
-
} catch {
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
2845
|
-
signal.addEventListener("abort", abortHandler);
|
|
2846
|
-
try {
|
|
2847
|
-
while (true) {
|
|
2848
|
-
const { done, value } = await reader.read();
|
|
2849
|
-
if (done) break;
|
|
2850
|
-
buffer += value;
|
|
2851
|
-
const chunks = buffer.split("\n\n");
|
|
2852
|
-
buffer = chunks.pop() ?? "";
|
|
2853
|
-
for (const chunk of chunks) {
|
|
2854
|
-
const lines = chunk.split("\n");
|
|
2855
|
-
const dataLines = [];
|
|
2856
|
-
let eventName;
|
|
2857
|
-
for (const line of lines) {
|
|
2858
|
-
if (line.startsWith("data:")) {
|
|
2859
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
2860
|
-
} else if (line.startsWith("event:")) {
|
|
2861
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
2862
|
-
} else if (line.startsWith("id:")) {
|
|
2863
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
2864
|
-
} else if (line.startsWith("retry:")) {
|
|
2865
|
-
const parsed = Number.parseInt(
|
|
2866
|
-
line.replace(/^retry:\s*/, ""),
|
|
2867
|
-
10
|
|
2868
|
-
);
|
|
2869
|
-
if (!Number.isNaN(parsed)) {
|
|
2870
|
-
retryDelay = parsed;
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
let data;
|
|
2875
|
-
let parsedJson = false;
|
|
2876
|
-
if (dataLines.length) {
|
|
2877
|
-
const rawData = dataLines.join("\n");
|
|
2878
|
-
try {
|
|
2879
|
-
data = JSON.parse(rawData);
|
|
2880
|
-
parsedJson = true;
|
|
2881
|
-
} catch {
|
|
2882
|
-
data = rawData;
|
|
2883
|
-
}
|
|
2884
|
-
}
|
|
2885
|
-
if (parsedJson) {
|
|
2886
|
-
if (responseValidator) {
|
|
2887
|
-
await responseValidator(data);
|
|
2888
|
-
}
|
|
2889
|
-
if (responseTransformer) {
|
|
2890
|
-
data = await responseTransformer(data);
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
onSseEvent?.({
|
|
2894
|
-
data,
|
|
2895
|
-
event: eventName,
|
|
2896
|
-
id: lastEventId,
|
|
2897
|
-
retry: retryDelay
|
|
2898
|
-
});
|
|
2899
|
-
if (dataLines.length) {
|
|
2900
|
-
yield data;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
} finally {
|
|
2905
|
-
signal.removeEventListener("abort", abortHandler);
|
|
2906
|
-
reader.releaseLock();
|
|
2907
|
-
}
|
|
2908
|
-
break;
|
|
2909
|
-
} catch (error) {
|
|
2910
|
-
onSseError?.(error);
|
|
2911
|
-
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
2912
|
-
break;
|
|
2913
|
-
}
|
|
2914
|
-
const backoff = Math.min(
|
|
2915
|
-
retryDelay * 2 ** (attempt - 1),
|
|
2916
|
-
sseMaxRetryDelay ?? 3e4
|
|
2917
|
-
);
|
|
2918
|
-
await sleep(backoff);
|
|
2919
|
-
}
|
|
2920
|
-
}
|
|
2921
|
-
};
|
|
2922
|
-
const stream = createStream();
|
|
2923
|
-
return { stream };
|
|
2924
|
-
};
|
|
2925
|
-
|
|
2926
|
-
// src/client/core/pathSerializer.gen.ts
|
|
2927
|
-
var separatorArrayExplode = (style) => {
|
|
2928
|
-
switch (style) {
|
|
2929
|
-
case "label":
|
|
2930
|
-
return ".";
|
|
2931
|
-
case "matrix":
|
|
2932
|
-
return ";";
|
|
2933
|
-
case "simple":
|
|
2934
|
-
return ",";
|
|
2935
|
-
default:
|
|
2936
|
-
return "&";
|
|
2937
|
-
}
|
|
2938
|
-
};
|
|
2939
|
-
var separatorArrayNoExplode = (style) => {
|
|
2940
|
-
switch (style) {
|
|
2941
|
-
case "form":
|
|
2942
|
-
return ",";
|
|
2943
|
-
case "pipeDelimited":
|
|
2944
|
-
return "|";
|
|
2945
|
-
case "spaceDelimited":
|
|
2946
|
-
return "%20";
|
|
2947
|
-
default:
|
|
2948
|
-
return ",";
|
|
2949
|
-
}
|
|
2950
|
-
};
|
|
2951
|
-
var separatorObjectExplode = (style) => {
|
|
2952
|
-
switch (style) {
|
|
2953
|
-
case "label":
|
|
2954
|
-
return ".";
|
|
2955
|
-
case "matrix":
|
|
2956
|
-
return ";";
|
|
2957
|
-
case "simple":
|
|
2958
|
-
return ",";
|
|
2959
|
-
default:
|
|
2960
|
-
return "&";
|
|
2961
|
-
}
|
|
2962
|
-
};
|
|
2963
|
-
var serializeArrayParam = ({
|
|
2964
|
-
allowReserved,
|
|
2965
|
-
explode,
|
|
2966
|
-
name,
|
|
2967
|
-
style,
|
|
2968
|
-
value
|
|
2969
|
-
}) => {
|
|
2970
|
-
if (!explode) {
|
|
2971
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
2972
|
-
switch (style) {
|
|
2973
|
-
case "label":
|
|
2974
|
-
return `.${joinedValues2}`;
|
|
2975
|
-
case "matrix":
|
|
2976
|
-
return `;${name}=${joinedValues2}`;
|
|
2977
|
-
case "simple":
|
|
2978
|
-
return joinedValues2;
|
|
2979
|
-
default:
|
|
2980
|
-
return `${name}=${joinedValues2}`;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
const separator = separatorArrayExplode(style);
|
|
2984
|
-
const joinedValues = value.map((v) => {
|
|
2985
|
-
if (style === "label" || style === "simple") {
|
|
2986
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
2987
|
-
}
|
|
2988
|
-
return serializePrimitiveParam({
|
|
2989
|
-
allowReserved,
|
|
2990
|
-
name,
|
|
2991
|
-
value: v
|
|
2992
|
-
});
|
|
2993
|
-
}).join(separator);
|
|
2994
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
2995
|
-
};
|
|
2996
|
-
var serializePrimitiveParam = ({
|
|
2997
|
-
allowReserved,
|
|
2998
|
-
name,
|
|
2999
|
-
value
|
|
3000
|
-
}) => {
|
|
3001
|
-
if (value === void 0 || value === null) {
|
|
3002
|
-
return "";
|
|
3003
|
-
}
|
|
3004
|
-
if (typeof value === "object") {
|
|
3005
|
-
throw new Error(
|
|
3006
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
3007
|
-
);
|
|
3008
|
-
}
|
|
3009
|
-
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
3010
|
-
};
|
|
3011
|
-
var serializeObjectParam = ({
|
|
3012
|
-
allowReserved,
|
|
3013
|
-
explode,
|
|
3014
|
-
name,
|
|
3015
|
-
style,
|
|
3016
|
-
value,
|
|
3017
|
-
valueOnly
|
|
3018
|
-
}) => {
|
|
3019
|
-
if (value instanceof Date) {
|
|
3020
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
3021
|
-
}
|
|
3022
|
-
if (style !== "deepObject" && !explode) {
|
|
3023
|
-
let values = [];
|
|
3024
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
3025
|
-
values = [
|
|
3026
|
-
...values,
|
|
3027
|
-
key,
|
|
3028
|
-
allowReserved ? v : encodeURIComponent(v)
|
|
3029
|
-
];
|
|
3030
|
-
});
|
|
3031
|
-
const joinedValues2 = values.join(",");
|
|
3032
|
-
switch (style) {
|
|
3033
|
-
case "form":
|
|
3034
|
-
return `${name}=${joinedValues2}`;
|
|
3035
|
-
case "label":
|
|
3036
|
-
return `.${joinedValues2}`;
|
|
3037
|
-
case "matrix":
|
|
3038
|
-
return `;${name}=${joinedValues2}`;
|
|
3039
|
-
default:
|
|
3040
|
-
return joinedValues2;
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
const separator = separatorObjectExplode(style);
|
|
3044
|
-
const joinedValues = Object.entries(value).map(
|
|
3045
|
-
([key, v]) => serializePrimitiveParam({
|
|
3046
|
-
allowReserved,
|
|
3047
|
-
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
3048
|
-
value: v
|
|
3049
|
-
})
|
|
3050
|
-
).join(separator);
|
|
3051
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
3052
|
-
};
|
|
3053
|
-
|
|
3054
|
-
// src/client/core/utils.gen.ts
|
|
3055
|
-
function getValidRequestBody(options) {
|
|
3056
|
-
const hasBody = options.body !== void 0;
|
|
3057
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
3058
|
-
if (isSerializedBody) {
|
|
3059
|
-
if ("serializedBody" in options) {
|
|
3060
|
-
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
3061
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
3062
|
-
}
|
|
3063
|
-
return options.body !== "" ? options.body : null;
|
|
3064
|
-
}
|
|
3065
|
-
if (hasBody) {
|
|
3066
|
-
return options.body;
|
|
3067
|
-
}
|
|
3068
|
-
return void 0;
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
// src/client/core/auth.gen.ts
|
|
3072
|
-
var getAuthToken = async (auth, callback) => {
|
|
3073
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
3074
|
-
if (!token) {
|
|
3075
|
-
return;
|
|
3076
|
-
}
|
|
3077
|
-
if (auth.scheme === "bearer") {
|
|
3078
|
-
return `Bearer ${token}`;
|
|
3079
|
-
}
|
|
3080
|
-
if (auth.scheme === "basic") {
|
|
3081
|
-
return `Basic ${btoa(token)}`;
|
|
3082
|
-
}
|
|
3083
|
-
return token;
|
|
3084
|
-
};
|
|
3085
|
-
|
|
3086
|
-
// src/client/client/utils.gen.ts
|
|
3087
|
-
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
3088
|
-
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
3089
|
-
let url = _url;
|
|
3090
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
3091
|
-
if (matches) {
|
|
3092
|
-
for (const match of matches) {
|
|
3093
|
-
let explode = false;
|
|
3094
|
-
let name = match.substring(1, match.length - 1);
|
|
3095
|
-
let style = "simple";
|
|
3096
|
-
if (name.endsWith("*")) {
|
|
3097
|
-
explode = true;
|
|
3098
|
-
name = name.substring(0, name.length - 1);
|
|
3099
|
-
}
|
|
3100
|
-
if (name.startsWith(".")) {
|
|
3101
|
-
name = name.substring(1);
|
|
3102
|
-
style = "label";
|
|
3103
|
-
} else if (name.startsWith(";")) {
|
|
3104
|
-
name = name.substring(1);
|
|
3105
|
-
style = "matrix";
|
|
3106
|
-
}
|
|
3107
|
-
const value = path[name];
|
|
3108
|
-
if (value === void 0 || value === null) {
|
|
3109
|
-
continue;
|
|
3110
|
-
}
|
|
3111
|
-
if (Array.isArray(value)) {
|
|
3112
|
-
url = url.replace(
|
|
3113
|
-
match,
|
|
3114
|
-
serializeArrayParam({ explode, name, style, value })
|
|
3115
|
-
);
|
|
3116
|
-
continue;
|
|
3117
|
-
}
|
|
3118
|
-
if (typeof value === "object") {
|
|
3119
|
-
url = url.replace(
|
|
3120
|
-
match,
|
|
3121
|
-
serializeObjectParam({
|
|
3122
|
-
explode,
|
|
3123
|
-
name,
|
|
3124
|
-
style,
|
|
3125
|
-
value,
|
|
3126
|
-
valueOnly: true
|
|
3127
|
-
})
|
|
3128
|
-
);
|
|
3129
|
-
continue;
|
|
3130
|
-
}
|
|
3131
|
-
if (style === "matrix") {
|
|
3132
|
-
url = url.replace(
|
|
3133
|
-
match,
|
|
3134
|
-
`;${serializePrimitiveParam({
|
|
3135
|
-
name,
|
|
3136
|
-
value
|
|
3137
|
-
})}`
|
|
3138
|
-
);
|
|
3139
|
-
continue;
|
|
3140
|
-
}
|
|
3141
|
-
const replaceValue = encodeURIComponent(
|
|
3142
|
-
style === "label" ? `.${value}` : value
|
|
3143
|
-
);
|
|
3144
|
-
url = url.replace(match, replaceValue);
|
|
3145
|
-
}
|
|
3146
|
-
}
|
|
3147
|
-
return url;
|
|
3148
|
-
};
|
|
3149
|
-
var createQuerySerializer = ({
|
|
3150
|
-
parameters = {},
|
|
3151
|
-
...args
|
|
3152
|
-
} = {}) => {
|
|
3153
|
-
const querySerializer = (queryParams) => {
|
|
3154
|
-
const search = [];
|
|
3155
|
-
if (queryParams && typeof queryParams === "object") {
|
|
3156
|
-
for (const name in queryParams) {
|
|
3157
|
-
const value = queryParams[name];
|
|
3158
|
-
if (value === void 0 || value === null) {
|
|
3159
|
-
continue;
|
|
3160
|
-
}
|
|
3161
|
-
const options = parameters[name] || args;
|
|
3162
|
-
if (Array.isArray(value)) {
|
|
3163
|
-
const serializedArray = serializeArrayParam({
|
|
3164
|
-
allowReserved: options.allowReserved,
|
|
3165
|
-
explode: true,
|
|
3166
|
-
name,
|
|
3167
|
-
style: "form",
|
|
3168
|
-
value,
|
|
3169
|
-
...options.array
|
|
3170
|
-
});
|
|
3171
|
-
if (serializedArray) search.push(serializedArray);
|
|
3172
|
-
} else if (typeof value === "object") {
|
|
3173
|
-
const serializedObject = serializeObjectParam({
|
|
3174
|
-
allowReserved: options.allowReserved,
|
|
3175
|
-
explode: true,
|
|
3176
|
-
name,
|
|
3177
|
-
style: "deepObject",
|
|
3178
|
-
value,
|
|
3179
|
-
...options.object
|
|
3180
|
-
});
|
|
3181
|
-
if (serializedObject) search.push(serializedObject);
|
|
3182
|
-
} else {
|
|
3183
|
-
const serializedPrimitive = serializePrimitiveParam({
|
|
3184
|
-
allowReserved: options.allowReserved,
|
|
3185
|
-
name,
|
|
3186
|
-
value
|
|
3187
|
-
});
|
|
3188
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
3189
|
-
}
|
|
3190
|
-
}
|
|
3191
|
-
}
|
|
3192
|
-
return search.join("&");
|
|
3193
|
-
};
|
|
3194
|
-
return querySerializer;
|
|
3195
|
-
};
|
|
3196
|
-
var getParseAs = (contentType) => {
|
|
3197
|
-
if (!contentType) {
|
|
3198
|
-
return "stream";
|
|
3199
|
-
}
|
|
3200
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
3201
|
-
if (!cleanContent) {
|
|
3202
|
-
return;
|
|
3203
|
-
}
|
|
3204
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
3205
|
-
return "json";
|
|
3206
|
-
}
|
|
3207
|
-
if (cleanContent === "multipart/form-data") {
|
|
3208
|
-
return "formData";
|
|
3209
|
-
}
|
|
3210
|
-
if (["application/", "audio/", "image/", "video/"].some(
|
|
3211
|
-
(type) => cleanContent.startsWith(type)
|
|
3212
|
-
)) {
|
|
3213
|
-
return "blob";
|
|
3214
|
-
}
|
|
3215
|
-
if (cleanContent.startsWith("text/")) {
|
|
3216
|
-
return "text";
|
|
3217
|
-
}
|
|
3218
|
-
return;
|
|
3219
|
-
};
|
|
3220
|
-
var checkForExistence = (options, name) => {
|
|
3221
|
-
if (!name) {
|
|
3222
|
-
return false;
|
|
3223
|
-
}
|
|
3224
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
3225
|
-
return true;
|
|
3226
|
-
}
|
|
3227
|
-
return false;
|
|
3228
|
-
};
|
|
3229
|
-
var setAuthParams = async ({
|
|
3230
|
-
security,
|
|
3231
|
-
...options
|
|
3232
|
-
}) => {
|
|
3233
|
-
for (const auth of security) {
|
|
3234
|
-
if (checkForExistence(options, auth.name)) {
|
|
3235
|
-
continue;
|
|
3236
|
-
}
|
|
3237
|
-
const token = await getAuthToken(auth, options.auth);
|
|
3238
|
-
if (!token) {
|
|
3239
|
-
continue;
|
|
3240
|
-
}
|
|
3241
|
-
const name = auth.name ?? "Authorization";
|
|
3242
|
-
switch (auth.in) {
|
|
3243
|
-
case "query":
|
|
3244
|
-
if (!options.query) {
|
|
3245
|
-
options.query = {};
|
|
3246
|
-
}
|
|
3247
|
-
options.query[name] = token;
|
|
3248
|
-
break;
|
|
3249
|
-
case "cookie":
|
|
3250
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
3251
|
-
break;
|
|
3252
|
-
case "header":
|
|
3253
|
-
default:
|
|
3254
|
-
options.headers.set(name, token);
|
|
3255
|
-
break;
|
|
3256
|
-
}
|
|
3257
|
-
}
|
|
3258
|
-
};
|
|
3259
|
-
var buildUrl = (options) => {
|
|
3260
|
-
const url = getUrl({
|
|
3261
|
-
baseUrl: options.baseUrl,
|
|
3262
|
-
path: options.path,
|
|
3263
|
-
query: options.query,
|
|
3264
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
3265
|
-
url: options.url
|
|
3266
|
-
});
|
|
3267
|
-
return url;
|
|
3268
|
-
};
|
|
3269
|
-
var getUrl = ({
|
|
3270
|
-
baseUrl,
|
|
3271
|
-
path,
|
|
3272
|
-
query,
|
|
3273
|
-
querySerializer,
|
|
3274
|
-
url: _url
|
|
3275
|
-
}) => {
|
|
3276
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
3277
|
-
let url = (baseUrl ?? "") + pathUrl;
|
|
3278
|
-
if (path) {
|
|
3279
|
-
url = defaultPathSerializer({ path, url });
|
|
3280
|
-
}
|
|
3281
|
-
let search = query ? querySerializer(query) : "";
|
|
3282
|
-
if (search.startsWith("?")) {
|
|
3283
|
-
search = search.substring(1);
|
|
3284
|
-
}
|
|
3285
|
-
if (search) {
|
|
3286
|
-
url += `?${search}`;
|
|
3287
|
-
}
|
|
3288
|
-
return url;
|
|
3289
|
-
};
|
|
3290
|
-
var mergeConfigs = (a, b) => {
|
|
3291
|
-
const config = { ...a, ...b };
|
|
3292
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
3293
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
3294
|
-
}
|
|
3295
|
-
config.headers = mergeHeaders(a.headers, b.headers);
|
|
3296
|
-
return config;
|
|
3297
|
-
};
|
|
3298
|
-
var headersEntries = (headers) => {
|
|
3299
|
-
const entries = [];
|
|
3300
|
-
headers.forEach((value, key) => {
|
|
3301
|
-
entries.push([key, value]);
|
|
3302
|
-
});
|
|
3303
|
-
return entries;
|
|
3304
|
-
};
|
|
3305
|
-
var mergeHeaders = (...headers) => {
|
|
3306
|
-
const mergedHeaders = new Headers();
|
|
3307
|
-
for (const header of headers) {
|
|
3308
|
-
if (!header || typeof header !== "object") {
|
|
3309
|
-
continue;
|
|
3310
|
-
}
|
|
3311
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
3312
|
-
for (const [key, value] of iterator) {
|
|
3313
|
-
if (value === null) {
|
|
3314
|
-
mergedHeaders.delete(key);
|
|
3315
|
-
} else if (Array.isArray(value)) {
|
|
3316
|
-
for (const v of value) {
|
|
3317
|
-
mergedHeaders.append(key, v);
|
|
3318
|
-
}
|
|
3319
|
-
} else if (value !== void 0) {
|
|
3320
|
-
mergedHeaders.set(
|
|
3321
|
-
key,
|
|
3322
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
3323
|
-
);
|
|
3324
|
-
}
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
return mergedHeaders;
|
|
3328
|
-
};
|
|
3329
|
-
var Interceptors = class {
|
|
3330
|
-
constructor() {
|
|
3331
|
-
this.fns = [];
|
|
3332
|
-
}
|
|
3333
|
-
clear() {
|
|
3334
|
-
this.fns = [];
|
|
3335
|
-
}
|
|
3336
|
-
eject(id) {
|
|
3337
|
-
const index = this.getInterceptorIndex(id);
|
|
3338
|
-
if (this.fns[index]) {
|
|
3339
|
-
this.fns[index] = null;
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
exists(id) {
|
|
3343
|
-
const index = this.getInterceptorIndex(id);
|
|
3344
|
-
return Boolean(this.fns[index]);
|
|
3345
|
-
}
|
|
3346
|
-
getInterceptorIndex(id) {
|
|
3347
|
-
if (typeof id === "number") {
|
|
3348
|
-
return this.fns[id] ? id : -1;
|
|
3349
|
-
}
|
|
3350
|
-
return this.fns.indexOf(id);
|
|
3351
|
-
}
|
|
3352
|
-
update(id, fn) {
|
|
3353
|
-
const index = this.getInterceptorIndex(id);
|
|
3354
|
-
if (this.fns[index]) {
|
|
3355
|
-
this.fns[index] = fn;
|
|
3356
|
-
return id;
|
|
3357
|
-
}
|
|
3358
|
-
return false;
|
|
3359
|
-
}
|
|
3360
|
-
use(fn) {
|
|
3361
|
-
this.fns.push(fn);
|
|
3362
|
-
return this.fns.length - 1;
|
|
3363
|
-
}
|
|
3364
|
-
};
|
|
3365
|
-
var createInterceptors = () => ({
|
|
3366
|
-
error: new Interceptors(),
|
|
3367
|
-
request: new Interceptors(),
|
|
3368
|
-
response: new Interceptors()
|
|
3369
|
-
});
|
|
3370
|
-
var defaultQuerySerializer = createQuerySerializer({
|
|
3371
|
-
allowReserved: false,
|
|
3372
|
-
array: {
|
|
3373
|
-
explode: true,
|
|
3374
|
-
style: "form"
|
|
3375
|
-
},
|
|
3376
|
-
object: {
|
|
3377
|
-
explode: true,
|
|
3378
|
-
style: "deepObject"
|
|
3379
|
-
}
|
|
3380
|
-
});
|
|
3381
|
-
var defaultHeaders = {
|
|
3382
|
-
"Content-Type": "application/json"
|
|
3383
|
-
};
|
|
3384
|
-
var createConfig = (override = {}) => ({
|
|
3385
|
-
...jsonBodySerializer,
|
|
3386
|
-
headers: defaultHeaders,
|
|
3387
|
-
parseAs: "auto",
|
|
3388
|
-
querySerializer: defaultQuerySerializer,
|
|
3389
|
-
...override
|
|
3390
|
-
});
|
|
3391
|
-
|
|
3392
|
-
// src/client/client/client.gen.ts
|
|
3393
|
-
var createClient = (config = {}) => {
|
|
3394
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
3395
|
-
const getConfig = () => ({ ..._config });
|
|
3396
|
-
const setConfig = (config2) => {
|
|
3397
|
-
_config = mergeConfigs(_config, config2);
|
|
3398
|
-
return getConfig();
|
|
3399
|
-
};
|
|
3400
|
-
const interceptors = createInterceptors();
|
|
3401
|
-
const beforeRequest = async (options) => {
|
|
3402
|
-
const opts = {
|
|
3403
|
-
..._config,
|
|
3404
|
-
...options,
|
|
3405
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
3406
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
3407
|
-
serializedBody: void 0
|
|
3408
|
-
};
|
|
3409
|
-
if (opts.security) {
|
|
3410
|
-
await setAuthParams({
|
|
3411
|
-
...opts,
|
|
3412
|
-
security: opts.security
|
|
3413
|
-
});
|
|
3414
|
-
}
|
|
3415
|
-
if (opts.requestValidator) {
|
|
3416
|
-
await opts.requestValidator(opts);
|
|
3417
|
-
}
|
|
3418
|
-
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
3419
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
3420
|
-
}
|
|
3421
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
3422
|
-
opts.headers.delete("Content-Type");
|
|
3423
|
-
}
|
|
3424
|
-
const url = buildUrl(opts);
|
|
3425
|
-
return { opts, url };
|
|
3426
|
-
};
|
|
3427
|
-
const request = async (options) => {
|
|
3428
|
-
const { opts, url } = await beforeRequest(options);
|
|
3429
|
-
for (const fn of interceptors.request.fns) {
|
|
3430
|
-
if (fn) {
|
|
3431
|
-
await fn(opts);
|
|
3432
|
-
}
|
|
3433
|
-
}
|
|
3434
|
-
const _fetch = opts.fetch;
|
|
3435
|
-
const requestInit = {
|
|
3436
|
-
...opts,
|
|
3437
|
-
body: getValidRequestBody(opts)
|
|
3438
|
-
};
|
|
3439
|
-
let response = await _fetch(url, requestInit);
|
|
3440
|
-
for (const fn of interceptors.response.fns) {
|
|
3441
|
-
if (fn) {
|
|
3442
|
-
response = await fn(response, opts);
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
const result = {
|
|
3446
|
-
response
|
|
3447
|
-
};
|
|
3448
|
-
if (response.ok) {
|
|
3449
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
3450
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
3451
|
-
let emptyData;
|
|
3452
|
-
switch (parseAs) {
|
|
3453
|
-
case "arrayBuffer":
|
|
3454
|
-
case "blob":
|
|
3455
|
-
case "text":
|
|
3456
|
-
emptyData = await response[parseAs]();
|
|
3457
|
-
break;
|
|
3458
|
-
case "formData":
|
|
3459
|
-
emptyData = new FormData();
|
|
3460
|
-
break;
|
|
3461
|
-
case "stream":
|
|
3462
|
-
emptyData = response.body;
|
|
3463
|
-
break;
|
|
3464
|
-
case "json":
|
|
3465
|
-
default:
|
|
3466
|
-
emptyData = {};
|
|
3467
|
-
break;
|
|
3468
|
-
}
|
|
3469
|
-
return {
|
|
3470
|
-
data: emptyData,
|
|
3471
|
-
...result
|
|
3472
|
-
};
|
|
3473
|
-
}
|
|
3474
|
-
let data;
|
|
3475
|
-
switch (parseAs) {
|
|
3476
|
-
case "arrayBuffer":
|
|
3477
|
-
case "blob":
|
|
3478
|
-
case "formData":
|
|
3479
|
-
case "json":
|
|
3480
|
-
case "text":
|
|
3481
|
-
data = await response[parseAs]();
|
|
3482
|
-
break;
|
|
3483
|
-
case "stream":
|
|
3484
|
-
return {
|
|
3485
|
-
data: response.body,
|
|
3486
|
-
...result
|
|
3487
|
-
};
|
|
3488
|
-
}
|
|
3489
|
-
if (parseAs === "json") {
|
|
3490
|
-
if (opts.responseValidator) {
|
|
3491
|
-
await opts.responseValidator(data);
|
|
3492
|
-
}
|
|
3493
|
-
if (opts.responseTransformer) {
|
|
3494
|
-
data = await opts.responseTransformer(data);
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
return {
|
|
3498
|
-
data,
|
|
3499
|
-
...result
|
|
3500
|
-
};
|
|
3501
|
-
}
|
|
3502
|
-
const textError = await response.text();
|
|
3503
|
-
let jsonError;
|
|
3504
|
-
try {
|
|
3505
|
-
jsonError = JSON.parse(textError);
|
|
3506
|
-
} catch {
|
|
3507
|
-
}
|
|
3508
|
-
const error = jsonError ?? textError;
|
|
3509
|
-
let finalError = error;
|
|
3510
|
-
for (const fn of interceptors.error.fns) {
|
|
3511
|
-
if (fn) {
|
|
3512
|
-
finalError = await fn(error, response, opts);
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
finalError = finalError || {};
|
|
3516
|
-
if (opts.throwOnError) {
|
|
3517
|
-
throw finalError;
|
|
3518
|
-
}
|
|
3519
|
-
return {
|
|
3520
|
-
error: finalError,
|
|
3521
|
-
...result
|
|
3522
|
-
};
|
|
3523
|
-
};
|
|
3524
|
-
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
3525
|
-
const makeSseFn = (method) => async (options) => {
|
|
3526
|
-
const { opts, url } = await beforeRequest(options);
|
|
3527
|
-
return createSseClient({
|
|
3528
|
-
...opts,
|
|
3529
|
-
body: opts.body,
|
|
3530
|
-
headers: opts.headers,
|
|
3531
|
-
method,
|
|
3532
|
-
onRequest: async (url2, init) => {
|
|
3533
|
-
let request2 = new Request(url2, init);
|
|
3534
|
-
const requestInit = {
|
|
3535
|
-
...init,
|
|
3536
|
-
method: init.method,
|
|
3537
|
-
url: url2
|
|
3538
|
-
};
|
|
3539
|
-
for (const fn of interceptors.request.fns) {
|
|
3540
|
-
if (fn) {
|
|
3541
|
-
await fn(requestInit);
|
|
3542
|
-
request2 = new Request(requestInit.url, requestInit);
|
|
3543
|
-
}
|
|
3544
|
-
}
|
|
3545
|
-
return request2;
|
|
3546
|
-
},
|
|
3547
|
-
url
|
|
3548
|
-
});
|
|
3549
|
-
};
|
|
3550
|
-
return {
|
|
3551
|
-
buildUrl,
|
|
3552
|
-
connect: makeMethodFn("CONNECT"),
|
|
3553
|
-
delete: makeMethodFn("DELETE"),
|
|
3554
|
-
get: makeMethodFn("GET"),
|
|
3555
|
-
getConfig,
|
|
3556
|
-
head: makeMethodFn("HEAD"),
|
|
3557
|
-
interceptors,
|
|
3558
|
-
options: makeMethodFn("OPTIONS"),
|
|
3559
|
-
patch: makeMethodFn("PATCH"),
|
|
3560
|
-
post: makeMethodFn("POST"),
|
|
3561
|
-
put: makeMethodFn("PUT"),
|
|
3562
|
-
request,
|
|
3563
|
-
setConfig,
|
|
3564
|
-
sse: {
|
|
3565
|
-
connect: makeSseFn("CONNECT"),
|
|
3566
|
-
delete: makeSseFn("DELETE"),
|
|
3567
|
-
get: makeSseFn("GET"),
|
|
3568
|
-
head: makeSseFn("HEAD"),
|
|
3569
|
-
options: makeSseFn("OPTIONS"),
|
|
3570
|
-
patch: makeSseFn("PATCH"),
|
|
3571
|
-
post: makeSseFn("POST"),
|
|
3572
|
-
put: makeSseFn("PUT"),
|
|
3573
|
-
trace: makeSseFn("TRACE")
|
|
3574
|
-
},
|
|
3575
|
-
trace: makeMethodFn("TRACE")
|
|
3576
|
-
};
|
|
3577
|
-
};
|
|
3578
|
-
|
|
3579
|
-
// src/client/client.gen.ts
|
|
3580
|
-
var client = createClient(createClientConfig(createConfig()));
|
|
3581
|
-
|
|
3582
|
-
// src/client/sdk.gen.ts
|
|
3583
|
-
var getApiV1Config = (options) => {
|
|
3584
|
-
return (options?.client ?? client).get({
|
|
3585
|
-
url: "/api/v1/config",
|
|
3586
|
-
...options
|
|
3587
|
-
});
|
|
3588
|
-
};
|
|
3589
|
-
var getApiV1CreditsBalance = (options) => {
|
|
3590
|
-
return (options?.client ?? client).get({
|
|
3591
|
-
url: "/api/v1/credits/balance",
|
|
3592
|
-
...options
|
|
3593
|
-
});
|
|
3594
|
-
};
|
|
3595
|
-
var getApiV1CreditsPacks = (options) => {
|
|
3596
|
-
return (options?.client ?? client).get({
|
|
3597
|
-
url: "/api/v1/credits/packs",
|
|
3598
|
-
...options
|
|
3599
|
-
});
|
|
3600
|
-
};
|
|
3601
|
-
var postApiV1CreditsPurchase = (options) => {
|
|
3602
|
-
return (options.client ?? client).post({
|
|
3603
|
-
url: "/api/v1/credits/purchase",
|
|
3604
|
-
...options,
|
|
3605
|
-
headers: {
|
|
3606
|
-
"Content-Type": "application/json",
|
|
3607
|
-
...options.headers
|
|
3608
|
-
}
|
|
3609
|
-
});
|
|
3610
|
-
};
|
|
3611
|
-
var postApiV1Embeddings = (options) => {
|
|
3612
|
-
return (options.client ?? client).post({
|
|
3613
|
-
url: "/api/v1/embeddings",
|
|
3614
|
-
...options,
|
|
3615
|
-
headers: {
|
|
3616
|
-
"Content-Type": "application/json",
|
|
3617
|
-
...options.headers
|
|
3618
|
-
}
|
|
3619
|
-
});
|
|
3620
|
-
};
|
|
3621
|
-
var getApiV1Models = (options) => {
|
|
3622
|
-
return (options?.client ?? client).get({
|
|
3623
|
-
url: "/api/v1/models",
|
|
3624
|
-
...options
|
|
3625
|
-
});
|
|
3626
|
-
};
|
|
3627
|
-
var postApiV1PhoneCalls = (options) => {
|
|
3628
|
-
return (options.client ?? client).post({
|
|
3629
|
-
url: "/api/v1/phone-calls",
|
|
3630
|
-
...options,
|
|
3631
|
-
headers: {
|
|
3632
|
-
"Content-Type": "application/json",
|
|
3633
|
-
...options.headers
|
|
3634
|
-
}
|
|
3635
|
-
});
|
|
3636
|
-
};
|
|
3637
|
-
var getApiV1PhoneCallsByCallId = (options) => {
|
|
3638
|
-
return (options.client ?? client).get({
|
|
3639
|
-
url: "/api/v1/phone-calls/{call_id}",
|
|
3640
|
-
...options
|
|
3641
|
-
});
|
|
3642
|
-
};
|
|
3643
|
-
var postApiV1SubscriptionsCancel = (options) => {
|
|
3644
|
-
return (options?.client ?? client).post({
|
|
3645
|
-
url: "/api/v1/subscriptions/cancel",
|
|
3646
|
-
...options,
|
|
3647
|
-
headers: {
|
|
3648
|
-
"Content-Type": "application/json",
|
|
3649
|
-
...options?.headers
|
|
3650
|
-
}
|
|
3651
|
-
});
|
|
3652
|
-
};
|
|
3653
|
-
var postApiV1SubscriptionsCreateCheckoutSession = (options) => {
|
|
3654
|
-
return (options.client ?? client).post({
|
|
3655
|
-
url: "/api/v1/subscriptions/create-checkout-session",
|
|
3656
|
-
...options,
|
|
3657
|
-
headers: {
|
|
3658
|
-
"Content-Type": "application/json",
|
|
3659
|
-
...options.headers
|
|
3660
|
-
}
|
|
3661
|
-
});
|
|
3662
|
-
};
|
|
3663
|
-
var postApiV1SubscriptionsCustomerPortal = (options) => {
|
|
3664
|
-
return (options.client ?? client).post({
|
|
3665
|
-
url: "/api/v1/subscriptions/customer-portal",
|
|
3666
|
-
...options,
|
|
3667
|
-
headers: {
|
|
3668
|
-
"Content-Type": "application/json",
|
|
3669
|
-
...options.headers
|
|
3670
|
-
}
|
|
3671
|
-
});
|
|
3672
|
-
};
|
|
3673
|
-
var postApiV1SubscriptionsRenew = (options) => {
|
|
3674
|
-
return (options?.client ?? client).post({
|
|
3675
|
-
url: "/api/v1/subscriptions/renew",
|
|
3676
|
-
...options
|
|
3677
|
-
});
|
|
3678
|
-
};
|
|
3679
|
-
var getApiV1SubscriptionsStatus = (options) => {
|
|
3680
|
-
return (options?.client ?? client).get({
|
|
3681
|
-
url: "/api/v1/subscriptions/status",
|
|
3682
|
-
...options
|
|
3683
|
-
});
|
|
3684
|
-
};
|
|
3685
|
-
var getApiV1WalletsBinding = (options) => {
|
|
3686
|
-
return (options?.client ?? client).get({
|
|
3687
|
-
url: "/api/v1/wallets/binding",
|
|
3688
|
-
...options
|
|
3689
|
-
});
|
|
3690
|
-
};
|
|
3691
|
-
var postApiV1WalletsBinding = (options) => {
|
|
3692
|
-
return (options.client ?? client).post({
|
|
3693
|
-
url: "/api/v1/wallets/binding",
|
|
3694
|
-
...options,
|
|
3695
|
-
headers: {
|
|
3696
|
-
"Content-Type": "application/json",
|
|
3697
|
-
...options.headers
|
|
3698
|
-
}
|
|
3699
|
-
});
|
|
3700
|
-
};
|
|
3701
|
-
var postApiV1WalletsBindingNonce = (options) => {
|
|
3702
|
-
return (options?.client ?? client).post({
|
|
3703
|
-
url: "/api/v1/wallets/binding/nonce",
|
|
3704
|
-
...options
|
|
3705
|
-
});
|
|
3706
|
-
};
|
|
3707
|
-
var deleteApiV1WalletsBindingByAddress = (options) => {
|
|
3708
|
-
return (options.client ?? client).delete({
|
|
3709
|
-
url: "/api/v1/wallets/binding/{address}",
|
|
3710
|
-
...options
|
|
3711
|
-
});
|
|
3712
|
-
};
|
|
3713
|
-
var postAuthOauthByProviderExchange = (options) => {
|
|
3714
|
-
return (options.client ?? client).post({
|
|
3715
|
-
url: "/auth/oauth/{provider}/exchange",
|
|
3716
|
-
...options,
|
|
3717
|
-
headers: {
|
|
3718
|
-
"Content-Type": "application/json",
|
|
3719
|
-
...options.headers
|
|
3720
|
-
}
|
|
3721
|
-
});
|
|
3722
|
-
};
|
|
3723
|
-
var postAuthOauthByProviderRefresh = (options) => {
|
|
3724
|
-
return (options.client ?? client).post({
|
|
3725
|
-
url: "/auth/oauth/{provider}/refresh",
|
|
3726
|
-
...options,
|
|
3727
|
-
headers: {
|
|
3728
|
-
"Content-Type": "application/json",
|
|
3729
|
-
...options.headers
|
|
3730
|
-
}
|
|
3731
|
-
});
|
|
3732
|
-
};
|
|
3733
|
-
var postAuthOauthByProviderRevoke = (options) => {
|
|
3734
|
-
return (options.client ?? client).post({
|
|
3735
|
-
url: "/auth/oauth/{provider}/revoke",
|
|
3736
|
-
...options,
|
|
3737
|
-
headers: {
|
|
3738
|
-
"Content-Type": "application/json",
|
|
3739
|
-
...options.headers
|
|
3740
|
-
}
|
|
3741
|
-
});
|
|
3742
|
-
};
|
|
3743
|
-
|
|
3744
2782
|
// src/lib/memoryEngine/chunking.ts
|
|
3745
2783
|
var DEFAULT_CHUNK_SIZE = 400;
|
|
3746
2784
|
var DEFAULT_CHUNK_OVERLAP = 50;
|
|
@@ -3876,8 +2914,8 @@ function shouldChunkMessage(content, chunkSize = DEFAULT_CHUNK_SIZE) {
|
|
|
3876
2914
|
return content.length > chunkSize;
|
|
3877
2915
|
}
|
|
3878
2916
|
|
|
3879
|
-
// src/lib/memoryEngine/
|
|
3880
|
-
|
|
2917
|
+
// src/lib/memoryEngine/generate.ts
|
|
2918
|
+
import { postApiV1Embeddings } from "@anuma/sdk";
|
|
3881
2919
|
var EMBED_MAX_ATTEMPTS = 4;
|
|
3882
2920
|
async function withEmbeddingRetry(call) {
|
|
3883
2921
|
let last;
|
|
@@ -4071,6 +3109,9 @@ async function generateEmbeddings(texts, options) {
|
|
|
4071
3109
|
}
|
|
4072
3110
|
return results;
|
|
4073
3111
|
}
|
|
3112
|
+
|
|
3113
|
+
// src/lib/memoryEngine/embeddings.ts
|
|
3114
|
+
var DEFAULT_MIN_CONTENT_LENGTH = 10;
|
|
4074
3115
|
async function embedMessage(ctx, messageId, options) {
|
|
4075
3116
|
let message;
|
|
4076
3117
|
const conversations = await getConversationsOp(ctx);
|
|
@@ -5490,7 +4531,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
5490
4531
|
legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
|
|
5491
4532
|
);
|
|
5492
4533
|
}
|
|
5493
|
-
const { recall: recall2 } = await import("./recall-
|
|
4534
|
+
const { recall: recall2 } = await import("./recall-FPACUZGD.mjs");
|
|
5494
4535
|
const result = await recall2(
|
|
5495
4536
|
query,
|
|
5496
4537
|
{ vaultCtx, embeddingOptions, vaultCache: cache },
|
|
@@ -6110,26 +5151,6 @@ function toChunkMemory(r) {
|
|
|
6110
5151
|
}
|
|
6111
5152
|
|
|
6112
5153
|
export {
|
|
6113
|
-
createSseClient,
|
|
6114
|
-
getApiV1Config,
|
|
6115
|
-
getApiV1CreditsBalance,
|
|
6116
|
-
getApiV1CreditsPacks,
|
|
6117
|
-
postApiV1CreditsPurchase,
|
|
6118
|
-
getApiV1Models,
|
|
6119
|
-
postApiV1PhoneCalls,
|
|
6120
|
-
getApiV1PhoneCallsByCallId,
|
|
6121
|
-
postApiV1SubscriptionsCancel,
|
|
6122
|
-
postApiV1SubscriptionsCreateCheckoutSession,
|
|
6123
|
-
postApiV1SubscriptionsCustomerPortal,
|
|
6124
|
-
postApiV1SubscriptionsRenew,
|
|
6125
|
-
getApiV1SubscriptionsStatus,
|
|
6126
|
-
getApiV1WalletsBinding,
|
|
6127
|
-
postApiV1WalletsBinding,
|
|
6128
|
-
postApiV1WalletsBindingNonce,
|
|
6129
|
-
deleteApiV1WalletsBindingByAddress,
|
|
6130
|
-
postAuthOauthByProviderExchange,
|
|
6131
|
-
postAuthOauthByProviderRefresh,
|
|
6132
|
-
postAuthOauthByProviderRevoke,
|
|
6133
5154
|
onClearAllEncryptionState,
|
|
6134
5155
|
onKeyAvailable,
|
|
6135
5156
|
clearEncryptionKey,
|
|
@@ -6203,9 +5224,9 @@ export {
|
|
|
6203
5224
|
chunkText,
|
|
6204
5225
|
shouldChunkMessage,
|
|
6205
5226
|
DEFAULT_API_EMBEDDING_MODEL,
|
|
6206
|
-
DEFAULT_MIN_CONTENT_LENGTH,
|
|
6207
5227
|
generateEmbedding,
|
|
6208
5228
|
generateEmbeddings,
|
|
5229
|
+
DEFAULT_MIN_CONTENT_LENGTH,
|
|
6209
5230
|
embedMessage,
|
|
6210
5231
|
embedAllMessages,
|
|
6211
5232
|
chunkAndEmbedMessage,
|