opencode-swarm 7.83.0 → 7.84.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.
Files changed (54) hide show
  1. package/README.md +3 -1
  2. package/dist/cli/capability-probe-jevmgwmf.js +18 -0
  3. package/dist/cli/config-doctor-4tcdd9vt.js +35 -0
  4. package/dist/cli/dispatch-k86d928w.js +477 -0
  5. package/dist/cli/evidence-summary-service-g2znnd33.js +320 -0
  6. package/dist/cli/explorer-gz70sm9b.js +16 -0
  7. package/dist/cli/gate-evidence-y8zn7fe2.js +29 -0
  8. package/dist/cli/guardrail-explain-tcamcdfy.js +30 -0
  9. package/dist/cli/guardrail-log-fd14n96q.js +15 -0
  10. package/dist/cli/index-293f68mj.js +13538 -0
  11. package/dist/cli/index-8ra2qpk8.js +29027 -0
  12. package/dist/cli/index-a76rekgs.js +67 -0
  13. package/dist/cli/index-a82d6d87.js +1241 -0
  14. package/dist/cli/index-b9v501fr.js +371 -0
  15. package/dist/cli/index-bcp79s17.js +1673 -0
  16. package/dist/cli/index-ckntc5gf.js +91 -0
  17. package/dist/cli/index-d9fbxaqd.js +2314 -0
  18. package/dist/cli/index-e7h9bb6v.js +233 -0
  19. package/dist/cli/index-e8pk68cc.js +540 -0
  20. package/dist/cli/index-eb85wtx9.js +242 -0
  21. package/dist/cli/index-f8r50m3h.js +14505 -0
  22. package/dist/cli/index-fjwwrwr5.js +37 -0
  23. package/dist/cli/index-hz59hg4h.js +452 -0
  24. package/dist/cli/index-j710h2ge.js +412 -0
  25. package/dist/cli/index-jfgr5gye.js +110 -0
  26. package/dist/cli/index-jtqkh8jf.js +119 -0
  27. package/dist/cli/index-p0arc26j.js +28 -0
  28. package/dist/cli/index-p0ye10nd.js +222 -0
  29. package/dist/cli/index-pv2xmc9k.js +2391 -0
  30. package/dist/cli/index-red8fm8p.js +2914 -0
  31. package/dist/cli/index-wg3r6acj.js +2042 -0
  32. package/dist/cli/index-xw0bcy0v.js +583 -0
  33. package/dist/cli/index-yhsmmv2z.js +339 -0
  34. package/dist/cli/index-yx44zd0p.js +40 -0
  35. package/dist/cli/index-zfsbaaqh.js +29 -0
  36. package/dist/cli/index.js +73 -69708
  37. package/dist/cli/knowledge-store-n4x6zyk7.js +73 -0
  38. package/dist/cli/pending-delegations-pz61mrsz.js +255 -0
  39. package/dist/cli/pr-subscriptions-y1nn36e5.js +33 -0
  40. package/dist/cli/schema-c2dbzhm8.js +168 -0
  41. package/dist/cli/skill-generator-a5ehggyg.js +55 -0
  42. package/dist/cli/task-envelope-qn0qtnh0.js +90 -0
  43. package/dist/cli/telemetry-9bbyxrvn.js +20 -0
  44. package/dist/cli/workspace-snapshot-w58jr2ga.js +90 -0
  45. package/dist/commands/guardrail-explain.d.ts +1 -0
  46. package/dist/commands/guardrail-log.d.ts +1 -0
  47. package/dist/commands/index.d.ts +2 -0
  48. package/dist/commands/registry.d.ts +14 -0
  49. package/dist/hooks/guardrails/audit-log.d.ts +114 -0
  50. package/dist/index.js +3569 -2366
  51. package/dist/services/diagnose-service.d.ts +5 -0
  52. package/dist/services/guardrail-explain-service.d.ts +42 -0
  53. package/dist/services/guardrail-log-service.d.ts +10 -0
  54. package/package.json +2 -2
@@ -0,0 +1,320 @@
1
+ // @bun
2
+ import {
3
+ getDurableGateEvidenceStatus,
4
+ listEvidenceTaskIds,
5
+ loadEvidence,
6
+ loadPlanJsonOnly,
7
+ mergeDurableGateEntriesFromEvidence,
8
+ readDurableGateEvidence
9
+ } from "./index-red8fm8p.js";
10
+ import"./index-e7h9bb6v.js";
11
+ import"./index-fjwwrwr5.js";
12
+ import"./index-ckntc5gf.js";
13
+ import"./index-jtqkh8jf.js";
14
+ import"./index-zfsbaaqh.js";
15
+ import"./index-p0arc26j.js";
16
+ import {
17
+ log
18
+ } from "./index-yx44zd0p.js";
19
+ import"./index-bcp79s17.js";
20
+ import"./index-293f68mj.js";
21
+ import"./index-b9v501fr.js";
22
+ import"./index-p0ye10nd.js";
23
+ import"./index-a76rekgs.js";
24
+
25
+ // src/services/evidence-summary-service.ts
26
+ var VALID_EVIDENCE_TYPES = new Set([
27
+ "review",
28
+ "test",
29
+ "diff",
30
+ "approval",
31
+ "note",
32
+ "retrospective"
33
+ ]);
34
+ function normalizeBundleEntries(bundle) {
35
+ if (!bundle) {
36
+ return [];
37
+ }
38
+ const entries = bundle.entries;
39
+ if (!Array.isArray(entries)) {
40
+ return [];
41
+ }
42
+ const validEntries = [];
43
+ for (const entry of entries) {
44
+ if (entry === null || entry === undefined) {
45
+ continue;
46
+ }
47
+ if (typeof entry !== "object") {
48
+ continue;
49
+ }
50
+ const typedEntry = entry;
51
+ if (!typedEntry.type || !VALID_EVIDENCE_TYPES.has(typedEntry.type)) {
52
+ continue;
53
+ }
54
+ if (!typedEntry.task_id || !typedEntry.timestamp || !typedEntry.agent) {
55
+ continue;
56
+ }
57
+ if (!typedEntry.verdict || !typedEntry.summary) {
58
+ continue;
59
+ }
60
+ validEntries.push(typedEntry);
61
+ }
62
+ return validEntries;
63
+ }
64
+ var REQUIRED_EVIDENCE_TYPES = ["review", "test"];
65
+ var EVIDENCE_SUMMARY_VERSION = "1.0.0";
66
+ function getTaskStatus(task, bundle) {
67
+ if (task?.status) {
68
+ return task.status;
69
+ }
70
+ const entries = _internals.normalizeBundleEntries(bundle);
71
+ if (entries.length > 0) {
72
+ return "completed";
73
+ }
74
+ return "pending";
75
+ }
76
+ function evidenceCompleteFromEntries(entries) {
77
+ if (entries.length === 0) {
78
+ return {
79
+ isComplete: false,
80
+ missingEvidence: [...REQUIRED_EVIDENCE_TYPES]
81
+ };
82
+ }
83
+ const typesPresent = new Set(entries.map((e) => e.type));
84
+ const missing = [];
85
+ for (const required of REQUIRED_EVIDENCE_TYPES) {
86
+ if (!typesPresent.has(required)) {
87
+ missing.push(required);
88
+ }
89
+ }
90
+ return {
91
+ isComplete: missing.length === 0,
92
+ missingEvidence: missing
93
+ };
94
+ }
95
+ function isEvidenceComplete(bundle) {
96
+ return evidenceCompleteFromEntries(_internals.normalizeBundleEntries(bundle));
97
+ }
98
+ function getTaskBlockers(task, summary, status) {
99
+ const blockers = [];
100
+ if (task?.blocked_reason) {
101
+ blockers.push(task.blocked_reason);
102
+ }
103
+ if (status === "blocked") {
104
+ blockers.push("Task is marked as blocked");
105
+ }
106
+ if (summary.missingEvidence.length > 0 && status !== "pending") {
107
+ blockers.push(`Missing evidence: ${summary.missingEvidence.join(", ")}`);
108
+ }
109
+ return blockers;
110
+ }
111
+ async function buildTaskSummary(directory, task, taskId) {
112
+ const result = await loadEvidence(directory, taskId);
113
+ const bundle = result.status === "found" ? result.bundle : null;
114
+ const gateEvidence = await readDurableGateEvidence(directory, taskId);
115
+ const phase = task?.phase ?? 0;
116
+ const status = _internals.getTaskStatus(task, bundle);
117
+ const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals.normalizeBundleEntries(bundle), gateEvidence);
118
+ let evidenceCheck = _internals.evidenceCompleteFromEntries(entries);
119
+ if (gateEvidence) {
120
+ const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
121
+ evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
122
+ isComplete: false,
123
+ missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
124
+ };
125
+ }
126
+ const blockers = _internals.getTaskBlockers(task, evidenceCheck, status);
127
+ const hasReview = entries.some((e) => e.type === "review");
128
+ const hasTest = entries.some((e) => e.type === "test");
129
+ const hasApproval = entries.some((e) => e.type === "approval");
130
+ let lastTimestamp = null;
131
+ if (entries.length > 0) {
132
+ const timestamps = entries.map((e) => e.timestamp).sort().reverse();
133
+ lastTimestamp = timestamps[0] ?? null;
134
+ }
135
+ return {
136
+ taskId,
137
+ phase,
138
+ taskStatus: status,
139
+ evidenceCount: entries.length,
140
+ hasReview,
141
+ hasTest,
142
+ hasApproval,
143
+ missingEvidence: evidenceCheck.missingEvidence,
144
+ isComplete: evidenceCheck.isComplete && status === "completed",
145
+ blockers,
146
+ lastEvidenceTimestamp: lastTimestamp
147
+ };
148
+ }
149
+ async function buildPhaseSummary(directory, phase) {
150
+ const taskIds = await listEvidenceTaskIds(directory);
151
+ const phaseTaskIds = new Set(phase.tasks.map((t) => t.id));
152
+ const taskSummaries = [];
153
+ const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
154
+ for (const task of phase.tasks) {
155
+ const summary = await _internals.buildTaskSummary(directory, task, task.id);
156
+ taskSummaries.push(summary);
157
+ }
158
+ const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
159
+ for (const taskId of extraTaskIds) {
160
+ const summary = await _internals.buildTaskSummary(directory, undefined, taskId);
161
+ if (summary.phase === phase.id) {
162
+ taskSummaries.push(summary);
163
+ }
164
+ }
165
+ const completedTasks = taskSummaries.filter((s) => s.taskStatus === "completed").length;
166
+ const tasksWithEvidence = taskSummaries.filter((s) => s.evidenceCount > 0).length;
167
+ const tasksWithCompleteEvidence = taskSummaries.filter((s) => s.isComplete).length;
168
+ const missingByType = {};
169
+ for (const summary of taskSummaries) {
170
+ for (const missing of summary.missingEvidence) {
171
+ if (!missingByType[missing]) {
172
+ missingByType[missing] = [];
173
+ }
174
+ if (!missingByType[missing].includes(summary.taskId)) {
175
+ missingByType[missing].push(summary.taskId);
176
+ }
177
+ }
178
+ }
179
+ const phaseBlockers = [];
180
+ for (const [type, taskIds2] of Object.entries(missingByType)) {
181
+ phaseBlockers.push({
182
+ type: "missing_evidence",
183
+ taskId: taskIds2.join(", "),
184
+ reason: `${type} evidence missing for ${taskIds2.length} task(s)`,
185
+ severity: "high"
186
+ });
187
+ }
188
+ const incomplete = taskSummaries.filter((s) => s.taskStatus === "completed" && !s.isComplete);
189
+ for (const task of incomplete) {
190
+ phaseBlockers.push({
191
+ type: "incomplete_task",
192
+ taskId: task.taskId,
193
+ reason: "Task marked complete but missing required evidence",
194
+ severity: "medium"
195
+ });
196
+ }
197
+ const blocked = taskSummaries.filter((s) => s.taskStatus === "blocked" || s.blockers.length > 0);
198
+ for (const task of blocked) {
199
+ phaseBlockers.push({
200
+ type: "blocked_task",
201
+ taskId: task.taskId,
202
+ reason: task.blockers.join("; ") || "Task is blocked",
203
+ severity: "high"
204
+ });
205
+ }
206
+ return {
207
+ phaseId: phase.id,
208
+ phaseName: phase.name,
209
+ phaseStatus: phase.status,
210
+ totalTasks: phase.tasks.length,
211
+ completedTasks,
212
+ tasksWithEvidence,
213
+ tasksWithCompleteEvidence,
214
+ completionRatio: phase.tasks.length > 0 ? completedTasks / phase.tasks.length : 0,
215
+ missingEvidenceByType: missingByType,
216
+ blockers: phaseBlockers,
217
+ tasks: taskSummaries
218
+ };
219
+ }
220
+ function generateSummaryText(artifact) {
221
+ const lines = [];
222
+ lines.push(`Evidence Summary for "${artifact.planTitle}"`);
223
+ lines.push(`Generated: ${new Date(artifact.generated_at).toISOString()}`);
224
+ lines.push("");
225
+ lines.push(`Overall Completion: ${(artifact.overallCompletionRatio * 100).toFixed(1)}%`);
226
+ lines.push(`Current Phase: ${artifact.currentPhase}`);
227
+ lines.push("");
228
+ for (const phase of artifact.phaseSummaries) {
229
+ lines.push(`## Phase ${phase.phaseId}: ${phase.phaseName}`);
230
+ lines.push(` Tasks: ${phase.completedTasks}/${phase.totalTasks} completed (${(phase.completionRatio * 100).toFixed(1)}%)`);
231
+ lines.push(` Evidence: ${phase.tasksWithCompleteEvidence}/${phase.totalTasks} complete`);
232
+ if (phase.blockers.length > 0) {
233
+ lines.push(" Blockers:");
234
+ for (const blocker of phase.blockers) {
235
+ lines.push(` - [${blocker.severity}] ${blocker.reason}`);
236
+ }
237
+ }
238
+ lines.push("");
239
+ }
240
+ if (artifact.overallBlockers.length > 0) {
241
+ lines.push("## Overall Blockers");
242
+ for (const blocker of artifact.overallBlockers) {
243
+ lines.push(`- [${blocker.severity}] ${blocker.reason}`);
244
+ }
245
+ }
246
+ return lines.join(`
247
+ `);
248
+ }
249
+ async function buildEvidenceSummary(directory, currentPhase) {
250
+ log("[EvidenceSummary] Building summary for directory", { directory });
251
+ const plan = await loadPlanJsonOnly(directory);
252
+ if (!plan) {
253
+ log("[EvidenceSummary] No plan found, skipping summary generation");
254
+ return null;
255
+ }
256
+ const phasesToProcess = currentPhase !== undefined ? plan.phases.filter((p) => p.id <= currentPhase) : plan.phases;
257
+ const phaseSummaries = [];
258
+ let totalTasks = 0;
259
+ let completedTasks = 0;
260
+ for (const phase of phasesToProcess) {
261
+ const summary = await _internals.buildPhaseSummary(directory, phase);
262
+ phaseSummaries.push(summary);
263
+ totalTasks += summary.totalTasks;
264
+ completedTasks += summary.completedTasks;
265
+ }
266
+ const overallCompletionRatio = totalTasks > 0 ? completedTasks / totalTasks : 0;
267
+ const overallBlockers = [];
268
+ for (const phase of phaseSummaries) {
269
+ if (phase.phaseStatus !== "complete") {
270
+ overallBlockers.push(...phase.blockers);
271
+ }
272
+ }
273
+ const artifact = {
274
+ schema_version: EVIDENCE_SUMMARY_VERSION,
275
+ generated_at: new Date().toISOString(),
276
+ planTitle: plan.title,
277
+ currentPhase: currentPhase ?? plan.current_phase ?? 1,
278
+ phaseSummaries,
279
+ overallCompletionRatio,
280
+ overallBlockers,
281
+ summaryText: ""
282
+ };
283
+ artifact.summaryText = _internals.generateSummaryText(artifact);
284
+ log("[EvidenceSummary] Summary built", {
285
+ phases: phaseSummaries.length,
286
+ totalTasks,
287
+ completedTasks,
288
+ completionRatio: overallCompletionRatio,
289
+ blockers: overallBlockers.length
290
+ });
291
+ return artifact;
292
+ }
293
+ function isAutoSummaryEnabled(automationConfig) {
294
+ if (!automationConfig) {
295
+ return false;
296
+ }
297
+ if (automationConfig.mode === "manual") {
298
+ return false;
299
+ }
300
+ return automationConfig.capabilities?.evidence_auto_summaries === true;
301
+ }
302
+ var _internals = {
303
+ buildEvidenceSummary,
304
+ isAutoSummaryEnabled,
305
+ normalizeBundleEntries,
306
+ getTaskStatus,
307
+ evidenceCompleteFromEntries,
308
+ isEvidenceComplete,
309
+ getTaskBlockers,
310
+ buildTaskSummary,
311
+ buildPhaseSummary,
312
+ generateSummaryText
313
+ };
314
+ export {
315
+ isAutoSummaryEnabled,
316
+ buildEvidenceSummary,
317
+ _internals,
318
+ REQUIRED_EVIDENCE_TYPES,
319
+ EVIDENCE_SUMMARY_VERSION
320
+ };
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ CURATOR_INIT_PROMPT,
4
+ CURATOR_PHASE_PROMPT,
5
+ CURATOR_POSTMORTEM_PROMPT,
6
+ EXPLORER_PROMPT,
7
+ createExplorerAgent
8
+ } from "./index-yhsmmv2z.js";
9
+ import"./index-a76rekgs.js";
10
+ export {
11
+ createExplorerAgent,
12
+ EXPLORER_PROMPT,
13
+ CURATOR_POSTMORTEM_PROMPT,
14
+ CURATOR_PHASE_PROMPT,
15
+ CURATOR_INIT_PROMPT
16
+ };
@@ -0,0 +1,29 @@
1
+ // @bun
2
+ import {
3
+ DEFAULT_REQUIRED_GATES,
4
+ deriveRequiredGates,
5
+ expandRequiredGates,
6
+ hasPassedAllGates,
7
+ isValidTaskId,
8
+ readTaskEvidence,
9
+ readTaskEvidenceRaw,
10
+ recordAgentDispatch,
11
+ recordGateEvidence
12
+ } from "./index-e7h9bb6v.js";
13
+ import"./index-fjwwrwr5.js";
14
+ import"./index-bcp79s17.js";
15
+ import"./index-293f68mj.js";
16
+ import"./index-b9v501fr.js";
17
+ import"./index-p0ye10nd.js";
18
+ import"./index-a76rekgs.js";
19
+ export {
20
+ recordGateEvidence,
21
+ recordAgentDispatch,
22
+ readTaskEvidenceRaw,
23
+ readTaskEvidence,
24
+ isValidTaskId,
25
+ hasPassedAllGates,
26
+ expandRequiredGates,
27
+ deriveRequiredGates,
28
+ DEFAULT_REQUIRED_GATES
29
+ };
@@ -0,0 +1,30 @@
1
+ // @bun
2
+ import {
3
+ handleGuardrailExplain
4
+ } from "./index-xw0bcy0v.js";
5
+ import"./index-8ra2qpk8.js";
6
+ import"./index-pv2xmc9k.js";
7
+ import"./index-yhsmmv2z.js";
8
+ import"./index-d9fbxaqd.js";
9
+ import"./index-e8pk68cc.js";
10
+ import"./index-a82d6d87.js";
11
+ import"./index-wg3r6acj.js";
12
+ import"./index-red8fm8p.js";
13
+ import"./index-f8r50m3h.js";
14
+ import"./index-hz59hg4h.js";
15
+ import"./index-e7h9bb6v.js";
16
+ import"./index-fjwwrwr5.js";
17
+ import"./index-eb85wtx9.js";
18
+ import"./index-ckntc5gf.js";
19
+ import"./index-jtqkh8jf.js";
20
+ import"./index-zfsbaaqh.js";
21
+ import"./index-p0arc26j.js";
22
+ import"./index-yx44zd0p.js";
23
+ import"./index-bcp79s17.js";
24
+ import"./index-293f68mj.js";
25
+ import"./index-b9v501fr.js";
26
+ import"./index-p0ye10nd.js";
27
+ import"./index-a76rekgs.js";
28
+ export {
29
+ handleGuardrailExplain
30
+ };
@@ -0,0 +1,15 @@
1
+ // @bun
2
+ import {
3
+ handleGuardrailLog
4
+ } from "./index-jfgr5gye.js";
5
+ import"./index-pv2xmc9k.js";
6
+ import"./index-wg3r6acj.js";
7
+ import"./index-zfsbaaqh.js";
8
+ import"./index-p0arc26j.js";
9
+ import"./index-yx44zd0p.js";
10
+ import"./index-293f68mj.js";
11
+ import"./index-b9v501fr.js";
12
+ import"./index-a76rekgs.js";
13
+ export {
14
+ handleGuardrailLog
15
+ };