opencode-swarm 7.125.3 → 7.125.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +15 -0
- package/.opencode/skills/swarm-pr-review/SKILL.md +34 -0
- package/dist/cli/{config-doctor-rm1m07gz.js → config-doctor-akxywx0c.js} +2 -2
- package/dist/cli/{curation-policy-7pgdjt5w.js → curation-policy-62w2pwfz.js} +2 -2
- package/dist/cli/{curator-llm-factory-yq5vf298.js → curator-llm-factory-av2tcfy9.js} +12 -12
- package/dist/cli/{curator-arwm18td.js → curator-mhhvx2pw.js} +12 -12
- package/dist/cli/{guardrail-explain-mscq3veq.js → guardrail-explain-kqx2bczn.js} +13 -13
- package/dist/cli/{guardrail-log-6a2zxvtx.js → guardrail-log-222xyxfp.js} +3 -3
- package/dist/cli/{hive-promoter-q79naynh.js → hive-promoter-6mhnhrbx.js} +12 -12
- package/dist/cli/{index-7p6jkkat.js → index-0cdq55k0.js} +14 -14
- package/dist/cli/{index-vdfewvn5.js → index-0f45t7xy.js} +5 -5
- package/dist/cli/{index-45mvd5q7.js → index-1012f47p.js} +4 -4
- package/dist/cli/{index-rp5msv7n.js → index-1htanqp1.js} +1 -1
- package/dist/cli/{index-emzes7sj.js → index-4b1e5m0d.js} +2 -2
- package/dist/cli/{index-ambnwnmt.js → index-74xejn4v.js} +1 -1
- package/dist/cli/{index-x8entmky.js → index-ccfkfrew.js} +2 -2
- package/dist/cli/{index-xezv6tdw.js → index-dezgmvtw.js} +1 -1
- package/dist/cli/{index-8tjbq2ej.js → index-e315gwc9.js} +1 -1
- package/dist/cli/{index-fm4zfxnr.js → index-gbnpz7rh.js} +1 -1
- package/dist/cli/{index-01n43w2p.js → index-gd5w3ef8.js} +3 -3
- package/dist/cli/{index-pk099nqv.js → index-jt7hnr7q.js} +1 -1
- package/dist/cli/{index-4ycq2mrp.js → index-qzkcy22e.js} +1 -1
- package/dist/cli/{index-414r47r7.js → index-r1gdkn2d.js} +4 -0
- package/dist/cli/{index-m5e00g9s.js → index-s6hskqg6.js} +231 -98
- package/dist/cli/{index-sa3dgpmc.js → index-yq4s3q43.js} +2 -2
- package/dist/cli/index.js +12 -12
- package/dist/cli/{knowledge-escalator-gr8qd7kz.js → knowledge-escalator-h3hg7ek7.js} +3 -3
- package/dist/cli/{knowledge-events-q83g3f8z.js → knowledge-events-jtr66wxz.js} +1 -1
- package/dist/cli/{knowledge-store-qq3w5yt8.js → knowledge-store-69ttjjjs.js} +1 -1
- package/dist/cli/{knowledge-validator-7jhq8yam.js → knowledge-validator-yn06rh13.js} +4 -4
- package/dist/cli/{scan-cursor-fa5sy36q.js → scan-cursor-r0w2p5gz.js} +2 -2
- package/dist/cli/{schema-bw68my66.js → schema-69z8w1ka.js} +1 -1
- package/dist/cli/{skill-generator-ffc1agyw.js → skill-generator-a7xfyddq.js} +5 -5
- package/dist/commands/abort-pr-workflow.d.ts +17 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/hooks/delegation-gate.d.ts +35 -0
- package/dist/hooks/pr-workflow-gate.d.ts +32 -0
- package/dist/hooks/pr-workflow-response-gate.d.ts +48 -0
- package/dist/hooks/shell-write-detect.d.ts +1 -1
- package/dist/index.js +100 -84
- package/dist/session/snapshot-writer.d.ts +9 -0
- package/dist/state.d.ts +15 -0
- package/dist/tools/abort-pr-workflow.d.ts +5 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/dist/turbo/lean/reviewer.d.ts +2 -1
- package/dist/turbo/lean/runner.d.ts +2 -1
- package/dist/utils/model-dispatch-fallback.d.ts +71 -0
- package/dist/utils/provider-error-classification.d.ts +52 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
readDoctorArtifact,
|
|
5
5
|
removeStraySwarmDir,
|
|
6
6
|
runConfigDoctor
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-jt7hnr7q.js";
|
|
8
8
|
import {
|
|
9
9
|
EvaluationTaskV1Schema,
|
|
10
10
|
GateAuditManifestV1Schema,
|
|
@@ -94,15 +94,15 @@ import {
|
|
|
94
94
|
retireSkill,
|
|
95
95
|
selectCandidateEntries,
|
|
96
96
|
syncBundledProjectSkillsIfMissingAsync
|
|
97
|
-
} from "./index-
|
|
97
|
+
} from "./index-gd5w3ef8.js";
|
|
98
98
|
import {
|
|
99
99
|
readRecentEscalations
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-0f45t7xy.js";
|
|
101
101
|
import {
|
|
102
102
|
alreadyCuratedThisGeneration,
|
|
103
103
|
claimNextScanBatch,
|
|
104
104
|
resolveCohortId
|
|
105
|
-
} from "./index-
|
|
105
|
+
} from "./index-e315gwc9.js";
|
|
106
106
|
import {
|
|
107
107
|
CURATOR_INIT_PROMPT,
|
|
108
108
|
CURATOR_PHASE_PROMPT,
|
|
@@ -135,11 +135,11 @@ import {
|
|
|
135
135
|
validateActionability,
|
|
136
136
|
validateActionableFields,
|
|
137
137
|
validateLesson
|
|
138
|
-
} from "./index-
|
|
138
|
+
} from "./index-yq4s3q43.js";
|
|
139
139
|
import {
|
|
140
140
|
authorizeCuration,
|
|
141
141
|
buildConfigFingerprintInput
|
|
142
|
-
} from "./index-
|
|
142
|
+
} from "./index-1htanqp1.js";
|
|
143
143
|
import {
|
|
144
144
|
cohortConfigFingerprint
|
|
145
145
|
} from "./index-rtry5xyf.js";
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
transactFile,
|
|
170
170
|
transactKnowledge,
|
|
171
171
|
wordBigrams
|
|
172
|
-
} from "./index-
|
|
172
|
+
} from "./index-1012f47p.js";
|
|
173
173
|
import {
|
|
174
174
|
MAX_EVENT_LOG_ENTRIES,
|
|
175
175
|
_internals,
|
|
@@ -179,7 +179,7 @@ import {
|
|
|
179
179
|
recordHiveKnowledgeEvent,
|
|
180
180
|
recordKnowledgeEvent,
|
|
181
181
|
resolveKnowledgeEventsPath
|
|
182
|
-
} from "./index-
|
|
182
|
+
} from "./index-gbnpz7rh.js";
|
|
183
183
|
import {
|
|
184
184
|
resolveHiveDataDir,
|
|
185
185
|
resolveHiveEventsPath,
|
|
@@ -201,7 +201,7 @@ import {
|
|
|
201
201
|
init_loader,
|
|
202
202
|
loadPluginConfig,
|
|
203
203
|
loadPluginConfigWithMeta
|
|
204
|
-
} from "./index-
|
|
204
|
+
} from "./index-74xejn4v.js";
|
|
205
205
|
import {
|
|
206
206
|
RetrospectiveEvidenceSchema
|
|
207
207
|
} from "./index-k5jrywpr.js";
|
|
@@ -220,7 +220,7 @@ import {
|
|
|
220
220
|
init_schema,
|
|
221
221
|
init_tool_metadata,
|
|
222
222
|
stripKnownSwarmPrefix
|
|
223
|
-
} from "./index-
|
|
223
|
+
} from "./index-r1gdkn2d.js";
|
|
224
224
|
import {
|
|
225
225
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
226
226
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -251,6 +251,9 @@ import {
|
|
|
251
251
|
getDeferredWarnings,
|
|
252
252
|
init_warning_buffer
|
|
253
253
|
} from "./index-4rhhvd1a.js";
|
|
254
|
+
import {
|
|
255
|
+
readDelegations
|
|
256
|
+
} from "./index-0cz1ws47.js";
|
|
254
257
|
import {
|
|
255
258
|
readSwarmFileAsync,
|
|
256
259
|
safeHook,
|
|
@@ -5449,6 +5452,60 @@ async function readPrWorkflowGateState(directory, sessionID) {
|
|
|
5449
5452
|
}
|
|
5450
5453
|
return state;
|
|
5451
5454
|
}
|
|
5455
|
+
async function clearPrWorkflowGateState(directory, sessionID, expectedRevision) {
|
|
5456
|
+
const normalizedSessionID = normalizeSessionID(sessionID);
|
|
5457
|
+
await withSessionStateMutation(directory, normalizedSessionID, async () => {
|
|
5458
|
+
const current = await readPrWorkflowGateStateFromDisk(directory, normalizedSessionID);
|
|
5459
|
+
if (expectedRevision !== undefined && (!current || current.revision !== expectedRevision)) {
|
|
5460
|
+
throw new Error("BLOCKED: PR workflow gate state changed during terminal completion; revalidate the current session state before retrying");
|
|
5461
|
+
}
|
|
5462
|
+
try {
|
|
5463
|
+
await fsp.rm(workflowGateStatePath(directory, normalizedSessionID), {
|
|
5464
|
+
force: true
|
|
5465
|
+
});
|
|
5466
|
+
} catch (error2) {
|
|
5467
|
+
if (error2.code !== "ENOENT") {
|
|
5468
|
+
throw error2;
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5471
|
+
trackedStatesByProjectSession.delete(stateCacheKey(directory, normalizedSessionID));
|
|
5472
|
+
});
|
|
5473
|
+
}
|
|
5474
|
+
async function abortPrWorkflow(directory, sessionID, options = {}) {
|
|
5475
|
+
const state = await requireAnyActiveState(directory, sessionID);
|
|
5476
|
+
if (options.expectedMode && state.mode !== options.expectedMode) {
|
|
5477
|
+
throw wrongModeError(state, options.expectedMode);
|
|
5478
|
+
}
|
|
5479
|
+
if (state.prFeedbackReadyToPublish) {
|
|
5480
|
+
throw new Error(`BLOCKED: ${state.mode} is armed for publication; abort is blocked. Complete the workflow with complete_pr_workflow (or push the bound commit first) before aborting.`);
|
|
5481
|
+
}
|
|
5482
|
+
const openLanes = readDelegations(directory).filter((record) => record.parentSessionId === state.sessionID && record.mode?.startsWith("swarm-pr-") && (record.status === "pending" || record.status === "running"));
|
|
5483
|
+
if (openLanes.length > 0) {
|
|
5484
|
+
const laneIds = openLanes.map((record) => record.laneId ?? record.subagentSessionId ?? "unknown").filter(Boolean).slice(0, 10).join(", ");
|
|
5485
|
+
throw new Error(`BLOCKED: ${state.mode} abort refused while ${openLanes.length} PR workflow lane(s) are still in flight (lane ids: ${laneIds}). Collect their results or let them settle before aborting.`);
|
|
5486
|
+
}
|
|
5487
|
+
const sanitizedReason = typeof options.reason === "string" ? options.reason.trim().slice(0, 500) : undefined;
|
|
5488
|
+
const abortEvent = {
|
|
5489
|
+
type: "pr_workflow_aborted",
|
|
5490
|
+
timestamp: isoNow(),
|
|
5491
|
+
sessionID: state.sessionID,
|
|
5492
|
+
mode: state.mode,
|
|
5493
|
+
...state.prHeadSha ? { prHeadSha: state.prHeadSha } : {},
|
|
5494
|
+
openLanes: openLanes.length,
|
|
5495
|
+
...sanitizedReason ? { reason: sanitizedReason } : {}
|
|
5496
|
+
};
|
|
5497
|
+
try {
|
|
5498
|
+
const eventsPath = validateSwarmPath(directory, "events.jsonl");
|
|
5499
|
+
await fsp.appendFile(eventsPath, `${JSON.stringify(abortEvent)}
|
|
5500
|
+
`, "utf-8");
|
|
5501
|
+
} catch {}
|
|
5502
|
+
await clearPrWorkflowGateState(directory, sessionID, state.revision);
|
|
5503
|
+
return {
|
|
5504
|
+
mode: state.mode,
|
|
5505
|
+
...state.prHeadSha ? { prHeadSha: state.prHeadSha } : {},
|
|
5506
|
+
openLanes: openLanes.length
|
|
5507
|
+
};
|
|
5508
|
+
}
|
|
5452
5509
|
async function bindPrWorkflowHead(directory, sessionID, prHeadSha) {
|
|
5453
5510
|
const state = await requireAnyActiveState(directory, sessionID);
|
|
5454
5511
|
const normalizedHead = normalizePrHeadSha(prHeadSha);
|
|
@@ -5513,7 +5570,11 @@ async function requireAnyActiveState(directory, sessionID) {
|
|
|
5513
5570
|
}
|
|
5514
5571
|
return state;
|
|
5515
5572
|
}
|
|
5573
|
+
function wrongModeError(state, expectedMode) {
|
|
5574
|
+
return new Error(`BLOCKED: session "${state.sessionID}" is active in ${state.mode}, not ${expectedMode}`);
|
|
5575
|
+
}
|
|
5516
5576
|
var PR_WORKFLOW_CONTROLLER_TOOLS = new Set([
|
|
5577
|
+
"abort_pr_workflow",
|
|
5517
5578
|
"collect_lane_results",
|
|
5518
5579
|
"complete_pr_workflow",
|
|
5519
5580
|
"dispatch_lanes_async",
|
|
@@ -5856,6 +5917,55 @@ function delay(ms) {
|
|
|
5856
5917
|
// src/commands/registry.ts
|
|
5857
5918
|
init_logger();
|
|
5858
5919
|
|
|
5920
|
+
// src/commands/abort-pr-workflow.ts
|
|
5921
|
+
var USAGE = [
|
|
5922
|
+
"Usage: /swarm abort-pr-workflow [PR_REVIEW|PR_FEEDBACK] [reason...]",
|
|
5923
|
+
"",
|
|
5924
|
+
"Clear an active PR_REVIEW or PR_FEEDBACK mechanical gate for the current session",
|
|
5925
|
+
"and stop the auto-resume loop. Use when a PR review or feedback workflow is stuck",
|
|
5926
|
+
"(e.g. the working tree cannot reach the PR head, a compound shell command was",
|
|
5927
|
+
"rejected, or the wake budget is suspended).",
|
|
5928
|
+
"",
|
|
5929
|
+
"Arguments:",
|
|
5930
|
+
" mode Optional: PR_REVIEW or PR_FEEDBACK. If omitted, aborts whichever is active.",
|
|
5931
|
+
" reason Optional free-text reason (recorded to .swarm/events.jsonl).",
|
|
5932
|
+
"",
|
|
5933
|
+
"Refuses while the workflow is armed for publication (call complete_pr_workflow",
|
|
5934
|
+
"instead) or while PR workflow lanes are still in flight (collect their results first)."
|
|
5935
|
+
].join(`
|
|
5936
|
+
`);
|
|
5937
|
+
var KNOWN_MODES = new Set(["PR_REVIEW", "PR_FEEDBACK"]);
|
|
5938
|
+
async function handleAbortPrWorkflowCommand(directory, args, sessionID) {
|
|
5939
|
+
const tokens = (args ?? []).filter((token) => token.trim().length > 0);
|
|
5940
|
+
const modeToken = tokens[0]?.toUpperCase();
|
|
5941
|
+
const knownMode = modeToken && KNOWN_MODES.has(modeToken) ? modeToken : undefined;
|
|
5942
|
+
const reasonStartIndex = knownMode ? 1 : 0;
|
|
5943
|
+
const reason = tokens.slice(reasonStartIndex).join(" ").trim().slice(0, 500) || undefined;
|
|
5944
|
+
if (modeToken && !knownMode) {
|
|
5945
|
+
return `Error: Unknown mode "${modeToken}". Expected PR_REVIEW or PR_FEEDBACK.
|
|
5946
|
+
|
|
5947
|
+
${USAGE}`;
|
|
5948
|
+
}
|
|
5949
|
+
if (!sessionID?.trim()) {
|
|
5950
|
+
return `Error: abort-pr-workflow requires an active sessionID.
|
|
5951
|
+
|
|
5952
|
+
${USAGE}`;
|
|
5953
|
+
}
|
|
5954
|
+
try {
|
|
5955
|
+
const summary = await abortPrWorkflow(directory, sessionID, {
|
|
5956
|
+
...knownMode ? { expectedMode: knownMode } : {},
|
|
5957
|
+
...reason ? { reason } : {}
|
|
5958
|
+
});
|
|
5959
|
+
const headLine = summary.prHeadSha ? ` (was bound to PR head ${summary.prHeadSha})` : " (was not bound to a PR head)";
|
|
5960
|
+
return `Aborted active ${summary.mode} mechanical gate for session ${sessionID}${headLine}. The durable gate state has been cleared and the auto-resume loop will stop. An audit event was appended to .swarm/events.jsonl.`;
|
|
5961
|
+
} catch (error2) {
|
|
5962
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
5963
|
+
return `Error: ${message}
|
|
5964
|
+
|
|
5965
|
+
${USAGE}`;
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5859
5969
|
// src/commands/acknowledge-spec-drift.ts
|
|
5860
5970
|
import { promises as fsPromises } from "fs";
|
|
5861
5971
|
import * as path10 from "path";
|
|
@@ -7916,7 +8026,7 @@ function resolvePrCommandInput(rest, cwd) {
|
|
|
7916
8026
|
}
|
|
7917
8027
|
|
|
7918
8028
|
// src/commands/ci-monitor.ts
|
|
7919
|
-
var
|
|
8029
|
+
var USAGE2 = [
|
|
7920
8030
|
"Usage: /swarm ci-monitor <pr-url|owner/repo#N|N>",
|
|
7921
8031
|
"",
|
|
7922
8032
|
"Drive an already human-reviewed, approved pull request to green and",
|
|
@@ -7933,17 +8043,17 @@ function handleCiMonitorCommand(directory, args) {
|
|
|
7933
8043
|
const rest = args.filter((token) => token.trim().length > 0);
|
|
7934
8044
|
const resolved = resolvePrCommandInput(rest, directory);
|
|
7935
8045
|
if (resolved === null) {
|
|
7936
|
-
return
|
|
8046
|
+
return USAGE2;
|
|
7937
8047
|
}
|
|
7938
8048
|
if ("error" in resolved) {
|
|
7939
8049
|
return `Error: ${resolved.error}
|
|
7940
8050
|
|
|
7941
|
-
${
|
|
8051
|
+
${USAGE2}`;
|
|
7942
8052
|
}
|
|
7943
8053
|
if (resolved.instructions) {
|
|
7944
8054
|
return `Error: /swarm ci-monitor takes only a PR reference \u2014 no trailing instructions. Got: "${resolved.instructions}"
|
|
7945
8055
|
|
|
7946
|
-
${
|
|
8056
|
+
${USAGE2}`;
|
|
7947
8057
|
}
|
|
7948
8058
|
return `[MODE: CI_MONITOR pr="${resolved.prUrl}"]`;
|
|
7949
8059
|
}
|
|
@@ -10815,7 +10925,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
10815
10925
|
}
|
|
10816
10926
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
10817
10927
|
try {
|
|
10818
|
-
const skillModule = await import("./skill-generator-
|
|
10928
|
+
const skillModule = await import("./skill-generator-a7xfyddq.js");
|
|
10819
10929
|
for (const cand of skillCandidates) {
|
|
10820
10930
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
10821
10931
|
continue;
|
|
@@ -11152,7 +11262,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
11152
11262
|
} catch {}
|
|
11153
11263
|
}
|
|
11154
11264
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
11155
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
11265
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-h3hg7ek7.js");
|
|
11156
11266
|
for (const { id } of contradictedEntries) {
|
|
11157
11267
|
try {
|
|
11158
11268
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -11951,7 +12061,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
11951
12061
|
warnings.push("Failed to collect knowledge summary.");
|
|
11952
12062
|
}
|
|
11953
12063
|
try {
|
|
11954
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
12064
|
+
const { getScanStatus } = await import("./scan-cursor-r0w2p5gz.js");
|
|
11955
12065
|
const scanStatus = await getScanStatus(directory);
|
|
11956
12066
|
if (scanStatus.remaining_estimate > 0) {
|
|
11957
12067
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -12123,9 +12233,9 @@ var _internals15 = {
|
|
|
12123
12233
|
verifyPostMortemKnowledgeActions,
|
|
12124
12234
|
repairPostMortemActions,
|
|
12125
12235
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
12126
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
12236
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-69z8w1ka.js");
|
|
12127
12237
|
try {
|
|
12128
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
12238
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-4b1e5m0d.js");
|
|
12129
12239
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
12130
12240
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
12131
12241
|
} catch {
|
|
@@ -12133,11 +12243,11 @@ var _internals15 = {
|
|
|
12133
12243
|
}
|
|
12134
12244
|
},
|
|
12135
12245
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
12136
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
12246
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-mhhvx2pw.js");
|
|
12137
12247
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
12138
12248
|
},
|
|
12139
12249
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
12140
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
12250
|
+
const { checkHivePromotions } = await import("./hive-promoter-6mhnhrbx.js");
|
|
12141
12251
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
12142
12252
|
},
|
|
12143
12253
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -12146,7 +12256,7 @@ var _internals15 = {
|
|
|
12146
12256
|
activateProposal,
|
|
12147
12257
|
listSkills: listSkills2,
|
|
12148
12258
|
sanitizeSlug
|
|
12149
|
-
} = await import("./skill-generator-
|
|
12259
|
+
} = await import("./skill-generator-a7xfyddq.js");
|
|
12150
12260
|
const result = {
|
|
12151
12261
|
approved: [],
|
|
12152
12262
|
rejected: [],
|
|
@@ -12279,7 +12389,7 @@ function failedGateNames(decision) {
|
|
|
12279
12389
|
|
|
12280
12390
|
// src/hooks/hive-transaction.ts
|
|
12281
12391
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
12282
|
-
import { appendFile as
|
|
12392
|
+
import { appendFile as appendFile3, mkdir as mkdir7 } from "fs/promises";
|
|
12283
12393
|
import * as path22 from "path";
|
|
12284
12394
|
init_logger();
|
|
12285
12395
|
var HIVE_LOCK_STALE_MS = 5000;
|
|
@@ -12340,13 +12450,13 @@ async function transactHiveStore(mutate) {
|
|
|
12340
12450
|
const rejectBlock = `${outcome.rejects.map((r) => JSON.stringify(r)).join(`
|
|
12341
12451
|
`)}
|
|
12342
12452
|
`;
|
|
12343
|
-
await
|
|
12453
|
+
await appendFile3(rejectedPath, rejectBlock, "utf-8");
|
|
12344
12454
|
}
|
|
12345
12455
|
if (outcome.audit && outcome.audit.length > 0) {
|
|
12346
12456
|
const auditBlock = `${outcome.audit.map((a) => a.line).join(`
|
|
12347
12457
|
`)}
|
|
12348
12458
|
`;
|
|
12349
|
-
await
|
|
12459
|
+
await appendFile3(eventsPath, auditBlock, "utf-8");
|
|
12350
12460
|
try {
|
|
12351
12461
|
await trimHiveEventsUnderLock(eventsPath);
|
|
12352
12462
|
} catch (err) {
|
|
@@ -12394,7 +12504,7 @@ init_knowledge_types();
|
|
|
12394
12504
|
|
|
12395
12505
|
// src/hooks/promotion-evidence-store.ts
|
|
12396
12506
|
import {
|
|
12397
|
-
appendFile as
|
|
12507
|
+
appendFile as appendFile4,
|
|
12398
12508
|
mkdir as mkdir8,
|
|
12399
12509
|
readFile as readFile7,
|
|
12400
12510
|
rename as rename5,
|
|
@@ -13102,7 +13212,7 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
|
|
|
13102
13212
|
import { createHash as createHash7 } from "crypto";
|
|
13103
13213
|
import { existsSync as existsSync15 } from "fs";
|
|
13104
13214
|
import {
|
|
13105
|
-
appendFile as
|
|
13215
|
+
appendFile as appendFile5,
|
|
13106
13216
|
mkdir as mkdir10,
|
|
13107
13217
|
readFile as readFile10,
|
|
13108
13218
|
realpath,
|
|
@@ -14671,9 +14781,9 @@ function hashContent(content) {
|
|
|
14671
14781
|
return createHash7("sha1").update(content).digest("hex");
|
|
14672
14782
|
}
|
|
14673
14783
|
async function loadConfigForPolicyCurator(directory) {
|
|
14674
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
14784
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-69z8w1ka.js");
|
|
14675
14785
|
try {
|
|
14676
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
14786
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-4b1e5m0d.js");
|
|
14677
14787
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
14678
14788
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
14679
14789
|
} catch {
|
|
@@ -15153,7 +15263,7 @@ async function appendCuratorSkippedEvent(directory, record) {
|
|
|
15153
15263
|
try {
|
|
15154
15264
|
const filePath = path28.join(directory, ".swarm", "events.jsonl");
|
|
15155
15265
|
await mkdir10(path28.dirname(filePath), { recursive: true });
|
|
15156
|
-
await
|
|
15266
|
+
await appendFile5(filePath, `${JSON.stringify({
|
|
15157
15267
|
timestamp: new Date().toISOString(),
|
|
15158
15268
|
event: "curator_skipped",
|
|
15159
15269
|
entry_id: record.entry_id,
|
|
@@ -17834,7 +17944,7 @@ async function runFinalizeStage(ctx) {
|
|
|
17834
17944
|
}
|
|
17835
17945
|
}
|
|
17836
17946
|
try {
|
|
17837
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
17947
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-69z8w1ka.js");
|
|
17838
17948
|
const { config: pmLoadedConfig } = _internals24.loadPluginConfigWithMeta(ctx.directory);
|
|
17839
17949
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
17840
17950
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -18674,7 +18784,7 @@ var MODES = new Set(CODEBASE_REVIEW_MODES);
|
|
|
18674
18784
|
var DEFAULT_MODE = "phase0";
|
|
18675
18785
|
var DEFAULT_SCOPE = "repository root";
|
|
18676
18786
|
var FLAG_VALUE_MISSING = (token) => `Flag "${token}" requires a value`;
|
|
18677
|
-
var
|
|
18787
|
+
var USAGE3 = `Usage: /swarm codebase-review [scope] [--mode phase0|complete|defect|security|correctness|testing|ui|performance|ai-slop|enhancements|custom] [--tracks <list>] [--continue <run-id>] [--json] [--skip-update] [--allow-dirty]
|
|
18678
18788
|
|
|
18679
18789
|
Run the codebase-review-swarm workflow in the current repository.
|
|
18680
18790
|
|
|
@@ -18767,12 +18877,12 @@ function parseArgs(args) {
|
|
|
18767
18877
|
async function handleCodebaseReviewCommand(_directory, args) {
|
|
18768
18878
|
const parsed = parseArgs(args);
|
|
18769
18879
|
if (parsed.help) {
|
|
18770
|
-
return
|
|
18880
|
+
return USAGE3;
|
|
18771
18881
|
}
|
|
18772
18882
|
if (parsed.error) {
|
|
18773
18883
|
return `Error: ${parsed.error}
|
|
18774
18884
|
|
|
18775
|
-
${
|
|
18885
|
+
${USAGE3}`;
|
|
18776
18886
|
}
|
|
18777
18887
|
const scope = sanitizeText(parsed.rest.join(" "), MAX_SCOPE_LEN) || DEFAULT_SCOPE;
|
|
18778
18888
|
return [
|
|
@@ -19190,7 +19300,7 @@ function parseArgs2(args) {
|
|
|
19190
19300
|
}
|
|
19191
19301
|
return out;
|
|
19192
19302
|
}
|
|
19193
|
-
var
|
|
19303
|
+
var USAGE4 = [
|
|
19194
19304
|
"Usage: /swarm council <question> [--spec-review]",
|
|
19195
19305
|
"",
|
|
19196
19306
|
" question The question to put to the council",
|
|
@@ -19203,7 +19313,7 @@ async function handleCouncilCommand(_directory, args) {
|
|
|
19203
19313
|
const parsed = parseArgs2(args);
|
|
19204
19314
|
const question = sanitizeQuestion(parsed.rest.join(" "));
|
|
19205
19315
|
if (!question) {
|
|
19206
|
-
return
|
|
19316
|
+
return USAGE4;
|
|
19207
19317
|
}
|
|
19208
19318
|
const tokens = ["MODE: COUNCIL"];
|
|
19209
19319
|
if (parsed.preset) {
|
|
@@ -20003,9 +20113,9 @@ var _internals28 = {
|
|
|
20003
20113
|
readSwarmFileAsync,
|
|
20004
20114
|
loadCuratorDeps: async () => {
|
|
20005
20115
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
20006
|
-
import("./schema-
|
|
20007
|
-
import("./curator-
|
|
20008
|
-
import("./curator-llm-factory-
|
|
20116
|
+
import("./schema-69z8w1ka.js"),
|
|
20117
|
+
import("./curator-mhhvx2pw.js"),
|
|
20118
|
+
import("./curator-llm-factory-av2tcfy9.js")
|
|
20009
20119
|
]);
|
|
20010
20120
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
20011
20121
|
}
|
|
@@ -20161,7 +20271,7 @@ var PROFILES = new Set([
|
|
|
20161
20271
|
var DEFAULT_PROFILE = "standard";
|
|
20162
20272
|
var DEFAULT_MAX_EXPLORERS = 6;
|
|
20163
20273
|
var FULL_PROFILE_DEFAULT_MAX_EXPLORERS = 8;
|
|
20164
|
-
var
|
|
20274
|
+
var USAGE5 = `Usage: /swarm deep-dive <scope> [--profile standard|security|ux|architecture|full] [--max-explorers N] [--json] [--skip-update] [--allow-dirty]
|
|
20165
20275
|
|
|
20166
20276
|
Run a bounded, evidence-backed deep dive on an application section.
|
|
20167
20277
|
|
|
@@ -20250,11 +20360,11 @@ async function handleDeepDiveCommand(_directory, args) {
|
|
|
20250
20360
|
if (parsed.error) {
|
|
20251
20361
|
return `Error: ${parsed.error}
|
|
20252
20362
|
|
|
20253
|
-
${
|
|
20363
|
+
${USAGE5}`;
|
|
20254
20364
|
}
|
|
20255
20365
|
const scope = sanitizeScope(parsed.rest.join(" "));
|
|
20256
20366
|
if (!scope) {
|
|
20257
|
-
return
|
|
20367
|
+
return USAGE5;
|
|
20258
20368
|
}
|
|
20259
20369
|
if (parsed.profile === "full" && !parsed.maxExplorersExplicit) {
|
|
20260
20370
|
parsed.maxExplorers = FULL_PROFILE_DEFAULT_MAX_EXPLORERS;
|
|
@@ -20271,7 +20381,7 @@ var DEFAULT_MAX_RESEARCHERS = 3;
|
|
|
20271
20381
|
var EXHAUSTIVE_DEFAULT_MAX_RESEARCHERS = 5;
|
|
20272
20382
|
var DEFAULT_ROUNDS = 2;
|
|
20273
20383
|
var EXHAUSTIVE_DEFAULT_ROUNDS = 3;
|
|
20274
|
-
var
|
|
20384
|
+
var USAGE6 = `Usage: /swarm deep-research <question> [--depth standard|exhaustive] [--max-researchers 1..6] [--rounds 1..4] [--brief]
|
|
20275
20385
|
|
|
20276
20386
|
Run a multi-source, fact-checked deep research pass and synthesize a cited report.
|
|
20277
20387
|
|
|
@@ -20365,11 +20475,11 @@ async function handleDeepResearchCommand(_directory, args) {
|
|
|
20365
20475
|
if (parsed.error) {
|
|
20366
20476
|
return `Error: ${parsed.error}
|
|
20367
20477
|
|
|
20368
|
-
${
|
|
20478
|
+
${USAGE6}`;
|
|
20369
20479
|
}
|
|
20370
20480
|
const question = sanitizeQuestion2(parsed.rest.join(" "));
|
|
20371
20481
|
if (!question) {
|
|
20372
|
-
return
|
|
20482
|
+
return USAGE6;
|
|
20373
20483
|
}
|
|
20374
20484
|
if (parsed.depth === "exhaustive") {
|
|
20375
20485
|
if (!parsed.maxResearchersExplicit)
|
|
@@ -20384,7 +20494,7 @@ ${USAGE5}`;
|
|
|
20384
20494
|
init_warning_buffer();
|
|
20385
20495
|
var MAX_DESC_LEN = 2000;
|
|
20386
20496
|
var _internals29 = { loadPluginConfigWithMeta };
|
|
20387
|
-
var
|
|
20497
|
+
var USAGE7 = `Usage: /swarm design-docs <description> [--out <dir>] [--lang <name>] [--update]
|
|
20388
20498
|
|
|
20389
20499
|
Generate or sync language-agnostic design docs for the project under build:
|
|
20390
20500
|
<out>/domain.md, <out>/technical-spec.md, <out>/behavior-spec.md,
|
|
@@ -20476,21 +20586,21 @@ async function handleDesignDocsCommand(directory, args) {
|
|
|
20476
20586
|
if (parsed.error) {
|
|
20477
20587
|
return `Error: ${parsed.error}
|
|
20478
20588
|
|
|
20479
|
-
${
|
|
20589
|
+
${USAGE7}`;
|
|
20480
20590
|
}
|
|
20481
20591
|
try {
|
|
20482
20592
|
const { config } = _internals29.loadPluginConfigWithMeta(directory);
|
|
20483
20593
|
if (config.design_docs?.enabled !== true) {
|
|
20484
20594
|
return "Error: design docs are disabled. Set `design_docs.enabled: true` in " + `opencode-swarm.json to enable the docs_design agent and this command.
|
|
20485
20595
|
|
|
20486
|
-
` +
|
|
20596
|
+
` + USAGE7;
|
|
20487
20597
|
}
|
|
20488
20598
|
} catch (configErr) {
|
|
20489
20599
|
advisoryWarn(`[design-docs] Could not read opencode-swarm.json (${String(configErr)}). ` + "Falling through \u2014 the architect will abort if docs_design is not registered.");
|
|
20490
20600
|
}
|
|
20491
20601
|
const description = sanitizeDescription(parsed.rest.join(" "));
|
|
20492
20602
|
if (!description && !parsed.update) {
|
|
20493
|
-
return
|
|
20603
|
+
return USAGE7;
|
|
20494
20604
|
}
|
|
20495
20605
|
const header = `[MODE: DESIGN_DOCS out=${parsed.out} lang=${parsed.lang} update=${parsed.update}] ${description}`;
|
|
20496
20606
|
return header.trimEnd();
|
|
@@ -20504,7 +20614,7 @@ import { fileURLToPath } from "url";
|
|
|
20504
20614
|
// package.json
|
|
20505
20615
|
var package_default = {
|
|
20506
20616
|
name: "opencode-swarm",
|
|
20507
|
-
version: "7.125.
|
|
20617
|
+
version: "7.125.5",
|
|
20508
20618
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
20509
20619
|
main: "dist/index.js",
|
|
20510
20620
|
types: "dist/index.d.ts",
|
|
@@ -21025,7 +21135,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
21025
21135
|
let scanCompleted = false;
|
|
21026
21136
|
let scanRemaining = 0;
|
|
21027
21137
|
try {
|
|
21028
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
21138
|
+
const { getScanStatus } = await import("./scan-cursor-r0w2p5gz.js");
|
|
21029
21139
|
const status = await getScanStatus(directory);
|
|
21030
21140
|
scanGeneration = status.generation;
|
|
21031
21141
|
scanCompleted = status.completed;
|
|
@@ -21035,17 +21145,17 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
21035
21145
|
try {
|
|
21036
21146
|
const { isLinked: isLinked2 } = await import("./knowledge-link-4yd2z8ev.js");
|
|
21037
21147
|
if (isLinked2(directory)) {
|
|
21038
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
21148
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-69z8w1ka.js");
|
|
21039
21149
|
let config;
|
|
21040
21150
|
try {
|
|
21041
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
21151
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-4b1e5m0d.js");
|
|
21042
21152
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21043
21153
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21044
21154
|
} catch {
|
|
21045
21155
|
config = KnowledgeConfigSchema2.parse({});
|
|
21046
21156
|
}
|
|
21047
21157
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
21048
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
21158
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-62w2pwfz.js");
|
|
21049
21159
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
21050
21160
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
21051
21161
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -22233,7 +22343,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
22233
22343
|
const result = runConfigDoctor(config, directory);
|
|
22234
22344
|
let output;
|
|
22235
22345
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
22236
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
22346
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-akxywx0c.js");
|
|
22237
22347
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
22238
22348
|
applyLossy: true
|
|
22239
22349
|
});
|
|
@@ -28574,6 +28684,12 @@ function serializeAgentSession(s) {
|
|
|
28574
28684
|
},
|
|
28575
28685
|
...s.cachedCohortId !== undefined && {
|
|
28576
28686
|
cachedCohortId: s.cachedCohortId
|
|
28687
|
+
},
|
|
28688
|
+
...s.lastObservedModel !== undefined && {
|
|
28689
|
+
lastObservedModel: s.lastObservedModel
|
|
28690
|
+
},
|
|
28691
|
+
...s.lastObservedProviderID !== undefined && {
|
|
28692
|
+
lastObservedProviderID: s.lastObservedProviderID
|
|
28577
28693
|
}
|
|
28578
28694
|
};
|
|
28579
28695
|
}
|
|
@@ -28821,7 +28937,7 @@ async function handleHistoryCommand(directory, _args) {
|
|
|
28821
28937
|
// src/commands/issue.ts
|
|
28822
28938
|
import * as fs24 from "fs";
|
|
28823
28939
|
import * as path56 from "path";
|
|
28824
|
-
var
|
|
28940
|
+
var USAGE8 = [
|
|
28825
28941
|
"Usage: /swarm issue <url|owner/repo#N|N> [--plan] [--trace] [--no-repro]",
|
|
28826
28942
|
"",
|
|
28827
28943
|
"Ingest a GitHub issue into the swarm workflow.",
|
|
@@ -28938,21 +29054,21 @@ function handleIssueCommand(directory, args) {
|
|
|
28938
29054
|
const parsed = parseArgs8(args);
|
|
28939
29055
|
const rawInput = parsed.rest.join(" ").trim();
|
|
28940
29056
|
if (!rawInput) {
|
|
28941
|
-
return
|
|
29057
|
+
return USAGE8;
|
|
28942
29058
|
}
|
|
28943
29059
|
const isFullUrl = /^https?:\/\//i.test(rawInput);
|
|
28944
29060
|
const issueInfo = parseIssueRef(isFullUrl ? sanitizeUrl(rawInput) : rawInput, directory);
|
|
28945
29061
|
if (!issueInfo) {
|
|
28946
29062
|
return `Error: Could not parse issue reference from "${sanitizeErrorEcho(rawInput)}"
|
|
28947
29063
|
|
|
28948
|
-
${
|
|
29064
|
+
${USAGE8}`;
|
|
28949
29065
|
}
|
|
28950
29066
|
const issueUrl = `https://github.com/${issueInfo.owner}/${issueInfo.repo}/issues/${issueInfo.number}`;
|
|
28951
29067
|
const result = validateAndSanitizeUrl2(issueUrl);
|
|
28952
29068
|
if ("error" in result) {
|
|
28953
29069
|
return `Error: ${result.error}
|
|
28954
29070
|
|
|
28955
|
-
${
|
|
29071
|
+
${USAGE8}`;
|
|
28956
29072
|
}
|
|
28957
29073
|
const swarmDir = path56.join(directory, ".swarm");
|
|
28958
29074
|
const issueReference = {
|
|
@@ -29003,7 +29119,7 @@ ${USAGE7}`;
|
|
|
29003
29119
|
const errMsg = e instanceof Error ? e.message : String(e);
|
|
29004
29120
|
return `Error: Failed to persist issue reference durably: ${errMsg}
|
|
29005
29121
|
|
|
29006
|
-
${
|
|
29122
|
+
${USAGE8}`;
|
|
29007
29123
|
}
|
|
29008
29124
|
const flags = [];
|
|
29009
29125
|
if (parsed.plan)
|
|
@@ -30528,7 +30644,7 @@ async function readLatestLoopState(directory) {
|
|
|
30528
30644
|
var _internals45 = {
|
|
30529
30645
|
readLatestLoopState
|
|
30530
30646
|
};
|
|
30531
|
-
var
|
|
30647
|
+
var USAGE9 = `Usage: /swarm loop <objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]
|
|
30532
30648
|
|
|
30533
30649
|
Run a compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve,
|
|
30534
30650
|
iterating until the objective is met or a budget stop condition fires.
|
|
@@ -30630,11 +30746,11 @@ async function handleLoopCommand(_directory, args) {
|
|
|
30630
30746
|
if (parsed.error) {
|
|
30631
30747
|
return `Error: ${parsed.error}
|
|
30632
30748
|
|
|
30633
|
-
${
|
|
30749
|
+
${USAGE9}`;
|
|
30634
30750
|
}
|
|
30635
30751
|
const objective = sanitizeObjective(parsed.rest.join(" "));
|
|
30636
30752
|
if (!objective && !parsed.resume) {
|
|
30637
|
-
return
|
|
30753
|
+
return USAGE9;
|
|
30638
30754
|
}
|
|
30639
30755
|
let autonomy = parsed.autonomy;
|
|
30640
30756
|
if (parsed.resume && !parsed.autonomyExplicit) {
|
|
@@ -31016,7 +31132,7 @@ var CuratorOutputMemoryDecisionSchema = exports_external.object({
|
|
|
31016
31132
|
// src/memory/injector.ts
|
|
31017
31133
|
init_schema();
|
|
31018
31134
|
// src/memory/consolidation-log.ts
|
|
31019
|
-
import { appendFile as
|
|
31135
|
+
import { appendFile as appendFile6, mkdir as mkdir17, readFile as readFile17 } from "fs/promises";
|
|
31020
31136
|
import * as path61 from "path";
|
|
31021
31137
|
var LOG_RELATIVE_PATH = path61.join("memory", "consolidation-log.jsonl");
|
|
31022
31138
|
var LOG_BASENAME = "consolidation-log.jsonl";
|
|
@@ -32496,7 +32612,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
|
|
|
32496
32612
|
}
|
|
32497
32613
|
|
|
32498
32614
|
// src/commands/pr-review.ts
|
|
32499
|
-
var
|
|
32615
|
+
var USAGE10 = [
|
|
32500
32616
|
"Usage: /swarm pr-review <url|owner/repo#N|N> [--council] [instructions...]",
|
|
32501
32617
|
"",
|
|
32502
32618
|
"Run a full swarm PR review on a GitHub pull request.",
|
|
@@ -32534,16 +32650,16 @@ function handlePrReviewCommand(directory, args) {
|
|
|
32534
32650
|
if (parsed.unknownFlag) {
|
|
32535
32651
|
return `Error: Unknown flag "${parsed.unknownFlag}"
|
|
32536
32652
|
|
|
32537
|
-
${
|
|
32653
|
+
${USAGE10}`;
|
|
32538
32654
|
}
|
|
32539
32655
|
const resolved = resolvePrCommandInput(parsed.rest, directory);
|
|
32540
32656
|
if (resolved === null) {
|
|
32541
|
-
return
|
|
32657
|
+
return USAGE10;
|
|
32542
32658
|
}
|
|
32543
32659
|
if ("error" in resolved) {
|
|
32544
32660
|
return `Error: ${resolved.error}
|
|
32545
32661
|
|
|
32546
|
-
${
|
|
32662
|
+
${USAGE10}`;
|
|
32547
32663
|
}
|
|
32548
32664
|
const councilFlag = parsed.council ? "council=true" : "council=false";
|
|
32549
32665
|
const signal = `[MODE: PR_REVIEW pr="${resolved.prUrl}" ${councilFlag}]`;
|
|
@@ -39328,7 +39444,7 @@ var _internals59 = {
|
|
|
39328
39444
|
writeProjectedSpecSync
|
|
39329
39445
|
};
|
|
39330
39446
|
var SWARM_SPEC_REL = path79.join(".swarm", "spec.md");
|
|
39331
|
-
var
|
|
39447
|
+
var USAGE11 = `Usage:
|
|
39332
39448
|
/swarm sdd status [--json] [--source <provider>]
|
|
39333
39449
|
/swarm sdd validate [--json] [--change <id>] [--source <provider>] [--feature <id>]
|
|
39334
39450
|
/swarm sdd project [--dry-run] [--overwrite] [--json] [--change <id>] [--source <provider>] [--feature <id>]
|
|
@@ -39441,11 +39557,11 @@ async function handleSddStatusCommand(directory, args) {
|
|
|
39441
39557
|
if (parsed.error)
|
|
39442
39558
|
return `Error: ${parsed.error}
|
|
39443
39559
|
|
|
39444
|
-
${
|
|
39560
|
+
${USAGE11}`;
|
|
39445
39561
|
if (parsed.feature && parsed.source && parsed.source !== "speckit") {
|
|
39446
39562
|
return `Error: --feature is only valid with --source speckit
|
|
39447
39563
|
|
|
39448
|
-
${
|
|
39564
|
+
${USAGE11}`;
|
|
39449
39565
|
}
|
|
39450
39566
|
const speckitDetection = detectSpeckit(directory);
|
|
39451
39567
|
const speckitPresent = speckitDetection.features.length > 0;
|
|
@@ -39512,11 +39628,11 @@ async function handleSddValidateCommand(directory, args) {
|
|
|
39512
39628
|
if (parsed.error)
|
|
39513
39629
|
return `Error: ${parsed.error}
|
|
39514
39630
|
|
|
39515
|
-
${
|
|
39631
|
+
${USAGE11}`;
|
|
39516
39632
|
if (parsed.feature && parsed.source && parsed.source !== "speckit") {
|
|
39517
39633
|
return `Error: --feature is only valid with --source speckit
|
|
39518
39634
|
|
|
39519
|
-
${
|
|
39635
|
+
${USAGE11}`;
|
|
39520
39636
|
}
|
|
39521
39637
|
let useSpeckit = false;
|
|
39522
39638
|
const nativeSpecExists = fs39.existsSync(path79.join(directory, SWARM_SPEC_REL));
|
|
@@ -39545,7 +39661,7 @@ ${USAGE10}`;
|
|
|
39545
39661
|
const resolution = resolveSpeckitProjection(directory);
|
|
39546
39662
|
return parsed.json ? JSON.stringify({ valid: false, error: formatSpeckitError(resolution) }, null, 2) : `Error: ${formatSpeckitError(resolution)}
|
|
39547
39663
|
|
|
39548
|
-
${
|
|
39664
|
+
${USAGE11}`;
|
|
39549
39665
|
}
|
|
39550
39666
|
}
|
|
39551
39667
|
}
|
|
@@ -39556,7 +39672,7 @@ ${USAGE10}`;
|
|
|
39556
39672
|
if (resolution.kind !== "ok" && resolution.kind !== "zero_requirements") {
|
|
39557
39673
|
return parsed.json ? JSON.stringify({ valid: false, error: formatSpeckitError(resolution) }, null, 2) : `Error: ${formatSpeckitError(resolution)}
|
|
39558
39674
|
|
|
39559
|
-
${
|
|
39675
|
+
${USAGE11}`;
|
|
39560
39676
|
}
|
|
39561
39677
|
const spec = resolution.kind === "ok" ? resolution.spec : null;
|
|
39562
39678
|
const result2 = {
|
|
@@ -39661,16 +39777,16 @@ async function handleSddProjectCommand(directory, args) {
|
|
|
39661
39777
|
if (parsed.error)
|
|
39662
39778
|
return `Error: ${parsed.error}
|
|
39663
39779
|
|
|
39664
|
-
${
|
|
39780
|
+
${USAGE11}`;
|
|
39665
39781
|
if (parsed.feature && parsed.source && parsed.source !== "speckit") {
|
|
39666
39782
|
return `Error: --feature is only valid with --source speckit
|
|
39667
39783
|
|
|
39668
|
-
${
|
|
39784
|
+
${USAGE11}`;
|
|
39669
39785
|
}
|
|
39670
39786
|
if (parsed.source === "swarm") {
|
|
39671
39787
|
return `Error: --source swarm selects the native .swarm/spec.md and does not generate a projection. Use --source openspec or --source speckit.
|
|
39672
39788
|
|
|
39673
|
-
${
|
|
39789
|
+
${USAGE11}`;
|
|
39674
39790
|
}
|
|
39675
39791
|
if (!parsed.dryRun) {
|
|
39676
39792
|
const nativeSpecPath = path79.join(directory, SWARM_SPEC_REL);
|
|
@@ -39680,7 +39796,7 @@ ${USAGE10}`;
|
|
|
39680
39796
|
"Error: .swarm/spec.md already exists.",
|
|
39681
39797
|
"Pass --overwrite to replace it.",
|
|
39682
39798
|
"",
|
|
39683
|
-
|
|
39799
|
+
USAGE11
|
|
39684
39800
|
].join(`
|
|
39685
39801
|
`);
|
|
39686
39802
|
}
|
|
@@ -39707,7 +39823,7 @@ ${USAGE10}`;
|
|
|
39707
39823
|
const resolution = resolveSpeckitProjection(directory);
|
|
39708
39824
|
return `Error: ${formatSpeckitError(resolution)}
|
|
39709
39825
|
|
|
39710
|
-
${
|
|
39826
|
+
${USAGE11}`;
|
|
39711
39827
|
}
|
|
39712
39828
|
}
|
|
39713
39829
|
}
|
|
@@ -39718,7 +39834,7 @@ ${USAGE10}`;
|
|
|
39718
39834
|
if (resolution.kind !== "ok") {
|
|
39719
39835
|
return `Error: ${formatSpeckitError(resolution)}
|
|
39720
39836
|
|
|
39721
|
-
${
|
|
39837
|
+
${USAGE11}`;
|
|
39722
39838
|
}
|
|
39723
39839
|
const result2 = _internals59.writeProjectedSpecSync(directory, {
|
|
39724
39840
|
source: "speckit",
|
|
@@ -39737,7 +39853,7 @@ ${USAGE10}`;
|
|
|
39737
39853
|
}
|
|
39738
39854
|
return `Error: ${result2.error}
|
|
39739
39855
|
|
|
39740
|
-
${
|
|
39856
|
+
${USAGE11}`;
|
|
39741
39857
|
}
|
|
39742
39858
|
if (!result2.projection) {
|
|
39743
39859
|
if (parsed.json) {
|
|
@@ -39751,7 +39867,7 @@ ${USAGE10}`;
|
|
|
39751
39867
|
return [
|
|
39752
39868
|
"SDD projection failed: no valid Spec-Kit projection could be built.",
|
|
39753
39869
|
"",
|
|
39754
|
-
|
|
39870
|
+
USAGE11
|
|
39755
39871
|
].join(`
|
|
39756
39872
|
`);
|
|
39757
39873
|
}
|
|
@@ -39794,7 +39910,7 @@ ${formatList(result2.projection.warnings)}` : ""
|
|
|
39794
39910
|
}
|
|
39795
39911
|
return `Error: ${result.error}
|
|
39796
39912
|
|
|
39797
|
-
${
|
|
39913
|
+
${USAGE11}`;
|
|
39798
39914
|
}
|
|
39799
39915
|
if (!result.projection) {
|
|
39800
39916
|
if (parsed.json) {
|
|
@@ -39808,7 +39924,7 @@ ${USAGE10}`;
|
|
|
39808
39924
|
return [
|
|
39809
39925
|
"SDD projection failed: no valid OpenSpec-compatible projection could be built.",
|
|
39810
39926
|
"",
|
|
39811
|
-
|
|
39927
|
+
USAGE11
|
|
39812
39928
|
].join(`
|
|
39813
39929
|
`);
|
|
39814
39930
|
}
|
|
@@ -39836,7 +39952,7 @@ ${formatList(result.projection.warnings)}` : ""
|
|
|
39836
39952
|
`);
|
|
39837
39953
|
}
|
|
39838
39954
|
async function handleSddCommand(_directory, _args) {
|
|
39839
|
-
return
|
|
39955
|
+
return USAGE11;
|
|
39840
39956
|
}
|
|
39841
39957
|
|
|
39842
39958
|
// src/commands/simulate.ts
|
|
@@ -41010,7 +41126,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
41010
41126
|
async function handleHelpCommand(ctx) {
|
|
41011
41127
|
const targetCommand = ctx.args.join(" ");
|
|
41012
41128
|
if (!targetCommand) {
|
|
41013
|
-
const { buildHelpText } = await import("./index-
|
|
41129
|
+
const { buildHelpText } = await import("./index-0cdq55k0.js");
|
|
41014
41130
|
return buildHelpText();
|
|
41015
41131
|
}
|
|
41016
41132
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -41019,7 +41135,7 @@ async function handleHelpCommand(ctx) {
|
|
|
41019
41135
|
return _internals62.buildDetailedHelp(resolved.key, resolved.entry);
|
|
41020
41136
|
}
|
|
41021
41137
|
const similar = _internals62.findSimilarCommands(targetCommand);
|
|
41022
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
41138
|
+
const { buildHelpText: fullHelp } = await import("./index-0cdq55k0.js");
|
|
41023
41139
|
if (similar.length > 0) {
|
|
41024
41140
|
return `Command '/swarm ${targetCommand}' not found.
|
|
41025
41141
|
|
|
@@ -41158,7 +41274,7 @@ var COMMAND_REGISTRY = {
|
|
|
41158
41274
|
},
|
|
41159
41275
|
"guardrail explain": {
|
|
41160
41276
|
handler: async (ctx) => {
|
|
41161
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
41277
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-kqx2bczn.js");
|
|
41162
41278
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
41163
41279
|
},
|
|
41164
41280
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -41168,7 +41284,7 @@ var COMMAND_REGISTRY = {
|
|
|
41168
41284
|
},
|
|
41169
41285
|
"guardrail-explain": {
|
|
41170
41286
|
handler: async (ctx) => {
|
|
41171
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
41287
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-kqx2bczn.js");
|
|
41172
41288
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
41173
41289
|
},
|
|
41174
41290
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -41178,7 +41294,7 @@ var COMMAND_REGISTRY = {
|
|
|
41178
41294
|
},
|
|
41179
41295
|
"guardrail-log": {
|
|
41180
41296
|
handler: async (ctx) => {
|
|
41181
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
41297
|
+
const { handleGuardrailLog } = await import("./guardrail-log-222xyxfp.js");
|
|
41182
41298
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
41183
41299
|
},
|
|
41184
41300
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -41531,6 +41647,14 @@ Subcommands:
|
|
|
41531
41647
|
category: "agent",
|
|
41532
41648
|
toolPolicy: "none"
|
|
41533
41649
|
},
|
|
41650
|
+
"abort-pr-workflow": {
|
|
41651
|
+
handler: (ctx) => handleAbortPrWorkflowCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
41652
|
+
description: "Clear a stuck PR_REVIEW/PR_FEEDBACK mechanical gate and stop the auto-resume loop [mode] [reason]",
|
|
41653
|
+
args: "[PR_REVIEW|PR_FEEDBACK] [reason...]",
|
|
41654
|
+
details: "Human-only escape hatch for an unrecoverable PR_REVIEW or PR_FEEDBACK mechanical gate. When the architect cannot reach complete_pr_workflow \u2014 for example a compound `git fetch && git checkout` was rejected as read-only shell syntax, the PR head cannot be fetched, or the working tree is on the wrong branch \u2014 running this clears the durable gate state for the current session and stops the auto-resume loop without depending on the trapped model. The agent itself cannot run this command; it must call the abort_pr_workflow tool (or ask you to run this command). Both paths funnel into the same fail-closed abortPrWorkflow hook, which refuses while the workflow is armed for publication or while PR workflow lanes are still in flight. An audit event is appended to .swarm/events.jsonl.",
|
|
41655
|
+
category: "utility",
|
|
41656
|
+
toolPolicy: "restricted"
|
|
41657
|
+
},
|
|
41534
41658
|
"pr-review": {
|
|
41535
41659
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handlePrReviewCommand, "PR_REVIEW"),
|
|
41536
41660
|
description: "Launch deep PR review with multi-lane analysis [url] [--council]",
|
|
@@ -42954,6 +43078,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
|
|
|
42954
43078
|
- RUN ALL MICRO-LANES: after the base explorer lanes settle, focus every repository-agnostic row from the exact diff/context pack and launch all 11 micro-lanes with \`mode: "swarm-pr-review:micro"\`, the complete all-\`MATCHED\` \`trigger_evaluation\`, and each trigger ID as \`workflow_lane\`. Keyword or path heuristics cannot waive a row. Missing any micro-lane is a BLOCKED coverage gap, not a speed optimization; split the lanes across bounded \`dispatch_lanes_async\` batches and use the same non-idling incremental collection pattern.
|
|
42955
43079
|
- RUN HEAD-BOUND VALIDATION: dispatch independent reviewers with \`mode: "swarm-pr-review:reviewer"\` and critics with \`mode: "swarm-pr-review:critic"\`, unique \`workflow_lane\` obligations, role-correct agents, and the same exact \`pr_head_sha\`. Critic dispatch is blocked until all declared reviewer obligations have successful artifacts.
|
|
42956
43080
|
- COMPLETE EXPLICITLY: after final artifacts and synthesis, call \`complete_pr_workflow\` with \`mode: "PR_REVIEW"\` and the bound \`pr_head_sha\`; never leave the session trapped in a stale workflow gate.
|
|
43081
|
+
- ABORT IF UNRECOVERABLE: if the PR head cannot be fetched/checked out (the working tree stays on the wrong branch), a compound \`git fetch && git checkout\` keeps being rejected as read-only shell syntax (run them as TWO separate standalone commands first), or the merge-base bind is unreachable for any reason, call \`abort_pr_workflow\` with \`mode: "PR_REVIEW"\` and a one-line \`reason\` instead of looping. The tool refuses while PR workflow lanes are in flight (collect their results first). Aborting clears the durable gate and stops the auto-resume loop; the user can also run \`/swarm abort-pr-workflow\`. Do NOT abort as a shortcut to avoid coverage obligations \u2014 only when the bind/checkout path is genuinely unreachable.
|
|
42957
43082
|
- Honor any free-text instructions that follow the closing bracket of the signal as additional reviewer focus, without weakening the validation ladder above.
|
|
42958
43083
|
|
|
42959
43084
|
### MODE: PR_FEEDBACK
|
|
@@ -42974,6 +43099,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
|
|
|
42974
43099
|
- DO NOT PUBLISH EARLY: commits, pushes, PR comments/updates, review-thread mutations, and other remote writes remain blocked until every ordered feedback gate settles positively on the same revision digest.
|
|
42975
43100
|
- After every local gate passes, create the reviewed commit with one standalone \`git commit\`, then call \`complete_pr_workflow\` once. It requires a clean index/worktree and a non-merge direct child whose sole parent is the immutable intake head before binding that post-commit HEAD and arming publication. Push only with \`git push <bound-remote> <bound-commit>:refs/heads/<bound-branch>\`; the literal bound commit and exact bound branch are required, and force flags, wrappers, aliases, fetch-based local-ref forgery, extra refspecs, \`git -C\`, and other remote writes fail closed. Perform read-only remote checks, then call \`complete_pr_workflow\` a second time with the same immutable verification \`pr_head_sha\`; the second call clears only after both the actual remote ref and its local tracking ref resolve to the exact bound commit. Only then perform any explicitly authorized PR comment/body/thread writes.
|
|
42976
43101
|
- Patch only confirmed items plus the tests/docs they require; report closure status for every ledger item including disproved ones.
|
|
43102
|
+
- ABORT IF UNRECOVERABLE (pre-armed only): if the PR head cannot be fetched/checked out or the verification bind is unreachable for any reason, call \`abort_pr_workflow\` with \`mode: "PR_FEEDBACK"\` and a one-line \`reason\` instead of looping. The tool refuses while PR workflow lanes are in flight (collect their results first) AND refuses once \`prFeedbackReadyToPublish\` is armed \u2014 after arming, you MUST complete the workflow with \`complete_pr_workflow\` (or push the bound commit first); aborting an armed gate would drop the immutable-commit binding and leave a half-published commit. Do NOT abort as a shortcut to skip the mechanical gates \u2014 only when the bind/verification path is genuinely unreachable.
|
|
42977
43103
|
- Do NOT resolve or mark GitHub review threads resolved unless the user explicitly instructs it.
|
|
42978
43104
|
- Honor any free-text instructions that follow the closing bracket of the signal as additional scope, without dropping any ledger item.
|
|
42979
43105
|
- Quality is the only metric \u2014 there is no speed, efficiency, or time exception; time, tokens, and agent dispatches are irrelevant to correctness
|
|
@@ -44447,6 +44573,17 @@ init_constants();
|
|
|
44447
44573
|
init_schema();
|
|
44448
44574
|
init_logger();
|
|
44449
44575
|
|
|
44576
|
+
// src/utils/provider-error-classification.ts
|
|
44577
|
+
var TRANSIENT_STATUS_CODES = new Set([
|
|
44578
|
+
408,
|
|
44579
|
+
429,
|
|
44580
|
+
500,
|
|
44581
|
+
502,
|
|
44582
|
+
503,
|
|
44583
|
+
504,
|
|
44584
|
+
529
|
|
44585
|
+
]);
|
|
44586
|
+
|
|
44450
44587
|
// src/hooks/guardrails/destructive-command.ts
|
|
44451
44588
|
import * as fsSync3 from "fs";
|
|
44452
44589
|
import * as path83 from "path";
|
|
@@ -44788,9 +44925,6 @@ init_schema();
|
|
|
44788
44925
|
// src/hooks/model-limits.ts
|
|
44789
44926
|
var loggedFirstCalls = new Set;
|
|
44790
44927
|
|
|
44791
|
-
// src/hooks/guardrails/messages-transform.ts
|
|
44792
|
-
var TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
|
|
44793
|
-
|
|
44794
44928
|
// src/hooks/guardrails/nontransient-circuit.ts
|
|
44795
44929
|
init_schema();
|
|
44796
44930
|
var IMMEDIATE_HARD_STOP_CATEGORIES = new Set([
|
|
@@ -45552,9 +45686,9 @@ function detectInterpreterEval(cmd) {
|
|
|
45552
45686
|
return [];
|
|
45553
45687
|
const suffixWords = getSuffixWords(cmd);
|
|
45554
45688
|
const evalFlags = {
|
|
45555
|
-
python: ["-c"
|
|
45556
|
-
python3: ["-c"
|
|
45557
|
-
python2: ["-c"
|
|
45689
|
+
python: ["-c"],
|
|
45690
|
+
python3: ["-c"],
|
|
45691
|
+
python2: ["-c"],
|
|
45558
45692
|
node: ["-e", "-p", "-pe"],
|
|
45559
45693
|
bun: ["-e", "-p", "-pe"],
|
|
45560
45694
|
ruby: ["-e"],
|
|
@@ -46497,7 +46631,6 @@ var SPEC_DRIFT_BLOCKED_TOOLS = new Set([
|
|
|
46497
46631
|
"lean_turbo_run_phase",
|
|
46498
46632
|
"lean_turbo_acquire_locks"
|
|
46499
46633
|
]);
|
|
46500
|
-
var TRANSIENT_STATUS_CODES2 = new Set([408, 429, 500, 502, 503, 504, 529]);
|
|
46501
46634
|
var toolCallsSinceLastWrite = new Map;
|
|
46502
46635
|
var noOpWarningIssued = new Set;
|
|
46503
46636
|
// src/hooks/delegation-gate.ts
|