Appendix A — Browser AI Field Guide: Setup, APIs, States, Diagnostics and Configuration
This appendix consolidates the contracts, states, and procedures distributed through the argument into one working reference. Prose explains; this section is for the keyboard.
Publication snapshot: September 2026. Browser flags, origin trials, API availability, and experimental configuration change. Flag values and external documentation details below reproduce the tested builds of this edition. Anything the book’s own laboratories did not observe is marked as such.
A.1 Development setup
| Surface | Setting / location | Value / action | Purpose | Stability |
|---|---|---|---|---|
| Chrome flags | chrome://flags/#optimization-guide-on-device-model |
Enabled (lab profile) | On-device model support for local development | Experimental, recheck per build |
| Chrome flags | chrome://flags/#prompt-api-for-gemini-nano |
Enabled where applicable | Foundation-model API access for local testing | Experimental, recheck per build |
| WebMCP | chrome://flags/#enable-webmcp-testing |
Enabled | Local WebMCP development without relying on the origin trial | Experimental, recheck per build |
| Extensions | chrome://extensions |
Developer mode, load unpacked | Load the Browser AI Observatory | Durable workflow |
| Diagnostics | chrome://on-device-internals |
Open model status | Inspect on-device model state and errors | Browser diagnostic surface |
| JavaScript | LanguageModel.availability(options) in DevTools |
Run with intended options | Operational preflight before creation | API contract |
| Observatory | AI Observatory panel, capability inspection | Run inspection | Capture the full lifecycle instead of guessing | Book tooling |
Flag values follow the laboratory run-book convention of this edition, not a permanent browser contract.
A.2 Availability and lifecycle states
One hierarchy, observed in the book’s laboratories:
| Layer | State | Meaning | What to do |
|---|---|---|---|
| Interface | not exposed | Global such as LanguageModel absent |
Check browser, channel, context, configuration |
| Interface | exposed | JavaScript interface exists | Continue to operational preflight |
| Capability | unavailable |
Requested configuration cannot currently be created | Explain, change route, or fall back |
| Capability | downloadable |
Required assets can be acquired | Require visible user action |
| Capability | downloading |
Acquisition underway | Show progress and wait |
| Capability | available |
Compatible instance can be created | Call create() |
| Session | creating | Browser is preparing the instance | Measure creation separately |
| Session | ready | Resource exists | Permit operation |
| Session | running | Request active | Permit cancellation |
| Session | destroyed | Explicit lifecycle end | Do not reuse |
| Request | completed | Runtime returned successfully | Still evaluate output |
| Request | aborted | Intentionally stopped | Do not count as model failure |
| Request | failed | Runtime operation failed | Classify the failure |
| Feature | accepted | Application validator accepted the output | Use the result |
| Feature | rejected | Model completed but the feature contract failed | Repair, retry, or abstain |
available is not a ready session, and operational completion is not behavioral acceptance.
A.3 Built-in AI API matrix
Globals, operations, and streaming support as implemented in the book’s adapter registry:
| Capability | Global | Create | Main operation | Streaming | Output |
|---|---|---|---|---|---|
| Prompt | LanguageModel |
LanguageModel.create() |
prompt() |
promptStreaming() |
Text, optionally constrained |
| Summarization | Summarizer |
Summarizer.create() |
summarize() |
summarizeStreaming() |
Summary text |
| Writing | Writer |
Writer.create() |
write() |
writeStreaming() |
New text |
| Rewriting | Rewriter |
Rewriter.create() |
rewrite() |
rewriteStreaming() |
Transformed text |
| Proofreading | Proofreader |
Proofreader.create() |
proofread() |
— | Corrected text with correction evidence |
| Detection | LanguageDetector |
LanguageDetector.create() |
detect() |
— | Ranked language candidates |
| Translation | Translator |
Translator.create() |
translate() |
translateStreaming() |
Translated text |
Session verbs observed in code: create, prompt, clone, destroy. The extension worker in this edition executes prompt; other operations return an explicit unsupported marker rather than failing silently.
A.4 Prompt API configuration quick reference
| Key | Where | Purpose | Important note |
|---|---|---|---|
expectedInputs |
create() and matching availability check |
Declares input modalities and languages | Must agree with preflight options |
expectedOutputs |
create() and matching availability check |
Declares expected output | Treat as capability contract |
samplingMode |
Enrolled web experiments | Semantic sampling policy | Not available on ordinary pages by default |
topK |
Extension compatibility surface | Numerical sampling control | Legacy extension surface; also a named compat alternative |
temperature |
Extension compatibility surface | Sampling variation | Legacy extension surface; also a named compat alternative |
monitor |
create() |
Observe acquisition progress | Progress events do not prove fresh bytes transferred |
signal |
creation and request operations | Cancellation | Preserve abort separately from failure |
responseConstraint |
prompt operation in laboratory surfaces | Constrain output with a schema | Laboratory surface; structure still requires validation |
A.5 Sampling modes
Per current Chrome Prompt API documentation (external, September 2026 — not lab-observed except as noted):
samplingMode |
Intent |
|---|---|
most-predictable |
Maximum predictability |
predictable |
Strongly predictable |
slightly-predictable |
Mildly predictable |
balanced |
Balance of predictability and variation (typical default) |
slightly-creative |
Mildly varied |
creative |
More varied |
most-creative |
Maximum variability |
Book laboratory default:
most-predictable. Reason: controlled experimental comparison and compatibility with the runtime observed during the book’s experiments, including the recorded speculative-decoding rejection that named it alongsidetopK: 1andtemperature: 0. Not a universal recommendation: creative or writing features may legitimately choose another supported profile.
A.6 Session lifecycle
Exposure, creation, ready, usage, clone, destroy, failure — see the table in Chapter 9, Section 6. Application rules: measure creation separately from inference, snapshot usage and quota, branch experiments with clone() rather than reprompting, end with explicit destroy(), and record why destruction occurred.
A.7 Observatory event dictionary
Every trace in this book validates against one closed vocabulary. Canonical lifecycle events:
| Event | Meaning |
|---|---|
capability.inspect.started |
Capability inspection began |
capability.inspect.finished |
Exposure and availability observed |
capability.inspect.failed |
The inspection itself failed |
model.download.progress |
Browser emitted acquisition progress |
session.create.started |
Creation attempt began |
session.create.finished |
Session available to the application |
session.create.failed |
Creation failed |
session.snapshot |
Usage, quota, and resource state observed |
session.cloned |
Branch created from an existing session |
session.destroyed |
Resource explicitly ended |
prompt.started |
Model request began |
prompt.chunk |
Streaming output observed |
prompt.finished |
Completed, failed, or aborted |
fixture.evaluated |
Machine-checkable evaluation performed |
feature.validation.finished |
Application-level acceptance or rejection |
Coordination, authority, policy, and context events:
| Event | Meaning |
|---|---|
coordinator.job.received |
Job accepted by the coordinator |
coordinator.job.queued |
Job awaiting a worker |
coordinator.worker.selected |
Idle worker matched capabilities |
coordinator.lease.issued |
Work leased, never duplicated |
coordinator.job.started |
Execution began (authority consumed here for bound jobs) |
coordinator.job.completed |
Result captured |
coordinator.job.failed |
Error captured |
authority.effect.normalized |
Exact effect canonicalized |
authority.grant.bound |
Single-use grant issued with digest |
authority.grant.consumed |
Grant consumed once |
authority.grant.expired |
Grant lapsed unused |
policy.compile.finished |
Portable policy compiled or rejected |
policy.decision.finished |
Decision with rule and reversibility recorded |
policy.run.finished |
Policy evaluation complete, external effects counted |
context.manifest.loaded |
Site context validated |
context.unit.extracted |
Bounded unit admitted with provenance |
context.unit.excluded |
Omission recorded with reason |
structured.candidate.received |
Proposal entered admission |
structured.validation.finished |
Gate outcomes recorded |
A.8 Capture and privacy modes
Metrics-only capture is the default: sizes and outcomes are recorded without retaining prompts or page text. Content capture is explicit and visible. Private units are excluded by default and cannot cross an external provider boundary; exclusions carry reasons rather than failing silently.
A.9 Structured-output validation gates
Parse, schema, domain, policy, authority, then bounded repair — see the table in Chapter 16, Section 11. A model may propose a structured action; only deterministic policy and appropriate human authority may admit it for execution.
A.10 WebMCP quick reference
The live surface is document.modelContext.registerTool(definition, { signal }), withdrawn via AbortController. Registration requires the origin trial or the testing flag, a secure top-level context, and an exposed global; the book’s probe records available or absent rather than assuming. Observed in the tested profile: WebMCP absent — the capstone never depends on it being present.
A.11 Authority states
A grant binds one normalized effect — origin, tool, arguments, policy version — under a SHA-256 digest, with a TTL and single use. Lifecycle: bound, consumed exactly once at the coordinator START boundary, or expired. Replay is denied before execution; mutation is rejected on digest mismatch. Policy requests authority; it never manufactures it.
A.12 Diagnostic decision table
| Symptom | First check | Next check | Likely layer |
|---|---|---|---|
LanguageModel undefined |
browser, channel, context | flags and configuration | exposure |
availability() returns unavailable |
exact options passed | hardware, storage, language support | capability |
downloadable |
visible user action | acquisition monitor | model acquisition |
downloading never completes |
chrome://on-device-internals |
restart, storage pressure | acquisition |
available but create() fails |
creation options | sampling and profile compatibility | session configuration |
| Session succeeds, no answer | prompt trace | abort and error events | request |
| Prompt completes, result wrong | fixture and evaluator | trace with captured evidence | behavior |
| Worked yesterday, unavailable today | model and browser state | storage, updates, build | browser-managed lifecycle |
| WebMCP global absent | origin trial and testing flag | browser build | WebMCP exposure |
| Visible tool, wrong tool selected | selection fixture | descriptions, schemas, results | agent behavior |
A.13 Lens modes
See the comparison table in Chapter 24, Section 2. One line each: Understand interprets, Explore retrieves bounded evidence, Govern applies user policy reversibly, Act proposes and executes through admission, policy, authority, and coordinator boundaries.
A.14 What to record in every experiment
Selection and inputs, provider and data route, evidence with provenance, policy version and decision, authority state for effects, worker and execution lineage, the validated trace — enough that a stranger can replay the run and reach the same verdict about what happened.
A.15 Laminated card
UNDERSTAND interpret EXPLORE retrieve bounded evidence
GOVERN policy, reversible ACT propose, never self-authorize
MODEL CAN: perceive, classify, generate, rank, propose
MODEL CANNOT: grant authority, change policy, bypass admission,
consume a grant twice, invent provenance, turn uncertainty
into certainty
AVAILABILITY: absent < exposed < downloadable < available
SESSION: create, run, clone, destroy — measure each
GRANT: exact effect, once, expiring — consumed at START
TRACE: every claim validates or it did not happen