agent-nuvira 2.6.14 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +4 -2
  2. package/dist/cli/chat.d.ts +2 -0
  3. package/dist/cli/chat.d.ts.map +1 -1
  4. package/dist/cli/chat.js +107 -4
  5. package/dist/cli/chat.js.map +1 -1
  6. package/dist/cli/eval.d.ts.map +1 -1
  7. package/dist/cli/eval.js +14 -1
  8. package/dist/cli/eval.js.map +1 -1
  9. package/dist/cli/execute.d.ts +8 -0
  10. package/dist/cli/execute.d.ts.map +1 -1
  11. package/dist/cli/execute.js +105 -1
  12. package/dist/cli/execute.js.map +1 -1
  13. package/dist/cli/loop-executor.d.ts +81 -0
  14. package/dist/cli/loop-executor.d.ts.map +1 -0
  15. package/dist/cli/loop-executor.js +246 -0
  16. package/dist/cli/loop-executor.js.map +1 -0
  17. package/dist/config/types.d.ts +18 -0
  18. package/dist/config/types.d.ts.map +1 -1
  19. package/dist/fresh.d.ts +2 -0
  20. package/dist/fresh.d.ts.map +1 -0
  21. package/dist/fresh.js +2 -0
  22. package/dist/fresh.js.map +1 -0
  23. package/dist/inference/anthropic-adapter.d.ts +9 -0
  24. package/dist/inference/anthropic-adapter.d.ts.map +1 -1
  25. package/dist/inference/anthropic-adapter.js +143 -0
  26. package/dist/inference/anthropic-adapter.js.map +1 -1
  27. package/dist/inference/gemini-adapter.d.ts +8 -0
  28. package/dist/inference/gemini-adapter.d.ts.map +1 -1
  29. package/dist/inference/gemini-adapter.js +145 -0
  30. package/dist/inference/gemini-adapter.js.map +1 -1
  31. package/dist/inference/model-probe.d.ts.map +1 -1
  32. package/dist/inference/model-probe.js +14 -0
  33. package/dist/inference/model-probe.js.map +1 -1
  34. package/dist/inference/native-tools.d.ts +226 -0
  35. package/dist/inference/native-tools.d.ts.map +1 -0
  36. package/dist/inference/native-tools.js +389 -0
  37. package/dist/inference/native-tools.js.map +1 -0
  38. package/dist/learning/auto-router.d.ts +36 -4
  39. package/dist/learning/auto-router.d.ts.map +1 -1
  40. package/dist/learning/auto-router.js +103 -2
  41. package/dist/learning/auto-router.js.map +1 -1
  42. package/dist/learning/context-pruner.d.ts.map +1 -1
  43. package/dist/learning/context-pruner.js +4 -2
  44. package/dist/learning/context-pruner.js.map +1 -1
  45. package/dist/learning/engine-router.d.ts +90 -0
  46. package/dist/learning/engine-router.d.ts.map +1 -0
  47. package/dist/learning/engine-router.js +128 -0
  48. package/dist/learning/engine-router.js.map +1 -0
  49. package/dist/learning/eval-framework.d.ts +42 -1
  50. package/dist/learning/eval-framework.d.ts.map +1 -1
  51. package/dist/learning/eval-framework.js +163 -7
  52. package/dist/learning/eval-framework.js.map +1 -1
  53. package/dist/learning/routing-cache.d.ts +64 -0
  54. package/dist/learning/routing-cache.d.ts.map +1 -0
  55. package/dist/learning/routing-cache.js +100 -0
  56. package/dist/learning/routing-cache.js.map +1 -0
  57. package/dist/tools/loop-project-context.d.ts +47 -0
  58. package/dist/tools/loop-project-context.d.ts.map +1 -0
  59. package/dist/tools/loop-project-context.js +210 -0
  60. package/dist/tools/loop-project-context.js.map +1 -0
  61. package/dist/tools/loop-skill-hint.d.ts +110 -0
  62. package/dist/tools/loop-skill-hint.d.ts.map +1 -0
  63. package/dist/tools/loop-skill-hint.js +266 -0
  64. package/dist/tools/loop-skill-hint.js.map +1 -0
  65. package/dist/tools/registry.d.ts +10 -0
  66. package/dist/tools/registry.d.ts.map +1 -1
  67. package/dist/tools/registry.js +66 -9
  68. package/dist/tools/registry.js.map +1 -1
  69. package/dist/tools/release-sync.d.ts.map +1 -1
  70. package/dist/tools/release-sync.js +5 -4
  71. package/dist/tools/release-sync.js.map +1 -1
  72. package/dist/tools/tool-loop.d.ts +28 -0
  73. package/dist/tools/tool-loop.d.ts.map +1 -1
  74. package/dist/tools/tool-loop.js +182 -6
  75. package/dist/tools/tool-loop.js.map +1 -1
  76. package/dist/tools/toolsets.d.ts +33 -0
  77. package/dist/tools/toolsets.d.ts.map +1 -1
  78. package/dist/tools/toolsets.js +84 -0
  79. package/dist/tools/toolsets.js.map +1 -1
  80. package/dist/web-dashboard/chat-console.d.ts +31 -0
  81. package/dist/web-dashboard/chat-console.d.ts.map +1 -1
  82. package/dist/web-dashboard/chat-console.js +73 -0
  83. package/dist/web-dashboard/chat-console.js.map +1 -1
  84. package/dist/web-dashboard/loop-turn-telemetry.d.ts +27 -0
  85. package/dist/web-dashboard/loop-turn-telemetry.d.ts.map +1 -0
  86. package/dist/web-dashboard/loop-turn-telemetry.js +43 -0
  87. package/dist/web-dashboard/loop-turn-telemetry.js.map +1 -0
  88. package/dist/web-dashboard/server.d.ts +62 -1
  89. package/dist/web-dashboard/server.d.ts.map +1 -1
  90. package/dist/web-dashboard/server.js +205 -4
  91. package/dist/web-dashboard/server.js.map +1 -1
  92. package/dist/web-dashboard/src/types.d.ts +44 -0
  93. package/dist/web-dashboard/src/types.d.ts.map +1 -1
  94. package/package.json +1 -1
  95. package/src/web-dashboard/public/assets/{index-Cg9LaToa.js → index-C4frng1Q.js} +79 -79
  96. package/src/web-dashboard/public/assets/{index-Cg9LaToa.js.map → index-C4frng1Q.js.map} +1 -1
  97. package/src/web-dashboard/public/assets/index-C507EUWf.css +1 -0
  98. package/src/web-dashboard/public/index.html +2 -2
  99. package/src/web-dashboard/public/assets/index-B47v8pr1.css +0 -1
@@ -0,0 +1,266 @@
1
+ /**
2
+ * Loop skill hint (`src/tools/loop-skill-hint.ts`) — AGENTIC_CAPABILITY_ASSESSMENT
3
+ * Addendum v4 Phase 3.2: "The loop never hears about the orchestrator's skill
4
+ * layer: the pipeline consults SkillStore.findMatch + the hub catalog before
5
+ * planning and injects the matched methodology, but a chat/execute-loop goal
6
+ * starts with zero knowledge that a first-party playbook exists."
7
+ *
8
+ * This module closes that parity gap DETERMINISTICALLY (no LLM call): given
9
+ * the user's goal, it finds the best available skill the SAME way the
10
+ * orchestrator does —
11
+ *
12
+ * 1. compiled SkillStore.findMatch (the first-party capability batch),
13
+ * 2. the hub catalog (findHubSkillMatch — installed SKILL.md skills),
14
+ *
15
+ * then returns a system-prompt block that hands the model the skill's
16
+ * methodology with an EXPLICIT escape hatch ("this is a recommendation —
17
+ * ignore it when it does not fit") and the exact load syntax
18
+ * (`skill` tool, {"skill":"<name>"}).
19
+ *
20
+ * Why an evidence filter on top of findMatch: the compiled store's threshold
21
+ * is intentionally low (score >= 1, "manual discovery") and its scoring adds
22
+ * a quality/usage bonus to EVERY skill — so a goal merely containing a generic
23
+ * pattern word ("goal", "task") can false-positive. The chat loop runs on
24
+ * EVERY message (not just pipeline goals), so the loop hint requires REAL
25
+ * goal evidence: a name-word or tag hit, or two pattern-word hits. The
26
+ * orchestrator does not need this (its planner only sees pipeline goals); the
27
+ * hub catalog's own scoring is keyword-based and needs no filter.
28
+ *
29
+ * Safety rails (mirroring the orchestrator's injection contract):
30
+ * - skills.disabled[] gate — a dashboard/CLI-disabled skill is NEVER
31
+ * injected (the same "the toggle is never cosmetic" rule the match gates
32
+ * enforce elsewhere).
33
+ * - Website-deploy activation gate — the orchestrator requires
34
+ * hosting-specific intent before injecting website methodology; the loop
35
+ * hint applies the identical regex so "deploy the API" does not drag in
36
+ * static-site deployment steps.
37
+ * - Side-effect-free matching: the match itself marks nothing; usage is
38
+ * marked ONCE via markLoopSkillUsed by the caller (skillView()'s internal
39
+ * markUsed is deliberately avoided so the hint builder is idempotent).
40
+ * - Bounded injection: at most ONE methodology block per prompt, and the
41
+ * methodology text itself is capped (compiled: 8 steps; hub: 2000 chars)
42
+ * so a crowded catalog cannot balloon the system prompt.
43
+ * - Best-effort by construction: any store/catalog failure returns '' /
44
+ * null and the turn proceeds exactly as before (a hint must never break
45
+ * a turn).
46
+ *
47
+ * Consumers: chat's runChatAnswer (system prompt) and the execute loop's
48
+ * runLoopExecutor — the two runToolLoop callers that had no skill knowledge.
49
+ */
50
+ /**
51
+ * Website-deploy activation gate — IDENTICAL to the orchestrator's
52
+ * (src/agents/orchestrator.ts §3c): a website-deployment skill (bundled OR
53
+ * hub-installed) is only injected when the goal carries hosting-specific
54
+ * intent. A generic "deploy the API" goal does NOT get website methodology.
55
+ */
56
+ const WEBSITE_DEPLOY_ID = /website[-_ ]?deploy/i;
57
+ const HOSTING_INTENT = /cloudflare|netlify|vercel|github\s*pages|hosting|pages\.dev|web\s*site|website|static\s*site|landing\s*page/i;
58
+ /**
59
+ * Meta-words that appear in generic goalPatterns but carry NO goal evidence
60
+ * ("compile a plan for this goal"). Excluded from pattern-word matching so a
61
+ * goal containing only meta-vocabulary can never match a skill.
62
+ */
63
+ const PATTERN_STOPWORDS = new Set([
64
+ 'goal', 'goals', 'task', 'tasks', 'skill', 'skills', 'step', 'steps',
65
+ 'plan', 'plans', 'planning', 'when', 'with', 'this', 'that', 'from',
66
+ 'into', 'user', 'users', 'want', 'wants', 'need', 'needs', 'request',
67
+ 'requests', 'help', 'make', 'using', 'used', 'work', 'works', 'some',
68
+ 'onto', 'over', 'your', 'their', 'them', 'then', 'also', 'each',
69
+ ]);
70
+ /** Cap on hub SKILL.md body text injected into the prompt (chars). */
71
+ const HUB_BODY_CAP = 2000;
72
+ /** Cap on compiled methodology steps injected into the prompt. */
73
+ const COMPILED_STEP_CAP = 8;
74
+ /** Cap on any single description line (chars). */
75
+ const LINE_CAP = 400;
76
+ /** The skills.disabled[] gate: a disabled skill is never injected. */
77
+ function isDisabled(id, cm) {
78
+ try {
79
+ const cfg = cm?.getAll?.();
80
+ const disabled = cfg?.skills?.disabled;
81
+ return Array.isArray(disabled) && disabled.includes(id);
82
+ }
83
+ catch {
84
+ return false; // config failure must not block matching (the injection is advisory)
85
+ }
86
+ }
87
+ /**
88
+ * Did the goal show REAL evidence for this skill — a name-word hit, a tag
89
+ * hit, or two pattern-word hits (meta-words excluded)? Guards the compiled
90
+ * store's intentionally loose threshold: findMatch adds a quality/usage bonus
91
+ * to every skill, so a generic word like "goal" alone must never inject
92
+ * methodology into a chat turn. Deterministic, no LLM.
93
+ */
94
+ export function hasRealGoalEvidence(goal, skill) {
95
+ const q = goal.toLowerCase();
96
+ if (!q)
97
+ return false;
98
+ let nameHits = 0;
99
+ for (const word of skill.name.toLowerCase().split(/[^a-z0-9]+/)) {
100
+ if (word.length > 3 && q.includes(word))
101
+ nameHits++;
102
+ }
103
+ let tagHits = 0;
104
+ for (const tag of skill.tags) {
105
+ const t = tag.toLowerCase().trim();
106
+ if (t.length > 3 && q.includes(t))
107
+ tagHits++;
108
+ }
109
+ let patternHits = 0;
110
+ for (const word of skill.goalPattern.toLowerCase().split(/\s+/)) {
111
+ const w = word.trim();
112
+ if (w.length > 3 && !PATTERN_STOPWORDS.has(w) && q.includes(w))
113
+ patternHits++;
114
+ }
115
+ return nameHits >= 1 || tagHits >= 1 || patternHits >= 2;
116
+ }
117
+ /**
118
+ * Find the best skill for the goal across BOTH sources the orchestrator
119
+ * consults, honoring the disabled + website-deploy activation gates (+ the
120
+ * compiled evidence filter). Compiled wins ties (its id is the deterministic
121
+ * seed id). Returns null when nothing matches (never a forced match).
122
+ */
123
+ export async function findLoopSkillMatch(goal, cm) {
124
+ const q = (goal || '').trim();
125
+ if (!q)
126
+ return null;
127
+ // 1. Compiled store (the first-party capability batch).
128
+ try {
129
+ const { getSkillStore } = await import('../learning/skill-store.js');
130
+ const match = getSkillStore().findMatch(q);
131
+ if (match && !isDisabled(match.id, cm) && hasRealGoalEvidence(q, match)) {
132
+ // Activation gate: website-deploy methodology needs hosting intent.
133
+ if (!(WEBSITE_DEPLOY_ID.test(match.id) || WEBSITE_DEPLOY_ID.test(match.name)) || HOSTING_INTENT.test(q)) {
134
+ return { name: match.name, id: match.id, source: 'compiled' };
135
+ }
136
+ }
137
+ }
138
+ catch {
139
+ // Fall through to the hub catalog — a store failure must not block it.
140
+ }
141
+ // 2. Hub catalog (installed SKILL.md skills — first-class runtime
142
+ // capabilities; a fresh `nuvira skills install` is matchable with zero
143
+ // recompilation, exactly like the orchestrator's fallback path). Its
144
+ // scoring is pure keyword evidence (score >= 1), no filter needed.
145
+ try {
146
+ const { findHubSkillMatch } = await import('../learning/hub-skill-catalog.js');
147
+ const hub = findHubSkillMatch(q, cm);
148
+ if (hub && !isDisabled(hub.id, cm)) {
149
+ if (!(WEBSITE_DEPLOY_ID.test(hub.id) || WEBSITE_DEPLOY_ID.test(hub.name)) || HOSTING_INTENT.test(q)) {
150
+ return { name: hub.name, id: hub.id, source: 'hub' };
151
+ }
152
+ }
153
+ }
154
+ catch {
155
+ // Best-effort — a catalog failure leaves no hint.
156
+ }
157
+ return null;
158
+ }
159
+ /**
160
+ * Bounded, side-effect-free methodology text for a compiled skill (the full
161
+ * Skill shape is fetched via the public get(); step descriptions carry the
162
+ * Level-2 methodology). Deliberately NOT store.skillView() — that marks the
163
+ * skill used as a side effect and renders reference-doc/quality sections the
164
+ * prompt block does not need.
165
+ */
166
+ function formatCompiledMethodology(skill) {
167
+ const lines = [];
168
+ if (skill.description)
169
+ lines.push(cap(skill.description));
170
+ if (skill.parameters.length > 0) {
171
+ lines.push('Parameters: ' +
172
+ skill.parameters
173
+ .map((p) => `${p.name}${p.required ? '' : ' (optional)'}`)
174
+ .join(', '));
175
+ }
176
+ const steps = skill.steps.slice(0, COMPILED_STEP_CAP);
177
+ steps.forEach((s, i) => {
178
+ lines.push(`Step ${i + 1} [${s.agentType}]: ${cap(s.description)}`);
179
+ });
180
+ if (skill.steps.length > steps.length) {
181
+ lines.push(`(+${skill.steps.length - steps.length} more steps — load the skill for the full methodology)`);
182
+ }
183
+ return lines.join('\n');
184
+ }
185
+ function cap(text, max = LINE_CAP) {
186
+ const t = text.trim();
187
+ return t.length > max ? t.slice(0, max - 1) + '…' : t;
188
+ }
189
+ /**
190
+ * Build the system-prompt block for a matched skill, or '' when there is no
191
+ * match. The block follows the orchestrator's injection contract:
192
+ *
193
+ * - the skill is a RECOMMENDATION, the model still owns the plan (the
194
+ * orchestrator's "model-selected activation" phrasing),
195
+ * - the methodology rides in as Level-2 content (progressive disclosure —
196
+ * the model sees the steps without paying a tool call for them),
197
+ * - the exact load syntax is included so the model can refresh/parameterize
198
+ * via the `skill` tool mid-turn,
199
+ * - ONE block max (bounded system-prompt growth).
200
+ *
201
+ * Marks nothing: usage tracking belongs to markLoopSkillUsed (the caller
202
+ * decides when a match actually got USED — i.e. was injected).
203
+ *
204
+ * @param goal the user's goal text (matched against skill triggers)
205
+ * @param cm ConfigManager for the disabled-skills gate (optional)
206
+ * @param injected out-param: when provided, receives the match that was
207
+ * injected (null when none).
208
+ */
209
+ export async function buildLoopSkillHint(goal, cm, injected) {
210
+ const match = await findLoopSkillMatch(goal, cm).catch(() => null);
211
+ if (injected)
212
+ injected.value = match;
213
+ if (!match)
214
+ return '';
215
+ // Full methodology (Level 2). Compiled: the stored Skill (steps carry the
216
+ // methodology). Hub: the SKILL.md body.
217
+ let methodology = '';
218
+ if (match.source === 'hub') {
219
+ try {
220
+ const { findHubSkillMatch } = await import('../learning/hub-skill-catalog.js');
221
+ methodology = cap(findHubSkillMatch(goal, cm)?.body ?? '', HUB_BODY_CAP);
222
+ }
223
+ catch {
224
+ methodology = '';
225
+ }
226
+ }
227
+ else {
228
+ try {
229
+ const { getSkillStore } = await import('../learning/skill-store.js');
230
+ methodology = formatCompiledMethodology(getSkillStore().get(match.id));
231
+ }
232
+ catch {
233
+ methodology = '';
234
+ }
235
+ }
236
+ const lines = [
237
+ '',
238
+ '## Matched skill',
239
+ `A first-party skill matches this goal: **${match.name}** (${match.source} skill, id ${match.id}).`,
240
+ 'This is a RECOMMENDATION — follow it when it fits the request; ignore it when it does not (you still own the plan).',
241
+ ];
242
+ if (methodology) {
243
+ lines.push('', 'Its methodology:', '', methodology);
244
+ }
245
+ lines.push('', `To (re)load it with parameters mid-turn, call the skill tool with {"skill":"${match.name}"}.`);
246
+ return lines.join('\n');
247
+ }
248
+ /**
249
+ * Mark an injected skill as used (usage tracking parity with the orchestrator
250
+ * — compiled skills only; hub skills have no compiled usage counter). The
251
+ * SINGLE usage marker for the loop hint path (the hint builder never marks).
252
+ * Best-effort, fire-and-forget: never throws, never awaited by callers on the
253
+ * hot path.
254
+ */
255
+ export async function markLoopSkillUsed(match) {
256
+ if (!match || match.source !== 'compiled')
257
+ return;
258
+ try {
259
+ const { getSkillStore } = await import('../learning/skill-store.js');
260
+ getSkillStore().markUsed(match.id);
261
+ }
262
+ catch {
263
+ // Best-effort.
264
+ }
265
+ }
266
+ //# sourceMappingURL=loop-skill-hint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-skill-hint.js","sourceRoot":"","sources":["../../src/tools/loop-skill-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAeH;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,MAAM,cAAc,GAAG,8GAA8G,CAAC;AAEtI;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO;IACpE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACnE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;IACpE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IACpE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAChE,CAAC,CAAC;AAEH,sEAAsE;AACtE,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,kDAAkD;A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1B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAgC;IACtE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO;IAClD,IAAI,CAAC;QACH,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QACrE,aAAa,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;AACH,CAAC"}
@@ -122,6 +122,16 @@ export interface ToolContext {
122
122
  * throws).
123
123
  */
124
124
  planStore?: import('./plan-store.js').PlanStoreLike;
125
+ /**
126
+ * Tiered tool exposure (AGENTIC_CAPABILITY_ASSESSMENT Addendum v3/v4):
127
+ * when the loop runs in 'tiered' mode, tools outside the CORE set are
128
+ * hidden from the model's schema until loaded. A `tool_search` load action
129
+ * writes the loaded toolset names here; the tool loop reads this AFTER
130
+ * each tool execution and unions the loaded toolsets' tool schemas into
131
+ * the live set before the next model step. Optional — absent contexts
132
+ * (tests, non-tiered callers) simply never extend the schema set.
133
+ */
134
+ loadedExtraTools?: Set<string>;
125
135
  }
126
136
  /** A clarify-style choice. */
127
137
  export interface AskUserChoice {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,CAAC,EAAgB,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAKpD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAElE,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC,MAAM,EAA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AAMH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAE7C;AAED,8BAA8B;AAC9B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEtD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,IAAI,IAAI,EAAE,CAElC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAOtE;AAID;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0iHAgB8R,CAAC;AAEzT,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,kyHAK2C,CAAC;AAgf3E;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAqBvE"}
@@ -1598,24 +1598,81 @@ registerTool({
1598
1598
  }),
1599
1599
  });
1600
1600
  // ─── Batch 5: Infrastructure ──────────────────────────────────────────────
1601
- // Tool search tool
1601
+ // Tool search tool — the tiered-exposure discovery surface. Two actions:
1602
+ // - search (default): fuzzy-find tools by query (the pre-existing behavior).
1603
+ // - load: LOAD a whole toolset's tools into the CURRENT turn's model schema
1604
+ // (tiered exposure — assessment Addendum v3/v4). Writes the toolset's tool
1605
+ // names into ctx.loadedExtraTools; the tool loop unions them into the live
1606
+ // schema set before the next model step. Domain tools (media, browser,
1607
+ // channels, docker, …) stay out of every turn's schema until this runs —
1608
+ // ~85% of per-turn schema tokens saved, zero capability lost.
1602
1609
  registerTool({
1603
1610
  name: 'tool_search',
1604
- description: 'Search tools by query with fuzzy matching.',
1611
+ description: 'Discover and load tools. Actions: "search" fuzzy-finds tools by query; ' +
1612
+ '"load" activates a whole toolset (media, browser, channels, docker, ' +
1613
+ 'productivity, publish, core-pipeline, …) for THIS turn — call it before ' +
1614
+ 'using any tool outside the always-available core set. "load" returns ' +
1615
+ 'the toolset\'s tool names, which become callable immediately.',
1605
1616
  category: 'workflow',
1606
1617
  inputSchema: z.object({
1607
- query: z.string().describe('Search query'),
1608
- limit: z.number().optional().describe('Max results'),
1618
+ action: z.enum(['search', 'load']).optional().describe('Defaults to "search".'),
1619
+ query: z.string().optional().describe('Search query (action=search)'),
1620
+ limit: z.number().optional().describe('Max results (action=search)'),
1621
+ toolset: z.string().optional().describe('Toolset name to load (action=load) — e.g. "media", "browser", "channels"'),
1609
1622
  }),
1610
1623
  endsAgentStep: false,
1611
- run: (args) => import('./infra-tools.js').then((m) => {
1612
- const { query, limit } = args;
1624
+ run: async (args, ctx) => {
1625
+ const { action = 'search', query, limit, toolset } = args;
1626
+ // ── load: activate a toolset for this turn (tiered exposure) ──
1627
+ if (action === 'load') {
1628
+ if (!toolset) {
1629
+ // No toolset named — return the CATALOG so the model can pick one.
1630
+ // All enabled toolsets are listed; loading one whose tools are
1631
+ // already core-exposed is a harmless idempotent union.
1632
+ const { getToolsetStatus } = await import('./toolsets.js');
1633
+ const status = getToolsetStatus(ctx?.configManager)
1634
+ .filter((s) => s.enabled)
1635
+ .map((s) => ({ name: s.name, label: s.label, tools: s.tools }));
1636
+ return JSON.stringify({
1637
+ loaded: false,
1638
+ message: 'No toolset named. Loadable toolsets (call again with action:"load", toolset:<name>):',
1639
+ toolsets: status,
1640
+ });
1641
+ }
1642
+ const { TOOLSETS, isToolEnabled } = await import('./toolsets.js');
1643
+ const def = TOOLSETS.find((t) => t.name === toolset);
1644
+ if (!def) {
1645
+ const names = TOOLSETS.map((t) => t.name).join(', ');
1646
+ return `Error: unknown toolset "${toolset}". Available: ${names}.`;
1647
+ }
1648
+ // A user-disabled toolset must not resurrect through the load path —
1649
+ // the I1 enablement gate stays the single source of truth.
1650
+ if (!isToolEnabled(def.tools[0], ctx?.configManager)) {
1651
+ return `Error: toolset "${toolset}" is disabled by configuration — enable it with \`nuvira tools toolsets\` first.`;
1652
+ }
1653
+ const already = ctx?.loadedExtraTools instanceof Set ? ctx.loadedExtraTools : undefined;
1654
+ if (already) {
1655
+ for (const name of def.tools)
1656
+ already.add(name);
1657
+ }
1658
+ return JSON.stringify({
1659
+ loaded: true,
1660
+ toolset: def.name,
1661
+ label: def.label,
1662
+ tools: def.tools,
1663
+ note: already
1664
+ ? 'Tools are now callable this turn.'
1665
+ : 'Toolset recorded, but this context has no live schema loader (loop not in tiered mode) — tools remain governed by the standard enablement gate.',
1666
+ });
1667
+ }
1668
+ // ── search: the pre-existing fuzzy find (unchanged behavior) ──
1669
+ const m = await import('./infra-tools.js');
1613
1670
  const engine = m.getToolSearchEngine();
1614
1671
  // Index from registry
1615
- const { listTools } = require('./registry.js');
1672
+ const { listTools } = await import('./registry.js');
1616
1673
  engine.index(listTools().map((t) => ({ name: t.name, description: t.description })));
1617
- return JSON.stringify(engine.search(query, limit || 10));
1618
- }),
1674
+ return JSON.stringify(engine.search(query || '', limit || 10));
1675
+ },
1619
1676
  });
1620
1677
  // Budget config tool
1621
1678
  registerTool({