@asteroidai/cli 1.9.122 → 1.9.123

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 CHANGED
@@ -4914,6 +4914,26 @@ var COMMANDS = [
4914
4914
  readOnly: false,
4915
4915
  destructive: false
4916
4916
  },
4917
+ {
4918
+ command: "workflow head validate",
4919
+ tool: "workflow_head_validate",
4920
+ title: "Validate workflow head",
4921
+ description: 'Check the workflow\'s editable head the way publish and run do, without changing it. Returns blocking errors and advisory warnings, each with the path of the field it names, such as ["nodes", "Login", "model"]. Use after `workflow_files_patch` and before `workflow_head_publish`; an empty `issues` list means the head can publish and run. The same list comes back on every `workflow_files_patch` response.',
4922
+ method: "POST",
4923
+ path: "/agents/v2/workflows/{workflowId}/head/validate",
4924
+ args: [
4925
+ {
4926
+ name: "workflowId",
4927
+ flag: "workflow-id",
4928
+ type: "string",
4929
+ required: true
4930
+ }
4931
+ ],
4932
+ query: [],
4933
+ binary: false,
4934
+ readOnly: true,
4935
+ destructive: false
4936
+ },
4917
4937
  {
4918
4938
  command: "workflow list",
4919
4939
  tool: "workflow_list",
@@ -7414,7 +7434,7 @@ var ApiError = class extends Error {
7414
7434
  status;
7415
7435
  body;
7416
7436
  };
7417
- var VERSION = "1.9.122";
7437
+ var VERSION = "1.9.123";
7418
7438
  function problem(status, body, fallback) {
7419
7439
  if (body && typeof body === "object") {
7420
7440
  const record2 = body;
@@ -8866,7 +8886,7 @@ function conflict(manifest) {
8866
8886
  }
8867
8887
  async function patch(sync, manifest, writes, deletes) {
8868
8888
  try {
8869
- await sync.remote.json({
8889
+ const snapshot = await sync.remote.json({
8870
8890
  method: "PATCH",
8871
8891
  path: `/agents/v2/workflows/${manifest.workflowId}/head/files`,
8872
8892
  query: new URLSearchParams(),
@@ -8879,7 +8899,7 @@ async function patch(sync, manifest, writes, deletes) {
8879
8899
  deletes
8880
8900
  }
8881
8901
  });
8882
- return "applied";
8902
+ return { issues: snapshot?.issues ?? [] };
8883
8903
  } catch (error) {
8884
8904
  if (statusOf(error) !== 409) throw error;
8885
8905
  return "conflict";
@@ -8949,14 +8969,20 @@ async function pushWorkflow(sync, dir, workflowId, options = {}) {
8949
8969
  if (writes.length === 0 && deletes.length === 0) {
8950
8970
  return { ...result, rev: manifest.rev, versionId: manifest.versionId };
8951
8971
  }
8952
- if (await patch(sync, manifest, writes, deletes) === "applied") {
8972
+ const applied = await patch(sync, manifest, writes, deletes);
8973
+ if (applied !== "conflict") {
8953
8974
  const next = await refresh2(
8954
8975
  sync,
8955
8976
  dir,
8956
8977
  manifest,
8957
8978
  new Map(writes.map((w) => [w.path, w.hash]))
8958
8979
  );
8959
- return { ...result, rev: next.rev, versionId: next.versionId };
8980
+ return {
8981
+ ...result,
8982
+ rev: next.rev,
8983
+ versionId: next.versionId,
8984
+ issues: applied.issues
8985
+ };
8960
8986
  }
8961
8987
  if (!options.rebase || attempt >= REBASE_ATTEMPTS) throw conflict(manifest);
8962
8988
  rebasedFrom ??= manifest.rev;
@@ -8972,9 +8998,23 @@ function formatWorkflowPush(result) {
8972
8998
  `Pushed to workflow ${result.workflowId}: ${result.written.length} written, ${result.deleted.length} deleted.${rebased}`,
8973
8999
  ...result.written.map((path) => ` + ${path}`),
8974
9000
  ...result.deleted.map((path) => ` - ${path}`),
8975
- `Head is now rev ${result.rev} (version ${result.versionId}).`
9001
+ `Head is now rev ${result.rev} (version ${result.versionId}).`,
9002
+ ...formatIssues(result.issues ?? [])
8976
9003
  ].join("\n");
8977
9004
  }
9005
+ function formatIssues(issues) {
9006
+ if (issues.length === 0) return [];
9007
+ const errors = issues.filter((issue) => issue.severity === "error").length;
9008
+ const warnings = issues.length - errors;
9009
+ const count = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
9010
+ const summary2 = errors === 0 ? `Validation: ${count(warnings, "warning")}, nothing blocks a publish.` : `Validation: ${count(errors, "error")}${warnings > 0 ? `, ${count(warnings, "warning")}` : ""}. Fix the errors before you publish.`;
9011
+ return [
9012
+ summary2,
9013
+ ...issues.map(
9014
+ (issue) => ` ${issue.severity === "error" ? "!" : "?"} ${issue.path.join("/") || "(workflow)"}: ${issue.message}`
9015
+ )
9016
+ ];
9017
+ }
8978
9018
 
8979
9019
  // src/sync/run.ts
8980
9020
  function flag(parsed, name) {
package/dist/core.js CHANGED
@@ -4935,6 +4935,26 @@ var COMMANDS = [
4935
4935
  readOnly: false,
4936
4936
  destructive: false
4937
4937
  },
4938
+ {
4939
+ command: "workflow head validate",
4940
+ tool: "workflow_head_validate",
4941
+ title: "Validate workflow head",
4942
+ description: 'Check the workflow\'s editable head the way publish and run do, without changing it. Returns blocking errors and advisory warnings, each with the path of the field it names, such as ["nodes", "Login", "model"]. Use after `workflow_files_patch` and before `workflow_head_publish`; an empty `issues` list means the head can publish and run. The same list comes back on every `workflow_files_patch` response.',
4943
+ method: "POST",
4944
+ path: "/agents/v2/workflows/{workflowId}/head/validate",
4945
+ args: [
4946
+ {
4947
+ name: "workflowId",
4948
+ flag: "workflow-id",
4949
+ type: "string",
4950
+ required: true
4951
+ }
4952
+ ],
4953
+ query: [],
4954
+ binary: false,
4955
+ readOnly: true,
4956
+ destructive: false
4957
+ },
4938
4958
  {
4939
4959
  command: "workflow list",
4940
4960
  tool: "workflow_list",
@@ -7864,7 +7884,7 @@ function conflict(manifest) {
7864
7884
  }
7865
7885
  async function patch(sync, manifest, writes, deletes) {
7866
7886
  try {
7867
- await sync.remote.json({
7887
+ const snapshot = await sync.remote.json({
7868
7888
  method: "PATCH",
7869
7889
  path: `/agents/v2/workflows/${manifest.workflowId}/head/files`,
7870
7890
  query: new URLSearchParams(),
@@ -7877,7 +7897,7 @@ async function patch(sync, manifest, writes, deletes) {
7877
7897
  deletes
7878
7898
  }
7879
7899
  });
7880
- return "applied";
7900
+ return { issues: snapshot?.issues ?? [] };
7881
7901
  } catch (error) {
7882
7902
  if (statusOf(error) !== 409) throw error;
7883
7903
  return "conflict";
@@ -7947,14 +7967,20 @@ async function pushWorkflow(sync, dir, workflowId, options = {}) {
7947
7967
  if (writes.length === 0 && deletes.length === 0) {
7948
7968
  return { ...result, rev: manifest.rev, versionId: manifest.versionId };
7949
7969
  }
7950
- if (await patch(sync, manifest, writes, deletes) === "applied") {
7970
+ const applied = await patch(sync, manifest, writes, deletes);
7971
+ if (applied !== "conflict") {
7951
7972
  const next = await refresh(
7952
7973
  sync,
7953
7974
  dir,
7954
7975
  manifest,
7955
7976
  new Map(writes.map((w) => [w.path, w.hash]))
7956
7977
  );
7957
- return { ...result, rev: next.rev, versionId: next.versionId };
7978
+ return {
7979
+ ...result,
7980
+ rev: next.rev,
7981
+ versionId: next.versionId,
7982
+ issues: applied.issues
7983
+ };
7958
7984
  }
7959
7985
  if (!options.rebase || attempt >= REBASE_ATTEMPTS) throw conflict(manifest);
7960
7986
  rebasedFrom ??= manifest.rev;
@@ -7970,9 +7996,23 @@ function formatWorkflowPush(result) {
7970
7996
  `Pushed to workflow ${result.workflowId}: ${result.written.length} written, ${result.deleted.length} deleted.${rebased}`,
7971
7997
  ...result.written.map((path) => ` + ${path}`),
7972
7998
  ...result.deleted.map((path) => ` - ${path}`),
7973
- `Head is now rev ${result.rev} (version ${result.versionId}).`
7999
+ `Head is now rev ${result.rev} (version ${result.versionId}).`,
8000
+ ...formatIssues(result.issues ?? [])
7974
8001
  ].join("\n");
7975
8002
  }
8003
+ function formatIssues(issues) {
8004
+ if (issues.length === 0) return [];
8005
+ const errors = issues.filter((issue) => issue.severity === "error").length;
8006
+ const warnings = issues.length - errors;
8007
+ const count = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
8008
+ const summary2 = errors === 0 ? `Validation: ${count(warnings, "warning")}, nothing blocks a publish.` : `Validation: ${count(errors, "error")}${warnings > 0 ? `, ${count(warnings, "warning")}` : ""}. Fix the errors before you publish.`;
8009
+ return [
8010
+ summary2,
8011
+ ...issues.map(
8012
+ (issue) => ` ${issue.severity === "error" ? "!" : "?"} ${issue.path.join("/") || "(workflow)"}: ${issue.message}`
8013
+ )
8014
+ ];
8015
+ }
7976
8016
 
7977
8017
  // src/sync/run.ts
7978
8018
  function flag(parsed, name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteroidai/cli",
3
- "version": "1.9.122",
3
+ "version": "1.9.123",
4
4
  "description": "The asteroid command-line interface for the Asteroid platform.",
5
5
  "type": "module",
6
6
  "license": "MIT",