opencode-swarm 7.77.1 → 7.77.3
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/.opencode/skills/swarm-pr-review/SKILL.md +6 -8
- package/dist/cli/index.js +6 -2
- package/dist/commands/registry.d.ts +1 -1
- package/dist/index.js +716 -281
- package/dist/tools/dispatch-lanes.d.ts +107 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var package_default;
|
|
|
69
69
|
var init_package = __esm(() => {
|
|
70
70
|
package_default = {
|
|
71
71
|
name: "opencode-swarm",
|
|
72
|
-
version: "7.77.
|
|
72
|
+
version: "7.77.3",
|
|
73
73
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
74
74
|
main: "dist/index.js",
|
|
75
75
|
types: "dist/index.d.ts",
|
|
@@ -682,6 +682,10 @@ var init_tool_metadata = __esm(() => {
|
|
|
682
682
|
"test_engineer"
|
|
683
683
|
]
|
|
684
684
|
},
|
|
685
|
+
dispatch_lanes: {
|
|
686
|
+
description: "dispatch multiple read-only exploration/review lanes concurrently and return a structured join result",
|
|
687
|
+
agents: ["architect"]
|
|
688
|
+
},
|
|
685
689
|
summarize_work: {
|
|
686
690
|
description: "emit a short structured summary of completed work (key decisions, assumptions, risks, constraints) at task completion; rolls up per phase for architecture-supervisor review. Advisory, never blocks.",
|
|
687
691
|
agents: [
|
|
@@ -92679,7 +92683,7 @@ Subcommands:
|
|
|
92679
92683
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handlePrReviewCommand),
|
|
92680
92684
|
description: "Launch deep PR review with multi-lane analysis [url] [--council]",
|
|
92681
92685
|
args: "<pr-url|owner/repo#N|N> [--council]",
|
|
92682
|
-
details: "Launches a structured PR review: reconstructs PR intent via obligation extraction cascade, runs 6 parallel explorer lanes (correctness, security, dependencies, docs-intent-vs-actual, tests, performance-architecture), validates findings through independent reviewer confirmation, applies critic challenge to HIGH/CRITICAL findings, synthesizes structured report. --council variant fires adversarial multi-model review. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolves against origin remote).",
|
|
92686
|
+
details: "Launches a structured PR review: reconstructs PR intent via obligation extraction cascade, runs 6 parallel explorer lanes through the deterministic dispatch_lanes join barrier (correctness, security, dependencies, docs-intent-vs-actual, tests, performance-architecture), validates findings through independent reviewer confirmation, applies critic challenge to HIGH/CRITICAL findings, synthesizes structured report. --council variant fires adversarial multi-model review. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolves against origin remote).",
|
|
92683
92687
|
category: "agent"
|
|
92684
92688
|
},
|
|
92685
92689
|
"pr-feedback": {
|
|
@@ -103434,7 +103438,7 @@ var init_curator_drift = __esm(() => {
|
|
|
103434
103438
|
var exports_design_doc_drift = {};
|
|
103435
103439
|
__export(exports_design_doc_drift, {
|
|
103436
103440
|
runDesignDocDriftCheck: () => runDesignDocDriftCheck,
|
|
103437
|
-
_internals: () =>
|
|
103441
|
+
_internals: () => _internals94
|
|
103438
103442
|
});
|
|
103439
103443
|
import * as fs109 from "node:fs";
|
|
103440
103444
|
import * as path164 from "node:path";
|
|
@@ -103567,7 +103571,7 @@ async function runDesignDocDriftCheck(directory, phase, outDir) {
|
|
|
103567
103571
|
return null;
|
|
103568
103572
|
}
|
|
103569
103573
|
}
|
|
103570
|
-
var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL,
|
|
103574
|
+
var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL, _internals94;
|
|
103571
103575
|
var init_design_doc_drift = __esm(() => {
|
|
103572
103576
|
init_event_bus();
|
|
103573
103577
|
init_effective_spec();
|
|
@@ -103582,7 +103586,7 @@ var init_design_doc_drift = __esm(() => {
|
|
|
103582
103586
|
"idiom-notes": path164.join("reference", "idiom-notes.md")
|
|
103583
103587
|
};
|
|
103584
103588
|
TRACEABILITY_REL = path164.join("reference", "traceability.json");
|
|
103585
|
-
|
|
103589
|
+
_internals94 = {
|
|
103586
103590
|
mtimeMsOrNull,
|
|
103587
103591
|
resolveAnchorWithin,
|
|
103588
103592
|
DESIGN_DOC_FILES
|
|
@@ -103593,7 +103597,7 @@ var init_design_doc_drift = __esm(() => {
|
|
|
103593
103597
|
var exports_project_context = {};
|
|
103594
103598
|
__export(exports_project_context, {
|
|
103595
103599
|
buildProjectContext: () => buildProjectContext,
|
|
103596
|
-
_internals: () =>
|
|
103600
|
+
_internals: () => _internals107,
|
|
103597
103601
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
103598
103602
|
});
|
|
103599
103603
|
import * as fs133 from "node:fs";
|
|
@@ -103677,7 +103681,7 @@ function selectLintCommand(backend, directory) {
|
|
|
103677
103681
|
return null;
|
|
103678
103682
|
}
|
|
103679
103683
|
async function buildProjectContext(directory) {
|
|
103680
|
-
const backend = await
|
|
103684
|
+
const backend = await _internals107.pickBackend(directory);
|
|
103681
103685
|
if (!backend)
|
|
103682
103686
|
return null;
|
|
103683
103687
|
const ctx = emptyProjectContext();
|
|
@@ -103716,17 +103720,17 @@ async function buildProjectContext(directory) {
|
|
|
103716
103720
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
103717
103721
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
103718
103722
|
}
|
|
103719
|
-
const profiles =
|
|
103723
|
+
const profiles = _internals107.pickedProfiles(directory);
|
|
103720
103724
|
if (profiles.length > 1) {
|
|
103721
103725
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
103722
103726
|
}
|
|
103723
103727
|
return ctx;
|
|
103724
103728
|
}
|
|
103725
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
103729
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals107;
|
|
103726
103730
|
var init_project_context = __esm(() => {
|
|
103727
103731
|
init_dispatch();
|
|
103728
103732
|
init_framework_detector();
|
|
103729
|
-
|
|
103733
|
+
_internals107 = {
|
|
103730
103734
|
pickBackend,
|
|
103731
103735
|
pickedProfiles
|
|
103732
103736
|
};
|
|
@@ -114869,13 +114873,13 @@ async function bumpCountersBatch(directory, bumps) {
|
|
|
114869
114873
|
updated = true;
|
|
114870
114874
|
}
|
|
114871
114875
|
}
|
|
114872
|
-
return updated;
|
|
114876
|
+
return updated ? entries : null;
|
|
114873
114877
|
};
|
|
114874
114878
|
const swarmPath = resolveSwarmKnowledgePath(directory);
|
|
114875
|
-
await transactKnowledge(swarmPath,
|
|
114879
|
+
await transactKnowledge(swarmPath, applyOne);
|
|
114876
114880
|
const hivePath = resolveHiveKnowledgePath();
|
|
114877
114881
|
if (existsSync71(hivePath)) {
|
|
114878
|
-
await transactKnowledge(hivePath,
|
|
114882
|
+
await transactKnowledge(hivePath, applyOne);
|
|
114879
114883
|
}
|
|
114880
114884
|
}
|
|
114881
114885
|
async function bumpCounters(directory, ids, field) {
|
|
@@ -124446,6 +124450,594 @@ var diff_summary = createSwarmTool({
|
|
|
124446
124450
|
}
|
|
124447
124451
|
});
|
|
124448
124452
|
|
|
124453
|
+
// node_modules/yocto-queue/index.js
|
|
124454
|
+
class Node2 {
|
|
124455
|
+
value;
|
|
124456
|
+
next;
|
|
124457
|
+
constructor(value) {
|
|
124458
|
+
this.value = value;
|
|
124459
|
+
}
|
|
124460
|
+
}
|
|
124461
|
+
|
|
124462
|
+
class Queue {
|
|
124463
|
+
#head;
|
|
124464
|
+
#tail;
|
|
124465
|
+
#size;
|
|
124466
|
+
constructor() {
|
|
124467
|
+
this.clear();
|
|
124468
|
+
}
|
|
124469
|
+
enqueue(value) {
|
|
124470
|
+
const node = new Node2(value);
|
|
124471
|
+
if (this.#head) {
|
|
124472
|
+
this.#tail.next = node;
|
|
124473
|
+
this.#tail = node;
|
|
124474
|
+
} else {
|
|
124475
|
+
this.#head = node;
|
|
124476
|
+
this.#tail = node;
|
|
124477
|
+
}
|
|
124478
|
+
this.#size++;
|
|
124479
|
+
}
|
|
124480
|
+
dequeue() {
|
|
124481
|
+
const current = this.#head;
|
|
124482
|
+
if (!current) {
|
|
124483
|
+
return;
|
|
124484
|
+
}
|
|
124485
|
+
this.#head = this.#head.next;
|
|
124486
|
+
this.#size--;
|
|
124487
|
+
if (!this.#head) {
|
|
124488
|
+
this.#tail = undefined;
|
|
124489
|
+
}
|
|
124490
|
+
return current.value;
|
|
124491
|
+
}
|
|
124492
|
+
peek() {
|
|
124493
|
+
if (!this.#head) {
|
|
124494
|
+
return;
|
|
124495
|
+
}
|
|
124496
|
+
return this.#head.value;
|
|
124497
|
+
}
|
|
124498
|
+
clear() {
|
|
124499
|
+
this.#head = undefined;
|
|
124500
|
+
this.#tail = undefined;
|
|
124501
|
+
this.#size = 0;
|
|
124502
|
+
}
|
|
124503
|
+
get size() {
|
|
124504
|
+
return this.#size;
|
|
124505
|
+
}
|
|
124506
|
+
*[Symbol.iterator]() {
|
|
124507
|
+
let current = this.#head;
|
|
124508
|
+
while (current) {
|
|
124509
|
+
yield current.value;
|
|
124510
|
+
current = current.next;
|
|
124511
|
+
}
|
|
124512
|
+
}
|
|
124513
|
+
*drain() {
|
|
124514
|
+
while (this.#head) {
|
|
124515
|
+
yield this.dequeue();
|
|
124516
|
+
}
|
|
124517
|
+
}
|
|
124518
|
+
}
|
|
124519
|
+
|
|
124520
|
+
// node_modules/p-limit/index.js
|
|
124521
|
+
function pLimit(concurrency) {
|
|
124522
|
+
let rejectOnClear = false;
|
|
124523
|
+
if (typeof concurrency === "object") {
|
|
124524
|
+
({ concurrency, rejectOnClear = false } = concurrency);
|
|
124525
|
+
}
|
|
124526
|
+
validateConcurrency(concurrency);
|
|
124527
|
+
if (typeof rejectOnClear !== "boolean") {
|
|
124528
|
+
throw new TypeError("Expected `rejectOnClear` to be a boolean");
|
|
124529
|
+
}
|
|
124530
|
+
const queue = new Queue;
|
|
124531
|
+
let activeCount = 0;
|
|
124532
|
+
const resumeNext = () => {
|
|
124533
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
124534
|
+
activeCount++;
|
|
124535
|
+
queue.dequeue().run();
|
|
124536
|
+
}
|
|
124537
|
+
};
|
|
124538
|
+
const next = () => {
|
|
124539
|
+
activeCount--;
|
|
124540
|
+
resumeNext();
|
|
124541
|
+
};
|
|
124542
|
+
const run2 = async (function_, resolve55, arguments_2) => {
|
|
124543
|
+
const result = (async () => function_(...arguments_2))();
|
|
124544
|
+
resolve55(result);
|
|
124545
|
+
try {
|
|
124546
|
+
await result;
|
|
124547
|
+
} catch {}
|
|
124548
|
+
next();
|
|
124549
|
+
};
|
|
124550
|
+
const enqueue = (function_, resolve55, reject, arguments_2) => {
|
|
124551
|
+
const queueItem = { reject };
|
|
124552
|
+
new Promise((internalResolve) => {
|
|
124553
|
+
queueItem.run = internalResolve;
|
|
124554
|
+
queue.enqueue(queueItem);
|
|
124555
|
+
}).then(run2.bind(undefined, function_, resolve55, arguments_2));
|
|
124556
|
+
if (activeCount < concurrency) {
|
|
124557
|
+
resumeNext();
|
|
124558
|
+
}
|
|
124559
|
+
};
|
|
124560
|
+
const generator = (function_, ...arguments_2) => new Promise((resolve55, reject) => {
|
|
124561
|
+
enqueue(function_, resolve55, reject, arguments_2);
|
|
124562
|
+
});
|
|
124563
|
+
Object.defineProperties(generator, {
|
|
124564
|
+
activeCount: {
|
|
124565
|
+
get: () => activeCount
|
|
124566
|
+
},
|
|
124567
|
+
pendingCount: {
|
|
124568
|
+
get: () => queue.size
|
|
124569
|
+
},
|
|
124570
|
+
clearQueue: {
|
|
124571
|
+
value() {
|
|
124572
|
+
if (!rejectOnClear) {
|
|
124573
|
+
queue.clear();
|
|
124574
|
+
return;
|
|
124575
|
+
}
|
|
124576
|
+
const abortError = AbortSignal.abort().reason;
|
|
124577
|
+
while (queue.size > 0) {
|
|
124578
|
+
queue.dequeue().reject(abortError);
|
|
124579
|
+
}
|
|
124580
|
+
}
|
|
124581
|
+
},
|
|
124582
|
+
concurrency: {
|
|
124583
|
+
get: () => concurrency,
|
|
124584
|
+
set(newConcurrency) {
|
|
124585
|
+
validateConcurrency(newConcurrency);
|
|
124586
|
+
concurrency = newConcurrency;
|
|
124587
|
+
queueMicrotask(() => {
|
|
124588
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
124589
|
+
resumeNext();
|
|
124590
|
+
}
|
|
124591
|
+
});
|
|
124592
|
+
}
|
|
124593
|
+
},
|
|
124594
|
+
map: {
|
|
124595
|
+
async value(iterable, function_) {
|
|
124596
|
+
const promises10 = Array.from(iterable, (value, index) => this(function_, value, index));
|
|
124597
|
+
return Promise.all(promises10);
|
|
124598
|
+
}
|
|
124599
|
+
}
|
|
124600
|
+
});
|
|
124601
|
+
return generator;
|
|
124602
|
+
}
|
|
124603
|
+
function validateConcurrency(concurrency) {
|
|
124604
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
124605
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
124606
|
+
}
|
|
124607
|
+
}
|
|
124608
|
+
|
|
124609
|
+
// src/tools/dispatch-lanes.ts
|
|
124610
|
+
init_zod();
|
|
124611
|
+
init_constants();
|
|
124612
|
+
init_schema();
|
|
124613
|
+
|
|
124614
|
+
// src/parallel/dispatcher/parallel-dispatcher.ts
|
|
124615
|
+
function createParallelDispatcher(config3) {
|
|
124616
|
+
const limit = pLimit(config3.maxConcurrentTasks);
|
|
124617
|
+
const activeSlots = new Map;
|
|
124618
|
+
let slotCounter = 0;
|
|
124619
|
+
let shutdownCalled = false;
|
|
124620
|
+
return {
|
|
124621
|
+
config: config3,
|
|
124622
|
+
dispatch(taskId) {
|
|
124623
|
+
if (!config3.enabled) {
|
|
124624
|
+
return { action: "reject", reason: "dispatcher_disabled" };
|
|
124625
|
+
}
|
|
124626
|
+
if (shutdownCalled) {
|
|
124627
|
+
return { action: "reject", reason: "dispatcher_shutdown" };
|
|
124628
|
+
}
|
|
124629
|
+
if (activeSlots.size >= config3.maxConcurrentTasks) {
|
|
124630
|
+
return { action: "defer", reason: "max_concurrent_tasks_reached" };
|
|
124631
|
+
}
|
|
124632
|
+
const slotId = `slot-${++slotCounter}`;
|
|
124633
|
+
const runId = `run-${taskId}-${slotId}`;
|
|
124634
|
+
const slot = {
|
|
124635
|
+
slotId,
|
|
124636
|
+
taskId,
|
|
124637
|
+
runId,
|
|
124638
|
+
startedAt: Date.now()
|
|
124639
|
+
};
|
|
124640
|
+
activeSlots.set(slotId, slot);
|
|
124641
|
+
limit(async () => {});
|
|
124642
|
+
return { action: "dispatch", reason: "slot_available", slot };
|
|
124643
|
+
},
|
|
124644
|
+
handles() {
|
|
124645
|
+
return [...activeSlots.values()].map((slot) => ({
|
|
124646
|
+
slotId: slot.slotId,
|
|
124647
|
+
taskId: slot.taskId,
|
|
124648
|
+
runId: slot.runId,
|
|
124649
|
+
cancel: () => {
|
|
124650
|
+
activeSlots.delete(slot.slotId);
|
|
124651
|
+
}
|
|
124652
|
+
}));
|
|
124653
|
+
},
|
|
124654
|
+
releaseSlot(slotId) {
|
|
124655
|
+
activeSlots.delete(slotId);
|
|
124656
|
+
},
|
|
124657
|
+
shutdown() {
|
|
124658
|
+
shutdownCalled = true;
|
|
124659
|
+
activeSlots.clear();
|
|
124660
|
+
limit.clearQueue();
|
|
124661
|
+
}
|
|
124662
|
+
};
|
|
124663
|
+
}
|
|
124664
|
+
|
|
124665
|
+
// src/tools/dispatch-lanes.ts
|
|
124666
|
+
init_state();
|
|
124667
|
+
init_create_tool();
|
|
124668
|
+
var MAX_LANES = 8;
|
|
124669
|
+
var MAX_PROMPT_CHARS = 80000;
|
|
124670
|
+
var DEFAULT_TIMEOUT_MS3 = 300000;
|
|
124671
|
+
var MAX_TIMEOUT_MS2 = 1800000;
|
|
124672
|
+
var MAX_LANE_OUTPUT_CHARS = 20000;
|
|
124673
|
+
var MAX_ERROR_CHARS = 200;
|
|
124674
|
+
var ERROR_TRUNCATION_SUFFIX = "...";
|
|
124675
|
+
var AGENT_NAME_SEPARATORS = ["_", "-", " "];
|
|
124676
|
+
var READ_ONLY_LANE_ROLES = new Set([
|
|
124677
|
+
"explorer",
|
|
124678
|
+
"reviewer",
|
|
124679
|
+
"critic",
|
|
124680
|
+
"critic_oversight",
|
|
124681
|
+
"critic_sounding_board",
|
|
124682
|
+
"critic_drift_verifier",
|
|
124683
|
+
"critic_hallucination_verifier",
|
|
124684
|
+
"critic_architecture_supervisor",
|
|
124685
|
+
"sme",
|
|
124686
|
+
"researcher",
|
|
124687
|
+
"council_generalist",
|
|
124688
|
+
"council_skeptic",
|
|
124689
|
+
"council_domain_expert"
|
|
124690
|
+
]);
|
|
124691
|
+
var READ_ONLY_TOOL_DENYLIST = [
|
|
124692
|
+
...new Set([
|
|
124693
|
+
...WRITE_TOOL_NAMES,
|
|
124694
|
+
"extract_code_blocks",
|
|
124695
|
+
"multiedit",
|
|
124696
|
+
"multi_edit",
|
|
124697
|
+
"todo_write",
|
|
124698
|
+
"save_plan",
|
|
124699
|
+
"update_task_status",
|
|
124700
|
+
"phase_complete",
|
|
124701
|
+
"declare_scope",
|
|
124702
|
+
"declare_council_criteria",
|
|
124703
|
+
"submit_council_verdicts",
|
|
124704
|
+
"submit_phase_council_verdicts",
|
|
124705
|
+
"set_qa_gates",
|
|
124706
|
+
"write_retro",
|
|
124707
|
+
"write_drift_evidence",
|
|
124708
|
+
"write_hallucination_evidence",
|
|
124709
|
+
"write_mutation_evidence",
|
|
124710
|
+
"knowledge_add",
|
|
124711
|
+
"knowledge_remove",
|
|
124712
|
+
"summarize_work",
|
|
124713
|
+
"doc_scan"
|
|
124714
|
+
])
|
|
124715
|
+
];
|
|
124716
|
+
var LaneSchema = exports_external.object({
|
|
124717
|
+
id: exports_external.string().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9_.-]*$/).describe("Stable lane identifier, unique within this dispatch batch"),
|
|
124718
|
+
agent: exports_external.string().min(1).max(120).describe("Read-only swarm agent name, including any generated swarm prefix"),
|
|
124719
|
+
prompt: exports_external.string().min(1).max(MAX_PROMPT_CHARS).describe("Full lane prompt to send to the requested agent")
|
|
124720
|
+
});
|
|
124721
|
+
var DispatchLanesArgsSchema = exports_external.object({
|
|
124722
|
+
lanes: exports_external.array(LaneSchema).min(1).max(MAX_LANES).describe("Read-only lane specs to dispatch concurrently"),
|
|
124723
|
+
max_concurrent: exports_external.number().int().min(1).max(MAX_LANES).optional().describe("Maximum lanes in flight at once; defaults to lane count"),
|
|
124724
|
+
timeout_ms: exports_external.number().int().min(10).max(MAX_TIMEOUT_MS2).optional().describe("Per-lane session create/prompt timeout in milliseconds")
|
|
124725
|
+
});
|
|
124726
|
+
var _internals79 = {
|
|
124727
|
+
getSessionOps: () => swarmState.opencodeClient?.session ?? null,
|
|
124728
|
+
getGeneratedAgentNames: () => swarmState.generatedAgentNames,
|
|
124729
|
+
createParallelDispatcher,
|
|
124730
|
+
now: () => Date.now()
|
|
124731
|
+
};
|
|
124732
|
+
async function executeDispatchLanes(args2, directory, context = {}) {
|
|
124733
|
+
const parsed = DispatchLanesArgsSchema.safeParse(args2);
|
|
124734
|
+
if (!parsed.success) {
|
|
124735
|
+
return failureResult({
|
|
124736
|
+
failure_class: "invalid_args",
|
|
124737
|
+
message: "Invalid dispatch_lanes arguments",
|
|
124738
|
+
errors: parsed.error.issues.map((issue3) => `${issue3.path.join(".")}: ${issue3.message}`)
|
|
124739
|
+
});
|
|
124740
|
+
}
|
|
124741
|
+
const duplicateLaneIds = findDuplicateLaneIds(parsed.data.lanes);
|
|
124742
|
+
if (duplicateLaneIds.length > 0) {
|
|
124743
|
+
return failureResult({
|
|
124744
|
+
failure_class: "invalid_args",
|
|
124745
|
+
message: "Lane IDs must be unique within one dispatch_lanes batch",
|
|
124746
|
+
errors: duplicateLaneIds.map((id) => `Duplicate lane id: ${id}`)
|
|
124747
|
+
});
|
|
124748
|
+
}
|
|
124749
|
+
const session = _internals79.getSessionOps();
|
|
124750
|
+
if (!session) {
|
|
124751
|
+
return failureResult({
|
|
124752
|
+
failure_class: "no_client",
|
|
124753
|
+
message: "OpenCode session client is not available"
|
|
124754
|
+
});
|
|
124755
|
+
}
|
|
124756
|
+
const lanes = parsed.data.lanes;
|
|
124757
|
+
const maxConcurrent = Math.min(parsed.data.max_concurrent ?? lanes.length, lanes.length, MAX_LANES);
|
|
124758
|
+
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_TIMEOUT_MS3;
|
|
124759
|
+
const dispatcher = _internals79.createParallelDispatcher({
|
|
124760
|
+
enabled: true,
|
|
124761
|
+
maxConcurrentTasks: maxConcurrent,
|
|
124762
|
+
evidenceLockTimeoutMs: 0
|
|
124763
|
+
});
|
|
124764
|
+
const limit = pLimit(maxConcurrent);
|
|
124765
|
+
try {
|
|
124766
|
+
const laneResults = await Promise.all(lanes.map((lane) => limit(() => runLane(session, dispatcher, lane, directory, timeoutMs, context))));
|
|
124767
|
+
return buildResult(laneResults, maxConcurrent, timeoutMs);
|
|
124768
|
+
} finally {
|
|
124769
|
+
dispatcher.shutdown();
|
|
124770
|
+
}
|
|
124771
|
+
}
|
|
124772
|
+
async function runLane(session, dispatcher, lane, directory, timeoutMs, context) {
|
|
124773
|
+
const validation2 = validateLaneAgent(lane.agent, context);
|
|
124774
|
+
const role = validation2.role;
|
|
124775
|
+
const startedAt = isoNow();
|
|
124776
|
+
if (!validation2.ok) {
|
|
124777
|
+
return {
|
|
124778
|
+
id: lane.id,
|
|
124779
|
+
agent: lane.agent,
|
|
124780
|
+
role,
|
|
124781
|
+
status: "rejected",
|
|
124782
|
+
started_at: startedAt,
|
|
124783
|
+
completed_at: isoNow(),
|
|
124784
|
+
error: validation2.error
|
|
124785
|
+
};
|
|
124786
|
+
}
|
|
124787
|
+
const decision = dispatcher.dispatch(lane.id);
|
|
124788
|
+
if (decision.action !== "dispatch") {
|
|
124789
|
+
return {
|
|
124790
|
+
id: lane.id,
|
|
124791
|
+
agent: lane.agent,
|
|
124792
|
+
role,
|
|
124793
|
+
status: "failed",
|
|
124794
|
+
started_at: startedAt,
|
|
124795
|
+
completed_at: isoNow(),
|
|
124796
|
+
error: `dispatcher ${decision.action}: ${decision.reason}`
|
|
124797
|
+
};
|
|
124798
|
+
}
|
|
124799
|
+
let sessionId;
|
|
124800
|
+
try {
|
|
124801
|
+
const createTimeoutMessage = `Lane "${lane.id}" session.create timed out after ${timeoutMs}ms`;
|
|
124802
|
+
const createPromise = session.create({ query: { directory } });
|
|
124803
|
+
let createTimedOut = false;
|
|
124804
|
+
createPromise.then((createResult2) => {
|
|
124805
|
+
if (createTimedOut && createResult2.data?.id) {
|
|
124806
|
+
scheduleSessionCleanup(session, createResult2.data.id);
|
|
124807
|
+
}
|
|
124808
|
+
}).catch(() => {
|
|
124809
|
+
return;
|
|
124810
|
+
});
|
|
124811
|
+
const createResult = await withTimeout2(createPromise, timeoutMs, createTimeoutMessage).catch((error93) => {
|
|
124812
|
+
if (formatError3(error93) === createTimeoutMessage) {
|
|
124813
|
+
createTimedOut = true;
|
|
124814
|
+
}
|
|
124815
|
+
throw error93;
|
|
124816
|
+
});
|
|
124817
|
+
if (!createResult.data?.id) {
|
|
124818
|
+
return failedLane(lane, role, startedAt, `session.create failed: ${formatError3(createResult.error)}`, decision.slot.slotId, decision.slot.runId);
|
|
124819
|
+
}
|
|
124820
|
+
sessionId = createResult.data.id;
|
|
124821
|
+
const promptResult = await withTimeout2(session.prompt({
|
|
124822
|
+
path: { id: sessionId },
|
|
124823
|
+
body: {
|
|
124824
|
+
agent: lane.agent,
|
|
124825
|
+
tools: buildReadOnlyTools(),
|
|
124826
|
+
parts: [{ type: "text", text: lane.prompt }]
|
|
124827
|
+
}
|
|
124828
|
+
}), timeoutMs, `Lane "${lane.id}" session.prompt timed out after ${timeoutMs}ms`);
|
|
124829
|
+
if (!promptResult.data) {
|
|
124830
|
+
return failedLane(lane, role, startedAt, `session.prompt failed: ${formatError3(promptResult.error)}`, decision.slot.slotId, decision.slot.runId, sessionId);
|
|
124831
|
+
}
|
|
124832
|
+
const boundedOutput = boundLaneOutput(extractText3(promptResult.data.parts));
|
|
124833
|
+
return {
|
|
124834
|
+
id: lane.id,
|
|
124835
|
+
agent: lane.agent,
|
|
124836
|
+
role,
|
|
124837
|
+
status: "completed",
|
|
124838
|
+
session_id: sessionId,
|
|
124839
|
+
slot_id: decision.slot.slotId,
|
|
124840
|
+
run_id: decision.slot.runId,
|
|
124841
|
+
started_at: startedAt,
|
|
124842
|
+
completed_at: isoNow(),
|
|
124843
|
+
...boundedOutput
|
|
124844
|
+
};
|
|
124845
|
+
} catch (error93) {
|
|
124846
|
+
return failedLane(lane, role, startedAt, formatError3(error93), decision.slot.slotId, decision.slot.runId, sessionId);
|
|
124847
|
+
} finally {
|
|
124848
|
+
dispatcher.releaseSlot(decision.slot.slotId);
|
|
124849
|
+
if (sessionId) {
|
|
124850
|
+
scheduleSessionCleanup(session, sessionId);
|
|
124851
|
+
}
|
|
124852
|
+
}
|
|
124853
|
+
}
|
|
124854
|
+
function buildResult(laneResults, maxConcurrent, timeoutMs) {
|
|
124855
|
+
const completed = laneResults.filter((lane) => lane.status === "completed");
|
|
124856
|
+
const failed = laneResults.filter((lane) => lane.status === "failed");
|
|
124857
|
+
const rejected = laneResults.filter((lane) => lane.status === "rejected");
|
|
124858
|
+
return {
|
|
124859
|
+
success: failed.length === 0 && rejected.length === 0,
|
|
124860
|
+
dispatched: laneResults.length,
|
|
124861
|
+
completed: completed.length,
|
|
124862
|
+
failed: failed.length,
|
|
124863
|
+
rejected: rejected.length,
|
|
124864
|
+
max_concurrent: maxConcurrent,
|
|
124865
|
+
timeout_ms: timeoutMs,
|
|
124866
|
+
lane_results: laneResults
|
|
124867
|
+
};
|
|
124868
|
+
}
|
|
124869
|
+
function failedLane(lane, role, startedAt, error93, slotId, runId, sessionId) {
|
|
124870
|
+
return {
|
|
124871
|
+
id: lane.id,
|
|
124872
|
+
agent: lane.agent,
|
|
124873
|
+
role,
|
|
124874
|
+
status: "failed",
|
|
124875
|
+
session_id: sessionId,
|
|
124876
|
+
slot_id: slotId,
|
|
124877
|
+
run_id: runId,
|
|
124878
|
+
started_at: startedAt,
|
|
124879
|
+
completed_at: isoNow(),
|
|
124880
|
+
error: error93
|
|
124881
|
+
};
|
|
124882
|
+
}
|
|
124883
|
+
function validateLaneAgent(agent, context) {
|
|
124884
|
+
const generatedAgentNames = _internals79.getGeneratedAgentNames();
|
|
124885
|
+
const role = resolveGeneratedAgentRole(agent, generatedAgentNames);
|
|
124886
|
+
if (!isKnownCanonicalRole(role)) {
|
|
124887
|
+
return {
|
|
124888
|
+
ok: false,
|
|
124889
|
+
role,
|
|
124890
|
+
error: `Agent "${agent}" is not registered as a generated swarm agent or canonical role`
|
|
124891
|
+
};
|
|
124892
|
+
}
|
|
124893
|
+
if (!READ_ONLY_LANE_ROLES.has(role)) {
|
|
124894
|
+
return {
|
|
124895
|
+
ok: false,
|
|
124896
|
+
role,
|
|
124897
|
+
error: `Agent role "${role}" is not allowed for read-only lane dispatch`
|
|
124898
|
+
};
|
|
124899
|
+
}
|
|
124900
|
+
const callerPrefix = context.callerAgent ? getGeneratedAgentPrefix(context.callerAgent, generatedAgentNames) : null;
|
|
124901
|
+
if (callerPrefix) {
|
|
124902
|
+
const lanePrefix = getGeneratedAgentPrefix(agent, generatedAgentNames);
|
|
124903
|
+
if (lanePrefix !== callerPrefix) {
|
|
124904
|
+
return {
|
|
124905
|
+
ok: false,
|
|
124906
|
+
role,
|
|
124907
|
+
error: `Agent "${agent}" does not match caller swarm prefix "${callerPrefix}"`
|
|
124908
|
+
};
|
|
124909
|
+
}
|
|
124910
|
+
}
|
|
124911
|
+
return { ok: true, role };
|
|
124912
|
+
}
|
|
124913
|
+
function getGeneratedAgentPrefix(agent, generatedAgentNames) {
|
|
124914
|
+
const role = resolveGeneratedAgentRole(agent, generatedAgentNames);
|
|
124915
|
+
if (!isKnownCanonicalRole(role))
|
|
124916
|
+
return null;
|
|
124917
|
+
const normalized = agent.toLowerCase();
|
|
124918
|
+
if (normalized === role)
|
|
124919
|
+
return null;
|
|
124920
|
+
for (const separator of AGENT_NAME_SEPARATORS) {
|
|
124921
|
+
const suffix = `${separator}${role}`;
|
|
124922
|
+
if (normalized.endsWith(suffix)) {
|
|
124923
|
+
return normalized.slice(0, -suffix.length);
|
|
124924
|
+
}
|
|
124925
|
+
}
|
|
124926
|
+
return null;
|
|
124927
|
+
}
|
|
124928
|
+
function buildReadOnlyTools() {
|
|
124929
|
+
const tools = {};
|
|
124930
|
+
for (const toolName of READ_ONLY_TOOL_DENYLIST) {
|
|
124931
|
+
tools[toolName] = false;
|
|
124932
|
+
}
|
|
124933
|
+
tools.write = false;
|
|
124934
|
+
tools.edit = false;
|
|
124935
|
+
tools.patch = false;
|
|
124936
|
+
return tools;
|
|
124937
|
+
}
|
|
124938
|
+
function boundLaneOutput(output) {
|
|
124939
|
+
if (output.length <= MAX_LANE_OUTPUT_CHARS) {
|
|
124940
|
+
return {
|
|
124941
|
+
output,
|
|
124942
|
+
output_chars: output.length,
|
|
124943
|
+
output_truncated: false
|
|
124944
|
+
};
|
|
124945
|
+
}
|
|
124946
|
+
const omitted = output.length - MAX_LANE_OUTPUT_CHARS;
|
|
124947
|
+
const suffix = `
|
|
124948
|
+
[... ${omitted} chars truncated by dispatch_lanes ...]`;
|
|
124949
|
+
const maxContent = Math.max(0, MAX_LANE_OUTPUT_CHARS - suffix.length);
|
|
124950
|
+
return {
|
|
124951
|
+
output: `${output.slice(0, maxContent)}${suffix}`,
|
|
124952
|
+
output_chars: output.length,
|
|
124953
|
+
output_truncated: true
|
|
124954
|
+
};
|
|
124955
|
+
}
|
|
124956
|
+
function failureResult(args2) {
|
|
124957
|
+
return {
|
|
124958
|
+
success: false,
|
|
124959
|
+
failure_class: args2.failure_class,
|
|
124960
|
+
message: args2.message,
|
|
124961
|
+
dispatched: 0,
|
|
124962
|
+
completed: 0,
|
|
124963
|
+
failed: 0,
|
|
124964
|
+
rejected: 0,
|
|
124965
|
+
max_concurrent: 0,
|
|
124966
|
+
timeout_ms: 0,
|
|
124967
|
+
lane_results: [],
|
|
124968
|
+
errors: args2.errors
|
|
124969
|
+
};
|
|
124970
|
+
}
|
|
124971
|
+
function findDuplicateLaneIds(lanes) {
|
|
124972
|
+
const seen = new Set;
|
|
124973
|
+
const duplicates = new Set;
|
|
124974
|
+
for (const lane of lanes) {
|
|
124975
|
+
if (seen.has(lane.id))
|
|
124976
|
+
duplicates.add(lane.id);
|
|
124977
|
+
seen.add(lane.id);
|
|
124978
|
+
}
|
|
124979
|
+
return [...duplicates];
|
|
124980
|
+
}
|
|
124981
|
+
function scheduleSessionCleanup(session, sessionId) {
|
|
124982
|
+
session.delete({ path: { id: sessionId } }).catch(() => {
|
|
124983
|
+
return;
|
|
124984
|
+
});
|
|
124985
|
+
}
|
|
124986
|
+
async function withTimeout2(promise3, timeoutMs, message) {
|
|
124987
|
+
let timeout;
|
|
124988
|
+
try {
|
|
124989
|
+
return await Promise.race([
|
|
124990
|
+
promise3,
|
|
124991
|
+
new Promise((_, reject) => {
|
|
124992
|
+
timeout = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
124993
|
+
})
|
|
124994
|
+
]);
|
|
124995
|
+
} finally {
|
|
124996
|
+
if (timeout)
|
|
124997
|
+
clearTimeout(timeout);
|
|
124998
|
+
}
|
|
124999
|
+
}
|
|
125000
|
+
function extractText3(parts2) {
|
|
125001
|
+
if (!Array.isArray(parts2))
|
|
125002
|
+
return "";
|
|
125003
|
+
return parts2.filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
|
|
125004
|
+
`);
|
|
125005
|
+
}
|
|
125006
|
+
function formatError3(error93) {
|
|
125007
|
+
if (error93 instanceof Error)
|
|
125008
|
+
return error93.message;
|
|
125009
|
+
const text = typeof error93 === "string" ? error93 : String(error93);
|
|
125010
|
+
return boundErrorString(text);
|
|
125011
|
+
}
|
|
125012
|
+
function boundErrorString(text) {
|
|
125013
|
+
if (text.length <= MAX_ERROR_CHARS)
|
|
125014
|
+
return text;
|
|
125015
|
+
return `${text.slice(0, MAX_ERROR_CHARS)}${ERROR_TRUNCATION_SUFFIX}`;
|
|
125016
|
+
}
|
|
125017
|
+
function isoNow() {
|
|
125018
|
+
return new Date(_internals79.now()).toISOString();
|
|
125019
|
+
}
|
|
125020
|
+
var dispatch_lanes = createSwarmTool({
|
|
125021
|
+
description: "Dispatch multiple read-only exploration/review lanes concurrently through OpenCode sessions and return a structured join result.",
|
|
125022
|
+
args: {
|
|
125023
|
+
lanes: DispatchLanesArgsSchema.shape.lanes,
|
|
125024
|
+
max_concurrent: DispatchLanesArgsSchema.shape.max_concurrent,
|
|
125025
|
+
timeout_ms: DispatchLanesArgsSchema.shape.timeout_ms
|
|
125026
|
+
},
|
|
125027
|
+
execute: async (args2, directory, ctx) => {
|
|
125028
|
+
const result = await executeDispatchLanes(args2, directory, {
|
|
125029
|
+
callerAgent: getContextAgent(ctx)
|
|
125030
|
+
});
|
|
125031
|
+
return JSON.stringify(result, null, 2);
|
|
125032
|
+
}
|
|
125033
|
+
});
|
|
125034
|
+
function getContextAgent(ctx) {
|
|
125035
|
+
if (!ctx || typeof ctx !== "object")
|
|
125036
|
+
return;
|
|
125037
|
+
const value = ctx.agent;
|
|
125038
|
+
return typeof value === "string" ? value : undefined;
|
|
125039
|
+
}
|
|
125040
|
+
|
|
124449
125041
|
// src/tools/manifest.ts
|
|
124450
125042
|
init_doc_scan();
|
|
124451
125043
|
|
|
@@ -124886,7 +125478,7 @@ function candidateFilePath(storePath3, id) {
|
|
|
124886
125478
|
}
|
|
124887
125479
|
return path146.join(storePath3, `${id}.json`);
|
|
124888
125480
|
}
|
|
124889
|
-
var
|
|
125481
|
+
var _internals80 = {
|
|
124890
125482
|
randomUUID: crypto11.randomUUID.bind(crypto11),
|
|
124891
125483
|
fs: {
|
|
124892
125484
|
mkdir: fs93.mkdir,
|
|
@@ -124899,11 +125491,11 @@ var _internals79 = {
|
|
|
124899
125491
|
function createExternalSkillStore(directory, config3) {
|
|
124900
125492
|
const storePath3 = path146.join(directory, ".swarm", "skills", "candidates");
|
|
124901
125493
|
async function add2(candidate) {
|
|
124902
|
-
const id =
|
|
125494
|
+
const id = _internals80.randomUUID();
|
|
124903
125495
|
const full = { ...candidate, id };
|
|
124904
125496
|
const filePath = path146.join(storePath3, `${id}.json`);
|
|
124905
|
-
await
|
|
124906
|
-
await
|
|
125497
|
+
await _internals80.fs.mkdir(storePath3, { recursive: true });
|
|
125498
|
+
await _internals80.atomicWriteFile(filePath, JSON.stringify(full, null, "\t"));
|
|
124907
125499
|
return full;
|
|
124908
125500
|
}
|
|
124909
125501
|
async function get2(id) {
|
|
@@ -124913,7 +125505,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
124913
125505
|
}
|
|
124914
125506
|
let raw;
|
|
124915
125507
|
try {
|
|
124916
|
-
raw = await
|
|
125508
|
+
raw = await _internals80.fs.readFile(filePath, "utf-8");
|
|
124917
125509
|
} catch (err2) {
|
|
124918
125510
|
if (err2.code === "ENOENT") {
|
|
124919
125511
|
return null;
|
|
@@ -124929,7 +125521,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
124929
125521
|
async function list(filter) {
|
|
124930
125522
|
let entries;
|
|
124931
125523
|
try {
|
|
124932
|
-
entries = await
|
|
125524
|
+
entries = await _internals80.fs.readdir(storePath3);
|
|
124933
125525
|
} catch (err2) {
|
|
124934
125526
|
if (err2.code === "ENOENT") {
|
|
124935
125527
|
return [];
|
|
@@ -124944,7 +125536,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
124944
125536
|
const filePath = path146.join(storePath3, entry);
|
|
124945
125537
|
let raw;
|
|
124946
125538
|
try {
|
|
124947
|
-
raw = await
|
|
125539
|
+
raw = await _internals80.fs.readFile(filePath, "utf-8");
|
|
124948
125540
|
} catch {
|
|
124949
125541
|
continue;
|
|
124950
125542
|
}
|
|
@@ -125011,7 +125603,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
125011
125603
|
...patch.evaluation_history
|
|
125012
125604
|
];
|
|
125013
125605
|
}
|
|
125014
|
-
await
|
|
125606
|
+
await _internals80.atomicWriteFile(filePath, JSON.stringify(updated, null, "\t"));
|
|
125015
125607
|
return updated;
|
|
125016
125608
|
}
|
|
125017
125609
|
async function deleteCandidate(id) {
|
|
@@ -125020,7 +125612,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
125020
125612
|
return false;
|
|
125021
125613
|
}
|
|
125022
125614
|
try {
|
|
125023
|
-
await
|
|
125615
|
+
await _internals80.fs.unlink(filePath);
|
|
125024
125616
|
return true;
|
|
125025
125617
|
} catch (err2) {
|
|
125026
125618
|
if (err2.code === "ENOENT") {
|
|
@@ -125058,7 +125650,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
125058
125650
|
|
|
125059
125651
|
// src/tools/external-skill-delete.ts
|
|
125060
125652
|
init_create_tool();
|
|
125061
|
-
var
|
|
125653
|
+
var _internals81 = {
|
|
125062
125654
|
loadConfig: (directory) => {
|
|
125063
125655
|
const pluginConfig = loadPluginConfig(directory);
|
|
125064
125656
|
return pluginConfig.external_skills;
|
|
@@ -125080,7 +125672,7 @@ var external_skill_delete = createSwarmTool({
|
|
|
125080
125672
|
} catch {}
|
|
125081
125673
|
let config3;
|
|
125082
125674
|
try {
|
|
125083
|
-
config3 =
|
|
125675
|
+
config3 = _internals81.loadConfig(directory);
|
|
125084
125676
|
} catch {
|
|
125085
125677
|
return JSON.stringify({
|
|
125086
125678
|
success: false,
|
|
@@ -125548,7 +126140,7 @@ function scanProvenanceIntegrity(candidate, trustLevel = "low", ttlDays) {
|
|
|
125548
126140
|
});
|
|
125549
126141
|
}
|
|
125550
126142
|
fieldsScanned.push("fetched_at");
|
|
125551
|
-
const now = new Date(
|
|
126143
|
+
const now = new Date(_internals82.getTimestamp()).getTime();
|
|
125552
126144
|
const fetchedAtMs = new Date(candidate.fetched_at).getTime();
|
|
125553
126145
|
if (Number.isNaN(fetchedAtMs)) {
|
|
125554
126146
|
findings.push({
|
|
@@ -125612,7 +126204,7 @@ function scanProvenanceIntegrity(candidate, trustLevel = "low", ttlDays) {
|
|
|
125612
126204
|
});
|
|
125613
126205
|
}
|
|
125614
126206
|
fieldsScanned.push("skill_body");
|
|
125615
|
-
const computedHash =
|
|
126207
|
+
const computedHash = _internals82.computeSha256(candidate.skill_body);
|
|
125616
126208
|
if (computedHash !== candidate.sha256) {
|
|
125617
126209
|
findings.push({
|
|
125618
126210
|
pattern: "content_hash_mismatch",
|
|
@@ -125662,7 +126254,7 @@ function evaluateCandidate(candidate, options) {
|
|
|
125662
126254
|
risk_flags: riskFlags
|
|
125663
126255
|
};
|
|
125664
126256
|
}
|
|
125665
|
-
var
|
|
126257
|
+
var _internals82 = {
|
|
125666
126258
|
getTimestamp: () => new Date().toISOString(),
|
|
125667
126259
|
computeSha256: (content) => createHash14("sha256").update(content).digest("hex"),
|
|
125668
126260
|
stripMarkdownCodeForUnsafeScan
|
|
@@ -125670,7 +126262,7 @@ var _internals81 = {
|
|
|
125670
126262
|
|
|
125671
126263
|
// src/tools/external-skill-discover.ts
|
|
125672
126264
|
init_create_tool();
|
|
125673
|
-
var
|
|
126265
|
+
var _internals83 = {
|
|
125674
126266
|
fetchContent: async (_url3, _timeoutMs) => {
|
|
125675
126267
|
const parsed = new URL(_url3);
|
|
125676
126268
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
@@ -125831,7 +126423,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
125831
126423
|
resolvedContent = content;
|
|
125832
126424
|
} else {
|
|
125833
126425
|
try {
|
|
125834
|
-
const fetched = await
|
|
126426
|
+
const fetched = await _internals83.fetchContent(resolvedUrl, config3.fetch_timeout_ms);
|
|
125835
126427
|
if (fetched.finalUrl !== resolvedUrl && matchedSource && !isSubpathUrl(fetched.finalUrl, matchedSource.location)) {
|
|
125836
126428
|
return JSON.stringify({
|
|
125837
126429
|
success: false,
|
|
@@ -125853,14 +126445,14 @@ var external_skill_discover = createSwarmTool({
|
|
|
125853
126445
|
error: `Content too large: ${resolvedContent.length} bytes exceeds max_bytes_per_candidate (${config3.max_bytes_per_candidate})`
|
|
125854
126446
|
});
|
|
125855
126447
|
}
|
|
125856
|
-
const sha256 =
|
|
126448
|
+
const sha256 = _internals83.computeSha256(resolvedContent);
|
|
125857
126449
|
const candidate = {
|
|
125858
|
-
id:
|
|
126450
|
+
id: _internals83.uuid(),
|
|
125859
126451
|
source_url: resolvedUrl,
|
|
125860
126452
|
source_type: sourceType,
|
|
125861
126453
|
publisher,
|
|
125862
126454
|
sha256,
|
|
125863
|
-
fetched_at:
|
|
126455
|
+
fetched_at: _internals83.getTimestamp(),
|
|
125864
126456
|
skill_name: typeof skillName === "string" ? skillName : undefined,
|
|
125865
126457
|
skill_description: typeof skillDescription === "string" ? skillDescription : undefined,
|
|
125866
126458
|
skill_body: resolvedContent,
|
|
@@ -125878,7 +126470,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
125878
126470
|
candidate.evaluation_history = [
|
|
125879
126471
|
{
|
|
125880
126472
|
verdict: result.overall_verdict,
|
|
125881
|
-
timestamp:
|
|
126473
|
+
timestamp: _internals83.getTimestamp(),
|
|
125882
126474
|
actor: "system",
|
|
125883
126475
|
reason: `Validation: ${result.gate_results.length} gates, ${result.all_findings.length} findings`,
|
|
125884
126476
|
gate_results: result.gate_results.map((gr) => ({
|
|
@@ -125923,7 +126515,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
125923
126515
|
init_zod();
|
|
125924
126516
|
init_loader();
|
|
125925
126517
|
init_create_tool();
|
|
125926
|
-
var
|
|
126518
|
+
var _internals84 = {
|
|
125927
126519
|
loadConfig: (directory) => {
|
|
125928
126520
|
const pluginConfig = loadPluginConfig(directory);
|
|
125929
126521
|
return pluginConfig.external_skills;
|
|
@@ -125945,7 +126537,7 @@ var external_skill_inspect = createSwarmTool({
|
|
|
125945
126537
|
} catch {}
|
|
125946
126538
|
let config3;
|
|
125947
126539
|
try {
|
|
125948
|
-
config3 =
|
|
126540
|
+
config3 = _internals84.loadConfig(directory);
|
|
125949
126541
|
} catch {
|
|
125950
126542
|
return JSON.stringify({
|
|
125951
126543
|
success: false,
|
|
@@ -125987,7 +126579,7 @@ var external_skill_inspect = createSwarmTool({
|
|
|
125987
126579
|
init_zod();
|
|
125988
126580
|
init_loader();
|
|
125989
126581
|
init_create_tool();
|
|
125990
|
-
var
|
|
126582
|
+
var _internals85 = {
|
|
125991
126583
|
loadConfig: (directory) => {
|
|
125992
126584
|
const pluginConfig = loadPluginConfig(directory);
|
|
125993
126585
|
return pluginConfig.external_skills;
|
|
@@ -126023,7 +126615,7 @@ var external_skill_list = createSwarmTool({
|
|
|
126023
126615
|
} catch {}
|
|
126024
126616
|
let config3;
|
|
126025
126617
|
try {
|
|
126026
|
-
config3 =
|
|
126618
|
+
config3 = _internals85.loadConfig(directory);
|
|
126027
126619
|
} catch {
|
|
126028
126620
|
return JSON.stringify({
|
|
126029
126621
|
success: false,
|
|
@@ -126076,7 +126668,7 @@ import { createHash as createHash16 } from "node:crypto";
|
|
|
126076
126668
|
import * as fs94 from "node:fs/promises";
|
|
126077
126669
|
import * as path147 from "node:path";
|
|
126078
126670
|
init_create_tool();
|
|
126079
|
-
var
|
|
126671
|
+
var _internals86 = {
|
|
126080
126672
|
loadConfig: (directory) => {
|
|
126081
126673
|
const pluginConfig = loadPluginConfig(directory);
|
|
126082
126674
|
return pluginConfig.external_skills;
|
|
@@ -126146,7 +126738,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
126146
126738
|
} catch {}
|
|
126147
126739
|
let config3;
|
|
126148
126740
|
try {
|
|
126149
|
-
config3 =
|
|
126741
|
+
config3 = _internals86.loadConfig(directory);
|
|
126150
126742
|
} catch {
|
|
126151
126743
|
return JSON.stringify({
|
|
126152
126744
|
success: false,
|
|
@@ -126216,8 +126808,8 @@ var external_skill_promote = createSwarmTool({
|
|
|
126216
126808
|
}
|
|
126217
126809
|
const targetDir = path147.join(directory, ".opencode", "skills", "generated", sanitizedSlug);
|
|
126218
126810
|
const targetPath = path147.join(targetDir, "SKILL.md");
|
|
126219
|
-
const timestamp =
|
|
126220
|
-
const alreadyExists = await
|
|
126811
|
+
const timestamp = _internals86.getTimestamp();
|
|
126812
|
+
const alreadyExists = await _internals86.fileExists(targetPath);
|
|
126221
126813
|
if (alreadyExists) {
|
|
126222
126814
|
return JSON.stringify({
|
|
126223
126815
|
success: false,
|
|
@@ -126226,7 +126818,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
126226
126818
|
}
|
|
126227
126819
|
const skillMarkdown = buildSkillMarkdown(candidate, sanitizedSlug, timestamp);
|
|
126228
126820
|
try {
|
|
126229
|
-
await
|
|
126821
|
+
await _internals86.writeSkillFile(targetPath, skillMarkdown);
|
|
126230
126822
|
} catch (writeErr) {
|
|
126231
126823
|
const writeError = writeErr;
|
|
126232
126824
|
if (writeError?.code === "EEXIST") {
|
|
@@ -126303,7 +126895,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
126303
126895
|
init_zod();
|
|
126304
126896
|
init_loader();
|
|
126305
126897
|
init_create_tool();
|
|
126306
|
-
var
|
|
126898
|
+
var _internals87 = {
|
|
126307
126899
|
loadConfig: (directory) => {
|
|
126308
126900
|
const pluginConfig = loadPluginConfig(directory);
|
|
126309
126901
|
return pluginConfig.external_skills;
|
|
@@ -126328,7 +126920,7 @@ var external_skill_reject = createSwarmTool({
|
|
|
126328
126920
|
} catch {}
|
|
126329
126921
|
let config3;
|
|
126330
126922
|
try {
|
|
126331
|
-
config3 =
|
|
126923
|
+
config3 = _internals87.loadConfig(directory);
|
|
126332
126924
|
} catch {
|
|
126333
126925
|
return JSON.stringify({
|
|
126334
126926
|
success: false,
|
|
@@ -126391,7 +126983,7 @@ init_zod();
|
|
|
126391
126983
|
init_loader();
|
|
126392
126984
|
import * as path148 from "node:path";
|
|
126393
126985
|
init_create_tool();
|
|
126394
|
-
var
|
|
126986
|
+
var _internals88 = {
|
|
126395
126987
|
loadConfig: (directory) => {
|
|
126396
126988
|
const pluginConfig = loadPluginConfig(directory);
|
|
126397
126989
|
return pluginConfig.external_skills;
|
|
@@ -126442,7 +127034,7 @@ var external_skill_revoke = createSwarmTool({
|
|
|
126442
127034
|
} catch {}
|
|
126443
127035
|
let config3;
|
|
126444
127036
|
try {
|
|
126445
|
-
config3 =
|
|
127037
|
+
config3 = _internals88.loadConfig(directory);
|
|
126446
127038
|
} catch {
|
|
126447
127039
|
return JSON.stringify({
|
|
126448
127040
|
success: false,
|
|
@@ -126489,8 +127081,8 @@ var external_skill_revoke = createSwarmTool({
|
|
|
126489
127081
|
});
|
|
126490
127082
|
}
|
|
126491
127083
|
const skillPath = path148.join(directory, ".opencode", "skills", "generated", slug, "SKILL.md");
|
|
126492
|
-
const skillFileRemoved = await
|
|
126493
|
-
const timestamp =
|
|
127084
|
+
const skillFileRemoved = await _internals88.retireSkillFile(skillPath);
|
|
127085
|
+
const timestamp = _internals88.getTimestamp();
|
|
126494
127086
|
const historyEntry = {
|
|
126495
127087
|
verdict: "revoked",
|
|
126496
127088
|
timestamp,
|
|
@@ -130059,7 +130651,7 @@ ${fileList}
|
|
|
130059
130651
|
async _withStateLock(fn2) {
|
|
130060
130652
|
const timeoutMs = 1e4;
|
|
130061
130653
|
let timeoutId;
|
|
130062
|
-
const
|
|
130654
|
+
const withTimeout3 = new Promise((_resolve, reject) => {
|
|
130063
130655
|
timeoutId = setTimeout(() => {
|
|
130064
130656
|
reject(new Error(`_withStateLock timed out after ${timeoutMs}ms — state update will not block subsequent operations`));
|
|
130065
130657
|
}, timeoutMs);
|
|
@@ -130068,7 +130660,7 @@ ${fileList}
|
|
|
130068
130660
|
if (timeoutId)
|
|
130069
130661
|
clearTimeout(timeoutId);
|
|
130070
130662
|
});
|
|
130071
|
-
const promise3 = Promise.race([chain,
|
|
130663
|
+
const promise3 = Promise.race([chain, withTimeout3]).finally(() => {
|
|
130072
130664
|
if (timeoutId)
|
|
130073
130665
|
clearTimeout(timeoutId);
|
|
130074
130666
|
});
|
|
@@ -130148,7 +130740,7 @@ ${fileList}
|
|
|
130148
130740
|
|
|
130149
130741
|
// src/tools/lean-turbo-run-phase.ts
|
|
130150
130742
|
init_create_tool();
|
|
130151
|
-
var
|
|
130743
|
+
var _internals89 = {
|
|
130152
130744
|
LeanTurboRunner,
|
|
130153
130745
|
loadPluginConfigWithMeta
|
|
130154
130746
|
};
|
|
@@ -130158,9 +130750,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
130158
130750
|
let runError = null;
|
|
130159
130751
|
let runner = null;
|
|
130160
130752
|
try {
|
|
130161
|
-
const { config: config3 } =
|
|
130753
|
+
const { config: config3 } = _internals89.loadPluginConfigWithMeta(directory);
|
|
130162
130754
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
130163
|
-
runner = new
|
|
130755
|
+
runner = new _internals89.LeanTurboRunner({
|
|
130164
130756
|
directory,
|
|
130165
130757
|
sessionID,
|
|
130166
130758
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -130496,7 +131088,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
130496
131088
|
const strippedMutated = stripCode(mutatedCode);
|
|
130497
131089
|
return strippedOriginal === strippedMutated;
|
|
130498
131090
|
}
|
|
130499
|
-
var
|
|
131091
|
+
var _internals90 = {
|
|
130500
131092
|
isStaticallyEquivalent,
|
|
130501
131093
|
checkEquivalence,
|
|
130502
131094
|
batchCheckEquivalence
|
|
@@ -130536,7 +131128,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
130536
131128
|
const results = [];
|
|
130537
131129
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
130538
131130
|
try {
|
|
130539
|
-
const result = await
|
|
131131
|
+
const result = await _internals90.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
130540
131132
|
results.push(result);
|
|
130541
131133
|
} catch (err2) {
|
|
130542
131134
|
results.push({
|
|
@@ -130596,7 +131188,7 @@ function validateTestCommand(testCommand) {
|
|
|
130596
131188
|
var MUTATION_TIMEOUT_MS = 30000;
|
|
130597
131189
|
var TOTAL_BUDGET_MS = 300000;
|
|
130598
131190
|
var GIT_APPLY_TIMEOUT_MS = 5000;
|
|
130599
|
-
var
|
|
131191
|
+
var _internals91 = {
|
|
130600
131192
|
executeMutation,
|
|
130601
131193
|
computeReport,
|
|
130602
131194
|
executeMutationSuite,
|
|
@@ -130628,7 +131220,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
130628
131220
|
};
|
|
130629
131221
|
}
|
|
130630
131222
|
try {
|
|
130631
|
-
const applyResult =
|
|
131223
|
+
const applyResult = _internals91.spawnSync("git", ["apply", "--", patchFile], {
|
|
130632
131224
|
cwd: workingDir,
|
|
130633
131225
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
130634
131226
|
stdio: "pipe"
|
|
@@ -130659,7 +131251,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
130659
131251
|
try {
|
|
130660
131252
|
const safeTestFiles = testFiles.filter((f) => !f.startsWith("-"));
|
|
130661
131253
|
const testArgs = safeTestFiles.length > 0 ? [...testCommand.slice(1), ...safeTestFiles] : testCommand.slice(1);
|
|
130662
|
-
const spawnResult =
|
|
131254
|
+
const spawnResult = _internals91.spawnSync(testCommand[0], testArgs, {
|
|
130663
131255
|
cwd: workingDir,
|
|
130664
131256
|
timeout: MUTATION_TIMEOUT_MS,
|
|
130665
131257
|
stdio: "pipe"
|
|
@@ -130692,7 +131284,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
130692
131284
|
} finally {
|
|
130693
131285
|
if (patchFile) {
|
|
130694
131286
|
try {
|
|
130695
|
-
const revertResult =
|
|
131287
|
+
const revertResult = _internals91.spawnSync("git", ["apply", "-R", "--", patchFile], {
|
|
130696
131288
|
cwd: workingDir,
|
|
130697
131289
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
130698
131290
|
stdio: "pipe"
|
|
@@ -130889,7 +131481,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
130889
131481
|
}
|
|
130890
131482
|
|
|
130891
131483
|
// src/mutation/gate.ts
|
|
130892
|
-
var
|
|
131484
|
+
var _internals92 = {
|
|
130893
131485
|
evaluateMutationGate,
|
|
130894
131486
|
buildTestImprovementPrompt,
|
|
130895
131487
|
buildMessage
|
|
@@ -130910,8 +131502,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
130910
131502
|
} else {
|
|
130911
131503
|
verdict = "fail";
|
|
130912
131504
|
}
|
|
130913
|
-
const testImprovementPrompt =
|
|
130914
|
-
const message =
|
|
131505
|
+
const testImprovementPrompt = _internals92.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
131506
|
+
const message = _internals92.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
130915
131507
|
return {
|
|
130916
131508
|
verdict,
|
|
130917
131509
|
killRate: report.killRate,
|
|
@@ -131428,7 +132020,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
131428
132020
|
}
|
|
131429
132021
|
return laneIds;
|
|
131430
132022
|
}
|
|
131431
|
-
var
|
|
132023
|
+
var _internals93 = {
|
|
131432
132024
|
listActiveLocks,
|
|
131433
132025
|
readPersisted: readPersisted2,
|
|
131434
132026
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -131489,7 +132081,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131489
132081
|
reason: "Lean Turbo state unreadable or missing"
|
|
131490
132082
|
};
|
|
131491
132083
|
}
|
|
131492
|
-
const persisted =
|
|
132084
|
+
const persisted = _internals93.readPersisted(directory);
|
|
131493
132085
|
if (!persisted) {
|
|
131494
132086
|
return {
|
|
131495
132087
|
ok: false,
|
|
@@ -131553,7 +132145,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131553
132145
|
}
|
|
131554
132146
|
}
|
|
131555
132147
|
if (runState.lanes.length > 0) {
|
|
131556
|
-
const evidenceLaneIds = new Set(
|
|
132148
|
+
const evidenceLaneIds = new Set(_internals93.listLaneEvidenceSync(directory, phase));
|
|
131557
132149
|
for (const lane of runState.lanes) {
|
|
131558
132150
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
131559
132151
|
return {
|
|
@@ -131563,7 +132155,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131563
132155
|
}
|
|
131564
132156
|
}
|
|
131565
132157
|
}
|
|
131566
|
-
const activeLocks =
|
|
132158
|
+
const activeLocks = _internals93.listActiveLocks(directory);
|
|
131567
132159
|
const phaseLaneIds = new Set(laneIds);
|
|
131568
132160
|
for (const lock of activeLocks) {
|
|
131569
132161
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -131583,7 +132175,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131583
132175
|
}
|
|
131584
132176
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
131585
132177
|
if (serialDegradedTasks.length > 0) {
|
|
131586
|
-
const plan =
|
|
132178
|
+
const plan = _internals93.readPlanJson(directory);
|
|
131587
132179
|
if (!plan) {
|
|
131588
132180
|
return {
|
|
131589
132181
|
ok: false,
|
|
@@ -131627,7 +132219,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131627
132219
|
}
|
|
131628
132220
|
const serializedTasks = runState.serializedTasks;
|
|
131629
132221
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
131630
|
-
const plan =
|
|
132222
|
+
const plan = _internals93.readPlanJson(directory);
|
|
131631
132223
|
if (!plan) {
|
|
131632
132224
|
return {
|
|
131633
132225
|
ok: false,
|
|
@@ -131686,7 +132278,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131686
132278
|
}
|
|
131687
132279
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
131688
132280
|
if (!reviewerVerdict) {
|
|
131689
|
-
const evidence =
|
|
132281
|
+
const evidence = _internals93.readReviewerEvidence(directory, phase);
|
|
131690
132282
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
131691
132283
|
}
|
|
131692
132284
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -131699,7 +132291,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
131699
132291
|
}
|
|
131700
132292
|
let criticVerdict = runState.lastCriticVerdict;
|
|
131701
132293
|
if (!criticVerdict) {
|
|
131702
|
-
const evidence =
|
|
132294
|
+
const evidence = _internals93.readCriticEvidence(directory, phase);
|
|
131703
132295
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
131704
132296
|
}
|
|
131705
132297
|
if (mergedConfig.phase_critic) {
|
|
@@ -132856,7 +133448,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
132856
133448
|
phase_critic: leanConfig.phase_critic,
|
|
132857
133449
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
132858
133450
|
} : undefined;
|
|
132859
|
-
const leanCheck =
|
|
133451
|
+
const leanCheck = _internals93.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
132860
133452
|
if (!leanCheck.ok) {
|
|
132861
133453
|
return JSON.stringify({
|
|
132862
133454
|
success: false,
|
|
@@ -135081,164 +135673,6 @@ var placeholder_scan = createSwarmTool({
|
|
|
135081
135673
|
// src/tools/pre-check-batch.ts
|
|
135082
135674
|
import * as fs116 from "node:fs";
|
|
135083
135675
|
import * as path171 from "node:path";
|
|
135084
|
-
|
|
135085
|
-
// node_modules/yocto-queue/index.js
|
|
135086
|
-
class Node2 {
|
|
135087
|
-
value;
|
|
135088
|
-
next;
|
|
135089
|
-
constructor(value) {
|
|
135090
|
-
this.value = value;
|
|
135091
|
-
}
|
|
135092
|
-
}
|
|
135093
|
-
|
|
135094
|
-
class Queue {
|
|
135095
|
-
#head;
|
|
135096
|
-
#tail;
|
|
135097
|
-
#size;
|
|
135098
|
-
constructor() {
|
|
135099
|
-
this.clear();
|
|
135100
|
-
}
|
|
135101
|
-
enqueue(value) {
|
|
135102
|
-
const node = new Node2(value);
|
|
135103
|
-
if (this.#head) {
|
|
135104
|
-
this.#tail.next = node;
|
|
135105
|
-
this.#tail = node;
|
|
135106
|
-
} else {
|
|
135107
|
-
this.#head = node;
|
|
135108
|
-
this.#tail = node;
|
|
135109
|
-
}
|
|
135110
|
-
this.#size++;
|
|
135111
|
-
}
|
|
135112
|
-
dequeue() {
|
|
135113
|
-
const current = this.#head;
|
|
135114
|
-
if (!current) {
|
|
135115
|
-
return;
|
|
135116
|
-
}
|
|
135117
|
-
this.#head = this.#head.next;
|
|
135118
|
-
this.#size--;
|
|
135119
|
-
if (!this.#head) {
|
|
135120
|
-
this.#tail = undefined;
|
|
135121
|
-
}
|
|
135122
|
-
return current.value;
|
|
135123
|
-
}
|
|
135124
|
-
peek() {
|
|
135125
|
-
if (!this.#head) {
|
|
135126
|
-
return;
|
|
135127
|
-
}
|
|
135128
|
-
return this.#head.value;
|
|
135129
|
-
}
|
|
135130
|
-
clear() {
|
|
135131
|
-
this.#head = undefined;
|
|
135132
|
-
this.#tail = undefined;
|
|
135133
|
-
this.#size = 0;
|
|
135134
|
-
}
|
|
135135
|
-
get size() {
|
|
135136
|
-
return this.#size;
|
|
135137
|
-
}
|
|
135138
|
-
*[Symbol.iterator]() {
|
|
135139
|
-
let current = this.#head;
|
|
135140
|
-
while (current) {
|
|
135141
|
-
yield current.value;
|
|
135142
|
-
current = current.next;
|
|
135143
|
-
}
|
|
135144
|
-
}
|
|
135145
|
-
*drain() {
|
|
135146
|
-
while (this.#head) {
|
|
135147
|
-
yield this.dequeue();
|
|
135148
|
-
}
|
|
135149
|
-
}
|
|
135150
|
-
}
|
|
135151
|
-
|
|
135152
|
-
// node_modules/p-limit/index.js
|
|
135153
|
-
function pLimit(concurrency) {
|
|
135154
|
-
let rejectOnClear = false;
|
|
135155
|
-
if (typeof concurrency === "object") {
|
|
135156
|
-
({ concurrency, rejectOnClear = false } = concurrency);
|
|
135157
|
-
}
|
|
135158
|
-
validateConcurrency(concurrency);
|
|
135159
|
-
if (typeof rejectOnClear !== "boolean") {
|
|
135160
|
-
throw new TypeError("Expected `rejectOnClear` to be a boolean");
|
|
135161
|
-
}
|
|
135162
|
-
const queue = new Queue;
|
|
135163
|
-
let activeCount = 0;
|
|
135164
|
-
const resumeNext = () => {
|
|
135165
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
135166
|
-
activeCount++;
|
|
135167
|
-
queue.dequeue().run();
|
|
135168
|
-
}
|
|
135169
|
-
};
|
|
135170
|
-
const next = () => {
|
|
135171
|
-
activeCount--;
|
|
135172
|
-
resumeNext();
|
|
135173
|
-
};
|
|
135174
|
-
const run2 = async (function_, resolve61, arguments_2) => {
|
|
135175
|
-
const result = (async () => function_(...arguments_2))();
|
|
135176
|
-
resolve61(result);
|
|
135177
|
-
try {
|
|
135178
|
-
await result;
|
|
135179
|
-
} catch {}
|
|
135180
|
-
next();
|
|
135181
|
-
};
|
|
135182
|
-
const enqueue = (function_, resolve61, reject, arguments_2) => {
|
|
135183
|
-
const queueItem = { reject };
|
|
135184
|
-
new Promise((internalResolve) => {
|
|
135185
|
-
queueItem.run = internalResolve;
|
|
135186
|
-
queue.enqueue(queueItem);
|
|
135187
|
-
}).then(run2.bind(undefined, function_, resolve61, arguments_2));
|
|
135188
|
-
if (activeCount < concurrency) {
|
|
135189
|
-
resumeNext();
|
|
135190
|
-
}
|
|
135191
|
-
};
|
|
135192
|
-
const generator = (function_, ...arguments_2) => new Promise((resolve61, reject) => {
|
|
135193
|
-
enqueue(function_, resolve61, reject, arguments_2);
|
|
135194
|
-
});
|
|
135195
|
-
Object.defineProperties(generator, {
|
|
135196
|
-
activeCount: {
|
|
135197
|
-
get: () => activeCount
|
|
135198
|
-
},
|
|
135199
|
-
pendingCount: {
|
|
135200
|
-
get: () => queue.size
|
|
135201
|
-
},
|
|
135202
|
-
clearQueue: {
|
|
135203
|
-
value() {
|
|
135204
|
-
if (!rejectOnClear) {
|
|
135205
|
-
queue.clear();
|
|
135206
|
-
return;
|
|
135207
|
-
}
|
|
135208
|
-
const abortError = AbortSignal.abort().reason;
|
|
135209
|
-
while (queue.size > 0) {
|
|
135210
|
-
queue.dequeue().reject(abortError);
|
|
135211
|
-
}
|
|
135212
|
-
}
|
|
135213
|
-
},
|
|
135214
|
-
concurrency: {
|
|
135215
|
-
get: () => concurrency,
|
|
135216
|
-
set(newConcurrency) {
|
|
135217
|
-
validateConcurrency(newConcurrency);
|
|
135218
|
-
concurrency = newConcurrency;
|
|
135219
|
-
queueMicrotask(() => {
|
|
135220
|
-
while (activeCount < concurrency && queue.size > 0) {
|
|
135221
|
-
resumeNext();
|
|
135222
|
-
}
|
|
135223
|
-
});
|
|
135224
|
-
}
|
|
135225
|
-
},
|
|
135226
|
-
map: {
|
|
135227
|
-
async value(iterable, function_) {
|
|
135228
|
-
const promises11 = Array.from(iterable, (value, index) => this(function_, value, index));
|
|
135229
|
-
return Promise.all(promises11);
|
|
135230
|
-
}
|
|
135231
|
-
}
|
|
135232
|
-
});
|
|
135233
|
-
return generator;
|
|
135234
|
-
}
|
|
135235
|
-
function validateConcurrency(concurrency) {
|
|
135236
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
135237
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
135238
|
-
}
|
|
135239
|
-
}
|
|
135240
|
-
|
|
135241
|
-
// src/tools/pre-check-batch.ts
|
|
135242
135676
|
init_zod();
|
|
135243
135677
|
init_manager2();
|
|
135244
135678
|
init_utils();
|
|
@@ -135366,11 +135800,11 @@ var quality_budget = createSwarmTool({
|
|
|
135366
135800
|
}).optional().describe("Quality budget thresholds")
|
|
135367
135801
|
},
|
|
135368
135802
|
async execute(args2, directory) {
|
|
135369
|
-
const result = await
|
|
135803
|
+
const result = await _internals95.qualityBudget(args2, directory);
|
|
135370
135804
|
return JSON.stringify(result);
|
|
135371
135805
|
}
|
|
135372
135806
|
});
|
|
135373
|
-
var
|
|
135807
|
+
var _internals95 = {
|
|
135374
135808
|
qualityBudget
|
|
135375
135809
|
};
|
|
135376
135810
|
|
|
@@ -136092,10 +136526,10 @@ import * as fs113 from "node:fs";
|
|
|
136092
136526
|
import * as path168 from "node:path";
|
|
136093
136527
|
var semgrepAvailableCache = null;
|
|
136094
136528
|
var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
136095
|
-
var
|
|
136529
|
+
var DEFAULT_TIMEOUT_MS4 = 30000;
|
|
136096
136530
|
var MAX_OUTPUT_BYTES8 = 10 * 1024 * 1024;
|
|
136097
136531
|
var KILL_GRACE_MS = 2000;
|
|
136098
|
-
var
|
|
136532
|
+
var _internals96 = {
|
|
136099
136533
|
isSemgrepAvailable,
|
|
136100
136534
|
checkSemgrepAvailable,
|
|
136101
136535
|
resetSemgrepCache,
|
|
@@ -136121,7 +136555,7 @@ function isSemgrepAvailable() {
|
|
|
136121
136555
|
}
|
|
136122
136556
|
}
|
|
136123
136557
|
async function checkSemgrepAvailable() {
|
|
136124
|
-
return
|
|
136558
|
+
return _internals96.isSemgrepAvailable();
|
|
136125
136559
|
}
|
|
136126
136560
|
function resetSemgrepCache() {
|
|
136127
136561
|
semgrepAvailableCache = null;
|
|
@@ -136275,15 +136709,15 @@ async function executeWithTimeout(command, args2, options) {
|
|
|
136275
136709
|
async function runSemgrep(options) {
|
|
136276
136710
|
const files = options.files || [];
|
|
136277
136711
|
const rulesDir = options.rulesDir || DEFAULT_RULES_DIR;
|
|
136278
|
-
const timeoutMs = options.timeoutMs ||
|
|
136712
|
+
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS4;
|
|
136279
136713
|
if (files.length === 0) {
|
|
136280
136714
|
return {
|
|
136281
|
-
available:
|
|
136715
|
+
available: _internals96.isSemgrepAvailable(),
|
|
136282
136716
|
findings: [],
|
|
136283
136717
|
engine: "tier_a"
|
|
136284
136718
|
};
|
|
136285
136719
|
}
|
|
136286
|
-
if (!
|
|
136720
|
+
if (!_internals96.isSemgrepAvailable()) {
|
|
136287
136721
|
return {
|
|
136288
136722
|
available: false,
|
|
136289
136723
|
findings: [],
|
|
@@ -136450,7 +136884,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
136450
136884
|
}
|
|
136451
136885
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
136452
136886
|
countMap.set(baseKey, occIdx + 1);
|
|
136453
|
-
const fp =
|
|
136887
|
+
const fp = _internals97.fingerprintFinding(finding, directory, occIdx);
|
|
136454
136888
|
return {
|
|
136455
136889
|
finding,
|
|
136456
136890
|
index: occIdx,
|
|
@@ -136519,7 +136953,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
136519
136953
|
}
|
|
136520
136954
|
} catch {}
|
|
136521
136955
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
136522
|
-
const indexed =
|
|
136956
|
+
const indexed = _internals97.assignOccurrenceIndices(findings, directory);
|
|
136523
136957
|
if (existing && !opts?.force) {
|
|
136524
136958
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
136525
136959
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -136659,7 +137093,7 @@ function loadBaseline(directory, phase) {
|
|
|
136659
137093
|
};
|
|
136660
137094
|
}
|
|
136661
137095
|
}
|
|
136662
|
-
var
|
|
137096
|
+
var _internals97 = {
|
|
136663
137097
|
fingerprintFinding,
|
|
136664
137098
|
assignOccurrenceIndices,
|
|
136665
137099
|
captureOrMergeBaseline,
|
|
@@ -137069,11 +137503,11 @@ var sast_scan = createSwarmTool({
|
|
|
137069
137503
|
capture_baseline: safeArgs.capture_baseline,
|
|
137070
137504
|
phase: safeArgs.phase
|
|
137071
137505
|
};
|
|
137072
|
-
const result = await
|
|
137506
|
+
const result = await _internals98.sastScan(input, directory);
|
|
137073
137507
|
return JSON.stringify(result, null, 2);
|
|
137074
137508
|
}
|
|
137075
137509
|
});
|
|
137076
|
-
var
|
|
137510
|
+
var _internals98 = {
|
|
137077
137511
|
sastScan,
|
|
137078
137512
|
sast_scan
|
|
137079
137513
|
};
|
|
@@ -141947,7 +142381,7 @@ init_schema3();
|
|
|
141947
142381
|
init_store();
|
|
141948
142382
|
init_create_tool();
|
|
141949
142383
|
init_resolve_working_directory();
|
|
141950
|
-
function
|
|
142384
|
+
function getContextAgent2(ctx) {
|
|
141951
142385
|
if (!ctx || typeof ctx !== "object")
|
|
141952
142386
|
return;
|
|
141953
142387
|
const value = ctx.agent;
|
|
@@ -142002,7 +142436,7 @@ var summarize_work = createSwarmTool({
|
|
|
142002
142436
|
}
|
|
142003
142437
|
const workingDir = dirResult.directory;
|
|
142004
142438
|
const sessionId = ctx?.sessionID ?? "unknown-session";
|
|
142005
|
-
const agent =
|
|
142439
|
+
const agent = getContextAgent2(ctx) ?? "unknown-agent";
|
|
142006
142440
|
let maxWords = MAX_AGENT_SUMMARY_WORDS;
|
|
142007
142441
|
try {
|
|
142008
142442
|
const config3 = loadPluginConfig(workingDir);
|
|
@@ -142108,7 +142542,7 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
142108
142542
|
evidenceRefs: exports_external.array(exports_external.string().min(1).max(500)).max(20).optional().describe("Evidence refs such as files, commits, test outputs, or URLs")
|
|
142109
142543
|
},
|
|
142110
142544
|
execute: async (args2, directory, ctx) => {
|
|
142111
|
-
const { config: config3 } =
|
|
142545
|
+
const { config: config3 } = _internals99.loadPluginConfigWithMeta(directory);
|
|
142112
142546
|
if (config3.memory?.enabled !== true) {
|
|
142113
142547
|
return JSON.stringify({
|
|
142114
142548
|
success: false,
|
|
@@ -142123,8 +142557,8 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
142123
142557
|
error: parsed.error.issues.map((issue3) => issue3.message).join("; ")
|
|
142124
142558
|
});
|
|
142125
142559
|
}
|
|
142126
|
-
const agent =
|
|
142127
|
-
const gateway =
|
|
142560
|
+
const agent = getContextAgent3(ctx);
|
|
142561
|
+
const gateway = _internals99.createMemoryGateway({
|
|
142128
142562
|
directory,
|
|
142129
142563
|
sessionID: ctx?.sessionID,
|
|
142130
142564
|
agentRole: agent,
|
|
@@ -142149,11 +142583,11 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
142149
142583
|
}
|
|
142150
142584
|
}
|
|
142151
142585
|
});
|
|
142152
|
-
var
|
|
142586
|
+
var _internals99 = {
|
|
142153
142587
|
loadPluginConfigWithMeta,
|
|
142154
142588
|
createMemoryGateway
|
|
142155
142589
|
};
|
|
142156
|
-
function
|
|
142590
|
+
function getContextAgent3(ctx) {
|
|
142157
142591
|
if (!ctx || typeof ctx !== "object")
|
|
142158
142592
|
return;
|
|
142159
142593
|
const value = ctx.agent;
|
|
@@ -142187,7 +142621,7 @@ var swarm_memory_recall = createSwarmTool({
|
|
|
142187
142621
|
maxItems: exports_external.number().int().min(1).max(20).optional().describe("Maximum memories to return")
|
|
142188
142622
|
},
|
|
142189
142623
|
execute: async (args2, directory, ctx) => {
|
|
142190
|
-
const { config: config3 } =
|
|
142624
|
+
const { config: config3 } = _internals100.loadPluginConfigWithMeta(directory);
|
|
142191
142625
|
if (config3.memory?.enabled !== true) {
|
|
142192
142626
|
return JSON.stringify({
|
|
142193
142627
|
success: false,
|
|
@@ -142202,8 +142636,8 @@ var swarm_memory_recall = createSwarmTool({
|
|
|
142202
142636
|
error: parsed.error.issues.map((issue3) => issue3.message).join("; ")
|
|
142203
142637
|
});
|
|
142204
142638
|
}
|
|
142205
|
-
const agent =
|
|
142206
|
-
const gateway =
|
|
142639
|
+
const agent = getContextAgent4(ctx);
|
|
142640
|
+
const gateway = _internals100.createMemoryGateway({
|
|
142207
142641
|
directory,
|
|
142208
142642
|
sessionID: ctx?.sessionID,
|
|
142209
142643
|
agentRole: agent,
|
|
@@ -142236,11 +142670,11 @@ var RecallArgsSchema = exports_external.object({
|
|
|
142236
142670
|
kinds: exports_external.array(exports_external.enum(MEMORY_KINDS2)).optional(),
|
|
142237
142671
|
maxItems: exports_external.number().int().min(1).max(20).optional()
|
|
142238
142672
|
});
|
|
142239
|
-
var
|
|
142673
|
+
var _internals100 = {
|
|
142240
142674
|
loadPluginConfigWithMeta,
|
|
142241
142675
|
createMemoryGateway
|
|
142242
142676
|
};
|
|
142243
|
-
function
|
|
142677
|
+
function getContextAgent4(ctx) {
|
|
142244
142678
|
if (!ctx || typeof ctx !== "object")
|
|
142245
142679
|
return;
|
|
142246
142680
|
const value = ctx.agent;
|
|
@@ -142762,7 +143196,7 @@ import * as path184 from "node:path";
|
|
|
142762
143196
|
init_bun_compat();
|
|
142763
143197
|
import * as fs125 from "node:fs";
|
|
142764
143198
|
import * as path183 from "node:path";
|
|
142765
|
-
var
|
|
143199
|
+
var _internals101 = { bunSpawn };
|
|
142766
143200
|
var _swarmGitExcludedChecked = false;
|
|
142767
143201
|
function fileCoversSwarm(content) {
|
|
142768
143202
|
for (const rawLine of content.split(`
|
|
@@ -142795,7 +143229,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
142795
143229
|
checkIgnoreExitCode
|
|
142796
143230
|
] = await Promise.all([
|
|
142797
143231
|
(async () => {
|
|
142798
|
-
const proc =
|
|
143232
|
+
const proc = _internals101.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
142799
143233
|
try {
|
|
142800
143234
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
142801
143235
|
} finally {
|
|
@@ -142805,7 +143239,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
142805
143239
|
}
|
|
142806
143240
|
})(),
|
|
142807
143241
|
(async () => {
|
|
142808
|
-
const proc =
|
|
143242
|
+
const proc = _internals101.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
142809
143243
|
try {
|
|
142810
143244
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
142811
143245
|
} finally {
|
|
@@ -142815,7 +143249,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
142815
143249
|
}
|
|
142816
143250
|
})(),
|
|
142817
143251
|
(async () => {
|
|
142818
|
-
const proc =
|
|
143252
|
+
const proc = _internals101.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
142819
143253
|
try {
|
|
142820
143254
|
return await proc.exited;
|
|
142821
143255
|
} finally {
|
|
@@ -142854,7 +143288,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
142854
143288
|
}
|
|
142855
143289
|
} catch {}
|
|
142856
143290
|
}
|
|
142857
|
-
const trackedProc =
|
|
143291
|
+
const trackedProc = _internals101.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
142858
143292
|
let trackedExitCode;
|
|
142859
143293
|
let trackedOutput;
|
|
142860
143294
|
try {
|
|
@@ -142879,7 +143313,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
142879
143313
|
}
|
|
142880
143314
|
|
|
142881
143315
|
// src/hooks/diff-scope.ts
|
|
142882
|
-
var
|
|
143316
|
+
var _internals102 = { bunSpawn };
|
|
142883
143317
|
function getDeclaredScope(taskId, directory) {
|
|
142884
143318
|
try {
|
|
142885
143319
|
const planPath = path184.join(directory, ".swarm", "plan.json");
|
|
@@ -142914,7 +143348,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
142914
143348
|
};
|
|
142915
143349
|
async function getChangedFiles2(directory) {
|
|
142916
143350
|
try {
|
|
142917
|
-
const proc =
|
|
143351
|
+
const proc = _internals102.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
142918
143352
|
cwd: directory,
|
|
142919
143353
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
142920
143354
|
});
|
|
@@ -142931,7 +143365,7 @@ async function getChangedFiles2(directory) {
|
|
|
142931
143365
|
return stdout.trim().split(`
|
|
142932
143366
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
142933
143367
|
}
|
|
142934
|
-
const proc2 =
|
|
143368
|
+
const proc2 = _internals102.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
142935
143369
|
cwd: directory,
|
|
142936
143370
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
142937
143371
|
});
|
|
@@ -142989,7 +143423,7 @@ init_telemetry();
|
|
|
142989
143423
|
init_file_locks();
|
|
142990
143424
|
import * as fs127 from "node:fs";
|
|
142991
143425
|
import * as path185 from "node:path";
|
|
142992
|
-
var
|
|
143426
|
+
var _internals103 = {
|
|
142993
143427
|
listActiveLocks,
|
|
142994
143428
|
verifyLeanTurboTaskCompletion
|
|
142995
143429
|
};
|
|
@@ -143131,7 +143565,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
143131
143565
|
}
|
|
143132
143566
|
};
|
|
143133
143567
|
}
|
|
143134
|
-
const activeLocks =
|
|
143568
|
+
const activeLocks = _internals103.listActiveLocks(directory);
|
|
143135
143569
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
143136
143570
|
if (laneLocks.length > 0) {
|
|
143137
143571
|
return {
|
|
@@ -143198,7 +143632,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
143198
143632
|
init_task_id();
|
|
143199
143633
|
init_create_tool();
|
|
143200
143634
|
init_resolve_working_directory();
|
|
143201
|
-
var
|
|
143635
|
+
var _internals104 = {
|
|
143202
143636
|
tryAcquireLock,
|
|
143203
143637
|
updateTaskStatus,
|
|
143204
143638
|
resolveWorkingDirectory
|
|
@@ -143295,7 +143729,7 @@ function checkReviewerGate(taskId, workingDirectory, stageBParallelEnabled = fal
|
|
|
143295
143729
|
}
|
|
143296
143730
|
let resolvedDir;
|
|
143297
143731
|
if (fallbackDir) {
|
|
143298
|
-
const resolveResult =
|
|
143732
|
+
const resolveResult = _internals104.resolveWorkingDirectory(workingDirectory, fallbackDir);
|
|
143299
143733
|
if (resolveResult.success) {
|
|
143300
143734
|
resolvedDir = resolveResult.directory;
|
|
143301
143735
|
} else {
|
|
@@ -143642,7 +144076,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
143642
144076
|
}
|
|
143643
144077
|
}
|
|
143644
144078
|
let directory;
|
|
143645
|
-
const resolveResult =
|
|
144079
|
+
const resolveResult = _internals104.resolveWorkingDirectory(args2.working_directory, fallbackDir);
|
|
143646
144080
|
if (!resolveResult.success) {
|
|
143647
144081
|
return {
|
|
143648
144082
|
success: false,
|
|
@@ -143735,7 +144169,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
143735
144169
|
}
|
|
143736
144170
|
let lockResult;
|
|
143737
144171
|
try {
|
|
143738
|
-
lockResult = await
|
|
144172
|
+
lockResult = await _internals104.tryAcquireLock(directory, planFilePath, agentName, lockTaskId);
|
|
143739
144173
|
} catch (error93) {
|
|
143740
144174
|
return {
|
|
143741
144175
|
success: false,
|
|
@@ -143754,7 +144188,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
143754
144188
|
};
|
|
143755
144189
|
}
|
|
143756
144190
|
try {
|
|
143757
|
-
const updatedPlan = await
|
|
144191
|
+
const updatedPlan = await _internals104.updateTaskStatus(directory, args2.task_id, args2.status);
|
|
143758
144192
|
if (args2.status === "completed") {
|
|
143759
144193
|
for (const [_sessionId, session] of swarmState.agentSessions) {
|
|
143760
144194
|
if (!(session.taskWorkflowStates instanceof Map)) {
|
|
@@ -143895,14 +144329,14 @@ init_create_tool();
|
|
|
143895
144329
|
init_resolve_working_directory();
|
|
143896
144330
|
var DEFAULT_MAX_BYTES = 1e6;
|
|
143897
144331
|
var MAX_BYTES_HARD_CAP = 5000000;
|
|
143898
|
-
var
|
|
143899
|
-
var
|
|
144332
|
+
var DEFAULT_TIMEOUT_MS5 = 15000;
|
|
144333
|
+
var MAX_TIMEOUT_MS3 = 30000;
|
|
143900
144334
|
var MAX_REDIRECTS = 5;
|
|
143901
144335
|
var MAX_TEXT_LENGTH2 = 50000;
|
|
143902
144336
|
var ArgsSchema6 = exports_external.object({
|
|
143903
144337
|
url: exports_external.string().min(1).max(2048),
|
|
143904
144338
|
max_bytes: exports_external.number().int().min(1024).max(MAX_BYTES_HARD_CAP).optional(),
|
|
143905
|
-
timeout_ms: exports_external.number().int().min(1000).max(
|
|
144339
|
+
timeout_ms: exports_external.number().int().min(1000).max(MAX_TIMEOUT_MS3).optional(),
|
|
143906
144340
|
working_directory: exports_external.string().optional()
|
|
143907
144341
|
});
|
|
143908
144342
|
function isBlockedAddress(address) {
|
|
@@ -144387,7 +144821,7 @@ var web_fetch = createSwarmTool({
|
|
|
144387
144821
|
args: {
|
|
144388
144822
|
url: exports_external.string().min(1).max(2048).describe("Absolute http(s) URL to fetch (1–2048 chars)."),
|
|
144389
144823
|
max_bytes: exports_external.number().int().min(1024).max(MAX_BYTES_HARD_CAP).optional().describe(`Max decoded response bytes to read (1024..${MAX_BYTES_HARD_CAP}, default ${DEFAULT_MAX_BYTES}).`),
|
|
144390
|
-
timeout_ms: exports_external.number().int().min(1000).max(
|
|
144824
|
+
timeout_ms: exports_external.number().int().min(1000).max(MAX_TIMEOUT_MS3).optional().describe(`Request timeout in ms (1000..${MAX_TIMEOUT_MS3}, default ${DEFAULT_TIMEOUT_MS5}).`),
|
|
144391
144825
|
working_directory: exports_external.string().optional().describe("Project root for config resolution and evidence storage. Optional.")
|
|
144392
144826
|
},
|
|
144393
144827
|
execute: async (args2, directory) => {
|
|
@@ -144409,7 +144843,7 @@ var web_fetch = createSwarmTool({
|
|
|
144409
144843
|
};
|
|
144410
144844
|
return JSON.stringify(fail, null, 2);
|
|
144411
144845
|
}
|
|
144412
|
-
const config3 =
|
|
144846
|
+
const config3 = _internals105.loadPluginConfig(dirResult.directory);
|
|
144413
144847
|
const generalConfig = config3.council?.general;
|
|
144414
144848
|
if (!generalConfig || generalConfig.enabled !== true) {
|
|
144415
144849
|
const fail = {
|
|
@@ -144419,7 +144853,7 @@ var web_fetch = createSwarmTool({
|
|
|
144419
144853
|
};
|
|
144420
144854
|
return JSON.stringify(fail, null, 2);
|
|
144421
144855
|
}
|
|
144422
|
-
const validated = await validateFetchUrl(parsed.data.url,
|
|
144856
|
+
const validated = await validateFetchUrl(parsed.data.url, _internals105.dnsLookup);
|
|
144423
144857
|
if (!validated.ok) {
|
|
144424
144858
|
const fail = {
|
|
144425
144859
|
success: false,
|
|
@@ -144429,8 +144863,8 @@ var web_fetch = createSwarmTool({
|
|
|
144429
144863
|
return JSON.stringify(fail, null, 2);
|
|
144430
144864
|
}
|
|
144431
144865
|
const maxBytes = parsed.data.max_bytes ?? DEFAULT_MAX_BYTES;
|
|
144432
|
-
const timeoutMs = parsed.data.timeout_ms ??
|
|
144433
|
-
const result = await boundedFetch({ url: validated.url, address: validated.address }, maxBytes, timeoutMs,
|
|
144866
|
+
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_TIMEOUT_MS5;
|
|
144867
|
+
const result = await boundedFetch({ url: validated.url, address: validated.address }, maxBytes, timeoutMs, _internals105);
|
|
144434
144868
|
if (!result.ok) {
|
|
144435
144869
|
const fail = {
|
|
144436
144870
|
success: false,
|
|
@@ -144465,7 +144899,7 @@ var web_fetch = createSwarmTool({
|
|
|
144465
144899
|
});
|
|
144466
144900
|
async function captureFetchEvidence(directory, url3, title, text) {
|
|
144467
144901
|
try {
|
|
144468
|
-
const written = await
|
|
144902
|
+
const written = await _internals105.writeEvidenceDocuments(directory, [
|
|
144469
144903
|
{
|
|
144470
144904
|
sourceType: "crawl",
|
|
144471
144905
|
url: url3,
|
|
@@ -144486,7 +144920,7 @@ async function captureFetchEvidence(directory, url3, title, text) {
|
|
|
144486
144920
|
};
|
|
144487
144921
|
}
|
|
144488
144922
|
}
|
|
144489
|
-
var
|
|
144923
|
+
var _internals105 = {
|
|
144490
144924
|
httpRequest: performHttpRequest,
|
|
144491
144925
|
dnsLookup: lookup,
|
|
144492
144926
|
loadPluginConfig,
|
|
@@ -144800,7 +145234,7 @@ var web_search = createSwarmTool({
|
|
|
144800
145234
|
});
|
|
144801
145235
|
async function captureSearchEvidence(directory, query, results) {
|
|
144802
145236
|
try {
|
|
144803
|
-
const written = await
|
|
145237
|
+
const written = await _internals106.writeEvidenceDocuments(directory, results.map((result) => ({
|
|
144804
145238
|
sourceType: "web_search",
|
|
144805
145239
|
query,
|
|
144806
145240
|
title: result.title,
|
|
@@ -144828,7 +145262,7 @@ async function captureSearchEvidence(directory, query, results) {
|
|
|
144828
145262
|
};
|
|
144829
145263
|
}
|
|
144830
145264
|
}
|
|
144831
|
-
var
|
|
145265
|
+
var _internals106 = {
|
|
144832
145266
|
writeEvidenceDocuments
|
|
144833
145267
|
};
|
|
144834
145268
|
|
|
@@ -145648,6 +146082,7 @@ var TOOL_MANIFEST = defineHandlers({
|
|
|
145648
146082
|
swarm_memory_recall: () => swarm_memory_recall,
|
|
145649
146083
|
swarm_memory_propose: () => swarm_memory_propose,
|
|
145650
146084
|
swarm_command: () => swarm_command,
|
|
146085
|
+
dispatch_lanes: () => dispatch_lanes,
|
|
145651
146086
|
summarize_work: () => summarize_work,
|
|
145652
146087
|
write_architecture_supervisor_evidence: () => write_architecture_supervisor_evidence,
|
|
145653
146088
|
lean_turbo_plan_lanes: () => lean_turbo_plan_lanes,
|