@openwop/cli 1.4.0 → 1.5.0

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 CHANGED
@@ -134,7 +134,7 @@ openwop packs search ads # browse the signed pack registry
134
134
 
135
135
  The `onboard` wizard walks you through:
136
136
 
137
- 1. **Host URL** — `https://app.openwop.dev/api` (shared demo), `http://localhost:8080` (local), or a custom URL.
137
+ 1. **Host URL** — `https://api.openwop.dev` (shared demo; `https://app.openwop.dev/api` also works), `http://localhost:8080` (local), or a custom URL.
138
138
  2. **AI provider** — `anthropic`, `openai`, `google`, or `minimax` (matches what the demo backend dispatches to).
139
139
  3. **API key** — auto-detects `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GOOGLE_API_KEY` / `MINIMAX_API_KEY`, or hidden-input via raw-mode stdin. The key is POSTed to `/v1/host/openwop-app/byok/secrets` on the configured host. **The key is never written to your local config file** — only a credential ref pointer is stored.
140
140
  4. **Model** — provider-specific recommended defaults plus a custom option.
package/dist/cli.js CHANGED
@@ -578,7 +578,7 @@ function errText(err) {
578
578
  // package.json
579
579
  var package_default = {
580
580
  name: "@openwop/cli",
581
- version: "1.4.0",
581
+ version: "1.5.0",
582
582
  description: "OpenWOP CLI for operating the workflow-engine demo app and OpenWOP-compatible hosts.",
583
583
  license: "Apache-2.0",
584
584
  type: "module",
@@ -667,7 +667,10 @@ var PROVIDER_CATALOG = {
667
667
  }
668
668
  };
669
669
  var HOST_PRESETS = [
670
- { key: "shared", label: "Shared demo at https://app.openwop.dev/api (recommended for trying things out)", url: "https://app.openwop.dev/api" },
670
+ // openwop-app ADR 0827: the protocol origin, served straight from Cloud Run with
671
+ // no CDN in front (`https://app.openwop.dev/api` still works; its edge drops
672
+ // conditional requests). `openwop login` opens the host-named web page.
673
+ { key: "shared", label: "Shared demo at https://api.openwop.dev (recommended for trying things out)", url: "https://api.openwop.dev" },
671
674
  { key: "local", label: "Local demo at http://localhost:8080 (run `openwop demo start` to launch)", url: "http://localhost:8080" }
672
675
  ];
673
676
 
@@ -4526,7 +4529,7 @@ async function runCatalogPacks(ctx, argv = []) {
4526
4529
  write(ctx.io.stdout, CATALOG_HELP);
4527
4530
  return 0;
4528
4531
  }
4529
- const res = await requestJson(ctx, "/v1/packs", { auth: false });
4532
+ const res = await catalogRead(ctx, "", { auth: false });
4530
4533
  if (ctx.json) {
4531
4534
  writeJson(ctx.io.stdout, res.body);
4532
4535
  return 0;
@@ -4535,6 +4538,14 @@ async function runCatalogPacks(ctx, argv = []) {
4535
4538
  writeLine(ctx.io.stdout, formatTable(rows, ["name", "nodes"]));
4536
4539
  return 0;
4537
4540
  }
4541
+ async function catalogRead(ctx, rest, options = {}) {
4542
+ try {
4543
+ return await requestJson(ctx, `/v1/host/openwop-app/packs${rest}`, options);
4544
+ } catch (err) {
4545
+ if (err instanceof HttpError && err.status === 404) return requestJson(ctx, `/v1/packs${rest}`, options);
4546
+ throw err;
4547
+ }
4548
+ }
4538
4549
  async function runCatalogPacksVerb(ctx, verb, argv) {
4539
4550
  const { options, positionals } = parseOptions(argv, { bool: ["--help"], value: ["--out"] });
4540
4551
  if (options.help) {
@@ -4543,7 +4554,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4543
4554
  }
4544
4555
  if (verb === "search") {
4545
4556
  const q = positionals[0] ?? "";
4546
- const res2 = await requestJson(ctx, `/v1/packs/-/search${q ? `?q=${encodeURIComponent(q)}` : ""}`);
4557
+ const res2 = await catalogRead(ctx, `/-/search${q ? `?q=${encodeURIComponent(q)}` : ""}`);
4547
4558
  if (ctx.json) {
4548
4559
  writeJson(ctx.io.stdout, res2.body);
4549
4560
  return 0;
@@ -4559,7 +4570,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4559
4570
  }
4560
4571
  if (verb === "get") {
4561
4572
  if (positionals.length !== 1) throw new CliError("Usage: openwop catalog packs get <packName> [--json]", 2);
4562
- const res2 = await requestJson(ctx, `/v1/packs/${encodeURIComponent(positionals[0])}`);
4573
+ const res2 = await catalogRead(ctx, `/${encodeURIComponent(positionals[0])}`);
4563
4574
  if (ctx.json) {
4564
4575
  writeJson(ctx.io.stdout, res2.body);
4565
4576
  return 0;
@@ -4570,7 +4581,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4570
4581
  for (const n of nodes) writeLine(ctx.io.stdout, ` ${n}`);
4571
4582
  return 0;
4572
4583
  }
4573
- const res = await requestJson(ctx, "/v1/packs/export");
4584
+ const res = await catalogRead(ctx, "/export");
4574
4585
  if (options.out) {
4575
4586
  writeFileSync4(String(options.out), `${JSON.stringify(res.body, null, 2)}
4576
4587
  `);
@@ -14917,13 +14928,21 @@ Approve a code ONLY if you just ran \`openwop login\` yourself.
14917
14928
  Exit codes: 0 signed in / signed out \xB7 1 denied, expired or not available on this host \xB7 2 usage.
14918
14929
 
14919
14930
  Examples:
14920
- export OPENWOP_BASE_URL=https://app.openwop.dev/api
14931
+ export OPENWOP_BASE_URL=https://api.openwop.dev
14921
14932
  openwop login
14922
14933
  openwop login --label "work laptop"
14923
14934
  openwop logout
14924
14935
  `;
14925
14936
  var sleep2 = (ms2) => new Promise((r) => setTimeout(r, ms2));
14926
- function approvalUrl(baseUrl, path) {
14937
+ function approvalUrl(baseUrl, path, uri) {
14938
+ if (typeof uri === "string") {
14939
+ try {
14940
+ const u = new URL(uri);
14941
+ const loopback = u.hostname === "localhost" || u.hostname === "127.0.0.1" || u.hostname === "[::1]";
14942
+ if (u.protocol === "https:" || u.protocol === "http:" && loopback) return u.toString();
14943
+ } catch {
14944
+ }
14945
+ }
14927
14946
  const p = typeof path === "string" && path.startsWith("/") ? path : "/access?tab=api-keys";
14928
14947
  try {
14929
14948
  return `${new URL(baseUrl).origin}${p}`;
@@ -14961,7 +14980,7 @@ async function runLogin(ctx, argv) {
14961
14980
  const userCode = started?.userCode;
14962
14981
  if (typeof deviceCode !== "string" || typeof userCode !== "string") throw notAvailable(ctx);
14963
14982
  writeLine(ctx.io.stderr, "");
14964
- writeLine(ctx.io.stderr, ` 1. Open ${approvalUrl(ctx.baseUrl, started.verificationPath)}`);
14983
+ writeLine(ctx.io.stderr, ` 1. Open ${approvalUrl(ctx.baseUrl, started.verificationPath, started.verificationUri)}`);
14965
14984
  writeLine(ctx.io.stderr, ` 2. Enter ${userCode} under "Sign in the OpenWOP CLI", and approve.`);
14966
14985
  writeLine(ctx.io.stderr, "");
14967
14986
  writeLine(ctx.io.stderr, "Waiting for approval\u2026");
package/dist/openwop.js CHANGED
@@ -579,7 +579,7 @@ function errText(err) {
579
579
  // package.json
580
580
  var package_default = {
581
581
  name: "@openwop/cli",
582
- version: "1.4.0",
582
+ version: "1.5.0",
583
583
  description: "OpenWOP CLI for operating the workflow-engine demo app and OpenWOP-compatible hosts.",
584
584
  license: "Apache-2.0",
585
585
  type: "module",
@@ -668,7 +668,10 @@ var PROVIDER_CATALOG = {
668
668
  }
669
669
  };
670
670
  var HOST_PRESETS = [
671
- { key: "shared", label: "Shared demo at https://app.openwop.dev/api (recommended for trying things out)", url: "https://app.openwop.dev/api" },
671
+ // openwop-app ADR 0827: the protocol origin, served straight from Cloud Run with
672
+ // no CDN in front (`https://app.openwop.dev/api` still works; its edge drops
673
+ // conditional requests). `openwop login` opens the host-named web page.
674
+ { key: "shared", label: "Shared demo at https://api.openwop.dev (recommended for trying things out)", url: "https://api.openwop.dev" },
672
675
  { key: "local", label: "Local demo at http://localhost:8080 (run `openwop demo start` to launch)", url: "http://localhost:8080" }
673
676
  ];
674
677
 
@@ -4526,7 +4529,7 @@ async function runCatalogPacks(ctx, argv = []) {
4526
4529
  write(ctx.io.stdout, CATALOG_HELP);
4527
4530
  return 0;
4528
4531
  }
4529
- const res = await requestJson(ctx, "/v1/packs", { auth: false });
4532
+ const res = await catalogRead(ctx, "", { auth: false });
4530
4533
  if (ctx.json) {
4531
4534
  writeJson(ctx.io.stdout, res.body);
4532
4535
  return 0;
@@ -4535,6 +4538,14 @@ async function runCatalogPacks(ctx, argv = []) {
4535
4538
  writeLine(ctx.io.stdout, formatTable(rows, ["name", "nodes"]));
4536
4539
  return 0;
4537
4540
  }
4541
+ async function catalogRead(ctx, rest, options = {}) {
4542
+ try {
4543
+ return await requestJson(ctx, `/v1/host/openwop-app/packs${rest}`, options);
4544
+ } catch (err) {
4545
+ if (err instanceof HttpError && err.status === 404) return requestJson(ctx, `/v1/packs${rest}`, options);
4546
+ throw err;
4547
+ }
4548
+ }
4538
4549
  async function runCatalogPacksVerb(ctx, verb, argv) {
4539
4550
  const { options, positionals } = parseOptions(argv, { bool: ["--help"], value: ["--out"] });
4540
4551
  if (options.help) {
@@ -4543,7 +4554,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4543
4554
  }
4544
4555
  if (verb === "search") {
4545
4556
  const q = positionals[0] ?? "";
4546
- const res2 = await requestJson(ctx, `/v1/packs/-/search${q ? `?q=${encodeURIComponent(q)}` : ""}`);
4557
+ const res2 = await catalogRead(ctx, `/-/search${q ? `?q=${encodeURIComponent(q)}` : ""}`);
4547
4558
  if (ctx.json) {
4548
4559
  writeJson(ctx.io.stdout, res2.body);
4549
4560
  return 0;
@@ -4559,7 +4570,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4559
4570
  }
4560
4571
  if (verb === "get") {
4561
4572
  if (positionals.length !== 1) throw new CliError("Usage: openwop catalog packs get <packName> [--json]", 2);
4562
- const res2 = await requestJson(ctx, `/v1/packs/${encodeURIComponent(positionals[0])}`);
4573
+ const res2 = await catalogRead(ctx, `/${encodeURIComponent(positionals[0])}`);
4563
4574
  if (ctx.json) {
4564
4575
  writeJson(ctx.io.stdout, res2.body);
4565
4576
  return 0;
@@ -4570,7 +4581,7 @@ async function runCatalogPacksVerb(ctx, verb, argv) {
4570
4581
  for (const n of nodes) writeLine(ctx.io.stdout, ` ${n}`);
4571
4582
  return 0;
4572
4583
  }
4573
- const res = await requestJson(ctx, "/v1/packs/export");
4584
+ const res = await catalogRead(ctx, "/export");
4574
4585
  if (options.out) {
4575
4586
  writeFileSync4(String(options.out), `${JSON.stringify(res.body, null, 2)}
4576
4587
  `);
@@ -14917,13 +14928,21 @@ Approve a code ONLY if you just ran \`openwop login\` yourself.
14917
14928
  Exit codes: 0 signed in / signed out \xB7 1 denied, expired or not available on this host \xB7 2 usage.
14918
14929
 
14919
14930
  Examples:
14920
- export OPENWOP_BASE_URL=https://app.openwop.dev/api
14931
+ export OPENWOP_BASE_URL=https://api.openwop.dev
14921
14932
  openwop login
14922
14933
  openwop login --label "work laptop"
14923
14934
  openwop logout
14924
14935
  `;
14925
14936
  var sleep2 = (ms2) => new Promise((r) => setTimeout(r, ms2));
14926
- function approvalUrl(baseUrl, path) {
14937
+ function approvalUrl(baseUrl, path, uri) {
14938
+ if (typeof uri === "string") {
14939
+ try {
14940
+ const u = new URL(uri);
14941
+ const loopback = u.hostname === "localhost" || u.hostname === "127.0.0.1" || u.hostname === "[::1]";
14942
+ if (u.protocol === "https:" || u.protocol === "http:" && loopback) return u.toString();
14943
+ } catch {
14944
+ }
14945
+ }
14927
14946
  const p = typeof path === "string" && path.startsWith("/") ? path : "/access?tab=api-keys";
14928
14947
  try {
14929
14948
  return `${new URL(baseUrl).origin}${p}`;
@@ -14961,7 +14980,7 @@ async function runLogin(ctx, argv) {
14961
14980
  const userCode = started?.userCode;
14962
14981
  if (typeof deviceCode !== "string" || typeof userCode !== "string") throw notAvailable(ctx);
14963
14982
  writeLine(ctx.io.stderr, "");
14964
- writeLine(ctx.io.stderr, ` 1. Open ${approvalUrl(ctx.baseUrl, started.verificationPath)}`);
14983
+ writeLine(ctx.io.stderr, ` 1. Open ${approvalUrl(ctx.baseUrl, started.verificationPath, started.verificationUri)}`);
14965
14984
  writeLine(ctx.io.stderr, ` 2. Enter ${userCode} under "Sign in the OpenWOP CLI", and approve.`);
14966
14985
  writeLine(ctx.io.stderr, "");
14967
14986
  writeLine(ctx.io.stderr, "Waiting for approval\u2026");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwop/cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "OpenWOP CLI for operating the workflow-engine demo app and OpenWOP-compatible hosts.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",