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.
Files changed (195) hide show
  1. package/README.md +134 -85
  2. package/dist/App-qfqvx9c7.js +11 -0
  3. package/dist/{App-b1yrwrcq.js.map → App-qfqvx9c7.js.map} +6 -7
  4. package/dist/ConfigEditor-apcnj4nj.js +6 -0
  5. package/dist/{ConfigEditor-n8hdw6r7.js.map → ConfigEditor-apcnj4nj.js.map} +2 -2
  6. package/dist/KeyProbe-ya5t3v3v.js +5 -0
  7. package/dist/{KeyProbe-9jjeze5r.js.map → KeyProbe-ya5t3v3v.js.map} +2 -2
  8. package/dist/Picker-b7mn0mjg.js +5 -0
  9. package/dist/{Picker-hfeh1g6m.js.map → Picker-b7mn0mjg.js.map} +1 -1
  10. package/dist/SessionPicker-vacfwczg.js +5 -0
  11. package/dist/{SessionPicker-zyqkg4dn.js.map → SessionPicker-vacfwczg.js.map} +2 -2
  12. package/dist/SkillBrowser-66ntwaa9.js +5 -0
  13. package/dist/{SkillBrowser-3qdp8080.js.map → SkillBrowser-66ntwaa9.js.map} +1 -1
  14. package/dist/WizardApp-123998yh.js +5 -0
  15. package/dist/{WizardApp-vzpbydy3.js.map → WizardApp-123998yh.js.map} +3 -3
  16. package/dist/agents.d.ts +19 -3
  17. package/dist/agents.d.ts.map +1 -1
  18. package/dist/channels-q4fwqq87.js +31 -0
  19. package/dist/channels-q4fwqq87.js.map +10 -0
  20. package/dist/channels.d.ts +26 -0
  21. package/dist/channels.d.ts.map +1 -0
  22. package/dist/client.js +10 -10
  23. package/dist/client.js.map +3 -3
  24. package/dist/config-64q4mgxc.js +24 -0
  25. package/dist/{config-g7za9x13.js.map → config-64q4mgxc.js.map} +2 -2
  26. package/dist/{credential-npr6z8c8.js → credential-2sj7vsmw.js} +5 -5
  27. package/dist/{credential-npr6z8c8.js.map → credential-2sj7vsmw.js.map} +1 -1
  28. package/dist/daemon.d.ts.map +1 -1
  29. package/dist/index-0k3w2mxf.js +6 -0
  30. package/dist/{index-hwpvhaza.js.map → index-0k3w2mxf.js.map} +1 -1
  31. package/dist/index-1s81qstp.js +6 -0
  32. package/dist/{index-v8e92nfw.js.map → index-1s81qstp.js.map} +1 -1
  33. package/dist/index-2rycma8x.js +12 -0
  34. package/dist/{index-258d8bzg.js.map → index-2rycma8x.js.map} +4 -3
  35. package/dist/index-2zye08c4.js +6 -0
  36. package/dist/{index-vgc3y3rm.js.map → index-2zye08c4.js.map} +2 -2
  37. package/dist/{index-gme2egyq.js → index-3km1jwh7.js} +4 -4
  38. package/dist/{index-gme2egyq.js.map → index-3km1jwh7.js.map} +1 -1
  39. package/dist/index-3mtgcvkq.js +429 -0
  40. package/dist/index-3mtgcvkq.js.map +11 -0
  41. package/dist/index-4knb5vjm.js +90 -0
  42. package/dist/index-4knb5vjm.js.map +13 -0
  43. package/dist/{index-3g3ny01d.js → index-5nwwekk0.js} +4 -4
  44. package/dist/{index-3g3ny01d.js.map → index-5nwwekk0.js.map} +1 -1
  45. package/dist/index-5rm7dwq4.js +6 -0
  46. package/dist/index-5rm7dwq4.js.map +11 -0
  47. package/dist/index-79epttpm.js +6 -0
  48. package/dist/index-79epttpm.js.map +10 -0
  49. package/dist/{index-4cf6v9nb.js → index-7yk1zvds.js} +4 -4
  50. package/dist/{index-4cf6v9nb.js.map → index-7yk1zvds.js.map} +1 -1
  51. package/dist/index-81gb4ey4.js +6 -0
  52. package/dist/{index-4z7axw4r.js.map → index-81gb4ey4.js.map} +1 -1
  53. package/dist/index-8a5d8sfe.js +6 -0
  54. package/dist/{index-0d93hyfc.js.map → index-8a5d8sfe.js.map} +1 -1
  55. package/dist/index-a21zyy54.js +6 -0
  56. package/dist/index-a21zyy54.js.map +9 -0
  57. package/dist/index-b6da6c16.js +92 -0
  58. package/dist/index-b6da6c16.js.map +15 -0
  59. package/dist/index-byxrc961.js +903 -0
  60. package/dist/{index-tv4yv7d2.js.map → index-byxrc961.js.map} +16 -15
  61. package/dist/{index-ammv5st7.js → index-cgfg6t5a.js} +6 -6
  62. package/dist/{index-ammv5st7.js.map → index-cgfg6t5a.js.map} +1 -1
  63. package/dist/{index-s9mbq7h6.js → index-ehzwdnc3.js} +4 -4
  64. package/dist/{index-s9mbq7h6.js.map → index-ehzwdnc3.js.map} +1 -1
  65. package/dist/index-fzmmhmk2.js +7 -0
  66. package/dist/index-fzmmhmk2.js.map +11 -0
  67. package/dist/index-g3pk0kc0.js +6 -0
  68. package/dist/{index-9r0wyj6w.js.map → index-g3pk0kc0.js.map} +2 -2
  69. package/dist/index-h828nk24.js +153 -0
  70. package/dist/index-h828nk24.js.map +20 -0
  71. package/dist/{index-02dn6m2j.js → index-jq999vcw.js} +5 -5
  72. package/dist/{index-02dn6m2j.js.map → index-jq999vcw.js.map} +2 -2
  73. package/dist/index-k2aq5bg0.js +9 -0
  74. package/dist/{index-6p999cx4.js.map → index-k2aq5bg0.js.map} +4 -6
  75. package/dist/{index-cqqb6gaq.js → index-k3y8y3wj.js} +5 -5
  76. package/dist/{index-cqqb6gaq.js.map → index-k3y8y3wj.js.map} +1 -1
  77. package/dist/index-k59wwdgz.js +9 -0
  78. package/dist/{index-ff514z3y.js.map → index-k59wwdgz.js.map} +3 -5
  79. package/dist/index-nmnnwa02.js +6 -0
  80. package/dist/{index-6q4wf8e3.js.map → index-nmnnwa02.js.map} +1 -1
  81. package/dist/index-nn3tk25c.js +6 -0
  82. package/dist/{index-d4x6yvqh.js.map → index-nn3tk25c.js.map} +3 -4
  83. package/dist/index-q0hxh57v.js +126 -0
  84. package/dist/index-q0hxh57v.js.map +14 -0
  85. package/dist/index-srmhk9g5.js +11 -0
  86. package/dist/index-srmhk9g5.js.map +11 -0
  87. package/dist/index-swtyfhha.js +6 -0
  88. package/dist/{index-fex44816.js.map → index-swtyfhha.js.map} +2 -2
  89. package/dist/index-whq42sat.js +6 -0
  90. package/dist/{index-h9mw7b9d.js.map → index-whq42sat.js.map} +1 -1
  91. package/dist/{index-j7gyr5nx.js → index-wzsmh5j0.js} +7 -7
  92. package/dist/{index-j7gyr5nx.js.map → index-wzsmh5j0.js.map} +1 -1
  93. package/dist/{index-j55s3ehk.js → index-x7v1zq89.js} +7 -7
  94. package/dist/{index-j55s3ehk.js.map → index-x7v1zq89.js.map} +2 -2
  95. package/dist/index-xhzmv4dh.js +66 -0
  96. package/dist/index-xhzmv4dh.js.map +12 -0
  97. package/dist/index-xmv47vs0.js +6 -0
  98. package/dist/{index-gz9x25tz.js.map → index-xmv47vs0.js.map} +2 -2
  99. package/dist/index-y4c32wn7.js +6 -0
  100. package/dist/{index-qdbq8crg.js.map → index-y4c32wn7.js.map} +2 -2
  101. package/dist/index-yjcdp72k.js +6 -0
  102. package/dist/{index-tf71ap9v.js.map → index-yjcdp72k.js.map} +1 -1
  103. package/dist/index-zn24991r.js +6 -0
  104. package/dist/index-zn24991r.js.map +10 -0
  105. package/dist/index.js +374 -443
  106. package/dist/index.js.map +23 -27
  107. package/dist/init.d.ts.map +1 -1
  108. package/dist/lib/channel-actions.d.ts +103 -0
  109. package/dist/lib/channel-actions.d.ts.map +1 -0
  110. package/dist/lib/chat-frame.d.ts +12 -1
  111. package/dist/lib/chat-frame.d.ts.map +1 -1
  112. package/dist/lib/commands.d.ts +13 -0
  113. package/dist/lib/commands.d.ts.map +1 -1
  114. package/dist/lib/const.d.ts +1 -1
  115. package/dist/lib/host-actions.d.ts +121 -0
  116. package/dist/lib/host-actions.d.ts.map +1 -0
  117. package/dist/lib/init-flow.d.ts +32 -0
  118. package/dist/lib/init-flow.d.ts.map +1 -1
  119. package/dist/lib/init-whatsapp.d.ts +52 -0
  120. package/dist/lib/init-whatsapp.d.ts.map +1 -0
  121. package/dist/lib/plugin-install.d.ts +120 -0
  122. package/dist/lib/plugin-install.d.ts.map +1 -0
  123. package/dist/lib/providers.d.ts.map +1 -1
  124. package/dist/lib/provision.d.ts.map +1 -1
  125. package/dist/lib/readme-table.d.ts +15 -0
  126. package/dist/lib/readme-table.d.ts.map +1 -0
  127. package/dist/lib/sandbox.d.ts +15 -0
  128. package/dist/lib/sandbox.d.ts.map +1 -1
  129. package/dist/lib/schema.d.ts +34 -1
  130. package/dist/lib/schema.d.ts.map +1 -1
  131. package/dist/lib/subcommand.d.ts.map +1 -1
  132. package/dist/lib/web-url.d.ts +15 -0
  133. package/dist/lib/web-url.d.ts.map +1 -0
  134. package/dist/lib/wizard.d.ts.map +1 -1
  135. package/dist/memory.d.ts.map +1 -1
  136. package/dist/model.d.ts.map +1 -1
  137. package/dist/plugins.d.ts +27 -8
  138. package/dist/plugins.d.ts.map +1 -1
  139. package/dist/restart.d.ts +21 -0
  140. package/dist/restart.d.ts.map +1 -0
  141. package/dist/run.d.ts.map +1 -1
  142. package/dist/schedules.d.ts.map +1 -1
  143. package/dist/serve.d.ts.map +1 -1
  144. package/dist/sessions.d.ts.map +1 -1
  145. package/dist/skills.d.ts.map +1 -1
  146. package/dist/status.d.ts +16 -0
  147. package/dist/status.d.ts.map +1 -0
  148. package/dist/tools.d.ts.map +1 -1
  149. package/dist/validate.d.ts.map +1 -1
  150. package/dist/web-923c7f5e.js +14 -0
  151. package/dist/{web-vkb16r62.js.map → web-923c7f5e.js.map} +3 -3
  152. package/dist/web.d.ts +2 -13
  153. package/dist/web.d.ts.map +1 -1
  154. package/dist/workspace.d.ts.map +1 -1
  155. package/dist/wrapper-0w9b3my0.js +11 -0
  156. package/dist/wrapper-0w9b3my0.js.map +23 -0
  157. package/package.json +6 -3
  158. package/dist/App-b1yrwrcq.js +0 -11
  159. package/dist/ConfigEditor-n8hdw6r7.js +0 -6
  160. package/dist/KeyProbe-9jjeze5r.js +0 -5
  161. package/dist/Picker-hfeh1g6m.js +0 -5
  162. package/dist/SessionPicker-zyqkg4dn.js +0 -5
  163. package/dist/SkillBrowser-3qdp8080.js +0 -5
  164. package/dist/WizardApp-vzpbydy3.js +0 -5
  165. package/dist/config-g7za9x13.js +0 -24
  166. package/dist/index-0d93hyfc.js +0 -6
  167. package/dist/index-1c5113t4.js +0 -66
  168. package/dist/index-1c5113t4.js.map +0 -12
  169. package/dist/index-258d8bzg.js +0 -12
  170. package/dist/index-4z7axw4r.js +0 -6
  171. package/dist/index-6p999cx4.js +0 -9
  172. package/dist/index-6q4wf8e3.js +0 -6
  173. package/dist/index-9r0wyj6w.js +0 -6
  174. package/dist/index-d4x6yvqh.js +0 -6
  175. package/dist/index-fecm8xe7.js +0 -77
  176. package/dist/index-fecm8xe7.js.map +0 -12
  177. package/dist/index-fex44816.js +0 -6
  178. package/dist/index-ff514z3y.js +0 -14
  179. package/dist/index-gz9x25tz.js +0 -6
  180. package/dist/index-h9mw7b9d.js +0 -6
  181. package/dist/index-hwpvhaza.js +0 -6
  182. package/dist/index-mtn0g9vc.js +0 -7
  183. package/dist/index-mtn0g9vc.js.map +0 -11
  184. package/dist/index-qdbq8crg.js +0 -6
  185. package/dist/index-tf71ap9v.js +0 -6
  186. package/dist/index-ttwyrdjs.js +0 -427
  187. package/dist/index-ttwyrdjs.js.map +0 -11
  188. package/dist/index-tv4yv7d2.js +0 -903
  189. package/dist/index-ty24n0jh.js +0 -167
  190. package/dist/index-ty24n0jh.js.map +0 -19
  191. package/dist/index-v8e92nfw.js +0 -6
  192. package/dist/index-vgc3y3rm.js +0 -6
  193. package/dist/index-whaw4b18.js +0 -6
  194. package/dist/index-whaw4b18.js.map +0 -10
  195. package/dist/web-vkb16r62.js +0 -14
@@ -1,19 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/skills.ts", "../src/lib/origins.ts", "../../channel-telegram/dist/index.js", "../../tools-composio/dist/index.js", "../../tools-system/dist/index.js", "../../tools-web/dist/index.js", "../src/lib/providers.ts", "../src/lib/source-cache.ts", "../src/lib/sources.ts", "../src/browse.ts"],
4
- "sourcesContent": [
5
- "/**\n * `skills list|show|validate <manifest>` — what this agent knows how to do, and how well it is written.\n *\n * Three questions, deliberately not one command. `list` is the inventory, `show` is one skill in full —\n * including the parts the model never sees, which is the only way to check what it *will* see — and\n * `validate` is the authoring read.\n *\n * `validate` warns and exits 0, with `--strict` for CI. That is the `workspace` split rather than the\n * `validate` one: a skill that does not load already fails here loudly, because this calls the same\n * `loadSkills` the runtime does, and everything past that is a judgement. In particular a missing\n * when-not-to-use is a warning and never a refusal — requiring it would reject every skill vendored from\n * `anthropics/skills` and withdraw decision 6.1's compliance claim to buy a nag.\n *\n * A `ScriptRunner` is supplied here for the same reason `run` supplies one: without it a skill's\n * `scripts/` is never scanned, so `skills list` would report \"no scripts\" for a skill that ships three.\n * The command answers about the runtime, not about a subset of it.\n */\n\nimport {\n cpSync,\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\"\nimport { basename, isAbsolute, join, relative, resolve } from \"node:path\"\nimport {\n checkSkillAuthoring,\n type ErrorDetail,\n editManifestSync,\n HarnessError,\n isSkillName,\n loadManifest,\n loadSkills,\n nearest,\n parseSkillFile,\n resolveCapabilities,\n type Skill,\n type SkillsConfig,\n whenNotToUseKey,\n} from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { forgetOrigin, type Origin, readOrigins, recordOrigins } from \"#lib/origins\"\nimport { CHANNEL_IDS, PROVIDER_IDS, scriptRunner } from \"#lib/providers\"\nimport { bullet, indent, keyValue, section } from \"#lib/render\"\nimport {\n type CatalogueEntry,\n isCached,\n looksLikePath,\n readCatalogue,\n readMeta,\n} from \"#lib/source-cache\"\nimport { loadSources, parseSkillRef, type SkillRef, type SourceSpec } from \"#lib/sources\"\nimport { fillTemplate, SKILL_TEMPLATE } from \"#lib/templates\"\n\n/** A skill found in a fetched source, with everything provenance needs. */\ninterface Located {\n readonly entry: CatalogueEntry\n readonly spec: SourceSpec\n readonly commit: string\n}\n\nconst SKILL_FILE = \"SKILL.md\"\n\n/**\n * The actions this command accepts, pinned so `--help` and the switch below cannot drift.\n *\n * The same guard `DAEMON_ACTIONS` gets: a verb added in one place and not the other fails a test rather\n * than at the moment somebody types it.\n */\nexport const SKILLS_ACTIONS = [\"list\", \"show\", \"new\", \"install\", \"remove\", \"validate\"] as const\n\nexport interface SkillsOptions {\n readonly manifestPath: string\n /** `list`, `show` or `validate`. Checked by the dispatcher against the spec's `choices`. */\n readonly action: string\n /**\n * The skill `show`, `new` and `remove` act on — or, for `install`, the directory to copy from.\n *\n * One positional rather than three, because the parser has one slot after the manifest and a\n * command with `--name`, `--from` and `--skill` flags reads worse than the thing it replaced.\n */\n readonly name?: string\n readonly json?: boolean\n /** `validate` only: exit non-zero when anything was reported. */\n readonly strict?: boolean\n /**\n * The `<ENVPREFIX>HOME` override that says where the source registry and cache live.\n *\n * Deliberately **not** the manifest environment — that one is `ambientEnv` below and answers \"which\n * model, which key\". This one answers \"which `sources.json`\", and it exists because `install` resolves\n * a `<source>/<skill>` ref against it: without the field, this command read the real home directory\n * while its caller read a sandbox, so an install driven from a test or from `init` looked up a\n * registry nobody had written to and reported `no source called test` on a source that plainly existed.\n */\n readonly sandboxEnv?: Readonly<Record<string, string | undefined>>\n /**\n * Extra variables layered on top of the resolved manifest environment.\n *\n * One caller: `init`, which stubs the API key variable it has just written as an empty line. Without\n * it, installing a skill during setup failed with `model.main.apiKeyEnv names MODEL_API_KEY, which is\n * not set` — correct, useless, and about a key nobody could have filled in yet. `init`'s own load\n * check has always done this; the command it calls needed the same courtesy.\n */\n readonly envOverlay?: Readonly<Record<string, string | undefined>>\n /**\n * Report nothing and let the caller summarise. Set by a batch install.\n *\n * Eleven ticked skills produced **eleven** `from/installed/this installed code/next` blocks — a screenful\n * of repeated narrative for one action, which is what \"the TUI should be everything\" was objecting to.\n * The per-skill report is right for `skills install <one>` and wrong the moment there are eleven, so the\n * caller decides. `collect` is how it gets the facts it needs to write one summary instead.\n */\n readonly quiet?: boolean\n /** Appended to, when given: what happened to each skill this call touched. */\n readonly collect?: InstallOutcome[]\n}\n\n/** What one install did, for a caller aggregating several. */\nexport interface InstallOutcome {\n readonly name: string\n readonly ok: boolean\n /** Why not, when `ok` is false. */\n readonly reason?: string\n /** Files that would run, relative to the skills directory. */\n readonly runnable: readonly string[]\n}\n\nexport function skillsCommand(options: SkillsOptions): number {\n try {\n const loaded = loadManifest(options.manifestPath, {\n knownProviders: PROVIDER_IDS,\n knownChannels: CHANNEL_IDS,\n // The same environment `run` uses, or this reports on a different agent — the asymmetry\n // every command that loads a manifest exists to avoid.\n env: { ...ambientEnv([options.manifestPath]), ...options.envOverlay },\n })\n\n // `new` and `install` are the two that may run with nothing configured — turning skills on is\n // exactly what they are for, so they do it rather than reporting that it has not been done.\n const creating = options.action === \"new\" || options.action === \"install\"\n const configured = creating\n ? enable(loaded.path, loaded.dir, loaded.manifest.skills)\n : loaded.manifest.skills\n if (configured === undefined) {\n return unconfigured(options)\n }\n\n const capabilities = resolveCapabilities(\n loaded.manifest.model.main.id,\n loaded.manifest.model.main.capabilities,\n )\n const resolvedDir = isAbsolute(configured.dir)\n ? configured.dir\n : resolve(loaded.dir, configured.dir)\n\n // `new` and `remove` run **before** the catalogue is loaded, and that ordering is the fix for a\n // dead end this command had: a skill over `skills.budget` fails the load, so with `remove` behind\n // `loadSkills` the one command that could undo it was the one that could not run. Neither needs a\n // catalogue — one writes a directory, the other deletes one — so neither waits for it.\n if (options.action === \"new\") return create(resolvedDir, options)\n if (options.action === \"remove\") return remove(resolvedDir, options)\n\n const catalogue = loadSkills({\n dir: resolvedDir,\n maxActive: configured.maxActive,\n threshold: configured.threshold,\n style: capabilities.promptStyle,\n agentDir: loaded.dir,\n runner: scriptRunner(),\n })\n\n switch (options.action) {\n case \"list\":\n return list(resolvedDir, catalogue.skills, catalogue, options)\n case \"show\":\n return show(catalogue.skills, options)\n case \"install\":\n return install(resolvedDir, options)\n default:\n // `validate` is the fallback rather than a named case because the parser has already\n // rejected anything outside `SKILLS_ACTIONS`, and the safest thing to do with an action\n // that somehow got through is the one that changes nothing.\n return validate(catalogue.skills, options)\n }\n } catch (error) {\n if (options.json === true && error instanceof HarnessError) {\n process.stdout.write(\n `${JSON.stringify({ ok: false, error: error.toDetail(), details: error.details }, null, 2)}\\n`,\n )\n return EXIT_FAILURE\n }\n throw error\n }\n}\n\n/**\n * No `skills:` block at all.\n *\n * Not an error — an agent without skills is an ordinary agent — but it names the block, because someone\n * who typed this command was looking for something and \"no skills\" without a way forward is the shape\n * decision 4.53 objects to.\n */\nfunction unconfigured(options: SkillsOptions): number {\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify({ ok: true, configured: false, skills: [] }, null, 2)}\\n`,\n )\n return EXIT_OK\n }\n // Two commands, not a YAML fragment. This used to print the block to add by hand, which is the\n // workaround `skills new` was built to remove — and it kept printing it for a phase after that\n // command existed, so the one place someone lands when looking for skills was the one place still\n // recommending the manual edit.\n process.stdout.write(\n \"this agent has no skills configured\\n\\n\" +\n \" · find one and install it — searches the catalogues, 440+ skills:\\n\" +\n \" sources search <what it should do>\\n\" +\n ` skills install ${options.manifestPath} <source>/<skill>\\n\\n` +\n \" · or write your own from a template:\\n\" +\n ` skills new ${options.manifestPath} <name>\\n\\n` +\n \" either one turns skills on for this agent; neither needs agent.yaml edited by hand\\n\",\n )\n return EXIT_OK\n}\n\nfunction list(\n dir: string,\n skills: readonly Skill[],\n catalogue: {\n readonly maxActive: number\n readonly threshold: number\n readonly cached: boolean\n },\n options: SkillsOptions,\n): number {\n // Read here rather than inside the loop: one file for the whole directory, and a listing that opened\n // it per skill would be doing filesystem work proportional to a catalogue it already has in memory.\n const origins = readOrigins(dir)\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n {\n ok: true,\n configured: true,\n cached: catalogue.cached,\n maxActive: catalogue.maxActive,\n threshold: catalogue.threshold,\n skills: skills.map((skill) => ({\n ...summarise(skill),\n ...(origins[skill.name] === undefined\n ? {}\n : { origin: origins[skill.name] }),\n })),\n },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n }\n\n if (skills.length === 0) {\n process.stdout.write(\n `no skills in ${dir}\\n\\n \\`sources search <what it should do>\\` ranks 440+ from the configured catalogues, then\\n \\`skills install <agent> <source>/<skill>\\`. \\`skills new <agent> <name>\\` writes one from a template.\\n`,\n )\n return EXIT_OK\n }\n\n process.stdout.write(\n `${keyValue([\n { label: \"skills\", value: String(skills.length) },\n { label: \"per turn\", value: `at most ${catalogue.maxActive}` },\n { label: \"threshold\", value: catalogue.threshold.toFixed(2) },\n { label: \"index\", value: catalogue.cached ? \"cached\" : \"scanned\" },\n ])}\\n`,\n )\n\n process.stdout.write(`${section(\"catalogue\")}\\n`)\n for (const skill of skills) {\n const scripts = skill.scripts.length === 0 ? \"\" : ` ${skill.scripts.length} script(s)`\n // A missing negative guidance is flagged even in `list`, because it is the one thing that is\n // both cheap to fix and invisible until something routes wrongly.\n const gap = skill.frontmatter.whenNotToUse === undefined ? \" no when-not-to-use\" : \"\"\n // Where it came from, on the line that lists it. The origins file is hidden by a leading dot to\n // stay out of the way; that must not make it hidden *information*.\n const origin = origins[skill.name]\n const from = origin === undefined ? \"\" : ` ${origin.source}@${origin.commit}`\n process.stdout.write(\n ` ${skill.name.padEnd(20)} ${String(skill.tokens).padStart(5)} tokens${scripts}${from}${gap}\\n`,\n )\n }\n return EXIT_OK\n}\n\nfunction show(skills: readonly Skill[], options: SkillsOptions): number {\n const wanted = options.name\n if (wanted === undefined) {\n process.stdout.write(\"skills show needs a skill name — `skills list` names them\\n\")\n return EXIT_FAILURE\n }\n const skill = skills.find((entry) => entry.name === wanted)\n if (skill === undefined) {\n const known = skills.map((entry) => entry.name).join(\", \")\n process.stdout.write(`no skill named ${wanted}${known === \"\" ? \"\" : `. Known: ${known}`}\\n`)\n return EXIT_FAILURE\n }\n\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify({ ok: true, skill: detail(skill) }, null, 2)}\\n`)\n return EXIT_OK\n }\n\n const { frontmatter } = skill\n process.stdout.write(\n `${keyValue([\n { label: \"name\", value: skill.name },\n { label: \"directory\", value: skill.dir },\n { label: \"body\", value: `${skill.tokens} tokens` },\n ...(frontmatter.license === undefined\n ? []\n : [{ label: \"license\", value: frontmatter.license }]),\n ...(frontmatter.compatibility === undefined\n ? []\n : [{ label: \"needs\", value: frontmatter.compatibility }]),\n ])}\\n`,\n )\n\n process.stdout.write(`${section(\"description\")}\\n`)\n process.stdout.write(`${indent(frontmatter.description)}\\n`)\n\n process.stdout.write(`${section(\"when not to use\")}\\n`)\n process.stdout.write(\n `${indent(\n frontmatter.whenNotToUse ??\n `not declared — add metadata.${whenNotToUseKey()} to improve routing`,\n )}\\n`,\n )\n\n if (skill.scripts.length > 0) {\n process.stdout.write(`${section(\"scripts\")}\\n`)\n for (const plan of skill.scripts) {\n process.stdout.write(\n `${bullet(`${plan.slug} — scripts/${plan.file} via ${plan.interpreter ?? \"its own shebang\"}`)}\\n`,\n )\n }\n }\n\n if (skill.ignoredScripts.length > 0) {\n process.stdout.write(`${section(\"in scripts/ and not runnable\")}\\n`)\n for (const ignored of skill.ignoredScripts) {\n process.stdout.write(`${bullet(`${ignored.file} — ${ignored.reason}`)}\\n`)\n }\n }\n\n if (frontmatter.allowedTools !== undefined) {\n process.stdout.write(`${section(\"allowed-tools, declared and not honoured\")}\\n`)\n // Printed rather than ignored, and labelled rather than merely printed. A downloaded folder does\n // not widen what this agent may run — that is `tools.policy`, and only a person edits it.\n process.stdout.write(`${indent(frontmatter.allowedTools)}\\n`)\n process.stdout.write(\n `${indent(\"this runtime reads the field and never acts on it; permissions live in tools.policy\")}\\n`,\n )\n }\n\n const extra = Object.entries(frontmatter.metadata).filter(([key]) => key !== whenNotToUseKey())\n if (extra.length > 0) {\n process.stdout.write(`${section(\"metadata\")}\\n`)\n process.stdout.write(`${keyValue(extra.map(([label, value]) => ({ label, value })))}\\n`)\n }\n\n return EXIT_OK\n}\n\nfunction validate(skills: readonly Skill[], options: SkillsOptions): number {\n const findings = checkSkillAuthoring(skills)\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n { ok: findings.length === 0, skills: skills.map(summarise), findings },\n null,\n 2,\n )}\\n`,\n )\n return options.strict === true && findings.length > 0 ? EXIT_FAILURE : EXIT_OK\n }\n\n // Every skill is named whether or not it has findings, so a clean one is visibly checked rather\n // than merely absent from a list of problems.\n const byName = new Map<string, ErrorDetail[]>()\n for (const finding of findings) {\n const name = skills.find((skill) => finding.message.includes(` ${skill.name}:`))?.name\n const key = name ?? \"\"\n byName.set(key, [...(byName.get(key) ?? []), finding])\n }\n\n for (const skill of skills) {\n const own = byName.get(skill.name) ?? []\n process.stdout.write(\n ` ${skill.name.padEnd(20)} ${own.length === 0 ? \"ok\" : `${own.length} warning(s)`}\\n`,\n )\n }\n\n if (findings.length === 0) {\n process.stdout.write(\"\\nno findings\\n\")\n return EXIT_OK\n }\n\n for (const finding of findings) {\n process.stdout.write(`\\n ${finding.code}: ${finding.message}\\n`)\n process.stdout.write(` hint: ${finding.hint}\\n`)\n }\n process.stdout.write(\n `\\n${findings.length} finding(s) — warnings, not failures. --strict exits non-zero.\\n`,\n )\n return options.strict === true ? EXIT_FAILURE : EXIT_OK\n}\n\nfunction summarise(skill: Skill) {\n return {\n name: skill.name,\n tokens: skill.tokens,\n hasWhenNotToUse: skill.frontmatter.whenNotToUse !== undefined,\n scripts: skill.scripts.map((plan) => plan.slug),\n ignoredScripts: skill.ignoredScripts,\n }\n}\n\nfunction detail(skill: Skill) {\n return {\n ...summarise(skill),\n dir: skill.dir,\n description: skill.frontmatter.description,\n ...(skill.frontmatter.whenNotToUse === undefined\n ? {}\n : { whenNotToUse: skill.frontmatter.whenNotToUse }),\n ...(skill.frontmatter.license === undefined ? {} : { license: skill.frontmatter.license }),\n ...(skill.frontmatter.compatibility === undefined\n ? {}\n : { compatibility: skill.frontmatter.compatibility }),\n ...(skill.frontmatter.allowedTools === undefined\n ? {}\n : { allowedToolsDeclaredNotHonoured: skill.frontmatter.allowedTools }),\n metadata: skill.frontmatter.metadata,\n }\n}\n\n// ─── writing ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Turn skills on for an agent that has not got them, and return the resolved config.\n *\n * Both halves or neither: `skills.dir` naming a directory that does not exist is a **load failure**, so\n * writing the block without creating the directory would leave an agent that refuses to start. That is\n * the reason this is a command rather than a `config_set` path — the agent cannot be trusted to do two\n * things atomically, and it is exactly the shape that made `config_set` report a pending `tokenEnv`.\n *\n * The manifest goes through `editManifest`, the one writer every surface uses. It used to place the\n * block itself and write it unvalidated, on the reasoning that \"the next load\" would catch a bad\n * result — which is the failure that validation exists to prevent, because the next load is a person's\n * agent refusing to start after this command reported success. The block is a fixed known-good shape,\n * so nothing was ever actually broken; the *guarantee* differed by which caller you happened to be.\n *\n * The uncommenting this used to do itself is `uncommentInSource` now, reached automatically for a\n * top-level path: `setInSource` appends to a parent and `skills` has none, so it declines, and the\n * generated manifest ships the line commented under its own heading. Generalising it was worth doing —\n * `channels` needed exactly the same thing, and writing it for the first time had been reflowing 98\n * lines of somebody's manifest.\n */\nfunction enable(\n manifestPath: string,\n agentDir: string,\n existing: SkillsConfig | undefined,\n): SkillsConfig | undefined {\n const dir = existing?.dir ?? \"./skills\"\n const absolute = isAbsolute(dir) ? dir : resolve(agentDir, dir)\n mkdirSync(absolute, { recursive: true })\n\n if (existing !== undefined) return existing\n\n const written = editManifestSync({ file: manifestPath, path: [\"skills\"], value: block(dir) })\n process.stdout.write(`${keyValue([{ label: \"enabled\", value: `skills.dir = ${dir}` }])}\\n`)\n if (written.reflowed) {\n // Said rather than swallowed. A manifest with no commented `# skills:` line to uncomment — a\n // hand-written one — goes through the round-trip, which is valid and moves comments, and\n // finding that in a later `git diff` with nothing having mentioned it is the worse outcome.\n process.stdout.write(\n `${bullet(\"the file was re-serialised to add the block — it is valid, and comments may have moved\")}\\n`,\n )\n }\n // Validated before it was written, so this is a resolved config rather than an assumption.\n return { dir, ...DEFAULTS }\n}\n\n/** Written once, so what is stored and what is printed cannot disagree. */\nconst DEFAULTS = { maxActive: 1, threshold: 0.35 } as const\n\nfunction block(dir: string): Record<string, unknown> {\n return { dir, ...DEFAULTS }\n}\n\nfunction create(dir: string, options: SkillsOptions): number {\n const name = options.name\n if (name === undefined) {\n process.stdout.write(\"skills new needs a name — `skills new <manifest> <name>`\\n\")\n return EXIT_FAILURE\n }\n if (!isSkillName(name)) {\n // The spec's own rule, checked here so a scaffold the loader would refuse is never written.\n process.stdout.write(\n `${name} is not a legal skill name: lowercase letters, digits and single hyphens, never leading, trailing or doubled, at most 64 characters.\\n`,\n )\n return EXIT_FAILURE\n }\n\n const target = join(dir, name)\n if (existsSync(target)) {\n process.stdout.write(`${target} already exists — nothing was written\\n`)\n return EXIT_FAILURE\n }\n\n mkdirSync(target, { recursive: true })\n writeFileSync(\n join(target, \"SKILL.md\"),\n fillTemplate(SKILL_TEMPLATE, {\n SKILL_NAME: name,\n WHEN_NOT_TO_USE_KEY: whenNotToUseKey(),\n }),\n \"utf8\",\n )\n\n process.stdout.write(\n `${keyValue([\n { label: \"created\", value: join(target, \"SKILL.md\") },\n { label: \"name\", value: name },\n ])}\\n`,\n )\n process.stdout.write(\n `${section(\"next\")}\\n` +\n `${bullet(\"edit the description — it is the only thing selection reads, so name the words someone would actually type\")}\\n` +\n `${bullet(\"write the steps in place of the placeholder body\")}\\n` +\n `${bullet(`skills validate — it warns until the scaffold is replaced`)}\\n` +\n `${bullet(\"restart the agent: the catalogue is scanned once at boot\")}\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * Copy a skill, or a directory of skills, into this agent.\n *\n * A **local path only**, and that is a decision rather than an unfinished feature. A skill may ship\n * executable scripts, so installing one from a URL is running someone else's code on this machine — a\n * thing that deserves its own decision about provenance and trust, not a flag added beside a copy\n * command. `git clone` or `gh repo clone` first, then install from the path; the network stays out of a\n * command whose job is to move files.\n *\n * Modes are preserved, because an executable bit is what makes a script runnable at all.\n */\nfunction install(dir: string, options: SkillsOptions): number {\n const from = options.name\n if (from === undefined) {\n process.stdout.write(\n \"skills install needs something to install — `skills install <manifest> anthropic/pdf`, or a local path\\n\\n `sources search <what you need>` finds one.\\n\",\n )\n return EXIT_FAILURE\n }\n\n // Filesystem-first, which is git's pathspec rule and the one `resolveAgentRef` already follows: a\n // name shadowed by a directory in the cwd resolves to the directory, with a note, rather than\n // silently installing something else.\n const asPath = looksLikePath(from)\n let origin: Located | undefined\n if (!asPath) {\n const located = locate(from, options.sandboxEnv)\n if (located === undefined) return EXIT_FAILURE\n origin = located\n }\n\n const source = origin === undefined ? resolve(from) : origin.entry.dir\n if (origin === undefined) {\n if (!existsSync(source) || !statSync(source).isDirectory()) {\n process.stdout.write(`${source} is not a directory\\n`)\n return EXIT_FAILURE\n }\n if (\n existsSync(from) &&\n loadSources(options.sandboxEnv).some((spec) => spec.name === from)\n ) {\n process.stdout.write(\n `note: ${from} is also a source, and a directory of that name here wins — \\`sources search\\` to install from the source instead\\n\\n`,\n )\n }\n }\n\n const origins: Record<string, Origin> = {}\n const runnable: string[] = []\n\n // One skill, or a folder holding several. Detected rather than flagged: `skills/` from a cloned\n // repository and a single `pdf/` are both obvious to look at, and asking which would be a question\n // the filesystem has already answered.\n const single = existsSync(join(source, SKILL_FILE))\n const candidates = single\n ? [source]\n : readdirSync(source, { withFileTypes: true })\n .filter(\n (entry) =>\n entry.isDirectory() && existsSync(join(source, entry.name, SKILL_FILE)),\n )\n .map((entry) => join(source, entry.name))\n\n if (candidates.length === 0) {\n process.stdout.write(\n `no ${SKILL_FILE} in ${source} or in any directory directly inside it\\n`,\n )\n return EXIT_FAILURE\n }\n\n const installed: string[] = []\n const skipped: string[] = []\n for (const candidate of candidates) {\n // The destination is the skill's declared `name`, not the source folder's — the spec requires\n // them to match, so a mismatched source is a skill that would fail to load wherever it landed.\n let name: string\n try {\n const parsed = parseSkillFile(\n basename(candidate),\n readFileSync(join(candidate, SKILL_FILE), \"utf8\"),\n )\n name = parsed.frontmatter.name\n } catch (error) {\n skipped.push(\n `${basename(candidate)} — ${error instanceof Error ? error.message : String(error)}`,\n )\n continue\n }\n const target = join(dir, name)\n if (existsSync(target)) {\n skipped.push(`${name} — already installed at ${target}`)\n continue\n }\n // No size check. There was one, against `skills.budget`, and it is what turned a person ticking\n // eleven skills into \"9 of 11 installed\" — refusing `pptx` at 5,441 tokens and `skill-creator` at\n // 9,065 against a default of 5,000 they never chose. The budget is gone (decision 11.59): the\n // catalogue prints every body's size on the row where the choice is made, and a large skill that\n // somebody picked on purpose is not a configuration error.\n cpSync(candidate, target, { recursive: true, preserveTimestamps: true })\n installed.push(name)\n if (origin !== undefined) {\n origins[name] = {\n source: origin.spec.name,\n url: origin.spec.url,\n repoPath: origin.entry.repoPath,\n commit: origin.commit,\n ...(origin.spec.ref === undefined ? {} : { ref: origin.spec.ref }),\n installedAt: new Date().toISOString(),\n }\n }\n // Named, not counted. This is the only moment somebody can decide to go and read code they are\n // about to give an agent, and \"3 runnable files\" does not tell them which files.\n runnable.push(...scriptFiles(target).map((file) => `${name}/${relative(target, file)}`))\n }\n\n if (Object.keys(origins).length > 0) recordOrigins(dir, origins)\n\n if (options.collect !== undefined) {\n for (const name of installed) {\n options.collect.push({\n name,\n ok: true,\n runnable: runnable.filter((file) => file.startsWith(`${name}/`)),\n })\n }\n for (const entry of skipped) {\n const cut = entry.indexOf(\" — \")\n options.collect.push({\n name: cut === -1 ? entry : entry.slice(0, cut),\n ok: false,\n reason: cut === -1 ? entry : entry.slice(cut + 3),\n runnable: [],\n })\n }\n }\n if (options.quiet === true) return installed.length === 0 ? EXIT_FAILURE : EXIT_OK\n\n process.stdout.write(\n `${keyValue([\n {\n label: \"from\",\n value:\n origin === undefined\n ? source\n : `${origin.spec.name} (${origin.spec.url}) at ${origin.commit}`,\n },\n { label: \"installed\", value: installed.join(\", \") },\n { label: \"skipped\", value: skipped.length === 0 ? \"\" : String(skipped.length) },\n ])}\\n`,\n )\n for (const entry of skipped) process.stdout.write(`${bullet(entry)}\\n`)\n if (runnable.length > 0) {\n // Disclosure rather than a prompt. Nothing runs at install time — a skill script becomes a tool\n // only once the skill activates, and it arrives `untrusted` and `mutating`, so the write gate and\n // `tools.policy` both still apply. A confirmation dialog on every install would be answered\n // reflexively within a week and would buy none of that.\n process.stdout.write(\n `${section(\"this installed code, which the agent can run\")}\\n${runnable\n .slice(0, 12)\n .map((file) => bullet(file))\n .join(\"\\n\")}\\n`,\n )\n if (runnable.length > 12) {\n process.stdout.write(`${indent(`… and ${runnable.length - 12} more`)}\\n`)\n }\n process.stdout.write(\n `${indent(\"read them before the agent does; `tools.policy` can name a skill script by slug\")}\\n`,\n )\n }\n if (installed.length > 0) {\n process.stdout.write(\n `${section(\"next\")}\\n${bullet(\"skills validate — a vendored skill usually has no negative guidance, which is a warning and not a problem\")}\\n${bullet(\"restart the agent: the catalogue is scanned once at boot\")}\\n`,\n )\n }\n return installed.length === 0 ? EXIT_FAILURE : EXIT_OK\n}\n\n/**\n * Turn `pdf` or `anthropic/pdf` into a folder in the source cache.\n *\n * Ambiguity is refused rather than resolved by source order: with two sources carrying a `pdf`, picking\n * the first would install one and report a name that describes both, and the person would find out which\n * they got by reading the file. Naming the candidates costs one retyped command and cannot be wrong.\n */\nfunction locate(\n ref: string,\n env?: Readonly<Record<string, string | undefined>>,\n): Located | undefined {\n let parsed: SkillRef\n try {\n parsed = parseSkillRef(ref)\n } catch (error) {\n if (!(error instanceof HarnessError)) throw error\n process.stdout.write(`${error.message}\\n\\n ${error.hint}\\n`)\n return undefined\n }\n\n const sources = loadSources(env)\n const named =\n parsed.source === undefined\n ? sources\n : sources.filter((spec) => spec.name === parsed.source)\n if (named.length === 0) {\n const suggestion = nearest(\n parsed.source ?? \"\",\n sources.map((spec) => spec.name),\n )\n process.stdout.write(\n `no source called ${parsed.source}\\n\\n ${suggestion === undefined ? \"`sources list` shows them.\" : `Did you mean ${suggestion}?`}\\n`,\n )\n return undefined\n }\n\n const cold = named.filter((spec) => !isCached(spec.name, env))\n if (cold.length === named.length) {\n // The distinction that matters: an empty cache is not a mistyped name, and only this layer knows\n // which. Reporting \"no skill called pdf\" against a cache that has never been fetched blames the\n // person for the tool's state — the same failure `explainUnresolved` exists to prevent.\n process.stdout.write(\n `${named.length === 1 ? `${named[0]?.name} has not` : \"no source has\"} been fetched yet, so there is nothing to install from\\n\\n \\`sources update${parsed.source === undefined ? \"\" : ` ${parsed.source}`}\\` first, or \\`sources search ${parsed.skill}\\` which fetches on demand.\\n`,\n )\n return undefined\n }\n\n const entries = named\n .filter((spec) => isCached(spec.name, env))\n .flatMap((spec) => readCatalogue(spec, env).map((entry) => ({ entry, spec })))\n const matches = entries.filter((row) => row.entry.skill === parsed.skill)\n\n if (matches.length === 0) {\n const suggestion = nearest(\n parsed.skill,\n entries.map((row) => row.entry.skill),\n )\n process.stdout.write(\n `no skill called ${parsed.skill} in ${named.map((spec) => spec.name).join(\", \")}\\n\\n ${\n suggestion === undefined\n ? `\\`sources search ${parsed.skill}\\` ranks what is there.`\n : `Did you mean ${suggestion}? \\`sources search ${parsed.skill}\\` ranks the alternatives.`\n }\\n`,\n )\n return undefined\n }\n if (matches.length > 1) {\n process.stdout.write(\n `${matches.length} sources carry a skill called ${parsed.skill}\\n\\n${matches\n .map((row) => ` ${row.spec.name}/${row.entry.skill} — ${row.spec.url}\\n`)\n .join(\"\")}\\n Name one.\\n`,\n )\n return undefined\n }\n\n const only = matches[0] as { entry: CatalogueEntry; spec: SourceSpec }\n if (only.entry.problem !== undefined) {\n process.stdout.write(\n `${only.spec.name}/${only.entry.skill} will not load: ${only.entry.problem}\\n\\n Nothing was copied. That is upstream's to fix — installing a hand-edited copy from a path is the way round it.\\n`,\n )\n return undefined\n }\n return {\n entry: only.entry,\n spec: only.spec,\n commit: readMeta(only.spec.name, env).commit ?? \"unknown\",\n }\n}\n\n/** Files under an installed skill that would run. Same over-reporting rule as the catalogue's. */\nfunction scriptFiles(dir: string, depth = 0): string[] {\n if (depth > 3) return []\n const found: string[] = []\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name)\n if (entry.isDirectory()) {\n if (entry.name.startsWith(\".\")) continue\n found.push(...scriptFiles(full, depth + 1))\n continue\n }\n if (!entry.isFile()) continue\n const executable = (statSync(full).mode & 0o111) !== 0\n if (executable || SCRIPT_EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {\n found.push(full)\n }\n }\n return found\n}\n\nconst SCRIPT_EXTENSIONS = [\".py\", \".sh\", \".js\", \".ts\", \".mjs\", \".rb\", \".pl\"]\n\n/**\n * Deletes files, and says what it removed rather than only that it did.\n *\n * Reads the directory rather than the catalogue on purpose — see the ordering note at the call site. A\n * skill that breaks the load is precisely the skill someone needs to remove.\n */\nfunction remove(dir: string, options: SkillsOptions): number {\n const name = options.name\n if (name === undefined) {\n process.stdout.write(\"skills remove needs a name — `skills list` names them\\n\")\n return EXIT_FAILURE\n }\n const target = join(dir, name)\n if (!existsSync(join(target, SKILL_FILE))) {\n const known = existsSync(dir)\n ? readdirSync(dir, { withFileTypes: true })\n .filter(\n (entry) =>\n entry.isDirectory() && existsSync(join(dir, entry.name, SKILL_FILE)),\n )\n .map((entry) => entry.name)\n .join(\", \")\n : \"\"\n process.stdout.write(`no skill named ${name}${known === \"\" ? \"\" : `. Known: ${known}`}\\n`)\n return EXIT_FAILURE\n }\n\n // Counted before the delete, so the report is about what was actually there rather than a guess.\n const files = countFiles(target)\n const origin = readOrigins(dir)[name]\n rmSync(target, { recursive: true, force: true })\n // The claim goes with the directory. A record saying `pdf` came from a commit, pointing at a folder\n // that is gone, is worse than no record: the next `install` of the same name would look like a\n // re-install of exactly that commit.\n forgetOrigin(dir, name)\n process.stdout.write(\n `${keyValue([\n { label: \"removed\", value: target },\n { label: \"files\", value: String(files) },\n ...(origin === undefined\n ? []\n : [\n {\n label: \"came from\",\n value: `${origin.source} (${origin.url}) at ${origin.commit}`,\n },\n ]),\n ])}\\n`,\n )\n process.stdout.write(`${bullet(\"restart the agent: the catalogue is scanned once at boot\")}\\n`)\n return EXIT_OK\n}\n\nfunction countFiles(dir: string): number {\n let total = 0\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n total += entry.isDirectory() ? countFiles(join(dir, entry.name)) : 1\n }\n return total\n}\n",
6
- "/**\n * Where an installed skill came from, recorded beside the skills rather than inside them.\n *\n * ## Why not in the skill's own frontmatter\n *\n * `metadata` is the spec's extension point and would accept it, and writing there would still be the\n * wrong move: decision 6.1's compliance claim is checked by vendoring a skill from `anthropics/skills`\n * **unmodified**, and a copy this tool has edited is no longer that. Provenance is a fact about the\n * copy, not about the skill.\n *\n * ## Why not in the agent's state directory\n *\n * `<agentDir>/<stateDir>/` is a cache — `skills.idx.json` lives there and is safe to delete. This is\n * not cache: it is the answer to \"where did this folder of somebody else's code come from\", which is\n * worth committing alongside the skills it describes. So it sits at `<skills dir>/.origins.json`, one\n * file for the whole directory rather than one per skill, and the loader never sees it because\n * `loadSkills` scans `<dir>/*​/SKILL.md` and a file is not a directory.\n *\n * Hidden by a leading dot to keep it out of the way, and surfaced by `skills list` so it is not hidden\n * *information* — a distinction this codebase has already had to make once, for boot warnings emitted\n * into an empty room.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { join } from \"node:path\"\n\nexport const ORIGINS_FILE = \".origins.json\"\n\nexport interface Origin {\n /** The source's nickname at the time of installing. */\n readonly source: string\n readonly url: string\n /** Path inside the repository — what to read to see the upstream copy. */\n readonly repoPath: string\n /** Short commit the copy was taken from. What makes \"has upstream changed?\" answerable. */\n readonly commit: string\n readonly ref?: string\n readonly installedAt: string\n}\n\ninterface OriginsFile {\n readonly version?: number\n readonly origins?: Readonly<Record<string, Origin>>\n}\n\nconst VERSION = 1\n\nexport function originsPath(skillsDir: string): string {\n return join(skillsDir, ORIGINS_FILE)\n}\n\nexport function readOrigins(skillsDir: string): Readonly<Record<string, Origin>> {\n const path = originsPath(skillsDir)\n if (!existsSync(path)) return {}\n try {\n const parsed = JSON.parse(readFileSync(path, \"utf8\")) as OriginsFile\n return parsed.origins ?? {}\n } catch {\n // A record of where things came from is not worth failing a listing over, and the next install\n // rewrites it. Silent here and only here: nothing downstream depends on it being present.\n return {}\n }\n}\n\nexport function recordOrigins(skillsDir: string, added: Readonly<Record<string, Origin>>): void {\n const merged = { ...readOrigins(skillsDir), ...added }\n writeFileSync(\n originsPath(skillsDir),\n `${JSON.stringify({ version: VERSION, origins: merged }, null, 4)}\\n`,\n )\n}\n\n/** Called by `remove`, so a deleted skill does not leave a claim about a directory that is gone. */\nexport function forgetOrigin(skillsDir: string, name: string): void {\n const origins = readOrigins(skillsDir)\n if (origins[name] === undefined) return\n const kept = Object.fromEntries(Object.entries(origins).filter(([skill]) => skill !== name))\n writeFileSync(\n originsPath(skillsDir),\n `${JSON.stringify({ version: VERSION, origins: kept }, null, 4)}\\n`,\n )\n}\n",
7
- "// src/index.ts\nimport { ConfigError } from \"@dispach/core\";\n\n// src/api.ts\nclass TelegramApiError extends Error {\n status;\n retryable;\n retryAfterMs;\n detail;\n constructor(init) {\n super(init.message);\n this.name = \"TelegramApiError\";\n this.status = init.status;\n this.retryable = init.retryable;\n this.retryAfterMs = init.retryAfterMs;\n this.detail = init.detail;\n }\n}\nvar DEFAULT_BASE = \"https://api.telegram.org\";\n\nclass TelegramApi {\n #token;\n #fetch;\n #base;\n constructor(options) {\n this.#token = options.token;\n this.#fetch = options.fetch ?? ((input, init) => fetch(input, init));\n this.#base = (options.baseUrl ?? DEFAULT_BASE).replace(/\\/+$/, \"\");\n }\n async call(method, body, signal) {\n let response;\n try {\n response = await this.#fetch(`${this.#base}/bot${this.#token}/${method}`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(body ?? {}),\n ...signal === undefined ? {} : { signal }\n });\n } catch (cause) {\n throw new TelegramApiError({\n message: `Telegram ${method} did not complete: ${cause instanceof Error ? cause.message : String(cause)}`,\n status: 0,\n retryable: true,\n detail: {\n code: \"telegram_unreachable\",\n message: `Could not reach the Telegram Bot API for ${method}.`,\n hint: \"Check network access from this host. api.telegram.org is blocked in some networks and from some cloud regions; a webhook deployment behind a proxy still needs outbound access for sendMessage.\"\n }\n });\n }\n const payload = await response.json().catch(() => ({}));\n if (response.ok && payload.ok && payload.result !== undefined)\n return payload.result;\n throw classify(method, response.status, payload);\n }\n getMe(signal) {\n return this.call(\"getMe\", {}, signal);\n }\n getUpdates(input, signal) {\n return this.call(\"getUpdates\", {\n offset: input.offset,\n timeout: input.timeout,\n limit: input.limit ?? 100,\n allowed_updates: [\"message\"]\n }, signal);\n }\n sendMessage(input, signal) {\n return this.call(\"sendMessage\", {\n chat_id: input.chatId,\n text: input.text,\n ...input.threadId === undefined ? {} : { message_thread_id: input.threadId }\n }, signal);\n }\n sendChatAction(input) {\n return this.call(\"sendChatAction\", {\n chat_id: input.chatId,\n action: \"typing\",\n ...input.threadId === undefined ? {} : { message_thread_id: input.threadId }\n });\n }\n setWebhook(input, signal) {\n return this.call(\"setWebhook\", {\n url: input.url,\n allowed_updates: [\"message\"],\n ...input.secretToken === undefined ? {} : { secret_token: input.secretToken },\n ...input.dropPending === undefined ? {} : { drop_pending_updates: input.dropPending }\n }, signal);\n }\n deleteWebhook(signal) {\n return this.call(\"deleteWebhook\", {}, signal);\n }\n}\nfunction classify(method, status, payload) {\n const description = payload.description ?? `HTTP ${status}`;\n const code = payload.error_code ?? status;\n const retryAfter = payload.parameters?.retry_after;\n if (code === 429) {\n return new TelegramApiError({\n message: `Telegram rate-limited ${method}: ${description}`,\n status: code,\n retryable: true,\n ...retryAfter === undefined ? {} : { retryAfterMs: retryAfter * 1000 },\n detail: {\n code: \"telegram_rate_limited\",\n message: `Telegram rate-limited ${method}.`,\n hint: retryAfter === undefined ? \"The outbox will back off and retry. Sustained rate limiting on one chat usually means replies are being split into many chunks — check the reply length.\" : `Telegram asked for ${retryAfter}s. The outbox honours that verbatim rather than applying its own backoff.`\n }\n });\n }\n if (code === 401) {\n return new TelegramApiError({\n message: `Telegram rejected the bot token on ${method}: ${description}`,\n status: code,\n retryable: false,\n detail: {\n code: \"telegram_unauthorized\",\n message: \"The Telegram bot token was rejected.\",\n hint: \"Check the variable named by the channel's tokenEnv. A token is revoked whenever /revoke is sent to @BotFather, and a regenerated token invalidates the old one immediately.\"\n }\n });\n }\n if (code === 409) {\n return new TelegramApiError({\n message: `Telegram reports a conflicting ${method}: ${description}`,\n status: code,\n retryable: true,\n detail: {\n code: \"telegram_conflict\",\n message: \"Another instance of this bot is already receiving updates.\",\n hint: \"Telegram allows one getUpdates consumer per bot token. Stop the other process — another terminal, a container that did not exit — or, if a webhook was registered earlier, this channel's own start clears it. Retried, so it recovers on its own once the other side stops.\"\n }\n });\n }\n if (code === 400 && /too long/i.test(description)) {\n return new TelegramApiError({\n message: `Telegram refused ${method}: ${description}`,\n status: code,\n retryable: false,\n detail: {\n code: \"telegram_message_too_long\",\n message: \"A chunk exceeded Telegram's message limit.\",\n hint: \"This is a chunking bug, not a configuration problem: the transport declares maxMessageChars and core splits to it. Report the reply length — the splitter reserves room for a code-fence reopen, so the effective limit is slightly under 4096.\"\n }\n });\n }\n const permanent = code === 400 || code === 403;\n return new TelegramApiError({\n message: `Telegram refused ${method}: ${description}`,\n status: code,\n retryable: !permanent,\n detail: {\n code: permanent ? \"telegram_refused\" : \"telegram_error\",\n message: `Telegram refused ${method}: ${description}`,\n hint: permanent ? \"Telegram reports this as a client error, so it is not retried. The usual causes are a chat the bot was removed from, a user who blocked it, or a chat id from a different bot — a chat id is not portable between bots.\" : \"Treated as transient and retried with backoff. A 5xx from Telegram is usually brief.\"\n }\n });\n}\n\n// src/transport.ts\nvar MAX_MESSAGE_CHARS = 4096;\nvar POLL_TIMEOUT_S = 30;\nvar POLL_BACKOFF_MS = [1000, 2000, 5000, 15000, 30000];\nvar MIN_SEND_INTERVAL_MS = 350;\n\nclass TelegramTransport {\n id;\n type = \"telegram\";\n limits = {\n maxMessageChars: MAX_MESSAGE_CHARS,\n idempotentSend: false,\n minSendIntervalMs: MIN_SEND_INTERVAL_MS\n };\n #api;\n #mode;\n #webhookUrl;\n #secretToken;\n #host;\n #offset = 0;\n #running = false;\n #abort;\n #loop;\n constructor(options) {\n this.id = options.id;\n this.#api = options.api ?? new TelegramApi({ token: options.token });\n this.#mode = options.mode;\n this.#webhookUrl = options.webhookUrl;\n this.#secretToken = options.secretToken;\n }\n async start(host) {\n if (this.#running)\n return;\n this.#running = true;\n this.#host = host;\n this.#abort = new AbortController;\n if (this.#mode === \"webhook\") {\n const url = this.#webhookUrl;\n if (url === undefined || url === \"\") {\n host.status(\"error\", \"no webhookUrl\");\n host.error({\n code: \"telegram_webhook_url_missing\",\n message: `Channel \"${this.id}\" is in webhook mode but declares no webhookUrl.`,\n hint: \"Set webhookUrl to the public HTTPS address this runtime is reachable at, ending in /v1/channels/<channelId>/webhook/<agentId>. Telegram will not deliver to plain HTTP, and a missing registration looks identical to a bot nobody is messaging.\",\n field: `channels[${this.id}].webhookUrl`\n });\n return;\n }\n try {\n await this.#api.setWebhook({\n url,\n ...this.#secretToken === undefined ? {} : { secretToken: this.#secretToken }\n });\n host.status(\"connected\", `webhook at ${url}`);\n } catch (cause) {\n host.status(\"error\", cause instanceof Error ? cause.message : String(cause));\n host.error(detailOf(cause, `registering the webhook for channel \"${this.id}\"`));\n }\n return;\n }\n this.#loop = this.#poll(host, this.#abort.signal);\n }\n async stop() {\n if (!this.#running)\n return;\n this.#running = false;\n this.#abort?.abort();\n await this.#loop?.catch(() => {});\n this.#loop = undefined;\n this.#host?.status(\"disconnected\");\n this.#host = undefined;\n }\n async send(message, signal) {\n const threadId = threadIdOf(message.thread);\n try {\n const sent = await this.#api.sendMessage({\n chatId: message.recipient,\n text: message.text,\n ...threadId === undefined ? {} : { threadId }\n }, signal);\n return { ok: true, providerMessageId: String(sent.message_id) };\n } catch (cause) {\n if (cause instanceof TelegramApiError) {\n return {\n ok: false,\n retryable: cause.retryable,\n error: cause.detail,\n ...cause.retryAfterMs === undefined ? {} : { retryAfterMs: cause.retryAfterMs }\n };\n }\n return {\n ok: false,\n retryable: true,\n error: {\n code: \"telegram_send_failed\",\n message: cause instanceof Error ? cause.message : String(cause),\n hint: \"An unclassified failure from the Telegram transport. Retried, because a failure nobody recognised is not a failure known to be permanent.\"\n }\n };\n }\n }\n async typing(recipient, thread) {\n const threadId = threadIdOf(thread);\n await this.#api.sendChatAction({\n chatId: recipient,\n ...threadId === undefined ? {} : { threadId }\n });\n }\n async webhook(delivery) {\n if (this.#secretToken !== undefined) {\n const presented = delivery.headers[\"x-telegram-bot-api-secret-token\"] ?? \"\";\n if (!timingSafeEqual(presented, this.#secretToken)) {\n return { status: 401, detail: \"bad secret token\" };\n }\n }\n const host = this.#host;\n if (host === undefined)\n return { status: 503, detail: \"channel not started\" };\n const update = delivery.body;\n if (update === undefined || typeof update !== \"object\") {\n return { status: 400, detail: \"not an update\" };\n }\n this.#ingest(host, update);\n return { status: 200 };\n }\n async#poll(host, signal) {\n let failures = 0;\n let announced = false;\n try {\n await this.#api.deleteWebhook(signal);\n } catch {}\n try {\n const me = await this.#api.getMe(signal);\n announced = true;\n host.status(\"connected\", me.username === undefined ? \"long-poll\" : `@${me.username}, long-poll`);\n } catch (cause) {\n if (signal.aborted)\n return;\n host.status(\"error\", cause instanceof Error ? cause.message : String(cause));\n host.error(detailOf(cause, `checking the bot token for channel \"${this.id}\"`));\n }\n while (this.#running && !signal.aborted) {\n try {\n const updates = await this.#api.getUpdates({ offset: this.#offset, timeout: POLL_TIMEOUT_S }, signal);\n if (failures > 0) {\n failures = 0;\n announced = true;\n host.status(\"connected\", \"polling resumed\");\n } else if (!announced) {\n announced = true;\n host.status(\"connected\", \"long-poll\");\n }\n for (const update of updates) {\n this.#offset = Math.max(this.#offset, update.update_id + 1);\n this.#ingest(host, update);\n }\n } catch (cause) {\n if (signal.aborted)\n return;\n const delay = POLL_BACKOFF_MS[Math.min(failures, POLL_BACKOFF_MS.length - 1)] ?? 1000;\n failures += 1;\n if (failures === 1 || failures % 8 === 0) {\n host.status(\"error\", cause instanceof Error ? cause.message : String(cause));\n host.error(detailOf(cause, `polling channel \"${this.id}\"`));\n }\n await sleep(delay, signal);\n }\n }\n }\n #ingest(host, update) {\n const message = update.message;\n if (message === undefined)\n return;\n const text = message.text ?? message.caption ?? \"\";\n if (text.trim() === \"\")\n return;\n if (message.from?.is_bot === true)\n return;\n host.receive(toInbound(message, text));\n }\n}\nfunction toInbound(message, text) {\n const username = message.from?.username;\n const name = [message.from?.first_name, message.from?.last_name].filter(Boolean).join(\" \");\n return {\n providerMessageId: `${message.chat.id}:${message.message_id}`,\n peerId: String(message.chat.id),\n ...username === undefined ? {} : { senderHandle: `@${username}` },\n ...name === \"\" ? {} : { senderName: name },\n ...message.message_thread_id === undefined ? {} : { thread: String(message.message_thread_id) },\n text,\n receivedAt: new Date(message.date * 1000).toISOString()\n };\n}\nfunction threadIdOf(thread) {\n if (thread === undefined)\n return;\n const parsed = Number.parseInt(thread, 10);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\nfunction detailOf(cause, context) {\n if (cause instanceof TelegramApiError)\n return cause.detail;\n return {\n code: \"telegram_channel_error\",\n message: `${context} failed: ${cause instanceof Error ? cause.message : String(cause)}`,\n hint: \"The channel keeps retrying and the rest of the runtime is unaffected. If this repeats, check network access to api.telegram.org and the token named by tokenEnv.\"\n };\n}\nfunction timingSafeEqual(a, b) {\n if (a.length !== b.length)\n return false;\n let diff = 0;\n for (let i = 0;i < a.length; i += 1)\n diff |= a.charCodeAt(i) ^ b.charCodeAt(i);\n return diff === 0;\n}\nfunction sleep(ms, signal) {\n return new Promise((resolve) => {\n const timer = setTimeout(resolve, ms);\n signal.addEventListener(\"abort\", () => {\n clearTimeout(timer);\n resolve();\n }, { once: true });\n });\n}\n\n// src/index.ts\nvar telegramChannel = (context) => {\n const config = context.config;\n const tokenEnv = stringField(config, \"tokenEnv\") ?? \"TELEGRAM_BOT_TOKEN\";\n const token = context.env[tokenEnv];\n if (token === undefined || token === \"\") {\n throw new ConfigError({\n code: \"telegram_token_missing\",\n message: `Channel \"${context.id}\" needs ${tokenEnv}, which is not set.`,\n hint: `Export ${tokenEnv}, or add it to the .env beside the manifest. Get a token from @BotFather with /newbot. This fails at load rather than at the first poll, because an unset variable is a configuration mistake and does not need a network round trip to discover.`,\n field: `channels[${context.id}].tokenEnv`\n });\n }\n const mode = stringField(config, \"mode\") ?? \"longpoll\";\n if (mode !== \"longpoll\" && mode !== \"webhook\") {\n throw new ConfigError({\n code: \"telegram_mode_invalid\",\n message: `Channel \"${context.id}\" declares mode \"${mode}\".`,\n hint: \"mode is longpoll or webhook. Long-poll needs no inbound connectivity and is the right default for a laptop or a private network; webhook needs a public HTTPS URL and is lower latency.\",\n field: `channels[${context.id}].mode`\n });\n }\n const secretEnv = stringField(config, \"secretTokenEnv\");\n const secretToken = secretEnv === undefined ? undefined : context.env[secretEnv];\n if (secretEnv !== undefined && (secretToken === undefined || secretToken === \"\")) {\n throw new ConfigError({\n code: \"telegram_secret_missing\",\n message: `Channel \"${context.id}\" names secretTokenEnv ${secretEnv}, which is not set.`,\n hint: `Export ${secretEnv} with any random string, or remove secretTokenEnv. Naming a variable and leaving it empty would start a webhook that verifies nothing, which is worse than one that never claimed to.`,\n field: `channels[${context.id}].secretTokenEnv`\n });\n }\n const baseUrl = stringField(config, \"apiBaseUrl\");\n const webhookUrl = stringField(config, \"webhookUrl\");\n return new TelegramTransport({\n id: context.id,\n token,\n mode,\n ...webhookUrl === undefined ? {} : { webhookUrl },\n ...secretToken === undefined || secretToken === \"\" ? {} : { secretToken },\n ...baseUrl === undefined ? {} : { api: new TelegramApi({ token, baseUrl }) }\n });\n};\nfunction stringField(config, key) {\n const value = config[key];\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\nvar VERSION = \"0.1.0\";\nvar src_default = {\n name: \"telegram\",\n version: VERSION,\n dispachApi: \"^0.1\",\n permissions: [\n { kind: \"network\", hosts: [\"api.telegram.org\"] },\n { kind: \"env\", vars: [\"TELEGRAM_BOT_TOKEN\"] }\n ],\n setup(context) {\n context.defineChannel(\"telegram\", telegramChannel);\n }\n};\nexport {\n TelegramApi,\n TelegramApiError,\n TelegramTransport,\n VERSION,\n src_default as default,\n telegramChannel,\n toInbound\n};\n\n//# debugId=974D513E4B7FC1CA64756E2164756E21\n//# sourceMappingURL=index.js.map\n",
8
- "// src/provider.ts\nimport {\n ConfigError as ConfigError2\n} from \"@dispach/core\";\n\n// src/cache.ts\nimport { mkdirSync, readFileSync, renameSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { BRAND } from \"@dispach/core\";\nvar CACHE_VERSION = 1;\nvar CACHE_FILE = \"tools.cache.json\";\nfunction cachePath(dir) {\n return isAbsolute(dir) ? join(dir, BRAND.stateDir, CACHE_FILE) : join(resolve(dir), BRAND.stateDir, CACHE_FILE);\n}\nfunction isTool(value) {\n return typeof value === \"object\" && value !== null && typeof value.slug === \"string\";\n}\nfunction readCache(dir) {\n const empty = {\n version: CACHE_VERSION,\n provider: \"composio\",\n fetchedAt: \"\",\n baseUrl: \"\",\n tools: {}\n };\n let raw;\n try {\n raw = readFileSync(cachePath(dir), \"utf8\");\n } catch {\n return empty;\n }\n try {\n const parsed = JSON.parse(raw);\n if (typeof parsed !== \"object\" || parsed === null)\n return empty;\n const file = parsed;\n if (file.version !== CACHE_VERSION)\n return empty;\n const tools = {};\n for (const [slug, tool] of Object.entries(file.tools ?? {})) {\n if (isTool(tool))\n tools[slug] = tool;\n }\n return {\n version: CACHE_VERSION,\n provider: \"composio\",\n fetchedAt: typeof file.fetchedAt === \"string\" ? file.fetchedAt : \"\",\n baseUrl: typeof file.baseUrl === \"string\" ? file.baseUrl : \"\",\n tools\n };\n } catch {\n return empty;\n }\n}\nfunction writeCache(dir, tools, baseUrl, now) {\n const path = cachePath(dir);\n mkdirSync(dirname(path), { recursive: true });\n const file = {\n version: CACHE_VERSION,\n provider: \"composio\",\n fetchedAt: now().toISOString(),\n baseUrl,\n tools\n };\n const temp = `${path}.${process.pid}.tmp`;\n writeFileSync(temp, `${JSON.stringify(file, null, 2)}\n`, \"utf8\");\n renameSync(temp, path);\n return path;\n}\n\n// src/errors.ts\nimport { BRAND as BRAND2, ConfigError, ToolError } from \"@dispach/core\";\nfunction composioKeyMissing(envVar) {\n return new ConfigError({\n code: \"composio_key_missing\",\n message: `The Composio provider needs an API key, and ${envVar} is not set.`,\n hint: `Set ${envVar} in the environment, or in a .env beside the manifest. Change which variable is read with tools.providers.composio.apiKeyEnv — the manifest holds the variable's name, never the key itself.`,\n field: \"tools.providers.composio.apiKeyEnv\"\n });\n}\nfunction composioSchemaUnsupported(slug, path, keyword) {\n return new ConfigError({\n code: \"composio_schema_unsupported\",\n message: `The Composio tool \"${slug}\" declares \"${keyword}\" at ${path}, which this runtime's schema subset cannot express.`,\n hint: \"Refused rather than dropped: that keyword decides which argument documents are valid, so ignoring it would hand the model a schema the endpoint disagrees with. Unpin this tool, or pin a sibling action with a flatter schema. Value constraints such as minimum and format are not affected — those are carried in the field's description.\",\n field: \"tools.pinned\"\n });\n}\nfunction composioCacheMiss(slugs, cachePath) {\n return new ConfigError({\n code: \"composio_cache_miss\",\n message: `${slugs.length === 1 ? \"A pinned Composio tool is\" : `${slugs.length} pinned Composio tools are`} not in the resolution cache: ${slugs.join(\", \")}.`,\n hint: `Boot resolves tools from ${cachePath} and makes no network call, because nothing may touch the network before runtime.ready. Run \\`${BRAND2.slug} tools <manifest> --warm\\` once to populate it, then start again.`,\n field: \"tools.pinned\"\n });\n}\nfunction composioRequestFailed(status, detail) {\n return new ToolError({\n code: \"composio_request_failed\",\n message: `Composio answered ${status}: ${detail}`,\n hint: status === 401 || status === 403 ? \"The API key was rejected. Check the value of the variable named by tools.providers.composio.apiKeyEnv — a key that works in the dashboard can still be scoped to a different project.\" : status === 404 ? \"The tool slug does not exist at this API version. Slugs are case-sensitive and shaped like GMAIL_SEND_EMAIL; check it against the toolkit listing.\" : \"Transient at this status. The runtime retries the refresh after readiness and keeps serving the cached catalogue meanwhile, so an agent already running is unaffected.\"\n });\n}\nfunction composioExecuteFailed(slug, status, detail) {\n return new ToolError({\n code: \"composio_execute_failed\",\n message: `Composio could not run \"${slug}\" (${status}): ${detail}`,\n hint: \"This is the tool's own failure, not a routing one — the arguments reached Composio and it refused them. A value constraint is the usual cause: this runtime carries minimum, format and pattern in the field description for the model to read, but does not enforce them locally, so an out-of-range value arrives here rather than as a repairable field error.\"\n });\n}\nfunction composioNotConnected(slug, toolkit) {\n return new ToolError({\n code: \"composio_not_connected\",\n message: `\"${slug}\" needs a connected ${toolkit} account and none was found.`,\n hint: `Connect ${toolkit} for this user in Composio, then set tools.providers.composio.userId to the same identifier. The tool resolves at load whether or not an account exists, because resolution reads a schema and execution needs the account — so this surfaces on first use rather than at boot.`\n });\n}\nfunction composioSessionKeyMissing(envVar) {\n return new ToolError({\n code: \"composio_session_key_missing\",\n message: `Searching your apps needs a Composio key, and ${envVar} is not set.`,\n hint: `Put the key in the .env beside this agent's manifest as ${envVar}=…, then restart. Get one from the Composio dashboard — the free tier is enough to connect an account and search the catalogue.`\n });\n}\nfunction composioNoMatch(useCase) {\n return new ToolError({\n code: \"composio_no_match\",\n message: `No tool matched \"${useCase}\".`,\n hint: 'Describe the action and its object in plain English — \"send an email\", \"create a calendar event\", \"post a message to a channel\" — rather than naming a product or a tool slug. Composio matches on the use case, not on its own names.'\n });\n}\n\n// src/client.ts\nvar DEFAULT_BASE_URL = \"https://backend.composio.dev/api/v3\";\nfunction routerBase(baseUrl) {\n return /\\/v3$/.test(baseUrl) ? baseUrl.replace(/\\/v3$/, \"/v3.1\") : baseUrl;\n}\nvar PAGE_SIZE = 100;\nfunction asRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) ? value : undefined;\n}\nasync function detailOf(response) {\n let body;\n try {\n body = await response.json();\n } catch {\n return response.statusText === \"\" ? \"no detail in the response body\" : response.statusText;\n }\n const error = asRecord(asRecord(body)?.error);\n const message = typeof error?.message === \"string\" ? error.message : undefined;\n const fix = typeof error?.suggested_fix === \"string\" ? error.suggested_fix : undefined;\n if (message === undefined)\n return response.statusText === \"\" ? \"no detail\" : response.statusText;\n return fix === undefined || fix === \"\" ? message : `${message} — ${fix}`;\n}\n\nclass ComposioClient {\n #apiKey;\n #baseUrl;\n #fetch;\n constructor(options) {\n this.#apiKey = options.apiKey;\n this.#baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.#fetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));\n }\n #request(path, signal) {\n return this.#fetch(`${this.#baseUrl}${path}`, {\n method: \"GET\",\n headers: { \"x-api-key\": this.#apiKey, accept: \"application/json\" },\n ...signal === undefined ? {} : { signal }\n });\n }\n async#get(path, signal) {\n const response = await this.#request(path, signal);\n if (!response.ok)\n throw composioRequestFailed(response.status, await detailOf(response));\n return response.json();\n }\n async tool(slug, signal) {\n const response = await this.#request(`/tools/${encodeURIComponent(slug)}`, signal);\n if (response.status === 404)\n return;\n if (!response.ok)\n throw composioRequestFailed(response.status, await detailOf(response));\n const record = asRecord(await response.json());\n return typeof record?.slug === \"string\" ? record : undefined;\n }\n async slugs(signal) {\n const out = [];\n let cursor;\n for (let page = 0;page < 400; page += 1) {\n const query = new URLSearchParams({ limit: String(PAGE_SIZE) });\n if (cursor !== undefined)\n query.set(\"cursor\", cursor);\n const body = await this.#get(`/tools?${query.toString()}`, signal);\n for (const item of body.items ?? []) {\n if (typeof item.slug === \"string\")\n out.push(item.slug);\n }\n const next = body.next_cursor;\n if (next === null || next === undefined || next === \"\" || next === cursor)\n break;\n cursor = next;\n }\n return out;\n }\n async execute(slug, args, userId, signal) {\n const response = await this.#post(`${this.#baseUrl}/tools/execute/${encodeURIComponent(slug)}`, { user_id: userId, arguments: args }, signal);\n if (!response.ok) {\n throw composioRequestFailed(response.status, await detailOf(response));\n }\n const body = asRecord(await response.json()) ?? {};\n const ok = body.successful !== false;\n const error = typeof body.error === \"string\" && body.error !== \"\" ? body.error : undefined;\n return { ok, data: body.data ?? body, ...error === undefined ? {} : { error } };\n }\n #post(path, body, signal) {\n return this.#fetch(path, {\n method: \"POST\",\n headers: {\n \"x-api-key\": this.#apiKey,\n \"content-type\": \"application/json\",\n accept: \"application/json\"\n },\n body: JSON.stringify(body),\n ...signal === undefined ? {} : { signal }\n });\n }\n async createSession(userId, signal) {\n const response = await this.#post(`${routerBase(this.#baseUrl)}/tool_router/session`, { user_id: userId }, signal);\n if (!response.ok)\n throw composioRequestFailed(response.status, await detailOf(response));\n const body = asRecord(await response.json()) ?? {};\n const id = body.session_id;\n if (typeof id !== \"string\" || id === \"\") {\n throw composioRequestFailed(response.status, \"no session_id in the response body\");\n }\n return body;\n }\n async executeMeta(sessionId, slug, args, signal) {\n const response = await this.#post(`${routerBase(this.#baseUrl)}/tool_router/session/${encodeURIComponent(sessionId)}/execute_meta`, { slug, arguments: args }, signal);\n if (response.status === 404)\n return { notFound: true };\n if (!response.ok)\n throw composioRequestFailed(response.status, await detailOf(response));\n const body = asRecord(await response.json()) ?? {};\n const error = typeof body.error === \"string\" && body.error !== \"\" ? body.error : undefined;\n const ok = body.successful === undefined ? error === undefined : body.successful !== false;\n return { ok, data: body.data ?? body, ...error === undefined ? {} : { error } };\n }\n}\n\n// src/map.ts\nvar STRUCTURAL = [\"anyOf\", \"oneOf\", \"allOf\", \"not\", \"$ref\"];\nvar CONSTRAINTS = [\n \"format\",\n \"minimum\",\n \"maximum\",\n \"exclusiveMinimum\",\n \"exclusiveMaximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"minItems\",\n \"maxItems\"\n];\nvar TYPES = new Set([\"string\", \"number\", \"integer\", \"boolean\", \"array\", \"object\"]);\nfunction asRecord2(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) ? value : undefined;\n}\nfunction constraintText(raw) {\n const parts = [];\n for (const key of CONSTRAINTS) {\n const value = raw[key];\n if (value === undefined || value === null)\n continue;\n if (typeof value === \"object\")\n continue;\n parts.push(`${key} ${String(value)}`);\n }\n return parts.join(\", \");\n}\nfunction describe(raw) {\n const base = typeof raw.description === \"string\" ? raw.description.trim() : \"\";\n const constraints = constraintText(raw);\n if (base === \"\" && constraints === \"\")\n return;\n if (constraints === \"\")\n return base;\n return base === \"\" ? constraints : `${base} (${constraints})`;\n}\nfunction node(raw, slug, path) {\n for (const keyword of STRUCTURAL) {\n if (raw[keyword] !== undefined)\n throw composioSchemaUnsupported(slug, path, keyword);\n }\n const declared = raw.type;\n if (Array.isArray(declared))\n throw composioSchemaUnsupported(slug, path, \"type: []\");\n const type = typeof declared === \"string\" && TYPES.has(declared) ? declared : \"string\";\n const description = describe(raw);\n const enumValues = Array.isArray(raw.enum) ? raw.enum.filter((value) => typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") : undefined;\n const items = type === \"array\" ? asRecord2(raw.items) : undefined;\n const properties = type === \"object\" ? asRecord2(raw.properties) : undefined;\n return {\n type,\n ...description === undefined ? {} : { description },\n ...enumValues === undefined || enumValues.length === 0 ? {} : { enum: enumValues },\n ...items === undefined ? {} : { items: node(items, slug, `${path}[]`) },\n ...properties === undefined ? {} : {\n properties: mapProperties(properties, slug, path),\n required: stringArray(raw.required)\n },\n ...raw.default === undefined || raw.default === null ? {} : { default: raw.default }\n };\n}\nfunction stringArray(value) {\n return Array.isArray(value) ? value.filter((item) => typeof item === \"string\") : [];\n}\nfunction mapProperties(properties, slug, path) {\n const out = {};\n for (const [name, value] of Object.entries(properties)) {\n const raw = asRecord2(value);\n if (raw === undefined)\n continue;\n out[name] = node(raw, slug, path === \"\" ? name : `${path}.${name}`);\n }\n return out;\n}\nfunction mapParameters(tool) {\n const raw = tool.input_parameters;\n if (raw === undefined)\n return { type: \"object\", properties: {} };\n for (const keyword of STRUCTURAL) {\n if (raw[keyword] !== undefined) {\n throw composioSchemaUnsupported(tool.slug, \"input_parameters\", keyword);\n }\n }\n const properties = asRecord2(raw.properties) ?? {};\n const required = stringArray(raw.required);\n const mapped = mapProperties(properties, tool.slug, \"\");\n return {\n type: \"object\",\n properties: mapped,\n ...required.length === 0 ? {} : { required: required.filter((name) => (name in mapped)) }\n };\n}\nfunction isMutating(tool) {\n const tags = new Set(tool.tags ?? []);\n if (tags.has(\"destructiveHint\"))\n return true;\n return !tags.has(\"readOnlyHint\");\n}\nfunction isUnannotated(tool) {\n const tags = new Set(tool.tags ?? []);\n return !tags.has(\"readOnlyHint\") && !tags.has(\"destructiveHint\");\n}\nfunction firstSentence(text) {\n const trimmed = text.replace(/\\s+/g, \" \").trim();\n const stop = trimmed.search(/\\.\\s|\\.$/);\n return stop === -1 ? trimmed : trimmed.slice(0, stop + 1);\n}\nfunction mapTool(tool) {\n const description = (tool.description ?? tool.human_description ?? \"\").trim();\n const summary = description === \"\" ? `The ${tool.slug} tool.` : firstSentence(description);\n const toolkit = tool.toolkit?.slug;\n return {\n slug: tool.slug,\n provider: \"composio\",\n summary,\n whenToUse: description === \"\" ? `the task needs ${tool.slug}` : description,\n mutating: isMutating(tool),\n tags: [\n ...toolkit === undefined ? [] : [toolkit],\n ...isMutating(tool) ? [\"write\"] : [\"read\"]\n ],\n parameters: mapParameters(tool)\n };\n}\n\n// src/meta.ts\nvar MAX_REPORTED = 8;\nvar MAX_SUMMARY = 100;\nvar SEARCH_SLUG = \"composio_search\";\nvar CONNECT_SLUG = \"composio_connect\";\nvar WORKBENCH_SLUG = \"composio_workbench\";\nvar META_SLUGS = [SEARCH_SLUG, CONNECT_SLUG, WORKBENCH_SLUG];\nfunction asRecord3(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) ? value : undefined;\n}\nfunction asArray(value) {\n return Array.isArray(value) ? value : [];\n}\nfunction str(value) {\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\nfunction firstLine(text) {\n const flat = text.replace(/\\s+/g, \" \").trim();\n return flat.length <= MAX_SUMMARY ? flat : `${flat.slice(0, MAX_SUMMARY - 1)}…`;\n}\nvar SEARCH_SPEC = {\n slug: SEARCH_SLUG,\n provider: \"composio\",\n summary: \"Finds tools for connecting to an outside app — email, calendar, chat, issue trackers.\",\n whenToUse: \"the person wants this agent to reach one of their other accounts and no pinned tool does it. \" + \"Describe the action and its object in plain English, like 'send an email' or 'create a \" + \"calendar event' — never a product name alone and never a tool slug. This finds the tools and \" + \"records their definitions; it does not run them and does not enable them.\",\n whenNotToUse: \"a pinned tool already does the job, or the person asked to read a web page — that is \" + \"web_fetch. This searches an app catalogue, never the web.\",\n mutating: false,\n trust: \"untrusted\",\n tags: [\"composio\", \"read\"],\n parameters: {\n type: \"object\",\n properties: {\n use_case: {\n type: \"string\",\n description: \"What the person wants done, as an action and its object: 'send an email', \" + \"'list upcoming calendar events', 'create an issue'. Plain English, one task.\"\n }\n },\n required: [\"use_case\"]\n }\n};\nfunction slugsFrom(data) {\n const ordered = [];\n for (const result of asArray(data.results)) {\n const record = asRecord3(result);\n if (record === undefined)\n continue;\n for (const list of [record.primary_tool_slugs, record.related_tool_slugs]) {\n for (const slug of asArray(list)) {\n if (typeof slug === \"string\" && !ordered.includes(slug))\n ordered.push(slug);\n }\n }\n }\n return ordered.slice(0, MAX_REPORTED);\n}\nfunction hitsFrom(slugs, schemas) {\n const out = [];\n for (const slug of slugs) {\n const tool = schemas[slug];\n if (tool === undefined)\n continue;\n const description = tool.description ?? tool.human_description ?? \"\";\n out.push({\n slug,\n summary: description === \"\" ? \"no description supplied\" : firstLine(description),\n toolkit: tool.toolkit?.slug ?? \"\",\n mutating: isMutating(tool),\n assumed: isUnannotated(tool)\n });\n }\n return out;\n}\nfunction statusesFrom(data) {\n const out = [];\n for (const entry of asArray(data.toolkit_connection_statuses)) {\n const record = asRecord3(entry);\n const toolkit = str(record?.toolkit);\n if (toolkit === undefined)\n continue;\n out.push({ toolkit, connected: record?.has_active_connection === true });\n }\n return out;\n}\nfunction renderSearch(useCase, hits, statuses) {\n const lines = [`Tools that can \"${useCase}\":`, \"\"];\n for (const hit of hits) {\n lines.push(` ${hit.mutating ? \"write\" : \"read \"} ${hit.slug}`);\n lines.push(` ${hit.summary}`);\n }\n if (hits.some((hit) => hit.assumed)) {\n lines.push(\"\");\n lines.push(\"Some of those are marked write because they say nothing either way, not because they \" + \"are known to change things. Composio leaves a third of its catalogue unannotated \" + \"and the safe reading is the one taken here.\");\n }\n const unconnected = statuses.filter((entry) => !entry.connected).map((entry) => entry.toolkit);\n const connected = statuses.filter((entry) => entry.connected).map((entry) => entry.toolkit);\n lines.push(\"\");\n if (connected.length > 0) {\n lines.push(`Already connected: ${connected.join(\", \")}.`);\n }\n if (unconnected.length > 0) {\n lines.push(`Not connected yet: ${unconnected.join(\", \")}. Call composio_connect for each before these tools can run.`);\n }\n lines.push(\"\");\n lines.push(\"These are not enabled yet. To enable them, add the slugs you need to tools.pinned with \" + \"config_set — their definitions are already saved, so no other setup is needed — and then \" + \"tell the person to restart the agent, because the tool list is fixed for a session. \" + \"Pin only what the task needs.\");\n return lines.join(`\n`);\n}\nfunction searchTool(context) {\n return {\n spec: SEARCH_SPEC,\n handler: async (args, toolContext) => {\n const useCase = String(args.use_case ?? \"\").trim();\n const result = await context.call(\"COMPOSIO_SEARCH_TOOLS\", {\n queries: [{ use_case: useCase }],\n session: { generate_id: true }\n }, toolContext.signal);\n if (!result.ok) {\n return `The search failed: ${result.error ?? \"no detail supplied\"}`;\n }\n const data = asRecord3(result.data) ?? {};\n const slugs = slugsFrom(data);\n if (slugs.length === 0)\n throw composioNoMatch(useCase);\n const schemas = await context.fetchSchemas(slugs, toolContext.signal);\n const hits = hitsFrom(slugs, schemas);\n if (hits.length === 0)\n throw composioNoMatch(useCase);\n return renderSearch(useCase, hits, statusesFrom(data));\n }\n };\n}\nvar CONNECT_SPEC = {\n slug: CONNECT_SLUG,\n provider: \"composio\",\n summary: \"Starts linking one of the person's accounts, and returns the link they must open.\",\n whenToUse: \"a tool needs an account that is not connected yet. Takes a toolkit name like 'gmail' or \" + \"'slack'. It returns a web address the person has to open themselves — this agent cannot \" + \"complete the sign-in, so pass the address on and wait for them to say it is done.\",\n whenNotToUse: \"the account already shows as connected, or the person has not asked for that app. This \" + \"starts a sign-in flow against their real account.\",\n mutating: true,\n trust: \"untrusted\",\n policyArg: \"toolkit\",\n tags: [\"composio\", \"write\"],\n parameters: {\n type: \"object\",\n properties: {\n toolkit: {\n type: \"string\",\n description: \"The app to connect, lowercase and by itself: gmail, slack, notion, \" + \"googlecalendar. Not a tool slug and not a sentence.\"\n }\n },\n required: [\"toolkit\"]\n }\n};\nfunction findUrl(value, depth = 0) {\n if (depth > 6)\n return;\n if (typeof value === \"string\") {\n return /^https?:\\/\\/\\S+$/.test(value.trim()) ? value.trim() : undefined;\n }\n for (const entry of Array.isArray(value) ? value : Object.values(asRecord3(value) ?? {})) {\n const found = findUrl(entry, depth + 1);\n if (found !== undefined)\n return found;\n }\n return;\n}\nfunction renderConnect(toolkit, data) {\n const entry = asRecord3(asRecord3(data.results)?.[toolkit]);\n const status = str(entry?.status)?.toLowerCase();\n const url = str(entry?.redirect_url) ?? findUrl(data.results) ?? findUrl(data);\n if (status === \"active\") {\n return `${toolkit} is already connected — nothing to do. Its tools work as soon as they are pinned.`;\n }\n if (url === undefined) {\n return `Composio returned no sign-in link for ${toolkit}${status === undefined ? \"\" : ` (status: ${status})`}. ${str(data.message) ?? \"No detail was supplied.\"}`;\n }\n return [\n `To connect ${toolkit}, the person needs to open this and sign in:`,\n \"\",\n ` ${url}`,\n \"\",\n \"Give them that address and stop — this agent cannot complete a sign-in on their behalf, and \" + \"the connection is not usable until they have. When they say it is done, the account \" + \"stays connected for future sessions with no further sign-in.\"\n ].join(`\n`);\n}\nfunction connectTool(context) {\n return {\n spec: CONNECT_SPEC,\n handler: async (args, toolContext) => {\n const toolkit = String(args.toolkit ?? \"\").trim().toLowerCase();\n const result = await context.call(\"COMPOSIO_MANAGE_CONNECTIONS\", { toolkits: [toolkit] }, toolContext.signal);\n if (!result.ok) {\n return `Could not start the connection for ${toolkit}: ${result.error ?? \"no detail supplied\"}`;\n }\n return renderConnect(toolkit, asRecord3(result.data) ?? {});\n }\n };\n}\nvar WORKBENCH_SPEC = {\n slug: WORKBENCH_SLUG,\n provider: \"composio\",\n summary: \"Runs Python in a Composio-hosted sandbox, for reshaping large tool output.\",\n whenToUse: \"a tool returned more data than is worth reading in full and it needs filtering, counting or \" + \"reshaping first. The sandbox keeps its files and variables for the rest of the task.\",\n whenNotToUse: \"the work belongs on this machine — that is exec, which the permission rules can actually \" + \"constrain. This runs somewhere else, under no rule written here.\",\n mutating: true,\n trust: \"untrusted\",\n tags: [\"composio\", \"write\"],\n parameters: {\n type: \"object\",\n properties: {\n code: {\n type: \"string\",\n description: \"Python to run in the sandbox. Print what should come back.\"\n }\n },\n required: [\"code\"]\n }\n};\nvar WORKBENCH_ARG = \"code_to_execute\";\nfunction renderWorkbench(data) {\n const record = asRecord3(data);\n if (record === undefined)\n return typeof data === \"string\" ? data : JSON.stringify(data, null, 2);\n const parts = [];\n const stdout = str(record.stdout);\n const stderr = str(record.stderr);\n const error = str(record.error);\n const results = str(record.results);\n if (stdout !== undefined)\n parts.push(stdout.trimEnd());\n if (results !== undefined)\n parts.push(results.trimEnd());\n if (stderr !== undefined)\n parts.push(`stderr:\n${stderr.trimEnd()}`);\n if (error !== undefined)\n parts.push(`error:\n${error.trimEnd()}`);\n return parts.length === 0 ? \"The code ran and printed nothing.\" : parts.join(`\n`);\n}\nfunction workbenchTool(context) {\n return {\n spec: WORKBENCH_SPEC,\n handler: async (args, toolContext) => {\n const result = await context.call(\"COMPOSIO_REMOTE_WORKBENCH\", { [WORKBENCH_ARG]: String(args.code ?? \"\") }, toolContext.signal);\n if (!result.ok) {\n return `The workbench failed: ${result.error ?? \"no detail supplied\"}`;\n }\n return renderWorkbench(result.data);\n }\n };\n}\nfunction metaTools(context) {\n return {\n [SEARCH_SLUG]: searchTool(context),\n [CONNECT_SLUG]: connectTool(context),\n [WORKBENCH_SLUG]: workbenchTool(context)\n };\n}\n\n// src/session.ts\nimport { mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from \"node:fs\";\nimport { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, resolve as resolve2 } from \"node:path\";\nimport { BRAND as BRAND3 } from \"@dispach/core\";\nvar SESSION_FILE = \"composio.session.json\";\nfunction sessionPath(dir) {\n return isAbsolute2(dir) ? join2(dir, BRAND3.stateDir, SESSION_FILE) : join2(resolve2(dir), BRAND3.stateDir, SESSION_FILE);\n}\nfunction readSession(dir, userId) {\n let raw;\n try {\n raw = readFileSync2(sessionPath(dir), \"utf8\");\n } catch {\n return;\n }\n try {\n const parsed = JSON.parse(raw);\n const sessions = parsed?.sessions;\n if (typeof sessions !== \"object\" || sessions === null)\n return;\n const id = sessions[userId];\n return typeof id === \"string\" && id !== \"\" ? id : undefined;\n } catch {\n return;\n }\n}\nfunction writeSession(dir, userId, sessionId) {\n const path = sessionPath(dir);\n mkdirSync2(dirname2(path), { recursive: true });\n let existing = {};\n try {\n const parsed = JSON.parse(readFileSync2(path, \"utf8\"));\n const sessions = parsed?.sessions;\n if (typeof sessions === \"object\" && sessions !== null) {\n for (const [key, value] of Object.entries(sessions)) {\n if (typeof value === \"string\")\n existing[key] = value;\n }\n }\n } catch {\n existing = {};\n }\n const file = { sessions: { ...existing, [userId]: sessionId } };\n const temp = `${path}.${process.pid}.tmp`;\n writeFileSync2(temp, `${JSON.stringify(file, null, 2)}\n`, \"utf8\");\n renameSync2(temp, path);\n return path;\n}\n\n// src/provider.ts\nvar DEFAULT_KEY_ENV = \"COMPOSIO_API_KEY\";\n\nclass ComposioProvider {\n id = \"composio\";\n #dir;\n #userId;\n #now;\n #baseUrl;\n #client;\n #keyEnv;\n #tools;\n #fetchedAt;\n #assumedMutating = [];\n #sessionId;\n constructor(options) {\n this.#dir = options.dir;\n this.#userId = options.userId ?? \"default\";\n this.#now = options.now ?? (() => new Date);\n this.#keyEnv = options.apiKeyEnv ?? DEFAULT_KEY_ENV;\n const apiKey = options.env[this.#keyEnv];\n this.#baseUrl = options.baseUrl ?? \"https://backend.composio.dev/api/v3\";\n this.#client = apiKey === undefined || apiKey === \"\" ? undefined : new ComposioClient({\n apiKey,\n baseUrl: this.#baseUrl,\n ...options.fetch === undefined ? {} : { fetch: options.fetch }\n });\n const cache = readCache(this.#dir);\n this.#tools = cache.tools;\n this.#fetchedAt = cache.fetchedAt;\n }\n async resolve(slugs) {\n const out = [];\n const assumed = [];\n const meta = metaTools(this.#metaContext());\n for (const slug of slugs) {\n const builtIn = meta[slug];\n if (builtIn !== undefined) {\n out.push(builtIn);\n continue;\n }\n const raw = this.#tools[slug];\n if (raw === undefined)\n continue;\n if (isUnannotated(raw))\n assumed.push(slug);\n out.push(this.#toTool(mapTool(raw)));\n }\n this.#assumedMutating = assumed;\n return out;\n }\n async list() {\n return [...META_SLUGS, ...Object.keys(this.#tools)];\n }\n async available() {\n return [\n { slug: SEARCH_SLUG, summary: SEARCH_SPEC.summary },\n { slug: CONNECT_SLUG, summary: CONNECT_SPEC.summary }\n ];\n }\n uncached(slugs) {\n return slugs.filter((slug) => this.#tools[slug] === undefined);\n }\n explainUnresolved(slugs) {\n if (Object.keys(this.#tools).length > 0 || slugs.length === 0)\n return;\n return composioCacheMiss(slugs, cachePath(this.#dir));\n }\n describe() {\n return {\n cached: Object.keys(this.#tools).length,\n fetchedAt: this.#fetchedAt,\n cachePath: cachePath(this.#dir),\n assumedMutating: this.#assumedMutating\n };\n }\n async refresh(slugs, signal) {\n const client = this.#client;\n if (client === undefined)\n throw composioKeyMissing(this.#keyEnv);\n const fetched = {};\n const missing = [];\n const changed = [];\n for (const slug of slugs) {\n const tool = await client.tool(slug, signal);\n if (tool === undefined) {\n missing.push(slug);\n continue;\n }\n fetched[slug] = tool;\n const before = this.#tools[slug];\n if (before === undefined || JSON.stringify(before) !== JSON.stringify(tool)) {\n changed.push(slug);\n }\n }\n this.#tools = { ...this.#tools, ...fetched };\n const path = writeCache(this.#dir, this.#tools, this.#baseUrl, this.#now);\n this.#fetchedAt = readCache(this.#dir).fetchedAt;\n return { fetched: Object.keys(fetched).length, missing, changed, cachePath: path };\n }\n async#session(signal, force = false) {\n const client = this.#client;\n if (client === undefined)\n throw composioSessionKeyMissing(this.#keyEnv);\n if (!force) {\n const cached = this.#sessionId ?? readSession(this.#dir, this.#userId);\n if (cached !== undefined) {\n this.#sessionId = cached;\n return cached;\n }\n }\n const created = await client.createSession(this.#userId, signal);\n this.#sessionId = created.session_id;\n writeSession(this.#dir, this.#userId, created.session_id);\n return created.session_id;\n }\n #metaContext() {\n return {\n call: async (slug, args, signal) => {\n const client = this.#client;\n if (client === undefined)\n throw composioSessionKeyMissing(this.#keyEnv);\n let id = await this.#session(signal);\n let result = await client.executeMeta(id, slug, args, signal);\n if (\"notFound\" in result) {\n id = await this.#session(signal, true);\n const retried = await client.executeMeta(id, slug, args, signal);\n if (\"notFound\" in retried) {\n return { ok: false, data: {}, error: \"the session could not be opened\" };\n }\n result = retried;\n }\n return result;\n },\n fetchSchemas: async (slugs, signal) => {\n await this.refresh(slugs, signal);\n const out = {};\n for (const slug of slugs) {\n const tool = this.#tools[slug];\n if (tool !== undefined)\n out[slug] = tool;\n }\n return out;\n }\n };\n }\n #toTool(spec) {\n return {\n spec,\n handler: async (args, context) => {\n const client = this.#client;\n if (client === undefined)\n throw composioKeyMissing(this.#keyEnv);\n const result = await client.execute(spec.slug, args, this.#userId, context.signal);\n if (!result.ok) {\n const detail = result.error ?? \"no detail supplied\";\n if (/connected account|not connected|no connection/i.test(detail)) {\n const toolkit = spec.tags[0] ?? \"the toolkit\";\n throw composioNotConnected(spec.slug, toolkit);\n }\n throw composioExecuteFailed(spec.slug, 200, detail);\n }\n return typeof result.data === \"string\" ? result.data : JSON.stringify(result.data, null, 2);\n }\n };\n }\n}\nvar CONFIG_KEYS = [\"apiKeyEnv\", \"userId\", \"baseUrl\"];\nfunction configString(config, key) {\n const value = config[key];\n if (value === undefined)\n return;\n if (typeof value !== \"string\" || value === \"\") {\n throw new ConfigError2({\n code: \"composio_config_invalid\",\n message: `tools.providers.composio.${key} must be a non-empty string.`,\n hint: `Got ${value === null ? \"null\" : typeof value}. ${key === \"apiKeyEnv\" ? \"This is the *name* of an environment variable, never the key itself — a manifest holding a literal key fails validation.\" : \"Remove the key to use the default.\"}`,\n field: `tools.providers.composio.${key}`\n });\n }\n return value;\n}\nfunction composioFromConfig(context) {\n const unknown = Object.keys(context.config).filter((key) => !CONFIG_KEYS.includes(key));\n if (unknown.length > 0) {\n throw new ConfigError2({\n code: \"composio_config_unknown\",\n message: `tools.providers.composio has ${unknown.length === 1 ? \"a key\" : \"keys\"} the Composio provider does not read: ${unknown.join(\", \")}.`,\n hint: `Accepted keys are ${CONFIG_KEYS.join(\", \")}. Refused rather than ignored, because a setting that looks applied and is not is worse than a rejected manifest.`,\n field: \"tools.providers.composio\"\n });\n }\n const apiKeyEnv = configString(context.config, \"apiKeyEnv\");\n const userId = configString(context.config, \"userId\");\n const baseUrl = configString(context.config, \"baseUrl\");\n return new ComposioProvider({\n dir: context.dir,\n env: context.env,\n ...apiKeyEnv === undefined ? {} : { apiKeyEnv },\n ...userId === undefined ? {} : { userId },\n ...baseUrl === undefined ? {} : { baseUrl }\n });\n}\n\n// src/index.ts\nvar VERSION = \"0.1.0\";\nvar src_default = {\n name: \"composio\",\n version: VERSION,\n dispachApi: \"^0.1\",\n permissions: [\n { kind: \"network\", hosts: [\"backend.composio.dev\"] },\n { kind: \"env\", vars: [\"COMPOSIO_API_KEY\"] },\n { kind: \"fs\", paths: [\"<state>/composio\"], mode: \"write\" }\n ],\n setup(context) {\n context.defineToolProvider(\"composio\", composioFromConfig);\n }\n};\nexport {\n CONNECT_SLUG,\n CONNECT_SPEC,\n ComposioClient,\n ComposioProvider,\n META_SLUGS,\n SEARCH_SLUG,\n SEARCH_SPEC,\n VERSION,\n WORKBENCH_SLUG,\n WORKBENCH_SPEC,\n cachePath,\n composioCacheMiss,\n composioExecuteFailed,\n composioFromConfig,\n composioKeyMissing,\n composioNoMatch,\n composioNotConnected,\n composioRequestFailed,\n composioSchemaUnsupported,\n composioSessionKeyMissing,\n src_default as default,\n findUrl,\n isMutating,\n isUnannotated,\n mapParameters,\n mapTool,\n metaTools,\n readCache,\n readSession,\n renderConnect,\n renderSearch,\n renderWorkbench,\n sessionPath,\n writeCache,\n writeSession\n};\n\n//# debugId=68E2496D5D66835664756E2164756E21\n//# sourceMappingURL=index.js.map\n",
9
- "// src/provider.ts\nimport {\n ConfigError as ConfigError2\n} from \"@dispach/core\";\n\n// src/config.ts\nimport { readFile } from \"node:fs/promises\";\nimport { join as join2 } from \"node:path\";\nimport {\n AGENT_SETTABLE_PATHS,\n editManifest,\n HarnessError,\n parseSettingValue,\n SETTINGS\n} from \"@dispach/core\";\nimport { isMap, isSeq, parseDocument, stringify } from \"yaml\";\n\n// src/errors.ts\nimport { ConfigError, ToolError } from \"@dispach/core\";\nfunction execCommandEmpty() {\n return new ToolError({\n code: \"exec_command_empty\",\n message: \"exec was called with no command.\",\n hint: \"Put the whole shell command in the command field, exactly as it would be typed at a prompt — for example `ls -la` or `npm test`.\"\n });\n}\nfunction execWorkdirMissing(path, remembered) {\n return new ConfigError({\n code: \"exec_workdir_missing\",\n message: `The directory to run in does not exist: ${path}`,\n hint: remembered ? \"This is where a previous exec call left the shell, and it has since been removed or renamed. The remembered directory has been cleared, so the next call starts from the agent's own directory; pass workdir to choose a different one.\" : \"workdir must name a directory that already exists. A relative path is resolved against the directory the last exec call ended in, the way a shell would.\",\n field: \"workdir\"\n });\n}\nfunction execPtyUnavailable(platform, cause) {\n return new ToolError({\n code: \"exec_pty_unavailable\",\n message: `A terminal was requested and this machine cannot provide one: ${cause}`,\n hint: `pty: true allocates a terminal with the system \\`script\\` command, which is missing or unusable on this ${platform} host. Refused rather than quietly falling back to a pipe: the fallback would run the command with no terminal while the observation claimed otherwise, and a program that checks isatty() would take the other branch with nothing reporting it. Re-run with pty omitted if the command does not need one.`,\n field: \"pty\"\n });\n}\nfunction execSpawnFailed(command, cause) {\n return new ToolError({\n code: \"exec_spawn_failed\",\n message: `The shell could not be started for: ${command}`,\n hint: `The operating system refused before the command ran, so nothing was executed: ${cause}. This is a failure of the host rather than of the command — check that /bin/sh exists and that the directory is readable.`\n });\n}\nfunction filePathEmpty() {\n return new ToolError({\n code: \"file_path_empty\",\n message: \"A file tool was called with no path.\",\n hint: \"Give the path field a value — either absolute, or relative to the current working directory, which is wherever the last exec call left it.\"\n });\n}\nfunction fileMissing(path) {\n return new ToolError({\n code: \"file_missing\",\n message: `There is no file at ${path}.`,\n hint: \"Check the path against what glob returns rather than guessing at it. A relative path is resolved against the current working directory, which starts at the agent's own directory and moves when a shell command changes it.\",\n field: \"path\"\n });\n}\nfunction fileTooLarge(path, size, max) {\n return new ToolError({\n code: \"file_too_large\",\n message: `${path} is ${size} bytes, over the ${max}-byte limit for reading.`,\n hint: \"Use grep to find the part that matters and read around it with offset and limit, rather than pulling the whole file into the conversation.\",\n field: \"path\"\n });\n}\nfunction fileIsBinary(path, size) {\n return new ToolError({\n code: \"file_is_binary\",\n message: `${path} is not a text file (${size} bytes).`,\n hint: \"Refused rather than decoded: a binary rendered as text is thousands of meaningless tokens and no information. If something about the file is needed — its type, its size, what it contains — a shell command that inspects it will answer better.\",\n field: \"path\"\n });\n}\nfunction fileProtected(path, reason) {\n return new ToolError({\n code: \"file_protected\",\n message: `${path} cannot be written: ${reason}.`,\n hint: \"This is a standing rule and no permission setting overrides it — a rule that authorised writing to the agent's own definition would be a rule authorising its own replacement. Say what change was wanted and let the person make it themselves.\",\n field: \"path\"\n });\n}\nfunction fileEditNoMatch(path, find) {\n const preview = find.length > 120 ? `${find.slice(0, 120)}…` : find;\n return new ToolError({\n code: \"file_edit_no_match\",\n message: `That text does not appear in ${path}: ${JSON.stringify(preview)}`,\n hint: \"The match is exact, including indentation and line breaks. Read the file and copy the text out of it rather than reconstructing it from memory — nothing was changed, so the file is still as it was.\",\n field: \"find\"\n });\n}\nfunction fileEditAmbiguous(path, occurrences) {\n return new ToolError({\n code: \"file_edit_ambiguous\",\n message: `That text appears ${occurrences} times in ${path}, so it does not identify one place.`,\n hint: \"Nothing was changed: picking one of several matches would be a guess, and a wrong guess reports success while editing the wrong line. Include a surrounding line or two to make it unique, or pass all: true if every occurrence should change.\",\n field: \"find\"\n });\n}\nfunction grepPatternInvalid(pattern, cause) {\n return new ToolError({\n code: \"grep_pattern_invalid\",\n message: `That is not a valid regular expression: ${pattern}`,\n hint: `${cause}. Refused rather than searched literally — a literalised pattern finds nothing and returns an empty result, which reads as \"it is not there\" instead of \"the pattern was wrong\". Escape any regex character meant literally, such as a dot or a bracket.`,\n field: \"pattern\"\n });\n}\nfunction fileOutsideRoot(path, roots) {\n return new ToolError({\n code: \"file_outside_root\",\n message: `${path} is outside the directories this agent may change.`,\n hint: `Writable: ${roots.join(\", \")}. Everything else is read-only by default — an agent that has misunderstood a request cannot damage anything while misunderstanding it. To work somewhere else, the person you work for adds it to tools.providerConfig.writeRoots in agent.yaml; nothing said in a conversation can add one. Reading outside these directories is allowed and unaffected.`,\n field: \"path\"\n });\n}\nfunction configReadFailed(file, cause) {\n return new ToolError({\n code: \"config_read_failed\",\n message: `This agent's configuration could not be read from ${file}.`,\n hint: `${cause}. The agent is running, so the file existed at boot — it has been moved or its permissions have changed since.`\n });\n}\nfunction configPathUnknown(path, known) {\n return new ToolError({\n code: \"config_path_unknown\",\n message: `\"${path}\" is not a setting config_set will change.`,\n hint: `Settable: ${known.join(\", \")}. Deliberately a list rather than anything the schema accepts: a tool that can write any field can write the ones that decide what it is allowed to do, and the list is where that judgement lives. Call config_read with no path to see each one explained.`,\n field: \"path\"\n });\n}\nfunction configValueUnreadable(raw, cause) {\n return new ToolError({\n code: \"config_value_unreadable\",\n message: `That value could not be read: ${JSON.stringify(raw)}`,\n hint: `${cause}. Write it the way it would appear in the file — a bare word, a number, or a list as [\"a\", \"b\"]. Refused rather than guessed at, because guessing is how tools.pinned becomes a list of single characters.`,\n field: \"value\"\n });\n}\nfunction configInvalid(path, raw, why) {\n return new ToolError({\n code: \"config_invalid\",\n message: `Setting ${path} to ${JSON.stringify(raw)} would produce a configuration that does not load: ${why}`,\n hint: \"Nothing was written, so the agent is unchanged and still starts. An invalid manifest is not a failure that shows up now — it is one that shows up at the next boot, by which time the change looks like it succeeded.\",\n field: \"value\"\n });\n}\nfunction configRefused(path, why) {\n return new ToolError({\n code: \"config_refused\",\n message: `${path} cannot be changed from inside a conversation: ${why}.`,\n hint: \"No permission rule overrides this, and asking again will not change it. Every other setting can be changed — including enabling a tool or adding a permission rule, which is what this tool is for. Name the exact line you would have added and let the person put it in themselves.\",\n field: \"path\"\n });\n}\nfunction execTooManyBackground(running) {\n return new ToolError({\n code: \"exec_too_many_background\",\n message: `${running.length} commands are already running in the background, which is the limit.`,\n hint: `Wait for one to finish, or stop one yourself. Already running: ${running.map((command) => command.length > 60 ? `${command.slice(0, 57)}...` : command).join(\"; \")}. A command that outruns its timeout is left running rather than discarded, so a loop that starts one per attempt reaches this quickly — which is the point of the limit.`\n });\n}\n\n// src/paths.ts\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { BRAND } from \"@dispach/core\";\nvar SYSTEM_PROVIDER_ID = \"system\";\nfunction spillDir() {\n return join(tmpdir(), `${BRAND.slug}-${SYSTEM_PROVIDER_ID}`);\n}\n\n// src/config.ts\nvar AGENT_ROWS = SETTINGS.filter((entry) => entry.agentListed);\nfunction floorRefusal(path, value) {\n const key = path.toLowerCase();\n const ALLOW_FROM = \"who is allowed to talk to you is not yours to decide. It is the inbound gate, so an agent that could widen it could be talked into widening it by the very message it is reading — put the handle in agent.yaml yourself; a refused message prints the exact line\";\n const SERVER_REACH = \"where the API listens, and what authenticates it, is not yours to decide — the same reason writeRoots is refused. Enabling it on 127.0.0.1 is settable; binding anywhere reachable is a person's call\";\n const WRITE_ROOTS = \"widening where you may write is not yours to do. Asked to create a file, an agent granted itself the whole home directory and then wrote there — which is what this refusal exists to prevent\";\n if (key.split(\".\").includes(\"writeroots\"))\n return WRITE_ROOTS;\n if (key.startsWith(\"tools.providers\") && containsKey(value, \"writeroots\"))\n return WRITE_ROOTS;\n if (key.split(\".\").includes(\"allowfrom\"))\n return ALLOW_FROM;\n if (key === \"channels\" && containsKey(value, \"allowfrom\"))\n return ALLOW_FROM;\n if (key === \"server.host\" || key === \"server.tokenenv\")\n return SERVER_REACH;\n if (key === \"server\" && (containsKey(value, \"host\") || containsKey(value, \"tokenenv\"))) {\n return SERVER_REACH;\n }\n if (key === \"tools.policy.deny\") {\n return \"removing or replacing the deny rules is the one edit whose only purpose is to remove a restriction someone deliberately set\";\n }\n if (value !== undefined && key === \"tools.untrusted.onmutate\" && String(value).toLowerCase() === \"allow\") {\n return 'setting the write gate to \"allow\" turns off the check that stops text from outside the conversation driving a tool that changes things';\n }\n return;\n}\nfunction containsKey(value, name) {\n if (Array.isArray(value))\n return value.some((entry) => containsKey(entry, name));\n if (typeof value !== \"object\" || value === null)\n return false;\n return Object.entries(value).some(([key, nested]) => key.toLowerCase() === name || containsKey(nested, name));\n}\nfunction manifestPath(options) {\n return options.file ?? join2(options.agentDir, \"agent.yaml\");\n}\nvar CONFIG_READ_SPEC = {\n slug: \"config_read\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Reads this agent's own configuration and lists what can be changed in it.\",\n whenToUse: \"you need to know how you are configured, or what would have to change for you to do something you currently cannot — which tool to enable, which permission rule to add\",\n whenNotToUse: \"for anything that is not your own configuration; an ordinary file is file_read. You do not need to read it before every answer, only when the question is about how you are set up\",\n mutating: false,\n trust: \"trusted\",\n trustReason: \"The manifest is the runtime's own file, written and validated by the runtime. Fencing it would put a warning about strangers around the agent's own settings.\",\n policyArg: \"path\",\n tags: [\"read\", \"config\"],\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"A single setting, such as tools.pinned. Omit to see the whole configuration and every setting that can be changed.\"\n }\n }\n }\n};\nvar CONFIG_SET_SPEC = {\n slug: \"config_set\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Changes one setting in this agent's own configuration.\",\n whenToUse: \"the person asks you to change how you are configured, or asks you to do something that needs a tool or permission you do not have and tells you to go ahead and enable it\",\n whenNotToUse: \"on your own initiative. Say what you would change and why, and let them ask — and never to remove a restriction someone set, which is refused anyway. The change takes effect when the agent next starts, not in this conversation\",\n mutating: true,\n trust: \"trusted\",\n trustReason: \"It reports the old and new value of one setting the runtime just validated, and nothing else.\",\n policyArg: \"path\",\n tags: [\"write\", \"config\"],\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"The setting, as a dotted path: tools.pinned, tools.policy.allow, model.main.temperature. config_read with no path lists them.\"\n },\n value: {\n type: \"string\",\n description: 'The new value, written the way it would appear in the file: a bare word, a number, or a list as [\"a\", \"b\"]. Replaces what is there.'\n }\n },\n required: [\"path\", \"value\"]\n }\n};\nfunction parseValue(raw) {\n try {\n return parseSettingValue(raw);\n } catch (cause) {\n throw configValueUnreadable(raw, cause instanceof Error ? cause.message : String(cause));\n }\n}\nfunction configReadHandler(options) {\n return async (args) => {\n const file = manifestPath(options);\n let source;\n try {\n source = await readFile(file, \"utf8\");\n } catch (cause) {\n throw configReadFailed(file, String(cause));\n }\n const asked = typeof args.path === \"string\" ? args.path.trim() : \"\";\n if (asked !== \"\") {\n const doc = parseDocument(source);\n const value = doc.getIn(asked.split(\".\"), false);\n if (value === undefined) {\n return `${asked} is not set in this configuration. It can be — see config_read with no path for the full list.`;\n }\n return `${asked}:\n${stringify(isMap(value) || isSeq(value) ? value.toJS(doc) : value).trimEnd()}`;\n }\n const doc = parseDocument(source);\n const rows = AGENT_ROWS.map((entry) => {\n const current = doc.getIn(entry.path.split(\".\"), false);\n const value = isMap(current) || isSeq(current) ? current.toJS(doc) : current;\n const shown = value === undefined || value === null ? \"(not set)\" : Array.isArray(value) ? `[${value.map((entry) => typeof entry === \"object\" && entry !== null ? JSON.stringify(entry) : String(entry)).join(\", \")}]` : stringify(value).trim();\n const means = entry.toAgent === undefined ? entry.means : `${entry.means}. ${entry.toAgent}`;\n return `- ${entry.path} = ${shown}\n ${means}`;\n }).join(`\n`);\n return [\n `This agent is ${doc.get(\"name\") ?? doc.get(\"id\")}, configured at ${file}.`,\n \"\",\n \"Settings config_set can change, with their current values:\",\n rows,\n \"\",\n \"Anything not on this list is not settable from a conversation. A change takes effect when the agent next starts, not in the current conversation.\",\n \"\",\n \"Some edits are refused whatever the rules say. Removing a check: replacing tools.policy.deny, or setting tools.untrusted.onMutate to allow. Deciding reach: a writeRoots list anywhere, a channel's allowFrom, and server.host or server.tokenEnv. Enabling a capability is what a person asks you for; where you may write, who may talk to you, and what address you listen on are theirs — name what you need and why, and let them add it.\",\n \"\",\n `The whole file, comments and all, is at ${file} — read it with file_read if that tool is enabled, or ask the person to open it.`\n ].join(`\n`);\n };\n}\nfunction configSetHandler(options) {\n return async (args) => {\n const file = manifestPath(options);\n const path = typeof args.path === \"string\" ? args.path.trim() : \"\";\n const raw = typeof args.value === \"string\" ? args.value : String(args.value ?? \"\");\n const pathFloor = floorRefusal(path);\n if (pathFloor !== undefined)\n throw configRefused(path, pathFloor);\n if (!AGENT_SETTABLE_PATHS.includes(path)) {\n throw configPathUnknown(path, AGENT_SETTABLE_PATHS);\n }\n const value = parseValue(raw);\n const valueFloor = floorRefusal(path, value);\n if (valueFloor !== undefined)\n throw configRefused(path, valueFloor);\n let result;\n try {\n result = await editManifest({ file, path: path.split(\".\"), value });\n } catch (cause) {\n if (cause instanceof HarnessError && cause.code === \"manifest_edit_unreadable\") {\n throw configReadFailed(file, String(cause.cause ?? cause.message));\n }\n if (cause instanceof HarnessError && cause.code === \"manifest_edit_invalid\") {\n const detail = cause.message.slice(cause.message.indexOf(\": \") + 2);\n throw configInvalid(path, raw, detail);\n }\n throw cause;\n }\n const wasSet = result.before !== undefined;\n return [\n `Set ${path} in ${file}.`,\n wasSet ? `It was: ${stringify(result.before).trim()}` : \"It was not set before.\",\n `It is now: ${stringify(value).trim()}`,\n \"\",\n \"The configuration still validates. This takes effect when the agent next starts — nothing in the current conversation changes, so do not try the new tool yet.\",\n ...pendingSecrets(result.manifest, value)\n ].join(`\n`);\n };\n}\nfunction pendingSecrets(manifest, written) {\n if (!containsKey(written, \"tokenenv\") && !containsKey(written, \"apikeyenv\"))\n return [];\n const names = new Set;\n for (const channel of manifest.channels ?? []) {\n const env = channel.tokenEnv;\n if (typeof env === \"string\" && env !== \"\")\n names.add(env);\n }\n if (names.size === 0)\n return [];\n return [\n \"\",\n `This will NOT start until ${[...names].join(\" and \")} ${names.size === 1 ? \"is\" : \"are\"} set in the .env beside the manifest — the value is read at boot, and a missing one fails the load rather than the first message. You cannot write that file; it is protected because it holds every secret here. Tell the person the variable name and where it goes.`\n ];\n}\nfunction configTools(options) {\n return [\n { spec: CONFIG_READ_SPEC, handler: configReadHandler(options) },\n { spec: CONFIG_SET_SPEC, handler: configSetHandler(options) }\n ];\n}\nvar SETTABLE_PATHS = AGENT_SETTABLE_PATHS;\n\n// src/exec.ts\nimport { mkdir, realpath, rm, stat } from \"node:fs/promises\";\nimport { isAbsolute as isAbsolute2, resolve as resolve2 } from \"node:path\";\n\n// src/output.ts\nimport { open } from \"node:fs/promises\";\nimport { stripControl } from \"@dispach/core\";\nvar INLINE_CAP = 6000;\nvar HEAD_PREVIEW = 3000;\nvar TAIL_PREVIEW = 1500;\nvar decoder = new TextDecoder(\"utf-8\");\nasync function readRange(path, offset, length) {\n const handle = await open(path, \"r\");\n try {\n const buffer = new Uint8Array(length);\n const { bytesRead } = await handle.read(buffer, 0, length, offset);\n return decoder.decode(buffer.subarray(0, bytesRead));\n } finally {\n await handle.close();\n }\n}\nasync function readOutput(path) {\n const handle = await open(path, \"r\");\n let bytes;\n try {\n bytes = (await handle.stat()).size;\n } finally {\n await handle.close();\n }\n if (bytes <= INLINE_CAP) {\n return {\n head: stripControl(await readRange(path, 0, bytes)),\n tail: \"\",\n bytes,\n spilled: false\n };\n }\n return {\n head: stripControl(await readRange(path, 0, HEAD_PREVIEW)),\n tail: stripControl(await readRange(path, bytes - TAIL_PREVIEW, TAIL_PREVIEW)),\n bytes,\n spilled: true\n };\n}\nfunction stripLeadingEcho(text) {\n return text.replace(/^(?:\\^[A-Z?]\\s*)+/, \"\");\n}\nfunction humanBytes(bytes) {\n if (bytes < 1024)\n return `${bytes} B`;\n if (bytes < 1024 * 1024)\n return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n// src/root.ts\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { isAbsolute, relative, resolve, sep } from \"node:path\";\nfunction expandTilde(path) {\n if (path === \"~\")\n return homedir();\n return path.startsWith(\"~/\") ? resolve(homedir(), path.slice(2)) : path;\n}\nvar WORKSPACE_DIR = \"workspace\";\nfunction resolveRoots(agentDir, writeRoots = []) {\n const base = resolve(agentDir);\n const workspace = resolve(base, WORKSPACE_DIR);\n return {\n primary: existsSync(workspace) ? workspace : base,\n extra: writeRoots.map((entry) => isAbsolute(entry) ? resolve(entry) : resolve(base, entry))\n };\n}\nfunction within(absolute, root) {\n if (absolute === root)\n return true;\n const rel = relative(root, absolute);\n return rel !== \"\" && !rel.startsWith(`..${sep}`) && rel !== \"..\" && !isAbsolute(rel);\n}\nfunction writable(roots) {\n return [roots.primary, ...roots.extra];\n}\nfunction isWritable(absolute, roots) {\n return writable(roots).some((root) => within(absolute, root));\n}\nfunction whereYouWork(roots, mode) {\n const extra = roots.extra.length === 0 ? \"\" : ` Also writable: ${roots.extra.join(\", \")}.`;\n if (mode === \"read\") {\n return ` Relative paths are resolved against ${roots.primary}. Reading elsewhere is allowed — give an absolute path for it.`;\n }\n if (mode === \"write\") {\n return ` You work in ${roots.primary}. A relative path lands there, and that is where anything you create belongs unless the person names somewhere else. Writing anywhere else is refused.${extra}`;\n }\n return ` Every command starts in ${roots.primary}, and that is where anything you create belongs unless the person names somewhere else. Nothing stops a command from leaving it, so this one is on you: use a relative path, and do not reach for ~ or an absolute path outside it on your own initiative.${extra}`;\n}\nfunction locate(spec, roots, fields, mode = spec.mutating ? \"write\" : \"read\") {\n const properties = { ...spec.parameters.properties };\n for (const field of fields) {\n const node = properties[field];\n if (node === undefined)\n continue;\n properties[field] = {\n ...node,\n description: `${node.description ?? \"\"}${whereYouWork(roots, mode)}`\n };\n }\n return { ...spec, parameters: { ...spec.parameters, properties } };\n}\n\n// src/run.ts\nimport { spawn } from \"node:child_process\";\nimport { open as open2, readFile as readFile2 } from \"node:fs/promises\";\nimport { subcommands } from \"@dispach/core\";\nvar BACKGROUNDED = new Map;\nvar MAX_BACKGROUNDED = 8;\nfunction backgroundedCommands() {\n return [...BACKGROUNDED.entries()].map(([pid, entry]) => ({ pid, ...entry })).sort((a, b) => b.since - a.since);\n}\nfunction reapBackgrounded() {\n const reaped = [];\n for (const [pid, entry] of BACKGROUNDED) {\n try {\n process.kill(-pid, \"SIGTERM\");\n reaped.push(`${pid} (${entry.command})`);\n } catch {}\n }\n BACKGROUNDED.clear();\n return reaped;\n}\nfunction forgetDead() {\n for (const pid of [...BACKGROUNDED.keys()]) {\n try {\n process.kill(pid, 0);\n } catch {\n BACKGROUNDED.delete(pid);\n }\n }\n}\nvar BACKGROUND_GRACE_MS = 250;\nvar KILL_GRACE_MS = 2000;\nvar NEVER_BACKGROUNDED = new Set([\"sleep\", \"git\", \"ssh\", \"scp\", \"sudo\", \"su\", \"doas\"]);\nfunction headWord(fragment) {\n for (const word of fragment.split(/\\s+/)) {\n if (/^[A-Za-z_]\\w*=/.test(word))\n continue;\n return word.replace(/^.*\\//, \"\").toLowerCase();\n }\n return \"\";\n}\nfunction backgroundable(command) {\n const fragments = subcommands(command);\n if (fragments.length === 0)\n return false;\n return fragments.every((fragment) => !NEVER_BACKGROUNDED.has(headWord(fragment)));\n}\nfunction shellQuote(value) {\n return `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\nfunction buildWrapper(command, statusPath) {\n return [\n command,\n \"__code=$?\",\n `{ printf '%s\\\\n' \"$__code\"; pwd; } > ${shellQuote(statusPath)} 2>/dev/null`,\n \"exit $__code\"\n ].join(`\n`);\n}\nfunction commandLine(wrapper, pty, platform = process.platform) {\n if (!pty)\n return { file: \"/bin/sh\", args: [\"-c\", wrapper], env: {} };\n if (platform === \"linux\") {\n return {\n file: \"script\",\n args: [\"-qec\", `/bin/sh -c ${shellQuote(wrapper)}`, \"/dev/null\"],\n env: { SHELL: \"/bin/sh\" }\n };\n }\n return {\n file: \"script\",\n args: [\"-q\", \"/dev/null\", \"/bin/sh\", \"-c\", wrapper],\n env: { SHELL: \"/bin/sh\" }\n };\n}\nfunction killGroup(child, signal) {\n const pid = child.pid;\n if (pid === undefined)\n return;\n try {\n process.kill(-pid, signal);\n } catch {}\n}\nasync function readStatus(path) {\n try {\n const [first, second] = (await readFile2(path, \"utf8\")).split(`\n`);\n const code = Number.parseInt(first ?? \"\", 10);\n const cwd = second?.trim();\n return {\n ...Number.isNaN(code) ? {} : { code },\n ...cwd === undefined || cwd === \"\" ? {} : { cwd }\n };\n } catch {\n return {};\n }\n}\nasync function runCommand(request) {\n forgetDead();\n if (BACKGROUNDED.size >= MAX_BACKGROUNDED) {\n throw execTooManyBackground(backgroundedCommands().map((entry) => entry.command));\n }\n const wrapper = buildWrapper(request.command, request.statusPath);\n const { file, args, env } = commandLine(wrapper, request.pty);\n const handle = await open2(request.outPath, \"w\");\n let child;\n try {\n child = spawn(file, args, {\n cwd: request.cwd,\n env: { ...request.env, ...env },\n stdio: [\"ignore\", handle.fd, handle.fd],\n detached: true\n });\n } catch (cause) {\n await handle.close();\n throw execSpawnFailed(request.command, String(cause));\n }\n const ending = await new Promise((resolve, reject) => {\n let settled = false;\n let killedAtDeadline = false;\n const timer = setTimeout(onDeadline, request.background ? BACKGROUND_GRACE_MS : request.timeoutMs);\n const done = (outcome) => {\n if (settled)\n return;\n settled = true;\n clearTimeout(timer);\n request.signal.removeEventListener(\"abort\", onAbort);\n resolve(outcome);\n };\n function onDeadline() {\n if (request.background || backgroundable(request.command)) {\n child.unref();\n if (child.pid !== undefined) {\n BACKGROUNDED.set(child.pid, {\n command: request.command,\n since: Date.now(),\n outPath: request.outPath\n });\n }\n done({\n ending: \"backgrounded\",\n ...child.pid === undefined ? {} : { pid: child.pid }\n });\n return;\n }\n killedAtDeadline = true;\n killGroup(child, \"SIGTERM\");\n const insist = setTimeout(() => killGroup(child, \"SIGKILL\"), KILL_GRACE_MS);\n insist.unref?.();\n }\n function onAbort() {\n killGroup(child, \"SIGTERM\");\n setTimeout(() => killGroup(child, \"SIGKILL\"), KILL_GRACE_MS).unref?.();\n }\n request.signal.addEventListener(\"abort\", onAbort, { once: true });\n child.on(\"error\", (cause) => {\n if (settled)\n return;\n settled = true;\n clearTimeout(timer);\n request.signal.removeEventListener(\"abort\", onAbort);\n reject(request.pty && isMissingBinary(cause) ? execPtyUnavailable(process.platform, String(cause)) : execSpawnFailed(request.command, String(cause)));\n });\n child.on(\"exit\", (code, killedBy) => {\n done({\n ending: killedAtDeadline ? \"killed\" : \"finished\",\n ...code === null ? {} : { code },\n ...killedBy === null ? {} : { killedBy },\n ...child.pid === undefined ? {} : { pid: child.pid }\n });\n });\n }).finally(() => handle.close());\n const status = await readStatus(request.statusPath);\n return {\n ...ending,\n ...status.code === undefined ? {} : { code: status.code },\n ...status.cwd === undefined ? {} : { cwdAfter: status.cwd }\n };\n}\nfunction isMissingBinary(cause) {\n return cause instanceof Error && \"code\" in cause && cause.code === \"ENOENT\";\n}\n\n// src/exec.ts\nvar DEFAULT_TIMEOUT_MS = 120000;\nvar MAX_TIMEOUT_MS = 600000;\nvar DEADLINE_MARGIN_MS = 5000;\nvar EXEC_SPEC = {\n slug: \"exec\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Runs a shell command on this computer and returns what it printed.\",\n whenToUse: \"you need to do something on this machine that no other tool covers — run a build or a test suite, use a command-line program, inspect what is running, or move and archive files in bulk\",\n whenNotToUse: \"reading one file, writing one file, or finding files by name or content — use file_read, file_write, glob and grep instead. They are more reliable and their targets can be checked against the permission rules; a path buried in a shell string cannot be\",\n mutating: true,\n trust: \"untrusted\",\n policyArg: \"command\",\n tags: [\"write\", \"system\", \"shell\"],\n parameters: {\n type: \"object\",\n properties: {\n command: {\n type: \"string\",\n description: \"The command, exactly as it would be typed at a shell prompt. Set environment variables inline (VAR=value command) rather than expecting them to survive from an earlier call.\"\n },\n workdir: {\n type: \"string\",\n description: \"Directory to run in. Relative paths are resolved against wherever the previous command ended up. Defaults to that directory, so a cd carries over.\"\n },\n timeoutMs: {\n type: \"integer\",\n description: `How long to wait, in milliseconds. Default ${DEFAULT_TIMEOUT_MS}, maximum ${MAX_TIMEOUT_MS}.`,\n default: DEFAULT_TIMEOUT_MS\n },\n pty: {\n type: \"boolean\",\n description: \"Give the command a terminal. Needed only by programs that behave differently without one, such as those that ask for a password or draw a progress display.\",\n default: false\n },\n background: {\n type: \"boolean\",\n description: \"Start it and return immediately instead of waiting. Use for something long-running like a dev server; the output keeps accumulating in a file whose path is reported.\",\n default: false\n }\n },\n required: [\"command\"]\n }\n};\nfunction effectiveTimeout(requested, deadlineMs) {\n const asked = requested === undefined || requested <= 0 ? DEFAULT_TIMEOUT_MS : requested;\n const capped = Math.min(asked, MAX_TIMEOUT_MS);\n const room = deadlineMs - DEADLINE_MARGIN_MS;\n return Math.max(1, Math.min(capped, room > 0 ? room : Math.floor(deadlineMs * 0.8)));\n}\nfunction numberArg(value) {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\nfunction paths(context, callSalt) {\n const dir = spillDir();\n return {\n out: resolve2(dir, `${context.turnId}-${callSalt}.log`),\n status: resolve2(dir, `${context.turnId}-${callSalt}.status`)\n };\n}\nfunction execHandler(options) {\n return async (args, context) => {\n const command = typeof args.command === \"string\" ? args.command.trim() : \"\";\n if (command === \"\")\n throw execCommandEmpty();\n const remembered = options.sessions.lastCwd(context.sessionKey);\n const base = remembered ?? options.roots.primary;\n const asked = typeof args.workdir === \"string\" ? args.workdir.trim() : \"\";\n const wanted = asked === \"\" ? base : isAbsolute2(asked) ? asked : resolve2(base, asked);\n let cwd;\n try {\n cwd = await realpath(wanted);\n if (!(await stat(cwd)).isDirectory())\n throw new Error(\"not a directory\");\n } catch {\n const fromMemory = asked === \"\" && remembered !== undefined;\n if (fromMemory)\n options.sessions.forget(context.sessionKey);\n throw execWorkdirMissing(wanted, fromMemory);\n }\n const timeoutMs = effectiveTimeout(numberArg(args.timeoutMs), context.deadlineMs);\n const clamped = numberArg(args.timeoutMs) !== undefined && timeoutMs < Number(args.timeoutMs);\n const background = args.background === true;\n const dir = spillDir();\n await mkdir(dir, { recursive: true });\n const files = paths(context, hashCall(command, context.turnId));\n const run = await runCommand({\n command,\n cwd,\n env: options.env,\n timeoutMs,\n pty: args.pty === true,\n background,\n signal: context.signal,\n outPath: files.out,\n statusPath: files.status\n });\n if (run.cwdAfter !== undefined) {\n options.sessions.remember(context.sessionKey, run.cwdAfter);\n }\n const read = await readOutput(files.out);\n const observation = args.pty === true ? { ...read, head: stripLeadingEcho(read.head) } : read;\n await rm(files.status, { force: true });\n if (!observation.spilled && run.ending !== \"backgrounded\") {\n await rm(files.out, { force: true });\n }\n return render({ command, cwd, run, observation, clamped, timeoutMs, path: files.out });\n };\n}\nfunction hashCall(command, turnId) {\n let hash = 2166136261;\n for (const text of [command, turnId]) {\n for (let i = 0;i < text.length; i += 1) {\n hash ^= text.charCodeAt(i);\n hash = Math.imul(hash, 16777619);\n }\n }\n return (hash >>> 0).toString(16).padStart(8, \"0\");\n}\nfunction render(input) {\n const notes = [];\n if (input.clamped) {\n notes.push(`The requested timeout was longer than allowed, so this ran with ${input.timeoutMs} ms.`);\n }\n if (input.run.ending === \"backgrounded\") {\n notes.push(`Still running${input.run.pid === undefined ? \"\" : ` as process ${input.run.pid}`}. It was left alone rather than stopped, and keeps writing to ${input.path}; read that file to see how far it has got. Nothing here is its final result.`);\n return [...notes, section(\"Output so far\", input.observation.head)].join(`\n\n`);\n }\n if (input.run.ending === \"killed\") {\n notes.push(`Stopped after ${input.timeoutMs} ms without finishing, and everything it started was stopped with it. Whatever it had already done still happened.`);\n } else if (input.run.code !== undefined && input.run.code !== 0) {\n notes.push(`Failed with exit code ${input.run.code}.`);\n } else if (input.run.killedBy !== undefined) {\n notes.push(`Ended on signal ${input.run.killedBy}.`);\n }\n if (input.run.cwdAfter !== undefined && input.run.cwdAfter !== input.cwd) {\n notes.push(`The working directory is now ${input.run.cwdAfter}, and the next exec call starts there.`);\n }\n const failed = input.run.ending === \"killed\" || (input.run.code ?? 0) !== 0;\n const body = [];\n if (input.observation.spilled) {\n notes.push(`Output was ${humanBytes(input.observation.bytes)}, too much to include. All of it is in ${input.path}; what follows is the ${failed ? \"start and end\" : \"start\"}.`);\n body.push(section(\"First part of the output\", input.observation.head));\n if (failed)\n body.push(section(\"End of the output\", input.observation.tail));\n } else if (input.observation.head.trim() !== \"\") {\n body.push(input.observation.head.trimEnd());\n } else if (notes.length === 0) {\n return \"The command finished successfully and printed nothing.\";\n }\n return [...notes, ...body].join(`\n\n`);\n}\nfunction section(title, text) {\n return `${title}:\n${text.trimEnd()}`;\n}\nfunction execTool(options) {\n return {\n spec: locate(EXEC_SPEC, options.roots, [\"command\", \"workdir\"], \"shell\"),\n handler: execHandler(options)\n };\n}\nfunction execFromContext(context, sessions, roots) {\n return execTool({ sessions, env: context.env, roots });\n}\n\n// src/files.ts\nimport { mkdir as mkdir2, readFile as readFile3, stat as stat2, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute as isAbsolute4, resolve as resolve4 } from \"node:path\";\nimport { stripControl as stripControl2 } from \"@dispach/core\";\n\n// src/protect.ts\nimport { isAbsolute as isAbsolute3, relative as relative2, resolve as resolve3, sep as sep2 } from \"node:path\";\nvar PROTECTED_NAMES = [\n \"agent.yaml\",\n \"agent.yml\",\n \"SOUL.md\",\n \"SOUL.compact.md\",\n \"AGENTS.md\",\n \"POLICY.md\",\n \"REMINDER.md\"\n];\nvar PROTECTED_DIRS = [\".ssh\", \".aws\", \".kube\", \".gnupg\", \".docker\"];\nvar PROTECTED_FILE = /^(?:\\.env(\\..+)?|\\.netrc|\\.npmrc|\\.pypirc|id_[a-z0-9]+|.*\\.pem|.*\\.key)$/i;\nfunction segments(path) {\n return path.split(sep2).filter((part) => part !== \"\");\n}\nfunction protectedReason(absolute, options) {\n const parts = segments(absolute);\n const name = parts[parts.length - 1] ?? \"\";\n for (const dir of PROTECTED_DIRS) {\n if (parts.includes(dir)) {\n return `${dir}/ holds credentials, and nothing under it is writable by an agent`;\n }\n }\n if (PROTECTED_FILE.test(name)) {\n return `${name} holds secrets — the manifest names environment variables, and their values are not the agent's to edit`;\n }\n const agentDir = resolve3(options.agentDir);\n const within = relative2(agentDir, absolute);\n const inside = within !== \"\" && !within.startsWith(\"..\") && !isAbsolute3(within);\n if (inside) {\n const tail = within.split(sep2);\n const last = tail[tail.length - 1] ?? \"\";\n if (PROTECTED_NAMES.includes(last)) {\n return `${within} is part of this agent's own definition — who it is, what it does, or what it is permitted to do — and it is not editable from inside a turn`;\n }\n if (tail[0]?.startsWith(\".\") === true) {\n return `${within} is runtime state this agent depends on`;\n }\n }\n for (const pattern of options.extra ?? []) {\n if (absolute.includes(pattern) || name === pattern) {\n return `${name} is listed in tools.providerConfig.protect`;\n }\n }\n return;\n}\n\n// src/files.ts\nvar MAX_READ_BYTES = 2000000;\nvar DEFAULT_READ_LINES = 400;\nfunction looksBinary(bytes) {\n const window = bytes.subarray(0, 8000);\n return window.includes(0);\n}\nvar FILE_READ_SPEC = {\n slug: \"file_read\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Reads a file and returns its contents.\",\n whenToUse: \"you need to see what is in a file — its code, its configuration, its text — before answering about it or changing it\",\n whenNotToUse: \"you are looking for which files exist or which ones mention something; that is glob and grep. Never read a file by running cat through the shell\",\n mutating: false,\n trust: \"untrusted\",\n policyArg: \"path\",\n tags: [\"read\", \"file\"],\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"The file, absolute or relative to the current working directory.\"\n },\n offset: {\n type: \"integer\",\n description: \"First line to return, counting from 1. Use for a long file.\"\n },\n limit: {\n type: \"integer\",\n description: `How many lines to return. Defaults to ${DEFAULT_READ_LINES}.`,\n default: DEFAULT_READ_LINES\n }\n },\n required: [\"path\"]\n }\n};\nvar FILE_WRITE_SPEC = {\n slug: \"file_write\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Writes a file, creating any folders it needs, and replaces it if it already exists.\",\n whenToUse: \"you are creating a new file, or replacing one whose whole contents you are producing. Folders in the path are created for you, so this needs no separate step and no shell\",\n whenNotToUse: \"you are changing part of an existing file — that is file_edit, which cannot silently destroy the rest of it\",\n mutating: true,\n trust: \"trusted\",\n trustReason: \"It reports what it wrote — the path, the line count — and never any of the content, so nothing from the file reaches the model through it.\",\n policyArg: \"path\",\n tags: [\"write\", \"file\"],\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"The file, absolute or relative to the current working directory.\"\n },\n content: { type: \"string\", description: \"The complete new contents.\" }\n },\n required: [\"path\", \"content\"]\n }\n};\nvar FILE_EDIT_SPEC = {\n slug: \"file_edit\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Replaces an exact piece of text in a file, leaving the rest untouched.\",\n whenToUse: \"you are changing part of a file you have already read — a line, a block, a value — and everything else should stay as it is\",\n whenNotToUse: \"you have not read the file in this conversation, or you are writing the whole thing; guessing at text that is already there fails rather than damaging the file, but it still wastes the step\",\n mutating: true,\n trust: \"trusted\",\n trustReason: \"It reports which occurrence changed and how long the file now is, never the text on either side of the change.\",\n policyArg: \"path\",\n tags: [\"write\", \"file\"],\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"The file, absolute or relative to the current working directory.\"\n },\n find: {\n type: \"string\",\n description: \"The exact text to replace, copied from the file including its indentation. It must appear exactly once unless all is true.\"\n },\n replace: { type: \"string\", description: \"What to put in its place.\" },\n all: {\n type: \"boolean\",\n description: \"Replace every occurrence instead of requiring exactly one.\",\n default: false\n }\n },\n required: [\"path\", \"find\", \"replace\"]\n }\n};\nfunction resolvePath(raw, sessions, sessionKey, base) {\n const given = expandTilde(typeof raw === \"string\" ? raw.trim() : \"\");\n if (given === \"\")\n throw filePathEmpty();\n const from = sessions.lastCwd(sessionKey) ?? base;\n return isAbsolute4(given) ? resolve4(given) : resolve4(from, given);\n}\nfunction assertWritable(path, options) {\n if (!isWritable(path, options.roots)) {\n throw fileOutsideRoot(path, writable(options.roots));\n }\n const refusal = protectedReason(path, {\n agentDir: options.agentDir,\n ...options.protect === undefined ? {} : { extra: options.protect }\n });\n if (refusal !== undefined)\n throw fileProtected(path, refusal);\n}\nfunction numberArg2(value) {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\nfunction fileReadHandler(options) {\n return async (args, context) => {\n const path = resolvePath(args.path, options.sessions, context.sessionKey, options.roots.primary);\n let size;\n try {\n size = (await stat2(path)).size;\n } catch {\n throw fileMissing(path);\n }\n if (size > MAX_READ_BYTES)\n throw fileTooLarge(path, size, MAX_READ_BYTES);\n const bytes = await readFile3(path);\n if (looksBinary(bytes))\n throw fileIsBinary(path, size);\n const text = stripControl2(bytes.toString(\"utf8\"));\n const lines = text.split(`\n`);\n const offset = Math.max(1, numberArg2(args.offset) ?? 1);\n const limit = Math.max(1, numberArg2(args.limit) ?? DEFAULT_READ_LINES);\n const slice = lines.slice(offset - 1, offset - 1 + limit);\n if (slice.length === 0) {\n return `${path} has ${lines.length} lines, so there is nothing at line ${offset}.`;\n }\n const body = slice.join(`\n`);\n const shown = offset - 1 + slice.length;\n if (offset === 1 && shown >= lines.length)\n return body;\n return `Lines ${offset}-${shown} of ${lines.length} in ${path}:\n${body}`;\n };\n}\nfunction fileWriteHandler(options) {\n return async (args, context) => {\n const path = resolvePath(args.path, options.sessions, context.sessionKey, options.roots.primary);\n assertWritable(path, options);\n const content = typeof args.content === \"string\" ? args.content : String(args.content ?? \"\");\n const existed = await stat2(path).then(() => true, () => false);\n await mkdir2(dirname(path), { recursive: true });\n await writeFile(path, content, \"utf8\");\n const lines = content === \"\" ? 0 : content.split(`\n`).length;\n return `${existed ? \"Replaced\" : \"Created\"} ${path} — ${lines} line${lines === 1 ? \"\" : \"s\"}, ${content.length} characters.`;\n };\n}\nfunction fileEditHandler(options) {\n return async (args, context) => {\n const path = resolvePath(args.path, options.sessions, context.sessionKey, options.roots.primary);\n assertWritable(path, options);\n const find = typeof args.find === \"string\" ? args.find : \"\";\n const replace = typeof args.replace === \"string\" ? args.replace : \"\";\n let before;\n try {\n before = await readFile3(path, \"utf8\");\n } catch {\n throw fileMissing(path);\n }\n const occurrences = find === \"\" ? 0 : before.split(find).length - 1;\n if (occurrences === 0)\n throw fileEditNoMatch(path, find);\n if (occurrences > 1 && args.all !== true)\n throw fileEditAmbiguous(path, occurrences);\n const after = args.all === true ? before.split(find).join(replace) : before.replace(find, replace);\n await writeFile(path, after, \"utf8\");\n const changed = args.all === true ? occurrences : 1;\n return `Edited ${path} — replaced ${changed} occurrence${changed === 1 ? \"\" : \"s\"}. The file is now ${after.split(`\n`).length} lines.`;\n };\n}\nfunction fileTools(options) {\n const at = (spec) => locate(spec, options.roots, [\"path\"]);\n return [\n { spec: at(FILE_READ_SPEC), handler: fileReadHandler(options) },\n { spec: at(FILE_WRITE_SPEC), handler: fileWriteHandler(options) },\n { spec: at(FILE_EDIT_SPEC), handler: fileEditHandler(options) }\n ];\n}\n\n// src/search.ts\nimport { readFile as readFile4 } from \"node:fs/promises\";\nimport { stripControl as stripControl3 } from \"@dispach/core\";\n\n// src/walk.ts\nimport { readdir } from \"node:fs/promises\";\nimport { join as join3, relative as relative3, sep as sep3 } from \"node:path\";\nvar SKIPPED_DIRS = new Set([\n \"node_modules\",\n \".git\",\n \".hg\",\n \".svn\",\n \"dist\",\n \"build\",\n \"out\",\n \".next\",\n \".turbo\",\n \".cache\",\n \"coverage\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n \"target\",\n \"vendor\"\n]);\nfunction globToRegExp(pattern) {\n let source = \"\";\n for (let i = 0;i < pattern.length; i += 1) {\n const char = pattern[i] ?? \"\";\n if (char === \"*\") {\n if (pattern[i + 1] === \"*\") {\n if (pattern[i + 2] === \"/\") {\n source += \"(?:.*/)?\";\n i += 2;\n continue;\n }\n source += \".*\";\n i += 1;\n continue;\n }\n source += \"[^/]*\";\n continue;\n }\n if (char === \"?\") {\n source += \"[^/]\";\n continue;\n }\n source += char.replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n return new RegExp(`^${source}$`);\n}\nfunction posix(path) {\n return sep3 === \"/\" ? path : path.split(sep3).join(\"/\");\n}\nasync function walk(root, options) {\n const files = [];\n const queue = [root];\n while (queue.length > 0) {\n const dir = queue.shift();\n if (dir === undefined)\n break;\n let entries;\n try {\n entries = await readdir(dir, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const entry of entries) {\n const full = join3(dir, entry.name);\n if (entry.isDirectory()) {\n if (SKIPPED_DIRS.has(entry.name))\n continue;\n if (options.hidden !== true && entry.name.startsWith(\".\"))\n continue;\n queue.push(full);\n continue;\n }\n if (!entry.isFile())\n continue;\n if (options.hidden !== true && entry.name.startsWith(\".\"))\n continue;\n const rel = posix(relative3(root, full));\n if (options.accept !== undefined && !options.accept(rel))\n continue;\n if (files.length >= options.limit)\n return { files, truncated: true };\n files.push(rel);\n }\n }\n return { files, truncated: false };\n}\n\n// src/search.ts\nvar MAX_GLOB_RESULTS = 200;\nvar MAX_GREP_MATCHES = 100;\nvar MAX_GREP_FILE_BYTES = 1e6;\nvar GLOB_SPEC = {\n slug: \"glob\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Finds files whose path matches a pattern.\",\n whenToUse: \"you need to know which files exist, or where a file is, when you know something about its name — every test file, every yaml, anything under a directory\",\n whenNotToUse: \"you know what a file is called and want to see it, which is file_read; or you are searching for text inside files, which is grep\",\n mutating: false,\n trust: \"untrusted\",\n policyArg: \"pattern\",\n tags: [\"read\", \"file\", \"search\"],\n parameters: {\n type: \"object\",\n properties: {\n pattern: {\n type: \"string\",\n description: \"A path pattern. * matches within one directory, ** matches across directories — for example **/*.test.ts or src/**/index.*\"\n },\n path: {\n type: \"string\",\n description: \"Directory to search under. Defaults to the current directory.\"\n },\n hidden: {\n type: \"boolean\",\n description: \"Include files and directories whose name begins with a dot.\",\n default: false\n }\n },\n required: [\"pattern\"]\n }\n};\nvar GREP_SPEC = {\n slug: \"grep\",\n provider: SYSTEM_PROVIDER_ID,\n summary: \"Finds lines in files that match a regular expression.\",\n whenToUse: \"you need to find where something is written — a function name, a setting, a phrase — without knowing which file it is in\",\n whenNotToUse: \"you are looking for files by name, which is glob; or you already know the file, in which case read it. Never run grep or rg through the shell\",\n mutating: false,\n trust: \"untrusted\",\n policyArg: \"pattern\",\n tags: [\"read\", \"file\", \"search\"],\n parameters: {\n type: \"object\",\n properties: {\n pattern: {\n type: \"string\",\n description: \"A regular expression, matched against each line.\"\n },\n path: {\n type: \"string\",\n description: \"Directory to search under. Defaults to the current directory.\"\n },\n glob: {\n type: \"string\",\n description: \"Only search files whose path matches this, for example **/*.ts. Searches everything if omitted.\"\n },\n ignoreCase: {\n type: \"boolean\",\n description: \"Match regardless of case.\",\n default: false\n }\n },\n required: [\"pattern\"]\n }\n};\nfunction rootFor(args, options, key) {\n const given = typeof args.path === \"string\" && args.path.trim() !== \"\" ? args.path : \".\";\n return resolvePath(given, options.sessions, key, options.roots.primary);\n}\nfunction globHandler(options) {\n return async (args, context) => {\n const pattern = typeof args.pattern === \"string\" ? args.pattern.trim() : \"\";\n const root = rootFor(args, options, context.sessionKey);\n const matcher = globToRegExp(pattern);\n const result = await walk(root, {\n limit: MAX_GLOB_RESULTS,\n ...args.hidden === true ? { hidden: true } : {},\n accept: (relative) => matcher.test(relative)\n });\n if (result.files.length === 0) {\n return `No file under ${root} matches ${pattern}. Directories like node_modules, .git and dist are never searched${args.hidden === true ? \"\" : \", and dot-files are skipped unless hidden is true\"}.`;\n }\n const header = result.truncated ? `The first ${result.files.length} of more than ${MAX_GLOB_RESULTS} matches for ${pattern} under ${root} — narrow the pattern to see the rest:` : `${result.files.length} match${result.files.length === 1 ? \"\" : \"es\"} for ${pattern} under ${root}:`;\n return `${header}\n${result.files.join(`\n`)}`;\n };\n}\nfunction grepHandler(options) {\n return async (args, context) => {\n const source = typeof args.pattern === \"string\" ? args.pattern : \"\";\n const root = rootFor(args, options, context.sessionKey);\n let expression;\n try {\n expression = new RegExp(source, args.ignoreCase === true ? \"i\" : \"\");\n } catch (cause) {\n throw grepPatternInvalid(source, String(cause));\n }\n const fileGlob = typeof args.glob === \"string\" && args.glob.trim() !== \"\" ? globToRegExp(args.glob.trim()) : undefined;\n const found = await walk(root, {\n limit: 5000,\n ...fileGlob === undefined ? {} : { accept: (rel) => fileGlob.test(rel) }\n });\n const hits = [];\n let scanned = 0;\n let capped = false;\n for (const relative of found.files) {\n if (hits.length >= MAX_GREP_MATCHES) {\n capped = true;\n break;\n }\n let text;\n try {\n const bytes = await readFile4(`${root}/${relative}`);\n if (bytes.length > MAX_GREP_FILE_BYTES || bytes.subarray(0, 8000).includes(0)) {\n continue;\n }\n text = bytes.toString(\"utf8\");\n } catch {\n continue;\n }\n scanned += 1;\n const lines = text.split(`\n`);\n for (let i = 0;i < lines.length; i += 1) {\n const line = lines[i] ?? \"\";\n if (!expression.test(line))\n continue;\n if (hits.length >= MAX_GREP_MATCHES) {\n capped = true;\n break;\n }\n const shown = line.length > 300 ? `${line.slice(0, 300)}…` : line;\n hits.push(`${relative}:${i + 1}: ${stripControl3(shown).trim()}`);\n }\n }\n if (hits.length === 0) {\n return `Nothing under ${root} matches ${source}${fileGlob === undefined ? \"\" : ` in files matching ${String(args.glob)}`}. ${scanned} file${scanned === 1 ? \"\" : \"s\"} were searched; node_modules, .git, dist and dot-files are skipped.`;\n }\n const header = capped ? `The first ${hits.length} matches for ${source} under ${root} — there are more, so narrow the pattern or pass a glob:` : `${hits.length} match${hits.length === 1 ? \"\" : \"es\"} for ${source} under ${root}, across ${scanned} file${scanned === 1 ? \"\" : \"s\"} searched:`;\n return `${header}\n${hits.join(`\n`)}`;\n };\n}\nfunction searchTools(options) {\n const at = (spec) => locate(spec, options.roots, [\"path\"]);\n return [\n { spec: at(GLOB_SPEC), handler: globHandler(options) },\n { spec: at(GREP_SPEC), handler: grepHandler(options) }\n ];\n}\n\n// src/session.ts\nclass ShellSessions {\n #cwd = new Map;\n lastCwd(sessionKey) {\n return this.#cwd.get(sessionKey);\n }\n remember(sessionKey, cwd) {\n this.#cwd.set(sessionKey, cwd);\n }\n forget(sessionKey) {\n this.#cwd.delete(sessionKey);\n }\n}\n\n// src/provider.ts\nfunction normalise(slug) {\n return slug.toLowerCase().replace(/[\\s_.-]+/g, \"\");\n}\n\nclass SystemProvider {\n id = SYSTEM_PROVIDER_ID;\n #sessions = new ShellSessions;\n #tools;\n constructor(options) {\n const roots = resolveRoots(options.dir, options.writeRoots ?? []);\n const shared = {\n sessions: this.#sessions,\n agentDir: options.dir,\n roots,\n ...options.protect === undefined ? {} : { protect: options.protect }\n };\n this.#tools = [\n execTool({ sessions: this.#sessions, env: options.env, roots }),\n ...fileTools(shared),\n ...searchTools({ sessions: this.#sessions, roots }),\n ...configTools({ agentDir: options.dir })\n ];\n }\n available() {\n return Promise.resolve(this.#tools.map((tool) => ({ slug: tool.spec.slug, summary: tool.spec.summary })));\n }\n resolve(slugs) {\n const wanted = new Set(slugs.map(normalise));\n return Promise.resolve(this.#tools.filter((tool) => wanted.has(normalise(tool.spec.slug))));\n }\n stop() {\n return Promise.resolve(reapBackgrounded());\n }\n list() {\n return Promise.resolve(this.#tools.map((tool) => tool.spec.slug));\n }\n}\nvar SYSTEM_TOOL_SLUGS = [\n \"exec\",\n \"file_read\",\n \"file_write\",\n \"file_edit\",\n \"glob\",\n \"grep\",\n \"config_read\",\n \"config_set\"\n];\nvar SYSTEM_READONLY_SLUGS = [\"file_read\", \"glob\", \"grep\"];\nvar CONFIG_KEYS = [\"protect\", \"writeRoots\"];\nfunction systemFromConfig(context) {\n const unknown = Object.keys(context.config).filter((key) => !CONFIG_KEYS.includes(key));\n if (unknown.length > 0) {\n throw new ConfigError2({\n code: \"system_config_unknown\",\n message: `tools.providerConfig has ${unknown.length === 1 ? \"a key\" : \"keys\"} the system provider does not read: ${unknown.join(\", \")}.`,\n hint: `Accepted keys are ${CONFIG_KEYS.join(\", \")} — extra paths the file tools refuse to write, and extra directories they may write. Refused rather than ignored, because a protection that looks applied and is not is worse than a rejected manifest.`,\n field: \"tools.providerConfig\"\n });\n }\n const protect = context.config.protect;\n const writeRoots = context.config.writeRoots;\n return new SystemProvider({\n env: context.env,\n dir: context.dir,\n ...Array.isArray(protect) ? { protect: protect.map((entry) => String(entry)) } : {},\n ...Array.isArray(writeRoots) ? { writeRoots: writeRoots.map((entry) => String(entry)) } : {}\n });\n}\n\n// src/scripts.ts\nimport { statSync } from \"node:fs\";\nimport { mkdir as mkdir3, rm as rm2 } from \"node:fs/promises\";\nimport { delimiter, join as join4 } from \"node:path\";\nfunction quote(value) {\n return `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n\nclass SystemScriptRunner {\n #env;\n constructor(options) {\n this.#env = options.env;\n }\n has(command) {\n const path = this.#env.PATH ?? process.env.PATH ?? \"\";\n for (const dir of path.split(delimiter)) {\n if (dir === \"\")\n continue;\n try {\n const found = statSync(join4(dir, command));\n if (found.isFile() && (found.mode & 73) !== 0)\n return true;\n } catch {}\n }\n return false;\n }\n async run(request) {\n const dir = spillDir();\n await mkdir3(dir, { recursive: true });\n const stamp = fingerprint([request.command, ...request.args].join(\" \"));\n const outPath = join4(dir, `skill-${stamp}.out`);\n const statusPath = join4(dir, `skill-${stamp}.status`);\n const line = [request.command, ...request.args].map(quote).join(\" \");\n const run = await runCommand({\n command: line,\n cwd: request.cwd,\n env: this.#env,\n timeoutMs: request.timeoutMs,\n pty: false,\n background: false,\n signal: request.signal,\n outPath,\n statusPath\n });\n const observation = await readOutput(outPath);\n await rm2(statusPath, { force: true });\n if (!observation.spilled && run.ending !== \"backgrounded\") {\n await rm2(outPath, { force: true });\n }\n const timedOut = run.ending === \"killed\" || run.ending === \"backgrounded\";\n const body = observation.spilled ? `${observation.head}\n\n… ${observation.bytes} bytes in total; the rest is at ${outPath}\n\n${observation.tail}` : observation.head;\n return {\n ok: run.ending === \"finished\" && run.code === 0,\n output: run.ending === \"backgrounded\" ? `${body}\n\nStill running past ${request.timeoutMs} ms, left going rather than discarded. Output continues to accumulate at ${outPath}.` : body,\n ...run.code === undefined ? {} : { code: run.code },\n timedOut\n };\n }\n}\nfunction fingerprint(text) {\n let hash = 2166136261;\n for (let index = 0;index < text.length; index += 1) {\n hash ^= text.charCodeAt(index);\n hash = Math.imul(hash, 16777619);\n }\n return (hash >>> 0).toString(16).padStart(8, \"0\");\n}\n\n// src/index.ts\nvar VERSION = \"0.1.0\";\nvar src_default = {\n name: \"system\",\n version: VERSION,\n dispachApi: \"^0.1\",\n permissions: [\n { kind: \"exec\", commands: [\"*\"] },\n { kind: \"fs\", paths: [\"<workspace>\"], mode: \"write\" }\n ],\n setup(context) {\n context.defineToolProvider(\"system\", systemFromConfig);\n context.defineScriptRunner(new SystemScriptRunner({ env: context.env }));\n }\n};\nexport {\n CONFIG_READ_SPEC,\n CONFIG_SET_SPEC,\n DEFAULT_TIMEOUT_MS,\n EXEC_SPEC,\n INLINE_CAP,\n MAX_BACKGROUNDED,\n MAX_TIMEOUT_MS,\n SETTABLE_PATHS,\n SYSTEM_PROVIDER_ID,\n SYSTEM_READONLY_SLUGS,\n SYSTEM_TOOL_SLUGS,\n ShellSessions,\n SystemProvider,\n SystemScriptRunner,\n VERSION,\n backgroundable,\n backgroundedCommands,\n buildWrapper,\n commandLine,\n configReadHandler,\n configSetHandler,\n configTools,\n src_default as default,\n effectiveTimeout,\n execCommandEmpty,\n execFromContext,\n execHandler,\n execPtyUnavailable,\n execSpawnFailed,\n execTool,\n execWorkdirMissing,\n humanBytes,\n parseValue,\n readOutput,\n readStatus,\n reapBackgrounded,\n render,\n runCommand,\n spillDir,\n stripLeadingEcho,\n systemFromConfig\n};\n\n//# debugId=D06E3715E87AA2DF64756E2164756E21\n//# sourceMappingURL=index.js.map\n",
10
- "// src/provider.ts\nimport {\n ConfigError as ConfigError2\n} from \"@dispach/core\";\n\n// src/errors.ts\nimport { ConfigError, ToolError } from \"@dispach/core\";\nfunction webUrlUnparseable(raw, cause) {\n return new ToolError({\n code: \"web_url_unparseable\",\n message: `That is not a URL: ${JSON.stringify(raw)}`,\n hint: `${cause}. Give a complete absolute URL including the scheme — https://example.com/page, not example.com/page. Parsed with the standard URL parser rather than a pattern, so what is accepted here is exactly what a browser would accept.`,\n field: \"url\"\n });\n}\nfunction webSchemeRefused(scheme) {\n return new ToolError({\n code: \"web_scheme_refused\",\n message: `${scheme} URLs are not fetchable.`,\n hint: \"Only http and https. This tool reaches the public web and nothing else — a file:// URL reads the disk, which is file_read's job and subject to its rules, and the other schemes reach services that were never designed to be spoken to by an HTTP client.\",\n field: \"url\"\n });\n}\nfunction webCredentialsRefused() {\n return new ToolError({\n code: \"web_credentials_refused\",\n message: \"That URL carries a username and password.\",\n hint: \"Refused rather than stripped: a URL with credentials in it is either a secret that should not be in a conversation, or an attempt to make the host look like something it is not. Fetch the address on its own if the page is public.\",\n field: \"url\"\n });\n}\nfunction webAddressRefused(host, address, kind, range, hop) {\n const where = address === host ? address : `${host} → ${address}`;\n return new ToolError({\n code: \"web_address_refused\",\n message: `${where} is ${kind}${range === undefined ? \"\" : ` (${range})`} and will not be fetched${hop > 0 ? `, reached by redirect ${hop}` : \"\"}.`,\n hint: \"This is a standing rule with no setting that overrides it. Addresses off the public internet — loopback, link-local, private and carrier-grade NAT ranges — include the cloud metadata endpoint and every service on this machine, so a page that can make this tool fetch one is a page that can read them. Nothing was requested. If the page is genuinely public, check the hostname.\",\n field: \"url\"\n });\n}\nfunction webHostRefused(host, why) {\n return new ToolError({\n code: \"web_host_refused\",\n message: `${host} is not a public hostname: ${why}.`,\n hint: \"Nothing was requested. This tool reaches the public web; names that only resolve inside this machine or this network are refused before any lookup happens.\",\n field: \"url\"\n });\n}\nfunction webHostUnresolvable(host, cause) {\n return new ToolError({\n code: \"web_host_unresolvable\",\n message: `${host} could not be resolved: ${cause}`,\n hint: \"Refused rather than handed to the HTTP client anyway. The address check happens on what DNS returns, so a name that will not resolve here cannot be checked — and fetching it regardless would mean the one request nobody looked at is the one that failed the lookup. Check the spelling of the host.\",\n field: \"url\"\n });\n}\nfunction webRequestFailed(url, cause) {\n return new ToolError({\n code: \"web_request_failed\",\n message: `The request to ${url} did not complete: ${cause}`,\n hint: \"The address passed every check, so this is the network or the far end rather than a refusal. Worth one retry if it reads like a timeout; not worth retrying if the host is simply gone.\",\n field: \"url\"\n });\n}\nfunction webStatusFailed(url, status, statusText) {\n return new ToolError({\n code: \"web_status_failed\",\n message: `${url} answered ${status}${statusText === \"\" ? \"\" : ` ${statusText}`}.`,\n hint: `${status === 404 ? \"The page is not there — check the URL against a search result rather than guessing at the path.\" : status === 403 || status === 401 ? \"The page requires credentials or refuses automated clients. There is no setting that supplies either; treat the page as unavailable and say so.\" : \"A server-side failure. One retry is reasonable; a second is not.\"}`,\n field: \"url\"\n });\n}\nfunction webTooManyRedirects(url, max) {\n return new ToolError({\n code: \"web_too_many_redirects\",\n message: `${url} redirected more than ${max} times.`,\n hint: \"Followed manually and re-checked at every hop, which is why the count is low — a redirect chain is the standard way to get a checked URL to end up somewhere unchecked. A chain this long is a redirect loop or a tracker, not a page.\",\n field: \"url\"\n });\n}\nfunction webContentUnusable(url, type) {\n return new ToolError({\n code: \"web_content_unusable\",\n message: `${url} returned ${type}, which has no text to extract.`,\n hint: \"Refused rather than decoded: a binary rendered as text is thousands of meaningless tokens and no information. This tool reads HTML, plain text, JSON and similar. PDF and image extraction are deliberately not in scope.\",\n field: \"url\"\n });\n}\nfunction webSearchKeyMissing(backend, variable) {\n return new ConfigError({\n code: \"web_search_key_missing\",\n message: `The ${backend} search backend needs ${variable} and it is not set.`,\n hint: `Set ${variable} in the .env beside agent.yaml, or in the environment. The manifest names the variable and never holds the key — a manifest with a literal key fails validation.`,\n field: \"tools.providers.web.apiKeyEnv\"\n });\n}\nfunction webSearchFailed(backend, status, detail) {\n return new ToolError({\n code: \"web_search_failed\",\n message: `${backend} answered ${status}: ${detail}`,\n hint: `${status === 401 || status === 403 ? \"The API key was rejected. Check the value of the variable named in tools.providers.web.apiKeyEnv — the manifest holds the name, the .env holds the key.\" : status === 429 ? \"Rate limited. This is the backend's own quota; nothing in the manifest raises it.\" : \"A failure at the search backend rather than in the query.\"}`\n });\n}\nfunction webConfigInvalid(key, why) {\n return new ConfigError({\n code: \"web_config_invalid\",\n message: `tools.providers.web.${key} ${why}`,\n hint: \"Refused rather than defaulted around: a search backend silently different from the one configured returns different results with nothing reporting why.\",\n field: `tools.providers.web.${key}`\n });\n}\n\n// src/backends.ts\nvar BACKEND_IDS = [\"tavily\", \"brave\", \"exa\"];\nfunction field(value, key) {\n return typeof value === \"object\" && value !== null ? value[key] : undefined;\n}\nfunction text(value) {\n return typeof value === \"string\" ? value : \"\";\n}\nfunction rows(value) {\n return Array.isArray(value) ? value : [];\n}\nvar TAVILY = {\n id: \"tavily\",\n defaultKeyEnv: \"TAVILY_API_KEY\",\n request(query, maxResults, apiKey) {\n return {\n url: \"https://api.tavily.com/search\",\n init: {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${apiKey}`,\n \"content-type\": \"application/json\"\n },\n body: JSON.stringify({\n query,\n max_results: maxResults,\n search_depth: \"basic\",\n include_answer: false\n })\n }\n };\n },\n read(payload) {\n return rows(field(payload, \"results\")).map((row) => ({\n title: text(field(row, \"title\")),\n url: text(field(row, \"url\")),\n snippet: text(field(row, \"content\"))\n }));\n }\n};\nvar BRAVE = {\n id: \"brave\",\n defaultKeyEnv: \"BRAVE_API_KEY\",\n request(query, maxResults, apiKey) {\n const url = new URL(\"https://api.search.brave.com/res/v1/web/search\");\n url.searchParams.set(\"q\", query);\n url.searchParams.set(\"count\", String(maxResults));\n return {\n url: url.href,\n init: {\n method: \"GET\",\n headers: {\n accept: \"application/json\",\n \"x-subscription-token\": apiKey\n }\n }\n };\n },\n read(payload) {\n return rows(field(field(payload, \"web\"), \"results\")).map((row) => ({\n title: text(field(row, \"title\")),\n url: text(field(row, \"url\")),\n snippet: text(field(row, \"description\"))\n }));\n }\n};\nvar EXA = {\n id: \"exa\",\n defaultKeyEnv: \"EXA_API_KEY\",\n request(query, maxResults, apiKey) {\n return {\n url: \"https://api.exa.ai/search\",\n init: {\n method: \"POST\",\n headers: {\n \"x-api-key\": apiKey,\n \"content-type\": \"application/json\"\n },\n body: JSON.stringify({\n query,\n numResults: maxResults,\n contents: { text: { maxCharacters: 400 } }\n })\n }\n };\n },\n read(payload) {\n return rows(field(payload, \"results\")).map((row) => ({\n title: text(field(row, \"title\")),\n url: text(field(row, \"url\")),\n snippet: text(field(row, \"text\")) || text(field(row, \"snippet\"))\n }));\n }\n};\nvar BY_ID = { tavily: TAVILY, brave: BRAVE, exa: EXA };\nfunction backend(id) {\n return BY_ID[id];\n}\nasync function readError(id, response) {\n let detail = response.statusText;\n try {\n const body = await response.text();\n if (body !== \"\")\n detail = body.length > 300 ? `${body.slice(0, 300)}…` : body;\n } catch {}\n throw webSearchFailed(id, response.status, detail);\n}\n\n// src/extract.ts\nvar DROPPED = [\"script\", \"style\", \"noscript\", \"template\", \"svg\", \"canvas\", \"iframe\", \"head\"];\nvar BREAKING = /<\\/?(?:p|div|br|hr|section|article|header|footer|nav|aside|main|h[1-6]|li|tr|td|th|blockquote|pre|figcaption|dt|dd)\\b[^>]*>/gi;\nvar NAMED_ENTITIES = {\n amp: \"&\",\n lt: \"<\",\n gt: \">\",\n quot: '\"',\n apos: \"'\",\n nbsp: \" \",\n hellip: \"…\",\n mdash: \"—\",\n ndash: \"–\",\n lsquo: \"‘\",\n rsquo: \"’\",\n ldquo: \"“\",\n rdquo: \"”\",\n times: \"×\",\n middot: \"·\",\n bull: \"•\",\n copy: \"©\",\n reg: \"®\",\n trade: \"™\",\n deg: \"°\",\n eacute: \"é\",\n egrave: \"è\",\n agrave: \"à\",\n ccedil: \"ç\",\n uuml: \"ü\",\n ouml: \"ö\",\n auml: \"ä\"\n};\nfunction decodeEntities(value) {\n return value.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]{1,31});/g, (whole, body) => {\n if (body.startsWith(\"#\")) {\n const code = body.startsWith(\"#x\") || body.startsWith(\"#X\") ? Number.parseInt(body.slice(2), 16) : Number.parseInt(body.slice(1), 10);\n if (!Number.isFinite(code) || code < 0 || code > 1114111)\n return whole;\n if (code >= 55296 && code <= 57343)\n return whole;\n return String.fromCodePoint(code);\n }\n return NAMED_ENTITIES[body.toLowerCase()] ?? whole;\n });\n}\nfunction extractTitle(html) {\n const match = /<title\\b[^>]*>([\\s\\S]*?)<\\/title>/i.exec(html);\n if (match === null)\n return;\n const title = collapse(decodeEntities(match[1] ?? \"\"));\n return title === \"\" ? undefined : title;\n}\nfunction htmlToText(html) {\n let text = html;\n for (const tag of DROPPED) {\n text = text.replace(new RegExp(`<${tag}\\\\b[^>]*>[\\\\s\\\\S]*?</${tag}>`, \"gi\"), \" \");\n text = text.replace(new RegExp(`<${tag}\\\\b[^>]*>[\\\\s\\\\S]*$`, \"i\"), \" \");\n }\n text = text.replace(/<!--[\\s\\S]*?-->/g, \" \");\n text = text.replace(BREAKING, `\n`);\n text = text.replace(/<[^>]*>/g, \" \");\n text = decodeEntities(text);\n return text.split(`\n`).map((line) => collapse(line)).filter((line, index, lines) => line !== \"\" || (lines[index - 1] ?? \"\") !== \"\").join(`\n`).trim();\n}\nfunction collapse(value) {\n return value.replace(/\\s+/g, \" \").trim();\n}\nfunction extract(body, contentType) {\n const type = contentType.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n if (type.includes(\"html\") || type.includes(\"xml\")) {\n const title = extractTitle(body);\n return { text: htmlToText(body), ...title === undefined ? {} : { title } };\n }\n return { text: body.trim() };\n}\nfunction isTextual(contentType) {\n const type = contentType.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n if (type === \"\")\n return true;\n if (type.startsWith(\"text/\"))\n return true;\n return /^application\\/(?:json|xml|xhtml\\+xml|ld\\+json|rss\\+xml|atom\\+xml|javascript|x-ndjson)$/.test(type);\n}\n\n// src/guard.ts\nimport { lookup } from \"node:dns/promises\";\n\n// src/address.ts\nvar PUBLIC = { kind: \"public\" };\nfunction parseIPv4(value) {\n const parts = value.split(\".\");\n if (parts.length !== 4)\n return;\n const octets = [];\n for (const part of parts) {\n if (part.length === 0 || part.length > 3 || !/^[0-9]+$/.test(part))\n return;\n if (part.length > 1 && part.startsWith(\"0\"))\n return;\n const octet = Number(part);\n if (octet > 255)\n return;\n octets.push(octet);\n }\n return octets;\n}\nfunction parseIPv6(value) {\n const address = value.split(\"%\")[0] ?? \"\";\n if (address === \"\")\n return;\n if (!/^[0-9a-fA-F:.]+$/.test(address))\n return;\n const halves = address.split(\"::\");\n if (halves.length > 2)\n return;\n const expand = (part) => {\n if (part === \"\")\n return [];\n const groups = part.split(\":\");\n const bytes = [];\n for (let index = 0;index < groups.length; index += 1) {\n const group = groups[index] ?? \"\";\n if (group.includes(\".\")) {\n if (index !== groups.length - 1)\n return;\n const quad = parseIPv4(group);\n if (quad === undefined)\n return;\n bytes.push(...quad);\n continue;\n }\n if (group.length === 0 || group.length > 4)\n return;\n const word = Number.parseInt(group, 16);\n if (Number.isNaN(word))\n return;\n bytes.push(word >> 8 & 255, word & 255);\n }\n return bytes;\n };\n if (halves.length === 1) {\n const bytes = expand(address);\n return bytes !== undefined && bytes.length === 16 ? bytes : undefined;\n }\n const head = expand(halves[0] ?? \"\");\n const tail = expand(halves[1] ?? \"\");\n if (head === undefined || tail === undefined)\n return;\n const gap = 16 - head.length - tail.length;\n if (gap < 0)\n return;\n return [...head, ...new Array(gap).fill(0), ...tail];\n}\nfunction classifyIPv4(octets) {\n const [a = 0, b = 0, c = 0, d = 0] = octets;\n if (a === 0)\n return { kind: \"unspecified\", range: \"0.0.0.0/8\" };\n if (a === 127)\n return { kind: \"loopback\", range: \"127.0.0.0/8\" };\n if (a === 10)\n return { kind: \"private\", range: \"10.0.0.0/8\" };\n if (a === 172 && b >= 16 && b <= 31)\n return { kind: \"private\", range: \"172.16.0.0/12\" };\n if (a === 192 && b === 168)\n return { kind: \"private\", range: \"192.168.0.0/16\" };\n if (a === 100 && b >= 64 && b <= 127)\n return { kind: \"cgnat\", range: \"100.64.0.0/10\" };\n if (a === 169 && b === 254)\n return { kind: \"link-local\", range: \"169.254.0.0/16\" };\n if (a === 192 && b === 0 && c === 0)\n return { kind: \"reserved\", range: \"192.0.0.0/24\" };\n if (a === 192 && b === 0 && c === 2)\n return { kind: \"reserved\", range: \"192.0.2.0/24 (TEST-NET-1)\" };\n if (a === 198 && (b === 18 || b === 19))\n return { kind: \"reserved\", range: \"198.18.0.0/15\" };\n if (a === 198 && b === 51 && c === 100) {\n return { kind: \"reserved\", range: \"198.51.100.0/24 (TEST-NET-2)\" };\n }\n if (a === 203 && b === 0 && c === 113) {\n return { kind: \"reserved\", range: \"203.0.113.0/24 (TEST-NET-3)\" };\n }\n if (a >= 224 && a <= 239)\n return { kind: \"multicast\", range: \"224.0.0.0/4\" };\n if (a === 255 && b === 255 && c === 255 && d === 255) {\n return { kind: \"reserved\", range: \"255.255.255.255\" };\n }\n if (a >= 240)\n return { kind: \"reserved\", range: \"240.0.0.0/4\" };\n return PUBLIC;\n}\nfunction classifyIPv6(bytes) {\n if (bytes.length !== 16)\n return { kind: \"reserved\", range: \"unparseable\" };\n const mapped = bytes.slice(0, 10).every((byte) => byte === 0) && bytes[10] === 255 && bytes[11] === 255;\n if (mapped)\n return classifyIPv4(bytes.slice(12));\n const nat64 = bytes[0] === 0 && bytes[1] === 100 && bytes[2] === 255 && bytes[3] === 155 && bytes.slice(4, 12).every((byte) => byte === 0);\n if (nat64)\n return classifyIPv4(bytes.slice(12));\n if (bytes.every((byte) => byte === 0))\n return { kind: \"unspecified\", range: \"::\" };\n if (bytes.slice(0, 15).every((byte) => byte === 0) && bytes[15] === 1) {\n return { kind: \"loopback\", range: \"::1\" };\n }\n const first = bytes[0] ?? 0;\n const second = bytes[1] ?? 0;\n if ((first & 254) === 252)\n return { kind: \"private\", range: \"fc00::/7\" };\n if (first === 254 && (second & 192) === 128)\n return { kind: \"link-local\", range: \"fe80::/10\" };\n if (first === 255)\n return { kind: \"multicast\", range: \"ff00::/8\" };\n if (first === 32 && second === 1 && bytes[2] === 13 && bytes[3] === 184) {\n return { kind: \"reserved\", range: \"2001:db8::/32\" };\n }\n return PUBLIC;\n}\nfunction classifyAddress(value) {\n const bare = value.startsWith(\"[\") && value.endsWith(\"]\") ? value.slice(1, -1) : value;\n const quad = parseIPv4(bare);\n if (quad !== undefined)\n return classifyIPv4(quad);\n const bytes = parseIPv6(bare);\n if (bytes !== undefined)\n return classifyIPv6(bytes);\n return;\n}\n\n// src/guard.ts\nvar ALLOWED_SCHEMES = new Set([\"http:\", \"https:\"]);\nvar PRIVATE_SUFFIXES = [\".local\", \".localhost\", \".internal\", \".intranet\", \".lan\", \".home.arpa\"];\nfunction parseUrl(raw) {\n const trimmed = raw.trim();\n if (trimmed === \"\")\n throw webUrlUnparseable(raw, \"the value is empty\");\n try {\n return new URL(trimmed);\n } catch (cause) {\n throw webUrlUnparseable(raw, cause instanceof Error ? cause.message : String(cause));\n }\n}\nfunction checkUrlShape(url) {\n if (!ALLOWED_SCHEMES.has(url.protocol))\n throw webSchemeRefused(url.protocol.replace(\":\", \"\"));\n if (url.username !== \"\" || url.password !== \"\")\n throw webCredentialsRefused();\n const host = url.hostname.toLowerCase();\n if (host === \"\")\n throw webHostRefused(url.href, \"there is no host in the URL\");\n if (host === \"localhost\")\n throw webHostRefused(host, \"it is this machine by definition\");\n for (const suffix of PRIVATE_SUFFIXES) {\n if (host.endsWith(suffix)) {\n throw webHostRefused(host, `${suffix} names are resolved on the local network, not the internet`);\n }\n }\n const bare = host.startsWith(\"[\") ? \"\" : host;\n if (bare !== \"\" && !bare.includes(\".\") && classifyAddress(host) === undefined) {\n throw webHostRefused(host, \"a name with no dot in it is completed by the local search domain\");\n }\n}\nasync function assertFetchable(url, lookupFn, hop = 0) {\n checkUrlShape(url);\n const host = url.hostname.toLowerCase();\n const literal = classifyAddress(host);\n if (literal !== undefined) {\n if (literal.kind !== \"public\") {\n throw webAddressRefused(host, host, literal.kind, literal.range, hop);\n }\n return;\n }\n let addresses;\n try {\n addresses = await lookupFn(host);\n } catch (cause) {\n throw webHostUnresolvable(host, cause instanceof Error ? cause.message : String(cause));\n }\n if (addresses.length === 0)\n throw webHostUnresolvable(host, \"it has no addresses\");\n for (const { address } of addresses) {\n const verdict = classifyAddress(address);\n if (verdict === undefined) {\n throw webAddressRefused(host, address, \"an address this cannot classify\", undefined, hop);\n }\n if (verdict.kind !== \"public\") {\n throw webAddressRefused(host, address, verdict.kind, verdict.range, hop);\n }\n }\n}\nvar systemLookup = async (hostname) => {\n const results = await lookup(hostname, { all: true, verbatim: true });\n return results.map((entry) => ({ address: entry.address }));\n};\n\n// src/paths.ts\nvar WEB_PROVIDER_ID = \"web\";\n\n// src/fetch.ts\nvar DEFAULT_MAX_BYTES = 2000000;\nvar DEFAULT_MAX_CHARS = 6000;\nvar MAX_REDIRECTS = 5;\nvar DEADLINE_MARGIN_MS = 3000;\nvar DEFAULT_TIMEOUT_MS = 20000;\nvar FETCH_SPEC = {\n slug: \"web_fetch\",\n provider: WEB_PROVIDER_ID,\n summary: \"Reads one web page and returns its text.\",\n whenToUse: \"you have a specific URL — from the person, from a search result, from a document — and need what is actually on that page rather than what you remember about it\",\n whenNotToUse: \"you do not have a URL yet, which is web_search; the address is on this machine or this network, which is refused; or you want a file from disk, which is file_read\",\n mutating: false,\n trust: \"untrusted\",\n policyArg: \"url\",\n tags: [\"read\", \"web\"],\n parameters: {\n type: \"object\",\n properties: {\n url: {\n type: \"string\",\n description: \"The complete address of one page, including https://. Public internet only — addresses on this machine or this network are refused.\"\n }\n },\n required: [\"url\"]\n }\n};\nfunction fetchTool(options) {\n return { spec: FETCH_SPEC, handler: fetchHandler(options) };\n}\nfunction effectiveTimeout(deadlineMs) {\n const ceiling = Math.max(1000, deadlineMs - DEADLINE_MARGIN_MS);\n return Math.min(DEFAULT_TIMEOUT_MS, ceiling);\n}\nfunction fetchHandler(options) {\n const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n return async (args, context) => {\n const raw = String(args.url ?? \"\");\n let url = parseUrl(raw);\n const controller = new AbortController;\n const abort = () => {\n controller.abort();\n };\n context.signal.addEventListener(\"abort\", abort, { once: true });\n const timer = setTimeout(abort, effectiveTimeout(context.deadlineMs));\n try {\n for (let hop = 0;hop <= MAX_REDIRECTS; hop += 1) {\n await assertFetchable(url, options.lookup, hop);\n let response;\n try {\n response = await options.fetch(url.href, {\n method: \"GET\",\n redirect: \"manual\",\n signal: controller.signal,\n headers: {\n \"user-agent\": options.userAgent,\n accept: \"text/html,application/xhtml+xml,text/plain;q=0.9,*/*;q=0.5\",\n \"accept-language\": \"en\"\n }\n });\n } catch (cause) {\n throw webRequestFailed(url.href, cause instanceof Error ? cause.message : String(cause));\n }\n const location = response.headers.get(\"location\");\n if (isRedirect(response.status) && location !== null) {\n await response.body?.cancel().catch(() => {\n return;\n });\n if (hop === MAX_REDIRECTS)\n throw webTooManyRedirects(raw, MAX_REDIRECTS);\n try {\n url = new URL(location, url);\n } catch {\n throw webRequestFailed(url.href, `it redirected to an unusable address: ${location}`);\n }\n continue;\n }\n if (!response.ok) {\n await response.body?.cancel().catch(() => {\n return;\n });\n throw webStatusFailed(url.href, response.status, response.statusText);\n }\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (!isTextual(contentType)) {\n await response.body?.cancel().catch(() => {\n return;\n });\n throw webContentUnusable(url.href, contentType.split(\";\")[0]?.trim() ?? \"binary\");\n }\n const { text: body, read, capped } = await readCapped(response, maxBytes);\n const { title, text } = extract(body, contentType);\n return render({\n url: url.href,\n requested: raw,\n ...title === undefined ? {} : { title },\n text,\n read,\n capped,\n hops: hop\n });\n }\n throw webTooManyRedirects(raw, MAX_REDIRECTS);\n } finally {\n clearTimeout(timer);\n context.signal.removeEventListener(\"abort\", abort);\n }\n };\n}\nfunction isRedirect(status) {\n return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;\n}\nasync function readCapped(response, maxBytes) {\n const body = response.body;\n if (body === null)\n return { text: \"\", read: 0, capped: false };\n const reader = body.getReader();\n const decoder = new TextDecoder(\"utf-8\");\n const parts = [];\n let read = 0;\n let capped = false;\n try {\n for (;; ) {\n const { done, value } = await reader.read();\n if (done)\n break;\n if (value === undefined)\n continue;\n read += value.byteLength;\n if (read >= maxBytes) {\n const keep = value.byteLength - (read - maxBytes);\n parts.push(decoder.decode(value.subarray(0, Math.max(0, keep)), { stream: true }));\n capped = true;\n break;\n }\n parts.push(decoder.decode(value, { stream: true }));\n }\n } finally {\n await reader.cancel().catch(() => {\n return;\n });\n }\n parts.push(decoder.decode());\n return { text: parts.join(\"\"), read: Math.min(read, maxBytes), capped };\n}\nfunction render(result) {\n const lines = [];\n lines.push(result.url);\n if (result.hops > 0 && result.url !== result.requested) {\n lines.push(`redirected from ${result.requested} (${result.hops} hop${result.hops === 1 ? \"\" : \"s\"})`);\n }\n if (result.title !== undefined)\n lines.push(`title: ${result.title}`);\n let text = result.text;\n let trimmed = false;\n if (text.length > DEFAULT_MAX_CHARS) {\n text = text.slice(0, DEFAULT_MAX_CHARS);\n trimmed = true;\n }\n const notes = [];\n if (result.capped) {\n notes.push(`the download stopped at ${result.read.toLocaleString(\"en-US\")} bytes, so the end of the page is missing`);\n }\n if (trimmed) {\n notes.push(`only the first ${DEFAULT_MAX_CHARS.toLocaleString(\"en-US\")} characters are shown`);\n }\n if (notes.length > 0)\n lines.push(`incomplete: ${notes.join(\"; \")}`);\n lines.push(\"\");\n lines.push(text === \"\" ? \"(the page has no readable text)\" : text);\n return lines.join(`\n`);\n}\n\n// src/search.ts\nvar DEFAULT_MAX_RESULTS = 5;\nvar MAX_MAX_RESULTS = 10;\nvar SNIPPET_CHARS = 300;\nvar DEADLINE_MARGIN_MS2 = 3000;\nvar DEFAULT_TIMEOUT_MS2 = 15000;\nvar SEARCH_SPEC = {\n slug: \"web_search\",\n provider: WEB_PROVIDER_ID,\n summary: \"Searches the web and returns titles, addresses and short extracts.\",\n whenToUse: \"you need something current, something you are unsure about, or a page whose address you do not know — prices, news, documentation, whether a thing still exists\",\n whenNotToUse: \"you already have the URL, which is web_fetch; the answer is in a file or in this conversation; or you want to find a tool rather than a page, which this cannot do\",\n mutating: false,\n trust: \"untrusted\",\n policyArg: \"query\",\n tags: [\"read\", \"web\", \"search\"],\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description: \"What to search for, written the way you would type it into a search box. Keywords work better than a full sentence.\"\n },\n maxResults: {\n type: \"integer\",\n description: `How many results to return, 1 to ${MAX_MAX_RESULTS}.`,\n default: DEFAULT_MAX_RESULTS\n }\n },\n required: [\"query\"]\n }\n};\nfunction searchTool(options) {\n return { spec: SEARCH_SPEC, handler: searchHandler(options) };\n}\nfunction searchHandler(options) {\n const chosen = backend(options.backend);\n return async (args, context) => {\n const query = String(args.query ?? \"\").trim();\n if (query === \"\") {\n return \"No query was given, so nothing was searched for. Call this again with the words you want to look up.\";\n }\n const apiKey = options.env[options.apiKeyEnv] ?? \"\";\n if (apiKey === \"\")\n throw webSearchKeyMissing(chosen.id, options.apiKeyEnv);\n const maxResults = clampResults(args.maxResults);\n const { url, init } = chosen.request(query, maxResults, apiKey);\n const controller = new AbortController;\n const abort = () => {\n controller.abort();\n };\n context.signal.addEventListener(\"abort\", abort, { once: true });\n const timer = setTimeout(abort, Math.min(DEFAULT_TIMEOUT_MS2, Math.max(1000, context.deadlineMs - DEADLINE_MARGIN_MS2)));\n try {\n const response = await options.fetch(url, { ...init, signal: controller.signal });\n if (!response.ok)\n await readError(chosen.id, response);\n const payload = await response.json();\n return render2(query, chosen.read(payload).slice(0, maxResults));\n } finally {\n clearTimeout(timer);\n context.signal.removeEventListener(\"abort\", abort);\n }\n };\n}\nfunction clampResults(value) {\n const asked = typeof value === \"number\" ? value : Number(value);\n if (!Number.isFinite(asked))\n return DEFAULT_MAX_RESULTS;\n return Math.min(MAX_MAX_RESULTS, Math.max(1, Math.trunc(asked)));\n}\nfunction render2(query, hits) {\n if (hits.length === 0) {\n return `No results for ${JSON.stringify(query)}. The search ran and came back empty — a narrower or differently worded query may find something, but do not assume the subject does not exist.`;\n }\n const blocks = hits.map((hit, index) => {\n const snippet = hit.snippet.length > SNIPPET_CHARS ? `${hit.snippet.slice(0, SNIPPET_CHARS).trimEnd()}…` : hit.snippet;\n return [\n `${index + 1}. ${hit.title === \"\" ? \"(untitled)\" : hit.title}`,\n ` ${hit.url}`,\n ...snippet === \"\" ? [] : [` ${snippet.replace(/\\s+/g, \" \")}`]\n ].join(`\n`);\n });\n return [\n `${hits.length} result${hits.length === 1 ? \"\" : \"s\"} for ${JSON.stringify(query)}:`,\n \"\",\n ...blocks\n ].join(`\n`);\n}\n\n// src/provider.ts\nvar USER_AGENT = \"dispach-agent/0.1 (+https://github.com/moeen-mahmud/dispach)\";\nvar WEB_TOOL_SLUGS = [\"web_search\", \"web_fetch\"];\nfunction normalise(slug) {\n return slug.toLowerCase().replace(/[\\s_.-]+/g, \"\");\n}\n\nclass WebProvider {\n id = WEB_PROVIDER_ID;\n #tools;\n constructor(options) {\n const id = options.backend ?? \"tavily\";\n const chosen = backend(id);\n const fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));\n const lookup = options.lookup ?? systemLookup;\n this.#tools = [\n searchTool({\n backend: id,\n apiKeyEnv: options.apiKeyEnv ?? chosen.defaultKeyEnv,\n env: options.env,\n fetch: fetchImpl\n }),\n fetchTool({\n lookup,\n fetch: fetchImpl,\n maxBytes: options.maxBytes ?? DEFAULT_MAX_BYTES,\n userAgent: USER_AGENT\n })\n ];\n }\n available() {\n return Promise.resolve(this.#tools.map((tool) => ({ slug: tool.spec.slug, summary: tool.spec.summary })));\n }\n resolve(slugs) {\n const wanted = new Set(slugs.map(normalise));\n return Promise.resolve(this.#tools.filter((tool) => wanted.has(normalise(tool.spec.slug))));\n }\n list() {\n return Promise.resolve(this.#tools.map((tool) => tool.spec.slug));\n }\n}\nvar CONFIG_KEYS = [\"backend\", \"apiKeyEnv\", \"maxBytes\"];\nfunction webFromConfig(context) {\n const unknown = Object.keys(context.config).filter((key) => !CONFIG_KEYS.includes(key));\n if (unknown.length > 0) {\n throw new ConfigError2({\n code: \"web_config_unknown\",\n message: `The web provider's configuration has ${unknown.length === 1 ? \"a key\" : \"keys\"} it does not read: ${unknown.join(\", \")}.`,\n hint: `Accepted keys are ${CONFIG_KEYS.join(\", \")}. Refused rather than ignored, because a setting that looks applied and is not is worse than a rejected manifest. There is deliberately no setting that permits private addresses.`,\n field: \"tools.providers.web\"\n });\n }\n const backendId = context.config.backend;\n if (backendId !== undefined && !BACKEND_IDS.includes(String(backendId))) {\n throw webConfigInvalid(\"backend\", `must be one of ${BACKEND_IDS.join(\", \")} — got ${JSON.stringify(backendId)}.`);\n }\n const apiKeyEnv = context.config.apiKeyEnv;\n if (apiKeyEnv !== undefined && (typeof apiKeyEnv !== \"string\" || apiKeyEnv === \"\")) {\n throw webConfigInvalid(\"apiKeyEnv\", \"must be the non-empty name of an environment variable — never the key itself, which fails validation.\");\n }\n const maxBytes = context.config.maxBytes;\n if (maxBytes !== undefined && (typeof maxBytes !== \"number\" || !Number.isFinite(maxBytes) || maxBytes < 1000)) {\n throw webConfigInvalid(\"maxBytes\", \"must be a number of at least 1000.\");\n }\n return new WebProvider({\n env: context.env,\n ...backendId === undefined ? {} : { backend: String(backendId) },\n ...typeof apiKeyEnv === \"string\" ? { apiKeyEnv } : {},\n ...typeof maxBytes === \"number\" ? { maxBytes } : {}\n });\n}\n\n// src/index.ts\nvar VERSION = \"0.1.0\";\nvar src_default = {\n name: \"web\",\n version: VERSION,\n dispachApi: \"^0.1\",\n permissions: [\n { kind: \"network\", hosts: [\"*\"] }\n ],\n setup(context) {\n context.defineToolProvider(\"web\", webFromConfig);\n }\n};\nexport {\n BACKEND_IDS,\n DEFAULT_MAX_BYTES,\n DEFAULT_MAX_CHARS,\n DEFAULT_MAX_RESULTS,\n FETCH_SPEC,\n MAX_MAX_RESULTS,\n MAX_REDIRECTS,\n SEARCH_SPEC,\n VERSION,\n WEB_PROVIDER_ID,\n WEB_TOOL_SLUGS,\n WebProvider,\n assertFetchable,\n backend,\n checkUrlShape,\n clampResults,\n classifyAddress,\n classifyIPv4,\n classifyIPv6,\n decodeEntities,\n src_default as default,\n effectiveTimeout,\n extract,\n extractTitle,\n fetchTool,\n htmlToText,\n isTextual,\n parseIPv4,\n parseIPv6,\n parseUrl,\n readCapped,\n render2 as render,\n searchTool,\n systemLookup,\n webFromConfig\n};\n\n//# debugId=9B5CE797582A3A1F64756E2164756E21\n//# sourceMappingURL=index.js.map\n",
11
- "/**\n * Which tool providers this binary can supply.\n *\n * One table, consumed by every command that boots a runtime, because the alternative is each command\n * registering its own set — and then `validate` accepts a manifest that `run` refuses, or the reverse.\n * A provider missing from one call site is exactly the class of drift the command table exists to stop.\n *\n * `packages/core` cannot import a provider (hard rule 2), so the binary is where the wiring lives.\n * Phase 9 moves this to the plugin loader and reads it from `plugins` in the manifest; the shape is\n * already the shape a loader would produce.\n *\n * No Ink and no React here — this sits on the shared path that `validate --json` runs through, where\n * a rendering import costs more than the whole command.\n */\n\nimport telegramPlugin, { telegramChannel } from \"@dispach/channel-telegram\"\nimport type {\n BuiltInPlugins,\n ChannelFactory,\n ScriptRunner,\n ToolProviderFactory,\n} from \"@dispach/core\"\nimport composioPlugin, { composioFromConfig } from \"@dispach/tools-composio\"\nimport systemPlugin, { SystemScriptRunner, systemFromConfig } from \"@dispach/tools-system\"\nimport webPlugin, { webFromConfig } from \"@dispach/tools-web\"\n\nexport const TOOL_PROVIDERS: Readonly<Record<string, ToolProviderFactory>> = {\n composio: composioFromConfig,\n // Registered, not implied. Naming `system` here means the binary *can* supply shell access; a\n // manifest still has to select the provider and pin `exec` before an agent has any. Availability\n // and grant are separate on purpose — the same separation that keeps `tools.local` opt-in.\n system: systemFromConfig,\n // Two read-only tools whose entire risk surface is which address they can be pointed at. Listed\n // beside the others rather than folded into `system`: an agent that reads the web and an agent\n // that runs commands are different grants, and a manifest should be able to make one and not the\n // other.\n web: webFromConfig,\n}\n\n/**\n * How a skill's script runs, from the one package allowed to start a process.\n *\n * Supplied by every command that builds a runtime, and unconditionally — unlike a tool provider, which a\n * manifest has to select. There is no grant here to be careful with: a script only becomes callable once\n * a skill ships one *and* that skill activates, and both of those are the workspace's decision. Omitting\n * it would mean a skill's `scripts/` is silently never discovered, which reads to whoever wrote the skill\n * as the runtime being broken.\n *\n * `env` is `process.env` rather than the manifest's, because this is constructed before any manifest is\n * loaded. It is used for the `PATH` walk in `has()`; the *run* inherits the process environment the same\n * way `exec` does.\n */\nexport function scriptRunner(): ScriptRunner {\n return new SystemScriptRunner({ env: process.env })\n}\n\n/** For an error that has to say what *is* available. */\nexport const PROVIDER_IDS: readonly string[] = Object.keys(TOOL_PROVIDERS)\n\n/**\n * Which channel types this binary can supply, keyed by the `type` a manifest names.\n *\n * Registered by every command that loads a manifest, not only by `serve`. A `channels:` entry has to\n * validate the same way everywhere or `validate` would refuse a manifest `serve` runs happily —\n * the asymmetry the tool-provider table already exists to prevent.\n */\nexport const CHANNELS: Readonly<Record<string, ChannelFactory>> = {\n telegram: telegramChannel,\n}\n\nexport const CHANNEL_IDS: readonly string[] = Object.keys(CHANNELS)\n\n/**\n * Plugins this binary can resolve by name, keyed by the specifier a manifest writes.\n *\n * The three tables above are what this binary supplies *by default* — every command passes them, so\n * an agent that names no plugins behaves exactly as it did before Phase 9A. This table is what lets a\n * manifest ask for the same capabilities by name, and it layers **over** the defaults so a future\n * third-party plugin can replace one.\n *\n * **Built in rather than imported at runtime, for a structural reason.** A module imported both\n * statically and dynamically makes `bun build --splitting` emit its exports twice and the bundle stops\n * parsing — `SyntaxError: Duplicate export`, which `bun test` walks straight past because tests import\n * source. The imports above are static, so the loader must never `import()` these same packages by\n * name. Registering them here keeps each module imported exactly one way, and `boundaries.test.ts`\n * enforces the rule generally.\n *\n * Keyed by package name because a manifest should name the package it means. The short name\n * (`telegram`, `system`) is what the plugin registers its channel or provider under, and that is a\n * different namespace on purpose: one plugin can register several.\n */\nexport const BUILT_IN_PLUGINS: BuiltInPlugins = {\n \"@dispach/channel-telegram\": telegramPlugin,\n \"@dispach/tools-composio\": composioPlugin,\n \"@dispach/tools-system\": systemPlugin,\n \"@dispach/tools-web\": webPlugin,\n}\n\nexport const BUILT_IN_PLUGIN_SPECS: readonly string[] = Object.keys(BUILT_IN_PLUGINS)\n",
12
- "/**\n * Fetching a source, and reading the skills out of it. The only place in the CLI that reaches a network.\n *\n * ## Git, and the two-minute hang that shaped this file\n *\n * `git ls-remote https://github.com/github/skills` — a repository that does not exist — did not fail.\n * It sat for two minutes waiting for a credential prompt on a terminal nobody was watching, because a\n * 404 on a private-or-absent repo is indistinguishable from \"you are not logged in yet\". So every\n * invocation here runs with prompting switched off in all four ways git can be asked\n * (`GIT_TERMINAL_PROMPT`, `GIT_ASKPASS`, `SSH_ASKPASS`, `BatchMode`) **and** under a wall-clock\n * timeout. A command that cannot fail is worse than one that fails slowly.\n *\n * The user's own git config is deliberately left alone — `GIT_CONFIG_NOSYSTEM` would drop the\n * credential helper, which is exactly how a private source is meant to work.\n *\n * ## Blobless and sparse, measured\n *\n * `git clone --depth 1 --single-branch --filter=blob:none --sparse` then `sparse-checkout set <path>`.\n * On `github/awesome-copilot`: 100 MB of repository becomes 22 MB on disk in 9 s, with all 425 skills\n * present. A plain shallow clone of the same repo is the full 100 MB, for the same 425 files. The\n * filter is refused by some servers, so a failure retries without it rather than reporting one.\n *\n * ## Update is re-clone, on purpose\n *\n * One code path instead of `fetch` + `reset --hard` + reconciling sparse state, and one thing that\n * cannot happen: a cache in a half-updated shape nobody can reason about. Every fetch lands in\n * `<name>.partial` and is renamed into place only once it has worked, so an interrupted update leaves\n * the previous catalogue intact and searchable — and an interrupted *first* fetch leaves no directory\n * at all, rather than an empty repo that looks like a source with no skills in it.\n */\n\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\"\nimport { join, relative } from \"node:path\"\nimport { estimateTokens, HarnessError, parseSkillFile } from \"@dispach/core\"\nimport { cacheDir, cacheRoot, type SourceSpec } from \"#lib/sources\"\nimport { spawnCaptureAsync } from \"#lib/spawn\"\n\nconst SKILL_FILE = \"SKILL.md\"\n\n/** Long enough for a 100 MB repository on a slow link; short enough to be a failure, not a hang. */\nexport const FETCH_TIMEOUT_MS = 180_000\n\nexport interface GitResult {\n readonly code: number\n readonly stdout: string\n readonly stderr: string\n /** True when the process was killed by the timeout rather than exiting on its own. */\n readonly timedOut?: boolean\n}\n\n/**\n * Injected by the tests, which never reach a network.\n *\n * Async, and that is load-bearing rather than stylistic: `spawnSync` inside a rendered screen freezes the\n * whole app — no spinner frame advances, and the keys pressed during a twenty-second clone are echoed by\n * the tty instead of being consumed, which is how `^[[B^[[A` was printed into a fetch progress line.\n */\nexport type Git = (args: readonly string[], cwd?: string) => Promise<GitResult>\n\nexport const realGit: Git = async (args, cwd) => {\n const result = await spawnCaptureAsync({\n command: \"git\",\n args,\n ...(cwd === undefined ? {} : { cwd }),\n timeoutMs: FETCH_TIMEOUT_MS,\n maxBuffer: 32 * 1024 * 1024,\n env: {\n ...process.env,\n // All four, because each covers a different way git asks for a credential and any one left\n // open is the hang described above. The user's own git config is untouched: dropping it would\n // drop the credential helper, which is exactly how a private source is meant to work.\n GIT_TERMINAL_PROMPT: \"0\",\n GIT_ASKPASS: \"\",\n SSH_ASKPASS: \"\",\n SSH_ASKPASS_REQUIRE: \"never\",\n GIT_SSH_COMMAND: \"ssh -oBatchMode=yes -oStrictHostKeyChecking=accept-new\",\n },\n })\n if (result.notFound) {\n throw new HarnessError({\n code: \"git_missing\",\n message: \"git is not on PATH, and a skill source is a git repository\",\n hint: \"Install git — on macOS `xcode-select --install` is enough. Until then, clone a repository by hand and use `skills install <agent> <path>`.\",\n })\n }\n return {\n code: result.code,\n stdout: result.stdout,\n stderr: result.stderr,\n ...(result.signalled ? { timedOut: true } : {}),\n }\n}\n\n/** One skill as it exists in a source, before anything is copied. */\nexport interface CatalogueEntry {\n readonly source: string\n /** The frontmatter `name`, which is what it will be installed as. */\n readonly skill: string\n /** Absolute path in the cache. */\n readonly dir: string\n /** Path inside the repository, recorded as provenance on install. */\n readonly repoPath: string\n readonly description: string\n readonly tokens: number\n /** Files that would run: an executable bit, or a script extension. A trust signal, not a count. */\n readonly scripts: readonly string[]\n /** Present when the folder holds a `SKILL.md` that will not load. Listed anyway, honestly. */\n readonly problem?: string\n}\n\nexport interface SourceMeta {\n readonly commit?: string\n readonly fetchedAt?: string\n readonly skills?: number\n}\n\nfunction metaPath(name: string, env?: Readonly<Record<string, string | undefined>>): string {\n return join(cacheRoot(env), `${name}.json`)\n}\n\nexport function readMeta(\n name: string,\n env?: Readonly<Record<string, string | undefined>>,\n): SourceMeta {\n const path = metaPath(name, env)\n if (!existsSync(path)) return {}\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as SourceMeta\n } catch {\n // A corrupt meta file costs a \"never fetched\" line and nothing else; it is not worth failing\n // a listing over, and the next fetch overwrites it.\n return {}\n }\n}\n\nexport function isCached(\n name: string,\n env?: Readonly<Record<string, string | undefined>>,\n): boolean {\n return existsSync(join(cacheDir(name, env), \".git\"))\n}\n\n/**\n * True when a skill reference should be read as a path on disk instead.\n *\n * Filesystem-first, which is git's pathspec rule and the one `resolveAgentRef` already follows. The three\n * prefixes are checked *before* existence so a mistyped `./skils/pdf` is reported as a missing directory\n * rather than as an unknown skill — the two failures have completely different remedies.\n */\nexport function looksLikePath(ref: string): boolean {\n return ref.startsWith(\".\") || ref.startsWith(\"/\") || ref.startsWith(\"~\") || existsSync(ref)\n}\n\nexport interface FetchResult {\n readonly commit: string\n readonly skills: number\n /** True when the partial-clone filter was refused and a full shallow clone was used instead. */\n readonly unfiltered: boolean\n}\n\n/**\n * Clone or re-clone a source into the cache.\n *\n * Failure throws with git's own stderr attached: it is almost always the useful part — a wrong branch\n * name, a repository that needs credentials, a host that is down — and paraphrasing it would lose the\n * one sentence that says which.\n */\nexport async function fetchSource(\n spec: SourceSpec,\n options: {\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly git?: Git\n } = {},\n): Promise<FetchResult> {\n const git = options.git ?? realGit\n const env = options.env\n const target = cacheDir(spec.name, env)\n const partial = `${target}.partial`\n\n mkdirSync(cacheRoot(env), { recursive: true })\n rmSync(partial, { recursive: true, force: true })\n\n const base = [\n \"clone\",\n \"--depth\",\n \"1\",\n \"--single-branch\",\n ...(spec.ref === undefined ? [] : [\"--branch\", spec.ref]),\n ]\n const sparse = spec.path !== undefined\n let unfiltered = !sparse\n let result = sparse\n ? await git([...base, \"--filter=blob:none\", \"--sparse\", spec.url, partial])\n : await git([...base, spec.url, partial])\n\n if (result.code !== 0 && sparse) {\n // Some servers refuse a partial clone. Retrying full is a bigger download, never a failure.\n rmSync(partial, { recursive: true, force: true })\n const retry = await git([...base, spec.url, partial])\n if (retry.code === 0) {\n unfiltered = true\n result = retry\n }\n }\n if (result.code !== 0) {\n rmSync(partial, { recursive: true, force: true })\n throw cloneFailed(spec, result)\n }\n\n if (spec.path !== undefined && !unfiltered) {\n const narrowed = await git([\"sparse-checkout\", \"set\", spec.path], partial)\n if (narrowed.code !== 0) {\n rmSync(partial, { recursive: true, force: true })\n throw new HarnessError({\n code: \"skill_source_path_missing\",\n message: `${spec.name}: could not narrow the checkout to ${spec.path}`,\n hint: `Check the path exists in ${spec.url}. ${narrowed.stderr.trim() || \"git said nothing.\"}`,\n })\n }\n }\n\n const head = await git([\"rev-parse\", \"--short\", \"HEAD\"], partial)\n const commit = head.code === 0 ? head.stdout.trim() : \"unknown\"\n\n rmSync(target, { recursive: true, force: true })\n renameSync(partial, target)\n\n const skills = readCatalogue(spec, env).length\n writeFileSync(\n metaPath(spec.name, env),\n `${JSON.stringify({ commit, fetchedAt: new Date().toISOString(), skills }, null, 4)}\\n`,\n )\n return { commit, skills, unfiltered }\n}\n\nfunction cloneFailed(spec: SourceSpec, result: GitResult): HarnessError {\n const said = result.stderr.trim().split(\"\\n\").slice(-3).join(\" \")\n if (result.timedOut === true) {\n return new HarnessError({\n code: \"skill_source_timeout\",\n message: `${spec.name}: git did not finish within ${Math.round(FETCH_TIMEOUT_MS / 1000)}s`,\n hint: `Check the network, then try again — a partly fetched source was discarded, so the previous copy of ${spec.name} is untouched.`,\n })\n }\n return new HarnessError({\n code: \"skill_source_fetch_failed\",\n message: `${spec.name}: could not clone ${spec.url}${said.length === 0 ? \"\" : ` — ${said}`}`,\n hint: \"A private repository needs a credential helper git can use without prompting. Check the URL and the branch; `sources remove` drops a source you no longer want.\",\n })\n}\n\n/** Depth from the scan root. Four covers `skills/<name>/`, a namespace level, and slack. */\nconst MAX_DEPTH = 4\nconst SKIPPED = new Set([\"node_modules\", \"dist\", \"build\", \"target\", \"vendor\", \".git\"])\n\nfunction skillDirs(root: string): string[] {\n const found: string[] = []\n const walk = (dir: string, depth: number): void => {\n if (depth > MAX_DEPTH) return\n let entries: readonly { name: string; isDirectory(): boolean }[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return\n }\n // A skill folder is **not** a leaf, and assuming it was hid fifteen skills on the first real run.\n // `github/awesome-copilot` nests them: `skills/qdrant-scaling/SKILL.md` is a skill and so are the\n // four inside it, three levels deep in one case. Stopping here reported 410 of 425 with nothing\n // saying which were missing.\n //\n // The cost of descending is a false positive — a `references/SKILL.md` kept as an example would be\n // listed as a skill — and that is the cheaper mistake by a wide margin: it appears in a listing\n // where a person can see it, while a false negative is a skill that simply does not exist as far\n // as this tool is concerned. `parseSkillFile` filters most of it anyway, since the spec requires\n // `name` to equal the directory.\n if (existsSync(join(dir, SKILL_FILE))) found.push(dir)\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n if (entry.name.startsWith(\".\") || SKIPPED.has(entry.name)) continue\n walk(join(dir, entry.name), depth + 1)\n }\n }\n walk(root, 0)\n return found.sort()\n}\n\nconst SCRIPT_EXTENSIONS = [\".py\", \".sh\", \".js\", \".ts\", \".mjs\", \".rb\", \".pl\"]\n\n/**\n * Files in a skill that would run if the model called them.\n *\n * Over-reports on purpose: a `.py` with no executable bit still runs under `python3`, and this is the\n * line a person reads before agreeing to install somebody else's folder. Under-reporting here is the\n * only failure that matters.\n */\nfunction scriptsIn(dir: string, depth = 0): string[] {\n if (depth > 3) return []\n const found: string[] = []\n let entries: readonly { name: string; isDirectory(): boolean; isFile(): boolean }[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n for (const entry of entries) {\n const full = join(dir, entry.name)\n if (entry.isDirectory()) {\n if (entry.name.startsWith(\".\") || SKIPPED.has(entry.name)) continue\n found.push(...scriptsIn(full, depth + 1))\n continue\n }\n if (!entry.isFile()) continue\n const executable = (statSync(full).mode & 0o111) !== 0\n if (executable || SCRIPT_EXTENSIONS.some((extension) => entry.name.endsWith(extension))) {\n found.push(full)\n }\n }\n return found\n}\n\n/**\n * Every skill in a fetched source.\n *\n * Reads whole files rather than only frontmatter, because the token count is a property of the body and\n * it is the number that decides whether a skill can be installed at all. 425 skills is a few megabytes.\n */\nexport function readCatalogue(\n spec: SourceSpec,\n env?: Readonly<Record<string, string | undefined>>,\n): readonly CatalogueEntry[] {\n const base = cacheDir(spec.name, env)\n const root = spec.path === undefined ? base : join(base, spec.path)\n if (!existsSync(root)) return []\n\n const entries: CatalogueEntry[] = []\n for (const dir of skillDirs(root)) {\n const raw = readFileSync(join(dir, SKILL_FILE), \"utf8\")\n const folder = dir.slice(dir.lastIndexOf(\"/\") + 1)\n const shared = {\n source: spec.name,\n dir,\n repoPath: relative(base, dir),\n scripts: scriptsIn(dir),\n }\n try {\n const parsed = parseSkillFile(folder, raw)\n entries.push({\n ...shared,\n skill: parsed.frontmatter.name,\n description: parsed.frontmatter.description,\n tokens: estimateTokens(parsed.body),\n })\n } catch (error) {\n // Listed with its problem rather than dropped — the same rule the sandbox listing follows.\n // A skill that will not load is information; a skill that silently is not there is a\n // filesystem investigation.\n entries.push({\n ...shared,\n skill: folder,\n description: \"\",\n tokens: estimateTokens(raw),\n problem: error instanceof Error ? error.message : String(error),\n })\n }\n }\n return entries\n}\n",
13
- "/**\n * Where skills come from: a named list of repositories, machine-level and the person's.\n *\n * ## Why this is not in `agent.yaml`\n *\n * A source is a place *you* trust, not a property of one agent. Put it in the manifest and you add a\n * repository once per agent, and — worse — you put a fetchable URL inside the document the runtime\n * loads at boot, which is an invitation to resolve it there. Hard rule 4 exists because the runtime\n * this replaces spent four minutes on network calls during initialisation. Nothing here is reachable\n * from `Runtime.create`: this module lives in the CLI, every fetch is an explicit command a person\n * typed, and the runtime's only relationship with a source is that a directory was copied before it\n * ever started.\n *\n * `skills.sources` was a manifest field reserved for this and is deliberately gone (decision 11.46).\n * A field only a CLI reads is a field the runtime will eventually be asked to read.\n *\n * ## Built-ins are compiled in, never written to the file\n *\n * `DEFAULT_SOURCES` ships in the binary. If it were seeded into `sources.json` on first run, a repo\n * that moves would stay broken until every user hand-edited a file, and an upgrade could not fix it.\n * A user entry with a built-in's name overrides it; `sources remove <builtin>` records the name in\n * `disabled` instead, because a default is an endorsement and refusing to let someone drop one would\n * make the endorsement mandatory.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport { HarnessError } from \"@dispach/core\"\nimport { CURATED_COMMUNITY_SKILLS } from \"#lib/curated\"\nimport { sandboxRoot } from \"#lib/sandbox\"\n\n/** A repository to look for skills in. */\nexport interface SourceSpec {\n /**\n * The nickname you install by — `install <agent> <name>/<skill>`.\n *\n * One path segment, so it can be a directory name in the cache and cannot be confused with the\n * `owner/repo` shorthand a URL uses.\n */\n readonly name: string\n /** Anything `git clone` accepts. */\n readonly url: string\n /**\n * Subdirectory holding the skill folders, if the repo does not keep them at the root.\n *\n * Load-bearing for more than tidiness: it is what `git sparse-checkout` narrows to, and narrowing\n * took `github/awesome-copilot` from 100 MB to 22 MB (measured). With no path the whole repository\n * is checked out, so a source without one is a source that costs its full size.\n */\n readonly path?: string\n /** Branch or tag. Omitted means whatever the remote's HEAD points at. */\n readonly ref?: string\n /** Shipped rather than added. Never written to the registry file. */\n readonly builtin?: boolean\n /**\n * Folder names to show when *browsing*, or absent to show everything.\n *\n * A filter on the catalogue rather than on the checkout. Narrowing the clone was the obvious\n * optimisation and does not work: `git sparse-checkout set` given twenty `skills/<name>` paths in cone\n * mode (git 2.55) writes them as root-level patterns and materialises one folder out of twenty. The\n * whole `skills/` tree is 22 MB fetched once per machine and shared by every agent on it, which is not\n * worth a git edge case.\n *\n * Never applied to `sources search`. Curation is a recommendation, and a search that refused to find a\n * skill somebody named would make it a restriction.\n */\n readonly curated?: readonly string[]\n}\n\n/**\n * The two sources every install starts with.\n *\n * Both verified to exist, to use `skills/<name>/SKILL.md`, and to be readable without credentials on\n * 2026-08-17: `anthropics/skills` carries 18 skills, `github/awesome-copilot` 425. Deliberately short\n * — a default is an endorsement of somebody else's executable code, so the list holds the spec's own\n * authors and one large community catalogue, and everything else is `sources add`.\n */\nexport const DEFAULT_SOURCES: readonly SourceSpec[] = [\n {\n name: \"anthropic\",\n url: \"https://github.com/anthropics/skills\",\n path: \"skills\",\n builtin: true,\n },\n {\n name: \"github\",\n url: \"https://github.com/github/awesome-copilot\",\n path: \"skills\",\n builtin: true,\n // 425 skills upstream, mostly developer tooling. See `curated.ts` for what this keeps and why.\n curated: CURATED_COMMUNITY_SKILLS,\n },\n]\n\n/** One path segment, no dots, so it is safe as a cache directory and as a ref prefix. */\nconst SOURCE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\n\nexport function isSourceName(name: string): boolean {\n return name.length > 0 && name.length <= 64 && SOURCE_NAME.test(name)\n}\n\ninterface RegistryFile {\n readonly version?: number\n readonly sources?: readonly SourceSpec[]\n readonly disabled?: readonly string[]\n}\n\nconst VERSION = 1\n\nexport function registryPath(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"sources.json\")\n}\n\n/** Where a source's working copy is cached. One directory per source name. */\nexport function cacheRoot(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"sources\")\n}\n\nexport function cacheDir(name: string, env?: Readonly<Record<string, string | undefined>>): string {\n return join(cacheRoot(env), name)\n}\n\nfunction readRegistry(env?: Readonly<Record<string, string | undefined>>): RegistryFile {\n const path = registryPath(env)\n if (!existsSync(path)) return {}\n let parsed: unknown\n try {\n parsed = JSON.parse(readFileSync(path, \"utf8\"))\n } catch (error) {\n throw new HarnessError({\n code: \"skill_sources_unreadable\",\n message: `${path} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n hint: \"Fix the file, or delete it — the built-in sources work with no file at all.\",\n })\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new HarnessError({\n code: \"skill_sources_unreadable\",\n message: `${path} does not hold a JSON object`,\n hint: `Expected {\"version\": ${VERSION}, \"sources\": [...]}. Delete the file to start from the built-in sources.`,\n })\n }\n return parsed as RegistryFile\n}\n\n/**\n * Every source `search` and `install` will look in: built-ins minus disabled, then user entries.\n *\n * Order is the resolution order for a bare skill name, so built-ins are first and a user's own\n * additions are tried after — which is also why an overriding entry keeps the built-in's position\n * rather than moving to the end.\n */\nexport function loadSources(\n env?: Readonly<Record<string, string | undefined>>,\n): readonly SourceSpec[] {\n const file = readRegistry(env)\n const added = (file.sources ?? []).filter((entry) => isSourceName(entry.name))\n const disabled = new Set(file.disabled ?? [])\n const overridden = new Map(added.map((entry) => [entry.name, entry]))\n\n const resolved: SourceSpec[] = []\n for (const builtin of DEFAULT_SOURCES) {\n if (disabled.has(builtin.name)) continue\n const override = overridden.get(builtin.name)\n resolved.push(override === undefined ? builtin : { ...override, builtin: false })\n }\n for (const entry of added) {\n if (DEFAULT_SOURCES.some((builtin) => builtin.name === entry.name)) continue\n resolved.push({ ...entry, builtin: false })\n }\n return resolved\n}\n\nfunction writeRegistry(\n file: RegistryFile,\n env?: Readonly<Record<string, string | undefined>>,\n): void {\n const path = registryPath(env)\n mkdirSync(sandboxRoot(env), { recursive: true })\n const body: RegistryFile = {\n version: VERSION,\n sources: file.sources ?? [],\n ...(file.disabled === undefined || file.disabled.length === 0\n ? {}\n : { disabled: file.disabled }),\n }\n writeFileSync(path, `${JSON.stringify(body, null, 4)}\\n`)\n}\n\nexport function addSource(\n spec: SourceSpec,\n env?: Readonly<Record<string, string | undefined>>,\n): void {\n const file = readRegistry(env)\n const kept = (file.sources ?? []).filter((entry) => entry.name !== spec.name)\n // Adding back a disabled built-in re-enables it; anything else would make `add` silently do\n // nothing for the one name most likely to be re-added.\n const disabled = (file.disabled ?? []).filter((name) => name !== spec.name)\n writeRegistry({ ...file, sources: [...kept, spec], disabled }, env)\n}\n\n/** Returns false when there was nothing by that name to remove. */\nexport function removeSource(\n name: string,\n env?: Readonly<Record<string, string | undefined>>,\n): boolean {\n const file = readRegistry(env)\n const kept = (file.sources ?? []).filter((entry) => entry.name !== name)\n const wasAdded = kept.length !== (file.sources ?? []).length\n const builtin = DEFAULT_SOURCES.some((entry) => entry.name === name)\n const already = (file.disabled ?? []).includes(name)\n if (!wasAdded && !builtin) return false\n if (builtin && already && !wasAdded) return false\n const disabled = builtin && !already ? [...(file.disabled ?? []), name] : (file.disabled ?? [])\n writeRegistry({ ...file, sources: kept, disabled }, env)\n return true\n}\n\n/**\n * What a person types for a repository, turned into a clone URL and — where the URL says so — a ref\n * and a path.\n *\n * The browser URL case is the one that has to work: someone finding a skill collection pastes\n * `https://github.com/anthropics/skills/tree/main/skills`, which is not a clone URL and carries two\n * fields inside its path. Refusing it would mean the documented way to add a source is to hand-edit\n * what GitHub put in the address bar.\n */\nexport function parseSourceUrl(input: string): {\n readonly url: string\n readonly ref?: string\n readonly path?: string\n} {\n const trimmed = input.trim()\n if (trimmed.length === 0) throw badUrl(input)\n\n // `owner/repo` — the shorthand every git front end accepts. Two segments exactly, so it cannot\n // swallow a path that was meant as one.\n if (/^[\\w.-]+\\/[\\w.-]+$/.test(trimmed)) {\n return { url: `https://github.com/${trimmed.replace(/\\.git$/, \"\")}` }\n }\n\n if (trimmed.startsWith(\"git@\") || trimmed.startsWith(\"ssh://\")) return { url: trimmed }\n\n let parsed: URL\n try {\n parsed = new URL(trimmed)\n } catch {\n throw badUrl(input)\n }\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") throw badUrl(input)\n\n const segments = parsed.pathname.split(\"/\").filter((segment) => segment.length > 0)\n const cut = segments.findIndex((segment) => segment === \"tree\" || segment === \"blob\")\n if (cut < 2) {\n return { url: `${parsed.origin}/${segments.join(\"/\")}`.replace(/\\.git$/, \"\") }\n }\n const repo = segments.slice(0, cut).join(\"/\")\n const ref = segments[cut + 1]\n const path = segments.slice(cut + 2).join(\"/\")\n return {\n url: `${parsed.origin}/${repo}`.replace(/\\.git$/, \"\"),\n ...(ref === undefined ? {} : { ref }),\n ...(path.length === 0 ? {} : { path }),\n }\n}\n\nfunction badUrl(input: string): HarnessError {\n return new HarnessError({\n code: \"skill_source_url_invalid\",\n message: `${JSON.stringify(input)} is not a repository`,\n hint: \"Accepted: owner/repo, an https:// clone URL, a git@ SSH URL, or the page URL you were reading — .../tree/<branch>/<subdir> is understood.\",\n })\n}\n\n/** A skill reference as typed: `pdf`, or `anthropic/pdf`. */\nexport interface SkillRef {\n readonly source?: string\n readonly skill: string\n}\n\nexport function parseSkillRef(input: string): SkillRef {\n const parts = input.split(\"/\").filter((part) => part.length > 0)\n if (parts.length === 1) return { skill: parts[0] as string }\n if (parts.length === 2) return { source: parts[0] as string, skill: parts[1] as string }\n throw new HarnessError({\n code: \"skill_ref_invalid\",\n message: `${JSON.stringify(input)} is neither a skill name nor <source>/<skill>`,\n hint: \"Use `pdf` to search every source, or `anthropic/pdf` to name one. A path is taken as a path only if it exists on disk.\",\n })\n}\n",
14
- "/**\n * Bare `skills`, with no arguments: the catalogue, ticked, installed into an agent you pick.\n *\n * This is the entry point the owner asked for and the one the surface was missing. Everything else\n * required knowing something first — `skills list <agent>` needs an agent, `sources search <words>` needs\n * words, and `skills install <agent> <source>/<skill>` needs the name of a skill you have not seen yet.\n * A person who wants skills has none of those, so the command that takes no arguments has to be the one\n * that shows what exists.\n *\n * ## What it does not do\n *\n * It does not fetch on a pipe. `--plain`, a redirect, or CI gets the same list as text, from the same\n * `browseRows`, with the two commands that install a skill non-interactively printed underneath — because\n * a picker is not scriptable and pretending otherwise means somebody's CI job hangs on a keypress.\n *\n * It also does not resolve an agent for you when there are several. Installing somebody else's executable\n * code into whichever agent happened to sort first is not a default worth having, so the second screen\n * asks — and with exactly one agent it does not, because there is nothing to ask.\n */\n\nimport { BRAND, HarnessError, VERSION } from \"@dispach/core\"\nimport {\n type BrowseInput,\n type BrowseRow,\n browseRows,\n type InstallReport,\n installReport,\n} from \"#lib/browse\"\nimport { ENTER_ALT_SCREEN, EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { flushOutput, markAltScreen, onExit, restoreTerminal } from \"#lib/exit\"\nimport { negotiateKeyboard } from \"#lib/keyboard\"\nimport { resolveModeFromProcess } from \"#lib/output\"\nimport { bullet, indent, section } from \"#lib/render\"\nimport { columnsFor, layoutRow } from \"#lib/rows\"\nimport { listAgents, type SandboxAgent } from \"#lib/sandbox\"\nimport {\n type CatalogueEntry,\n fetchSource,\n type Git,\n isCached,\n readCatalogue,\n} from \"#lib/source-cache\"\nimport { loadSources } from \"#lib/sources\"\nimport { type InstallOutcome, skillsCommand } from \"#skills\"\n\nexport interface BrowseOptions {\n readonly plain?: boolean\n readonly json?: boolean\n /** Injected by the tests, which never reach a network. */\n readonly git?: Git\n readonly env?: Readonly<Record<string, string | undefined>>\n /** Both overridden in tests; at a terminal they are measured from the stream. */\n readonly rows?: number\n readonly width?: number\n}\n\n/**\n * Fetch what is not cached, then build the rows. Shared by the command and by `init`.\n *\n * Announced before the work: the first run pays ~40 MB once per machine and every agent on it shares the\n * result, and a command that pauses for twenty seconds with no output is indistinguishable from one that\n * has hung — the failure this whole area's git wrapper exists to prevent.\n */\n/**\n * Fetch what is not cached, then build the rows — reporting progress through a callback.\n *\n * A callback rather than `process.stdout` because one caller is *inside* a rendered screen, where writing\n * to stdout paints over the frame Ink is managing. The other caller passes a writer and gets the same lines\n * on a pipe. This is the seam that lets the init wizard show a spinner instead of a printed line.\n */\nexport async function fetchCatalogue(\n options: BrowseOptions & { readonly onStatus?: (line: string) => void },\n): Promise<readonly BrowseRow[]> {\n const say = options.onStatus ?? (() => {})\n const sources = loadSources(options.env)\n const cold = sources.filter((spec) => !isCached(spec.name, options.env))\n for (const [at, spec] of cold.entries()) {\n say(\n `fetching ${spec.name} (${at + 1} of ${cold.length}) — once per machine, shared by every agent`,\n )\n try {\n const result = await fetchSource(spec, {\n ...(options.env === undefined ? {} : { env: options.env }),\n ...(options.git === undefined ? {} : { git: options.git }),\n })\n say(`${spec.name}: ${result.skills} skills`)\n } catch (error) {\n say(\n `${spec.name} could not be fetched: ${error instanceof HarnessError ? error.message : String(error)}`,\n )\n }\n }\n const inputs: BrowseInput[] = sources\n .filter((spec) => isCached(spec.name, options.env))\n .map((spec) => ({ spec, entries: readCatalogue(spec, options.env) }))\n return browseRows(inputs)\n}\n\n/** The same thing for the paths that own the terminal, printing each line as it happens. */\nexport async function catalogueRows(options: BrowseOptions): Promise<readonly BrowseRow[]> {\n return await fetchCatalogue({\n ...options,\n onStatus: (line) => process.stdout.write(`${line}\\n`),\n })\n}\n\n/**\n * Install a list of `<source>/<skill>` refs, reporting once.\n *\n * Exported for `init`, whose wizard already collected the refs on its own screen — so it needs the install\n * without the picker.\n */\nexport function installRefs(\n refs: readonly string[],\n manifestPath: string,\n options: BrowseOptions & { readonly envOverlay?: Readonly<Record<string, string | undefined>> },\n): number {\n const outcomes: InstallOutcome[] = []\n for (const ref of refs) {\n skillsCommand({\n action: \"install\",\n manifestPath,\n name: ref,\n quiet: true,\n collect: outcomes,\n ...(options.env === undefined ? {} : { sandboxEnv: options.env }),\n ...(options.envOverlay === undefined ? {} : { envOverlay: options.envOverlay }),\n })\n }\n return report(outcomes)\n}\n\n/**\n * One `skills install` per skill rather than one call with a list.\n *\n * The command's contract is one ref, it reports per skill, and a partial failure leaves the successful\n * ones installed with a named reason for the rest — batching would have to reimplement all of that.\n */\nfunction collectInstall(\n skills: readonly CatalogueEntry[],\n manifestPath: string,\n options: BrowseOptions & { readonly envOverlay?: Readonly<Record<string, string | undefined>> },\n): readonly InstallOutcome[] {\n const outcomes: InstallOutcome[] = []\n for (const entry of skills) {\n skillsCommand({\n action: \"install\",\n manifestPath,\n name: `${entry.source}/${entry.skill}`,\n quiet: true,\n collect: outcomes,\n ...(options.env === undefined ? {} : { sandboxEnv: options.env }),\n ...(options.envOverlay === undefined ? {} : { envOverlay: options.envOverlay }),\n })\n }\n return outcomes\n}\n\n/**\n * The one report for a batch, as text.\n *\n * Renders from `installReport`, which the rich result card also reads — so a pipe and a terminal cannot\n * disagree about what happened. Eleven ticked skills used to produce eleven of these.\n */\nfunction report(outcomes: readonly InstallOutcome[]): number {\n const summary = installReport(outcomes)\n process.stdout.write(\n `${section(`installed ${summary.installed.length} of ${summary.total} skill${summary.total === 1 ? \"\" : \"s\"}`, true)}\\n`,\n )\n if (summary.installed.length > 0) {\n process.stdout.write(`${indent(summary.installed.join(\", \"))}\\n`)\n }\n for (const failure of summary.failed) {\n process.stdout.write(`${bullet(`${failure.name} — ${failure.reason}`)}\\n`)\n }\n if (summary.runnable > 0) {\n // Counted here and named per skill by `skills show`. Twelve file paths per skill across eleven\n // skills is 130 lines of disclosure nobody reads, which discloses less than one honest sentence.\n process.stdout.write(\n `${section(\"code that came with them\")}\\n${indent(\n `${summary.runnable} runnable file${summary.runnable === 1 ? \"\" : \"s\"} across ${summary.withCode} skill${summary.withCode === 1 ? \"\" : \"s\"} — \\`skills show <agent> <skill>\\` names them`,\n )}\\n`,\n )\n }\n return summary.failed.length\n}\n\nexport async function browseCommand(options: BrowseOptions): Promise<number> {\n const sources = loadSources(options.env)\n if (sources.length === 0) {\n process.stdout.write(\n `no skill sources are configured\\n\\n \\`${BRAND.slug} sources add <url>\\` adds one — a repository holding a skills/ directory.\\n`,\n )\n return EXIT_FAILURE\n }\n\n const decision = resolveModeFromProcess({\n plain: options.plain === true,\n json: options.json === true,\n oneShot: false,\n })\n const interactive = decision.mode === \"rich\" && options.json !== true\n\n // The plain and JSON paths still fetch first, because they have nothing to render while they wait\n // and a spinner on a pipe is noise. The rich path does the opposite, and that inversion is the\n // whole point of this stage.\n if (!interactive) {\n const rows = await catalogueRows(options)\n if (rows.length === 0) {\n process.stdout.write(\n `nothing to show — no catalogue could be read\\n\\n \\`${BRAND.slug} sources update\\` reports why.\\n`,\n )\n return EXIT_FAILURE\n }\n if (options.json === true) return printJson(rows)\n return plainList(rows, listAgents(options.env))\n }\n\n const agents = listAgents(options.env)\n if (agents.length === 0) {\n // Checked before the mount because it needs no catalogue: fetching 40 MB to then say there is\n // nowhere to put it would be the wrong order to find out in.\n process.stdout.write(\n `${section(\"no agent to install into\", true)}\\n${indent(`\\`${BRAND.slug} init\\` creates one, then this command installs into it.`)}\\n`,\n )\n return EXIT_FAILURE\n }\n\n const [{ render }, { createElement }, { SkillBrowser }] = await Promise.all([\n import(\"ink\"),\n import(\"react\"),\n import(\"#components/SkillBrowser\"),\n ])\n\n let report: InstallReport | undefined\n let finish: () => void = () => {}\n const closed = new Promise<void>((resolve) => {\n finish = resolve\n })\n\n // Alternate screen: this waits for a keypress, so it takes the terminal and gives it back. The\n // enter sequence and the flag are written together — a flag set without the sequence would make the\n // restore clear the screen the output was just written to.\n markAltScreen()\n process.stdout.write(ENTER_ALT_SCREEN)\n\n const instance = render(\n createElement(SkillBrowser, {\n title: BROWSE_TITLE,\n agents,\n load: (onStatus: (line: string) => void) => fetchCatalogue({ ...options, onStatus }),\n install: async (skills: readonly CatalogueEntry[], manifestPath: string) =>\n installReport(collectInstall(skills, manifestPath, options)),\n onDone: (result: InstallReport | undefined) => {\n report = result\n finish()\n },\n }),\n { exitOnCtrlC: false, ...negotiateKeyboard() },\n )\n onExit(() => instance.unmount())\n await closed\n instance.unmount()\n restoreTerminal()\n await flushOutput()\n\n // Restored first, then one line on the real screen. A clean exit leaves no trace of the browsing;\n // what it does leave is the pointer to what changed, and any failure, because hard rule 8 does not\n // stop applying because a screen has closed.\n if (report === undefined) return EXIT_OK\n for (const failure of report.failed) {\n process.stderr.write(`${failure.name} — ${failure.reason}\\n`)\n }\n if (report.installed.length > 0) {\n process.stdout.write(\n `${report.installed.length} skill${report.installed.length === 1 ? \"\" : \"s\"} installed — \\`${BRAND.slug} skills list <agent>\\` shows them\\n`,\n )\n }\n return report.failed.length === report.total && report.total > 0 ? EXIT_FAILURE : EXIT_OK\n}\n\n/** The JSON form, unchanged and deliberately not rendered. */\nfunction printJson(rows: readonly BrowseRow[]): number {\n process.stdout.write(\n `${JSON.stringify(\n {\n skills: rows\n .filter((row) => row.entry !== undefined)\n .map((row) => ({\n ref: `${row.entry?.source}/${row.entry?.skill}`,\n source: row.entry?.source,\n skill: row.entry?.skill,\n tokens: row.entry?.tokens,\n scripts: row.entry?.scripts.length ?? 0,\n description: row.entry?.description,\n })),\n },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * The pipe's rendering: the same rows, laid out in the same columns, at a fixed 100.\n *\n * Fixed rather than measured, because a redirected stream has no width and output that changed shape\n * depending on the terminal it was *not* written to is output no test can pin.\n */\nfunction plainListText(rows: readonly BrowseRow[]): string {\n const width = 100\n const longest = rows.reduce(\n (max, row) => (row.kind === \"item\" ? Math.max(max, row.label.length) : max),\n 0,\n )\n // `longest + 12` and a matching ceiling, because each name is printed as `<source>/<skill>` here.\n const columns = columnsFor(width, longest + 12, { nameMax: 46 })\n const lines: string[] = []\n for (const row of rows) {\n if (row.kind === \"source\") {\n lines.push(`\\n${row.label}`)\n continue\n }\n if (row.kind === \"group\") {\n lines.push(` ${row.label}`)\n continue\n }\n const cells = layoutRow(\n {\n name: `${row.entry?.source}/${row.label}`,\n meta: row.meta ?? \"\",\n description: row.description ?? \"\",\n },\n columns,\n )\n lines.push(` ${cells.name} ${cells.meta} ${cells.description}`.trimEnd())\n }\n return lines.join(\"\\n\")\n}\n\n/**\n * The pipe's answer: the same rows, plus the two commands that install one without a keypress.\n *\n * Exits 0. Asking what exists is a legitimate question and it was answered — unlike bare `run`, which\n * exits non-zero on a pipe because nothing ran and something was supposed to.\n */\nfunction plainList(rows: readonly BrowseRow[], agents: readonly SandboxAgent[]): number {\n process.stdout.write(`${plainListText(rows)}\\n`)\n const example = rows.find((row) => row.entry !== undefined)?.entry\n const agent = agents[0]?.ref ?? \"<agent>\"\n process.stdout.write(\n `${section(\"install\")}\\n${indent(`${BRAND.slug} skills install ${agent} ${example?.source ?? \"anthropic\"}/${example?.skill ?? \"pdf\"}`)}\\n${indent(`${BRAND.slug} skills — at a terminal, ticks several at once`, 2)}\\n`,\n )\n return EXIT_OK\n}\n\n/** Kept beside the command so the banner and the picker cannot disagree about the version. */\nexport const BROWSE_TITLE = `${BRAND.name} ${VERSION}`\n"
15
- ],
16
- "mappings": ";4cAkBA,iBACI,iBACA,gBACA,kBACA,mBACA,aACA,eACA,oBACA,iBAEJ,mBAAS,iBAAU,WAAY,cAAM,cAAU,mBCL/C,qBAAS,mBAAY,oBAAc,iBACnC,eAAS,mBAEF,IAAM,GAAe,gBAmBtB,GAAU,EAET,SAAS,EAAW,CAAC,EAA2B,CACnD,OAAO,GAAK,EAAW,EAAY,EAGhC,SAAS,EAAW,CAAC,EAAqD,CAC7E,IAAM,EAAO,GAAY,CAAS,EAClC,GAAI,CAAC,GAAW,CAAI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