opencode-swarm 7.20.0 → 7.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/hooks/guardrails.d.ts +21 -0
- package/dist/index.js +310 -257
- package/dist/state.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var package_default;
|
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "opencode-swarm",
|
|
36
|
-
version: "7.20.
|
|
36
|
+
version: "7.20.1",
|
|
37
37
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
38
38
|
main: "dist/index.js",
|
|
39
39
|
types: "dist/index.d.ts",
|
|
@@ -24268,6 +24268,33 @@ function extractErrorSignal(errorContent) {
|
|
|
24268
24268
|
}
|
|
24269
24269
|
return parts2.join(" ");
|
|
24270
24270
|
}
|
|
24271
|
+
function getMessageText(message) {
|
|
24272
|
+
if (!message?.parts)
|
|
24273
|
+
return "";
|
|
24274
|
+
return message.parts.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
|
|
24275
|
+
`);
|
|
24276
|
+
}
|
|
24277
|
+
function getMostRecentAssistantText(messages) {
|
|
24278
|
+
for (let i2 = messages.length - 1;i2 >= 0; i2--) {
|
|
24279
|
+
if (messages[i2]?.info?.role === "assistant") {
|
|
24280
|
+
return getMessageText(messages[i2]);
|
|
24281
|
+
}
|
|
24282
|
+
}
|
|
24283
|
+
return "";
|
|
24284
|
+
}
|
|
24285
|
+
function isTransientProviderFailureText(text) {
|
|
24286
|
+
if (!text.trim())
|
|
24287
|
+
return false;
|
|
24288
|
+
const providerFailureMarker = /provider[_\s-]?unavailable|network\s+connection\s+lost/i.test(text);
|
|
24289
|
+
if (!providerFailureMarker)
|
|
24290
|
+
return false;
|
|
24291
|
+
const status = extractStatusCode(text);
|
|
24292
|
+
const hasTransientStatus = status !== null && TRANSIENT_STATUS_CODES.has(status);
|
|
24293
|
+
return hasTransientStatus || TRANSIENT_MODEL_ERROR_PATTERN.test(text);
|
|
24294
|
+
}
|
|
24295
|
+
function getProviderFailureFingerprint(text) {
|
|
24296
|
+
return String(hashArgs({ providerFailure: text.slice(-4000) }));
|
|
24297
|
+
}
|
|
24271
24298
|
function getStoredInputArgs(callID) {
|
|
24272
24299
|
return storedInputArgs.get(callID);
|
|
24273
24300
|
}
|
|
@@ -25482,7 +25509,8 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
25482
25509
|
const isTransientStatusCode = extractedStatus !== null && TRANSIENT_STATUS_CODES.has(extractedStatus);
|
|
25483
25510
|
const isTransientPatternMatch = TRANSIENT_MODEL_ERROR_PATTERN.test(errorSignal);
|
|
25484
25511
|
const isTransientMatch = isTransientStatusCode || isTransientPatternMatch;
|
|
25485
|
-
const
|
|
25512
|
+
const maxTransientRetries = cfg.max_transient_retries ?? 5;
|
|
25513
|
+
const isTransient = !!session && isTransientMatch && window2.transientRetryCount < maxTransientRetries;
|
|
25486
25514
|
const isDegraded = !isTransient && DEGRADED_ERROR_PATTERN.test(errorSignal);
|
|
25487
25515
|
if (isTransient) {
|
|
25488
25516
|
window2.transientRetryCount++;
|
|
@@ -25491,7 +25519,7 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
25491
25519
|
if (session && !session.modelFallbackExhausted) {
|
|
25492
25520
|
session.model_fallback_index++;
|
|
25493
25521
|
const baseAgentName = session.agentName ? session.agentName.replace(/^[^_]+[_]/, "") : "";
|
|
25494
|
-
const swarmAgents = getSwarmAgents();
|
|
25522
|
+
const swarmAgents = _internals10.getSwarmAgents();
|
|
25495
25523
|
const fallbackModels = swarmAgents?.[baseAgentName]?.fallback_models;
|
|
25496
25524
|
session.modelFallbackExhausted = !fallbackModels || session.model_fallback_index > fallbackModels.length;
|
|
25497
25525
|
session.pendingAdvisoryMessages ??= [];
|
|
@@ -25511,13 +25539,14 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
25511
25539
|
} else {
|
|
25512
25540
|
window2.consecutiveErrors++;
|
|
25513
25541
|
}
|
|
25542
|
+
let modelFallbackAdvisoryEmitted = false;
|
|
25514
25543
|
if (session && isTransientMatch && !session.modelFallbackExhausted && !isDegraded) {
|
|
25515
25544
|
session.model_fallback_index++;
|
|
25516
25545
|
const baseAgentName = session.agentName ? session.agentName.replace(/^[^_]+[_]/, "") : "";
|
|
25517
|
-
const swarmAgents = getSwarmAgents();
|
|
25546
|
+
const swarmAgents = _internals10.getSwarmAgents();
|
|
25518
25547
|
const fallbackModels = swarmAgents?.[baseAgentName]?.fallback_models;
|
|
25519
25548
|
session.modelFallbackExhausted = !fallbackModels || session.model_fallback_index > fallbackModels.length;
|
|
25520
|
-
const fallbackModel = resolveFallbackModel(baseAgentName, session.model_fallback_index, swarmAgents);
|
|
25549
|
+
const fallbackModel = _internals10.resolveFallbackModel(baseAgentName, session.model_fallback_index, swarmAgents);
|
|
25521
25550
|
const primaryModel = swarmAgents?.[baseAgentName]?.model ?? "default";
|
|
25522
25551
|
if (fallbackModel) {
|
|
25523
25552
|
if (swarmAgents?.[baseAgentName]) {
|
|
@@ -25525,17 +25554,19 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
25525
25554
|
}
|
|
25526
25555
|
session.pendingAdvisoryMessages ??= [];
|
|
25527
25556
|
session.pendingAdvisoryMessages.push(`MODEL FALLBACK: Applied fallback model "${fallbackModel}" (attempt ${session.model_fallback_index}). ` + `Using /swarm handoff to reset to primary model.`);
|
|
25557
|
+
modelFallbackAdvisoryEmitted = true;
|
|
25528
25558
|
} else {
|
|
25529
25559
|
session.pendingAdvisoryMessages ??= [];
|
|
25530
25560
|
session.pendingAdvisoryMessages.push(`MODEL FALLBACK: Transient model error detected (attempt ${session.model_fallback_index}). ` + `No fallback models configured for this agent. Add "fallback_models": ["model-a", "model-b"] ` + `to the agent's config in opencode-swarm.json.`);
|
|
25561
|
+
modelFallbackAdvisoryEmitted = true;
|
|
25531
25562
|
}
|
|
25532
25563
|
telemetry.modelFallback(input.sessionID, session.agentName, primaryModel, fallbackModel ?? "none", "transient_model_error");
|
|
25533
25564
|
swarmState.pendingEvents++;
|
|
25534
25565
|
}
|
|
25535
|
-
if (session && isTransient && isTransientMatch) {
|
|
25566
|
+
if (session && isTransient && isTransientMatch && !modelFallbackAdvisoryEmitted) {
|
|
25536
25567
|
session.pendingAdvisoryMessages ??= [];
|
|
25537
|
-
if (!session.pendingAdvisoryMessages.some((m) => m.startsWith("TRANSIENT ERROR:"))) {
|
|
25538
|
-
session.pendingAdvisoryMessages.push(`TRANSIENT ERROR: Provider error detected (attempt ${window2.transientRetryCount}/${
|
|
25568
|
+
if (!session.pendingAdvisoryMessages.some((m) => m.startsWith("TRANSIENT ERROR:") || m.startsWith("MODEL FALLBACK:"))) {
|
|
25569
|
+
session.pendingAdvisoryMessages.push(`TRANSIENT ERROR: Provider error detected (attempt ${window2.transientRetryCount}/${maxTransientRetries}). Retrying...`);
|
|
25539
25570
|
}
|
|
25540
25571
|
}
|
|
25541
25572
|
} else {
|
|
@@ -25588,6 +25619,21 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
25588
25619
|
const activeAgent = swarmState.activeAgent.get(sessionId);
|
|
25589
25620
|
const isArchitectSession = activeAgent ? stripKnownSwarmPrefix(activeAgent) === ORCHESTRATOR_NAME : session ? stripKnownSwarmPrefix(session.agentName) === ORCHESTRATOR_NAME : false;
|
|
25590
25621
|
const systemMessages = messages.filter((msg) => msg.info?.role === "system");
|
|
25622
|
+
if (isArchitectSession && session) {
|
|
25623
|
+
const lastAssistantText = getMostRecentAssistantText(messages);
|
|
25624
|
+
if (isTransientProviderFailureText(lastAssistantText)) {
|
|
25625
|
+
const fingerprint = getProviderFailureFingerprint(lastAssistantText);
|
|
25626
|
+
session.pendingAdvisoryMessages ??= [];
|
|
25627
|
+
const alreadyPending = session.pendingAdvisoryMessages.some((message) => message.startsWith(TRANSIENT_PROVIDER_RECOVERY_TAG));
|
|
25628
|
+
const alreadyInjected = systemMessages.some((message) => getMessageText(message).includes(TRANSIENT_PROVIDER_RECOVERY_TAG));
|
|
25629
|
+
if (session.lastProviderRecoveryFingerprint !== fingerprint && !alreadyPending && !alreadyInjected) {
|
|
25630
|
+
session.pendingAdvisoryMessages.push(`${TRANSIENT_PROVIDER_RECOVERY_TAG}: The previous Architect response appears to have been interrupted by a transient provider/network error. On this turn, continue from the last stable step, inspect current repo or plan state if needed, and keep working instead of treating the interrupted response as task completion.`);
|
|
25631
|
+
session.lastProviderRecoveryFingerprint = fingerprint;
|
|
25632
|
+
}
|
|
25633
|
+
} else {
|
|
25634
|
+
session.lastProviderRecoveryFingerprint = undefined;
|
|
25635
|
+
}
|
|
25636
|
+
}
|
|
25591
25637
|
if (isArchitectSession) {
|
|
25592
25638
|
let lastAssistantMsg;
|
|
25593
25639
|
for (let i2 = messages.length - 1;i2 >= 0; i2--) {
|
|
@@ -26115,7 +26161,7 @@ function checkFileAuthorityWithRules(agentName, filePath, cwd, effectiveRules, o
|
|
|
26115
26161
|
}
|
|
26116
26162
|
return { allowed: true };
|
|
26117
26163
|
}
|
|
26118
|
-
var import_picomatch, SPEC_DRIFT_BLOCKED_TOOLS, storedInputArgs, TRANSIENT_STATUS_CODES, TRANSIENT_MODEL_ERROR_PATTERN, DEGRADED_ERROR_PATTERN, CONTENT_FILTER_PATTERN, toolCallsSinceLastWrite, noOpWarningIssued, consecutiveNoToolTurns, DC_MAX_UNWRAP_DEPTH = 5, DC_SAFE_TARGETS, DC_BLOCKED_ABSOLUTE_PREFIXES, DC_FS_ROOTS, DC_REMOTE_PREFIXES, pathNormalizationCache, globMatcherCache, DEFAULT_AGENT_AUTHORITY_RULES;
|
|
26164
|
+
var import_picomatch, _internals10, SPEC_DRIFT_BLOCKED_TOOLS, storedInputArgs, TRANSIENT_STATUS_CODES, TRANSIENT_MODEL_ERROR_PATTERN, TRANSIENT_PROVIDER_RECOVERY_TAG = "TRANSIENT PROVIDER RECOVERY", DEGRADED_ERROR_PATTERN, CONTENT_FILTER_PATTERN, toolCallsSinceLastWrite, noOpWarningIssued, consecutiveNoToolTurns, DC_MAX_UNWRAP_DEPTH = 5, DC_SAFE_TARGETS, DC_BLOCKED_ABSOLUTE_PREFIXES, DC_FS_ROOTS, DC_REMOTE_PREFIXES, pathNormalizationCache, globMatcherCache, DEFAULT_AGENT_AUTHORITY_RULES;
|
|
26119
26165
|
var init_guardrails = __esm(() => {
|
|
26120
26166
|
init_quick_lru();
|
|
26121
26167
|
init_agents2();
|
|
@@ -26135,6 +26181,13 @@ var init_guardrails = __esm(() => {
|
|
|
26135
26181
|
init_model_limits();
|
|
26136
26182
|
init_normalize_tool_name();
|
|
26137
26183
|
import_picomatch = __toESM(require_picomatch2(), 1);
|
|
26184
|
+
_internals10 = {
|
|
26185
|
+
getSwarmAgents,
|
|
26186
|
+
getMostRecentAssistantText,
|
|
26187
|
+
getProviderFailureFingerprint,
|
|
26188
|
+
isTransientProviderFailureText,
|
|
26189
|
+
resolveFallbackModel
|
|
26190
|
+
};
|
|
26138
26191
|
SPEC_DRIFT_BLOCKED_TOOLS = new Set([
|
|
26139
26192
|
"save_plan",
|
|
26140
26193
|
"update_task_status",
|
|
@@ -26144,7 +26197,7 @@ var init_guardrails = __esm(() => {
|
|
|
26144
26197
|
]);
|
|
26145
26198
|
storedInputArgs = new Map;
|
|
26146
26199
|
TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
|
|
26147
|
-
TRANSIENT_MODEL_ERROR_PATTERN = /rate.?limit|429|500|502|503|504|529|timeout|overloaded|model.?not.?found|temporarily.?unavailable|provider
|
|
26200
|
+
TRANSIENT_MODEL_ERROR_PATTERN = /rate.?limit|429|500|502|503|504|529|timeout|overloaded|model.?not.?found|temporarily.?unavailable|provider[_\s-]?unavailable|server.?error|network.?connection.?lost|connection.?(refused|reset|timeout|lost)|bad.?gateway|gateway.?timeout|internal.?server.?error|service.?unavailable/i;
|
|
26148
26201
|
DEGRADED_ERROR_PATTERN = /context.?length|token.?(limit|budget)|input.?too.?long|content.?filter|exceeds?.?(maximum.?)?tokens|maximum.?context|context.?window|too.?many.?tokens|prompt.?too.?long|message.?too.?long|request.?too.?large|max.?tokens/i;
|
|
26149
26202
|
CONTENT_FILTER_PATTERN = /content.?filter/i;
|
|
26150
26203
|
toolCallsSinceLastWrite = new Map;
|
|
@@ -27135,7 +27188,7 @@ __export(exports_state, {
|
|
|
27135
27188
|
advanceTaskState: () => advanceTaskState,
|
|
27136
27189
|
addKnowledgeAckDedup: () => addKnowledgeAckDedup,
|
|
27137
27190
|
_resetCouncilDisagreementWarnings: () => _resetCouncilDisagreementWarnings,
|
|
27138
|
-
_internals: () =>
|
|
27191
|
+
_internals: () => _internals11,
|
|
27139
27192
|
MAX_TRACKED_KNOWLEDGE_ACKS: () => MAX_TRACKED_KNOWLEDGE_ACKS,
|
|
27140
27193
|
MAX_TRACKED_CRITICAL_SHOWN: () => MAX_TRACKED_CRITICAL_SHOWN,
|
|
27141
27194
|
AgentRunContext: () => AgentRunContext
|
|
@@ -27239,10 +27292,10 @@ function startAgentSession(sessionId, agentName, staleDurationMs = 7200000, dire
|
|
|
27239
27292
|
swarmState.agentSessions.set(sessionId, sessionState);
|
|
27240
27293
|
telemetry.sessionStarted(sessionId, agentName);
|
|
27241
27294
|
swarmState.activeAgent.set(sessionId, agentName);
|
|
27242
|
-
|
|
27295
|
+
_internals11.applyRehydrationCache(sessionState);
|
|
27243
27296
|
if (directory) {
|
|
27244
27297
|
let rehydrationPromise;
|
|
27245
|
-
rehydrationPromise =
|
|
27298
|
+
rehydrationPromise = _internals11.rehydrateSessionFromDisk(directory, sessionState).catch((err2) => {
|
|
27246
27299
|
warn("[state] Rehydration failed:", err2 instanceof Error ? err2.message : String(err2));
|
|
27247
27300
|
}).finally(() => {
|
|
27248
27301
|
swarmState.pendingRehydrations.delete(rehydrationPromise);
|
|
@@ -27406,7 +27459,7 @@ function ensureAgentSession(sessionId, agentName, directory) {
|
|
|
27406
27459
|
session.lastToolCallTime = now;
|
|
27407
27460
|
return session;
|
|
27408
27461
|
}
|
|
27409
|
-
|
|
27462
|
+
_internals11.startAgentSession(sessionId, agentName ?? "unknown", 7200000, directory);
|
|
27410
27463
|
session = swarmState.agentSessions.get(sessionId);
|
|
27411
27464
|
if (!session) {
|
|
27412
27465
|
throw new Error(`Failed to create guardrail session for ${sessionId}`);
|
|
@@ -27760,8 +27813,8 @@ function applyRehydrationCache(session) {
|
|
|
27760
27813
|
}
|
|
27761
27814
|
}
|
|
27762
27815
|
async function rehydrateSessionFromDisk(directory, session) {
|
|
27763
|
-
await
|
|
27764
|
-
|
|
27816
|
+
await _internals11.buildRehydrationCache(directory);
|
|
27817
|
+
_internals11.applyRehydrationCache(session);
|
|
27765
27818
|
}
|
|
27766
27819
|
function hasActiveTurboMode(sessionID) {
|
|
27767
27820
|
if (sessionID) {
|
|
@@ -27842,7 +27895,7 @@ function addKnowledgeAckDedup(key) {
|
|
|
27842
27895
|
set2.delete(oldest);
|
|
27843
27896
|
}
|
|
27844
27897
|
}
|
|
27845
|
-
var _rehydrationCache = null, _councilDisagreementWarned, _toolAggregates, defaultRunContext, _runContexts, swarmState, MAX_TRACKED_CRITICAL_SHOWN = 500, MAX_TRACKED_KNOWLEDGE_ACKS = 5000,
|
|
27898
|
+
var _rehydrationCache = null, _councilDisagreementWarned, _toolAggregates, defaultRunContext, _runContexts, swarmState, MAX_TRACKED_CRITICAL_SHOWN = 500, MAX_TRACKED_KNOWLEDGE_ACKS = 5000, _internals11;
|
|
27846
27899
|
var init_state = __esm(() => {
|
|
27847
27900
|
init_constants();
|
|
27848
27901
|
init_plan_schema();
|
|
@@ -27876,7 +27929,7 @@ var init_state = __esm(() => {
|
|
|
27876
27929
|
fullAutoEnabledInConfig: false,
|
|
27877
27930
|
environmentProfiles: defaultRunContext.environmentProfiles
|
|
27878
27931
|
};
|
|
27879
|
-
|
|
27932
|
+
_internals11 = {
|
|
27880
27933
|
swarmState,
|
|
27881
27934
|
resetSwarmState,
|
|
27882
27935
|
ensureAgentSession,
|
|
@@ -41486,7 +41539,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
41486
41539
|
const prunedBranches = [];
|
|
41487
41540
|
try {
|
|
41488
41541
|
const currentBranch = getCurrentBranch(cwd);
|
|
41489
|
-
const defaultRemoteBranch =
|
|
41542
|
+
const defaultRemoteBranch = _internals12.detectDefaultRemoteBranch(cwd);
|
|
41490
41543
|
if (!defaultRemoteBranch) {
|
|
41491
41544
|
return {
|
|
41492
41545
|
success: false,
|
|
@@ -41668,7 +41721,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
41668
41721
|
function resetToMainAfterMerge(cwd, options) {
|
|
41669
41722
|
const warnings = [];
|
|
41670
41723
|
try {
|
|
41671
|
-
const defaultBranch =
|
|
41724
|
+
const defaultBranch = _internals12.detectDefaultRemoteBranch(cwd);
|
|
41672
41725
|
if (!defaultBranch) {
|
|
41673
41726
|
return {
|
|
41674
41727
|
success: false,
|
|
@@ -41695,7 +41748,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41695
41748
|
}
|
|
41696
41749
|
if (currentBranch === defaultBranch) {
|
|
41697
41750
|
try {
|
|
41698
|
-
const logOutput =
|
|
41751
|
+
const logOutput = _internals12.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
|
|
41699
41752
|
if (logOutput.trim().length > 0) {
|
|
41700
41753
|
return {
|
|
41701
41754
|
success: false,
|
|
@@ -41710,11 +41763,11 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41710
41763
|
} catch {}
|
|
41711
41764
|
} else {
|
|
41712
41765
|
try {
|
|
41713
|
-
|
|
41766
|
+
_internals12.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
|
|
41714
41767
|
} catch {
|
|
41715
41768
|
try {
|
|
41716
|
-
const localSha =
|
|
41717
|
-
const remoteSha =
|
|
41769
|
+
const localSha = _internals12.gitExec(["rev-parse", "HEAD"], cwd).trim();
|
|
41770
|
+
const remoteSha = _internals12.gitExec(["rev-parse", targetBranch], cwd).trim();
|
|
41718
41771
|
if (localSha !== remoteSha) {
|
|
41719
41772
|
return {
|
|
41720
41773
|
success: false,
|
|
@@ -41740,7 +41793,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41740
41793
|
}
|
|
41741
41794
|
}
|
|
41742
41795
|
try {
|
|
41743
|
-
|
|
41796
|
+
_internals12.gitExec(["fetch", "--prune", "origin"], cwd);
|
|
41744
41797
|
} catch (err2) {
|
|
41745
41798
|
return {
|
|
41746
41799
|
success: false,
|
|
@@ -41756,7 +41809,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41756
41809
|
let switchedBranch = false;
|
|
41757
41810
|
if (currentBranch !== defaultBranch) {
|
|
41758
41811
|
try {
|
|
41759
|
-
|
|
41812
|
+
_internals12.gitExec(["checkout", defaultBranch], cwd);
|
|
41760
41813
|
switchedBranch = true;
|
|
41761
41814
|
} catch (err2) {
|
|
41762
41815
|
return {
|
|
@@ -41771,7 +41824,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41771
41824
|
}
|
|
41772
41825
|
}
|
|
41773
41826
|
try {
|
|
41774
|
-
|
|
41827
|
+
_internals12.gitExec(["reset", "--hard", targetBranch], cwd);
|
|
41775
41828
|
} catch (err2) {
|
|
41776
41829
|
return {
|
|
41777
41830
|
success: false,
|
|
@@ -41792,7 +41845,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41792
41845
|
while (Date.now() < endTime) {}
|
|
41793
41846
|
}
|
|
41794
41847
|
try {
|
|
41795
|
-
|
|
41848
|
+
_internals12.gitExec(["checkout", "--", "."], cwd);
|
|
41796
41849
|
discardSucceeded = true;
|
|
41797
41850
|
break;
|
|
41798
41851
|
} catch {}
|
|
@@ -41803,18 +41856,18 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41803
41856
|
changesDiscarded = discardSucceeded;
|
|
41804
41857
|
}
|
|
41805
41858
|
try {
|
|
41806
|
-
|
|
41859
|
+
_internals12.gitExec(["clean", "-fd"], cwd);
|
|
41807
41860
|
} catch {
|
|
41808
41861
|
warnings.push("Could not clean untracked files");
|
|
41809
41862
|
}
|
|
41810
41863
|
let branchDeleted = false;
|
|
41811
41864
|
if (switchedBranch && previousBranch !== defaultBranch) {
|
|
41812
41865
|
try {
|
|
41813
|
-
const mergedOutput =
|
|
41866
|
+
const mergedOutput = _internals12.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
41814
41867
|
const isMerged = mergedOutput.split(`
|
|
41815
41868
|
`).some((line) => line.trim() === previousBranch || line.trim() === `* ${previousBranch}`);
|
|
41816
41869
|
if (isMerged) {
|
|
41817
|
-
|
|
41870
|
+
_internals12.gitExec(["branch", "-d", previousBranch], cwd);
|
|
41818
41871
|
branchDeleted = true;
|
|
41819
41872
|
} else {
|
|
41820
41873
|
warnings.push(`Branch ${previousBranch} is not merged into ${defaultBranch} — keeping it`);
|
|
@@ -41825,7 +41878,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41825
41878
|
}
|
|
41826
41879
|
if (options?.pruneBranches) {
|
|
41827
41880
|
try {
|
|
41828
|
-
const mergedOutput =
|
|
41881
|
+
const mergedOutput = _internals12.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
41829
41882
|
const mergedLines = mergedOutput.split(`
|
|
41830
41883
|
`);
|
|
41831
41884
|
for (const line of mergedLines) {
|
|
@@ -41834,7 +41887,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41834
41887
|
continue;
|
|
41835
41888
|
}
|
|
41836
41889
|
try {
|
|
41837
|
-
|
|
41890
|
+
_internals12.gitExec(["branch", "-d", trimmedLine], cwd);
|
|
41838
41891
|
} catch {
|
|
41839
41892
|
warnings.push(`Could not prune branch: ${trimmedLine}`);
|
|
41840
41893
|
}
|
|
@@ -41864,10 +41917,10 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
41864
41917
|
};
|
|
41865
41918
|
}
|
|
41866
41919
|
}
|
|
41867
|
-
var GIT_TIMEOUT_MS2 = 30000,
|
|
41920
|
+
var GIT_TIMEOUT_MS2 = 30000, _internals12;
|
|
41868
41921
|
var init_branch = __esm(() => {
|
|
41869
41922
|
init_logger();
|
|
41870
|
-
|
|
41923
|
+
_internals12 = {
|
|
41871
41924
|
gitExec: gitExec2,
|
|
41872
41925
|
detectDefaultRemoteBranch,
|
|
41873
41926
|
getDefaultBaseBranch,
|
|
@@ -42944,7 +42997,7 @@ __export(exports_skill_generator, {
|
|
|
42944
42997
|
activeRepoRelativePath: () => activeRepoRelativePath,
|
|
42945
42998
|
activePath: () => activePath,
|
|
42946
42999
|
activateProposal: () => activateProposal,
|
|
42947
|
-
_internals: () =>
|
|
43000
|
+
_internals: () => _internals13
|
|
42948
43001
|
});
|
|
42949
43002
|
import { existsSync as existsSync11 } from "node:fs";
|
|
42950
43003
|
import { mkdir as mkdir5, readFile as readFile6, rename as rename3, writeFile as writeFile5 } from "node:fs/promises";
|
|
@@ -43392,13 +43445,13 @@ async function inspectSkill(directory, slug, prefer = "auto") {
|
|
|
43392
43445
|
}
|
|
43393
43446
|
return { found: false };
|
|
43394
43447
|
}
|
|
43395
|
-
var SLUG_PATTERN,
|
|
43448
|
+
var SLUG_PATTERN, _internals13;
|
|
43396
43449
|
var init_skill_generator = __esm(() => {
|
|
43397
43450
|
init_knowledge_store();
|
|
43398
43451
|
init_knowledge_validator();
|
|
43399
43452
|
init_logger();
|
|
43400
43453
|
SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
43401
|
-
|
|
43454
|
+
_internals13 = {
|
|
43402
43455
|
sanitizeSlug,
|
|
43403
43456
|
isValidSlug,
|
|
43404
43457
|
selectCandidateEntries,
|
|
@@ -43620,8 +43673,8 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
43620
43673
|
const observations = [];
|
|
43621
43674
|
const timestamp = new Date().toISOString();
|
|
43622
43675
|
for (const agent of requiredAgents) {
|
|
43623
|
-
const normalizedAgent =
|
|
43624
|
-
const isDispatched = agentsDispatched.some((a) =>
|
|
43676
|
+
const normalizedAgent = _internals14.normalizeAgentName(agent);
|
|
43677
|
+
const isDispatched = agentsDispatched.some((a) => _internals14.normalizeAgentName(a) === normalizedAgent);
|
|
43625
43678
|
if (!isDispatched) {
|
|
43626
43679
|
observations.push({
|
|
43627
43680
|
phase,
|
|
@@ -43640,7 +43693,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
43640
43693
|
if (e.type === "agent.delegation") {
|
|
43641
43694
|
const agent = e.agent;
|
|
43642
43695
|
if (agent && typeof agent === "string") {
|
|
43643
|
-
const normalized =
|
|
43696
|
+
const normalized = _internals14.normalizeAgentName(agent);
|
|
43644
43697
|
if (normalized === "coder") {
|
|
43645
43698
|
coderDelegations.push({ event: e, index: i2 });
|
|
43646
43699
|
} else if (normalized === "reviewer") {
|
|
@@ -43697,7 +43750,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
43697
43750
|
if (e.type === "agent.delegation" && e.agent) {
|
|
43698
43751
|
const agent = e.agent;
|
|
43699
43752
|
if (agent && typeof agent === "string") {
|
|
43700
|
-
const normalized =
|
|
43753
|
+
const normalized = _internals14.normalizeAgentName(agent);
|
|
43701
43754
|
if (normalized === "sme") {
|
|
43702
43755
|
smeDelegations.push({ event: e, index: i2 });
|
|
43703
43756
|
}
|
|
@@ -43721,7 +43774,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
43721
43774
|
}
|
|
43722
43775
|
async function runCuratorInit(directory, config3, llmDelegate) {
|
|
43723
43776
|
try {
|
|
43724
|
-
const priorSummary = await
|
|
43777
|
+
const priorSummary = await _internals14.readCuratorSummary(directory);
|
|
43725
43778
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
43726
43779
|
const allEntries = await readKnowledge(knowledgePath);
|
|
43727
43780
|
const highConfidenceEntries = allEntries.filter((e) => typeof e.confidence === "number" && e.confidence >= config3.min_knowledge_confidence);
|
|
@@ -43842,7 +43895,7 @@ Could not load prior session context.`,
|
|
|
43842
43895
|
}
|
|
43843
43896
|
async function runCuratorPhase(directory, phase, agentsDispatched, config3, _knowledgeConfig, llmDelegate) {
|
|
43844
43897
|
try {
|
|
43845
|
-
const priorSummary = await
|
|
43898
|
+
const priorSummary = await _internals14.readCuratorSummary(directory);
|
|
43846
43899
|
if (priorSummary?.phase_digests.some((d) => d.phase === phase)) {
|
|
43847
43900
|
const existingDigest = priorSummary.phase_digests.find((d) => d.phase === phase);
|
|
43848
43901
|
return {
|
|
@@ -43854,10 +43907,10 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config3, _kno
|
|
|
43854
43907
|
};
|
|
43855
43908
|
}
|
|
43856
43909
|
const eventsJsonlContent = await readSwarmFileAsync(directory, "events.jsonl");
|
|
43857
|
-
const phaseEvents = eventsJsonlContent ?
|
|
43910
|
+
const phaseEvents = eventsJsonlContent ? _internals14.filterPhaseEvents(eventsJsonlContent, phase) : [];
|
|
43858
43911
|
const contextMd = await readSwarmFileAsync(directory, "context.md");
|
|
43859
43912
|
const requiredAgents = ["reviewer", "test_engineer"];
|
|
43860
|
-
const complianceObservations =
|
|
43913
|
+
const complianceObservations = _internals14.checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, phase);
|
|
43861
43914
|
const plan = await loadPlanJsonOnly(directory);
|
|
43862
43915
|
const phaseData = plan?.phases.find((p) => p.id === phase);
|
|
43863
43916
|
const tasksCompleted = phaseData ? phaseData.tasks.filter((t) => t.status === "completed").length : 0;
|
|
@@ -43881,7 +43934,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config3, _kno
|
|
|
43881
43934
|
timestamp: new Date().toISOString(),
|
|
43882
43935
|
summary: `Phase ${phase} completed. ${tasksCompleted}/${tasksTotal} tasks completed. ${complianceObservations.length} compliance observations.`,
|
|
43883
43936
|
agents_used: [
|
|
43884
|
-
...new Set(agentsDispatched.map((a) =>
|
|
43937
|
+
...new Set(agentsDispatched.map((a) => _internals14.normalizeAgentName(a)))
|
|
43885
43938
|
],
|
|
43886
43939
|
tasks_completed: tasksCompleted,
|
|
43887
43940
|
tasks_total: tasksTotal,
|
|
@@ -43931,7 +43984,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config3, _kno
|
|
|
43931
43984
|
clearTimeout(timer);
|
|
43932
43985
|
}
|
|
43933
43986
|
if (llmOutput?.trim()) {
|
|
43934
|
-
knowledgeRecommendations =
|
|
43987
|
+
knowledgeRecommendations = _internals14.parseKnowledgeRecommendations(llmOutput);
|
|
43935
43988
|
const structured = parseStructuredCuratorBlocks(llmOutput);
|
|
43936
43989
|
knowledgeApplicationFindings = structured.findings;
|
|
43937
43990
|
skillCandidates = structured.candidates;
|
|
@@ -43982,7 +44035,7 @@ ${phaseDigest.summary}`,
|
|
|
43982
44035
|
knowledge_recommendations: knowledgeRecommendations
|
|
43983
44036
|
};
|
|
43984
44037
|
}
|
|
43985
|
-
await
|
|
44038
|
+
await _internals14.writeCuratorSummary(directory, updatedSummary);
|
|
43986
44039
|
const eventsPath = path18.join(directory, ".swarm", "events.jsonl");
|
|
43987
44040
|
for (const obs of complianceObservations) {
|
|
43988
44041
|
await appendKnowledge(eventsPath, {
|
|
@@ -44188,7 +44241,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
44188
44241
|
}
|
|
44189
44242
|
return { applied, skipped };
|
|
44190
44243
|
}
|
|
44191
|
-
var DEFAULT_CURATOR_LLM_TIMEOUT_MS = 300000,
|
|
44244
|
+
var DEFAULT_CURATOR_LLM_TIMEOUT_MS = 300000, _internals14;
|
|
44192
44245
|
var init_curator = __esm(() => {
|
|
44193
44246
|
init_event_bus();
|
|
44194
44247
|
init_schema();
|
|
@@ -44199,7 +44252,7 @@ var init_curator = __esm(() => {
|
|
|
44199
44252
|
init_knowledge_store();
|
|
44200
44253
|
init_knowledge_validator();
|
|
44201
44254
|
init_utils2();
|
|
44202
|
-
|
|
44255
|
+
_internals14 = {
|
|
44203
44256
|
parseKnowledgeRecommendations,
|
|
44204
44257
|
readCuratorSummary,
|
|
44205
44258
|
writeCuratorSummary,
|
|
@@ -45014,7 +45067,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
|
|
|
45014
45067
|
existingEntries.push(entry);
|
|
45015
45068
|
}
|
|
45016
45069
|
await enforceKnowledgeCap(knowledgePath, config3.swarm_max_entries);
|
|
45017
|
-
await
|
|
45070
|
+
await _internals15.runAutoPromotion(directory, config3);
|
|
45018
45071
|
return { stored, skipped, rejected };
|
|
45019
45072
|
}
|
|
45020
45073
|
async function runAutoPromotion(directory, config3) {
|
|
@@ -45095,7 +45148,7 @@ function createKnowledgeCuratorHook(directory, config3) {
|
|
|
45095
45148
|
});
|
|
45096
45149
|
const projectName2 = evidenceData.project_name ?? "unknown";
|
|
45097
45150
|
const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
|
|
45098
|
-
await
|
|
45151
|
+
await _internals15.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
|
|
45099
45152
|
await updateRetrievalOutcome(directory, `Phase ${phaseNumber2}`, true);
|
|
45100
45153
|
return;
|
|
45101
45154
|
}
|
|
@@ -45118,19 +45171,19 @@ function createKnowledgeCuratorHook(directory, config3) {
|
|
|
45118
45171
|
const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
|
|
45119
45172
|
const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
|
|
45120
45173
|
const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
|
|
45121
|
-
await
|
|
45174
|
+
await _internals15.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
|
|
45122
45175
|
await updateRetrievalOutcome(directory, `Phase ${phaseNumber}`, true);
|
|
45123
45176
|
};
|
|
45124
45177
|
return safeHook(handler);
|
|
45125
45178
|
}
|
|
45126
|
-
var seenRetroSections,
|
|
45179
|
+
var seenRetroSections, _internals15;
|
|
45127
45180
|
var init_knowledge_curator = __esm(() => {
|
|
45128
45181
|
init_knowledge_reader();
|
|
45129
45182
|
init_knowledge_store();
|
|
45130
45183
|
init_knowledge_validator();
|
|
45131
45184
|
init_utils2();
|
|
45132
45185
|
seenRetroSections = new Map;
|
|
45133
|
-
|
|
45186
|
+
_internals15 = {
|
|
45134
45187
|
isWriteToEvidenceFile,
|
|
45135
45188
|
curateAndStoreSwarm,
|
|
45136
45189
|
runAutoPromotion,
|
|
@@ -46006,7 +46059,7 @@ async function executeWriteRetro(args2, directory) {
|
|
|
46006
46059
|
}, null, 2);
|
|
46007
46060
|
}
|
|
46008
46061
|
}
|
|
46009
|
-
var write_retro,
|
|
46062
|
+
var write_retro, _internals16;
|
|
46010
46063
|
var init_write_retro = __esm(() => {
|
|
46011
46064
|
init_zod();
|
|
46012
46065
|
init_evidence_schema();
|
|
@@ -46053,13 +46106,13 @@ var init_write_retro = __esm(() => {
|
|
|
46053
46106
|
task_id: args2.task_id !== undefined ? String(args2.task_id) : undefined,
|
|
46054
46107
|
metadata: args2.metadata
|
|
46055
46108
|
};
|
|
46056
|
-
return await
|
|
46109
|
+
return await _internals16.executeWriteRetro(writeRetroArgs, directory);
|
|
46057
46110
|
} catch {
|
|
46058
46111
|
return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
|
|
46059
46112
|
}
|
|
46060
46113
|
}
|
|
46061
46114
|
});
|
|
46062
|
-
|
|
46115
|
+
_internals16 = {
|
|
46063
46116
|
executeWriteRetro,
|
|
46064
46117
|
write_retro
|
|
46065
46118
|
};
|
|
@@ -46838,7 +46891,7 @@ __export(exports_co_change_analyzer, {
|
|
|
46838
46891
|
darkMatterToKnowledgeEntries: () => darkMatterToKnowledgeEntries,
|
|
46839
46892
|
co_change_analyzer: () => co_change_analyzer,
|
|
46840
46893
|
buildCoChangeMatrix: () => buildCoChangeMatrix,
|
|
46841
|
-
_internals: () =>
|
|
46894
|
+
_internals: () => _internals17
|
|
46842
46895
|
});
|
|
46843
46896
|
import * as child_process3 from "node:child_process";
|
|
46844
46897
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -47061,9 +47114,9 @@ async function detectDarkMatter(directory, options) {
|
|
|
47061
47114
|
} catch {
|
|
47062
47115
|
return [];
|
|
47063
47116
|
}
|
|
47064
|
-
const commitMap = await
|
|
47065
|
-
const matrix =
|
|
47066
|
-
const staticEdges = await
|
|
47117
|
+
const commitMap = await _internals17.parseGitLog(directory, maxCommitsToAnalyze);
|
|
47118
|
+
const matrix = _internals17.buildCoChangeMatrix(commitMap);
|
|
47119
|
+
const staticEdges = await _internals17.getStaticEdges(directory);
|
|
47067
47120
|
const results = [];
|
|
47068
47121
|
for (const entry of matrix.values()) {
|
|
47069
47122
|
const key = `${entry.fileA}::${entry.fileB}`;
|
|
@@ -47143,7 +47196,7 @@ ${rows}
|
|
|
47143
47196
|
These pairs likely share an architectural concern invisible to static analysis.
|
|
47144
47197
|
Consider adding explicit documentation or extracting the shared concern.`;
|
|
47145
47198
|
}
|
|
47146
|
-
var co_change_analyzer,
|
|
47199
|
+
var co_change_analyzer, _internals17;
|
|
47147
47200
|
var init_co_change_analyzer = __esm(() => {
|
|
47148
47201
|
init_zod();
|
|
47149
47202
|
init_create_tool();
|
|
@@ -47175,11 +47228,11 @@ var init_co_change_analyzer = __esm(() => {
|
|
|
47175
47228
|
npmiThreshold,
|
|
47176
47229
|
maxCommitsToAnalyze
|
|
47177
47230
|
};
|
|
47178
|
-
const pairs = await
|
|
47179
|
-
return
|
|
47231
|
+
const pairs = await _internals17.detectDarkMatter(directory, options);
|
|
47232
|
+
return _internals17.formatDarkMatterOutput(pairs);
|
|
47180
47233
|
}
|
|
47181
47234
|
});
|
|
47182
|
-
|
|
47235
|
+
_internals17 = {
|
|
47183
47236
|
parseGitLog,
|
|
47184
47237
|
buildCoChangeMatrix,
|
|
47185
47238
|
getStaticEdges,
|
|
@@ -47210,7 +47263,7 @@ async function handleDarkMatterCommand(directory, args2) {
|
|
|
47210
47263
|
}
|
|
47211
47264
|
let pairs;
|
|
47212
47265
|
try {
|
|
47213
|
-
pairs = await
|
|
47266
|
+
pairs = await _internals17.detectDarkMatter(directory, options);
|
|
47214
47267
|
} catch (err2) {
|
|
47215
47268
|
const errMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
47216
47269
|
return `## Dark Matter Analysis Failed
|
|
@@ -50055,7 +50108,7 @@ function isCommandAvailable(command) {
|
|
|
50055
50108
|
const isWindows = process.platform === "win32";
|
|
50056
50109
|
const cmd = isWindows ? `${command}.exe` : command;
|
|
50057
50110
|
try {
|
|
50058
|
-
const result =
|
|
50111
|
+
const result = _internals18.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
|
|
50059
50112
|
cwd: process.cwd(),
|
|
50060
50113
|
stdin: "ignore",
|
|
50061
50114
|
stdout: "ignore",
|
|
@@ -50205,7 +50258,7 @@ async function discoverBuildCommands(workingDir, options) {
|
|
|
50205
50258
|
const scope = options?.scope ?? "all";
|
|
50206
50259
|
const changedFiles = options?.changedFiles ?? [];
|
|
50207
50260
|
const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
|
|
50208
|
-
const profileResult = await
|
|
50261
|
+
const profileResult = await _internals18.discoverBuildCommandsFromProfiles(workingDir);
|
|
50209
50262
|
const profileCommands = profileResult.commands;
|
|
50210
50263
|
const profileSkipped = profileResult.skipped;
|
|
50211
50264
|
const coveredEcosystems = new Set;
|
|
@@ -50268,7 +50321,7 @@ function clearToolchainCache() {
|
|
|
50268
50321
|
function getEcosystems() {
|
|
50269
50322
|
return ECOSYSTEMS.map((e) => e.ecosystem);
|
|
50270
50323
|
}
|
|
50271
|
-
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000,
|
|
50324
|
+
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals18, build_discovery;
|
|
50272
50325
|
var init_discovery = __esm(() => {
|
|
50273
50326
|
init_dist();
|
|
50274
50327
|
init_detector();
|
|
@@ -50386,7 +50439,7 @@ var init_discovery = __esm(() => {
|
|
|
50386
50439
|
php: ["php-composer"]
|
|
50387
50440
|
};
|
|
50388
50441
|
toolchainCache = new Map;
|
|
50389
|
-
|
|
50442
|
+
_internals18 = {
|
|
50390
50443
|
isCommandAvailable,
|
|
50391
50444
|
discoverBuildCommandsFromProfiles,
|
|
50392
50445
|
discoverBuildCommands,
|
|
@@ -50656,7 +50709,7 @@ var exports_evidence_summary_service = {};
|
|
|
50656
50709
|
__export(exports_evidence_summary_service, {
|
|
50657
50710
|
isAutoSummaryEnabled: () => isAutoSummaryEnabled,
|
|
50658
50711
|
buildEvidenceSummary: () => buildEvidenceSummary,
|
|
50659
|
-
_internals: () =>
|
|
50712
|
+
_internals: () => _internals19,
|
|
50660
50713
|
REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
|
|
50661
50714
|
EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
|
|
50662
50715
|
});
|
|
@@ -50694,14 +50747,14 @@ function getTaskStatus(task, bundle) {
|
|
|
50694
50747
|
if (task?.status) {
|
|
50695
50748
|
return task.status;
|
|
50696
50749
|
}
|
|
50697
|
-
const entries =
|
|
50750
|
+
const entries = _internals19.normalizeBundleEntries(bundle);
|
|
50698
50751
|
if (entries.length > 0) {
|
|
50699
50752
|
return "completed";
|
|
50700
50753
|
}
|
|
50701
50754
|
return "pending";
|
|
50702
50755
|
}
|
|
50703
50756
|
function isEvidenceComplete(bundle) {
|
|
50704
|
-
const entries =
|
|
50757
|
+
const entries = _internals19.normalizeBundleEntries(bundle);
|
|
50705
50758
|
if (entries.length === 0) {
|
|
50706
50759
|
return {
|
|
50707
50760
|
isComplete: false,
|
|
@@ -50737,10 +50790,10 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
50737
50790
|
const result = await loadEvidence(directory, taskId);
|
|
50738
50791
|
const bundle = result.status === "found" ? result.bundle : null;
|
|
50739
50792
|
const phase = task?.phase ?? 0;
|
|
50740
|
-
const status =
|
|
50741
|
-
const evidenceCheck =
|
|
50742
|
-
const blockers =
|
|
50743
|
-
const entries =
|
|
50793
|
+
const status = _internals19.getTaskStatus(task, bundle);
|
|
50794
|
+
const evidenceCheck = _internals19.isEvidenceComplete(bundle);
|
|
50795
|
+
const blockers = _internals19.getTaskBlockers(task, evidenceCheck, status);
|
|
50796
|
+
const entries = _internals19.normalizeBundleEntries(bundle);
|
|
50744
50797
|
const hasReview = entries.some((e) => e.type === "review");
|
|
50745
50798
|
const hasTest = entries.some((e) => e.type === "test");
|
|
50746
50799
|
const hasApproval = entries.some((e) => e.type === "approval");
|
|
@@ -50769,12 +50822,12 @@ async function buildPhaseSummary(directory, phase) {
|
|
|
50769
50822
|
const taskSummaries = [];
|
|
50770
50823
|
const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
|
|
50771
50824
|
for (const task of phase.tasks) {
|
|
50772
|
-
const summary = await
|
|
50825
|
+
const summary = await _internals19.buildTaskSummary(directory, task, task.id);
|
|
50773
50826
|
taskSummaries.push(summary);
|
|
50774
50827
|
}
|
|
50775
50828
|
const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
|
|
50776
50829
|
for (const taskId of extraTaskIds) {
|
|
50777
|
-
const summary = await
|
|
50830
|
+
const summary = await _internals19.buildTaskSummary(directory, undefined, taskId);
|
|
50778
50831
|
if (summary.phase === phase.id) {
|
|
50779
50832
|
taskSummaries.push(summary);
|
|
50780
50833
|
}
|
|
@@ -50875,7 +50928,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
50875
50928
|
let totalTasks = 0;
|
|
50876
50929
|
let completedTasks = 0;
|
|
50877
50930
|
for (const phase of phasesToProcess) {
|
|
50878
|
-
const summary = await
|
|
50931
|
+
const summary = await _internals19.buildPhaseSummary(directory, phase);
|
|
50879
50932
|
phaseSummaries.push(summary);
|
|
50880
50933
|
totalTasks += summary.totalTasks;
|
|
50881
50934
|
completedTasks += summary.completedTasks;
|
|
@@ -50897,7 +50950,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
50897
50950
|
overallBlockers,
|
|
50898
50951
|
summaryText: ""
|
|
50899
50952
|
};
|
|
50900
|
-
artifact.summaryText =
|
|
50953
|
+
artifact.summaryText = _internals19.generateSummaryText(artifact);
|
|
50901
50954
|
log("[EvidenceSummary] Summary built", {
|
|
50902
50955
|
phases: phaseSummaries.length,
|
|
50903
50956
|
totalTasks,
|
|
@@ -50916,7 +50969,7 @@ function isAutoSummaryEnabled(automationConfig) {
|
|
|
50916
50969
|
}
|
|
50917
50970
|
return automationConfig.capabilities?.evidence_auto_summaries === true;
|
|
50918
50971
|
}
|
|
50919
|
-
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0",
|
|
50972
|
+
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals19;
|
|
50920
50973
|
var init_evidence_summary_service = __esm(() => {
|
|
50921
50974
|
init_manager2();
|
|
50922
50975
|
init_manager();
|
|
@@ -50930,7 +50983,7 @@ var init_evidence_summary_service = __esm(() => {
|
|
|
50930
50983
|
"retrospective"
|
|
50931
50984
|
]);
|
|
50932
50985
|
REQUIRED_EVIDENCE_TYPES = ["review", "test"];
|
|
50933
|
-
|
|
50986
|
+
_internals19 = {
|
|
50934
50987
|
buildEvidenceSummary,
|
|
50935
50988
|
isAutoSummaryEnabled,
|
|
50936
50989
|
normalizeBundleEntries,
|
|
@@ -50985,7 +51038,7 @@ function getVerdictEmoji(verdict) {
|
|
|
50985
51038
|
return getVerdictIcon(verdict);
|
|
50986
51039
|
}
|
|
50987
51040
|
async function getTaskEvidenceData(directory, taskId) {
|
|
50988
|
-
const result = await
|
|
51041
|
+
const result = await _internals20.loadEvidence(directory, taskId);
|
|
50989
51042
|
if (result.status !== "found") {
|
|
50990
51043
|
return {
|
|
50991
51044
|
hasEvidence: false,
|
|
@@ -51008,13 +51061,13 @@ async function getTaskEvidenceData(directory, taskId) {
|
|
|
51008
51061
|
};
|
|
51009
51062
|
}
|
|
51010
51063
|
async function getEvidenceListData(directory) {
|
|
51011
|
-
const taskIds = await
|
|
51064
|
+
const taskIds = await _internals20.listEvidenceTaskIds(directory);
|
|
51012
51065
|
if (taskIds.length === 0) {
|
|
51013
51066
|
return { hasEvidence: false, tasks: [] };
|
|
51014
51067
|
}
|
|
51015
51068
|
const tasks = [];
|
|
51016
51069
|
for (const taskId of taskIds) {
|
|
51017
|
-
const result = await
|
|
51070
|
+
const result = await _internals20.loadEvidence(directory, taskId);
|
|
51018
51071
|
if (result.status === "found") {
|
|
51019
51072
|
tasks.push({
|
|
51020
51073
|
taskId,
|
|
@@ -51128,10 +51181,10 @@ async function handleEvidenceSummaryCommand(directory) {
|
|
|
51128
51181
|
return lines.join(`
|
|
51129
51182
|
`);
|
|
51130
51183
|
}
|
|
51131
|
-
var
|
|
51184
|
+
var _internals20;
|
|
51132
51185
|
var init_evidence_service = __esm(() => {
|
|
51133
51186
|
init_manager2();
|
|
51134
|
-
|
|
51187
|
+
_internals20 = {
|
|
51135
51188
|
loadEvidence,
|
|
51136
51189
|
listEvidenceTaskIds
|
|
51137
51190
|
};
|
|
@@ -51652,7 +51705,7 @@ function extractCurrentPhaseFromPlan2(plan) {
|
|
|
51652
51705
|
if (!plan) {
|
|
51653
51706
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
51654
51707
|
}
|
|
51655
|
-
if (!
|
|
51708
|
+
if (!_internals21.validatePlanPhases(plan)) {
|
|
51656
51709
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
51657
51710
|
}
|
|
51658
51711
|
let currentPhase = null;
|
|
@@ -51794,9 +51847,9 @@ function extractPhaseMetrics(content) {
|
|
|
51794
51847
|
async function getHandoffData(directory) {
|
|
51795
51848
|
const now = new Date().toISOString();
|
|
51796
51849
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
51797
|
-
const sessionState =
|
|
51850
|
+
const sessionState = _internals21.parseSessionState(sessionContent);
|
|
51798
51851
|
const plan = await loadPlanJsonOnly(directory);
|
|
51799
|
-
const planInfo =
|
|
51852
|
+
const planInfo = _internals21.extractCurrentPhaseFromPlan(plan);
|
|
51800
51853
|
if (!plan) {
|
|
51801
51854
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
51802
51855
|
if (planMdContent) {
|
|
@@ -51815,8 +51868,8 @@ async function getHandoffData(directory) {
|
|
|
51815
51868
|
}
|
|
51816
51869
|
}
|
|
51817
51870
|
const contextContent = await readSwarmFileAsync(directory, "context.md");
|
|
51818
|
-
const recentDecisions =
|
|
51819
|
-
const rawPhaseMetrics =
|
|
51871
|
+
const recentDecisions = _internals21.extractDecisions(contextContent);
|
|
51872
|
+
const rawPhaseMetrics = _internals21.extractPhaseMetrics(contextContent);
|
|
51820
51873
|
const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
|
|
51821
51874
|
let delegationState = null;
|
|
51822
51875
|
if (sessionState?.delegationState) {
|
|
@@ -51980,13 +52033,13 @@ ${lines.join(`
|
|
|
51980
52033
|
`)}
|
|
51981
52034
|
\`\`\``;
|
|
51982
52035
|
}
|
|
51983
|
-
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20,
|
|
52036
|
+
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals21;
|
|
51984
52037
|
var init_handoff_service = __esm(() => {
|
|
51985
52038
|
init_utils2();
|
|
51986
52039
|
init_manager();
|
|
51987
52040
|
init_utils();
|
|
51988
52041
|
RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
51989
|
-
|
|
52042
|
+
_internals21 = {
|
|
51990
52043
|
getHandoffData,
|
|
51991
52044
|
formatHandoffMarkdown,
|
|
51992
52045
|
formatContinuationPrompt,
|
|
@@ -52105,22 +52158,22 @@ async function writeSnapshot(directory, state) {
|
|
|
52105
52158
|
}
|
|
52106
52159
|
function createSnapshotWriterHook(directory) {
|
|
52107
52160
|
return (_input, _output) => {
|
|
52108
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
52161
|
+
_writeInFlight = _writeInFlight.then(() => _internals22.writeSnapshot(directory, swarmState), () => _internals22.writeSnapshot(directory, swarmState));
|
|
52109
52162
|
return _writeInFlight;
|
|
52110
52163
|
};
|
|
52111
52164
|
}
|
|
52112
52165
|
async function flushPendingSnapshot(directory) {
|
|
52113
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
52166
|
+
_writeInFlight = _writeInFlight.then(() => _internals22.writeSnapshot(directory, swarmState), () => _internals22.writeSnapshot(directory, swarmState));
|
|
52114
52167
|
await _writeInFlight;
|
|
52115
52168
|
}
|
|
52116
|
-
var _writeInFlight,
|
|
52169
|
+
var _writeInFlight, _internals22;
|
|
52117
52170
|
var init_snapshot_writer = __esm(() => {
|
|
52118
52171
|
init_utils2();
|
|
52119
52172
|
init_state();
|
|
52120
52173
|
init_utils();
|
|
52121
52174
|
init_bun_compat();
|
|
52122
52175
|
_writeInFlight = Promise.resolve();
|
|
52123
|
-
|
|
52176
|
+
_internals22 = {
|
|
52124
52177
|
writeSnapshot,
|
|
52125
52178
|
createSnapshotWriterHook,
|
|
52126
52179
|
flushPendingSnapshot
|
|
@@ -52585,9 +52638,9 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
52585
52638
|
skippedReason: "empty-context"
|
|
52586
52639
|
};
|
|
52587
52640
|
}
|
|
52588
|
-
const rawEntries =
|
|
52641
|
+
const rawEntries = _internals23.parseContextMd(contextContent);
|
|
52589
52642
|
if (rawEntries.length === 0) {
|
|
52590
|
-
await
|
|
52643
|
+
await _internals23.writeSentinel(sentinelPath, 0, 0);
|
|
52591
52644
|
return {
|
|
52592
52645
|
migrated: true,
|
|
52593
52646
|
entriesMigrated: 0,
|
|
@@ -52598,10 +52651,10 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
52598
52651
|
const existing = await readKnowledge(knowledgePath);
|
|
52599
52652
|
let migrated = 0;
|
|
52600
52653
|
let dropped = 0;
|
|
52601
|
-
const projectName =
|
|
52654
|
+
const projectName = _internals23.inferProjectName(directory);
|
|
52602
52655
|
for (const raw of rawEntries) {
|
|
52603
52656
|
if (config3.validation_enabled !== false) {
|
|
52604
|
-
const category = raw.categoryHint ??
|
|
52657
|
+
const category = raw.categoryHint ?? _internals23.inferCategoryFromText(raw.text);
|
|
52605
52658
|
const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
|
|
52606
52659
|
category,
|
|
52607
52660
|
scope: "global",
|
|
@@ -52621,8 +52674,8 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
52621
52674
|
const entry = {
|
|
52622
52675
|
id: randomUUID3(),
|
|
52623
52676
|
tier: "swarm",
|
|
52624
|
-
lesson:
|
|
52625
|
-
category: raw.categoryHint ??
|
|
52677
|
+
lesson: _internals23.truncateLesson(raw.text),
|
|
52678
|
+
category: raw.categoryHint ?? _internals23.inferCategoryFromText(raw.text),
|
|
52626
52679
|
tags: [...inferredTags, `migration:${raw.sourceSection}`],
|
|
52627
52680
|
scope: "global",
|
|
52628
52681
|
confidence: 0.3,
|
|
@@ -52645,7 +52698,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
52645
52698
|
if (migrated > 0) {
|
|
52646
52699
|
await rewriteKnowledge(knowledgePath, existing);
|
|
52647
52700
|
}
|
|
52648
|
-
await
|
|
52701
|
+
await _internals23.writeSentinel(sentinelPath, migrated, dropped);
|
|
52649
52702
|
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
52650
52703
|
return {
|
|
52651
52704
|
migrated: true,
|
|
@@ -52655,7 +52708,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
52655
52708
|
};
|
|
52656
52709
|
}
|
|
52657
52710
|
function parseContextMd(content) {
|
|
52658
|
-
const sections =
|
|
52711
|
+
const sections = _internals23.splitIntoSections(content);
|
|
52659
52712
|
const entries = [];
|
|
52660
52713
|
const seen = new Set;
|
|
52661
52714
|
const sectionPatterns = [
|
|
@@ -52671,7 +52724,7 @@ function parseContextMd(content) {
|
|
|
52671
52724
|
const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
|
|
52672
52725
|
if (!match)
|
|
52673
52726
|
continue;
|
|
52674
|
-
const bullets =
|
|
52727
|
+
const bullets = _internals23.extractBullets(section.body);
|
|
52675
52728
|
for (const bullet of bullets) {
|
|
52676
52729
|
if (bullet.length < 15)
|
|
52677
52730
|
continue;
|
|
@@ -52680,9 +52733,9 @@ function parseContextMd(content) {
|
|
|
52680
52733
|
continue;
|
|
52681
52734
|
seen.add(normalized);
|
|
52682
52735
|
entries.push({
|
|
52683
|
-
text:
|
|
52736
|
+
text: _internals23.truncateLesson(bullet),
|
|
52684
52737
|
sourceSection: match.sourceSection,
|
|
52685
|
-
categoryHint:
|
|
52738
|
+
categoryHint: _internals23.inferCategoryFromText(bullet)
|
|
52686
52739
|
});
|
|
52687
52740
|
}
|
|
52688
52741
|
}
|
|
@@ -52775,12 +52828,12 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
52775
52828
|
await mkdir9(path34.dirname(sentinelPath), { recursive: true });
|
|
52776
52829
|
await writeFile9(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
52777
52830
|
}
|
|
52778
|
-
var
|
|
52831
|
+
var _internals23;
|
|
52779
52832
|
var init_knowledge_migrator = __esm(() => {
|
|
52780
52833
|
init_logger();
|
|
52781
52834
|
init_knowledge_store();
|
|
52782
52835
|
init_knowledge_validator();
|
|
52783
|
-
|
|
52836
|
+
_internals23 = {
|
|
52784
52837
|
migrateContextToKnowledge,
|
|
52785
52838
|
migrateKnowledgeToExternal,
|
|
52786
52839
|
parseContextMd,
|
|
@@ -52917,9 +52970,9 @@ var init_knowledge = __esm(() => {
|
|
|
52917
52970
|
|
|
52918
52971
|
// src/services/plan-service.ts
|
|
52919
52972
|
async function getPlanData(directory, phaseArg) {
|
|
52920
|
-
const plan = await
|
|
52973
|
+
const plan = await _internals24.loadPlanJsonOnly(directory);
|
|
52921
52974
|
if (plan) {
|
|
52922
|
-
const fullMarkdown =
|
|
52975
|
+
const fullMarkdown = _internals24.derivePlanMarkdown(plan);
|
|
52923
52976
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
52924
52977
|
return {
|
|
52925
52978
|
hasPlan: true,
|
|
@@ -52962,7 +53015,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
52962
53015
|
isLegacy: false
|
|
52963
53016
|
};
|
|
52964
53017
|
}
|
|
52965
|
-
const planContent = await
|
|
53018
|
+
const planContent = await _internals24.readSwarmFileAsync(directory, "plan.md");
|
|
52966
53019
|
if (!planContent) {
|
|
52967
53020
|
return {
|
|
52968
53021
|
hasPlan: false,
|
|
@@ -53058,11 +53111,11 @@ async function handlePlanCommand(directory, args2) {
|
|
|
53058
53111
|
const planData = await getPlanData(directory, phaseArg);
|
|
53059
53112
|
return formatPlanMarkdown(planData);
|
|
53060
53113
|
}
|
|
53061
|
-
var
|
|
53114
|
+
var _internals24;
|
|
53062
53115
|
var init_plan_service = __esm(() => {
|
|
53063
53116
|
init_utils2();
|
|
53064
53117
|
init_manager();
|
|
53065
|
-
|
|
53118
|
+
_internals24 = {
|
|
53066
53119
|
loadPlanJsonOnly,
|
|
53067
53120
|
derivePlanMarkdown,
|
|
53068
53121
|
readSwarmFileAsync
|
|
@@ -53704,7 +53757,7 @@ async function runAdditionalLint(linter, mode, cwd) {
|
|
|
53704
53757
|
};
|
|
53705
53758
|
}
|
|
53706
53759
|
}
|
|
53707
|
-
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint,
|
|
53760
|
+
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals25;
|
|
53708
53761
|
var init_lint = __esm(() => {
|
|
53709
53762
|
init_zod();
|
|
53710
53763
|
init_discovery();
|
|
@@ -53736,15 +53789,15 @@ var init_lint = __esm(() => {
|
|
|
53736
53789
|
}
|
|
53737
53790
|
const { mode } = args2;
|
|
53738
53791
|
const cwd = directory;
|
|
53739
|
-
const linter = await
|
|
53792
|
+
const linter = await _internals25.detectAvailableLinter(directory);
|
|
53740
53793
|
if (linter) {
|
|
53741
|
-
const result = await
|
|
53794
|
+
const result = await _internals25.runLint(linter, mode, directory);
|
|
53742
53795
|
return JSON.stringify(result, null, 2);
|
|
53743
53796
|
}
|
|
53744
|
-
const additionalLinter =
|
|
53797
|
+
const additionalLinter = _internals25.detectAdditionalLinter(cwd);
|
|
53745
53798
|
if (additionalLinter) {
|
|
53746
53799
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
53747
|
-
const result = await
|
|
53800
|
+
const result = await _internals25.runAdditionalLint(additionalLinter, mode, cwd);
|
|
53748
53801
|
return JSON.stringify(result, null, 2);
|
|
53749
53802
|
}
|
|
53750
53803
|
const errorResult = {
|
|
@@ -53758,7 +53811,7 @@ For Rust: rustup component add clippy`
|
|
|
53758
53811
|
return JSON.stringify(errorResult, null, 2);
|
|
53759
53812
|
}
|
|
53760
53813
|
});
|
|
53761
|
-
|
|
53814
|
+
_internals25 = {
|
|
53762
53815
|
detectAvailableLinter,
|
|
53763
53816
|
runLint,
|
|
53764
53817
|
detectAdditionalLinter,
|
|
@@ -54072,7 +54125,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
54072
54125
|
}
|
|
54073
54126
|
async function runSecretscan(directory) {
|
|
54074
54127
|
try {
|
|
54075
|
-
const result = await
|
|
54128
|
+
const result = await _internals26.secretscan.execute({ directory }, {});
|
|
54076
54129
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
54077
54130
|
return JSON.parse(jsonStr);
|
|
54078
54131
|
} catch (e) {
|
|
@@ -54087,7 +54140,7 @@ async function runSecretscan(directory) {
|
|
|
54087
54140
|
return errorResult;
|
|
54088
54141
|
}
|
|
54089
54142
|
}
|
|
54090
|
-
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS, O_NOFOLLOW, secretscan,
|
|
54143
|
+
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS, O_NOFOLLOW, secretscan, _internals26;
|
|
54091
54144
|
var init_secretscan = __esm(() => {
|
|
54092
54145
|
init_zod();
|
|
54093
54146
|
init_path_security();
|
|
@@ -54459,7 +54512,7 @@ var init_secretscan = __esm(() => {
|
|
|
54459
54512
|
}
|
|
54460
54513
|
}
|
|
54461
54514
|
});
|
|
54462
|
-
|
|
54515
|
+
_internals26 = {
|
|
54463
54516
|
secretscan,
|
|
54464
54517
|
runSecretscan
|
|
54465
54518
|
};
|
|
@@ -55031,14 +55084,14 @@ function buildGoBackend() {
|
|
|
55031
55084
|
selectEntryPoints
|
|
55032
55085
|
};
|
|
55033
55086
|
}
|
|
55034
|
-
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE,
|
|
55087
|
+
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals27;
|
|
55035
55088
|
var init_go = __esm(() => {
|
|
55036
55089
|
init_default_backend();
|
|
55037
55090
|
init_profiles();
|
|
55038
55091
|
IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
|
|
55039
55092
|
IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
|
|
55040
55093
|
IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
|
|
55041
|
-
|
|
55094
|
+
_internals27 = { extractImports };
|
|
55042
55095
|
});
|
|
55043
55096
|
|
|
55044
55097
|
// src/lang/backends/python.ts
|
|
@@ -55150,13 +55203,13 @@ function buildPythonBackend() {
|
|
|
55150
55203
|
selectEntryPoints: selectEntryPoints2
|
|
55151
55204
|
};
|
|
55152
55205
|
}
|
|
55153
|
-
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT,
|
|
55206
|
+
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals28;
|
|
55154
55207
|
var init_python = __esm(() => {
|
|
55155
55208
|
init_default_backend();
|
|
55156
55209
|
init_profiles();
|
|
55157
55210
|
IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
|
|
55158
55211
|
IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
|
|
55159
|
-
|
|
55212
|
+
_internals28 = { extractImports: extractImports2 };
|
|
55160
55213
|
});
|
|
55161
55214
|
|
|
55162
55215
|
// src/test-impact/analyzer.ts
|
|
@@ -55367,7 +55420,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
55367
55420
|
return;
|
|
55368
55421
|
}
|
|
55369
55422
|
if (PYTHON_EXTENSIONS.has(ext)) {
|
|
55370
|
-
const modules =
|
|
55423
|
+
const modules = _internals28.extractImports(testFile, content);
|
|
55371
55424
|
for (const mod of modules) {
|
|
55372
55425
|
const resolved = resolvePythonImport(testDir, mod);
|
|
55373
55426
|
if (resolved !== null)
|
|
@@ -55376,7 +55429,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
55376
55429
|
return;
|
|
55377
55430
|
}
|
|
55378
55431
|
if (GO_EXTENSIONS.has(ext)) {
|
|
55379
|
-
const imports =
|
|
55432
|
+
const imports = _internals27.extractImports(testFile, content);
|
|
55380
55433
|
for (const importPath of imports) {
|
|
55381
55434
|
const sourceFiles = resolveGoImport(testDir, importPath);
|
|
55382
55435
|
for (const source of sourceFiles)
|
|
@@ -55403,8 +55456,8 @@ async function buildImpactMapInternal(cwd) {
|
|
|
55403
55456
|
return impactMap;
|
|
55404
55457
|
}
|
|
55405
55458
|
async function buildImpactMap(cwd) {
|
|
55406
|
-
const impactMap = await
|
|
55407
|
-
await
|
|
55459
|
+
const impactMap = await _internals29.buildImpactMapInternal(cwd);
|
|
55460
|
+
await _internals29.saveImpactMap(cwd, impactMap);
|
|
55408
55461
|
return impactMap;
|
|
55409
55462
|
}
|
|
55410
55463
|
async function loadImpactMap(cwd, options) {
|
|
@@ -55418,7 +55471,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
55418
55471
|
const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
55419
55472
|
if (hasValidValues) {
|
|
55420
55473
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
55421
|
-
if (!
|
|
55474
|
+
if (!_internals29.isCacheStale(map3, generatedAt)) {
|
|
55422
55475
|
return map3;
|
|
55423
55476
|
}
|
|
55424
55477
|
if (options?.skipRebuild) {
|
|
@@ -55438,7 +55491,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
55438
55491
|
if (options?.skipRebuild) {
|
|
55439
55492
|
return {};
|
|
55440
55493
|
}
|
|
55441
|
-
return
|
|
55494
|
+
return _internals29.buildImpactMap(cwd);
|
|
55442
55495
|
}
|
|
55443
55496
|
async function saveImpactMap(cwd, impactMap) {
|
|
55444
55497
|
const cacheDir2 = path41.join(cwd, ".swarm", "cache");
|
|
@@ -55464,7 +55517,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
55464
55517
|
};
|
|
55465
55518
|
}
|
|
55466
55519
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
55467
|
-
const impactMap = await
|
|
55520
|
+
const impactMap = await _internals29.loadImpactMap(cwd);
|
|
55468
55521
|
const impactedTestsSet = new Set;
|
|
55469
55522
|
const untestedFiles = [];
|
|
55470
55523
|
let visitedCount = 0;
|
|
@@ -55531,7 +55584,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
55531
55584
|
budgetExceeded
|
|
55532
55585
|
};
|
|
55533
55586
|
}
|
|
55534
|
-
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache,
|
|
55587
|
+
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals29;
|
|
55535
55588
|
var init_analyzer = __esm(() => {
|
|
55536
55589
|
init_go();
|
|
55537
55590
|
init_python();
|
|
@@ -55543,7 +55596,7 @@ var init_analyzer = __esm(() => {
|
|
|
55543
55596
|
GO_EXTENSIONS = new Set([".go"]);
|
|
55544
55597
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
55545
55598
|
goModuleCache = new Map;
|
|
55546
|
-
|
|
55599
|
+
_internals29 = {
|
|
55547
55600
|
normalizePath,
|
|
55548
55601
|
isCacheStale,
|
|
55549
55602
|
resolveRelativeImport,
|
|
@@ -56023,7 +56076,7 @@ function readPackageJsonRaw(dir) {
|
|
|
56023
56076
|
}
|
|
56024
56077
|
}
|
|
56025
56078
|
function readPackageJson(dir) {
|
|
56026
|
-
return
|
|
56079
|
+
return _internals30.readPackageJsonRaw(dir);
|
|
56027
56080
|
}
|
|
56028
56081
|
function readPackageJsonTestScript(dir) {
|
|
56029
56082
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -56193,7 +56246,7 @@ function buildTypescriptBackend() {
|
|
|
56193
56246
|
selectEntryPoints: selectEntryPoints3
|
|
56194
56247
|
};
|
|
56195
56248
|
}
|
|
56196
|
-
var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2,
|
|
56249
|
+
var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals30;
|
|
56197
56250
|
var init_typescript = __esm(() => {
|
|
56198
56251
|
init_default_backend();
|
|
56199
56252
|
init_profiles();
|
|
@@ -56202,7 +56255,7 @@ var init_typescript = __esm(() => {
|
|
|
56202
56255
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
56203
56256
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
56204
56257
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
56205
|
-
|
|
56258
|
+
_internals30 = {
|
|
56206
56259
|
readPackageJsonRaw,
|
|
56207
56260
|
readPackageJsonTestScript,
|
|
56208
56261
|
frameworkFromScriptsTest
|
|
@@ -56233,7 +56286,7 @@ __export(exports_dispatch, {
|
|
|
56233
56286
|
pickedProfiles: () => pickedProfiles,
|
|
56234
56287
|
pickBackend: () => pickBackend,
|
|
56235
56288
|
clearDispatchCache: () => clearDispatchCache,
|
|
56236
|
-
_internals: () =>
|
|
56289
|
+
_internals: () => _internals31
|
|
56237
56290
|
});
|
|
56238
56291
|
import * as fs28 from "node:fs";
|
|
56239
56292
|
import * as path45 from "node:path";
|
|
@@ -56288,7 +56341,7 @@ function findManifestRoot(start2) {
|
|
|
56288
56341
|
return start2;
|
|
56289
56342
|
}
|
|
56290
56343
|
function evictIfNeeded() {
|
|
56291
|
-
if (cache.size <=
|
|
56344
|
+
if (cache.size <= _internals31.cacheCapacity)
|
|
56292
56345
|
return;
|
|
56293
56346
|
let oldestKey;
|
|
56294
56347
|
let oldestOrder = Infinity;
|
|
@@ -56319,7 +56372,7 @@ async function pickBackend(dir) {
|
|
|
56319
56372
|
evictIfNeeded();
|
|
56320
56373
|
return null;
|
|
56321
56374
|
}
|
|
56322
|
-
const profiles = await
|
|
56375
|
+
const profiles = await _internals31.detectProjectLanguages(root);
|
|
56323
56376
|
if (profiles.length === 0) {
|
|
56324
56377
|
cache.set(cacheKey, {
|
|
56325
56378
|
hash: hash3,
|
|
@@ -56351,12 +56404,12 @@ function clearDispatchCache() {
|
|
|
56351
56404
|
manifestRootCache.clear();
|
|
56352
56405
|
insertCounter = 0;
|
|
56353
56406
|
}
|
|
56354
|
-
var
|
|
56407
|
+
var _internals31, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
56355
56408
|
var init_dispatch = __esm(() => {
|
|
56356
56409
|
init_backends();
|
|
56357
56410
|
init_detector();
|
|
56358
56411
|
init_registry_backend();
|
|
56359
|
-
|
|
56412
|
+
_internals31 = {
|
|
56360
56413
|
detectProjectLanguages,
|
|
56361
56414
|
cacheCapacity: 64
|
|
56362
56415
|
};
|
|
@@ -57980,9 +58033,9 @@ function getVersionFileVersion(dir) {
|
|
|
57980
58033
|
async function runVersionCheck2(dir, _timeoutMs) {
|
|
57981
58034
|
const startTime = Date.now();
|
|
57982
58035
|
try {
|
|
57983
|
-
const packageVersion =
|
|
57984
|
-
const changelogVersion =
|
|
57985
|
-
const versionFileVersion =
|
|
58036
|
+
const packageVersion = _internals32.getPackageVersion(dir);
|
|
58037
|
+
const changelogVersion = _internals32.getChangelogVersion(dir);
|
|
58038
|
+
const versionFileVersion = _internals32.getVersionFileVersion(dir);
|
|
57986
58039
|
const versions3 = [];
|
|
57987
58040
|
if (packageVersion)
|
|
57988
58041
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -58332,7 +58385,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58332
58385
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
58333
58386
|
let validatedDir;
|
|
58334
58387
|
try {
|
|
58335
|
-
validatedDir =
|
|
58388
|
+
validatedDir = _internals32.validateDirectoryPath(dir);
|
|
58336
58389
|
} catch (error93) {
|
|
58337
58390
|
return {
|
|
58338
58391
|
id: reportId,
|
|
@@ -58352,7 +58405,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58352
58405
|
}
|
|
58353
58406
|
let validatedTimeout;
|
|
58354
58407
|
try {
|
|
58355
|
-
validatedTimeout =
|
|
58408
|
+
validatedTimeout = _internals32.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
58356
58409
|
} catch (error93) {
|
|
58357
58410
|
return {
|
|
58358
58411
|
id: reportId,
|
|
@@ -58393,12 +58446,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58393
58446
|
});
|
|
58394
58447
|
const checks5 = [];
|
|
58395
58448
|
log("[Preflight] Running lint check...");
|
|
58396
|
-
const lintResult = await
|
|
58449
|
+
const lintResult = await _internals32.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
58397
58450
|
checks5.push(lintResult);
|
|
58398
58451
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
58399
58452
|
if (!cfg.skipTests) {
|
|
58400
58453
|
log("[Preflight] Running tests check...");
|
|
58401
|
-
const testsResult = await
|
|
58454
|
+
const testsResult = await _internals32.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
58402
58455
|
checks5.push(testsResult);
|
|
58403
58456
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
58404
58457
|
} else {
|
|
@@ -58410,7 +58463,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58410
58463
|
}
|
|
58411
58464
|
if (!cfg.skipSecrets) {
|
|
58412
58465
|
log("[Preflight] Running secrets check...");
|
|
58413
|
-
const secretsResult = await
|
|
58466
|
+
const secretsResult = await _internals32.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
58414
58467
|
checks5.push(secretsResult);
|
|
58415
58468
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
58416
58469
|
} else {
|
|
@@ -58422,7 +58475,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58422
58475
|
}
|
|
58423
58476
|
if (!cfg.skipEvidence) {
|
|
58424
58477
|
log("[Preflight] Running evidence check...");
|
|
58425
|
-
const evidenceResult = await
|
|
58478
|
+
const evidenceResult = await _internals32.runEvidenceCheck(validatedDir);
|
|
58426
58479
|
checks5.push(evidenceResult);
|
|
58427
58480
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
58428
58481
|
} else {
|
|
@@ -58433,12 +58486,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58433
58486
|
});
|
|
58434
58487
|
}
|
|
58435
58488
|
log("[Preflight] Running requirement coverage check...");
|
|
58436
|
-
const reqCoverageResult = await
|
|
58489
|
+
const reqCoverageResult = await _internals32.runRequirementCoverageCheck(validatedDir, phase);
|
|
58437
58490
|
checks5.push(reqCoverageResult);
|
|
58438
58491
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
58439
58492
|
if (!cfg.skipVersion) {
|
|
58440
58493
|
log("[Preflight] Running version check...");
|
|
58441
|
-
const versionResult = await
|
|
58494
|
+
const versionResult = await _internals32.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
58442
58495
|
checks5.push(versionResult);
|
|
58443
58496
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
58444
58497
|
} else {
|
|
@@ -58501,10 +58554,10 @@ function formatPreflightMarkdown(report) {
|
|
|
58501
58554
|
async function handlePreflightCommand(directory, _args) {
|
|
58502
58555
|
const plan = await loadPlan(directory);
|
|
58503
58556
|
const phase = plan?.current_phase ?? 1;
|
|
58504
|
-
const report = await
|
|
58505
|
-
return
|
|
58557
|
+
const report = await _internals32.runPreflight(directory, phase);
|
|
58558
|
+
return _internals32.formatPreflightMarkdown(report);
|
|
58506
58559
|
}
|
|
58507
|
-
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG,
|
|
58560
|
+
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals32;
|
|
58508
58561
|
var init_preflight_service = __esm(() => {
|
|
58509
58562
|
init_manager2();
|
|
58510
58563
|
init_manager();
|
|
@@ -58521,7 +58574,7 @@ var init_preflight_service = __esm(() => {
|
|
|
58521
58574
|
testScope: "convention",
|
|
58522
58575
|
linter: "biome"
|
|
58523
58576
|
};
|
|
58524
|
-
|
|
58577
|
+
_internals32 = {
|
|
58525
58578
|
runPreflight,
|
|
58526
58579
|
formatPreflightMarkdown,
|
|
58527
58580
|
handlePreflightCommand,
|
|
@@ -59836,7 +59889,7 @@ async function handleSimulateCommand(directory, args2) {
|
|
|
59836
59889
|
}
|
|
59837
59890
|
let darkMatterPairs;
|
|
59838
59891
|
try {
|
|
59839
|
-
darkMatterPairs = await
|
|
59892
|
+
darkMatterPairs = await _internals17.detectDarkMatter(directory, options);
|
|
59840
59893
|
} catch (err2) {
|
|
59841
59894
|
const errMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
59842
59895
|
return `## Simulate Report
|
|
@@ -60416,7 +60469,7 @@ async function getStatusData(directory, agents) {
|
|
|
60416
60469
|
}
|
|
60417
60470
|
function enrichWithLeanTurbo(status, directory) {
|
|
60418
60471
|
const turboMode = hasActiveTurboMode();
|
|
60419
|
-
const leanActive =
|
|
60472
|
+
const leanActive = _internals33.hasActiveLeanTurbo();
|
|
60420
60473
|
let turboStrategy = "off";
|
|
60421
60474
|
if (leanActive) {
|
|
60422
60475
|
turboStrategy = "lean";
|
|
@@ -60435,7 +60488,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
60435
60488
|
}
|
|
60436
60489
|
}
|
|
60437
60490
|
if (leanSessionID) {
|
|
60438
|
-
const runState =
|
|
60491
|
+
const runState = _internals33.loadLeanTurboRunState(directory, leanSessionID);
|
|
60439
60492
|
if (runState) {
|
|
60440
60493
|
status.leanTurboPhase = runState.phase;
|
|
60441
60494
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -60467,7 +60520,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
60467
60520
|
}
|
|
60468
60521
|
}
|
|
60469
60522
|
}
|
|
60470
|
-
status.fullAutoActive =
|
|
60523
|
+
status.fullAutoActive = _internals33.hasActiveFullAuto();
|
|
60471
60524
|
return status;
|
|
60472
60525
|
}
|
|
60473
60526
|
function formatStatusMarkdown(status) {
|
|
@@ -60549,7 +60602,7 @@ async function handleStatusCommand(directory, agents) {
|
|
|
60549
60602
|
}
|
|
60550
60603
|
return formatStatusMarkdown(statusData);
|
|
60551
60604
|
}
|
|
60552
|
-
var
|
|
60605
|
+
var _internals33;
|
|
60553
60606
|
var init_status_service = __esm(() => {
|
|
60554
60607
|
init_extractors();
|
|
60555
60608
|
init_utils2();
|
|
@@ -60558,7 +60611,7 @@ var init_status_service = __esm(() => {
|
|
|
60558
60611
|
init_state3();
|
|
60559
60612
|
init_compaction_service();
|
|
60560
60613
|
init_context_budget_service();
|
|
60561
|
-
|
|
60614
|
+
_internals33 = {
|
|
60562
60615
|
loadLeanTurboRunState,
|
|
60563
60616
|
hasActiveLeanTurbo,
|
|
60564
60617
|
hasActiveFullAuto
|
|
@@ -60649,7 +60702,7 @@ async function handleTurboCommand(directory, args2, sessionID) {
|
|
|
60649
60702
|
if (arg0 === "on") {
|
|
60650
60703
|
let strategy = "standard";
|
|
60651
60704
|
try {
|
|
60652
|
-
const { config: config3 } =
|
|
60705
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
60653
60706
|
if (config3.turbo?.strategy === "lean") {
|
|
60654
60707
|
strategy = "lean";
|
|
60655
60708
|
}
|
|
@@ -60704,7 +60757,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
60704
60757
|
let maxParallelCoders = 4;
|
|
60705
60758
|
let conflictPolicy = "serialize";
|
|
60706
60759
|
try {
|
|
60707
|
-
const { config: config3 } =
|
|
60760
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
60708
60761
|
const leanConfig = config3.turbo?.lean;
|
|
60709
60762
|
if (leanConfig) {
|
|
60710
60763
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -60774,13 +60827,13 @@ function buildStatusMessage(session, directory, sessionID) {
|
|
|
60774
60827
|
].join(`
|
|
60775
60828
|
`);
|
|
60776
60829
|
}
|
|
60777
|
-
var
|
|
60830
|
+
var _internals34;
|
|
60778
60831
|
var init_turbo = __esm(() => {
|
|
60779
60832
|
init_config();
|
|
60780
60833
|
init_state();
|
|
60781
60834
|
init_state3();
|
|
60782
60835
|
init_logger();
|
|
60783
|
-
|
|
60836
|
+
_internals34 = {
|
|
60784
60837
|
loadPluginConfigWithMeta
|
|
60785
60838
|
};
|
|
60786
60839
|
});
|
|
@@ -60873,7 +60926,7 @@ function formatCommandNotFound(tokens) {
|
|
|
60873
60926
|
const attemptedCommand = tokens[0] || "";
|
|
60874
60927
|
const MAX_DISPLAY = 100;
|
|
60875
60928
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
60876
|
-
const similar =
|
|
60929
|
+
const similar = _internals35.findSimilarCommands(attemptedCommand);
|
|
60877
60930
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
60878
60931
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
60879
60932
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -61308,7 +61361,7 @@ async function buildSwarmCommandPrompt(args2) {
|
|
|
61308
61361
|
activeAgentName,
|
|
61309
61362
|
registeredAgents
|
|
61310
61363
|
} = args2;
|
|
61311
|
-
const resolved =
|
|
61364
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
61312
61365
|
if (!resolved) {
|
|
61313
61366
|
if (tokens.length === 0) {
|
|
61314
61367
|
return buildHelpText();
|
|
@@ -61459,7 +61512,7 @@ function findSimilarCommands(query) {
|
|
|
61459
61512
|
}
|
|
61460
61513
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
61461
61514
|
const cmdLower = cmd.toLowerCase();
|
|
61462
|
-
const fullScore =
|
|
61515
|
+
const fullScore = _internals35.levenshteinDistance(q, cmdLower);
|
|
61463
61516
|
let tokenScore = Infinity;
|
|
61464
61517
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
61465
61518
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -61472,7 +61525,7 @@ function findSimilarCommands(query) {
|
|
|
61472
61525
|
for (const ct of cmdTokens) {
|
|
61473
61526
|
if (ct.length === 0)
|
|
61474
61527
|
continue;
|
|
61475
|
-
const dist =
|
|
61528
|
+
const dist = _internals35.levenshteinDistance(qt, ct);
|
|
61476
61529
|
if (dist < minDist)
|
|
61477
61530
|
minDist = dist;
|
|
61478
61531
|
}
|
|
@@ -61482,7 +61535,7 @@ function findSimilarCommands(query) {
|
|
|
61482
61535
|
}
|
|
61483
61536
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
61484
61537
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
61485
|
-
const dashScore =
|
|
61538
|
+
const dashScore = _internals35.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
61486
61539
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
61487
61540
|
return { cmd, score };
|
|
61488
61541
|
});
|
|
@@ -61514,11 +61567,11 @@ async function handleHelpCommand(ctx) {
|
|
|
61514
61567
|
return buildHelpText2();
|
|
61515
61568
|
}
|
|
61516
61569
|
const tokens = targetCommand.split(/\s+/);
|
|
61517
|
-
const resolved =
|
|
61570
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
61518
61571
|
if (resolved) {
|
|
61519
|
-
return
|
|
61572
|
+
return _internals35.buildDetailedHelp(resolved.key, resolved.entry);
|
|
61520
61573
|
}
|
|
61521
|
-
const similar =
|
|
61574
|
+
const similar = _internals35.findSimilarCommands(targetCommand);
|
|
61522
61575
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
61523
61576
|
if (similar.length > 0) {
|
|
61524
61577
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -61612,7 +61665,7 @@ function resolveCommand(tokens) {
|
|
|
61612
61665
|
}
|
|
61613
61666
|
return null;
|
|
61614
61667
|
}
|
|
61615
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
61668
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals35, validation;
|
|
61616
61669
|
var init_registry = __esm(() => {
|
|
61617
61670
|
init_acknowledge_spec_drift();
|
|
61618
61671
|
init_agents();
|
|
@@ -61682,7 +61735,7 @@ var init_registry = __esm(() => {
|
|
|
61682
61735
|
clashesWithNativeCcCommand: "/agents"
|
|
61683
61736
|
},
|
|
61684
61737
|
help: {
|
|
61685
|
-
handler: (ctx) =>
|
|
61738
|
+
handler: (ctx) => _internals35.handleHelpCommand(ctx),
|
|
61686
61739
|
description: "Show help for swarm commands",
|
|
61687
61740
|
category: "core",
|
|
61688
61741
|
args: "[command]",
|
|
@@ -62054,7 +62107,7 @@ Subcommands:
|
|
|
62054
62107
|
}
|
|
62055
62108
|
};
|
|
62056
62109
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
62057
|
-
|
|
62110
|
+
_internals35 = {
|
|
62058
62111
|
handleHelpCommand,
|
|
62059
62112
|
validateAliases,
|
|
62060
62113
|
resolveCommand,
|
|
@@ -62062,7 +62115,7 @@ Subcommands:
|
|
|
62062
62115
|
findSimilarCommands,
|
|
62063
62116
|
buildDetailedHelp
|
|
62064
62117
|
};
|
|
62065
|
-
validation =
|
|
62118
|
+
validation = _internals35.validateAliases();
|
|
62066
62119
|
if (!validation.valid) {
|
|
62067
62120
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
62068
62121
|
${validation.errors.join(`
|
|
@@ -70687,7 +70740,7 @@ __export(exports_runtime, {
|
|
|
70687
70740
|
getSupportedLanguages: () => getSupportedLanguages,
|
|
70688
70741
|
getInitializedLanguages: () => getInitializedLanguages,
|
|
70689
70742
|
clearParserCache: () => clearParserCache,
|
|
70690
|
-
_internals: () =>
|
|
70743
|
+
_internals: () => _internals36
|
|
70691
70744
|
});
|
|
70692
70745
|
import * as path77 from "node:path";
|
|
70693
70746
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -70697,10 +70750,10 @@ async function initTreeSitter() {
|
|
|
70697
70750
|
const thisDir = path77.dirname(fileURLToPath2(import.meta.url));
|
|
70698
70751
|
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
70699
70752
|
if (isSource) {
|
|
70700
|
-
await
|
|
70753
|
+
await _internals36.parserInit();
|
|
70701
70754
|
} else {
|
|
70702
70755
|
const grammarsDir = getGrammarsDirAbsolute();
|
|
70703
|
-
await
|
|
70756
|
+
await _internals36.parserInit({
|
|
70704
70757
|
locateFile(scriptName) {
|
|
70705
70758
|
return path77.join(grammarsDir, scriptName);
|
|
70706
70759
|
}
|
|
@@ -70802,12 +70855,12 @@ function getInitializedLanguages() {
|
|
|
70802
70855
|
function getSupportedLanguages() {
|
|
70803
70856
|
return Object.keys(LANGUAGE_WASM_MAP);
|
|
70804
70857
|
}
|
|
70805
|
-
var parserCache, initializedLanguages, treeSitterInitPromise = null,
|
|
70858
|
+
var parserCache, initializedLanguages, treeSitterInitPromise = null, _internals36, LANGUAGE_WASM_MAP;
|
|
70806
70859
|
var init_runtime = __esm(() => {
|
|
70807
70860
|
init_tree_sitter();
|
|
70808
70861
|
parserCache = new Map;
|
|
70809
70862
|
initializedLanguages = new Set;
|
|
70810
|
-
|
|
70863
|
+
_internals36 = {
|
|
70811
70864
|
parserInit: Parser.init
|
|
70812
70865
|
};
|
|
70813
70866
|
LANGUAGE_WASM_MAP = {
|
|
@@ -71264,9 +71317,9 @@ var init_doc_scan = __esm(() => {
|
|
|
71264
71317
|
var exports_knowledge_recall = {};
|
|
71265
71318
|
__export(exports_knowledge_recall, {
|
|
71266
71319
|
knowledge_recall: () => knowledge_recall,
|
|
71267
|
-
_internals: () =>
|
|
71320
|
+
_internals: () => _internals37
|
|
71268
71321
|
});
|
|
71269
|
-
var knowledge_recall,
|
|
71322
|
+
var knowledge_recall, _internals37;
|
|
71270
71323
|
var init_knowledge_recall = __esm(() => {
|
|
71271
71324
|
init_zod();
|
|
71272
71325
|
init_knowledge_store();
|
|
@@ -71352,7 +71405,7 @@ var init_knowledge_recall = __esm(() => {
|
|
|
71352
71405
|
return JSON.stringify(result);
|
|
71353
71406
|
}
|
|
71354
71407
|
});
|
|
71355
|
-
|
|
71408
|
+
_internals37 = {
|
|
71356
71409
|
knowledge_recall
|
|
71357
71410
|
};
|
|
71358
71411
|
});
|
|
@@ -71407,7 +71460,7 @@ __export(exports_curator_drift, {
|
|
|
71407
71460
|
runDeterministicDriftCheck: () => runDeterministicDriftCheck,
|
|
71408
71461
|
readPriorDriftReports: () => readPriorDriftReports,
|
|
71409
71462
|
buildDriftInjectionText: () => buildDriftInjectionText,
|
|
71410
|
-
_internals: () =>
|
|
71463
|
+
_internals: () => _internals39
|
|
71411
71464
|
});
|
|
71412
71465
|
import * as fs60 from "node:fs";
|
|
71413
71466
|
import * as path85 from "node:path";
|
|
@@ -71452,7 +71505,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
71452
71505
|
try {
|
|
71453
71506
|
const planMd = await readSwarmFileAsync(directory, "plan.md");
|
|
71454
71507
|
const specMd = await readSwarmFileAsync(directory, "spec.md");
|
|
71455
|
-
const priorReports = await
|
|
71508
|
+
const priorReports = await _internals39.readPriorDriftReports(directory);
|
|
71456
71509
|
const complianceCount = curatorResult.compliance.length;
|
|
71457
71510
|
const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
|
|
71458
71511
|
let alignment = "ALIGNED";
|
|
@@ -71501,7 +71554,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
71501
71554
|
scope_additions: [],
|
|
71502
71555
|
injection_summary: injectionSummary
|
|
71503
71556
|
};
|
|
71504
|
-
const reportPath = await
|
|
71557
|
+
const reportPath = await _internals39.writeDriftReport(directory, report);
|
|
71505
71558
|
getGlobalEventBus().publish("curator.drift.completed", {
|
|
71506
71559
|
phase,
|
|
71507
71560
|
alignment,
|
|
@@ -71564,12 +71617,12 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
71564
71617
|
}
|
|
71565
71618
|
return text.slice(0, maxChars);
|
|
71566
71619
|
}
|
|
71567
|
-
var DRIFT_REPORT_PREFIX = "drift-report-phase-",
|
|
71620
|
+
var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals39;
|
|
71568
71621
|
var init_curator_drift = __esm(() => {
|
|
71569
71622
|
init_event_bus();
|
|
71570
71623
|
init_logger();
|
|
71571
71624
|
init_utils2();
|
|
71572
|
-
|
|
71625
|
+
_internals39 = {
|
|
71573
71626
|
readPriorDriftReports,
|
|
71574
71627
|
writeDriftReport,
|
|
71575
71628
|
runDeterministicDriftCheck,
|
|
@@ -71581,7 +71634,7 @@ var init_curator_drift = __esm(() => {
|
|
|
71581
71634
|
var exports_project_context = {};
|
|
71582
71635
|
__export(exports_project_context, {
|
|
71583
71636
|
buildProjectContext: () => buildProjectContext,
|
|
71584
|
-
_internals: () =>
|
|
71637
|
+
_internals: () => _internals52,
|
|
71585
71638
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
71586
71639
|
});
|
|
71587
71640
|
import * as fs110 from "node:fs";
|
|
@@ -71665,7 +71718,7 @@ function selectLintCommand(backend, directory) {
|
|
|
71665
71718
|
return null;
|
|
71666
71719
|
}
|
|
71667
71720
|
async function buildProjectContext(directory) {
|
|
71668
|
-
const backend = await
|
|
71721
|
+
const backend = await _internals52.pickBackend(directory);
|
|
71669
71722
|
if (!backend)
|
|
71670
71723
|
return null;
|
|
71671
71724
|
const ctx = emptyProjectContext();
|
|
@@ -71696,16 +71749,16 @@ async function buildProjectContext(directory) {
|
|
|
71696
71749
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
71697
71750
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
71698
71751
|
}
|
|
71699
|
-
const profiles =
|
|
71752
|
+
const profiles = _internals52.pickedProfiles(directory);
|
|
71700
71753
|
if (profiles.length > 1) {
|
|
71701
71754
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
71702
71755
|
}
|
|
71703
71756
|
return ctx;
|
|
71704
71757
|
}
|
|
71705
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
71758
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals52;
|
|
71706
71759
|
var init_project_context = __esm(() => {
|
|
71707
71760
|
init_dispatch();
|
|
71708
|
-
|
|
71761
|
+
_internals52 = {
|
|
71709
71762
|
pickBackend,
|
|
71710
71763
|
pickedProfiles
|
|
71711
71764
|
};
|
|
@@ -72271,7 +72324,7 @@ async function writeFullAutoOversightEvidence(directory, phase, event) {
|
|
|
72271
72324
|
}
|
|
72272
72325
|
}
|
|
72273
72326
|
async function dispatchFullAutoOversight(input) {
|
|
72274
|
-
const client =
|
|
72327
|
+
const client = _internals11.swarmState.opencodeClient;
|
|
72275
72328
|
const sequence = nextFullAutoOversightSequence(input.directory);
|
|
72276
72329
|
oversightSequenceCounter = sequence;
|
|
72277
72330
|
const beforeStatus = loadFullAutoRunState(input.directory, input.sessionID)?.status;
|
|
@@ -73909,7 +73962,7 @@ Critic reasoning: ${criticResult.reasoning}`
|
|
|
73909
73962
|
}
|
|
73910
73963
|
}
|
|
73911
73964
|
async function dispatchCriticAndWriteEvent(directory, architectOutput, criticContext, criticModel, escalationType, interactionCount, deadlockCount, oversightAgentName, sessionID) {
|
|
73912
|
-
const client =
|
|
73965
|
+
const client = _internals11.swarmState.opencodeClient;
|
|
73913
73966
|
if (!client) {
|
|
73914
73967
|
warn("[full-auto-intercept] No opencodeClient — critic dispatch skipped (fallback to PENDING)");
|
|
73915
73968
|
const result = {
|
|
@@ -74042,11 +74095,11 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
74042
74095
|
if (!architectText)
|
|
74043
74096
|
return;
|
|
74044
74097
|
const sessionID = architectMessage.info?.sessionID;
|
|
74045
|
-
if (!
|
|
74098
|
+
if (!_internals11.hasActiveFullAuto(sessionID))
|
|
74046
74099
|
return;
|
|
74047
74100
|
let session = null;
|
|
74048
74101
|
if (sessionID) {
|
|
74049
|
-
session =
|
|
74102
|
+
session = _internals11.ensureAgentSession(sessionID);
|
|
74050
74103
|
}
|
|
74051
74104
|
if (session) {
|
|
74052
74105
|
const interactionCount = session.fullAutoInteractionCount ?? 0;
|
|
@@ -82141,10 +82194,10 @@ async function getRunMemorySummary(directory) {
|
|
|
82141
82194
|
if (entries.length === 0) {
|
|
82142
82195
|
return null;
|
|
82143
82196
|
}
|
|
82144
|
-
const groups =
|
|
82197
|
+
const groups = _internals38.groupByTaskId(entries);
|
|
82145
82198
|
const summaries = [];
|
|
82146
82199
|
for (const [taskId, taskEntries] of groups) {
|
|
82147
|
-
const summary =
|
|
82200
|
+
const summary = _internals38.summarizeTask(taskId, taskEntries);
|
|
82148
82201
|
if (summary) {
|
|
82149
82202
|
summaries.push(summary);
|
|
82150
82203
|
}
|
|
@@ -82177,7 +82230,7 @@ Use this data to avoid repeating known failure patterns.`;
|
|
|
82177
82230
|
}
|
|
82178
82231
|
return prefix + summaryText + suffix;
|
|
82179
82232
|
}
|
|
82180
|
-
var
|
|
82233
|
+
var _internals38 = {
|
|
82181
82234
|
generateTaskFingerprint,
|
|
82182
82235
|
recordOutcome,
|
|
82183
82236
|
getTaskHistory,
|
|
@@ -89690,7 +89743,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
89690
89743
|
}
|
|
89691
89744
|
return laneIds;
|
|
89692
89745
|
}
|
|
89693
|
-
var
|
|
89746
|
+
var _internals40 = {
|
|
89694
89747
|
listActiveLocks,
|
|
89695
89748
|
readPersisted: readPersisted2,
|
|
89696
89749
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -89751,7 +89804,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89751
89804
|
reason: "Lean Turbo state unreadable or missing"
|
|
89752
89805
|
};
|
|
89753
89806
|
}
|
|
89754
|
-
const persisted =
|
|
89807
|
+
const persisted = _internals40.readPersisted(directory);
|
|
89755
89808
|
if (!persisted) {
|
|
89756
89809
|
return {
|
|
89757
89810
|
ok: false,
|
|
@@ -89815,7 +89868,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89815
89868
|
}
|
|
89816
89869
|
}
|
|
89817
89870
|
if (runState.lanes.length > 0) {
|
|
89818
|
-
const evidenceLaneIds = new Set(
|
|
89871
|
+
const evidenceLaneIds = new Set(_internals40.listLaneEvidenceSync(directory, phase));
|
|
89819
89872
|
for (const lane of runState.lanes) {
|
|
89820
89873
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
89821
89874
|
return {
|
|
@@ -89825,7 +89878,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89825
89878
|
}
|
|
89826
89879
|
}
|
|
89827
89880
|
}
|
|
89828
|
-
const activeLocks =
|
|
89881
|
+
const activeLocks = _internals40.listActiveLocks(directory);
|
|
89829
89882
|
const phaseLaneIds = new Set(laneIds);
|
|
89830
89883
|
for (const lock of activeLocks) {
|
|
89831
89884
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -89845,7 +89898,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89845
89898
|
}
|
|
89846
89899
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
89847
89900
|
if (serialDegradedTasks.length > 0) {
|
|
89848
|
-
const plan =
|
|
89901
|
+
const plan = _internals40.readPlanJson(directory);
|
|
89849
89902
|
if (!plan) {
|
|
89850
89903
|
return {
|
|
89851
89904
|
ok: false,
|
|
@@ -89889,7 +89942,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89889
89942
|
}
|
|
89890
89943
|
const serializedTasks = runState.serializedTasks;
|
|
89891
89944
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
89892
|
-
const plan =
|
|
89945
|
+
const plan = _internals40.readPlanJson(directory);
|
|
89893
89946
|
if (!plan) {
|
|
89894
89947
|
return {
|
|
89895
89948
|
ok: false,
|
|
@@ -89948,7 +90001,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89948
90001
|
}
|
|
89949
90002
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
89950
90003
|
if (!reviewerVerdict) {
|
|
89951
|
-
const evidence =
|
|
90004
|
+
const evidence = _internals40.readReviewerEvidence(directory, phase);
|
|
89952
90005
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
89953
90006
|
}
|
|
89954
90007
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -89961,7 +90014,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89961
90014
|
}
|
|
89962
90015
|
let criticVerdict = runState.lastCriticVerdict;
|
|
89963
90016
|
if (!criticVerdict) {
|
|
89964
|
-
const evidence =
|
|
90017
|
+
const evidence = _internals40.readCriticEvidence(directory, phase);
|
|
89965
90018
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
89966
90019
|
}
|
|
89967
90020
|
if (mergedConfig.phase_critic) {
|
|
@@ -90864,7 +90917,7 @@ Advisory notes: ${advisoryNotes.join("; ")}` : "";
|
|
|
90864
90917
|
phase_critic: leanConfig.phase_critic,
|
|
90865
90918
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
90866
90919
|
} : undefined;
|
|
90867
|
-
const leanCheck =
|
|
90920
|
+
const leanCheck = _internals40.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
90868
90921
|
if (!leanCheck.ok) {
|
|
90869
90922
|
return JSON.stringify({
|
|
90870
90923
|
success: false,
|
|
@@ -93052,11 +93105,11 @@ var quality_budget = createSwarmTool({
|
|
|
93052
93105
|
}).optional().describe("Quality budget thresholds")
|
|
93053
93106
|
},
|
|
93054
93107
|
async execute(args2, directory) {
|
|
93055
|
-
const result = await
|
|
93108
|
+
const result = await _internals41.qualityBudget(args2, directory);
|
|
93056
93109
|
return JSON.stringify(result);
|
|
93057
93110
|
}
|
|
93058
93111
|
});
|
|
93059
|
-
var
|
|
93112
|
+
var _internals41 = {
|
|
93060
93113
|
qualityBudget
|
|
93061
93114
|
};
|
|
93062
93115
|
|
|
@@ -93785,7 +93838,7 @@ import * as path110 from "node:path";
|
|
|
93785
93838
|
var semgrepAvailableCache = null;
|
|
93786
93839
|
var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
93787
93840
|
var DEFAULT_TIMEOUT_MS3 = 30000;
|
|
93788
|
-
var
|
|
93841
|
+
var _internals42 = {
|
|
93789
93842
|
isSemgrepAvailable,
|
|
93790
93843
|
checkSemgrepAvailable,
|
|
93791
93844
|
resetSemgrepCache,
|
|
@@ -93810,7 +93863,7 @@ function isSemgrepAvailable() {
|
|
|
93810
93863
|
}
|
|
93811
93864
|
}
|
|
93812
93865
|
async function checkSemgrepAvailable() {
|
|
93813
|
-
return
|
|
93866
|
+
return _internals42.isSemgrepAvailable();
|
|
93814
93867
|
}
|
|
93815
93868
|
function resetSemgrepCache() {
|
|
93816
93869
|
semgrepAvailableCache = null;
|
|
@@ -93907,12 +93960,12 @@ async function runSemgrep(options) {
|
|
|
93907
93960
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS3;
|
|
93908
93961
|
if (files.length === 0) {
|
|
93909
93962
|
return {
|
|
93910
|
-
available:
|
|
93963
|
+
available: _internals42.isSemgrepAvailable(),
|
|
93911
93964
|
findings: [],
|
|
93912
93965
|
engine: "tier_a"
|
|
93913
93966
|
};
|
|
93914
93967
|
}
|
|
93915
|
-
if (!
|
|
93968
|
+
if (!_internals42.isSemgrepAvailable()) {
|
|
93916
93969
|
return {
|
|
93917
93970
|
available: false,
|
|
93918
93971
|
findings: [],
|
|
@@ -94071,7 +94124,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
94071
94124
|
}
|
|
94072
94125
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
94073
94126
|
countMap.set(baseKey, occIdx + 1);
|
|
94074
|
-
const fp =
|
|
94127
|
+
const fp = _internals43.fingerprintFinding(finding, directory, occIdx);
|
|
94075
94128
|
return {
|
|
94076
94129
|
finding,
|
|
94077
94130
|
index: occIdx,
|
|
@@ -94140,7 +94193,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
94140
94193
|
}
|
|
94141
94194
|
} catch {}
|
|
94142
94195
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
94143
|
-
const indexed =
|
|
94196
|
+
const indexed = _internals43.assignOccurrenceIndices(findings, directory);
|
|
94144
94197
|
if (existing && !opts?.force) {
|
|
94145
94198
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
94146
94199
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -94280,7 +94333,7 @@ function loadBaseline(directory, phase) {
|
|
|
94280
94333
|
};
|
|
94281
94334
|
}
|
|
94282
94335
|
}
|
|
94283
|
-
var
|
|
94336
|
+
var _internals43 = {
|
|
94284
94337
|
fingerprintFinding,
|
|
94285
94338
|
assignOccurrenceIndices,
|
|
94286
94339
|
captureOrMergeBaseline,
|
|
@@ -94690,11 +94743,11 @@ var sast_scan = createSwarmTool({
|
|
|
94690
94743
|
capture_baseline: safeArgs.capture_baseline,
|
|
94691
94744
|
phase: safeArgs.phase
|
|
94692
94745
|
};
|
|
94693
|
-
const result = await
|
|
94746
|
+
const result = await _internals44.sastScan(input, directory);
|
|
94694
94747
|
return JSON.stringify(result, null, 2);
|
|
94695
94748
|
}
|
|
94696
94749
|
});
|
|
94697
|
-
var
|
|
94750
|
+
var _internals44 = {
|
|
94698
94751
|
sastScan,
|
|
94699
94752
|
sast_scan
|
|
94700
94753
|
};
|
|
@@ -100018,7 +100071,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
|
|
|
100018
100071
|
}
|
|
100019
100072
|
async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
|
|
100020
100073
|
const lanes = await listLaneEvidence(directory, phase);
|
|
100021
|
-
const persisted =
|
|
100074
|
+
const persisted = _internals45.readPersisted?.(directory) ?? null;
|
|
100022
100075
|
if (persisted) {
|
|
100023
100076
|
let matchingRunState = null;
|
|
100024
100077
|
for (const sessionState of Object.values(persisted.sessions)) {
|
|
@@ -100210,7 +100263,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
|
|
|
100210
100263
|
client.session.delete({ path: { id: sessionId } }).catch(() => {});
|
|
100211
100264
|
}
|
|
100212
100265
|
}
|
|
100213
|
-
var
|
|
100266
|
+
var _internals45 = {
|
|
100214
100267
|
compileReviewPackage,
|
|
100215
100268
|
parseReviewerVerdict,
|
|
100216
100269
|
writeReviewerEvidence,
|
|
@@ -100227,28 +100280,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
|
|
|
100227
100280
|
};
|
|
100228
100281
|
const generatedAgentNames = swarmState.generatedAgentNames;
|
|
100229
100282
|
const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
|
|
100230
|
-
const pkg = await
|
|
100283
|
+
const pkg = await _internals45.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
|
|
100231
100284
|
let responseText;
|
|
100232
100285
|
try {
|
|
100233
|
-
responseText = await
|
|
100286
|
+
responseText = await _internals45.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
|
|
100234
100287
|
} catch (error93) {
|
|
100235
|
-
const evidencePath2 = await
|
|
100288
|
+
const evidencePath2 = await _internals45.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
|
|
100236
100289
|
return {
|
|
100237
100290
|
verdict: "REJECTED",
|
|
100238
100291
|
reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
|
|
100239
100292
|
evidencePath: evidencePath2
|
|
100240
100293
|
};
|
|
100241
100294
|
}
|
|
100242
|
-
const parsed =
|
|
100295
|
+
const parsed = _internals45.parseReviewerVerdict(responseText);
|
|
100243
100296
|
if (!parsed) {
|
|
100244
|
-
const evidencePath2 = await
|
|
100297
|
+
const evidencePath2 = await _internals45.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
|
|
100245
100298
|
return {
|
|
100246
100299
|
verdict: "REJECTED",
|
|
100247
100300
|
reason: "Reviewer response could not be parsed",
|
|
100248
100301
|
evidencePath: evidencePath2
|
|
100249
100302
|
};
|
|
100250
100303
|
}
|
|
100251
|
-
const evidencePath = await
|
|
100304
|
+
const evidencePath = await _internals45.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
|
|
100252
100305
|
return {
|
|
100253
100306
|
verdict: parsed.verdict,
|
|
100254
100307
|
reason: parsed.reason,
|
|
@@ -100754,7 +100807,7 @@ ${fileList}
|
|
|
100754
100807
|
|
|
100755
100808
|
// src/tools/lean-turbo-run-phase.ts
|
|
100756
100809
|
init_create_tool();
|
|
100757
|
-
var
|
|
100810
|
+
var _internals46 = {
|
|
100758
100811
|
LeanTurboRunner,
|
|
100759
100812
|
loadPluginConfigWithMeta
|
|
100760
100813
|
};
|
|
@@ -100764,9 +100817,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
100764
100817
|
let runError = null;
|
|
100765
100818
|
let runner = null;
|
|
100766
100819
|
try {
|
|
100767
|
-
const { config: config3 } =
|
|
100820
|
+
const { config: config3 } = _internals46.loadPluginConfigWithMeta(directory);
|
|
100768
100821
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
100769
|
-
runner = new
|
|
100822
|
+
runner = new _internals46.LeanTurboRunner({
|
|
100770
100823
|
directory,
|
|
100771
100824
|
sessionID,
|
|
100772
100825
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -101120,7 +101173,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
101120
101173
|
const strippedMutated = stripCode(mutatedCode);
|
|
101121
101174
|
return strippedOriginal === strippedMutated;
|
|
101122
101175
|
}
|
|
101123
|
-
var
|
|
101176
|
+
var _internals47 = {
|
|
101124
101177
|
isStaticallyEquivalent,
|
|
101125
101178
|
checkEquivalence,
|
|
101126
101179
|
batchCheckEquivalence
|
|
@@ -101160,7 +101213,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
101160
101213
|
const results = [];
|
|
101161
101214
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
101162
101215
|
try {
|
|
101163
|
-
const result = await
|
|
101216
|
+
const result = await _internals47.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
101164
101217
|
results.push(result);
|
|
101165
101218
|
} catch (err3) {
|
|
101166
101219
|
results.push({
|
|
@@ -101460,7 +101513,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
101460
101513
|
}
|
|
101461
101514
|
|
|
101462
101515
|
// src/mutation/gate.ts
|
|
101463
|
-
var
|
|
101516
|
+
var _internals48 = {
|
|
101464
101517
|
evaluateMutationGate,
|
|
101465
101518
|
buildTestImprovementPrompt,
|
|
101466
101519
|
buildMessage
|
|
@@ -101481,8 +101534,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
101481
101534
|
} else {
|
|
101482
101535
|
verdict = "fail";
|
|
101483
101536
|
}
|
|
101484
|
-
const testImprovementPrompt =
|
|
101485
|
-
const message =
|
|
101537
|
+
const testImprovementPrompt = _internals48.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
101538
|
+
const message = _internals48.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
101486
101539
|
return {
|
|
101487
101540
|
verdict,
|
|
101488
101541
|
killRate: report.killRate,
|
|
@@ -102099,7 +102152,7 @@ import * as path132 from "node:path";
|
|
|
102099
102152
|
init_bun_compat();
|
|
102100
102153
|
import * as fs102 from "node:fs";
|
|
102101
102154
|
import * as path131 from "node:path";
|
|
102102
|
-
var
|
|
102155
|
+
var _internals49 = { bunSpawn };
|
|
102103
102156
|
var _swarmGitExcludedChecked = false;
|
|
102104
102157
|
function fileCoversSwarm(content) {
|
|
102105
102158
|
for (const rawLine of content.split(`
|
|
@@ -102132,7 +102185,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102132
102185
|
checkIgnoreExitCode
|
|
102133
102186
|
] = await Promise.all([
|
|
102134
102187
|
(async () => {
|
|
102135
|
-
const proc =
|
|
102188
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
102136
102189
|
try {
|
|
102137
102190
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
102138
102191
|
} finally {
|
|
@@ -102142,7 +102195,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102142
102195
|
}
|
|
102143
102196
|
})(),
|
|
102144
102197
|
(async () => {
|
|
102145
|
-
const proc =
|
|
102198
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
102146
102199
|
try {
|
|
102147
102200
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
102148
102201
|
} finally {
|
|
@@ -102152,7 +102205,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102152
102205
|
}
|
|
102153
102206
|
})(),
|
|
102154
102207
|
(async () => {
|
|
102155
|
-
const proc =
|
|
102208
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
102156
102209
|
try {
|
|
102157
102210
|
return await proc.exited;
|
|
102158
102211
|
} finally {
|
|
@@ -102191,7 +102244,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102191
102244
|
}
|
|
102192
102245
|
} catch {}
|
|
102193
102246
|
}
|
|
102194
|
-
const trackedProc =
|
|
102247
|
+
const trackedProc = _internals49.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
102195
102248
|
let trackedExitCode;
|
|
102196
102249
|
let trackedOutput;
|
|
102197
102250
|
try {
|
|
@@ -102216,7 +102269,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102216
102269
|
}
|
|
102217
102270
|
|
|
102218
102271
|
// src/hooks/diff-scope.ts
|
|
102219
|
-
var
|
|
102272
|
+
var _internals50 = { bunSpawn };
|
|
102220
102273
|
function getDeclaredScope(taskId, directory) {
|
|
102221
102274
|
try {
|
|
102222
102275
|
const planPath = path132.join(directory, ".swarm", "plan.json");
|
|
@@ -102251,7 +102304,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
102251
102304
|
};
|
|
102252
102305
|
async function getChangedFiles(directory) {
|
|
102253
102306
|
try {
|
|
102254
|
-
const proc =
|
|
102307
|
+
const proc = _internals50.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
102255
102308
|
cwd: directory,
|
|
102256
102309
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
102257
102310
|
});
|
|
@@ -102268,7 +102321,7 @@ async function getChangedFiles(directory) {
|
|
|
102268
102321
|
return stdout.trim().split(`
|
|
102269
102322
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
102270
102323
|
}
|
|
102271
|
-
const proc2 =
|
|
102324
|
+
const proc2 = _internals50.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
102272
102325
|
cwd: directory,
|
|
102273
102326
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
102274
102327
|
});
|
|
@@ -102326,7 +102379,7 @@ init_telemetry();
|
|
|
102326
102379
|
init_file_locks();
|
|
102327
102380
|
import * as fs104 from "node:fs";
|
|
102328
102381
|
import * as path133 from "node:path";
|
|
102329
|
-
var
|
|
102382
|
+
var _internals51 = {
|
|
102330
102383
|
listActiveLocks,
|
|
102331
102384
|
verifyLeanTurboTaskCompletion
|
|
102332
102385
|
};
|
|
@@ -102468,7 +102521,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
102468
102521
|
}
|
|
102469
102522
|
};
|
|
102470
102523
|
}
|
|
102471
|
-
const activeLocks =
|
|
102524
|
+
const activeLocks = _internals51.listActiveLocks(directory);
|
|
102472
102525
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
102473
102526
|
if (laneLocks.length > 0) {
|
|
102474
102527
|
return {
|