The first end-to-end test: a Project Think agent, on the real model,
writes code that runs in a dynamic worker and drives a mower; the test
counts the cells cut, and saves the turn to itest-output/.
Installs @cloudflare/think, @cloudflare/codemode, agents, ai,
workers-ai-provider, zod. The model-test worker now has a main entry,
the Neighbor DO, and a LOADER binding.
Red: src/worker.ts doesn't exist yet.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
codeModeMessages turns what I say plus `about` into a prompt: a
neighbor persona, rules for the reply (one async arrow function over
`env`), and the lent things' types. Things are remote and calls on one
are delivered in order, so a lamp example shows pipelining: await only
for a value, or on a batch's last call. With only the rule, the model
awaited every call; with the example, it pipelines.
aboutMower gives the Mower type with Promise returns. The model test
checks the code calls only Mower methods, pushes, and awaits less often
than it calls; it saves the code to itest-output/ via a reporter, since
the test runs in workerd, which can't write files. Model tests get 60s.
Green: both model tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gpt-oss-120b reasons before it answers, and Workers AI's default
max_tokens (256) ran out mid-thought: finish_reason "length", content
null. Ask for 4096, and when there's no reply text, say which choice
and message keys came back instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code mode (2c): the harness turns what I say plus `about` into a prompt;
the model replies with `(env) => ...` code. Checked textually for now,
since workerd won't eval it: the code pushes `env.mower` and calls only
methods in `about`. It also prints the code, to see what the model writes.
Red: src/code-mode.ts doesn't exist yet.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
makeWorkersAiModel narrows the AI binding to one model's chat
completion: the harness gets `complete`, not `run` on any model at
any cost. gpt-oss-120b replies in the OpenAI shape (checked with a
one-off probe), so the text is choices[0].message.content; anything
else throws, naming the keys it got.
Green: the model counts 3 rs in strawberry.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A first integration test of the model call: Workers AI through the AI
binding, behind the same `complete(messages)` interface as the sim's
fake model. Opt-in (`pnpm test:model`) since it needs `wrangler login`
and costs money.
Red: src/model.ts doesn't exist yet.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The chat and load arrows drew `things: { mower }` whether I lent the
raw mower or the governed one. Name objects by the reply arrow that
introduced them, so the diagram reads `things: { mower: governed }`
and lending the raw mower would fail the trace comparison.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The spec is a sequence diagram of the a2030.md story: I lend a governed
mower; the neighbor's harness shows the model only `about`, runs its
code as a tenant, and the governor stops the tipsy tenant at a 2-cell
fence. The test runs the actors through a causal tracer and compares
the trace with the diagram, then checks the yard and what the model saw.
The tracer comes from agoric-sdk PR #12895, extended to name
participants made mid-sequence (governor, tenant) and to draw thrown
errors as replies.
Red: src/ doesn't exist yet (ERR_MODULE_NOT_FOUND for src/fence.ts).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>