opencode-swarm-plugin 0.58.4 → 0.59.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/claude-plugin/dist/index.js +253 -131
- package/dist/bin/swarm.js +518 -225
- package/dist/decision-trace-integration.d.ts +18 -0
- package/dist/decision-trace-integration.d.ts.map +1 -1
- package/dist/index.js +249 -134
- package/dist/marketplace/index.js +253 -131
- package/dist/plugin.js +249 -134
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.js +248 -85
- package/package.json +2 -2
|
@@ -12815,6 +12815,7 @@ __export(exports_dist, {
|
|
|
12815
12815
|
formatCSV: () => formatCSV,
|
|
12816
12816
|
findSimilarDecisions: () => findSimilarDecisions,
|
|
12817
12817
|
findRelatedMemories: () => findRelatedMemories,
|
|
12818
|
+
findDecisionTraceByBead: () => findDecisionTraceByBead,
|
|
12818
12819
|
findCellsByPartialId: () => findCellsByPartialId,
|
|
12819
12820
|
failedDecompositions: () => failedDecompositions,
|
|
12820
12821
|
extractEntitiesAndRelationships: () => extractEntitiesAndRelationships,
|
|
@@ -29347,6 +29348,10 @@ async function getDecisionTracesByEpic(db2, epicId) {
|
|
|
29347
29348
|
const result = await db2.query(`SELECT * FROM decision_traces WHERE epic_id = ? ORDER BY timestamp ASC`, [epicId]);
|
|
29348
29349
|
return result.rows;
|
|
29349
29350
|
}
|
|
29351
|
+
async function findDecisionTraceByBead(db2, beadId) {
|
|
29352
|
+
const result = await db2.query(`SELECT * FROM decision_traces WHERE bead_id = ? ORDER BY timestamp DESC LIMIT 1`, [beadId]);
|
|
29353
|
+
return result.rows[0] ?? null;
|
|
29354
|
+
}
|
|
29350
29355
|
async function getDecisionTracesByAgent(db2, agentName) {
|
|
29351
29356
|
const result = await db2.query(`SELECT * FROM decision_traces WHERE agent_name = ? ORDER BY timestamp ASC`, [agentName]);
|
|
29352
29357
|
return result.rows;
|
|
@@ -120790,6 +120795,7 @@ ${stack.split(`
|
|
|
120790
120795
|
getAgent: () => getAgent2,
|
|
120791
120796
|
getActiveReservations: () => getActiveReservations2,
|
|
120792
120797
|
findSimilarDecisions: () => findSimilarDecisions,
|
|
120798
|
+
findDecisionTraceByBead: () => findDecisionTraceByBead,
|
|
120793
120799
|
emitThreadActivity: () => emitThreadActivity,
|
|
120794
120800
|
createEvent: () => createEvent,
|
|
120795
120801
|
createEntityLink: () => createEntityLink,
|
|
@@ -139479,6 +139485,235 @@ Codebase context considered: ${args2.codebase_context.slice(0, 200)}...`;
|
|
|
139479
139485
|
};
|
|
139480
139486
|
});
|
|
139481
139487
|
|
|
139488
|
+
// src/decision-trace-integration.ts
|
|
139489
|
+
var exports_decision_trace_integration = {};
|
|
139490
|
+
__export(exports_decision_trace_integration, {
|
|
139491
|
+
traceWorkerSpawn: () => traceWorkerSpawn,
|
|
139492
|
+
traceStrategySelection: () => traceStrategySelection,
|
|
139493
|
+
traceScopeChange: () => traceScopeChange,
|
|
139494
|
+
traceReviewDecision: () => traceReviewDecision,
|
|
139495
|
+
traceFileSelection: () => traceFileSelection,
|
|
139496
|
+
linkOutcomeToDecisionTrace: () => linkOutcomeToDecisionTrace,
|
|
139497
|
+
getEpicDecisionTraces: () => getEpicDecisionTraces,
|
|
139498
|
+
getDecisionTracesByType: () => getDecisionTracesByType2,
|
|
139499
|
+
extractMemoryIds: () => extractMemoryIds
|
|
139500
|
+
});
|
|
139501
|
+
async function getTraceDb(projectPath) {
|
|
139502
|
+
const dbPath = getDatabasePath2(projectPath);
|
|
139503
|
+
return createLibSQLAdapter({ url: `file:${dbPath}` });
|
|
139504
|
+
}
|
|
139505
|
+
function extractMemoryIds(precedentCited) {
|
|
139506
|
+
if (!precedentCited) {
|
|
139507
|
+
return [];
|
|
139508
|
+
}
|
|
139509
|
+
if (precedentCited.memoryIds && Array.isArray(precedentCited.memoryIds)) {
|
|
139510
|
+
return precedentCited.memoryIds;
|
|
139511
|
+
}
|
|
139512
|
+
if (precedentCited.memoryId) {
|
|
139513
|
+
return [precedentCited.memoryId];
|
|
139514
|
+
}
|
|
139515
|
+
return [];
|
|
139516
|
+
}
|
|
139517
|
+
async function traceStrategySelection(input) {
|
|
139518
|
+
try {
|
|
139519
|
+
const db = await getTraceDb(input.projectKey);
|
|
139520
|
+
const trace3 = await createDecisionTrace(db, {
|
|
139521
|
+
decision_type: "strategy_selection",
|
|
139522
|
+
epic_id: input.epicId,
|
|
139523
|
+
bead_id: input.beadId,
|
|
139524
|
+
agent_name: input.agentName,
|
|
139525
|
+
project_key: input.projectKey,
|
|
139526
|
+
decision: {
|
|
139527
|
+
strategy: input.strategy,
|
|
139528
|
+
confidence: input.confidence,
|
|
139529
|
+
task_preview: input.taskPreview
|
|
139530
|
+
},
|
|
139531
|
+
rationale: input.reasoning,
|
|
139532
|
+
inputs_gathered: input.inputsGathered,
|
|
139533
|
+
alternatives: input.alternatives,
|
|
139534
|
+
precedent_cited: input.precedentCited
|
|
139535
|
+
});
|
|
139536
|
+
const memoryIds = extractMemoryIds(input.precedentCited);
|
|
139537
|
+
for (const memoryId of memoryIds) {
|
|
139538
|
+
await createEntityLink(db, {
|
|
139539
|
+
source_decision_id: trace3.id,
|
|
139540
|
+
target_entity_type: "memory",
|
|
139541
|
+
target_entity_id: memoryId,
|
|
139542
|
+
link_type: "cites_precedent",
|
|
139543
|
+
strength: input.precedentCited?.similarity ?? 1,
|
|
139544
|
+
context: "Cited as precedent for strategy selection"
|
|
139545
|
+
});
|
|
139546
|
+
}
|
|
139547
|
+
await db.close?.();
|
|
139548
|
+
return trace3.id;
|
|
139549
|
+
} catch (error47) {
|
|
139550
|
+
console.warn("[decision-trace] Failed to trace strategy_selection:", error47);
|
|
139551
|
+
return "";
|
|
139552
|
+
}
|
|
139553
|
+
}
|
|
139554
|
+
async function traceWorkerSpawn(input) {
|
|
139555
|
+
try {
|
|
139556
|
+
const db = await getTraceDb(input.projectKey);
|
|
139557
|
+
const trace3 = await createDecisionTrace(db, {
|
|
139558
|
+
decision_type: "worker_spawn",
|
|
139559
|
+
epic_id: input.epicId,
|
|
139560
|
+
bead_id: input.beadId,
|
|
139561
|
+
agent_name: input.agentName,
|
|
139562
|
+
project_key: input.projectKey,
|
|
139563
|
+
decision: {
|
|
139564
|
+
worker: input.workerName || "worker",
|
|
139565
|
+
subtask_title: input.subtaskTitle,
|
|
139566
|
+
files: input.files,
|
|
139567
|
+
model: input.model,
|
|
139568
|
+
spawn_order: input.spawnOrder,
|
|
139569
|
+
is_parallel: input.isParallel
|
|
139570
|
+
},
|
|
139571
|
+
rationale: input.rationale || `Spawning worker for: ${input.subtaskTitle}`
|
|
139572
|
+
});
|
|
139573
|
+
for (const file3 of input.files) {
|
|
139574
|
+
await createEntityLink(db, {
|
|
139575
|
+
source_decision_id: trace3.id,
|
|
139576
|
+
target_entity_type: "file",
|
|
139577
|
+
target_entity_id: file3,
|
|
139578
|
+
link_type: "assigns_file",
|
|
139579
|
+
strength: 1,
|
|
139580
|
+
context: `File assigned to worker ${input.workerName || "worker"}`
|
|
139581
|
+
});
|
|
139582
|
+
}
|
|
139583
|
+
await db.close?.();
|
|
139584
|
+
return trace3.id;
|
|
139585
|
+
} catch (error47) {
|
|
139586
|
+
console.warn("[decision-trace] Failed to trace worker_spawn:", error47);
|
|
139587
|
+
return "";
|
|
139588
|
+
}
|
|
139589
|
+
}
|
|
139590
|
+
async function traceReviewDecision(input) {
|
|
139591
|
+
try {
|
|
139592
|
+
const db = await getTraceDb(input.projectKey);
|
|
139593
|
+
const trace3 = await createDecisionTrace(db, {
|
|
139594
|
+
decision_type: "review_decision",
|
|
139595
|
+
epic_id: input.epicId,
|
|
139596
|
+
bead_id: input.beadId,
|
|
139597
|
+
agent_name: input.agentName,
|
|
139598
|
+
project_key: input.projectKey,
|
|
139599
|
+
decision: {
|
|
139600
|
+
status: input.status,
|
|
139601
|
+
worker_id: input.workerId,
|
|
139602
|
+
issues_count: input.issues?.length || 0,
|
|
139603
|
+
attempt_number: input.attemptNumber,
|
|
139604
|
+
remaining_attempts: input.remainingAttempts
|
|
139605
|
+
},
|
|
139606
|
+
rationale: input.rationale || input.summary || `Review ${input.status}`,
|
|
139607
|
+
inputs_gathered: input.issues ? [{ source: "code_review", issues: input.issues }] : undefined
|
|
139608
|
+
});
|
|
139609
|
+
await createEntityLink(db, {
|
|
139610
|
+
source_decision_id: trace3.id,
|
|
139611
|
+
target_entity_type: "agent",
|
|
139612
|
+
target_entity_id: input.workerId,
|
|
139613
|
+
link_type: "reviewed_work_by",
|
|
139614
|
+
strength: 1,
|
|
139615
|
+
context: `Review ${input.status} for ${input.workerId}`
|
|
139616
|
+
});
|
|
139617
|
+
await db.close?.();
|
|
139618
|
+
return trace3.id;
|
|
139619
|
+
} catch (error47) {
|
|
139620
|
+
console.warn("[decision-trace] Failed to trace review_decision:", error47);
|
|
139621
|
+
return "";
|
|
139622
|
+
}
|
|
139623
|
+
}
|
|
139624
|
+
async function traceFileSelection(input) {
|
|
139625
|
+
try {
|
|
139626
|
+
const db = await getTraceDb(input.projectKey);
|
|
139627
|
+
const trace3 = await createDecisionTrace(db, {
|
|
139628
|
+
decision_type: "file_selection",
|
|
139629
|
+
epic_id: input.epicId,
|
|
139630
|
+
bead_id: input.beadId,
|
|
139631
|
+
agent_name: input.agentName,
|
|
139632
|
+
project_key: input.projectKey,
|
|
139633
|
+
decision: {
|
|
139634
|
+
files_selected: input.filesSelected,
|
|
139635
|
+
files_owned: input.filesOwned,
|
|
139636
|
+
scope_expanded: input.scopeExpanded
|
|
139637
|
+
},
|
|
139638
|
+
rationale: input.rationale || `Selected ${input.filesSelected.length} files`
|
|
139639
|
+
});
|
|
139640
|
+
await db.close?.();
|
|
139641
|
+
return trace3.id;
|
|
139642
|
+
} catch (error47) {
|
|
139643
|
+
console.warn("[decision-trace] Failed to trace file_selection:", error47);
|
|
139644
|
+
return "";
|
|
139645
|
+
}
|
|
139646
|
+
}
|
|
139647
|
+
async function traceScopeChange(input) {
|
|
139648
|
+
try {
|
|
139649
|
+
const db = await getTraceDb(input.projectKey);
|
|
139650
|
+
const trace3 = await createDecisionTrace(db, {
|
|
139651
|
+
decision_type: "scope_change",
|
|
139652
|
+
epic_id: input.epicId,
|
|
139653
|
+
bead_id: input.beadId,
|
|
139654
|
+
agent_name: input.agentName,
|
|
139655
|
+
project_key: input.projectKey,
|
|
139656
|
+
decision: {
|
|
139657
|
+
files_added: input.filesAdded || [],
|
|
139658
|
+
files_removed: input.filesRemoved || [],
|
|
139659
|
+
coordinator_approved: input.coordinatorApproved
|
|
139660
|
+
},
|
|
139661
|
+
rationale: input.reason
|
|
139662
|
+
});
|
|
139663
|
+
await db.close?.();
|
|
139664
|
+
return trace3.id;
|
|
139665
|
+
} catch (error47) {
|
|
139666
|
+
console.warn("[decision-trace] Failed to trace scope_change:", error47);
|
|
139667
|
+
return "";
|
|
139668
|
+
}
|
|
139669
|
+
}
|
|
139670
|
+
async function getEpicDecisionTraces(projectKey, epicId) {
|
|
139671
|
+
try {
|
|
139672
|
+
const { getDecisionTracesByEpic: getDecisionTracesByEpic2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
139673
|
+
const db = await getTraceDb(projectKey);
|
|
139674
|
+
const traces = await getDecisionTracesByEpic2(db, epicId);
|
|
139675
|
+
await db.close?.();
|
|
139676
|
+
return traces;
|
|
139677
|
+
} catch (error47) {
|
|
139678
|
+
console.warn("[decision-trace] Failed to query epic traces:", error47);
|
|
139679
|
+
return [];
|
|
139680
|
+
}
|
|
139681
|
+
}
|
|
139682
|
+
async function getDecisionTracesByType2(projectKey, decisionType) {
|
|
139683
|
+
try {
|
|
139684
|
+
const { getDecisionTracesByType: queryByType } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
139685
|
+
const db = await getTraceDb(projectKey);
|
|
139686
|
+
const traces = await queryByType(db, decisionType);
|
|
139687
|
+
await db.close?.();
|
|
139688
|
+
return traces;
|
|
139689
|
+
} catch (error47) {
|
|
139690
|
+
console.warn("[decision-trace] Failed to query traces by type:", error47);
|
|
139691
|
+
return [];
|
|
139692
|
+
}
|
|
139693
|
+
}
|
|
139694
|
+
async function linkOutcomeToDecisionTrace(input) {
|
|
139695
|
+
try {
|
|
139696
|
+
const { findDecisionTraceByBead: findDecisionTraceByBead2, linkOutcomeToTrace: linkOutcomeToTrace2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
139697
|
+
const db = await getTraceDb(input.projectKey);
|
|
139698
|
+
const trace3 = await findDecisionTraceByBead2(db, input.beadId);
|
|
139699
|
+
if (!trace3) {
|
|
139700
|
+
await db.close?.();
|
|
139701
|
+
return false;
|
|
139702
|
+
}
|
|
139703
|
+
await linkOutcomeToTrace2(db, trace3.id, input.outcomeEventId);
|
|
139704
|
+
await db.close?.();
|
|
139705
|
+
return true;
|
|
139706
|
+
} catch (error47) {
|
|
139707
|
+
console.warn("[decision-trace] Failed to link outcome to trace:", error47);
|
|
139708
|
+
return false;
|
|
139709
|
+
}
|
|
139710
|
+
}
|
|
139711
|
+
var init_decision_trace_integration = __esm(() => {
|
|
139712
|
+
init_dist2();
|
|
139713
|
+
init_dist2();
|
|
139714
|
+
init_dist2();
|
|
139715
|
+
});
|
|
139716
|
+
|
|
139482
139717
|
// src/learning.ts
|
|
139483
139718
|
var exports_learning = {};
|
|
139484
139719
|
__export(exports_learning, {
|
|
@@ -179082,136 +179317,7 @@ init_dist();
|
|
|
179082
179317
|
init_zod();
|
|
179083
179318
|
init_swarm_strategies();
|
|
179084
179319
|
init_eval_capture();
|
|
179085
|
-
|
|
179086
|
-
// src/decision-trace-integration.ts
|
|
179087
|
-
init_dist2();
|
|
179088
|
-
init_dist2();
|
|
179089
|
-
init_dist2();
|
|
179090
|
-
async function getTraceDb(projectPath) {
|
|
179091
|
-
const dbPath = getDatabasePath2(projectPath);
|
|
179092
|
-
return createLibSQLAdapter({ url: `file:${dbPath}` });
|
|
179093
|
-
}
|
|
179094
|
-
function extractMemoryIds(precedentCited) {
|
|
179095
|
-
if (!precedentCited) {
|
|
179096
|
-
return [];
|
|
179097
|
-
}
|
|
179098
|
-
if (precedentCited.memoryIds && Array.isArray(precedentCited.memoryIds)) {
|
|
179099
|
-
return precedentCited.memoryIds;
|
|
179100
|
-
}
|
|
179101
|
-
if (precedentCited.memoryId) {
|
|
179102
|
-
return [precedentCited.memoryId];
|
|
179103
|
-
}
|
|
179104
|
-
return [];
|
|
179105
|
-
}
|
|
179106
|
-
async function traceStrategySelection(input) {
|
|
179107
|
-
try {
|
|
179108
|
-
const db = await getTraceDb(input.projectKey);
|
|
179109
|
-
const trace3 = await createDecisionTrace(db, {
|
|
179110
|
-
decision_type: "strategy_selection",
|
|
179111
|
-
epic_id: input.epicId,
|
|
179112
|
-
bead_id: input.beadId,
|
|
179113
|
-
agent_name: input.agentName,
|
|
179114
|
-
project_key: input.projectKey,
|
|
179115
|
-
decision: {
|
|
179116
|
-
strategy: input.strategy,
|
|
179117
|
-
confidence: input.confidence,
|
|
179118
|
-
task_preview: input.taskPreview
|
|
179119
|
-
},
|
|
179120
|
-
rationale: input.reasoning,
|
|
179121
|
-
inputs_gathered: input.inputsGathered,
|
|
179122
|
-
alternatives: input.alternatives,
|
|
179123
|
-
precedent_cited: input.precedentCited
|
|
179124
|
-
});
|
|
179125
|
-
const memoryIds = extractMemoryIds(input.precedentCited);
|
|
179126
|
-
for (const memoryId of memoryIds) {
|
|
179127
|
-
await createEntityLink(db, {
|
|
179128
|
-
source_decision_id: trace3.id,
|
|
179129
|
-
target_entity_type: "memory",
|
|
179130
|
-
target_entity_id: memoryId,
|
|
179131
|
-
link_type: "cites_precedent",
|
|
179132
|
-
strength: input.precedentCited?.similarity ?? 1,
|
|
179133
|
-
context: "Cited as precedent for strategy selection"
|
|
179134
|
-
});
|
|
179135
|
-
}
|
|
179136
|
-
await db.close?.();
|
|
179137
|
-
return trace3.id;
|
|
179138
|
-
} catch (error47) {
|
|
179139
|
-
console.warn("[decision-trace] Failed to trace strategy_selection:", error47);
|
|
179140
|
-
return "";
|
|
179141
|
-
}
|
|
179142
|
-
}
|
|
179143
|
-
async function traceWorkerSpawn(input) {
|
|
179144
|
-
try {
|
|
179145
|
-
const db = await getTraceDb(input.projectKey);
|
|
179146
|
-
const trace3 = await createDecisionTrace(db, {
|
|
179147
|
-
decision_type: "worker_spawn",
|
|
179148
|
-
epic_id: input.epicId,
|
|
179149
|
-
bead_id: input.beadId,
|
|
179150
|
-
agent_name: input.agentName,
|
|
179151
|
-
project_key: input.projectKey,
|
|
179152
|
-
decision: {
|
|
179153
|
-
worker: input.workerName || "worker",
|
|
179154
|
-
subtask_title: input.subtaskTitle,
|
|
179155
|
-
files: input.files,
|
|
179156
|
-
model: input.model,
|
|
179157
|
-
spawn_order: input.spawnOrder,
|
|
179158
|
-
is_parallel: input.isParallel
|
|
179159
|
-
},
|
|
179160
|
-
rationale: input.rationale || `Spawning worker for: ${input.subtaskTitle}`
|
|
179161
|
-
});
|
|
179162
|
-
for (const file3 of input.files) {
|
|
179163
|
-
await createEntityLink(db, {
|
|
179164
|
-
source_decision_id: trace3.id,
|
|
179165
|
-
target_entity_type: "file",
|
|
179166
|
-
target_entity_id: file3,
|
|
179167
|
-
link_type: "assigns_file",
|
|
179168
|
-
strength: 1,
|
|
179169
|
-
context: `File assigned to worker ${input.workerName || "worker"}`
|
|
179170
|
-
});
|
|
179171
|
-
}
|
|
179172
|
-
await db.close?.();
|
|
179173
|
-
return trace3.id;
|
|
179174
|
-
} catch (error47) {
|
|
179175
|
-
console.warn("[decision-trace] Failed to trace worker_spawn:", error47);
|
|
179176
|
-
return "";
|
|
179177
|
-
}
|
|
179178
|
-
}
|
|
179179
|
-
async function traceReviewDecision(input) {
|
|
179180
|
-
try {
|
|
179181
|
-
const db = await getTraceDb(input.projectKey);
|
|
179182
|
-
const trace3 = await createDecisionTrace(db, {
|
|
179183
|
-
decision_type: "review_decision",
|
|
179184
|
-
epic_id: input.epicId,
|
|
179185
|
-
bead_id: input.beadId,
|
|
179186
|
-
agent_name: input.agentName,
|
|
179187
|
-
project_key: input.projectKey,
|
|
179188
|
-
decision: {
|
|
179189
|
-
status: input.status,
|
|
179190
|
-
worker_id: input.workerId,
|
|
179191
|
-
issues_count: input.issues?.length || 0,
|
|
179192
|
-
attempt_number: input.attemptNumber,
|
|
179193
|
-
remaining_attempts: input.remainingAttempts
|
|
179194
|
-
},
|
|
179195
|
-
rationale: input.rationale || input.summary || `Review ${input.status}`,
|
|
179196
|
-
inputs_gathered: input.issues ? [{ source: "code_review", issues: input.issues }] : undefined
|
|
179197
|
-
});
|
|
179198
|
-
await createEntityLink(db, {
|
|
179199
|
-
source_decision_id: trace3.id,
|
|
179200
|
-
target_entity_type: "agent",
|
|
179201
|
-
target_entity_id: input.workerId,
|
|
179202
|
-
link_type: "reviewed_work_by",
|
|
179203
|
-
strength: 1,
|
|
179204
|
-
context: `Review ${input.status} for ${input.workerId}`
|
|
179205
|
-
});
|
|
179206
|
-
await db.close?.();
|
|
179207
|
-
return trace3.id;
|
|
179208
|
-
} catch (error47) {
|
|
179209
|
-
console.warn("[decision-trace] Failed to trace review_decision:", error47);
|
|
179210
|
-
return "";
|
|
179211
|
-
}
|
|
179212
|
-
}
|
|
179213
|
-
|
|
179214
|
-
// src/swarm-decompose.ts
|
|
179320
|
+
init_decision_trace_integration();
|
|
179215
179321
|
var DECOMPOSITION_PROMPT = `You are decomposing a task into parallelizable subtasks for a swarm of agents.
|
|
179216
179322
|
|
|
179217
179323
|
## Task
|
|
@@ -181813,6 +181919,7 @@ init_dist();
|
|
|
181813
181919
|
init_zod();
|
|
181814
181920
|
init_dist2();
|
|
181815
181921
|
init_eval_capture();
|
|
181922
|
+
init_decision_trace_integration();
|
|
181816
181923
|
var ReviewIssueSchema = exports_external.object({
|
|
181817
181924
|
file: exports_external.string(),
|
|
181818
181925
|
line: exports_external.number().optional(),
|
|
@@ -183073,6 +183180,7 @@ This will be recorded as a negative learning signal.`;
|
|
|
183073
183180
|
}
|
|
183074
183181
|
const completionDurationMs = Date.now() - args2.start_time;
|
|
183075
183182
|
const eventEpicId = cell.parent_id || (args2.bead_id.includes(".") ? args2.bead_id.split(".")[0] : args2.bead_id);
|
|
183183
|
+
let outcomeEventId;
|
|
183076
183184
|
try {
|
|
183077
183185
|
const event = createEvent("subtask_outcome", {
|
|
183078
183186
|
project_key: args2.project_key,
|
|
@@ -183087,10 +183195,23 @@ This will be recorded as a negative learning signal.`;
|
|
|
183087
183195
|
scope_violation: contractValidation ? !contractValidation.valid : undefined,
|
|
183088
183196
|
violation_files: contractValidation?.violations
|
|
183089
183197
|
});
|
|
183090
|
-
await appendEvent(event, args2.project_key);
|
|
183198
|
+
const savedEvent = await appendEvent(event, args2.project_key);
|
|
183199
|
+
outcomeEventId = savedEvent.id;
|
|
183091
183200
|
} catch (error47) {
|
|
183092
183201
|
console.warn("[swarm_complete] Failed to emit SubtaskOutcomeEvent:", error47);
|
|
183093
183202
|
}
|
|
183203
|
+
if (outcomeEventId) {
|
|
183204
|
+
try {
|
|
183205
|
+
const { linkOutcomeToDecisionTrace: linkOutcomeToDecisionTrace2 } = await Promise.resolve().then(() => (init_decision_trace_integration(), exports_decision_trace_integration));
|
|
183206
|
+
await linkOutcomeToDecisionTrace2({
|
|
183207
|
+
projectKey: args2.project_key,
|
|
183208
|
+
beadId: args2.bead_id,
|
|
183209
|
+
outcomeEventId
|
|
183210
|
+
});
|
|
183211
|
+
} catch (error47) {
|
|
183212
|
+
console.warn("[swarm_complete] Failed to link outcome to decision trace:", error47);
|
|
183213
|
+
}
|
|
183214
|
+
}
|
|
183094
183215
|
try {
|
|
183095
183216
|
const workerCompletedEvent = createEvent("worker_completed", {
|
|
183096
183217
|
project_key: args2.project_key,
|
|
@@ -184068,6 +184189,7 @@ var orchestrateTools = {
|
|
|
184068
184189
|
// src/swarm-prompts.ts
|
|
184069
184190
|
init_eval_capture();
|
|
184070
184191
|
init_memory_tools();
|
|
184192
|
+
init_decision_trace_integration();
|
|
184071
184193
|
var STRATEGY_DECOMPOSITION_PROMPT2 = `You are decomposing a task into parallelizable subtasks for a swarm of agents.
|
|
184072
184194
|
|
|
184073
184195
|
## Task
|