wyrm-mcp 7.3.2 → 7.3.3

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 (184) hide show
  1. package/README.md +8 -14
  2. package/dist/activation.js +59 -1
  3. package/dist/agent-daemon.js +281 -4
  4. package/dist/agent-loop.js +332 -7
  5. package/dist/analytics.js +236 -13
  6. package/dist/attribution.js +49 -1
  7. package/dist/audit.js +457 -2
  8. package/dist/auto-capture.js +138 -3
  9. package/dist/auto-orchestrator.js +325 -1
  10. package/dist/autoconfig.d.ts +50 -0
  11. package/dist/autoconfig.d.ts.map +1 -1
  12. package/dist/autoconfig.js +1115 -39
  13. package/dist/autoconfig.js.map +1 -1
  14. package/dist/buddy-runner.js +109 -1
  15. package/dist/buddy.js +564 -14
  16. package/dist/build-flags.js +15 -1
  17. package/dist/capabilities.js +183 -3
  18. package/dist/capture.js +56 -1
  19. package/dist/causality.js +148 -8
  20. package/dist/cli.js +281 -20
  21. package/dist/cloud/cli.js +541 -5
  22. package/dist/cloud/client.js +221 -1
  23. package/dist/cloud/crypto.js +85 -1
  24. package/dist/cloud/machine-id.js +113 -2
  25. package/dist/cloud/recovery.js +60 -1
  26. package/dist/cloud/sync-engine.js +543 -7
  27. package/dist/cloud-backup.js +579 -5
  28. package/dist/cloud-profile.js +138 -1
  29. package/dist/cloud-sync-entrypoint.js +47 -1
  30. package/dist/cloud-sync.js +309 -2
  31. package/dist/connectors/bridge-source.d.ts +46 -0
  32. package/dist/connectors/bridge-source.d.ts.map +1 -0
  33. package/dist/connectors/bridge-source.js +77 -0
  34. package/dist/connectors/bridge-source.js.map +1 -0
  35. package/dist/connectors/index.d.ts +24 -0
  36. package/dist/connectors/index.d.ts.map +1 -0
  37. package/dist/connectors/index.js +69 -0
  38. package/dist/connectors/index.js.map +1 -0
  39. package/dist/connectors/ingest.d.ts +16 -0
  40. package/dist/connectors/ingest.d.ts.map +1 -0
  41. package/dist/connectors/ingest.js +116 -0
  42. package/dist/connectors/ingest.js.map +1 -0
  43. package/dist/connectors/types.d.ts +99 -0
  44. package/dist/connectors/types.d.ts.map +1 -0
  45. package/dist/connectors/types.js +17 -0
  46. package/dist/connectors/types.js.map +1 -0
  47. package/dist/constellation.js +168 -12
  48. package/dist/content-signature.js +45 -1
  49. package/dist/context-build-budgeted.js +144 -4
  50. package/dist/context-ranking.js +69 -1
  51. package/dist/crypto.js +179 -1
  52. package/dist/daemon-write-endpoint.js +290 -1
  53. package/dist/daemon-writer.js +406 -2
  54. package/dist/database.js +1278 -53
  55. package/dist/deprecations.js +162 -2
  56. package/dist/design.js +141 -13
  57. package/dist/event-replication.js +112 -1
  58. package/dist/events-sse.js +43 -7
  59. package/dist/events.js +238 -6
  60. package/dist/failure-patterns.d.ts +107 -0
  61. package/dist/failure-patterns.d.ts.map +1 -1
  62. package/dist/failure-patterns.js +924 -43
  63. package/dist/failure-patterns.js.map +1 -1
  64. package/dist/federation.js +236 -12
  65. package/dist/goals.js +101 -13
  66. package/dist/golden.js +355 -3
  67. package/dist/handlers/agent.js +165 -4
  68. package/dist/handlers/alias-adapters.js +129 -1
  69. package/dist/handlers/aliases.js +171 -1
  70. package/dist/handlers/audit.js +87 -1
  71. package/dist/handlers/boundary.js +221 -1
  72. package/dist/handlers/capture.js +1114 -73
  73. package/dist/handlers/causality.js +119 -9
  74. package/dist/handlers/cloud.js +382 -85
  75. package/dist/handlers/companion.js +459 -28
  76. package/dist/handlers/datalake.js +187 -7
  77. package/dist/handlers/dispatch-context.js +22 -0
  78. package/dist/handlers/entity.js +256 -25
  79. package/dist/handlers/events.js +335 -16
  80. package/dist/handlers/failure.d.ts.map +1 -1
  81. package/dist/handlers/failure.js +408 -13
  82. package/dist/handlers/failure.js.map +1 -1
  83. package/dist/handlers/goals.js +296 -4
  84. package/dist/handlers/intelligence.js +681 -126
  85. package/dist/handlers/invoicing.js +70 -1
  86. package/dist/handlers/mcpclient.js +137 -6
  87. package/dist/handlers/orchestration.js +125 -40
  88. package/dist/handlers/output-schemas.js +24 -1
  89. package/dist/handlers/presence.js +99 -3
  90. package/dist/handlers/project.js +182 -28
  91. package/dist/handlers/prompts.js +157 -6
  92. package/dist/handlers/quest.js +224 -4
  93. package/dist/handlers/recall.js +237 -13
  94. package/dist/handlers/registry.js +167 -1
  95. package/dist/handlers/resources.js +288 -1
  96. package/dist/handlers/review.js +74 -11
  97. package/dist/handlers/run.js +498 -16
  98. package/dist/handlers/search.js +338 -15
  99. package/dist/handlers/session.js +643 -31
  100. package/dist/handlers/share.js +184 -8
  101. package/dist/handlers/shims.js +464 -1
  102. package/dist/handlers/skill.js +449 -67
  103. package/dist/handlers/survivors.js +120 -1
  104. package/dist/handlers/symbols.js +109 -8
  105. package/dist/handlers/syncops.js +302 -4
  106. package/dist/handlers/types.js +27 -1
  107. package/dist/harvest.js +191 -5
  108. package/dist/hours.js +156 -7
  109. package/dist/http-auth.js +321 -3
  110. package/dist/http-fast.js +1302 -22
  111. package/dist/icons.js +47 -1
  112. package/dist/importers.js +268 -1
  113. package/dist/index.js +840 -2
  114. package/dist/indexer.js +145 -4
  115. package/dist/intelligence.js +261 -31
  116. package/dist/internal-dispatch.js +212 -3
  117. package/dist/keyset.js +110 -1
  118. package/dist/knowledge-graph.js +176 -12
  119. package/dist/license.js +441 -2
  120. package/dist/logger.js +199 -2
  121. package/dist/maintenance.js +148 -2
  122. package/dist/mcp-client.js +262 -6
  123. package/dist/memory-artifacts.js +596 -32
  124. package/dist/migrate-prompt.js +124 -2
  125. package/dist/migrations.d.ts.map +1 -1
  126. package/dist/migrations.js +799 -42
  127. package/dist/migrations.js.map +1 -1
  128. package/dist/performance.js +228 -1
  129. package/dist/presence.js +140 -11
  130. package/dist/priority-embed.js +164 -5
  131. package/dist/providers/embedding-provider.js +196 -1
  132. package/dist/readonly-gate.js +29 -1
  133. package/dist/receipt.js +43 -1
  134. package/dist/rehydration.js +157 -9
  135. package/dist/reindex.js +88 -1
  136. package/dist/render-target.js +544 -21
  137. package/dist/render.js +280 -4
  138. package/dist/repl-guard.js +173 -1
  139. package/dist/replication-daemon-entrypoint.js +31 -1
  140. package/dist/replication-daemon.js +262 -2
  141. package/dist/rerank.js +142 -1
  142. package/dist/resilience.js +591 -1
  143. package/dist/reverse-bridge.js +360 -5
  144. package/dist/security.js +244 -1
  145. package/dist/session-seen.js +51 -3
  146. package/dist/setup.js +260 -1
  147. package/dist/skill-author.js +168 -5
  148. package/dist/spec-kit.js +191 -1
  149. package/dist/sqlite-busy.js +154 -1
  150. package/dist/statusline.js +315 -11
  151. package/dist/sub-agent.js +262 -13
  152. package/dist/summarizer.js +139 -13
  153. package/dist/symbols.js +283 -7
  154. package/dist/sync.js +359 -5
  155. package/dist/tasks-dispatch.js +84 -1
  156. package/dist/tasks.js +282 -1
  157. package/dist/token-budget.js +143 -1
  158. package/dist/tool-analytics.js +129 -7
  159. package/dist/tool-annotations.js +365 -1
  160. package/dist/tool-manifest-v2.json +1 -1
  161. package/dist/tool-manifest.json +1 -1
  162. package/dist/tool-profiles.js +75 -1
  163. package/dist/trace-harvest.js +244 -6
  164. package/dist/types.js +30 -1
  165. package/dist/ui-dashboard.js +50 -41
  166. package/dist/ulid.js +81 -1
  167. package/dist/usage-tracker.js +66 -1
  168. package/dist/validate.js +129 -1
  169. package/dist/vault.js +534 -1
  170. package/dist/vector-init.js +67 -1
  171. package/dist/vectors.js +184 -3
  172. package/dist/version-check.js +136 -4
  173. package/dist/visibility.js +155 -19
  174. package/dist/wyrm-cli.js +2845 -101
  175. package/dist/wyrm-cli.js.map +1 -1
  176. package/dist/wyrm-guard.d.ts.map +1 -1
  177. package/dist/wyrm-guard.js +475 -14
  178. package/dist/wyrm-guard.js.map +1 -1
  179. package/dist/wyrm-loop.js +150 -3
  180. package/dist/wyrm-manifest.json +1 -1
  181. package/dist/wyrm-statusline-daemon.js +11 -1
  182. package/dist/wyrm-statusline.js +56 -4
  183. package/dist/wyrm-ui.js +77 -9
  184. package/package.json +1 -1
@@ -1 +1,325 @@
1
- function g(i,e){const t=i.toLowerCase();let s="generation",r=50,o="medium";["decide","choose","architecture","design pattern","approach","strategy","should we","which is better","trade-off","tradeoff"].some(a=>t.includes(a))&&(s="decision",r=85,o=e?.complexity==="high"?"high":"medium"),["investigate","analyze","explore","research","what are the","find all","compare","benchmark"].some(a=>t.includes(a))&&(s="research",r=80,o="high"),["review","check","validate","test","security","performance","audit","lint"].some(a=>t.includes(a))&&(s="verification",r=75,o="medium");const u=["build","implement","feature","system","module","create","develop","setup"],y=i.length>500;u.some(a=>t.includes(a))&&y&&(s="decomposition",r=70,o="high"),s==="generation"&&(r=60,o="low"),i.length>1e3&&(o="high"),i.length<200&&(o="low");const k=b(s,o);return{type:s,confidence:r,description:i.substring(0,100)+(i.length>100?"...":""),complexity:o,recommendedApproach:v(s),parallelBlocks:k}}function b(i,e){return{decision:{low:2,medium:3,high:4},generation:{low:1,medium:2,high:3},research:{low:2,medium:4,high:6},verification:{low:2,medium:3,high:4},decomposition:{low:2,medium:4,high:6}}[i][e]||3}function v(i){return{decision:"ensemble-voting (4 approaches + vote)",generation:"haiku-boosting (few-shot + self-critique)",research:"parallel-research (N angles + synthesis)",verification:"verification-pipeline (security + perf + style reviews)",decomposition:"task-decomposition (subtasks + parallel + synthesis)"}[i]}function d(){return{autoOrchestrateEnabled:!0,minConfidenceThreshold:65,maxParallelAgents:6,defaultHaikuBoosting:!0,trackMetrics:!0,thinkingBudget:1e4}}async function w(i,e=d()){const t=g(i);if(t.confidence<e.minConfidenceThreshold)return{taskType:t.type,approach:"standard (below confidence threshold)",results:null,quality:0,costSavings:0,parallelExecutionTime:0,confidence:t.confidence,appliedPatterns:[],metrics:{tokensBoosting:0,tokensEnsemble:0,tokensVerification:0,totalTokens:0}};let s=[],r=Date.now();switch(t.type){case"decision":s=["ensemble-voting","haiku-boosting"];break;case"generation":s=["haiku-boosting","self-critique"];break;case"research":s=["parallel-research","synthesis"];break;case"verification":s=["parallel-review","multi-angle"];break;case"decomposition":s=["task-decomposition","parallel-synthesis"];break}const o=Date.now()-r,h=p(s),n=m(s,t.parallelBlocks);return{taskType:t.type,approach:t.recommendedApproach,results:null,quality:60+h,costSavings:n,parallelExecutionTime:o,confidence:t.confidence,appliedPatterns:s,metrics:{tokensBoosting:s.includes("haiku-boosting")?800:0,tokensEnsemble:s.includes("ensemble-voting")?1200:0,tokensVerification:s.includes("multi-angle")?600:0,totalTokens:0}}}function p(i){let e=0;return i.includes("haiku-boosting")&&(e+=45),i.includes("ensemble-voting")&&(e+=35),i.includes("self-critique")&&(e+=25),i.includes("multi-angle")&&(e+=20),Math.min(e,80)}function m(i,e=1){return i.includes("ensemble-voting")?e>1?45:30:i.includes("haiku-boosting")?35:25}class f{config;taskHistory=[];constructor(e){this.config={...d(),...e}}async processTask(e){const t=g(e);return this.taskHistory.push(t),this.taskHistory.length>100&&(this.taskHistory=this.taskHistory.slice(-100)),w(e,this.config)}getTaskDistribution(){const e={decision:0,generation:0,research:0,verification:0,decomposition:0};for(const t of this.taskHistory)e[t.type]++;return e}getStats(){const e=this.getTaskDistribution(),t=this.taskHistory.length,s=this.taskHistory.reduce((n,c)=>{const u=this.getPatternSetForType(c.type);return n+p(u)},0)/(t||1),r=this.taskHistory.reduce((n,c)=>n+m(this.getPatternSetForType(c.type),c.complexity==="high"?4:2),0)/(t||1),o=this.taskHistory.map(n=>n.complexity),h=o.filter(n=>n==="high").length>t/2?"high":o.filter(n=>n==="low").length>t/2?"low":"medium";return{tasksProcessed:t,distribution:e,estimatedQualityBoost:Math.round(s),estimatedCostSavings:Math.round(r),averageComplexity:h}}getPatternSetForType(e){return{decision:["ensemble-voting","haiku-boosting"],generation:["haiku-boosting","self-critique"],research:["parallel-research","synthesis"],verification:["parallel-review","multi-angle"],decomposition:["task-decomposition","parallel-synthesis"]}[e]}updateConfig(e){this.config={...this.config,...e}}}let l=null;function x(){return l||(l=new f(d())),l}function T(i){return l=new f(i),l}export{f as AutoOrchestrator,g as classifyTask,d as getDefaultConfig,x as getGlobalOrchestrator,T as initializeOrchestrator,w as orchestrateTask};
1
+ /**
2
+ * Wyrm Auto-Orchestrator - Automatically apply reasoning patterns
3
+ *
4
+ * This layer intercepts task requests and automatically applies
5
+ * the best multi-agent reasoning pattern based on task classification.
6
+ *
7
+ * Patterns applied automatically:
8
+ * - Haiku Boosting: All content generation via few-shot + self-critique
9
+ * - Ensemble Voting: Decisions (architecture, design, strategy) via N approaches + vote
10
+ * - Task Decomposition: Large features via subtasks + parallel execution
11
+ * - Verification: High-risk code changes via multi-angle review
12
+ *
13
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
14
+ * @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
15
+ */
16
+ /**
17
+ * Classify incoming task based on multiple signals
18
+ */
19
+ export function classifyTask(input, context) {
20
+ const text = input.toLowerCase();
21
+ let type = 'generation';
22
+ let confidence = 50;
23
+ let complexity = 'medium';
24
+ // Decision detection
25
+ const decisionKeywords = ['decide', 'choose', 'architecture', 'design pattern', 'approach', 'strategy', 'should we', 'which is better', 'trade-off', 'tradeoff'];
26
+ if (decisionKeywords.some(kw => text.includes(kw))) {
27
+ type = 'decision';
28
+ confidence = 85;
29
+ complexity = context?.complexity === 'high' ? 'high' : 'medium';
30
+ }
31
+ // Research detection
32
+ const researchKeywords = ['investigate', 'analyze', 'explore', 'research', 'what are the', 'find all', 'compare', 'benchmark'];
33
+ if (researchKeywords.some(kw => text.includes(kw))) {
34
+ type = 'research';
35
+ confidence = 80;
36
+ complexity = 'high';
37
+ }
38
+ // Verification detection
39
+ const verificationKeywords = ['review', 'check', 'validate', 'test', 'security', 'performance', 'audit', 'lint'];
40
+ if (verificationKeywords.some(kw => text.includes(kw))) {
41
+ type = 'verification';
42
+ confidence = 75;
43
+ complexity = 'medium';
44
+ }
45
+ // Decomposition detection (large feature builds)
46
+ const decompositionKeywords = ['build', 'implement', 'feature', 'system', 'module', 'create', 'develop', 'setup'];
47
+ const hasDetailedDescription = input.length > 500;
48
+ if (decompositionKeywords.some(kw => text.includes(kw)) && hasDetailedDescription) {
49
+ type = 'decomposition';
50
+ confidence = 70;
51
+ complexity = 'high';
52
+ }
53
+ // Generation (default, with boosting)
54
+ if (type === 'generation') {
55
+ confidence = 60; // Lower confidence for default catch-all
56
+ complexity = 'low';
57
+ }
58
+ // Adjust complexity based on input length
59
+ if (input.length > 1000)
60
+ complexity = 'high';
61
+ if (input.length < 200)
62
+ complexity = 'low';
63
+ const parallelBlocks = getParallelBlockCount(type, complexity);
64
+ return {
65
+ type,
66
+ confidence,
67
+ description: input.substring(0, 100) + (input.length > 100 ? '...' : ''),
68
+ complexity,
69
+ recommendedApproach: getRecommendedApproach(type),
70
+ parallelBlocks,
71
+ };
72
+ }
73
+ /**
74
+ * Determine how many parallel agents to spawn
75
+ */
76
+ function getParallelBlockCount(type, complexity) {
77
+ const config = {
78
+ decision: { low: 2, medium: 3, high: 4 },
79
+ generation: { low: 1, medium: 2, high: 3 },
80
+ research: { low: 2, medium: 4, high: 6 },
81
+ verification: { low: 2, medium: 3, high: 4 },
82
+ decomposition: { low: 2, medium: 4, high: 6 },
83
+ };
84
+ return config[type][complexity] || 3;
85
+ }
86
+ /**
87
+ * Get recommended orchestration approach
88
+ */
89
+ function getRecommendedApproach(type) {
90
+ const approaches = {
91
+ decision: 'ensemble-voting (4 approaches + vote)',
92
+ generation: 'haiku-boosting (few-shot + self-critique)',
93
+ research: 'parallel-research (N angles + synthesis)',
94
+ verification: 'verification-pipeline (security + perf + style reviews)',
95
+ decomposition: 'task-decomposition (subtasks + parallel + synthesis)',
96
+ };
97
+ return approaches[type];
98
+ }
99
+ /**
100
+ * Default orchestration config
101
+ */
102
+ export function getDefaultConfig() {
103
+ return {
104
+ autoOrchestrateEnabled: true,
105
+ minConfidenceThreshold: 65, // Only apply if 65%+ confident
106
+ maxParallelAgents: 6,
107
+ defaultHaikuBoosting: true, // Boost all Haiku content generation
108
+ trackMetrics: true,
109
+ thinkingBudget: 10000, // Max thinking tokens per orchestrated task
110
+ };
111
+ }
112
+ /**
113
+ * Apply appropriate orchestration pattern
114
+ */
115
+ export async function orchestrateTask(task, config = getDefaultConfig()) {
116
+ const classified = classifyTask(task);
117
+ // Check if confidence meets threshold
118
+ if (classified.confidence < config.minConfidenceThreshold) {
119
+ return {
120
+ taskType: classified.type,
121
+ approach: 'standard (below confidence threshold)',
122
+ results: null,
123
+ quality: 0,
124
+ costSavings: 0,
125
+ parallelExecutionTime: 0,
126
+ confidence: classified.confidence,
127
+ appliedPatterns: [],
128
+ metrics: { tokensBoosting: 0, tokensEnsemble: 0, tokensVerification: 0, totalTokens: 0 },
129
+ };
130
+ }
131
+ // Apply pattern based on task type
132
+ let patterns = [];
133
+ let startTime = Date.now();
134
+ switch (classified.type) {
135
+ case 'decision':
136
+ patterns = ['ensemble-voting', 'haiku-boosting'];
137
+ // Would spawn 4 approaches via parallel agents, vote, boost confidence
138
+ break;
139
+ case 'generation':
140
+ patterns = ['haiku-boosting', 'self-critique'];
141
+ // Add few-shot examples + self-critique loop
142
+ break;
143
+ case 'research':
144
+ patterns = ['parallel-research', 'synthesis'];
145
+ // Spawn parallel agents for different angles, synthesize findings
146
+ break;
147
+ case 'verification':
148
+ patterns = ['parallel-review', 'multi-angle'];
149
+ // Parallel: security review, performance check, style check → synthesize
150
+ break;
151
+ case 'decomposition':
152
+ patterns = ['task-decomposition', 'parallel-synthesis'];
153
+ // Break into subtasks, parallel execution, merge results
154
+ break;
155
+ }
156
+ const executionTime = Date.now() - startTime;
157
+ // Estimate quality and cost savings
158
+ const qualityBoost = getQualityBoost(patterns);
159
+ const costSavings = getCostSavings(patterns, classified.parallelBlocks);
160
+ return {
161
+ taskType: classified.type,
162
+ approach: classified.recommendedApproach,
163
+ results: null, // Would be filled by actual implementation
164
+ quality: 60 + qualityBoost,
165
+ costSavings,
166
+ parallelExecutionTime: executionTime,
167
+ confidence: classified.confidence,
168
+ appliedPatterns: patterns,
169
+ metrics: {
170
+ tokensBoosting: patterns.includes('haiku-boosting') ? 800 : 0,
171
+ tokensEnsemble: patterns.includes('ensemble-voting') ? 1200 : 0,
172
+ tokensVerification: patterns.includes('multi-angle') ? 600 : 0,
173
+ totalTokens: 0, // Would be calculated
174
+ },
175
+ };
176
+ }
177
+ /**
178
+ * Quality boost from applied patterns (est. %)
179
+ */
180
+ function getQualityBoost(patterns) {
181
+ let boost = 0;
182
+ if (patterns.includes('haiku-boosting'))
183
+ boost += 45;
184
+ if (patterns.includes('ensemble-voting'))
185
+ boost += 35;
186
+ if (patterns.includes('self-critique'))
187
+ boost += 25;
188
+ if (patterns.includes('multi-angle'))
189
+ boost += 20;
190
+ return Math.min(boost, 80); // Cap at 80% boost
191
+ }
192
+ /**
193
+ * Cost savings vs Opus (est. %)
194
+ */
195
+ function getCostSavings(patterns, parallelBlocks = 1) {
196
+ // Base: Haiku is 10x cheaper than Opus
197
+ // With patterns: Multiple Haiku calls (boosting + ensemble) still beat single Opus
198
+ // Typical: 4 Haiku ($0.48) vs 1 Opus ($1.00) = 52% savings
199
+ if (patterns.includes('ensemble-voting')) {
200
+ return parallelBlocks > 1 ? 45 : 30; // Multiple approaches still cheaper
201
+ }
202
+ if (patterns.includes('haiku-boosting')) {
203
+ return 35; // Boosting adds overhead but still cheaper than Opus
204
+ }
205
+ return 25; // Other patterns, general Haiku usage
206
+ }
207
+ /**
208
+ * Orchestration middleware for agent context
209
+ *
210
+ * Usage in agent:
211
+ * ```typescript
212
+ * const config = getDefaultConfig();
213
+ * const task = "Design a microservice architecture for a real-time collaboration tool";
214
+ * const plan = await orchestrateTask(task, config);
215
+ *
216
+ * if (plan.appliedPatterns.length > 0) {
217
+ * // Auto-orchestration active
218
+ * // Implementation would:
219
+ * // 1. Spawn parallel agents (if ensemble/decomposition)
220
+ * // 2. Apply boosting (if generation)
221
+ * // 3. Run reviews (if verification)
222
+ * // 4. Synthesize results
223
+ * // 5. Store metrics in Wyrm
224
+ * }
225
+ * ```
226
+ */
227
+ export class AutoOrchestrator {
228
+ config;
229
+ taskHistory = [];
230
+ constructor(config) {
231
+ this.config = {
232
+ ...getDefaultConfig(),
233
+ ...config,
234
+ };
235
+ }
236
+ /**
237
+ * Process incoming task with auto-orchestration
238
+ */
239
+ async processTask(task) {
240
+ const classified = classifyTask(task);
241
+ this.taskHistory.push(classified);
242
+ // Trim history to last 100 tasks
243
+ if (this.taskHistory.length > 100) {
244
+ this.taskHistory = this.taskHistory.slice(-100);
245
+ }
246
+ return orchestrateTask(task, this.config);
247
+ }
248
+ /**
249
+ * Get task classification insight
250
+ */
251
+ getTaskDistribution() {
252
+ const dist = {
253
+ decision: 0,
254
+ generation: 0,
255
+ research: 0,
256
+ verification: 0,
257
+ decomposition: 0,
258
+ };
259
+ for (const task of this.taskHistory) {
260
+ dist[task.type]++;
261
+ }
262
+ return dist;
263
+ }
264
+ /**
265
+ * Get orchestration effectiveness stats
266
+ */
267
+ getStats() {
268
+ const distribution = this.getTaskDistribution();
269
+ const total = this.taskHistory.length;
270
+ const avgQuality = this.taskHistory.reduce((sum, t) => {
271
+ const patterns = this.getPatternSetForType(t.type);
272
+ return sum + getQualityBoost(patterns);
273
+ }, 0) / (total || 1);
274
+ const avgCost = this.taskHistory.reduce((sum, t) => {
275
+ return sum + getCostSavings(this.getPatternSetForType(t.type), t.complexity === 'high' ? 4 : 2);
276
+ }, 0) / (total || 1);
277
+ const complexities = this.taskHistory.map(t => t.complexity);
278
+ const avgComplexity = complexities.filter(c => c === 'high').length > total / 2
279
+ ? 'high'
280
+ : complexities.filter(c => c === 'low').length > total / 2
281
+ ? 'low'
282
+ : 'medium';
283
+ return {
284
+ tasksProcessed: total,
285
+ distribution,
286
+ estimatedQualityBoost: Math.round(avgQuality),
287
+ estimatedCostSavings: Math.round(avgCost),
288
+ averageComplexity: avgComplexity,
289
+ };
290
+ }
291
+ /**
292
+ * Get pattern set for task type
293
+ */
294
+ getPatternSetForType(type) {
295
+ const patterns = {
296
+ decision: ['ensemble-voting', 'haiku-boosting'],
297
+ generation: ['haiku-boosting', 'self-critique'],
298
+ research: ['parallel-research', 'synthesis'],
299
+ verification: ['parallel-review', 'multi-angle'],
300
+ decomposition: ['task-decomposition', 'parallel-synthesis'],
301
+ };
302
+ return patterns[type];
303
+ }
304
+ /**
305
+ * Update config at runtime
306
+ */
307
+ updateConfig(updates) {
308
+ this.config = { ...this.config, ...updates };
309
+ }
310
+ }
311
+ /**
312
+ * Singleton instance for global orchestration
313
+ */
314
+ let globalOrchestrator = null;
315
+ export function getGlobalOrchestrator() {
316
+ if (!globalOrchestrator) {
317
+ globalOrchestrator = new AutoOrchestrator(getDefaultConfig());
318
+ }
319
+ return globalOrchestrator;
320
+ }
321
+ export function initializeOrchestrator(config) {
322
+ globalOrchestrator = new AutoOrchestrator(config);
323
+ return globalOrchestrator;
324
+ }
325
+ //# sourceMappingURL=auto-orchestrator.js.map
@@ -71,6 +71,56 @@ export declare function installClaudeStatusline(): SetupResult | null;
71
71
  export declare function removeClaudeStatusline(): SetupResult | null;
72
72
  /** Remove all Wyrm hooks from ~/.claude/settings.json (leaves other hooks). */
73
73
  export declare function removeClaudeCodeHooks(): SetupResult | null;
74
+ export interface GuardHookOptions {
75
+ /** Target settings file. Default: $CLAUDE_SETTINGS (the install.sh
76
+ * contract) or ~/.claude/settings.json. Tests pass temp fixtures — the
77
+ * real ~/.claude must never be touched by a test. */
78
+ settingsPath?: string;
79
+ /** Override the hook command (tests). Default: resolveWyrmGuardCommand(). */
80
+ guardCommand?: string;
81
+ }
82
+ /**
83
+ * Shell-quote a path for the PreToolUse hook command, which Claude Code runs
84
+ * THROUGH A SHELL on every tool call. POSIX single-quoting makes $, backtick,
85
+ * backslash and double-quote inert — double-quoting does NOT, so a path
86
+ * containing a command substitution would EXECUTE on every tool call (crucible
87
+ * HIGH 2026-07-03). cmd.exe (Windows) does not honor single quotes, so there
88
+ * we wrap in double quotes and escape embedded double-quotes.
89
+ */
90
+ export declare function quoteHookPath(p: string): string;
91
+ /**
92
+ * Resolve the wyrm-guard hook command for THIS running install. Never a
93
+ * repo-checkout guess:
94
+ * 1. dist sibling — 'wyrm-guard.js' next to this module (autoconfig ships in
95
+ * the same dist/ for npm-global installs and built checkouts alike),
96
+ * invoked `node '<abs path>'` (shell-quoted via quoteHookPath: install
97
+ * paths may contain spaces AND shell metacharacters; works without an
98
+ * executable bit or shebang support);
99
+ * 2. else the package.json bin name 'wyrm-guard' resolved on PATH
100
+ * (which/where — the same probe install.sh uses), shell-quoted the same way.
101
+ */
102
+ export declare function resolveWyrmGuardCommand(): string | null;
103
+ /**
104
+ * Install the wyrm-guard failure-firewall hooks into Claude Code's
105
+ * settings.json — the zero-config path (`wyrm setup` runs this) and the
106
+ * explicit one (`wyrm guard`). Idempotent strip-then-add: a re-run never
107
+ * duplicates, and a byte-identical result skips the write entirely. No-op
108
+ * (returns null) when the Claude Code CLI isn't present and no explicit
109
+ * target was given.
110
+ */
111
+ export declare function installWyrmGuardHooks(options?: GuardHookOptions): SetupResult | null;
112
+ /**
113
+ * Remove ONLY the wyrm-guard hook entries (the install.sh --uninstall filter
114
+ * for the guard). Unrelated hooks/settings survive; when nothing of ours is
115
+ * present the file is not rewritten at all (bytes untouched).
116
+ */
117
+ export declare function removeWyrmGuardHooks(options?: GuardHookOptions): SetupResult | null;
118
+ /** Whether guard hooks are currently present, and the commands they run. */
119
+ export declare function wyrmGuardHookStatus(options?: GuardHookOptions): {
120
+ settingsPath: string;
121
+ installed: boolean;
122
+ commands: string[];
123
+ };
74
124
  /**
75
125
  * Auto-configure Wyrm in ALL detected AI clients
76
126
  */
@@ -1 +1 @@
1
- {"version":3,"file":"autoconfig.d.ts","sourceRoot":"","sources":["../src/autoconfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAA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