@shobyde/boaz 0.0.0-stage → 0.8.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.
Files changed (163) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +402 -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,145 @@
1
+ function lowerFirst(text) {
2
+ return text.charAt(0).toLowerCase() + text.slice(1);
3
+ }
4
+ /** "opened the archive, then copied your email" */
5
+ function phraseRan(executed) {
6
+ const titles = executed.map((step) => lowerFirst(step.title || step.capabilityId));
7
+ if (titles.length === 1)
8
+ return titles[0];
9
+ if (titles.length === 2)
10
+ return `${titles[0]}, then ${titles[1]}`;
11
+ return `${titles.slice(0, -1).join(', ')}, then ${titles[titles.length - 1]}`;
12
+ }
13
+ /**
14
+ * What counts as "the capability came back with nothing". Only a handler that
15
+ * produced no value at all: `undefined`, `null` or an empty string. An empty
16
+ * array is an answer ("no project lists Cobol"), and recovering from it would
17
+ * overwrite a correct result with an unrelated one.
18
+ */
19
+ export function isEmptyResult(value) {
20
+ return value === undefined || value === null || value === '';
21
+ }
22
+ export async function executePlan(plan, options) {
23
+ const maxSteps = Math.max(1, options.maxSteps ?? 4);
24
+ const maxAlternates = Math.max(0, options.maxAlternates ?? 2);
25
+ const executed = [];
26
+ const ran = [];
27
+ const skipped = [];
28
+ const notes = [];
29
+ const record = (step) => {
30
+ executed.push(step);
31
+ return step;
32
+ };
33
+ for (const step of plan.steps) {
34
+ const base = { capabilityId: step.capabilityId, title: step.title, text: step.text };
35
+ if (failedAt(executed)) {
36
+ skipped.push({ step: record({ ...base, status: 'skipped', reason: 'previous-failed' }), reason: 'previous-failed' });
37
+ continue;
38
+ }
39
+ if (ran.length >= maxSteps) {
40
+ skipped.push({ step: record({ ...base, status: 'skipped', reason: 'step-limit' }), reason: 'step-limit' });
41
+ continue;
42
+ }
43
+ // A step that needs an argument its clause never stated is not runnable, and
44
+ // guessing one is how a plan opens the wrong card.
45
+ if (step.needs === 'args') {
46
+ skipped.push({
47
+ step: record({ ...base, status: 'skipped', reason: 'missing-argument' }),
48
+ reason: 'missing-argument',
49
+ });
50
+ continue;
51
+ }
52
+ // The step acts on a page an earlier step opens. If that navigation did not
53
+ // land, the control is not mounted and running it would throw.
54
+ if (step.needs === 'route') {
55
+ const now = options.currentRoute?.();
56
+ const wanted = step.route ?? null;
57
+ if (!now || (wanted && now !== wanted)) {
58
+ skipped.push({
59
+ step: record({ ...base, status: 'skipped', reason: 'not-on-route' }),
60
+ reason: 'not-on-route',
61
+ });
62
+ continue;
63
+ }
64
+ }
65
+ const candidates = [
66
+ { capabilityId: step.capabilityId, title: step.title, kind: step.kind, args: step.args, primary: true },
67
+ ...(options.recover === false ? [] : (step.alternates ?? []).slice(0, maxAlternates)),
68
+ ];
69
+ const attempts = [];
70
+ let finished;
71
+ for (const candidate of candidates) {
72
+ const candidateStep = candidate.primary
73
+ ? step
74
+ : { ...step, capabilityId: candidate.capabilityId, title: candidate.title, kind: candidate.kind, args: candidate.args };
75
+ // An empty result is only a failure when there is another candidate left to
76
+ // serve the clause; with nothing to fall back to it is the answer.
77
+ const recoverable = candidates.length > 1 && candidate !== candidates[candidates.length - 1];
78
+ try {
79
+ const runner = candidate.primary ? options.run : options.runAlternate ?? options.run;
80
+ const result = await runner(candidateStep);
81
+ if (isEmptyResult(result) && recoverable) {
82
+ attempts.push({ capabilityId: candidate.capabilityId, outcome: 'empty' });
83
+ continue;
84
+ }
85
+ finished = record({
86
+ ...base,
87
+ capabilityId: candidate.capabilityId,
88
+ title: candidate.title,
89
+ status: 'ran',
90
+ ...(result === undefined ? {} : { result }),
91
+ ...(attempts.length > 0 ? { attempts: [...attempts] } : {}),
92
+ });
93
+ ran.push(finished);
94
+ break;
95
+ }
96
+ catch (error) {
97
+ const message = error instanceof Error ? error.message : String(error);
98
+ attempts.push({ capabilityId: candidate.capabilityId, outcome: 'threw', error: message });
99
+ }
100
+ }
101
+ if (!finished) {
102
+ const last = attempts[attempts.length - 1];
103
+ record({
104
+ ...base,
105
+ status: 'failed',
106
+ ...(last?.error ? { error: last.error } : { error: 'returned nothing' }),
107
+ ...(attempts.length > 1 ? { attempts: [...attempts] } : {}),
108
+ });
109
+ // Keep walking so the record names every step the failure cost, instead of
110
+ // ending the report at the one that broke.
111
+ continue;
112
+ }
113
+ if (attempts.length > 0) {
114
+ const first = attempts[0];
115
+ const reason = first.outcome === 'threw' ? 'failed' : 'returned nothing';
116
+ notes.push(`${lowerFirst(step.title || step.capabilityId)} ${reason}, so I tried ${lowerFirst(finished.title || finished.capabilityId)} instead.`);
117
+ }
118
+ }
119
+ const failed = executed.find((step) => step.status === 'failed');
120
+ const ok = !failed && skipped.length === 0 && ran.length === plan.steps.length;
121
+ const parts = [];
122
+ if (ran.length > 0) {
123
+ parts.push(`I did ${ran.length === 1 ? 'one thing' : `${ran.length} things`}: ${phraseRan(ran)}.`);
124
+ }
125
+ parts.push(...notes);
126
+ for (const { step, reason } of skipped) {
127
+ const name = lowerFirst(step.title || step.capabilityId);
128
+ if (reason === 'missing-argument')
129
+ parts.push(`I did not run ${name}, because the sentence never said which one.`);
130
+ else if (reason === 'not-on-route')
131
+ parts.push(`I did not run ${name}, because the page it needs did not open.`);
132
+ else if (reason === 'previous-failed')
133
+ parts.push(`${name} did not run.`);
134
+ else
135
+ parts.push(`I stopped before ${name}.`);
136
+ }
137
+ if (failed) {
138
+ parts.push(`${lowerFirst(failed.title || failed.capabilityId)} failed: ${failed.error ?? 'unknown error'}.`);
139
+ }
140
+ return { steps: executed, summary: parts.join(' '), ok, ...(failed ? { failedAt: failed.capabilityId } : {}) };
141
+ }
142
+ function failedAt(executed) {
143
+ return executed.some((step) => step.status === 'failed');
144
+ }
145
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/core/execute.ts"],"names":[],"mappings":"AA+EA,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,mDAAmD;AACnD,SAAS,SAAS,CAAC,QAAwB;IACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACnF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,OAAO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C,CAAC;IACrB,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,MAAM,KAAK,kBAAkB;YAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,8CAA8C,CAAC,CAAC;aAC9G,IAAI,MAAM,KAAK,cAAc;YAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,2CAA2C,CAAC,CAAC;aAC5G,IAAI,MAAM,KAAK,iBAAiB;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC;;YACrE,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,YAAY,CAAC,YAAY,MAAM,CAAC,KAAK,IAAI,eAAe,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACjH,CAAC;AAED,SAAS,QAAQ,CAAC,QAAwB;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,35 @@
1
+ export * from './types.js';
2
+ export { defineCapability, defineKnowledge, toManifestCapability, CapabilityDefinitionError } from './define.js';
3
+ export { CapabilityRegistry, registry, registerCapability } from './registry.js';
4
+ export type { RegistryLookup } from './registry.js';
5
+ export { validateParams, formatSchemaErrors, unsupportedKeywords, SUPPORTED_KEYWORDS, IGNORED_KEYWORDS, } from './schema.js';
6
+ export type { SchemaErrorDetail, SchemaValidation } from './schema.js';
7
+ export { tokenize, CapabilityIndex, createCapabilityIndex } from './retriever.js';
8
+ export { analyzeQuestion } from './question.js';
9
+ export { summarise, splitSentences } from './summarise.js';
10
+ export { planRequest, routeRequest } from './plan.js';
11
+ export { createToolServer, createToolClient, toolsFromCapabilities, planToolCall, toolName } from './mcp.js';
12
+ export type { JsonRpcRequest, JsonRpcResponse, JsonRpcError, JsonRpcId, ToolDefinition, ToolCallResult, ToolServer, ToolServerOptions, ToolClient, ToolPlan, PlannedToolCall, PlanToolOptions, } from './mcp.js';
13
+ export { matchSkill, selectSkill, runSkill } from './skill.js';
14
+ export type { Skill, SkillStep, SkillCheck, SkillCheckKind, SkillRun, SkillStepRecord, SkillCheckRecord, RunSkillOptions } from './skill.js';
15
+ export { executePlan } from './execute.js';
16
+ export { createPreferenceMemory } from './preferences.js';
17
+ export type { PreferenceDeclaration, PreferenceMemory, PreferenceRecordOptions, StatedPreference, } from './preferences.js';
18
+ export { createWorkingMemory, isCoverageQuery } from './memory.js';
19
+ export { parseAction, resolveAction, describeResolution, flattenTree, normaliseName } from './actions.js';
20
+ export type { ActionNode, ActionRequest, ActionResolution, ActionCandidate, ActionVerb, ActionReason, } from './actions.js';
21
+ export type { WorkingMemory, WorkingMemoryOptions, MemoryTurn, SalientEntity, SalientTopic, Coverage, ObserveOptions, } from './memory.js';
22
+ export type { PlanExecution, ExecutedStep, ExecuteOptions, StepStatus, SkipReason, } from './execute.js';
23
+ export type { SummarySentence, SummaryPick, SummaryOptions, SummaryResult, } from './summarise.js';
24
+ export { LEMMAS, DOMAIN_SYNONYMS, canonicalTerm } from './lemmas.js';
25
+ export type { Combine, QuestionAnalysis, QuestionSlots, QuestionType, AnalyzeOptions, Reference } from './question.js';
26
+ export type { PlannedStep, RequestPlan, PlanOptions } from './plan.js';
27
+ export type { ScoredCapability, RetrieverOptions } from './retriever.js';
28
+ export { buildSystemPrompt, buildToolSpecs, estimateTokens } from './prompt.js';
29
+ export type { PromptInput } from './prompt.js';
30
+ export { parseModelOutput, parseNativeToolCall } from './tools.js';
31
+ export type { ParsedModelOutput } from './tools.js';
32
+ export { AgentRuntime, chunkForDisplay } from './loop.js';
33
+ export { createLexicalEngine } from './lexical-engine.js';
34
+ export type { LexicalEngineOptions } from './lexical-engine.js';
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7G,YA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BAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACvH,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export * from './types.js';
2
+ export { defineCapability, defineKnowledge, toManifestCapability, CapabilityDefinitionError } from './define.js';
3
+ export { CapabilityRegistry, registry, registerCapability } from './registry.js';
4
+ export { validateParams, formatSchemaErrors, unsupportedKeywords, SUPPORTED_KEYWORDS, IGNORED_KEYWORDS, } from './schema.js';
5
+ export { tokenize, CapabilityIndex, createCapabilityIndex } from './retriever.js';
6
+ export { analyzeQuestion } from './question.js';
7
+ export { summarise, splitSentences } from './summarise.js';
8
+ export { planRequest, routeRequest } from './plan.js';
9
+ export { createToolServer, createToolClient, toolsFromCapabilities, planToolCall, toolName } from './mcp.js';
10
+ export { matchSkill, selectSkill, runSkill } from './skill.js';
11
+ export { executePlan } from './execute.js';
12
+ export { createPreferenceMemory } from './preferences.js';
13
+ export { createWorkingMemory, isCoverageQuery } from './memory.js';
14
+ export { parseAction, resolveAction, describeResolution, flattenTree, normaliseName } from './actions.js';
15
+ export { LEMMAS, DOMAIN_SYNONYMS, canonicalTerm } from './lemmas.js';
16
+ export { buildSystemPrompt, buildToolSpecs, estimateTokens } from './prompt.js';
17
+ export { parseModelOutput, parseNativeToolCall } from './tools.js';
18
+ export { AgentRuntime, chunkForDisplay } from './loop.js';
19
+ export { createLexicalEngine } from './lexical-engine.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAe7G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAO1D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA+B1G,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIrE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A bundled vocabulary, not a model.
3
+ *
4
+ * A visitor does not use the app's words. A capability is titled "project
5
+ * stack" and the visitor types "toolset"; the page declares "JavaScript" and
6
+ * they type "js"; the rule says "written" and they say "shipped". Every one of
7
+ * those is a lookup, not an inference, so it belongs in a table that ships with
8
+ * the library and can be read, tested and argued with.
9
+ *
10
+ * Keys are the tokens `tokenize()` emits, not the surface words: tokenize stems
11
+ * plurals and splits camel case, so "PostgreSQL" is `postgre` + `sql` and
12
+ * "postgres" is `postgr`. Writing the table in surface form would make it a
13
+ * second tokenizer, which is exactly the bug that cost 0.5.1 (constants matched
14
+ * through a different split than the retriever used). `test/question.test.ts`
15
+ * asserts every key round-trips through `tokenize()` so a surface word cannot
16
+ * be mistaken for a token.
17
+ *
18
+ * `LEMMAS` is generic English morphology plus technology aliases; it applies to
19
+ * entity matching and attribute lookup alike. `DOMAIN_SYNONYMS` only maps words
20
+ * onto an attribute name the app already declares, so it can never make a
21
+ * sentence name an entity it did not name.
22
+ */
23
+ export declare const LEMMAS: Record<string, string>;
24
+ /**
25
+ * Words that mean an attribute the app already declares. The value must be a
26
+ * name in the app's attribute table (stack, writing, contact, identity, ...);
27
+ * anything else is a typo that would silently drop the word from `mentions`.
28
+ */
29
+ export declare const DOMAIN_SYNONYMS: Record<string, string>;
30
+ /** The canonical token for a query token, or the token unchanged. */
31
+ export declare function canonicalTerm(token: string): string;
32
+ //# sourceMappingURL=lemmas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lemmas.d.ts","sourceRoot":"","sources":["../../src/core/lemmas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmCzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWlD,CAAC;AAEF,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A bundled vocabulary, not a model.
3
+ *
4
+ * A visitor does not use the app's words. A capability is titled "project
5
+ * stack" and the visitor types "toolset"; the page declares "JavaScript" and
6
+ * they type "js"; the rule says "written" and they say "shipped". Every one of
7
+ * those is a lookup, not an inference, so it belongs in a table that ships with
8
+ * the library and can be read, tested and argued with.
9
+ *
10
+ * Keys are the tokens `tokenize()` emits, not the surface words: tokenize stems
11
+ * plurals and splits camel case, so "PostgreSQL" is `postgre` + `sql` and
12
+ * "postgres" is `postgr`. Writing the table in surface form would make it a
13
+ * second tokenizer, which is exactly the bug that cost 0.5.1 (constants matched
14
+ * through a different split than the retriever used). `test/question.test.ts`
15
+ * asserts every key round-trips through `tokenize()` so a surface word cannot
16
+ * be mistaken for a token.
17
+ *
18
+ * `LEMMAS` is generic English morphology plus technology aliases; it applies to
19
+ * entity matching and attribute lookup alike. `DOMAIN_SYNONYMS` only maps words
20
+ * onto an attribute name the app already declares, so it can never make a
21
+ * sentence name an entity it did not name.
22
+ */
23
+ export const LEMMAS = {
24
+ // Inflection the stemmer does not fold. `shipped` stays `shipped`, `built`
25
+ // stays `built`, so a capability keyworded "ship" or "build" misses the past
26
+ // tense, which is the tense visitors use about finished work.
27
+ shipped: 'ship',
28
+ shipping: 'ship',
29
+ built: 'build',
30
+ building: 'build',
31
+ used: 'use',
32
+ using: 'use',
33
+ // `tokenize()` reads "writes" as `writ` (it strips a trailing "es" from any
34
+ // word longer than four letters), so both spellings have to be listed.
35
+ writ: 'write',
36
+ wrote: 'write',
37
+ written: 'write',
38
+ writing: 'write',
39
+ made: 'make',
40
+ making: 'make',
41
+ leverage: 'use',
42
+ leverag: 'use',
43
+ leveraged: 'use',
44
+ utilise: 'use',
45
+ utilis: 'use',
46
+ utilised: 'use',
47
+ utilize: 'use',
48
+ utiliz: 'use',
49
+ utilized: 'use',
50
+ // Abbreviations a developer types about their own stack. Kept short and
51
+ // word-level: "chart" is not "ts", "json" is not "js".
52
+ js: 'javascript',
53
+ ts: 'typescript',
54
+ postgr: 'postgresql',
55
+ postgre: 'postgresql',
56
+ k8s: 'kubernetes',
57
+ nodejs: 'node',
58
+ };
59
+ /**
60
+ * Words that mean an attribute the app already declares. The value must be a
61
+ * name in the app's attribute table (stack, writing, contact, identity, ...);
62
+ * anything else is a typo that would silently drop the word from `mentions`.
63
+ */
64
+ export const DOMAIN_SYNONYMS = {
65
+ toolset: 'stack',
66
+ toolchain: 'stack',
67
+ tooling: 'stack',
68
+ bio: 'identity',
69
+ background: 'identity',
70
+ experience: 'identity',
71
+ touch: 'contact',
72
+ dm: 'contact',
73
+ portfolio: 'projects',
74
+ essay: 'writing',
75
+ };
76
+ /** The canonical token for a query token, or the token unchanged. */
77
+ export function canonicalTerm(token) {
78
+ return LEMMAS[token] ?? token;
79
+ }
80
+ //# sourceMappingURL=lemmas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lemmas.js","sourceRoot":"","sources":["../../src/core/lemmas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,MAAM,GAA2B;IAC5C,2EAA2E;IAC3E,6EAA6E;IAC7E,8DAA8D;IAC9D,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,KAAK;IACZ,4EAA4E;IAC5E,uEAAuE;IACvE,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,wEAAwE;IACxE,uDAAuD;IACvD,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,MAAM;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,OAAO;IAChB,GAAG,EAAE,UAAU;IACf,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,SAAS;IAChB,EAAE,EAAE,SAAS;IACb,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,qEAAqE;AACrE,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAChC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { AgentEngine, ManifestCapability } from './types.js';
2
+ export interface LexicalEngineOptions {
3
+ capabilities: ManifestCapability[];
4
+ /** Minimum BM25 score before a capability is called. Default 0.9. */
5
+ threshold?: number;
6
+ /** How far ahead of the runner-up the top match must be. Default 1.25. */
7
+ margin?: number;
8
+ }
9
+ /**
10
+ * Deterministic engine that answers from the capability index.
11
+ *
12
+ * It is the no-model fallback and the reference implementation of the tool
13
+ * protocol: same messages in, same JSON out, no download and no GPU. When the
14
+ * request is unambiguous it navigates or calls the action; when it is not, it
15
+ * asks instead of guessing.
16
+ */
17
+ export declare function createLexicalEngine(options: LexicalEngineOptions): AgentEngine;
18
+ //# sourceMappingURL=lexical-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexical-engine.d.ts","sourceRoot":"","sources":["../../src/core/lexical-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmC,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGnG,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA8JD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,WAAW,CA6I9E"}