@fungi.computer/darkroom 0.11.16 → 0.11.18

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.
@@ -39,6 +39,9 @@ const providerMessage = z
39
39
  const cut = body.indexOf(": ");
40
40
  return { code: Number(body.slice(0, cut)), rest: body.slice(cut + 2) };
41
41
  });
42
+ // Native Miniflare's local AI stub has no code field. Decode its complete
43
+ // vendor grammar here, alongside Workers AI's numeric message grammar.
44
+ const disabledRemoteBinding = z.literal("Binding AI needs to be run remotely");
42
45
  // Never print keys, URLs, ids or structured bodies: plain words only.
43
46
  const safeSentence = z
44
47
  .string()
@@ -50,6 +53,10 @@ const safeSentence = z
50
53
  .refine((text) => !/key|token|secret|bearer|password|authorization/iu.test(text));
51
54
  /** The reason a provider failure is classified under, from its documented code or wording. */
52
55
  export function providerReason(name, message) {
56
+ // Native Miniflare AI binding error, reproduced with Wrangler 4.159.0 and
57
+ // dev.remote: false. This is local configuration, not a provider outage.
58
+ if (disabledRemoteBinding.safeParse(message).success)
59
+ return "remote_binding_disabled";
53
60
  if (name === "TimeoutError")
54
61
  return "timeout";
55
62
  const parsed = providerMessage.safeParse(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/darkroom",
3
- "version": "0.11.16",
3
+ "version": "0.11.18",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Media generation, durable output retention and provenance with host-owned authority and billing",
6
6
  "type": "module",
@@ -66,7 +66,7 @@
66
66
  "exifreader": "4.46.0",
67
67
  "@fungi.computer/ts-webp": "0.1.6",
68
68
  "@xmldom/xmldom": "0.9.12",
69
- "@fungi.computer/agar": "0.27.0",
69
+ "@fungi.computer/agar": "0.27.2",
70
70
  "@fungi.computer/capnweb": "0.12.0-fungi.0"
71
71
  },
72
72
  "devDependencies": {
@@ -45,6 +45,10 @@ const providerMessage = z
45
45
  return { code: Number(body.slice(0, cut)), rest: body.slice(cut + 2) };
46
46
  });
47
47
 
48
+ // Native Miniflare's local AI stub has no code field. Decode its complete
49
+ // vendor grammar here, alongside Workers AI's numeric message grammar.
50
+ const disabledRemoteBinding = z.literal("Binding AI needs to be run remotely");
51
+
48
52
  // Never print keys, URLs, ids or structured bodies: plain words only.
49
53
  const safeSentence = z
50
54
  .string()
@@ -62,6 +66,10 @@ export function providerReason(
62
66
  name: string | undefined,
63
67
  message: string | undefined,
64
68
  ): MediaProviderReason | undefined {
69
+ // Native Miniflare AI binding error, reproduced with Wrangler 4.159.0 and
70
+ // dev.remote: false. This is local configuration, not a provider outage.
71
+ if (disabledRemoteBinding.safeParse(message).success)
72
+ return "remote_binding_disabled";
65
73
  if (name === "TimeoutError") return "timeout";
66
74
  const parsed = providerMessage.safeParse(message);
67
75
  if (!parsed.success) return undefined;
@@ -33,6 +33,11 @@ function failed(name: string, message: string) {
33
33
  // https://developers.cloudflare.com/workers-ai/platform/errors/
34
34
  // https://developers.cloudflare.com/ai-gateway/reference/troubleshooting/
35
35
  it.each([
36
+ [
37
+ "Error",
38
+ "Binding AI needs to be run remotely",
39
+ { code: null, reason: "remote_binding_disabled" },
40
+ ],
36
41
  [
37
42
  "AiGatewayError",
38
43
  "7003: Model execution failed (User Input Error): image dimensions are too small",