@ancha-labs/cli 0.4.3 → 0.4.5

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.
@@ -170,7 +170,7 @@ function connectDefaults(detected) {
170
170
  const started = Array.isArray(detected?.evidence) && detected.evidence.includes("package.json") && /^(?:npm|pnpm) start$/.test(String(detected?.suggestions?.command ?? ""));
171
171
  return started ? { taskInputKind: "command", state: "stateless" } : {};
172
172
  }
173
- var toolNames = { slack: "Slack", "open-meteo": "Open-Meteo", datadog: "Datadog", pagerduty: "PagerDuty", github: "GitHub", "linkedin-ads": "LinkedIn Ads", salesforce: "Salesforce", gong: "Gong", "google-ads": "Google Ads", "chatgpt-ads": "ChatGPT Ads", hubspot: "HubSpot", ga4: "Google Analytics", gmail: "Gmail", "google-drive": "Google Drive", "amazon-s3": "Amazon S3", linear: "Linear", okta: "Okta", stripe: "Stripe", clerk: "Clerk", "better-stack": "Better Stack", notion: "Notion", attio: "Attio", dropbox: "Dropbox", resend: "Resend", "microsoft-word": "Microsoft Word", shopify: "Shopify", lob: "Lob", paypal: "PayPal", jira: "Jira", kalshi: "Kalshi", intercom: "Intercom", zendesk: "Zendesk", "google-calendar": "Google Calendar", twilio: "Twilio", asana: "Asana", discord: "Discord", sentry: "Sentry", airtable: "Airtable" };
173
+ var toolNames = { slack: "Slack", "open-meteo": "Open-Meteo", datadog: "Datadog", pagerduty: "PagerDuty", github: "GitHub", "linkedin-ads": "LinkedIn Ads", salesforce: "Salesforce", gong: "Gong", "google-ads": "Google Ads", "chatgpt-ads": "ChatGPT Ads", hubspot: "HubSpot", ga4: "Google Analytics", gmail: "Gmail", "google-drive": "Google Drive", "amazon-s3": "Amazon S3", linear: "Linear", okta: "Okta", stripe: "Stripe", clerk: "Clerk", "better-stack": "Better Stack", notion: "Notion", attio: "Attio", dropbox: "Dropbox", resend: "Resend", "microsoft-word": "Microsoft Word", shopify: "Shopify", lob: "Lob", paypal: "PayPal", jira: "Jira", kalshi: "Kalshi", intercom: "Intercom", zendesk: "Zendesk", "google-calendar": "Google Calendar", twilio: "Twilio", asana: "Asana", discord: "Discord", sentry: "Sentry", airtable: "Airtable", netsuite: "NetSuite" };
174
174
  var toolName = (name) => toolNames[name] ?? name;
175
175
  var toolLinks = (names) => names.map((name) => `<a class="tool-chip" href="/tools/${encodeURIComponent(name)}" data-nav>${h(toolName(name))}</a>`).join("");
176
176
  var toolDescription = (name) => ({ slack: "Channels, messages and threads", datadog: "Monitors, metrics and logs", pagerduty: "Incidents, on-call and escalation", github: "Repositories, pull requests and deployments" })[name] ?? "API capabilities";
@@ -729,6 +729,9 @@ function toolView(observation2, tool, options = {}) {
729
729
  if (!observation2.state?.[tool]) return empty2(`${toolName(tool)} data is unavailable for this trial.`);
730
730
  return renderers[tool](observation2, options);
731
731
  }
732
+ function recordsView(observation2, tool, options = {}) {
733
+ return projectedTool(observation2, tool, options);
734
+ }
732
735
  function projectedTool(o, tool, options) {
733
736
  const view = o.toolViews?.[tool], tables = list2(view?.tables), conversations = list2(view?.conversations), active = tables.find((t) => t.title === options.resource) ?? tables[0];
734
737
  if (!view) return empty2(`${toolName(tool)} records are not available in this capture.`);
@@ -1378,7 +1381,7 @@ function mountWorldWorkspace(node, options) {
1378
1381
  function render() {
1379
1382
  if (disposed) return;
1380
1383
  const currentRuns = selected ? setupRuns(runs, selected) : [], run = currentRuns[0], attempts = run?.attempts ?? [], tasks = selected?.tasks ?? [], choices = worldSetups(tests, world.id, agentId);
1381
- node.innerHTML = `<div class="ww-workspace"><header class="ww-header"><h1>${h(world.name)}</h1><div class="ww-world-actions"><label class="ww-agent-select">Agent<select data-ww-select="agent"><option value="" disabled>Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${a.id === agentId ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select></label><button type="button" data-ww="configure">Configure</button>${selected ? options.runActions?.(selected.id) ?? button("Run tasks", "run-saved-test", selected.id, "primary") : ""}</div></header>${peopleSection(world)}<p class="ww-error" role="alert" ${error ? "" : "hidden"}>${h(error)}</p>${errors.map((e) => `<p class="ww-error" role="alert">${h(e.message)}</p>`).join("")}${!loaded ? '<p role="status">Loading tasks\u2026</p>' : ""}${choices.length > 1 ? `<label class="ww-setup-select">Configuration<select data-ww-select="test">${!selected ? '<option value="" selected disabled>New configuration</option>' : ""}${choices.map((t) => `<option value="${h(t.id)}" ${t.id === selected?.id ? "selected" : ""}>${h(t.name)}</option>`).join("")}</select></label>` : ""}${loaded && configure ? configuration2() : loaded ? `${summaryWidgets(attempts, hasChecks(run?.tasks ?? tasks), run?.summary?.counts?.requested ?? attempts.length)}<div class="ww-section-heading"><h2>Tasks${tasks.length ? ` <span class="ww-task-count">${tasks.length}</span>` : ""}</h2><div class="actions">${worldHistory(runs, world.id, agentId || void 0).length || selected ? `<button type="button" data-ww="history" aria-expanded="${showHistory}">History</button>` : ""}<button type="button" data-ww="configure">${tasks.length ? "Edit tasks" : "Add tasks"}</button></div></div>${tasks.length ? `<section class="ww-task-table"><div class="ww-table-head"><span>Task</span><span>Result</span><span>Attempts</span><span>Median</span><span></span></div>${tasks.map((task, index) => {
1384
+ node.innerHTML = `<div class="ww-workspace"><header class="ww-header"><h1>${h(world.name)}</h1><div class="ww-world-actions"><label class="ww-agent-select">Agent<select data-ww-select="agent"><option value="" disabled>Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${a.id === agentId ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select></label><a data-nav class="button-link" href="${base}?data=1">View data</a><button type="button" data-ww="configure">Configure</button>${selected ? options.runActions?.(selected.id) ?? button("Run tasks", "run-saved-test", selected.id, "primary") : ""}</div></header>${peopleSection(world)}<p class="ww-error" role="alert" ${error ? "" : "hidden"}>${h(error)}</p>${errors.map((e) => `<p class="ww-error" role="alert">${h(e.message)}</p>`).join("")}${!loaded ? '<p role="status">Loading tasks\u2026</p>' : ""}${choices.length > 1 ? `<label class="ww-setup-select">Configuration<select data-ww-select="test">${!selected ? '<option value="" selected disabled>New configuration</option>' : ""}${choices.map((t) => `<option value="${h(t.id)}" ${t.id === selected?.id ? "selected" : ""}>${h(t.name)}</option>`).join("")}</select></label>` : ""}${loaded && configure ? configuration2() : loaded ? `${summaryWidgets(attempts, hasChecks(run?.tasks ?? tasks), run?.summary?.counts?.requested ?? attempts.length)}<div class="ww-section-heading"><h2>Tasks${tasks.length ? ` <span class="ww-task-count">${tasks.length}</span>` : ""}</h2><div class="actions">${worldHistory(runs, world.id, agentId || void 0).length || selected ? `<button type="button" data-ww="history" aria-expanded="${showHistory}">History</button>` : ""}<button type="button" data-ww="configure">${tasks.length ? "Edit tasks" : "Add tasks"}</button></div></div>${tasks.length ? `<section class="ww-task-table"><div class="ww-table-head"><span>Task</span><span>Result</span><span>Attempts</span><span>Median</span><span></span></div>${tasks.map((task, index) => {
1382
1385
  const list4 = attempts.filter((a) => a.taskId === task.id), taskURL = run ? `/playgrounds/${enc(run.id)}?task=${enc(task.id)}${list4[0] ? "&attempt=" + enc(list4[0].id) : ""}` : "";
1383
1386
  return `<article class="ww-task-row"><div class="ww-task-identity">${taskURL ? `<a data-nav class="ww-task-name" href="${taskURL}"><span class="ww-ordinal">${index + 1}</span><strong>${h(label(task, index))}</strong></a>` : `<strong class="ww-task-name"><span class="ww-ordinal">${index + 1}</span>${h(label(task, index))}</strong>`}<p class="ww-task-prompt" title="${h(task.prompt)}">${h(task.prompt)}</p></div>${(() => {
1384
1387
  const o = taskOutcome(list4, hasChecks([task]), Number(task.attempts) || list4.length);
@@ -1536,6 +1539,19 @@ function worldHasActiveRuns(runs, worldId) {
1536
1539
  return runs.some((run) => !terminal(run.status) && (run.entries?.length ? run.entries.some((entry) => entry.world?.id === worldId) : run.world?.id === worldId));
1537
1540
  }
1538
1541
 
1542
+ // frontend/src/world-data.ts
1543
+ function worldDataPage(title2, context, back, data, base, query) {
1544
+ const tools = Array.isArray(data.tools) ? data.tools : [], tool = tools.includes(query.get("tool") ?? "") ? query.get("tool") : tools[0];
1545
+ const link = (name) => {
1546
+ const next = new URLSearchParams(base.split("?")[1]);
1547
+ next.set("tool", name);
1548
+ return `${base.split("?")[0]}?${next}`;
1549
+ };
1550
+ const tabs = tools.map((name) => `<a data-nav class="${name === tool ? "active" : ""}" href="${h(link(name))}" ${name === tool ? 'aria-current="page"' : ""}><span class="world-data-logo" aria-hidden="true">${toolLogo(name)}</span>${h(toolName(name))}</a>`).join("");
1551
+ const options = Object.fromEntries([...query].filter(([key]) => key === "resource" || key === "conversation"));
1552
+ return `<a data-nav class="back" href="${h(back.href)}">\u2190 ${h(back.label)}</a><header class="page-head"><div><h1>${h(title2)}</h1><p class="page-meta">${h(context)}</p></div></header><p class="world-data-note">Starting data, before any run. Read-only.</p>` + (tools.length ? `<nav class="tabs world-data-tabs" aria-label="Tools">${tabs}</nav>${recordsView(data, tool, { ...options, embedded: true, baseHref: link(tool) })}` : '<div class="quiet-empty">This world has no tools.</div>');
1553
+ }
1554
+
1539
1555
  // frontend/src/workspace-view.ts
1540
1556
  var VIEW_SECTIONS = /* @__PURE__ */ new Set(["worlds", "agents", "playgrounds", "settings", "help", "tools"]);
1541
1557
  var viewMode = (boot2) => boot2.mode === "view";
@@ -1573,8 +1589,8 @@ function startHeartbeat(ping, options = {}) {
1573
1589
  }
1574
1590
 
1575
1591
  // frontend/src/tool-meta.ts
1576
- var toolOrder = ["slack", "discord", "github", "linear", "jira", "asana", "notion", "microsoft-word", "airtable", "gmail", "resend", "lob", "twilio", "google-calendar", "google-drive", "dropbox", "amazon-s3", "okta", "clerk", "stripe", "paypal", "shopify", "kalshi", "datadog", "sentry", "better-stack", "pagerduty", "hubspot", "salesforce", "attio", "intercom", "zendesk", "gong", "ga4", "google-ads", "linkedin-ads", "chatgpt-ads", "open-meteo"];
1577
- var toolCategory = { slack: "Team chat", discord: "Community chat", asana: "Projects", airtable: "Databases", sentry: "Errors", github: "Code", gmail: "Email", resend: "Email", "google-drive": "Files", dropbox: "Files", "amazon-s3": "Files", linear: "Issues", okta: "Identity", clerk: "Identity", stripe: "Payments", paypal: "Payments", shopify: "Commerce", lob: "Mail", jira: "Issues", kalshi: "Markets", intercom: "Support", zendesk: "Support", "google-calendar": "Calendar", twilio: "SMS & voice", notion: "Docs", "microsoft-word": "Docs", datadog: "Monitoring", "better-stack": "Uptime", pagerduty: "Incidents", hubspot: "CRM", salesforce: "CRM", attio: "CRM", gong: "Sales calls", ga4: "Analytics", "google-ads": "Ads", "linkedin-ads": "Ads", "chatgpt-ads": "Ads", "open-meteo": "Weather" };
1592
+ var toolOrder = ["slack", "discord", "github", "linear", "jira", "asana", "notion", "microsoft-word", "airtable", "netsuite", "gmail", "resend", "lob", "twilio", "google-calendar", "google-drive", "dropbox", "amazon-s3", "okta", "clerk", "stripe", "paypal", "shopify", "kalshi", "datadog", "sentry", "better-stack", "pagerduty", "hubspot", "salesforce", "attio", "intercom", "zendesk", "gong", "ga4", "google-ads", "linkedin-ads", "chatgpt-ads", "open-meteo"];
1593
+ var toolCategory = { slack: "Team chat", discord: "Community chat", asana: "Projects", airtable: "Databases", netsuite: "Finance", sentry: "Errors", github: "Code", gmail: "Email", resend: "Email", "google-drive": "Files", dropbox: "Files", "amazon-s3": "Files", linear: "Issues", okta: "Identity", clerk: "Identity", stripe: "Payments", paypal: "Payments", shopify: "Commerce", lob: "Mail", jira: "Issues", kalshi: "Markets", intercom: "Support", zendesk: "Support", "google-calendar": "Calendar", twilio: "SMS & voice", notion: "Docs", "microsoft-word": "Docs", datadog: "Monitoring", "better-stack": "Uptime", pagerduty: "Incidents", hubspot: "CRM", salesforce: "CRM", attio: "CRM", gong: "Sales calls", ga4: "Analytics", "google-ads": "Ads", "linkedin-ads": "Ads", "chatgpt-ads": "Ads", "open-meteo": "Weather" };
1578
1594
  var starterCounts = {
1579
1595
  slack: [["users", "Members"], ["channels", "Channels"], ["messages", "Messages"]],
1580
1596
  github: [["repos", "Repositories"], ["pulls", "Pull requests"], ["issues", "Issues"], ["commits", "Commits"]],
@@ -1613,7 +1629,8 @@ var starterCounts = {
1613
1629
  asana: [["projects", "Projects"], ["tasks", "Tasks"], ["subtasks", "Subtasks"], ["comments", "Comments"]],
1614
1630
  discord: [["channels", "Channels"], ["threads", "Threads"], ["messages", "Messages"], ["members", "Members"]],
1615
1631
  sentry: [["projects", "Projects"], ["issues", "Issues"], ["releases", "Releases"], ["members", "Members"]],
1616
- airtable: [["bases", "Bases"], ["tables", "Tables"], ["records", "Records"], ["comments", "Comments"]]
1632
+ airtable: [["bases", "Bases"], ["tables", "Tables"], ["records", "Records"], ["comments", "Comments"]],
1633
+ netsuite: [["customers", "Customers"], ["vendors", "Vendors"], ["transactions", "Transactions"]]
1617
1634
  };
1618
1635
  var list3 = (value) => Array.isArray(value) ? value : [];
1619
1636
  var sum = (values) => values.reduce((total, n) => total + n, 0);
@@ -1639,7 +1656,7 @@ function starterCount(tool, key, state) {
1639
1656
  }
1640
1657
 
1641
1658
  // frontend/src/generated/coding-agent-skill.ts
1642
- var codingAgentSkill = "---\nname: ancha\ndescription: Test, debug and fix an AI agent (a Slack bot, a support or on-call agent) against stateful replicas of the tools it uses, and prove a fix with graded runs. Use when asked to test an agent with Ancha, or in a repository that has ancha.yaml.\n---\n\n# Ancha\n\nAncha gives an AI agent the other side of its job: stateful replicas of the tools it uses (Slack, GitHub, Datadog, PagerDuty and more), seeded with one fictional company, and checks that grade every attempt from the agent's calls and the world's end state. The verdict comes from the world, not from mocks you wrote yourself.\n\n## Run the CLI\n\nBefore the CLI is installed, run every command as `npx -y @ancha-labs/cli <command>`. After `npm install -g @ancha-labs/cli` (Node 24 or newer), run `ancha <command>`. Never run `npx` with the bare name `ancha`: that npm name is not this package.\n\nAdd `--json` to every command. Runs print NDJSON events that end with `run_finished`; everything else prints one JSON object. `ancha schema <kind> --json` prints the JSON Schema of `ancha.yaml`, scene files and these outputs. If your command can time out, give `ancha run` an `--idempotency-key <key>`: running it again with the same key returns the same run instead of starting another.\n\n## The loop\n\n1. `ancha init --agent \"<the command that starts the agent>\"`, once, in the agent's project, if it has no `ancha.yaml` yet. It writes `ancha.yaml`, `scenes/starter/` (when `scenes/` holds no tests yet), the coding-agent skill, and `.ancha/` in `.gitignore`. It installs and runs nothing.\n2. `ancha doctor --json` checks the config and scenes and runs the agent once. A tool the agent didn't call is a warning, not a failure.\n3. `ancha run --json` runs every scene in fresh worlds. Exit 1 means a check failed.\n4. `ancha explain latest --json` shows each failed check: what was expected, what happened, and the calls and world events behind it. Read it before guessing from the code; many bugs only show up with the world's data and timing.\n5. `ancha baseline save before` keeps the failing run as the reference.\n6. Fix the agent's code.\n7. `ancha run --compare before --json` proves the fix: exit 0 means every check passes and nothing regressed.\n\nWith production traces (an export from the user's tracing), `ancha import --offline <trace file> --json` writes one test per conversation under `scenes/from-traces/`, and `ancha run scenes/from-traces/*/scene.yaml --json` runs them. More: `ancha docs traces`.\n\nThe starter scene only proves that the agent reaches each tool. For the agent's real job, `ancha test new \"<the test in one sentence>\" --json` drafts a test with people for the project's world (`ancha init --intent \"<company and scenario>\"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a scene can make on it. More: `ancha docs scenes`.\n\n## An app, not a command\n\nIf the AI feature lives inside an app (a web app or API server with its database, workers and scheduled jobs), don't wrap it in `agent.command`. Ancha starts the app once per trial with `agent.start`, waits for `agent.ready_url`, delivers the tools' events to `agent.url`, and a scene's `world_rules.app_calls` call the app's own routes, such as its cron jobs, at a time. Read `ancha docs apps` before writing `ancha.yaml`. The start script gives the app a clean database, cache and seed every trial: a new world has new URLs and tokens, and stale rows or sync cursors make an app silently do nothing.\n\n## From a production failure\n\nA production run that went wrong becomes a test here. With a trace file (an export from the user's tracing):\n\n1. `ancha import --offline <trace file> --json` makes the test on this computer and uploads nothing. It writes `scenes/from-traces/<name>/scene.yaml` and lists the questions one trace cannot settle, each with the default the test uses.\n2. Ask the user for the answers; don't guess them. Pass them with `--answer <question>=<value>` and import again with `--force` (`ancha docs apps`).\n3. `ancha run` on the `scene.yaml` against the version that failed in production should fail the same way. That is where the loop above starts. If it doesn't, `ancha traces diff <trace file> latest` shows the calls production made and the trial didn't; the import also lists the app's own setup calls, which the start script or an `app_call` has to make.\n\nIf the user's workspace takes traces (their agents send them to it), `ancha traces --failed --json` lists the ones where production failed a check, `ancha traces show <id> --json` previews the test, and `ancha pull <id> --json` saves it, with `--answer` for its questions. Checks you add to a pulled `scene.yaml` stay when you pull a newer version; any other edit stops the pull. A workspace that doesn't take traces says so; use the file. More: `ancha docs traces`.\n\n## The rule\n\nFix the agent, not `ancha.yaml`, the scenes or their checks. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.\n\nNever give the agent under test the scenes, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.\n\n## What the agent gets\n\nEach trial gives the agent its tools as environment variables, with fake credentials that only work against the replicas:\n\n- Slack: `SLACK_API_URL` (ends in `/api/`), `SLACK_BOT_TOKEN`\n- GitHub: `GITHUB_API_URL`, `GITHUB_TOKEN`\n- Datadog: `DATADOG_API_URL`, `DD_API_KEY`, `DD_APP_KEY`\n- PagerDuty: `PAGERDUTY_API_URL`, `PAGERDUTY_API_TOKEN`, `PAGERDUTY_FROM_EMAIL`, `PAGERDUTY_ROUTING_KEY`\n- the same pattern for the other tools in the world; `ANCHA_TASK` carries a command-line task.\n\n`ancha connect <tool> --lang ts|py` prints the SDK settings. `ancha twins coverage <tool>` lists the endpoints each replica implements.\n\nGoogle clients (`googleapis`, `@googleapis/*`) take the replica's URL in each call's options: `drive.files.list(params, { rootUrl: process.env.GOOGLE_DRIVE_API_URL + '/' })`. A `rootUrl` set on the client keeps only the host; Ancha still routes those calls by their token, but the client sends file uploads to www.googleapis.com.\n\n`ancha run` starts the agent on this computer. It has this computer's network, and an environment limited to Ancha's variables, the tools' variables and the names allowed in `agent.pass_env` in `ancha.yaml` (or `--pass-env NAME`). The agent's own model key is one of those names: `agent.pass_env: [OPENROUTER_API_KEY]` passes it from this shell, and `agent.env` sets fixed values, such as the path of a key file. Without it, an agent that calls a model stops at its first call. For a sealed run, set `agent.execution: { mode: container, image: node:24-slim }` in `ancha.yaml`; it needs Docker.\n\n## Hosted workspace\n\nIf the user has an Ancha workspace, `ancha login` asks them to approve this computer once in the browser; ask them to do it. After that, `ancha run` still runs its worlds on this computer; `ancha run --upload --json` sends the finished run to their workspace, where the console shows it (`upload.url` in the JSON). `ancha whoami --json` shows the workspace and where runs put their worlds. In CI, `ANCHA_SERVER_URL` and `ANCHA_API_KEY` replace the login: `ancha run --local --upload --json`. `ancha secrets set NAME` copies a provider key from this shell into the workspace for agents that run there.\n\nRunning the agent itself in the cloud is a console flow at https://app.ancha.io: Bring your agent, Connect, tasks with checks, Run. Send the user there for it.\n\n## When something fails\n\n- Exit 1: a check failed or the comparison regressed (a single check's drop counts, see `comparison.droppedChecks`). Run `ancha explain latest --json`.\n- Exit 2: usage, config, scene or authentication error. `AUTH_INVALID` means `ancha login` again or a valid `ANCHA_API_KEY`. Read the `hint`.\n- Exit 3: infrastructure, or a trial the harness couldn't complete. That's not the agent's fault; run again, and `ancha doctor --json` if it repeats.\n- Exit 4, only with `--strict`: the agent called an endpoint a replica doesn't implement. `ancha explain` lists these coverage gaps even without `--strict`; check `ancha twins coverage <tool>` before changing the agent.\n\nEvery error has a stable `code` and a `hint` that names the next command. More: `ancha docs`, `ancha docs <topic>` for setup, run, traces, explain, compare, scenes, integrations, cloud and playgrounds, and https://docs.ancha.io/coding-agents.\n\nTell the user what you ran, the pass rate and the evidence. Never claim a fix until `ancha run --compare` exits 0.\n";
1659
+ var codingAgentSkill = "---\nname: ancha\ndescription: Test, debug and fix an AI agent (a Slack bot, a support or on-call agent) against stateful replicas of the tools it uses, and prove a fix with graded runs. Use when asked to test an agent with Ancha, or in a repository that has ancha.yaml.\n---\n\n# Ancha\n\nAncha gives an AI agent the other side of its job: stateful replicas of the tools it uses (Slack, GitHub, Datadog, PagerDuty and more), seeded with one fictional company, and checks that grade every attempt from the agent's calls and the world's end state. The verdict comes from the world, not from mocks you wrote yourself.\n\n## Run the CLI\n\nBefore the CLI is installed, run every command as `npx -y @ancha-labs/cli <command>`. After `npm install -g @ancha-labs/cli` (Node 24 or newer), run `ancha <command>`. Never run `npx` with the bare name `ancha`: that npm name is not this package.\n\nAdd `--json` to every command. Runs print NDJSON events that end with `run_finished`; everything else prints one JSON object. `ancha schema <kind> --json` prints the JSON Schema of `ancha.yaml`, scene files and these outputs. If your command can time out, give `ancha run` an `--idempotency-key <key>`: running it again with the same key returns the same run instead of starting another.\n\n## The loop\n\n1. `ancha init --agent \"<the command that starts the agent>\"`, once, in the agent's project, if it has no `ancha.yaml` yet. It writes `ancha.yaml`, `scenes/starter/` (when `scenes/` holds no tests yet), the coding-agent skill, and `.ancha/` in `.gitignore`. It installs and runs nothing.\n2. `ancha doctor --json` checks the config and scenes and runs the agent once. A tool the agent didn't call is a warning, not a failure.\n3. `ancha run --json` runs every scene in fresh worlds. Exit 1 means a check failed.\n4. `ancha explain latest --json` shows each failed check: what was expected, what happened, and the calls and world events behind it. Read it before guessing from the code; many bugs only show up with the world's data and timing.\n5. `ancha baseline save before` keeps the failing run as the reference.\n6. Fix the agent's code.\n7. `ancha run --compare before --json` proves the fix: exit 0 means every check passes and nothing regressed.\n\nWith production traces (an export from the user's tracing), `ancha import --offline <trace file> --json` writes one test per conversation under `scenes/from-traces/`, and `ancha run scenes/from-traces/*/scene.yaml --json` runs them. More: `ancha docs traces`.\n\nThe starter scene only proves that the agent reaches each tool. For the agent's real job, `ancha test new \"<the test in one sentence>\" --json` drafts a test with people for the project's world (`ancha init --intent \"<company and scenario>\"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a scene can make on it. More: `ancha docs scenes`.\n\n## An app, not a command\n\nIf the AI feature lives inside an app (a web app or API server with its database, workers and scheduled jobs), don't wrap it in `agent.command`. Ancha starts the app once per trial with `agent.start`, waits for `agent.ready_url`, delivers the tools' events to `agent.url`, and a scene's `world_rules.app_calls` call the app's own routes, such as its cron jobs, at a time. Read `ancha docs apps` before writing `ancha.yaml`. The start script gives the app a clean database, cache and seed every trial: a new world has new URLs and tokens, and stale rows or sync cursors make an app silently do nothing.\n\n## From a production failure\n\nA production run that went wrong becomes a test here. With a trace file (an export from the user's tracing):\n\n1. `ancha import --offline <trace file> --json` makes the test on this computer and uploads nothing. It writes `scenes/from-traces/<name>/scene.yaml` and lists the questions one trace cannot settle, each with the default the test uses.\n2. Ask the user for the answers; don't guess them. Pass them with `--answer <question>=<value>` and import again with `--force` (`ancha docs apps`).\n3. `ancha run` on the `scene.yaml` against the version that failed in production should fail the same way. That is where the loop above starts. If it doesn't, `ancha traces diff <trace file> latest` shows the calls production made and the trial didn't; the import also lists the app's own setup calls, which the start script or an `app_call` has to make.\n\nIf the user's workspace takes traces (their agents send them to it), each trace becomes a test there: `ancha pull --all --json` writes every test that is turned on (`--agent <name>` for one agent's), `ancha traces --failed --json` lists the ones where production failed a check, `ancha traces show <id> --json` previews the test, and `ancha pull <id> --json` writes one, with `--answer` for its questions. Checks you add to a pulled `scene.yaml` stay when you pull a newer version; any other edit stops the pull. A workspace that doesn't take traces says so; use the file. More: `ancha docs traces`.\n\n## The rule\n\nFix the agent, not `ancha.yaml`, the scenes or their checks. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.\n\nNever give the agent under test the scenes, checks, seeds or reference companions (`oracle.mjs`, `null.mjs`), and never point it at a real SaaS API.\n\n## What the agent gets\n\nEach trial gives the agent its tools as environment variables, with fake credentials that only work against the replicas:\n\n- Slack: `SLACK_API_URL` (ends in `/api/`), `SLACK_BOT_TOKEN`\n- GitHub: `GITHUB_API_URL`, `GITHUB_TOKEN`\n- Datadog: `DATADOG_API_URL`, `DD_API_KEY`, `DD_APP_KEY`\n- PagerDuty: `PAGERDUTY_API_URL`, `PAGERDUTY_API_TOKEN`, `PAGERDUTY_FROM_EMAIL`, `PAGERDUTY_ROUTING_KEY`\n- the same pattern for the other tools in the world; `ANCHA_TASK` carries a command-line task.\n\n`ancha connect <tool> --lang ts|py` prints the SDK settings. `ancha twins coverage <tool>` lists the endpoints each replica implements.\n\nGoogle clients (`googleapis`, `@googleapis/*`) take the replica's URL in each call's options: `drive.files.list(params, { rootUrl: process.env.GOOGLE_DRIVE_API_URL + '/' })`. A `rootUrl` set on the client keeps only the host; Ancha still routes those calls by their token, but the client sends file uploads to www.googleapis.com.\n\n`ancha run` starts the agent on this computer. It has this computer's network, and an environment limited to Ancha's variables, the tools' variables and the names allowed in `agent.pass_env` in `ancha.yaml` (or `--pass-env NAME`). The agent's own model key is one of those names: `agent.pass_env: [OPENROUTER_API_KEY]` passes it from this shell, and `agent.env` sets fixed values, such as the path of a key file. Without it, an agent that calls a model stops at its first call. For a sealed run, set `agent.execution: { mode: container, image: node:24-slim }` in `ancha.yaml`; it needs Docker.\n\n## Hosted workspace\n\nIf the user has an Ancha workspace, `ancha login` asks them to approve this computer once in the browser; ask them to do it. After that, `ancha run` still runs its worlds on this computer; `ancha run --upload --json` sends the finished run to their workspace, where the console shows it (`upload.url` in the JSON). `ancha whoami --json` shows the workspace and where runs put their worlds. In CI, `ANCHA_SERVER_URL` and `ANCHA_API_KEY` replace the login: `ancha run --local --upload --json`. `ancha secrets set NAME` copies a provider key from this shell into the workspace for agents that run there.\n\nRunning the agent itself in the cloud is a console flow at https://app.ancha.io: Bring your agent, Connect, tasks with checks, Run. Send the user there for it.\n\n## When something fails\n\n- Exit 1: a check failed or the comparison regressed (a single check's drop counts, see `comparison.droppedChecks`). Run `ancha explain latest --json`.\n- Exit 2: usage, config, scene or authentication error. `AUTH_INVALID` means `ancha login` again or a valid `ANCHA_API_KEY`. Read the `hint`.\n- Exit 3: infrastructure, or a trial the harness couldn't complete. That's not the agent's fault; run again, and `ancha doctor --json` if it repeats.\n- Exit 4, only with `--strict`: the agent called an endpoint a replica doesn't implement. `ancha explain` lists these coverage gaps even without `--strict`; check `ancha twins coverage <tool>` before changing the agent.\n\nEvery error has a stable `code` and a `hint` that names the next command. More: `ancha docs`, `ancha docs <topic>` for setup, run, traces, explain, compare, scenes, integrations, cloud and playgrounds, and https://docs.ancha.io/coding-agents.\n\nTell the user what you ran, the pass rate and the evidence. Never claim a fix until `ancha run --compare` exits 0.\n";
1643
1660
 
1644
1661
  // frontend/src/workspace-pages.ts
1645
1662
  var startSentence = "Test our agent with Ancha. Start with: npx -y @ancha-labs/cli init, then read https://app.ancha.io/llms.txt";
@@ -2148,6 +2165,7 @@ var connectionFields = {
2148
2165
  discord: ["DISCORD_API_URL", "DISCORD_BOT_TOKEN"],
2149
2166
  sentry: ["SENTRY_API_URL", "SENTRY_AUTH_TOKEN"],
2150
2167
  airtable: ["AIRTABLE_API_URL", "AIRTABLE_ENDPOINT_URL", "AIRTABLE_API_KEY"],
2168
+ netsuite: ["NETSUITE_API_URL", "NETSUITE_RECORD_URL", "NETSUITE_SUITEQL_URL", "NETSUITE_ACCOUNT_ID", "NETSUITE_CONSUMER_KEY", "NETSUITE_CONSUMER_SECRET", "NETSUITE_TOKEN_ID", "NETSUITE_TOKEN_SECRET", "NETSUITE_ACCESS_TOKEN"],
2151
2169
  twilio: ["TWILIO_API_URL", "TWILIO_ACCOUNT_SID", "TWILIO_AUTH_TOKEN"]
2152
2170
  };
2153
2171
  var connectionNote = {
@@ -2166,6 +2184,7 @@ var connectionNote = {
2166
2184
  discord: "Send Authorization: Bot DISCORD_BOT_TOKEN to DISCORD_API_URL plus the path (it ends in /api/v10).",
2167
2185
  sentry: "Call SENTRY_API_URL/api/0/\u2026 with Authorization: Bearer SENTRY_AUTH_TOKEN; lists page through the Link header.",
2168
2186
  airtable: "The airtable.js client reads AIRTABLE_ENDPOINT_URL and AIRTABLE_API_KEY itself. Over HTTP, send AIRTABLE_API_KEY as a Bearer token to AIRTABLE_API_URL (it ends in /v0).",
2187
+ netsuite: "Point the client at NETSUITE_API_URL; use NETSUITE_RECORD_URL for records and NETSUITE_SUITEQL_URL for queries. Send NETSUITE_ACCESS_TOKEN as a Bearer token, or sign TBA requests with HMAC-SHA256 using NETSUITE_ACCOUNT_ID as realm and NETSUITE_CONSUMER_KEY, NETSUITE_CONSUMER_SECRET, NETSUITE_TOKEN_ID and NETSUITE_TOKEN_SECRET. SuiteQL needs Prefer: transient; creates return 204 with a Location header.",
2169
2188
  "google-calendar": 'calendar({ version: "v3", auth }) with GOOGLE_CALENDAR_ACCESS_TOKEN as the OAuth access token, and GOOGLE_CALENDAR_API_URL + "/" as each request\u2019s rootUrl.',
2170
2189
  twilio: "twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, { httpClient }), where the httpClient sends https://api.twilio.com to TWILIO_API_URL, and Verify and Lookup to TWILIO_API_URL plus /verify and /lookups.",
2171
2190
  intercom: "new IntercomClient({ token: INTERCOM_ACCESS_TOKEN, baseUrl: INTERCOM_API_URL }).",
@@ -2174,7 +2193,7 @@ var connectionNote = {
2174
2193
  dropbox: "new Dropbox({ accessToken: DROPBOX_ACCESS_TOKEN, fetch }), where fetch replaces https://api.dropboxapi.com and https://content.dropboxapi.com with DROPBOX_API_URL before sending.",
2175
2194
  "better-stack": "There is no official Uptime SDK: send each request to BETTER_STACK_API_URL plus its /api/v2 or /api/v3 path, with Authorization: Bearer BETTER_STACK_API_TOKEN."
2176
2195
  };
2177
- var awsLabels = { AWS_ENDPOINT_URL_S3: "Endpoint URL", AWS_ACCESS_KEY_ID: "Access key ID", AWS_SECRET_ACCESS_KEY: "Secret access key", AWS_REGION: "Region", OKTA_ORG_URL: "Org URL", OKTA_API_TOKEN: "API token", STRIPE_SECRET_KEY: "Secret key", CLERK_SECRET_KEY: "Secret key", BETTER_STACK_API_TOKEN: "API token", NOTION_TOKEN: "Integration token", SHOPIFY_API_VERSION: "API version", LOB_ASSETS_URL: "Assets URL", PAYPAL_CLIENT_ID: "Client ID", PAYPAL_CLIENT_SECRET: "Client secret", JIRA_BASE_URL: "Site URL", JIRA_EMAIL: "Email", JIRA_API_TOKEN: "API token", KALSHI_API_KEY_ID: "API key ID", KALSHI_PRIVATE_KEY: "Private key", ZENDESK_EMAIL: "Email", ZENDESK_API_TOKEN: "API token", TWILIO_ACCOUNT_SID: "Account SID", TWILIO_AUTH_TOKEN: "Auth token", DISCORD_BOT_TOKEN: "Bot token", SENTRY_AUTH_TOKEN: "Auth token", AIRTABLE_ENDPOINT_URL: "Endpoint URL" };
2196
+ var awsLabels = { AWS_ENDPOINT_URL_S3: "Endpoint URL", AWS_ACCESS_KEY_ID: "Access key ID", AWS_SECRET_ACCESS_KEY: "Secret access key", AWS_REGION: "Region", OKTA_ORG_URL: "Org URL", OKTA_API_TOKEN: "API token", STRIPE_SECRET_KEY: "Secret key", CLERK_SECRET_KEY: "Secret key", BETTER_STACK_API_TOKEN: "API token", NOTION_TOKEN: "Integration token", SHOPIFY_API_VERSION: "API version", LOB_ASSETS_URL: "Assets URL", PAYPAL_CLIENT_ID: "Client ID", PAYPAL_CLIENT_SECRET: "Client secret", JIRA_BASE_URL: "Site URL", JIRA_EMAIL: "Email", JIRA_API_TOKEN: "API token", KALSHI_API_KEY_ID: "API key ID", KALSHI_PRIVATE_KEY: "Private key", ZENDESK_EMAIL: "Email", ZENDESK_API_TOKEN: "API token", TWILIO_ACCOUNT_SID: "Account SID", TWILIO_AUTH_TOKEN: "Auth token", DISCORD_BOT_TOKEN: "Bot token", SENTRY_AUTH_TOKEN: "Auth token", AIRTABLE_ENDPOINT_URL: "Endpoint URL", NETSUITE_RECORD_URL: "Record URL", NETSUITE_SUITEQL_URL: "SuiteQL URL", NETSUITE_ACCOUNT_ID: "Account ID", NETSUITE_CONSUMER_KEY: "Consumer key", NETSUITE_CONSUMER_SECRET: "Consumer secret", NETSUITE_TOKEN_ID: "Token ID", NETSUITE_TOKEN_SECRET: "Token secret" };
2178
2197
  var fields = connectionFields;
2179
2198
  var connectionLabel = (key) => awsLabels[key] ?? (key.endsWith("URL") ? "API URL" : key.endsWith("ENDPOINT") ? "gRPC endpoint" : key.endsWith("FROM_EMAIL") ? "Caller email" : key === "DD_APP_KEY" ? "Application key" : key === "GONG_ACCESS_KEY" ? "Access key" : key.endsWith("SECRET") ? "Access key secret" : key.endsWith("API_KEY") ? "API key" : "Access token");
2180
2199
  function connectionsView(info, mode, tool) {
@@ -2398,6 +2417,7 @@ var viewMode2 = () => viewMode(boot);
2398
2417
  var viewBanner2 = () => viewBanner(boot);
2399
2418
  var worldsAnswer = {};
2400
2419
  var agentsAnswer = {};
2420
+ var worldData;
2401
2421
  var startTimer;
2402
2422
  function adoptBoot(next) {
2403
2423
  const was = viewMode2();
@@ -2431,7 +2451,7 @@ async function startWorkspace() {
2431
2451
  await load();
2432
2452
  if (result2.state !== "capped") waitForWorkspace();
2433
2453
  }
2434
- var betaNote = () => '<p class="beta-note">Hosted runs of your own agent are in private beta for this workspace. Run <code>ancha run</code> on your computer, or <a href="/account#hosted">request access in Settings</a>.</p>';
2454
+ var betaNote = () => '<p class="beta-note">Run <code>ancha run</code> on your computer, or <a href="/account#hosted">request access in Settings</a>.</p>';
2435
2455
  var poll = (path2) => api(path2, void 0, void 0, true);
2436
2456
  function path() {
2437
2457
  return location.pathname.split("/").filter(Boolean).map(decodeURIComponent);
@@ -2491,6 +2511,10 @@ function shell(section, content) {
2491
2511
  const nav2 = (items) => items.map(([id, name]) => `<a href="/${id}" data-nav class="nav-item ${section === id ? "active" : ""}" ${section === id ? 'aria-current="page"' : ""}>${name}</a>`).join("");
2492
2512
  root.innerHTML = `<aside class="sidebar"><a href="/worlds" class="brand" data-nav>ancha</a><nav class="app-nav" aria-label="Main navigation">${nav2([["worlds", "Worlds"], ["agents", "Agents"], ["playgrounds", "Runs"], ["tools", "Tools"]])}</nav><div class="workspace"><span id="connection" class="connection warn" role="status"${failedProbes < 2 ? " hidden" : ""}>${failedProbes < 2 ? "" : "Can\u2019t reach the server. Retrying\u2026"}</span><a href="/help" data-nav>Help</a><a href="/settings" data-nav>Settings</a></div></aside><main id="main" tabindex="-1">${viewMode2() && viewServes(section, path()[1]) ? viewBanner2() : ""}${content}</main>`;
2493
2513
  }
2514
+ function folderScenes(scenes) {
2515
+ if (!scenes.length) return "";
2516
+ return `<section class="folder-scenes" aria-labelledby="folder-scenes-title"><div class="section-title"><div><h2 id="folder-scenes-title">Scenes in this folder</h2><p class="muted">Open one to see its starting data before any run.</p></div></div><div class="world-catalog">${scenes.map((scene) => `<a class="world-catalog-item" href="/worlds?scene=${enc2(String(scene.key))}" data-nav><h2>${h(String(scene.title || scene.id))}</h2><div class="world-tool-icons" role="group" aria-label="Tools: ${h((scene.tools ?? []).map(toolName).join(", "))}">${(scene.tools ?? []).map((tool) => `<span title="${h(toolName(tool))}" role="img" aria-label="${h(toolName(tool))}">${toolLogo(tool)}</span>`).join("")}</div><p>${h(String(scene.path))}</p></a>`).join("")}</div></section>`;
2517
+ }
2494
2518
  function worldToolIcons(world) {
2495
2519
  const tools = [...new Set((world.configuration?.preset?.datasets ?? []).map((dataset) => dataset.tool))];
2496
2520
  return `<div class="world-tool-icons" role="group" aria-label="Tools: ${h(tools.map(toolName).join(", "))}">${tools.map((tool) => `<span title="${h(toolName(tool))}" role="img" aria-label="${h(toolName(tool))}">${toolLogo(tool)}</span>`).join("")}</div>`;
@@ -2560,7 +2584,18 @@ async function load() {
2560
2584
  } else if (section === "help" || section === "settings") {
2561
2585
  shell(section, head(section === "help" ? "Help" : "Settings") + (section === "help" ? helpPage() : boot.hosted ? `<section class="settings-page"><h2>Hosted workspace</h2><dl class="hosted-urls">${boot.hosted.tier ? `<dt>This workspace</dt><dd>${ownRunsOff() ? 'Free \xB7 <a href="/account#hosted">Request hosted runs</a>' : 'Hosted runs \xB7 <a href="/account#hosted">Machine time</a>'}</dd>` : ""}${boot.hosted.console ? `<dt>Console</dt><dd><a href="${h(boot.hosted.console)}">${h(boot.hosted.console)}</a></dd><dt>World server</dt><dd><code>${h(boot.hosted.worldServer)}</code></dd>` : ""}</dl><p class="muted">For CI, set <code>ANCHA_SERVER_URL</code> to the world server and <code>ANCHA_API_KEY</code> to a key from <a href="/account">Account settings</a>. On your computer, <code>ancha login</code> sets both.</p></section>` : `<section class="settings-page"><h2>Local workspace</h2><p class="workspace-path">${h(boot.workspace)}</p><p class="muted">Agents, worlds, tests and results are saved here.</p></section>`));
2562
2586
  } else if (section === "worlds") {
2563
- const [result2, registry, definitions] = await Promise.all([api("/worlds"), api("/agents"), api("/playground-tests")]);
2587
+ const q = new URLSearchParams(location.search), sceneKey = p[1] ? null : q.get("scene"), revision = q.get("revision");
2588
+ if (!viewMode2() && (sceneKey !== null || !!p[1] && p[1] !== "new" && q.has("data"))) {
2589
+ const source = sceneKey !== null ? `/scenarios/data?key=${enc2(sceneKey)}` : `/worlds/${enc2(p[1])}/data${revision ? `?revision=${enc2(revision)}` : ""}`;
2590
+ const data = worldData?.source === source && Date.now() - worldData.at < 6e4 ? worldData.data : await api(source);
2591
+ if (thisGeneration !== generation) return;
2592
+ if (worldData?.source !== source) worldData = { source, at: Date.now(), data };
2593
+ current = {};
2594
+ if (sceneKey !== null) shell("worlds", worldDataPage(String(data.scene?.title || data.scene?.path || "Scene"), String(data.scene?.path ?? ""), { href: "/worlds", label: "Worlds" }, data, `/worlds?scene=${enc2(sceneKey)}`, q));
2595
+ else shell("worlds", worldDataPage(String(data.world?.name ?? "World"), `Revision ${data.world?.revision}`, { href: `/worlds/${enc2(p[1])}`, label: String(data.world?.name ?? "World") }, data, `/worlds/${enc2(p[1])}?data=1${revision ? `&revision=${enc2(revision)}` : ""}`, q));
2596
+ return;
2597
+ }
2598
+ const [result2, registry, definitions, folder] = await Promise.all([api("/worlds"), api("/agents"), api("/playground-tests"), !p[1] && !viewMode2() ? api("/scenarios/folder").catch(() => ({ scenes: [] })) : Promise.resolve({ scenes: [] })]);
2564
2599
  if (thisGeneration !== generation) return;
2565
2600
  worldsAnswer = result2;
2566
2601
  worlds = result2.worlds ?? [];
@@ -2590,7 +2625,7 @@ async function load() {
2590
2625
  const ownAgents = agentCatalog.filter((a) => !/(^|\/)sample-agent\/?$/.test(String(a.cwd ?? "")));
2591
2626
  const sampleRun = !p[1] && !ownAgents.length ? ((await api("/playgrounds")).runs ?? []).slice().sort((a, b) => String(a.createdAt).localeCompare(String(b.createdAt)))[0] : void 0;
2592
2627
  if (thisGeneration !== generation) return;
2593
- if (!p[1]) document.querySelector("#worlds-page").innerHTML = (ownAgents.length ? "" : startCard(sampleRun?.id)) + (worlds.length ? `<div class="world-catalog">${worlds.map((world) => `<a class="world-catalog-item" href="/worlds/${enc2(world.id)}" data-nav><h2>${h(world.name)}</h2>${worldToolIcons(world)}<p>${worldTaskCounts.get(world.id) ?? 0} ${worldTaskCounts.get(world.id) === 1 ? "task" : "tasks"}</p></a>`).join("")}</div>` : `<section class="empty"><h2>No worlds yet</h2><a href="/worlds/new" data-nav class="button-link primary">Create world</a></section>`);
2628
+ if (!p[1]) document.querySelector("#worlds-page").innerHTML = (ownAgents.length ? "" : startCard(sampleRun?.id)) + (worlds.length ? `<div class="world-catalog">${worlds.map((world) => `<a class="world-catalog-item" href="/worlds/${enc2(world.id)}" data-nav><h2>${h(world.name)}</h2>${worldToolIcons(world)}<p>${worldTaskCounts.get(world.id) ?? 0} ${worldTaskCounts.get(world.id) === 1 ? "task" : "tasks"}</p></a>`).join("")}</div>` : `<section class="empty"><h2>No worlds yet</h2><a href="/worlds/new" data-nav class="button-link primary">Create world</a></section>`) + folderScenes(folder.scenes ?? []);
2594
2629
  else mountWorlds(document.querySelector("#worlds-page"), worlds, toolCatalog, p[1], api, go);
2595
2630
  }
2596
2631
  } else if (section === "tools") {
@@ -2882,7 +2917,7 @@ function renderTools(selected) {
2882
2917
  if (!tool) {
2883
2918
  const ordered2 = [...toolCatalog].sort((a, b) => (toolOrder.indexOf(a.name) + 99) % 99 - (toolOrder.indexOf(b.name) + 99) % 99);
2884
2919
  const cliNote = boot.hosted ? '<p class="tools-cli-note">These replicas come with this workspace. To use all of them from your computer, update your CLI: <code>npm install -g @ancha-labs/cli@latest</code></p>' : "";
2885
- shell("tools", head("Tools", "", "Replicas of the APIs agents call. Every attempt gets its own copy, seeded with the data shown on each tool.") + cliNote + `<div class="tools-grid">${ordered2.map((t) => {
2920
+ shell("tools", head("Tools", '<a class="button-link" href="mailto:patrick@ancha.io?subject=Tool%20request">Request a tool</a>', "Replicas of the APIs agents call. Every attempt gets its own copy, seeded with the data shown on each tool.") + cliNote + `<div class="tools-grid">${ordered2.map((t) => {
2886
2921
  const d2 = t.descriptor ?? {}, endpoints2 = (t.coverage ?? []).length, version = String(d2.version ?? "");
2887
2922
  const api2 = version && !/[A-Za-z]{3,}/.test(version.replace(/subset/g, "")) ? `API ${version}` : version;
2888
2923
  return `<a class="tool-card" data-nav href="/tools/${enc2(t.name)}"><div class="tool-card-head">${toolLogo(t.name)}<div><strong>${h(toolName(t.name))}</strong><span>${h(toolCategory[t.name] ?? "Tool")}</span></div></div><p>${h(d2.description ?? toolDescription(t.name))}</p><div class="tool-card-foot"><span>${h(api2)}</span><span>${endpoints2} endpoint${endpoints2 === 1 ? "" : "s"}</span></div></a>`;
@@ -2894,7 +2929,7 @@ function renderTools(selected) {
2894
2929
  const row2 = (c) => `<li title="${h(`${c.method} ${c.path}${c.notes ? ` \u2014 ${c.notes}` : ""}`)}"><code>${h(c.method)}</code><span>${h(c.path).replaceAll("/", "/<wbr>")}</span></li>`;
2895
2930
  const endpoints = coverage.length ? `<section class="tool-aside-section"><h2>Endpoints <span>${coverage.length}</span></h2><ul class="cov-list">${sorted.slice(0, 10).map(row2).join("")}</ul>${coverage.length > 10 ? `<details class="cov-more"><summary>All ${coverage.length} endpoints</summary><ul class="cov-list">${sorted.slice(10).map(row2).join("")}</ul></details>` : ""}</section>` : "";
2896
2931
  const connect = env.length ? `<section class="tool-aside-section"><h2>Connect your agent</h2><p>Your agent reads these at start; point your client at the URL instead of the real service.</p><dl class="env-list">${env.map((key) => `<div><dt><code>${h(key)}</code></dt><dd>${h(connectionLabel(key))}</dd></div>`).join("")}</dl>${connectionNote[tool.name] ? `<p class="hint">${h(connectionNote[tool.name])}</p>` : ""}</section>` : "";
2897
- const limits = (d.limitations ?? []).length ? `<section class="tool-aside-section"><h2>Limits</h2><ul class="tool-limits">${(d.limitations ?? []).map((x) => `<li>${h(x)}</li>`).join("")}</ul></section>` : "";
2932
+ const limits = (d.limitations ?? []).length ? `<section class="tool-aside-section"><ul class="tool-limits">${(d.limitations ?? []).map((x) => `<li>${h(x)}</li>`).join("")}</ul></section>` : "";
2898
2933
  const preview = viewMode2() ? waitingForToolPreview() : previewCache.has(tool.name) ? toolView(starterObservation, tool.name, { ...Object.fromEntries(new URLSearchParams(location.search)), baseHref: "/tools/" + enc2(tool.name), embedded: true }) : `<p class="loading" role="status">Loading ${h(toolName(tool.name))}\u2026</p>`;
2899
2934
  shell("tools", `<a class="back" data-nav href="/tools">\u2190 All tools</a><header class="page-head tool-hero"><div class="tool-hero-id">${toolLogo(tool.name)}<div><h1>${h(toolName(tool.name))}</h1><p class="page-meta">${h(toolCategory[tool.name] ?? "Tool")} \xB7 ${h(d.description ?? toolDescription(tool.name))}</p></div></div>${viewMode2() ? "" : '<div class="actions"><a class="button-link primary" data-nav href="/worlds/new">Use in a world</a></div>'}</header><p class="tool-intro">A replica of the ${h(toolName(tool.name))} API with its own data. Every attempt starts from a fresh copy of what is below, and every call your agent makes is recorded.</p>${!viewMode2() && previewCache.has(tool.name) ? starterStats(tool.name) : ""}<div class="tool-page"><section class="tool-main"><h2 class="tool-main-title">Starter data</h2>${preview}</section><aside class="tool-aside">${connect}${endpoints}${limits}</aside></div>`);
2900
2935
  }
@@ -513,3 +513,5 @@ body.navigating main{opacity:.55;transition:opacity .15s .25s;cursor:progress}
513
513
  /* The console as a view of the workspace (hosting spec §3.4) */
514
514
  .view-banner{display:flex;align-items:center;gap:16px;margin:0 0 24px;padding:16px 18px;border:1px solid var(--line);border-radius:10px;background:var(--raised,#fafaf8)}.view-banner>div{flex:1;min-width:0}.view-banner strong{display:block;font-weight:600}.view-banner p{margin:4px 0 0;color:var(--muted);font-size:13px}.view-banner button{flex:none}.view-note{color:var(--muted);font-size:13px}
515
515
  @media (max-width:560px){.view-banner{flex-direction:column;align-items:flex-start}}
516
+ /* A world's starting data before any run (SPEC-027) */
517
+ .world-data-note{margin:-12px 0 20px;color:var(--muted);font-size:13px}.world-data-tabs{display:flex;flex-wrap:wrap;gap:4px 22px}.world-data-tabs a{gap:8px;align-items:center}.world-data-logo{display:inline-flex;width:16px;height:16px}.world-data-logo svg,.world-data-logo img{width:16px;height:16px}.folder-scenes{margin-top:36px}.folder-scenes .world-catalog-item p{overflow-wrap:anywhere;font-size:12px}.ww-world-actions .button-link{color:var(--ink)}