nativeapptemplate-agent 0.2.4 → 0.3.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/AGENTS.md +6 -4
- package/README.md +40 -10
- package/dist/agents/judge.d.ts.map +1 -1
- package/dist/agents/judge.js +3 -2
- package/dist/agents/judge.js.map +1 -1
- package/dist/agents/planner.d.ts +93 -0
- package/dist/agents/planner.d.ts.map +1 -1
- package/dist/agents/planner.js +110 -80
- package/dist/agents/planner.js.map +1 -1
- package/dist/agents/repair.d.ts +2 -0
- package/dist/agents/repair.d.ts.map +1 -1
- package/dist/agents/repair.js +25 -16
- package/dist/agents/repair.js.map +1 -1
- package/dist/agents/types.d.ts +1 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/workers/android.d.ts +2 -0
- package/dist/agents/workers/android.d.ts.map +1 -1
- package/dist/agents/workers/android.js +10 -6
- package/dist/agents/workers/android.js.map +1 -1
- package/dist/agents/workers/copy.d.ts +3 -0
- package/dist/agents/workers/copy.d.ts.map +1 -1
- package/dist/agents/workers/copy.js +46 -0
- package/dist/agents/workers/copy.js.map +1 -1
- package/dist/agents/workers/ios.d.ts +2 -0
- package/dist/agents/workers/ios.d.ts.map +1 -1
- package/dist/agents/workers/ios.js +22 -8
- package/dist/agents/workers/ios.js.map +1 -1
- package/dist/agents/workers/rails.d.ts +4 -1
- package/dist/agents/workers/rails.d.ts.map +1 -1
- package/dist/agents/workers/rails.js +18 -7
- package/dist/agents/workers/rails.js.map +1 -1
- package/dist/dispatch.d.ts +4 -0
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +23 -3
- package/dist/dispatch.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/dist/japanese-nouns.d.ts +5 -0
- package/dist/japanese-nouns.d.ts.map +1 -0
- package/dist/japanese-nouns.js +18 -0
- package/dist/japanese-nouns.js.map +1 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +7 -2
- package/dist/mcp.js.map +1 -1
- package/dist/models.d.ts +11 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +27 -0
- package/dist/models.js.map +1 -0
- package/dist/rename-overrides.d.ts +12 -0
- package/dist/rename-overrides.d.ts.map +1 -1
- package/dist/rename-overrides.js +49 -1
- package/dist/rename-overrides.js.map +1 -1
- package/dist/report/render.js +1 -1
- package/dist/report/render.js.map +1 -1
- package/dist/reserved-words.d.ts +13 -0
- package/dist/reserved-words.d.ts.map +1 -0
- package/dist/reserved-words.js +72 -0
- package/dist/reserved-words.js.map +1 -0
- package/dist/slug.js +1 -1
- package/dist/slug.js.map +1 -1
- package/dist/structured-output.d.ts +6 -0
- package/dist/structured-output.d.ts.map +1 -0
- package/dist/structured-output.js +32 -0
- package/dist/structured-output.js.map +1 -0
- package/dist/validation/layer1.d.ts.map +1 -1
- package/dist/validation/layer1.js +13 -1
- package/dist/validation/layer1.js.map +1 -1
- package/dist/validation/layer3.d.ts +21 -0
- package/dist/validation/layer3.d.ts.map +1 -1
- package/dist/validation/layer3.js +65 -51
- package/dist/validation/layer3.js.map +1 -1
- package/dist/validation/stage2-judge.d.ts.map +1 -1
- package/dist/validation/stage2-judge.js +2 -1
- package/dist/validation/stage2-judge.js.map +1 -1
- package/dist/validation/visual-judge.d.ts +1 -0
- package/dist/validation/visual-judge.d.ts.map +1 -1
- package/dist/validation/visual-judge.js +8 -2
- package/dist/validation/visual-judge.js.map +1 -1
- package/package.json +3 -3
- package/scripts/ruby/rename.rb +30 -5
package/AGENTS.md
CHANGED
|
@@ -10,9 +10,11 @@ Project-wide instructions for AI coding agents (Claude Code, Codex, etc.). Keep
|
|
|
10
10
|
|
|
11
11
|
## Model
|
|
12
12
|
|
|
13
|
-
- Use `claude-opus-
|
|
14
|
-
- Requires Claude Agent SDK `>= 0.
|
|
15
|
-
-
|
|
13
|
+
- Use `claude-opus-5-5` for all agent invocations. Model ids and per-role effort live in `src/models.ts` — a model bump is a one-line change there.
|
|
14
|
+
- Requires Claude Agent SDK `>= 0.3.286` and `@anthropic-ai/sdk >= 0.131.0`.
|
|
15
|
+
- Opus 5.5 always thinks: do not send `thinking` (`disabled` and `budget_tokens` are 400s). Set `output_config.effort` explicitly — the default is `medium`.
|
|
16
|
+
- Forced `tool_choice` (`any` / `tool`) is a 400: get JSON back with structured outputs (`output_config.format`) instead. No `temperature` / `top_p`, no assistant prefill.
|
|
17
|
+
- Check `stop_reason` (`refusal`, `max_tokens`) before reading content. Messages API calls opt into server-side refusal fallbacks (`fallbacks: "default"`, beta `server-side-fallback-2026-07-01`).
|
|
16
18
|
|
|
17
19
|
## Stack
|
|
18
20
|
|
|
@@ -96,7 +98,7 @@ Three clean operations on the substrate (details in `docs/SPEC.md` section 4):
|
|
|
96
98
|
|
|
97
99
|
1. **Structural** — ripgrep for leftover domain tokens + OpenAPI contract parity (Rails ↔ iOS ↔ Android).
|
|
98
100
|
2. **Runtime** — Rails boots, iOS builds & launches, Android builds & launches (Stage 1); UI-driven CRUD scenario via mobile-mcp (Stage 2).
|
|
99
|
-
3. **Semantic** — Opus
|
|
101
|
+
3. **Semantic** — Opus 5.5 as judge (text + vision) scoring against a structured rubric. Three runs per screenshot, take the median.
|
|
100
102
|
|
|
101
103
|
## Guardrails
|
|
102
104
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Coherent across all three, in under an hour.
|
|
|
17
17
|
npx nativeapptemplate-agent "a walk-in clinic queue for small veterinary practices" --project-name="VetClinic"
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
> **Status: 0.
|
|
20
|
+
> **Status: 0.3.1 stable.** First built during [Built with Opus 4.7: a Claude Code Hackathon](https://cerebralvalley.ai/e/built-with-4-7-hackathon) (April 21–27, 2026); shipped to npm post-hackathon. Verified end-to-end on the three demo specs below from a fresh `/tmp/` cwd — the full 3-spec × 2-edition × 2-platform matrix is green at `NATIVEAPPTEMPLATE_VISUAL=2` (see the [matrix](#demo)). Stage 2 (scripted-CRUD walk-through via `mobile-mcp` against a live Rails server) and paid-edition parity validation landed post-launch. Active development continues — see the [roadmap](./ROADMAP.md) for what's next.
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -101,7 +101,7 @@ Three demo specs, both adapt and replace paths, all four validation layers green
|
|
|
101
101
|
| `"a restaurant waitlist for casual dining"` | `Shop → Restaurant`, `Shopkeeper → Host` | adapt | Layer 1 3/3 · Layer 2 3/3 · Layer 3 2/2 · Reviewer PASS |
|
|
102
102
|
| `"a personal task tracker with due dates"` | `ItemTag → Todo` (replaces queue entry entirely) | replace | Layer 1 3/3 · Layer 2 3/3 · Layer 3 2/2 · Reviewer PASS |
|
|
103
103
|
|
|
104
|
-
Layer 2 ran in build mode — real `xcodebuild build` and `./gradlew assembleDebug`, full app builds installed on iPhone 17 Pro simulator and Android emulator. Layer 3 captured the home-screen via `xcrun simctl io booted screenshot` / `adb exec-out screencap` and judged against the rubric using Opus
|
|
104
|
+
Layer 2 ran in build mode — real `xcodebuild build` and `./gradlew assembleDebug`, full app builds installed on iPhone 17 Pro simulator and Android emulator. Layer 3 captured the home-screen via `xcrun simctl io booted screenshot` / `adb exec-out screencap` and judged against the rubric using Opus 5.5 vision (median of 3 samples per criterion). With `NATIVEAPPTEMPLATE_VISUAL=2`, Layer 2 additionally drives a scripted-CRUD walk-through via `mobile-mcp` against a live Rails server — Welcome → Sign Up → email-confirm via `bin/rails runner` → Sign In → drill into the auto-seeded sample — and Layer 3 then judges the post-walk screenshot against a domain-content rubric.
|
|
105
105
|
|
|
106
106
|
The agent works on either the **free (MIT) edition** or the **paid edition** without code changes — the same pipeline handles both substrates; multi-tenant features (org switching, invitations, role permissions) survive the rename pipeline when targeting paid. The agent tests paid first because free is a strict subset of paid; running paid first catches regressions that wouldn't surface against free alone.
|
|
107
107
|
|
|
@@ -131,14 +131,14 @@ End-to-end wall-clock per run, measured from `report.json`'s `meta.durationMs` o
|
|
|
131
131
|
|
|
132
132
|
Cold builds, first-run cocoapods/gradle dependency resolution, or unbooted simulators add a one-time minute or two. The self-repair loop (opt-in, hard-capped at 5 iterations) can extend a failing run substantially — budget for it if you set `NATIVEAPPTEMPLATE_REPAIR=on`.
|
|
133
133
|
|
|
134
|
-
**Cost** scales with model usage, not wall-clock. The agent makes real `claude-opus-
|
|
134
|
+
**Cost** scales with model usage, not wall-clock. The agent makes real `claude-opus-5-5` API calls (the planner, the Layer 3 vision judge, and the opt-in self-repair agent) and a single VISUAL=2 run consumes tens of thousands of tokens across multiple sub-agents. Set a workspace spend cap (see [Security](#security)) as a backstop — the agent exits non-zero on validation failure, but doesn't gate on spend itself.
|
|
135
135
|
|
|
136
136
|
## Architecture
|
|
137
137
|
|
|
138
138
|
```mermaid
|
|
139
139
|
flowchart LR
|
|
140
140
|
Spec["Natural-language spec<br/>(e.g. walk-in clinic queue)"] --> Agent
|
|
141
|
-
subgraph Agent["Claude Code Agent · Opus
|
|
141
|
+
subgraph Agent["Claude Code Agent · Opus 5.5"]
|
|
142
142
|
Planner --> Workers
|
|
143
143
|
Workers --> Reviewer
|
|
144
144
|
Reviewer --> Judge
|
|
@@ -162,6 +162,26 @@ The agent operates on the free, MIT-licensed edition of NativeAppTemplate — th
|
|
|
162
162
|
|
|
163
163
|
Combined ~42.5k LOC. Extracted from [MyTurnTag Creator](https://myturntag.com), a walk-in queue-management SaaS live on both app stores since 2024.
|
|
164
164
|
|
|
165
|
+
### Subscriptions in the paid templates
|
|
166
|
+
|
|
167
|
+
The paid iOS and Android templates include optional [RevenueCat](https://www.revenuecat.com) subscriptions. Generated apps keep them, **switched off**: billing stays off until you set your own app's RevenueCat key, so a generated app behaves as it would without billing (every feature open, no paywall). The agent never carries a key over:
|
|
168
|
+
|
|
169
|
+
- **iOS:** the key is `REVENUECAT_API_KEY` in `RevenueCat.xcconfig` (committed empty). The template's gitignored `RevenueCat.local.xcconfig`, which may hold the template developer's own key, is not copied into the generated app; `API.local.xcconfig` still is, so Debug builds keep pointing at your local Rails. Generated iOS apps depend on [`purchases-ios`](https://github.com/RevenueCat/purchases-ios) through Swift Package Manager, so the **first build needs network access** to resolve it.
|
|
170
|
+
- **Android:** the key is the Gradle property `<PRODUCT>_REVENUECAT_GOOGLE_API_KEY` (e.g. `CLINICQUEUE_REVENUECAT_GOOGLE_API_KEY`), renamed with the app. The env bridge mirrors only the API settings (`<PRODUCT>_API_*`), never `NATIVEAPPTEMPLATE_REVENUECAT_GOOGLE_API_KEY`.
|
|
171
|
+
|
|
172
|
+
To turn billing on, follow the template's subscription docs (`docs/subscription.md` on iOS, `docs/subscriptions.md` on Android) with your own RevenueCat app. The paywall copy that names the primary resource ("Run all your shops from one account", 店舗) is renamed with it.
|
|
173
|
+
|
|
174
|
+
### Error monitoring (Sentry) in the templates
|
|
175
|
+
|
|
176
|
+
The paid iOS and Android templates and the Rails API include optional [Sentry](https://sentry.io) error monitoring, **off** until you set your own DSN. Generated apps keep it off and never carry the template developer's settings over:
|
|
177
|
+
|
|
178
|
+
- **iOS:** `SENTRY_DSN`, `SENTRY_ORG` and `SENTRY_PROJECT` live in `Sentry.xcconfig` (committed empty), included by `Project.xcconfig`, the project's base configuration for Debug and Release. Both files are copied and stay wired (the renamed `.pbxproj` keeps `Project.xcconfig` as the base configuration). The gitignored `Sentry.local.xcconfig` (the developer's own DSN) is not copied. The "Upload dSYMs to Sentry" build phase does nothing while the DSN, org or project is empty. The project depends on [`sentry-cocoa`](https://github.com/getsentry/sentry-cocoa) through Swift Package Manager, so the first build needs network access.
|
|
179
|
+
- **Android:** the DSN and the R8 mapping upload read the Gradle properties `<PRODUCT>_SENTRY_DSN`, `<PRODUCT>_SENTRY_ORG`, `<PRODUCT>_SENTRY_PROJECT` (e.g. `FADEQUEUE_SENTRY_DSN`), renamed with the app; without them `BuildConfig.SENTRY_DSN` is empty and no mapping is uploaded. The env bridge never mirrors `NATIVEAPPTEMPLATE_SENTRY_*`.
|
|
180
|
+
- **Rails API:** `SENTRY_DSN` (unset in development and test); in production it comes from the Kamal secret `<SERVICE>_SENTRY_DSN` (e.g. `FADE_QUEUE_API_SENTRY_DSN` for the service `fade_queue_api`). The initializer's `NativeapptemplateSentry` module is renamed with the app (`FadeQueueSentry`).
|
|
181
|
+
- sentry-cli's auth token files (`.sentryclirc`, `sentry.properties`) are never copied from any substrate.
|
|
182
|
+
|
|
183
|
+
To turn it on, follow the template's README section "Error monitoring (Sentry)" with your own Sentry project.
|
|
184
|
+
|
|
165
185
|
## Usage
|
|
166
186
|
|
|
167
187
|
```bash
|
|
@@ -199,8 +219,8 @@ The same generator also ships as an MCP server — `npx -y -p nativeapptemplate-
|
|
|
199
219
|
## Requirements
|
|
200
220
|
|
|
201
221
|
- [Node.js](https://nodejs.org) 22+
|
|
202
|
-
- [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-typescript) v0.
|
|
203
|
-
- An [Anthropic API key](https://console.anthropic.com/settings/keys) with access to `claude-opus-
|
|
222
|
+
- [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-typescript) v0.3.286 or later and `@anthropic-ai/sdk` v0.131.0 or later (needed for Opus 5.5; both are installed as dependencies)
|
|
223
|
+
- An [Anthropic API key](https://console.anthropic.com/settings/keys) with access to `claude-opus-5-5`, exported as `ANTHROPIC_API_KEY`:
|
|
204
224
|
```bash
|
|
205
225
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
206
226
|
```
|
|
@@ -217,7 +237,7 @@ The same generator also ships as an MCP server — `npx -y -p nativeapptemplate-
|
|
|
217
237
|
|
|
218
238
|
### Optional flags
|
|
219
239
|
|
|
220
|
-
- `NATIVEAPPTEMPLATE_VISUAL=1` — opts the run into Stage 1 visual judging (Layer 3). When set, Layer 2 runs in **build mode** instead of fast mode (full `xcodebuild build` + `./gradlew assembleDebug`), then for each platform the agent installs the app on the booted sim/emulator, captures the home screen, and judges it with Opus
|
|
240
|
+
- `NATIVEAPPTEMPLATE_VISUAL=1` — opts the run into Stage 1 visual judging (Layer 3). When set, Layer 2 runs in **build mode** instead of fast mode (full `xcodebuild build` + `./gradlew assembleDebug`), then for each platform the agent installs the app on the booted sim/emulator, captures the home screen, and judges it with Opus 5.5 vision against `DEFAULT_STAGE1_RUBRIC`. Adds 60-180s per platform depending on cold-build time. Requires a sim/emulator booted for each platform you want judged. Off by default — `npm run dev` keeps the existing fast path.
|
|
221
241
|
- `NATIVEAPPTEMPLATE_VISUAL=2` — implies `=1` and additionally runs **Stage 2**: the agent boots the generated Rails app under `mise exec -- bin/dev` (after `bundle install` + `bin/rails db:prepare` + `bin/rails db:seed_fu`), waits for it to listen, then drives the iOS sim and Android emulator through the parameterized queue scenario (Sign Up → email-confirm via `bin/rails runner` → Sign In → drill into auto-seeded sample). Layer 3 then judges the last captured screenshot against `DEFAULT_STAGE2_RUBRIC` (domain content + no substrate-token leak). Adds 2–4 minutes per platform on top of `=1`. Requires both sims/emulators booted and the substrate's `mise` toolchain installed for `bin/dev`.
|
|
222
242
|
- `NATIVEAPPTEMPLATE_REPAIR` — opts into the bounded self-repair loop. Set `on` (or a positive integer N, hard-capped at 5) to enable. When the first validation pass fails on a **code-repairable** layer — Layer 1 leftover substrate tokens or Layer 2 build/compile errors — the agent runs a Claude Agent SDK repair pass scoped to the failing generated project (Read/Edit/Bash inside `out/<slug>/<platform>/` only), re-validates that platform, and repeats up to the cap. Each attempt is recorded in the validation report's self-repair table. Layer 3 (vision) and contract-reviewer misses are surfaced but not auto-repaired (a Layer 3 miss is usually environmental, not a source bug). Off by default; when the loop can't close the failures the agent still exits non-zero.
|
|
223
243
|
- `NATIVEAPPTEMPLATE_BRIDGE=off` — skip writing to `~/.gradle/gradle.properties`. The agent normally mirrors `NATIVEAPPTEMPLATE_API_*` (HOST/PORT/SCHEME) into renamed-product variants (`<PRODUCT>_API_*`) at run time so the generated Android app picks them up via `gradle.properties` and the iOS sim launch picks them up via `SIMCTL_CHILD_*`. Set this to disable the file write (process.env injection still runs for child-spawn paths).
|
|
@@ -236,7 +256,7 @@ The agent doesn't just generate code and exit — it validates the output.
|
|
|
236
256
|
|
|
237
257
|
1. **Structural.** `ripgrep` for leftover domain tokens; OpenAPI contract parity check between Rails, iOS networking, and Android repository layers. A silent rename inconsistency fails the run before any tests execute.
|
|
238
258
|
2. **Runtime.** Verify the generated Rails app boots (`bin/rails runner 'puts OK'`); type-check or build the iOS and Android apps. With `NATIVEAPPTEMPLATE_VISUAL=1`, escalate to a full build (`xcodebuild build` + `./gradlew assembleDebug`) and install on the booted sim/emulator. With `=2`, additionally boot the live Rails server and drive a scripted CRUD walk-through via [`mobile-next/mobile-mcp`](https://github.com/mobile-next/mobile-mcp). A walk step that doesn't reach its expected screen fails the run.
|
|
239
|
-
3. **Semantic.** Opus
|
|
259
|
+
3. **Semantic.** Opus 5.5 as judge — scores whether the generated code and rendered UI actually express the intended domain. Vision judges read simulator/emulator screenshots directly.
|
|
240
260
|
|
|
241
261
|
See [`docs/SPEC.md`](./docs/SPEC.md) for the full design.
|
|
242
262
|
|
|
@@ -262,7 +282,17 @@ Naming flags:
|
|
|
262
282
|
| Flag | Default | Effect |
|
|
263
283
|
|---|---|---|
|
|
264
284
|
| `--project-name="Vet Clinic"` | planner's pick | Name the project. Accepts a human name (`"Vet Clinic"`), PascalCase (`VetClinic`), or kebab (`vet-clinic`); from it the agent derives the Pascal project name (`NativeAppTemplate → VetClinic` across all three platforms), the slug/output dir (`out/vet-clinic/`), the DB prefix + env-bridge token, and the display name. Invalid (no derivable slug) is reported and skipped. |
|
|
265
|
-
| `--rename From=To` | planner's pick | Override one of the planner's domain rename targets (repeatable). `From` is a substrate token (`Shop`, `Shopkeeper`, `ItemTag`); the planner fills in everything else. An override that matches no planned rename is reported and skipped. Example: `--rename Shopkeeper=Vet --rename Shop=Clinic` |
|
|
285
|
+
| `--rename From=To` | planner's pick | Override one of the planner's domain rename targets (repeatable). `From` is a substrate token (`Shop`, `Shopkeeper`, `ItemTag`); the planner fills in everything else. An override that matches no planned rename is reported and skipped, and so is one whose target is a [reserved name](#reserved-rename-targets) (the current target is kept: the planner's pick, or an earlier `--rename` for the same token). Example: `--rename Shopkeeper=Vet --rename Shop=Clinic` |
|
|
286
|
+
| `--rename-ja From=名前` | planner's pick | Override the Japanese name of a planned rename (repeatable). `From` is `Shop` or `ItemTag`; the Rails API's Japanese messages (`config/locales/ja.yml`) and their tests use it in place of the substrate's 店舗 / アイテムタグ. The planner picks one itself (`toJa` in the rename plan); without one the Japanese is left as is. Example: `--rename-ja Shop=動物病院` |
|
|
287
|
+
|
|
288
|
+
#### Reserved rename targets
|
|
289
|
+
|
|
290
|
+
A rename target must not be a name the substrate or the languages already use, or the renamed types collide with existing ones and the build breaks. The planner is told to avoid these, `--rename` / the MCP `renameOverrides` reject them (case-insensitively), and a run warns if a planned target is one of them. The list lives in [`src/reserved-words.ts`](./src/reserved-words.ts):
|
|
291
|
+
|
|
292
|
+
- **Substrate auth/admin:** Owner, Account, Admin, Personal, Role, Permission, User, App, Version, Privacy, Terms, Invitation, Error, Scan, Redirect, Notification, Session
|
|
293
|
+
- **Subscriptions (paid templates):** Subscription, Paywall, Plan, Purchase, Purchases, Billing, Entitlement, Trial, Customer, and the RevenueCat / StoreKit / Play Billing names Package, Offering, Store, StoreProduct, Product, Transaction, Price, Period
|
|
294
|
+
- **Error monitoring (paid templates, Rails API):** Sentry, ErrorReport, ErrorReporter, ErrorReporting, and Event (the iOS template's logging type, which the Sentry reporter tells apart from `Sentry.Event`), Breadcrumb, Exception (Sentry SDK names the iOS tests use unqualified; `Exception` is also Ruby's)
|
|
295
|
+
- **Standard libraries:** Swift (Task, Actor, Result, View, Data, Date, …), Kotlin (Unit, List, Map, Flow, Context, …), Ruby/Rails (Object, Module, Class, Hash, Request, Response, …)
|
|
266
296
|
|
|
267
297
|
Report flags:
|
|
268
298
|
|
|
@@ -309,7 +339,7 @@ MIT. See [`LICENSE`](./LICENSE).
|
|
|
309
339
|
|
|
310
340
|
## Acknowledgments
|
|
311
341
|
|
|
312
|
-
- [Anthropic](https://www.anthropic.com) for Claude Opus 4.7 and Claude Code
|
|
342
|
+
- [Anthropic](https://www.anthropic.com) for Claude Opus (4.7 during the hackathon, 5.5 today) and Claude Code
|
|
313
343
|
- [Cerebral Valley](https://cerebralvalley.ai) for running the hackathon
|
|
314
344
|
- [`mobile-next/mobile-mcp`](https://github.com/mobile-next/mobile-mcp) for making mobile UI automation actually workable from an agent
|
|
315
345
|
- [MyTurnTag Creator](https://myturntag.com) users, whose real-world queue management taught me which abstractions survive and which don't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../src/agents/judge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../src/agents/judge.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,KAAK,UAAU,EAAqB,MAAM,yBAAyB,CAAC;AAMxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAGX,cAAc,EAGd,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAWF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QACP,mBAAmB,EAAE,MAAM,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;KACrC,CAAC;CACH,CAAC;AAQF,wBAAsB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAkEtE"}
|
package/dist/agents/judge.js
CHANGED
|
@@ -2,6 +2,7 @@ import { resolve } from "node:path";
|
|
|
2
2
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
3
3
|
import { trace } from "../trace.js";
|
|
4
4
|
import { isStub } from "../stub.js";
|
|
5
|
+
import { JUDGE_MODEL } from "../models.js";
|
|
5
6
|
import { createMobileClient } from "../mobile.js";
|
|
6
7
|
import { runLayer1 } from "../validation/layer1.js";
|
|
7
8
|
import { runLayer2 } from "../validation/layer2.js";
|
|
@@ -36,7 +37,7 @@ export async function runJudge(input) {
|
|
|
36
37
|
layer3Summary = formatLayer3Summary(visualReport);
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
trace("judge",
|
|
40
|
+
trace("judge", `Layer 3 (semantic, ${JUDGE_MODEL} vision judge) — visual config not provided; skipped`);
|
|
40
41
|
}
|
|
41
42
|
const layer1Layer2Pass = reports.every((r) => r.layer1.pass && r.layer2.pass);
|
|
42
43
|
const visualPass = visualReport
|
|
@@ -241,7 +242,7 @@ async function runStubJudge() {
|
|
|
241
242
|
await delay(400);
|
|
242
243
|
trace("judge", "Layer 2: PASS (scripted CRUD walk)");
|
|
243
244
|
await delay(100);
|
|
244
|
-
trace("judge",
|
|
245
|
+
trace("judge", `Layer 3 (semantic): ${JUDGE_MODEL} judge, median of 3 runs`);
|
|
245
246
|
await delay(300);
|
|
246
247
|
trace("judge", "Layer 3: PASS (semantic score above threshold)");
|
|
247
248
|
return { overallPass: true, summary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,CAAC,CAAC;IAChC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,CAAC,OAAO,EAAE,2DAA2D,CAAC,CAAC;IAC5E,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,CAAC,OAAO,EAAE,oCAAoC,CAAC,CAAC;IACrD,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,CAAC,OAAO,EAAE,uBAAuB,WAAW,0BAA0B,CAAC,CAAC;IAC7E,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,CAAC,OAAO,EAAE,gDAAgD,CAAC,CAAC;IACjE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,MAAoB,EAAE,UAAsB;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAErD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,SAAS,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QACtE,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;KACnE,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
package/dist/agents/planner.d.ts
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
1
2
|
import type { DomainSpec } from "./types.js";
|
|
3
|
+
export declare const SYSTEM_PROMPT: string;
|
|
4
|
+
export declare const DOMAIN_SPEC_SCHEMA: {
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly slug: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly description: "kebab-case filesystem slug matching ^[a-z0-9][a-z0-9-]*$, e.g. 'clinic-queue'";
|
|
10
|
+
};
|
|
11
|
+
readonly displayName: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Human-readable name, e.g. 'Clinic Queue'";
|
|
14
|
+
};
|
|
15
|
+
readonly entities: {
|
|
16
|
+
readonly type: "array";
|
|
17
|
+
readonly items: {
|
|
18
|
+
readonly type: "object";
|
|
19
|
+
readonly properties: {
|
|
20
|
+
readonly name: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly description: "Entity name in PascalCase";
|
|
23
|
+
};
|
|
24
|
+
readonly replaces: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly description: "Which substrate type this replaces: Shop, Shopkeeper, or ItemTag";
|
|
27
|
+
};
|
|
28
|
+
readonly fields: {
|
|
29
|
+
readonly type: "array";
|
|
30
|
+
readonly items: {
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly name: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
};
|
|
36
|
+
readonly type: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly enum: readonly ["string", "integer", "boolean", "datetime", "reference"];
|
|
39
|
+
};
|
|
40
|
+
readonly references: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly description: "If type=reference, the target entity name";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly required: readonly ["name", "type"];
|
|
46
|
+
readonly additionalProperties: false;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly states: {
|
|
50
|
+
readonly type: "array";
|
|
51
|
+
readonly items: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
};
|
|
54
|
+
readonly description: "Optional state-machine states for this entity";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly required: readonly ["name", "replaces", "fields"];
|
|
58
|
+
readonly additionalProperties: false;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly renamePlan: {
|
|
62
|
+
readonly type: "array";
|
|
63
|
+
readonly items: {
|
|
64
|
+
readonly type: "object";
|
|
65
|
+
readonly properties: {
|
|
66
|
+
readonly from: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly description: "Substrate token, e.g. 'Shop'";
|
|
69
|
+
};
|
|
70
|
+
readonly to: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly description: "Replacement token, e.g. 'Clinic'";
|
|
73
|
+
};
|
|
74
|
+
readonly toJa: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly description: "Shop and ItemTag only: the Japanese noun for the target, e.g. '医院'";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly required: readonly ["from", "to"];
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly jsonApiContract: {
|
|
84
|
+
readonly type: "object";
|
|
85
|
+
readonly description: "Placeholder JSON:API contract object; empty {} for now (a later reviewer sub-agent expands it)";
|
|
86
|
+
readonly properties: {};
|
|
87
|
+
readonly additionalProperties: false;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
readonly required: readonly ["slug", "displayName", "entities", "renamePlan", "jsonApiContract"];
|
|
91
|
+
readonly additionalProperties: false;
|
|
92
|
+
};
|
|
93
|
+
export declare function buildPlannerRequest(spec: string): Anthropic.Beta.Messages.MessageCreateParamsNonStreaming;
|
|
94
|
+
export declare function parsePlannerResponse(response: Anthropic.Beta.Messages.BetaMessage): DomainSpec;
|
|
2
95
|
export declare function runPlanner(spec: string): Promise<DomainSpec>;
|
|
3
96
|
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/agents/planner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/agents/planner.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU7C,eAAO,MAAM,aAAa,QAkC6H,CAAC;AAMxJ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DrB,CAAC;AAKX,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAazG;AAID,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,UAAU,CAM9F;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAwBlE"}
|
package/dist/agents/planner.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import Anthropic from "@anthropic-ai/sdk";
|
|
2
2
|
import { trace } from "../trace.js";
|
|
3
3
|
import { isStub } from "../stub.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { BILLING_RESERVED, ERROR_MONITORING_RESERVED, STDLIB_RESERVED, SUBSTRATE_RESERVED } from "../reserved-words.js";
|
|
5
|
+
import { FALLBACK_BETA, FALLBACKS, PLANNER_EFFORT, PLANNER_MODEL } from "../models.js";
|
|
6
|
+
import { isValidSlug } from "../slug.js";
|
|
7
|
+
import { readStructuredJson, usageLine } from "../structured-output.js";
|
|
8
|
+
// Opus 5.5 always thinks, and thinking counts toward max_tokens: leave room
|
|
9
|
+
// for it on top of the DomainSpec JSON.
|
|
10
|
+
const MAX_TOKENS = 16000;
|
|
11
|
+
export const SYSTEM_PROMPT = `You are a domain modeler for a three-platform SaaS code generator. You receive a one-sentence natural-language specification of a SaaS product and output a structured DomainSpec that drives code generation across Rails 8.1 (API), SwiftUI (iOS), and Jetpack Compose (Android).
|
|
7
12
|
|
|
8
13
|
The substrate you specialize is a walk-in queue management system. Its generic types are:
|
|
9
14
|
- Shop (the primary tenant resource) — renamed to a domain-appropriate noun
|
|
@@ -15,87 +20,123 @@ For non-queue specs (task tracker, note-taking, inventory), propose replacing It
|
|
|
15
20
|
|
|
16
21
|
IMPORTANT — substrate-reserved vocabulary: the substrate's auth/admin layer already uses these tokens as unrelated identifiers, so rename targets MUST NOT collide with them (a lexical rename would produce duplicate-identifier build errors):
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
${SUBSTRATE_RESERVED.join(", ")}
|
|
24
|
+
|
|
25
|
+
IMPORTANT — billing-reserved vocabulary: the substrate's subscription layer (RevenueCat) already uses these tokens — its own type names (SubscriptionRepository, PaywallView, SubscriptionPlan, FreeTrial…) and the RevenueCat / StoreKit / Play Billing types it calls — so rename targets MUST NOT collide with them either:
|
|
26
|
+
|
|
27
|
+
${BILLING_RESERVED.join(", ")}
|
|
28
|
+
|
|
29
|
+
IMPORTANT — error-monitoring-reserved vocabulary: the substrate's error monitoring layer (Sentry) already uses these tokens — its own type names (ErrorReporter, ErrorReport, ErrorReporting), the template's logging Event type, and the Sentry SDK names it calls — so rename targets MUST NOT collide with them either:
|
|
30
|
+
|
|
31
|
+
${ERROR_MONITORING_RESERVED.join(", ")}
|
|
20
32
|
|
|
21
33
|
IMPORTANT — language-stdlib-reserved vocabulary: the generated code must compile in Swift, Kotlin, and Ruby. A rename target that collides with any of these standard-library types silently shadows the stdlib and breaks compilation (e.g. Task.isCancelled no longer resolves if Task is shadowed):
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
Data, Date, URL, UUID, Set, Array, Dictionary, Optional
|
|
25
|
-
Kotlin — Unit, Nothing, Any, List, Map, Set, Flow, Sequence, Result,
|
|
26
|
-
Continuation, Deferred, Context
|
|
27
|
-
Ruby/Rails — Object, Module, Class, Array, Hash, String, Integer, Proc,
|
|
28
|
-
Thread, Request, Response, Session
|
|
35
|
+
${Object.entries(STDLIB_RESERVED).map(([lang, words]) => ` ${lang} — ${words.join(", ")}`).join("\n")}
|
|
29
36
|
|
|
30
37
|
For Shopkeeper, prefer domain-distinctive nouns: Assignee, Maintainer, Host, Vet, Barber, Stylist, Staff, Curator, Editor, Author — NOT Owner / User / Admin.
|
|
31
|
-
For Shop, prefer: Clinic, Restaurant, Workspace, Project, Board, Journal, Space, Studio — NOT Account.
|
|
38
|
+
For Shop, prefer: Clinic, Restaurant, Workspace, Project, Board, Journal, Space, Studio — NOT Account / Store / Event.
|
|
32
39
|
For ItemTag replacements, prefer: Todo, Ticket, Entry, Card, Issue, Note, Memo, Patient, Reservation — NOT Task (Swift Concurrency) / Actor (Swift Concurrency) / Scan / Notification.
|
|
33
40
|
|
|
41
|
+
For the Shop and ItemTag renames, also give toJa: the natural Japanese noun a Japanese app would use for the target, e.g. Clinic → 医院, Restaurant → 店, Patient → 患者, Reservation → 予約. The substrate's Japanese messages use 店舗 (Shop) and アイテムタグ (ItemTag), and toJa replaces them as a plain substring, so it must be a bare noun (no particles, no 様/さん) that reads naturally before 名, は and を, as in 医院名, 医院は3件まで作成できます. Omit toJa for other renames.
|
|
42
|
+
|
|
34
43
|
Never emit identity rename pairs (from === to). If the target happens to equal the source, pick a different target.
|
|
35
44
|
|
|
36
45
|
slug must be kebab-case and filesystem-safe. Keep entities tight (2-4 per spec). Keep jsonApiContract minimal — a later reviewer sub-agent expands it.`;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
required: ["name", "type"],
|
|
46
|
+
// JSON schema for the planner's structured output (output_config.format).
|
|
47
|
+
// Structured outputs need additionalProperties: false on every object and
|
|
48
|
+
// don't support `pattern`, so the slug rule lives in the description and is
|
|
49
|
+
// checked after parsing (isValidSlug).
|
|
50
|
+
export const DOMAIN_SPEC_SCHEMA = {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
slug: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "kebab-case filesystem slug matching ^[a-z0-9][a-z0-9-]*$, e.g. 'clinic-queue'",
|
|
56
|
+
},
|
|
57
|
+
displayName: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Human-readable name, e.g. 'Clinic Queue'",
|
|
60
|
+
},
|
|
61
|
+
entities: {
|
|
62
|
+
type: "array",
|
|
63
|
+
items: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
name: { type: "string", description: "Entity name in PascalCase" },
|
|
67
|
+
replaces: { type: "string", description: "Which substrate type this replaces: Shop, Shopkeeper, or ItemTag" },
|
|
68
|
+
fields: {
|
|
69
|
+
type: "array",
|
|
70
|
+
items: {
|
|
71
|
+
type: "object",
|
|
72
|
+
properties: {
|
|
73
|
+
name: { type: "string" },
|
|
74
|
+
type: { type: "string", enum: ["string", "integer", "boolean", "datetime", "reference"] },
|
|
75
|
+
references: { type: "string", description: "If type=reference, the target entity name" },
|
|
69
76
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type: "array",
|
|
73
|
-
items: { type: "string" },
|
|
74
|
-
description: "Optional state-machine states for this entity",
|
|
77
|
+
required: ["name", "type"],
|
|
78
|
+
additionalProperties: false,
|
|
75
79
|
},
|
|
76
80
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: "array",
|
|
82
|
-
items: {
|
|
83
|
-
type: "object",
|
|
84
|
-
properties: {
|
|
85
|
-
from: { type: "string", description: "Substrate token, e.g. 'Shop'" },
|
|
86
|
-
to: { type: "string", description: "Replacement token, e.g. 'Clinic'" },
|
|
81
|
+
states: {
|
|
82
|
+
type: "array",
|
|
83
|
+
items: { type: "string" },
|
|
84
|
+
description: "Optional state-machine states for this entity",
|
|
87
85
|
},
|
|
88
|
-
required: ["from", "to"],
|
|
89
86
|
},
|
|
87
|
+
required: ["name", "replaces", "fields"],
|
|
88
|
+
additionalProperties: false,
|
|
90
89
|
},
|
|
91
|
-
|
|
90
|
+
},
|
|
91
|
+
renamePlan: {
|
|
92
|
+
type: "array",
|
|
93
|
+
items: {
|
|
92
94
|
type: "object",
|
|
93
|
-
|
|
95
|
+
properties: {
|
|
96
|
+
from: { type: "string", description: "Substrate token, e.g. 'Shop'" },
|
|
97
|
+
to: { type: "string", description: "Replacement token, e.g. 'Clinic'" },
|
|
98
|
+
toJa: { type: "string", description: "Shop and ItemTag only: the Japanese noun for the target, e.g. '医院'" },
|
|
99
|
+
},
|
|
100
|
+
required: ["from", "to"],
|
|
101
|
+
additionalProperties: false,
|
|
94
102
|
},
|
|
95
103
|
},
|
|
96
|
-
|
|
104
|
+
jsonApiContract: {
|
|
105
|
+
type: "object",
|
|
106
|
+
description: "Placeholder JSON:API contract object; empty {} for now (a later reviewer sub-agent expands it)",
|
|
107
|
+
properties: {},
|
|
108
|
+
additionalProperties: false,
|
|
109
|
+
},
|
|
97
110
|
},
|
|
111
|
+
required: ["slug", "displayName", "entities", "renamePlan", "jsonApiContract"],
|
|
112
|
+
additionalProperties: false,
|
|
98
113
|
};
|
|
114
|
+
// The Messages API request the planner sends. Exported so tests can check
|
|
115
|
+
// its shape without a network call. Opus 5.5 rejects forced tool_choice, so
|
|
116
|
+
// the DomainSpec comes back as structured output instead of a tool call.
|
|
117
|
+
export function buildPlannerRequest(spec) {
|
|
118
|
+
return {
|
|
119
|
+
model: PLANNER_MODEL,
|
|
120
|
+
max_tokens: MAX_TOKENS,
|
|
121
|
+
system: SYSTEM_PROMPT,
|
|
122
|
+
output_config: {
|
|
123
|
+
effort: PLANNER_EFFORT,
|
|
124
|
+
format: { type: "json_schema", schema: DOMAIN_SPEC_SCHEMA },
|
|
125
|
+
},
|
|
126
|
+
betas: [FALLBACK_BETA],
|
|
127
|
+
fallbacks: FALLBACKS,
|
|
128
|
+
messages: [{ role: "user", content: spec }],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// Turns the planner's response into a DomainSpec, failing loudly on a
|
|
132
|
+
// refusal, a truncated response, or a slug that breaks the contract.
|
|
133
|
+
export function parsePlannerResponse(response) {
|
|
134
|
+
const domain = readStructuredJson(response, "planner");
|
|
135
|
+
if (typeof domain.slug !== "string" || !isValidSlug(domain.slug)) {
|
|
136
|
+
throw new Error(`planner: invalid slug ${JSON.stringify(domain.slug)} (must match ^[a-z0-9][a-z0-9-]*$)`);
|
|
137
|
+
}
|
|
138
|
+
return domain;
|
|
139
|
+
}
|
|
99
140
|
export async function runPlanner(spec) {
|
|
100
141
|
trace("planner", `received spec: "${spec}"`);
|
|
101
142
|
if (isStub("planner")) {
|
|
@@ -107,24 +148,13 @@ export async function runPlanner(spec) {
|
|
|
107
148
|
// single-key default path.
|
|
108
149
|
const apiKey = process.env['NATIVEAPPTEMPLATE_AGENT_ANTHROPIC_KEY'] ?? process.env['ANTHROPIC_API_KEY'];
|
|
109
150
|
const client = new Anthropic({ apiKey });
|
|
110
|
-
trace("planner", `calling ${
|
|
111
|
-
const response = await client.messages.create(
|
|
112
|
-
|
|
113
|
-
max_tokens: MAX_TOKENS,
|
|
114
|
-
system: SYSTEM_PROMPT,
|
|
115
|
-
tools: [DOMAIN_TOOL],
|
|
116
|
-
tool_choice: { type: "tool", name: "submit_domain_spec" },
|
|
117
|
-
messages: [{ role: "user", content: spec }],
|
|
118
|
-
});
|
|
119
|
-
const toolUse = response.content.find((c) => c.type === "tool_use");
|
|
120
|
-
if (!toolUse || toolUse.type !== "tool_use") {
|
|
121
|
-
throw new Error("planner: expected tool_use in response, got: " + JSON.stringify(response.content));
|
|
122
|
-
}
|
|
123
|
-
const domain = toolUse.input;
|
|
151
|
+
trace("planner", `calling ${PLANNER_MODEL} (effort ${PLANNER_EFFORT}) to extract domain`);
|
|
152
|
+
const response = await client.beta.messages.create(buildPlannerRequest(spec));
|
|
153
|
+
const domain = parsePlannerResponse(response);
|
|
124
154
|
trace("planner", `derived slug: ${domain.slug}`);
|
|
125
|
-
trace("planner", `rename plan: ${domain.renamePlan.map((r) => `${r.from}->${r.to}`).join(", ")}`);
|
|
155
|
+
trace("planner", `rename plan: ${domain.renamePlan.map((r) => `${r.from}->${r.to}${r.toJa ? ` (${r.toJa})` : ""}`).join(", ")}`);
|
|
126
156
|
trace("planner", `entities: ${domain.entities.map((e) => e.name).join(", ")}`);
|
|
127
|
-
trace("planner",
|
|
157
|
+
trace("planner", usageLine(response, PLANNER_MODEL));
|
|
128
158
|
trace("planner", "done");
|
|
129
159
|
return domain;
|
|
130
160
|
}
|
|
@@ -145,7 +175,7 @@ async function runStubPlanner(spec) {
|
|
|
145
175
|
displayName: "Clinic Queue",
|
|
146
176
|
entities: [],
|
|
147
177
|
renamePlan: [
|
|
148
|
-
{ from: "Shop", to: "Clinic" },
|
|
178
|
+
{ from: "Shop", to: "Clinic", toJa: "医院" },
|
|
149
179
|
{ from: "Shopkeeper", to: "Vet" },
|
|
150
180
|
],
|
|
151
181
|
jsonApiContract: {},
|