@shobyde/boaz 0.0.0-stage → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +422 -2
  3. package/dist/build/codes.d.ts +16 -0
  4. package/dist/build/codes.d.ts.map +1 -0
  5. package/dist/build/codes.js +72 -0
  6. package/dist/build/codes.js.map +1 -0
  7. package/dist/build/extract.d.ts +45 -0
  8. package/dist/build/extract.d.ts.map +1 -0
  9. package/dist/build/extract.js +484 -0
  10. package/dist/build/extract.js.map +1 -0
  11. package/dist/build/glob.d.ts +11 -0
  12. package/dist/build/glob.d.ts.map +1 -0
  13. package/dist/build/glob.js +88 -0
  14. package/dist/build/glob.js.map +1 -0
  15. package/dist/build/index.d.ts +7 -0
  16. package/dist/build/index.d.ts.map +1 -0
  17. package/dist/build/index.js +4 -0
  18. package/dist/build/index.js.map +1 -0
  19. package/dist/build/probes.d.ts +41 -0
  20. package/dist/build/probes.d.ts.map +1 -0
  21. package/dist/build/probes.js +134 -0
  22. package/dist/build/probes.js.map +1 -0
  23. package/dist/build/report.d.ts +11 -0
  24. package/dist/build/report.d.ts.map +1 -0
  25. package/dist/build/report.js +39 -0
  26. package/dist/build/report.js.map +1 -0
  27. package/dist/cli/audit.d.ts +15 -0
  28. package/dist/cli/audit.d.ts.map +1 -0
  29. package/dist/cli/audit.js +68 -0
  30. package/dist/cli/audit.js.map +1 -0
  31. package/dist/cli/bench.d.ts +7 -0
  32. package/dist/cli/bench.d.ts.map +1 -0
  33. package/dist/cli/bench.js +147 -0
  34. package/dist/cli/bench.js.map +1 -0
  35. package/dist/cli/harness.d.ts +45 -0
  36. package/dist/cli/harness.d.ts.map +1 -0
  37. package/dist/cli/harness.js +90 -0
  38. package/dist/cli/harness.js.map +1 -0
  39. package/dist/cli/index.d.ts +3 -0
  40. package/dist/cli/index.d.ts.map +1 -0
  41. package/dist/cli/index.js +404 -0
  42. package/dist/cli/index.js.map +1 -0
  43. package/dist/cli/probes.d.ts +20 -0
  44. package/dist/cli/probes.d.ts.map +1 -0
  45. package/dist/cli/probes.js +27 -0
  46. package/dist/cli/probes.js.map +1 -0
  47. package/dist/cli/skill-template.d.ts +2 -0
  48. package/dist/cli/skill-template.d.ts.map +1 -0
  49. package/dist/cli/skill-template.js +254 -0
  50. package/dist/cli/skill-template.js.map +1 -0
  51. package/dist/core/actions.d.ts +67 -0
  52. package/dist/core/actions.d.ts.map +1 -0
  53. package/dist/core/actions.js +357 -0
  54. package/dist/core/actions.js.map +1 -0
  55. package/dist/core/define.d.ts +25 -0
  56. package/dist/core/define.d.ts.map +1 -0
  57. package/dist/core/define.js +76 -0
  58. package/dist/core/define.js.map +1 -0
  59. package/dist/core/execute.d.ts +75 -0
  60. package/dist/core/execute.d.ts.map +1 -0
  61. package/dist/core/execute.js +145 -0
  62. package/dist/core/execute.js.map +1 -0
  63. package/dist/core/index.d.ts +35 -0
  64. package/dist/core/index.d.ts.map +1 -0
  65. package/dist/core/index.js +20 -0
  66. package/dist/core/index.js.map +1 -0
  67. package/dist/core/lemmas.d.ts +32 -0
  68. package/dist/core/lemmas.d.ts.map +1 -0
  69. package/dist/core/lemmas.js +80 -0
  70. package/dist/core/lemmas.js.map +1 -0
  71. package/dist/core/lexical-engine.d.ts +18 -0
  72. package/dist/core/lexical-engine.d.ts.map +1 -0
  73. package/dist/core/lexical-engine.js +296 -0
  74. package/dist/core/lexical-engine.js.map +1 -0
  75. package/dist/core/loop.d.ts +51 -0
  76. package/dist/core/loop.d.ts.map +1 -0
  77. package/dist/core/loop.js +432 -0
  78. package/dist/core/loop.js.map +1 -0
  79. package/dist/core/mcp.d.ts +119 -0
  80. package/dist/core/mcp.d.ts.map +1 -0
  81. package/dist/core/mcp.js +253 -0
  82. package/dist/core/mcp.js.map +1 -0
  83. package/dist/core/memory.d.ts +106 -0
  84. package/dist/core/memory.d.ts.map +1 -0
  85. package/dist/core/memory.js +185 -0
  86. package/dist/core/memory.js.map +1 -0
  87. package/dist/core/plan.d.ts +83 -0
  88. package/dist/core/plan.d.ts.map +1 -0
  89. package/dist/core/plan.js +258 -0
  90. package/dist/core/plan.js.map +1 -0
  91. package/dist/core/preferences.d.ts +54 -0
  92. package/dist/core/preferences.d.ts.map +1 -0
  93. package/dist/core/preferences.js +83 -0
  94. package/dist/core/preferences.js.map +1 -0
  95. package/dist/core/prompt.d.ts +23 -0
  96. package/dist/core/prompt.d.ts.map +1 -0
  97. package/dist/core/prompt.js +76 -0
  98. package/dist/core/prompt.js.map +1 -0
  99. package/dist/core/question.d.ts +96 -0
  100. package/dist/core/question.d.ts.map +1 -0
  101. package/dist/core/question.js +501 -0
  102. package/dist/core/question.js.map +1 -0
  103. package/dist/core/registry.d.ts +33 -0
  104. package/dist/core/registry.d.ts.map +1 -0
  105. package/dist/core/registry.js +72 -0
  106. package/dist/core/registry.js.map +1 -0
  107. package/dist/core/retriever.d.ts +48 -0
  108. package/dist/core/retriever.d.ts.map +1 -0
  109. package/dist/core/retriever.js +123 -0
  110. package/dist/core/retriever.js.map +1 -0
  111. package/dist/core/schema.d.ts +27 -0
  112. package/dist/core/schema.d.ts.map +1 -0
  113. package/dist/core/schema.js +231 -0
  114. package/dist/core/schema.js.map +1 -0
  115. package/dist/core/skill.d.ts +105 -0
  116. package/dist/core/skill.d.ts.map +1 -0
  117. package/dist/core/skill.js +205 -0
  118. package/dist/core/skill.js.map +1 -0
  119. package/dist/core/summarise.d.ts +52 -0
  120. package/dist/core/summarise.d.ts.map +1 -0
  121. package/dist/core/summarise.js +146 -0
  122. package/dist/core/summarise.js.map +1 -0
  123. package/dist/core/tools.d.ts +21 -0
  124. package/dist/core/tools.d.ts.map +1 -0
  125. package/dist/core/tools.js +120 -0
  126. package/dist/core/tools.js.map +1 -0
  127. package/dist/core/types.d.ts +199 -0
  128. package/dist/core/types.d.ts.map +1 -0
  129. package/dist/core/types.js +5 -0
  130. package/dist/core/types.js.map +1 -0
  131. package/dist/dom/index.d.ts +22 -0
  132. package/dist/dom/index.d.ts.map +1 -0
  133. package/dist/dom/index.js +94 -0
  134. package/dist/dom/index.js.map +1 -0
  135. package/dist/extract/index.d.ts +36 -0
  136. package/dist/extract/index.d.ts.map +1 -0
  137. package/dist/extract/index.js +86 -0
  138. package/dist/extract/index.js.map +1 -0
  139. package/dist/react/index.d.ts +52 -0
  140. package/dist/react/index.d.ts.map +1 -0
  141. package/dist/react/index.js +131 -0
  142. package/dist/react/index.js.map +1 -0
  143. package/dist/rules/engine.d.ts +152 -0
  144. package/dist/rules/engine.d.ts.map +1 -0
  145. package/dist/rules/engine.js +364 -0
  146. package/dist/rules/engine.js.map +1 -0
  147. package/dist/rules/facts.d.ts +63 -0
  148. package/dist/rules/facts.d.ts.map +1 -0
  149. package/dist/rules/facts.js +115 -0
  150. package/dist/rules/facts.js.map +1 -0
  151. package/dist/rules/index.d.ts +10 -0
  152. package/dist/rules/index.d.ts.map +1 -0
  153. package/dist/rules/index.js +5 -0
  154. package/dist/rules/index.js.map +1 -0
  155. package/dist/rules/knowledge.d.ts +78 -0
  156. package/dist/rules/knowledge.d.ts.map +1 -0
  157. package/dist/rules/knowledge.js +254 -0
  158. package/dist/rules/knowledge.js.map +1 -0
  159. package/dist/vite/index.d.ts +26 -0
  160. package/dist/vite/index.d.ts.map +1 -0
  161. package/dist/vite/index.js +112 -0
  162. package/dist/vite/index.js.map +1 -0
  163. package/package.json +108 -4
@@ -0,0 +1,254 @@
1
+ export const BOAZ_SKILL_MD = `---
2
+ name: boaz-capabilities
3
+ description: Use when adding or changing a route, control, answer rule, or reply copy in an app with the boaz assistant. Declares capabilities, then proves the answers are routed and readable.
4
+ ---
5
+
6
+ # boaz: capabilities, answers and proof
7
+
8
+ This repository ships an in-browser assistant (\`boaz\`). It has no model:
9
+ it answers from the build-time capability manifest, from facts and rules your app
10
+ declares, and from the page text. It cannot read your source and it cannot see
11
+ the DOM. A feature without a capability declaration is invisible to it, and a
12
+ question no rule claims gets a keyword guess.
13
+
14
+ ## When this skill applies
15
+
16
+ Any time you:
17
+
18
+ - add a route, page, tab, or deep-linked view;
19
+ - add or change a modal, wizard, filter, sort, or bulk action;
20
+ - rename a user-visible control or change what it does;
21
+ - add an answer rule (a sentence computed from app data);
22
+ - change any reply copy the assistant says;
23
+ - delete a screen, action or rule.
24
+
25
+ ## 1. Declare what exists
26
+
27
+ Every user-reachable destination gets a \`route\` capability. Every mutating or
28
+ stateful control gets an \`action\`. Live state the assistant should read before
29
+ acting gets a \`query\`. A fixed paragraph it should quote gets a \`knowledge\`.
30
+
31
+ Declare it in a \`capabilities.ts\` next to the feature, not in a central file.
32
+ Central files rot; co-located ones get updated with the feature.
33
+
34
+ \`\`\`ts
35
+ import { defineCapability } from '@shobyde/boaz/core';
36
+
37
+ export const openInvoices = defineCapability({
38
+ id: 'billing.open_invoices',
39
+ kind: 'route',
40
+ title: 'Billing & invoices',
41
+ description:
42
+ 'Takes the visitor to the billing page where they can change plan, update the payment card, or download past invoices as PDF.',
43
+ keywords: ['invoice', 'receipt', 'payment', 'card', 'subscription', 'plan'],
44
+ route: '/settings/billing',
45
+ });
46
+ \`\`\`
47
+
48
+ **Metadata that decides retrieval** (the description is the search text):
49
+
50
+ - **id**: \`<area>.<verb_or_noun>\`, lowercase, never reused for something else.
51
+ The conversation refers to ids.
52
+ - **title**: what a visitor would call it. "Download invoices", not
53
+ \`InvoiceTableToolbar\`.
54
+ - **description**: start from the visitor's goal — "Use when the visitor
55
+ wants to…". If it lacks the words a visitor types, the capability is
56
+ unfindable.
57
+ - **keywords**: synonyms and plural forms. Cheap; add them.
58
+ - **route**: where its UI lives, even for actions.
59
+ - **paramsSchema**: strict JSON Schema, \`additionalProperties: false\`, enums over
60
+ free strings.
61
+
62
+ **Confirmation** (\`requiresConfirmation: true\`) is for deletes, spends, sends,
63
+ and anything hard to undo. Not for navigation, filtering, or opening a dialog.
64
+
65
+ ## 2. Decide who answers: capability, rule, or knowledge
66
+
67
+ The engine tries, in order: an answer rule, then the keyword engine over the
68
+ capabilities, then nothing.
69
+
70
+ | the visitor says | it should be |
71
+ | --- | --- |
72
+ | "open billing", "filter invoices to overdue" | a \`route\`/\`action\` capability |
73
+ | "which invoices are overdue?" | a \`query\` capability, or an answer rule if it joins data |
74
+ | "what is your refund policy?" | a \`knowledge\` capability |
75
+ | "which projects use Python?" (a join over rows) | an **answer rule** |
76
+ | "what does he do?" (a phrasing with no content words) | an **answer rule** with \`match\` |
77
+
78
+ Rules live in your app, not the library. The library owns retrieval, inference
79
+ and the order of operations; you own the facts.
80
+
81
+ \`\`\`ts
82
+ export const answers = [
83
+ {
84
+ id: 'projects.using',
85
+ title: 'Which projects use a technology',
86
+ keywords: ['which projects use', 'written in', 'uses'],
87
+ goal: 'projects_using(?P)',
88
+ steps: [{ capabilityId: 'projects.list', toFacts: projectFacts }],
89
+ // Needs the visitor to name a technology: no subject, no call.
90
+ explain: ({ terms, solutions }) => \`Matched \${terms[0]} against \${solutions.length} projects\`,
91
+ compose: ({ solutions, terms }) => phraseProjectsUsing(solutions, terms[0]),
92
+ },
93
+ ];
94
+ \`\`\`
95
+
96
+ Rule options that matter:
97
+
98
+ - **\`steps\`** run a capability first; the result becomes facts for the goal.
99
+ - **\`requiresSubject\`** — a rule that joins \`asked(?T)\` waits until the question
100
+ names a value to look up; a listing rule ("which invoices are overdue") runs
101
+ whenever it matches. Set \`false\` to opt out entirely.
102
+ - **\`constants\`** on the engine: values a tool will return, declared up front, so
103
+ "what's built with python?" is recognised before the tool has run.
104
+ - **\`match(query)\`** — an explicit trigger for phrasings keyword matching cannot
105
+ see, because they tokenize to nothing ("what does he do?").
106
+ - **\`threshold\`** — raise it when two rules share vocabulary.
107
+
108
+ **Controller verbs are the app's.** A question starting with show / open / go /
109
+ take / read / expand / copy / download / print / visit / browse / scroll / jump /
110
+ navigate / see is handled by a capability, not by an answer rule. Apps with their
111
+ own commands extend the list instead of fighting it:
112
+
113
+ \`\`\`ts
114
+ createRulesEngine({ ..., controllerVerbs: ['filter', 'sort', 'apply', 'clear'] });
115
+ \`\`\`
116
+
117
+ **Enums are literal.** A capability is called with the enum value that appeared in
118
+ the question, so "show only the unpaid invoices" cannot fill \`status: overdue\`.
119
+ Include the visitor's word in the enum and normalise it in the handler.
120
+
121
+ ## 3. Write the copy like writing
122
+
123
+ One intent should not have one sentence. Key the construction on the question
124
+ form (count-first for "how many", entity-first for "which"), and pick a
125
+ realisation from a hash of the question, so paraphrases differ while a repeated
126
+ question stays identical — a visitor can quote what they saw.
127
+
128
+ \`\`\`ts
129
+ const pick = (list, key) => list[hash(key) % list.length];
130
+
131
+ if (/how many|how much/i.test(query)) return pick([\`\${n} projects: \${names}.\`, ...], query);
132
+ return pick([\`\${names} — \${n} of them.\`, \`Everything public: \${names}.\`, ...], query);
133
+ \`\`\`
134
+
135
+ Three rules that keep this honest:
136
+
137
+ - **One intent per rule.** Two rules that read the same tool will fight over any
138
+ shared keyword ("built"), and the loser hijacks the question.
139
+ - **Facts first, flourish never.** Every realisation must carry every required
140
+ fact; a stylish wrong answer is a bug.
141
+ - **Never invent a claim to sound human.** Extra sentences must come from data
142
+ ("each has engineering notes"), not from adjectives.
143
+
144
+ ## 4. Prove it works
145
+
146
+ \`verify\` proves the declarations are sound. These two commands prove the
147
+ assistant is actually useful, and they are the ones to run before you call a
148
+ task done.
149
+
150
+ **Probe file** — the questions you promise to answer, grouped into intents:
151
+
152
+ \`\`\`json
153
+ {
154
+ "questions": [
155
+ { "question": "which projects use python?", "expect": "projects.using", "intent": "projects.using", "must": ["Readback", "Groundglass"] },
156
+ { "question": "what's built with python?", "expect": "projects.using", "intent": "projects.using", "must": ["Readback", "Groundglass"] },
157
+ { "question": "open the newest article", "expect": "blog.open_newest" },
158
+ { "question": "show the hobnob card", "expect": "projects.card", "args": { "project": "hobnob" } }
159
+ ]
160
+ }
161
+ \`\`\`
162
+
163
+ Four paraphrases per intent is enough to expose a template. \`must\` is what a
164
+ correct answer contains; \`args\` is what the capability must be called with. Only
165
+ intents with a \`must\` list are scored — a route or action has no copy to compare.
166
+
167
+ **Setup module** — the harness asks *your* engine, not a reimplementation:
168
+
169
+ \`\`\`js
170
+ // agent-setup.mjs
171
+ import manifest from './agent-manifest.json' with { type: 'json' };
172
+ import { createRulesEngine } from '@shobyde/boaz/rules';
173
+
174
+ export const capabilities = manifest.capabilities;
175
+ export const answers = /* your rules */ [];
176
+
177
+ // Without this, a rule that reads a tool answers with the tool call, not a sentence.
178
+ export const runCapability = async (id, args) =>
179
+ handlers[id] ? handlers[id](args) : {};
180
+
181
+ export function createEngine() {
182
+ return createRulesEngine({ knowledge, answers, capabilities, constants });
183
+ }
184
+ \`\`\`
185
+
186
+ **Run them:**
187
+
188
+ \`\`\`bash
189
+ npx boaz audit --probes agent-probes.json --module agent-setup.mjs
190
+ npx boaz bench --probes agent-probes.json --module agent-setup.mjs --samples
191
+ \`\`\`
192
+
193
+ - \`audit\` prints one line per miss — expected id, what actually ran — and exits 1.
194
+ Put it in CI. Add a probe for every capability you declare, in a visitor's words.
195
+ It reports the engine's own plan: a rule that asked for a capability is named,
196
+ a keyword match on the same capability is not. Rules that reply in prose are
197
+ checked by \`bench\` through their \`must\` facts.
198
+ - \`bench\` scores the copy per intent: **fidelity** (required facts present),
199
+ **similarity** between paraphrases with the facts masked, **openers**, **spread**,
200
+ **ttr**, **stable** (same question twice). Exit 1 when a fact goes missing or an
201
+ answer wobbles.
202
+
203
+ Reading the numbers:
204
+
205
+ | number | means |
206
+ | --- | --- |
207
+ | similarity 1.00 | every phrasing returned the identical sentence — a template |
208
+ | similarity ≈ 0.5 | the wording follows the question |
209
+ | similarity < 0.25 | check \`--samples\`: the topics may be drifting |
210
+ | fidelity 100% | no paraphrase lost a fact; anything less is a bug, not style |
211
+ | stable NO | the same question answered differently — drop the randomness |
212
+
213
+ Then read the samples. The numbers say the answers stopped repeating; they cannot
214
+ say the answers read well.
215
+
216
+ **No probe file yet?** Generate a starting one from the manifest:
217
+
218
+ \`\`\`bash
219
+ npx boaz probes --generate --manifest dist/agent-manifest.json
220
+ \`\`\`
221
+
222
+ It writes \`probes.generated.json\` with one question per capability title and
223
+ keyword, each already expecting the capability it came from, and prints two
224
+ lists worth reading: phrases that two capabilities in the same query class both
225
+ claim (no probe can assert a coin flip; give one of them a phrase of its own),
226
+ and capabilities with no probe (a capability that requires arguments cannot be
227
+ probed from a phrase alone, so write that one by hand with \`args\`). Edit the
228
+ phrasing to match how your visitors actually talk, then run \`audit\`. A miss on a
229
+ generated probe usually means the manifest still claims a phrasing that an
230
+ answer rule took over.
231
+
232
+ ## Done means
233
+
234
+ \`\`\`bash
235
+ npx boaz verify
236
+ npx boaz audit --probes agent-probes.json --module agent-setup.mjs
237
+ npx boaz bench --probes agent-probes.json --module agent-setup.mjs
238
+ \`\`\`
239
+
240
+ All three exit 0. If a new route is intentionally invisible to the assistant, say
241
+ so in the pull request instead of leaving an unexplained CAP008.
242
+
243
+ ## Failure modes this catches
244
+
245
+ | symptom | cause | fix |
246
+ | --- | --- | --- |
247
+ | "I'm not sure" for a supported thing | no capability description contains the visitor's words | rewrite the description, add keywords |
248
+ | a question runs the wrong action | two capabilities share a noun; no verb to separate them | give each its own verb and phrase |
249
+ | a bare noun answer ("No stack lists much.") | a rule matched on a quantifier | keep rules to question-shaped phrases |
250
+ | every phrasing answers identically | one \`compose\` string per intent | construction on the question, realisation on the hash |
251
+ | a phrasing with no content words is ignored | it tokenizes to nothing | \`match(query)\` on the rule |
252
+ | a tool is called for a question with nothing to look up | \`requiresSubject\` default | name it \`false\` for listing rules |
253
+ `;
254
+ //# sourceMappingURL=skill-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/cli/skill-template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4P5B,CAAC"}
@@ -0,0 +1,67 @@
1
+ export type ActionVerb = 'click' | 'fill' | 'scroll' | 'focus';
2
+ export interface ActionNode {
3
+ role: string;
4
+ /** Accessible name: aria-label, aria-labelledby text, or the text content. */
5
+ name?: string;
6
+ /** Region/landmark labels this node sits inside, outermost first. */
7
+ scopes?: string[];
8
+ /** aria-hidden, display:none, or inside either. Excluded, then reported. */
9
+ hidden?: boolean;
10
+ disabled?: boolean;
11
+ /** Current value of an input, when the host supplies it. */
12
+ value?: string;
13
+ children?: ActionNode[];
14
+ }
15
+ export interface ActionRequest {
16
+ verb: ActionVerb;
17
+ /** Canonical ARIA role the verb applies to, when the visitor named one. */
18
+ role?: string;
19
+ /** Accessible name as the visitor typed it, normalised later. */
20
+ name?: string;
21
+ /** 1-based among equally scored candidates; -1 means the last one. */
22
+ ordinal?: number;
23
+ /** Region label the visitor restricted the search to ("the chat panel"). */
24
+ scope?: string;
25
+ /** The target phrase as typed, used as weak evidence when it names no control. */
26
+ hint?: string;
27
+ /** Value to fill, for `fill`. */
28
+ text?: string;
29
+ }
30
+ export type ActionReason = 'resolved' | 'no-verb' | 'no-target' | 'ambiguous' | 'hidden' | 'disabled' | 'role-mismatch' | 'name-mismatch';
31
+ export interface ActionCandidate {
32
+ node: ActionNode;
33
+ index: number;
34
+ score: number;
35
+ }
36
+ export interface ActionResolution {
37
+ ok: boolean;
38
+ request?: ActionRequest;
39
+ node?: ActionNode;
40
+ index?: number;
41
+ score: number;
42
+ reason: ActionReason;
43
+ /** The right name on a role the verb does not act on, when there is one. */
44
+ nearMiss?: ActionNode;
45
+ /** Everything that scored above zero, best first, for the host to name. */
46
+ considered: ActionCandidate[];
47
+ }
48
+ /** Case, punctuation, articles and spacing: the only free variation in a name. */
49
+ export declare function normaliseName(input: string): string;
50
+ /**
51
+ * Read one sentence into an action request, or `null` when the sentence is not
52
+ * an action. Roles, ordinals and scopes come from closed tables; the name is
53
+ * whatever is left after those are removed, so a control whose name is new to
54
+ * the package still resolves.
55
+ */
56
+ export declare function parseAction(query: string): ActionRequest | null;
57
+ /** Walk a nested tree into the flat, document-ordered list the resolver wants. */
58
+ export declare function flattenTree(nodes: ActionNode[], scopes?: string[], hidden?: boolean): ActionNode[];
59
+ /**
60
+ * Resolve a request (or a sentence) against the tree. Refusals carry the reason
61
+ * and the candidates, so a host can say "two buttons are called Send" instead of
62
+ * clicking one and hoping.
63
+ */
64
+ export declare function resolveAction(input: ActionRequest | string, nodes: ActionNode[]): ActionResolution;
65
+ /** The sentence a host prints before it acts. One line, no jargon. */
66
+ export declare function describeResolution(resolution: ActionResolution): string;
67
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/core/actions.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,UAAU,GACV,eAAe,GACf,eAAe,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,2EAA2E;IAC3E,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAwDD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASnD;AAoBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CA4E/D;AAMD,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,MAAM,GAAE,MAAM,EAAO,EAAE,MAAM,UAAQ,GAAG,UAAU,EAAE,CAWpG;AASD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,GAAG,MAAM,EAC7B,KAAK,EAAE,UAAU,EAAE,GAClB,gBAAgB,CA2HlB;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,CA4BvE"}