@thinkingai/ae-cli 6.0.40 → 6.0.41
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/README.md +0 -2
- package/README.zh.md +0 -2
- package/dist/{auth-NN55553T.js → auth-GBMV6TEJ.js} +2 -2
- package/dist/{auth-GDV3H5I4.js → auth-NDSXE54J.js} +4 -4
- package/dist/{capability-TPORIKRQ.js → capability-CETVHGXF.js} +25 -15
- package/dist/{capability-VQNC5CF7.js → capability-ZSQBMNOE.js} +25 -15
- package/dist/{chunk-GJJA4CQZ.js → chunk-3FY3RJ26.js} +0 -4
- package/dist/chunk-4E3DB4MM.js +556 -0
- package/dist/{chunk-GS2P7LFD.js → chunk-5XUSIK27.js} +2 -2
- package/dist/{chunk-VTXHDCBW.js → chunk-AFXA7BRK.js} +2 -2
- package/dist/{chunk-7KQWSBSL.js → chunk-FNZA5RZA.js} +8 -8
- package/dist/{chunk-TS6BUGUY.js → chunk-J2N4PB56.js} +8 -8
- package/dist/{chunk-RBNKI5ZW.js → chunk-JUW4AJXN.js} +2 -2
- package/dist/{chunk-Z3OXWCIA.js → chunk-S5NTSDBS.js} +2 -2
- package/dist/{chunk-VKD5WQKN.js → chunk-VLWOLBGZ.js} +142 -24
- package/dist/chunk-WANVG6SY.js +556 -0
- package/dist/{chunk-YTG6Q75E.js → chunk-WZRX4KOH.js} +25 -3
- package/dist/{chunk-YV52FB5G.js → chunk-ZQKDZXDO.js} +1 -1
- package/dist/{cli-token-GL5MS5FK.js → cli-token-4UPER74P.js} +3 -3
- package/dist/{chunk-6A2FUCIS.js → client-L2YDMHQ6.js} +5 -6
- package/dist/{config-4VZNLBKF.js → config-OL2LWGBV.js} +4 -33
- package/dist/index.js +31 -44
- package/dist/{memory-RWJW4XFO.js → memory-MUP7PPL7.js} +4 -4
- package/dist/{memory-VO2ZJCRT.js → memory-U4O5PMXH.js} +4 -4
- package/dist/{metadata-YGTHR2XJ.js → metadata-UKZDNLLQ.js} +21 -11
- package/dist/{metadata-ZRN2GHPN.js → metadata-XXMJFN2M.js} +21 -11
- package/dist/{model-CLUIK3K5.js → model-JTUEO5M4.js} +2 -2
- package/dist/{sync-3REDHGY6.js → sync-MOSFNBVR.js} +5 -5
- package/dist/{te-agent-XNPELAKX.js → te-agent-IFKZDHZI.js} +25 -18
- package/dist/{te-analysis-GJI5FZUL.js → te-analysis-3QLLS35K.js} +1231 -456
- package/dist/{te-analysis-N2BRDJZ5.js → te-analysis-YSK2DBVL.js} +1231 -456
- package/dist/{te-community-SQXKE5OO.js → te-community-HNKVTERD.js} +207 -12
- package/dist/{te-community-TYSNU3NQ.js → te-community-IWE5B7W6.js} +208 -12
- package/dist/{te-dataops-OWIADNSM.js → te-dataops-KQPYNAE3.js} +262 -145
- package/dist/{te-dataops-5TM7WZDI.js → te-dataops-KXCEB4CS.js} +262 -145
- package/dist/{te-engage-L72HWRGO.js → te-engage-6RNGK5GH.js} +566 -17
- package/dist/{te-engage-QWM4GFS7.js → te-engage-IRMHTSQK.js} +566 -17
- package/dist/{te-kb-VRMEY3D4.js → te-kb-OIH3T6CS.js} +4 -4
- package/dist/{te-system-XGS5EQIQ.js → te-system-AZ3URMUO.js} +515 -11
- package/dist/{te-team-BZRDV2CM.js → te-team-GZPU6UWA.js} +5 -5
- package/dist/{update-HEDXGOJH.js → update-TOBFXF2V.js} +4 -4
- package/package.json +5 -5
- package/skills/ae-agent/SKILL.md +3 -3
- package/skills/ae-agent/references/list-skill-references.md +4 -4
- package/skills/ae-agent/references/read-skill-reference.md +10 -7
- package/skills/ae-agent/references/upload-skill-reference.md +11 -9
- package/skills/ae-analysis/SKILL.md +15 -12
- package/skills/ae-analysis/metadata_resolution.md +150 -0
- package/skills/ae-analysis/references/adhoc_export.md +17 -2
- package/skills/ae-analysis/references/adhoc_run.md +12 -8
- package/skills/ae-analysis/references/ai_models.md +31 -5
- package/skills/ae-analysis/references/analysis_data_retrieval.md +104 -16
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -4
- package/skills/ae-analysis/references/analysis_gateway_assets.md +12 -10
- package/skills/ae-analysis/references/artifact_download.md +4 -3
- package/skills/ae-analysis/references/asset_abnormal_list.md +5 -3
- package/skills/ae-analysis/references/asset_authentication_list.md +5 -3
- package/skills/ae-analysis/references/asset_search.md +5 -3
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
- package/skills/ae-analysis/references/bi_panel_page_data_run.md +4 -4
- package/skills/ae-analysis/references/catalog_export.md +28 -0
- package/skills/ae-analysis/references/catalog_list.md +44 -0
- package/skills/ae-analysis/references/command_index.md +72 -63
- package/skills/ae-analysis/references/dashboard_report_data_run.md +11 -4
- package/skills/ae-analysis/references/datatable_version_list.md +5 -3
- package/skills/ae-analysis/references/drilldown_entities_run.md +4 -4
- package/skills/ae-analysis/references/drilldown_events_run.md +2 -2
- package/skills/ae-analysis/references/drilldown_user_events_export.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -2
- package/skills/ae-analysis/references/entity_detail_run.md +4 -4
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/event_detail_run.md +4 -4
- package/skills/ae-analysis/references/event_export.md +21 -0
- package/skills/ae-analysis/references/event_list.md +7 -6
- package/skills/ae-analysis/references/exchange_rule_list.md +5 -3
- package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -2
- package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +2 -2
- package/skills/ae-analysis/references/history_tag_data_run.md +2 -2
- package/skills/ae-analysis/references/metric_export.md +21 -0
- package/skills/ae-analysis/references/metric_list.md +8 -7
- package/skills/ae-analysis/references/property_export.md +21 -0
- package/skills/ae-analysis/references/property_list.md +9 -8
- package/skills/ae-analysis/references/query_context_get.md +20 -0
- package/skills/ae-analysis/references/query_create_result_cluster.md +1 -1
- package/skills/ae-analysis/references/report_change_log_list.md +1 -1
- package/skills/ae-analysis/references/report_create.md +3 -3
- package/skills/ae-analysis/references/report_data_run.md +8 -8
- package/skills/ae-analysis/references/report_update.md +3 -3
- package/skills/ae-analysis/references/report_version_rollback.md +1 -1
- package/skills/ae-analysis/references/rule_list.md +6 -4
- package/skills/ae-analysis/references/run_inspect.md +8 -5
- package/skills/ae-analysis/references/run_wait.md +37 -0
- package/skills/ae-analysis/references/user_cluster_export.md +13 -0
- package/skills/ae-analysis/references/user_cluster_list.md +6 -2
- package/skills/ae-analysis/references/user_cluster_member_export.md +5 -3
- package/skills/ae-analysis/references/user_cluster_member_list.md +4 -4
- package/skills/ae-analysis/references/user_tag_export.md +13 -0
- package/skills/ae-analysis/references/user_tag_list.md +6 -2
- package/skills/ae-analysis/references/user_tag_member_export.md +5 -3
- package/skills/ae-analysis/references/user_tag_member_list.md +4 -4
- package/skills/ae-analysis/references/virtual_property_create.md +2 -2
- package/skills/ae-community/SKILL.md +2 -2
- package/skills/ae-dataops/SKILL.md +4 -3
- package/skills/ae-dataops/references/dataops-flow-create.md +47 -3
- package/skills/ae-engage/SKILL.md +46 -6
- package/skills/ae-engage/references/build-task-save-guide.md +12 -0
- package/skills/ae-engage/references/cancel-query-run.md +31 -0
- package/skills/ae-engage/references/config-item-analysis-report.md +14 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +11 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +15 -1
- package/skills/ae-engage/references/flow-metric-detail-report.md +134 -0
- package/skills/ae-engage/references/flow-metric-update.md +77 -0
- package/skills/ae-engage/references/flow-metric-user.md +118 -0
- package/skills/ae-engage/references/flow-node-metric-user.md +122 -0
- package/skills/ae-engage/references/flow-node-user.md +122 -0
- package/skills/ae-engage/references/push-record-query.md +32 -1
- package/skills/ae-engage/references/save-task.md +9 -0
- package/skills/ae-engage/references/task-data-detail.md +9 -2
- package/skills/ae-engage/references/task-metric-detail.md +9 -2
- package/skills/ae-engage/references/task-submit-approval.md +3 -0
- package/skills/ae-metadata/SKILL.md +2 -1
- package/skills/ae-metadata/references/metadata_data_table_download.md +10 -2
- package/skills/ae-metadata/references/metadata_data_table_list.md +5 -2
- package/skills/ae-system/SKILL.md +66 -3
- package/dist/chunk-DT6Y3TD7.js +0 -232
- package/dist/chunk-MVDZ7DBQ.js +0 -231
- package/dist/chunk-NBPKWKRA.js +0 -51
- package/dist/client-DAIPF7XN.js +0 -23
- package/dist/raw-52B4UKO4.js +0 -71
- package/dist/te-meta-53BVXPFI.js +0 -95
- package/dist/te-meta-TOCBPBXI.js +0 -95
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveHost,
|
|
3
3
|
getSandboxRuntimeRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3FY3RJ26.js";
|
|
5
5
|
|
|
6
6
|
// src/core/te-agent-credentials.ts
|
|
7
7
|
import { readFileSync } from "fs";
|
|
@@ -94,6 +94,10 @@ function getClaudeConfigDir() {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// src/core/te-agent-client.ts
|
|
97
|
+
import { open, unlink } from "fs/promises";
|
|
98
|
+
import path from "path";
|
|
99
|
+
import { Readable } from "stream";
|
|
100
|
+
import { pipeline } from "stream/promises";
|
|
97
101
|
var TeAgentApiError = class extends Error {
|
|
98
102
|
constructor(message, status, code, body) {
|
|
99
103
|
super(message);
|
|
@@ -108,6 +112,7 @@ var TeAgentApiError = class extends Error {
|
|
|
108
112
|
};
|
|
109
113
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
110
114
|
var UPLOAD_TIMEOUT_MS = 12e4;
|
|
115
|
+
var DOWNLOAD_TIMEOUT_MS = 12e4;
|
|
111
116
|
async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
112
117
|
const controller = new AbortController();
|
|
113
118
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -131,7 +136,7 @@ function teClaudeBaseFromActiveHost(hostOverride) {
|
|
|
131
136
|
const bp = process.env.TE_CLAUDE_BASE_PATH || "/agent";
|
|
132
137
|
return base.endsWith(bp) ? base : base + bp;
|
|
133
138
|
}
|
|
134
|
-
async function signRequest(method,
|
|
139
|
+
async function signRequest(method, path2, rawBody, hostOverride) {
|
|
135
140
|
const sandboxCred = tryLoadTeAgentSandboxCredentials();
|
|
136
141
|
if (!hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
137
142
|
const headers = {
|
|
@@ -142,13 +147,13 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
142
147
|
headers["Content-Type"] = "application/json";
|
|
143
148
|
}
|
|
144
149
|
return {
|
|
145
|
-
url: `${sandboxCred.url.replace(/\/$/, "")}${
|
|
150
|
+
url: `${sandboxCred.url.replace(/\/$/, "")}${path2}`,
|
|
146
151
|
headers,
|
|
147
152
|
rawBody
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
|
-
const { getToken } = await import("./auth-
|
|
151
|
-
const { getCliToken } = await import("./cli-token-
|
|
155
|
+
const { getToken } = await import("./auth-GBMV6TEJ.js");
|
|
156
|
+
const { getCliToken } = await import("./cli-token-4UPER74P.js");
|
|
152
157
|
const baseUrl = hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
153
158
|
if (!baseUrl) {
|
|
154
159
|
throw new TeAgentCredentialsError(
|
|
@@ -166,7 +171,7 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
166
171
|
}
|
|
167
172
|
if (accessToken) {
|
|
168
173
|
return {
|
|
169
|
-
url: `${baseUrl.replace(/\/$/, "")}${
|
|
174
|
+
url: `${baseUrl.replace(/\/$/, "")}${path2}`,
|
|
170
175
|
headers: {
|
|
171
176
|
"Authorization": `bearer ${accessToken}`,
|
|
172
177
|
...contentTypeHeader
|
|
@@ -182,7 +187,7 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
182
187
|
}
|
|
183
188
|
if (cliToken) {
|
|
184
189
|
return {
|
|
185
|
-
url: `${baseUrl.replace(/\/$/, "")}${
|
|
190
|
+
url: `${baseUrl.replace(/\/$/, "")}${path2}`,
|
|
186
191
|
headers: {
|
|
187
192
|
"cli-token": cliToken,
|
|
188
193
|
...contentTypeHeader
|
|
@@ -220,9 +225,9 @@ async function parseResponse(response, defaultErrorPrefix) {
|
|
|
220
225
|
}
|
|
221
226
|
return parsed;
|
|
222
227
|
}
|
|
223
|
-
async function postToMainApp(
|
|
228
|
+
async function postToMainApp(path2, body, hostOverride) {
|
|
224
229
|
const rawBody = JSON.stringify(body);
|
|
225
|
-
const signed = await signRequest("POST",
|
|
230
|
+
const signed = await signRequest("POST", path2, rawBody, hostOverride);
|
|
226
231
|
const response = await fetchWithTimeout(signed.url, {
|
|
227
232
|
method: "POST",
|
|
228
233
|
headers: signed.headers,
|
|
@@ -230,8 +235,8 @@ async function postToMainApp(path, body, hostOverride) {
|
|
|
230
235
|
});
|
|
231
236
|
return parseResponse(response, "Main app returned");
|
|
232
237
|
}
|
|
233
|
-
async function getFromMainApp(
|
|
234
|
-
const signed = await signRequest("GET",
|
|
238
|
+
async function getFromMainApp(path2, hostOverride) {
|
|
239
|
+
const signed = await signRequest("GET", path2, "", hostOverride);
|
|
235
240
|
const response = await fetchWithTimeout(signed.url, {
|
|
236
241
|
method: "GET",
|
|
237
242
|
headers: signed.headers
|
|
@@ -264,17 +269,17 @@ async function postSandboxSyncPull(args) {
|
|
|
264
269
|
mode: "merge"
|
|
265
270
|
});
|
|
266
271
|
}
|
|
267
|
-
async function deleteFromMainApp(
|
|
268
|
-
const signed = await signRequest("DELETE",
|
|
272
|
+
async function deleteFromMainApp(path2, hostOverride) {
|
|
273
|
+
const signed = await signRequest("DELETE", path2, "", hostOverride);
|
|
269
274
|
const response = await fetchWithTimeout(signed.url, {
|
|
270
275
|
method: "DELETE",
|
|
271
276
|
headers: signed.headers
|
|
272
277
|
});
|
|
273
278
|
return parseResponse(response, "Main app returned");
|
|
274
279
|
}
|
|
275
|
-
async function patchToMainApp(
|
|
280
|
+
async function patchToMainApp(path2, body, hostOverride) {
|
|
276
281
|
const rawBody = JSON.stringify(body);
|
|
277
|
-
const signed = await signRequest("PATCH",
|
|
282
|
+
const signed = await signRequest("PATCH", path2, rawBody, hostOverride);
|
|
278
283
|
const response = await fetchWithTimeout(signed.url, {
|
|
279
284
|
method: "PATCH",
|
|
280
285
|
headers: signed.headers,
|
|
@@ -282,9 +287,9 @@ async function patchToMainApp(path, body, hostOverride) {
|
|
|
282
287
|
});
|
|
283
288
|
return parseResponse(response, "Main app returned");
|
|
284
289
|
}
|
|
285
|
-
async function putToMainApp(
|
|
290
|
+
async function putToMainApp(path2, body, hostOverride) {
|
|
286
291
|
const rawBody = JSON.stringify(body);
|
|
287
|
-
const signed = await signRequest("PUT",
|
|
292
|
+
const signed = await signRequest("PUT", path2, rawBody, hostOverride);
|
|
288
293
|
const response = await fetchWithTimeout(signed.url, {
|
|
289
294
|
method: "PUT",
|
|
290
295
|
headers: signed.headers,
|
|
@@ -292,8 +297,8 @@ async function putToMainApp(path, body, hostOverride) {
|
|
|
292
297
|
});
|
|
293
298
|
return parseResponse(response, "Main app returned");
|
|
294
299
|
}
|
|
295
|
-
async function getBufferFromMainApp(
|
|
296
|
-
const signed = await signRequest("GET",
|
|
300
|
+
async function getBufferFromMainApp(path2, hostOverride) {
|
|
301
|
+
const signed = await signRequest("GET", path2, "", hostOverride);
|
|
297
302
|
const response = await fetchWithTimeout(signed.url, {
|
|
298
303
|
method: "GET",
|
|
299
304
|
headers: signed.headers
|
|
@@ -325,9 +330,121 @@ async function getBufferFromMainApp(path, hostOverride) {
|
|
|
325
330
|
const cd = response.headers.get("Content-Disposition") || "";
|
|
326
331
|
const match = cd.match(/filename\*=UTF-8''([^;]+)/);
|
|
327
332
|
const fileName = match ? decodeURIComponent(match[1]) : null;
|
|
328
|
-
|
|
333
|
+
const contentType = response.headers.get("Content-Type");
|
|
334
|
+
return { buffer, fileName, contentType };
|
|
329
335
|
}
|
|
330
|
-
|
|
336
|
+
function responseFileName(response) {
|
|
337
|
+
const disposition = response.headers.get("Content-Disposition") ?? "";
|
|
338
|
+
const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
|
|
339
|
+
if (encoded) {
|
|
340
|
+
try {
|
|
341
|
+
return decodeURIComponent(encoded.trim());
|
|
342
|
+
} catch {
|
|
343
|
+
return encoded.trim();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return disposition.match(/filename="([^"]+)"/i)?.[1] ?? disposition.match(/filename=([^;]+)/i)?.[1]?.trim() ?? null;
|
|
347
|
+
}
|
|
348
|
+
async function* responseBodyChunks(body) {
|
|
349
|
+
const reader = body.getReader();
|
|
350
|
+
try {
|
|
351
|
+
while (true) {
|
|
352
|
+
const chunk = await reader.read();
|
|
353
|
+
if (chunk.done) return;
|
|
354
|
+
yield chunk.value;
|
|
355
|
+
}
|
|
356
|
+
} finally {
|
|
357
|
+
reader.releaseLock();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
async function downloadFromMainApp(requestPath, outputPath, hostOverride) {
|
|
361
|
+
const absolutePath = path.resolve(outputPath);
|
|
362
|
+
let fileHandle;
|
|
363
|
+
let created = false;
|
|
364
|
+
const controller = new AbortController();
|
|
365
|
+
const timer = setTimeout(() => controller.abort(), DOWNLOAD_TIMEOUT_MS);
|
|
366
|
+
try {
|
|
367
|
+
try {
|
|
368
|
+
fileHandle = await open(absolutePath, "wx");
|
|
369
|
+
created = true;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
if (error.code === "EEXIST") {
|
|
372
|
+
throw new TeAgentApiError(
|
|
373
|
+
`Output file already exists: ${absolutePath}`,
|
|
374
|
+
0,
|
|
375
|
+
"OUTPUT_EXISTS"
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
throw new TeAgentApiError(
|
|
379
|
+
`Unable to create output file: ${absolutePath}`,
|
|
380
|
+
0,
|
|
381
|
+
"OUTPUT_ERROR"
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
const signed = await signRequest("GET", requestPath, "", hostOverride);
|
|
385
|
+
let response;
|
|
386
|
+
try {
|
|
387
|
+
response = await fetch(signed.url, {
|
|
388
|
+
method: "GET",
|
|
389
|
+
headers: signed.headers,
|
|
390
|
+
signal: controller.signal
|
|
391
|
+
});
|
|
392
|
+
} catch (error) {
|
|
393
|
+
if (error?.name === "AbortError") {
|
|
394
|
+
throw new TeAgentApiError(
|
|
395
|
+
`Request timed out (${DOWNLOAD_TIMEOUT_MS}ms): ${signed.url}`,
|
|
396
|
+
0,
|
|
397
|
+
"TIMEOUT"
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
throw new TeAgentApiError(
|
|
401
|
+
`Network request failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
402
|
+
0,
|
|
403
|
+
"NETWORK_ERROR"
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
if (!response.ok) {
|
|
407
|
+
await parseResponse(response, "Main app returned");
|
|
408
|
+
}
|
|
409
|
+
if (!response.body) {
|
|
410
|
+
throw new TeAgentApiError("Main app returned an empty download stream", 0, "EMPTY_BODY");
|
|
411
|
+
}
|
|
412
|
+
const output = fileHandle.createWriteStream();
|
|
413
|
+
try {
|
|
414
|
+
await pipeline(
|
|
415
|
+
Readable.from(responseBodyChunks(response.body)),
|
|
416
|
+
output
|
|
417
|
+
);
|
|
418
|
+
} catch (error) {
|
|
419
|
+
if (error?.name === "AbortError") {
|
|
420
|
+
throw new TeAgentApiError(
|
|
421
|
+
`Request timed out (${DOWNLOAD_TIMEOUT_MS}ms): ${signed.url}`,
|
|
422
|
+
0,
|
|
423
|
+
"TIMEOUT"
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
throw new TeAgentApiError(
|
|
427
|
+
`Download failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
428
|
+
0,
|
|
429
|
+
"DOWNLOAD_ERROR"
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
path: absolutePath,
|
|
434
|
+
bytes: output.bytesWritten,
|
|
435
|
+
fileName: responseFileName(response),
|
|
436
|
+
contentType: response.headers.get("Content-Type")
|
|
437
|
+
};
|
|
438
|
+
} catch (error) {
|
|
439
|
+
if (fileHandle) await fileHandle.close().catch(() => void 0);
|
|
440
|
+
if (created) await unlink(absolutePath).catch(() => void 0);
|
|
441
|
+
throw error;
|
|
442
|
+
} finally {
|
|
443
|
+
clearTimeout(timer);
|
|
444
|
+
controller.abort();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async function uploadToMainApp(path2, formData, hostOverride) {
|
|
331
448
|
const sandboxCred = tryLoadTeAgentSandboxCredentials();
|
|
332
449
|
let baseUrl;
|
|
333
450
|
let authHeaders;
|
|
@@ -338,8 +455,8 @@ async function uploadToMainApp(path, formData, hostOverride) {
|
|
|
338
455
|
"X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
|
|
339
456
|
};
|
|
340
457
|
} else {
|
|
341
|
-
const { getToken } = await import("./auth-
|
|
342
|
-
const { getCliToken } = await import("./cli-token-
|
|
458
|
+
const { getToken } = await import("./auth-GBMV6TEJ.js");
|
|
459
|
+
const { getCliToken } = await import("./cli-token-4UPER74P.js");
|
|
343
460
|
baseUrl = (hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost())?.replace(/\/$/, "") || "";
|
|
344
461
|
if (!baseUrl) {
|
|
345
462
|
throw new TeAgentCredentialsError(
|
|
@@ -373,7 +490,7 @@ async function uploadToMainApp(path, formData, hostOverride) {
|
|
|
373
490
|
}
|
|
374
491
|
}
|
|
375
492
|
const response = await fetchWithTimeout(
|
|
376
|
-
`${baseUrl}${
|
|
493
|
+
`${baseUrl}${path2}`,
|
|
377
494
|
{
|
|
378
495
|
method: "POST",
|
|
379
496
|
headers: authHeaders,
|
|
@@ -399,5 +516,6 @@ export {
|
|
|
399
516
|
patchToMainApp,
|
|
400
517
|
putToMainApp,
|
|
401
518
|
getBufferFromMainApp,
|
|
519
|
+
downloadFromMainApp,
|
|
402
520
|
uploadToMainApp
|
|
403
521
|
};
|