@zerotal/arch 1.14.0 → 1.14.1

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/docs/ai.md CHANGED
@@ -287,6 +287,48 @@ after a crash before another worker may take over". If the lock is ever lost the
287
287
  loop's signal aborts, because at that point somebody else may be doing the same work.
288
288
  See [Locking](/docs/lock) for the mechanism.
289
289
 
290
+ ## Prompt caching
291
+
292
+ A long, stable prefix is worth caching: a cached read costs a tenth of an ordinary input
293
+ token. A _write_ costs more than one, so caching something that changes every request is
294
+ strictly more expensive than not caching it.
295
+
296
+ **The system prompt is cached for you** when `cacheSystem` is on (the default) and it is
297
+ long enough to be worth a breakpoint.
298
+
299
+ **Anything else you mark yourself.** Put `cache: true` on the last message of the stable
300
+ prefix — a retrieved document, a fixed few-shot block — and everything up to and including
301
+ it is cached:
302
+
303
+ ```ts fragment
304
+ await Ai.generate({
305
+ messages: [
306
+ { role: "user", content: policyDocument, cache: true },
307
+ { role: "user", content: question },
308
+ ],
309
+ });
310
+ ```
311
+
312
+ The marker goes on the **last** message of the prefix, not on every message in it: a
313
+ breakpoint caches everything before it, so marking each one spends four breakpoints to
314
+ describe one boundary. Anthropic allows four per request and the framework refuses a fifth
315
+ by name rather than letting the provider return a 400 about a field you did not write.
316
+
317
+ Before 1.14.1 only the system prompt could be cached, so a long document in the message
318
+ history could not be — which is the case caching is most worth having for.
319
+
320
+ ### What it costs
321
+
322
+ `estimateCost` prices a cache read at 0.1× input and a **5-minute** write at 1.25×. A
323
+ **1-hour** write costs 2×, and the two are tracked separately in `AiUsage`
324
+ (`cacheWrite1hTokens`, counted inside `cacheWriteTokens`) because one number cannot be
325
+ priced two ways.
326
+
327
+ Zerotal never requests a 1-hour cache, so that figure is `0` unless you reach past the
328
+ driver with `providerOptions`. It used to be priced at 1.25× regardless, which
329
+ underestimated by 37.5% — in the unsafe direction for a spend ceiling, since a limit that
330
+ under-counts lets spend through rather than blocking it.
331
+
290
332
  ## Refusals
291
333
 
292
334
  A provider's safety classifiers can decline a request. That arrives as a **successful
package/docs/changelog.md CHANGED
@@ -27,6 +27,72 @@ the section for every version you cross and apply its migration notes, not only
27
27
  majors. [Releases and versioning](/docs/support-policy#releases-and-versioning) explains
28
28
  when that carve-out ends.
29
29
 
30
+ ## 1.14.1 — 2026-09-01
31
+
32
+ Clearing the deferred list. Three of the four are fixed; the other two were sized and moved
33
+ to 2.0 with the reasoning recorded, because deciding is also addressing.
34
+
35
+ ### Added
36
+
37
+ - **Prompt-cache breakpoints on messages.** Caching reached exactly one place — the system
38
+ prompt — so a long stable document in the message history could not be cached, which is
39
+ the case caching is most worth having for.
40
+
41
+ ```ts
42
+ await Ai.generate({
43
+ messages: [
44
+ { role: "user", content: policyDocument, cache: true },
45
+ { role: "user", content: question },
46
+ ],
47
+ });
48
+ ```
49
+
50
+ The marker goes on the **last** message of the prefix, because a breakpoint caches
51
+ everything before it — marking each message spends four breakpoints describing one
52
+ boundary. Anthropic allows four, and a fifth is refused by name rather than surfacing as
53
+ a provider 400 about a field you never wrote.
54
+
55
+ ### Fixed
56
+
57
+ - **A 1-hour cache write is priced at 2×, not 1.25×.** Every write was multiplied by the
58
+ 5-minute rate, underestimating a 1-hour write by 37.5% — in the unsafe direction for a
59
+ ceiling, since a limit that under-counts lets spend through rather than blocking it.
60
+ `AiUsage.cacheWrite1hTokens` carries the split, read from the `cache_creation` breakdown
61
+ Anthropic returns when a 1-hour cache was used. Optional on the type, because a custom
62
+ driver constructs `AiUsage` and making it required would break every one for an
63
+ accounting detail their provider probably does not report.
64
+
65
+ - **A command that declares `needsApp = false` no longer boots the application.**
66
+ `zt version`, `key:generate`, every `make:*` scaffolder and the gate commands paid for
67
+ providers, a database connection and a schedule registry they never touch — and could not
68
+ run when booting was the thing that was broken. A CLI you cannot reach when the app is
69
+ down is missing exactly when it is wanted.
70
+
71
+ Config is still bound, through the new `Application.bindConfig()`. "Does not need the
72
+ app" and "does not need config" are different claims, and only the first is true of a
73
+ scaffolder writing to a configured path.
74
+
75
+ It also makes `zt version --json` pipeable, which previously needed the `--version` form
76
+ to dodge the boot log on stdout.
77
+
78
+ ### Decided, not done
79
+
80
+ Two entries on the 2.0 ledger were filed as alias retirements and are mass renames:
81
+
82
+ - **`BaseModel` → `Model`** is **617 references across `api-surface.md` files and 354 in
83
+ non-test source.** `BaseModel` is the class's declared name, so TypeScript prints it into
84
+ every signature mentioning a model — retiring it means renaming the class and
85
+ regenerating every snapshot, which the breaking-change gate reads as hundreds of removals.
86
+ The "trivial" codemod in the ledger is the app-side rewrite, which is genuinely trivial
87
+ and already written; the framework side was never sized.
88
+ - **Prefixing the 269 `@internal` exports with `_`** is the same shape, minus the classes
89
+ that [cannot be renamed at all](#1131--2026-08-31).
90
+
91
+ Both move to 2.0 on the ledger's own rule — a break worth taking once, wanting one
92
+ migration and one `zt upgrade` run rather than hundreds of app-visible type positions
93
+ churned so there is one name instead of two. They should cross together, so an app pays for
94
+ one rename pass rather than two.
95
+
30
96
  ## 1.14.0 — 2026-09-01
31
97
 
32
98
  Rendering and the SSR endpoint become separate decisions. Small in practice — most apps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerotal/arch",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "license": "MIT",
5
5
  "maturity": "stable",
6
6
  "private": false,
@@ -35,11 +35,11 @@
35
35
  "typecheck": "tsc --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@zerotal/core": "1.14.0"
38
+ "@zerotal/core": "1.14.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "typescript": "^5.8.0",
42
- "@zerotal/orm": "1.14.0"
42
+ "@zerotal/orm": "1.14.1"
43
43
  },
44
44
  "description": "The Zerotal agent surface — an MCP server that hands coding agents the framework's machine-readable truth: exact API signatures, live routes and schema, version-matched docs, and `zt doctor`.",
45
45
  "keywords": [