opencode-swarm-plugin 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -4
- package/claude-plugin/agents/background-worker.md +1 -0
- package/claude-plugin/agents/coordinator.md +1 -0
- package/claude-plugin/agents/worker.md +1 -0
- package/claude-plugin/bin/swarm-mcp-server.ts +47 -8
- package/claude-plugin/commands/hive.md +1 -1
- package/claude-plugin/commands/swarm.md +5 -1
- package/claude-plugin/dist/agent-mail.d.ts +480 -0
- package/claude-plugin/dist/agent-mail.d.ts.map +1 -0
- package/claude-plugin/dist/anti-patterns.d.ts +257 -0
- package/claude-plugin/dist/anti-patterns.d.ts.map +1 -0
- package/claude-plugin/dist/bin/swarm.js +373128 -0
- package/claude-plugin/dist/cass-tools.d.ts +74 -0
- package/claude-plugin/dist/cass-tools.d.ts.map +1 -0
- package/claude-plugin/dist/claude-plugin/claude-plugin-assets.d.ts +10 -0
- package/claude-plugin/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-hook.d.ts +178 -0
- package/claude-plugin/dist/compaction-hook.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-observability.d.ts +173 -0
- package/claude-plugin/dist/compaction-observability.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-prompt-scoring.d.ts +125 -0
- package/claude-plugin/dist/compaction-prompt-scoring.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-prompt-scoring.js +139 -0
- package/claude-plugin/dist/contributor-tools.d.ts +42 -0
- package/claude-plugin/dist/contributor-tools.d.ts.map +1 -0
- package/claude-plugin/dist/coordinator-guard.d.ts +79 -0
- package/claude-plugin/dist/coordinator-guard.d.ts.map +1 -0
- package/claude-plugin/dist/dashboard.d.ts +82 -0
- package/claude-plugin/dist/dashboard.d.ts.map +1 -0
- package/claude-plugin/dist/decision-trace-integration.d.ts +204 -0
- package/claude-plugin/dist/decision-trace-integration.d.ts.map +1 -0
- package/claude-plugin/dist/error-enrichment.d.ts +49 -0
- package/claude-plugin/dist/error-enrichment.d.ts.map +1 -0
- package/claude-plugin/dist/eval-capture.d.ts +494 -0
- package/claude-plugin/dist/eval-capture.d.ts.map +1 -0
- package/claude-plugin/dist/eval-capture.js +12844 -0
- package/claude-plugin/dist/eval-gates.d.ts +84 -0
- package/claude-plugin/dist/eval-gates.d.ts.map +1 -0
- package/claude-plugin/dist/eval-history.d.ts +117 -0
- package/claude-plugin/dist/eval-history.d.ts.map +1 -0
- package/claude-plugin/dist/eval-learning.d.ts +216 -0
- package/claude-plugin/dist/eval-learning.d.ts.map +1 -0
- package/claude-plugin/dist/eval-runner.d.ts +134 -0
- package/claude-plugin/dist/eval-runner.d.ts.map +1 -0
- package/claude-plugin/dist/examples/plugin-wrapper-template.ts +3341 -0
- package/claude-plugin/dist/export-tools.d.ts +76 -0
- package/claude-plugin/dist/export-tools.d.ts.map +1 -0
- package/claude-plugin/dist/hive.d.ts +949 -0
- package/claude-plugin/dist/hive.d.ts.map +1 -0
- package/claude-plugin/dist/hive.js +15009 -0
- package/claude-plugin/dist/hivemind-tools.d.ts +479 -0
- package/claude-plugin/dist/hivemind-tools.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/atomic-write.d.ts +21 -0
- package/claude-plugin/dist/hooks/atomic-write.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/constants.d.ts +28 -0
- package/claude-plugin/dist/hooks/constants.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/index.d.ts +16 -0
- package/claude-plugin/dist/hooks/index.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/session-start.d.ts +30 -0
- package/claude-plugin/dist/hooks/session-start.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/tool-complete.d.ts +54 -0
- package/claude-plugin/dist/hooks/tool-complete.d.ts.map +1 -0
- package/claude-plugin/dist/index.d.ts +2017 -0
- package/claude-plugin/dist/index.d.ts.map +1 -0
- package/claude-plugin/dist/index.js +73453 -0
- package/claude-plugin/dist/learning.d.ts +700 -0
- package/claude-plugin/dist/learning.d.ts.map +1 -0
- package/claude-plugin/dist/logger.d.ts +38 -0
- package/claude-plugin/dist/logger.d.ts.map +1 -0
- package/claude-plugin/dist/mandate-promotion.d.ts +93 -0
- package/claude-plugin/dist/mandate-promotion.d.ts.map +1 -0
- package/claude-plugin/dist/mandate-storage.d.ts +209 -0
- package/claude-plugin/dist/mandate-storage.d.ts.map +1 -0
- package/claude-plugin/dist/mandates.d.ts +230 -0
- package/claude-plugin/dist/mandates.d.ts.map +1 -0
- package/claude-plugin/dist/memory-tools.d.ts +281 -0
- package/claude-plugin/dist/memory-tools.d.ts.map +1 -0
- package/claude-plugin/dist/memory.d.ts +164 -0
- package/claude-plugin/dist/memory.d.ts.map +1 -0
- package/claude-plugin/dist/model-selection.d.ts +37 -0
- package/claude-plugin/dist/model-selection.d.ts.map +1 -0
- package/claude-plugin/dist/observability-health.d.ts +87 -0
- package/claude-plugin/dist/observability-health.d.ts.map +1 -0
- package/claude-plugin/dist/observability-tools.d.ts +184 -0
- package/claude-plugin/dist/observability-tools.d.ts.map +1 -0
- package/claude-plugin/dist/output-guardrails.d.ts +125 -0
- package/claude-plugin/dist/output-guardrails.d.ts.map +1 -0
- package/claude-plugin/dist/pattern-maturity.d.ts +246 -0
- package/claude-plugin/dist/pattern-maturity.d.ts.map +1 -0
- package/claude-plugin/dist/planning-guardrails.d.ts +183 -0
- package/claude-plugin/dist/planning-guardrails.d.ts.map +1 -0
- package/claude-plugin/dist/plugin.d.ts +22 -0
- package/claude-plugin/dist/plugin.d.ts.map +1 -0
- package/claude-plugin/dist/plugin.js +72295 -0
- package/claude-plugin/dist/post-compaction-tracker.d.ts +133 -0
- package/claude-plugin/dist/post-compaction-tracker.d.ts.map +1 -0
- package/claude-plugin/dist/query-tools.d.ts +90 -0
- package/claude-plugin/dist/query-tools.d.ts.map +1 -0
- package/claude-plugin/dist/rate-limiter.d.ts +218 -0
- package/claude-plugin/dist/rate-limiter.d.ts.map +1 -0
- package/claude-plugin/dist/regression-detection.d.ts +58 -0
- package/claude-plugin/dist/regression-detection.d.ts.map +1 -0
- package/claude-plugin/dist/replay-tools.d.ts +28 -0
- package/claude-plugin/dist/replay-tools.d.ts.map +1 -0
- package/claude-plugin/dist/repo-crawl.d.ts +146 -0
- package/claude-plugin/dist/repo-crawl.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/cell-events.d.ts +1352 -0
- package/claude-plugin/dist/schemas/cell-events.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/cell.d.ts +413 -0
- package/claude-plugin/dist/schemas/cell.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/evaluation.d.ts +161 -0
- package/claude-plugin/dist/schemas/evaluation.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/index.d.ts +46 -0
- package/claude-plugin/dist/schemas/index.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/mandate.d.ts +336 -0
- package/claude-plugin/dist/schemas/mandate.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/swarm-context.d.ts +131 -0
- package/claude-plugin/dist/schemas/swarm-context.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/task.d.ts +189 -0
- package/claude-plugin/dist/schemas/task.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/worker-handoff.d.ts +78 -0
- package/claude-plugin/dist/schemas/worker-handoff.d.ts.map +1 -0
- package/claude-plugin/dist/sessions/agent-discovery.d.ts +59 -0
- package/claude-plugin/dist/sessions/agent-discovery.d.ts.map +1 -0
- package/claude-plugin/dist/sessions/index.d.ts +10 -0
- package/claude-plugin/dist/sessions/index.d.ts.map +1 -0
- package/claude-plugin/dist/skills.d.ts +490 -0
- package/claude-plugin/dist/skills.d.ts.map +1 -0
- package/claude-plugin/dist/storage.d.ts +260 -0
- package/claude-plugin/dist/storage.d.ts.map +1 -0
- package/claude-plugin/dist/structured.d.ts +206 -0
- package/claude-plugin/dist/structured.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-adversarial-review.d.ts +104 -0
- package/claude-plugin/dist/swarm-adversarial-review.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-decompose.d.ts +297 -0
- package/claude-plugin/dist/swarm-decompose.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-insights.d.ts +390 -0
- package/claude-plugin/dist/swarm-insights.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-mail.d.ts +274 -0
- package/claude-plugin/dist/swarm-mail.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-orchestrate.d.ts +924 -0
- package/claude-plugin/dist/swarm-orchestrate.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-prompts.d.ts +467 -0
- package/claude-plugin/dist/swarm-prompts.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-prompts.js +45283 -0
- package/claude-plugin/dist/swarm-research.d.ts +125 -0
- package/claude-plugin/dist/swarm-research.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-review.d.ts +214 -0
- package/claude-plugin/dist/swarm-review.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-signature.d.ts +106 -0
- package/claude-plugin/dist/swarm-signature.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-strategies.d.ts +113 -0
- package/claude-plugin/dist/swarm-strategies.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-validation.d.ts +127 -0
- package/claude-plugin/dist/swarm-validation.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-worktree.d.ts +185 -0
- package/claude-plugin/dist/swarm-worktree.d.ts.map +1 -0
- package/claude-plugin/dist/swarm.d.ts +590 -0
- package/claude-plugin/dist/swarm.d.ts.map +1 -0
- package/claude-plugin/dist/tool-availability.d.ts +91 -0
- package/claude-plugin/dist/tool-availability.d.ts.map +1 -0
- package/claude-plugin/dist/utils/tree-renderer.d.ts +61 -0
- package/claude-plugin/dist/utils/tree-renderer.d.ts.map +1 -0
- package/claude-plugin/dist/validators/index.d.ts +7 -0
- package/claude-plugin/dist/validators/index.d.ts.map +1 -0
- package/claude-plugin/dist/validators/schema-validator.d.ts +58 -0
- package/claude-plugin/dist/validators/schema-validator.d.ts.map +1 -0
- package/claude-plugin/skills/always-on-guidance/SKILL.md +44 -0
- package/dist/agent-mail.d.ts +4 -4
- package/dist/agent-mail.d.ts.map +1 -1
- package/dist/bin/swarm.js +477 -22
- package/dist/claude-plugin/claude-plugin-assets.d.ts +10 -0
- package/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -0
- package/dist/compaction-hook.d.ts +1 -1
- package/dist/compaction-hook.d.ts.map +1 -1
- package/dist/index.js +375 -265
- package/dist/plugin.js +374 -264
- package/dist/skills.d.ts +15 -0
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +4 -2
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-prompts.js +84 -7
- package/global-skills/swarm-coordination/SKILL.md +21 -20
- package/package.json +2 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/compaction-prompt-scoring.ts
|
|
2
|
+
var REAL_EPIC_ID = /mjkw[a-z0-9]{7,}/;
|
|
3
|
+
var PLACEHOLDERS = [
|
|
4
|
+
/<epic-id>/i,
|
|
5
|
+
/bd-xxx/,
|
|
6
|
+
/<path>/i,
|
|
7
|
+
/<project>/i
|
|
8
|
+
];
|
|
9
|
+
var ASCII_BOX = /[┌┐└┘─│]{3,}/;
|
|
10
|
+
var STRONG_LANGUAGE = [/\bNEVER\b/, /\bALWAYS\b/, /\bNON-NEGOTIABLE\b/];
|
|
11
|
+
function scoreEpicIdSpecificity(prompt) {
|
|
12
|
+
for (const pattern of PLACEHOLDERS) {
|
|
13
|
+
if (pattern.test(prompt.content)) {
|
|
14
|
+
return {
|
|
15
|
+
score: 0,
|
|
16
|
+
message: `Found placeholder: ${pattern.source}`
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (REAL_EPIC_ID.test(prompt.content)) {
|
|
21
|
+
return {
|
|
22
|
+
score: 1,
|
|
23
|
+
message: "Contains real epic ID"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
score: 0,
|
|
28
|
+
message: "No epic ID found"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function scoreActionability(prompt) {
|
|
32
|
+
const actionableTools = [
|
|
33
|
+
/swarm_status\([^)]*epic_id\s*=\s*['"]mjkw[a-z0-9]{7,}['"]/,
|
|
34
|
+
/swarmmail_inbox\(\)/
|
|
35
|
+
];
|
|
36
|
+
for (const pattern of actionableTools) {
|
|
37
|
+
if (pattern.test(prompt.content)) {
|
|
38
|
+
return {
|
|
39
|
+
score: 1,
|
|
40
|
+
message: "Contains actionable tool call with real values"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (/swarm_status\([^)]*<epic-id>/.test(prompt.content) || /swarm_status\([^)]*<path>/.test(prompt.content)) {
|
|
45
|
+
return {
|
|
46
|
+
score: 0,
|
|
47
|
+
message: "Tool call has placeholders"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
score: 0,
|
|
52
|
+
message: "No actionable tool calls found"
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function scoreCoordinatorIdentity(prompt) {
|
|
56
|
+
const hasAsciiHeader = ASCII_BOX.test(prompt.content) && /(YOU ARE THE COORDINATOR|COORDINATOR MODE)/i.test(prompt.content);
|
|
57
|
+
if (!hasAsciiHeader) {
|
|
58
|
+
return {
|
|
59
|
+
score: 0,
|
|
60
|
+
message: "No ASCII header found"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const hasStrongLanguage = STRONG_LANGUAGE.some((pattern) => pattern.test(prompt.content));
|
|
64
|
+
if (!hasStrongLanguage) {
|
|
65
|
+
return {
|
|
66
|
+
score: 0.5,
|
|
67
|
+
message: "ASCII header present but weak language"
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
score: 1,
|
|
72
|
+
message: "ASCII header + strong mandates present"
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function scoreForbiddenToolsPresent(prompt) {
|
|
76
|
+
const forbiddenTools = [
|
|
77
|
+
/\bEdit\b/i,
|
|
78
|
+
/\bWrite\b/i,
|
|
79
|
+
/swarmmail_reserve/,
|
|
80
|
+
/git commit/,
|
|
81
|
+
/\bbash\b/i
|
|
82
|
+
];
|
|
83
|
+
const foundTools = forbiddenTools.filter((pattern) => pattern.test(prompt.content));
|
|
84
|
+
const score = foundTools.length / forbiddenTools.length;
|
|
85
|
+
if (score === 1) {
|
|
86
|
+
return {
|
|
87
|
+
score: 1,
|
|
88
|
+
message: "All 5 forbidden tools listed"
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (score === 0) {
|
|
92
|
+
return {
|
|
93
|
+
score: 0,
|
|
94
|
+
message: "No forbidden tools listed (0/5)"
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
score,
|
|
99
|
+
message: `${foundTools.length}/5 forbidden tools listed`
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function scorePostCompactionDiscipline(prompt) {
|
|
103
|
+
const toolCallPattern = /\b(swarm_status|swarmmail_inbox|Edit|Write|Read)\b/i;
|
|
104
|
+
const match = prompt.content.match(toolCallPattern);
|
|
105
|
+
if (!match) {
|
|
106
|
+
return {
|
|
107
|
+
score: 0,
|
|
108
|
+
message: "No tool calls found"
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const firstTool = match[1].toLowerCase();
|
|
112
|
+
if (firstTool === "swarm_status") {
|
|
113
|
+
return {
|
|
114
|
+
score: 1,
|
|
115
|
+
message: "First tool is swarm_status (correct)"
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (firstTool === "swarmmail_inbox") {
|
|
119
|
+
return {
|
|
120
|
+
score: 1,
|
|
121
|
+
message: "First tool is inbox (correct)"
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
score: 0,
|
|
126
|
+
message: `First tool is ${match[1]} (should be swarm_status or inbox)`
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
scorePostCompactionDiscipline,
|
|
131
|
+
scoreForbiddenToolsPresent,
|
|
132
|
+
scoreEpicIdSpecificity,
|
|
133
|
+
scoreCoordinatorIdentity,
|
|
134
|
+
scoreActionability,
|
|
135
|
+
STRONG_LANGUAGE,
|
|
136
|
+
REAL_EPIC_ID,
|
|
137
|
+
PLACEHOLDERS,
|
|
138
|
+
ASCII_BOX
|
|
139
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contributor Tools - GitHub profile extraction for changeset credits
|
|
3
|
+
*
|
|
4
|
+
* Provides contributor_lookup tool for fetching GitHub profiles and
|
|
5
|
+
* generating formatted changeset credit lines. Automatically stores
|
|
6
|
+
* contributor info in semantic-memory for future reference.
|
|
7
|
+
*
|
|
8
|
+
* Based on patterns from gh-issue-triage skill.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/**
|
|
12
|
+
* Reset cache for testing
|
|
13
|
+
*/
|
|
14
|
+
export declare function resetContributorCache(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Look up GitHub contributor and generate changeset credit
|
|
17
|
+
*/
|
|
18
|
+
export declare const contributor_lookup: {
|
|
19
|
+
description: string;
|
|
20
|
+
args: {
|
|
21
|
+
login: z.ZodString;
|
|
22
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
};
|
|
24
|
+
execute(args: {
|
|
25
|
+
login: string;
|
|
26
|
+
issue?: number | undefined;
|
|
27
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
28
|
+
};
|
|
29
|
+
export declare const contributorTools: {
|
|
30
|
+
readonly contributor_lookup: {
|
|
31
|
+
description: string;
|
|
32
|
+
args: {
|
|
33
|
+
login: z.ZodString;
|
|
34
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
};
|
|
36
|
+
execute(args: {
|
|
37
|
+
login: string;
|
|
38
|
+
issue?: number | undefined;
|
|
39
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=contributor-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contributor-tools.d.ts","sourceRoot":"","sources":["../src/contributor-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuHxB;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;CAgD7B,CAAC;AAMH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;CAEnB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coordinator Guard - Runtime Violation Enforcement
|
|
3
|
+
*
|
|
4
|
+
* Detects and REJECTS coordinator protocol violations at runtime.
|
|
5
|
+
* Unlike planning-guardrails.ts (which only warns), this guard throws errors
|
|
6
|
+
* to prevent coordinators from performing work that should be delegated to workers.
|
|
7
|
+
*
|
|
8
|
+
* Coordinators MUST:
|
|
9
|
+
* - Spawn workers via swarm_spawn_subtask
|
|
10
|
+
* - Review worker output via swarm_review
|
|
11
|
+
* - Coordinate and monitor, not implement
|
|
12
|
+
*
|
|
13
|
+
* Coordinators MUST NOT:
|
|
14
|
+
* - Edit or write files (use workers)
|
|
15
|
+
* - Run tests (workers verify their own work)
|
|
16
|
+
* - Reserve files (workers reserve before editing)
|
|
17
|
+
*
|
|
18
|
+
* @module coordinator-guard
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Custom error for coordinator guard violations
|
|
22
|
+
*
|
|
23
|
+
* Thrown when a coordinator attempts to perform work that should be delegated to workers.
|
|
24
|
+
* Includes helpful suggestions for the correct approach.
|
|
25
|
+
*/
|
|
26
|
+
export declare class CoordinatorGuardError extends Error {
|
|
27
|
+
/** Type of violation that occurred */
|
|
28
|
+
violationType: "coordinator_edited_file" | "coordinator_ran_tests" | "coordinator_reserved_files";
|
|
29
|
+
/** Additional context about the violation */
|
|
30
|
+
payload: Record<string, unknown>;
|
|
31
|
+
/** Helpful suggestion for fixing the violation */
|
|
32
|
+
suggestion?: string;
|
|
33
|
+
constructor(message: string, violationType: "coordinator_edited_file" | "coordinator_ran_tests" | "coordinator_reserved_files", payload?: Record<string, unknown>, suggestion?: string);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Result of coordinator guard check
|
|
37
|
+
*/
|
|
38
|
+
export interface GuardCheckResult {
|
|
39
|
+
/** Whether the tool call is blocked */
|
|
40
|
+
blocked: boolean;
|
|
41
|
+
/** Error if blocked */
|
|
42
|
+
error?: CoordinatorGuardError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if the current agent context is a coordinator
|
|
46
|
+
*
|
|
47
|
+
* @param agentContext - Agent context type
|
|
48
|
+
* @returns True if coordinator, false otherwise
|
|
49
|
+
*/
|
|
50
|
+
export declare function isCoordinator(agentContext: "coordinator" | "worker" | string): agentContext is "coordinator";
|
|
51
|
+
/**
|
|
52
|
+
* Check coordinator guard for potential violations
|
|
53
|
+
*
|
|
54
|
+
* This is the main entry point for the guard. It checks if the current tool call
|
|
55
|
+
* violates coordinator protocol and returns a result indicating whether to block
|
|
56
|
+
* the call and what error to throw.
|
|
57
|
+
*
|
|
58
|
+
* @param params - Guard check parameters
|
|
59
|
+
* @returns Guard check result with block status and optional error
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const result = checkCoordinatorGuard({
|
|
64
|
+
* agentContext: "coordinator",
|
|
65
|
+
* toolName: "edit",
|
|
66
|
+
* toolArgs: { filePath: "src/auth.ts" },
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* if (result.blocked) {
|
|
70
|
+
* throw result.error; // Prevents coordinator from editing files
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function checkCoordinatorGuard(params: {
|
|
75
|
+
agentContext: "coordinator" | "worker" | string;
|
|
76
|
+
toolName: string;
|
|
77
|
+
toolArgs: Record<string, unknown>;
|
|
78
|
+
}): GuardCheckResult;
|
|
79
|
+
//# sourceMappingURL=coordinator-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-guard.d.ts","sourceRoot":"","sources":["../src/coordinator-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,sCAAsC;IAC/B,aAAa,EAChB,yBAAyB,GACzB,uBAAuB,GACvB,4BAA4B,CAAC;IAEjC,6CAA6C;IACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC,kDAAkD;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,aAAa,EACT,yBAAyB,GACzB,uBAAuB,GACvB,4BAA4B,EAChC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,UAAU,CAAC,EAAE,MAAM;CAQtB;AAsCD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IAEjB,uBAAuB;IACvB,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,aAAa,GAAG,QAAQ,GAAG,MAAM,GAC9C,YAAY,IAAI,aAAa,CAE/B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,YAAY,EAAE,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,gBAAgB,CA+FnB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard Data Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides read-only queries for swarm observability dashboard.
|
|
5
|
+
* Data sources:
|
|
6
|
+
* - libSQL events table (event sourcing)
|
|
7
|
+
* - Hive cells (work items)
|
|
8
|
+
* - Agent projections (agent states)
|
|
9
|
+
* - Reservation projections (file locks)
|
|
10
|
+
*/
|
|
11
|
+
export interface WorkerStatus {
|
|
12
|
+
agent_name: string;
|
|
13
|
+
status: "idle" | "working" | "blocked";
|
|
14
|
+
current_task?: string;
|
|
15
|
+
last_activity: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SubtaskProgress {
|
|
18
|
+
bead_id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
status: "open" | "in_progress" | "completed" | "blocked";
|
|
21
|
+
progress_percent: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FileLock {
|
|
24
|
+
path: string;
|
|
25
|
+
agent_name: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
acquired_at: string;
|
|
28
|
+
ttl_seconds: number;
|
|
29
|
+
}
|
|
30
|
+
export interface RecentMessage {
|
|
31
|
+
id: number;
|
|
32
|
+
from: string;
|
|
33
|
+
to: string[];
|
|
34
|
+
subject: string;
|
|
35
|
+
timestamp: string;
|
|
36
|
+
importance: "low" | "normal" | "high" | "urgent";
|
|
37
|
+
}
|
|
38
|
+
export interface EpicInfo {
|
|
39
|
+
epic_id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
subtask_count: number;
|
|
42
|
+
completed_count: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get current status of all worker agents.
|
|
46
|
+
* Derives status from latest events: task_started, progress_reported, task_blocked, etc.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getWorkerStatus(projectPath: string, options?: {
|
|
49
|
+
project_key?: string;
|
|
50
|
+
}): Promise<WorkerStatus[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Get progress of all subtasks within an epic.
|
|
53
|
+
* Returns completion percentage from progress_reported events.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getSubtaskProgress(projectPath: string, epic_id: string): Promise<SubtaskProgress[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Get currently active file reservations.
|
|
58
|
+
* Excludes released reservations.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getFileLocks(projectPath: string, options?: {
|
|
61
|
+
project_key?: string;
|
|
62
|
+
}): Promise<FileLock[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Get recent swarm mail messages, ordered by timestamp descending.
|
|
65
|
+
* Defaults to limit of 10.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getRecentMessages(projectPath: string, options?: {
|
|
68
|
+
limit?: number;
|
|
69
|
+
thread_id?: string;
|
|
70
|
+
importance?: "low" | "normal" | "high" | "urgent";
|
|
71
|
+
}): Promise<RecentMessage[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Get list of all epics with subtask counts.
|
|
74
|
+
* Used for dashboard tabs/navigation.
|
|
75
|
+
*
|
|
76
|
+
* Derives epic information from events when beads table doesn't exist (test mode).
|
|
77
|
+
* In production, queries beads table directly.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getEpicList(projectPath: string, options?: {
|
|
80
|
+
status?: "open" | "in_progress" | "completed" | "blocked";
|
|
81
|
+
}): Promise<EpicInfo[]>;
|
|
82
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","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MAAM,EACnB,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,EAAE,CAAC,CAyD5B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAChC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAmDrB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;CAClD,GACC,OAAO,CAAC,aAAa,EAAE,CAAC,CAoD1B;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAA;CAAE,GACrE,OAAO,CAAC,QAAQ,EAAE,CAAC,CA4IrB"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision Trace Integration
|
|
3
|
+
*
|
|
4
|
+
* Wires decision trace capture into swarm coordination tools.
|
|
5
|
+
* Provides helper functions that tools can call to record decisions.
|
|
6
|
+
*
|
|
7
|
+
* ## Decision Types Captured
|
|
8
|
+
*
|
|
9
|
+
* - **strategy_selection** - Coordinator choosing decomposition strategy
|
|
10
|
+
* - **worker_spawn** - Coordinator spawning a worker agent
|
|
11
|
+
* - **review_decision** - Coordinator approving/rejecting worker output
|
|
12
|
+
* - **file_selection** - Worker choosing which files to modify
|
|
13
|
+
* - **scope_change** - Worker expanding/contracting task scope
|
|
14
|
+
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { traceStrategySelection, traceWorkerSpawn } from "./decision-trace-integration.js";
|
|
19
|
+
*
|
|
20
|
+
* // In swarm_delegate_planning:
|
|
21
|
+
* await traceStrategySelection({
|
|
22
|
+
* projectKey: "/path/to/project",
|
|
23
|
+
* agentName: "coordinator",
|
|
24
|
+
* epicId: "epic-123",
|
|
25
|
+
* strategy: "file-based",
|
|
26
|
+
* reasoning: "File-based chosen due to clear file boundaries",
|
|
27
|
+
* alternatives: [{ strategy: "feature-based", reason: "rejected" }],
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @module decision-trace-integration
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Extract memory IDs from precedent_cited object
|
|
35
|
+
*
|
|
36
|
+
* Handles both single memoryId and array memoryIds fields.
|
|
37
|
+
*
|
|
38
|
+
* @param precedentCited - Precedent object from decision trace
|
|
39
|
+
* @returns Array of memory IDs (empty if none found)
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractMemoryIds(precedentCited?: {
|
|
42
|
+
memoryId?: string;
|
|
43
|
+
memoryIds?: string[];
|
|
44
|
+
similarity?: number;
|
|
45
|
+
} | null): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Input for tracing strategy selection decisions
|
|
48
|
+
*/
|
|
49
|
+
export interface StrategySelectionInput {
|
|
50
|
+
projectKey: string;
|
|
51
|
+
agentName: string;
|
|
52
|
+
epicId?: string;
|
|
53
|
+
beadId?: string;
|
|
54
|
+
strategy: string;
|
|
55
|
+
reasoning: string;
|
|
56
|
+
confidence?: number;
|
|
57
|
+
taskPreview?: string;
|
|
58
|
+
inputsGathered?: Array<{
|
|
59
|
+
source: string;
|
|
60
|
+
query?: string;
|
|
61
|
+
results?: number;
|
|
62
|
+
}>;
|
|
63
|
+
alternatives?: Array<{
|
|
64
|
+
strategy: string;
|
|
65
|
+
score?: number;
|
|
66
|
+
reason?: string;
|
|
67
|
+
}>;
|
|
68
|
+
precedentCited?: {
|
|
69
|
+
memoryId?: string;
|
|
70
|
+
memoryIds?: string[];
|
|
71
|
+
similarity?: number;
|
|
72
|
+
cassResults?: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Trace a strategy selection decision
|
|
77
|
+
*
|
|
78
|
+
* Call this when the coordinator selects a decomposition strategy.
|
|
79
|
+
* Automatically creates entity links to any memory patterns cited as precedent.
|
|
80
|
+
*
|
|
81
|
+
* @param input - Strategy selection details
|
|
82
|
+
* @returns Created decision trace ID
|
|
83
|
+
*/
|
|
84
|
+
export declare function traceStrategySelection(input: StrategySelectionInput): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Input for tracing worker spawn decisions
|
|
87
|
+
*/
|
|
88
|
+
export interface WorkerSpawnInput {
|
|
89
|
+
projectKey: string;
|
|
90
|
+
agentName: string;
|
|
91
|
+
epicId: string;
|
|
92
|
+
beadId: string;
|
|
93
|
+
workerName?: string;
|
|
94
|
+
subtaskTitle: string;
|
|
95
|
+
files: string[];
|
|
96
|
+
model?: string;
|
|
97
|
+
spawnOrder?: number;
|
|
98
|
+
isParallel?: boolean;
|
|
99
|
+
rationale?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Trace a worker spawn decision
|
|
103
|
+
*
|
|
104
|
+
* Call this when the coordinator spawns a worker agent.
|
|
105
|
+
* Automatically creates entity links to assigned files.
|
|
106
|
+
*
|
|
107
|
+
* @param input - Worker spawn details
|
|
108
|
+
* @returns Created decision trace ID
|
|
109
|
+
*/
|
|
110
|
+
export declare function traceWorkerSpawn(input: WorkerSpawnInput): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Input for tracing review decisions
|
|
113
|
+
*/
|
|
114
|
+
export interface ReviewDecisionInput {
|
|
115
|
+
projectKey: string;
|
|
116
|
+
agentName: string;
|
|
117
|
+
epicId: string;
|
|
118
|
+
beadId: string;
|
|
119
|
+
workerId: string;
|
|
120
|
+
status: "approved" | "needs_changes";
|
|
121
|
+
summary?: string;
|
|
122
|
+
issues?: Array<{
|
|
123
|
+
file: string;
|
|
124
|
+
line?: number;
|
|
125
|
+
issue: string;
|
|
126
|
+
suggestion?: string;
|
|
127
|
+
}>;
|
|
128
|
+
attemptNumber?: number;
|
|
129
|
+
remainingAttempts?: number;
|
|
130
|
+
rationale?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Trace a review decision
|
|
134
|
+
*
|
|
135
|
+
* Call this when the coordinator approves or rejects worker output.
|
|
136
|
+
* Automatically creates entity link to the worker agent being reviewed.
|
|
137
|
+
*
|
|
138
|
+
* @param input - Review decision details
|
|
139
|
+
* @returns Created decision trace ID
|
|
140
|
+
*/
|
|
141
|
+
export declare function traceReviewDecision(input: ReviewDecisionInput): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Input for tracing file selection decisions
|
|
144
|
+
*/
|
|
145
|
+
export interface FileSelectionInput {
|
|
146
|
+
projectKey: string;
|
|
147
|
+
agentName: string;
|
|
148
|
+
epicId?: string;
|
|
149
|
+
beadId: string;
|
|
150
|
+
filesSelected: string[];
|
|
151
|
+
filesOwned: string[];
|
|
152
|
+
rationale?: string;
|
|
153
|
+
scopeExpanded?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Trace a file selection decision
|
|
157
|
+
*
|
|
158
|
+
* Call this when a worker selects which files to modify.
|
|
159
|
+
*
|
|
160
|
+
* @param input - File selection details
|
|
161
|
+
* @returns Created decision trace ID
|
|
162
|
+
*/
|
|
163
|
+
export declare function traceFileSelection(input: FileSelectionInput): Promise<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Input for tracing scope change decisions
|
|
166
|
+
*/
|
|
167
|
+
export interface ScopeChangeInput {
|
|
168
|
+
projectKey: string;
|
|
169
|
+
agentName: string;
|
|
170
|
+
epicId?: string;
|
|
171
|
+
beadId: string;
|
|
172
|
+
filesAdded?: string[];
|
|
173
|
+
filesRemoved?: string[];
|
|
174
|
+
reason: string;
|
|
175
|
+
coordinatorApproved?: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Trace a scope change decision
|
|
179
|
+
*
|
|
180
|
+
* Call this when a worker expands or contracts their task scope.
|
|
181
|
+
*
|
|
182
|
+
* @param input - Scope change details
|
|
183
|
+
* @returns Created decision trace ID
|
|
184
|
+
*/
|
|
185
|
+
export declare function traceScopeChange(input: ScopeChangeInput): Promise<string>;
|
|
186
|
+
/**
|
|
187
|
+
* Get all decision traces for an epic
|
|
188
|
+
*
|
|
189
|
+
* Useful for post-hoc analysis of how an epic was coordinated.
|
|
190
|
+
*
|
|
191
|
+
* @param projectKey - Project path
|
|
192
|
+
* @param epicId - Epic ID to query
|
|
193
|
+
* @returns Array of decision traces
|
|
194
|
+
*/
|
|
195
|
+
export declare function getEpicDecisionTraces(projectKey: string, epicId: string): Promise<import("swarm-mail").DecisionTrace[]>;
|
|
196
|
+
/**
|
|
197
|
+
* Get decision traces by type for analysis
|
|
198
|
+
*
|
|
199
|
+
* @param projectKey - Project path
|
|
200
|
+
* @param decisionType - Type of decision to query
|
|
201
|
+
* @returns Array of decision traces
|
|
202
|
+
*/
|
|
203
|
+
export declare function getDecisionTracesByType(projectKey: string, decisionType: string): Promise<import("swarm-mail").DecisionTrace[]>;
|
|
204
|
+
//# sourceMappingURL=decision-trace-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-trace-integration.d.ts","sourceRoot":"","sources":["../src/decision-trace-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA6BH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GACvF,MAAM,EAAE,CAgBV;AA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E,kBAAkB,GACxB,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAMD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,iDAYf;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,iDAYrB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Enrichment - Structured error context for swarm agents
|
|
3
|
+
*
|
|
4
|
+
* TDD GREEN: Minimal implementation to pass tests
|
|
5
|
+
*/
|
|
6
|
+
export interface SwarmErrorContext {
|
|
7
|
+
file?: string;
|
|
8
|
+
line?: number;
|
|
9
|
+
agent?: string;
|
|
10
|
+
epic_id?: string;
|
|
11
|
+
bead_id?: string;
|
|
12
|
+
recent_events?: Array<{
|
|
13
|
+
type: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SwarmError - Error class with structured context
|
|
20
|
+
*/
|
|
21
|
+
export declare class SwarmError extends Error {
|
|
22
|
+
context: SwarmErrorContext;
|
|
23
|
+
constructor(message: string, context?: SwarmErrorContext);
|
|
24
|
+
toJSON(): {
|
|
25
|
+
name: string;
|
|
26
|
+
message: string;
|
|
27
|
+
context: SwarmErrorContext;
|
|
28
|
+
stack: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* enrichError - Convert any error to SwarmError with context
|
|
33
|
+
*/
|
|
34
|
+
export declare function enrichError(error: unknown, context: SwarmErrorContext): SwarmError;
|
|
35
|
+
/**
|
|
36
|
+
* debugLog - Conditional logging based on DEBUG env var
|
|
37
|
+
*
|
|
38
|
+
* Patterns:
|
|
39
|
+
* - DEBUG=swarm:* (all)
|
|
40
|
+
* - DEBUG=swarm:coordinator
|
|
41
|
+
* - DEBUG=swarm:worker
|
|
42
|
+
* - DEBUG=swarm:mail
|
|
43
|
+
*/
|
|
44
|
+
export declare function debugLog(namespace: string, message: string, data?: unknown): void;
|
|
45
|
+
/**
|
|
46
|
+
* suggestFix - Pattern matching for common swarm errors
|
|
47
|
+
*/
|
|
48
|
+
export declare function suggestFix(error: Error | SwarmError): string | null;
|
|
49
|
+
//# sourceMappingURL=error-enrichment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-enrichment.d.ts","sourceRoot":"","sources":["../src/error-enrichment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACpC,OAAO,EAAE,iBAAiB,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB;IAW5D,MAAM;;;;;;CAQN;AAED;;GAEG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,iBAAiB,GACxB,UAAU,CAyBZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,OAAO,GACZ,IAAI,CAyBN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CA8EnE"}
|