@cratis/screenplay-language 5.4.0 → 5.5.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"completion-planner.js","names":["scope.sampleRowItems","scope.sampleShapeItems","items.moduleItems","items.featureItems","items.sliceItemsFor","items.typeItems","items.commandItems","items.eventItems","scope.readModelItems","scope.reducerItems","scope.formItems","scope.contributeItems","scope.behaviorItems","scope.personaItems","items.applicationContextItems","scope.profileIdentityItems","items.identityItems","scope.authenticationItems","scope.onboardingItems","scope.inviteMemberItems","scope.legalTermsItems","scope.emailItems","scope.seedItems","scope.themeItems","scope.uiProfileItems","scope.profileRootTemplateItems","scope.profileAppearanceItems","scope.profileSampleDataItems","scope.sampleDataItems","scope.outcomeItems","scope.layoutItems","scope.navigationItems","scope.toolbarItems","items.stateMachineItems","items.stateItems","items.workflowItems","items.operationItems","items.operationPhaseItems","items.producesItems","items.handlerItems","items.implementationItems","items.operationImplementationItems","items.queryItems","items.performerItems","items.constraintItems","items.reactionItems","items.invocationItems","items.triggerItems","items.reactionTriggerItems","items.specificationItems","items.policyItems","items.validateItems","items.actionItems","items.tableItems","scope.templateItems","items.screenItems","items.actionSubjectValueItems","items.actionSubjectItems","items.guardedActionItems","items.actionArgumentItems","items.interactionChoiceItems","items.interactionActionItems","items.refusalItems","items.namedRuleImplementationItems","items.commandRuleItems","items.optionalTypeItems","items.specificationStepItems","items.inlineEventItems","items.ruleItems","productionRouteItem","RULE_LINE_PATTERN","document","keyword","line","singularDeclarations","topLevelItems","item","header","relative","text","index","indent","indentOf","construct","chain","where","sampleRowItems","sampleShapeItems","subLanguage","getSubLanguage","purposeItems","moduleScopeItems","featureScopeItems","sliceItemsFor","conceptItems","typeItems","commandItems","eventItems","readModelItems","reducerItems","formItems","contributeItems","behaviorItems","personaItems","applicationContextItems","profileIdentityItems","identityItems","authenticationItems","onboardingItems","inviteMemberItems","legalTermsItems","emailItems","seedItems","themeItems","uiProfileItems","profileRootTemplateItems","profileAppearanceItems","profileSampleDataItems","sampleDataItems","outcomeItems","layoutItems","navigationItems","toolbarItems","stateMachineItems","stateItems","workflowItems","operationItems","operationPhaseItems","producesItems","handlerItems","implementationItems","operationImplementationItems","queryItems","performerItems","constraintItems","reactionItems","invocationItems","triggerItems","reactionTriggerItems","specificationItems","policyItems","validateItems","actionItems","tableItems","templateItems","screenItems","candidate","scanDocument","lines","fences","fenceMap","lineIndex","withoutComment","textBefore","marker","generationChain","enclosingChain","inConcept","nearestEnclosingLine","generationEntries","generationCompletions","scope","category","continuationEntries","continuationResponseCompletions","symbols","responseEntries","exampleCompletions","responseCompletions","readEntries","commandReadCompletions","keyEntries","readModelKeyCompletions","dependencyEntries","dependencyTargetCompletions","importPath","refusal","refusalContext","member","contextVariableMatch","currentLine","effectiveIndent","subjectHeader","suffix","actionSubjectValueItems","actionSubjectItems","parentIndent","guarded","parent","guardedActionItems","actionArgumentItems","interactionChoiceItems","interactionActionItems","refusalItems","ruleContext","namedRuleContext","namedRuleImplementationItems","commandRuleItems","propertyOwner","propertyName","reservedProperty","match","afterPropertyType","afterQueryType","subjectModifier","subjectConcept","concept","subjectType","subjectTarget","attribute","afterSubjectType","keyModifier","modifierEntries","optionalTypeItems","step","specificationStepItems","enclosingLine","inlineEventItems","ruleItems","headers","enclosingHeaders","entries","expansion","structureCompletion"],"sources":["../../completion-planner.ts"],"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 { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { generationCompletions } from './generation-completions';\nimport { namedRuleContext } from './named-rule-context';\nimport { continuationResponseCompletions } from './continuation-responses';\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';\nimport { readModelKeyCompletions } from './read-model-key-completions';\nimport { commandReadCompletions } from './command-read-completions';\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 productionRouteItem = { label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: 'Replace the whole command route for this event production. ESM v10.' };\n\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 const singularDeclarations = ['domain', 'authentication', 'onboarding', 'identity', 'context'];\n return items.topLevelItems.filter(item => !singularDeclarations.includes(item.label) || !declaredIn(document, item.label));\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 if (chain.includes('sample') && !chain.includes('ui')) {\n if (construct === 'row') return scope.sampleRowItems;\n if (chain[1] === 'row' && /^[A-Za-z_]\\w*$/.test(where.headers[0] ?? construct)) return scope.sampleShapeItems;\n }\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 /:\\s*Enum\\b/.test(header ?? '') ? [...items.conceptItems.filter(item => item.label !== 'validate checksum'), { label: 'enum member (numbered)', insertText: '${1:value} = ${2:0}', documentation: 'Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.' }] : items.conceptItems.filter(item => item.label !== 'validate checksum' || /:\\s*String\\b/.test(header ?? ''));\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 'context':\n return items.applicationContextItems;\n case 'identity':\n return chain.includes('ui') ? scope.profileIdentityItems : items.identityItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'onboarding':\n return scope.onboardingItems;\n case 'invite':\n return scope.inviteMemberItems;\n case 'legal':\n return scope.legalTermsItems;\n case 'emails':\n return scope.emailItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'root':\n return chain.includes('ui') ? scope.profileRootTemplateItems : [];\n case 'appearance':\n return chain.includes('ui') ? scope.profileAppearanceItems : [];\n case 'sample':\n return chain.includes('ui') ? scope.profileSampleDataItems : scope.sampleDataItems;\n case 'shape':\n return chain[1] === 'sample' ? scope.sampleShapeItems : [];\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 'navigation':\n return scope.navigationItems;\n case 'toolbar':\n return scope.toolbarItems;\n case 'statemachine':\n return items.stateMachineItems;\n case 'state':\n return items.stateItems;\n case 'workflow':\n return items.workflowItems;\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 chain.includes('command') ? [...items.producesItems, productionRouteItem] : 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 'reads':\n return [{ label: 'by parts', insertText: 'by\\n ${1:part} = ${2:source}\\n ${3:part} = ${4:source}', documentation: 'Supply every composite read-model key part by name.' }];\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 chain.includes('concept') && /:\\s*String\\b/.test(where.headers.find(header => /^concept\\s/.test(header)) ?? '')\n ? [...items.validateItems, { label: 'checksum', insertText: 'checksum ${1|luhn,mod11,mod97|}', documentation: 'Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.' }]\n : 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 chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency — 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 generationChain = enclosingChain(lines, fences, lineIndex, indentOf(textBefore));\n const inConcept = generationChain[0] === 'concept';\n if (generationChain[0] === 'generate' && generationChain[1] === 'concept' && /^generate\\s+rule\\s+/.test((nearestEnclosingLine(lines, fences, lineIndex, indentOf(textBefore)) ?? '').trim())) {\n return { kind: 'entries', entries: [\n { label: 'file', insertText: 'file ${1:Generator.cs}', documentation: 'The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.' },\n { label: 'csharp', insertText: '```csharp\\n${1:return value;}\\n```', documentation: 'The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.' },\n ] };\n }\n const generationEntries = inConcept || (generationChain[0] === 'validate' && generationChain[1] === 'concept') ? generationCompletions(lines, lineIndex, textBefore) : null;\n if (generationEntries !== null) return { kind: 'entries', entries: generationEntries };\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 continuationEntries = continuationResponseCompletions(lines, lineIndex, textBefore, symbols);\n if (continuationEntries !== null) return { kind: 'entries', entries: continuationEntries };\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const readEntries = commandReadCompletions(lines, lineIndex, textBefore, symbols);\n if (readEntries !== null) return { kind: 'entries', entries: readEntries };\n const keyEntries = readModelKeyCompletions(lines, lineIndex, textBefore, symbols);\n if (keyEntries !== null) return { kind: 'entries', entries: keyEntries };\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 in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.' })) };\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 const subjectHeader = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+/;\n if (subjectHeader.test(textBefore)) {\n const suffix = textBefore.replace(subjectHeader, '');\n if (/^for\\s+\\w*$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectValueItems };\n if (/^(?:f|fo|for)?$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectItems };\n }\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|change)\\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 keyModifier = chain[0] === 'readmodel' ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+(\\w*)$/) : null;\n const modifierEntries = [\n ...(keyModifier && 'key'.startsWith(keyModifier[1]) ? [{ label: 'key', insertText: 'key', documentation: 'Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.' }] : []),\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: chain.includes('command') ? [...items.inlineEventItems, productionRouteItem] : 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"],"mappings":"A,mkFA0BA,MAAMqE,EAAsB,CAAE,MAAO,SAAU,WAAY,4BAA6B,cAAe,qEAAsE,EAEvKC,GAAoB,mGAwBpB,YAAc,EAA6B,IAAoBC,EAAS,KAAK,GAAY,OAAO,IAAIC,EAAQ,IAAI,CAAC,CAAC,KAAKC,CAAI,CAAC,EAElI,SAAS,gBAAgB,EAAgD,CACrE,IAAMC,EAAuB,CAAC,SAAU,iBAAkB,aAAc,WAAY,SAAS,EAC7F,OAAAC,EAA2B,OAAO,GAAQ,CAACD,EAAqB,SAASE,EAAK,KAAK,GAAK,CAAC,WAAWL,EAAUK,EAAK,KAAK,CAAC,CAC7H,CAEA,MAAM,WAAc,GAA+B,kCAAkC,KAAKC,GAAU,EAAE,EAItG,SAAS,eAAe,EAAc,EAAiC,CACnE,IAAMC,EAAWC,EAAK,MAAM;CAAI,CAAC,CAAC,KAAK,EAAM,IAAWC,IAAU,EAAIP,EAAOA,EAAK,MAAM,KAAK,IAAIQ,EAAQC,EAAST,CAAI,CAAC,CAAC,CAAE,CAAC,CAAC,KAAK;CAAI,EAErI,MAAO,CAAE,MADKM,EAAK,MAAM;CAAI,CAA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pL,CAAqB,EAC5H,GAAIoL,GAAiB,sBAAsB,KAAKA,CAAa,EAEzD,MADI,+BAA+B,KAAK/D,CAAU,EAAU,CAAE,KAAM,OAAQ,EACrE,CAAE,KAAM,UAAW,QAASrE,EAAM,SAAS,SAAS,EAAI,CAAC,GAAGjB,EAAwBE,CAAmB,EAAIF,CAAuB,EAE7I,GAAIqJ,GAAiBlJ,GAAkB,KAAKkJ,CAAa,EACrD,MAAO,CAAE,KAAM,UAAW,QAASpJ,EAAgB,EAGvD,IAAMuJ,EAAUC,EAAiBxE,EAAOC,EAAQE,EAAW8B,CAAe,EAC1E,GAAIjG,EAAM,KAAO,OAASA,EAAM,SAAS,MAAM,EAAG,MAAO,CAAE,KAAM,QAAS,EAC1E,IAAMyI,EAAU,qBAAqBzI,EAAO,CAAE,UAAS,SAAUgE,CAAM,CAAC,EAClE0E,EAAY1I,EAAM,KAAO,UAAY2I,GAAoB3E,EAAOG,EAAW,IAAI,OAAO8B,CAAe,EAAG,GAAIhB,CAAO,EAAI,KAC7H,MAAO,CAAE,KAAM,UAAW,QAASyD,EAAY,CAAC,eAAeA,EAAU,KAAMzC,CAAe,EAAG,GAAGwC,CAAO,EAAIA,CAAQ,CAC3H,C"}
1
+ {"version":3,"file":"completion-planner.js","names":["scope.sampleRowItems","scope.sampleShapeItems","items.moduleItems","items.featureItems","items.sliceItemsFor","items.typeItems","items.commandItems","items.eventItems","scope.readModelItems","scope.reducerItems","scope.formItems","scope.contributeItems","scope.behaviorItems","scope.personaItems","items.applicationContextItems","scope.profileIdentityItems","items.identityItems","scope.authenticationItems","scope.onboardingItems","scope.inviteMemberItems","scope.legalTermsItems","scope.emailItems","scope.seedItems","scope.themeItems","scope.uiProfileItems","scope.profileRootTemplateItems","scope.profileAppearanceItems","scope.profileSampleDataItems","scope.sampleDataItems","scope.outcomeItems","scope.layoutItems","scope.navigationItems","scope.toolbarItems","items.stateMachineItems","items.stateItems","items.workflowItems","items.operationItems","items.operationPhaseItems","items.producesItems","items.handlerItems","items.implementationItems","items.operationImplementationItems","items.queryItems","items.performerItems","items.constraintItems","items.reactionItems","items.invocationItems","items.triggerItems","items.reactionTriggerItems","items.specificationItems","items.policyItems","items.validateItems","items.actionItems","items.tableItems","scope.templateItems","items.screenItems","items.calendarContextEntries","items.clockOperandItems","items.actionSubjectValueItems","items.actionSubjectItems","items.guardedActionItems","items.actionArgumentItems","items.interactionChoiceItems","items.interactionActionItems","items.refusalItems","items.namedRuleImplementationItems","items.commandRuleItems","items.optionalTypeItems","items.specificationStepItems","items.inlineEventItems","items.ruleItems","productionRouteItem","RULE_LINE_PATTERN","document","keyword","line","singularDeclarations","topLevelItems","item","header","relative","text","index","indent","indentOf","construct","chain","where","sampleRowItems","sampleShapeItems","subLanguage","getSubLanguage","purposeItems","moduleScopeItems","featureScopeItems","sliceItemsFor","conceptItems","typeItems","commandItems","eventItems","readModelItems","reducerItems","formItems","contributeItems","behaviorItems","personaItems","applicationContextItems","profileIdentityItems","identityItems","authenticationItems","onboardingItems","inviteMemberItems","legalTermsItems","emailItems","seedItems","themeItems","uiProfileItems","profileRootTemplateItems","profileAppearanceItems","profileSampleDataItems","sampleDataItems","outcomeItems","layoutItems","navigationItems","toolbarItems","stateMachineItems","stateItems","workflowItems","operationItems","operationPhaseItems","producesItems","handlerItems","implementationItems","operationImplementationItems","queryItems","performerItems","constraintItems","reactionItems","invocationItems","triggerItems","reactionTriggerItems","specificationItems","policyItems","validateItems","actionItems","tableItems","templateItems","screenItems","candidate","scanDocument","lines","fences","fenceMap","lineIndex","withoutComment","textBefore","marker","generationChain","enclosingChain","inConcept","nearestEnclosingLine","generationEntries","generationCompletions","scope","category","continuationEntries","continuationResponseCompletions","symbols","responseEntries","exampleCompletions","responseCompletions","readEntries","commandReadCompletions","keyEntries","readModelKeyCompletions","dependencyEntries","dependencyTargetCompletions","importPath","refusal","refusalContext","member","clockChain","prefix","calendarContextEntries","clockOperandItems","contextVariableMatch","currentLine","effectiveIndent","subjectHeader","suffix","actionSubjectValueItems","actionSubjectItems","parentIndent","guarded","parent","guardedActionItems","actionArgumentItems","interactionChoiceItems","interactionActionItems","refusalItems","ruleContext","namedRuleContext","namedRuleImplementationItems","commandRuleItems","propertyOwner","propertyName","reservedProperty","match","afterPropertyType","afterQueryType","subjectModifier","subjectConcept","concept","subjectType","subjectTarget","attribute","afterSubjectType","keyModifier","modifierEntries","optionalTypeItems","step","specificationStepItems","enclosingLine","inlineEventItems","ruleItems","headers","enclosingHeaders","entries","expansion","structureCompletion"],"sources":["../../completion-planner.ts"],"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 { enclosingChain, enclosingHeaders, fenceMap, indentOf, nearestEnclosingLine, withoutComment } from './document-context';\nimport { refusalContext } from './refusal-context';\nimport { generationCompletions } from './generation-completions';\nimport { namedRuleContext } from './named-rule-context';\nimport { continuationResponseCompletions } from './continuation-responses';\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';\nimport { readModelKeyCompletions } from './read-model-key-completions';\nimport { commandReadCompletions } from './command-read-completions';\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 productionRouteItem = { label: 'stream', insertText: 'stream ${1:Source.Stream}', documentation: 'Replace the whole command route for this event production. ESM v10.' };\n\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 const singularDeclarations = ['domain', 'authentication', 'onboarding', 'identity', 'context'];\n return items.topLevelItems.filter(item => !singularDeclarations.includes(item.label) || !declaredIn(document, item.label));\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 if (chain.includes('sample') && !chain.includes('ui')) {\n if (construct === 'row') return scope.sampleRowItems;\n if (chain[1] === 'row' && /^[A-Za-z_]\\w*$/.test(where.headers[0] ?? construct)) return scope.sampleShapeItems;\n }\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 /:\\s*Enum\\b/.test(header ?? '') ? [...items.conceptItems.filter(item => item.label !== 'validate checksum'), { label: 'enum member (numbered)', insertText: '${1:value} = ${2:0}', documentation: 'Every member must declare a unique int32 number. Keep published numbers unchanged; specifications name members, not numbers.' }] : items.conceptItems.filter(item => item.label !== 'validate checksum' || /:\\s*String\\b/.test(header ?? ''));\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 'context':\n return items.applicationContextItems;\n case 'identity':\n return chain.includes('ui') ? scope.profileIdentityItems : items.identityItems;\n case 'authentication':\n return scope.authenticationItems;\n case 'onboarding':\n return scope.onboardingItems;\n case 'invite':\n return scope.inviteMemberItems;\n case 'legal':\n return scope.legalTermsItems;\n case 'emails':\n return scope.emailItems;\n case 'seed':\n return scope.seedItems;\n case 'theme':\n return scope.themeItems;\n case 'ui':\n return scope.uiProfileItems;\n case 'root':\n return chain.includes('ui') ? scope.profileRootTemplateItems : [];\n case 'appearance':\n return chain.includes('ui') ? scope.profileAppearanceItems : [];\n case 'sample':\n return chain.includes('ui') ? scope.profileSampleDataItems : scope.sampleDataItems;\n case 'shape':\n return chain[1] === 'sample' ? scope.sampleShapeItems : [];\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 'navigation':\n return scope.navigationItems;\n case 'toolbar':\n return scope.toolbarItems;\n case 'statemachine':\n return items.stateMachineItems;\n case 'state':\n return items.stateItems;\n case 'workflow':\n return items.workflowItems;\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 chain.includes('command') ? [...items.producesItems, productionRouteItem] : 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 'reads':\n return [{ label: 'by parts', insertText: 'by\\n ${1:part} = ${2:source}\\n ${3:part} = ${4:source}', documentation: 'Supply every composite read-model key part by name.' }];\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 chain.includes('concept') && /:\\s*String\\b/.test(where.headers.find(header => /^concept\\s/.test(header)) ?? '')\n ? [...items.validateItems, { label: 'checksum', insertText: 'checksum ${1|luhn,mod11,mod97|}', documentation: 'Exact trailing check digits over preceding ASCII digits. String concepts only; also validates inputs and stored values.' }]\n : 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 chain.includes('command') ? [...items.producesItems, productionRouteItem] : items.producesItems;\n return [];\n }\n}\n\n// Decides what to complete at a position, without any editor dependency — 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 generationChain = enclosingChain(lines, fences, lineIndex, indentOf(textBefore));\n const inConcept = generationChain[0] === 'concept';\n if (generationChain[0] === 'generate' && generationChain[1] === 'concept' && /^generate\\s+rule\\s+/.test((nearestEnclosingLine(lines, fences, lineIndex, indentOf(textBefore)) ?? '').trim())) {\n return { kind: 'entries', entries: [\n { label: 'file', insertText: 'file ${1:Generator.cs}', documentation: 'The sole ValueGeneration source. Receives the provider-bound GenerationContext (Now, Tenant); returns String.' },\n { label: 'csharp', insertText: '```csharp\\n${1:return value;}\\n```', documentation: 'The sole ValueGeneration body. Reference execution requires fixtures; it never invokes this code.' },\n ] };\n }\n const generationEntries = inConcept || (generationChain[0] === 'validate' && generationChain[1] === 'concept') ? generationCompletions(lines, lineIndex, textBefore) : null;\n if (generationEntries !== null) return { kind: 'entries', entries: generationEntries };\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 continuationEntries = continuationResponseCompletions(lines, lineIndex, textBefore, symbols);\n if (continuationEntries !== null) return { kind: 'entries', entries: continuationEntries };\n const responseEntries = exampleCompletions(lines, lineIndex, textBefore) ?? responseCompletions(lines, lineIndex, textBefore, scanDocument(lines));\n if (responseEntries !== null) return { kind: 'entries', entries: responseEntries };\n const readEntries = commandReadCompletions(lines, lineIndex, textBefore, symbols);\n if (readEntries !== null) return { kind: 'entries', entries: readEntries };\n const keyEntries = readModelKeyCompletions(lines, lineIndex, textBefore, symbols);\n if (keyEntries !== null) return { kind: 'entries', entries: keyEntries };\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 in branch event mappings; executable from ESM v19. Constraint is available only in a by constraint branch.' })) };\n }\n const clockChain = enclosingChain(lines, fences, lineIndex, indentOf(lines[lineIndex] ?? textBefore));\n if (clockChain[0] === 'command' && /^\\s*calendar\\s+from\\s+(?:\\$[\\w.]*)?$/.test(textBefore)) {\n const prefix = textBefore.match(/\\$[\\w.]*$/)?.[0];\n return { kind: 'entries', entries: items.calendarContextEntries(lines, prefix) };\n }\n if (clockChain.includes('command') && (clockChain[0] === 'validate' || (clockChain[0] === 'command' && /^\\s*produces\\s+when\\b/.test(textBefore))) &&\n /^\\s*(?:require\\s+|produces\\s+when\\s+)?[a-z_]\\w*(?:\\.\\w+)*\\s*(?:==|!=|>=|<=|>|<)\\s+(?:[a-z ]*)$/.test(textBefore)) {\n const afterDateOf = /\\bdate\\s+of\\s+\\w*$/.test(textBefore);\n return { kind: 'entries', entries: afterDateOf ? items.clockOperandItems.filter(item => ['today', 'now'].includes(item.label)) : items.clockOperandItems };\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 const subjectHeader = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+/;\n if (subjectHeader.test(textBefore)) {\n const suffix = textBefore.replace(subjectHeader, '');\n if (/^for\\s+\\w*$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectValueItems };\n if (/^(?:f|fo|for)?$/.test(suffix)) return { kind: 'entries', entries: items.actionSubjectItems };\n }\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|change)\\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 keyModifier = chain[0] === 'readmodel' ? textBefore.match(/^\\s*@?[a-z_]\\w*\\s+[\\w.]+\\s+(\\w*)$/) : null;\n const modifierEntries = [\n ...(keyModifier && 'key'.startsWith(keyModifier[1]) ? [{ label: 'key', insertText: 'key', documentation: 'Declares a required scalar read-model key part. Explicit keys replace inference. Supply every part by name when looking up one instance.' }] : []),\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: chain.includes('command') ? [...items.inlineEventItems, productionRouteItem] : 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"],"mappings":"A,wnFA0BA,MAAMuE,EAAsB,CAAE,MAAO,SAAU,WAAY,4BAA6B,cAAe,qEAAsE,EAEvKC,GAAoB,mGAwBpB,YAAc,EAA6B,IAAoBC,EAAS,KAAK,GAAY,OAAO,IAAIC,EAAQ,IAAI,CAAC,CAAC,KAAKC,CAAI,CAAC,EAElI,SAAS,gBAAgB,EAAgD,CACrE,IAAMC,EAAuB,CAAC,SAAU,iBAAkB,aAAc,WAAY,SAAS,EAC7F,OAAAC,EAA2B,OAAO,GAAQ,CAACD,EAAqB,SAASE,EAAK,KAAK,GAAK,CAAC,WAAWL,EAAUK,EAAK,KAAK,CAAC,CAC7H,CAEA,MAAM,WAAc,GAA+B,kCAAkC,KAAKC,GAAU,EAAE,EAItG,SAAS,eAAe,EAAc,EAAiC,CACnE,IAAMC,EAAWC,EAAK,MAAM;CAAI,CAAC,CAAC,KAAK,EAAM,IAAWC,IAAU,EAAIP,EAAOA,EAAK,MAAM,KAAK,IAAIQ,EAAQC,EAAST,CAAI,CAAC,CAAC,CAAE,CAAC,CAAC,KAAK;CAAI,EAErI,MAAO,CAAE,MADKM,EAAK,MAA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W,QAAS6D,EAAY,CAAC,eAAeA,EAAU,KAAMzC,CAAe,EAAG,GAAGwC,CAAO,EAAIA,CAAQ,CAC3H,C"}
@@ -1,6 +1,6 @@
1
- import"./_virtual/_virtual/_rolldown/runtime.js";import{actionSubjectHover as e}from"./action-subject-authoring.js";import{continuationResponseHover as t}from"./continuation-responses.js";import{reactionReferenceAt as n}from"./reaction-authoring.js";import{refusalContext as ee}from"./refusal-context.js";import{namedRuleContext as r}from"./named-rule-context.js";import{eventSourceHover as i}from"./event-source-authoring.js";import{exampleHover as te}from"./example-authoring.js";import{operationHover as a}from"./operation-authoring.js";import{directBody as ne,propertyTypeReference as o,scanDocument as s,symbolsForBuffer as c}from"./symbols.js";import{responseAnalysis as l,responseAvailability as u}from"./response-analysis.js";import{enclosingChain as d,enclosingHeaders as re,fenceMap as f,indentOf as p,withoutComment as m}from"./document-context.js";import{typeReferenceText as h}from"./TypeReferenceSymbol.js";import{eventAnalysisSource as g}from"./event-analysis-source.js";import{getSubLanguage as ie}from"./sub-language-registry.js";import{attributeDocs as ae,contextVariableDocs as _,handlerIntentDocs as v,keywordDocs as y,specialCategoryDocs as b,specificationKeywordDocs as x}from"./keyword-docs.js";function hoverContent(S,C,w,T,E,D){let O=f(S);if(O[C])return null;let k=S[C]??``;if(E-1>m(k).length)return null;let A=!1,j=!1;for(let e=0;e<T-1;e++)k[e]===`\\`&&A?e++:k[e]===`"`&&!j?A=!A:k[e]==="`"&&!A&&(j=!j);if(A||j)return null;let M=e(k,w,T);if(M)return M;let N=t(S,C,w,T,E,D);if(N)return N;let P=n(S,C,T,E,D);if(P)return P.content;let F=te(S,C,T,E,D);if(F)return F;let I=i(S,C,T,E,D);if(I)return I;let L=a(S,C,T,E,D);if(L)return L;let tokenAt=(e,t)=>{let n=e+ +(k[e-1]===`@`);return w===t&&T===n&&E===n+t.length&&k.slice(n-1,E-1)===t},R=k.charAt(T-2);if(w===`authorization`&&d(S,O,C,p(k))[0]===`purpose`)return`A quoted authorization in law for criminal-offence data (Art. 10).`;if(d(S,O,C,p(k))[0]===`concept`&&/^\s*generate\b/.test(k)){let e={generate:`The concept declares how; a command property declares generated. ESM v15 checks fixture shape and guards generated event sources against existing facts.`,uuid:`Random UUID v4, 122 random bits; about 3.27 × 10^17 values at 1% collision probability.`,uuidv7:`Time-ordered UUID v7, 74 random bits; about 1.95 × 10^10 values at 1% collision probability. Exposes time; not monotonic within a millisecond.`,ulid:`26 Crockford base32 characters (uppercase by default), 80 random bits; about 1.56 × 10^11 values at 1% collision probability.`,typeid:`TypeID 0.3: lowercase UUIDv7 base32 with a 0..63-character prefix. 74 random bits; empty prefix has no separator.`,nanoid:`Default 21 characters over 64 symbols: 126 random bits. Custom entropy = size × log2(alphabet size).`,bytes:`8 × count random bits; base64url, hex or base32 without padding. RFC 4648 unused trailing bits must be zero.`,prefix:`Printable ASCII prefix, at most 32 characters. UUID prefixes require a String concept; TypeID uses its own argument.`,alphabet:`NanoID only: 2..256 distinct printable ASCII characters.`,case:`lower or upper for String UUIDs, ULID, hex/base32 bytes. Never base64url, NanoID or TypeID.`,pattern:`ESM v21 finite ASCII pattern: # digits, ? uppercase letters, * uppercase letters and digits, classes, repeats 1..64 and UTC yyyy/yy/MM/dd segments. Final value including checksum is at most 256 characters. Counts distinct strings, not repeat decompositions; dates and check digits add no entropy.`,random:`ESM v21 inclusive signed Int64 range for an Int value. Fixtures must be integral numbers within the exact bounds. Int cannot be a generated identifier.`,rule:`ESM v21 ValueGeneration requirement with exactly one direct file or tagged fence. Returns String; the closed GenerationContext descriptor (Now, Tenant) is bound by each provider to its own type; Cratis C# binds the Fundamentals GenerationContext. Entropy is unknown. The reference runner uses a fixture and never executes the body.`,checksum:`Appends luhn/mod11/mod97 check digits, adding no entropy. mod11 excludes check digit 10. Generated fixtures check only suffix digit shape unless validate checksum is authored.`,sequence:`Reserved; binding refuses it until #619 is admitted.`};if(e[w])return e[w]}let z=/^\s*concept\s+[^\s:]+\s*:\s*\w+\s+/.exec(k),oe=d(S,O,C,p(k))[0]===`concept`&&/^\s*(?:@?pii|personal|@?sensitive|secret)\s+(?:reason|scope|special|criminal)\b/.test(k);if(z!==null&&T-1>=z[0].length-1||oe){let e=ae[w];if(e)return e;if(Object.hasOwn(b,w)&&/^\s*(?:@?pii|personal)\s+special\s+/.test(k))return`**${w}** — ${b[w]}`;if(w===`special`)return`GDPR Art. 9(1) special category; requires pii. At most one category per concept.`;if(w===`criminal`)return`Personal data relating to criminal convictions and offenses (GDPR Art. 10); requires pii.`;if(/^\s*(?:secret|sensitive|@sensitive)\s+scope\s+/.test(k)&&[`subject`,`namespace`,`global`].includes(w))return`**${w}** — Secret encryption scope${w===`subject`?` per data subject`:w===`namespace`?` per tenant namespace`:` shared globally`}. Not an event-property subject role.`;if(w===`scope`)return`Secret encryption scope: subject, namespace or global. Omitted scope keeps Chronicle’s Subject default; pii secret renders only [PII].`}if(R===`$`||R===`.`){let e=k.substring(0,E-1).match(/\$[\w.]*$/)?.[0];if(e){if(e.startsWith(`$refusal`)){let t=ee(S,C,p(k)),n=e.substring(9),r={reason:`Refusal kind as a String: validation, constraint or authorization.`,message:`Messages of the classified kind joined with a newline in result order, verbatim including unresolved $strings keys; authorization uses its denial reason.`,constraint:`First violated constraint name in result order as a String, only in a by constraint branch.`};return t!==void 0&&r[n]!==void 0?`**${e}** — ${r[n]} Executable from ESM v19 in branch event mappings.`:null}if(e.startsWith(`$identity.`)){let t=e.substring(10).split(`.`)[0],n=c(S,D).identityDetails?.find(e=>e.name===t);if(n)return`**$identity.${n.name}** — ${n.type}. Declared caller detail; authoring metadata only, not executable until admitted (#600).`}let t=_[e]??(e.startsWith(`$env`)?_.$env:void 0);if(t)return t}}let B=k.slice(0,T-1),V=/^\s*(?:by|filter)\s+/.test(B)?/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(B):/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(B),se=/^\s*query\s+\w+\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+$/.test(B)&&!/^\s*query\s+\w+\s*=>\s*observable\s+$/.test(B);if(w===`subject`){let e=g(S),t=/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?(?:\?|\s+optional)?(?:\s+generated)?(?:\s+identifier)?\s+$/.test(B),n=d(e,O,C,p(k));return t&&(n[0]===`event`||/^produces\s+event\s+/.test(re(e,O,C,p(k))[0]??``))?`**subject** — 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.`:/\bclaim\s+"(?:[^"\\]|\\.)*"\s+matches\s+$/.test(B)&&n.includes(`policy`)?`**subject** — ${y.subject}`:null}if(w===`optional`&&(V||se))return`**optional** — ${y.optional}`;if(w===`implementation`||w===`hint`){let e=d(S,O,C,p(k)),t=r(S,C,p(k));if(w===`implementation`&&t===`rule`&&/^\s*implementation\s*$/.test(m(k))||w===`hint`&&t===`implementation`&&/^\s*hint\s+"/.test(k))return`**${w}** — 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.`;if(w===`implementation`&&e[0]===`handler`&&/^\s*implementation\s*$/.test(m(k)))return`**implementation** — ${v.implementation}`;if(w===`hint`&&e[0]===`implementation`&&e[1]===`handler`&&/^\s*hint\s+"/.test(k))return`**hint** — ${v.hint}`}let H=s(S),U=H.commands.filter(e=>e.line<C).at(-1),W=U?.properties.find(e=>e.name===w&&e.line===C);if(W?.isGenerated||w===`generated`&&U?.properties.some(e=>e.isGenerated&&e.line===C)&&V)return`**${W?.name??`generated`}** — ${W?h(o(W))+`. `:``}Generated value, not a request or form input. ${u}`;let G=U?.response;if(G?.location.line===C+1&&(tokenAt(G.location.column,`returns`)||G.kind===`ScalarCommandResponseSyntax`&&tokenAt(G.source.location.column,G.source.property))){let e=G.kind===`ScalarCommandResponseSyntax`?U?.properties.find(e=>e.name===G.source.property):void 0;return`**returns**${e?` — ${h(o(e))}`:` — unnamed record response`}. ${u}`}if(G?.kind===`RecordCommandResponseSyntax`){let e=G.fields.find(e=>e.location.line===C+1&&(tokenAt(e.location.column,e.name)||tokenAt(e.source.location.column,e.source.property)));if(e){let t=U?.properties.find(t=>t.name===e.source.property),n=e.type?h(e.type):t?h(o(t)):`Unresolved type`;return`**${e.name}** — ${n}${e.type?` (explicit)`:` (inferred)`} = ${e.source.property}. ${t?.isGenerated?`Generated source, not request input. `:``}${u}`}}for(let e of l(S).specifications.values())if(w===`returns`&&e.thenReturns?.location.line===C+1||w===`generated`&&e.when?.generatedValues?.some(e=>e.location.line===C+1))return u;let K=H.concepts.find(e=>e.name===w);if(K){let e=K.attributes.length?` ${K.attributes.join(` `)}`:``,t=K.enumValues.length?`\n\nValues: ${K.enumValues.map((e,t)=>K.enumNumbers===void 0?e:`${e} = ${K.enumNumbers[t]}`).join(`, `)}`:``,n=Object.entries(K.attributeReasons).map(([e,t])=>`\n\n**@${e}** — ${t}`).join(``);return`\`\`\`screenplay\nconcept ${K.name} : ${K.primitive}${e}\n\`\`\`${n}${t}`}let q=H.types.find(e=>e.name===w);if(q){let e=q.properties.map(e=>`${e.name} ${h(o(e))}`).join(`
1
+ import"./_virtual/_virtual/_rolldown/runtime.js";import{actionSubjectHover as e}from"./action-subject-authoring.js";import{continuationResponseHover as t}from"./continuation-responses.js";import{reactionReferenceAt as n}from"./reaction-authoring.js";import{refusalContext as r}from"./refusal-context.js";import{namedRuleContext as i}from"./named-rule-context.js";import{eventSourceHover as a}from"./event-source-authoring.js";import{exampleHover as ee}from"./example-authoring.js";import{operationHover as o}from"./operation-authoring.js";import{directBody as te,propertyTypeReference as s,scanDocument as ne,symbolsForBuffer as c}from"./symbols.js";import{responseAnalysis as re,responseAvailability as l}from"./response-analysis.js";import{enclosingChain as u,enclosingHeaders as d,fenceMap as f,indentOf as p,withoutComment as m}from"./document-context.js";import{typeReferenceText as h}from"./TypeReferenceSymbol.js";import{eventAnalysisSource as g}from"./event-analysis-source.js";import{getSubLanguage as ie}from"./sub-language-registry.js";import{attributeDocs as ae,contextVariableDocs as _,handlerIntentDocs as v,keywordDocs as y,specialCategoryDocs as b,specificationKeywordDocs as x}from"./keyword-docs.js";function contextualKeywordDoc(e,t,n){let r=[`today`,`now`,`date`,`of`,`clock`,`calendar`,`zone`].includes(e),i=n===`.`||/^\s*@?[a-z_]\w*\s+(?:String|Date|DateTime|Int|Bool)\b/.test(t);return r&&i?void 0:y[e]}function hoverContent(S,C,w,T,E,D){let O=f(S);if(O[C])return null;let k=S[C]??``;if(E-1>m(k).length)return null;let A=!1,j=!1;for(let e=0;e<T-1;e++)k[e]===`\\`&&A?e++:k[e]===`"`&&!j?A=!A:k[e]==="`"&&!A&&(j=!j);if(A||j)return null;let M=e(k,w,T);if(M)return M;let N=t(S,C,w,T,E,D);if(N)return N;let P=n(S,C,T,E,D);if(P)return P.content;let F=ee(S,C,T,E,D);if(F)return F;let I=a(S,C,T,E,D);if(I)return I;let L=o(S,C,T,E,D);if(L)return L;let tokenAt=(e,t)=>{let n=e+ +(k[e-1]===`@`);return w===t&&T===n&&E===n+t.length&&k.slice(n-1,E-1)===t},R=k.charAt(T-2);if(w===`authorization`&&u(S,O,C,p(k))[0]===`purpose`)return`A quoted authorization in law for criminal-offence data (Art. 10).`;if(u(S,O,C,p(k))[0]===`concept`&&/^\s*generate\b/.test(k)){let e={generate:`The concept declares how; a command property declares generated. ESM v15 checks fixture shape and guards generated event sources against existing facts.`,uuid:`Random UUID v4, 122 random bits; about 3.27 × 10^17 values at 1% collision probability.`,uuidv7:`Time-ordered UUID v7, 74 random bits; about 1.95 × 10^10 values at 1% collision probability. Exposes time; not monotonic within a millisecond.`,ulid:`26 Crockford base32 characters (uppercase by default), 80 random bits; about 1.56 × 10^11 values at 1% collision probability.`,typeid:`TypeID 0.3: lowercase UUIDv7 base32 with a 0..63-character prefix. 74 random bits; empty prefix has no separator.`,nanoid:`Default 21 characters over 64 symbols: 126 random bits. Custom entropy = size × log2(alphabet size).`,bytes:`8 × count random bits; base64url, hex or base32 without padding. RFC 4648 unused trailing bits must be zero.`,prefix:`Printable ASCII prefix, at most 32 characters. UUID prefixes require a String concept; TypeID uses its own argument.`,alphabet:`NanoID only: 2..256 distinct printable ASCII characters.`,case:`lower or upper for String UUIDs, ULID, hex/base32 bytes. Never base64url, NanoID or TypeID.`,pattern:`ESM v21 finite ASCII pattern: # digits, ? uppercase letters, * uppercase letters and digits, classes, repeats 1..64 and UTC yyyy/yy/MM/dd segments. Final value including checksum is at most 256 characters. Counts distinct strings, not repeat decompositions; dates and check digits add no entropy.`,random:`ESM v21 inclusive signed Int64 range for an Int value. Fixtures must be integral numbers within the exact bounds. Int cannot be a generated identifier.`,rule:`ESM v21 ValueGeneration requirement with exactly one direct file or tagged fence. Returns String; the closed GenerationContext descriptor (Now, Tenant) is bound by each provider to its own type; Cratis C# binds the Fundamentals GenerationContext. Entropy is unknown. The reference runner uses a fixture and never executes the body.`,checksum:`Appends luhn/mod11/mod97 check digits, adding no entropy. mod11 excludes check digit 10. Generated fixtures check only suffix digit shape unless validate checksum is authored.`,sequence:`Reserved; binding refuses it until #619 is admitted.`};if(e[w])return e[w]}let z=/^\s*concept\s+[^\s:]+\s*:\s*\w+\s+/.exec(k),oe=u(S,O,C,p(k))[0]===`concept`&&/^\s*(?:@?pii|personal|@?sensitive|secret)\s+(?:reason|scope|special|criminal)\b/.test(k);if(z!==null&&T-1>=z[0].length-1||oe){let e=ae[w];if(e)return e;if(Object.hasOwn(b,w)&&/^\s*(?:@?pii|personal)\s+special\s+/.test(k))return`**${w}** — ${b[w]}`;if(w===`special`)return`GDPR Art. 9(1) special category; requires pii. At most one category per concept.`;if(w===`criminal`)return`Personal data relating to criminal convictions and offenses (GDPR Art. 10); requires pii.`;if(/^\s*(?:secret|sensitive|@sensitive)\s+scope\s+/.test(k)&&[`subject`,`namespace`,`global`].includes(w))return`**${w}** — Secret encryption scope${w===`subject`?` per data subject`:w===`namespace`?` per tenant namespace`:` shared globally`}. Not an event-property subject role.`;if(w===`scope`)return`Secret encryption scope: subject, namespace or global. Omitted scope keeps Chronicle’s Subject default; pii secret renders only [PII].`}if(R===`$`||R===`.`){let e=k.substring(0,E-1).match(/\$[\w.]*$/)?.[0];if(e){if(e.startsWith(`$refusal`)){let t=r(S,C,p(k)),n=e.substring(9),i={reason:`Refusal kind as a String: validation, constraint or authorization.`,message:`Messages of the classified kind joined with a newline in result order, verbatim including unresolved $strings keys; authorization uses its denial reason.`,constraint:`First violated constraint name in result order as a String, only in a by constraint branch.`};return t!==void 0&&i[n]!==void 0?`**${e}** — ${i[n]} Executable from ESM v19 in branch event mappings.`:null}if(e.startsWith(`$identity.`)){let t=e.substring(10).split(`.`)[0],n=c(S,D).identityDetails?.find(e=>e.name===t);if(n)return`**$identity.${n.name}** — ${n.type}. Declared caller detail; authoring metadata only, not executable until admitted (#600).`}let t=_[e]??(e.startsWith(`$env`)?_.$env:void 0);if(t)return t}}let B=k.slice(0,T-1),V=/^\s*(?:by|filter)\s+/.test(B)?/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(B):/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(B),se=/^\s*query\s+\w+\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+$/.test(B)&&!/^\s*query\s+\w+\s*=>\s*observable\s+$/.test(B);if(w===`subject`){let e=g(S),t=/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?(?:\?|\s+optional)?(?:\s+generated)?(?:\s+identifier)?\s+$/.test(B),n=u(e,O,C,p(k));return t&&(n[0]===`event`||/^produces\s+event\s+/.test(d(e,O,C,p(k))[0]??``))?`**subject** — 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.`:/\bclaim\s+"(?:[^"\\]|\\.)*"\s+matches\s+$/.test(B)&&n.includes(`policy`)?`**subject** — ${y.subject}`:null}if(w===`optional`&&(V||se))return`**optional** — ${y.optional}`;if(w===`implementation`||w===`hint`){let e=u(S,O,C,p(k)),t=i(S,C,p(k));if(w===`implementation`&&t===`rule`&&/^\s*implementation\s*$/.test(m(k))||w===`hint`&&t===`implementation`&&/^\s*hint\s+"/.test(k))return`**${w}** — 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.`;if(w===`implementation`&&e[0]===`handler`&&/^\s*implementation\s*$/.test(m(k)))return`**implementation** — ${v.implementation}`;if(w===`hint`&&e[0]===`implementation`&&e[1]===`handler`&&/^\s*hint\s+"/.test(k))return`**hint** — ${v.hint}`}let H=ne(S),U=H.commands.filter(e=>e.line<C).at(-1),W=U?.properties.find(e=>e.name===w&&e.line===C);if(W?.isGenerated||w===`generated`&&U?.properties.some(e=>e.isGenerated&&e.line===C)&&V)return`**${W?.name??`generated`}** — ${W?h(s(W))+`. `:``}Generated value, not a request or form input. ${l}`;let G=U?.response;if(G?.location.line===C+1&&(tokenAt(G.location.column,`returns`)||G.kind===`ScalarCommandResponseSyntax`&&tokenAt(G.source.location.column,G.source.property))){let e=G.kind===`ScalarCommandResponseSyntax`?U?.properties.find(e=>e.name===G.source.property):void 0;return`**returns**${e?` — ${h(s(e))}`:` — unnamed record response`}. ${l}`}if(G?.kind===`RecordCommandResponseSyntax`){let e=G.fields.find(e=>e.location.line===C+1&&(tokenAt(e.location.column,e.name)||tokenAt(e.source.location.column,e.source.property)));if(e){let t=U?.properties.find(t=>t.name===e.source.property),n=e.type?h(e.type):t?h(s(t)):`Unresolved type`;return`**${e.name}** — ${n}${e.type?` (explicit)`:` (inferred)`} = ${e.source.property}. ${t?.isGenerated?`Generated source, not request input. `:``}${l}`}}for(let e of re(S).specifications.values())if(w===`returns`&&e.thenReturns?.location.line===C+1||w===`generated`&&e.when?.generatedValues?.some(e=>e.location.line===C+1))return l;let K=H.concepts.find(e=>e.name===w);if(K){let e=K.attributes.length?` ${K.attributes.join(` `)}`:``,t=K.enumValues.length?`\n\nValues: ${K.enumValues.map((e,t)=>K.enumNumbers===void 0?e:`${e} = ${K.enumNumbers[t]}`).join(`, `)}`:``,n=Object.entries(K.attributeReasons).map(([e,t])=>`\n\n**@${e}** — ${t}`).join(``);return`\`\`\`screenplay\nconcept ${K.name} : ${K.primitive}${e}\n\`\`\`${n}${t}`}let q=H.types.find(e=>e.name===w);if(q){let e=q.properties.map(e=>`${e.name} ${h(s(e))}`).join(`
2
2
  `);return`\`\`\`screenplay\ntype ${q.name}\n${e}\n\`\`\``}let J=H.policies.find(e=>e.name===w);if(J){let e=J.requires.length?J.requires.join(`
3
- `):`(custom C#)`;return`\`\`\`screenplay\npolicy ${J.name}\n${e}\n\`\`\``}let Y=H.events.find(e=>e.name===w&&e.line===C)??H.events.filter(e=>e.name===w).sort((e,t)=>(t.generation??1)-(e.generation??1))[0];if(Y){let e=Y.properties.map(e=>`${e.name} ${h(o(e))}${e.isSubject?` subject`:``}`).join(`
4
- `);return`\`\`\`screenplay\n${Y.visibility===`Public`?`public `:``}event ${Y.name}${Y.generation===void 0?``:` generation ${Y.generation}`}${Y.origin===void 0?``:` from ${JSON.stringify(Y.origin)}`}\n${e}\n\`\`\``}let X=H.commands.find(e=>e.name===w);if(X&&X.properties.length>0){let e=X.properties.map(e=>`${e.name} ${h(o(e))}${e.isGenerated?` generated`:``}${e.isIdentifier?` identifier`:``}`).join(`
5
- `);return`\`\`\`screenplay\ncommand ${X.name}\n${e}\n\`\`\`${X.response||X.properties.some(e=>e.isGenerated)?`\n\n${u}`:``}`}let Z=d(S,O,C,p(k));for(let e of[k.trim().split(/\s+/)[0],...Z]){let t=ie(e??``)?.hovers?.[w];if(t)return t}if(w===`reads`&&(Z[0]===`every`||Z[0]===`at`)&&Z.includes(`reaction`))return"**reads** — Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.";let Q=k.trim().match(/^(given|when|then)\s+(?:no\s+)?(\w+)/);if(Q&&Q[2]===w&&Z[0]===`specification`&&x[w])return`**${w}** — ${x[w]}`;if(w===`id`||w===`documentation`){let e=g(S),t=H.events.some(t=>ne(e,O,t.line,p(e[t.line])).includes(C)),n=w===`id`?/^\s*id\s+"/.test(e[C]):/^\s*documentation\s*$/.test(e[C]);if(!(t||w===`documentation`&&[`module`,`feature`,`slice`,`command`,`readmodel`,`reaction`].includes(Z[0]))||!n||T!==p(k)+1)return null}if(w===`optional`||w===`generated`||w===`returns`)return null;let $=y[w];return $?`**${w}** — ${$}`:null}export{hoverContent};
3
+ `):`(custom C#)`;return`\`\`\`screenplay\npolicy ${J.name}\n${e}\n\`\`\``}let Y=H.events.find(e=>e.name===w&&e.line===C)??H.events.filter(e=>e.name===w).sort((e,t)=>(t.generation??1)-(e.generation??1))[0];if(Y){let e=Y.properties.map(e=>`${e.name} ${h(s(e))}${e.isSubject?` subject`:``}`).join(`
4
+ `);return`\`\`\`screenplay\n${Y.visibility===`Public`?`public `:``}event ${Y.name}${Y.generation===void 0?``:` generation ${Y.generation}`}${Y.origin===void 0?``:` from ${JSON.stringify(Y.origin)}`}\n${e}\n\`\`\``}let X=H.commands.find(e=>e.name===w);if(X&&X.properties.length>0){let e=X.properties.map(e=>`${e.name} ${h(s(e))}${e.isGenerated?` generated`:``}${e.isIdentifier?` identifier`:``}`).join(`
5
+ `);return`\`\`\`screenplay\ncommand ${X.name}\n${e}\n\`\`\`${X.response||X.properties.some(e=>e.isGenerated)?`\n\n${l}`:``}`}let Z=u(S,O,C,p(k));for(let e of[k.trim().split(/\s+/)[0],...Z]){let t=ie(e??``)?.hovers?.[w];if(t)return t}if(w===`reads`&&(Z[0]===`every`||Z[0]===`at`)&&Z.includes(`reaction`))return"**reads** — Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.";let Q=k.trim().match(/^(given|when|then)\s+(?:no\s+)?(\w+)/);if(Q&&Q[2]===w&&Z[0]===`specification`&&x[w])return`**${w}** — ${x[w]}`;if(w===`id`||w===`documentation`){let e=g(S),t=H.events.some(t=>te(e,O,t.line,p(e[t.line])).includes(C)),n=w===`id`?/^\s*id\s+"/.test(e[C]):/^\s*documentation\s*$/.test(e[C]);if(!(t||w===`documentation`&&[`module`,`feature`,`slice`,`command`,`readmodel`,`reaction`].includes(Z[0]))||!n||T!==p(k)+1)return null}if(w===`optional`||w===`generated`||w===`returns`)return null;let $=contextualKeywordDoc(w,k,R);return $?`**${w}** — ${$}`:null}export{hoverContent};
6
6
  //# sourceMappingURL=hover-content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hover-content.js","names":["fences","fenceMap","lines","lineIndex","line","endColumn","withoutComment","inString","inTemplate","index","startColumn","actionSubject","actionSubjectHover","word","returned","continuationResponseHover","application","reaction","reactionReferenceAt","fixtureHover","exampleHover","sourceHover","eventSourceHover","operation","operationHover","start","column","name","before","enclosingChain","indentOf","generationDocs","complianceHeader","complianceBody","doc","attributeDocs","specialCategoryDocs","variable","branch","refusalContext","member","descriptions","detail","symbolsForBuffer","contextVariableDocs","\"$env\"","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","right","left","construct","getSubLanguage","step","specificationKeywordDocs","inEvent","directBody","directive","keywordDoc"],"sources":["../../hover-content.ts"],"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 { actionSubjectHover } from './action-subject-authoring';\nimport { continuationResponseHover } from './continuation-responses';\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 — 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 actionSubject = actionSubjectHover(line, word, startColumn);\n if (actionSubject) return actionSubject;\n const returned = continuationResponseHover(lines, lineIndex, word, startColumn, endColumn, application);\n if (returned) return returned;\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 if (enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'concept' && /^\\s*generate\\b/.test(line)) {\n const generationDocs: Record<string, string> = {\n generate: 'The concept declares how; a command property declares generated. ESM v15 checks fixture shape and guards generated event sources against existing facts.',\n uuid: 'Random UUID v4, 122 random bits; about 3.27 × 10^17 values at 1% collision probability.',\n uuidv7: 'Time-ordered UUID v7, 74 random bits; about 1.95 × 10^10 values at 1% collision probability. Exposes time; not monotonic within a millisecond.',\n ulid: '26 Crockford base32 characters (uppercase by default), 80 random bits; about 1.56 × 10^11 values at 1% collision probability.',\n typeid: 'TypeID 0.3: lowercase UUIDv7 base32 with a 0..63-character prefix. 74 random bits; empty prefix has no separator.',\n nanoid: 'Default 21 characters over 64 symbols: 126 random bits. Custom entropy = size × log2(alphabet size).',\n bytes: '8 × count random bits; base64url, hex or base32 without padding. RFC 4648 unused trailing bits must be zero.',\n prefix: 'Printable ASCII prefix, at most 32 characters. UUID prefixes require a String concept; TypeID uses its own argument.',\n alphabet: 'NanoID only: 2..256 distinct printable ASCII characters.',\n case: 'lower or upper for String UUIDs, ULID, hex/base32 bytes. Never base64url, NanoID or TypeID.',\n pattern: 'ESM v21 finite ASCII pattern: # digits, ? uppercase letters, * uppercase letters and digits, classes, repeats 1..64 and UTC yyyy/yy/MM/dd segments. Final value including checksum is at most 256 characters. Counts distinct strings, not repeat decompositions; dates and check digits add no entropy.',\n random: 'ESM v21 inclusive signed Int64 range for an Int value. Fixtures must be integral numbers within the exact bounds. Int cannot be a generated identifier.',\n rule: 'ESM v21 ValueGeneration requirement with exactly one direct file or tagged fence. Returns String; the closed GenerationContext descriptor (Now, Tenant) is bound by each provider to its own type; Cratis C# binds the Fundamentals GenerationContext. Entropy is unknown. The reference runner uses a fixture and never executes the body.',\n checksum: 'Appends luhn/mod11/mod97 check digits, adding no entropy. mod11 excludes check digit 10. Generated fixtures check only suffix digit shape unless validate checksum is authored.',\n sequence: 'Reserved; binding refuses it until #619 is admitted.',\n };\n if (generationDocs[word]) return generationDocs[word];\n }\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}** — ${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}** — 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’s 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: 'Messages of the classified kind joined with a newline in result order, verbatim including unresolved $strings keys; authorization uses its denial reason.', constraint: 'First violated constraint name in result order as a String, only in a by constraint branch.' };\n return branch !== undefined && descriptions[member] !== undefined ? `**${variable}** — ${descriptions[member]} Executable from ESM v19 in branch event mappings.` : 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}** — ${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** — 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** — ${keywordDocs.subject}`;\n return null;\n }\n if (word === 'optional' && (followsPropertyType || followsQueryType)) {\n return `**optional** — ${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}** — 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** — ${handlerIntentDocs.implementation}`;\n }\n if (word === 'hint' && chain[0] === 'implementation' && chain[1] === 'handler' && /^\\s*hint\\s+\"/.test(line)) {\n return `**hint** — ${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'}** — ${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 ? ` — ${typeReferenceText(propertyTypeReference(source))}` : ' — 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}** — ${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.map((value, index) => concept.enumNumbers === undefined ? value : `${value} = ${concept.enumNumbers[index]}`).join(', ')}`\n : '';\n const reasons = Object.entries(concept.attributeReasons)\n .map(([attribute, reason]) => `\\n\\n**@${attribute}** — ${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** — 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}** — ${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}** — ${keywordDoc}`;\n\n return null;\n}\n"],"mappings":"A,ksCAuBA,SAAgB,aACZ,EACA,EACA,EACA,EACA,EACA,EACa,CACb,IAAMA,EAASC,EAASC,CAAK,EAC7B,GAAIF,EAAOG,GAAY,OAAO,KAE9B,IAAMC,EAAOF,EAAMC,IAAc,GACjC,GAAIE,EAAY,EAAIC,EAAeF,CAAI,CAAC,CAAC,OAAQ,OAAO,KACxD,IAAIG,EAAW,GACXC,EAAa,GACjB,IAAK,IAAIC,EAAQ,EAAGA,EAAQC,EAAc,EAAG,IACrCN,EAAKK,KAAW,MAAQF,EAAU,IAC7BH,EAAKK,KAAW,KAAO,CAACD,EAAY,EAAW,CAACD,EAChDH,EAAKK,KAAW,KAAO,CAACF,IAAU,EAAa,CAACC,GAE7D,GAAID,GAAYC,EAAY,OAAO,KACnC,IAAMG,EAAgBC,EAAmBR,EAAMS,EAAMH,CAAW,EAChE,GAAIC,EAAe,OAAOA,EAC1B,IAAMG,EAAWC,EAA0Bb,EAAOC,EAAWU,EAAMH,EAAaL,EAAWW,CAAW,EACtG,GAAIF,EAAU,OAAOA,EACrB,IAAMG,EAAWC,EAAoBhB,EAAOC,EAAWO,EAAaL,EAAWW,CAAW,EAC1F,GAAIC,EAAU,OAAOA,EAAS,QAC9B,IAAME,EAAeC,GAAalB,EAAOC,EAAWO,EAAaL,EAAWW,CAAW,EACvF,GAAIG,EAAc,OAAOA,EACzB,IAAME,EAAcC,EAAiBpB,EAAOC,EAAWO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 {"version":3,"file":"hover-content.js","names":["clockWord","word","property","before","line","keywordDocs","fences","fenceMap","lines","lineIndex","endColumn","withoutComment","inString","inTemplate","index","startColumn","actionSubject","actionSubjectHover","returned","continuationResponseHover","application","reaction","reactionReferenceAt","fixtureHover","exampleHover","sourceHover","eventSourceHover","operation","operationHover","start","column","name","enclosingChain","indentOf","generationDocs","complianceHeader","complianceBody","doc","attributeDocs","specialCategoryDocs","variable","branch","refusalContext","member","descriptions","detail","symbolsForBuffer","contextVariableDocs","\"$env\"","prefix","followsPropertyType","followsQueryType","source","eventAnalysisSource","subjectPrefix","ownerChain","enclosingHeaders","chain","ruleContext","namedRuleContext","handlerIntentDocs","symbols","scanDocument","owner","command","typeReferenceText","propertyTypeReference","responseAvailability","response","field","type","specification","responseAnalysis","value","concept","candidate","attributes","values","reasons","attribute","reason","properties","policy","body","event","right","left","construct","getSubLanguage","step","specificationKeywordDocs","inEvent","directBody","directive","keywordDoc"],"sources":["../../hover-content.ts"],"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 { actionSubjectHover } from './action-subject-authoring';\nimport { continuationResponseHover } from './continuation-responses';\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\nfunction contextualKeywordDoc(word: string, line: string, before: string): string | undefined {\n const clockWord = ['today', 'now', 'date', 'of', 'clock', 'calendar', 'zone'].includes(word);\n const property = before === '.' || /^\\s*@?[a-z_]\\w*\\s+(?:String|Date|DateTime|Int|Bool)\\b/.test(line);\n return clockWord && property ? undefined : keywordDocs[word];\n}\n\n// Produces the hover markdown for a word at a position, without any editor\n// dependency — 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 actionSubject = actionSubjectHover(line, word, startColumn);\n if (actionSubject) return actionSubject;\n const returned = continuationResponseHover(lines, lineIndex, word, startColumn, endColumn, application);\n if (returned) return returned;\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 if (enclosingChain(lines, fences, lineIndex, indentOf(line))[0] === 'concept' && /^\\s*generate\\b/.test(line)) {\n const generationDocs: Record<string, string> = {\n generate: 'The concept declares how; a command property declares generated. ESM v15 checks fixture shape and guards generated event sources against existing facts.',\n uuid: 'Random UUID v4, 122 random bits; about 3.27 × 10^17 values at 1% collision probability.',\n uuidv7: 'Time-ordered UUID v7, 74 random bits; about 1.95 × 10^10 values at 1% collision probability. Exposes time; not monotonic within a millisecond.',\n ulid: '26 Crockford base32 characters (uppercase by default), 80 random bits; about 1.56 × 10^11 values at 1% collision probability.',\n typeid: 'TypeID 0.3: lowercase UUIDv7 base32 with a 0..63-character prefix. 74 random bits; empty prefix has no separator.',\n nanoid: 'Default 21 characters over 64 symbols: 126 random bits. Custom entropy = size × log2(alphabet size).',\n bytes: '8 × count random bits; base64url, hex or base32 without padding. RFC 4648 unused trailing bits must be zero.',\n prefix: 'Printable ASCII prefix, at most 32 characters. UUID prefixes require a String concept; TypeID uses its own argument.',\n alphabet: 'NanoID only: 2..256 distinct printable ASCII characters.',\n case: 'lower or upper for String UUIDs, ULID, hex/base32 bytes. Never base64url, NanoID or TypeID.',\n pattern: 'ESM v21 finite ASCII pattern: # digits, ? uppercase letters, * uppercase letters and digits, classes, repeats 1..64 and UTC yyyy/yy/MM/dd segments. Final value including checksum is at most 256 characters. Counts distinct strings, not repeat decompositions; dates and check digits add no entropy.',\n random: 'ESM v21 inclusive signed Int64 range for an Int value. Fixtures must be integral numbers within the exact bounds. Int cannot be a generated identifier.',\n rule: 'ESM v21 ValueGeneration requirement with exactly one direct file or tagged fence. Returns String; the closed GenerationContext descriptor (Now, Tenant) is bound by each provider to its own type; Cratis C# binds the Fundamentals GenerationContext. Entropy is unknown. The reference runner uses a fixture and never executes the body.',\n checksum: 'Appends luhn/mod11/mod97 check digits, adding no entropy. mod11 excludes check digit 10. Generated fixtures check only suffix digit shape unless validate checksum is authored.',\n sequence: 'Reserved; binding refuses it until #619 is admitted.',\n };\n if (generationDocs[word]) return generationDocs[word];\n }\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}** — ${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}** — 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’s 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: 'Messages of the classified kind joined with a newline in result order, verbatim including unresolved $strings keys; authorization uses its denial reason.', constraint: 'First violated constraint name in result order as a String, only in a by constraint branch.' };\n return branch !== undefined && descriptions[member] !== undefined ? `**${variable}** — ${descriptions[member]} Executable from ESM v19 in branch event mappings.` : 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}** — ${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** — 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** — ${keywordDocs.subject}`;\n return null;\n }\n if (word === 'optional' && (followsPropertyType || followsQueryType)) {\n return `**optional** — ${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}** — 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** — ${handlerIntentDocs.implementation}`;\n }\n if (word === 'hint' && chain[0] === 'implementation' && chain[1] === 'handler' && /^\\s*hint\\s+\"/.test(line)) {\n return `**hint** — ${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'}** — ${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 ? ` — ${typeReferenceText(propertyTypeReference(source))}` : ' — 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}** — ${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.map((value, index) => concept.enumNumbers === undefined ? value : `${value} = ${concept.enumNumbers[index]}`).join(', ')}`\n : '';\n const reasons = Object.entries(concept.attributeReasons)\n .map(([attribute, reason]) => `\\n\\n**@${attribute}** — ${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** — 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}** — ${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 = contextualKeywordDoc(word, line, before);\n if (keywordDoc) return `**${word}** — ${keywordDoc}`;\n\n return null;\n}\n"],"mappings":"A,ksCAoBA,SAAS,qBAAqB,EAAc,EAAc,EAAoC,CAC1F,IAAMA,EAAY,CAAC,QAAS,MAAO,OAAQ,KAAM,QAAS,WAAY,MAAM,CAAC,CAAC,SAASC,CAAI,EACrFC,EAAWC,IAAW,KAAO,wDAAwD,KAAKC,CAAI,EACpG,OAAOJ,GAAaE,EAAW,IAAA,GAAYG,EAAYJ,EAC3D,CAKA,SAAgB,aACZ,EACA,EACA,EACA,EACA,EACA,EACa,CACb,IAAMK,EAASC,EAASC,CAAK,EAC7B,GAAIF,EAAOG,GAAY,OAAO,KAE9B,IAAML,EAAOI,EAAMC,IAAc,GACjC,GAAIC,EAAY,EAAIC,EAAeP,CAAI,CAAC,CAAC,OAAQ,OAAO,KACxD,IAAIQ,EAAW,GACXC,EAAa,GACjB,IAAK,IAAIC,EAAQ,EAAGA,EAAQC,EAAc,EAAG,IACrCX,EAAKU,KAAW,MAAQF,EAAU,IAC7BR,EAAKU,KAAW,KAAO,CAACD,EAAY,EAAW,CAACD,EAChDR,EAAKU,KAAW,KAAO,CAACF,IAAU,EAAa,CAACC,GAE7D,GAAID,GAAYC,EAAY,OAAO,KACnC,IAAMG,EAAgBC,EAAmBb,EAAMH,EAAMc,CAAW,EAChE,GAAIC,EAAe,OAAOA,EAC1B,IAAME,EAAWC,EAA0BX,EAAOC,EAAWR,EAAMc,EAAaL,EAAWU,CAAW,EACtG,GAAIF,EAAU,OAAOA,EACrB,IAAMG,EAAWC,EAAoBd,EAAOC,EAAWM,EAAaL,EAAWU,CAAW,EAC1F,GAAIC,EAAU,OAAOA,EAAS,QAC9B,IAAME,EAAeC,GAAahB,EAAOC,EAAWM,EAAaL,EAAWU,CAAW,EACvF,GAAIG,EAAc,OAAOA,EACzB,IAAME,EAAcC,EAA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