typeglish 0.1.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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +13 -0
  3. package/README.md +301 -0
  4. package/dist/chunk-3NQ3VYO6.js +566 -0
  5. package/dist/chunk-3NQ3VYO6.js.map +1 -0
  6. package/dist/chunk-KRYC4OTL.js +3573 -0
  7. package/dist/chunk-KRYC4OTL.js.map +1 -0
  8. package/dist/chunk-NLQIL5WD.js +25 -0
  9. package/dist/chunk-NLQIL5WD.js.map +1 -0
  10. package/dist/chunk-PR4QN5HX.js +39 -0
  11. package/dist/chunk-PR4QN5HX.js.map +1 -0
  12. package/dist/chunk-PXAMTGYY.js +3 -0
  13. package/dist/chunk-PXAMTGYY.js.map +1 -0
  14. package/dist/chunk-VMACILYN.js +140 -0
  15. package/dist/chunk-VMACILYN.js.map +1 -0
  16. package/dist/chunk-Y64EAEYB.js +10919 -0
  17. package/dist/chunk-Y64EAEYB.js.map +1 -0
  18. package/dist/chunk-YH4ZLQ4G.js +4260 -0
  19. package/dist/chunk-YH4ZLQ4G.js.map +1 -0
  20. package/dist/chunk-ZKMHZHID.js +56 -0
  21. package/dist/chunk-ZKMHZHID.js.map +1 -0
  22. package/dist/cli.d.ts +1 -0
  23. package/dist/cli.js +447 -0
  24. package/dist/cli.js.map +1 -0
  25. package/dist/compile-DViQS2oG.d.ts +310 -0
  26. package/dist/diagnostics-BWJ_oMd8.d.ts +49 -0
  27. package/dist/exhaustiveness-VBVWCX5W.js +123 -0
  28. package/dist/exhaustiveness-VBVWCX5W.js.map +1 -0
  29. package/dist/index-Df_QnTgq.d.ts +313 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +7 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/mcp.d.ts +11 -0
  34. package/dist/mcp.js +36378 -0
  35. package/dist/mcp.js.map +1 -0
  36. package/dist/monaco.css +46 -0
  37. package/dist/monaco.d.ts +43 -0
  38. package/dist/monaco.js +971 -0
  39. package/dist/monaco.js.map +1 -0
  40. package/dist/node.d.ts +21 -0
  41. package/dist/node.js +8 -0
  42. package/dist/node.js.map +1 -0
  43. package/dist/spell-node.d.ts +8 -0
  44. package/dist/spell-node.js +23 -0
  45. package/dist/spell-node.js.map +1 -0
  46. package/dist/spell.d.ts +18 -0
  47. package/dist/spell.js +4 -0
  48. package/dist/spell.js.map +1 -0
  49. package/dist/z3-MWU3GSVT.js +5 -0
  50. package/dist/z3-MWU3GSVT.js.map +1 -0
  51. package/package.json +160 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../node_modules/pluralize/pluralize.js","../src/core/expr.ts","../src/core/switch.ts","../src/core/type-system.ts","../src/core/tool.ts","../src/core/cardinality.ts","../src/core/possession.ts","../src/core/testblock.ts","../src/core/exampleblock.ts","../src/core/prompt.ts","../src/core/xml.ts","../src/core/config-schema.ts","../src/core/models.generated.ts","../src/core/models.ts","../src/core/structure.ts"],"names":["i","pluralizeLib","leading","FIELD","items","norm","closeM","m","kinds","stem"],"mappings":";;;;AAAA,IAAA,iBAAA,GAAA,UAAA,CAAA;AAAA,EAAA,qCAAA,CAAA,OAAA,EAAA,MAAA,EAAA;AAEA,IAAA,CAAC,SAAU,MAAM,SAAA,EAAW;AAE1B,MAAA,IAAI,OAAO,cAAY,UAAA,IAAc,OAAO,YAAY,QAAA,IAAY,OAAO,WAAW,QAAA,EAAU;AAE9F,QAAA,MAAA,CAAO,UAAU,SAAA,EAAU;AAAA,MAC7B,CAAA,MAAA,IAAW,OAAO,MAAA,KAAW,UAAA,IAAc,OAAO,GAAA,EAAK;AAErD,QAAA,MAAA,CAAO,WAAY;AACjB,UAAA,OAAO,SAAA,EAAU;AAAA,QACnB,CAAC,CAAA;AAAA,MACH,CAAA,MAAO;AAEL,QAAA,IAAA,CAAK,YAAY,SAAA,EAAU;AAAA,MAC7B;AAAA,IACF,CAAA,EAAG,SAAM,WAAY;AAGnB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CAAA,CAAE,IAAA,GAAO,CAAA,CAAE,OAAO,CAAA,CACzD,MAAA,CAAkC,CAAC,IAAA,EAAM,CAAA,KAAO,CAAC,IAAA,IAAQ,CAAA,CAAE,KAAA,GAAQ,IAAA,CAAK,KAAA,GAAQ,CAAA,GAAI,IAAA,EAAO,MAAS,CAAA;AACvG,IAAA,IAAI,MAAM,WAAA,CAAY,CAAA,GAAI,CAAC,CAAA,EAAG,QAAQ,QAAA,CAAS,MAAA;AAC/C,IAAA,IAAI,KAAK,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAI,OAAO,CAAA;AACxC,IAAA,KAAA,IAAS,CAAA,GAAI,EAAE,IAAA,EAAM,CAAA,GAAI,OAAO,CAAA,GAAI,OAAA,CAAQ,MAAA,EAAQ,CAAA,IAAK,CAAA,EAAG;AAAE,MAAA,MAAM,CAAA,GAAI,QAAQ,CAAC,CAAA;AAAG,MAAA,IAAI,CAAA,EAAG,CAAA,CAAE,KAAA,GAAQ,IAAA,CAAK,GAAA,CAAI,CAAA,CAAE,KAAA,EAAA,CAAQ,GAAA,EAAK,KAAA,IAAS,CAAA,IAAK,CAAA,CAAE,KAAK,CAAA;AAAA,IAAG;AAAA,EACvJ,CAAC,CAAA;AAED,EAAA,OAAO,EAAE,YAAA,EAAc,UAAA,EAAY,IAAA,EAAM,SAAS,UAAA,EAAY,CAAC,SAAA,CAAU,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,EAAE;AAC/G;AAuDO,IAAM,mBAAA,GAAyC,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAG","file":"chunk-YH4ZLQ4G.js","sourcesContent":["/* global define */\n\n(function (root, pluralize) {\n /* istanbul ignore else */\n if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {\n // Node.\n module.exports = pluralize();\n } else if (typeof define === 'function' && define.amd) {\n // AMD, registers as an anonymous module.\n define(function () {\n return pluralize();\n });\n } else {\n // Browser global.\n root.pluralize = pluralize();\n }\n})(this, function () {\n // Rule storage - pluralize and singularize need to be run sequentially,\n // while other rules can be optimized using an object for instant lookups.\n var pluralRules = [];\n var singularRules = [];\n var uncountables = {};\n var irregularPlurals = {};\n var irregularSingles = {};\n\n /**\n * Sanitize a pluralization rule to a usable regular expression.\n *\n * @param {(RegExp|string)} rule\n * @return {RegExp}\n */\n function sanitizeRule (rule) {\n if (typeof rule === 'string') {\n return new RegExp('^' + rule + '$', 'i');\n }\n\n return rule;\n }\n\n /**\n * Pass in a word token to produce a function that can replicate the case on\n * another word.\n *\n * @param {string} word\n * @param {string} token\n * @return {Function}\n */\n function restoreCase (word, token) {\n // Tokens are an exact match.\n if (word === token) return token;\n\n // Lower cased words. E.g. \"hello\".\n if (word === word.toLowerCase()) return token.toLowerCase();\n\n // Upper cased words. E.g. \"WHISKY\".\n if (word === word.toUpperCase()) return token.toUpperCase();\n\n // Title cased words. E.g. \"Title\".\n if (word[0] === word[0].toUpperCase()) {\n return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();\n }\n\n // Lower cased words. E.g. \"test\".\n return token.toLowerCase();\n }\n\n /**\n * Interpolate a regexp string.\n *\n * @param {string} str\n * @param {Array} args\n * @return {string}\n */\n function interpolate (str, args) {\n return str.replace(/\\$(\\d{1,2})/g, function (match, index) {\n return args[index] || '';\n });\n }\n\n /**\n * Replace a word using a rule.\n *\n * @param {string} word\n * @param {Array} rule\n * @return {string}\n */\n function replace (word, rule) {\n return word.replace(rule[0], function (match, index) {\n var result = interpolate(rule[1], arguments);\n\n if (match === '') {\n return restoreCase(word[index - 1], result);\n }\n\n return restoreCase(match, result);\n });\n }\n\n /**\n * Sanitize a word by passing in the word and sanitization rules.\n *\n * @param {string} token\n * @param {string} word\n * @param {Array} rules\n * @return {string}\n */\n function sanitizeWord (token, word, rules) {\n // Empty string or doesn't need fixing.\n if (!token.length || uncountables.hasOwnProperty(token)) {\n return word;\n }\n\n var len = rules.length;\n\n // Iterate over the sanitization rules and use the first one to match.\n while (len--) {\n var rule = rules[len];\n\n if (rule[0].test(word)) return replace(word, rule);\n }\n\n return word;\n }\n\n /**\n * Replace a word with the updated word.\n *\n * @param {Object} replaceMap\n * @param {Object} keepMap\n * @param {Array} rules\n * @return {Function}\n */\n function replaceWord (replaceMap, keepMap, rules) {\n return function (word) {\n // Get the correct token and case restoration functions.\n var token = word.toLowerCase();\n\n // Check against the keep object map.\n if (keepMap.hasOwnProperty(token)) {\n return restoreCase(word, token);\n }\n\n // Check against the replacement map for a direct word replacement.\n if (replaceMap.hasOwnProperty(token)) {\n return restoreCase(word, replaceMap[token]);\n }\n\n // Run all the rules against the word.\n return sanitizeWord(token, word, rules);\n };\n }\n\n /**\n * Check if a word is part of the map.\n */\n function checkWord (replaceMap, keepMap, rules, bool) {\n return function (word) {\n var token = word.toLowerCase();\n\n if (keepMap.hasOwnProperty(token)) return true;\n if (replaceMap.hasOwnProperty(token)) return false;\n\n return sanitizeWord(token, token, rules) === token;\n };\n }\n\n /**\n * Pluralize or singularize a word based on the passed in count.\n *\n * @param {string} word The word to pluralize\n * @param {number} count How many of the word exist\n * @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks)\n * @return {string}\n */\n function pluralize (word, count, inclusive) {\n var pluralized = count === 1\n ? pluralize.singular(word) : pluralize.plural(word);\n\n return (inclusive ? count + ' ' : '') + pluralized;\n }\n\n /**\n * Pluralize a word.\n *\n * @type {Function}\n */\n pluralize.plural = replaceWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Check if a word is plural.\n *\n * @type {Function}\n */\n pluralize.isPlural = checkWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Singularize a word.\n *\n * @type {Function}\n */\n pluralize.singular = replaceWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Check if a word is singular.\n *\n * @type {Function}\n */\n pluralize.isSingular = checkWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Add a pluralization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addPluralRule = function (rule, replacement) {\n pluralRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add a singularization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addSingularRule = function (rule, replacement) {\n singularRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add an uncountable word rule.\n *\n * @param {(string|RegExp)} word\n */\n pluralize.addUncountableRule = function (word) {\n if (typeof word === 'string') {\n uncountables[word.toLowerCase()] = true;\n return;\n }\n\n // Set singular and plural references for the word.\n pluralize.addPluralRule(word, '$0');\n pluralize.addSingularRule(word, '$0');\n };\n\n /**\n * Add an irregular word definition.\n *\n * @param {string} single\n * @param {string} plural\n */\n pluralize.addIrregularRule = function (single, plural) {\n plural = plural.toLowerCase();\n single = single.toLowerCase();\n\n irregularSingles[single] = plural;\n irregularPlurals[plural] = single;\n };\n\n /**\n * Irregular rules.\n */\n [\n // Pronouns.\n ['I', 'we'],\n ['me', 'us'],\n ['he', 'they'],\n ['she', 'they'],\n ['them', 'them'],\n ['myself', 'ourselves'],\n ['yourself', 'yourselves'],\n ['itself', 'themselves'],\n ['herself', 'themselves'],\n ['himself', 'themselves'],\n ['themself', 'themselves'],\n ['is', 'are'],\n ['was', 'were'],\n ['has', 'have'],\n ['this', 'these'],\n ['that', 'those'],\n // Words ending in with a consonant and `o`.\n ['echo', 'echoes'],\n ['dingo', 'dingoes'],\n ['volcano', 'volcanoes'],\n ['tornado', 'tornadoes'],\n ['torpedo', 'torpedoes'],\n // Ends with `us`.\n ['genus', 'genera'],\n ['viscus', 'viscera'],\n // Ends with `ma`.\n ['stigma', 'stigmata'],\n ['stoma', 'stomata'],\n ['dogma', 'dogmata'],\n ['lemma', 'lemmata'],\n ['schema', 'schemata'],\n ['anathema', 'anathemata'],\n // Other irregular rules.\n ['ox', 'oxen'],\n ['axe', 'axes'],\n ['die', 'dice'],\n ['yes', 'yeses'],\n ['foot', 'feet'],\n ['eave', 'eaves'],\n ['goose', 'geese'],\n ['tooth', 'teeth'],\n ['quiz', 'quizzes'],\n ['human', 'humans'],\n ['proof', 'proofs'],\n ['carve', 'carves'],\n ['valve', 'valves'],\n ['looey', 'looies'],\n ['thief', 'thieves'],\n ['groove', 'grooves'],\n ['pickaxe', 'pickaxes'],\n ['passerby', 'passersby']\n ].forEach(function (rule) {\n return pluralize.addIrregularRule(rule[0], rule[1]);\n });\n\n /**\n * Pluralization rules.\n */\n [\n [/s?$/i, 's'],\n [/[^\\u0000-\\u007F]$/i, '$0'],\n [/([^aeiou]ese)$/i, '$1'],\n [/(ax|test)is$/i, '$1es'],\n [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],\n [/(e[mn]u)s?$/i, '$1s'],\n [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],\n [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],\n [/(seraph|cherub)(?:im)?$/i, '$1im'],\n [/(her|at|gr)o$/i, '$1oes'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/([^ch][ieo][ln])ey$/i, '$1ies'],\n [/(x|ch|ss|sh|zz)$/i, '$1es'],\n [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],\n [/\\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],\n [/(pe)(?:rson|ople)$/i, '$1ople'],\n [/(child)(?:ren)?$/i, '$1ren'],\n [/eaux$/i, '$0'],\n [/m[ae]n$/i, 'men'],\n ['thou', 'you']\n ].forEach(function (rule) {\n return pluralize.addPluralRule(rule[0], rule[1]);\n });\n\n /**\n * Singularization rules.\n */\n [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\\w]|^)li)ves$/i, '$1fe'],\n [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],\n [/ies$/i, 'y'],\n [/\\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],\n [/\\b(mon|smil)ies$/i, '$1ey'],\n [/\\b((?:tit)?m|l)ice$/i, '$1ouse'],\n [/(seraph|cherub)im$/i, '$1'],\n [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],\n [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],\n [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],\n [/(test)(?:is|es)$/i, '$1is'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],\n [/(alumn|alg|vertebr)ae$/i, '$1a'],\n [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],\n [/(matr|append)ices$/i, '$1ix'],\n [/(pe)(rson|ople)$/i, '$1rson'],\n [/(child)ren$/i, '$1'],\n [/(eau)x?$/i, '$1'],\n [/men$/i, 'man']\n ].forEach(function (rule) {\n return pluralize.addSingularRule(rule[0], rule[1]);\n });\n\n /**\n * Uncountable rules.\n */\n [\n // Singular words with no plurals.\n 'adulthood',\n 'advice',\n 'agenda',\n 'aid',\n 'aircraft',\n 'alcohol',\n 'ammo',\n 'analytics',\n 'anime',\n 'athletics',\n 'audio',\n 'bison',\n 'blood',\n 'bream',\n 'buffalo',\n 'butter',\n 'carp',\n 'cash',\n 'chassis',\n 'chess',\n 'clothing',\n 'cod',\n 'commerce',\n 'cooperation',\n 'corps',\n 'debris',\n 'diabetes',\n 'digestion',\n 'elk',\n 'energy',\n 'equipment',\n 'excretion',\n 'expertise',\n 'firmware',\n 'flounder',\n 'fun',\n 'gallows',\n 'garbage',\n 'graffiti',\n 'hardware',\n 'headquarters',\n 'health',\n 'herpes',\n 'highjinks',\n 'homework',\n 'housework',\n 'information',\n 'jeans',\n 'justice',\n 'kudos',\n 'labour',\n 'literature',\n 'machinery',\n 'mackerel',\n 'mail',\n 'media',\n 'mews',\n 'moose',\n 'music',\n 'mud',\n 'manga',\n 'news',\n 'only',\n 'personnel',\n 'pike',\n 'plankton',\n 'pliers',\n 'police',\n 'pollution',\n 'premises',\n 'rain',\n 'research',\n 'rice',\n 'salmon',\n 'scissors',\n 'series',\n 'sewage',\n 'shambles',\n 'shrimp',\n 'software',\n 'species',\n 'staff',\n 'swine',\n 'tennis',\n 'traffic',\n 'transportation',\n 'trout',\n 'tuna',\n 'wealth',\n 'welfare',\n 'whiting',\n 'wildebeest',\n 'wildlife',\n 'you',\n /pok[eé]mon$/i,\n // Regexes.\n /[^aeiou]ese$/i, // \"chinese\", \"japanese\"\n /deer$/i, // \"deer\", \"reindeer\"\n /fish$/i, // \"fish\", \"blowfish\", \"angelfish\"\n /measles$/i,\n /o[iu]s$/i, // \"carnivorous\"\n /pox$/i, // \"chickpox\", \"smallpox\"\n /sheep$/i\n ].forEach(pluralize.addUncountableRule);\n\n return pluralize;\n});\n","// ── Boolean expression layer for deterministic conditionals ─────────────────────────────────────────────\n// A guard (`<tag when=@{expr}…>`) — and a deterministic condition — is a boolean expression over typed\n// inputs. This is the parser + evaluator + atom extraction. Pure: no editor, no DOM, no solver. The whole\n// expression is resolved AWAY at compile (see resolve.ts) — evalExpr decides whether a section survives, so\n// the model never sees the condition.\n//\n// A variable in a condition is a POINTER — `@{name}`, the same typed pointer prose uses — so `$` keeps\n// exactly one meaning (a machine command at line start: $IF, $TOOL, $DEFINE). The bare `$name` form is a\n// migration ERROR carrying the complete rewritten condition, never silently accepted.\n//\n// Grammar (precedence: not > and > or). Every comparison reads the SAME way — `@{x} is [not] <two-word\n// operator> <operand>` — the vocabulary comes from the lexicon (COMPARISON_KEYWORDS, invariant #1):\n// or := and ('or' and)*\n// and := unary ('and' unary)*\n// unary := 'not' unary | atom\n// atom := '(' or ')' | '@{' name '}' test? (absent test → a boolean read)\n// test := 'is' ['not'] 'equal to' value equality (word or number)\n// | 'is' ['not'] 'greater than' number strict >\n// | 'is' ['not'] 'less than' number strict <\n// | 'is' 'at least' number inclusive >= — never takes `not` (that IS `less than`)\n// | 'is' 'at most' number inclusive <= — never takes `not` (that IS `greater than`)\n// | 'is' ['not'] 'one of' value (',' value)*\n// One canonical form per predicate: the symbols (`>`, `>=`, `<`, `<=`) and the bare copula (`@{x} is v`)\n// are ERRORS carrying the exact English rewrite. Because no comparison needs a `<`/`>` character, every\n// form is legal inside a `when=` attribute — `<upsell when=@{cart_total} is at least 100>` — so numeric\n// guards no longer need a `$DEFINE` hop.\n\nimport { COMPARISON_KEYWORDS, COMPARISON_SYMBOLS } from './lexicon';\n\nexport type Expr =\n | { kind: 'read'; name: string } // `@{voice}` — a boolean input read\n | { kind: 'not'; arg: Expr }\n | { kind: 'and'; left: Expr; right: Expr }\n | { kind: 'or'; left: Expr; right: Expr }\n | { kind: 'is'; name: string; value: string; negate: boolean } // `@{phase} is equal to booking` / `is not equal to`\n | { kind: 'oneOf'; name: string; values: string[] } // `@{phase} is one of a, b`\n | { kind: 'cmp'; name: string; op: '>' | '>=' | '<' | '<='; n: number }; // `@{cart_total} is greater than 100`\n\nexport type Bag = Record<string, string | number | boolean>; // the runtime variable bag resolve() ranges over\n\n// ── Lexer ──\ntype Tok =\n | { t: 'var'; v: string } // `@{name}` — a variable pointer\n | { t: 'legacyvar'; v: string } // bare `$name` — recognized ONLY to compose the migration rewrite\n | { t: 'kw'; v: string }\n | { t: 'word'; v: string }\n | { t: 'num'; v: number }\n | { t: 'op'; v: string } // a code-era symbol (> >= < <= == != =) — recognized ONLY to compose the rewrite\n | { t: 'comma' }\n | { t: 'lp' }\n | { t: 'rp' };\n\n// The keyword vocabulary DERIVES from the lexicon's comparison operators (never a local list): the\n// connectives plus every word of `is [not] equal to / greater than / less than / at least / at most /\n// one of`. A word outside this set is an operand value.\nconst KEYWORDS = new Set(['not', 'and', 'or', ...COMPARISON_KEYWORDS.flatMap((p) => p.toLowerCase().split(' '))]);\n// `>=` / `<=` before `>` / `<` so the two-char operators win — recognized ONLY to hand back the English\n// rewrite. A number is signed with an optional fraction. `==`/`!=`/`=` fold into the same error path.\n// Bare `$name` tokenizes as legacyvar for the same reason — the parser errors with the pointer rewrite.\nconst TOKEN = /@\\{([a-z][a-z0-9_]*)\\}|\\$([a-z][a-z0-9_]*)|([a-z][a-z0-9_]*)|(,)|(\\()|(\\))|(-?\\d+(?:\\.\\d+)?)|(>=|<=|>|<|==|!=|=)/gi;\n\n/** The complete pointer rewrite of a condition — every bare `$name` becomes `@{name}`. Exported so higher\n * layers (chain arms, guards, $DEFINE) can quote the WHOLE fixed line in their migration errors. Pure. */\nexport function pointerRewrite(text: string): string {\n return text.replace(/\\$([a-z][a-z0-9_]*)/gi, (_, n: string) => `@{${n.toLowerCase()}}`);\n}\n\n// The symbol → English rewrite, DERIVED from the lexicon's COMPARISON_SYMBOLS (invariant #1), never a local\n// copy: a code-era symbol (`>`, `>=`, `==`, …) hands back its operator's canonical English in the error.\nconst SYMBOL_REWRITE: Record<string, string> = Object.fromEntries(\n COMPARISON_SYMBOLS.flatMap((c) => c.symbols.map((s) => [s, c.machine])),\n);\n\nfunction tokenize(s: string): Tok[] {\n const toks: Tok[] = [];\n TOKEN.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = TOKEN.exec(s)) !== null) {\n if (m[1] !== undefined) toks.push({ t: 'var', v: m[1].toLowerCase() });\n else if (m[2] !== undefined) toks.push({ t: 'legacyvar', v: m[2].toLowerCase() });\n else if (m[3] !== undefined) {\n const w = m[3].toLowerCase();\n toks.push(KEYWORDS.has(w) ? { t: 'kw', v: w } : { t: 'word', v: w });\n } else if (m[4] !== undefined) toks.push({ t: 'comma' });\n else if (m[5] !== undefined) toks.push({ t: 'lp' });\n else if (m[6] !== undefined) toks.push({ t: 'rp' });\n else if (m[7] !== undefined) toks.push({ t: 'num', v: Number(m[7]) });\n else if (m[8] !== undefined) toks.push({ t: 'op', v: m[8] });\n }\n return toks;\n}\n\n// ── Parser (recursive descent) ──\nexport interface ExprParse {\n ast: Expr | null;\n error: string | null;\n}\n\n/** Parse a guard/predicate expression. Returns the AST, or a human-readable `error` (never both). Pure. */\nexport function parseExpr(text: string): ExprParse {\n const toks = tokenize(text);\n if (toks.length === 0) return { ast: null, error: 'empty condition' };\n\n let i = 0;\n let error: string | null = null;\n const peek = (): Tok | undefined => toks[i];\n const kw = (v: string): boolean => peek()?.t === 'kw' && (peek() as { v: string }).v === v;\n const fail = (msg: string): null => {\n if (error === null) error = msg;\n return null;\n };\n\n // An operand value: a plain word, or a number (equality compares numbers as values too).\n const parseValue = (): string | null => {\n const tk = peek();\n if (tk?.t === 'word') {\n i += 1;\n return tk.v;\n }\n if (tk?.t === 'num') {\n i += 1;\n return String(tk.v);\n }\n return fail('expected a value (a plain word or number, e.g. `booking`)');\n };\n\n // A numeric operand for greater than / less than / at least / at most.\n const parseNumber = (op: string, name: string): number | null => {\n const tk = peek();\n if (tk?.t === 'num') {\n i += 1;\n return tk.v;\n }\n fail(`\\`is ${op}\\` compares numbers — write \\`@{${name}} is ${op} 100\\`. For a value match, write \\`@{${name}} is equal to …\\`.`);\n return null;\n };\n\n const parseAtom = (): Expr | null => {\n const tk = peek();\n if (tk?.t === 'lp') {\n i += 1;\n const inner = parseOr();\n if (!inner) return null;\n if (peek()?.t !== 'rp') return fail('missing `)`');\n i += 1;\n return inner;\n }\n // Bare `$name` — the pre-pointer spelling. The error quotes the WHOLE condition rewritten, so the fix\n // is one paste (and `$` keeps its single meaning: a machine command, never a variable).\n if (tk?.t === 'legacyvar') {\n return fail(`a variable in a condition is a pointer — \\`@{${tk.v}}\\`, never \\`$${tk.v}\\`. Write the condition as: \\`${pointerRewrite(text)}\\`.`);\n }\n if (tk?.t !== 'var') return fail('expected a `@{variable}` pointer');\n i += 1;\n const name = tk.v;\n\n // The code-era symbols — an ERROR carrying the exact English rewrite, never silently accepted.\n const opTok = peek();\n if (opTok?.t === 'op') {\n i += 1;\n const num = peek();\n const operand = num?.t === 'num' ? ` ${num.v}` : num?.t === 'word' ? ` ${num.v}` : ' …';\n return fail(`comparisons are English — \\`${opTok.v}\\` is not an operator. Write \\`@{${name}} ${SYMBOL_REWRITE[opTok.v] ?? 'is equal to'}${operand}\\`.`);\n }\n\n if (!kw('is')) return { kind: 'read', name }; // a bare `$var` is a boolean read\n i += 1;\n const negate = kw('not');\n if (negate) i += 1;\n const wrap = (e: Expr): Expr => (negate ? { kind: 'not', arg: e } : e);\n\n if (kw('equal')) {\n i += 1;\n if (!kw('to')) return fail('expected `to` after `equal` — the operator is `is equal to`');\n i += 1;\n const value = parseValue();\n return value === null ? null : { kind: 'is', name, value, negate };\n }\n if (kw('greater')) {\n i += 1;\n if (!kw('than')) return fail('expected `than` after `greater` — the operator is `is greater than`');\n i += 1;\n const n = parseNumber('greater than', name);\n return n === null ? null : wrap({ kind: 'cmp', name, op: '>', n });\n }\n if (kw('less')) {\n i += 1;\n if (!kw('than')) return fail('expected `than` after `less` — the operator is `is less than`');\n i += 1;\n const n = parseNumber('less than', name);\n return n === null ? null : wrap({ kind: 'cmp', name, op: '<', n });\n }\n if (kw('at')) {\n i += 1;\n const bound = kw('least') ? 'least' : kw('most') ? 'most' : null;\n if (bound === null) return fail('expected `least` or `most` after `at` — the operators are `is at least` / `is at most`');\n i += 1;\n const n = parseNumber(`at ${bound}`, name);\n if (n === null) return null;\n if (negate) {\n // The inclusive pair never takes `not` — its negation IS the strict positive. One predicate, one spelling.\n const positive = bound === 'least' ? `is less than ${n}` : `is greater than ${n}`;\n return fail(`\\`is not at ${bound}\\` has a positive form — write \\`@{${name}} ${positive}\\`.`);\n }\n return { kind: 'cmp', name, op: bound === 'least' ? '>=' : '<=', n };\n }\n if (kw('one')) {\n i += 1;\n if (!kw('of')) return fail('expected `of` after `one` — the operator is `is one of`');\n i += 1;\n const values: string[] = [];\n const first = parseValue();\n if (first === null) return null;\n values.push(first);\n while (peek()?.t === 'comma') {\n i += 1;\n const v = parseValue();\n if (v === null) return null;\n values.push(v);\n }\n return wrap({ kind: 'oneOf', name, values });\n }\n\n // A bare `is v` — the old implicit equality. One uniform shape now: `is [not] <two-word operator>`.\n const vTok = peek();\n const shown = vTok?.t === 'word' ? vTok.v : vTok?.t === 'num' ? String(vTok.v) : '…';\n return fail(`equality is written \\`is equal to\\` — write \\`@{${name}} is ${negate ? 'not ' : ''}equal to ${shown}\\` (every comparison reads \\`is [not] <operator> <operand>\\`).`);\n };\n\n const parseUnary = (): Expr | null => {\n if (kw('not')) {\n i += 1;\n const arg = parseUnary();\n return arg === null ? null : { kind: 'not', arg };\n }\n return parseAtom();\n };\n\n const parseAnd = (): Expr | null => {\n let left = parseUnary();\n if (!left) return null;\n while (kw('and')) {\n i += 1;\n const right = parseUnary();\n if (!right) return null;\n left = { kind: 'and', left, right };\n }\n return left;\n };\n\n function parseOr(): Expr | null {\n let left = parseAnd();\n if (!left) return null;\n while (kw('or')) {\n i += 1;\n const right = parseAnd();\n if (!right) return null;\n left = { kind: 'or', left, right };\n }\n return left;\n }\n\n const ast = parseOr();\n if (error !== null) return { ast: null, error };\n if (i < toks.length) {\n const tk = toks[i];\n const shown = tk === undefined ? 'end' : tk.t === 'var' ? `@{${(tk as { v: string }).v}}` : tk.t === 'legacyvar' ? `$${(tk as { v: string }).v}` : 'v' in tk ? tk.v : tk.t;\n return { ast: null, error: `unexpected \\`${shown}\\`` };\n }\n return { ast, error: null };\n}\n\n// ── Evaluation ──\nconst norm = (v: unknown): string => String(v ?? '').trim().toLowerCase();\n\n/** Evaluate a guard against the variable bag. Total and deterministic — a missing variable reads as\n * falsy/absent, never throws (out-of-domain values simply don't match). Pure. */\nexport function evalExpr(e: Expr, bag: Bag): boolean {\n switch (e.kind) {\n case 'read': {\n const v = bag[e.name];\n return v === true || norm(v) === 'true';\n }\n case 'not':\n return !evalExpr(e.arg, bag);\n case 'and':\n return evalExpr(e.left, bag) && evalExpr(e.right, bag);\n case 'or':\n return evalExpr(e.left, bag) || evalExpr(e.right, bag);\n case 'is': {\n const hit = norm(bag[e.name]) === norm(e.value);\n return e.negate ? !hit : hit;\n }\n case 'oneOf': {\n const v = norm(bag[e.name]);\n return e.values.some((x) => norm(x) === v);\n }\n case 'cmp': {\n const v = Number(bag[e.name]);\n if (Number.isNaN(v)) return false; // missing or non-numeric → the comparison simply doesn't hold\n return e.op === '>' ? v > e.n : e.op === '>=' ? v >= e.n : e.op === '<' ? v < e.n : v <= e.n;\n }\n }\n}\n\n// ── Atom extraction (for type-checking a guard against the declared input types) ──\nexport interface Atom {\n name: string; // the input the atom reads (lowercased)\n test: 'bool' | 'value' | 'numeric'; // a bare read (bool) · an `is`/`one of` comparison (value) · a `>`/`<` comparison (number)\n values: string[]; // the compared values (empty for a bool read or a numeric comparison) — checked against an enum's domain\n}\n\n/** Every leaf atom in the expression, so the checker can verify each input is declared and used at the right\n * type (a bare read wants a bool; a value comparison wants an enum member; a `>`/`<` wants a number). Pure. */\nexport function exprAtoms(e: Expr): Atom[] {\n switch (e.kind) {\n case 'read':\n return [{ name: e.name, test: 'bool', values: [] }];\n case 'is':\n return [{ name: e.name, test: 'value', values: [e.value] }];\n case 'oneOf':\n return [{ name: e.name, test: 'value', values: e.values }];\n case 'cmp':\n return [{ name: e.name, test: 'numeric', values: [] }];\n case 'not':\n return exprAtoms(e.arg);\n case 'and':\n case 'or':\n return [...exprAtoms(e.left), ...exprAtoms(e.right)];\n }\n}\n","// ── The selection commands — ONE engine, TWO spellings ───────────────────────────────────────────────────\n// The plane is declared at COLUMN ONE: a deterministic arm is a COMMAND (`$IF`, `$SWITCH`), exactly like\n// every other machine construct ($TOOL, $DEFINE, $REQUIRE) — the compiler evaluates it (resolve.ts keeps\n// the winning arm; losing arms never reach the model). A bare `IF` is PROSE — a statement the model weighs\n// (`IF the user asks about pricing THEN route to sales.`). Conditions read `@{name}` pointers (expr.ts).\n//\n// Spelling 1 — the `$IF` CHAIN: arms are PREDICATES, ordered, first-true-wins (may overlap):\n// $IF @{channel} is equal to voice: Speak amounts as words.\n// $ELSE IF @{channel} is one of chat, sms: Use digits.\n// $ELSE: Match the user's format.\n//\n// Spelling 2 — the `$SWITCH ON` BLOCK: arms are MEMBERS of one typed input's closed domain, unordered,\n// coverage proven by construction (`$IF` is `$SWITCH` on a boolean — same engine, different contract):\n// $SWITCH ON @{channel}\n// - voice:: Speak amounts as words.\n// - chat:: Use digits with a currency symbol.\n// - sms:: Plain digits, replies under 160 characters.\n//\n// Chain arms sit at ONE column; an arm's body is inline after the `:` or on the lines indented beneath it\n// (the chain ends at the first same-or-lesser-indented line that isn't an arm). A chain CLASSIFIES for\n// checking: every arm testing the SAME single input with equality/membership → a VALUE chain (sync\n// exhaustiveness over the declared domain); every arm a conjunction of equalities over the same 2+ inputs\n// → a TUPLE chain (product-domain match); anything else → a PREDICATE chain (first-true; totality proven\n// by the solver tier). A `$SWITCH ON` block parses into the SAME SwitchBlock shape as a value chain\n// (kind 'value', form 'block'), so resolve/selection, exhaustiveness, depgraph, and the render prose all\n// serve both spellings from one implementation. A block's arms are member keys ONLY — a predicate in arm\n// position is an error handing back the chain rewrite (the existence contract: the day $SWITCH grows a\n// predicate arm, it is the retired $SWITCH again and should be deleted).\n// $ELSE binds to the deterministic plane ONLY — a dangling $ELSE is an error. The RETIRED forms — the old\n// `$SWITCH ON $x:`/`CASE` block AND the bare-IF colon-arm (`IF $x …:`) — are recognized ONLY to hand back\n// the complete rewrite in the current grammar. Pure — no editor, no bag; resolve.ts and structure.ts consume this.\n\nimport { configSectionMask, examplesMask, toolBlockMask } from './clause';\nimport { parseExpr, pointerRewrite } from './expr';\nimport type { Expr } from './expr';\n\nexport interface SwitchArm {\n kind: 'case' | 'else';\n values: string[]; // VALUE chain: the arm's matched members (case-folded) — `is one of a, b` matches a OR b.\n predicate?: string; // PREDICATE chain only: the raw condition (evaluated first-true against the bag)\n patterns?: string[]; // TUPLE chain only: one positional pattern per switched var — a value or `_` (wildcard)\n condition?: string; // every deterministic arm: the raw condition text as written (render strips its sigils)\n headerLine: number; // the IF / ELSE IF / ELSE line\n spanEnd: number; // exclusive — the next arm's header, or the chain end; body = (headerLine, spanEnd)\n inlineBody: string; // text after the `:` on the arm line (empty when the body is on indented lines below)\n}\n\nexport interface SwitchBlock {\n kind: 'value' | 'predicate' | 'tuple'; // same-input equality chain · first-true chain · product-match chain\n /** Which SPELLING wrote this block: a `$IF` chain, or a `$SWITCH ON` member table. One engine serves\n * both; the checker keys contract differences (otherwise rules, advisories, message wording) off this. */\n form: 'chain' | 'block';\n headerLine: number; // the first `IF` arm's line (a chain has no separate header) / the `$SWITCH ON` line\n blockEnd: number; // exclusive — the first line after the last arm's body, or EOF\n indent: number; // leading-space count of the arm column (chain) / the header column (block)\n varName: string; // VALUE chain/block: the switched input (lowercased); '' otherwise\n varNames?: string[]; // TUPLE chain only: the ordered switched inputs (2+)\n arms: SwitchArm[];\n error: string | null; // a parse-level problem (dangling ELSE, arm after ELSE, a nested chain, a retired form)\n errorCode?: string; // a specific diagnostic code for `error` (defaults to the generic chain code)\n}\n\n// A deterministic arm: `$IF <condition>:` — the command declares the plane; the colon splits condition\n// from inline body. Prose never matches: a bare `IF the user asks … THEN …` has no `$` lead.\nconst DET_IF = /^(\\s*)\\$IF\\s+([^:]*?)\\s*:\\s*(.*)$/i;\nconst ELSE_IF = /^(\\s*)\\$ELSE\\s+IF\\s+([^:]*?)\\s*:\\s*(.*)$/i;\nconst ELSE_A = /^(\\s*)\\$ELSE\\s*:\\s*(.*)$/i;\nconst PROSE_IF_LEAD = /^\\s*IF\\b[^:]*:\\s*/i; // a bare-IF colon lead-in — for the dangling-$ELSE hint\n// The PRE-COMMAND deterministic forms — a bare IF/ELSE IF/ELSE colon-arm whose condition reads a variable\n// (`$x` or `@{x}`) — recognized ONLY to compose the complete rewritten chain ($-led arms, pointer conditions).\nconst LEGACY_DET_IF = /^(\\s*)IF\\s+([^:]*(?:\\$|@\\{)[a-z][a-z0-9_]*[^:]*?)\\s*:\\s*(.*)$/i;\nconst LEGACY_ELSE_IF = /^(\\s*)ELSE\\s+IF\\s+([^:]*?)\\s*:\\s*(.*)$/i;\nconst LEGACY_ELSE = /^(\\s*)ELSE\\s*:\\s*(.*)$/i;\n// The CURRENT `$SWITCH ON` block — the member-keyed spelling. Header takes a `@{name}` pointer and no\n// colon (cleanly disjoint from the retired `$SWITCH ON $x:` below); arms are `- member:: body` rows one\n// unit deeper, `- otherwise::` the fallback. NEW_ARM deliberately matches ONLY a bare member key — a\n// predicate lands in NEW_ARM_ANY and errors with the chain rewrite.\nconst NEW_HEADER = /^(\\s*)\\$SWITCH\\s+ON\\s+@\\{([a-z][a-z0-9_]*)\\}\\s*$/i;\nconst NEW_ARM = /^(\\s*)-\\s+([A-Za-z][A-Za-z0-9_]*)\\s*::\\s*(.*)$/;\nconst NEW_ARM_ANY = /^(\\s*)-\\s+(.*?)\\s*::\\s*(.*)$/;\n\n// The RETIRED forms — recognized ONLY to compose the complete rewritten chain.\nconst OLD_VALUE_HEADER = /^(\\s*)\\$SWITCH\\s+ON\\s+\\$([a-z][a-z0-9_]*)\\s*:\\s*$/i;\nconst OLD_TUPLE_HEADER = /^(\\s*)\\$SWITCH\\s+ON\\s+(\\$[a-z][a-z0-9_]*(?:\\s*,\\s*\\$[a-z][a-z0-9_]*)+)\\s*:\\s*$/i;\nconst OLD_PRED_HEADER = /^(\\s*)\\$SWITCH\\s*:\\s*$/i;\nconst OLD_CASE_ARM = /^\\s*CASE\\b\\s*(.*?)\\s*:\\s*(.*)$/i;\nconst OLD_ELSE_ARM = /^\\s*ELSE\\s*:\\s*(.*)$/i;\nconst ANY_OLD_SWITCH = /^\\s*\\$SWITCH\\b/i;\n\nconst leading = (s: string): number => s.length - s.trimStart().length;\n\n/** Flatten an `and` tree into its leaves (for tuple-chain detection). */\nfunction andLeaves(e: Expr): Expr[] {\n return e.kind === 'and' ? [...andLeaves(e.left), ...andLeaves(e.right)] : [e];\n}\n\n/** Classify a chain from its parsed case-arm conditions, filling per-kind arm fields in place. */\nfunction classifyChain(arms: SwitchArm[], conds: (Expr | null)[]): { kind: SwitchBlock['kind']; varName: string; varNames?: string[] } {\n const caseArms = arms.filter((a) => a.kind === 'case');\n const asPredicate = (): { kind: SwitchBlock['kind']; varName: string } => {\n caseArms.forEach((a) => {\n a.predicate = a.condition ?? '';\n });\n return { kind: 'predicate', varName: '' };\n };\n if (conds.some((c) => c === null)) return asPredicate(); // an unparseable condition → the predicate path flags it\n\n // VALUE chain: every condition is `$v is equal to x` or `$v is one of xs` on ONE shared input.\n const valueOf = (e: Expr): { name: string; values: string[] } | null =>\n e.kind === 'is' && !e.negate ? { name: e.name, values: [e.value] } : e.kind === 'oneOf' ? { name: e.name, values: e.values } : null;\n const vals = conds.map((c) => valueOf(c as Expr));\n if (vals.every((v) => v !== null) && new Set(vals.map((v) => v!.name)).size === 1) {\n caseArms.forEach((a, i) => {\n a.values = (vals[i]?.values ?? []).map((v) => v.toLowerCase());\n });\n return { kind: 'value', varName: vals[0]!.name };\n }\n\n // TUPLE chain: every condition is a conjunction of plain equalities over the same 2+ inputs.\n const rows = conds.map((c) => {\n const leaves = andLeaves(c as Expr);\n const row = new Map<string, string>();\n for (const l of leaves) {\n if (l.kind !== 'is' || l.negate || row.has(l.name)) return null;\n row.set(l.name, l.value.toLowerCase());\n }\n return row;\n });\n if (rows.every((r) => r !== null)) {\n const order: string[] = [];\n for (const r of rows) for (const name of r!.keys()) if (!order.includes(name)) order.push(name);\n if (order.length >= 2) {\n caseArms.forEach((a, i) => {\n a.patterns = order.map((name) => rows[i]!.get(name) ?? '_');\n });\n return { kind: 'tuple', varName: '', varNames: order } as { kind: SwitchBlock['kind']; varName: string; varNames: string[] };\n }\n }\n\n return asPredicate();\n}\n\n/** Compose the CURRENT block form for a retired value `$SWITCH ON $x:`/`CASE` block — member rows under a\n * `@{x}` header. Only single-member CASEs qualify (a block arm is one member per row); a multi-member\n * CASE (`CASE a, b:`) shares one body, so those blocks fall back to the chain rewrite. Returns null when\n * the block doesn't qualify. */\nfunction composeBlockRewrite(lines: string[], headerLine: number, blockEnd: number, varName: string): string | null {\n const pad = ' '.repeat(leading(lines[headerLine] ?? ''));\n const out: string[] = [`${pad}$SWITCH ON @{${varName}}`];\n for (let k = headerLine + 1; k < blockEnd; k += 1) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') continue;\n const em = raw.match(OLD_ELSE_ARM);\n const cm = em ? null : raw.match(OLD_CASE_ARM);\n if (em) {\n out.push(`${pad} - otherwise::${(em[1] ?? '').trim() !== '' ? ` ${(em[1] ?? '').trim()}` : ''}`);\n continue;\n }\n if (!cm) continue; // body lines ride along unchanged (they stay indented under their arm)\n const members = (cm[1] ?? '').split(',').map((v) => v.trim()).filter((v) => v !== '');\n if (members.length !== 1 || !/^[A-Za-z][A-Za-z0-9_]*$/.test(members[0] ?? '')) return null;\n out.push(`${pad} - ${members[0]}::${(cm[2] ?? '').trim() !== '' ? ` ${(cm[2] ?? '').trim()}` : ''}`);\n }\n return out.join('\\n');\n}\n\n/** Compose the rewritten chain for a retired `$SWITCH` block — the complete arms, ready to paste at the\n * header's column (the old arms sat one unit deeper; the chain sits AT the statement column). */\nfunction composeChainRewrite(lines: string[], headerLine: number, blockEnd: number, kind: 'value' | 'tuple' | 'predicate', varName: string, varNames: string[]): string {\n const pad = ' '.repeat(leading(lines[headerLine] ?? ''));\n const out: string[] = [];\n let first = true;\n for (let k = headerLine + 1; k < blockEnd; k += 1) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') continue;\n const em = raw.match(OLD_ELSE_ARM);\n const cm = em ? null : raw.match(OLD_CASE_ARM);\n if (em) {\n out.push(`${pad}$ELSE:${(em[1] ?? '').trim() !== '' ? ` ${(em[1] ?? '').trim()}` : ''}`);\n continue;\n }\n if (!cm) continue; // body lines ride along unchanged (they dedent with their arm)\n const label = (cm[1] ?? '').trim();\n const body = (cm[2] ?? '').trim();\n let cond: string;\n if (kind === 'value') {\n const members = label.split(',').map((v) => v.trim()).filter((v) => v !== '');\n cond = members.length > 1 ? `@{${varName}} is one of ${members.join(', ')}` : `@{${varName}} is equal to ${members[0] ?? ''}`;\n } else if (kind === 'tuple') {\n const pats = label.split(',').map((v) => v.trim());\n const parts = pats.map((p, i) => (p === '_' || p === '' ? null : `@{${varNames[i] ?? ''}} is equal to ${p}`)).filter((p): p is string => p !== null);\n if (parts.length === 0) {\n out.push(`${pad}$ELSE:${body !== '' ? ` ${body}` : ''}`); // an all-wildcard pattern IS the default arm\n continue;\n }\n cond = parts.join(' and ');\n } else {\n cond = pointerRewrite(label); // predicate: the condition is an expression — its $vars become pointers\n }\n out.push(`${pad}${first ? '$IF' : '$ELSE IF'} ${cond}:${body !== '' ? ` ${body}` : ''}`);\n first = false;\n }\n return out.join('\\n');\n}\n\n/** Every deterministic chain (and every retired `$SWITCH` block or legacy bare-IF chain, as an error\n * carrying its rewrite), with arms and extent. Chains don't nest (a nested deterministic $IF is an error).\n * Fences, `<examples>` zones, `<$CONFIG>` extents, and `$TOOL` bodies are literal homes — never scanned. Pure. */\nexport function parseSwitches(lines: string[]): SwitchBlock[] {\n const blocks: SwitchBlock[] = [];\n const exMask = examplesMask(lines);\n const cfgMask = configSectionMask(lines);\n const toolMask = toolBlockMask(lines);\n let inFence = false;\n const skip: boolean[] = lines.map((raw, i) => {\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return true;\n }\n return inFence || exMask[i] === true || cfgMask[i] === true || toolMask[i] === true;\n });\n\n let i = 0;\n while (i < lines.length) {\n if (skip[i]) {\n i += 1;\n continue;\n }\n const raw0 = lines[i] ?? '';\n\n // ── The `$SWITCH ON @{x}` block — the member-keyed spelling ──\n const nm = raw0.match(NEW_HEADER);\n if (nm) {\n const headerIndent = (nm[1] ?? '').length;\n const varName = (nm[2] ?? '').toLowerCase();\n const arms: SwitchArm[] = [];\n let error: string | null = null;\n let errorCode: string | undefined;\n let armIndent = -1;\n let k = i + 1;\n while (k < lines.length) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') {\n k += 1;\n continue;\n }\n if (skip[k]) break;\n const lead = leading(raw);\n if (lead <= headerIndent) break; // dedent to (or past) the header ends the block\n if (armIndent === -1) armIndent = lead; // the first row fixes the arm column\n if (lead > armIndent) {\n k += 1; // an arm's BODY line — statements under the arm row\n continue;\n }\n const am = raw.match(NEW_ARM);\n if (am) {\n const key = am[2] ?? '';\n const body = (am[3] ?? '').trim();\n if (/^otherwise$/i.test(key)) {\n arms.push({ kind: 'else', values: [], headerLine: k, spanEnd: k + 1, inlineBody: body });\n } else {\n // A member arm. The condition is SYNTHESIZED so every downstream consumer (selection, the\n // unresolved prose render, depgraph) reads the block exactly like the equivalent value chain.\n const member = key.toLowerCase();\n arms.push({ kind: 'case', values: [member], condition: `@{${varName}} is equal to ${member}`, headerLine: k, spanEnd: k + 1, inlineBody: body });\n }\n k += 1;\n continue;\n }\n const pm = raw.match(NEW_ARM_ANY);\n if (pm) {\n // A condition in arm position — the existence contract: block arms are MEMBERS, never predicates.\n const label = (pm[2] ?? '').trim();\n const pad = ' '.repeat(headerIndent);\n error ??= `a $SWITCH arm is a MEMBER of @{${varName}}'s domain, never a condition — \"- ${label}::\" asks a question, and questions are a chain's job. Write it as a chain:\\n${pad}$IF ${/@\\{/.test(label) ? label : pointerRewrite(label)}: …\\n${pad}$ELSE: …`;\n errorCode ??= 'switch-arm';\n k += 1;\n continue;\n }\n error ??= 'every row under $SWITCH ON is an arm — \"- member:: …\" (or \"- otherwise:: …\"); an arm\\'s body sits on the lines indented beneath its row.';\n errorCode ??= 'switch-arm';\n k += 1;\n }\n const blockEnd = k;\n for (let a = 0; a < arms.length; a += 1) {\n const arm = arms[a];\n if (arm) arm.spanEnd = arms[a + 1]?.headerLine ?? blockEnd;\n }\n if (arms.length === 0) {\n error ??= 'the $SWITCH ON block has no arms — add \"- member:: …\" rows one unit beneath the header.';\n errorCode ??= 'switch-arm';\n }\n blocks.push({ kind: 'value', form: 'block', headerLine: i, blockEnd, indent: headerIndent, varName, arms, error, ...(errorCode !== undefined ? { errorCode } : {}) });\n i = blockEnd;\n continue;\n }\n\n // ── The retired $SWITCH forms → an error block carrying the COMPLETE rewritten chain ──\n const om = raw0.match(OLD_VALUE_HEADER);\n const otm = om ? null : raw0.match(OLD_TUPLE_HEADER);\n const opm = om || otm ? null : raw0.match(OLD_PRED_HEADER);\n if (om || otm || opm) {\n const indent = ((om ?? otm ?? opm)?.[1] ?? '').length;\n let j = i + 1;\n while (j < lines.length) {\n const l = lines[j] ?? '';\n if (l.trim() !== '' && leading(l) <= indent) break;\n j += 1;\n }\n const kind = om ? 'value' : otm ? 'tuple' : 'predicate';\n const varName = (om?.[2] ?? '').toLowerCase();\n const varNames = otm ? (otm[2] ?? '').split(',').map((v) => v.trim().replace(/^\\$/, '').toLowerCase()) : [];\n // A value block with single-member CASEs migrates to the CURRENT block form (member rows); a\n // tuple/predicate block — or a multi-member CASE — has no member-table home, so it becomes a chain.\n const blockRewrite = om ? composeBlockRewrite(lines, i, j, varName) : null;\n const rewrite = blockRewrite ?? composeChainRewrite(lines, i, j, kind, varName, varNames);\n blocks.push({\n kind: 'predicate',\n form: 'block',\n headerLine: i,\n blockEnd: j,\n indent,\n varName: '',\n arms: [],\n error: blockRewrite !== null\n ? `the CASE form is retired — a $SWITCH block's arms are \"- member::\" rows under a \"@{name}\" header. Replace the block with:\\n${rewrite}`\n : `this $SWITCH form is retired — conditions belong to a $IF chain (members-only blocks use \"$SWITCH ON @{x}\" with \"- member::\" rows). Replace the block with:\\n${rewrite}`,\n });\n i = j;\n continue;\n }\n if (ANY_OLD_SWITCH.test(raw0)) {\n blocks.push({ kind: 'predicate', form: 'block', headerLine: i, blockEnd: i + 1, indent: leading(raw0), varName: '', arms: [], error: `malformed $SWITCH — the block form is \"$SWITCH ON @{x}\" (a pointer, no colon) with \"- member:: …\" arm rows one unit beneath; for conditions, write a $IF chain instead.` });\n i += 1;\n continue;\n }\n\n // ── A deterministic chain: $IF → $ELSE IF* → $ELSE? (legacy bare-IF arms parse too, as migration) ──\n const m = raw0.match(DET_IF);\n const lm = m ? null : raw0.match(LEGACY_DET_IF);\n if (m || lm) {\n const head = (m ?? lm) as RegExpMatchArray;\n const indent = (head[1] ?? '').length;\n const legacyArms: number[] = lm ? [i] : [];\n const arms: SwitchArm[] = [{ kind: 'case', values: [], condition: (head[2] ?? '').trim(), headerLine: i, spanEnd: i + 1, inlineBody: (head[3] ?? '').trim() }];\n let error: string | null = null;\n let k = i + 1;\n while (k < lines.length) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') {\n k += 1;\n continue;\n }\n if (skip[k]) break;\n const lead = leading(raw);\n if (lead > indent) {\n // A body line — a nested DETERMINISTIC arm here is an error (combine conditions instead).\n if (DET_IF.test(raw) || LEGACY_DET_IF.test(raw)) error ??= 'a nested deterministic $IF is not supported — combine the conditions with `and`, or lift the inner chain out.';\n k += 1;\n continue;\n }\n if (lead < indent) break;\n const eim = raw.match(ELSE_IF);\n const lei = eim ? null : raw.match(LEGACY_ELSE_IF);\n const em = eim ?? lei ? null : raw.match(ELSE_A);\n const lem = (eim ?? lei ?? em) ? null : raw.match(LEGACY_ELSE);\n if (eim || lei) {\n // An arm after ELSE parses fine — the CHECKER flags it (unreachable-case), line-precise.\n const am = (eim ?? lei) as RegExpMatchArray;\n const cond = (am[2] ?? '').trim();\n if (lei) legacyArms.push(k);\n if (!/@\\{[a-z]|\\$[a-z]/i.test(cond)) error ??= `$ELSE IF binds to the deterministic plane — its condition must read a @{variable} pointer (found \"${cond}\"). For a prose alternative, write it as its own sentence.`;\n arms.push({ kind: 'case', values: [], condition: cond, headerLine: k, spanEnd: k + 1, inlineBody: (am[3] ?? '').trim() });\n k += 1;\n continue;\n }\n if (em || lem) {\n // A second ELSE also parses — the checker's arms-after-ELSE sweep flags it.\n const am = (em ?? lem) as RegExpMatchArray;\n if (lem) legacyArms.push(k);\n arms.push({ kind: 'else', values: [], headerLine: k, spanEnd: k + 1, inlineBody: (am[2] ?? '').trim() });\n k += 1;\n continue;\n }\n break; // a same-indent non-arm line (including a NEW $IF chain) ends this chain\n }\n const blockEnd = k;\n for (let a = 0; a < arms.length; a += 1) {\n const arm = arms[a];\n if (arm) arm.spanEnd = arms[a + 1]?.headerLine ?? blockEnd;\n }\n // Any legacy arm → ONE migration error carrying every arm line rewritten ($-led commands, pointer\n // conditions). Bodies keep their lines and columns, so the fix is a per-line paste. This outranks\n // the plane/nesting notes above — the arms must speak the current language before finer checks help.\n if (legacyArms.length > 0) {\n const pad = ' '.repeat(indent);\n const rewritten = arms\n .map((a, ix) =>\n a.kind === 'else'\n ? `${pad}$ELSE:${a.inlineBody !== '' ? ` ${a.inlineBody}` : ''}`\n : `${pad}${ix === 0 ? '$IF' : '$ELSE IF'} ${pointerRewrite(a.condition ?? '')}:${a.inlineBody !== '' ? ` ${a.inlineBody}` : ''}`,\n )\n .join('\\n');\n error = `a deterministic chain leads with $ — the arms are commands ($IF / $ELSE IF / $ELSE), and a variable in a condition is a @{name} pointer. Replace the arm lines with:\\n${rewritten}`;\n }\n const conds = arms.filter((a) => a.kind === 'case').map((a) => parseExpr(a.condition ?? '').ast);\n const cls = classifyChain(arms, conds);\n blocks.push({ kind: cls.kind, form: 'chain', headerLine: i, blockEnd, indent, varName: cls.varName, ...(cls.varNames !== undefined ? { varNames: cls.varNames } : {}), arms, error });\n i = blockEnd;\n continue;\n }\n\n // ── A dangling $ELSE / $ELSE IF (or a legacy bare one) — no deterministic $IF above at this column ──\n const strayElseIf = raw0.match(ELSE_IF) ?? raw0.match(LEGACY_ELSE_IF);\n const strayElse = strayElseIf ? null : (raw0.match(ELSE_A) ?? raw0.match(LEGACY_ELSE));\n if (strayElseIf || strayElse) {\n // Walk back to the construct this ELSE tried to attach to — skipping blanks, deeper lines, and\n // list items (a prose IF's lead-in body is often a bullet list at the same column).\n let p = i - 1;\n while (p >= 0 && ((lines[p] ?? '').trim() === '' || leading(lines[p] ?? '') > leading(raw0) || /^\\s*(?:[-*+]|\\d+[.)])\\s/.test(lines[p] ?? ''))) p -= 1;\n const prev = lines[p] ?? '';\n const afterProseIf = PROSE_IF_LEAD.test(prev) && !DET_IF.test(prev) && !LEGACY_DET_IF.test(prev);\n blocks.push({\n kind: 'predicate',\n form: 'chain',\n headerLine: i,\n blockEnd: i + 1,\n indent: leading(raw0),\n varName: '',\n arms: [],\n error: afterProseIf\n ? `$ELSE binds to a deterministic $IF — the IF above is prose, so the model weighs it. Write the alternative as prose (e.g. lead with OTHERWISE), or make the chain deterministic: lead it with $IF and read a @{variable} pointer in the condition.`\n : `$ELSE without a deterministic $IF above it at the same column — a chain reads $IF @{x} …: / $ELSE IF …: / $ELSE:.`,\n });\n i += 1;\n continue;\n }\n // A stray retired CASE arm (its $SWITCH header already removed or mis-indented).\n if (OLD_CASE_ARM.test(raw0) && /^\\s*CASE\\b/i.test(raw0)) {\n blocks.push({ kind: 'predicate', form: 'block', headerLine: i, blockEnd: i + 1, indent: leading(raw0), varName: '', arms: [], error: `CASE is retired — a $SWITCH block's arms are \"- member:: …\" rows (or write a $IF chain: \"$IF @{x} is equal to <value>: …\").` });\n i += 1;\n continue;\n }\n\n i += 1;\n }\n return blocks;\n}\n\n/** The arm a value chain resolves to for a given (case-folded) value: the first arm listing it, else the\n * ELSE arm, else null (a non-exhaustive chain with no match — the checker forbids this, resolve stays total). Pure. */\nexport function selectArm(block: SwitchBlock, value: string): SwitchArm | null {\n const v = value.trim().toLowerCase();\n return block.arms.find((a) => a.kind === 'case' && a.values.includes(v)) ?? block.arms.find((a) => a.kind === 'else') ?? null;\n}\n\n/** The arm a predicate chain resolves to: the FIRST arm whose condition tests true (order matters, like\n * if/elif), else the ELSE arm, else null. `test` is injected (resolve wires it to evalExpr) so this stays\n * expr-free of evaluation and pure. Iterating in order means reaching ELSE only after every arm tested false. */\nexport function selectPredicateArm(block: SwitchBlock, test: (expr: string) => boolean): SwitchArm | null {\n for (const a of block.arms) {\n if (a.kind === 'else') return a;\n if (a.predicate !== undefined && test(a.predicate)) return a;\n }\n return null;\n}\n\n/** The arm a tuple chain resolves to for the switched values: the first arm whose every position matches\n * (value-equal, or `_` wildcard — an input absent from the arm's conjunction), else the ELSE arm, else null.\n * Case-folded, pure. */\nexport function selectTupleArm(block: SwitchBlock, values: string[]): SwitchArm | null {\n const v = values.map((x) => x.trim().toLowerCase());\n const match = block.arms.find(\n (a) => a.kind === 'case' && a.patterns !== undefined && a.patterns.length === v.length && a.patterns.every((p, i) => p === '_' || p === v[i]),\n );\n return match ?? block.arms.find((a) => a.kind === 'else') ?? null;\n}\n\n// ── Inline `$SWITCH ON $x ( a: … | b: … | _: … )` — RETIRED ──────────────────────────────────────────────\n// The mid-sentence form is out of the language: it hid a `|`-delimited mini-grammar inside prose, and its\n// name outlived the block `$SWITCH` it borrowed from. The scanner below survives ONLY so the checker\n// (structure.ts) can flag each occurrence with a complete rewrite — one full sentence per arm, under a\n// block $IF chain — and so resolve() can keep its fail-open contract (a flagged line resolves verbatim;\n// a broken form never silently deletes content).\n\nexport interface InlineCase {\n values: string[]; // case-folded CASE values; `a, b` matches either. Empty when isDefault.\n isDefault: boolean; // `_` or ELSE — the fallback fragment\n frag: string; // the replacement text\n}\n\nexport interface InlineSwitch {\n line: number;\n start: number; // column of `$SWITCH`\n end: number; // column just past the closing `)`\n varName: string; // the switched input (lowercased)\n cases: InlineCase[];\n error: string | null; // no arms, or an arm missing its `value:` — exhaustiveness is structure.ts's job\n}\n\n// One source of truth for the inline shape, shared by every consumer (parse, resolve, mask). Global so\n// `matchAll`/`replace` sweep a whole line; both copy or reset lastIndex per call, so reuse is safe.\nconst INLINE_SWITCH = /\\$SWITCH\\s+ON\\s+\\$([a-z][a-z0-9_]*)\\s*\\(([^)]*)\\)/gi;\n\n/** Parse the `a: x | b: y | _: z` arm list inside an inline switch's parens. */\nfunction parseInlineCases(body: string): { cases: InlineCase[]; error: string | null } {\n const cases: InlineCase[] = [];\n let error: string | null = null;\n for (const seg of body.split('|')) {\n if (seg.trim() === '') continue;\n const colon = seg.indexOf(':');\n if (colon < 0) {\n error ??= 'each arm needs a `value: fragment`.';\n continue;\n }\n const label = seg.slice(0, colon).trim();\n const frag = seg.slice(colon + 1).trim();\n if (label === '_' || /^else$/i.test(label)) {\n cases.push({ values: [], isDefault: true, frag });\n continue;\n }\n const values = label.split(',').map((v) => v.trim().toLowerCase()).filter((v) => v !== '');\n if (values.length === 0) {\n error ??= 'an arm has no value before its colon.';\n continue;\n }\n cases.push({ values, isDefault: false, frag });\n }\n if (cases.length === 0) error ??= 'the inline $SWITCH has no arms.';\n return { cases, error };\n}\n\n/** Every inline `$SWITCH ON $x ( … )` across the source, with its column span. Pure. */\nexport function parseInlineSwitches(lines: string[]): InlineSwitch[] {\n const out: InlineSwitch[] = [];\n lines.forEach((line, i) => {\n for (const m of line.matchAll(INLINE_SWITCH)) {\n const { cases, error } = parseInlineCases(m[2] ?? '');\n const start = m.index ?? 0;\n out.push({ line: i, start, end: start + m[0].length, varName: (m[1] ?? '').toLowerCase(), cases, error });\n }\n });\n return out;\n}\n\n/** The case an inline switch resolves to for a (case-folded) value: first CASE listing it, else the default,\n * else null (no match, no default — the checker forbids this, but resolve stays total). Pure. */\nexport function selectInlineCase(sw: InlineSwitch, value: string): InlineCase | null {\n const v = value.trim().toLowerCase();\n return sw.cases.find((c) => !c.isDefault && c.values.includes(v)) ?? sw.cases.find((c) => c.isDefault) ?? null;\n}\n\n/** Replace every inline `$SWITCH ON $x ( … )` in a line with its picked fragment (or '' if unmatched). Re-parses\n * from the given text so it survives an earlier whole-line rewrite; a malformed switch is left verbatim. */\nexport function resolveInlineText(text: string, pick: (varName: string) => string): string {\n return text.replace(INLINE_SWITCH, (whole, varName: string, body: string) => {\n const { cases, error } = parseInlineCases(body);\n if (error !== null) return whole; // malformed → keep verbatim (the checker flagged it; won't compile)\n const v = pick(String(varName).toLowerCase()).trim().toLowerCase();\n const arm = cases.find((c) => !c.isDefault && c.values.includes(v)) ?? cases.find((c) => c.isDefault) ?? null;\n return arm ? arm.frag : '';\n });\n}\n\n/** Blank every inline switch span to equal-length spaces (offsets/spans survive). The semantic tier masks these\n * before decomposition — a fragment is conditional, not an always-on claim, so it must not be compared. */\nexport function maskInlineSwitches(source: string): string {\n return source.replace(INLINE_SWITCH, (m) => ' '.repeat(m.length));\n}\n\n// ── render's compile-away for UNRESOLVED chains (Layer 1: render is TOTAL) ─────────────────────────────────\n// resolve() collapses a chain to one arm when the bag knows its inputs. Whatever the bag couldn't decide is\n// left for render — and render must never leak `$` sigils to the model. An unresolved chain renders as the\n// conditional English it already IS: each arm's own condition, sigils stripped — `If channel is equal to\n// voice: …` / `Otherwise: …`. Nothing is hidden (fail-open — a chain never silently drops a branch), and the\n// output is a correct, functional prompt. This is the state-free half of the two-stage pipeline; resolve() is\n// the state-dependent optimization on top.\n\nfunction joinOr(values: string[]): string {\n if (values.length <= 1) return values[0] ?? '';\n return `${values.slice(0, -1).join(', ')} or ${values[values.length - 1]}`;\n}\n\n/** The human-readable condition for one arm — the arm's own English, pointer marks stripped\n * (`@{channel}` → `channel`; a legacy bare `$` sheds too), copulas SMOOTHED: the render is plain\n * English for the model, not TypeGlish, so the uniform operators contract to their natural forms\n * (`is equal to voice` → `is voice`, `is one of a, b` → `is a or b`). Ordered comparisons\n * (`is at least 100`) already read naturally and pass through. Pure. */\nexport function conditionPhrase(_block: SwitchBlock, arm: SwitchArm): string {\n if (arm.kind === 'else') return 'Otherwise';\n const smoothed = (arm.condition ?? arm.predicate ?? '')\n .replace(/@\\{([a-z][a-z0-9_]*)\\}/gi, '$1')\n .replace(/\\$/g, '')\n .trim()\n .replace(/\\bis\\s+not\\s+equal\\s+to\\s+/gi, 'is not ')\n .replace(/\\bis\\s+equal\\s+to\\s+/gi, 'is ')\n .replace(/\\bis\\s+one\\s+of\\s+((?:[a-z0-9_-]+\\s*,\\s*)*[a-z0-9_-]+)/gi, (_m, list: string) => `is ${joinOr(list.split(',').map((v) => v.trim()).filter((v) => v !== ''))}`);\n return `If ${smoothed}`;\n}\n\n/** Every line of every well-formed chain — the span whose indentation is SEMANTIC (arm bodies are\n * dedent-delimited, like a $TOOL body or a code fence). stripIndent must preserve it, or flattening the\n * chain to column 0 dissolves its arms and the conditions leak verbatim. Pure. */\nexport function switchBlockMask(lines: string[]): boolean[] {\n const mask: boolean[] = new Array(lines.length).fill(false);\n for (const block of parseSwitches(lines)) {\n if (block.error !== null) continue;\n for (let l = block.headerLine; l < block.blockEnd && l < mask.length; l += 1) mask[l] = true;\n }\n return mask;\n}\n\n/** A line-rewrite map that turns every WELL-FORMED chain into sigil-free conditional prose: each arm line\n * becomes its `If …:` / `Otherwise:` phrase, and every arm's body is KEPT (all branches survive). A\n * malformed chain is left verbatim (fail-open — the checker already flagged it, and it won't compile).\n * null → drop the line; a string → replace it; absent → keep verbatim. Pure. */\nexport function switchProseRewrite(lines: string[]): Map<number, string | null> {\n const rw = new Map<number, string | null>();\n for (const block of parseSwitches(lines)) {\n if (block.error !== null) continue;\n const pad = ' '.repeat(block.indent);\n for (let l = block.headerLine; l < block.blockEnd; l += 1) rw.set(l, null); // drop the whole chain …\n for (const arm of block.arms) {\n const cond = conditionPhrase(block, arm);\n rw.set(arm.headerLine, arm.inlineBody !== '' ? `${pad}${cond}: ${arm.inlineBody}` : `${pad}${cond}:`);\n // … and re-emit each arm's body DEDENTED one unit under its conditional lead-in (the arm header's\n // gutter is scaffolding, not emitted layout — same shift resolve() applies to the winning arm).\n const bodyLines: number[] = [];\n for (let l = arm.headerLine + 1; l < arm.spanEnd; l += 1) bodyLines.push(l);\n const nonBlank = bodyLines.filter((l) => (lines[l] ?? '').trim() !== '');\n if (nonBlank.length === 0) continue;\n const base = Math.min(...nonBlank.map((l) => leading(lines[l] ?? '')));\n for (const l of bodyLines) {\n const raw = lines[l] ?? '';\n if (raw.trim() === '') {\n rw.set(l, '');\n continue;\n }\n rw.set(l, ' '.repeat(block.indent + 2 + Math.max(0, leading(raw) - base)) + raw.trimStart());\n }\n }\n }\n return rw;\n}\n\n/** Replace every inline `$SWITCH ON $x ( … )` with its default (`_`/ELSE) fragment, else the first arm — a\n * mid-sentence switch has no room to spell out all branches, so the state-free render picks the fallback.\n * Malformed → verbatim (the checker flagged it). Pure. */\nexport function expandInlineToProse(text: string): string {\n return text.replace(INLINE_SWITCH, (whole, _v: string, body: string) => {\n const { cases, error } = parseInlineCases(body);\n if (error !== null) return whole;\n const arm = cases.find((c) => c.isDefault) ?? cases[0];\n return arm ? arm.frag : '';\n });\n}\n","// ── type-system.ts · SSOT: the TypeGlish TYPE SYSTEM ──────────────────────────────────────────────\n// THE single source of truth for TypeGlish's types — the ONE grammar every machine-plane domain reads:\n// `$TOOL` params, `$REQUIRE variable` domains, `$CONFIG` params. Owns the base-type atoms (PRIM_TYPES),\n// the composite + refinement grammar, and the `TypeExpr` model with its parse / render / validate.\n//\n// SCOPE + BOUNDARY: this file owns the type ATOMS (base types) and the REFINEMENT operators; the type\n// QUANTIFIER keyword vocabulary (`one of` / `any of` / `list of` / `optional` / `default to`) lives in\n// the lexicon (invariant #1 — the operator-vocabulary SSOT), which this file consumes. THE RULE: never\n// hardcode a base type, a refinement operator, or a type spelling anywhere else — import from here.\n// Adding or changing a type means editing THIS file. Locked by `type-system.test.ts`.\n//\n// base := string | number | integer | boolean a primitive, optionally REFINED:\n// | number between 0 and 2 · at least N · at most N a numeric range\n// | string up to N characters · matching /re/ a length bound or a pattern\n// | list of strings|numbers|integers|booleans an open array (plural required)\n// | one of a, b, c a closed set — pick EXACTLY ONE (enum)\n// | any of a, b, c a closed set — pick ONE OR MORE (array of enum)\n//\n// One canonical form per concept. The code-era forms are recognized ONLY to compose migration\n// rewrites: `a | b` pipes, `string[]` arrays, and the prim synonyms (`bool`, `int`, `text`) each\n// yield a { ok:false } with the exact English replacement, never a silent acceptance — and never a\n// silent demotion to prose: when a value LOOKS type-intended (`typeIntended`), a failed parse is a\n// compile error with evidence, because \"list of caveats\" absorbing into a description would hide a\n// broken schema.\n//\n// Callers wrap this base with their own affordances (tool params add `optional` and `default to`;\n// variable domains are bare). Pure — no diagnostics types, no editor.\n\nexport type PrimType = 'string' | 'number' | 'integer' | 'boolean';\n\n/** A constraint that NARROWS a primitive: a numeric range (min/max), a character-length range (minLen/maxLen),\n * or a regex pattern. Written in English — `number between 0 and 2`, `string up to 200 characters`,\n * `string matching /^[a-z]+$/`. min/max apply to number|integer; minLen/maxLen + pattern apply to string. */\nexport interface Refinement {\n min?: number;\n max?: number;\n minLen?: number;\n maxLen?: number;\n pattern?: string;\n}\n\nexport type TypeExpr =\n | { kind: 'prim'; prim: PrimType; refine?: Refinement }\n | { kind: 'list'; prim: PrimType }\n | { kind: 'oneOf'; members: string[] }\n | { kind: 'anyOf'; members: string[] };\n\n/** ok:false carries the human reason and, when deterministic, the canonical rewrite of the head. */\nexport type TypeExprParse = { ok: true; expr: TypeExpr } | { ok: false; reason: string; rewrite?: string };\n\nexport const PRIM_TYPES: ReadonlySet<string> = new Set(['string', 'number', 'integer', 'boolean']);\nexport const PLURAL_PRIMS: Record<string, PrimType> = { strings: 'string', numbers: 'number', integers: 'integer', booleans: 'boolean' };\nconst PRIM_SYNONYMS: Record<string, PrimType> = { bool: 'boolean', int: 'integer', text: 'string' };\n/** A set member is one bare name — no spaces, so the comma list stays unambiguous. */\nconst MEMBER_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;\nconst QUANT_RE = /^(one|any)\\s+of\\s+(.+)$/i;\nconst LIST_RE = /^list\\s+of\\s+(\\S+)$/i;\n\n/** Split a `one of` / `any of` member list. Returns the members or a reason. */\nfunction parseMembers(quant: string, tail: string): { members: string[] } | { reason: string; rewrite?: string } {\n const members = tail.split(',').map((m) => m.trim()).filter((m) => m !== '');\n if (members.length < 2) return { reason: `\"${quant} of\" declares a closed set — it needs at least two comma-separated members.` };\n const bad = members.find((m) => !MEMBER_RE.test(m));\n if (bad !== undefined) return { reason: `\"${bad}\" is not a valid set member — members are bare names (letters, digits, _ or -); the description sits after a \":\".` };\n const dup = members.find((m, i) => members.findIndex((x) => x.toLowerCase() === m.toLowerCase()) !== i);\n if (dup !== undefined) return { reason: `\"${dup}\" is listed twice in the ${quant} of set.` };\n return { members };\n}\n\n/** Is this text INTENDED as a type expression? Decides error-vs-prose when the parse fails: a\n * type-intended head that doesn't parse is a compile error; anything else is ordinary prose. */\nexport function typeIntended(text: string): boolean {\n const t = text.trim();\n if (QUANT_RE.test(t) || /^list\\s+of\\b/i.test(t) || /^optional\\b/i.test(t)) return true;\n const first = (t.split(/[\\s,]/, 1)[0] ?? '').toLowerCase();\n if (PRIM_TYPES.has(first) || first in PRIM_SYNONYMS) return true;\n // A bare comma list of names is a closed set that forgot its quantifier.\n const segs = t.split(',').map((s) => s.trim());\n return segs.length >= 2 && segs.every((s) => MEMBER_RE.test(s));\n}\n\n// The REFINEMENT operators — the SSOT catalog for the constraints a primitive can carry (`number between 0 and\n// 2`, `string up to N characters`, `matching /re/`). REFINE_HEAD derives its recognizer from this list,\n// semantic-tokens.ts colours it, and the docs enumerate it — one source, so a new refinement is added HERE only.\n// Uppercase is the canonical display form (matched case-insensitively, like the lexicon's keyword catalogs).\nexport const REFINEMENT_KEYWORDS = ['BETWEEN', 'AT LEAST', 'AT MOST', 'UP TO', 'MATCHING'] as const;\nconst REFINE_HEAD = new RegExp(`^(${REFINEMENT_KEYWORDS.map((k) => k.toLowerCase().replace(/ /g, '\\\\s+')).join('|')})\\\\b`, 'i');\nconst NUM = String.raw`(-?\\d+(?:\\.\\d+)?)`;\n\n/** Parse the constraint TAIL after a primitive (`between 0 and 2`, `up to 200 characters`, `matching /re/`).\n * null → the tail isn't a constraint attempt (so the head is a bare prim and the tail is prose); {reason} → a\n * genuine attempt that's malformed or misapplied (boolean can't be ranged, a length needs `characters`, a\n * numeric range can't apply to string); {refine} → the parsed constraint. min/max ↔ number|integer, minLen/\n * maxLen ↔ string length, pattern ↔ string regex. */\nfunction parseRefinement(prim: PrimType, tail: string): { refine: Refinement } | { reason: string } | null {\n const raw = tail.trim();\n if (!REFINE_HEAD.test(raw)) return null;\n if (prim === 'boolean') return { reason: `boolean takes no constraint — drop \"${raw}\".` };\n const mm = raw.match(/^matching\\s+\\/(.+)\\/$/i);\n if (mm) {\n if (prim !== 'string') return { reason: `\"matching\" applies to string, not ${prim}.` };\n try {\n new RegExp(mm[1]!);\n } catch {\n return { reason: `\"/${mm[1]}/\" is not a valid regular expression.` };\n }\n return { refine: { pattern: mm[1]! } };\n }\n if (/^matching\\b/i.test(raw)) return { reason: `\"matching\" takes a /regex/ — e.g. matching /^[a-z]+$/.` };\n const isLen = /\\bcharacters?\\b/i.test(raw);\n if (isLen && prim !== 'string') return { reason: `a character-length constraint applies to string, not ${prim}.` };\n if (!isLen && prim === 'string') return { reason: `a numeric range applies to number|integer; for string, add \"characters\" or use a pattern.` };\n const body = raw.replace(/\\s+characters?\\s*$/i, '').trim();\n let m: RegExpMatchArray | null;\n let bounds: { min?: number; max?: number } | null = null;\n if ((m = body.match(new RegExp(`^between\\\\s+${NUM}\\\\s+and\\\\s+${NUM}$`, 'i')))) {\n const lo = Number(m[1]);\n const hi = Number(m[2]);\n if (lo > hi) return { reason: `the lower bound (${lo}) is above the upper (${hi}).` };\n bounds = { min: lo, max: hi };\n } else if ((m = body.match(new RegExp(`^at\\\\s+least\\\\s+${NUM}$`, 'i')))) bounds = { min: Number(m[1]) };\n else if ((m = body.match(new RegExp(`^at\\\\s+most\\\\s+${NUM}$`, 'i')))) bounds = { max: Number(m[1]) };\n else if ((m = body.match(new RegExp(`^up\\\\s+to\\\\s+${NUM}$`, 'i')))) bounds = { max: Number(m[1]) };\n if (!bounds) return { reason: `\"${raw}\" isn't a recognized ${prim} constraint — try \"between A and B\", \"at least N\", \"at most N\"${prim === 'string' ? ', \"up to N characters\"' : ''}.` };\n const key = isLen ? (['minLen', 'maxLen'] as const) : (['min', 'max'] as const);\n const refine: Refinement = {};\n if (bounds.min !== undefined) refine[key[0]] = bounds.min;\n if (bounds.max !== undefined) refine[key[1]] = bounds.max;\n return { refine };\n}\n\n/** Parse one base type expression. Returns null when the text isn't type-shaped at all (prose). */\nexport function parseTypeExpr(text: string): TypeExprParse | null {\n const t = text.trim();\n if (t === '') return null;\n\n const q = t.match(QUANT_RE);\n if (q) {\n const quant = (q[1] ?? 'one').toLowerCase();\n const r = parseMembers(quant, q[2] ?? '');\n if ('reason' in r) return { ok: false, ...r };\n return { ok: true, expr: quant === 'one' ? { kind: 'oneOf', members: r.members } : { kind: 'anyOf', members: r.members } };\n }\n\n const l = t.match(LIST_RE);\n if (l) {\n const unit = (l[1] ?? '').toLowerCase();\n const prim = PLURAL_PRIMS[unit];\n if (prim) return { ok: true, expr: { kind: 'list', prim } };\n if (PRIM_TYPES.has(unit)) return { ok: false, reason: `\"list of\" takes a plural base type.`, rewrite: `list of ${unit}s` };\n return { ok: false, reason: `\"list of ${l[1] ?? ''}\" is not a type — the base types are strings, numbers, integers, booleans.` };\n }\n if (/^list\\s+of\\b/i.test(t)) return { ok: false, reason: `\"list of\" takes exactly one plural base type: strings, numbers, integers, or booleans.` };\n\n const low = t.toLowerCase();\n const primHead = t.match(/^(string|number|integer|boolean)\\b\\s*(.*)$/i);\n if (primHead) {\n const prim = primHead[1]!.toLowerCase() as PrimType;\n const rest = (primHead[2] ?? '').trim();\n if (rest === '') return { ok: true, expr: { kind: 'prim', prim } };\n const ref = parseRefinement(prim, rest);\n if (ref === null) return null; // `number of retries` — not a refinement → prose (unchanged)\n if ('reason' in ref) return { ok: false, reason: ref.reason }; // a malformed / misapplied constraint\n return { ok: true, expr: { kind: 'prim', prim, refine: ref.refine } };\n }\n const syn = PRIM_SYNONYMS[low];\n if (syn) return { ok: false, reason: `\"${t}\" is not a canonical type — TypeGlish has one spelling per type.`, rewrite: syn };\n\n // A bare comma list of names: a closed set that doesn't say pick-one or pick-many.\n const segs = t.split(',').map((s) => s.trim());\n if (segs.length >= 2 && segs.every((s) => MEMBER_RE.test(s))) {\n return {\n ok: false,\n reason: `\"${t}\" doesn't say whether to pick one or many — write \"one of ${segs.join(', ')}\" (exactly one) or \"any of ${segs.join(', ')}\" (one or more).`,\n rewrite: `one of ${segs.join(', ')}`,\n };\n }\n\n return null;\n}\n\n/** Translate an OLD code-syntax type head into canonical English, for migration rewrites. Null when\n * the head is not an exact old type expression — prose never translates. */\nexport function translateLegacyTypeHead(head: string): string | null {\n const t = head.trim();\n const arr = t.match(/^(string|number|integer|boolean)\\[\\]$/);\n if (arr) return `list of ${arr[1]}s`;\n const dflt = t.match(/^(string|number|integer|boolean)\\s*=\\s*(\\S.*?)$/);\n if (dflt) return `${dflt[1]} default to ${(dflt[2] ?? '').trim()}`;\n if (t.includes('|')) {\n const members = t.split('|').map((m) => m.trim()).filter((m) => m !== '');\n if (members.length >= 2) return `one of ${members.join(', ')}`;\n }\n const syn = PRIM_SYNONYMS[t.toLowerCase()];\n if (syn) return syn;\n return null;\n}\n\n/** Render a refinement back to its canonical English (the spelling `at most` / `up to N characters` messages\n * quote; a max-only numeric bound is `at most`, a max-only length is `up to … characters`). */\nfunction renderRefine(r: Refinement): string {\n if (r.pattern !== undefined) return `matching /${r.pattern}/`;\n if (r.minLen !== undefined && r.maxLen !== undefined) return `between ${r.minLen} and ${r.maxLen} characters`;\n if (r.minLen !== undefined) return `at least ${r.minLen} characters`;\n if (r.maxLen !== undefined) return `up to ${r.maxLen} characters`;\n if (r.min !== undefined && r.max !== undefined) return `between ${r.min} and ${r.max}`;\n if (r.min !== undefined) return `at least ${r.min}`;\n if (r.max !== undefined) return `at most ${r.max}`;\n return '';\n}\n\n/** Render a TypeExpr back to its canonical English — the single spelling messages quote. */\nexport function renderTypeExpr(e: TypeExpr): string {\n switch (e.kind) {\n case 'prim':\n return e.refine ? `${e.prim} ${renderRefine(e.refine)}` : e.prim;\n case 'list':\n return `list of ${e.prim}s`;\n case 'oneOf':\n return `one of ${e.members.join(', ')}`;\n case 'anyOf':\n return `any of ${e.members.join(', ')}`;\n }\n}\n","// ── Tool + service definitions — parse $TOOL / $SERVICE blocks into schemas ──────────────────────────\n// A definition is CODE, not prose: the model never reads it — only the compiled schema, and, inside it, the\n// `description:` string (that one value routes the model, so it alone is treated as English and checked like\n// prose). Everything else is YAML-shaped key:value pairs, chosen for exactly one quality: anyone can read and\n// write them.\n//\n// $SERVICE acme\n// - base:: https://api.acme.com\n// - headers::\n// - Authorization:: Bearer @{env.ACME_API_KEY}\n//\n// $TOOL book_appointment\n// - description:: Books an appointment at the customer's nearest franchise.\n// - input::\n// - zip:: the customer's 5-digit zip code.\n// - team:: one of finance, technical, sales: the destination team.\n// - request:: POST acme /appointments\n//\n// A block is its INDENTATION (dedent ends it — no closing tag). A $SERVICE is the shared external backend —\n// defined ONCE, referenced by many tools' `request::` rows (the OpenAPI servers / Terraform provider move), so\n// ten tools against one API never repeat the base URL or the auth header. A param row is `- name:: value.`\n// where the value is either a description alone (string + required inferred) or `type expression: description`\n// — the single `:` PAIRS the machine facet with the human facet, while `::` DEFINES the name (see SPEC: one\n// colon pairs, two colons define). The type expression is English: `optional` marks optionality, `one of a, b`\n// is a closed pick-one set, `any of a, b` a pick-many set, `list of strings` an open array, `default to 10` a\n// default (which implies optional). Every future capability is just another key (`output::`, `timeout::` …).\n//\n// The result compiles OUT of the prompt: render() strips the blocks, and compile() carries the parsed tools\n// on its `agent` output — bindings RESOLVED (absolute URL + merged headers), ready for the runner and for\n// toolInputSchema() to convert to the Anthropic/OpenAI tool shape.\nimport { SERVICE_DECL_RE, TOOL_DECL_RE, stripPunct } from './clause';\nimport type { Severity } from './diagnostics';\nimport { parseTypeExpr, translateLegacyTypeHead, typeIntended } from './type-system';\nimport type { TypeExpr } from './type-system';\n\nexport type ParamType = 'string' | 'number' | 'integer' | 'boolean';\n\nexport interface ToolParam {\n name: string;\n type: ParamType;\n /** A `list of <type>s` open array, or — with `enum` set — an `any of a, b` pick-many set. */\n array?: boolean;\n required: boolean;\n description?: string;\n /** The closed set: `one of a, b` (pick one) or, with `array`, `any of a, b` (pick many). */\n enum?: string[];\n /** `default to <value>`. A param with a default is optional by definition. */\n default?: string | number | boolean;\n}\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\n/** How the tool EXECUTES — the declarative HTTP binding. Authored as `request: METHOD https://…` or\n * `request: METHOD <service> /path`; either way it is stored RESOLVED (absolute URL, service headers merged\n * in), so the runner never needs the service table. `@{param}` pointers interpolate from the model's\n * input; `@{env.NAME}` from the runner's environment (secrets never live in the file). A tool WITHOUT a\n * binding is still legal — schema-only, executed by the host runtime (the $IMPORT-style case). */\nexport interface ToolBinding {\n method: HttpMethod;\n url: string;\n headers: { name: string; value: string }[];\n /** The $SERVICE this binding resolved through, when it used the `METHOD service /path` form. */\n service?: string;\n line: number;\n}\n\nexport interface ToolDef {\n name: string;\n description: string;\n params: ToolParam[];\n binding?: ToolBinding;\n /** The 0-based line of the block's `$TOOL name` opener. */\n line: number;\n}\n\n/** A shared external backend: `base:` + `headers:`, referenced by tool bindings. */\nexport interface ServiceDef {\n name: string;\n base: string;\n headers: { name: string; value: string }[];\n line: number;\n}\n\nexport interface ToolConflict {\n lines: number[];\n message: string;\n code: string; // → `structure/<code>` (definitions are structural integrity)\n severity: Severity;\n}\n\nconst TOOL_KEYS = new Set(['description', 'input', 'request', 'headers']);\nconst SERVICE_KEYS = new Set(['base', 'headers']);\n// Tool fields are BULLET rows — `- key:: value`, one way, no alternatives. The `::` is TG's ONE\n// definition marker (`term:: definition` in def lists); the REQUIRED `- ` is the structure itself:\n// bullets and sub-bullets ARE the JSON nesting of the compiled schema (a field is a bullet, its\n// params are its sub-bullets), so a field without a bullet is a compile finding, not a style choice.\n// A bare `key:: value` and an old single-colon `key: value` each get a targeted migration error\n// naming the exact rewrite (see the not-a-field branches).\nconst FIELD_RE = /^(\\s+)-\\s+([a-z][a-z0-9_-]*)::\\s*(.*)$/; // an indented `- key:: value`\nconst PARAM_RE = /^-\\s+([a-z][a-z0-9_]*)(\\?)?::\\s*(.*)$/; // an input child: `- name?:: value`\nconst HEADER_RE = /^-\\s+([A-Za-z0-9-]+)::\\s*(\\S.*?)\\s*$/; // a headers child: `- Header-Name:: value`\n// The OLD shapes — recognized ONLY to say exactly what to change.\nconst LEGACY_FIELD_RE = /^\\s*(?:[-*+]\\s+)?([A-Za-z][\\w-]*)(\\??):(?!:)\\s*(.*)$/; // single colon\nconst BARE_FIELD_RE = /^\\s*([A-Za-z][\\w-]*)(\\??)::\\s*(.*)$/; // `::` but no bullet\n// The request value — METHOD exact-uppercase, then EITHER an absolute URL or `<service> /path`.\nconst BINDING_ABS_RE = /^(GET|POST|PUT|PATCH|DELETE)\\s+(https?:\\/\\/\\S+)$/;\nconst BINDING_SVC_RE = /^(GET|POST|PUT|PATCH|DELETE)\\s+([a-z][a-z0-9_]*)\\s+(\\/\\S*)$/;\n// ── The param value — `[type expression[: description]]` — the type grammar is SHARED ──\n// The base type grammar (one of / any of / list of / primitives) lives in type-system.ts — ONE grammar\n// for every machine-plane domain ($TOOL params, $REQUIRE variable domains). Params add two local\n// affordances around the base: an `optional` prefix and a `default to <literal>` tail (a default\n// implies optional). The single `:` PAIRS the type facet with the human facet; a value with no\n// parseable type is all description. Old forms (`a | b`, `string[]`, `= 10`, `name?::`, comma as\n// the separator) are recognized ONLY to hand back the complete rewritten row.\nconst OPTIONAL_LEAD_RE = /^optional\\b\\s*/i;\nconst DEFAULT_TAIL_RE = /\\s+default\\s+to\\s+(\\S.*)$/i; // canonical `default to <literal>`\nconst BAD_DEFAULT_TAIL_RE = /\\s+(?:=\\s*(\\S.*)|defaults\\s+to\\s+(\\S.*)|default\\s+(?!to\\b)(\\S.*))$/i; // `= 10` / `defaults to 10` / `default 10`\n// A binding placeholder is a POINTER — `@{order_id}` reads the tool's own input, `@{env.NAME}` the runner's\n// environment. The one reference family everywhere: a placeholder points at a declared symbol exactly like\n// a pointer in prose does, and it is checked the same way (dangling-binding-param).\nexport const PLACEHOLDER_RE = /@\\{([A-Za-z][A-Za-z0-9_.]*)\\}/g;\n// The PRE-POINTER spelling — bare `{x}` — recognized ONLY to compose the migration rewrite.\nconst LEGACY_PLACEHOLDER_RE = /(?<!@)\\{([A-Za-z][A-Za-z0-9_.]*)\\}/g;\n// Credential shapes that must never be literals in a committed file — use @{env.NAME}. Tight, so plain prose\n// never trips it: known token prefixes, or a Bearer value that is one long opaque token.\nconst SECRET_RE = /\\b(?:sk-[A-Za-z0-9_-]{10,}|ghp_[A-Za-z0-9]{20,}|xoxb-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16})\\b|^Bearer\\s+[A-Za-z0-9._~+/=-]{20,}$/;\n\ninterface Block {\n name: string;\n line: number;\n body: { raw: string; line: number }[];\n}\n\n/** Scan `$KIND name` blocks: the opener + every following indented line, until the first non-blank line at\n * column 0. Fence-aware, mirroring toolBlockMask exactly. */\nfunction scanBlocks(rawLines: string[], decl: RegExp): Block[] {\n const blocks: Block[] = [];\n let inFence = false;\n for (let i = 0; i < rawLines.length; i += 1) {\n const trimmed = (rawLines[i] ?? '').trim();\n if (trimmed.startsWith('```') || trimmed.startsWith('~~~')) {\n inFence = !inFence;\n continue;\n }\n const m = inFence ? null : (rawLines[i] ?? '').match(decl);\n if (!m) continue;\n // Body scoped RELATIVE to the header (mirroring toolBlockMask): deeper lines belong, the first\n // non-blank at or above the header's column ends the block.\n const headerIndent = ((rawLines[i] ?? '').match(/^[ \\t]*/) ?? [''])[0].length;\n const body: { raw: string; line: number }[] = [];\n for (let j = i + 1; j < rawLines.length; j += 1) {\n const line = rawLines[j] ?? '';\n if (line.trim() === '') continue;\n if (((line.match(/^[ \\t]*/) ?? [''])[0].length) <= headerIndent) break;\n body.push({ raw: line, line: j });\n }\n blocks.push({ name: (m[1] ?? '').toLowerCase(), line: i, body });\n if (body.length > 0) i = body[body.length - 1]?.line ?? i;\n }\n return blocks;\n}\n\n/** Compose the canonical row a message tells the reader to write. trimEnd is load-bearing: an\n * empty value must quote \"- input::\", never \"- input:: \" — a pasted trailing space is itself a\n * compile error, and quoted rewrites must always be valid TG to paste. The same paste-safety\n * demands a terminator: every tool row is a statement, so an unterminated rewrite would compile\n * into a missing-period error the moment it lands. An empty value ends on the marker's ':'\n * (a bare lead terminates on its own colon); anything else gets its '.' if it lacks one.\n * A `?` sigil never survives into a rewrite — optionality is written as the `optional` prefix. */\nfunction rewriteRow(key: string, opt: string, value: string): string {\n const translated = translateLegacyValue(value.trim()) ?? value.trim();\n const v = opt === '?' && translated !== '' ? `optional ${translated}` : opt === '?' ? 'optional' : translated;\n const row = `- ${key}:: ${v}`.trimEnd();\n return /[.!?:][\"')\\]]*$/.test(row) ? row : `${row}.`;\n}\n\n/** Translate an OLD param value (pipes, `[]`, `= 10`, prim synonyms, comma separator) into the\n * canonical English form, for migration rewrites. Returns null when the value has no old type\n * head — plain prose passes through untouched, so a description like \"Replace a line, verbatim.\"\n * is never mangled. Only an EXACT old type expression before the first comma fires. */\nfunction translateLegacyValue(value: string): string | null {\n const comma = value.indexOf(',');\n const head = stripPunct(comma >= 0 ? value.slice(0, comma) : value);\n const desc = comma >= 0 ? value.slice(comma + 1).trim() : '';\n let newHead = translateLegacyTypeHead(head);\n // A NEW-grammar type before a comma is the comma-separator migration (`string, the terms`).\n if (newHead === null && desc !== '' && parseTypeExpr(head)?.ok) newHead = head;\n if (newHead === null) return null;\n return desc !== '' ? `${newHead}: ${desc}` : newHead;\n}\n\n/** Recompose a canonical param VALUE from its facets — the string a migration message quotes. */\nfunction composeValue(optional: boolean, head: string, dflt: string | null, desc: string): string {\n const type = `${optional ? 'optional ' : ''}${head}${dflt !== null && dflt !== '' ? ` default to ${dflt}` : ''}`.trim();\n return desc !== '' ? `${type}: ${desc}` : type;\n}\n\n/** The base TypeExpr → the ToolParam facets, with the default coerced and validated. */\nfunction buildParam(expr: TypeExpr, dfltRaw: string | null, desc: string): Omit<ToolParam, 'name' | 'required'> | { reason: string } {\n const base: Omit<ToolParam, 'name' | 'required'> =\n expr.kind === 'prim'\n ? { type: expr.prim }\n : expr.kind === 'list'\n ? { type: expr.prim, array: true }\n : expr.kind === 'oneOf'\n ? { type: 'string', enum: expr.members }\n : { type: 'string', array: true, enum: expr.members };\n if (dfltRaw !== null) {\n if (expr.kind === 'list' || expr.kind === 'anyOf') return { reason: `\"default to\" doesn't apply to a list — a default is one value.` };\n const raw = dfltRaw.trim().replace(/^[\"']|[\"']$/g, '');\n if (expr.kind === 'prim' && (expr.prim === 'number' || expr.prim === 'integer')) {\n const n = Number(raw);\n if (Number.isNaN(n)) return { reason: `\"default to ${raw}\" isn't a number — if a description follows the default, it sits after \":\", never a comma.` };\n base.default = n;\n } else if (expr.kind === 'prim' && expr.prim === 'boolean') {\n if (raw !== 'true' && raw !== 'false') return { reason: `\"default to ${raw}\" isn't a boolean — write true or false.` };\n base.default = raw === 'true';\n } else if (expr.kind === 'oneOf') {\n if (!expr.members.includes(raw)) return { reason: `\"default to ${raw}\" isn't a member of the set (${expr.members.join(', ')}).` };\n base.default = raw;\n } else {\n base.default = raw;\n }\n }\n if (desc !== '') base.description = desc;\n return base;\n}\n\n/** Field/param-shaped lines hiding where they are never read (or read WRONGLY) — the children of a\n * malformed field row, or param rows absorbed into description:: text. One compile round must name\n * the COMPLETE work list: an agent should never fix the parent only to discover the children on the\n * next round. `proseSafe` guards description text: there, only unambiguous shapes flag (`x::`,\n * `- x::`, `x?:`) — a prose line like \"Note: keep it short.\" is description content, not a param. */\nfunction shapedChildren(\n children: { text: string; line: number }[],\n proseSafe: boolean,\n): { line: number; rewrite: string }[] {\n const out: { line: number; rewrite: string }[] = [];\n for (const c of children) {\n const bare = c.text.match(BARE_FIELD_RE);\n const legacy = c.text.match(LEGACY_FIELD_RE);\n if (bare) out.push({ line: c.line, rewrite: rewriteRow(bare[1] ?? '', bare[2] ?? '', bare[3] ?? '') });\n else if (legacy && (!proseSafe || legacy[2] === '?')) out.push({ line: c.line, rewrite: rewriteRow(legacy[1] ?? '', legacy[2] ?? '', legacy[3] ?? '') });\n }\n return out;\n}\n\n/** Fields of a block body: `- key:: value` lines at the body's own indent open a field; DEEPER lines\n * are its children. A same-indent line that ISN'T a valid field row is a MALFORMED FIELD (key: ''),\n * never a child — absorbing it would silently corrupt the previous field (a broken `input:` used to\n * vanish into the description's text, taking its params with it, with no error at all). */\nfunction scanFields(block: Block): { key: string; value: string; line: number; children: { text: string; line: number }[] }[] {\n const bodyIndent = (block.body[0]?.raw.match(/^[ \\t]+/)?.[0] ?? '').length;\n const fields: { key: string; value: string; line: number; children: { text: string; line: number }[] }[] = [];\n for (const b of block.body) {\n if (b.raw.trim().startsWith('//')) continue;\n const indent = (b.raw.match(/^[ \\t]+/)?.[0] ?? '').length;\n if (indent === bodyIndent) {\n const f = b.raw.match(FIELD_RE);\n if (f) fields.push({ key: (f[2] ?? '').toLowerCase(), value: (f[3] ?? '').trim(), line: b.line, children: [] });\n else fields.push({ key: '', value: b.raw.trim(), line: b.line, children: [] }); // malformed field row — flagged by the caller\n } else if (fields.length > 0) {\n fields[fields.length - 1]?.children.push({ text: b.raw.trim(), line: b.line });\n } else {\n fields.push({ key: '', value: b.raw.trim(), line: b.line, children: [] }); // stray pre-key line\n }\n }\n return fields;\n}\n\n/** Parse one param VALUE — `[optional] base [default to v][: description]`, or a description alone.\n *\n * The single `:` PAIRS the type facet with the human facet. When no colon splits the value, the\n * whole value is either one type expression or all prose — and a value that LOOKS type-intended\n * but doesn't parse is an ERROR, never a silent demotion to prose (a broken schema must not hide\n * inside a description). Old code forms (pipes, `[]`, `= 10`, comma separator, prim synonyms)\n * return ok:false with the complete canonical value.\n *\n * THE TERMINATOR NEVER ENTERS A TYPE POSITION — the same JS-semicolon rule declarations follow\n * (`Tone IS warm.` binds `warm`): every row is a statement, so `- team:: one of finance, sales.`\n * must terminate, and stripPunct sheds that terminator before the type read — the last member is\n * `sales`, never `sales.`. PROSE positions (descriptions) keep their periods. */\ntype ParamParse = { ok: true; param: Omit<ToolParam, 'name' | 'required'>; optional: boolean } | { ok: false; reason: string; value?: string };\nfunction parseParamValue(value: string): ParamParse {\n const v = value.trim();\n if (v === '') return { ok: true, param: { type: 'string' }, optional: false };\n\n // OLD forms first — they get the complete rewritten value, one compile round.\n const legacy = translateLegacyValue(v);\n if (legacy !== null) {\n const reason = v.includes('|')\n ? `Closed sets are English — \"one of a, b\" (pick one) or \"any of a, b\" (pick many) — never \"|\" pipes.`\n : /\\[\\]/.test(v)\n ? `Arrays are English — \"list of strings\" (numbers, integers, booleans) — never \"[]\".`\n : /=/.test(v)\n ? `Defaults are English — \"default to <value>\" — never \"=\".`\n : /^(bool|int|text)\\b/i.test(v)\n ? `TypeGlish has one spelling per type — string, number, integer, boolean.`\n : `The type and the description are separated by \":\" — commas belong to lists and prose.`;\n return { ok: false, reason, value: legacy };\n }\n\n // Facet split at the FIRST ':' — the pairing colon between the machine facet and the human facet.\n const ci = v.indexOf(':');\n const rawHead = ci >= 0 ? v.slice(0, ci) : v;\n const desc = ci >= 0 ? v.slice(ci + 1).trim() : '';\n\n // The row terminator rides the LAST facet: shed it from the head only when the head IS the value.\n let head = ci >= 0 ? rawHead.trim() : stripPunct(rawHead);\n const optional = OPTIONAL_LEAD_RE.test(head);\n if (optional) head = head.replace(OPTIONAL_LEAD_RE, '').trim();\n let dflt: string | null = null;\n const dm = head.match(DEFAULT_TAIL_RE);\n if (dm) {\n dflt = (dm[1] ?? '').trim();\n head = head.slice(0, dm.index).trim();\n } else {\n const bad = head.match(BAD_DEFAULT_TAIL_RE);\n if (bad) {\n const dv = (bad[1] ?? bad[2] ?? bad[3] ?? '').trim();\n return { ok: false, reason: `Defaults are written \"default to ${dv}\" — one canonical form, like \"one of\" and \"at least\".`, value: composeValue(optional, head.slice(0, bad.index).trim(), dv, desc) };\n }\n }\n\n // 1) The head parses as a type expression → a typed param (+ the paired description).\n const parsed = head === '' ? null : parseTypeExpr(head);\n if (parsed?.ok) {\n const built = buildParam(parsed.expr, dflt, desc);\n if ('reason' in built) return { ok: false, reason: built.reason };\n return { ok: true, param: built, optional };\n }\n if (parsed && !parsed.ok) {\n return { ok: false, reason: parsed.reason, ...(parsed.rewrite !== undefined ? { value: composeValue(optional, parsed.rewrite, dflt, desc) } : {}) };\n }\n\n // 2) A bare `optional` (or a lone default) — an optional string.\n if (head === '' && (optional || dflt !== null)) {\n const built = buildParam({ kind: 'prim', prim: 'string' }, dflt, desc);\n if ('reason' in built) return { ok: false, reason: built.reason };\n return { ok: true, param: built, optional: true };\n }\n\n // 3) Type-intended but unparseable → an ERROR, never a silent demotion to prose.\n if ((optional && head !== '') || dflt !== null || typeIntended(head)) {\n return {\n ok: false,\n reason: `\"${head}\" is not a type expression. The forms: string, number, integer, boolean, \"list of strings\", \"one of a, b\", \"any of a, b\", \"optional <type>\", \"<type> default to <value>\". If this is prose, reword it so it doesn't open with a type keyword.`,\n };\n }\n\n // 4) Prose — the WHOLE value is the description (its colons and commas are its own).\n return { ok: true, param: { type: 'string', description: v }, optional: false };\n}\n\n/** Validate the pointers in a binding-side text: each must be a declared param or @{env.NAME}. A bare\n * `{x}` placeholder is the pre-pointer spelling — a migration error quoting the complete rewritten value. */\nfunction checkPlaceholders(\n text: string,\n line: number,\n allowedParams: Set<string> | null, // null = env-only (service values are shared — no per-tool params exist)\n where: string,\n flag: (line: number, message: string, code: string, severity: Severity) => void,\n): void {\n PLACEHOLDER_RE.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = PLACEHOLDER_RE.exec(text)) !== null) {\n const key = (m[1] ?? '').toLowerCase();\n if (key.startsWith('env.')) continue;\n if (allowedParams?.has(key)) continue;\n flag(\n line,\n allowedParams === null\n ? `@{${m[1]}} in ${where} — a $SERVICE is shared by many tools, so its values may only use @{env.NAME}.`\n : `@{${m[1]}} in ${where} isn't a declared parameter — declare it under input:, or use @{env.NAME} for environment values.`,\n 'dangling-binding-param',\n 'error',\n );\n }\n LEGACY_PLACEHOLDER_RE.lastIndex = 0;\n while ((m = LEGACY_PLACEHOLDER_RE.exec(text)) !== null) {\n flag(\n line,\n `A binding placeholder is a pointer — \\`@{${m[1]}}\\`, never \\`{${m[1]}}\\`. Rewrite the value as: \"${text.replace(LEGACY_PLACEHOLDER_RE, '@{$1}').trim()}\".`,\n 'malformed-binding',\n 'error',\n );\n break; // ONE rewrite covers the whole value — per-placeholder repeats would just echo it\n }\n}\n\n/** Parse every $SERVICE block. Pure. */\nexport function parseServices(rawLines: string[]): { services: ServiceDef[]; conflicts: ToolConflict[] } {\n const services: ServiceDef[] = [];\n const conflicts: ToolConflict[] = [];\n const flag = (line: number, message: string, code: string, severity: Severity): void => {\n conflicts.push({ lines: [line], message, code, severity });\n };\n\n for (const block of scanBlocks(rawLines, SERVICE_DECL_RE)) {\n if (block.body.length === 0) {\n flag(block.line, `$SERVICE ${block.name} has no body — indent its fields (base::, headers::) beneath it.`, 'empty-service', 'error');\n continue;\n }\n const seen = new Set<string>();\n let base = '';\n const headers: { name: string; value: string; line: number }[] = [];\n for (const f of scanFields(block)) {\n if (f.key === '') {\n {\n const legacy = f.value.match(LEGACY_FIELD_RE);\n const bare = f.value.match(BARE_FIELD_RE);\n flag(\n f.line,\n legacy\n ? `Tool fields use the definition marker \"::\" with a leading bullet, never a single colon. Replace this line with: \"${rewriteRow(legacy[1] ?? '', legacy[2] ?? '', legacy[3] ?? '')}\".`\n : bare\n ? `Every tool field is a bullet row (the bullets are the compiled schema's nesting). Replace this line with: \"${rewriteRow(bare[1] ?? '', bare[2] ?? '', bare[3] ?? '')}\".`\n : `This line isn't a field of $SERVICE ${block.name}. A field is \"- key:: value\" (keys: base, headers). Found: \"${f.value.slice(0, 60)}\".`,\n 'malformed-service',\n 'error',\n );\n for (const kid of shapedChildren(f.children, false)) {\n flag(kid.line, `Unreachable — it sits under the malformed field above. After fixing that line, write this one as: \"${kid.rewrite}\".`, 'malformed-service', 'error');\n }\n }\n continue;\n }\n if (seen.has(f.key)) {\n flag(f.line, `Duplicate \"${f.key}::\" in $SERVICE ${block.name} — one per service.`, 'duplicate-key', 'error');\n continue;\n }\n seen.add(f.key);\n if (!SERVICE_KEYS.has(f.key)) {\n flag(f.line, `Unknown key \"${f.key}::\" in $SERVICE ${block.name} — known keys: base, headers.`, 'unknown-service-key', 'warn');\n } else if (f.key === 'base') {\n // A URL is a TYPE position: the row's terminator sheds before the check (the semicolon rule).\n const baseValue = stripPunct(f.value);\n if (/^https?:\\/\\/\\S+$/.test(baseValue)) {\n base = baseValue.replace(/\\/+$/, '');\n checkPlaceholders(base, f.line, null, `$SERVICE ${block.name}'s base`, flag);\n } else {\n flag(f.line, `Malformed base in $SERVICE ${block.name} — the value must be an absolute URL. Replace this line with the form: \"- base:: https://api.example.com\".`, 'malformed-service', 'error');\n }\n } else {\n for (const c of f.children) {\n const hm = c.text.match(HEADER_RE);\n if (!hm) {\n flag(c.line, `This isn't a header. A header is \"- Header-Name:: value\". Found: \"${c.text.slice(0, 60)}\".`, 'malformed-header', 'error');\n continue;\n }\n headers.push({ name: hm[1] ?? '', value: stripPunct(hm[2] ?? ''), line: c.line });\n checkPlaceholders(hm[2] ?? '', c.line, null, `$SERVICE ${block.name}'s headers`, flag);\n if (!/\\{env\\./.test(hm[2] ?? '') && SECRET_RE.test(hm[2] ?? '')) {\n flag(c.line, `This looks like a credential literal — never put secrets in the file; use @{env.NAME} instead.`, 'secret-literal', 'warn');\n }\n }\n }\n }\n if (base === '') {\n flag(block.line, `$SERVICE ${block.name} has no base — add a base field beneath it, like: \"- base:: https://api.example.com\".`, 'service-no-base', 'error');\n continue;\n }\n services.push({ name: block.name, base, headers: headers.map((h) => ({ name: h.name, value: h.value })), line: block.line });\n }\n\n // Duplicate services — a reference to the name is ambiguous.\n const byName = new Map<string, ServiceDef[]>();\n for (const s of services) {\n const list = byName.get(s.name) ?? [];\n list.push(s);\n byName.set(s.name, list);\n }\n for (const [dup, list] of byName) {\n if (list.length > 1) conflicts.push({ lines: list.map((s) => s.line), message: `$SERVICE ${dup} is defined ${list.length} times.`, code: 'duplicate-service', severity: 'error' });\n }\n return { services, conflicts };\n}\n\n/** Parse every $TOOL block (resolving `request: METHOD service /path` through the $SERVICE table) and every\n * $SERVICE block. Indentation-scoped and fence-aware, mirroring toolBlockMask exactly, so what parses here is\n * precisely what render() strips and what the scopes exclude. Pure. */\nexport function parseTools(rawLines: string[]): { tools: ToolDef[]; services: ServiceDef[]; conflicts: ToolConflict[] } {\n const svc = parseServices(rawLines);\n const services = new Map(svc.services.map((s) => [s.name, s]));\n const usedServices = new Set<string>();\n const tools: ToolDef[] = [];\n const conflicts: ToolConflict[] = [...svc.conflicts];\n const flag = (line: number, message: string, code: string, severity: Severity): void => {\n conflicts.push({ lines: [line], message, code, severity });\n };\n\n for (const block of scanBlocks(rawLines, TOOL_DECL_RE)) {\n const name = block.name;\n if (block.body.length === 0) {\n flag(block.line, `$TOOL ${name} has no body — indent its fields (description::, input::, request::) beneath it.`, 'empty-tool', 'error');\n tools.push({ name, description: '', params: [], line: block.line });\n continue;\n }\n\n const seen = new Set<string>();\n const descParts: string[] = [];\n const params: ToolParam[] = [];\n let binding: ToolBinding | undefined;\n const headers: { name: string; value: string; line: number }[] = [];\n\n for (const f of scanFields(block)) {\n if (f.key === '') {\n {\n const legacy = f.value.match(LEGACY_FIELD_RE);\n const bare = f.value.match(BARE_FIELD_RE);\n flag(\n f.line,\n legacy\n ? `Tool fields use the definition marker \"::\" with a leading bullet, never a single colon. Replace this line with: \"${rewriteRow(legacy[1] ?? '', legacy[2] ?? '', legacy[3] ?? '')}\".`\n : bare\n ? `Every tool field is a bullet row (the bullets are the compiled schema's nesting). Replace this line with: \"${rewriteRow(bare[1] ?? '', bare[2] ?? '', bare[3] ?? '')}\".`\n : `This line isn't a field of $TOOL ${name}. A field is \"- key:: value\" (keys: description, input, request, headers). Found: \"${f.value.slice(0, 60)}\".`,\n 'malformed-tool',\n 'error',\n );\n for (const kid of shapedChildren(f.children, false)) {\n flag(kid.line, `Unreachable — it sits under the malformed field above. After fixing that line, write this one as: \"${kid.rewrite}\".`, 'malformed-param', 'error');\n }\n }\n continue;\n }\n if (seen.has(f.key)) {\n flag(f.line, `Duplicate \"${f.key}::\" in $TOOL ${name} — one per tool.`, 'duplicate-key', 'error');\n continue;\n }\n seen.add(f.key);\n if (!TOOL_KEYS.has(f.key)) {\n flag(f.line, `Unknown key \"${f.key}::\" in $TOOL ${name} — known keys: description, input, request, headers.`, 'unknown-tool-key', 'warn');\n } else if (f.key === 'description') {\n if (f.value !== '') descParts.push(f.value);\n // Deeper lines continue the text — but a PARAM-shaped line here would silently become\n // description prose (and its parameter would never exist). Flag it; absorb only real prose.\n const misplaced = new Set(shapedChildren(f.children, true).map((k) => k.line));\n for (const kid of shapedChildren(f.children, true)) {\n flag(kid.line, `This looks like a parameter, but it sits inside description:: text (deeper lines continue the description) — it would never reach the schema. Move it under \"- input::\" as: \"${kid.rewrite}\".`, 'misplaced-param', 'error');\n }\n for (const c of f.children) if (!misplaced.has(c.line)) descParts.push(c.text);\n } else if (f.key === 'input') {\n for (const c of f.children) {\n const pm = c.text.match(PARAM_RE);\n if (pm) {\n const pname = (pm[1] ?? '').toLowerCase();\n if (pm[2] === '?') {\n // The \"?\" sigil is code, not English — optionality is the `optional` prefix.\n flag(c.line, `Optional parameters are written with the \"optional\" prefix, never a \"?\" sigil. Replace this line with: \"${rewriteRow(pname, '?', pm[3] ?? '')}\".`, 'malformed-param', 'error');\n continue;\n }\n const parsed = parseParamValue(pm[3] ?? '');\n if (parsed.ok) {\n params.push({ name: pname, required: !parsed.optional && parsed.param.default === undefined, ...parsed.param });\n } else {\n flag(c.line, parsed.value !== undefined ? `${parsed.reason} Replace this line with: \"${rewriteRow(pname, '', parsed.value)}\".` : parsed.reason, 'malformed-param', 'error');\n }\n continue;\n }\n const legacy = c.text.match(LEGACY_FIELD_RE);\n const bare = c.text.match(BARE_FIELD_RE);\n flag(\n c.line,\n legacy\n ? `Parameters use the definition marker \"::\" with a leading bullet, never a single colon. Replace this line with: \"${rewriteRow(legacy[1] ?? '', legacy[2] ?? '', legacy[3] ?? '')}\".`\n : bare\n ? `Every parameter is a bullet row under input:: (a sub-bullet is the schema's nesting). Replace this line with: \"${rewriteRow(bare[1] ?? '', bare[2] ?? '', bare[3] ?? '')}\".`\n : `This isn't a parameter. A parameter is \"- name:: description.\" or \"- name:: type: description.\" — the type is English, like \"one of a, b\" or \"optional string\". Found: \"${c.text.slice(0, 60)}\".`,\n 'malformed-param',\n 'error',\n );\n }\n } else if (f.key === 'request') {\n // The binding is a TYPE position: shed the row's terminator before METHOD/url parse.\n const reqValue = stripPunct(f.value);\n const abs = reqValue.match(BINDING_ABS_RE);\n const via = reqValue.match(BINDING_SVC_RE);\n if (abs) {\n binding = { method: (abs[1] ?? 'GET') as HttpMethod, url: abs[2] ?? '', headers: [], line: f.line };\n } else if (via) {\n const svcName = (via[2] ?? '').toLowerCase();\n const service = services.get(svcName);\n if (!service) {\n flag(f.line, `Request references $SERVICE \"${svcName}\", which is not defined.`, 'dangling-service', 'error');\n } else {\n usedServices.add(svcName);\n binding = { method: (via[1] ?? 'GET') as HttpMethod, url: `${service.base}${via[3] ?? ''}`, headers: [], service: svcName, line: f.line };\n }\n } else {\n flag(f.line, `Malformed request in $TOOL ${name}. The value is \"METHOD url\": either absolute, like \"- request:: GET https://api.example.com/orders\", or through a $SERVICE, like \"- request:: POST acme /orders\" (acme names a $SERVICE). METHOD is uppercase: GET, POST, PUT, PATCH, DELETE.`, 'malformed-binding', 'error');\n }\n } else {\n for (const c of f.children) {\n const hm = c.text.match(HEADER_RE);\n if (hm) headers.push({ name: hm[1] ?? '', value: stripPunct(hm[2] ?? ''), line: c.line });\n else flag(c.line, `This isn't a header. A header is \"- Header-Name:: value\". Found: \"${c.text.slice(0, 60)}\".`, 'malformed-header', 'error');\n }\n }\n }\n\n // Duplicate params collapse the schema key — a real defect, not a style point.\n const pseen = new Set<string>();\n for (const p of params) {\n if (pseen.has(p.name)) flag(block.line, `Parameter \"${p.name}\" is defined more than once in $TOOL ${name}.`, 'duplicate-param', 'error');\n pseen.add(p.name);\n }\n\n // A tool with no description gives the model nothing to route on — the #1 real-world tool defect.\n if (descParts.length === 0) {\n flag(block.line, `$TOOL ${name} has no description — the model has nothing to decide WHEN to call it.`, 'tool-no-description', 'warn');\n }\n\n // ── Binding integrity ──\n if (binding) {\n // The service's headers come first (already validated env-only); the tool's own headers follow and WIN on\n // a name collision — a tool may specialize its service.\n const fromService = binding.service ? services.get(binding.service)?.headers ?? [] : [];\n const own = headers.map((h) => ({ name: h.name, value: h.value }));\n binding.headers = [...fromService.filter((sh) => !own.some((th) => th.name.toLowerCase() === sh.name.toLowerCase())), ...own];\n } else if (headers.length > 0) {\n flag(headers[0]?.line ?? block.line, `$TOOL ${name} has headers but no request — headers ride an HTTP binding. Add one, like: \"- request:: GET https://api.example.com/orders\", or delete the headers.`, 'header-without-binding', 'warn');\n }\n if (binding) {\n // Tool-authored spots (the url/path + the tool's own headers) may use declared params or @{env.NAME}.\n const paramNames = new Set(params.map((p) => p.name));\n checkPlaceholders(binding.url.slice(binding.service ? (services.get(binding.service)?.base.length ?? 0) : 0), binding.line, paramNames, 'the request', flag);\n for (const h of headers) {\n checkPlaceholders(h.value, h.line, paramNames, 'this header', flag);\n if (!/\\{env\\./.test(h.value) && SECRET_RE.test(h.value)) {\n flag(h.line, `This looks like a credential literal — never put secrets in the file; use @{env.NAME} instead.`, 'secret-literal', 'warn');\n }\n }\n }\n\n tools.push({ name, description: descParts.join(' '), params, ...(binding ? { binding } : {}), line: block.line });\n }\n\n // Two definitions of the same name — a reference to it is ambiguous, exactly like a duplicate step.\n const byName = new Map<string, ToolDef[]>();\n for (const tl of tools) {\n const list = byName.get(tl.name) ?? [];\n list.push(tl);\n byName.set(tl.name, list);\n }\n for (const [dup, list] of byName) {\n if (list.length > 1) conflicts.push({ lines: list.map((tl) => tl.line), message: `$TOOL ${dup} is defined ${list.length} times.`, code: 'duplicate-tool', severity: 'error' });\n }\n\n // A service no tool uses is a dead definition — same standard as an unused import.\n for (const s of svc.services) {\n if (!usedServices.has(s.name)) conflicts.push({ lines: [s.line], message: `$SERVICE ${s.name} is never used by any tool's request.`, code: 'unused-service', severity: 'warn' });\n }\n\n return { tools, services: svc.services, conflicts };\n}\n\n/** The tool's parameters as a JSON-Schema object — the `input_schema` (Anthropic) / `parameters` (OpenAI)\n * shape, so a compiled agent bundle is directly consumable by a function-calling API. */\nexport function toolInputSchema(tool: ToolDef): {\n type: 'object';\n properties: Record<string, Record<string, unknown>>;\n required: string[];\n} {\n const properties: Record<string, Record<string, unknown>> = {};\n for (const p of tool.params) {\n const base: Record<string, unknown> = { type: p.type };\n if (p.enum !== undefined) base['enum'] = p.enum;\n if (p.default !== undefined) base['default'] = p.default;\n if (p.description !== undefined) base['description'] = p.description;\n // An array carries its member constraint into items — `any of a, b` is an array of that enum.\n properties[p.name] = p.array\n ? { type: 'array', items: { type: p.type, ...(p.enum !== undefined ? { enum: p.enum } : {}) }, ...(p.description !== undefined ? { description: p.description } : {}) }\n : base;\n }\n return { type: 'object', properties, required: tool.params.filter((p) => p.required).map((p) => p.name) };\n}\n","// ── Cardinality — the existential-there frame bounds a set's SIZE ────────────────────────────────────────\n// `There is only one tool` = |tool| ∈ [1,1]; `There are many tools` = |tool| ∈ [2,∞). The quantity phrase\n// classifies to an interval; a noun's claims live on its object (prompt.ts collectObjects folds them into\n// DeclaredObject.count) and the quantifier layer (quantifier.ts) proves conflicts between them. This module\n// is a near-LEAF — its only import is the LEXICON (invariant #1: the vocabulary is defined ONCE, in\n// CARDINAL_QUANTITIES / NUMBER_WORDS / EXACTNESS_MARKERS; this file is just the parse over it) — so both\n// prompt.ts and quantifier.ts can use it without a cycle, exactly the possession.ts pattern.\n//\n// Soundness rules the readings (encoded IN the lexicon tables): exactness needs an EXPLICIT marker\n// (`only/exactly/just one` = [1,1]; a bare `one`, `a`/`an`, or numeral is at-least — \"there is one tool\n// that can help\" claims no uniqueness). An unknown quantity phrase abstains (null).\nimport pluralizeLib from 'pluralize';\n\nimport { copulaAlternation } from './copula';\nimport { CARDINAL_QUANTITIES, EXACTNESS_MARKERS, NUMBER_WORDS, QUANTIFIER_KEYWORDS } from './lexicon';\n\n// Domain words the library mis-lemmatizes (`sms` → `sm`); extend HERE, never with a local special case.\npluralizeLib.addUncountableRule('sms');\n\nexport interface CardinalBound {\n noun: string; // singularized pivot noun — the identity axis\n lo: number;\n hi: number; // Infinity = unbounded above\n text: string; // the quantity phrase + noun as written, for messages\n /** The RESTRICTOR TAIL after the noun (`the only person ON THIS EARTH` → `on this earth`), normalized.\n * Part of the claim's identity: `the only person in this conversation` and `many people on earth` bound\n * DIFFERENT sets, so differing tails must never cross (empty tail = the unqualified set). */\n tail: string;\n /** The POSSESSIVE-have frame's owner (`You have only one tool` → `you`) — the claim bounds the OWNER's\n * set, so claims bucket by (owner, noun) and a have-claim never crosses an ownerless there-claim. */\n owner?: string;\n /** The quantity PHRASE alone (`only one`, `a`, `many`) — the strength pass reads it: an `a`/`an` claim\n * is generic, never a stated count, so it joins the emptiness check but abstains from strength. */\n phrase?: string;\n}\n\n// The two FRAME sources, defined ONCE (the PLACEHOLDER_RE precedent): the checker, the object model, and\n// the semantic highlighter all read these, so a frame added here reaches every consumer.\nexport const EXISTENTIAL_FRAME_SRC = 'there\\\\s+(?:is|are|was|were|exists|exist)';\nexport const POSSESSIVE_FRAME_SRC = '(?:has|have)';\n\n/** Noun identity, shared by every tier (the quantifier layer, the object graph, occurrences, hover):\n * full lemmatization via `pluralize`, so IRREGULAR pairs unify too — `people` ⇄ `person`,\n * `children` ⇄ `child` — not just the `s`-suffix regulars. */\nexport function singularizeNoun(s: string): string {\n return pluralizeLib.singular(s.trim().toLowerCase());\n}\n\n/** The plural surface form of a noun — the other half of number folding (`person` → `people`). */\nexport function pluralizeNoun(s: string): string {\n return pluralizeLib.plural(s.trim().toLowerCase());\n}\n\nconst numOf = (w: string): number | null => NUMBER_WORDS[w] ?? (/^\\d+$/.test(w) ? Number(w) : null);\nconst FIXED = new Map(CARDINAL_QUANTITIES.map((q) => [q.phrase, { lo: q.lo, hi: q.hi ?? Infinity }]));\nconst EXACT = new Set(EXACTNESS_MARKERS.map((m) => m.toLowerCase()));\nconst QUANT_WORD_SET = new Set(QUANTIFIER_KEYWORDS.map((w) => w.toLowerCase())); // quantifier-led owners abstain\n\n/** Classify a quantity phrase (as a token list) into an |S| interval, or null (unknown → abstain). */\nfunction classifyCardinal(tokens: string[]): { lo: number; hi: number } | null {\n const [a, b] = [tokens[0] ?? '', tokens[1] ?? ''];\n const fixed = FIXED.get(tokens.join(' '));\n if (fixed) return fixed;\n if (EXACT.has(a) && tokens.length === 2) {\n const n = numOf(b);\n return n === null ? null : { lo: n, hi: n };\n }\n if (a === 'at' && b === 'least' && tokens.length === 3) {\n const n = numOf(tokens[2] ?? '');\n return n === null ? null : { lo: n, hi: Infinity };\n }\n if (a === 'at' && b === 'most' && tokens.length === 3) {\n const n = numOf(tokens[2] ?? '');\n return n === null ? null : { lo: 0, hi: n };\n }\n if (tokens.length === 1) {\n const n = numOf(a);\n return n === null ? null : { lo: n, hi: Infinity }; // a bare numeral is at-least (sound; exactness needs a marker)\n }\n return null;\n}\n\n/** Normalize a restrictor tail: lowercased plain words, single-spaced (punctuation shed). */\nfunction normTail(words: string[]): string {\n return words.join(' ');\n}\n\n/** The longest recognizable quantity prefix + pivot noun + restrictor tail of a phrase, or null. */\nfunction quantityAndNoun(rest: string): { noun: string; lo: number; hi: number; text: string; phrase: string; tail: string } | null {\n const words = rest.toLowerCase().split(/\\s+/).map((w) => w.replace(/[.,;:!?]+$/, '')).filter((w) => w !== '');\n for (const take of [3, 2, 1]) {\n if (words.length <= take) continue;\n const iv = classifyCardinal(words.slice(0, take));\n if (iv === null) continue;\n const noun = singularizeNoun(words[take] ?? '');\n if (noun === '' || numOf(noun) !== null) return null; // a numeral is never a noun\n return { noun, lo: iv.lo, hi: iv.hi, text: words.slice(0, take + 1).join(' '), phrase: words.slice(0, take).join(' '), tail: normTail(words.slice(take + 1)) };\n }\n return null;\n}\n\nconst THERE_RE = new RegExp(`^${EXISTENTIAL_FRAME_SRC}\\\\s+(.+)$`, 'i');\n// The have-frame owner is a SHORT subject phrase (1–2 words, an optional leading article dropped):\n// `You have …`, `The agent has …`, `Sarah has …`. A quantifier-led owner (`All users have …`) abstains —\n// a per-member bound under a quantified subject is a different claim than a set-size bound (sound over clever).\nconst SUBJECT_SRC = '(?:the\\\\s+|an?\\\\s+)?([A-Za-z][A-Za-z0-9_]*(?:\\\\s+[A-Za-z][A-Za-z0-9_]*)?)';\nconst HAVE_RE = new RegExp(`^${SUBJECT_SRC}\\\\s+(${POSSESSIVE_FRAME_SRC})\\\\s+(.+)$`, 'i');\n// The two MEMBERSHIP frames — copula idioms that bound a set the subject belongs to:\n// `<subj> is one of [the] many <noun> <tail>` → |noun| ≥ 2 (the subject is among MANY)\n// `<subj> is the only <noun> <tail>` → |noun| = 1 (the subject is the UNIQUE one)\n// The subject itself is not part of the claim's identity — the bound is on the NOUN set.\n/** The single-word \"many\"-class quantities (`many`/`several`/`multiple` — lo 2, unbounded), lexicon-derived.\n * Exported so the semantic highlighter colours exactly the words this parser accepts (one definition). */\nexport const MANY_CLASS = CARDINAL_QUANTITIES.filter((q) => q.lo === 2 && q.hi === null && !q.phrase.includes(' ')).map((q) => q.phrase);\nconst ONE_OF_RE = new RegExp(`^${SUBJECT_SRC}\\\\s+(?:${copulaAlternation})\\\\s+one\\\\s+of\\\\s+(?:the\\\\s+)?((?:${MANY_CLASS.join('|')})|[a-z0-9]+)\\\\s+(.+)$`, 'i');\nconst THE_ONLY_RE = new RegExp(`^${SUBJECT_SRC}\\\\s+(?:${copulaAlternation})\\\\s+the\\\\s+only\\\\s+(.+)$`, 'i');\n\nconst subjectAbstains = (subject: string): boolean => subject === '' || subject.split(/\\s+/).some((w) => QUANT_WORD_SET.has(w) || numOf(w) !== null);\n\n/** Is a phrase led by a cardinal quantity (`many people…`, `three admins…`)? The enum-declaration parser\n * uses this to disown `X IS one of many people` — a membership idiom, never a closed-set declaration. */\nexport function isCardinalQuantityLead(text: string): boolean {\n const first = (text.trim().toLowerCase().split(/\\s+/)[0] ?? '').replace(/[.,;:!?]+$/, '');\n return FIXED.has(first) || EXACT.has(first) || numOf(first) !== null;\n}\n\n/** Parse a GUARD-FREE cardinality clause body into a bound, or null. Four frames: existential-there\n * (`There is only one tool`), possessive-have (`You have only one tool`, owner-scoped), one-of-many\n * membership (`You are one of many people on this earth` → |person| ≥ 2), and the-only uniqueness\n * (`You are the only person on this earth` → |person| = 1). Pure. */\nexport function parseCardinalBody(body: string): CardinalBound | null {\n const trimmed = body.trim();\n const there = trimmed.match(THERE_RE);\n if (there) {\n const q = quantityAndNoun(there[1] ?? '');\n return q === null ? null : q;\n }\n const have = trimmed.match(HAVE_RE);\n if (have) {\n const owner = (have[1] ?? '').toLowerCase().trim();\n if (subjectAbstains(owner)) return null; // `there` never reaches here (THERE_RE wins above)\n const q = quantityAndNoun(have[3] ?? '');\n if (q === null) return null;\n // `a`/`an` never participate in the have-frame: \"You have a clear mission\" is ordinary prose, not a\n // set-size claim — the [1,∞) reading is too weak to prove anything, and an adjective-led NP would key\n // the claim on a junk noun. (They stay meaningful in the there-frame, where the pivot introduces a set.)\n if (q.phrase === 'a' || q.phrase === 'an') return null;\n return { ...q, owner, text: `${owner} ${(have[2] ?? '').toLowerCase()} ${q.text}` };\n }\n const only = trimmed.match(THE_ONLY_RE);\n if (only) {\n const subject = (only[1] ?? '').toLowerCase().trim();\n if (subjectAbstains(subject)) return null;\n const words = (only[2] ?? '').toLowerCase().split(/\\s+/).map((w) => w.replace(/[.,;:!?]+$/, '')).filter((w) => w !== '');\n const noun = singularizeNoun(words[0] ?? '');\n if (noun === '' || numOf(noun) !== null) return null;\n return { noun, lo: 1, hi: 1, text: `the only ${words[0] ?? ''}`, phrase: 'the only', tail: normTail(words.slice(1)) };\n }\n const oneOf = trimmed.match(ONE_OF_RE);\n if (oneOf) {\n const subject = (oneOf[1] ?? '').toLowerCase().trim();\n if (subjectAbstains(subject)) return null;\n const quantity = (oneOf[2] ?? '').toLowerCase();\n const n = numOf(quantity);\n const lo = n !== null ? Math.max(n, 2) : MANY_CLASS.includes(quantity) ? 2 : null; // `one of one`? not a set idiom\n if (lo === null || (n !== null && n < 2)) return null;\n const words = (oneOf[3] ?? '').toLowerCase().split(/\\s+/).map((w) => w.replace(/[.,;:!?]+$/, '')).filter((w) => w !== '');\n const noun = singularizeNoun(words[0] ?? '');\n if (noun === '' || numOf(noun) !== null) return null;\n return { noun, lo, hi: Infinity, text: `one of ${quantity} ${words[0] ?? ''}`, phrase: `one of ${quantity}`, tail: normTail(words.slice(1)) };\n }\n return null;\n}\n\n// ── The ACTION-COUNT frame — a directive whose object carries a quantity ────────────────────────────────\n// `call five tools` claims the count of the (verb, noun, tail) SLOT. The slot axiom (SPEC §7) gives one\n// action one count, so two different counts on one slot conflict (`call six tools` vs `call five tools`) —\n// the check lives in quantifier.ts; this is only the pure parse. The deontic lead (`you must …`) is the\n// caller's business (logic.ts owns the deontic lexicon); this parser sees the bare directive.\nexport interface ActionCount {\n verb: string;\n noun: string;\n lo: number;\n hi: number;\n text: string; // `<verb> <quantity> <noun>` as written, for messages\n tail: string; // restrictor tail — part of the slot's identity, like every cardinality frame\n}\n\n// Words that can never be an ACTION verb in this frame: determiners and pronouns (a subject NP like\n// `the five tools are logged` must not read as a directive), copulas/expletives (world-cardinality is the\n// there-frame's business), and connectives. Quantifier words and numerals are excluded via the lexicon sets.\n/** Exported so the highlighter's action-quantity rule excludes EXACTLY the words this parser excludes\n * (the colouring must match what the compiler believes — one list, two consumers). */\nexport const NON_ACTION_LEADS = new Set([\n 'the', 'a', 'an', 'this', 'that', 'these', 'those', 'it', 'they', 'we', 'i', 'he', 'she', 'you',\n 'there', 'is', 'are', 'was', 'were', 'am', 'be', 'been', 'being', 'if', 'then', 'otherwise', 'and', 'or', 'not',\n 'have', 'has', 'had', // the POSSESSIVE-have frame owns these (owner-scoped set sizes) — never double-read\n]);\n\n/** Parse a bare directive segment into an action-count claim (`call five tools` → call/tool [5,∞)), or\n * null. Sound readings match the other frames: `a`/`an` never claim (`call a tool` is prose), the\n * quantity must classify via the lexicon, and a non-verb lead abstains. Pure. */\nexport function parseActionCount(segment: string): ActionCount | null {\n const m = segment.trim().match(/^([A-Za-z][A-Za-z-]*)\\s+(.+)$/);\n if (!m) return null;\n const verb = (m[1] ?? '').toLowerCase();\n if (NON_ACTION_LEADS.has(verb) || QUANT_WORD_SET.has(verb) || numOf(verb) !== null || FIXED.has(verb) || EXACT.has(verb)) return null;\n const q = quantityAndNoun(m[2] ?? '');\n if (q === null) return null;\n if (q.phrase === 'a' || q.phrase === 'an') return null; // `call a tool` is prose-weak, same as the have-frame\n return { verb, noun: q.noun, lo: q.lo, hi: q.hi, text: `${verb} ${q.text}`, tail: q.tail };\n}\n\n/** A readable rendering of an |S| interval for messages and hover. */\nexport function boundText(lo: number, hi: number): string {\n if (lo === hi) return `exactly ${lo}`;\n if (hi === Infinity) return `${lo} or more`;\n if (lo === 0) return `at most ${hi}`;\n return `${lo} to ${hi}`;\n}\n","import { HONORIFIC_PREFIX_SRC, NAME_PHRASE, bindsHere, maskQuotes, stripInlineComment, stripPunct, stripQuotes } from './clause';\nimport { copulaAlternation } from './copula';\n\n// ── Possession ──────────────────────────────────────────────────────────────────────────────────────\n// Every English form of possession expresses ONE operation: `owner.property = value` (or, for the\n// predicate forms, `owner OWNS thing`). English just spells the (owner, property) pair many ways. Each\n// surface pattern below recognizes one form and yields a uniform `Possession`; the shared copula/value\n// parse, negation folding, and cardinality handling are common to all of them.\n//\n// determiner Your name is Joe → you.name = Joe\n// Saxon (proper) Sarah's name is Joe → sarah.name = Joe\n// Saxon (common) the user's name is Joe → user.name = Joe\n// plural Saxon the agents' goal is X → agents.goal = X\n// of-genitive the name of the user is Joe → user.name = Joe\n// nested Your company's policy is X → you.company.policy = X\n// have-of You have a goal of helping → you.goal = helping\n// predicate abs. the decision is yours → you OWNS decision\n// predicate Saxon the call is Sarah's → sarah OWNS call\n//\n// Cardinality comes straight from the copula: singular `is`/`am` → a single-valued property (re-assigning a\n// DIFFERENT value is a contradiction — this is how \"two names\" is caught); plural `are` → a set that\n// accumulates. A possession is inert inside conditionals/directives/quotes, exactly like a declaration.\n\n// Possessive determiners (prenominal) → the object they own.\nexport const DETERMINER: Record<string, string> = {\n my: 'i', your: 'you', its: 'it', their: 'they', our: 'we', his: 'he', her: 'she', whose: 'who',\n};\n// Absolute/independent possessives (predicate position) → the owner of the subject.\nexport const ABSOLUTE: Record<string, string> = {\n mine: 'i', yours: 'you', hers: 'she', ours: 'we', theirs: 'they', his: 'he', its: 'it',\n};\n\nexport type Possession =\n | {\n kind: 'property';\n owner: string; // display casing; the object table lowercases it for the key\n path: string[]; // property path on `owner`: ['name'] or, nested, ['company', 'policy']\n items: string[]; // value decomposed on `and` / `,` — `a plumber and apples` → [\"a plumber\", \"apples\"]\n negated: boolean;\n cardinality: 'one' | 'many'; // `are`, or any `and`/`,` list, → a set; a lone `is`/`am` value → single\n }\n | { kind: 'ownership'; owner: string; thing: string };\n\nconst NOTS = '((?:not\\\\s+)*)';\nconst COP = `(${copulaAlternation})`;\nconst DET_ALT = Object.keys(DETERMINER).join('|');\nconst ABS_ALT = Object.keys(ABSOLUTE).join('|');\nconst ART = '(?:(?:the|a|an)\\\\s+)?';\n\n// Prenominal determiner: `<det> <property…> <copula> <value>`. Matched anywhere (\\b) like a declaration.\nconst PRENOMINAL_DET = new RegExp(`\\\\b(${DET_ALT})\\\\s+(.+?)\\\\s+${COP}\\\\s+${NOTS}(.+)$`, 'di');\n// Prenominal Saxon: `[article] <owner>'s <property…> <copula> <value>`. `'s` (singular) or `'` (plural)\n// marks the owner; a leading article is dropped. The owner may be multi-word (`the support agent's …`).\nconst PRENOMINAL_SAXON = new RegExp(`\\\\b${ART}(${HONORIFIC_PREFIX_SRC}${NAME_PHRASE})(?:'s|')\\\\s+(.+?)\\\\s+${COP}\\\\s+${NOTS}(.+)$`, 'diu');\n// Of-genitive: `the <property> of <owner> <copula> <value>`. No possessive marker, so it is line-anchored\n// to limit collisions with prose like \"the point of this is …\".\nconst OF_GENITIVE = new RegExp(`^\\\\s*the\\\\s+(${NAME_PHRASE})\\\\s+of\\\\s+${ART}(${HONORIFIC_PREFIX_SRC}${NAME_PHRASE})\\\\s+${COP}\\\\s+${NOTS}(.+)$`, 'diu');\n// Have-of: `<owner> has|have [article] <property> of <value>`.\nconst HAVE_OF = new RegExp(`^\\\\s*${ART}(${HONORIFIC_PREFIX_SRC}${NAME_PHRASE})\\\\s+(?:has|have)\\\\s+${ART}(${NAME_PHRASE})\\\\s+of\\\\s+(.+)$`, 'diu');\n// Predicate ownership: `<thing> <copula> <owner-possessive>` — the possessive sits at the END.\nconst OWNERSHIP_ABS = new RegExp(`^\\\\s*${ART}(.+?)\\\\s+(?:${copulaAlternation})\\\\s+(${ABS_ALT})\\\\s*\\\\.?$`, 'di');\nconst OWNERSHIP_SAXON = new RegExp(`^\\\\s*${ART}(.+?)\\\\s+(?:${copulaAlternation})\\\\s+(${HONORIFIC_PREFIX_SRC}${NAME_PHRASE})(?:'s|')\\\\s*\\\\.?$`, 'diu');\n\nfunction sliceAt(clean: string, m: RegExpMatchArray, i: number): string {\n const ix = m.indices?.[i];\n return ix ? clean.slice(ix[0], ix[1]) : '';\n}\nfunction foldNegation(nots: string): boolean {\n return ((nots.match(/\\bnot\\b/gi) ?? []).length % 2) === 1;\n}\nfunction stripArticle(s: string): string {\n return s.replace(/^(?:the|a|an)\\s+/i, '').trim();\n}\n// Split a possessive path on `'s` boundaries: `company's policy` → [company, policy]; `first name` → [first name].\nfunction splitPath(raw: string): string[] {\n return raw.split(/'s\\b\\s*/).map((s) => s.trim()).filter((s) => s !== '');\n}\n// An of-genitive / have-of owner can itself be a determiner possessive: `the name of your company` means the\n// name of (your company) = you.company.name — the SAME field as the Saxon `Your company's name`. Decompose a\n// `<determiner> <noun phrase>` owner into a base owner + a path-prefix segment so the two surface forms unify;\n// a plain owner (`the user`, `Acme`, `Mr. Lee`) is returned untouched (no determiner head).\nfunction resolveOwnerPhrase(phrase: string): { owner: string; prefix: string[] } {\n const trimmed = phrase.trim();\n // `X of Y` — X is a property of (Y). Recurse on the owner Y (stripping its article) and append X as the\n // next-deeper segment, so a chained of-genitive `the CEO of your company` → you.company.ceo and nests to\n // any depth — unifying with the Saxon `Your company's CEO's …`.\n const of = trimmed.match(/^(.+?)\\s+of\\s+(.+)$/i);\n if (of) {\n const base = resolveOwnerPhrase((of[2] ?? '').trim().replace(/^(?:the|a|an)\\s+/i, ''));\n return { owner: base.owner, prefix: [...base.prefix, (of[1] ?? '').trim()] };\n }\n // `<determiner> <noun phrase>` — `your company` = you.company.\n const m = trimmed.match(/^([A-Za-z]+)\\s+(.+)$/);\n const det = m ? (m[1] ?? '').toLowerCase() : '';\n if (m && DETERMINER[det]) return { owner: DETERMINER[det] ?? det, prefix: [(m[2] ?? '').trim()] };\n return { owner: trimmed, prefix: [] };\n}\n// A conjunct that is itself `<noun> <copula> <value>` is a CLAUSE — it continues the possessive onto a NEW\n// property rather than adding a value to the current one (`Your job is apples and name is george` means\n// `job = apples` AND `name = george`). A bare clause (`… and name is george`) inherits the head owner; a\n// clause with its OWN possessive (`… and Sarah's name is george`) is a full possession with its own owner.\nconst CLAUSE_RE = new RegExp(`^(${NAME_PHRASE})\\\\s+(${copulaAlternation})\\\\s+(.+)$`, 'iu');\n// Subject pronouns can't be property names: `… and it is great` is a remark about the prior value, not a new\n// property (and treating it as one would wrongly turn the head field into a set, hiding a real conflict). A\n// bare clause needs a real noun subject.\nconst PRONOUN_SUBJECTS = new Set(['it', 'this', 'that', 'they', 'these', 'those', 'he', 'she', 'we', 'i', 'you']);\n\ninterface Acc {\n owner: string;\n path: string[];\n many: boolean; // a plural copula (`are`) makes the field a set regardless of count\n values: string[];\n}\n\n// Decompose a possession value into ONE OR MORE property assignments. Splitting on `and` / `,`: the head\n// conjunct is always a value of the head property; a later conjunct that parses as a FULL possession switches\n// to that property (its own owner); a bare `noun is value` clause switches with the head owner inherited; and\n// anything else is just another value of whatever property is current (`a plumber and apples` → both head values).\nfunction makeProperties(owner: string, headPath: string[], rawValue: string, headCopula: string, negated: boolean): Possession[] {\n if (headPath.length === 0) return [];\n const conjuncts = stripQuotes(rawValue.trim()).split(/\\s*,\\s*|\\s+and\\s+/i).map((s) => s.trim()).filter((s) => s !== '');\n const out: Possession[] = [];\n let cur: Acc = { owner, path: headPath, many: /are/i.test(headCopula), values: [] };\n const flush = (): void => {\n const items = cur.values.map(stripPunct).filter((v) => v !== '');\n if (cur.path.length > 0 && items.length > 0) {\n // The property name is case-insensitive — `Your NAME is Joe` and `your name is Bob` address the same\n // field — so the path is lower-cased for keying, exactly like the owner/object key is.\n const path = cur.path.map((p) => p.toLowerCase());\n out.push({ kind: 'property', owner: cur.owner, path, items, negated, cardinality: cur.many || items.length > 1 ? 'many' : 'one' });\n }\n };\n conjuncts.forEach((c, i) => {\n if (i === 0) {\n cur.values.push(c); // the first conjunct is always a value of the head property\n return;\n }\n const sub = parsePossessions(c)[0]; // a conjunct with its own possessive marker (Sarah's …, your …, the user's …)\n if (sub) {\n flush();\n if (sub.kind === 'property') {\n cur = { owner: sub.owner, path: sub.path, many: sub.cardinality === 'many', values: [...sub.items] };\n } else {\n out.push(sub); // an ownership predicate has no value to continue\n cur = { owner, path: [], many: false, values: [] };\n }\n return;\n }\n const clause = c.match(CLAUSE_RE); // a bare `noun is value` — inherit the head owner\n if (clause) {\n const noun = clause[1]?.trim() ?? '';\n if (PRONOUN_SUBJECTS.has(noun.toLowerCase())) return; // `… and it is great` is a remark, not a property\n flush();\n cur = { owner, path: splitPath(noun), many: /are/i.test(clause[2] ?? 'is'), values: [clause[3] ?? ''] };\n return;\n }\n cur.values.push(c); // a plain value of the current property\n });\n flush();\n return out;\n}\n\n/** Every property assignment a possession line makes — usually one, but a conjoined clause yields several\n * (`Your job is apples and name is george` → job AND name). A predicate-ownership line yields exactly one. */\nexport function parsePossessions(text: string): Possession[] {\n const clean = stripInlineComment(text);\n if (!bindsHere(clean)) return [];\n const masked = maskQuotes(clean);\n\n // PROPERTY forms FIRST so a prenominal/of head wins over a trailing absolute possessive: in `Your job is\n // apples and the decision is yours` the line is `Your job is …` (with the ownership as a conjunct), not one\n // greedy \"you owns (Your job is apples and the decision)\". Have-of before of-genitive (both use `of`).\n let m = masked.match(HAVE_OF);\n if (m?.indices) {\n const { owner, prefix } = resolveOwnerPhrase(sliceAt(clean, m, 1));\n return makeProperties(owner, [...prefix, sliceAt(clean, m, 2).trim()], sliceAt(clean, m, 3), '', false);\n }\n m = masked.match(OF_GENITIVE);\n if (m?.indices) {\n const { owner, prefix } = resolveOwnerPhrase(sliceAt(clean, m, 2));\n return makeProperties(owner, [...prefix, sliceAt(clean, m, 1).trim()], sliceAt(clean, m, 5), sliceAt(clean, m, 3), foldNegation(sliceAt(clean, m, 4)));\n }\n // Prenominal: determiner, then Saxon. Both: group2 = property path (split on `'s` for nesting).\n m = masked.match(PRENOMINAL_DET);\n if (m?.indices) {\n const det = sliceAt(clean, m, 1).toLowerCase();\n return makeProperties(DETERMINER[det] ?? det, splitPath(sliceAt(clean, m, 2)), sliceAt(clean, m, 5), sliceAt(clean, m, 3), foldNegation(sliceAt(clean, m, 4)));\n }\n m = masked.match(PRENOMINAL_SAXON);\n if (m?.indices) {\n return makeProperties(sliceAt(clean, m, 1), splitPath(sliceAt(clean, m, 2)), sliceAt(clean, m, 5), sliceAt(clean, m, 3), foldNegation(sliceAt(clean, m, 4)));\n }\n // Predicate ownership LAST — a line with no prenominal/of property structure (`the decision is yours`,\n // `the call is Sarah's`) is a pure ownership assertion; the possessive sits at the END.\n m = masked.match(OWNERSHIP_ABS);\n if (m?.indices) {\n const abs = sliceAt(clean, m, 2).toLowerCase();\n return [{ kind: 'ownership', owner: ABSOLUTE[abs] ?? abs, thing: stripArticle(sliceAt(clean, m, 1)) }];\n }\n m = masked.match(OWNERSHIP_SAXON);\n if (m?.indices) {\n return [{ kind: 'ownership', owner: sliceAt(clean, m, 2), thing: stripArticle(sliceAt(clean, m, 1)) }];\n }\n return [];\n}\n\n/** The PRIMARY possession on a line (its head property, or the ownership) — null if none. Use parsePossessions\n * to get EVERY assignment a line makes. Kept for the declaration guard and single-assignment callers. */\nexport function parsePossession(text: string): Possession | null {\n return parsePossessions(text)[0] ?? null;\n}\n","// ── $TEST block parsing — eval cases that live IN the prompt file ───────────────────────────────────\n// `$TEST <id>` opens a test block; its body is `- field:: value` bullets, indentation-delimited exactly\n// like a $TOOL body (the block ends at the first line dedented to the header's column; a blank line\n// doesn't dedent). Two fields — the SAME `- field::` shape $TOOL / $SERVICE use, so there is one block\n// syntax across the language:\n// - input:: the user turn (one value)\n// - expect:: a LIST — one expectation per `- ` sub-bullet (judge-scored prose, or a deterministic\n// assert: `contains \"…\"` / `matches /…/` / `at most N sentences`)\n//\n// $TEST pricing\n// - input:: How much does the Enterprise plan cost?\n// - expect::\n// - no specific price is stated ← rubric expectation (judge-scored)\n// - contains \"sales\" ← deterministic assert (code-checked, zero cost)\n// - at most 3 sentences\n//\n// The whole block is control-plane: it compiles away entirely — the model never sees a test — and\n// extractSuite() turns it into the {testCases, rubric} shape the profiler, the profile, and the promptfoo\n// emitter consume. Anything inside that isn't `- input::` / `- expect::` (+ its sub-bullets) is a\n// structure/bad-test ERROR — the wellFormed gate is what guarantees TypeGlish can never leak into the model.\n\nexport type TestAssert =\n | { kind: 'contains'; value: string }\n | { kind: 'matches'; source: string; flags: string }\n | { kind: 'atMost' | 'atLeast'; n: number; unit: 'sentences' | 'words' | 'characters' }\n | { kind: 'rubric'; text: string };\n\nexport interface TestBlockT {\n headerLine: number;\n blockEnd: number; // exclusive — the first dedented line, or EOF\n indent: number;\n id: string;\n input: string;\n expects: TestAssert[];\n /** Each judge-scored (rubric) expectation's line + column span — the determinable-expect lint's raw material. */\n rubricLines: { line: number; start: number; text: string }[];\n error: string | null;\n}\n\nconst TEST_HEADER = /^(\\s*)\\$TEST\\s+([A-Za-z][A-Za-z0-9_-]*)\\s*$/i; // `$TEST id` — the name only; fields are bullets\nconst FIELD = /^(\\s*)-\\s+([a-z][a-z0-9_]*)::\\s*(.*)$/i; // `- key:: value` — a def-style field row (as in $TOOL)\nconst SUBITEM = /^\\s*-\\s+(.+?)\\s*$/; // `- <assertion>` — an expect sub-bullet (unkeyed)\nconst ANY_TEST = /^\\s*\\$TEST\\b/i;\nconst RETIRED_EXPECT = /^\\s*EXPECT\\b/; // the retired keyword form — UPPERCASE only, so prose \"Expect …\" never fires\n\nconst CONTAINS = /^contains\\s+\"(.+)\"\\s*$/i;\nconst MATCHES = /^matches\\s+\\/(.+)\\/([a-z]*)\\s*$/i;\nconst BOUND = /^at\\s+(most|least)\\s+(\\d+)\\s+(sentences?|words?|characters?)\\s*$/i;\n\nconst leading = (s: string): number => s.length - s.trimStart().length;\n\n/** One expectation payload → an assert. Deterministic shapes parse structurally; everything else is a\n * rubric expectation the judge scores. Returns an error string for a malformed deterministic shape\n * (an unclosable regex must be an error, not silently demoted to a rubric sentence). */\nexport function parseExpect(text: string): { assert: TestAssert | null; error: string | null } {\n const t = text.trim();\n if (t === '') return { assert: null, error: 'an expectation has no condition after it.' };\n const c = CONTAINS.exec(t);\n if (c) return { assert: { kind: 'contains', value: c[1] ?? '' }, error: null };\n const m = MATCHES.exec(t);\n if (m) {\n try {\n // Validate now so a bad pattern is a compile error, not a runtime throw.\n void new RegExp(m[1] ?? '', m[2] ?? '');\n return { assert: { kind: 'matches', source: m[1] ?? '', flags: m[2] ?? '' }, error: null };\n } catch {\n return { assert: null, error: `the expectation \\`matches /${m[1] ?? ''}/\\` is not a valid regular expression.` };\n }\n }\n const b = BOUND.exec(t);\n if (b) {\n const unit = (b[3] ?? '').toLowerCase().replace(/s?$/, 's') as 'sentences' | 'words' | 'characters';\n return { assert: { kind: b[1]?.toLowerCase() === 'most' ? 'atMost' : 'atLeast', n: Number(b[2]), unit }, error: null };\n }\n return { assert: { kind: 'rubric', text: t }, error: null };\n}\n\n/** Every `$TEST` block with its expects and extent. Blocks don't nest; scanning skips past each end. Pure. */\nexport function parseTests(lines: string[]): TestBlockT[] {\n const blocks: TestBlockT[] = [];\n const seen = new Set<string>();\n let i = 0;\n while (i < lines.length) {\n const m = (lines[i] ?? '').match(TEST_HEADER);\n if (!m) {\n i += 1;\n continue;\n }\n const indent = (m[1] ?? '').length;\n const id = (m[2] ?? '').toLowerCase();\n\n // Block extent: to the first non-blank line dedented to the header's column (a blank never dedents).\n let j = i + 1;\n while (j < lines.length) {\n const l = lines[j] ?? '';\n if (l.trim() !== '' && leading(l) <= indent) break;\n j += 1;\n }\n const blockEnd = j;\n\n let input: string | null = null;\n const expects: TestAssert[] = [];\n const rubricLines: { line: number; start: number; text: string }[] = [];\n let error: string | null = null;\n\n let k = i + 1;\n while (k < blockEnd && error === null) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') {\n k += 1;\n continue;\n }\n if (ANY_TEST.test(raw)) {\n error = 'a nested $TEST is not supported — dedent it to start a new test.';\n break;\n }\n const fm = raw.match(FIELD);\n if (!fm) {\n error = `only \"- input::\" and \"- expect::\" fields belong in $TEST ${id} — \"${raw.trim().slice(0, 48)}\" is not one.`;\n break;\n }\n const fieldIndent = (fm[1] ?? '').length;\n const key = (fm[2] ?? '').toLowerCase();\n const value = (fm[3] ?? '').trim();\n if (key === 'input') {\n if (value === '') {\n error = `$TEST ${id} needs the user turn on the \"- input::\" line.`;\n break;\n }\n input = value;\n k += 1;\n } else if (key === 'expect') {\n if (value !== '') {\n error = `\"- expect::\" is a list — put each expectation on its own \"- \" sub-bullet beneath it.`;\n break;\n }\n k += 1;\n let count = 0;\n while (k < blockEnd) {\n const sub = lines[k] ?? '';\n if (sub.trim() === '') {\n k += 1;\n continue;\n }\n if (leading(sub) <= fieldIndent) break; // dedented to the field column → the next field\n const sm = sub.match(SUBITEM);\n if (sm === null) {\n error = `each expectation is a \"- \" sub-bullet under \"- expect::\" — \"${sub.trim().slice(0, 48)}\" is not.`;\n break;\n }\n const parsed = parseExpect(sm[1] ?? '');\n if (parsed.error !== null) {\n error = parsed.error;\n break;\n }\n if (parsed.assert) {\n expects.push(parsed.assert);\n if (parsed.assert.kind === 'rubric') rubricLines.push({ line: k, start: (sub.match(/^\\s*-\\s+/)?.[0] ?? '').length, text: parsed.assert.text });\n }\n count += 1;\n k += 1;\n }\n if (error === null && count === 0) error = `$TEST ${id}'s \"- expect::\" has no expectations — add a \"- \" sub-bullet.`;\n } else {\n error = `only \"- input::\" and \"- expect::\" fields belong in $TEST ${id} — \"- ${key}::\" is neither.`;\n break;\n }\n }\n\n if (error === null && input === null) error = `$TEST ${id} needs an \"- input:: …\" line.`;\n if (error === null && expects.length === 0) error = `$TEST ${id} needs at least one expectation under \"- expect::\".`;\n if (error === null && seen.has(id)) error = `duplicate $TEST id \"${id}\".`;\n seen.add(id);\n\n blocks.push({ headerLine: i, blockEnd, indent, id, input: input ?? '', expects, rubricLines, error });\n i = blockEnd;\n }\n return blocks;\n}\n\n/** Every line belonging to a $TEST block (header through extent) — the strip set. Render, the semantic\n * decomposer, and the style rules all skip these: tests are scaffolding, never content. */\nexport function testBlockLines(lines: string[]): Set<number> {\n const out = new Set<number>();\n for (const b of parseTests(lines)) for (let i = b.headerLine; i < b.blockEnd; i += 1) out.add(i);\n return out;\n}\n\n/** Every judge-scored (rubric) expectation across all well-formed blocks, with its line + payload span —\n * the determinable-expect lint's raw material. */\nexport function rubricExpectLines(lines: string[]): { line: number; start: number; text: string }[] {\n return parseTests(lines)\n .filter((b) => b.error === null)\n .flatMap((b) => b.rubricLines);\n}\n\n/** Retired `EXPECT …` keyword lines — the pre-bullet spelling. Expectations are now `- ` sub-bullets under\n * `- expect::`, so a bare uppercase `EXPECT` is old syntax; the caller flags it with a migration hint.\n * Exact-case (prose like \"Expect delays during holidays.\" must never fire). */\nexport function strayExpects(lines: string[]): number[] {\n const out: number[] = [];\n lines.forEach((raw, i) => {\n if (RETIRED_EXPECT.test(raw)) out.push(i);\n });\n return out;\n}\n\n// ── extractSuite — the bridge to the profiler / profile / emitters ──────────────────────────────────\n\nexport interface SuiteCase {\n id: string;\n input: string;\n /** The case's rubric expectations, joined — rides TestCase.expectation as judge steering. */\n expectation?: string;\n}\n\nexport interface SuiteRubricDim {\n key: string;\n description: string;\n}\n\nexport interface ExtractedSuite {\n testCases: SuiteCase[];\n /** Union of every distinct rubric expectation (the legacy suite-JSON shape is one global rubric;\n * per-case steering rides `expectation`, per-case dimensions live in `caseRubrics`). */\n rubric: { dimensions: SuiteRubricDim[] };\n caseRubrics: Record<string, { dimensions: SuiteRubricDim[] }>;\n /** Deterministic asserts per case — code-checked, zero model cost. */\n asserts: Record<string, TestAssert[]>;\n}\n\nconst slug = (s: string): string =>\n s\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_')\n .replace(/^_+|_+$/g, '')\n .slice(0, 48) || 'expectation';\n\n/** The suite carried by the source's $TEST blocks (errored blocks are excluded — the gate already\n * flags them). Same shape as examples/*.suite.json so profilePrompt consumes it unchanged. */\nexport function extractSuite(source: string): ExtractedSuite {\n const blocks = parseTests(source.replace(/\\r\\n/g, '\\n').split('\\n')).filter((b) => b.error === null);\n const testCases: SuiteCase[] = [];\n const caseRubrics: ExtractedSuite['caseRubrics'] = {};\n const asserts: ExtractedSuite['asserts'] = {};\n const union = new Map<string, SuiteRubricDim>();\n\n for (const b of blocks) {\n const rubricTexts = b.expects.filter((e): e is Extract<TestAssert, { kind: 'rubric' }> => e.kind === 'rubric');\n const detAsserts = b.expects.filter((e) => e.kind !== 'rubric');\n const dims = rubricTexts.map((r) => ({ key: slug(r.text), description: r.text }));\n for (const d of dims) if (!union.has(d.key)) union.set(d.key, d);\n testCases.push({\n id: b.id,\n input: b.input,\n expectation: rubricTexts.length > 0 ? rubricTexts.map((r) => r.text).join('; ') : undefined,\n });\n caseRubrics[b.id] = { dimensions: dims };\n asserts[b.id] = detAsserts;\n }\n return { testCases, rubric: { dimensions: [...union.values()] }, caseRubrics, asserts };\n}\n","// ── $EXAMPLE block parsing — structured, checkable few-shot demonstrations ───────────────────────────\n// `$EXAMPLE <id>` opens an example block; its body is `- field:: value` bullets, indentation-delimited\n// exactly like a $TEST / $TOOL body — one block syntax across the language. Three fields, each a single\n// value:\n// - input:: the user turn (required)\n// - good:: the ideal assistant response to demonstrate (required)\n// - bad:: a response to AVOID (optional)\n//\n// $EXAMPLE pricing\n// - input:: How much does the Enterprise plan cost?\n// - good:: Our sales team owns Enterprise pricing — I can connect you right now.\n// - bad:: The Enterprise plan is $2,000 a month.\n//\n// Unlike a $TEST (which compiles away ENTIRELY), an $EXAMPLE is part control-plane, part content: the\n// block SCAFFOLDING strips, but each GOOD emits as a User/Assistant few-shot pair the model reads. BAD\n// is HELD OUT — showing a model a bad response invites imitation — so it never reaches the prompt; it\n// documents the failure mode for the author and rides evals downstream (extractExamples). Anything\n// inside that isn't `- input::` / `- good::` / `- bad::` is a structure/bad-example ERROR.\n\nexport interface ExampleBlockT {\n headerLine: number;\n blockEnd: number; // exclusive — the first dedented line, or EOF\n indent: number;\n id: string;\n input: string;\n good: string;\n bad: string | null;\n error: string | null;\n}\n\nconst EXAMPLE_HEADER = /^(\\s*)\\$EXAMPLE\\s+([A-Za-z][A-Za-z0-9_-]*)\\s*$/i; // `$EXAMPLE id` — the name only; fields are bullets\nconst FIELD = /^(\\s*)-\\s+([a-z][a-z0-9_]*)::\\s*(.*)$/i; // `- key:: value` — a def-style field row (as in $TOOL / $TEST)\nconst ANY_EXAMPLE = /^\\s*\\$EXAMPLE\\b/i;\n\nconst leading = (s: string): number => s.length - s.trimStart().length;\n\n/** Every `$EXAMPLE` block with its fields and extent. Blocks don't nest; scanning skips past each end. Pure. */\nexport function parseExamples(lines: string[]): ExampleBlockT[] {\n const blocks: ExampleBlockT[] = [];\n const seen = new Set<string>();\n let i = 0;\n while (i < lines.length) {\n const m = (lines[i] ?? '').match(EXAMPLE_HEADER);\n if (!m) {\n i += 1;\n continue;\n }\n const indent = (m[1] ?? '').length;\n const id = (m[2] ?? '').toLowerCase();\n\n // Block extent: to the first non-blank line dedented to the header's column (a blank never dedents).\n let j = i + 1;\n while (j < lines.length) {\n const l = lines[j] ?? '';\n if (l.trim() !== '' && leading(l) <= indent) break;\n j += 1;\n }\n const blockEnd = j;\n\n let input: string | null = null;\n let good: string | null = null;\n let bad: string | null = null;\n let error: string | null = null;\n\n let k = i + 1;\n while (k < blockEnd && error === null) {\n const raw = lines[k] ?? '';\n if (raw.trim() === '') {\n k += 1;\n continue;\n }\n if (ANY_EXAMPLE.test(raw)) {\n error = 'a nested $EXAMPLE is not supported — dedent it to start a new example.';\n break;\n }\n const fm = raw.match(FIELD);\n if (!fm) {\n error = `only \"- input::\", \"- good::\", and \"- bad::\" fields belong in $EXAMPLE ${id} — \"${raw.trim().slice(0, 48)}\" is not one.`;\n break;\n }\n const key = (fm[2] ?? '').toLowerCase();\n const value = (fm[3] ?? '').trim();\n if (key === 'input' || key === 'good' || key === 'bad') {\n if (value === '') {\n error = `$EXAMPLE ${id}'s \"- ${key}::\" needs its text on the same line.`;\n break;\n }\n if (key === 'input') input = value;\n else if (key === 'good') good = value;\n else bad = value;\n k += 1;\n } else {\n error = `only \"- input::\", \"- good::\", and \"- bad::\" fields belong in $EXAMPLE ${id} — \"- ${key}::\" is neither.`;\n break;\n }\n }\n\n if (error === null && input === null) error = `$EXAMPLE ${id} needs an \"- input:: …\" line.`;\n if (error === null && good === null) error = `$EXAMPLE ${id} needs a \"- good:: …\" line — the ideal response to demonstrate.`;\n if (error === null && seen.has(id)) error = `duplicate $EXAMPLE id \"${id}\".`;\n seen.add(id);\n\n blocks.push({ headerLine: i, blockEnd, indent, id, input: input ?? '', good: good ?? '', bad, error });\n i = blockEnd;\n }\n return blocks;\n}\n\n/** Every line belonging to an $EXAMPLE block (header through extent) — the strip set. The style/grammar\n * rules skip these (scaffolding), and render replaces the block with its few-shot emission. */\nexport function exampleBlockLines(lines: string[]): Set<number> {\n const out = new Set<number>();\n for (const b of parseExamples(lines)) for (let i = b.headerLine; i < b.blockEnd; i += 1) out.add(i);\n return out;\n}\n\n/** The few-shot lines a well-formed example emits INTO the compiled prompt — GOOD only. BAD is held out\n * (a demonstrated bad response invites imitation). The pair is wrapped in an `<example>` tag so the\n * model reads a clean, labelled exchange. Errored blocks emit nothing (the gate already flags them). */\nexport function renderExample(b: ExampleBlockT): string[] {\n if (b.error !== null) return [];\n return ['<example>', `User: ${b.input}`, `Assistant: ${b.good}`, '</example>'];\n}\n\n// ── extractExamples — the bridge to evals / downstream tooling ───────────────────────────────────────\n\nexport interface ExampleCase {\n id: string;\n input: string;\n /** The ideal response — emitted as few-shot AND usable as a positive eval target. */\n good: string;\n /** The response to avoid — never emitted; a negative eval target. */\n bad: string | null;\n}\n\n/** The example set carried by the source's $EXAMPLE blocks (errored blocks excluded — the gate flags them). */\nexport function extractExamples(source: string): ExampleCase[] {\n return parseExamples(source.replace(/\\r\\n/g, '\\n').split('\\n'))\n .filter((b) => b.error === null)\n .map((b) => ({ id: b.id, input: b.input, good: b.good, bad: b.bad }));\n}\n","import {\n CONFIG_RE,\n DEFINE_RE,\n HONORIFIC_PREFIX_SRC,\n IMPORT_FILE_RE,\n IMPORT_RE,\n REQUIRE_RE,\n NAME_BOUNDARY_CLOSE,\n NAME_BOUNDARY_OPEN,\n NAME_PHRASE,\n NAME_WORD,\n bindsHere,\n defEntries,\n defListMask,\n examplesMask,\n isAnnotationLine,\n literalSectionMask,\n maskQuotes,\n renderDefBlock,\n stripAnnotation,\n stripInlineComment,\n stripPunct,\n stripQuotes,\n configSectionMask,\n toolBlockMask,\n} from './clause';\nimport { isCardinalQuantityLead, parseCardinalBody, pluralizeNoun, singularizeNoun } from './cardinality';\nimport { QUANTIFIER_KEYWORDS } from './lexicon';\nimport { copulaConnector } from './copula';\nimport { ABSOLUTE, DETERMINER, parsePossession, parsePossessions } from './possession';\nimport { splitSentences } from './sentence';\nimport { expandInlineToProse, switchBlockMask, switchProseRewrite } from './switch';\nimport { testBlockLines } from './testblock';\nimport { parseExamples, exampleBlockLines, renderExample } from './exampleblock';\nimport { toolsFromLines } from './predicate';\nimport { parseTools } from './tool';\nimport type { LineKind, PromptDocData, PromptLine } from './types';\n\n// Classify each raw line, tracking block-comment AND markdown-code-fence state across\n// lines. Line comments (`//`) and block comments (the C delimiters) are documentation —\n// render() never sends them to the model and they are not ablated. But inside a markdown\n// code fence (```), `//` and `/*` are literal content, so fence state suppresses comment\n// recognition there.\nexport function classifyLines(rawLines: string[]): LineKind[] {\n const kinds: LineKind[] = [];\n let inBlock = false;\n let inFence = false;\n for (const raw of rawLines) {\n const t = raw.trim();\n const isFence = t.startsWith('```') || t.startsWith('~~~');\n if (inFence) {\n if (isFence) inFence = false;\n kinds.push(t === '' ? 'blank' : 'content');\n continue;\n }\n if (inBlock) {\n kinds.push('comment');\n if (t.includes('*/')) inBlock = false;\n continue;\n }\n if (isFence) {\n inFence = true;\n kinds.push('content');\n continue;\n }\n if (t.startsWith('/*')) {\n kinds.push('comment');\n if (!t.includes('*/')) inBlock = true;\n continue;\n }\n if (t.startsWith('//')) {\n kinds.push('comment');\n continue;\n }\n kinds.push(t === '' ? 'blank' : 'content');\n }\n return kinds;\n}\n\n// A line whose content is a markdown heading marker — `# Role`, ` ## Persona` (leading whitespace is\n// cosmetic). A heading is purely STRUCTURAL: it names a section and nothing else — it declares no object,\n// asserts no fact, and holds no reference. So every content scanner (declarations, object mentions) treats a\n// heading as opaque and skips it; a heading is only ever a heading, painted by the tokenizer's block color\n// alone. (`#tag` with no space is NOT a heading — that requires the trailing whitespace, like the tokenizer.)\nexport function isHeadingLine(text: string): boolean {\n return /^\\s*#{1,6}\\s/.test(text);\n}\n\n// Lines inside (or delimiting) a ``` code fence — inline `//` there is literal code.\nfunction fenceMask(rawLines: string[]): boolean[] {\n const mask: boolean[] = [];\n let inFence = false;\n for (const raw of rawLines) {\n const t = raw.trim();\n const isFence = t.startsWith('```') || t.startsWith('~~~');\n if (inFence) {\n mask.push(true);\n if (isFence) inFence = false;\n } else if (isFence) {\n inFence = true;\n mask.push(true);\n } else {\n mask.push(false);\n }\n }\n return mask;\n}\n\n/** Strip leading indentation from every non-fenced line. TypeGlish's structure is carried by explicit\n * markers (`#`/`##` headings, step numbers, `<tags>`), so leading whitespace is purely cosmetic — the\n * editor auto-indents it for readability and the compiler ignores it (the C/Go model, not Python's). Code\n * inside ``` / ~~~ fences keeps its indentation. */\nexport function stripIndent(source: string): string {\n const lines = source.split('\\n');\n const mask = fenceMask(lines);\n // A $TOOL block is the SECOND place indentation is semantic (the first is a fence): its YAML-shaped body is\n // scoped BY its indent, so flattening it would dissolve the block. A deterministic chain is the THIRD: its arm\n // are dedent-delimited. A `term:: definition` entry is the FOURTH: its continuations are scoped BY\n // indenting deeper than the term. These spans keep their RELATIVE indentation but shed their BASE — under\n // the layout doctrine a construct sits at its section's column (nesting indentation is a SOURCE feature),\n // and the compiled text must read exactly as if authored flat, so each contiguous span dedents by its\n // anchor line's own indent.\n const tools = toolBlockMask(lines);\n const switches = switchBlockMask(lines);\n const defs = defListMask(lines);\n const dedent = new Array<number>(lines.length).fill(0);\n const markRuns = (m: readonly boolean[]): void => {\n for (let i = 0; i < lines.length; i += 1) {\n if (m[i] !== true || (i > 0 && m[i - 1] === true)) continue;\n const anchor = ((lines[i] ?? '').match(/^ */) ?? [''])[0].length;\n for (let j = i; j < lines.length && m[j] === true; j += 1) dedent[j] = anchor;\n }\n };\n markRuns(tools);\n markRuns(switches);\n markRuns(defs);\n return lines\n .map((l, i) => {\n if (mask[i]) return l; // fence content is verbatim\n if (tools[i] || switches[i] || defs[i]) {\n const lead = (l.match(/^ */) ?? [''])[0].length;\n return l.slice(Math.min(dedent[i] ?? 0, lead));\n }\n return l.replace(/^[ \\t]+/, '');\n })\n .join('\\n');\n}\n\n// A declaration binds a subject to a value (`Personality IS You are Jonas ...`). The operator is the\n// copula spelled out — IS / ARE / AM, chosen by number and person; all three are the same assignment,\n// so ANY subject + a copula declares that subject (it turns gold and is placed elsewhere with {Name}).\n// Case is irrelevant, like every operator (SPEC §2, §5): `You ARE {Persona}` and `you are {persona}`\n// both declare — the copula fragments match either case and the NAME is `\\p{L}` (any letter). What keeps\n// a line plain prose is grammar, not case: no copula, or a copula inside a conditional/directive\n// (`IF you are unsure THEN …` does not declare), or quotes. Declarations don't print — reference {Name}.\n// A negated copula (`IS NOT` / `ARE NOT` / `AM NOT`) is a negative *assertion*, not a binding: it\n// does not define {Name}, and it renders so the model reads the negative fact. NOT is a real logical\n// negation (an involution), so a run of NOTs folds by parity — `IS NOT NOT a guy` is positive again.\nexport const DECLARATION_RE = new RegExp(\n `^\\\\s*(${HONORIFIC_PREFIX_SRC}${NAME_WORD})${copulaConnector}\\\\s+((?:(?:NOT|not)\\\\s+)*)(.+)$`,\n 'du',\n);\n\n// Detect the copula on the quote-MASKED line (so a copula inside a \"string\" doesn't count), but slice\n// name/value from the ORIGINAL at the matched offsets — so a quoted value survives — then strip its\n// quotes. The `d` flag supplies the offsets.\nfunction matchDeclaration(\n re: RegExp,\n text: string,\n): { name: string; value: string; negated: boolean } | null {\n const m = maskQuotes(text).match(re);\n if (!m?.indices) return null;\n const at = (i: number): string => {\n const ix = m.indices?.[i];\n return ix ? text.slice(ix[0], ix[1]) : '';\n };\n const nots = (at(2).match(/NOT/gi) ?? []).length;\n // The statement terminator is punctuation of the STATEMENT, never part of the bound value — the JS\n // semicolon: `const tone = 'warm';` binds 'warm', so `Tone IS warm.` binds `warm` and `{Tone}` never\n // expands mid-sentence with a stray period. stripPunct runs BEFORE stripQuotes: a quoted value ends\n // in `\"`, not a terminator, so `Greeting IS \"How can I help?\"` keeps its interior punctuation.\n return { name: at(1), negated: nots % 2 === 1, value: stripQuotes(stripPunct(at(3))) };\n}\n\nexport function parseDeclaration(text: string): { name: string; value: string; negated: boolean } | null {\n return matchDeclaration(DECLARATION_RE, text);\n}\n\n// Line-anchored DECLARATION_RE matches only a WHOLE-line declaration (a pure definition that\n// render() suppresses). ANYWHERE_DECLARATION_RE finds a declaration embedded mid-sentence too\n// (`Remember, You ARE an orangutan`), used for binding, reference resolution, and consistency — so an\n// assertion counts no matter where in the line it sits. The only difference is the `\\b` anchor vs `^`.\nconst ANYWHERE_DECLARATION_RE = new RegExp(\n `\\\\b(${HONORIFIC_PREFIX_SRC}${NAME_WORD})${copulaConnector}\\\\s+((?:(?:NOT|not)\\\\s+)*)(.+)$`,\n 'du',\n);\n\n// A quantifier-led subject (`All users are…`, `Some refunds are not…`) is a QUANTIFIED statement, owned by\n// the quantifier layer (quantifier.ts) — the determiner is part of the meaning, so reading the sentence as a\n// bare `users = …` binding would erase it (and mis-fire the declaration tier on legal pairs like the\n// partition `some P / some not P`). One fact, one owner: determiner-led → quantifier layer, bare → here.\n// Derived from the lexicon's QUANTIFIER_WORDS (invariant #1) — never a local word list. The exclusive\n// family (`only`) attaches to actions, not subjects, so it can't lead a declaration subject anyway; keeping\n// the whole flat list here is harmless and simpler.\nconst QUANTIFIER_LED_RE = new RegExp(`\\\\b(?:${QUANTIFIER_KEYWORDS.map((w) => w.toLowerCase()).join('|')})\\\\s+$`, 'i');\n\nexport function findDeclaration(text: string): { name: string; value: string; negated: boolean } | null {\n if (isHeadingLine(text)) return null; // a heading is structural, not an assertion — `# That's great` declares nothing\n if (!bindsHere(text)) return null;\n // A possession (`Your name is …`, `Sarah's role is …`, `the decision is yours`) binds a PROPERTY of its\n // owner — or asserts ownership — not a standalone object, and it reads as prose, not a pure definition to\n // suppress. So it is never an ordinary declaration. (parsePossession lives in possession.ts — acyclic.)\n if (parsePossession(text)) return null;\n const m = matchDeclaration(ANYWHERE_DECLARATION_RE, text);\n if (!m) return null;\n // The expletive `there` (`There is only one tool`) is a dummy subject — it names NOTHING, so it never\n // declares an object. The existential-there frame belongs to the quantifier layer (a cardinality claim).\n if (m.name.toLowerCase() === 'there') return null;\n // The matched subject's start: check the text BEFORE it for a leading determiner of quantity.\n const at = maskQuotes(text).match(ANYWHERE_DECLARATION_RE)?.indices?.[1]?.[0] ?? 0;\n if (QUANTIFIER_LED_RE.test(text.slice(0, at))) return null;\n return m;\n}\n\n// A list declaration with INCLUDING instead of a copula: `Tools INCLUDING search, lookup, escalate`.\nconst INCLUDING_RE = new RegExp(`\\\\b(${NAME_WORD})\\\\s+(?:INCLUDING|including)\\\\s+(.+)$`, 'du');\n\n// A declaration's ITEMS — the set of things it asserts about the name, for redundancy/conflict\n// checks. A copula value splits on AND into conjuncts (`Braden AND a silly guy` → [Braden, a silly\n// guy]); an INCLUDING list splits on commas (`search, lookup` → [search, lookup]). Both are\n// conjunctive — the name has all of them — so a sub-list/sub-conjunction adds nothing (redundant).\nexport function findDeclaredItems(\n text: string,\n): { name: string; items: string[]; negated: boolean; list?: boolean } | null {\n const clean = stripInlineComment(text);\n if (!bindsHere(clean)) return null;\n const inc = maskQuotes(clean).match(INCLUDING_RE);\n if (inc?.indices) {\n const nameIx = inc.indices[1];\n const listIx = inc.indices[2];\n const name = nameIx ? clean.slice(nameIx[0], nameIx[1]) : '';\n const list = listIx ? clean.slice(listIx[0], listIx[1]) : '';\n // stripPunct drops the list's statement terminator (`…search, lookup.` → the last item is\n // `lookup`, not `lookup.`) — before stripQuotes, so a quoted final item keeps its punctuation.\n const items = stripQuotes(stripPunct(list)).split(',').map((s) => s.trim()).filter((s) => s !== '');\n // `list: true` marks a MEMBERSHIP declaration — its items are members of a collection (they prove a\n // lower bound on |S|), unlike copula items, which are traits of one object and bound nothing.\n return { name, items, negated: false, list: true };\n }\n const d = findDeclaration(clean);\n if (!d) return null;\n const items = d.value.split(/\\s+AND\\s+/i).map((s) => s.trim()).filter((s) => s !== '');\n return { name: d.name, items, negated: d.negated };\n}\n\nexport interface LineDecl {\n line: number;\n name: string;\n items: string[];\n negated: boolean;\n /** Property possession (`Your name is …`): the property path on `name` — `['name']`, or `['company','policy']`. */\n path?: string[];\n /** Property possession: `is`/`am` → single-valued (`one`); `are` → a set (`many`). Drives property consistency. */\n cardinality?: 'one' | 'many';\n /** Ownership possession (`the call is Sarah's`): the thing `name` owns. */\n owns?: string;\n /** A LIST declaration (`Name INCLUDING a, b`): items are collection MEMBERS, not traits. */\n list?: boolean;\n}\n\nconst BULLET_RE = /^\\s*(?:[-*+]|\\d+[.)])\\s+(.+)$/;\n// A list-header declaration — `You ARE:` / `You are NOT:` / `Your traits are:` — names an object whose\n// values are the bullets that follow. Like the inline copula, casing is irrelevant (`You ARE x` and\n// `you are x` both declare, SPEC §2); the trailing colon + list just make the list intent explicit.\nconst LIST_HEADER_RE = new RegExp(`^(${NAME_PHRASE})\\\\s+(?:is|are|am)(\\\\s+not)?\\\\s*:\\\\s*$`, 'iu');\n\n// Extract the possession(s) or standalone declaration one statement makes, pushing a LineDecl for each.\n// `seg` is parsed for possessions; `declText` is what findDeclaredItems reads — the raw line for a whole\n// line (its ANYWHERE match tolerates a bullet marker / leading text) or the sentence itself when a line\n// holds several. Returns true if anything bound. Shared by the whole-line and per-sentence paths so they\n// can't drift. A line can make several assignments at once — `Your job is X and name is Y` → job AND name.\nfunction pushDecls(seg: string, declText: string, i: number, out: LineDecl[]): boolean {\n const possessions = parsePossessions(seg);\n if (possessions.length > 0) {\n for (const poss of possessions) {\n out.push(\n poss.kind === 'property'\n ? { line: i, name: poss.owner, items: poss.items, negated: poss.negated, path: poss.path, cardinality: poss.cardinality }\n : { line: i, name: poss.owner, items: [], negated: false, owns: poss.thing },\n );\n }\n return true;\n }\n const d = findDeclaredItems(declText);\n if (d) {\n out.push({ line: i, name: d.name, items: d.items, negated: d.negated, ...(d.list ? { list: true } : {}) });\n return true;\n }\n return false;\n}\n\n/**\n * Every value bound to an object across the whole prompt — the key to treating declarations as\n * ACCUMULATION rather than competing definitions. Two shapes feed it: an inline `X IS y` (or `X ARE NOT y`),\n * and a list header `X ARE:` whose following bullets are its items (negated under `X are NOT:`). A blank\n * line, a heading, or any non-bullet line closes an open list. Consumers union the positive items per\n * object and look only for a CONTRADICTION (a trait asserted and denied) — never for mere re-declaration.\n */\nexport function resolveDeclarations(rawLines: string[]): LineDecl[] {\n const out: LineDecl[] = [];\n let header: { name: string; negated: boolean } | null = null;\n // A $TOOL block is its OWN scope: a param declaration (`zip IS a required string`) describes the tool's\n // input, not a prompt object — binding it here would make {zip} expand to its TYPE text. Mask the spans.\n const toolMask = toolBlockMask(rawLines);\n rawLines.forEach((raw, i) => {\n if (toolMask[i]) return;\n const trimmed = raw.trim();\n if (trimmed === '' || isHeadingLine(trimmed)) {\n header = null;\n return;\n }\n const bullet = raw.match(BULLET_RE);\n const clause = stripInlineComment(bullet ? (bullet[1] ?? '') : trimmed).trim();\n if (bullet && header && clause !== '') {\n // stripPunct: a bullet item's statement terminator (`- warm.`) is line punctuation, not part of\n // the trait — so conflict/redundancy matching compares `warm` to `warm` regardless of periods.\n out.push({ line: i, name: header.name, items: [stripPunct(clause)], negated: header.negated });\n return;\n }\n if (!bullet) {\n const hm = clause.match(LIST_HEADER_RE);\n if (hm) {\n header = { name: (hm[1] ?? '').trim(), negated: Boolean(hm[2]) };\n out.push({ line: i, name: header.name, items: [], negated: header.negated });\n return;\n }\n }\n // A possession (`Your name is …`, `Sarah's role is …`, `the decision is yours`) binds a property of its\n // owner — or asserts ownership — not a standalone declaration. Record it against the owner so the bare\n // property noun never becomes an object of its own. Each sentence is its own statement (sentence.ts):\n // `Your name is Joe. Your name is Bob.` makes TWO assignments, so a second same-line claim isn't\n // swallowed into the first's value (mirrors lower() / extractClauses). A single-sentence line takes the\n // whole-clause path unchanged — declarations, aliases, and objects stay byte-identical.\n const sentences = splitSentences(clause);\n if (sentences.length > 1) {\n let matched = false;\n for (const s of sentences) if (pushDecls(s.text, s.text, i, out)) matched = true;\n if (matched) {\n header = null;\n return;\n }\n } else if (pushDecls(clause, raw, i, out)) {\n header = null;\n return;\n }\n if (!bullet) header = null;\n });\n return out;\n}\n\n// A standalone `X is/are <ProperName>` makes <ProperName> an ALIAS of X — another name for the same object,\n// so `Sarah's job …` folds into `You` when `You are Sarah`. The value (or its first comma-segment) aliases\n// only if it's a bare proper noun — capitalized, no article: `Sarah`, `Acme`, `Mr. Appliance` — never a\n// trait like `a support agent` or `friendly`.\nfunction properNounAlias(value: string): string | null {\n const first = (value.split(',')[0] ?? '').trim();\n if (first === '' || /^(?:a|an|the)\\s/i.test(first)) return null;\n return /^\\p{Lu}[\\p{L}.]*(?:\\s+\\p{Lu}[\\p{L}.]*)*$/u.test(first) ? first : null;\n}\n\n// The subjects of every positive standalone declaration — the set of objects a value may refer to BY NAME.\nfunction declaredObjectNames(decls: LineDecl[]): Set<string> {\n return new Set(decls.filter((d) => !d.negated && !d.path && !d.owns).map((d) => d.name.toLowerCase()));\n}\n\n// `That is you`, `it is that` — a value that names another object through an identity PRONOUN. The value\n// aliases its subject (the two are one and the same object) when it's a bare pronoun (`you`/`it`/`that`/… —\n// the UNHIGHLIGHTED_NAMES set) that is ALSO a declared object. Restricting to pronouns is what keeps this\n// sound: a pronoun carries identity, but a common word stays a TRAIT even when it happens to be declared\n// elsewhere — `You are nice` (with a `Nice is a virtue` above it) is a trait, not `you ≡ the nice object`.\n// Proper-noun naming (`You are Sarah`) is the separate, capitalized path through properNounAlias. The trailing\n// punctuation is kept on the returned name so the caller's `value.slice(name.length)` consumes it cleanly.\nfunction objectRefAlias(value: string, declaredNames: Set<string>): string | null {\n const first = (value.split(',')[0] ?? '').trim();\n const key = stripPunct(first).toLowerCase();\n return first !== '' && UNHIGHLIGHTED_NAMES.has(key) && declaredNames.has(key) ? first : null;\n}\n\n/**\n * alias key (lowercased) → canonical object key, resolved transitively. `You are Sarah` ⇒ sarah → you; a\n * later `Sarah are Sally` ⇒ sally → you too. Only a positive STANDALONE declaration aliases — a possession\n * or a negation never does. Self-aliases and cycles are dropped.\n */\nexport function aliasMap(decls: LineDecl[]): Map<string, string> {\n const direct = new Map<string, string>();\n const declaredNames = declaredObjectNames(decls);\n for (const d of decls) {\n if (d.negated || d.path || d.owns) continue;\n for (const item of d.items) {\n const nm = properNounAlias(item) ?? objectRefAlias(item, declaredNames);\n if (!nm) continue;\n // Strip a trailing sentence period so `You are Sarah.` keys as `sarah`, matching a bare `Sarah` mention\n // and a `Sarah's …` possession (`Dr. Smith.` -> `dr. smith`; an honorific's own period is kept).\n const ak = stripPunct(nm).toLowerCase();\n const ck = d.name.toLowerCase();\n if (ak !== ck && !direct.has(ak)) direct.set(ak, ck);\n }\n }\n const canon = (k: string): string => {\n const seen = new Set<string>();\n let cur = k;\n while (direct.has(cur) && !seen.has(cur)) {\n seen.add(cur);\n cur = direct.get(cur) ?? cur;\n }\n return cur;\n };\n const resolved = new Map<string, string>();\n for (const k of direct.keys()) resolved.set(k, canon(k));\n return resolved;\n}\n\nexport interface PropertyValue {\n /** Values assigned to the property — unioned across declarations, in first-seen order. */\n values: string[];\n /** `one` (singular copula `is`/`am` — a single value; re-assigning a different one conflicts) or `many`\n * (plural `are` — a set that accumulates). */\n cardinality: 'one' | 'many';\n /** The claimed SIZE of the owner's set, from possessive-have cardinality claims (`You have only one\n * tool` → you.tool count [1,1]). Same intersection/first-claim rules as DeclaredObject.count. */\n count?: { lo: number; hi: number; lines: number[] };\n /** 0-based line indices where the property is assigned. */\n lines: number[];\n}\n\nexport interface DeclaredObject {\n /** Canonical (first-declared) casing of the name. */\n name: string;\n /** Every unnamed trait declared for it — the union of items across declarations, in first-seen order. */\n items: string[];\n /** Named fields from possessions (`Your name is Joe` → `name` ↦ {values:[\"Joe\"], cardinality:\"one\"}), keyed\n * by dotted path (`company.policy` for a nested possessive). */\n properties: Map<string, PropertyValue>;\n /** Things this object OWNS, from predicate possessives (`the call is Sarah's` → `sarah` owns \"call\"). */\n owns: string[];\n /** Other names for this object, from `You are Sarah` — `Sarah` is an alias of `You`; its declarations fold here. */\n aliases: string[];\n /** Members listed via `Name INCLUDING a, b` — a LIST declaration's items (never copula traits). The list\n * itself proves |S| ≥ length, which the quantifier layer checks against any claimed count. */\n listMembers?: string[];\n /** The claimed size of the set, from existential-there cardinality claims (`There is only one tool` →\n * [1,1]). The INTERSECTION of every unguarded claim; if a later claim would empty it, the first claim is\n * kept — the builder stays total, and the conflict is the quantifier checker's to report. */\n count?: { lo: number; hi: number; lines: number[] };\n /** 0-based line indices where it is declared. */\n lines: number[];\n}\n\n// The object table: every name a positive declaration binds, keyed lowercase — objects are\n// case-insensitive, so `You` and `you` are the same object. A bare mention of a declared name is a\n// reference to that object (what the editor highlights and hovers). A negated copula asserts a fact,\n// it doesn't define a value, so it never creates an object; `findDeclaredItems` already excludes\n// conditionals/directives and quoted spans, so those can't accidentally declare either.\nexport function collectObjects(rawLines: string[]): Map<string, DeclaredObject> {\n // A `@@` statement annotation is inert authoring metadata — strip its note so nothing inside one DECLARES an\n // object (a leading `@@` line strips to nothing; a trailing note drops, keeping its statement). A definition\n // body or literal-zone interior is PARSE-literal — reference prose and samples, never bindings — so those\n // lines blank wholesale (`these forms are compile-time scaffolding.` in a cheat-sheet row must not declare a\n // \"forms\" object the rest of the file then lights up). Line indices are preserved, so an object's `lines`\n // still point at real declarations. This is the single chokepoint every caller (compile's property pass, the\n // editor's object highlight and hover) flows through, so exclusion is uniform.\n const literal = examplesMask(rawLines);\n const decls = resolveDeclarations(rawLines.map((l, i) => (literal[i] ? '' : stripAnnotation(l))));\n // Aliases fold every name for an object onto one canonical key, so `Sarah's …` lands on `You`.\n const aliases = aliasMap(decls);\n const declaredNames = declaredObjectNames(decls);\n const canon = (key: string): string => aliases.get(key) ?? key;\n const objects = new Map<string, DeclaredObject>();\n for (const d of decls) {\n // A negated copula asserts a fact, it doesn't bind a value, so it never creates an object.\n if (d.negated) continue;\n const subjKey = d.name.toLowerCase();\n const key = canon(subjKey);\n let obj = objects.get(key);\n if (!obj) {\n obj = { name: d.name, items: [], properties: new Map(), owns: [], aliases: [], lines: [] };\n objects.set(key, obj);\n }\n // The canonical subject's own casing wins for the display name (`You`, not an aliased `Sarah`).\n if (subjKey === key) obj.name = d.name;\n if (!obj.lines.includes(d.line)) obj.lines.push(d.line);\n if (d.owns) {\n // Predicate possession (`the call is Sarah's`): the owner gains an owned thing, not a trait.\n if (!obj.owns.includes(d.owns)) obj.owns.push(d.owns);\n } else if (d.path) {\n // A property possession's value belongs to its named field (keyed by dotted path), not the trait list.\n const pathKey = d.path.join('.');\n const pv: PropertyValue = obj.properties.get(pathKey) ?? { values: [], cardinality: 'one', lines: [] };\n // A field is a SET if ANY assignment to it is a list/are; one lone `is` value keeps it single-valued.\n if (d.cardinality === 'many') pv.cardinality = 'many';\n for (const it of d.items) if (!pv.values.includes(it)) pv.values.push(it);\n if (!pv.lines.includes(d.line)) pv.lines.push(d.line);\n obj.properties.set(pathKey, pv);\n } else {\n // A LIST declaration's items are MEMBERS of the collection — they also prove |S| ≥ length, so the\n // quantifier layer can check them against any claimed count (\"Tools INCLUDING a, b\" vs \"only one tool\").\n if (d.list) {\n const members = obj.listMembers ?? [];\n for (const it of d.items) if (!members.includes(it)) members.push(it);\n obj.listMembers = members;\n }\n for (const it of d.items) {\n // A proper-noun value is an ALIAS (another name), not a trait — record it under aliases and keep any\n // trailing description as a trait (`Sarah, a support assistant` → alias `Sarah`, trait `a support assistant`).\n const nm = properNounAlias(it) ?? objectRefAlias(it, declaredNames);\n if (nm) {\n // Store the alias with its trailing sentence period stripped (`Dr. Smith.` -> `Dr. Smith`) so it\n // keys cleanly; the ORIGINAL `nm` length still drives the slice that splits off any trailing trait.\n const alias = stripPunct(nm);\n if (alias.toLowerCase() !== key && !obj.aliases.includes(alias)) obj.aliases.push(alias);\n const rest = it.slice(nm.length).replace(/^\\s*,\\s*/, '').trim();\n if (rest !== '' && !obj.items.includes(rest)) obj.items.push(rest);\n } else if (!obj.items.includes(it)) {\n obj.items.push(it);\n }\n }\n }\n }\n\n // Cardinality claims fold onto the graph — a count is a fact ABOUT the set, stored like any other fact\n // (the quantifier layer proves conflicts; this builder just records). Only UNCONDITIONAL claims enter:\n // a guarded/conditional count (`IF weekend THEN there is only one tool`, a `$IF` arm) is not a standing\n // property. The noun resolves with NUMBER FOLDING — `there is only one tool` attaches to an existing\n // `tools` object (`Tools INCLUDING …`) rather than splitting the graph on grammatical number.\n rawLines.forEach((raw, i) => {\n if (literal[i]) return;\n const line = stripInlineComment(stripAnnotation(raw));\n const text = line.replace(BULLET_RE, '$1').trim();\n if (text === '' || text.startsWith('//') || isHeadingLine(text)) return;\n if (/^\\$?(?:IF|ELSE)\\b/i.test(text) || /\\bIF\\b.+\\bTHEN\\b/i.test(text)) return; // conditional — not a standing count\n const bound = parseCardinalBody(maskQuotes(text));\n if (!bound) return;\n // TAIL-SCOPED claims stay checker-only: `the only person on this earth` bounds a QUALIFIED set, and the\n // graph stores only unqualified set sizes (folding both would let the graph disagree with the checker's\n // tail-respecting buckets).\n if (bound.tail !== '') return;\n // A POSSESSIVE-have claim bounds the OWNER's set: it lands on the owner object's property [noun] as a\n // count (`You have only one tool` → you.tool count [1,1]), never on a world-level noun object.\n if (bound.owner !== undefined) {\n const ownerKey = canon(bound.owner);\n let owner = objects.get(ownerKey);\n if (!owner) {\n owner = { name: bound.owner, items: [], properties: new Map(), owns: [], aliases: [], lines: [] };\n objects.set(ownerKey, owner);\n }\n if (!owner.lines.includes(i)) owner.lines.push(i);\n const pv: PropertyValue = owner.properties.get(bound.noun) ?? { values: [], cardinality: 'one', lines: [] };\n const plo = Math.max(pv.count?.lo ?? 0, bound.lo);\n const phi = Math.min(pv.count?.hi ?? Infinity, bound.hi);\n pv.count =\n plo <= phi\n ? { lo: plo, hi: phi, lines: [...(pv.count?.lines ?? []), i] }\n : { lo: pv.count?.lo ?? bound.lo, hi: pv.count?.hi ?? bound.hi, lines: [...(pv.count?.lines ?? []), i] };\n if (!pv.lines.includes(i)) pv.lines.push(i);\n owner.properties.set(bound.noun, pv);\n return;\n }\n const candidates = [bound.noun, pluralizeNoun(bound.noun)].map((k) => canon(k)); // person ⇄ people, tool ⇄ tools\n const key = candidates.find((k) => objects.has(k)) ?? bound.noun;\n let obj = objects.get(key);\n if (!obj) {\n obj = { name: bound.noun, items: [], properties: new Map(), owns: [], aliases: [], lines: [] };\n objects.set(key, obj);\n }\n if (!obj.lines.includes(i)) obj.lines.push(i);\n const prev = obj.count;\n const lo = Math.max(prev?.lo ?? 0, bound.lo);\n const hi = Math.min(prev?.hi ?? Infinity, bound.hi);\n obj.count =\n lo <= hi\n ? { lo, hi, lines: [...(prev?.lines ?? []), i] }\n : { lo: prev?.lo ?? bound.lo, hi: prev?.hi ?? bound.hi, lines: [...(prev?.lines ?? []), i] }; // empty → keep first, checker reports\n });\n return objects;\n}\n\nexport interface ObjectOccurrence {\n /** 0-based line index. */\n line: number;\n /** 0-based start column, inclusive. */\n start: number;\n /** 0-based end column, exclusive. */\n end: number;\n /** Lowercased object key this mention resolves to. */\n name: string;\n}\n\n// Every bare mention of a declared object across the source — what the editor highlights. Quoted spans (raw\n// strings), inline `//` comments, and comment lines are skipped, since a mention there is text, not a\n// reference. Column offsets survive masking because the masks are length-preserving.\n// Pronouns and other ubiquitous words (you, it, this, …) can be declared objects. Highlighting EVERY \"you\"\n// would be noise — but once \"you\" is DECLARED it carries meaning, so a pronoun is highlighted only from its\n// first declaration line onward (reading the prompt top to bottom): a plain `you` before any declaration is\n// not yet a reference. A distinctive name you declare (Persona, Tone, …) highlights everywhere it's mentioned.\nexport const UNHIGHLIGHTED_NAMES = new Set([\n 'you', 'your', 'yours', 'i', 'me', 'my', 'mine', 'we', 'us', 'our', 'ours',\n 'it', 'its', 'they', 'them', 'their', 'theirs', 'he', 'him', 'his', 'she', 'her', 'hers',\n 'this', 'that', 'these', 'those',\n]);\n\nexport function objectOccurrences(rawLines: string[]): ObjectOccurrence[] {\n const objects = collectObjects(rawLines);\n if (objects.size === 0) return [];\n // Highlightable words → the object key they reference. An object key references itself; a possessive — a\n // determiner (`your` → you) OR an absolute (`yours` → you) — references its OWNER when that owner is a\n // declared object, so `your`/`yours` highlight wherever `you` does, standing in for the same object.\n const refOf = new Map<string, string>();\n for (const key of objects.keys()) refOf.set(key, key);\n // NUMBER FOLDING — an object's mentions come in both grammatical numbers: `tool`/`tools` and the\n // irregulars `person`/`people` are ONE object (the cardinality fold already keys claims that way), so\n // each key registers its other-number variant when that spelling is free. Lemmatization comes from the\n // shared noun-identity layer (cardinality.ts → pluralize), never a local `s` hack. Registered BEFORE\n // determiners/aliases so a real object never loses a word to a variant, and after self-registration so\n // an explicitly-declared variant object beats a derived one.\n for (const key of objects.keys()) {\n const sing = singularizeNoun(key);\n const variant = sing === key ? pluralizeNoun(key) : sing;\n if (variant.length > 1 && variant !== key && !refOf.has(variant)) refOf.set(variant, key);\n }\n for (const [word, owner] of [...Object.entries(DETERMINER), ...Object.entries(ABSOLUTE)]) {\n if (objects.has(owner) && !refOf.has(word)) refOf.set(word, owner);\n }\n // An alias names its object too: `You are Sarah` makes `Sarah` (and `Dr. Smith`, …) a reference to the\n // you-object wherever it appears, exactly like the object's own name.\n for (const [key, obj] of objects) {\n for (const alias of obj.aliases) {\n const ak = alias.toLowerCase();\n if (!refOf.has(ak)) refOf.set(ak, key);\n }\n }\n // The earliest line a mention counts as a reference. Gate on the matched WORD, not the object it resolves\n // to: a common pronoun/possessive (`you`, `your`, `yours`) is a reference only from its owner's first\n // declaration onward (a `you` before it's defined stays plain); a distinctive name — an object's own name\n // OR an alias (`Sarah`, `Dr. Smith`) — lights up everywhere, even when it resolves to the pronoun `you`.\n const liveFrom = (word: string, key: string): number => {\n if (!UNHIGHLIGHTED_NAMES.has(word)) return 0;\n const obj = objects.get(key);\n return obj ? Math.min(...obj.lines) : 0;\n };\n // Keys may now contain a honorific's `.` and space (`mr. jones`), so escape regex metacharacters and try\n // longest-first — `mr. jones` must win over a bare `jones` key at the same position.\n const escapeRe = (s: string): string => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const alternation = [...refOf.keys()].sort((a, b) => b.length - a.length).map(escapeRe).join('|');\n // Unicode-aware boundaries (JS `\\b` is ASCII-only, so it can't bound `José`).\n const re = new RegExp(`${NAME_BOUNDARY_OPEN}(${alternation})${NAME_BOUNDARY_CLOSE}`, 'giu');\n const kinds = classifyLines(rawLines);\n const out: ObjectOccurrence[] = [];\n // Literal zones (<examples> / <\"name\">) and fenced code are illustration — a \"you\" in a sample or a\n // reference table is not a mention of the prompt's object, so nothing inside highlights gold.\n const litMask = examplesMask(rawLines);\n let inFence = false;\n rawLines.forEach((line, i) => {\n const t = line.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return;\n }\n if (inFence || litMask[i]) return;\n if (kinds[i] === 'comment' || isHeadingLine(line)) return; // a heading is only ever a heading — no object mentions inside it\n // A `@@` statement annotation is inert — strip its note so no object MENTION inside one highlights (a leading\n // `@@` line strips to nothing; a trailing note is removed, keeping the statement's mentions at their columns).\n const masked = maskQuotes(stripAnnotation(line)).replace(/\\s+\\/\\/.*$/, (m) => ' '.repeat(m.length));\n re.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = re.exec(masked)) !== null) {\n const word = m[0].toLowerCase();\n const key = refOf.get(word) ?? word;\n if (i < liveFrom(word, key)) continue; // a pronoun/possessive before its owner's declaration isn't a reference yet\n out.push({ line: i, start: m.index, end: m.index + m[0].length, name: key });\n }\n });\n return out;\n}\n\n// ── THE ADDRESSEE MODEL (SPEC §7) — who \"you\" is, resolved from the prompt's own declarations ──────────\n// Every directive has a subject; when none is written it is the ADDRESSEE, `you` — and `you` is a value,\n// not an absence. Rules 2–3 extend the grammar rule (rule 1, per tier): a DECLARED ALIAS (`You are\n// Claude` → `claude`) and a DECLARED ROLE (`You are a support agent` → `support agent`, both numbers)\n// resolve to `you`, so `Claude must never quote prices` and `Always quote prices` are one subject's rules.\n// Only the prompt's own declarations fold — an undeclared `the assistant` stays scoped (no guessing);\n// projects can opt extra nouns in via glish.tgc (`$CONFIG addressee …`), threaded through `extra`.\n//\n// The never-addressee rail: the OTHER PARTY of a conversation is never the addressee, whatever the\n// style — folding `the user must verify` into `you` would invert who a rule binds. Checker-lexicon\n// (deliberately fuzzy, like logic.ts's deontic lists) — not lexicon.ts operators.\nconst NEVER_ADDRESSEE = new Set(['user', 'customer', 'caller', 'human', 'visitor', 'they', 'them']);\n\n/** Subject phrases that RESOLVE TO `you` — lowercased, article-free, both grammatical numbers of the\n * head noun. Consumed by the deontic tier (via diagnostics), the quantifier layer, and hover. Pure. */\nexport function addresseeSubjects(rawLines: string[], extra: readonly string[] = []): Set<string> {\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const out = new Set<string>();\n const add = (phrase: string): void => {\n const stripped = phrase.trim().toLowerCase().replace(/^(?:the|a|an)\\s+/, '').replace(/[.,;:!?]+$/, '').trim();\n if (stripped === '' || stripped === 'you') return;\n const words = stripped.split(/\\s+/);\n const last = words[words.length - 1] ?? '';\n if (NEVER_ADDRESSEE.has(stripped) || NEVER_ADDRESSEE.has(singularizeNoun(last))) return;\n out.add(stripped);\n const other = singularizeNoun(last) === last ? pluralizeNoun(last) : singularizeNoun(last);\n if (other !== last && other.length > 1) out.add([...words.slice(0, -1), other].join(' '));\n };\n for (const [alias, target] of aliases) if (target === 'you') add(alias); // rule 2 — declared names\n for (const d of decls) {\n const canon = aliases.get(d.name.toLowerCase()) ?? d.name.toLowerCase();\n if (canon !== 'you' || d.negated) continue;\n for (const item of d.items) if (/^an?\\s+/i.test(item)) add(item); // rule 3 — declared roles (`a support agent`)\n }\n for (const e of extra) add(e); // the glish.tgc dial — rule 4, config-only\n return out;\n}\n\n// `Animals ARE one of alligator, orangutan, monkey` — a closed, mutually-exclusive set. Its members\n// are pairwise disjoint, so an object declared as two different members is a contradiction. The\n// copula stays UPPERCASE syntax; \"one of\" is matched leniently.\nexport function findEnumDeclaration(text: string): { name: string; members: string[] } | null {\n const d = findDeclaration(stripInlineComment(text));\n if (!d || d.negated) return null;\n const m = d.value.match(/^one\\s+of\\s*(:)?\\s*(.+)$/i);\n if (!m) return null;\n const members = (m[2] ?? '').split(',').map((s) => s.trim()).filter((s) => s !== '');\n // MEMBERSHIP IDIOM, not a declaration: a colon-free `one of` whose single \"member\" is quantity-led\n // (`You are one of many people on this earth`, `…one of three admins…`) is the cardinality frame's\n // territory — it bounds a set's SIZE, it never declares a closed set. The explicit-colon form\n // (`Status IS one of: a, b`) stays a declaration.\n if (m[1] === undefined && members.length === 1 && isCardinalQuantityLead(members[0] ?? '')) return null;\n return members.length > 0 ? { name: d.name, members } : null;\n}\n\n// A `@[tool]` reference inlines a `$TOOL` definition's schema — `name — description` — so a prompt's tool\n// list stays in sync with the definitions it documents (write the description once, reference it). The\n// pointer is THE tool reference (a bare exact tool name in prose is `structure/bare-tool-ref`), and the\n// emit is layout-aware: a pointer ALONE on its line (optionally bulleted/terminated) is a LISTING row and\n// surfaces the defined tool's `name — description`; inline in a statement it emits just the checked bare\n// name — a rule references the tool, it never wants the description spliced mid-sentence. An IMPORTED\n// tool has no local schema, so its pointer emits the bare name in both positions; an unknown name is\n// left raw for the diagnostics layer to flag. A defined tool with an empty description degrades to name.\nfunction expandToolRefs(text: string, tools: Map<string, string>, imported?: Set<string>): string {\n if (tools.size === 0 && (imported?.size ?? 0) === 0) return text;\n const standalone = /^\\s*(?:[-*]\\s+)?@\\[[a-z][a-z0-9_]*\\]\\s*\\.?\\s*$/i.test(text);\n return text.replace(/@\\[([a-z][a-z0-9_]*)\\]/gi, (whole, name: string) => {\n const key = name.toLowerCase();\n if (tools.has(key)) {\n const desc = tools.get(key) ?? '';\n return standalone && desc !== '' ? `${name} — ${desc}` : name;\n }\n return imported?.has(key) === true ? name : whole;\n });\n}\n\nfunction expandRefs(text: string, decls: Map<string, string>): string {\n // ONE reference family: only the `@{name}` pointer participates. A declared name (`Name IS …`) splices\n // its value; an undeclared pointer emits the bare `{name}` runtime placeholder (the `@` is compile-time\n // syntax and never reaches the model — the host fills `{name}` per conversation). BARE braces are prose:\n // they flow through byte-identical, whatever they wrap (the retired-brace-ref guard catches the old\n // reference spelling at check time, so nothing silently stops expanding).\n // Iterate so a declaration whose value references another declaration resolves through;\n // the pass cap stops a circular reference (A = @{B}, B = @{A}) from looping forever.\n let cur = text;\n for (let pass = 0; pass < 5; pass += 1) {\n // Case-insensitive lookup: declare with a capital (proper-noun style), point in any case.\n const next = cur.replace(/@\\{([A-Za-z0-9_.]+)\\}/g, (_whole, name: string) => decls.get(name.toLowerCase()) ?? `{${name}}`);\n if (next === cur) break;\n cur = next;\n }\n return cur;\n}\n\n// ── Emit-time layout: the compiler owns how compiled lines pack ──────────────────────────────────\n// A compiled line is FLOW prose (packs together), a BLANK (paragraph break), or KEEP (stands on its\n// own line: list items, ordinals, markdown headings, section tags, definition blocks, fenced/literal\n// interiors). This is the emit-time counterpart to the source-side layout rules.\ntype CompiledKind = 'flow' | 'blank' | 'keep';\n\nconst COMPILED_LIST_ITEM = /^\\s*(?:[-*+]\\s|(?:\\d{1,9}|[a-z])[.)]\\s)/i;\n\n/** Classify a compiled PLAIN-content line for the join pass. Structural lines keep their own line; a\n * blank separates; everything else is flow prose. Verbatim and definition-block lines are tagged\n * KEEP at their push site, so this only ever sees genuine plain content — string inspection is safe. */\nfunction classifyCompiledLine(text: string): CompiledKind {\n if (text.trim() === '') return 'blank';\n const t = text.trimStart();\n if (t.startsWith('<') || t.startsWith('#') || COMPILED_LIST_ITEM.test(text)) return 'keep';\n return 'flow';\n}\n\n/** Pack the compiled stream the way the model should read it: consecutive FLOW lines at the same\n * indent (no blank between) merge onto one line — an author's editor line-wrapping never reaches the\n * model; a blank line is a paragraph break (a run collapses to one); KEEP lines always stand alone.\n * Leading and trailing blanks drop. This is where \"the compiler owns the emitted layout\" lives. */\nfunction joinCompiledLines(lines: string[], kinds: CompiledKind[]): string[] {\n const res: string[] = [];\n let buf: string | null = null; // the flow paragraph being accumulated\n let bufIndent = '';\n let pendingBlank = false;\n const flush = (): void => {\n if (buf !== null) {\n res.push(buf);\n buf = null;\n bufIndent = '';\n }\n };\n for (let i = 0; i < lines.length; i += 1) {\n const text = lines[i] ?? '';\n const kind = kinds[i] ?? 'flow';\n if (kind === 'blank') {\n pendingBlank = true;\n continue;\n }\n if (kind === 'flow') {\n const indent = (text.match(/^ */) ?? [''])[0];\n if (buf !== null && !pendingBlank && indent === bufIndent) {\n buf += ` ${text.slice(indent.length)}`; // pack onto the paragraph, dropping the repeated indent\n } else {\n flush();\n if (pendingBlank && res.length > 0) res.push('');\n buf = text;\n bufIndent = indent;\n }\n } else {\n flush();\n if (pendingBlank && res.length > 0) res.push('');\n res.push(text);\n }\n pendingBlank = false;\n }\n flush();\n while (res.length > 0 && (res[0] ?? '').trim() === '') res.shift();\n while (res.length > 0 && (res[res.length - 1] ?? '').trim() === '') res.pop();\n return res;\n}\n\n/**\n * A prompt as an ordered list of addressable lines.\n *\n * Lines carry a stable `id` (the address) separate from their `n` (display number),\n * so toggling or editing one line never changes what another line's id refers to.\n * `render()` emits the enabled, non-comment lines; `without()` is leave-one-out ablation.\n */\nexport class PromptDoc {\n readonly lines: PromptLine[];\n\n constructor(lines: PromptLine[]) {\n this.lines = lines;\n }\n\n static parse(text: string): PromptDoc {\n const raw = text.replace(/\\r\\n/g, '\\n').split('\\n');\n // Drop the single empty element a trailing newline produces.\n if (raw.length > 1 && raw[raw.length - 1] === '') raw.pop();\n const kinds = classifyLines(raw);\n const lines = raw.map(\n (t, i): PromptLine => ({\n id: `L${i + 1}`,\n n: i + 1,\n text: t,\n enabled: true,\n kind: kinds[i] ?? 'content',\n }),\n );\n return new PromptDoc(lines);\n }\n\n /** Content lines — the candidates for ablation (blank and comment lines are excluded). */\n contentLines(): PromptLine[] {\n return this.lines.filter((l) => l.kind === 'content');\n }\n\n byId(id: string): PromptLine | undefined {\n return this.lines.find((l) => l.id === id);\n }\n\n // Enabled, non-comment lines joined back to a prompt string. Whole-line comments are dropped; trailing\n // `//` inline comments are stripped (but left intact inside fenced code). A declaration (`Name IS value`)\n // BOTH registers `Name` (so {Name} places its value, and the consistency checker reasons over it) AND\n // renders as the instruction it is — binding and use are the same statement, not a hidden definition. Only\n // IMPORT lines and comments are stripped; everything else reaches the model.\n render(): string {\n const texts = this.lines.map((l) => l.text);\n const mask = fenceMask(texts);\n // A $TOOL block is a DEFINITION, not prompt content: it compiles into the agent's tool schemas (see\n // tool.ts), never into the prompt the model reads — and nothing inside it binds an object.\n const toolMask = toolBlockMask(texts);\n // `@[tool]` inlines a `$TOOL` definition's `name — description`. The defs are stripped from the prompt\n // (they compile into the agent's schemas), so capture their descriptions here before they're masked out.\n const toolDescs = new Map<string, string>();\n for (const t of parseTools(texts).tools) toolDescs.set(t.name.toLowerCase(), t.description);\n // Imported tools have no local schema — their pointer emits the bare (checked) name.\n const importedToolKeys = toolsFromLines(texts);\n const decls = new Map<string, string>();\n this.lines.forEach((l, i) => {\n if (!l.enabled || l.kind === 'comment' || mask[i] || toolMask[i]) return;\n // Bind from a declaration ANYWHERE in the line (mid-sentence too), keyed lowercase so refs\n // resolve case-insensitively. Only a positive copula binds a value.\n const d = findDeclaration(stripAnnotation(stripInlineComment(l.text)));\n if (d && !d.negated) decls.set(d.name.toLowerCase(), d.value);\n });\n // Property references: `{Object.field}` — and `{Alias.field}`, since an alias resolves to its object —\n // expand to the field's value(s). `{You.name}` → Joe; `{Sarah.name}` → Joe when `You are Sarah`.\n const active = this.lines.filter((l) => l.enabled && l.kind !== 'comment').map((l) => l.text);\n for (const [key, obj] of collectObjects(active)) {\n for (const [path, pv] of obj.properties) {\n const value = pv.values.join(', ');\n decls.set(`${key}.${path}`, value);\n for (const alias of obj.aliases) decls.set(`${alias.toLowerCase()}.${path}`, value);\n }\n }\n const out: string[] = [];\n const kinds: CompiledKind[] = []; // parallel to `out`: how each emitted line packs at join time\n // A $TEST block (header + `- input::`/`- expect::` bullets) is the file's own eval suite — control-plane by the\n // $-rule, so the whole extent strips. Computed over the full line array (disabled lines keep\n // their text) so extents stay aligned with indices. A <$CONFIG> section is the same rule at\n // section scale: its whole extent (tags + body) is scaffolding the model never sees.\n const testLines = testBlockLines(texts);\n // An $EXAMPLE block is part control-plane, part content: its SCAFFOLDING strips (exampleLines), but\n // at the header line it EMITS a few-shot `<example>User: …\\nAssistant: …</example>` pair (GOOD only —\n // BAD is held out). Errored blocks aren't in exampleStart, so they emit nothing (the gate flags them).\n const exampleLines = exampleBlockLines(texts);\n const exampleStart = new Map(parseExamples(texts).filter((e) => e.error === null).map((e) => [e.headerLine, e] as const));\n const cfgMask = configSectionMask(texts);\n // Layer 1 — render is TOTAL over control-plane: any chain the bag didn't resolve becomes\n // sigil-free conditional prose here, so `$` reads never reach the model. Arm lines → their `If …:` phrases,\n // each arm marker → its `If …:` / `Otherwise:` phrase, arm bodies kept. Inline switches collapse to\n // their default arm on each surviving line (below).\n const switchRw = switchProseRewrite(texts);\n // A `?`-prefixed section tag (`<?example>` / `</?example>`) is a TRANSPARENT wrapper: authoring-only, so the\n // tag token strips from the compiled prompt but its BODY flows through (few-shot the model still reads). A\n // whole-line wrapper becomes empty and drops; a same-line `<?x> hi` keeps `hi`. (A `<$…>` section strips its\n // WHOLE extent — that's cfgMask above.) Matches an optional attribute run (`<?example when=…>`) inside the tag.\n const QUIET_WRAPPER = /<\\/?\\?[a-z][a-z0-9_]*(?:\\s[^>]*)?>/gi;\n // A `<\"name\">` LITERAL section: its interior reaches the model byte-identical — comments, `@@` notes,\n // quotes, `{refs}`, `$`-words are all content there, not scaffolding. The tag lines themselves emit with\n // the quote sigil dropped (`<\"name\">` → `<name>`) — the same §6 law that strips an inline \"…\" span.\n const litMask = literalSectionMask(texts);\n const defMask = defListMask(texts);\n // Each definition entry emits as ONE composed markdown block at its start line (prose joined,\n // sub-items nested, samples fenced) — the member lines below it emit nothing of their own.\n const defStart = new Map(defEntries(texts).map((e) => [e.line, e]));\n const LITERAL_SIGIL = /<(\\/?)\"([a-z][a-z0-9_]*)\"(?=[\\s>])/gi;\n this.lines.forEach((l, i) => {\n if (!l.enabled || l.kind === 'comment' || toolMask[i] || cfgMask[i]) return;\n if (testLines.has(i)) return;\n const ex = exampleStart.get(i);\n if (ex) {\n // The block's header line stands in for the whole block: emit its few-shot exchange here…\n const block = renderExample(ex);\n out.push(...block);\n for (let b = 0; b < block.length; b += 1) kinds.push('keep'); // few-shot lines are verbatim, never packed\n return;\n }\n if (exampleLines.has(i)) return; // …and every other line of the block emits nothing of its own.\n if (defMask[i]) {\n // Checked BEFORE the fence branch: a fenced sample inside a definition body is part of the\n // entry's composed block, not a free-standing code fence.\n const eDef = defStart.get(i);\n if (eDef) {\n const block = renderDefBlock(texts, eDef);\n out.push(...block);\n for (let b = 0; b < block.length; b += 1) kinds.push('keep'); // a def block is pre-composed markdown\n }\n return;\n }\n if (mask[i]) {\n out.push(l.text); // fenced code — verbatim (a chain inside a code sample is not control-plane)\n kinds.push('keep');\n return;\n }\n if (litMask[i]) {\n out.push(l.text); // a literal section's interior — verbatim, same rule as a fence\n kinds.push('keep');\n return;\n }\n const swr = switchRw.get(i);\n if (swr === null) return; // dropped chain scaffolding (a between-arm blank)\n // A leading `@@` line is a STATEMENT ANNOTATION for the line below it — authoring metadata, never compiled.\n // (A `@@` that trails content is stripped by stripAnnotation below, keeping the statement.)\n if (isAnnotationLine(swr ?? l.text)) return;\n const stripped = stripAnnotation(stripInlineComment(swr ?? l.text)); // strip a trailing // comment AND a @@ annotation\n // A $-command ($IMPORT / $REQUIRE / $CONFIG / $DEFINE) is author-facing scaffolding — it configures\n // compilation (the external surface, a required variable, the compile target, a named condition) but is\n // never sent to the model, so strip it.\n if (IMPORT_RE.test(stripped) || IMPORT_FILE_RE.test(stripped) || REQUIRE_RE.test(stripped) || CONFIG_RE.test(stripped) || DEFINE_RE.test(stripped)) return;\n // A declaration (`You are Joe`) is NOT a hidden assignment: it is at once the binding (the fact the\n // consistency checker reads, registered in the pass above) AND the instruction the model receives, so it\n // renders like any other line. Definition and use are the same statement — the core departure from\n // conventional programming, where a definition is separate from, and invisible at, its uses.\n // Strip quote delimiters so the literal text (refs still expand) reaches the model, not the quotes.\n // An inline `$SWITCH ON $x ( … )` collapses to its default fragment.\n const unwrapped = stripped.replace(QUIET_WRAPPER, '');\n const hadWrapper = unwrapped !== stripped; // a `<?…>` / `</?…>` wrapper was on this line\n const body = hadWrapper ? unwrapped.trim() : stripped; // strip the wrapper, keep the (trimmed) body\n if (hadWrapper && body === '') return; // the line was nothing but a `?`-wrapper tag → drop it\n // (stripQuotes above already bares a `<\"name\">` tag — quotes strip on compile; this replace is the\n // explicit emit rule for the tag position, kept so the sigil strip never rides on the span law alone.)\n const emitted = expandToolRefs(expandRefs(stripQuotes(expandInlineToProse(body)), decls), toolDescs, importedToolKeys).replace(LITERAL_SIGIL, '<$1$2');\n out.push(emitted);\n kinds.push(classifyCompiledLine(emitted));\n });\n // The manifest region — $-commands, definition blocks, and the blank lines that SEPARATE them — compiles to\n // nothing. Those separators leave a run of empty strings at the top of `out`; the prompt shouldn't open on\n // them, so drop leading blanks and start at the first real content line. (Interior/trailing blanks are the\n // author's paragraph breaks and stay.)\n // The compiler owns the emitted layout — pack consecutive flow prose, collapse blank runs, keep\n // structure (lists, headings, tags, def blocks, fences) on its own line, drop edge blanks.\n return joinCompiledLines(out, kinds).join('\\n');\n }\n\n /** A copy of this doc with the given line disabled (leave-one-out ablation). */\n without(id: string): PromptDoc {\n return new PromptDoc(this.lines.map((l) => (l.id === id ? { ...l, enabled: false } : { ...l })));\n }\n\n toData(): PromptDocData {\n return { lines: this.lines.map((l) => ({ ...l })) };\n }\n}\n","import { PromptDoc, stripIndent } from './prompt';\n\n/** Normalize a heading into a section key: \"Output Format\" → \"output_format\". Used by the structure layer so a\n * `# Closing` heading and a `<closing>` tag share the key `closing` for reference resolution — that folding is\n * an AUTHORING convenience (jump-to-definition, dangling checks), NOT a compile-time rewrite. */\nexport function tagName(heading: string): string {\n return heading.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'section';\n}\n\n/**\n * Compile the TypeGlish source into the prompt the agent runs: declarations expanded, comments and IMPORT\n * manifests stripped, cosmetic indentation removed — System then Instructions.\n *\n * Markdown headers (`# Role`) and XML tags (`<examples>…</examples>`) are PRESERVED AS AUTHORED — the two are\n * NOT interconverted. They solve different problems and the model leans on them differently: a `#` heading\n * signals document structure and semantic weight (section / subsection), while a `<tag>` marks a hard block\n * boundary the model treats as a delimiter (\"everything here is examples\"). Rewriting `#` into `<tag>` (as an\n * earlier version did) erased that distinction and made it ambiguous which one was authoritative; leaving each\n * as written keeps the signal clean. (The name is historical — the output is a compiled prompt, not only XML.)\n */\nexport function compileToXml(systemContent: string, instructionsContent: string): string {\n const parts: string[] = [];\n const sys = PromptDoc.parse(stripIndent(systemContent)).render();\n if (sys) parts.push(sys);\n const instr = PromptDoc.parse(stripIndent(instructionsContent)).render();\n if (instr) parts.push(instr);\n return parts.join('\\n\\n');\n}\n","// ── config-schema.ts · SSOT: the built-in `$CONFIG` schema ──────────────────────────────────────────────────\n// THE single source of truth for the built-in `$CONFIG` kinds + their typed params (see the SSOT registry —\n// CLAUDE.md invariant #1). A HUMBLE registry: it powers `$CONFIG` autocomplete and a gentle out-of-domain nudge,\n// never a hard rule — `$CONFIG` stays open (\"any key the runner understands is allowed\"), so an unknown key is\n// never an error. Param types are the shared `TypeExpr` (from `type-system.ts`) + two config-only wrappers.\n//\n// The schema has two layers: the compiler's BUILT-IN defaults (below), and a project's `glish.tgc`, which\n// EXTENDS them with the SAME typed-block syntax it validates — `$CONFIG modality one of voice, chat` widens a\n// domain, `$CONFIG model` + `- top_p:: number` adds a param, a new `$CONFIG <kind>` adds a whole kind.\n// `resolveConfigSchema` DEEP-merges the two (per param, so extending `model` keeps `via`) — the seam that makes\n// the language self-describing. Pure — the glish source arrives as a string (the workspace/CLI reads it).\nimport { CONFIG_RE } from './clause';\nimport { parseTypeExpr, renderTypeExpr, type TypeExpr } from './type-system';\n\n// A PARAM's value type. The SHARED TypeExpr (prim / list / one of / any of — and, after Slice 2, the refinements\n// like `between`) covers most of it; two wrappers are config-only: `service` (the value names a defined\n// `$SERVICE` — a config-plane binding, validated, never an `@<>` prompt pointer) and `object` (a NESTED param\n// block). A `.tg` SETS these as literals; a `.tgc` DECLARES them — the same text, read as a type not a value\n// (the file-kind rule). Discriminated by `kind`, so validation + rendering switch cleanly.\nexport type ConfigParamType =\n | { kind: 'service' } // the value names a defined $SERVICE\n | { kind: 'object'; params: Record<string, ConfigParamSchema> } // a nested `- name::` sub-block (composite)\n | TypeExpr; // prim | list | oneOf | anyOf (+ refinements)\n\n// A PARAM of a rich config kind — the nested `- param:: value` rows a kind like `model` carries (see\n// DESIGN-config.md). A built-in declares these in code; a `.tgc` declares/extends them in the language itself.\nexport interface ConfigParamSchema {\n detail: string;\n /** The param's value type — a shared TypeExpr or a config-only `service` / `object`. */\n type: ConfigParamType;\n /** A required param warns when missing (e.g. `model`'s `via`). */\n required?: boolean;\n /** The typed-over placeholder in the param-completion snippet. */\n placeholder?: string;\n}\n\nexport interface ConfigKeySchema {\n /** A short human hint, shown in the key completion. */\n detail: string;\n /** An ENUM domain for the HEADER value: the allowed values → a dropdown + a gentle out-of-domain nudge. */\n values?: readonly string[];\n /** For a non-enum key, the typed-over placeholder for the HEADER value in the key-completion snippet. */\n placeholder?: string;\n /** A RICH kind carries a param schema — the nested `- param:: value` rows. Simple kinds omit it (header-only). */\n params?: Record<string, ConfigParamSchema>;\n}\nexport type ConfigSchema = Record<string, ConfigKeySchema>;\n\n// The compiler's built-in defaults — the fallback when there is no `glish.tgc`. `model` is the first RICH kind:\n// its header value is a model id (validated by models.ts, so a placeholder not a domain), and its settings —\n// the transport `via` (required), `max_tokens`, `temperature` — are params. Simple kinds stay header-only.\nexport const BUILTIN_CONFIG_SCHEMA: ConfigSchema = {\n model: {\n detail: 'the target model — id on the header, settings as params',\n placeholder: 'claude-opus-4',\n params: {\n via: { detail: 'the $SERVICE that carries the request', type: { kind: 'service' }, required: true, placeholder: 'service_name' },\n max_tokens: { detail: 'the output token cap', type: { kind: 'prim', prim: 'number' }, placeholder: '8192' },\n temperature: { detail: 'sampling temperature (0.0–2.0)', type: { kind: 'prim', prim: 'number' }, placeholder: '0.3' },\n },\n },\n modality: { detail: 'the interaction channel', values: ['voice', 'chat'] },\n language: { detail: 'a language code', placeholder: 'en' },\n // A SIMPLE kind: extra addressee nouns are a flat list on the header/domain form, no params needed.\n addressee: { detail: 'extra subjects that mean \"you\" (the addressee model, SPEC §7)', placeholder: 'one of assistant, support_agent' },\n};\n\n/** A human label for a param type — the shared TypeExpr renderer plus the two config-only wrappers. */\nfunction renderParamType(t: ConfigParamType): string {\n if (t.kind === 'service') return 'a $SERVICE name';\n if (t.kind === 'object') return 'a nested block';\n return renderTypeExpr(t);\n}\n\n/** A sensible typed-over completion placeholder for a declared param type. */\nfunction placeholderFor(t: ConfigParamType): string | undefined {\n if (t.kind === 'service') return 'service_name';\n if (t.kind === 'prim') return t.prim === 'boolean' ? 'true' : t.prim === 'string' ? 'text' : '0';\n if (t.kind === 'oneOf' || t.kind === 'anyOf') return t.members[0];\n if (t.kind === 'list') return `${t.prim}, …`;\n return undefined; // object — its children carry the placeholders\n}\n\n/** Map a param's DECLARED type text (from a `.tgc` — \"number\", \"one of a, b\", \"service\", \"required string\") into\n * a ConfigParamSchema. `service` is the config-only cross-ref; everything else is a shared TypeExpr. A leading\n * `required`/`optional` marks presence (params default OPTIONAL — settings have defaults). An unparseable type\n * falls back to `string` so completion still works; step-5 meta-validation is what flags it. */\nfunction paramFromType(text: string): ConfigParamSchema {\n let t = text.trim();\n let required: boolean | undefined;\n const marker = t.match(/^(required|optional)\\s+(.+)$/i);\n if (marker) {\n required = marker[1]!.toLowerCase() === 'required';\n t = marker[2]!.trim();\n }\n let type: ConfigParamType;\n if (/^service$/i.test(t)) {\n type = { kind: 'service' };\n } else {\n const parsed = parseTypeExpr(t);\n type = parsed?.ok ? parsed.expr : { kind: 'prim', prim: 'string' };\n }\n return { detail: renderParamType(type), type, required, placeholder: placeholderFor(type) };\n}\n\n/** Build the param SCHEMA for a `.tgc` body: each leaf `- name:: TYPE` row → a typed param; each nested\n * `- name::` + deeper body → an `object` param whose params recurse. The declare-side counterpart of the\n * parser's ConfigBlock tree. */\nfunction paramsFromBody(leaves: Map<string, string>, objects?: Map<string, ParamObject>): Record<string, ConfigParamSchema> {\n const out: Record<string, ConfigParamSchema> = {};\n for (const [name, typeText] of leaves) out[name] = paramFromType(typeText);\n for (const [name, obj] of objects ?? new Map<string, ParamObject>()) {\n out[name] = { detail: 'a nested block', type: { kind: 'object', params: paramsFromBody(obj.params, obj.objects) } };\n }\n return out;\n}\n\n/** Parse a `glish.tgc` into a config SCHEMA. Every `$CONFIG <kind> …` block DECLARES a kind: its header value is\n * a type-expr = the header DOMAIN (`$CONFIG modality one of voice, chat`), and its `- param:: TYPE` rows are the\n * param schema — read as TYPES, not values, by the file-kind rule. The typed-block successor to the retired\n * `$CONFIG key: a | b` colon-pipe form. Pure. */\nexport function parseGlishConfigSchema(glishSource: string): ConfigSchema {\n const out: ConfigSchema = {};\n for (const block of parseConfigBlocks(glishSource.split('\\n'))) {\n const key: ConfigKeySchema = { detail: '' };\n if (block.value) {\n const parsed = parseTypeExpr(block.value);\n if (parsed?.ok && (parsed.expr.kind === 'oneOf' || parsed.expr.kind === 'anyOf')) {\n key.values = parsed.expr.members;\n key.detail = `one of: ${parsed.expr.members.join(', ')}`;\n } else {\n key.placeholder = block.value; // a non-enum header sample\n }\n }\n const params = paramsFromBody(block.params, block.objects);\n if (Object.keys(params).length > 0) key.params = params;\n out[block.kind] = key;\n }\n return out;\n}\n\n/** The EFFECTIVE schema: a project's `glish.tgc` DEEP-merged over the built-in defaults. A glish kind EXTENDS a\n * built-in of the same name — its params merge in PER NAME (so adding `top_p` to `model` keeps `via`), and a\n * header domain / detail it declares wins; the rest is inherited. A brand-new kind just joins. No glish → the\n * built-ins verbatim. Pure. */\nexport function resolveConfigSchema(glishSource?: string): ConfigSchema {\n if (!glishSource) return BUILTIN_CONFIG_SCHEMA;\n const out: ConfigSchema = { ...BUILTIN_CONFIG_SCHEMA };\n for (const [kind, gk] of Object.entries(parseGlishConfigSchema(glishSource))) {\n const base = out[kind];\n out[kind] = base\n ? {\n detail: gk.detail || base.detail,\n values: gk.values ?? base.values,\n placeholder: gk.placeholder ?? base.placeholder,\n ...(base.params || gk.params ? { params: { ...base.params, ...gk.params } } : {}),\n }\n : { ...gk, detail: gk.detail || 'declared in glish.tgc' };\n }\n return out;\n}\n\n// A parsed `$CONFIG <kind> <value>` block — the header + its indented `- param:: value` body (the same def-block\n// shape `$TOOL`/`$SERVICE` use). LEAF rows land in `params`; a `- name::` row with an EMPTY value and a deeper\n// indented body is a NESTED OBJECT param and lands in `objects` (composite config, Slice 2 — recursion). `value`\n// is the header value (the model id); a `.tgc` schema-declaration header may omit it.\n\n/** Parse a glish.tgc's `$CONFIG addressee one of noun, other_noun` declaration (bare names; `_` reads as a space) into extra addressee nouns — the\n * addressee model's CONFIG-ONLY rung (rule 4): a project whose house style writes `the assistant should …`\n * with no persona line opts those nouns into folding to `you`. Reads the `addressee` kind's declared\n * domain through the ONE glish parser (parseGlishConfigSchema), so the grammar can never drift from the\n * rest of the config layer. Absent → [] (the compiler never guesses). Pure. */\nexport function parseAddresseeConfig(glishSource?: string): string[] {\n if (glishSource === undefined || glishSource === '') return [];\n // Set members are bare names by the type grammar (letters/digits/_/-), so a multi-word noun is written\n // snake_case and normalized here: `support_agent` folds the subject phrase `support agent`.\n return (parseGlishConfigSchema(glishSource)['addressee']?.values ?? []).map((v) => v.replace(/_/g, ' '));\n}\n\nexport interface ConfigBlock {\n kind: string; // lowercased — model, modality, language, …\n value: string; // the header value (the primary value, e.g. the model id); '' if omitted\n params: Map<string, string>; // leaf `- param:: value` rows (lowercased keys), in source order\n objects?: Map<string, ParamObject>; // nested object params (`- name::` + a deeper body)\n line: number; // 0-based header line\n}\n/** A nested object param — its own leaf params plus deeper objects. The recursive half of ConfigBlock. */\nexport interface ParamObject {\n params: Map<string, string>;\n objects?: Map<string, ParamObject>;\n line: number; // 0-based line of the `- name::` opener\n}\n\nconst CONFIG_HEADER_RE = /^\\s*\\$CONFIG\\s+([a-z][\\w-]*)(?:\\s+(\\S.*?))?\\s*$/i; // kind + OPTIONAL value (.tgc may omit)\nconst CONFIG_PARAM_RE = /^\\s*-\\s+([a-z][a-z0-9_]*)::\\s*(.*?)\\s*$/i; // a nested `- param:: value` row\nconst indentWidth = (line: string): number => ((line.match(/^[ \\t]*/) ?? [''])[0].length);\n\n/** Parse the `- param:: …` body under a header/object indented at `parentIndent`, RECURSIVELY: a `- name::` with\n * an EMPTY value whose next non-blank line is deeper opens a nested object. Returns the leaf + object maps and\n * `end` — the first line at/above `parentIndent` (where the body stops). */\nfunction parseParamBody(rawLines: readonly string[], start: number, parentIndent: number): { params: Map<string, string>; objects: Map<string, ParamObject>; end: number } {\n const params = new Map<string, string>();\n const objects = new Map<string, ParamObject>();\n let j = start;\n while (j < rawLines.length) {\n const line = rawLines[j] ?? '';\n if (line.trim() === '') {\n j += 1;\n continue;\n }\n if (indentWidth(line) <= parentIndent) break; // dedent ends this body\n const pm = line.match(CONFIG_PARAM_RE);\n if (!pm) {\n j += 1;\n continue;\n }\n const name = (pm[1] ?? '').toLowerCase();\n const value = (pm[2] ?? '').trim();\n let nextDeeper = false; // an empty value + a deeper next non-blank line ⇒ a nested object opener\n for (let k = j + 1; k < rawLines.length; k += 1) {\n const nl = rawLines[k] ?? '';\n if (nl.trim() === '') continue;\n nextDeeper = indentWidth(nl) > indentWidth(line);\n break;\n }\n if (value === '' && nextDeeper) {\n const sub = parseParamBody(rawLines, j + 1, indentWidth(line));\n objects.set(name, { params: sub.params, ...(sub.objects.size ? { objects: sub.objects } : {}), line: j });\n j = sub.end;\n } else {\n params.set(name, value);\n j += 1;\n }\n }\n return { params, objects, end: j };\n}\n\n/** Parse every `$CONFIG <kind> <value>` block: the header plus its indented `- param:: value` body, scoped like a\n * `$TOOL` block (deeper lines belong; the first non-blank at or above the header column ends it), NESTED objects\n * and all. Fence-aware. Pure — the typed-config counterpart of the flat CONFIG_RE map, and what the bundle/editor\n * read for a kind's params. */\nexport function parseConfigBlocks(rawLines: readonly string[]): ConfigBlock[] {\n const blocks: ConfigBlock[] = [];\n let inFence = false;\n for (let i = 0; i < rawLines.length; i += 1) {\n const t = (rawLines[i] ?? '').trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n continue;\n }\n const h = inFence ? null : (rawLines[i] ?? '').match(CONFIG_HEADER_RE);\n if (!h) continue;\n const body = parseParamBody(rawLines, i + 1, indentWidth(rawLines[i] ?? ''));\n blocks.push({ kind: (h[1] ?? '').toLowerCase(), value: (h[2] ?? '').trim(), params: body.params, ...(body.objects.size ? { objects: body.objects } : {}), line: i });\n i = body.end - 1; // skip the consumed body\n }\n return blocks;\n}\n\nexport interface ConfigFinding {\n line: number;\n start: number;\n end: number;\n message: string;\n severity: 'error' | 'warn' | 'info';\n /** The diagnostic code — the param checks set it (config/dangling-service, …); the domain nudge leaves it\n * undefined (its web consumer maps it to config/out-of-domain). */\n code?: string;\n}\n\n/** A `$CONFIG key value` whose value falls outside the key's declared enum domain → a HUMBLE nudge (never an\n * error: `$CONFIG` isn't validated at runtime, and the schema itself is advisory). Domain-declaration lines\n * (`key: a | b`) and open keys (no domain) are skipped. Pure. */\nexport function configDomainDiagnostics(rawLines: string[], schema: ConfigSchema): ConfigFinding[] {\n const out: ConfigFinding[] = [];\n rawLines.forEach((raw, i) => {\n const m = raw.match(CONFIG_RE);\n if (!m) return; // not a `$CONFIG key value` set-line (a `key: domain` line has no space before ':')\n const key = (m[1] ?? '').toLowerCase();\n const value = (m[2] ?? '').split(',')[0]!.trim(); // the first pair on the line, like models.ts\n const values = schema[key]?.values;\n if (!values || value === '' || values.includes(value)) return;\n out.push({\n line: i,\n start: raw.length - raw.trimStart().length,\n end: raw.trimEnd().length,\n severity: 'warn',\n message: `$CONFIG ${key} is \"${value}\", which isn't one of its allowed values (${values.join(', ')}). Fix it, or widen the domain with \"$CONFIG ${key} one of …\" in glish.tgc.`,\n });\n });\n return out;\n}\n\n/** A SET value checked against a param's refinement (if any). Returns the human reason it's out of bounds, or\n * null when it's in bounds / the type carries no refinement. The numeric non-finite case is left to the\n * bad-number check. Pure. */\nfunction refineViolation(t: ConfigParamType, value: string): string | null {\n if (t.kind !== 'prim' || !t.refine) return null;\n const r = t.refine;\n if (t.prim === 'string') {\n if (r.pattern !== undefined && !new RegExp(r.pattern).test(value)) return `must match /${r.pattern}/`;\n if (r.minLen !== undefined && value.length < r.minLen) return `must be at least ${r.minLen} characters`;\n if (r.maxLen !== undefined && value.length > r.maxLen) return `must be at most ${r.maxLen} characters`;\n return null;\n }\n const n = Number(value);\n if (!Number.isFinite(n)) return null;\n if (r.min !== undefined && n < r.min) return `must be at least ${r.min}`;\n if (r.max !== undefined && n > r.max) return `must be at most ${r.max}`;\n return null;\n}\n\n/** Structural checks on `$CONFIG <kind>` PARAM blocks: a `service`-typed param naming a `$SERVICE` that isn't\n * defined → a DANGLING error; a REQUIRED param missing → warn; an unknown param → info; a non-numeric number or\n * non-whole integer → warn; a value outside a declared refinement (range / length / pattern) → warn.\n * `serviceNames` is the set of defined `$SERVICE` names (runDiagnostics reads them from parseTools). Pure. */\nexport function configParamDiagnostics(rawLines: readonly string[], schema: ConfigSchema, serviceNames: ReadonlySet<string>): (ConfigFinding & { code: string })[] {\n const out: (ConfigFinding & { code: string })[] = [];\n const range = (line: number): { line: number; start: number; end: number } => {\n const raw = rawLines[line] ?? '';\n return { line, start: raw.length - raw.trimStart().length, end: raw.trimEnd().length };\n };\n const indentOf = (line: number): number => ((rawLines[line] ?? '').match(/^\\s*/)?.[0] ?? '').length;\n // The source line of a `- name::` row within a block's body (for a tight range); falls back to the header.\n const paramLine = (headerLine: number, name: string): number => {\n const re = new RegExp(`^\\\\s*-\\\\s+${name}::`, 'i');\n for (let j = headerLine + 1; j < rawLines.length; j += 1) {\n const l = rawLines[j] ?? '';\n if (l.trim() === '') continue;\n if (indentOf(j) <= indentOf(headerLine)) break;\n if (re.test(l)) return j;\n }\n return headerLine;\n };\n // Check one body (a $CONFIG block or a nested object) against its param schema, recursing into object params.\n const checkBody = (schemaParams: Record<string, ConfigParamSchema>, leaves: Map<string, string>, objects: Map<string, ParamObject> | undefined, kind: string, headerLine: number): void => {\n for (const [name, p] of Object.entries(schemaParams)) {\n const present = p.type.kind === 'object' ? !!objects?.has(name) : leaves.has(name);\n if (p.required && !present) {\n out.push({ ...range(headerLine), severity: 'warn', code: 'config/missing-param', message: `$CONFIG ${kind} is missing the required \"${name}\" — add \"- ${name}:: …\" beneath it.` });\n }\n }\n leaves.forEach((value, name) => {\n const p = schemaParams[name];\n const ln = paramLine(headerLine, name);\n if (p === undefined) {\n out.push({ ...range(ln), severity: 'info', code: 'config/unknown-param', message: `\"${name}\" isn't a known param of $CONFIG ${kind}.` });\n } else if (p.type.kind === 'object') {\n out.push({ ...range(ln), severity: 'info', code: 'config/unknown-param', message: `$CONFIG ${kind} → ${name} is a nested block — give it indented \"- …::\" rows, not a value.` });\n } else if (value !== '') {\n const t = p.type;\n const num = Number(value);\n if (t.kind === 'service' && !serviceNames.has(value)) {\n out.push({ ...range(ln), severity: 'error', code: 'config/dangling-service', message: `$CONFIG ${kind} → ${name} names \"${value}\", but no \"$SERVICE ${value}\" is defined.` });\n } else if (t.kind === 'prim' && (t.prim === 'number' || t.prim === 'integer') && !Number.isFinite(num)) {\n out.push({ ...range(ln), severity: 'warn', code: 'config/bad-number', message: `$CONFIG ${kind} → ${name} should be a number — got \"${value}\".` });\n } else if (t.kind === 'prim' && t.prim === 'integer' && !Number.isInteger(num)) {\n out.push({ ...range(ln), severity: 'warn', code: 'config/bad-number', message: `$CONFIG ${kind} → ${name} should be a whole number — got \"${value}\".` });\n } else {\n const v = refineViolation(t, value);\n if (v) out.push({ ...range(ln), severity: 'warn', code: 'config/out-of-range', message: `$CONFIG ${kind} → ${name} ${v} — got \"${value}\".` });\n }\n }\n });\n objects?.forEach((obj, name) => {\n const p = schemaParams[name];\n if (p === undefined) {\n out.push({ ...range(obj.line), severity: 'info', code: 'config/unknown-param', message: `\"${name}\" isn't a known param of $CONFIG ${kind}.` });\n } else if (p.type.kind !== 'object') {\n out.push({ ...range(obj.line), severity: 'info', code: 'config/unknown-param', message: `$CONFIG ${kind} → ${name} takes a value, not a nested block.` });\n } else {\n checkBody(p.type.params, obj.params, obj.objects, `${kind} → ${name}`, obj.line);\n }\n });\n };\n for (const block of parseConfigBlocks(rawLines)) {\n const params = schema[block.kind]?.params;\n if (params) checkBody(params, block.params, block.objects, block.kind, block.line);\n }\n return out;\n}\n\n// A CROSS-FIELD rule from a `.tgc`: `$REQUIRE <target> when <kind> is <value>` — when the condition kind is SET\n// to the trigger value, the target kind becomes required. Reuses the `is` copula; distinct from `$REQUIRE\n// variable` (no `when` clause, and it lives in a `.tg`, not glish).\nexport interface ConfigRule {\n target: string; // the kind that becomes required\n whenKind: string; // the condition kind\n whenValue: string; // the trigger value (equality)\n line: number; // 0-based source line (in the glish file)\n}\nconst CONFIG_RULE_RE = /^\\s*\\$REQUIRE\\s+([a-z][\\w-]*)\\s+when\\s+([a-z][\\w-]*)\\s+is\\s+(\\S.*?)\\s*$/i;\n\n/** Parse `$REQUIRE <target> when <kind> is <value>` cross-field rules from a `.tgc`. Pure. */\nexport function parseConfigRules(glishSource: string): ConfigRule[] {\n const rules: ConfigRule[] = [];\n glishSource.split('\\n').forEach((raw, line) => {\n const m = raw.match(CONFIG_RULE_RE);\n if (m) rules.push({ target: (m[1] ?? '').toLowerCase(), whenKind: (m[2] ?? '').toLowerCase(), whenValue: (m[3] ?? '').trim(), line });\n });\n return rules;\n}\n\n/** Check a `.tg`'s `$CONFIG` sets against the glish cross-field rules: when the condition kind is set to the\n * trigger value and the target kind is ABSENT, warn on the condition line. Pure. */\nexport function configRuleDiagnostics(rawLines: readonly string[], rules: readonly ConfigRule[]): (ConfigFinding & { code: string })[] {\n if (rules.length === 0) return [];\n const byKind = new Map(parseConfigBlocks(rawLines).map((b) => [b.kind, b] as const));\n const out: (ConfigFinding & { code: string })[] = [];\n for (const rule of rules) {\n const cond = byKind.get(rule.whenKind);\n if (cond && cond.value === rule.whenValue && !byKind.has(rule.target)) {\n const raw = rawLines[cond.line] ?? '';\n out.push({ line: cond.line, start: raw.length - raw.trimStart().length, end: raw.trimEnd().length, severity: 'warn', code: 'config/missing-conditional', message: `$CONFIG ${rule.whenKind} is \"${rule.whenValue}\", so $CONFIG ${rule.target} is required — add it.` });\n }\n }\n return out;\n}\n","// ── AUTO-GENERATED — the committed model snapshot the checker reads ──────────────────────────────────────\n// This is the OFFLINE source of truth for `$CONFIG model` validation. It is regenerated from the vendors'\n// `/models` endpoints by `scripts/refresh-models.ts` (run weekly by CI, or `npm run refresh:models` locally) —\n// network access lives ONLY in that script, never in the checker, so the compiler stays pure, offline, and\n// deterministic in the browser and in tests. Do not hand-edit for freshness; fix the script and re-run it.\n//\n// A snapshot can lag a brand-new release by up to a refresh cycle — which is exactly why the checker is humble:\n// an unknown id in a known vendor family is a gentle note, never an error (see models.ts / `classifyModel`).\n\nexport interface KnownModel {\n /** The canonical API id a request sends. */\n id: string;\n vendor: 'anthropic' | 'openai' | 'google';\n /** Vendor-published aliases that also resolve (e.g. a `-latest` pointer or an undated alias). */\n aliases?: string[];\n}\n\n/** ISO date the snapshot was generated — surfaced in the \"may be newer than the list (as of …)\" note. */\nexport const MODELS_GENERATED_AT = '2026-07-01';\n\nexport const KNOWN_MODELS: KnownModel[] = [\n // Anthropic — https://api.anthropic.com/v1/models\n // Current line-up, confirmed against the live endpoint 2026-07-09 (a full refresh would drop the\n // committed OpenAI/Google entries when those keys are absent, so these three merged surgically).\n { id: 'claude-opus-4-8', vendor: 'anthropic' },\n { id: 'claude-sonnet-4-6', vendor: 'anthropic' },\n { id: 'claude-haiku-4-5-20251001', vendor: 'anthropic', aliases: ['claude-haiku-4-5'] },\n { id: 'claude-opus-4-1-20250805', vendor: 'anthropic', aliases: ['claude-opus-4-1'] },\n { id: 'claude-opus-4-20250514', vendor: 'anthropic', aliases: ['claude-opus-4-0'] },\n { id: 'claude-sonnet-4-20250514', vendor: 'anthropic', aliases: ['claude-sonnet-4-0'] },\n { id: 'claude-3-7-sonnet-20250219', vendor: 'anthropic', aliases: ['claude-3-7-sonnet-latest'] },\n { id: 'claude-3-5-sonnet-20241022', vendor: 'anthropic', aliases: ['claude-3-5-sonnet-latest'] },\n { id: 'claude-3-5-haiku-20241022', vendor: 'anthropic', aliases: ['claude-3-5-haiku-latest'] },\n { id: 'claude-3-haiku-20240307', vendor: 'anthropic' },\n // OpenAI — https://api.openai.com/v1/models (chat/reasoning models only)\n { id: 'gpt-4o', vendor: 'openai' },\n { id: 'gpt-4o-mini', vendor: 'openai' },\n { id: 'gpt-4.1', vendor: 'openai' },\n { id: 'gpt-4.1-mini', vendor: 'openai' },\n { id: 'o3', vendor: 'openai' },\n { id: 'o4-mini', vendor: 'openai' },\n // Google — https://generativelanguage.googleapis.com/v1beta/models\n { id: 'gemini-2.5-pro', vendor: 'google' },\n { id: 'gemini-2.5-flash', vendor: 'google' },\n { id: 'gemini-2.0-flash', vendor: 'google' },\n];\n","// ── Model registry: is a `$CONFIG model` a real, current model id? ──────────────────────────────────────\n// The check the reverted target-registry used to do, rebuilt narrow and FRESH: only model-id validity (no\n// modality/channel rules), reading a snapshot (models.generated.ts) that a weekly CI job refreshes from the\n// vendors. Pure and offline — the network lives in scripts/refresh-models.ts, never here.\n//\n// Posture: HUMBLE. A snapshot can lag a new release, so the checker never errors. It nudges an obvious typo or\n// an unversioned id toward the real one, and stays gentle (a note, not a warning) for an unknown id that still\n// looks like a real vendor model — the case where the id is simply newer than the last refresh.\n\nimport { CONFIG_RE } from './clause';\nimport type { Severity } from './diagnostics';\nimport { KNOWN_MODELS, MODELS_GENERATED_AT } from './models.generated';\n\nconst norm = (id: string): string => id.trim().toLowerCase();\n\n// A stem is an id minus its trailing date/version, so a typo of the FRIENDLY form (`claude-opsu-4`) still finds\n// its model even though the snapshot stores the fully-versioned id (`claude-opus-4-20250514`).\nconst stem = (id: string): string => norm(id).replace(/-\\d{4,}$/, '');\n\n// Every string that resolves to a real model — the canonical id, its aliases, and its stem — mapped to the\n// canonical id to suggest. Stems map to the SHORTEST id that carries them (the base model, not a point release).\nconst CANDIDATES = new Map<string, string>();\nconst KNOWN = new Set<string>(); // exact-resolvable strings (ids + aliases) — a hit here is \"known\", no nudge\nfor (const m of [...KNOWN_MODELS].sort((a, b) => a.id.length - b.id.length)) {\n const id = norm(m.id);\n KNOWN.add(id);\n if (!CANDIDATES.has(id)) CANDIDATES.set(id, m.id);\n const s = stem(m.id);\n if (!CANDIDATES.has(s)) CANDIDATES.set(s, m.id);\n for (const a of m.aliases ?? []) {\n KNOWN.add(norm(a));\n if (!CANDIDATES.has(norm(a))) CANDIDATES.set(norm(a), m.id);\n }\n}\n/** The canonical model ids — the `$CONFIG model <id>` completion dropdown (the leading-DX model picker). */\nexport const CANONICAL_IDS = [...new Set(KNOWN_MODELS.map((m) => m.id))];\n\n// Vendor family prefixes — the heuristic that lets a model NEWER than the snapshot degrade to a gentle note\n// instead of a false \"unknown\". Kept deliberately short and vendor-anchored so random prose can't match.\nconst FAMILIES = ['claude-', 'gpt-', 'gemini-', 'o1', 'o3', 'o4', 'text-', 'chatgpt-'];\n\n/** True if `id` (or an alias) is a real, current model in the snapshot. */\nexport function isKnownModel(id: string): boolean {\n return KNOWN.has(norm(id));\n}\n\n/** Damerau–Levenshtein (optimal string alignment): edit distance WITH adjacent transpositions, so a slip like\n * `opsu`↔`opus` counts as one edit, not two. Used only to rank the nearest real id for a nudge. */\nexport function damerau(a: string, b: string): number {\n const al = a.length;\n const bl = b.length;\n if (al === 0) return bl;\n if (bl === 0) return al;\n const d: number[][] = Array.from({ length: al + 1 }, () => new Array<number>(bl + 1).fill(0));\n for (let i = 0; i <= al; i += 1) d[i]![0] = i;\n for (let j = 0; j <= bl; j += 1) d[0]![j] = j;\n for (let i = 1; i <= al; i += 1) {\n for (let j = 1; j <= bl; j += 1) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n d[i]![j] = Math.min(d[i - 1]![j]! + 1, d[i]![j - 1]! + 1, d[i - 1]![j - 1]! + cost);\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n d[i]![j] = Math.min(d[i]![j]!, d[i - 2]![j - 2]! + 1);\n }\n }\n }\n return d[al]![bl]!;\n}\n\nexport type ModelVerdict =\n | { kind: 'known' } // an exact id or alias — nothing to say\n | { kind: 'incomplete'; suggest: string } // a prefix of a real id (`claude-opus-4`) — an unversioned form\n | { kind: 'typo'; suggest: string } // within a couple edits of a real id / stem — probably a slip\n | { kind: 'maybe-newer' } // unknown, but a real vendor family — likely newer than the snapshot\n | { kind: 'unknown' }; // nothing recognizable\n\nexport function classifyModel(id: string): ModelVerdict {\n const n = norm(id);\n if (KNOWN.has(n)) return { kind: 'known' };\n\n // A dated id (`…-20991231`) is a SPECIFIC request — either right, or newer than the snapshot; never\n // second-guess it by edit distance (every dated id in a family is only a few digits from every other). Only\n // the FRIENDLY forms (no trailing date) get the incomplete / typo nudges.\n const dated = /-\\d{4,}$/.test(n);\n if (!dated) {\n // An unversioned / prefix form — `claude-opus-4` → `claude-opus-4-20250514`. Suggest the shortest id\n // carrying the prefix (the base model, not a point release).\n const prefixed = CANONICAL_IDS.filter((k) => norm(k).startsWith(`${n}-`)).sort((a, b) => a.length - b.length);\n if (prefixed.length > 0) return { kind: 'incomplete', suggest: prefixed[0]! };\n\n // Nearest real string (id / alias / stem). A tight, length-relative budget keeps it to genuine slips, and\n // stems are short — so a friendly typo lands on its base model, not on a far-off dated id.\n let best: { suggest: string; dist: number } | null = null;\n for (const [cand, canonical] of CANDIDATES) {\n const dist = damerau(n, cand);\n if (!best || dist < best.dist) best = { suggest: canonical, dist };\n }\n if (best && best.dist <= Math.max(1, Math.floor(n.length * 0.2))) return { kind: 'typo', suggest: best.suggest };\n }\n\n if (FAMILIES.some((f) => n.startsWith(f))) return { kind: 'maybe-newer' };\n return { kind: 'unknown' };\n}\n\nexport interface ModelFinding {\n line: number;\n start: number;\n end: number;\n message: string;\n severity: Severity;\n}\n\n/** Check every `$CONFIG model <id>` line against the snapshot. Never an error — `$CONFIG` isn't validated at\n * runtime, so a wrong id fails only when the agent actually calls the model; this surfaces it at author time. */\nexport function checkModel(rawLines: string[]): ModelFinding[] {\n const out: ModelFinding[] = [];\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n const m = raw.match(CONFIG_RE);\n if (!m || (m[1] ?? '').toLowerCase() !== 'model') continue;\n const value = (m[2] ?? '').split(',')[0]!.trim(); // the model id is the first pair on the line\n if (value === '') continue;\n const start = raw.length - raw.trimStart().length;\n const end = raw.trimEnd().length;\n const v = classifyModel(value);\n if (v.kind === 'known') continue;\n if (v.kind === 'maybe-newer') {\n out.push({\n line: i,\n start,\n end,\n severity: 'info',\n message: `\"${value}\" isn't in the known-model list (as of ${MODELS_GENERATED_AT}). If it's newer than the list, ignore this — the list refreshes from the vendors.`,\n });\n continue;\n }\n const suggest = v.kind === 'incomplete' || v.kind === 'typo' ? ` Did you mean \"${v.suggest}\"?` : '';\n out.push({\n line: i,\n start,\n end,\n severity: 'warn',\n message: `Unknown model \"${value}\".${suggest} $CONFIG model isn't validated at runtime, so a wrong id fails only when the agent runs.`,\n });\n }\n return out;\n}\n","// ── Structural / referential-integrity layer ─────────────────────────────────────────────────────────\n// A prompt is a PROGRAM: ordered steps, named sections, variables, and an imported tool/route/input surface,\n// bound by a web of cross-references. This module models that structure and checks its integrity — the\n// completeness analogue of \"undefined variable\", \"duplicate label\", \"goto a nonexistent step\". Pure + core.\n//\n// It recognizes an EXPLICIT, Markdown-like format (no fuzzy prose inference), so every diagnostic is provable:\n// step a dotted-decimal list item — `2.` (top) / `2.1.` / `2.1.3.` … nesting one level per segment, to\n// any depth. The `.`/`)` terminator keeps it sound: `2.1. Verify` is a step, `2.1 million` is not.\n// section `# Heading` OR a balanced `<tag>…</tag>` block (both fold to one key via tagName)\n// variable `{name}` / `[name]` (the two notations are the same variable)\n// import `$IMPORT tool|route|input a, b, c` — the EXTERNAL surface, stripped at compile (total observability)\n// References are explicit tokens: `step 2.1` / `(step 8)` / `2.1–2.5` (steps), `<closing>` (sections),\n// `{name}` (variables), bare snake_case (tools), and an imported route name (routes).\n\nimport { BARE_COMMAND_RE, CONFIG_RE, CONFIG_SECTION_CLOSE, CONFIG_SECTION_OPEN, DEFINE_RE, IMPORT_FILE_RE, IMPORT_RE, REQUIRE_RE, SNAKE_RE, TAG_NAME_SRC, TRANSCLUSION_LINE_RE, annotationAlias, configSectionMask, examplesMask, isAnnotationLine, maskQuotes, toolBlockMask } from './clause';\nimport { BUILTIN_CONFIG_SCHEMA } from './config-schema';\nimport type { ConfigKeySchema, ConfigSchema } from './config-schema';\nimport { CANONICAL_IDS } from './models';\nimport { exprAtoms, parseExpr } from './expr';\nimport { BLOCK_SNIPPETS, COMPARISON_KEYWORDS, DIRECTIVE_SNIPPETS, STATEMENT_SNIPPETS } from './lexicon';\nimport { parseTypeExpr, PRIM_TYPES, translateLegacyTypeHead } from './type-system';\nimport { parseTools } from './tool';\nimport type { ToolDef } from './tool';\nimport { parseInlineSwitches, parseSwitches } from './switch';\nimport type { SwitchBlock } from './switch';\nimport { parseTests, strayExpects, testBlockLines } from './testblock';\nimport type { TestBlockT } from './testblock';\nimport { parseExamples, exampleBlockLines } from './exampleblock';\nimport type { ExampleBlockT } from './exampleblock';\nimport { classifyLines, findEnumDeclaration, isHeadingLine } from './prompt';\nimport { tagName } from './xml';\nimport type { Severity } from './diagnostics';\n\nexport type SymbolKind = 'step' | 'section' | 'variable' | 'tool' | 'route' | 'alias';\n\nexport interface StepSymbol {\n ord: string; // the dotted path, e.g. \"2\", \"2.1\", \"2.1.3\"\n segments: number[]; // the path as numbers, e.g. [2, 1, 3] — one per nesting level\n major: number; // segments[0], the top-level step number\n parent: string | null; // the parent step's ord (\"2.1\" for \"2.1.3\"), or null for a top step — for sibling grouping\n line: number;\n text: string;\n depth: number; // segments.length - 1 (0 = top-level step, 1 = sub-step, 2 = sub-sub-step, … unbounded)\n anchor: string | null; // optional stable name (`#greet`) — the step's identity, independent of its number\n}\nexport interface SectionSymbol {\n tag: string; // normalized key, e.g. \"closing\"\n name: string; // display: \"<closing>\" or \"# Closing\"\n syntax: 'xml' | 'heading';\n startLine: number;\n endLine: number; // exclusive\n depth: number;\n guard?: { text: string; col: number }; // an `<tag when=$expr>` boolean guard — the section is included iff it holds\n control?: boolean; // a `<$CONFIG>` section — folds/outlines like any section, never reaches the model\n literal?: boolean; // a `<\"name\">` section — its body renders VERBATIM and is analysis-exempt (a literal zone)\n}\nexport interface VariableSymbol {\n base: string; // \"customer_phone\"\n notations: { form: 'curly' | 'square'; line: number; start: number; end: number }[];\n}\n// The declared DOMAIN of an imported input — what a chain / guard can range over. `enum` is what powers\n// exhaustiveness (every member must be handled); `bool` powers a boolean guard; `number` / `string` are opaque\n// (usable, but never exhaustively switchable — a switch on one needs a fallback). An UNTYPED input (a bare\n// `$REQUIRE variable x`) carries no type and is treated as `string`. This is the type half of \"typed imports\".\nexport type InputType =\n | { kind: 'enum'; members: string[] } // `one of greeting, booking, closing` — case-folded members\n | { kind: 'bool' }\n | { kind: 'number' }\n | { kind: 'string' };\n\nexport interface ImportSymbol {\n /** `variable` = a `$REQUIRE variable` — a required, fillable placeholder. */\n kind: 'tool' | 'route' | 'variable';\n name: string; // exact, as written\n key: string; // lookup key (lowercased)\n line: number;\n type?: InputType; // variables only — the declared domain (`$REQUIRE variable x: T`); undefined = untyped (≈ string)\n}\n\nexport interface StructuredDoc {\n steps: StepSymbol[];\n sections: SectionSymbol[];\n variables: Map<string, VariableSymbol>;\n imports: ImportSymbol[];\n fileImports: { alias: string; key: string; path: string; line: number }[]; // `$IMPORT file \"path\" as alias` — expanded by expandImports (imports.ts); `{alias}` transcludes the file\n importLines: Set<number>; // lines that are $IMPORT manifests (skipped by reference scanning + stripped at render)\n config: Map<string, string>; // compile-time settings from `$CONFIG <key> <value>` lines (e.g. model → \"gpt-4o\")\n configLines: Set<number>; // lines that are $CONFIG commands (skipped by reference scanning + stripped at render)\n defines: Map<string, { expr: string; line: number }>; // `$DEFINE name AS expr` — a reusable named boolean condition\n defineLines: Set<number>; // lines that are $DEFINE commands (skipped by reference scanning + stripped at render)\n inputTypes: Map<string, InputType>; // declared domain per typed input (`$REQUIRE variable x: T`) — powers chain exhaustiveness\n toolDefs: ToolDef[]; // inline $TOOL definitions — auto-declared (index.tools includes them)\n tests: TestBlockT[]; // $TEST blocks — the file's own eval suite (control-plane, stripped at render)\n testLines: Set<number>; // every line of every $TEST block (skipped by reference scanning + stripped at render)\n examples: ExampleBlockT[]; // $EXAMPLE blocks — structured few-shot (scaffolding strips; GOOD emits as a User/Assistant pair)\n exampleLines: Set<number>; // every line of every $EXAMPLE block (skipped by reference scanning; the block is replaced by its few-shot at render)\n unclosedTags: { tag: string; line: number }[]; // whole-line `<x>` opened but never closed\n strayCloses: { tag: string; line: number }[]; // whole-line `</x>` with no matching open\n aliases: AliasDef[]; // `@@ name:` statement annotations — each NAMES the statement it documents (a named statement)\n index: { steps: Set<string>; anchors: Set<string>; sections: Set<string>; tools: Set<string>; routes: Set<string>; inputs: Set<string>; aliases: Set<string> };\n}\n// A `@@ name: …` statement annotation: `name` is an alias for the statement the annotation documents (the next\n// content line). `line` is the annotation line; `target` is the statement line it names (or null when nothing\n// follows — a dangling annotation, flagged separately). Author-facing only: aliases never reach the compiled prompt.\nexport interface AliasDef { name: string; line: number; target: number | null }\n\n// ── Declaration syntax ──\n// A step is a dotted decimal path — `2.`, `2.1.`, `2.1.3.` — nesting one level per `.`-separated segment, to any\n// depth. The trailing `.`/`)` terminator is what keeps it sound: `2.1. Verify` is a step, `2.1 million` is not.\nconst STEP = /^(\\d+(?:\\.\\d+)*)[.)]\\s+(.*)$/; // \"2.\" / \"2.1.\" / \"2.1.3.\" + content\n// A step may open with a stable anchor — `2.1. #greet Greet the caller`. The `#name` is the step's identity,\n// peeled off the step text here; references use it (`#greet`) and it never changes when the number does.\nconst ANCHOR_DECL = /^#([a-z][a-z0-9_]*)\\s+(.*)$/i;\nfunction splitAnchor(text: string): { anchor: string | null; text: string } {\n const m = text.match(ANCHOR_DECL);\n return m ? { anchor: (m[1] ?? '').toLowerCase(), text: m[2] ?? '' } : { anchor: null, text };\n}\n// A line's section-tag role. A tag no longer has to be alone on its line: a line may OPEN a section (`<name>` at\n// the line start — any trailing text is the section's first content), CLOSE one (`</name>` at the line START or\n// END — surrounding text is content), or be a complete INLINE section (`<note>Be brief</note>` — open + close on\n// one line). An OPENING `<tag>` sitting MID-prose (text before it, no close at the end) is still just a reference,\n// not a section. Matches the same `\\$?name` grammar as the old whole-line regexes, so `<$CONFIG>` flows through.\nexport interface SectionTagRole {\n open: string | null; // section opened by this line (lowercased tag name), else null\n close: string | null; // section closed by this line (lowercased tag name), else null\n inline: boolean; // opened AND closed on this one line (a self-contained one-line section)\n}\n// The `$`/`?` prefixes and the `\"…\"` quote pair are the COMPILE sigils: `<$name>` strips its whole extent\n// from the compiled prompt (control-plane, like `<$CONFIG>`); `<?name>` strips just its wrapper tag, keeping\n// the body (a transparent authoring wrapper); `<\"name\">` keeps its body VERBATIM (a literal zone — reference\n// tables, syntax samples — analysis-exempt, rendered untouched, emitted as a plain `<name>` tag: quotes\n// strip on compile, §6). All are part of the tag IDENTITY here, so `<?x>` balances against `</?x>` and\n// `<\"x\">` against `</\"x\">`, never `</x>`.\nconst SECTION_LEAD = new RegExp(`^\\\\s*<(\\\\/?)(${TAG_NAME_SRC})(?:\\\\s[^>]*)?>`, 'i'); // `<name …>` OR `</name>` at the line start\nconst SECTION_CLOSE_TAIL = new RegExp(`<\\\\/(${TAG_NAME_SRC})>\\\\s*$`, 'i'); // `</name>` at the line end\nexport function matchSectionTag(raw: string): SectionTagRole | null {\n const lead = raw.match(SECTION_LEAD);\n if (lead) {\n const name = (lead[2] ?? '').toLowerCase();\n // `</name> …` — a close leading the line (any trailing text is content that follows the closed section).\n if (lead[1] === '/') return { open: null, close: name, inline: false };\n // `<name> …` — an open leading the line. Inline only if a matching close ALSO ends the line; the close is\n // searched AFTER the opening tag so the open tag's own `>` is never mistaken for it.\n const closeM = raw.slice((lead.index ?? 0) + lead[0].length).match(SECTION_CLOSE_TAIL);\n return closeM ? { open: name, close: (closeM[1] ?? '').toLowerCase(), inline: true } : { open: name, close: null, inline: false };\n }\n // No leading tag, but a close may still trail the line (`content </name>`).\n const closeM = raw.match(SECTION_CLOSE_TAIL);\n return closeM ? { open: null, close: (closeM[1] ?? '').toLowerCase(), inline: false } : null;\n}\nconst HEADING = /^\\s*(#{1,6})\\s+(.+?)\\s*$/;\n// A variable reference — `@{name}`. The `@` sigil disambiguates it from bare `{…}`, which is common in\n// prose, JSON, and code. `@` marks insertion; `$` marks control (a `$SWITCH`/guard read of the same variable).\nconst VARREF = /@\\{([a-z][a-z0-9_]*)\\}/g; // the pointer is THE variable reference — bare `{x}` is prose (retired-brace-ref guards the migration)\n\n// A section may carry a boolean guard — `<recap_sms when=$voice>`. The guard text is everything between\n// `when=` and the tag close `>` (no quotes; a `<`/`>` inside is forbidden by design, so numeric thresholds\n// get named via `$DEFINE`). Returns the raw text and its 0-based start column, for the guard checks and\n// resolve(). It's control-plane — resolve() strips `when=…` on a surviving tag and drops a false section. Pure.\nfunction parseWhenAttr(raw: string): { text: string; col: number } | null {\n const m = raw.match(/\\bwhen=/i);\n if (!m || m.index === undefined) return null;\n const col = m.index + m[0].length;\n const gt = raw.indexOf('>', col);\n return gt < 0 ? null : { text: raw.slice(col, gt).trim(), col };\n}\n\nfunction collectVarUses(masked: string, line: number, vars: Map<string, VariableSymbol>): void {\n VARREF.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = VARREF.exec(masked)) !== null) {\n const base = (m[1] ?? '').toLowerCase();\n const sym = vars.get(base) ?? { base, notations: [] };\n sym.notations.push({ form: 'curly', line, start: m.index, end: m.index + m[0].length });\n vars.set(base, sym);\n }\n}\n\nconst INPUT_IDENT = /^[a-z][a-z0-9_]*$/i; // an input / enum-member name — a plain identifier\n\n/** Parse a variable's declared domain — through the SHARED English type grammar (type-system.ts), the\n * same grammar $TOOL params read. A variable's domain is one value: a primitive (`boolean` powers\n * guards, `number` comparisons, `string` is opaque) or a `one of a, b` closed set (exhaustively\n * switchable). Old code forms (`a | b` pipes, `bool`/`int`/`text` synonyms) error with the exact\n * canonical rewrite — one grammar, one spelling, every machine-plane surface. Pure. */\nexport function parseInputType(typeStr: string): { type: InputType | null; error: string | null } {\n const parsed = parseTypeExpr(typeStr);\n if (parsed?.ok) {\n const e = parsed.expr;\n if (e.kind === 'prim') {\n return { type: e.prim === 'boolean' ? { kind: 'bool' } : e.prim === 'string' ? { kind: 'string' } : { kind: 'number' }, error: null };\n }\n if (e.kind === 'oneOf') {\n const members = e.members.map((m) => m.toLowerCase());\n const bad = members.find((v) => !INPUT_IDENT.test(v));\n if (bad !== undefined) return { type: null, error: `Set member \"${bad}\" is not a valid identifier (letters, digits, _ — starting with a letter).` };\n return { type: { kind: 'enum', members }, error: null };\n }\n return { type: null, error: `A variable's domain is ONE value — a primitive or a \"one of a, b\" set, never a list (\"${typeStr.trim()}\").` };\n }\n if (parsed && !parsed.ok) {\n return { type: null, error: `${parsed.reason}${parsed.rewrite !== undefined ? ` Replace the type with: \"${parsed.rewrite}\".` : ''}` };\n }\n const legacy = translateLegacyTypeHead(typeStr);\n if (legacy !== null) {\n return { type: null, error: `Domains are English — \"one of a, b\" for a closed set — never \"|\" pipes. Replace the type with: \"${legacy}\".` };\n }\n return { type: null, error: `\"${typeStr.trim()}\" is not a domain. The forms: boolean, number, integer, string, or \"one of a, b\".` };\n}\n\n/** Parse a typed-input payload — the `name: type` after `$REQUIRE variable`. Returns the name, its parsed\n * type, and an error message when the declaration is malformed (bad name, missing type, bad domain). The\n * checker turns a non-null `error` into a `structure/bad-input-type`; buildStructure registers a well-formed\n * one so later guard references resolve. Pure — the single source of truth for typed-input parsing. */\nexport function parseTypedInput(payload: string): { name: string; type: InputType | null; error: string | null } {\n const ci = payload.indexOf(':');\n const name = payload.slice(0, ci).trim();\n const typeStr = payload.slice(ci + 1).trim();\n if (!INPUT_IDENT.test(name)) return { name, type: null, error: `\"${name || '(empty)'}\" is not a valid input name.` };\n if (typeStr === '') return { name, type: null, error: `Input \"${name}\" has no domain after \":\" — write \": boolean\", \": number\", \": string\", or \": one of a, b\".` };\n const { type, error } = parseInputType(typeStr);\n return { name, type, error: error === null ? null : `Input \"${name}\": ${error}` };\n}\n\n/** Content that falls OUTSIDE every section — the \"nothing floats loose\" check. A `#` heading covers content\n * until it hits a section tag or another heading (then it ENDS); a `<tag>` covers until its matching close. A\n * prose line with nothing open above it is loose. Blanks, comments, headings, tags, `$`-commands, `$TOOL`\n * bodies, and fenced code are exempt. Content BEFORE the first section is a preamble (a top-level declaration,\n * an intro line) and is exempt too — only content that falls out AFTER structure has begun is flagged; a\n * document with no sections at all is therefore never flagged. Returns each loose span as a 0-based line plus the\n * start column — either a whole loose line (start = its indent) or the prose TRAILING a leading close tag. Pure. */\nexport function looseContentLines(rawLines: string[]): { line: number; start: number }[] {\n const kinds = classifyLines(rawLines);\n const toolMask = toolBlockMask(rawLines);\n const exMask = examplesMask(rawLines); // <examples> interior is a literal zone — skip it\n type Cover = { kind: 'heading'; level: number } | { kind: 'tag'; name: string };\n const cover: Cover[] = [];\n const loose: { line: number; start: number }[] = [];\n let sawSection = false;\n let inFence = false;\n rawLines.forEach((raw, i) => {\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return;\n }\n if (inFence || kinds[i] !== 'content' || toolMask[i] || exMask[i]) return; // fenced, blanks, comments, $TOOL, examples\n // A lone transclusion pointer is STRUCTURE, not loose prose: `@<identity>` at top level BECOMES the\n // `<identity>` section at compose time (imports.ts splices it), the way a `<tag>` line opens one.\n if (TRANSCLUSION_LINE_RE.test(raw)) return;\n\n const hm = raw.match(HEADING);\n if (hm) {\n const level = (hm[1] ?? '').length;\n while (cover.length > 0) {\n const top = cover[cover.length - 1]!;\n if (top.kind === 'heading' && top.level >= level) cover.pop();\n else break;\n }\n cover.push({ kind: 'heading', level });\n sawSection = true;\n return;\n }\n const st = matchSectionTag(raw);\n if (st) {\n if (st.open) {\n while (cover.length > 0 && cover[cover.length - 1]!.kind === 'heading') cover.pop(); // a tag ends open headings\n cover.push({ kind: 'tag', name: st.open });\n sawSection = true;\n }\n if (st.close) {\n for (let s = cover.length - 1; s >= 0; s -= 1) {\n const c = cover[s]!;\n if (c.kind === 'tag' && c.name === st.close) {\n cover.length = s;\n break;\n }\n }\n }\n // Prose that TRAILS a leading close (`</identity> and now some stray words`) has no home once the tag\n // popped — flag just that trailing span, from the columns after the `>`, not the tag itself.\n const leadClose = raw.match(/^\\s*<\\/(?:\\$?[a-z][a-z0-9_]*)>/i);\n if (leadClose && sawSection && cover.length === 0 && raw.slice(leadClose[0].length).trim() !== '') {\n loose.push({ line: i, start: leadClose[0].length });\n }\n return;\n }\n if (t.startsWith('$')) return; // control-plane command ($IMPORT / $CONFIG / $TOOL / $DEFINE / $TEST / …)\n // Flag only once structure has begun: content before the first section is a preamble and stays exempt.\n if (sawSection && cover.length === 0) loose.push({ line: i, start: raw.length - raw.trimStart().length });\n });\n return loose;\n}\n\n/** When a document organizes with XML `<tag>` sections, every `#` heading must live INSIDE one — a heading at the\n * top level (outside every tag) is structurally homeless, but because a heading opens its OWN section the\n * loose-content check (which treats a heading as a cover) never sees it. This is that gap: each heading whose line\n * falls outside every non-control XML section is returned as a 0-based line + start column. A document with NO xml\n * sections (headings only, or nothing) is never flagged — headings alone are a fine way to organize. Pure. */\nexport function headingsOutsideSections(rawLines: string[]): { line: number; start: number }[] {\n const doc = buildStructure(rawLines);\n // `<$CONFIG>` is control-plane, not a content section, so it neither triggers the rule nor counts as a home.\n const xml = doc.sections.filter((s) => s.syntax === 'xml' && s.control !== true);\n if (xml.length === 0) return [];\n // A `#` inside fenced code is a literal sample, not a heading, so never flag it (track fences ourselves — the\n // section builder doesn't fence-guard heading detection).\n const fenced = new Set<number>();\n let inFence = false;\n rawLines.forEach((raw, i) => {\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n fenced.add(i);\n inFence = !inFence;\n return;\n }\n if (inFence) fenced.add(i);\n });\n const out: { line: number; start: number }[] = [];\n for (const h of doc.sections) {\n if (h.syntax !== 'heading' || fenced.has(h.startLine)) continue;\n const inside = xml.some((x) => h.startLine >= x.startLine && h.startLine < x.endLine);\n if (inside) continue;\n const raw = rawLines[h.startLine] ?? '';\n out.push({ line: h.startLine, start: raw.length - raw.trimStart().length });\n }\n return out;\n}\n\n/** Build the structural symbol graph from raw lines. Pure; masking-aware (skips comment lines). */\nexport function buildStructure(rawLines: string[]): StructuredDoc {\n const kinds = classifyLines(rawLines);\n const steps: StepSymbol[] = [];\n const sections: SectionSymbol[] = [];\n const variables = new Map<string, VariableSymbol>();\n const imports: ImportSymbol[] = [];\n const fileImports: StructuredDoc['fileImports'] = [];\n const importLines = new Set<number>();\n const config = new Map<string, string>();\n const configLines = new Set<number>();\n const inputTypes = new Map<string, InputType>();\n const defines = new Map<string, { expr: string; line: number }>();\n const defineLines = new Set<number>();\n const xmlStack: { tag: string; line: number; guard?: { text: string; col: number } }[] = [];\n const strayCloses: { tag: string; line: number }[] = []; // `</x>` with no matching `<x>` above it\n const headingStack: { level: number; sec: SectionSymbol }[] = [];\n\n // A $TOOL/$SERVICE block's body is the tool parser's domain — its indented YAML lines are not headings,\n // steps, or variable uses of the PROMPT ({zip} in a request URL is a param placeholder, not a prompt var).\n const toolMask = toolBlockMask(rawLines);\n // An <examples> block's interior is a LITERAL zone: sample tags/steps/refs inside are illustration, not\n // structure — so they never create phantom sections, steps, or dangling references. The tag lines themselves\n // stay unmasked, so the block still opens/closes/folds/outlines as one <examples> section.\n const exMask = examplesMask(rawLines);\n rawLines.forEach((raw, i) => {\n if (kinds[i] === 'comment' || toolMask[i] || exMask[i]) return;\n collectVarUses(maskQuotes(raw), i, variables); // vars can appear on any line\n\n // `$IMPORT file \"path\" as alias` — a module import; expandImports (imports.ts) transcludes `{alias}` before\n // compile. Here it's a manifest line: stripped at render, skipped by ref-scan, and its alias resolves `{alias}`.\n const fileImp = raw.match(IMPORT_FILE_RE);\n if (fileImp) {\n importLines.add(i);\n fileImports.push({ alias: fileImp[2] ?? '', key: (fileImp[2] ?? '').toLowerCase(), path: fileImp[1] ?? '', line: i });\n return;\n }\n\n // `$REQUIRE variable …` (canonical) and the deprecated `$IMPORT input …` normalize to the SAME thing: a\n // required variable (kind 'variable'). `$IMPORT tool|route` keep their kinds.\n const rq = raw.match(REQUIRE_RE);\n const im = rq ? null : raw.match(IMPORT_RE);\n if (rq || im) {\n importLines.add(i);\n const kind: 'tool' | 'route' | 'variable' = rq ? 'variable' : ((im![1] === 'input' ? 'variable' : im![1]) as 'tool' | 'route' | 'variable');\n const payload = (rq ? rq[1] : im![2]) ?? '';\n // A typed variable — `$REQUIRE variable phase: one of greeting, booking` — is ONE variable with a domain; the\n // `:` is the signal (an enum's members are `|`-separated, so a comma never collides with the untyped list\n // form). A malformed type still registers the NAME (so references don't cascade) and is flagged by the checker.\n if (kind === 'variable' && payload.includes(':')) {\n const { name, type } = parseTypedInput(payload);\n if (INPUT_IDENT.test(name)) {\n imports.push({ kind, name, key: name.toLowerCase(), line: i, ...(type ? { type } : {}) });\n if (type) inputTypes.set(name.toLowerCase(), type);\n }\n return;\n }\n for (const rawName of payload.split(',')) {\n const name = rawName.trim().replace(/^[\"']|[\"']$/g, '').trim();\n if (name !== '') imports.push({ kind, name, key: name.toLowerCase(), line: i });\n }\n return;\n }\n\n const cf = raw.match(CONFIG_RE);\n if (cf) {\n configLines.add(i);\n const key = (cf[1] ?? '').toLowerCase();\n if (!config.has(key)) config.set(key, (cf[2] ?? '').trim()); // first value per key wins; extras still strip\n return;\n }\n\n const df = raw.match(DEFINE_RE);\n if (df) {\n defineLines.add(i);\n const name = (df[1] ?? '').toLowerCase();\n if (!defines.has(name)) defines.set(name, { expr: (df[2] ?? '').trim(), line: i }); // first per name wins; a duplicate is flagged\n return;\n }\n\n // The <$CONFIG> section — the control-plane wrapper: a real section (folds, outlines, expands)\n // whose whole extent never reaches the model. Balance rides the same unclosed/stray machinery\n // as ordinary tags ($-names can't collide with XML_OPEN's letter-anchored grammar).\n if (CONFIG_SECTION_OPEN.test(raw)) {\n xmlStack.push({ tag: '$config', line: i });\n return;\n }\n if (CONFIG_SECTION_CLOSE.test(raw)) {\n let matched = false;\n for (let s = xmlStack.length - 1; s >= 0; s -= 1) {\n if (xmlStack[s]?.tag === '$config') {\n const o = xmlStack.splice(s, 1)[0];\n if (o) sections.push({ tag: '$config', name: '<$config>', syntax: 'xml', startLine: o.line, endLine: i + 1, depth: s, control: true });\n matched = true;\n break;\n }\n }\n if (!matched) strayCloses.push({ tag: '$config', line: i });\n return;\n }\n\n // Section tags (`<name>` / `</name>`) — recognized even with content on the same line, and an inline\n // `<name>…</name>` opens and closes at once. Balance rides the xmlStack (unclosed / stray-close checks).\n const st = matchSectionTag(raw);\n if (st) {\n if (st.open) {\n const guard = parseWhenAttr(raw);\n xmlStack.push({ tag: st.open, line: i, ...(guard ? { guard } : {}) });\n }\n if (st.close) {\n const tag = st.close;\n let matched = false;\n for (let s = xmlStack.length - 1; s >= 0; s -= 1) {\n if (xmlStack[s]?.tag === tag) {\n const o = xmlStack.splice(s, 1)[0];\n // A `<\"name\">` literal section registers under its BARE name (the quote sigil is compile identity,\n // not the section's name): hygiene, the outline, and reference links all see `name`, flagged literal.\n const literal = tag.startsWith('\"');\n if (o) sections.push({ tag: literal ? tag.slice(1, -1) : tag, name: `<${o.tag}>`, syntax: 'xml', startLine: o.line, endLine: i + 1, depth: s, ...(literal ? { literal: true } : {}), ...(o.guard ? { guard: o.guard } : {}) });\n matched = true;\n break;\n }\n }\n if (!matched) strayCloses.push({ tag, line: i }); // a close with no open — mismatched or extra\n }\n return;\n }\n\n const h = raw.match(HEADING);\n if (h) {\n const level = (h[1] ?? '').length;\n const name = h[2] ?? '';\n while (headingStack.length && (headingStack[headingStack.length - 1]?.level ?? 0) >= level) {\n const closed = headingStack.pop();\n if (closed) closed.sec.endLine = i;\n }\n const sec: SectionSymbol = { tag: tagName(name), name: `# ${name}`, syntax: 'heading', startLine: i, endLine: rawLines.length, depth: headingStack.length };\n sections.push(sec);\n headingStack.push({ level, sec });\n return;\n }\n\n const m = raw.trimStart().match(STEP);\n if (m) {\n const ord = m[1] ?? '';\n const segments = ord.split('.').map(Number);\n const { anchor, text } = splitAnchor(m[2] ?? '');\n steps.push({\n ord,\n segments,\n major: segments[0] ?? 0,\n parent: segments.length > 1 ? segments.slice(0, -1).join('.') : null,\n line: i,\n text,\n depth: segments.length - 1,\n anchor,\n });\n }\n });\n\n // Defining a $TOOL IN the file declares it — the single-file agent needs no $IMPORT for its own tools.\n const toolDefs = parseTools(rawLines).tools;\n const toolKeys = new Set([...imports.filter((x) => x.kind === 'tool').map((x) => x.key), ...toolDefs.map((t) => t.name)]);\n const routeKeys = new Set(imports.filter((x) => x.kind === 'route').map((x) => x.key));\n const inputKeys = new Set(imports.filter((x) => x.kind === 'variable').map((x) => x.key));\n const tests = parseTests(rawLines);\n const examples = parseExamples(rawLines);\n // `@@ name: …` statement annotations — each NAMES the statement it documents (a named statement). Fence-aware\n // (a `@@ x:` inside ``` code is a literal sample). `target` is the next real content line the alias points at.\n const aliases: AliasDef[] = [];\n {\n let inFence = false;\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n if (raw.trim().startsWith('```') || raw.trim().startsWith('~~~')) { inFence = !inFence; continue; }\n if (inFence) continue;\n const name = annotationAlias(raw);\n if (name === null) continue;\n let target: number | null = null;\n let f2 = false;\n for (let j = i + 1; j < rawLines.length; j += 1) {\n const r2 = rawLines[j] ?? '';\n const s2 = r2.trim();\n if (s2.startsWith('```') || s2.startsWith('~~~')) { f2 = !f2; continue; }\n if (f2) { target = j; break; }\n if (s2 === '' || /^\\s*\\/\\//.test(r2) || isAnnotationLine(r2)) continue; // skip blanks / comments / other annotations\n target = j;\n break;\n }\n aliases.push({ name, line: i, target });\n }\n }\n return {\n steps,\n sections,\n variables,\n imports,\n fileImports,\n importLines,\n config,\n configLines,\n defines,\n defineLines,\n inputTypes,\n toolDefs,\n tests,\n testLines: testBlockLines(rawLines),\n examples,\n exampleLines: exampleBlockLines(rawLines),\n unclosedTags: xmlStack.map((o) => ({ tag: o.tag, line: o.line })), // opens still on the stack at EOF\n strayCloses,\n aliases,\n index: {\n steps: new Set(steps.map((s) => s.ord)),\n anchors: new Set(steps.map((s) => s.anchor).filter((a): a is string => a !== null)),\n sections: new Set(sections.map((s) => s.tag)),\n tools: toolKeys,\n routes: routeKeys,\n inputs: inputKeys,\n aliases: new Set(aliases.map((a) => a.name)),\n },\n };\n}\n\nexport interface TagNameSpan {\n line: number; // 0-based\n start: number; // 0-based column, inclusive — first char of the tag NAME\n end: number; // 0-based column, exclusive — one past the last char of the name\n}\n\n/** The character spans of BOTH tag names for the section whose `<open>` or `</close>` sits on line `line0`.\n * An editor uses this to keep the pair renamed in lockstep (linked editing): edit either name, mirror it to\n * the other. Only the NAME is returned (not the `<`, `/`, `>`), so the brackets stay put while the name syncs.\n *\n * Returns null when line0 isn't a whole-line section tag, or the tag has no matching partner — an unclosed\n * `<x>` or a stray `</x>` has nothing to sync to. Pairing comes from buildStructure (a section only exists\n * when it's balanced), so this agrees exactly with folding and the open/close balance check. A cheap regex\n * guard skips the buildStructure pass entirely unless the caret line is actually a tag line. Pure. */\nexport function linkedTagSpans(rawLines: string[], line0: number): { open: TagNameSpan; close: TagNameSpan } | null {\n const raw = rawLines[line0];\n if (raw === undefined) return null;\n const st = matchSectionTag(raw);\n if (st?.inline) return null; // an inline `<x>…</x>` has no separate partner line to sync to\n const onOpen = st?.open != null;\n const onClose = st?.close != null;\n if (!onOpen && !onClose) return null; // fast path: the caret isn't on a section tag line\n\n const sec = buildStructure(rawLines).sections.find(\n (s) => s.syntax === 'xml' && (onOpen ? s.startLine === line0 : s.endLine - 1 === line0),\n );\n if (!sec) return null; // no matching partner (unclosed / stray / fenced) → nothing to keep in sync\n\n const open = tagNameSpan(rawLines[sec.startLine] ?? '', sec.startLine, false);\n const close = tagNameSpan(rawLines[sec.endLine - 1] ?? '', sec.endLine - 1, true);\n return open && close ? { open, close } : null;\n}\n\n/** A collapsible line range — 1-based inclusive line numbers, the shape both Monaco's FoldingRange and the LSP's\n * foldingRange take. */\nexport interface FoldRange {\n start: number;\n end: number;\n}\n\n/** Every foldable range in `source`: a `#` heading folds down to the next heading of equal-or-higher level; a\n * list item folds its more-indented sub-items; a whole-line `<tag>` folds to its matching `</tag>` (innermost\n * first). `<examples>` interiors are literal, so sample headings/lists/tags inside them create no folds (the\n * block itself still folds as one unit). This lived inline in the editor; in core, the LSP serves it to every\n * IDE and the preview reaches it through the worker — one implementation. */\nexport function foldingRanges(source: string): FoldRange[] {\n const lines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const count = lines.length;\n const exMask = examplesMask(lines);\n const info: { line: number; indent: number; isList: boolean; isHeading: boolean; blank: boolean; level: number; tagOpen: string | null; tagClose: string | null }[] = [];\n for (let i = 1; i <= count; i += 1) {\n const text = lines[i - 1] ?? '';\n const trimmed = text.trim();\n const masked = exMask[i - 1] ?? false;\n const hm = masked ? null : trimmed.match(/^(#{1,6})\\s/);\n const st = masked ? null : matchSectionTag(text);\n info.push({\n line: i,\n indent: text.length - text.trimStart().length,\n isList: !masked && /^([-*+]|\\d+(?:\\.\\d+)*[.)])\\s/.test(trimmed),\n isHeading: hm !== null,\n blank: trimmed === '',\n level: hm?.[1]?.length ?? 0,\n tagOpen: st && st.open && !st.inline ? st.open : null,\n tagClose: st && st.close && !st.inline ? st.close : null,\n });\n }\n\n const ranges: FoldRange[] = [];\n\n // Blocks: a heading folds down to the next heading of equal-or-higher level.\n const headers = info.filter((x) => x.isHeading);\n for (let h = 0; h < headers.length; h += 1) {\n const cur = headers[h];\n if (!cur) continue;\n let end = count;\n for (let k = h + 1; k < headers.length; k += 1) {\n const nxt = headers[k];\n if (nxt && nxt.level <= cur.level) {\n end = nxt.line - 1;\n break;\n }\n }\n if (end > cur.line) ranges.push({ start: cur.line, end });\n }\n\n // Nested lists: a list item folds its more-indented sub-items, just like a block.\n for (let a = 0; a < info.length; a += 1) {\n const cur = info[a];\n if (!cur || !cur.isList) continue;\n let lastChild = a;\n for (let b = a + 1; b < info.length; b += 1) {\n const nxt = info[b];\n if (!nxt) break;\n if (nxt.blank) continue;\n if (nxt.isHeading) break;\n if (nxt.indent > cur.indent) lastChild = b;\n else break;\n }\n const child = info[lastChild];\n if (lastChild > a && child) ranges.push({ start: cur.line, end: child.line });\n }\n\n // XML tag blocks: a whole-line `<tag>` folds down to its matching `</tag>`, innermost first.\n const tagStack: { tag: string; line: number }[] = [];\n for (const x of info) {\n if (x.tagOpen) tagStack.push({ tag: x.tagOpen, line: x.line });\n else if (x.tagClose) {\n for (let s = tagStack.length - 1; s >= 0; s -= 1) {\n if (tagStack[s]?.tag === x.tagClose) {\n const o = tagStack.splice(s, 1)[0];\n if (o && x.line > o.line) ranges.push({ start: o.line, end: x.line });\n break;\n }\n }\n }\n }\n\n return ranges;\n}\n\n/** Locate the tag NAME within a whole-line `<name>` (open) or `</name>` (close), tolerant of leading indent\n * and of attributes on the open (`<name attr>`). Columns are 0-based; the name starts one char past `<` on an\n * open, two past `</` on a close. */\nfunction tagNameSpan(line: string, lineIdx: number, closing: boolean): TagNameSpan | null {\n const m = line.match(closing ? /^(\\s*)<\\/([a-z][a-z0-9_]*)/i : /^(\\s*)<([a-z][a-z0-9_]*)/i);\n if (!m) return null;\n const start = (m[1] ?? '').length + (closing ? 2 : 1);\n return { line: lineIdx, start, end: start + (m[2] ?? '').length };\n}\n\n/** The nesting depth a whole-line `<name>` section at `openLineIdx` will settle at ONCE it's closed — i.e. how\n * many tab-stops its opening/closing tag and body should be indented. Used by the editor's tag auto-close so\n * it drops the block at the RIGHT indent immediately, instead of at the caret's (shallower) indent and letting\n * the auto-indent reflow it a beat later — the jump that made nested auto-close feel inconsistent.\n *\n * It closes the tag hypothetically (so the section becomes balanced) and reads the authoritative per-line depth\n * back from `structure()`, so it accounts for BOTH enclosing XML tags and enclosing `#`/`##` headings exactly\n * as the live auto-indent does — the two never disagree. Returns 0 for a non-tag line. Pure. */\nexport function sectionDepthAfterClose(rawLines: string[], openLineIdx: number): number {\n const m = (rawLines[openLineIdx] ?? '').match(/^\\s*<([a-z][a-z0-9_]*)>\\s*$/i);\n if (!m) return 0;\n const tag = m[1] ?? '';\n const hypothetical = [...rawLines];\n hypothetical.splice(openLineIdx, 1, `<${tag}>`, '', `</${tag}>`); // balance it: trimmed open, empty body, close\n return structure(hypothetical.join('\\n')).perLine[openLineIdx]?.depth ?? 0;\n}\n\n/** Resolve step anchors for the COMPILED prompt. The `#name` anchors are author-facing identity, not content,\n * so the model never sees them: each `#name` DECLARATION is stripped (the step keeps its number), and every\n * `#name` REFERENCE is rewritten to that step's number — so the model reads consistent, followable steps\n * (`per step 1A`, not `per step #greet`). A reference to an undefined anchor is left untouched (the structural\n * checker has already flagged it as dangling). Fenced code is left alone. */\nexport function resolveAnchors(source: string): string {\n const lines = source.split('\\n');\n const anchored = buildStructure(lines).steps.filter((s) => s.anchor !== null);\n if (anchored.length === 0) return source;\n const label = new Map<string, string>(); // anchor name -> the step's displayed number (\"1A\"), case preserved\n for (const s of anchored) {\n if (!s.anchor) continue;\n label.set(s.anchor, (lines[s.line] ?? '').match(/^\\s*(\\d+(?:\\.\\d+)*)/)?.[1] ?? s.ord);\n lines[s.line] = (lines[s.line] ?? '').replace(/^(\\s*\\d+(?:\\.\\d+)*[.)]\\s+)#[a-z][a-z0-9_]*\\s+/i, '$1');\n }\n let inFence = false;\n return lines\n .map((line) => {\n const t = line.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return line;\n }\n return inFence ? line : line.replace(/#([a-z][a-z0-9_]*)/gi, (whole, name: string) => label.get(name.toLowerCase()) ?? whole);\n })\n .join('\\n');\n}\n\n/** Renumber nested steps so each parent's children run .1, .2, .3… in document order — delete `2.2` from\n * `2.1 2.2 2.3` and the old `2.3` becomes `2.2`, and its own descendants (`2.3.1` → `2.2.1`) cascade with it.\n * Label references (`step 2.3`, `go to 2.3`) are rewritten to follow the survivors; `#anchor` references carry\n * no number, so they are inherently stable and untouched. Top-level numbers (`1.`, `2.`) are left as the author\n * wrote them. Pure + idempotent: returns the SAME array when nothing needs renumbering. A transient duplicate\n * ord (mid-insert) is ambiguous, so it relabels its markers but is left out of reference rewriting. */\nexport function renumberSubSteps(lines: string[]): string[] {\n const doc = buildStructure(lines);\n // Assign each step a new dotted ord, top-down by line: a top step keeps its number; a nested step's last\n // segment is its 1-based position among siblings. A renamed parent flows into its children via `oldToNew`.\n const oldToNew = new Map<string, string>();\n const ambiguous = new Set<string>();\n const childCount = new Map<string, number>(); // parent NEW ord -> children numbered so far\n for (const s of [...doc.steps].sort((a, b) => a.line - b.line)) {\n let neu: string;\n if (s.parent === null) neu = String(s.major);\n else {\n // A renamed parent step flows in via oldToNew; an orphan sub-step (no parent line) keeps its literal path\n // prefix, so its siblings still renumber under it.\n const parentNew = oldToNew.get(s.parent) ?? s.parent;\n const n = (childCount.get(parentNew) ?? 0) + 1;\n childCount.set(parentNew, n);\n neu = `${parentNew}.${n}`;\n }\n if (oldToNew.has(s.ord) && oldToNew.get(s.ord) !== neu) ambiguous.add(s.ord);\n else oldToNew.set(s.ord, neu);\n }\n for (const a of ambiguous) oldToNew.delete(a);\n\n type Edit = { line: number; start: number; end: number; text: string };\n const edits: Edit[] = [];\n for (const s of doc.steps) {\n const neu = oldToNew.get(s.ord);\n if (neu === undefined || neu === s.ord) continue;\n const m = (lines[s.line] ?? '').match(/^(\\s*)(\\d+(?:\\.\\d+)*)/); // the ord in this step's own marker\n if (m) edits.push({ line: s.line, start: (m[1] ?? '').length, end: (m[1] ?? '').length + (m[2] ?? '').length, text: neu });\n }\n if (edits.length === 0) return lines;\n for (const r of findReferences(lines, doc)) {\n if (r.kind !== 'step') continue;\n const neu = oldToNew.get(r.key); // an anchor ref keys on a NAME, never a dotted ord → left alone\n if (neu === undefined || neu === r.key) continue;\n const text = (lines[r.line] ?? '').slice(r.start, r.end);\n const rewritten = text.replace(/\\d+(?:\\.\\d+)*/, neu);\n if (rewritten !== text) edits.push({ line: r.line, start: r.start, end: r.end, text: rewritten });\n }\n const out = [...lines];\n const byLine = new Map<number, Edit[]>();\n for (const e of edits) {\n const list = byLine.get(e.line) ?? [];\n list.push(e);\n byLine.set(e.line, list);\n }\n for (const [ln, es] of byLine) {\n es.sort((a, b) => b.start - a.start); // apply right-to-left so earlier offsets stay valid\n let text = out[ln] ?? '';\n for (const e of es) text = text.slice(0, e.start) + e.text + text.slice(e.end);\n out[ln] = text;\n }\n return out;\n}\n\n// ── References ──\nexport interface StructRef {\n kind: SymbolKind;\n line: number;\n start: number;\n end: number;\n key: string; // resolved/raw token (lowercased)\n resolved: boolean;\n}\n\nconst STEP_REF_PATTERNS = [\n /\\b(?:flow\\s+)?step\\s+(\\d+(?:\\.\\d+)*)/gi, // step 2 / flow step 2.1.3\n /\\(step\\s+(\\d+(?:\\.\\d+)*)\\)/gi, // (step 8) — explicit keyword\n /\\((\\d+\\.\\d+(?:\\.\\d+)*)\\)/gi, // (2.1) — a DOTTED ord; a bare (1)/(2) is a prose enumeration, not a step ref\n /\\b(\\d+(?:\\.\\d+)*)\\s*=\\s*[a-z]+/gi, // 2.1=yes\n];\n// A step ordinal is 1-indexed at every level (`2`, `2.1`, `2.1.3`); a zero segment (`1.0`, `2.0`) is a decimal\n// — a ratio, a version, a time — never a step. Reject those so `back to 1.0` / `speed 1.0` aren't read as refs.\nconst STEP_ORD = /^[1-9]\\d*(?:\\.[1-9]\\d*)*$/;\nconst STEP_RANGE = /\\b(\\d+\\.\\d+(?:\\.\\d+)*)\\s*[–-]\\s*(\\d+\\.\\d+(?:\\.\\d+)*)\\b/g; // 2.1–2.5 (dotted endpoints, both marked)\nconst STEP_POINTER = /\\b(?:to|into|goto|see|per|then|at|from)\\s+(\\d+\\.\\d+(?:\\.\\d+)*)\\b/gi; // `go to 2.1` — a nav cue + a dotted (sub-)step ord (bare `to 5` stays a quantity)\nconst INLINE_TAG = /<([a-z][a-z0-9_]*)>/gi; // <closing> in prose\nconst TRANSREF = /@<([a-z][a-z0-9_]*)((?:\\.|#)[a-z][a-z0-9_]*)?>/gi; // @<section> / @<alias.section> / @<alias#anchor> — the transclusion insertion sigil\nconst TOOLINLINE = /@\\[([a-z][a-z0-9_]*)\\]/gi; // @[tool] — inline a $TOOL definition's schema\nconst ANCHOR_REF = /#([a-z][a-z0-9_]*)/gi; // #greet — a reference to the step NAMED `greet` (stable across renumbering)\nconst MARKER_PREFIX = /^\\s*\\d+(?:\\.\\d+)*[.)]\\s+$/i; // a line up to its step marker — where a `#name` is DECLARED, not referenced\n\n/** Blank a span so a later scan doesn't see it (length-preserving). */\nfunction blank(s: string, re: RegExp): string {\n return s.replace(re, (m) => ' '.repeat(m.length));\n}\n\n/** Every structural reference in the body, resolved against the doc's index. Masking-aware. */\nexport function findReferences(rawLines: string[], doc: StructuredDoc): StructRef[] {\n const kinds = classifyLines(rawLines);\n const xmlOpenLines = new Set(doc.sections.filter((s) => s.syntax === 'xml').map((s) => s.startLine));\n // Tools are on the scan when they exist at all — imported OR defined in-file.\n const hasToolImport = doc.imports.some((x) => x.kind === 'tool') || doc.toolDefs.length > 0;\n const fileImportKeys = new Set(doc.fileImports.map((f) => f.key)); // `$IMPORT file … as alias` keys — an `@<alias>` transclusion target\n\n // A $TOOL block's interior is a DEFINITION, not body prose: its param names are bare snake_case that would\n // false-flag as undeclared tools, and nothing inside it references the prompt's structure. Skip the span.\n const toolMask = toolBlockMask(rawLines);\n const out: StructRef[] = [];\n\n const cfgMask = configSectionMask(rawLines);\n // Literal content holds no references: an <examples>/<\"name\"> interior is illustration (a sample\n // `<tag>` or `@<name>` must never squiggle as dangling), and fenced code is literal per §1 — track\n // fences here since no line-kind carries it.\n const litMask = examplesMask(rawLines);\n let inFence = false;\n rawLines.forEach((raw, i) => {\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return; // the fence line itself is punctuation, not prose\n }\n if (inFence || litMask[i]) return; // literal zones — samples, not references\n if (toolMask[i]) return; // a $TOOL/$SERVICE body is a definition, not referencing prose\n if (cfgMask[i] && (CONFIG_SECTION_OPEN.test(raw) || CONFIG_SECTION_CLOSE.test(raw))) return; // a <$config> tag names no reference\n if (kinds[i] === 'comment' || doc.importLines.has(i) || doc.configLines.has(i) || doc.defineLines.has(i) || doc.testLines.has(i) || doc.exampleLines.has(i) || isHeadingLine(raw) || isAnnotationLine(raw)) return; // a heading/annotation holds no references — its text is inert\n // Mask control-plane conditionals — a `when=…>` guard and a deterministic arm's `$IF …:` head are\n // compiled away, so their pointers and operand values are never prose references (an enum member like\n // `same_day` in a condition must not read as an undeclared tool). Their variable reads still count as\n // USED — the guard-vars fold-back below re-adds every atom the guards and chains read. An arm's inline\n // BODY is prose, so it's kept. The guard mask stops BEFORE the tag's closing `>` (lookahead): that\n // bracket belongs to the TAG, and the bare-tool scan below blanks `<tag …>` tokens by shape — eating\n // the `>` here would leave the section name bracketless, reading as a bare tool mention\n // (`<priority_handling when=…>` must never flag \"tool priority_handling is used but never imported\").\n const masked = maskQuotes(raw)\n .replace(/\\s+\\/\\/.*$/, (m) => ' '.repeat(m.length))\n .replace(/\\bwhen=[^>]*(?=>)/gi, (m) => ' '.repeat(m.length))\n .replace(/^\\s*\\$SWITCH\\b.*$/i, (m) => ' '.repeat(m.length))\n .replace(/^(\\s*\\$(?:IF|ELSE\\s+IF)\\b[^:]*:|\\s*\\$ELSE\\s*:)/i, (m) => ' '.repeat(m.length))\n .replace(/^(\\s*(?:CASE\\b[^:]*|ELSE(?:\\s+IF\\b[^:]*)?)\\s*:)/i, (m) => ' '.repeat(m.length));\n const covered: [number, number][] = [];\n const overlaps = (s: number, e: number): boolean => covered.some(([a, b]) => s < b && e > a);\n const add = (kind: SymbolKind, s: number, e: number, key: string, resolved: boolean): void => {\n if (overlaps(s, e)) return;\n covered.push([s, e]);\n out.push({ kind, line: i, start: s, end: e, key, resolved });\n };\n let m: RegExpExecArray | null;\n\n // Step references (ranges first — most specific). A `2.1–2.5` range marks BOTH endpoints as refs, each\n // resolved by membership; the span between isn't expanded (dotted ranges rarely enumerate cleanly).\n STEP_RANGE.lastIndex = 0;\n while ((m = STEP_RANGE.exec(masked)) !== null) {\n const a = (m[1] ?? '').toLowerCase();\n const b = (m[2] ?? '').toLowerCase();\n const bStart = m.index + m[0].length - b.length;\n add('step', m.index, m.index + a.length, a, doc.index.steps.has(a));\n add('step', bStart, m.index + m[0].length, b, doc.index.steps.has(b));\n }\n for (const re of STEP_REF_PATTERNS) {\n re.lastIndex = 0;\n while ((m = re.exec(masked)) !== null) {\n const key = (m[1] ?? '').toLowerCase();\n if (!STEP_ORD.test(key)) continue; // a decimal (`1.0`), not a step ord\n add('step', m.index, m.index + m[0].length, key, doc.index.steps.has(key));\n }\n }\n // Bare sub-step pointers in prose — `Go to 2A`, `see 2A`, `then 2B`. A navigation cue (`to`/`see`/`per`/\n // `then`/…) before the ord is what marks it a POINTER, so `version 2A` (no cue) stays prose and the step's\n // own marker (`2A.` with nothing before it) is never a pointer to itself. Only the ORD is highlighted, not\n // the cue; membership decides resolved-vs-dangling, so `go to 2Z` (no such step) squiggles. Explicit\n // `step 2.1` / `(2.1)` / ranges are matched above and reserve their span, so this never re-flags them.\n STEP_POINTER.lastIndex = 0;\n while ((m = STEP_POINTER.exec(masked)) !== null) {\n const key = (m[1] ?? '').toLowerCase();\n if (!STEP_ORD.test(key)) continue; // `back to 1.0` is a value, not a pointer to step 1.0\n const ordStart = m.index + m[0].length - (m[1] ?? '').length;\n add('step', ordStart, m.index + m[0].length, key, doc.index.steps.has(key));\n }\n // Anchor references — `#greet` points to the step NAMED greet, stable across renumbering. A `#name` sitting\n // right after a step marker is that step's own anchor DECLARATION, not a reference, so skip it. An unknown\n // `#name` resolves to nothing → a dangling step reference (membership over the anchor set).\n ANCHOR_REF.lastIndex = 0;\n while ((m = ANCHOR_REF.exec(masked)) !== null) {\n if (MARKER_PREFIX.test(masked.slice(0, m.index))) continue;\n const name = (m[1] ?? '').toLowerCase();\n add('step', m.index, m.index + m[0].length, name, doc.index.anchors.has(name));\n }\n\n // Transclusion references — `@<name>` (same-file section or import alias) and `@<alias.section>` /\n // `@<alias#anchor>` (into an imported file). Scanned BEFORE the inline-tag pass so the inner `<name>` is\n // never re-counted as a section tag. A resolved ref enables go-to-def; an UNRESOLVED one is left to\n // expandImports (imports.ts), which owns the `@<…>` dangling error — so we never double-flag it here.\n TRANSREF.lastIndex = 0;\n while ((m = TRANSREF.exec(masked)) !== null) {\n const [ts, te] = [m.index, m.index + m[0].length];\n const key = (m[1] ?? '').toLowerCase();\n const addressed = !!m[2]; // `.section` / `#anchor` → addresses into an imported file, never a same-file section\n if (!addressed && doc.index.sections.has(key)) add('section', ts, te, key, true);\n else if (fileImportKeys.has(key)) add('alias', ts, te, key, true);\n else covered.push([ts, te]); // unresolved — claim the span so the inline-tag pass skips its interior\n }\n\n // The tool POINTER — `@[name]` is THE tool reference form: a DEFINED tool resolves (go-to-def to its\n // `$TOOL` block, schema splice on a listing line), and an IMPORTED tool resolves too (the pointer marks\n // the manifest entry USED and emits the bare name). Only an unknown name adds nothing — it is left to\n // the dedicated `@[…]` diagnostic (diagnostics.ts); claim its span so no other pass re-reads the interior.\n TOOLINLINE.lastIndex = 0;\n while ((m = TOOLINLINE.exec(masked)) !== null) {\n const [is, ie] = [m.index, m.index + m[0].length];\n const key = (m[1] ?? '').toLowerCase();\n if (doc.index.tools.has(key)) add('tool', is, ie, key, true);\n else covered.push([is, ie]);\n }\n\n // Section references — a bare inline <tag> in prose. Skip any WHOLE-line `<tag>` (a section OPEN, balanced\n // or not — its balance is checked separately, so don't also flag it as a dangling reference), and skip a\n // <tag>…</tag> content pair on the same line (e.g. `<spell>K1A</spell>` is a TTS tag, not a section ref).\n // Resolution is membership, so a typo'd `<closeing>` in prose surfaces as a dangling reference.\n if (!xmlOpenLines.has(i) && !matchSectionTag(raw)?.open) {\n INLINE_TAG.lastIndex = 0;\n while ((m = INLINE_TAG.exec(masked)) !== null) {\n const key = (m[1] ?? '').toLowerCase();\n if (masked.slice(m.index + m[0].length).toLowerCase().includes(`</${key}>`)) continue;\n add('section', m.index, m.index + m[0].length, key, doc.index.sections.has(key));\n }\n }\n\n // Variable references — `@{name}`, each a reference to its variable symbol.\n VARREF.lastIndex = 0;\n while ((m = VARREF.exec(masked)) !== null) add('variable', m.index, m.index + m[0].length, (m[1] ?? '').toLowerCase(), true);\n\n // Route references — an imported route name appearing in the body (membership).\n for (const r of doc.imports) {\n if (r.kind !== 'route') continue;\n let from = 0;\n const lower = masked.toLowerCase();\n let at: number;\n while ((at = lower.indexOf(r.key, from)) >= 0) {\n add('route', at, at + r.key.length, r.key, true);\n from = at + r.key.length;\n }\n }\n\n // Bare snake_case tool mentions (outside {}/[] var spans). Checked only when tools are imported.\n // These still SCAN — the link shows which tool a mention hit — but a bare mention is now an error\n // (structure/bare-tool-ref): the pointer above is the canonical reference.\n if (hasToolImport) {\n // Tag tokens are STRUCTURE, not prose: a snake_case section name inside <...> (open, close, or\n // inline) must never read as a bare tool mention — the moment a file defines its first $TOOL,\n // every <language_reference> tag would otherwise flag as an undeclared tool.\n const noVars = blank(blank(masked, new RegExp(`<\\\\/?${TAG_NAME_SRC}(?:\\\\s[^>]*)?>`, 'gi')), /[{[][^}\\]]*[}\\]]/g);\n SNAKE_RE.lastIndex = 0;\n while ((m = SNAKE_RE.exec(noVars)) !== null) {\n const key = m[0].toLowerCase();\n if (doc.index.inputs.has(key)) continue; // a bare input var, handled elsewhere\n add('tool', m.index, m.index + m[0].length, key, doc.index.tools.has(key));\n }\n }\n // (Dangling-var detection for curly inputs runs in the checks, gated on whether inputs are imported.)\n });\n return out;\n}\n\n// ── Branching ──\n// A step's sub-steps can be a DECISION: an ordered set of `If <guard>, <outcome>` branches, optionally closed\n// by an `Otherwise, <outcome>`. The syntax is deliberately plain English (an LLM reads it verbatim); the value\n// is the compile-time check that the decision is TOTAL and unambiguous. Two checks are sound with zero false\n// positives and run here: exhaustiveness when the guards switch on a declared enum (every member must be\n// handled), and dead-branch detection (nothing survives after `Otherwise`).\nexport interface Branch {\n line: number;\n ord: string; // the sub-step's ordinal, e.g. \"5a\"\n kind: 'if' | 'otherwise';\n guard: string; // the raw condition text (empty for `otherwise`)\n outcome: string; // the raw action/goto text\n}\nexport interface BranchGroup {\n parent: string; // the parent step's ord (\"2\", \"2.1\") — the decision hangs off its direct children\n headerLine: number; // the parent step's line — where a group-level diagnostic (a missing case) anchors\n headerText: string; // the parent step's text — carries the `Based on …:` decision marker, if any\n branches: Branch[]; // in source order\n}\n\nconst IF_BRANCH = /^\\s*if\\b\\s*(.*)$/i;\nconst OTHERWISE_BRANCH = /^\\s*otherwise\\b[,:]?\\s*(.*)$/i;\n// A parent step that OPTS the sub-steps into decision semantics: `Based on X:` / `Depending on X:`. The prefix\n// means \"switching on X\" (so it's a decision, not a `Watch for these:` checklist), and the trailing colon marks\n// a header rather than a statement (`Based on the research, the tone is formal.`). This is the sound signal that\n// lets a free-predicate guard chain REQUIRE an `Otherwise` — without it, a bare run of `If`s stays unflagged.\nconst DECISION_HEADER = /^(?:based|depending)\\s+on\\b.*:\\s*$/i;\n\n/** Does this parent-step text declare its `If` sub-steps to be one exhaustive decision? */\nexport function isDecisionHeader(text: string): boolean {\n return DECISION_HEADER.test(text.trim());\n}\n\n/** Parse a sub-step's text as a branch — `If <guard>, <outcome>` or `Otherwise, <outcome>` — or null if it's an\n * ordinary step. The guard is everything up to the first comma (natural English puts one there); no comma means\n * the whole remainder is the guard and the outcome is empty. Pure. */\nexport function parseBranch(text: string): { kind: 'if' | 'otherwise'; guard: string; outcome: string } | null {\n const ow = text.match(OTHERWISE_BRANCH);\n if (ow) return { kind: 'otherwise', guard: '', outcome: (ow[1] ?? '').trim() };\n const iff = text.match(IF_BRANCH);\n if (!iff) return null;\n const rest = iff[1] ?? '';\n const comma = rest.indexOf(',');\n return comma >= 0\n ? { kind: 'if', guard: rest.slice(0, comma).trim(), outcome: rest.slice(comma + 1).trim() }\n : { kind: 'if', guard: rest.trim(), outcome: '' };\n}\n\n/** Group a step's DIRECT children into a decision when they're branches (`If …` / `Otherwise …`), in source\n * order — so a decision can sit at any depth (`2.` with `2.1`/`2.2` branches, or `2.1.` with `2.1.1`/`2.1.2`).\n * A step with no branch children is not a decision and is omitted. Pure. */\nexport function branchGroups(doc: StructuredDoc): BranchGroup[] {\n const byOrd = new Map<string, StepSymbol>();\n const byParent = new Map<string, StepSymbol[]>();\n for (const s of doc.steps) {\n byOrd.set(s.ord, s);\n if (s.parent === null) continue; // a top-level step is a flow, not a branch of some parent\n const list = byParent.get(s.parent) ?? [];\n list.push(s);\n byParent.set(s.parent, list);\n }\n const groups: BranchGroup[] = [];\n for (const [parent, children] of byParent) {\n const branches: Branch[] = [];\n for (const s of [...children].sort((a, b) => a.line - b.line)) {\n const p = parseBranch(s.text);\n if (p) branches.push({ line: s.line, ord: s.ord, kind: p.kind, guard: p.guard, outcome: p.outcome });\n }\n if (branches.length === 0) continue;\n const header = byOrd.get(parent);\n groups.push({ parent, headerLine: header?.line ?? branches[0]?.line ?? 0, headerText: header?.text ?? '', branches });\n }\n return groups;\n}\n\n/** Canonical form of a single value, so an enum MEMBER and a guard's VALUE compare equal regardless of a\n * trailing sentence period, casing, or a leading article — `sales.` ≡ `Sales` ≡ `the sales` → `sales`. */\nexport function normValue(s: string): string {\n return s.trim().toLowerCase().replace(/[.,;:!?]+$/, '').replace(/^(?:an?|the)\\s+/, '').trim();\n}\n\n/** Normalize a guard into the discrete VALUES it tests, for matching against an enum's members. `it is billing`\n * → `[\"billing\"]`; `billing or sales` → `[\"billing\", \"sales\"]`; a prose predicate like `the caller is upset`\n * stays one opaque string that won't match any member (so it's simply not an enum switch). */\nfunction guardValues(guard: string): string[] {\n const head = guard.trim().toLowerCase().replace(/^(?:it'?s|it\\s+is)\\s+/, '');\n return head.split(/\\s*(?:,|\\bor\\b)\\s*/).map(normValue).filter((s) => s !== '');\n}\n\n// ── Integrity checks ──\nexport interface StructConflict {\n lines: number[];\n message: string;\n code: string; // → `structure/<code>`\n severity: Severity;\n}\n\nconst MAX_TUPLE_PRODUCT = 256; // above this, a tuple chain is too large to enumerate for coverage — it must carry an ELSE\n\n/** The first tuple in the cartesian product of `domains` (each axis a finite value list) that no `pattern` covers\n * — a pattern covers a tuple when every position is `_` or value-equal — or null if the patterns tile the whole\n * product. Mixed-radix decode of the flat index; only called when the product is within MAX_TUPLE_PRODUCT. Pure. */\nfunction firstUncovered(domains: string[][], patterns: string[][]): string[] | null {\n const total = domains.reduce((n, d) => n * d.length, 1);\n for (let idx = 0; idx < total; idx += 1) {\n const tuple: string[] = [];\n let rem = idx;\n for (const d of domains) {\n tuple.push(d[rem % d.length] ?? '');\n rem = Math.floor(rem / d.length);\n }\n if (!patterns.some((p) => p.every((cell, i) => cell === '_' || cell === tuple[i]))) return tuple;\n }\n return null;\n}\n\n/** Can every arm condition of a predicate chain be encoded for the Z3 exhaustiveness tier? True only when\n * each leaf reads a bool / enum / number at the matching test — a `$DEFINE` inlines to its base expression\n * (cycle-guarded). A string / untyped / type-mismatched leaf makes it unencodable, so that switch keeps the\n * structural require-ELSE rule. Pure (no Z3), and it mirrors EXACTLY what solver/exhaustiveness.ts encodes, so\n * the sync tier defers precisely the switches the solver will decide — the two never disagree. */\nexport function predicateEncodable(block: SwitchBlock, inputTypes: Map<string, InputType>, defines: Map<string, { expr: string }>): boolean {\n const okAtom = (name: string, test: 'bool' | 'value' | 'numeric', seen: Set<string>): boolean => {\n if (defines.has(name)) {\n if (test !== 'bool' || seen.has(name)) return false; // a define is bool; is/cmp on it is a mismatch; a cycle bails\n const ast = parseExpr(defines.get(name)?.expr ?? '').ast;\n return ast !== null && exprAtoms(ast).every((a) => okAtom(a.name, a.test, new Set([...seen, name])));\n }\n const t = inputTypes.get(name);\n if (!t) return false; // untyped / undeclared → opaque\n return test === 'bool' ? t.kind === 'bool' : test === 'numeric' ? t.kind === 'number' : t.kind === 'enum';\n };\n for (const arm of block.arms) {\n if (arm.kind !== 'case' || arm.predicate === undefined) continue;\n const ast = parseExpr(arm.predicate).ast;\n if (ast === null || !exprAtoms(ast).every((a) => okAtom(a.name, a.test, new Set()))) return false;\n }\n return true;\n}\n\n/** The whole structural integrity pass — built once, all checks run. Wired into runDiagnostics like checkOrder. */\nexport function structuralConflicts(rawLines: string[]): StructConflict[] {\n const doc = buildStructure(rawLines);\n const refs = findReferences(rawLines, doc);\n const out: StructConflict[] = [];\n\n // $TEST integrity — a malformed test is an ERROR (the wellFormed gate is what guarantees test\n // scaffolding can never leak into the model), and a bare EXPECT outside any block lost its indent.\n for (const t of doc.tests) {\n if (t.error !== null) out.push({ lines: [t.headerLine], message: t.error, code: 'bad-test', severity: 'error' });\n }\n for (const line of strayExpects(rawLines)) {\n out.push({ lines: [line], message: 'EXPECT is retired — write each expectation as a \"- \" sub-bullet under \"- expect::\" inside a $TEST block.', code: 'bad-test', severity: 'error' });\n }\n\n // $EXAMPLE integrity — a malformed example is an ERROR: its scaffolding strips and its GOOD emits as\n // few-shot, so a broken block would either vanish silently or ship a half-formed exchange to the model.\n for (const e of doc.examples) {\n if (e.error !== null) out.push({ lines: [e.headerLine], message: e.error, code: 'bad-example', severity: 'error' });\n }\n\n // <$CONFIG> integrity — only command content belongs inside: everything in the section is\n // stripped from the render, so a prompt rule dragged in here would VANISH silently (the exact\n // silent-wrong failure the compiler exists to prevent). Tag balance rides the shared\n // unclosed-tag / stray-close machinery.\n const cfgMask = configSectionMask(rawLines);\n if (cfgMask.some(Boolean)) {\n const kinds = classifyLines(rawLines);\n const defMask = toolBlockMask(rawLines);\n rawLines.forEach((raw, i) => {\n if (!cfgMask[i]) return;\n if (CONFIG_SECTION_OPEN.test(raw) || CONFIG_SECTION_CLOSE.test(raw)) return;\n if (raw.trim() === '' || kinds[i] === 'comment') return;\n if (doc.importLines.has(i) || doc.configLines.has(i) || doc.defineLines.has(i) || doc.testLines.has(i) || defMask[i]) return;\n out.push({\n lines: [i],\n message:\n 'Content inside <$CONFIG> never reaches the model — only $-commands ($IMPORT, $CONFIG, $TOOL, $DEFINE, $TEST) belong here. Move prompt content outside the section.',\n code: 'config-section-content',\n severity: 'error',\n });\n });\n }\n\n // XML tag balance — a `<tag>` block is a hard delimiter, so every whole-line `<x>` must have a matching\n // `</x>` with the SAME name. An open with no close, or a close whose name doesn't match any open (a typo\n // like `</exmaples>`, or a stray `</x>`), blocks compile — the block boundary would be ambiguous.\n for (const u of doc.unclosedTags) {\n out.push({ lines: [u.line], message: `Tag <${u.tag}> is opened but never closed — add a </${u.tag}>.`, code: 'unclosed-tag', severity: 'error' });\n }\n for (const c of doc.strayCloses) {\n out.push({ lines: [c.line], message: `</${c.tag}> has no matching <${c.tag}> to close.`, code: 'stray-close-tag', severity: 'error' });\n }\n\n // Sequence: a duplicate ord makes a reference ambiguous; and each parent's children (and the top-level steps)\n // should run 1, 2, 3… with no gaps and in order. The checks are per-parent so they apply at every depth.\n const byOrd = new Map<string, StepSymbol[]>();\n for (const s of doc.steps) {\n const list = byOrd.get(s.ord);\n if (list) list.push(s);\n else byOrd.set(s.ord, [s]);\n }\n for (const [ord, list] of byOrd) {\n if (list.length > 1) out.push({ lines: list.map((s) => s.line), message: `Duplicate step \"${ord}\" — ${list.length} steps carry this number, so a reference to it is ambiguous. Renumber one of them.`, code: 'duplicate-step', severity: 'error' });\n }\n // Statement-alias uniqueness — a `@@ name:` whose name is already taken collides: a duplicate name resolves\n // to the pre-existing symbol (or the first alias), never this statement. Warn so the author renames. Steps are\n // dotted ords (an identifier alias can't collide) and anchors live in a separate `#name` namespace, so neither\n // is checked here.\n {\n const kindOf = (n: string): string | null =>\n doc.index.tools.has(n) ? 'tool' : doc.index.routes.has(n) ? 'route' : doc.index.inputs.has(n) ? 'input' : doc.index.sections.has(n) ? 'section' : doc.variables.has(n) ? 'variable' : null;\n const seenAlias = new Set<string>();\n for (const a of doc.aliases) {\n if (seenAlias.has(a.name)) {\n out.push({ lines: [a.line], message: `Statement alias @@ ${a.name}: is already used by another annotation — a name can point at only one statement.`, code: 'alias-collision', severity: 'warn' });\n } else {\n const k = kindOf(a.name);\n if (k) out.push({ lines: [a.line], message: `Statement alias @@ ${a.name}: collides with an existing ${k} of that name. Rename the alias.`, code: 'alias-collision', severity: 'warn' });\n }\n seenAlias.add(a.name);\n }\n }\n // Section-name hygiene — clear, distinct names are what make XML structure pay off. Control sections (<$CONFIG>)\n // and <examples> interiors (already masked out of doc.sections) are exempt, so repeated few-shot <example> tags\n // never trip this. Exact duplicates + near-duplicates are ERRORS (ambiguous structure); vague names are a WARN.\n {\n const named = doc.sections.filter((s) => s.control !== true);\n // Inherently-repeatable content tags — a doc may legitimately have many, so they're exempt from the\n // exact-duplicate error (an accidental double <identity> is the real target).\n const REPEATABLE = new Set(['example', 'case', 'item', 'option', 'step', 'turn', 'message', 'exchange', 'entry']);\n const byTag = new Map<string, SectionSymbol[]>();\n for (const s of named) {\n const list = byTag.get(s.tag) ?? [];\n list.push(s);\n byTag.set(s.tag, list);\n }\n // 1) Exact duplicates — the same name opens two+ sections.\n for (const [tag, list] of byTag) {\n if (list.length > 1 && !REPEATABLE.has(tag)) {\n out.push({ lines: list.map((s) => s.startLine), message: `Duplicate section \"${tag}\" — ${list.length} sections share this name. Give each a distinct name; the structure (and any reference to \"${tag}\") is ambiguous.`, code: 'duplicate-section', severity: 'error' });\n }\n }\n // 2) Near-duplicates — DISTINCT names that are singular/plural or share a stem at an underscore boundary.\n const nearDup = (a: string, b: string): boolean =>\n a + 's' === b || b + 's' === a || a + 'es' === b || b + 'es' === a || b.startsWith(`${a}_`) || a.startsWith(`${b}_`);\n const tags = [...byTag.keys()];\n for (let i = 0; i < tags.length; i += 1) {\n for (let j = i + 1; j < tags.length; j += 1) {\n const a = tags[i] ?? '';\n const b = tags[j] ?? '';\n if (!nearDup(a, b)) continue;\n const lines = named.filter((s) => s.tag === a || s.tag === b).map((s) => s.startLine);\n out.push({ lines, message: `Near-duplicate section names \"${a}\" and \"${b}\" — consolidate them or give each a clearly distinct name.`, code: 'near-duplicate-section', severity: 'error' });\n }\n }\n // 3) Vague / opaque XML tag names (warn) — a name should say what the section CONTAINS. Headings are prose, so\n // this targets XML tags only; the check is stem-aware so `section1` reads as vague too.\n const VAGUE = new Set(['section', 'content', 'contents', 'data', 'info', 'text', 'stuff', 'misc', 'part', 'tmp', 'temp', 'block', 'tag', 'thing', 'things', 'general', 'main', 'body', 'other', 'extra']);\n for (const s of named) {\n if (s.syntax !== 'xml') continue;\n if (s.tag.length <= 2) {\n out.push({ lines: [s.startLine], message: `Section name \"${s.tag}\" is too short to be meaningful — name it for what it contains.`, code: 'vague-section-name', severity: 'warn' });\n continue;\n }\n const stem = s.tag.replace(/\\d+$/, '');\n if (stem === '' || VAGUE.has(stem)) {\n out.push({ lines: [s.startLine], message: `Section name \"${s.tag}\" is vague — name it for what it contains (e.g. <escalation_rules>, not <${s.tag}>).`, code: 'vague-section-name', severity: 'warn' });\n }\n }\n }\n const siblings = new Map<string, StepSymbol[]>(); // parent ord (\"\" for top steps) -> its children\n for (const s of doc.steps) {\n const key = s.parent ?? '';\n const list = siblings.get(key) ?? [];\n list.push(s);\n siblings.set(key, list);\n }\n const lastSeg = (s: StepSymbol): number => s.segments[s.segments.length - 1] ?? 0;\n const label = (parent: string, n: number): string => (parent ? `${parent}.${n}` : `${n}`);\n for (const [parent, kids] of siblings) {\n const byLine = [...kids].sort((a, b) => a.line - b.line);\n const nums = [...new Set(byLine.map(lastSeg))].sort((a, b) => a - b);\n for (let k = 1; k < nums.length; k += 1) {\n const prev = nums[k - 1] ?? 0;\n const cur = nums[k] ?? 0;\n for (let g = prev + 1; g < cur; g += 1) {\n const line = byLine.find((s) => lastSeg(s) === cur)?.line ?? 0;\n out.push({ lines: [line], message: `Missing step ${label(parent, g)} — the sequence jumps from ${label(parent, prev)} to ${label(parent, cur)}.`, code: 'missing-step', severity: 'error' });\n }\n }\n for (let k = 1; k < byLine.length; k += 1) {\n const cur = byLine[k];\n const prevStep = byLine[k - 1];\n if (cur && prevStep && lastSeg(cur) < lastSeg(prevStep)) {\n out.push({ lines: [cur.line], message: `Step ${cur.ord} appears after step ${prevStep.ord} — steps are out of order.`, code: 'unordered-step', severity: 'warn' });\n }\n }\n }\n\n // References: dangling steps/sections (dangling POINTERS); undeclared tools.\n for (const r of refs) {\n if (r.resolved) continue;\n if (r.kind === 'step') out.push({ lines: [r.line], message: `Reference to step ${r.key}, which is not defined.`, code: 'dangling-step-ref', severity: 'error' });\n else if (r.kind === 'section') out.push({ lines: [r.line], message: `Reference to section <${r.key}>, which is not defined.`, code: 'dangling-section-ref', severity: 'error' });\n else if (r.kind === 'tool') out.push({ lines: [r.line], message: `Tool \"${r.key}\" is used but never imported (add it to a $IMPORT tool line).`, code: 'undeclared-tool', severity: 'error' });\n }\n\n\n // Imports never referenced (dead manifest entries — unlike a section, an unused import IS a defect). A guard\n // variable counts as a reference: guards are masked out of findReferences (so a snake_case input isn't read\n // as a tool), so fold them back in here, or an input used only in a `when=` guard would read as unused.\n const guardVars = new Set<string>();\n for (const sec of doc.sections) {\n if (sec.syntax !== 'xml' || !sec.guard) continue;\n const parsed = parseExpr(sec.guard.text).ast;\n if (parsed) for (const a of exprAtoms(parsed)) guardVars.add(a.name);\n }\n for (const d of doc.defines.values()) {\n const parsed = parseExpr(d.expr).ast;\n if (parsed) for (const a of exprAtoms(parsed)) guardVars.add(a.name); // a var read in a $DEFINE is a reference too\n }\n const switches = parseSwitches(rawLines);\n for (const b of switches) {\n guardVars.add(b.varName); // a value chain's input counts as a reference ('' for a predicate block, harmless)\n for (const n of b.varNames ?? []) guardVars.add(n); // each tuple chain input, too\n for (const a of b.arms) {\n if (a.predicate === undefined) continue;\n const parsed = parseExpr(a.predicate).ast;\n if (parsed) for (const at of exprAtoms(parsed)) guardVars.add(at.name); // a var read in a predicate CASE, too\n }\n }\n const inlineSwitches = parseInlineSwitches(rawLines);\n for (const sw of inlineSwitches) guardVars.add(sw.varName); // an inline $SWITCH input, too\n const referenced = new Set([...refs.map((r) => r.key), ...guardVars]);\n\n // A condition variable is a declared input OR a $DEFINE name; a define is always boolean-typed (it names a\n // boolean expression). These fold defines into the guard/switch/define type-checks below.\n const isCondVar = (name: string): boolean => doc.index.inputs.has(name) || doc.defines.has(name);\n const condType = (name: string): InputType | undefined => doc.inputTypes.get(name) ?? (doc.defines.has(name) ? { kind: 'bool' } : undefined);\n // A MODULAR host (any `$IMPORT file`) defers unused-import to the composed program: a declaration's only\n // use may live inside an imported module (the host keeps the declaration — its runtime bag fills the\n // module's `$REQUIRE`), and this raw pass has no resolver to see it. Extraction relies on this: moving a\n // section out must not turn the host's still-real declarations into warnings.\n const modular = rawLines.some((l) => IMPORT_FILE_RE.test(l));\n for (const im of doc.imports) {\n if (!modular && !referenced.has(im.key)) out.push({ lines: [im.line], message: im.kind === 'variable' ? `Required variable \"${im.name}\" is never used.` : `Imported ${im.kind} \"${im.name}\" is never used.`, code: 'unused-import', severity: 'warn' });\n }\n\n // Tool definitions: the block-level integrity checks (duplicate tools/params, malformed params, missing\n // descriptions, binding placeholders, secret literals) come from the tool parser; the cross-file ones live here.\n out.push(...parseTools(rawLines).conflicts);\n const importedTools = new Map(doc.imports.filter((x) => x.kind === 'tool').map((x) => [x.key, x.line]));\n for (const t of doc.toolDefs) {\n const importLine = importedTools.get(t.name);\n if (importLine !== undefined) {\n out.push({ lines: [t.line, importLine], message: `Tool \"${t.name}\" is both DEFINED here and $IMPORTed — pick one: drop the import (it's defined in-file) or the definition.`, code: 'tool-defined-and-imported', severity: 'warn' });\n }\n // A defined tool the prompt never mentions is dead weight in the model's tool list — same as an unused import.\n if (!referenced.has(t.name)) {\n out.push({ lines: [t.line], message: `Defined tool \"${t.name}\" is never used in the prompt — the model cannot discover a tool no rule mentions. Reference it in a rule (e.g. \"call ${t.name} when ...\") or delete the definition.`, code: 'unused-tool', severity: 'warn' });\n }\n }\n\n // Typed variables: a `$REQUIRE variable name: type` (or deprecated `$IMPORT input name: type`) whose name or\n // type is malformed can't be resolved against, so a chain/guard on it would be unsound — block compile\n // rather than silently drop the type. Re-parse the manifest lines (buildStructure kept only well-formed ones).\n for (const line of doc.importLines) {\n const raw = rawLines[line] ?? '';\n const rq = raw.match(REQUIRE_RE);\n const im = rq ? null : raw.match(IMPORT_RE);\n const payload: string | null = rq ? (rq[1] ?? null) : im && im[1] === 'input' ? (im[2] ?? null) : null;\n if (payload === null || !payload.includes(':')) continue;\n const { error } = parseTypedInput(payload);\n if (error !== null) out.push({ lines: [line], message: error, code: 'bad-input-type', severity: 'error' });\n }\n\n // Section guards: `<tag when=$expr>` gates a section on typed inputs, resolved AWAY at compile. Parse each\n // guard and verify every atom is a declared input used at the right type — a bare read wants a bool, a value\n // comparison wants an enum member. A malformed guard, an undeclared input, a type mismatch, or an\n // out-of-domain value blocks compile (a guard on unsound state would silently mis-resolve). Untyped inputs\n // are opaque, so they're accepted either way (false-negative-safe).\n for (const sec of doc.sections) {\n if (sec.syntax !== 'xml' || !sec.guard) continue;\n const at = sec.startLine;\n const { ast, error } = parseExpr(sec.guard.text);\n if (error !== null || ast === null) {\n out.push({ lines: [at], message: `Guard on <${sec.tag}> is not a valid condition: ${error ?? 'parse error'}.`, code: 'bad-guard-expr', severity: 'error' });\n continue;\n }\n for (const atom of exprAtoms(ast)) {\n if (!isCondVar(atom.name)) {\n out.push({ lines: [at], message: `Guard on <${sec.tag}> reads @{${atom.name}}, which isn't a declared input or $DEFINE.`, code: 'undeclared-input', severity: 'error' });\n continue;\n }\n const type = condType(atom.name);\n if (type === undefined) continue; // untyped input ≈ string — opaque, so any use is accepted\n if (atom.test === 'bool' && type.kind !== 'bool') {\n out.push({ lines: [at], message: `Guard on <${sec.tag}> uses @{${atom.name}} as a boolean, but it's ${type.kind === 'enum' ? 'an enum' : `a ${type.kind}`} — compare it, e.g. ${type.kind === 'number' ? `\\`@{${atom.name}} is at least <n>\\`` : `\\`@{${atom.name}} is equal to <value>\\``}.`, code: 'guard-type-mismatch', severity: 'error' });\n } else if (atom.test === 'value' && type.kind === 'bool') {\n out.push({ lines: [at], message: `Guard on <${sec.tag}> compares @{${atom.name}} to a value, but it's a bool — use \\`@{${atom.name}}\\` or \\`not @{${atom.name}}\\`.`, code: 'guard-type-mismatch', severity: 'error' });\n } else if (atom.test === 'value' && type.kind === 'enum') {\n const bad = atom.values.filter((v) => !type.members.includes(v));\n if (bad.length > 0) out.push({ lines: [at], message: `Guard on <${sec.tag}>: @{${atom.name}} is never ${bad.join(', ')} (it's one of ${type.members.join(', ')}).`, code: 'impossible-value', severity: 'error' });\n } else if (atom.test === 'numeric' && type.kind !== 'number') {\n out.push({ lines: [at], message: `Guard on <${sec.tag}> compares @{${atom.name}} numerically (is greater than / is at least …), but it's ${type.kind === 'enum' ? 'an enum' : `a ${type.kind}`} — a numeric comparison needs a number input.`, code: 'guard-type-mismatch', severity: 'error' });\n }\n }\n }\n\n // Deterministic chains: a choose-one over typed inputs, resolved AWAY at compile. Prove the arm set\n // is total and unambiguous over the input's declared domain — no dead arm (after ELSE), no duplicated value,\n // no impossible value, and no uncovered member (or an ELSE). An open domain (number/string/untyped) can't be\n // exhaustive by enumeration, so it must carry an ELSE.\n for (const block of switches) {\n const at = block.headerLine;\n const isBlock = block.form === 'block'; // the `$SWITCH ON` member table vs the `$IF` chain — same engine, different contract\n const fallbackName = isBlock ? '\"- otherwise::\"' : 'ELSE';\n if (block.error !== null) {\n out.push({ lines: [at], message: block.error, code: block.errorCode ?? 'bad-switch', severity: 'error' });\n continue;\n }\n // Shared by both forms: an arm after ELSE/otherwise can never run; hasElse also decides exhaustiveness below.\n const elseIdx = block.arms.findIndex((a) => a.kind === 'else');\n for (const a of elseIdx >= 0 ? block.arms.slice(elseIdx + 1) : []) {\n out.push({ lines: [a.headerLine], message: `This arm comes after ${fallbackName}, so it can never run — move it above the ${isBlock ? 'otherwise row' : 'ELSE'}.`, code: 'unreachable-case', severity: 'error' });\n }\n const hasElse = elseIdx >= 0;\n\n // Predicate chains — each arm is a boolean condition, picked first-true (order matters, like if/elif).\n // Its totality can't be proven by enumeration (that's the Z3 slice), so it MUST carry an ELSE; each condition\n // is type-checked exactly like a guard (declared vars, right types, no impossible enum value).\n if (block.kind === 'predicate') {\n for (const a of block.arms) {\n if (a.kind !== 'case' || a.predicate === undefined) continue;\n const { ast, error } = parseExpr(a.predicate);\n if (error !== null || ast === null) {\n out.push({ lines: [a.headerLine], message: `This arm's condition doesn't parse: ${error ?? 'parse error'}.`, code: 'bad-case-expr', severity: 'error' });\n continue;\n }\n for (const atom of exprAtoms(ast)) {\n if (!isCondVar(atom.name)) {\n out.push({ lines: [a.headerLine], message: `This arm's condition reads @{${atom.name}}, which isn't a declared input or $DEFINE.`, code: 'undeclared-input', severity: 'error' });\n continue;\n }\n const t = condType(atom.name);\n if (t === undefined) continue; // untyped ≈ string, opaque — accepted\n if (atom.test === 'bool' && t.kind !== 'bool') out.push({ lines: [a.headerLine], message: `This arm's condition uses @{${atom.name}} as a boolean, but it's ${t.kind === 'enum' ? 'an enum' : `a ${t.kind}`} — compare it, e.g. ${t.kind === 'number' ? `\\`@{${atom.name}} is at least <n>\\`` : `\\`@{${atom.name}} is equal to <value>\\``}.`, code: 'guard-type-mismatch', severity: 'error' });\n else if (atom.test === 'value' && t.kind === 'bool') out.push({ lines: [a.headerLine], message: `This arm's condition compares @{${atom.name}} to a value, but it's a bool — use \\`@{${atom.name}}\\` or \\`not @{${atom.name}}\\`.`, code: 'guard-type-mismatch', severity: 'error' });\n else if (atom.test === 'value' && t.kind === 'enum') {\n const bad = atom.values.filter((v) => !t.members.includes(v));\n if (bad.length > 0) out.push({ lines: [a.headerLine], message: `This arm's condition: @{${atom.name}} is never ${bad.join(', ')} (it's one of ${t.members.join(', ')}).`, code: 'impossible-value', severity: 'error' });\n } else if (atom.test === 'numeric' && t.kind !== 'number') out.push({ lines: [a.headerLine], message: `This arm's condition compares @{${atom.name}} numerically (is greater than / is at least …), but it's ${t.kind === 'enum' ? 'an enum' : `a ${t.kind}`} — a numeric comparison needs a number input.`, code: 'guard-type-mismatch', severity: 'error' });\n }\n }\n // No ELSE: if the conditions are Z3-encodable, DEFER — the solver tier proves totality (and reports a real\n // gap with its counterexample). Only an unencodable switch (a string / untyped condition the solver can't\n // reason about) keeps the conservative require-ELSE rule here.\n if (!hasElse && !predicateEncodable(block, doc.inputTypes, doc.defines))\n out.push({ lines: [at], message: `A chain over open-ended conditions can't be proven exhaustive — add an ELSE arm.`, code: 'non-exhaustive-switch', severity: 'error' });\n continue;\n }\n\n // Tuple chain — conjunctions of equalities over the same inputs, matched first-hit. Every\n // combination of the vars' declared domains must be covered (a `_` expands a position) or an ELSE given; an\n // open axis (number/string/untyped) or a product too large to enumerate can't be proven total, so it needs ELSE.\n if (block.kind === 'tuple') {\n const vars = block.varNames ?? [];\n const undeclared = vars.filter((n) => !isCondVar(n));\n if (undeclared.length > 0) {\n for (const n of undeclared) out.push({ lines: [at], message: `This chain reads @{${n}}, which isn't a declared input or $DEFINE.`, code: 'undeclared-input', severity: 'error' });\n continue;\n }\n const domains = vars.map((n) => {\n const t = condType(n);\n return t?.kind === 'enum' ? t.members : t?.kind === 'bool' ? ['true', 'false'] : null;\n });\n const seen = new Set<string>();\n const covering: string[][] = []; // well-formed CASE patterns (right arity) fed to the coverage scan\n for (const a of block.arms) {\n if (a.kind !== 'case' || a.patterns === undefined) continue;\n a.patterns.forEach((p, i) => {\n const dom = domains[i];\n if (p !== '_' && dom && !dom.includes(p)) out.push({ lines: [a.headerLine], message: `@{${vars[i]}} is never ${p} (it's one of ${dom.join(', ')}).`, code: 'impossible-case', severity: 'error' });\n });\n const key = JSON.stringify(a.patterns);\n if (seen.has(key)) out.push({ lines: [a.headerLine], message: `The combination (${a.patterns.join(', ')}) is matched by an earlier arm — this arm can never run.`, code: 'duplicate-case', severity: 'error' });\n else {\n seen.add(key);\n covering.push(a.patterns);\n }\n }\n if (!hasElse) {\n const open = domains.some((d) => d === null);\n const product = open ? Infinity : domains.reduce((n, d) => n * (d as string[]).length, 1);\n if (open || product > MAX_TUPLE_PRODUCT) {\n out.push({ lines: [at], message: `This chain on ${vars.map((v) => `@{${v}}`).join(', ')} ranges over ${open ? 'an open domain' : 'too many combinations'} to enumerate — add an ELSE arm.`, code: 'opaque-switch', severity: 'error' });\n } else {\n const gap = firstUncovered(domains as string[][], covering);\n if (gap) out.push({ lines: [at], message: `No arm handles ${vars.map((v, i) => `@{${v}}=${gap[i]}`).join(', ')} — add an arm or an ELSE.`, code: 'non-exhaustive-switch', severity: 'error' });\n }\n }\n continue;\n }\n\n // Value chains and $SWITCH ON blocks — match the one input's value against its declared domain.\n if (!isCondVar(block.varName)) {\n out.push({ lines: [at], message: `This ${isBlock ? '$SWITCH reads' : 'chain reads'} @{${block.varName}}, which isn't a declared input or $DEFINE.`, code: 'undeclared-input', severity: 'error' });\n continue;\n }\n const firstUse = new Map<string, number>();\n for (const a of block.arms) {\n if (a.kind !== 'case') continue;\n for (const v of a.values) {\n const prev = firstUse.get(v);\n if (prev === undefined) firstUse.set(v, a.headerLine);\n else out.push({ lines: [a.headerLine, prev], message: `${isBlock ? `Member \"${v}\" already has an arm` : `Value \"${v}\" is matched by more than one arm`} — only the first can run.`, code: 'duplicate-case', severity: 'error' });\n }\n }\n const covered = new Set(firstUse.keys());\n const type = condType(block.varName);\n const domain = type?.kind === 'enum' ? type.members : type?.kind === 'bool' ? ['true', 'false'] : null;\n if (domain !== null) {\n for (const a of block.arms) {\n if (a.kind !== 'case') continue;\n const bad = a.values.filter((v) => !domain.includes(v));\n if (bad.length > 0)\n out.push({\n lines: [a.headerLine],\n message: isBlock\n ? `\"${bad.join('\", \"')}\" is not a member of @{${block.varName}}'s domain — one of ${domain.join(', ')}.`\n : `@{${block.varName}} is never ${bad.join(', ')} (it's one of ${domain.join(', ')}).`,\n code: 'impossible-case',\n severity: 'error',\n });\n }\n if (!hasElse) {\n const missing = domain.filter((m) => !covered.has(m));\n if (missing.length > 0)\n out.push({\n lines: [at],\n message: isBlock\n ? `@{${block.varName}} can be ${missing.join(', ')}, but no arm handles ${missing.length > 1 ? 'them' : 'it'} — add a \"- <member>::\" row for each (or a deliberate \"- otherwise::\" fallback).`\n : `@{${block.varName}} can be ${missing.join(', ')}, but no arm handles ${missing.length > 1 ? 'them' : 'it'} — add an arm or an ELSE.`,\n code: 'non-exhaustive-switch',\n severity: 'error',\n });\n } else if (isBlock) {\n // The block contract: coverage is BY CONSTRUCTION. A fallback on a fully-covered domain is a dead\n // arm — worse, it would silently absorb members ADDED to the domain later, which is exactly the\n // loud-failure-on-growth property the $SWITCH exists to provide.\n const missing = domain.filter((m) => !covered.has(m));\n const elseArm = block.arms[elseIdx];\n if (missing.length === 0 && elseArm !== undefined) {\n out.push({ lines: [elseArm.headerLine], message: `Every member of @{${block.varName}} has its own arm — \"- otherwise::\" can never run, and it would silently absorb members added to the domain later. Remove the row.`, code: 'unreachable-otherwise', severity: 'error' });\n }\n }\n } else if (!hasElse) {\n out.push({ lines: [at], message: isBlock ? `@{${block.varName}} has an open domain (${type?.kind ?? 'untyped'}) — a $SWITCH on it needs a \"- otherwise::\" row (members can't cover an open domain).` : `@{${block.varName}} has an open domain (${type?.kind ?? 'untyped'}) — a chain on it needs an ELSE arm.`, code: 'opaque-switch', severity: 'error' });\n }\n\n // ── A switch in disguise: an all-equality chain over one enum — the block form would PROVE what this\n // chain merely passes. Advisory with the complete rewrite (arms with indented bodies keep their lines;\n // an ELSE converts to \"- otherwise::\" only while the domain isn't fully covered — covered, it's dead).\n if (!isBlock && domain !== null && block.arms.length >= 2 && block.arms.every((a) => a.kind === 'else' || (a.values.length === 1 && a.inlineBody !== '' && a.headerLine + 1 === a.spanEnd))) {\n const pad = ' '.repeat(block.indent);\n const missing = domain.filter((m) => !covered.has(m));\n const rows = block.arms\n .filter((a) => a.kind === 'case' || missing.length > 0)\n .map((a) => (a.kind === 'else' ? `${pad} - otherwise:: ${a.inlineBody}` : `${pad} - ${a.values[0]}:: ${a.inlineBody}`));\n out.push({\n lines: [at],\n message: `Every arm tests @{${block.varName}} for one member — this chain is a $SWITCH in disguise. The block form proves coverage by construction (a member added to the domain later fails loudly here instead of falling through). Replace the chain with:\\n${pad}$SWITCH ON @{${block.varName}}\\n${rows.join('\\n')}`,\n code: 'switch-shaped-chain',\n severity: 'info',\n });\n }\n\n // ── The block-form advisories — the compiler's opinions on switch SHAPE ──────────────────────────────\n if (isBlock) {\n // Each arm's statements: the inline body plus its indented body lines (blanks, comments, and `@@`\n // annotations aren't statements). Exact-text matching only — the honest static tier; the semantic\n // tier's fuzzier redundancy work stays advisory and separate.\n const armStmts = block.arms.map((a) => {\n const stmts: { text: string; line: number }[] = [];\n if (a.inlineBody !== '') stmts.push({ text: a.inlineBody.trim(), line: a.headerLine });\n for (let l = a.headerLine + 1; l < a.spanEnd; l += 1) {\n const t = (rawLines[l] ?? '').trim();\n if (t === '' || t.startsWith('//') || t.startsWith('@@')) continue;\n stmts.push({ text: t, line: l });\n }\n return stmts;\n });\n // Hoist: a statement EVERY arm repeats is provably branch-independent — it belongs above the switch.\n if (block.arms.length >= 2) {\n const first = armStmts[0] ?? [];\n for (const s of first) {\n if (armStmts.every((stmts) => stmts.some((x) => x.text === s.text))) {\n const sites = armStmts.map((stmts) => stmts.find((x) => x.text === s.text)?.line).filter((l): l is number => l !== undefined);\n out.push({ lines: sites, message: `Every arm repeats \"${s.text}\" — shared content is branch-independent, so hoist it above the $SWITCH.`, code: 'hoist-arm', severity: 'info' });\n }\n }\n }\n // Large arm: the switch is a routing table, not a container — big bodies belong in sections.\n block.arms.forEach((a, i) => {\n const n = (armStmts[i] ?? []).length;\n if (a.kind === 'case' && n > 8) {\n out.push({ lines: [a.headerLine], message: `This arm carries ${n} statements — extract the body to a section and point: \"- ${a.values[0] ?? 'member'}:: @<section_name>\".`, code: 'large-arm', severity: 'info' });\n }\n });\n }\n }\n\n // Inline `$SWITCH ON $x ( … )` — RETIRED. Every occurrence errors with a complete rewrite: one full\n // sentence per arm, under a block $IF chain (the line with the inline form replaced by that arm's\n // fragment), so the fix is a straight paste and no meaning is lost.\n for (const sw of inlineSwitches) {\n const at = sw.line;\n const raw = rawLines[at] ?? '';\n const pad = ' '.repeat(raw.length - raw.trimStart().length);\n const sentence = (frag: string): string => (raw.slice(0, sw.start) + frag + raw.slice(sw.end)).trim();\n const arms: string[] = [];\n for (const c of sw.cases) {\n if (c.isDefault) arms.push(`${pad}$ELSE: ${sentence(c.frag)}`);\n else {\n const cond = c.values.length > 1 ? `@{${sw.varName}} is one of ${c.values.join(', ')}` : `@{${sw.varName}} is equal to ${c.values[0] ?? ''}`;\n arms.push(`${pad}${arms.length === 0 ? '$IF' : '$ELSE IF'} ${cond}: ${sentence(c.frag)}`);\n }\n }\n const rewrite = arms.length > 0 ? ` Replace the line with:\\n${arms.join('\\n')}` : '';\n out.push({ lines: [at], message: `The inline $SWITCH is retired — a deterministic branch is a block $IF chain, one full sentence per arm.${rewrite}`, code: 'bad-switch', severity: 'error' });\n }\n\n // $DEFINE named states: each names a reusable boolean condition. Check the expression parses, reads only\n // declared condition vars (an input or another define) at the right type, isn't a redefinition, and has no\n // dependency cycle; a define nothing references is a dead entry (warn).\n const seenDefine = new Map<string, number>();\n for (const line of doc.defineLines) {\n const raw = rawLines[line] ?? '';\n const name = (raw.match(DEFINE_RE)?.[1] ?? '').toLowerCase();\n if (name === '') continue;\n // The binder is AS — the English binder, matching prose `DEFINE … AS …`. The retired `=` still\n // parses (so the define registers and nothing cascades), but the spelling is an error with the\n // complete rewrite.\n const legacy = raw.match(/^(\\s*)\\$DEFINE\\s+([a-z][a-z0-9_]*)\\s*=\\s*(\\S.*)$/i);\n if (legacy) {\n out.push({ lines: [line], message: `The $DEFINE binder is AS, never \"=\". Replace this line with: \"${legacy[1] ?? ''}$DEFINE ${legacy[2] ?? ''} AS ${(legacy[3] ?? '').trim()}\".`, code: 'define-binder', severity: 'error' });\n }\n const prev = seenDefine.get(name);\n if (prev !== undefined) out.push({ lines: [line, prev], message: `$DEFINE ${name} is defined more than once.`, code: 'duplicate-define', severity: 'error' });\n else seenDefine.set(name, line);\n }\n const defineDeps = new Map<string, string[]>();\n for (const [name, d] of doc.defines) {\n const { ast, error } = parseExpr(d.expr);\n if (error !== null || ast === null) {\n out.push({ lines: [d.line], message: `$DEFINE ${name} is not a valid condition: ${error ?? 'parse error'}.`, code: 'bad-define-expr', severity: 'error' });\n defineDeps.set(name, []);\n continue;\n }\n const atoms = exprAtoms(ast);\n defineDeps.set(name, atoms.map((a) => a.name).filter((n) => doc.defines.has(n)));\n for (const atom of atoms) {\n if (!isCondVar(atom.name)) {\n out.push({ lines: [d.line], message: `$DEFINE ${name} reads @{${atom.name}}, which isn't a declared input or $DEFINE.`, code: 'undeclared-input', severity: 'error' });\n continue;\n }\n const type = condType(atom.name);\n if (type === undefined) continue;\n if (atom.test === 'bool' && type.kind !== 'bool') out.push({ lines: [d.line], message: `$DEFINE ${name} uses @{${atom.name}} as a boolean, but it's ${type.kind === 'enum' ? 'an enum' : `a ${type.kind}`} — compare it, e.g. ${type.kind === 'number' ? `\\`@{${atom.name}} is at least <n>\\`` : `\\`@{${atom.name}} is equal to <value>\\``}.`, code: 'guard-type-mismatch', severity: 'error' });\n else if (atom.test === 'value' && type.kind === 'bool') out.push({ lines: [d.line], message: `$DEFINE ${name} compares @{${atom.name}} to a value, but it's a bool.`, code: 'guard-type-mismatch', severity: 'error' });\n else if (atom.test === 'value' && type.kind === 'enum') {\n const bad = atom.values.filter((v) => !type.members.includes(v));\n if (bad.length > 0) out.push({ lines: [d.line], message: `$DEFINE ${name}: @{${atom.name}} is never ${bad.join(', ')} (it's one of ${type.members.join(', ')}).`, code: 'impossible-value', severity: 'error' });\n } else if (atom.test === 'numeric' && type.kind !== 'number') out.push({ lines: [d.line], message: `$DEFINE ${name} compares @{${atom.name}} numerically (is greater than / is at least …), but it's ${type.kind === 'enum' ? 'an enum' : `a ${type.kind}`} — a numeric comparison needs a number input.`, code: 'guard-type-mismatch', severity: 'error' });\n }\n if (!referenced.has(name)) out.push({ lines: [d.line], message: `$DEFINE ${name} is never used.`, code: 'unused-define', severity: 'warn' });\n }\n // A define that (transitively) reads itself can never resolve — a DFS from each define back to itself.\n for (const [start, d] of doc.defines) {\n const seen = new Set<string>();\n const stack = [...(defineDeps.get(start) ?? [])];\n let cyclic = false;\n while (stack.length > 0) {\n const n = stack.pop() ?? '';\n if (n === start) {\n cyclic = true;\n break;\n }\n if (seen.has(n)) continue;\n seen.add(n);\n stack.push(...(defineDeps.get(n) ?? []));\n }\n if (cyclic) out.push({ lines: [d.line], message: `$DEFINE ${start} depends on itself — remove the cycle.`, code: 'define-cycle', severity: 'error' });\n }\n\n // Branching: a decision must be TOTAL. When a group's guards switch on a declared enum, every member must be\n // handled (or an `Otherwise` must catch the rest); and no branch may follow an `Otherwise` (it can never run).\n const enums = rawLines\n .map((l) => findEnumDeclaration(l))\n .filter((e): e is { name: string; members: string[] } => e !== null)\n .map((e) => ({ name: e.name, members: new Set(e.members.map(normValue)) }));\n for (const g of branchGroups(doc)) {\n const owIdx = g.branches.findIndex((b) => b.kind === 'otherwise');\n const ifs = g.branches.filter((b) => b.kind === 'if');\n const perBranch = ifs.map((b) => new Set(guardValues(b.guard))); // the discrete values each branch handles\n const allVals = perBranch.flatMap((s) => [...s]);\n\n // Is this a DECISION (exactly one branch should run)? Two sound signals: the guards switch on one declared\n // enum, or a `Based on X:` header opts in. Only decisions get the totality + overlap checks — a bare run of\n // `If`s could be independent conditionals, where a gap or a shared value is fine.\n const on = allVals.length > 0 ? enums.filter((e) => allVals.every((v) => e.members.has(v))) : [];\n const enumOf = on.length === 1 ? on[0] : undefined; // 0 → not an enum switch; ≥2 → ambiguous, skip\n const isDecision = enumOf !== undefined || isDecisionHeader(g.headerText);\n\n // Dead branch: once `Otherwise` catches everything, any later branch is unreachable.\n for (const b of owIdx >= 0 ? g.branches.slice(owIdx + 1) : []) {\n out.push({ lines: [b.line], message: `This branch comes after \"Otherwise\", so it can never run — move it above the Otherwise.`, code: 'unreachable-branch', severity: 'error' });\n }\n\n // Overlap: a value handled by more than one branch. In a decision only one branch runs, and an LLM won't\n // reliably take the first — so this is ambiguity, not just redundancy. WARN (a deliberate priority order is\n // legitimate); fires only on a value we can see in two branches (a shared enum member or a duplicated guard),\n // never on distinct opaque predicates we can't compare.\n if (isDecision) {\n const firstUse = new Map<string, number>();\n const warned = new Set<string>();\n perBranch.forEach((vals, i) => {\n for (const v of vals) {\n const prev = firstUse.get(v);\n if (prev === undefined) firstUse.set(v, i);\n else if (!warned.has(v)) {\n warned.add(v);\n out.push({ lines: [ifs[i]?.line ?? g.headerLine, ifs[prev]?.line ?? g.headerLine], message: `\"${v}\" is handled by more than one branch — in a decision only one runs, and an LLM won't reliably pick the first. Make the branches mutually exclusive.`, code: 'overlapping-guard', severity: 'warn' });\n }\n }\n });\n }\n\n // Totality (only with NO `Otherwise` — one would close the gap). An enum switch must cover every member; a\n // `Based on X:` decision on free predicates must still carry a fallback.\n if (owIdx >= 0) continue;\n if (enumOf) {\n const covered = new Set(allVals);\n const missing = [...enumOf.members].filter((v) => !covered.has(v));\n if (missing.length > 0) {\n out.push({\n lines: [g.headerLine],\n message: `${enumOf.name} can be ${missing.join(', ')}, but no branch handles ${missing.length > 1 ? 'them' : 'it'} — add a branch or an \"Otherwise\".`,\n code: 'non-exhaustive-branch',\n severity: 'error',\n });\n }\n } else if (isDecisionHeader(g.headerText)) {\n out.push({\n lines: [g.headerLine],\n message: `This decision has no \"Otherwise\" — a state matching none of the branches would be unhandled. Add an \"Otherwise\" branch.`,\n code: 'no-default-branch',\n severity: 'error',\n });\n }\n }\n\n // Placement: `$IMPORT` / `$CONFIG` commands are the file's manifest — they must sit at the TOP, OUTSIDE any\n // content section, like a language's import block. The first non-blank, non-comment, non-command line ends the\n // manifest region; a command after it (buried inside a `#`/`<tag>` section, or after the steps begin) is\n // misplaced. A <$CONFIG> section is the sanctioned EXCEPTION both ways: its extent never starts the content\n // region, and a command inside it is legally placed wherever the section sits — collecting the scaffolding\n // into one foldable home is precisely what the section is for.\n const kinds = classifyLines(rawLines);\n const cmdToolMask = toolBlockMask(rawLines);\n let firstContent = rawLines.length;\n for (let i = 0; i < rawLines.length; i += 1) {\n if (kinds[i] !== 'content' || cmdToolMask[i] || cfgMask[i]) continue; // blanks, comments, $TOOL/$SERVICE blocks, and <$CONFIG> sections may precede the manifest content\n const line = rawLines[i] ?? '';\n if (IMPORT_RE.test(line) || IMPORT_FILE_RE.test(line) || REQUIRE_RE.test(line) || CONFIG_RE.test(line)) continue; // the command lines themselves\n firstContent = i;\n break;\n }\n for (const line of [...doc.importLines, ...doc.configLines]) {\n if (line >= firstContent && !cfgMask[line]) {\n out.push({ lines: [line], message: `A $-command must sit at the top of the file, outside any content section (it currently follows content on line ${firstContent + 1}).`, code: 'misplaced-command', severity: 'error' });\n }\n }\n\n // Missing sigil: a line shaped like a command but without its `$` (the sigil is mandatory). Sound and tight —\n // only the full command shape matches, so plain prose is never caught — so flag it rather than silently render it.\n rawLines.forEach((raw, i) => {\n if (kinds[i] !== 'content' || cmdToolMask[i] || !BARE_COMMAND_RE.test(raw)) return;\n const kw = /^\\s*IMPORT\\b/.test(raw) ? '$IMPORT' : /^\\s*TOOL\\b/.test(raw) ? '$TOOL' : /^\\s*SERVICE\\b/.test(raw) ? '$SERVICE' : /^\\s*DEFINE\\b/.test(raw) ? '$DEFINE' : '$CONFIG';\n out.push({ lines: [i], message: `Commands must start with \"$\" — did you mean \"${kw}\"?`, code: 'needs-sigil', severity: 'error' });\n });\n return out;\n}\n\n// ── Editor-facing projection ──\nexport interface Loc { line: number; start: number; end: number }\nexport interface Declaration { id: string; kind: SymbolKind; label: string; loc: Loc; depth: number; parentId?: string; ordinal?: number }\nexport interface Reference { loc: Loc; targetId: string | null }\nexport interface StructureModel {\n declarations: Declaration[];\n references: Reference[];\n byId: Record<string, Declaration>;\n perLine: { depth: number; sectionId: string | null }[];\n wellFormed: boolean;\n}\n\n/** Project the symbol graph into the editor's view (declarations + resolved references + per-line depth). */\nexport function structure(source: string): StructureModel {\n const rawLines = source.split('\\n');\n const doc = buildStructure(rawLines);\n const refs = findReferences(rawLines, doc);\n const conflicts = structuralConflicts(rawLines);\n\n const declarations: Declaration[] = [];\n const byId: Record<string, Declaration> = {};\n const reg = (d: Declaration): void => {\n declarations.push(d);\n byId[d.id] = d;\n };\n for (const s of doc.steps) {\n const decl: Declaration = { id: `step:${s.ord}`, kind: 'step', label: s.ord, loc: { line: s.line, start: 0, end: 0 }, depth: s.depth, ordinal: s.major, ...(s.parent ? { parentId: `step:${s.parent}` } : {}) };\n reg(decl);\n // An anchored step is reachable by its NAME too, so a `#greet` reference resolves to (and jumps to) the\n // same step its number does — the alias is what makes a resolved anchor ref render as a link, not dangling.\n if (s.anchor) byId[`step:${s.anchor}`] = decl;\n }\n for (const s of doc.sections) reg({ id: `section:${s.tag}`, kind: 'section', label: s.tag, loc: { line: s.startLine, start: 0, end: 0 }, depth: s.depth });\n for (const im of doc.imports) reg({ id: `${im.kind}:${im.key}`, kind: im.kind, label: im.name, loc: { line: im.line, start: 0, end: 0 }, depth: 0 });\n // A `$IMPORT file \"./x.tg\" as x` alias is a declaration too — the go-to-def target an `@<x>` transclusion\n // binds (findReferences resolves it as kind 'alias'). Without this, a resolved pointer to an imported FILE\n // had no targetId and decorated as dangling in the editor — the same bug the $TOOL registration below\n // fixes for tools. Registered before `@@ name:` aliases; a name collision keeps the file alias (pointers\n // prefer the import, matching imports.ts resolution order).\n for (const f of doc.fileImports) {\n const id = `alias:${f.key}`;\n if (!byId[id]) reg({ id, kind: 'alias', label: f.alias, loc: { line: f.line, start: 0, end: 0 }, depth: 0 });\n }\n // In-file `$TOOL` definitions are declarations too — the go-to-def target a `tool:` reference binds.\n // Without this, a resolved `@[tool]` pointer to a DEFINED tool had no targetId and decorated as\n // dangling in the editor. An imported name keeps its manifest line as the target (registered above).\n for (const t of doc.toolDefs) {\n const id = `tool:${t.name.toLowerCase()}`;\n if (!byId[id]) reg({ id, kind: 'tool', label: t.name, loc: { line: t.line, start: 0, end: 0 }, depth: 0 });\n }\n // A `$REQUIRE variable x` is the CANONICAL declaration of `x` (registered above); a bare `{x}` use only\n // gets its own declaration when there's no such requirement — otherwise the two would collide on `variable:x`\n // and the use would shadow the requirement (wrong go-to-definition, double-count in the Map).\n const declaredVarKeys = new Set(doc.imports.filter((im) => im.kind === 'variable').map((im) => im.key));\n for (const v of doc.variables.values()) {\n if (declaredVarKeys.has(v.base)) continue;\n const first = v.notations[0];\n if (first) reg({ id: `variable:${v.base}`, kind: 'variable', label: v.base, loc: { line: first.line, start: first.start, end: first.end }, depth: 0 });\n }\n // A `@@ name:` statement annotation declares `name` as an alias for the statement it documents (its loc is the\n // naming annotation line). NOTE: the soft-link pointer that consumed these aliases was removed, so an alias has\n // no reference form today — the `@@ name:` naming machinery is orphaned, pending its own cleanup.\n for (const a of doc.aliases) if (!byId[`alias:${a.name}`]) reg({ id: `alias:${a.name}`, kind: 'alias', label: a.name, loc: { line: a.line, start: 0, end: 0 }, depth: 0 });\n\n const references: Reference[] = refs.map((r) => {\n const id = `${r.kind}:${r.key}`;\n return { loc: { line: r.line, start: r.start, end: r.end }, targetId: r.resolved && byId[id] ? id : null };\n });\n\n // Per-line indentation depth: a section's HEADER and all of its content line up at the section's own nesting\n // depth — a `##` and everything under it sits one tab in from a `#`, a `###` two in; the deepest section\n // covering a line wins. A sub-step is the lone exception: it nests one level deeper than its surrounding\n // content, the way a sub-list sits under its parent item.\n const perLine = rawLines.map(() => ({ depth: 0, sectionId: null as string | null }));\n for (const s of doc.sections) {\n for (let l = s.startLine; l < s.endLine && l < perLine.length; l += 1) {\n const p = perLine[l];\n if (!p) continue;\n p.depth = Math.max(p.depth, s.depth);\n p.sectionId = `section:${s.tag}`;\n }\n }\n const sortedSteps = [...doc.steps].sort((a, b) => a.line - b.line);\n sortedSteps.forEach((s, k) => {\n if (s.depth === 0) return; // a top-level step lines up with the section's content; only a nested step indents\n // The INNERMOST enclosing section, not the first: sections nest (`## Identity` inside `# Role`), and a step\n // nests below the section it actually sits in. The step's own path depth (`2.1.3` → 2) adds on top, so a\n // three-segment step inside a depth-1 heading sits at depth 3.\n const sec = doc.sections\n .filter((x) => s.line >= x.startLine && s.line < x.endLine)\n .reduce<SectionSymbol | undefined>((best, x) => (!best || x.depth > best.depth ? x : best), undefined);\n let end = sortedSteps[k + 1]?.line ?? rawLines.length;\n if (sec) end = Math.min(end, sec.endLine);\n for (let l = s.line; l < end && l < perLine.length; l += 1) { const p = perLine[l]; if (p) p.depth = Math.max(p.depth, (sec?.depth ?? 0) + s.depth); }\n });\n\n return { declarations, references, byId, perLine, wellFormed: !conflicts.some((c) => c.severity === 'error') };\n}\n\n// ── Outline: the section hierarchy ──────────────────────────────────────────────────────────────────────\n// A pure tree of sections (headings nest by level, XML by tag containment) for the editor's\n// DocumentSymbolProvider — which powers sticky scroll (pin the parent headers you're nested under) and\n// go-to-symbol. Built by interval nesting: a section is a child of the innermost section whose span contains\n// it (sections are well-nested — headings partition, XML balances — so a simple stack reconstructs the tree).\nexport interface OutlineNode { tag: string; name: string; line: number; endLine: number; depth: number; children: OutlineNode[] }\n\nexport function outline(source: string): OutlineNode[] {\n const sections = [...buildStructure(source.split('\\n')).sections].sort((a, b) => a.startLine - b.startLine || b.endLine - a.endLine);\n const roots: OutlineNode[] = [];\n const stack: OutlineNode[] = [];\n for (const s of sections) {\n const node: OutlineNode = { tag: s.tag, name: s.name, line: s.startLine, endLine: s.endLine, depth: s.depth, children: [] };\n while (stack.length > 0 && (stack[stack.length - 1]?.endLine ?? 0) <= s.startLine) stack.pop();\n (stack[stack.length - 1]?.children ?? roots).push(node);\n stack.push(node);\n }\n return roots;\n}\n\n// ── Completion: what the structural format offers at a cursor ───────────────────────────────────────────\n// Pure (no editor types) so the Monaco adapter stays thin and this is unit-tested. Given the line text up to\n// the cursor and the document, it returns suggestions that complete to DEFINED symbols — teaching the format\n// AND making a dangling reference un-typable (you pick a real target, you don't hand-type a key). `replace`\n// is how many already-typed characters before the cursor the insert overwrites.\nexport type CompletionKind = SymbolKind | 'keyword';\nexport interface StructCompletion {\n label: string;\n insert: string;\n detail: string;\n kind: CompletionKind;\n replace: number;\n /** When true, `insert` is an LSP snippet template (`${1:blank}` tab stops) — a fill-in-the-blank insert. */\n snippet?: boolean;\n}\n\n// The $IMPORT picker drops a fill-in-the-blank command line: the kind plus a named placeholder for the symbol,\n// so picking `tool` after `$IMPORT ` gives `$IMPORT tool ▮tool_name▮` ready to type over. $CONFIG is analogous.\nconst IMPORT_TEMPLATE = { tool: 'tool ${1:tool_name}', route: 'route \"${1:Route Name}\"', file: 'file \"${1:./path.tg}\" as ${2:alias}' } as const;\n\n// The value part of a `$CONFIG <key> …` snippet: an enum key offers its values as a choice dropdown\n// (`${1|voice,chat|}`), any other key a plain typed-over placeholder. The schema itself lives in\n// config-schema.ts (built-in defaults + a project's glish.tgc); completionsAt takes the resolved one.\nconst configValueSnippet = (s: ConfigKeySchema): string =>\n s.values ? `\\${1|${s.values.join(',')}|}` : `\\${1:${s.placeholder ?? 'value'}}`;\n\n// The completion TRIGGER CHARACTERS — the single source of truth for \"when the editor auto-opens completions.\"\n// BOTH surfaces must consume this: the web app's Monaco provider AND the LSP server (lsp/server.ts). A second\n// hardcoded copy is exactly the drift we guard against — the LSP once shipped a stale `['$','<']` while the web\n// app had eight. The capabilities parity test (structure.test.ts) fails if either surface hand-rolls its own\n// list. Each char maps to a completionsAt rule: `$` directives; `@`/`{`/`[`/`<` insertion & section refs; `#`\n// anchors; ` `/`:` the config-value & require-type pickers. completionsAt is context-gated, so a char that\n// matches no rule simply returns [] (Monaco shows no widget).\nexport const COMPLETION_TRIGGERS: readonly string[] = ['$', '<', '{', '[', '@', '#', ' ', ':'];\n\nexport function completionsAt(before: string, source: string, line = -1, schema: ConfigSchema = BUILTIN_CONFIG_SCHEMA): StructCompletion[] {\n const doc = structure(source);\n const labels = (kind: SymbolKind): string[] => [...new Set(doc.declarations.filter((d) => d.kind === kind).map((d) => d.label))];\n\n // A line-start `$` (or a directive being typed — `$SW…`) → the compiler directives, each a fill-in-the-blank\n // skeleton. This is what makes each command discoverable as you type it, not only from a blank line.\n const dir = before.match(/^\\s*\\$([a-z]*)$/i);\n if (dir) {\n const typed = (dir[1] ?? '').toLowerCase();\n const directives: { label: string; insert: string; detail: string }[] = [\n { label: '$IMPORT', insert: 'IMPORT input ${1:name}: ${2:boolean}', detail: 'declare a typed input' },\n { label: '$CONFIG', insert: 'CONFIG ${1:model} ${2:value}', detail: 'a compile-time setting' },\n { label: '$REQUIRE', insert: 'REQUIRE variable ${1:name}: ${2:boolean}', detail: 'a required variable — a placeholder to fill (values panel, or a parent on import)' },\n { label: '$DEFINE', insert: 'DEFINE ${1:name} AS ${2:@{input} is equal to value}', detail: 'a reusable named boolean condition' },\n {\n label: '$SWITCH',\n insert: 'SWITCH ON @{${1:input}}\\n - ${2:member}:: ${3:the arm for that member}',\n detail: 'a member table over one typed input — every member gets an arm, coverage proven',\n },\n {\n label: '$TEST',\n insert: 'TEST ${1:case_id}\\n - input:: ${2:the user message}\\n - expect::\\n - contains \"${3:required text}\"\\n - at most ${4:3} sentences',\n detail: 'an eval case — compiles away; deterministic asserts are free',\n },\n {\n label: '$EXAMPLE',\n insert: 'EXAMPLE ${1:case_id}\\n - input:: ${2:the user message}\\n - good:: ${3:the ideal response}\\n - bad:: ${4:a response to avoid}',\n detail: 'a few-shot demo — GOOD emits as a User/Assistant pair; BAD is held out',\n },\n ];\n return directives.filter((d) => d.label.slice(1).toLowerCase().startsWith(typed)).map((d) => ({ label: d.label, insert: d.insert, detail: d.detail, kind: 'keyword' as const, replace: typed.length, snippet: true }));\n }\n\n // Everything a condition can read: a declared input OR a $DEFINE name (both host-state a guard/switch tests).\n const condNames = [...new Set([...labels('variable'), ...buildStructure(source.split('\\n')).defines.keys()])];\n\n // A condition position — `<tag when=@{x` or `$IF … @{x` — → the inputs / defines (the pointer reads\n // host state, so the picker offers everything a condition can test).\n const guardVar = before.match(/when=[^>]*@\\{([a-z0-9_]*)$/i) ?? before.match(/^\\s*\\$(?:ELSE\\s+)?IF\\b[^:]*@\\{([a-z0-9_]*)$/i);\n if (guardVar) {\n const typed = (guardVar[1] ?? '').toLowerCase();\n return condNames.filter((n) => n.toLowerCase().startsWith(typed)).map((n) => ({ label: `@{${n}}`, insert: `${n}}`, detail: 'condition', kind: 'variable' as const, replace: typed.length }));\n }\n\n // `$IF @{x} <op>` / `<tag when=@{x} <op>` → after a `@{pointer}` read in a machine-plane condition, the\n // comparison operators (is equal to / is one of / is at least / …), narrowed by the partial typed. Derived\n // from COMPARISON_KEYWORDS (lexicon SSOT). Sits BEFORE the enum-member rule below: that fires once the operator\n // is COMPLETE (offering values); this completes the operator itself. Returns only on a hit, so a completed\n // operator (`is one of `) falls through to the members.\n const cmpOp = before.match(/(?:^\\s*\\$(?:ELSE\\s+)?IF\\b|when=)[^:>]*@\\{[a-z0-9_]+\\}\\s+([a-z ]*)$/i);\n if (cmpOp) {\n const typed = (cmpOp[1] ?? '').toLowerCase();\n const hits = COMPARISON_KEYWORDS.map((k) => k.toLowerCase()).filter((op) => op.startsWith(typed));\n if (hits.length > 0) return hits.map((op) => ({ label: op, insert: op, detail: 'comparison', kind: 'keyword' as const, replace: typed.length }));\n }\n\n // `$IF @{var} is equal to <v>` / `$ELSE IF @{var} is one of a, <v>` → the input's enum members, UNCOVERED\n // first: the editor walks you toward a total chain, and marks the ones already handled. Needs the caret\n // line to find the enclosing chain (the chain may not include the arm still being typed).\n const caseVal = before.match(/^\\s*\\$(?:ELSE\\s+)?IF\\s+@\\{([a-z0-9_]+)\\}\\s+is\\s+(?:equal\\s+to|one\\s+of(?:\\s+[a-z0-9_]+\\s*,)*)\\s*([a-z0-9_]*)$/i);\n if (caseVal && line >= 0) {\n const rawLines = source.split('\\n');\n const varName = (caseVal[1] ?? '').toLowerCase();\n const type = buildStructure(rawLines).inputTypes.get(varName);\n if (type?.kind === 'enum') {\n // The enclosing chain (if any) tells us which members earlier arms already handle. The arm\n // being typed has no colon yet, so the chain may END just above the caret — allow that edge.\n const block = parseSwitches(rawLines).find((b) => line >= b.headerLine && line <= b.blockEnd && (b.kind !== 'value' || b.varName === varName));\n const covered = new Set(block?.arms.flatMap((a) => a.values) ?? []);\n const typed = (caseVal[2] ?? '').toLowerCase();\n return type.members\n .filter((m) => m.startsWith(typed))\n .sort((a, b) => Number(covered.has(a)) - Number(covered.has(b))) // uncovered first\n .map((m) => ({ label: covered.has(m) ? `${m} · handled` : m, insert: m, detail: covered.has(m) ? 'already handled' : 'uncovered — needs an arm', kind: 'keyword' as const, replace: typed.length }));\n }\n }\n\n // `@<x>` → a TRANSCLUSION target: a same-file section OR an import alias (whole imported file). Checked\n // BEFORE the bare `<tag>` rule, since `@<gr` also ends with `<gr` — the `@` marks an insertion, not a new tag.\n const trans = before.match(/@<([a-z0-9_]*)$/i);\n if (trans) {\n const typed = (trans[1] ?? '').toLowerCase();\n const targets = [\n ...labels('section').map((t) => ({ name: t, detail: 'same-file section' })),\n ...buildStructure(source.split('\\n')).fileImports.map((f) => ({ name: f.alias, detail: 'imported file' })),\n ];\n return targets.filter((o) => o.name.toLowerCase().startsWith(typed)).map((o) => ({ label: `@<${o.name}>`, insert: `${o.name}>`, detail: o.detail, kind: 'section' as const, replace: typed.length }));\n }\n\n // `<tag>` → a declared section, narrowed to the typed prefix.\n const sec = before.match(/<([a-z0-9_]*)$/i);\n if (sec) {\n const typed = (sec[1] ?? '').toLowerCase();\n return labels('section').filter((t) => t.toLowerCase().startsWith(typed)).map((t) => ({ label: `<${t}>`, insert: `${t}>`, detail: 'section reference', kind: 'section', replace: typed.length }));\n }\n\n // `@{x}` → a declared variable or imported input.\n const v = before.match(/@\\{([a-z0-9_]*)$/);\n if (v) {\n const typed = (v[1] ?? '').toLowerCase();\n return [...new Set(labels('variable'))].filter((n) => n.toLowerCase().startsWith(typed)).map((n) => ({ label: `@{${n}}`, insert: `${n}}`, detail: 'variable', kind: 'variable', replace: typed.length }));\n }\n\n // `@[x]` → a $TOOL defined in this file, whose schema is inlined. Only DEFINED tools (an imported tool has\n // no local schema to inline — reference it by its bare name in prose instead).\n const toolInline = before.match(/@\\[([a-z0-9_]*)$/i);\n if (toolInline) {\n const typed = (toolInline[1] ?? '').toLowerCase();\n return buildStructure(source.split('\\n')).toolDefs\n .filter((t) => t.name.toLowerCase().startsWith(typed))\n .map((t) => ({ label: `@[${t.name}]`, insert: `${t.name}]`, detail: t.description || 'tool', kind: 'tool' as const, replace: typed.length }));\n }\n\n // `step N` → a defined step ordinal.\n const st = before.match(/\\b(?:flow\\s+)?step\\s+(\\d*[a-z]?)$/i);\n if (st) {\n const typed = (st[1] ?? '').toLowerCase();\n return labels('step').filter((o) => o.startsWith(typed)).map((o) => ({ label: o, insert: o, detail: 'step', kind: 'step', replace: typed.length }));\n }\n\n // `#name` → a step ANCHOR reference, narrowed to the typed prefix — the `#` selector opens the picker of\n // every named step, so you point by stable name and never typo a `#greet`. A line-start `#` is a heading,\n // not an anchor, so it's skipped.\n const anc = before.match(/#([a-z0-9_]*)$/i);\n if (anc && anc.index !== undefined && before.slice(0, anc.index).trim() !== '') {\n const typed = (anc[1] ?? '').toLowerCase();\n return [...buildStructure(source.split('\\n')).index.anchors]\n .filter((a) => a.startsWith(typed))\n .map((a) => ({ label: `#${a}`, insert: a, detail: 'step anchor', kind: 'step', replace: typed.length }));\n }\n\n // `$IMPORT <kind>` — picking a kind drops the kind + a named blank for the symbol. Case-exact ($-command).\n const imp = before.match(/^\\s*\\$IMPORT\\s+([a-z]*)$/);\n if (imp) {\n const typed = imp[1] ?? '';\n return (['tool', 'route', 'file'] as const).filter((k) => k.startsWith(typed)).map((k) => ({ label: k, insert: IMPORT_TEMPLATE[k], detail: `import a ${k}`, kind: 'keyword' as const, replace: typed.length, snippet: true }));\n }\n\n // `$CONFIG <key> <value>` — an ENUM key (e.g. `modality`) offers its allowed values as a dropdown. Checked\n // before the key rule below: this needs a space + a partial value after the key, the key rule matches only\n // a bare partial key — so the two never both fire.\n const cfgVal = before.match(/^\\s*\\$CONFIG\\s+([a-z][\\w-]*)\\s+([\\w.-]*)$/i);\n if (cfgVal) {\n const key = (cfgVal[1] ?? '').toLowerCase();\n const typed = (cfgVal[2] ?? '').toLowerCase();\n const values = schema[key]?.values;\n if (values) return values.filter((v) => v.startsWith(typed)).map((v) => ({ label: v, insert: v, detail: `${key} = ${v}`, kind: 'keyword' as const, replace: typed.length }));\n // `$CONFIG model <id>` — the header value is a model id (validated by models.ts), so offer the known ids.\n if (key === 'model') return CANONICAL_IDS.filter((v) => v.toLowerCase().startsWith(typed)).map((v) => ({ label: v, insert: v, detail: 'a known model id', kind: 'keyword' as const, replace: typed.length }));\n }\n\n // `$CONFIG <key>` — picking a setting key drops the key + its value part (an enum key → a choice dropdown).\n const cfg = before.match(/^\\s*\\$CONFIG\\s+([\\w-]*)$/);\n if (cfg) {\n const typed = (cfg[1] ?? '').toLowerCase();\n return Object.entries(schema).filter(([k]) => k.startsWith(typed)).map(([k, s]) => ({ label: k, insert: `${k} ${configValueSnippet(s)}`, detail: `set ${k} — ${s.detail}`, kind: 'keyword' as const, replace: typed.length, snippet: true }));\n }\n\n // `- param` inside a `$CONFIG <kind>` block → the kind's schema PARAMS (model → via/max_tokens/temperature),\n // required first. Walks up to the enclosing header (the first shallower non-blank line); only a `$CONFIG <kind>`\n // with a param schema offers. Fires before the generic statement starters so a config body never offers MUST/IF.\n const cfgParam = before.match(/^(\\s*)-\\s+([a-z0-9_]*)$/i);\n if (cfgParam && line >= 0) {\n const myIndent = (cfgParam[1] ?? '').length;\n const rawLines = source.split('\\n');\n let kind: string | undefined;\n for (let j = line - 1; j >= 0; j -= 1) {\n const l = rawLines[j] ?? '';\n if (l.trim() === '') continue;\n if (l.length - l.trimStart().length >= myIndent) continue; // a sibling/deeper line — not the enclosing header\n kind = l.match(/^\\s*\\$CONFIG\\s+([a-z][\\w-]*)\\b/i)?.[1]?.toLowerCase();\n break;\n }\n const params = kind ? schema[kind]?.params : undefined;\n if (params) {\n const typed = (cfgParam[2] ?? '').toLowerCase();\n return Object.entries(params)\n .filter(([k]) => k.startsWith(typed))\n .sort(([, a], [, b]) => Number(!!b.required) - Number(!!a.required))\n .map(([k, p]) => ({ label: p.required ? `${k} · required` : k, insert: p.placeholder ? `${k}:: \\${1:${p.placeholder}}` : `${k}:: `, detail: p.detail, kind: 'keyword' as const, replace: typed.length, snippet: !!p.placeholder }));\n }\n }\n\n // `$REQUIRE variable x: <domain>` — after the colon, the domain forms the grammar accepts: the primitives\n // (PRIM_TYPES, the SSOT) and a `one of a, b` closed set. NEVER the legacy `bool`/`int`/`text` synonyms or `a | b`\n // pipes — those ERROR with a rewrite, so suggesting one hands the user a broken domain. A variable's domain is\n // ONE value, so no `list of` here (that's the $TOOL param's richer type-expr, below).\n const reqType = before.match(/\\$REQUIRE\\s+variable\\s+[a-z][a-z0-9_]*\\s*:\\s*([a-z]*)$/i);\n if (reqType) {\n const typed = (reqType[1] ?? '').toLowerCase();\n const domains: { match: string; insert: string; detail: string; snippet?: boolean }[] = [\n ...[...PRIM_TYPES].map((p) => ({ match: p, insert: p, detail: `a ${p} variable` })),\n { match: 'one of', insert: 'one of ${1:a}, ${2:b}', detail: 'a closed set — exhaustively switchable', snippet: true },\n ];\n return domains.filter((d) => d.match.startsWith(typed)).map((d) => ({ label: d.snippet ? 'one of …' : d.match, insert: d.insert, detail: d.detail, kind: 'keyword' as const, replace: typed.length, snippet: d.snippet }));\n }\n\n // `$TOOL/$SERVICE - name:: <type-expr>` — after the `::` field marker (a param row), the type-expr forms: the\n // primitives + the type keywords (optional / one of / any of / list of / default to) — the richer sibling of the\n // $REQUIRE domain picker. `optional` drops off once it's already typed so the arm never doubles it.\n const toolType = before.match(/^\\s*-\\s+[a-z][a-z0-9_]*::\\s*(?:(optional)\\s+)?([a-z]*)$/i);\n if (toolType) {\n const hasOptional = toolType[1] !== undefined;\n const typed = (toolType[2] ?? '').toLowerCase();\n const forms: { match: string; insert: string; detail: string; snippet?: boolean }[] = [\n ...[...PRIM_TYPES].map((p) => ({ match: p, insert: p, detail: `a ${p}` })),\n { match: 'one of', insert: 'one of ${1:a}, ${2:b}', detail: 'a closed set — pick one', snippet: true },\n { match: 'any of', insert: 'any of ${1:a}, ${2:b}', detail: 'a set — pick one or more', snippet: true },\n { match: 'list of', insert: 'list of ${1:strings}', detail: 'an open array', snippet: true },\n { match: 'optional', insert: 'optional ', detail: 'marks the param optional' },\n { match: 'default to', insert: 'default to ${1:value}', detail: 'a default (implies optional)', snippet: true },\n ];\n return forms\n .filter((d) => d.match.startsWith(typed) && !(hasOptional && d.match === 'optional'))\n .map((d) => ({ label: d.snippet ? `${d.match} …` : d.match, insert: d.insert, detail: d.detail, kind: 'keyword' as const, replace: typed.length, snippet: d.snippet }));\n }\n\n // A bare word mid-line → an imported tool/route/input it prefixes (complete it, don't typo it). Only RETURN\n // on a match; an empty result falls through so the line-start starters below can offer instead.\n const wm = before.match(/([a-z0-9_]+)$/i);\n if (wm) {\n const w = (wm[1] ?? '').toLowerCase();\n const words = doc.declarations\n .filter((d) => (d.kind === 'tool' || d.kind === 'route' || d.kind === 'variable') && d.label.toLowerCase().startsWith(w) && d.label.toLowerCase() !== w)\n .map((d) => ({ label: d.label, insert: d.label, detail: d.kind, kind: d.kind, replace: w.length }));\n if (words.length > 0) return words;\n }\n\n // Line START (optionally after a list marker) → the statement / block STARTERS, each a fill-in-the-blank\n // template — the format's entry points. Served from HERE, not the editor, so the worker and every IDE offer\n // them identically (the last completion-parity gap). `beforeWord` is the line minus the word being typed;\n // empty or a lone list marker ⇒ we're at a statement start. A truly blank line also gets the BLOCK starters.\n const typedWord = before.match(/[A-Za-z#]*$/)?.[0] ?? '';\n const beforeWord = before.slice(0, before.length - typedWord.length);\n if (/^\\s*(?:[-*+]\\s+|\\d+(?:\\.\\d+)*[.)]\\s+)?$/.test(beforeWord)) {\n const noMarker = /^\\s*$/.test(beforeWord); // a truly blank line also gets the BLOCK + DIRECTIVE starters\n const starters = noMarker ? [...STATEMENT_SNIPPETS, ...BLOCK_SNIPPETS, ...DIRECTIVE_SNIPPETS] : STATEMENT_SNIPPETS;\n return starters.map((s) => ({ label: s.label, insert: s.snippet ?? s.insert, detail: s.detail, kind: 'keyword' as const, replace: typedWord.length, snippet: !!s.snippet }));\n }\n return [];\n}\n"]}