@standardagents/builder 0.45.0 → 0.45.2
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/built-in-routes.js +1 -1
- package/dist/runtime.js +670 -673
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -6
package/dist/runtime.js
CHANGED
|
@@ -12,9 +12,6 @@ import { jsonPathReader } from '@formkit/jsonreader';
|
|
|
12
12
|
import { DurableObject, WorkerEntrypoint, RpcTarget } from 'cloudflare:workers';
|
|
13
13
|
import { isLogStreamEvent } from '@standardagents/client/protocol';
|
|
14
14
|
import { transform, collect } from '@standardagents/sip';
|
|
15
|
-
import 'fs';
|
|
16
|
-
import 'path';
|
|
17
|
-
import 'typescript';
|
|
18
15
|
|
|
19
16
|
var __create = Object.create;
|
|
20
17
|
var __defProp = Object.defineProperty;
|
|
@@ -18670,7 +18667,7 @@ var init_web = __esm({
|
|
|
18670
18667
|
params
|
|
18671
18668
|
);
|
|
18672
18669
|
const urlParams = body["_url"];
|
|
18673
|
-
const
|
|
18670
|
+
const path3 = formatMap("{model}:batchGenerateContent", urlParams);
|
|
18674
18671
|
const batch = body["batch"];
|
|
18675
18672
|
const inputConfig = batch["inputConfig"];
|
|
18676
18673
|
const requestsWrapper = inputConfig["requests"];
|
|
@@ -18691,7 +18688,7 @@ var init_web = __esm({
|
|
|
18691
18688
|
delete body["config"];
|
|
18692
18689
|
delete body["_url"];
|
|
18693
18690
|
delete body["_query"];
|
|
18694
|
-
return { path:
|
|
18691
|
+
return { path: path3, body };
|
|
18695
18692
|
}
|
|
18696
18693
|
// Helper function to get the first GCS URI
|
|
18697
18694
|
getGcsUri(src) {
|
|
@@ -18747,16 +18744,16 @@ var init_web = __esm({
|
|
|
18747
18744
|
async createInternal(params) {
|
|
18748
18745
|
var _a16, _b16, _c, _d;
|
|
18749
18746
|
let response;
|
|
18750
|
-
let
|
|
18747
|
+
let path3 = "";
|
|
18751
18748
|
let queryParams = {};
|
|
18752
18749
|
if (this.apiClient.isVertexAI()) {
|
|
18753
18750
|
const body = createBatchJobParametersToVertex(this.apiClient, params);
|
|
18754
|
-
|
|
18751
|
+
path3 = formatMap("batchPredictionJobs", body["_url"]);
|
|
18755
18752
|
queryParams = body["_query"];
|
|
18756
18753
|
delete body["_url"];
|
|
18757
18754
|
delete body["_query"];
|
|
18758
18755
|
response = this.apiClient.request({
|
|
18759
|
-
path:
|
|
18756
|
+
path: path3,
|
|
18760
18757
|
queryParams,
|
|
18761
18758
|
body: JSON.stringify(body),
|
|
18762
18759
|
httpMethod: "POST",
|
|
@@ -18771,12 +18768,12 @@ var init_web = __esm({
|
|
|
18771
18768
|
});
|
|
18772
18769
|
} else {
|
|
18773
18770
|
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
18774
|
-
|
|
18771
|
+
path3 = formatMap("{model}:batchGenerateContent", body["_url"]);
|
|
18775
18772
|
queryParams = body["_query"];
|
|
18776
18773
|
delete body["_url"];
|
|
18777
18774
|
delete body["_query"];
|
|
18778
18775
|
response = this.apiClient.request({
|
|
18779
|
-
path:
|
|
18776
|
+
path: path3,
|
|
18780
18777
|
queryParams,
|
|
18781
18778
|
body: JSON.stringify(body),
|
|
18782
18779
|
httpMethod: "POST",
|
|
@@ -18801,18 +18798,18 @@ var init_web = __esm({
|
|
|
18801
18798
|
async createEmbeddingsInternal(params) {
|
|
18802
18799
|
var _a16, _b16;
|
|
18803
18800
|
let response;
|
|
18804
|
-
let
|
|
18801
|
+
let path3 = "";
|
|
18805
18802
|
let queryParams = {};
|
|
18806
18803
|
if (this.apiClient.isVertexAI()) {
|
|
18807
18804
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
18808
18805
|
} else {
|
|
18809
18806
|
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
18810
|
-
|
|
18807
|
+
path3 = formatMap("{model}:asyncBatchEmbedContent", body["_url"]);
|
|
18811
18808
|
queryParams = body["_query"];
|
|
18812
18809
|
delete body["_url"];
|
|
18813
18810
|
delete body["_query"];
|
|
18814
18811
|
response = this.apiClient.request({
|
|
18815
|
-
path:
|
|
18812
|
+
path: path3,
|
|
18816
18813
|
queryParams,
|
|
18817
18814
|
body: JSON.stringify(body),
|
|
18818
18815
|
httpMethod: "POST",
|
|
@@ -18841,16 +18838,16 @@ var init_web = __esm({
|
|
|
18841
18838
|
async get(params) {
|
|
18842
18839
|
var _a16, _b16, _c, _d;
|
|
18843
18840
|
let response;
|
|
18844
|
-
let
|
|
18841
|
+
let path3 = "";
|
|
18845
18842
|
let queryParams = {};
|
|
18846
18843
|
if (this.apiClient.isVertexAI()) {
|
|
18847
18844
|
const body = getBatchJobParametersToVertex(this.apiClient, params);
|
|
18848
|
-
|
|
18845
|
+
path3 = formatMap("batchPredictionJobs/{name}", body["_url"]);
|
|
18849
18846
|
queryParams = body["_query"];
|
|
18850
18847
|
delete body["_url"];
|
|
18851
18848
|
delete body["_query"];
|
|
18852
18849
|
response = this.apiClient.request({
|
|
18853
|
-
path:
|
|
18850
|
+
path: path3,
|
|
18854
18851
|
queryParams,
|
|
18855
18852
|
body: JSON.stringify(body),
|
|
18856
18853
|
httpMethod: "GET",
|
|
@@ -18865,12 +18862,12 @@ var init_web = __esm({
|
|
|
18865
18862
|
});
|
|
18866
18863
|
} else {
|
|
18867
18864
|
const body = getBatchJobParametersToMldev(this.apiClient, params);
|
|
18868
|
-
|
|
18865
|
+
path3 = formatMap("batches/{name}", body["_url"]);
|
|
18869
18866
|
queryParams = body["_query"];
|
|
18870
18867
|
delete body["_url"];
|
|
18871
18868
|
delete body["_query"];
|
|
18872
18869
|
response = this.apiClient.request({
|
|
18873
|
-
path:
|
|
18870
|
+
path: path3,
|
|
18874
18871
|
queryParams,
|
|
18875
18872
|
body: JSON.stringify(body),
|
|
18876
18873
|
httpMethod: "GET",
|
|
@@ -18898,16 +18895,16 @@ var init_web = __esm({
|
|
|
18898
18895
|
*/
|
|
18899
18896
|
async cancel(params) {
|
|
18900
18897
|
var _a16, _b16, _c, _d;
|
|
18901
|
-
let
|
|
18898
|
+
let path3 = "";
|
|
18902
18899
|
let queryParams = {};
|
|
18903
18900
|
if (this.apiClient.isVertexAI()) {
|
|
18904
18901
|
const body = cancelBatchJobParametersToVertex(this.apiClient, params);
|
|
18905
|
-
|
|
18902
|
+
path3 = formatMap("batchPredictionJobs/{name}:cancel", body["_url"]);
|
|
18906
18903
|
queryParams = body["_query"];
|
|
18907
18904
|
delete body["_url"];
|
|
18908
18905
|
delete body["_query"];
|
|
18909
18906
|
await this.apiClient.request({
|
|
18910
|
-
path:
|
|
18907
|
+
path: path3,
|
|
18911
18908
|
queryParams,
|
|
18912
18909
|
body: JSON.stringify(body),
|
|
18913
18910
|
httpMethod: "POST",
|
|
@@ -18916,12 +18913,12 @@ var init_web = __esm({
|
|
|
18916
18913
|
});
|
|
18917
18914
|
} else {
|
|
18918
18915
|
const body = cancelBatchJobParametersToMldev(this.apiClient, params);
|
|
18919
|
-
|
|
18916
|
+
path3 = formatMap("batches/{name}:cancel", body["_url"]);
|
|
18920
18917
|
queryParams = body["_query"];
|
|
18921
18918
|
delete body["_url"];
|
|
18922
18919
|
delete body["_query"];
|
|
18923
18920
|
await this.apiClient.request({
|
|
18924
|
-
path:
|
|
18921
|
+
path: path3,
|
|
18925
18922
|
queryParams,
|
|
18926
18923
|
body: JSON.stringify(body),
|
|
18927
18924
|
httpMethod: "POST",
|
|
@@ -18933,16 +18930,16 @@ var init_web = __esm({
|
|
|
18933
18930
|
async listInternal(params) {
|
|
18934
18931
|
var _a16, _b16, _c, _d;
|
|
18935
18932
|
let response;
|
|
18936
|
-
let
|
|
18933
|
+
let path3 = "";
|
|
18937
18934
|
let queryParams = {};
|
|
18938
18935
|
if (this.apiClient.isVertexAI()) {
|
|
18939
18936
|
const body = listBatchJobsParametersToVertex(params);
|
|
18940
|
-
|
|
18937
|
+
path3 = formatMap("batchPredictionJobs", body["_url"]);
|
|
18941
18938
|
queryParams = body["_query"];
|
|
18942
18939
|
delete body["_url"];
|
|
18943
18940
|
delete body["_query"];
|
|
18944
18941
|
response = this.apiClient.request({
|
|
18945
|
-
path:
|
|
18942
|
+
path: path3,
|
|
18946
18943
|
queryParams,
|
|
18947
18944
|
body: JSON.stringify(body),
|
|
18948
18945
|
httpMethod: "GET",
|
|
@@ -18965,12 +18962,12 @@ var init_web = __esm({
|
|
|
18965
18962
|
});
|
|
18966
18963
|
} else {
|
|
18967
18964
|
const body = listBatchJobsParametersToMldev(params);
|
|
18968
|
-
|
|
18965
|
+
path3 = formatMap("batches", body["_url"]);
|
|
18969
18966
|
queryParams = body["_query"];
|
|
18970
18967
|
delete body["_url"];
|
|
18971
18968
|
delete body["_query"];
|
|
18972
18969
|
response = this.apiClient.request({
|
|
18973
|
-
path:
|
|
18970
|
+
path: path3,
|
|
18974
18971
|
queryParams,
|
|
18975
18972
|
body: JSON.stringify(body),
|
|
18976
18973
|
httpMethod: "GET",
|
|
@@ -19007,16 +19004,16 @@ var init_web = __esm({
|
|
|
19007
19004
|
async delete(params) {
|
|
19008
19005
|
var _a16, _b16, _c, _d;
|
|
19009
19006
|
let response;
|
|
19010
|
-
let
|
|
19007
|
+
let path3 = "";
|
|
19011
19008
|
let queryParams = {};
|
|
19012
19009
|
if (this.apiClient.isVertexAI()) {
|
|
19013
19010
|
const body = deleteBatchJobParametersToVertex(this.apiClient, params);
|
|
19014
|
-
|
|
19011
|
+
path3 = formatMap("batchPredictionJobs/{name}", body["_url"]);
|
|
19015
19012
|
queryParams = body["_query"];
|
|
19016
19013
|
delete body["_url"];
|
|
19017
19014
|
delete body["_query"];
|
|
19018
19015
|
response = this.apiClient.request({
|
|
19019
|
-
path:
|
|
19016
|
+
path: path3,
|
|
19020
19017
|
queryParams,
|
|
19021
19018
|
body: JSON.stringify(body),
|
|
19022
19019
|
httpMethod: "DELETE",
|
|
@@ -19037,12 +19034,12 @@ var init_web = __esm({
|
|
|
19037
19034
|
});
|
|
19038
19035
|
} else {
|
|
19039
19036
|
const body = deleteBatchJobParametersToMldev(this.apiClient, params);
|
|
19040
|
-
|
|
19037
|
+
path3 = formatMap("batches/{name}", body["_url"]);
|
|
19041
19038
|
queryParams = body["_query"];
|
|
19042
19039
|
delete body["_url"];
|
|
19043
19040
|
delete body["_query"];
|
|
19044
19041
|
response = this.apiClient.request({
|
|
19045
|
-
path:
|
|
19042
|
+
path: path3,
|
|
19046
19043
|
queryParams,
|
|
19047
19044
|
body: JSON.stringify(body),
|
|
19048
19045
|
httpMethod: "DELETE",
|
|
@@ -19101,16 +19098,16 @@ var init_web = __esm({
|
|
|
19101
19098
|
async create(params) {
|
|
19102
19099
|
var _a16, _b16, _c, _d;
|
|
19103
19100
|
let response;
|
|
19104
|
-
let
|
|
19101
|
+
let path3 = "";
|
|
19105
19102
|
let queryParams = {};
|
|
19106
19103
|
if (this.apiClient.isVertexAI()) {
|
|
19107
19104
|
const body = createCachedContentParametersToVertex(this.apiClient, params);
|
|
19108
|
-
|
|
19105
|
+
path3 = formatMap("cachedContents", body["_url"]);
|
|
19109
19106
|
queryParams = body["_query"];
|
|
19110
19107
|
delete body["_url"];
|
|
19111
19108
|
delete body["_query"];
|
|
19112
19109
|
response = this.apiClient.request({
|
|
19113
|
-
path:
|
|
19110
|
+
path: path3,
|
|
19114
19111
|
queryParams,
|
|
19115
19112
|
body: JSON.stringify(body),
|
|
19116
19113
|
httpMethod: "POST",
|
|
@@ -19124,12 +19121,12 @@ var init_web = __esm({
|
|
|
19124
19121
|
});
|
|
19125
19122
|
} else {
|
|
19126
19123
|
const body = createCachedContentParametersToMldev(this.apiClient, params);
|
|
19127
|
-
|
|
19124
|
+
path3 = formatMap("cachedContents", body["_url"]);
|
|
19128
19125
|
queryParams = body["_query"];
|
|
19129
19126
|
delete body["_url"];
|
|
19130
19127
|
delete body["_query"];
|
|
19131
19128
|
response = this.apiClient.request({
|
|
19132
|
-
path:
|
|
19129
|
+
path: path3,
|
|
19133
19130
|
queryParams,
|
|
19134
19131
|
body: JSON.stringify(body),
|
|
19135
19132
|
httpMethod: "POST",
|
|
@@ -19157,16 +19154,16 @@ var init_web = __esm({
|
|
|
19157
19154
|
async get(params) {
|
|
19158
19155
|
var _a16, _b16, _c, _d;
|
|
19159
19156
|
let response;
|
|
19160
|
-
let
|
|
19157
|
+
let path3 = "";
|
|
19161
19158
|
let queryParams = {};
|
|
19162
19159
|
if (this.apiClient.isVertexAI()) {
|
|
19163
19160
|
const body = getCachedContentParametersToVertex(this.apiClient, params);
|
|
19164
|
-
|
|
19161
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19165
19162
|
queryParams = body["_query"];
|
|
19166
19163
|
delete body["_url"];
|
|
19167
19164
|
delete body["_query"];
|
|
19168
19165
|
response = this.apiClient.request({
|
|
19169
|
-
path:
|
|
19166
|
+
path: path3,
|
|
19170
19167
|
queryParams,
|
|
19171
19168
|
body: JSON.stringify(body),
|
|
19172
19169
|
httpMethod: "GET",
|
|
@@ -19180,12 +19177,12 @@ var init_web = __esm({
|
|
|
19180
19177
|
});
|
|
19181
19178
|
} else {
|
|
19182
19179
|
const body = getCachedContentParametersToMldev(this.apiClient, params);
|
|
19183
|
-
|
|
19180
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19184
19181
|
queryParams = body["_query"];
|
|
19185
19182
|
delete body["_url"];
|
|
19186
19183
|
delete body["_query"];
|
|
19187
19184
|
response = this.apiClient.request({
|
|
19188
|
-
path:
|
|
19185
|
+
path: path3,
|
|
19189
19186
|
queryParams,
|
|
19190
19187
|
body: JSON.stringify(body),
|
|
19191
19188
|
httpMethod: "GET",
|
|
@@ -19213,16 +19210,16 @@ var init_web = __esm({
|
|
|
19213
19210
|
async delete(params) {
|
|
19214
19211
|
var _a16, _b16, _c, _d;
|
|
19215
19212
|
let response;
|
|
19216
|
-
let
|
|
19213
|
+
let path3 = "";
|
|
19217
19214
|
let queryParams = {};
|
|
19218
19215
|
if (this.apiClient.isVertexAI()) {
|
|
19219
19216
|
const body = deleteCachedContentParametersToVertex(this.apiClient, params);
|
|
19220
|
-
|
|
19217
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19221
19218
|
queryParams = body["_query"];
|
|
19222
19219
|
delete body["_url"];
|
|
19223
19220
|
delete body["_query"];
|
|
19224
19221
|
response = this.apiClient.request({
|
|
19225
|
-
path:
|
|
19222
|
+
path: path3,
|
|
19226
19223
|
queryParams,
|
|
19227
19224
|
body: JSON.stringify(body),
|
|
19228
19225
|
httpMethod: "DELETE",
|
|
@@ -19245,12 +19242,12 @@ var init_web = __esm({
|
|
|
19245
19242
|
});
|
|
19246
19243
|
} else {
|
|
19247
19244
|
const body = deleteCachedContentParametersToMldev(this.apiClient, params);
|
|
19248
|
-
|
|
19245
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19249
19246
|
queryParams = body["_query"];
|
|
19250
19247
|
delete body["_url"];
|
|
19251
19248
|
delete body["_query"];
|
|
19252
19249
|
response = this.apiClient.request({
|
|
19253
|
-
path:
|
|
19250
|
+
path: path3,
|
|
19254
19251
|
queryParams,
|
|
19255
19252
|
body: JSON.stringify(body),
|
|
19256
19253
|
httpMethod: "DELETE",
|
|
@@ -19290,16 +19287,16 @@ var init_web = __esm({
|
|
|
19290
19287
|
async update(params) {
|
|
19291
19288
|
var _a16, _b16, _c, _d;
|
|
19292
19289
|
let response;
|
|
19293
|
-
let
|
|
19290
|
+
let path3 = "";
|
|
19294
19291
|
let queryParams = {};
|
|
19295
19292
|
if (this.apiClient.isVertexAI()) {
|
|
19296
19293
|
const body = updateCachedContentParametersToVertex(this.apiClient, params);
|
|
19297
|
-
|
|
19294
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19298
19295
|
queryParams = body["_query"];
|
|
19299
19296
|
delete body["_url"];
|
|
19300
19297
|
delete body["_query"];
|
|
19301
19298
|
response = this.apiClient.request({
|
|
19302
|
-
path:
|
|
19299
|
+
path: path3,
|
|
19303
19300
|
queryParams,
|
|
19304
19301
|
body: JSON.stringify(body),
|
|
19305
19302
|
httpMethod: "PATCH",
|
|
@@ -19313,12 +19310,12 @@ var init_web = __esm({
|
|
|
19313
19310
|
});
|
|
19314
19311
|
} else {
|
|
19315
19312
|
const body = updateCachedContentParametersToMldev(this.apiClient, params);
|
|
19316
|
-
|
|
19313
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
19317
19314
|
queryParams = body["_query"];
|
|
19318
19315
|
delete body["_url"];
|
|
19319
19316
|
delete body["_query"];
|
|
19320
19317
|
response = this.apiClient.request({
|
|
19321
|
-
path:
|
|
19318
|
+
path: path3,
|
|
19322
19319
|
queryParams,
|
|
19323
19320
|
body: JSON.stringify(body),
|
|
19324
19321
|
httpMethod: "PATCH",
|
|
@@ -19335,16 +19332,16 @@ var init_web = __esm({
|
|
|
19335
19332
|
async listInternal(params) {
|
|
19336
19333
|
var _a16, _b16, _c, _d;
|
|
19337
19334
|
let response;
|
|
19338
|
-
let
|
|
19335
|
+
let path3 = "";
|
|
19339
19336
|
let queryParams = {};
|
|
19340
19337
|
if (this.apiClient.isVertexAI()) {
|
|
19341
19338
|
const body = listCachedContentsParametersToVertex(params);
|
|
19342
|
-
|
|
19339
|
+
path3 = formatMap("cachedContents", body["_url"]);
|
|
19343
19340
|
queryParams = body["_query"];
|
|
19344
19341
|
delete body["_url"];
|
|
19345
19342
|
delete body["_query"];
|
|
19346
19343
|
response = this.apiClient.request({
|
|
19347
|
-
path:
|
|
19344
|
+
path: path3,
|
|
19348
19345
|
queryParams,
|
|
19349
19346
|
body: JSON.stringify(body),
|
|
19350
19347
|
httpMethod: "GET",
|
|
@@ -19367,12 +19364,12 @@ var init_web = __esm({
|
|
|
19367
19364
|
});
|
|
19368
19365
|
} else {
|
|
19369
19366
|
const body = listCachedContentsParametersToMldev(params);
|
|
19370
|
-
|
|
19367
|
+
path3 = formatMap("cachedContents", body["_url"]);
|
|
19371
19368
|
queryParams = body["_query"];
|
|
19372
19369
|
delete body["_url"];
|
|
19373
19370
|
delete body["_query"];
|
|
19374
19371
|
response = this.apiClient.request({
|
|
19375
|
-
path:
|
|
19372
|
+
path: path3,
|
|
19376
19373
|
queryParams,
|
|
19377
19374
|
body: JSON.stringify(body),
|
|
19378
19375
|
httpMethod: "GET",
|
|
@@ -19703,18 +19700,18 @@ var init_web = __esm({
|
|
|
19703
19700
|
async listInternal(params) {
|
|
19704
19701
|
var _a16, _b16;
|
|
19705
19702
|
let response;
|
|
19706
|
-
let
|
|
19703
|
+
let path3 = "";
|
|
19707
19704
|
let queryParams = {};
|
|
19708
19705
|
if (this.apiClient.isVertexAI()) {
|
|
19709
19706
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
19710
19707
|
} else {
|
|
19711
19708
|
const body = listFilesParametersToMldev(params);
|
|
19712
|
-
|
|
19709
|
+
path3 = formatMap("files", body["_url"]);
|
|
19713
19710
|
queryParams = body["_query"];
|
|
19714
19711
|
delete body["_url"];
|
|
19715
19712
|
delete body["_query"];
|
|
19716
19713
|
response = this.apiClient.request({
|
|
19717
|
-
path:
|
|
19714
|
+
path: path3,
|
|
19718
19715
|
queryParams,
|
|
19719
19716
|
body: JSON.stringify(body),
|
|
19720
19717
|
httpMethod: "GET",
|
|
@@ -19740,18 +19737,18 @@ var init_web = __esm({
|
|
|
19740
19737
|
async createInternal(params) {
|
|
19741
19738
|
var _a16, _b16;
|
|
19742
19739
|
let response;
|
|
19743
|
-
let
|
|
19740
|
+
let path3 = "";
|
|
19744
19741
|
let queryParams = {};
|
|
19745
19742
|
if (this.apiClient.isVertexAI()) {
|
|
19746
19743
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
19747
19744
|
} else {
|
|
19748
19745
|
const body = createFileParametersToMldev(params);
|
|
19749
|
-
|
|
19746
|
+
path3 = formatMap("upload/v1beta/files", body["_url"]);
|
|
19750
19747
|
queryParams = body["_query"];
|
|
19751
19748
|
delete body["_url"];
|
|
19752
19749
|
delete body["_query"];
|
|
19753
19750
|
response = this.apiClient.request({
|
|
19754
|
-
path:
|
|
19751
|
+
path: path3,
|
|
19755
19752
|
queryParams,
|
|
19756
19753
|
body: JSON.stringify(body),
|
|
19757
19754
|
httpMethod: "POST",
|
|
@@ -19786,18 +19783,18 @@ var init_web = __esm({
|
|
|
19786
19783
|
async get(params) {
|
|
19787
19784
|
var _a16, _b16;
|
|
19788
19785
|
let response;
|
|
19789
|
-
let
|
|
19786
|
+
let path3 = "";
|
|
19790
19787
|
let queryParams = {};
|
|
19791
19788
|
if (this.apiClient.isVertexAI()) {
|
|
19792
19789
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
19793
19790
|
} else {
|
|
19794
19791
|
const body = getFileParametersToMldev(params);
|
|
19795
|
-
|
|
19792
|
+
path3 = formatMap("files/{file}", body["_url"]);
|
|
19796
19793
|
queryParams = body["_query"];
|
|
19797
19794
|
delete body["_url"];
|
|
19798
19795
|
delete body["_query"];
|
|
19799
19796
|
response = this.apiClient.request({
|
|
19800
|
-
path:
|
|
19797
|
+
path: path3,
|
|
19801
19798
|
queryParams,
|
|
19802
19799
|
body: JSON.stringify(body),
|
|
19803
19800
|
httpMethod: "GET",
|
|
@@ -19827,18 +19824,18 @@ var init_web = __esm({
|
|
|
19827
19824
|
async delete(params) {
|
|
19828
19825
|
var _a16, _b16;
|
|
19829
19826
|
let response;
|
|
19830
|
-
let
|
|
19827
|
+
let path3 = "";
|
|
19831
19828
|
let queryParams = {};
|
|
19832
19829
|
if (this.apiClient.isVertexAI()) {
|
|
19833
19830
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
19834
19831
|
} else {
|
|
19835
19832
|
const body = deleteFileParametersToMldev(params);
|
|
19836
|
-
|
|
19833
|
+
path3 = formatMap("files/{file}", body["_url"]);
|
|
19837
19834
|
queryParams = body["_query"];
|
|
19838
19835
|
delete body["_url"];
|
|
19839
19836
|
delete body["_query"];
|
|
19840
19837
|
response = this.apiClient.request({
|
|
19841
|
-
path:
|
|
19838
|
+
path: path3,
|
|
19842
19839
|
queryParams,
|
|
19843
19840
|
body: JSON.stringify(body),
|
|
19844
19841
|
httpMethod: "DELETE",
|
|
@@ -19864,18 +19861,18 @@ var init_web = __esm({
|
|
|
19864
19861
|
async registerFilesInternal(params) {
|
|
19865
19862
|
var _a16, _b16;
|
|
19866
19863
|
let response;
|
|
19867
|
-
let
|
|
19864
|
+
let path3 = "";
|
|
19868
19865
|
let queryParams = {};
|
|
19869
19866
|
if (this.apiClient.isVertexAI()) {
|
|
19870
19867
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
19871
19868
|
} else {
|
|
19872
19869
|
const body = internalRegisterFilesParametersToMldev(params);
|
|
19873
|
-
|
|
19870
|
+
path3 = formatMap("files:register", body["_url"]);
|
|
19874
19871
|
queryParams = body["_query"];
|
|
19875
19872
|
delete body["_url"];
|
|
19876
19873
|
delete body["_query"];
|
|
19877
19874
|
response = this.apiClient.request({
|
|
19878
|
-
path:
|
|
19875
|
+
path: path3,
|
|
19879
19876
|
queryParams,
|
|
19880
19877
|
body: JSON.stringify(body),
|
|
19881
19878
|
httpMethod: "POST",
|
|
@@ -20034,13 +20031,13 @@ var init_web = __esm({
|
|
|
20034
20031
|
throw new Error("HTTP options are not correctly set.");
|
|
20035
20032
|
}
|
|
20036
20033
|
}
|
|
20037
|
-
constructUrl(
|
|
20034
|
+
constructUrl(path3, httpOptions, prependProjectLocation) {
|
|
20038
20035
|
const urlElement = [this.getRequestUrlInternal(httpOptions)];
|
|
20039
20036
|
if (prependProjectLocation) {
|
|
20040
20037
|
urlElement.push(this.getBaseResourcePath());
|
|
20041
20038
|
}
|
|
20042
|
-
if (
|
|
20043
|
-
urlElement.push(
|
|
20039
|
+
if (path3 !== "") {
|
|
20040
|
+
urlElement.push(path3);
|
|
20044
20041
|
}
|
|
20045
20042
|
const url = new URL(`${urlElement.join("/")}`);
|
|
20046
20043
|
return url;
|
|
@@ -20325,8 +20322,8 @@ var init_web = __esm({
|
|
|
20325
20322
|
file: fileToUpload
|
|
20326
20323
|
};
|
|
20327
20324
|
const fileName = this.getFileName(file);
|
|
20328
|
-
const
|
|
20329
|
-
const uploadUrl = await this.fetchUploadUrl(
|
|
20325
|
+
const path3 = formatMap("upload/v1beta/files", body["_url"]);
|
|
20326
|
+
const uploadUrl = await this.fetchUploadUrl(path3, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
20330
20327
|
return uploader.upload(file, uploadUrl, this);
|
|
20331
20328
|
}
|
|
20332
20329
|
/**
|
|
@@ -20350,13 +20347,13 @@ var init_web = __esm({
|
|
|
20350
20347
|
if (mimeType === void 0 || mimeType === "") {
|
|
20351
20348
|
throw new Error("Can not determine mimeType. Please provide mimeType in the config.");
|
|
20352
20349
|
}
|
|
20353
|
-
const
|
|
20350
|
+
const path3 = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
|
|
20354
20351
|
const fileName = this.getFileName(file);
|
|
20355
20352
|
const body = {};
|
|
20356
20353
|
if (config != null) {
|
|
20357
20354
|
uploadToFileSearchStoreConfigToMldev(config, body);
|
|
20358
20355
|
}
|
|
20359
|
-
const uploadUrl = await this.fetchUploadUrl(
|
|
20356
|
+
const uploadUrl = await this.fetchUploadUrl(path3, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
20360
20357
|
return uploader.uploadToFileSearchStore(file, uploadUrl, this);
|
|
20361
20358
|
}
|
|
20362
20359
|
/**
|
|
@@ -20369,7 +20366,7 @@ var init_web = __esm({
|
|
|
20369
20366
|
const downloader = this.clientOptions.downloader;
|
|
20370
20367
|
await downloader.download(params, this);
|
|
20371
20368
|
}
|
|
20372
|
-
async fetchUploadUrl(
|
|
20369
|
+
async fetchUploadUrl(path3, sizeBytes, mimeType, fileName, body, configHttpOptions) {
|
|
20373
20370
|
var _a16;
|
|
20374
20371
|
let httpOptions = {};
|
|
20375
20372
|
if (configHttpOptions) {
|
|
@@ -20382,7 +20379,7 @@ var init_web = __esm({
|
|
|
20382
20379
|
};
|
|
20383
20380
|
}
|
|
20384
20381
|
const httpResponse = await this.request({
|
|
20385
|
-
path:
|
|
20382
|
+
path: path3,
|
|
20386
20383
|
body: JSON.stringify(body),
|
|
20387
20384
|
httpMethod: "POST",
|
|
20388
20385
|
httpOptions
|
|
@@ -21355,16 +21352,16 @@ var init_web = __esm({
|
|
|
21355
21352
|
async generateContentInternal(params) {
|
|
21356
21353
|
var _a16, _b16, _c, _d;
|
|
21357
21354
|
let response;
|
|
21358
|
-
let
|
|
21355
|
+
let path3 = "";
|
|
21359
21356
|
let queryParams = {};
|
|
21360
21357
|
if (this.apiClient.isVertexAI()) {
|
|
21361
21358
|
const body = generateContentParametersToVertex(this.apiClient, params);
|
|
21362
|
-
|
|
21359
|
+
path3 = formatMap("{model}:generateContent", body["_url"]);
|
|
21363
21360
|
queryParams = body["_query"];
|
|
21364
21361
|
delete body["_url"];
|
|
21365
21362
|
delete body["_query"];
|
|
21366
21363
|
response = this.apiClient.request({
|
|
21367
|
-
path:
|
|
21364
|
+
path: path3,
|
|
21368
21365
|
queryParams,
|
|
21369
21366
|
body: JSON.stringify(body),
|
|
21370
21367
|
httpMethod: "POST",
|
|
@@ -21387,12 +21384,12 @@ var init_web = __esm({
|
|
|
21387
21384
|
});
|
|
21388
21385
|
} else {
|
|
21389
21386
|
const body = generateContentParametersToMldev(this.apiClient, params);
|
|
21390
|
-
|
|
21387
|
+
path3 = formatMap("{model}:generateContent", body["_url"]);
|
|
21391
21388
|
queryParams = body["_query"];
|
|
21392
21389
|
delete body["_url"];
|
|
21393
21390
|
delete body["_query"];
|
|
21394
21391
|
response = this.apiClient.request({
|
|
21395
|
-
path:
|
|
21392
|
+
path: path3,
|
|
21396
21393
|
queryParams,
|
|
21397
21394
|
body: JSON.stringify(body),
|
|
21398
21395
|
httpMethod: "POST",
|
|
@@ -21418,17 +21415,17 @@ var init_web = __esm({
|
|
|
21418
21415
|
async generateContentStreamInternal(params) {
|
|
21419
21416
|
var _a16, _b16, _c, _d;
|
|
21420
21417
|
let response;
|
|
21421
|
-
let
|
|
21418
|
+
let path3 = "";
|
|
21422
21419
|
let queryParams = {};
|
|
21423
21420
|
if (this.apiClient.isVertexAI()) {
|
|
21424
21421
|
const body = generateContentParametersToVertex(this.apiClient, params);
|
|
21425
|
-
|
|
21422
|
+
path3 = formatMap("{model}:streamGenerateContent?alt=sse", body["_url"]);
|
|
21426
21423
|
queryParams = body["_query"];
|
|
21427
21424
|
delete body["_url"];
|
|
21428
21425
|
delete body["_query"];
|
|
21429
21426
|
const apiClient = this.apiClient;
|
|
21430
21427
|
response = apiClient.requestStream({
|
|
21431
|
-
path:
|
|
21428
|
+
path: path3,
|
|
21432
21429
|
queryParams,
|
|
21433
21430
|
body: JSON.stringify(body),
|
|
21434
21431
|
httpMethod: "POST",
|
|
@@ -21464,13 +21461,13 @@ var init_web = __esm({
|
|
|
21464
21461
|
});
|
|
21465
21462
|
} else {
|
|
21466
21463
|
const body = generateContentParametersToMldev(this.apiClient, params);
|
|
21467
|
-
|
|
21464
|
+
path3 = formatMap("{model}:streamGenerateContent?alt=sse", body["_url"]);
|
|
21468
21465
|
queryParams = body["_query"];
|
|
21469
21466
|
delete body["_url"];
|
|
21470
21467
|
delete body["_query"];
|
|
21471
21468
|
const apiClient = this.apiClient;
|
|
21472
21469
|
response = apiClient.requestStream({
|
|
21473
|
-
path:
|
|
21470
|
+
path: path3,
|
|
21474
21471
|
queryParams,
|
|
21475
21472
|
body: JSON.stringify(body),
|
|
21476
21473
|
httpMethod: "POST",
|
|
@@ -21530,17 +21527,17 @@ var init_web = __esm({
|
|
|
21530
21527
|
async embedContentInternal(params) {
|
|
21531
21528
|
var _a16, _b16, _c, _d;
|
|
21532
21529
|
let response;
|
|
21533
|
-
let
|
|
21530
|
+
let path3 = "";
|
|
21534
21531
|
let queryParams = {};
|
|
21535
21532
|
if (this.apiClient.isVertexAI()) {
|
|
21536
21533
|
const body = embedContentParametersPrivateToVertex(this.apiClient, params, params);
|
|
21537
21534
|
const endpointUrl = tIsVertexEmbedContentModel(params.model) ? "{model}:embedContent" : "{model}:predict";
|
|
21538
|
-
|
|
21535
|
+
path3 = formatMap(endpointUrl, body["_url"]);
|
|
21539
21536
|
queryParams = body["_query"];
|
|
21540
21537
|
delete body["_url"];
|
|
21541
21538
|
delete body["_query"];
|
|
21542
21539
|
response = this.apiClient.request({
|
|
21543
|
-
path:
|
|
21540
|
+
path: path3,
|
|
21544
21541
|
queryParams,
|
|
21545
21542
|
body: JSON.stringify(body),
|
|
21546
21543
|
httpMethod: "POST",
|
|
@@ -21563,12 +21560,12 @@ var init_web = __esm({
|
|
|
21563
21560
|
});
|
|
21564
21561
|
} else {
|
|
21565
21562
|
const body = embedContentParametersPrivateToMldev(this.apiClient, params);
|
|
21566
|
-
|
|
21563
|
+
path3 = formatMap("{model}:batchEmbedContents", body["_url"]);
|
|
21567
21564
|
queryParams = body["_query"];
|
|
21568
21565
|
delete body["_url"];
|
|
21569
21566
|
delete body["_query"];
|
|
21570
21567
|
response = this.apiClient.request({
|
|
21571
|
-
path:
|
|
21568
|
+
path: path3,
|
|
21572
21569
|
queryParams,
|
|
21573
21570
|
body: JSON.stringify(body),
|
|
21574
21571
|
httpMethod: "POST",
|
|
@@ -21597,16 +21594,16 @@ var init_web = __esm({
|
|
|
21597
21594
|
async generateImagesInternal(params) {
|
|
21598
21595
|
var _a16, _b16, _c, _d;
|
|
21599
21596
|
let response;
|
|
21600
|
-
let
|
|
21597
|
+
let path3 = "";
|
|
21601
21598
|
let queryParams = {};
|
|
21602
21599
|
if (this.apiClient.isVertexAI()) {
|
|
21603
21600
|
const body = generateImagesParametersToVertex(this.apiClient, params);
|
|
21604
|
-
|
|
21601
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21605
21602
|
queryParams = body["_query"];
|
|
21606
21603
|
delete body["_url"];
|
|
21607
21604
|
delete body["_query"];
|
|
21608
21605
|
response = this.apiClient.request({
|
|
21609
|
-
path:
|
|
21606
|
+
path: path3,
|
|
21610
21607
|
queryParams,
|
|
21611
21608
|
body: JSON.stringify(body),
|
|
21612
21609
|
httpMethod: "POST",
|
|
@@ -21629,12 +21626,12 @@ var init_web = __esm({
|
|
|
21629
21626
|
});
|
|
21630
21627
|
} else {
|
|
21631
21628
|
const body = generateImagesParametersToMldev(this.apiClient, params);
|
|
21632
|
-
|
|
21629
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21633
21630
|
queryParams = body["_query"];
|
|
21634
21631
|
delete body["_url"];
|
|
21635
21632
|
delete body["_query"];
|
|
21636
21633
|
response = this.apiClient.request({
|
|
21637
|
-
path:
|
|
21634
|
+
path: path3,
|
|
21638
21635
|
queryParams,
|
|
21639
21636
|
body: JSON.stringify(body),
|
|
21640
21637
|
httpMethod: "POST",
|
|
@@ -21663,16 +21660,16 @@ var init_web = __esm({
|
|
|
21663
21660
|
async editImageInternal(params) {
|
|
21664
21661
|
var _a16, _b16;
|
|
21665
21662
|
let response;
|
|
21666
|
-
let
|
|
21663
|
+
let path3 = "";
|
|
21667
21664
|
let queryParams = {};
|
|
21668
21665
|
if (this.apiClient.isVertexAI()) {
|
|
21669
21666
|
const body = editImageParametersInternalToVertex(this.apiClient, params);
|
|
21670
|
-
|
|
21667
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21671
21668
|
queryParams = body["_query"];
|
|
21672
21669
|
delete body["_url"];
|
|
21673
21670
|
delete body["_query"];
|
|
21674
21671
|
response = this.apiClient.request({
|
|
21675
|
-
path:
|
|
21672
|
+
path: path3,
|
|
21676
21673
|
queryParams,
|
|
21677
21674
|
body: JSON.stringify(body),
|
|
21678
21675
|
httpMethod: "POST",
|
|
@@ -21703,16 +21700,16 @@ var init_web = __esm({
|
|
|
21703
21700
|
async upscaleImageInternal(params) {
|
|
21704
21701
|
var _a16, _b16;
|
|
21705
21702
|
let response;
|
|
21706
|
-
let
|
|
21703
|
+
let path3 = "";
|
|
21707
21704
|
let queryParams = {};
|
|
21708
21705
|
if (this.apiClient.isVertexAI()) {
|
|
21709
21706
|
const body = upscaleImageAPIParametersInternalToVertex(this.apiClient, params);
|
|
21710
|
-
|
|
21707
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21711
21708
|
queryParams = body["_query"];
|
|
21712
21709
|
delete body["_url"];
|
|
21713
21710
|
delete body["_query"];
|
|
21714
21711
|
response = this.apiClient.request({
|
|
21715
|
-
path:
|
|
21712
|
+
path: path3,
|
|
21716
21713
|
queryParams,
|
|
21717
21714
|
body: JSON.stringify(body),
|
|
21718
21715
|
httpMethod: "POST",
|
|
@@ -21778,16 +21775,16 @@ var init_web = __esm({
|
|
|
21778
21775
|
async recontextImage(params) {
|
|
21779
21776
|
var _a16, _b16;
|
|
21780
21777
|
let response;
|
|
21781
|
-
let
|
|
21778
|
+
let path3 = "";
|
|
21782
21779
|
let queryParams = {};
|
|
21783
21780
|
if (this.apiClient.isVertexAI()) {
|
|
21784
21781
|
const body = recontextImageParametersToVertex(this.apiClient, params);
|
|
21785
|
-
|
|
21782
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21786
21783
|
queryParams = body["_query"];
|
|
21787
21784
|
delete body["_url"];
|
|
21788
21785
|
delete body["_query"];
|
|
21789
21786
|
response = this.apiClient.request({
|
|
21790
|
-
path:
|
|
21787
|
+
path: path3,
|
|
21791
21788
|
queryParams,
|
|
21792
21789
|
body: JSON.stringify(body),
|
|
21793
21790
|
httpMethod: "POST",
|
|
@@ -21829,16 +21826,16 @@ var init_web = __esm({
|
|
|
21829
21826
|
async segmentImage(params) {
|
|
21830
21827
|
var _a16, _b16;
|
|
21831
21828
|
let response;
|
|
21832
|
-
let
|
|
21829
|
+
let path3 = "";
|
|
21833
21830
|
let queryParams = {};
|
|
21834
21831
|
if (this.apiClient.isVertexAI()) {
|
|
21835
21832
|
const body = segmentImageParametersToVertex(this.apiClient, params);
|
|
21836
|
-
|
|
21833
|
+
path3 = formatMap("{model}:predict", body["_url"]);
|
|
21837
21834
|
queryParams = body["_query"];
|
|
21838
21835
|
delete body["_url"];
|
|
21839
21836
|
delete body["_query"];
|
|
21840
21837
|
response = this.apiClient.request({
|
|
21841
|
-
path:
|
|
21838
|
+
path: path3,
|
|
21842
21839
|
queryParams,
|
|
21843
21840
|
body: JSON.stringify(body),
|
|
21844
21841
|
httpMethod: "POST",
|
|
@@ -21868,16 +21865,16 @@ var init_web = __esm({
|
|
|
21868
21865
|
async get(params) {
|
|
21869
21866
|
var _a16, _b16, _c, _d;
|
|
21870
21867
|
let response;
|
|
21871
|
-
let
|
|
21868
|
+
let path3 = "";
|
|
21872
21869
|
let queryParams = {};
|
|
21873
21870
|
if (this.apiClient.isVertexAI()) {
|
|
21874
21871
|
const body = getModelParametersToVertex(this.apiClient, params);
|
|
21875
|
-
|
|
21872
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
21876
21873
|
queryParams = body["_query"];
|
|
21877
21874
|
delete body["_url"];
|
|
21878
21875
|
delete body["_query"];
|
|
21879
21876
|
response = this.apiClient.request({
|
|
21880
|
-
path:
|
|
21877
|
+
path: path3,
|
|
21881
21878
|
queryParams,
|
|
21882
21879
|
body: JSON.stringify(body),
|
|
21883
21880
|
httpMethod: "GET",
|
|
@@ -21892,12 +21889,12 @@ var init_web = __esm({
|
|
|
21892
21889
|
});
|
|
21893
21890
|
} else {
|
|
21894
21891
|
const body = getModelParametersToMldev(this.apiClient, params);
|
|
21895
|
-
|
|
21892
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
21896
21893
|
queryParams = body["_query"];
|
|
21897
21894
|
delete body["_url"];
|
|
21898
21895
|
delete body["_query"];
|
|
21899
21896
|
response = this.apiClient.request({
|
|
21900
|
-
path:
|
|
21897
|
+
path: path3,
|
|
21901
21898
|
queryParams,
|
|
21902
21899
|
body: JSON.stringify(body),
|
|
21903
21900
|
httpMethod: "GET",
|
|
@@ -21915,16 +21912,16 @@ var init_web = __esm({
|
|
|
21915
21912
|
async listInternal(params) {
|
|
21916
21913
|
var _a16, _b16, _c, _d;
|
|
21917
21914
|
let response;
|
|
21918
|
-
let
|
|
21915
|
+
let path3 = "";
|
|
21919
21916
|
let queryParams = {};
|
|
21920
21917
|
if (this.apiClient.isVertexAI()) {
|
|
21921
21918
|
const body = listModelsParametersToVertex(this.apiClient, params);
|
|
21922
|
-
|
|
21919
|
+
path3 = formatMap("{models_url}", body["_url"]);
|
|
21923
21920
|
queryParams = body["_query"];
|
|
21924
21921
|
delete body["_url"];
|
|
21925
21922
|
delete body["_query"];
|
|
21926
21923
|
response = this.apiClient.request({
|
|
21927
|
-
path:
|
|
21924
|
+
path: path3,
|
|
21928
21925
|
queryParams,
|
|
21929
21926
|
body: JSON.stringify(body),
|
|
21930
21927
|
httpMethod: "GET",
|
|
@@ -21947,12 +21944,12 @@ var init_web = __esm({
|
|
|
21947
21944
|
});
|
|
21948
21945
|
} else {
|
|
21949
21946
|
const body = listModelsParametersToMldev(this.apiClient, params);
|
|
21950
|
-
|
|
21947
|
+
path3 = formatMap("{models_url}", body["_url"]);
|
|
21951
21948
|
queryParams = body["_query"];
|
|
21952
21949
|
delete body["_url"];
|
|
21953
21950
|
delete body["_query"];
|
|
21954
21951
|
response = this.apiClient.request({
|
|
21955
|
-
path:
|
|
21952
|
+
path: path3,
|
|
21956
21953
|
queryParams,
|
|
21957
21954
|
body: JSON.stringify(body),
|
|
21958
21955
|
httpMethod: "GET",
|
|
@@ -21995,16 +21992,16 @@ var init_web = __esm({
|
|
|
21995
21992
|
async update(params) {
|
|
21996
21993
|
var _a16, _b16, _c, _d;
|
|
21997
21994
|
let response;
|
|
21998
|
-
let
|
|
21995
|
+
let path3 = "";
|
|
21999
21996
|
let queryParams = {};
|
|
22000
21997
|
if (this.apiClient.isVertexAI()) {
|
|
22001
21998
|
const body = updateModelParametersToVertex(this.apiClient, params);
|
|
22002
|
-
|
|
21999
|
+
path3 = formatMap("{model}", body["_url"]);
|
|
22003
22000
|
queryParams = body["_query"];
|
|
22004
22001
|
delete body["_url"];
|
|
22005
22002
|
delete body["_query"];
|
|
22006
22003
|
response = this.apiClient.request({
|
|
22007
|
-
path:
|
|
22004
|
+
path: path3,
|
|
22008
22005
|
queryParams,
|
|
22009
22006
|
body: JSON.stringify(body),
|
|
22010
22007
|
httpMethod: "PATCH",
|
|
@@ -22019,12 +22016,12 @@ var init_web = __esm({
|
|
|
22019
22016
|
});
|
|
22020
22017
|
} else {
|
|
22021
22018
|
const body = updateModelParametersToMldev(this.apiClient, params);
|
|
22022
|
-
|
|
22019
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22023
22020
|
queryParams = body["_query"];
|
|
22024
22021
|
delete body["_url"];
|
|
22025
22022
|
delete body["_query"];
|
|
22026
22023
|
response = this.apiClient.request({
|
|
22027
|
-
path:
|
|
22024
|
+
path: path3,
|
|
22028
22025
|
queryParams,
|
|
22029
22026
|
body: JSON.stringify(body),
|
|
22030
22027
|
httpMethod: "PATCH",
|
|
@@ -22053,16 +22050,16 @@ var init_web = __esm({
|
|
|
22053
22050
|
async delete(params) {
|
|
22054
22051
|
var _a16, _b16, _c, _d;
|
|
22055
22052
|
let response;
|
|
22056
|
-
let
|
|
22053
|
+
let path3 = "";
|
|
22057
22054
|
let queryParams = {};
|
|
22058
22055
|
if (this.apiClient.isVertexAI()) {
|
|
22059
22056
|
const body = deleteModelParametersToVertex(this.apiClient, params);
|
|
22060
|
-
|
|
22057
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22061
22058
|
queryParams = body["_query"];
|
|
22062
22059
|
delete body["_url"];
|
|
22063
22060
|
delete body["_query"];
|
|
22064
22061
|
response = this.apiClient.request({
|
|
22065
|
-
path:
|
|
22062
|
+
path: path3,
|
|
22066
22063
|
queryParams,
|
|
22067
22064
|
body: JSON.stringify(body),
|
|
22068
22065
|
httpMethod: "DELETE",
|
|
@@ -22085,12 +22082,12 @@ var init_web = __esm({
|
|
|
22085
22082
|
});
|
|
22086
22083
|
} else {
|
|
22087
22084
|
const body = deleteModelParametersToMldev(this.apiClient, params);
|
|
22088
|
-
|
|
22085
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22089
22086
|
queryParams = body["_query"];
|
|
22090
22087
|
delete body["_url"];
|
|
22091
22088
|
delete body["_query"];
|
|
22092
22089
|
response = this.apiClient.request({
|
|
22093
|
-
path:
|
|
22090
|
+
path: path3,
|
|
22094
22091
|
queryParams,
|
|
22095
22092
|
body: JSON.stringify(body),
|
|
22096
22093
|
httpMethod: "DELETE",
|
|
@@ -22132,16 +22129,16 @@ var init_web = __esm({
|
|
|
22132
22129
|
async countTokens(params) {
|
|
22133
22130
|
var _a16, _b16, _c, _d;
|
|
22134
22131
|
let response;
|
|
22135
|
-
let
|
|
22132
|
+
let path3 = "";
|
|
22136
22133
|
let queryParams = {};
|
|
22137
22134
|
if (this.apiClient.isVertexAI()) {
|
|
22138
22135
|
const body = countTokensParametersToVertex(this.apiClient, params);
|
|
22139
|
-
|
|
22136
|
+
path3 = formatMap("{model}:countTokens", body["_url"]);
|
|
22140
22137
|
queryParams = body["_query"];
|
|
22141
22138
|
delete body["_url"];
|
|
22142
22139
|
delete body["_query"];
|
|
22143
22140
|
response = this.apiClient.request({
|
|
22144
|
-
path:
|
|
22141
|
+
path: path3,
|
|
22145
22142
|
queryParams,
|
|
22146
22143
|
body: JSON.stringify(body),
|
|
22147
22144
|
httpMethod: "POST",
|
|
@@ -22164,12 +22161,12 @@ var init_web = __esm({
|
|
|
22164
22161
|
});
|
|
22165
22162
|
} else {
|
|
22166
22163
|
const body = countTokensParametersToMldev(this.apiClient, params);
|
|
22167
|
-
|
|
22164
|
+
path3 = formatMap("{model}:countTokens", body["_url"]);
|
|
22168
22165
|
queryParams = body["_query"];
|
|
22169
22166
|
delete body["_url"];
|
|
22170
22167
|
delete body["_query"];
|
|
22171
22168
|
response = this.apiClient.request({
|
|
22172
|
-
path:
|
|
22169
|
+
path: path3,
|
|
22173
22170
|
queryParams,
|
|
22174
22171
|
body: JSON.stringify(body),
|
|
22175
22172
|
httpMethod: "POST",
|
|
@@ -22213,16 +22210,16 @@ var init_web = __esm({
|
|
|
22213
22210
|
async computeTokens(params) {
|
|
22214
22211
|
var _a16, _b16;
|
|
22215
22212
|
let response;
|
|
22216
|
-
let
|
|
22213
|
+
let path3 = "";
|
|
22217
22214
|
let queryParams = {};
|
|
22218
22215
|
if (this.apiClient.isVertexAI()) {
|
|
22219
22216
|
const body = computeTokensParametersToVertex(this.apiClient, params);
|
|
22220
|
-
|
|
22217
|
+
path3 = formatMap("{model}:computeTokens", body["_url"]);
|
|
22221
22218
|
queryParams = body["_query"];
|
|
22222
22219
|
delete body["_url"];
|
|
22223
22220
|
delete body["_query"];
|
|
22224
22221
|
response = this.apiClient.request({
|
|
22225
|
-
path:
|
|
22222
|
+
path: path3,
|
|
22226
22223
|
queryParams,
|
|
22227
22224
|
body: JSON.stringify(body),
|
|
22228
22225
|
httpMethod: "POST",
|
|
@@ -22253,16 +22250,16 @@ var init_web = __esm({
|
|
|
22253
22250
|
async generateVideosInternal(params) {
|
|
22254
22251
|
var _a16, _b16, _c, _d;
|
|
22255
22252
|
let response;
|
|
22256
|
-
let
|
|
22253
|
+
let path3 = "";
|
|
22257
22254
|
let queryParams = {};
|
|
22258
22255
|
if (this.apiClient.isVertexAI()) {
|
|
22259
22256
|
const body = generateVideosParametersToVertex(this.apiClient, params);
|
|
22260
|
-
|
|
22257
|
+
path3 = formatMap("{model}:predictLongRunning", body["_url"]);
|
|
22261
22258
|
queryParams = body["_query"];
|
|
22262
22259
|
delete body["_url"];
|
|
22263
22260
|
delete body["_query"];
|
|
22264
22261
|
response = this.apiClient.request({
|
|
22265
|
-
path:
|
|
22262
|
+
path: path3,
|
|
22266
22263
|
queryParams,
|
|
22267
22264
|
body: JSON.stringify(body),
|
|
22268
22265
|
httpMethod: "POST",
|
|
@@ -22279,12 +22276,12 @@ var init_web = __esm({
|
|
|
22279
22276
|
});
|
|
22280
22277
|
} else {
|
|
22281
22278
|
const body = generateVideosParametersToMldev(this.apiClient, params);
|
|
22282
|
-
|
|
22279
|
+
path3 = formatMap("{model}:predictLongRunning", body["_url"]);
|
|
22283
22280
|
queryParams = body["_query"];
|
|
22284
22281
|
delete body["_url"];
|
|
22285
22282
|
delete body["_query"];
|
|
22286
22283
|
response = this.apiClient.request({
|
|
22287
|
-
path:
|
|
22284
|
+
path: path3,
|
|
22288
22285
|
queryParams,
|
|
22289
22286
|
body: JSON.stringify(body),
|
|
22290
22287
|
httpMethod: "POST",
|
|
@@ -22386,16 +22383,16 @@ var init_web = __esm({
|
|
|
22386
22383
|
async getVideosOperationInternal(params) {
|
|
22387
22384
|
var _a16, _b16, _c, _d;
|
|
22388
22385
|
let response;
|
|
22389
|
-
let
|
|
22386
|
+
let path3 = "";
|
|
22390
22387
|
let queryParams = {};
|
|
22391
22388
|
if (this.apiClient.isVertexAI()) {
|
|
22392
22389
|
const body = getOperationParametersToVertex(params);
|
|
22393
|
-
|
|
22390
|
+
path3 = formatMap("{operationName}", body["_url"]);
|
|
22394
22391
|
queryParams = body["_query"];
|
|
22395
22392
|
delete body["_url"];
|
|
22396
22393
|
delete body["_query"];
|
|
22397
22394
|
response = this.apiClient.request({
|
|
22398
|
-
path:
|
|
22395
|
+
path: path3,
|
|
22399
22396
|
queryParams,
|
|
22400
22397
|
body: JSON.stringify(body),
|
|
22401
22398
|
httpMethod: "GET",
|
|
@@ -22407,12 +22404,12 @@ var init_web = __esm({
|
|
|
22407
22404
|
return response;
|
|
22408
22405
|
} else {
|
|
22409
22406
|
const body = getOperationParametersToMldev(params);
|
|
22410
|
-
|
|
22407
|
+
path3 = formatMap("{operationName}", body["_url"]);
|
|
22411
22408
|
queryParams = body["_query"];
|
|
22412
22409
|
delete body["_url"];
|
|
22413
22410
|
delete body["_query"];
|
|
22414
22411
|
response = this.apiClient.request({
|
|
22415
|
-
path:
|
|
22412
|
+
path: path3,
|
|
22416
22413
|
queryParams,
|
|
22417
22414
|
body: JSON.stringify(body),
|
|
22418
22415
|
httpMethod: "GET",
|
|
@@ -22427,16 +22424,16 @@ var init_web = __esm({
|
|
|
22427
22424
|
async fetchPredictVideosOperationInternal(params) {
|
|
22428
22425
|
var _a16, _b16;
|
|
22429
22426
|
let response;
|
|
22430
|
-
let
|
|
22427
|
+
let path3 = "";
|
|
22431
22428
|
let queryParams = {};
|
|
22432
22429
|
if (this.apiClient.isVertexAI()) {
|
|
22433
22430
|
const body = fetchPredictOperationParametersToVertex(params);
|
|
22434
|
-
|
|
22431
|
+
path3 = formatMap("{resourceName}:fetchPredictOperation", body["_url"]);
|
|
22435
22432
|
queryParams = body["_query"];
|
|
22436
22433
|
delete body["_url"];
|
|
22437
22434
|
delete body["_query"];
|
|
22438
22435
|
response = this.apiClient.request({
|
|
22439
|
-
path:
|
|
22436
|
+
path: path3,
|
|
22440
22437
|
queryParams,
|
|
22441
22438
|
body: JSON.stringify(body),
|
|
22442
22439
|
httpMethod: "POST",
|
|
@@ -22542,20 +22539,20 @@ var init_web = __esm({
|
|
|
22542
22539
|
async create(params) {
|
|
22543
22540
|
var _a16, _b16;
|
|
22544
22541
|
let response;
|
|
22545
|
-
let
|
|
22542
|
+
let path3 = "";
|
|
22546
22543
|
let queryParams = {};
|
|
22547
22544
|
if (this.apiClient.isVertexAI()) {
|
|
22548
22545
|
throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");
|
|
22549
22546
|
} else {
|
|
22550
22547
|
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
22551
|
-
|
|
22548
|
+
path3 = formatMap("auth_tokens", body["_url"]);
|
|
22552
22549
|
queryParams = body["_query"];
|
|
22553
22550
|
delete body["config"];
|
|
22554
22551
|
delete body["_url"];
|
|
22555
22552
|
delete body["_query"];
|
|
22556
22553
|
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
22557
22554
|
response = this.apiClient.request({
|
|
22558
|
-
path:
|
|
22555
|
+
path: path3,
|
|
22559
22556
|
queryParams,
|
|
22560
22557
|
body: JSON.stringify(transformedBody),
|
|
22561
22558
|
httpMethod: "POST",
|
|
@@ -22587,18 +22584,18 @@ var init_web = __esm({
|
|
|
22587
22584
|
async get(params) {
|
|
22588
22585
|
var _a16, _b16;
|
|
22589
22586
|
let response;
|
|
22590
|
-
let
|
|
22587
|
+
let path3 = "";
|
|
22591
22588
|
let queryParams = {};
|
|
22592
22589
|
if (this.apiClient.isVertexAI()) {
|
|
22593
22590
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22594
22591
|
} else {
|
|
22595
22592
|
const body = getDocumentParametersToMldev(params);
|
|
22596
|
-
|
|
22593
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22597
22594
|
queryParams = body["_query"];
|
|
22598
22595
|
delete body["_url"];
|
|
22599
22596
|
delete body["_query"];
|
|
22600
22597
|
response = this.apiClient.request({
|
|
22601
|
-
path:
|
|
22598
|
+
path: path3,
|
|
22602
22599
|
queryParams,
|
|
22603
22600
|
body: JSON.stringify(body),
|
|
22604
22601
|
httpMethod: "GET",
|
|
@@ -22619,18 +22616,18 @@ var init_web = __esm({
|
|
|
22619
22616
|
*/
|
|
22620
22617
|
async delete(params) {
|
|
22621
22618
|
var _a16, _b16;
|
|
22622
|
-
let
|
|
22619
|
+
let path3 = "";
|
|
22623
22620
|
let queryParams = {};
|
|
22624
22621
|
if (this.apiClient.isVertexAI()) {
|
|
22625
22622
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22626
22623
|
} else {
|
|
22627
22624
|
const body = deleteDocumentParametersToMldev(params);
|
|
22628
|
-
|
|
22625
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22629
22626
|
queryParams = body["_query"];
|
|
22630
22627
|
delete body["_url"];
|
|
22631
22628
|
delete body["_query"];
|
|
22632
22629
|
await this.apiClient.request({
|
|
22633
|
-
path:
|
|
22630
|
+
path: path3,
|
|
22634
22631
|
queryParams,
|
|
22635
22632
|
body: JSON.stringify(body),
|
|
22636
22633
|
httpMethod: "DELETE",
|
|
@@ -22642,18 +22639,18 @@ var init_web = __esm({
|
|
|
22642
22639
|
async listInternal(params) {
|
|
22643
22640
|
var _a16, _b16;
|
|
22644
22641
|
let response;
|
|
22645
|
-
let
|
|
22642
|
+
let path3 = "";
|
|
22646
22643
|
let queryParams = {};
|
|
22647
22644
|
if (this.apiClient.isVertexAI()) {
|
|
22648
22645
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22649
22646
|
} else {
|
|
22650
22647
|
const body = listDocumentsParametersToMldev(params);
|
|
22651
|
-
|
|
22648
|
+
path3 = formatMap("{parent}/documents", body["_url"]);
|
|
22652
22649
|
queryParams = body["_query"];
|
|
22653
22650
|
delete body["_url"];
|
|
22654
22651
|
delete body["_query"];
|
|
22655
22652
|
response = this.apiClient.request({
|
|
22656
|
-
path:
|
|
22653
|
+
path: path3,
|
|
22657
22654
|
queryParams,
|
|
22658
22655
|
body: JSON.stringify(body),
|
|
22659
22656
|
httpMethod: "GET",
|
|
@@ -22731,18 +22728,18 @@ var init_web = __esm({
|
|
|
22731
22728
|
async create(params) {
|
|
22732
22729
|
var _a16, _b16;
|
|
22733
22730
|
let response;
|
|
22734
|
-
let
|
|
22731
|
+
let path3 = "";
|
|
22735
22732
|
let queryParams = {};
|
|
22736
22733
|
if (this.apiClient.isVertexAI()) {
|
|
22737
22734
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22738
22735
|
} else {
|
|
22739
22736
|
const body = createFileSearchStoreParametersToMldev(params);
|
|
22740
|
-
|
|
22737
|
+
path3 = formatMap("fileSearchStores", body["_url"]);
|
|
22741
22738
|
queryParams = body["_query"];
|
|
22742
22739
|
delete body["_url"];
|
|
22743
22740
|
delete body["_query"];
|
|
22744
22741
|
response = this.apiClient.request({
|
|
22745
|
-
path:
|
|
22742
|
+
path: path3,
|
|
22746
22743
|
queryParams,
|
|
22747
22744
|
body: JSON.stringify(body),
|
|
22748
22745
|
httpMethod: "POST",
|
|
@@ -22765,18 +22762,18 @@ var init_web = __esm({
|
|
|
22765
22762
|
async get(params) {
|
|
22766
22763
|
var _a16, _b16;
|
|
22767
22764
|
let response;
|
|
22768
|
-
let
|
|
22765
|
+
let path3 = "";
|
|
22769
22766
|
let queryParams = {};
|
|
22770
22767
|
if (this.apiClient.isVertexAI()) {
|
|
22771
22768
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22772
22769
|
} else {
|
|
22773
22770
|
const body = getFileSearchStoreParametersToMldev(params);
|
|
22774
|
-
|
|
22771
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22775
22772
|
queryParams = body["_query"];
|
|
22776
22773
|
delete body["_url"];
|
|
22777
22774
|
delete body["_query"];
|
|
22778
22775
|
response = this.apiClient.request({
|
|
22779
|
-
path:
|
|
22776
|
+
path: path3,
|
|
22780
22777
|
queryParams,
|
|
22781
22778
|
body: JSON.stringify(body),
|
|
22782
22779
|
httpMethod: "GET",
|
|
@@ -22797,18 +22794,18 @@ var init_web = __esm({
|
|
|
22797
22794
|
*/
|
|
22798
22795
|
async delete(params) {
|
|
22799
22796
|
var _a16, _b16;
|
|
22800
|
-
let
|
|
22797
|
+
let path3 = "";
|
|
22801
22798
|
let queryParams = {};
|
|
22802
22799
|
if (this.apiClient.isVertexAI()) {
|
|
22803
22800
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22804
22801
|
} else {
|
|
22805
22802
|
const body = deleteFileSearchStoreParametersToMldev(params);
|
|
22806
|
-
|
|
22803
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
22807
22804
|
queryParams = body["_query"];
|
|
22808
22805
|
delete body["_url"];
|
|
22809
22806
|
delete body["_query"];
|
|
22810
22807
|
await this.apiClient.request({
|
|
22811
|
-
path:
|
|
22808
|
+
path: path3,
|
|
22812
22809
|
queryParams,
|
|
22813
22810
|
body: JSON.stringify(body),
|
|
22814
22811
|
httpMethod: "DELETE",
|
|
@@ -22820,18 +22817,18 @@ var init_web = __esm({
|
|
|
22820
22817
|
async listInternal(params) {
|
|
22821
22818
|
var _a16, _b16;
|
|
22822
22819
|
let response;
|
|
22823
|
-
let
|
|
22820
|
+
let path3 = "";
|
|
22824
22821
|
let queryParams = {};
|
|
22825
22822
|
if (this.apiClient.isVertexAI()) {
|
|
22826
22823
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22827
22824
|
} else {
|
|
22828
22825
|
const body = listFileSearchStoresParametersToMldev(params);
|
|
22829
|
-
|
|
22826
|
+
path3 = formatMap("fileSearchStores", body["_url"]);
|
|
22830
22827
|
queryParams = body["_query"];
|
|
22831
22828
|
delete body["_url"];
|
|
22832
22829
|
delete body["_query"];
|
|
22833
22830
|
response = this.apiClient.request({
|
|
22834
|
-
path:
|
|
22831
|
+
path: path3,
|
|
22835
22832
|
queryParams,
|
|
22836
22833
|
body: JSON.stringify(body),
|
|
22837
22834
|
httpMethod: "GET",
|
|
@@ -22851,18 +22848,18 @@ var init_web = __esm({
|
|
|
22851
22848
|
async uploadToFileSearchStoreInternal(params) {
|
|
22852
22849
|
var _a16, _b16;
|
|
22853
22850
|
let response;
|
|
22854
|
-
let
|
|
22851
|
+
let path3 = "";
|
|
22855
22852
|
let queryParams = {};
|
|
22856
22853
|
if (this.apiClient.isVertexAI()) {
|
|
22857
22854
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22858
22855
|
} else {
|
|
22859
22856
|
const body = uploadToFileSearchStoreParametersToMldev(params);
|
|
22860
|
-
|
|
22857
|
+
path3 = formatMap("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore", body["_url"]);
|
|
22861
22858
|
queryParams = body["_query"];
|
|
22862
22859
|
delete body["_url"];
|
|
22863
22860
|
delete body["_query"];
|
|
22864
22861
|
response = this.apiClient.request({
|
|
22865
|
-
path:
|
|
22862
|
+
path: path3,
|
|
22866
22863
|
queryParams,
|
|
22867
22864
|
body: JSON.stringify(body),
|
|
22868
22865
|
httpMethod: "POST",
|
|
@@ -22890,18 +22887,18 @@ var init_web = __esm({
|
|
|
22890
22887
|
async importFile(params) {
|
|
22891
22888
|
var _a16, _b16;
|
|
22892
22889
|
let response;
|
|
22893
|
-
let
|
|
22890
|
+
let path3 = "";
|
|
22894
22891
|
let queryParams = {};
|
|
22895
22892
|
if (this.apiClient.isVertexAI()) {
|
|
22896
22893
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
22897
22894
|
} else {
|
|
22898
22895
|
const body = importFileParametersToMldev(params);
|
|
22899
|
-
|
|
22896
|
+
path3 = formatMap("{file_search_store_name}:importFile", body["_url"]);
|
|
22900
22897
|
queryParams = body["_query"];
|
|
22901
22898
|
delete body["_url"];
|
|
22902
22899
|
delete body["_query"];
|
|
22903
22900
|
response = this.apiClient.request({
|
|
22904
|
-
path:
|
|
22901
|
+
path: path3,
|
|
22905
22902
|
queryParams,
|
|
22906
22903
|
body: JSON.stringify(body),
|
|
22907
22904
|
httpMethod: "POST",
|
|
@@ -23094,12 +23091,12 @@ var init_web = __esm({
|
|
|
23094
23091
|
};
|
|
23095
23092
|
APIResource._key = [];
|
|
23096
23093
|
EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
23097
|
-
createPathTagFunction = (pathEncoder = encodeURIPath) => (function
|
|
23094
|
+
createPathTagFunction = (pathEncoder = encodeURIPath) => (function path3(statics, ...params) {
|
|
23098
23095
|
if (statics.length === 1)
|
|
23099
23096
|
return statics[0];
|
|
23100
23097
|
let postPath = false;
|
|
23101
23098
|
const invalidSegments = [];
|
|
23102
|
-
const
|
|
23099
|
+
const path4 = statics.reduce((previousValue, currentValue, index) => {
|
|
23103
23100
|
var _a16, _b16, _c;
|
|
23104
23101
|
if (/[?#]/.test(currentValue)) {
|
|
23105
23102
|
postPath = true;
|
|
@@ -23117,7 +23114,7 @@ var init_web = __esm({
|
|
|
23117
23114
|
}
|
|
23118
23115
|
return previousValue + currentValue + (index === params.length ? "" : encoded);
|
|
23119
23116
|
}, "");
|
|
23120
|
-
const pathOnly =
|
|
23117
|
+
const pathOnly = path4.split(/[?#]/, 1)[0];
|
|
23121
23118
|
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
23122
23119
|
let match2;
|
|
23123
23120
|
while ((match2 = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -23141,10 +23138,10 @@ var init_web = __esm({
|
|
|
23141
23138
|
}, "");
|
|
23142
23139
|
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:
|
|
23143
23140
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
23144
|
-
${
|
|
23141
|
+
${path4}
|
|
23145
23142
|
${underline}`);
|
|
23146
23143
|
}
|
|
23147
|
-
return
|
|
23144
|
+
return path4;
|
|
23148
23145
|
});
|
|
23149
23146
|
path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
23150
23147
|
BaseInteractions = class extends APIResource {
|
|
@@ -23698,9 +23695,9 @@ ${underline}`);
|
|
|
23698
23695
|
makeStatusError(status, error, message, headers) {
|
|
23699
23696
|
return APIError.generate(status, error, message, headers);
|
|
23700
23697
|
}
|
|
23701
|
-
buildURL(
|
|
23698
|
+
buildURL(path3, query, defaultBaseURL) {
|
|
23702
23699
|
const baseURL = !this.baseURLOverridden() && defaultBaseURL || this.baseURL;
|
|
23703
|
-
const url = isAbsoluteURL(
|
|
23700
|
+
const url = isAbsoluteURL(path3) ? new URL(path3) : new URL(baseURL + (baseURL.endsWith("/") && path3.startsWith("/") ? path3.slice(1) : path3));
|
|
23704
23701
|
const defaultQuery = this.defaultQuery();
|
|
23705
23702
|
const pathQuery = Object.fromEntries(url.searchParams);
|
|
23706
23703
|
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
@@ -23729,24 +23726,24 @@ ${underline}`);
|
|
|
23729
23726
|
*/
|
|
23730
23727
|
async prepareRequest(request, { url, options }) {
|
|
23731
23728
|
}
|
|
23732
|
-
get(
|
|
23733
|
-
return this.methodRequest("get",
|
|
23729
|
+
get(path3, opts) {
|
|
23730
|
+
return this.methodRequest("get", path3, opts);
|
|
23734
23731
|
}
|
|
23735
|
-
post(
|
|
23736
|
-
return this.methodRequest("post",
|
|
23732
|
+
post(path3, opts) {
|
|
23733
|
+
return this.methodRequest("post", path3, opts);
|
|
23737
23734
|
}
|
|
23738
|
-
patch(
|
|
23739
|
-
return this.methodRequest("patch",
|
|
23735
|
+
patch(path3, opts) {
|
|
23736
|
+
return this.methodRequest("patch", path3, opts);
|
|
23740
23737
|
}
|
|
23741
|
-
put(
|
|
23742
|
-
return this.methodRequest("put",
|
|
23738
|
+
put(path3, opts) {
|
|
23739
|
+
return this.methodRequest("put", path3, opts);
|
|
23743
23740
|
}
|
|
23744
|
-
delete(
|
|
23745
|
-
return this.methodRequest("delete",
|
|
23741
|
+
delete(path3, opts) {
|
|
23742
|
+
return this.methodRequest("delete", path3, opts);
|
|
23746
23743
|
}
|
|
23747
|
-
methodRequest(method,
|
|
23744
|
+
methodRequest(method, path3, opts) {
|
|
23748
23745
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
23749
|
-
return Object.assign({ method, path:
|
|
23746
|
+
return Object.assign({ method, path: path3 }, opts2);
|
|
23750
23747
|
}));
|
|
23751
23748
|
}
|
|
23752
23749
|
request(options, remainingRetries = null) {
|
|
@@ -23920,8 +23917,8 @@ ${underline}`);
|
|
|
23920
23917
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
23921
23918
|
var _b16, _c, _d;
|
|
23922
23919
|
const options = Object.assign({}, inputOptions);
|
|
23923
|
-
const { method, path:
|
|
23924
|
-
const url = this.buildURL(
|
|
23920
|
+
const { method, path: path3, query, defaultBaseURL } = options;
|
|
23921
|
+
const url = this.buildURL(path3, query, defaultBaseURL);
|
|
23925
23922
|
if ("timeout" in options)
|
|
23926
23923
|
validatePositiveInteger("timeout", options.timeout);
|
|
23927
23924
|
options.timeout = (_b16 = options.timeout) !== null && _b16 !== void 0 ? _b16 : this.timeout;
|
|
@@ -24050,16 +24047,16 @@ ${underline}`);
|
|
|
24050
24047
|
async getInternal(params) {
|
|
24051
24048
|
var _a16, _b16, _c, _d;
|
|
24052
24049
|
let response;
|
|
24053
|
-
let
|
|
24050
|
+
let path3 = "";
|
|
24054
24051
|
let queryParams = {};
|
|
24055
24052
|
if (this.apiClient.isVertexAI()) {
|
|
24056
24053
|
const body = getTuningJobParametersToVertex(params);
|
|
24057
|
-
|
|
24054
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
24058
24055
|
queryParams = body["_query"];
|
|
24059
24056
|
delete body["_url"];
|
|
24060
24057
|
delete body["_query"];
|
|
24061
24058
|
response = this.apiClient.request({
|
|
24062
|
-
path:
|
|
24059
|
+
path: path3,
|
|
24063
24060
|
queryParams,
|
|
24064
24061
|
body: JSON.stringify(body),
|
|
24065
24062
|
httpMethod: "GET",
|
|
@@ -24080,12 +24077,12 @@ ${underline}`);
|
|
|
24080
24077
|
});
|
|
24081
24078
|
} else {
|
|
24082
24079
|
const body = getTuningJobParametersToMldev(params);
|
|
24083
|
-
|
|
24080
|
+
path3 = formatMap("{name}", body["_url"]);
|
|
24084
24081
|
queryParams = body["_query"];
|
|
24085
24082
|
delete body["_url"];
|
|
24086
24083
|
delete body["_query"];
|
|
24087
24084
|
response = this.apiClient.request({
|
|
24088
|
-
path:
|
|
24085
|
+
path: path3,
|
|
24089
24086
|
queryParams,
|
|
24090
24087
|
body: JSON.stringify(body),
|
|
24091
24088
|
httpMethod: "GET",
|
|
@@ -24109,16 +24106,16 @@ ${underline}`);
|
|
|
24109
24106
|
async listInternal(params) {
|
|
24110
24107
|
var _a16, _b16, _c, _d;
|
|
24111
24108
|
let response;
|
|
24112
|
-
let
|
|
24109
|
+
let path3 = "";
|
|
24113
24110
|
let queryParams = {};
|
|
24114
24111
|
if (this.apiClient.isVertexAI()) {
|
|
24115
24112
|
const body = listTuningJobsParametersToVertex(params);
|
|
24116
|
-
|
|
24113
|
+
path3 = formatMap("tuningJobs", body["_url"]);
|
|
24117
24114
|
queryParams = body["_query"];
|
|
24118
24115
|
delete body["_url"];
|
|
24119
24116
|
delete body["_query"];
|
|
24120
24117
|
response = this.apiClient.request({
|
|
24121
|
-
path:
|
|
24118
|
+
path: path3,
|
|
24122
24119
|
queryParams,
|
|
24123
24120
|
body: JSON.stringify(body),
|
|
24124
24121
|
httpMethod: "GET",
|
|
@@ -24141,12 +24138,12 @@ ${underline}`);
|
|
|
24141
24138
|
});
|
|
24142
24139
|
} else {
|
|
24143
24140
|
const body = listTuningJobsParametersToMldev(params);
|
|
24144
|
-
|
|
24141
|
+
path3 = formatMap("tunedModels", body["_url"]);
|
|
24145
24142
|
queryParams = body["_query"];
|
|
24146
24143
|
delete body["_url"];
|
|
24147
24144
|
delete body["_query"];
|
|
24148
24145
|
response = this.apiClient.request({
|
|
24149
|
-
path:
|
|
24146
|
+
path: path3,
|
|
24150
24147
|
queryParams,
|
|
24151
24148
|
body: JSON.stringify(body),
|
|
24152
24149
|
httpMethod: "GET",
|
|
@@ -24183,16 +24180,16 @@ ${underline}`);
|
|
|
24183
24180
|
async cancel(params) {
|
|
24184
24181
|
var _a16, _b16, _c, _d;
|
|
24185
24182
|
let response;
|
|
24186
|
-
let
|
|
24183
|
+
let path3 = "";
|
|
24187
24184
|
let queryParams = {};
|
|
24188
24185
|
if (this.apiClient.isVertexAI()) {
|
|
24189
24186
|
const body = cancelTuningJobParametersToVertex(params);
|
|
24190
|
-
|
|
24187
|
+
path3 = formatMap("{name}:cancel", body["_url"]);
|
|
24191
24188
|
queryParams = body["_query"];
|
|
24192
24189
|
delete body["_url"];
|
|
24193
24190
|
delete body["_query"];
|
|
24194
24191
|
response = this.apiClient.request({
|
|
24195
|
-
path:
|
|
24192
|
+
path: path3,
|
|
24196
24193
|
queryParams,
|
|
24197
24194
|
body: JSON.stringify(body),
|
|
24198
24195
|
httpMethod: "POST",
|
|
@@ -24215,12 +24212,12 @@ ${underline}`);
|
|
|
24215
24212
|
});
|
|
24216
24213
|
} else {
|
|
24217
24214
|
const body = cancelTuningJobParametersToMldev(params);
|
|
24218
|
-
|
|
24215
|
+
path3 = formatMap("{name}:cancel", body["_url"]);
|
|
24219
24216
|
queryParams = body["_query"];
|
|
24220
24217
|
delete body["_url"];
|
|
24221
24218
|
delete body["_query"];
|
|
24222
24219
|
response = this.apiClient.request({
|
|
24223
|
-
path:
|
|
24220
|
+
path: path3,
|
|
24224
24221
|
queryParams,
|
|
24225
24222
|
body: JSON.stringify(body),
|
|
24226
24223
|
httpMethod: "POST",
|
|
@@ -24246,16 +24243,16 @@ ${underline}`);
|
|
|
24246
24243
|
async tuneInternal(params) {
|
|
24247
24244
|
var _a16, _b16;
|
|
24248
24245
|
let response;
|
|
24249
|
-
let
|
|
24246
|
+
let path3 = "";
|
|
24250
24247
|
let queryParams = {};
|
|
24251
24248
|
if (this.apiClient.isVertexAI()) {
|
|
24252
24249
|
const body = createTuningJobParametersPrivateToVertex(params, params);
|
|
24253
|
-
|
|
24250
|
+
path3 = formatMap("tuningJobs", body["_url"]);
|
|
24254
24251
|
queryParams = body["_query"];
|
|
24255
24252
|
delete body["_url"];
|
|
24256
24253
|
delete body["_query"];
|
|
24257
24254
|
response = this.apiClient.request({
|
|
24258
|
-
path:
|
|
24255
|
+
path: path3,
|
|
24259
24256
|
queryParams,
|
|
24260
24257
|
body: JSON.stringify(body),
|
|
24261
24258
|
httpMethod: "POST",
|
|
@@ -24281,18 +24278,18 @@ ${underline}`);
|
|
|
24281
24278
|
async tuneMldevInternal(params) {
|
|
24282
24279
|
var _a16, _b16;
|
|
24283
24280
|
let response;
|
|
24284
|
-
let
|
|
24281
|
+
let path3 = "";
|
|
24285
24282
|
let queryParams = {};
|
|
24286
24283
|
if (this.apiClient.isVertexAI()) {
|
|
24287
24284
|
throw new Error("This method is only supported by the Gemini Developer API.");
|
|
24288
24285
|
} else {
|
|
24289
24286
|
const body = createTuningJobParametersPrivateToMldev(params);
|
|
24290
|
-
|
|
24287
|
+
path3 = formatMap("tunedModels", body["_url"]);
|
|
24291
24288
|
queryParams = body["_query"];
|
|
24292
24289
|
delete body["_url"];
|
|
24293
24290
|
delete body["_query"];
|
|
24294
24291
|
response = this.apiClient.request({
|
|
24295
|
-
path:
|
|
24292
|
+
path: path3,
|
|
24296
24293
|
queryParams,
|
|
24297
24294
|
body: JSON.stringify(body),
|
|
24298
24295
|
httpMethod: "POST",
|
|
@@ -26258,12 +26255,12 @@ var init_path = __esm({
|
|
|
26258
26255
|
"../../node_modules/.pnpm/groq-sdk@1.1.2/node_modules/groq-sdk/internal/utils/path.mjs"() {
|
|
26259
26256
|
init_error();
|
|
26260
26257
|
EMPTY2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
26261
|
-
createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function
|
|
26258
|
+
createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function path3(statics, ...params) {
|
|
26262
26259
|
if (statics.length === 1)
|
|
26263
26260
|
return statics[0];
|
|
26264
26261
|
let postPath = false;
|
|
26265
26262
|
const invalidSegments = [];
|
|
26266
|
-
const
|
|
26263
|
+
const path4 = statics.reduce((previousValue, currentValue, index) => {
|
|
26267
26264
|
if (/[?#]/.test(currentValue)) {
|
|
26268
26265
|
postPath = true;
|
|
26269
26266
|
}
|
|
@@ -26280,7 +26277,7 @@ var init_path = __esm({
|
|
|
26280
26277
|
}
|
|
26281
26278
|
return previousValue + currentValue + (index === params.length ? "" : encoded);
|
|
26282
26279
|
}, "");
|
|
26283
|
-
const pathOnly =
|
|
26280
|
+
const pathOnly = path4.split(/[?#]/, 1)[0];
|
|
26284
26281
|
const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
26285
26282
|
let match2;
|
|
26286
26283
|
while ((match2 = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
@@ -26301,10 +26298,10 @@ var init_path = __esm({
|
|
|
26301
26298
|
}, "");
|
|
26302
26299
|
throw new GroqError(`Path parameters result in path with invalid segments:
|
|
26303
26300
|
${invalidSegments.map((e) => e.error).join("\n")}
|
|
26304
|
-
${
|
|
26301
|
+
${path4}
|
|
26305
26302
|
${underline}`);
|
|
26306
26303
|
}
|
|
26307
|
-
return
|
|
26304
|
+
return path4;
|
|
26308
26305
|
};
|
|
26309
26306
|
path2 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
|
|
26310
26307
|
}
|
|
@@ -27216,9 +27213,9 @@ var init_client = __esm({
|
|
|
27216
27213
|
makeStatusError(status, error, message, headers) {
|
|
27217
27214
|
return APIError2.generate(status, error, message, headers);
|
|
27218
27215
|
}
|
|
27219
|
-
buildURL(
|
|
27216
|
+
buildURL(path3, query, defaultBaseURL) {
|
|
27220
27217
|
const baseURL = !__classPrivateFieldGet(this, _Groq_instances, "m", _Groq_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
|
|
27221
|
-
const url = isAbsoluteURL2(
|
|
27218
|
+
const url = isAbsoluteURL2(path3) ? new URL(path3) : new URL(baseURL + (baseURL.endsWith("/") && path3.startsWith("/") ? path3.slice(1) : path3));
|
|
27222
27219
|
const defaultQuery = this.defaultQuery();
|
|
27223
27220
|
const pathQuery = Object.fromEntries(url.searchParams);
|
|
27224
27221
|
if (!isEmptyObj2(defaultQuery) || !isEmptyObj2(pathQuery)) {
|
|
@@ -27242,24 +27239,24 @@ var init_client = __esm({
|
|
|
27242
27239
|
*/
|
|
27243
27240
|
async prepareRequest(request, { url, options }) {
|
|
27244
27241
|
}
|
|
27245
|
-
get(
|
|
27246
|
-
return this.methodRequest("get",
|
|
27242
|
+
get(path3, opts) {
|
|
27243
|
+
return this.methodRequest("get", path3, opts);
|
|
27247
27244
|
}
|
|
27248
|
-
post(
|
|
27249
|
-
return this.methodRequest("post",
|
|
27245
|
+
post(path3, opts) {
|
|
27246
|
+
return this.methodRequest("post", path3, opts);
|
|
27250
27247
|
}
|
|
27251
|
-
patch(
|
|
27252
|
-
return this.methodRequest("patch",
|
|
27248
|
+
patch(path3, opts) {
|
|
27249
|
+
return this.methodRequest("patch", path3, opts);
|
|
27253
27250
|
}
|
|
27254
|
-
put(
|
|
27255
|
-
return this.methodRequest("put",
|
|
27251
|
+
put(path3, opts) {
|
|
27252
|
+
return this.methodRequest("put", path3, opts);
|
|
27256
27253
|
}
|
|
27257
|
-
delete(
|
|
27258
|
-
return this.methodRequest("delete",
|
|
27254
|
+
delete(path3, opts) {
|
|
27255
|
+
return this.methodRequest("delete", path3, opts);
|
|
27259
27256
|
}
|
|
27260
|
-
methodRequest(method,
|
|
27257
|
+
methodRequest(method, path3, opts) {
|
|
27261
27258
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
27262
|
-
return { method, path:
|
|
27259
|
+
return { method, path: path3, ...opts2 };
|
|
27263
27260
|
}));
|
|
27264
27261
|
}
|
|
27265
27262
|
request(options, remainingRetries = null) {
|
|
@@ -27435,8 +27432,8 @@ var init_client = __esm({
|
|
|
27435
27432
|
}
|
|
27436
27433
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
27437
27434
|
const options = { ...inputOptions };
|
|
27438
|
-
const { method, path:
|
|
27439
|
-
const url = this.buildURL(
|
|
27435
|
+
const { method, path: path3, query, defaultBaseURL } = options;
|
|
27436
|
+
const url = this.buildURL(path3, query, defaultBaseURL);
|
|
27440
27437
|
if ("timeout" in options)
|
|
27441
27438
|
validatePositiveInteger2("timeout", options.timeout);
|
|
27442
27439
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -38094,14 +38091,14 @@ var init_sdks = __esm({
|
|
|
38094
38091
|
}
|
|
38095
38092
|
}
|
|
38096
38093
|
_createRequest(context, conf, options) {
|
|
38097
|
-
const { method, path:
|
|
38094
|
+
const { method, path: path3, query, headers: opHeaders, security } = conf;
|
|
38098
38095
|
const base = conf.baseURL ?? this._baseURL;
|
|
38099
38096
|
if (!base) {
|
|
38100
38097
|
return ERR(new InvalidRequestError("No base URL provided for operation"));
|
|
38101
38098
|
}
|
|
38102
38099
|
const reqURL = new URL(base);
|
|
38103
|
-
const inputURL = new URL(
|
|
38104
|
-
if (
|
|
38100
|
+
const inputURL = new URL(path3, reqURL);
|
|
38101
|
+
if (path3) {
|
|
38105
38102
|
reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
|
|
38106
38103
|
reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
|
|
38107
38104
|
}
|
|
@@ -40139,7 +40136,7 @@ async function $do(client, request, options) {
|
|
|
40139
40136
|
}
|
|
40140
40137
|
const payload = parsed.value;
|
|
40141
40138
|
const body = null;
|
|
40142
|
-
const
|
|
40139
|
+
const path3 = pathToFunc("/activity")();
|
|
40143
40140
|
const query = encodeFormQuery({
|
|
40144
40141
|
"date": payload?.date
|
|
40145
40142
|
});
|
|
@@ -40163,7 +40160,7 @@ async function $do(client, request, options) {
|
|
|
40163
40160
|
security: requestSecurity,
|
|
40164
40161
|
method: "GET",
|
|
40165
40162
|
baseURL: options?.serverURL,
|
|
40166
|
-
path:
|
|
40163
|
+
path: path3,
|
|
40167
40164
|
headers,
|
|
40168
40165
|
query,
|
|
40169
40166
|
body,
|
|
@@ -40239,7 +40236,7 @@ async function $do2(client, request, options) {
|
|
|
40239
40236
|
}
|
|
40240
40237
|
const payload = parsed.value;
|
|
40241
40238
|
const body = encodeJSON("body", payload, { explode: true });
|
|
40242
|
-
const
|
|
40239
|
+
const path3 = pathToFunc("/keys")();
|
|
40243
40240
|
const headers = new Headers(compactMap({
|
|
40244
40241
|
"Content-Type": "application/json",
|
|
40245
40242
|
Accept: "application/json"
|
|
@@ -40261,7 +40258,7 @@ async function $do2(client, request, options) {
|
|
|
40261
40258
|
security: requestSecurity,
|
|
40262
40259
|
method: "POST",
|
|
40263
40260
|
baseURL: options?.serverURL,
|
|
40264
|
-
path:
|
|
40261
|
+
path: path3,
|
|
40265
40262
|
headers,
|
|
40266
40263
|
body,
|
|
40267
40264
|
userAgent: client._options.userAgent,
|
|
@@ -40321,7 +40318,7 @@ async function $do3(client, request, options) {
|
|
|
40321
40318
|
charEncoding: "percent"
|
|
40322
40319
|
})
|
|
40323
40320
|
};
|
|
40324
|
-
const
|
|
40321
|
+
const path3 = pathToFunc("/keys/{hash}")(pathParams);
|
|
40325
40322
|
const headers = new Headers(compactMap({
|
|
40326
40323
|
Accept: "application/json"
|
|
40327
40324
|
}));
|
|
@@ -40342,7 +40339,7 @@ async function $do3(client, request, options) {
|
|
|
40342
40339
|
security: requestSecurity,
|
|
40343
40340
|
method: "DELETE",
|
|
40344
40341
|
baseURL: options?.serverURL,
|
|
40345
|
-
path:
|
|
40342
|
+
path: path3,
|
|
40346
40343
|
headers,
|
|
40347
40344
|
body,
|
|
40348
40345
|
userAgent: client._options.userAgent,
|
|
@@ -40402,7 +40399,7 @@ async function $do4(client, request, options) {
|
|
|
40402
40399
|
charEncoding: "percent"
|
|
40403
40400
|
})
|
|
40404
40401
|
};
|
|
40405
|
-
const
|
|
40402
|
+
const path3 = pathToFunc("/keys/{hash}")(pathParams);
|
|
40406
40403
|
const headers = new Headers(compactMap({
|
|
40407
40404
|
Accept: "application/json"
|
|
40408
40405
|
}));
|
|
@@ -40423,7 +40420,7 @@ async function $do4(client, request, options) {
|
|
|
40423
40420
|
security: requestSecurity,
|
|
40424
40421
|
method: "GET",
|
|
40425
40422
|
baseURL: options?.serverURL,
|
|
40426
|
-
path:
|
|
40423
|
+
path: path3,
|
|
40427
40424
|
headers,
|
|
40428
40425
|
body,
|
|
40429
40426
|
userAgent: client._options.userAgent,
|
|
@@ -40471,7 +40468,7 @@ function apiKeysGetCurrentKeyMetadata(client, options) {
|
|
|
40471
40468
|
return new APIPromise3($do5(client, options));
|
|
40472
40469
|
}
|
|
40473
40470
|
async function $do5(client, options) {
|
|
40474
|
-
const
|
|
40471
|
+
const path3 = pathToFunc("/key")();
|
|
40475
40472
|
const headers = new Headers(compactMap({
|
|
40476
40473
|
Accept: "application/json"
|
|
40477
40474
|
}));
|
|
@@ -40492,7 +40489,7 @@ async function $do5(client, options) {
|
|
|
40492
40489
|
security: requestSecurity,
|
|
40493
40490
|
method: "GET",
|
|
40494
40491
|
baseURL: options?.serverURL,
|
|
40495
|
-
path:
|
|
40492
|
+
path: path3,
|
|
40496
40493
|
headers,
|
|
40497
40494
|
userAgent: client._options.userAgent,
|
|
40498
40495
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -40543,7 +40540,7 @@ async function $do6(client, request, options) {
|
|
|
40543
40540
|
}
|
|
40544
40541
|
const payload = parsed.value;
|
|
40545
40542
|
const body = null;
|
|
40546
|
-
const
|
|
40543
|
+
const path3 = pathToFunc("/keys")();
|
|
40547
40544
|
const query = encodeFormQuery({
|
|
40548
40545
|
"include_disabled": payload?.include_disabled,
|
|
40549
40546
|
"offset": payload?.offset
|
|
@@ -40568,7 +40565,7 @@ async function $do6(client, request, options) {
|
|
|
40568
40565
|
security: requestSecurity,
|
|
40569
40566
|
method: "GET",
|
|
40570
40567
|
baseURL: options?.serverURL,
|
|
40571
|
-
path:
|
|
40568
|
+
path: path3,
|
|
40572
40569
|
headers,
|
|
40573
40570
|
query,
|
|
40574
40571
|
body,
|
|
@@ -40629,7 +40626,7 @@ async function $do7(client, request, options) {
|
|
|
40629
40626
|
charEncoding: "percent"
|
|
40630
40627
|
})
|
|
40631
40628
|
};
|
|
40632
|
-
const
|
|
40629
|
+
const path3 = pathToFunc("/keys/{hash}")(pathParams);
|
|
40633
40630
|
const headers = new Headers(compactMap({
|
|
40634
40631
|
"Content-Type": "application/json",
|
|
40635
40632
|
Accept: "application/json"
|
|
@@ -40651,7 +40648,7 @@ async function $do7(client, request, options) {
|
|
|
40651
40648
|
security: requestSecurity,
|
|
40652
40649
|
method: "PATCH",
|
|
40653
40650
|
baseURL: options?.serverURL,
|
|
40654
|
-
path:
|
|
40651
|
+
path: path3,
|
|
40655
40652
|
headers,
|
|
40656
40653
|
body,
|
|
40657
40654
|
userAgent: client._options.userAgent,
|
|
@@ -40761,7 +40758,7 @@ async function $do8(client, request, options) {
|
|
|
40761
40758
|
}
|
|
40762
40759
|
const payload = parsed.value;
|
|
40763
40760
|
const body = encodeJSON("body", payload, { explode: true });
|
|
40764
|
-
const
|
|
40761
|
+
const path3 = pathToFunc("/responses")();
|
|
40765
40762
|
const headers = new Headers(compactMap({
|
|
40766
40763
|
"Content-Type": "application/json",
|
|
40767
40764
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -40783,7 +40780,7 @@ async function $do8(client, request, options) {
|
|
|
40783
40780
|
security: requestSecurity,
|
|
40784
40781
|
method: "POST",
|
|
40785
40782
|
baseURL: options?.serverURL,
|
|
40786
|
-
path:
|
|
40783
|
+
path: path3,
|
|
40787
40784
|
headers,
|
|
40788
40785
|
body,
|
|
40789
40786
|
userAgent: client._options.userAgent,
|
|
@@ -40883,7 +40880,7 @@ async function $do9(client, request, options) {
|
|
|
40883
40880
|
}
|
|
40884
40881
|
const payload = parsed.value;
|
|
40885
40882
|
const body = encodeJSON("body", payload, { explode: true });
|
|
40886
|
-
const
|
|
40883
|
+
const path3 = pathToFunc("/chat/completions")();
|
|
40887
40884
|
const headers = new Headers(compactMap({
|
|
40888
40885
|
"Content-Type": "application/json",
|
|
40889
40886
|
Accept: request?.stream ? "text/event-stream" : "application/json"
|
|
@@ -40905,7 +40902,7 @@ async function $do9(client, request, options) {
|
|
|
40905
40902
|
security: requestSecurity,
|
|
40906
40903
|
method: "POST",
|
|
40907
40904
|
baseURL: options?.serverURL,
|
|
40908
|
-
path:
|
|
40905
|
+
path: path3,
|
|
40909
40906
|
headers,
|
|
40910
40907
|
body,
|
|
40911
40908
|
userAgent: client._options.userAgent,
|
|
@@ -40975,7 +40972,7 @@ async function $do10(client, request, options) {
|
|
|
40975
40972
|
}
|
|
40976
40973
|
const payload = parsed.value;
|
|
40977
40974
|
const body = encodeJSON("body", payload, { explode: true });
|
|
40978
|
-
const
|
|
40975
|
+
const path3 = pathToFunc("/completions")();
|
|
40979
40976
|
const headers = new Headers(compactMap({
|
|
40980
40977
|
"Content-Type": "application/json",
|
|
40981
40978
|
Accept: "application/json"
|
|
@@ -40997,7 +40994,7 @@ async function $do10(client, request, options) {
|
|
|
40997
40994
|
security: requestSecurity,
|
|
40998
40995
|
method: "POST",
|
|
40999
40996
|
baseURL: options?.serverURL,
|
|
41000
|
-
path:
|
|
40997
|
+
path: path3,
|
|
41001
40998
|
headers,
|
|
41002
40999
|
body,
|
|
41003
41000
|
userAgent: client._options.userAgent,
|
|
@@ -41072,7 +41069,7 @@ async function $do11(client, security, request, options) {
|
|
|
41072
41069
|
}
|
|
41073
41070
|
const payload = parsed.value;
|
|
41074
41071
|
const body = encodeJSON("body", payload, { explode: true });
|
|
41075
|
-
const
|
|
41072
|
+
const path3 = pathToFunc("/credits/coinbase")();
|
|
41076
41073
|
const headers = new Headers(compactMap({
|
|
41077
41074
|
"Content-Type": "application/json",
|
|
41078
41075
|
Accept: "application/json"
|
|
@@ -41098,7 +41095,7 @@ async function $do11(client, security, request, options) {
|
|
|
41098
41095
|
security: requestSecurity,
|
|
41099
41096
|
method: "POST",
|
|
41100
41097
|
baseURL: options?.serverURL,
|
|
41101
|
-
path:
|
|
41098
|
+
path: path3,
|
|
41102
41099
|
headers,
|
|
41103
41100
|
body,
|
|
41104
41101
|
userAgent: client._options.userAgent,
|
|
@@ -41147,7 +41144,7 @@ function creditsGetCredits(client, options) {
|
|
|
41147
41144
|
return new APIPromise3($do12(client, options));
|
|
41148
41145
|
}
|
|
41149
41146
|
async function $do12(client, options) {
|
|
41150
|
-
const
|
|
41147
|
+
const path3 = pathToFunc("/credits")();
|
|
41151
41148
|
const headers = new Headers(compactMap({
|
|
41152
41149
|
Accept: "application/json"
|
|
41153
41150
|
}));
|
|
@@ -41168,7 +41165,7 @@ async function $do12(client, options) {
|
|
|
41168
41165
|
security: requestSecurity,
|
|
41169
41166
|
method: "GET",
|
|
41170
41167
|
baseURL: options?.serverURL,
|
|
41171
|
-
path:
|
|
41168
|
+
path: path3,
|
|
41172
41169
|
headers,
|
|
41173
41170
|
userAgent: client._options.userAgent,
|
|
41174
41171
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -41250,7 +41247,7 @@ async function $do13(client, request, options) {
|
|
|
41250
41247
|
}
|
|
41251
41248
|
const payload = parsed.value;
|
|
41252
41249
|
const body = encodeJSON("body", payload, { explode: true });
|
|
41253
|
-
const
|
|
41250
|
+
const path3 = pathToFunc("/embeddings")();
|
|
41254
41251
|
const headers = new Headers(compactMap({
|
|
41255
41252
|
"Content-Type": "application/json",
|
|
41256
41253
|
Accept: "application/json;q=1, text/event-stream;q=0"
|
|
@@ -41272,7 +41269,7 @@ async function $do13(client, request, options) {
|
|
|
41272
41269
|
security: requestSecurity,
|
|
41273
41270
|
method: "POST",
|
|
41274
41271
|
baseURL: options?.serverURL,
|
|
41275
|
-
path:
|
|
41272
|
+
path: path3,
|
|
41276
41273
|
headers,
|
|
41277
41274
|
body,
|
|
41278
41275
|
userAgent: client._options.userAgent,
|
|
@@ -41335,7 +41332,7 @@ function embeddingsListModels(client, options) {
|
|
|
41335
41332
|
return new APIPromise3($do14(client, options));
|
|
41336
41333
|
}
|
|
41337
41334
|
async function $do14(client, options) {
|
|
41338
|
-
const
|
|
41335
|
+
const path3 = pathToFunc("/embeddings/models")();
|
|
41339
41336
|
const headers = new Headers(compactMap({
|
|
41340
41337
|
Accept: "application/json"
|
|
41341
41338
|
}));
|
|
@@ -41356,7 +41353,7 @@ async function $do14(client, options) {
|
|
|
41356
41353
|
security: requestSecurity,
|
|
41357
41354
|
method: "GET",
|
|
41358
41355
|
baseURL: options?.serverURL,
|
|
41359
|
-
path:
|
|
41356
|
+
path: path3,
|
|
41360
41357
|
headers,
|
|
41361
41358
|
userAgent: client._options.userAgent,
|
|
41362
41359
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -41448,7 +41445,7 @@ async function $do15(client, request, options) {
|
|
|
41448
41445
|
charEncoding: "percent"
|
|
41449
41446
|
})
|
|
41450
41447
|
};
|
|
41451
|
-
const
|
|
41448
|
+
const path3 = pathToFunc("/models/{author}/{slug}/endpoints")(pathParams);
|
|
41452
41449
|
const headers = new Headers(compactMap({
|
|
41453
41450
|
Accept: "application/json"
|
|
41454
41451
|
}));
|
|
@@ -41469,7 +41466,7 @@ async function $do15(client, request, options) {
|
|
|
41469
41466
|
security: requestSecurity,
|
|
41470
41467
|
method: "GET",
|
|
41471
41468
|
baseURL: options?.serverURL,
|
|
41472
|
-
path:
|
|
41469
|
+
path: path3,
|
|
41473
41470
|
headers,
|
|
41474
41471
|
body,
|
|
41475
41472
|
userAgent: client._options.userAgent,
|
|
@@ -41517,7 +41514,7 @@ function endpointsListZdrEndpoints(client, options) {
|
|
|
41517
41514
|
return new APIPromise3($do16(client, options));
|
|
41518
41515
|
}
|
|
41519
41516
|
async function $do16(client, options) {
|
|
41520
|
-
const
|
|
41517
|
+
const path3 = pathToFunc("/endpoints/zdr")();
|
|
41521
41518
|
const headers = new Headers(compactMap({
|
|
41522
41519
|
Accept: "application/json"
|
|
41523
41520
|
}));
|
|
@@ -41538,7 +41535,7 @@ async function $do16(client, options) {
|
|
|
41538
41535
|
security: requestSecurity,
|
|
41539
41536
|
method: "GET",
|
|
41540
41537
|
baseURL: options?.serverURL,
|
|
41541
|
-
path:
|
|
41538
|
+
path: path3,
|
|
41542
41539
|
headers,
|
|
41543
41540
|
userAgent: client._options.userAgent,
|
|
41544
41541
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -41614,7 +41611,7 @@ async function $do17(client, request, options) {
|
|
|
41614
41611
|
}
|
|
41615
41612
|
const payload = parsed.value;
|
|
41616
41613
|
const body = null;
|
|
41617
|
-
const
|
|
41614
|
+
const path3 = pathToFunc("/generation")();
|
|
41618
41615
|
const query = encodeFormQuery({
|
|
41619
41616
|
"id": payload.id
|
|
41620
41617
|
});
|
|
@@ -41638,7 +41635,7 @@ async function $do17(client, request, options) {
|
|
|
41638
41635
|
security: requestSecurity,
|
|
41639
41636
|
method: "GET",
|
|
41640
41637
|
baseURL: options?.serverURL,
|
|
41641
|
-
path:
|
|
41638
|
+
path: path3,
|
|
41642
41639
|
headers,
|
|
41643
41640
|
query,
|
|
41644
41641
|
body,
|
|
@@ -41716,7 +41713,7 @@ function modelsCount(client, options) {
|
|
|
41716
41713
|
return new APIPromise3($do18(client, options));
|
|
41717
41714
|
}
|
|
41718
41715
|
async function $do18(client, options) {
|
|
41719
|
-
const
|
|
41716
|
+
const path3 = pathToFunc("/models/count")();
|
|
41720
41717
|
const headers = new Headers(compactMap({
|
|
41721
41718
|
Accept: "application/json"
|
|
41722
41719
|
}));
|
|
@@ -41737,7 +41734,7 @@ async function $do18(client, options) {
|
|
|
41737
41734
|
security: requestSecurity,
|
|
41738
41735
|
method: "GET",
|
|
41739
41736
|
baseURL: options?.serverURL,
|
|
41740
|
-
path:
|
|
41737
|
+
path: path3,
|
|
41741
41738
|
headers,
|
|
41742
41739
|
userAgent: client._options.userAgent,
|
|
41743
41740
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -41788,7 +41785,7 @@ async function $do19(client, request, options) {
|
|
|
41788
41785
|
}
|
|
41789
41786
|
const payload = parsed.value;
|
|
41790
41787
|
const body = null;
|
|
41791
|
-
const
|
|
41788
|
+
const path3 = pathToFunc("/models")();
|
|
41792
41789
|
const query = encodeFormQuery({
|
|
41793
41790
|
"category": payload?.category,
|
|
41794
41791
|
"supported_parameters": payload?.supported_parameters
|
|
@@ -41813,7 +41810,7 @@ async function $do19(client, request, options) {
|
|
|
41813
41810
|
security: requestSecurity,
|
|
41814
41811
|
method: "GET",
|
|
41815
41812
|
baseURL: options?.serverURL,
|
|
41816
|
-
path:
|
|
41813
|
+
path: path3,
|
|
41817
41814
|
headers,
|
|
41818
41815
|
query,
|
|
41819
41816
|
body,
|
|
@@ -41863,7 +41860,7 @@ function modelsListForUser(client, security, options) {
|
|
|
41863
41860
|
return new APIPromise3($do20(client, security, options));
|
|
41864
41861
|
}
|
|
41865
41862
|
async function $do20(client, security, options) {
|
|
41866
|
-
const
|
|
41863
|
+
const path3 = pathToFunc("/models/user")();
|
|
41867
41864
|
const headers = new Headers(compactMap({
|
|
41868
41865
|
Accept: "application/json"
|
|
41869
41866
|
}));
|
|
@@ -41888,7 +41885,7 @@ async function $do20(client, security, options) {
|
|
|
41888
41885
|
security: requestSecurity,
|
|
41889
41886
|
method: "GET",
|
|
41890
41887
|
baseURL: options?.serverURL,
|
|
41891
|
-
path:
|
|
41888
|
+
path: path3,
|
|
41892
41889
|
headers,
|
|
41893
41890
|
userAgent: client._options.userAgent,
|
|
41894
41891
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -41971,7 +41968,7 @@ async function $do21(client, request, options) {
|
|
|
41971
41968
|
}
|
|
41972
41969
|
const payload = parsed.value;
|
|
41973
41970
|
const body = encodeJSON("body", payload, { explode: true });
|
|
41974
|
-
const
|
|
41971
|
+
const path3 = pathToFunc("/auth/keys/code")();
|
|
41975
41972
|
const headers = new Headers(compactMap({
|
|
41976
41973
|
"Content-Type": "application/json",
|
|
41977
41974
|
Accept: "application/json"
|
|
@@ -41993,7 +41990,7 @@ async function $do21(client, request, options) {
|
|
|
41993
41990
|
security: requestSecurity,
|
|
41994
41991
|
method: "POST",
|
|
41995
41992
|
baseURL: options?.serverURL,
|
|
41996
|
-
path:
|
|
41993
|
+
path: path3,
|
|
41997
41994
|
headers,
|
|
41998
41995
|
body,
|
|
41999
41996
|
userAgent: client._options.userAgent,
|
|
@@ -42047,7 +42044,7 @@ async function $do22(client, request, options) {
|
|
|
42047
42044
|
}
|
|
42048
42045
|
const payload = parsed.value;
|
|
42049
42046
|
const body = encodeJSON("body", payload, { explode: true });
|
|
42050
|
-
const
|
|
42047
|
+
const path3 = pathToFunc("/auth/keys")();
|
|
42051
42048
|
const headers = new Headers(compactMap({
|
|
42052
42049
|
"Content-Type": "application/json",
|
|
42053
42050
|
Accept: "application/json"
|
|
@@ -42069,7 +42066,7 @@ async function $do22(client, request, options) {
|
|
|
42069
42066
|
security: requestSecurity,
|
|
42070
42067
|
method: "POST",
|
|
42071
42068
|
baseURL: options?.serverURL,
|
|
42072
|
-
path:
|
|
42069
|
+
path: path3,
|
|
42073
42070
|
headers,
|
|
42074
42071
|
body,
|
|
42075
42072
|
userAgent: client._options.userAgent,
|
|
@@ -42299,7 +42296,7 @@ async function $do23(client, security, request, options) {
|
|
|
42299
42296
|
charEncoding: "percent"
|
|
42300
42297
|
})
|
|
42301
42298
|
};
|
|
42302
|
-
const
|
|
42299
|
+
const path3 = pathToFunc("/parameters/{author}/{slug}")(pathParams);
|
|
42303
42300
|
const query = encodeFormQuery({
|
|
42304
42301
|
"provider": payload.provider
|
|
42305
42302
|
});
|
|
@@ -42327,7 +42324,7 @@ async function $do23(client, security, request, options) {
|
|
|
42327
42324
|
security: requestSecurity,
|
|
42328
42325
|
method: "GET",
|
|
42329
42326
|
baseURL: options?.serverURL,
|
|
42330
|
-
path:
|
|
42327
|
+
path: path3,
|
|
42331
42328
|
headers,
|
|
42332
42329
|
query,
|
|
42333
42330
|
body,
|
|
@@ -42394,7 +42391,7 @@ function providersList(client, options) {
|
|
|
42394
42391
|
return new APIPromise3($do24(client, options));
|
|
42395
42392
|
}
|
|
42396
42393
|
async function $do24(client, options) {
|
|
42397
|
-
const
|
|
42394
|
+
const path3 = pathToFunc("/providers")();
|
|
42398
42395
|
const headers = new Headers(compactMap({
|
|
42399
42396
|
Accept: "application/json"
|
|
42400
42397
|
}));
|
|
@@ -42415,7 +42412,7 @@ async function $do24(client, options) {
|
|
|
42415
42412
|
security: requestSecurity,
|
|
42416
42413
|
method: "GET",
|
|
42417
42414
|
baseURL: options?.serverURL,
|
|
42418
|
-
path:
|
|
42415
|
+
path: path3,
|
|
42419
42416
|
headers,
|
|
42420
42417
|
userAgent: client._options.userAgent,
|
|
42421
42418
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
|
|
@@ -46136,12 +46133,12 @@ var init_dist9 = __esm({
|
|
|
46136
46133
|
kind = "decision";
|
|
46137
46134
|
specificationVersion = "1";
|
|
46138
46135
|
baseUrl;
|
|
46139
|
-
async call(
|
|
46136
|
+
async call(path3, body, signal) {
|
|
46140
46137
|
signal?.throwIfAborted();
|
|
46141
46138
|
const timeout = AbortSignal.timeout(this.config.timeout ?? 6e4);
|
|
46142
46139
|
const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
46143
46140
|
try {
|
|
46144
|
-
const response = await (this.config.fetch ?? fetch)(`${this.baseUrl}${
|
|
46141
|
+
const response = await (this.config.fetch ?? fetch)(`${this.baseUrl}${path3}`, {
|
|
46145
46142
|
method: body ? "POST" : "GET",
|
|
46146
46143
|
headers: { ...this.config.defaultHeaders, "Content-Type": "application/json", Authorization: `Bearer ${this.config.apiKey}` },
|
|
46147
46144
|
...body ? { body: JSON.stringify(body) } : {},
|
|
@@ -53478,8 +53475,8 @@ async function readCompletedArg(partialJson, argName) {
|
|
|
53478
53475
|
controller.close();
|
|
53479
53476
|
}
|
|
53480
53477
|
}).getReader();
|
|
53481
|
-
for await (const [value,
|
|
53482
|
-
if (
|
|
53478
|
+
for await (const [value, path3] of jsonPathReader(reader, [argName])) {
|
|
53479
|
+
if (path3 === argName) {
|
|
53483
53480
|
return typeof value === "string" ? value : void 0;
|
|
53484
53481
|
}
|
|
53485
53482
|
}
|
|
@@ -54369,11 +54366,11 @@ function stripBase64FromMessages(messages, imagePathMap) {
|
|
|
54369
54366
|
const data = part.data;
|
|
54370
54367
|
if (typeof data === "string") {
|
|
54371
54368
|
if (data.startsWith("data:") || data.length > 1e3) {
|
|
54372
|
-
const
|
|
54369
|
+
const path3 = imagePathMap?.get(data);
|
|
54373
54370
|
return {
|
|
54374
54371
|
...part,
|
|
54375
54372
|
data: "[base64 omitted]",
|
|
54376
|
-
...
|
|
54373
|
+
...path3 ? { path: path3 } : {}
|
|
54377
54374
|
};
|
|
54378
54375
|
}
|
|
54379
54376
|
}
|
|
@@ -54387,18 +54384,18 @@ function stripBase64FromMessages(messages, imagePathMap) {
|
|
|
54387
54384
|
...msg,
|
|
54388
54385
|
content: msg.content.map((part) => {
|
|
54389
54386
|
if (part.type === "image_url" && part.image_url.url.startsWith("data:")) {
|
|
54390
|
-
const
|
|
54387
|
+
const path4 = imagePathMap?.get(part.image_url.url);
|
|
54391
54388
|
const mediaType = /^data:([^;,]+)/.exec(part.image_url.url)?.[1];
|
|
54392
54389
|
return {
|
|
54393
54390
|
...part,
|
|
54394
54391
|
image_url: { ...part.image_url, url: "[base64 omitted]" },
|
|
54395
|
-
...
|
|
54396
|
-
...
|
|
54392
|
+
...path4 ? { path: path4 } : {},
|
|
54393
|
+
...path4 && mediaType ? { mediaType } : {}
|
|
54397
54394
|
};
|
|
54398
54395
|
}
|
|
54399
54396
|
if (part.type !== "image" && part.type !== "file") return part;
|
|
54400
|
-
const
|
|
54401
|
-
return { ...part, data: "[base64 omitted]", ...
|
|
54397
|
+
const path3 = imagePathMap?.get(part.data);
|
|
54398
|
+
return { ...part, data: "[base64 omitted]", ...path3 ? { path: path3 } : {} };
|
|
54402
54399
|
})
|
|
54403
54400
|
};
|
|
54404
54401
|
}
|
|
@@ -55594,11 +55591,11 @@ var init_LLMRequest = __esm({
|
|
|
55594
55591
|
...choice2.message,
|
|
55595
55592
|
images: choice2.message?.images?.map(
|
|
55596
55593
|
(img) => {
|
|
55597
|
-
const
|
|
55598
|
-
if (
|
|
55594
|
+
const path3 = img._id ? imagePathMap.get(img._id) : void 0;
|
|
55595
|
+
if (path3) {
|
|
55599
55596
|
return {
|
|
55600
55597
|
type: img.type,
|
|
55601
|
-
image_url: { url:
|
|
55598
|
+
image_url: { url: path3 }
|
|
55602
55599
|
};
|
|
55603
55600
|
}
|
|
55604
55601
|
return img;
|
|
@@ -56272,20 +56269,20 @@ var init_FlowMessages = __esm({
|
|
|
56272
56269
|
continue;
|
|
56273
56270
|
}
|
|
56274
56271
|
const attachmentId = crypto.randomUUID();
|
|
56275
|
-
const
|
|
56272
|
+
const path3 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
56276
56273
|
try {
|
|
56277
|
-
const written = await state.thread.instance.writeFile(
|
|
56274
|
+
const written = await state.thread.instance.writeFile(path3, base64Data, mimeType);
|
|
56278
56275
|
if (written && written.success === false) {
|
|
56279
56276
|
console.error("[FlowEngine] Generated image write failed:", written.error);
|
|
56280
56277
|
continue;
|
|
56281
56278
|
}
|
|
56282
56279
|
if (image.id) {
|
|
56283
|
-
imagePathMap.set(image.id,
|
|
56280
|
+
imagePathMap.set(image.id, path3);
|
|
56284
56281
|
}
|
|
56285
56282
|
refs.push({
|
|
56286
56283
|
id: attachmentId,
|
|
56287
56284
|
type: "file",
|
|
56288
|
-
path:
|
|
56285
|
+
path: path3,
|
|
56289
56286
|
name: `generated-${attachmentId}.${ext}`,
|
|
56290
56287
|
mimeType,
|
|
56291
56288
|
size: Math.ceil(base64Data.length * 3 / 4)
|
|
@@ -56350,9 +56347,9 @@ var init_FlowMessages = __esm({
|
|
|
56350
56347
|
continue;
|
|
56351
56348
|
}
|
|
56352
56349
|
const attachmentId = crypto.randomUUID();
|
|
56353
|
-
const
|
|
56350
|
+
const path3 = `/attachments/${Date.now()}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
56354
56351
|
try {
|
|
56355
|
-
const written = await state.thread.instance.writeFile(
|
|
56352
|
+
const written = await state.thread.instance.writeFile(path3, base64Data, mimeType);
|
|
56356
56353
|
if (written && written.success === false) {
|
|
56357
56354
|
console.error(`[FlowEngine] ${toolName} image write failed:`, written.error);
|
|
56358
56355
|
continue;
|
|
@@ -56360,7 +56357,7 @@ var init_FlowMessages = __esm({
|
|
|
56360
56357
|
const attachmentRef = {
|
|
56361
56358
|
id: attachmentId,
|
|
56362
56359
|
type: "file",
|
|
56363
|
-
path:
|
|
56360
|
+
path: path3,
|
|
56364
56361
|
name: `generated-${attachmentId}.${ext}`,
|
|
56365
56362
|
mimeType,
|
|
56366
56363
|
size: Math.ceil(base64Data.length * 3 / 4)
|
|
@@ -56417,7 +56414,7 @@ var init_FlowMessages = __esm({
|
|
|
56417
56414
|
content: "Image generated successfully",
|
|
56418
56415
|
status: "success",
|
|
56419
56416
|
timestamp: Date.now(),
|
|
56420
|
-
attachment_path:
|
|
56417
|
+
attachment_path: path3
|
|
56421
56418
|
});
|
|
56422
56419
|
await state.storage.sql.exec(
|
|
56423
56420
|
`UPDATE logs SET tool_results = ?1 WHERE id = ?2`,
|
|
@@ -56439,7 +56436,7 @@ var init_FlowMessages = __esm({
|
|
|
56439
56436
|
}
|
|
56440
56437
|
}
|
|
56441
56438
|
if (image.id) {
|
|
56442
|
-
imagePathMap.set(image.id,
|
|
56439
|
+
imagePathMap.set(image.id, path3);
|
|
56443
56440
|
}
|
|
56444
56441
|
} catch (error) {
|
|
56445
56442
|
console.error(`[FlowEngine] Failed to store provider tool result for ${toolName}:`, error);
|
|
@@ -59197,13 +59194,13 @@ Message one with subagent_message(referenceId, message).`
|
|
|
59197
59194
|
new Set(
|
|
59198
59195
|
issues.map(
|
|
59199
59196
|
(issue) => Array.isArray(issue.path) ? issue.path.map(String).join(".") : String(issue.path ?? "")
|
|
59200
|
-
).filter((
|
|
59197
|
+
).filter((path3) => path3.length > 0)
|
|
59201
59198
|
)
|
|
59202
59199
|
);
|
|
59203
59200
|
const detail = issues.map((issue) => {
|
|
59204
|
-
const
|
|
59201
|
+
const path3 = Array.isArray(issue.path) ? issue.path.map(String).join(".") : "";
|
|
59205
59202
|
const message = typeof issue.message === "string" ? issue.message : "invalid value";
|
|
59206
|
-
return
|
|
59203
|
+
return path3 ? `${path3}: ${message}` : message;
|
|
59207
59204
|
}).join("; ") || parsed.error.message || "invalid arguments";
|
|
59208
59205
|
const agentLabel = agentDef.title || agentDef.name || options.agentName || qualifiedPromptName;
|
|
59209
59206
|
return {
|
|
@@ -59617,8 +59614,8 @@ Reference: ${referenceId}` : `Reference: ${referenceId}`;
|
|
|
59617
59614
|
}
|
|
59618
59615
|
return [];
|
|
59619
59616
|
}
|
|
59620
|
-
static inferMimeTypeFromPath(
|
|
59621
|
-
const normalized =
|
|
59617
|
+
static inferMimeTypeFromPath(path3) {
|
|
59618
|
+
const normalized = path3.toLowerCase();
|
|
59622
59619
|
if (normalized.endsWith(".png")) return "image/png";
|
|
59623
59620
|
if (normalized.endsWith(".jpg") || normalized.endsWith(".jpeg")) return "image/jpeg";
|
|
59624
59621
|
if (normalized.endsWith(".webp")) return "image/webp";
|
|
@@ -59657,7 +59654,7 @@ Reference: ${referenceId}` : `Reference: ${referenceId}`;
|
|
|
59657
59654
|
ext: value.slice(lastDot + 1).toLowerCase()
|
|
59658
59655
|
};
|
|
59659
59656
|
}
|
|
59660
|
-
static resolveAttachmentMimeType(sourceMimeType, fallbackMimeType,
|
|
59657
|
+
static resolveAttachmentMimeType(sourceMimeType, fallbackMimeType, path3) {
|
|
59661
59658
|
const source = sourceMimeType?.trim();
|
|
59662
59659
|
if (source && source !== "application/octet-stream") {
|
|
59663
59660
|
return source;
|
|
@@ -59666,7 +59663,7 @@ Reference: ${referenceId}` : `Reference: ${referenceId}`;
|
|
|
59666
59663
|
if (fallback && fallback !== "application/octet-stream") {
|
|
59667
59664
|
return fallback;
|
|
59668
59665
|
}
|
|
59669
|
-
return this.inferMimeTypeFromPath(
|
|
59666
|
+
return this.inferMimeTypeFromPath(path3) ?? source ?? fallback ?? "application/octet-stream";
|
|
59670
59667
|
}
|
|
59671
59668
|
static buildAttachmentTargetPath(preferredName, mimeType, sourcePath) {
|
|
59672
59669
|
const safeName = this.sanitizeFilename(preferredName);
|
|
@@ -59763,8 +59760,8 @@ Reference: ${referenceId}` : `Reference: ${referenceId}`;
|
|
|
59763
59760
|
}
|
|
59764
59761
|
return copied;
|
|
59765
59762
|
}
|
|
59766
|
-
static async readAttachmentDataFromSource(sourceThread,
|
|
59767
|
-
const sourceData = await sourceThread.readFile(
|
|
59763
|
+
static async readAttachmentDataFromSource(sourceThread, path3, sourceFile, allowedAttachmentFetchHosts) {
|
|
59764
|
+
const sourceData = await sourceThread.readFile(path3);
|
|
59768
59765
|
if (sourceData.success && sourceData.data) {
|
|
59769
59766
|
return sourceData.data;
|
|
59770
59767
|
}
|
|
@@ -59801,7 +59798,7 @@ Reference: ${referenceId}` : `Reference: ${referenceId}`;
|
|
|
59801
59798
|
if (!attachments || attachments.length === 0) {
|
|
59802
59799
|
return "";
|
|
59803
59800
|
}
|
|
59804
|
-
const paths = attachments.map((attachment) => attachment.path).filter((
|
|
59801
|
+
const paths = attachments.map((attachment) => attachment.path).filter((path3) => typeof path3 === "string" && path3.length > 0);
|
|
59805
59802
|
if (paths.length === 0) {
|
|
59806
59803
|
return "";
|
|
59807
59804
|
}
|
|
@@ -60076,20 +60073,20 @@ function detectStorageBackend(location) {
|
|
|
60076
60073
|
return "url";
|
|
60077
60074
|
return "local";
|
|
60078
60075
|
}
|
|
60079
|
-
function basename(
|
|
60080
|
-
const parts =
|
|
60076
|
+
function basename(path3) {
|
|
60077
|
+
const parts = path3.split("/").filter(Boolean);
|
|
60081
60078
|
return parts[parts.length - 1] || "";
|
|
60082
60079
|
}
|
|
60083
|
-
function normalizePath(
|
|
60084
|
-
let normalized =
|
|
60080
|
+
function normalizePath(path3) {
|
|
60081
|
+
let normalized = path3.replace(/\/+/g, "/");
|
|
60085
60082
|
if (!normalized.startsWith("/")) normalized = "/" + normalized;
|
|
60086
60083
|
if (normalized.length > 1 && normalized.endsWith("/")) {
|
|
60087
60084
|
normalized = normalized.slice(0, -1);
|
|
60088
60085
|
}
|
|
60089
60086
|
return normalized;
|
|
60090
60087
|
}
|
|
60091
|
-
function dirname(
|
|
60092
|
-
const normalized = normalizePath(
|
|
60088
|
+
function dirname(path3) {
|
|
60089
|
+
const normalized = normalizePath(path3);
|
|
60093
60090
|
const lastSlash = normalized.lastIndexOf("/");
|
|
60094
60091
|
if (lastSlash <= 0) return "/";
|
|
60095
60092
|
return normalized.slice(0, lastSlash);
|
|
@@ -60107,7 +60104,7 @@ function validateMovePaths(source, destination, isDirectory) {
|
|
|
60107
60104
|
);
|
|
60108
60105
|
}
|
|
60109
60106
|
}
|
|
60110
|
-
function resolveRenameDestination(
|
|
60107
|
+
function resolveRenameDestination(path3, newName) {
|
|
60111
60108
|
if (typeof newName !== "string" || newName.length === 0) {
|
|
60112
60109
|
throw new Error("New name must be a non-empty string");
|
|
60113
60110
|
}
|
|
@@ -60117,7 +60114,7 @@ function resolveRenameDestination(path7, newName) {
|
|
|
60117
60114
|
if (newName === "." || newName === "..") {
|
|
60118
60115
|
throw new Error("New name must not be '.' or '..'");
|
|
60119
60116
|
}
|
|
60120
|
-
const normalized = normalizePath(
|
|
60117
|
+
const normalized = normalizePath(path3);
|
|
60121
60118
|
const parent = dirname(normalized);
|
|
60122
60119
|
return parent === "/" ? `/${newName}` : `${parent}/${newName}`;
|
|
60123
60120
|
}
|
|
@@ -60241,8 +60238,8 @@ var init_files3 = __esm({
|
|
|
60241
60238
|
* Write a file to storage.
|
|
60242
60239
|
* Files > CHUNK_SIZE are automatically chunked into file_chunks table.
|
|
60243
60240
|
*/
|
|
60244
|
-
async writeFile(
|
|
60245
|
-
const normalizedPath = normalizePath(
|
|
60241
|
+
async writeFile(path3, data, mimeType, options) {
|
|
60242
|
+
const normalizedPath = normalizePath(path3);
|
|
60246
60243
|
const name15 = basename(normalizedPath);
|
|
60247
60244
|
const isText = isTextMimeType(mimeType);
|
|
60248
60245
|
const now = Date.now();
|
|
@@ -60354,8 +60351,8 @@ var init_files3 = __esm({
|
|
|
60354
60351
|
/**
|
|
60355
60352
|
* Link to an external file (URL, S3, R2)
|
|
60356
60353
|
*/
|
|
60357
|
-
async linkFile(
|
|
60358
|
-
const normalizedPath = normalizePath(
|
|
60354
|
+
async linkFile(path3, location, options) {
|
|
60355
|
+
const normalizedPath = normalizePath(path3);
|
|
60359
60356
|
const name15 = basename(normalizedPath);
|
|
60360
60357
|
const storage = detectStorageBackend(location);
|
|
60361
60358
|
const now = Date.now();
|
|
@@ -60394,8 +60391,8 @@ var init_files3 = __esm({
|
|
|
60394
60391
|
* WARNING: For large chunked files, this loads the entire file into memory.
|
|
60395
60392
|
* Use streamFile() for memory-efficient access to large files.
|
|
60396
60393
|
*/
|
|
60397
|
-
async readFile(
|
|
60398
|
-
const normalizedPath = normalizePath(
|
|
60394
|
+
async readFile(path3) {
|
|
60395
|
+
const normalizedPath = normalizePath(path3);
|
|
60399
60396
|
const cursor = await this.sql.exec(
|
|
60400
60397
|
`SELECT data, content, storage, is_chunked, chunk_count FROM files WHERE path = ? AND is_directory = 0`,
|
|
60401
60398
|
normalizedPath
|
|
@@ -60447,8 +60444,8 @@ var init_files3 = __esm({
|
|
|
60447
60444
|
* Memory-efficient way to read large chunked files.
|
|
60448
60445
|
* Yields one chunk at a time for streaming HTTP responses.
|
|
60449
60446
|
*/
|
|
60450
|
-
async *streamFile(
|
|
60451
|
-
const normalizedPath = normalizePath(
|
|
60447
|
+
async *streamFile(path3) {
|
|
60448
|
+
const normalizedPath = normalizePath(path3);
|
|
60452
60449
|
const cursor = await this.sql.exec(
|
|
60453
60450
|
`SELECT data, content, storage, is_chunked, chunk_count FROM files WHERE path = ? AND is_directory = 0`,
|
|
60454
60451
|
normalizedPath
|
|
@@ -60482,8 +60479,8 @@ var init_files3 = __esm({
|
|
|
60482
60479
|
/**
|
|
60483
60480
|
* Read text file content
|
|
60484
60481
|
*/
|
|
60485
|
-
async readTextFile(
|
|
60486
|
-
const normalizedPath = normalizePath(
|
|
60482
|
+
async readTextFile(path3) {
|
|
60483
|
+
const normalizedPath = normalizePath(path3);
|
|
60487
60484
|
const cursor = await this.sql.exec(
|
|
60488
60485
|
`SELECT content, data, storage FROM files WHERE path = ? AND is_directory = 0`,
|
|
60489
60486
|
normalizedPath
|
|
@@ -60501,8 +60498,8 @@ var init_files3 = __esm({
|
|
|
60501
60498
|
/**
|
|
60502
60499
|
* Get file metadata (stat)
|
|
60503
60500
|
*/
|
|
60504
|
-
async stat(
|
|
60505
|
-
const normalizedPath = normalizePath(
|
|
60501
|
+
async stat(path3) {
|
|
60502
|
+
const normalizedPath = normalizePath(path3);
|
|
60506
60503
|
const cursor = await this.sql.exec(
|
|
60507
60504
|
`SELECT path, name, mime_type, storage, location, size, metadata, is_directory, created_at, width, height, is_chunked, chunk_count
|
|
60508
60505
|
FROM files WHERE path = ?`,
|
|
@@ -60515,8 +60512,8 @@ var init_files3 = __esm({
|
|
|
60515
60512
|
/**
|
|
60516
60513
|
* Check if file or directory exists
|
|
60517
60514
|
*/
|
|
60518
|
-
async exists(
|
|
60519
|
-
const normalizedPath = normalizePath(
|
|
60515
|
+
async exists(path3) {
|
|
60516
|
+
const normalizedPath = normalizePath(path3);
|
|
60520
60517
|
const cursor = await this.sql.exec(
|
|
60521
60518
|
`SELECT COUNT(*) as count FROM files WHERE path = ?`,
|
|
60522
60519
|
normalizedPath
|
|
@@ -60526,8 +60523,8 @@ var init_files3 = __esm({
|
|
|
60526
60523
|
/**
|
|
60527
60524
|
* Delete a file
|
|
60528
60525
|
*/
|
|
60529
|
-
async unlink(
|
|
60530
|
-
const normalizedPath = normalizePath(
|
|
60526
|
+
async unlink(path3) {
|
|
60527
|
+
const normalizedPath = normalizePath(path3);
|
|
60531
60528
|
await this.sql.exec(
|
|
60532
60529
|
`DELETE FROM files WHERE path = ? AND is_directory = 0`,
|
|
60533
60530
|
normalizedPath
|
|
@@ -60537,8 +60534,8 @@ var init_files3 = __esm({
|
|
|
60537
60534
|
/**
|
|
60538
60535
|
* Create a directory marker
|
|
60539
60536
|
*/
|
|
60540
|
-
async mkdir(
|
|
60541
|
-
const normalizedPath = normalizePath(
|
|
60537
|
+
async mkdir(path3) {
|
|
60538
|
+
const normalizedPath = normalizePath(path3);
|
|
60542
60539
|
const name15 = basename(normalizedPath);
|
|
60543
60540
|
const now = Date.now();
|
|
60544
60541
|
await this.sql.exec(
|
|
@@ -60563,8 +60560,8 @@ var init_files3 = __esm({
|
|
|
60563
60560
|
/**
|
|
60564
60561
|
* List directory contents
|
|
60565
60562
|
*/
|
|
60566
|
-
async readdir(
|
|
60567
|
-
const normalizedPath = normalizePath(
|
|
60563
|
+
async readdir(path3) {
|
|
60564
|
+
const normalizedPath = normalizePath(path3);
|
|
60568
60565
|
const prefix = normalizedPath === "/" ? "/" : normalizedPath + "/";
|
|
60569
60566
|
const cursor = await this.sql.exec(
|
|
60570
60567
|
`SELECT path, name, mime_type, storage, location, size, metadata, is_directory, created_at
|
|
@@ -60582,8 +60579,8 @@ var init_files3 = __esm({
|
|
|
60582
60579
|
/**
|
|
60583
60580
|
* Remove empty directory
|
|
60584
60581
|
*/
|
|
60585
|
-
async rmdir(
|
|
60586
|
-
const normalizedPath = normalizePath(
|
|
60582
|
+
async rmdir(path3) {
|
|
60583
|
+
const normalizedPath = normalizePath(path3);
|
|
60587
60584
|
const prefix = normalizedPath + "/";
|
|
60588
60585
|
const cursor = await this.sql.exec(
|
|
60589
60586
|
`SELECT COUNT(*) as count FROM files WHERE path LIKE ? || '%'`,
|
|
@@ -60681,9 +60678,9 @@ var init_files3 = __esm({
|
|
|
60681
60678
|
* Rename a file or directory in place, keeping it in the same parent
|
|
60682
60679
|
* directory. `newName` must be a bare file name with no path separators.
|
|
60683
60680
|
*/
|
|
60684
|
-
async rename(
|
|
60685
|
-
const destination = resolveRenameDestination(
|
|
60686
|
-
return this.move(normalizePath(
|
|
60681
|
+
async rename(path3, newName) {
|
|
60682
|
+
const destination = resolveRenameDestination(path3, newName);
|
|
60683
|
+
return this.move(normalizePath(path3), destination);
|
|
60687
60684
|
}
|
|
60688
60685
|
/**
|
|
60689
60686
|
* Get storage statistics
|
|
@@ -60713,8 +60710,8 @@ var init_files3 = __esm({
|
|
|
60713
60710
|
/**
|
|
60714
60711
|
* Get thumbnail for an image
|
|
60715
60712
|
*/
|
|
60716
|
-
async getThumbnail(
|
|
60717
|
-
const normalizedPath = normalizePath(
|
|
60713
|
+
async getThumbnail(path3) {
|
|
60714
|
+
const normalizedPath = normalizePath(path3);
|
|
60718
60715
|
const cursor = await this.sql.exec(
|
|
60719
60716
|
`SELECT thumbnail FROM files WHERE path = ? AND is_directory = 0`,
|
|
60720
60717
|
normalizedPath
|
|
@@ -61149,8 +61146,8 @@ var init_ToolExecutor = __esm({
|
|
|
61149
61146
|
const validation = argsSchema.safeParse(args);
|
|
61150
61147
|
if (!validation.success) {
|
|
61151
61148
|
const errorMessage = validation.error.issues.map((issue) => {
|
|
61152
|
-
const
|
|
61153
|
-
return `[${
|
|
61149
|
+
const path3 = issue.path.length > 0 ? issue.path.map(String).join(".") : "root";
|
|
61150
|
+
return `[${path3}] ${issue.message}`;
|
|
61154
61151
|
}).join("; ");
|
|
61155
61152
|
return {
|
|
61156
61153
|
status: "error",
|
|
@@ -61597,7 +61594,7 @@ ${errorLines.join("\n")}`);
|
|
|
61597
61594
|
mappedAttachmentValue
|
|
61598
61595
|
);
|
|
61599
61596
|
const resolvedPaths = new Set(mappedRefs.map((ref) => ref.path));
|
|
61600
|
-
const missingPaths = candidatePaths.filter((
|
|
61597
|
+
const missingPaths = candidatePaths.filter((path3) => !resolvedPaths.has(path3));
|
|
61601
61598
|
if (candidatePaths.length === 0 || missingPaths.length > 0) {
|
|
61602
61599
|
processedResult = {
|
|
61603
61600
|
status: "error",
|
|
@@ -61773,8 +61770,8 @@ ${attachmentPaths}`;
|
|
|
61773
61770
|
if (mimeType.startsWith("image/")) {
|
|
61774
61771
|
return true;
|
|
61775
61772
|
}
|
|
61776
|
-
const
|
|
61777
|
-
return
|
|
61773
|
+
const path3 = ref.path.toLowerCase();
|
|
61774
|
+
return path3.endsWith(".png") || path3.endsWith(".jpg") || path3.endsWith(".jpeg") || path3.endsWith(".webp") || path3.endsWith(".gif") || path3.endsWith(".bmp") || path3.endsWith(".svg");
|
|
61778
61775
|
});
|
|
61779
61776
|
if (imageRefs.length === 0) {
|
|
61780
61777
|
return;
|
|
@@ -61832,27 +61829,27 @@ ${attachmentPaths}`;
|
|
|
61832
61829
|
*/
|
|
61833
61830
|
static async processToolAttachments(attachments, state) {
|
|
61834
61831
|
const { FileStorage: FileStorage2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
61835
|
-
const
|
|
61832
|
+
const fs = new FileStorage2(state.storage.sql);
|
|
61836
61833
|
const refs = [];
|
|
61837
61834
|
for (const attachment of attachments) {
|
|
61838
61835
|
try {
|
|
61839
61836
|
const attachmentId = crypto.randomUUID();
|
|
61840
61837
|
const timestamp = Date.now();
|
|
61841
61838
|
const ext = attachment.mimeType === "image/png" ? "png" : attachment.mimeType === "image/jpeg" ? "jpg" : attachment.mimeType === "image/gif" ? "gif" : attachment.mimeType === "image/webp" ? "webp" : attachment.name.split(".").pop() || "bin";
|
|
61842
|
-
const
|
|
61839
|
+
const path3 = `/attachments/${timestamp}-${attachmentId.slice(0, 8)}.${ext}`;
|
|
61843
61840
|
const binaryString = atob(attachment.data);
|
|
61844
61841
|
const dataBuffer = new Uint8Array(binaryString.length);
|
|
61845
61842
|
for (let i = 0; i < binaryString.length; i++) {
|
|
61846
61843
|
dataBuffer[i] = binaryString.charCodeAt(i);
|
|
61847
61844
|
}
|
|
61848
|
-
await
|
|
61845
|
+
await fs.writeFile(path3, dataBuffer.buffer, attachment.mimeType, {
|
|
61849
61846
|
width: attachment.width,
|
|
61850
61847
|
height: attachment.height
|
|
61851
61848
|
});
|
|
61852
61849
|
const ref = {
|
|
61853
61850
|
id: attachmentId,
|
|
61854
61851
|
type: "file",
|
|
61855
|
-
path:
|
|
61852
|
+
path: path3,
|
|
61856
61853
|
name: attachment.name,
|
|
61857
61854
|
mimeType: attachment.mimeType,
|
|
61858
61855
|
size: dataBuffer.byteLength
|
|
@@ -63673,7 +63670,7 @@ var init_thread_values = __esm({
|
|
|
63673
63670
|
this.assertJsonSerializableThreadValue(value, "$", /* @__PURE__ */ new WeakSet());
|
|
63674
63671
|
return JSON.stringify(value);
|
|
63675
63672
|
}
|
|
63676
|
-
assertJsonSerializableThreadValue(value,
|
|
63673
|
+
assertJsonSerializableThreadValue(value, path3, seen) {
|
|
63677
63674
|
if (value === null) {
|
|
63678
63675
|
return;
|
|
63679
63676
|
}
|
|
@@ -63683,36 +63680,36 @@ var init_thread_values = __esm({
|
|
|
63683
63680
|
return;
|
|
63684
63681
|
case "number":
|
|
63685
63682
|
if (!Number.isFinite(value)) {
|
|
63686
|
-
throw new Error(`Thread value at ${
|
|
63683
|
+
throw new Error(`Thread value at ${path3} must be a finite number`);
|
|
63687
63684
|
}
|
|
63688
63685
|
return;
|
|
63689
63686
|
case "object": {
|
|
63690
63687
|
if (seen.has(value)) {
|
|
63691
|
-
throw new Error(`Thread value at ${
|
|
63688
|
+
throw new Error(`Thread value at ${path3} cannot contain circular references`);
|
|
63692
63689
|
}
|
|
63693
63690
|
seen.add(value);
|
|
63694
63691
|
if (Array.isArray(value)) {
|
|
63695
63692
|
for (let i = 0; i < value.length; i += 1) {
|
|
63696
|
-
this.assertJsonSerializableThreadValue(value[i], `${
|
|
63693
|
+
this.assertJsonSerializableThreadValue(value[i], `${path3}[${i}]`, seen);
|
|
63697
63694
|
}
|
|
63698
63695
|
seen.delete(value);
|
|
63699
63696
|
return;
|
|
63700
63697
|
}
|
|
63701
63698
|
const prototype = Object.getPrototypeOf(value);
|
|
63702
63699
|
if (prototype !== Object.prototype && prototype !== null) {
|
|
63703
|
-
throw new Error(`Thread value at ${
|
|
63700
|
+
throw new Error(`Thread value at ${path3} must be a JSON object, array, or primitive`);
|
|
63704
63701
|
}
|
|
63705
63702
|
if (Object.getOwnPropertySymbols(value).length > 0) {
|
|
63706
|
-
throw new Error(`Thread value at ${
|
|
63703
|
+
throw new Error(`Thread value at ${path3} cannot contain symbol keys`);
|
|
63707
63704
|
}
|
|
63708
63705
|
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
63709
|
-
this.assertJsonSerializableThreadValue(entryValue, `${
|
|
63706
|
+
this.assertJsonSerializableThreadValue(entryValue, `${path3}.${entryKey}`, seen);
|
|
63710
63707
|
}
|
|
63711
63708
|
seen.delete(value);
|
|
63712
63709
|
return;
|
|
63713
63710
|
}
|
|
63714
63711
|
default:
|
|
63715
|
-
throw new Error(`Thread value at ${
|
|
63712
|
+
throw new Error(`Thread value at ${path3} must be JSON-serializable`);
|
|
63716
63713
|
}
|
|
63717
63714
|
}
|
|
63718
63715
|
};
|
|
@@ -63738,12 +63735,12 @@ var init_code_execution_rpc = __esm({
|
|
|
63738
63735
|
});
|
|
63739
63736
|
|
|
63740
63737
|
// src/durable-objects/thread-endpoints.ts
|
|
63741
|
-
function normalizeEndpointThreadPath(
|
|
63742
|
-
if (!
|
|
63738
|
+
function normalizeEndpointThreadPath(path3) {
|
|
63739
|
+
if (!path3 || /^[A-Za-z][A-Za-z\d+\-.]*:/.test(path3)) {
|
|
63743
63740
|
throw new Error("Use a relative thread filesystem path");
|
|
63744
63741
|
}
|
|
63745
63742
|
const parts = [];
|
|
63746
|
-
for (const part of
|
|
63743
|
+
for (const part of path3.replace(/\\/g, "/").split("/")) {
|
|
63747
63744
|
if (!part || part === ".") continue;
|
|
63748
63745
|
if (part === "..") {
|
|
63749
63746
|
if (parts.length === 0) throw new Error("Path cannot escape the thread filesystem root");
|
|
@@ -63793,12 +63790,12 @@ function createEndpointFetchBridge() {
|
|
|
63793
63790
|
function createEndpointFsBridge(state) {
|
|
63794
63791
|
const decoder2 = new TextDecoder();
|
|
63795
63792
|
return {
|
|
63796
|
-
readFile: async (
|
|
63797
|
-
const data = await state.readFile(normalizeEndpointThreadPath(
|
|
63793
|
+
readFile: async (path3) => {
|
|
63794
|
+
const data = await state.readFile(normalizeEndpointThreadPath(path3));
|
|
63798
63795
|
return data ? decoder2.decode(data) : null;
|
|
63799
63796
|
},
|
|
63800
|
-
writeFile: async (
|
|
63801
|
-
return state.writeFile(normalizeEndpointThreadPath(
|
|
63797
|
+
writeFile: async (path3, content, mimeType = "text/plain") => {
|
|
63798
|
+
return state.writeFile(normalizeEndpointThreadPath(path3), content, mimeType);
|
|
63802
63799
|
}
|
|
63803
63800
|
};
|
|
63804
63801
|
}
|
|
@@ -63869,24 +63866,24 @@ function createEndpointThreadStateBridge(state) {
|
|
|
63869
63866
|
emit: (event, data) => state.emit(event, data),
|
|
63870
63867
|
getValue: (key) => state.getValue(key),
|
|
63871
63868
|
setValue: (key, value) => state.setValue(key, value),
|
|
63872
|
-
readFile: (
|
|
63873
|
-
writeFile: (
|
|
63874
|
-
return state.writeFile(normalizeEndpointThreadPath(
|
|
63869
|
+
readFile: (path3) => state.readFile(normalizeEndpointThreadPath(path3)),
|
|
63870
|
+
writeFile: (path3, data, mimeType = "application/octet-stream", options) => {
|
|
63871
|
+
return state.writeFile(normalizeEndpointThreadPath(path3), data, mimeType, options);
|
|
63875
63872
|
},
|
|
63876
|
-
statFile: (
|
|
63877
|
-
readdirFile: (
|
|
63878
|
-
unlinkFile: (
|
|
63879
|
-
mkdirFile: (
|
|
63880
|
-
rmdirFile: (
|
|
63873
|
+
statFile: (path3) => state.statFile(normalizeEndpointThreadPath(path3)),
|
|
63874
|
+
readdirFile: (path3) => state.readdirFile(normalizeEndpointThreadPath(path3)),
|
|
63875
|
+
unlinkFile: (path3) => state.unlinkFile(normalizeEndpointThreadPath(path3)),
|
|
63876
|
+
mkdirFile: (path3) => state.mkdirFile(normalizeEndpointThreadPath(path3)),
|
|
63877
|
+
rmdirFile: (path3) => state.rmdirFile(normalizeEndpointThreadPath(path3)),
|
|
63881
63878
|
moveFile: (sourcePath, destinationPath) => state.moveFile(
|
|
63882
63879
|
normalizeEndpointThreadPath(sourcePath),
|
|
63883
63880
|
normalizeEndpointThreadPath(destinationPath)
|
|
63884
63881
|
),
|
|
63885
|
-
renameFile: (
|
|
63882
|
+
renameFile: (path3, newName) => state.renameFile(normalizeEndpointThreadPath(path3), newName),
|
|
63886
63883
|
getFileStats: () => state.getFileStats(),
|
|
63887
63884
|
grepFiles: (pattern) => state.grepFiles(pattern),
|
|
63888
63885
|
findFiles: (pattern) => state.findFiles(pattern),
|
|
63889
|
-
getFileThumbnail: (
|
|
63886
|
+
getFileThumbnail: (path3) => state.getFileThumbnail(normalizeEndpointThreadPath(path3))
|
|
63890
63887
|
};
|
|
63891
63888
|
}
|
|
63892
63889
|
var RUNTIME_STORAGE_PREFIX, ThreadEndpoints;
|
|
@@ -65765,10 +65762,10 @@ var init_builder_pending_env = __esm({
|
|
|
65765
65762
|
for (const entry of value) {
|
|
65766
65763
|
if (!entry || typeof entry !== "object") continue;
|
|
65767
65764
|
const attachment = entry;
|
|
65768
|
-
const
|
|
65769
|
-
if (!
|
|
65765
|
+
const path3 = typeof attachment.path === "string" ? attachment.path.trim() : "";
|
|
65766
|
+
if (!path3) continue;
|
|
65770
65767
|
output.push({
|
|
65771
|
-
path:
|
|
65768
|
+
path: path3,
|
|
65772
65769
|
name: typeof attachment.name === "string" ? attachment.name : void 0,
|
|
65773
65770
|
mimeType: typeof attachment.mimeType === "string" ? attachment.mimeType : void 0,
|
|
65774
65771
|
size: typeof attachment.size === "number" ? attachment.size : void 0,
|
|
@@ -65785,8 +65782,8 @@ var init_builder_pending_env = __esm({
|
|
|
65785
65782
|
const trimmed = sanitized.replace(/^[-.]+|[-.]+$/g, "");
|
|
65786
65783
|
return trimmed || "attachment";
|
|
65787
65784
|
}
|
|
65788
|
-
inferMimeTypeFromPath(
|
|
65789
|
-
const normalized =
|
|
65785
|
+
inferMimeTypeFromPath(path3) {
|
|
65786
|
+
const normalized = path3.toLowerCase();
|
|
65790
65787
|
if (normalized.endsWith(".png")) return "image/png";
|
|
65791
65788
|
if (normalized.endsWith(".jpg") || normalized.endsWith(".jpeg")) return "image/jpeg";
|
|
65792
65789
|
if (normalized.endsWith(".webp")) return "image/webp";
|
|
@@ -65824,7 +65821,7 @@ var init_builder_pending_env = __esm({
|
|
|
65824
65821
|
if (!attachments || attachments.length === 0) {
|
|
65825
65822
|
return "";
|
|
65826
65823
|
}
|
|
65827
|
-
const paths = attachments.map((attachment) => attachment.path).filter((
|
|
65824
|
+
const paths = attachments.map((attachment) => attachment.path).filter((path3) => typeof path3 === "string" && path3.length > 0);
|
|
65828
65825
|
if (paths.length === 0) {
|
|
65829
65826
|
return "";
|
|
65830
65827
|
}
|
|
@@ -71249,7 +71246,7 @@ var init_DurableAgentBuilder = __esm({
|
|
|
71249
71246
|
for (const row of cursor.toArray()) {
|
|
71250
71247
|
if (skills.has(row.name)) continue;
|
|
71251
71248
|
const parsedFiles = row.files ? JSON.parse(row.files) : [];
|
|
71252
|
-
const files = Array.isArray(parsedFiles) ? parsedFiles.filter((
|
|
71249
|
+
const files = Array.isArray(parsedFiles) ? parsedFiles.filter((path3) => typeof path3 === "string").sort() : [];
|
|
71253
71250
|
skills.set(row.name, {
|
|
71254
71251
|
name: row.name,
|
|
71255
71252
|
description: row.description,
|
|
@@ -71267,7 +71264,7 @@ var init_DurableAgentBuilder = __esm({
|
|
|
71267
71264
|
return all.find((s) => s.name === name15) ?? null;
|
|
71268
71265
|
}
|
|
71269
71266
|
/** One bundled file's text (null when the skill or file is missing). */
|
|
71270
|
-
async getSkillFile(scope, name15,
|
|
71267
|
+
async getSkillFile(scope, name15, path3) {
|
|
71271
71268
|
await this.ensureMigrated();
|
|
71272
71269
|
const cursor = await this.ctx.storage.sql.exec(
|
|
71273
71270
|
`SELECT f.content FROM skill_files f
|
|
@@ -71277,7 +71274,7 @@ var init_DurableAgentBuilder = __esm({
|
|
|
71277
71274
|
ORDER BY CASE WHEN f.owner_id = ? THEN 0 ELSE 1 END
|
|
71278
71275
|
LIMIT 1`,
|
|
71279
71276
|
name15,
|
|
71280
|
-
|
|
71277
|
+
path3.replace(/^\.\//, ""),
|
|
71281
71278
|
scope.ownerId,
|
|
71282
71279
|
scope.includeShared ? 1 : 0,
|
|
71283
71280
|
scope.ownerId
|
|
@@ -72288,8 +72285,8 @@ var init_thread_subagents = __esm({
|
|
|
72288
72285
|
terminal: hasTerminalSessionTools
|
|
72289
72286
|
};
|
|
72290
72287
|
}
|
|
72291
|
-
inferMimeTypeFromPath(
|
|
72292
|
-
const normalized =
|
|
72288
|
+
inferMimeTypeFromPath(path3) {
|
|
72289
|
+
const normalized = path3.toLowerCase();
|
|
72293
72290
|
if (normalized.endsWith(".png")) return "image/png";
|
|
72294
72291
|
if (normalized.endsWith(".jpg") || normalized.endsWith(".jpeg")) return "image/jpeg";
|
|
72295
72292
|
if (normalized.endsWith(".webp")) return "image/webp";
|
|
@@ -72328,7 +72325,7 @@ var init_thread_subagents = __esm({
|
|
|
72328
72325
|
ext: value.slice(lastDot + 1).toLowerCase()
|
|
72329
72326
|
};
|
|
72330
72327
|
}
|
|
72331
|
-
resolveAttachmentMimeType(sourceMimeType, fallbackMimeType,
|
|
72328
|
+
resolveAttachmentMimeType(sourceMimeType, fallbackMimeType, path3) {
|
|
72332
72329
|
const source = sourceMimeType?.trim();
|
|
72333
72330
|
if (source && source !== "application/octet-stream") {
|
|
72334
72331
|
return source;
|
|
@@ -72337,7 +72334,7 @@ var init_thread_subagents = __esm({
|
|
|
72337
72334
|
if (fallback && fallback !== "application/octet-stream") {
|
|
72338
72335
|
return fallback;
|
|
72339
72336
|
}
|
|
72340
|
-
return this.inferMimeTypeFromPath(
|
|
72337
|
+
return this.inferMimeTypeFromPath(path3) ?? source ?? fallback ?? "application/octet-stream";
|
|
72341
72338
|
}
|
|
72342
72339
|
buildAttachmentTargetPath(preferredName, mimeType, sourcePath) {
|
|
72343
72340
|
const safeName = this.sanitizeFilename(preferredName);
|
|
@@ -72432,8 +72429,8 @@ var init_thread_subagents = __esm({
|
|
|
72432
72429
|
}
|
|
72433
72430
|
return copied;
|
|
72434
72431
|
}
|
|
72435
|
-
async readAttachmentDataFromSource(
|
|
72436
|
-
const sourceData = await this.services.readFile(
|
|
72432
|
+
async readAttachmentDataFromSource(path3, sourceFile) {
|
|
72433
|
+
const sourceData = await this.services.readFile(path3);
|
|
72437
72434
|
if (sourceData.success && sourceData.data) {
|
|
72438
72435
|
return sourceData.data;
|
|
72439
72436
|
}
|
|
@@ -72470,7 +72467,7 @@ var init_thread_subagents = __esm({
|
|
|
72470
72467
|
if (!attachments || attachments.length === 0) {
|
|
72471
72468
|
return "";
|
|
72472
72469
|
}
|
|
72473
|
-
const paths = attachments.map((attachment) => attachment.path).filter((
|
|
72470
|
+
const paths = attachments.map((attachment) => attachment.path).filter((path3) => typeof path3 === "string" && path3.length > 0);
|
|
72474
72471
|
if (paths.length === 0) {
|
|
72475
72472
|
return "";
|
|
72476
72473
|
}
|
|
@@ -73196,11 +73193,11 @@ var init_thread_files = __esm({
|
|
|
73196
73193
|
/**
|
|
73197
73194
|
* Write a file to storage (RPC method)
|
|
73198
73195
|
*/
|
|
73199
|
-
async writeFile(
|
|
73196
|
+
async writeFile(path3, data, mimeType, options) {
|
|
73200
73197
|
await this.services.ensureMigrated();
|
|
73201
73198
|
try {
|
|
73202
|
-
const
|
|
73203
|
-
const existingFile = await
|
|
73199
|
+
const fs = this.getFileStorage();
|
|
73200
|
+
const existingFile = await fs.stat(path3);
|
|
73204
73201
|
const isUpdate = existingFile !== null;
|
|
73205
73202
|
const binaryString = atob(data);
|
|
73206
73203
|
const dataBuffer = new Uint8Array(binaryString.length);
|
|
@@ -73223,12 +73220,12 @@ var init_thread_files = __esm({
|
|
|
73223
73220
|
}
|
|
73224
73221
|
}
|
|
73225
73222
|
}
|
|
73226
|
-
const record24 = await
|
|
73223
|
+
const record24 = await fs.writeFile(path3, dataBuffer.buffer, mimeType, {
|
|
73227
73224
|
metadata: options?.metadata,
|
|
73228
73225
|
thumbnail: thumbnailBuffer
|
|
73229
73226
|
});
|
|
73230
73227
|
this.services.broadcastEvent(isUpdate ? "file_updated" : "file_created", {
|
|
73231
|
-
path:
|
|
73228
|
+
path: path3,
|
|
73232
73229
|
file: record24
|
|
73233
73230
|
});
|
|
73234
73231
|
return { success: true, file: record24 };
|
|
@@ -73240,15 +73237,15 @@ var init_thread_files = __esm({
|
|
|
73240
73237
|
/**
|
|
73241
73238
|
* Write a text file to storage (RPC method)
|
|
73242
73239
|
*/
|
|
73243
|
-
async writeTextFile(
|
|
73240
|
+
async writeTextFile(path3, content, mimeType = "text/plain", options) {
|
|
73244
73241
|
await this.services.ensureMigrated();
|
|
73245
73242
|
try {
|
|
73246
|
-
const
|
|
73247
|
-
const existingFile = await
|
|
73243
|
+
const fs = this.getFileStorage();
|
|
73244
|
+
const existingFile = await fs.stat(path3);
|
|
73248
73245
|
const isUpdate = existingFile !== null;
|
|
73249
|
-
const record24 = await
|
|
73246
|
+
const record24 = await fs.writeFile(path3, content, mimeType, options);
|
|
73250
73247
|
this.services.broadcastEvent(isUpdate ? "file_updated" : "file_created", {
|
|
73251
|
-
path:
|
|
73248
|
+
path: path3,
|
|
73252
73249
|
file: record24
|
|
73253
73250
|
});
|
|
73254
73251
|
return { success: true, file: record24 };
|
|
@@ -73285,11 +73282,11 @@ var init_thread_files = __esm({
|
|
|
73285
73282
|
/**
|
|
73286
73283
|
* Link to an external file (RPC method)
|
|
73287
73284
|
*/
|
|
73288
|
-
async linkFile(
|
|
73285
|
+
async linkFile(path3, location, options) {
|
|
73289
73286
|
await this.services.ensureMigrated();
|
|
73290
73287
|
try {
|
|
73291
|
-
const
|
|
73292
|
-
const record24 = await
|
|
73288
|
+
const fs = this.getFileStorage();
|
|
73289
|
+
const record24 = await fs.linkFile(path3, location, options);
|
|
73293
73290
|
return { success: true, file: record24 };
|
|
73294
73291
|
} catch (error) {
|
|
73295
73292
|
console.error("Error in linkFile:", error);
|
|
@@ -73300,11 +73297,11 @@ var init_thread_files = __esm({
|
|
|
73300
73297
|
* Read a file from storage (RPC method)
|
|
73301
73298
|
* Returns base64-encoded data
|
|
73302
73299
|
*/
|
|
73303
|
-
async readFile(
|
|
73300
|
+
async readFile(path3) {
|
|
73304
73301
|
await this.services.ensureMigrated();
|
|
73305
73302
|
try {
|
|
73306
|
-
const
|
|
73307
|
-
const data = await
|
|
73303
|
+
const fs = this.getFileStorage();
|
|
73304
|
+
const data = await fs.readFile(path3);
|
|
73308
73305
|
if (data === null) {
|
|
73309
73306
|
return { success: false, error: "File not found or external" };
|
|
73310
73307
|
}
|
|
@@ -73323,11 +73320,11 @@ var init_thread_files = __esm({
|
|
|
73323
73320
|
/**
|
|
73324
73321
|
* Read a text file from storage (RPC method)
|
|
73325
73322
|
*/
|
|
73326
|
-
async readTextFile(
|
|
73323
|
+
async readTextFile(path3) {
|
|
73327
73324
|
await this.services.ensureMigrated();
|
|
73328
73325
|
try {
|
|
73329
|
-
const
|
|
73330
|
-
const content = await
|
|
73326
|
+
const fs = this.getFileStorage();
|
|
73327
|
+
const content = await fs.readTextFile(path3);
|
|
73331
73328
|
if (content === null) {
|
|
73332
73329
|
return { success: false, error: "File not found or external" };
|
|
73333
73330
|
}
|
|
@@ -73340,11 +73337,11 @@ var init_thread_files = __esm({
|
|
|
73340
73337
|
/**
|
|
73341
73338
|
* Get file metadata (RPC method)
|
|
73342
73339
|
*/
|
|
73343
|
-
async statFile(
|
|
73340
|
+
async statFile(path3) {
|
|
73344
73341
|
await this.services.ensureMigrated();
|
|
73345
73342
|
try {
|
|
73346
|
-
const
|
|
73347
|
-
const record24 = await
|
|
73343
|
+
const fs = this.getFileStorage();
|
|
73344
|
+
const record24 = await fs.stat(path3);
|
|
73348
73345
|
if (record24 === null) {
|
|
73349
73346
|
return { success: false, error: "File not found" };
|
|
73350
73347
|
}
|
|
@@ -73357,11 +73354,11 @@ var init_thread_files = __esm({
|
|
|
73357
73354
|
/**
|
|
73358
73355
|
* Check if file exists (RPC method)
|
|
73359
73356
|
*/
|
|
73360
|
-
async fileExists(
|
|
73357
|
+
async fileExists(path3) {
|
|
73361
73358
|
await this.services.ensureMigrated();
|
|
73362
73359
|
try {
|
|
73363
|
-
const
|
|
73364
|
-
const exists2 = await
|
|
73360
|
+
const fs = this.getFileStorage();
|
|
73361
|
+
const exists2 = await fs.exists(path3);
|
|
73365
73362
|
return { success: true, exists: exists2 };
|
|
73366
73363
|
} catch (error) {
|
|
73367
73364
|
console.error("Error in fileExists:", error);
|
|
@@ -73371,12 +73368,12 @@ var init_thread_files = __esm({
|
|
|
73371
73368
|
/**
|
|
73372
73369
|
* Delete a file (RPC method)
|
|
73373
73370
|
*/
|
|
73374
|
-
async unlinkFile(
|
|
73371
|
+
async unlinkFile(path3) {
|
|
73375
73372
|
await this.services.ensureMigrated();
|
|
73376
73373
|
try {
|
|
73377
|
-
const
|
|
73378
|
-
await
|
|
73379
|
-
this.services.broadcastEvent("file_deleted", { path:
|
|
73374
|
+
const fs = this.getFileStorage();
|
|
73375
|
+
await fs.unlink(path3);
|
|
73376
|
+
this.services.broadcastEvent("file_deleted", { path: path3 });
|
|
73380
73377
|
return { success: true };
|
|
73381
73378
|
} catch (error) {
|
|
73382
73379
|
console.error("Error in unlinkFile:", error);
|
|
@@ -73386,12 +73383,12 @@ var init_thread_files = __esm({
|
|
|
73386
73383
|
/**
|
|
73387
73384
|
* Create a directory (RPC method)
|
|
73388
73385
|
*/
|
|
73389
|
-
async mkdirFile(
|
|
73386
|
+
async mkdirFile(path3) {
|
|
73390
73387
|
await this.services.ensureMigrated();
|
|
73391
73388
|
try {
|
|
73392
|
-
const
|
|
73393
|
-
const record24 = await
|
|
73394
|
-
this.services.broadcastEvent("file_created", { path:
|
|
73389
|
+
const fs = this.getFileStorage();
|
|
73390
|
+
const record24 = await fs.mkdir(path3);
|
|
73391
|
+
this.services.broadcastEvent("file_created", { path: path3, file: record24 });
|
|
73395
73392
|
return { success: true, directory: record24 };
|
|
73396
73393
|
} catch (error) {
|
|
73397
73394
|
console.error("Error in mkdirFile:", error);
|
|
@@ -73401,11 +73398,11 @@ var init_thread_files = __esm({
|
|
|
73401
73398
|
/**
|
|
73402
73399
|
* List directory contents (RPC method)
|
|
73403
73400
|
*/
|
|
73404
|
-
async readdirFile(
|
|
73401
|
+
async readdirFile(path3) {
|
|
73405
73402
|
await this.services.ensureMigrated();
|
|
73406
73403
|
try {
|
|
73407
|
-
const
|
|
73408
|
-
const files = await
|
|
73404
|
+
const fs = this.getFileStorage();
|
|
73405
|
+
const files = await fs.readdir(path3);
|
|
73409
73406
|
return { success: true, files };
|
|
73410
73407
|
} catch (error) {
|
|
73411
73408
|
console.error("Error in readdirFile:", error);
|
|
@@ -73415,12 +73412,12 @@ var init_thread_files = __esm({
|
|
|
73415
73412
|
/**
|
|
73416
73413
|
* Remove empty directory (RPC method)
|
|
73417
73414
|
*/
|
|
73418
|
-
async rmdirFile(
|
|
73415
|
+
async rmdirFile(path3) {
|
|
73419
73416
|
await this.services.ensureMigrated();
|
|
73420
73417
|
try {
|
|
73421
|
-
const
|
|
73422
|
-
await
|
|
73423
|
-
this.services.broadcastEvent("file_deleted", { path:
|
|
73418
|
+
const fs = this.getFileStorage();
|
|
73419
|
+
await fs.rmdir(path3);
|
|
73420
|
+
this.services.broadcastEvent("file_deleted", { path: path3 });
|
|
73424
73421
|
return { success: true };
|
|
73425
73422
|
} catch (error) {
|
|
73426
73423
|
console.error("Error in rmdirFile:", error);
|
|
@@ -73435,9 +73432,9 @@ var init_thread_files = __esm({
|
|
|
73435
73432
|
await this.services.ensureMigrated();
|
|
73436
73433
|
try {
|
|
73437
73434
|
const { normalizePath: normalizePath2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73438
|
-
const
|
|
73435
|
+
const fs = this.getFileStorage();
|
|
73439
73436
|
const from = normalizePath2(sourcePath);
|
|
73440
|
-
const record24 = await
|
|
73437
|
+
const record24 = await fs.move(sourcePath, destinationPath);
|
|
73441
73438
|
this.services.broadcastEvent("file_moved", { from, path: record24.path, file: record24 });
|
|
73442
73439
|
this.services.broadcastEvent("file_deleted", { path: from });
|
|
73443
73440
|
this.services.broadcastEvent("file_created", { path: record24.path, file: record24 });
|
|
@@ -73450,13 +73447,13 @@ var init_thread_files = __esm({
|
|
|
73450
73447
|
/**
|
|
73451
73448
|
* Rename a file or directory in place (RPC method).
|
|
73452
73449
|
*/
|
|
73453
|
-
async renameFile(
|
|
73450
|
+
async renameFile(path3, newName) {
|
|
73454
73451
|
await this.services.ensureMigrated();
|
|
73455
73452
|
try {
|
|
73456
73453
|
const { normalizePath: normalizePath2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73457
|
-
const
|
|
73458
|
-
const from = normalizePath2(
|
|
73459
|
-
const record24 = await
|
|
73454
|
+
const fs = this.getFileStorage();
|
|
73455
|
+
const from = normalizePath2(path3);
|
|
73456
|
+
const record24 = await fs.rename(path3, newName);
|
|
73460
73457
|
this.services.broadcastEvent("file_moved", { from, path: record24.path, file: record24 });
|
|
73461
73458
|
this.services.broadcastEvent("file_deleted", { path: from });
|
|
73462
73459
|
this.services.broadcastEvent("file_created", { path: record24.path, file: record24 });
|
|
@@ -73472,8 +73469,8 @@ var init_thread_files = __esm({
|
|
|
73472
73469
|
async getFileStats() {
|
|
73473
73470
|
await this.services.ensureMigrated();
|
|
73474
73471
|
try {
|
|
73475
|
-
const
|
|
73476
|
-
const stats = await
|
|
73472
|
+
const fs = this.getFileStorage();
|
|
73473
|
+
const stats = await fs.getFileStats();
|
|
73477
73474
|
return { success: true, stats };
|
|
73478
73475
|
} catch (error) {
|
|
73479
73476
|
console.error("Error in getFileStats:", error);
|
|
@@ -73484,11 +73481,11 @@ var init_thread_files = __esm({
|
|
|
73484
73481
|
* Get thumbnail for an image (RPC method)
|
|
73485
73482
|
* Returns base64-encoded data
|
|
73486
73483
|
*/
|
|
73487
|
-
async getFileThumbnail(
|
|
73484
|
+
async getFileThumbnail(path3) {
|
|
73488
73485
|
await this.services.ensureMigrated();
|
|
73489
73486
|
try {
|
|
73490
|
-
const
|
|
73491
|
-
const data = await
|
|
73487
|
+
const fs = this.getFileStorage();
|
|
73488
|
+
const data = await fs.getThumbnail(path3);
|
|
73492
73489
|
if (data === null) {
|
|
73493
73490
|
return { success: false, error: "Thumbnail not found" };
|
|
73494
73491
|
}
|
|
@@ -73510,8 +73507,8 @@ var init_thread_files = __esm({
|
|
|
73510
73507
|
async grepFiles(pattern, options) {
|
|
73511
73508
|
await this.services.ensureMigrated();
|
|
73512
73509
|
try {
|
|
73513
|
-
const
|
|
73514
|
-
const results = await
|
|
73510
|
+
const fs = this.getFileStorage();
|
|
73511
|
+
const results = await fs.grep(pattern, options);
|
|
73515
73512
|
return { success: true, results };
|
|
73516
73513
|
} catch (error) {
|
|
73517
73514
|
console.error("Error in grepFiles:", error);
|
|
@@ -73524,8 +73521,8 @@ var init_thread_files = __esm({
|
|
|
73524
73521
|
async findFiles(pattern, options) {
|
|
73525
73522
|
await this.services.ensureMigrated();
|
|
73526
73523
|
try {
|
|
73527
|
-
const
|
|
73528
|
-
const files = await
|
|
73524
|
+
const fs = this.getFileStorage();
|
|
73525
|
+
const files = await fs.find(pattern, options);
|
|
73529
73526
|
return { success: true, files };
|
|
73530
73527
|
} catch (error) {
|
|
73531
73528
|
console.error("Error in findFiles:", error);
|
|
@@ -73540,11 +73537,11 @@ var init_thread_files = __esm({
|
|
|
73540
73537
|
* Creates file record with is_chunked=1 and chunk_count=null.
|
|
73541
73538
|
* Caller should then use writeFileChunk() to write chunks.
|
|
73542
73539
|
*/
|
|
73543
|
-
async startChunkedUpload(
|
|
73540
|
+
async startChunkedUpload(path3, totalSize, mimeType, options) {
|
|
73544
73541
|
await this.services.ensureMigrated();
|
|
73545
73542
|
try {
|
|
73546
73543
|
const { CHUNK_SIZE: CHUNK_SIZE2, normalizePath: normalizePath2, basename: basename2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73547
|
-
const normalizedPath = normalizePath2(
|
|
73544
|
+
const normalizedPath = normalizePath2(path3);
|
|
73548
73545
|
const name15 = basename2(normalizedPath);
|
|
73549
73546
|
const now = Date.now();
|
|
73550
73547
|
const expectedChunks = Math.ceil(totalSize / CHUNK_SIZE2);
|
|
@@ -73581,11 +73578,11 @@ var init_thread_files = __esm({
|
|
|
73581
73578
|
* @param chunkIndex - 0-based chunk index
|
|
73582
73579
|
* @param data - Base64 encoded chunk data
|
|
73583
73580
|
*/
|
|
73584
|
-
async writeFileChunk(
|
|
73581
|
+
async writeFileChunk(path3, chunkIndex, data) {
|
|
73585
73582
|
await this.services.ensureMigrated();
|
|
73586
73583
|
try {
|
|
73587
73584
|
const { normalizePath: normalizePath2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73588
|
-
const normalizedPath = normalizePath2(
|
|
73585
|
+
const normalizedPath = normalizePath2(path3);
|
|
73589
73586
|
const binaryString = atob(data);
|
|
73590
73587
|
const dataBuffer = new Uint8Array(binaryString.length);
|
|
73591
73588
|
for (let i = 0; i < binaryString.length; i++) {
|
|
@@ -73607,12 +73604,12 @@ var init_thread_files = __esm({
|
|
|
73607
73604
|
* Complete a chunked file upload.
|
|
73608
73605
|
* Validates all chunks are present and sets chunk_count.
|
|
73609
73606
|
*/
|
|
73610
|
-
async completeChunkedUpload(
|
|
73607
|
+
async completeChunkedUpload(path3, expectedChunks, options) {
|
|
73611
73608
|
await this.services.ensureMigrated();
|
|
73612
73609
|
try {
|
|
73613
73610
|
const { normalizePath: normalizePath2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73614
|
-
const
|
|
73615
|
-
const normalizedPath = normalizePath2(
|
|
73611
|
+
const fs = this.getFileStorage();
|
|
73612
|
+
const normalizedPath = normalizePath2(path3);
|
|
73616
73613
|
const countResult = await this.storage.sql.exec(
|
|
73617
73614
|
`SELECT COUNT(*) as count FROM file_chunks WHERE file_path = ?`,
|
|
73618
73615
|
normalizedPath
|
|
@@ -73639,7 +73636,7 @@ var init_thread_files = __esm({
|
|
|
73639
73636
|
thumbnailBuffer || null,
|
|
73640
73637
|
normalizedPath
|
|
73641
73638
|
);
|
|
73642
|
-
const file = await
|
|
73639
|
+
const file = await fs.stat(normalizedPath);
|
|
73643
73640
|
if (!file) {
|
|
73644
73641
|
return { success: false, error: `File not found: ${normalizedPath}` };
|
|
73645
73642
|
}
|
|
@@ -73654,11 +73651,11 @@ var init_thread_files = __esm({
|
|
|
73654
73651
|
* Read a single chunk of a file.
|
|
73655
73652
|
* Use for streaming large files to client.
|
|
73656
73653
|
*/
|
|
73657
|
-
async readFileChunk(
|
|
73654
|
+
async readFileChunk(path3, chunkIndex) {
|
|
73658
73655
|
await this.services.ensureMigrated();
|
|
73659
73656
|
try {
|
|
73660
73657
|
const { normalizePath: normalizePath2 } = await Promise.resolve().then(() => (init_files3(), files_exports2));
|
|
73661
|
-
const normalizedPath = normalizePath2(
|
|
73658
|
+
const normalizedPath = normalizePath2(path3);
|
|
73662
73659
|
const cursor = await this.storage.sql.exec(
|
|
73663
73660
|
`SELECT data FROM file_chunks WHERE file_path = ? AND chunk_index = ?`,
|
|
73664
73661
|
normalizedPath,
|
|
@@ -73683,11 +73680,11 @@ var init_thread_files = __esm({
|
|
|
73683
73680
|
/**
|
|
73684
73681
|
* Get file info including chunking metadata.
|
|
73685
73682
|
*/
|
|
73686
|
-
async getFileInfo(
|
|
73683
|
+
async getFileInfo(path3) {
|
|
73687
73684
|
await this.services.ensureMigrated();
|
|
73688
73685
|
try {
|
|
73689
|
-
const
|
|
73690
|
-
const file = await
|
|
73686
|
+
const fs = this.getFileStorage();
|
|
73687
|
+
const file = await fs.stat(path3);
|
|
73691
73688
|
if (!file) {
|
|
73692
73689
|
return { success: false, error: "File not found" };
|
|
73693
73690
|
}
|
|
@@ -78358,21 +78355,21 @@ async function prepareExecutableSource(source, language, filename = DEFAULT_FILE
|
|
|
78358
78355
|
if (language !== "typescript") {
|
|
78359
78356
|
return source;
|
|
78360
78357
|
}
|
|
78361
|
-
const
|
|
78362
|
-
if (!
|
|
78358
|
+
const ts = await loadTypeScriptCompiler();
|
|
78359
|
+
if (!ts) {
|
|
78363
78360
|
return stripTypeScriptTypes(source);
|
|
78364
78361
|
}
|
|
78365
|
-
const output =
|
|
78362
|
+
const output = ts.transpileModule(source, {
|
|
78366
78363
|
fileName: filename,
|
|
78367
78364
|
reportDiagnostics: true,
|
|
78368
|
-
compilerOptions: createTranspileCompilerOptions(
|
|
78365
|
+
compilerOptions: createTranspileCompilerOptions(ts)
|
|
78369
78366
|
});
|
|
78370
78367
|
const diagnostics = output.diagnostics ?? [];
|
|
78371
78368
|
const blocking = diagnostics.find(
|
|
78372
|
-
(diagnostic) => diagnostic.category ===
|
|
78369
|
+
(diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error
|
|
78373
78370
|
);
|
|
78374
78371
|
if (blocking) {
|
|
78375
|
-
throw diagnosticToCodeExecutionError(
|
|
78372
|
+
throw diagnosticToCodeExecutionError(ts, blocking, filename);
|
|
78376
78373
|
}
|
|
78377
78374
|
return output.outputText;
|
|
78378
78375
|
}
|
|
@@ -78426,7 +78423,7 @@ function normalizeTypeScriptCompiler(module) {
|
|
|
78426
78423
|
}
|
|
78427
78424
|
return null;
|
|
78428
78425
|
}
|
|
78429
|
-
function createTranspileCompilerOptions(
|
|
78426
|
+
function createTranspileCompilerOptions(ts) {
|
|
78430
78427
|
const options = {
|
|
78431
78428
|
isolatedModules: true,
|
|
78432
78429
|
preserveValueImports: false,
|
|
@@ -78434,30 +78431,30 @@ function createTranspileCompilerOptions(ts2) {
|
|
|
78434
78431
|
inlineSourceMap: false,
|
|
78435
78432
|
inlineSources: false
|
|
78436
78433
|
};
|
|
78437
|
-
const target =
|
|
78434
|
+
const target = ts.ScriptTarget?.ES2022 ?? ts.ScriptTarget?.ES2021 ?? ts.ScriptTarget?.ES2020;
|
|
78438
78435
|
if (target !== void 0) {
|
|
78439
78436
|
options.target = target;
|
|
78440
78437
|
}
|
|
78441
|
-
const moduleKind =
|
|
78438
|
+
const moduleKind = ts.ModuleKind?.ESNext ?? ts.ModuleKind?.ES2022 ?? ts.ModuleKind?.ES2020;
|
|
78442
78439
|
if (moduleKind !== void 0) {
|
|
78443
78440
|
options.module = moduleKind;
|
|
78444
78441
|
}
|
|
78445
|
-
const moduleResolution =
|
|
78442
|
+
const moduleResolution = ts.ModuleResolutionKind?.Bundler ?? ts.ModuleResolutionKind?.NodeNext ?? ts.ModuleResolutionKind?.Node16 ?? ts.ModuleResolutionKind?.NodeJs;
|
|
78446
78443
|
if (moduleResolution !== void 0) {
|
|
78447
78444
|
options.moduleResolution = moduleResolution;
|
|
78448
78445
|
}
|
|
78449
|
-
const jsx =
|
|
78446
|
+
const jsx = ts.JsxEmit?.ReactJSX ?? ts.JsxEmit?.Preserve;
|
|
78450
78447
|
if (jsx !== void 0) {
|
|
78451
78448
|
options.jsx = jsx;
|
|
78452
78449
|
}
|
|
78453
|
-
const importsNotUsedAsValues =
|
|
78450
|
+
const importsNotUsedAsValues = ts.ImportsNotUsedAsValues?.Remove;
|
|
78454
78451
|
if (importsNotUsedAsValues !== void 0) {
|
|
78455
78452
|
options.importsNotUsedAsValues = importsNotUsedAsValues;
|
|
78456
78453
|
}
|
|
78457
78454
|
return options;
|
|
78458
78455
|
}
|
|
78459
|
-
function diagnosticToCodeExecutionError(
|
|
78460
|
-
const message =
|
|
78456
|
+
function diagnosticToCodeExecutionError(ts, diagnostic, fallbackFilename) {
|
|
78457
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
78461
78458
|
const file = diagnostic.file;
|
|
78462
78459
|
if (file && typeof diagnostic.start === "number") {
|
|
78463
78460
|
const position = file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
@@ -78512,32 +78509,32 @@ function prepareBridge(options, reports, logs) {
|
|
|
78512
78509
|
logs
|
|
78513
78510
|
};
|
|
78514
78511
|
}
|
|
78515
|
-
function prepareNamespaceRecord(value,
|
|
78512
|
+
function prepareNamespaceRecord(value, path3, functions) {
|
|
78516
78513
|
const out = {};
|
|
78517
78514
|
for (const [key, namespace] of Object.entries(value)) {
|
|
78518
|
-
out[key] = prepareValueRecord(namespace, `${
|
|
78515
|
+
out[key] = prepareValueRecord(namespace, `${path3}.${key}`, functions);
|
|
78519
78516
|
}
|
|
78520
78517
|
return out;
|
|
78521
78518
|
}
|
|
78522
|
-
function prepareValueRecord(value,
|
|
78519
|
+
function prepareValueRecord(value, path3, functions) {
|
|
78523
78520
|
const out = {};
|
|
78524
78521
|
for (const [key, item] of Object.entries(value)) {
|
|
78525
|
-
out[key] = prepareBridgeValue(item, `${
|
|
78522
|
+
out[key] = prepareBridgeValue(item, `${path3}.${key}`, functions);
|
|
78526
78523
|
}
|
|
78527
78524
|
return out;
|
|
78528
78525
|
}
|
|
78529
|
-
function prepareBridgeValue(value,
|
|
78526
|
+
function prepareBridgeValue(value, path3, functions) {
|
|
78530
78527
|
if (typeof value === "function") {
|
|
78531
|
-
functions.set(
|
|
78532
|
-
return { __agentbuilderType: "function", id:
|
|
78528
|
+
functions.set(path3, value);
|
|
78529
|
+
return { __agentbuilderType: "function", id: path3 };
|
|
78533
78530
|
}
|
|
78534
78531
|
if (isThenable(value)) {
|
|
78535
|
-
const promiseId = `${
|
|
78532
|
+
const promiseId = `${path3}.__promise`;
|
|
78536
78533
|
functions.set(promiseId, async () => value);
|
|
78537
78534
|
return { __agentbuilderType: "promise", id: promiseId };
|
|
78538
78535
|
}
|
|
78539
78536
|
if (Array.isArray(value)) {
|
|
78540
|
-
return value.map((item, index) => prepareBridgeValue(item, `${
|
|
78537
|
+
return value.map((item, index) => prepareBridgeValue(item, `${path3}.${index}`, functions));
|
|
78541
78538
|
}
|
|
78542
78539
|
if (value && typeof value === "object") {
|
|
78543
78540
|
if (value instanceof Date || value instanceof Map || value instanceof Set || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {
|
|
@@ -78548,7 +78545,7 @@ function prepareBridgeValue(value, path7, functions) {
|
|
|
78548
78545
|
}
|
|
78549
78546
|
const out = {};
|
|
78550
78547
|
for (const [key, item] of Object.entries(value)) {
|
|
78551
|
-
out[key] = prepareBridgeValue(item, `${
|
|
78548
|
+
out[key] = prepareBridgeValue(item, `${path3}.${key}`, functions);
|
|
78552
78549
|
}
|
|
78553
78550
|
return out;
|
|
78554
78551
|
}
|
|
@@ -79423,12 +79420,12 @@ function normalizeVirtualModulePath(basePath, specifier) {
|
|
|
79423
79420
|
}
|
|
79424
79421
|
return normalized;
|
|
79425
79422
|
}
|
|
79426
|
-
function dirnameModulePath(
|
|
79427
|
-
const index =
|
|
79428
|
-
return index <= 0 ? "" :
|
|
79423
|
+
function dirnameModulePath(path3) {
|
|
79424
|
+
const index = path3.lastIndexOf("/");
|
|
79425
|
+
return index <= 0 ? "" : path3.slice(0, index);
|
|
79429
79426
|
}
|
|
79430
|
-
function hasModuleExtension(
|
|
79431
|
-
return /\.[A-Za-z0-9]+$/.test(
|
|
79427
|
+
function hasModuleExtension(path3) {
|
|
79428
|
+
return /\.[A-Za-z0-9]+$/.test(path3);
|
|
79432
79429
|
}
|
|
79433
79430
|
function resolveGraphModuleSpecifier(fromPath, specifier, modulePaths) {
|
|
79434
79431
|
const base = normalizeVirtualModulePath(dirnameModulePath(fromPath), specifier);
|
|
@@ -80051,8 +80048,8 @@ var init_DurableThread = __esm({
|
|
|
80051
80048
|
getLatestTerminalSessionMessageAfter: (...args) => this.getLatestTerminalSessionMessageAfter(...args),
|
|
80052
80049
|
parseAttachmentRefsJson: (raw) => this.parseAttachmentRefsJson(raw),
|
|
80053
80050
|
persistParentHandoffStatusMessage: (threadId, kind) => this.persistParentHandoffStatusMessage(threadId, kind),
|
|
80054
|
-
readFile: (
|
|
80055
|
-
statFile: (
|
|
80051
|
+
readFile: (path3) => this.readFile(path3),
|
|
80052
|
+
statFile: (path3) => this.statFile(path3),
|
|
80056
80053
|
broadcastMessage: (message) => this.broadcastMessage(message)
|
|
80057
80054
|
}
|
|
80058
80055
|
);
|
|
@@ -80135,7 +80132,7 @@ var init_DurableThread = __esm({
|
|
|
80135
80132
|
ensureMigrated: () => this.ensureMigrated(),
|
|
80136
80133
|
getChildrenRegistry: (threadId) => this.getChildrenRegistry(threadId),
|
|
80137
80134
|
loadAgent: (name15, namespace) => this.loadAgent(name15, namespace),
|
|
80138
|
-
unlinkFile: (
|
|
80135
|
+
unlinkFile: (path3) => this.unlinkFile(path3),
|
|
80139
80136
|
broadcastMessage: (message) => this.broadcastMessage(message),
|
|
80140
80137
|
broadcastMessageRow: (row) => this.broadcastMessageRow(row)
|
|
80141
80138
|
}
|
|
@@ -81626,53 +81623,53 @@ var init_DurableThread = __esm({
|
|
|
81626
81623
|
testOperation(id, label, expectedOrder) {
|
|
81627
81624
|
return this.getDevelopment().testOperation(id, label, expectedOrder);
|
|
81628
81625
|
}
|
|
81629
|
-
writeFile(
|
|
81630
|
-
return this.getFiles().writeFile(
|
|
81626
|
+
writeFile(path3, data, mimeType, options) {
|
|
81627
|
+
return this.getFiles().writeFile(path3, data, mimeType, options);
|
|
81631
81628
|
}
|
|
81632
|
-
writeTextFile(
|
|
81633
|
-
return this.getFiles().writeTextFile(
|
|
81629
|
+
writeTextFile(path3, content, mimeType = "text/plain", options) {
|
|
81630
|
+
return this.getFiles().writeTextFile(path3, content, mimeType, options);
|
|
81634
81631
|
}
|
|
81635
81632
|
processImage(data, mimeType) {
|
|
81636
81633
|
return this.getFiles().processImage(data, mimeType);
|
|
81637
81634
|
}
|
|
81638
|
-
linkFile(
|
|
81639
|
-
return this.getFiles().linkFile(
|
|
81635
|
+
linkFile(path3, location, options) {
|
|
81636
|
+
return this.getFiles().linkFile(path3, location, options);
|
|
81640
81637
|
}
|
|
81641
|
-
readFile(
|
|
81642
|
-
return this.getFiles().readFile(
|
|
81638
|
+
readFile(path3) {
|
|
81639
|
+
return this.getFiles().readFile(path3);
|
|
81643
81640
|
}
|
|
81644
|
-
readTextFile(
|
|
81645
|
-
return this.getFiles().readTextFile(
|
|
81641
|
+
readTextFile(path3) {
|
|
81642
|
+
return this.getFiles().readTextFile(path3);
|
|
81646
81643
|
}
|
|
81647
|
-
statFile(
|
|
81648
|
-
return this.getFiles().statFile(
|
|
81644
|
+
statFile(path3) {
|
|
81645
|
+
return this.getFiles().statFile(path3);
|
|
81649
81646
|
}
|
|
81650
|
-
fileExists(
|
|
81651
|
-
return this.getFiles().fileExists(
|
|
81647
|
+
fileExists(path3) {
|
|
81648
|
+
return this.getFiles().fileExists(path3);
|
|
81652
81649
|
}
|
|
81653
|
-
unlinkFile(
|
|
81654
|
-
return this.getFiles().unlinkFile(
|
|
81650
|
+
unlinkFile(path3) {
|
|
81651
|
+
return this.getFiles().unlinkFile(path3);
|
|
81655
81652
|
}
|
|
81656
|
-
mkdirFile(
|
|
81657
|
-
return this.getFiles().mkdirFile(
|
|
81653
|
+
mkdirFile(path3) {
|
|
81654
|
+
return this.getFiles().mkdirFile(path3);
|
|
81658
81655
|
}
|
|
81659
|
-
readdirFile(
|
|
81660
|
-
return this.getFiles().readdirFile(
|
|
81656
|
+
readdirFile(path3) {
|
|
81657
|
+
return this.getFiles().readdirFile(path3);
|
|
81661
81658
|
}
|
|
81662
|
-
rmdirFile(
|
|
81663
|
-
return this.getFiles().rmdirFile(
|
|
81659
|
+
rmdirFile(path3) {
|
|
81660
|
+
return this.getFiles().rmdirFile(path3);
|
|
81664
81661
|
}
|
|
81665
81662
|
moveFile(sourcePath, destinationPath) {
|
|
81666
81663
|
return this.getFiles().moveFile(sourcePath, destinationPath);
|
|
81667
81664
|
}
|
|
81668
|
-
renameFile(
|
|
81669
|
-
return this.getFiles().renameFile(
|
|
81665
|
+
renameFile(path3, newName) {
|
|
81666
|
+
return this.getFiles().renameFile(path3, newName);
|
|
81670
81667
|
}
|
|
81671
81668
|
getFileStats() {
|
|
81672
81669
|
return this.getFiles().getFileStats();
|
|
81673
81670
|
}
|
|
81674
|
-
getFileThumbnail(
|
|
81675
|
-
return this.getFiles().getFileThumbnail(
|
|
81671
|
+
getFileThumbnail(path3) {
|
|
81672
|
+
return this.getFiles().getFileThumbnail(path3);
|
|
81676
81673
|
}
|
|
81677
81674
|
grepFiles(pattern, options) {
|
|
81678
81675
|
return this.getFiles().grepFiles(pattern, options);
|
|
@@ -81680,20 +81677,20 @@ var init_DurableThread = __esm({
|
|
|
81680
81677
|
findFiles(pattern, options) {
|
|
81681
81678
|
return this.getFiles().findFiles(pattern, options);
|
|
81682
81679
|
}
|
|
81683
|
-
startChunkedUpload(
|
|
81684
|
-
return this.getFiles().startChunkedUpload(
|
|
81680
|
+
startChunkedUpload(path3, totalSize, mimeType, options) {
|
|
81681
|
+
return this.getFiles().startChunkedUpload(path3, totalSize, mimeType, options);
|
|
81685
81682
|
}
|
|
81686
|
-
writeFileChunk(
|
|
81687
|
-
return this.getFiles().writeFileChunk(
|
|
81683
|
+
writeFileChunk(path3, chunkIndex, data) {
|
|
81684
|
+
return this.getFiles().writeFileChunk(path3, chunkIndex, data);
|
|
81688
81685
|
}
|
|
81689
|
-
completeChunkedUpload(
|
|
81690
|
-
return this.getFiles().completeChunkedUpload(
|
|
81686
|
+
completeChunkedUpload(path3, expectedChunks, options) {
|
|
81687
|
+
return this.getFiles().completeChunkedUpload(path3, expectedChunks, options);
|
|
81691
81688
|
}
|
|
81692
|
-
readFileChunk(
|
|
81693
|
-
return this.getFiles().readFileChunk(
|
|
81689
|
+
readFileChunk(path3, chunkIndex) {
|
|
81690
|
+
return this.getFiles().readFileChunk(path3, chunkIndex);
|
|
81694
81691
|
}
|
|
81695
|
-
getFileInfo(
|
|
81696
|
-
return this.getFiles().getFileInfo(
|
|
81692
|
+
getFileInfo(path3) {
|
|
81693
|
+
return this.getFiles().getFileInfo(path3);
|
|
81697
81694
|
}
|
|
81698
81695
|
};
|
|
81699
81696
|
}
|
|
@@ -83950,7 +83947,7 @@ async function updateThread(thread, params) {
|
|
|
83950
83947
|
}
|
|
83951
83948
|
return result.thread;
|
|
83952
83949
|
}
|
|
83953
|
-
async function writeFile(flow,
|
|
83950
|
+
async function writeFile(flow, path3, data, mimeType, options) {
|
|
83954
83951
|
const instance = flow.thread.instance;
|
|
83955
83952
|
let base64Data;
|
|
83956
83953
|
if (typeof data === "string") {
|
|
@@ -83972,7 +83969,7 @@ async function writeFile(flow, path7, data, mimeType, options) {
|
|
|
83972
83969
|
}
|
|
83973
83970
|
base64Thumbnail = btoa(binary);
|
|
83974
83971
|
}
|
|
83975
|
-
const result = await instance.writeFile(
|
|
83972
|
+
const result = await instance.writeFile(path3, base64Data, mimeType, {
|
|
83976
83973
|
metadata: options?.metadata,
|
|
83977
83974
|
thumbnail: base64Thumbnail
|
|
83978
83975
|
});
|
|
@@ -83981,18 +83978,18 @@ async function writeFile(flow, path7, data, mimeType, options) {
|
|
|
83981
83978
|
}
|
|
83982
83979
|
return result.file;
|
|
83983
83980
|
}
|
|
83984
|
-
async function writeImage(flow,
|
|
83985
|
-
return writeFile(flow,
|
|
83981
|
+
async function writeImage(flow, path3, data, mimeType, options) {
|
|
83982
|
+
return writeFile(flow, path3, data, mimeType, options);
|
|
83986
83983
|
}
|
|
83987
|
-
async function linkFile(flow,
|
|
83988
|
-
const result = await flow.thread.instance.linkFile(
|
|
83984
|
+
async function linkFile(flow, path3, location, options) {
|
|
83985
|
+
const result = await flow.thread.instance.linkFile(path3, location, options);
|
|
83989
83986
|
if (!result.success) {
|
|
83990
83987
|
throw new Error(result.error || "Failed to link file");
|
|
83991
83988
|
}
|
|
83992
83989
|
return result.file;
|
|
83993
83990
|
}
|
|
83994
|
-
async function readFile(flow,
|
|
83995
|
-
const result = await flow.thread.instance.readFile(
|
|
83991
|
+
async function readFile(flow, path3) {
|
|
83992
|
+
const result = await flow.thread.instance.readFile(path3);
|
|
83996
83993
|
if (!result.success) {
|
|
83997
83994
|
return null;
|
|
83998
83995
|
}
|
|
@@ -84003,39 +84000,39 @@ async function readFile(flow, path7) {
|
|
|
84003
84000
|
}
|
|
84004
84001
|
return bytes.buffer;
|
|
84005
84002
|
}
|
|
84006
|
-
async function stat(flow,
|
|
84007
|
-
const result = await flow.thread.instance.statFile(
|
|
84003
|
+
async function stat(flow, path3) {
|
|
84004
|
+
const result = await flow.thread.instance.statFile(path3);
|
|
84008
84005
|
if (!result.success) {
|
|
84009
84006
|
return null;
|
|
84010
84007
|
}
|
|
84011
84008
|
return result.file;
|
|
84012
84009
|
}
|
|
84013
|
-
async function exists(flow,
|
|
84014
|
-
const result = await flow.thread.instance.fileExists(
|
|
84010
|
+
async function exists(flow, path3) {
|
|
84011
|
+
const result = await flow.thread.instance.fileExists(path3);
|
|
84015
84012
|
return result.success && result.exists;
|
|
84016
84013
|
}
|
|
84017
|
-
async function unlink(flow,
|
|
84018
|
-
const result = await flow.thread.instance.unlinkFile(
|
|
84014
|
+
async function unlink(flow, path3) {
|
|
84015
|
+
const result = await flow.thread.instance.unlinkFile(path3);
|
|
84019
84016
|
if (!result.success) {
|
|
84020
84017
|
throw new Error(result.error || "Failed to delete file");
|
|
84021
84018
|
}
|
|
84022
84019
|
}
|
|
84023
|
-
async function mkdir(flow,
|
|
84024
|
-
const result = await flow.thread.instance.mkdirFile(
|
|
84020
|
+
async function mkdir(flow, path3) {
|
|
84021
|
+
const result = await flow.thread.instance.mkdirFile(path3);
|
|
84025
84022
|
if (!result.success) {
|
|
84026
84023
|
throw new Error(result.error || "Failed to create directory");
|
|
84027
84024
|
}
|
|
84028
84025
|
return result.directory;
|
|
84029
84026
|
}
|
|
84030
|
-
async function readdir(flow,
|
|
84031
|
-
const result = await flow.thread.instance.readdirFile(
|
|
84027
|
+
async function readdir(flow, path3) {
|
|
84028
|
+
const result = await flow.thread.instance.readdirFile(path3);
|
|
84032
84029
|
if (!result.success) {
|
|
84033
84030
|
throw new Error(result.error || "Failed to read directory");
|
|
84034
84031
|
}
|
|
84035
84032
|
return result.files;
|
|
84036
84033
|
}
|
|
84037
|
-
async function rmdir(flow,
|
|
84038
|
-
const result = await flow.thread.instance.rmdirFile(
|
|
84034
|
+
async function rmdir(flow, path3) {
|
|
84035
|
+
const result = await flow.thread.instance.rmdirFile(path3);
|
|
84039
84036
|
if (!result.success) {
|
|
84040
84037
|
throw new Error(result.error || "Failed to remove directory");
|
|
84041
84038
|
}
|
|
@@ -84047,8 +84044,8 @@ async function move(flow, sourcePath, destinationPath) {
|
|
|
84047
84044
|
}
|
|
84048
84045
|
return result.file;
|
|
84049
84046
|
}
|
|
84050
|
-
async function rename(flow,
|
|
84051
|
-
const result = await flow.thread.instance.renameFile(
|
|
84047
|
+
async function rename(flow, path3, newName) {
|
|
84048
|
+
const result = await flow.thread.instance.renameFile(path3, newName);
|
|
84052
84049
|
if (!result.success) {
|
|
84053
84050
|
throw new Error(result.error || "Failed to rename file");
|
|
84054
84051
|
}
|
|
@@ -84061,8 +84058,8 @@ async function getFileStats(flow) {
|
|
|
84061
84058
|
}
|
|
84062
84059
|
return result.stats;
|
|
84063
84060
|
}
|
|
84064
|
-
async function getThumbnail(flow,
|
|
84065
|
-
const result = await flow.thread.instance.getFileThumbnail(
|
|
84061
|
+
async function getThumbnail(flow, path3) {
|
|
84062
|
+
const result = await flow.thread.instance.getFileThumbnail(path3);
|
|
84066
84063
|
if (!result.success) {
|
|
84067
84064
|
return null;
|
|
84068
84065
|
}
|
|
@@ -84073,21 +84070,21 @@ async function getThumbnail(flow, path7) {
|
|
|
84073
84070
|
}
|
|
84074
84071
|
return bytes.buffer;
|
|
84075
84072
|
}
|
|
84076
|
-
async function cat(flow,
|
|
84077
|
-
const result = await flow.thread.instance.readTextFile(
|
|
84073
|
+
async function cat(flow, path3) {
|
|
84074
|
+
const result = await flow.thread.instance.readTextFile(path3);
|
|
84078
84075
|
if (!result.success) {
|
|
84079
84076
|
return null;
|
|
84080
84077
|
}
|
|
84081
84078
|
return result.content;
|
|
84082
84079
|
}
|
|
84083
|
-
async function head(flow,
|
|
84084
|
-
const content = await cat(flow,
|
|
84080
|
+
async function head(flow, path3, lines = 10) {
|
|
84081
|
+
const content = await cat(flow, path3);
|
|
84085
84082
|
if (content === null) return null;
|
|
84086
84083
|
const allLines = content.split("\n");
|
|
84087
84084
|
return allLines.slice(0, lines).join("\n");
|
|
84088
84085
|
}
|
|
84089
|
-
async function tail(flow,
|
|
84090
|
-
const content = await cat(flow,
|
|
84086
|
+
async function tail(flow, path3, lines = 10) {
|
|
84087
|
+
const content = await cat(flow, path3);
|
|
84091
84088
|
if (content === null) return null;
|
|
84092
84089
|
const allLines = content.split("\n");
|
|
84093
84090
|
return allLines.slice(-lines).join("\n");
|
|
@@ -85150,7 +85147,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85150
85147
|
// ─────────────────────────────────────────────────────────────────────────
|
|
85151
85148
|
// File System
|
|
85152
85149
|
// ─────────────────────────────────────────────────────────────────────────
|
|
85153
|
-
async writeFile(
|
|
85150
|
+
async writeFile(path3, data, mimeType, options) {
|
|
85154
85151
|
const isText = this._isTextMimeType(mimeType);
|
|
85155
85152
|
if (isText) {
|
|
85156
85153
|
let textContent;
|
|
@@ -85159,7 +85156,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85159
85156
|
} else {
|
|
85160
85157
|
textContent = new TextDecoder().decode(data);
|
|
85161
85158
|
}
|
|
85162
|
-
const result = await this._threadInstance.writeTextFile(
|
|
85159
|
+
const result = await this._threadInstance.writeTextFile(path3, textContent, mimeType, options);
|
|
85163
85160
|
if (!result.success) throw new Error(result.error);
|
|
85164
85161
|
return this._mapFileRecord(result.file);
|
|
85165
85162
|
} else {
|
|
@@ -85180,7 +85177,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85180
85177
|
}
|
|
85181
85178
|
base64Data = btoa(binary);
|
|
85182
85179
|
}
|
|
85183
|
-
const result = await this._threadInstance.writeFile(
|
|
85180
|
+
const result = await this._threadInstance.writeFile(path3, base64Data, mimeType, options);
|
|
85184
85181
|
if (!result.success) throw new Error(result.error);
|
|
85185
85182
|
return this._mapFileRecord(result.file);
|
|
85186
85183
|
}
|
|
@@ -85253,8 +85250,8 @@ var init_ThreadStateImpl = __esm({
|
|
|
85253
85250
|
(type) => mimeType === type || mimeType.startsWith(type + ";")
|
|
85254
85251
|
);
|
|
85255
85252
|
}
|
|
85256
|
-
async readFile(
|
|
85257
|
-
const result = await this._threadInstance.readFile(
|
|
85253
|
+
async readFile(path3) {
|
|
85254
|
+
const result = await this._threadInstance.readFile(path3);
|
|
85258
85255
|
if (!result.success || !result.data) {
|
|
85259
85256
|
return null;
|
|
85260
85257
|
}
|
|
@@ -85265,8 +85262,8 @@ var init_ThreadStateImpl = __esm({
|
|
|
85265
85262
|
}
|
|
85266
85263
|
return bytes.buffer;
|
|
85267
85264
|
}
|
|
85268
|
-
async readFileStream(
|
|
85269
|
-
const stat2 = await this._threadInstance.statFile(
|
|
85265
|
+
async readFileStream(path3, options) {
|
|
85266
|
+
const stat2 = await this._threadInstance.statFile(path3);
|
|
85270
85267
|
if (!stat2.success) {
|
|
85271
85268
|
return null;
|
|
85272
85269
|
}
|
|
@@ -85282,7 +85279,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85282
85279
|
return {
|
|
85283
85280
|
[Symbol.asyncIterator]: async function* () {
|
|
85284
85281
|
if (!isChunked) {
|
|
85285
|
-
const result = await threadInstance.readFile(
|
|
85282
|
+
const result = await threadInstance.readFile(path3);
|
|
85286
85283
|
if (!result.success || !result.data) {
|
|
85287
85284
|
return;
|
|
85288
85285
|
}
|
|
@@ -85303,7 +85300,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85303
85300
|
if (signal?.aborted) {
|
|
85304
85301
|
return;
|
|
85305
85302
|
}
|
|
85306
|
-
const result = await threadInstance.readFileChunk(
|
|
85303
|
+
const result = await threadInstance.readFileChunk(path3, i);
|
|
85307
85304
|
if (!result.success) {
|
|
85308
85305
|
throw new Error(result.error || `Failed to read chunk ${i}`);
|
|
85309
85306
|
}
|
|
@@ -85325,28 +85322,28 @@ var init_ThreadStateImpl = __esm({
|
|
|
85325
85322
|
}
|
|
85326
85323
|
};
|
|
85327
85324
|
}
|
|
85328
|
-
async statFile(
|
|
85329
|
-
const result = await this._threadInstance.statFile(
|
|
85325
|
+
async statFile(path3) {
|
|
85326
|
+
const result = await this._threadInstance.statFile(path3);
|
|
85330
85327
|
return result.success ? this._mapFileRecord(result.file) : null;
|
|
85331
85328
|
}
|
|
85332
|
-
async readdirFile(
|
|
85333
|
-
const result = await this._threadInstance.readdirFile(
|
|
85334
|
-
if (!result.success) throw new Error(result.error || `Could not list directory: ${
|
|
85329
|
+
async readdirFile(path3) {
|
|
85330
|
+
const result = await this._threadInstance.readdirFile(path3);
|
|
85331
|
+
if (!result.success) throw new Error(result.error || `Could not list directory: ${path3}`);
|
|
85335
85332
|
return {
|
|
85336
85333
|
entries: result.files.map((entry) => this._mapFileRecord(entry))
|
|
85337
85334
|
};
|
|
85338
85335
|
}
|
|
85339
|
-
async unlinkFile(
|
|
85340
|
-
const result = await this._threadInstance.unlinkFile(
|
|
85336
|
+
async unlinkFile(path3) {
|
|
85337
|
+
const result = await this._threadInstance.unlinkFile(path3);
|
|
85341
85338
|
if (!result.success) throw new Error(result.error || "Failed to delete file");
|
|
85342
85339
|
}
|
|
85343
|
-
async mkdirFile(
|
|
85344
|
-
const result = await this._threadInstance.mkdirFile(
|
|
85340
|
+
async mkdirFile(path3) {
|
|
85341
|
+
const result = await this._threadInstance.mkdirFile(path3);
|
|
85345
85342
|
if (!result.success) throw new Error(result.error || "Failed to create directory");
|
|
85346
85343
|
return this._mapFileRecord(result.directory);
|
|
85347
85344
|
}
|
|
85348
|
-
async rmdirFile(
|
|
85349
|
-
const result = await this._threadInstance.rmdirFile(
|
|
85345
|
+
async rmdirFile(path3) {
|
|
85346
|
+
const result = await this._threadInstance.rmdirFile(path3);
|
|
85350
85347
|
if (!result.success) throw new Error(result.error || "Failed to remove directory");
|
|
85351
85348
|
}
|
|
85352
85349
|
async moveFile(sourcePath, destinationPath) {
|
|
@@ -85354,8 +85351,8 @@ var init_ThreadStateImpl = __esm({
|
|
|
85354
85351
|
if (!result.success) throw new Error(result.error || "Failed to move file");
|
|
85355
85352
|
return this._mapFileRecord(result.file);
|
|
85356
85353
|
}
|
|
85357
|
-
async renameFile(
|
|
85358
|
-
const result = await this._threadInstance.renameFile(
|
|
85354
|
+
async renameFile(path3, newName) {
|
|
85355
|
+
const result = await this._threadInstance.renameFile(path3, newName);
|
|
85359
85356
|
if (!result.success) throw new Error(result.error || "Failed to rename file");
|
|
85360
85357
|
return this._mapFileRecord(result.file);
|
|
85361
85358
|
}
|
|
@@ -85381,8 +85378,8 @@ var init_ThreadStateImpl = __esm({
|
|
|
85381
85378
|
paths: result.files.map((file) => file.path)
|
|
85382
85379
|
};
|
|
85383
85380
|
}
|
|
85384
|
-
async getFileThumbnail(
|
|
85385
|
-
const result = await this._threadInstance.getFileThumbnail(
|
|
85381
|
+
async getFileThumbnail(path3) {
|
|
85382
|
+
const result = await this._threadInstance.getFileThumbnail(path3);
|
|
85386
85383
|
if (!result.success) return null;
|
|
85387
85384
|
const binary = atob(result.data);
|
|
85388
85385
|
const bytes = new Uint8Array(binary.length);
|
|
@@ -85712,7 +85709,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
85712
85709
|
const skillMd = await stub.getSkillFile(scope, name15, "SKILL.md") ?? "";
|
|
85713
85710
|
return { metadata, skillMd };
|
|
85714
85711
|
},
|
|
85715
|
-
readFile: (name15,
|
|
85712
|
+
readFile: (name15, path3) => stub.getSkillFile(scope, name15, path3),
|
|
85716
85713
|
install: async (files) => {
|
|
85717
85714
|
await requireMutationAdmin();
|
|
85718
85715
|
return stub.upsertSkill(scope, files);
|
|
@@ -86637,16 +86634,16 @@ function parseUserRouteKey(key) {
|
|
|
86637
86634
|
}
|
|
86638
86635
|
return { key, method, segments, dynamism };
|
|
86639
86636
|
}
|
|
86640
|
-
function matchSegments(route,
|
|
86637
|
+
function matchSegments(route, path3) {
|
|
86641
86638
|
const params = {};
|
|
86642
86639
|
for (let i = 0; i < route.length; i++) {
|
|
86643
86640
|
const seg = route[i];
|
|
86644
86641
|
if (seg === "[*]") {
|
|
86645
86642
|
if (i !== route.length - 1) return null;
|
|
86646
|
-
params["*"] =
|
|
86643
|
+
params["*"] = path3.slice(i).join("/");
|
|
86647
86644
|
return params;
|
|
86648
86645
|
}
|
|
86649
|
-
const value =
|
|
86646
|
+
const value = path3[i];
|
|
86650
86647
|
if (value === void 0) return null;
|
|
86651
86648
|
if (seg.startsWith("[") && seg.endsWith("]")) {
|
|
86652
86649
|
params[seg.slice(1, -1)] = value;
|
|
@@ -86654,16 +86651,16 @@ function matchSegments(route, path7) {
|
|
|
86654
86651
|
return null;
|
|
86655
86652
|
}
|
|
86656
86653
|
}
|
|
86657
|
-
return
|
|
86654
|
+
return path3.length === route.length ? params : null;
|
|
86658
86655
|
}
|
|
86659
86656
|
function matchUserRoute(keys, method, endpointPath) {
|
|
86660
|
-
const
|
|
86657
|
+
const path3 = endpointPath.split("/").filter((s) => s.length > 0);
|
|
86661
86658
|
const wanted = method.toUpperCase();
|
|
86662
86659
|
let best = null;
|
|
86663
86660
|
for (const key of keys) {
|
|
86664
86661
|
const route = parseUserRouteKey(key);
|
|
86665
86662
|
if (route.method !== wanted) continue;
|
|
86666
|
-
const params = matchSegments(route.segments,
|
|
86663
|
+
const params = matchSegments(route.segments, path3);
|
|
86667
86664
|
if (!params) continue;
|
|
86668
86665
|
if (!best || route.dynamism < best.route.dynamism) {
|
|
86669
86666
|
best = { route, params };
|
|
@@ -87934,55 +87931,6 @@ var DurableUserHub = class extends DurableObject {
|
|
|
87934
87931
|
}
|
|
87935
87932
|
};
|
|
87936
87933
|
|
|
87937
|
-
// src/router/thread-endpoint-route-key.ts
|
|
87938
|
-
var THREAD_ENDPOINT_METHODS = /* @__PURE__ */ new Set([
|
|
87939
|
-
"GET",
|
|
87940
|
-
"POST",
|
|
87941
|
-
"PUT",
|
|
87942
|
-
"PATCH",
|
|
87943
|
-
"DELETE"
|
|
87944
|
-
]);
|
|
87945
|
-
function stripRouteExtension(input) {
|
|
87946
|
-
return input.replace(/\.(ts|tsx|js|mjs)$/i, "");
|
|
87947
|
-
}
|
|
87948
|
-
function normalizeRouteKey(input) {
|
|
87949
|
-
return stripRouteExtension(input).replace(/\\/g, "/").replace(/^\/+/, "");
|
|
87950
|
-
}
|
|
87951
|
-
function convertRouteSegment(segment) {
|
|
87952
|
-
if (segment === "[*]") {
|
|
87953
|
-
return "**";
|
|
87954
|
-
}
|
|
87955
|
-
const dynamicMatch = segment.match(/^\[([A-Za-z_$][A-Za-z0-9_$]*)\]$/);
|
|
87956
|
-
if (dynamicMatch) {
|
|
87957
|
-
return `:${dynamicMatch[1]}`;
|
|
87958
|
-
}
|
|
87959
|
-
return segment;
|
|
87960
|
-
}
|
|
87961
|
-
function parseThreadEndpointRouteKey(input) {
|
|
87962
|
-
const routeKey = normalizeRouteKey(input);
|
|
87963
|
-
const parts = routeKey.split("/").filter(Boolean);
|
|
87964
|
-
const rawFileName = parts.pop() || "index";
|
|
87965
|
-
let method = "GET";
|
|
87966
|
-
let fileRouteName = rawFileName;
|
|
87967
|
-
const methodMatch = rawFileName.match(/^(.*)\.([A-Za-z]+)$/);
|
|
87968
|
-
if (methodMatch) {
|
|
87969
|
-
const maybeMethod = methodMatch[2].toUpperCase();
|
|
87970
|
-
if (THREAD_ENDPOINT_METHODS.has(maybeMethod)) {
|
|
87971
|
-
method = maybeMethod;
|
|
87972
|
-
fileRouteName = methodMatch[1] || "index";
|
|
87973
|
-
}
|
|
87974
|
-
}
|
|
87975
|
-
const routeSegments = parts.map(convertRouteSegment);
|
|
87976
|
-
if (fileRouteName !== "index") {
|
|
87977
|
-
routeSegments.push(convertRouteSegment(fileRouteName));
|
|
87978
|
-
}
|
|
87979
|
-
return {
|
|
87980
|
-
method,
|
|
87981
|
-
route: routeSegments.length > 0 ? `/${routeSegments.join("/")}` : "/",
|
|
87982
|
-
routeKey
|
|
87983
|
-
};
|
|
87984
|
-
}
|
|
87985
|
-
|
|
87986
87934
|
// src/runtime.ts
|
|
87987
87935
|
init_utilities();
|
|
87988
87936
|
|
|
@@ -88283,6 +88231,55 @@ init_ProviderRegistry();
|
|
|
88283
88231
|
init_types3();
|
|
88284
88232
|
init_resolver();
|
|
88285
88233
|
|
|
88234
|
+
// src/router/thread-endpoint-route-key.ts
|
|
88235
|
+
var THREAD_ENDPOINT_METHODS = /* @__PURE__ */ new Set([
|
|
88236
|
+
"GET",
|
|
88237
|
+
"POST",
|
|
88238
|
+
"PUT",
|
|
88239
|
+
"PATCH",
|
|
88240
|
+
"DELETE"
|
|
88241
|
+
]);
|
|
88242
|
+
function stripRouteExtension(input) {
|
|
88243
|
+
return input.replace(/\.(ts|tsx|js|mjs)$/i, "");
|
|
88244
|
+
}
|
|
88245
|
+
function normalizeRouteKey(input) {
|
|
88246
|
+
return stripRouteExtension(input).replace(/\\/g, "/").replace(/^\/+/, "");
|
|
88247
|
+
}
|
|
88248
|
+
function convertRouteSegment(segment) {
|
|
88249
|
+
if (segment === "[*]") {
|
|
88250
|
+
return "**";
|
|
88251
|
+
}
|
|
88252
|
+
const dynamicMatch = segment.match(/^\[([A-Za-z_$][A-Za-z0-9_$]*)\]$/);
|
|
88253
|
+
if (dynamicMatch) {
|
|
88254
|
+
return `:${dynamicMatch[1]}`;
|
|
88255
|
+
}
|
|
88256
|
+
return segment;
|
|
88257
|
+
}
|
|
88258
|
+
function parseThreadEndpointRouteKey(input) {
|
|
88259
|
+
const routeKey = normalizeRouteKey(input);
|
|
88260
|
+
const parts = routeKey.split("/").filter(Boolean);
|
|
88261
|
+
const rawFileName = parts.pop() || "index";
|
|
88262
|
+
let method = "GET";
|
|
88263
|
+
let fileRouteName = rawFileName;
|
|
88264
|
+
const methodMatch = rawFileName.match(/^(.*)\.([A-Za-z]+)$/);
|
|
88265
|
+
if (methodMatch) {
|
|
88266
|
+
const maybeMethod = methodMatch[2].toUpperCase();
|
|
88267
|
+
if (THREAD_ENDPOINT_METHODS.has(maybeMethod)) {
|
|
88268
|
+
method = maybeMethod;
|
|
88269
|
+
fileRouteName = methodMatch[1] || "index";
|
|
88270
|
+
}
|
|
88271
|
+
}
|
|
88272
|
+
const routeSegments = parts.map(convertRouteSegment);
|
|
88273
|
+
if (fileRouteName !== "index") {
|
|
88274
|
+
routeSegments.push(convertRouteSegment(fileRouteName));
|
|
88275
|
+
}
|
|
88276
|
+
return {
|
|
88277
|
+
method,
|
|
88278
|
+
route: routeSegments.length > 0 ? `/${routeSegments.join("/")}` : "/",
|
|
88279
|
+
routeKey
|
|
88280
|
+
};
|
|
88281
|
+
}
|
|
88282
|
+
|
|
88286
88283
|
// ../../node_modules/.pnpm/rou3@0.7.10/node_modules/rou3/dist/index.mjs
|
|
88287
88284
|
var NullProtoObj = /* @__PURE__ */ (() => {
|
|
88288
88285
|
const e = function() {
|
|
@@ -88295,8 +88292,8 @@ function createRouter() {
|
|
|
88295
88292
|
static: new NullProtoObj()
|
|
88296
88293
|
};
|
|
88297
88294
|
}
|
|
88298
|
-
function splitPath(
|
|
88299
|
-
const [_, ...s] =
|
|
88295
|
+
function splitPath(path3) {
|
|
88296
|
+
const [_, ...s] = path3.split("/");
|
|
88300
88297
|
return s[s.length - 1] === "" ? s.slice(0, -1) : s;
|
|
88301
88298
|
}
|
|
88302
88299
|
function getMatchParams(segments, paramsMap) {
|
|
@@ -88311,10 +88308,10 @@ function getMatchParams(segments, paramsMap) {
|
|
|
88311
88308
|
}
|
|
88312
88309
|
return params;
|
|
88313
88310
|
}
|
|
88314
|
-
function addRoute(ctx, method = "",
|
|
88311
|
+
function addRoute(ctx, method = "", path3, data) {
|
|
88315
88312
|
method = method.toUpperCase();
|
|
88316
|
-
if (
|
|
88317
|
-
const segments = splitPath(
|
|
88313
|
+
if (path3.charCodeAt(0) !== 47) path3 = `/${path3}`;
|
|
88314
|
+
const segments = splitPath(path3);
|
|
88318
88315
|
let node = ctx.root;
|
|
88319
88316
|
let _unnamedParamIndex = 0;
|
|
88320
88317
|
const paramsMap = [];
|
|
@@ -88372,20 +88369,20 @@ function addRoute(ctx, method = "", path7, data) {
|
|
|
88372
88369
|
paramsRegexp,
|
|
88373
88370
|
paramsMap: hasParams ? paramsMap : void 0
|
|
88374
88371
|
});
|
|
88375
|
-
if (!hasParams) ctx.static[
|
|
88372
|
+
if (!hasParams) ctx.static[path3] = node;
|
|
88376
88373
|
}
|
|
88377
88374
|
function getParamRegexp(segment) {
|
|
88378
88375
|
const regex = segment.replace(/:(\w+)/g, (_, id) => `(?<${id}>[^/]+)`).replace(/\./g, "\\.");
|
|
88379
88376
|
return /* @__PURE__ */ new RegExp(`^${regex}$`);
|
|
88380
88377
|
}
|
|
88381
|
-
function findRoute(ctx, method = "",
|
|
88382
|
-
if (
|
|
88383
|
-
const staticNode = ctx.static[
|
|
88378
|
+
function findRoute(ctx, method = "", path3, opts) {
|
|
88379
|
+
if (path3.charCodeAt(path3.length - 1) === 47) path3 = path3.slice(0, -1);
|
|
88380
|
+
const staticNode = ctx.static[path3];
|
|
88384
88381
|
if (staticNode && staticNode.methods) {
|
|
88385
88382
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
88386
88383
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
88387
88384
|
}
|
|
88388
|
-
const segments = splitPath(
|
|
88385
|
+
const segments = splitPath(path3);
|
|
88389
88386
|
const match2 = _lookupTree(ctx, ctx.root, method, segments, 0)?.[0];
|
|
88390
88387
|
if (match2 === void 0) return;
|
|
88391
88388
|
return {
|