opencode-swarm 7.99.0 → 7.99.2
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/brainstorm/SKILL.md +11 -1
- package/.opencode/skills/loop/SKILL.md +13 -4
- package/.opencode/skills/plan/SKILL.md +8 -1
- package/.opencode/skills/specify/SKILL.md +4 -2
- package/README.md +5 -3
- package/dist/agents/_prompt-helpers.d.ts +1 -0
- package/dist/cli/{evidence-summary-service-4hs44n2c.js → evidence-summary-service-wxarfgt8.js} +2 -2
- package/dist/cli/{explorer-jc46negv.js → explorer-rwfvbbx5.js} +1 -1
- package/dist/cli/{guardrail-explain-ktm6szbm.js → guardrail-explain-t3prwa5b.js} +6 -6
- package/dist/cli/{index-hw8r3e5p.js → index-62tmq1kc.js} +212 -109
- package/dist/cli/{index-wwnjw0fb.js → index-6wgwybzj.js} +27 -14
- package/dist/cli/{index-we94wkty.js → index-94qwbx11.js} +48 -0
- package/dist/cli/{index-4pt2py5p.js → index-ryns3fqt.js} +6 -6
- package/dist/cli/{index-5fxjagjt.js → index-s3esnz7m.js} +1 -1
- package/dist/cli/{index-ft4gehk1.js → index-y4stbk2f.js} +1 -1
- package/dist/cli/{index-2a6ppa65.js → index-ydgy7vg5.js} +12 -7
- package/dist/cli/index.js +5 -5
- package/dist/cli/{pending-delegations-c785p5n2.js → pending-delegations-vh2nae3n.js} +1 -1
- package/dist/cli/{pr-subscriptions-fqrzm0tv.js → pr-subscriptions-d57tq0c0.js} +2 -2
- package/dist/commands/loop.d.ts +5 -0
- package/dist/commands/registry.d.ts +5 -2
- package/dist/db/qa-gate-profile.d.ts +10 -0
- package/dist/evidence/manager.d.ts +5 -0
- package/dist/hooks/auto-review.d.ts +1 -1
- package/dist/hooks/knowledge-migrator.d.ts +7 -0
- package/dist/index.js +2265 -2033
- package/dist/plan/utils.d.ts +8 -3
- package/dist/tools/dispatch-lanes.d.ts +14 -0
- package/dist/tools/phase-complete/gates/gate-helpers.d.ts +2 -0
- package/dist/tools/phase-complete/gates/types.d.ts +4 -0
- package/dist/turbo/lean/conflicts.d.ts +2 -13
- package/dist/utils/path.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
READ_ONLY_LANE_GUIDANCE
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ydgy7vg5.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_SKILL_MIN_CONFIDENCE,
|
|
7
7
|
DEFAULT_SKILL_MIN_CONFIRMATIONS,
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
transientBackoff,
|
|
115
115
|
validateProjectRoot,
|
|
116
116
|
writeProjectedSpecSync
|
|
117
|
-
} from "./index-
|
|
117
|
+
} from "./index-6wgwybzj.js";
|
|
118
118
|
import {
|
|
119
119
|
_internals as _internals2,
|
|
120
120
|
_internals1 as _internals3,
|
|
@@ -138,12 +138,12 @@ import {
|
|
|
138
138
|
listActive,
|
|
139
139
|
subscribe,
|
|
140
140
|
unsubscribe
|
|
141
|
-
} from "./index-
|
|
141
|
+
} from "./index-s3esnz7m.js";
|
|
142
142
|
import {
|
|
143
143
|
readSwarmFileAsync,
|
|
144
144
|
safeHook,
|
|
145
145
|
validateSwarmPath
|
|
146
|
-
} from "./index-
|
|
146
|
+
} from "./index-94qwbx11.js";
|
|
147
147
|
import {
|
|
148
148
|
deepMerge
|
|
149
149
|
} from "./index-p0arc26j.js";
|
|
@@ -909,7 +909,7 @@ var init_executor = __esm(() => {
|
|
|
909
909
|
// package.json
|
|
910
910
|
var package_default = {
|
|
911
911
|
name: "opencode-swarm",
|
|
912
|
-
version: "7.99.
|
|
912
|
+
version: "7.99.2",
|
|
913
913
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
914
914
|
main: "dist/index.js",
|
|
915
915
|
types: "dist/index.d.ts",
|
|
@@ -1668,7 +1668,8 @@ var _internals4 = {
|
|
|
1668
1668
|
getOrCreateProfile,
|
|
1669
1669
|
setGates,
|
|
1670
1670
|
getEffectiveGates,
|
|
1671
|
-
computeProfileHash
|
|
1671
|
+
computeProfileHash,
|
|
1672
|
+
hasAnyProfileWithEnabledGate
|
|
1672
1673
|
};
|
|
1673
1674
|
var DEFAULT_QA_GATES = {
|
|
1674
1675
|
reviewer: true,
|
|
@@ -1723,6 +1724,20 @@ function getProfile(directory, planId) {
|
|
|
1723
1724
|
const row = db.query("SELECT * FROM qa_gate_profile WHERE plan_id = ?").get(planId);
|
|
1724
1725
|
return row ? rowToProfile(row) : null;
|
|
1725
1726
|
}
|
|
1727
|
+
function hasAnyProfileWithEnabledGate(directory, gate) {
|
|
1728
|
+
if (!projectDbExists(directory))
|
|
1729
|
+
return false;
|
|
1730
|
+
const db = getProjectDb(directory);
|
|
1731
|
+
const rows = db.query("SELECT gates FROM qa_gate_profile").all();
|
|
1732
|
+
for (const row of rows) {
|
|
1733
|
+
try {
|
|
1734
|
+
const parsed = JSON.parse(row.gates);
|
|
1735
|
+
if (parsed?.[gate] === true)
|
|
1736
|
+
return true;
|
|
1737
|
+
} catch {}
|
|
1738
|
+
}
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1726
1741
|
function getOrCreateProfile(directory, planId, projectType) {
|
|
1727
1742
|
const existing = _internals4.getProfile(directory, planId);
|
|
1728
1743
|
if (existing)
|
|
@@ -3738,6 +3753,9 @@ function clearAllScopes(directory) {
|
|
|
3738
3753
|
// src/hooks/shell-write-detect.ts
|
|
3739
3754
|
import * as path8 from "path";
|
|
3740
3755
|
import parse from "bash-parser";
|
|
3756
|
+
function buildDedupeKey(category, operator, path9) {
|
|
3757
|
+
return `${category}|${operator}|${path9 ?? "null"}`;
|
|
3758
|
+
}
|
|
3741
3759
|
var REDIRECT_WRITE_TOKENS = new Set([
|
|
3742
3760
|
"GREAT",
|
|
3743
3761
|
"DGREAT",
|
|
@@ -4756,7 +4774,7 @@ function detectPosixWrites(command) {
|
|
|
4756
4774
|
}
|
|
4757
4775
|
const seen = new Set;
|
|
4758
4776
|
const writes = allWrites.filter((wt) => {
|
|
4759
|
-
const key =
|
|
4777
|
+
const key = buildDedupeKey(wt.category, wt.operator, wt.path);
|
|
4760
4778
|
if (seen.has(key))
|
|
4761
4779
|
return false;
|
|
4762
4780
|
seen.add(key);
|
|
@@ -4781,7 +4799,7 @@ function detectWindowsWrites(command, shell) {
|
|
|
4781
4799
|
}
|
|
4782
4800
|
const seen = new Set;
|
|
4783
4801
|
const writes = allWrites.filter((wt) => {
|
|
4784
|
-
const key =
|
|
4802
|
+
const key = buildDedupeKey(wt.category, wt.operator, wt.path);
|
|
4785
4803
|
if (seen.has(key))
|
|
4786
4804
|
return false;
|
|
4787
4805
|
seen.add(key);
|
|
@@ -5036,7 +5054,7 @@ function resolveWriteTargets(command, writes, cwd) {
|
|
|
5036
5054
|
collectWritesWithNodes(ast, writesWithNodes, cwdStack);
|
|
5037
5055
|
const seen = new Set;
|
|
5038
5056
|
const deduplicated = writesWithNodes.filter((wwn) => {
|
|
5039
|
-
const key =
|
|
5057
|
+
const key = buildDedupeKey(wwn.write.category, wwn.write.operator, wwn.write.path);
|
|
5040
5058
|
if (seen.has(key))
|
|
5041
5059
|
return false;
|
|
5042
5060
|
seen.add(key);
|
|
@@ -5046,11 +5064,11 @@ function resolveWriteTargets(command, writes, cwd) {
|
|
|
5046
5064
|
for (const { write, context } of deduplicated) {
|
|
5047
5065
|
const resolvedPath = resolvePath(write.path, context);
|
|
5048
5066
|
const resolved = write.path !== null && !isDynamicPath(write.path);
|
|
5049
|
-
const key =
|
|
5067
|
+
const key = buildDedupeKey(write.category, write.operator, write.path);
|
|
5050
5068
|
resolvedMap.set(key, { resolvedPath, resolved });
|
|
5051
5069
|
}
|
|
5052
5070
|
return writes.map((original) => {
|
|
5053
|
-
const key =
|
|
5071
|
+
const key = buildDedupeKey(original.category, original.operator, original.path);
|
|
5054
5072
|
const resolved = resolvedMap.get(key);
|
|
5055
5073
|
if (resolved) {
|
|
5056
5074
|
return {
|
|
@@ -5996,7 +6014,7 @@ function hasActiveEpicMode(sessionID) {
|
|
|
5996
6014
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
5997
6015
|
const map = new Map;
|
|
5998
6016
|
try {
|
|
5999
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
6017
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-d57tq0c0.js");
|
|
6000
6018
|
const records = await listActive2(directory);
|
|
6001
6019
|
for (const record of records) {
|
|
6002
6020
|
if (record.sessionID !== sessionID)
|
|
@@ -7650,7 +7668,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
7650
7668
|
let reportContent;
|
|
7651
7669
|
if (options.llmDelegate) {
|
|
7652
7670
|
try {
|
|
7653
|
-
const { CURATOR_POSTMORTEM_PROMPT: CURATOR_POSTMORTEM_PROMPT2 } = await import("./explorer-
|
|
7671
|
+
const { CURATOR_POSTMORTEM_PROMPT: CURATOR_POSTMORTEM_PROMPT2 } = await import("./explorer-rwfvbbx5.js");
|
|
7654
7672
|
const userInput = assembleLLMInput(effectivePlanId, planSummary, knowledgeSummary, curatorDigest, proposals, unactionable, retrospectives, driftReports);
|
|
7655
7673
|
const ac = new AbortController;
|
|
7656
7674
|
const timer = setTimeout(() => ac.abort(), 300000);
|
|
@@ -17914,7 +17932,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
17914
17932
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
17915
17933
|
}
|
|
17916
17934
|
async function handleEvidenceSummaryCommand(directory) {
|
|
17917
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
17935
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-wxarfgt8.js");
|
|
17918
17936
|
const artifact = await buildEvidenceSummary(directory);
|
|
17919
17937
|
if (!artifact) {
|
|
17920
17938
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -19424,12 +19442,50 @@ var KNOWLEDGE_SCHEMA_VERSION = 2;
|
|
|
19424
19442
|
|
|
19425
19443
|
// src/hooks/knowledge-migrator.ts
|
|
19426
19444
|
async function migrateKnowledgeToExternal(_directory, _config) {
|
|
19445
|
+
const externalSentinelPath = path39.join(_directory, ".swarm", ".knowledge-external-migrated");
|
|
19446
|
+
const contextPath = path39.join(_directory, ".swarm", "context.md");
|
|
19447
|
+
if (_internals30.existsSync(externalSentinelPath)) {
|
|
19448
|
+
return {
|
|
19449
|
+
migrated: false,
|
|
19450
|
+
entriesMigrated: 0,
|
|
19451
|
+
entriesDropped: 0,
|
|
19452
|
+
entriesTotal: 0,
|
|
19453
|
+
skippedReason: "external-sentinel-exists"
|
|
19454
|
+
};
|
|
19455
|
+
}
|
|
19456
|
+
if (!_internals30.existsSync(contextPath)) {
|
|
19457
|
+
return {
|
|
19458
|
+
migrated: false,
|
|
19459
|
+
entriesMigrated: 0,
|
|
19460
|
+
entriesDropped: 0,
|
|
19461
|
+
entriesTotal: 0,
|
|
19462
|
+
skippedReason: "no-context-file"
|
|
19463
|
+
};
|
|
19464
|
+
}
|
|
19465
|
+
const contextContent = await _internals30.readFile(contextPath, "utf-8");
|
|
19466
|
+
if (contextContent.trim().length === 0) {
|
|
19467
|
+
return {
|
|
19468
|
+
migrated: false,
|
|
19469
|
+
entriesMigrated: 0,
|
|
19470
|
+
entriesDropped: 0,
|
|
19471
|
+
entriesTotal: 0,
|
|
19472
|
+
skippedReason: "empty-context"
|
|
19473
|
+
};
|
|
19474
|
+
}
|
|
19475
|
+
const lines = contextContent.split(`
|
|
19476
|
+
`);
|
|
19477
|
+
let entriesCount = 0;
|
|
19478
|
+
for (const line of lines) {
|
|
19479
|
+
if (line.trimStart().startsWith("- ")) {
|
|
19480
|
+
entriesCount++;
|
|
19481
|
+
}
|
|
19482
|
+
}
|
|
19483
|
+
await _internals30.writeSentinel(externalSentinelPath, entriesCount, entriesCount);
|
|
19427
19484
|
return {
|
|
19428
|
-
migrated:
|
|
19429
|
-
entriesMigrated:
|
|
19485
|
+
migrated: true,
|
|
19486
|
+
entriesMigrated: entriesCount,
|
|
19430
19487
|
entriesDropped: 0,
|
|
19431
|
-
entriesTotal:
|
|
19432
|
-
skippedReason: "no-context-file"
|
|
19488
|
+
entriesTotal: entriesCount
|
|
19433
19489
|
};
|
|
19434
19490
|
}
|
|
19435
19491
|
var _internals30 = {
|
|
@@ -19444,7 +19500,12 @@ var _internals30 = {
|
|
|
19444
19500
|
truncateLesson: truncateLesson2,
|
|
19445
19501
|
inferProjectName,
|
|
19446
19502
|
writeSentinel,
|
|
19447
|
-
resolveLegacyHiveKnowledgePath
|
|
19503
|
+
resolveLegacyHiveKnowledgePath,
|
|
19504
|
+
existsSync: existsSync23,
|
|
19505
|
+
readFileSync: readFileSync15,
|
|
19506
|
+
readFile: readFile11,
|
|
19507
|
+
mkdir: mkdir9,
|
|
19508
|
+
writeFile: writeFile9
|
|
19448
19509
|
};
|
|
19449
19510
|
async function migrateContextToKnowledge(directory, config) {
|
|
19450
19511
|
const sentinelPath = path39.join(directory, ".swarm", ".knowledge-migrated");
|
|
@@ -19782,8 +19843,8 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
19782
19843
|
schema_version: 1,
|
|
19783
19844
|
migration_tool: "knowledge-migrator.ts"
|
|
19784
19845
|
};
|
|
19785
|
-
await
|
|
19786
|
-
await
|
|
19846
|
+
await _internals30.mkdir(path39.dirname(sentinelPath), { recursive: true });
|
|
19847
|
+
await _internals30.writeFile(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
19787
19848
|
}
|
|
19788
19849
|
function resolveLegacyHiveKnowledgePath() {
|
|
19789
19850
|
const platform = process.platform;
|
|
@@ -20262,10 +20323,45 @@ var MAX_OBJECTIVE_LEN = 2000;
|
|
|
20262
20323
|
var DEPTHS2 = new Set(["standard", "exhaustive"]);
|
|
20263
20324
|
var AUTONOMY_LEVELS = new Set(["checkpoint", "auto"]);
|
|
20264
20325
|
var DEFAULT_DEPTH2 = "standard";
|
|
20265
|
-
var DEFAULT_AUTONOMY = "
|
|
20326
|
+
var DEFAULT_AUTONOMY = "auto";
|
|
20266
20327
|
var DEFAULT_MAX_CYCLES = 3;
|
|
20267
20328
|
var MIN_MAX_CYCLES = 1;
|
|
20268
20329
|
var MAX_MAX_CYCLES = 5;
|
|
20330
|
+
async function readLatestLoopState(directory) {
|
|
20331
|
+
try {
|
|
20332
|
+
const { readdirSync: readdirSync4, statSync: statSync9, readFileSync: readFileSync16 } = await import("fs");
|
|
20333
|
+
const loopDir = `${directory}/.swarm/loop`;
|
|
20334
|
+
let latestMtime = 0;
|
|
20335
|
+
let latestPath = null;
|
|
20336
|
+
try {
|
|
20337
|
+
const entries = readdirSync4(loopDir, { withFileTypes: true });
|
|
20338
|
+
for (const entry of entries) {
|
|
20339
|
+
if (!entry.isDirectory())
|
|
20340
|
+
continue;
|
|
20341
|
+
const statePath = `${loopDir}/${entry.name}/state.json`;
|
|
20342
|
+
try {
|
|
20343
|
+
const mtime = statSync9(statePath).mtimeMs;
|
|
20344
|
+
if (mtime > latestMtime) {
|
|
20345
|
+
latestMtime = mtime;
|
|
20346
|
+
latestPath = statePath;
|
|
20347
|
+
}
|
|
20348
|
+
} catch {}
|
|
20349
|
+
}
|
|
20350
|
+
} catch {
|
|
20351
|
+
return null;
|
|
20352
|
+
}
|
|
20353
|
+
if (!latestPath)
|
|
20354
|
+
return null;
|
|
20355
|
+
const raw = readFileSync16(latestPath, "utf-8");
|
|
20356
|
+
const state = JSON.parse(raw);
|
|
20357
|
+
return { autonomy: state.params?.autonomy };
|
|
20358
|
+
} catch {
|
|
20359
|
+
return null;
|
|
20360
|
+
}
|
|
20361
|
+
}
|
|
20362
|
+
var _internals32 = {
|
|
20363
|
+
readLatestLoopState
|
|
20364
|
+
};
|
|
20269
20365
|
var USAGE7 = `Usage: /swarm loop <objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]
|
|
20270
20366
|
|
|
20271
20367
|
Run a compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve,
|
|
@@ -20274,13 +20370,13 @@ iterating until the objective is met or a budget stop condition fires.
|
|
|
20274
20370
|
Examples:
|
|
20275
20371
|
/swarm loop "add rate limiting to the public API"
|
|
20276
20372
|
/swarm loop "harden auth session handling" --depth exhaustive --max-cycles 2
|
|
20277
|
-
/swarm loop "migrate config loader" --autonomy
|
|
20373
|
+
/swarm loop "migrate config loader" --autonomy checkpoint
|
|
20278
20374
|
/swarm loop --resume
|
|
20279
20375
|
|
|
20280
20376
|
Flags:
|
|
20281
20377
|
--max-cycles <N> outer improvement cycles, 1..5 (default: 3)
|
|
20282
|
-
--autonomy <level>
|
|
20283
|
-
|
|
20378
|
+
--autonomy <level> auto (default; run unattended with hard stops still
|
|
20379
|
+
enforced) or checkpoint (pause at phase gates)
|
|
20284
20380
|
--depth <name> standard (default) or exhaustive (wider exploration)
|
|
20285
20381
|
--resume resume the existing loop run from durable state in
|
|
20286
20382
|
.swarm/loop/ instead of starting a new objective`;
|
|
@@ -20299,6 +20395,7 @@ function parseArgs8(args) {
|
|
|
20299
20395
|
const result = {
|
|
20300
20396
|
maxCycles: DEFAULT_MAX_CYCLES,
|
|
20301
20397
|
autonomy: DEFAULT_AUTONOMY,
|
|
20398
|
+
autonomyExplicit: false,
|
|
20302
20399
|
depth: DEFAULT_DEPTH2,
|
|
20303
20400
|
resume: false,
|
|
20304
20401
|
rest: []
|
|
@@ -20306,7 +20403,10 @@ function parseArgs8(args) {
|
|
|
20306
20403
|
let i = 0;
|
|
20307
20404
|
while (i < args.length) {
|
|
20308
20405
|
const token = args[i];
|
|
20309
|
-
if (token === "--
|
|
20406
|
+
if (token === "--") {
|
|
20407
|
+
result.rest.push(...args.slice(i + 1));
|
|
20408
|
+
break;
|
|
20409
|
+
} else if (token === "--max-cycles") {
|
|
20310
20410
|
if (i + 1 >= args.length) {
|
|
20311
20411
|
return { ...result, error: `Flag "${token}" requires a value` };
|
|
20312
20412
|
}
|
|
@@ -20330,6 +20430,7 @@ function parseArgs8(args) {
|
|
|
20330
20430
|
};
|
|
20331
20431
|
}
|
|
20332
20432
|
result.autonomy = value;
|
|
20433
|
+
result.autonomyExplicit = true;
|
|
20333
20434
|
} else if (token === "--depth") {
|
|
20334
20435
|
if (i + 1 >= args.length) {
|
|
20335
20436
|
return { ...result, error: `Flag "${token}" requires a value` };
|
|
@@ -20345,6 +20446,11 @@ function parseArgs8(args) {
|
|
|
20345
20446
|
} else if (token === "--resume") {
|
|
20346
20447
|
result.resume = true;
|
|
20347
20448
|
} else if (token.startsWith("--")) {
|
|
20449
|
+
if (result.rest.length > 0) {
|
|
20450
|
+
result.rest.push(token);
|
|
20451
|
+
i++;
|
|
20452
|
+
continue;
|
|
20453
|
+
}
|
|
20348
20454
|
return { ...result, error: `Unknown flag "${token}"` };
|
|
20349
20455
|
} else {
|
|
20350
20456
|
result.rest.push(token);
|
|
@@ -20364,7 +20470,14 @@ ${USAGE7}`;
|
|
|
20364
20470
|
if (!objective && !parsed.resume) {
|
|
20365
20471
|
return USAGE7;
|
|
20366
20472
|
}
|
|
20367
|
-
|
|
20473
|
+
let autonomy = parsed.autonomy;
|
|
20474
|
+
if (parsed.resume && !parsed.autonomyExplicit) {
|
|
20475
|
+
const state = await _internals32.readLatestLoopState(_directory);
|
|
20476
|
+
if (state?.autonomy && AUTONOMY_LEVELS.has(state.autonomy)) {
|
|
20477
|
+
autonomy = state.autonomy;
|
|
20478
|
+
}
|
|
20479
|
+
}
|
|
20480
|
+
const header = `[MODE: LOOP max_cycles=${parsed.maxCycles} autonomy=${autonomy} depth=${parsed.depth} resume=${parsed.resume}]`;
|
|
20368
20481
|
if (!objective && parsed.resume) {
|
|
20369
20482
|
return `${header} Resume the existing compound-engineering loop from durable state in .swarm/loop/. Read the latest run state, report cycle progress, and continue from the current phase.`;
|
|
20370
20483
|
}
|
|
@@ -24141,15 +24254,15 @@ function truncate(value, maxLength) {
|
|
|
24141
24254
|
}
|
|
24142
24255
|
|
|
24143
24256
|
// src/services/plan-service.ts
|
|
24144
|
-
var
|
|
24257
|
+
var _internals33 = {
|
|
24145
24258
|
loadPlanJsonOnly,
|
|
24146
24259
|
derivePlanMarkdown,
|
|
24147
24260
|
readSwarmFileAsync
|
|
24148
24261
|
};
|
|
24149
24262
|
async function getPlanData(directory, phaseArg) {
|
|
24150
|
-
const plan = await
|
|
24263
|
+
const plan = await _internals33.loadPlanJsonOnly(directory);
|
|
24151
24264
|
if (plan) {
|
|
24152
|
-
const fullMarkdown =
|
|
24265
|
+
const fullMarkdown = _internals33.derivePlanMarkdown(plan);
|
|
24153
24266
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
24154
24267
|
return {
|
|
24155
24268
|
hasPlan: true,
|
|
@@ -24192,7 +24305,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
24192
24305
|
isLegacy: false
|
|
24193
24306
|
};
|
|
24194
24307
|
}
|
|
24195
|
-
const planContent = await
|
|
24308
|
+
const planContent = await _internals33.readSwarmFileAsync(directory, "plan.md");
|
|
24196
24309
|
if (!planContent) {
|
|
24197
24310
|
return {
|
|
24198
24311
|
hasPlan: false,
|
|
@@ -24289,7 +24402,7 @@ async function handlePlanCommand(directory, args) {
|
|
|
24289
24402
|
return formatPlanMarkdown(planData);
|
|
24290
24403
|
}
|
|
24291
24404
|
// src/commands/post-mortem.ts
|
|
24292
|
-
var
|
|
24405
|
+
var _internals34 = {
|
|
24293
24406
|
createCuratorLLMDelegate,
|
|
24294
24407
|
runCuratorPostMortem
|
|
24295
24408
|
};
|
|
@@ -24301,10 +24414,10 @@ async function handlePostMortemCommand(directory, args, options) {
|
|
|
24301
24414
|
};
|
|
24302
24415
|
if (options?.sessionID) {
|
|
24303
24416
|
try {
|
|
24304
|
-
pmOptions.llmDelegate =
|
|
24417
|
+
pmOptions.llmDelegate = _internals34.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
24305
24418
|
} catch {}
|
|
24306
24419
|
}
|
|
24307
|
-
const result = await
|
|
24420
|
+
const result = await _internals34.runCuratorPostMortem(directory, pmOptions);
|
|
24308
24421
|
const lines = [];
|
|
24309
24422
|
if (result.success) {
|
|
24310
24423
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -24459,12 +24572,12 @@ function formatRelativeTime(epochMs) {
|
|
|
24459
24572
|
const diffDays = Math.floor(diffHours / 24);
|
|
24460
24573
|
return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
24461
24574
|
}
|
|
24462
|
-
var
|
|
24575
|
+
var _internals35 = {
|
|
24463
24576
|
formatRelativeTime,
|
|
24464
24577
|
listActive
|
|
24465
24578
|
};
|
|
24466
24579
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
|
|
24467
|
-
const allActive = await
|
|
24580
|
+
const allActive = await _internals35.listActive(directory);
|
|
24468
24581
|
const allSessions = source === "cli";
|
|
24469
24582
|
const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
|
|
24470
24583
|
if (subs.length === 0) {
|
|
@@ -24602,7 +24715,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
24602
24715
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
24603
24716
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
24604
24717
|
try {
|
|
24605
|
-
const config =
|
|
24718
|
+
const config = _internals36.loadPluginConfig(directory);
|
|
24606
24719
|
const prMonitorConfig = config.pr_monitor;
|
|
24607
24720
|
if (!prMonitorConfig?.enabled) {
|
|
24608
24721
|
return [
|
|
@@ -24612,7 +24725,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
24612
24725
|
].join(`
|
|
24613
24726
|
`);
|
|
24614
24727
|
}
|
|
24615
|
-
await
|
|
24728
|
+
await _internals36.subscribe(directory, {
|
|
24616
24729
|
sessionID,
|
|
24617
24730
|
prNumber: prInfo.number,
|
|
24618
24731
|
repoFullName,
|
|
@@ -24636,7 +24749,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
24636
24749
|
`);
|
|
24637
24750
|
}
|
|
24638
24751
|
}
|
|
24639
|
-
var
|
|
24752
|
+
var _internals36 = {
|
|
24640
24753
|
loadPluginConfig,
|
|
24641
24754
|
subscribe
|
|
24642
24755
|
};
|
|
@@ -24659,9 +24772,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
24659
24772
|
`);
|
|
24660
24773
|
}
|
|
24661
24774
|
const refToken = rest[0];
|
|
24662
|
-
const prInfo =
|
|
24775
|
+
const prInfo = _internals37.parsePrRef(refToken, directory);
|
|
24663
24776
|
if (!prInfo) {
|
|
24664
|
-
if (
|
|
24777
|
+
if (_internals37.looksLikePrRef(refToken)) {
|
|
24665
24778
|
return [
|
|
24666
24779
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
24667
24780
|
"",
|
|
@@ -24682,8 +24795,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
24682
24795
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
24683
24796
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
24684
24797
|
try {
|
|
24685
|
-
const correlationId =
|
|
24686
|
-
const result = await
|
|
24798
|
+
const correlationId = _internals37.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
24799
|
+
const result = await _internals37.unsubscribe(directory, correlationId);
|
|
24687
24800
|
if (!result) {
|
|
24688
24801
|
return [
|
|
24689
24802
|
`Not subscribed to ${prUrl}`,
|
|
@@ -24710,7 +24823,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
24710
24823
|
`);
|
|
24711
24824
|
}
|
|
24712
24825
|
}
|
|
24713
|
-
var
|
|
24826
|
+
var _internals37 = {
|
|
24714
24827
|
unsubscribe,
|
|
24715
24828
|
buildCorrelationId,
|
|
24716
24829
|
parsePrRef,
|
|
@@ -25144,15 +25257,15 @@ var lint = createSwarmTool({
|
|
|
25144
25257
|
}
|
|
25145
25258
|
const { mode } = args;
|
|
25146
25259
|
const cwd = directory;
|
|
25147
|
-
const linter = await
|
|
25260
|
+
const linter = await _internals38.detectAvailableLinter(directory);
|
|
25148
25261
|
if (linter) {
|
|
25149
|
-
const result = await
|
|
25262
|
+
const result = await _internals38.runLint(linter, mode, directory);
|
|
25150
25263
|
return JSON.stringify(result, null, 2);
|
|
25151
25264
|
}
|
|
25152
|
-
const additionalLinter =
|
|
25265
|
+
const additionalLinter = _internals38.detectAdditionalLinter(cwd);
|
|
25153
25266
|
if (additionalLinter) {
|
|
25154
25267
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
25155
|
-
const result = await
|
|
25268
|
+
const result = await _internals38.runAdditionalLint(additionalLinter, mode, cwd);
|
|
25156
25269
|
return JSON.stringify(result, null, 2);
|
|
25157
25270
|
}
|
|
25158
25271
|
const errorResult = {
|
|
@@ -25166,7 +25279,7 @@ For Rust: rustup component add clippy`
|
|
|
25166
25279
|
return JSON.stringify(errorResult, null, 2);
|
|
25167
25280
|
}
|
|
25168
25281
|
});
|
|
25169
|
-
var
|
|
25282
|
+
var _internals38 = {
|
|
25170
25283
|
detectAvailableLinter,
|
|
25171
25284
|
runLint,
|
|
25172
25285
|
detectAdditionalLinter,
|
|
@@ -25854,7 +25967,7 @@ var secretscan = createSwarmTool({
|
|
|
25854
25967
|
});
|
|
25855
25968
|
async function runSecretscan(directory) {
|
|
25856
25969
|
try {
|
|
25857
|
-
const result = await
|
|
25970
|
+
const result = await _internals39.secretscan.execute({ directory }, {});
|
|
25858
25971
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
25859
25972
|
return JSON.parse(jsonStr);
|
|
25860
25973
|
} catch (e) {
|
|
@@ -25869,7 +25982,7 @@ async function runSecretscan(directory) {
|
|
|
25869
25982
|
return errorResult;
|
|
25870
25983
|
}
|
|
25871
25984
|
}
|
|
25872
|
-
var
|
|
25985
|
+
var _internals39 = {
|
|
25873
25986
|
secretscan,
|
|
25874
25987
|
runSecretscan
|
|
25875
25988
|
};
|
|
@@ -26142,7 +26255,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
26142
26255
|
}
|
|
26143
26256
|
return impactMap;
|
|
26144
26257
|
}
|
|
26145
|
-
var
|
|
26258
|
+
var _internals40 = {
|
|
26146
26259
|
validateProjectRoot,
|
|
26147
26260
|
normalizePath: normalizePath2,
|
|
26148
26261
|
isCacheStale,
|
|
@@ -26157,8 +26270,8 @@ var _internals39 = {
|
|
|
26157
26270
|
_clearGoModuleCache
|
|
26158
26271
|
};
|
|
26159
26272
|
async function buildImpactMap(cwd) {
|
|
26160
|
-
const impactMap = await
|
|
26161
|
-
await
|
|
26273
|
+
const impactMap = await _internals40.buildImpactMapInternal(cwd);
|
|
26274
|
+
await _internals40.saveImpactMap(cwd, impactMap);
|
|
26162
26275
|
return impactMap;
|
|
26163
26276
|
}
|
|
26164
26277
|
async function loadImpactMap(cwd, options) {
|
|
@@ -26172,7 +26285,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
26172
26285
|
const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
26173
26286
|
if (hasValidValues) {
|
|
26174
26287
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
26175
|
-
if (!
|
|
26288
|
+
if (!_internals40.isCacheStale(map, generatedAt)) {
|
|
26176
26289
|
return map;
|
|
26177
26290
|
}
|
|
26178
26291
|
if (options?.skipRebuild) {
|
|
@@ -26192,13 +26305,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
26192
26305
|
if (options?.skipRebuild) {
|
|
26193
26306
|
return {};
|
|
26194
26307
|
}
|
|
26195
|
-
return
|
|
26308
|
+
return _internals40.buildImpactMap(cwd);
|
|
26196
26309
|
}
|
|
26197
26310
|
async function saveImpactMap(cwd, impactMap) {
|
|
26198
26311
|
if (!path51.isAbsolute(cwd)) {
|
|
26199
26312
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
26200
26313
|
}
|
|
26201
|
-
|
|
26314
|
+
_internals40.validateProjectRoot(cwd);
|
|
26202
26315
|
const cacheDir2 = path51.join(cwd, ".swarm", "cache");
|
|
26203
26316
|
const cachePath = path51.join(cacheDir2, "impact-map.json");
|
|
26204
26317
|
if (!fs22.existsSync(cacheDir2)) {
|
|
@@ -26222,7 +26335,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
26222
26335
|
};
|
|
26223
26336
|
}
|
|
26224
26337
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
26225
|
-
const impactMap = await
|
|
26338
|
+
const impactMap = await _internals40.loadImpactMap(cwd);
|
|
26226
26339
|
const impactedTestsSet = new Set;
|
|
26227
26340
|
const untestedFiles = [];
|
|
26228
26341
|
let visitedCount = 0;
|
|
@@ -26687,7 +26800,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
26687
26800
|
}
|
|
26688
26801
|
const historyPath = getHistoryPath(workingDir);
|
|
26689
26802
|
const historyDir = path52.dirname(historyPath);
|
|
26690
|
-
|
|
26803
|
+
_internals41.validateProjectRoot(workingDir);
|
|
26691
26804
|
if (!fs23.existsSync(historyDir)) {
|
|
26692
26805
|
fs23.mkdirSync(historyDir, { recursive: true });
|
|
26693
26806
|
}
|
|
@@ -26810,7 +26923,7 @@ function getAllHistory(workingDir) {
|
|
|
26810
26923
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
26811
26924
|
return records;
|
|
26812
26925
|
}
|
|
26813
|
-
var
|
|
26926
|
+
var _internals41 = {
|
|
26814
26927
|
validateProjectRoot
|
|
26815
26928
|
};
|
|
26816
26929
|
|
|
@@ -28723,9 +28836,9 @@ function getVersionFileVersion(dir) {
|
|
|
28723
28836
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
28724
28837
|
const startTime = Date.now();
|
|
28725
28838
|
try {
|
|
28726
|
-
const packageVersion =
|
|
28727
|
-
const changelogVersion =
|
|
28728
|
-
const versionFileVersion =
|
|
28839
|
+
const packageVersion = _internals42.getPackageVersion(dir);
|
|
28840
|
+
const changelogVersion = _internals42.getChangelogVersion(dir);
|
|
28841
|
+
const versionFileVersion = _internals42.getVersionFileVersion(dir);
|
|
28729
28842
|
const versions = [];
|
|
28730
28843
|
if (packageVersion)
|
|
28731
28844
|
versions.push(`package.json: ${packageVersion}`);
|
|
@@ -29089,7 +29202,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
29089
29202
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
29090
29203
|
let validatedDir;
|
|
29091
29204
|
try {
|
|
29092
|
-
validatedDir =
|
|
29205
|
+
validatedDir = _internals42.validateDirectoryPath(dir);
|
|
29093
29206
|
} catch (error2) {
|
|
29094
29207
|
return {
|
|
29095
29208
|
id: reportId,
|
|
@@ -29109,7 +29222,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
29109
29222
|
}
|
|
29110
29223
|
let validatedTimeout;
|
|
29111
29224
|
try {
|
|
29112
|
-
validatedTimeout =
|
|
29225
|
+
validatedTimeout = _internals42.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
29113
29226
|
} catch (error2) {
|
|
29114
29227
|
return {
|
|
29115
29228
|
id: reportId,
|
|
@@ -29150,12 +29263,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
29150
29263
|
});
|
|
29151
29264
|
const checks = [];
|
|
29152
29265
|
log("[Preflight] Running lint check...");
|
|
29153
|
-
const lintResult = await
|
|
29266
|
+
const lintResult = await _internals42.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
29154
29267
|
checks.push(lintResult);
|
|
29155
29268
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
29156
29269
|
if (!cfg.skipTests) {
|
|
29157
29270
|
log("[Preflight] Running tests check...");
|
|
29158
|
-
const testsResult = await
|
|
29271
|
+
const testsResult = await _internals42.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
29159
29272
|
checks.push(testsResult);
|
|
29160
29273
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
29161
29274
|
} else {
|
|
@@ -29167,7 +29280,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
29167
29280
|
}
|
|
29168
29281
|
if (!cfg.skipSecrets) {
|
|
29169
29282
|
log("[Preflight] Running secrets check...");
|
|
29170
|
-
const secretsResult = await
|
|
29283
|
+
const secretsResult = await _internals42.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
29171
29284
|
checks.push(secretsResult);
|
|
29172
29285
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
29173
29286
|
} else {
|
|
@@ -29179,7 +29292,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
29179
29292
|
}
|
|
29180
29293
|
if (!cfg.skipEvidence) {
|
|
29181
29294
|
log("[Preflight] Running evidence check...");
|
|
29182
|
-
const evidenceResult = await
|
|
29295
|
+
const evidenceResult = await _internals42.runEvidenceCheck(validatedDir);
|
|
29183
29296
|
checks.push(evidenceResult);
|
|
29184
29297
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
29185
29298
|
} else {
|
|
@@ -29190,12 +29303,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
29190
29303
|
});
|
|
29191
29304
|
}
|
|
29192
29305
|
log("[Preflight] Running requirement coverage check...");
|
|
29193
|
-
const reqCoverageResult = await
|
|
29306
|
+
const reqCoverageResult = await _internals42.runRequirementCoverageCheck(validatedDir, phase);
|
|
29194
29307
|
checks.push(reqCoverageResult);
|
|
29195
29308
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
29196
29309
|
if (!cfg.skipVersion) {
|
|
29197
29310
|
log("[Preflight] Running version check...");
|
|
29198
|
-
const versionResult = await
|
|
29311
|
+
const versionResult = await _internals42.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
29199
29312
|
checks.push(versionResult);
|
|
29200
29313
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
29201
29314
|
} else {
|
|
@@ -29258,10 +29371,10 @@ function formatPreflightMarkdown(report) {
|
|
|
29258
29371
|
async function handlePreflightCommand(directory, _args) {
|
|
29259
29372
|
const plan = await loadPlan(directory);
|
|
29260
29373
|
const phase = plan?.current_phase ?? 1;
|
|
29261
|
-
const report = await
|
|
29262
|
-
return
|
|
29374
|
+
const report = await _internals42.runPreflight(directory, phase);
|
|
29375
|
+
return _internals42.formatPreflightMarkdown(report);
|
|
29263
29376
|
}
|
|
29264
|
-
var
|
|
29377
|
+
var _internals42 = {
|
|
29265
29378
|
runPreflight,
|
|
29266
29379
|
formatPreflightMarkdown,
|
|
29267
29380
|
handlePreflightCommand,
|
|
@@ -30666,7 +30779,7 @@ async function recordReplayEntry(artifactPath, sessionID, entry) {
|
|
|
30666
30779
|
}
|
|
30667
30780
|
|
|
30668
30781
|
// src/prm/index.ts
|
|
30669
|
-
var
|
|
30782
|
+
var _internals43 = {
|
|
30670
30783
|
getAgentSession,
|
|
30671
30784
|
readTrajectory,
|
|
30672
30785
|
getInMemoryTrajectory,
|
|
@@ -30689,7 +30802,7 @@ function resetPrmSessionState(session, sessionId) {
|
|
|
30689
30802
|
session.prmTrajectoryStep = 0;
|
|
30690
30803
|
session.replayArtifactPath = null;
|
|
30691
30804
|
if (sessionId) {
|
|
30692
|
-
|
|
30805
|
+
_internals43.clearTrajectoryCache(sessionId);
|
|
30693
30806
|
}
|
|
30694
30807
|
}
|
|
30695
30808
|
|
|
@@ -31431,7 +31544,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
|
|
|
31431
31544
|
};
|
|
31432
31545
|
|
|
31433
31546
|
// src/services/status-service.ts
|
|
31434
|
-
var
|
|
31547
|
+
var _internals44 = {
|
|
31435
31548
|
loadLeanTurboRunState,
|
|
31436
31549
|
hasActiveLeanTurbo,
|
|
31437
31550
|
hasActiveFullAuto
|
|
@@ -31536,7 +31649,7 @@ async function getStatusData(directory, agents) {
|
|
|
31536
31649
|
}
|
|
31537
31650
|
function enrichWithLeanTurbo(status, directory) {
|
|
31538
31651
|
const turboMode = hasActiveTurboMode();
|
|
31539
|
-
const leanActive =
|
|
31652
|
+
const leanActive = _internals44.hasActiveLeanTurbo();
|
|
31540
31653
|
let turboStrategy = "off";
|
|
31541
31654
|
if (leanActive) {
|
|
31542
31655
|
turboStrategy = "lean";
|
|
@@ -31555,7 +31668,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
31555
31668
|
}
|
|
31556
31669
|
}
|
|
31557
31670
|
if (leanSessionID) {
|
|
31558
|
-
const runState =
|
|
31671
|
+
const runState = _internals44.loadLeanTurboRunState(directory, leanSessionID);
|
|
31559
31672
|
if (runState) {
|
|
31560
31673
|
status.leanTurboPhase = runState.phase;
|
|
31561
31674
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -31587,7 +31700,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
31587
31700
|
}
|
|
31588
31701
|
}
|
|
31589
31702
|
}
|
|
31590
|
-
status.fullAutoActive =
|
|
31703
|
+
status.fullAutoActive = _internals44.hasActiveFullAuto();
|
|
31591
31704
|
return status;
|
|
31592
31705
|
}
|
|
31593
31706
|
function formatStatusMarkdown(status) {
|
|
@@ -31741,7 +31854,7 @@ No active swarm plan found. Nothing to sync.`;
|
|
|
31741
31854
|
|
|
31742
31855
|
// src/commands/turbo.ts
|
|
31743
31856
|
init_logger();
|
|
31744
|
-
var
|
|
31857
|
+
var _internals45 = {
|
|
31745
31858
|
loadPluginConfigWithMeta
|
|
31746
31859
|
};
|
|
31747
31860
|
async function handleTurboCommand(directory, args, sessionID) {
|
|
@@ -31801,7 +31914,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
31801
31914
|
if (arg0 === "on") {
|
|
31802
31915
|
let strategy = "standard";
|
|
31803
31916
|
try {
|
|
31804
|
-
const { config } =
|
|
31917
|
+
const { config } = _internals45.loadPluginConfigWithMeta(directory);
|
|
31805
31918
|
if (config.turbo?.strategy === "lean") {
|
|
31806
31919
|
strategy = "lean";
|
|
31807
31920
|
}
|
|
@@ -31898,7 +32011,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
31898
32011
|
let maxParallelCoders = 4;
|
|
31899
32012
|
let conflictPolicy = "serialize";
|
|
31900
32013
|
try {
|
|
31901
|
-
const { config } =
|
|
32014
|
+
const { config } = _internals45.loadPluginConfigWithMeta(directory);
|
|
31902
32015
|
const leanConfig = config.turbo?.lean;
|
|
31903
32016
|
if (leanConfig) {
|
|
31904
32017
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -32114,7 +32227,7 @@ function findSimilarCommands(query) {
|
|
|
32114
32227
|
}
|
|
32115
32228
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
32116
32229
|
const cmdLower = cmd.toLowerCase();
|
|
32117
|
-
const fullScore =
|
|
32230
|
+
const fullScore = _internals46.levenshteinDistance(q, cmdLower);
|
|
32118
32231
|
let tokenScore = Infinity;
|
|
32119
32232
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
32120
32233
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -32127,7 +32240,7 @@ function findSimilarCommands(query) {
|
|
|
32127
32240
|
for (const ct of cmdTokens) {
|
|
32128
32241
|
if (ct.length === 0)
|
|
32129
32242
|
continue;
|
|
32130
|
-
const dist =
|
|
32243
|
+
const dist = _internals46.levenshteinDistance(qt, ct);
|
|
32131
32244
|
if (dist < minDist)
|
|
32132
32245
|
minDist = dist;
|
|
32133
32246
|
}
|
|
@@ -32137,7 +32250,7 @@ function findSimilarCommands(query) {
|
|
|
32137
32250
|
}
|
|
32138
32251
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
32139
32252
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
32140
|
-
const dashScore =
|
|
32253
|
+
const dashScore = _internals46.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
32141
32254
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
32142
32255
|
return { cmd, score };
|
|
32143
32256
|
});
|
|
@@ -32165,16 +32278,16 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
32165
32278
|
async function handleHelpCommand(ctx) {
|
|
32166
32279
|
const targetCommand = ctx.args.join(" ");
|
|
32167
32280
|
if (!targetCommand) {
|
|
32168
|
-
const { buildHelpText } = await import("./index-
|
|
32281
|
+
const { buildHelpText } = await import("./index-ryns3fqt.js");
|
|
32169
32282
|
return buildHelpText();
|
|
32170
32283
|
}
|
|
32171
32284
|
const tokens = targetCommand.split(/\s+/);
|
|
32172
|
-
const resolved =
|
|
32285
|
+
const resolved = _internals46.resolveCommand(tokens);
|
|
32173
32286
|
if (resolved) {
|
|
32174
|
-
return
|
|
32287
|
+
return _internals46.buildDetailedHelp(resolved.key, resolved.entry);
|
|
32175
32288
|
}
|
|
32176
|
-
const similar =
|
|
32177
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
32289
|
+
const similar = _internals46.findSimilarCommands(targetCommand);
|
|
32290
|
+
const { buildHelpText: fullHelp } = await import("./index-ryns3fqt.js");
|
|
32178
32291
|
if (similar.length > 0) {
|
|
32179
32292
|
return `Command '/swarm ${targetCommand}' not found.
|
|
32180
32293
|
|
|
@@ -32238,7 +32351,7 @@ var COMMAND_REGISTRY = {
|
|
|
32238
32351
|
toolNoArgs: true
|
|
32239
32352
|
},
|
|
32240
32353
|
help: {
|
|
32241
|
-
handler: (ctx) =>
|
|
32354
|
+
handler: (ctx) => _internals46.handleHelpCommand(ctx),
|
|
32242
32355
|
description: "Show help for swarm commands",
|
|
32243
32356
|
category: "core",
|
|
32244
32357
|
args: "[command]",
|
|
@@ -32307,7 +32420,7 @@ var COMMAND_REGISTRY = {
|
|
|
32307
32420
|
},
|
|
32308
32421
|
"guardrail explain": {
|
|
32309
32422
|
handler: async (ctx) => {
|
|
32310
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
32423
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-t3prwa5b.js");
|
|
32311
32424
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
32312
32425
|
},
|
|
32313
32426
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -32630,7 +32743,7 @@ Subcommands:
|
|
|
32630
32743
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleLoopCommand),
|
|
32631
32744
|
description: "Enter architect MODE: LOOP \u2014 compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve, iterating until done [objective]",
|
|
32632
32745
|
args: "<objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]",
|
|
32633
|
-
details: "Triggers the architect to run the compound-engineering loop defined in .opencode/skills/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy
|
|
32746
|
+
details: "Triggers the architect to run the compound-engineering loop defined in .opencode/skills/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy auto (default) runs unattended with hard stops still enforced; --autonomy checkpoint pauses at phase gates for user approval. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.",
|
|
32634
32747
|
category: "agent",
|
|
32635
32748
|
toolPolicy: "none"
|
|
32636
32749
|
},
|
|
@@ -33071,7 +33184,6 @@ var VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
|
33071
33184
|
function validateAliases() {
|
|
33072
33185
|
const errors = [];
|
|
33073
33186
|
const warnings = [];
|
|
33074
|
-
const aliasTargets = new Map;
|
|
33075
33187
|
for (const [name, entry] of Object.entries(COMMAND_REGISTRY)) {
|
|
33076
33188
|
const cmdEntry = entry;
|
|
33077
33189
|
if (cmdEntry.aliasOf) {
|
|
@@ -33080,10 +33192,6 @@ function validateAliases() {
|
|
|
33080
33192
|
errors.push(`Alias '${name}' points to non-existent command '${target}'`);
|
|
33081
33193
|
continue;
|
|
33082
33194
|
}
|
|
33083
|
-
if (!aliasTargets.has(target)) {
|
|
33084
|
-
aliasTargets.set(target, []);
|
|
33085
|
-
}
|
|
33086
|
-
aliasTargets.get(target).push(name);
|
|
33087
33195
|
const visited = new Set;
|
|
33088
33196
|
const path64 = [];
|
|
33089
33197
|
let current = target;
|
|
@@ -33107,11 +33215,6 @@ function validateAliases() {
|
|
|
33107
33215
|
}
|
|
33108
33216
|
}
|
|
33109
33217
|
}
|
|
33110
|
-
for (const [target, aliases] of aliasTargets.entries()) {
|
|
33111
|
-
if (aliases.length > 1) {
|
|
33112
|
-
warnings.push(`Multiple aliases point to '${target}': ${aliases.join(", ")}`);
|
|
33113
|
-
}
|
|
33114
|
-
}
|
|
33115
33218
|
return { valid: errors.length === 0, errors, warnings };
|
|
33116
33219
|
}
|
|
33117
33220
|
function validateToolPolicy() {
|
|
@@ -33126,7 +33229,7 @@ function validateToolPolicy() {
|
|
|
33126
33229
|
}
|
|
33127
33230
|
return { valid: warnings.length === 0, warnings };
|
|
33128
33231
|
}
|
|
33129
|
-
var
|
|
33232
|
+
var _internals46 = {
|
|
33130
33233
|
handleHelpCommand,
|
|
33131
33234
|
validateAliases,
|
|
33132
33235
|
validateToolPolicy,
|
|
@@ -33135,7 +33238,7 @@ var _internals45 = {
|
|
|
33135
33238
|
findSimilarCommands,
|
|
33136
33239
|
buildDetailedHelp
|
|
33137
33240
|
};
|
|
33138
|
-
var validation =
|
|
33241
|
+
var validation = _internals46.validateAliases();
|
|
33139
33242
|
if (!validation.valid) {
|
|
33140
33243
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
33141
33244
|
${validation.errors.join(`
|
|
@@ -33147,7 +33250,7 @@ ${validation.warnings.join(`
|
|
|
33147
33250
|
`)}`);
|
|
33148
33251
|
}
|
|
33149
33252
|
try {
|
|
33150
|
-
const toolPolicyValidation =
|
|
33253
|
+
const toolPolicyValidation = _internals46.validateToolPolicy();
|
|
33151
33254
|
if (toolPolicyValidation.warnings.length > 0) {
|
|
33152
33255
|
console.warn(`COMMAND_REGISTRY toolPolicy warnings:
|
|
33153
33256
|
${toolPolicyValidation.warnings.join(`
|
|
@@ -33211,7 +33314,7 @@ function formatCommandNotFound(tokens) {
|
|
|
33211
33314
|
const attemptedCommand = tokens[0] || "";
|
|
33212
33315
|
const MAX_DISPLAY = 100;
|
|
33213
33316
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
33214
|
-
const similar =
|
|
33317
|
+
const similar = _internals46.findSimilarCommands(attemptedCommand);
|
|
33215
33318
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
33216
33319
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
33217
33320
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -33268,4 +33371,4 @@ ${text}`;
|
|
|
33268
33371
|
};
|
|
33269
33372
|
}
|
|
33270
33373
|
|
|
33271
|
-
export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleClarifyCommand, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS,
|
|
33374
|
+
export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleClarifyCommand, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals46 as _internals, resolveCommand };
|