cf-orbs 0.2.2 → 0.2.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/README.md CHANGED
@@ -70,7 +70,7 @@ What `init` does:
70
70
  amp -ox "hello from cf-orbs" --orb-provider <name>
71
71
  ```
72
72
 
73
- The name after `--orb-provider` must match the provider name in Amp Settings. In the Amp app, pick the provider under **Self-Hosted** when you start a thread.
73
+ The name after `--orb-provider` must match the provider name in Amp Settings. The default name is `cloudflare`. A saved name from an earlier `init` wins. In the Amp app, pick the provider under **Self-Hosted** when you start a thread.
74
74
 
75
75
  `init` is safe to run again. It keeps the control token, and it keeps the Amp token secret unless you give a new one.
76
76
 
@@ -225,6 +225,10 @@ After `cf-orbs deploy`, an orb that is awake keeps the old Worker code until it
225
225
 
226
226
  `cf-orbs deploy` then starts `prewarm` throwaway instances in the background (`prewarm: started 2 instances in the background`); `cf-orbs status` shows how fast they were ready.
227
227
 
228
+ ### Back up
229
+
230
+ Running orbs need nothing on your machine: the Worker, the orbs and the snapshots are in Cloudflare. Back up `cf-orbs.config.jsonc` and `image/` (a private git repo is enough; the `.gitignore` that `init` writes keeps the control token out). Keep the Amp provider token in a password manager if you want to restore without making a new one. The control token can be made again. See [Back up and restore](https://cf-orbs-site.mdick85.workers.dev/docs/guides/back-up-and-restore/).
231
+
228
232
  ## Troubleshooting
229
233
 
230
234
  Run `cf-orbs doctor` first.
@@ -275,7 +279,7 @@ To report a vulnerability, see [SECURITY.md](https://github.com/meirdick/cf-orbs
275
279
 
276
280
  ## Status and known gaps
277
281
 
278
- v0.2.2. The control plane, dispatch program, provider host and CLI are built and unit tested. On 2026-10-30 a real Amp thread ran end to end on a fresh install: spawn from the image, setup, pause with a project snapshot, wake from the snapshot in 2.3 s, first answer 41 s after the message.
282
+ v0.2.3. The control plane, dispatch program, provider host and CLI are built and unit tested. On 2026-10-30 a real Amp thread ran end to end on a fresh install: spawn from the image, setup, pause with a project snapshot, wake from the snapshot in 2.3 s, first answer 41 s after the message.
279
283
 
280
284
  Known gaps:
281
285
 
@@ -22,6 +22,8 @@ export const SELFTEST_WAIT_MS = 180_000;
22
22
  /** Provider must stay up this long with no reject, no second-provider line and no restart. */
23
23
  export const PROVIDER_STABLE_MS = 15_000;
24
24
  const CRON_PERIOD_MS = 5 * 60_000;
25
+ /** One line at the end of a successful init, before the amp command. */
26
+ export const BACKUP_LINE = "back up: cf-orbs.config.jsonc and image/. Guide: https://cf-orbs-site.mdick85.workers.dev/docs/guides/back-up-and-restore/";
25
27
  export function helloCommand(providerName) {
26
28
  return `amp -ox "hello from cf-orbs" --orb-provider ${providerName}`;
27
29
  }
@@ -340,8 +342,7 @@ export async function runInit(ctx, o, steps) {
340
342
  break;
341
343
  case "amp-token":
342
344
  // No interactive name question here: say so if the name is a fallback, not given
343
- if (s.source !== "prompt" &&
344
- (o.providerNameSource === "config" || o.providerNameSource === "default"))
345
+ if (s.source !== "prompt" && o.providerNameSource === "default")
345
346
  ui.warn(`provider name ${providerName} was not given explicitly; it must match the name in Amp Settings → Orbs (pass --provider-name <name> if it differs)`);
346
347
  if (s.source === "env")
347
348
  ampToken = checkAmpToken(ctx, (ctx.env.AMP_ORB_PROVIDER_TOKEN ?? "").trim());
@@ -580,6 +581,7 @@ export async function runInit(ctx, o, steps) {
580
581
  case "done":
581
582
  command = s.command === helloCommand(o.providerName) ? helloCommand(providerName) : s.command;
582
583
  ui.step(`provider name ${providerName} must match the name in Amp Settings → Orbs`);
584
+ ui.out(BACKUP_LINE);
583
585
  break;
584
586
  }
585
587
  }
@@ -745,6 +747,8 @@ export function parseVcpuFlag(v) {
745
747
  throw new CliError(`--vcpu must be 1, 2, 3 or 4, got ${JSON.stringify(v)}`, "pass --vcpu 4 (default, 12 GiB) or --vcpu 2 (6 GiB, about half the cost)");
746
748
  return Number(v);
747
749
  }
750
+ /** Default Amp provider name when none is given. The Worker name default is separate: cf-orbs. */
751
+ export const DEFAULT_PROVIDER_NAME = "cloudflare";
748
752
  const WORKER_NAME_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
749
753
  export function initOptions(ctx, existing) {
750
754
  const modeFlag = flagString(ctx.args, "provider");
@@ -768,17 +772,14 @@ export function initOptions(ctx, existing) {
768
772
  providerName: flagString(ctx.args, "provider-name") ??
769
773
  ctx.env.AMP_ORB_PROVIDER_NAME ??
770
774
  existing?.providerName ??
771
- existing?.name ??
772
- "cf-orbs",
775
+ DEFAULT_PROVIDER_NAME,
773
776
  providerNameSource: flagString(ctx.args, "provider-name") !== undefined
774
777
  ? "flag"
775
778
  : ctx.env.AMP_ORB_PROVIDER_NAME !== undefined
776
779
  ? "env"
777
780
  : existing?.providerName !== undefined
778
781
  ? "saved"
779
- : existing?.name !== undefined
780
- ? "config"
781
- : "default",
782
+ : "default",
782
783
  };
783
784
  }
784
785
  export async function initCommand(ctx) {
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ export const COMMANDS = {
30
30
  "--provider cloudflare|external where amp orb provider runs (default cloudflare)",
31
31
  "--token-file <file> Amp provider token file (else AMP_ORB_PROVIDER_TOKEN, else prompt)",
32
32
  "--account-id <id> Cloudflare account (else CLOUDFLARE_ACCOUNT_ID, else ask)",
33
- "--provider-name <name> Amp provider name, as in Amp Settings → Orbs (else AMP_ORB_PROVIDER_NAME, saved name, config name, then cf-orbs)",
33
+ "--provider-name <name> Amp provider name, as in Amp Settings → Orbs (default cloudflare; AMP_ORB_PROVIDER_NAME or a saved name wins)",
34
34
  "--subdomain <name> workers.dev subdomain to register if the account has none",
35
35
  "--vcpu <1|2|3|4> orb size: N vCPU, N x 3 GiB, 20 GB disk (default 4; 2 is cheaper)",
36
36
  "--name <name> Worker name (default cf-orbs; a second install needs another)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-orbs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Run Amp orbs on Cloudflare Containers: self-hosted orb provider, one command to install.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,7 +18,7 @@ import { type Env, orbDoName, PROVIDER_DO_NAME, REGISTRY_DO_NAME } from "./env";
18
18
  import { BENCH_ORB_RE, type BenchStartRequest, parseBenchStart } from "./orb/bench";
19
19
  import { restartProvider } from "./provider-restart";
20
20
 
21
- export const API_VERSION = "0.2.2";
21
+ export const API_VERSION = "0.2.3";
22
22
 
23
23
  /** D2. Amp sends `amp-<thread id>`. Never starts with `_` or `.`, so it cannot look like an internal name. */
24
24
  export const ORB_ID_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;