@asteroidai/cli 1.9.434 → 1.9.436
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/asteroid.js +22 -16
- package/dist/core.js +17 -11
- package/package.json +1 -1
package/dist/asteroid.js
CHANGED
|
@@ -6922,11 +6922,19 @@ var COMMANDS = [
|
|
|
6922
6922
|
}
|
|
6923
6923
|
];
|
|
6924
6924
|
|
|
6925
|
+
// src/args.ts
|
|
6926
|
+
var UsageError = class extends Error {
|
|
6927
|
+
};
|
|
6928
|
+
|
|
6925
6929
|
// src/sync/types.ts
|
|
6926
6930
|
var MANIFEST = ".asteroid.json";
|
|
6927
6931
|
function get(path, query = {}) {
|
|
6928
6932
|
return { method: "GET", path, query: new URLSearchParams(query) };
|
|
6929
6933
|
}
|
|
6934
|
+
function pathId(id) {
|
|
6935
|
+
if (id === "." || id === "..") throw new UsageError(`invalid id: ${id}`);
|
|
6936
|
+
return encodeURIComponent(id);
|
|
6937
|
+
}
|
|
6930
6938
|
function statusOf(error) {
|
|
6931
6939
|
const status = error?.status;
|
|
6932
6940
|
return typeof status === "number" ? status : void 0;
|
|
@@ -6942,7 +6950,7 @@ async function syncExecution(sync, executionId2, timeoutMs) {
|
|
|
6942
6950
|
Math.max(1, Math.ceil(timeoutMs / 1e3))
|
|
6943
6951
|
);
|
|
6944
6952
|
return await sync.remote.json(
|
|
6945
|
-
get(`/agents/v2/executions/${executionId2}/sync`, {
|
|
6953
|
+
get(`/agents/v2/executions/${pathId(executionId2)}/sync`, {
|
|
6946
6954
|
timeoutSeconds: String(timeoutSeconds)
|
|
6947
6955
|
})
|
|
6948
6956
|
);
|
|
@@ -7314,10 +7322,6 @@ function orgLabel(org) {
|
|
|
7314
7322
|
// src/program.ts
|
|
7315
7323
|
import { Command, CommanderError, Option as Flag } from "commander";
|
|
7316
7324
|
|
|
7317
|
-
// src/args.ts
|
|
7318
|
-
var UsageError = class extends Error {
|
|
7319
|
-
};
|
|
7320
|
-
|
|
7321
7325
|
// src/reference.ts
|
|
7322
7326
|
var BUILTINS = [
|
|
7323
7327
|
{
|
|
@@ -8109,7 +8113,7 @@ var ApiError = class extends Error {
|
|
|
8109
8113
|
status;
|
|
8110
8114
|
body;
|
|
8111
8115
|
};
|
|
8112
|
-
var VERSION = "1.9.
|
|
8116
|
+
var VERSION = "1.9.436";
|
|
8113
8117
|
function problem(status, body, fallback) {
|
|
8114
8118
|
if (body && typeof body === "object") {
|
|
8115
8119
|
const record2 = body;
|
|
@@ -9410,7 +9414,9 @@ async function writeText(sync, path, text3) {
|
|
|
9410
9414
|
async function writeActivities(sync, dir, execution) {
|
|
9411
9415
|
try {
|
|
9412
9416
|
const activities = await sync.remote.json(
|
|
9413
|
-
get(`/agents/v2/executions/${execution.id}/activities`, {
|
|
9417
|
+
get(`/agents/v2/executions/${pathId(execution.id)}/activities`, {
|
|
9418
|
+
order: "asc"
|
|
9419
|
+
})
|
|
9414
9420
|
);
|
|
9415
9421
|
if (activities.length === 0) return false;
|
|
9416
9422
|
const markdown = formatActivitiesMarkdown(
|
|
@@ -9426,12 +9432,12 @@ async function writeActivities(sync, dir, execution) {
|
|
|
9426
9432
|
}
|
|
9427
9433
|
async function listFiles(sync, executionId2) {
|
|
9428
9434
|
const listing = await sync.remote.json(
|
|
9429
|
-
get(`/agents/v2/executions/${executionId2}/files`)
|
|
9435
|
+
get(`/agents/v2/executions/${pathId(executionId2)}/files`)
|
|
9430
9436
|
);
|
|
9431
9437
|
return DIRECTORIES.flatMap((name) => listing.directories[name] ?? []);
|
|
9432
9438
|
}
|
|
9433
9439
|
async function download(sync, executionId2, file) {
|
|
9434
|
-
const path = `/agents/v2/executions/${executionId2}/files/${file.id}/signed-url`;
|
|
9440
|
+
const path = `/agents/v2/executions/${pathId(executionId2)}/files/${pathId(file.id)}/signed-url`;
|
|
9435
9441
|
const { url } = await sync.remote.json(get(path));
|
|
9436
9442
|
return sync.remote.download(url);
|
|
9437
9443
|
}
|
|
@@ -9480,7 +9486,7 @@ async function pullFiles(sync, dir, options) {
|
|
|
9480
9486
|
}
|
|
9481
9487
|
async function pullExecution(sync, options) {
|
|
9482
9488
|
const execution = await sync.remote.json(
|
|
9483
|
-
get(`/agents/v2/executions/${options.executionId}`)
|
|
9489
|
+
get(`/agents/v2/executions/${pathId(options.executionId)}`)
|
|
9484
9490
|
);
|
|
9485
9491
|
const dir = executionDir(options, execution);
|
|
9486
9492
|
await writeText(
|
|
@@ -9632,7 +9638,7 @@ async function pullInsights(sync, options = {}) {
|
|
|
9632
9638
|
const dir = options.dir ?? INSIGHTS_DIR;
|
|
9633
9639
|
const insights = options.insightId ? [
|
|
9634
9640
|
await sync.remote.json(
|
|
9635
|
-
get(`/astro/v2/insights/${options.insightId}`)
|
|
9641
|
+
get(`/astro/v2/insights/${pathId(options.insightId)}`)
|
|
9636
9642
|
)
|
|
9637
9643
|
] : await listInsights(sync, options.workflowId);
|
|
9638
9644
|
const pulled = [];
|
|
@@ -9731,10 +9737,10 @@ function pullDir(root, tree, head) {
|
|
|
9731
9737
|
return join3(base, ".versions", workflowDirName(tree.versionId, tree.version));
|
|
9732
9738
|
}
|
|
9733
9739
|
function headFilesRequest(workflowId) {
|
|
9734
|
-
return get(`/agents/v2/workflows/${workflowId}/head/files`);
|
|
9740
|
+
return get(`/agents/v2/workflows/${pathId(workflowId)}/head/files`);
|
|
9735
9741
|
}
|
|
9736
|
-
async function agentFileBytes(sync, workflowId, tree,
|
|
9737
|
-
const path = `/agents/v2/workflows/${workflowId}/versions/${tree.versionId}/files/${
|
|
9742
|
+
async function agentFileBytes(sync, workflowId, tree, fileId) {
|
|
9743
|
+
const path = `/agents/v2/workflows/${pathId(workflowId)}/versions/${pathId(tree.versionId)}/files/${pathId(fileId)}/signed-url`;
|
|
9738
9744
|
const { url } = await sync.remote.json(get(path));
|
|
9739
9745
|
return sync.remote.download(url);
|
|
9740
9746
|
}
|
|
@@ -9745,7 +9751,7 @@ async function entryBytes(sync, workflowId, tree, entry) {
|
|
|
9745
9751
|
if (entry.storageObjectKey && sync.remote.object)
|
|
9746
9752
|
return sync.remote.object(entry.storageObjectKey);
|
|
9747
9753
|
if (!entry.fileId) return void 0;
|
|
9748
|
-
return agentFileBytes(sync, workflowId, tree, entry);
|
|
9754
|
+
return agentFileBytes(sync, workflowId, tree, entry.fileId);
|
|
9749
9755
|
}
|
|
9750
9756
|
function inlineBytes(entry) {
|
|
9751
9757
|
if (entry.contentBase64 !== void 0)
|
|
@@ -9960,7 +9966,7 @@ async function patch(sync, manifest, writes, deletes) {
|
|
|
9960
9966
|
try {
|
|
9961
9967
|
const snapshot = await sync.remote.json({
|
|
9962
9968
|
method: "PATCH",
|
|
9963
|
-
path: `/agents/v2/workflows/${manifest.workflowId}/head/files`,
|
|
9969
|
+
path: `/agents/v2/workflows/${pathId(manifest.workflowId)}/head/files`,
|
|
9964
9970
|
query: new URLSearchParams(),
|
|
9965
9971
|
json: {
|
|
9966
9972
|
baseRev: manifest.rev,
|
package/dist/core.js
CHANGED
|
@@ -7655,6 +7655,10 @@ var MANIFEST = ".asteroid.json";
|
|
|
7655
7655
|
function get(path, query = {}) {
|
|
7656
7656
|
return { method: "GET", path, query: new URLSearchParams(query) };
|
|
7657
7657
|
}
|
|
7658
|
+
function pathId(id) {
|
|
7659
|
+
if (id === "." || id === "..") throw new UsageError(`invalid id: ${id}`);
|
|
7660
|
+
return encodeURIComponent(id);
|
|
7661
|
+
}
|
|
7658
7662
|
function statusOf(error) {
|
|
7659
7663
|
const status = error?.status;
|
|
7660
7664
|
return typeof status === "number" ? status : void 0;
|
|
@@ -7670,7 +7674,7 @@ async function syncExecution(sync, executionId2, timeoutMs) {
|
|
|
7670
7674
|
Math.max(1, Math.ceil(timeoutMs / 1e3))
|
|
7671
7675
|
);
|
|
7672
7676
|
return await sync.remote.json(
|
|
7673
|
-
get(`/agents/v2/executions/${executionId2}/sync`, {
|
|
7677
|
+
get(`/agents/v2/executions/${pathId(executionId2)}/sync`, {
|
|
7674
7678
|
timeoutSeconds: String(timeoutSeconds)
|
|
7675
7679
|
})
|
|
7676
7680
|
);
|
|
@@ -8030,7 +8034,9 @@ async function writeText(sync, path, text2) {
|
|
|
8030
8034
|
async function writeActivities(sync, dir, execution) {
|
|
8031
8035
|
try {
|
|
8032
8036
|
const activities = await sync.remote.json(
|
|
8033
|
-
get(`/agents/v2/executions/${execution.id}/activities`, {
|
|
8037
|
+
get(`/agents/v2/executions/${pathId(execution.id)}/activities`, {
|
|
8038
|
+
order: "asc"
|
|
8039
|
+
})
|
|
8034
8040
|
);
|
|
8035
8041
|
if (activities.length === 0) return false;
|
|
8036
8042
|
const markdown = formatActivitiesMarkdown(
|
|
@@ -8046,12 +8052,12 @@ async function writeActivities(sync, dir, execution) {
|
|
|
8046
8052
|
}
|
|
8047
8053
|
async function listFiles(sync, executionId2) {
|
|
8048
8054
|
const listing = await sync.remote.json(
|
|
8049
|
-
get(`/agents/v2/executions/${executionId2}/files`)
|
|
8055
|
+
get(`/agents/v2/executions/${pathId(executionId2)}/files`)
|
|
8050
8056
|
);
|
|
8051
8057
|
return DIRECTORIES.flatMap((name) => listing.directories[name] ?? []);
|
|
8052
8058
|
}
|
|
8053
8059
|
async function download(sync, executionId2, file) {
|
|
8054
|
-
const path = `/agents/v2/executions/${executionId2}/files/${file.id}/signed-url`;
|
|
8060
|
+
const path = `/agents/v2/executions/${pathId(executionId2)}/files/${pathId(file.id)}/signed-url`;
|
|
8055
8061
|
const { url } = await sync.remote.json(get(path));
|
|
8056
8062
|
return sync.remote.download(url);
|
|
8057
8063
|
}
|
|
@@ -8100,7 +8106,7 @@ async function pullFiles(sync, dir, options) {
|
|
|
8100
8106
|
}
|
|
8101
8107
|
async function pullExecution(sync, options) {
|
|
8102
8108
|
const execution = await sync.remote.json(
|
|
8103
|
-
get(`/agents/v2/executions/${options.executionId}`)
|
|
8109
|
+
get(`/agents/v2/executions/${pathId(options.executionId)}`)
|
|
8104
8110
|
);
|
|
8105
8111
|
const dir = executionDir(options, execution);
|
|
8106
8112
|
await writeText(
|
|
@@ -8252,7 +8258,7 @@ async function pullInsights(sync, options = {}) {
|
|
|
8252
8258
|
const dir = options.dir ?? INSIGHTS_DIR;
|
|
8253
8259
|
const insights = options.insightId ? [
|
|
8254
8260
|
await sync.remote.json(
|
|
8255
|
-
get(`/astro/v2/insights/${options.insightId}`)
|
|
8261
|
+
get(`/astro/v2/insights/${pathId(options.insightId)}`)
|
|
8256
8262
|
)
|
|
8257
8263
|
] : await listInsights(sync, options.workflowId);
|
|
8258
8264
|
const pulled = [];
|
|
@@ -8351,10 +8357,10 @@ function pullDir(root, tree, head) {
|
|
|
8351
8357
|
return join(base, ".versions", workflowDirName(tree.versionId, tree.version));
|
|
8352
8358
|
}
|
|
8353
8359
|
function headFilesRequest(workflowId) {
|
|
8354
|
-
return get(`/agents/v2/workflows/${workflowId}/head/files`);
|
|
8360
|
+
return get(`/agents/v2/workflows/${pathId(workflowId)}/head/files`);
|
|
8355
8361
|
}
|
|
8356
|
-
async function agentFileBytes(sync, workflowId, tree,
|
|
8357
|
-
const path = `/agents/v2/workflows/${workflowId}/versions/${tree.versionId}/files/${
|
|
8362
|
+
async function agentFileBytes(sync, workflowId, tree, fileId) {
|
|
8363
|
+
const path = `/agents/v2/workflows/${pathId(workflowId)}/versions/${pathId(tree.versionId)}/files/${pathId(fileId)}/signed-url`;
|
|
8358
8364
|
const { url } = await sync.remote.json(get(path));
|
|
8359
8365
|
return sync.remote.download(url);
|
|
8360
8366
|
}
|
|
@@ -8365,7 +8371,7 @@ async function entryBytes(sync, workflowId, tree, entry) {
|
|
|
8365
8371
|
if (entry.storageObjectKey && sync.remote.object)
|
|
8366
8372
|
return sync.remote.object(entry.storageObjectKey);
|
|
8367
8373
|
if (!entry.fileId) return void 0;
|
|
8368
|
-
return agentFileBytes(sync, workflowId, tree, entry);
|
|
8374
|
+
return agentFileBytes(sync, workflowId, tree, entry.fileId);
|
|
8369
8375
|
}
|
|
8370
8376
|
function inlineBytes(entry) {
|
|
8371
8377
|
if (entry.contentBase64 !== void 0)
|
|
@@ -8580,7 +8586,7 @@ async function patch(sync, manifest, writes, deletes) {
|
|
|
8580
8586
|
try {
|
|
8581
8587
|
const snapshot = await sync.remote.json({
|
|
8582
8588
|
method: "PATCH",
|
|
8583
|
-
path: `/agents/v2/workflows/${manifest.workflowId}/head/files`,
|
|
8589
|
+
path: `/agents/v2/workflows/${pathId(manifest.workflowId)}/head/files`,
|
|
8584
8590
|
query: new URLSearchParams(),
|
|
8585
8591
|
json: {
|
|
8586
8592
|
baseRev: manifest.rev,
|