Publish benchmark task data
Browse filesFiles changed (6)
- LICENSEAdded+21
- README.mdAdded+113
- croissant.jsonAdded+216
- data/PROVENANCE.mdAdded+13
- data/tasks.jsonlAdded
- scripts/gen-tasks.mjsAdded+579
123456789101112131415161718192021MIT License
Copyright (c) 2026 Pooria Arab
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113---license: "mit"language:- enpretty_name: "Schema Mutation"tags:- benchmark- llm-evaluation- ai-benchmark- model-evaluation- evals- grading- openrouter- openai- mcp- typescript- agent-benchmark- function-calling- tool-use- openapi- schema-migrationtask_categories:- text-generationsize_categories:- n<1Kconfigs:- config_name: default data_files: - split: test path: data/tasks.jsonl---
# Schema Mutation
Tool schemas change. Does the model call the current one?
## What it measures
Whether a model follows the current tool schema after a migration — renamed fields, new required fields, changed enums, split endpoints and type changes — instead of the version it memorized.
Category: `tools`. Status: `alpha`.
## How to run
```console$ npx benchmark-schema-mutation list$ npx benchmark-schema-mutation run --model <model-id> --provider openrouter$ npx benchmark-schema-mutation score results.json```
`--provider mock` runs the whole benchmark offline with no keys. Real models runthrough OpenRouter (`OPENROUTER_API_KEY`) or any OpenAI-compatible base URL(`OPENAI_BASE_URL`, `OPENAI_API_KEY`).
## Data fields
`data/tasks.jsonl` holds 60 tasks, one JSON object per line(kinds: 60 single).
| field | type ||---|---|| `id` | string || `kind` | string || `prompt` | string || `expected` | string || `metadata` | object |
## Provenance
# Schema Mutation provenance
This file is generated from the benchmark definition.
## Seeded schema-mutation task generator
- Kind: `synthetic`- URL: https://github.com/pooriaarab/benchmark-schema-mutation/blob/main/scripts/gen-tasks.mjs- Licence: `MIT`- Retrieved: 2026-10-15T00:00:00.000Z- How to get it: Run `node scripts/gen-tasks.mjs` for the public split (seed 20261015) or `node scripts/gen-tasks.mjs --seed <n> --split hidden` for a held-out split.- Contamination notes: All 60 public tasks are synthetic mutations of 12 hand-authored base tool schemas. The hidden split uses a different seed, which selects different values, mutation variants, field names and enum targets, and is never committed, so public tasks may enter training data without leaking final evaluation items.- Refresh: Change the seed, rerun the generator, and review the JSONL diff. Rotate mutation parameters quarterly.
## Grader
Canonical JSON equality on the tool name and arguments after normalisation; exact matches against the pre-migration call are reported as staleSchemaUsed.
## Limitations
This dataset contains only the public task split (60 tasks).Hidden evaluation splits use a private seed and are deliberately not part ofthis dataset. Source kinds: synthetic. These are evaluation promptsfor the `benchmark-schema-mutation` benchmark, not training data; scoring requires the package'sdeterministic grader. See PROVENANCE.md for contamination notes.
## Citation
```bibtex@misc{benchmark_schema_mutation, author = {Pooria Arab}, title = {Schema Mutation task data}, year = {2026}, url = {https://github.com/pooriaarab/benchmark-schema-mutation}}```
## Links
- npm: https://www.npmjs.com/package/benchmark-schema-mutation- GitHub: https://github.com/pooriaarab/benchmark-schema-mutation- Leaderboard: https://aibenchmarkindex.com/benchmarks/benchmark-schema-mutation- Dataset: https://huggingface.co/datasets/pooria/benchmark-schema-mutation123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216{ "@context": { "@language": "en", "@vocab": "https://schema.org/", "citeAs": "cr:citeAs", "column": "cr:column", "conformsTo": "dct:conformsTo", "cr": "http://mlcommons.org/croissant/", "data": { "@id": "cr:data", "@type": "@json" }, "dataBiases": "cr:dataBiases", "dataCollection": "cr:dataCollection", "dataType": { "@id": "cr:dataType", "@type": "@vocab" }, "dct": "http://purl.org/dc/terms/", "equivalentProperty": "cr:equivalentProperty", "examples": { "@id": "cr:examples", "@type": "@json" }, "extract": "cr:extract", "field": "cr:field", "fileProperty": "cr:fileProperty", "fileObject": "cr:fileObject", "fileSet": "cr:fileSet", "format": "cr:format", "includes": "cr:includes", "isLiveDataset": "cr:isLiveDataset", "jsonPath": "cr:jsonPath", "key": "cr:key", "md5": "cr:md5", "parentField": "cr:parentField", "path": "cr:path", "personalSensitiveInformation": "cr:personalSensitiveInformation", "prov": "http://www.w3.org/ns/prov#", "rai": "http://mlcommons.org/croissant/RAI/", "recordSet": "cr:recordSet", "references": "cr:references", "regex": "cr:regex", "repeated": "cr:repeated", "replace": "cr:replace", "samplingRate": "cr:samplingRate", "sc": "https://schema.org/", "separator": "cr:separator", "source": "cr:source", "subField": "cr:subField", "transform": "cr:transform" }, "@type": "sc:Dataset", "conformsTo": [ "http://mlcommons.org/croissant/1.0", "http://mlcommons.org/croissant/RAI/1.0" ], "name": "Schema Mutation", "description": "Tool schemas change. Does the model call the current one?", "url": "https://huggingface.co/datasets/pooria/benchmark-schema-mutation", "sameAs": [ "https://github.com/pooriaarab/benchmark-schema-mutation", "https://aibenchmarkindex.com/benchmarks/benchmark-schema-mutation" ], "license": "https://choosealicense.com/licenses/mit/", "creator": { "@type": "Person", "name": "Pooria Arab", "url": "https://github.com/pooriaarab" }, "datePublished": "2026-10-15", "dateModified": "2026-10-15", "version": "0.1.0", "inLanguage": "en", "keywords": [ "benchmark-schema-mutation", "llm-evaluation", "benchmark" ], "isAccessibleForFree": true, "citeAs": "@misc{benchmark-schema-mutation, author={Pooria Arab}, title={Schema Mutation}, year={2026}, url={https://github.com/pooriaarab/benchmark-schema-mutation}}", "distribution": [ { "@type": "cr:FileObject", "@id": "data/PROVENANCE.md", "name": "data/PROVENANCE.md", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/data/PROVENANCE.md", "encodingFormat": "text/markdown", "sha256": "e27e3bf0c53f9e132670a1bf6c7d6939dc946f3c7cf3daaa851a3a9dae02af9c" }, { "@type": "cr:FileObject", "@id": "data/tasks.jsonl", "name": "data/tasks.jsonl", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/data/tasks.jsonl", "encodingFormat": "application/jsonlines", "sha256": "726579f10ff3e4dd440f9c221ed09f4de2a2b5d4bdb12aa8251fcc7caf26ba27" }, { "@type": "cr:FileObject", "@id": "scripts/gen-tasks.mjs", "name": "scripts/gen-tasks.mjs", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/scripts/gen-tasks.mjs", "encodingFormat": "text/javascript", "sha256": "30bbe73fcfcf42ea5500a855cd7cfe15b7207b18b35c59d6731aeb26a4099a7e" }, { "@type": "cr:FileObject", "@id": "LICENSE", "name": "LICENSE", "contentUrl": "https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/LICENSE", "encodingFormat": "text/plain", "sha256": "db83f2db2a2b6a3b5587ce4750a3a6cff3dd1219650fa1ea3b3354ee04891d96" } ], "recordSet": [ { "@type": "cr:RecordSet", "name": "tasks", "description": "60 benchmark tasks, one JSON object per line.", "field": [ { "@type": "cr:Field", "name": "id", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.id" } } }, { "@type": "cr:Field", "name": "kind", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.kind" } } }, { "@type": "cr:Field", "name": "prompt", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.prompt" } } }, { "@type": "cr:Field", "name": "expected", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.expected" } } }, { "@type": "cr:Field", "name": "metadata", "dataType": "sc:Text", "source": { "fileObject": { "@id": "data/tasks.jsonl" }, "extract": { "jsonPath": "$.metadata" } } } ] } ], "rai:dataCollection": "Public task split cloned from the benchmark repository; tasks are produced by scripts/gen-tasks.mjs with a fixed public seed.", "rai:dataCollectionType": "Benchmark task prompts for LLM evaluation.", "rai:dataCollectionRawData": "https://github.com/pooriaarab/benchmark-schema-mutation/tree/main/data", "rai:dataReleaseMaintenancePlan": "Refreshed when the benchmark's public seed changes; hidden splits are generated with a private seed and never published.", "rai:dataLimitations": "Public split only (60 tasks); hidden evaluation splits are held out. Evaluation prompts, not training data.", "rai:dataBiases": "Synthetic task families oversample the shapes the generator enumerates; coverage of real-world variation is limited by the generator templates.", "rai:personalSensitiveInformation": "None. Tasks contain no personal data; names, orders and scenarios are generated fixtures.", "rai:dataUseCases": [ "Testing and comparing LLM/agent behaviour on the measured construct", "Regression testing of model releases" ], "rai:dataSocialImpact": "Low risk: synthetic eval data. Improves transparency of model capability claims when used responsibly.", "rai:hasSyntheticData": true, "prov:wasDerivedFrom": [ "https://github.com/pooriaarab/benchmark-schema-mutation/blob/main/scripts/gen-tasks.mjs" ], "prov:wasGeneratedBy": [ { "@type": "prov:Activity", "name": "Seeded schema-mutation task generator", "description": "synthetic source: https://github.com/pooriaarab/benchmark-schema-mutation/blob/main/scripts/gen-tasks.mjs" } ], "alternateName": [ "pooria/benchmark-schema-mutation" ]}12345678910111213# Schema Mutation provenance
This file is generated from the benchmark definition.
## Seeded schema-mutation task generator
- Kind: `synthetic`- URL: https://github.com/pooriaarab/benchmark-schema-mutation/blob/main/scripts/gen-tasks.mjs- Licence: `MIT`- Retrieved: 2026-10-15T00:00:00.000Z- How to get it: Run `node scripts/gen-tasks.mjs` for the public split (seed 20261015) or `node scripts/gen-tasks.mjs --seed <n> --split hidden` for a held-out split.- Contamination notes: All 60 public tasks are synthetic mutations of 12 hand-authored base tool schemas. The hidden split uses a different seed, which selects different values, mutation variants, field names and enum targets, and is never committed, so public tasks may enter training data without leaking final evaluation items.- Refresh: Change the seed, rerun the generator, and review the JSONL diff. Rotate mutation parameters quarterly.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579import { mkdir, writeFile } from "node:fs/promises";import { dirname, resolve, sep } from "node:path";
const PUBLIC_SEED = 20261015;const KINDS = ["renamedField", "newRequired", "enumChange", "splitEndpoint", "typeChange"];
const S = (d) => ({ type: "string", description: d });const N = (d) => ({ type: "number", description: d });const I = (d) => ({ type: "integer", description: d });const A = (d) => ({ type: "array", items: { type: "string" }, description: d });const E = (d, v) => ({ type: "string", enum: v, description: d });
const pick = (r, xs) => xs[Math.floor(r() * xs.length)];const int = (r, lo, hi) => lo + Math.floor(r() * (hi - lo + 1));const digits = (r, n) => Array.from({ length: n }, () => Math.floor(r() * 10)).join("");const usd = (r) => int(r, 500, 9999) / 100;const email = (r) => `${pick(r, ["sam", "lee", "jae", "kim", "pat"])}@${pick(r, ["acme.io", "foo.dev", "bar.io", "baz.dev"])}`;const phone = (r) => `+1416555${digits(r, 4)}`;const code = (r) => `Your code is ${digits(r, 4)}.`;
// Base tool catalogue. `vars(rng)` draws the concrete values (ids, amounts,// names) for one task, so a different seed yields genuinely different tasks.// `ask(ctx, words)` renders the request; `words` overrides how an enum-valued// field is phrased. `call(ctx)` is the stale call, valid under the base// schema. `ops[kind]` lists mutation variants; the seed picks one.const TOOLS = [ { name: "issues.create", v: "3.2.0", desc: "Create an issue in a repository.", props: { repo: S("Repository as owner/name"), title: S("Issue title"), body: S("Markdown body"), labels: A("Label names"), kind: E("Issue kind", ["bug", "feature", "chore"]), visibility: E("Who can see it", ["public", "maintainers"]) }, req: ["repo", "title", "kind", "visibility"], vars: (r) => ({ repo: pick(r, ["acme/widgets", "northwind/shop", "globex/portal", "initech/billing"]), title: pick(r, ["Dark mode", "Export CSV", "SSO login", "Mobile layout"]), body: pick(r, ["Add a dark theme.", "See the attached spec.", "Requested by the design team.", "Blocked on the API refresh."]), label: pick(r, ["ui", "backend", "billing", "docs"]), kind: pick(r, ["feature", "bug", "chore"]), visibility: pick(r, ["maintainers", "public"]), }), ask: (c, w = {}) => `In ${c.repo} open a '${w.kind ?? c.kind}' issue titled '${c.title}' with body '${c.body}', label ${c.label}, visible to ${w.visibility ?? c.visibility}.`, call: (c) => ({ repo: c.repo, title: c.title, body: c.body, labels: [c.label], kind: c.kind, visibility: c.visibility }), ops: { renamedField: [ (c, r) => ({ field: "title", to: pick(r, ["subject", "headline", "name"]) }), (c, r) => ({ field: "body", to: pick(r, ["details", "description", "content"]) }), (c, r) => ({ field: "labels", to: pick(r, ["label_list", "tags"]) }), ], newRequired: [ (c, r) => ({ field: "severity", schema: E("Triage severity", ["low", "medium", "high"]), value: pick(r, ["low", "medium", "high"]) }), (c, r) => ({ field: pick(r, ["milestone", "sprint"]), schema: S("Iteration name"), value: `iter-${int(r, 3, 40)}` }), ], enumChange: [ () => ({ field: "kind", to: ["defect", "enhancement", "task"], map: { bug: "defect", feature: "enhancement", chore: "task" } }), () => ({ field: "kind", to: ["bug_report", "feature_request", "maintenance"], map: { bug: "bug_report", feature: "feature_request", chore: "maintenance" } }), () => ({ field: "visibility", to: ["everyone", "restricted"], map: { public: "everyone", maintainers: "restricted" } }), ], splitEndpoint: [ () => ({ field: "visibility", children: { public: "issues.create_public", maintainers: "issues.create_team" } }), () => ({ field: "kind", children: { bug: "issues.report_bug", feature: "issues.request_feature", chore: "issues.log_chore" } }), ], typeChange: [(c) => ({ field: "labels", to: S("Comma-separated label names"), value: c.label })], }, }, { name: "charges.create", v: "2.8.1", desc: "Create a payment charge.", props: { customer: S("Customer id"), amount: N("Amount in dollars"), currency: E("Settlement currency", ["usd", "eur", "gbp"]), capture: E("Capture mode", ["auto", "manual"]), description: S("Statement text") }, req: ["customer", "amount", "currency", "capture"], vars: (r) => ({ customer: `cus_${int(r, 1000, 9999)}`, amount: usd(r), currency: pick(r, ["usd", "eur", "gbp"]), capture: pick(r, ["auto", "manual"]), description: `Order ${int(r, 100, 999)}`, }), ask: (c, w = {}) => `Charge customer ${c.customer} ${c.amount.toFixed(2)} in '${w.currency ?? c.currency}' for '${c.description}' with ${w.capture ?? c.capture} capture.`, call: (c) => ({ customer: c.customer, amount: c.amount, currency: c.currency, capture: c.capture, description: c.description }), ops: { renamedField: [ (c, r) => ({ field: "description", to: pick(r, ["memo", "note", "statement_text"]) }), (c, r) => ({ field: "customer", to: pick(r, ["customer_id", "account", "buyer"]) }), (c, r) => ({ field: "amount", to: pick(r, ["total", "charge_amount"]) }), ], newRequired: [ (c, r) => ({ field: "idempotency_key", schema: S("Unique key to retry safely"), value: `req-${int(r, 1000, 9999)}` }), (c, r) => ({ field: "receipt_email", schema: S("Where to send the receipt"), value: email(r) }), ], enumChange: [ () => ({ field: "currency", to: ["USD", "EUR", "GBP", "JPY"], map: { usd: "USD", eur: "EUR", gbp: "GBP" } }), () => ({ field: "currency", to: ["usd_fiat", "eur_fiat", "gbp_fiat"], map: { usd: "usd_fiat", eur: "eur_fiat", gbp: "gbp_fiat" } }), () => ({ field: "capture", to: ["immediate", "deferred"], map: { auto: "immediate", manual: "deferred" } }), ], splitEndpoint: [ () => ({ field: "capture", children: { auto: "charges.create_capture", manual: "charges.authorize" } }), () => ({ field: "currency", children: { usd: "charges.create_usd", eur: "charges.create_eur", gbp: "charges.create_gbp" } }), ], typeChange: [ (c) => ({ field: "amount", to: I("Amount in cents"), value: Math.round(c.amount * 100) }), (c) => ({ field: "amount", to: S("Amount as a decimal string"), value: c.amount.toFixed(2) }), ], }, }, { name: "messages.post", v: "5.1.0", desc: "Post a message to a chat channel.", props: { channel: S("Channel name"), text: S("Message text"), attachments: A("Attachment URLs"), priority: E("Delivery priority", ["normal", "high", "urgent"]), audience: E("Who may read it", ["everyone", "admins"]) }, req: ["channel", "text", "priority", "audience"], vars: (r) => ({ channel: pick(r, ["#ops", "#dev", "#alerts"]), text: pick(r, ["Deploy finished.", "The build is green.", "Rollback started.", "Maintenance begins at midnight."]), attachment: `https://ci.example/build/${int(r, 2, 98)}`, priority: pick(r, ["normal", "high", "urgent"]), audience: pick(r, ["everyone", "admins"]), }), ask: (c, w = {}) => `Post '${c.text}' to ${c.channel} with attachment ${c.attachment} at '${w.priority ?? c.priority}' priority for ${w.audience ?? c.audience}.`, call: (c) => ({ channel: c.channel, text: c.text, attachments: [c.attachment], priority: c.priority, audience: c.audience }), ops: { renamedField: [ (c, r) => ({ field: "text", to: pick(r, ["body", "message", "content"]) }), (c, r) => ({ field: "channel", to: pick(r, ["room", "destination"]) }), (c, r) => ({ field: "attachments", to: pick(r, ["files", "links", "media"]) }), ], newRequired: [ (c, r) => ({ field: "team_id", schema: S("Workspace team id"), value: `T${int(r, 2, 9)}${digits(r, 4)}` }), (c, r) => ({ field: "workspace", schema: S("Workspace slug"), value: pick(r, ["acme", "globex", "initech"]) }), ], enumChange: [ () => ({ field: "priority", to: ["low", "elevated", "critical"], map: { normal: "low", high: "elevated", urgent: "critical" } }), () => ({ field: "priority", to: ["p3", "p2", "p1"], map: { normal: "p3", high: "p2", urgent: "p1" } }), () => ({ field: "audience", to: ["public_room", "staff_only"], map: { everyone: "public_room", admins: "staff_only" } }), ], splitEndpoint: [ () => ({ field: "audience", children: { everyone: "messages.post_channel", admins: "messages.post_admins" } }), () => ({ field: "priority", children: { normal: "messages.post_normal", high: "messages.post_priority", urgent: "messages.post_urgent" } }), ], typeChange: [(c) => ({ field: "attachments", to: S("Single attachment URL"), value: c.attachment })], }, }, { name: "events.create", v: "4.0.2", desc: "Create a calendar event.", props: { calendar_id: S("Calendar id"), title: S("Event title"), start: S("ISO 8601 start time"), duration_min: I("Length in minutes"), attendees: A("Attendee emails"), status: E("Event status", ["confirmed", "tentative", "cancelled"]), scope: E("Calendar scope", ["personal", "shared"]) }, req: ["calendar_id", "title", "start", "status", "scope"], vars: (r) => ({ calendar: pick(r, ["cal_main", "cal_team", "cal_ops"]), title: pick(r, ["Quarterly review", "Sprint demo", "Board sync"]), start: `2026-${pick(r, ["10", "11", "12"])}-${pick(r, ["02", "09", "17", "24"])}T${pick(r, ["09", "14", "15", "18"])}:00:00Z`, duration: pick(r, [30, 45, 60, 90]), attendees: [email(r), email(r)], status: pick(r, ["confirmed", "tentative", "cancelled"]), scope: pick(r, ["personal", "shared"]), }), ask: (c, w = {}) => `On calendar ${c.calendar} create '${c.title}' starting ${c.start} lasting ${c.duration} minutes with attendees ${c.attendees.join(" and ")}, status '${w.status ?? c.status}', on the ${w.scope ?? c.scope} calendar.`, call: (c) => ({ calendar_id: c.calendar, title: c.title, start: c.start, duration_min: c.duration, attendees: c.attendees, status: c.status, scope: c.scope }), ops: { renamedField: [ (c, r) => ({ field: "title", to: pick(r, ["summary", "name", "headline"]) }), (c, r) => ({ field: "start", to: pick(r, ["start_time", "begins", "starts_at"]) }), (c, r) => ({ field: "attendees", to: pick(r, ["invitees", "guests", "participants"]) }), ], newRequired: [ (c, r) => ({ field: "timezone", schema: S("IANA timezone"), value: pick(r, ["America/Toronto", "Europe/Berlin", "UTC"]) }), (c, r) => ({ field: "reminder_min", schema: I("Minutes before to remind"), value: pick(r, [5, 10, 15, 30]) }), ], enumChange: [ () => ({ field: "status", to: ["accepted", "maybe", "declined"], map: { confirmed: "accepted", tentative: "maybe", cancelled: "declined" } }), () => ({ field: "status", to: ["going", "uncertain", "out"], map: { confirmed: "going", tentative: "uncertain", cancelled: "out" } }), () => ({ field: "scope", to: ["private", "team"], map: { personal: "private", shared: "team" } }), ], splitEndpoint: [ () => ({ field: "scope", children: { personal: "events.create_personal", shared: "events.create_shared" } }), () => ({ field: "status", children: { confirmed: "events.create_confirmed", tentative: "events.create_tentative", cancelled: "events.create_cancelled" } }), ], typeChange: [ (c) => ({ field: "duration_min", to: S("ISO 8601 duration"), value: `PT${c.duration}M` }), (c) => ({ field: "attendees", to: S("Comma-separated attendee emails"), value: c.attendees.join(",") }), ], }, }, { name: "tickets.open", v: "2.4.0", desc: "Open a support ticket.", props: { requester: S("Requester email"), subject: S("Ticket subject"), comment: S("First comment"), tags: A("Tag names"), priority: E("Ticket priority", ["low", "normal", "high", "urgent"]), queue: E("Routing queue", ["support", "billing"]) }, req: ["requester", "subject", "comment", "priority", "queue"], vars: (r) => ({ requester: email(r), subject: pick(r, ["Invoice mismatch", "Login fails", "Refund missing", "Cannot export"]), comment: pick(r, ["Billed twice in October.", "Error 500 on sign-in.", "Money never arrived.", "Export stalls at 90%."]), tag: pick(r, ["billing", "auth", "refunds"]), priority: pick(r, ["low", "normal", "high", "urgent"]), queue: pick(r, ["support", "billing"]), }), ask: (c, w = {}) => `Open a ticket in the '${w.queue ?? c.queue}' queue for ${c.requester} titled '${c.subject}' saying '${c.comment}', tag ${c.tag}, priority '${w.priority ?? c.priority}'.`, call: (c) => ({ requester: c.requester, subject: c.subject, comment: c.comment, tags: [c.tag], priority: c.priority, queue: c.queue }), ops: { renamedField: [ (c, r) => ({ field: "subject", to: pick(r, ["title", "headline", "summary"]) }), (c, r) => ({ field: "comment", to: pick(r, ["body", "message", "description"]) }), (c, r) => ({ field: "requester", to: pick(r, ["email", "customer", "from"]) }), ], newRequired: [ (c, r) => ({ field: "brand_id", schema: I("Brand to file under"), value: int(r, 3, 9) }), (c, r) => ({ field: "product", schema: S("Product area"), value: pick(r, ["billing", "mobile", "api"]) }), ], enumChange: [ () => ({ field: "priority", to: ["p3", "p2", "p1", "p0"], map: { low: "p3", normal: "p2", high: "p1", urgent: "p0" } }), () => ({ field: "priority", to: ["minor", "standard", "major", "blocker"], map: { low: "minor", normal: "standard", high: "major", urgent: "blocker" } }), () => ({ field: "queue", to: ["helpdesk", "accounts"], map: { support: "helpdesk", billing: "accounts" } }), ], splitEndpoint: [ () => ({ field: "queue", children: { support: "tickets.open_support", billing: "tickets.open_billing" } }), () => ({ field: "priority", children: { low: "tickets.open_low", normal: "tickets.open_normal", high: "tickets.open_high", urgent: "tickets.open_urgent" } }), ], typeChange: [(c) => ({ field: "tags", to: S("Comma-separated tags"), value: c.tag })], }, }, { name: "emails.send", v: "3.0.0", desc: "Send a transactional email.", props: { to: S("Recipient address"), subject: S("Subject line"), body: S("Plain text body"), cc: A("CC addresses"), importance: E("Importance flag", ["normal", "high"]), audience: E("Recipient class", ["customer", "internal"]) }, req: ["to", "subject", "body", "importance", "audience"], vars: (r) => ({ to: email(r), subject: pick(r, ["Receipt #311", "Welcome aboard", "Your invoice", "Password reset"]), body: pick(r, ["Thanks for your order.", "Here is your receipt.", "Reset instructions inside."]), cc: email(r), importance: pick(r, ["normal", "high"]), audience: pick(r, ["customer", "internal"]), }), ask: (c, w = {}) => `Email ${c.to} subject '${c.subject}' body '${c.body}', cc ${c.cc}, '${w.importance ?? c.importance}' importance, ${w.audience ?? c.audience} audience.`, call: (c) => ({ to: c.to, subject: c.subject, body: c.body, cc: [c.cc], importance: c.importance, audience: c.audience }), ops: { renamedField: [ (c, r) => ({ field: "body", to: pick(r, ["html", "text", "message"]) }), (c, r) => ({ field: "subject", to: pick(r, ["headline", "title"]) }), (c, r) => ({ field: "to", to: pick(r, ["recipient", "address"]) }), ], newRequired: [ (c, r) => ({ field: "campaign_id", schema: S("Campaign tag"), value: `cmp-${int(r, 10, 99)}` }), (c, r) => ({ field: "reply_to", schema: S("Reply-to address"), value: email(r) }), ], enumChange: [ () => ({ field: "importance", to: ["routine", "priority"], map: { normal: "routine", high: "priority" } }), () => ({ field: "importance", to: ["low_flag", "flagged"], map: { normal: "low_flag", high: "flagged" } }), () => ({ field: "audience", to: ["external", "staff"], map: { customer: "external", internal: "staff" } }), ], splitEndpoint: [ () => ({ field: "audience", children: { customer: "emails.send_customer", internal: "emails.send_internal" } }), () => ({ field: "importance", children: { normal: "emails.send_normal", high: "emails.send_urgent" } }), ], typeChange: [ (c) => ({ field: "cc", to: S("Comma-separated CC addresses"), value: c.cc }), (c) => ({ field: "to", to: A("Recipient addresses"), value: [c.to] }), ], }, }, { name: "objects.upload", v: "6.1.3", desc: "Upload an object to a storage bucket.", props: { bucket: S("Bucket name"), key: S("Object key"), content_type: S("MIME type"), tags: A("Object tags"), storage: E("Storage class", ["standard", "infrequent", "archive"]), acl: E("Access policy", ["private", "public"]) }, req: ["bucket", "key", "content_type", "storage", "acl"], vars: (r) => ({ bucket: pick(r, ["assets-prod", "media-eu", "backups", "static"]), ...pick(r, [{ key: "img/hero.png", ct: "image/png" }, { key: "docs/guide.pdf", ct: "application/pdf" }, { key: "video/intro.mp4", ct: "video/mp4" }, { key: "css/site.css", ct: "text/css" }]), tags: pick(r, [["web", "hero"], ["marketing"], ["assets", "public"], ["img", "hero", "web"]]), storage: pick(r, ["standard", "infrequent", "archive"]), acl: pick(r, ["private", "public"]), }), ask: (c, w = {}) => `Upload ${c.key} (${c.ct}) to bucket ${c.bucket}, tags ${c.tags.join(" and ")}, '${w.storage ?? c.storage}' storage, ${w.acl ?? c.acl} acl.`, call: (c) => ({ bucket: c.bucket, key: c.key, content_type: c.ct, tags: c.tags, storage: c.storage, acl: c.acl }), ops: { renamedField: [ (c, r) => ({ field: "key", to: pick(r, ["path", "object_key", "filename"]) }), (c, r) => ({ field: "bucket", to: pick(r, ["container", "vault"]) }), (c, r) => ({ field: "content_type", to: pick(r, ["mime_type", "media_type"]) }), ], newRequired: [ (c, r) => ({ field: "checksum", schema: S("Content checksum"), value: `sha256:${digits(r, 4)}` }), (c, r) => ({ field: "region", schema: S("Storage region"), value: pick(r, ["us-east-1", "eu-west-1", "ca-central-1"]) }), ], enumChange: [ () => ({ field: "storage", to: ["hot", "cool", "cold"], map: { standard: "hot", infrequent: "cool", archive: "cold" } }), () => ({ field: "storage", to: ["frequent", "rare", "frozen"], map: { standard: "frequent", infrequent: "rare", archive: "frozen" } }), () => ({ field: "acl", to: ["restricted", "open"], map: { private: "restricted", public: "open" } }), ], splitEndpoint: [ () => ({ field: "acl", children: { private: "objects.upload_private", public: "objects.upload_public" } }), () => ({ field: "storage", children: { standard: "objects.upload_standard", infrequent: "objects.upload_infrequent", archive: "objects.upload_archive" } }), ], typeChange: [(c) => ({ field: "tags", to: S("Comma-separated tags"), value: c.tags.join(",") })], }, }, { name: "search.query", v: "1.9.0", desc: "Run a keyword search.", props: { q: S("Query text"), limit: I("Max results"), filters: A("Filter expressions"), index: E("Index to search", ["docs", "code", "issues"]), scope: E("Result scope", ["org", "user"]) }, req: ["q", "limit", "index", "scope"], vars: (r) => ({ q: pick(r, ["refund policy", "uptime sla", "api keys", "rate limits"]), limit: int(r, 5, 50), filter: `${pick(r, ["country", "lang", "type"])}:${pick(r, ["ca", "us", "de", "en", "docs"])}`, index: pick(r, ["docs", "code", "issues"]), scope: pick(r, ["org", "user"]), }), ask: (c, w = {}) => `Search the '${w.index ?? c.index}' index for '${c.q}', limit ${c.limit}, filter ${c.filter}, scope ${w.scope ?? c.scope}.`, call: (c) => ({ q: c.q, limit: c.limit, filters: [c.filter], index: c.index, scope: c.scope }), ops: { renamedField: [ (c, r) => ({ field: "q", to: pick(r, ["query", "term", "text"]) }), (c, r) => ({ field: "limit", to: pick(r, ["max_results", "top_k", "count"]) }), (c, r) => ({ field: "filters", to: pick(r, ["constraints", "clauses"]) }), ], newRequired: [ (c, r) => ({ field: "locale", schema: S("Result locale"), value: pick(r, ["en-CA", "en-US", "fr-FR", "de-DE"]) }), (c, r) => ({ field: "tenant", schema: S("Tenant id"), value: `tn-${int(r, 10, 99)}` }), ], enumChange: [ () => ({ field: "index", to: ["documentation", "source", "tickets"], map: { docs: "documentation", code: "source", issues: "tickets" } }), () => ({ field: "index", to: ["manual", "repo", "support"], map: { docs: "manual", code: "repo", issues: "support" } }), () => ({ field: "scope", to: ["organization", "personal"], map: { org: "organization", user: "personal" } }), ], splitEndpoint: [ () => ({ field: "scope", children: { org: "search.query_org", user: "search.query_user" } }), () => ({ field: "index", children: { docs: "search.query_docs", code: "search.query_code", issues: "search.query_issues" } }), ], typeChange: [ (c) => ({ field: "filters", to: S("Comma-separated filters"), value: c.filter }), (c) => ({ field: "limit", to: S("Max results as a string"), value: String(c.limit) }), ], }, }, { name: "sms.send", v: "7.3.1", desc: "Send a text message.", props: { to: S("Recipient number"), from: S("Sender number"), body: S("Message body"), media: A("Media URLs"), priority: E("Send priority", ["standard", "express"]), channel: E("Bearer channel", ["sms", "mms"]) }, req: ["to", "from", "body", "priority", "channel"], vars: (r) => ({ to: phone(r), from: phone(r), body: pick(r, [code(r), "Your package shipped.", "Appointment reminder.", "Delivery delayed by one day."]), media: `https://img.example/${pick(r, ["x", "qr", "photo", "receipt"])}.png`, priority: pick(r, ["standard", "express"]), channel: pick(r, ["sms", "mms"]), }), ask: (c, w = {}) => `Text ${c.to} from ${c.from} saying '${c.body}' with media ${c.media}, '${w.priority ?? c.priority}' priority over ${w.channel ?? c.channel}.`, call: (c) => ({ to: c.to, from: c.from, body: c.body, media: [c.media], priority: c.priority, channel: c.channel }), ops: { renamedField: [ (c, r) => ({ field: "body", to: pick(r, ["message", "text"]) }), (c, r) => ({ field: "media", to: pick(r, ["attachments", "images"]) }), (c, r) => ({ field: "to", to: pick(r, ["recipient", "number"]) }), ], newRequired: [ (c, r) => ({ field: "app_id", schema: S("Sending application id"), value: `app-${int(r, 100, 999)}` }), (c, r) => ({ field: "campaign", schema: S("Campaign slug"), value: pick(r, ["otp", "alerts", "marketing"]) }), ], enumChange: [ () => ({ field: "priority", to: ["economy", "flash"], map: { standard: "economy", express: "flash" } }), () => ({ field: "priority", to: ["bulk", "instant"], map: { standard: "bulk", express: "instant" } }), () => ({ field: "channel", to: ["text", "rich"], map: { sms: "text", mms: "rich" } }), ], splitEndpoint: [ () => ({ field: "channel", children: { sms: "sms.send_text", mms: "sms.send_media" } }), () => ({ field: "priority", children: { standard: "sms.send_standard", express: "sms.send_express" } }), ], typeChange: [(c) => ({ field: "media", to: S("Single media URL"), value: c.media })], }, }, { name: "deploys.trigger", v: "2.2.0", desc: "Trigger a deployment.", props: { service: S("Service name"), ref: S("Git ref or tag"), replicas: I("Replica count"), notify: A("Notification channels"), env: E("Target environment", ["staging", "production"]), strategy: E("Rollout strategy", ["rolling", "bluegreen"]) }, req: ["service", "ref", "replicas", "env", "strategy"], vars: (r) => ({ service: pick(r, ["api-gateway", "web-frontend", "worker-pool", "billing-svc"]), ref: `v${int(r, 1, 5)}.${int(r, 0, 20)}.${int(r, 0, 9)}`, replicas: int(r, 1, 5), notify: pick(r, [["#deploys"], ["#ops", "#deploys"], ["#releases"]]), env: pick(r, ["staging", "production"]), strategy: pick(r, ["rolling", "bluegreen"]), }), ask: (c, w = {}) => `Deploy ${c.service} ref ${c.ref} with ${c.replicas} replicas to '${w.env ?? c.env}' using a ${w.strategy ?? c.strategy} strategy; notify ${c.notify.join(" and ")}.`, call: (c) => ({ service: c.service, ref: c.ref, replicas: c.replicas, notify: c.notify, env: c.env, strategy: c.strategy }), ops: { renamedField: [ (c, r) => ({ field: "ref", to: pick(r, ["revision", "version", "commit"]) }), (c, r) => ({ field: "replicas", to: pick(r, ["count", "instances"]) }), (c, r) => ({ field: "service", to: pick(r, ["app", "workload"]) }), ], newRequired: [ (c, r) => ({ field: "ticket", schema: S("Change ticket id"), value: `CHG-${int(r, 1000, 9999)}` }), (c, r) => ({ field: "approver", schema: S("Approving manager"), value: email(r) }), ], enumChange: [ () => ({ field: "env", to: ["stage", "prod"], map: { staging: "stage", production: "prod" } }), () => ({ field: "env", to: ["prelive", "live"], map: { staging: "prelive", production: "live" } }), () => ({ field: "strategy", to: ["gradual", "canary"], map: { rolling: "gradual", bluegreen: "canary" } }), ], splitEndpoint: [ () => ({ field: "strategy", children: { rolling: "deploys.trigger_rolling", bluegreen: "deploys.trigger_bluegreen" } }), () => ({ field: "env", children: { staging: "deploys.trigger_staging", production: "deploys.trigger_production" } }), ], typeChange: [(c) => ({ field: "replicas", to: S("Replica count as a string"), value: String(c.replicas) })], }, }, { name: "contacts.update", v: "4.4.0", desc: "Update a CRM contact.", props: { contact_id: S("Contact id"), email: S("Email address"), phone: S("Phone number"), tags: A("Contact tags"), stage: E("Pipeline stage", ["lead", "prospect", "customer"]), owner: E("Owning team", ["sales", "support"]) }, req: ["contact_id", "email", "stage", "owner"], vars: (r) => ({ contact: `ct-${int(r, 100, 999)}`, email: email(r), phone: phone(r), tag: pick(r, ["vip", "trial", "churned", "enterprise"]), stage: pick(r, ["lead", "prospect", "customer"]), owner: pick(r, ["sales", "support"]), }), ask: (c, w = {}) => `Update contact ${c.contact}: email ${c.email}, phone ${c.phone}, tag ${c.tag}, stage '${w.stage ?? c.stage}', owner ${w.owner ?? c.owner}.`, call: (c) => ({ contact_id: c.contact, email: c.email, phone: c.phone, tags: [c.tag], stage: c.stage, owner: c.owner }), ops: { renamedField: [ (c, r) => ({ field: "phone", to: pick(r, ["phone_number", "mobile", "tel"]) }), (c, r) => ({ field: "email", to: pick(r, ["email_address", "mail"]) }), (c, r) => ({ field: "stage", to: pick(r, ["pipeline_stage", "phase"]) }), ], newRequired: [ (c, r) => ({ field: "source", schema: S("Attribution source"), value: pick(r, ["webinar-oct", "conf-2026", "referral", "ads"]) }), (c, r) => ({ field: "region", schema: S("Sales region"), value: pick(r, ["emea", "na", "apac"]) }), ], enumChange: [ () => ({ field: "stage", to: ["new", "qualified", "won"], map: { lead: "new", prospect: "qualified", customer: "won" } }), () => ({ field: "stage", to: ["cold", "warm", "closed"], map: { lead: "cold", prospect: "warm", customer: "closed" } }), () => ({ field: "owner", to: ["revenue", "care"], map: { sales: "revenue", support: "care" } }), ], splitEndpoint: [ () => ({ field: "owner", children: { sales: "contacts.update_sales", support: "contacts.update_support" } }), () => ({ field: "stage", children: { lead: "contacts.update_lead", prospect: "contacts.update_prospect", customer: "contacts.update_customer" } }), ], typeChange: [(c) => ({ field: "tags", to: S("Comma-separated tags"), value: c.tag })], }, }, { name: "payments.refund", v: "1.5.2", desc: "Refund a captured payment.", props: { payment_id: S("Payment id"), amount: N("Amount in dollars"), reason: E("Refund reason", ["duplicate", "fraud", "requested"]), method: E("Refund destination", ["card", "balance"]) }, req: ["payment_id", "amount", "reason", "method"], vars: (r) => ({ payment: `pay_${int(r, 1000, 9999)}`, amount: usd(r), reason: pick(r, ["duplicate", "fraud", "requested"]), method: pick(r, ["card", "balance"]), }), ask: (c, w = {}) => `Refund payment ${c.payment} for $${c.amount.toFixed(2)}, reason '${w.reason ?? c.reason}', back to ${w.method ?? c.method}.`, call: (c) => ({ payment_id: c.payment, amount: c.amount, reason: c.reason, method: c.method }), ops: { renamedField: [ (c, r) => ({ field: "payment_id", to: pick(r, ["transaction_id", "charge_id"]) }), (c, r) => ({ field: "reason", to: pick(r, ["cause", "explanation"]) }), (c, r) => ({ field: "amount", to: pick(r, ["total", "refund_amount"]) }), ], newRequired: [ (c, r) => ({ field: "note", schema: S("Refund note"), value: pick(r, ["double charge", "customer request", "fraud review"]) }), (c, r) => ({ field: "agent_id", schema: S("Agent issuing the refund"), value: `agt-${int(r, 10, 99)}` }), ], enumChange: [ () => ({ field: "reason", to: ["accidental", "suspected_fraud", "customer_request"], map: { duplicate: "accidental", fraud: "suspected_fraud", requested: "customer_request" } }), () => ({ field: "reason", to: ["duplicate_charge", "abuse", "buyer_asked"], map: { duplicate: "duplicate_charge", fraud: "abuse", requested: "buyer_asked" } }), () => ({ field: "method", to: ["source", "funds"], map: { card: "source", balance: "funds" } }), ], splitEndpoint: [ () => ({ field: "method", children: { card: "payments.refund_card", balance: "payments.refund_balance" } }), () => ({ field: "reason", children: { duplicate: "payments.refund_duplicate", fraud: "payments.refund_fraud", requested: "payments.refund_requested" } }), ], typeChange: [(c) => ({ field: "amount", to: I("Amount in cents"), value: Math.round(c.amount * 100) })], }, },];
function mulberry32(seed) { return () => { seed |= 0; seed = (seed + 0x6d2b79f5) | 0; let t = Math.imul(seed ^ (seed >>> 15), 1 | seed); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; };}
function canon(value) { if (Array.isArray(value)) return `[${value.map(canon).join(",")}]`; if (value && typeof value === "object") { return `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canon(value[k])}`).join(",")}}`; } return JSON.stringify(value);}
const clone = (v) => JSON.parse(JSON.stringify(v));
const spec = (name, desc, props, req, v) => ({ name, description: desc, schema_version: v, parameters: { type: "object", properties: props, required: req, additionalProperties: false },});
const OPERATORS = { renamedField(t, c, m, v) { const { field, to } = m; const props = Object.fromEntries(Object.entries(t.props).map(([k, s]) => [k === field ? to : k, s])); const args = Object.fromEntries(Object.entries(t.call(c)).map(([k, x]) => [k === field ? to : k, x])); return { schemas: [spec(t.name, t.desc, props, t.req.map((r) => (r === field ? to : r)), v)], ask: t.ask(c), expected: { name: t.name, arguments: args } }; }, newRequired(t, c, m, v) { return { schemas: [spec(t.name, t.desc, { ...t.props, [m.field]: m.schema }, [...t.req, m.field], v)], ask: `${t.ask(c)} New required field '${m.field}': set it to ${JSON.stringify(m.value)}.`, expected: { name: t.name, arguments: { ...t.call(c), [m.field]: m.value } }, }; }, enumChange(t, c, m, v) { // The request keeps the pre-migration wording; only the current schema // carries the old -> new value map, so copying the user's words emits the // stale value and scores 0. const legend = Object.entries(m.map).map(([a, b]) => `${a} -> ${b}`).join(", "); const props = { ...t.props, [m.field]: { ...t.props[m.field], enum: m.to, description: `${t.props[m.field].description}. Pre-migration values map as: ${legend}` } }; const use = m.map[t.call(c)[m.field]]; return { schemas: [spec(t.name, t.desc, props, t.req, v)], ask: t.ask(c), expected: { name: t.name, arguments: { ...t.call(c), [m.field]: use } } }; }, splitEndpoint(t, c, m, v) { const { field, children } = m; const schemas = Object.entries(children).map(([value, name]) => { const props = clone(t.props); delete props[field]; return spec(name, `${t.desc} (${field}: ${value})`, props, t.req.filter((r) => r !== field), v); }); const args = clone(t.call(c)); const chosen = args[field]; delete args[field]; return { schemas, ask: t.ask(c), expected: { name: children[chosen], arguments: args } }; }, typeChange(t, c, m, v) { const value = typeof m.value === "function" ? m.value(c) : m.value; return { schemas: [spec(t.name, t.desc, { ...t.props, [m.field]: m.to }, t.req, v)], ask: t.ask(c), expected: { name: t.name, arguments: { ...t.call(c), [m.field]: value } } }; },};
function buildPrompt(schemas, version, ask) { return [ `The tools below are the current interface. They were migrated to schema version ${version}; earlier versions used different names, fields, types, or endpoints. Follow the current schema exactly, even if you remember a different version.`, "", "CURRENT TOOLS:", JSON.stringify({ tools: schemas }, null, 2), "", "USER REQUEST:", ask, "", 'Respond with a single JSON object and nothing else: {"name": "<tool name>", "arguments": { ... }}', ].join("\n");}
function generate(seed, split) { const rng = mulberry32(seed); const prefix = split === "hidden" ? "smh" : "smu"; const tasks = []; for (const [ti, t] of TOOLS.entries()) { for (const [ki, kind] of KINDS.entries()) { const ctx = t.vars(rng); const variants = t.ops[kind]; const mutation = variants[Math.floor(rng() * variants.length)](ctx, rng); const major = Number(t.v.split(".")[0]) + 1; const v = `${major}.${Math.floor(rng() * 3)}.${Math.floor(rng() * 5)}`; const { schemas, ask, expected } = OPERATORS[kind](t, ctx, mutation, v); const stale = { name: t.name, arguments: t.call(ctx) }; if (canon(expected) === canon(stale)) throw new Error(`${t.name}/${kind}: expected equals stale`); tasks.push({ id: `${prefix}-${String(ti * 5 + ki + 1).padStart(2, "0")}`, kind: "single", prompt: buildPrompt(schemas, v, ask), expected: canon(expected), metadata: { seed, mutationKind: kind, tool: t.name, baseVersion: t.v, schemaVersion: v, stale: canon(stale) }, }); } } return tasks;}
const argv = process.argv.slice(2);const flag = (name) => { const i = argv.indexOf(name); return i === -1 ? undefined : argv[i + 1]; };const split = flag("--split") ?? "public";if (!["public", "hidden"].includes(split)) throw new Error("--split must be public or hidden");const seed = Number(flag("--seed") ?? (split === "hidden" ? NaN : PUBLIC_SEED));if (!Number.isInteger(seed)) throw new Error("hidden split requires --seed <n>");if (split === "hidden" && seed === PUBLIC_SEED) throw new Error("hidden split must not reuse the public seed");
const tasks = generate(seed, split);// Hidden output defaults to .hidden/ so it is gitignored and, unlike// data/, never inside the npm `files` list -- the tarball cannot leak it.const file = flag("--out") ?? (split === "hidden" ? ".hidden/tasks-hidden.jsonl" : "data/tasks.jsonl");// A hidden --out under data/ would sit inside the npm `files` list under a// name the e2e pack guard does not match, so refuse it outright.if (split === "hidden" && resolve(file).startsWith(`${resolve("data")}${sep}`)) throw new Error("hidden --out must not write inside data/ (it would ship to npm)");await mkdir(dirname(file), { recursive: true });await writeFile(file, tasks.map((task) => JSON.stringify(task)).join("\n") + "\n");console.log(`wrote ${tasks.length} ${split} tasks to ${file}`);LICENSEAdded+21
README.mdAdded+113
croissant.jsonAdded+216
data/PROVENANCE.mdAdded+13
data/tasks.jsonlAdded
scripts/gen-tasks.mjsAdded+579