@koda-sl/baker-cli 0.485.0 → 0.486.0

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 (33) hide show
  1. package/README.md +12 -0
  2. package/dist/{chunk-ADSNY4KZ.js → chunk-DVA4DOBH.js} +2 -2
  3. package/dist/{chunk-CM6FCSWN.js → chunk-LCMIAWUZ.js} +3 -1
  4. package/dist/chunk-LCMIAWUZ.js.map +1 -0
  5. package/dist/cli.js +4 -4
  6. package/dist/{create-B3QMYSIX.js → create-RBZJ27B2.js} +3 -3
  7. package/dist/{delete-S4VKH7IS.js → delete-EJG3MRM2.js} +3 -3
  8. package/dist/{get-MGDY5JYZ.js → get-ZI6RB6K5.js} +3 -3
  9. package/dist/{list-SZH6TH74.js → list-VY4UTTRG.js} +3 -3
  10. package/dist/{mcp-T6SAG4XB.js → mcp-MTFBVKLX.js} +279 -28
  11. package/dist/mcp-MTFBVKLX.js.map +1 -0
  12. package/dist/{run-HCJKCEOL.js → run-IKGW7UPB.js} +3 -3
  13. package/dist/{scheduled-agents-MFLMG34I.js → scheduled-agents-MUCDCONT.js} +10 -10
  14. package/dist/{schema-EFR7NGJG.js → schema-YT2DBX6T.js} +2 -2
  15. package/dist/{targets-NI7TR4GV.js → targets-SF4AOFZ3.js} +3 -3
  16. package/dist/{triggers-WYFM7PAH.js → triggers-PJ3UJAHM.js} +3 -3
  17. package/dist/{unstage-MCM6EZWK.js → unstage-NPQ5JQ6S.js} +3 -3
  18. package/dist/{update-GUIP6G3N.js → update-77YN5JEJ.js} +3 -3
  19. package/package.json +1 -1
  20. package/dist/chunk-CM6FCSWN.js.map +0 -1
  21. package/dist/mcp-T6SAG4XB.js.map +0 -1
  22. /package/dist/{chunk-ADSNY4KZ.js.map → chunk-DVA4DOBH.js.map} +0 -0
  23. /package/dist/{create-B3QMYSIX.js.map → create-RBZJ27B2.js.map} +0 -0
  24. /package/dist/{delete-S4VKH7IS.js.map → delete-EJG3MRM2.js.map} +0 -0
  25. /package/dist/{get-MGDY5JYZ.js.map → get-ZI6RB6K5.js.map} +0 -0
  26. /package/dist/{list-SZH6TH74.js.map → list-VY4UTTRG.js.map} +0 -0
  27. /package/dist/{run-HCJKCEOL.js.map → run-IKGW7UPB.js.map} +0 -0
  28. /package/dist/{scheduled-agents-MFLMG34I.js.map → scheduled-agents-MUCDCONT.js.map} +0 -0
  29. /package/dist/{schema-EFR7NGJG.js.map → schema-YT2DBX6T.js.map} +0 -0
  30. /package/dist/{targets-NI7TR4GV.js.map → targets-SF4AOFZ3.js.map} +0 -0
  31. /package/dist/{triggers-WYFM7PAH.js.map → triggers-PJ3UJAHM.js.map} +0 -0
  32. /package/dist/{unstage-MCM6EZWK.js.map → unstage-NPQ5JQ6S.js.map} +0 -0
  33. /package/dist/{update-GUIP6G3N.js.map → update-77YN5JEJ.js.map} +0 -0
@@ -33,18 +33,18 @@ Examples:
33
33
  Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
34
34
  },
35
35
  subCommands: {
36
- list: () => import("./list-SZH6TH74.js").then((m) => m.listCommand),
37
- get: () => import("./get-MGDY5JYZ.js").then((m) => m.getCommand),
38
- triggers: () => import("./triggers-WYFM7PAH.js").then((m) => m.triggersCommand),
39
- targets: () => import("./targets-NI7TR4GV.js").then((m) => m.targetsCommand),
40
- create: () => import("./create-B3QMYSIX.js").then((m) => m.createCommand),
41
- update: () => import("./update-GUIP6G3N.js").then((m) => m.updateCommand),
42
- delete: () => import("./delete-S4VKH7IS.js").then((m) => m.deleteCommand),
43
- unstage: () => import("./unstage-MCM6EZWK.js").then((m) => m.unstageCommand),
44
- run: () => import("./run-HCJKCEOL.js").then((m) => m.runCommand)
36
+ list: () => import("./list-VY4UTTRG.js").then((m) => m.listCommand),
37
+ get: () => import("./get-ZI6RB6K5.js").then((m) => m.getCommand),
38
+ triggers: () => import("./triggers-PJ3UJAHM.js").then((m) => m.triggersCommand),
39
+ targets: () => import("./targets-SF4AOFZ3.js").then((m) => m.targetsCommand),
40
+ create: () => import("./create-RBZJ27B2.js").then((m) => m.createCommand),
41
+ update: () => import("./update-77YN5JEJ.js").then((m) => m.updateCommand),
42
+ delete: () => import("./delete-EJG3MRM2.js").then((m) => m.deleteCommand),
43
+ unstage: () => import("./unstage-NPQ5JQ6S.js").then((m) => m.unstageCommand),
44
+ run: () => import("./run-IKGW7UPB.js").then((m) => m.runCommand)
45
45
  }
46
46
  });
47
47
  export {
48
48
  scheduledAgentsCommand
49
49
  };
50
- //# sourceMappingURL=scheduled-agents-MFLMG34I.js.map
50
+ //# sourceMappingURL=scheduled-agents-MUCDCONT.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  agentProfile,
3
3
  offers
4
- } from "./chunk-CM6FCSWN.js";
4
+ } from "./chunk-LCMIAWUZ.js";
5
5
  import "./chunk-EE72SSB2.js";
6
6
  import {
7
7
  findSchema,
@@ -66,4 +66,4 @@ export {
66
66
  narrowToFamily,
67
67
  schemaCommand
68
68
  };
69
- //# sourceMappingURL=schema-EFR7NGJG.js.map
69
+ //# sourceMappingURL=schema-YT2DBX6T.js.map
@@ -2,8 +2,8 @@ import {
2
2
  chatBody,
3
3
  failApi,
4
4
  failValidation
5
- } from "./chunk-ADSNY4KZ.js";
6
- import "./chunk-CM6FCSWN.js";
5
+ } from "./chunk-DVA4DOBH.js";
6
+ import "./chunk-LCMIAWUZ.js";
7
7
  import {
8
8
  TRIGGER_KIND_IDS,
9
9
  TRIGGER_TARGET_FIELD_IDS
@@ -100,4 +100,4 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
100
100
  export {
101
101
  targetsCommand
102
102
  };
103
- //# sourceMappingURL=targets-NI7TR4GV.js.map
103
+ //# sourceMappingURL=targets-SF4AOFZ3.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  failApi
3
- } from "./chunk-ADSNY4KZ.js";
4
- import "./chunk-CM6FCSWN.js";
3
+ } from "./chunk-DVA4DOBH.js";
4
+ import "./chunk-LCMIAWUZ.js";
5
5
  import {
6
6
  triggerCatalogSchema
7
7
  } from "./chunk-FRK7SSEH.js";
@@ -139,4 +139,4 @@ export {
139
139
  shapeTriggerCatalog,
140
140
  triggersCommand
141
141
  };
142
- //# sourceMappingURL=triggers-WYFM7PAH.js.map
142
+ //# sourceMappingURL=triggers-PJ3UJAHM.js.map
@@ -2,8 +2,8 @@ import {
2
2
  failApi,
3
3
  failValidation,
4
4
  validateScheduledAgentRef
5
- } from "./chunk-ADSNY4KZ.js";
6
- import "./chunk-CM6FCSWN.js";
5
+ } from "./chunk-DVA4DOBH.js";
6
+ import "./chunk-LCMIAWUZ.js";
7
7
  import "./chunk-FRK7SSEH.js";
8
8
  import "./chunk-GXDLWBOY.js";
9
9
  import "./chunk-GIWHHCD6.js";
@@ -82,4 +82,4 @@ export {
82
82
  unstageBody,
83
83
  unstageCommand
84
84
  };
85
- //# sourceMappingURL=unstage-MCM6EZWK.js.map
85
+ //# sourceMappingURL=unstage-NPQ5JQ6S.js.map
@@ -16,8 +16,8 @@ import {
16
16
  slackBody,
17
17
  validateScheduledAgentRef,
18
18
  writeOk
19
- } from "./chunk-ADSNY4KZ.js";
20
- import "./chunk-CM6FCSWN.js";
19
+ } from "./chunk-DVA4DOBH.js";
20
+ import "./chunk-LCMIAWUZ.js";
21
21
  import "./chunk-FRK7SSEH.js";
22
22
  import "./chunk-GXDLWBOY.js";
23
23
  import "./chunk-GIWHHCD6.js";
@@ -149,4 +149,4 @@ var updateCommand = defineCommand({
149
149
  export {
150
150
  updateCommand
151
151
  };
152
- //# sourceMappingURL=update-GUIP6G3N.js.map
152
+ //# sourceMappingURL=update-77YN5JEJ.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koda-sl/baker-cli",
3
- "version": "0.485.0",
3
+ "version": "0.486.0",
4
4
  "description": "AI-agent-first CLI for interacting with Baker, including the Baker creative canvas.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/command-loading.ts","../src/profile-help.ts","../src/agent-profile.ts"],"sourcesContent":["import type { Resolvable, SubCommandsDef } from \"citty\";\n\n/**\n * Which command families one `baker` invocation has to load.\n *\n * Loading every family is what made each `baker` process hold ~135 MB of heap\n * while it waited on one HTTP call: twenty parallel agents ran sixty of them and\n * filled an 8 GB Runtime. A command needs its own family and nothing else.\n */\nexport function familiesToLoad(argv: readonly string[], families: readonly string[]): string[] | \"all\" {\n const first = argv.find((token) => !token.startsWith(\"-\"));\n // `schema` reads the registry every family fills as it loads.\n if (first !== undefined && first !== \"schema\" && families.includes(first)) return [first];\n return \"all\";\n}\n\nexport type LoadableCommand = { meta?: Resolvable<unknown>; subCommands?: Resolvable<SubCommandsDef> };\n\nasync function resolved<T>(value: Resolvable<T>): Promise<T> {\n return typeof value === \"function\" ? await (value as () => T | Promise<T>)() : await value;\n}\n\n/** The command's subcommands, loaded in place if they were declared lazily. */\nasync function subCommandsOf(command: LoadableCommand): Promise<SubCommandsDef | undefined> {\n if (command.subCommands === undefined) return undefined;\n const subCommands = await resolved(command.subCommands);\n command.subCommands = subCommands;\n return subCommands;\n}\n\n/**\n * The subcommand of `command` that `token` names, by its name or an alias, as\n * citty finds it — loaded in place. An alias lives in the subcommand's own\n * meta, so a token that is no name loads the siblings to read theirs.\n */\nexport async function loadSubCommandNamed(\n command: LoadableCommand,\n token: string,\n): Promise<[string, LoadableCommand] | null> {\n const subCommands = await subCommandsOf(command);\n if (!subCommands) return null;\n const named = subCommands[token];\n if (named !== undefined) {\n const loaded = await resolved(named);\n subCommands[token] = loaded;\n return [token, loaded];\n }\n for (const [name, sub] of Object.entries(subCommands)) {\n const loaded = await resolved(sub);\n subCommands[name] = loaded;\n const meta = (await resolved(loaded.meta ?? {})) as { alias?: unknown };\n const aliases = Array.isArray(meta.alias) ? meta.alias : meta.alias === undefined ? [] : [meta.alias];\n if (aliases.includes(token)) return [name, loaded];\n }\n return null;\n}\n\n/** Loads, in place, every command at every depth. */\nexport async function loadAllCommands(command: LoadableCommand): Promise<void> {\n const subCommands = await subCommandsOf(command);\n if (!subCommands) return;\n for (const [name, sub] of Object.entries(subCommands)) {\n const loaded = await resolved(sub);\n subCommands[name] = loaded;\n await loadAllCommands(loaded);\n }\n}\n\n/**\n * Loads, in place, the command `argv` names and every parent on the way — and\n * nothing else, so the flag guards in `cli.ts` see the command they judge while\n * its siblings stay unloaded. Everything loads for `schema` and an unknown\n * name, which need the whole tree. It stops at the first flag: the organization\n * guard (`agent-profile.ts`) walks on past one itself, and loads the subtree a\n * `--help` lists.\n */\nexport async function loadCommands<T extends LoadableCommand>(root: T, argv: readonly string[]): Promise<T> {\n const families = Object.keys((await subCommandsOf(root)) ?? {});\n if (familiesToLoad(argv, families) === \"all\") {\n await loadAllCommands(root);\n return root;\n }\n let command: LoadableCommand = root;\n for (const token of argv) {\n if (token === \"--\" || token.startsWith(\"-\")) break;\n const subCommands = await subCommandsOf(command);\n const sub = subCommands?.[token];\n if (!subCommands || sub === undefined) break;\n const loaded = await resolved(sub);\n subCommands[token] = loaded;\n command = loaded;\n }\n return root;\n}\n","/**\n * What a command's help says, for the agent reading it.\n *\n * Descriptions are written for a company's agent, which may run every command:\n * they cite writes as examples (`baker ads meta campaigns create …`) and say a\n * family \"lists campaigns, or stages writes\". Read by the organization's agent,\n * which may only read, each is a call it would make and be refused. So a line\n * that names a command the reader may not run leaves its help, and where a\n * family holds commands the reader may not run, so does the talk of staging\n * them. A family the reader may change whole (the organization's own Scheduled\n * agents) keeps its staging, because it is how that family works.\n */\n\nimport type { AgentProfile } from \"./agent-profile.ts\";\n\ntype HelpNode = { meta?: unknown; subCommands?: unknown };\ntype Offers = (path: string) => boolean;\n\nfunction loadedSubCommands(node: HelpNode): Array<[string, HelpNode]> {\n const subCommands = node.subCommands;\n if (typeof subCommands !== \"object\" || subCommands === null) return [];\n return Object.entries(subCommands as Record<string, unknown>).flatMap(([name, sub]) =>\n typeof sub === \"object\" && sub !== null ? [[name, sub as HelpNode] as [string, HelpNode]] : [],\n );\n}\n\nfunction subCommandNames(node: HelpNode): string[] {\n const subCommands = node.subCommands;\n return typeof subCommands === \"object\" && subCommands !== null ? Object.keys(subCommands) : [];\n}\n\n/**\n * The command words name (`baker <words>`, or a family's command in backticks),\n * as far as the tree reaches; none when the first is no family. Where the tree\n * is not loaded this far (another family, a sibling this call never needed),\n * the words as written stand for the command: `offers` reads a command by its\n * leading words, so an argument after them changes nothing.\n */\nfunction commandOf(root: HelpNode, mention: string): string[] {\n const words = mention.trim().split(/\\s+/);\n let node: HelpNode = root;\n const path: string[] = [];\n for (const word of words) {\n const loaded = loadedSubCommands(node).find(([name]) => name === word)?.[1];\n if (!loaded) {\n // Not loaded is not \"not there\": a lazy entry of that name stands for the words written.\n return subCommandNames(node).includes(word) ? [words.join(\" \")] : path.length > 0 ? [path.join(\" \")] : [];\n }\n node = loaded;\n path.push(word);\n }\n return [path.join(\" \")];\n}\n\nfunction indentOf(line: string): number {\n return line.length - line.trimStart().length;\n}\n\n/**\n * The lines without those `drops` says go, each taken with what continues it:\n * the lines indented under it, the next line after a trailing `\\`, and the rest\n * of a sentence wrapped onto the lines below. `drops` returns the kept text of\n * a line, or null to drop it.\n */\nfunction dropping(lines: string[], drops: (line: string) => string | null): string[] {\n const kept: string[] = [];\n let carried: ((line: string) => boolean) | null = null;\n for (const line of lines) {\n if (carried?.(line)) continue;\n carried = null;\n const rest = drops(line);\n if (rest !== null) {\n kept.push(rest);\n continue;\n }\n const indent = indentOf(line);\n if (/\\\\\\s*$/.test(line)) {\n let open = true;\n carried = (next) => {\n const continues = open;\n open = /\\\\\\s*$/.test(next);\n return continues;\n };\n } else if (indent === 0 && !/[.:!?)]\\s*$/.test(line)) {\n let open = true;\n carried = (next) => {\n const continues = open && next.trim() !== \"\" && indentOf(next) === 0;\n open = continues && !/[.:!?)]\\s*$/.test(next);\n return continues;\n };\n } else if (indent > 0) {\n carried = (next) => next.trim() !== \"\" && indentOf(next) > indent;\n }\n }\n return kept;\n}\n\n/** A line that stands alone — an example, a table row, a \"Label: …\" entry — goes whole. */\nconst STANDALONE_LINE = /^(?:\\s|baker\\b|[A-Z][\\w ]{0,30}:\\s)/;\n\nfunction balanced(text: string): boolean {\n return (text.match(/\\(/g)?.length ?? 0) === (text.match(/\\)/g)?.length ?? 0);\n}\n\n/** Each command the text names, at where it names it: `baker <words>`, or a family's `<words>` in backticks. */\nfunction commandMentions(root: HelpNode, text: string): Array<{ at: number; words: string }> {\n const families = new Set(subCommandNames(root));\n const quoted = [...text.matchAll(/`([a-z][\\w-]*(?:[ \\t][a-z][\\w-]*)*)(?=[`\\s<])/g)].filter((match) =>\n families.has((match[1] ?? \"\").split(/\\s+/)[0] ?? \"\"),\n );\n return [...text.matchAll(/`?\\bbaker ((?:[a-z][\\w-]*[ \\t]?)+)/g), ...quoted].map((match) => ({\n at: match.index,\n words: match[1] ?? \"\",\n }));\n}\n\n/**\n * Where the text first mentions something the reader may not use — a command\n * it is not offered, or a flag it is refused (`--add-trigger`) — or -1.\n */\nfunction firstUnusable(root: HelpNode, text: string, offered: Offers, refusedFlags: readonly string[]): number {\n const commands = commandMentions(root, text)\n .filter(({ words }) => commandOf(root, words).some((path) => !offered(path)))\n .map(({ at }) => at);\n const flags = refusedFlags.flatMap((flag) => {\n const match = new RegExp(`--${flag}(?![\\\\w-])`).exec(text);\n return match ? [match.index] : [];\n });\n const at = [...commands, ...flags];\n return at.length > 0 ? Math.min(...at) : -1;\n}\n\n/**\n * The sentence without what it says about something the reader may not use:\n * cut back to the clause before the mention when one stands on its own, else\n * dropped.\n */\nfunction sentenceWithout(sentence: string, unusableAt: number): string {\n if (unusableAt === -1) return sentence;\n const before = sentence.slice(0, unusableAt).replace(/`$/, \"\");\n const cut = Math.max(before.lastIndexOf(\", \"), before.lastIndexOf(\" — \"), before.lastIndexOf(\"; \"));\n const clause = cut === -1 ? \"\" : before.slice(0, cut).trim();\n // \"To undo one, `baker …`\" only led to the command.\n const leadsIn = /^(?:to|use|run|call|for|with)\\b/i.test(clause);\n return clause.split(/\\s+/).length >= 3 && balanced(clause) && !leadsIn ? `${clause}.` : \"\";\n}\n\n/** A sentence that leans on the one before it (\"It never touches a live tag.\"). */\nconst LEANS_BACK = /^(?:it|they|this|that|these|those)\\b/i;\n\n/** The text without any mention of a command the reader may not run, or a flag it is refused. */\nexport function withoutUnoffered(\n root: HelpNode,\n text: string,\n offered: Offers,\n refusedFlags: readonly string[] = [],\n): string {\n const unusable = (part: string) => firstUnusable(root, part, offered, refusedFlags);\n return dropping(text.split(\"\\n\"), (line) => {\n if (unusable(line) === -1) return line;\n if (STANDALONE_LINE.test(line)) return null;\n const kept: string[] = [];\n let dropped = false;\n for (const sentence of line.split(/(?<=[.!?])\\s+/)) {\n const rest: string = dropped && LEANS_BACK.test(sentence) ? \"\" : sentenceWithout(sentence, unusable(sentence));\n dropped = rest === \"\";\n if (rest !== \"\") kept.push(rest);\n }\n return kept.length === 0 ? null : kept.join(\" \");\n }).join(\"\\n\");\n}\n\n/** Whether anything loaded under `path` is a command the reader may not run. */\nfunction holdsUnoffered(node: HelpNode, path: string[], offered: Offers): boolean {\n return loadedSubCommands(node).some(\n ([name, sub]) => !offered([...path, name].join(\" \")) || holdsUnoffered(sub, [...path, name], offered),\n );\n}\n\n/** A sentence or line that is about staging a change, from its first words. */\nconst WRITE_TALK =\n /^(?:stage\\b|staged\\b|staging\\b|write subcommands\\b|writes\\b|then stage\\b|drafts:|staged vs published\\b|lifecycle:|nothing staged\\b|on publish\\b|\\w+(?: \\/ \\w+)*\\s+—\\s+stage\\b)/i;\n\n/** The tail of a sentence offering a change: \"List campaigns, or stage writes (…)\". */\nconst WRITE_CLAUSE =\n /(?:\\s*(?:[,;]|\\s—|\\s-)\\s*(?:(?:or|plus|and)\\s+)?|\\s+(?:or|plus|and)\\s+)(?:stage[sd]?|staged)\\b[^.]*/gi;\n\n/** \"List, show, amend or clear …\": a sentence opening on a list of this command's own verbs. */\nconst VERB_LIST = /^((?:[A-Za-z]+, )*[A-Za-z]+,? (?:or|and) [a-z]+)\\b/;\n\n/** The sentence naming, of the verbs it opens on, only those the reader may run; \"\" when none. */\nfunction withOfferedVerbs(sentence: string, children: ReadonlySet<string>, unoffered: ReadonlySet<string>): string {\n const list = VERB_LIST.exec(sentence)?.[1];\n if (!list) return sentence;\n const verbs = list.split(/,\\s*(?:(?:or|and)\\s+)?|\\s+(?:or|and)\\s+/).map((verb) => verb.toLowerCase());\n if (!verbs.every((verb) => children.has(verb))) return sentence;\n const kept = verbs.filter((verb) => !unoffered.has(verb));\n if (kept.length === 0) return \"\";\n const named = kept.length === 1 ? (kept[0] ?? \"\") : `${kept.slice(0, -1).join(\", \")} or ${kept.at(-1)}`;\n return `${named.charAt(0).toUpperCase()}${named.slice(1)}${sentence.slice(list.length)}`;\n}\n\n/** Whether text opens on the name of a command here the reader may not run (\"Release if…\", \" associate-campaign / …\"). */\nfunction opensOnUnoffered(text: string, unoffered: ReadonlySet<string>): boolean {\n const first =\n text\n .trim()\n .split(/[\\s/]+/)[0]\n ?.toLowerCase() ?? \"\";\n return unoffered.has(first);\n}\n\n/** A line that is about a change: staging talk, a command it may not run, or \"Library writes (…):\" over reads. */\nfunction isWriteLine(line: string, unoffered: ReadonlySet<string>): boolean {\n if (WRITE_TALK.test(line.trim())) return true;\n if (indentOf(line) > 0) return opensOnUnoffered(line, unoffered);\n return /:\\s*$/.test(line) && /\\bwrites?\\b/i.test(line);\n}\n\nfunction withoutWriteTalk(paragraph: string, children: ReadonlySet<string>, unoffered: ReadonlySet<string>): string {\n const prose = (text: string) =>\n text\n .replace(WRITE_CLAUSE, \"\")\n .split(/(?<=[.!?])\\s+/)\n .map((sentence) => withOfferedVerbs(sentence, children, unoffered))\n .filter(\n (sentence) => sentence !== \"\" && !WRITE_TALK.test(sentence.trim()) && !opensOnUnoffered(sentence, unoffered),\n )\n .join(\" \");\n const lines = paragraph.split(\"\\n\");\n // Examples, tables and headings are kept line by line, and a line of prose among them sentence by sentence.\n if (lines.some((line) => /^\\s/.test(line) || STANDALONE_LINE.test(line) || /:\\s*$/.test(line))) {\n return dropping(lines, (line) => {\n if (isWriteLine(line, unoffered)) return null;\n if (indentOf(line) > 0 || STANDALONE_LINE.test(line) || !/[.!?]\\s*$/.test(line)) return line;\n const kept = prose(line);\n return kept === \"\" ? null : kept;\n }).join(\"\\n\");\n }\n return prose(lines.join(\" \"));\n}\n\n/** \"Subcommands: list (default), remove, clear.\" names only the ones the reader may run. */\nfunction withOfferedSubcommands(text: string, path: string[], offered: Offers): string {\n return text.replace(/Subcommands: ([^.]*)\\./g, (_whole, list: string) => {\n const kept = list.split(/,\\s*/).filter((item) => offered([...path, item.split(/\\s/)[0] ?? \"\"].join(\" \")));\n return kept.length > 0 ? `Subcommands: ${kept.join(\", \")}.` : \"\";\n });\n}\n\n/** Drops a heading whose block below it was emptied, and the blank lines left behind. */\nfunction tidy(text: string): string {\n const lines = text.split(\"\\n\");\n const kept = lines.filter((line, index) => {\n if (!/:\\s*$/.test(line)) return true;\n const next = lines.slice(index + 1).find((later) => later.trim() !== \"\");\n return next !== undefined && /^\\s/.test(next) && lines[index + 1]?.trim() !== \"\";\n });\n return kept\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .replace(/^(?:[ \\t]*\\n)+/, \"\")\n .trimEnd();\n}\n\nexport function describedFor(\n root: HelpNode,\n description: string,\n path: string[],\n node: HelpNode,\n profile: AgentProfile,\n offered: Offers,\n refusedFlags: readonly string[] = [],\n): string {\n const cited = withoutUnoffered(root, description, offered, refusedFlags);\n if (profile === \"company\" || !holdsUnoffered(node, path, offered)) return tidy(cited);\n const children = new Set(subCommandNames(node));\n const unoffered = new Set([...children].filter((name) => !offered([...path, name].join(\" \"))));\n const shaped = cited\n .split(/\\n\\s*\\n/)\n .map((paragraph) => withoutWriteTalk(withOfferedSubcommands(paragraph, path, offered), children, unoffered))\n .join(\"\\n\\n\");\n const text = tidy(shaped);\n if (text !== \"\") return text;\n const reads = loadedSubCommands(node).flatMap(([name]) => (offered([...path, name].join(\" \")) ? [name] : []));\n return reads.length > 0 ? `Read: ${reads.join(\", \")}.` : \"\";\n}\n","import { type LoadableCommand, loadAllCommands, loadSubCommandNamed } from \"./command-loading.ts\";\nimport { optionalWorkspaceKind } from \"./env.ts\";\nimport { describedFor, withoutUnoffered } from \"./profile-help.ts\";\n\n/**\n * Which commands this CLI offers the agent running it.\n *\n * One CLI serves two agents. A company's agent works inside its own workspace\n * and changes it; it is offered everything, except the organization family,\n * which is for reading other companies and means nothing to it. The\n * organization workspace's agent reads every company of its organization and\n * changes none of them: it is offered the reads alone, plus the research and\n * judgment it runs as itself, and its own Scheduled agents.\n *\n * This is what the agent is shown, not what it is allowed: the backend refuses\n * a write naming a company whatever the CLI does (`readNamedCompany`). Kept as\n * an explicit list so a new command is hidden from the organization until\n * someone decides it only reads.\n */\n\nexport type AgentProfile = \"company\" | \"organization\";\n\n/** Set on the organization workspace's Runtime (`runtimeSession/nodeActions.ts`). */\nexport function agentProfile(workspaceKind: string | undefined = optionalWorkspaceKind()): AgentProfile {\n return workspaceKind === \"organization\" ? \"organization\" : \"company\";\n}\n\n/** Families only the organization workspace runs: hidden from a company's agent. */\nconst ORGANIZATION_ONLY = [\"organization\"];\n\n/**\n * Every command the organization workspace's agent is offered, as typed. An\n * entry offers that command and everything under it.\n */\nexport const ORGANIZATION_COMMANDS: readonly string[] = [\n \"schema\",\n \"capabilities\",\n \"organization\",\n // What a company did and has.\n \"chats\",\n \"history\",\n \"actions list\",\n \"actions log\",\n \"actions get\",\n \"actions status\",\n \"actions draft list\",\n \"actions tags list\",\n // The organization's own Scheduled agents, which live in this workspace:\n // staged like a company's, applied at Publish. Naming a company is still a\n // read only (`readNamedCompany`), so none of these reaches one.\n \"scheduled-agents\",\n \"experiment status\",\n \"experiment history\",\n \"flows list\",\n \"flows show\",\n \"flows schema\",\n \"testimonials get\",\n \"testimonials search\",\n \"testimonials list\",\n \"testimonials tags list\",\n \"testimonials sources list\",\n \"images get\",\n \"images search\",\n \"images library\",\n \"images tags list\",\n \"videos get\",\n \"videos search\",\n \"videos tags list\",\n \"studio get\",\n \"studio list\",\n \"avatars list\",\n \"avatars get\",\n \"creatives performance\",\n \"creatives feedback read\",\n \"landing export status\",\n \"landing export list\",\n \"site show\",\n \"site domain list\",\n \"credentials list\",\n \"setup-links list\",\n \"media-sources list\",\n \"mcp connected\",\n \"mcp catalog\",\n \"mcp list\",\n // Ads, every platform: accounts, structure, results, staged drafts.\n \"ads google accounts\",\n \"ads google currency\",\n \"ads google url-options\",\n \"ads google changes\",\n \"ads google invoices\",\n \"ads google identity-verification\",\n \"ads google previews\",\n \"ads google brands\",\n \"ads google query\",\n \"ads google keywords discover\",\n \"ads google keywords metrics\",\n \"ads google keywords forecast\",\n \"ads google keywords themes\",\n \"ads google keywords locations\",\n \"ads google keywords languages\",\n \"ads google keywords list\",\n \"ads google budgets list\",\n \"ads google campaigns list\",\n \"ads google ad-groups list\",\n \"ads google negative-keywords list\",\n \"ads google keyword-lists list\",\n \"ads google ads list\",\n \"ads google assets list\",\n \"ads google asset-groups list\",\n \"ads google audiences list\",\n \"ads google audiences targeting\",\n \"ads google conversions list\",\n \"ads google bidding-strategies list\",\n \"ads google labels list\",\n \"ads google campaign-criteria list\",\n \"ads google ad-group-criteria list\",\n \"ads google ad-group-bid-modifiers list\",\n \"ads google account-exclusions list\",\n \"ads google merchant-center list\",\n \"ads google draft list\",\n \"ads google draft show\",\n \"ads meta accounts\",\n \"ads meta account\",\n \"ads meta businesses\",\n \"ads meta pages\",\n \"ads meta lead-forms list\",\n \"ads meta leads\",\n \"ads meta campaigns list\",\n \"ads meta adsets list\",\n \"ads meta ads list\",\n \"ads meta creatives list\",\n \"ads meta audiences list\",\n \"ads meta custom-conversions list\",\n \"ads meta pixels\",\n \"ads meta activities\",\n \"ads meta insights\",\n \"ads meta draft list\",\n \"ads meta draft show\",\n \"ads linkedin accounts\",\n \"ads linkedin account detail\",\n \"ads linkedin campaign-groups list\",\n \"ads linkedin campaigns list\",\n \"ads linkedin creatives list\",\n \"ads linkedin draft list\",\n \"ads linkedin draft show\",\n \"ads linkedin analytics\",\n \"ads linkedin demographics\",\n \"ads linkedin companies\",\n \"ads linkedin top-companies\",\n \"ads linkedin resolve\",\n \"ads linkedin facets list\",\n \"ads linkedin facets values\",\n \"ads linkedin audience-size\",\n \"ads linkedin bid-pricing\",\n \"ads linkedin forecast\",\n \"ads linkedin leads\",\n \"ads linkedin conversions list\",\n \"ads linkedin conversions health\",\n \"ads linkedin conversation\",\n \"ads linkedin audit\",\n \"ads linkedin url-params\",\n \"ads x accounts\",\n \"ads x funding\",\n \"ads x campaigns list\",\n \"ads x line-items list\",\n \"ads x promoted-tweets list\",\n \"ads x tweets\",\n \"ads x cards\",\n \"ads x draft list\",\n \"ads x draft show\",\n \"ads x media\",\n \"ads x audiences\",\n \"ads x targeting-criteria list\",\n \"ads x targeting-constants\",\n \"ads x active-entities\",\n \"ads x stats job-status\",\n \"ads chatgpt account show\",\n \"ads chatgpt campaigns list\",\n \"ads chatgpt ad-groups list\",\n \"ads chatgpt ads list\",\n \"ads chatgpt conversions list\",\n \"ads chatgpt conversions events\",\n \"ads chatgpt conversions report\",\n \"ads chatgpt audiences list\",\n \"ads chatgpt catalogs list\",\n \"ads chatgpt catalogs uploads\",\n \"ads chatgpt catalogs products\",\n \"ads chatgpt history\",\n \"ads chatgpt insights\",\n \"ads chatgpt locations\",\n \"ads chatgpt draft list\",\n \"ads chatgpt draft show\",\n // Pages and measurement.\n \"analytics overview\",\n \"analytics traffic\",\n \"analytics funnel\",\n \"analytics flow\",\n \"analytics page\",\n \"analytics triggers\",\n \"analytics releases\",\n \"analytics paid\",\n \"analytics delivery\",\n \"analytics submissions\",\n \"analytics geo\",\n \"analytics bots\",\n \"analytics landings\",\n \"analytics tags\",\n \"analytics events\",\n \"analytics feed\",\n \"analytics lookup\",\n \"analytics devices\",\n \"analytics ads\",\n \"analytics conversions\",\n \"analytics sends\",\n \"analytics tracking\",\n \"analytics arrivals\",\n \"analytics sending-events\",\n \"analytics sources\",\n \"analytics website-tag\",\n \"analytics sites\",\n \"analytics questionnaire\",\n \"analytics presets\",\n \"funnel\",\n \"ga4 properties\",\n \"ga4 config\",\n \"ga4 audit\",\n \"ga4 query\",\n \"ga4 draft list\",\n \"ga4 draft show\",\n \"gsc\",\n \"tags list\",\n \"tags draft\",\n \"tag-manager containers\",\n \"tag-manager read\",\n \"tag-manager draft list\",\n \"tag-manager draft show\",\n // CRM and accounts.\n \"hubspot\",\n \"accounts influenced\",\n \"accounts engagement\",\n \"accounts warm\",\n \"accounts company\",\n \"accounts campaigns\",\n \"accounts crm status\",\n \"accounts crm check\",\n \"accounts crm contract\",\n // Research and judgment, run as the workspace itself (never with --company).\n // Not `research customers`, which writes into a company's Knowledge, nor\n // `winning-ads fit`, which judges an ad against a company's own COMPANY.md.\n \"research web\",\n \"research fetch\",\n \"research google-ads\",\n \"research reddit\",\n \"research advertisers\",\n \"research autocomplete\",\n \"research countries\",\n \"research intent\",\n \"research keyword-metrics\",\n \"research keywords-for-site\",\n \"research keyword-gap\",\n \"research languages\",\n \"research lighthouse\",\n \"research relevant-pages\",\n \"decide\",\n \"winning-ads search\",\n \"winning-ads advertisers\",\n \"winning-ads following\",\n \"winning-ads feed\",\n \"winning-ads winners\",\n \"winning-ads ads\",\n \"winning-ads profile\",\n \"winning-ads launches\",\n \"winning-ads landings\",\n \"winning-ads search-copy\",\n \"winning-ads content\",\n \"winning-ads hooks\",\n \"winning-ads mechanisms\",\n \"winning-ads formats\",\n];\n\nfunction covers(entry: string, path: string): boolean {\n return path === entry || path.startsWith(`${entry} `);\n}\n\n/**\n * Whether `path` (a command as typed, `\"ads meta campaigns list\"`) is offered\n * to `profile`. A group is offered when anything under it is, so the way to an\n * offered command stays open.\n */\nexport function offers(profile: AgentProfile, path: string): boolean {\n if (path === \"\") return true;\n if (profile === \"company\") {\n return !ORGANIZATION_ONLY.some((family) => covers(family, path));\n }\n return ORGANIZATION_COMMANDS.some((entry) => covers(entry, path) || covers(path, entry));\n}\n\n/**\n * The flags that change something, on commands the organization is offered to\n * read. `funnel` reads the funnel and `funnel --add-trigger` changes it, so the\n * command is offered and these are refused, and left out of its help.\n */\nexport const ORGANIZATION_WRITE_FLAGS: Readonly<Record<string, readonly string[]>> = {\n funnel: [\"steps\", \"step\", \"add-trigger\", \"remove-trigger\", \"event\", \"remove-step\", \"preset\"],\n \"analytics conversions\": [\"event\", \"name\", \"rename\", \"to\", \"remove-name\", \"count-mode\", \"remove\"],\n \"analytics sends\": [\n \"set\",\n \"source-event\",\n \"from\",\n \"platform\",\n \"tag\",\n \"event\",\n \"account\",\n \"parameter\",\n \"id\",\n \"remove\",\n ],\n \"analytics sources\": [\n \"server\",\n \"create\",\n \"create-hubspot\",\n \"create-activecampaign\",\n \"events\",\n \"account\",\n \"set-trigger\",\n \"set-amount\",\n \"amount-property\",\n \"currency\",\n \"write\",\n \"name\",\n \"map\",\n \"field\",\n \"pause\",\n \"resume\",\n \"remove\",\n ],\n \"analytics sites\": [\"add\", \"remove\"],\n};\n\nfunction kebabCase(name: string): string {\n return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/** The first flag in `argv` the organization is refused on the command at `path`, if any. */\nfunction refusedFlagIn(path: string, argv: readonly string[]): string | null {\n const refused = ORGANIZATION_WRITE_FLAGS[path];\n if (!refused) return null;\n const end = argv.indexOf(\"--\");\n for (const token of end === -1 ? argv : argv.slice(0, end)) {\n if (!token.startsWith(\"--\")) continue;\n const name = kebabCase(token.slice(2).split(\"=\")[0] ?? \"\").replace(/^no-/, \"\");\n if (refused.includes(name)) return name;\n }\n return null;\n}\n\ntype ProfiledCommand = { meta?: unknown; subCommands?: unknown };\n\n/** What the organization's agent is told when it reaches for a command it is not offered. */\nexport const ORGANIZATION_REFUSAL =\n \"The organization workspace only reads its companies, and this command changes something. A change to a company is made in that company's own chat; here, read it and show it in a Report.\";\n\nfunction hide(command: ProfiledCommand): void {\n if (typeof command.meta === \"object\" && command.meta !== null) {\n (command.meta as { hidden?: boolean }).hidden = true;\n }\n}\n\n/**\n * Rewrites, in place, what each loaded command `profile` is shown says\n * (`profile-help.ts`), and takes off it the flags `profile` is refused. Args are\n * replaced rather than edited: one definition can be shared between commands.\n */\nfunction describeOffered(root: ProfiledCommand, command: ProfiledCommand, profile: AgentProfile, path: string[]): void {\n const meta = command.meta as { hidden?: boolean; description?: unknown } | undefined;\n if (meta?.hidden === true) return;\n const offered = (cited: string) => offers(profile, cited);\n const refusedFlags = profile === \"organization\" ? (ORGANIZATION_WRITE_FLAGS[path.join(\" \")] ?? []) : [];\n if (typeof meta?.description === \"string\") {\n meta.description = describedFor(root, meta.description, path, command, profile, offered, refusedFlags);\n }\n const shaped = command as { args?: unknown };\n if (typeof shaped.args === \"object\" && shaped.args !== null) {\n shaped.args = Object.fromEntries(\n Object.entries(shaped.args as Record<string, unknown>).flatMap(([name, arg]) => {\n if (refusedFlags.includes(kebabCase(name))) return [];\n const description = (arg as { description?: unknown } | null)?.description;\n return [\n [\n name,\n typeof description === \"string\"\n ? { ...(arg as object), description: withoutUnoffered(root, description, offered, refusedFlags) }\n : arg,\n ],\n ];\n }),\n );\n }\n const subCommands = command.subCommands;\n if (typeof subCommands !== \"object\" || subCommands === null) return;\n for (const [name, sub] of Object.entries(subCommands as Record<string, unknown>)) {\n if (typeof sub === \"object\" && sub !== null)\n describeOffered(root, sub as ProfiledCommand, profile, [...path, name]);\n }\n}\n\n/** Marks, in place, every loaded command `profile` is not offered as hidden from help. */\nfunction hideUnoffered(command: ProfiledCommand, profile: AgentProfile, path: string[]): void {\n const subCommands = command.subCommands;\n if (typeof subCommands !== \"object\" || subCommands === null) return;\n for (const [name, sub] of Object.entries(subCommands as Record<string, unknown>)) {\n if (typeof sub !== \"object\" || sub === null) continue;\n const subPath = [...path, name];\n if (!offers(profile, subPath.join(\" \"))) hide(sub as ProfiledCommand);\n hideUnoffered(sub as ProfiledCommand, profile, subPath);\n }\n}\n\ntype ArgDefinition = { type?: unknown; alias?: unknown };\n\nfunction camelCase(name: string): string {\n return name.replace(/-([a-z0-9])/g, (_, letter: string) => letter.toUpperCase());\n}\n\nfunction aliases(of: unknown): unknown[] {\n return Array.isArray(of) ? of : of === undefined ? [] : [of];\n}\n\n/** Whether `flag` takes the token after it as its value on `command`, as citty reads it. */\nfunction takesValue(command: ProfiledCommand & { args?: unknown }, flag: string): boolean {\n if (flag.includes(\"=\") || typeof command.args !== \"object\" || command.args === null) return false;\n const name = flag.replace(/^-{1,2}/, \"\");\n return Object.entries(command.args as Record<string, ArgDefinition>).some(\n ([key, definition]) =>\n (definition.type === \"string\" || definition.type === \"enum\") &&\n (camelCase(key) === camelCase(name) || aliases(definition.alias).includes(name)),\n );\n}\n\n/**\n * The command `argv` addresses, found the way citty finds it: flags, and the\n * value after one that takes it, are skipped, so a flag before a command's name\n * cannot leave the path at its group. Each step is loaded on the way —\n * `loadCommands` stops at the first flag, and `--company` is taken off only\n * after it ran, so the guard cannot lean on what it loaded.\n */\nasync function addressedCommand(\n root: ProfiledCommand,\n argv: readonly string[],\n): Promise<{ path: string; command: ProfiledCommand }> {\n const path: string[] = [];\n let command: ProfiledCommand = root;\n for (let index = 0; index < argv.length; index++) {\n const token = argv[index] ?? \"\";\n if (token === \"--\") break;\n if (token.startsWith(\"-\")) {\n if (takesValue(command, token)) index++;\n continue;\n }\n const next = await loadSubCommandNamed(command as LoadableCommand, token);\n if (!next) break;\n path.push(next[0]);\n command = next[1] as ProfiledCommand;\n }\n return { path: path.join(\" \"), command };\n}\n\n/**\n * Shapes the loaded command tree for the agent running it: what it is not\n * offered leaves its help, and the organization's agent is refused a command it\n * is not offered (the returned message; `null` when it may run). A company's\n * agent is never refused: the organization's commands are only out of its help,\n * because a Report published from the organization workspace runs them on a\n * runner that has no profile of its own.\n */\nexport async function applyAgentProfile(\n root: ProfiledCommand,\n profile: AgentProfile,\n argv: readonly string[],\n): Promise<string | null> {\n const { path, command } = await addressedCommand(root, argv);\n // A walk that ends on a group prints its usage — `--help` anywhere, past `--`\n // too, or no command or an unknown one — listing its subcommands, which are\n // hidden only once loaded. A walk that reaches a command loads nothing more.\n await loadAllCommands(command as LoadableCommand);\n // Judged before the help is shaped, which takes the refused flags off the command.\n const refused = profile === \"organization\" && (!offers(profile, path) || refusedFlagIn(path, argv) !== null);\n hideUnoffered(root, profile, []);\n describeOffered(root, root, profile, []);\n return refused ? ORGANIZATION_REFUSAL : null;\n}\n"],"mappings":";;;;;AASO,SAAS,eAAe,MAAyB,UAA+C;AACrG,QAAM,QAAQ,KAAK,KAAK,CAAC,UAAU,CAAC,MAAM,WAAW,GAAG,CAAC;AAEzD,MAAI,UAAU,UAAa,UAAU,YAAY,SAAS,SAAS,KAAK,EAAG,QAAO,CAAC,KAAK;AACxF,SAAO;AACT;AAIA,eAAe,SAAY,OAAkC;AAC3D,SAAO,OAAO,UAAU,aAAa,MAAO,MAA+B,IAAI,MAAM;AACvF;AAGA,eAAe,cAAc,SAA+D;AAC1F,MAAI,QAAQ,gBAAgB,OAAW,QAAO;AAC9C,QAAM,cAAc,MAAM,SAAS,QAAQ,WAAW;AACtD,UAAQ,cAAc;AACtB,SAAO;AACT;AAOA,eAAsB,oBACpB,SACA,OAC2C;AAC3C,QAAM,cAAc,MAAM,cAAc,OAAO;AAC/C,MAAI,CAAC,YAAa,QAAO;AACzB,QAAM,QAAQ,YAAY,KAAK;AAC/B,MAAI,UAAU,QAAW;AACvB,UAAM,SAAS,MAAM,SAAS,KAAK;AACnC,gBAAY,KAAK,IAAI;AACrB,WAAO,CAAC,OAAO,MAAM;AAAA,EACvB;AACA,aAAW,CAAC,MAAM,GAAG,KAAK,OAAO,QAAQ,WAAW,GAAG;AACrD,UAAM,SAAS,MAAM,SAAS,GAAG;AACjC,gBAAY,IAAI,IAAI;AACpB,UAAM,OAAQ,MAAM,SAAS,OAAO,QAAQ,CAAC,CAAC;AAC9C,UAAMA,WAAU,MAAM,QAAQ,K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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;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AAS,YAAY,QAAQ,SAAS,KAAM,QAAO;AAC5F,QAAM,OAAO,KAAK,QAAQ,WAAW,EAAE;AACvC,SAAO,OAAO,QAAQ,QAAQ,IAAqC,EAAE;AAAA,IACnE,CAAC,CAAC,KAAK,UAAU,OACd,WAAW,SAAS,YAAY,WAAW,SAAS,YACpD,UAAU,GAAG,MAAM,UAAU,IAAI,KAAK,QAAQ,WAAW,KAAK,EAAE,SAAS,IAAI;AAAA,EAClF;AACF;AASA,eAAe,iBACb,MACA,MACqD;AACrD,QAAM,OAAiB,CAAC;AACxB,MAAI,UAA2B;AAC/B,WAAS,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;AAChD,UAAM,QAAQ,KAAK,KAAK,KAAK;AAC7B,QAAI,UAAU,KAAM;AACpB,QAAI,MAAM,WAAW,GAAG,GAAG;AACzB,UAAI,WAAW,SAAS,KAAK,EAAG;AAChC;AAAA,IACF;AACA,UAAM,OAAO,MAAM,oBAAoB,SAA4B,KAAK;AACxE,QAAI,CAAC,KAAM;AACX,SAAK,KAAK,KAAK,CAAC,CAAC;AACjB,cAAU,KAAK,CAAC;AAAA,EAClB;AACA,SAAO,EAAE,MAAM,KAAK,KAAK,GAAG,GAAG,QAAQ;AACzC;AAUA,eAAsB,kBACpB,MACA,SACA,MACwB;AACxB,QAAM,EAAE,MAAM,QAAQ,IAAI,MAAM,iBAAiB,MAAM,IAAI;AAI3D,QAAM,gBAAgB,OAA0B;AAEhD,QAAM,UAAU,YAAY,mBAAmB,CAAC,OAAO,SAAS,IAAI,KAAK,cAAc,MAAM,IAAI,MAAM;AACvG,gBAAc,MAAM,SAAS,CAAC,CAAC;AAC/B,kBAAgB,MAAM,MAAM,SAAS,CAAC,CAAC;AACvC,SAAO,UAAU,uBAAuB;AAC1C;","names":["aliases","at"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../api/src/mcp-catalog.ts","../src/commands/mcp/index.ts","../src/commands/mcp/catalog.ts","../src/commands/mcp/platforms.ts"],"sourcesContent":["/**\n * Contract for `GET /api/mcp/catalog` — searching the managed-app catalog the\n * sandbox agent can ask the user to connect when a vendor publishes no MCP\n * server of its own.\n *\n * `connect` mirrors `ToolkitConnectMode` in `convex/composio/types.ts`, folded\n * to what the user will be asked for: a sign-in or a key. Apps that need no\n * sign-in are left out — Composio refuses to connect them.\n */\nimport { z } from \"zod\";\n\nexport const MCP_CATALOG_DEFAULT_LIMIT = 8;\nexport const MCP_CATALOG_DESCRIPTION_MAX = 160;\n\nexport const mcpCatalogRequestSchema = z.object({\n search: z.string().trim().min(1, \"Provide --search\").max(100),\n limit: z.coerce.number().int().min(1).max(20).default(MCP_CATALOG_DEFAULT_LIMIT),\n});\nexport type McpCatalogRequest = z.infer<typeof mcpCatalogRequestSchema>;\n\nexport const mcpCatalogConnectSchema = z.enum([\"sign-in\", \"key\"]);\nexport type McpCatalogConnect = z.infer<typeof mcpCatalogConnectSchema>;\n\nexport const mcpCatalogEntrySchema = z.object({\n /** The toolkit slug — what request_connection `{ app }` takes. */\n app: z.string(),\n name: z.string(),\n description: z.string().max(MCP_CATALOG_DESCRIPTION_MAX),\n connect: mcpCatalogConnectSchema,\n connected: z.boolean(),\n});\nexport type McpCatalogEntry = z.infer<typeof mcpCatalogEntrySchema>;\n\nexport const mcpCatalogResponseSchema = z.object({\n apps: z.array(mcpCatalogEntrySchema),\n /** Baker's own connections this search matched — ask for these with `{ platform }`, never a managed copy. */\n platforms: z.array(z.string()).optional(),\n});\nexport type McpCatalogResponse = z.infer<typeof mcpCatalogResponseSchema>;\n","import {\n type CustomMcpDisableResponse,\n type CustomMcpVerifyResponse,\n customMcpServerNameRequestSchema,\n} from \"@baker/api\";\nimport { type McpCatalogResponse, mcpCatalogRequestSchema } from \"@baker/api/mcp-catalog\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiGet, apiPost } from \"../../client.ts\";\nimport { getEnv } from \"../../env.ts\";\nimport { repeatedValues } from \"../../lib/repeatedFlags.ts\";\nimport { writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { catalogHints } from \"./catalog.ts\";\nimport { type ConnectedPlatform, platformEntry } from \"./platforms.ts\";\n\nconst SCOPES = [\"user\", \"user_org\", \"company\", \"org\"] as const;\ntype Scope = (typeof SCOPES)[number];\n\nfunction parseScope(raw: unknown): Scope {\n const scope = raw === undefined ? \"company\" : String(raw);\n if (!(SCOPES as readonly string[]).includes(scope)) {\n throw new ApiError(\"VALIDATION_ERROR\", `Invalid --scope \"${scope}\". Use user | user_org | company | org.`);\n }\n return scope as Scope;\n}\n\n/** The turn's message sender, injected by the bridge — required only for user scope. */\nfunction actingUserId(): string | undefined {\n return getEnv().BAKER_ACTING_USER_ID;\n}\n\ntype CustomMcpServer = {\n _id: string;\n scope: \"user\" | \"user_org\" | \"company\" | \"org\";\n name: string;\n url: string;\n headerKeys: string[];\n enabled: boolean;\n /** Absent until the address has been checked; `ok: false` means it serves no tools. */\n health?: { ok: boolean; message?: string; suggestedUrl?: string; transient?: boolean; checkedAt: number };\n createdAt: number;\n};\n\n/**\n * What to report for one custom server. `problem` is the whole point: a server can\n * be signed in, enabled and still serve nothing (wrong address), and reporting it\n * as plain \"connected\" is how an agent ends up promising tools it does not have.\n * A `transient` failure is reported separately — the tool may well answer, so\n * declaring it broken would be its own kind of lie.\n */\nfunction customEntry(server: CustomMcpServer): Record<string, unknown> {\n const failed = server.health && !server.health.ok;\n const problem = server.health?.message ?? \"This server's address is not serving tools.\";\n return {\n name: server.name,\n scope: server.scope,\n enabled: server.enabled,\n ...(failed && !server.health?.transient ? { usable: false, problem } : {}),\n ...(failed && server.health?.transient ? { lastCheck: \"failed\", problem } : {}),\n ...(failed && server.health?.suggestedUrl ? { suggestedAddress: server.health.suggestedUrl } : {}),\n };\n}\n\n/** The hint an unusable server earns — the agent must not offer its tools or invent a reason. */\nconst BROKEN_SERVER_HINT =\n \"A server marked usable=false will NOT answer: its tools are absent from this turn. Say plainly that the tool is not working and relay `problem`; never claim its tools are loading, coming next message, or temporarily unavailable. `problem` names what a person has to fix — the address, the sign-in, or the key the server was added with — so pass on that fix and no other: never tell the user to reconnect a server whose `problem` is its address or its key. The user makes the fix in the dashboard (Brain → Integrations → More apps). If `suggestedAddress` is present, that is the address to use.\";\n\n/** The hint for a server whose last check failed for a reason that may already have passed. */\nconst LAST_CHECK_FAILED_HINT =\n \"A server with lastCheck=failed was unreachable or erroring when it was last checked — that may already have passed, and its tools ARE loaded this turn. Try the tool; if it works, say nothing about the check. If it fails, report `problem` as what happened rather than guessing.\";\n\n/** Turn repeated `--header \"K: V\"` (or `K=V`) flags into a headers record. */\n/** `--header` is repeatable, so its values come off the command line — citty keeps only the last. */\nfunction parseHeaders(raw: unknown, rawArgs?: readonly string[]): Record<string, string> | undefined {\n const list = repeatedValues(rawArgs, \"header\", raw);\n const headers: Record<string, string> = {};\n for (const entry of list) {\n const text = String(entry);\n const sep = text.indexOf(\":\") >= 0 && (text.indexOf(\":\") < text.indexOf(\"=\") || text.indexOf(\"=\") < 0) ? \":\" : \"=\";\n const at = text.indexOf(sep);\n if (at <= 0) {\n throw new ApiError(\"VALIDATION_ERROR\", `Invalid header \"${text}\". Use \"Key: Value\".`);\n }\n headers[text.slice(0, at).trim()] = text.slice(at + 1).trim();\n }\n return Object.keys(headers).length > 0 ? headers : undefined;\n}\n\nfunction fail(err: unknown): never {\n if (err instanceof ApiError) {\n writeJson({ ok: false, error: { code: err.code, message: err.message } });\n process.exit(1);\n }\n writeJson({ ok: false, error: { code: \"NETWORK_ERROR\", message: \"Unexpected error\" } });\n process.exit(1);\n}\n\ntype ManagedConnection = {\n toolkitSlug: string;\n scope: \"user\" | \"user_org\" | \"company\" | \"org\";\n status: string;\n accountLabel: string | null;\n readOnly: boolean;\n};\n\ntype ConnectedResponse = {\n managed: ManagedConnection[];\n custom: CustomMcpServer[];\n platforms: ConnectedPlatform[];\n};\n\n/** The one thing an agent must not do with this list: infer a platform's state from the MCP half. */\nconst PLATFORMS_HINT =\n \"`platforms` are connected accounts you reach through `baker` commands (HubSpot, Google Ads, GA4, Search Console, Tag Manager, …), NOT mcp__* tools — there is no tool to call for them. A platform listed here IS connected: never tell the user to connect it, and never conclude it is missing because it has no mcp__* entry. Read what it holds with its own command family (`baker hubspot …`, `baker ads google …`, `baker ga4 …`, and so on).\";\n\nregisterSchema({\n command: \"mcp.connected\",\n description:\n \"List everything this chat can reach: managed integrations (Attio, Slack, Gmail, Google Sheets, …), custom MCP servers, and the platforms the company signed in to (HubSpot, Google Ads, GA4, Search Console, Tag Manager) which you read through their own `baker` commands. Start here when the user mentions an external tool or platform.\",\n args: {},\n});\n\nconst connectedCommand = defineCommand({\n meta: {\n name: \"connected\",\n description: `Everything this chat can reach — managed integrations, custom MCP servers, and connected platforms.\n\nManaged tools ride the composio servers (mcp__composio_<scope>__*); custom servers expose mcp__<name>__*.\nPlatforms (HubSpot, Google Ads, GA4, …) have no mcp__* tools at all — you read them with their own\n\\`baker\\` command family, and one listed here is connected and ready to use.\nA tool or platform the user names that is NOT listed anywhere here is simply not connected yet.`,\n },\n run: async () => {\n try {\n const user = actingUserId();\n const data = await apiGet<ConnectedResponse>(\"/api/mcp/connected\", user ? { actingUserId: user } : undefined);\n const managed = data.managed.map((c) => ({\n toolkit: c.toolkitSlug,\n scope: c.scope,\n ...(c.status !== \"ACTIVE\" ? { status: c.status } : {}),\n ...(c.accountLabel ? { account: c.accountLabel } : {}),\n ...(c.readOnly ? { readOnly: true } : {}),\n }));\n const custom = data.custom.map(customEntry);\n const platforms = (data.platforms ?? []).map(platformEntry);\n const hints: string[] = [];\n if (platforms.length > 0) {\n hints.push(PLATFORMS_HINT);\n }\n if (data.custom.some((s) => s.health && !s.health.ok && !s.health.transient)) {\n hints.push(BROKEN_SERVER_HINT);\n }\n if (data.custom.some((s) => s.health && !s.health.ok && s.health.transient)) {\n hints.push(LAST_CHECK_FAILED_HINT);\n }\n if ([...data.managed, ...data.custom].some((e) => e.scope === \"user\" || e.scope === \"user_org\")) {\n hints.push(\n \"user/user_org entries are personal: they belong to the current message sender and load only in their turns — other users in this chat won't have them.\",\n );\n }\n hints.push(\n \"Not listed anywhere = not connected — connect it from the chat with request_connection, never by sending the user to the dashboard: a Baker platform (HubSpot, Google Ads, GA4, …) → { platform }; anything else → the vendor's own MCP server FIRST: use the address the user gave you, or WebSearch '<vendor> MCP server' and WebFetch its official docs for the remote https address and how it signs in, then { server: { name, url, auth, keyHeader } }; only when the vendor has none → `baker mcp catalog --search <name>`, then { app }. Research before you ask the user anything. What they connect loads into this same turn.\",\n );\n writeJson({\n ok: true,\n data: { managed, custom, platforms },\n hints,\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nconst catalogArgs = {\n search: { type: \"string\", description: \"App or vendor name, e.g. notion, clarity, pipedrive\", required: true },\n limit: { type: \"string\", description: \"Max apps to return, 1-20 (default 8)\", required: false },\n} as const;\n\nregisterSchema({\n command: \"mcp.catalog\",\n description:\n \"Search the managed apps you can ask the user to connect when a vendor has no MCP server of its own. Each app says how the user connects it (sign-in | key) and whether this chat already reaches it. Example: baker mcp catalog --search notion\",\n args: catalogArgs,\n});\n\nconst catalogCommand = defineCommand({\n meta: {\n name: \"catalog\",\n description: `Managed apps you can ask the user to connect when a vendor has no MCP server of its own.\n\nFor a tool \\`baker mcp connected\\` does not list whose vendor has no official remote MCP server:\n baker mcp catalog --search notion\n baker mcp catalog --search \"microsoft clarity\" --limit 3\n\nEach app: app (slug for request_connection), name, description, connect (sign-in | key), connected.\nPrefer the vendor's own MCP server when it publishes one; a catalog app is the fallback.`,\n },\n args: catalogArgs,\n run: async ({ args }) => {\n const parsed = mcpCatalogRequestSchema.safeParse({ search: args.search, limit: args.limit });\n if (!parsed.success) {\n writeJson({\n ok: false,\n error: { code: \"VALIDATION_ERROR\", message: parsed.error.issues[0]?.message ?? \"Invalid arguments\" },\n });\n process.exit(1);\n }\n try {\n const user = actingUserId();\n const data = await apiGet<McpCatalogResponse>(\"/api/mcp/catalog\", {\n search: parsed.data.search,\n limit: String(parsed.data.limit),\n ...(user ? { actingUserId: user } : {}),\n });\n writeJson({\n ok: true,\n data: {\n apps: data.apps,\n ...(data.platforms?.length ? { platforms: data.platforms } : {}),\n },\n hints: catalogHints(data.apps, { platforms: data.platforms ?? [] }),\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nregisterSchema({\n command: \"mcp.list\",\n description: \"List the custom MCP servers this company's chats see (org + company + your own user scope).\",\n args: {},\n});\n\nconst listCommand = defineCommand({\n meta: { name: \"list\", description: \"List custom MCP servers visible to this company's chats.\" },\n run: async () => {\n try {\n const user = actingUserId();\n const data = await apiGet<{ servers: CustomMcpServer[] }>(\n \"/api/mcp/custom\",\n user ? { actingUserId: user } : undefined,\n );\n writeJson({\n ok: true,\n // Detail view: the full row (address included) plus the usability verdict.\n // `health` itself is folded into `usable`/`problem` by `customEntry`.\n data: data.servers.map((server) => ({ ...server, health: undefined, ...customEntry(server) })),\n ...(data.servers.some((s) => s.health && !s.health.ok)\n ? {\n hints: data.servers.some((s) => s.health && !s.health.ok && !s.health.transient)\n ? [BROKEN_SERVER_HINT]\n : [LAST_CHECK_FAILED_HINT],\n }\n : {}),\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nregisterSchema({\n command: \"mcp.add\",\n description:\n \"Register a custom MCP server. Tools appear as mcp__<name>__* on the next message. URL must be HTTPS. Scope: company (default, all chats) | org (org admin key) | user (only the current sender).\",\n args: {\n name: { type: \"string\", description: \"Server name → tools appear as mcp__<name>__*\", required: true },\n url: {\n type: \"string\",\n description: \"Full HTTPS MCP endpoint (commonly ends in /mcp, not just the domain)\",\n required: true,\n },\n scope: { type: \"string\", description: \"user | user_org | company | org (default company)\", required: false },\n header: { type: \"string\", description: 'Auth header \"Key: Value\" (repeatable)', required: false },\n },\n});\n\nconst addCommand = defineCommand({\n meta: {\n name: \"add\",\n description: `Register a custom MCP server. Tools appear as mcp__<name>__* on the NEXT message.\nFor a server the USER asks for, use request_connection { server } instead: they confirm who can use it,\ntype any key into the card (never the chat), and its tools load in this same turn.\n\nScope: company (default — every chat in the company) | org (all companies in the org; needs an admin key) | user (only the current message sender).\n\nExamples:\n baker mcp add --name weather --url https://mcp.example.com/mcp\n baker mcp add --name acme --url https://acme.dev/mcp --header \"Authorization: Bearer sk-…\"\n baker mcp add --name mine --url https://my.dev/mcp --scope user`,\n },\n args: {\n name: { type: \"string\", description: \"Server name (mcp__<name>__*)\", required: true },\n url: {\n type: \"string\",\n description: \"Full HTTPS MCP endpoint (commonly ends in /mcp, not just the domain)\",\n required: true,\n },\n scope: { type: \"string\", description: \"user | user_org | company | org (default company)\", required: false },\n header: { type: \"string\", description: 'Auth header \"Key: Value\" (repeatable)', required: false },\n },\n run: async ({ args, rawArgs }) => {\n try {\n const scope = parseScope(args.scope);\n const user = actingUserId();\n const headers = parseHeaders(args.header, rawArgs);\n const data = await apiPost<{ name: string }>(\"/api/mcp/custom\", {\n name: args.name as string,\n url: args.url as string,\n scope,\n ...(user ? { actingUserId: user } : {}),\n ...(headers ? { headers } : {}),\n });\n writeJson({\n ok: true,\n data,\n hints: [\n \"The address must be the full MCP endpoint (commonly ending in /mcp), not just the domain — a domain on its own usually answers sign-in and then serves no tools.\",\n \"The address is checked in the background. Run `baker mcp connected` on the next message to confirm it serves tools before promising the user anything.\",\n ],\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nregisterSchema({\n command: \"mcp.remove\",\n description: \"Remove a company custom MCP server by name.\",\n args: { name: { type: \"string\", description: \"Server name to remove\", required: true } },\n});\n\nconst removeCommand = defineCommand({\n meta: {\n name: \"remove\",\n description: `Remove a company custom MCP server by name.\n\nExample:\n baker mcp remove --name weather`,\n },\n args: { name: { type: \"string\", description: \"Server name to remove\", required: true } },\n run: async ({ args }) => {\n try {\n const user = actingUserId();\n const data = await apiPost<{ removed: boolean }>(\"/api/mcp/custom/remove\", {\n name: args.name as string,\n ...(user ? { actingUserId: user } : {}),\n });\n writeJson({ ok: true, data });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nconst serverNameArgs = {\n name: { type: \"string\", description: \"Custom server name, as `baker mcp list` shows it\", required: true },\n} as const;\n\nregisterSchema({\n command: \"mcp.verify\",\n description:\n \"Check a custom MCP server now (the dashboard's 'Check now') and store the result. Use after the user fixed its address or sign-in, or when its tools failed this turn.\",\n args: serverNameArgs,\n});\n\nconst verifyCommand = defineCommand({\n meta: {\n name: \"verify\",\n description: `Check a custom MCP server now and store the result.\n\nExample:\n baker mcp verify --name weather`,\n },\n args: serverNameArgs,\n run: async ({ args }) => {\n const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId() });\n if (!parsed.success) {\n fail(new ApiError(\"VALIDATION_ERROR\", parsed.error.issues[0]?.message ?? \"Invalid arguments\"));\n }\n try {\n const data = await apiPost<CustomMcpVerifyResponse>(\"/api/mcp/custom/verify\", parsed.data);\n writeJson({\n ok: true,\n data,\n hints: [\n data.ok\n ? \"The server answers and serves tools. Its tools load on the next message.\"\n : data.transient\n ? LAST_CHECK_FAILED_HINT\n : BROKEN_SERVER_HINT,\n ],\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nregisterSchema({\n command: \"mcp.disable\",\n description:\n \"Switch a custom MCP server off so its tools stop loading; its address and sign-in are kept. Turning it back on is done by a person in the dashboard, never by the agent.\",\n args: serverNameArgs,\n});\n\nconst disableCommand = defineCommand({\n meta: {\n name: \"disable\",\n description: `Switch a custom MCP server off (its tools stop loading). Only a person can turn it back on, in the dashboard.\n\nExample:\n baker mcp disable --name weather`,\n },\n args: serverNameArgs,\n run: async ({ args }) => {\n const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId() });\n if (!parsed.success) {\n fail(new ApiError(\"VALIDATION_ERROR\", parsed.error.issues[0]?.message ?? \"Invalid arguments\"));\n }\n try {\n const data = await apiPost<CustomMcpDisableResponse>(\"/api/mcp/custom/disable\", parsed.data);\n writeJson({\n ok: true,\n data,\n hints: [\n \"Its tools stop loading from the next message, and this applies right away — publishing or discarding this chat does not undo it. Tell the user they can turn it back on in Brain → Integrations → More apps.\",\n ],\n });\n } catch (err) {\n fail(err);\n }\n },\n});\n\nexport const mcpCommand = defineCommand({\n meta: {\n name: \"mcp\",\n description: `Third-party tools for this company — see what's connected, register custom HTTPS MCP endpoints.\n\nTools from a registered server appear as mcp__<name>__* on the next message.\nManaged here are **company-scoped** servers; user- and org-scoped servers are managed in the dashboard.\n\nStart here:\n baker mcp connected # everything this chat can reach: managed integrations, custom servers, connected platforms\n baker mcp catalog --search notion # managed apps you can connect when a vendor has no MCP server of its own\n\nExamples:\n baker mcp add --name weather --url https://mcp.example.com/mcp\n baker mcp add --name acme --url https://acme.dev/mcp --header \"Authorization: Bearer sk-…\"\n baker mcp remove --name weather\n baker mcp verify --name weather # check it now after the user fixed it\n baker mcp disable --name weather # stop its tools loading (only a person turns it back on)\nFull guide: __tooling__/docs/tools/baker/mcp.md`,\n },\n subCommands: {\n connected: connectedCommand,\n catalog: catalogCommand,\n list: listCommand,\n add: addCommand,\n remove: removeCommand,\n verify: verifyCommand,\n disable: disableCommand,\n },\n});\n","/**\n * What `baker mcp catalog` tells the agent to do next with the managed apps it\n * found — the fallback when a vendor publishes no MCP server of its own.\n */\nimport type { McpCatalogEntry } from \"@baker/api/mcp-catalog\";\n\nconst PREFER_VENDOR_HINT =\n 'The vendor\\'s own MCP server comes before any app here. If you have not yet, WebSearch \"<vendor> MCP server\" and WebFetch its official docs for the remote https address and how it signs in, then ask for it with request_connection `{ server: { name, url, auth, keyHeader } }`. Only when the vendor has none, ask for an app from this catalog with request_connection `{ app: \"<slug>\", reason }` — the user connects it in the chat and its tools load right after, in this same turn.';\n\nconst ALREADY_CONNECTED_HINT =\n \"An app marked connected is already reachable — use its mcp__composio_* tools; do not ask again.\";\n\nconst NO_MATCH_HINT =\n \"Nothing in the catalog matches. WebSearch for the vendor's official remote MCP server (its docs, its developer site) before telling the user it can't be connected — if one exists, ask for it with request_connection `{ server }`. Only when the web shows no official remote server either, say plainly this tool can't be connected yet and offer a Task.\";\n\n/** Baker's own connection always wins over a catalog app or anyone's MCP server for the same tool. */\nfunction firstPartyHint(platforms: readonly string[]): string {\n const asks = platforms.map((p) => `request_connection \\`{ platform: \"${p}\" }\\``).join(\" or \");\n return `This is one of Baker's own connections — ask for it with ${asks}. It is the one Baker's commands, staging and publish work with, so never connect it as a catalog app or as an MCP server, even one the vendor publishes or the user names. If it is already connected, read it with its own baker command family instead.`;\n}\n\n/** What the agent should do next with a catalog answer. */\nexport function catalogHints(\n apps: readonly McpCatalogEntry[],\n { platforms = [] }: { platforms?: readonly string[] } = {},\n): string[] {\n if (platforms.length > 0) {\n return [firstPartyHint(platforms)];\n }\n const hints = [PREFER_VENDOR_HINT];\n if (apps.some((a) => a.connected)) {\n hints.push(ALREADY_CONNECTED_HINT);\n }\n if (apps.length === 0) {\n hints.push(NO_MATCH_HINT);\n }\n return hints;\n}\n","/**\n * How a connected platform reads back to the agent.\n *\n * A platform (HubSpot, Google Ads, GA4, …) is an account the company signed in\n * to, reached through its own `baker` command family rather than an `mcp__*`\n * tool. It rides `mcp connected` because that is the one answer to \"what can\n * this chat reach\" — and because an agent that only saw the tool half had no\n * way to tell a working HubSpot connection from a missing one.\n */\n\nexport interface ConnectedPlatform {\n type: string;\n label: string;\n account: string | null;\n reads: string[];\n readsLabel: string | null;\n}\n\n/** \"Ad Accounts\" -> `adAccounts`, \"Properties\" -> `properties`. */\nfunction readsKey(label: string): string {\n const [first = \"\", ...rest] = label.split(\" \");\n return [first.toLowerCase(), ...rest].join(\"\");\n}\n\n/**\n * One platform as the agent sees it. The resources are keyed by the platform's\n * own word for them — `properties` for GA4, `containers` for Tag Manager,\n * `adAccounts` for the ad platforms — so what the agent reads back matches what\n * the user sees in the dashboard.\n */\nexport function platformEntry(platform: ConnectedPlatform): Record<string, unknown> {\n return {\n platform: platform.label,\n ...(platform.account ? { account: platform.account } : {}),\n ...(platform.readsLabel && platform.reads.length > 0 ? { [readsKey(platform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