@maxceem/agw 0.1.10 → 0.1.12

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/agw.mjs +36 -9
  2. package/package.json +3 -1
package/dist/agw.mjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // <define:__AGW_MANIFEST__>
9
- var define_AGW_MANIFEST_default = { version: "0.1.10", wrangler: "4.96.0", upgradeFrom: ["0.1.10", "0.1.9", "0.1.8", "0.1.7", "0.1.6", "0.1.5", "0.1.4", "0.1.3", "0.1.2", "0.1.1", "0.1.0"], release: { url: "https://github.com/maxceem/app-ai-gateway/releases/download/v0.1.10/gateway-0.1.10.tar.gz", sha256: "39a8b65f05d666e323a08db70c90e345dd3eec698cbf7491b288dd5b9f864efa", manifest: "5f58bcdb8dee3dd4ca72f6da3a52ca086f2f7529cd39bd0e331a72779b8fd506" } };
9
+ var define_AGW_MANIFEST_default = { version: "0.1.12", wrangler: "4.96.0", upgradeFrom: ["0.1.12", "0.1.11", "0.1.10", "0.1.9", "0.1.8", "0.1.7", "0.1.6", "0.1.5", "0.1.4", "0.1.3", "0.1.2", "0.1.1", "0.1.0"], release: { url: "https://github.com/maxceem/app-ai-gateway/releases/download/v0.1.12/gateway-0.1.12.tar.gz", sha256: "bdc229177426c4391f49b9c74a52e97a7719b0c8c1ccbf06bc50f1e2d5835cd4", manifest: "f3ccb867dec27ab8ff813532515abbf1b7f1765b64f2f1bd16bc55b4b424503a" } };
10
10
 
11
11
  // src/main.ts
12
12
  import { Writable as Writable2 } from "node:stream";
@@ -18560,6 +18560,29 @@ async function configFile(ctx, journal, artifact) {
18560
18560
  await writeFile2(path, JSON.stringify(config2, null, 2), { mode: 384 });
18561
18561
  return { path, directory, config: config2 };
18562
18562
  }
18563
+ function transient(error51) {
18564
+ if (!(error51 instanceof CliError)) return false;
18565
+ if (error51.code === "connection_failed") return true;
18566
+ const status2 = error51.details?.status;
18567
+ return typeof status2 === "number" && status2 >= 500;
18568
+ }
18569
+ async function whileWarming(run, sleep = delay3, report = (line) => process.stderr.write(line + "\n")) {
18570
+ let wait = 1e3;
18571
+ for (let attempt = 0; ; attempt++) {
18572
+ try {
18573
+ return await run();
18574
+ } catch (error51) {
18575
+ if (attempt === 5 || !transient(error51)) throw error51;
18576
+ const { code, details } = error51;
18577
+ const status2 = details?.status;
18578
+ report(
18579
+ `Deployment is still coming up (${code}${status2 === void 0 ? "" : ` ${status2}`}); retrying in ${wait / 1e3}s.`
18580
+ );
18581
+ await sleep(wait);
18582
+ wait = Math.min(wait * 2, 8e3);
18583
+ }
18584
+ }
18585
+ }
18563
18586
  async function verifyDeployment(ctx, url2, id) {
18564
18587
  for (let attempt = 0; attempt < 20; attempt++) {
18565
18588
  try {
@@ -18960,13 +18983,13 @@ async function deploymentCommand(ctx, command, flags, cf = new Cloudflare(), loa
18960
18983
  journal.phase = "deployed";
18961
18984
  await ctx.save();
18962
18985
  await verifyDeployment(ctx, url2, journal.id);
18963
- const { data } = await ctx.publicCall("bootstrapCliAccount", [], {
18964
- body: {
18965
- idempotencyKey: journal.bootstrap.idempotencyKey,
18966
- pollToken: journal.bootstrap.pollToken
18967
- },
18968
- url: url2
18969
- });
18986
+ const proofs = {
18987
+ idempotencyKey: journal.bootstrap.idempotencyKey,
18988
+ pollToken: journal.bootstrap.pollToken
18989
+ };
18990
+ const { data } = await whileWarming(
18991
+ () => ctx.publicCall("bootstrapCliAccount", [], { body: proofs, url: url2 })
18992
+ );
18970
18993
  await ctx.select(url2, data);
18971
18994
  journal.phase = "ready";
18972
18995
  if (domain2) journal.pendingDomain = domain2;
@@ -19646,7 +19669,11 @@ var Transport = class {
19646
19669
  "invalid_response",
19647
19670
  "Deployment returned an invalid JSON response.",
19648
19671
  "Check deployment version and connectivity.",
19649
- 3
19672
+ 3,
19673
+ // The status this arrived with, which is the whole difference between
19674
+ // an edge error page in front of a Worker that is not serving yet and
19675
+ // a deployment that answered 200 with a body no client can read.
19676
+ { status: response.status }
19650
19677
  );
19651
19678
  }
19652
19679
  if (!response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxceem/agw",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "Manage App AI Gateway from a terminal or coding agent: providers, iOS and server apps, usage, and self-hosted deployment on Cloudflare",
6
6
  "keywords": [
@@ -26,6 +26,8 @@
26
26
  },
27
27
  "bugs": "https://github.com/maxceem/app-ai-gateway/issues",
28
28
  "upgradeFrom": [
29
+ "0.1.11",
30
+ "0.1.10",
29
31
  "0.1.9",
30
32
  "0.1.8",
31
33
  "0.1.7",