dispach 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -85
- package/dist/App-qfqvx9c7.js +11 -0
- package/dist/{App-b1yrwrcq.js.map → App-qfqvx9c7.js.map} +6 -7
- package/dist/ConfigEditor-apcnj4nj.js +6 -0
- package/dist/{ConfigEditor-n8hdw6r7.js.map → ConfigEditor-apcnj4nj.js.map} +2 -2
- package/dist/KeyProbe-ya5t3v3v.js +5 -0
- package/dist/{KeyProbe-9jjeze5r.js.map → KeyProbe-ya5t3v3v.js.map} +2 -2
- package/dist/Picker-b7mn0mjg.js +5 -0
- package/dist/{Picker-hfeh1g6m.js.map → Picker-b7mn0mjg.js.map} +1 -1
- package/dist/SessionPicker-vacfwczg.js +5 -0
- package/dist/{SessionPicker-zyqkg4dn.js.map → SessionPicker-vacfwczg.js.map} +2 -2
- package/dist/SkillBrowser-66ntwaa9.js +5 -0
- package/dist/{SkillBrowser-3qdp8080.js.map → SkillBrowser-66ntwaa9.js.map} +1 -1
- package/dist/WizardApp-123998yh.js +5 -0
- package/dist/{WizardApp-vzpbydy3.js.map → WizardApp-123998yh.js.map} +3 -3
- package/dist/agents.d.ts +19 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/channels-q4fwqq87.js +31 -0
- package/dist/channels-q4fwqq87.js.map +10 -0
- package/dist/channels.d.ts +26 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/client.js +10 -10
- package/dist/client.js.map +3 -3
- package/dist/config-64q4mgxc.js +24 -0
- package/dist/{config-g7za9x13.js.map → config-64q4mgxc.js.map} +2 -2
- package/dist/{credential-npr6z8c8.js → credential-2sj7vsmw.js} +5 -5
- package/dist/{credential-npr6z8c8.js.map → credential-2sj7vsmw.js.map} +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/index-0k3w2mxf.js +6 -0
- package/dist/{index-hwpvhaza.js.map → index-0k3w2mxf.js.map} +1 -1
- package/dist/index-1s81qstp.js +6 -0
- package/dist/{index-v8e92nfw.js.map → index-1s81qstp.js.map} +1 -1
- package/dist/index-2rycma8x.js +12 -0
- package/dist/{index-258d8bzg.js.map → index-2rycma8x.js.map} +4 -3
- package/dist/index-2zye08c4.js +6 -0
- package/dist/{index-vgc3y3rm.js.map → index-2zye08c4.js.map} +2 -2
- package/dist/{index-gme2egyq.js → index-3km1jwh7.js} +4 -4
- package/dist/{index-gme2egyq.js.map → index-3km1jwh7.js.map} +1 -1
- package/dist/index-3mtgcvkq.js +429 -0
- package/dist/index-3mtgcvkq.js.map +11 -0
- package/dist/index-4knb5vjm.js +90 -0
- package/dist/index-4knb5vjm.js.map +13 -0
- package/dist/{index-3g3ny01d.js → index-5nwwekk0.js} +4 -4
- package/dist/{index-3g3ny01d.js.map → index-5nwwekk0.js.map} +1 -1
- package/dist/index-5rm7dwq4.js +6 -0
- package/dist/index-5rm7dwq4.js.map +11 -0
- package/dist/index-79epttpm.js +6 -0
- package/dist/index-79epttpm.js.map +10 -0
- package/dist/{index-4cf6v9nb.js → index-7yk1zvds.js} +4 -4
- package/dist/{index-4cf6v9nb.js.map → index-7yk1zvds.js.map} +1 -1
- package/dist/index-81gb4ey4.js +6 -0
- package/dist/{index-4z7axw4r.js.map → index-81gb4ey4.js.map} +1 -1
- package/dist/index-8a5d8sfe.js +6 -0
- package/dist/{index-0d93hyfc.js.map → index-8a5d8sfe.js.map} +1 -1
- package/dist/index-a21zyy54.js +6 -0
- package/dist/index-a21zyy54.js.map +9 -0
- package/dist/index-b6da6c16.js +92 -0
- package/dist/index-b6da6c16.js.map +15 -0
- package/dist/index-byxrc961.js +903 -0
- package/dist/{index-tv4yv7d2.js.map → index-byxrc961.js.map} +16 -15
- package/dist/{index-ammv5st7.js → index-cgfg6t5a.js} +6 -6
- package/dist/{index-ammv5st7.js.map → index-cgfg6t5a.js.map} +1 -1
- package/dist/{index-s9mbq7h6.js → index-ehzwdnc3.js} +4 -4
- package/dist/{index-s9mbq7h6.js.map → index-ehzwdnc3.js.map} +1 -1
- package/dist/index-fzmmhmk2.js +7 -0
- package/dist/index-fzmmhmk2.js.map +11 -0
- package/dist/index-g3pk0kc0.js +6 -0
- package/dist/{index-9r0wyj6w.js.map → index-g3pk0kc0.js.map} +2 -2
- package/dist/index-h828nk24.js +153 -0
- package/dist/index-h828nk24.js.map +20 -0
- package/dist/{index-02dn6m2j.js → index-jq999vcw.js} +5 -5
- package/dist/{index-02dn6m2j.js.map → index-jq999vcw.js.map} +2 -2
- package/dist/index-k2aq5bg0.js +9 -0
- package/dist/{index-6p999cx4.js.map → index-k2aq5bg0.js.map} +4 -6
- package/dist/{index-cqqb6gaq.js → index-k3y8y3wj.js} +5 -5
- package/dist/{index-cqqb6gaq.js.map → index-k3y8y3wj.js.map} +1 -1
- package/dist/index-k59wwdgz.js +9 -0
- package/dist/{index-ff514z3y.js.map → index-k59wwdgz.js.map} +3 -5
- package/dist/index-nmnnwa02.js +6 -0
- package/dist/{index-6q4wf8e3.js.map → index-nmnnwa02.js.map} +1 -1
- package/dist/index-nn3tk25c.js +6 -0
- package/dist/{index-d4x6yvqh.js.map → index-nn3tk25c.js.map} +3 -4
- package/dist/index-q0hxh57v.js +126 -0
- package/dist/index-q0hxh57v.js.map +14 -0
- package/dist/index-srmhk9g5.js +11 -0
- package/dist/index-srmhk9g5.js.map +11 -0
- package/dist/index-swtyfhha.js +6 -0
- package/dist/{index-fex44816.js.map → index-swtyfhha.js.map} +2 -2
- package/dist/index-whq42sat.js +6 -0
- package/dist/{index-h9mw7b9d.js.map → index-whq42sat.js.map} +1 -1
- package/dist/{index-j7gyr5nx.js → index-wzsmh5j0.js} +7 -7
- package/dist/{index-j7gyr5nx.js.map → index-wzsmh5j0.js.map} +1 -1
- package/dist/{index-j55s3ehk.js → index-x7v1zq89.js} +7 -7
- package/dist/{index-j55s3ehk.js.map → index-x7v1zq89.js.map} +2 -2
- package/dist/index-xhzmv4dh.js +66 -0
- package/dist/index-xhzmv4dh.js.map +12 -0
- package/dist/index-xmv47vs0.js +6 -0
- package/dist/{index-gz9x25tz.js.map → index-xmv47vs0.js.map} +2 -2
- package/dist/index-y4c32wn7.js +6 -0
- package/dist/{index-qdbq8crg.js.map → index-y4c32wn7.js.map} +2 -2
- package/dist/index-yjcdp72k.js +6 -0
- package/dist/{index-tf71ap9v.js.map → index-yjcdp72k.js.map} +1 -1
- package/dist/index-zn24991r.js +6 -0
- package/dist/index-zn24991r.js.map +10 -0
- package/dist/index.js +374 -443
- package/dist/index.js.map +23 -27
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/channel-actions.d.ts +103 -0
- package/dist/lib/channel-actions.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +12 -1
- package/dist/lib/chat-frame.d.ts.map +1 -1
- package/dist/lib/commands.d.ts +13 -0
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/const.d.ts +1 -1
- package/dist/lib/host-actions.d.ts +121 -0
- package/dist/lib/host-actions.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +32 -0
- package/dist/lib/init-flow.d.ts.map +1 -1
- package/dist/lib/init-whatsapp.d.ts +52 -0
- package/dist/lib/init-whatsapp.d.ts.map +1 -0
- package/dist/lib/plugin-install.d.ts +120 -0
- package/dist/lib/plugin-install.d.ts.map +1 -0
- package/dist/lib/providers.d.ts.map +1 -1
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/lib/readme-table.d.ts +15 -0
- package/dist/lib/readme-table.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +15 -0
- package/dist/lib/sandbox.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +34 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/subcommand.d.ts.map +1 -1
- package/dist/lib/web-url.d.ts +15 -0
- package/dist/lib/web-url.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/plugins.d.ts +27 -8
- package/dist/plugins.d.ts.map +1 -1
- package/dist/restart.d.ts +21 -0
- package/dist/restart.d.ts.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/schedules.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/status.d.ts +16 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/web-923c7f5e.js +14 -0
- package/dist/{web-vkb16r62.js.map → web-923c7f5e.js.map} +3 -3
- package/dist/web.d.ts +2 -13
- package/dist/web.d.ts.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/wrapper-0w9b3my0.js +11 -0
- package/dist/wrapper-0w9b3my0.js.map +23 -0
- package/package.json +6 -3
- package/dist/App-b1yrwrcq.js +0 -11
- package/dist/ConfigEditor-n8hdw6r7.js +0 -6
- package/dist/KeyProbe-9jjeze5r.js +0 -5
- package/dist/Picker-hfeh1g6m.js +0 -5
- package/dist/SessionPicker-zyqkg4dn.js +0 -5
- package/dist/SkillBrowser-3qdp8080.js +0 -5
- package/dist/WizardApp-vzpbydy3.js +0 -5
- package/dist/config-g7za9x13.js +0 -24
- package/dist/index-0d93hyfc.js +0 -6
- package/dist/index-1c5113t4.js +0 -66
- package/dist/index-1c5113t4.js.map +0 -12
- package/dist/index-258d8bzg.js +0 -12
- package/dist/index-4z7axw4r.js +0 -6
- package/dist/index-6p999cx4.js +0 -9
- package/dist/index-6q4wf8e3.js +0 -6
- package/dist/index-9r0wyj6w.js +0 -6
- package/dist/index-d4x6yvqh.js +0 -6
- package/dist/index-fecm8xe7.js +0 -77
- package/dist/index-fecm8xe7.js.map +0 -12
- package/dist/index-fex44816.js +0 -6
- package/dist/index-ff514z3y.js +0 -14
- package/dist/index-gz9x25tz.js +0 -6
- package/dist/index-h9mw7b9d.js +0 -6
- package/dist/index-hwpvhaza.js +0 -6
- package/dist/index-mtn0g9vc.js +0 -7
- package/dist/index-mtn0g9vc.js.map +0 -11
- package/dist/index-qdbq8crg.js +0 -6
- package/dist/index-tf71ap9v.js +0 -6
- package/dist/index-ttwyrdjs.js +0 -427
- package/dist/index-ttwyrdjs.js.map +0 -11
- package/dist/index-tv4yv7d2.js +0 -903
- package/dist/index-ty24n0jh.js +0 -167
- package/dist/index-ty24n0jh.js.map +0 -19
- package/dist/index-v8e92nfw.js +0 -6
- package/dist/index-vgc3y3rm.js +0 -6
- package/dist/index-whaw4b18.js +0 -6
- package/dist/index-whaw4b18.js.map +0 -10
- package/dist/web-vkb16r62.js +0 -14
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/templates.ts", "../src/lib/init-flow.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The workspace templates, embedded.\n *\n * Embedded rather than read from disk because the installed binary ships only `dist/` — an\n * `init` run in an arbitrary directory has no `examples/` to read. The human-edited source of\n * truth stays `examples/workspace-template/`; `test/templates.test.ts` asserts byte-equality\n * between that directory and these constants, so an edit to one without the other fails CI\n * rather than shipping a scaffold that silently drifted from the documented templates.\n *\n * These are the *un-substituted* forms, `{{PLACEHOLDER}}` tokens intact. Substitution is\n * `fillTemplate`'s job, and any token it does not fill survives into the generated file on\n * purpose — the `workspace` command warns about unfilled placeholders until a person writes\n * the real text, which is the nag-until-personalised mechanism working as designed.\n */\n\n/**\n * The starter skill `init --skills starter` scaffolds.\n *\n * Embedded for the same reason as the workspace templates, and byte-equal to\n * `examples/workspace-template/skills/starter/SKILL.md` by the same test. It carries no\n * `{{PLACEHOLDER}}` tokens: a skill is a procedure nobody can guess from the agent's name, so there is\n * nothing to substitute and the whole file is deliberately written as instructions to a person.\n */\nexport const SKILL_TEMPLATE =\n '---\\nname: {{SKILL_NAME}}\\ndescription: Replace this description with what the skill does and when to use it, naming the specific words someone would type \\u2014 file formats, tool names, the error they are looking at. Selection is lexical and this sentence is all it has.\\nmetadata:\\n \"{{WHEN_NOT_TO_USE_KEY}}\": >\\n Replace this too. Say what this skill is NOT for, and name the skill or the plain answer\\n that handles those cases instead.\\n---\\n\\n<!--\\nSKILL.md \\u2014 one procedure the agent follows on the turns that call for it.\\n\\nThe format is agentskills.io, so this folder is portable to other clients. The spec\\'s fields are\\n`name` (which must equal this directory\\'s name), `description`, and optionally `license`,\\n`compatibility`, `metadata` and `allowed-tools`. Anything else is ignored rather than refused.\\n\\nHOW SELECTION WORKS, because it changes how you write the description. The harness ranks every\\nskill\\'s name and description against what was just asked, picks at most `skills.maxActive`, and\\ninjects the winner. The model does not choose \\u2014 so the description is a routing signal aimed at a\\nlexical scorer, not a pitch aimed at a reader. Concrete nouns beat adjectives. A description whose\\nonly distinctive word is a common verb activates on any turn using that verb: measured, a skill\\nopening \"Write and debug a Dockerfile\" was selected for \"write me a haiku about autumn\".\\n\\nNegative guidance is not a spec field, which is why it lives under `metadata`. It is worth writing\\nanyway \\u2014 negative examples are the cheapest routing improvement available \\u2014 and `skills validate`\\nwarns when it is missing. It is never required to load, so a skill vendored from elsewhere works\\nas it arrives.\\n\\nTHE BODY IS INJECTED VERBATIM on every turn this skill activates, so every line below is paid for.\\nWrite steps, not background. Detail that is only occasionally needed goes in `references/` for the\\nmodel to read on demand. These HTML comments are stripped before the model sees the file, so\\nauthoring notes like this one are free.\\n\\nSCRIPTS. Drop an executable into `scripts/` and it becomes a tool named\\n`skill.{{SKILL_NAME}}.<filename>`, callable only while this skill is active. A `.py` runs under `python3`,\\nor under `uv run` if this folder has a `pyproject.toml` or `requirements.txt`; `.ts` and `.js` run\\nunder the host; anything else needs an executable bit and a shebang. A file in `scripts/` that\\nmatches none of those will never run, and `skills validate` says so. A deterministic script beats\\ninstructions the model has to interpret \\u2014 prefer one wherever the work is mechanical.\\n-->\\n\\nReplace everything below with the steps.\\n\\n1. State the first step as an action, not a topic.\\n2. Where a step has a rule that was learned the hard way, say the rule and why \\u2014 a step with a\\n reason generalises to the case you did not think of.\\n3. Say what to report at the end, and what not to do. A procedure that does not say where it stops\\n gets carried into the next turn.\\n'\n\nexport const WORKSPACE_TEMPLATE_FILES = [\n \"AGENTS.md\",\n \"POLICY.md\",\n \"USER.md\",\n \"MEMORY.md\",\n \"REMINDER.md\",\n \"SOUL.md\",\n \"SOUL.compact.md\",\n] as const\n\nexport type WorkspaceTemplateName = (typeof WORKSPACE_TEMPLATE_FILES)[number]\n\nexport const WORKSPACE_TEMPLATES: Record<WorkspaceTemplateName, string> = {\n \"AGENTS.md\":\n '---\\ntier: static\\neditable: none\\nbudget: 800\\n---\\n\\n<!--\\nAGENTS.md \\u2014 what this agent DOES: responsibilities and operating procedure.\\n\\nTIER 0. Sent every turn, cached, read-only to the agent. Budget: 800 tokens.\\n\\nThe identity lives in SOUL.md; this file is deliberately free of personality. The split\\nis the one the wider ecosystem converged on: if SOUL.md answers \"who are you?\", AGENTS.md\\nanswers \"what do you do, and how?\" Mixing them makes both files harder to maintain \\u2014 a\\ntone change should never touch a procedure, and a workflow change should never risk the\\nvoice.\\n\\nWHAT THIS FILE IS FOR: the agent\\'s job, stated as scope; how it works through a task;\\nwhen and where it records things. Operational truth that holds whatever mood the prose\\nin SOUL.md is in.\\n\\nWHAT IT IS NOT FOR: rules and boundaries (POLICY.md and the soul\\'s <rules> block own\\nthose, and the rule counter budgets them), facts about the user (USER.md), or anything\\nenforced in code \\u2014 a procedure written here is advisory the way all prompt text is.\\n\\nSTYLE: declarative first person \\u2014 \"I check X before Y\", never \"Check X before Y\". This\\nis not cosmetic: obligation-shaped lines (imperative openers, must/never/always) count\\nagainst the same rule budget as everything else in the static tier, and a procedures\\nfile written as commands reads as twenty rules. Written as description, it reads as one\\njob. The workspace command\\'s authoring checks will tell you if a line counts.\\n-->\\n\\n# What I do\\n\\n{{RESPONSIBILITIES}}\\n\\n# How I work\\n\\n{{WORKFLOW}}\\n\\n# How I use memory\\n\\n{{MEMORY_PROCEDURE}}\\n\\n<!-- \\u2500\\u2500 Team \\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\nSub-agent responsibilities and handoff routing live here once delegation ships. This\\nsection stays commented out until then: comments are stripped before the model sees the\\nfile, and a visible instruction to \"hand off to the research agent\" on a runtime that\\ncannot delegate yet produces confidently narrated handoffs that never happened.\\n\\n# Team\\n\\n- <sub-agent>: <what it owns, and what I hand it>\\n- <sub-agent>: <what it owns, and what I hand it>\\n\\nWhat comes back from a sub-agent I treat as a draft to check, not a fact to repeat.\\n\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500 -->\\n',\n \"POLICY.md\":\n \"---\\ntier: static\\neditable: none\\nbudget: 600\\n---\\n\\n<!--\\nPOLICY.md \\u2014 the few standing boundaries worth prompt tokens.\\n\\nTIER 0. Sent every turn, cached, read-only. Budget: 600 tokens.\\n\\nREAD THIS BEFORE WRITING ANYTHING HERE.\\n\\nThis file is NOT a security control. Prompt-level restrictions are advisory: automated\\nattacks defeat them on open-weight models at very high success rates, and patient\\nmulti-turn pressure defeats them with no tooling at all. Anything you need to be TRUE\\nmust be enforced in code at the tool boundary.\\n\\n Belongs in code, not here How to enforce it\\n --------------------------------- --------------------------------------------\\n Cannot spend money no payment tool, or approval middleware\\n Cannot email arbitrary people recipient allowlist in the tool\\n Cannot delete data no destructive tool bound to this agent\\n Cannot read other users' data scoped credentials, per agent\\n Cannot exceed a budget usage tracking in middleware\\n Cannot touch production separate credentials per environment\\n\\n Belongs here\\n ---------------------------------\\n Tone under pressure\\n When to defer rather than act\\n What to decline, and how\\n What to do when uncertain\\n\\nIf you find yourself writing \\\"never\\\" about something that would be expensive if it\\nhappened, stop and write a wrapToolCall middleware instead.\\n\\nSTATE THE REASON alongside each boundary. A boundary with a rationale generalises to\\nsituations you didn't enumerate; a bare prohibition only covers what it names.\\n\\nSTYLE: match the target output, same as the identity file. Prose for chat agents.\\n\\nBUDGET: two or three items. They count against the same rule budget as the identity\\nfile, AGENTS.md, and\\nREMINDER.md. Many agents need none \\u2014 delete the file and the loader skips it.\\n-->\\n\\n# Policy\\n\\n<!--\\nSoft boundaries, each with its reason.\\n\\n Weak: Never share information about other people.\\n Better: If something involves a person other than the user, ask what they want shared\\n before including it \\u2014 the user knows the relationship and I don't.\\n-->\\n\\n{{BOUNDARIES}}\\n\\n<!--\\nOne line: what the agent does when it doesn't know, can't reach a tool, or hits an\\nambiguous request. A defined fallback measurably reduces confabulation and gives the\\nagent somewhere to go other than guessing.\\n-->\\n\\n{{UNCERTAINTY_BEHAVIOUR}}\\n\",\n \"USER.md\":\n '---\\ntier: volatile\\neditable: append\\nbudget: 1500\\n---\\n\\n<!--\\nUSER.md — what the agent knows about the person it works for.\\n\\nTIER 1. Sent every turn, UNCACHED. Budget: 1500 tokens.\\n\\nYou write this file. The agent reads it every turn. memory_write does not land\\nhere — that tool writes MEMORY.md, which declared eviction: oldest. This file\\nis appendable so you can add a standing fact by hand; notes the agent saves\\nhave a budget and an overflow, and this file has neither.\\n\\nThis file sits AFTER cache breakpoint A because the volatile tier changes:\\nMEMORY.md is rewritten on every save, and a changing file ahead of the\\nbreakpoint would invalidate the cached prefix on every write with no error\\nand no symptom beyond the bill.\\n\\nWHAT THIS FILE IS FOR: standing facts about the user — name, role, timezone,\\ncontext, preferences they should not have to restate. Facts, not transcript:\\n\"prefers answers under a paragraph\" belongs here; \"asked about the weather on\\nTuesday\" does not.\\n\\nWHAT IT IS NOT FOR: rules. An obligation written here escapes the rule budget\\'s\\ncount (volatile is excluded — it holds facts about the person, not policy) but\\nthe model reads it like any other instruction, so a rule hidden here is a rule\\nnobody budgeted for. Put rules in the soul\\'s <rules> block and let the guard\\ncount them.\\n\\nWHAT IT IS NOT FOR: working notes. A save that lands here has no eviction and\\ngrows until the next load fails. Promote a settled fact from MEMORY.md into\\nthis file by hand.\\n\\nFORMAT: short declarative lines, one fact per line, in prose — not bullets.\\nModels imitate form. Keep the authored part small and stable — every token\\nhere is paid on every turn.\\n-->\\n\\n# {{USER}}\\n\\n{{USER_FACTS}}\\n\\n<!--\\nAdd standing facts below, one prose sentence each. Leave a line out rather than\\nguessing. Timezone, how they like to be addressed, role and recurring people,\\nlength and tone, tools they always want or never want.\\n-->\\n',\n \"MEMORY.md\":\n \"---\\ntier: volatile\\neditable: replace\\nbudget: 2000\\neviction: oldest\\n---\\n\\n<!--\\nMEMORY.md — the agent's working memory.\\n\\nTIER 1. Sent every turn, UNCACHED, agent-writable (replace + oldest-first eviction).\\nBudget: 2000 tokens.\\n\\nmemory_write lands here. The runtime resolves ONE write target — the writable\\nvolatile file that declared `eviction: oldest` — and the model never chooses a\\nfilename, because choosing would be a second decision on every save and that is\\nthe two-hop shape small models fail. Declared order does not decide it: USER.md\\nis listed first and is writable, and saves still land HERE. That is why USER.md\\ndoes not grow until the agent refuses to boot.\\n\\nWHAT THIS FILE IS FOR: state that matters across sessions but is not a durable\\nfact about the user — open threads, decisions taken, things promised. It is\\ncapped and evicting by design: working memory that only ever grows becomes a\\nsecond conversation history, paid for on every turn.\\n\\nWHAT IT IS NOT FOR: an archive. When something stops being working state and\\nbecomes a fact about the person, it belongs in USER.md; when it is reference\\nmaterial needed only sometimes, it belongs in knowledge/, which costs nothing\\non the turns that don't mention it.\\n\\nLeave the body empty below this comment. The agent fills it; you don't.\\n-->\\n\",\n \"REMINDER.md\":\n \"---\\ntier: reminder\\neditable: none\\nbudget: 500\\n---\\n\\n<!--\\nREMINDER.md \\u2014 one or two rules, re-asserted where attention is strongest.\\n\\nTIER 2. Injected AFTER the conversation history, before retrieved memory and the current input.\\nBudget: 500 tokens \\u2014 and using a fraction of it is the point.\\n\\nRule adherence decays over a conversation and compaction does not reliably reset it.\\nAttention is stronger at both ends of the context than in the middle, so a rule stated\\nonce at the top of a thirty-turn session is effectively in the middle. This file re-states\\nthe one or two rules that must survive turn thirty, at the recency position.\\n\\nONE OR TWO RULES. This is not a second policy file: everything here counts against the\\nsame rule budget as the rest of the static tier (the model does not know the text came from\\ndifferent files), and a reminder tier that grows into a policy file spends the position\\nit exists to exploit.\\n\\nPick the rule whose failure is most expensive \\u2014 usually the confirm-before-consequences\\none \\u2014 and restate it in the same words the identity file uses. Same words, not a paraphrase: two\\nphrasings of one rule read as two rules.\\n\\nOmit this file entirely for short-lived agents; drift isn't a problem under ~10 turns.\\n-->\\n\\n{{REMINDER_RULE}}\\n\",\n \"SOUL.md\":\n '---\\ntier: static\\nbudget: 1400\\n---\\n\\n<!--\\nSOUL.md \\u2014 the long-form identity document, in the style of a model constitution.\\n\\nThis file ships ONLY to a model that meets context.soul.requires (a big window on a\\nfrontier-class id). Anything else gets SOUL.compact.md instead and never sees this file.\\nIts premise is that a capable model, given enough understanding of the goals, can derive\\nrules the author never wrote \\u2014 so write it as explanation, not instruction.\\n\\nThe <rules> block is the exception: rules survive distillation verbatim and hold on every\\nmodel. Keep each rule to ONE LINE \\u2014 the rule counter is line-based. The prose outside\\n<rules> is exempt from rule counting for this file only; the compact file enjoys no such\\nexemption.\\n\\nA soul owns WHO the agent is. Operations \\u2014 responsibilities, workflows, team routing \\u2014\\nlive in AGENTS.md, which coexists with the soul; what must not exist is a second identity\\ndocument in the same prefix, because two identities contradict each other.\\n\\nEvery paragraph here is a starting point, not a script. The fastest way to a distinctive\\nagent is rewriting \"How I sound\" in the voice you actually want back, then re-deriving\\nSOUL.compact.md by hand to match. Edit this file first, the compact one second \\u2014 never\\nthe reverse.\\n-->\\n\\n# Who {{AGENT_NAME}} is\\n\\n{{SOUL_WHO}}\\n\\n{{SOUL_MEASURE}}\\n\\n# How I think about answers\\n\\n{{SOUL_ANSWERS}}\\n\\n<rules>\\n{{RULE_CONFIRM}}\\n{{RULE_HONESTY}}\\n{{RULE_MEMORY}}\\n</rules>\\n\\n# How I sound\\n\\n{{SOUL_VOICE}}\\n\\n## How I talk\\n\\n<!--\\nThree short exchanges, in the voice above. This is the highest-leverage section in the\\nfile and the main defence against generic output \\u2014 an example demonstrates a voice that\\nadjectives can only describe. Keep them varied: three examples about one topic produce\\nan agent that steers every conversation toward it. The placeholders below are deliberate:\\nthe workspace command warns until you replace them with real exchanges.\\n-->\\n\\n<example>\\n{{USER}}: {{INPUT_1}}\\n{{AGENT_NAME}}: {{REPLY_1}}\\n</example>\\n\\n<example>\\n{{USER}}: {{INPUT_2}}\\n{{AGENT_NAME}}: {{REPLY_2}}\\n</example>\\n\\n<example>\\n{{USER}}: {{INPUT_3}}\\n{{AGENT_NAME}}: {{REPLY_3}}\\n</example>\\n\\n# What I refuse to become\\n\\n{{SOUL_REFUSE}}\\n',\n \"SOUL.compact.md\":\n \"---\\ntier: static\\nbudget: 800\\n---\\n\\n<!--\\nCompact identity, derived from SOUL.md. This is the file small models actually run on, so\\nevery sentence here is paid for on every turn \\u2014 keep it to the few that produce the voice.\\nThe long document stays the source of truth: edit it first, then re-derive this by hand.\\n\\nUnlike SOUL.md, EVERY line here counts against the rule budget, not just the <rules>\\nblock \\u2014 a small model does not get the benefit of the derivation exemption, because it is\\nprecisely the model that cannot derive.\\n-->\\n\\n# Who {{AGENT_NAME}} is\\n\\n{{SOUL_COMPACT_WHO}}\\n\\n# How I think about answers\\n\\n{{SOUL_COMPACT_ANSWERS}}\\n\\n<rules>\\n{{RULE_CONFIRM}}\\n{{RULE_HONESTY}}\\n{{RULE_MEMORY}}\\n</rules>\\n\\n# How I sound\\n\\n{{SOUL_COMPACT_VOICE}}\\n\\n## How I talk\\n\\n<!-- The same three exchanges as SOUL.md, or trimmed variants \\u2014 same voice, fewer words. -->\\n\\n<example>\\n{{USER}}: {{INPUT_1}}\\n{{AGENT_NAME}}: {{REPLY_1}}\\n</example>\\n\\n<example>\\n{{USER}}: {{INPUT_2}}\\n{{AGENT_NAME}}: {{REPLY_2}}\\n</example>\\n\\n<example>\\n{{USER}}: {{INPUT_3}}\\n{{AGENT_NAME}}: {{REPLY_3}}\\n</example>\\n\\n# What I refuse to become\\n\\n{{SOUL_REFUSE}}\\n\",\n}\n\n/**\n * Replace `{{NAME}}` tokens with values; tokens without a value survive untouched.\n *\n * Deliberately not an error path: a surviving token is the scaffold contract, not a failure.\n * The regex is the same shape the authoring check uses to *find* placeholders, so what this\n * function leaves behind is exactly what `checkAuthoring` will report.\n */\nexport function fillTemplate(text: string, values: Record<string, string>): string {\n return text.replace(/\\{\\{\\s*([A-Za-z0-9_]+)\\s*\\}\\}/g, (token, name: string) => {\n const value = values[name]\n return value === undefined ? token : value\n })\n}\n",
|
|
6
|
+
"/**\n * The init wizard's question flow and file plan — pure data in, pure data out.\n *\n * Deliberately renderer-free and process-free (it is in the boundaries test's PURE list): the\n * readline loop in `init.ts` is one consumer, a flag-driven non-interactive run is another, and\n * an Ink wizard would be a third if one ever pays for itself. The flow cannot know which is\n * driving it, which is what keeps the three from diverging.\n *\n * Generated text carries two kinds of content. Everything *structural* — identity, voice, rules,\n * policy — is genuinely filled from the answers, so the agent runs and validates immediately.\n * The three dialogue examples keep their `{{INPUT_n}}`/`{{REPLY_n}}` placeholders on purpose:\n * examples are the highest-leverage section of an identity file and stock ones teach a stock\n * voice, so the `workspace` command keeps warning until a person writes real exchanges.\n */\n\nimport { BRAND, whenNotToUseKey } from \"@dispach/core\"\nimport { fillTemplate, SKILL_TEMPLATE, WORKSPACE_TEMPLATES } from \"#lib/templates\"\n\n/**\n * The local tools every generated agent starts with, and the one line of guidance each carries\n * into the generated manifest and the wizard's tools screen — single-sourced so the two cannot\n * drift, and pinned by a test to core's `LOCAL_TOOL_SLUGS` so a new local tool cannot ship\n * without init knowing.\n */\nexport const INIT_LOCAL_TOOLS: readonly { readonly slug: string; readonly note: string }[] = [\n { slug: \"now\", note: \"read-only: runs in parallel with other reads\" },\n {\n slug: \"memory_write\",\n note: \"mutating: serialises, holds a reserved write slot, never retried\",\n },\n {\n slug: \"artifact_read\",\n // Pinned by default rather than offered as a choice, and that is not the usual bias here.\n // Compaction is always on — the thresholds are manifest values with defaults — so a generated\n // agent will eventually replace a large tool result with a pointer whether or not anyone\n // decided anything. Without this tool that pointer names an id nothing can resolve: the\n // model is told detail was removed and given no way to get it back, which is worse than\n // either having the tool or never seeing the marker.\n note: \"read-only: follows the pointer compaction leaves behind\",\n },\n]\n\n/** Exported so the drift test can compare against core without re-deriving the mapping. */\nexport const INIT_LOCAL_TOOL_SLUGS: readonly string[] = INIT_LOCAL_TOOLS.map((tool) => tool.slug)\n\nexport type PresetId =\n | \"openai\"\n | \"anthropic\"\n | \"deepseek\"\n | \"openrouter\"\n | \"groq\"\n | \"nvidia\"\n | \"ollama\"\n | \"ollama-cloud\"\n | \"custom\"\n\nexport interface Preset {\n readonly id: PresetId\n readonly label: string\n /** Empty for `custom`, which has no defaults to offer. */\n readonly modelId: string\n readonly baseUrl: string\n /** Absent means the manifest omits `apiKeyEnv` entirely — a keyless local endpoint. */\n readonly apiKeyEnv?: string\n}\n\n/**\n * The same presets the examples' `.env.example` documents, plus the aggregators and Ollama.\n * `custom` exists so an unlisted endpoint is a first-class answer rather than a fight with the\n * nearest preset.\n *\n * **Every one of these is the same transport.** There is no provider branch in\n * `chat-completions.ts` — one POST, one body builder — so a preset is nothing but three strings,\n * and adding one is cheap precisely because it buys no special-casing. What a preset *is* for is\n * that a base URL has to end at the version segment (the runtime appends `/chat/completions`\n * itself, and a URL pasted from a provider's docs with the full path is refused three times over),\n * and that is the sort of thing nobody should have to get right from memory.\n *\n * **`ollama` and `ollama-cloud` are two rows on purpose.** Local Ollama needs no key, and the\n * absent `apiKeyEnv` is what makes the manifest omit the field and the provider send no\n * `authorization` header. Ollama Cloud needs one. With a single row, choosing `ollama` and then\n * editing the base URL to the hosted endpoint produced a **keyless manifest with no route to a\n * key** short of hand-editing `apiKeyEnv` back in — a dead end reached by the obvious move.\n */\nexport const PRESETS: readonly Preset[] = [\n {\n id: \"openai\",\n label: \"OpenAI\",\n modelId: \"gpt-5-6-sol\",\n baseUrl: \"https://api.openai.com/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"anthropic\",\n label: \"Anthropic (OpenAI-compatible endpoint)\",\n modelId: \"claude-sonnet-5\",\n baseUrl: \"https://api.anthropic.com/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"deepseek\",\n label: \"DeepSeek\",\n modelId: \"deepseek-v4-flash\",\n baseUrl: \"https://api.deepseek.com/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"openrouter\",\n label: \"OpenRouter (many providers, one key)\",\n modelId: \"deepseek/deepseek-chat\",\n baseUrl: \"https://openrouter.ai/api/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"groq\",\n label: \"Groq\",\n modelId: \"llama-3.3-70b-versatile\",\n baseUrl: \"https://api.groq.com/openai/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"nvidia\",\n label: \"NVIDIA NIM\",\n modelId: \"meta/llama-3.3-70b-instruct\",\n baseUrl: \"https://integrate.api.nvidia.com/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"ollama\",\n label: \"Ollama (local, no key)\",\n modelId: \"qwen3.5:9b\",\n baseUrl: \"http://localhost:11434/v1\",\n },\n {\n // Two rows rather than one — see the block comment above. The hosted endpoint takes a key\n // and the local one must not, and a single row made the second reachable only by hand.\n id: \"ollama-cloud\",\n label: \"Ollama Cloud (hosted, needs a key)\",\n modelId: \"gpt-oss:120b\",\n baseUrl: \"https://ollama.com/v1\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n {\n id: \"custom\",\n label: \"any other OpenAI-compatible endpoint\",\n modelId: \"\",\n baseUrl: \"\",\n apiKeyEnv: \"MODEL_API_KEY\",\n },\n] as const\n\nexport function presetById(id: string): Preset | undefined {\n return PRESETS.find((preset) => preset.id === id)\n}\n\nexport interface InitAnswers {\n /** The person's name. */\n readonly user: string\n /** The agent's name. Drives the manifest `id` and the default directory. */\n readonly name: string\n /** One line: what the agent is for. */\n readonly purpose: string\n readonly preset: PresetId\n readonly model: string\n readonly baseUrl: string\n /**\n * The env var the manifest names. Absent = the manifest omits the field entirely (a keyless\n * endpoint). Set from `--api-key-env` or the preset, never asked: which *variable* holds the\n * key is a detail of the generated file, and asking for it while asking for every other value\n * outright is the confusing shape this replaced.\n */\n readonly apiKeyEnv?: string\n /**\n * The key itself. Written to the gitignored `.env` beside the manifest, never to `agent.yaml`\n * — hard rule 10 is about what the *manifest* contains, and it still holds: the manifest names\n * the variable, this fills it in.\n *\n * Empty is a legitimate answer for anyone who exports the variable another way, and the next\n * steps keep saying so.\n */\n readonly apiKey?: string\n /**\n * How much of this machine the agent may touch: `none`, `read`, or `full`.\n *\n * Asked rather than left as a commented block, because the block was the bug. The generated\n * manifest named neither the provider nor the tools, so shell access was reachable only by\n * someone who already knew the field names — which is the opposite of what a generated file is\n * for. The answer writes real config, permission rules included, and `none` writes the same\n * block commented out so the shape is still there to uncomment.\n */\n readonly system: string\n /**\n * Whether it can reach the internet: `none`, `fetch`, or `search`.\n *\n * Asked for the same reason `system` is, and found the same way. The web provider was generated\n * commented out, so asked whether it could search the web an agent answered that the only route\n * was shell access and `curl` — a correct reading of its own catalogue and a false statement\n * about the runtime. Every capability this runtime has is a question here now; a generated file\n * that hides its own options is not doing the job a generated file exists for.\n */\n readonly web: string\n /** Which search backend, when `web` is `search`. Ignored otherwise. */\n readonly webBackend?: string\n /**\n * The search key itself, written to the gitignored `.env` beside the manifest. Same rule as the\n * model key: the manifest names the variable, no flag accepts the value.\n */\n readonly webKey?: string\n /**\n * Whether the agent reaches the person's other apps through Composio: `none` or `connected`.\n *\n * A question for the same reason `system` and `web` are — the provider shipped finished and\n * generated as a single commented line, which is the third time a built capability reached a\n * generated manifest hidden. What differs is what the answer can *do*, and the difference is\n * real rather than an inconsistency to iron out: see `COMPOSIO_CHOICES`.\n */\n readonly composio: string\n /**\n * The Composio key, written to the gitignored `.env`. Same rule as every other secret here: the\n * manifest names the variable, no flag accepts the value.\n */\n readonly composioKey?: string\n /**\n * Whether people can message it on Telegram: `none` or `connected`.\n *\n * A question for the same reason `system`, `web` and `composio` are, and found the same way —\n * Phase 4 shipped the channel and `init` generated it commented, so the only route to a working\n * bot was knowing the field names. It is the fourth time a finished capability reached a\n * generated manifest hidden, which is why the rule is now standing rather than case by case.\n */\n readonly telegram: string\n /**\n * WhatsApp, asked separately from Telegram rather than as one multi-select.\n *\n * Two independent single-selects is the cheapest correct shape and satisfies \"both at once\"\n * naturally. The alternative — one `none | telegram | whatsapp | both` answer — would need the\n * pure wizard reducer to store more than one value per question, and would need\n * `ProvisionStep.requires` to name two values so a browser form kept the follow-up fields\n * visible under `both`: a breaking wire change for nothing. It also matches how `system`, `web`\n * and `composio` already work — one capability, one question.\n */\n readonly whatsapp: string\n /**\n * The bot token, written to the gitignored `.env`. Same rule as every other secret: the\n * manifest names the variable, no flag accepts the value.\n */\n readonly telegramToken?: string\n /**\n * Who may message it — one Telegram handle, or empty.\n *\n * Empty is a real answer and a safe one: `allowFrom: []` permits nobody, and the first message\n * from anyone prints the exact line to add. That is a better first run than guessing a handle\n * into the file, because a wrong handle fails the same way an empty list does and says less.\n */\n readonly telegramAllow?: string\n /** A WhatsApp number in digits. There is no token: pairing is a QR, not a credential. */\n readonly whatsappNumber?: string\n /**\n * Whether to serve the HTTP API: `none` or `local`.\n *\n * `local` binds loopback. A public bind is a deliberate edit afterwards, and it refuses to\n * start without a token — which is why the generated `.env` gets one rather than an empty line.\n */\n /**\n * What the agent runs on a schedule: `none`, `daily` or `hourly`.\n *\n * Not asked. Set by `--schedules` or defaulted to `none` in `complete()` — see\n * `SCHEDULE_CHOICES` for why this capability has no question, and `apiKeyEnv` for why the\n * default lives at that funnel rather than as a step fallback.\n */\n readonly schedules: string\n readonly server: string\n /**\n * The API token, generated rather than asked. Not a third-party credential and not a choice —\n * `openssl rand -hex 32` is what someone does by hand here, so the command does it.\n */\n readonly serverToken?: string\n /**\n * Whether to keep it running in the background: `none` or `service`.\n *\n * Writes nothing — see `DAEMON_CHOICES`. It decides whether the last screen names the command,\n * which is the whole of its job: `serve` dies with its terminal, and nothing in the flow said so.\n */\n readonly daemon: string\n /**\n * Whether the agent gets a skills directory: `none` or `starter`.\n *\n * `none` still writes the block and an empty directory rather than omitting it. A configured-and-empty\n * directory is a switch that is off, which slot 2 reports as such; no block at all is a concept the\n * agent does not have and will not ask about — decision 5.19, and the same reason `--system none`\n * still names its provider.\n */\n readonly skills: string\n /**\n * Words to search the skill sources for. **Set by `--skills \"<phrase>\"` and never asked.**\n *\n * It was a wizard question for exactly one commit, and that was the wrong answer to \"ask about skills\n * during init\": a text box asking what the agent does often, in a tree that already had a catalogue\n * picker. At a terminal `find` now shows the real list and this stays empty. It survives for the\n * scripted path, where a picker cannot run — the ranking is the same `bm25Selector` that decides\n * activation, so what a CI run installs is what will fire.\n */\n readonly skillsSearch?: string\n /**\n * Comma-separated `<source>/<skill>` refs the person ticked in the wizard's catalogue step.\n *\n * Not in `STEP_ORDER` and never produced by `nextQuestion`: the catalogue is a *screen*, not a question,\n * and `nextQuestion` is pure and synchronous. The wizard root fetches, shows the checklist, and writes\n * the answer here — which keeps the reducer static-option-only while the flow still contains the list.\n */\n readonly skillsPick?: string\n /**\n * Where the agent lives: `sandbox`, `here`, or `custom`.\n *\n * A menu rather than a prefilled path, because \"somewhere else\" was reachable only by clearing a\n * 37-character absolute path and retyping it — and because a menu puts the *cost* on the label at\n * the moment of choosing, where a note printed afterwards cannot. `custom` is the only answer that\n * asks a follow-up, exactly as `web: search` is the only one that asks for a backend.\n *\n * Optional, and only because the reverse implication has to hold too: `--dir` answers the question,\n * so asking it would be asking something whose answer the funnel then ignores. Absence is safe here\n * in the way `agentDirBase`'s was not — it means `dir` was given, and if somehow neither yields a\n * path `complete()` throws rather than guessing.\n */\n readonly dirChoice?: string\n /**\n * Target directory, as given — the command resolves it against the cwd.\n *\n * **Asked only when `dirChoice` is `custom`**, and otherwise derived at the `complete()` funnel.\n * That derivation is load-bearing rather than convenient: a step that stops being asked without\n * its default moving to the funnel is how `apiKeyEnv` once vanished from generated manifests\n * entirely, so `dirFor` is one function and the guard is a test reading the path back out of a\n * real run.\n */\n readonly dir: string\n}\n\n/**\n * What web access an agent may be given, and what each answer pins.\n *\n * `none` still names the provider, exactly as `--system none` does — naming is what makes\n * `available()` run, and `available()` is the only reason the model can say \"web_search exists and is\n * not enabled for me\" rather than \"I cannot search the web\".\n *\n * `fetch` is separated from `search` because they have genuinely different costs: `web_fetch` needs\n * no account anywhere, and `web_search` needs a key from a third party. Collapsing them would force\n * anyone who wants to hand their agent a URL to go and sign up for something first.\n */\n/**\n * Whether the agent runs anything on a schedule, and what the generated manifest shows.\n *\n * **Flag-only: `--schedules`, and no wizard step.** The standing rule is that every capability the\n * runtime has is a question in `init`, and the exception it already carries is the one that applies\n * here — *not every hidden capability wants a question; a switch that is off wants to exist*, which\n * is how `knowledge:` shipped with scaffolding and a commented block instead of a screen. A schedule\n * is not a thing anyone knows they want at minute two of setting an agent up; it is a thing they want\n * three days later, and by then the answer is `config_set` from a conversation or an edit to the file\n * the commented block is already sitting in.\n *\n * So `none` — the value every interactive and every `--yes` run takes — writes the commented\n * `schedules:` block with a worked example, for the same reason `--system none` still names the\n * provider. The flag survives because a scripted setup has no other route, exactly as\n * `--skills \"<phrase>\"` survives a picker that cannot run in CI.\n *\n * `daily` and `hourly` stay offered by the flag because a cron expression is exactly the kind of\n * thing people get wrong once and then avoid. Only `serve` fires them, which the generated comments\n * say.\n */\nexport const SCHEDULE_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n { value: \"none\", label: \"no — the block is written commented, with an example\" },\n { value: \"daily\", label: \"a daily briefing at 08:00\" },\n { value: \"hourly\", label: \"an hourly check\" },\n]\n\nfunction scheduleChoice(value: string): { readonly value: string } | undefined {\n return SCHEDULE_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * Where a new agent's directory goes.\n *\n * The labels carry the whole trade-off, because this is the only moment it is cheap to reconsider: an\n * agent inside the sandbox is reachable by bare name from anywhere, and one outside is reachable only\n * by path — `run`, `config`, `daemon`, `schedules`, every one of them, forever. That sentence used to\n * be a note printed *after* the choice was made.\n *\n * `custom` is the escape hatch and stays: a project-local agent is a real thing to want, and a wizard\n * that refuses it is one people work around with `mv`.\n */\nexport const DIR_CHOICES: readonly {\n readonly value: string\n /** Only for the row that has no path to show; the other two are labelled by their directory. */\n readonly label: string\n readonly hint: string\n}[] = [\n { value: \"sandbox\", label: \"the sandbox\", hint: \"run it by name from anywhere\" },\n { value: \"here\", label: \"the current directory\", hint: \"every later command needs its path\" },\n { value: \"custom\", label: \"somewhere else\", hint: \"type a path\" },\n]\n\nfunction dirChoice(value: string): { readonly value: string } | undefined {\n return DIR_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * The directory a non-`custom` answer means.\n *\n * One function, called by the confirm screen and by `complete()`, because two derivations of \"where\n * is this going\" is how a summary comes to describe a path other than the one written — and this is\n * the one screen whose whole job is to be believed before anything exists on disk.\n *\n * Returns `undefined` for `custom`: there is nothing to derive, the `dir` question was asked.\n */\nexport function dirFor(\n choice: string | undefined,\n name: string | undefined,\n defaults: QuestionDefaults,\n): string | undefined {\n if (name === undefined) return undefined\n // Plain \"/\" concatenation, as everywhere in this module: a PURE module cannot import node:path.\n if (choice === \"sandbox\") return `${defaults.agentDirBase}/${slugify(name)}`\n if (choice === \"here\") return `./${slugify(name)}`\n return undefined\n}\n\nexport const WEB_CHOICES: readonly {\n readonly value: string\n readonly label: string\n readonly pinned: readonly string[]\n}[] = [\n {\n value: \"none\",\n label: \"No — but it will know the web tools exist and can ask you to enable them\",\n pinned: [],\n },\n {\n value: \"fetch\",\n label: \"Read pages — it can open a URL you give it. No account or key needed\",\n pinned: [\"web_fetch\"],\n },\n {\n value: \"search\",\n label: \"Search and read — needs an API key from a search provider\",\n pinned: [\"web_search\", \"web_fetch\"],\n },\n]\n\nexport function webChoice(value: string): (typeof WEB_CHOICES)[number] | undefined {\n return WEB_CHOICES.find((choice) => choice.value === value)\n}\n\n/** The search backends, with the variable each conventionally reads. */\nexport const WEB_BACKENDS: readonly {\n readonly value: string\n readonly label: string\n readonly apiKeyEnv: string\n}[] = [\n {\n value: \"tavily\",\n label: \"Tavily — built for agents, generous free tier\",\n apiKeyEnv: \"TAVILY_API_KEY\",\n },\n { value: \"brave\", label: \"Brave Search\", apiKeyEnv: \"BRAVE_API_KEY\" },\n { value: \"exa\", label: \"Exa — neural search, returns page excerpts\", apiKeyEnv: \"EXA_API_KEY\" },\n]\n\nexport function webBackendByValue(value: string): (typeof WEB_BACKENDS)[number] | undefined {\n return WEB_BACKENDS.find((backend) => backend.value === value)\n}\n\n/** The variable the Composio provider reads when the manifest names none. Its own default. */\nexport const COMPOSIO_KEY_ENV = \"COMPOSIO_API_KEY\"\n\n/**\n * Whether the agent is wired to the person's other apps, and what `connected` actually pins.\n *\n * **It pins two tools, and neither is an app tool.** `composio_search` finds the tools a task needs\n * and records their definitions; `composio_connect` returns the sign-in link for an account. Between\n * them the agent gets from \"connect my Gmail\" to a pinned, working `GMAIL_SEND_EMAIL` without anyone\n * opening a dashboard: it searches, hands over the link, writes the slug into `tools.pinned` with\n * `config_set`, and asks for a restart.\n *\n * The restart is the design rather than a limitation worked around. Decision 4.7 fixes the working\n * set at load because search-then-execute is two-hop reasoning and small models fail it — and that\n * still holds, because this is *setup*, which happens once, at the moment a person is already\n * pausing to click an OAuth link. What is deliberately absent is a `composio_execute(slug, args)`\n * that runs anything discovered: that would make every Composio task two-hop, forever, on every\n * model.\n *\n * The route this replaces was not a worse route, it was **no route**. `tools --warm` refreshes the\n * slugs already in `pinned`, so a slug had to be known before it could be warmed and warmed before\n * it could be pinned — the only way in was composio.dev in a browser, and nothing said so. An agent\n * asked to connect a Gmail account spent 4,417 output tokens establishing that.\n *\n * `none` names the provider with nothing pinned, exactly as `web` does. It did not while this\n * provider had no `available()` worth calling; three fixed meta tools changed that premise, and\n * \"I could search your apps if you enable composio_search\" is the sentence `available()` exists for.\n */\nexport const COMPOSIO_CHOICES: readonly {\n readonly value: string\n readonly label: string\n readonly pinned: readonly string[]\n}[] = [\n {\n value: \"none\",\n label: \"No — but it will know the route exists and can tell you how to switch it on\",\n pinned: [],\n },\n {\n value: \"connected\",\n label: \"Yes — Gmail, Slack, Notion and ~1,000 more, via a Composio account\",\n // Not the workbench. It runs Python somewhere no rule written in this manifest can reach —\n // a broader grant than `exec`, and one that belongs behind a deliberate edit rather than an\n // answer to \"can it use your other apps?\".\n pinned: [\"composio_search\", \"composio_connect\"],\n },\n]\n\nexport function composioChoice(value: string): (typeof COMPOSIO_CHOICES)[number] | undefined {\n return COMPOSIO_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * What system access an agent may be given, and what each answer pins.\n *\n * Three rather than two because \"can it read my files\" and \"can it change them\" are genuinely\n * different questions, and collapsing them forces anyone who wants a reviewer or a summariser to\n * grant a shell they never needed.\n */\nexport const TELEGRAM_TOKEN_ENV = \"TELEGRAM_BOT_TOKEN\"\n\n/**\n * Whether the agent is reachable on Telegram.\n *\n * Unlike `web` and `system`, `none` writes nothing live: a channel has no `available()` for the\n * model to read, so naming a switched-off one would buy none of what naming a provider buys. It\n * writes the same block commented, with a heading that does not end in a colon — uncommenting one\n * that did turned the heading itself into a YAML key, which is a papercut this generated exactly\n * once before someone hit it.\n */\nexport const TELEGRAM_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n { value: \"none\", label: \"No — it is reachable through the CLI and the API only\" },\n { value: \"connected\", label: \"Yes — a Telegram bot, long-poll (needs no public URL)\" },\n]\n\nexport function telegramChoice(value: string): (typeof TELEGRAM_CHOICES)[number] | undefined {\n return TELEGRAM_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * WhatsApp, and the label carries the warning because this is where the choice is made.\n *\n * Baileys reverse-engineers WhatsApp Web with no appeal path when a number is banned, so the one\n * sentence that matters — pair a spare number — belongs at the moment somebody says yes, not three\n * files away in a README they will read afterwards if at all.\n */\n/**\n * Where the plugin is published, and the name it installs under.\n *\n * Derived from the brand rather than written, because hard rule 3 puts the product name in exactly\n * one file — and a rename that left a literal here would print an install command for a repository\n * that does not exist. The owner is a person's GitHub handle, which a rename does not move.\n */\n\nexport const WHATSAPP_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n { value: \"none\", label: \"No\" },\n {\n value: \"connected\",\n label: \"Yes — unofficial, and it can get a number banned. Use a spare one.\",\n },\n]\n\nexport function whatsappChoice(value: string): (typeof WHATSAPP_CHOICES)[number] | undefined {\n return WHATSAPP_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * Whether to serve the HTTP surface.\n *\n * Loopback only. Binding a public host is a deliberate edit, and it refuses to start without a\n * token — so the generated `.env` carries a real one rather than an empty line to fill in. That is\n * the one secret this command can legitimately mint: it is ours, not a third party's, and there is\n * no shell-history risk because nothing types it.\n */\nexport const SERVER_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n { value: \"none\", label: \"No\" },\n { value: \"local\", label: \"Yes — HTTP, SSE and WebSocket on 127.0.0.1:7420\" },\n]\n\nexport function serverChoice(value: string): (typeof SERVER_CHOICES)[number] | undefined {\n return SERVER_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * Whether this agent should keep running without a terminal.\n *\n * The answer writes **nothing** — no service, no manifest field. Not a service, because at this\n * point in the flow the `.env` is still empty of the bot token in the common case, and the install\n * check that exists to catch exactly that would fail; installing anyway would produce a service\n * that fails from birth, which is the failure this whole capability was designed against. Not a\n * manifest field, because whether *this machine* supervises the agent is a fact about the machine\n * and would make the manifest non-portable.\n *\n * What it changes is the last screen: the command appears in the next steps, at the moment it\n * becomes runnable. A capability reachable only by someone who already knows the field names is a\n * capability the generated file is hiding — the standing rule that put `system`, `web` and Composio\n * in here too.\n */\nexport const DAEMON_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n // `service` first and the question's fallback, since 0.1.3. Enter-through and `--yes` used to\n // mean *no service*, so the always-on shape the product is built around was the one answer a\n // person had to choose deliberately — and a paired channel on an agent nothing was serving was\n // the first thing every new user hit. `--daemon none` is still one flag away.\n { value: \"service\", label: \"Yes — in the background: starts at login, restarts on crash\" },\n { value: \"none\", label: \"No — it runs while you have `serve` open in a terminal\" },\n]\n\nexport function daemonChoice(value: string): (typeof DAEMON_CHOICES)[number] | undefined {\n return DAEMON_CHOICES.find((choice) => choice.value === value)\n}\n\n/**\n * Whether to scaffold a skills directory, and what to put in it.\n *\n * A question rather than a field to discover, per the standing rule: every capability the runtime has is\n * asked about here. `starter` writes one worked skill because an empty directory teaches nothing about the\n * format, and the format has parts — the `metadata` key for negative guidance, the fact that the body is\n * injected verbatim — that a person will not guess.\n */\nexport const SKILLS_CHOICES: readonly {\n readonly value: string\n readonly label: string\n}[] = [\n {\n // First, because it is the only answer that produces a working procedure — and the label says\n // what it costs, since the catalogues are ~40 MB fetched once per machine and shared by every\n // agent on it, not per agent.\n value: \"find\",\n label: \"Yes — pick from the catalogue: real skills, tick as many as you want\",\n },\n { value: \"starter\", label: \"Yes — with one worked example to copy\" },\n { value: \"none\", label: \"An empty directory — the concept is there, the procedures are not\" },\n]\n\nexport function skillsChoice(value: string): (typeof SKILLS_CHOICES)[number] | undefined {\n return SKILLS_CHOICES.find((choice) => choice.value === value)\n}\n\nexport const SYSTEM_CHOICES: readonly {\n readonly value: string\n readonly label: string\n readonly pinned: readonly string[]\n /** Mutating slugs that need an allow rule, or the first untrusted read gates them. */\n readonly allow: readonly string[]\n}[] = [\n {\n value: \"none\",\n label: \"No — it can talk and remember, and change its own settings when you ask\",\n /**\n * Not empty, and the emptiness was the bug.\n *\n * With nothing pinned there is no provider, so `available()` is never called and the agent is\n * never told the file tools exist — asked to create a file it said \"I don't have a tool that\n * touches your file system\", which is true and useless. Asked to enable one it said the tools\n * are fixed at startup, which was also true and is the thing that was supposed to be fixed.\n *\n * So every level, including this one, can read its own configuration and change it when asked.\n * That is the whole of \"it should always be able to update its own configuration\" — and this is\n * the level where it matters most, because it is the only route out of it.\n */\n pinned: [\"config_read\", \"config_set\"],\n allow: [\"memory_write\", \"config_set\"],\n },\n {\n value: \"read\",\n label: \"Read only — it can read and search files, but change nothing\",\n // `config_read` on every level above `none`: without it the agent cannot tell you which\n // setting to change when a request needs a tool it does not have, which is the whole point of\n // telling it that the tool exists.\n pinned: [\"file_read\", \"glob\", \"grep\", \"config_read\", \"config_set\"],\n // `memory_write` is mutating and a file read taints the turn, so without this the agent\n // could read one file and then never save a note again for the rest of that turn.\n allow: [\"memory_write\", \"config_set\"],\n },\n {\n // The level that makes confinement *real*. `full` pins `exec`, and a shell carries its target\n // inside a string no path check can look inside — so the write root binds the file tools and\n // not the shell. Verified live: a full agent refused a `file_write` outside the root and then\n // did the same thing with `echo … >`. Anyone who wants \"only inside workspace/, never\n // anywhere\" and means it wants this level, and there was no way to ask for it.\n value: \"write\",\n label: \"Read and write files — confined to its own workspace, no shell\",\n pinned: [\n \"file_read\",\n \"file_write\",\n \"file_edit\",\n \"glob\",\n \"grep\",\n \"config_read\",\n \"config_set\",\n ],\n allow: [\"memory_write\", \"file_write\", \"file_edit\", \"config_set\"],\n },\n {\n value: \"full\",\n label: \"Yes — read and write files, run commands, and change its own configuration\",\n pinned: [\n \"file_read\",\n \"file_write\",\n \"file_edit\",\n \"glob\",\n \"grep\",\n \"exec\",\n \"config_read\",\n \"config_set\",\n ],\n allow: [\"memory_write\", \"file_write\", \"file_edit\", \"exec\", \"config_set\"],\n },\n]\n\nexport function systemChoice(value: string) {\n return SYSTEM_CHOICES.find((choice) => choice.value === value)\n}\n\nexport type InitStep = keyof InitAnswers\n\n/**\n * Answers as they accumulate: every step is a string until `complete` narrows them, because they\n * arrive from readline and flags as text and are validated per step, not per type.\n */\nexport type PartialAnswers = Partial<Record<InitStep, string>>\n\n/**\n * The asking order. `apiKeyEnv` is skipped when the chosen preset is keyless.\n *\n * Exported so `provisionSteps` can put the served question list back into asking order after\n * exploring the branches out of order. Reading the authority is not the same as copying it — a\n * second array here would be the drift `NO_MANIFEST` and `THRESHOLD_ORDER` already cost.\n */\nexport const STEP_ORDER: readonly InitStep[] = [\n \"user\",\n \"name\",\n \"purpose\",\n \"preset\",\n \"model\",\n \"baseUrl\",\n \"apiKey\",\n \"system\",\n \"web\",\n \"webBackend\",\n \"webKey\",\n \"composio\",\n \"composioKey\",\n \"telegram\",\n \"telegramAllow\",\n \"telegramToken\",\n \"whatsapp\",\n \"whatsappNumber\",\n \"skills\",\n \"daemon\",\n \"dirChoice\",\n \"dir\",\n]\n\n/**\n * Steps whose answer must never be echoed, logged, or shown in a summary.\n *\n * The renderer reads this rather than special-casing a slug, so a second secret question later\n * cannot be added without the masking coming with it.\n */\nexport const SECRET_STEPS: ReadonlySet<InitStep> = new Set<InitStep>([\n \"apiKey\",\n \"webKey\",\n \"composioKey\",\n \"telegramToken\",\n])\n\nexport interface Question {\n readonly step: InitStep\n /** One line, printed before the input prompt. */\n readonly prompt: string\n /** Offered default; empty string means the answer is required — unless `optional`. */\n readonly fallback: string\n /**\n * An empty answer is a real answer here, not a missing one.\n *\n * Stated rather than inferred from an empty fallback: those two things look identical and mean\n * opposite things to the non-interactive path, which must refuse for one and proceed for the\n * other.\n */\n readonly optional?: boolean\n /**\n * Present when the answer is one of a fixed set, which the renderer draws as a list rather than\n * a text field.\n *\n * On the question rather than hardcoded in the wizard: the preset menu was the only select for\n * three phases, and \"is this the preset step\" was written into the reducer, the renderer and the\n * cursor-prefill in three separate places. A second select had to either repeat all three or\n * generalise them, and generalising is what stops a third one repeating them again.\n */\n readonly options?: readonly {\n readonly value: string\n readonly label: string\n /**\n * The dim half of the row — a reason, not a second label.\n *\n * `SelectList.hint` has existed since the component did and no question ever supplied one, so\n * every option had to fold its rationale into the label. That produced a 79-column row for the\n * location question, which **wrapped at 80** onto a continuation line with no pointer and no\n * number — a broken list, and invisible at the 100 columns it was first checked at.\n */\n readonly hint?: string\n }[]\n}\n\n/**\n * The manifest `id` and default directory name, from the agent's name.\n *\n * Kebab-case because the id is a slug (session keys, API paths) and the directory is typed into\n * shells. A name that reduces to nothing (\"!!!\") falls back to \"agent\" rather than producing an\n * invalid id.\n */\nexport function slugify(name: string): string {\n const slug = name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n return slug === \"\" ? \"agent\" : slug\n}\n\n/**\n * The next unanswered question, or undefined when the flow is complete.\n *\n * Model and base URL default from the chosen preset, so at a TTY the happy path is naming two\n * people and pressing return a few times. `custom` offers no defaults — an unlisted endpoint has\n * nothing honest to prefill.\n */\nexport interface QuestionDefaults {\n /**\n * Where agents live when nobody says otherwise — the command layer passes the sandbox's\n * agents directory. Passed in rather than computed because this module is PURE: it may not\n * touch the filesystem, the home directory, or the environment.\n *\n * **Required, and that is the whole point.** It was optional, and absence fell back to a\n * cwd-relative `./<slug>` — a live second default that put agents in whatever checkout you\n * happened to be standing in, guarded by nothing but every caller remembering to pass this.\n * The repo has paid for that shape six times (`apiKeyEnv`, `ChatMessage.toolCalls`,\n * `TurnInput.skills`, `ToolContext.readArtifact`, `ToolContext.memoryDir`,\n * `init --schedules`); an optional field whose absence is legal *and* silent is the trap, so\n * there is now one default and no branch that can reach the other one.\n */\n readonly agentDirBase: string\n}\n\nexport function nextQuestion(\n partial: PartialAnswers,\n defaults: QuestionDefaults,\n): Question | undefined {\n const preset = partial.preset === undefined ? undefined : presetById(partial.preset)\n\n for (const step of STEP_ORDER) {\n if (partial[step] !== undefined) continue\n // A keyless preset asks no key question. An explicit --api-key-env still lands in\n // `partial` before this runs, so the deliberate keyed-proxy override survives the skip.\n if (step === \"apiKey\" && preset !== undefined && preset.apiKeyEnv === undefined) {\n continue\n }\n // The backend and its key are only questions for someone who asked for search. Skipped\n // rather than asked-and-ignored: an answer the flow discards is a question that lies.\n if ((step === \"webBackend\" || step === \"webKey\") && partial.web !== \"search\") continue\n // Same rule: only \"somewhere else\" has a path to type. The other two answers derive their\n // directory at the `complete()` funnel, which is where a no-longer-asked step's default has\n // to live — the alternative is the manifest arriving with the field simply absent.\n if (step === \"dir\" && partial.dirChoice !== \"custom\") continue\n // ...and the question is not worth asking at all when `--dir` already answered it. Structural\n // rather than a courtesy from `fromFlags`: a caller that assembles `given` by hand — the\n // wizard's own tests do — would otherwise ask where to put an agent whose path is decided.\n if (step === \"dirChoice\" && partial.dir !== undefined) continue\n // Same rule: nobody who said no to Composio is asked for a Composio key.\n if (step === \"composioKey\" && partial.composio !== \"connected\") continue\n // And nobody who said no to Telegram is asked for a bot token or an allowlist.\n if (\n (step === \"telegramToken\" || step === \"telegramAllow\") &&\n partial.telegram !== \"connected\"\n ) {\n continue\n }\n // And nobody who said no to WhatsApp is asked whose number may message it. There is no\n // token step to skip: WhatsApp is paired by scanning a QR, not by pasting a credential.\n if (step === \"whatsappNumber\" && partial.whatsapp !== \"connected\") continue\n // `daemon` is asked of everyone, and used to be gated on\n // `telegram === \"connected\" || server === \"local\"`. `server` stopped being a question in\n // 0.1.2 and defaults to `local` at the funnel, so that half was true for every agent — and a\n // gate whose remaining half is \"did you connect Telegram\" would refuse the question to\n // exactly the agent that has an always-on server and nothing else, which is the common shape.\n\n switch (step) {\n case \"user\":\n return { step, prompt: \"Your name\", fallback: \"\" }\n case \"name\":\n return { step, prompt: \"The agent's name\", fallback: \"\" }\n case \"purpose\":\n return {\n step,\n prompt: \"What is it for, in one line\",\n fallback: \"helping with whatever comes up\",\n }\n case \"preset\":\n return {\n step,\n // Short title plus `options`, rather than a prompt with the menu baked into it.\n // The menu text was written for a renderer that never used it — the wizard drew\n // its own list from PRESETS — so the choices lived in two places and only one of\n // them was ever read. One source now, and `system` gets the same treatment for\n // free rather than adding a second special case.\n prompt: \"Model endpoint\",\n fallback: \"1\",\n options: PRESETS.map((preset) => ({ value: preset.id, label: preset.label })),\n }\n case \"model\":\n return { step, prompt: \"Model id\", fallback: preset?.modelId ?? \"\" }\n case \"baseUrl\":\n return { step, prompt: \"Base URL\", fallback: preset?.baseUrl ?? \"\" }\n case \"apiKey\":\n return {\n step,\n prompt: `Model API key`,\n // Empty is allowed and means \"I supply it another way\" — the next steps then\n // say where to put it. There is deliberately no flag for this: a key passed on\n // the command line lands in shell history, which is why `--yes` takes the empty\n // answer rather than refusing for want of one.\n fallback: \"\",\n optional: true,\n }\n case \"system\":\n return {\n step,\n prompt: \"Can it act on this computer?\",\n fallback: \"1\",\n options: SYSTEM_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"web\":\n return {\n step,\n prompt: \"Can it reach the internet?\",\n fallback: \"1\",\n options: WEB_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"webBackend\":\n return {\n step,\n prompt: \"Search backend\",\n fallback: \"1\",\n options: WEB_BACKENDS.map((backend) => ({\n value: backend.value,\n label: backend.label,\n })),\n }\n case \"webKey\":\n return {\n step,\n prompt: `${webBackendByValue(partial.webBackend ?? \"tavily\")?.label.split(\" —\")[0] ?? \"Search\"} API key`,\n // Empty is a real answer, exactly as it is for the model key: the variable can be\n // exported another way, and the next steps say where it goes. No flag, for the\n // same reason — a key on the command line lands in shell history.\n fallback: \"\",\n optional: true,\n }\n case \"composio\":\n return {\n step,\n prompt: \"Can it use your other apps?\",\n fallback: \"1\",\n options: COMPOSIO_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"composioKey\":\n return {\n step,\n prompt: \"Composio API key\",\n // Empty is a real answer, as everywhere else a secret is asked for. There is no\n // flag for the value — a key on a command line lands in shell history.\n fallback: \"\",\n optional: true,\n }\n case \"telegram\":\n return {\n step,\n prompt: \"Can people message it on Telegram?\",\n fallback: \"1\",\n options: TELEGRAM_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"telegramAllow\":\n return {\n step,\n prompt: \"Your Telegram handle — who may message it\",\n // Empty permits nobody, which is the safe default and a workable first run:\n // the first message from anyone is refused with the exact line to add.\n fallback: \"\",\n optional: true,\n }\n case \"telegramToken\":\n return {\n step,\n prompt: \"Telegram bot token (from @BotFather)\",\n // Empty is a real answer, as everywhere else a secret is asked for, and there\n // is no flag — a token on a command line lands in shell history.\n fallback: \"\",\n optional: true,\n }\n case \"whatsapp\":\n return {\n step,\n prompt: \"Can people message it on WhatsApp?\",\n fallback: \"1\",\n options: WHATSAPP_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"whatsappNumber\":\n return {\n step,\n /**\n * **The account the agent is linked to, which is not the same as who may\n * message it.** The old prompt asked for both at once — \"Your WhatsApp number\n * … who may message it\" — and wrote the answer to `allowFrom`, which is the\n * inbound gate. Two different facts behind one question, and the number a\n * person types is nearly always the first one.\n *\n * Given it, pairing is an **eight-character code typed into the phone** rather\n * than a QR to scan, which is the only route that works on a surface that\n * cannot draw a barcode. Left empty, pairing falls back to the QR.\n *\n * `allowFrom` stays empty and is filled in later from the log, which already\n * names a refused sender and prints the exact line to paste — the affordance\n * that makes a second question here unnecessary.\n */\n prompt: \"Your WhatsApp number in digits, no + — the account it links to\",\n fallback: \"\",\n optional: true,\n }\n case \"skills\":\n return {\n step,\n prompt: \"Give it a skills directory? A skill is a procedure it follows when the turn calls for one.\",\n // A name rather than `\"1\"`, which decouples the default from the order on screen —\n // and that separation is the point. `find` is listed first because it is the answer\n // that produces a working agent, and pressing enter on a labelled option that says\n // \"downloads\" is consent. The *fallback* stays `starter`, so `--yes` and every\n // non-interactive run reach no network: a scripted init that silently clones two\n // repositories is a surprise nobody asked for.\n fallback: \"starter\",\n options: SKILLS_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"daemon\":\n return {\n step,\n prompt: \"Keep it running in the background?\",\n // By name, never `\"1\"`: the order of `DAEMON_CHOICES` and the default are two\n // decisions, and an index makes them one forever.\n fallback: \"service\",\n options: DAEMON_CHOICES.map((choice) => ({\n value: choice.value,\n label: choice.label,\n })),\n }\n case \"dirChoice\":\n return {\n step,\n prompt: \"Where should it live?\",\n fallback: \"1\",\n options: DIR_CHOICES.map((choice) => ({\n value: choice.value,\n // The resolved path *is* the label where there is one: \"the sandbox\" is a word,\n // and what a person needs to recognise is the directory. The path goes first so\n // that when the row is too narrow it is the reason that clips, not the path.\n label: dirFor(choice.value, partial.name, defaults) ?? choice.label,\n hint: choice.hint,\n })),\n }\n case \"dir\":\n return {\n step,\n // Reached only after \"somewhere else\", so there is nothing honest to prefill —\n // and a fallback here would be a third directory default arriving by the back\n // door, which is the whole class 11.141 exists to close. Empty is refused by\n // `validateAnswer`, so enter alone cannot pick a path nobody typed.\n prompt: \"Path to create it at\",\n fallback: \"\",\n }\n }\n }\n\n return undefined\n}\n\n/**\n * Is this a handle Telegram could actually issue, normalised to a leading `@`?\n *\n * Exported and shared because two surfaces ask it — `init` when the handle is typed, and `config\n * allow` when one is added later — and *a check only one of them performs is a check they disagree\n * with*. That is the `ruleBudgetFailure` lesson: the rule guard first lived in `Agent.create` alone,\n * and `validate` happily reported ok on a manifest `run` refused.\n *\n * Checked against Telegram's real username rule: letters, digits and underscores, five to thirty-two\n * of them. Not pedantry — a hyphen cannot occur in a real handle, so `@ada-lovelace` matches nobody,\n * and the only symptom is the bot silently refusing every message from the one person it was set up\n * for. That refusal names the problem perfectly and writes it to a log file, which under a background\n * service nobody opens. The moment it is typed is the only cheap place to catch it.\n */\nexport function telegramHandle(raw: string): Answered {\n const handle = raw.trim()\n if (/\\s/.test(handle)) {\n return { ok: false, reason: \"is one handle, with no spaces — for example @moeen.\" }\n }\n const bare = handle.startsWith(\"@\") ? handle.slice(1) : handle\n if (!/^[A-Za-z0-9_]{5,32}$/.test(bare)) {\n return {\n ok: false,\n reason: /-/.test(bare)\n ? \"contains a hyphen, and a Telegram handle cannot — they are letters, digits and underscores only. Did you mean an underscore?\"\n : \"is not a Telegram handle: 5-32 characters, letters, digits and underscores only. Leave it empty to allow nobody for now.\",\n }\n }\n return { ok: true, value: `@${bare}` }\n}\n\nexport type Answered =\n | { readonly ok: true; readonly value: string }\n | { readonly ok: false; readonly reason: string }\n\nconst ENV_NAME = /^[A-Z_][A-Z0-9_]*$/\n\n/**\n * Per-step validation, with the loader's own rules applied early.\n *\n * The base-URL checks are the same two `manifest/validate.ts` enforces at load — failing here,\n * at the question, beats generating a directory whose first validate names the mistake back.\n */\nexport function validateAnswer(step: InitStep, raw: string): Answered {\n const value = raw.trim()\n\n switch (step) {\n case \"user\":\n case \"name\":\n case \"model\":\n case \"purpose\":\n return value === \"\" ? { ok: false, reason: \"cannot be empty.\" } : { ok: true, value }\n\n case \"preset\": {\n const byNumber = PRESETS[Number(value) - 1]\n const chosen = byNumber ?? presetById(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${PRESETS.length}, or a name: ${PRESETS.map((p) => p.id).join(\", \")}.`,\n }\n : { ok: true, value: chosen.id }\n }\n\n case \"web\": {\n const byNumber = WEB_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? webChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${WEB_CHOICES.length}, or a name: ${WEB_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"webBackend\": {\n const byNumber = WEB_BACKENDS[Number(value) - 1]\n const chosen = byNumber ?? webBackendByValue(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${WEB_BACKENDS.length}, or a name: ${WEB_BACKENDS.map((b) => b.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"webKey\":\n case \"composioKey\":\n case \"telegramToken\":\n return { ok: true, value }\n\n case \"telegramAllow\": {\n // Empty permits nobody, which is a real and safe answer. A handle is normalised to a\n // leading `@` so the file reads the way a person writes it — matching folds case and\n // treats the prefix as optional either way, so this is cosmetic rather than load-bearing.\n const handle = value.trim()\n if (handle === \"\") return { ok: true, value: \"\" }\n return telegramHandle(handle)\n }\n\n case \"telegram\": {\n const byNumber = TELEGRAM_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? telegramChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${TELEGRAM_CHOICES.length}, or a name: ${TELEGRAM_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"whatsapp\": {\n const byNumber = WHATSAPP_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? whatsappChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${WHATSAPP_CHOICES.length}, or a name: ${WHATSAPP_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"whatsappNumber\": {\n // Empty is a real answer: no number means pairing by QR instead of by code. Anything\n // else has to be the digits WhatsApp reports, because `requestPairingCode` fails\n // opaquely on a malformed one. Refused *here*, where the value is typed, because that\n // is the only moment somebody can still fix it cheaply.\n const raw = value.trim()\n if (raw === \"\") return { ok: true, value: \"\" }\n const digits = raw.replace(/[^0-9]/g, \"\")\n if (!/^[0-9]{6,20}$/.test(digits)) {\n return {\n ok: false,\n reason: \"that is not a WhatsApp number — use the digits including the country code, with no + and no spaces.\",\n }\n }\n // Normalised rather than refused when only the punctuation is wrong: somebody who\n // pasted `+880 171 122 3344` meant the right person, and telling them to retype it\n // would be a rule for its own sake.\n return { ok: true, value: digits }\n }\n\n case \"server\": {\n const byNumber = SERVER_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? serverChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${SERVER_CHOICES.length}, or a name: ${SERVER_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"schedules\": {\n const byNumber = SCHEDULE_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? scheduleChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${SCHEDULE_CHOICES.length}, or a name: ${SCHEDULE_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"skillsPick\":\n // Refs the wizard collected from its own checklist. Nothing to validate: they came from the\n // catalogue this process just read, not from a person typing.\n return { ok: true, value: value.trim() }\n case \"skillsSearch\":\n // Flag-only, and never refused. `--skills \"pdf tables\"` is the scripted path where a picker\n // cannot run; at a terminal this step is not asked at all, because `find` shows the catalogue.\n return { ok: true, value: value.trim() }\n case \"skills\": {\n const byNumber = SKILLS_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? skillsChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${SKILLS_CHOICES.length}, or a name: ${SKILLS_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"daemon\": {\n const byNumber = DAEMON_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? daemonChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${DAEMON_CHOICES.length}, or a name: ${DAEMON_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"composio\": {\n const byNumber = COMPOSIO_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? composioChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${COMPOSIO_CHOICES.length}, or a name: ${COMPOSIO_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"baseUrl\": {\n let url: URL\n try {\n url = new URL(value)\n } catch {\n return {\n ok: false,\n reason: \"must be an absolute URL, e.g. https://api.example.com/v1.\",\n }\n }\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return { ok: false, reason: \"only http and https are supported.\" }\n }\n if (url.pathname.endsWith(\"/chat/completions\")) {\n return {\n ok: false,\n reason: \"must end at the version segment — the runtime appends /chat/completions itself.\",\n }\n }\n return { ok: true, value }\n }\n\n case \"apiKeyEnv\":\n return ENV_NAME.test(value)\n ? { ok: true, value }\n : { ok: false, reason: \"must be an env var name, like MODEL_API_KEY.\" }\n\n case \"apiKey\":\n // Never rejected. Key formats differ per vendor and change without notice, so a shape\n // check here would refuse a valid key on the vendor's say-so — and the endpoint gives\n // an honest 401 on the first turn anyway. Empty means \"not now\".\n return { ok: true, value }\n\n case \"serverToken\":\n // Never asked — generated by the command, so there is nothing here to reject. Present\n // so the switch stays exhaustive over InitStep, which is what makes adding a step\n // without validating it a compile error rather than a silent pass-through.\n return { ok: true, value }\n\n case \"system\": {\n const byNumber = SYSTEM_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? systemChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${SYSTEM_CHOICES.length}, or a name: ${SYSTEM_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"dirChoice\": {\n const byNumber = DIR_CHOICES[Number(value) - 1]\n const chosen = byNumber ?? dirChoice(value.toLowerCase())\n return chosen === undefined\n ? {\n ok: false,\n reason: `pick 1-${DIR_CHOICES.length}, or a name: ${DIR_CHOICES.map((c) => c.value).join(\", \")}.`,\n }\n : { ok: true, value: chosen.value }\n }\n\n case \"dir\":\n return value === \"\" ? { ok: false, reason: \"cannot be empty.\" } : { ok: true, value }\n }\n}\n\n/**\n * The whole `providers` map and the `pinned` list under it.\n *\n * One block rather than three, because there is one `providers:` key: system is the one the wizard\n * asks about, and web and Composio sit beside it commented, at the indentation that makes them work.\n * A generated file whose other options live somewhere the reader has to assemble is the failure this\n * exists to prevent — the previous template mentioned neither the provider nor a single tool slug, so\n * the only way to reach shell access was to already know the field names.\n *\n * `none` still writes the map, commented, with the exact lines to uncomment.\n */\nfunction systemBlock(answers: InitAnswers): readonly string[] {\n const system = answers.system\n const choice = systemChoice(system) ?? SYSTEM_CHOICES[0]\n const shell = choice?.pinned.includes(\"exec\") === true\n const files = choice?.pinned.includes(\"file_read\") === true\n const writes = choice?.pinned.includes(\"file_write\") === true\n\n const intro: readonly string[] =\n choice === undefined || choice.pinned.length === 0\n ? [` # Nothing is enabled. Add tools here and permit them in the policy block below.`]\n : !files\n ? [\n // The configuration-only level. Everything the agent lacks is still named to it, so\n // \"I can't do that\" becomes \"I can't do that yet, and here is the line that would\n // let me\" — and `config_set` is what writes that line when you say go ahead.\n ` # This agent cannot read, write or run anything. It CAN read this file and change it when`,\n ` # you ask — which is how you turn the rest on without editing YAML yourself.`,\n ` #`,\n ` # It is told which tools exist and are not enabled, so ask it for something it cannot do`,\n ` # and it will name the tool and offer to add it. A change takes effect on the next start.`,\n ` #`,\n ` # To enable them by hand instead, add to pinned:`,\n ` # file_read, glob, grep read and search files`,\n ` # file_write, file_edit change files, confined to workspace/`,\n ` # exec run shell commands — the confinement does not bind it`,\n ]\n : shell\n ? [\n ` # This agent can read and change files and run shell commands. What it may run is decided`,\n ` # by the policy block below — narrow it, and prefer the file tools over the shell, whose`,\n ` # target a rule cannot see inside a command string.`,\n ` #`,\n ` # Writes are confined to workspace/. To open another directory, give the system`,\n ` # provider a writeRoots list — the agent cannot add one to itself, by design.`,\n ` # That confinement binds the file tools and NOT exec, whose target lives inside a`,\n ` # shell string no path check can see.`,\n ]\n : writes\n ? [\n // The level where \"only inside workspace/\" is a true sentence, and the only\n // one — which is the whole reason it exists. Saying so here is the point:\n // this text used to be the read-only paragraph, so a `--system write` agent\n // was generated with a comment claiming it could change nothing.\n ` # This agent can read files and change them, and cannot run commands. That combination`,\n ` # is the only one in which \"confined to workspace/\" is a true statement — a shell`,\n ` # carries its target inside a string no path check can look inside.`,\n ` #`,\n ` # To open another directory, give the system provider a writeRoots list. The agent`,\n ` # cannot add one to itself, by design.`,\n ]\n : [\n ` # This agent can read and search files and change nothing. Reading is still not nothing:`,\n ` # anything it reads can carry text a stranger wrote, which is why the write gate exists.`,\n ` #`,\n ` # Reading is not confined; changing things would be, but nothing here changes things.`,\n ]\n\n // Every level pins something — `none` still gets `config_read`/`config_set`, which is the only\n // route out of `none` — so the provider and the list are always written, never commented.\n const pinned = choice?.pinned ?? []\n const webPinned = webChoice(answers.web)?.pinned ?? []\n const backend = searchBackend(answers)\n\n return [\n ` # ── providers: where tools come from ──`,\n ...intro,\n ` #`,\n ` # Several may be configured at once — this is a map, not a choice. Each block is that`,\n ` # provider's own configuration and it refuses a key it does not read.`,\n ` providers:`,\n ` system: {}`,\n ...(shell\n ? [\n ` # system: { writeRoots: [~/code/my-project] } # absolute, or relative to this file`,\n ]\n : []),\n ``,\n // Always named, whatever the answer — naming a provider is what lets the agent be TOLD its\n // tools exist. Left commented out, asked whether it could search the web an agent answered\n // that the only route was shell access and curl: true of its catalogue, false of this\n // runtime, and the worse of the two answers.\n ...(webPinned.length === 0\n ? [\n ` # Named with nothing pinned. It cannot reach the internet, and it knows the two`,\n ` # tools exist and will tell you which one to enable rather than saying it can't.`,\n ` # web_fetch needs no key; web_search needs one, named here:`,\n ` # web: { backend: tavily, apiKeyEnv: TAVILY_API_KEY } # tavily | brave | exa`,\n ` web: {}`,\n ]\n : backend === undefined\n ? [\n ` # Reading pages only. No key and no account: web_fetch takes a URL you or the`,\n ` # person gave it. To add search, pick a backend and name its variable:`,\n ` # web: { backend: tavily, apiKeyEnv: TAVILY_API_KEY } # tavily | brave | exa`,\n ` web: {}`,\n ]\n : [\n ` # Search and page reading. The key lives in the .env beside this file; this names`,\n ` # only the variable, and a literal key here fails validation.`,\n ` web:`,\n ` backend: ${backend.value}`,\n ` apiKeyEnv: ${backend.apiKeyEnv}`,\n ]),\n ` # Addresses on this machine or this network are refused and no setting permits them.`,\n ` # Neither tool can change anything, but what they return is text a stranger wrote — so it`,\n ` # is fenced as data, and a tool that CHANGES something needs an allow rule after one runs.`,\n ``,\n ...composioBlock(answers),\n ``,\n ` # What the model is actually given, from any provider above. A slug no configured provider`,\n ` # has fails the load naming it — nothing is ever dropped quietly.`,\n ` pinned:`,\n ...pinned.map((slug) => ` - ${slug}`),\n ...webPinned.map((slug) => ` - ${slug}`),\n ...(webPinned.includes(\"web_search\") ? [] : [` # - web_search`]),\n ...(webPinned.includes(\"web_fetch\") ? [] : [` # - web_fetch`]),\n ...composioPinned(answers).map((slug) => ` - ${slug}`),\n ...(composioEnabled(answers)\n ? [\n ` # App tools land here once composio_search has found them — ask the agent for what`,\n ` # you want and it writes the slug itself. A slug typed in by hand needs`,\n ` # \\`${BRAND.slug} tools . --warm\\` first: boot resolves from a cache and makes no`,\n ` # request, so an unwarmed slug fails the load rather than fetching.`,\n ` # - GMAIL_FETCH_EMAILS`,\n ` # - composio_workbench # runs Python in Composio's sandbox, under no rule here`,\n ]\n : [` # - GMAIL_FETCH_EMAILS`]),\n ]\n}\n\n/** Whether this agent was wired to Composio. One reading, so no caller re-derives it. */\nexport function composioEnabled(answers: InitAnswers): boolean {\n return answers.composio === \"connected\"\n}\n\n/** The Composio meta tools this answer pins. Empty for `none`. */\nexport function composioPinned(answers: InitAnswers): readonly string[] {\n return composioChoice(answers.composio)?.pinned ?? []\n}\n\n/**\n * Which pinned meta tools need an allow rule.\n *\n * A list rather than a `!== \"composio_search\"` test, so adding a third meta tool is a decision\n * someone makes here rather than a default they inherit by omission. Pinned by a test against the\n * provider's own specs, because a tool that becomes mutating later and is not listed here goes back\n * to stopping mid-turn with nothing explaining why.\n */\nconst MUTATING_META: readonly string[] = [\"composio_connect\", \"composio_workbench\"]\n\nfunction isMutatingMeta(slug: string): boolean {\n return MUTATING_META.includes(slug)\n}\n\n/**\n * The Composio entry in the `providers` map — named either way, configured when asked for.\n *\n * `none` used to leave it commented, because a provider holding 25,000 tools had no `available()`\n * worth calling and naming it told the model nothing. The meta tools changed that premise: the agent\n * can now say \"I could search your apps if you switch this on\", which is the entire reason decision\n * 4.53 names a provider that is switched off.\n */\nfunction composioBlock(answers: InitAnswers): readonly string[] {\n const shared = [\n ` # Your other apps — Gmail, Slack, Notion, ~1,000 more — through a Composio account.`,\n ` # Two tools do the setup: composio_search finds what a task needs and saves the`,\n ` # definitions, composio_connect returns the sign-in link. Ask the agent for an app and it`,\n ` # pins the slug itself with config_set; the new tool is live after a restart.`,\n ]\n\n if (!composioEnabled(answers)) {\n return [\n ...shared,\n ` # Named with nothing pinned, so it knows the route exists and can tell you the line`,\n ` # to add. To switch it on: pin the two tools below, put a key in .env, and give this`,\n ` # block the two settings shown here.`,\n ` # composio: { apiKeyEnv: ${COMPOSIO_KEY_ENV}, userId: default }`,\n ` composio: {}`,\n ]\n }\n\n return [\n ...shared,\n ` composio:`,\n ` apiKeyEnv: ${COMPOSIO_KEY_ENV}`,\n ` # Whose accounts these are, in Composio's terms — not a name of yours. One person on`,\n ` # one machine wants \"default\", and a connection made under it is reused by every later`,\n ` # session. Change it only to keep two people's accounts apart on one agent.`,\n ` userId: default`,\n ]\n}\n\n/**\n * The permission rules, and the `allow` entries without which the agent stops working mid-turn.\n *\n * Those entries look like they weaken the gate and are what makes it usable: a mutating call in a\n * turn that has already read a file needs a rule naming the tool, and a blanket `mode` is the\n * absence of one. Generated with the comment explaining what removing them costs, because the\n * alternative — a fresh agent that reads one file and then refuses to save a note — reads as a\n * broken runtime rather than as a security setting.\n */\nfunction policyBlock(answers: InitAnswers): readonly string[] {\n const choice = systemChoice(answers.system) ?? SYSTEM_CHOICES[0]\n const shell = choice?.pinned.includes(\"exec\") === true\n // `composio_connect` is mutating and `composio_search` is untrusted, so the first search taints\n // the turn and the connect that has to follow it has nothing to point at. That is the gate\n // working exactly as designed and indistinguishable from a broken runtime while the one useful\n // sequence — find the app, hand over the sign-in link — stops halfway through.\n const allow = [...(choice?.allow ?? []), ...composioPinned(answers).filter(isMutatingMeta)]\n\n const lines = [\n ` # ── which calls run, which ask, and which are refused ──`,\n ` # deny wins over allow, first match, and being more specific never reorders that. A rule`,\n ` # naming a primary content field — exec(command:rm *) — is refused at load, because a`,\n ` # compound command defeats it and a rule that can be defeated reads as protection.`,\n ` #`,\n ` # Below every setting here is a floor that cannot be lowered: rm -rf / and rm -rf ~,`,\n ` # --no-preserve-root, fork bombs, mkfs, and dd to a block device are never permitted.`,\n ` policy:`,\n ` mode: allow # allow | ask | deny — for calls no rule mentions`,\n ]\n\n if (allow.length === 0) {\n return [...lines, ` allow: []`, ` deny: []`, ` onNoApprover: deny`]\n }\n\n return [\n ...lines,\n ` # Authorises these even once untrusted content has entered the turn. Remove one and that`,\n ` # tool stops working for the rest of any turn that has read a file — which is the gate`,\n ` # doing its job, and worth choosing on purpose rather than discovering.`,\n ` allow:`,\n ...allow.map((slug) => ` - \"${slug}\"`),\n ...(shell\n ? [\n ` deny:`,\n ` # Narrow these to taste. A pattern matches the command, and every part of a`,\n ` # compound must match for an allow — so \"git status && rm -rf x\" is not allowed`,\n ` # by exec(git status:*).`,\n ` - \"exec(rm *)\"`,\n ` - \"exec(sudo *)\"`,\n ]\n : [` deny: []`]),\n ` onNoApprover: deny # what \"ask\" means with nobody to ask — a schedule, a pipe`,\n ]\n}\n\nexport interface GeneratedFile {\n /** Relative to the target directory. */\n readonly relPath: string\n readonly contents: string\n}\n\n/**\n * The full file plan. Pure — the command decides where it lands and whether anything exists.\n *\n * Identity and operations are different files, per the split the wider ecosystem converged\n * on (OpenClaw, soul.md): the soul pair answers *who the agent is*, AGENTS.md answers *what\n * it does and how* — responsibilities, workflow, the memory procedure, and eventually the\n * team routing. They coexist; what must not exist is a second *identity* document.\n */\nexport function planFiles(answers: InitAnswers): readonly GeneratedFile[] {\n const substitutions = substitutionsFor(answers)\n return [\n { relPath: \"agent.yaml\", contents: manifestFor(answers) },\n ...(\n [\n \"SOUL.md\",\n \"SOUL.compact.md\",\n \"AGENTS.md\",\n \"POLICY.md\",\n \"USER.md\",\n \"MEMORY.md\",\n \"REMINDER.md\",\n ] as const\n ).map((name) => ({\n relPath: `workspace/${name}`,\n contents: fillTemplate(WORKSPACE_TEMPLATES[name], substitutions),\n })),\n // `starter` seeds one worked skill; `none` still gets the directory, because `skills.dir`\n // naming a path that does not exist is a load failure and the block is written either way.\n // `.keep` is what makes an empty directory survive a git checkout.\n ...(answers.skills === \"starter\"\n ? [\n {\n relPath: \"skills/starter/SKILL.md\",\n contents: fillTemplate(SKILL_TEMPLATE, substitutions),\n },\n ]\n : [{ relPath: \"skills/.keep\", contents: \"\" }]),\n // `knowledge.dir` naming a path that does not exist is a load failure, exactly as with\n // skills, and the block is written either way. `.keep` rather than a README because every\n // *.md* here is an entry and must declare frontmatter keywords — a README.md explaining\n // how to author one would fail the very load it was written to help with.\n { relPath: \"knowledge/.keep\", contents: \"\" },\n { relPath: \".env.example\", contents: envExampleFor(answers) },\n { relPath: \".env\", contents: envFor(answers) },\n // The generated .env carries real endpoint values and eventually a key; a repo-ready\n // directory that would commit it by default is a trap. Kept even in the sandbox —\n // people run `git init` there too.\n {\n relPath: \".gitignore\",\n // `.whatsapp/` only when there is one. The session directory holds credentials that\n // **are** the linked device — committing it hands somebody the agent's WhatsApp — and\n // the manifest comment beside it says \"gitignored for you\", which has to be true.\n contents: answers.whatsapp === \"connected\" ? \".env\\n.whatsapp/\\n\" : \".env\\n\",\n },\n ]\n}\n\n/**\n * What fills the templates.\n *\n * The wording descends from the filled reference workspace, with pronouns replaced by the\n * user's name — a generated file must not guess anyone's pronouns. The dialogue examples'\n * `INPUT_n`/`REPLY_n` are deliberately absent from this map: they stay placeholders until a\n * person writes real exchanges, and the `workspace` command keeps saying so.\n *\n * Every sentence here is audited against the rule counter (`workspace/rules.ts`): the prose\n * avoids obligation markers and imperative openers, so whichever identity file the soul gate\n * ships, the counted total is 1 (RULE_HONESTY's \"don't\") against the default budget of 2 —\n * a test pins this, because one synonym swap (\"never guess\") would silently bust it. Three\n * rules ship; the counter's keyword heuristic sees one, and that is fine — the budget guards\n * against obligation *density*, and the pin is what notices if a rewrite changes the count.\n */\nfunction substitutionsFor(answers: InitAnswers): Record<string, string> {\n const { user, name, purpose } = answers\n // One line each — the rule counter is line-based, and these three survive distillation\n // verbatim into every model's context. REMINDER reuses the confirm rule byte-for-byte:\n // two phrasings of one rule read as two rules. The memory rule exists because the gap\n // it closes was observed, not imagined: a generated agent told a durable fact answered\n // warmly and saved nothing, and the recall the person then saw came from session\n // history — which evaporates on a fresh session. The tool catalogue's whenToUse alone\n // did not move a frontier model to save; the identity file is what sets behaviour.\n const ruleConfirm = `I confirm before anything that sends, spends, schedules, or deletes, because I'm wired into live systems and mistakes there are expensive.`\n const ruleHonesty = `When I don't know something I say so and offer to go find out, rather than producing something plausible and letting ${user} discover the difference later.`\n const ruleMemory = `When ${user} tells me something worth keeping — a fact about them, a preference, a decision — I save it with memory_write in the same turn, because the conversation is not memory and a new session starts without it.`\n\n return {\n AGENT_NAME: name,\n USER: user,\n // Derived, never written out. The starter skill needs the real metadata key and hard rule 3\n // forbids a source file from spelling the brand — so the template carries a placeholder, quoted\n // because `{{FOO}}: bar` is a YAML flow mapping and fails to parse before substitution.\n WHEN_NOT_TO_USE_KEY: whenNotToUseKey(),\n // `init` scaffolds it as `starter`; `skills new` substitutes the name it was given.\n SKILL_NAME: \"starter\",\n RULE_CONFIRM: ruleConfirm,\n RULE_HONESTY: ruleHonesty,\n RULE_MEMORY: ruleMemory,\n\n SOUL_WHO:\n `I'm ${name}. I work with ${user}, and this is what I'm for: ${purpose}. ` +\n `The relationship is the point — I'm not a search box; I'm closer to a colleague ` +\n `who holds context so ${user} doesn't have to.`,\n SOUL_MEASURE:\n `The measure of whether I'm working is not how impressive my answers are — it's ` +\n `whether ${user}'s day runs smoother because I was in it.`,\n SOUL_ANSWERS:\n `I lead with the answer and put the reasoning after it, when the reasoning is worth ` +\n `having. Disagreement is part of the job: if I think an idea is bad I say so once, ` +\n `plainly, with the reason, and then help with it anyway if ${user} still wants it. ` +\n `When I'm unsure I name the part I'm unsure about instead of hedging the whole ` +\n `answer into mush — an unhelpful answer isn't the safe one, it just moves the cost ` +\n `somewhere ${user} can't see it.`,\n SOUL_VOICE:\n `I write the way people write to each other: plain sentences, no headers, no bullet ` +\n `lists unless there's genuinely a list. Short is a courtesy. I skip performed ` +\n `enthusiasm and padded pleasantries — warmth, where it shows, is in remembering ` +\n `things ${user} didn't ask me to remember.`,\n SOUL_REFUSE:\n `A yes-machine. The moment I optimise for sounding agreeable over being right, I ` +\n `stop being worth talking to.`,\n\n SOUL_COMPACT_WHO:\n `I'm ${name}. I work with ${user} — ${purpose}. The measure of whether I'm working ` +\n `is whether ${user}'s day runs smoother because I was in it.`,\n SOUL_COMPACT_ANSWERS:\n `I lead with the answer and put the reasoning after it. When I'm unsure I name the ` +\n `part I'm unsure about instead of hedging the whole answer into mush.`,\n SOUL_COMPACT_VOICE:\n `I write plain sentences: no headers, no bullet lists unless there's genuinely a ` +\n `list. Short is a courtesy.`,\n\n // AGENTS.md — operations, deliberately personality-free. Declarative first person\n // throughout (\"I check…\", never \"Check…\"): an imperative opener or a modal would\n // count against the same rule budget as the soul's <rules> block.\n RESPONSIBILITIES:\n `My job: ${purpose}. A task ${user} hands me stays mine until it's done, handed ` +\n `back, or blocked — and when it's blocked, ${user} hears what's blocking it ` +\n `rather than silence.`,\n WORKFLOW:\n `I look at what I already know — the files in my context and what ${user} told me ` +\n `earlier — before asking ${user} to repeat themselves. For anything with more than ` +\n `one step I say the plan in a line first, so a wrong direction costs one message ` +\n `instead of the whole job. Work that touches live systems goes through the ` +\n `confirmation rule in my identity file.`,\n MEMORY_PROCEDURE:\n `USER.md is the standing picture of ${user} — name, role, preferences they wrote. ` +\n `MEMORY.md is my working notes: when ${user} tells me something worth keeping I ` +\n `save it with memory_write in the same turn, and those notes come back every turn ` +\n `until older ones overflow into the memory directory, where they return when the ` +\n `question matches. Earlier conversations are searched the same way. When a saved ` +\n `note and what ${user} just said disagree, the person wins and I correct the note.`,\n\n BOUNDARIES:\n `If something involves a person other than ${user}, I ask what they want shared ` +\n `before including it — ${user} knows the relationship and I don't.`,\n UNCERTAINTY_BEHAVIOUR:\n `When I can't reach a tool or a request is ambiguous, I say which part is unclear ` +\n `and ask, because guessing just moves the cost somewhere ${user} can't see it.`,\n USER_FACTS: `${user} is the person I work for.\\nWhat they brought me in for: ${purpose}.`,\n REMINDER_RULE: ruleConfirm,\n }\n}\n\n/**\n * The generated manifest, in the reference style: everything init configured is live, and\n * everything a later phase delivers is present but commented, labelled with its phase — so the\n * file teaches its own surface. A commented section is REFUSED AT LOAD if uncommented before its\n * phase ships; the runtime never silently ignores configuration.\n *\n * Every mention of the binary interpolates `BRAND.slug` (hard rule 3), and the endpoint values\n * live in `.env` so switching providers never edits this file.\n */\n/** One section header, so every generated section is ruled to the same width. */\nconst rule = (title: string): string =>\n `# \\u2500\\u2500 ${title} ${\"\\u2500\".repeat(Math.max(1, 88 - title.length))}`\n\n/**\n * The `channels` and `delivery` sections.\n *\n * Live when the answer was `connected`, commented otherwise — a channel has no `available()`, so\n * naming a switched-off one buys none of what naming a switched-off *provider* buys. The commented\n * heading deliberately does not end in a colon: one that did became a YAML key the moment someone\n * uncommented the block, which is how `Unrecognized key: \"Phase 4 — channels, delivery, and the\n * HTTP server\"` happened to the first person who tried it.\n */\n/**\n * The WhatsApp entry, or nothing.\n *\n * Separate from `channelsBlock` because the two channels are independent answers and either, both\n * or neither can be on — which is the whole reason they are two questions rather than one\n * multi-select.\n */\nfunction whatsappEntry(answers: InitAnswers): readonly string[] {\n if (answers.whatsapp !== \"connected\") return []\n const number = answers.whatsappNumber ?? \"\"\n return [\n ` # Unofficial: this runs Baileys, which reverse-engineers WhatsApp Web. The number can be`,\n ` # banned and there is no appeal — use a spare one.`,\n ` # Pairing does not complete under Bun; every install of \\`${BRAND.slug}\\` runs under Node, so`,\n ` # this only matters when running from a checkout with bun. The channel says so at start.`,\n ` - type: whatsapp`,\n ` id: wa # the channel segment of every session key it produces`,\n ` authDir: ./.whatsapp # the paired session — 0600, and gitignored for you`,\n ` # What the phone lists under Linked devices: \"Google Chrome (<deviceName>)\". The left`,\n ` # half is fixed by the protocol; only the bracket is yours. Some accounts refuse a`,\n ` # non-standard name under pairing-by-code — if pairing is refused, remove this and pair`,\n ` # again. New pairings only; a linked device keeps the name it was paired with.`,\n ` # deviceName: ${slugify(answers.name)}`,\n ...(number === \"\"\n ? [\n ` # No number, so pairing is a QR to scan. Set pairWith to the account's own`,\n ` # number, digits with no +, and it becomes a code you type into the phone.`,\n ` # pairWith: \"8801711223344\"`,\n ]\n : [\n ` # The account this agent becomes a linked device of. Pairing is an`,\n ` # eight-character code typed into the phone, under Linked devices.`,\n ` pairWith: \"${number}\"`,\n ]),\n // **The owner is in the gate from the start.** `pairWith` and `allowFrom` are different\n // questions — the account the agent runs as, and who may talk to it — but the first person\n // who will talk to it is its owner, in the chat with themselves, and an empty gate refused\n // exactly that. A freshly paired agent showed as a linked device and answered nothing.\n // Anyone else is added from the log, which names a refused sender and prints the line.\n ...(number === \"\"\n ? [\n ` # INBOUND ONLY, and an empty list permits nobody — which is the safe default.`,\n ` # Message it and the log prints the exact line to paste here. A + is fine.`,\n ` allowFrom: []`,\n ]\n : [\n ` # INBOUND ONLY. You are in it, so the chat with yourself works. Add others`,\n ` # from the log, which names a refused sender and prints the line. A + is fine.`,\n ` allowFrom: [\"${number}\"]`,\n ]),\n ]\n}\n\nfunction channelsBlock(answers: InitAnswers): readonly string[] {\n if (answers.telegram !== \"connected\" && answers.whatsapp === \"connected\") {\n // WhatsApp alone. The heading and the delivery default are the same shape Telegram's are;\n // what differs is that there is no token to fill in, because pairing is a QR.\n return [\n rule(\"channels\"),\n `# The channel connects AFTER the runtime is ready and never blocks it. Only`,\n `# \\`${BRAND.slug} serve\\` starts it; \\`${BRAND.slug} run\\` builds the same agent with`,\n `# channels switched off. Pairing is a QR: start it and the channel reports needs_input,`,\n `# which the web UI draws and \\`GET /v1/agents/<id>\\` carries.`,\n `channels:`,\n ...whatsappEntry(answers),\n ``,\n `# Where a turn with no origin goes — a scheduled run, or an API call asking for delivery.`,\n `delivery:`,\n ` default: wa`,\n ``,\n ]\n }\n if (answers.telegram !== \"connected\") {\n return [\n rule(\"channels — not configured\"),\n `# Reachable through the CLI and the API only.`,\n `#`,\n `# You do not have to edit this by hand: ask the agent — \"put yourself on Telegram\" —`,\n `# and it writes the block below with config_set, then tells you which variable to fill`,\n `# in. Two things stay yours either way, and it will say so rather than doing them:`,\n `# the token, because .env is protected, and allowFrom, because who may talk to it is`,\n `# not its decision. Get a token from @BotFather with /newbot.`,\n `#`,\n `# allowFrom is INBOUND ONLY, and omitting it permits nobody — which is safe and`,\n `# workable: message the bot and the log prints the exact line to paste here.`,\n `# channels:`,\n `# - type: telegram`,\n `# id: tg`,\n `# tokenEnv: ${TELEGRAM_TOKEN_ENV}`,\n `# mode: longpoll`,\n `# allowFrom: [\"@your-handle\"]`,\n `# delivery:`,\n `# default: tg`,\n ``,\n ]\n }\n\n const handle = answers.telegramAllow ?? \"\"\n return [\n rule(\"channels\"),\n `# Long-poll: no public URL, no inbound firewall rule. Switch to webhook by setting`,\n `# mode: webhook and webhookUrl once this runtime has a public HTTPS address.`,\n `#`,\n `# The bot connects AFTER the runtime is ready and never blocks it — a bad token surfaces`,\n `# as an event and the HTTP surface keeps serving. Only \\`${BRAND.slug} serve\\` starts it;`,\n `# \\`${BRAND.slug} run\\` builds the same agent with channels switched off.`,\n `channels:`,\n ` - type: telegram`,\n ` id: tg # the channel segment of every session key it produces`,\n ` tokenEnv: ${TELEGRAM_TOKEN_ENV}`,\n ` mode: longpoll # or webhook, with webhookUrl below`,\n ` # webhookUrl: https://your-host/v1/channels/tg/webhook/${slugify(answers.name)}`,\n ...(handle === \"\"\n ? [\n ` # INBOUND ONLY, and an empty list permits nobody — which is the safe default.`,\n ` # Message the bot and the log prints the exact line to paste here.`,\n ` allowFrom: []`,\n ]\n : [\n ` # INBOUND ONLY. It grants nothing on delivery, and omitting it permits nobody.`,\n ` allowFrom: [\"${handle}\"]`,\n ]),\n ...whatsappEntry(answers),\n ``,\n `# Where a turn with no origin goes — a scheduled run, or an API call asking for delivery.`,\n `delivery:`,\n ` default: tg`,\n ``,\n ]\n}\n\n/**\n * The `server` section.\n *\n * Written either way, unlike `channels`: `enabled: false` is a complete and readable statement of\n * the choice, and the fields around it are the ones someone changes next. A public bind refuses to\n * start without a token, which is why the generated `.env` carries a real one.\n */\nfunction serverBlock(answers: InitAnswers): readonly string[] {\n const on = answers.server === \"local\"\n return [\n rule(\"http api\"),\n // The `on` branch is the default since 0.1.2 — the question was withdrawn, because an\n // always-on server is the product — so it is the one that has to carry the useful sentence.\n ...(on\n ? [\n `# On, loopback only — the token is in the .env beside this file. Set`,\n `# enabled: false to switch it off.`,\n ]\n : [\n `# Off — ask the agent to \"turn on your HTTP API\" and it flips this, or set`,\n `# enabled: true here. \\`${BRAND.slug} init --server local\\` is the default; this`,\n `# agent was created with --server none.`,\n ]),\n `# A non-loopback host REFUSES to start without a token, and host and tokenEnv are the two`,\n `# fields the agent may not change: an agent that runs shell commands, exposed on 0.0.0.0,`,\n `# looks identical to a safe one until someone finds it.`,\n `server:`,\n ` enabled: ${on}`,\n ` host: 127.0.0.1`,\n ` port: 7420`,\n ` tokenEnv: ${BRAND.envPrefix}API_TOKEN`,\n ``,\n ]\n}\n\n/**\n * The `schedules` section.\n *\n * Written either way, like `server` and unlike `channels` — the commented form carries a worked\n * example so the field names are discoverable without opening the spec, which is the whole reason\n * this became a question instead of a block somebody had to find.\n *\n * Only `serve` fires them, and the comment says so: a schedule that exists and never runs because\n * the process was started with `run` is exactly the \"configured but not working\" gap slot 2 and\n * `status` were both built to close.\n */\nfunction schedulesBlock(answers: InitAnswers): readonly string[] {\n const head = [\n rule(\"schedules\"),\n `# Only \\`${BRAND.slug} serve\\` fires these. \\`run\\` reconciles them so they are listed and`,\n `# validated, and starts no timer.`,\n `#`,\n `# cron observes DST: an occurrence whose local time does not exist on a spring-forward day`,\n `# is SKIPPED, and a repeated fall-back hour fires ONCE. Avoid 00:00-03:00 and neither`,\n `# applies. every is interval-anchored and ignores DST. Each fire carries a fixed offset`,\n `# derived from the id — at most a tenth of the interval, capped at 15 minutes — so many`,\n `# schedules do not hit one endpoint at the same instant.`,\n `#`,\n `# deliver is required: { channel, to }, or the literal \"none\" for the event stream only.`,\n ]\n\n if (answers.schedules === \"daily\") {\n return [\n ...head,\n `schedules:`,\n ` - id: morning-brief`,\n ` kind: cron`,\n ` expr: \"0 8 * * *\" # 08:00 in the timezone below`,\n ` timezone: ${hostZoneName()}`,\n ` task: \"Summarise what is on today and anything left over from yesterday.\"`,\n ` deliver: none # or { channel: tg, to: \"@your-handle\" } once a channel exists`,\n ``,\n ]\n }\n\n if (answers.schedules === \"hourly\") {\n return [\n ...head,\n `schedules:`,\n ` - id: hourly-check`,\n ` kind: every`,\n ` expr: 1h`,\n ` task: \"Check for anything that needs attention and say nothing if all is well.\"`,\n ` deliver: none # or { channel: tg, to: \"@your-handle\" } once a channel exists`,\n ``,\n ]\n }\n\n return [\n ...head,\n `# schedules:`,\n `# - id: morning-brief`,\n `# kind: cron # cron | every | at`,\n `# expr: \"0 8 * * *\" # cron: 5 or 6 field | every: \"15m\" | at: ISO 8601`,\n `# timezone: ${hostZoneName()}`,\n `# task: \"Summarise the day ahead.\"`,\n `# deliver: none`,\n ``,\n ]\n}\n\n/** The host's own zone, so the generated example means what it looks like it means. */\nfunction hostZoneName(): string {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\"\n}\n\nfunction manifestFor(answers: InitAnswers): string {\n const slug = slugify(answers.name)\n\n const lines = [\n `# ${answers.name} — generated by \\`${BRAND.slug} init\\`.`,\n `#`,\n `# Everything active below is what init configured; everything commented arrives with the`,\n `# phase named beside it, and is REFUSED AT LOAD if uncommented early — the runtime never`,\n `# silently ignores configuration. docs/02-SPEC-MANIFEST.md is the binding reference.`,\n ``,\n `apiVersion: ${BRAND.apiVersion}`,\n `id: ${slug}`,\n `name: ${answers.name}`,\n ``,\n rule(\"model\"),\n `model:`,\n ` main:`,\n // Literal, not \\${MODEL_ID}. Which model an agent runs on is not a secret, and hard rule 10\n // governs secrets — so the indirection bought nothing and cost three things: the sandbox\n // picker listed every agent as \"\\${MODEL_ID}\" because `readManifestHeader` deliberately does\n // not expand; a stray .env in the directory you launched from silently changed the model,\n // and with it the resolved contextWindow, thinking mode and promptStyle; and `validate`\n // checked whichever agent the ambient environment happened to describe.\n //\n // \\${VAR} still expands everywhere. It is simply not what a generated file should reach for\n // when the value is a fact about this agent.\n ` id: ${answers.model}`,\n ` # Must end at the version segment; the runtime appends /chat/completions itself.`,\n ` baseUrl: ${answers.baseUrl}`,\n ` # Both take \\${VAR} if you would rather set them from the environment — a container, say.`,\n ` # The KEY never goes here in either form; the manifest names its variable, below.`,\n ]\n if (answers.apiKeyEnv !== undefined) {\n lines.push(\n ` # The *name* of an env var, never a value — a literal key fails validation.`,\n ` apiKeyEnv: ${answers.apiKeyEnv}`,\n )\n }\n lines.push(\n ` temperature: 0.3`,\n ` # reasoningEffort: none # none | minimal | low | medium | high — a reasoning model`,\n ` # # bills its thinking to the output budget; verify per endpoint`,\n ` # topP: 0.95`,\n ` # maxTokens: 4096`,\n ` # streamUsage: true # OpenAI extension; needed for real token counts on Ollama`,\n ` # Override the shipped capability registry only when it is wrong for your endpoint.`,\n ` # capabilities:`,\n ` # contextWindow: 32768`,\n ` # thinking: none # none | anthropic | openai | deepseek`,\n ` # promptStyle: # how workspace files render for this model (Phase 3.5)`,\n ` # delimiters: plain # xml | markdown | plain`,\n ` # intensity: emphatic # emphatic | neutral | soft`,\n ``,\n ` # A cheap model for tool selection and summarisation. \\`$ref\\` reuses a role.`,\n ` # selector:`,\n ` # id: a-cheaper-model`,\n ` # baseUrl: ${answers.baseUrl}`,\n ` # compactor: { $ref: model.selector }`,\n ``,\n rule(\"context\"),\n `context:`,\n ` workspace: ./workspace`,\n ``,\n ` # Tier 0 — cached, read-only. Identity is NOT listed here: the soul below (or its`,\n ` # distilled compact file) ships it. AGENTS.md is operations — what the agent does,`,\n ` # not who it is — which is why the two coexist.`,\n ` static:`,\n ` - AGENTS.md`,\n ` - POLICY.md`,\n ``,\n ` # Tier 1 — after the cache breakpoint, so a memory write never invalidates the prefix.`,\n ` volatile:`,\n ` - USER.md`,\n ` - MEMORY.md`,\n ``,\n ` # Tier 2 — re-asserted after the history, where attention is strongest.`,\n ` reminder: REMINDER.md`,\n ``,\n ` # How much of the window to keep free for the reply, so the prompt cannot crowd it out.`,\n ` # This is NOT a cap on what the model may generate — nothing is sent as max_tokens unless`,\n ` # you set model.main.maxTokens. Generous because a reasoning model thinks here too.`,\n ` reserveOutput: 8192`,\n ``,\n ` # Capability-gated identity: SOUL.md ships only to a model meeting \\`requires\\`; anything`,\n ` # else gets the hand-edited compact file. Edit SOUL.md first, then re-derive`,\n ` # SOUL.compact.md to match — never the reverse.`,\n ` soul:`,\n ` file: SOUL.md`,\n ` requires: { contextWindow: \">=200000\", class: frontier }`,\n ` onUnmet: distill`,\n ` distilled: SOUL.compact.md`,\n ``,\n ` # Defaults shown; uncomment to change. Budgets fail the load naming the file — never`,\n ` # silent truncation.`,\n ` # observationMaxTokens: 2000`,\n ` # budgets: { static: 2000, volatile: 3500, reminder: 500, total: 6000 }`,\n ` # rules:`,\n ` # perRuleSuccess: 0.90 # measure with \\`bun run eval:rules\\` in a checkout, do not guess`,\n ` # reliabilityTarget: 0.80 # at 0.90 per rule this permits TWO rules, not four`,\n ` # onExceed: fail`,\n ``,\n rule(\"tools\"),\n `tools:`,\n ` # Config only, never auto-detected: behaviour must not drift when the model changes.`,\n ` dialect: nlt`,\n ``,\n ` # Built-in tools, resolved from memory. Never sent to a remote provider.`,\n ` local:`,\n ...INIT_LOCAL_TOOLS.map((tool) => ` - ${tool.slug.padEnd(14)}# ${tool.note}`),\n ``,\n ` budget:`,\n ` max: 24`,\n ` reserveWrite: 6 # slots held for mutating tools so reads cannot starve writes`,\n ``,\n ...systemBlock(answers),\n ``,\n ` # tools.search finds a TOOL in the provider's catalogue — nothing to do with web search.`,\n ` # Off by design in v1: search-then-execute is two-hop reasoning, where small models fail.`,\n ` search:`,\n ` enabled: false`,\n ``,\n ...policyBlock(answers),\n ``,\n ` # ── the write gate ──`,\n ` # A tool whose output came from outside this conversation taints the turn. After that, a`,\n ` # tool that CHANGES something needs explicit authorisation — one of the allow rules above,`,\n ` # or a live approval. \"refuse\" never prompts, which is what makes it right for a schedule.`,\n ` untrusted:`,\n ` onMutate: refuse # refuse | confirm | allow`,\n ``,\n rule(\"limits\"),\n `limits:`,\n ` # Generous, because a step budget is not a plan. The old default here was 6 — sized for a`,\n ` # two-tool chain, call/observe/call/observe/reply and one spare — and it cut a real agent`,\n ` # off one step after it had installed the dependency it needed, with the reply ending on`,\n ` # \"Let me install it\". Real work recovers, and recovery costs steps.`,\n ` maxSteps: 40`,\n ` # This is what catches a model that is stuck rather than working: identical consecutive`,\n ` # calls, same tool AND same arguments. Two is a retry, often correct. Three is a pattern.`,\n ` noProgress:`,\n ` identicalCalls: 3`,\n ` # Both of these were overridden here at 120000 and 30000, tighter than the defaults for no`,\n ` # stated reason — and 6 steps x 30s already exceeded the 120s turn, so the wall clock would`,\n ` # have fired first on slow tools. The schema defaults are 1800000 and 120000; uncomment to`,\n ` # change them rather than to restate them.`,\n ` # turnTimeoutMs: 1800000`,\n ` # toolTimeoutMs: 120000`,\n ``,\n ...channelsBlock(answers),\n ...serverBlock(answers),\n rule(\"later phases — refused at load until they ship\"),\n `# Phase 7 — phase-scoped tool visibility (the strongest published small-model lever)`,\n `# phases:`,\n `# triage: { entry: true, allow: [\"now\"] }`,\n `# act: { allow: [\"*\"] }`,\n ``,\n // Written whether or not a starter skill was scaffolded. The directory always exists, so an\n // empty one is a switch that is off — which slot 2 reports as such — rather than a concept the\n // agent does not have and will never ask about.\n `# Skills — procedures the harness selects from the turn's input, at most maxActive per turn.`,\n `# The model does not choose one; ranking happens before the turn. \\`skills list\\` shows them.`,\n `skills:`,\n ` dir: ./skills`,\n ` maxActive: 1`,\n ` threshold: 0.35 # normalised floor; below it nothing activates`,\n ` # # there is no token budget: maxActive is the only limit, and a`,\n ` # # skill's size is shown in the catalogue where you choose it`,\n ``,\n // Named and switched on, for the reason the web provider had to learn twice: a capability left\n // commented out is one the model cannot know it lacks, and the only route to it is knowing the\n // field names already. The block it replaced said `k: 6` — a field that does not exist in the\n // schema, so uncommenting it would have failed the load. Nothing checks a comment.\n `# Memory — what carries across sessions. Retrieved per turn and BM25-ranked, never pinned:`,\n `# slot 10 is retrieved, and compaction may drop it. \\`memory search <agent> \"...\"\\` shows what a`,\n `# question would recall; \\`memory rebuild <agent>\\` re-reads the notes and the conversations.`,\n `memory:`,\n ` retriever: fts5`,\n ` dir: ./memory # where eviction files older notes. Indexed, never carried;`,\n ` # # created on first eviction, so its absence is not an error`,\n ` maxActive: 5`,\n ` threshold: 0.2 # lexical relevance × original-query coverage × recency`,\n ` budget: 2000 # a ceiling, not a target. One exchange bills about 370 tokens`,\n ` includeHistory: true # index clean prose, not only what was deliberately saved.`,\n ` # # Tool output and replies derived from it are never indexed: text a`,\n ` # # stranger wrote must not outlive the write gate`,\n ``,\n // Named and switched on for the reason skills above is: `knowledge.dir` naming a path that\n // does not exist is a load failure, so the directory is scaffolded and an empty one is a\n // switch that is off rather than a concept the agent does not have. It shipped commented\n // out for three phases behind a \"create ./knowledge first\" note — which is the same shape\n // as the web provider and memory, a capability reachable only by knowing the field names.\n `# Knowledge — reference material that activates only on the turns that mention it. Tier 3:`,\n `# retrieved, never pinned, outside the workspace budget, and compaction may drop it.`,\n `# Every .md in that directory is an entry and must open with frontmatter naming its`,\n `# keywords, so a plain README.md there fails the load. An entry looks like:`,\n `# ---`,\n `# keywords: [invoice, billing, VAT]`,\n `# ---`,\n `# Whatever this agent should know whenever one of those words comes up.`,\n `knowledge:`,\n ` dir: ./knowledge`,\n ` maxActive: 2 # entries in one turn`,\n ` budget: 600 # total across them. One entry over this fails the load: it could`,\n ` # # never activate, and silently unreachable is the wrong answer.`,\n ` # # Matching is whole-word and case-insensitive against the input`,\n ``,\n ...schedulesBlock(answers),\n // Not a phase heading any more — plugins ship, and a `# Phase 9` line above a live block\n // reads as a phase that has not arrived. `uncommentInSource` drops a `# Phase <n>` line and\n // keeps prose, which is the behaviour wanted either way: this explanation belongs above the\n // block whether or not it is commented.\n `# Plugins — extra channels, tool providers and script runners, resolved at boot.`,\n `# Looked up in three places, in order: this binary's built-in registry, then`,\n `# ~/${BRAND.stateDir}/plugins/<name>/ where \\`${BRAND.slug} plugins add\\` puts one, then a module`,\n `# import. A relative path is only ever a path, resolved against this file's directory.`,\n `# Nothing is installed while the process runs, so a plugin is one self-contained bundle.`,\n `# Trusted in-process code: \\`permissions\\` is advisory in v1 — recorded, surfaced by`,\n `# \\`${BRAND.slug} plugins list\\`, enforced by nothing. Install plugins you trust.`,\n // **No entry for WhatsApp any more.** It is bundled, so naming it here would name a plugin\n // the binary already supplies — and a `plugins:` entry that cannot be satisfied is exactly\n // what made a generated manifest print an install command that could not work.\n `# plugins:`,\n `# - \"${BRAND.packageScope}/channel-telegram\"`,\n ``,\n )\n return lines.join(\"\\n\")\n}\n\nfunction envFor(answers: InitAnswers): string {\n // Secrets and nothing else. The model id and the base URL are facts about this agent and live\n // in agent.yaml where a person reads them; a file that also held them made the manifest\n // unreadable on its own and let any other .env on the machine change which model ran.\n const lines = [\n `# Secrets for this agent. Gitignored, and the only thing that belongs here.`,\n `# Everything else — model, endpoint, tools, permissions — is in agent.yaml.`,\n ]\n if (answers.apiKeyEnv !== undefined) {\n // The value the wizard collected, or an empty line to fill in. This file is gitignored and\n // sits beside the manifest, which is the whole point: the manifest names the variable, the\n // key lives here. A key is still never accepted as a command-line flag — that writes it\n // into shell history — so the scripted path leaves this blank and the next steps say so.\n lines.push(`${answers.apiKeyEnv}=${answers.apiKey ?? \"\"}`)\n }\n // Only when search was chosen. Writing an empty TAVILY_API_KEY into every agent's .env would put\n // a variable nobody asked for in front of everybody, and `web_search` names the missing one at\n // the moment it is called anyway.\n const backend = searchBackend(answers)\n if (backend !== undefined) {\n lines.push(\"\")\n lines.push(`# ${backend.label.split(\" —\")[0] ?? backend.value}, for web_search.`)\n lines.push(`${backend.apiKeyEnv}=${answers.webKey ?? \"\"}`)\n }\n // Same rule again: only written for an agent that asked for it. An empty COMPOSIO_API_KEY in\n // every generated .env is a variable nobody chose, and the provider names the missing one at\n // the moment it needs it anyway.\n if (composioEnabled(answers)) {\n lines.push(\"\")\n lines.push(`# Composio, for your other apps. Needed to warm the cache and to execute.`)\n lines.push(`${COMPOSIO_KEY_ENV}=${answers.composioKey ?? \"\"}`)\n }\n if (answers.telegram === \"connected\") {\n lines.push(\"\")\n lines.push(`# Telegram. From @BotFather with /newbot; /revoke invalidates it immediately.`)\n lines.push(`${TELEGRAM_TOKEN_ENV}=${answers.telegramToken ?? \"\"}`)\n }\n // The one secret here that is *ours* rather than a third party's, so it is generated rather\n // than left blank: a public bind refuses to start without it, and `openssl rand -hex 32` is\n // exactly what someone does by hand at this point.\n if (answers.serverToken !== undefined && answers.serverToken !== \"\") {\n lines.push(\"\")\n lines.push(`# The HTTP API's bearer token. Generated — replace it whenever you like.`)\n lines.push(`${BRAND.envPrefix}API_TOKEN=${answers.serverToken}`)\n }\n return `${lines.join(\"\\n\")}\\n`\n}\n\n/** The chosen search backend, or undefined when this agent does not search. */\nfunction searchBackend(answers: InitAnswers): (typeof WEB_BACKENDS)[number] | undefined {\n if (answers.web !== \"search\") return undefined\n return webBackendByValue(answers.webBackend ?? \"tavily\") ?? WEB_BACKENDS[0]\n}\n\n/**\n * The committed template beside the gitignored real thing.\n *\n * Once the model id and the base URL moved into the manifest, this stopped being a menu of endpoints\n * — switching endpoint is now `config_set model.main.id` or two lines in agent.yaml — and became\n * what its name says: the list of variables that must exist, with no values in it.\n */\nfunction envExampleFor(answers: InitAnswers): string {\n const backend = searchBackend(answers)\n const lines = [\n `# Copy to .env beside the manifest and fill in the values. Never commit the copy.`,\n `# Only secrets belong here. The model, the endpoint, the tools and the permissions are all`,\n `# in agent.yaml, where you can read them without opening a second file.`,\n ``,\n ]\n if (answers.apiKeyEnv === undefined) {\n lines.push(\n `# This endpoint needs no key — agent.yaml omits apiKeyEnv entirely, so there is nothing`,\n `# to put here yet. A hosted endpoint would name its variable there and you would set it`,\n `# here, like:`,\n `# MODEL_API_KEY=`,\n )\n } else {\n lines.push(`${answers.apiKeyEnv}=`)\n }\n if (backend !== undefined) {\n lines.push(``, `# ${backend.label.split(\" —\")[0] ?? backend.value}, for web_search.`)\n lines.push(`${backend.apiKeyEnv}=`)\n }\n if (composioEnabled(answers)) {\n lines.push(``, `# Composio, for your other apps.`)\n lines.push(`${COMPOSIO_KEY_ENV}=`)\n }\n return `${lines.join(\"\\n\")}\\n`\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";sCAuBO,IAAM,GACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,sFACA,uFACA,oDACA,YACA,kBACA,kBACA,GACA,2FACA,cACA,gBACA,kBACA,GACA,4EACA,0BACA,GACA,4FACA,8FACA,wFACA,wBACA,GACA,4FACA,iFACA,oDACA,UACA,oBACA,+DACA,uBACA,iCACA,GACA,yFACA,yBACA,iCACA,4EACA,aACA,gGACA,oFACA,uBACA,GACA,EAAK,OAAO,EACZ,SACA,yFACA,iBACA,GACA,6EACA,WACA,GAAG,EAAiB,IAAI,CAAC,IAAS,SAAS,EAAK,KAAK,OAAO,EAAE,MAAM,EAAK,MAAM,EAC/E,GACA,YACA,cACA,sFACA,GACA,GAAG,EAAY,CAAO,EACtB,GACA,6FACA,8FACA,YACA,qBACA,GACA,GAAG,EAAY,CAAO,EACtB,GACA,2BACA,6FACA,+FACA,+FACA,eACA,6DACA,GACA,EAAK,QAAQ,EACb,UACA,8FACA,8FACA,6FACA,yEACA,iBACA,4FACA,8FACA,gBACA,wBACA,+FACA,gGACA,+FACA,+CACA,6BACA,4BACA,GACA,GAAG,EAAc,CAAO,EACxB,GAAG,EAAY,CAAO,EACtB,EAAK,gDAAgD,EACrD,uFACA,YACA,8CACA,+BACA,GAIA,+FACA,8FACA,UACA,kBACA,iBACA,0EACA,0FACA,wFACA,GAKA,6FACA,iGACA,8FACA,UACA,oBACA,uFACA,uFACA,iBACA,mFACA,0FACA,sFACA,+FACA,4EACA,GAMA,6FACA,uFACA,sFACA,8EACA,UACA,wCACA,UACA,4EACA,aACA,qBACA,iDACA,6FACA,2FACA,2FACA,GACA,GAAG,EAAe,CAAO,EAKzB,mFACA,+EACA,OAAO,EAAM,oCAAoC,EAAM,6CACvD,yFACA,2FACA,qFACA,OAAO,EAAM,uEAIb,aACA,UAAU,EAAM,iCAChB,EACJ,EACO,EAAM,KAAK;AAAA,CAAI,EAG1B,SAAS,CAAM,CAAC,EAA8B,CAI1C,IAAM,EAAQ,CACV,8EACA,6EACJ,EACA,GAAI,EAAQ,YAAc,OAKtB,EAAM,KAAK,GAAG,EA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