create-op-node 0.12.2 → 0.12.3

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/cli.js CHANGED
@@ -1335,8 +1335,6 @@ async function waitForApplyAndFetchTunnelToken(input) {
1335
1335
  return null;
1336
1336
  }
1337
1337
  }
1338
-
1339
- // src/lib/homebrew.ts
1340
1338
  var STUDIO_PACKAGES = [
1341
1339
  { name: "git", kind: "formula" },
1342
1340
  { name: "gh", kind: "formula" },
@@ -1347,8 +1345,11 @@ var STUDIO_PACKAGES = [
1347
1345
  { name: "ollama", kind: "formula" },
1348
1346
  // Required for the fail-closed image-signature gate in `bootstrap` (#34).
1349
1347
  { name: "cosign", kind: "formula" },
1350
- { name: "docker", kind: "cask" },
1351
- { name: "tailscale", kind: "cask" }
1348
+ // Homebrew renamed the `docker` cask to `docker-desktop`. The appPath skip
1349
+ // means a directly-installed Docker Desktop (the common case) is treated as
1350
+ // present rather than tripping `brew install` on the existing app. (#89)
1351
+ { name: "docker-desktop", kind: "cask", appPath: "/Applications/Docker.app" },
1352
+ { name: "tailscale", kind: "cask", appPath: "/Applications/Tailscale.app" }
1352
1353
  ];
1353
1354
  async function detectBrew() {
1354
1355
  const res = await safeExeca("brew", ["--version"]);
@@ -1359,7 +1360,18 @@ async function detectBrew() {
1359
1360
  return { installed: true, ...version ? { version } : {} };
1360
1361
  }
1361
1362
  var HOMEBREW_INSTALL_COMMAND = '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"';
1363
+ async function pathExists(path) {
1364
+ try {
1365
+ await access(path);
1366
+ return true;
1367
+ } catch {
1368
+ return false;
1369
+ }
1370
+ }
1362
1371
  async function isPackageInstalled(pkg) {
1372
+ if (pkg.appPath && await pathExists(pkg.appPath)) {
1373
+ return true;
1374
+ }
1363
1375
  const flag = pkg.kind === "cask" ? "--cask" : "--formula";
1364
1376
  const res = await safeExeca("brew", ["list", flag, pkg.name]);
1365
1377
  return res !== null && res.exitCode === 0;
@@ -2615,15 +2627,18 @@ async function collectCoreSecrets(args) {
2615
2627
  }
2616
2628
  async function collectPromptServiceSecrets(args) {
2617
2629
  const { region, nodeType, opts } = args;
2630
+ let promptsDbPassword;
2631
+ let promptServiceApiKey;
2632
+ let promptServiceAdminApiKeys;
2618
2633
  if (nodeType === "region-with-prompts") {
2619
- await loadSecret({
2634
+ promptsDbPassword = await loadSecret({
2620
2635
  region,
2621
2636
  account: "prompts-db-password",
2622
2637
  label: "prompt-service Postgres password",
2623
2638
  validate: (v) => URL_SAFE_PASSWORD_RE.test(v) ? void 0 : "must be base64url chars only (no + / =)",
2624
2639
  generate: generatePostgresPassword
2625
2640
  });
2626
- await loadSecret({
2641
+ promptServiceApiKey = await loadSecret({
2627
2642
  region,
2628
2643
  account: "prompt-service-api-key",
2629
2644
  label: "prompt-service HMAC API key",
@@ -2632,7 +2647,7 @@ async function collectPromptServiceSecrets(args) {
2632
2647
  validate: (v) => URL_SAFE_PASSWORD_RE.test(v) ? void 0 : "must be base64url chars only (no + / =)",
2633
2648
  generate: generateHmacApiKey
2634
2649
  });
2635
- await loadSecret({
2650
+ promptServiceAdminApiKeys = await loadSecret({
2636
2651
  region,
2637
2652
  account: "prompt-service-admin-api-key",
2638
2653
  label: "prompt-service admin API key",
@@ -2640,7 +2655,7 @@ async function collectPromptServiceSecrets(args) {
2640
2655
  generate: generateHmacApiKey
2641
2656
  });
2642
2657
  } else {
2643
- await loadSecret({
2658
+ promptServiceApiKey = await loadSecret({
2644
2659
  region,
2645
2660
  account: "prompt-service-api-key",
2646
2661
  label: "prompt-service HMAC API key (issued by the prompts team)",
@@ -2658,7 +2673,15 @@ async function collectPromptServiceSecrets(args) {
2658
2673
  );
2659
2674
  process.exit(1);
2660
2675
  }
2661
- return promptServiceUrl;
2676
+ return {
2677
+ url: promptServiceUrl,
2678
+ ...promptsDbPassword !== void 0 ? { promptsDbPassword } : {},
2679
+ // PROMPT_SERVICE_API_KEY is the raw key; PROMPT_SERVICE_API_KEYS is the
2680
+ // `<region>:<key>` list prompt-service validates against — same derivation
2681
+ // the op-compose wrapper does.
2682
+ ...promptServiceApiKey !== void 0 ? { promptServiceApiKey, promptServiceApiKeys: `${region}:${promptServiceApiKey}` } : {},
2683
+ ...promptServiceAdminApiKeys !== void 0 ? { promptServiceAdminApiKeys } : {}
2684
+ };
2662
2685
  }
2663
2686
  async function resolveSupabaseUrl(opts) {
2664
2687
  let supabaseUrl;
@@ -2688,9 +2711,9 @@ async function resolveSupabaseUrl(opts) {
2688
2711
  }
2689
2712
  async function collectSecretsPhase(args) {
2690
2713
  const core = await collectCoreSecrets({ region: args.region, opts: args.opts });
2691
- const promptServiceUrl = await collectPromptServiceSecrets(args);
2714
+ const { url: promptServiceUrl, ...promptSecrets } = await collectPromptServiceSecrets(args);
2692
2715
  const supabaseUrl = await resolveSupabaseUrl(args.opts);
2693
- return { ...core, promptServiceUrl, supabaseUrl };
2716
+ return { ...core, ...promptSecrets, promptServiceUrl, supabaseUrl };
2694
2717
  }
2695
2718
  async function runLaunchAgentPhase(args) {
2696
2719
  const { opts, secrets, llmModel, embeddingModel } = args;
@@ -2806,6 +2829,16 @@ function buildComposeEnv(args) {
2806
2829
  SUPABASE_URL: secrets.supabaseUrl,
2807
2830
  AUTH_JWT_SECRET: process.env["AUTH_JWT_SECRET"] ?? secrets.jwtSecret,
2808
2831
  ...secrets.tunnelToken !== void 0 ? { TUNNEL_TOKEN: secrets.tunnelToken } : {},
2832
+ // prompt-service wiring — mirrors the op-compose wrapper so bootstrap's OWN
2833
+ // compose calls can process the region-with-prompts overlay instead of
2834
+ // aborting on `${PROMPTS_DB_PASSWORD:?}`. PROMPT_SERVICE_URL is always set
2835
+ // (in-network for colocated, remote otherwise); the rest are present only
2836
+ // when the node runs or calls a prompt-service. (#90)
2837
+ PROMPT_SERVICE_URL: secrets.promptServiceUrl,
2838
+ ...secrets.promptsDbPassword !== void 0 ? { PROMPTS_DB_PASSWORD: secrets.promptsDbPassword } : {},
2839
+ ...secrets.promptServiceApiKey !== void 0 ? { PROMPT_SERVICE_API_KEY: secrets.promptServiceApiKey } : {},
2840
+ ...secrets.promptServiceApiKeys !== void 0 ? { PROMPT_SERVICE_API_KEYS: secrets.promptServiceApiKeys } : {},
2841
+ ...secrets.promptServiceAdminApiKeys !== void 0 ? { PROMPT_SERVICE_ADMIN_API_KEYS: secrets.promptServiceAdminApiKeys } : {},
2809
2842
  ...llmModel ? { LLM_MODEL: llmModel } : {},
2810
2843
  ...embeddingModel ? { EMBEDDINGS_MODEL: embeddingModel } : {}
2811
2844
  };
@@ -5121,7 +5154,7 @@ function withDefaultSubcommand(argv, known) {
5121
5154
  }
5122
5155
 
5123
5156
  // src/cli.ts
5124
- var VERSION = "0.12.2";
5157
+ var VERSION = "0.12.3";
5125
5158
  var program = new Command();
5126
5159
  program.name("create-op-node").description(
5127
5160
  "Interactive bootstrap for an Opus Populi federation node.\nCloudflare infrastructure \u2192 Mac Studio \u2192 live public API."