dino-spec 13.5.0 → 13.6.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 (99) hide show
  1. package/README.md +2 -47
  2. package/bin/dino-hud.js +0 -0
  3. package/bin/dino.js +0 -0
  4. package/dist/commands/hud.d.ts +8 -1
  5. package/dist/commands/hud.d.ts.map +1 -1
  6. package/dist/commands/hud.js +18 -4
  7. package/dist/commands/hud.js.map +1 -1
  8. package/dist/core/config/feature-flags.d.ts +0 -15
  9. package/dist/core/config/feature-flags.d.ts.map +1 -1
  10. package/dist/core/config/feature-flags.js +0 -3
  11. package/dist/core/config/feature-flags.js.map +1 -1
  12. package/dist/core/context/context-health.d.ts +2 -27
  13. package/dist/core/context/context-health.d.ts.map +1 -1
  14. package/dist/core/context/context-health.js +12 -98
  15. package/dist/core/context/context-health.js.map +1 -1
  16. package/dist/core/context/index.d.ts +2 -3
  17. package/dist/core/context/index.d.ts.map +1 -1
  18. package/dist/core/context/index.js +2 -18
  19. package/dist/core/context/index.js.map +1 -1
  20. package/dist/core/context/lazy-loader.d.ts +1 -44
  21. package/dist/core/context/lazy-loader.d.ts.map +1 -1
  22. package/dist/core/context/lazy-loader.js +1 -59
  23. package/dist/core/context/lazy-loader.js.map +1 -1
  24. package/dist/core/generator/claude-md.js +1 -1
  25. package/dist/core/provider/storage.d.ts.map +1 -1
  26. package/dist/core/provider/storage.js +2 -1
  27. package/dist/core/provider/storage.js.map +1 -1
  28. package/dist/hooks/post-edit.js +0 -73
  29. package/dist/hooks/post-edit.js.map +1 -1
  30. package/dist/hooks/session-start.js +0 -115
  31. package/dist/hooks/session-start.js.map +1 -1
  32. package/dist/hooks/types.js +1 -1
  33. package/dist/hooks/user-prompt-submit.js +0 -100
  34. package/dist/hooks/user-prompt-submit.js.map +1 -1
  35. package/dist/hud/config-tui.d.ts +25 -0
  36. package/dist/hud/config-tui.d.ts.map +1 -0
  37. package/dist/hud/config-tui.js +199 -0
  38. package/dist/hud/config-tui.js.map +1 -0
  39. package/dist/hud/config.d.ts +28 -3
  40. package/dist/hud/config.d.ts.map +1 -1
  41. package/dist/hud/config.js +60 -8
  42. package/dist/hud/config.js.map +1 -1
  43. package/dist/hud/index.d.ts.map +1 -1
  44. package/dist/hud/index.js +1 -0
  45. package/dist/hud/index.js.map +1 -1
  46. package/dist/hud/models.d.ts +58 -0
  47. package/dist/hud/models.d.ts.map +1 -0
  48. package/dist/hud/models.js +124 -0
  49. package/dist/hud/models.js.map +1 -0
  50. package/dist/hud/render/budget-bar.d.ts +2 -0
  51. package/dist/hud/render/budget-bar.d.ts.map +1 -1
  52. package/dist/hud/render/budget-bar.js +8 -5
  53. package/dist/hud/render/budget-bar.js.map +1 -1
  54. package/dist/hud/stdin.d.ts +3 -0
  55. package/dist/hud/stdin.d.ts.map +1 -1
  56. package/dist/hud/stdin.js +29 -2
  57. package/dist/hud/stdin.js.map +1 -1
  58. package/dist/hud/token-estimator.d.ts +79 -0
  59. package/dist/hud/token-estimator.d.ts.map +1 -0
  60. package/dist/hud/token-estimator.js +126 -0
  61. package/dist/hud/token-estimator.js.map +1 -0
  62. package/dist/hud/types.d.ts +2 -0
  63. package/dist/hud/types.d.ts.map +1 -1
  64. package/dist/mcp/server.d.ts +1 -2
  65. package/dist/mcp/server.d.ts.map +1 -1
  66. package/dist/mcp/server.js +3 -12
  67. package/dist/mcp/server.js.map +1 -1
  68. package/dist/mcp/tools/index.d.ts +2 -6
  69. package/dist/mcp/tools/index.d.ts.map +1 -1
  70. package/dist/mcp/tools/index.js +2 -17
  71. package/dist/mcp/tools/index.js.map +1 -1
  72. package/dist/mcp-server.d.ts.map +1 -1
  73. package/dist/mcp-server.js +5 -9
  74. package/dist/mcp-server.js.map +1 -1
  75. package/dist/rules/index.js +2 -2
  76. package/dist/utils/gitignore.d.ts.map +1 -1
  77. package/dist/utils/gitignore.js +0 -5
  78. package/dist/utils/gitignore.js.map +1 -1
  79. package/package.json +2 -1
  80. package/dist/core/context/focus-resource-loader.d.ts +0 -143
  81. package/dist/core/context/focus-resource-loader.d.ts.map +0 -1
  82. package/dist/core/context/focus-resource-loader.js +0 -305
  83. package/dist/core/context/focus-resource-loader.js.map +0 -1
  84. package/dist/mcp/focus-filter.d.ts +0 -74
  85. package/dist/mcp/focus-filter.d.ts.map +0 -1
  86. package/dist/mcp/focus-filter.js +0 -229
  87. package/dist/mcp/focus-filter.js.map +0 -1
  88. package/dist/mcp/tools/auto-inject.d.ts +0 -36
  89. package/dist/mcp/tools/auto-inject.d.ts.map +0 -1
  90. package/dist/mcp/tools/auto-inject.js +0 -143
  91. package/dist/mcp/tools/auto-inject.js.map +0 -1
  92. package/dist/mcp/tools/auto-unload.d.ts +0 -29
  93. package/dist/mcp/tools/auto-unload.d.ts.map +0 -1
  94. package/dist/mcp/tools/auto-unload.js +0 -151
  95. package/dist/mcp/tools/auto-unload.js.map +0 -1
  96. package/dist/mcp/tools/health.d.ts +0 -29
  97. package/dist/mcp/tools/health.d.ts.map +0 -1
  98. package/dist/mcp/tools/health.js +0 -171
  99. package/dist/mcp/tools/health.js.map +0 -1
@@ -1,229 +0,0 @@
1
- /**
2
- * Focus-Based Tool Filtering - v13.4.0
3
- *
4
- * Reduces context overhead by filtering tools based on current focus area.
5
- * Beyond phase-based filtering, tools are further filtered by focus relevance.
6
- *
7
- * Key features:
8
- * - Wildcard tag system: tools tagged with ['*'] always load
9
- * - Focus-aware mapping: tools tagged with focus areas only load when relevant
10
- * - Backward compatible: falls back to phase-only filtering if focus unavailable
11
- * - Feature-flagged: behind DINO_FOCUS_FILTERING environment variable
12
- *
13
- * Focus tags examples:
14
- * - ['*']: Always load (e.g., dino_status)
15
- * - ['mcp']: Load when focus is in src/mcp/ or .claude/
16
- * - ['core']: Load when focus is in src/core/
17
- * - ['commands']: Load when focus is in src/commands/
18
- * - ['test']: Load when focus is in test/ or .test/.spec
19
- *
20
- * Usage:
21
- * ```typescript
22
- * const filtered = filterToolsByFocus(tools, focusArea, phase);
23
- * ```
24
- */
25
- /**
26
- * Tool focus tag mapping
27
- * Maps tool names to focus tags that determine when they should be loaded
28
- */
29
- export const TOOL_FOCUS_TAGS = {
30
- // Core tools - always loaded
31
- 'dino_status': ['*'],
32
- 'dino_focus_set': ['*'],
33
- 'dino_focus_detect': ['*'],
34
- 'dino_blocker_add': ['*'],
35
- 'dino_blocker_resolve': ['*'],
36
- 'dino_phase_transition': ['*'],
37
- 'dino_budget_update': ['*'],
38
- 'dino_refresh': ['*'],
39
- 'dino_expand': ['*'],
40
- 'dino_defer': ['*'],
41
- 'dino_deferred_status': ['*'],
42
- 'dino_budget_stats': ['*'],
43
- // Discovery tools - relevant to research and exploration
44
- 'dino_memory_recall': ['*', 'memory'],
45
- 'dino_retrieval_optimize': ['*'],
46
- 'dino_context_repl': ['*'],
47
- 'dino_recursive_query': ['*'],
48
- 'dino_partition': ['*'],
49
- 'dino_graph_query': ['*', 'analysis'],
50
- 'dino_embed_search': ['*'],
51
- 'dino_playbook_suggest': ['*'],
52
- 'dino_strategy_select': ['*'],
53
- 'dino_spec_questions': ['*'],
54
- 'dino_chunk_analyze': ['*'],
55
- 'dino_embed_stats': ['*'],
56
- 'dino_graph_relations': ['*', 'analysis'],
57
- 'dino_retrieve': ['*'],
58
- 'dino_retrieve_similar': ['*'],
59
- // Planning tools - task and plan management
60
- 'dino_task_create': ['*'],
61
- 'dino_task_breakdown': ['*'],
62
- 'dino_task_status': ['*'],
63
- 'dino_task_delegate': ['*'],
64
- 'dino_plan_create': ['*'],
65
- 'dino_plan_progress': ['*'],
66
- 'dino_parallel_plan': ['*'],
67
- 'dino_agent_analyze': ['*', 'agents'],
68
- 'dino_agent_spawn_decision': ['*', 'agents'],
69
- 'dino_agent_tree': ['*', 'agents'],
70
- 'dino_budget_allocate': ['*'],
71
- 'dino_effort_recommend': ['*'],
72
- 'dino_spawn_context': ['*'],
73
- 'dino_graph_architecture': ['*', 'core', 'analysis'],
74
- 'dino_ralph_from_plan': ['*', 'ralph'],
75
- // Implementation tools - execution and Ralph Loop
76
- 'dino_checkpoint_create': ['*'],
77
- 'dino_progress_signal': ['*'],
78
- 'dino_budget_consume': ['*'],
79
- 'dino_budget_handoff': ['*'],
80
- 'dino_script_execute': ['*'],
81
- 'dino_delegate': ['*'],
82
- 'dino_pattern_feedback': ['*'],
83
- 'dino_memory_auto_capture': ['*', 'memory'],
84
- 'dino_playbook_feedback': ['*'],
85
- 'dino_strategy_record': ['*'],
86
- 'dino_action_mask': ['*'],
87
- 'dino_ralph_init': ['*', 'ralph'],
88
- 'dino_ralph_iterate': ['*', 'ralph'],
89
- 'dino_ralph_status': ['*', 'ralph'],
90
- 'dino_ralph_learn': ['*', 'ralph'],
91
- 'dino_chunk_file': ['*'],
92
- 'dino_ralph_iterate_parallel': ['*', 'ralph'],
93
- 'dino_ralph_restore': ['*', 'ralph'],
94
- // Verification tools - review and statistics
95
- 'dino_plan_complete': ['*'],
96
- 'dino_script_stats': ['*'],
97
- 'dino_script_templates': ['*'],
98
- 'dino_tool_recommend': ['*'],
99
- 'dino_trace_export': ['*'],
100
- 'dino_memory_access_stats': ['*', 'memory'],
101
- 'dino_session_sync': ['*'],
102
- 'dino_spec_feedback': ['*'],
103
- 'dino_spec_stats': ['*'],
104
- 'dino_spec_weights': ['*'],
105
- 'dino_circuit_status': ['*', 'agents'],
106
- 'dino_context_transitions': ['*'],
107
- 'dino_ralph_cleanup': ['*', 'ralph'],
108
- 'dino_ralph_consolidate': ['*', 'ralph'],
109
- 'dino_ralph_metrics': ['*', 'ralph'],
110
- };
111
- /**
112
- * Map focus area to tool focus tags
113
- * Examples:
114
- * - 'src/mcp/' -> ['mcp']
115
- * - 'src/core/context/' -> ['core', 'memory']
116
- * - 'src/commands/' -> ['commands']
117
- * - 'test/' -> ['test']
118
- */
119
- export function extractFocusTags(focusArea) {
120
- const tags = new Set();
121
- // Map directory paths to focus tags
122
- if (focusArea.includes('src/mcp') || focusArea.includes('.claude')) {
123
- tags.add('mcp');
124
- }
125
- if (focusArea.includes('src/core')) {
126
- tags.add('core');
127
- }
128
- if (focusArea.includes('src/core/context') || focusArea.includes('src/core/memory')) {
129
- tags.add('memory');
130
- }
131
- if (focusArea.includes('src/commands')) {
132
- tags.add('commands');
133
- }
134
- if (focusArea.includes('src/mcp/tools/ralph')) {
135
- tags.add('ralph');
136
- }
137
- if (focusArea.includes('src/core/agents')) {
138
- tags.add('agents');
139
- }
140
- if (focusArea.includes('src/core/analyzer') || focusArea.includes('src/mcp/tool-recommender')) {
141
- tags.add('analysis');
142
- }
143
- if (focusArea.includes('test/') || focusArea.includes('.test.') || focusArea.includes('.spec.')) {
144
- tags.add('test');
145
- }
146
- if (focusArea.includes('.claude/rules')) {
147
- tags.add('rules');
148
- }
149
- if (focusArea.includes('.claude/skills')) {
150
- tags.add('skills');
151
- }
152
- return Array.from(tags);
153
- }
154
- /**
155
- * Check if a tool should be loaded given the current focus
156
- */
157
- export function shouldLoadToolForFocus(toolName, focusTags) {
158
- const tags = TOOL_FOCUS_TAGS[toolName];
159
- // Tool not in mapping - don't load
160
- if (!tags) {
161
- return false;
162
- }
163
- // Tool has wildcard - always load
164
- if (tags.includes('*')) {
165
- return true;
166
- }
167
- // Tool has specific tags - load if focus contains any matching tag
168
- return tags.some(tag => focusTags.includes(tag));
169
- }
170
- /**
171
- * Filter tools by focus area
172
- * Only keeps tools that should be loaded for the current focus
173
- */
174
- export function filterToolsByFocus(tools, focusArea) {
175
- // If no focus provided, return all tools
176
- if (!focusArea) {
177
- return tools;
178
- }
179
- const focusTags = extractFocusTags(focusArea);
180
- // If no focus tags extracted, return all tools (fallback)
181
- if (focusTags.length === 0) {
182
- return tools;
183
- }
184
- // Filter to only tools that should load for this focus
185
- return tools.filter(tool => shouldLoadToolForFocus(tool.name, focusTags));
186
- }
187
- /**
188
- * Check if focus-based filtering is enabled
189
- * Default: enabled (true)
190
- * Opt-out: DINO_FOCUS_FILTERING=false
191
- */
192
- export function isFocusFilteringEnabled() {
193
- return process.env.DINO_FOCUS_FILTERING !== 'false';
194
- }
195
- /**
196
- * Get statistics about tool filtering
197
- */
198
- export function getFilterStats(allTools, focusArea) {
199
- const focusTags = focusArea ? extractFocusTags(focusArea) : [];
200
- // Create dummy objects with name property for filtering
201
- const toolObjects = allTools.map(name => ({ name }));
202
- const filtered = focusArea ? filterToolsByFocus(toolObjects, focusArea) : toolObjects;
203
- const total = allTools.length;
204
- const kept = filtered.length;
205
- const removed = total - kept;
206
- const percentageRemoved = total > 0 ? Math.round((removed / total) * 100) : 0;
207
- return {
208
- total,
209
- filtered: kept,
210
- reduction: removed,
211
- percentageRemoved,
212
- focusTags,
213
- };
214
- }
215
- /**
216
- * Format focus filter stats for display
217
- */
218
- export function formatFocusFilterStats(stats) {
219
- const lines = [
220
- '## Focus-Based Tool Filtering',
221
- '',
222
- `**Focus Tags:** ${stats.focusTags.length > 0 ? stats.focusTags.join(', ') : 'none'}`,
223
- `**Total Tools:** ${stats.total}`,
224
- `**Filtered Tools:** ${stats.filtered}`,
225
- `**Reduction:** ${stats.reduction} tools (${stats.percentageRemoved}%)`,
226
- ];
227
- return lines.join('\n');
228
- }
229
- //# sourceMappingURL=focus-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focus-filter.js","sourceRoot":"","sources":["../../src/mcp/focus-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC;IAC7D,6BAA6B;IAC7B,aAAa,EAAE,CAAC,GAAG,CAAC;IACpB,gBAAgB,EAAE,CAAC,GAAG,CAAC;IACvB,mBAAmB,EAAE,CAAC,GAAG,CAAC;IAC1B,kBAAkB,EAAE,CAAC,GAAG,CAAC;IACzB,sBAAsB,EAAE,CAAC,GAAG,CAAC;IAC7B,uBAAuB,EAAE,CAAC,GAAG,CAAC;IAC9B,oBAAoB,EAAE,CAAC,GAAG,CAAC;IAC3B,cAAc,EAAE,CAAC,GAAG,CA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,GAAG,IAAI,CAAC;IAC7B,MAAM,iBAAiB,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9E,OAAO;QACL,KAAK;QACL,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,OAAO;QAClB,iBAAiB;QACjB,SAAS;KACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAwC;IAExC,MAAM,KAAK,GAAa;QACtB,+BAA+B;QAC/B,EAAE;QACF,mBAAmB,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE;QACrF,oBAAoB,KAAK,CAAC,KAAK,EAAE;QACjC,uBAAuB,KAAK,CAAC,QAAQ,EAAE;QACvC,kBAAkB,KAAK,CAAC,SAAS,WAAW,KAAK,CAAC,iBAAiB,IAAI;KACxE,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Auto-Inject Tools Module - v13.5.0
3
- *
4
- * MCP tool for automatic context injection based on prompt analysis.
5
- * Wires the auto-injection-engine to be callable from hooks and manually.
6
- *
7
- * Tools:
8
- * - dino_auto_inject - Analyze prompt and inject relevant context
9
- */
10
- import { type ToolDefinition } from '../registry.js';
11
- interface AutoInjectInput {
12
- prompt: string;
13
- budgetPercentage?: number;
14
- minRelevance?: number;
15
- maxTokens?: number;
16
- }
17
- /**
18
- * Auto-inject tool definition
19
- */
20
- export declare const autoInjectTool: ToolDefinition<AutoInjectInput>;
21
- /**
22
- * Demand check tool definition - lightweight check without injection
23
- */
24
- export declare const demandCheckTool: ToolDefinition<{
25
- prompt: string;
26
- }>;
27
- /**
28
- * All auto-inject tools
29
- */
30
- export declare const autoInjectTools: ToolDefinition[];
31
- /**
32
- * Register all auto-inject tools with the registry
33
- */
34
- export declare function registerAutoInjectTools(): void;
35
- export {};
36
- //# sourceMappingURL=auto-inject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-inject.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/auto-inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAcxB,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkFD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,CA8BzD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAkB7D,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,EAG3C,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
@@ -1,143 +0,0 @@
1
- /**
2
- * Auto-Inject Tools Module - v13.5.0
3
- *
4
- * MCP tool for automatic context injection based on prompt analysis.
5
- * Wires the auto-injection-engine to be callable from hooks and manually.
6
- *
7
- * Tools:
8
- * - dino_auto_inject - Analyze prompt and inject relevant context
9
- */
10
- import { defineTool, registry, } from '../registry.js';
11
- import { executeAutoInjection, formatAutoInjectionResult, hasDemandSignals, getDemandSummary, } from '../../core/context/auto-injection-engine.js';
12
- // =============================================================================
13
- // Tool Handlers
14
- // =============================================================================
15
- /**
16
- * Auto-inject handler
17
- * Analyzes prompt and injects relevant context based on demand signals
18
- */
19
- async function handleAutoInject(params, projectDir) {
20
- const result = await executeAutoInjection(params.prompt, projectDir, {
21
- budgetPercentage: params.budgetPercentage ?? 50,
22
- minRelevance: params.minRelevance ?? 0.3,
23
- maxTokens: params.maxTokens ?? 500,
24
- includeFailures: true,
25
- });
26
- const lines = [];
27
- lines.push('# Auto-Injection Result');
28
- lines.push('');
29
- lines.push(formatAutoInjectionResult(result));
30
- lines.push('');
31
- if (result.executed) {
32
- lines.push('## Demand Signals Detected');
33
- for (const signal of result.signals) {
34
- lines.push(`- **${signal.type}** (${signal.confidence}): "${signal.trigger}"`);
35
- }
36
- lines.push('');
37
- if (result.injectedContext) {
38
- lines.push('## Injected Context');
39
- lines.push('```');
40
- lines.push(result.injectedContext);
41
- lines.push('```');
42
- }
43
- lines.push('');
44
- lines.push(`**Tokens injected:** ~${result.tokensInjected}`);
45
- lines.push(`**Relevance score:** ${(result.relevanceScore * 100).toFixed(0)}%`);
46
- }
47
- else {
48
- lines.push(`**Reason:** ${result.reason}`);
49
- // Show demand summary even if not executed
50
- const summary = getDemandSummary(params.prompt);
51
- lines.push(`**Demand summary:** ${summary}`);
52
- }
53
- return lines.join('\n');
54
- }
55
- /**
56
- * Quick check handler - just detects demand signals without injection
57
- */
58
- async function handleDemandCheck(params, projectDir) {
59
- const hasSignals = hasDemandSignals(params.prompt);
60
- const summary = getDemandSummary(params.prompt);
61
- const lines = [];
62
- lines.push('# Demand Signal Check');
63
- lines.push('');
64
- lines.push(`**Has demand signals:** ${hasSignals ? 'Yes' : 'No'}`);
65
- lines.push(`**Summary:** ${summary}`);
66
- return lines.join('\n');
67
- }
68
- // =============================================================================
69
- // Tool Definitions
70
- // =============================================================================
71
- /**
72
- * Auto-inject tool definition
73
- */
74
- export const autoInjectTool = defineTool({
75
- name: 'dino_auto_inject',
76
- description: 'Analyze prompt and automatically inject relevant context based on demand signals (v13.5.0). Part of auto context engineering.',
77
- category: 'retrieval',
78
- inputSchema: {
79
- type: 'object',
80
- properties: {
81
- prompt: {
82
- type: 'string',
83
- description: 'User prompt to analyze for context demand',
84
- },
85
- budgetPercentage: {
86
- type: 'number',
87
- description: 'Current budget percentage 0-100 (default: 50). Above 90% skips injection.',
88
- },
89
- minRelevance: {
90
- type: 'number',
91
- description: 'Minimum relevance score 0-1 (default: 0.3)',
92
- },
93
- maxTokens: {
94
- type: 'number',
95
- description: 'Maximum tokens to inject (default: 500)',
96
- },
97
- },
98
- required: ['prompt'],
99
- },
100
- handler: handleAutoInject,
101
- whenToUse: 'Use to automatically analyze a prompt and inject relevant context. Called by user-prompt-submit hook. Respects autoContextInjection feature flag.',
102
- relatedTools: ['dino_memory_recall', 'dino_expand'],
103
- version: '13.5.0',
104
- });
105
- /**
106
- * Demand check tool definition - lightweight check without injection
107
- */
108
- export const demandCheckTool = defineTool({
109
- name: 'dino_demand_check',
110
- description: 'Quick check for context demand signals in a prompt without performing injection (v13.5.0)',
111
- category: 'retrieval',
112
- inputSchema: {
113
- type: 'object',
114
- properties: {
115
- prompt: {
116
- type: 'string',
117
- description: 'User prompt to analyze for demand signals',
118
- },
119
- },
120
- required: ['prompt'],
121
- },
122
- handler: handleDemandCheck,
123
- whenToUse: 'Use for a lightweight check of whether a prompt has context demand signals. Faster than full auto-inject.',
124
- relatedTools: ['dino_auto_inject'],
125
- version: '13.5.0',
126
- });
127
- // =============================================================================
128
- // Exports
129
- // =============================================================================
130
- /**
131
- * All auto-inject tools
132
- */
133
- export const autoInjectTools = [
134
- autoInjectTool,
135
- demandCheckTool,
136
- ];
137
- /**
138
- * Register all auto-inject tools with the registry
139
- */
140
- export function registerAutoInjectTools() {
141
- registry.registerTools(autoInjectTools);
142
- }
143
- //# sourceMappingURL=auto-inject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-inject.js","sourceRoot":"","sources":["../../../src/mcp/tools/auto-inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,QAAQ,GAET,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB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AEhF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C,cAAgC;IAChC,eAAiC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,29 +0,0 @@
1
- /**
2
- * Auto-Unload Tools Module - v13.5.0
3
- *
4
- * MCP tool for automatic context unloading based on budget pressure.
5
- * Wires the auto-unload-engine to be callable from hooks and manually.
6
- *
7
- * Tools:
8
- * - dino_auto_unload - Unload cold context to free budget
9
- */
10
- import { type ToolDefinition } from '../registry.js';
11
- interface AutoUnloadInput {
12
- budgetPercentage?: number;
13
- aggressiveness?: string;
14
- minColdness?: number;
15
- }
16
- /**
17
- * Auto-unload tool definition
18
- */
19
- export declare const autoUnloadTool: ToolDefinition<AutoUnloadInput>;
20
- /**
21
- * All auto-unload tools
22
- */
23
- export declare const autoUnloadTools: ToolDefinition[];
24
- /**
25
- * Register all auto-unload tools with the registry
26
- */
27
- export declare function registerAutoUnloadTools(): void;
28
- export {};
29
- //# sourceMappingURL=auto-unload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-unload.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/auto-unload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAwBxB,UAAU,eAAe;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAmHD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,CA2BzD,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,EAE3C,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
@@ -1,151 +0,0 @@
1
- /**
2
- * Auto-Unload Tools Module - v13.5.0
3
- *
4
- * MCP tool for automatic context unloading based on budget pressure.
5
- * Wires the auto-unload-engine to be callable from hooks and manually.
6
- *
7
- * Tools:
8
- * - dino_auto_unload - Unload cold context to free budget
9
- */
10
- import { defineTool, registry, } from '../registry.js';
11
- import { executeAutoUnload, } from '../../core/context/auto-unload-engine.js';
12
- import { loadAccessPatterns, } from '../../core/context/access-tracker.js';
13
- import { createLazyContext, } from '../../core/context/lazy-loader.js';
14
- import { join } from 'path';
15
- import { FileSystem } from '../../utils/file-system.js';
16
- // =============================================================================
17
- // State Loading
18
- // =============================================================================
19
- /**
20
- * Get current budget percentage from session or budget file
21
- */
22
- async function getCurrentBudget(projectDir) {
23
- const budgetPath = join(projectDir, '.dino', 'context-budget.json');
24
- if (await FileSystem.exists(budgetPath)) {
25
- const data = await FileSystem.readJsonSafe(budgetPath);
26
- if (data && data.limit > 0) {
27
- return Math.round((data.estimated / data.limit) * 100);
28
- }
29
- }
30
- // Fallback to session.md
31
- const sessionPath = join(projectDir, '.dino', 'session.md');
32
- if (await FileSystem.exists(sessionPath)) {
33
- const content = await FileSystem.readFileSafe(sessionPath);
34
- if (content) {
35
- const match = content.match(/Budget.*?(\d+)%/);
36
- if (match) {
37
- return parseInt(match[1], 10);
38
- }
39
- }
40
- }
41
- return 50; // Default
42
- }
43
- /**
44
- * Map aggressiveness level to minimum coldness threshold
45
- */
46
- function getMinColdness(aggressiveness) {
47
- switch (aggressiveness) {
48
- case 'aggressive':
49
- return 0.3; // Unload even moderately cold resources
50
- case 'light':
51
- return 0.7; // Only unload very cold resources
52
- case 'medium':
53
- default:
54
- return 0.5; // Default threshold
55
- }
56
- }
57
- // =============================================================================
58
- // Tool Handlers
59
- // =============================================================================
60
- /**
61
- * Auto-unload handler
62
- */
63
- async function handleAutoUnload(params, projectDir) {
64
- // Load states
65
- const accessState = await loadAccessPatterns(projectDir);
66
- const lazyState = createLazyContext();
67
- // Get budget
68
- const budgetPercentage = params.budgetPercentage ?? await getCurrentBudget(projectDir);
69
- // Get aggressiveness
70
- const aggressiveness = params.aggressiveness ?? 'medium';
71
- const minColdness = params.minColdness ?? getMinColdness(aggressiveness);
72
- // Execute auto-unload
73
- const result = await executeAutoUnload(lazyState, accessState, {
74
- budgetPercentage,
75
- minColdness,
76
- }, projectDir);
77
- const lines = [];
78
- lines.push('# Auto-Unload Result');
79
- lines.push('');
80
- if (result.executed) {
81
- lines.push(`**Status:** Executed`);
82
- lines.push(`**Tokens freed:** ~${result.totalTokensFreed}`);
83
- lines.push(`**Budget:** ${result.budgetBefore}% -> ${result.budgetAfter}%`);
84
- lines.push('');
85
- if (result.unloaded.length > 0) {
86
- lines.push('## Unloaded Resources');
87
- for (const item of result.unloaded) {
88
- lines.push(`- ${item.file} (~${item.tokensFreed} tokens, coldness: ${item.coldnessScore.toFixed(2)})`);
89
- }
90
- }
91
- }
92
- else {
93
- lines.push(`**Status:** Skipped`);
94
- lines.push(`**Reason:** ${result.reason}`);
95
- lines.push(`**Budget:** ${result.budgetBefore}%`);
96
- }
97
- lines.push('');
98
- lines.push(`**Aggressiveness:** ${aggressiveness}`);
99
- lines.push(`**Min coldness threshold:** ${minColdness}`);
100
- return lines.join('\n');
101
- }
102
- // =============================================================================
103
- // Tool Definitions
104
- // =============================================================================
105
- /**
106
- * Auto-unload tool definition
107
- */
108
- export const autoUnloadTool = defineTool({
109
- name: 'dino_auto_unload',
110
- description: 'Automatically unload cold context resources to free budget (v13.5.0). Part of auto context engineering.',
111
- category: 'retrieval',
112
- inputSchema: {
113
- type: 'object',
114
- properties: {
115
- budgetPercentage: {
116
- type: 'number',
117
- description: 'Current budget percentage 0-100. Auto-detected if not provided.',
118
- },
119
- aggressiveness: {
120
- type: 'string',
121
- enum: ['light', 'medium', 'aggressive'],
122
- description: 'How aggressively to unload (default: medium). Light=70%, Medium=80%, Aggressive=90%.',
123
- },
124
- minColdness: {
125
- type: 'number',
126
- description: 'Minimum coldness score 0-1 to unload (overrides aggressiveness).',
127
- },
128
- },
129
- required: [],
130
- },
131
- handler: handleAutoUnload,
132
- whenToUse: 'Use to free up context budget by unloading cold resources. Called by session-start hook at budget thresholds (70%, 80%, 90%).',
133
- relatedTools: ['dino_health_check', 'dino_auto_inject'],
134
- version: '13.5.0',
135
- });
136
- // =============================================================================
137
- // Exports
138
- // =============================================================================
139
- /**
140
- * All auto-unload tools
141
- */
142
- export const autoUnloadTools = [
143
- autoUnloadTool,
144
- ];
145
- /**
146
- * Register all auto-unload tools with the registry
147
- */
148
- export function registerAutoUnloadTools() {
149
- registry.registerTools(autoUnloadTools);
150
- }
151
- //# sourceMappingURL=auto-unload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-unload.js","sourceRoot":"","sources":["../../../src/mcp/tools/auto-unload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,QAAQ,GAET,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,GAIlB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAYxD,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAEpE,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,YAAY,CAAuC,UAAU,CAAC,CAAC;QAC7F,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC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MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,29 +0,0 @@
1
- /**
2
- * Health Monitor Tools Module - v13.5.0
3
- *
4
- * MCP tool for context health monitoring.
5
- * Wires the context-health engine to be callable from hooks and manually.
6
- *
7
- * Tools:
8
- * - dino_health_check - Check context health status
9
- */
10
- import { type ToolDefinition } from '../registry.js';
11
- interface HealthCheckInput {
12
- budgetPercentage?: number;
13
- focusArea?: string;
14
- verbose?: string;
15
- }
16
- /**
17
- * Health check tool definition
18
- */
19
- export declare const healthCheckTool: ToolDefinition<HealthCheckInput>;
20
- /**
21
- * All health tools
22
- */
23
- export declare const healthTools: ToolDefinition[];
24
- /**
25
- * Register all health tools with the registry
26
- */
27
- export declare function registerHealthTools(): void;
28
- export {};
29
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAwBxB,UAAU,gBAAgB;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA6ID;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,gBAAgB,CA2B3D,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAAc,EAEvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}