@cratis/screenplay-language 4.120.0 → 4.122.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/dist/ResponseAnalysis.d.ts +5 -0
- package/dist/ResponseAnalysis.d.ts.map +1 -1
- package/dist/bundles/chunk-4CLLEMBX.js +42 -0
- package/dist/bundles/chunk-4CLLEMBX.js.map +7 -0
- package/dist/bundles/index.js +36 -36
- package/dist/bundles/index.js.map +3 -3
- package/dist/bundles/sub-languages/capture/index.js +2 -2
- package/dist/bundles/sub-languages/capture/index.js.map +2 -2
- package/dist/bundles/sub-languages/projection/index.js +1 -1
- package/dist/completion-items.d.ts +3 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +15 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/hover-content.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/response-analysis.d.ts.map +1 -1
- package/dist/sub-languages/capture/HoverProvider.d.ts.map +1 -1
- package/dist/sub-languages/capture/language.d.ts.map +1 -1
- package/dist/symbols.d.ts +5 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/bundles/chunk-HI5WTI3G.js +0 -42
- package/dist/bundles/chunk-HI5WTI3G.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../tokens.ts", "../../response-completions.ts", "../../case-authoring.ts", "../../example-authoring.ts", "../../operation-authoring.ts", "../../event-source-authoring.ts", "../../refusal-context.ts", "../../named-rule-context.ts", "../../dependency-completions.ts", "../../example-values.ts", "../../structure-completions.ts", "../../sub-language-registry.ts", "../../completion-planner.ts", "../../completions.ts", "../../inline-completions.ts", "../../response-tokens.ts", "../../reaction-authoring.ts", "../../keyword-docs.ts", "../../hover-content.ts", "../../hover.ts", "../../inlay-hints.ts", "../../code-actions.ts", "../../diagnostics.ts", "../../sub-languages/pdl.ts", "../../sub-languages/cdl.ts", "../../themes/screenplay-dark.ts", "../../themes/screenplay-light.ts", "../../index.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport {\n clauseKeywords,\n codeBlockTags,\n constructKeywords,\n primitiveTypes,\n sliceTypes,\n} from './language';\nimport { MonarchTokenRules, SubLanguage } from './sub-language-registry';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\n// Maps a Screenplay inline code tag to the Monaco language id used for embedded highlighting.\n// Declaration registration must not globally reserve existing property names.\n// Ambiguous standalone operation headers are supplied by typed semantic tokens.\nconst contextualConstructs = new Set(['operation', 'system', 'eventsource', 'purpose']);\n\nconst embeddedLanguages: Record<string, string> = {\n csharp: 'csharp',\n typescript: 'typescript',\n react: 'typescript',\n html: 'html',\n sql: 'sql',\n};\n\nfunction subLanguageState(keyword: string): string {\n return `subLanguage_${keyword}`;\n}\n\n// A construct keyword at the start of a line ends any indented sub-language block.\nfunction subLanguageExitRule(subLanguages: SubLanguage[]): MonarchTokenRules[number] {\n const exitKeywords = [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...subLanguages.map((subLanguage) => subLanguage.keyword)];\n return [\n new RegExp(`^\\\\s*(?:${exitKeywords.join('|')})\\\\b`),\n { token: '@rematch', next: '@pop' },\n ];\n}\n\n// Shared across the composite `.play` tokenizer and every standalone sub-language tokenizer\n// (comments, `$`-prefixed context variables, strings, numbers, operators, delimiters, whitespace).\nexport const commonTokenRules: MonarchTokenRules = [\n [/\\/\\/.*$/, 'comment'],\n [/\\$(?:context|eventContext|eventSourceId|causedBy|refusal)(?:\\.\\w+)*/, 'variable.predefined'],\n [/\\$(?:env|secrets|strings)\\.[\\w.]+/, 'variable.predefined'],\n [/\\$\\.[\\w.]*/, 'variable.predefined'],\n [/\"(?:[^\"\\\\]|\\\\.)*\"/, 'string'],\n [/\"(?:[^\"\\\\]|\\\\.)*$/, 'string.invalid'],\n [/\\d+(?:ms|s|m|h|d)\\b/, 'number'],\n [/-?\\d+\\.\\d+/, 'number.float'],\n [/-?\\d+/, 'number'],\n [/=>|==|!=|>=|<=|[><=:?]/, 'operator'],\n [/[[\\](),.]/, 'delimiter'],\n [/\\s+/, 'white'],\n];\n\nexport function createTokensProvider(subLanguages: SubLanguage[]): languages.IMonarchLanguage {\n const tokenizer: Record<string, MonarchTokenRules> = {\n root: [\n [new RegExp(`^(\\\\s*)(example)(\\\\s+)([A-Z][${bmpWordCharacters}]*)(\\\\s*)(:)(\\\\s*)([A-Z][${bmpWordCharacters}.]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'operator', 'white', 'type.identifier']],\n [/^(\\s*)(direction)(\\s+)(inbound|outbound)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^()(purpose)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@purposeBody.$1' }]],\n [/^(\\s*)(parameter)(\\s+)([a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\s+optional)?)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'identifier', 'white', 'type.identifier']],\n [/^(\\s*)(case)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:[a-z_]\\w*\\s*=|\\/\\/|$))/, ['white', 'keyword', 'white', 'type.identifier']],\n [/\\b(case)(\\.)([a-z_]\\w*)\\b/, ['keyword', 'delimiter', 'identifier']],\n [/^(\\s*)(concept)(\\s+)([^\\s:]+)(\\s*:\\s*)(\\w+)((?:\\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier', 'operator', { token: 'type.identifier', next: '@conceptBody.$1' }, 'keyword']],\n [/^(numbers)([ \\t]+)(exact)(?=[ \\t]*(?:(?:\\/\\/|#).*)?$)/, ['keyword', 'white', 'keyword']],\n [/^(eventsource)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(system)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(\\s*)(produces\\s+operation)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@operationBody.$1' }]],\n [/^(\\s*)(given\\s+operation)(\\s+)([\\w.]+)(\\s+)(fails)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*)(then\\s+(?:operation|compensated))(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier']],\n [new RegExp(`^(\\\\s*)(command)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@commandBody.$1' }]],\n [/^(\\s*)(handler)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@handlerBody.$1' }]],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(\\s+)(generated)(\\s+identifier|)(?=\\s*(?:\\/\\/.*)?$)/,\n ['identifier', 'type.identifier', 'white', 'keyword', 'keyword']],\n [/^(\\s*)(generated)(\\s+)([a-z_]\\w*)(\\s*=(?!=|>))/, ['white', 'keyword', 'white', 'identifier', 'operator']],\n [/^(\\s*)(then)(\\s+)(returns)\\b/, ['white', 'keyword', 'white', 'keyword']],\n // Only unambiguous response headers: two-token property declarations keep their names.\n [/^(\\s*)(returns)(?=\\s*(?:\\/\\/.*)?$|\\s+@\\w+\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A modifier only after a complete type; names called optional remain ordinary names.\n [/^(\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:from\\b|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n // Query prefixes cannot fall back to being property names.\n [/^(?!\\s*(?:by|filter)\\s+)(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:identifier\\b|from\\b|=(?!=|>)|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?!observable\\s+optional\\s*(?:\\/\\/.*)?$)(?:observable\\s+)?)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:\\/\\/.*)?$)/,\n ['keyword', 'type.identifier', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(given)(\\\\s+)(caller)(\\\\s+)(as)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n // A specification's clock, trigger, capture and query steps - matched before a sub-language keyword\n // can claim 'capture' and read the rest of the specification as change data capture.\n [/^(\\s*)(given|when)(\\s+)(clock|capture|trigger|query)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(result|no\\s+(?:result|events))\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(events)(\\s+)(in any order)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(redelivered)(\\s+)([\\w.]+)(\\s+)(to)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', 'type.identifier']],\n // Guarded-action words are contextual; property names keep their ordinary meaning.\n [/^(\\s*)(otherwise)(\\s+)(hidden)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(otherwise)(\\s+)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(when)(\\s+)(?=.+\\s+execute\\s+[\\w.]+\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', { token: 'white', next: '@guardedActionCondition' }]],\n [/^(\\s*)(behavior)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@behaviorBody.$1' }]],\n [/^(\\s*)(on)(\\s+)(refused)(\\s+)(by)(\\s+)(validation|constraint|authorization)\\b/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)(refused)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)([\\w-]+)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@interactionBody.$1' }]],\n [/^(\\s*)(acknowledge)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A quoted import names .play files rather than a qualified name - the path reads as a link.\n [/^(\\s*)(import)(\\s+)(\"[^\"\\\\]*\")/, ['white', 'keyword', 'white', 'string.link']],\n // Retain the header indent so event metadata stops at the enclosing block boundary.\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(\\s+)(generation)(\\s+)(\\d+)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', { token: 'number', next: '@eventBody.$1' }]],\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@eventBody.$1' }]],\n // A tagged opening fence carries the embedded language; legacy tag lines still highlight.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`^\\\\s*\\\\x60\\\\x60\\\\x60${tag}\\\\s*$`),\n { token: 'string.quote', next: `@codeBlock.${embeddedLanguages[tag]}`, nextEmbedded: embeddedLanguages[tag] },\n ],\n ),\n // Inline code block tags at end of line open an embedded code block.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${tag}\\\\b(?=\\\\s*$)`),\n { token: 'keyword.tag', next: `@codeBlockPending.${embeddedLanguages[tag]}` },\n ],\n ),\n // Sub-language constructs switch to the registered sub-language's token rules.\n ...subLanguages.map(\n (subLanguage): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${subLanguage.keyword}\\\\b`),\n { token: 'keyword', next: `@${subLanguageState(subLanguage.keyword)}` },\n ],\n ),\n // Typed documentation names are properties, not metadata directives.\n [/^(\\s*)(documentation)(?=\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?\\s*(?:identifier\\b|generated\\b|=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier']],\n // A bare description or documentation keyword opens a fenced prose block.\n [/\\b(?:description|documentation)\\b(?=\\s*(?:\\/\\/.*)?$)/, { token: 'keyword', next: '@descriptionBlockPending' }],\n [/\\brow-click\\b/, 'keyword'],\n // A leading @ escapes a name that collides with a directive keyword - it is a name, not an attribute.\n [/^\\s*@[a-z_]\\w*/, 'identifier'],\n [/@\\w+/, 'annotation'],\n [\n /[A-Z]\\w*/,\n {\n cases: {\n '@sliceTypes': 'keyword.type',\n '@primitiveTypes': 'type',\n '@default': 'type.identifier',\n },\n },\n ],\n [\n /[a-z_]\\w*/,\n {\n cases: {\n '@keywords': 'keyword',\n '@default': 'identifier',\n },\n },\n ],\n { include: '@common' },\n ],\n\n guardedActionCondition: [\n [/(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', { token: 'type.identifier', next: '@pop' }]],\n { include: '@root' },\n ],\n\n behaviorBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n { include: '@root' },\n ],\n\n interactionBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(otherwise)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(?=item\\.|\\()/, ['white', 'keyword', 'white']],\n [/^(\\s*)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n purposeBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\\s+)/, ['white', 'keyword', 'white']],\n [/\\b(safeguard|exception)\\b/, 'keyword'],\n { include: '@root' },\n ],\n\n conceptBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(@?pii|personal|@?sensitive|secret)(\\s+)(reason|scope|special|criminal)\\b/, ['white', 'keyword', 'white', 'keyword']],\n { include: '@root' },\n ],\n\n commandBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@commandValidation.$1' }]],\n { include: '@root' },\n ],\n\n commandValidation: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [new RegExp(`^(\\\\s*)([${bmpWordCharacters}.]+)(\\\\s+)(rule)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?:severity\\\\s+\\\\w+|message\\\\s+.*|//.*|$))`),\n ['white', 'identifier', 'white', 'keyword', 'white', { token: 'type.identifier', next: '@namedRuleBody.$1' }]],\n { include: '@root' },\n ],\n\n namedRuleBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n operationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(execute|compensate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@operationPhase.$1' }]],\n [/^(\\s*)(uses)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(@?[a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(?=\\s*(?:=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n operationPhase: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n handlerBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n implementationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(hint)(?=\\s+\")/, ['white', 'keyword']],\n { include: '@root' },\n ],\n\n eventBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(id)(?=\\s+\")/, ['white', 'keyword']],\n [/^(\\s*)(documentation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@descriptionBlockPending' }]],\n { include: '@root' },\n ],\n\n common: commonTokenRules,\n\n // After a code tag, the only thing allowed before the opening fence is whitespace.\n codeBlockPending: [\n [\n /^\\s*```\\s*$/,\n { token: 'string.quote', switchTo: '@codeBlock.$S2', nextEmbedded: '$S2' },\n ],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n codeBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop', nextEmbedded: '@pop' }],\n [/[^`]+/, ''],\n [/`/, ''],\n ],\n\n // After a bare description, the only thing allowed before the opening fence is whitespace.\n descriptionBlockPending: [\n [/\\/\\/.*$/, 'comment'],\n [/^\\s*```(?:text|markdown)?\\s*$/, { token: 'string.quote', switchTo: '@descriptionBlock' }],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n descriptionBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop' }],\n [/.+/, 'string'],\n ],\n };\n\n for (const subLanguage of subLanguages) {\n tokenizer[subLanguageState(subLanguage.keyword)] = [\n subLanguageExitRule(subLanguages),\n ...subLanguage.tokens,\n { include: '@common' },\n [/[A-Z]\\w*/, 'type.identifier'],\n [/[a-z_]\\w*/, 'identifier'],\n ];\n }\n\n return {\n defaultToken: '',\n tokenPostfix: '.play',\n ignoreCase: false,\n keywords: [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...clauseKeywords, ...codeBlockTags],\n sliceTypes,\n primitiveTypes,\n tokenizer,\n } as languages.IMonarchLanguage;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { CompletionEntry, optionalTypeItems } from './completion-items';\nimport { DocumentSymbols, PropertySymbol, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\nimport { responseAvailability, responseAnalysis } from './response-analysis';\nimport { primitiveTypes } from './language';\n\nexport function responseCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const fences = fenceMap(lines);\n if (fences[line] || withoutComment(before).length < before.length) return null;\n const indent = before.trim() === '' ? before.length : indentOf(lines[line]);\n const chain = enclosingChain(lines, fences, line, indent);\n const enclosing = nearestEnclosingLine(lines, fences, line, indent);\n const namedCommand = (name: string | undefined) => {\n const matches = symbols.commands.filter(command => command.name === name);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const entry = (property: PropertySymbol, insertText = property.name): CompletionEntry => ({\n label: property.name, insertText,\n documentation: `${typeReferenceText(propertyTypeReference(property))}${property.isGenerated ? ' \u2014 generated, not request/form input' : ''}. ${responseAvailability}`,\n });\n if (chain.includes('command')) {\n // Merged symbol line offsets belong to different documents. Only the current (possibly\n // unsaved) source can own the cursor; application symbols are for external lookup.\n const command = scanDocument(lines).commands.filter(command => command.line < line).at(-1);\n if (!command) return null;\n if (chain[0] === 'command') {\n if (/^\\s*returns\\s+@?\\w*$/.test(before)) {\n if (!/returns\\s+@/.test(before) && command.properties.some(property => property.name === 'returns' && property.line === line)) return null;\n return command.properties.map(property => entry(property, `${/returns\\s+@/.test(before) ? '' : '@'}${property.name}`));\n }\n const modifier = before.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/);\n if (modifier && ['generated', 'identifier'].some(word => word.startsWith(modifier[2]))) {\n const concept = symbols.concepts.find(concept => concept.name === modifier[1]);\n if (concept?.primitive === 'Uuid') return [\n ...('optional'.startsWith(modifier[2]) ? optionalTypeItems : []),\n { label: 'generated', insertText: 'generated', documentation: `Required scalar Uuid concept with no validation rules; not a request/form input. ${responseAvailability}` },\n { label: 'generated identifier', insertText: 'generated identifier', documentation: `Specification fixture uses an indented for value. ${responseAvailability}` },\n { label: 'identifier', insertText: 'identifier', documentation: 'Names the event source identifier.' },\n ];\n }\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+generated\\s+\\w*$/.test(before)) return [{ label: 'identifier', insertText: 'identifier', documentation: responseAvailability }];\n }\n if (chain[0] === 'returns') {\n if (/=\\s*@?\\w*$/.test(before)) return command.properties.map(property => entry(property));\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]*$/.test(before)) return [...symbols.concepts.map(concept => concept.name), ...symbols.types.map(type => type.name), ...primitiveTypes].map(name => ({ label: name, insertText: name, documentation: `Explicit response type must exactly match the source. ${responseAvailability}` }));\n return command.properties.map(property => entry(property, `${property.name} = ${property.name}`));\n }\n }\n if (chain[0] === 'form' && enclosing && (/^\\s*field\\s+\\w*$/.test(before) || before.trim() === '')) {\n const command = namedCommand(enclosing.match(/\\bfor\\s+([\\w.]+)$/)?.[1]);\n if (command) return command.properties.filter(property => !property.isGenerated).map(property => entry(property, before.trim() === '' ? `field ${property.name}` : property.name));\n }\n if (chain.includes('specification')) {\n if (chain[0] === 'when' && enclosing) {\n const name = enclosing.match(/^when\\s+([\\w.]+)$/)?.[1];\n const command = namedCommand(name);\n if (!command) return null;\n if (/^\\s*generated\\s+\\w*$/.test(before)) return command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => entry(property, `${property.name} = \"\\${1:uuid}\"`));\n if (before.trim() === '') return [\n ...command.properties.filter(property => !property.isGenerated).map(property => entry(property, `${property.name} = \\${1:value}`)),\n ...command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => ({ ...entry(property, `generated ${property.name} = \"\\${1:uuid}\"`), label: `generated ${property.name}` })),\n ...(command.properties.some(property => property.isGenerated && property.isIdentifier) ? [{ label: 'for', insertText: 'for \"${1:uuid}\"', documentation: `Generated identifier fixture, not request input. ${responseAvailability}` }] : []),\n ];\n }\n if (chain[0] === 'then' && /^then\\s+returns$/.test(enclosing ?? '')) {\n const specification = [...responseAnalysis(lines).specifications.values()].filter(specification => specification.location.line - 1 < line).at(-1);\n const command = namedCommand(specification?.when?.commandType);\n if (command?.response?.kind === 'RecordCommandResponseSyntax') {\n const properties = new Map(command.properties.map(property => [property.name, property]));\n return command.response.fields.map(field => {\n const source = properties.get(field.source.property);\n const type = field.type ?? (source ? propertyTypeReference(source) : undefined);\n return { label: field.name, insertText: `${field.name} = \\${1:value}`, documentation: `${type ? typeReferenceText(type) : 'Unresolved type'}. ${responseAvailability}` };\n });\n }\n }\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { enclosingHeaders, fenceMap, indentOf } from './document-context';\n\nfunction enclosing(lines: string[], line: number) {\n const headers = enclosingHeaders(lines, fenceMap(lines), line, indentOf(lines[line]));\n if (!headers.some(header => header.startsWith('specification ')) || headers.some(header => /^(?:case|given caller|when redelivered)\\b/.test(header))) return undefined;\n return [...responseAnalysis(lines).specifications].filter(([start]) => start <= line).sort(([left], [right]) => right - left)[0]?.[1];\n}\n\nexport function caseCompletions(lines: string[], line: number, before: string) {\n if (!/(?:=\\s*|for\\s+|then\\s+error\\s+)case\\.[\\w]*$/.test(before) || /when\\s+redelivered|given\\s+caller/.test(before) || /^\\s*case\\b/.test(before)) return null;\n const table = enclosing(lines, line);\n if ((table?.cases?.length ?? 0) === 0) return null;\n return table!.parameters?.map(parameter => ({ label: `case.${parameter.name}`, insertText: `case.${parameter.name}`, documentation: `Case value of ${parameter.type.name}${parameter.type.isCollection ? '[]' : ''}${parameter.type.isOptional ? ' optional' : ''}.` })) ?? [];\n}\n\nexport function caseHover(lines: string[], line: number, start: number, end: number): string | null {\n const text = lines[line];\n const reference = [...text.matchAll(/\\bcase\\.([a-z_]\\w*)\\b/g)].find(match => match.index! < end && match.index! + match[0].length >= start);\n if (reference === undefined) return null;\n const table = enclosing(lines, line);\n const parameter = table?.parameters?.find(parameter => parameter.name === reference[1]);\n if (parameter === undefined) return null;\n const values = table!.cases?.map(row => {\n const source = row.values.find(value => value.property === parameter.name)?.source;\n const value = source !== null && typeof source === 'object' && 'value' in source ? source.value : source;\n return `- ${row.name}: \\`${JSON.stringify(value)}\\``;\n }).join('\\n');\n return `**case.${parameter.name}** \u2014 ${parameter.type.name}\\n\\nCase origin in **${table!.name}**; substitutes after example overrides.\\n\\n${values ?? ''}`;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, withoutComment } from './document-context';\nimport { caseCompletions, caseHover } from './case-authoring';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\n\nfunction analyze(lines: string[], application?: DocumentSymbols) {\n const symbols = symbolsForBuffer(lines, application);\n return responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n}\n\nexport function exampleCompletions(lines: string[], line: number, before: string, application?: DocumentSymbols) {\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length) return null;\n const analysis = analyze(lines, application);\n return caseCompletions(lines, line, before) ?? analysis.personas.completions(line, before) ?? analysis.examples.completions(line, before);\n}\n\nexport function exampleHover(lines: string[], line: number, start: number, end: number, application?: DocumentSymbols) {\n const analysis = analyze(lines, application);\n return caseHover(lines, line, start, end) ?? analysis.personas.hover(line, start, end) ?? analysis.examples.hover(line, start, end);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry, operationItems, operationPhaseItems, operationImplementationItems } from './completion-items';\nimport { enclosingChain, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { DocumentSymbols } from './symbols';\nimport { responseAnalysis } from './response-analysis';\nimport { OperationAnalysis, OperationDeclaration, OperationPhase } from './OperationAnalysis';\nimport { TypeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\n\nexport const operationAvailability = 'Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#301). No semantic or requirement identity is assigned.';\n\nexport function analyzeOperations(lines: string[], symbols?: DocumentSymbols) {\n return responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols?.authoringPlacement, symbols?.authoringPath).operations;\n}\n\nexport function phaseState(phase: OperationPhase | null): string {\n return !phase ? 'not declared' : phase.file ? `file ${phase.file.path}` : phase.code ? `inline ${phase.code.language}` : 'pending';\n}\n\nexport function operationDetails(operation: OperationDeclaration): string {\n const inputs = operation.inputs.map(input => `${input.name} ${typeReferenceText(input.type)}`).join('\\n');\n const phase = (name: string, value: OperationPhase | null) => `${name}: ${name === 'compensate' && !value ? 'not declared' : phaseState(value)}${value?.description ? ` \u2014 ${value.description}` : ''}${value?.implementation?.hints.map(hint => `\\n hint: ${hint.text}`).join('') ?? ''}`;\n return `**operation ${[...operation.scope, operation.name].join('.')}**\\n\\n${operation.description ?? ''}\\n\\nUses ${operation.uses}\\n\\n\\`\\`\\`screenplay\\n${inputs}\\n\\`\\`\\`\\n\\n${phase('execute', operation.execute)}\\n\\n${phase('compensate', operation.compensate)}\\n\\n${operationAvailability}`;\n}\n\nexport function operationCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const fences = fenceMap(lines);\n if (fences[line] || withoutComment(before).length < before.length) return null;\n const indent = before.trim() === '' ? before.length : indentOf(lines[line]);\n const chain = enclosingChain(lines, fences, line, indent);\n const enclosing = nearestEnclosingLine(lines, fences, line, indent) ?? '';\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const operations = analysis.operations;\n const context = operations.contexts.get(line);\n const targets = () => {\n if (!context) return [];\n const reference = before.match(/(?:produces|given\\s+operation|then\\s+(?:operation|compensated))\\s+([\\w.]*)$/)?.[1] ?? before.trim();\n const qualifiers = reference.split('.').slice(0, -1);\n return operations.targets(context.scope).filter(target => qualifiers.length === 0 ||\n qualifiers.length <= target.declaration.scope.length && qualifiers.every((part, index) => target.declaration.scope[target.declaration.scope.length - qualifiers.length + index] === part))\n .map(target => ({ label: target.name, insertText: qualifiers.length > 0 ? target.declaration.name : target.name, documentation: operationDetails(target.declaration) }));\n };\n if (chain.includes('specification') && /^\\s*(?:given\\s+operation|then\\s+(?:operation|compensated))\\s+[\\w.]*$/.test(before)) return targets();\n if (chain[0] === 'command' && /^\\s*produces\\s+[\\w.]*$/.test(before)) return targets().length ? [\n { label: 'event', insertText: 'event ${1:Name}', documentation: 'Declares an inline event.' },\n { label: 'operation', insertText: 'operation ${1:Name}\\n uses ${2:System}\\n ${3:input} ${4:Type} = ${5:source}', documentation: operationAvailability },\n ...symbols.events.map(event => ({ label: event.name, insertText: event.name, documentation: 'Declared event.' })), ...targets()\n ] : null;\n if (context?.commandLine !== undefined && chain[0] === 'produces' && /^produces\\s+when\\b/.test(enclosing) && /^\\s*[\\w.]*$/.test(before)) return targets();\n const ownedOperation = context?.operation;\n const operation = ownedOperation && (line === ownedOperation.location.line - 1 || indent > indentOf(lines[ownedOperation.location.line - 1])) ? ownedOperation : undefined;\n if (operation && /^\\s*uses\\s+\\w*$/.test(before) && !operation.inputs.some(input => input.location.line === line + 1)) return operations.systems.map(system => ({ label: system.name, insertText: system.name, documentation: `${system.description ?? 'External system'}. ${operationAvailability}` }));\n if (chain[0] === 'implementation' && ['execute', 'compensate'].includes(chain[1])) return operationImplementationItems;\n if (['execute', 'compensate'].includes(chain[0]) && operation) return operationPhaseItems;\n const production = context?.production;\n const targetLine = (production?.targetLocation ?? production?.location)?.line;\n const inProductionBody = targetLine !== undefined && line > targetLine - 1 && indent > indentOf(lines[targetLine - 1]);\n const mappedOperation = operation ?? (inProductionBody ? production?.declaration : undefined);\n // Typed ranges include blank lines and comments. The caret must still be inside\n // the target's body, not dedented to a command member or conditional target line.\n // Ancestor keywords cannot own mappings, including deeper composite paths.\n if (mappedOperation) {\n const rhs = before.match(/=\\s*([\\w.]*)$/);\n if (rhs && context?.commandLine !== undefined) {\n const command = analysis.commands.get(context.commandLine);\n let properties: readonly { name: string; type: TypeReferenceSymbol; isGenerated?: boolean }[] = command?.properties ?? [];\n const parts = rhs[1].split('.');\n for (const part of parts.slice(0, -1)) {\n const property = properties.find(property => property.name === part);\n if (!property || property.type.isCollection) return [];\n const types = operations.types.filter(type => type.name === property.type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties;\n }\n return properties.map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)}${property.isGenerated ? ' \u2014 generated source, not request input' : ''}. ${operationAvailability}` }));\n }\n if (operation && /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+\\w*$/.test(before)) return [{ label: 'optional', insertText: 'optional', documentation: 'Allows absence of the complete operation input value.' }];\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.[\\]?]*$/.test(before) && operation) return [...operations.concepts.map(concept => concept.name), ...operations.types.map(type => type.name), 'String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'].map(name => ({ label: name, insertText: name, documentation: 'Operation input type.' }));\n if (operation) return operationItems;\n return mappedOperation.inputs.map(input => ({ label: input.name, insertText: `${input.name} = \\${1:source}`, documentation: `${typeReferenceText(input.type)}. ${operationAvailability}` }));\n }\n if (chain[0] === 'then' && /^then\\s+operation\\s+/.test(enclosing)) {\n const name = enclosing.match(/^then\\s+operation\\s+([\\w.]+)/)?.[1];\n const declaration = operations.references.filter(reference => reference.name === name && reference.location.line - 1 < line && reference.kind === 'operation').at(-1)?.declaration;\n if (declaration) {\n const value = before.match(/^\\s*(\\w+)\\s*=\\s*[^=]*$/);\n if (value) {\n const type = declaration.inputs.find(input => input.name === value[1])?.type;\n const concept = operations.concepts.filter(concept => concept.name === type?.name);\n if (concept.length === 1 && concept[0].type === 'Enum') return concept[0].values.map(value => ({ label: value, insertText: JSON.stringify(value), documentation: `${type?.name} value.` }));\n }\n return declaration.inputs.map(input => ({ label: input.name, insertText: `${input.name} = \\${1:value}`, documentation: `${typeReferenceText(input.type)}. Partial assertion; ${operationAvailability}` }));\n }\n }\n return null;\n}\n\n// Shared by both editor hosts. Only the parser-owned target span can bind a reference;\n// a repeated identifier in a trailing comment or a condition is not that reference.\nexport function operationReferenceAt(analysis: OperationAnalysis, lines: string[], line: number, start: number, end: number) {\n const source = withoutComment(lines[line] ?? '');\n return analysis.references.find(reference => {\n const target = reference.targetLocation ?? reference.location;\n return target.line === line + 1 && start >= target.column && end <= target.column + reference.name.length &&\n source.slice(target.column - 1, target.column - 1 + reference.name.length) === reference.name;\n });\n}\n\nexport function operationHover(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols): string | null {\n const analysis = analyzeOperations(lines, symbols);\n const source = lines[line] ?? '';\n const at = (location: { line: number; column: number }, name: string) => {\n const column = location.column + (source[location.column - 1] === '@' ? 1 : 0);\n return location.line === line + 1 && start === column && end === column + name.length && source.slice(start - 1, end - 1) === name;\n };\n const context = analysis.contexts.get(line);\n const property = context?.operation?.inputs.find(input => at(input.location, input.name));\n if (property) return `**${property.name}** \u2014 ${typeReferenceText(property.type)}. Operation input, not a command request field. ${operationAvailability}`;\n const equals = source.indexOf('=');\n if (equals >= 0 && start - 1 > equals && context?.commandLine !== undefined && (context.operation || context.production?.declaration)) {\n const command = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(text => text !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath).commands.get(context.commandLine);\n const expression = source.slice(equals + 1, end - 1).trim();\n const parts = expression.split('.');\n let properties: readonly { name: string; type: TypeReferenceSymbol }[] = command?.properties ?? [];\n for (const [index, part] of parts.entries()) {\n const property = properties.find(property => property.name === part);\n if (!property) break;\n if (index === parts.length - 1) return `**${part}** \u2014 ${typeReferenceText(property.type)}. Command source for an operation input. ${operationAvailability}`;\n const types = analysis.types.filter(type => type.name === property.type.name);\n if (types.length !== 1 || property.type.isCollection) break;\n properties = types[0].properties;\n }\n }\n const reference = operationReferenceAt(analysis, lines, line, start, end);\n if (reference?.declaration) return operationDetails(reference.declaration);\n if (reference?.kind === 'ambiguous') return `Ambiguous production: no declaration kind was selected. ${operationAvailability}`;\n const operation = context?.operation;\n if (operation && operation.location.line === line + 1) {\n const header = withoutComment(source).match(/^\\s*(?:produces\\s+)?operation\\s+/)?.[0];\n if (header && start === header.length + 1 && end === start + operation.name.length) return operationDetails(operation);\n }\n if (operation?.usesLocation?.line === line + 1 && start >= operation.usesLocation.column && end <= operation.usesLocation.column + operation.uses.length && withoutComment(source).slice(start - 1, end - 1) === operation.uses.slice(start - operation.usesLocation.column, end - operation.usesLocation.column)) {\n const systems = analysis.systems.filter(system => system.name === operation.uses);\n return systems.length === 1 ? `**system ${systems[0].name}**\\n\\n${systems[0].description ?? ''}\\n\\n${operationAvailability}` : `Unresolved or ambiguous external system. ${operationAvailability}`;\n }\n for (const phase of [operation?.execute, operation?.compensate]) {\n if (!phase) continue;\n if (phase.location.line === line + 1 || phase.implementation?.location.line === line + 1 || phase.implementation?.hints.some(hint => hint.location.line === line + 1)) return `${phaseState(phase)}\\n\\n${phase.description ?? ''}\\n\\n${phase.implementation?.hints.map(hint => hint.text).join('\\n') ?? ''}\\n\\n${operationAvailability}`;\n }\n const system = analysis.systems.find(system => system.location.path === (symbols?.authoringPath ?? 'current.play') && system.location.line === line + 1);\n return system ? `**system ${system.name}**\\n\\n${system.description ?? ''}\\n\\n${operationAvailability}` : null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry } from './completion-items';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\nimport { AuthoredEventSource } from './AuthoredEventSource';\nimport { AuthoredStream } from './AuthoredStream';\nimport { isSourceStreamName, isSourceStreamTypeName, sourceStreamPattern } from '@cratis/screenplay-compiler';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\nimport { responseAnalysis } from './response-analysis';\nimport { typeReferenceText } from './TypeReferenceSymbol';\n\nexport const eventSourceAvailability = 'Event sources, streams and declarative command routes are admitted in executable semantic model (ESM) v8. A route classifies events; it does not supply an identity destination. Property-path mappings and handler routes remain unadmitted (PLAY0268).';\n\nexport const specificationRouteAvailability = 'Specification event routes, including example routes, are admitted in executable semantic model (ESM) v8. Redelivery remains unadmitted (PLAY0268) (#433), independently of its locator route.';\n\nconst routePrefix = sourceStreamPattern('^\\\\s*stream\\\\s+(?:[A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)?\\\\.?)?$');\nconst keyPrefix = sourceStreamPattern('^\\\\s*streamId\\\\s*=\\\\s*([\\\\w.]*)$');\nconst identifierTypePrefix = sourceStreamPattern('^\\\\s*identifier\\\\s+[\\\\w.]*$');\nconst streamTypePrefix = sourceStreamPattern('^\\\\s*streamId\\\\s+[\\\\w.]*$');\n\nexport function analyzeEventSources(lines: string[], symbols?: DocumentSymbols) {\n symbols = symbolsForBuffer(lines, symbols);\n return responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath, symbols?.authoringPlacementResolved).eventSources;\n}\n\nexport function eventSourceDetails(source: AuthoredEventSource, stream?: AuthoredStream): string {\n return [`**${stream ? `stream ${source.name}.${stream.name}` : `eventsource ${source.name}`}**`,\n stream?.description ?? source.description ?? '',\n source.identifier ? `Identifier type: ${typeReferenceText(source.identifier)}` : 'No identifier type declared.',\n stream ? stream.streamIdParts.length > 0 ? `Stream id parts: ${stream.streamIdParts.map(part => `${part.name} ${typeReferenceText(part.type)}`).join(', ')}` : stream.streamId ? `Stream id type: ${typeReferenceText(stream.streamId)}` : 'Unkeyed stream.' : source.streams.map(stream => `${stream.name}${stream.streamIdParts.length > 0 ? ` \u2014 ${stream.streamIdParts.map(part => `${part.name} ${typeReferenceText(part.type)}`).join(', ')}` : stream.streamId ? ` \u2014 ${typeReferenceText(stream.streamId)}` : ' \u2014 unkeyed'}`).join('\\n'),\n (stream?.id ?? (!stream ? source.id : null)) ? 'Stored-name pin (rename-only metadata; not a semantic ID).' : '', eventSourceAvailability].filter(Boolean).join('\\n\\n');\n}\n\nexport function eventSourceReferenceAt(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols) {\n const analysis = analyzeEventSources(lines, symbols);\n const at = (route: typeof analysis.routes[number]) => {\n const location = route.referenceLocation;\n const name = `${route.eventSource}.${route.stream}`;\n return location?.line === line + 1 && start >= location.column && end <= location.column + name.length &&\n withoutComment(lines[line] ?? '').slice(location.column - 1, location.column - 1 + name.length) === name;\n };\n const candidate = analysis.ambiguousCandidates.find(at);\n if (candidate) return { route: candidate, resolution: { state: 'ambiguous', source: undefined, stream: undefined }, target: undefined };\n const route = analysis.routes.find(at);\n if (!route) return null;\n const resolution = analysis.resolve(route.eventSource, route.stream);\n const sourcePart = end <= route.referenceLocation!.column + route.eventSource.length;\n return { route, resolution, target: resolution.state === 'unique' ? sourcePart ? resolution.source : resolution.stream : undefined };\n}\n\n// The location is a typed header start. Match its exact prefix, never search comments or another\n// occurrence of the same name. Both hosts use this to navigate to the authored identifier.\nexport function eventSourceIdentifier(location: { line: number; column: number; path?: string }, name: string, source: string) {\n const line = withoutComment(source.split(/\\r?\\n/)[location.line - 1] ?? '');\n const prefix = line.slice(location.column - 1).match(/^(?:eventsource|stream)\\s+/)?.[0];\n return prefix && line.slice(location.column - 1 + prefix.length, location.column - 1 + prefix.length + name.length) === name\n ? { ...location, column: location.column + prefix.length } : undefined;\n}\n\nexport function eventSourceHover(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols): string | null {\n symbols = symbolsForBuffer(lines, symbols);\n const analysis = analyzeEventSources(lines, symbols);\n const reference = eventSourceReferenceAt(lines, line, start, end, symbols);\n if (reference) return reference.resolution.source && reference.resolution.stream ? eventSourceDetails(reference.resolution.source, reference.resolution.stream) + (analysis.contexts.get(line)?.event ? `\\n\\n${specificationRouteAvailability}` : '')\n : `Physical stream owner: ${reference.resolution.state}; no route selected. ${'reasons' in reference.resolution ? reference.resolution.reasons.join(' ') : ''} ${eventSourceAvailability}`;\n const context = analysis.contexts.get(line);\n if (context?.event?.noStream?.location.line === line + 1 && start >= context.event.noStream.location.column && end <= context.event.noStream.location.column + 9)\n return `Assert an unrouted event; omitting a route on then leaves it unasserted. ${specificationRouteAvailability}`;\n if (context?.event && context.route?.streamId?.location.line === line + 1 && start === context.route.streamId.location.column && end === start + 8)\n return `Concrete literal stream id, not a command property mapping. ${specificationRouteAvailability}`;\n const blockLocation = context?.route?.directiveLocations?.streamId ?? context?.stream?.directiveLocations?.streamId;\n if (blockLocation?.line === line + 1 && start === blockLocation.column && end === start + 8)\n return `Composite stream id: named parts, not a pre-joined value. ${context?.event ? specificationRouteAvailability : eventSourceAvailability}`;\n for (const part of context?.route?.streamIdParts ?? []) {\n if (part.location.line === line + 1 && start === part.location.column && end === start + part.property.length)\n return `Authored stream id part **${part.property}**. ${context?.event ? `Concrete literal. ${specificationRouteAvailability}` : eventSourceAvailability}`;\n }\n const declaration = context?.stream ?? context?.source;\n if (declaration) {\n const name = eventSourceIdentifier(declaration.location, declaration.name, lines.join('\\n'));\n if (name?.line === line + 1 && start === name.column && end === start + declaration.name.length && context?.source) {\n const confidence = analysis.resolve(context.source.name, context.stream?.name);\n return eventSourceDetails(context.source, context.stream) + (confidence.state === 'unique' ? '' : `\\n\\nPhysical ownership: ${confidence.state}. ${confidence.reasons.join(' ')}`);\n }\n }\n const mapping = context?.route ? [context.route.streamId, ...context.route.streamIdParts].find(mapping => mapping?.location.line === line + 1) : undefined;\n if (mapping && context?.command) {\n if (mapping.location.line === line + 1 && start === mapping.location.column && end === start + 8)\n return `Authored stream id mapping. ${eventSourceAvailability}`;\n const expression = mapping.source as { kind?: string; path?: string; location?: { line: number; column: number } };\n if (expression.kind === 'PathExpressionSyntax' && expression.path && expression.location?.line === line + 1 &&\n start >= expression.location.column && end <= expression.location.column + expression.path.length) {\n const typed = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath, symbols?.authoringPlacementResolved);\n const prefix = expression.path.slice(0, end - expression.location.column);\n const parts = prefix.split('.');\n let properties = context.command.properties;\n let optional = false;\n let collection = false;\n for (const [index, part] of parts.entries()) {\n const matches = properties.filter(property => property.name === part);\n if (matches.length !== 1) break;\n const property = matches[0];\n optional ||= property.type.isOptional;\n collection ||= property.type.isCollection;\n if (index === parts.length - 1)\n return `**${part}** \u2014 ${typeReferenceText({ ...property.type, isOptional: optional, isCollection: collection })}. Command source for authored stream id. ${eventSourceAvailability}`;\n const types = typed.operations.types.filter(type => type.name === property.type.name);\n if (types.length !== 1 || collection) break;\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n }\n }\n if (context?.source && /^\\s*id\\s+\"/.test(withoutComment(lines[line] ?? '')) && start === indentOf(lines[line]) + 1 && end === start + 2)\n return `Stored-name pin: rename-only metadata, not a semantic identity or an automatic refactor. ${eventSourceAvailability}`;\n const type = context?.stream?.streamIdParts.find(part => part.type.location?.line === line + 1)?.type ?? context?.stream?.streamId ?? context?.source?.identifier;\n if (type && type.location?.line === line + 1 && start >= type.location.column && end <= type.location.column + type.name.length)\n return `${typeReferenceText(type)} \u2014 authored ${context?.stream ? 'stream id' : 'identifier'} type. ${eventSourceAvailability}`;\n return null;\n}\n\nfunction streamIdHeader(lines: string[], line: number, owner: number): number | null {\n const indent = indentOf(lines[line] ?? '');\n for (let index = line - 1; index > owner; index--) {\n const text = withoutComment(lines[index]);\n if (!text.trim() || indentOf(text) >= indent) continue;\n return text.trim() === 'streamId' ? index : null;\n }\n return null;\n}\n\nexport function eventSourceCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n // .NET word characters are UTF-16 code units; supplementary letters are not identifiers.\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length || /[\\uD800-\\uDFFF]/.test(before)) return null;\n const analysis = analyzeEventSources(lines, symbols);\n const context = analysis.contexts.get(line);\n const indent = before.trim() ? indentOf(lines[line]) : before.length;\n if (context?.route && indent > indentOf(lines[context.route.location.line - 1])) {\n const stream = analysis.resolve(context.route.eventSource, context.route.stream).stream;\n if (stream?.streamIdParts.length) {\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const literal = (name: string) => {\n const primitive = typed.operations.concepts.find(concept => concept.name === name)?.type ?? name;\n return primitive === 'Int' ? '0' : primitive === 'Uuid' ? '\"00000000-0000-0000-0000-000000000000\"' : '\"${1:value}\"';\n };\n if (streamIdHeader(lines, line, context.route.location.line - 1) !== null) {\n const mapping = sourceStreamPattern('^\\\\s*([A-Za-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*([\\\\w.]*)$').exec(before);\n if (mapping) {\n const part = stream.streamIdParts.find(part => part.name === mapping[1]);\n if (!part) return [];\n if (context.event) return [{ label: part.name, insertText: literal(part.type.name), documentation: specificationRouteAvailability }];\n if (!context.command) return [];\n const concepts = typed.operations.concepts.filter(concept => concept.name === part.type.name);\n if (part.type.isOptional || part.type.isCollection || !(['String', 'Uuid'].includes(part.type.name) || concepts.length === 1 && ['String', 'Uuid', 'Int'].includes(concepts[0].type) && concepts[0].values.length === 0)) return [];\n const path = mapping[2].split('.');\n let properties = context.command.properties;\n for (const segment of path.slice(0, -1)) {\n const fields = properties.filter(property => property.name === segment && !property.type.isOptional && !property.type.isCollection);\n if (fields.length !== 1) return [];\n const types = typed.operations.types.filter(type => type.name === fields[0].type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n return properties.filter(property => isSourceStreamName(property.name) && property.type.name === part.type.name && !property.type.isOptional && !property.type.isCollection)\n .map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)} \u2014 command source for authored stream id. ${eventSourceAvailability}` }));\n }\n const mapped = new Set(context.route.streamIdParts.filter(part => part.location.line !== line + 1).map(part => part.property));\n return stream.streamIdParts.filter(part => !mapped.has(part.name) && part.name.startsWith(before.trim()))\n .map(part => ({ label: part.name, insertText: `${part.name} = ${context.event ? literal(part.type.name) : ''}`, documentation: context.event ? specificationRouteAvailability : eventSourceAvailability }));\n }\n if (/^\\s*(?:streamId)?$/.test(before)) return [{ label: 'streamId parts', insertText: `streamId\\n${stream.streamIdParts.map((part, index) => ` ${part.name} = ${context.event ? literal(part.type.name) : `\\${${index + 1}:source}`}`).join('\\n')}`, documentation: context.event ? specificationRouteAvailability : eventSourceAvailability }];\n return [];\n }\n }\n if (context?.event && indent > indentOf(lines[context.event.location.line - 1])) {\n if (context.route && indent > indentOf(lines[context.route.location.line - 1])) {\n const target = analysis.resolve(context.route.eventSource, context.route.stream).stream?.streamId;\n if (!target || context.route.streamId && context.route.streamId.location.line !== line + 1) return [];\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const primitive = typed.operations.concepts.find(concept => concept.name === target.name)?.type ?? target.name;\n const literal = primitive === 'Int' ? '0' : primitive === 'Uuid' ? '\"00000000-0000-0000-0000-000000000000\"' : '\"${1:value}\"';\n if (/^\\s*(?:streamId\\s*=\\s*)?$/.test(before) || 'streamId'.startsWith(before.trim()))\n return [{ label: 'streamId', insertText: before.includes('=') ? literal : `streamId = ${literal}`, documentation: `Concrete ${typeReferenceText(target)} literal. ${specificationRouteAvailability}` }];\n return [];\n }\n if (routePrefix.test(before) && (!context.event.stream || context.event.stream.location.line === line + 1) && !context.event.noStream) {\n const qualified = before.trim().split(/\\s+/)[1] ?? '';\n // Specification payload lines require '=', so imported value types cannot compete\n // with a route here as they do under a command. Physical ownership still must be unique.\n const targets = analysis.declarations.flatMap(source => source.streams.filter(stream => analysis.resolve(source.name, stream.name).state === 'unique')\n .map(stream => ({ name: `${source.name}.${stream.name}`, source, stream })));\n return targets.filter(target => isSourceStreamName(target.source.name) && isSourceStreamName(target.stream.name) && (!qualified.includes('.') || target.name.startsWith(qualified.slice(0, qualified.lastIndexOf('.') + 1))))\n .map(target => ({ label: target.name, insertText: qualified.includes('.') ? target.stream.name : target.name, documentation: `${eventSourceDetails(target.source, target.stream)}\\n\\n${specificationRouteAvailability}` }));\n }\n if (context.event.stream || context.event.noStream)\n return !before.trim() || 'stream'.startsWith(before.trim()) || 'no stream'.startsWith(before.trim()) ? [] : null;\n const entries = [{ label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: specificationRouteAvailability },\n ...(context.expectation ? [{ label: 'no stream', insertText: /^\\s*no\\s+/.test(before) ? 'stream' : 'no stream', documentation: `Assert an unrouted fact. ${specificationRouteAvailability}` }] : [])];\n const matching = entries.filter(entry => entry.label.startsWith(before.trim()));\n return matching.length > 0 ? matching : null;\n }\n if (context?.command && indent > indentOf(lines[context.command.location.line - 1]) &&\n (!context.route || indent <= indentOf(lines[context.route.location.line - 1])) && routePrefix.test(before)) {\n // A property named stream remains legal. Only offer routes whose complete-input\n // candidates have no known value-type competitor; never silently rewrite ambiguity.\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const names = new Set([...typed.operations.concepts, ...typed.operations.types].map(type => type.name));\n // targets already exclude competing imports from the authoritative parsed documents.\n // Scanned symbols can retain an import removed from the current unsaved buffer.\n const qualified = before.trim().split(/\\s+/)[1] ?? '';\n return analysis.targets.filter(target => isSourceStreamName(target.source.name) && isSourceStreamName(target.stream.name) && !names.has(target.name) && (!qualified.includes('.') || target.name.startsWith(qualified.slice(0, qualified.lastIndexOf('.') + 1))))\n .map(target => ({ label: target.name, insertText: qualified.includes('.') ? target.stream.name : target.name, documentation: eventSourceDetails(target.source, target.stream) }));\n }\n if (context?.route && context.command && indent > indentOf(lines[context.route.location.line - 1]) && keyPrefix.test(before)) {\n const target = analysis.resolve(context.route.eventSource, context.route.stream).stream?.streamId;\n if (!target) return [];\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const concepts = typed.operations.concepts.filter(concept => concept.name === target.name);\n const supported = ['String', 'Uuid'].includes(target.name) || concepts.length === 1 && ['String', 'Uuid', 'Int'].includes(concepts[0].type) && concepts[0].values.length === 0;\n if (!supported || target.isOptional || target.isCollection) return [];\n const parts = keyPrefix.exec(before)![1].split('.');\n let properties = context.command.properties;\n for (const part of parts.slice(0, -1)) {\n const matches = properties.filter(property => property.name === part);\n if (matches.length !== 1 || matches[0].type.isOptional || matches[0].type.isCollection) return [];\n const types = typed.operations.types.filter(type => type.name === matches[0].type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n return properties.filter(property => isSourceStreamName(property.name) && property.type.name === target.name && !property.type.isOptional && !property.type.isCollection)\n .map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)} \u2014 command source for authored stream id. ${eventSourceAvailability}` }));\n }\n if (context?.source && indent > indentOf(lines[context.source.location.line - 1])) {\n const ownsStream = context.stream && indent > indentOf(lines[context.stream.location.line - 1]);\n const partType = ownsStream && streamIdHeader(lines, line, context.stream!.location.line - 1) !== null && sourceStreamPattern('^\\\\s*[A-Za-z_]\\\\w*\\\\s+[\\\\w.]*$').test(before);\n if (partType || (ownsStream ? streamTypePrefix : identifierTypePrefix).test(before)) {\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const streamId = partType || /^\\s*streamId\\b/.test(before);\n return [...(streamId ? ['String', 'Uuid'] : ['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']), ...typed.operations.concepts.filter(concept => !streamId || ['String', 'Uuid', 'Int'].includes(concept.type) && concept.values.length === 0).map(concept => concept.name)]\n .filter(isSourceStreamTypeName).map(name => ({ label: name, insertText: name, documentation: eventSourceAvailability }));\n }\n if (/^\\s*$/.test(before)) return ownsStream ? [\n { label: 'streamId', insertText: 'streamId ${1:Type}', documentation: eventSourceAvailability },\n { label: 'streamId parts', insertText: 'streamId\\n ${1:first} ${2:Type}\\n ${3:second} ${4:Type}', documentation: eventSourceAvailability },\n { label: 'description', insertText: 'description \"${1:Description}\"', documentation: 'Authored description.' }\n ] : [\n { label: 'identifier', insertText: 'identifier ${1:Type}', documentation: eventSourceAvailability },\n { label: 'stream', insertText: 'stream ${1:Name}', documentation: eventSourceAvailability },\n { label: 'description', insertText: 'description \"${1:Description}\"', documentation: 'Authored description.' }\n ];\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, indentOf, withoutComment } from './document-context';\n\n// Return only an enclosing invocation branch, never a sibling branch or quoted/code content.\nexport function refusalContext(lines: string[], lineIndex: number, indent: number): string | undefined {\n const fences = fenceMap(lines);\n const headers: string[] = [];\n for (let index = lineIndex - 1; index >= 0 && indent > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]);\n if (line.trim().length === 0 || indentOf(line) >= indent) continue;\n headers.push(line.trim());\n indent = indentOf(line);\n }\n const branch = headers.findIndex(header => /^on\\s+refused(?:\\s|$)/.test(header));\n return branch >= 0 && /^invokes\\s+/.test(headers[branch + 1] ?? '') && headers.some(header => /^reaction\\s+/.test(header)) ? headers[branch] : undefined;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { bmpWordCharacters } from './bmp-word-characters';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\n\n// The command property form, with the compiler/tokenizer BMP identifier boundary, including its existing optional severity/message suffixes.\nexport const commandNamedRulePattern = new RegExp(`^[${bmpWordCharacters}.]+\\\\s+rule\\\\s+[A-Za-z_][${bmpWordCharacters}]*(?:\\\\s+severity\\\\s+(?:information|warning|error))?(?:\\\\s+message\\\\s+.*)?$`);\n\nexport function namedRuleContext(lines: string[], lineIndex: number, indent: number): 'rule' | 'implementation' | null {\n const fences = fenceMap(lines);\n const owners: string[] = [];\n let boundary = indent;\n for (let index = lineIndex - 1; index >= 0 && boundary > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]).trimEnd();\n if (line.trim().length === 0 || indentOf(line) >= boundary) continue;\n owners.push(line.trim());\n boundary = indentOf(line);\n }\n const wrapped = owners[0] === 'implementation';\n const offset = wrapped ? 1 : 0;\n return commandNamedRulePattern.test(owners[offset] ?? '') && owners[offset + 1] === 'validate' && /^command\\s/.test(owners[offset + 2] ?? '')\n ? wrapped ? 'implementation' : 'rule' : null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, withoutComment } from './document-context';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\nimport { CompletionEntry } from './completion-items';\n\nexport function dependencyTargetCompletions(lines: string[], line: number, before: string, application: DocumentSymbols): CompletionEntry[] | null {\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length) return null;\n const match = before.match(/^\\s*depends\\s+on\\s+((?:[A-Za-z_]\\w*\\.)*)([A-Za-z_]\\w*)?$/);\n if (!match) return null;\n const symbols = symbolsForBuffer(lines, application);\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n return analysis.dependencies.completions(line, match[1], symbols.authoringPlacement);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DocumentSymbols } from './symbols';\n\nconst exampleUuid = '\"0f8fad5b-d9cb-469f-a165-70867728950e\"';\n\nconst primitiveExamples: Record<string, string> = {\n Uuid: exampleUuid,\n String: '\"Example\"',\n Int: '1',\n Decimal: '1.5',\n Bool: 'true',\n Date: '\"2026-01-15\"',\n DateTime: '\"2026-01-15T10:00:00Z\"',\n};\n\n// An example value to write in a specification for a property of the given type, resolving concepts\n// down to the primitive they wrap. Collections and unknown types fall back to a quoted string.\nexport function exampleValueFor(type: string, symbols: DocumentSymbols): string {\n const bare = type.replace(/\\s+optional$/, '').replace(/\\?$/, '');\n if (bare.endsWith('[]')) return '\"Example\"';\n const primitive = symbols.concepts.find(concept => concept.name === bare)?.primitive ?? bare;\n return primitiveExamples[primitive] ?? '\"Example\"';\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { exampleValueFor } from './example-values';\nimport { CommandSymbol, DocumentSymbols, PropertySymbol } from './symbols';\n\n// A multi-line suggestion shown as ghost text at the cursor. The text starts at the cursor and\n// continues on following lines with absolute indentation, so inserting it needs no further work.\nexport interface StructureCompletion {\n text: string;\n}\n\nfunction lastIndexWhere(lines: string[], matches: (line: string, index: number) => boolean): number {\n for (let index = lines.length - 1; index >= 0; index--) if (matches(lines[index], index)) return index;\n return -1;\n}\n\nconst upperCamelWords = (name: string) => name.match(/[A-Z][a-z0-9]*/g) ?? [name];\n\nfunction pastTense(verb: string): string {\n if (/[^aeiou]y$/i.test(verb)) return `${verb.slice(0, -1)}ied`;\n return /e$/i.test(verb) ? `${verb}d` : `${verb}ed`;\n}\n\n// The event a command most likely produces: a declared event that names its subject, else the\n// subject followed by the past tense of the command's verb - AddProduct becomes ProductAdded.\nfunction likelyEventName(command: string, symbols: DocumentSymbols): string {\n const [verb, ...subject] = upperCamelWords(command);\n const noun = subject.join('');\n const declared = symbols.events.find(event => noun.length > 0 && event.name.startsWith(noun));\n return declared?.name ?? `${noun}${pastTense(verb)}`;\n}\n\n\n// The indentation of one level in the document, learned from its first indented line.\nfunction indentUnit(lines: string[]): number {\n const indented = lines.map(indentOf).filter(indent => indent > 0);\n return indented.length === 0 ? 4 : Math.min(...indented);\n}\n\nfunction producesBlock(command: CommandSymbol, symbols: DocumentSymbols, indent: number, unit: number): string {\n const eventName = likelyEventName(command.name, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const inner = ' '.repeat(indent + unit);\n const sources = command.properties.filter(property => !property.isIdentifier);\n if (declared) {\n const mappings = declared.properties.filter(property => sources.some(source => source.name === property.name));\n const identifier = command.properties.find(property => property.isIdentifier);\n return [`produces ${eventName}`, ...(identifier ? [`${inner}for ${identifier.name}`] : []), ...mappings.map(property => `${inner}${property.name} = ${property.name}`)].join('\\n');\n }\n return [`produces event ${eventName}`, ...sources.map(property => `${inner}${property.name} ${property.type} = ${property.name}`)].join('\\n');\n}\n\n// What a command that has nothing yet most likely needs: the identity of the thing it acts on when a\n// concept for it is declared, the properties of the event it will most likely produce, and the production.\nfunction newCommandBlock(command: string, symbols: DocumentSymbols, indent: number, unit: number): string {\n const noun = upperCamelWords(command).slice(1).join('');\n const eventName = likelyEventName(command, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const identity = noun.length > 0 && symbols.concepts.some(concept => concept.name === `${noun}Id`) ? `${noun[0].toLowerCase()}${noun.slice(1)}Id` : undefined;\n const identityLine = identity ? [`${identity} ${noun}Id identifier`] : [];\n const inner = ' '.repeat(indent + unit);\n const properties = (declared?.properties ?? []).filter(property => property.name !== identity);\n const propertyLines = properties.map(property => `${' '.repeat(indent)}${property.name} ${property.type}`);\n const outcome = declared\n ? [`${' '.repeat(indent)}produces ${eventName}`, ...(identity ? [`${inner}for ${identity}`] : []), ...properties.map(property => `${inner}${property.name} = ${property.name}`)]\n : [`${' '.repeat(indent)}produces event ${eventName}`];\n const lines = [...identityLine.map((line, index) => (index === 0 ? line : `${' '.repeat(indent)}${line}`)), ...propertyLines, ...outcome];\n return lines.join('\\n').trimStart();\n}\n\nfunction assignments(properties: PropertySymbol[], symbols: DocumentSymbols, indent: number): string[] {\n return properties.map(property => `${' '.repeat(indent)}${property.name} = ${exampleValueFor(property.type, symbols)}`);\n}\n\n// The command the slice enclosing a line declares, with whether it carries an authorize clause.\nfunction sliceCommand(lines: string[], fences: boolean[], headerIndex: number, symbols: DocumentSymbols) {\n let sliceIndex = -1;\n for (let index = headerIndex - 1; index >= 0; index--) {\n if (!fences[index] && /^\\s*slice\\s/.test(lines[index]) && indentOf(lines[index]) < indentOf(lines[headerIndex])) { sliceIndex = index; break; }\n }\n if (sliceIndex < 0) return undefined;\n let name: string | undefined;\n let authorized = false;\n for (let index = sliceIndex + 1; index < lines.length; index++) {\n if (lines[index].trim().length === 0 || fences[index]) continue;\n if (indentOf(lines[index]) <= indentOf(lines[sliceIndex])) break;\n const command = lines[index].trim().match(/^command\\s+(\\w+)\\s*$/);\n if (command) { name = command[1]; authorized = false; continue; }\n if (name && /^authorize\\b/.test(lines[index].trim())) authorized = true;\n }\n const symbol = symbols.commands.find(candidate => candidate.name === name);\n return symbol ? { symbol, authorized } : undefined;\n}\n\nfunction specificationBlock(command: CommandSymbol, authorized: boolean, symbols: DocumentSymbols, indent: number, unit: number): string {\n const inner = indent + unit;\n const eventName = likelyEventName(command.name, symbols);\n const identifier = command.properties.find(property => property.isIdentifier);\n const sources = command.properties.filter(property => !property.isIdentifier);\n return [\n ...(authorized ? [`given caller`, `${' '.repeat(inner)}authenticated`] : []),\n ...(authorized ? [`${' '.repeat(indent)}when ${command.name}`] : [`when ${command.name}`]),\n ...assignments(command.properties, symbols, inner),\n `${' '.repeat(indent)}then ${eventName}`,\n ...(identifier ? [`${' '.repeat(inner)}for ${exampleValueFor(identifier.type, symbols)}`] : []),\n ...assignments(sources, symbols, inner),\n ].join('\\n');\n}\n\n// Suggests the structure a block most obviously needs next - the production of a command, the\n// skeleton of a specification, the fields of a form - when the cursor rests on an empty line directly\n// inside a block that has no content yet. Returns null when nothing is obviously missing.\nexport function structureCompletion(lines: string[], lineIndex: number, textBefore: string, textAfter: string, symbols: DocumentSymbols): StructureCompletion | null {\n if (textBefore.trim().length > 0 || textAfter.trim().length > 0) return null;\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n const previous = lastIndexWhere(lines.slice(0, lineIndex), line => withoutComment(line).trim().length > 0);\n if (previous < 0 || fences[previous]) return null;\n const unit = indentUnit(lines);\n const previousLine = lines[previous].trim();\n const opensEmptyBlock = /^(?:command\\s+\\w+|specification\\s+\\w+|form\\s+\\w+\\s+for\\s+[\\w.]+)\\s*$/.test(previousLine);\n // An empty block's body starts one level in; otherwise the cursor continues the lines above it.\n const indent = opensEmptyBlock ? Math.max(textBefore.length, indentOf(lines[previous]) + unit) : textBefore.length || indentOf(lines[previous]);\n const header = opensEmptyBlock ? previousLine : nearestEnclosingLine(lines, fences, lineIndex, indent);\n if (!header) return null;\n const headerIndent = opensEmptyBlock ? indentOf(lines[previous]) : indent - Math.max(1, unit);\n const pad = ' '.repeat(Math.max(0, indent - textBefore.length));\n const wrap = (block: string | undefined) => (block ? { text: `${pad}${block}` } : null);\n\n const command = header.match(/^command\\s+(\\w+)\\s*$/);\n if (command) {\n const symbol = symbols.commands.find(candidate => candidate.name === command[1]);\n const headerLine = lastIndexWhere(lines, (line, index) => index < lineIndex && line.trim() === header && indentOf(line) < indent);\n const body = lines.slice(headerLine + 1, lineIndex).filter(line => line.trim().length > 0);\n const hasOutcome = body.some(line => /^\\s*(produces|handler)\\b/.test(line));\n if (hasOutcome) return null;\n if (!symbol || symbol.properties.length === 0) return wrap(newCommandBlock(command[1], symbols, indent, unit));\n return wrap(producesBlock(symbol, symbols, indent, unit));\n }\n\n if (/^specification\\s+\\w+\\s*$/.test(header) && headerIndent >= 0) {\n const found = sliceCommand(lines, fences, previous, symbols);\n return found ? wrap(specificationBlock(found.symbol, found.authorized, symbols, indent, unit)) : null;\n }\n\n const form = header.match(/^form\\s+\\w+\\s+for\\s+(?:\\w+\\.)*(\\w+)\\s*$/);\n if (form) {\n const symbol = symbols.commands.find(candidate => candidate.name === form[1]);\n return symbol ? wrap(symbol.properties.map((property, index) => `${index === 0 ? '' : ' '.repeat(indent)}field ${property.name}`).join('\\n')) : null;\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\n\nexport type MonarchTokenRules = languages.IMonarchLanguage['tokenizer'][string];\n\nexport interface SubLanguageCompletion {\n label: string;\n insertText: string;\n documentation: string;\n}\n\nexport interface SubLanguageDefinition {\n tokens: MonarchTokenRules;\n completions?: SubLanguageCompletion[];\n hovers?: Record<string, string>;\n}\n\nexport interface SubLanguage extends SubLanguageDefinition {\n keyword: string;\n}\n\nconst subLanguages = new Map<string, SubLanguage>();\nconst listeners = new Set<() => void>();\n\nexport function registerSubLanguage(keyword: string, definition: SubLanguageDefinition): void {\n subLanguages.set(keyword, { keyword, ...definition });\n listeners.forEach((listener) => listener());\n}\n\nexport function getSubLanguages(): SubLanguage[] {\n return [...subLanguages.values()];\n}\n\nexport function getSubLanguage(keyword: string): SubLanguage | undefined {\n return subLanguages.get(keyword);\n}\n\nexport function onSubLanguagesChanged(listener: () => void): void {\n listeners.add(listener);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { namedRuleContext } from './named-rule-context';\nimport { responseCompletions } from './response-completions';\nimport { dependencyTargetCompletions } from './dependency-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { DocumentSymbols, scanDocument } from './symbols';\nimport { structureCompletion } from './structure-completions';\nimport { getSubLanguage } from './sub-language-registry';\nimport * as items from './completion-items';\nimport * as scope from './scope-items';\nimport { CompletionEntry } from './completion-items';\nimport { purposeItems } from './purpose-items';\n\n// Matches a validation rule line ending in \"rule <Name>\" (optionally followed by a\n// message clause) - both the command form (\"<property> rule <Name>\") and the\n// concept implied-subject form (\"rule <Name>\"). Its first word is the property\n// name, not \"rule\", so it can't be recognized through the chain[0] keyword switch\n// the way \"on <EventType>\" or \"handler\" are - hence the dedicated regex check.\nconst RULE_LINE_PATTERN = /(?:^|\\s)rule\\s+[A-Za-z_]\\w*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$/;\n\nexport type CompletionPlan =\n | { kind: 'none' }\n | { kind: 'entries'; entries: CompletionEntry[] }\n | { kind: 'contextVariables'; replaceLength: number }\n | { kind: 'playFiles'; replaceLength: number }\n | { kind: 'policies' }\n | { kind: 'events' }\n | { kind: 'triggers' }\n | { kind: 'commands' }\n | { kind: 'producesTargets' }\n | { kind: 'screens' }\n | { kind: 'queries' }\n | { kind: 'types' };\n\n// What the position sits inside, beyond the keyword chain: the whole header of each enclosing block, so a\n// slice's type and a template's kind are known, and the document's own lines, so a declaration that may\n// appear once is not offered again.\nexport interface CompletionScope {\n headers: readonly string[];\n document: readonly string[];\n}\n\nconst declaredIn = (document: readonly string[], keyword: string) => document.some(line => new RegExp(`^${keyword}\\\\b`).test(line));\n\nfunction topLevelEntries(document: readonly string[]): CompletionEntry[] {\n return items.topLevelItems.filter(item => !(item.label === 'domain' && declaredIn(document, 'domain')) && !(item.label === 'authentication' && declaredIn(document, 'authentication')));\n}\n\nconst isTemplate = (header: string | undefined) => /^(?:screen|dialog)\\s+template\\b/.test(header ?? '');\n\n// A whole block as one completion entry. Continuation lines are indented relative to the line it is inserted on,\n// which is how the editors indent a multi-line snippet.\nfunction expansionEntry(text: string, indent: number): CompletionEntry {\n const relative = text.split('\\n').map((line, index) => (index === 0 ? line : line.slice(Math.min(indent, indentOf(line))))).join('\\n');\n const label = text.split('\\n')[0].trim();\n return { label, insertText: relative.replace(/[$}\\\\]/g, '\\\\$&'), documentation: 'Expands the whole block from what the command and its events declare.' };\n}\n\nexport function completionEntriesFor(chain: string[], where: CompletionScope = { headers: [], document: [] }): CompletionEntry[] {\n const construct = chain[0];\n if (construct === undefined || construct === 'domain') return topLevelEntries(where.document);\n const subLanguage = getSubLanguage(construct);\n if (subLanguage) return subLanguage.completions ?? [];\n const header = where.headers[0];\n switch (construct) {\n case 'purpose':\n return purposeItems;\n case 'module':\n return items.moduleItems;\n case 'feature':\n return items.featureItems;\n case 'slice':\n return items.sliceItemsFor(header?.split(/\\s+/)[1]);\n case 'concept':\n return items.conceptItems;\n case 'type':\n return items.typeItems;\n case 'command':\n return items.commandItems;\n case 'public':\n case 'event':\n return items.eventItems;\n case 'readmodel':\n return scope.readModelItems;\n case 'reducer':\n return scope.reducerItems;\n case 'form':\n return scope.formItems;\n case 'contribute':\n return scope.contributeItems;\n case 'behavior':\n return scope.behaviorItems;\n case 'persona':\n return scope.personaItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'on':\n case 'success':\n case 'failure':\n case 'confirm':\n return scope.outcomeItems;\n case 'layout':\n return scope.layoutItems;\n case 'system':\n return items.operationItems.filter(item => item.label === 'description');\n case 'operation':\n return items.operationItems;\n case 'execute':\n case 'compensate':\n return items.operationPhaseItems;\n case 'produces':\n return items.producesItems;\n case 'handler':\n return items.handlerItems;\n case 'implementation':\n return chain[1] === 'handler' ? items.implementationItems : ['execute', 'compensate'].includes(chain[1]) ? items.operationImplementationItems : [];\n case 'query':\n return items.queryItems;\n case 'performer':\n return items.performerItems;\n case 'constraint':\n return items.constraintItems;\n case 'reaction':\n return items.reactionItems;\n case 'invokes':\n return chain.includes('reaction') ? items.invocationItems : [];\n case 'trigger':\n return items.triggerItems;\n case 'when':\n case 'every':\n case 'at':\n return chain.includes('reaction') ? items.reactionTriggerItems : [];\n case 'specification':\n return items.specificationItems;\n case 'policy':\n return items.policyItems;\n case 'validate':\n return items.validateItems;\n case 'action':\n return items.actionItems;\n case 'table':\n case 'summary':\n return items.tableItems;\n case 'screen':\n return isTemplate(header) ? scope.templateItems : items.screenItems;\n case 'dialog':\n return scope.templateItems;\n default:\n if (isTemplate(where.headers.find(candidate => isTemplate(candidate)))) return scope.templateItems;\n // Sections inside a screen expose the screen vocabulary.\n if (chain.includes('screen') || construct === 'section') return items.screenItems;\n if (chain.includes('produces')) return items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency \u2014 the\n// Monaco service and the VSCode extension both materialize the plan into items.\nexport function planCompletions(\n lines: string[],\n lineIndex: number,\n textBefore: string,\n symbols: DocumentSymbols = scanDocument(lines),\n): CompletionPlan {\n const fences = fenceMap(lines);\n if (fences[lineIndex] || withoutComment(textBefore).length < textBefore.length) return { kind: 'none' };\n if (/^\\s*concept\\s+[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]+\\s*:\\s*\\w+\\s+(?:(?:pii|personal|secret)\\s+)*\\w*$/u.test(textBefore)) {\n return { kind: 'entries', entries: ['pii', 'secret'].filter(marker => !new RegExp(`\\\\b${marker}\\\\b`).test(textBefore)).map(marker => ({ label: marker, insertText: marker, documentation: marker === 'pii' ? 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]' : 'Operational secret; renders [Encrypted] + [NotAudited].' })) };\n }\n const inConcept = enclosingChain(lines, fences, lineIndex, indentOf(textBefore))[0] === 'concept';\n if (inConcept && /^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['subject', 'namespace', 'global'].map(scope => ({ label: scope, insertText: scope, documentation: 'Explicit secret encryption scope.' })) };\n }\n if (inConcept && /^\\s*(?:pii|personal|@pii)\\s+special\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'].map(category => ({ label: category, insertText: category, documentation: 'GDPR Art. 9(1) special category.' })) };\n }\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const dependencyEntries = dependencyTargetCompletions(lines, lineIndex, textBefore, symbols);\n if (dependencyEntries !== null) return { kind: 'entries', entries: dependencyEntries };\n\n // Inside the quotes of a file import, what is wanted is a path - replacing what has been typed so far.\n const importPath = textBefore.match(/^\\s*import\\s+\"([^\"]*)$/);\n if (importPath) {\n return { kind: 'playFiles', replaceLength: importPath[1].length };\n }\n\n // A quote or a slash only asks for a completion inside an import path.\n if (/[\"/]$/.test(textBefore)) return { kind: 'none' };\n\n const refusal = refusalContext(lines, lineIndex, indentOf(lines[lineIndex] ?? textBefore));\n if (/\\$refusal\\.\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: refusal === undefined ? [] : ['reason', 'message', ...(/^on\\s+refused\\s+by\\s+constraint(?:\\s|$)/.test(refusal) ? ['constraint'] : [])].map(member => ({ label: member, insertText: member, documentation: 'String refusal value; syntax-only, not yet executable (PLAY0268).' })) };\n }\n const contextVariableMatch = textBefore.match(/\\$[\\w.]*$/);\n if (contextVariableMatch) {\n return { kind: 'contextVariables', replaceLength: contextVariableMatch[0].length };\n }\n\n const currentLine = lines[lineIndex] ?? '';\n const effectiveIndent =\n textBefore.trim().length === 0 ? textBefore.length : indentOf(currentLine);\n const chain = enclosingChain(lines, fences, lineIndex, effectiveIndent);\n if (chain.includes('screen')) {\n let parentIndent = effectiveIndent;\n let guarded = false;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*action\\s+(?:\"|\\$strings\\.)/.test(parent)) { guarded = true; break; }\n if (/^\\s*screen\\b/.test(parent)) break;\n }\n if (guarded) {\n if (/^\\s*(?:when\\b.*|otherwise)\\s+execute\\s+[\\w.]*$/.test(textBefore)) return { kind: 'commands' };\n if (chain[0] === 'action') return { kind: 'entries', entries: items.guardedActionItems };\n if (['when', 'otherwise'].includes(chain[0])) {\n const parent = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? '';\n return { kind: 'entries', entries: /\\bexecute\\s+[\\w.]+$/.test(parent) ? items.actionArgumentItems : [] };\n }\n }\n }\n if (['on', 'when', 'otherwise'].includes(chain[0])) {\n let parentIndent = effectiveIndent;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*on\\s+(?:click|double click|select)\\s*$/.test(parent)) {\n return { kind: 'entries', entries: chain[0] === 'on' ? items.interactionChoiceItems : items.interactionActionItems };\n }\n if (/^\\s*(?:screen|behavior|specification|reaction)\\b/.test(parent)) break;\n }\n }\n if (chain[0] === 'on' && refusal !== undefined) return { kind: 'entries', entries: items.refusalItems };\n const ruleContext = namedRuleContext(lines, lineIndex, effectiveIndent);\n if (ruleContext === 'implementation') return { kind: 'entries', entries: items.namedRuleImplementationItems };\n if (ruleContext === 'rule') return { kind: 'entries', entries: items.commandRuleItems };\n\n const propertyOwner = ['public', 'event', 'command', 'type', 'readmodel', 'trigger', 'when', 'every', 'at'].includes(chain[0]) ||\n (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const propertyName = textBefore.trimStart().split(/\\s+/)[0];\n const reservedProperty = (chain[0] === 'command' && ['reads', 'authorize', 'produces'].includes(propertyName)) ||\n (chain[0] === 'event' && propertyName === 'tag') ||\n (['trigger', 'when', 'every', 'at'].includes(chain[0]) && ['description', 'file', 'reads', 'produces', 'invokes'].includes(propertyName));\n const optionalPrefix = (match: RegExpMatchArray | null) => match !== null && 'optional'.startsWith(match[1]);\n const afterPropertyType = propertyOwner && !reservedProperty && optionalPrefix(textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const afterQueryType = (chain[0] === 'query' && optionalPrefix(textBefore.match(/^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/))) ||\n optionalPrefix(textBefore.match(/^\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const eventPropertyOwner = chain[0] === 'event' || (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const subjectModifier = eventPropertyOwner && !reservedProperty ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/) : null;\n const subjectConcept = symbols.concepts.find(concept => concept.name === subjectModifier?.[1]);\n const subjectType = subjectConcept?.primitive ?? subjectModifier?.[1];\n const subjectTarget = (subjectType === 'String' || subjectType === 'Uuid' || (subjectType === 'Int' && subjectConcept !== undefined)) &&\n !subjectConcept?.attributes.some(attribute => ['pii', 'personal', 'secret', 'sensitive'].includes(attribute.replace(/^@/, '')));\n const afterSubjectType = subjectModifier !== null && subjectTarget && 'subject'.startsWith(subjectModifier[2]);\n const modifierEntries = [\n ...((afterPropertyType || afterQueryType) && !/=>\\s*observable\\s+$/.test(textBefore) ? items.optionalTypeItems : []),\n ...(afterSubjectType ? [{ label: 'subject', insertText: 'subject', documentation: 'One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.' }] : []),\n ];\n if (modifierEntries.length > 0) return { kind: 'entries', entries: modifierEntries };\n\n if (/\\bauthorize\\s+[\\w\\s]*$/.test(textBefore) || chain[0] === 'authorize') {\n return { kind: 'policies' };\n }\n if (/\\bwhen\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'triggers' };\n }\n if (/\\bon\\s+\\w*$/.test(textBefore) && chain.includes('constraint')) {\n return { kind: 'events' };\n }\n if (/\\binvokes\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'commands' };\n }\n if (/\\b(?:on|unique\\s+event)\\s+\\w*$/.test(textBefore) && chain[0] === 'constraint') {\n return { kind: 'events' };\n }\n if (/\\bproduces\\s+\\w*$/.test(textBefore)) {\n return { kind: 'producesTargets' };\n }\n if (/\\bnavigate\\s+to\\s+\\w*$/.test(textBefore)) {\n return { kind: 'screens' };\n }\n if (chain[0] === 'specification') {\n if (/^\\s*when\\s+query\\s+[\\w.]*$/.test(textBefore)) return { kind: 'queries' };\n const step = textBefore.match(/^\\s*(given|when|then)\\s+\\w*$/);\n if (step) return { kind: 'entries', entries: items.specificationStepItems[step[1] as 'given' | 'when' | 'then'] };\n }\n if (/\\b(?:via|then)\\s+query\\s+[\\w.]*$/.test(textBefore)) {\n return { kind: 'queries' };\n }\n if (\n (chain[0] === 'event' || chain[0] === 'command' || chain[0] === 'type') &&\n /^\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)\n ) {\n return { kind: 'types' };\n }\n if (chain[0] === 'query' && /^\\s+(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) {\n return { kind: 'types' };\n }\n\n const enclosingLine = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent);\n if (enclosingLine && /^produces\\s+operation\\b/.test(enclosingLine)) return { kind: 'entries', entries: items.operationItems };\n if (enclosingLine && /^produces\\s+event\\b/.test(enclosingLine)) {\n if (/^\\s+@?[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) return { kind: 'types' };\n return { kind: 'entries', entries: items.inlineEventItems };\n }\n if (enclosingLine && RULE_LINE_PATTERN.test(enclosingLine)) {\n return { kind: 'entries', entries: items.ruleItems };\n }\n\n const headers = enclosingHeaders(lines, fences, lineIndex, effectiveIndent);\n if (chain[0] === 'for' && chain.includes('seed')) return { kind: 'events' };\n const entries = completionEntriesFor(chain, { headers, document: lines });\n const expansion = chain[0] === 'command' ? structureCompletion(lines, lineIndex, ' '.repeat(effectiveIndent), '', symbols) : null;\n return { kind: 'entries', entries: expansion ? [expansionEntry(expansion.text, effectiveIndent), ...entries] : entries };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, languages } from 'monaco-editor';\nimport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nimport { Monaco, primitiveTypes } from './language';\nimport { DocumentSymbols, knownEventNames, knownTriggerNames, symbolsForBuffer } from './symbols';\nimport { responseCompletions } from './response-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { operationCompletions } from './operation-authoring';\nimport { eventSourceCompletions } from './event-source-authoring';\nimport { planCompletions } from './completion-planner';\nimport { contextVariableItems, producesItems, CompletionEntry } from './completion-items';\n\n// What a host knows beyond the one model the editor holds.\nexport interface CompletionOptions {\n // The paths a file import written in the model can name, relative to the model's folder - typically\n // importablePaths over the host's .play files. Without it, an import path is not completed.\n playFiles?: (model: editor.ITextModel) => readonly string[];\n application?: (model: editor.ITextModel) => DocumentSymbols;\n // Notify after changing application documents or placement, even when this buffer is unchanged.\n onDidChangeApplication?: (listener: () => void) => { dispose(): void };\n}\n\nexport function createCompletionProvider(monaco: Monaco, options: CompletionOptions = {}): languages.CompletionItemProvider {\n return {\n triggerCharacters: [' ', '$', '@', '.', '\"', '/'],\n\n provideCompletionItems(model, position) {\n const lines = model.getLinesContent();\n const lineIndex = position.lineNumber - 1;\n const currentLine = lines[lineIndex] ?? '';\n const textBefore = currentLine.substring(0, position.column - 1);\n const application = options.application?.(model);\n const symbols = symbolsForBuffer(lines, application);\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore, symbols) ?? eventSourceCompletions(lines, lineIndex, textBefore, symbols) ?? operationCompletions(lines, lineIndex, textBefore, symbols) ?? responseCompletions(lines, lineIndex, textBefore, symbols);\n const plan = responseEntries === null ? planCompletions(lines, lineIndex, textBefore, symbols) : { kind: 'entries' as const, entries: responseEntries };\n if (plan.kind === 'none') return { suggestions: [] };\n\n const word = model.getWordUntilPosition(position);\n const range = new monaco.Range(\n position.lineNumber,\n word.startColumn,\n position.lineNumber,\n word.endColumn,\n );\n const kinds = monaco.languages.CompletionItemKind;\n const asSnippet = monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;\n\n const snippet = (entry: CompletionEntry): languages.CompletionItem => ({\n label: entry.label,\n kind: entry.insertText.includes('$') ? kinds.Snippet : kinds.Keyword,\n insertText: entry.insertText,\n insertTextRules: asSnippet,\n documentation: entry.documentation,\n sortText: entry.sortText,\n detail: entry.detail,\n range,\n });\n const symbolItem = (\n name: string,\n kind: languages.CompletionItemKind,\n detail: string,\n ): languages.CompletionItem => ({\n label: name,\n kind,\n insertText: name,\n detail,\n range,\n });\n const eventNames = () => {\n const inlineNames = new Set(symbols.events.filter(event => event.inline).map(event => event.name));\n return [...new Set(knownEventNames(symbols))].map((name) => symbolItem(name, kinds.Event, inlineNames.has(name) ? 'inline event' : 'event'));\n };\n\n switch (plan.kind) {\n case 'playFiles': {\n const pathRange = new monaco.Range(\n position.lineNumber,\n position.column - plan.replaceLength,\n position.lineNumber,\n position.column,\n );\n return {\n suggestions: (options.playFiles?.(model) ?? []).map((path) => ({\n label: path,\n kind: path.includes('*') ? kinds.Folder : kinds.File,\n insertText: path,\n range: pathRange,\n })),\n };\n }\n case 'contextVariables': {\n const variableRange = new monaco.Range(\n position.lineNumber,\n position.column - plan.replaceLength,\n position.lineNumber,\n word.endColumn,\n );\n return {\n suggestions: contextVariableItems.map((entry) => ({\n ...snippet(entry),\n range: variableRange,\n })),\n };\n }\n case 'policies':\n return {\n suggestions: symbols.policies.map((policy) =>\n symbolItem(policy.name, kinds.Reference, 'policy'),\n ),\n };\n case 'events':\n return { suggestions: eventNames() };\n case 'triggers':\n return {\n suggestions: [...new Set(knownTriggerNames(symbols))].map((name) =>\n symbolItem(name, kinds.Event, 'trigger'),\n ),\n };\n case 'commands':\n return {\n suggestions: symbols.commands.map((command) =>\n symbolItem(command.name, kinds.Method, 'command'),\n ),\n };\n case 'producesTargets':\n return { suggestions: [...producesItems.map(snippet), ...eventNames()] };\n case 'screens':\n return {\n suggestions: symbols.screens.map((screen) =>\n symbolItem(screen.name, kinds.Interface, 'screen'),\n ),\n };\n case 'queries':\n return {\n suggestions: symbols.queries.map((query) =>\n symbolItem(query.name, kinds.Function, `query => ${typeReferenceText(query.returnTypeReference ?? typeReferenceSymbol(query.returnType))}`),\n ),\n };\n case 'types':\n return {\n suggestions: [\n ...symbols.concepts.map((concept) =>\n symbolItem(\n concept.name,\n kinds.Class,\n `concept : ${concept.primitive}${concept.attributes.length ? ' ' + concept.attributes.join(' ') : ''}`,\n ),\n ),\n ...symbols.types.map((type) =>\n symbolItem(\n type.name,\n kinds.Struct,\n `type (${type.properties.length} properties)`,\n ),\n ),\n ...primitiveTypes.map((primitive) =>\n symbolItem(primitive, kinds.Struct, 'primitive'),\n ),\n ],\n };\n case 'entries':\n return { suggestions: plan.entries.map(snippet) };\n }\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport type { CompletionOptions } from './completions';\nimport { structureCompletion } from './structure-completions';\nimport { symbolsForBuffer } from './symbols';\n\n// Ghost text for the structure a block obviously needs next, from the compiler's own model.\nexport function createInlineCompletionProvider(options: CompletionOptions): languages.InlineCompletionsProvider {\n return {\n provideInlineCompletions(model, position) {\n const lines = model.getLinesContent();\n const lineIndex = position.lineNumber - 1;\n const line = lines[lineIndex] ?? '';\n const symbols = symbolsForBuffer(lines, options.application?.(model));\n const suggestion = structureCompletion(lines, lineIndex, line.substring(0, position.column - 1), line.substring(position.column - 1), symbols);\n if (!suggestion) return { items: [] };\n // The suggestion replaces the indentation before the cursor, so it starts with indentation of its own -\n // the editors take Tab as 'indent' rather than 'accept' for a suggestion that does not.\n return { items: [{ insertText: `${line.substring(0, position.column - 1)}${suggestion.text}`, range: { startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column } }] };\n },\n disposeInlineCompletions() {},\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols } from './symbols';\nimport { withoutComment } from './document-context';\n\nexport const responseTokenTypes = ['keyword', 'property', 'type'] as const;\n\n// Semantic overlays resolve the local returns ambiguity that a line-based grammar cannot.\nexport function responseTokens(lines: string[], symbols?: DocumentSymbols): { line: number; column: number; length: number; type: number }[] {\n const tokens: { line: number; column: number; length: number; type: number }[] = [];\n const add = (line: number, column: number, length: number, type: number) => {\n const source = lines[line - 1];\n if (source === undefined || column < 1 || length < 1) return;\n const start = column - 1 + (source[column - 1] === '@' ? 1 : 0);\n if (start + length <= source.length) tokens.push({ line: line - 1, column: start, length, type });\n };\n const path = symbols?.authoringPath ?? 'current.play';\n const analysis = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, path, symbols?.authoringPlacementResolved);\n for (const source of analysis.eventSources.declarations.filter(source => source.location.path === path)) {\n add(source.location.line, source.location.column, 11, 0);\n if (source.identifier) add(source.identifier.location.line, source.identifier.location.column, source.identifier.name.length, 2);\n for (const stream of source.streams) {\n add(stream.location.line, stream.location.column, 6, 0);\n if (stream.streamId) add(stream.streamId.location.line, stream.streamId.location.column, stream.streamId.name.length, 2);\n const header = stream.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of stream.streamIdParts) {\n add(part.location.line, part.location.column, part.name.length, 1);\n add(part.type.location.line, part.type.location.column, part.type.name.length, 2);\n }\n }\n }\n for (const route of analysis.eventSources.routes) {\n add(route.location.line, route.location.column, 6, 0);\n if (route.referenceLocation) add(route.referenceLocation.line, route.referenceLocation.column, `${route.eventSource}.${route.stream}`.length, 2);\n if (route.streamId) add(route.streamId.location.line, route.streamId.location.column, 8, 0);\n const header = route.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of route.streamIdParts) add(part.location.line, part.location.column, part.property.length, 1);\n }\n for (const command of analysis.commands.values()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const source = withoutComment(lines[property.location.line - 1] ?? '');\n add(property.location.line, source.lastIndexOf('generated') + 1, 9, 0);\n }\n const response = command.response;\n if (!response) continue;\n add(response.location.line, response.location.column, 7, 0);\n if (response.kind === 'ScalarCommandResponseSyntax') {\n add(response.source.location.line, response.source.location.column, response.source.property.length, 1);\n } else for (const field of response.fields) {\n add(field.location.line, field.location.column, field.name.length, 1);\n add(field.source.location.line, field.source.location.column, field.source.property.length, 1);\n if (field.type) add(field.type.location.line, field.type.location.column, field.type.name.length, 2);\n }\n }\n for (const specification of analysis.specifications.values()) {\n for (const event of specification.thenEvents ?? []) {\n if (event.noStream) add(event.noStream.location.line, event.noStream.location.column, 9, 0);\n }\n for (const fixture of specification.when?.generatedValues ?? []) {\n add(fixture.location.line, fixture.location.column, 9, 0);\n }\n if (specification.thenReturns) add(specification.thenReturns.location.line, (lines[specification.thenReturns.location.line - 1] ?? '').indexOf('returns') + 1, 7, 0);\n }\n for (const system of analysis.operations.systems.filter(system => system.location.path === path)) {\n add(system.location.line, system.location.column, 6, 0);\n }\n for (const operation of analysis.operations.declarations.filter(operation => operation.location.path === path)) {\n const header = withoutComment(lines[operation.location.line - 1] ?? '');\n const keyword = header.indexOf('operation', operation.location.column - 1);\n if (keyword >= 0) add(operation.location.line, keyword + 1, 9, 0);\n for (const input of operation.inputs) {\n add(input.location.line, input.location.column, input.name.length, 1);\n add(input.type.location.line, input.type.location.column, input.type.name.length, 2);\n }\n if (operation.usesLocation) add(operation.usesLocation.line, (lines[operation.usesLocation.line - 1] ?? '').indexOf('uses') + 1, 4, 0);\n for (const phase of [operation.execute, operation.compensate]) {\n if (!phase) continue;\n const name = withoutComment(lines[phase.location.line - 1] ?? '').trim();\n add(phase.location.line, phase.location.column, name.length, 0);\n if (phase.implementation) add(phase.implementation.location.line, phase.implementation.location.column, 14, 0);\n for (const hint of phase.implementation?.hints ?? []) add(hint.location.line, hint.location.column, 4, 0);\n }\n }\n // Overlays never overlap or duplicate a typed token, even with recovered malformed syntax.\n const ordered = tokens.sort((left, right) => left.line - right.line || left.column - right.column);\n return ordered.filter((token, index) => index === 0 || token.line !== ordered[index - 1].line || token.column >= ordered[index - 1].column + ordered[index - 1].length);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, fenceMap, indentOf, withoutComment } from './document-context';\nimport { ReactionReference } from './ReactionReference';\nimport { directBody, DocumentSymbols, NamedSymbol, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\n\n// Resolve only a reaction's named occurrence, never a specification step, comment or native fence.\n// Both editors use the same event/import/declared-trigger precedence, including unsaved buffers.\nexport function reactionReferenceAt(lines: string[], lineIndex: number, startColumn: number, endColumn: number, application?: DocumentSymbols): ReactionReference | null {\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n const line = withoutComment(lines[lineIndex] ?? '');\n const match = line.match(/^\\s*when\\s+([A-Za-z_][\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]*)\\s*$/u);\n if (!match || enclosingChain(lines, fences, lineIndex, indentOf(line))[0] !== 'reaction') return null;\n const name = match[1];\n const column = line.indexOf(name, line.indexOf('when') + 4) + 1;\n if (startColumn !== column || endColumn !== column + name.length) return null;\n const current = application?.authoringPath ?? 'current.play';\n const documents = [...(application?.authoringDocuments ?? []).filter(document => document.path !== current), { path: current, source: lines.join('\\n') }];\n const scanned = documents.map(document => ({ ...document, lines: document.source.split(/\\r?\\n/), symbols: scanDocument(document.source.split(/\\r?\\n/)) }));\n const events = scanned.flatMap(document => {\n const named = document.symbols.events.filter(event => event.name === name);\n const generation = Math.max(...named.map(event => event.generation ?? 1));\n return named.filter(event => (event.generation ?? 1) === generation).map(event => ({ document, declaration: event }));\n });\n const selected = (matches: { document: typeof scanned[number]; declaration: NamedSymbol }[]): ReactionReference => {\n if (matches.length !== 1) return { name, content: null, target: null };\n const { document, declaration } = matches[0];\n const body = directBody(document.lines, fenceMap(document.lines), declaration.line, indentOf(document.lines[declaration.line]));\n const content = [document.lines[declaration.line].trim(), ...body.map(line => document.lines[line].trim())].join('\\n');\n const prefix = document.lines[declaration.line].match(/\\b(?:event|trigger)\\s+/)!;\n return { name, content: `\\`\\`\\`screenplay\\n${content}\\n\\`\\`\\``, target: { name, location: { path: document.path, line: declaration.line + 1, column: prefix.index! + prefix[0].length + 1 }, source: document.source } };\n };\n if (events.length > 0) return selected(events);\n // A host may supply symbols without physical documents. Hover their event shape, but\n // never invent a definition location or fall through to a shadowed local trigger.\n if (application?.authoringDocuments === undefined) {\n const known = application?.events.filter(event => event.name === name) ?? [];\n if (known.length > 0) {\n const generation = Math.max(...known.map(event => event.generation ?? 1));\n const current = known.filter(event => (event.generation ?? 1) === generation);\n const content = current.length === 1 ? `\\`\\`\\`screenplay\\nevent ${name}\\n${current[0].properties.map(property => `${property.name} ${typeReferenceText(propertyTypeReference(property))}`).join('\\n')}\\n\\`\\`\\`` : null;\n return { name, content, target: null };\n }\n }\n const imports = [...scanned.flatMap(document => document.symbols.imports), ...(application?.authoringDocuments === undefined ? application?.imports ?? [] : [])].filter(imported => imported.shortName === name);\n if (imports.length > 0) return { name, content: imports.length === 1 ? `\\`\\`\\`screenplay\\nimport ${imports[0].qualifiedName}\\n\\`\\`\\`` : null, target: null };\n const triggers = scanned.flatMap(document => document.symbols.triggers.filter(trigger => trigger.name === name).map(trigger => ({ document, declaration: trigger })));\n return selected(triggers);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { eventContextPaths } from './event-context';\n\n// These words are contextual beneath a handler, never global property keywords.\nexport const handlerIntentDocs = {\n implementation: 'Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.',\n hint: 'One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code.',\n};\n\nexport const keywordDocs: Record<string, string> = {\n parameter: 'A typed value declared by a specification table, or an argument of a named behavior. Table types are required; every case supplies each parameter exactly once.',\n case: 'One named concrete row of a specification table, expanded as <Specification>_<Case>. Use case.<parameter> for a whole step value.',\n example: 'One typed, possibly partial fixture: `example <Name> : <EventOrCommandOrReadModel>`. Use its name in a matching specification step; assignments override example values without changing matching or supplying defaults. Event examples may carry stream or no stream; a step replaces that route as a whole.',\n domain: 'The domain the file belongs to \u2014 optional, at most one per file, before everything else.',\n import: 'Imports a type from another module by its qualified name \u2014 `import Module.Type` \u2014 making it available by its short name; or, quoted, other `.play` files by path or glob \u2014 `import \"Orders/**/*.play\"`, relative to this file\\'s folder. Written inside a module or feature, a file import places the imported files there: their top level is that module\\'s or feature\\'s body. `import Module.Event from \"origin\"` is instead public contract metadata with an opaque origin; executable binding refuses it with PLAY0268.',\n concept: 'A formalized value type wrapping a primitive. Bare pii and secret markers travel with every usage, with optional concept notes and qualifiers.',\n type: 'A composite value type \u2014 a named shape built from several properties, referenced by events, commands and other types the same way a concept is.',\n reason: 'A free-text concept note, not a lawful basis. Written as pii reason \"...\" or secret reason \"...\"; migration preserves it verbatim.',\n optional: 'Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.',\n identifier: 'Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.',\n policy: 'A named authorization rule referenced by commands and queries. Multiple policies AND together.',\n purpose: 'A report-only processing declaration (GDPR Art. 30), referenced on modules, features and slices. Coverage is their union, not an authorization gate. Generated declarations are not legal advice.',\n basis: 'One declared Art. 6(1) basis: consent, contract, legalObligation, vitalInterests, publicTask or legitimateInterests; an optional quoted reference may follow.',\n interest: 'The legitimate-interest statement for basis legitimateInterests (Art. 13(1)(d)).',\n condition: 'One Art. 9(2) processing condition, optionally followed by a quoted reference.',\n subjects: 'Comma-separated categories of data subjects, as open identifiers.',\n retention: 'Declared retention period or criteria, not enforced by the model or Chronicle.',\n recipient: 'A quoted recipient category; repeatable on a purpose.',\n transfer: 'A declared destination followed by safeguard and quoted safeguards; repeatable.',\n safeguard: 'The declared safeguard accompanying a third-country transfer.',\n erasure: 'An erasure exception under Art. 17(3); Chronicle crypto-shredding remains per subject, not per purpose.',\n exception: 'One declared Art. 17(3) exception: expression, legalObligation, publicTask, publicHealth, archiving or legalClaims.',\n persona: 'A named role interacting with the application, with an optional description and its associated policies.',\n authentication: 'Declares the identity providers of the application \u2014 at most one block per file.',\n provider: 'A named identity provider within `authentication`, with free-form `name value` settings.',\n description: 'A human-readable description, including the rule or case a specification witnesses, as a quoted single line or a fenced ```text block for multiple lines.',\n depends: 'Declares `depends on <Name>` on a module or feature. This opts only that container into checking counted explicit references against its own declarations; it does not change executable bytes.',\n module: 'The top-level namespace \u2014 maps to a bounded context.',\n layout: 'A reusable screen template with named slots.',\n template: 'Declares the named slots of a layout.',\n feature: 'A vertical slice grouping. Features nest arbitrarily deep.',\n slice: 'The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.',\n public: 'Marks an event as a public contract. An event with from \"origin\" is also public. Origin is opaque, not a path or declaration reference. Public events and origins are admitted by executable semantic model (ESM) v9.',\n direction: 'Declare direction inbound or direction outbound once inside a Translate slice. Admitted by executable semantic model (ESM) v9; a Translate slice that uses public events must declare it (PLAY0614).',\n inbound: 'Inbound Translate direction metadata. No transport or delivery guarantee is implied.',\n outbound: 'Outbound Translate direction metadata. No transport or delivery guarantee is implied.',\n event: 'An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.',\n documentation: 'Authoring-only reasoning on a module, feature, slice, command, event, read model or reaction in one nonempty fenced ```markdown block. It does not change executable model bytes.',\n id: 'Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.',\n command: 'An imperative intent. Declares authorization, validation, and what events it produces \u2014 declaratively, or via a full handler.',\n query: 'A read-side entry point mapping to a return type, with an optional description, parameters and performer.',\n observable: 'Qualifies a query return type as a live read \u2014 `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.',\n performer: 'The code that performs a query \u2014 a `file <Path>` reference or an inline `csharp`/`sql` block. The query\\'s counterpart to a command handler.',\n from: 'Fills a query parameter from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.',\n projection: 'Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).',\n capture: 'Converts external data into events, using the embedded Change Data Capture Language (CDL).',\n reaction: 'Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own \u2014 `file`/code is optional realization metadata.',\n trigger: 'Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.',\n where: 'Narrows which occurrences actually run the reaction.',\n contains: 'Text comparison \u2014 true when the left string holds the right one anywhere.',\n every: 'Runs a reaction on an interval \u2014 `every 15 minutes`, `every 1 day`.',\n refused: 'Ordered invocation refusal branch: first match wins. Bare `on refused` covers validation and constraints, not authorization. Syntax-only, not yet executable (PLAY0268).',\n acknowledge: 'A refusal branch acknowledges alone, or produces events instead. Syntax-only, not yet executable (PLAY0268).',\n validation: 'In `on refused by validation`, selects property, concept and require refusals. Syntax-only, not yet executable (PLAY0268).',\n authorization: 'In `on refused by authorization`, explicitly selects unauthorized results, never Unsupported. Syntax-only, not yet executable (PLAY0268).',\n redelivered: '`when redelivered <Event> to <Reaction>` selects exactly one effective given occurrence by optional for, stated values and stream or no stream, without appending it again. Syntax-only, not yet executable (PLAY0268).',\n invokes: 'A command a reaction hands on. A command is asked for, not produced \u2014 it may still be rejected.',\n screen: 'A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.',\n constraint: 'A server-side rule enforced in the Chronicle kernel before events are committed.',\n authorize: 'References the policies that must all pass for the construct to execute.',\n validate: 'Declarative validation rules, or `validate` followed by ```csharp for imperative rules \u2014 on commands and concepts.',\n produces: 'References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.',\n reads: 'Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. Repeated views require unique aliases. Runtime binding is not yet supported for command or reaction reads.',\n as: 'Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.',\n handler: 'A fully imperative command implementation \u2014 a `file <Path>` reference or an inline `csharp` block, instead of `produces`.',\n when: 'Guards a produced event or a capture append with a condition. In a labeled screen action, `when item.<field> == <literal> execute <Command>` selects the first matching command. Inside on click, double click or select, block-form `when <condition>` selects one whole action list at gesture time.',\n rule: 'Names a predicate. Bare, it states that a constraint exists without expressing what it computes \u2014 nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.',\n require: 'A policy condition: `authenticated`, `role \"...\"`, or `claim \"...\" matches ...`. Unary `not` negates a condition or group; precedence is not, and, or.',\n authenticated: 'Requires an authenticated caller.',\n role: 'Requires the caller to have the given role.',\n claim: 'Requires a claim on the caller to match a subject or value.',\n subject: 'In policy `matches subject`, the identifier of the thing acted on, not the caller. The caller is `$context.causedBy.subject`.',\n data: 'Binds a read model to a screen through a query.',\n action: 'Makes a command available on a screen. `action \"Label\"` declares one button with ordered `when \u2026 execute` alternatives over the nearest data item or selected row. No subject hides it; commands still enforce authorization and validation.',\n otherwise: 'The final fallback of a guarded action: `otherwise hidden` or `otherwise execute <Command>`. In an item interaction, bare `otherwise` opens a fallback action list. No subject runs nothing, including fallback; authorization never falls through.',\n hidden: 'Hides a guarded action when no condition matches. Without a subject the action is always hidden, even with an execute fallback.',\n execute: 'Executes a command. A guarded screen action selects it by the first matching condition; explicit `with \u2026 from` bindings precede same-name item fields, its declared form and renderer input.',\n navigate: 'Navigates to a screen, optionally passing a parameter with `by`.',\n section: 'A named structural section of a screen.',\n table: 'A table widget over a read model or child collection.',\n summary: 'A summary widget showing labeled fields.',\n column: 'A table column bound to a property.',\n field: 'A summary field bound to a property.',\n title: 'The display title of a screen or section.',\n label: 'The display label of an action, column, or field.',\n unique: 'A uniqueness constraint \u2014 `unique <property> on <EventType>` or `unique event <EventType>`.',\n concurrency: 'The concurrency scope enforced when the command appends events \u2014 dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.',\n eventSource: 'Concurrency dimension \u2014 scope the check to the event source id of the command.',\n sourceType: 'Concurrency dimension \u2014 scope the check to an event source type.',\n streamType: 'Concurrency dimension \u2014 scope the check to an event stream type.',\n streamId: 'Concurrency dimension \u2014 scope the check to an event stream id.',\n tag: 'Attaches a tag to appended events \u2014 a static identifier or string, or a `$context.` expression resolved at append time.',\n seed: 'Declares events to seed into the event store per event source id \u2014 multiple blocks accumulate.',\n for: 'Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.',\n readmodel: 'Declares a read model \u2014 its name and properties \u2014 in a slice, or, in a specification, read model state: `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.',\n reducer: 'Builds a read model from events with imperative code \u2014 `reducer <Name> => <ReadModel>` with an `on <EventType>` rule per event. Use it when a projection cannot express the transition.',\n specification: 'Given/when/then acceptance criteria for a slice: prior events and state, the command, query or appended event under test, and the events, state, results, errors or denials that follow.',\n dialog: 'A dialog opened over the shell, or with `dialog template` a reusable dialog shape.',\n form: 'A form bound to a command \u2014 `form <Name> for <Command>` with a `field` per input.',\n contribute: 'Contributes entries to a slot of the shell \u2014 `contribute to Navigation` with `navigate to`, `label` and `order`.',\n theme: 'A named theme and the component packages it is compatible with.',\n ui: 'A UI profile \u2014 `ui profile <Name>` binds a target platform and size to a layout, theme and packages.',\n behavior: 'A named interaction wiring of `on <interaction>` handlers, attached to a screen, form or dialog with `uses`.',\n system: 'An application-scoped external system that operations use.',\n eventsource: 'An application-owned event source with nested streams.',\n operation: 'A reusable operation intent that uses one external system.',\n no: 'A keyed absence assertion: `then no readmodel <View> for <key>`.',\n arguments: 'The values supplied to a query asserted by `then query`.',\n result: 'One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.',\n clock: 'The instant a specification happens at - `given clock \"2026-10-05T08:00:00Z\"` fixes when everything occurs; `when clock \"<instant>\"` is the clock reaching it, as the action.',\n exactly: 'Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.',\n file: 'Delegates the implementation to an external file; the Screenplay contract stays visible.',\n by: 'Introduces the identifying parameter.',\n via: 'Connects screen data to the query that supplies it.',\n filter: 'An optional query filter parameter.',\n on: 'The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.',\n message: 'The validation message reported when the rule fails.',\n matches: 'Matches a value against a regular expression or a named pattern such as `email`.',\n all: 'Applies a comparison to every element of a collection.',\n max: 'Maximum length or value.',\n min: 'Minimum length or value.',\n length: 'Constrains the exact length of a value.',\n today: 'The current date.',\n empty: 'Used with `not empty` \u2014 the value must be present.',\n not: 'Negates a validation condition, as in `not empty`.',\n and: 'Both conditions must hold.',\n or: 'Either condition may hold.',\n csharp: 'An inline C# block whose opening fence is ```csharp.',\n sql: 'An inline SQL block between triple backticks \u2014 a query performer written against a relational store.',\n typescript: 'An inline TypeScript block between triple backticks.',\n react: 'An inline React/TSX block; receives the surrounding data contract as `Props`.',\n html: 'An inline static HTML block.',\n StateChange: 'Slice type \u2014 a command \u2192 events flow; something that changes the system.',\n StateView: 'Slice type \u2014 a query + projection + screen; something that reads the system.',\n Automation: 'Slice type \u2014 a reaction or reducer; something that runs when something happens.',\n Translate: 'Slice type \u2014 a capture; converts external data into events.',\n Uuid: 'Primitive type \u2014 a universally unique identifier.',\n String: 'Primitive type \u2014 a string of characters.',\n Int: 'Primitive type \u2014 an integer number.',\n Decimal: 'Primitive type \u2014 a decimal number.',\n Bool: 'Primitive type \u2014 true or false.',\n Date: 'Primitive type \u2014 a date without time.',\n DateTime: 'Primitive type \u2014 a date and time.',\n Enum: 'An enumeration concept with a fixed set of values.',\n};\n\n// What the words of a specification's steps mean there - where 'trigger', 'capture' and 'query' name what the\n// scenario exercises rather than declare one.\nexport const specificationKeywordDocs: Record<string, string> = {\n parameter: 'Declares a required typed case value: `parameter <name> <Type>`. Every case assigns it once. `optional` permits literal null but supplies no default.',\n case: 'One named complete row of a specification table. `case.<parameter>` substitutes a whole value after example overrides; each row runs as `<Specification>_<Case>`.',\n caller: '`given caller` states an explicit identity; `given caller as <Persona>` synthesizes an authenticated deterministic witness of the persona, with no body. Leftmost buildable policy alternatives are significant.',\n clock: keywordDocs.clock,\n redelivered: keywordDocs.redelivered,\n trigger: '`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.',\n capture: '`given capture <Capture>` - a record the capture\\'s source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.',\n query: '`when query <Query>` - the query is performed, as the action, with its arguments on the lines beneath; assert what it returns with `then result` or `then no result`. `then query` instead asserts a query after another action.',\n events: '`then no events` - asserts no new events after a non-append action. Syntax-only, not yet executable (PLAY0268). Cannot accompany event, event-order, error or denial expectations.',\n result: '`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing.',\n};\n\nexport const attributeDocs: Record<string, string> = {\n pii: 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]. Bare suffix marker; @pii is deprecated (PLAY0565). Not admitted by the executable model (PLAY0268).',\n personal: 'Alias of pii: personal data (GDPR Art. 4(1)); renders Chronicle [PII]. No diagnostic; canonical printing writes pii.',\n secret: 'Operational secret, not personal data: encrypted at rest without erasure and withheld from causation. Provider mapping: [Encrypted] + [NotAudited], or [PII] only with pii. Cannot be identity (PLAY0515). Not admitted by the executable model (PLAY0268).',\n sensitive: 'Deprecated spelling of secret (PLAY0565); repair to bare secret. Operational secret, not GDPR Art. 9 special-category data.',\n};\n\nexport const contextVariableDocs: Record<string, string> = {\n '$context.occurred': 'When the command or query was received.',\n '$context.tenant': 'The tenant the command or query is executing for.',\n '$context.command': 'The command being handled, shaped by its `command` declaration.',\n '$context.arguments': 'The arguments of the query being performed.',\n '$context.causedBy': 'The identity that caused the command or query \u2014 `subject`, `name`, `userName`.',\n '$context.causedBy.subject': 'The subject of the identity that caused the command or query.',\n '$context.causedBy.name': 'The display name of the identity that caused the command or query.',\n '$context.causedBy.userName': 'The user name of the identity that caused the command or query.',\n '$context.causation': 'What caused the command or query \u2014 `type`, `occurred`, `properties`.',\n '$context.causation.type': 'What caused the command or query \u2014 a command, a reactor, a schedule.',\n '$context.identity': 'The caller a decision is made about \u2014 `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.',\n '$context.identity.id': 'The identifier of the caller from the auth token.',\n '$context.identity.name': 'The display name of the caller.',\n '$context.identity.userName': 'The user name of the caller.',\n '$context.identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$context.identity.roles': 'The roles the caller holds.',\n '$context.identity.claims': 'The claims the caller carries \u2014 `$context.identity.claims.<name>` reads one.',\n '$env': 'An environment variable, e.g. `$env.SERVICE_NAME`.',\n '$secrets': 'An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` \u2014 stays symbolic in the compiled tree.',\n '$strings': 'A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.',\n // Every $eventContext path the event-context catalog lists, for projections.\n ...Object.fromEntries(eventContextPaths.map((path) => [`$eventContext.${path.path}`, path.description])),\n};\n\n// One-sentence descriptions of the `pii special` categories (GDPR Art. 9(1)) and `pii criminal` (Art. 10).\n// The same sentences appear in Documentation/screenplay/concepts.md.\nexport const specialCategoryDocs: Record<string, string> = {\n racialOrEthnicOrigin: 'Data revealing a person\\'s racial or ethnic origin (GDPR Art. 9(1)).',\n politicalOpinions: 'Data revealing a person\\'s political opinions (GDPR Art. 9(1)).',\n religiousOrPhilosophicalBeliefs: 'Data revealing a person\\'s religious or philosophical beliefs (GDPR Art. 9(1)).',\n tradeUnionMembership: 'Data revealing whether a person belongs to a trade union (GDPR Art. 9(1)).',\n genetic: 'Data about inherited or acquired genetic characteristics that gives unique information about a person\\'s physiology or health (GDPR Art. 9(1), Art. 4(13)).',\n biometric: 'Data from technical processing of physical, physiological or behavioral characteristics, special only when processed to uniquely identify a person (GDPR Art. 9(1), Art. 4(14)).',\n health: 'Data about a person\\'s physical or mental health, including health care services, that reveals their health status (GDPR Art. 9(1), Art. 4(15)).',\n sexLifeOrSexualOrientation: 'Data concerning a person\\'s sex life or sexual orientation (GDPR Art. 9(1)).'\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { refusalContext } from './refusal-context';\nimport { namedRuleContext } from './named-rule-context';\nimport { eventSourceHover } from './event-source-authoring';\nimport { exampleHover } from './example-authoring';\nimport { operationHover } from './operation-authoring';\nimport { DocumentSymbols } from './symbols';\nimport { responseAnalysis, responseAvailability } from './response-analysis';\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, withoutComment } from './document-context';\nimport { directBody, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { getSubLanguage } from './sub-language-registry';\nimport { attributeDocs, contextVariableDocs, handlerIntentDocs, keywordDocs, specialCategoryDocs, specificationKeywordDocs } from './keyword-docs';\n\n// Produces the hover markdown for a word at a position, without any editor\n// dependency \u2014 the Monaco service and the VSCode extension share this content.\n// Columns are 1-based, matching both editors' word-at-position APIs.\nexport function hoverContent(\n lines: string[],\n lineIndex: number,\n word: string,\n startColumn: number,\n endColumn: number,\n application?: DocumentSymbols,\n): string | null {\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n\n const line = lines[lineIndex] ?? '';\n if (endColumn - 1 > withoutComment(line).length) return null;\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < startColumn - 1; index++) {\n if (line[index] === '\\\\' && inString) index++;\n else if (line[index] === '\"' && !inTemplate) inString = !inString;\n else if (line[index] === '`' && !inString) inTemplate = !inTemplate;\n }\n if (inString || inTemplate) return null;\n const reaction = reactionReferenceAt(lines, lineIndex, startColumn, endColumn, application);\n if (reaction) return reaction.content;\n const fixtureHover = exampleHover(lines, lineIndex, startColumn, endColumn, application);\n if (fixtureHover) return fixtureHover;\n const sourceHover = eventSourceHover(lines, lineIndex, startColumn, endColumn, application);\n if (sourceHover) return sourceHover;\n const operation = operationHover(lines, lineIndex, startColumn, endColumn, application);\n if (operation) return operation;\n const tokenAt = (column: number, name: string): boolean => {\n const start = column + (line[column - 1] === '@' ? 1 : 0);\n return word === name && startColumn === start && endColumn === start + name.length && line.slice(start - 1, endColumn - 1) === name;\n };\n const before = line.charAt(startColumn - 2);\n if (word === 'authorization' && enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'purpose') return 'A quoted authorization in law for criminal-offence data (Art. 10).';\n\n const complianceHeader = /^\\s*concept\\s+[^\\s:]+\\s*:\\s*\\w+\\s+/.exec(line);\n const complianceBody = enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'concept' && /^\\s*(?:@?pii|personal|@?sensitive|secret)\\s+(?:reason|scope|special|criminal)\\b/.test(line);\n if ((complianceHeader !== null && startColumn - 1 >= complianceHeader[0].length - 1) || complianceBody) {\n const doc = attributeDocs[word];\n if (doc) return doc;\n if (Object.hasOwn(specialCategoryDocs, word) && /^\\s*(?:@?pii|personal)\\s+special\\s+/.test(line)) return `**${word}** \u2014 ${specialCategoryDocs[word]}`;\n if (word === 'special') return 'GDPR Art. 9(1) special category; requires pii. At most one category per concept.';\n if (word === 'criminal') return 'Personal data relating to criminal convictions and offenses (GDPR Art. 10); requires pii.';\n if (/^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+/.test(line) && ['subject', 'namespace', 'global'].includes(word)) return `**${word}** \u2014 Secret encryption scope${word === 'subject' ? ' per data subject' : word === 'namespace' ? ' per tenant namespace' : ' shared globally'}. Not an event-property subject role.`;\n if (word === 'scope') return 'Secret encryption scope: subject, namespace or global. Omitted scope keeps Chronicle\u2019s Subject default; pii secret renders only [PII].';\n }\n if (before === '$' || before === '.') {\n const variable = line.substring(0, endColumn - 1).match(/\\$[\\w.]*$/)?.[0];\n if (variable) {\n if (variable.startsWith('$refusal')) {\n const branch = refusalContext(lines, lineIndex, indentOf(line));\n const member = variable.substring('$refusal.'.length);\n const descriptions: Record<string, string> = { reason: 'Refusal kind as a String: validation, constraint or authorization.', message: 'Rejection details verbatim, including unresolved $strings keys.', constraint: 'Violated constraint name as a String, only in a by constraint branch.' };\n return branch !== undefined && descriptions[member] !== undefined ? `**${variable}** \u2014 ${descriptions[member]} Syntax-only, not yet executable (PLAY0268).` : null;\n }\n const doc =\n contextVariableDocs[variable] ??\n (variable.startsWith('$env') ? contextVariableDocs['$env'] : undefined);\n if (doc) return doc;\n }\n }\n\n // Do not mistake a property/type named optional for the contextual modifier.\n const prefix = line.slice(0, startColumn - 1);\n // Commit to query-parameter context before matching the name and type.\n const followsPropertyType = /^\\s*(?:by|filter)\\s+/.test(prefix)\n ? /^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+$/.test(prefix)\n : /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+$/.test(prefix);\n const followsQueryType = /^\\s*query\\s+\\w+\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+$/.test(prefix) &&\n !/^\\s*query\\s+\\w+\\s*=>\\s*observable\\s+$/.test(prefix);\n if (word === 'subject') {\n const source = eventAnalysisSource(lines);\n const subjectPrefix = /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?(?:\\s+generated)?(?:\\s+identifier)?\\s+$/.test(prefix);\n const ownerChain = enclosingChain(source, fences, lineIndex, indentOf(line));\n if (subjectPrefix && (ownerChain[0] === 'event' || /^produces\\s+event\\s+/.test(enclosingHeaders(source, fences, lineIndex, indentOf(line))[0] ?? ''))) {\n return '**subject** \u2014 This event property identifies its one data subject instead of the event source (decision 0008). Required scalar String, Uuid or their concepts, or an Int-backed concept; never pii or secret. Report-only lineage metadata (PLAY0270); no ESM bytes or provider output yet.';\n }\n if (/\\bclaim\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s+matches\\s+$/.test(prefix) && ownerChain.includes('policy')) return `**subject** \u2014 ${keywordDocs.subject}`;\n return null;\n }\n if (word === 'optional' && (followsPropertyType || followsQueryType)) {\n return `**optional** \u2014 ${keywordDocs.optional}`;\n }\n\n if (word === 'implementation' || word === 'hint') {\n const chain = enclosingChain(lines, fences, lineIndex, indentOf(line));\n const ruleContext = namedRuleContext(lines, lineIndex, indentOf(line));\n if ((word === 'implementation' && ruleContext === 'rule' && /^\\s*implementation\\s*$/.test(withoutComment(line))) ||\n (word === 'hint' && ruleContext === 'implementation' && /^\\s*hint\\s+\"/.test(line))) {\n return `**${word}** \u2014 Command named-rule guidance with at most one file or tagged fence. No payload means pending and fails binding (PLAY0268). Attached predicates keep their existing pure RuleContext contract; reference execution is unsupported, never confirmation.`;\n }\n if (word === 'implementation' && chain[0] === 'handler' && /^\\s*implementation\\s*$/.test(withoutComment(line))) {\n return `**implementation** \u2014 ${handlerIntentDocs.implementation}`;\n }\n if (word === 'hint' && chain[0] === 'implementation' && chain[1] === 'handler' && /^\\s*hint\\s+\"/.test(line)) {\n return `**hint** \u2014 ${handlerIntentDocs.hint}`;\n }\n }\n\n const symbols = scanDocument(lines);\n const owner = symbols.commands.filter(command => command.line < lineIndex).at(-1);\n const property = owner?.properties.find(property => property.name === word && property.line === lineIndex);\n if (property?.isGenerated || (word === 'generated' && owner?.properties.some(property => property.isGenerated && property.line === lineIndex) && followsPropertyType)) {\n return `**${property?.name ?? 'generated'}** \u2014 ${property ? typeReferenceText(propertyTypeReference(property)) + '. ' : ''}Generated value, not a request or form input. ${responseAvailability}`;\n }\n const response = owner?.response;\n if (response?.location.line === lineIndex + 1 && (tokenAt(response.location.column, 'returns') || (response.kind === 'ScalarCommandResponseSyntax' && tokenAt(response.source.location.column, response.source.property)))) {\n const source = response.kind === 'ScalarCommandResponseSyntax' ? owner?.properties.find(property => property.name === response.source.property) : undefined;\n return `**returns**${source ? ` \u2014 ${typeReferenceText(propertyTypeReference(source))}` : ' \u2014 unnamed record response'}. ${responseAvailability}`;\n }\n if (response?.kind === 'RecordCommandResponseSyntax') {\n const field = response.fields.find(field => field.location.line === lineIndex + 1 && (tokenAt(field.location.column, field.name) || tokenAt(field.source.location.column, field.source.property)));\n if (field) {\n const source = owner?.properties.find(property => property.name === field.source.property);\n const type = field.type ? typeReferenceText(field.type) : source ? typeReferenceText(propertyTypeReference(source)) : 'Unresolved type';\n return `**${field.name}** \u2014 ${type}${field.type ? ' (explicit)' : ' (inferred)'} = ${field.source.property}. ${source?.isGenerated ? 'Generated source, not request input. ' : ''}${responseAvailability}`;\n }\n }\n for (const specification of responseAnalysis(lines).specifications.values()) {\n if ((word === 'returns' && specification.thenReturns?.location.line === lineIndex + 1) || (word === 'generated' && specification.when?.generatedValues?.some(value => value.location.line === lineIndex + 1))) return responseAvailability;\n }\n\n const concept = symbols.concepts.find((candidate) => candidate.name === word);\n if (concept) {\n const attributes = concept.attributes.length ? ` ${concept.attributes.join(' ')}` : '';\n const values = concept.enumValues.length\n ? `\\n\\nValues: ${concept.enumValues.join(', ')}`\n : '';\n const reasons = Object.entries(concept.attributeReasons)\n .map(([attribute, reason]) => `\\n\\n**@${attribute}** \u2014 ${reason}`)\n .join('');\n return `\\`\\`\\`screenplay\\nconcept ${concept.name} : ${concept.primitive}${attributes}\\n\\`\\`\\`${reasons}${values}`;\n }\n\n const type = symbols.types.find((candidate) => candidate.name === word);\n if (type) {\n const properties = type.properties\n .map((property) => `${property.name} ${typeReferenceText(propertyTypeReference(property))}`)\n .join('\\n');\n return `\\`\\`\\`screenplay\\ntype ${type.name}\\n${properties}\\n\\`\\`\\``;\n }\n\n const policy = symbols.policies.find((candidate) => candidate.name === word);\n if (policy) {\n const body = policy.requires.length ? policy.requires.join('\\n') : '(custom C#)';\n return `\\`\\`\\`screenplay\\npolicy ${policy.name}\\n${body}\\n\\`\\`\\``;\n }\n\n const event = symbols.events.find((candidate) => candidate.name === word && candidate.line === lineIndex) ??\n symbols.events.filter((candidate) => candidate.name === word)\n .sort((left, right) => (right.generation ?? 1) - (left.generation ?? 1))[0];\n if (event) {\n const properties = event.properties\n .map((property) => `${property.name} ${typeReferenceText(propertyTypeReference(property))}${property.isSubject ? ' subject' : ''}`)\n .join('\\n');\n return `\\`\\`\\`screenplay\\n${event.visibility === 'Public' ? 'public ' : ''}event ${event.name}${event.generation !== undefined ? ` generation ${event.generation}` : ''}${event.origin !== undefined ? ` from ${JSON.stringify(event.origin)}` : ''}\\n${properties}\\n\\`\\`\\``;\n }\n\n const command = symbols.commands.find((candidate) => candidate.name === word);\n if (command && command.properties.length > 0) {\n const properties = command.properties\n .map(\n (property) =>\n `${property.name} ${typeReferenceText(propertyTypeReference(property))}${property.isGenerated ? ' generated' : ''}${property.isIdentifier ? ' identifier' : ''}`,\n )\n .join('\\n');\n return `\\`\\`\\`screenplay\\ncommand ${command.name}\\n${properties}\\n\\`\\`\\`${command.response || command.properties.some(property => property.isGenerated) ? `\\n\\n${responseAvailability}` : ''}`;\n }\n\n // Sub-language keywords take precedence inside their construct.\n const chain = enclosingChain(lines, fences, lineIndex, indentOf(line));\n for (const construct of [line.trim().split(/\\s+/)[0], ...chain]) {\n const subLanguage = getSubLanguage(construct ?? '');\n const doc = subLanguage?.hovers?.[word];\n if (doc) return doc;\n }\n\n if (word === 'reads' && (chain[0] === 'every' || chain[0] === 'at') && chain.includes('reaction')) {\n return '**reads** \u2014 Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.';\n }\n\n const step = line.trim().match(/^(given|when|then)\\s+(?:no\\s+)?(\\w+)/);\n if (step && step[2] === word && chain[0] === 'specification' && specificationKeywordDocs[word]) {\n return `**${word}** \u2014 ${specificationKeywordDocs[word]}`;\n }\n\n if (word === 'id' || word === 'documentation') {\n const source = eventAnalysisSource(lines);\n const inEvent = symbols.events.some(event => directBody(source, fences, event.line, indentOf(source[event.line])).includes(lineIndex));\n const directive = word === 'id' ? /^\\s*id\\s+\"/.test(source[lineIndex]) : /^\\s*documentation\\s*$/.test(source[lineIndex]);\n const supportedOwner = inEvent || (word === 'documentation' && ['module', 'feature', 'slice', 'command', 'readmodel', 'reaction'].includes(chain[0]));\n if (!supportedOwner || !directive || startColumn !== indentOf(line) + 1) return null;\n }\n\n if (word === 'optional' || word === 'generated' || word === 'returns') return null;\n const keywordDoc = keywordDocs[word];\n if (keywordDoc) return `**${word}** \u2014 ${keywordDoc}`;\n\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport { hoverContent } from './hover-content';\nimport { CompletionOptions } from './completions';\n\nexport function createHoverProvider(options: CompletionOptions = {}): languages.HoverProvider {\n return {\n provideHover(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return null;\n\n const content = hoverContent(\n model.getLinesContent(),\n position.lineNumber - 1,\n word.word,\n word.startColumn,\n word.endColumn,\n options.application?.(model),\n );\n return content ? { contents: [{ value: content }] } : null;\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport { destinationHints } from './production-destinations';\nimport { CompletionOptions } from './completions';\n\nexport function createInlayHintsProvider(options: CompletionOptions = {}): languages.InlayHintsProvider {\n return {\n provideInlayHints(model, range) {\n const hints = destinationHints(model.getLinesContent(), options.application?.(model)).filter(hint => hint.line + 1 >= range.startLineNumber && hint.line + 1 <= range.endLineNumber);\n return {\n hints: hints.map(hint => ({ position: { lineNumber: hint.line + 1, column: hint.column }, label: hint.label, paddingLeft: true })),\n dispose() {},\n };\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, IRange, languages } from 'monaco-editor';\nimport { DiagnosticCodes, isQuickFixDiagnostic, prepareQuickFixes } from '@cratis/screenplay-compiler';\n\nconst migrateOptional = 'source.screenplay.migrateOptional';\nconst migrateCompliance = 'source.screenplay.migrateCompliance';\nconst migrationKind = (code: string) => code === DiagnosticCodes.LegacyComplianceMarker ? migrateCompliance : migrateOptional;\nconst containsKind = (requested: string, kind: string) => requested === '' || requested === kind || kind.startsWith(`${requested}.`);\n\nfunction intersects(left: IRange, right: IRange): boolean {\n return (left.startLineNumber < right.endLineNumber || (left.startLineNumber === right.endLineNumber && left.startColumn <= right.endColumn)) &&\n (right.startLineNumber < left.endLineNumber || (right.startLineNumber === left.endLineNumber && right.startColumn <= left.endColumn));\n}\n\n// The compiler owns recipes and verification. The adapter only translates verified offsets and pins\n// edits to the analyzed buffer version, so future fixes need no editor-specific parsing or .NET bridge.\nexport function createCodeActionProvider(placement?: readonly string[]): languages.CodeActionProvider {\n const cache = new WeakMap<editor.ITextModel, { version: number; placement: string; fixes: ReturnType<typeof prepareQuickFixes> }>();\n return {\n provideCodeActions(model, range, context, token) {\n const migrationRequested = context.only !== undefined && [migrateOptional, migrateCompliance].some(kind => containsKind(context.only!, kind));\n const migrationOnly = context.only !== undefined && migrationRequested && !containsKind(context.only, 'quickfix');\n if (token.isCancellationRequested || (context.only !== undefined && !migrationRequested && !containsKind(context.only, 'quickfix'))) return { actions: [], dispose() {} };\n const diagnostics = context.markers.filter(marker => {\n const code = typeof marker.code === 'object' ? marker.code.value : marker.code;\n return isQuickFixDiagnostic(code) && intersects(marker, range);\n });\n if (!migrationRequested && diagnostics.length === 0) return { actions: [], dispose() {} };\n const version = model.getVersionId();\n const placementKey = JSON.stringify(placement) ?? '';\n let analysis = cache.get(model);\n if (analysis?.version !== version || analysis.placement !== placementKey) {\n analysis = { version, placement: placementKey, fixes: prepareQuickFixes(model.getValue(), { placement }) };\n cache.set(model, analysis);\n }\n const occurrences = migrationOnly ? [] : analysis.fixes(diagnostics.map(diagnostic => ({\n line: diagnostic.startLineNumber,\n diagnosticCode: String(typeof diagnostic.code === 'object' ? diagnostic.code.value : diagnostic.code),\n }))).filter(fix => fix.scope === 'occurrence');\n const requested = [...occurrences, ...(context.only === undefined || migrationRequested ? [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker].flatMap(code => analysis.fixes(undefined, code)) : [])];\n const fixes = requested.filter(fix => context.only === undefined || containsKind(context.only, fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix'));\n if (token.isCancellationRequested || model.getVersionId() !== version) return { actions: [], dispose() {} };\n return {\n actions: fixes.map(fix => ({\n title: fix.title,\n kind: fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix',\n isPreferred: fix.scope === 'occurrence',\n edit: { edits: fix.edits.map(edit => {\n const start = model.getPositionAt(edit.start);\n const end = model.getPositionAt(edit.start + edit.length);\n return { resource: model.uri, versionId: version, textEdit: {\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column },\n text: edit.text,\n } };\n }) },\n })),\n dispose() {},\n };\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\nimport { Monaco, languageId } from './language';\nimport { validateLines } from './validation';\nimport { CompletionOptions } from './completions';\nimport { symbolsForBuffer } from './symbols';\n\nconst owner = 'screenplay';\nconst validationDelay = 300;\n\nexport function validate(monaco: Monaco, model: editor.ITextModel, options: CompletionOptions = {}): editor.IMarkerData[] {\n const lines = model.getLinesContent();\n const application = symbolsForBuffer(lines, options.application?.(model));\n return validateLines(lines, { application, path: application.authoringPath, placement: application.authoringPlacement }).map((issue) => ({\n severity:\n issue.severity === 'error'\n ? monaco.MarkerSeverity.Error\n : issue.severity === 'information'\n ? monaco.MarkerSeverity.Info\n : monaco.MarkerSeverity.Warning,\n tags: (issue.code === 'PLAY0479' || issue.code === 'PLAY0565') ? [monaco.MarkerTag.Deprecated] : undefined,\n message: issue.message,\n code: issue.code,\n startLineNumber: issue.line + 1,\n startColumn: issue.startColumn,\n endLineNumber: issue.line + 1,\n endColumn: issue.endColumn,\n }));\n}\n\nfunction watch(monaco: Monaco, model: editor.ITextModel, options: CompletionOptions): void {\n let handle: ReturnType<typeof setTimeout> | undefined;\n\n const run = () => {\n if (model.isDisposed()) return;\n if (model.getLanguageId() !== languageId) {\n monaco.editor.setModelMarkers(model, owner, []);\n return;\n }\n monaco.editor.setModelMarkers(model, owner, validate(monaco, model, options));\n };\n const schedule = () => {\n if (handle !== undefined) clearTimeout(handle);\n handle = setTimeout(run, validationDelay);\n };\n\n const contextChange = options.onDidChangeApplication?.(run);\n model.onDidChangeContent(schedule);\n model.onDidChangeLanguage(run);\n model.onWillDispose(() => {\n contextChange?.dispose();\n if (handle !== undefined) clearTimeout(handle);\n });\n run();\n}\n\nexport function attachDiagnostics(monaco: Monaco, options: CompletionOptions = {}): void {\n monaco.editor.getModels().forEach((model) => watch(monaco, model, options));\n monaco.editor.onDidCreateModel((model) => watch(monaco, model, options));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SubLanguageDefinition } from '../sub-language-registry';\n\n// Projection Declaration Language (PDL) \u2014 embedded inside `projection` blocks.\n// See https://www.cratis.io/chronicle/projections/projection-declaration-language/grammar/\nexport const pdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:description|from|every|all|nested|join|children|identified|by|key|parent|with|remove|via|clear|on|sequence|automap|no|exclude|literal|set|increment|decrement|add|subtract|count)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n { label: 'description', insertText: 'description \"${1:builder intent}\"', documentation: 'Report-only description on a projection header, not on its nested blocks or variants.' },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which property identifies the read model instance.',\n },\n {\n label: 'from',\n insertText: 'from ${1:EventType}',\n documentation: 'Maps properties from an event onto the read model.',\n },\n {\n label: 'join',\n insertText: 'join ${1:property} on ${2:key}',\n documentation: 'Joins related state onto the read model by a key property.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Projects events into a child collection on the read model.',\n },\n {\n label: 'remove with',\n insertText: 'remove with ${1:EventType}',\n documentation: 'Removes the read model instance when the event occurs.',\n },\n {\n label: 'parent',\n insertText: 'parent ${1:property}',\n documentation: 'Declares the property that identifies the parent of a child.',\n },\n {\n label: 'clear',\n insertText: 'clear ${1:property}',\n documentation: 'Removes the value a property holds when the event occurs.',\n },\n {\n label: 'increment',\n insertText: 'increment ${1:property}',\n documentation: 'Increments a numeric property when the event occurs.',\n },\n {\n label: 'decrement',\n insertText: 'decrement ${1:property}',\n documentation: 'Decrements a numeric property when the event occurs.',\n },\n ],\n hovers: {\n description: 'Report-only projection-header description, as quoted or fenced text; adds no executable bytes.',\n from: 'PDL \u2014 maps properties from an event onto the read model.',\n every: 'PDL \u2014 applies property mappings for every event type in the projection.',\n join: 'PDL \u2014 joins related state onto the read model by a key property.',\n children: 'PDL \u2014 projects events into a child collection on the read model.',\n identified: 'PDL \u2014 introduces the identifying key of a child collection.',\n key: 'PDL \u2014 declares which property identifies the read model instance.',\n parent: 'PDL \u2014 declares the property that identifies the parent of a child.',\n remove: 'PDL \u2014 removes the read model instance when an event occurs.',\n clear: 'PDL \u2014 clear <property> removes the value a property holds; clear with <EventType> nulls a nested object.',\n increment: 'PDL \u2014 increments a numeric property when the event occurs.',\n decrement: 'PDL \u2014 decrements a numeric property when the event occurs.',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SubLanguageDefinition } from '../sub-language-registry';\n\n// Change Data Capture Language (CDL) \u2014 embedded inside `capture` blocks. This is the\n// lightweight definition mixed into the composite `.play` tokenizer; the full standalone\n// CDL language (its own tokenizer, context-aware completions, hover, and validation) lives\n// in `./capture` and is what `@cratis/screenplay-language/capture` exposes to consumers.\nexport const cdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n {\n label: 'source',\n insertText: 'source ${1:api}',\n documentation: 'Declares where the captured data comes from.',\n },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which source property identifies an instance.',\n },\n {\n label: 'map',\n insertText: 'map\\n ${1:property} = ${2:source}',\n documentation: 'Maps and translates source values before events are appended.',\n },\n {\n label: 'append',\n insertText: 'append ${1:EventType}\\n when ${2:property}',\n documentation: 'Appends an event when the source data changes.',\n },\n {\n label: 'translate',\n insertText: 'translate\\n \"${1:source}\" => ${2:target}',\n documentation: 'Translates source values into Screenplay values.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Captures changes in a child collection of the source data.',\n },\n {\n label: 'when added',\n insertText: 'when added',\n documentation: 'Appends the event when a new item appears in the source.',\n },\n {\n label: 'when removed',\n insertText: 'when removed',\n documentation: 'Appends the event when an item disappears from the source.',\n },\n ],\n hovers: {\n source: 'CDL \u2014 declares where the captured data comes from.',\n api: 'CDL \u2014 as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.',\n route: 'CDL \u2014 optional path appended to an API source\\'s External Service base URL.',\n poll: 'CDL \u2014 the polling interval for an API source, e.g. 5m.',\n path: 'CDL \u2014 the inbound path a webhook source listens on.',\n topic: 'CDL \u2014 the topic a message source subscribes to.',\n key: 'CDL \u2014 declares which source property identifies an instance.',\n map: 'CDL \u2014 maps and translates source values before events are appended.',\n translate: 'CDL \u2014 translates source values into Screenplay values.',\n append: 'CDL \u2014 appends an event when the source data changes.',\n when: 'CDL \u2014 the change condition: a property change, added, or removed.',\n added: 'CDL \u2014 matches items that appear in the source.',\n removed: 'CDL \u2014 matches items that disappear from the source.',\n children: 'CDL \u2014 captures changes in a child collection of the source data.',\n identified: 'CDL \u2014 introduces the identifying key of a child collection.',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\n\nexport const screenplayDarkThemeName = 'screenplay-dark';\n\nexport const screenplayDark: editor.IStandaloneThemeData = {\n base: 'vs-dark',\n inherit: true,\n rules: [\n { token: 'keyword.play', foreground: 'C586C0' },\n { token: 'keyword.tag.play', foreground: '569CD6', fontStyle: 'italic' },\n { token: 'keyword.type.play', foreground: '4FC1FF', fontStyle: 'bold' },\n { token: 'type.play', foreground: '4EC9B0' },\n { token: 'type.identifier.play', foreground: '4EC9B0' },\n { token: 'identifier.play', foreground: '9CDCFE' },\n { token: 'annotation.play', foreground: 'DCDCAA' },\n { token: 'variable.predefined.play', foreground: 'D7BA7D' },\n { token: 'string.play', foreground: 'CE9178' },\n { token: 'string.link.play', foreground: 'CE9178', fontStyle: 'underline' },\n { token: 'string.invalid.play', foreground: 'F44747' },\n { token: 'string.quote.play', foreground: '6A9955' },\n { token: 'number.play', foreground: 'B5CEA8' },\n { token: 'number.float.play', foreground: 'B5CEA8' },\n { token: 'comment.play', foreground: '6A9955', fontStyle: 'italic' },\n { token: 'operator.play', foreground: 'D4D4D4' },\n { token: 'delimiter.play', foreground: 'CCCCCC' },\n ],\n colors: {\n 'editor.background': '#1E1E1E',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\n\nexport const screenplayLightThemeName = 'screenplay-light';\n\nexport const screenplayLight: editor.IStandaloneThemeData = {\n base: 'vs',\n inherit: true,\n rules: [\n { token: 'keyword.play', foreground: 'AF00DB' },\n { token: 'keyword.tag.play', foreground: '0000FF', fontStyle: 'italic' },\n { token: 'keyword.type.play', foreground: '0070C1', fontStyle: 'bold' },\n { token: 'type.play', foreground: '267F99' },\n { token: 'type.identifier.play', foreground: '267F99' },\n { token: 'identifier.play', foreground: '001080' },\n { token: 'annotation.play', foreground: '795E26' },\n { token: 'variable.predefined.play', foreground: 'B45309' },\n { token: 'string.play', foreground: 'A31515' },\n { token: 'string.link.play', foreground: 'A31515', fontStyle: 'underline' },\n { token: 'string.invalid.play', foreground: 'CD3131' },\n { token: 'string.quote.play', foreground: '008000' },\n { token: 'number.play', foreground: '098658' },\n { token: 'number.float.play', foreground: '098658' },\n { token: 'comment.play', foreground: '008000', fontStyle: 'italic' },\n { token: 'operator.play', foreground: '000000' },\n { token: 'delimiter.play', foreground: '000000' },\n ],\n colors: {\n 'editor.background': '#FFFFFF',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Monaco,\n languageConfiguration,\n languageExtensionPoint,\n languageId,\n} from './language';\nimport { createTokensProvider } from './tokens';\nimport { CompletionOptions, createCompletionProvider } from './completions';\nimport { createInlineCompletionProvider } from './inline-completions';\nimport { responseTokens, responseTokenTypes } from './response-tokens';\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { createHoverProvider } from './hover';\nimport { createInlayHintsProvider } from './inlay-hints';\nimport { eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nimport { createCodeActionProvider } from './code-actions';\nimport { attachDiagnostics } from './diagnostics';\nimport {\n getSubLanguage,\n getSubLanguages,\n onSubLanguagesChanged,\n registerSubLanguage,\n} from './sub-language-registry';\nimport { pdl } from './sub-languages/pdl';\nimport { cdl } from './sub-languages/cdl';\nimport { screenplayDark, screenplayDarkThemeName } from './themes/screenplay-dark';\nimport { screenplayLight, screenplayLightThemeName } from './themes/screenplay-light';\n\nconst registeredInstances = new Set<Monaco>();\n\nfunction applyTokensProvider(monaco: Monaco): void {\n monaco.languages.setMonarchTokensProvider(languageId, createTokensProvider(getSubLanguages()));\n}\n\n// Sub-languages registered after register() recompose the tokenizer on the fly.\nonSubLanguagesChanged(() => registeredInstances.forEach(applyTokensProvider));\n\n// Registers the built-in PDL and CDL sub-languages. Hosts that do not go through\n// register() \u2014 such as the VSCode extension \u2014 call this before using the registry.\nexport function ensureBuiltInSubLanguages(): void {\n if (!getSubLanguage('projection')) registerSubLanguage('projection', pdl);\n if (!getSubLanguage('capture')) registerSubLanguage('capture', cdl);\n}\n\n// What a host can tell the language service beyond the models it holds.\nexport type LanguageServiceOptions = CompletionOptions;\n\nexport function register(monaco: Monaco, options: LanguageServiceOptions = {}): void {\n if (registeredInstances.has(monaco)) return;\n\n ensureBuiltInSubLanguages();\n\n registeredInstances.add(monaco);\n\n monaco.languages.register(languageExtensionPoint);\n monaco.languages.setLanguageConfiguration(languageId, languageConfiguration);\n applyTokensProvider(monaco);\n monaco.languages.registerCompletionItemProvider(languageId, createCompletionProvider(monaco, options));\n monaco.languages.registerInlineCompletionsProvider(languageId, createInlineCompletionProvider(options));\n monaco.languages.registerHoverProvider(languageId, createHoverProvider(options));\n monaco.languages.registerDefinitionProvider(languageId, {\n provideDefinition(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return [];\n const symbols = options.application?.(model);\n const reference = eventSourceReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const reaction = reactionReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const target = reaction ? reaction.target : reference?.target;\n if (!target) return [];\n const current = symbols?.authoringPath ?? 'current.play';\n const source = target.location.path === current ? model.getValue() : symbols?.authoringDocuments?.find(document => document.path === target.location.path)?.source;\n const location = reaction ? reaction.target?.location : source && eventSourceIdentifier(target.location, target.name, source);\n if (!location) return [];\n // Foreign navigation requires an actual host model, not a guessed path or merged line.\n const targetUri = target.location.path && model.uri.path.endsWith(`/${current}`)\n ? model.uri.with({ path: model.uri.path.slice(0, -current.length) + target.location.path }) : undefined;\n const targetModels = targetUri ? monaco.editor.getModels().filter(candidate => candidate.uri.toString() === targetUri.toString()) : [];\n const targetModel = target.location.path === current ? model : targetModels.length === 1 ? targetModels[0] : undefined;\n return targetModel ? [{ uri: targetModel.uri, range: new monaco.Range(location.line, location.column, location.line, location.column + target.name.length) }] : [];\n }\n });\n monaco.languages.registerDocumentSemanticTokensProvider(languageId, {\n getLegend: () => ({ tokenTypes: [...responseTokenTypes], tokenModifiers: [] }),\n provideDocumentSemanticTokens(model) {\n const data: number[] = [];\n let previousLine = 0;\n let previousColumn = 0;\n for (const token of responseTokens(model.getLinesContent(), options.application?.(model))) {\n data.push(token.line - previousLine, token.line === previousLine ? token.column - previousColumn : token.column, token.length, token.type, 0);\n previousLine = token.line;\n previousColumn = token.column;\n }\n return { data: new Uint32Array(data) };\n },\n releaseDocumentSemanticTokens() {},\n });\n monaco.languages.registerInlayHintsProvider(languageId, createInlayHintsProvider(options));\n monaco.languages.registerCodeActionProvider(languageId, createCodeActionProvider());\n monaco.editor.defineTheme(screenplayDarkThemeName, screenplayDark);\n monaco.editor.defineTheme(screenplayLightThemeName, screenplayLight);\n attachDiagnostics(monaco, options);\n}\n\nexport { reactionReferenceAt } from './reaction-authoring';\n\nexport {\n causedByProperties,\n clauseKeywords,\n codeBlockTags,\n conceptAttributes,\n constructKeywords,\n contextRoots,\n languageId,\n primitiveTypes,\n sliceTypes,\n} from './language';\nexport type { Monaco } from './language';\nexport { getSubLanguage, getSubLanguages, registerSubLanguage } from './sub-language-registry';\nexport type {\n MonarchTokenRules,\n SubLanguage,\n SubLanguageCompletion,\n SubLanguageDefinition,\n} from './sub-language-registry';\nexport { pdl } from './sub-languages/pdl';\nexport { cdl } from './sub-languages/cdl';\nexport { screenplayDarkThemeName } from './themes/screenplay-dark';\nexport { screenplayLightThemeName } from './themes/screenplay-light';\nexport { enclosingChain, fenceMap, firstWord, indentOf, withoutComment } from './document-context';\nexport { exampleCompletions, exampleHover } from './example-authoring';\nexport {\n fileReferenceKeyword,\n fileReferenceOn,\n fileReferences,\n isAbsoluteFileReferencePath,\n} from './file-references';\nexport type { FileReference } from './file-references';\nexport { fileImportOn, fileImports, importablePaths, isFileImportLine } from './file-imports';\nexport type { FileImport } from './file-imports';\nexport type { CompletionOptions } from './completions';\nexport { builtInTriggerNames, knownEventNames, knownTriggerNames, knownTypeNames, mergeSymbols, scanDocument, symbolsForBuffer } from './symbols';\nexport type {\n CommandSymbol,\n ConceptSymbol,\n DocumentSymbols,\n EventSymbol,\n ImportSymbol,\n NamedSymbol,\n PolicySymbol,\n PropertySymbol,\n ReadSymbol,\n QuerySymbol,\n TypeSymbol,\n} from './symbols';\nexport { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';\nexport { eventContextMemberAt, eventContextMembers, eventContextMembersAfter, eventContextPaths, namesEventContextMember } from './event-context';\nexport type { EventContextMember, EventContextPath } from './event-context';\nexport { contextVariableItems, producesItems, specificationStepItems } from './completion-items';\nexport type { CompletionEntry } from './completion-items';\nexport { completionEntriesFor, planCompletions } from './completion-planner';\nexport type { CompletionPlan } from './completion-planner';\nexport { responseTokens, responseTokenTypes } from './response-tokens';\nexport { responseCompletions } from './response-completions';\nexport { structureCompletion } from './structure-completions';\nexport { blockHeaderPattern } from './language';\nexport type { StructureCompletion } from './structure-completions';\nexport { analyzeEventSources, eventSourceAvailability, eventSourceCompletions, eventSourceDetails, eventSourceHover, eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nexport type { EventSourceAnalysis } from './EventSourceAnalysis';\nexport type { AuthoredEventSource } from './AuthoredEventSource';\nexport type { AuthoredStream } from './AuthoredStream';\nexport type { AuthoredCommandRoute } from './AuthoredCommandRoute';\nexport type { AuthoredSpecificationEvent } from './AuthoredSpecificationEvent';\nexport { analyzeOperations, operationCompletions, operationDetails, operationAvailability, operationHover, operationReferenceAt, phaseState } from './operation-authoring';\nexport type { OperationAnalysis, OperationDeclaration, OperationInput, OperationPhase, OperationReference, SystemDeclaration } from './OperationAnalysis';\nexport { responseAvailability, responseAnalysis } from './response-analysis';\nexport { hoverContent } from './hover-content';\nexport { validateLines } from './validation';\nexport { destinationHints, productionDestinations } from './production-destinations';\nexport type { DestinationHint } from './DestinationHint';\nexport type { ProductionSymbol } from './ProductionSymbol';\nexport type { ValidationContext, ValidationIssue, ValidationSeverity } from './validation';\nexport { createCodeActionProvider } from './code-actions';\nexport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nexport type { TypeReferenceSymbol } from './TypeReferenceSymbol';\nexport { diagnosticCodes } from './diagnostic-codes';\nexport type { DiagnosticCode } from './diagnostic-codes';\n"],
|
|
5
|
-
"mappings": "s+BAiBA,IAAMA,GAAuB,IAAI,IAAI,CAAC,YAAa,SAAU,cAAe,SAAS,CAAC,EAEhFC,GAA4C,CAC9C,OAAQ,SACR,WAAY,aACZ,MAAO,aACP,KAAM,OACN,IAAK,KACT,EAEA,SAASC,GAAiBC,EAAyB,CAC/C,MAAO,eAAeA,CAAO,EACjC,CAFSC,EAAAF,GAAA,oBAKT,SAASG,GAAoBC,EAAwD,CACjF,IA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C,EACD1B,EAAO,UAAU,uCAAuCC,EAAY,CAChE,UAAWG,EAAA,KAAO,CAAE,WAAY,CAAC,GAAGgC,EAAkB,EAAG,eAAgB,CAAC,CAAE,GAAjE,aACX,8BAA8BlB,EAAO,CACjC,IAAMmB,EAAiB,CAAC,EACpBC,EAAe,EACfC,EAAiB,EACrB,QAAWC,KAASC,GAAevB,EAAM,gBAAgB,EAAGN,EAAQ,cAAcM,CAAK,CAAC,EACpFmB,EAAK,KAAKG,EAAM,KAAOF,EAAcE,EAAM,OAASF,EAAeE,EAAM,OAASD,EAAiBC,EAAM,OAAQA,EAAM,OAAQA,EAAM,KAAM,CAAC,EAC5IF,EAAeE,EAAM,KACrBD,EAAiBC,EAAM,OAE3B,MAAO,CAAE,KAAM,IAAI,YAAYH,CAAI,CAAE,CACzC,EACA,+BAAgC,CAAC,CACrC,CAAC,EACDrC,EAAO,UAAU,2BAA2BC,EAAYyC,GAAyB9B,CAAO,CAAC,EACzFZ,EAAO,UAAU,2BAA2BC,EAAY0C,GAAyB,CAAC,EAClF3C,EAAO,OAAO,YAAY4C,GAAyBC,EAAc,EACjE7C,EAAO,OAAO,YAAY8C,GAA0BC,EAAe,EACnEC,GAAkBhD,EAAQY,CAAO,EACrC,CAtDgBR,EAAAO,GAAA",
|
|
6
|
-
"names": ["contextualConstructs", "embeddedLanguages", "subLanguageState", "keyword", "__name", "subLanguageExitRule", "subLanguages", "exitKeywords", "constructKeywords", "subLanguage", "commonTokenRules", "createTokensProvider", "tokenizer", "bmpWordCharacters", "codeBlockTags", "tag", "clauseKeywords", "sliceTypes", "primitiveTypes", "responseCompletions", "lines", "line", "before", "symbols", "fences", "fenceMap", "withoutComment", "indent", "indentOf", "chain", "enclosingChain", "enclosing", "nearestEnclosingLine", "namedCommand", "__name", "name", "matches", "command", "entry", "property", "insertText", "typeReferenceText", "propertyTypeReference", "responseAvailability", "scanDocument", "modifier", "word", "concept", "optionalTypeItems", "type", "primitiveTypes", "specification", "responseAnalysis", "properties", "field", "source", "enclosing", "lines", "line", "headers", "enclosingHeaders", "fenceMap", "indentOf", "header", "responseAnalysis", "start", "left", "right", "__name", "caseCompletions", "before", "table", "parameter", "caseHover", "end", "reference", "match", "values", "row", "source", "value", "analyze", "lines", "application", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "exampleCompletions", "line", "before", "fenceMap", "withoutComment", "analysis", "caseCompletions", "exampleHover", "start", "end", "caseHover", "operationAvailability", "analyzeOperations", "lines", "symbols", "responseAnalysis", "source", "__name", "phaseState", "phase", "operationDetails", "operation", "inputs", "input", "typeReferenceText", "name", "value", "hint", "operationCompletions", "line", "before", "fences", "fenceMap", "withoutComment", "indent", "indentOf", "chain", "enclosingChain", "enclosing", "nearestEnclosingLine", "analysis", "operations", "context", "targets", "qualifiers", "target", "part", "index", "event", "ownedOperation", "system", "operationImplementationItems", "operationPhaseItems", "production", "targetLine", "inProductionBody", "mappedOperation", "rhs", "properties", "parts", "property", "types", "type", "concept", "operationItems", "declaration", "reference", "operationReferenceAt", "start", "end", "operationHover", "at", "location", "column", "equals", "command", "text", "header", "systems", "eventSourceAvailability", "specificationRouteAvailability", "routePrefix", "sourceStreamPattern", "keyPrefix", "identifierTypePrefix", "streamTypePrefix", "analyzeEventSources", "lines", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "eventSourceDetails", "stream", "typeReferenceText", "part", "eventSourceReferenceAt", "line", "start", "end", "analysis", "at", "route", "location", "name", "withoutComment", "candidate", "resolution", "sourcePart", "eventSourceIdentifier", "prefix", "eventSourceHover", "reference", "context", "blockLocation", "declaration", "confidence", "mapping", "expression", "typed", "parts", "properties", "optional", "collection", "index", "matches", "property", "types", "type", "indentOf", "streamIdHeader", "owner", "indent", "text", "eventSourceCompletions", "before", "fenceMap", "literal", "primitive", "concept", "concepts", "path", "segment", "fields", "isSourceStreamName", "mapped", "target", "qualified", "matching", "entry", "names", "ownsStream", "partType", "streamId", "isSourceStreamTypeName", "refusalContext", "lines", "lineIndex", "indent", "fences", "fenceMap", "headers", "index", "line", "withoutComment", "indentOf", "branch", "header", "__name", "commandNamedRulePattern", "bmpWordCharacters", "namedRuleContext", "lines", "lineIndex", "indent", "fences", "fenceMap", "owners", "boundary", "index", "line", "withoutComment", "indentOf", "wrapped", "offset", "__name", "dependencyTargetCompletions", "lines", "line", "before", "application", "fenceMap", "withoutComment", "match", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "exampleUuid", "primitiveExamples", "exampleValueFor", "type", "symbols", "bare", "primitive", "concept", "__name", "lastIndexWhere", "lines", "matches", "index", "__name", "upperCamelWords", "name", "pastTense", "verb", "likelyEventName", "command", "symbols", "subject", "noun", "event", "indentUnit", "indented", "indentOf", "indent", "producesBlock", "unit", "eventName", "declared", "inner", "sources", "property", "mappings", "source", "identifier", "newCommandBlock", "identity", "concept", "identityLine", "properties", "propertyLines", "outcome", "line", "assignments", "exampleValueFor", "sliceCommand", "fences", "headerIndex", "sliceIndex", "authorized", "symbol", "candidate", "specificationBlock", "structureCompletion", "lineIndex", "textBefore", "textAfter", "fenceMap", "previous", "withoutComment", "previousLine", "opensEmptyBlock", "header", "nearestEnclosingLine", "headerIndent", "pad", "wrap", "block", "headerLine", "found", "form", "subLanguages", "listeners", "registerSubLanguage", "keyword", "definition", "listener", "__name", "getSubLanguages", "getSubLanguage", "onSubLanguagesChanged", "RULE_LINE_PATTERN", "declaredIn", "__name", "document", "keyword", "line", "topLevelEntries", "topLevelItems", "item", "isTemplate", "header", "expansionEntry", "text", "indent", "relative", "index", "indentOf", "completionEntriesFor", "chain", "where", "construct", "subLanguage", "getSubLanguage", "purposeItems", "moduleScopeItems", "featureScopeItems", "sliceItemsFor", "conceptItems", "typeItems", "commandItems", "eventItems", "readModelItems", "reducerItems", "formItems", "contributeItems", "behaviorItems", "personaItems", "authenticationItems", "seedItems", "themeItems", "uiProfileItems", "outcomeItems", "layoutItems", "operationItems", "operationPhaseItems", "producesItems", "handlerItems", "implementationItems", "operationImplementationItems", "queryItems", "performerItems", "constraintItems", "reactionItems", "invocationItems", "triggerItems", "reactionTriggerItems", "specificationItems", "policyItems", "validateItems", "actionItems", "tableItems", "templateItems", "screenItems", "candidate", "planCompletions", "lines", "lineIndex", "textBefore", "symbols", "scanDocument", "fences", "fenceMap", "withoutComment", "marker", "inConcept", "enclosingChain", "scope", "category", "responseEntries", "exampleCompletions", "responseCompletions", "dependencyEntries", "dependencyTargetCompletions", "importPath", "refusal", "refusalContext", "member", "contextVariableMatch", "currentLine", "effectiveIndent", "parentIndent", "guarded", "parent", "guardedActionItems", "nearestEnclosingLine", "actionArgumentItems", "interactionChoiceItems", "interactionActionItems", "refusalItems", "ruleContext", "namedRuleContext", "namedRuleImplementationItems", "commandRuleItems", "propertyOwner", "propertyName", "reservedProperty", "optionalPrefix", "match", "afterPropertyType", "afterQueryType", "subjectModifier", "subjectConcept", "concept", "subjectType", "subjectTarget", "attribute", "afterSubjectType", "modifierEntries", "optionalTypeItems", "step", "specificationStepItems", "enclosingLine", "inlineEventItems", "ruleItems", "headers", "enclosingHeaders", "entries", "expansion", "structureCompletion", "createCompletionProvider", "monaco", "options", "model", "position", "lines", "lineIndex", "textBefore", "application", "symbols", "symbolsForBuffer", "responseEntries", "exampleCompletions", "eventSourceCompletions", "operationCompletions", "responseCompletions", "plan", "planCompletions", "word", "range", "kinds", "asSnippet", "snippet", "__name", "entry", "symbolItem", "name", "kind", "detail", "eventNames", "inlineNames", "event", "knownEventNames", "pathRange", "path", "variableRange", "contextVariableItems", "policy", "knownTriggerNames", "command", "producesItems", "screen", "query", "typeReferenceText", "typeReferenceSymbol", "concept", "type", "primitiveTypes", "primitive", "createInlineCompletionProvider", "options", "model", "position", "lines", "lineIndex", "line", "symbols", "symbolsForBuffer", "suggestion", "structureCompletion", "__name", "responseTokenTypes", "responseTokens", "lines", "symbols", "tokens", "add", "__name", "line", "column", "length", "type", "source", "start", "path", "analysis", "responseAnalysis", "stream", "header", "part", "route", "command", "property", "withoutComment", "response", "field", "specification", "event", "fixture", "system", "operation", "keyword", "input", "phase", "name", "hint", "ordered", "left", "right", "token", "index", "reactionReferenceAt", "lines", "lineIndex", "startColumn", "endColumn", "application", "fences", "fenceMap", "line", "withoutComment", "match", "enclosingChain", "indentOf", "name", "column", "current", "scanned", "document", "scanDocument", "events", "named", "event", "generation", "selected", "__name", "matches", "declaration", "body", "directBody", "content", "prefix", "known", "property", "typeReferenceText", "propertyTypeReference", "imports", "imported", "triggers", "trigger", "handlerIntentDocs", "keywordDocs", "specificationKeywordDocs", "attributeDocs", "contextVariableDocs", "eventContextPaths", "path", "specialCategoryDocs", "hoverContent", "lines", "lineIndex", "word", "startColumn", "endColumn", "application", "fences", "fenceMap", "line", "withoutComment", "inString", "inTemplate", "index", "reaction", "reactionReferenceAt", "fixtureHover", "exampleHover", "sourceHover", "eventSourceHover", "operation", "operationHover", "tokenAt", "__name", "column", "name", "start", "before", "enclosingChain", "indentOf", "complianceHeader", "complianceBody", "doc", "attributeDocs", "specialCategoryDocs", "variable", "branch", "refusalContext", "member", "descriptions", "contextVariableDocs", "prefix", "followsPropertyType", "followsQueryType", "source", "eventAnalysisSource", "subjectPrefix", "ownerChain", "enclosingHeaders", "keywordDocs", "chain", "ruleContext", "namedRuleContext", "handlerIntentDocs", "symbols", "scanDocument", "owner", "command", "property", "typeReferenceText", "propertyTypeReference", "responseAvailability", "response", "field", "type", "specification", "responseAnalysis", "value", "concept", "candidate", "attributes", "values", "reasons", "attribute", "reason", "properties", "policy", "body", "event", "left", "right", "construct", "getSubLanguage", "step", "specificationKeywordDocs", "inEvent", "directBody", "directive", "keywordDoc", "createHoverProvider", "options", "model", "position", "word", "content", "hoverContent", "__name", "createInlayHintsProvider", "options", "model", "range", "destinationHints", "hint", "__name", "migrateOptional", "migrateCompliance", "migrationKind", "__name", "code", "DiagnosticCodes", "containsKind", "requested", "kind", "intersects", "left", "right", "createCodeActionProvider", "placement", "cache", "model", "range", "context", "token", "migrationRequested", "migrationOnly", "diagnostics", "marker", "isQuickFixDiagnostic", "version", "placementKey", "analysis", "prepareQuickFixes", "fixes", "diagnostic", "fix", "edit", "start", "end", "owner", "validationDelay", "validate", "monaco", "model", "options", "lines", "application", "symbolsForBuffer", "validateLines", "issue", "__name", "watch", "handle", "run", "languageId", "schedule", "contextChange", "attachDiagnostics", "pdl", "cdl", "screenplayDarkThemeName", "screenplayDark", "screenplayLightThemeName", "screenplayLight", "registeredInstances", "applyTokensProvider", "monaco", "languageId", "createTokensProvider", "getSubLanguages", "__name", "onSubLanguagesChanged", "ensureBuiltInSubLanguages", "getSubLanguage", "registerSubLanguage", "pdl", "cdl", "register", "options", "languageExtensionPoint", "languageConfiguration", "createCompletionProvider", "createInlineCompletionProvider", "createHoverProvider", "model", "position", "word", "symbols", "reference", "eventSourceReferenceAt", "reaction", "reactionReferenceAt", "target", "current", "source", "document", "location", "eventSourceIdentifier", "targetUri", "targetModels", "candidate", "targetModel", "responseTokenTypes", "data", "previousLine", "previousColumn", "token", "responseTokens", "createInlayHintsProvider", "createCodeActionProvider", "screenplayDarkThemeName", "screenplayDark", "screenplayLightThemeName", "screenplayLight", "attachDiagnostics"]
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport {\n clauseKeywords,\n codeBlockTags,\n constructKeywords,\n primitiveTypes,\n sliceTypes,\n} from './language';\nimport { MonarchTokenRules, SubLanguage } from './sub-language-registry';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\n// Maps a Screenplay inline code tag to the Monaco language id used for embedded highlighting.\n// Declaration registration must not globally reserve existing property names.\n// Ambiguous standalone operation headers are supplied by typed semantic tokens.\nconst contextualConstructs = new Set(['operation', 'system', 'eventsource', 'purpose']);\n\nconst embeddedLanguages: Record<string, string> = {\n csharp: 'csharp',\n typescript: 'typescript',\n react: 'typescript',\n html: 'html',\n sql: 'sql',\n};\n\nfunction subLanguageState(keyword: string): string {\n return `subLanguage_${keyword}`;\n}\n\n// A construct keyword at the start of a line ends any indented sub-language block.\nfunction subLanguageExitRule(subLanguages: SubLanguage[]): MonarchTokenRules[number] {\n const exitKeywords = [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...subLanguages.map((subLanguage) => subLanguage.keyword)];\n return [\n new RegExp(`^\\\\s*(?:${exitKeywords.join('|')})\\\\b`),\n { token: '@rematch', next: '@pop' },\n ];\n}\n\n// Shared across the composite `.play` tokenizer and every standalone sub-language tokenizer\n// (comments, `$`-prefixed context variables, strings, numbers, operators, delimiters, whitespace).\nexport const commonTokenRules: MonarchTokenRules = [\n [/\\/\\/.*$/, 'comment'],\n [/\\$(?:context|identity|eventContext|eventSourceId|causedBy|refusal)(?:\\.\\w+)*/, 'variable.predefined'],\n [/\\$(?:env|secrets|strings)\\.[\\w.]+/, 'variable.predefined'],\n [/\\$\\.[\\w.]*/, 'variable.predefined'],\n [/\"(?:[^\"\\\\]|\\\\.)*\"/, 'string'],\n [/\"(?:[^\"\\\\]|\\\\.)*$/, 'string.invalid'],\n [/\\d+(?:ms|s|m|h|d)\\b/, 'number'],\n [/-?\\d+\\.\\d+/, 'number.float'],\n [/-?\\d+/, 'number'],\n [/=>|==|!=|>=|<=|[><=:?]/, 'operator'],\n [/[[\\](),.]/, 'delimiter'],\n [/\\s+/, 'white'],\n];\n\nexport function createTokensProvider(subLanguages: SubLanguage[]): languages.IMonarchLanguage {\n const tokenizer: Record<string, MonarchTokenRules> = {\n root: [\n [new RegExp(`^(\\\\s*)(example)(\\\\s+)([A-Z][${bmpWordCharacters}]*)(\\\\s*)(:)(\\\\s*)([A-Z][${bmpWordCharacters}.]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'operator', 'white', 'type.identifier']],\n [/^(\\s*)(direction)(\\s+)(inbound|outbound)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^()(purpose)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@purposeBody.$1' }]],\n [/^(\\s*)(parameter)(\\s+)([a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\s+optional)?)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'identifier', 'white', 'type.identifier']],\n [/^(\\s*)(case)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:[a-z_]\\w*\\s*=|\\/\\/|$))/, ['white', 'keyword', 'white', 'type.identifier']],\n [/\\b(case)(\\.)([a-z_]\\w*)\\b/, ['keyword', 'delimiter', 'identifier']],\n [/^(\\s*)(concept)(\\s+)([^\\s:]+)(\\s*:\\s*)(\\w+)((?:\\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier', 'operator', { token: 'type.identifier', next: '@conceptBody.$1' }, 'keyword']],\n [/^(numbers)([ \\t]+)(exact)(?=[ \\t]*(?:(?:\\/\\/|#).*)?$)/, ['keyword', 'white', 'keyword']],\n [/^(eventsource)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(system)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(\\s*)(produces\\s+operation)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@operationBody.$1' }]],\n [/^(\\s*)(given\\s+operation)(\\s+)([\\w.]+)(\\s+)(fails)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*)(then\\s+(?:operation|compensated))(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier']],\n [new RegExp(`^(\\\\s*)(command)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@commandBody.$1' }]],\n [/^(\\s*)(handler)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@handlerBody.$1' }]],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(\\s+)(generated)(\\s+identifier|)(?=\\s*(?:\\/\\/.*)?$)/,\n ['identifier', 'type.identifier', 'white', 'keyword', 'keyword']],\n [/^(\\s*)(generated)(\\s+)([a-z_]\\w*)(\\s*=(?!=|>))/, ['white', 'keyword', 'white', 'identifier', 'operator']],\n [/^(\\s*)(then)(\\s+)(returns)\\b/, ['white', 'keyword', 'white', 'keyword']],\n // Only unambiguous response headers: two-token property declarations keep their names.\n [/^(\\s*)(returns)(?=\\s*(?:\\/\\/.*)?$|\\s+@\\w+\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A modifier only after a complete type; names called optional remain ordinary names.\n [/^(\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:from\\b|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n // Query prefixes cannot fall back to being property names.\n [/^(?!\\s*(?:by|filter)\\s+)(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:identifier\\b|from\\b|=(?!=|>)|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?!observable\\s+optional\\s*(?:\\/\\/.*)?$)(?:observable\\s+)?)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:\\/\\/.*)?$)/,\n ['keyword', 'type.identifier', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(given)(\\\\s+)(caller)(\\\\s+)(as)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n // A specification's clock, trigger, capture and query steps - matched before a sub-language keyword\n // can claim 'capture' and read the rest of the specification as change data capture.\n [/^(\\s*)(given|when)(\\s+)(clock|capture|trigger|query)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(result|no\\s+(?:result|events))\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(events)(\\s+)(in any order)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(redelivered)(\\s+)([\\w.]+)(\\s+)(to)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', 'type.identifier']],\n // Guarded-action words are contextual; property names keep their ordinary meaning.\n [/^(\\s*)(otherwise)(\\s+)(hidden)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(otherwise)(\\s+)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(when)(\\s+)(?=.+\\s+execute\\s+[\\w.]+\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', { token: 'white', next: '@guardedActionCondition' }]],\n [/^(\\s*)(behavior)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@behaviorBody.$1' }]],\n [/^(\\s*)(on)(\\s+)(refused)(\\s+)(by)(\\s+)(validation|constraint|authorization)\\b/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)(refused)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)([\\w-]+)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@interactionBody.$1' }]],\n [/^(\\s*)(acknowledge)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A quoted import names .play files rather than a qualified name - the path reads as a link.\n [/^(\\s*)(import)(\\s+)(\"[^\"\\\\]*\")/, ['white', 'keyword', 'white', 'string.link']],\n // Retain the header indent so event metadata stops at the enclosing block boundary.\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(\\s+)(generation)(\\s+)(\\d+)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', { token: 'number', next: '@eventBody.$1' }]],\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@eventBody.$1' }]],\n // A tagged opening fence carries the embedded language; legacy tag lines still highlight.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`^\\\\s*\\\\x60\\\\x60\\\\x60${tag}\\\\s*$`),\n { token: 'string.quote', next: `@codeBlock.${embeddedLanguages[tag]}`, nextEmbedded: embeddedLanguages[tag] },\n ],\n ),\n // Inline code block tags at end of line open an embedded code block.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${tag}\\\\b(?=\\\\s*$)`),\n { token: 'keyword.tag', next: `@codeBlockPending.${embeddedLanguages[tag]}` },\n ],\n ),\n // Sub-language constructs switch to the registered sub-language's token rules.\n ...subLanguages.map(\n (subLanguage): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${subLanguage.keyword}\\\\b`),\n { token: 'keyword', next: `@${subLanguageState(subLanguage.keyword)}` },\n ],\n ),\n // Typed documentation names are properties, not metadata directives.\n [/^(\\s*)(documentation)(?=\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?\\s*(?:identifier\\b|generated\\b|=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier']],\n // A bare description or documentation keyword opens a fenced prose block.\n [/\\b(?:description|documentation)\\b(?=\\s*(?:\\/\\/.*)?$)/, { token: 'keyword', next: '@descriptionBlockPending' }],\n [/\\brow-click\\b/, 'keyword'],\n // A leading @ escapes a name that collides with a directive keyword - it is a name, not an attribute.\n [/^\\s*@[a-z_]\\w*/, 'identifier'],\n [/@\\w+/, 'annotation'],\n [\n /[A-Z]\\w*/,\n {\n cases: {\n '@sliceTypes': 'keyword.type',\n '@primitiveTypes': 'type',\n '@default': 'type.identifier',\n },\n },\n ],\n [\n /[a-z_]\\w*/,\n {\n cases: {\n '@keywords': 'keyword',\n '@default': 'identifier',\n },\n },\n ],\n { include: '@common' },\n ],\n\n guardedActionCondition: [\n [/(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', { token: 'type.identifier', next: '@pop' }]],\n { include: '@root' },\n ],\n\n behaviorBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n { include: '@root' },\n ],\n\n interactionBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(otherwise)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(?=item\\.|\\()/, ['white', 'keyword', 'white']],\n [/^(\\s*)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n purposeBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\\s+)/, ['white', 'keyword', 'white']],\n [/\\b(safeguard|exception)\\b/, 'keyword'],\n { include: '@root' },\n ],\n\n conceptBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(@?pii|personal|@?sensitive|secret)(\\s+)(reason|scope|special|criminal)\\b/, ['white', 'keyword', 'white', 'keyword']],\n { include: '@root' },\n ],\n\n commandBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@commandValidation.$1' }]],\n { include: '@root' },\n ],\n\n commandValidation: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [new RegExp(`^(\\\\s*)([${bmpWordCharacters}.]+)(\\\\s+)(rule)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?:severity\\\\s+\\\\w+|message\\\\s+.*|//.*|$))`),\n ['white', 'identifier', 'white', 'keyword', 'white', { token: 'type.identifier', next: '@namedRuleBody.$1' }]],\n { include: '@root' },\n ],\n\n namedRuleBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n operationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(execute|compensate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@operationPhase.$1' }]],\n [/^(\\s*)(uses)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(@?[a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(?=\\s*(?:=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n operationPhase: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n handlerBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n implementationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(hint)(?=\\s+\")/, ['white', 'keyword']],\n { include: '@root' },\n ],\n\n eventBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(id)(?=\\s+\")/, ['white', 'keyword']],\n [/^(\\s*)(documentation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@descriptionBlockPending' }]],\n { include: '@root' },\n ],\n\n common: commonTokenRules,\n\n // After a code tag, the only thing allowed before the opening fence is whitespace.\n codeBlockPending: [\n [\n /^\\s*```\\s*$/,\n { token: 'string.quote', switchTo: '@codeBlock.$S2', nextEmbedded: '$S2' },\n ],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n codeBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop', nextEmbedded: '@pop' }],\n [/[^`]+/, ''],\n [/`/, ''],\n ],\n\n // After a bare description, the only thing allowed before the opening fence is whitespace.\n descriptionBlockPending: [\n [/\\/\\/.*$/, 'comment'],\n [/^\\s*```(?:text|markdown)?\\s*$/, { token: 'string.quote', switchTo: '@descriptionBlock' }],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n descriptionBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop' }],\n [/.+/, 'string'],\n ],\n };\n\n for (const subLanguage of subLanguages) {\n tokenizer[subLanguageState(subLanguage.keyword)] = [\n subLanguageExitRule(subLanguages),\n ...subLanguage.tokens,\n { include: '@common' },\n [/[A-Z]\\w*/, 'type.identifier'],\n [/[a-z_]\\w*/, 'identifier'],\n ];\n }\n\n return {\n defaultToken: '',\n tokenPostfix: '.play',\n ignoreCase: false,\n keywords: [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...clauseKeywords, ...codeBlockTags],\n sliceTypes,\n primitiveTypes,\n tokenizer,\n } as languages.IMonarchLanguage;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { CompletionEntry, optionalTypeItems } from './completion-items';\nimport { DocumentSymbols, PropertySymbol, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\nimport { responseAvailability, responseAnalysis } from './response-analysis';\nimport { primitiveTypes } from './language';\n\nexport function responseCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const fences = fenceMap(lines);\n if (fences[line] || withoutComment(before).length < before.length) return null;\n const indent = before.trim() === '' ? before.length : indentOf(lines[line]);\n const chain = enclosingChain(lines, fences, line, indent);\n const enclosing = nearestEnclosingLine(lines, fences, line, indent);\n const namedCommand = (name: string | undefined) => {\n const matches = symbols.commands.filter(command => command.name === name);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const entry = (property: PropertySymbol, insertText = property.name): CompletionEntry => ({\n label: property.name, insertText,\n documentation: `${typeReferenceText(propertyTypeReference(property))}${property.isGenerated ? ' \u2014 generated, not request/form input' : ''}. ${responseAvailability}`,\n });\n if (chain.includes('command')) {\n // Merged symbol line offsets belong to different documents. Only the current (possibly\n // unsaved) source can own the cursor; application symbols are for external lookup.\n const command = scanDocument(lines).commands.filter(command => command.line < line).at(-1);\n if (!command) return null;\n if (chain[0] === 'command') {\n if (/^\\s*returns\\s+@?\\w*$/.test(before)) {\n if (!/returns\\s+@/.test(before) && command.properties.some(property => property.name === 'returns' && property.line === line)) return null;\n return command.properties.map(property => entry(property, `${/returns\\s+@/.test(before) ? '' : '@'}${property.name}`));\n }\n const modifier = before.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/);\n if (modifier && ['generated', 'identifier'].some(word => word.startsWith(modifier[2]))) {\n const concept = symbols.concepts.find(concept => concept.name === modifier[1]);\n if (concept?.primitive === 'Uuid') return [\n ...('optional'.startsWith(modifier[2]) ? optionalTypeItems : []),\n { label: 'generated', insertText: 'generated', documentation: `Required scalar Uuid concept with no validation rules; not a request/form input. ${responseAvailability}` },\n { label: 'generated identifier', insertText: 'generated identifier', documentation: `Specification fixture uses an indented for value. ${responseAvailability}` },\n { label: 'identifier', insertText: 'identifier', documentation: 'Names the event source identifier.' },\n ];\n }\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+generated\\s+\\w*$/.test(before)) return [{ label: 'identifier', insertText: 'identifier', documentation: responseAvailability }];\n }\n if (chain[0] === 'returns') {\n if (/=\\s*@?\\w*$/.test(before)) return command.properties.map(property => entry(property));\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.]*$/.test(before)) return [...symbols.concepts.map(concept => concept.name), ...symbols.types.map(type => type.name), ...primitiveTypes].map(name => ({ label: name, insertText: name, documentation: `Explicit response type must exactly match the source. ${responseAvailability}` }));\n return command.properties.map(property => entry(property, `${property.name} = ${property.name}`));\n }\n }\n if (chain[0] === 'form' && enclosing && (/^\\s*field\\s+\\w*$/.test(before) || before.trim() === '')) {\n const command = namedCommand(enclosing.match(/\\bfor\\s+([\\w.]+)$/)?.[1]);\n if (command) return command.properties.filter(property => !property.isGenerated).map(property => entry(property, before.trim() === '' ? `field ${property.name}` : property.name));\n }\n if (chain.includes('specification')) {\n if (chain[0] === 'when' && enclosing) {\n const name = enclosing.match(/^when\\s+([\\w.]+)$/)?.[1];\n const command = namedCommand(name);\n if (!command) return null;\n if (/^\\s*generated\\s+\\w*$/.test(before)) return command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => entry(property, `${property.name} = \"\\${1:uuid}\"`));\n if (before.trim() === '') return [\n ...command.properties.filter(property => !property.isGenerated).map(property => entry(property, `${property.name} = \\${1:value}`)),\n ...command.properties.filter(property => property.isGenerated && !property.isIdentifier).map(property => ({ ...entry(property, `generated ${property.name} = \"\\${1:uuid}\"`), label: `generated ${property.name}` })),\n ...(command.properties.some(property => property.isGenerated && property.isIdentifier) ? [{ label: 'for', insertText: 'for \"${1:uuid}\"', documentation: `Generated identifier fixture, not request input. ${responseAvailability}` }] : []),\n ];\n }\n if (chain[0] === 'then' && /^then\\s+returns$/.test(enclosing ?? '')) {\n const specification = [...responseAnalysis(lines).specifications.values()].filter(specification => specification.location.line - 1 < line).at(-1);\n const command = namedCommand(specification?.when?.commandType);\n if (command?.response?.kind === 'RecordCommandResponseSyntax') {\n const properties = new Map(command.properties.map(property => [property.name, property]));\n return command.response.fields.map(field => {\n const source = properties.get(field.source.property);\n const type = field.type ?? (source ? propertyTypeReference(source) : undefined);\n return { label: field.name, insertText: `${field.name} = \\${1:value}`, documentation: `${type ? typeReferenceText(type) : 'Unresolved type'}. ${responseAvailability}` };\n });\n }\n }\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { enclosingHeaders, fenceMap, indentOf } from './document-context';\n\nfunction enclosing(lines: string[], line: number) {\n const headers = enclosingHeaders(lines, fenceMap(lines), line, indentOf(lines[line]));\n if (!headers.some(header => header.startsWith('specification ')) || headers.some(header => /^(?:case|given caller|when redelivered)\\b/.test(header))) return undefined;\n return [...responseAnalysis(lines).specifications].filter(([start]) => start <= line).sort(([left], [right]) => right - left)[0]?.[1];\n}\n\nexport function caseCompletions(lines: string[], line: number, before: string) {\n if (!/(?:=\\s*|for\\s+|then\\s+error\\s+)case\\.[\\w]*$/.test(before) || /when\\s+redelivered|given\\s+caller/.test(before) || /^\\s*case\\b/.test(before)) return null;\n const table = enclosing(lines, line);\n if ((table?.cases?.length ?? 0) === 0) return null;\n return table!.parameters?.map(parameter => ({ label: `case.${parameter.name}`, insertText: `case.${parameter.name}`, documentation: `Case value of ${parameter.type.name}${parameter.type.isCollection ? '[]' : ''}${parameter.type.isOptional ? ' optional' : ''}.` })) ?? [];\n}\n\nexport function caseHover(lines: string[], line: number, start: number, end: number): string | null {\n const text = lines[line];\n const reference = [...text.matchAll(/\\bcase\\.([a-z_]\\w*)\\b/g)].find(match => match.index! < end && match.index! + match[0].length >= start);\n if (reference === undefined) return null;\n const table = enclosing(lines, line);\n const parameter = table?.parameters?.find(parameter => parameter.name === reference[1]);\n if (parameter === undefined) return null;\n const values = table!.cases?.map(row => {\n const source = row.values.find(value => value.property === parameter.name)?.source;\n const value = source !== null && typeof source === 'object' && 'value' in source ? source.value : source;\n return `- ${row.name}: \\`${JSON.stringify(value)}\\``;\n }).join('\\n');\n return `**case.${parameter.name}** \u2014 ${parameter.type.name}\\n\\nCase origin in **${table!.name}**; substitutes after example overrides.\\n\\n${values ?? ''}`;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, withoutComment } from './document-context';\nimport { caseCompletions, caseHover } from './case-authoring';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\n\nfunction analyze(lines: string[], application?: DocumentSymbols) {\n const symbols = symbolsForBuffer(lines, application);\n return responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n}\n\nexport function exampleCompletions(lines: string[], line: number, before: string, application?: DocumentSymbols) {\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length) return null;\n const analysis = analyze(lines, application);\n return caseCompletions(lines, line, before) ?? analysis.personas.completions(line, before) ?? analysis.examples.completions(line, before);\n}\n\nexport function exampleHover(lines: string[], line: number, start: number, end: number, application?: DocumentSymbols) {\n const analysis = analyze(lines, application);\n return caseHover(lines, line, start, end) ?? analysis.personas.hover(line, start, end) ?? analysis.examples.hover(line, start, end);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry, operationItems, operationPhaseItems, operationImplementationItems } from './completion-items';\nimport { enclosingChain, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { DocumentSymbols } from './symbols';\nimport { responseAnalysis } from './response-analysis';\nimport { OperationAnalysis, OperationDeclaration, OperationPhase } from './OperationAnalysis';\nimport { TypeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\n\nexport const operationAvailability = 'Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#301). No semantic or requirement identity is assigned.';\n\nexport function analyzeOperations(lines: string[], symbols?: DocumentSymbols) {\n return responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols?.authoringPlacement, symbols?.authoringPath).operations;\n}\n\nexport function phaseState(phase: OperationPhase | null): string {\n return !phase ? 'not declared' : phase.file ? `file ${phase.file.path}` : phase.code ? `inline ${phase.code.language}` : 'pending';\n}\n\nexport function operationDetails(operation: OperationDeclaration): string {\n const inputs = operation.inputs.map(input => `${input.name} ${typeReferenceText(input.type)}`).join('\\n');\n const phase = (name: string, value: OperationPhase | null) => `${name}: ${name === 'compensate' && !value ? 'not declared' : phaseState(value)}${value?.description ? ` \u2014 ${value.description}` : ''}${value?.implementation?.hints.map(hint => `\\n hint: ${hint.text}`).join('') ?? ''}`;\n return `**operation ${[...operation.scope, operation.name].join('.')}**\\n\\n${operation.description ?? ''}\\n\\nUses ${operation.uses}\\n\\n\\`\\`\\`screenplay\\n${inputs}\\n\\`\\`\\`\\n\\n${phase('execute', operation.execute)}\\n\\n${phase('compensate', operation.compensate)}\\n\\n${operationAvailability}`;\n}\n\nexport function operationCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const fences = fenceMap(lines);\n if (fences[line] || withoutComment(before).length < before.length) return null;\n const indent = before.trim() === '' ? before.length : indentOf(lines[line]);\n const chain = enclosingChain(lines, fences, line, indent);\n const enclosing = nearestEnclosingLine(lines, fences, line, indent) ?? '';\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const operations = analysis.operations;\n const context = operations.contexts.get(line);\n const targets = () => {\n if (!context) return [];\n const reference = before.match(/(?:produces|given\\s+operation|then\\s+(?:operation|compensated))\\s+([\\w.]*)$/)?.[1] ?? before.trim();\n const qualifiers = reference.split('.').slice(0, -1);\n return operations.targets(context.scope).filter(target => qualifiers.length === 0 ||\n qualifiers.length <= target.declaration.scope.length && qualifiers.every((part, index) => target.declaration.scope[target.declaration.scope.length - qualifiers.length + index] === part))\n .map(target => ({ label: target.name, insertText: qualifiers.length > 0 ? target.declaration.name : target.name, documentation: operationDetails(target.declaration) }));\n };\n if (chain.includes('specification') && /^\\s*(?:given\\s+operation|then\\s+(?:operation|compensated))\\s+[\\w.]*$/.test(before)) return targets();\n if (chain[0] === 'command' && /^\\s*produces\\s+[\\w.]*$/.test(before)) return targets().length ? [\n { label: 'event', insertText: 'event ${1:Name}', documentation: 'Declares an inline event.' },\n { label: 'operation', insertText: 'operation ${1:Name}\\n uses ${2:System}\\n ${3:input} ${4:Type} = ${5:source}', documentation: operationAvailability },\n ...symbols.events.map(event => ({ label: event.name, insertText: event.name, documentation: 'Declared event.' })), ...targets()\n ] : null;\n if (context?.commandLine !== undefined && chain[0] === 'produces' && /^produces\\s+when\\b/.test(enclosing) && /^\\s*[\\w.]*$/.test(before)) return targets();\n const ownedOperation = context?.operation;\n const operation = ownedOperation && (line === ownedOperation.location.line - 1 || indent > indentOf(lines[ownedOperation.location.line - 1])) ? ownedOperation : undefined;\n if (operation && /^\\s*uses\\s+\\w*$/.test(before) && !operation.inputs.some(input => input.location.line === line + 1)) return operations.systems.map(system => ({ label: system.name, insertText: system.name, documentation: `${system.description ?? 'External system'}. ${operationAvailability}` }));\n if (chain[0] === 'implementation' && ['execute', 'compensate'].includes(chain[1])) return operationImplementationItems;\n if (['execute', 'compensate'].includes(chain[0]) && operation) return operationPhaseItems;\n const production = context?.production;\n const targetLine = (production?.targetLocation ?? production?.location)?.line;\n const inProductionBody = targetLine !== undefined && line > targetLine - 1 && indent > indentOf(lines[targetLine - 1]);\n const mappedOperation = operation ?? (inProductionBody ? production?.declaration : undefined);\n // Typed ranges include blank lines and comments. The caret must still be inside\n // the target's body, not dedented to a command member or conditional target line.\n // Ancestor keywords cannot own mappings, including deeper composite paths.\n if (mappedOperation) {\n const rhs = before.match(/=\\s*([\\w.]*)$/);\n if (rhs && context?.commandLine !== undefined) {\n const command = analysis.commands.get(context.commandLine);\n let properties: readonly { name: string; type: TypeReferenceSymbol; isGenerated?: boolean }[] = command?.properties ?? [];\n const parts = rhs[1].split('.');\n for (const part of parts.slice(0, -1)) {\n const property = properties.find(property => property.name === part);\n if (!property || property.type.isCollection) return [];\n const types = operations.types.filter(type => type.name === property.type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties;\n }\n return properties.map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)}${property.isGenerated ? ' \u2014 generated source, not request input' : ''}. ${operationAvailability}` }));\n }\n if (operation && /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+\\w*$/.test(before)) return [{ label: 'optional', insertText: 'optional', documentation: 'Allows absence of the complete operation input value.' }];\n if (/^\\s*@?[a-z_]\\w*\\s+[\\w.[\\]?]*$/.test(before) && operation) return [...operations.concepts.map(concept => concept.name), ...operations.types.map(type => type.name), 'String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'].map(name => ({ label: name, insertText: name, documentation: 'Operation input type.' }));\n if (operation) return operationItems;\n return mappedOperation.inputs.map(input => ({ label: input.name, insertText: `${input.name} = \\${1:source}`, documentation: `${typeReferenceText(input.type)}. ${operationAvailability}` }));\n }\n if (chain[0] === 'then' && /^then\\s+operation\\s+/.test(enclosing)) {\n const name = enclosing.match(/^then\\s+operation\\s+([\\w.]+)/)?.[1];\n const declaration = operations.references.filter(reference => reference.name === name && reference.location.line - 1 < line && reference.kind === 'operation').at(-1)?.declaration;\n if (declaration) {\n const value = before.match(/^\\s*(\\w+)\\s*=\\s*[^=]*$/);\n if (value) {\n const type = declaration.inputs.find(input => input.name === value[1])?.type;\n const concept = operations.concepts.filter(concept => concept.name === type?.name);\n if (concept.length === 1 && concept[0].type === 'Enum') return concept[0].values.map(value => ({ label: value, insertText: JSON.stringify(value), documentation: `${type?.name} value.` }));\n }\n return declaration.inputs.map(input => ({ label: input.name, insertText: `${input.name} = \\${1:value}`, documentation: `${typeReferenceText(input.type)}. Partial assertion; ${operationAvailability}` }));\n }\n }\n return null;\n}\n\n// Shared by both editor hosts. Only the parser-owned target span can bind a reference;\n// a repeated identifier in a trailing comment or a condition is not that reference.\nexport function operationReferenceAt(analysis: OperationAnalysis, lines: string[], line: number, start: number, end: number) {\n const source = withoutComment(lines[line] ?? '');\n return analysis.references.find(reference => {\n const target = reference.targetLocation ?? reference.location;\n return target.line === line + 1 && start >= target.column && end <= target.column + reference.name.length &&\n source.slice(target.column - 1, target.column - 1 + reference.name.length) === reference.name;\n });\n}\n\nexport function operationHover(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols): string | null {\n const analysis = analyzeOperations(lines, symbols);\n const source = lines[line] ?? '';\n const at = (location: { line: number; column: number }, name: string) => {\n const column = location.column + (source[location.column - 1] === '@' ? 1 : 0);\n return location.line === line + 1 && start === column && end === column + name.length && source.slice(start - 1, end - 1) === name;\n };\n const context = analysis.contexts.get(line);\n const property = context?.operation?.inputs.find(input => at(input.location, input.name));\n if (property) return `**${property.name}** \u2014 ${typeReferenceText(property.type)}. Operation input, not a command request field. ${operationAvailability}`;\n const equals = source.indexOf('=');\n if (equals >= 0 && start - 1 > equals && context?.commandLine !== undefined && (context.operation || context.production?.declaration)) {\n const command = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(text => text !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath).commands.get(context.commandLine);\n const expression = source.slice(equals + 1, end - 1).trim();\n const parts = expression.split('.');\n let properties: readonly { name: string; type: TypeReferenceSymbol }[] = command?.properties ?? [];\n for (const [index, part] of parts.entries()) {\n const property = properties.find(property => property.name === part);\n if (!property) break;\n if (index === parts.length - 1) return `**${part}** \u2014 ${typeReferenceText(property.type)}. Command source for an operation input. ${operationAvailability}`;\n const types = analysis.types.filter(type => type.name === property.type.name);\n if (types.length !== 1 || property.type.isCollection) break;\n properties = types[0].properties;\n }\n }\n const reference = operationReferenceAt(analysis, lines, line, start, end);\n if (reference?.declaration) return operationDetails(reference.declaration);\n if (reference?.kind === 'ambiguous') return `Ambiguous production: no declaration kind was selected. ${operationAvailability}`;\n const operation = context?.operation;\n if (operation && operation.location.line === line + 1) {\n const header = withoutComment(source).match(/^\\s*(?:produces\\s+)?operation\\s+/)?.[0];\n if (header && start === header.length + 1 && end === start + operation.name.length) return operationDetails(operation);\n }\n if (operation?.usesLocation?.line === line + 1 && start >= operation.usesLocation.column && end <= operation.usesLocation.column + operation.uses.length && withoutComment(source).slice(start - 1, end - 1) === operation.uses.slice(start - operation.usesLocation.column, end - operation.usesLocation.column)) {\n const systems = analysis.systems.filter(system => system.name === operation.uses);\n return systems.length === 1 ? `**system ${systems[0].name}**\\n\\n${systems[0].description ?? ''}\\n\\n${operationAvailability}` : `Unresolved or ambiguous external system. ${operationAvailability}`;\n }\n for (const phase of [operation?.execute, operation?.compensate]) {\n if (!phase) continue;\n if (phase.location.line === line + 1 || phase.implementation?.location.line === line + 1 || phase.implementation?.hints.some(hint => hint.location.line === line + 1)) return `${phaseState(phase)}\\n\\n${phase.description ?? ''}\\n\\n${phase.implementation?.hints.map(hint => hint.text).join('\\n') ?? ''}\\n\\n${operationAvailability}`;\n }\n const system = analysis.systems.find(system => system.location.path === (symbols?.authoringPath ?? 'current.play') && system.location.line === line + 1);\n return system ? `**system ${system.name}**\\n\\n${system.description ?? ''}\\n\\n${operationAvailability}` : null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry } from './completion-items';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\nimport { AuthoredEventSource } from './AuthoredEventSource';\nimport { AuthoredStream } from './AuthoredStream';\nimport { isSourceStreamName, isSourceStreamTypeName, sourceStreamPattern } from '@cratis/screenplay-compiler';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\nimport { responseAnalysis } from './response-analysis';\nimport { typeReferenceText } from './TypeReferenceSymbol';\n\nexport const eventSourceAvailability = 'Event sources, streams and declarative command routes are admitted in executable semantic model (ESM) v8. A route classifies events; it does not supply an identity destination. Property-path mappings and handler routes remain unadmitted (PLAY0268).';\n\nexport const specificationRouteAvailability = 'Specification event routes, including example routes, are admitted in executable semantic model (ESM) v8. Redelivery remains unadmitted (PLAY0268) (#433), independently of its locator route.';\n\nconst routePrefix = sourceStreamPattern('^\\\\s*stream\\\\s+(?:[A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)?\\\\.?)?$');\nconst keyPrefix = sourceStreamPattern('^\\\\s*streamId\\\\s*=\\\\s*([\\\\w.]*)$');\nconst identifierTypePrefix = sourceStreamPattern('^\\\\s*identifier\\\\s+[\\\\w.]*$');\nconst streamTypePrefix = sourceStreamPattern('^\\\\s*streamId\\\\s+[\\\\w.]*$');\n\nexport function analyzeEventSources(lines: string[], symbols?: DocumentSymbols) {\n symbols = symbolsForBuffer(lines, symbols);\n return responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath, symbols?.authoringPlacementResolved).eventSources;\n}\n\nexport function eventSourceDetails(source: AuthoredEventSource, stream?: AuthoredStream): string {\n return [`**${stream ? `stream ${source.name}.${stream.name}` : `eventsource ${source.name}`}**`,\n stream?.description ?? source.description ?? '',\n source.identifier ? `Identifier type: ${typeReferenceText(source.identifier)}` : 'No identifier type declared.',\n stream ? stream.streamIdParts.length > 0 ? `Stream id parts: ${stream.streamIdParts.map(part => `${part.name} ${typeReferenceText(part.type)}`).join(', ')}` : stream.streamId ? `Stream id type: ${typeReferenceText(stream.streamId)}` : 'Unkeyed stream.' : source.streams.map(stream => `${stream.name}${stream.streamIdParts.length > 0 ? ` \u2014 ${stream.streamIdParts.map(part => `${part.name} ${typeReferenceText(part.type)}`).join(', ')}` : stream.streamId ? ` \u2014 ${typeReferenceText(stream.streamId)}` : ' \u2014 unkeyed'}`).join('\\n'),\n (stream?.id ?? (!stream ? source.id : null)) ? 'Stored-name pin (rename-only metadata; not a semantic ID).' : '', eventSourceAvailability].filter(Boolean).join('\\n\\n');\n}\n\nexport function eventSourceReferenceAt(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols) {\n const analysis = analyzeEventSources(lines, symbols);\n const at = (route: typeof analysis.routes[number]) => {\n const location = route.referenceLocation;\n const name = `${route.eventSource}.${route.stream}`;\n return location?.line === line + 1 && start >= location.column && end <= location.column + name.length &&\n withoutComment(lines[line] ?? '').slice(location.column - 1, location.column - 1 + name.length) === name;\n };\n const candidate = analysis.ambiguousCandidates.find(at);\n if (candidate) return { route: candidate, resolution: { state: 'ambiguous', source: undefined, stream: undefined }, target: undefined };\n const route = analysis.routes.find(at);\n if (!route) return null;\n const resolution = analysis.resolve(route.eventSource, route.stream);\n const sourcePart = end <= route.referenceLocation!.column + route.eventSource.length;\n return { route, resolution, target: resolution.state === 'unique' ? sourcePart ? resolution.source : resolution.stream : undefined };\n}\n\n// The location is a typed header start. Match its exact prefix, never search comments or another\n// occurrence of the same name. Both hosts use this to navigate to the authored identifier.\nexport function eventSourceIdentifier(location: { line: number; column: number; path?: string }, name: string, source: string) {\n const line = withoutComment(source.split(/\\r?\\n/)[location.line - 1] ?? '');\n const prefix = line.slice(location.column - 1).match(/^(?:eventsource|stream)\\s+/)?.[0];\n return prefix && line.slice(location.column - 1 + prefix.length, location.column - 1 + prefix.length + name.length) === name\n ? { ...location, column: location.column + prefix.length } : undefined;\n}\n\nexport function eventSourceHover(lines: string[], line: number, start: number, end: number, symbols?: DocumentSymbols): string | null {\n symbols = symbolsForBuffer(lines, symbols);\n const analysis = analyzeEventSources(lines, symbols);\n const reference = eventSourceReferenceAt(lines, line, start, end, symbols);\n if (reference) return reference.resolution.source && reference.resolution.stream ? eventSourceDetails(reference.resolution.source, reference.resolution.stream) + (analysis.contexts.get(line)?.event ? `\\n\\n${specificationRouteAvailability}` : '')\n : `Physical stream owner: ${reference.resolution.state}; no route selected. ${'reasons' in reference.resolution ? reference.resolution.reasons.join(' ') : ''} ${eventSourceAvailability}`;\n const context = analysis.contexts.get(line);\n if (context?.event?.noStream?.location.line === line + 1 && start >= context.event.noStream.location.column && end <= context.event.noStream.location.column + 9)\n return `Assert an unrouted event; omitting a route on then leaves it unasserted. ${specificationRouteAvailability}`;\n if (context?.event && context.route?.streamId?.location.line === line + 1 && start === context.route.streamId.location.column && end === start + 8)\n return `Concrete literal stream id, not a command property mapping. ${specificationRouteAvailability}`;\n const blockLocation = context?.route?.directiveLocations?.streamId ?? context?.stream?.directiveLocations?.streamId;\n if (blockLocation?.line === line + 1 && start === blockLocation.column && end === start + 8)\n return `Composite stream id: named parts, not a pre-joined value. ${context?.event ? specificationRouteAvailability : eventSourceAvailability}`;\n for (const part of context?.route?.streamIdParts ?? []) {\n if (part.location.line === line + 1 && start === part.location.column && end === start + part.property.length)\n return `Authored stream id part **${part.property}**. ${context?.event ? `Concrete literal. ${specificationRouteAvailability}` : eventSourceAvailability}`;\n }\n const declaration = context?.stream ?? context?.source;\n if (declaration) {\n const name = eventSourceIdentifier(declaration.location, declaration.name, lines.join('\\n'));\n if (name?.line === line + 1 && start === name.column && end === start + declaration.name.length && context?.source) {\n const confidence = analysis.resolve(context.source.name, context.stream?.name);\n return eventSourceDetails(context.source, context.stream) + (confidence.state === 'unique' ? '' : `\\n\\nPhysical ownership: ${confidence.state}. ${confidence.reasons.join(' ')}`);\n }\n }\n const mapping = context?.route ? [context.route.streamId, ...context.route.streamIdParts].find(mapping => mapping?.location.line === line + 1) : undefined;\n if (mapping && context?.command) {\n if (mapping.location.line === line + 1 && start === mapping.location.column && end === start + 8)\n return `Authored stream id mapping. ${eventSourceAvailability}`;\n const expression = mapping.source as { kind?: string; path?: string; location?: { line: number; column: number } };\n if (expression.kind === 'PathExpressionSyntax' && expression.path && expression.location?.line === line + 1 &&\n start >= expression.location.column && end <= expression.location.column + expression.path.length) {\n const typed = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, symbols?.authoringPath, symbols?.authoringPlacementResolved);\n const prefix = expression.path.slice(0, end - expression.location.column);\n const parts = prefix.split('.');\n let properties = context.command.properties;\n let optional = false;\n let collection = false;\n for (const [index, part] of parts.entries()) {\n const matches = properties.filter(property => property.name === part);\n if (matches.length !== 1) break;\n const property = matches[0];\n optional ||= property.type.isOptional;\n collection ||= property.type.isCollection;\n if (index === parts.length - 1)\n return `**${part}** \u2014 ${typeReferenceText({ ...property.type, isOptional: optional, isCollection: collection })}. Command source for authored stream id. ${eventSourceAvailability}`;\n const types = typed.operations.types.filter(type => type.name === property.type.name);\n if (types.length !== 1 || collection) break;\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n }\n }\n if (context?.source && /^\\s*id\\s+\"/.test(withoutComment(lines[line] ?? '')) && start === indentOf(lines[line]) + 1 && end === start + 2)\n return `Stored-name pin: rename-only metadata, not a semantic identity or an automatic refactor. ${eventSourceAvailability}`;\n const type = context?.stream?.streamIdParts.find(part => part.type.location?.line === line + 1)?.type ?? context?.stream?.streamId ?? context?.source?.identifier;\n if (type && type.location?.line === line + 1 && start >= type.location.column && end <= type.location.column + type.name.length)\n return `${typeReferenceText(type)} \u2014 authored ${context?.stream ? 'stream id' : 'identifier'} type. ${eventSourceAvailability}`;\n return null;\n}\n\nfunction streamIdHeader(lines: string[], line: number, owner: number): number | null {\n const indent = indentOf(lines[line] ?? '');\n for (let index = line - 1; index > owner; index--) {\n const text = withoutComment(lines[index]);\n if (!text.trim() || indentOf(text) >= indent) continue;\n return text.trim() === 'streamId' ? index : null;\n }\n return null;\n}\n\nexport function eventSourceCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n // .NET word characters are UTF-16 code units; supplementary letters are not identifiers.\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length || /[\\uD800-\\uDFFF]/.test(before)) return null;\n const analysis = analyzeEventSources(lines, symbols);\n const context = analysis.contexts.get(line);\n const indent = before.trim() ? indentOf(lines[line]) : before.length;\n if (context?.route && indent > indentOf(lines[context.route.location.line - 1])) {\n const stream = analysis.resolve(context.route.eventSource, context.route.stream).stream;\n if (stream?.streamIdParts.length) {\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const literal = (name: string) => {\n const primitive = typed.operations.concepts.find(concept => concept.name === name)?.type ?? name;\n return primitive === 'Int' ? '0' : primitive === 'Uuid' ? '\"00000000-0000-0000-0000-000000000000\"' : '\"${1:value}\"';\n };\n if (streamIdHeader(lines, line, context.route.location.line - 1) !== null) {\n const mapping = sourceStreamPattern('^\\\\s*([A-Za-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*([\\\\w.]*)$').exec(before);\n if (mapping) {\n const part = stream.streamIdParts.find(part => part.name === mapping[1]);\n if (!part) return [];\n if (context.event) return [{ label: part.name, insertText: literal(part.type.name), documentation: specificationRouteAvailability }];\n if (!context.command) return [];\n const concepts = typed.operations.concepts.filter(concept => concept.name === part.type.name);\n if (part.type.isOptional || part.type.isCollection || !(['String', 'Uuid'].includes(part.type.name) || concepts.length === 1 && ['String', 'Uuid', 'Int'].includes(concepts[0].type) && concepts[0].values.length === 0)) return [];\n const path = mapping[2].split('.');\n let properties = context.command.properties;\n for (const segment of path.slice(0, -1)) {\n const fields = properties.filter(property => property.name === segment && !property.type.isOptional && !property.type.isCollection);\n if (fields.length !== 1) return [];\n const types = typed.operations.types.filter(type => type.name === fields[0].type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n return properties.filter(property => isSourceStreamName(property.name) && property.type.name === part.type.name && !property.type.isOptional && !property.type.isCollection)\n .map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)} \u2014 command source for authored stream id. ${eventSourceAvailability}` }));\n }\n const mapped = new Set(context.route.streamIdParts.filter(part => part.location.line !== line + 1).map(part => part.property));\n return stream.streamIdParts.filter(part => !mapped.has(part.name) && part.name.startsWith(before.trim()))\n .map(part => ({ label: part.name, insertText: `${part.name} = ${context.event ? literal(part.type.name) : ''}`, documentation: context.event ? specificationRouteAvailability : eventSourceAvailability }));\n }\n if (/^\\s*(?:streamId)?$/.test(before)) return [{ label: 'streamId parts', insertText: `streamId\\n${stream.streamIdParts.map((part, index) => ` ${part.name} = ${context.event ? literal(part.type.name) : `\\${${index + 1}:source}`}`).join('\\n')}`, documentation: context.event ? specificationRouteAvailability : eventSourceAvailability }];\n return [];\n }\n }\n if (context?.event && indent > indentOf(lines[context.event.location.line - 1])) {\n if (context.route && indent > indentOf(lines[context.route.location.line - 1])) {\n const target = analysis.resolve(context.route.eventSource, context.route.stream).stream?.streamId;\n if (!target || context.route.streamId && context.route.streamId.location.line !== line + 1) return [];\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const primitive = typed.operations.concepts.find(concept => concept.name === target.name)?.type ?? target.name;\n const literal = primitive === 'Int' ? '0' : primitive === 'Uuid' ? '\"00000000-0000-0000-0000-000000000000\"' : '\"${1:value}\"';\n if (/^\\s*(?:streamId\\s*=\\s*)?$/.test(before) || 'streamId'.startsWith(before.trim()))\n return [{ label: 'streamId', insertText: before.includes('=') ? literal : `streamId = ${literal}`, documentation: `Concrete ${typeReferenceText(target)} literal. ${specificationRouteAvailability}` }];\n return [];\n }\n if (routePrefix.test(before) && (!context.event.stream || context.event.stream.location.line === line + 1) && !context.event.noStream) {\n const qualified = before.trim().split(/\\s+/)[1] ?? '';\n // Specification payload lines require '=', so imported value types cannot compete\n // with a route here as they do under a command. Physical ownership still must be unique.\n const targets = analysis.declarations.flatMap(source => source.streams.filter(stream => analysis.resolve(source.name, stream.name).state === 'unique')\n .map(stream => ({ name: `${source.name}.${stream.name}`, source, stream })));\n return targets.filter(target => isSourceStreamName(target.source.name) && isSourceStreamName(target.stream.name) && (!qualified.includes('.') || target.name.startsWith(qualified.slice(0, qualified.lastIndexOf('.') + 1))))\n .map(target => ({ label: target.name, insertText: qualified.includes('.') ? target.stream.name : target.name, documentation: `${eventSourceDetails(target.source, target.stream)}\\n\\n${specificationRouteAvailability}` }));\n }\n if (context.event.stream || context.event.noStream)\n return !before.trim() || 'stream'.startsWith(before.trim()) || 'no stream'.startsWith(before.trim()) ? [] : null;\n const entries = [{ label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: specificationRouteAvailability },\n ...(context.expectation ? [{ label: 'no stream', insertText: /^\\s*no\\s+/.test(before) ? 'stream' : 'no stream', documentation: `Assert an unrouted fact. ${specificationRouteAvailability}` }] : [])];\n const matching = entries.filter(entry => entry.label.startsWith(before.trim()));\n return matching.length > 0 ? matching : null;\n }\n if (context?.command && indent > indentOf(lines[context.command.location.line - 1]) &&\n (!context.route || indent <= indentOf(lines[context.route.location.line - 1])) && routePrefix.test(before)) {\n // A property named stream remains legal. Only offer routes whose complete-input\n // candidates have no known value-type competitor; never silently rewrite ambiguity.\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const names = new Set([...typed.operations.concepts, ...typed.operations.types].map(type => type.name));\n // targets already exclude competing imports from the authoritative parsed documents.\n // Scanned symbols can retain an import removed from the current unsaved buffer.\n const qualified = before.trim().split(/\\s+/)[1] ?? '';\n return analysis.targets.filter(target => isSourceStreamName(target.source.name) && isSourceStreamName(target.stream.name) && !names.has(target.name) && (!qualified.includes('.') || target.name.startsWith(qualified.slice(0, qualified.lastIndexOf('.') + 1))))\n .map(target => ({ label: target.name, insertText: qualified.includes('.') ? target.stream.name : target.name, documentation: eventSourceDetails(target.source, target.stream) }));\n }\n if (context?.route && context.command && indent > indentOf(lines[context.route.location.line - 1]) && keyPrefix.test(before)) {\n const target = analysis.resolve(context.route.eventSource, context.route.stream).stream?.streamId;\n if (!target) return [];\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const concepts = typed.operations.concepts.filter(concept => concept.name === target.name);\n const supported = ['String', 'Uuid'].includes(target.name) || concepts.length === 1 && ['String', 'Uuid', 'Int'].includes(concepts[0].type) && concepts[0].values.length === 0;\n if (!supported || target.isOptional || target.isCollection) return [];\n const parts = keyPrefix.exec(before)![1].split('.');\n let properties = context.command.properties;\n for (const part of parts.slice(0, -1)) {\n const matches = properties.filter(property => property.name === part);\n if (matches.length !== 1 || matches[0].type.isOptional || matches[0].type.isCollection) return [];\n const types = typed.operations.types.filter(type => type.name === matches[0].type.name);\n if (types.length !== 1) return [];\n properties = types[0].properties.map(property => ({ ...property, isIdentifier: false }));\n }\n return properties.filter(property => isSourceStreamName(property.name) && property.type.name === target.name && !property.type.isOptional && !property.type.isCollection)\n .map(property => ({ label: property.name, insertText: property.name, documentation: `${typeReferenceText(property.type)} \u2014 command source for authored stream id. ${eventSourceAvailability}` }));\n }\n if (context?.source && indent > indentOf(lines[context.source.location.line - 1])) {\n const ownsStream = context.stream && indent > indentOf(lines[context.stream.location.line - 1]);\n const partType = ownsStream && streamIdHeader(lines, line, context.stream!.location.line - 1) !== null && sourceStreamPattern('^\\\\s*[A-Za-z_]\\\\w*\\\\s+[\\\\w.]*$').test(before);\n if (partType || (ownsStream ? streamTypePrefix : identifierTypePrefix).test(before)) {\n const typed = responseAnalysis(lines, symbols.authoringDocuments ?? [], symbols.authoringPlacement, symbols.authoringPath);\n const streamId = partType || /^\\s*streamId\\b/.test(before);\n return [...(streamId ? ['String', 'Uuid'] : ['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']), ...typed.operations.concepts.filter(concept => !streamId || ['String', 'Uuid', 'Int'].includes(concept.type) && concept.values.length === 0).map(concept => concept.name)]\n .filter(isSourceStreamTypeName).map(name => ({ label: name, insertText: name, documentation: eventSourceAvailability }));\n }\n if (/^\\s*$/.test(before)) return ownsStream ? [\n { label: 'streamId', insertText: 'streamId ${1:Type}', documentation: eventSourceAvailability },\n { label: 'streamId parts', insertText: 'streamId\\n ${1:first} ${2:Type}\\n ${3:second} ${4:Type}', documentation: eventSourceAvailability },\n { label: 'description', insertText: 'description \"${1:Description}\"', documentation: 'Authored description.' }\n ] : [\n { label: 'identifier', insertText: 'identifier ${1:Type}', documentation: eventSourceAvailability },\n { label: 'stream', insertText: 'stream ${1:Name}', documentation: eventSourceAvailability },\n { label: 'description', insertText: 'description \"${1:Description}\"', documentation: 'Authored description.' }\n ];\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, indentOf, withoutComment } from './document-context';\n\n// Return only an enclosing invocation branch, never a sibling branch or quoted/code content.\nexport function refusalContext(lines: string[], lineIndex: number, indent: number): string | undefined {\n const fences = fenceMap(lines);\n const headers: string[] = [];\n for (let index = lineIndex - 1; index >= 0 && indent > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]);\n if (line.trim().length === 0 || indentOf(line) >= indent) continue;\n headers.push(line.trim());\n indent = indentOf(line);\n }\n const branch = headers.findIndex(header => /^on\\s+refused(?:\\s|$)/.test(header));\n return branch >= 0 && /^invokes\\s+/.test(headers[branch + 1] ?? '') && headers.some(header => /^reaction\\s+/.test(header)) ? headers[branch] : undefined;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { bmpWordCharacters } from './bmp-word-characters';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\n\n// The command property form, with the compiler/tokenizer BMP identifier boundary, including its existing optional severity/message suffixes.\nexport const commandNamedRulePattern = new RegExp(`^[${bmpWordCharacters}.]+\\\\s+rule\\\\s+[A-Za-z_][${bmpWordCharacters}]*(?:\\\\s+severity\\\\s+(?:information|warning|error))?(?:\\\\s+message\\\\s+.*)?$`);\n\nexport function namedRuleContext(lines: string[], lineIndex: number, indent: number): 'rule' | 'implementation' | null {\n const fences = fenceMap(lines);\n const owners: string[] = [];\n let boundary = indent;\n for (let index = lineIndex - 1; index >= 0 && boundary > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]).trimEnd();\n if (line.trim().length === 0 || indentOf(line) >= boundary) continue;\n owners.push(line.trim());\n boundary = indentOf(line);\n }\n const wrapped = owners[0] === 'implementation';\n const offset = wrapped ? 1 : 0;\n return commandNamedRulePattern.test(owners[offset] ?? '') && owners[offset + 1] === 'validate' && /^command\\s/.test(owners[offset + 2] ?? '')\n ? wrapped ? 'implementation' : 'rule' : null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, withoutComment } from './document-context';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\nimport { CompletionEntry } from './completion-items';\n\nexport function dependencyTargetCompletions(lines: string[], line: number, before: string, application: DocumentSymbols): CompletionEntry[] | null {\n if (fenceMap(lines)[line] || withoutComment(before).length < before.length) return null;\n const match = before.match(/^\\s*depends\\s+on\\s+((?:[A-Za-z_]\\w*\\.)*)([A-Za-z_]\\w*)?$/);\n if (!match) return null;\n const symbols = symbolsForBuffer(lines, application);\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [],\n symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n return analysis.dependencies.completions(line, match[1], symbols.authoringPlacement);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DocumentSymbols } from './symbols';\n\nconst exampleUuid = '\"0f8fad5b-d9cb-469f-a165-70867728950e\"';\n\nconst primitiveExamples: Record<string, string> = {\n Uuid: exampleUuid,\n String: '\"Example\"',\n Int: '1',\n Decimal: '1.5',\n Bool: 'true',\n Date: '\"2026-01-15\"',\n DateTime: '\"2026-01-15T10:00:00Z\"',\n};\n\n// An example value to write in a specification for a property of the given type, resolving concepts\n// down to the primitive they wrap. Collections and unknown types fall back to a quoted string.\nexport function exampleValueFor(type: string, symbols: DocumentSymbols): string {\n const bare = type.replace(/\\s+optional$/, '').replace(/\\?$/, '');\n if (bare.endsWith('[]')) return '\"Example\"';\n const primitive = symbols.concepts.find(concept => concept.name === bare)?.primitive ?? bare;\n return primitiveExamples[primitive] ?? '\"Example\"';\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { exampleValueFor } from './example-values';\nimport { CommandSymbol, DocumentSymbols, PropertySymbol } from './symbols';\n\n// A multi-line suggestion shown as ghost text at the cursor. The text starts at the cursor and\n// continues on following lines with absolute indentation, so inserting it needs no further work.\nexport interface StructureCompletion {\n text: string;\n}\n\nfunction lastIndexWhere(lines: string[], matches: (line: string, index: number) => boolean): number {\n for (let index = lines.length - 1; index >= 0; index--) if (matches(lines[index], index)) return index;\n return -1;\n}\n\nconst upperCamelWords = (name: string) => name.match(/[A-Z][a-z0-9]*/g) ?? [name];\n\nfunction pastTense(verb: string): string {\n if (/[^aeiou]y$/i.test(verb)) return `${verb.slice(0, -1)}ied`;\n return /e$/i.test(verb) ? `${verb}d` : `${verb}ed`;\n}\n\n// The event a command most likely produces: a declared event that names its subject, else the\n// subject followed by the past tense of the command's verb - AddProduct becomes ProductAdded.\nfunction likelyEventName(command: string, symbols: DocumentSymbols): string {\n const [verb, ...subject] = upperCamelWords(command);\n const noun = subject.join('');\n const declared = symbols.events.find(event => noun.length > 0 && event.name.startsWith(noun));\n return declared?.name ?? `${noun}${pastTense(verb)}`;\n}\n\n\n// The indentation of one level in the document, learned from its first indented line.\nfunction indentUnit(lines: string[]): number {\n const indented = lines.map(indentOf).filter(indent => indent > 0);\n return indented.length === 0 ? 4 : Math.min(...indented);\n}\n\nfunction producesBlock(command: CommandSymbol, symbols: DocumentSymbols, indent: number, unit: number): string {\n const eventName = likelyEventName(command.name, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const inner = ' '.repeat(indent + unit);\n const sources = command.properties.filter(property => !property.isIdentifier);\n if (declared) {\n const mappings = declared.properties.filter(property => sources.some(source => source.name === property.name));\n const identifier = command.properties.find(property => property.isIdentifier);\n return [`produces ${eventName}`, ...(identifier ? [`${inner}for ${identifier.name}`] : []), ...mappings.map(property => `${inner}${property.name} = ${property.name}`)].join('\\n');\n }\n return [`produces event ${eventName}`, ...sources.map(property => `${inner}${property.name} ${property.type} = ${property.name}`)].join('\\n');\n}\n\n// What a command that has nothing yet most likely needs: the identity of the thing it acts on when a\n// concept for it is declared, the properties of the event it will most likely produce, and the production.\nfunction newCommandBlock(command: string, symbols: DocumentSymbols, indent: number, unit: number): string {\n const noun = upperCamelWords(command).slice(1).join('');\n const eventName = likelyEventName(command, symbols);\n const declared = symbols.events.find(event => event.name === eventName);\n const identity = noun.length > 0 && symbols.concepts.some(concept => concept.name === `${noun}Id`) ? `${noun[0].toLowerCase()}${noun.slice(1)}Id` : undefined;\n const identityLine = identity ? [`${identity} ${noun}Id identifier`] : [];\n const inner = ' '.repeat(indent + unit);\n const properties = (declared?.properties ?? []).filter(property => property.name !== identity);\n const propertyLines = properties.map(property => `${' '.repeat(indent)}${property.name} ${property.type}`);\n const outcome = declared\n ? [`${' '.repeat(indent)}produces ${eventName}`, ...(identity ? [`${inner}for ${identity}`] : []), ...properties.map(property => `${inner}${property.name} = ${property.name}`)]\n : [`${' '.repeat(indent)}produces event ${eventName}`];\n const lines = [...identityLine.map((line, index) => (index === 0 ? line : `${' '.repeat(indent)}${line}`)), ...propertyLines, ...outcome];\n return lines.join('\\n').trimStart();\n}\n\nfunction assignments(properties: PropertySymbol[], symbols: DocumentSymbols, indent: number): string[] {\n return properties.map(property => `${' '.repeat(indent)}${property.name} = ${exampleValueFor(property.type, symbols)}`);\n}\n\n// The command the slice enclosing a line declares, with whether it carries an authorize clause.\nfunction sliceCommand(lines: string[], fences: boolean[], headerIndex: number, symbols: DocumentSymbols) {\n let sliceIndex = -1;\n for (let index = headerIndex - 1; index >= 0; index--) {\n if (!fences[index] && /^\\s*slice\\s/.test(lines[index]) && indentOf(lines[index]) < indentOf(lines[headerIndex])) { sliceIndex = index; break; }\n }\n if (sliceIndex < 0) return undefined;\n let name: string | undefined;\n let authorized = false;\n for (let index = sliceIndex + 1; index < lines.length; index++) {\n if (lines[index].trim().length === 0 || fences[index]) continue;\n if (indentOf(lines[index]) <= indentOf(lines[sliceIndex])) break;\n const command = lines[index].trim().match(/^command\\s+(\\w+)\\s*$/);\n if (command) { name = command[1]; authorized = false; continue; }\n if (name && /^authorize\\b/.test(lines[index].trim())) authorized = true;\n }\n const symbol = symbols.commands.find(candidate => candidate.name === name);\n return symbol ? { symbol, authorized } : undefined;\n}\n\nfunction specificationBlock(command: CommandSymbol, authorized: boolean, symbols: DocumentSymbols, indent: number, unit: number): string {\n const inner = indent + unit;\n const eventName = likelyEventName(command.name, symbols);\n const identifier = command.properties.find(property => property.isIdentifier);\n const sources = command.properties.filter(property => !property.isIdentifier);\n return [\n ...(authorized ? [`given caller`, `${' '.repeat(inner)}authenticated`] : []),\n ...(authorized ? [`${' '.repeat(indent)}when ${command.name}`] : [`when ${command.name}`]),\n ...assignments(command.properties, symbols, inner),\n `${' '.repeat(indent)}then ${eventName}`,\n ...(identifier ? [`${' '.repeat(inner)}for ${exampleValueFor(identifier.type, symbols)}`] : []),\n ...assignments(sources, symbols, inner),\n ].join('\\n');\n}\n\n// Suggests the structure a block most obviously needs next - the production of a command, the\n// skeleton of a specification, the fields of a form - when the cursor rests on an empty line directly\n// inside a block that has no content yet. Returns null when nothing is obviously missing.\nexport function structureCompletion(lines: string[], lineIndex: number, textBefore: string, textAfter: string, symbols: DocumentSymbols): StructureCompletion | null {\n if (textBefore.trim().length > 0 || textAfter.trim().length > 0) return null;\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n const previous = lastIndexWhere(lines.slice(0, lineIndex), line => withoutComment(line).trim().length > 0);\n if (previous < 0 || fences[previous]) return null;\n const unit = indentUnit(lines);\n const previousLine = lines[previous].trim();\n const opensEmptyBlock = /^(?:command\\s+\\w+|specification\\s+\\w+|form\\s+\\w+\\s+for\\s+[\\w.]+)\\s*$/.test(previousLine);\n // An empty block's body starts one level in; otherwise the cursor continues the lines above it.\n const indent = opensEmptyBlock ? Math.max(textBefore.length, indentOf(lines[previous]) + unit) : textBefore.length || indentOf(lines[previous]);\n const header = opensEmptyBlock ? previousLine : nearestEnclosingLine(lines, fences, lineIndex, indent);\n if (!header) return null;\n const headerIndent = opensEmptyBlock ? indentOf(lines[previous]) : indent - Math.max(1, unit);\n const pad = ' '.repeat(Math.max(0, indent - textBefore.length));\n const wrap = (block: string | undefined) => (block ? { text: `${pad}${block}` } : null);\n\n const command = header.match(/^command\\s+(\\w+)\\s*$/);\n if (command) {\n const symbol = symbols.commands.find(candidate => candidate.name === command[1]);\n const headerLine = lastIndexWhere(lines, (line, index) => index < lineIndex && line.trim() === header && indentOf(line) < indent);\n const body = lines.slice(headerLine + 1, lineIndex).filter(line => line.trim().length > 0);\n const hasOutcome = body.some(line => /^\\s*(produces|handler)\\b/.test(line));\n if (hasOutcome) return null;\n if (!symbol || symbol.properties.length === 0) return wrap(newCommandBlock(command[1], symbols, indent, unit));\n return wrap(producesBlock(symbol, symbols, indent, unit));\n }\n\n if (/^specification\\s+\\w+\\s*$/.test(header) && headerIndent >= 0) {\n const found = sliceCommand(lines, fences, previous, symbols);\n return found ? wrap(specificationBlock(found.symbol, found.authorized, symbols, indent, unit)) : null;\n }\n\n const form = header.match(/^form\\s+\\w+\\s+for\\s+(?:\\w+\\.)*(\\w+)\\s*$/);\n if (form) {\n const symbol = symbols.commands.find(candidate => candidate.name === form[1]);\n return symbol ? wrap(symbol.properties.map((property, index) => `${index === 0 ? '' : ' '.repeat(indent)}field ${property.name}`).join('\\n')) : null;\n }\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\n\nexport type MonarchTokenRules = languages.IMonarchLanguage['tokenizer'][string];\n\nexport interface SubLanguageCompletion {\n label: string;\n insertText: string;\n documentation: string;\n}\n\nexport interface SubLanguageDefinition {\n tokens: MonarchTokenRules;\n completions?: SubLanguageCompletion[];\n hovers?: Record<string, string>;\n}\n\nexport interface SubLanguage extends SubLanguageDefinition {\n keyword: string;\n}\n\nconst subLanguages = new Map<string, SubLanguage>();\nconst listeners = new Set<() => void>();\n\nexport function registerSubLanguage(keyword: string, definition: SubLanguageDefinition): void {\n subLanguages.set(keyword, { keyword, ...definition });\n listeners.forEach((listener) => listener());\n}\n\nexport function getSubLanguages(): SubLanguage[] {\n return [...subLanguages.values()];\n}\n\nexport function getSubLanguage(keyword: string): SubLanguage | undefined {\n return subLanguages.get(keyword);\n}\n\nexport function onSubLanguagesChanged(listener: () => void): void {\n listeners.add(listener);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { namedRuleContext } from './named-rule-context';\nimport { responseCompletions } from './response-completions';\nimport { dependencyTargetCompletions } from './dependency-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { DocumentSymbols, scanDocument } from './symbols';\nimport { structureCompletion } from './structure-completions';\nimport { getSubLanguage } from './sub-language-registry';\nimport * as items from './completion-items';\nimport * as scope from './scope-items';\nimport { CompletionEntry } from './completion-items';\nimport { purposeItems } from './purpose-items';\n\n// Matches a validation rule line ending in \"rule <Name>\" (optionally followed by a\n// message clause) - both the command form (\"<property> rule <Name>\") and the\n// concept implied-subject form (\"rule <Name>\"). Its first word is the property\n// name, not \"rule\", so it can't be recognized through the chain[0] keyword switch\n// the way \"on <EventType>\" or \"handler\" are - hence the dedicated regex check.\nconst RULE_LINE_PATTERN = /(?:^|\\s)rule\\s+[A-Za-z_]\\w*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$/;\n\nexport type CompletionPlan =\n | { kind: 'none' }\n | { kind: 'entries'; entries: CompletionEntry[] }\n | { kind: 'contextVariables'; replaceLength: number }\n | { kind: 'playFiles'; replaceLength: number }\n | { kind: 'policies' }\n | { kind: 'events' }\n | { kind: 'triggers' }\n | { kind: 'commands' }\n | { kind: 'producesTargets' }\n | { kind: 'screens' }\n | { kind: 'queries' }\n | { kind: 'types' };\n\n// What the position sits inside, beyond the keyword chain: the whole header of each enclosing block, so a\n// slice's type and a template's kind are known, and the document's own lines, so a declaration that may\n// appear once is not offered again.\nexport interface CompletionScope {\n headers: readonly string[];\n document: readonly string[];\n}\n\nconst declaredIn = (document: readonly string[], keyword: string) => document.some(line => new RegExp(`^${keyword}\\\\b`).test(line));\n\nfunction topLevelEntries(document: readonly string[]): CompletionEntry[] {\n return items.topLevelItems.filter(item => !(item.label === 'domain' && declaredIn(document, 'domain')) && !(item.label === 'authentication' && declaredIn(document, 'authentication')) && !(item.label === 'identity' && declaredIn(document, 'identity')));\n}\n\nconst isTemplate = (header: string | undefined) => /^(?:screen|dialog)\\s+template\\b/.test(header ?? '');\n\n// A whole block as one completion entry. Continuation lines are indented relative to the line it is inserted on,\n// which is how the editors indent a multi-line snippet.\nfunction expansionEntry(text: string, indent: number): CompletionEntry {\n const relative = text.split('\\n').map((line, index) => (index === 0 ? line : line.slice(Math.min(indent, indentOf(line))))).join('\\n');\n const label = text.split('\\n')[0].trim();\n return { label, insertText: relative.replace(/[$}\\\\]/g, '\\\\$&'), documentation: 'Expands the whole block from what the command and its events declare.' };\n}\n\nexport function completionEntriesFor(chain: string[], where: CompletionScope = { headers: [], document: [] }): CompletionEntry[] {\n const construct = chain[0];\n if (construct === undefined || construct === 'domain') return topLevelEntries(where.document);\n const subLanguage = getSubLanguage(construct);\n if (subLanguage) return subLanguage.completions ?? [];\n const header = where.headers[0];\n switch (construct) {\n case 'purpose':\n return purposeItems;\n case 'module':\n return items.moduleItems;\n case 'feature':\n return items.featureItems;\n case 'slice':\n return items.sliceItemsFor(header?.split(/\\s+/)[1]);\n case 'concept':\n return items.conceptItems;\n case 'type':\n return items.typeItems;\n case 'command':\n return items.commandItems;\n case 'public':\n case 'event':\n return items.eventItems;\n case 'readmodel':\n return scope.readModelItems;\n case 'reducer':\n return scope.reducerItems;\n case 'form':\n return scope.formItems;\n case 'contribute':\n return scope.contributeItems;\n case 'behavior':\n return scope.behaviorItems;\n case 'persona':\n return scope.personaItems;\n case 'identity':\n return items.identityItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'on':\n case 'success':\n case 'failure':\n case 'confirm':\n return scope.outcomeItems;\n case 'layout':\n return scope.layoutItems;\n case 'system':\n return items.operationItems.filter(item => item.label === 'description');\n case 'operation':\n return items.operationItems;\n case 'execute':\n case 'compensate':\n return items.operationPhaseItems;\n case 'produces':\n return items.producesItems;\n case 'handler':\n return items.handlerItems;\n case 'implementation':\n return chain[1] === 'handler' ? items.implementationItems : ['execute', 'compensate'].includes(chain[1]) ? items.operationImplementationItems : [];\n case 'query':\n return items.queryItems;\n case 'performer':\n return items.performerItems;\n case 'constraint':\n return items.constraintItems;\n case 'reaction':\n return items.reactionItems;\n case 'invokes':\n return chain.includes('reaction') ? items.invocationItems : [];\n case 'trigger':\n return items.triggerItems;\n case 'when':\n case 'every':\n case 'at':\n return chain.includes('reaction') ? items.reactionTriggerItems : [];\n case 'specification':\n return items.specificationItems;\n case 'policy':\n return items.policyItems;\n case 'validate':\n return items.validateItems;\n case 'action':\n return items.actionItems;\n case 'table':\n case 'summary':\n return items.tableItems;\n case 'screen':\n return isTemplate(header) ? scope.templateItems : items.screenItems;\n case 'dialog':\n return scope.templateItems;\n default:\n if (isTemplate(where.headers.find(candidate => isTemplate(candidate)))) return scope.templateItems;\n // Sections inside a screen expose the screen vocabulary.\n if (chain.includes('screen') || construct === 'section') return items.screenItems;\n if (chain.includes('produces')) return items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency \u2014 the\n// Monaco service and the VSCode extension both materialize the plan into items.\nexport function planCompletions(\n lines: string[],\n lineIndex: number,\n textBefore: string,\n symbols: DocumentSymbols = scanDocument(lines),\n): CompletionPlan {\n const fences = fenceMap(lines);\n if (fences[lineIndex] || withoutComment(textBefore).length < textBefore.length) return { kind: 'none' };\n if (/^\\s*concept\\s+[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]+\\s*:\\s*\\w+\\s+(?:(?:pii|personal|secret)\\s+)*\\w*$/u.test(textBefore)) {\n return { kind: 'entries', entries: ['pii', 'secret'].filter(marker => !new RegExp(`\\\\b${marker}\\\\b`).test(textBefore)).map(marker => ({ label: marker, insertText: marker, documentation: marker === 'pii' ? 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]' : 'Operational secret; renders [Encrypted] + [NotAudited].' })) };\n }\n const inConcept = enclosingChain(lines, fences, lineIndex, indentOf(textBefore))[0] === 'concept';\n if (inConcept && /^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['subject', 'namespace', 'global'].map(scope => ({ label: scope, insertText: scope, documentation: 'Explicit secret encryption scope.' })) };\n }\n if (inConcept && /^\\s*(?:pii|personal|@pii)\\s+special\\s+\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'].map(category => ({ label: category, insertText: category, documentation: 'GDPR Art. 9(1) special category.' })) };\n }\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const dependencyEntries = dependencyTargetCompletions(lines, lineIndex, textBefore, symbols);\n if (dependencyEntries !== null) return { kind: 'entries', entries: dependencyEntries };\n\n // Inside the quotes of a file import, what is wanted is a path - replacing what has been typed so far.\n const importPath = textBefore.match(/^\\s*import\\s+\"([^\"]*)$/);\n if (importPath) {\n return { kind: 'playFiles', replaceLength: importPath[1].length };\n }\n\n // A quote or a slash only asks for a completion inside an import path.\n if (/[\"/]$/.test(textBefore)) return { kind: 'none' };\n\n const refusal = refusalContext(lines, lineIndex, indentOf(lines[lineIndex] ?? textBefore));\n if (/\\$refusal\\.\\w*$/.test(textBefore)) {\n return { kind: 'entries', entries: refusal === undefined ? [] : ['reason', 'message', ...(/^on\\s+refused\\s+by\\s+constraint(?:\\s|$)/.test(refusal) ? ['constraint'] : [])].map(member => ({ label: member, insertText: member, documentation: 'String refusal value; syntax-only, not yet executable (PLAY0268).' })) };\n }\n const contextVariableMatch = textBefore.match(/\\$[\\w.]*$/);\n if (contextVariableMatch) {\n return { kind: 'contextVariables', replaceLength: contextVariableMatch[0].length };\n }\n\n const currentLine = lines[lineIndex] ?? '';\n const effectiveIndent =\n textBefore.trim().length === 0 ? textBefore.length : indentOf(currentLine);\n const chain = enclosingChain(lines, fences, lineIndex, effectiveIndent);\n if (chain.includes('screen')) {\n let parentIndent = effectiveIndent;\n let guarded = false;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*action\\s+(?:\"|\\$strings\\.)/.test(parent)) { guarded = true; break; }\n if (/^\\s*screen\\b/.test(parent)) break;\n }\n if (guarded) {\n if (/^\\s*(?:when\\b.*|otherwise)\\s+execute\\s+[\\w.]*$/.test(textBefore)) return { kind: 'commands' };\n if (chain[0] === 'action') return { kind: 'entries', entries: items.guardedActionItems };\n if (['when', 'otherwise'].includes(chain[0])) {\n const parent = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? '';\n return { kind: 'entries', entries: /\\bexecute\\s+[\\w.]+$/.test(parent) ? items.actionArgumentItems : [] };\n }\n }\n }\n if (['on', 'when', 'otherwise'].includes(chain[0])) {\n let parentIndent = effectiveIndent;\n for (let index = lineIndex - 1; index >= 0; index--) {\n if (fences[index]) continue;\n const parent = withoutComment(lines[index]);\n if (parent.trim().length === 0 || indentOf(parent) >= parentIndent) continue;\n parentIndent = indentOf(parent);\n if (/^\\s*on\\s+(?:click|double click|select)\\s*$/.test(parent)) {\n return { kind: 'entries', entries: chain[0] === 'on' ? items.interactionChoiceItems : items.interactionActionItems };\n }\n if (/^\\s*(?:screen|behavior|specification|reaction)\\b/.test(parent)) break;\n }\n }\n if (chain[0] === 'on' && refusal !== undefined) return { kind: 'entries', entries: items.refusalItems };\n const ruleContext = namedRuleContext(lines, lineIndex, effectiveIndent);\n if (ruleContext === 'implementation') return { kind: 'entries', entries: items.namedRuleImplementationItems };\n if (ruleContext === 'rule') return { kind: 'entries', entries: items.commandRuleItems };\n\n const propertyOwner = ['public', 'event', 'command', 'type', 'readmodel', 'trigger', 'when', 'every', 'at'].includes(chain[0]) ||\n (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const propertyName = textBefore.trimStart().split(/\\s+/)[0];\n const reservedProperty = (chain[0] === 'command' && ['reads', 'authorize', 'produces'].includes(propertyName)) ||\n (chain[0] === 'event' && propertyName === 'tag') ||\n (['trigger', 'when', 'every', 'at'].includes(chain[0]) && ['description', 'file', 'reads', 'produces', 'invokes'].includes(propertyName));\n const optionalPrefix = (match: RegExpMatchArray | null) => match !== null && 'optional'.startsWith(match[1]);\n const afterPropertyType = propertyOwner && !reservedProperty && optionalPrefix(textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const afterQueryType = (chain[0] === 'query' && optionalPrefix(textBefore.match(/^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+(\\w*)$/))) ||\n optionalPrefix(textBefore.match(/^\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+(\\w*)$/));\n const eventPropertyOwner = chain[0] === 'event' || (chain[0] === 'produces' && /^produces\\s+event\\b/.test(nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent) ?? ''));\n const subjectModifier = eventPropertyOwner && !reservedProperty ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+([\\w.]+)\\s+(\\w*)$/) : null;\n const subjectConcept = symbols.concepts.find(concept => concept.name === subjectModifier?.[1]);\n const subjectType = subjectConcept?.primitive ?? subjectModifier?.[1];\n const subjectTarget = (subjectType === 'String' || subjectType === 'Uuid' || (subjectType === 'Int' && subjectConcept !== undefined)) &&\n !subjectConcept?.attributes.some(attribute => ['pii', 'personal', 'secret', 'sensitive'].includes(attribute.replace(/^@/, '')));\n const afterSubjectType = subjectModifier !== null && subjectTarget && 'subject'.startsWith(subjectModifier[2]);\n const modifierEntries = [\n ...((afterPropertyType || afterQueryType) && !/=>\\s*observable\\s+$/.test(textBefore) ? items.optionalTypeItems : []),\n ...(afterSubjectType ? [{ label: 'subject', insertText: 'subject', documentation: 'One required scalar event data-subject identity; not pii or secret. Report-only lineage metadata (PLAY0270), no ESM or provider output yet.' }] : []),\n ];\n if (modifierEntries.length > 0) return { kind: 'entries', entries: modifierEntries };\n\n if (/\\bauthorize\\s+[\\w\\s]*$/.test(textBefore) || chain[0] === 'authorize') {\n return { kind: 'policies' };\n }\n if (/\\bwhen\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'triggers' };\n }\n if (/\\bon\\s+\\w*$/.test(textBefore) && chain.includes('constraint')) {\n return { kind: 'events' };\n }\n if (/\\binvokes\\s+\\w*$/.test(textBefore) && chain.includes('reaction')) {\n return { kind: 'commands' };\n }\n if (/\\b(?:on|unique\\s+event)\\s+\\w*$/.test(textBefore) && chain[0] === 'constraint') {\n return { kind: 'events' };\n }\n if (/\\bproduces\\s+\\w*$/.test(textBefore)) {\n return { kind: 'producesTargets' };\n }\n if (/\\bnavigate\\s+to\\s+\\w*$/.test(textBefore)) {\n return { kind: 'screens' };\n }\n if (chain[0] === 'specification') {\n if (/^\\s*when\\s+query\\s+[\\w.]*$/.test(textBefore)) return { kind: 'queries' };\n const step = textBefore.match(/^\\s*(given|when|then)\\s+\\w*$/);\n if (step) return { kind: 'entries', entries: items.specificationStepItems[step[1] as 'given' | 'when' | 'then'] };\n }\n if (/\\b(?:via|then)\\s+query\\s+[\\w.]*$/.test(textBefore)) {\n return { kind: 'queries' };\n }\n if (\n (chain[0] === 'event' || chain[0] === 'command' || chain[0] === 'type') &&\n /^\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)\n ) {\n return { kind: 'types' };\n }\n if (chain[0] === 'query' && /^\\s+(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) {\n return { kind: 'types' };\n }\n\n const enclosingLine = nearestEnclosingLine(lines, fences, lineIndex, effectiveIndent);\n if (enclosingLine && /^produces\\s+operation\\b/.test(enclosingLine)) return { kind: 'entries', entries: items.operationItems };\n if (enclosingLine && /^produces\\s+event\\b/.test(enclosingLine)) {\n if (/^\\s+@?[a-z_]\\w*\\s+[\\w[\\]?]*$/.test(textBefore)) return { kind: 'types' };\n return { kind: 'entries', entries: items.inlineEventItems };\n }\n if (enclosingLine && RULE_LINE_PATTERN.test(enclosingLine)) {\n return { kind: 'entries', entries: items.ruleItems };\n }\n\n const headers = enclosingHeaders(lines, fences, lineIndex, effectiveIndent);\n if (chain[0] === 'for' && chain.includes('seed')) return { kind: 'events' };\n const entries = completionEntriesFor(chain, { headers, document: lines });\n const expansion = chain[0] === 'command' ? structureCompletion(lines, lineIndex, ' '.repeat(effectiveIndent), '', symbols) : null;\n return { kind: 'entries', entries: expansion ? [expansionEntry(expansion.text, effectiveIndent), ...entries] : entries };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, languages } from 'monaco-editor';\nimport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nimport { Monaco, primitiveTypes } from './language';\nimport { DocumentSymbols, knownEventNames, knownTriggerNames, symbolsForBuffer } from './symbols';\nimport { responseCompletions } from './response-completions';\nimport { exampleCompletions } from './example-authoring';\nimport { operationCompletions } from './operation-authoring';\nimport { eventSourceCompletions } from './event-source-authoring';\nimport { planCompletions } from './completion-planner';\nimport { contextVariableEntries, producesItems, CompletionEntry } from './completion-items';\n\n// What a host knows beyond the one model the editor holds.\nexport interface CompletionOptions {\n // The paths a file import written in the model can name, relative to the model's folder - typically\n // importablePaths over the host's .play files. Without it, an import path is not completed.\n playFiles?: (model: editor.ITextModel) => readonly string[];\n application?: (model: editor.ITextModel) => DocumentSymbols;\n // Notify after changing application documents or placement, even when this buffer is unchanged.\n onDidChangeApplication?: (listener: () => void) => { dispose(): void };\n}\n\nexport function createCompletionProvider(monaco: Monaco, options: CompletionOptions = {}): languages.CompletionItemProvider {\n return {\n triggerCharacters: [' ', '$', '@', '.', '\"', '/'],\n\n provideCompletionItems(model, position) {\n const lines = model.getLinesContent();\n const lineIndex = position.lineNumber - 1;\n const currentLine = lines[lineIndex] ?? '';\n const textBefore = currentLine.substring(0, position.column - 1);\n const application = options.application?.(model);\n const symbols = symbolsForBuffer(lines, application);\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore, symbols) ?? eventSourceCompletions(lines, lineIndex, textBefore, symbols) ?? operationCompletions(lines, lineIndex, textBefore, symbols) ?? responseCompletions(lines, lineIndex, textBefore, symbols);\n const plan = responseEntries === null ? planCompletions(lines, lineIndex, textBefore, symbols) : { kind: 'entries' as const, entries: responseEntries };\n if (plan.kind === 'none') return { suggestions: [] };\n\n const word = model.getWordUntilPosition(position);\n const range = new monaco.Range(\n position.lineNumber,\n word.startColumn,\n position.lineNumber,\n word.endColumn,\n );\n const kinds = monaco.languages.CompletionItemKind;\n const asSnippet = monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;\n\n const snippet = (entry: CompletionEntry): languages.CompletionItem => ({\n label: entry.label,\n kind: entry.insertText.includes('$') ? kinds.Snippet : kinds.Keyword,\n insertText: entry.insertText,\n insertTextRules: asSnippet,\n documentation: entry.documentation,\n sortText: entry.sortText,\n detail: entry.detail,\n range,\n });\n const symbolItem = (\n name: string,\n kind: languages.CompletionItemKind,\n detail: string,\n ): languages.CompletionItem => ({\n label: name,\n kind,\n insertText: name,\n detail,\n range,\n });\n const eventNames = () => {\n const inlineNames = new Set(symbols.events.filter(event => event.inline).map(event => event.name));\n return [...new Set(knownEventNames(symbols))].map((name) => symbolItem(name, kinds.Event, inlineNames.has(name) ? 'inline event' : 'event'));\n };\n\n switch (plan.kind) {\n case 'playFiles': {\n const pathRange = new monaco.Range(\n position.lineNumber,\n position.column - plan.replaceLength,\n position.lineNumber,\n position.column,\n );\n return {\n suggestions: (options.playFiles?.(model) ?? []).map((path) => ({\n label: path,\n kind: path.includes('*') ? kinds.Folder : kinds.File,\n insertText: path,\n range: pathRange,\n })),\n };\n }\n case 'contextVariables': {\n const variableRange = new monaco.Range(\n position.lineNumber,\n position.column - plan.replaceLength,\n position.lineNumber,\n word.endColumn,\n );\n return {\n suggestions: contextVariableEntries(symbols).map((entry) => ({\n ...snippet(entry),\n range: variableRange,\n })),\n };\n }\n case 'policies':\n return {\n suggestions: symbols.policies.map((policy) =>\n symbolItem(policy.name, kinds.Reference, 'policy'),\n ),\n };\n case 'events':\n return { suggestions: eventNames() };\n case 'triggers':\n return {\n suggestions: [...new Set(knownTriggerNames(symbols))].map((name) =>\n symbolItem(name, kinds.Event, 'trigger'),\n ),\n };\n case 'commands':\n return {\n suggestions: symbols.commands.map((command) =>\n symbolItem(command.name, kinds.Method, 'command'),\n ),\n };\n case 'producesTargets':\n return { suggestions: [...producesItems.map(snippet), ...eventNames()] };\n case 'screens':\n return {\n suggestions: symbols.screens.map((screen) =>\n symbolItem(screen.name, kinds.Interface, 'screen'),\n ),\n };\n case 'queries':\n return {\n suggestions: symbols.queries.map((query) =>\n symbolItem(query.name, kinds.Function, `query => ${typeReferenceText(query.returnTypeReference ?? typeReferenceSymbol(query.returnType))}`),\n ),\n };\n case 'types':\n return {\n suggestions: [\n ...symbols.concepts.map((concept) =>\n symbolItem(\n concept.name,\n kinds.Class,\n `concept : ${concept.primitive}${concept.attributes.length ? ' ' + concept.attributes.join(' ') : ''}`,\n ),\n ),\n ...symbols.types.map((type) =>\n symbolItem(\n type.name,\n kinds.Struct,\n `type (${type.properties.length} properties)`,\n ),\n ),\n ...primitiveTypes.map((primitive) =>\n symbolItem(primitive, kinds.Struct, 'primitive'),\n ),\n ],\n };\n case 'entries':\n return { suggestions: plan.entries.map(snippet) };\n }\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport type { CompletionOptions } from './completions';\nimport { structureCompletion } from './structure-completions';\nimport { symbolsForBuffer } from './symbols';\n\n// Ghost text for the structure a block obviously needs next, from the compiler's own model.\nexport function createInlineCompletionProvider(options: CompletionOptions): languages.InlineCompletionsProvider {\n return {\n provideInlineCompletions(model, position) {\n const lines = model.getLinesContent();\n const lineIndex = position.lineNumber - 1;\n const line = lines[lineIndex] ?? '';\n const symbols = symbolsForBuffer(lines, options.application?.(model));\n const suggestion = structureCompletion(lines, lineIndex, line.substring(0, position.column - 1), line.substring(position.column - 1), symbols);\n if (!suggestion) return { items: [] };\n // The suggestion replaces the indentation before the cursor, so it starts with indentation of its own -\n // the editors take Tab as 'indent' rather than 'accept' for a suggestion that does not.\n return { items: [{ insertText: `${line.substring(0, position.column - 1)}${suggestion.text}`, range: { startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column } }] };\n },\n disposeInlineCompletions() {},\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols } from './symbols';\nimport { withoutComment } from './document-context';\n\nexport const responseTokenTypes = ['keyword', 'property', 'type'] as const;\n\n// Semantic overlays resolve the local returns ambiguity that a line-based grammar cannot.\nexport function responseTokens(lines: string[], symbols?: DocumentSymbols): { line: number; column: number; length: number; type: number }[] {\n const tokens: { line: number; column: number; length: number; type: number }[] = [];\n const add = (line: number, column: number, length: number, type: number) => {\n const source = lines[line - 1];\n if (source === undefined || column < 1 || length < 1) return;\n const start = column - 1 + (source[column - 1] === '@' ? 1 : 0);\n if (start + length <= source.length) tokens.push({ line: line - 1, column: start, length, type });\n };\n const path = symbols?.authoringPath ?? 'current.play';\n const analysis = responseAnalysis(lines, symbols?.authoringDocuments ?? symbols?.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols?.authoringPlacement, path, symbols?.authoringPlacementResolved);\n for (const source of analysis.eventSources.declarations.filter(source => source.location.path === path)) {\n add(source.location.line, source.location.column, 11, 0);\n if (source.identifier) add(source.identifier.location.line, source.identifier.location.column, source.identifier.name.length, 2);\n for (const stream of source.streams) {\n add(stream.location.line, stream.location.column, 6, 0);\n if (stream.streamId) add(stream.streamId.location.line, stream.streamId.location.column, stream.streamId.name.length, 2);\n const header = stream.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of stream.streamIdParts) {\n add(part.location.line, part.location.column, part.name.length, 1);\n add(part.type.location.line, part.type.location.column, part.type.name.length, 2);\n }\n }\n }\n for (const route of analysis.eventSources.routes) {\n add(route.location.line, route.location.column, 6, 0);\n if (route.referenceLocation) add(route.referenceLocation.line, route.referenceLocation.column, `${route.eventSource}.${route.stream}`.length, 2);\n if (route.streamId) add(route.streamId.location.line, route.streamId.location.column, 8, 0);\n const header = route.directiveLocations?.streamId;\n if (header) add(header.line, header.column, 8, 0);\n for (const part of route.streamIdParts) add(part.location.line, part.location.column, part.property.length, 1);\n }\n for (const command of analysis.commands.values()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const source = withoutComment(lines[property.location.line - 1] ?? '');\n add(property.location.line, source.lastIndexOf('generated') + 1, 9, 0);\n }\n const response = command.response;\n if (!response) continue;\n add(response.location.line, response.location.column, 7, 0);\n if (response.kind === 'ScalarCommandResponseSyntax') {\n add(response.source.location.line, response.source.location.column, response.source.property.length, 1);\n } else for (const field of response.fields) {\n add(field.location.line, field.location.column, field.name.length, 1);\n add(field.source.location.line, field.source.location.column, field.source.property.length, 1);\n if (field.type) add(field.type.location.line, field.type.location.column, field.type.name.length, 2);\n }\n }\n for (const specification of analysis.specifications.values()) {\n for (const event of specification.thenEvents ?? []) {\n if (event.noStream) add(event.noStream.location.line, event.noStream.location.column, 9, 0);\n }\n for (const fixture of specification.when?.generatedValues ?? []) {\n add(fixture.location.line, fixture.location.column, 9, 0);\n }\n if (specification.thenReturns) add(specification.thenReturns.location.line, (lines[specification.thenReturns.location.line - 1] ?? '').indexOf('returns') + 1, 7, 0);\n }\n for (const system of analysis.operations.systems.filter(system => system.location.path === path)) {\n add(system.location.line, system.location.column, 6, 0);\n }\n for (const operation of analysis.operations.declarations.filter(operation => operation.location.path === path)) {\n const header = withoutComment(lines[operation.location.line - 1] ?? '');\n const keyword = header.indexOf('operation', operation.location.column - 1);\n if (keyword >= 0) add(operation.location.line, keyword + 1, 9, 0);\n for (const input of operation.inputs) {\n add(input.location.line, input.location.column, input.name.length, 1);\n add(input.type.location.line, input.type.location.column, input.type.name.length, 2);\n }\n if (operation.usesLocation) add(operation.usesLocation.line, (lines[operation.usesLocation.line - 1] ?? '').indexOf('uses') + 1, 4, 0);\n for (const phase of [operation.execute, operation.compensate]) {\n if (!phase) continue;\n const name = withoutComment(lines[phase.location.line - 1] ?? '').trim();\n add(phase.location.line, phase.location.column, name.length, 0);\n if (phase.implementation) add(phase.implementation.location.line, phase.implementation.location.column, 14, 0);\n for (const hint of phase.implementation?.hints ?? []) add(hint.location.line, hint.location.column, 4, 0);\n }\n }\n // Overlays never overlap or duplicate a typed token, even with recovered malformed syntax.\n const ordered = tokens.sort((left, right) => left.line - right.line || left.column - right.column);\n return ordered.filter((token, index) => index === 0 || token.line !== ordered[index - 1].line || token.column >= ordered[index - 1].column + ordered[index - 1].length);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { enclosingChain, fenceMap, indentOf, withoutComment } from './document-context';\nimport { ReactionReference } from './ReactionReference';\nimport { directBody, DocumentSymbols, NamedSymbol, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\n\n// Resolve only a reaction's named occurrence, never a specification step, comment or native fence.\n// Both editors use the same event/import/declared-trigger precedence, including unsaved buffers.\nexport function reactionReferenceAt(lines: string[], lineIndex: number, startColumn: number, endColumn: number, application?: DocumentSymbols): ReactionReference | null {\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n const line = withoutComment(lines[lineIndex] ?? '');\n const match = line.match(/^\\s*when\\s+([A-Za-z_][\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]*)\\s*$/u);\n if (!match || enclosingChain(lines, fences, lineIndex, indentOf(line))[0] !== 'reaction') return null;\n const name = match[1];\n const column = line.indexOf(name, line.indexOf('when') + 4) + 1;\n if (startColumn !== column || endColumn !== column + name.length) return null;\n const current = application?.authoringPath ?? 'current.play';\n const documents = [...(application?.authoringDocuments ?? []).filter(document => document.path !== current), { path: current, source: lines.join('\\n') }];\n const scanned = documents.map(document => ({ ...document, lines: document.source.split(/\\r?\\n/), symbols: scanDocument(document.source.split(/\\r?\\n/)) }));\n const events = scanned.flatMap(document => {\n const named = document.symbols.events.filter(event => event.name === name);\n const generation = Math.max(...named.map(event => event.generation ?? 1));\n return named.filter(event => (event.generation ?? 1) === generation).map(event => ({ document, declaration: event }));\n });\n const selected = (matches: { document: typeof scanned[number]; declaration: NamedSymbol }[]): ReactionReference => {\n if (matches.length !== 1) return { name, content: null, target: null };\n const { document, declaration } = matches[0];\n const body = directBody(document.lines, fenceMap(document.lines), declaration.line, indentOf(document.lines[declaration.line]));\n const content = [document.lines[declaration.line].trim(), ...body.map(line => document.lines[line].trim())].join('\\n');\n const prefix = document.lines[declaration.line].match(/\\b(?:event|trigger)\\s+/)!;\n return { name, content: `\\`\\`\\`screenplay\\n${content}\\n\\`\\`\\``, target: { name, location: { path: document.path, line: declaration.line + 1, column: prefix.index! + prefix[0].length + 1 }, source: document.source } };\n };\n if (events.length > 0) return selected(events);\n // A host may supply symbols without physical documents. Hover their event shape, but\n // never invent a definition location or fall through to a shadowed local trigger.\n if (application?.authoringDocuments === undefined) {\n const known = application?.events.filter(event => event.name === name) ?? [];\n if (known.length > 0) {\n const generation = Math.max(...known.map(event => event.generation ?? 1));\n const current = known.filter(event => (event.generation ?? 1) === generation);\n const content = current.length === 1 ? `\\`\\`\\`screenplay\\nevent ${name}\\n${current[0].properties.map(property => `${property.name} ${typeReferenceText(propertyTypeReference(property))}`).join('\\n')}\\n\\`\\`\\`` : null;\n return { name, content, target: null };\n }\n }\n const imports = [...scanned.flatMap(document => document.symbols.imports), ...(application?.authoringDocuments === undefined ? application?.imports ?? [] : [])].filter(imported => imported.shortName === name);\n if (imports.length > 0) return { name, content: imports.length === 1 ? `\\`\\`\\`screenplay\\nimport ${imports[0].qualifiedName}\\n\\`\\`\\`` : null, target: null };\n const triggers = scanned.flatMap(document => document.symbols.triggers.filter(trigger => trigger.name === name).map(trigger => ({ document, declaration: trigger })));\n return selected(triggers);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { eventContextPaths } from './event-context';\n\n// These words are contextual beneath a handler, never global property keywords.\nexport const handlerIntentDocs = {\n implementation: 'Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.',\n hint: 'One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code.',\n};\n\nexport const keywordDocs: Record<string, string> = {\n parameter: 'A typed value declared by a specification table, or an argument of a named behavior. Table types are required; every case supplies each parameter exactly once.',\n case: 'One named concrete row of a specification table, expanded as <Specification>_<Case>. Use case.<parameter> for a whole step value.',\n example: 'One typed, possibly partial fixture: `example <Name> : <EventOrCommandOrReadModel>`. Use its name in a matching specification step; assignments override example values without changing matching or supplying defaults. Event examples may carry stream or no stream; a step replaces that route as a whole.',\n domain: 'The domain the file belongs to \u2014 optional, at most one per file, before everything else.',\n import: 'Imports a type from another module by its qualified name \u2014 `import Module.Type` \u2014 making it available by its short name; or, quoted, other `.play` files by path or glob \u2014 `import \"Orders/**/*.play\"`, relative to this file\\'s folder. Written inside a module or feature, a file import places the imported files there: their top level is that module\\'s or feature\\'s body. `import Module.Event from \"origin\"` is instead public contract metadata with an opaque origin; executable binding refuses it with PLAY0268.',\n concept: 'A formalized value type wrapping a primitive. Bare pii and secret markers travel with every usage, with optional concept notes and qualifiers.',\n type: 'A composite value type \u2014 a named shape built from several properties, referenced by events, commands and other types the same way a concept is.',\n reason: 'A free-text concept note, not a lawful basis. Written as pii reason \"...\" or secret reason \"...\"; migration preserves it verbatim.',\n optional: 'Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.',\n identifier: 'Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.',\n policy: 'A named authorization rule referenced by commands and queries. Multiple policies AND together.',\n purpose: 'A report-only processing declaration (GDPR Art. 30), referenced on modules, features and slices. Coverage is their union, not an authorization gate. Generated declarations are not legal advice.',\n basis: 'One declared Art. 6(1) basis: consent, contract, legalObligation, vitalInterests, publicTask or legitimateInterests; an optional quoted reference may follow.',\n interest: 'The legitimate-interest statement for basis legitimateInterests (Art. 13(1)(d)).',\n condition: 'One Art. 9(2) processing condition, optionally followed by a quoted reference.',\n subjects: 'Comma-separated categories of data subjects, as open identifiers.',\n retention: 'Declared retention period or criteria, not enforced by the model or Chronicle.',\n recipient: 'A quoted recipient category; repeatable on a purpose.',\n transfer: 'A declared destination followed by safeguard and quoted safeguards; repeatable.',\n safeguard: 'The declared safeguard accompanying a third-country transfer.',\n erasure: 'An erasure exception under Art. 17(3); Chronicle crypto-shredding remains per subject, not per purpose.',\n exception: 'One declared Art. 17(3) exception: expression, legalObligation, publicTask, publicHealth, archiving or legalClaims.',\n persona: 'A named role interacting with the application, with an optional description and its associated policies.',\n identity: 'Declares typed additional caller details from a claim, a keyed single-result query, inline code or a file. Authoring metadata only; executable use of `$identity.<detail>` reports PLAY0268 until admitted (#600).',\n authentication: 'Declares the identity providers of the application \u2014 at most one block per file.',\n provider: 'A named identity provider within `authentication`, with free-form `name value` settings.',\n description: 'A human-readable description, including the rule or case a specification witnesses, as a quoted single line or a fenced ```text block for multiple lines.',\n depends: 'Declares `depends on <Name>` on a module or feature. This opts only that container into checking counted explicit references against its own declarations; it does not change executable bytes.',\n module: 'The top-level namespace \u2014 maps to a bounded context.',\n layout: 'A reusable screen template with named slots.',\n template: 'Declares the named slots of a layout.',\n feature: 'A vertical slice grouping. Features nest arbitrarily deep.',\n slice: 'The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.',\n public: 'Marks an event as a public contract. An event with from \"origin\" is also public. Origin is opaque, not a path or declaration reference. Public events and origins are admitted by executable semantic model (ESM) v9.',\n direction: 'Declare direction inbound or direction outbound once inside a Translate slice. Admitted by executable semantic model (ESM) v9; a Translate slice that uses public events must declare it (PLAY0614).',\n inbound: 'Inbound Translate direction metadata. No transport or delivery guarantee is implied.',\n outbound: 'Outbound Translate direction metadata. No transport or delivery guarantee is implied.',\n event: 'An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.',\n documentation: 'Authoring-only reasoning on a module, feature, slice, command, event, read model or reaction in one nonempty fenced ```markdown block. It does not change executable model bytes.',\n id: 'Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.',\n command: 'An imperative intent. Declares authorization, validation, and what events it produces \u2014 declaratively, or via a full handler.',\n query: 'A read-side entry point mapping to a return type, with an optional description, parameters and performer.',\n observable: 'Qualifies a query return type as a live read \u2014 `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.',\n performer: 'The code that performs a query \u2014 a `file <Path>` reference or an inline `csharp`/`sql` block. The query\\'s counterpart to a command handler.',\n from: 'Fills a query parameter from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.',\n projection: 'Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).',\n capture: 'Converts external data into events, using the embedded Change Data Capture Language (CDL).',\n reaction: 'Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own \u2014 `file`/code is optional realization metadata.',\n trigger: 'Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.',\n where: 'Narrows which occurrences actually run the reaction.',\n contains: 'Text comparison \u2014 true when the left string holds the right one anywhere.',\n every: 'Runs a reaction on an interval \u2014 `every 15 minutes`, `every 1 day`.',\n refused: 'Ordered invocation refusal branch: first match wins. Bare `on refused` covers validation and constraints, not authorization. Syntax-only, not yet executable (PLAY0268).',\n acknowledge: 'A refusal branch acknowledges alone, or produces events instead. Syntax-only, not yet executable (PLAY0268).',\n validation: 'In `on refused by validation`, selects property, concept and require refusals. Syntax-only, not yet executable (PLAY0268).',\n authorization: 'In `on refused by authorization`, explicitly selects unauthorized results, never Unsupported. Syntax-only, not yet executable (PLAY0268).',\n redelivered: '`when redelivered <Event> to <Reaction>` selects exactly one effective given occurrence by optional for, stated values and stream or no stream, without appending it again. Syntax-only, not yet executable (PLAY0268).',\n invokes: 'A command a reaction hands on. A command is asked for, not produced \u2014 it may still be rejected.',\n screen: 'A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.',\n constraint: 'A server-side rule enforced in the Chronicle kernel before events are committed.',\n authorize: 'References the policies that must all pass for the construct to execute.',\n validate: 'Declarative validation rules, or `validate` followed by ```csharp for imperative rules \u2014 on commands and concepts.',\n produces: 'References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.',\n reads: 'Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. Repeated views require unique aliases. Runtime binding is not yet supported for command or reaction reads.',\n as: 'Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.',\n handler: 'A fully imperative command implementation \u2014 a `file <Path>` reference or an inline `csharp` block, instead of `produces`.',\n when: 'Guards a produced event or a capture append with a condition. In a labeled screen action, `when item.<field> == <literal> execute <Command>` selects the first matching command. Inside on click, double click or select, block-form `when <condition>` selects one whole action list at gesture time.',\n rule: 'Names a predicate. Bare, it states that a constraint exists without expressing what it computes \u2014 nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.',\n require: 'A policy condition: `authenticated`, `role \"...\"`, or `claim \"...\" matches ...`. Unary `not` negates a condition or group; precedence is not, and, or.',\n authenticated: 'Requires an authenticated caller.',\n role: 'Requires the caller to have the given role.',\n claim: 'Requires a claim on the caller to match a subject or value.',\n subject: 'In policy `matches subject`, the identifier of the thing acted on, not the caller. The caller is `$context.causedBy.subject`.',\n data: 'Binds a read model to a screen through a query.',\n action: 'Makes a command available on a screen. `action \"Label\"` declares one button with ordered `when \u2026 execute` alternatives over the nearest data item or selected row. No subject hides it; commands still enforce authorization and validation.',\n otherwise: 'The final fallback of a guarded action: `otherwise hidden` or `otherwise execute <Command>`. In an item interaction, bare `otherwise` opens a fallback action list. No subject runs nothing, including fallback; authorization never falls through.',\n hidden: 'Hides a guarded action when no condition matches. Without a subject the action is always hidden, even with an execute fallback.',\n execute: 'Executes a command. A guarded screen action selects it by the first matching condition; explicit `with \u2026 from` bindings precede same-name item fields, its declared form and renderer input.',\n navigate: 'Navigates to a screen, optionally passing a parameter with `by`.',\n section: 'A named structural section of a screen.',\n table: 'A table widget over a read model or child collection.',\n summary: 'A summary widget showing labeled fields.',\n column: 'A table column bound to a property.',\n field: 'A summary field bound to a property.',\n title: 'The display title of a screen or section.',\n label: 'The display label of an action, column, or field.',\n unique: 'A uniqueness constraint \u2014 `unique <property> on <EventType>` or `unique event <EventType>`.',\n concurrency: 'The concurrency scope enforced when the command appends events \u2014 dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.',\n eventSource: 'Concurrency dimension \u2014 scope the check to the event source id of the command.',\n sourceType: 'Concurrency dimension \u2014 scope the check to an event source type.',\n streamType: 'Concurrency dimension \u2014 scope the check to an event stream type.',\n streamId: 'Concurrency dimension \u2014 scope the check to an event stream id.',\n tag: 'Attaches a tag to appended events \u2014 a static identifier or string, or a `$context.` expression resolved at append time.',\n seed: 'Declares events to seed into the event store per event source id \u2014 multiple blocks accumulate.',\n for: 'Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.',\n readmodel: 'Declares a read model \u2014 its name and properties \u2014 in a slice, or, in a specification, read model state: `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.',\n reducer: 'Builds a read model from events with imperative code \u2014 `reducer <Name> => <ReadModel>` with an `on <EventType>` rule per event. Use it when a projection cannot express the transition.',\n specification: 'Given/when/then acceptance criteria for a slice: prior events and state, the command, query or appended event under test, and the events, state, results, errors or denials that follow.',\n dialog: 'A dialog opened over the shell, or with `dialog template` a reusable dialog shape.',\n form: 'A form bound to a command \u2014 `form <Name> for <Command>` with a `field` per input.',\n contribute: 'Contributes entries to a slot of the shell \u2014 `contribute to Navigation` with `navigate to`, `label` and `order`.',\n theme: 'A named theme and the component packages it is compatible with.',\n ui: 'A UI profile \u2014 `ui profile <Name>` binds a target platform and size to a layout, theme and packages.',\n behavior: 'A named interaction wiring of `on <interaction>` handlers, attached to a screen, form or dialog with `uses`.',\n system: 'An application-scoped external system that operations use.',\n eventsource: 'An application-owned event source with nested streams.',\n operation: 'A reusable operation intent that uses one external system.',\n no: 'A keyed absence assertion: `then no readmodel <View> for <key>`.',\n arguments: 'The values supplied to a query asserted by `then query`.',\n result: 'One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.',\n clock: 'The instant a specification happens at - `given clock \"2026-10-05T08:00:00Z\"` fixes when everything occurs; `when clock \"<instant>\"` is the clock reaching it, as the action.',\n exactly: 'Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.',\n file: 'Delegates the implementation to an external file; the Screenplay contract stays visible.',\n by: 'Introduces the identifying parameter.',\n via: 'Connects screen data to the query that supplies it.',\n filter: 'An optional query filter parameter.',\n on: 'The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.',\n message: 'The validation message reported when the rule fails.',\n matches: 'Matches a value against a regular expression or a named pattern such as `email`.',\n all: 'Applies a comparison to every element of a collection.',\n max: 'Maximum length or value.',\n min: 'Minimum length or value.',\n length: 'Constrains the exact length of a value.',\n today: 'The current date.',\n empty: 'Used with `not empty` \u2014 the value must be present.',\n not: 'Negates a validation condition, as in `not empty`.',\n and: 'Both conditions must hold.',\n or: 'Either condition may hold.',\n csharp: 'An inline C# block whose opening fence is ```csharp.',\n sql: 'An inline SQL block between triple backticks \u2014 a query performer written against a relational store.',\n typescript: 'An inline TypeScript block between triple backticks.',\n react: 'An inline React/TSX block; receives the surrounding data contract as `Props`.',\n html: 'An inline static HTML block.',\n StateChange: 'Slice type \u2014 a command \u2192 events flow; something that changes the system.',\n StateView: 'Slice type \u2014 a query + projection + screen; something that reads the system.',\n Automation: 'Slice type \u2014 a reaction or reducer; something that runs when something happens.',\n Translate: 'Slice type \u2014 a capture; converts external data into events.',\n Uuid: 'Primitive type \u2014 a universally unique identifier.',\n String: 'Primitive type \u2014 a string of characters.',\n Int: 'Primitive type \u2014 an integer number.',\n Decimal: 'Primitive type \u2014 a decimal number.',\n Bool: 'Primitive type \u2014 true or false.',\n Date: 'Primitive type \u2014 a date without time.',\n DateTime: 'Primitive type \u2014 a date and time.',\n Enum: 'An enumeration concept with a fixed set of values.',\n};\n\n// What the words of a specification's steps mean there - where 'trigger', 'capture' and 'query' name what the\n// scenario exercises rather than declare one.\nexport const specificationKeywordDocs: Record<string, string> = {\n parameter: 'Declares a required typed case value: `parameter <name> <Type>`. Every case assigns it once. `optional` permits literal null but supplies no default.',\n case: 'One named complete row of a specification table. `case.<parameter>` substitutes a whole value after example overrides; each row runs as `<Specification>_<Case>`.',\n caller: '`given caller` states an explicit identity; `given caller as <Persona>` synthesizes an authenticated deterministic witness of the persona, with no body. Leftmost buildable policy alternatives are significant.',\n clock: keywordDocs.clock,\n redelivered: keywordDocs.redelivered,\n trigger: '`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.',\n capture: '`given capture <Capture>` - a record the capture\\'s source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.',\n query: '`when query <Query>` - the query is performed, as the action, with its arguments on the lines beneath; assert what it returns with `then result` or `then no result`. `then query` instead asserts a query after another action.',\n events: '`then no events` - asserts no new events after a non-append action. Syntax-only, not yet executable (PLAY0268). Cannot accompany event, event-order, error or denial expectations.',\n result: '`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing.',\n};\n\nexport const attributeDocs: Record<string, string> = {\n pii: 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]. Bare suffix marker; @pii is deprecated (PLAY0565). Not admitted by the executable model (PLAY0268).',\n personal: 'Alias of pii: personal data (GDPR Art. 4(1)); renders Chronicle [PII]. No diagnostic; canonical printing writes pii.',\n secret: 'Operational secret, not personal data: encrypted at rest without erasure and withheld from causation. Provider mapping: [Encrypted] + [NotAudited], or [PII] only with pii. Cannot be identity (PLAY0515). Not admitted by the executable model (PLAY0268).',\n sensitive: 'Deprecated spelling of secret (PLAY0565); repair to bare secret. Operational secret, not GDPR Art. 9 special-category data.',\n};\n\nexport const contextVariableDocs: Record<string, string> = {\n '$context.occurred': 'When the command or query was received.',\n '$context.tenant': 'The tenant the command or query is executing for.',\n '$context.command': 'The command being handled, shaped by its `command` declaration.',\n '$context.arguments': 'The arguments of the query being performed.',\n '$context.causedBy': 'The identity that caused the command or query \u2014 `subject`, `name`, `userName`.',\n '$context.causedBy.subject': 'The subject of the identity that caused the command or query.',\n '$context.causedBy.name': 'The display name of the identity that caused the command or query.',\n '$context.causedBy.userName': 'The user name of the identity that caused the command or query.',\n '$context.causation': 'What caused the command or query \u2014 `type`, `occurred`, `properties`.',\n '$context.causation.type': 'What caused the command or query \u2014 a command, a reactor, a schedule.',\n '$identity': 'The caller \u2014 token built-ins `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`, plus declared identity details. Built-ins are equivalent to `$context.identity`; details are authoring-only until admitted (#600).',\n '$identity.id': 'The identifier of the caller from the auth token; equivalent to `$context.identity.id`.',\n '$identity.name': 'The display name of the caller; equivalent to `$context.identity.name`.',\n '$identity.userName': 'The user name of the caller; equivalent to `$context.identity.userName`.',\n '$identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$identity.roles': 'The roles the caller holds.',\n '$identity.claims': 'The claims the caller carries \u2014 `$identity.claims.<name>` reads one.',\n '$context.identity': 'The caller a decision is made about \u2014 `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.',\n '$context.identity.id': 'The identifier of the caller from the auth token.',\n '$context.identity.name': 'The display name of the caller.',\n '$context.identity.userName': 'The user name of the caller.',\n '$context.identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$context.identity.roles': 'The roles the caller holds.',\n '$context.identity.claims': 'The claims the caller carries \u2014 `$context.identity.claims.<name>` reads one.',\n '$env': 'An environment variable, e.g. `$env.SERVICE_NAME`.',\n '$secrets': 'An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` \u2014 stays symbolic in the compiled tree.',\n '$strings': 'A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.',\n // Every $eventContext path the event-context catalog lists, for projections.\n ...Object.fromEntries(eventContextPaths.map((path) => [`$eventContext.${path.path}`, path.description])),\n};\n\n// One-sentence descriptions of the `pii special` categories (GDPR Art. 9(1)) and `pii criminal` (Art. 10).\n// The same sentences appear in Documentation/screenplay/concepts.md.\nexport const specialCategoryDocs: Record<string, string> = {\n racialOrEthnicOrigin: 'Data revealing a person\\'s racial or ethnic origin (GDPR Art. 9(1)).',\n politicalOpinions: 'Data revealing a person\\'s political opinions (GDPR Art. 9(1)).',\n religiousOrPhilosophicalBeliefs: 'Data revealing a person\\'s religious or philosophical beliefs (GDPR Art. 9(1)).',\n tradeUnionMembership: 'Data revealing whether a person belongs to a trade union (GDPR Art. 9(1)).',\n genetic: 'Data about inherited or acquired genetic characteristics that gives unique information about a person\\'s physiology or health (GDPR Art. 9(1), Art. 4(13)).',\n biometric: 'Data from technical processing of physical, physiological or behavioral characteristics, special only when processed to uniquely identify a person (GDPR Art. 9(1), Art. 4(14)).',\n health: 'Data about a person\\'s physical or mental health, including health care services, that reveals their health status (GDPR Art. 9(1), Art. 4(15)).',\n sexLifeOrSexualOrientation: 'Data concerning a person\\'s sex life or sexual orientation (GDPR Art. 9(1)).'\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { refusalContext } from './refusal-context';\nimport { namedRuleContext } from './named-rule-context';\nimport { eventSourceHover } from './event-source-authoring';\nimport { exampleHover } from './example-authoring';\nimport { operationHover } from './operation-authoring';\nimport { DocumentSymbols, symbolsForBuffer } from './symbols';\nimport { responseAnalysis, responseAvailability } from './response-analysis';\nimport { enclosingChain, enclosingHeaders, fenceMap, indentOf, withoutComment } from './document-context';\nimport { directBody, propertyTypeReference, scanDocument } from './symbols';\nimport { typeReferenceText } from './TypeReferenceSymbol';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { getSubLanguage } from './sub-language-registry';\nimport { attributeDocs, contextVariableDocs, handlerIntentDocs, keywordDocs, specialCategoryDocs, specificationKeywordDocs } from './keyword-docs';\n\n// Produces the hover markdown for a word at a position, without any editor\n// dependency \u2014 the Monaco service and the VSCode extension share this content.\n// Columns are 1-based, matching both editors' word-at-position APIs.\nexport function hoverContent(\n lines: string[],\n lineIndex: number,\n word: string,\n startColumn: number,\n endColumn: number,\n application?: DocumentSymbols,\n): string | null {\n const fences = fenceMap(lines);\n if (fences[lineIndex]) return null;\n\n const line = lines[lineIndex] ?? '';\n if (endColumn - 1 > withoutComment(line).length) return null;\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < startColumn - 1; index++) {\n if (line[index] === '\\\\' && inString) index++;\n else if (line[index] === '\"' && !inTemplate) inString = !inString;\n else if (line[index] === '`' && !inString) inTemplate = !inTemplate;\n }\n if (inString || inTemplate) return null;\n const reaction = reactionReferenceAt(lines, lineIndex, startColumn, endColumn, application);\n if (reaction) return reaction.content;\n const fixtureHover = exampleHover(lines, lineIndex, startColumn, endColumn, application);\n if (fixtureHover) return fixtureHover;\n const sourceHover = eventSourceHover(lines, lineIndex, startColumn, endColumn, application);\n if (sourceHover) return sourceHover;\n const operation = operationHover(lines, lineIndex, startColumn, endColumn, application);\n if (operation) return operation;\n const tokenAt = (column: number, name: string): boolean => {\n const start = column + (line[column - 1] === '@' ? 1 : 0);\n return word === name && startColumn === start && endColumn === start + name.length && line.slice(start - 1, endColumn - 1) === name;\n };\n const before = line.charAt(startColumn - 2);\n if (word === 'authorization' && enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'purpose') return 'A quoted authorization in law for criminal-offence data (Art. 10).';\n\n const complianceHeader = /^\\s*concept\\s+[^\\s:]+\\s*:\\s*\\w+\\s+/.exec(line);\n const complianceBody = enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'concept' && /^\\s*(?:@?pii|personal|@?sensitive|secret)\\s+(?:reason|scope|special|criminal)\\b/.test(line);\n if ((complianceHeader !== null && startColumn - 1 >= complianceHeader[0].length - 1) || complianceBody) {\n const doc = attributeDocs[word];\n if (doc) return doc;\n if (Object.hasOwn(specialCategoryDocs, word) && /^\\s*(?:@?pii|personal)\\s+special\\s+/.test(line)) return `**${word}** \u2014 ${specialCategoryDocs[word]}`;\n if (word === 'special') return 'GDPR Art. 9(1) special category; requires pii. At most one category per concept.';\n if (word === 'criminal') return 'Personal data relating to criminal convictions and offenses (GDPR Art. 10); requires pii.';\n if (/^\\s*(?:secret|sensitive|@sensitive)\\s+scope\\s+/.test(line) && ['subject', 'namespace', 'global'].includes(word)) return `**${word}** \u2014 Secret encryption scope${word === 'subject' ? ' per data subject' : word === 'namespace' ? ' per tenant namespace' : ' shared globally'}. Not an event-property subject role.`;\n if (word === 'scope') return 'Secret encryption scope: subject, namespace or global. Omitted scope keeps Chronicle\u2019s Subject default; pii secret renders only [PII].';\n }\n if (before === '$' || before === '.') {\n const variable = line.substring(0, endColumn - 1).match(/\\$[\\w.]*$/)?.[0];\n if (variable) {\n if (variable.startsWith('$refusal')) {\n const branch = refusalContext(lines, lineIndex, indentOf(line));\n const member = variable.substring('$refusal.'.length);\n const descriptions: Record<string, string> = { reason: 'Refusal kind as a String: validation, constraint or authorization.', message: 'Rejection details verbatim, including unresolved $strings keys.', constraint: 'Violated constraint name as a String, only in a by constraint branch.' };\n return branch !== undefined && descriptions[member] !== undefined ? `**${variable}** \u2014 ${descriptions[member]} Syntax-only, not yet executable (PLAY0268).` : null;\n }\n if (variable.startsWith('$identity.')) {\n const name = variable.substring('$identity.'.length).split('.')[0];\n const detail = symbolsForBuffer(lines, application).identityDetails?.find(detail => detail.name === name);\n if (detail) return `**$identity.${detail.name}** \u2014 ${detail.type}. Declared caller detail; authoring metadata only, not executable until admitted (#600).`;\n }\n const doc =\n contextVariableDocs[variable] ??\n (variable.startsWith('$env') ? contextVariableDocs['$env'] : undefined);\n if (doc) return doc;\n }\n }\n\n // Do not mistake a property/type named optional for the contextual modifier.\n const prefix = line.slice(0, startColumn - 1);\n // Commit to query-parameter context before matching the name and type.\n const followsPropertyType = /^\\s*(?:by|filter)\\s+/.test(prefix)\n ? /^\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+$/.test(prefix)\n : /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?\\s+$/.test(prefix);\n const followsQueryType = /^\\s*query\\s+\\w+\\s*=>\\s*(?:observable\\s+)?[\\w.]+(?:\\[\\])?\\s+$/.test(prefix) &&\n !/^\\s*query\\s+\\w+\\s*=>\\s*observable\\s+$/.test(prefix);\n if (word === 'subject') {\n const source = eventAnalysisSource(lines);\n const subjectPrefix = /^\\s*@?[a-z_]\\w*\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?(?:\\s+generated)?(?:\\s+identifier)?\\s+$/.test(prefix);\n const ownerChain = enclosingChain(source, fences, lineIndex, indentOf(line));\n if (subjectPrefix && (ownerChain[0] === 'event' || /^produces\\s+event\\s+/.test(enclosingHeaders(source, fences, lineIndex, indentOf(line))[0] ?? ''))) {\n return '**subject** \u2014 This event property identifies its one data subject instead of the event source (decision 0008). Required scalar String, Uuid or their concepts, or an Int-backed concept; never pii or secret. Report-only lineage metadata (PLAY0270); no ESM bytes or provider output yet.';\n }\n if (/\\bclaim\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s+matches\\s+$/.test(prefix) && ownerChain.includes('policy')) return `**subject** \u2014 ${keywordDocs.subject}`;\n return null;\n }\n if (word === 'optional' && (followsPropertyType || followsQueryType)) {\n return `**optional** \u2014 ${keywordDocs.optional}`;\n }\n\n if (word === 'implementation' || word === 'hint') {\n const chain = enclosingChain(lines, fences, lineIndex, indentOf(line));\n const ruleContext = namedRuleContext(lines, lineIndex, indentOf(line));\n if ((word === 'implementation' && ruleContext === 'rule' && /^\\s*implementation\\s*$/.test(withoutComment(line))) ||\n (word === 'hint' && ruleContext === 'implementation' && /^\\s*hint\\s+\"/.test(line))) {\n return `**${word}** \u2014 Command named-rule guidance with at most one file or tagged fence. No payload means pending and fails binding (PLAY0268). Attached predicates keep their existing pure RuleContext contract; reference execution is unsupported, never confirmation.`;\n }\n if (word === 'implementation' && chain[0] === 'handler' && /^\\s*implementation\\s*$/.test(withoutComment(line))) {\n return `**implementation** \u2014 ${handlerIntentDocs.implementation}`;\n }\n if (word === 'hint' && chain[0] === 'implementation' && chain[1] === 'handler' && /^\\s*hint\\s+\"/.test(line)) {\n return `**hint** \u2014 ${handlerIntentDocs.hint}`;\n }\n }\n\n const symbols = scanDocument(lines);\n const owner = symbols.commands.filter(command => command.line < lineIndex).at(-1);\n const property = owner?.properties.find(property => property.name === word && property.line === lineIndex);\n if (property?.isGenerated || (word === 'generated' && owner?.properties.some(property => property.isGenerated && property.line === lineIndex) && followsPropertyType)) {\n return `**${property?.name ?? 'generated'}** \u2014 ${property ? typeReferenceText(propertyTypeReference(property)) + '. ' : ''}Generated value, not a request or form input. ${responseAvailability}`;\n }\n const response = owner?.response;\n if (response?.location.line === lineIndex + 1 && (tokenAt(response.location.column, 'returns') || (response.kind === 'ScalarCommandResponseSyntax' && tokenAt(response.source.location.column, response.source.property)))) {\n const source = response.kind === 'ScalarCommandResponseSyntax' ? owner?.properties.find(property => property.name === response.source.property) : undefined;\n return `**returns**${source ? ` \u2014 ${typeReferenceText(propertyTypeReference(source))}` : ' \u2014 unnamed record response'}. ${responseAvailability}`;\n }\n if (response?.kind === 'RecordCommandResponseSyntax') {\n const field = response.fields.find(field => field.location.line === lineIndex + 1 && (tokenAt(field.location.column, field.name) || tokenAt(field.source.location.column, field.source.property)));\n if (field) {\n const source = owner?.properties.find(property => property.name === field.source.property);\n const type = field.type ? typeReferenceText(field.type) : source ? typeReferenceText(propertyTypeReference(source)) : 'Unresolved type';\n return `**${field.name}** \u2014 ${type}${field.type ? ' (explicit)' : ' (inferred)'} = ${field.source.property}. ${source?.isGenerated ? 'Generated source, not request input. ' : ''}${responseAvailability}`;\n }\n }\n for (const specification of responseAnalysis(lines).specifications.values()) {\n if ((word === 'returns' && specification.thenReturns?.location.line === lineIndex + 1) || (word === 'generated' && specification.when?.generatedValues?.some(value => value.location.line === lineIndex + 1))) return responseAvailability;\n }\n\n const concept = symbols.concepts.find((candidate) => candidate.name === word);\n if (concept) {\n const attributes = concept.attributes.length ? ` ${concept.attributes.join(' ')}` : '';\n const values = concept.enumValues.length\n ? `\\n\\nValues: ${concept.enumValues.join(', ')}`\n : '';\n const reasons = Object.entries(concept.attributeReasons)\n .map(([attribute, reason]) => `\\n\\n**@${attribute}** \u2014 ${reason}`)\n .join('');\n return `\\`\\`\\`screenplay\\nconcept ${concept.name} : ${concept.primitive}${attributes}\\n\\`\\`\\`${reasons}${values}`;\n }\n\n const type = symbols.types.find((candidate) => candidate.name === word);\n if (type) {\n const properties = type.properties\n .map((property) => `${property.name} ${typeReferenceText(propertyTypeReference(property))}`)\n .join('\\n');\n return `\\`\\`\\`screenplay\\ntype ${type.name}\\n${properties}\\n\\`\\`\\``;\n }\n\n const policy = symbols.policies.find((candidate) => candidate.name === word);\n if (policy) {\n const body = policy.requires.length ? policy.requires.join('\\n') : '(custom C#)';\n return `\\`\\`\\`screenplay\\npolicy ${policy.name}\\n${body}\\n\\`\\`\\``;\n }\n\n const event = symbols.events.find((candidate) => candidate.name === word && candidate.line === lineIndex) ??\n symbols.events.filter((candidate) => candidate.name === word)\n .sort((left, right) => (right.generation ?? 1) - (left.generation ?? 1))[0];\n if (event) {\n const properties = event.properties\n .map((property) => `${property.name} ${typeReferenceText(propertyTypeReference(property))}${property.isSubject ? ' subject' : ''}`)\n .join('\\n');\n return `\\`\\`\\`screenplay\\n${event.visibility === 'Public' ? 'public ' : ''}event ${event.name}${event.generation !== undefined ? ` generation ${event.generation}` : ''}${event.origin !== undefined ? ` from ${JSON.stringify(event.origin)}` : ''}\\n${properties}\\n\\`\\`\\``;\n }\n\n const command = symbols.commands.find((candidate) => candidate.name === word);\n if (command && command.properties.length > 0) {\n const properties = command.properties\n .map(\n (property) =>\n `${property.name} ${typeReferenceText(propertyTypeReference(property))}${property.isGenerated ? ' generated' : ''}${property.isIdentifier ? ' identifier' : ''}`,\n )\n .join('\\n');\n return `\\`\\`\\`screenplay\\ncommand ${command.name}\\n${properties}\\n\\`\\`\\`${command.response || command.properties.some(property => property.isGenerated) ? `\\n\\n${responseAvailability}` : ''}`;\n }\n\n // Sub-language keywords take precedence inside their construct.\n const chain = enclosingChain(lines, fences, lineIndex, indentOf(line));\n for (const construct of [line.trim().split(/\\s+/)[0], ...chain]) {\n const subLanguage = getSubLanguage(construct ?? '');\n const doc = subLanguage?.hovers?.[word];\n if (doc) return doc;\n }\n\n if (word === 'reads' && (chain[0] === 'every' || chain[0] === 'at') && chain.includes('reaction')) {\n return '**reads** \u2014 Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.';\n }\n\n const step = line.trim().match(/^(given|when|then)\\s+(?:no\\s+)?(\\w+)/);\n if (step && step[2] === word && chain[0] === 'specification' && specificationKeywordDocs[word]) {\n return `**${word}** \u2014 ${specificationKeywordDocs[word]}`;\n }\n\n if (word === 'id' || word === 'documentation') {\n const source = eventAnalysisSource(lines);\n const inEvent = symbols.events.some(event => directBody(source, fences, event.line, indentOf(source[event.line])).includes(lineIndex));\n const directive = word === 'id' ? /^\\s*id\\s+\"/.test(source[lineIndex]) : /^\\s*documentation\\s*$/.test(source[lineIndex]);\n const supportedOwner = inEvent || (word === 'documentation' && ['module', 'feature', 'slice', 'command', 'readmodel', 'reaction'].includes(chain[0]));\n if (!supportedOwner || !directive || startColumn !== indentOf(line) + 1) return null;\n }\n\n if (word === 'optional' || word === 'generated' || word === 'returns') return null;\n const keywordDoc = keywordDocs[word];\n if (keywordDoc) return `**${word}** \u2014 ${keywordDoc}`;\n\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport { hoverContent } from './hover-content';\nimport { CompletionOptions } from './completions';\n\nexport function createHoverProvider(options: CompletionOptions = {}): languages.HoverProvider {\n return {\n provideHover(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return null;\n\n const content = hoverContent(\n model.getLinesContent(),\n position.lineNumber - 1,\n word.word,\n word.startColumn,\n word.endColumn,\n options.application?.(model),\n );\n return content ? { contents: [{ value: content }] } : null;\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\nimport { destinationHints } from './production-destinations';\nimport { CompletionOptions } from './completions';\n\nexport function createInlayHintsProvider(options: CompletionOptions = {}): languages.InlayHintsProvider {\n return {\n provideInlayHints(model, range) {\n const hints = destinationHints(model.getLinesContent(), options.application?.(model)).filter(hint => hint.line + 1 >= range.startLineNumber && hint.line + 1 <= range.endLineNumber);\n return {\n hints: hints.map(hint => ({ position: { lineNumber: hint.line + 1, column: hint.column }, label: hint.label, paddingLeft: true })),\n dispose() {},\n };\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, IRange, languages } from 'monaco-editor';\nimport { DiagnosticCodes, isQuickFixDiagnostic, prepareQuickFixes } from '@cratis/screenplay-compiler';\n\nconst migrateOptional = 'source.screenplay.migrateOptional';\nconst migrateCompliance = 'source.screenplay.migrateCompliance';\nconst migrationKind = (code: string) => code === DiagnosticCodes.LegacyComplianceMarker ? migrateCompliance : migrateOptional;\nconst containsKind = (requested: string, kind: string) => requested === '' || requested === kind || kind.startsWith(`${requested}.`);\n\nfunction intersects(left: IRange, right: IRange): boolean {\n return (left.startLineNumber < right.endLineNumber || (left.startLineNumber === right.endLineNumber && left.startColumn <= right.endColumn)) &&\n (right.startLineNumber < left.endLineNumber || (right.startLineNumber === left.endLineNumber && right.startColumn <= left.endColumn));\n}\n\n// The compiler owns recipes and verification. The adapter only translates verified offsets and pins\n// edits to the analyzed buffer version, so future fixes need no editor-specific parsing or .NET bridge.\nexport function createCodeActionProvider(placement?: readonly string[]): languages.CodeActionProvider {\n const cache = new WeakMap<editor.ITextModel, { version: number; placement: string; fixes: ReturnType<typeof prepareQuickFixes> }>();\n return {\n provideCodeActions(model, range, context, token) {\n const migrationRequested = context.only !== undefined && [migrateOptional, migrateCompliance].some(kind => containsKind(context.only!, kind));\n const migrationOnly = context.only !== undefined && migrationRequested && !containsKind(context.only, 'quickfix');\n if (token.isCancellationRequested || (context.only !== undefined && !migrationRequested && !containsKind(context.only, 'quickfix'))) return { actions: [], dispose() {} };\n const diagnostics = context.markers.filter(marker => {\n const code = typeof marker.code === 'object' ? marker.code.value : marker.code;\n return isQuickFixDiagnostic(code) && intersects(marker, range);\n });\n if (!migrationRequested && diagnostics.length === 0) return { actions: [], dispose() {} };\n const version = model.getVersionId();\n const placementKey = JSON.stringify(placement) ?? '';\n let analysis = cache.get(model);\n if (analysis?.version !== version || analysis.placement !== placementKey) {\n analysis = { version, placement: placementKey, fixes: prepareQuickFixes(model.getValue(), { placement }) };\n cache.set(model, analysis);\n }\n const occurrences = migrationOnly ? [] : analysis.fixes(diagnostics.map(diagnostic => ({\n line: diagnostic.startLineNumber,\n diagnosticCode: String(typeof diagnostic.code === 'object' ? diagnostic.code.value : diagnostic.code),\n }))).filter(fix => fix.scope === 'occurrence');\n const requested = [...occurrences, ...(context.only === undefined || migrationRequested ? [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker].flatMap(code => analysis.fixes(undefined, code)) : [])];\n const fixes = requested.filter(fix => context.only === undefined || containsKind(context.only, fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix'));\n if (token.isCancellationRequested || model.getVersionId() !== version) return { actions: [], dispose() {} };\n return {\n actions: fixes.map(fix => ({\n title: fix.title,\n kind: fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix',\n isPreferred: fix.scope === 'occurrence',\n edit: { edits: fix.edits.map(edit => {\n const start = model.getPositionAt(edit.start);\n const end = model.getPositionAt(edit.start + edit.length);\n return { resource: model.uri, versionId: version, textEdit: {\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column },\n text: edit.text,\n } };\n }) },\n })),\n dispose() {},\n };\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\nimport { Monaco, languageId } from './language';\nimport { validateLines } from './validation';\nimport { CompletionOptions } from './completions';\nimport { symbolsForBuffer } from './symbols';\n\nconst owner = 'screenplay';\nconst validationDelay = 300;\n\nexport function validate(monaco: Monaco, model: editor.ITextModel, options: CompletionOptions = {}): editor.IMarkerData[] {\n const lines = model.getLinesContent();\n const application = symbolsForBuffer(lines, options.application?.(model));\n return validateLines(lines, { application, path: application.authoringPath, placement: application.authoringPlacement }).map((issue) => ({\n severity:\n issue.severity === 'error'\n ? monaco.MarkerSeverity.Error\n : issue.severity === 'information'\n ? monaco.MarkerSeverity.Info\n : monaco.MarkerSeverity.Warning,\n tags: (issue.code === 'PLAY0479' || issue.code === 'PLAY0565') ? [monaco.MarkerTag.Deprecated] : undefined,\n message: issue.message,\n code: issue.code,\n startLineNumber: issue.line + 1,\n startColumn: issue.startColumn,\n endLineNumber: issue.line + 1,\n endColumn: issue.endColumn,\n }));\n}\n\nfunction watch(monaco: Monaco, model: editor.ITextModel, options: CompletionOptions): void {\n let handle: ReturnType<typeof setTimeout> | undefined;\n\n const run = () => {\n if (model.isDisposed()) return;\n if (model.getLanguageId() !== languageId) {\n monaco.editor.setModelMarkers(model, owner, []);\n return;\n }\n monaco.editor.setModelMarkers(model, owner, validate(monaco, model, options));\n };\n const schedule = () => {\n if (handle !== undefined) clearTimeout(handle);\n handle = setTimeout(run, validationDelay);\n };\n\n const contextChange = options.onDidChangeApplication?.(run);\n model.onDidChangeContent(schedule);\n model.onDidChangeLanguage(run);\n model.onWillDispose(() => {\n contextChange?.dispose();\n if (handle !== undefined) clearTimeout(handle);\n });\n run();\n}\n\nexport function attachDiagnostics(monaco: Monaco, options: CompletionOptions = {}): void {\n monaco.editor.getModels().forEach((model) => watch(monaco, model, options));\n monaco.editor.onDidCreateModel((model) => watch(monaco, model, options));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SubLanguageDefinition } from '../sub-language-registry';\n\n// Projection Declaration Language (PDL) \u2014 embedded inside `projection` blocks.\n// See https://www.cratis.io/chronicle/projections/projection-declaration-language/grammar/\nexport const pdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:description|from|every|all|nested|join|children|identified|by|key|parent|with|remove|via|clear|on|sequence|automap|no|exclude|literal|set|increment|decrement|add|subtract|count)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n { label: 'description', insertText: 'description \"${1:builder intent}\"', documentation: 'Report-only description on a projection header, not on its nested blocks or variants.' },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which property identifies the read model instance.',\n },\n {\n label: 'from',\n insertText: 'from ${1:EventType}',\n documentation: 'Maps properties from an event onto the read model.',\n },\n {\n label: 'join',\n insertText: 'join ${1:property} on ${2:key}',\n documentation: 'Joins related state onto the read model by a key property.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Projects events into a child collection on the read model.',\n },\n {\n label: 'remove with',\n insertText: 'remove with ${1:EventType}',\n documentation: 'Removes the read model instance when the event occurs.',\n },\n {\n label: 'parent',\n insertText: 'parent ${1:property}',\n documentation: 'Declares the property that identifies the parent of a child.',\n },\n {\n label: 'clear',\n insertText: 'clear ${1:property}',\n documentation: 'Removes the value a property holds when the event occurs.',\n },\n {\n label: 'increment',\n insertText: 'increment ${1:property}',\n documentation: 'Increments a numeric property when the event occurs.',\n },\n {\n label: 'decrement',\n insertText: 'decrement ${1:property}',\n documentation: 'Decrements a numeric property when the event occurs.',\n },\n ],\n hovers: {\n description: 'Report-only projection-header description, as quoted or fenced text; adds no executable bytes.',\n from: 'PDL \u2014 maps properties from an event onto the read model.',\n every: 'PDL \u2014 applies property mappings for every event type in the projection.',\n join: 'PDL \u2014 joins related state onto the read model by a key property.',\n children: 'PDL \u2014 projects events into a child collection on the read model.',\n identified: 'PDL \u2014 introduces the identifying key of a child collection.',\n key: 'PDL \u2014 declares which property identifies the read model instance.',\n parent: 'PDL \u2014 declares the property that identifies the parent of a child.',\n remove: 'PDL \u2014 removes the read model instance when an event occurs.',\n clear: 'PDL \u2014 clear <property> removes the value a property holds; clear with <EventType> nulls a nested object.',\n increment: 'PDL \u2014 increments a numeric property when the event occurs.',\n decrement: 'PDL \u2014 decrements a numeric property when the event occurs.',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SubLanguageDefinition } from '../sub-language-registry';\n\n// Change Data Capture Language (CDL) \u2014 embedded inside `capture` blocks. This is the\n// lightweight definition mixed into the composite `.play` tokenizer; the full standalone\n// CDL language (its own tokenizer, context-aware completions, hover, and validation) lives\n// in `./capture` and is what `@cratis/screenplay-language/capture` exposes to consumers.\nexport const cdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n {\n label: 'source',\n insertText: 'source ${1:api}',\n documentation: 'Declares where the captured data comes from.',\n },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which source property identifies an instance.',\n },\n {\n label: 'map',\n insertText: 'map\\n ${1:property} = ${2:source}',\n documentation: 'Maps and translates source values before events are appended.',\n },\n {\n label: 'append',\n insertText: 'append ${1:EventType}\\n when ${2:property}',\n documentation: 'Appends an event when the source data changes.',\n },\n {\n label: 'translate',\n insertText: 'translate\\n \"${1:source}\" => ${2:target}',\n documentation: 'Translates source values into Screenplay values.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Captures changes in a child collection of the source data.',\n },\n {\n label: 'when added',\n insertText: 'when added',\n documentation: 'Appends the event when a new item appears in the source.',\n },\n {\n label: 'when removed',\n insertText: 'when removed',\n documentation: 'Appends the event when an item disappears from the source.',\n },\n ],\n hovers: {\n source: 'CDL \u2014 declares where the captured data comes from.',\n api: 'CDL \u2014 as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.',\n route: 'CDL \u2014 optional path appended to an API source\\'s External Service base URL.',\n poll: 'CDL \u2014 the polling interval for an API source, e.g. 5m.',\n path: 'CDL \u2014 the inbound path a webhook source listens on.',\n topic: 'CDL \u2014 the topic a message source subscribes to.',\n key: 'CDL \u2014 declares which source property identifies an instance.',\n map: 'CDL \u2014 maps and translates source values before events are appended.',\n translate: 'CDL \u2014 translates source values into Screenplay values.',\n append: 'CDL \u2014 appends an event when the source data changes.',\n when: 'CDL \u2014 the change condition: a property change, added, or removed.',\n added: 'CDL \u2014 matches items that appear in the source.',\n removed: 'CDL \u2014 matches items that disappear from the source.',\n children: 'CDL \u2014 captures changes in a child collection of the source data.',\n identified: 'CDL \u2014 introduces the identifying key of a child collection.',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\n\nexport const screenplayDarkThemeName = 'screenplay-dark';\n\nexport const screenplayDark: editor.IStandaloneThemeData = {\n base: 'vs-dark',\n inherit: true,\n rules: [\n { token: 'keyword.play', foreground: 'C586C0' },\n { token: 'keyword.tag.play', foreground: '569CD6', fontStyle: 'italic' },\n { token: 'keyword.type.play', foreground: '4FC1FF', fontStyle: 'bold' },\n { token: 'type.play', foreground: '4EC9B0' },\n { token: 'type.identifier.play', foreground: '4EC9B0' },\n { token: 'identifier.play', foreground: '9CDCFE' },\n { token: 'annotation.play', foreground: 'DCDCAA' },\n { token: 'variable.predefined.play', foreground: 'D7BA7D' },\n { token: 'string.play', foreground: 'CE9178' },\n { token: 'string.link.play', foreground: 'CE9178', fontStyle: 'underline' },\n { token: 'string.invalid.play', foreground: 'F44747' },\n { token: 'string.quote.play', foreground: '6A9955' },\n { token: 'number.play', foreground: 'B5CEA8' },\n { token: 'number.float.play', foreground: 'B5CEA8' },\n { token: 'comment.play', foreground: '6A9955', fontStyle: 'italic' },\n { token: 'operator.play', foreground: 'D4D4D4' },\n { token: 'delimiter.play', foreground: 'CCCCCC' },\n ],\n colors: {\n 'editor.background': '#1E1E1E',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor } from 'monaco-editor';\n\nexport const screenplayLightThemeName = 'screenplay-light';\n\nexport const screenplayLight: editor.IStandaloneThemeData = {\n base: 'vs',\n inherit: true,\n rules: [\n { token: 'keyword.play', foreground: 'AF00DB' },\n { token: 'keyword.tag.play', foreground: '0000FF', fontStyle: 'italic' },\n { token: 'keyword.type.play', foreground: '0070C1', fontStyle: 'bold' },\n { token: 'type.play', foreground: '267F99' },\n { token: 'type.identifier.play', foreground: '267F99' },\n { token: 'identifier.play', foreground: '001080' },\n { token: 'annotation.play', foreground: '795E26' },\n { token: 'variable.predefined.play', foreground: 'B45309' },\n { token: 'string.play', foreground: 'A31515' },\n { token: 'string.link.play', foreground: 'A31515', fontStyle: 'underline' },\n { token: 'string.invalid.play', foreground: 'CD3131' },\n { token: 'string.quote.play', foreground: '008000' },\n { token: 'number.play', foreground: '098658' },\n { token: 'number.float.play', foreground: '098658' },\n { token: 'comment.play', foreground: '008000', fontStyle: 'italic' },\n { token: 'operator.play', foreground: '000000' },\n { token: 'delimiter.play', foreground: '000000' },\n ],\n colors: {\n 'editor.background': '#FFFFFF',\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n Monaco,\n languageConfiguration,\n languageExtensionPoint,\n languageId,\n} from './language';\nimport { createTokensProvider } from './tokens';\nimport { CompletionOptions, createCompletionProvider } from './completions';\nimport { createInlineCompletionProvider } from './inline-completions';\nimport { responseTokens, responseTokenTypes } from './response-tokens';\nimport { reactionReferenceAt } from './reaction-authoring';\nimport { createHoverProvider } from './hover';\nimport { createInlayHintsProvider } from './inlay-hints';\nimport { eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nimport { createCodeActionProvider } from './code-actions';\nimport { attachDiagnostics } from './diagnostics';\nimport {\n getSubLanguage,\n getSubLanguages,\n onSubLanguagesChanged,\n registerSubLanguage,\n} from './sub-language-registry';\nimport { pdl } from './sub-languages/pdl';\nimport { cdl } from './sub-languages/cdl';\nimport { screenplayDark, screenplayDarkThemeName } from './themes/screenplay-dark';\nimport { screenplayLight, screenplayLightThemeName } from './themes/screenplay-light';\n\nconst registeredInstances = new Set<Monaco>();\n\nfunction applyTokensProvider(monaco: Monaco): void {\n monaco.languages.setMonarchTokensProvider(languageId, createTokensProvider(getSubLanguages()));\n}\n\n// Sub-languages registered after register() recompose the tokenizer on the fly.\nonSubLanguagesChanged(() => registeredInstances.forEach(applyTokensProvider));\n\n// Registers the built-in PDL and CDL sub-languages. Hosts that do not go through\n// register() \u2014 such as the VSCode extension \u2014 call this before using the registry.\nexport function ensureBuiltInSubLanguages(): void {\n if (!getSubLanguage('projection')) registerSubLanguage('projection', pdl);\n if (!getSubLanguage('capture')) registerSubLanguage('capture', cdl);\n}\n\n// What a host can tell the language service beyond the models it holds.\nexport type LanguageServiceOptions = CompletionOptions;\n\nexport function register(monaco: Monaco, options: LanguageServiceOptions = {}): void {\n if (registeredInstances.has(monaco)) return;\n\n ensureBuiltInSubLanguages();\n\n registeredInstances.add(monaco);\n\n monaco.languages.register(languageExtensionPoint);\n monaco.languages.setLanguageConfiguration(languageId, languageConfiguration);\n applyTokensProvider(monaco);\n monaco.languages.registerCompletionItemProvider(languageId, createCompletionProvider(monaco, options));\n monaco.languages.registerInlineCompletionsProvider(languageId, createInlineCompletionProvider(options));\n monaco.languages.registerHoverProvider(languageId, createHoverProvider(options));\n monaco.languages.registerDefinitionProvider(languageId, {\n provideDefinition(model, position) {\n const word = model.getWordAtPosition(position);\n if (!word) return [];\n const symbols = options.application?.(model);\n const reference = eventSourceReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const reaction = reactionReferenceAt(model.getLinesContent(), position.lineNumber - 1, word.startColumn, word.endColumn, symbols);\n const target = reaction ? reaction.target : reference?.target;\n if (!target) return [];\n const current = symbols?.authoringPath ?? 'current.play';\n const source = target.location.path === current ? model.getValue() : symbols?.authoringDocuments?.find(document => document.path === target.location.path)?.source;\n const location = reaction ? reaction.target?.location : source && eventSourceIdentifier(target.location, target.name, source);\n if (!location) return [];\n // Foreign navigation requires an actual host model, not a guessed path or merged line.\n const targetUri = target.location.path && model.uri.path.endsWith(`/${current}`)\n ? model.uri.with({ path: model.uri.path.slice(0, -current.length) + target.location.path }) : undefined;\n const targetModels = targetUri ? monaco.editor.getModels().filter(candidate => candidate.uri.toString() === targetUri.toString()) : [];\n const targetModel = target.location.path === current ? model : targetModels.length === 1 ? targetModels[0] : undefined;\n return targetModel ? [{ uri: targetModel.uri, range: new monaco.Range(location.line, location.column, location.line, location.column + target.name.length) }] : [];\n }\n });\n monaco.languages.registerDocumentSemanticTokensProvider(languageId, {\n getLegend: () => ({ tokenTypes: [...responseTokenTypes], tokenModifiers: [] }),\n provideDocumentSemanticTokens(model) {\n const data: number[] = [];\n let previousLine = 0;\n let previousColumn = 0;\n for (const token of responseTokens(model.getLinesContent(), options.application?.(model))) {\n data.push(token.line - previousLine, token.line === previousLine ? token.column - previousColumn : token.column, token.length, token.type, 0);\n previousLine = token.line;\n previousColumn = token.column;\n }\n return { data: new Uint32Array(data) };\n },\n releaseDocumentSemanticTokens() {},\n });\n monaco.languages.registerInlayHintsProvider(languageId, createInlayHintsProvider(options));\n monaco.languages.registerCodeActionProvider(languageId, createCodeActionProvider());\n monaco.editor.defineTheme(screenplayDarkThemeName, screenplayDark);\n monaco.editor.defineTheme(screenplayLightThemeName, screenplayLight);\n attachDiagnostics(monaco, options);\n}\n\nexport { reactionReferenceAt } from './reaction-authoring';\n\nexport {\n causedByProperties,\n clauseKeywords,\n codeBlockTags,\n conceptAttributes,\n constructKeywords,\n contextRoots,\n languageId,\n primitiveTypes,\n sliceTypes,\n} from './language';\nexport type { Monaco } from './language';\nexport { getSubLanguage, getSubLanguages, registerSubLanguage } from './sub-language-registry';\nexport type {\n MonarchTokenRules,\n SubLanguage,\n SubLanguageCompletion,\n SubLanguageDefinition,\n} from './sub-language-registry';\nexport { pdl } from './sub-languages/pdl';\nexport { cdl } from './sub-languages/cdl';\nexport { screenplayDarkThemeName } from './themes/screenplay-dark';\nexport { screenplayLightThemeName } from './themes/screenplay-light';\nexport { enclosingChain, fenceMap, firstWord, indentOf, withoutComment } from './document-context';\nexport { exampleCompletions, exampleHover } from './example-authoring';\nexport {\n fileReferenceKeyword,\n fileReferenceOn,\n fileReferences,\n isAbsoluteFileReferencePath,\n} from './file-references';\nexport type { FileReference } from './file-references';\nexport { fileImportOn, fileImports, importablePaths, isFileImportLine } from './file-imports';\nexport type { FileImport } from './file-imports';\nexport type { CompletionOptions } from './completions';\nexport { builtInTriggerNames, knownEventNames, knownTriggerNames, knownTypeNames, mergeSymbols, scanDocument, symbolsForBuffer } from './symbols';\nexport type {\n CommandSymbol,\n ConceptSymbol,\n DocumentSymbols,\n EventSymbol,\n ImportSymbol,\n NamedSymbol,\n PolicySymbol,\n PropertySymbol,\n ReadSymbol,\n QuerySymbol,\n TypeSymbol,\n} from './symbols';\nexport { attributeDocs, contextVariableDocs, keywordDocs, specificationKeywordDocs } from './keyword-docs';\nexport { eventContextMemberAt, eventContextMembers, eventContextMembersAfter, eventContextPaths, namesEventContextMember } from './event-context';\nexport type { EventContextMember, EventContextPath } from './event-context';\nexport { contextVariableEntries, contextVariableItems, producesItems, specificationStepItems } from './completion-items';\nexport type { CompletionEntry } from './completion-items';\nexport { completionEntriesFor, planCompletions } from './completion-planner';\nexport type { CompletionPlan } from './completion-planner';\nexport { responseTokens, responseTokenTypes } from './response-tokens';\nexport { responseCompletions } from './response-completions';\nexport { structureCompletion } from './structure-completions';\nexport { blockHeaderPattern } from './language';\nexport type { StructureCompletion } from './structure-completions';\nexport { analyzeEventSources, eventSourceAvailability, eventSourceCompletions, eventSourceDetails, eventSourceHover, eventSourceIdentifier, eventSourceReferenceAt } from './event-source-authoring';\nexport type { EventSourceAnalysis } from './EventSourceAnalysis';\nexport type { AuthoredEventSource } from './AuthoredEventSource';\nexport type { AuthoredStream } from './AuthoredStream';\nexport type { AuthoredCommandRoute } from './AuthoredCommandRoute';\nexport type { AuthoredSpecificationEvent } from './AuthoredSpecificationEvent';\nexport { analyzeOperations, operationCompletions, operationDetails, operationAvailability, operationHover, operationReferenceAt, phaseState } from './operation-authoring';\nexport type { OperationAnalysis, OperationDeclaration, OperationInput, OperationPhase, OperationReference, SystemDeclaration } from './OperationAnalysis';\nexport { responseAvailability, responseAnalysis } from './response-analysis';\nexport { hoverContent } from './hover-content';\nexport { validateLines } from './validation';\nexport { destinationHints, productionDestinations } from './production-destinations';\nexport type { DestinationHint } from './DestinationHint';\nexport type { ProductionSymbol } from './ProductionSymbol';\nexport type { ValidationContext, ValidationIssue, ValidationSeverity } from './validation';\nexport { createCodeActionProvider } from './code-actions';\nexport { typeReferenceSymbol, typeReferenceText } from './TypeReferenceSymbol';\nexport type { TypeReferenceSymbol } from './TypeReferenceSymbol';\nexport { diagnosticCodes } from './diagnostic-codes';\nexport type { DiagnosticCode } from './diagnostic-codes';\n"],
|
|
5
|
+
"mappings": "w/BAiBA,IAAMA,GAAuB,IAAI,IAAI,CAAC,YAAa,SAAU,cAAe,SAAS,CAAC,EAEhFC,GAA4C,CAC9C,OAAQ,SACR,WAAY,aACZ,MAAO,aACP,KAAM,OACN,IAAK,KACT,EAEA,SAASC,GAAiBC,EAAyB,CAC/C,MAAO,eAAeA,CAAO,EACjC,CAFSC,EAAAF,GAAA,oBAKT,SAASG,GAAoBC,EAAwD,CACjF,IAAMC,EAAe,C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,CAtDgBR,EAAAO,GAAA",
|
|
6
|
+
"names": ["contextualConstructs", "embeddedLanguages", "subLanguageState", "keyword", "__name", "subLanguageExitRule", "subLanguages", "exitKeywords", "constructKeywords", "subLanguage", "commonTokenRules", "createTokensProvider", "tokenizer", "bmpWordCharacters", "codeBlockTags", "tag", "clauseKeywords", "sliceTypes", "primitiveTypes", "responseCompletions", "lines", "line", "before", "symbols", "fences", "fenceMap", "withoutComment", "indent", "indentOf", "chain", "enclosingChain", "enclosing", "nearestEnclosingLine", "namedCommand", "__name", "name", "matches", "command", "entry", "property", "insertText", "typeReferenceText", "propertyTypeReference", "responseAvailability", "scanDocument", "modifier", "word", "concept", "optionalTypeItems", "type", "primitiveTypes", "specification", "responseAnalysis", "properties", "field", "source", "enclosing", "lines", "line", "headers", "enclosingHeaders", "fenceMap", "indentOf", "header", "responseAnalysis", "start", "left", "right", "__name", "caseCompletions", "before", "table", "parameter", "caseHover", "end", "reference", "match", "values", "row", "source", "value", "analyze", "lines", "application", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "exampleCompletions", "line", "before", "fenceMap", "withoutComment", "analysis", "caseCompletions", "exampleHover", "start", "end", "caseHover", "operationAvailability", "analyzeOperations", "lines", "symbols", "responseAnalysis", "source", "__name", "phaseState", "phase", "operationDetails", "operation", "inputs", "input", "typeReferenceText", "name", "value", "hint", "operationCompletions", "line", "before", "fences", "fenceMap", "withoutComment", "indent", "indentOf", "chain", "enclosingChain", "enclosing", "nearestEnclosingLine", "analysis", "operations", "context", "targets", "qualifiers", "target", "part", "index", "event", "ownedOperation", "system", "operationImplementationItems", "operationPhaseItems", "production", "targetLine", "inProductionBody", "mappedOperation", "rhs", "properties", "parts", "property", "types", "type", "concept", "operationItems", "declaration", "reference", "operationReferenceAt", "start", "end", "operationHover", "at", "location", "column", "equals", "command", "text", "header", "systems", "eventSourceAvailability", "specificationRouteAvailability", "routePrefix", "sourceStreamPattern", "keyPrefix", "identifierTypePrefix", "streamTypePrefix", "analyzeEventSources", "lines", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "eventSourceDetails", "stream", "typeReferenceText", "part", "eventSourceReferenceAt", "line", "start", "end", "analysis", "at", "route", "location", "name", "withoutComment", "candidate", "resolution", "sourcePart", "eventSourceIdentifier", "prefix", "eventSourceHover", "reference", "context", "blockLocation", "declaration", "confidence", "mapping", "expression", "typed", "parts", "properties", "optional", "collection", "index", "matches", "property", "types", "type", "indentOf", "streamIdHeader", "owner", "indent", "text", "eventSourceCompletions", "before", "fenceMap", "literal", "primitive", "concept", "concepts", "path", "segment", "fields", "isSourceStreamName", "mapped", "target", "qualified", "matching", "entry", "names", "ownsStream", "partType", "streamId", "isSourceStreamTypeName", "refusalContext", "lines", "lineIndex", "indent", "fences", "fenceMap", "headers", "index", "line", "withoutComment", "indentOf", "branch", "header", "__name", "commandNamedRulePattern", "bmpWordCharacters", "namedRuleContext", "lines", "lineIndex", "indent", "fences", "fenceMap", "owners", "boundary", "index", "line", "withoutComment", "indentOf", "wrapped", "offset", "__name", "dependencyTargetCompletions", "lines", "line", "before", "application", "fenceMap", "withoutComment", "match", "symbols", "symbolsForBuffer", "responseAnalysis", "source", "__name", "exampleUuid", "primitiveExamples", "exampleValueFor", "type", "symbols", "bare", "primitive", "concept", "__name", "lastIndexWhere", "lines", "matches", "index", "__name", "upperCamelWords", "name", "pastTense", "verb", "likelyEventName", "command", "symbols", "subject", "noun", "event", "indentUnit", "indented", "indentOf", "indent", "producesBlock", "unit", "eventName", "declared", "inner", "sources", "property", "mappings", "source", "identifier", "newCommandBlock", "identity", "concept", "identityLine", "properties", "propertyLines", "outcome", "line", "assignments", "exampleValueFor", "sliceCommand", "fences", "headerIndex", "sliceIndex", "authorized", "symbol", "candidate", "specificationBlock", "structureCompletion", "lineIndex", "textBefore", "textAfter", "fenceMap", "previous", "withoutComment", "previousLine", "opensEmptyBlock", "header", "nearestEnclosingLine", "headerIndent", "pad", "wrap", "block", "headerLine", "found", "form", "subLanguages", "listeners", "registerSubLanguage", "keyword", "definition", "listener", "__name", "getSubLanguages", "getSubLanguage", "onSubLanguagesChanged", "RULE_LINE_PATTERN", "declaredIn", "__name", "document", "keyword", "line", "topLevelEntries", "topLevelItems", "item", "isTemplate", "header", "expansionEntry", "text", "indent", "relative", "index", "indentOf", "completionEntriesFor", "chain", "where", "construct", "subLanguage", "getSubLanguage", "purposeItems", "moduleScopeItems", "featureScopeItems", "sliceItemsFor", "conceptItems", "typeItems", "commandItems", "eventItems", "readModelItems", "reducerItems", "formItems", "contributeItems", "behaviorItems", "personaItems", "identityItems", "authenticationItems", "seedItems", "themeItems", "uiProfileItems", "outcomeItems", "layoutItems", "operationItems", "operationPhaseItems", "producesItems", "handlerItems", "implementationItems", "operationImplementationItems", "queryItems", "performerItems", "constraintItems", "reactionItems", "invocationItems", "triggerItems", "reactionTriggerItems", "specificationItems", "policyItems", "validateItems", "actionItems", "tableItems", "templateItems", "screenItems", "candidate", "planCompletions", "lines", "lineIndex", "textBefore", "symbols", "scanDocument", "fences", "fenceMap", "withoutComment", "marker", "inConcept", "enclosingChain", "scope", "category", "responseEntries", "exampleCompletions", "responseCompletions", "dependencyEntries", "dependencyTargetCompletions", "importPath", "refusal", "refusalContext", "member", "contextVariableMatch", "currentLine", "effectiveIndent", "parentIndent", "guarded", "parent", "guardedActionItems", "nearestEnclosingLine", "actionArgumentItems", "interactionChoiceItems", "interactionActionItems", "refusalItems", "ruleContext", "namedRuleContext", "namedRuleImplementationItems", "commandRuleItems", "propertyOwner", "propertyName", "reservedProperty", "optionalPrefix", "match", "afterPropertyType", "afterQueryType", "subjectModifier", "subjectConcept", "concept", "subjectType", "subjectTarget", "attribute", "afterSubjectType", "modifierEntries", "optionalTypeItems", "step", "specificationStepItems", "enclosingLine", "inlineEventItems", "ruleItems", "headers", "enclosingHeaders", "entries", "expansion", "structureCompletion", "createCompletionProvider", "monaco", "options", "model", "position", "lines", "lineIndex", "textBefore", "application", "symbols", "symbolsForBuffer", "responseEntries", "exampleCompletions", "eventSourceCompletions", "operationCompletions", "responseCompletions", "plan", "planCompletions", "word", "range", "kinds", "asSnippet", "snippet", "__name", "entry", "symbolItem", "name", "kind", "detail", "eventNames", "inlineNames", "event", "knownEventNames", "pathRange", "path", "variableRange", "contextVariableEntries", "policy", "knownTriggerNames", "command", "producesItems", "screen", "query", "typeReferenceText", "typeReferenceSymbol", "concept", "type", "primitiveTypes", "primitive", "createInlineCompletionProvider", "options", "model", "position", "lines", "lineIndex", "line", "symbols", "symbolsForBuffer", "suggestion", "structureCompletion", "__name", "responseTokenTypes", "responseTokens", "lines", "symbols", "tokens", "add", "__name", "line", "column", "length", "type", "source", "start", "path", "analysis", "responseAnalysis", "stream", "header", "part", "route", "command", "property", "withoutComment", "response", "field", "specification", "event", "fixture", "system", "operation", "keyword", "input", "phase", "name", "hint", "ordered", "left", "right", "token", "index", "reactionReferenceAt", "lines", "lineIndex", "startColumn", "endColumn", "application", "fences", "fenceMap", "line", "withoutComment", "match", "enclosingChain", "indentOf", "name", "column", "current", "scanned", "document", "scanDocument", "events", "named", "event", "generation", "selected", "__name", "matches", "declaration", "body", "directBody", "content", "prefix", "known", "property", "typeReferenceText", "propertyTypeReference", "imports", "imported", "triggers", "trigger", "handlerIntentDocs", "keywordDocs", "specificationKeywordDocs", "attributeDocs", "contextVariableDocs", "eventContextPaths", "path", "specialCategoryDocs", "hoverContent", "lines", "lineIndex", "word", "startColumn", "endColumn", "application", "fences", "fenceMap", "line", "withoutComment", "inString", "inTemplate", "index", "reaction", "reactionReferenceAt", "fixtureHover", "exampleHover", "sourceHover", "eventSourceHover", "operation", "operationHover", "tokenAt", "__name", "column", "name", "start", "before", "enclosingChain", "indentOf", "complianceHeader", "complianceBody", "doc", "attributeDocs", "specialCategoryDocs", "variable", "branch", "refusalContext", "member", "descriptions", "detail", "symbolsForBuffer", "contextVariableDocs", "prefix", "followsPropertyType", "followsQueryType", "source", "eventAnalysisSource", "subjectPrefix", "ownerChain", "enclosingHeaders", "keywordDocs", "chain", "ruleContext", "namedRuleContext", "handlerIntentDocs", "symbols", "scanDocument", "owner", "command", "property", "typeReferenceText", "propertyTypeReference", "responseAvailability", "response", "field", "type", "specification", "responseAnalysis", "value", "concept", "candidate", "attributes", "values", "reasons", "attribute", "reason", "properties", "policy", "body", "event", "left", "right", "construct", "getSubLanguage", "step", "specificationKeywordDocs", "inEvent", "directBody", "directive", "keywordDoc", "createHoverProvider", "options", "model", "position", "word", "content", "hoverContent", "__name", "createInlayHintsProvider", "options", "model", "range", "destinationHints", "hint", "__name", "migrateOptional", "migrateCompliance", "migrationKind", "__name", "code", "DiagnosticCodes", "containsKind", "requested", "kind", "intersects", "left", "right", "createCodeActionProvider", "placement", "cache", "model", "range", "context", "token", "migrationRequested", "migrationOnly", "diagnostics", "marker", "isQuickFixDiagnostic", "version", "placementKey", "analysis", "prepareQuickFixes", "fixes", "diagnostic", "fix", "edit", "start", "end", "owner", "validationDelay", "validate", "monaco", "model", "options", "lines", "application", "symbolsForBuffer", "validateLines", "issue", "__name", "watch", "handle", "run", "languageId", "schedule", "contextChange", "attachDiagnostics", "pdl", "cdl", "screenplayDarkThemeName", "screenplayDark", "screenplayLightThemeName", "screenplayLight", "registeredInstances", "applyTokensProvider", "monaco", "languageId", "createTokensProvider", "getSubLanguages", "__name", "onSubLanguagesChanged", "ensureBuiltInSubLanguages", "getSubLanguage", "registerSubLanguage", "pdl", "cdl", "register", "options", "languageExtensionPoint", "languageConfiguration", "createCompletionProvider", "createInlineCompletionProvider", "createHoverProvider", "model", "position", "word", "symbols", "reference", "eventSourceReferenceAt", "reaction", "reactionReferenceAt", "target", "current", "source", "document", "location", "eventSourceIdentifier", "targetUri", "targetModels", "candidate", "targetModel", "responseTokenTypes", "data", "previousLine", "previousColumn", "token", "responseTokens", "createInlayHintsProvider", "createCodeActionProvider", "screenplayDarkThemeName", "screenplayDark", "screenplayLightThemeName", "screenplayLight", "attachDiagnostics"]
|
|
7
7
|
}
|