@caelo-cms/shared 0.12.9 → 0.12.11
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/ai-cost.d.ts +146 -0
- package/dist/ai-cost.d.ts.map +1 -0
- package/dist/ai-cost.js +182 -0
- package/dist/ai-cost.js.map +1 -0
- package/dist/ai-tools.d.ts +1 -1
- package/dist/build-page.d.ts +2 -2
- package/dist/cap-failures.d.ts.map +1 -1
- package/dist/cap-failures.js +7 -5
- package/dist/cap-failures.js.map +1 -1
- package/dist/change-journal.d.ts.map +1 -1
- package/dist/change-journal.js +16 -0
- package/dist/change-journal.js.map +1 -1
- package/dist/content.d.ts +3 -3
- package/dist/embedding-models.d.ts +95 -0
- package/dist/embedding-models.d.ts.map +1 -0
- package/dist/embedding-models.js +60 -0
- package/dist/embedding-models.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/module-id-tag.d.ts +13 -0
- package/dist/module-id-tag.d.ts.map +1 -1
- package/dist/module-id-tag.js +24 -2
- package/dist/module-id-tag.js.map +1 -1
- package/dist/preview-compose.d.ts +17 -1
- package/dist/preview-compose.d.ts.map +1 -1
- package/dist/preview-compose.js +10 -3
- package/dist/preview-compose.js.map +1 -1
- package/dist/search-feed.d.ts +123 -0
- package/dist/search-feed.d.ts.map +1 -0
- package/dist/search-feed.js +152 -0
- package/dist/search-feed.js.map +1 -0
- package/dist/seo.d.ts +19 -0
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +12 -1
- package/dist/seo.js.map +1 -1
- package/dist/site-security-headers.d.ts +2 -2
- package/dist/stage-status.d.ts +10 -5
- package/dist/stage-status.d.ts.map +1 -1
- package/dist/stage-status.js +27 -1
- package/dist/stage-status.js.map +1 -1
- package/dist/static-files.d.ts.map +1 -1
- package/dist/static-files.js +1 -0
- package/dist/static-files.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/visitor-ai-origin.d.ts +41 -0
- package/dist/visitor-ai-origin.d.ts.map +1 -0
- package/dist/visitor-ai-origin.js +65 -0
- package/dist/visitor-ai-origin.js.map +1 -0
- package/package.json +8 -1
- package/src/ai-cost.test.ts +81 -0
- package/src/ai-cost.ts +288 -0
- package/src/cap-failures.ts +7 -5
- package/src/change-journal.ts +31 -0
- package/src/embedding-models.test.ts +37 -0
- package/src/embedding-models.ts +147 -0
- package/src/index.ts +9 -0
- package/src/module-id-tag.test.ts +27 -1
- package/src/module-id-tag.ts +29 -2
- package/src/preview-compose.test.ts +21 -0
- package/src/preview-compose.ts +33 -4
- package/src/search-feed.test.ts +115 -0
- package/src/search-feed.ts +180 -0
- package/src/seo.test.ts +13 -0
- package/src/seo.ts +26 -1
- package/src/stage-status.ts +29 -1
- package/src/static-files.ts +1 -0
- package/src/version.ts +1 -1
- package/src/visitor-ai-origin.ts +86 -0
package/dist/static-files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-files.js","sourceRoot":"","sources":["../src/static-files.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kEAAkE;AAClE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB;IAClB,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,UAAU;CACF,CAAC;AAKX,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC,sCAAsC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC,mCAAmC;AACnC,MAAM,CAAC,MAAM,2BAA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AI,EAAE,IAAI,CAAC,WAAW,CAAC;QAC7D,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;KACjD,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
|
|
20
20
|
* follow standard SemVer.
|
|
21
21
|
*/
|
|
22
|
-
export declare const CAELO_VERSION = "0.12.
|
|
22
|
+
export declare const CAELO_VERSION = "0.12.11";
|
|
23
23
|
/**
|
|
24
24
|
* Deprecated alias for back-compat — early P17 work spelled this
|
|
25
25
|
* `CALEO_VERSION` (typo of "Caelo"). New code should import
|
|
@@ -31,7 +31,7 @@ export declare const CAELO_VERSION = "0.12.9";
|
|
|
31
31
|
*
|
|
32
32
|
* @deprecated use CAELO_VERSION
|
|
33
33
|
*/
|
|
34
|
-
export declare const CALEO_VERSION = "0.12.
|
|
34
|
+
export declare const CALEO_VERSION = "0.12.11";
|
|
35
35
|
/**
|
|
36
36
|
* Parsed shape — major/minor/patch + optional pre-release tag.
|
|
37
37
|
* Stable interface for callers that need to feature-gate (rare —
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,YAAgB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAsB,GAAG,YAAY,CAYtE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAkBvE"}
|
package/dist/version.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Format: SemVer 2.0.0. Pre-1.0 minor bumps are breaking; post-1.0
|
|
21
21
|
* follow standard SemVer.
|
|
22
22
|
*/
|
|
23
|
-
export const CAELO_VERSION = "0.12.
|
|
23
|
+
export const CAELO_VERSION = "0.12.11";
|
|
24
24
|
/**
|
|
25
25
|
* Deprecated alias for back-compat — early P17 work spelled this
|
|
26
26
|
* `CALEO_VERSION` (typo of "Caelo"). New code should import
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAgB3C,MAAM,UAAU,YAAY,CAAC,MAAc,aAAa;IACtD,MAAM,CA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AC,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU;QAAE,OAAO,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;IACrE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a visitor's browser streams an AI conversation from (#1654).
|
|
3
|
+
*
|
|
4
|
+
* On `gcp` (load balancer) and self-hosted (Caddy) the site's own origin
|
|
5
|
+
* streams: `/api/*` reaches the gateway unbuffered. On `gcp-firebase` the
|
|
6
|
+
* Firebase Hosting rewrite of `/api/**` buffers a response until it ends,
|
|
7
|
+
* so the widget streams from the gateway's own run.app origin instead
|
|
8
|
+
* (with CORS for the site's origins), the one Cloud Run gives every
|
|
9
|
+
* service: `https://<service>-<project number>.<region>.run.app`.
|
|
10
|
+
*
|
|
11
|
+
* Nothing about it is configured: the service name and region are the
|
|
12
|
+
* env the install already sets (`CAELO_GATEWAY_SERVICE`,
|
|
13
|
+
* `CAELO_GATEWAY_REGION` on the admin; Cloud Run's own `K_SERVICE` on a
|
|
14
|
+
* gateway), the project number and region come from the metadata server
|
|
15
|
+
* of the Cloud Run instance. `CAELO_VISITOR_AI_STREAM_ORIGIN` overrides
|
|
16
|
+
* everything (tests, an install behind its own streaming proxy); an empty
|
|
17
|
+
* value means the site's own origin.
|
|
18
|
+
*/
|
|
19
|
+
/** The override; empty: the site's own origin. */
|
|
20
|
+
export declare const VISITOR_AI_STREAM_ORIGIN_ENV = "CAELO_VISITOR_AI_STREAM_ORIGIN";
|
|
21
|
+
/** The deterministic URL Cloud Run gives a service. */
|
|
22
|
+
export declare function cloudRunServiceOrigin(service: string, projectNumber: string, region: string): string;
|
|
23
|
+
/** The project number and region of this Cloud Run instance, from the metadata server. */
|
|
24
|
+
export declare function cloudRunInstanceLocation(fetchFn?: typeof fetch): Promise<{
|
|
25
|
+
readonly projectNumber: string;
|
|
26
|
+
readonly region: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* The origin to stream from, or null for the site's own. `service` and
|
|
30
|
+
* `region` name the gateway (the admin's env); without `region` the
|
|
31
|
+
* instance's own (a gateway asking about itself). The staging gateway
|
|
32
|
+
* always streams on its own origin: it serves the staged site itself, with
|
|
33
|
+
* no Firebase rewrite in front to buffer, and its gate admits only requests
|
|
34
|
+
* carrying the operator's staging cookie, which a run.app request would not.
|
|
35
|
+
*/
|
|
36
|
+
export declare function visitorAiStreamOrigin(env: Readonly<Record<string, string | undefined>>, gateway: {
|
|
37
|
+
readonly service: string | undefined;
|
|
38
|
+
readonly region?: string | undefined;
|
|
39
|
+
readonly environment?: "live" | "staging";
|
|
40
|
+
}, fetchFn?: typeof fetch): Promise<string | null>;
|
|
41
|
+
//# sourceMappingURL=visitor-ai-origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor-ai-origin.d.ts","sourceRoot":"","sources":["../src/visitor-ai-origin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,kDAAkD;AAClD,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E,uDAAuD;AACvD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,MAAM,CAQR;AAED,0FAA0F;AAC1F,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAUtE;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACjD,OAAO,EAAE;IACP,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C,EACD,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAexB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Where a visitor's browser streams an AI conversation from (#1654).
|
|
4
|
+
*
|
|
5
|
+
* On `gcp` (load balancer) and self-hosted (Caddy) the site's own origin
|
|
6
|
+
* streams: `/api/*` reaches the gateway unbuffered. On `gcp-firebase` the
|
|
7
|
+
* Firebase Hosting rewrite of `/api/**` buffers a response until it ends,
|
|
8
|
+
* so the widget streams from the gateway's own run.app origin instead
|
|
9
|
+
* (with CORS for the site's origins), the one Cloud Run gives every
|
|
10
|
+
* service: `https://<service>-<project number>.<region>.run.app`.
|
|
11
|
+
*
|
|
12
|
+
* Nothing about it is configured: the service name and region are the
|
|
13
|
+
* env the install already sets (`CAELO_GATEWAY_SERVICE`,
|
|
14
|
+
* `CAELO_GATEWAY_REGION` on the admin; Cloud Run's own `K_SERVICE` on a
|
|
15
|
+
* gateway), the project number and region come from the metadata server
|
|
16
|
+
* of the Cloud Run instance. `CAELO_VISITOR_AI_STREAM_ORIGIN` overrides
|
|
17
|
+
* everything (tests, an install behind its own streaming proxy); an empty
|
|
18
|
+
* value means the site's own origin.
|
|
19
|
+
*/
|
|
20
|
+
/** The override; empty: the site's own origin. */
|
|
21
|
+
export const VISITOR_AI_STREAM_ORIGIN_ENV = "CAELO_VISITOR_AI_STREAM_ORIGIN";
|
|
22
|
+
/** The deterministic URL Cloud Run gives a service. */
|
|
23
|
+
export function cloudRunServiceOrigin(service, projectNumber, region) {
|
|
24
|
+
if (!/^[a-z][a-z0-9-]{0,62}$/.test(service) ||
|
|
25
|
+
!/^\d{1,20}$/.test(projectNumber) ||
|
|
26
|
+
!/^[a-z]+-[a-z]+\d+$/.test(region))
|
|
27
|
+
throw new Error(`not a Cloud Run service address: ${service} / ${projectNumber} / ${region}`);
|
|
28
|
+
return `https://${service}-${projectNumber}.${region}.run.app`;
|
|
29
|
+
}
|
|
30
|
+
/** The project number and region of this Cloud Run instance, from the metadata server. */
|
|
31
|
+
export async function cloudRunInstanceLocation(fetchFn = fetch) {
|
|
32
|
+
const res = await fetchFn("http://metadata.google.internal/computeMetadata/v1/instance/region", {
|
|
33
|
+
headers: { "Metadata-Flavor": "Google" },
|
|
34
|
+
signal: AbortSignal.timeout(3000),
|
|
35
|
+
});
|
|
36
|
+
if (!res.ok)
|
|
37
|
+
throw new Error(`metadata server: instance/region returned HTTP ${res.status}`);
|
|
38
|
+
// projects/<number>/regions/<region>
|
|
39
|
+
const m = /^projects\/(\d+)\/regions\/([a-z]+-[a-z]+\d+)$/.exec((await res.text()).trim());
|
|
40
|
+
if (!m)
|
|
41
|
+
throw new Error("metadata server: instance/region has an unknown shape");
|
|
42
|
+
return { projectNumber: m[1], region: m[2] };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The origin to stream from, or null for the site's own. `service` and
|
|
46
|
+
* `region` name the gateway (the admin's env); without `region` the
|
|
47
|
+
* instance's own (a gateway asking about itself). The staging gateway
|
|
48
|
+
* always streams on its own origin: it serves the staged site itself, with
|
|
49
|
+
* no Firebase rewrite in front to buffer, and its gate admits only requests
|
|
50
|
+
* carrying the operator's staging cookie, which a run.app request would not.
|
|
51
|
+
*/
|
|
52
|
+
export async function visitorAiStreamOrigin(env, gateway, fetchFn = fetch) {
|
|
53
|
+
const override = env[VISITOR_AI_STREAM_ORIGIN_ENV];
|
|
54
|
+
if (override !== undefined)
|
|
55
|
+
return override.trim() === "" ? null : new URL(override).origin;
|
|
56
|
+
if (gateway.environment === "staging")
|
|
57
|
+
return null;
|
|
58
|
+
if (env.CAELO_PROVIDER !== "gcp-firebase")
|
|
59
|
+
return null;
|
|
60
|
+
if (!gateway.service)
|
|
61
|
+
throw new Error("gcp-firebase: the gateway's Cloud Run service is not named (CAELO_GATEWAY_SERVICE on the admin, K_SERVICE on the gateway); run `cms-provision upgrade`");
|
|
62
|
+
const where = await cloudRunInstanceLocation(fetchFn);
|
|
63
|
+
return cloudRunServiceOrigin(gateway.service, where.projectNumber, gateway.region ?? where.region);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=visitor-ai-origin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor-ai-origin.js","sourceRoot":"","sources":["../src/visitor-ai-origin.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AAEH,kDAAkD;AAClD,MAAM,CAAC,MAAM,4BAA4B,GAAG,gCAAgC,CAAC;AAE7E,uDAAuD;AACvD,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,aAAqB,EACrB,MAAc;IAEd,IACE,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC;QACvC,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;QACjC,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC;QAElC,MAAM,IAAI,KAAK,CAAC,oCAAoC,OAAO,MAAM,aAAa,MAAM,MAAM,EAAE,CAAC,CAAC;IAChG,OAAO,WAAW,OAAO,IAAI,aAAa,IAAI,MAAM,UAAU,CAAC;AACjE,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,UAAwB,KAAK;IAE7B,MAAM,GAAG,GAAG,MAA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CAC1B,OAAO,CAAC,OAAO,EACf,KAAK,CAAC,aAAa,EACnB,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAC/B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caelo-cms/shared",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Shared Zod schemas + types + the two-pass HTML composer used by every Caelo CMS workspace package. Stable enough for plugin authors and embedders to depend on directly.",
|
|
@@ -28,6 +28,13 @@
|
|
|
28
28
|
"development": "./src/lists/model.ts",
|
|
29
29
|
"import": "./dist/lists/model.js",
|
|
30
30
|
"default": "./dist/lists/model.js"
|
|
31
|
+
},
|
|
32
|
+
"./embedding-models": {
|
|
33
|
+
"types": "./dist/embedding-models.d.ts",
|
|
34
|
+
"bun": "./src/embedding-models.ts",
|
|
35
|
+
"development": "./src/embedding-models.ts",
|
|
36
|
+
"import": "./dist/embedding-models.js",
|
|
37
|
+
"default": "./dist/embedding-models.js"
|
|
31
38
|
}
|
|
32
39
|
},
|
|
33
40
|
"files": [
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from "bun:test";
|
|
4
|
+
import {
|
|
5
|
+
computeAiCallCostMicrocents,
|
|
6
|
+
IMAGE_TOKEN_BOUND,
|
|
7
|
+
PROVIDER_REQUEST_OVERHEAD_TOKENS,
|
|
8
|
+
promptTokenBound,
|
|
9
|
+
tokenBoundOf,
|
|
10
|
+
worstCaseTextMicrocents,
|
|
11
|
+
} from "./ai-cost.js";
|
|
12
|
+
|
|
13
|
+
describe("worstCaseTextMicrocents (#1653)", () => {
|
|
14
|
+
const pricing = {
|
|
15
|
+
inputMicrocents: 300,
|
|
16
|
+
outputMicrocents: 1500,
|
|
17
|
+
cachedMicrocents: 30,
|
|
18
|
+
cacheCreationMicrocents: 375,
|
|
19
|
+
longPromptThresholdTokens: null,
|
|
20
|
+
longPromptMultiplier: null,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
it("bills every prompt token at the dearest input lane and the whole output ceiling", () => {
|
|
24
|
+
// 10,000 × 375/1K + 2,000 × 1,500/1K = 3,750 + 3,000.
|
|
25
|
+
expect(worstCaseTextMicrocents(pricing, { promptTokens: 10_000, maxOutputTokens: 2_000 })).toBe(
|
|
26
|
+
6_750,
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("is never below the real cost of a call inside its bounds", () => {
|
|
31
|
+
const real = computeAiCallCostMicrocents(pricing, {
|
|
32
|
+
operationType: "text",
|
|
33
|
+
inputTokens: 10_000,
|
|
34
|
+
outputTokens: 2_000,
|
|
35
|
+
cachedTokens: 4_000,
|
|
36
|
+
cacheCreationTokens: 6_000,
|
|
37
|
+
imageCount: 0,
|
|
38
|
+
}).costMicrocents;
|
|
39
|
+
expect(
|
|
40
|
+
worstCaseTextMicrocents(pricing, { promptTokens: 10_000, maxOutputTokens: 2_000 }),
|
|
41
|
+
).toBeGreaterThanOrEqual(real);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("takes the prompt-length card when the bound crosses its threshold, and null without pricing", () => {
|
|
45
|
+
const long = { ...pricing, longPromptThresholdTokens: 5_000, longPromptMultiplier: 2 };
|
|
46
|
+
expect(worstCaseTextMicrocents(long, { promptTokens: 10_000, maxOutputTokens: 0 })).toBe(7_500);
|
|
47
|
+
expect(worstCaseTextMicrocents(null, { promptTokens: 1, maxOutputTokens: 1 })).toBeNull();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("token bounds for reservations (#1653)", () => {
|
|
52
|
+
it("counts every UTF-8 byte of text as at most one token", () => {
|
|
53
|
+
// The JSON text's bytes: quotes included.
|
|
54
|
+
expect(tokenBoundOf("abc")).toBe(5);
|
|
55
|
+
// Each umlaut is two bytes, so two tokens at most.
|
|
56
|
+
expect(tokenBoundOf("äö")).toBe(6);
|
|
57
|
+
expect(tokenBoundOf("你好")).toBe(8);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("counts an image part at a fixed bound instead of its base64 bytes", () => {
|
|
61
|
+
const image = { type: "image", base64: "A".repeat(2_000_000), mediaType: "image/png" };
|
|
62
|
+
const bound = tokenBoundOf([{ role: "user", content: "see", additionalContent: [image] }]);
|
|
63
|
+
expect(bound).toBeGreaterThanOrEqual(IMAGE_TOKEN_BOUND);
|
|
64
|
+
expect(bound).toBeLessThan(IMAGE_TOKEN_BOUND + 200);
|
|
65
|
+
// The SDK's file/media part shapes count the same way.
|
|
66
|
+
expect(
|
|
67
|
+
tokenBoundOf({ type: "file", data: "B".repeat(500_000), mediaType: "application/pdf" }),
|
|
68
|
+
).toBeLessThan(IMAGE_TOKEN_BOUND + 100);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("never counts a function (tool handlers) and adds the provider's wrapping once", () => {
|
|
72
|
+
// The key travels in a schema dump at most; the function's source never does.
|
|
73
|
+
expect(tokenBoundOf({ name: "t", handler: () => "x".repeat(10_000) })).toBeLessThan(40);
|
|
74
|
+
expect(promptTokenBound("s", "m")).toBe(PROVIDER_REQUEST_OVERHEAD_TOKENS + 6);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("bounds a JSON value at no less than its serialized bytes", () => {
|
|
78
|
+
const value = { a: [1, 2, { b: "text", d: "Grüße\n" }], c: null, e: true };
|
|
79
|
+
expect(tokenBoundOf(value)).toBeGreaterThanOrEqual(Buffer.byteLength(JSON.stringify(value)));
|
|
80
|
+
});
|
|
81
|
+
});
|
package/src/ai-cost.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What an AI call costs, and the most it can cost before it runs: the pure
|
|
5
|
+
* pricing every spend ledger shares (#297, #1477, #1653, #1654). The admin's
|
|
6
|
+
* `ai_calls` ledger and the gateway's visitor-AI ledger (cms_public) price
|
|
7
|
+
* the same way from the same code, so a cap means the same on both sides.
|
|
8
|
+
*
|
|
9
|
+
* Money unit: microcents (1e-8 USD); pricing rows are per 1K tokens for
|
|
10
|
+
* text and per image for image ops (see migration 0048).
|
|
11
|
+
*
|
|
12
|
+
* Prices that depend on prompt length (#1477): Claude Haiku 5.5 bills a
|
|
13
|
+
* request whose prompt is over 100,000 tokens at five times its normal
|
|
14
|
+
* rates, on every lane. The prompt length counts cache reads and writes
|
|
15
|
+
* too, and each request is priced on its own.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The prompt-length fields of an `ai_pricing` row; absent or null = one flat card. */
|
|
19
|
+
export interface LongPromptPricing {
|
|
20
|
+
readonly longPromptThresholdTokens?: number | null;
|
|
21
|
+
readonly longPromptMultiplier?: number | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The factor on every rate for a request with `promptTokens` of input.
|
|
26
|
+
*
|
|
27
|
+
* @param promptTokens all input tokens of the request (fresh + cache read +
|
|
28
|
+
* cache write). At exactly the threshold the normal rates still apply.
|
|
29
|
+
* @returns 1 for a row without prompt-length pricing or a prompt at or under
|
|
30
|
+
* the threshold, else the row's multiplier.
|
|
31
|
+
*/
|
|
32
|
+
export function longPromptRateMultiplier(
|
|
33
|
+
pricing: LongPromptPricing | null | undefined,
|
|
34
|
+
promptTokens: number,
|
|
35
|
+
): number {
|
|
36
|
+
const threshold = pricing?.longPromptThresholdTokens;
|
|
37
|
+
const multiplier = pricing?.longPromptMultiplier;
|
|
38
|
+
if (threshold == null || multiplier == null) return 1;
|
|
39
|
+
return promptTokens > threshold ? multiplier : 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The rates of one `ai_pricing` row (per 1K tokens; per image for image rows). */
|
|
43
|
+
export interface PricingRow extends LongPromptPricing {
|
|
44
|
+
inputMicrocents: number;
|
|
45
|
+
outputMicrocents: number | null;
|
|
46
|
+
/** Cache-READ (`cache_read_input_tokens`) rate per 1K tokens. */
|
|
47
|
+
cachedMicrocents: number | null;
|
|
48
|
+
/** Cache-WRITE (`cache_creation_input_tokens`) rate per 1K tokens; NULL
|
|
49
|
+
* lets the cost mapper default to 1.25x the input rate. */
|
|
50
|
+
cacheCreationMicrocents: number | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A candidate ai_pricing row for one (provider, operationType), carrying the
|
|
55
|
+
* fields `pickPricingRow` needs to choose the row in force at a given time:
|
|
56
|
+
* the rates plus the model (for exact-vs-wildcard specificity) and the
|
|
57
|
+
* validity/effective timestamps as epoch ms (null bound = open-ended).
|
|
58
|
+
*/
|
|
59
|
+
export interface PricingCandidate extends PricingRow {
|
|
60
|
+
model: string;
|
|
61
|
+
effectiveFromMs: number;
|
|
62
|
+
validFromMs: number | null;
|
|
63
|
+
validToMs: number | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Pick the ai_pricing row in force at `nowMs` from candidates already scoped
|
|
68
|
+
* to one (provider, operationType). Eligibility: `effective_from` has passed
|
|
69
|
+
* AND the `[valid_from, valid_to]` window (either bound open) contains
|
|
70
|
+
* `nowMs`. Precedence among the eligible: exact-model beats the wildcard `*`,
|
|
71
|
+
* then a DATED window beats the undated back-compat row, then the
|
|
72
|
+
* latest-starting window wins, then the latest `effective_from`. Returns the
|
|
73
|
+
* `PricingRow` rate subset, or null when nothing is eligible.
|
|
74
|
+
*
|
|
75
|
+
* Pure + exported so validity-window selection is unit-testable without a DB.
|
|
76
|
+
*/
|
|
77
|
+
export function pickPricingRow(
|
|
78
|
+
candidates: readonly PricingCandidate[],
|
|
79
|
+
requestedModel: string,
|
|
80
|
+
nowMs: number,
|
|
81
|
+
): PricingRow | null {
|
|
82
|
+
const eligible = candidates.filter(
|
|
83
|
+
(c) =>
|
|
84
|
+
c.effectiveFromMs <= nowMs &&
|
|
85
|
+
(c.validFromMs === null || c.validFromMs <= nowMs) &&
|
|
86
|
+
(c.validToMs === null || c.validToMs >= nowMs),
|
|
87
|
+
);
|
|
88
|
+
if (eligible.length === 0) return null;
|
|
89
|
+
const exact = (c: PricingCandidate) => (c.model === requestedModel ? 1 : 0);
|
|
90
|
+
const dated = (c: PricingCandidate) => (c.validFromMs !== null || c.validToMs !== null ? 1 : 0);
|
|
91
|
+
// Later in each ranked dimension wins; `beats(b, a)` = "b outranks a".
|
|
92
|
+
const beats = (b: PricingCandidate, a: PricingCandidate): boolean => {
|
|
93
|
+
if (exact(b) !== exact(a)) return exact(b) > exact(a);
|
|
94
|
+
if (dated(b) !== dated(a)) return dated(b) > dated(a);
|
|
95
|
+
const bf = b.validFromMs ?? Number.NEGATIVE_INFINITY;
|
|
96
|
+
const af = a.validFromMs ?? Number.NEGATIVE_INFINITY;
|
|
97
|
+
if (bf !== af) return bf > af;
|
|
98
|
+
return b.effectiveFromMs > a.effectiveFromMs;
|
|
99
|
+
};
|
|
100
|
+
const best = eligible.reduce((a, b) => (beats(b, a) ? b : a));
|
|
101
|
+
return {
|
|
102
|
+
inputMicrocents: best.inputMicrocents,
|
|
103
|
+
outputMicrocents: best.outputMicrocents,
|
|
104
|
+
cachedMicrocents: best.cachedMicrocents,
|
|
105
|
+
cacheCreationMicrocents: best.cacheCreationMicrocents,
|
|
106
|
+
longPromptThresholdTokens: best.longPromptThresholdTokens ?? null,
|
|
107
|
+
longPromptMultiplier: best.longPromptMultiplier ?? null,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// The cost of a finished call (issue #297).
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
export interface AiCallCostInput {
|
|
115
|
+
operationType: "text" | "image";
|
|
116
|
+
inputTokens: number;
|
|
117
|
+
outputTokens: number;
|
|
118
|
+
/** Cache-READ tokens (`cache_read_input_tokens`), billed at the cheap
|
|
119
|
+
* `cachedMicrocents` rate. */
|
|
120
|
+
cachedTokens: number;
|
|
121
|
+
/** Cache-WRITE tokens (`cache_creation_input_tokens`), billed at
|
|
122
|
+
* `cacheCreationMicrocents` (~1.25x the input rate). */
|
|
123
|
+
cacheCreationTokens: number;
|
|
124
|
+
/** The longest single prompt among the requests this row sums up. Omitted =
|
|
125
|
+
* `inputTokens`, which is exact for a one-request call and on the high side
|
|
126
|
+
* for an aggregate, so a caller that sums requests can only overcount by
|
|
127
|
+
* leaving it out. */
|
|
128
|
+
largestPromptTokens?: number;
|
|
129
|
+
imageCount: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface AiCallCost {
|
|
133
|
+
/** Microcents to store on the ai_calls row. */
|
|
134
|
+
costMicrocents: number;
|
|
135
|
+
/** True when the call did real work but no pricing row exists — the row
|
|
136
|
+
* will store 0 and every spend roll-up reading it is UNDERSTATED. */
|
|
137
|
+
unpriced: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Map a pricing row (or a lookup miss, `null`) onto a call's token/image
|
|
142
|
+
* counts. Three input lanes bill at three rates: fresh input at
|
|
143
|
+
* `inputMicrocents`, cache-READ at `cachedMicrocents` (else input rate), and
|
|
144
|
+
* cache-WRITE at `cacheCreationMicrocents` (else 1.25x the input rate, the
|
|
145
|
+
* Anthropic cache-write premium).
|
|
146
|
+
*
|
|
147
|
+
* Double-count decision: the Vercel AI SDK's flat `usage.inputTokens` is the
|
|
148
|
+
* GRAND total of all three input lanes — see `asLanguageModelUsage`
|
|
149
|
+
* (`ai/dist/index.js`: `inputTokens = usage.inputTokens.total`) fed by the
|
|
150
|
+
* Anthropic adapter (`@ai-sdk/anthropic`: `total = input(fresh) +
|
|
151
|
+
* cacheCreation + cacheRead`). So the fresh remainder billed at the full
|
|
152
|
+
* input rate is `inputTokens - cachedTokens - cacheCreationTokens`; failing
|
|
153
|
+
* to subtract cacheCreationTokens would bill cache writes twice (once at the
|
|
154
|
+
* input rate inside `billedInput`, once at the cache-write rate).
|
|
155
|
+
*
|
|
156
|
+
* Prompt-length pricing (#1477): a row with `longPromptThresholdTokens` bills
|
|
157
|
+
* every lane at its multiplier once the prompt is over the threshold. An
|
|
158
|
+
* `ai_calls` row of a chat turn sums all of the turn's requests, so the whole
|
|
159
|
+
* turn takes the higher card when ANY of its requests crossed the threshold.
|
|
160
|
+
* That can overcount a turn that started below it, by at most the multiplier.
|
|
161
|
+
* Pricing each request would need per-step rows; an overcount is the safe side
|
|
162
|
+
* of this trade because budget caps read this number.
|
|
163
|
+
*/
|
|
164
|
+
export function computeAiCallCostMicrocents(
|
|
165
|
+
pricing: PricingRow | null,
|
|
166
|
+
call: AiCallCostInput,
|
|
167
|
+
): AiCallCost {
|
|
168
|
+
const didWork =
|
|
169
|
+
call.operationType === "image" ? call.imageCount > 0 : call.inputTokens + call.outputTokens > 0;
|
|
170
|
+
if (pricing === null) {
|
|
171
|
+
return { costMicrocents: 0, unpriced: didWork };
|
|
172
|
+
}
|
|
173
|
+
if (call.operationType === "image") {
|
|
174
|
+
return { costMicrocents: pricing.inputMicrocents * call.imageCount, unpriced: false };
|
|
175
|
+
}
|
|
176
|
+
const tier = longPromptRateMultiplier(pricing, call.largestPromptTokens ?? call.inputTokens);
|
|
177
|
+
const inRate = pricing.inputMicrocents * tier;
|
|
178
|
+
const outRate = (pricing.outputMicrocents ?? 0) * tier;
|
|
179
|
+
const cacheReadRate = (pricing.cachedMicrocents ?? pricing.inputMicrocents) * tier;
|
|
180
|
+
const cacheCreationRate =
|
|
181
|
+
(pricing.cacheCreationMicrocents ?? pricing.inputMicrocents * 1.25) * tier;
|
|
182
|
+
const billedInput = Math.max(0, call.inputTokens - call.cachedTokens - call.cacheCreationTokens);
|
|
183
|
+
const costMicrocents = Math.round(
|
|
184
|
+
(billedInput * inRate) / 1000 +
|
|
185
|
+
(call.cachedTokens * cacheReadRate) / 1000 +
|
|
186
|
+
(call.cacheCreationTokens * cacheCreationRate) / 1000 +
|
|
187
|
+
(call.outputTokens * outRate) / 1000,
|
|
188
|
+
);
|
|
189
|
+
return { costMicrocents, unpriced: false };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** What a text request can cost at most, before it runs (#1653). */
|
|
193
|
+
export interface WorstCaseTextInput {
|
|
194
|
+
/** An upper bound of the request's prompt tokens (every input lane). */
|
|
195
|
+
promptTokens: number;
|
|
196
|
+
/** The request's output ceiling (`maxOutputTokens`), thinking included. */
|
|
197
|
+
maxOutputTokens: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The most a text request can cost: every prompt token at the dearest
|
|
202
|
+
* input lane (a cache WRITE, ~1.25x the input rate — a cold prompt may be
|
|
203
|
+
* written to the cache in full), every output token the ceiling allows,
|
|
204
|
+
* and the prompt-length card when the prompt bound is over its threshold.
|
|
205
|
+
* A reservation at this amount cannot be overrun by the call it covers.
|
|
206
|
+
* Null pricing → null: the caller decides whether an unpriced call may run.
|
|
207
|
+
*/
|
|
208
|
+
export function worstCaseTextMicrocents(
|
|
209
|
+
pricing: PricingRow | null,
|
|
210
|
+
req: WorstCaseTextInput,
|
|
211
|
+
): number | null {
|
|
212
|
+
if (pricing === null) return null;
|
|
213
|
+
const tier = longPromptRateMultiplier(pricing, req.promptTokens);
|
|
214
|
+
const inRate = Math.max(
|
|
215
|
+
pricing.inputMicrocents,
|
|
216
|
+
pricing.cacheCreationMicrocents ?? pricing.inputMicrocents * 1.25,
|
|
217
|
+
);
|
|
218
|
+
const outRate = pricing.outputMicrocents ?? 0;
|
|
219
|
+
return Math.ceil(
|
|
220
|
+
((req.promptTokens * inRate) / 1000 + (req.maxOutputTokens * outRate) / 1000) * tier,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
// The prompt bound of a request before it runs (#1653).
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
|
|
228
|
+
/** Tokens a provider adds to every request around the caller's content. */
|
|
229
|
+
export const PROVIDER_REQUEST_OVERHEAD_TOKENS = 2_000;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Tokens one image counts at most, whatever its size: providers scale an
|
|
233
|
+
* image down before they count it (about 1,600 tokens at most for Claude,
|
|
234
|
+
* fewer for the others), so its base64 bytes say nothing about its cost.
|
|
235
|
+
*/
|
|
236
|
+
export const IMAGE_TOKEN_BOUND = 5_000;
|
|
237
|
+
|
|
238
|
+
/** Media parts in any of the message shapes the AI SDK and Caelo use. */
|
|
239
|
+
function isMediaPart(o: Record<string, unknown>): boolean {
|
|
240
|
+
return (
|
|
241
|
+
o.type === "image" ||
|
|
242
|
+
o.type === "file" ||
|
|
243
|
+
o.type === "media" ||
|
|
244
|
+
o.type === "image-data" ||
|
|
245
|
+
typeof o.mediaType === "string" ||
|
|
246
|
+
typeof o.mimeType === "string"
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* An upper bound of the tokens a value sends: one token per UTF-8 byte of
|
|
252
|
+
* its text (a byte-level BPE token is at least one byte), {@link
|
|
253
|
+
* IMAGE_TOKEN_BOUND} per image or file part instead of its encoded bytes.
|
|
254
|
+
* Several times the real count for prose — the safe side for a
|
|
255
|
+
* reservation, which is settled to the real count after the call.
|
|
256
|
+
*/
|
|
257
|
+
export function tokenBoundOf(value: unknown): number {
|
|
258
|
+
// The UTF-8 length of the value's JSON text, with each media part
|
|
259
|
+
// counted at its token bound instead: what the provider receives is at
|
|
260
|
+
// most this many bytes of text plus the images.
|
|
261
|
+
if (typeof value === "function" || value === undefined) return 0;
|
|
262
|
+
if (typeof value === "string") return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
263
|
+
if (value === null || typeof value !== "object") return String(value).length;
|
|
264
|
+
if (Array.isArray(value)) {
|
|
265
|
+
let n = 2;
|
|
266
|
+
for (const v of value) n += tokenBoundOf(v) + 1;
|
|
267
|
+
return n;
|
|
268
|
+
}
|
|
269
|
+
const o = value as Record<string, unknown>;
|
|
270
|
+
if (isMediaPart(o)) {
|
|
271
|
+
// The part's own short fields (type, name) still travel; its data does not count as text.
|
|
272
|
+
let n = IMAGE_TOKEN_BOUND;
|
|
273
|
+
for (const [k, v] of Object.entries(o))
|
|
274
|
+
if (typeof v === "string" && v.length < 1_000) n += Buffer.byteLength(k + v, "utf8") + 6;
|
|
275
|
+
return n;
|
|
276
|
+
}
|
|
277
|
+
let n = 2;
|
|
278
|
+
for (const [k, v] of Object.entries(o))
|
|
279
|
+
n += Buffer.byteLength(JSON.stringify(k), "utf8") + tokenBoundOf(v) + 2;
|
|
280
|
+
return n;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** An upper bound of a request's prompt tokens: its parts plus the provider's wrapping. */
|
|
284
|
+
export function promptTokenBound(...parts: readonly unknown[]): number {
|
|
285
|
+
let n = PROVIDER_REQUEST_OVERHEAD_TOKENS;
|
|
286
|
+
for (const p of parts) n += tokenBoundOf(p);
|
|
287
|
+
return n;
|
|
288
|
+
}
|
package/src/cap-failures.ts
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* P16 hardening — track consecutive cap-lookup failures so a flaky DB
|
|
5
5
|
* query doesn't silently disable AI cost enforcement.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* #1653 — every paid AI call reserves its worst-case cost in the AI spend
|
|
8
|
+
* ledger before it reaches the provider (`ai_ledger.reserve`, plugin-host
|
|
9
|
+
* ai-ledger.ts): the chat-runner per request of a turn, a plugin's
|
|
10
|
+
* `ctx.ai`, the core helpers (moduleize, query_page_html, the completeness
|
|
11
|
+
* judge), images. A ledger that cannot be reached lets the call through
|
|
12
|
+
* (it is recorded after it ran, so a working chat or plugin does not break
|
|
13
|
+
* on a DB hiccup). That's the right default — but unbounded silent passes =
|
|
12
14
|
* "no enforcement at all under sustained DB pressure".
|
|
13
15
|
*
|
|
14
16
|
* The counter trips a per-key fail-closed mode after `LOOKUP_FAIL_THRESHOLD`
|