@workbench-ai/workbench 0.0.78 → 0.0.79

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -17
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -723,6 +723,7 @@ const API_REQUEST_MAX_ATTEMPTS = 3;
723
723
  const API_REQUEST_GZIP_THRESHOLD_BYTES = 1024 * 1024;
724
724
  const CLOUD_RUN_TIMEOUT_MS = 30 * 60 * 1000;
725
725
  const CLOUD_RUN_POLL_INTERVAL_MS = 3000;
726
+ const LOGIN_WAIT_TIMEOUT_SECONDS = 120;
726
727
  async function handleLogin(parsed, io) {
727
728
  const provider = optionalPositional(parsed, 1);
728
729
  if (provider) {
@@ -739,7 +740,7 @@ async function handleLogin(parsed, io) {
739
740
  }
740
741
  if (parsed.flags["start-only"] === true && parsed.flags.wait === true) {
741
742
  throw new WorkbenchCodedError("usage", "workbench login accepts only one of --start-only or --wait.", {
742
- remediation: "Run workbench login --start-only or workbench login --wait.",
743
+ remediation: `Run workbench login --start-only or workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}.`,
743
744
  exitCode: 2,
744
745
  });
745
746
  }
@@ -748,7 +749,13 @@ async function handleLogin(parsed, io) {
748
749
  const timeoutSeconds = intFlag(parsed, "timeout");
749
750
  if (startOnly && timeoutSeconds !== undefined) {
750
751
  throw new WorkbenchCodedError("usage", "workbench login --timeout only applies with --wait.", {
751
- remediation: "Run workbench login --start-only, then workbench login --wait.",
752
+ remediation: `Run workbench login --start-only, then workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}.`,
753
+ exitCode: 2,
754
+ });
755
+ }
756
+ if (waitOnly && timeoutSeconds === undefined) {
757
+ throw new WorkbenchCodedError("usage", "workbench login --wait requires --timeout N.", {
758
+ remediation: `Run workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}.`,
752
759
  exitCode: 2,
753
760
  });
754
761
  }
@@ -773,8 +780,8 @@ async function handleLogin(parsed, io) {
773
780
  verificationUriComplete: record.verification_uri_complete,
774
781
  userCode: record.user_code,
775
782
  expiresAt: record.expiresAt,
776
- resume: "workbench login --wait",
777
- }, parsed, io, () => `Open ${record.verification_uri_complete}\nCode: ${record.user_code}\nResume: workbench login --wait`);
783
+ resume: `workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}`,
784
+ }, parsed, io, () => `Open ${record.verification_uri_complete}\nCode: ${record.user_code}\nResume: workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}`);
778
785
  }
779
786
  await writePendingDeviceAuthorization(record);
780
787
  if (freshAuthorization && !parsed.flags.json) {
@@ -1726,7 +1733,7 @@ async function pollDeviceToken(baseUrl, authorization, timeoutSeconds) {
1726
1733
  }
1727
1734
  throw new WorkbenchCodedError("login_pending", "Device login is still waiting for browser authorization.", {
1728
1735
  retryable: true,
1729
- remediation: "Authorize the device in the browser, then run workbench login --wait.",
1736
+ remediation: `Authorize the device in the browser, then run workbench login --wait --timeout ${LOGIN_WAIT_TIMEOUT_SECONDS}.`,
1730
1737
  subject: {
1731
1738
  retryAfterSeconds: Math.max(1, Math.ceil(intervalMs / 1000)),
1732
1739
  verificationUri: authorization.verification_uri,
@@ -2750,11 +2757,6 @@ function snapshotHasWorkflowCase(snapshot) {
2750
2757
  /^\.workbench\/cases\/[^/]+\/case\.ya?ml$/u.test(file.path)) ?? [];
2751
2758
  return caseFiles.some((file) => file.kind === "text" && !/\n\s*smoke:\s*true(?:\s|$)/u.test(`\n${file.content}`));
2752
2759
  }
2753
- function installHandleFromStatusRemote(remote) {
2754
- const publicationUrl = remote.publication.status === "published" ? remote.publication.installUrl : undefined;
2755
- const source = parseWorkbenchInstallSource(publicationUrl ?? remote.url);
2756
- return source ? `${source.owner}/${source.skill}` : publicationUrl ?? remote.url;
2757
- }
2758
2760
  async function statusWithCausalNext(status, auth, core, machine) {
2759
2761
  if (!status.project.initialized) {
2760
2762
  return {
@@ -2816,12 +2818,6 @@ async function statusWithCausalNext(status, auth, core, machine) {
2816
2818
  }
2817
2819
  return { ...status, next: "workbench publish" };
2818
2820
  }
2819
- const publishedCloudRemote = status.remotes.find((remote) => remote.kind === "workbench-cloud" &&
2820
- remote.publication.status === "published" &&
2821
- Boolean(remote.publication.installUrl));
2822
- if (publishedCloudRemote) {
2823
- return { ...status, next: `workbench install ${installHandleFromStatusRemote(publishedCloudRemote)}` };
2824
- }
2825
2821
  return {
2826
2822
  ...status,
2827
2823
  next: null,
@@ -3254,7 +3250,21 @@ async function evalSuccessNextCommand(core, runs) {
3254
3250
  return "edit .workbench/cases, then run workbench eval";
3255
3251
  }
3256
3252
  const snapshot = await createWorkbenchReadOnlyInspectionSnapshot(core);
3257
- return snapshotHasWorkflowCase(snapshot) ? "workbench publish" : "edit .workbench/cases, then run workbench eval";
3253
+ if (!snapshotHasWorkflowCase(snapshot)) {
3254
+ return "edit .workbench/cases, then run workbench eval";
3255
+ }
3256
+ const auth = await workbenchCliAuthStatus();
3257
+ if (auth.workbenchCloud.status !== "authenticated") {
3258
+ return "workbench login";
3259
+ }
3260
+ const status = await workbenchStatusSnapshot(core);
3261
+ return statusHasPublishedCurrentCloudSource(status) ? null : "workbench publish";
3262
+ }
3263
+ function statusHasPublishedCurrentCloudSource(status) {
3264
+ const currentVersionId = status.project.currentVersionId;
3265
+ return Boolean(currentVersionId && status.remotes.some((remote) => remote.kind === "workbench-cloud" &&
3266
+ remote.publication.status === "published" &&
3267
+ remote.publication.versionId === currentVersionId));
3258
3268
  }
3259
3269
  function formatStatusSnapshot(status) {
3260
3270
  const lines = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbench-ai/workbench",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/workbench-ai/workbench.git",
@@ -22,10 +22,10 @@
22
22
  "dependencies": {
23
23
  "skills": "1.5.11",
24
24
  "yaml": "^2.8.2",
25
- "@workbench-ai/workbench-built-in-adapters": "0.0.78",
26
- "@workbench-ai/workbench-protocol": "0.0.78",
27
- "@workbench-ai/workbench-contract": "0.0.78",
28
- "@workbench-ai/workbench-core": "0.0.78"
25
+ "@workbench-ai/workbench-built-in-adapters": "0.0.79",
26
+ "@workbench-ai/workbench-core": "0.0.79",
27
+ "@workbench-ai/workbench-contract": "0.0.79",
28
+ "@workbench-ai/workbench-protocol": "0.0.79"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@tailwindcss/postcss": "^4.2.2",
@@ -36,7 +36,7 @@
36
36
  "react-dom": "^19.2.0",
37
37
  "typescript": "^5.9.2",
38
38
  "vitest": "^3.2.4",
39
- "@workbench-ai/workbench-ui": "0.0.78"
39
+ "@workbench-ai/workbench-ui": "0.0.79"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "rm -rf dist && tsc -p tsconfig.json && chmod 755 dist/workbench.js && node ./scripts/build-dev-open-assets.mjs",