opencode-swarm 7.17.2 → 7.17.4
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/dist/cli/index.js +36 -17
- package/dist/commands/registry.d.ts +3 -3
- package/dist/commands/turbo.d.ts +11 -0
- package/dist/index.js +213 -91
- package/dist/tools/write-final-council-evidence.d.ts +12 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.17.
|
|
37
|
+
version: "7.17.4",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
|
@@ -51420,7 +51420,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
51420
51420
|
if (arg0 === "on") {
|
|
51421
51421
|
let strategy = "standard";
|
|
51422
51422
|
try {
|
|
51423
|
-
const { config: config3 } = loadPluginConfigWithMeta(directory);
|
|
51423
|
+
const { config: config3 } = _internals25.loadPluginConfigWithMeta(directory);
|
|
51424
51424
|
if (config3.turbo?.strategy === "lean") {
|
|
51425
51425
|
strategy = "lean";
|
|
51426
51426
|
}
|
|
@@ -51475,7 +51475,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
51475
51475
|
let maxParallelCoders = 4;
|
|
51476
51476
|
let conflictPolicy = "serialize";
|
|
51477
51477
|
try {
|
|
51478
|
-
const { config: config3 } = loadPluginConfigWithMeta(directory);
|
|
51478
|
+
const { config: config3 } = _internals25.loadPluginConfigWithMeta(directory);
|
|
51479
51479
|
const leanConfig = config3.turbo?.lean;
|
|
51480
51480
|
if (leanConfig) {
|
|
51481
51481
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -51545,11 +51545,15 @@ function buildStatusMessage(session, directory, sessionID) {
|
|
|
51545
51545
|
].join(`
|
|
51546
51546
|
`);
|
|
51547
51547
|
}
|
|
51548
|
+
var _internals25;
|
|
51548
51549
|
var init_turbo = __esm(() => {
|
|
51549
51550
|
init_config();
|
|
51550
51551
|
init_state();
|
|
51551
51552
|
init_state3();
|
|
51552
51553
|
init_logger();
|
|
51554
|
+
_internals25 = {
|
|
51555
|
+
loadPluginConfigWithMeta
|
|
51556
|
+
};
|
|
51553
51557
|
});
|
|
51554
51558
|
|
|
51555
51559
|
// src/commands/write-retro.ts
|
|
@@ -51802,7 +51806,7 @@ function createSwarmCommandHandler(directory, agents) {
|
|
|
51802
51806
|
const attemptedCommand = tokens[0] || "";
|
|
51803
51807
|
const MAX_DISPLAY = 100;
|
|
51804
51808
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
51805
|
-
const similar =
|
|
51809
|
+
const similar = _internals26.findSimilarCommands(attemptedCommand);
|
|
51806
51810
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
51807
51811
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
51808
51812
|
${similar.map((cmd) => ` \u2022 /swarm ${cmd}`).join(`
|
|
@@ -51909,7 +51913,7 @@ function findSimilarCommands(query) {
|
|
|
51909
51913
|
}
|
|
51910
51914
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
51911
51915
|
const cmdLower = cmd.toLowerCase();
|
|
51912
|
-
const fullScore =
|
|
51916
|
+
const fullScore = _internals26.levenshteinDistance(q, cmdLower);
|
|
51913
51917
|
let tokenScore = Infinity;
|
|
51914
51918
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
51915
51919
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -51922,7 +51926,7 @@ function findSimilarCommands(query) {
|
|
|
51922
51926
|
for (const ct of cmdTokens) {
|
|
51923
51927
|
if (ct.length === 0)
|
|
51924
51928
|
continue;
|
|
51925
|
-
const dist =
|
|
51929
|
+
const dist = _internals26.levenshteinDistance(qt, ct);
|
|
51926
51930
|
if (dist < minDist)
|
|
51927
51931
|
minDist = dist;
|
|
51928
51932
|
}
|
|
@@ -51932,7 +51936,7 @@ function findSimilarCommands(query) {
|
|
|
51932
51936
|
}
|
|
51933
51937
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
51934
51938
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
51935
|
-
const dashScore =
|
|
51939
|
+
const dashScore = _internals26.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
51936
51940
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
51937
51941
|
return { cmd, score };
|
|
51938
51942
|
});
|
|
@@ -51964,11 +51968,11 @@ async function handleHelpCommand(ctx) {
|
|
|
51964
51968
|
return buildHelpText2();
|
|
51965
51969
|
}
|
|
51966
51970
|
const tokens = targetCommand.split(/\s+/);
|
|
51967
|
-
const resolved =
|
|
51971
|
+
const resolved = _internals26.resolveCommand(tokens);
|
|
51968
51972
|
if (resolved) {
|
|
51969
|
-
return
|
|
51973
|
+
return _internals26.buildDetailedHelp(resolved.key, resolved.entry);
|
|
51970
51974
|
}
|
|
51971
|
-
const similar =
|
|
51975
|
+
const similar = _internals26.findSimilarCommands(targetCommand);
|
|
51972
51976
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
51973
51977
|
if (similar.length > 0) {
|
|
51974
51978
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -52062,7 +52066,7 @@ function resolveCommand(tokens) {
|
|
|
52062
52066
|
}
|
|
52063
52067
|
return null;
|
|
52064
52068
|
}
|
|
52065
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
52069
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals26, validation;
|
|
52066
52070
|
var init_registry = __esm(() => {
|
|
52067
52071
|
init_acknowledge_spec_drift();
|
|
52068
52072
|
init_agents();
|
|
@@ -52132,7 +52136,7 @@ var init_registry = __esm(() => {
|
|
|
52132
52136
|
clashesWithNativeCcCommand: "/agents"
|
|
52133
52137
|
},
|
|
52134
52138
|
help: {
|
|
52135
|
-
handler: (ctx) =>
|
|
52139
|
+
handler: (ctx) => _internals26.handleHelpCommand(ctx),
|
|
52136
52140
|
description: "Show help for swarm commands",
|
|
52137
52141
|
category: "core",
|
|
52138
52142
|
args: "[command]",
|
|
@@ -52431,9 +52435,24 @@ var init_registry = __esm(() => {
|
|
|
52431
52435
|
},
|
|
52432
52436
|
turbo: {
|
|
52433
52437
|
handler: (ctx) => handleTurboCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
52434
|
-
description: "Toggle Turbo Mode for the active session [on|off]",
|
|
52435
|
-
args: "on, off",
|
|
52436
|
-
details:
|
|
52438
|
+
description: "Toggle Turbo Mode strategy for the active session [on|off|lean|standard|status]",
|
|
52439
|
+
args: "on, off, lean, standard, status",
|
|
52440
|
+
details: `Toggles Turbo Mode for the current session. Supports two strategies:
|
|
52441
|
+
|
|
52442
|
+
` + `**Standard turbo** \u2014 skips non-critical QA gates for faster iteration.
|
|
52443
|
+
` + `**Lean turbo** \u2014 parallel lane execution with per-lane reviewer gates and file-lock conflict detection.
|
|
52444
|
+
` + `
|
|
52445
|
+
Subcommands:
|
|
52446
|
+
` + ` turbo on \u2014 enable turbo (uses lean when config turbo.strategy is "lean", otherwise standard)
|
|
52447
|
+
` + ` turbo off \u2014 disable all turbo modes
|
|
52448
|
+
` + ` turbo lean on \u2014 enable Lean Turbo explicitly
|
|
52449
|
+
` + ` turbo lean off \u2014 disable Lean Turbo
|
|
52450
|
+
` + ` turbo lean \u2014 toggle Lean Turbo on/off
|
|
52451
|
+
` + ` turbo standard on \u2014 force standard turbo (disables lean even if config says lean)
|
|
52452
|
+
` + ` turbo standard off \u2014 disable standard turbo (falls back to lean if config strategy is lean)
|
|
52453
|
+
` + ` turbo status \u2014 show detailed status including active strategy and lanes
|
|
52454
|
+
` + `
|
|
52455
|
+
` + "Session-scoped \u2014 resets on new session.",
|
|
52437
52456
|
category: "utility"
|
|
52438
52457
|
},
|
|
52439
52458
|
"full-auto": {
|
|
@@ -52489,7 +52508,7 @@ var init_registry = __esm(() => {
|
|
|
52489
52508
|
}
|
|
52490
52509
|
};
|
|
52491
52510
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
52492
|
-
|
|
52511
|
+
_internals26 = {
|
|
52493
52512
|
handleHelpCommand,
|
|
52494
52513
|
validateAliases,
|
|
52495
52514
|
resolveCommand,
|
|
@@ -52497,7 +52516,7 @@ var init_registry = __esm(() => {
|
|
|
52497
52516
|
findSimilarCommands,
|
|
52498
52517
|
buildDetailedHelp
|
|
52499
52518
|
};
|
|
52500
|
-
validation =
|
|
52519
|
+
validation = _internals26.validateAliases();
|
|
52501
52520
|
if (!validation.valid) {
|
|
52502
52521
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
52503
52522
|
${validation.errors.join(`
|
|
@@ -366,9 +366,9 @@ export declare const COMMAND_REGISTRY: {
|
|
|
366
366
|
};
|
|
367
367
|
readonly turbo: {
|
|
368
368
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
369
|
-
readonly description: "Toggle Turbo Mode for the active session [on|off]";
|
|
370
|
-
readonly args: "on, off";
|
|
371
|
-
readonly details:
|
|
369
|
+
readonly description: "Toggle Turbo Mode strategy for the active session [on|off|lean|standard|status]";
|
|
370
|
+
readonly args: "on, off, lean, standard, status";
|
|
371
|
+
readonly details: string;
|
|
372
372
|
readonly category: "utility";
|
|
373
373
|
};
|
|
374
374
|
readonly 'full-auto': {
|
package/dist/commands/turbo.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { loadPluginConfigWithMeta } from '../config';
|
|
2
|
+
/**
|
|
3
|
+
* Test-only dependency-injection seam. Production code calls
|
|
4
|
+
* `_internals.loadPluginConfigWithMeta(...)` so tests can replace the function
|
|
5
|
+
* on this object without using `mock.module` from `bun:test`, which leaks
|
|
6
|
+
* across files in Bun's shared test-runner process (AGENTS.md §7).
|
|
7
|
+
* Mutating this local object is file-scoped and trivially restorable via afterEach.
|
|
8
|
+
*/
|
|
9
|
+
export declare const _internals: {
|
|
10
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta;
|
|
11
|
+
};
|
|
1
12
|
/**
|
|
2
13
|
* Handles the /swarm turbo command.
|
|
3
14
|
* Supports standard turbo toggle, lean turbo mode, and status reporting.
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var package_default;
|
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "opencode-swarm",
|
|
36
|
-
version: "7.17.
|
|
36
|
+
version: "7.17.4",
|
|
37
37
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
38
38
|
main: "dist/index.js",
|
|
39
39
|
types: "dist/index.d.ts",
|
|
@@ -60218,7 +60218,7 @@ async function handleTurboCommand(directory, args2, sessionID) {
|
|
|
60218
60218
|
if (arg0 === "on") {
|
|
60219
60219
|
let strategy = "standard";
|
|
60220
60220
|
try {
|
|
60221
|
-
const { config: config3 } = loadPluginConfigWithMeta(directory);
|
|
60221
|
+
const { config: config3 } = _internals31.loadPluginConfigWithMeta(directory);
|
|
60222
60222
|
if (config3.turbo?.strategy === "lean") {
|
|
60223
60223
|
strategy = "lean";
|
|
60224
60224
|
}
|
|
@@ -60273,7 +60273,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
60273
60273
|
let maxParallelCoders = 4;
|
|
60274
60274
|
let conflictPolicy = "serialize";
|
|
60275
60275
|
try {
|
|
60276
|
-
const { config: config3 } = loadPluginConfigWithMeta(directory);
|
|
60276
|
+
const { config: config3 } = _internals31.loadPluginConfigWithMeta(directory);
|
|
60277
60277
|
const leanConfig = config3.turbo?.lean;
|
|
60278
60278
|
if (leanConfig) {
|
|
60279
60279
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -60343,11 +60343,15 @@ function buildStatusMessage(session, directory, sessionID) {
|
|
|
60343
60343
|
].join(`
|
|
60344
60344
|
`);
|
|
60345
60345
|
}
|
|
60346
|
+
var _internals31;
|
|
60346
60347
|
var init_turbo = __esm(() => {
|
|
60347
60348
|
init_config();
|
|
60348
60349
|
init_state();
|
|
60349
60350
|
init_state3();
|
|
60350
60351
|
init_logger();
|
|
60352
|
+
_internals31 = {
|
|
60353
|
+
loadPluginConfigWithMeta
|
|
60354
|
+
};
|
|
60351
60355
|
});
|
|
60352
60356
|
|
|
60353
60357
|
// src/commands/write-retro.ts
|
|
@@ -60600,7 +60604,7 @@ function createSwarmCommandHandler(directory, agents) {
|
|
|
60600
60604
|
const attemptedCommand = tokens[0] || "";
|
|
60601
60605
|
const MAX_DISPLAY = 100;
|
|
60602
60606
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
60603
|
-
const similar =
|
|
60607
|
+
const similar = _internals32.findSimilarCommands(attemptedCommand);
|
|
60604
60608
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
60605
60609
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
60606
60610
|
${similar.map((cmd) => ` • /swarm ${cmd}`).join(`
|
|
@@ -60707,7 +60711,7 @@ function findSimilarCommands(query) {
|
|
|
60707
60711
|
}
|
|
60708
60712
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
60709
60713
|
const cmdLower = cmd.toLowerCase();
|
|
60710
|
-
const fullScore =
|
|
60714
|
+
const fullScore = _internals32.levenshteinDistance(q, cmdLower);
|
|
60711
60715
|
let tokenScore = Infinity;
|
|
60712
60716
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
60713
60717
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -60720,7 +60724,7 @@ function findSimilarCommands(query) {
|
|
|
60720
60724
|
for (const ct of cmdTokens) {
|
|
60721
60725
|
if (ct.length === 0)
|
|
60722
60726
|
continue;
|
|
60723
|
-
const dist =
|
|
60727
|
+
const dist = _internals32.levenshteinDistance(qt, ct);
|
|
60724
60728
|
if (dist < minDist)
|
|
60725
60729
|
minDist = dist;
|
|
60726
60730
|
}
|
|
@@ -60730,7 +60734,7 @@ function findSimilarCommands(query) {
|
|
|
60730
60734
|
}
|
|
60731
60735
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
60732
60736
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
60733
|
-
const dashScore =
|
|
60737
|
+
const dashScore = _internals32.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
60734
60738
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
60735
60739
|
return { cmd, score };
|
|
60736
60740
|
});
|
|
@@ -60762,11 +60766,11 @@ async function handleHelpCommand(ctx) {
|
|
|
60762
60766
|
return buildHelpText2();
|
|
60763
60767
|
}
|
|
60764
60768
|
const tokens = targetCommand.split(/\s+/);
|
|
60765
|
-
const resolved =
|
|
60769
|
+
const resolved = _internals32.resolveCommand(tokens);
|
|
60766
60770
|
if (resolved) {
|
|
60767
|
-
return
|
|
60771
|
+
return _internals32.buildDetailedHelp(resolved.key, resolved.entry);
|
|
60768
60772
|
}
|
|
60769
|
-
const similar =
|
|
60773
|
+
const similar = _internals32.findSimilarCommands(targetCommand);
|
|
60770
60774
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
60771
60775
|
if (similar.length > 0) {
|
|
60772
60776
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -60860,7 +60864,7 @@ function resolveCommand(tokens) {
|
|
|
60860
60864
|
}
|
|
60861
60865
|
return null;
|
|
60862
60866
|
}
|
|
60863
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
60867
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals32, validation;
|
|
60864
60868
|
var init_registry = __esm(() => {
|
|
60865
60869
|
init_acknowledge_spec_drift();
|
|
60866
60870
|
init_agents();
|
|
@@ -60930,7 +60934,7 @@ var init_registry = __esm(() => {
|
|
|
60930
60934
|
clashesWithNativeCcCommand: "/agents"
|
|
60931
60935
|
},
|
|
60932
60936
|
help: {
|
|
60933
|
-
handler: (ctx) =>
|
|
60937
|
+
handler: (ctx) => _internals32.handleHelpCommand(ctx),
|
|
60934
60938
|
description: "Show help for swarm commands",
|
|
60935
60939
|
category: "core",
|
|
60936
60940
|
args: "[command]",
|
|
@@ -61229,9 +61233,24 @@ var init_registry = __esm(() => {
|
|
|
61229
61233
|
},
|
|
61230
61234
|
turbo: {
|
|
61231
61235
|
handler: (ctx) => handleTurboCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
61232
|
-
description: "Toggle Turbo Mode for the active session [on|off]",
|
|
61233
|
-
args: "on, off",
|
|
61234
|
-
details:
|
|
61236
|
+
description: "Toggle Turbo Mode strategy for the active session [on|off|lean|standard|status]",
|
|
61237
|
+
args: "on, off, lean, standard, status",
|
|
61238
|
+
details: `Toggles Turbo Mode for the current session. Supports two strategies:
|
|
61239
|
+
|
|
61240
|
+
` + `**Standard turbo** — skips non-critical QA gates for faster iteration.
|
|
61241
|
+
` + `**Lean turbo** — parallel lane execution with per-lane reviewer gates and file-lock conflict detection.
|
|
61242
|
+
` + `
|
|
61243
|
+
Subcommands:
|
|
61244
|
+
` + ` turbo on — enable turbo (uses lean when config turbo.strategy is "lean", otherwise standard)
|
|
61245
|
+
` + ` turbo off — disable all turbo modes
|
|
61246
|
+
` + ` turbo lean on — enable Lean Turbo explicitly
|
|
61247
|
+
` + ` turbo lean off — disable Lean Turbo
|
|
61248
|
+
` + ` turbo lean — toggle Lean Turbo on/off
|
|
61249
|
+
` + ` turbo standard on — force standard turbo (disables lean even if config says lean)
|
|
61250
|
+
` + ` turbo standard off — disable standard turbo (falls back to lean if config strategy is lean)
|
|
61251
|
+
` + ` turbo status — show detailed status including active strategy and lanes
|
|
61252
|
+
` + `
|
|
61253
|
+
` + "Session-scoped — resets on new session.",
|
|
61235
61254
|
category: "utility"
|
|
61236
61255
|
},
|
|
61237
61256
|
"full-auto": {
|
|
@@ -61287,7 +61306,7 @@ var init_registry = __esm(() => {
|
|
|
61287
61306
|
}
|
|
61288
61307
|
};
|
|
61289
61308
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
61290
|
-
|
|
61309
|
+
_internals32 = {
|
|
61291
61310
|
handleHelpCommand,
|
|
61292
61311
|
validateAliases,
|
|
61293
61312
|
resolveCommand,
|
|
@@ -61295,7 +61314,7 @@ var init_registry = __esm(() => {
|
|
|
61295
61314
|
findSimilarCommands,
|
|
61296
61315
|
buildDetailedHelp
|
|
61297
61316
|
};
|
|
61298
|
-
validation =
|
|
61317
|
+
validation = _internals32.validateAliases();
|
|
61299
61318
|
if (!validation.valid) {
|
|
61300
61319
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
61301
61320
|
${validation.errors.join(`
|
|
@@ -69908,7 +69927,7 @@ __export(exports_runtime, {
|
|
|
69908
69927
|
getSupportedLanguages: () => getSupportedLanguages,
|
|
69909
69928
|
getInitializedLanguages: () => getInitializedLanguages,
|
|
69910
69929
|
clearParserCache: () => clearParserCache,
|
|
69911
|
-
_internals: () =>
|
|
69930
|
+
_internals: () => _internals33
|
|
69912
69931
|
});
|
|
69913
69932
|
import * as path76 from "node:path";
|
|
69914
69933
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -69918,10 +69937,10 @@ async function initTreeSitter() {
|
|
|
69918
69937
|
const thisDir = path76.dirname(fileURLToPath2(import.meta.url));
|
|
69919
69938
|
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
69920
69939
|
if (isSource) {
|
|
69921
|
-
await
|
|
69940
|
+
await _internals33.parserInit();
|
|
69922
69941
|
} else {
|
|
69923
69942
|
const grammarsDir = getGrammarsDirAbsolute();
|
|
69924
|
-
await
|
|
69943
|
+
await _internals33.parserInit({
|
|
69925
69944
|
locateFile(scriptName) {
|
|
69926
69945
|
return path76.join(grammarsDir, scriptName);
|
|
69927
69946
|
}
|
|
@@ -70023,12 +70042,12 @@ function getInitializedLanguages() {
|
|
|
70023
70042
|
function getSupportedLanguages() {
|
|
70024
70043
|
return Object.keys(LANGUAGE_WASM_MAP);
|
|
70025
70044
|
}
|
|
70026
|
-
var parserCache, initializedLanguages, treeSitterInitPromise = null,
|
|
70045
|
+
var parserCache, initializedLanguages, treeSitterInitPromise = null, _internals33, LANGUAGE_WASM_MAP;
|
|
70027
70046
|
var init_runtime = __esm(() => {
|
|
70028
70047
|
init_tree_sitter();
|
|
70029
70048
|
parserCache = new Map;
|
|
70030
70049
|
initializedLanguages = new Set;
|
|
70031
|
-
|
|
70050
|
+
_internals33 = {
|
|
70032
70051
|
parserInit: Parser.init
|
|
70033
70052
|
};
|
|
70034
70053
|
LANGUAGE_WASM_MAP = {
|
|
@@ -70485,9 +70504,9 @@ var init_doc_scan = __esm(() => {
|
|
|
70485
70504
|
var exports_knowledge_recall = {};
|
|
70486
70505
|
__export(exports_knowledge_recall, {
|
|
70487
70506
|
knowledge_recall: () => knowledge_recall,
|
|
70488
|
-
_internals: () =>
|
|
70507
|
+
_internals: () => _internals34
|
|
70489
70508
|
});
|
|
70490
|
-
var knowledge_recall,
|
|
70509
|
+
var knowledge_recall, _internals34;
|
|
70491
70510
|
var init_knowledge_recall = __esm(() => {
|
|
70492
70511
|
init_zod();
|
|
70493
70512
|
init_knowledge_store();
|
|
@@ -70573,7 +70592,7 @@ var init_knowledge_recall = __esm(() => {
|
|
|
70573
70592
|
return JSON.stringify(result);
|
|
70574
70593
|
}
|
|
70575
70594
|
});
|
|
70576
|
-
|
|
70595
|
+
_internals34 = {
|
|
70577
70596
|
knowledge_recall
|
|
70578
70597
|
};
|
|
70579
70598
|
});
|
|
@@ -70628,7 +70647,7 @@ __export(exports_curator_drift, {
|
|
|
70628
70647
|
runDeterministicDriftCheck: () => runDeterministicDriftCheck,
|
|
70629
70648
|
readPriorDriftReports: () => readPriorDriftReports,
|
|
70630
70649
|
buildDriftInjectionText: () => buildDriftInjectionText,
|
|
70631
|
-
_internals: () =>
|
|
70650
|
+
_internals: () => _internals36
|
|
70632
70651
|
});
|
|
70633
70652
|
import * as fs60 from "node:fs";
|
|
70634
70653
|
import * as path84 from "node:path";
|
|
@@ -70673,7 +70692,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
70673
70692
|
try {
|
|
70674
70693
|
const planMd = await readSwarmFileAsync(directory, "plan.md");
|
|
70675
70694
|
const specMd = await readSwarmFileAsync(directory, "spec.md");
|
|
70676
|
-
const priorReports = await
|
|
70695
|
+
const priorReports = await _internals36.readPriorDriftReports(directory);
|
|
70677
70696
|
const complianceCount = curatorResult.compliance.length;
|
|
70678
70697
|
const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
|
|
70679
70698
|
let alignment = "ALIGNED";
|
|
@@ -70722,7 +70741,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
70722
70741
|
scope_additions: [],
|
|
70723
70742
|
injection_summary: injectionSummary
|
|
70724
70743
|
};
|
|
70725
|
-
const reportPath = await
|
|
70744
|
+
const reportPath = await _internals36.writeDriftReport(directory, report);
|
|
70726
70745
|
getGlobalEventBus().publish("curator.drift.completed", {
|
|
70727
70746
|
phase,
|
|
70728
70747
|
alignment,
|
|
@@ -70785,12 +70804,12 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
70785
70804
|
}
|
|
70786
70805
|
return text.slice(0, maxChars);
|
|
70787
70806
|
}
|
|
70788
|
-
var DRIFT_REPORT_PREFIX = "drift-report-phase-",
|
|
70807
|
+
var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals36;
|
|
70789
70808
|
var init_curator_drift = __esm(() => {
|
|
70790
70809
|
init_event_bus();
|
|
70791
70810
|
init_logger();
|
|
70792
70811
|
init_utils2();
|
|
70793
|
-
|
|
70812
|
+
_internals36 = {
|
|
70794
70813
|
readPriorDriftReports,
|
|
70795
70814
|
writeDriftReport,
|
|
70796
70815
|
runDeterministicDriftCheck,
|
|
@@ -70802,7 +70821,7 @@ var init_curator_drift = __esm(() => {
|
|
|
70802
70821
|
var exports_project_context = {};
|
|
70803
70822
|
__export(exports_project_context, {
|
|
70804
70823
|
buildProjectContext: () => buildProjectContext,
|
|
70805
|
-
_internals: () =>
|
|
70824
|
+
_internals: () => _internals50,
|
|
70806
70825
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
70807
70826
|
});
|
|
70808
70827
|
import * as fs110 from "node:fs";
|
|
@@ -70886,7 +70905,7 @@ function selectLintCommand(backend, directory) {
|
|
|
70886
70905
|
return null;
|
|
70887
70906
|
}
|
|
70888
70907
|
async function buildProjectContext(directory) {
|
|
70889
|
-
const backend = await
|
|
70908
|
+
const backend = await _internals50.pickBackend(directory);
|
|
70890
70909
|
if (!backend)
|
|
70891
70910
|
return null;
|
|
70892
70911
|
const ctx = emptyProjectContext();
|
|
@@ -70917,16 +70936,16 @@ async function buildProjectContext(directory) {
|
|
|
70917
70936
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
70918
70937
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
70919
70938
|
}
|
|
70920
|
-
const profiles =
|
|
70939
|
+
const profiles = _internals50.pickedProfiles(directory);
|
|
70921
70940
|
if (profiles.length > 1) {
|
|
70922
70941
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
70923
70942
|
}
|
|
70924
70943
|
return ctx;
|
|
70925
70944
|
}
|
|
70926
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
70945
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals50;
|
|
70927
70946
|
var init_project_context = __esm(() => {
|
|
70928
70947
|
init_dispatch();
|
|
70929
|
-
|
|
70948
|
+
_internals50 = {
|
|
70930
70949
|
pickBackend,
|
|
70931
70950
|
pickedProfiles
|
|
70932
70951
|
};
|
|
@@ -81317,10 +81336,10 @@ async function getRunMemorySummary(directory) {
|
|
|
81317
81336
|
if (entries.length === 0) {
|
|
81318
81337
|
return null;
|
|
81319
81338
|
}
|
|
81320
|
-
const groups =
|
|
81339
|
+
const groups = _internals35.groupByTaskId(entries);
|
|
81321
81340
|
const summaries = [];
|
|
81322
81341
|
for (const [taskId, taskEntries] of groups) {
|
|
81323
|
-
const summary =
|
|
81342
|
+
const summary = _internals35.summarizeTask(taskId, taskEntries);
|
|
81324
81343
|
if (summary) {
|
|
81325
81344
|
summaries.push(summary);
|
|
81326
81345
|
}
|
|
@@ -81353,7 +81372,7 @@ Use this data to avoid repeating known failure patterns.`;
|
|
|
81353
81372
|
}
|
|
81354
81373
|
return prefix + summaryText + suffix;
|
|
81355
81374
|
}
|
|
81356
|
-
var
|
|
81375
|
+
var _internals35 = {
|
|
81357
81376
|
generateTaskFingerprint,
|
|
81358
81377
|
recordOutcome,
|
|
81359
81378
|
getTaskHistory,
|
|
@@ -88866,7 +88885,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
88866
88885
|
}
|
|
88867
88886
|
return laneIds;
|
|
88868
88887
|
}
|
|
88869
|
-
var
|
|
88888
|
+
var _internals37 = {
|
|
88870
88889
|
listActiveLocks,
|
|
88871
88890
|
readPersisted: readPersisted2,
|
|
88872
88891
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -88927,7 +88946,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
88927
88946
|
reason: "Lean Turbo state unreadable or missing"
|
|
88928
88947
|
};
|
|
88929
88948
|
}
|
|
88930
|
-
const persisted =
|
|
88949
|
+
const persisted = _internals37.readPersisted(directory);
|
|
88931
88950
|
if (!persisted) {
|
|
88932
88951
|
return {
|
|
88933
88952
|
ok: false,
|
|
@@ -88991,7 +89010,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
88991
89010
|
}
|
|
88992
89011
|
}
|
|
88993
89012
|
if (runState.lanes.length > 0) {
|
|
88994
|
-
const evidenceLaneIds = new Set(
|
|
89013
|
+
const evidenceLaneIds = new Set(_internals37.listLaneEvidenceSync(directory, phase));
|
|
88995
89014
|
for (const lane of runState.lanes) {
|
|
88996
89015
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
88997
89016
|
return {
|
|
@@ -89001,7 +89020,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89001
89020
|
}
|
|
89002
89021
|
}
|
|
89003
89022
|
}
|
|
89004
|
-
const activeLocks =
|
|
89023
|
+
const activeLocks = _internals37.listActiveLocks(directory);
|
|
89005
89024
|
const phaseLaneIds = new Set(laneIds);
|
|
89006
89025
|
for (const lock of activeLocks) {
|
|
89007
89026
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -89021,7 +89040,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89021
89040
|
}
|
|
89022
89041
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
89023
89042
|
if (serialDegradedTasks.length > 0) {
|
|
89024
|
-
const plan =
|
|
89043
|
+
const plan = _internals37.readPlanJson(directory);
|
|
89025
89044
|
if (!plan) {
|
|
89026
89045
|
return {
|
|
89027
89046
|
ok: false,
|
|
@@ -89065,7 +89084,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89065
89084
|
}
|
|
89066
89085
|
const serializedTasks = runState.serializedTasks;
|
|
89067
89086
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
89068
|
-
const plan =
|
|
89087
|
+
const plan = _internals37.readPlanJson(directory);
|
|
89069
89088
|
if (!plan) {
|
|
89070
89089
|
return {
|
|
89071
89090
|
ok: false,
|
|
@@ -89124,7 +89143,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89124
89143
|
}
|
|
89125
89144
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
89126
89145
|
if (!reviewerVerdict) {
|
|
89127
|
-
const evidence =
|
|
89146
|
+
const evidence = _internals37.readReviewerEvidence(directory, phase);
|
|
89128
89147
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
89129
89148
|
}
|
|
89130
89149
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -89137,7 +89156,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89137
89156
|
}
|
|
89138
89157
|
let criticVerdict = runState.lastCriticVerdict;
|
|
89139
89158
|
if (!criticVerdict) {
|
|
89140
|
-
const evidence =
|
|
89159
|
+
const evidence = _internals37.readCriticEvidence(directory, phase);
|
|
89141
89160
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
89142
89161
|
}
|
|
89143
89162
|
if (mergedConfig.phase_critic) {
|
|
@@ -90040,7 +90059,7 @@ Advisory notes: ${advisoryNotes.join("; ")}` : "";
|
|
|
90040
90059
|
phase_critic: leanConfig.phase_critic,
|
|
90041
90060
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
90042
90061
|
} : undefined;
|
|
90043
|
-
const leanCheck =
|
|
90062
|
+
const leanCheck = _internals37.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
90044
90063
|
if (!leanCheck.ok) {
|
|
90045
90064
|
return JSON.stringify({
|
|
90046
90065
|
success: false,
|
|
@@ -92228,11 +92247,11 @@ var quality_budget = createSwarmTool({
|
|
|
92228
92247
|
}).optional().describe("Quality budget thresholds")
|
|
92229
92248
|
},
|
|
92230
92249
|
async execute(args2, directory) {
|
|
92231
|
-
const result = await
|
|
92250
|
+
const result = await _internals38.qualityBudget(args2, directory);
|
|
92232
92251
|
return JSON.stringify(result);
|
|
92233
92252
|
}
|
|
92234
92253
|
});
|
|
92235
|
-
var
|
|
92254
|
+
var _internals38 = {
|
|
92236
92255
|
qualityBudget
|
|
92237
92256
|
};
|
|
92238
92257
|
|
|
@@ -92961,7 +92980,7 @@ import * as path109 from "node:path";
|
|
|
92961
92980
|
var semgrepAvailableCache = null;
|
|
92962
92981
|
var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
92963
92982
|
var DEFAULT_TIMEOUT_MS3 = 30000;
|
|
92964
|
-
var
|
|
92983
|
+
var _internals39 = {
|
|
92965
92984
|
isSemgrepAvailable,
|
|
92966
92985
|
checkSemgrepAvailable,
|
|
92967
92986
|
resetSemgrepCache,
|
|
@@ -92986,7 +93005,7 @@ function isSemgrepAvailable() {
|
|
|
92986
93005
|
}
|
|
92987
93006
|
}
|
|
92988
93007
|
async function checkSemgrepAvailable() {
|
|
92989
|
-
return
|
|
93008
|
+
return _internals39.isSemgrepAvailable();
|
|
92990
93009
|
}
|
|
92991
93010
|
function resetSemgrepCache() {
|
|
92992
93011
|
semgrepAvailableCache = null;
|
|
@@ -93083,12 +93102,12 @@ async function runSemgrep(options) {
|
|
|
93083
93102
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS3;
|
|
93084
93103
|
if (files.length === 0) {
|
|
93085
93104
|
return {
|
|
93086
|
-
available:
|
|
93105
|
+
available: _internals39.isSemgrepAvailable(),
|
|
93087
93106
|
findings: [],
|
|
93088
93107
|
engine: "tier_a"
|
|
93089
93108
|
};
|
|
93090
93109
|
}
|
|
93091
|
-
if (!
|
|
93110
|
+
if (!_internals39.isSemgrepAvailable()) {
|
|
93092
93111
|
return {
|
|
93093
93112
|
available: false,
|
|
93094
93113
|
findings: [],
|
|
@@ -93247,7 +93266,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
93247
93266
|
}
|
|
93248
93267
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
93249
93268
|
countMap.set(baseKey, occIdx + 1);
|
|
93250
|
-
const fp =
|
|
93269
|
+
const fp = _internals40.fingerprintFinding(finding, directory, occIdx);
|
|
93251
93270
|
return {
|
|
93252
93271
|
finding,
|
|
93253
93272
|
index: occIdx,
|
|
@@ -93316,7 +93335,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
93316
93335
|
}
|
|
93317
93336
|
} catch {}
|
|
93318
93337
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
93319
|
-
const indexed =
|
|
93338
|
+
const indexed = _internals40.assignOccurrenceIndices(findings, directory);
|
|
93320
93339
|
if (existing && !opts?.force) {
|
|
93321
93340
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
93322
93341
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -93456,7 +93475,7 @@ function loadBaseline(directory, phase) {
|
|
|
93456
93475
|
};
|
|
93457
93476
|
}
|
|
93458
93477
|
}
|
|
93459
|
-
var
|
|
93478
|
+
var _internals40 = {
|
|
93460
93479
|
fingerprintFinding,
|
|
93461
93480
|
assignOccurrenceIndices,
|
|
93462
93481
|
captureOrMergeBaseline,
|
|
@@ -93866,11 +93885,11 @@ var sast_scan = createSwarmTool({
|
|
|
93866
93885
|
capture_baseline: safeArgs.capture_baseline,
|
|
93867
93886
|
phase: safeArgs.phase
|
|
93868
93887
|
};
|
|
93869
|
-
const result = await
|
|
93888
|
+
const result = await _internals41.sastScan(input, directory);
|
|
93870
93889
|
return JSON.stringify(result, null, 2);
|
|
93871
93890
|
}
|
|
93872
93891
|
});
|
|
93873
|
-
var
|
|
93892
|
+
var _internals41 = {
|
|
93874
93893
|
sastScan,
|
|
93875
93894
|
sast_scan
|
|
93876
93895
|
};
|
|
@@ -99053,7 +99072,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
|
|
|
99053
99072
|
}
|
|
99054
99073
|
async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
|
|
99055
99074
|
const lanes = await listLaneEvidence(directory, phase);
|
|
99056
|
-
const persisted =
|
|
99075
|
+
const persisted = _internals42.readPersisted?.(directory) ?? null;
|
|
99057
99076
|
if (persisted) {
|
|
99058
99077
|
let matchingRunState = null;
|
|
99059
99078
|
for (const sessionState of Object.values(persisted.sessions)) {
|
|
@@ -99245,7 +99264,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
|
|
|
99245
99264
|
client.session.delete({ path: { id: sessionId } }).catch(() => {});
|
|
99246
99265
|
}
|
|
99247
99266
|
}
|
|
99248
|
-
var
|
|
99267
|
+
var _internals42 = {
|
|
99249
99268
|
compileReviewPackage,
|
|
99250
99269
|
parseReviewerVerdict,
|
|
99251
99270
|
writeReviewerEvidence,
|
|
@@ -99262,28 +99281,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
|
|
|
99262
99281
|
};
|
|
99263
99282
|
const generatedAgentNames = swarmState.generatedAgentNames;
|
|
99264
99283
|
const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
|
|
99265
|
-
const pkg = await
|
|
99284
|
+
const pkg = await _internals42.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
|
|
99266
99285
|
let responseText;
|
|
99267
99286
|
try {
|
|
99268
|
-
responseText = await
|
|
99287
|
+
responseText = await _internals42.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
|
|
99269
99288
|
} catch (error93) {
|
|
99270
|
-
const evidencePath2 = await
|
|
99289
|
+
const evidencePath2 = await _internals42.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
|
|
99271
99290
|
return {
|
|
99272
99291
|
verdict: "REJECTED",
|
|
99273
99292
|
reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
|
|
99274
99293
|
evidencePath: evidencePath2
|
|
99275
99294
|
};
|
|
99276
99295
|
}
|
|
99277
|
-
const parsed =
|
|
99296
|
+
const parsed = _internals42.parseReviewerVerdict(responseText);
|
|
99278
99297
|
if (!parsed) {
|
|
99279
|
-
const evidencePath2 = await
|
|
99298
|
+
const evidencePath2 = await _internals42.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
|
|
99280
99299
|
return {
|
|
99281
99300
|
verdict: "REJECTED",
|
|
99282
99301
|
reason: "Reviewer response could not be parsed",
|
|
99283
99302
|
evidencePath: evidencePath2
|
|
99284
99303
|
};
|
|
99285
99304
|
}
|
|
99286
|
-
const evidencePath = await
|
|
99305
|
+
const evidencePath = await _internals42.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
|
|
99287
99306
|
return {
|
|
99288
99307
|
verdict: parsed.verdict,
|
|
99289
99308
|
reason: parsed.reason,
|
|
@@ -99789,7 +99808,7 @@ ${fileList}
|
|
|
99789
99808
|
|
|
99790
99809
|
// src/tools/lean-turbo-run-phase.ts
|
|
99791
99810
|
init_create_tool();
|
|
99792
|
-
var
|
|
99811
|
+
var _internals43 = {
|
|
99793
99812
|
LeanTurboRunner,
|
|
99794
99813
|
loadPluginConfigWithMeta
|
|
99795
99814
|
};
|
|
@@ -99799,9 +99818,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
99799
99818
|
let runError = null;
|
|
99800
99819
|
let runner = null;
|
|
99801
99820
|
try {
|
|
99802
|
-
const { config: config3 } =
|
|
99821
|
+
const { config: config3 } = _internals43.loadPluginConfigWithMeta(directory);
|
|
99803
99822
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
99804
|
-
runner = new
|
|
99823
|
+
runner = new _internals43.LeanTurboRunner({
|
|
99805
99824
|
directory,
|
|
99806
99825
|
sessionID,
|
|
99807
99826
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -100155,7 +100174,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
100155
100174
|
const strippedMutated = stripCode(mutatedCode);
|
|
100156
100175
|
return strippedOriginal === strippedMutated;
|
|
100157
100176
|
}
|
|
100158
|
-
var
|
|
100177
|
+
var _internals44 = {
|
|
100159
100178
|
isStaticallyEquivalent,
|
|
100160
100179
|
checkEquivalence,
|
|
100161
100180
|
batchCheckEquivalence
|
|
@@ -100195,7 +100214,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
100195
100214
|
const results = [];
|
|
100196
100215
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
100197
100216
|
try {
|
|
100198
|
-
const result = await
|
|
100217
|
+
const result = await _internals44.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
100199
100218
|
results.push(result);
|
|
100200
100219
|
} catch (err3) {
|
|
100201
100220
|
results.push({
|
|
@@ -100495,7 +100514,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
100495
100514
|
}
|
|
100496
100515
|
|
|
100497
100516
|
// src/mutation/gate.ts
|
|
100498
|
-
var
|
|
100517
|
+
var _internals45 = {
|
|
100499
100518
|
evaluateMutationGate,
|
|
100500
100519
|
buildTestImprovementPrompt,
|
|
100501
100520
|
buildMessage
|
|
@@ -100516,8 +100535,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
100516
100535
|
} else {
|
|
100517
100536
|
verdict = "fail";
|
|
100518
100537
|
}
|
|
100519
|
-
const testImprovementPrompt =
|
|
100520
|
-
const message =
|
|
100538
|
+
const testImprovementPrompt = _internals45.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
100539
|
+
const message = _internals45.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
100521
100540
|
return {
|
|
100522
100541
|
verdict,
|
|
100523
100542
|
killRate: report.killRate,
|
|
@@ -101134,7 +101153,7 @@ import * as path131 from "node:path";
|
|
|
101134
101153
|
init_bun_compat();
|
|
101135
101154
|
import * as fs102 from "node:fs";
|
|
101136
101155
|
import * as path130 from "node:path";
|
|
101137
|
-
var
|
|
101156
|
+
var _internals46 = { bunSpawn };
|
|
101138
101157
|
var _swarmGitExcludedChecked = false;
|
|
101139
101158
|
function fileCoversSwarm(content) {
|
|
101140
101159
|
for (const rawLine of content.split(`
|
|
@@ -101167,7 +101186,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
101167
101186
|
checkIgnoreExitCode
|
|
101168
101187
|
] = await Promise.all([
|
|
101169
101188
|
(async () => {
|
|
101170
|
-
const proc =
|
|
101189
|
+
const proc = _internals46.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
101171
101190
|
try {
|
|
101172
101191
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
101173
101192
|
} finally {
|
|
@@ -101177,7 +101196,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
101177
101196
|
}
|
|
101178
101197
|
})(),
|
|
101179
101198
|
(async () => {
|
|
101180
|
-
const proc =
|
|
101199
|
+
const proc = _internals46.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
101181
101200
|
try {
|
|
101182
101201
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
101183
101202
|
} finally {
|
|
@@ -101187,7 +101206,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
101187
101206
|
}
|
|
101188
101207
|
})(),
|
|
101189
101208
|
(async () => {
|
|
101190
|
-
const proc =
|
|
101209
|
+
const proc = _internals46.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
101191
101210
|
try {
|
|
101192
101211
|
return await proc.exited;
|
|
101193
101212
|
} finally {
|
|
@@ -101226,7 +101245,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
101226
101245
|
}
|
|
101227
101246
|
} catch {}
|
|
101228
101247
|
}
|
|
101229
|
-
const trackedProc =
|
|
101248
|
+
const trackedProc = _internals46.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
101230
101249
|
let trackedExitCode;
|
|
101231
101250
|
let trackedOutput;
|
|
101232
101251
|
try {
|
|
@@ -101251,7 +101270,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
101251
101270
|
}
|
|
101252
101271
|
|
|
101253
101272
|
// src/hooks/diff-scope.ts
|
|
101254
|
-
var
|
|
101273
|
+
var _internals47 = { bunSpawn };
|
|
101255
101274
|
function getDeclaredScope(taskId, directory) {
|
|
101256
101275
|
try {
|
|
101257
101276
|
const planPath = path131.join(directory, ".swarm", "plan.json");
|
|
@@ -101286,7 +101305,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
101286
101305
|
};
|
|
101287
101306
|
async function getChangedFiles(directory) {
|
|
101288
101307
|
try {
|
|
101289
|
-
const proc =
|
|
101308
|
+
const proc = _internals47.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
101290
101309
|
cwd: directory,
|
|
101291
101310
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
101292
101311
|
});
|
|
@@ -101303,7 +101322,7 @@ async function getChangedFiles(directory) {
|
|
|
101303
101322
|
return stdout.trim().split(`
|
|
101304
101323
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
101305
101324
|
}
|
|
101306
|
-
const proc2 =
|
|
101325
|
+
const proc2 = _internals47.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
101307
101326
|
cwd: directory,
|
|
101308
101327
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
101309
101328
|
});
|
|
@@ -101361,7 +101380,7 @@ init_telemetry();
|
|
|
101361
101380
|
init_file_locks();
|
|
101362
101381
|
import * as fs104 from "node:fs";
|
|
101363
101382
|
import * as path132 from "node:path";
|
|
101364
|
-
var
|
|
101383
|
+
var _internals48 = {
|
|
101365
101384
|
listActiveLocks,
|
|
101366
101385
|
verifyLeanTurboTaskCompletion
|
|
101367
101386
|
};
|
|
@@ -101503,7 +101522,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
101503
101522
|
}
|
|
101504
101523
|
};
|
|
101505
101524
|
}
|
|
101506
|
-
const activeLocks =
|
|
101525
|
+
const activeLocks = _internals48.listActiveLocks(directory);
|
|
101507
101526
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
101508
101527
|
if (laneLocks.length > 0) {
|
|
101509
101528
|
return {
|
|
@@ -102426,6 +102445,7 @@ var write_drift_evidence = createSwarmTool({
|
|
|
102426
102445
|
// src/tools/write-final-council-evidence.ts
|
|
102427
102446
|
init_zod();
|
|
102428
102447
|
init_loader();
|
|
102448
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
102429
102449
|
import fs107 from "node:fs";
|
|
102430
102450
|
import path135 from "node:path";
|
|
102431
102451
|
init_utils2();
|
|
@@ -102462,6 +102482,90 @@ var ArgsSchema6 = exports_external.object({
|
|
|
102462
102482
|
function normalizeFinalVerdict(verdict) {
|
|
102463
102483
|
return verdict === "APPROVE" ? "approved" : "rejected";
|
|
102464
102484
|
}
|
|
102485
|
+
var replacementLocks = new Map;
|
|
102486
|
+
var _internals49 = {
|
|
102487
|
+
loadPluginConfig,
|
|
102488
|
+
synthesizeFinalCouncilAdvisory,
|
|
102489
|
+
loadPlan,
|
|
102490
|
+
derivePlanId,
|
|
102491
|
+
validateSwarmPath
|
|
102492
|
+
};
|
|
102493
|
+
function getErrnoCode(error93) {
|
|
102494
|
+
return error93 && typeof error93 === "object" ? error93.code : undefined;
|
|
102495
|
+
}
|
|
102496
|
+
async function replaceEvidenceFile(tempPath, finalPath) {
|
|
102497
|
+
const previous = replacementLocks.get(finalPath)?.catch(() => {});
|
|
102498
|
+
let release;
|
|
102499
|
+
const current = new Promise((resolve51) => {
|
|
102500
|
+
release = resolve51;
|
|
102501
|
+
});
|
|
102502
|
+
replacementLocks.set(finalPath, current);
|
|
102503
|
+
if (previous) {
|
|
102504
|
+
await previous;
|
|
102505
|
+
}
|
|
102506
|
+
try {
|
|
102507
|
+
await replaceEvidenceFileLocked(tempPath, finalPath);
|
|
102508
|
+
} finally {
|
|
102509
|
+
release();
|
|
102510
|
+
if (replacementLocks.get(finalPath) === current) {
|
|
102511
|
+
replacementLocks.delete(finalPath);
|
|
102512
|
+
}
|
|
102513
|
+
}
|
|
102514
|
+
}
|
|
102515
|
+
async function replaceEvidenceFileLocked(tempPath, finalPath) {
|
|
102516
|
+
try {
|
|
102517
|
+
await fs107.promises.rename(tempPath, finalPath);
|
|
102518
|
+
return;
|
|
102519
|
+
} catch (error93) {
|
|
102520
|
+
const code = getErrnoCode(error93);
|
|
102521
|
+
if (!["EEXIST", "EPERM", "EACCES"].includes(code ?? "")) {
|
|
102522
|
+
throw error93;
|
|
102523
|
+
}
|
|
102524
|
+
}
|
|
102525
|
+
const backupPath = `${finalPath}.${randomUUID9()}.bak`;
|
|
102526
|
+
let backupCreated = false;
|
|
102527
|
+
try {
|
|
102528
|
+
try {
|
|
102529
|
+
await fs107.promises.rename(finalPath, backupPath);
|
|
102530
|
+
backupCreated = true;
|
|
102531
|
+
} catch (error93) {
|
|
102532
|
+
if (getErrnoCode(error93) !== "ENOENT") {
|
|
102533
|
+
throw error93;
|
|
102534
|
+
}
|
|
102535
|
+
}
|
|
102536
|
+
try {
|
|
102537
|
+
await fs107.promises.rename(tempPath, finalPath);
|
|
102538
|
+
} catch (error93) {
|
|
102539
|
+
if (backupCreated) {
|
|
102540
|
+
if (!await restoreEvidenceBackup(backupPath, finalPath)) {
|
|
102541
|
+
await fs107.promises.rm(backupPath, { force: true }).catch(() => {});
|
|
102542
|
+
}
|
|
102543
|
+
backupCreated = false;
|
|
102544
|
+
}
|
|
102545
|
+
throw error93;
|
|
102546
|
+
}
|
|
102547
|
+
if (backupCreated) {
|
|
102548
|
+
await fs107.promises.rm(backupPath, { force: true }).catch(() => {});
|
|
102549
|
+
backupCreated = false;
|
|
102550
|
+
}
|
|
102551
|
+
} finally {
|
|
102552
|
+
await fs107.promises.rm(tempPath, { force: true }).catch(() => {});
|
|
102553
|
+
}
|
|
102554
|
+
}
|
|
102555
|
+
async function restoreEvidenceBackup(backupPath, finalPath) {
|
|
102556
|
+
try {
|
|
102557
|
+
await fs107.promises.rename(backupPath, finalPath);
|
|
102558
|
+
return true;
|
|
102559
|
+
} catch {
|
|
102560
|
+
try {
|
|
102561
|
+
await fs107.promises.copyFile(backupPath, finalPath);
|
|
102562
|
+
await fs107.promises.rm(backupPath, { force: true }).catch(() => {});
|
|
102563
|
+
return true;
|
|
102564
|
+
} catch {
|
|
102565
|
+
return false;
|
|
102566
|
+
}
|
|
102567
|
+
}
|
|
102568
|
+
}
|
|
102465
102569
|
async function executeWriteFinalCouncilEvidence(args2, directory) {
|
|
102466
102570
|
const parsed = ArgsSchema6.safeParse(args2);
|
|
102467
102571
|
if (!parsed.success) {
|
|
@@ -102475,7 +102579,7 @@ async function executeWriteFinalCouncilEvidence(args2, directory) {
|
|
|
102475
102579
|
}, null, 2);
|
|
102476
102580
|
}
|
|
102477
102581
|
const input = parsed.data;
|
|
102478
|
-
const config3 = loadPluginConfig(directory);
|
|
102582
|
+
const config3 = _internals49.loadPluginConfig(directory);
|
|
102479
102583
|
const requiredMembers = FINAL_COUNCIL_MEMBERS.length;
|
|
102480
102584
|
const distinctMembers = new Set(input.verdicts.map((v) => v.agent));
|
|
102481
102585
|
const membersVoted = [...distinctMembers];
|
|
@@ -102490,9 +102594,27 @@ async function executeWriteFinalCouncilEvidence(args2, directory) {
|
|
|
102490
102594
|
quorumRequired: requiredMembers
|
|
102491
102595
|
}, null, 2);
|
|
102492
102596
|
}
|
|
102493
|
-
|
|
102494
|
-
|
|
102495
|
-
|
|
102597
|
+
let synthesis;
|
|
102598
|
+
try {
|
|
102599
|
+
synthesis = _internals49.synthesizeFinalCouncilAdvisory(input.projectSummary.trim(), input.verdicts, input.roundNumber ?? 1, config3.council);
|
|
102600
|
+
} catch (error93) {
|
|
102601
|
+
return JSON.stringify({
|
|
102602
|
+
success: false,
|
|
102603
|
+
phase: input.phase,
|
|
102604
|
+
message: error93 instanceof Error ? error93.message : "Failed to synthesize final council evidence"
|
|
102605
|
+
}, null, 2);
|
|
102606
|
+
}
|
|
102607
|
+
let planId = "unknown";
|
|
102608
|
+
try {
|
|
102609
|
+
const plan = await _internals49.loadPlan(directory);
|
|
102610
|
+
planId = plan ? _internals49.derivePlanId(plan) : "unknown";
|
|
102611
|
+
} catch (error93) {
|
|
102612
|
+
return JSON.stringify({
|
|
102613
|
+
success: false,
|
|
102614
|
+
phase: input.phase,
|
|
102615
|
+
message: error93 instanceof Error ? error93.message : "Failed to load project plan"
|
|
102616
|
+
}, null, 2);
|
|
102617
|
+
}
|
|
102496
102618
|
const normalizedVerdict = normalizeFinalVerdict(synthesis.overallVerdict);
|
|
102497
102619
|
const evidenceEntry = {
|
|
102498
102620
|
type: "final-council",
|
|
@@ -102518,7 +102640,7 @@ async function executeWriteFinalCouncilEvidence(args2, directory) {
|
|
|
102518
102640
|
const relativePath = path135.join("evidence", filename);
|
|
102519
102641
|
let validatedPath;
|
|
102520
102642
|
try {
|
|
102521
|
-
validatedPath = validateSwarmPath(directory, relativePath);
|
|
102643
|
+
validatedPath = _internals49.validateSwarmPath(directory, relativePath);
|
|
102522
102644
|
} catch (error93) {
|
|
102523
102645
|
return JSON.stringify({
|
|
102524
102646
|
success: false,
|
|
@@ -102532,9 +102654,9 @@ async function executeWriteFinalCouncilEvidence(args2, directory) {
|
|
|
102532
102654
|
const evidenceDir = path135.dirname(validatedPath);
|
|
102533
102655
|
try {
|
|
102534
102656
|
await fs107.promises.mkdir(evidenceDir, { recursive: true });
|
|
102535
|
-
const tempPath = path135.join(evidenceDir, `.${filename}.tmp`);
|
|
102657
|
+
const tempPath = path135.join(evidenceDir, `.${filename}.${randomUUID9()}.tmp`);
|
|
102536
102658
|
await fs107.promises.writeFile(tempPath, JSON.stringify(evidenceContent, null, 2), "utf-8");
|
|
102537
|
-
await
|
|
102659
|
+
await replaceEvidenceFile(tempPath, validatedPath);
|
|
102538
102660
|
return JSON.stringify({
|
|
102539
102661
|
success: true,
|
|
102540
102662
|
phase: input.phase,
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
+
import { loadPluginConfig } from '../config/loader';
|
|
11
|
+
import { synthesizeFinalCouncilAdvisory } from '../council/council-service';
|
|
10
12
|
import type { CouncilMemberVerdict } from '../council/types';
|
|
13
|
+
import { validateSwarmPath } from '../hooks/utils';
|
|
14
|
+
import { loadPlan } from '../plan/manager.js';
|
|
15
|
+
import { derivePlanId } from '../plan/utils.js';
|
|
11
16
|
export declare const ArgsSchema: z.ZodObject<{
|
|
12
17
|
phase: z.ZodNumber;
|
|
13
18
|
projectSummary: z.ZodString;
|
|
@@ -55,6 +60,13 @@ export interface WriteFinalCouncilEvidenceArgs {
|
|
|
55
60
|
/** Collected verdicts from critic, reviewer, sme, test_engineer, explorer */
|
|
56
61
|
verdicts: CouncilMemberVerdict[];
|
|
57
62
|
}
|
|
63
|
+
export declare const _internals: {
|
|
64
|
+
loadPluginConfig: typeof loadPluginConfig;
|
|
65
|
+
synthesizeFinalCouncilAdvisory: typeof synthesizeFinalCouncilAdvisory;
|
|
66
|
+
loadPlan: typeof loadPlan;
|
|
67
|
+
derivePlanId: typeof derivePlanId;
|
|
68
|
+
validateSwarmPath: typeof validateSwarmPath;
|
|
69
|
+
};
|
|
58
70
|
/**
|
|
59
71
|
* Execute the write_final_council_evidence tool.
|
|
60
72
|
* Validates input, synthesizes project-scoped council evidence, and writes it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.17.
|
|
3
|
+
"version": "7.17.4",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|