maskweaver 0.9.4 → 0.9.6

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 (229) hide show
  1. package/README.ko.md +638 -592
  2. package/README.md +671 -667
  3. package/dist/cli/doctor.js +5 -21
  4. package/dist/cli/install.d.ts +0 -8
  5. package/dist/cli/install.js +0 -39
  6. package/dist/context/config.d.ts +0 -22
  7. package/dist/context/config.js +0 -28
  8. package/dist/context/feature.d.ts +0 -39
  9. package/dist/context/feature.js +0 -77
  10. package/dist/context/files.d.ts +0 -13
  11. package/dist/context/files.js +1 -24
  12. package/dist/context/index.d.ts +0 -7
  13. package/dist/context/index.js +0 -12
  14. package/dist/context/project.d.ts +0 -21
  15. package/dist/context/project.js +0 -30
  16. package/dist/context/types.d.ts +0 -48
  17. package/dist/context/types.js +0 -12
  18. package/dist/context/utils.d.ts +0 -18
  19. package/dist/context/utils.js +0 -27
  20. package/dist/core/engine/promptBuilder.d.ts +0 -17
  21. package/dist/core/engine/promptBuilder.js +0 -28
  22. package/dist/core/index.d.ts +0 -6
  23. package/dist/core/index.js +0 -9
  24. package/dist/core/loader/MaskLoader.d.ts +0 -23
  25. package/dist/core/loader/MaskLoader.js +0 -29
  26. package/dist/core/schema/types.d.ts +0 -47
  27. package/dist/core/schema/types.js +0 -6
  28. package/dist/core/schema/validator.d.ts +0 -14
  29. package/dist/core/schema/validator.js +0 -18
  30. package/dist/i18n/index.d.ts +0 -18
  31. package/dist/i18n/index.js +4 -23
  32. package/dist/index.d.ts +0 -8
  33. package/dist/index.js +0 -8
  34. package/dist/lib.d.ts +0 -5
  35. package/dist/lib.js +0 -12
  36. package/dist/memory/chunking.d.ts +0 -22
  37. package/dist/memory/chunking.js +2 -37
  38. package/dist/memory/core.d.ts +0 -29
  39. package/dist/memory/core.js +1 -52
  40. package/dist/memory/index.d.ts +0 -5
  41. package/dist/memory/index.js +0 -10
  42. package/dist/memory/indexer.d.ts +0 -21
  43. package/dist/memory/indexer.js +0 -44
  44. package/dist/memory/providers/examples.d.ts +0 -5
  45. package/dist/memory/providers/examples.js +4 -64
  46. package/dist/memory/providers/factory.d.ts +0 -44
  47. package/dist/memory/providers/factory.js +0 -46
  48. package/dist/memory/providers/index.d.ts +0 -26
  49. package/dist/memory/providers/index.js +0 -28
  50. package/dist/memory/providers/ollama.d.ts +0 -6
  51. package/dist/memory/providers/ollama.js +1 -8
  52. package/dist/memory/providers/openai.d.ts +0 -6
  53. package/dist/memory/providers/openai.js +1 -8
  54. package/dist/memory/providers/openrouter.d.ts +0 -6
  55. package/dist/memory/providers/openrouter.js +0 -8
  56. package/dist/memory/providers/text-only.d.ts +0 -13
  57. package/dist/memory/providers/text-only.js +0 -17
  58. package/dist/memory/providers/types.d.ts +0 -39
  59. package/dist/memory/providers/types.js +0 -7
  60. package/dist/memory/providers/voyage.d.ts +0 -22
  61. package/dist/memory/providers/voyage.js +1 -24
  62. package/dist/memory/search/hybrid.d.ts +0 -12
  63. package/dist/memory/search/hybrid.js +1 -22
  64. package/dist/memory/store/sqlite.d.ts +0 -72
  65. package/dist/memory/store/sqlite.js +4 -127
  66. package/dist/plugin/config/index.d.ts +0 -112
  67. package/dist/plugin/config/index.js +0 -115
  68. package/dist/plugin/index.d.ts +0 -13
  69. package/dist/plugin/index.js +1 -123
  70. package/dist/plugin/tools/command-registry.d.ts +0 -6
  71. package/dist/plugin/tools/command-registry.js +0 -14
  72. package/dist/plugin/tools/context.d.ts +0 -12
  73. package/dist/plugin/tools/context.js +0 -58
  74. package/dist/plugin/tools/maskSave.d.ts +0 -3
  75. package/dist/plugin/tools/maskSave.js +0 -3
  76. package/dist/plugin/tools/memoryGet.d.ts +0 -3
  77. package/dist/plugin/tools/memoryGet.js +0 -3
  78. package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
  79. package/dist/plugin/tools/memoryIndexer.js +0 -10
  80. package/dist/plugin/tools/memorySearch.d.ts +0 -31
  81. package/dist/plugin/tools/memorySearch.js +0 -79
  82. package/dist/plugin/tools/memoryWrite.d.ts +0 -8
  83. package/dist/plugin/tools/memoryWrite.js +0 -32
  84. package/dist/plugin/tools/retrospect.d.ts +0 -3
  85. package/dist/plugin/tools/retrospect.js +0 -3
  86. package/dist/plugin/tools/slashcommand.d.ts +0 -11
  87. package/dist/plugin/tools/slashcommand.js +0 -38
  88. package/dist/plugin/tools/squad.d.ts +0 -12
  89. package/dist/plugin/tools/squad.js +11 -83
  90. package/dist/plugin/tools/weave.d.ts +0 -6
  91. package/dist/plugin/tools/weave.js +0 -78
  92. package/dist/plugin/types.d.ts +0 -20
  93. package/dist/plugin/types.js +0 -7
  94. package/dist/retrospect/index.d.ts +0 -7
  95. package/dist/retrospect/index.js +0 -9
  96. package/dist/retrospect/mask-save.d.ts +0 -12
  97. package/dist/retrospect/mask-save.js +1 -80
  98. package/dist/retrospect/retrospect.d.ts +0 -18
  99. package/dist/retrospect/retrospect.js +0 -63
  100. package/dist/retrospect/strategies/base.d.ts +0 -15
  101. package/dist/retrospect/strategies/base.js +0 -7
  102. package/dist/retrospect/strategies/deep.d.ts +0 -12
  103. package/dist/retrospect/strategies/deep.js +0 -24
  104. package/dist/retrospect/strategies/index.d.ts +0 -12
  105. package/dist/retrospect/strategies/index.js +0 -12
  106. package/dist/retrospect/strategies/quick.d.ts +0 -12
  107. package/dist/retrospect/strategies/quick.js +0 -19
  108. package/dist/retrospect/strategies/standard.d.ts +0 -12
  109. package/dist/retrospect/strategies/standard.js +0 -15
  110. package/dist/retrospect/types.d.ts +0 -7
  111. package/dist/retrospect/types.js +0 -7
  112. package/dist/shared/config.d.ts +0 -105
  113. package/dist/shared/config.js +0 -33
  114. package/dist/shared/errors.d.ts +0 -18
  115. package/dist/shared/errors.js +0 -19
  116. package/dist/shared/generate-agents.d.ts +0 -69
  117. package/dist/shared/generate-agents.js +2 -86
  118. package/dist/shared/image.d.ts +0 -67
  119. package/dist/shared/image.js +6 -104
  120. package/dist/shared/index.d.ts +0 -5
  121. package/dist/shared/index.js +0 -7
  122. package/dist/shared/model-registry.d.ts +0 -72
  123. package/dist/shared/model-registry.js +5 -95
  124. package/dist/shared/types.d.ts +0 -15
  125. package/dist/shared/types.js +0 -3
  126. package/dist/shared-context/dag.d.ts +0 -105
  127. package/dist/shared-context/dag.js +3 -114
  128. package/dist/shared-context/index.d.ts +0 -5
  129. package/dist/shared-context/index.js +0 -15
  130. package/dist/shared-context/logger.d.ts +0 -37
  131. package/dist/shared-context/logger.js +0 -41
  132. package/dist/shared-context/parallel-executor.d.ts +0 -54
  133. package/dist/shared-context/parallel-executor.js +4 -56
  134. package/dist/shared-context/session.d.ts +0 -56
  135. package/dist/shared-context/session.js +0 -47
  136. package/dist/shared-context/squad.d.ts +0 -68
  137. package/dist/shared-context/squad.js +0 -63
  138. package/dist/shared-context/storage.d.ts +0 -132
  139. package/dist/shared-context/storage.js +0 -116
  140. package/dist/shared-context/task.d.ts +0 -120
  141. package/dist/shared-context/task.js +0 -152
  142. package/dist/shared-context/test/dag.test.js +9 -14
  143. package/dist/shared-context/test/logger.test.d.ts +0 -8
  144. package/dist/shared-context/test/logger.test.js +0 -52
  145. package/dist/shared-context/test/session.test.d.ts +0 -7
  146. package/dist/shared-context/test/session.test.js +0 -63
  147. package/dist/shared-context/test/squad.test.d.ts +0 -10
  148. package/dist/shared-context/test/squad.test.js +2 -68
  149. package/dist/shared-context/test/storage.test.d.ts +0 -8
  150. package/dist/shared-context/test/storage.test.js +0 -68
  151. package/dist/shared-context/test/task.test.d.ts +0 -7
  152. package/dist/shared-context/test/task.test.js +0 -54
  153. package/dist/shared-context/test/watchdog.test.d.ts +0 -7
  154. package/dist/shared-context/test/watchdog.test.js +3 -58
  155. package/dist/shared-context/types.d.ts +0 -215
  156. package/dist/shared-context/types.js +0 -125
  157. package/dist/shared-context/watchdog.d.ts +0 -127
  158. package/dist/shared-context/watchdog.js +0 -148
  159. package/dist/shared-context/worktree.d.ts +0 -68
  160. package/dist/shared-context/worktree.js +2 -34
  161. package/dist/verify/budget.d.ts +0 -29
  162. package/dist/verify/budget.js +0 -34
  163. package/dist/verify/critical-files.d.ts +0 -17
  164. package/dist/verify/critical-files.js +0 -37
  165. package/dist/verify/escalation.d.ts +0 -20
  166. package/dist/verify/escalation.js +0 -22
  167. package/dist/verify/index.d.ts +0 -5
  168. package/dist/verify/index.js +0 -11
  169. package/dist/verify/prompts.d.ts +0 -20
  170. package/dist/verify/prompts.js +0 -20
  171. package/dist/verify/types.d.ts +0 -26
  172. package/dist/verify/types.js +1 -12
  173. package/dist/verify/verifier.d.ts +0 -29
  174. package/dist/verify/verifier.js +0 -54
  175. package/dist/version.d.ts +1 -16
  176. package/dist/version.js +1 -16
  177. package/dist/weave/bridge.d.ts +0 -35
  178. package/dist/weave/bridge.js +0 -51
  179. package/dist/weave/environment/detector.d.ts +0 -6
  180. package/dist/weave/environment/detector.js +4 -45
  181. package/dist/weave/environment/index.d.ts +0 -19
  182. package/dist/weave/environment/index.js +1 -39
  183. package/dist/weave/environment/issues.d.ts +0 -35
  184. package/dist/weave/environment/issues.js +0 -59
  185. package/dist/weave/git.d.ts +0 -8
  186. package/dist/weave/git.js +0 -8
  187. package/dist/weave/index.d.ts +0 -13
  188. package/dist/weave/index.js +2 -28
  189. package/dist/weave/knowledge/global.d.ts +0 -39
  190. package/dist/weave/knowledge/global.js +2 -78
  191. package/dist/weave/loop.js +0 -3
  192. package/dist/weave/orchestrator.d.ts +0 -69
  193. package/dist/weave/orchestrator.js +1 -101
  194. package/dist/weave/phase-manager.d.ts +0 -64
  195. package/dist/weave/phase-manager.js +0 -89
  196. package/dist/weave/security/secret-scan.d.ts +0 -14
  197. package/dist/weave/security/secret-scan.js +0 -19
  198. package/dist/weave/stages/build.js +0 -15
  199. package/dist/weave/stages/execute.d.ts +0 -42
  200. package/dist/weave/stages/execute.js +4 -86
  201. package/dist/weave/stages/handoff.d.ts +0 -7
  202. package/dist/weave/stages/handoff.js +0 -43
  203. package/dist/weave/stages/index.d.ts +0 -3
  204. package/dist/weave/stages/index.js +0 -3
  205. package/dist/weave/stages/intake.d.ts +0 -8
  206. package/dist/weave/stages/intake.js +5 -65
  207. package/dist/weave/stages/map.d.ts +0 -1
  208. package/dist/weave/stages/openspec.d.ts +0 -1
  209. package/dist/weave/stages/plan.d.ts +0 -11
  210. package/dist/weave/stages/plan.js +1 -53
  211. package/dist/weave/stages/refine.d.ts +0 -7
  212. package/dist/weave/stages/refine.js +0 -7
  213. package/dist/weave/stages/research.d.ts +0 -6
  214. package/dist/weave/stages/research.js +0 -6
  215. package/dist/weave/stages/spec.d.ts +0 -12
  216. package/dist/weave/stages/spec.js +0 -17
  217. package/dist/weave/types.d.ts +0 -20
  218. package/dist/weave/types.js +0 -5
  219. package/dist/weave/verification/commands.d.ts +0 -12
  220. package/dist/weave/verification/commands.js +0 -19
  221. package/dist/weave/verification/index.d.ts +0 -6
  222. package/dist/weave/verification/index.js +1 -19
  223. package/dist/weave/verification/playwright.d.ts +0 -47
  224. package/dist/weave/verification/playwright.js +1 -90
  225. package/dist/weave/worktree.d.ts +0 -16
  226. package/dist/weave/worktree.js +0 -23
  227. package/dist/weave/yaml-repair.d.ts +0 -39
  228. package/dist/weave/yaml-repair.js +13 -116
  229. package/package.json +1 -1
@@ -1,98 +1,29 @@
1
- /**
2
- * Weave Orchestrator
3
- *
4
- * Automatically selects expert masks based on task context.
5
- * This is the "brain" that decides which persona to wear for each task.
6
- */
7
1
  import type { WeaveTask, WeaveConfig, AgentTier, TaskComplexity, PhaseExecutionPlan } from './types.js';
8
2
  import type { WeavePhase } from './types.js';
9
3
  export type TaskType = 'architecture' | 'testing' | 'frontend' | 'backend' | 'performance' | 'database' | 'ml' | 'devops' | 'general';
10
4
  export declare class WeaveOrchestrator {
11
5
  private config;
12
6
  constructor(config?: Partial<WeaveConfig>);
13
- /**
14
- * Detect the type of task from its description.
15
- */
16
7
  detectTaskType(taskDescription: string): TaskType;
17
- /**
18
- * Select the best mask for a task.
19
- * Considers: task type, user preferences, and context.
20
- */
21
8
  selectMaskForTask(task: WeaveTask): string | null;
22
- /**
23
- * Select mask for error analysis/debugging.
24
- * Performance/system errors → Linus, Architecture errors → Martin, etc.
25
- */
26
9
  selectMaskForError(errorMessage: string): string;
27
- /**
28
- * Suggest mask rotation for stuck situations.
29
- * If current mask isn't solving the problem, try a different perspective.
30
- */
31
10
  suggestAlternativeMask(currentMask: string, taskType: TaskType): string;
32
- /**
33
- * Get configuration.
34
- */
35
11
  getConfig(): WeaveConfig;
36
- /**
37
- * Complexity signal patterns.
38
- * Each pattern adds to a complexity score when matched.
39
- */
40
12
  private static readonly COMPLEXITY_SIGNALS;
41
- /**
42
- * Simple task patterns — if matched, override to simple.
43
- */
44
13
  private static readonly SIMPLE_PATTERNS;
45
- /**
46
- * Assess complexity of a task based on its name/description.
47
- * Returns: simple (score 0), standard (score 1-2), complex (score 3+)
48
- */
49
14
  assessComplexity(taskDescription: string): TaskComplexity;
50
- /**
51
- * Select the appropriate agent tier based on task complexity.
52
- *
53
- * Strategy:
54
- * - simple -> dummy-flash (fast, cheap: file renames, formatting, config)
55
- * - standard -> dummy-human (balanced: component implementation, API endpoints)
56
- * - complex -> dummy-premium (powerful: architecture, debugging, multi-step reasoning)
57
- */
58
15
  selectAgentTier(complexity: TaskComplexity): AgentTier;
59
- /** Map TaskType to ModelCapability tags for pool-based selection */
60
16
  private static readonly TASK_TYPE_CAPABILITIES;
61
- /** Map complexity to ModelTier for pool queries */
62
17
  private static readonly COMPLEXITY_TIER_MAP;
63
- /**
64
- * Select the best available agent from the model pool.
65
- * This considers:
66
- * 1. Task complexity -> preferred tier
67
- * 2. Task type -> required capabilities
68
- * 3. Model availability -> concurrency limits
69
- * 4. Cost awareness -> prefer cheaper when possible
70
- *
71
- * Returns the agent name to use (e.g., "dummy-gemini-flash")
72
- * or falls back to the legacy tier name (e.g., "dummy-flash")
73
- */
74
18
  selectAgentFromPool(task: WeaveTask): {
75
19
  agentName: string;
76
20
  tier: AgentTier;
77
21
  poolManaged: boolean;
78
22
  };
79
- /**
80
- * Release a model back to the pool after task completion.
81
- */
82
23
  releaseAgent(agentName: string): boolean;
83
- /**
84
- * Generate execution plan for a phase.
85
- * Analyzes each task and determines:
86
- * 1. Which expert mask to use
87
- * 2. Which agent tier (model) to delegate to
88
- * 3. Any relevant troubleshooting hints from global knowledge
89
- */
90
24
  generateExecutionPlan(phase: WeavePhase, options?: {
91
25
  projectType?: string;
92
26
  }): Promise<PhaseExecutionPlan>;
93
- /**
94
- * Update configuration.
95
- */
96
27
  updateConfig(updates: Partial<WeaveConfig>): void;
97
28
  }
98
29
  export declare function getOrchestrator(config?: Partial<WeaveConfig>): WeaveOrchestrator;
@@ -1,9 +1,3 @@
1
- /**
2
- * Weave Orchestrator
3
- *
4
- * Automatically selects expert masks based on task context.
5
- * This is the "brain" that decides which persona to wear for each task.
6
- */
7
1
  import { searchTroubleshooting } from './knowledge/global.js';
8
2
  import { getModelRegistry } from '../shared/model-registry.js';
9
3
  const TASK_PATTERNS = {
@@ -47,7 +41,6 @@ const TASK_PATTERNS = {
47
41
  ],
48
42
  general: []
49
43
  };
50
- // Default mask recommendations per task type
51
44
  const DEFAULT_MASKS = {
52
45
  architecture: 'martin-fowler',
53
46
  testing: 'kent-beck',
@@ -57,11 +50,8 @@ const DEFAULT_MASKS = {
57
50
  database: 'martin-fowler',
58
51
  ml: 'andrew-ng',
59
52
  devops: 'linus-torvalds',
60
- general: 'kent-beck' // Good all-rounder with TDD focus
53
+ general: 'kent-beck'
61
54
  };
62
- // ============================================================================
63
- // Orchestrator Class
64
- // ============================================================================
65
55
  export class WeaveOrchestrator {
66
56
  config;
67
57
  constructor(config = {}) {
@@ -73,11 +63,7 @@ export class WeaveOrchestrator {
73
63
  maskPreferences: config.maskPreferences ?? {},
74
64
  };
75
65
  }
76
- /**
77
- * Detect the type of task from its description.
78
- */
79
66
  detectTaskType(taskDescription) {
80
- // Check each pattern set
81
67
  for (const [type, patterns] of Object.entries(TASK_PATTERNS)) {
82
68
  if (type === 'general')
83
69
  continue;
@@ -89,54 +75,35 @@ export class WeaveOrchestrator {
89
75
  }
90
76
  return 'general';
91
77
  }
92
- /**
93
- * Select the best mask for a task.
94
- * Considers: task type, user preferences, and context.
95
- */
96
78
  selectMaskForTask(task) {
97
79
  if (!this.config.autoSelectMasks) {
98
80
  return null;
99
81
  }
100
82
  const taskType = this.detectTaskType(task.name);
101
- // Check user preferences first
102
83
  if (this.config.maskPreferences) {
103
84
  const preferred = this.config.maskPreferences[taskType];
104
85
  if (preferred) {
105
86
  return preferred;
106
87
  }
107
88
  }
108
- // Fall back to defaults
109
89
  return DEFAULT_MASKS[taskType] || null;
110
90
  }
111
- /**
112
- * Select mask for error analysis/debugging.
113
- * Performance/system errors → Linus, Architecture errors → Martin, etc.
114
- */
115
91
  selectMaskForError(errorMessage) {
116
92
  const lower = errorMessage.toLowerCase();
117
- // Performance/memory issues → Linus
118
93
  if (/memory|leak|performance|slow|timeout|race|concurrent/.test(lower)) {
119
94
  return 'linus-torvalds';
120
95
  }
121
- // Type/structure issues → Martin (architecture perspective)
122
96
  if (/type|interface|abstract|pattern|coupling|dependency/.test(lower)) {
123
97
  return 'martin-fowler';
124
98
  }
125
- // Test failures → Kent
126
99
  if (/test|assert|expect|mock|spec|coverage/.test(lower)) {
127
100
  return 'kent-beck';
128
101
  }
129
- // React/frontend issues → Dan
130
102
  if (/react|component|hook|state|render|jsx|tsx/.test(lower)) {
131
103
  return 'dan-abramov';
132
104
  }
133
- // Default to Kent for methodical debugging
134
105
  return 'kent-beck';
135
106
  }
136
- /**
137
- * Suggest mask rotation for stuck situations.
138
- * If current mask isn't solving the problem, try a different perspective.
139
- */
140
107
  suggestAlternativeMask(currentMask, taskType) {
141
108
  const alternatives = {
142
109
  'kent-beck': ['martin-fowler', 'linus-torvalds'],
@@ -148,21 +115,10 @@ export class WeaveOrchestrator {
148
115
  const options = alternatives[currentMask] || ['kent-beck'];
149
116
  return options[0];
150
117
  }
151
- /**
152
- * Get configuration.
153
- */
154
118
  getConfig() {
155
119
  return { ...this.config };
156
120
  }
157
- // ========================================================================
158
- // Task Complexity Assessment
159
- // ========================================================================
160
- /**
161
- * Complexity signal patterns.
162
- * Each pattern adds to a complexity score when matched.
163
- */
164
121
  static COMPLEXITY_SIGNALS = [
165
- // High complexity signals (+2)
166
122
  { pattern: /architect/i, weight: 2 },
167
123
  { pattern: /refactor/i, weight: 2 },
168
124
  { pattern: /design pattern/i, weight: 2 },
@@ -174,7 +130,6 @@ export class WeaveOrchestrator {
174
130
  { pattern: /debug|troubleshoot|diagnos/i, weight: 2 },
175
131
  { pattern: /security|encrypt|vulnerab/i, weight: 2 },
176
132
  { pattern: /algorithm|data structure/i, weight: 2 },
177
- // Medium complexity signals (+1)
178
133
  { pattern: /component/i, weight: 1 },
179
134
  { pattern: /api|endpoint|route/i, weight: 1 },
180
135
  { pattern: /test|spec/i, weight: 1 },
@@ -184,9 +139,6 @@ export class WeaveOrchestrator {
184
139
  { pattern: /validation/i, weight: 1 },
185
140
  { pattern: /integrate/i, weight: 1 },
186
141
  ];
187
- /**
188
- * Simple task patterns — if matched, override to simple.
189
- */
190
142
  static SIMPLE_PATTERNS = [
191
143
  /rename|renames/i,
192
144
  /import|imports/i,
@@ -199,12 +151,7 @@ export class WeaveOrchestrator {
199
151
  /add export/i,
200
152
  /fix lint/i,
201
153
  ];
202
- /**
203
- * Assess complexity of a task based on its name/description.
204
- * Returns: simple (score 0), standard (score 1-2), complex (score 3+)
205
- */
206
154
  assessComplexity(taskDescription) {
207
- // Check for explicit simple patterns first
208
155
  for (const pattern of WeaveOrchestrator.SIMPLE_PATTERNS) {
209
156
  if (pattern.test(taskDescription)) {
210
157
  return 'simple';
@@ -222,14 +169,6 @@ export class WeaveOrchestrator {
222
169
  return 'standard';
223
170
  return 'simple';
224
171
  }
225
- /**
226
- * Select the appropriate agent tier based on task complexity.
227
- *
228
- * Strategy:
229
- * - simple -> dummy-flash (fast, cheap: file renames, formatting, config)
230
- * - standard -> dummy-human (balanced: component implementation, API endpoints)
231
- * - complex -> dummy-premium (powerful: architecture, debugging, multi-step reasoning)
232
- */
233
172
  selectAgentTier(complexity) {
234
173
  switch (complexity) {
235
174
  case 'simple':
@@ -240,10 +179,6 @@ export class WeaveOrchestrator {
240
179
  return 'dummy-premium';
241
180
  }
242
181
  }
243
- // ========================================================================
244
- // Model Pool Integration
245
- // ========================================================================
246
- /** Map TaskType to ModelCapability tags for pool-based selection */
247
182
  static TASK_TYPE_CAPABILITIES = {
248
183
  architecture: ['architecture', 'reasoning', 'complex-coding'],
249
184
  testing: ['testing', 'coding'],
@@ -255,23 +190,11 @@ export class WeaveOrchestrator {
255
190
  devops: ['devops', 'file-ops'],
256
191
  general: ['coding'],
257
192
  };
258
- /** Map complexity to ModelTier for pool queries */
259
193
  static COMPLEXITY_TIER_MAP = {
260
194
  simple: 'flash',
261
195
  standard: 'human',
262
196
  complex: 'premium',
263
197
  };
264
- /**
265
- * Select the best available agent from the model pool.
266
- * This considers:
267
- * 1. Task complexity -> preferred tier
268
- * 2. Task type -> required capabilities
269
- * 3. Model availability -> concurrency limits
270
- * 4. Cost awareness -> prefer cheaper when possible
271
- *
272
- * Returns the agent name to use (e.g., "dummy-gemini-flash")
273
- * or falls back to the legacy tier name (e.g., "dummy-flash")
274
- */
275
198
  selectAgentFromPool(task) {
276
199
  const complexity = this.assessComplexity(task.name);
277
200
  const defaultTier = this.selectAgentTier(complexity);
@@ -279,7 +202,6 @@ export class WeaveOrchestrator {
279
202
  try {
280
203
  const registry = getModelRegistry();
281
204
  const pool = registry.getPool();
282
- // If no pool configured, fall back to legacy
283
205
  if (pool.length === 0) {
284
206
  return { agentName: defaultTier, tier: defaultTier, poolManaged: false };
285
207
  }
@@ -297,21 +219,15 @@ export class WeaveOrchestrator {
297
219
  poolManaged: true,
298
220
  };
299
221
  }
300
- // Pool exhausted -- fall back to legacy tier name
301
222
  return { agentName: defaultTier, tier: defaultTier, poolManaged: false };
302
223
  }
303
224
  catch {
304
- // Registry not initialized -- fall back to legacy
305
225
  return { agentName: defaultTier, tier: defaultTier, poolManaged: false };
306
226
  }
307
227
  }
308
- /**
309
- * Release a model back to the pool after task completion.
310
- */
311
228
  releaseAgent(agentName) {
312
229
  try {
313
230
  const registry = getModelRegistry();
314
- // Agent name format: "dummy-{modelId}"
315
231
  const modelId = agentName.replace(/^dummy-/, '');
316
232
  return registry.release(modelId);
317
233
  }
@@ -319,20 +235,12 @@ export class WeaveOrchestrator {
319
235
  return false;
320
236
  }
321
237
  }
322
- /**
323
- * Generate execution plan for a phase.
324
- * Analyzes each task and determines:
325
- * 1. Which expert mask to use
326
- * 2. Which agent tier (model) to delegate to
327
- * 3. Any relevant troubleshooting hints from global knowledge
328
- */
329
238
  async generateExecutionPlan(phase, options) {
330
239
  const taskPlans = [];
331
240
  for (const task of phase.tasks) {
332
241
  const mask = this.selectMaskForTask(task);
333
242
  const complexity = this.assessComplexity(task.name);
334
243
  const agentTier = this.selectAgentTier(complexity);
335
- // Pre-fetch troubleshooting hints for known error patterns
336
244
  let troubleshootingHints = [];
337
245
  if (this.config.globalKnowledge) {
338
246
  try {
@@ -342,7 +250,6 @@ export class WeaveOrchestrator {
342
250
  .map(s => s.entry.solution.slice(0, 200));
343
251
  }
344
252
  catch {
345
- // Knowledge search is best-effort
346
253
  }
347
254
  }
348
255
  taskPlans.push({
@@ -353,7 +260,6 @@ export class WeaveOrchestrator {
353
260
  troubleshootingHints,
354
261
  });
355
262
  }
356
- // Generate human-readable summary
357
263
  const tierCounts = { flash: 0, human: 0, premium: 0 };
358
264
  for (const p of taskPlans) {
359
265
  if (p.agentTier === 'dummy-flash')
@@ -380,16 +286,10 @@ export class WeaveOrchestrator {
380
286
  summary: summaryParts.join('\n'),
381
287
  };
382
288
  }
383
- /**
384
- * Update configuration.
385
- */
386
289
  updateConfig(updates) {
387
290
  this.config = { ...this.config, ...updates };
388
291
  }
389
292
  }
390
- // ============================================================================
391
- // Singleton Instance
392
- // ============================================================================
393
293
  let orchestratorInstance = null;
394
294
  export function getOrchestrator(config) {
395
295
  if (!orchestratorInstance) {
@@ -1,9 +1,3 @@
1
- /**
2
- * Phase Manager
3
- *
4
- * Manages phase lifecycle and persistence.
5
- * Integrates with Maskweaver's context module for file tracking.
6
- */
7
1
  import type { WeavePhase, WeavePlan, PhaseStatus } from './types.js';
8
2
  import type { RepairResult } from './yaml-repair.js';
9
3
  export declare class PhaseManager {
@@ -11,33 +5,13 @@ export declare class PhaseManager {
11
5
  private plan;
12
6
  private _recoveryMessages;
13
7
  constructor(basePath?: string);
14
- /**
15
- * Get recovery messages from last load operation.
16
- * UI can display these to inform the user about auto-repairs.
17
- */
18
8
  getRecoveryMessages(): string[];
19
- /**
20
- * Load existing plan or return null.
21
- * Supports multi-plan architecture (state.yaml → plans/) with legacy PLAN.yaml fallback.
22
- * Auto-repairs corrupted YAML files when possible.
23
- */
24
9
  loadPlan(): Promise<WeavePlan | null>;
25
- /**
26
- * Save plan to disk using safe file I/O (atomic writes with backup).
27
- * If state.yaml exists (new mode): save to plans/{planName}.yaml and update state.yaml.
28
- * Otherwise (legacy mode): save to PLAN.yaml.
29
- */
30
10
  savePlan(plan: WeavePlan): Promise<void>;
31
- /**
32
- * Repair all plan files. Returns repair report.
33
- */
34
11
  repairPlans(): Promise<{
35
12
  results: RepairResult[];
36
13
  summary: string;
37
14
  }>;
38
- /**
39
- * Create a new plan.
40
- */
41
15
  createPlan(input: {
42
16
  planName?: string;
43
17
  projectName: string;
@@ -50,59 +24,21 @@ export declare class PhaseManager {
50
24
  shardTotal?: number;
51
25
  nextPlanName?: string;
52
26
  }): Promise<WeavePlan>;
53
- /**
54
- * Get a specific phase.
55
- */
56
27
  getPhase(phaseId: string): WeavePhase | null;
57
- /**
58
- * Update phase status.
59
- */
60
28
  updatePhaseStatus(phaseId: string, status: PhaseStatus, additionalData?: Partial<WeavePhase>): Promise<WeavePhase | null>;
61
- /**
62
- * Add tasks to a phase.
63
- */
64
29
  addTasks(phaseId: string, tasks: Omit<WeavePhase['tasks'][0], 'status' | 'retryCount'>[]): Promise<void>;
65
- /**
66
- * Update task status.
67
- */
68
30
  updateTaskStatus(phaseId: string, taskId: string, status: 'pending' | 'in_progress' | 'passed' | 'failed', additionalData?: Partial<WeavePhase['tasks'][0]>): Promise<void>;
69
- /**
70
- * Mark all tasks in a phase as passed.
71
- * Useful when the phase is approved after full verification.
72
- */
73
31
  markAllTasksPassed(phaseId: string): Promise<void>;
74
- /**
75
- * Get next pending phase (respecting dependencies).
76
- */
77
32
  getNextPhase(): WeavePhase | null;
78
- /**
79
- * Get plan statistics.
80
- */
81
33
  getStats(): {
82
34
  totalPhases: number;
83
35
  completedPhases: number;
84
36
  inProgressPhases: number;
85
37
  progress: number;
86
38
  };
87
- /**
88
- * Convert project name to a filesystem-safe plan file name.
89
- */
90
39
  private toPlanFileName;
91
- /**
92
- * Load all plans from the plans/ directory.
93
- * Returns empty array in legacy mode or if no plans exist.
94
- * Auto-repairs corrupted plans when possible.
95
- */
96
40
  loadAllPlans(): Promise<WeavePlan[]>;
97
- /**
98
- * Get the active plan name from state.yaml.
99
- * Returns null in legacy mode or if state.yaml doesn't exist.
100
- */
101
41
  getActivePlanName(): Promise<string | null>;
102
- /**
103
- * Load and return state.yaml content.
104
- * Returns null if state.yaml doesn't exist (legacy mode).
105
- */
106
42
  loadState(): Promise<{
107
43
  active_plan?: string;
108
44
  } | null>;