feat(create-agent-app): --chat variant — the one-day multimodal chat app, CI-enforced (#188 wave 3)#199
Merged
Merged
Conversation
…modal chat app Scaffolds the examples/chat-app.md assembly as a runnable Cloudflare Workers product: createAppAuth over drizzle/D1, createChatTables + createChatStore, createChatTurnRoutes with the config-driven sandbox producer lane, createUploadRoute (inline vs sandbox path split), the /interactions answer endpoints, a D1 migration the generated app's own e2e test executes for real, and a dependency-free dev chat page. The generated app ships tests/chat-turn.e2e.test.ts: fake sandbox producer -> POST turn -> NDJSON stream consumed -> user+assistant rows persisted with typed parts + usage receipt -> buffered replay. The repo-side gate (tests/create-agent-app-chat.test.ts) scaffolds into tmp, links the real dist offline, typechecks the generated app, and runs its suite — CI reds if the template ever drifts from the framework (#188 wave 3).
tangletools
approved these changes
Jul 15, 2026
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 80c3cb1f
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-07-15T20:02:55Z
drewstone
added a commit
that referenced
this pull request
Jul 17, 2026
…cument upload's sole consumer (#202) Audit simplification pass. No behavior change, no export added or removed — honest labeling of the single-consumer surface the over-engineering audit flagged. - turnLock/contextGate/beforeTurn/onRawEvent: @experimental + single-consumer (gtm, #200) JSDoc. They stay FLAT top-level options (not grouped under a `hooks` object): that regroup would break gtm's shipped createChatTurnRoutes call for no mechanism gain, and this package's exports are additive-only. lifecycle/heartbeat stay stable (generically useful). - createUploadRoute: kept, NOT deleted. Its sole consumer is the `--chat` scaffold (the shipped reference multimodal path, PR #199). Documented that the four fleet apps (gtm/tax/legal/insurance) keep their own durable-vault upload routes (KV / encrypted R2) — a different persistence model — and shouldn't route through it. - Docs (AGENTS.md/CLAUDE.md module map, ARCHITECTURE.md) reflect both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
create-agent-app --chatscaffolds theexamples/chat-app.mdassembly as a runnable Cloudflare Workers product — the finish line of #188: scaffold → deployed multimodal chat app in one day, and CI proves the claim stays true.The generated app (
create-agent-app/template-chat/)agent.config.ts+prompts/system.md(Text module)src/chat.tscreateAppAuth(drizzle/D1, memoryAdapter comment) +createChatStore+createChatTurnRoutes(turn/replay/interactions) +createUploadRoute+ thread CRUD handlerssrc/sandbox.tsSandboxRuntimeConfig→ensureWorkspaceSandbox+streamSandboxPrompt+createSandboxChatProducer; upload sink (box.fs); sidecar connection for asks. No mock fallback — missing creds fail loudsrc/db/schema.ts+migrations/0001_init.sqlcreateChatTables()+ the/streamturn-buffer DDL;wrangler.tomlcarries the D1 binding +migrations_dir(R2 commented off)src/worker.ts+public/index.html/web-reactAGENTS.md/CLAUDE.md/CUSTOMIZE.md/README.mdThe CI enforcement (two layers)
template-chat/tests/chat-turn.e2e.test.ts): executes the REALmigrations/0001_init.sqlinto better-sqlite3, signs up through the real better-auth drizzle adapter, uploads a file (inlinedata:part), POSTs a turn whose only fake is the sandbox event feed (canonical sidecar events through the realcreateSandboxChatProducerbridge), consumes the NDJSON stream (text deltas, reasoning, tool_call/tool_result, usage), asserts user+assistant rows persisted with typed parts + the usage receipt, then replays the buffered turn. Plus: fail-closed 401 before any row, and a turn-buffer-DDL-matches-TURN_EVENTS_MIGRATION_SQLdrift gate.tests/create-agent-app-chat.test.ts) scaffolds--chatinto tmp, installs agent-app as a copy of the published payload (the fix(create-agent-app): repair template deps/types, harden scaffold CI, scope npm name (#188) #195 hardening — undeclared deps cannot leak through the repo's node_modules), links only what the generatedpackage.jsondeclares, typechecks the generated app, checks engine pins against agent-app's peer floors, and runs the generated app's own vitest suite. If any shell factory drifts, CI reds here first.Repo-side changes
create-agent-app/index.mjs:--chatflag + help text (default template unchanged; base suite still green).create-agent-app/package.json:template-chatadded tofiles, description covers both variants.@cloudflare/workers-typesdevDep (offline typecheck of the generated worker), knip/vitest excludes for the new template tree.Verification
pnpm typecheckclean,pnpm test2484/2484 green (includes both scaffold gates), heap-bumpedpnpm buildgreen.tsc --noEmitclean, own suite 4/4 green in ~1s.🤖 Generated with Claude Code