@asteroidai/cli 1.9.485 → 1.9.498
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 +281 -8
- package/dist/core.js +271 -4
- package/package.json +1 -1
package/dist/asteroid.js
CHANGED
|
@@ -2405,6 +2405,96 @@ var COMMANDS = [
|
|
|
2405
2405
|
readOnly: true,
|
|
2406
2406
|
destructive: false
|
|
2407
2407
|
},
|
|
2408
|
+
{
|
|
2409
|
+
command: "insight create",
|
|
2410
|
+
tool: "insight_create",
|
|
2411
|
+
title: "Create insight",
|
|
2412
|
+
description: "Create an insight: a markdown note with a type (`recommendation` or `overview`) that people read on the Insights page. Pass `proposalId` from `workflow_proposal_create` to attach a workflow change the reader can review and apply in one click, and set `workflowId`. Without `chatId` a new Astro chat is started for the insight. The response's `id` opens at /insights?insight=<id>.",
|
|
2413
|
+
method: "POST",
|
|
2414
|
+
path: "/astro/v2/insights",
|
|
2415
|
+
args: [],
|
|
2416
|
+
query: [],
|
|
2417
|
+
binary: false,
|
|
2418
|
+
readOnly: false,
|
|
2419
|
+
destructive: false,
|
|
2420
|
+
body: {
|
|
2421
|
+
required: true,
|
|
2422
|
+
contentType: "application/json",
|
|
2423
|
+
fields: [
|
|
2424
|
+
{
|
|
2425
|
+
name: "chatId",
|
|
2426
|
+
flag: "chat-id",
|
|
2427
|
+
type: "string",
|
|
2428
|
+
required: false,
|
|
2429
|
+
description: 'The Astro chat the insight belongs to. Omit it to start a new chat for the insight, which "Discuss with Astro" then opens.'
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
name: "workflowId",
|
|
2433
|
+
flag: "workflow-id",
|
|
2434
|
+
type: "string",
|
|
2435
|
+
required: false,
|
|
2436
|
+
description: "The workflow the insight is about. Required with a proposal."
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
name: "name",
|
|
2440
|
+
flag: "name",
|
|
2441
|
+
type: "string",
|
|
2442
|
+
required: true
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
name: "type",
|
|
2446
|
+
flag: "type",
|
|
2447
|
+
type: "string",
|
|
2448
|
+
required: true,
|
|
2449
|
+
description: "The insight type, e.g. `recommendation` or `overview`."
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
name: "content",
|
|
2453
|
+
flag: "content",
|
|
2454
|
+
type: "string",
|
|
2455
|
+
required: true,
|
|
2456
|
+
description: "Markdown body."
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
name: "status",
|
|
2460
|
+
flag: "status",
|
|
2461
|
+
type: "string",
|
|
2462
|
+
required: false,
|
|
2463
|
+
description: "Starting status. Defaults to the type's first status."
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
name: "nextSteps",
|
|
2467
|
+
flag: "next-steps",
|
|
2468
|
+
type: "json",
|
|
2469
|
+
required: false,
|
|
2470
|
+
description: "A question to put to the reader, with the answers it accepts.",
|
|
2471
|
+
fields: [
|
|
2472
|
+
{
|
|
2473
|
+
name: "question",
|
|
2474
|
+
flag: "question",
|
|
2475
|
+
type: "string",
|
|
2476
|
+
required: false
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
name: "options",
|
|
2480
|
+
flag: "options",
|
|
2481
|
+
type: "json",
|
|
2482
|
+
required: false
|
|
2483
|
+
}
|
|
2484
|
+
]
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
name: "proposalId",
|
|
2488
|
+
flag: "proposal-id",
|
|
2489
|
+
type: "string",
|
|
2490
|
+
required: false,
|
|
2491
|
+
description: "A workflow proposal from `workflow_proposal_create`, for the reader to review and apply. Set `workflowId` with it."
|
|
2492
|
+
}
|
|
2493
|
+
],
|
|
2494
|
+
files: [],
|
|
2495
|
+
credentialOrganization: false
|
|
2496
|
+
}
|
|
2497
|
+
},
|
|
2408
2498
|
{
|
|
2409
2499
|
command: "insight get",
|
|
2410
2500
|
tool: "insight_get",
|
|
@@ -6091,6 +6181,108 @@ var COMMANDS = [
|
|
|
6091
6181
|
credentialOrganization: false
|
|
6092
6182
|
}
|
|
6093
6183
|
},
|
|
6184
|
+
{
|
|
6185
|
+
command: "workflow proposal create",
|
|
6186
|
+
tool: "workflow_proposal_create",
|
|
6187
|
+
title: "Propose a workflow change",
|
|
6188
|
+
description: "Propose a change without touching the editable head or the published version. The proposal is a new version built from `baseVersionId` (default: the published version) with the writes and deletes applied. Each write carries `content` (UTF-8 text) or `contentBase64`, exactly one, like `workflow_files_patch`. A person reviews and applies it in the platform: attach the returned `id` to an insight with `insight_create`. From the CLI, pull the published version with `workflow version pull`, edit that folder, then run `workflow proposal create --from <folder>`.",
|
|
6189
|
+
method: "POST",
|
|
6190
|
+
path: "/agents/v2/workflows/{workflowId}/proposals",
|
|
6191
|
+
args: [
|
|
6192
|
+
{
|
|
6193
|
+
name: "workflowId",
|
|
6194
|
+
flag: "workflow-id",
|
|
6195
|
+
type: "string",
|
|
6196
|
+
required: true
|
|
6197
|
+
}
|
|
6198
|
+
],
|
|
6199
|
+
query: [],
|
|
6200
|
+
binary: false,
|
|
6201
|
+
readOnly: false,
|
|
6202
|
+
destructive: false,
|
|
6203
|
+
body: {
|
|
6204
|
+
required: true,
|
|
6205
|
+
contentType: "application/json",
|
|
6206
|
+
fields: [
|
|
6207
|
+
{
|
|
6208
|
+
name: "baseVersionId",
|
|
6209
|
+
flag: "base-version-id",
|
|
6210
|
+
type: "string",
|
|
6211
|
+
required: false,
|
|
6212
|
+
description: "The version the proposal is built from. Defaults to the published version."
|
|
6213
|
+
},
|
|
6214
|
+
{
|
|
6215
|
+
name: "writes",
|
|
6216
|
+
flag: "writes",
|
|
6217
|
+
type: "json",
|
|
6218
|
+
required: true,
|
|
6219
|
+
description: "Files to upsert, relative to the workflow root."
|
|
6220
|
+
},
|
|
6221
|
+
{
|
|
6222
|
+
name: "deletes",
|
|
6223
|
+
flag: "deletes",
|
|
6224
|
+
type: "string[]",
|
|
6225
|
+
required: true,
|
|
6226
|
+
description: "Paths to delete, relative to the workflow root."
|
|
6227
|
+
}
|
|
6228
|
+
],
|
|
6229
|
+
files: [],
|
|
6230
|
+
credentialOrganization: false
|
|
6231
|
+
},
|
|
6232
|
+
files: "propose"
|
|
6233
|
+
},
|
|
6234
|
+
{
|
|
6235
|
+
command: "workflow proposal get",
|
|
6236
|
+
tool: "workflow_proposal_get",
|
|
6237
|
+
title: "Get workflow proposal",
|
|
6238
|
+
description: "Get one open proposal. Returns 404 once it is withdrawn or applied.",
|
|
6239
|
+
method: "GET",
|
|
6240
|
+
path: "/agents/v2/workflows/{workflowId}/proposals/{proposalId}",
|
|
6241
|
+
args: [
|
|
6242
|
+
{
|
|
6243
|
+
name: "workflowId",
|
|
6244
|
+
flag: "workflow-id",
|
|
6245
|
+
type: "string",
|
|
6246
|
+
required: true
|
|
6247
|
+
},
|
|
6248
|
+
{
|
|
6249
|
+
name: "proposalId",
|
|
6250
|
+
flag: "proposal-id",
|
|
6251
|
+
type: "string",
|
|
6252
|
+
required: true
|
|
6253
|
+
}
|
|
6254
|
+
],
|
|
6255
|
+
query: [],
|
|
6256
|
+
binary: false,
|
|
6257
|
+
readOnly: true,
|
|
6258
|
+
destructive: false
|
|
6259
|
+
},
|
|
6260
|
+
{
|
|
6261
|
+
command: "workflow proposal withdraw",
|
|
6262
|
+
tool: "workflow_proposal_withdraw",
|
|
6263
|
+
title: "Withdraw workflow proposal",
|
|
6264
|
+
description: "Withdraw an open proposal, for example to replace it with a new one built on the current published version. Withdrawing one that is gone or applied does nothing.",
|
|
6265
|
+
method: "DELETE",
|
|
6266
|
+
path: "/agents/v2/workflows/{workflowId}/proposals/{proposalId}",
|
|
6267
|
+
args: [
|
|
6268
|
+
{
|
|
6269
|
+
name: "workflowId",
|
|
6270
|
+
flag: "workflow-id",
|
|
6271
|
+
type: "string",
|
|
6272
|
+
required: true
|
|
6273
|
+
},
|
|
6274
|
+
{
|
|
6275
|
+
name: "proposalId",
|
|
6276
|
+
flag: "proposal-id",
|
|
6277
|
+
type: "string",
|
|
6278
|
+
required: true
|
|
6279
|
+
}
|
|
6280
|
+
],
|
|
6281
|
+
query: [],
|
|
6282
|
+
binary: false,
|
|
6283
|
+
readOnly: false,
|
|
6284
|
+
destructive: true
|
|
6285
|
+
},
|
|
6094
6286
|
{
|
|
6095
6287
|
command: "workflow pull",
|
|
6096
6288
|
tool: "workflow_files_list",
|
|
@@ -6184,13 +6376,14 @@ var COMMANDS = [
|
|
|
6184
6376
|
flag: "writes",
|
|
6185
6377
|
type: "json",
|
|
6186
6378
|
required: true,
|
|
6187
|
-
description: "Files to upsert."
|
|
6379
|
+
description: "Files to upsert, relative to the workflow root."
|
|
6188
6380
|
},
|
|
6189
6381
|
{
|
|
6190
6382
|
name: "deletes",
|
|
6191
6383
|
flag: "deletes",
|
|
6192
6384
|
type: "string[]",
|
|
6193
|
-
required: true
|
|
6385
|
+
required: true,
|
|
6386
|
+
description: "Paths to delete, relative to the workflow root."
|
|
6194
6387
|
}
|
|
6195
6388
|
],
|
|
6196
6389
|
files: [],
|
|
@@ -7679,6 +7872,12 @@ function leafOptions(leaf, command) {
|
|
|
7679
7872
|
"Into a folder pulled before: keep every file you edited since that pull and refresh the rest. From a head, a later push sends those edits on top of the new revision."
|
|
7680
7873
|
);
|
|
7681
7874
|
}
|
|
7875
|
+
if (command.files === "propose") {
|
|
7876
|
+
leaf.option(
|
|
7877
|
+
"--from <dir>",
|
|
7878
|
+
"The pulled version folder whose edits to propose. Defaults to the current folder."
|
|
7879
|
+
);
|
|
7880
|
+
}
|
|
7682
7881
|
if (command.files === "push") {
|
|
7683
7882
|
leaf.option(
|
|
7684
7883
|
"--from <dir>",
|
|
@@ -8307,7 +8506,7 @@ var ApiError = class extends Error {
|
|
|
8307
8506
|
status;
|
|
8308
8507
|
body;
|
|
8309
8508
|
};
|
|
8310
|
-
var VERSION = "1.9.
|
|
8509
|
+
var VERSION = "1.9.498";
|
|
8311
8510
|
function problem(status, body, fallback) {
|
|
8312
8511
|
if (body && typeof body === "object") {
|
|
8313
8512
|
const record2 = body;
|
|
@@ -9838,6 +10037,7 @@ function serializeInsightFile(meta, body) {
|
|
|
9838
10037
|
if (meta.status) front.status = meta.status;
|
|
9839
10038
|
front.name = meta.name;
|
|
9840
10039
|
if (meta.nextSteps) front.next_steps = meta.nextSteps;
|
|
10040
|
+
if (meta.proposalId) front.proposal_id = meta.proposalId;
|
|
9841
10041
|
const yaml = stringifyYaml(front).trimEnd();
|
|
9842
10042
|
return `---
|
|
9843
10043
|
${yaml}
|
|
@@ -9916,7 +10116,8 @@ async function pullInsights(sync, options = {}) {
|
|
|
9916
10116
|
type: insight.type,
|
|
9917
10117
|
status: insight.status,
|
|
9918
10118
|
name: insight.name,
|
|
9919
|
-
nextSteps: insight.nextSteps ?? void 0
|
|
10119
|
+
nextSteps: insight.nextSteps ?? void 0,
|
|
10120
|
+
proposalId: insight.proposalId
|
|
9920
10121
|
},
|
|
9921
10122
|
insight.content
|
|
9922
10123
|
);
|
|
@@ -10357,6 +10558,61 @@ function formatIssueLines(issues) {
|
|
|
10357
10558
|
);
|
|
10358
10559
|
}
|
|
10359
10560
|
|
|
10561
|
+
// src/sync/workflow-propose.ts
|
|
10562
|
+
async function proposeWorkflow(sync, dir, workflowId) {
|
|
10563
|
+
const manifest = await loadManifest(sync, dir);
|
|
10564
|
+
if (!manifest) {
|
|
10565
|
+
throw new UsageError(
|
|
10566
|
+
`no pulled workflow version in ${dir}. Run \`asteroid workflow version pull <workflow-id> <version-id>\`, edit that folder, then propose from it.`
|
|
10567
|
+
);
|
|
10568
|
+
}
|
|
10569
|
+
if (manifest.head) {
|
|
10570
|
+
throw new UsageError(
|
|
10571
|
+
`${dir} holds the editable head, which can carry unpublished edits. Pull the published version with \`asteroid workflow version pull <workflow-id> <version-id>\` and propose from that folder.`
|
|
10572
|
+
);
|
|
10573
|
+
}
|
|
10574
|
+
if (workflowId !== void 0 && manifest.workflowId !== workflowId) {
|
|
10575
|
+
throw new UsageError(
|
|
10576
|
+
`${dir} holds workflow ${manifest.workflowId}, not ${workflowId}.`
|
|
10577
|
+
);
|
|
10578
|
+
}
|
|
10579
|
+
const { writes, deletes } = await localChanges(sync, dir, manifest);
|
|
10580
|
+
const result = {
|
|
10581
|
+
workflowId: manifest.workflowId,
|
|
10582
|
+
dir,
|
|
10583
|
+
baseVersionId: manifest.versionId,
|
|
10584
|
+
written: writes.map((w) => w.path),
|
|
10585
|
+
deleted: deletes
|
|
10586
|
+
};
|
|
10587
|
+
if (writes.length === 0 && deletes.length === 0) return result;
|
|
10588
|
+
const created = await sync.remote.json({
|
|
10589
|
+
method: "POST",
|
|
10590
|
+
path: `/agents/v2/workflows/${pathId(manifest.workflowId)}/proposals`,
|
|
10591
|
+
query: new URLSearchParams(),
|
|
10592
|
+
json: {
|
|
10593
|
+
baseVersionId: manifest.versionId,
|
|
10594
|
+
writes: writes.map(({ path, contentBase64 }) => ({
|
|
10595
|
+
path,
|
|
10596
|
+
contentBase64
|
|
10597
|
+
})),
|
|
10598
|
+
deletes
|
|
10599
|
+
}
|
|
10600
|
+
});
|
|
10601
|
+
return { ...result, proposalId: created.id };
|
|
10602
|
+
}
|
|
10603
|
+
function formatWorkflowProposal(result) {
|
|
10604
|
+
if (result.proposalId === void 0) {
|
|
10605
|
+
return `Nothing to propose: ${result.dir}/ matches the version you pulled (${result.baseVersionId}).`;
|
|
10606
|
+
}
|
|
10607
|
+
return [
|
|
10608
|
+
`Proposed a change to workflow ${result.workflowId}: ${result.written.length} written, ${result.deleted.length} deleted.`,
|
|
10609
|
+
...result.written.map((path) => ` + ${path}`),
|
|
10610
|
+
...result.deleted.map((path) => ` - ${path}`),
|
|
10611
|
+
`Proposal: ${result.proposalId}, built from ${result.baseVersionId}.`,
|
|
10612
|
+
"The head and the published version are unchanged. Set proposal_id in an insight to let someone apply it."
|
|
10613
|
+
].join("\n");
|
|
10614
|
+
}
|
|
10615
|
+
|
|
10360
10616
|
// src/sync/run.ts
|
|
10361
10617
|
function flag(parsed, name) {
|
|
10362
10618
|
return parsed.flags.get(name)?.at(-1);
|
|
@@ -10417,7 +10673,10 @@ function withoutFlags(parsed, ...names) {
|
|
|
10417
10673
|
function runsLocally(command, parsed) {
|
|
10418
10674
|
if (command.local) return true;
|
|
10419
10675
|
if (command.files === "pull") return !parsed.json;
|
|
10420
|
-
if (command.files === "push"
|
|
10676
|
+
if (command.files === "push" || command.files === "propose")
|
|
10677
|
+
return parsed.body === void 0 && !(command.body?.fields ?? []).some(
|
|
10678
|
+
(field) => parsed.flags.has(field.flag)
|
|
10679
|
+
);
|
|
10421
10680
|
return false;
|
|
10422
10681
|
}
|
|
10423
10682
|
var PARTIAL = ["paths", "variants"];
|
|
@@ -10457,6 +10716,14 @@ async function execute(command, parsed, sync, deps) {
|
|
|
10457
10716
|
);
|
|
10458
10717
|
return { result: result2, text: formatWorkflowPush(result2) };
|
|
10459
10718
|
}
|
|
10719
|
+
if (command.files === "propose") {
|
|
10720
|
+
const result2 = await proposeWorkflow(
|
|
10721
|
+
sync,
|
|
10722
|
+
flag(parsed, "from") ?? ".",
|
|
10723
|
+
parsed.positionals[0] || void 0
|
|
10724
|
+
);
|
|
10725
|
+
return { result: result2, text: formatWorkflowProposal(result2) };
|
|
10726
|
+
}
|
|
10460
10727
|
if (command.command === "execution wait") {
|
|
10461
10728
|
const result2 = await waitForExecution(sync, {
|
|
10462
10729
|
...executionWaitOptions(parsed),
|
|
@@ -10686,7 +10953,13 @@ async function execute2(invocation, deps) {
|
|
|
10686
10953
|
remote: nodeRemote(deps.env.apiUrl, auth, deps.fetch)
|
|
10687
10954
|
});
|
|
10688
10955
|
}
|
|
10689
|
-
|
|
10956
|
+
const { command, parsed } = invocation;
|
|
10957
|
+
if ((command.files === "push" || command.files === "propose") && parsed.positionals[0] === "") {
|
|
10958
|
+
throw new UsageError(
|
|
10959
|
+
`with --body or body flags, pass <${command.args[0]?.flag}>: there is no folder to take it from.`
|
|
10960
|
+
);
|
|
10961
|
+
}
|
|
10962
|
+
return runCommand(command, parsed, deps);
|
|
10690
10963
|
}
|
|
10691
10964
|
async function run(argv2, deps) {
|
|
10692
10965
|
let invocation;
|
|
@@ -10697,8 +10970,8 @@ async function run(argv2, deps) {
|
|
|
10697
10970
|
builtins: BUILTINS,
|
|
10698
10971
|
version: VERSION,
|
|
10699
10972
|
description: DESCRIPTION,
|
|
10700
|
-
defaultArg: (command, arg) => command.files === "push" && arg.name === "workflowId" ? "" : void 0,
|
|
10701
|
-
defaultArgNote: "<workflow-id> defaults to the workflow the
|
|
10973
|
+
defaultArg: (command, arg) => (command.files === "push" || command.files === "propose") && arg.name === "workflowId" ? "" : void 0,
|
|
10974
|
+
defaultArgNote: "<workflow-id> defaults to the workflow the folder was pulled from."
|
|
10702
10975
|
});
|
|
10703
10976
|
code2 = await execute2(invocation, deps);
|
|
10704
10977
|
} catch (error) {
|
package/dist/core.js
CHANGED
|
@@ -2426,6 +2426,96 @@ var COMMANDS = [
|
|
|
2426
2426
|
readOnly: true,
|
|
2427
2427
|
destructive: false
|
|
2428
2428
|
},
|
|
2429
|
+
{
|
|
2430
|
+
command: "insight create",
|
|
2431
|
+
tool: "insight_create",
|
|
2432
|
+
title: "Create insight",
|
|
2433
|
+
description: "Create an insight: a markdown note with a type (`recommendation` or `overview`) that people read on the Insights page. Pass `proposalId` from `workflow_proposal_create` to attach a workflow change the reader can review and apply in one click, and set `workflowId`. Without `chatId` a new Astro chat is started for the insight. The response's `id` opens at /insights?insight=<id>.",
|
|
2434
|
+
method: "POST",
|
|
2435
|
+
path: "/astro/v2/insights",
|
|
2436
|
+
args: [],
|
|
2437
|
+
query: [],
|
|
2438
|
+
binary: false,
|
|
2439
|
+
readOnly: false,
|
|
2440
|
+
destructive: false,
|
|
2441
|
+
body: {
|
|
2442
|
+
required: true,
|
|
2443
|
+
contentType: "application/json",
|
|
2444
|
+
fields: [
|
|
2445
|
+
{
|
|
2446
|
+
name: "chatId",
|
|
2447
|
+
flag: "chat-id",
|
|
2448
|
+
type: "string",
|
|
2449
|
+
required: false,
|
|
2450
|
+
description: 'The Astro chat the insight belongs to. Omit it to start a new chat for the insight, which "Discuss with Astro" then opens.'
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
name: "workflowId",
|
|
2454
|
+
flag: "workflow-id",
|
|
2455
|
+
type: "string",
|
|
2456
|
+
required: false,
|
|
2457
|
+
description: "The workflow the insight is about. Required with a proposal."
|
|
2458
|
+
},
|
|
2459
|
+
{
|
|
2460
|
+
name: "name",
|
|
2461
|
+
flag: "name",
|
|
2462
|
+
type: "string",
|
|
2463
|
+
required: true
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
name: "type",
|
|
2467
|
+
flag: "type",
|
|
2468
|
+
type: "string",
|
|
2469
|
+
required: true,
|
|
2470
|
+
description: "The insight type, e.g. `recommendation` or `overview`."
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
name: "content",
|
|
2474
|
+
flag: "content",
|
|
2475
|
+
type: "string",
|
|
2476
|
+
required: true,
|
|
2477
|
+
description: "Markdown body."
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
name: "status",
|
|
2481
|
+
flag: "status",
|
|
2482
|
+
type: "string",
|
|
2483
|
+
required: false,
|
|
2484
|
+
description: "Starting status. Defaults to the type's first status."
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
name: "nextSteps",
|
|
2488
|
+
flag: "next-steps",
|
|
2489
|
+
type: "json",
|
|
2490
|
+
required: false,
|
|
2491
|
+
description: "A question to put to the reader, with the answers it accepts.",
|
|
2492
|
+
fields: [
|
|
2493
|
+
{
|
|
2494
|
+
name: "question",
|
|
2495
|
+
flag: "question",
|
|
2496
|
+
type: "string",
|
|
2497
|
+
required: false
|
|
2498
|
+
},
|
|
2499
|
+
{
|
|
2500
|
+
name: "options",
|
|
2501
|
+
flag: "options",
|
|
2502
|
+
type: "json",
|
|
2503
|
+
required: false
|
|
2504
|
+
}
|
|
2505
|
+
]
|
|
2506
|
+
},
|
|
2507
|
+
{
|
|
2508
|
+
name: "proposalId",
|
|
2509
|
+
flag: "proposal-id",
|
|
2510
|
+
type: "string",
|
|
2511
|
+
required: false,
|
|
2512
|
+
description: "A workflow proposal from `workflow_proposal_create`, for the reader to review and apply. Set `workflowId` with it."
|
|
2513
|
+
}
|
|
2514
|
+
],
|
|
2515
|
+
files: [],
|
|
2516
|
+
credentialOrganization: false
|
|
2517
|
+
}
|
|
2518
|
+
},
|
|
2429
2519
|
{
|
|
2430
2520
|
command: "insight get",
|
|
2431
2521
|
tool: "insight_get",
|
|
@@ -6112,6 +6202,108 @@ var COMMANDS = [
|
|
|
6112
6202
|
credentialOrganization: false
|
|
6113
6203
|
}
|
|
6114
6204
|
},
|
|
6205
|
+
{
|
|
6206
|
+
command: "workflow proposal create",
|
|
6207
|
+
tool: "workflow_proposal_create",
|
|
6208
|
+
title: "Propose a workflow change",
|
|
6209
|
+
description: "Propose a change without touching the editable head or the published version. The proposal is a new version built from `baseVersionId` (default: the published version) with the writes and deletes applied. Each write carries `content` (UTF-8 text) or `contentBase64`, exactly one, like `workflow_files_patch`. A person reviews and applies it in the platform: attach the returned `id` to an insight with `insight_create`. From the CLI, pull the published version with `workflow version pull`, edit that folder, then run `workflow proposal create --from <folder>`.",
|
|
6210
|
+
method: "POST",
|
|
6211
|
+
path: "/agents/v2/workflows/{workflowId}/proposals",
|
|
6212
|
+
args: [
|
|
6213
|
+
{
|
|
6214
|
+
name: "workflowId",
|
|
6215
|
+
flag: "workflow-id",
|
|
6216
|
+
type: "string",
|
|
6217
|
+
required: true
|
|
6218
|
+
}
|
|
6219
|
+
],
|
|
6220
|
+
query: [],
|
|
6221
|
+
binary: false,
|
|
6222
|
+
readOnly: false,
|
|
6223
|
+
destructive: false,
|
|
6224
|
+
body: {
|
|
6225
|
+
required: true,
|
|
6226
|
+
contentType: "application/json",
|
|
6227
|
+
fields: [
|
|
6228
|
+
{
|
|
6229
|
+
name: "baseVersionId",
|
|
6230
|
+
flag: "base-version-id",
|
|
6231
|
+
type: "string",
|
|
6232
|
+
required: false,
|
|
6233
|
+
description: "The version the proposal is built from. Defaults to the published version."
|
|
6234
|
+
},
|
|
6235
|
+
{
|
|
6236
|
+
name: "writes",
|
|
6237
|
+
flag: "writes",
|
|
6238
|
+
type: "json",
|
|
6239
|
+
required: true,
|
|
6240
|
+
description: "Files to upsert, relative to the workflow root."
|
|
6241
|
+
},
|
|
6242
|
+
{
|
|
6243
|
+
name: "deletes",
|
|
6244
|
+
flag: "deletes",
|
|
6245
|
+
type: "string[]",
|
|
6246
|
+
required: true,
|
|
6247
|
+
description: "Paths to delete, relative to the workflow root."
|
|
6248
|
+
}
|
|
6249
|
+
],
|
|
6250
|
+
files: [],
|
|
6251
|
+
credentialOrganization: false
|
|
6252
|
+
},
|
|
6253
|
+
files: "propose"
|
|
6254
|
+
},
|
|
6255
|
+
{
|
|
6256
|
+
command: "workflow proposal get",
|
|
6257
|
+
tool: "workflow_proposal_get",
|
|
6258
|
+
title: "Get workflow proposal",
|
|
6259
|
+
description: "Get one open proposal. Returns 404 once it is withdrawn or applied.",
|
|
6260
|
+
method: "GET",
|
|
6261
|
+
path: "/agents/v2/workflows/{workflowId}/proposals/{proposalId}",
|
|
6262
|
+
args: [
|
|
6263
|
+
{
|
|
6264
|
+
name: "workflowId",
|
|
6265
|
+
flag: "workflow-id",
|
|
6266
|
+
type: "string",
|
|
6267
|
+
required: true
|
|
6268
|
+
},
|
|
6269
|
+
{
|
|
6270
|
+
name: "proposalId",
|
|
6271
|
+
flag: "proposal-id",
|
|
6272
|
+
type: "string",
|
|
6273
|
+
required: true
|
|
6274
|
+
}
|
|
6275
|
+
],
|
|
6276
|
+
query: [],
|
|
6277
|
+
binary: false,
|
|
6278
|
+
readOnly: true,
|
|
6279
|
+
destructive: false
|
|
6280
|
+
},
|
|
6281
|
+
{
|
|
6282
|
+
command: "workflow proposal withdraw",
|
|
6283
|
+
tool: "workflow_proposal_withdraw",
|
|
6284
|
+
title: "Withdraw workflow proposal",
|
|
6285
|
+
description: "Withdraw an open proposal, for example to replace it with a new one built on the current published version. Withdrawing one that is gone or applied does nothing.",
|
|
6286
|
+
method: "DELETE",
|
|
6287
|
+
path: "/agents/v2/workflows/{workflowId}/proposals/{proposalId}",
|
|
6288
|
+
args: [
|
|
6289
|
+
{
|
|
6290
|
+
name: "workflowId",
|
|
6291
|
+
flag: "workflow-id",
|
|
6292
|
+
type: "string",
|
|
6293
|
+
required: true
|
|
6294
|
+
},
|
|
6295
|
+
{
|
|
6296
|
+
name: "proposalId",
|
|
6297
|
+
flag: "proposal-id",
|
|
6298
|
+
type: "string",
|
|
6299
|
+
required: true
|
|
6300
|
+
}
|
|
6301
|
+
],
|
|
6302
|
+
query: [],
|
|
6303
|
+
binary: false,
|
|
6304
|
+
readOnly: false,
|
|
6305
|
+
destructive: true
|
|
6306
|
+
},
|
|
6115
6307
|
{
|
|
6116
6308
|
command: "workflow pull",
|
|
6117
6309
|
tool: "workflow_files_list",
|
|
@@ -6205,13 +6397,14 @@ var COMMANDS = [
|
|
|
6205
6397
|
flag: "writes",
|
|
6206
6398
|
type: "json",
|
|
6207
6399
|
required: true,
|
|
6208
|
-
description: "Files to upsert."
|
|
6400
|
+
description: "Files to upsert, relative to the workflow root."
|
|
6209
6401
|
},
|
|
6210
6402
|
{
|
|
6211
6403
|
name: "deletes",
|
|
6212
6404
|
flag: "deletes",
|
|
6213
6405
|
type: "string[]",
|
|
6214
|
-
required: true
|
|
6406
|
+
required: true,
|
|
6407
|
+
description: "Paths to delete, relative to the workflow root."
|
|
6215
6408
|
}
|
|
6216
6409
|
],
|
|
6217
6410
|
files: [],
|
|
@@ -7440,6 +7633,12 @@ function leafOptions(leaf, command) {
|
|
|
7440
7633
|
"Into a folder pulled before: keep every file you edited since that pull and refresh the rest. From a head, a later push sends those edits on top of the new revision."
|
|
7441
7634
|
);
|
|
7442
7635
|
}
|
|
7636
|
+
if (command.files === "propose") {
|
|
7637
|
+
leaf.option(
|
|
7638
|
+
"--from <dir>",
|
|
7639
|
+
"The pulled version folder whose edits to propose. Defaults to the current folder."
|
|
7640
|
+
);
|
|
7641
|
+
}
|
|
7443
7642
|
if (command.files === "push") {
|
|
7444
7643
|
leaf.option(
|
|
7445
7644
|
"--from <dir>",
|
|
@@ -8398,6 +8597,7 @@ function serializeInsightFile(meta, body) {
|
|
|
8398
8597
|
if (meta.status) front.status = meta.status;
|
|
8399
8598
|
front.name = meta.name;
|
|
8400
8599
|
if (meta.nextSteps) front.next_steps = meta.nextSteps;
|
|
8600
|
+
if (meta.proposalId) front.proposal_id = meta.proposalId;
|
|
8401
8601
|
const yaml = stringifyYaml(front).trimEnd();
|
|
8402
8602
|
return `---
|
|
8403
8603
|
${yaml}
|
|
@@ -8476,7 +8676,8 @@ async function pullInsights(sync, options = {}) {
|
|
|
8476
8676
|
type: insight.type,
|
|
8477
8677
|
status: insight.status,
|
|
8478
8678
|
name: insight.name,
|
|
8479
|
-
nextSteps: insight.nextSteps ?? void 0
|
|
8679
|
+
nextSteps: insight.nextSteps ?? void 0,
|
|
8680
|
+
proposalId: insight.proposalId
|
|
8480
8681
|
},
|
|
8481
8682
|
insight.content
|
|
8482
8683
|
);
|
|
@@ -8917,6 +9118,61 @@ function formatIssueLines(issues) {
|
|
|
8917
9118
|
);
|
|
8918
9119
|
}
|
|
8919
9120
|
|
|
9121
|
+
// src/sync/workflow-propose.ts
|
|
9122
|
+
async function proposeWorkflow(sync, dir, workflowId) {
|
|
9123
|
+
const manifest = await loadManifest(sync, dir);
|
|
9124
|
+
if (!manifest) {
|
|
9125
|
+
throw new UsageError(
|
|
9126
|
+
`no pulled workflow version in ${dir}. Run \`asteroid workflow version pull <workflow-id> <version-id>\`, edit that folder, then propose from it.`
|
|
9127
|
+
);
|
|
9128
|
+
}
|
|
9129
|
+
if (manifest.head) {
|
|
9130
|
+
throw new UsageError(
|
|
9131
|
+
`${dir} holds the editable head, which can carry unpublished edits. Pull the published version with \`asteroid workflow version pull <workflow-id> <version-id>\` and propose from that folder.`
|
|
9132
|
+
);
|
|
9133
|
+
}
|
|
9134
|
+
if (workflowId !== void 0 && manifest.workflowId !== workflowId) {
|
|
9135
|
+
throw new UsageError(
|
|
9136
|
+
`${dir} holds workflow ${manifest.workflowId}, not ${workflowId}.`
|
|
9137
|
+
);
|
|
9138
|
+
}
|
|
9139
|
+
const { writes, deletes } = await localChanges(sync, dir, manifest);
|
|
9140
|
+
const result = {
|
|
9141
|
+
workflowId: manifest.workflowId,
|
|
9142
|
+
dir,
|
|
9143
|
+
baseVersionId: manifest.versionId,
|
|
9144
|
+
written: writes.map((w) => w.path),
|
|
9145
|
+
deleted: deletes
|
|
9146
|
+
};
|
|
9147
|
+
if (writes.length === 0 && deletes.length === 0) return result;
|
|
9148
|
+
const created = await sync.remote.json({
|
|
9149
|
+
method: "POST",
|
|
9150
|
+
path: `/agents/v2/workflows/${pathId(manifest.workflowId)}/proposals`,
|
|
9151
|
+
query: new URLSearchParams(),
|
|
9152
|
+
json: {
|
|
9153
|
+
baseVersionId: manifest.versionId,
|
|
9154
|
+
writes: writes.map(({ path, contentBase64 }) => ({
|
|
9155
|
+
path,
|
|
9156
|
+
contentBase64
|
|
9157
|
+
})),
|
|
9158
|
+
deletes
|
|
9159
|
+
}
|
|
9160
|
+
});
|
|
9161
|
+
return { ...result, proposalId: created.id };
|
|
9162
|
+
}
|
|
9163
|
+
function formatWorkflowProposal(result) {
|
|
9164
|
+
if (result.proposalId === void 0) {
|
|
9165
|
+
return `Nothing to propose: ${result.dir}/ matches the version you pulled (${result.baseVersionId}).`;
|
|
9166
|
+
}
|
|
9167
|
+
return [
|
|
9168
|
+
`Proposed a change to workflow ${result.workflowId}: ${result.written.length} written, ${result.deleted.length} deleted.`,
|
|
9169
|
+
...result.written.map((path) => ` + ${path}`),
|
|
9170
|
+
...result.deleted.map((path) => ` - ${path}`),
|
|
9171
|
+
`Proposal: ${result.proposalId}, built from ${result.baseVersionId}.`,
|
|
9172
|
+
"The head and the published version are unchanged. Set proposal_id in an insight to let someone apply it."
|
|
9173
|
+
].join("\n");
|
|
9174
|
+
}
|
|
9175
|
+
|
|
8920
9176
|
// src/sync/run.ts
|
|
8921
9177
|
function flag(parsed, name) {
|
|
8922
9178
|
return parsed.flags.get(name)?.at(-1);
|
|
@@ -8977,7 +9233,10 @@ function withoutFlags(parsed, ...names) {
|
|
|
8977
9233
|
function runsLocally(command, parsed) {
|
|
8978
9234
|
if (command.local) return true;
|
|
8979
9235
|
if (command.files === "pull") return !parsed.json;
|
|
8980
|
-
if (command.files === "push"
|
|
9236
|
+
if (command.files === "push" || command.files === "propose")
|
|
9237
|
+
return parsed.body === void 0 && !(command.body?.fields ?? []).some(
|
|
9238
|
+
(field) => parsed.flags.has(field.flag)
|
|
9239
|
+
);
|
|
8981
9240
|
return false;
|
|
8982
9241
|
}
|
|
8983
9242
|
var PARTIAL = ["paths", "variants"];
|
|
@@ -9017,6 +9276,14 @@ async function execute(command, parsed, sync, deps) {
|
|
|
9017
9276
|
);
|
|
9018
9277
|
return { result: result2, text: formatWorkflowPush(result2) };
|
|
9019
9278
|
}
|
|
9279
|
+
if (command.files === "propose") {
|
|
9280
|
+
const result2 = await proposeWorkflow(
|
|
9281
|
+
sync,
|
|
9282
|
+
flag(parsed, "from") ?? ".",
|
|
9283
|
+
parsed.positionals[0] || void 0
|
|
9284
|
+
);
|
|
9285
|
+
return { result: result2, text: formatWorkflowProposal(result2) };
|
|
9286
|
+
}
|
|
9020
9287
|
if (command.command === "execution wait") {
|
|
9021
9288
|
const result2 = await waitForExecution(sync, {
|
|
9022
9289
|
...executionWaitOptions(parsed),
|