@maxceem/agw 0.10.2 → 0.10.4

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 +24 -10
  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.10.2", wrangler: "4.96.0", upgradeFrom: ["0.10.2", "0.10.1", "0.10.0", "0.9.3", "0.9.2", "0.9.1", "0.9.0", "0.8.3", "0.8.2", "0.8.1", "0.8.0", "0.7.2", "0.7.1", "0.7.0", "0.6.4", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.2", "0.5.1", "0.5.0", "0.4.0"], release: { url: "https://github.com/maxceem/app-ai-gateway/releases/download/v0.10.2/gateway-0.10.2.tar.gz", sha256: "0bc86a42bb5848b2448125fff408823a29bd0bd437a99dbe5cda4e101bd8f1df", manifest: "c1080e9a4f4f8abdb7a9df13b54c0bb245b7da9154127ebee755635d161da5b5" } };
9
+ var define_AGW_MANIFEST_default = { version: "0.10.4", wrangler: "4.96.0", upgradeFrom: ["0.10.4", "0.10.3", "0.10.2", "0.10.1", "0.10.0", "0.9.3", "0.9.2", "0.9.1", "0.9.0", "0.8.3", "0.8.2", "0.8.1", "0.8.0", "0.7.2", "0.7.1", "0.7.0", "0.6.4", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.2", "0.5.1", "0.5.0", "0.4.0"], release: { url: "https://github.com/maxceem/app-ai-gateway/releases/download/v0.10.4/gateway-0.10.4.tar.gz", sha256: "5f179a3b720d172c3b61d2eeb67ba10b3521d6a114c8782a0ce25066161300b7", manifest: "0a38daa1520ef90feb91eb4601b70d36e3e5c779c2e5b06fbd8f4f00a104bf5f" } };
10
10
 
11
11
  // src/main.ts
12
12
  import { Writable as Writable2 } from "node:stream";
@@ -15383,7 +15383,7 @@ var IssuerAuthenticationSchema = external_exports.object({
15383
15383
  audience: IssuerClaimValuesSchema,
15384
15384
  user_id_claim: external_exports.string().min(1),
15385
15385
  /** Lowercased, because header lookups ignore case. */
15386
- token_header: external_exports.string().min(1).toLowerCase().optional(),
15386
+ token_header: external_exports.string().min(1).toLowerCase().superRefine(refuseReservedHeader).optional(),
15387
15387
  required_claims: external_exports.array(ClaimRequirementSchema),
15388
15388
  max_token_lifetime_seconds: external_exports.number().int().positive(),
15389
15389
  /**
@@ -15399,22 +15399,25 @@ var IssuerAuthenticationSchema = external_exports.object({
15399
15399
  provider: external_exports.enum(ISSUER_PROVIDERS).optional(),
15400
15400
  entitlement: external_exports.enum(ENTITLEMENT_CHECKS).optional()
15401
15401
  }).strict();
15402
- var RESERVED_END_USER_HEADERS = /* @__PURE__ */ new Set([
15402
+ var RESERVED_APP_HEADERS = /* @__PURE__ */ new Set([
15403
15403
  "authorization",
15404
+ "cookie",
15405
+ "x-appattest-proof",
15404
15406
  ...PROVIDER_CREDENTIAL_HEADERS,
15405
15407
  "x-app-version",
15406
15408
  "content-type",
15407
15409
  "content-length",
15408
15410
  "host"
15409
15411
  ]);
15410
- var EndUserHeaderSchema = external_exports.string().trim().toLowerCase().min(1).max(64).regex(HTTP_FIELD_NAME, { error: "must be a valid HTTP header name" }).superRefine((header, context) => {
15411
- if (RESERVED_END_USER_HEADERS.has(header)) {
15412
+ function refuseReservedHeader(header, context) {
15413
+ if (RESERVED_APP_HEADERS.has(header)) {
15412
15414
  context.addIssue({
15413
15415
  code: "custom",
15414
15416
  message: `cannot be ${header}: the gateway already uses that header`
15415
15417
  });
15416
15418
  }
15417
- });
15419
+ }
15420
+ var EndUserHeaderSchema = external_exports.string().trim().toLowerCase().min(1).max(64).regex(HTTP_FIELD_NAME, { error: "must be a valid HTTP header name" }).superRefine(refuseReservedHeader);
15418
15421
  var HeaderEndUserSchema = external_exports.object({
15419
15422
  source: external_exports.literal("header"),
15420
15423
  header: EndUserHeaderSchema
@@ -18585,6 +18588,7 @@ var ISSUER_ERRORS = {
18585
18588
  403: "`issuer_token_rejected` \u2014 the token did not verify; get a fresh one, retry once, then fail. `issuer_claims_missing` \u2014 the token is valid but a required entitlement claim has not propagated yet; do not re-authenticate, wait and retry. `auth_required` \u2014 the key was refused or the user is blocked. `attest_failed` \u2014 the App Attest proof did not hold.",
18586
18589
  503: "`issuer_verification_unavailable` \u2014 the gateway could not reach or read the issuer's keys, so the token was never judged. Retry with backoff."
18587
18590
  };
18591
+ var SERVICE_UNAVAILABLE = "`service_unavailable` \u2014 the gateway's database or one of its Durable Objects failed or was overloaded, or the call ran past its ten-second deadline. Nothing about the request is known to be wrong. Carries Retry-After; retry after it with backoff.";
18588
18592
  var CLI_ERRORS = {
18589
18593
  409: "A conflicting transition or setup cap prevents this operation.",
18590
18594
  410: "The protected credential exchange has expired; no replacement is minted.",
@@ -18723,7 +18727,7 @@ var CATALOG = {
18723
18727
  params: APP_PARAM,
18724
18728
  response: AppAttestChallengeResponseSchema,
18725
18729
  responseDescription: "A five-minute, single-use challenge.",
18726
- errors: { 402: NO_PLAN, 429: APP_AUTH_RATE_LIMITED, 404: NO_END_USERS }
18730
+ errors: { 402: NO_PLAN, 429: APP_AUTH_RATE_LIMITED, 404: NO_END_USERS, 503: SERVICE_UNAVAILABLE }
18727
18731
  },
18728
18732
  registerAppAttestKey: {
18729
18733
  method: "POST",
@@ -18735,7 +18739,12 @@ var CATALOG = {
18735
18739
  request: AppAttestRegisterRequestSchema,
18736
18740
  response: AppAttestRegisterResponseSchema,
18737
18741
  responseDescription: "The key was registered for the verified issuer identity.",
18738
- errors: { ...ISSUER_ERRORS, 402: NO_PLAN, 429: APP_AUTH_RATE_LIMITED }
18742
+ errors: {
18743
+ ...ISSUER_ERRORS,
18744
+ 402: NO_PLAN,
18745
+ 429: APP_AUTH_RATE_LIMITED,
18746
+ 503: `${ISSUER_ERRORS[503]} ${SERVICE_UNAVAILABLE}`
18747
+ }
18739
18748
  },
18740
18749
  exchangeGatewayToken: {
18741
18750
  method: "POST",
@@ -18748,7 +18757,12 @@ var CATALOG = {
18748
18757
  request: external_exports.union([AppAttestTokenRequestSchema, ApiKeyTokenRequestSchema]),
18749
18758
  response: GatewayTokenResponseSchema,
18750
18759
  responseDescription: "A short-lived gateway access token.",
18751
- errors: { ...ISSUER_ERRORS, 402: NO_PLAN, 429: APP_AUTH_RATE_LIMITED }
18760
+ errors: {
18761
+ ...ISSUER_ERRORS,
18762
+ 402: NO_PLAN,
18763
+ 429: APP_AUTH_RATE_LIMITED,
18764
+ 503: `${ISSUER_ERRORS[503]} ${SERVICE_UNAVAILABLE}`
18765
+ }
18752
18766
  },
18753
18767
  getCurrentUser: {
18754
18768
  method: "GET",
@@ -18761,7 +18775,7 @@ var CATALOG = {
18761
18775
  headers: GatewayClientHeadersSchema,
18762
18776
  response: CurrentUserResponseSchema,
18763
18777
  responseDescription: "Current user state.",
18764
- errors: { 402: NO_PLAN, 404: NO_END_USERS }
18778
+ errors: { 402: NO_PLAN, 404: NO_END_USERS, 503: SERVICE_UNAVAILABLE }
18765
18779
  },
18766
18780
  proxyProviderRequest: {
18767
18781
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxceem/agw",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
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.10.3",
30
+ "0.10.2",
29
31
  "0.10.1",
30
32
  "0.10.0",
31
33
  "0.9.3",