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.
- package/LICENSE +201 -0
- package/NOTICE +13 -0
- package/README.md +301 -0
- package/dist/chunk-3NQ3VYO6.js +566 -0
- package/dist/chunk-3NQ3VYO6.js.map +1 -0
- package/dist/chunk-KRYC4OTL.js +3573 -0
- package/dist/chunk-KRYC4OTL.js.map +1 -0
- package/dist/chunk-NLQIL5WD.js +25 -0
- package/dist/chunk-NLQIL5WD.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +39 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-PXAMTGYY.js +3 -0
- package/dist/chunk-PXAMTGYY.js.map +1 -0
- package/dist/chunk-VMACILYN.js +140 -0
- package/dist/chunk-VMACILYN.js.map +1 -0
- package/dist/chunk-Y64EAEYB.js +10919 -0
- package/dist/chunk-Y64EAEYB.js.map +1 -0
- package/dist/chunk-YH4ZLQ4G.js +4260 -0
- package/dist/chunk-YH4ZLQ4G.js.map +1 -0
- package/dist/chunk-ZKMHZHID.js +56 -0
- package/dist/chunk-ZKMHZHID.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +447 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile-DViQS2oG.d.ts +310 -0
- package/dist/diagnostics-BWJ_oMd8.d.ts +49 -0
- package/dist/exhaustiveness-VBVWCX5W.js +123 -0
- package/dist/exhaustiveness-VBVWCX5W.js.map +1 -0
- package/dist/index-Df_QnTgq.d.ts +313 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +11 -0
- package/dist/mcp.js +36378 -0
- package/dist/mcp.js.map +1 -0
- package/dist/monaco.css +46 -0
- package/dist/monaco.d.ts +43 -0
- package/dist/monaco.js +971 -0
- package/dist/monaco.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.js +8 -0
- package/dist/node.js.map +1 -0
- package/dist/spell-node.d.ts +8 -0
- package/dist/spell-node.js +23 -0
- package/dist/spell-node.js.map +1 -0
- package/dist/spell.d.ts +18 -0
- package/dist/spell.js +4 -0
- package/dist/spell.js.map +1 -0
- package/dist/z3-MWU3GSVT.js +5 -0
- package/dist/z3-MWU3GSVT.js.map +1 -0
- package/package.json +160 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/semantic-tokens.ts","../src/core/editor-config.ts","../src/web/blocks.ts","../src/core/profile.ts","../src/web/lsp-client.ts","../src/web/monaco-setup.ts","../src/web/operators.ts","../src/lib/monaco.ts"],"names":[],"mappings":";;;;;;;AAwBO,IAAM,eAAA,GAAkB;AAAA,EAC7B,WAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,OAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,aAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,YAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,YAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAA;AAgBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,SAAA,EAAW,EAAE,IAAA,EAAM,OAAA,EAAS,UAAU,WAAA,EAAY;AAAA;AAAA,EAClD,OAAA,EAAS,EAAE,IAAA,EAAM,SAAA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A,CAAM,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,MAAA,CAAO,KAAA,CAAM,WAAW,CAAC,CAAA;AACxF,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAO,GAAI,YAAY,IAAI,CAAA;AAC3C,EAAA,MAAM,GAAA,GAAM,oBAAoB,MAAM,CAAA;AACtC,EAAA,IAAI,CAAC,OAAO,MAAA,CAAO,KAAA,CAAM,GAAG,GAAA,CAAI,GAAG,CAAA,KAAM,GAAA,CAAI,KAAA,EAAO;AACpD,EAAA,IAAI,YAAA,CAAa,eAAe,KAAA,CAAM,eAAA,IAAmB,EAAA,GAAK,CAAC,CAAC,CAAA,EAAG;AACnE,EAAA,MAAM,WAAA,GAAc,OAAO,MAAA,GAAS,CAAA;AACpC,EAAA,MAAA,CAAO,aAAa,gBAAA,EAAkB,CAAC,EAAE,KAAA,EAAO,IAAI,OAAO,KAAA,CAAM,EAAA,EAAI,aAAa,EAAA,EAAI,WAAA,GAAc,IAAI,GAAG,CAAA,EAAG,MAAM,GAAA,CAAI,KAAA,EAAO,CAAC,CAAA;AAClI","file":"monaco.js","sourcesContent":["// ── Semantic tokens — the ONE source of truth for how TypeGlish colours ──────────────────────────────────────\n// Highlighting was the last thing hardcoded in the editor: the web had a bespoke Monaco Monarch tokenizer, an\n// IDE would need its own TextMate grammar, and the LSP served none. This is a SYNTACTIC tokenizer in the core,\n// so the preview (via the worker), the LSP (semantic-tokens capability), and any IDE all colour identically —\n// one grammar, not three. It is syntactic on purpose: a `@{x}` / `@<x>` / `@[x]` / `$x` / `<tag>` colours by its\n// SHAPE, whether or not it resolves (an undeclared reference is still a reference to the eye), which is exactly\n// what a highlighter must do and what makes it distinct from the semantic reference graph (findReferences).\n//\n// It is a faithful port of the Monaco Monarch grammar that used to live in the web (monaco-setup.ts): the SAME\n// directive/copula/possession/markdown regexes, reusing the SAME core sources (copula.ts, lexicon.ts, clause.ts)\n// so the two can't drift. The keyword lists come from the lexicon — the language's single source of truth — so a\n// vocabulary change there recolours here automatically. The token TYPES are a small fixed legend; the LSP and\n// Monaco layers encode positions in their wire formats. The legend is APPEND-ONLY — indices are baked into the\n// wire format, so new types go on the end (never reordered) or every previously-encoded document mis-colours.\nimport { MANY_CLASS, NON_ACTION_LEADS } from './cardinality';\nimport { OBLIGATE, PROHIBIT } from './logic';\nimport { TAG_NAME_PLAIN_SRC, TAG_NAME_QUOTED_SRC, defEntriesDisplay, isAnnotationLine, maskQuotes, switchCommandMask, toolBlockMask } from './clause';\nimport { copulaAlternation, copulaConnector, copulaContraction } from './copula';\nimport { keywordAlt, keywordAltCI, keywordRegex } from './grammar';\nimport { BRANCH_KEYWORDS, CARDINAL_QUANTITIES, COMPARISON_KEYWORDS, COMPARISON_SYMBOLS, CONTROL_KEYWORDS, DEFINITION_KEYWORDS, EXACTNESS_MARKERS, FREQUENCY_KEYWORDS, MODAL_KEYWORDS, NUMBER_WORDS, OPERATOR_KEYWORDS, QUANTIFIER_KEYWORDS, QUANTIFIER_WORDS } from './lexicon';\nimport { classifyLines } from './prompt';\n\n// The legend — TG's token vocabulary. Kept small and semantic; the editor theme maps each to a colour. Indices\n// 0-9 are load-bearing (older encoders/tests assume them); everything after is append-only.\nexport const SEM_TOKEN_TYPES = [\n 'directive', // 0 $IMPORT/$CONFIG/$REQUIRE/$SWITCH … — import red\n 'keyword', // 1 IF/WHEN/THEN — control purple\n 'modal', // 2 MUST/NEVER/NOT — red\n 'operator', // 3 IS/ARE/AND/OR/INCLUDING — cyan\n 'variable', // 4 @{x} / $x — insertion blue\n 'section', // 5 <tag> / @<x> — section blue\n 'tool', // 6 @[x] — insertion blue\n 'comment', // 7 // free comment — muted green\n 'string', // 8 \"…\" literal + fenced code — orange\n 'heading', // 9 # heading — section blue\n 'declaration', // 10 a declared subject/owner/name/value — gold\n 'property', // 11 a possessed property noun — muted gold\n 'annotation', // 12 RETIRED from emission (kept for index stability) — @@ notes now emit 'comment': an annotation IS an attached comment\n 'list', // 13 - * 1. list markers — grey\n 'link', // 14 [text](href) — blue\n 'strong', // 15 **bold**\n 'emphasis', // 16 *italic*\n 'strike', // 17 ~~struck~~\n 'code', // 18 `inline code`\n 'markup', // 19 the **, *, ~~, ` markers themselves — dim\n 'quantifier', // 20 ALL/SOME/NO/ONLY/MOST + cardinal quantities (only one, many) — quantity green\n 'scaffold', // 21 <$name> tags — control-plane, hidden from the MODEL (strip whole extent) — directive red\n 'literal', // 22 <\"name\"> tags — literal zone, hidden from the CHECKER (verbatim body) — string orange\n 'defterm', // 23 a definition entry's `term::` — the reference-table label, gold\n 'defbody', // 24 a definition entry's body/continuations — one neutral colour (rendered, not authored)\n 'toolkey', // 25 a $TOOL/$SERVICE body field key + its `::` — a record key, blue\n 'toolval', // 26 a $TOOL/$SERVICE body value / free body line — one neutral colour, like defbody\n] as const;\nexport type SemTokenType = (typeof SEM_TOKEN_TYPES)[number];\n\n// ── The portable classification — how each token type travels to editors we don't control ──────────\n// The wire legend an arbitrary LSP editor sees. Two fallback philosophies, chosen per type:\n// graceful COLOUR — the type rides a STANDARD LSP base type (property, keyword, macro, …) that a\n// native theme already styles, with our semantic name as a MODIFIER for exact-palette surfaces;\n// graceful SILENCE — style-only or layout-ish types (strong, defbody, …) keep a custom base, which\n// foreign themes ignore: plain text IS the right degradation there.\n// Our own theme (monaco-setup, derived from editor-config's TOKEN_PALETTE) targets `base.modifier`,\n// so the playground and every typeglish/monaco embedder render the exact palette, while a bare\n// VS Code over the stdio LSP still colours every construct from its own theme, day one.\nexport interface TokenClass {\n base: string;\n modifier: string | null;\n}\nexport const TOKEN_CLASSIFICATION: Record<SemTokenType, TokenClass> = {\n directive: { base: 'macro', modifier: 'directive' }, // $-commands read as preprocessor abroad\n keyword: { base: 'keyword', modifier: null },\n modal: { base: 'keyword', modifier: 'modal' },\n operator: { base: 'operator', modifier: null },\n variable: { base: 'variable', modifier: 'interpolation' },\n section: { base: 'namespace', modifier: 'section' }, // a section is a named container\n tool: { base: 'function', modifier: 'tool' }, // a tool is callable\n comment: { base: 'comment', modifier: null },\n string: { base: 'string', modifier: null },\n heading: { base: 'namespace', modifier: 'heading' },\n declaration: { base: 'variable', modifier: 'declaration' }, // 'declaration' is a STANDARD modifier\n property: { base: 'property', modifier: null },\n annotation: { base: 'comment', modifier: 'annotation' }, // retired from emission\n list: { base: 'list', modifier: null }, // graceful silence — plain markers abroad\n link: { base: 'link', modifier: null }, // graceful silence\n strong: { base: 'strong', modifier: null }, // graceful silence (style-only)\n emphasis: { base: 'emphasis', modifier: null },\n strike: { base: 'strike', modifier: null },\n code: { base: 'code', modifier: null },\n markup: { base: 'markup', modifier: null },\n quantifier: { base: 'keyword', modifier: 'quantifier' },\n scaffold: { base: 'macro', modifier: 'scaffold' },\n literal: { base: 'string', modifier: 'literalZone' },\n defterm: { base: 'property', modifier: 'defterm' },\n defbody: { base: 'defbody', modifier: null }, // graceful silence — a plain body abroad is right\n toolkey: { base: 'property', modifier: 'toolkey' },\n toolval: { base: 'toolval', modifier: null }, // graceful silence\n};\n\n/** The ONE wire legend both transports serve (stdio LSP + the Monaco provider), derived from the\n * classification: bases and modifiers in first-appearance order over SEM_TOKEN_TYPES. */\nexport const SEM_LEGEND: { tokenTypes: string[]; tokenModifiers: string[] } = (() => {\n const tokenTypes: string[] = [];\n const tokenModifiers: string[] = [];\n for (const t of SEM_TOKEN_TYPES) {\n const c = TOKEN_CLASSIFICATION[t];\n if (!tokenTypes.includes(c.base)) tokenTypes.push(c.base);\n if (c.modifier !== null && !tokenModifiers.includes(c.modifier)) tokenModifiers.push(c.modifier);\n }\n return { tokenTypes, tokenModifiers };\n})();\n\nexport interface SemToken {\n line: number; // 0-based\n start: number; // 0-based column\n length: number;\n type: SemTokenType;\n}\n\n// Group-mapped rule: a regex whose EVERY character lands in some capture group (the Monarch convention), paired\n// with the token type for each group (`''` = leave that group uncoloured). Ported 1:1 from the Monarch rules.\ntype GroupRule = readonly [RegExp, readonly (SemTokenType | '')[]];\n\nconst MODAL_RE = keywordRegex(MODAL_KEYWORDS);\nconst CONTROL_RE = keywordRegex([...CONTROL_KEYWORDS, ...BRANCH_KEYWORDS, ...DEFINITION_KEYWORDS]);\nconst OPERATOR_RE = keywordRegex(OPERATOR_KEYWORDS);\nconst globalize = (re: RegExp): RegExp => new RegExp(re.source, re.flags.includes('g') ? re.flags : `${re.flags}g`);\n\n// Line-anchored directive rules — FIRST match wins per line (like Monarch's per-line dispatch): a line is a\n// `$CONFIG` line OR a `$TOOL` line OR a `<tag when=…>` line, never two. Ordered most- to least-specific.\n// A deterministic chain arm leads with its COMMAND — `$IF` / `$ELSE IF` / `$ELSE` color as directives (the\n// head-only rule leaves the condition to the pointer/operator scans below); a bare prose `IF` colors as an\n// ordinary keyword. The retired inline `$SWITCH ON` keeps its coloring so a legacy occurrence reads as\n// structure while its retirement error walks the author to the rewrite.\nconst DIRECTIVE_RULES: GroupRule[] = [\n [/^(\\s*)(\\$ELSE\\s+IF|\\$IF|\\$ELSE)\\b/i, ['', 'directive']],\n [/^(\\s*)(\\$IMPORT)(\\s+)(file)(\\s+)(\".*?\")(\\s+)(as)(\\s+)([a-z][a-z0-9_]*)(.*)$/, ['', 'directive', '', 'directive', '', 'string', '', 'directive', '', 'declaration', '']],\n [/^(\\s*)(\\$IMPORT)(\\s+)(tool|route|input)(\\s+)(.*)$/, ['', 'directive', '', 'directive', '', 'declaration']],\n [/^(\\s*)(\\$REQUIRE)(\\s+)(variable)(\\s+)(.*)$/, ['', 'directive', '', 'directive', '', 'declaration']],\n [/^(\\s*)(\\$CONFIG)(\\s+)([a-z][\\w-]*)(\\s+)(.*)$/, ['', 'directive', '', 'directive', '', 'declaration']],\n [/^(\\s*)(\\$DEFINE)(\\s+)([a-z][a-z0-9_]*)/, ['', 'directive', '', 'declaration']],\n // The $TOOL/$SERVICE header may sit at any column — the layout doctrine puts it at its section's column\n // (e.g. one unit deep inside <$CONFIG>), so the leading-indent group is load-bearing.\n [/^(\\s*)(\\$TOOL|\\$SERVICE)(\\s+)([a-z][a-z0-9_]*)(\\s*)$/, ['', 'directive', '', 'declaration', '']],\n // $TEST / $EXAMPLE headers share a shape (`$KW case_id`, no colon since the bullet refactor): the id\n // colors as a declaration like $TOOL, the bare keyword as a directive.\n [/^(\\s*)(\\$TEST|\\$EXAMPLE)(\\s+)([A-Za-z][A-Za-z0-9_-]*)(\\s*)$/, ['', 'directive', '', 'declaration', '']],\n [/^(\\s*)(\\$TEST|\\$EXAMPLE)\\b/, ['', 'directive']],\n [/^(\\s*)(EXPECT)(\\s+)(contains|matches)\\b/, ['', 'keyword', '', 'keyword']],\n [/^(\\s*)(EXPECT)(\\s+)(at (?:most|least))\\b/, ['', 'keyword', '', 'keyword']],\n [/^(\\s*)(EXPECT)\\b/, ['', 'keyword']],\n // <tag when=…> — the tag in its FAMILY colour (the sigil is compile identity, so the guard variants\n // keep it), `when=` purple. Ordered most-specific first: quote pair, $-scaffold, then plain/`?`.\n // Shapes derive from clause.ts's tag-name fragments — the one home (inv #1).\n [new RegExp(`^(\\\\s*<\\\\/?${TAG_NAME_QUOTED_SRC})(\\\\s+when=)`, 'i'), ['literal', 'keyword']],\n [new RegExp(`^(\\\\s*<\\\\/?\\\\$${TAG_NAME_PLAIN_SRC})(\\\\s+when=)`, 'i'), ['scaffold', 'keyword']],\n [new RegExp(`^(\\\\s*<\\\\/?\\\\??${TAG_NAME_PLAIN_SRC})(\\\\s+when=)`, 'i'), ['section', 'keyword']],\n];\n\n// Prose declaration rules, over the QUOTE-MASKED line, in Monarch order (possession before copula so `Your name\n// is` reads determiner+property, not `name is`; the contraction whole-token before the spaced copula).\nconst DETERMINER = new RegExp(`\\\\b(Your|your|My|my|Its|its|Their|their|Our|our|His|his|Her|her|Whose|whose)(\\\\s+)([A-Za-z][A-Za-z0-9_ ]*?)(\\\\s+(?:${copulaAlternation})\\\\b)`);\nconst SAXON = new RegExp(`\\\\b([A-Za-z][A-Za-z0-9_]*)('s|')(\\\\s+)([A-Za-z][A-Za-z0-9_ ]*?)(\\\\s+(?:${copulaAlternation})\\\\b)`);\nconst OF_GENITIVE = new RegExp(`\\\\b([Tt]he\\\\s+)([A-Za-z][A-Za-z0-9_ ]*?)(\\\\s+of\\\\s+(?:[Tt]he\\\\s+|[Aa]n?\\\\s+)?)([A-Za-z][A-Za-z0-9_ ]*?)(\\\\s+(?:${copulaAlternation})\\\\b)`);\nconst CONTRACTION = new RegExp(`\\\\b[A-Za-z][A-Za-z0-9_]*${copulaContraction}\\\\b`); // `You're` — ONE gold token\n// The subject before a copula golds as a declaration — EXCEPT the two frames the declaration tier does not\n// own (the coloring must match the parser, prompt.ts findDeclaration): the expletive `there` (`There is only\n// one tool` is a cardinality claim, `there` names nothing) and a QUANTIFIER-led subject (`All users are cool`\n// belongs to the quantifier layer — the determiner is the meaning). The quantifier alternation derives from\n// the lexicon (inv #1).\nconst COPULA_SUBJECT = new RegExp(`(?<!\\\\b(?:${keywordAltCI(QUANTIFIER_KEYWORDS)})\\\\s)\\\\b(?![Tt]here\\\\b)([A-Za-z][A-Za-z0-9_]*)(${copulaConnector}\\\\b)`);\n\n// ── The quantifier layer's colour — the words that count (SPEC §7), lexicon-derived (inv #1) ─────────────\n// Coloured ONLY where the compiler reads them (quantifier.ts / cardinality.ts): a proportion determiner at\n// SUBJECT position (clause start, after a list marker, or a THEN consequent), an `only` lead, and the\n// quantity phrase of an existential-there frame. A mid-sentence \"any\"/\"no\" in ordinary prose stays plain —\n// colouring it would claim logic the checker doesn't run (the coloring must match what the compiler believes).\nconst SUBJ_QUANT_ALT = keywordAltCI(QUANTIFIER_WORDS.filter((q) => q.kind !== 'exclusive').flatMap((q) => q.words));\nconst EXCL_QUANT_ALT = keywordAltCI(QUANTIFIER_WORDS.filter((q) => q.kind === 'exclusive').flatMap((q) => q.words));\nconst CLAUSE_LEAD = `^\\\\s*(?:[-*+]\\\\s+|\\\\d+[.)]\\\\s+)?|\\\\b${keywordAltCI(['THEN'])}\\\\s+`;\nconst NUM_ALT = `(?:${Object.keys(NUMBER_WORDS).map((w) => keywordAltCI([w])).join('|')}|\\\\d+)`;\n// Fixed cardinal phrases longest-first so `more than one` wins over `one`; bound words from the SAME lexicon\n// entry the ≤/≥ fixes read (COMPARISON_SYMBOLS.bound); exactness markers compose with a number.\nconst CARD_FIXED_ALT = [...CARDINAL_QUANTITIES].sort((a, b) => b.phrase.length - a.phrase.length).map((q) => keywordAltCI([q.phrase])).join('|');\nconst BOUND_ALT = COMPARISON_SYMBOLS.filter((c) => c.bound !== undefined).map((c) => keywordAltCI([c.bound as string])).join('|');\nconst CARD_QUANTITY = `(?:(?:${keywordAltCI([...EXACTNESS_MARKERS])})\\\\s+${NUM_ALT}|(?:${BOUND_ALT})\\\\s+${NUM_ALT}|${CARD_FIXED_ALT}|${NUM_ALT})`;\nconst QUANT_SUBJECT: GroupRule = [new RegExp(`(${CLAUSE_LEAD})(${SUBJ_QUANT_ALT})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\nconst QUANT_EXCLUSIVE: GroupRule = [new RegExp(`(${CLAUSE_LEAD})(${EXCL_QUANT_ALT})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\nconst QUANT_THERE: GroupRule = [new RegExp(`(\\\\b${keywordAltCI(['THERE'])}\\\\s+(?:${keywordAltCI(['IS', 'ARE', 'WAS', 'WERE', 'EXISTS', 'EXIST'])})\\\\s+)(${CARD_QUANTITY})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\n// The possessive-have frame (`You have only one tool`) — the same quantity phrases, owner-scoped, MINUS\n// `a`/`an` (\"You have a clear mission\" is prose, not a claim — mirroring the parser's exclusion).\nconst CARD_FIXED_HAVE_ALT = [...CARDINAL_QUANTITIES].filter((q) => q.phrase !== 'a' && q.phrase !== 'an').sort((a, b) => b.phrase.length - a.phrase.length).map((q) => keywordAltCI([q.phrase])).join('|');\nconst CARD_QUANTITY_HAVE = `(?:(?:${keywordAltCI([...EXACTNESS_MARKERS])})\\\\s+${NUM_ALT}|(?:${BOUND_ALT})\\\\s+${NUM_ALT}|${CARD_FIXED_HAVE_ALT}|${NUM_ALT})`;\nconst QUANT_HAVE: GroupRule = [new RegExp(`(\\\\b(?:${keywordAltCI(['HAS', 'HAVE'])})\\\\s+)(${CARD_QUANTITY_HAVE})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\n// The two MEMBERSHIP frames (`You are one of many people…`, `You are the only person…`) — colour the\n// quantity idiom exactly as the parser reads it (cardinality.ts ONE_OF_RE / THE_ONLY_RE): `one of [the]\n// many|<n>=2>` and `the only`. The parser abstains on a quantifier- or numeral-led subject, so the same\n// two lookbehinds (one-word and two-word subjects) keep the colour off those lines; `one of one` and\n// `one of 1` are not set idioms there, so numerals colour only from two up.\nconst SUBJ_ABSTAIN_1 = `(?<!\\\\b(?:${keywordAltCI(QUANTIFIER_KEYWORDS)}|${NUM_ALT})\\\\s)`;\nconst SUBJ_ABSTAIN_2 = `(?<!\\\\b(?:${keywordAltCI(QUANTIFIER_KEYWORDS)}|${NUM_ALT})\\\\s[A-Za-z][A-Za-z0-9_]*\\\\s)`;\nconst MANY_ALT = MANY_CLASS.map((w) => keywordAltCI([w])).join('|');\nconst NUM_GE2_ALT = `(?:${Object.entries(NUMBER_WORDS).filter(([, n]) => n >= 2).map(([w]) => keywordAltCI([w])).join('|')}|[2-9]|[1-9]\\\\d+)`;\nconst QUANT_THE_ONLY: GroupRule = [new RegExp(`${SUBJ_ABSTAIN_1}${SUBJ_ABSTAIN_2}\\\\b((?:${copulaAlternation})\\\\s+)(${keywordAltCI(['THE'])}\\\\s+${keywordAltCI(['ONLY'])})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\nconst QUANT_ONE_OF: GroupRule = [new RegExp(`${SUBJ_ABSTAIN_1}${SUBJ_ABSTAIN_2}\\\\b((?:${copulaAlternation})\\\\s+)(${keywordAltCI(['ONE'])}\\\\s+${keywordAltCI(['OF'])}\\\\s+(?:${keywordAltCI(['THE'])}\\\\s+)?(?:${MANY_ALT}|${NUM_GE2_ALT}))(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\n// The ACTION-COUNT frame (`call five tools`, `you must call six tools`) — colour the quantity the parser\n// claims (cardinality.ts parseActionCount via quantifier.ts): a directive's object quantity. The verb\n// exclusions are THE SAME list the parser reads (NON_ACTION_LEADS + quantifier/number/deontic words), and\n// prohibitions stay plain because a prohibited count claims nothing. `a`/`an` never claim (the have-frame's\n// CARD_QUANTITY_HAVE alternation already excludes them).\nconst ACTION_VERB_EXCL = [\n ...NON_ACTION_LEADS,\n ...QUANTIFIER_KEYWORDS.map((w) => w.toLowerCase()),\n ...Object.keys(NUMBER_WORDS),\n ...EXACTNESS_MARKERS.map((w) => w.toLowerCase()),\n ...CARDINAL_QUANTITIES.map((q) => q.phrase.split(' ')[0] ?? ''),\n ...[...OBLIGATE, ...PROHIBIT].map((w) => (w.split(' ')[0] ?? '').toLowerCase()),\n].filter((w) => w !== '');\nconst ACTION_VERB = `(?!(?:${[...new Set(ACTION_VERB_EXCL)].map((w) => keywordAltCI([w])).join('|')})\\\\b)[A-Za-z][A-Za-z-]*`;\nconst OBLIGATE_ALT = OBLIGATE.map((w) => keywordAltCI([w])).join('|');\nconst QUANT_ACTION_MODAL: GroupRule = [new RegExp(`((?:${OBLIGATE_ALT})\\\\s+(?!${keywordAltCI(['NOT'])}\\\\b)${ACTION_VERB}\\\\s+)(${CARD_QUANTITY_HAVE})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\nconst QUANT_ACTION_LEAD: GroupRule = [new RegExp(`((?:${CLAUSE_LEAD}|[,;]\\\\s*)${ACTION_VERB}\\\\s+)(${CARD_QUANTITY_HAVE})(?=\\\\s+[A-Za-z])`), ['', 'quantifier']];\n// The FREQUENCY square (`Sometimes use firm language`, `should sometimes …`) — colour the adverb exactly\n// where the checker grades a rule (logic.ts peelFrequency): at a clause lead (an optional `you` before it)\n// or right after a modal. Quantity green — it quantifies occasions the way `some` quantifies a set.\nconst FREQ_COLOR_ALT = FREQUENCY_KEYWORDS.map((w) => keywordAltCI([w])).join('|');\nconst QUANT_FREQUENCY: GroupRule = [new RegExp(`((?:${CLAUSE_LEAD})(?:[Yy]ou\\\\s+)?|(?:${keywordAlt(MODAL_KEYWORDS)})\\\\s+(?:${keywordAltCI(['NOT'])}\\\\s+)?)(${FREQ_COLOR_ALT})\\\\b(?=,?\\\\s+[A-Za-z])`), ['', 'quantifier']];\nconst INCLUDING = /\\b([A-Za-z][A-Za-z0-9_]*)(\\s+(?:INCLUDING|including)\\b)/;\nconst MODAL_SUBJECT = new RegExp(`\\\\b((?!(?:${keywordAltCI([...BRANCH_KEYWORDS, ...CONTROL_KEYWORDS])})\\\\b)[A-Za-z][A-Za-z0-9_]*)(\\\\s+(?:${keywordAlt(MODAL_KEYWORDS)})\\\\b)`); // a branch/control word is never a modal's subject (`THEN never …`)\n// A machine-plane comparison — `@{tier} is one of pro, vip`, `@{n} is at least 5` — in a `$IF` arm, a `when=`\n// guard, or a `$DEFINE` body. ANCHORED to the `@{pointer}` (the one read form; a bare `$name` in an expression is\n// retired), so it can never fire on prose. The phrase colours as ONE `operator` (cyan — the copula extended into a\n// relation), claimed BEFORE the copula rule so `is` isn't split off. keywordAlt(COMPARISON_KEYWORDS) keeps the\n// vocabulary lexicon-derived (inv #1).\nconst COMPARISON: GroupRule = [new RegExp(`(@\\\\{[A-Za-z0-9_.]+\\\\})(\\\\s+)(${keywordAlt(COMPARISON_KEYWORDS)})\\\\b`), ['variable', '', 'operator']];\nconst PROSE_RULES: GroupRule[] = [\n [DETERMINER, ['declaration', '', 'property', 'operator']],\n [SAXON, ['declaration', '', '', 'property', 'operator']],\n [OF_GENITIVE, ['', 'property', '', 'declaration', 'operator']],\n [COPULA_SUBJECT, ['declaration', 'operator']],\n [INCLUDING, ['declaration', 'operator']],\n [MODAL_SUBJECT, ['declaration', 'modal']],\n];\n\n// Markdown inline styling — the markers dim (markup), the content styled. Content-then-marker groups.\nconst MARKDOWN_RULES: GroupRule[] = [\n [/(\\*\\*)([^*\\n]+?)(\\*\\*)/, ['markup', 'strong', 'markup']],\n [/(\\*)(\\S[^*\\n]*?)(\\*)/, ['markup', 'emphasis', 'markup']], // a `* ` list marker is claimed first, so this is safe\n [/(~~)([^~\\n]+?)(~~)/, ['markup', 'strike', 'markup']],\n [/(`)([^`\\n]+?)(`)/, ['markup', 'code', 'markup']],\n];\n\n/** Every semantic token in `source`, sorted by (line, start), non-overlapping. Pure. Higher-precedence tokens\n * (a comment, a directive, an insertion sigil) claim their span first so a lower one (a bare keyword) can't\n * double-mark it — the same coverage discipline findReferences uses. */\nexport function semanticTokens(source: string): SemToken[] {\n const lines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const kinds = classifyLines(lines);\n const fence = fenceMask(lines); // fenced code (```/~~~) — whole-line string, like Monarch's @fenced state\n // Definition rows and tool bodies render as REFERENCE/SCHEMA, not prose: the whole row claims its\n // styling up front so no operator/tag/sample rule fires inside — rendered, not authored, the doctrine\n // the retired editor decorations enforced, now in the token stream so EVERY LSP client serves it. The\n // DISPLAY def scan includes `<\"name\">` literal-zone rows — a cheat-sheet reads the same wherever it sits.\n const defTermAt = new Map<number, { col: number; len: number }>();\n const defBody = new Set<number>();\n for (const e of defEntriesDisplay(lines)) {\n defTermAt.set(e.line, { col: e.termCol, len: e.term.length });\n for (const l of e.lines.slice(1)) defBody.add(l);\n }\n const toolBody = toolBlockMask(lines);\n const switchBody = switchCommandMask(lines);\n const out: SemToken[] = [];\n\n lines.forEach((raw, i) => {\n const covered: [number, number][] = [];\n const push = (start: number, length: number, type: SemTokenType): void => {\n if (length <= 0) return;\n const end = start + length;\n if (covered.some(([a, b]) => start < b && end > a)) return;\n covered.push([start, end]);\n out.push({ line: i, start, length, type });\n };\n // Fill `type` over [start,end) for every sub-range NOT already claimed — lets an insertion sigil punch through\n // a string (Monarch colours `@{x}` inside \"…\"), the surrounding literal staying string.\n const fillGaps = (start: number, end: number, type: SemTokenType): void => {\n const spans = covered.filter(([a, b]) => a < end && b > start).sort((x, y) => x[0] - y[0]);\n let cur = start;\n for (const [a, b] of spans) {\n if (a > cur) push(cur, a - cur, type);\n cur = Math.max(cur, b);\n }\n if (cur < end) push(cur, end - cur, type);\n };\n const scan = (re: RegExp, type: SemTokenType, on = raw): void => {\n for (const m of on.matchAll(globalize(re))) if (m.index !== undefined) push(m.index, m[0].length, type);\n };\n // Apply a group-rule's per-group types at a match, walking the capture groups left to right (each group's\n // start = running offset, valid because every char of the match is captured — the Monarch convention).\n const applyGroups = (m: RegExpMatchArray, types: readonly (SemTokenType | '')[]): void => {\n let off = m.index ?? 0;\n for (let g = 1; g < m.length; g += 1) {\n const text = m[g] ?? '';\n const t = types[g - 1];\n if (text && t) push(off, text.length, t);\n off += text.length;\n }\n };\n const scanGroups = (rule: GroupRule, on = raw): void => {\n for (const m of on.matchAll(globalize(rule[0]))) applyGroups(m, rule[1]);\n };\n const lead = raw.length - raw.trimStart().length;\n\n // Reference/schema rows claim FIRST — before even the fence branch, because a fenced sample or a\n // `@@` note INSIDE a definition body is body content and wears the one neutral colour.\n const dt = defTermAt.get(i);\n if (dt) {\n push(dt.col, dt.len + 2, 'defterm'); // the term + its `::` marker\n push(dt.col + dt.len + 2, raw.length - (dt.col + dt.len + 2), 'defbody');\n return;\n }\n if (defBody.has(i)) return void push(0, raw.length, 'defbody');\n if (toolBody[i] === true && !/^\\s*\\$(?:TOOL|SERVICE)\\b/i.test(raw)) {\n // A field row (`- key:: value`) splits key from value; any other body line is all value-neutral.\n const m = raw.match(/^(\\s*(?:[-*+]\\s+)?)([A-Za-z][\\w-]*\\??)(::)(.*)$/);\n if (m !== null) {\n const keyStart = (m[1] ?? '').length;\n const keyLen = (m[2] ?? '').length + 2;\n push(keyStart, keyLen, 'toolkey');\n push(keyStart + keyLen, raw.length - (keyStart + keyLen), 'toolval');\n } else {\n push(lead, raw.length - lead, 'toolval');\n }\n return;\n }\n // A `$SWITCH ON` arm row: the member key wears the record-row colour (`- voice::` reads like a\n // `$TOOL`/`$TEST` field key), but the VALUE stays UNCLAIMED — an arm's inline body is model-facing\n // content, so the normal statement tokenization (modals, pointers, operators) colours it below.\n // Body lines under a row aren't touched at all — plain content lines. The header line falls through\n // too: `$SWITCH`/`ON` colour as the command they are.\n if (switchBody[i] === true) {\n const m = raw.match(/^(\\s*-\\s+)([A-Za-z][A-Za-z0-9_]*)(::)/);\n if (m !== null) push((m[1] ?? '').length, (m[2] ?? '').length + 2, 'toolkey');\n }\n\n // Whole-line kinds own the line: fenced code, a comment, a `@@` annotation, a `#` heading.\n // A `@@` note colours as a COMMENT — it IS one: an attached note the compiler strips, so it wears\n // the comment green and reads as documentation for the statement below it.\n if (fence[i]) return void push(0, raw.trimEnd().length, 'string');\n if (kinds[i] === 'comment') return void push(0, raw.trimEnd().length, 'comment');\n if (isAnnotationLine(raw)) return void push(raw.indexOf('@@'), raw.trimEnd().length - raw.indexOf('@@'), 'comment');\n if (/^\\s*#{1,6}\\s/.test(raw)) return void push(lead, raw.trimEnd().length - lead, 'heading');\n\n // A trailing `// …` inline comment, and a trailing `@@ note` (misplaced but legal — same comment\n // colour as its own-line form), each claimed first so nothing inside them colours.\n const cm = raw.match(/\\s+\\/\\/.*$/);\n if (cm?.index !== undefined) push(cm.index, raw.length - cm.index, 'comment');\n const am = raw.match(/\\s@@.*$/);\n if (am?.index !== undefined) push(am.index, raw.length - am.index, 'comment');\n\n // A line-anchored directive — first match wins (a line is one kind of directive), so break after it applies.\n for (const rule of DIRECTIVE_RULES) {\n const m = raw.match(rule[0]);\n if (m) {\n applyGroups(m, rule[1]);\n break;\n }\n }\n // A `$SWITCH ON` INLINE mid-sentence (`The fee is $SWITCH ON $x …`) — not caught by the anchored rule above.\n scanGroups([/(\\$SWITCH)(\\s+)(ON)\\b/, ['directive', '', 'keyword']]);\n\n // Insertion sigils FIRST — they punch through strings (a `@{x}` inside \"…\" still expands, so it stays blue).\n scan(/@\\{[A-Za-z0-9_.]+\\}/, 'variable'); // @{var}\n scan(/@<[A-Za-z0-9_.#]+>/, 'section'); // @<section>\n scan(/@\\[[A-Za-z][A-Za-z0-9_]*\\]/, 'tool'); // @[tool]\n // A `<\"name\">` literal-zone tag — BEFORE the string fill, so its quote pair reads as tag identity,\n // not as a \"…\" span: the quotes here are the sigil, not a string. Its own token type ('literal',\n // string-orange but tag-bold) — the colour says \"hidden from the checker\" at a glance.\n scan(new RegExp(`<\\\\/?${TAG_NAME_QUOTED_SRC}(?:\\\\s[^>]*)?>`, 'i'), 'literal');\n // A \"…\" literal — fills AROUND any insertion already claimed inside it.\n for (const m of raw.matchAll(/\"[^\"\\n]*\"/g)) if (m.index !== undefined) fillGaps(m.index, m.index + m[0].length, 'string');\n // A `<$name>` scaffold tag — its own token type ('scaffold', directive-red): the whole extent is\n // control-plane, hidden from the model, so the tag wears the $-family colour.\n scan(new RegExp(`<\\\\/?\\\\$${TAG_NAME_PLAIN_SRC}(?:\\\\s[^>]*)?>`, 'i'), 'scaffold');\n // A `<tag>` / `</tag>` delimiter — after strings (so a `<…>` inside \"…\" stays string), before `$var` (so a\n // `when=$x` guard inside the tag is owned by the tag, not split out). `\\??` admits the `<?quiet>`\n // wrapper (compiled away, so it stays quiet section blue); `<$…>` and `<\"…\">` are claimed above.\n scan(new RegExp(`<\\\\/?\\\\??${TAG_NAME_PLAIN_SRC}(?:\\\\s[^>]*)?>`, 'i'), 'section');\n scan(/\\$[a-z][a-z0-9_]*/, 'variable'); // $var host-state read (lowercase-gated)\n\n // Prose declarations + keywords over the QUOTE-MASKED line, so `\"you are welcome\"` isn't a copula and a\n // keyword can't steal a span an insertion/string already claimed.\n const masked = maskQuotes(raw);\n // The quantifier layer claims its words FIRST among the prose rules — a determiner at subject position,\n // an `only` lead, a there-frame quantity — so a possession/copula rule can't read them as plain subjects.\n scanGroups(QUANT_THERE, masked); // longest frame first: `there is only one` claims `only one` whole\n scanGroups(QUANT_HAVE, masked);\n scanGroups(QUANT_THE_ONLY, masked); // membership frames, parser order (cardinality.ts)\n scanGroups(QUANT_ONE_OF, masked);\n scanGroups(QUANT_ACTION_MODAL, masked); // action counts: `must call six tools`, then bare `call five tools`\n scanGroups(QUANT_ACTION_LEAD, masked);\n scanGroups(QUANT_FREQUENCY, masked); // the square over occasions: `sometimes`/`usually`/`rarely` leads\n scanGroups(QUANT_SUBJECT, masked);\n scanGroups(QUANT_EXCLUSIVE, masked);\n for (const rule of PROSE_RULES.slice(0, 3)) scanGroups(rule, masked); // possession — before the copula rules\n scan(CONTRACTION, 'declaration', masked); // `You're` whole, before the spaced copula\n scanGroups(COMPARISON, masked); // `@{x} is one of a, b` — before the copula, so `is` joins the phrase\n // (No `- name::` row rule here: a field row is EITHER a tool-body row — toolkey/toolval, claimed at the\n // top of this closure — or a definition entry — defterm/defbody, same place. The old property+type-word\n // colouring was dead pixels: the editor decorations always painted over it.)\n for (const rule of PROSE_RULES.slice(3)) scanGroups(rule, masked); // copula subject, INCLUDING, modal subject\n scan(/^\\s*[-*+]\\s/, 'list', masked); // - * + list marker\n scan(/^\\s*\\d+(?:\\.\\d+)*[.)]\\s/, 'list', masked); // 1. / 1) / 2.1. ordered marker (+ sub-step)\n for (const rule of MARKDOWN_RULES) scanGroups(rule, masked); // **bold** *italic* ~~strike~~ `code`\n scanGroups([/(\\[[^\\]\\n]+\\])(\\([^)\\n]+\\))/, ['link', 'link']], masked); // [text](href)\n scan(/\\b(?:NOT|not)\\b/, 'modal', masked); // NOT — negation red (before the operator scan)\n scan(MODAL_RE, 'modal', masked);\n scan(CONTROL_RE, 'keyword', masked);\n scan(OPERATOR_RE, 'operator', masked);\n });\n\n return out.sort((a, b) => a.line - b.line || a.start - b.start);\n}\n\n// Lines inside (or delimiting) a ``` / ~~~ code fence — highlighted whole as string, like Monarch's @fenced.\nfunction fenceMask(lines: readonly string[]): boolean[] {\n const mask: boolean[] = [];\n let inFence = false;\n for (const raw of lines) {\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// Wire indices derive from the portable legend: every token ships its STANDARD base's index plus a\n// modifier bit carrying our semantic name — foreign themes read the base, ours reads base.modifier.\nconst BASE_INDEX = new Map<string, number>(SEM_LEGEND.tokenTypes.map((t, i) => [t, i]));\nconst MODIFIER_BIT = new Map<string, number>(SEM_LEGEND.tokenModifiers.map((m, i) => [m, 1 << i]));\n\n/** Encode tokens into the LSP / Monaco semantic-tokens wire format: a flat int array, five per token —\n * `[deltaLine, deltaStartChar, length, tokenTypeIndex, tokenModifierBits]`, deltas relative to the previous\n * token, indices into SEM_LEGEND. Both the LSP server and the Monaco provider use THIS one encoder, so\n * the two can't drift. Tokens must already be sorted (semanticTokens returns them so). Pure. */\nexport function encodeSemanticTokens(tokens: readonly SemToken[]): number[] {\n const data: number[] = [];\n let prevLine = 0;\n let prevStart = 0;\n for (const t of tokens) {\n const deltaLine = t.line - prevLine;\n const deltaStart = deltaLine === 0 ? t.start - prevStart : t.start;\n const c = TOKEN_CLASSIFICATION[t.type];\n data.push(deltaLine, deltaStart, t.length, BASE_INDEX.get(c.base) ?? 0, c.modifier !== null ? (MODIFIER_BIT.get(c.modifier) ?? 0) : 0);\n prevLine = t.line;\n prevStart = t.start;\n }\n return data;\n}\n","// ── editor-config.ts · SSOT: the CLIENT-SIDE editor facts (CLAUDE.md inv #1) ─────────────────────────\n// Everything an EDITOR (not the language server) must know to host `.tg` lives here, exactly once:\n// the comment syntax, the bracket policy, the tag-line shapes that drive indentation and auto-close,\n// the indent unit, and the token PALETTE. The Language Server Protocol deliberately has no channel\n// for these — every LSP-based language ships them as client configuration (VS Code's\n// language-configuration.json) — so the portability move is not \"force them through LSP\" but \"derive\n// every client artifact from one source\":\n//\n// monaco-setup.ts derives setLanguageConfiguration + the theme rules\n// lib/monaco.ts derives the close-tag-outdent shape\n// web/operators.ts derives the auto-close tag shape\n// editors/vscode/… GENERATED by scripts/gen-editor-config.ts (never hand-edit)\n//\n// editor-config.test.ts locks the chain: the palette covers every token type, the tag shapes agree\n// with the parser's matchSectionTag on a witness corpus, and the generated VS Code file is fresh.\n\nimport { TAG_NAME_SRC } from './clause';\nimport type { SemTokenType } from './semantic-tokens';\nimport { SEM_TOKEN_TYPES } from './semantic-tokens';\n\n// Re-exported through the editor door so clients read ONE module — the definitions live with their\n// authorities (the tag shape beside the parser in clause.ts; the indent unit beside the formatter).\nexport { TAG_NAME_SRC } from './clause';\nexport { INDENT_UNIT } from './fmt';\n\n// ── Comments ──────────────────────────────────────────────────────────────────────────────────────\n/** The authoring-plane comment syntax, line and block pair — stripped at compile (SPEC §Comments). */\nexport const COMMENT_SYNTAX = { line: '//', block: ['/*', '*/'] as [string, string] };\n\n// ── Brackets ──────────────────────────────────────────────────────────────────────────────────────\n/** NO colorized bracket pairs — brackets in TypeGlish are prose punctuation, part of a single pointer\n * token (`@{x}` / `@[x]`), or neutral definition-body text: never pairs to rainbow by nesting depth.\n * This is the switch that actually disables Monaco's bracket-pair colorization (the editor option is\n * unreliably honoured), and it is the identical key a VS Code language-configuration.json ships. */\nexport const COLORIZED_BRACKET_PAIRS: [string, string][] = [];\n\n// ── Tag-line shapes ───────────────────────────────────────────────────────────────────────────────\n// The editor's view of a section tag: what a whole-line opener/closer looks like, for indentation\n// (indent after an open, outdent a close), auto-close (`<x>` → `</x>`), and the VS Code\n// language-configuration's onEnter/indentation rules. Built on clause.ts's TAG_NAME_SRC — the one\n// tag-name shape the parser itself reads — and welded to matchSectionTag by editor-config.test.ts on\n// a witness corpus, so a sigil added to one surface cannot silently miss the other.\n/** A whole-line OPENING tag (optional attrs, optional trailing `//` comment). */\nexport const OPEN_TAG_LINE_SRC = `^\\\\s*<${TAG_NAME_SRC}(\\\\s[^>]*)?>\\\\s*(\\\\/\\\\/.*)?$`;\n/** A whole-line CLOSING tag (optional trailing `//` comment). */\nexport const CLOSE_TAG_LINE_SRC = `^\\\\s*<\\\\/${TAG_NAME_SRC}>\\\\s*(\\\\/\\\\/.*)?$`;\n/** A whole-line opener whose caret sits right past the `>` — the auto-close trigger (name captured). */\nexport const AUTO_CLOSE_TAG_SRC = `^\\\\s*<(${TAG_NAME_SRC})>$`;\n/** A line that OPENS one indent level: a whole-line tag, a deterministic-chain arm left open\n * ($IF …: / $ELSE IF …: / $ELSE:), or a $TOOL/$SERVICE/$TEST header. Drives Monaco's\n * increaseIndentPattern and the generated VS Code indentation rule — one composition, two clients. */\nexport const INDENT_OPENERS_SRC = `^\\\\s*(?:<${TAG_NAME_SRC}(?:\\\\s[^>]*)?>|\\\\$(?:ELSE\\\\s+)?IF\\\\s+[^:]*:|\\\\$ELSE\\\\s*:|\\\\$(?:TOOL|SERVICE)\\\\s+[a-z][a-z0-9_]*|\\\\$TEST\\\\b[^:]*:\\\\s*\"[^\"]*\")\\\\s*(\\\\/\\\\/.*)?$`;\n\n// ── The token palette ─────────────────────────────────────────────────────────────────────────────\nexport interface TokenStyle {\n fg?: string; // hex without '#', Monaco-style\n bold?: boolean;\n italic?: boolean;\n strikethrough?: boolean;\n}\n\n/** One style per semantic token type — THE palette. monaco-setup derives its theme rules from this\n * (keyed by the portable `base.modifier` classification, semantic-tokens.ts), and the VS Code theme\n * generator will read the same table. Editors that never install our theme still colour every\n * construct sanely: the CLASSIFICATION maps each type onto a standard LSP base their native themes\n * already style. */\nexport const TOKEN_PALETTE: Record<SemTokenType, TokenStyle> = {\n directive: { fg: 'ff7b72', bold: true }, // $IMPORT/$CONFIG/$REQUIRE — import red\n keyword: { fg: 'c586c0', bold: true }, // IF/WHEN/THEN — control purple\n modal: { fg: 'ff7b72', bold: true }, // MUST/NEVER/NOT — red\n operator: { fg: '56b6c2' }, // IS/ARE/AND/OR/INCLUDING — cyan\n variable: { fg: '79c0ff' }, // @{x} / $x — insertion blue\n section: { fg: '58a6ff', bold: true }, // <tag> / @<x> — section blue\n tool: { fg: '79c0ff' }, // @[x] — insertion blue\n comment: { fg: '6b8f71', italic: true }, // // comment AND @@ annotation — muted green\n string: { fg: 'ffa657' }, // \"…\" literal + fenced code — orange\n heading: { fg: '58a6ff', bold: true }, // # heading — section blue\n declaration: { fg: 'e3b341', bold: true }, // a declared subject/owner/name/value — gold\n property: { fg: 'c9a86a' }, // a possessed property noun — muted gold\n annotation: { fg: '6b8f71', italic: true }, // RETIRED from emission — kept for legend index stability\n list: { fg: '8b949e' }, // - * 1. list markers — grey\n link: { fg: '4493f8' }, // [text](href)\n strong: { bold: true }, // **bold** — content bold, colour kept\n emphasis: { italic: true }, // *italic*\n strike: { fg: '8b949e', strikethrough: true }, // ~~struck~~\n code: { fg: '79c0ff' }, // `inline code`\n markup: { fg: '6e7681' }, // the **, *, ~~, ` markers — dim so content pops\n quantifier: { fg: '7ee787', bold: true }, // ALL/SOME/NO/ONLY/MOST — quantity green\n scaffold: { fg: 'ff7b72', bold: true }, // <$name> tags — control-plane, $-family red\n literal: { fg: 'ffa657', bold: true }, // <\"name\"> tags — literal zone, quote-family orange\n defterm: { fg: 'e3b341', bold: true }, // a definition `term::` — the reference-table label, gold\n defbody: { fg: 'a8b3bd' }, // a definition body — one neutral colour\n toolkey: { fg: '79c0ff', bold: true }, // a $TOOL/$SERVICE field key — a record key, blue\n toolval: { fg: 'a8b3bd' }, // a $TOOL/$SERVICE value — neutral, like defbody\n};\n\n/** Every token type is styled — locked so a new legend entry cannot ship unpainted. */\nexport function paletteCovers(): SemTokenType[] {\n return SEM_TOKEN_TYPES.filter((t) => TOKEN_PALETTE[t] === undefined);\n}\n\n// ── Editor chrome — the surface colours around the tokens ─────────────────────────────────────────\n/** The non-token half of the theme: editor surfaces, gutter, widgets. One table so a future VS Code\n * theme generator emits the same chrome the playground renders (monaco-setup derives its `colors`). */\nexport const EDITOR_CHROME: Record<string, string> = {\n 'editor.background': '#0d1117',\n 'editor.foreground': '#e6edf3',\n 'editorLineNumber.foreground': '#6e7681',\n 'editorLineNumber.activeForeground': '#e6edf3',\n 'editor.lineHighlightBackground': '#161b22',\n 'editorGutter.background': '#0d1117',\n 'editorIndentGuide.background1': '#21262d',\n 'editorWidget.background': '#161b22',\n 'editorWidget.border': '#2a3340',\n 'editorHoverWidget.background': '#161b22',\n 'editorHoverWidget.border': '#2a3340',\n // Suggest (autocomplete) dropdown. Without these it inherits a background ~9 RGB points off the\n // editor's (#161b22 vs #0d1117) with no border or shadow, so it blends into the text and reads as\n // \"cut off.\" Give it an elevated surface, a clear border, an accent-filled selection, and a real\n // drop shadow so it reads as a floating box.\n 'editorSuggestWidget.background': '#1c2330',\n 'editorSuggestWidget.border': '#3d4a5c',\n 'editorSuggestWidget.foreground': '#e6edf3',\n 'editorSuggestWidget.selectedBackground': '#1f6feb',\n 'editorSuggestWidget.selectedForeground': '#ffffff',\n 'editorSuggestWidget.highlightForeground': '#79c0ff',\n 'editorSuggestWidget.focusHighlightForeground': '#cae8ff',\n 'widget.shadow': '#00000088',\n};\n\n// ── The generated VS Code artifact ────────────────────────────────────────────────────────────────\n/** Render editors/vscode/language-configuration.json — the client half a VS Code extension ships next\n * to the stdio LSP (the protocol has no channel for these facts). GENERATED by\n * scripts/gen-editor-config.ts; editor-config.test.ts locks freshness, so the file can never drift\n * from this source. `brackets` is deliberately OMITTED (default pair-matching stays, mirroring the\n * Monaco setup); only colorization is disabled. JSONC — VS Code allows the banner comment. */\nexport function renderVsCodeLanguageConfiguration(): string {\n const cfg = {\n comments: { lineComment: COMMENT_SYNTAX.line, blockComment: COMMENT_SYNTAX.block },\n colorizedBracketPairs: COLORIZED_BRACKET_PAIRS,\n indentationRules: {\n increaseIndentPattern: { pattern: INDENT_OPENERS_SRC, flags: 'i' },\n decreaseIndentPattern: { pattern: CLOSE_TAG_LINE_SRC, flags: 'i' },\n },\n };\n return `// GENERATED from src/core/editor-config.ts — run \\`npm run gen:editor\\`; never hand-edit.\\n${JSON.stringify(cfg, null, 2)}\\n`;\n}\n","export type BlockType =\n | 'role'\n | 'constraints'\n | 'process'\n | 'examples'\n | 'output'\n | 'tone'\n | 'prose'\n | 'comment';\n\nexport interface Block {\n id: string;\n type: BlockType;\n body: string;\n children: Block[];\n collapsed: boolean;\n}\n\nexport type BodyShape = 'prose' | 'rules' | 'steps' | 'pairs' | 'spec' | 'note';\n\nexport interface BlockTypeDef {\n label: string;\n /** What this block is for. */\n does: string;\n /** What this block must NOT be used for — the half that prevents misuse. */\n doesNot: string;\n bodyShape: BodyShape;\n unit: string;\n canHaveChildren: boolean;\n accent: string;\n}\n\nexport const BLOCK_TYPES: Record<BlockType, BlockTypeDef> = {\n role: {\n label: 'Role',\n does: \"Sets the agent's persona and purpose.\",\n doesNot: 'Hold rules or steps — put those in Constraints or Process.',\n bodyShape: 'prose',\n unit: 'line',\n canHaveChildren: false,\n accent: 'var(--v-role)',\n },\n constraints: {\n label: 'Constraints',\n does: 'Testable rules the model must follow — one per line.',\n doesNot: 'Describe persona or sequence.',\n bodyShape: 'rules',\n unit: 'rule',\n canHaveChildren: true,\n accent: 'var(--v-prohibition)',\n },\n process: {\n label: 'Process',\n does: 'Ordered steps the agent works through.',\n doesNot: 'Hold standalone rules.',\n bodyShape: 'steps',\n unit: 'step',\n canHaveChildren: true,\n accent: 'var(--v-conditional)',\n },\n examples: {\n label: 'Examples',\n does: 'Few-shot examples that show the desired behaviour.',\n doesNot: \"State rules — show, don't tell.\",\n bodyShape: 'pairs',\n unit: 'line',\n canHaveChildren: true,\n accent: 'var(--v-example)',\n },\n output: {\n label: 'Output',\n does: 'The required output format or shape.',\n doesNot: 'Hold persona or rules.',\n bodyShape: 'spec',\n unit: 'line',\n canHaveChildren: false,\n accent: 'var(--v-format)',\n },\n tone: {\n label: 'Tone',\n does: 'Voice and writing style.',\n doesNot: 'Hold rules or steps.',\n bodyShape: 'prose',\n unit: 'line',\n canHaveChildren: false,\n accent: 'var(--v-directive)',\n },\n prose: {\n label: 'Prose',\n does: 'Free-form text — the escape hatch.',\n doesNot: 'Get analysed or measured structurally.',\n bodyShape: 'prose',\n unit: 'line',\n canHaveChildren: false,\n accent: 'var(--inert)',\n },\n comment: {\n label: 'Comment',\n does: 'A note for authors.',\n doesNot: 'Ever reach the model.',\n bodyShape: 'note',\n unit: 'line',\n canHaveChildren: false,\n accent: 'var(--comment)',\n },\n};\n\nlet _seq = 0;\nfunction nid(): string {\n _seq += 1;\n return `blk-${_seq}`;\n}\n\nexport function newBlock(type: BlockType, body = ''): Block {\n return { id: nid(), type, body, children: [], collapsed: false };\n}\n\nexport function seedBlocks(): Block[] {\n return [\n newBlock('role', 'You are a customer support agent for Acme, a SaaS analytics company.'),\n newBlock(\n 'constraints',\n \"Answer only using Acme's documented features; if unsure, say so and offer to escalate.\\n\" +\n 'Keep every response to at most 3 sentences.\\n' +\n 'Never state a specific price; direct pricing questions to the sales team.',\n ),\n newBlock(\n 'process',\n 'Greet the user.\\nAnswer the question or escalate.\\nAsk if there is anything else you can help with.',\n ),\n newBlock('comment', 'Profiler said the conciseness rule carries the score (+0.27 on opus-4-8).'),\n ];\n}\n\n// ---- tree operations (immutable) ----\n\nexport function updateBlock(blocks: Block[], id: string, fn: (b: Block) => Block): Block[] {\n return blocks.map((b) => {\n if (b.id === id) return fn(b);\n if (b.children.length) return { ...b, children: updateBlock(b.children, id, fn) };\n return b;\n });\n}\n\nexport function removeBlock(blocks: Block[], id: string): Block[] {\n return blocks\n .filter((b) => b.id !== id)\n .map((b) => (b.children.length ? { ...b, children: removeBlock(b.children, id) } : b));\n}\n\nexport function addChild(blocks: Block[], parentId: string, child: Block): Block[] {\n return blocks.map((b) => {\n if (b.id === parentId) return { ...b, collapsed: false, children: [...b.children, child] };\n if (b.children.length) return { ...b, children: addChild(b.children, parentId, child) };\n return b;\n });\n}\n\nexport function moveBlock(blocks: Block[], id: string, dir: -1 | 1): Block[] {\n const idx = blocks.findIndex((b) => b.id === id);\n if (idx !== -1) {\n const j = idx + dir;\n if (j < 0 || j >= blocks.length) return blocks;\n const copy = blocks.slice();\n const item = copy[idx];\n if (!item) return blocks;\n copy.splice(idx, 1);\n copy.splice(j, 0, item);\n return copy;\n }\n return blocks.map((b) => (b.children.length ? { ...b, children: moveBlock(b.children, id, dir) } : b));\n}\n\nexport function findBlock(blocks: Block[], id: string): Block | undefined {\n for (const b of blocks) {\n if (b.id === id) return b;\n const found = findBlock(b.children, id);\n if (found) return found;\n }\n return undefined;\n}\n\n// ---- compile to the markdown the model actually receives ----\n\nfunction ensurePeriod(s: string): string {\n return /[.!?:]$/.test(s) ? s : `${s}.`;\n}\n\nfunction bodyLines(body: string): string[] {\n return body\n .split('\\n')\n .map((l) => l.trim())\n .filter((l) => l !== '');\n}\n\nfunction compileBlock(b: Block, depth: number): string {\n if (b.type === 'comment') return '';\n const def = BLOCK_TYPES[b.type];\n const lines = bodyLines(b.body);\n let bodyMd: string;\n if (b.type === 'constraints') bodyMd = lines.map((l) => `- ${ensurePeriod(l)}`).join('\\n');\n else if (b.type === 'process') bodyMd = lines.map((l, i) => `${i + 1}. ${l}`).join('\\n');\n else bodyMd = b.body.trim();\n const childMd = b.children\n .map((c) => compileBlock(c, depth + 1))\n .filter((s) => s)\n .join('\\n\\n');\n if (b.type === 'prose') return [bodyMd, childMd].filter((s) => s).join('\\n\\n');\n const heading = `${'#'.repeat(Math.min(6, depth))} ${def.label}`;\n return [heading, bodyMd, childMd].filter((s) => s).join('\\n');\n}\n\nexport function compileBlocks(blocks: Block[]): string {\n return blocks\n .map((b) => compileBlock(b, 1))\n .filter((s) => s)\n .join('\\n\\n');\n}\n\nexport function blockSummary(b: Block): string {\n const def = BLOCK_TYPES[b.type];\n const lines = bodyLines(b.body).length;\n const parts: string[] = [];\n if (def.bodyShape !== 'note' && lines) parts.push(`${lines} ${def.unit}${lines === 1 ? '' : 's'}`);\n if (b.children.length) parts.push(`${b.children.length} sub-block${b.children.length === 1 ? '' : 's'}`);\n return parts.join(' · ') || 'empty';\n}\n\nexport function firstLine(body: string): string {\n const l = bodyLines(body)[0] ?? '';\n return l.length > 48 ? `${l.slice(0, 47)}…` : l;\n}\n","// ── The profile — what each line does, in three layers of certainty ────────────────────────────────\n// The organizing artifact of \"prompts as mechanical programs\": every statement carries a record of\n// STATIC what it says (IR kind, deontic force, predicates), what it duplicates (residual,\n// coveredBy), what it conflicts with — free, computed from what the compiler already knows;\n// COVERAGE which $TEST cases exercise it — whether the behavioral question is even answerable;\n// BEHAVIORAL what actually happened under ablation (Δ per case) — measured, costs eval calls.\n//\n// Records key on a CONTENT HASH of the statement (same FNV-1a the semantic atoms use), so annotations,\n// comments, and reordering never invalidate them — and an EDITED statement is a new hash, which makes\n// staleness impossible by construction: behavioral numbers can only ever attach to the exact text that\n// was measured.\nimport { configSectionMask, stripInlineComment, toolBlockMask } from './clause';\nimport { ruleCoverage } from './coverage';\nimport { parseLine } from './grammar';\nimport { renderLines } from './highlight';\nimport { lower } from './ir';\nimport type { IR } from './ir';\nimport type { LineEffect } from './types';\nimport { atomId } from './semantic/atoms';\nimport type { SemanticReport } from './semantic/types';\nimport { buildStructure } from './structure';\nimport type { StructuredDoc } from './structure';\nimport { extractSuite } from './testblock';\nimport type { ExtractedSuite } from './testblock';\n\n/** Content-addressed statement identity: the clause text, comment-stripped and case-folded — stable\n * under `//@` annotations, human comments, list-marker changes, and reordering. */\nexport function statementHash(rawLine: string): string {\n const clause = parseLine(stripInlineComment(rawLine)).clause.trim();\n return atomId(clause, undefined);\n}\n\nexport interface ProfileBehavioral {\n overall: { delta: number; stderr: number; samples: number };\n perCase: { caseId: string; delta: number; stderr: number; samples: number }[];\n model: string;\n at: string; // ISO timestamp of the measuring run\n}\n\nexport interface StatementProfile {\n v: 1;\n hash: string;\n /** Where the statement sat when last seen (0-based) — display only; identity is the hash. */\n lastLine: number;\n text: string;\n static: {\n irKind?: 'directive' | 'declaration';\n deontic?: string;\n /** Canonical predicate label(s) — `emit(label)`, `transfer→billing_desk`. */\n predicates?: string[];\n residual?: number;\n coveredBy?: { line: number; ent: number }[];\n contradicts?: { line: number; confirmed: boolean }[];\n };\n coverage: { cases: string[] };\n behavioral?: ProfileBehavioral;\n}\n\n/** The flattened per-line view a hover renders — what an editor's provider (or a loaded\n * StatementProfile) supplies. Kept transport-agnostic: the web worker and the stdio LSP compose the\n * SAME markdown from it, so no editor layer owns the wording. */\nexport interface ProfileHoverInfo {\n residual?: number;\n coveredBy?: { line: number; ent: number }[];\n cases?: string[];\n isHardRule?: boolean;\n delta?: { delta: number; stderr: number; samples: number };\n}\n\n/** The line-profile hover, composed in CORE so every editor serves identical wording. Every row\n * carries its own WHY — the reader (a person or an agent mid-edit) must never need the docs to\n * decode a finding (the MESSAGE DOCTRINE, codes.ts): a term of art (residual, entailment,\n * ablation Δ) never appears without its plain-English meaning in the same clause. Locked by\n * profile.test.ts — the wording is a contract, not decoration. */\nexport function profileHoverMarkdown(info: ProfileHoverInfo): string | null {\n const rows: string[] = [];\n if (info.residual !== undefined)\n rows.push(`residual **${info.residual.toFixed(2)}** — the share of this line's meaning found nowhere else in the prompt`);\n if (info.coveredBy && info.coveredBy.length > 0)\n rows.push(`already said by ${info.coveredBy.map((c) => `L${c.line + 1}`).join(', ')} (entailment ${info.coveredBy.map((c) => c.ent.toFixed(2)).join(', ')}) — those lines assert what this one asserts`);\n if (info.cases && info.cases.length > 0) rows.push(`exercised by \\`${info.cases.join('`, `')}\\` — these $TEST cases measure this rule's behavioral impact`);\n else if (info.isHardRule)\n rows.push('⚠ **no $TEST case exercises this rule** — the compiler cannot measure what the rule changes (removing it would alter no test outcome it can see). Add a $TEST whose input triggers this rule to prove it matters.');\n if (info.delta)\n rows.push(\n `ablation Δ **${info.delta.delta >= 0 ? '+' : ''}${info.delta.delta.toFixed(2)}** ±${info.delta.stderr.toFixed(2)} — removing this line ${info.delta.delta >= 0 ? 'drops' : 'RAISES'} the test score by ${Math.abs(info.delta.delta).toFixed(2)} (measured over ${info.delta.samples} run${info.delta.samples === 1 ? '' : 's'})`,\n );\n if (rows.length === 0) return null;\n return `**statement profile** — what the compiler has measured about this statement:\\n\\n- ${rows.join('\\n- ')}`;\n}\n\nexport interface ProfileInputs {\n ir?: IR;\n structure?: StructuredDoc;\n semantic?: SemanticReport;\n suite?: ExtractedSuite;\n}\n\n/** The free pass: one record per content statement, from what the compiler already computed. */\nexport function buildStaticProfile(source: string, inputs: ProfileInputs = {}): StatementProfile[] {\n const rawLines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const render = renderLines(rawLines);\n const structure = inputs.structure ?? buildStructure(rawLines);\n // Tool bodies are schemas, not statements of the prompt — same blanking the logic tiers use.\n // A <$CONFIG> section is scaffolding at section scale.\n const toolMask = toolBlockMask(rawLines);\n const cfgMask = configSectionMask(rawLines);\n const ir =\n inputs.ir ?? lower(rawLines.map((l, i) => (toolMask[i] ? '' : l)).join('\\n'), { tools: structure.index.tools });\n const suite = inputs.suite ?? extractSuite(source);\n const coverage = suite.testCases.length > 0 ? ruleCoverage(ir, suite) : null;\n\n const byLine = new Map<number, StatementProfile>();\n rawLines.forEach((raw, i) => {\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading') return;\n if (structure.importLines.has(i) || structure.configLines.has(i) || structure.testLines.has(i) || toolMask[i] || cfgMask[i]) return;\n const clause = parseLine(stripInlineComment(raw)).clause.trim();\n if (clause === '') return;\n byLine.set(i, {\n v: 1,\n hash: statementHash(raw),\n lastLine: i,\n text: clause,\n static: {},\n coverage: { cases: [] },\n });\n });\n\n for (const node of ir.nodes) {\n const rec = byLine.get(node.line);\n if (!rec) continue;\n rec.static.irKind = node.kind;\n if (node.kind === 'directive') {\n rec.static.deontic = node.deontic;\n if (node.predicate) {\n const p = node.predicate;\n const label = `${p.lexicalPolarity === -1 ? '¬' : ''}${p.tool ? `tool:${p.tool}` : p.head}${p.theme ? `(${p.theme})` : ''}`;\n rec.static.predicates = [...(rec.static.predicates ?? []), label];\n }\n }\n }\n\n if (inputs.semantic) {\n for (const audit of inputs.semantic.lines) {\n const rec = byLine.get(audit.line);\n if (!rec) continue;\n rec.static.residual = audit.residual;\n if (audit.coveredBy.length > 0) rec.static.coveredBy = audit.coveredBy.map((c) => ({ line: c.line, ent: c.ent }));\n if (audit.contradicts.length > 0)\n rec.static.contradicts = audit.contradicts.map((c) => ({ line: c.line, confirmed: c.confirmed }));\n }\n }\n\n if (coverage) {\n for (const rule of coverage.perRule) {\n const rec = byLine.get(rule.line);\n if (rec) rec.coverage.cases = [...new Set([...rec.coverage.cases, ...rule.cases])];\n }\n }\n\n return [...byLine.values()];\n}\n\n/** Attach a behavioral run's per-line effects to the matching records. Effects address lines\n * positionally (`L<n>`), so this must run against the SAME source the profiler saw. */\nexport function attachBehavioral(\n records: StatementProfile[],\n effects: LineEffect[],\n model: string,\n at: string,\n): StatementProfile[] {\n const byLine = new Map(records.map((r) => [r.lastLine, r]));\n for (const e of effects) {\n const rec = byLine.get(e.n - 1);\n if (!rec) continue;\n rec.behavioral = {\n overall: { delta: e.delta, stderr: e.stderr, samples: e.samples },\n perCase: e.perCase ?? [],\n model,\n at,\n };\n }\n return records;\n}\n\n/** Latest-wins by hash; a prior behavioral measurement carries forward while the hash (the exact\n * statement text) is unchanged — an edited statement is a new hash, so staleness cannot happen. */\nexport function mergeProfiles(prev: StatementProfile[], next: StatementProfile[]): StatementProfile[] {\n const byHash = new Map(prev.map((r) => [r.hash, r]));\n const out: StatementProfile[] = [];\n for (const n of next) {\n const p = byHash.get(n.hash);\n out.push(p?.behavioral && !n.behavioral ? { ...n, behavioral: p.behavioral } : n);\n }\n return out;\n}\n","// ── The client for the worker-hosted language service ───────────────────────────────────────────────────────\n// A thin async bridge: one Worker, request/response keyed by id. The editor providers (monaco-setup) call the\n// exported functions here — and MUST NOT import the core language services directly. That boundary (enforced by\n// eslint's no-restricted-imports) is what keeps the preview and every IDE in lockstep: both go through the same\n// service, so neither can quietly hardcode its own behavior.\nimport type { AgentBundle } from '../core/compile';\nimport type { CacheReport } from '../core/caching';\nimport type { ConfigSchema } from '../core/config-schema';\nimport type { CodeAction, CodeActionRange } from '../core/code-actions';\nimport type { Diagnostic, RubricDim } from '../core/diagnostics';\nimport type { Bag } from '../core/expr';\nimport type { FoldRange, ImportSymbol, OutlineNode, StructCompletion } from '../core/structure';\nimport type { LinkedEdit, LspRequest, LspResult, LspServerMessage } from './lsp-worker';\n\nlet worker: Worker | null = null;\nlet nextId = 1;\nconst pending = new Map<number, (result: LspResult) => void>();\n// Fired when the worker's dictionary finishes loading — diagnostics consumers re-request so the now-available\n// unknown-word check shows up (mirrors the old `dict.version` bump, just across the worker boundary).\nconst readyCallbacks = new Set<() => void>();\n\n/** Subscribe to \"the worker's spell dictionary is ready.\" Returns an unsubscribe. */\nexport function onDictionaryReady(cb: () => void): () => void {\n readyCallbacks.add(cb);\n return () => readyCallbacks.delete(cb);\n}\n\n// Lazily spin up the worker on first use (Vite bundles it from the URL). Kept module-local so the whole app\n// shares one worker instance.\nfunction getWorker(): Worker {\n if (!worker) {\n worker = new Worker(new URL('./lsp-worker.ts', import.meta.url), { type: 'module' });\n worker.onmessage = (e: MessageEvent<LspServerMessage>): void => {\n const msg = e.data;\n if ('notification' in msg) {\n if (msg.notification === 'dictionaryReady') for (const cb of readyCallbacks) cb();\n return;\n }\n const resolve = pending.get(msg.id);\n if (resolve) {\n pending.delete(msg.id);\n resolve(msg.result);\n }\n };\n }\n return worker;\n}\n\n// DEV self-healing — the page and the worker are SEPARATE bundles of the same core, and semantic tokens\n// travel between them as an index-encoded wire format. An HMR update can therefore split the module graph:\n// the worker keeps encoding with the old rules while the page decodes with the new ones, and the symptom\n// is subtle corruption (a `$TOOL` rendering as two differently-coloured fragments), not an error. So after\n// EVERY update batch the worker is torn down; the next request lazily respawns it on the CURRENT graph,\n// and the fresh worker's `dictionaryReady` notification re-triggers the diagnostics consumers. In-flight\n// requests are dropped, not rejected — the respawn's re-requests supersede them. Production builds have\n// no HMR; this whole block compiles away.\nif (import.meta.hot) {\n import.meta.hot.on('vite:beforeUpdate', () => {\n worker?.terminate();\n worker = null;\n pending.clear();\n });\n}\n\n// One request/response round-trip; the typed wrappers below narrow the result. `WithoutId` distributes the\n// omit over the request UNION (a plain `Omit<LspRequest,'id'>` would collapse it to only the shared keys).\ntype WithoutId<T> = T extends unknown ? Omit<T, 'id'> : never;\nfunction send(req: WithoutId<LspRequest>): Promise<LspResult> {\n const id = nextId++;\n return new Promise((resolve) => {\n pending.set(id, resolve);\n getWorker().postMessage({ ...req, id } as LspRequest);\n });\n}\n\n/** Completions at a position — the same StructCompletion[] the LSP produces (the worker runs completionsAt). */\nexport function requestCompletion(before: string, source: string, line: number, schema: ConfigSchema): Promise<StructCompletion[]> {\n return send({ kind: 'completion', before, source, line, schema }) as Promise<StructCompletion[]>;\n}\n\n/** A hover markdown card at a position, or null — the same rich hover the LSP now serves (objects, symbols). */\nexport function requestHover(source: string, line: number, character: number): Promise<string | null> {\n return send({ kind: 'hover', source, line, character }) as Promise<string | null>;\n}\n\n/** The definition location a reference resolves to, or null — sections, variables, `@<…>`, `@[…]`, `$DEFINE`. */\nexport function requestDefinition(source: string, line: number, character: number): Promise<{ line: number; character: number } | null> {\n return send({ kind: 'definition', source, line, character }) as Promise<{ line: number; character: number } | null>;\n}\n\n/** The delta-encoded semantic tokens for the whole document — the LSP/Monaco wire format (five ints per token).\n * The same tokenizer the LSP serves; the caller wraps this in Monaco's SemanticTokens shape. */\nexport function requestSemanticTokens(source: string): Promise<number[]> {\n return send({ kind: 'semanticTokens', source }) as Promise<number[]>;\n}\n\n/** The section-outline tree (the LSP's documentSymbol) — powers sticky scroll + go-to-symbol. The caller maps\n * each OutlineNode to Monaco's nested DocumentSymbol. Same outline() the LSP serves, off the main thread. */\nexport function requestDocumentSymbols(source: string): Promise<OutlineNode[]> {\n return send({ kind: 'documentSymbol', source }) as Promise<OutlineNode[]>;\n}\n\n/** Foldable line ranges (headings, nested lists, `<tag>` blocks) — the SAME foldingRanges() the LSP serves. */\nexport function requestFoldingRanges(source: string): Promise<FoldRange[]> {\n return send({ kind: 'foldingRanges', source }) as Promise<FoldRange[]>;\n}\n\n/** The open/close tag-name spans to keep in sync while renaming an XML section tag, or null (caret not on one).\n * The SAME linkedTagSpans() the LSP's linkedEditingRange serves. `line` is 0-based. */\nexport function requestLinkedEdit(source: string, line: number): Promise<LinkedEdit> {\n return send({ kind: 'linkedEdit', source, line }) as Promise<LinkedEdit>;\n}\n\n/** Compile diagnostics for the document — structural + config + (once the worker's dictionary loads) the\n * unknown-word check. `customWords` is the user's personal dictionary; `rubric` lets the checker flag a\n * constraint nothing measures; `glishConfig` is the project's glish.tgc source, so config params + cross-field\n * rules validate against the PROJECT schema. The SAME compile() the LSP runs, dictionary and all, off-thread. */\nexport function requestDiagnostics(source: string, rubric: RubricDim[], customWords: string[], glishConfig?: string): Promise<Diagnostic[]> {\n return send({ kind: 'diagnostics', source, rubric, customWords, glishConfig }) as Promise<Diagnostic[]>;\n}\n\n/** The quick-fix menu for a range — compiler fixes + spelling suggestions + the add-to-dictionary command,\n * composed in core (codeActionsAt), the SAME set the stdio LSP serves. Awaits the worker's dictionary.\n * Pass `fileNames` (the workspace's existing file names) to ALSO compose the section-extraction refactor —\n * the same opt-in the stdio LSP expresses with its directory listing. */\nexport function requestCodeActions(source: string, range: CodeActionRange, customWords: string[], glishConfig?: string, fileNames?: string[]): Promise<CodeAction[]> {\n return send({ kind: 'codeActions', source, range, customWords, glishConfig, fileNames }) as Promise<CodeAction[]>;\n}\n\n/** The compiled, XML-tagged prompt — imports composed (`source`), values `bag` resolved, then tagged. The SAME\n * compileToXml/resolve the compiler runs; the web no longer calls them on the main thread. */\nexport function requestCompiledXml(source: string, instructions: string, bag: Bag): Promise<string> {\n return send({ kind: 'compiledXml', source, instructions, bag }) as Promise<string>;\n}\n\n/** The agent bundle — `$CONFIG` settings + inline `$TOOL` definitions — of the source. The SAME compile() the\n * LSP runs; the web no longer calls compile() at all. */\nexport function requestAgent(source: string): Promise<AgentBundle> {\n return send({ kind: 'agent', source }) as Promise<AgentBundle>;\n}\n\n/** How cacheable the compiled prompt is (the static share across turns), or null when it can't compile. Renders\n * the prompt twice in the worker — the SAME compileToXml/resolve — so the web never compiles for this either. */\nexport function requestPromptCache(source: string, instructions: string, inputs: ImportSymbol[]): Promise<CacheReport | null> {\n return send({ kind: 'promptCache', source, instructions, inputs }) as Promise<CacheReport | null>;\n}\n","import type { Monaco } from '@monaco-editor/react';\nimport type * as Mon from 'monaco-editor';\n\nimport { BLOCK_TYPES } from './blocks';\nimport type { BlockType } from './blocks';\nimport { examplesMask } from '../core/clause';\nimport { BUILTIN_CONFIG_SCHEMA } from '../core/config-schema';\nimport type { ConfigSchema } from '../core/config-schema';\n// Ratchet note (DESIGN-lsp.md): the banned imports are the language-service ENTRY POINTS (hoverAt,\n// completionsAt, …) — analysis must go through the worker. profileHoverMarkdown is a pure formatter\n// over app-computed data: importing it is how the wording stays single-sourced across transports.\nimport { profileHoverMarkdown } from '../core/profile';\nimport type { ProfileHoverInfo } from '../core/profile';\nimport { COMPLETION_TRIGGERS, type CompletionKind, matchSectionTag, type OutlineNode } from '../core/structure';\nimport { SEM_LEGEND, SEM_TOKEN_TYPES, TOKEN_CLASSIFICATION } from '../core/semantic-tokens';\nimport { CLOSE_TAG_LINE_SRC, COLORIZED_BRACKET_PAIRS, COMMENT_SYNTAX, EDITOR_CHROME, INDENT_OPENERS_SRC, OPEN_TAG_LINE_SRC, TOKEN_PALETTE } from '../core/editor-config';\nimport { requestCompletion, requestDefinition, requestDocumentSymbols, requestFoldingRanges, requestHover, requestLinkedEdit, requestSemanticTokens } from './lsp-client';\n\n// TypeGlish's own language id + file extension — `.tg`, the way `.ts` is TypeScript. The editor binds\n// highlighting, folding, hovers, and completion to this id, and registers the extension so any host that\n// keys language off a file URI resolves a `.tg` file to TypeGlish.\nexport const LANG_ID = 'tg';\nexport const FILE_EXT = '.tg';\nexport const THEME_ID = 'typeglish-dark';\n\n// ── The profile hover — per-line \"what does this line do\" ──────────────────────────────────────────\n// The app injects a provider (the setSpellContext pattern: the hover provider registers once per\n// language, the data changes per render); hovering any statement shows its profile: residual value,\n// which $TEST cases exercise it, and the last measured ablation Δ. The DATA is app-state (the async\n// semantic tier + verify runs live in the app), but the WORDING is core's (profileHoverMarkdown) —\n// this layer renders, it never composes, so Monaco and the stdio LSP can never drift on a message.\nexport type { ProfileHoverInfo } from '../core/profile';\n\nlet profileFn: ((line0: number) => ProfileHoverInfo | null) | null = null;\nexport function setProfileProvider(fn: ((line0: number) => ProfileHoverInfo | null) | null): void {\n profileFn = fn;\n}\n\n// The effective `$CONFIG` schema (built-in defaults + the project's glish.tgc), injected by the app whenever\n// the nearest glish.tgc changes. The completion provider reads it so `$CONFIG modality ␣` offers the AUTHOR's\n// declared values, not the compiler's hardcoded ones. Defaults to built-in so a zero-config project still works.\nlet configSchemaCtx: ConfigSchema = BUILTIN_CONFIG_SCHEMA;\nexport function setConfigSchema(schema: ConfigSchema): void {\n configSchemaCtx = schema;\n}\n\n// Thin display shim: fetch the app's per-line data, let CORE compose the words. The wording contract\n// (what fired / why it matters / what to do) lives in profileHoverMarkdown, locked by profile.test.ts.\nfunction profileMarkdown(line0: number): string | null {\n const info = profileFn?.(line0);\n return info ? profileHoverMarkdown(info) : null;\n}\n\nfunction inferBlockType(label: string): BlockType | null {\n const norm = label.trim().toLowerCase();\n for (const key of Object.keys(BLOCK_TYPES) as BlockType[]) {\n if (BLOCK_TYPES[key].label.toLowerCase() === norm) return key;\n }\n return null;\n}\n\nexport interface OutlineItem {\n line: number;\n label: string;\n level: number;\n type: BlockType | null;\n}\n\n/** Parse section headers into a flat outline list with nesting levels. A section is EITHER a `# heading`\n * (nested by level) OR a whole-line `<tag>…</tag>` block (nested by containment) — both list, exactly as\n * both compile to tags. The level is the containment depth (so `# heading` keeps its `#`-count level, and a\n * `<persona>` inside a `# Role` lists one deeper). A self-closing `<break/>` is content, not a section. */\nexport function scanOutline(text: string): OutlineItem[] {\n const out: OutlineItem[] = [];\n const stack: { heading: boolean; hlevel: number; tag: string }[] = [];\n const lines = text.split('\\n');\n const exMask = examplesMask(lines); // <examples> interior is literal — no phantom outline entries from sample tags\n lines.forEach((l, i) => {\n if (exMask[i]) return; // the tag lines stay unmasked, so <examples> itself still lists\n const h = l.match(/^\\s*(#{1,6})\\s+(.+?)\\s*$/); // leading indentation tolerated — a nested `##` still lists\n const st = matchSectionTag(l);\n if (h) {\n const hlevel = (h[1] ?? '').length;\n while (stack.length > 0 && stack[stack.length - 1]?.heading && (stack[stack.length - 1]?.hlevel ?? 0) >= hlevel) stack.pop();\n const label = h[2] ?? '';\n out.push({ line: i + 1, label, level: stack.length + 1, type: inferBlockType(label) });\n stack.push({ heading: true, hlevel, tag: '' });\n } else if (st?.open) {\n // An inline `<x>…</x>` is listed as a section but not pushed — it closes on its own line, nesting nothing.\n out.push({ line: i + 1, label: st.open, level: stack.length + 1, type: inferBlockType(st.open) });\n if (!st.inline) stack.push({ heading: false, hlevel: 0, tag: st.open });\n } else if (st?.close && stack.some((s) => !s.heading && s.tag.toLowerCase() === st.close)) {\n while (stack.length > 0) {\n const s = stack.pop();\n if (s && !s.heading && s.tag.toLowerCase() === st.close) break;\n }\n }\n });\n return out;\n}\n\n/** Register the TypeGlish language, theme, folding (blocks), and block-contract hovers.\n * Re-runnable: the tokenizer + theme are re-applied on every call so a grammar/highlighting edit\n * takes effect on the next editor mount, while the language and its folding/hover/completion\n * providers register exactly once. `alreadyRegistered` survives HMR — the monaco instance persists\n * in the page — so the providers never stack duplicates. */\nexport function setupMonaco(monaco: Monaco): void {\n const alreadyRegistered = monaco.languages\n .getLanguages()\n .some((l: Mon.languages.ILanguageExtensionPoint) => l.id === LANG_ID);\n if (!alreadyRegistered) {\n monaco.languages.register({ id: LANG_ID, extensions: [FILE_EXT], aliases: ['TypeGlish', 'tg'] });\n }\n\n // Indentation behavior — Monaco's half of the layout doctrine (the compiler's half is the\n // bad-indent pass; both read the same 2-space unit). Enter after a whole-line opening tag, a\n // deterministic chain arm left OPEN (`$IF …:` / `$ELSE IF …:` / `$ELSE:` with no inline body —\n // its block body sits one unit deeper), or a `$TOOL` / `$SERVICE` / `$TEST` opener indents one\n // unit; typing a whole-line closing tag outdents it back to its open's column. Same-line content\n // tags (`<a> text </a>`) never match — the first `>` ends the tag alternation, so the trailing\n // text fails the `$` anchor. Deliberately ABSENT: a generic \"indent after any line ending in\n // `:`\" — a prose lead-in (`Rotate between:`) takes bullets at the SAME column, and a chain arm\n // is $-led (a prose `IF the user asks:` is a lead-in, not an arm).\n // A trailing `// comment` never changes a line's structural reading, so every pattern tolerates one\n // (`<goals> // empty for now` still indents its interior on Enter).\n // Every language-configuration fact derives from the editor-config SSOT (core/editor-config.ts) —\n // the same source the VS Code language-configuration.json is GENERATED from, so no client can drift.\n const OPEN_TAG = new RegExp(OPEN_TAG_LINE_SRC, 'i');\n monaco.languages.setLanguageConfiguration(LANG_ID, {\n // `//` and `/* … */` — enables the editor's native toggle-comment on `.tg`.\n comments: { lineComment: COMMENT_SYNTAX.line, blockComment: COMMENT_SYNTAX.block },\n // NO colorized bracket pairs — the switch that actually disables bracket-pair colorization (the\n // editor option is unreliably honoured). Brackets are prose punctuation, pointer-token interiors,\n // or neutral definition-body text — never pairs to rainbow by nesting depth.\n colorizedBracketPairs: COLORIZED_BRACKET_PAIRS,\n indentationRules: {\n increaseIndentPattern: new RegExp(INDENT_OPENERS_SRC, 'i'),\n decreaseIndentPattern: new RegExp(CLOSE_TAG_LINE_SRC, 'i'),\n },\n onEnterRules: [\n {\n beforeText: OPEN_TAG,\n action: { indentAction: monaco.languages.IndentAction.Indent },\n },\n ],\n });\n\n // No Monarch tokenizer: TypeGlish highlighting comes ENTIRELY from the LSP's semantic tokens — the core\n // semanticTokens(), served through the worker and painted by the DocumentSemanticTokensProvider registered\n // below. This is the \"nothing hardcoded\" end state: the language's grammar lives in ONE place (the core), not\n // duplicated in a bespoke editor tokenizer the web — and every IDE — would each have to re-implement. The\n // theme's `rules` map each semantic token TYPE to a colour; there is one rule per type the tokenizer emits.\n // (Text paints a beat after load/edit — the worker round-trip — then never drifts from the compiler's view.)\n const theme: Mon.editor.IStandaloneThemeData = {\n base: 'vs-dark',\n inherit: true,\n // One rule per token type — DERIVED, never authored here: the classification (semantic-tokens.ts)\n // says how each type travels on the wire (`base.modifier`), the palette (editor-config.ts) says how\n // it paints. This file only assembles the two SSOTs, so the exact palette lands wherever our theme\n // is installed while a foreign editor's theme colours the standard bases natively.\n rules: SEM_TOKEN_TYPES.map((t) => {\n const c = TOKEN_CLASSIFICATION[t];\n const p = TOKEN_PALETTE[t];\n const fontStyle = [p.bold === true ? 'bold' : null, p.italic === true ? 'italic' : null, p.strikethrough === true ? 'strikethrough' : null]\n .filter((s): s is string => s !== null)\n .join(' ');\n return {\n token: c.modifier !== null ? `${c.base}.${c.modifier}` : c.base,\n ...(p.fg !== undefined ? { foreground: p.fg } : {}),\n ...(fontStyle !== '' ? { fontStyle } : {}),\n };\n }),\n // The chrome (surfaces, gutter, widgets) is editor-config's — the same table a VS Code theme\n // generator would read, so the playground and any generated theme can never disagree.\n colors: EDITOR_CHROME,\n };\n monaco.editor.defineTheme(THEME_ID, theme);\n\n // Tokenizer + theme above are idempotent (each call replaces the prior). The providers below attach\n // listeners, so register them only the first time — re-registering would stack duplicate hovers.\n if (alreadyRegistered) return;\n\n // Folding: a heading folds down to the next heading of equal-or-higher level; a nested list folds its\n // sub-items; a whole-line `<tag>` folds to its matching `</tag>`. Computed in the worker now (the SAME\n // foldingRanges() the stdio LSP serves), so every IDE folds a `.tg` identically — no editor-specific logic.\n monaco.languages.registerFoldingRangeProvider(LANG_ID, {\n async provideFoldingRanges(model: Mon.editor.ITextModel) {\n return await requestFoldingRanges(model.getValue());\n },\n });\n\n // Linked editing: with the caret in an XML section tag, the opening and closing tag NAMES are returned as a\n // linked pair, so Monaco mirrors an edit of one onto the other live (`<examples>` → `<samples>` renames\n // `</examples>` in lockstep). The pairing comes from the worker (linkedTagSpans, the SAME one the LSP's\n // linkedEditingRange serves); an unclosed tag has no partner and returns nothing.\n monaco.languages.registerLinkedEditingRangeProvider(LANG_ID, {\n async provideLinkedEditingRanges(model: Mon.editor.ITextModel, position: Mon.Position) {\n const spans = await requestLinkedEdit(model.getValue(), position.lineNumber - 1);\n if (!spans) return null;\n const toRange = (s: { line: number; start: number; end: number }): Mon.IRange =>\n new monaco.Range(s.line + 1, s.start + 1, s.line + 1, s.end + 1);\n return { ranges: [toRange(spans.open), toRange(spans.close)], wordPattern: /[a-z][a-z0-9_]*/i };\n },\n });\n\n // Document symbols: the section hierarchy (a `##` nests under its `#`, a nested <tag> under its parent).\n // Powers sticky scroll — as you scroll into a child, its parent headers pin to the top of the editor — and\n // go-to-symbol. The tree comes from the worker (the SAME outline() the LSP serves, off the main thread); this\n // adapter just maps each OutlineNode to Monaco's nested DocumentSymbol.\n monaco.languages.registerDocumentSymbolProvider(LANG_ID, {\n async provideDocumentSymbols(model: Mon.editor.ITextModel) {\n const lineCount = model.getLineCount();\n const toSymbol = (n: OutlineNode): Mon.languages.DocumentSymbol => {\n const start = Math.min(n.line + 1, lineCount);\n const end = Math.min(Math.max(n.endLine, start), lineCount);\n const display = n.name.startsWith('#') ? n.name.replace(/^#+\\s*/, '') : n.tag;\n return {\n name: display || n.tag,\n detail: '',\n kind: monaco.languages.SymbolKind.Namespace,\n tags: [],\n range: new monaco.Range(start, 1, end, model.getLineMaxColumn(end)),\n selectionRange: new monaco.Range(start, 1, start, model.getLineMaxColumn(start)),\n children: n.children.map(toSymbol),\n };\n };\n const nodes = await requestDocumentSymbols(model.getValue());\n return nodes.map(toSymbol);\n },\n });\n\n // Go-to-definition: a structural reference (step 11d, <closing>, @{var}, an imported tool/route) jumps to\n // its declaration. Cmd/Ctrl-Click and F12 both route here; the resolved graph comes from structure().\n monaco.languages.registerDefinitionProvider(LANG_ID, {\n async provideDefinition(model: Mon.editor.ITextModel, position: Mon.Position) {\n // Through the worker — the SAME definitionAt the LSP runs, so go-to-def is identical in the preview.\n const loc = await requestDefinition(model.getValue(), position.lineNumber - 1, position.column - 1);\n if (!loc) return null;\n const tl = loc.line + 1;\n return { uri: model.uri, range: new monaco.Range(tl, 1, tl, model.getLineMaxColumn(tl)) };\n },\n });\n\n // Hover a block header → its contract (what it does and does NOT do). Hover a statement → its\n // DOSSIER (residual, coverage, ablation Δ) when the app has one for that line.\n monaco.languages.registerHoverProvider(LANG_ID, {\n async provideHover(model: Mon.editor.ITextModel, position: Mon.Position) {\n const line = model.getLineContent(position.lineNumber);\n const profile = profileMarkdown(position.lineNumber - 1);\n // A block header → its contract, and a comment marker → its note: these are web/app-specific (the\n // BLOCK_TYPES catalog, the eval profile). Everything ELSE — a `$variable` domain, an object's value\n // record — comes from the worker (hoverAt), the SAME rich hover an IDE now gets. One source, no drift.\n const h = line.match(/^#{1,6}\\s+(.+?)\\s*$/);\n if (h) {\n const type = inferBlockType(h[1] ?? '');\n if (type) {\n const def = BLOCK_TYPES[type];\n return { contents: [{ value: `**${def.label} block**` }, { value: `**Does:** ${def.does}` }, { value: `**Doesn't:** ${def.doesNot}` }] };\n }\n return { contents: [{ value: '**Section**' }] };\n }\n if (/^\\s*\\/\\//.test(line) || /^\\s*\\/\\*/.test(line)) {\n return { contents: [{ value: 'Comment — never sent to the model.' }] };\n }\n const md = await requestHover(model.getValue(), position.lineNumber - 1, position.column - 1);\n if (md) return { contents: [{ value: md }, ...(profile ? [{ value: profile }] : [])] };\n if (profile) return { contents: [{ value: profile }] };\n return null;\n },\n });\n\n // Highlighting comes from the LSP now: a document semantic-tokens provider fed by the worker — the SAME core\n // tokenizer the stdio LSP serves. The theme rules above colour each token TYPE. It layers over the Monarch\n // base for now; as the core tokenizer reaches parity, the Monarch rules come out (the goal: nothing hardcoded).\n monaco.languages.registerDocumentSemanticTokensProvider(LANG_ID, {\n getLegend: () => ({ tokenTypes: [...SEM_LEGEND.tokenTypes], tokenModifiers: [...SEM_LEGEND.tokenModifiers] }),\n provideDocumentSemanticTokens: async (model: Mon.editor.ITextModel) => {\n const data = await requestSemanticTokens(model.getValue());\n return { data: new Uint32Array(data) };\n },\n releaseDocumentSemanticTokens: () => undefined,\n });\n\n // Completion teaches the format AND prevents dangling references. The structural contexts (a `<` offers\n // declared sections, `{`/`[` declared variables, `step ` defined ordinals, `IMPORT` a kind, a bare word an\n // imported tool) come from the pure, unit-tested completionsAt(); this adapter just maps kinds to Monaco's\n // and computes the replace-range. Failing those, the statement/block starters + IMPORT manifest at line start.\n const KIND: Record<CompletionKind, Mon.languages.CompletionItemKind> = {\n section: monaco.languages.CompletionItemKind.Module,\n variable: monaco.languages.CompletionItemKind.Variable,\n step: monaco.languages.CompletionItemKind.Reference,\n route: monaco.languages.CompletionItemKind.Reference,\n tool: monaco.languages.CompletionItemKind.Function,\n alias: monaco.languages.CompletionItemKind.Reference, // a `@@ name:` statement alias — a named pointer, like a step/route\n keyword: monaco.languages.CompletionItemKind.Keyword,\n };\n // Fill-in-the-blank inserts: an item whose text carries ${1:…} tab stops is flagged InsertAsSnippet so the\n // editor drops the template and steps the cursor through the blanks. (The enum is CompletionItemInsertTextRule\n // — singular; the plural name is not exported and resolves to undefined at runtime.)\n const SNIPPET = monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;\n monaco.languages.registerCompletionItemProvider(LANG_ID, {\n // The trigger set is the SHARED source of truth (COMPLETION_TRIGGERS) — the LSP uses the same list, so the\n // web preview and every IDE auto-open completions identically. Space/colon open the value pickers\n // (`$CONFIG modality ␣`, `$REQUIRE variable x:`); safe because completionsAt is context-gated (no rule → []).\n triggerCharacters: [...COMPLETION_TRIGGERS],\n async provideCompletionItems(model: Mon.editor.ITextModel, position: Mon.Position) {\n const before = model.getValueInRange({ startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column });\n\n // Through the worker-hosted language service — the SAME completionsAt the LSP runs, off the main thread.\n const struct = await requestCompletion(before, model.getValue(), position.lineNumber - 1, configSchemaCtx);\n return {\n suggestions: struct.map((c) => ({\n label: c.label,\n kind: KIND[c.kind],\n insertText: c.insert,\n detail: c.detail,\n range: new monaco.Range(position.lineNumber, position.column - c.replace, position.lineNumber, position.column),\n ...(c.snippet ? { insertTextRules: SNIPPET } : {}),\n })),\n };\n },\n });\n}\n","import { AUTO_CLOSE_TAG_SRC } from '../core/editor-config';\nimport { COMMAND_WORDS } from '../core/lexicon';\n\n// Only the COMMAND plane auto-cases as you type: the `$` sigil is an explicit machine-plane marker (no\n// English word starts with `$`), so recasing `$if ` → `$IF ` can never touch prose. Bare operator words\n// (IF, MUST, WHEN, …) are NEVER auto-cased — `If you need help, ask.` is ordinary prose (the plane is\n// declared at column one: `$IF` is the command, a bare `IF … THEN` is a statement the model weighs), case\n// never carries meaning anyway (SPEC §2), and a surprise edit under the caret costs more than the\n// canonical look. Sorted longest-first so `$ELSE IF` wins over `$ELSE`.\nconst COMMAND_FORMS: readonly string[] = [...COMMAND_WORDS].sort((a, b) => b.length - a.length);\n\n// A leading list marker: a bullet, or a dotted-decimal step (`1.`, `2.1.`, `2.1.3.`) at any depth. Peeling it\n// off is what lets an operator right after the marker (`2.1. if …`) be recognized + auto-cased like one after a\n// plain `1.`.\nconst MARKER_RE = /^(\\s*(?:[-*+]\\s+|\\d+(?:\\.\\d+)*[.)]\\s+)?)([\\s\\S]*)$/;\n\n/** Split a line into its [leading whitespace + list marker] prefix and the remaining clause. */\nexport function splitMarker(line: string): { prefix: string; clause: string } {\n const m = line.match(MARKER_RE);\n return { prefix: m?.[1] ?? '', clause: m?.[2] ?? line };\n}\n\n/** The next list item to open when Enter is pressed on `lineText` — or null when the line isn't a list item\n * (so a plain newline is inserted). `{ terminate: true }` means the current item is empty, so the list ends\n * (the caller clears the dangling marker). Otherwise `prefix` is the marker for the next line: a carried bullet\n * (`- `), or the step with its LAST dotted segment incremented — `2.` → `3.`, `2.1.` → `2.2.`, `2.1.3.` →\n * `2.1.4.` — so Enter continues the list at the same level, carrying the `.`/`)` delimiter and indent. */\nexport function nextListItem(lineText: string): { terminate: true } | { terminate: false; prefix: string } | null {\n const unordered = lineText.match(/^(\\s*)([-*+])\\s+(.*)$/);\n const step = lineText.match(/^(\\s*)(\\d+(?:\\.\\d+)*)([.)])\\s+(.*)$/); // `2.1. text` — a dotted step at any depth\n if (!unordered && !step) return null;\n const content = (unordered?.[3] ?? step?.[4]) ?? '';\n if (content.trim() === '') return { terminate: true };\n const indent = (unordered?.[1] ?? step?.[1]) ?? '';\n if (unordered) return { terminate: false, prefix: `${indent}${unordered[2] ?? '-'} ` };\n const segs = (step?.[2] ?? '0').split('.');\n segs[segs.length - 1] = String(Number(segs[segs.length - 1]) + 1);\n return { terminate: false, prefix: `${indent}${segs.join('.')}${step?.[3] ?? '.'} ` };\n}\n\n/** Tab / Shift-Tab nesting for a dotted step, to any depth. Tab (`outdent` = false) DEMOTES the step into a\n * child of its PREVIOUS SIBLING — with `1. / 2. / 3.`, Tab on `3.` makes it `2.1.` (the next child of 2); with\n * `2.1. / 2.2.`, Tab on `2.2.` makes it `2.1.1.`. Shift-Tab (`outdent` = true) PROMOTES the step to its parent's\n * next sibling — `2.1.` → `3.`, `2.1.1.` → `2.2.`. Returns the marker replacement `{ start, end, text }` as\n * 0-based columns on `line0` (the leading whitespace is left for the auto-indent to set), or null when there's\n * nothing to nest — a top step can't promote, and a first child (no previous sibling) can't demote. Pure — the\n * caller applies the edit; the delimiter is carried. */\nexport function nestStep(lines: string[], line0: number, outdent: boolean): { start: number; end: number; text: string } | null {\n const cur = (lines[line0] ?? '').match(/^(\\s*)(\\d+(?:\\.\\d+)*)([.)])(?:\\s.*)?$/);\n if (!cur) return null;\n const ord = cur[2] ?? '';\n const delim = cur[3] ?? '.';\n const segs = ord.split('.').map(Number);\n const start = (cur[1] ?? '').length;\n const end = start + ord.length + delim.length; // the \"<ord><delim>\" span\n\n if (outdent) {\n if (segs.length === 1) return null; // a top step is already at the top level\n const up = segs.slice(0, -1); // drop the last segment, then bump — becomes the parent's next sibling\n up[up.length - 1] = (up[up.length - 1] ?? 0) + 1;\n return { start, end, text: `${up.join('.')}${delim}` };\n }\n\n // Demote: find the nearest preceding step at THIS depth — the previous sibling — and become its next child.\n const depth = segs.length;\n let parent: string | null = null;\n for (let i = line0 - 1; i >= 0; i -= 1) {\n const t = (lines[i] ?? '').trim();\n if (/^#{1,6}\\s/.test(t)) return null; // a heading bounds the section — no sibling above\n const m = t.match(/^(\\d+(?:\\.\\d+)*)[.)]\\s/);\n if (!m) continue;\n const d = (m[1] ?? '').split('.').length;\n if (d === depth) { parent = m[1] ?? ''; break; }\n if (d < depth) return null; // a shallower step first → no previous sibling at this depth (a first child)\n }\n if (parent === null) return null;\n const childRe = new RegExp(`^${parent.replace(/\\./g, '\\\\.')}\\\\.\\\\d+[.)]\\\\s`);\n let kids = 0;\n for (let i = line0 - 1; i >= 0; i -= 1) {\n const t = (lines[i] ?? '').trim();\n if (/^#{1,6}\\s/.test(t)) break;\n if (childRe.test(t)) kids += 1;\n }\n return { start, end, text: `${parent}.${kids + 1}${delim}` };\n}\n\n/**\n * If `clause` begins (case-insensitively, on a word boundary) with a `$`-command, return how many\n * characters the command spans (sigil included) and the canonical UPPERCASE form — else null. Two-word\n * commands re-match as they grow: `$else` → `$ELSE`, then `$else if` → `$ELSE IF` recases the second\n * word too. Anchored at the start and gated on the sigil, so prose can never match.\n */\nexport function matchLeadingCommand(clause: string): { len: number; upper: string } | null {\n if (!clause.startsWith('$')) return null;\n const body = clause.slice(1);\n for (const word of COMMAND_FORMS) {\n if (body.length < word.length) continue;\n if (body.slice(0, word.length).toUpperCase() !== word) continue;\n const next = body[word.length];\n if (next === undefined || /\\s/.test(next) || next === ':') return { len: word.length + 1, upper: `$${word}` };\n }\n return null;\n}\n\n/** The nearest block heading above line `idx` (0-based, exclusive), '' if there is none. */\nexport function enclosingBlock(lines: string[], idx: number): string {\n for (let i = Math.min(idx, lines.length) - 1; i >= 0; i -= 1) {\n const m = (lines[i] ?? '').match(/^#{1,6}\\s+(.+?)\\s*$/);\n if (m) return m[1] ?? '';\n }\n return '';\n}\n\n/** Decide whether a just-typed `>` completed a whole-line opening section tag that should auto-close — the\n * TypeGlish take on the `<div>` → `</div>` affordance every HTML/JSX editor has — and if so, the tag NAME.\n * `head` is the line up to the caret, `tail` the rest. Returns the name only when the caret sits exactly after\n * the `>` of a bare `<name>` filling the whole line; a closing tag (`</x>`), a self-closing tag (`<br/>`), an\n * inline tag mid-prose (text before the `<` or after the caret), and any non-tag line all return null. Pure —\n * the caller places the block at the section's structural indent (so a nested tag doesn't reflow after the\n * fact) and preserves the name's case, so `<Foo>` pairs with `</Foo>`. */\nexport function autoCloseSectionTag(head: string, tail: string): { tag: string } | null {\n if (tail.trim() !== '') return null; // content after the caret → this isn't a whole-line section open\n // Capture a compile sigil too (`<?example>` → `</?example>`, `<$config>` → `</$config>`, `<\"ref\">` → `</\"ref\">`),\n // so the auto-closed partner carries the same sigil — a mismatched `</example>` would otherwise read as an\n // unclosed/stray pair. The tag shape comes from the editor-config SSOT.\n const m = head.match(new RegExp(AUTO_CLOSE_TAG_SRC, 'i')); // the caret is exactly past the `>` of `<name>`\n return m ? { tag: m[1] ?? '' } : null;\n}\n","import type * as Mon from 'monaco-editor';\n\nimport { lineOrdinals } from '../core/clause';\nimport { CLOSE_TAG_LINE_SRC, INDENT_UNIT } from '../core/editor-config';\nimport { type CompileOptions, compile } from '../core/compile';\nimport { isProseBlock } from '../core/grammar';\nimport { layoutColumns } from '../core/layout';\nimport { renumberSubSteps, structure } from '../core/structure';\nimport { FILE_EXT, LANG_ID, THEME_ID, setupMonaco } from '../web/monaco-setup';\nimport { autoCloseSectionTag, enclosingBlock, matchLeadingCommand, nestStep, nextListItem, splitMarker } from '../web/operators';\n\n// ── @typeglish/monaco ─────────────────────────────────────────────────────────────────────────────────\n// The Monaco integration for the TypeGlish (`.tg`) language. Any product embedding Monaco gets the full\n// editor experience — syntax highlighting, the object-record hover, completion, live consistency squiggles,\n// object-reference highlighting, and list/operator authoring — in two calls:\n//\n// import { setupTypeGlish, attachTypeGlish } from 'typeglish/monaco';\n// import 'typeglish/monaco.css';\n// setupTypeGlish(monaco); // once per monaco instance\n// const editor = monaco.editor.create(el, { language: 'typeglish', theme: 'typeglish-dark' });\n// attachTypeGlish(monaco, editor); // per editor → squiggles, highlights, authoring\n//\n// All the rules live in the framework-agnostic core (`compile()`); this module only wires them to Monaco's\n// APIs (Monarch tokenizer, hover/completion providers, model markers, editor decorations).\n\ntype MonacoApi = typeof import('monaco-editor');\ntype CodeEditor = Mon.editor.IStandaloneCodeEditor;\n\nexport { FILE_EXT, LANG_ID, THEME_ID };\nexport { compile } from '../core/compile';\n\nexport interface AttachOptions {\n /** Compute diagnostics on every edit and show them as squiggles (default true). Turn off to drive\n * markers yourself, e.g. when you compile with extra options elsewhere. */\n diagnostics?: boolean;\n /** Extra compile options (e.g. an eval rubric) for the auto-diagnostics pass. */\n compileOptions?: CompileOptions;\n /** List auto-continue (Enter/Tab) and leading-operator UPPERCASING as you type (default true). */\n authoring?: boolean;\n /** Render the structural program view — reference styling (default true). */\n structure?: boolean;\n /** Structural authoring aids as you type (default true): a new line snaps to its indent the moment its marker\n * is completed (`2.1. ` / `## `) — once, a suggestion, so backspace/dedent stick afterward (Python-IDE feel, not\n * a forced reformat) — AND sub-steps are renumbered to close gaps after a delete (`1A 1C` → `1A 1B`), with\n * label references rewritten to follow. Both are cosmetic to the compiler, which strips indentation. */\n autoIndent?: boolean;\n /** Number ONLY content lines — blank lines get an empty gutter (default). Set true to number every line the\n * way a plain code editor does. The host must not also pass a `lineNumbers` option, which would override this. */\n numberBlankLines?: boolean;\n}\n\n/** Register the `.tg` language, its Monarch tokenizer + dark theme, the object-record hover, and completion\n * on a Monaco instance. Idempotent and safe to call once at startup. */\nexport function setupTypeGlish(monaco: MonacoApi): void {\n setupMonaco(monaco);\n}\n\n/** Recompute and apply TypeGlish diagnostics (consistency errors, clarity warnings) as model markers. */\nexport function applyDiagnostics(monaco: MonacoApi, model: Mon.editor.ITextModel, compileOptions?: CompileOptions): void {\n const sev = monaco.MarkerSeverity;\n monaco.editor.setModelMarkers(\n model,\n LANG_ID,\n compile(model.getValue(), compileOptions).diagnostics.map((d) => ({\n startLineNumber: d.line + 1,\n startColumn: d.start + 1,\n endLineNumber: d.line + 1,\n endColumn: d.end + 1,\n message: d.message,\n source: d.source,\n severity: d.severity === 'error' ? sev.Error : d.severity === 'warn' ? sev.Warning : sev.Info,\n })),\n );\n}\n\n/** Wire an editor for TypeGlish: live diagnostics, object-reference highlighting, and (optional) authoring\n * behaviors. Returns a disposable that removes every listener + decoration. */\nexport function attachTypeGlish(monaco: MonacoApi, editor: CodeEditor, opts: AttachOptions = {}): { dispose(): void } {\n const subs: Mon.IDisposable[] = [];\n const structDecos = editor.createDecorationsCollection([]);\n\n // Number only CONTENT lines: blanks AND `@@` statement annotations DON'T consume a number (an annotation is\n // authoring metadata that compiles to nothing, like a blank). The gutter counts the Nth content line, so\n // `# Role / (blank) / You are a bot.` reads 1 / (blank) / 2 — not 1 / (blank) / 3. So the display number is the\n // content-line ORDINAL, recomputed on edit. Re-applying the option forces a full gutter re-render (the ordinals\n // shift for every line below an edit), but we only do it when the blank/content PATTERN actually changes, so\n // typing within a line is free. Driven by the option (not a decoration) so a re-render can't reset it — the host\n // must NOT also pass `lineNumbers` (a partial updateOptions won't clobber this one).\n if (opts.numberBlankLines !== true) {\n let ordinalKey = '';\n const applyLineOrdinals = (): void => {\n const model = editor.getModel();\n if (!model) return;\n // ONE rule, owned by core (clause.ts lineOrdinals): blanks and `@@` annotations take no number.\n // Every diagnostic message and panel label maps through the same function, so a \"line 12\" in a\n // tooltip is always the 12 this gutter shows.\n const ords = lineOrdinals(model.getLinesContent());\n const ordinals: string[] = ['', ...ords.map((o) => (o === null ? '' : String(o)))]; // 1-based; index 0 unused\n const key = ords.map((o) => (o === null ? '0' : '1')).join('');\n if (key === ordinalKey) return; // same blank/content pattern → same ordinals → nothing to re-render\n ordinalKey = key;\n editor.updateOptions({ lineNumbers: (n: number): string => ordinals[n] ?? '' });\n };\n applyLineOrdinals();\n subs.push(editor.onDidChangeModelContent(applyLineOrdinals));\n }\n\n const refresh = (): void => {\n const model = editor.getModel();\n if (!model) return;\n // Definition-row and tool-body styling is SEMANTIC TOKENS now (core semantic-tokens.ts: 'defterm' /\n // 'defbody' / 'toolkey' / 'toolval') — served through the LSP so every editor renders it, never a\n // Monaco-only decoration. What remains here is the one thing tokens cannot express: REFERENCE\n // affordances (link vs dangling), which pair with go-to-definition. (The old tg-object decoration\n // was dead CSS — Monaco's generated .mtk rules out-cascaded it — and is removed, not ported.)\n if (opts.structure !== false) {\n const s = structure(model.getValue());\n const decos: Mon.editor.IModelDeltaDecoration[] = [];\n // References: a pointer to a declaration — resolved reads as a link, a dangling one squiggles.\n for (const r of s.references) {\n const cls = r.targetId ? 'tg-ref' : 'tg-ref-dangling';\n decos.push({ range: new monaco.Range(r.loc.line + 1, r.loc.start + 1, r.loc.line + 1, r.loc.end + 1), options: { inlineClassName: cls } });\n }\n structDecos.set(decos);\n }\n if (opts.diagnostics !== false) applyDiagnostics(monaco, model, opts.compileOptions);\n };\n refresh();\n // Debounce the reference-decoration recompute. Recomputing reference links across the WHOLE document on\n // every keystroke is a big per-keystroke cost on a large file; the affordance is advisory, so running it\n // ~150ms after typing settles is invisible and keeps typing snappy.\n let refreshTimer: ReturnType<typeof setTimeout> | undefined;\n subs.push(\n editor.onDidChangeModelContent(() => {\n if (refreshTimer !== undefined) clearTimeout(refreshTimer);\n refreshTimer = setTimeout(refresh, 150);\n }),\n );\n subs.push({\n dispose: () => {\n if (refreshTimer !== undefined) clearTimeout(refreshTimer);\n },\n });\n\n if (opts.authoring !== false) {\n // Renaming an opening section tag mirrors to its closing tag (and vice versa) in lockstep — the pair-rename\n // every HTML/JSX editor does. The matching ranges come from the LinkedEditingRangeProvider (setupMonaco);\n // this option is what turns the live mirroring on.\n // autoIndent 'full' (not the 'advanced' default) applies the language's indentationRules on TYPE\n // too — a hand-typed `</voice>` outdents to its open's column the moment the `>` lands, not only\n // on the next Enter.\n // Bracket-pair colorization: the EFFECTIVE off-switch is the language configuration's\n // `colorizedBracketPairs: []` (setupMonaco) — per-language, so every editor hosting `.tg` inherits\n // it. Brackets in TypeGlish are prose punctuation, part of a single pointer token (`@{x}` / `@[x]`),\n // or neutral definition-body text — never pairs to rainbow by nesting depth. The editor option below\n // is defence-in-depth only (Monaco ignores it in the bundled version); the VS Code equivalent is\n // `\"colorizedBracketPairs\": []` in a language-configuration.json.\n editor.updateOptions({ linkedEditing: true, autoIndent: 'full', bracketPairColorization: { enabled: false } });\n // The indent unit is the LANGUAGE'S (2 spaces, layout doctrine), never Monaco's default (4) or a\n // content guess (detectIndentation) — pin it on every model this editor hosts, so Tab, Enter, and\n // every auto-indent land on columns the compiler accepts.\n const pinIndentUnit = (): void => {\n editor.getModel()?.updateOptions({ tabSize: INDENT_UNIT, insertSpaces: true });\n };\n pinIndentUnit();\n subs.push(editor.onDidChangeModel(pinIndentUnit));\n subs.push(\n editor.onKeyDown((e) => {\n if (e.keyCode === monaco.KeyCode.Enter && !e.shiftKey && !e.altKey) {\n if (handleListEnter(monaco, editor)) {\n e.preventDefault();\n e.stopPropagation();\n }\n } else if (e.keyCode === monaco.KeyCode.Tab) {\n if (handleListTab(monaco, editor, e.shiftKey)) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n }),\n );\n // Auto-close a section tag: finishing a whole-line `<examples>` drops a matching `</examples>` below, caret\n // between them — the `<div>`→`</div>` affordance, shaped for TypeGlish's whole-line blocks. Detected off the\n // typed `>` in the content change (handleTagClose no-ops on any other edit, incl. its own multi-line insert).\n // The same typed `>` completing a whole-line CLOSING tag snaps that line to its open's column — the\n // outdent Monaco's indentationRules only apply on Enter, driven by the same layout engine as the checker.\n subs.push(\n editor.onDidChangeModelContent((ev) => {\n if (ev.changes.length === 1 && ev.changes[0]) {\n handleTagClose(monaco, editor, ev.changes[0]);\n handleCloseTagOutdent(monaco, editor, ev.changes[0]);\n }\n }),\n );\n let recasing = false;\n subs.push(\n editor.onDidChangeModelContent((ev) => {\n if (recasing || ev.changes.length !== 1) return;\n const change = ev.changes[0];\n if (!change) return;\n recasing = true;\n try {\n autoUppercaseCommand(monaco, editor, change);\n } finally {\n recasing = false;\n }\n }),\n );\n }\n\n // Indent-on-creation, not a forced reformat. The moment a list/heading marker is completed (`2.1. `, `## `), its\n // line snaps to its structural depth — but only that once. Afterward the whitespace is the writer's: backspace,\n // dedent, and Shift-Tab all stick, the Python-IDE feel. Separately, closing sub-step gaps after a delete\n // (`1A 1C` → `1A 1B`) stays debounced. Nothing continuously re-aligns whitespace, so editing never fights back.\n if (opts.autoIndent !== false) {\n let renumberTimer: ReturnType<typeof setTimeout> | undefined;\n let renumbering = false;\n const scheduleRenumber = (): void => {\n if (renumbering) return;\n if (renumberTimer) clearTimeout(renumberTimer);\n renumberTimer = setTimeout(() => {\n renumbering = true;\n try {\n applyRenumber(monaco, editor);\n } finally {\n renumbering = false;\n }\n }, 120);\n };\n subs.push(\n editor.onDidChangeModelContent((ev) => {\n const ch = ev.changes.length === 1 ? ev.changes[0] : undefined;\n if (ch && completesMarker(monaco, editor, ch)) indentNewLine(monaco, editor, ch.range.startLineNumber);\n // A line snaps to its engine column the moment it is BORN as content: the first non-space\n // text landing on a whitespace-only line re-indents that line to the layout engine's column\n // (and drops any whitespace residue after it). This is what makes the doctrine effortless in\n // the messy real flows — backspacing the auto-close body line, clicking into a stale blank,\n // pasting a statement at column 0 — the newborn line lands where the compiler expects, ONCE,\n // and afterwards its whitespace is the writer's (the same one-shot contract as indentNewLine).\n if (ch) snapNewbornContent(monaco, editor, ch);\n scheduleRenumber();\n }),\n );\n // The residue reaper: leaving a line that is whitespace-ONLY clears it. Abandoned auto-close\n // body lines (and any stray indent) would otherwise sit as trailing-space compile errors — a\n // whitespace-only line is never meaningful in TypeGlish, so reaping it is pure doctrine.\n let lastLine = editor.getPosition()?.lineNumber ?? 1;\n subs.push(\n editor.onDidChangeCursorPosition((e) => {\n const departed = lastLine;\n lastLine = e.position.lineNumber;\n if (departed === e.position.lineNumber) return;\n const model = editor.getModel();\n if (!model || departed < 1 || departed > model.getLineCount()) return;\n const text = model.getLineContent(departed);\n if (text.length > 0 && text.trim() === '') {\n editor.executeEdits('tg-reap-whitespace', [\n { range: new monaco.Range(departed, 1, departed, text.length + 1), text: '' },\n ]);\n }\n }),\n );\n }\n\n return {\n dispose(): void {\n for (const s of subs) s.dispose();\n structDecos.clear();\n },\n };\n}\n\n// ── Authoring behaviors (kept here so the whole editor experience ships with the library) ──────────────\n\n/** Reorder sub-steps after an edit settles: delete `1B` from `1A 1B 1C` and the rest close the gap to\n * `1A 1B`, with label-based `step 1c` references rewritten to follow. Surgical per-line edits (only the\n * changed marker letter / ref ord, via a common prefix+suffix diff), so an already-sequential list is a\n * no-op and the cursor stays put. `#greet` anchor references carry no number, so they're never touched. */\nfunction applyRenumber(monaco: MonacoApi, editor: CodeEditor): void {\n const model = editor.getModel();\n if (!model) return;\n const oldLines = model.getValue().split('\\n');\n const newLines = renumberSubSteps(oldLines);\n if (newLines === oldLines) return; // same reference → nothing to renumber\n const edits: Mon.editor.IIdentifiedSingleEditOperation[] = [];\n for (let i = 0; i < oldLines.length; i += 1) {\n const a = oldLines[i] ?? '';\n const b = newLines[i] ?? '';\n if (a === b) continue;\n let p = 0;\n while (p < a.length && p < b.length && a[p] === b[p]) p += 1;\n let s = 0;\n while (s < a.length - p && s < b.length - p && a[a.length - 1 - s] === b[b.length - 1 - s]) s += 1;\n edits.push({ range: new monaco.Range(i + 1, p + 1, i + 1, a.length - s + 1), text: b.slice(p, b.length - s) });\n }\n if (edits.length > 0) editor.executeEdits('tg-renumber', edits);\n}\n\n/** Set ONE line's leading whitespace to its structural depth — the one-time indent applied the moment a line is\n * created (a marker completed, a step demoted). Deliberately NOT a continuous reformat: once the line is placed,\n * its whitespace is the writer's to change — backspace, dedent, and Shift-Tab all stick, the way a Python IDE\n * indents a new block but never fights you afterward. A `##` body sits one tab in from a `#` body, a sub-step\n * one in from its step; the compiler strips it all, so this is pure readability. No-op on the caret line if it's\n * already at depth, or inside a ``` / ~~~ fence. */\nfunction indentNewLine(monaco: MonacoApi, editor: CodeEditor, lineNumber: number): void {\n const model = editor.getModel();\n if (!model || lineNumber < 1 || lineNumber > model.getLineCount()) return;\n const text = model.getLineContent(lineNumber);\n const trimmed = text.trim();\n if (trimmed === '') return;\n // Respect fenced code — a marker-looking line inside ``` is content, not structure.\n let inFence = false;\n for (let i = 1; i < lineNumber; i += 1) {\n const t = model.getLineContent(i).trim();\n if (t.startsWith('```') || t.startsWith('~~~')) inFence = !inFence;\n }\n if (inFence) return;\n // A just-created marker usually has no body yet (`2A.` from a Tab-demote, a fresh `## `), and the parsers only\n // count a line as a step/heading once it has `marker + space + content` — so measure the column against a copy\n // where a content-less marker carries a placeholder body, then indent the REAL (still-empty) line to it.\n // The column comes from the LAYOUT ENGINE — the same layoutColumns the compiler's bad-indent pass reads —\n // so the snap can never place a line the checker then flags (headings add no depth, a bullet sits at its\n // SECTION's column, content one unit inside its tag).\n const lines = model.getValue().split('\\n');\n if (/^\\s*(?:#{1,6}|\\d+(?:\\.\\d+)*[.)]|[-*+])\\s*$/i.test(text)) lines[lineNumber - 1] = `${text.replace(/\\s+$/, '')} x`;\n const target = layoutColumns(lines).col[lineNumber - 1];\n if (target === null || target === undefined) return; // a free line (fence, zone, body) is the writer's\n const current = text.length - text.trimStart().length;\n if (current !== target) editor.executeEdits('tg-indent-line', [{ range: new monaco.Range(lineNumber, 1, lineNumber, current + 1), text: ' '.repeat(target) }]);\n}\n\n/** Drop a matching closing tag below a just-completed whole-line opening section tag, caret on the body line\n * between them. Fires only when the edit is a lone typed `>` that completes a bare `<name>` filling the line —\n * so a closing/self-closing/inline tag, a paste, and the handler's own multi-line insert are all left alone.\n *\n * The whole block (open, body, close) is laid down at the section's STRUCTURAL indent — the depth it will\n * settle at once closed — not at the caret's current (shallower) indent. That's what keeps a NESTED tag from\n * reflowing a beat later: at the top level the depth is 0 so nothing moves, but inside another section the\n * open would otherwise land at the parent's indent and jump inward when the auto-indent caught up. One undo\n * stop reverts the whole affordance back to what the user typed. */\nfunction handleTagClose(monaco: MonacoApi, editor: CodeEditor, change: Mon.editor.IModelContentChange): void {\n if (change.text !== '>' || change.rangeLength !== 0) return;\n const model = editor.getModel();\n if (!model) return;\n const ln = change.range.startLineNumber;\n const caretCol = change.range.startColumn + 1; // one past the just-inserted `>`\n const line = model.getLineContent(ln);\n const close = autoCloseSectionTag(line.slice(0, caretCol - 1), line.slice(caretCol - 1));\n if (!close) return;\n // Columns come from the LAYOUT ENGINE, computed against the balanced block (open, body, close) the\n // edit is about to create: the tags land at the section's column and the caret line lands one unit\n // DEEPER — exactly what the compiler's bad-indent pass will demand of the content typed there.\n const hypothetical = model.getLinesContent().slice();\n hypothetical.splice(ln - 1, 1, `<${close.tag}>`, '', `</${close.tag}>`);\n const tagIndent = layoutColumns(hypothetical).col[ln - 1] ?? 0;\n const indent = ' '.repeat(tagIndent);\n const body = ' '.repeat(tagIndent + 2);\n const block = `${indent}<${close.tag}>\\n${body}\\n${indent}</${close.tag}>`;\n editor.executeEdits(\n 'tg-tag-close',\n [{ range: new monaco.Range(ln, 1, ln, model.getLineMaxColumn(ln)), text: block }],\n [new monaco.Selection(ln + 1, body.length + 1, ln + 1, body.length + 1)],\n );\n}\n\n/** Snap a line to its layout-engine column at the moment it becomes CONTENT: a single-line, non-space\n * insertion onto a line that held only whitespace re-indents that line (and strips residue after the\n * text). One-shot — an established content line is never touched, so editing doesn't fight back. */\nfunction snapNewbornContent(monaco: MonacoApi, editor: CodeEditor, change: Mon.editor.IModelContentChange): void {\n // Pure INSERTS only: the newborn reconstruction below strips the inserted text and checks that nothing\n // else was on the line — for a REPLACE (rangeLength > 0) that math lies. The auto-uppercase recase\n // (`$if` → `$IF`) is exactly such a replace: reconstructing left only the just-typed space, the line was\n // judged newborn, and the snap's `trim()` ate the space while parking the caret at the body end — every\n // following keystroke then fused into the word (`$IFx`).\n if (change.rangeLength !== 0) return;\n if (change.text === '' || change.text.includes('\\n') || change.text.trim() === '') return;\n const model = editor.getModel();\n if (!model) return;\n const ln = change.range.startLineNumber;\n if (change.range.endLineNumber !== ln || ln > model.getLineCount()) return;\n const line = model.getLineContent(ln);\n // Reconstruct the line as it was BEFORE the insert: newborn iff it held only whitespace.\n const before = line.slice(0, change.range.startColumn - 1) + line.slice(change.range.startColumn - 1 + change.text.length);\n if (before.trim() !== '') return;\n const lines = model.getLinesContent();\n const target = layoutColumns(lines).col[ln - 1];\n if (target === null || target === undefined) return;\n const body = line.trim();\n const current = line.length - line.trimStart().length;\n const trailing = line.length - line.trimEnd().length;\n if (current === target && trailing === 0) return;\n const caret = editor.getPosition();\n const caretOffsetInBody = caret && caret.lineNumber === ln ? Math.max(0, caret.column - 1 - current) : body.length;\n editor.executeEdits(\n 'tg-newborn-indent',\n [{ range: new monaco.Range(ln, 1, ln, line.length + 1), text: ' '.repeat(target) + body }],\n [new monaco.Selection(ln, target + caretOffsetInBody + 1, ln, target + caretOffsetInBody + 1)],\n );\n}\n\n/** Snap a just-completed whole-line CLOSING tag to its open's column. Fires on the lone typed `>` that\n * finishes `</name>` filling the line; the column comes from the layout engine (the checker's own), so\n * the outdent lands exactly where bad-indent expects it. One no-op when already placed. */\nfunction handleCloseTagOutdent(monaco: MonacoApi, editor: CodeEditor, change: Mon.editor.IModelContentChange): void {\n if (change.text !== '>' || change.rangeLength !== 0) return;\n const model = editor.getModel();\n if (!model) return;\n const ln = change.range.startLineNumber;\n const line = model.getLineContent(ln);\n if (!new RegExp(CLOSE_TAG_LINE_SRC, 'i').test(line)) return; // the editor-config SSOT's close-tag shape\n const target = layoutColumns(model.getLinesContent()).col[ln - 1];\n if (target === null || target === undefined) return;\n const current = line.length - line.trimStart().length;\n if (current === target) return;\n editor.executeEdits('tg-close-outdent', [\n { range: new monaco.Range(ln, 1, ln, current + 1), text: ' '.repeat(target) },\n ]);\n}\n\n/** True when `change` is the space that just completed a bare list/heading marker at the line start — `2A.`,\n * `1)`, `-`, `(a)`, `##` — i.e. the moment a line first becomes a step/heading and should snap to its indent. */\nfunction completesMarker(monaco: MonacoApi, editor: CodeEditor, change: Mon.editor.IModelContentChange): boolean {\n if (change.text !== ' ' || change.rangeLength !== 0) return false;\n const model = editor.getModel();\n if (!model) return false;\n const ln = change.range.startLineNumber;\n const head = model.getValueInRange(new monaco.Range(ln, 1, ln, change.range.startColumn));\n return /^\\s*(?:#{1,6}|\\d+(?:\\.\\d+)*[.)]|[-*+])$/i.test(head);\n}\n\n/** Continue a list on Enter: carry an unordered marker, increment an ordered one, exit on an empty item. */\nfunction handleListEnter(monaco: MonacoApi, editor: CodeEditor): boolean {\n const model = editor.getModel();\n const pos = editor.getPosition();\n const sel = editor.getSelection();\n if (!model || !pos || !sel) return false;\n const lineNumber = pos.lineNumber;\n const lineText = model.getLineContent(lineNumber);\n const next = nextListItem(lineText);\n if (!next) return false;\n if (next.terminate) {\n // An empty item ends the list — clear the dangling marker instead of carrying it.\n editor.executeEdits('list', [{ range: new monaco.Range(lineNumber, 1, lineNumber, lineText.length + 1), text: '' }]);\n return true;\n }\n editor.executeEdits('list', [{ range: sel, text: `\\n${next.prefix}` }]);\n return true;\n}\n\n/** Tab / Shift-Tab on a list line. On a NUMBERED step it changes the level by rewriting the marker: Tab\n * demotes a top step to a sub-step of the major above (`3.` → `2A.`), Shift-Tab promotes a sub back up, and the\n * whitespace snaps to match immediately. On a BULLET it just nudges the leading whitespace by one step. */\nfunction handleListTab(monaco: MonacoApi, editor: CodeEditor, outdent: boolean): boolean {\n const model = editor.getModel();\n const pos = editor.getPosition();\n const sel = editor.getSelection();\n if (!model || !pos || (sel && !sel.isEmpty())) return false;\n const lineNumber = pos.lineNumber;\n const lineText = model.getLineContent(lineNumber);\n\n // Numbered step: demote/promote by rewriting the marker, then reindent right away so the level change is\n // visible on the keystroke instead of jumping into place after the debounce.\n const nest = nestStep(model.getLinesContent(), lineNumber - 1, outdent);\n if (nest) {\n editor.executeEdits('list-nest', [{ range: new monaco.Range(lineNumber, nest.start + 1, lineNumber, nest.end + 1), text: nest.text }]);\n indentNewLine(monaco, editor, lineNumber);\n return true;\n }\n // A numbered step with no move (a sub can't demote, a top can't promote) still swallows Tab — no literal tab.\n if (/^\\s*\\d+(?:\\.\\d+)*[.)]\\s/.test(lineText)) return true;\n\n if (!/^\\s*[-*+]\\s/.test(lineText)) return false;\n if (outdent) {\n const lead = lineText.length - lineText.trimStart().length;\n const remove = Math.min(2, lead);\n if (remove > 0) {\n editor.executeEdits('list-tab', [{ range: new monaco.Range(lineNumber, 1, lineNumber, remove + 1), text: '' }]);\n editor.setPosition({ lineNumber, column: Math.max(1, pos.column - remove) });\n }\n return true;\n }\n editor.executeEdits('list-tab', [{ range: new monaco.Range(lineNumber, 1, lineNumber, 1), text: ' ' }]);\n editor.setPosition({ lineNumber, column: pos.column + 2 });\n return true;\n}\n\n/** Recase a freshly-typed `$`-COMMAND to its canonical UPPERCASE (`$if ` → `$IF `) outside prose blocks.\n * Commands are the ONLY plane that auto-cases: the `$` sigil is an explicit machine-plane marker, so the\n * recase can never touch prose. Bare operator words are deliberately left alone — `If you need help, ask.`\n * is a statement the model weighs (a bare `IF … THEN` is not the `$IF` command), and case never carries\n * meaning (SPEC §2). The recase is a same-length replace strictly before the caret, so the caret stays\n * put on its own. (The historical `If ` → `IFyou…` fusion was NOT this edit moving the caret — it was\n * snapNewbornContent misreading the recase's replace as a newborn insert and trimming the line; that\n * handler now ignores replaces.) */\nfunction autoUppercaseCommand(monaco: MonacoApi, editor: CodeEditor, change: Mon.editor.IModelContentChange): void {\n if (change.text !== ' ' || change.rangeLength !== 0) return;\n const model = editor.getModel();\n if (!model) return;\n const ln = change.range.startLineNumber;\n const head = model.getValueInRange(new monaco.Range(ln, 1, ln, change.range.startColumn));\n const { prefix, clause } = splitMarker(head);\n const hit = matchLeadingCommand(clause);\n if (!hit || clause.slice(0, hit.len) === hit.upper) return;\n if (isProseBlock(enclosingBlock(model.getLinesContent(), ln - 1))) return;\n const startColumn = prefix.length + 1;\n editor.executeEdits('auto-uppercase', [{ range: new monaco.Range(ln, startColumn, ln, startColumn + hit.len), text: hit.upper }]);\n}\n"]}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { A as AgentBundle, B as Bag, C as CompileOptions, a as CompileResult, E as Expr, H as HttpMethod, I as IR, b as IRNode, P as ParamType, c as PreparedTemplate, R as ResolvedModel, T as ToolBinding, d as ToolDef, e as ToolParam, f as compile, g as evalExpr, h as exprAtoms, n as numericDiagnostics, p as parseExpr, i as parseTools, j as prepareTemplate, s as structuralDiagnostics, t as toolInputSchema } from './compile-DViQS2oG.js';
|
|
2
|
+
import { S as StrictnessPolicy, R as ReportCompileOptions, T as TgReport } from './index-Df_QnTgq.js';
|
|
3
|
+
export { A as AtomCoverage, E as EditResult, I as Importance, L as LineAudit, O as OverlapRelation, P as PairVerdict, a as ProgramSummary, b as ReductionStep, c as ReportDiagnostic, d as ReportRange, e as SemanticAtom, f as SemanticReport, g as assembleAudits, h as atLeastImportant, i as buildReport, j as candidatePairs, k as classifyPair, l as compileToXml, m as decompose, n as importanceOf, p as proposeReduction, r as rename, o as report, q as resolve, s as semanticDiagnostics, v as verdictFrom } from './index-Df_QnTgq.js';
|
|
4
|
+
export { D as Diagnostic, R as RubricDim, S as Severity, a as SpellChecker, b as applyFix, c as composeSpans, r as runDiagnostics } from './diagnostics-BWJ_oMd8.js';
|
|
5
|
+
|
|
6
|
+
/** Thrown when the optional `z3-solver` peer isn't installed — the one failure a caller may degrade on. */
|
|
7
|
+
declare class MissingSolverError extends Error {
|
|
8
|
+
constructor(cause: unknown);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The complete TypeGlish check in one `await`: the synchronous compiler PLUS the Z3 solver
|
|
12
|
+
* (predicate-chain exhaustiveness + numeric conflicts), folded into the same {@link TgReport}. Requires the
|
|
13
|
+
* optional peer `z3-solver`; throws {@link MissingSolverError} if it isn't installed. Any other solver
|
|
14
|
+
* failure propagates as-is — do not degrade on it.
|
|
15
|
+
*/
|
|
16
|
+
declare function reportFull(source: string, opts?: {
|
|
17
|
+
policy?: StrictnessPolicy;
|
|
18
|
+
compile?: ReportCompileOptions;
|
|
19
|
+
}): Promise<TgReport>;
|
|
20
|
+
|
|
21
|
+
export { MissingSolverError, StrictnessPolicy, TgReport, reportFull };
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './chunk-PXAMTGYY.js';
|
|
2
|
+
export { MissingSolverError, reportFull } from './chunk-NLQIL5WD.js';
|
|
3
|
+
export { applyFix, assembleAudits, atLeastImportant, buildReport, candidatePairs, classifyPair, compile, composeSpans, decompose, importanceOf, numericDiagnostics, prepareTemplate, proposeReduction, rename, report, resolve, runDiagnostics, semanticDiagnostics, structuralDiagnostics, verdictFrom } from './chunk-KRYC4OTL.js';
|
|
4
|
+
export { compileToXml, evalExpr, exprAtoms, parseExpr, parseTools, toolInputSchema } from './chunk-YH4ZLQ4G.js';
|
|
5
|
+
import './chunk-Y64EAEYB.js';
|
|
6
|
+
import './chunk-PR4QN5HX.js';
|
|
7
|
+
//# sourceMappingURL=node.js.map
|
|
8
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"node.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dictionary } from './spell.js';
|
|
2
|
+
export { DictionarySource, createDictionary } from './spell.js';
|
|
3
|
+
import './diagnostics-BWJ_oMd8.js';
|
|
4
|
+
|
|
5
|
+
/** Read the US + British dictionaries (optional peers) and build the checker. Node only. */
|
|
6
|
+
declare function loadDictionary(custom?: readonly string[]): Promise<Dictionary>;
|
|
7
|
+
|
|
8
|
+
export { Dictionary, loadDictionary };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createDictionary } from './chunk-ZKMHZHID.js';
|
|
2
|
+
export { createDictionary } from './chunk-ZKMHZHID.js';
|
|
3
|
+
import './chunk-PR4QN5HX.js';
|
|
4
|
+
|
|
5
|
+
// src/lib/spell-node.ts
|
|
6
|
+
async function loadDictionary(custom = []) {
|
|
7
|
+
let en;
|
|
8
|
+
let gb;
|
|
9
|
+
try {
|
|
10
|
+
[en, gb] = await Promise.all([import('dictionary-en'), import('dictionary-en-gb')]);
|
|
11
|
+
} catch {
|
|
12
|
+
throw new Error("typeglish/spell needs the optional dictionary peers \u2014 install with: npm i -D nspell dictionary-en dictionary-en-gb");
|
|
13
|
+
}
|
|
14
|
+
const decode = (d) => ({
|
|
15
|
+
aff: new TextDecoder("utf-8").decode(d.aff),
|
|
16
|
+
dic: new TextDecoder("utf-8").decode(d.dic)
|
|
17
|
+
});
|
|
18
|
+
return createDictionary(decode(en.default), decode(gb.default), custom);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { loadDictionary };
|
|
22
|
+
//# sourceMappingURL=spell-node.js.map
|
|
23
|
+
//# sourceMappingURL=spell-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/spell-node.ts"],"names":[],"mappings":";;;;;AAWA,eAAsB,cAAA,CAAe,MAAA,GAA4B,EAAC,EAAwB;AACxF,EAAA,IAAI,EAAA;AACJ,EAAA,IAAI,EAAA;AACJ,EAAA,IAAI;AACF,IAAA,CAAC,EAAA,EAAI,EAAE,CAAA,GAAI,MAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,OAAO,eAAe,CAAA,EAAG,OAAO,kBAAkB,CAAC,CAAC,CAAA;AAAA,EACpF,CAAA,CAAA,MAAQ;AAGN,IAAA,MAAM,IAAI,MAAM,yHAAoH,CAAA;AAAA,EACtI;AACA,EAAA,MAAM,MAAA,GAAS,CAAC,CAAA,MAA+D;AAAA,IAC7E,KAAK,IAAI,WAAA,CAAY,OAAO,CAAA,CAAE,MAAA,CAAO,EAAE,GAAG,CAAA;AAAA,IAC1C,KAAK,IAAI,WAAA,CAAY,OAAO,CAAA,CAAE,MAAA,CAAO,EAAE,GAAG;AAAA,GAC5C,CAAA;AACA,EAAA,OAAO,gBAAA,CAAiB,OAAO,EAAA,CAAG,OAAO,GAAG,MAAA,CAAO,EAAA,CAAG,OAAO,CAAA,EAAG,MAAM,CAAA;AACxE","file":"spell-node.js","sourcesContent":["// ── typeglish/spell — Node entry ──────────────────────────────────────────────────────────────────────\n// The `node` condition of the `typeglish/spell` package export. Re-exports the host-agnostic builder and adds\n// the convenience loader that reads the bundled en + en-GB dictionaries from disk — so a Node consumer (a CLI,\n// a server) gets full spell-check with one call and no asset wiring. The dictionaries are dynamic-imported so\n// they (and their node:fs reads) never reach a browser build, which resolves the `default` condition (spell.ts).\nexport * from './spell';\n\nimport { createDictionary } from './spell';\nimport type { Dictionary, DictionarySource } from './spell';\n\n/** Read the US + British dictionaries (optional peers) and build the checker. Node only. */\nexport async function loadDictionary(custom: readonly string[] = []): Promise<Dictionary> {\n let en: { default: { aff: Uint8Array; dic: Uint8Array } };\n let gb: { default: { aff: Uint8Array; dic: Uint8Array } };\n try {\n [en, gb] = await Promise.all([import('dictionary-en'), import('dictionary-en-gb')]);\n } catch {\n // The dictionaries are optional peer dependencies — same tier as z3-solver: the deterministic\n // core never needs them, and a consumer that wants spell-check opts in with one install.\n throw new Error('typeglish/spell needs the optional dictionary peers — install with: npm i -D nspell dictionary-en dictionary-en-gb');\n }\n const decode = (d: { aff: Uint8Array; dic: Uint8Array }): DictionarySource => ({\n aff: new TextDecoder('utf-8').decode(d.aff),\n dic: new TextDecoder('utf-8').decode(d.dic),\n });\n return createDictionary(decode(en.default), decode(gb.default), custom);\n}\n"]}
|
package/dist/spell.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as SpellChecker } from './diagnostics-BWJ_oMd8.js';
|
|
2
|
+
|
|
3
|
+
interface Dictionary {
|
|
4
|
+
/** True when the word is spelled correctly in US OR British English (or is a supplied custom word). */
|
|
5
|
+
isWord: SpellChecker;
|
|
6
|
+
/** Up to five ranked corrections, merged across both variants. */
|
|
7
|
+
suggest: (word: string) => string[];
|
|
8
|
+
/** Teach the live checker a word so it stops being flagged. */
|
|
9
|
+
add: (word: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Raw hunspell dictionary text: the `.aff` affix rules + the `.dic` word list, decoded to UTF-8 strings. */
|
|
12
|
+
interface DictionarySource {
|
|
13
|
+
aff: string;
|
|
14
|
+
dic: string;
|
|
15
|
+
}
|
|
16
|
+
declare function createDictionary(en: DictionarySource, gb: DictionarySource, custom?: readonly string[]): Dictionary;
|
|
17
|
+
|
|
18
|
+
export { type Dictionary, type DictionarySource, createDictionary };
|
package/dist/spell.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"spell.js"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { checkDirectiveConsistency, checkLogic, checkNumeric, checkNumericConsistency, satisfiable, z3 } from './chunk-VMACILYN.js';
|
|
2
|
+
import './chunk-Y64EAEYB.js';
|
|
3
|
+
import './chunk-PR4QN5HX.js';
|
|
4
|
+
//# sourceMappingURL=z3-MWU3GSVT.js.map
|
|
5
|
+
//# sourceMappingURL=z3-MWU3GSVT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"z3-MWU3GSVT.js"}
|