@ultimat3/cli 31.25.0 → 31.27.0
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/CLAUDE.md +44 -36
- package/README.md +5 -4
- package/package.json +29 -29
- package/src/app-mcp.ts +17 -3
- package/src/cmd-cache-spec.ts +5 -2
- package/src/cmd-db-recount.ts +7 -0
- package/src/cmd-db-spec.ts +2 -3
- package/src/cmd-db.ts +0 -2
- package/src/cmd-deploy-verify-sample.ts +93 -0
- package/src/cmd-deploy-verify.ts +2 -41
- package/src/cmd-dev-spec.ts +15 -1
- package/src/cmd-dev.ts +31 -4
- package/src/cmd-doctor.ts +4 -1
- package/src/cmd-exercise-spec.ts +7 -1
- package/src/cmd-exercise.ts +22 -10
- package/src/cmd-generate.ts +2 -0
- package/src/cmd-jobs-spec.ts +3 -6
- package/src/cmd-jobs.ts +1 -7
- package/src/cmd-logs-spec.ts +2 -1
- package/src/cmd-logs.ts +9 -28
- package/src/cmd-planned.ts +11 -45
- package/src/cmd-profile-frames.ts +99 -0
- package/src/cmd-profile-spec.ts +24 -0
- package/src/cmd-profile.ts +164 -0
- package/src/cmd-status-sample.ts +57 -0
- package/src/cmd-status-spec.ts +30 -0
- package/src/cmd-status.ts +108 -0
- package/src/cmd-token-spec.ts +5 -2
- package/src/cmd-token.ts +7 -3
- package/src/coverage-island.ts +121 -0
- package/src/coverage-lcov.ts +49 -5
- package/src/coverage-remap.ts +146 -0
- package/src/db-replay-engine-prepared.ts +66 -0
- package/src/db-replay-engine-template.ts +156 -0
- package/src/db-replay-engine.ts +4 -0
- package/src/db-replay-scratch-reap.ts +54 -0
- package/src/deploy-verify-flags.ts +9 -2
- package/src/deploy-verify-grade.ts +10 -3
- package/src/dev-boot.ts +14 -1
- package/src/dev-dashboard-guard.ts +57 -10
- package/src/dev-host.ts +46 -0
- package/src/dev-tls-cache.ts +103 -0
- package/src/dev-tls-der.ts +69 -0
- package/src/dev-tls.ts +120 -0
- package/src/dispatch.ts +6 -1
- package/src/doctor-browser.ts +60 -0
- package/src/error-codes-verify.ts +47 -0
- package/src/error-codes.ts +14 -23
- package/src/exercise-database.ts +40 -7
- package/src/exercise-push-device.ts +51 -0
- package/src/exercise-route-api.ts +74 -0
- package/src/exercise-routes.ts +14 -5
- package/src/exercise-services.ts +3 -1
- package/src/exercise-shard-flag.ts +47 -0
- package/src/fix-command.ts +2 -2
- package/src/generate-factories.ts +9 -11
- package/src/generate-feature-required.ts +9 -4
- package/src/generate-files.ts +20 -2
- package/src/generate-kinds.ts +5 -1
- package/src/guards.ts +21 -6
- package/src/island-bundle-options.ts +48 -0
- package/src/island-bundle.ts +18 -46
- package/src/island-link.ts +5 -0
- package/src/island-outputs.ts +5 -0
- package/src/mcp-errors-verify.ts +35 -0
- package/src/mcp-errors.ts +10 -19
- package/src/mcp-host-logs.ts +121 -0
- package/src/mcp-host.ts +12 -73
- package/src/messages-floor.ts +19 -0
- package/src/messages-status.ts +10 -0
- package/src/messages.ts +21 -0
- package/src/registry.ts +4 -0
- package/src/role-start-types.ts +7 -0
- package/src/role-start.ts +4 -0
- package/src/serve-boot.ts +7 -1
- package/src/serve-env-tls.ts +57 -0
- package/src/solid-loader.ts +27 -10
- package/src/templates/generate-export-rows.ts +136 -0
- package/src/templates/generate-import-rows.ts +186 -0
- package/src/templates/generate-rows-slice.ts +95 -0
- package/src/templates/github/ci.yml.ts +4 -0
- package/src/templates/scaffold-db-package.ts +3 -0
- package/src/templates/scaffold-docs.ts +8 -6
- package/src/templates/scaffold-repo.ts +2 -7
- package/src/templates/scaffold-site.ts +4 -1
- package/src/templates/scaffold-suites.ts +72 -0
- package/src/templates/scaffold-test-services.ts +35 -10
- package/src/templates/scaffold-verify-floor.ts +53 -31
- package/src/templates/shapes/api.ts +4 -0
- package/src/templates/slice-foundation.ts +3 -3
- package/src/unthrown-codes.ts +1 -1
- package/src/upgrade-gate.ts +6 -1
- package/src/upgrade-guards-baseline.ts +43 -0
- package/src/upgrade-guards.ts +37 -2
- package/src/upgrade-report.ts +3 -0
- package/src/verify-coverage-run.ts +42 -11
- package/src/verify-e2e.ts +115 -4
- package/src/verify-floor.ts +27 -0
- package/src/verify-guard-baseline.ts +109 -0
- package/src/verify-live.ts +72 -0
- package/src/verify-merge-skips.ts +51 -0
- package/src/verify-merge.ts +36 -2
- package/src/verify-run.ts +48 -7
- package/src/verify-services.ts +287 -0
- package/src/verify-skip-reason.ts +53 -0
- package/src/verify-strict.ts +108 -0
- package/src/verify-test-command.ts +129 -0
- package/src/verify-tests.ts +39 -126
- package/types/babel-modules.d.ts +2 -0
- package/wiki/Agents.md +2 -5
- package/wiki/CLI-Reference.md +142 -23
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Entities-And-Migrations.md +1 -1
- package/wiki/Interface-Rules.md +5 -0
- package/wiki/Jobs-And-Workflows.md +3 -3
- package/wiki/Known-Gaps.md +5 -1
- package/wiki/MCP-And-AI.md +103 -2
- package/wiki/Mail.md +52 -0
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Scraping.md +19 -4
- package/wiki/Troubleshooting.md +3 -3
- package/wiki/Tutorial-05-Deploy-Free.md +2 -2
- package/wiki/Upgrading.md +3 -0
package/wiki/MCP-And-AI.md
CHANGED
|
@@ -639,7 +639,8 @@ export const summarize = llm({
|
|
|
639
639
|
| Caching | semantic cache from [Caching and invalidation](Caching-And-Invalidation) |
|
|
640
640
|
| Provider prompt caching | the provider keeps a request's stable prefix; on by default for `agent()`, off for `llm()` → [Agents](Agents#provider-prompt-caching) |
|
|
641
641
|
| Tracing | one OTel span per call with model, tokens, cache hit, prompt version |
|
|
642
|
-
| Fallback | ordered provider list per model; the provider that answered is on the span as `gen_ai.provider.name`, never silent. A refusal names a more capable model for the declaration to adopt —
|
|
642
|
+
| Fallback | ordered provider list per model; the provider that answered is on the span as `gen_ai.provider.name`, never silent. Across models only through a declared `fallbackModels` chain → [Model fallback](#model-fallback-fallbackmodels). A refusal names a more capable model for the declaration to adopt — never an automatic swap |
|
|
643
|
+
| Provider parameters | `providerOptions: { openai: { top_p: 0.9 } }` — one bag per wire, keys screened → [Provider parameters](#provider-parameters-provideroptions) |
|
|
643
644
|
| Money | `Money = { minor, currency }` — never a float → [Money](Money) |
|
|
644
645
|
|
|
645
646
|
**A stream is the same action over a different transport, with one difference that is forced rather than chosen: there is no repair turn.** The non-streaming call retries once on a parse failure; a stream cannot, because the tokens are already on the reader's screen and a second answer is two answers to one question. So a stream yields **unvalidated** text increments plus one final `done` carrying the value that did satisfy `output`, and a schema disagreement is `X_LLM_STREAM_INVALID` naming the non-streaming call as the fix. A structured schema wants the non-streaming call.
|
|
@@ -664,6 +665,106 @@ and usage records are `JsonView`; a model's proposed edit against the original i
|
|
|
664
665
|
|
|
665
666
|
Long or multi-call chains are `job`s with steps, so a model call that fails on step 4 retries step 4 only. See [Jobs and workflows](Jobs-And-Workflows).
|
|
666
667
|
|
|
668
|
+
### Model fallback: `fallbackModels`
|
|
669
|
+
|
|
670
|
+
**A second model is asked only when the first fails with a declared class, and only because the
|
|
671
|
+
declaration named it** — on `llm()`, on `agent()` (every turn walks the chain; a run's own
|
|
672
|
+
`model()` pick is left out of it), or on a raw `GenerateRequest`. `As of 2026-11`.
|
|
673
|
+
|
|
674
|
+
```ts
|
|
675
|
+
import { definePrompt, llm, t } from '@ultimat3/ai';
|
|
676
|
+
import { allow } from '@ultimat3/policy';
|
|
677
|
+
|
|
678
|
+
const digestPrompt = definePrompt<{ postId: string }>({
|
|
679
|
+
id: 'digest',
|
|
680
|
+
version: '1.0.0',
|
|
681
|
+
template: 'Summarise post {{postId}} in one sentence.',
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
export const digest = llm({
|
|
685
|
+
model: 'claude-sonnet-5-5',
|
|
686
|
+
fallbackModels: ['gpt-5.6-terra'], // tried in order; each one registerModel-ed
|
|
687
|
+
providerOptions: { openai: { top_p: 0.9 } }, // read only by a chat-completions provider
|
|
688
|
+
input: t.object({ postId: t.uuid }),
|
|
689
|
+
output: t.object({ summary: t.string }),
|
|
690
|
+
prompt: digestPrompt,
|
|
691
|
+
vars: ({ input }) => ({ postId: input.postId }),
|
|
692
|
+
policy: allow(),
|
|
693
|
+
});
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
| Falls over (`MODEL_FALLBACK_ON`) | Read from |
|
|
697
|
+
|---|---|
|
|
698
|
+
| `rate_limited` | 429 |
|
|
699
|
+
| `overloaded` | 529 |
|
|
700
|
+
| `timeout` | 408, 504, `ETIMEDOUT` |
|
|
701
|
+
| `unavailable` | any other 5xx, a refused or dropped socket, every provider's breaker open |
|
|
702
|
+
|
|
703
|
+
Never on a 4xx, a refusal, a truncation, a budget refusal, an abort, or a model no provider lists:
|
|
704
|
+
each fails the same way on every model. The verdict is reached after the gateway's provider retries
|
|
705
|
+
for that model ran out, and only when **every** failure had a class.
|
|
706
|
+
|
|
707
|
+
| Rule | Detail |
|
|
708
|
+
|---|---|
|
|
709
|
+
| billed per attempt | each model reserves its own estimate and settles on its own; the run meter (`meteredRun`, `meta.billed`) counts a failed model as an `unsettled` attempt, never as free — also when the chain's last model fails outside the class and that error is thrown as it stands |
|
|
710
|
+
| priced per model | a fallback's answer is billed at its own model's rate, never folded into the primary's; `onCall` / `onTurn` name the model that answered |
|
|
711
|
+
| one trace | the caller's span is the one parent; each model is an `ai.model.attempt` child with `gen_ai.request.model`, `ultimate.llm.fallback.index` and, on failure, `ultimate.llm.fallback.reason`. A call with no chain opens none |
|
|
712
|
+
| visible | `GenerateResult.fallbacks` lists each failed model, its class and cause |
|
|
713
|
+
| streams | fall over only before the first chunk reaches the reader; after it, the failure is thrown as it stands |
|
|
714
|
+
| the chain | screened before any request: an unregistered id is `X_AI_MODEL_UNKNOWN`, a repeated one `X_AI_REQUEST_INVALID` |
|
|
715
|
+
| all fail | one `X_AI_PROVIDER_UNAVAILABLE` naming every model, `a → b` |
|
|
716
|
+
| `retry.timeBudgetMs` | one clock for the whole chain, checked before every call after the first — the next provider, the next model; a call that ran out of time does not fall over |
|
|
717
|
+
|
|
718
|
+
### Provider parameters: `providerOptions`
|
|
719
|
+
|
|
720
|
+
**A wire parameter the framework does not model passes through one typed bag per wire, screened
|
|
721
|
+
key by key before any request.** The keys are the wire's own names. `As of 2026-11`.
|
|
722
|
+
|
|
723
|
+
| Wire | Keys (`PROVIDER_OPTION_KEYS`) |
|
|
724
|
+
|---|---|
|
|
725
|
+
| `anthropic` | `metadata` (`{ user_id }`), `service_tier` (`'auto'`, `'standard_only'`) |
|
|
726
|
+
| `openai` | `frequency_penalty`, `presence_penalty` (-2 to 2), `top_p` (0 to 1), `user`, `parallel_tool_calls`, `service_tier` (`'auto'`, `'default'`, `'flex'`, `'priority'`) |
|
|
727
|
+
|
|
728
|
+
An unknown wire, an unknown key, a wrong type or an out-of-range number is `X_AI_REQUEST_INVALID`:
|
|
729
|
+
at declaration on `llm()` and `agent()`, in the gateway for a raw `generate`/`stream`, and in each body builder for
|
|
730
|
+
a direct provider call. Each provider sends its own wire's bag only, so one request may carry both
|
|
731
|
+
when its `fallbackModels` cross formats. The bag is part of the response cache key. A key the
|
|
732
|
+
framework sets itself (`temperature`, `seed`, `max_tokens`, `tools`, …) is not in the table.
|
|
733
|
+
|
|
734
|
+
## Prompt caching on your own endpoint
|
|
735
|
+
|
|
736
|
+
**An endpoint the built-in table does not name gets no cache mark until its provider declares
|
|
737
|
+
one.** A self-hosted or company gateway speaking the OpenAI format says how it is told on its own
|
|
738
|
+
provider, never in a process-wide registry: the provider already is the wire and the host. `As of
|
|
739
|
+
2026-11`.
|
|
740
|
+
|
|
741
|
+
```ts
|
|
742
|
+
import { openAiProvider } from '@ultimat3/ai';
|
|
743
|
+
|
|
744
|
+
export const internalProvider = openAiProvider({
|
|
745
|
+
baseUrl: 'https://llm.internal.example/v1',
|
|
746
|
+
models: ['family/large'],
|
|
747
|
+
promptCache: { rules: [{ model: 'family/', marks: 'parts', session: 'x-session-id' }] },
|
|
748
|
+
});
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
| Step | What decides the marks for one request |
|
|
752
|
+
|---|---|
|
|
753
|
+
| 1. the provider's rows | `promptCache.rules`, first match by model-id prefix (`''` is every model) |
|
|
754
|
+
| 2. the built-in table | `PROMPT_CACHE_RULES`: any Anthropic Messages endpoint, `openrouter.ai`, `api.openai.com` → [Agents](Agents#provider-prompt-caching) |
|
|
755
|
+
| 3. nothing | no mark and no session field: a field a self-hosted server has never heard of can be a 400 |
|
|
756
|
+
|
|
757
|
+
| Row field | `openAiProvider()` | `anthropicProvider()` |
|
|
758
|
+
|---|---|---|
|
|
759
|
+
| `marks` | `'parts'` (stable system part + the tail message's last part) or `'none'` | `'blocks'` or `'none'` |
|
|
760
|
+
| `session` | `'x-session-id'` header, `'prompt_cache_key'` body field, or `'none'` | `'none'` only |
|
|
761
|
+
|
|
762
|
+
A row the wire cannot speak — `blocks` on chat-completions, `parts` or a session on the Messages
|
|
763
|
+
wire, a row that is not `{ model, marks, session }` — is `X_AI_REQUEST_INVALID` when the provider
|
|
764
|
+
is built, never a 400 on every hinted call. The rows only say *how*; *whether* a call asks is still
|
|
765
|
+
`promptCache` on the declaration (`agent()` `'auto'`, `llm()` `'off'`), and the budget reserves the
|
|
766
|
+
cache-write rate exactly where a mark is sent.
|
|
767
|
+
|
|
667
768
|
## Agents, hives and agent jobs → [Agents](Agents)
|
|
668
769
|
|
|
669
770
|
`llm()` is one model call. A **tool-using loop** is `agent()`, and it is the same kind of thing — an action factory, not a ninth primitive. Everything the loop needs is a factory over a primitive already in the vocabulary:
|
|
@@ -782,7 +883,7 @@ $ x verify --json
|
|
|
782
883
|
| `X_MCP_ARGS_INVALID` | not raised on the wire since 22.10 — invalid arguments answer `X_INPUT_INVALID` as a tool result; `McpArgsInvalidError` stays exported | — |
|
|
783
884
|
| `X_MCP_SURFACE_OVER_BUDGET` | `assertMcpSurfaceBudget` measured `tools/list`, `list_resources` or `instructions` over the budget declared for them | shorten what it names, group tools behind `surface: 'meta'`, or raise the budget with the measured size and the reason in the same diff |
|
|
784
885
|
| `X_MCP_IDEMPOTENCY_KEY_SHADOWED` | an `idempotent: true` action's input declares `idempotencyKey`, the tool argument reserved for the retry key — refused at boot | rename the action's input field |
|
|
785
|
-
| `X_MCP_SCOPE_DENIED` | the connection's token does not carry the tool's scope | reconnect with a token whose scopes include the one `cause` names — the app's `resolveToken(token)` is what returns them — or drop that scope from `defineAppMcp({ scopes })`. Scopes are fixed for the life of a connection, so a grant takes effect on the next one.
|
|
886
|
+
| `X_MCP_SCOPE_DENIED` | the connection's token does not carry the tool's scope | reconnect with a token whose scopes include the one `cause` names — the app's `resolveToken(token)` is what returns them — or drop that scope from `defineAppMcp({ scopes })`. Scopes are fixed for the life of a connection, so a grant takes effect on the next one. A token's scopes are never widened, so there is no grant verb: issue one with the wider set, `x token create --scopes <a>,<b> --json`, then `x token revoke <old-id>` |
|
|
786
887
|
| `X_MCP_SCOPE_UNKNOWN` | `defineAppMcp`'s `scopes:` names a tool the server does not project | spell the name as one of the tools the server actually projects, or drop it from that `scopes` entry |
|
|
787
888
|
| `X_MCP_SCOPE_CONFLICT` | two `scopes:` entries claim the same tool | keep the tool under the single scope a token must hold for it, and remove the other entry |
|
|
788
889
|
| `X_MCP_QUERY_REJECTED` | `db.query` was not given one read-only statement | send exactly one **read-only** `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`TABLE`/`VALUES` — a data-modifying CTE is not a read |
|
package/wiki/Mail.md
CHANGED
|
@@ -107,6 +107,58 @@ an hour later is not refused by the signature window. Declaring it is its regist
|
|
|
107
107
|
mounts its route. `api/` holds no route file.
|
|
108
108
|
`SES_CONFIGURATION_SET` names the SES configuration set sent on every message (`ConfigurationSetName`) — the set whose event destination publishes to that SNS topic.
|
|
109
109
|
|
|
110
|
+
## Inbound mail: `@ultimat3/mail/inbound`
|
|
111
|
+
|
|
112
|
+
`As of 2026-11-15`. Rule: received email is `inboundMail()`, a factory over
|
|
113
|
+
[`webhookReceiver()`](Jobs-And-Workflows#inbound-webhooks) — never a ninth primitive, never a route
|
|
114
|
+
file. Declared in `defineApi({ jobs })`, the boot mounts its `POST path`.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { inboundMail, resendInbound } from '@ultimat3/mail/inbound';
|
|
118
|
+
|
|
119
|
+
export const supportInbox = inboundMail({
|
|
120
|
+
name: 'support.inbound',
|
|
121
|
+
path: '/hooks/mail/inbound',
|
|
122
|
+
// A thunk, built on the first delivery: every role imports this, only the web role receives.
|
|
123
|
+
provider: () =>
|
|
124
|
+
resendInbound({
|
|
125
|
+
secret: Bun.env['RESEND_INBOUND_SECRET'] ?? '',
|
|
126
|
+
apiKey: Bun.env['RESEND_API_KEY'] ?? '',
|
|
127
|
+
}),
|
|
128
|
+
tenant: 'none',
|
|
129
|
+
handle: async ({ message }) => ({ subject: message.subject }),
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
| Step | Where | What |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| verify | the door | the provider's signature over the exact bytes — before any parse. SNS via `sesEventReceiver`'s verifier, Svix via `resendEventReceiver`'s. A forgery is `X_MAIL_EVENT_UNVERIFIED` (401) and queues nothing |
|
|
136
|
+
| queue | the door | the verified envelope (`recipients`, and SES's `content` or Resend's email id), `.sensitive()` |
|
|
137
|
+
| fetch | the job | SES: the row's `content`. Resend: `GET /emails/receiving/:id` with the API key, then the signed `raw.download_url` without it |
|
|
138
|
+
| parse | the job | in-tree, bounded MIME: multipart trees, base64 / quoted-printable, RFC 2047 words, RFC 2231 filenames, address groups |
|
|
139
|
+
| store | the job | each attachment through storage's `validateUpload` (size, allowlist, sniff) and `put`, at a key derived from the message id |
|
|
140
|
+
| handle | the job | your function, with one `InboundMessage`, at least once per `eventId` |
|
|
141
|
+
|
|
142
|
+
| Bound | Default | Refusal |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `limits.maxBytes` | 10 MiB | `X_MAIL_INBOUND_TOO_LARGE` (`meta.limit`) — refused whole, never truncated |
|
|
145
|
+
| `limits.maxParts` · `maxDepth` | 100 · 8 | the same |
|
|
146
|
+
| `limits.maxAttachments` · `maxHeaderBytes` | 20 · 64 KiB | the same |
|
|
147
|
+
| unreadable MIME | — | `X_MAIL_INBOUND_MALFORMED` (`meta.problem`), terminal |
|
|
148
|
+
|
|
149
|
+
**Sender-controlled, unsanitised:** `html`, every `filename`, every `contentId`, `subject`, the
|
|
150
|
+
address names. Never render `html` on the app's origin (a sandboxed frame, or text); never use a
|
|
151
|
+
`filename` as a path. `recipients` comes from the provider's signed payload, never a header: SES's
|
|
152
|
+
is the SMTP envelope; Resend's is its `to`, not documented as the envelope — route only on your
|
|
153
|
+
own receiving domain. An SES virus verdict of `FAIL` stores no attachment (`refusal: 'verdict'`)
|
|
154
|
+
unless `attachments: { keepOnVirusFail: true }`.
|
|
155
|
+
|
|
156
|
+
An attachment the upload policy refuses (HTML, SVG, a type the sniff contradicts) arrives
|
|
157
|
+
`stored: false` with storage's code — or `X_MAIL_INBOUND_MALFORMED` when its transfer encoding does
|
|
158
|
+
not decode; the message is still delivered (only an undecodable text or HTML BODY refuses it). `attachments: { disk, policy,
|
|
159
|
+
prefix }` overrides each part; `attachments: false` stores nothing. SES's spam/virus/SPF/DKIM/DMARC
|
|
160
|
+
verdicts ride on `message.verdicts` — what to do about a `FAIL` is the app's decision.
|
|
161
|
+
|
|
110
162
|
## Previews
|
|
111
163
|
|
|
112
164
|
`As of 2026-11-06`. `defineMail({ preview })` declares the data a template is checked by: a value,
|
package/wiki/PWA-And-Offline.md
CHANGED
|
@@ -258,7 +258,7 @@ The client is not broken and the server is not broken; they disagree about which
|
|
|
258
258
|
| 3 | **N-deploy asset retention** | `assets: { retain: { disk, builds } }` in `app.config.ts`: every web pod publishes its hashed files to that shared disk before it reports ready, and answers an earlier build's `/islands`, `/styles` and assets from it on a miss. Unset (the default), a pod serves only what it built. A **count of deploys, with no time component**. Proven in a browser `As of 2026-11`: a tab opened on build 0 survives six deploys that each change an island, and its first click boots build 0's chunk with a 200 and no 404 ([`six-deploys.e2e.test.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/six-deploys.e2e.test.ts)); without `retain` the same click is a 404. `retentionPlan` was removed in 30.0.0: it kept nothing on its own, because no boot called it |
|
|
259
259
|
| 4 | **`AppUpdateAvailable` signal, not a 404** | a Solid signal flips when the server reports a newer build. The app renders its own "Update available — reload" affordance. **No forced navigation, no lost form state, no dinosaur** |
|
|
260
260
|
| 5 | **Forced reload after a grace period** | **Not a capability of this package.** Deleted in 9.0.0 — `updateSignal`/`updatePolicy` computed a deadline nothing acted on, and `pwa` (tier 4) sits above the two runtimes that hold both build ids. The service worker posts `{ type: 'AppUpdateAvailable', to }`; act on it yourself, or read `useConnection().updateAvailable` |
|
|
261
|
-
| 6 | **Skew is observable** | the `/_x` live panel reports the build-ID distribution of connected clients, so "how many users are three deploys behind" has an answer. `x status --json`
|
|
261
|
+
| 6 | **Skew is observable** | the `/_x` live panel reports the build-ID distribution of connected clients, so "how many users are three deploys behind" has an answer. Outside dev, `x status --url <origin> --json` reports the builds the serving processes answer with and every live worker's; the connected-clients distribution itself has no aggregate outside the sync node ([Known gaps](Known-Gaps#not-built-yet)) |
|
|
262
262
|
| 7 | **Build ID scopes the SW cache** | preview/branch builds get their own cache namespace and SW scope, so a preview can never poison prod caches |
|
|
263
263
|
|
|
264
264
|
Server behaviour on a stale build ID:
|
package/wiki/Scraping.md
CHANGED
|
@@ -89,13 +89,13 @@ One interface, three drivers, no driver type in it.
|
|
|
89
89
|
| `frame(nameOrSelector)` | re-resolves on every call; nothing hands out a stale handle |
|
|
90
90
|
| `screenshot` | `{ fullPage }` or `{ clip }`, never both |
|
|
91
91
|
| `pdf` | the print layout: `format` (`a4`, `letter`, …) or `widthMm` + `heightMm`, `marginMm`, `printBackground`, `preferCssPageSize`, `headerHtml` / `footerHtml`. Two sizes, half a size or a size beside `preferCssPageSize` is `X_SCRAPE_PDF_OPTIONS_INVALID` (422), before any driver |
|
|
92
|
-
| `download({ timeout })` |
|
|
92
|
+
| `download({ timeout })` | the file the **last** click, key or navigation produced — the newest since it, older ones cleared — or `X_SCRAPE_DOWNLOAD_TIMEOUT`. A file from an earlier trigger, or one that landed after its own `download()` timed out, never answers a later one. Off the wire on the browser driver, never a download directory, capped at `maxDownloadBytes` — see [The port is complete](#the-port-is-complete) |
|
|
93
93
|
| `cookies` / `session` | the handoff to the HTTP leg, as a value you can inspect |
|
|
94
94
|
| `query(selector)` | every match as a snapshot — tag, attributes, text, **and `visible`**. The one definition of "visible" in the framework; nothing else may compute it |
|
|
95
95
|
| `offline(enabled)` | the browser's own offline mode. **Not** `@ultimat3/testing`'s sealed network, which patches `fetch` in the *test process* and a browser's requests never traverse — a test built on that would pass against a fully online app |
|
|
96
96
|
| `focus(selector, { timeout })` | waits for `actionable`, then moves focus — the setup for a `press()` |
|
|
97
97
|
| `press(chord)` | `'Meta+K'`, `'Escape'`, `'Shift+Tab'` on whatever holds focus. Modifiers are `Meta`, `Control`, `Alt`, `Shift` in the browser's own spelling; `'Ctrl+K'` is `X_SCRAPE_KEY_INVALID` on **every** driver, offline included — the parse is the one thing an offline driver can be wrong about, so it runs there too, then stops |
|
|
98
|
-
| `accessibility(selector, { max })` | what a screen reader is told about each match —
|
|
98
|
+
| `accessibility(selector, { max })` | what a screen reader is told about each match — role and name after ARIA and label association, at most `max` (default 25) nodes, from **this handle's document**: on a `frame(…)` handle, the frame's. The browser driver answers what Chrome computed; the offline drivers answer the HTML-AAM mapping of the markup, never `role=` read alone: a `<div onclick>` maps to no role *on every driver*, and that *is* the finding |
|
|
99
99
|
| `console()` / `network()` | bounded rings, 200 entries each |
|
|
100
100
|
| `pageErrors()` / `pageErrorsDropped()` | uncaught exceptions, a **third** ring — not console lines |
|
|
101
101
|
| `activity()` | tells the wedge watchdog the run is working on a channel this page cannot see — your own CDP session, a long warm-up. Every verb above already reports; this touches the idle clock only and counts no usage. On every driver |
|
|
@@ -158,10 +158,25 @@ Response bodies are counted **as they arrive**, capped at `DEFAULT_HTTP_MAX_BYTE
|
|
|
158
158
|
| `fixtureBrowser(dir)` | committed page recordings | none |
|
|
159
159
|
| `fakeBrowser(pages)` | inline pages, for a unit test | none |
|
|
160
160
|
|
|
161
|
-
**The launcher is passed in, never imported.** `CdpLauncherLike` is two methods — `launch` and `connect` — so `puppeteer`, `puppeteer-core` or anything with the same shape satisfies it, and this package declares no browser dependency at all. A launcher with no `launch` is `X_SCRAPE_REMOTE_REQUIRED`, not a crash. The browser it hands back must expose `target().createCDPSession()` — puppeteer's does — because `allowHosts` is enforced at the browser too, on every tab a scraped page opens;
|
|
161
|
+
**The launcher is passed in, never imported.** `CdpLauncherLike` is two methods — `launch` and `connect` — so `puppeteer`, `puppeteer-core` or anything with the same shape satisfies it, and this package declares no browser dependency at all. A launcher with no `launch` is `X_SCRAPE_REMOTE_REQUIRED`, not a crash. The browser it hands back must expose `target().createCDPSession()` — puppeteer's does — because `allowHosts` is enforced at the browser too, on every tab a scraped page opens; its pages and the browser must carry every verb the page forwards to, checked when the session opens (`X_SCRAPE_LAUNCHER_INCOMPLETE`, see [The port is complete](#the-port-is-complete)).
|
|
162
162
|
|
|
163
163
|
`driver-parity.test.ts` runs one suite against all three and pins the single honest divergence: the offline drivers have no layout engine, so `ElementSnapshot.box` and `hitTarget` are absent rather than faked.
|
|
164
164
|
|
|
165
|
+
## The port is complete
|
|
166
|
+
|
|
167
|
+
**Every page verb answers on every driver; none is `X_NOT_IMPLEMENTED`** (`As of 2026-11-15`). Thirteen refusals came out of `cdp-target.ts` and `html-target.ts`: a port method one driver cannot honour is a second path, so each one was implemented there — or, for a launcher missing a method, moved to a check when the session opens. `port-complete.test.ts` calls every `ScrapeTarget` member on the offline and the browser driver, on the page and on a frame, keyed by the port's own members — a member added without a row does not compile.
|
|
168
|
+
|
|
169
|
+
| Verb | Browser driver | Offline drivers |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| `download()` | the file's bytes off the wire: the browser-level `Fetch` pause at the Response stage streams the body (`Fetch.takeResponseBodyAsStream` + `IO.read`) under a byte cap — `localBrowser({ maxDownloadBytes })`, default `DEFAULT_MAX_DOWNLOAD_BYTES` (25 MiB) — and fulfils the response with the bytes read; `Browser.downloadWillBegin` names it, and Chrome's own copy is denied. Over the cap nothing is buffered: a declared `Content-Length` over it is left to Chrome (`download()` times out), an undeclared attachment is abandoned at the cap and failed, an undeclared non-attachment is never read. Works on `remoteBrowser()`, whose disk is not yours. A script-made `blob:` download is read through the page, its size checked first | the recorded `downloads` entry the LAST click armed — a click that downloads nothing, or a key, disarms it |
|
|
172
|
+
| `offline(enabled)` | the browser's own network condition | every navigation — `goto`, a link's click — fails `X_SCRAPE_BROWSER_UNREACHABLE` while set, the code a browser's failed navigation carries. No JS runs, so an assertion on what the app's offline code renders fails rather than passing |
|
|
173
|
+
| `accessibility()` | what the browser computed — on a frame handle, scoped to the frame's document, found through the page's own session (`Page.getFrameTree` → `DOM.getFrameOwner` → its `contentDocument`). A cross-site frame under site isolation renders in another process the page session cannot read: `X_SCRAPE_FRAME_OUT_OF_PROCESS`, fixed by `localBrowser({ launcher, options: { args: ['--disable-site-isolation-trials'] } })` (measured on Chrome 157) | the HTML-AAM mapping of the markup — the frame's own markup on a frame handle: explicit `role`, else the implicit one; the name from `aria-labelledby`, `aria-label`, `<label for>`, `alt`, content, `title`, `placeholder`. CSS and script are not seen. A `<div onclick>` answers no role and no name |
|
|
174
|
+
| `press` / `focus` / `colorScheme` / `prepare` / `cookies` / `session` | `CdpPageLike` and `CdpBrowserLike` keep `keyboard`, `focus`, `createCDPSession`, `setOfflineMode`, `emulateMediaFeatures`, `evaluateOnNewDocument`, `cookies`, `setCookie` optional in the type, so a launcher written against 31.x still compiles — and checks every one **when the session opens**: a missing one is `X_SCRAPE_LAUNCHER_INCOMPLETE` naming each, and the launched browser is closed. Never a refusal on the first run that reached the verb. `CompleteLauncher` is the same shape with each required, which the built-in launchers are declared as | unchanged |
|
|
175
|
+
|
|
176
|
+
**A frame handle reads its frame.** `page.frame(…).accessibility()` answers from the frame's document on every driver; it was `X_NOT_IMPLEMENTED` on all three until 2026-11-15.
|
|
177
|
+
|
|
178
|
+
**What a browser dependency beside `scraping` still buys.** A direct `puppeteer` import for a download, an offline toggle, a keyboard chord, an accessibility read, an init script, a theme, cookies or a frame's form is now a page verb, on every driver, with `allowHosts`, robots, pacing, redaction and the wedge watchdog applied. What the port does not cover, and a direct import still does: request/response bodies of subresources, a download Chrome makes from an HTML response with no `Content-Disposition`, file uploads, and multiple tabs.
|
|
179
|
+
|
|
165
180
|
## The silent-green alarm
|
|
166
181
|
|
|
167
182
|
A scraper that returns zero rows because the site changed its markup is the failure that does not look like one.
|
|
@@ -440,7 +455,7 @@ Every owned code is split by whether the same request can succeed unchanged. `x
|
|
|
440
455
|
| `X_SCRAPE_HTTP_FAILED` | 408, 409, 425, 429, any 5xx, a deploy — transient far more often than not. **Which 4xx are permanent is `@ultimat3/core`'s `isRetryableStatus`, not this package's**, `As of 2026-08-23`: a private copy here called 408 and 425 terminal while the rest of the framework called them retryable, and a terminal classification dead-letters the run on the attempt that failed rather than spending its declared `attempts` |
|
|
441
456
|
| `X_SCRAPE_BLOCKED` | retryable **and it burns the session first**: retrying a block on the same flagged cookies re-trips it every time |
|
|
442
457
|
|
|
443
|
-
Everything else is terminal, including `X_SCRAPE_SELECTOR_MISSING` (the markup changed), `X_SCRAPE_OUTPUT_INVALID` (the rows are the wrong shape), `X_SCRAPE_YIELD_COLLAPSED`, `X_SCRAPE_SECRET_EXPOSED`, `X_SCRAPE_KEY_INVALID` (the chord is the caller's own literal), `X_SCRAPE_PROMPT_UNANSWERED`, `X_SCRAPE_BROWSER_MISSING` (there is no browser binary to launch), `X_SCRAPE_EGRESS_UNSUPPORTED` (the exit is the run's input and the driver is the deploy's constant)
|
|
458
|
+
Everything else is terminal, including `X_SCRAPE_SELECTOR_MISSING` (the markup changed), `X_SCRAPE_OUTPUT_INVALID` (the rows are the wrong shape), `X_SCRAPE_YIELD_COLLAPSED`, `X_SCRAPE_SECRET_EXPOSED`, `X_SCRAPE_KEY_INVALID` (the chord is the caller's own literal), `X_SCRAPE_PROMPT_UNANSWERED`, `X_SCRAPE_BROWSER_MISSING` (there is no browser binary to launch), `X_SCRAPE_EGRESS_UNSUPPORTED` (the exit is the run's input and the driver is the deploy's constant) `X_SCRAPE_LAUNCH_ARGS_INVALID` (the args are the deploy's literal), `X_SCRAPE_LAUNCHER_INCOMPLETE` (the launcher is the deploy's library) and `X_SCRAPE_FRAME_OUT_OF_PROCESS` (site isolation is the browser's configuration).
|
|
444
459
|
|
|
445
460
|
## Testing offline
|
|
446
461
|
|
package/wiki/Troubleshooting.md
CHANGED
|
@@ -14,8 +14,8 @@ Run these first, in this order. All support `--json`.
|
|
|
14
14
|
| `x docs "<symptom or question>" --json` | the framework's own docs and this wiki, offline from the install — the first lookup for a symptom with no code |
|
|
15
15
|
| `x doctor --json` | environment, versions, drift, ports, PWA prerequisites — each with a fix |
|
|
16
16
|
| `x dev` then `/_x` | the live panels: routes, timeline, jobs, db, mail, cache, policy, manifest |
|
|
17
|
-
| `x logs tail --json` | the last lines of `.x/dev.log`, or one role's `.x/logs/<role>.log
|
|
18
|
-
| `x status --json` |
|
|
17
|
+
| `x logs tail --json` | the last lines of `.x/dev.log`, or one role's with `--role` (its `.x/logs/<role>.log`, else its lines of the dev log) — the file the `logs.tail` MCP tool reads (since 31.17.0) |
|
|
18
|
+
| `x status --json` | the build each live worker runs, and what each `--url` origin's `/readyz` answers (`As of 2026-11-15`, [CLI reference](CLI-Reference#x-status)) |
|
|
19
19
|
|
|
20
20
|
The `--json` form is the same content as the terminal form. Paste the JSON into a bug report; do not paraphrase the terminal.
|
|
21
21
|
|
|
@@ -143,7 +143,7 @@ Boundaries run on pre-push and inside `x verify`. They are build errors, never l
|
|
|
143
143
|
| `X_MCP_TOOL_UNKNOWN`, or a tool absent from `tools/list` | the tool is hidden from this caller, or the name is stale — role-hidden and absent answer identically, on purpose | visibility is fail-closed: check the caller against the tool's `visibleTo` (a role allowlist or a predicate over the caller). Otherwise `tools/list` for the catalog this caller may use, and `x manifest` if the committed manifest is stale |
|
|
144
144
|
| `X_MCP_TOOL_UNDECLARED`, and MCP refuses to boot | an action or query written out in `defineAppMcp`'s `actions:`/`queries:` never declared `mcp: { expose: true }` — a boot-time configuration error, not a hidden tool | add `mcp: { expose: true, description: '<what it does>' }` beside the primitive's policy, or drop it from the list and let `include: 'exposed'` project what opted in |
|
|
145
145
|
| `X_MCP_SCOPE_UNKNOWN`, and MCP refuses to boot | `defineAppMcp`'s `scopes:` map names a tool by a name the server does not project — a typo, or the primitive was renamed or dropped from `actions:`/`queries:`/`tools:` | spell the name as one of the tools the server actually projects, or drop it from that `scopes` entry |
|
|
146
|
-
| `X_MCP_SCOPE_DENIED` | the connection's token does not carry the tool's scope — scope is a property of the token, not of the actor's permissions | reconnect with a token whose scopes include the one `cause` names — the app's `resolveToken(token)` returns them — or drop that scope from `defineAppMcp({ scopes })`. Scopes are fixed for the life of a connection, so a grant takes effect on the next one. A wider grant is a new token — `x token create --scopes <a>,<b> --json`, then `x token revoke <old-id>`:
|
|
146
|
+
| `X_MCP_SCOPE_DENIED` | the connection's token does not carry the tool's scope — scope is a property of the token, not of the actor's permissions | reconnect with a token whose scopes include the one `cause` names — the app's `resolveToken(token)` returns them — or drop that scope from `defineAppMcp({ scopes })`. Scopes are fixed for the life of a connection, so a grant takes effect on the next one. A wider grant is a new token — `x token create --scopes <a>,<b> --json`, then `x token revoke <old-id>`: a token's scopes are never widened, so there is no grant verb |
|
|
147
147
|
| `X_FORBIDDEN` from a `tools/call` | the tool was invoked and its policy refused this input — the same denial the HTTP route returns for the same call | grant the human the permission — an agent can never exceed the human it acts for |
|
|
148
148
|
| Dev MCP server not reachable | `x dev` not running, or you pointed at prod | default socket is `mcp.devSocket` (`ws://localhost:9229`). The dev server is **never** bound in `ROLE=web` |
|
|
149
149
|
| `X_MCP_QUERY_REJECTED` | `db.query` was not given exactly one read-only statement | send a single **read-only** `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`TABLE`/`VALUES` — a data-modifying CTE is not a read. MCP has no arbitrary-write path: change data by calling an action exposed with `mcp: { expose: true }`, change schema with `db.migrate` on a branch database |
|
|
@@ -219,8 +219,8 @@ Scaling the two serving roles is the next rung, and it is not an edit to this fi
|
|
|
219
219
|
| Expected | Reality `As of 2026-08` |
|
|
220
220
|
|---|---|
|
|
221
221
|
| `/metrics` on the **app** port | `X_ROUTE_NOT_FOUND`, and that is deliberate. Every role — `web` included — serves `/metrics` on `METRICS_PORT`, default **9090**, because the Helm ingress routes `/` with no path exclusion and metrics on 3000 would be public. Scrape `http://<host>:9090/metrics`, not `:3000/metrics` |
|
|
222
|
-
| `x logs tail` |
|
|
223
|
-
| `x status` |
|
|
222
|
+
| `x logs tail` | shipped in 31.17.0: the end of the dev log `x dev` writes — a deployed role's log is its container's stdout |
|
|
223
|
+
| `x status` | shipped `As of 2026-11-15`: `x status --url https://<your-app> --json` reports the build each live worker runs and what the app's `/readyz` answers |
|
|
224
224
|
| OTLP export, on by default | on when **configured**: the production boot (`apps/web/server.ts`, every `ROLE`) wires traces, metrics and logs (OTLP/HTTP JSON) from `OTEL_EXPORTER_OTLP_ENDPOINT` set to a collector's HTTP receiver (`:4318` — `:4317` is gRPC and is refused). Unset, nothing leaves the process; there is no code to write |
|
|
225
225
|
| a Helm chart in your app | **`x new` writes one** `As of 2026-11-03` — `docker/helm`, 10 files — so `x deploy --method helm` works here. On 3.0.0 and below it writes none: copy [`docker/helm`](https://github.com/developerz-ai/ultimate/tree/main/docker/helm) from the framework repo, or stay on `--method compose` |
|
|
226
226
|
|
package/wiki/Upgrading.md
CHANGED
|
@@ -291,6 +291,9 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
291
291
|
| `x verify --changed` gives a route's `page.tsx` its own rule, `page` (**31.22.0**): typecheck, lint, boundaries, filesize, i18n and that route's tests, where it ran every step but `drift` | nothing; `x verify` with no flag is still the verdict |
|
|
292
292
|
| `x doctor` lists `error-declared` as differing from the shipped template after the **31.24.0** hop: its `fix:` is now one pasteable call per class — `export const PostNotFound = defineError({ code: 'X_POST_NOT_FOUND', title, status, cause, fix, problemMeta: [...] })`, the binding and the code read off the finding — because `defineError` now takes `problemMeta` and `publicCause: true`, which replace a hand-written class's `registerErrorStatus` / `registerProblemMeta` rows. The rule is the same; nothing new is reported | optional: `x g guard error-declared --force` — it rewrites `guards/error-declared.ts` **and** its `.test.ts`, so review the diff and keep any rule you edited on purpose. Then `x verify` |
|
|
293
293
|
| `repo-unbounded` fails the gate in a **new** app from **31.24.0** (`x new` and `x g guard` write it with no `severity` line); an existing app's report-only copy still reads as current in `x doctor`. A bare `.all()` also logs `X_ENTITY_ALL_TRUNCATED` with its call site in dev and test | optional: `x g guard repo-unbounded --force` to make your copy fail the gate on a bare `.all()` — add `.limit(n)` or page with `.page()` at every site it then lists. Then `x verify` |
|
|
294
|
+
| `@ultimat3/entity` `ColumnMeta.countedIn` (and `ReferenceOptions.countedIn`) widened in **31.24.0** from `() => AnyColumn` to `CountedIn` — that function, or `{ to, where? }` so a filtered counter carries its `where`. Passing it to `references()` is unchanged; code that READS it off a column's meta and calls it no longer compiles. Shipped in a minor; recorded `As of 2026-11-15` | where you read it: `const to = typeof meta.countedIn === 'function' ? meta.countedIn : meta.countedIn?.to;` |
|
|
295
|
+
| `@ultimat3/policy` `PolicyScope` and `policyScope()` return `readonly ScopeNode[]` from **31.24.0** — a condition, `{ or }`, `{ and }` or `{ via }` — where they returned `readonly ScopeCondition[]`. Writing a scope that returns conditions is unchanged; code that reads a scope's nodes and their fields no longer compiles. Shipped in a minor; recorded `As of 2026-11-15` | narrow each node before reading it: `if ('column' in node) { node.column; node.op; node.value }`, and treat `or` / `and` / `via` nodes as groups |
|
|
296
|
+
| `@ultimat3/core` `mapBounded` became overloads in **31.24.0** (`settle: 'first' \| 'all'`), so a value typed `MapBoundedOptions` matched none. **31.27.0** accepts it again; its result is `R[] \| PromiseSettledResult<R>[]`, since such a value may carry `settle: 'all'` | pass the options as a literal (`{ concurrency: 4 }` keeps `R[]`), or add `settle: 'first'` |
|
|
294
297
|
|
|
295
298
|
## 29.x → 30.0.0, entry by entry
|
|
296
299
|
|