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.
- package/README.ko.md +638 -592
- package/README.md +671 -667
- package/dist/cli/doctor.js +5 -21
- package/dist/cli/install.d.ts +0 -8
- package/dist/cli/install.js +0 -39
- package/dist/context/config.d.ts +0 -22
- package/dist/context/config.js +0 -28
- package/dist/context/feature.d.ts +0 -39
- package/dist/context/feature.js +0 -77
- package/dist/context/files.d.ts +0 -13
- package/dist/context/files.js +1 -24
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -12
- package/dist/context/project.d.ts +0 -21
- package/dist/context/project.js +0 -30
- package/dist/context/types.d.ts +0 -48
- package/dist/context/types.js +0 -12
- package/dist/context/utils.d.ts +0 -18
- package/dist/context/utils.js +0 -27
- package/dist/core/engine/promptBuilder.d.ts +0 -17
- package/dist/core/engine/promptBuilder.js +0 -28
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/loader/MaskLoader.d.ts +0 -23
- package/dist/core/loader/MaskLoader.js +0 -29
- package/dist/core/schema/types.d.ts +0 -47
- package/dist/core/schema/types.js +0 -6
- package/dist/core/schema/validator.d.ts +0 -14
- package/dist/core/schema/validator.js +0 -18
- package/dist/i18n/index.d.ts +0 -18
- package/dist/i18n/index.js +4 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/lib.d.ts +0 -5
- package/dist/lib.js +0 -12
- package/dist/memory/chunking.d.ts +0 -22
- package/dist/memory/chunking.js +2 -37
- package/dist/memory/core.d.ts +0 -29
- package/dist/memory/core.js +1 -52
- package/dist/memory/index.d.ts +0 -5
- package/dist/memory/index.js +0 -10
- package/dist/memory/indexer.d.ts +0 -21
- package/dist/memory/indexer.js +0 -44
- package/dist/memory/providers/examples.d.ts +0 -5
- package/dist/memory/providers/examples.js +4 -64
- package/dist/memory/providers/factory.d.ts +0 -44
- package/dist/memory/providers/factory.js +0 -46
- package/dist/memory/providers/index.d.ts +0 -26
- package/dist/memory/providers/index.js +0 -28
- package/dist/memory/providers/ollama.d.ts +0 -6
- package/dist/memory/providers/ollama.js +1 -8
- package/dist/memory/providers/openai.d.ts +0 -6
- package/dist/memory/providers/openai.js +1 -8
- package/dist/memory/providers/openrouter.d.ts +0 -6
- package/dist/memory/providers/openrouter.js +0 -8
- package/dist/memory/providers/text-only.d.ts +0 -13
- package/dist/memory/providers/text-only.js +0 -17
- package/dist/memory/providers/types.d.ts +0 -39
- package/dist/memory/providers/types.js +0 -7
- package/dist/memory/providers/voyage.d.ts +0 -22
- package/dist/memory/providers/voyage.js +1 -24
- package/dist/memory/search/hybrid.d.ts +0 -12
- package/dist/memory/search/hybrid.js +1 -22
- package/dist/memory/store/sqlite.d.ts +0 -72
- package/dist/memory/store/sqlite.js +4 -127
- package/dist/plugin/config/index.d.ts +0 -112
- package/dist/plugin/config/index.js +0 -115
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +1 -123
- package/dist/plugin/tools/command-registry.d.ts +0 -6
- package/dist/plugin/tools/command-registry.js +0 -14
- package/dist/plugin/tools/context.d.ts +0 -12
- package/dist/plugin/tools/context.js +0 -58
- package/dist/plugin/tools/maskSave.d.ts +0 -3
- package/dist/plugin/tools/maskSave.js +0 -3
- package/dist/plugin/tools/memoryGet.d.ts +0 -3
- package/dist/plugin/tools/memoryGet.js +0 -3
- package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
- package/dist/plugin/tools/memoryIndexer.js +0 -10
- package/dist/plugin/tools/memorySearch.d.ts +0 -31
- package/dist/plugin/tools/memorySearch.js +0 -79
- package/dist/plugin/tools/memoryWrite.d.ts +0 -8
- package/dist/plugin/tools/memoryWrite.js +0 -32
- package/dist/plugin/tools/retrospect.d.ts +0 -3
- package/dist/plugin/tools/retrospect.js +0 -3
- package/dist/plugin/tools/slashcommand.d.ts +0 -11
- package/dist/plugin/tools/slashcommand.js +0 -38
- package/dist/plugin/tools/squad.d.ts +0 -12
- package/dist/plugin/tools/squad.js +11 -83
- package/dist/plugin/tools/weave.d.ts +0 -6
- package/dist/plugin/tools/weave.js +0 -78
- package/dist/plugin/types.d.ts +0 -20
- package/dist/plugin/types.js +0 -7
- package/dist/retrospect/index.d.ts +0 -7
- package/dist/retrospect/index.js +0 -9
- package/dist/retrospect/mask-save.d.ts +0 -12
- package/dist/retrospect/mask-save.js +1 -80
- package/dist/retrospect/retrospect.d.ts +0 -18
- package/dist/retrospect/retrospect.js +0 -63
- package/dist/retrospect/strategies/base.d.ts +0 -15
- package/dist/retrospect/strategies/base.js +0 -7
- package/dist/retrospect/strategies/deep.d.ts +0 -12
- package/dist/retrospect/strategies/deep.js +0 -24
- package/dist/retrospect/strategies/index.d.ts +0 -12
- package/dist/retrospect/strategies/index.js +0 -12
- package/dist/retrospect/strategies/quick.d.ts +0 -12
- package/dist/retrospect/strategies/quick.js +0 -19
- package/dist/retrospect/strategies/standard.d.ts +0 -12
- package/dist/retrospect/strategies/standard.js +0 -15
- package/dist/retrospect/types.d.ts +0 -7
- package/dist/retrospect/types.js +0 -7
- package/dist/shared/config.d.ts +0 -105
- package/dist/shared/config.js +0 -33
- package/dist/shared/errors.d.ts +0 -18
- package/dist/shared/errors.js +0 -19
- package/dist/shared/generate-agents.d.ts +0 -69
- package/dist/shared/generate-agents.js +2 -86
- package/dist/shared/image.d.ts +0 -67
- package/dist/shared/image.js +6 -104
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/index.js +0 -7
- package/dist/shared/model-registry.d.ts +0 -72
- package/dist/shared/model-registry.js +5 -95
- package/dist/shared/types.d.ts +0 -15
- package/dist/shared/types.js +0 -3
- package/dist/shared-context/dag.d.ts +0 -105
- package/dist/shared-context/dag.js +3 -114
- package/dist/shared-context/index.d.ts +0 -5
- package/dist/shared-context/index.js +0 -15
- package/dist/shared-context/logger.d.ts +0 -37
- package/dist/shared-context/logger.js +0 -41
- package/dist/shared-context/parallel-executor.d.ts +0 -54
- package/dist/shared-context/parallel-executor.js +4 -56
- package/dist/shared-context/session.d.ts +0 -56
- package/dist/shared-context/session.js +0 -47
- package/dist/shared-context/squad.d.ts +0 -68
- package/dist/shared-context/squad.js +0 -63
- package/dist/shared-context/storage.d.ts +0 -132
- package/dist/shared-context/storage.js +0 -116
- package/dist/shared-context/task.d.ts +0 -120
- package/dist/shared-context/task.js +0 -152
- package/dist/shared-context/test/dag.test.js +9 -14
- package/dist/shared-context/test/logger.test.d.ts +0 -8
- package/dist/shared-context/test/logger.test.js +0 -52
- package/dist/shared-context/test/session.test.d.ts +0 -7
- package/dist/shared-context/test/session.test.js +0 -63
- package/dist/shared-context/test/squad.test.d.ts +0 -10
- package/dist/shared-context/test/squad.test.js +2 -68
- package/dist/shared-context/test/storage.test.d.ts +0 -8
- package/dist/shared-context/test/storage.test.js +0 -68
- package/dist/shared-context/test/task.test.d.ts +0 -7
- package/dist/shared-context/test/task.test.js +0 -54
- package/dist/shared-context/test/watchdog.test.d.ts +0 -7
- package/dist/shared-context/test/watchdog.test.js +3 -58
- package/dist/shared-context/types.d.ts +0 -215
- package/dist/shared-context/types.js +0 -125
- package/dist/shared-context/watchdog.d.ts +0 -127
- package/dist/shared-context/watchdog.js +0 -148
- package/dist/shared-context/worktree.d.ts +0 -68
- package/dist/shared-context/worktree.js +2 -34
- package/dist/verify/budget.d.ts +0 -29
- package/dist/verify/budget.js +0 -34
- package/dist/verify/critical-files.d.ts +0 -17
- package/dist/verify/critical-files.js +0 -37
- package/dist/verify/escalation.d.ts +0 -20
- package/dist/verify/escalation.js +0 -22
- package/dist/verify/index.d.ts +0 -5
- package/dist/verify/index.js +0 -11
- package/dist/verify/prompts.d.ts +0 -20
- package/dist/verify/prompts.js +0 -20
- package/dist/verify/types.d.ts +0 -26
- package/dist/verify/types.js +1 -12
- package/dist/verify/verifier.d.ts +0 -29
- package/dist/verify/verifier.js +0 -54
- package/dist/version.d.ts +1 -16
- package/dist/version.js +1 -16
- package/dist/weave/bridge.d.ts +0 -35
- package/dist/weave/bridge.js +0 -51
- package/dist/weave/environment/detector.d.ts +0 -6
- package/dist/weave/environment/detector.js +4 -45
- package/dist/weave/environment/index.d.ts +0 -19
- package/dist/weave/environment/index.js +1 -39
- package/dist/weave/environment/issues.d.ts +0 -35
- package/dist/weave/environment/issues.js +0 -59
- package/dist/weave/git.d.ts +0 -8
- package/dist/weave/git.js +0 -8
- package/dist/weave/index.d.ts +0 -13
- package/dist/weave/index.js +2 -28
- package/dist/weave/knowledge/global.d.ts +0 -39
- package/dist/weave/knowledge/global.js +2 -78
- package/dist/weave/loop.js +0 -3
- package/dist/weave/orchestrator.d.ts +0 -69
- package/dist/weave/orchestrator.js +1 -101
- package/dist/weave/phase-manager.d.ts +0 -64
- package/dist/weave/phase-manager.js +0 -89
- package/dist/weave/security/secret-scan.d.ts +0 -14
- package/dist/weave/security/secret-scan.js +0 -19
- package/dist/weave/stages/build.js +0 -15
- package/dist/weave/stages/execute.d.ts +0 -42
- package/dist/weave/stages/execute.js +4 -86
- package/dist/weave/stages/handoff.d.ts +0 -7
- package/dist/weave/stages/handoff.js +0 -43
- package/dist/weave/stages/index.d.ts +0 -3
- package/dist/weave/stages/index.js +0 -3
- package/dist/weave/stages/intake.d.ts +0 -8
- package/dist/weave/stages/intake.js +5 -65
- package/dist/weave/stages/map.d.ts +0 -1
- package/dist/weave/stages/openspec.d.ts +0 -1
- package/dist/weave/stages/plan.d.ts +0 -11
- package/dist/weave/stages/plan.js +1 -53
- package/dist/weave/stages/refine.d.ts +0 -7
- package/dist/weave/stages/refine.js +0 -7
- package/dist/weave/stages/research.d.ts +0 -6
- package/dist/weave/stages/research.js +0 -6
- package/dist/weave/stages/spec.d.ts +0 -12
- package/dist/weave/stages/spec.js +0 -17
- package/dist/weave/types.d.ts +0 -20
- package/dist/weave/types.js +0 -5
- package/dist/weave/verification/commands.d.ts +0 -12
- package/dist/weave/verification/commands.js +0 -19
- package/dist/weave/verification/index.d.ts +0 -6
- package/dist/weave/verification/index.js +1 -19
- package/dist/weave/verification/playwright.d.ts +0 -47
- package/dist/weave/verification/playwright.js +1 -90
- package/dist/weave/worktree.d.ts +0 -16
- package/dist/weave/worktree.js +0 -23
- package/dist/weave/yaml-repair.d.ts +0 -39
- package/dist/weave/yaml-repair.js +13 -116
- package/package.json +1 -1
|
@@ -1,62 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model Registry
|
|
3
|
-
*
|
|
4
|
-
* Manages the pool of available AI models with:
|
|
5
|
-
* - Concurrency tracking (max N simultaneous uses per model)
|
|
6
|
-
* - Capability-based matching (task → best model)
|
|
7
|
-
* - Tier-based fallback (if preferred model is full, find similar)
|
|
8
|
-
* - Cost-aware scheduling (prefer cheaper models for simple tasks)
|
|
9
|
-
*
|
|
10
|
-
* "The art of programming is the art of organizing complexity." - Dijkstra
|
|
11
|
-
*
|
|
12
|
-
* @author Mask Weaver
|
|
13
|
-
*/
|
|
14
1
|
import { loadRuntimeConfig, normalizeDummyHumansConfig } from './config.js';
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// Cost tier ordering
|
|
17
|
-
// ============================================================================
|
|
18
2
|
const COST_ORDER = {
|
|
19
3
|
low: 1,
|
|
20
4
|
medium: 2,
|
|
21
5
|
high: 3,
|
|
22
6
|
};
|
|
23
|
-
// ============================================================================
|
|
24
|
-
// Tier fallback chain - when preferred tier is full
|
|
25
|
-
// ============================================================================
|
|
26
7
|
const TIER_FALLBACK = {
|
|
27
|
-
flash: ['human', 'premium'],
|
|
28
|
-
human: ['premium', 'flash'],
|
|
29
|
-
premium: ['human', 'flash'],
|
|
8
|
+
flash: ['human', 'premium'],
|
|
9
|
+
human: ['premium', 'flash'],
|
|
10
|
+
premium: ['human', 'flash'],
|
|
30
11
|
};
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// Model Registry
|
|
33
|
-
// ============================================================================
|
|
34
12
|
export class ModelRegistry {
|
|
35
13
|
pool;
|
|
36
14
|
activeCountMap = new Map();
|
|
37
15
|
constructor(pool) {
|
|
38
16
|
this.pool = pool;
|
|
39
|
-
// Initialize all counts to 0
|
|
40
17
|
for (const entry of pool) {
|
|
41
18
|
this.activeCountMap.set(entry.id, 0);
|
|
42
19
|
}
|
|
43
20
|
}
|
|
44
|
-
// --------------------------------------------------------------------------
|
|
45
|
-
// Core: Acquire / Release
|
|
46
|
-
// --------------------------------------------------------------------------
|
|
47
|
-
/**
|
|
48
|
-
* Acquire a model from the pool.
|
|
49
|
-
*
|
|
50
|
-
* Selection strategy:
|
|
51
|
-
* 1. If modelId specified → try that exact model
|
|
52
|
-
* 2. Filter by tier preference
|
|
53
|
-
* 3. Filter by required capabilities
|
|
54
|
-
* 4. Among candidates, pick best available (cost-aware)
|
|
55
|
-
* 5. If no match in preferred tier, try fallback tiers
|
|
56
|
-
*/
|
|
57
21
|
acquire(options = {}) {
|
|
58
22
|
const { tier, capabilities, preferCheap = true, modelId } = options;
|
|
59
|
-
// Specific model requested
|
|
60
23
|
if (modelId) {
|
|
61
24
|
const entry = this.pool.find(e => e.id === modelId);
|
|
62
25
|
if (!entry) {
|
|
@@ -64,23 +27,19 @@ export class ModelRegistry {
|
|
|
64
27
|
}
|
|
65
28
|
return this.tryAcquire(entry);
|
|
66
29
|
}
|
|
67
|
-
// Tier + capabilities based selection
|
|
68
30
|
const tiersToTry = [];
|
|
69
31
|
if (tier) {
|
|
70
32
|
tiersToTry.push(tier, ...TIER_FALLBACK[tier]);
|
|
71
33
|
}
|
|
72
34
|
else {
|
|
73
|
-
// No tier specified → try all from cheapest
|
|
74
35
|
tiersToTry.push('flash', 'human', 'premium');
|
|
75
36
|
}
|
|
76
37
|
for (const tryTier of tiersToTry) {
|
|
77
38
|
const candidates = this.findCandidates(tryTier, capabilities);
|
|
78
|
-
// Sort by availability then cost
|
|
79
39
|
const sorted = this.sortCandidates(candidates, preferCheap);
|
|
80
40
|
for (const entry of sorted) {
|
|
81
41
|
const result = this.tryAcquire(entry);
|
|
82
42
|
if (result.success) {
|
|
83
|
-
// If we fell back to a different tier, note it
|
|
84
43
|
if (tier && tryTier !== tier) {
|
|
85
44
|
result.suggestion = `Preferred tier "${tier}" was full. Using "${tryTier}" model "${entry.id}" instead.`;
|
|
86
45
|
}
|
|
@@ -88,32 +47,23 @@ export class ModelRegistry {
|
|
|
88
47
|
}
|
|
89
48
|
}
|
|
90
49
|
}
|
|
91
|
-
// All models exhausted
|
|
92
50
|
return {
|
|
93
51
|
success: false,
|
|
94
52
|
reason: 'All suitable models are at maximum concurrency',
|
|
95
53
|
suggestion: this.suggestWait(tier, capabilities),
|
|
96
54
|
};
|
|
97
55
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Release a model back to the pool.
|
|
100
|
-
* Must be called when a task using this model completes.
|
|
101
|
-
*/
|
|
102
56
|
release(modelId) {
|
|
103
57
|
const current = this.activeCountMap.get(modelId);
|
|
104
58
|
if (current === undefined) {
|
|
105
|
-
return false;
|
|
59
|
+
return false;
|
|
106
60
|
}
|
|
107
61
|
if (current <= 0) {
|
|
108
|
-
return false;
|
|
62
|
+
return false;
|
|
109
63
|
}
|
|
110
64
|
this.activeCountMap.set(modelId, current - 1);
|
|
111
65
|
return true;
|
|
112
66
|
}
|
|
113
|
-
// --------------------------------------------------------------------------
|
|
114
|
-
// Query: Status and availability
|
|
115
|
-
// --------------------------------------------------------------------------
|
|
116
|
-
/** Get the current status of all models in the pool */
|
|
117
67
|
getStatus() {
|
|
118
68
|
const models = this.pool.map(entry => this.getSlot(entry));
|
|
119
69
|
const totalCapacity = models.reduce((sum, m) => sum + m.entry.maxConcurrent, 0);
|
|
@@ -125,20 +75,17 @@ export class ModelRegistry {
|
|
|
125
75
|
totalAvailable: totalCapacity - totalActive,
|
|
126
76
|
};
|
|
127
77
|
}
|
|
128
|
-
/** Get available models for a specific tier */
|
|
129
78
|
getAvailableForTier(tier) {
|
|
130
79
|
return this.pool
|
|
131
80
|
.filter(e => e.tier === tier)
|
|
132
81
|
.map(e => this.getSlot(e))
|
|
133
82
|
.filter(s => s.available);
|
|
134
83
|
}
|
|
135
|
-
/** Get all models with a specific capability */
|
|
136
84
|
getModelsWithCapability(capability) {
|
|
137
85
|
return this.pool
|
|
138
86
|
.filter(e => e.capabilities.includes(capability))
|
|
139
87
|
.map(e => this.getSlot(e));
|
|
140
88
|
}
|
|
141
|
-
/** Get the total concurrency available for a tier (including fallbacks) */
|
|
142
89
|
getTierConcurrency(tier) {
|
|
143
90
|
const tiersToInclude = [tier, ...TIER_FALLBACK[tier]];
|
|
144
91
|
const entries = this.pool.filter(e => tiersToInclude.includes(e.tier));
|
|
@@ -154,21 +101,12 @@ export class ModelRegistry {
|
|
|
154
101
|
}
|
|
155
102
|
return { total, available, models };
|
|
156
103
|
}
|
|
157
|
-
/** Get the pool entries */
|
|
158
104
|
getPool() {
|
|
159
105
|
return [...this.pool];
|
|
160
106
|
}
|
|
161
|
-
/** Get the agent name for a pool entry */
|
|
162
107
|
getAgentName(entry) {
|
|
163
108
|
return `dummy-${entry.id}`;
|
|
164
109
|
}
|
|
165
|
-
// --------------------------------------------------------------------------
|
|
166
|
-
// Recommend: Smart model selection
|
|
167
|
-
// --------------------------------------------------------------------------
|
|
168
|
-
/**
|
|
169
|
-
* Recommend the best model for a task based on its capabilities.
|
|
170
|
-
* Does NOT acquire — just suggests.
|
|
171
|
-
*/
|
|
172
110
|
recommend(options = {}) {
|
|
173
111
|
const { tier, capabilities, preferCheap = true } = options;
|
|
174
112
|
const tiersToTry = tier
|
|
@@ -186,17 +124,11 @@ export class ModelRegistry {
|
|
|
186
124
|
}
|
|
187
125
|
return null;
|
|
188
126
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Compute maximum parallelism for a set of tasks.
|
|
191
|
-
* Given N tasks of different tiers, returns how many can run simultaneously.
|
|
192
|
-
*/
|
|
193
127
|
computeMaxParallelism(taskTiers) {
|
|
194
|
-
// Count tasks per tier
|
|
195
128
|
const tierCounts = new Map();
|
|
196
129
|
for (const tier of taskTiers) {
|
|
197
130
|
tierCounts.set(tier, (tierCounts.get(tier) ?? 0) + 1);
|
|
198
131
|
}
|
|
199
|
-
// For each tier, compute available concurrency
|
|
200
132
|
let maxParallel = 0;
|
|
201
133
|
for (const [tier, count] of tierCounts) {
|
|
202
134
|
const entries = this.pool.filter(e => e.tier === tier);
|
|
@@ -205,9 +137,6 @@ export class ModelRegistry {
|
|
|
205
137
|
}
|
|
206
138
|
return maxParallel;
|
|
207
139
|
}
|
|
208
|
-
// --------------------------------------------------------------------------
|
|
209
|
-
// Internal helpers
|
|
210
|
-
// --------------------------------------------------------------------------
|
|
211
140
|
getSlot(entry) {
|
|
212
141
|
const activeCount = this.activeCountMap.get(entry.id) ?? 0;
|
|
213
142
|
const remainingSlots = entry.maxConcurrent - activeCount;
|
|
@@ -226,7 +155,6 @@ export class ModelRegistry {
|
|
|
226
155
|
reason: `Model "${entry.id}" at max concurrency (${entry.maxConcurrent})`,
|
|
227
156
|
};
|
|
228
157
|
}
|
|
229
|
-
// Increment active count
|
|
230
158
|
this.activeCountMap.set(entry.id, slot.activeCount + 1);
|
|
231
159
|
return {
|
|
232
160
|
success: true,
|
|
@@ -241,10 +169,8 @@ export class ModelRegistry {
|
|
|
241
169
|
}
|
|
242
170
|
findCandidates(tier, capabilities) {
|
|
243
171
|
return this.pool.filter(entry => {
|
|
244
|
-
// Must match tier
|
|
245
172
|
if (entry.tier !== tier)
|
|
246
173
|
return false;
|
|
247
|
-
// If capabilities specified, at least one must match
|
|
248
174
|
if (capabilities && capabilities.length > 0) {
|
|
249
175
|
const hasMatch = capabilities.some(c => entry.capabilities.includes(c));
|
|
250
176
|
if (!hasMatch)
|
|
@@ -255,20 +181,17 @@ export class ModelRegistry {
|
|
|
255
181
|
}
|
|
256
182
|
sortCandidates(entries, preferCheap) {
|
|
257
183
|
return [...entries].sort((a, b) => {
|
|
258
|
-
// 1. Available slots first
|
|
259
184
|
const slotA = this.getSlot(a);
|
|
260
185
|
const slotB = this.getSlot(b);
|
|
261
186
|
if (slotA.available && !slotB.available)
|
|
262
187
|
return -1;
|
|
263
188
|
if (!slotA.available && slotB.available)
|
|
264
189
|
return 1;
|
|
265
|
-
// 2. Cost ordering
|
|
266
190
|
if (preferCheap) {
|
|
267
191
|
const costDiff = COST_ORDER[a.costTier] - COST_ORDER[b.costTier];
|
|
268
192
|
if (costDiff !== 0)
|
|
269
193
|
return costDiff;
|
|
270
194
|
}
|
|
271
|
-
// 3. More remaining slots = better
|
|
272
195
|
return slotB.remainingSlots - slotA.remainingSlots;
|
|
273
196
|
});
|
|
274
197
|
}
|
|
@@ -284,14 +207,7 @@ export class ModelRegistry {
|
|
|
284
207
|
return `All models are busy. Current usage:\n${hints.join('\n')}\nWait for a task to complete or add more models to the pool.`;
|
|
285
208
|
}
|
|
286
209
|
}
|
|
287
|
-
// ============================================================================
|
|
288
|
-
// Singleton Instance
|
|
289
|
-
// ============================================================================
|
|
290
210
|
let registryInstance = null;
|
|
291
|
-
/**
|
|
292
|
-
* Get the global model registry.
|
|
293
|
-
* Lazily initialized from maskweaver.config.json.
|
|
294
|
-
*/
|
|
295
211
|
export function getModelRegistry(basePath) {
|
|
296
212
|
if (!registryInstance) {
|
|
297
213
|
const config = loadRuntimeConfig(basePath);
|
|
@@ -302,15 +218,9 @@ export function getModelRegistry(basePath) {
|
|
|
302
218
|
}
|
|
303
219
|
return registryInstance;
|
|
304
220
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Reset the registry (for testing or config reload).
|
|
307
|
-
*/
|
|
308
221
|
export function resetModelRegistry() {
|
|
309
222
|
registryInstance = null;
|
|
310
223
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Create a fresh registry from explicit pool entries.
|
|
313
|
-
*/
|
|
314
224
|
export function createModelRegistry(pool) {
|
|
315
225
|
registryInstance = new ModelRegistry(pool);
|
|
316
226
|
return registryInstance;
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common types used across Maskweaver packages
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Result type for operations that can fail gracefully
|
|
6
|
-
*/
|
|
7
1
|
export type Result<T> = {
|
|
8
2
|
success: true;
|
|
9
3
|
data: T;
|
|
@@ -11,21 +5,12 @@ export type Result<T> = {
|
|
|
11
5
|
success: false;
|
|
12
6
|
error: string;
|
|
13
7
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Health check result for system components
|
|
16
|
-
*/
|
|
17
8
|
export interface HealthCheckResult {
|
|
18
9
|
ok: boolean;
|
|
19
10
|
reason?: string;
|
|
20
11
|
hint?: string;
|
|
21
12
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Log levels for the system
|
|
24
|
-
*/
|
|
25
13
|
export type LogLevel = "error" | "warn" | "info" | "debug";
|
|
26
|
-
/**
|
|
27
|
-
* Feature status
|
|
28
|
-
*/
|
|
29
14
|
export interface FeatureStatus {
|
|
30
15
|
enabled: boolean;
|
|
31
16
|
healthy?: boolean;
|
package/dist/shared/types.js
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DAG (Directed Acyclic Graph) Dependency Analysis
|
|
3
|
-
*
|
|
4
|
-
* Analyzes task dependencies to enable parallel execution.
|
|
5
|
-
* Uses Kahn's algorithm for topological sorting and wave grouping.
|
|
6
|
-
*
|
|
7
|
-
* "Make the implicit explicit" - Eric Evans
|
|
8
|
-
* Task dependencies are the implicit structure; DAG makes it explicit.
|
|
9
|
-
*
|
|
10
|
-
* @author Jeff Dean's Dummy Human
|
|
11
|
-
*/
|
|
12
1
|
import type { TaskState } from "./types.js";
|
|
13
|
-
/**
|
|
14
|
-
* DAG node representation
|
|
15
|
-
*/
|
|
16
2
|
export interface DAGNode {
|
|
17
3
|
taskId: string;
|
|
18
4
|
dependencies: string[];
|
|
19
5
|
dependents: string[];
|
|
20
6
|
inDegree: number;
|
|
21
7
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Execution wave — tasks in same wave can run in parallel
|
|
24
|
-
*/
|
|
25
8
|
export interface ExecutionWave {
|
|
26
9
|
waveIndex: number;
|
|
27
10
|
taskIds: string[];
|
|
28
11
|
}
|
|
29
|
-
/**
|
|
30
|
-
* DAG analysis result
|
|
31
|
-
*/
|
|
32
12
|
export interface DAGAnalysis {
|
|
33
13
|
nodes: Map<string, DAGNode>;
|
|
34
14
|
waves: ExecutionWave[];
|
|
@@ -36,94 +16,9 @@ export interface DAGAnalysis {
|
|
|
36
16
|
hasCycle: boolean;
|
|
37
17
|
parallelismFactor: number;
|
|
38
18
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Build DAG from task list
|
|
41
|
-
* - Validates no cycles exist (throws if cycle detected)
|
|
42
|
-
* - Computes topological sort
|
|
43
|
-
* - Groups into parallel execution waves (Kahn's algorithm)
|
|
44
|
-
* - Identifies critical path
|
|
45
|
-
* @param tasks - List of tasks to build the DAG from.
|
|
46
|
-
* @returns An object containing the DAG analysis result.
|
|
47
|
-
* @throws {ValidationError} If a cycle is detected or dependencies are invalid.
|
|
48
|
-
* @example
|
|
49
|
-
* import { buildDAG } from './dag.js';
|
|
50
|
-
* import { TaskState } from './types.js';
|
|
51
|
-
*
|
|
52
|
-
* const tasks: TaskState[] = [
|
|
53
|
-
* { taskId: "A", dependencies: [], status: "pending", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
54
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
55
|
-
* { taskId: "C", dependencies: ["A"], status: "pending", assignee: "worker-2", priority: "medium", description: "Task C", createdAt: new Date().toISOString() },
|
|
56
|
-
* { taskId: "D", dependencies: ["B", "C"], status: "pending", assignee: "worker-3", priority: "medium", description: "Task D", createdAt: new Date().toISOString() },
|
|
57
|
-
* ];
|
|
58
|
-
* try {
|
|
59
|
-
* const dag = buildDAG(tasks);
|
|
60
|
-
* console.log(dag.waves);
|
|
61
|
-
* // Expected:
|
|
62
|
-
* // [
|
|
63
|
-
* // { waveIndex: 0, taskIds: ["A"] },
|
|
64
|
-
* // { waveIndex: 1, taskIds: ["B", "C"] },
|
|
65
|
-
* // { waveIndex: 2, taskIds: ["D"] }
|
|
66
|
-
* // ]
|
|
67
|
-
* console.log(dag.criticalPath); // Expected: ["A", "B", "D"] or ["A", "C", "D"]
|
|
68
|
-
* } catch (error) {
|
|
69
|
-
* if (error instanceof ValidationError) {
|
|
70
|
-
* console.error("DAG Error:", error.message);
|
|
71
|
-
* }
|
|
72
|
-
* }
|
|
73
|
-
*/
|
|
74
19
|
export declare function buildDAG(tasks: TaskState[]): DAGAnalysis;
|
|
75
|
-
/**
|
|
76
|
-
* Get next executable tasks (all dependencies completed)
|
|
77
|
-
* Used at runtime to determine what can be dispatched now
|
|
78
|
-
* @param tasks - All tasks in the squad.
|
|
79
|
-
* @returns An array of TaskState objects that are ready to be executed.
|
|
80
|
-
* @example
|
|
81
|
-
* import { getReadyTasks } from './dag.js';
|
|
82
|
-
* import { TaskState } from './types.js';
|
|
83
|
-
*
|
|
84
|
-
* const tasks: TaskState[] = [
|
|
85
|
-
* { taskId: "A", dependencies: [], status: "completed", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
86
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
87
|
-
* { taskId: "C", dependencies: [], status: "pending", assignee: "worker-2", priority: "medium", description: "Task C", createdAt: new Date().toISOString() },
|
|
88
|
-
* ];
|
|
89
|
-
* const ready = getReadyTasks(tasks);
|
|
90
|
-
* console.log(ready.map(t => t.taskId)); // Expected: ["B", "C"]
|
|
91
|
-
*/
|
|
92
20
|
export declare function getReadyTasks(tasks: TaskState[]): TaskState[];
|
|
93
|
-
/**
|
|
94
|
-
* Check if a task's dependencies are all satisfied
|
|
95
|
-
* @param task - The task to check.
|
|
96
|
-
* @param allTasks - All tasks in the squad.
|
|
97
|
-
* @returns True if all dependencies are completed, false otherwise.
|
|
98
|
-
* @example
|
|
99
|
-
* import { areDependenciesMet } from './dag.js';
|
|
100
|
-
* import { TaskState } from './types.js';
|
|
101
|
-
*
|
|
102
|
-
* const tasks: TaskState[] = [
|
|
103
|
-
* { taskId: "A", dependencies: [], status: "completed", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
104
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
105
|
-
* ];
|
|
106
|
-
* const taskB = tasks[1];
|
|
107
|
-
* const met = areDependenciesMet(taskB, tasks);
|
|
108
|
-
* console.log(met); // Expected: true
|
|
109
|
-
*/
|
|
110
21
|
export declare function areDependenciesMet(task: TaskState, allTasks: TaskState[]): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Validate that dependencies reference valid task IDs (no dangling refs)
|
|
113
|
-
* @param tasks - List of tasks to validate.
|
|
114
|
-
* @returns An object indicating validity and a list of errors if any.
|
|
115
|
-
* @example
|
|
116
|
-
* import { validateDependencies } from './dag.js';
|
|
117
|
-
* import { TaskState } from './types.js';
|
|
118
|
-
*
|
|
119
|
-
* const tasks: TaskState[] = [
|
|
120
|
-
* { taskId: "A", dependencies: [], status: "pending", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
121
|
-
* { taskId: "B", dependencies: ["A", "X"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() }, // X is invalid
|
|
122
|
-
* ];
|
|
123
|
-
* const validation = validateDependencies(tasks);
|
|
124
|
-
* console.log(validation.valid); // Expected: false
|
|
125
|
-
* console.log(validation.errors); // Expected: ["Task B depends on non-existent task X"]
|
|
126
|
-
*/
|
|
127
22
|
export declare function validateDependencies(tasks: TaskState[]): {
|
|
128
23
|
valid: boolean;
|
|
129
24
|
errors: string[];
|
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DAG (Directed Acyclic Graph) Dependency Analysis
|
|
3
|
-
*
|
|
4
|
-
* Analyzes task dependencies to enable parallel execution.
|
|
5
|
-
* Uses Kahn's algorithm for topological sorting and wave grouping.
|
|
6
|
-
*
|
|
7
|
-
* "Make the implicit explicit" - Eric Evans
|
|
8
|
-
* Task dependencies are the implicit structure; DAG makes it explicit.
|
|
9
|
-
*
|
|
10
|
-
* @author Jeff Dean's Dummy Human
|
|
11
|
-
*/
|
|
12
1
|
import { ValidationError } from "../shared/errors.js";
|
|
13
|
-
/**
|
|
14
|
-
* Build DAG from task list
|
|
15
|
-
* - Validates no cycles exist (throws if cycle detected)
|
|
16
|
-
* - Computes topological sort
|
|
17
|
-
* - Groups into parallel execution waves (Kahn's algorithm)
|
|
18
|
-
* - Identifies critical path
|
|
19
|
-
* @param tasks - List of tasks to build the DAG from.
|
|
20
|
-
* @returns An object containing the DAG analysis result.
|
|
21
|
-
* @throws {ValidationError} If a cycle is detected or dependencies are invalid.
|
|
22
|
-
* @example
|
|
23
|
-
* import { buildDAG } from './dag.js';
|
|
24
|
-
* import { TaskState } from './types.js';
|
|
25
|
-
*
|
|
26
|
-
* const tasks: TaskState[] = [
|
|
27
|
-
* { taskId: "A", dependencies: [], status: "pending", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
28
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
29
|
-
* { taskId: "C", dependencies: ["A"], status: "pending", assignee: "worker-2", priority: "medium", description: "Task C", createdAt: new Date().toISOString() },
|
|
30
|
-
* { taskId: "D", dependencies: ["B", "C"], status: "pending", assignee: "worker-3", priority: "medium", description: "Task D", createdAt: new Date().toISOString() },
|
|
31
|
-
* ];
|
|
32
|
-
* try {
|
|
33
|
-
* const dag = buildDAG(tasks);
|
|
34
|
-
* console.log(dag.waves);
|
|
35
|
-
* // Expected:
|
|
36
|
-
* // [
|
|
37
|
-
* // { waveIndex: 0, taskIds: ["A"] },
|
|
38
|
-
* // { waveIndex: 1, taskIds: ["B", "C"] },
|
|
39
|
-
* // { waveIndex: 2, taskIds: ["D"] }
|
|
40
|
-
* // ]
|
|
41
|
-
* console.log(dag.criticalPath); // Expected: ["A", "B", "D"] or ["A", "C", "D"]
|
|
42
|
-
* } catch (error) {
|
|
43
|
-
* if (error instanceof ValidationError) {
|
|
44
|
-
* console.error("DAG Error:", error.message);
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
*/
|
|
48
2
|
export function buildDAG(tasks) {
|
|
49
|
-
// Handle empty input
|
|
50
3
|
if (tasks.length === 0) {
|
|
51
4
|
return {
|
|
52
5
|
nodes: new Map(),
|
|
@@ -58,7 +11,6 @@ export function buildDAG(tasks) {
|
|
|
58
11
|
}
|
|
59
12
|
const nodes = new Map();
|
|
60
13
|
const taskMap = new Map();
|
|
61
|
-
// Initialize nodes and taskMap
|
|
62
14
|
for (const task of tasks) {
|
|
63
15
|
taskMap.set(task.taskId, task);
|
|
64
16
|
nodes.set(task.taskId, {
|
|
@@ -68,7 +20,6 @@ export function buildDAG(tasks) {
|
|
|
68
20
|
inDegree: 0,
|
|
69
21
|
});
|
|
70
22
|
}
|
|
71
|
-
// Validate dependencies and build graph (dependents, inDegree)
|
|
72
23
|
const validationResult = validateDependencies(tasks);
|
|
73
24
|
if (!validationResult.valid) {
|
|
74
25
|
throw new ValidationError(`Invalid dependencies: ${validationResult.errors.join(", ")}`);
|
|
@@ -81,9 +32,8 @@ export function buildDAG(tasks) {
|
|
|
81
32
|
taskNode.inDegree++;
|
|
82
33
|
}
|
|
83
34
|
}
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
const inDegreeCopy = new Map(); // Copy for Kahn's algorithm
|
|
35
|
+
const q = [];
|
|
36
|
+
const inDegreeCopy = new Map();
|
|
87
37
|
for (const [taskId, node] of nodes) {
|
|
88
38
|
inDegreeCopy.set(taskId, node.inDegree);
|
|
89
39
|
if (node.inDegree === 0) {
|
|
@@ -110,19 +60,15 @@ export function buildDAG(tasks) {
|
|
|
110
60
|
}
|
|
111
61
|
}
|
|
112
62
|
if (currentWaveTaskIds.length > 0) {
|
|
113
|
-
waves.push({ waveIndex: currentWaveIndex, taskIds: currentWaveTaskIds.sort() });
|
|
63
|
+
waves.push({ waveIndex: currentWaveIndex, taskIds: currentWaveTaskIds.sort() });
|
|
114
64
|
currentWaveIndex++;
|
|
115
65
|
}
|
|
116
66
|
q.push(...nextQ);
|
|
117
67
|
}
|
|
118
|
-
// Cycle detection
|
|
119
68
|
const hasCycle = topologicalOrder.length !== tasks.length;
|
|
120
69
|
if (hasCycle) {
|
|
121
70
|
throw new ValidationError("Cycle detected in task dependencies.");
|
|
122
71
|
}
|
|
123
|
-
// Critical Path (simple longest path by number of tasks)
|
|
124
|
-
// This is a simplified critical path calculation, assuming all tasks take equal "time".
|
|
125
|
-
// For more complex scenarios, task durations would be needed.
|
|
126
72
|
const distances = new Map();
|
|
127
73
|
for (const task of tasks) {
|
|
128
74
|
distances.set(task.taskId, 0);
|
|
@@ -144,7 +90,6 @@ export function buildDAG(tasks) {
|
|
|
144
90
|
endNodeId = taskId;
|
|
145
91
|
}
|
|
146
92
|
}
|
|
147
|
-
// Reconstruct critical path by backtracking
|
|
148
93
|
if (endNodeId) {
|
|
149
94
|
criticalPath.unshift(endNodeId);
|
|
150
95
|
let currentTaskId = endNodeId;
|
|
@@ -160,22 +105,16 @@ export function buildDAG(tasks) {
|
|
|
160
105
|
}
|
|
161
106
|
}
|
|
162
107
|
if (!foundPrev) {
|
|
163
|
-
// This should not happen if distances are calculated correctly for a DAG
|
|
164
|
-
// Fallback to just the current task if no predecessor is found (e.g., start of path)
|
|
165
108
|
break;
|
|
166
109
|
}
|
|
167
110
|
}
|
|
168
111
|
}
|
|
169
112
|
else if (tasks.length > 0) {
|
|
170
|
-
// If there's only one task or all tasks have distance 0 (no dependencies),
|
|
171
|
-
// the critical path is just the task itself.
|
|
172
|
-
// Find a task with 0 dependencies to be the start of a critical path if no endNodeId was found.
|
|
173
113
|
const startTask = tasks.find(t => (t.dependencies || []).length === 0);
|
|
174
114
|
if (startTask) {
|
|
175
115
|
criticalPath = [startTask.taskId];
|
|
176
116
|
}
|
|
177
117
|
}
|
|
178
|
-
// Parallelism Factor
|
|
179
118
|
const totalTasks = tasks.length;
|
|
180
119
|
const totalWaves = waves.length;
|
|
181
120
|
const parallelismFactor = totalWaves > 0 ? totalTasks / totalWaves : 0;
|
|
@@ -187,43 +126,9 @@ export function buildDAG(tasks) {
|
|
|
187
126
|
parallelismFactor,
|
|
188
127
|
};
|
|
189
128
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Get next executable tasks (all dependencies completed)
|
|
192
|
-
* Used at runtime to determine what can be dispatched now
|
|
193
|
-
* @param tasks - All tasks in the squad.
|
|
194
|
-
* @returns An array of TaskState objects that are ready to be executed.
|
|
195
|
-
* @example
|
|
196
|
-
* import { getReadyTasks } from './dag.js';
|
|
197
|
-
* import { TaskState } from './types.js';
|
|
198
|
-
*
|
|
199
|
-
* const tasks: TaskState[] = [
|
|
200
|
-
* { taskId: "A", dependencies: [], status: "completed", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
201
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
202
|
-
* { taskId: "C", dependencies: [], status: "pending", assignee: "worker-2", priority: "medium", description: "Task C", createdAt: new Date().toISOString() },
|
|
203
|
-
* ];
|
|
204
|
-
* const ready = getReadyTasks(tasks);
|
|
205
|
-
* console.log(ready.map(t => t.taskId)); // Expected: ["B", "C"]
|
|
206
|
-
*/
|
|
207
129
|
export function getReadyTasks(tasks) {
|
|
208
130
|
return tasks.filter(task => task.status === "pending" && areDependenciesMet(task, tasks));
|
|
209
131
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Check if a task's dependencies are all satisfied
|
|
212
|
-
* @param task - The task to check.
|
|
213
|
-
* @param allTasks - All tasks in the squad.
|
|
214
|
-
* @returns True if all dependencies are completed, false otherwise.
|
|
215
|
-
* @example
|
|
216
|
-
* import { areDependenciesMet } from './dag.js';
|
|
217
|
-
* import { TaskState } from './types.js';
|
|
218
|
-
*
|
|
219
|
-
* const tasks: TaskState[] = [
|
|
220
|
-
* { taskId: "A", dependencies: [], status: "completed", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
221
|
-
* { taskId: "B", dependencies: ["A"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() },
|
|
222
|
-
* ];
|
|
223
|
-
* const taskB = tasks[1];
|
|
224
|
-
* const met = areDependenciesMet(taskB, tasks);
|
|
225
|
-
* console.log(met); // Expected: true
|
|
226
|
-
*/
|
|
227
132
|
export function areDependenciesMet(task, allTasks) {
|
|
228
133
|
if (!task.dependencies || task.dependencies.length === 0) {
|
|
229
134
|
return true;
|
|
@@ -233,22 +138,6 @@ export function areDependenciesMet(task, allTasks) {
|
|
|
233
138
|
return depTask && depTask.status === "completed";
|
|
234
139
|
});
|
|
235
140
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Validate that dependencies reference valid task IDs (no dangling refs)
|
|
238
|
-
* @param tasks - List of tasks to validate.
|
|
239
|
-
* @returns An object indicating validity and a list of errors if any.
|
|
240
|
-
* @example
|
|
241
|
-
* import { validateDependencies } from './dag.js';
|
|
242
|
-
* import { TaskState } from './types.js';
|
|
243
|
-
*
|
|
244
|
-
* const tasks: TaskState[] = [
|
|
245
|
-
* { taskId: "A", dependencies: [], status: "pending", assignee: "worker-1", priority: "medium", description: "Task A", createdAt: new Date().toISOString() },
|
|
246
|
-
* { taskId: "B", dependencies: ["A", "X"], status: "pending", assignee: "worker-1", priority: "medium", description: "Task B", createdAt: new Date().toISOString() }, // X is invalid
|
|
247
|
-
* ];
|
|
248
|
-
* const validation = validateDependencies(tasks);
|
|
249
|
-
* console.log(validation.valid); // Expected: false
|
|
250
|
-
* console.log(validation.errors); // Expected: ["Task B depends on non-existent task X"]
|
|
251
|
-
*/
|
|
252
141
|
export function validateDependencies(tasks) {
|
|
253
142
|
const taskIds = new Set(tasks.map(t => t.taskId));
|
|
254
143
|
const errors = [];
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/shared-context
|
|
3
|
-
*
|
|
4
|
-
* Multi-agent collaboration with shared context
|
|
5
|
-
*/
|
|
6
1
|
export * from "./types.js";
|
|
7
2
|
export { FileStorageAdapter, validatePath, type StorageAdapter, type LockOptions } from "./storage.js";
|
|
8
3
|
export { createSession, loadSession, type Session, type CreateSessionOptions } from "./session.js";
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/shared-context
|
|
3
|
-
*
|
|
4
|
-
* Multi-agent collaboration with shared context
|
|
5
|
-
*/
|
|
6
|
-
// Types
|
|
7
1
|
export * from "./types.js";
|
|
8
|
-
// Storage
|
|
9
2
|
export { FileStorageAdapter, validatePath } from "./storage.js";
|
|
10
|
-
// Session
|
|
11
3
|
export { createSession, loadSession } from "./session.js";
|
|
12
|
-
// Squad
|
|
13
4
|
export { createSquad, getSquad, updateSquadState } from "./squad.js";
|
|
14
|
-
// Task
|
|
15
5
|
export { assignTask, getTask, updateTask, completeTask } from "./task.js";
|
|
16
|
-
// DAG Analysis
|
|
17
6
|
export { buildDAG, getReadyTasks, areDependenciesMet, validateDependencies } from "./dag.js";
|
|
18
|
-
// Worktree
|
|
19
7
|
export { createWorktreeManager } from "./worktree.js";
|
|
20
|
-
// Parallel Execution
|
|
21
8
|
export { createExecutionPlan, executeWave } from "./parallel-executor.js";
|
|
22
|
-
// Watchdog
|
|
23
9
|
export { checkSquadTimeout, checkTaskTimeout, markSquadExpired, runWatchdog } from "./watchdog.js";
|
|
24
|
-
// Logger
|
|
25
10
|
export { logEvent, readLog } from "./logger.js";
|