opencode-swarm 7.19.3 → 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 +109 -11
- package/dist/hooks/guardrails.d.ts +21 -0
- package/dist/index.js +417 -266
- package/dist/state.d.ts +2 -0
- package/dist/test-impact/analyzer.d.ts +8 -2
- package/dist/tools/test-runner.d.ts +11 -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.
|
|
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,24 +55456,42 @@ 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
|
-
async function loadImpactMap(cwd) {
|
|
55463
|
+
async function loadImpactMap(cwd, options) {
|
|
55411
55464
|
const cachePath = path41.join(cwd, ".swarm", "cache", "impact-map.json");
|
|
55412
55465
|
if (fs24.existsSync(cachePath)) {
|
|
55413
55466
|
try {
|
|
55414
55467
|
const content = fs24.readFileSync(cachePath, "utf-8");
|
|
55415
55468
|
const data = JSON.parse(content);
|
|
55416
|
-
|
|
55417
|
-
|
|
55418
|
-
|
|
55419
|
-
|
|
55469
|
+
if (data.map !== null && typeof data.map === "object" && !Array.isArray(data.map)) {
|
|
55470
|
+
const map3 = data.map;
|
|
55471
|
+
const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
55472
|
+
if (hasValidValues) {
|
|
55473
|
+
const generatedAt = new Date(data.generatedAt).getTime();
|
|
55474
|
+
if (!_internals29.isCacheStale(map3, generatedAt)) {
|
|
55475
|
+
return map3;
|
|
55476
|
+
}
|
|
55477
|
+
if (options?.skipRebuild) {
|
|
55478
|
+
return map3;
|
|
55479
|
+
}
|
|
55480
|
+
}
|
|
55420
55481
|
}
|
|
55421
|
-
|
|
55482
|
+
if (options?.skipRebuild) {
|
|
55483
|
+
return {};
|
|
55484
|
+
}
|
|
55485
|
+
} catch {
|
|
55486
|
+
if (options?.skipRebuild) {
|
|
55487
|
+
return {};
|
|
55488
|
+
}
|
|
55489
|
+
}
|
|
55422
55490
|
}
|
|
55423
|
-
|
|
55491
|
+
if (options?.skipRebuild) {
|
|
55492
|
+
return {};
|
|
55493
|
+
}
|
|
55494
|
+
return _internals29.buildImpactMap(cwd);
|
|
55424
55495
|
}
|
|
55425
55496
|
async function saveImpactMap(cwd, impactMap) {
|
|
55426
55497
|
const cacheDir2 = path41.join(cwd, ".swarm", "cache");
|
|
@@ -55435,7 +55506,7 @@ async function saveImpactMap(cwd, impactMap) {
|
|
|
55435
55506
|
};
|
|
55436
55507
|
fs24.writeFileSync(cachePath, JSON.stringify(data, null, 2), "utf-8");
|
|
55437
55508
|
}
|
|
55438
|
-
async function analyzeImpact(changedFiles, cwd) {
|
|
55509
|
+
async function analyzeImpact(changedFiles, cwd, budget) {
|
|
55439
55510
|
if (!Array.isArray(changedFiles)) {
|
|
55440
55511
|
const emptyMap = {};
|
|
55441
55512
|
return {
|
|
@@ -55446,27 +55517,52 @@ async function analyzeImpact(changedFiles, cwd) {
|
|
|
55446
55517
|
};
|
|
55447
55518
|
}
|
|
55448
55519
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
55449
|
-
const impactMap = await
|
|
55520
|
+
const impactMap = await _internals29.loadImpactMap(cwd);
|
|
55450
55521
|
const impactedTestsSet = new Set;
|
|
55451
55522
|
const untestedFiles = [];
|
|
55523
|
+
let visitedCount = 0;
|
|
55524
|
+
let budgetExceeded = false;
|
|
55452
55525
|
for (const changedFile of validFiles) {
|
|
55526
|
+
if (budget !== undefined && visitedCount >= budget) {
|
|
55527
|
+
budgetExceeded = true;
|
|
55528
|
+
break;
|
|
55529
|
+
}
|
|
55453
55530
|
const normalizedChanged = normalizePath(path41.resolve(changedFile));
|
|
55454
55531
|
const tests = impactMap[normalizedChanged];
|
|
55455
55532
|
if (tests && tests.length > 0) {
|
|
55456
55533
|
for (const test of tests) {
|
|
55534
|
+
if (budget !== undefined && visitedCount >= budget) {
|
|
55535
|
+
budgetExceeded = true;
|
|
55536
|
+
break;
|
|
55537
|
+
}
|
|
55457
55538
|
impactedTestsSet.add(test);
|
|
55539
|
+
visitedCount++;
|
|
55458
55540
|
}
|
|
55541
|
+
if (budgetExceeded)
|
|
55542
|
+
break;
|
|
55459
55543
|
} else {
|
|
55460
55544
|
let found = false;
|
|
55461
55545
|
for (const [sourcePath, tests2] of Object.entries(impactMap)) {
|
|
55546
|
+
if (budget !== undefined && visitedCount >= budget) {
|
|
55547
|
+
budgetExceeded = true;
|
|
55548
|
+
break;
|
|
55549
|
+
}
|
|
55462
55550
|
if (sourcePath.endsWith(changedFile) || changedFile.endsWith(sourcePath)) {
|
|
55463
55551
|
for (const test of tests2) {
|
|
55552
|
+
if (budget !== undefined && visitedCount >= budget) {
|
|
55553
|
+
budgetExceeded = true;
|
|
55554
|
+
break;
|
|
55555
|
+
}
|
|
55464
55556
|
impactedTestsSet.add(test);
|
|
55557
|
+
visitedCount++;
|
|
55465
55558
|
}
|
|
55559
|
+
if (budgetExceeded)
|
|
55560
|
+
break;
|
|
55466
55561
|
found = true;
|
|
55467
|
-
break;
|
|
55468
55562
|
}
|
|
55469
55563
|
}
|
|
55564
|
+
if (budgetExceeded)
|
|
55565
|
+
break;
|
|
55470
55566
|
if (!found) {
|
|
55471
55567
|
untestedFiles.push(changedFile);
|
|
55472
55568
|
}
|
|
@@ -55484,10 +55580,11 @@ async function analyzeImpact(changedFiles, cwd) {
|
|
|
55484
55580
|
impactedTests,
|
|
55485
55581
|
unrelatedTests,
|
|
55486
55582
|
untestedFiles,
|
|
55487
|
-
impactMap
|
|
55583
|
+
impactMap,
|
|
55584
|
+
budgetExceeded
|
|
55488
55585
|
};
|
|
55489
55586
|
}
|
|
55490
|
-
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;
|
|
55491
55588
|
var init_analyzer = __esm(() => {
|
|
55492
55589
|
init_go();
|
|
55493
55590
|
init_python();
|
|
@@ -55499,7 +55596,7 @@ var init_analyzer = __esm(() => {
|
|
|
55499
55596
|
GO_EXTENSIONS = new Set([".go"]);
|
|
55500
55597
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
55501
55598
|
goModuleCache = new Map;
|
|
55502
|
-
|
|
55599
|
+
_internals29 = {
|
|
55503
55600
|
normalizePath,
|
|
55504
55601
|
isCacheStale,
|
|
55505
55602
|
resolveRelativeImport,
|
|
@@ -55979,7 +56076,7 @@ function readPackageJsonRaw(dir) {
|
|
|
55979
56076
|
}
|
|
55980
56077
|
}
|
|
55981
56078
|
function readPackageJson(dir) {
|
|
55982
|
-
return
|
|
56079
|
+
return _internals30.readPackageJsonRaw(dir);
|
|
55983
56080
|
}
|
|
55984
56081
|
function readPackageJsonTestScript(dir) {
|
|
55985
56082
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -56149,7 +56246,7 @@ function buildTypescriptBackend() {
|
|
|
56149
56246
|
selectEntryPoints: selectEntryPoints3
|
|
56150
56247
|
};
|
|
56151
56248
|
}
|
|
56152
|
-
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;
|
|
56153
56250
|
var init_typescript = __esm(() => {
|
|
56154
56251
|
init_default_backend();
|
|
56155
56252
|
init_profiles();
|
|
@@ -56158,7 +56255,7 @@ var init_typescript = __esm(() => {
|
|
|
56158
56255
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
56159
56256
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
56160
56257
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
56161
|
-
|
|
56258
|
+
_internals30 = {
|
|
56162
56259
|
readPackageJsonRaw,
|
|
56163
56260
|
readPackageJsonTestScript,
|
|
56164
56261
|
frameworkFromScriptsTest
|
|
@@ -56189,7 +56286,7 @@ __export(exports_dispatch, {
|
|
|
56189
56286
|
pickedProfiles: () => pickedProfiles,
|
|
56190
56287
|
pickBackend: () => pickBackend,
|
|
56191
56288
|
clearDispatchCache: () => clearDispatchCache,
|
|
56192
|
-
_internals: () =>
|
|
56289
|
+
_internals: () => _internals31
|
|
56193
56290
|
});
|
|
56194
56291
|
import * as fs28 from "node:fs";
|
|
56195
56292
|
import * as path45 from "node:path";
|
|
@@ -56244,7 +56341,7 @@ function findManifestRoot(start2) {
|
|
|
56244
56341
|
return start2;
|
|
56245
56342
|
}
|
|
56246
56343
|
function evictIfNeeded() {
|
|
56247
|
-
if (cache.size <=
|
|
56344
|
+
if (cache.size <= _internals31.cacheCapacity)
|
|
56248
56345
|
return;
|
|
56249
56346
|
let oldestKey;
|
|
56250
56347
|
let oldestOrder = Infinity;
|
|
@@ -56275,7 +56372,7 @@ async function pickBackend(dir) {
|
|
|
56275
56372
|
evictIfNeeded();
|
|
56276
56373
|
return null;
|
|
56277
56374
|
}
|
|
56278
|
-
const profiles = await
|
|
56375
|
+
const profiles = await _internals31.detectProjectLanguages(root);
|
|
56279
56376
|
if (profiles.length === 0) {
|
|
56280
56377
|
cache.set(cacheKey, {
|
|
56281
56378
|
hash: hash3,
|
|
@@ -56307,12 +56404,12 @@ function clearDispatchCache() {
|
|
|
56307
56404
|
manifestRootCache.clear();
|
|
56308
56405
|
insertCounter = 0;
|
|
56309
56406
|
}
|
|
56310
|
-
var
|
|
56407
|
+
var _internals31, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
56311
56408
|
var init_dispatch = __esm(() => {
|
|
56312
56409
|
init_backends();
|
|
56313
56410
|
init_detector();
|
|
56314
56411
|
init_registry_backend();
|
|
56315
|
-
|
|
56412
|
+
_internals31 = {
|
|
56316
56413
|
detectProjectLanguages,
|
|
56317
56414
|
cacheCapacity: 64
|
|
56318
56415
|
};
|
|
@@ -56346,6 +56443,25 @@ var init_dispatch = __esm(() => {
|
|
|
56346
56443
|
// src/tools/test-runner.ts
|
|
56347
56444
|
import * as fs29 from "node:fs";
|
|
56348
56445
|
import * as path46 from "node:path";
|
|
56446
|
+
async function estimateFanOut(sourceFiles, cwd) {
|
|
56447
|
+
try {
|
|
56448
|
+
const impactMap = await loadImpactMap(cwd, { skipRebuild: true });
|
|
56449
|
+
const uniqueTestFiles = new Set;
|
|
56450
|
+
for (const sourceFile of sourceFiles) {
|
|
56451
|
+
const resolvedPath = path46.resolve(cwd, sourceFile);
|
|
56452
|
+
const normalizedPath = resolvedPath.replace(/\\/g, "/");
|
|
56453
|
+
const testFiles = impactMap[normalizedPath];
|
|
56454
|
+
if (testFiles) {
|
|
56455
|
+
for (const testFile of testFiles) {
|
|
56456
|
+
uniqueTestFiles.add(testFile);
|
|
56457
|
+
}
|
|
56458
|
+
}
|
|
56459
|
+
}
|
|
56460
|
+
return { estimatedCount: uniqueTestFiles.size };
|
|
56461
|
+
} catch {
|
|
56462
|
+
return { estimatedCount: 0 };
|
|
56463
|
+
}
|
|
56464
|
+
}
|
|
56349
56465
|
function isAbsolutePath(str) {
|
|
56350
56466
|
if (str.startsWith("/"))
|
|
56351
56467
|
return true;
|
|
@@ -57690,6 +57806,18 @@ var init_test_runner = __esm(() => {
|
|
|
57690
57806
|
};
|
|
57691
57807
|
return JSON.stringify(errorResult, null, 2);
|
|
57692
57808
|
}
|
|
57809
|
+
const estimate = await estimateFanOut(sourceFiles, workingDir);
|
|
57810
|
+
if (estimate.estimatedCount > MAX_SAFE_TEST_FILES) {
|
|
57811
|
+
const errorResult = {
|
|
57812
|
+
success: false,
|
|
57813
|
+
framework,
|
|
57814
|
+
scope,
|
|
57815
|
+
error: "Estimated test file count exceeds safe maximum",
|
|
57816
|
+
message: `Scope "graph" resolution would produce approximately ${estimate.estimatedCount} test files, which exceeds the safe limit of ${MAX_SAFE_TEST_FILES}. Break the source files into smaller batches and retry.`,
|
|
57817
|
+
outcome: "scope_exceeded"
|
|
57818
|
+
};
|
|
57819
|
+
return JSON.stringify(errorResult, null, 2);
|
|
57820
|
+
}
|
|
57693
57821
|
const graphTestFiles = await getTestFilesFromGraph(sourceFiles, workingDir);
|
|
57694
57822
|
if (graphTestFiles.length > 0) {
|
|
57695
57823
|
testFiles = graphTestFiles;
|
|
@@ -57728,8 +57856,31 @@ var init_test_runner = __esm(() => {
|
|
|
57728
57856
|
};
|
|
57729
57857
|
return JSON.stringify(errorResult, null, 2);
|
|
57730
57858
|
}
|
|
57859
|
+
const estimate = await estimateFanOut(sourceFiles, workingDir);
|
|
57860
|
+
if (estimate.estimatedCount > MAX_SAFE_TEST_FILES) {
|
|
57861
|
+
const errorResult = {
|
|
57862
|
+
success: false,
|
|
57863
|
+
framework,
|
|
57864
|
+
scope,
|
|
57865
|
+
error: "Estimated test file count exceeds safe maximum",
|
|
57866
|
+
message: `Scope "impact" resolution would produce approximately ${estimate.estimatedCount} test files, which exceeds the safe limit of ${MAX_SAFE_TEST_FILES}. Break the source files into smaller batches and retry.`,
|
|
57867
|
+
outcome: "scope_exceeded"
|
|
57868
|
+
};
|
|
57869
|
+
return JSON.stringify(errorResult, null, 2);
|
|
57870
|
+
}
|
|
57731
57871
|
try {
|
|
57732
|
-
const impactResult = await analyzeImpact(sourceFiles, workingDir);
|
|
57872
|
+
const impactResult = await analyzeImpact(sourceFiles, workingDir, MAX_SAFE_TEST_FILES);
|
|
57873
|
+
if (impactResult.budgetExceeded) {
|
|
57874
|
+
const errorResult = {
|
|
57875
|
+
success: false,
|
|
57876
|
+
framework,
|
|
57877
|
+
scope,
|
|
57878
|
+
error: "Budget exceeded during impact analysis",
|
|
57879
|
+
message: `Impact analysis exceeded safe budget of ${MAX_SAFE_TEST_FILES} test files.`,
|
|
57880
|
+
outcome: "scope_exceeded"
|
|
57881
|
+
};
|
|
57882
|
+
return JSON.stringify(errorResult, null, 2);
|
|
57883
|
+
}
|
|
57733
57884
|
if (impactResult.impactedTests.length > 0) {
|
|
57734
57885
|
testFiles = impactResult.impactedTests.map((absPath) => {
|
|
57735
57886
|
const relativePath = path46.relative(workingDir, absPath);
|
|
@@ -57882,9 +58033,9 @@ function getVersionFileVersion(dir) {
|
|
|
57882
58033
|
async function runVersionCheck2(dir, _timeoutMs) {
|
|
57883
58034
|
const startTime = Date.now();
|
|
57884
58035
|
try {
|
|
57885
|
-
const packageVersion =
|
|
57886
|
-
const changelogVersion =
|
|
57887
|
-
const versionFileVersion =
|
|
58036
|
+
const packageVersion = _internals32.getPackageVersion(dir);
|
|
58037
|
+
const changelogVersion = _internals32.getChangelogVersion(dir);
|
|
58038
|
+
const versionFileVersion = _internals32.getVersionFileVersion(dir);
|
|
57888
58039
|
const versions3 = [];
|
|
57889
58040
|
if (packageVersion)
|
|
57890
58041
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -58234,7 +58385,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58234
58385
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
58235
58386
|
let validatedDir;
|
|
58236
58387
|
try {
|
|
58237
|
-
validatedDir =
|
|
58388
|
+
validatedDir = _internals32.validateDirectoryPath(dir);
|
|
58238
58389
|
} catch (error93) {
|
|
58239
58390
|
return {
|
|
58240
58391
|
id: reportId,
|
|
@@ -58254,7 +58405,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58254
58405
|
}
|
|
58255
58406
|
let validatedTimeout;
|
|
58256
58407
|
try {
|
|
58257
|
-
validatedTimeout =
|
|
58408
|
+
validatedTimeout = _internals32.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
58258
58409
|
} catch (error93) {
|
|
58259
58410
|
return {
|
|
58260
58411
|
id: reportId,
|
|
@@ -58295,12 +58446,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58295
58446
|
});
|
|
58296
58447
|
const checks5 = [];
|
|
58297
58448
|
log("[Preflight] Running lint check...");
|
|
58298
|
-
const lintResult = await
|
|
58449
|
+
const lintResult = await _internals32.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
58299
58450
|
checks5.push(lintResult);
|
|
58300
58451
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
58301
58452
|
if (!cfg.skipTests) {
|
|
58302
58453
|
log("[Preflight] Running tests check...");
|
|
58303
|
-
const testsResult = await
|
|
58454
|
+
const testsResult = await _internals32.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
58304
58455
|
checks5.push(testsResult);
|
|
58305
58456
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
58306
58457
|
} else {
|
|
@@ -58312,7 +58463,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58312
58463
|
}
|
|
58313
58464
|
if (!cfg.skipSecrets) {
|
|
58314
58465
|
log("[Preflight] Running secrets check...");
|
|
58315
|
-
const secretsResult = await
|
|
58466
|
+
const secretsResult = await _internals32.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
58316
58467
|
checks5.push(secretsResult);
|
|
58317
58468
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
58318
58469
|
} else {
|
|
@@ -58324,7 +58475,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58324
58475
|
}
|
|
58325
58476
|
if (!cfg.skipEvidence) {
|
|
58326
58477
|
log("[Preflight] Running evidence check...");
|
|
58327
|
-
const evidenceResult = await
|
|
58478
|
+
const evidenceResult = await _internals32.runEvidenceCheck(validatedDir);
|
|
58328
58479
|
checks5.push(evidenceResult);
|
|
58329
58480
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
58330
58481
|
} else {
|
|
@@ -58335,12 +58486,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
58335
58486
|
});
|
|
58336
58487
|
}
|
|
58337
58488
|
log("[Preflight] Running requirement coverage check...");
|
|
58338
|
-
const reqCoverageResult = await
|
|
58489
|
+
const reqCoverageResult = await _internals32.runRequirementCoverageCheck(validatedDir, phase);
|
|
58339
58490
|
checks5.push(reqCoverageResult);
|
|
58340
58491
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
58341
58492
|
if (!cfg.skipVersion) {
|
|
58342
58493
|
log("[Preflight] Running version check...");
|
|
58343
|
-
const versionResult = await
|
|
58494
|
+
const versionResult = await _internals32.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
58344
58495
|
checks5.push(versionResult);
|
|
58345
58496
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
58346
58497
|
} else {
|
|
@@ -58403,10 +58554,10 @@ function formatPreflightMarkdown(report) {
|
|
|
58403
58554
|
async function handlePreflightCommand(directory, _args) {
|
|
58404
58555
|
const plan = await loadPlan(directory);
|
|
58405
58556
|
const phase = plan?.current_phase ?? 1;
|
|
58406
|
-
const report = await
|
|
58407
|
-
return
|
|
58557
|
+
const report = await _internals32.runPreflight(directory, phase);
|
|
58558
|
+
return _internals32.formatPreflightMarkdown(report);
|
|
58408
58559
|
}
|
|
58409
|
-
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;
|
|
58410
58561
|
var init_preflight_service = __esm(() => {
|
|
58411
58562
|
init_manager2();
|
|
58412
58563
|
init_manager();
|
|
@@ -58423,7 +58574,7 @@ var init_preflight_service = __esm(() => {
|
|
|
58423
58574
|
testScope: "convention",
|
|
58424
58575
|
linter: "biome"
|
|
58425
58576
|
};
|
|
58426
|
-
|
|
58577
|
+
_internals32 = {
|
|
58427
58578
|
runPreflight,
|
|
58428
58579
|
formatPreflightMarkdown,
|
|
58429
58580
|
handlePreflightCommand,
|
|
@@ -59738,7 +59889,7 @@ async function handleSimulateCommand(directory, args2) {
|
|
|
59738
59889
|
}
|
|
59739
59890
|
let darkMatterPairs;
|
|
59740
59891
|
try {
|
|
59741
|
-
darkMatterPairs = await
|
|
59892
|
+
darkMatterPairs = await _internals17.detectDarkMatter(directory, options);
|
|
59742
59893
|
} catch (err2) {
|
|
59743
59894
|
const errMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
59744
59895
|
return `## Simulate Report
|
|
@@ -60318,7 +60469,7 @@ async function getStatusData(directory, agents) {
|
|
|
60318
60469
|
}
|
|
60319
60470
|
function enrichWithLeanTurbo(status, directory) {
|
|
60320
60471
|
const turboMode = hasActiveTurboMode();
|
|
60321
|
-
const leanActive =
|
|
60472
|
+
const leanActive = _internals33.hasActiveLeanTurbo();
|
|
60322
60473
|
let turboStrategy = "off";
|
|
60323
60474
|
if (leanActive) {
|
|
60324
60475
|
turboStrategy = "lean";
|
|
@@ -60337,7 +60488,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
60337
60488
|
}
|
|
60338
60489
|
}
|
|
60339
60490
|
if (leanSessionID) {
|
|
60340
|
-
const runState =
|
|
60491
|
+
const runState = _internals33.loadLeanTurboRunState(directory, leanSessionID);
|
|
60341
60492
|
if (runState) {
|
|
60342
60493
|
status.leanTurboPhase = runState.phase;
|
|
60343
60494
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -60369,7 +60520,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
60369
60520
|
}
|
|
60370
60521
|
}
|
|
60371
60522
|
}
|
|
60372
|
-
status.fullAutoActive =
|
|
60523
|
+
status.fullAutoActive = _internals33.hasActiveFullAuto();
|
|
60373
60524
|
return status;
|
|
60374
60525
|
}
|
|
60375
60526
|
function formatStatusMarkdown(status) {
|
|
@@ -60451,7 +60602,7 @@ async function handleStatusCommand(directory, agents) {
|
|
|
60451
60602
|
}
|
|
60452
60603
|
return formatStatusMarkdown(statusData);
|
|
60453
60604
|
}
|
|
60454
|
-
var
|
|
60605
|
+
var _internals33;
|
|
60455
60606
|
var init_status_service = __esm(() => {
|
|
60456
60607
|
init_extractors();
|
|
60457
60608
|
init_utils2();
|
|
@@ -60460,7 +60611,7 @@ var init_status_service = __esm(() => {
|
|
|
60460
60611
|
init_state3();
|
|
60461
60612
|
init_compaction_service();
|
|
60462
60613
|
init_context_budget_service();
|
|
60463
|
-
|
|
60614
|
+
_internals33 = {
|
|
60464
60615
|
loadLeanTurboRunState,
|
|
60465
60616
|
hasActiveLeanTurbo,
|
|
60466
60617
|
hasActiveFullAuto
|
|
@@ -60551,7 +60702,7 @@ async function handleTurboCommand(directory, args2, sessionID) {
|
|
|
60551
60702
|
if (arg0 === "on") {
|
|
60552
60703
|
let strategy = "standard";
|
|
60553
60704
|
try {
|
|
60554
|
-
const { config: config3 } =
|
|
60705
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
60555
60706
|
if (config3.turbo?.strategy === "lean") {
|
|
60556
60707
|
strategy = "lean";
|
|
60557
60708
|
}
|
|
@@ -60606,7 +60757,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
60606
60757
|
let maxParallelCoders = 4;
|
|
60607
60758
|
let conflictPolicy = "serialize";
|
|
60608
60759
|
try {
|
|
60609
|
-
const { config: config3 } =
|
|
60760
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
60610
60761
|
const leanConfig = config3.turbo?.lean;
|
|
60611
60762
|
if (leanConfig) {
|
|
60612
60763
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -60676,13 +60827,13 @@ function buildStatusMessage(session, directory, sessionID) {
|
|
|
60676
60827
|
].join(`
|
|
60677
60828
|
`);
|
|
60678
60829
|
}
|
|
60679
|
-
var
|
|
60830
|
+
var _internals34;
|
|
60680
60831
|
var init_turbo = __esm(() => {
|
|
60681
60832
|
init_config();
|
|
60682
60833
|
init_state();
|
|
60683
60834
|
init_state3();
|
|
60684
60835
|
init_logger();
|
|
60685
|
-
|
|
60836
|
+
_internals34 = {
|
|
60686
60837
|
loadPluginConfigWithMeta
|
|
60687
60838
|
};
|
|
60688
60839
|
});
|
|
@@ -60775,7 +60926,7 @@ function formatCommandNotFound(tokens) {
|
|
|
60775
60926
|
const attemptedCommand = tokens[0] || "";
|
|
60776
60927
|
const MAX_DISPLAY = 100;
|
|
60777
60928
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
60778
|
-
const similar =
|
|
60929
|
+
const similar = _internals35.findSimilarCommands(attemptedCommand);
|
|
60779
60930
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
60780
60931
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
60781
60932
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -61210,7 +61361,7 @@ async function buildSwarmCommandPrompt(args2) {
|
|
|
61210
61361
|
activeAgentName,
|
|
61211
61362
|
registeredAgents
|
|
61212
61363
|
} = args2;
|
|
61213
|
-
const resolved =
|
|
61364
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
61214
61365
|
if (!resolved) {
|
|
61215
61366
|
if (tokens.length === 0) {
|
|
61216
61367
|
return buildHelpText();
|
|
@@ -61361,7 +61512,7 @@ function findSimilarCommands(query) {
|
|
|
61361
61512
|
}
|
|
61362
61513
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
61363
61514
|
const cmdLower = cmd.toLowerCase();
|
|
61364
|
-
const fullScore =
|
|
61515
|
+
const fullScore = _internals35.levenshteinDistance(q, cmdLower);
|
|
61365
61516
|
let tokenScore = Infinity;
|
|
61366
61517
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
61367
61518
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -61374,7 +61525,7 @@ function findSimilarCommands(query) {
|
|
|
61374
61525
|
for (const ct of cmdTokens) {
|
|
61375
61526
|
if (ct.length === 0)
|
|
61376
61527
|
continue;
|
|
61377
|
-
const dist =
|
|
61528
|
+
const dist = _internals35.levenshteinDistance(qt, ct);
|
|
61378
61529
|
if (dist < minDist)
|
|
61379
61530
|
minDist = dist;
|
|
61380
61531
|
}
|
|
@@ -61384,7 +61535,7 @@ function findSimilarCommands(query) {
|
|
|
61384
61535
|
}
|
|
61385
61536
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
61386
61537
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
61387
|
-
const dashScore =
|
|
61538
|
+
const dashScore = _internals35.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
61388
61539
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
61389
61540
|
return { cmd, score };
|
|
61390
61541
|
});
|
|
@@ -61416,11 +61567,11 @@ async function handleHelpCommand(ctx) {
|
|
|
61416
61567
|
return buildHelpText2();
|
|
61417
61568
|
}
|
|
61418
61569
|
const tokens = targetCommand.split(/\s+/);
|
|
61419
|
-
const resolved =
|
|
61570
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
61420
61571
|
if (resolved) {
|
|
61421
|
-
return
|
|
61572
|
+
return _internals35.buildDetailedHelp(resolved.key, resolved.entry);
|
|
61422
61573
|
}
|
|
61423
|
-
const similar =
|
|
61574
|
+
const similar = _internals35.findSimilarCommands(targetCommand);
|
|
61424
61575
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
61425
61576
|
if (similar.length > 0) {
|
|
61426
61577
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -61514,7 +61665,7 @@ function resolveCommand(tokens) {
|
|
|
61514
61665
|
}
|
|
61515
61666
|
return null;
|
|
61516
61667
|
}
|
|
61517
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
61668
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals35, validation;
|
|
61518
61669
|
var init_registry = __esm(() => {
|
|
61519
61670
|
init_acknowledge_spec_drift();
|
|
61520
61671
|
init_agents();
|
|
@@ -61584,7 +61735,7 @@ var init_registry = __esm(() => {
|
|
|
61584
61735
|
clashesWithNativeCcCommand: "/agents"
|
|
61585
61736
|
},
|
|
61586
61737
|
help: {
|
|
61587
|
-
handler: (ctx) =>
|
|
61738
|
+
handler: (ctx) => _internals35.handleHelpCommand(ctx),
|
|
61588
61739
|
description: "Show help for swarm commands",
|
|
61589
61740
|
category: "core",
|
|
61590
61741
|
args: "[command]",
|
|
@@ -61956,7 +62107,7 @@ Subcommands:
|
|
|
61956
62107
|
}
|
|
61957
62108
|
};
|
|
61958
62109
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
61959
|
-
|
|
62110
|
+
_internals35 = {
|
|
61960
62111
|
handleHelpCommand,
|
|
61961
62112
|
validateAliases,
|
|
61962
62113
|
resolveCommand,
|
|
@@ -61964,7 +62115,7 @@ Subcommands:
|
|
|
61964
62115
|
findSimilarCommands,
|
|
61965
62116
|
buildDetailedHelp
|
|
61966
62117
|
};
|
|
61967
|
-
validation =
|
|
62118
|
+
validation = _internals35.validateAliases();
|
|
61968
62119
|
if (!validation.valid) {
|
|
61969
62120
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
61970
62121
|
${validation.errors.join(`
|
|
@@ -70589,7 +70740,7 @@ __export(exports_runtime, {
|
|
|
70589
70740
|
getSupportedLanguages: () => getSupportedLanguages,
|
|
70590
70741
|
getInitializedLanguages: () => getInitializedLanguages,
|
|
70591
70742
|
clearParserCache: () => clearParserCache,
|
|
70592
|
-
_internals: () =>
|
|
70743
|
+
_internals: () => _internals36
|
|
70593
70744
|
});
|
|
70594
70745
|
import * as path77 from "node:path";
|
|
70595
70746
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -70599,10 +70750,10 @@ async function initTreeSitter() {
|
|
|
70599
70750
|
const thisDir = path77.dirname(fileURLToPath2(import.meta.url));
|
|
70600
70751
|
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
70601
70752
|
if (isSource) {
|
|
70602
|
-
await
|
|
70753
|
+
await _internals36.parserInit();
|
|
70603
70754
|
} else {
|
|
70604
70755
|
const grammarsDir = getGrammarsDirAbsolute();
|
|
70605
|
-
await
|
|
70756
|
+
await _internals36.parserInit({
|
|
70606
70757
|
locateFile(scriptName) {
|
|
70607
70758
|
return path77.join(grammarsDir, scriptName);
|
|
70608
70759
|
}
|
|
@@ -70704,12 +70855,12 @@ function getInitializedLanguages() {
|
|
|
70704
70855
|
function getSupportedLanguages() {
|
|
70705
70856
|
return Object.keys(LANGUAGE_WASM_MAP);
|
|
70706
70857
|
}
|
|
70707
|
-
var parserCache, initializedLanguages, treeSitterInitPromise = null,
|
|
70858
|
+
var parserCache, initializedLanguages, treeSitterInitPromise = null, _internals36, LANGUAGE_WASM_MAP;
|
|
70708
70859
|
var init_runtime = __esm(() => {
|
|
70709
70860
|
init_tree_sitter();
|
|
70710
70861
|
parserCache = new Map;
|
|
70711
70862
|
initializedLanguages = new Set;
|
|
70712
|
-
|
|
70863
|
+
_internals36 = {
|
|
70713
70864
|
parserInit: Parser.init
|
|
70714
70865
|
};
|
|
70715
70866
|
LANGUAGE_WASM_MAP = {
|
|
@@ -71166,9 +71317,9 @@ var init_doc_scan = __esm(() => {
|
|
|
71166
71317
|
var exports_knowledge_recall = {};
|
|
71167
71318
|
__export(exports_knowledge_recall, {
|
|
71168
71319
|
knowledge_recall: () => knowledge_recall,
|
|
71169
|
-
_internals: () =>
|
|
71320
|
+
_internals: () => _internals37
|
|
71170
71321
|
});
|
|
71171
|
-
var knowledge_recall,
|
|
71322
|
+
var knowledge_recall, _internals37;
|
|
71172
71323
|
var init_knowledge_recall = __esm(() => {
|
|
71173
71324
|
init_zod();
|
|
71174
71325
|
init_knowledge_store();
|
|
@@ -71254,7 +71405,7 @@ var init_knowledge_recall = __esm(() => {
|
|
|
71254
71405
|
return JSON.stringify(result);
|
|
71255
71406
|
}
|
|
71256
71407
|
});
|
|
71257
|
-
|
|
71408
|
+
_internals37 = {
|
|
71258
71409
|
knowledge_recall
|
|
71259
71410
|
};
|
|
71260
71411
|
});
|
|
@@ -71309,7 +71460,7 @@ __export(exports_curator_drift, {
|
|
|
71309
71460
|
runDeterministicDriftCheck: () => runDeterministicDriftCheck,
|
|
71310
71461
|
readPriorDriftReports: () => readPriorDriftReports,
|
|
71311
71462
|
buildDriftInjectionText: () => buildDriftInjectionText,
|
|
71312
|
-
_internals: () =>
|
|
71463
|
+
_internals: () => _internals39
|
|
71313
71464
|
});
|
|
71314
71465
|
import * as fs60 from "node:fs";
|
|
71315
71466
|
import * as path85 from "node:path";
|
|
@@ -71354,7 +71505,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
71354
71505
|
try {
|
|
71355
71506
|
const planMd = await readSwarmFileAsync(directory, "plan.md");
|
|
71356
71507
|
const specMd = await readSwarmFileAsync(directory, "spec.md");
|
|
71357
|
-
const priorReports = await
|
|
71508
|
+
const priorReports = await _internals39.readPriorDriftReports(directory);
|
|
71358
71509
|
const complianceCount = curatorResult.compliance.length;
|
|
71359
71510
|
const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
|
|
71360
71511
|
let alignment = "ALIGNED";
|
|
@@ -71403,7 +71554,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
71403
71554
|
scope_additions: [],
|
|
71404
71555
|
injection_summary: injectionSummary
|
|
71405
71556
|
};
|
|
71406
|
-
const reportPath = await
|
|
71557
|
+
const reportPath = await _internals39.writeDriftReport(directory, report);
|
|
71407
71558
|
getGlobalEventBus().publish("curator.drift.completed", {
|
|
71408
71559
|
phase,
|
|
71409
71560
|
alignment,
|
|
@@ -71466,12 +71617,12 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
71466
71617
|
}
|
|
71467
71618
|
return text.slice(0, maxChars);
|
|
71468
71619
|
}
|
|
71469
|
-
var DRIFT_REPORT_PREFIX = "drift-report-phase-",
|
|
71620
|
+
var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals39;
|
|
71470
71621
|
var init_curator_drift = __esm(() => {
|
|
71471
71622
|
init_event_bus();
|
|
71472
71623
|
init_logger();
|
|
71473
71624
|
init_utils2();
|
|
71474
|
-
|
|
71625
|
+
_internals39 = {
|
|
71475
71626
|
readPriorDriftReports,
|
|
71476
71627
|
writeDriftReport,
|
|
71477
71628
|
runDeterministicDriftCheck,
|
|
@@ -71483,7 +71634,7 @@ var init_curator_drift = __esm(() => {
|
|
|
71483
71634
|
var exports_project_context = {};
|
|
71484
71635
|
__export(exports_project_context, {
|
|
71485
71636
|
buildProjectContext: () => buildProjectContext,
|
|
71486
|
-
_internals: () =>
|
|
71637
|
+
_internals: () => _internals52,
|
|
71487
71638
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
71488
71639
|
});
|
|
71489
71640
|
import * as fs110 from "node:fs";
|
|
@@ -71567,7 +71718,7 @@ function selectLintCommand(backend, directory) {
|
|
|
71567
71718
|
return null;
|
|
71568
71719
|
}
|
|
71569
71720
|
async function buildProjectContext(directory) {
|
|
71570
|
-
const backend = await
|
|
71721
|
+
const backend = await _internals52.pickBackend(directory);
|
|
71571
71722
|
if (!backend)
|
|
71572
71723
|
return null;
|
|
71573
71724
|
const ctx = emptyProjectContext();
|
|
@@ -71598,16 +71749,16 @@ async function buildProjectContext(directory) {
|
|
|
71598
71749
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
71599
71750
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
71600
71751
|
}
|
|
71601
|
-
const profiles =
|
|
71752
|
+
const profiles = _internals52.pickedProfiles(directory);
|
|
71602
71753
|
if (profiles.length > 1) {
|
|
71603
71754
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
71604
71755
|
}
|
|
71605
71756
|
return ctx;
|
|
71606
71757
|
}
|
|
71607
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
71758
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals52;
|
|
71608
71759
|
var init_project_context = __esm(() => {
|
|
71609
71760
|
init_dispatch();
|
|
71610
|
-
|
|
71761
|
+
_internals52 = {
|
|
71611
71762
|
pickBackend,
|
|
71612
71763
|
pickedProfiles
|
|
71613
71764
|
};
|
|
@@ -72173,7 +72324,7 @@ async function writeFullAutoOversightEvidence(directory, phase, event) {
|
|
|
72173
72324
|
}
|
|
72174
72325
|
}
|
|
72175
72326
|
async function dispatchFullAutoOversight(input) {
|
|
72176
|
-
const client =
|
|
72327
|
+
const client = _internals11.swarmState.opencodeClient;
|
|
72177
72328
|
const sequence = nextFullAutoOversightSequence(input.directory);
|
|
72178
72329
|
oversightSequenceCounter = sequence;
|
|
72179
72330
|
const beforeStatus = loadFullAutoRunState(input.directory, input.sessionID)?.status;
|
|
@@ -73811,7 +73962,7 @@ Critic reasoning: ${criticResult.reasoning}`
|
|
|
73811
73962
|
}
|
|
73812
73963
|
}
|
|
73813
73964
|
async function dispatchCriticAndWriteEvent(directory, architectOutput, criticContext, criticModel, escalationType, interactionCount, deadlockCount, oversightAgentName, sessionID) {
|
|
73814
|
-
const client =
|
|
73965
|
+
const client = _internals11.swarmState.opencodeClient;
|
|
73815
73966
|
if (!client) {
|
|
73816
73967
|
warn("[full-auto-intercept] No opencodeClient — critic dispatch skipped (fallback to PENDING)");
|
|
73817
73968
|
const result = {
|
|
@@ -73944,11 +74095,11 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
73944
74095
|
if (!architectText)
|
|
73945
74096
|
return;
|
|
73946
74097
|
const sessionID = architectMessage.info?.sessionID;
|
|
73947
|
-
if (!
|
|
74098
|
+
if (!_internals11.hasActiveFullAuto(sessionID))
|
|
73948
74099
|
return;
|
|
73949
74100
|
let session = null;
|
|
73950
74101
|
if (sessionID) {
|
|
73951
|
-
session =
|
|
74102
|
+
session = _internals11.ensureAgentSession(sessionID);
|
|
73952
74103
|
}
|
|
73953
74104
|
if (session) {
|
|
73954
74105
|
const interactionCount = session.fullAutoInteractionCount ?? 0;
|
|
@@ -82043,10 +82194,10 @@ async function getRunMemorySummary(directory) {
|
|
|
82043
82194
|
if (entries.length === 0) {
|
|
82044
82195
|
return null;
|
|
82045
82196
|
}
|
|
82046
|
-
const groups =
|
|
82197
|
+
const groups = _internals38.groupByTaskId(entries);
|
|
82047
82198
|
const summaries = [];
|
|
82048
82199
|
for (const [taskId, taskEntries] of groups) {
|
|
82049
|
-
const summary =
|
|
82200
|
+
const summary = _internals38.summarizeTask(taskId, taskEntries);
|
|
82050
82201
|
if (summary) {
|
|
82051
82202
|
summaries.push(summary);
|
|
82052
82203
|
}
|
|
@@ -82079,7 +82230,7 @@ Use this data to avoid repeating known failure patterns.`;
|
|
|
82079
82230
|
}
|
|
82080
82231
|
return prefix + summaryText + suffix;
|
|
82081
82232
|
}
|
|
82082
|
-
var
|
|
82233
|
+
var _internals38 = {
|
|
82083
82234
|
generateTaskFingerprint,
|
|
82084
82235
|
recordOutcome,
|
|
82085
82236
|
getTaskHistory,
|
|
@@ -89592,7 +89743,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
89592
89743
|
}
|
|
89593
89744
|
return laneIds;
|
|
89594
89745
|
}
|
|
89595
|
-
var
|
|
89746
|
+
var _internals40 = {
|
|
89596
89747
|
listActiveLocks,
|
|
89597
89748
|
readPersisted: readPersisted2,
|
|
89598
89749
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -89653,7 +89804,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89653
89804
|
reason: "Lean Turbo state unreadable or missing"
|
|
89654
89805
|
};
|
|
89655
89806
|
}
|
|
89656
|
-
const persisted =
|
|
89807
|
+
const persisted = _internals40.readPersisted(directory);
|
|
89657
89808
|
if (!persisted) {
|
|
89658
89809
|
return {
|
|
89659
89810
|
ok: false,
|
|
@@ -89717,7 +89868,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89717
89868
|
}
|
|
89718
89869
|
}
|
|
89719
89870
|
if (runState.lanes.length > 0) {
|
|
89720
|
-
const evidenceLaneIds = new Set(
|
|
89871
|
+
const evidenceLaneIds = new Set(_internals40.listLaneEvidenceSync(directory, phase));
|
|
89721
89872
|
for (const lane of runState.lanes) {
|
|
89722
89873
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
89723
89874
|
return {
|
|
@@ -89727,7 +89878,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89727
89878
|
}
|
|
89728
89879
|
}
|
|
89729
89880
|
}
|
|
89730
|
-
const activeLocks =
|
|
89881
|
+
const activeLocks = _internals40.listActiveLocks(directory);
|
|
89731
89882
|
const phaseLaneIds = new Set(laneIds);
|
|
89732
89883
|
for (const lock of activeLocks) {
|
|
89733
89884
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -89747,7 +89898,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89747
89898
|
}
|
|
89748
89899
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
89749
89900
|
if (serialDegradedTasks.length > 0) {
|
|
89750
|
-
const plan =
|
|
89901
|
+
const plan = _internals40.readPlanJson(directory);
|
|
89751
89902
|
if (!plan) {
|
|
89752
89903
|
return {
|
|
89753
89904
|
ok: false,
|
|
@@ -89791,7 +89942,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89791
89942
|
}
|
|
89792
89943
|
const serializedTasks = runState.serializedTasks;
|
|
89793
89944
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
89794
|
-
const plan =
|
|
89945
|
+
const plan = _internals40.readPlanJson(directory);
|
|
89795
89946
|
if (!plan) {
|
|
89796
89947
|
return {
|
|
89797
89948
|
ok: false,
|
|
@@ -89850,7 +90001,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89850
90001
|
}
|
|
89851
90002
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
89852
90003
|
if (!reviewerVerdict) {
|
|
89853
|
-
const evidence =
|
|
90004
|
+
const evidence = _internals40.readReviewerEvidence(directory, phase);
|
|
89854
90005
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
89855
90006
|
}
|
|
89856
90007
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -89863,7 +90014,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
89863
90014
|
}
|
|
89864
90015
|
let criticVerdict = runState.lastCriticVerdict;
|
|
89865
90016
|
if (!criticVerdict) {
|
|
89866
|
-
const evidence =
|
|
90017
|
+
const evidence = _internals40.readCriticEvidence(directory, phase);
|
|
89867
90018
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
89868
90019
|
}
|
|
89869
90020
|
if (mergedConfig.phase_critic) {
|
|
@@ -90766,7 +90917,7 @@ Advisory notes: ${advisoryNotes.join("; ")}` : "";
|
|
|
90766
90917
|
phase_critic: leanConfig.phase_critic,
|
|
90767
90918
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
90768
90919
|
} : undefined;
|
|
90769
|
-
const leanCheck =
|
|
90920
|
+
const leanCheck = _internals40.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
90770
90921
|
if (!leanCheck.ok) {
|
|
90771
90922
|
return JSON.stringify({
|
|
90772
90923
|
success: false,
|
|
@@ -92954,11 +93105,11 @@ var quality_budget = createSwarmTool({
|
|
|
92954
93105
|
}).optional().describe("Quality budget thresholds")
|
|
92955
93106
|
},
|
|
92956
93107
|
async execute(args2, directory) {
|
|
92957
|
-
const result = await
|
|
93108
|
+
const result = await _internals41.qualityBudget(args2, directory);
|
|
92958
93109
|
return JSON.stringify(result);
|
|
92959
93110
|
}
|
|
92960
93111
|
});
|
|
92961
|
-
var
|
|
93112
|
+
var _internals41 = {
|
|
92962
93113
|
qualityBudget
|
|
92963
93114
|
};
|
|
92964
93115
|
|
|
@@ -93687,7 +93838,7 @@ import * as path110 from "node:path";
|
|
|
93687
93838
|
var semgrepAvailableCache = null;
|
|
93688
93839
|
var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
93689
93840
|
var DEFAULT_TIMEOUT_MS3 = 30000;
|
|
93690
|
-
var
|
|
93841
|
+
var _internals42 = {
|
|
93691
93842
|
isSemgrepAvailable,
|
|
93692
93843
|
checkSemgrepAvailable,
|
|
93693
93844
|
resetSemgrepCache,
|
|
@@ -93712,7 +93863,7 @@ function isSemgrepAvailable() {
|
|
|
93712
93863
|
}
|
|
93713
93864
|
}
|
|
93714
93865
|
async function checkSemgrepAvailable() {
|
|
93715
|
-
return
|
|
93866
|
+
return _internals42.isSemgrepAvailable();
|
|
93716
93867
|
}
|
|
93717
93868
|
function resetSemgrepCache() {
|
|
93718
93869
|
semgrepAvailableCache = null;
|
|
@@ -93809,12 +93960,12 @@ async function runSemgrep(options) {
|
|
|
93809
93960
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS3;
|
|
93810
93961
|
if (files.length === 0) {
|
|
93811
93962
|
return {
|
|
93812
|
-
available:
|
|
93963
|
+
available: _internals42.isSemgrepAvailable(),
|
|
93813
93964
|
findings: [],
|
|
93814
93965
|
engine: "tier_a"
|
|
93815
93966
|
};
|
|
93816
93967
|
}
|
|
93817
|
-
if (!
|
|
93968
|
+
if (!_internals42.isSemgrepAvailable()) {
|
|
93818
93969
|
return {
|
|
93819
93970
|
available: false,
|
|
93820
93971
|
findings: [],
|
|
@@ -93973,7 +94124,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
93973
94124
|
}
|
|
93974
94125
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
93975
94126
|
countMap.set(baseKey, occIdx + 1);
|
|
93976
|
-
const fp =
|
|
94127
|
+
const fp = _internals43.fingerprintFinding(finding, directory, occIdx);
|
|
93977
94128
|
return {
|
|
93978
94129
|
finding,
|
|
93979
94130
|
index: occIdx,
|
|
@@ -94042,7 +94193,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
94042
94193
|
}
|
|
94043
94194
|
} catch {}
|
|
94044
94195
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
94045
|
-
const indexed =
|
|
94196
|
+
const indexed = _internals43.assignOccurrenceIndices(findings, directory);
|
|
94046
94197
|
if (existing && !opts?.force) {
|
|
94047
94198
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
94048
94199
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -94182,7 +94333,7 @@ function loadBaseline(directory, phase) {
|
|
|
94182
94333
|
};
|
|
94183
94334
|
}
|
|
94184
94335
|
}
|
|
94185
|
-
var
|
|
94336
|
+
var _internals43 = {
|
|
94186
94337
|
fingerprintFinding,
|
|
94187
94338
|
assignOccurrenceIndices,
|
|
94188
94339
|
captureOrMergeBaseline,
|
|
@@ -94592,11 +94743,11 @@ var sast_scan = createSwarmTool({
|
|
|
94592
94743
|
capture_baseline: safeArgs.capture_baseline,
|
|
94593
94744
|
phase: safeArgs.phase
|
|
94594
94745
|
};
|
|
94595
|
-
const result = await
|
|
94746
|
+
const result = await _internals44.sastScan(input, directory);
|
|
94596
94747
|
return JSON.stringify(result, null, 2);
|
|
94597
94748
|
}
|
|
94598
94749
|
});
|
|
94599
|
-
var
|
|
94750
|
+
var _internals44 = {
|
|
94600
94751
|
sastScan,
|
|
94601
94752
|
sast_scan
|
|
94602
94753
|
};
|
|
@@ -99920,7 +100071,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
|
|
|
99920
100071
|
}
|
|
99921
100072
|
async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
|
|
99922
100073
|
const lanes = await listLaneEvidence(directory, phase);
|
|
99923
|
-
const persisted =
|
|
100074
|
+
const persisted = _internals45.readPersisted?.(directory) ?? null;
|
|
99924
100075
|
if (persisted) {
|
|
99925
100076
|
let matchingRunState = null;
|
|
99926
100077
|
for (const sessionState of Object.values(persisted.sessions)) {
|
|
@@ -100112,7 +100263,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
|
|
|
100112
100263
|
client.session.delete({ path: { id: sessionId } }).catch(() => {});
|
|
100113
100264
|
}
|
|
100114
100265
|
}
|
|
100115
|
-
var
|
|
100266
|
+
var _internals45 = {
|
|
100116
100267
|
compileReviewPackage,
|
|
100117
100268
|
parseReviewerVerdict,
|
|
100118
100269
|
writeReviewerEvidence,
|
|
@@ -100129,28 +100280,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
|
|
|
100129
100280
|
};
|
|
100130
100281
|
const generatedAgentNames = swarmState.generatedAgentNames;
|
|
100131
100282
|
const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
|
|
100132
|
-
const pkg = await
|
|
100283
|
+
const pkg = await _internals45.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
|
|
100133
100284
|
let responseText;
|
|
100134
100285
|
try {
|
|
100135
|
-
responseText = await
|
|
100286
|
+
responseText = await _internals45.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
|
|
100136
100287
|
} catch (error93) {
|
|
100137
|
-
const evidencePath2 = await
|
|
100288
|
+
const evidencePath2 = await _internals45.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
|
|
100138
100289
|
return {
|
|
100139
100290
|
verdict: "REJECTED",
|
|
100140
100291
|
reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
|
|
100141
100292
|
evidencePath: evidencePath2
|
|
100142
100293
|
};
|
|
100143
100294
|
}
|
|
100144
|
-
const parsed =
|
|
100295
|
+
const parsed = _internals45.parseReviewerVerdict(responseText);
|
|
100145
100296
|
if (!parsed) {
|
|
100146
|
-
const evidencePath2 = await
|
|
100297
|
+
const evidencePath2 = await _internals45.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
|
|
100147
100298
|
return {
|
|
100148
100299
|
verdict: "REJECTED",
|
|
100149
100300
|
reason: "Reviewer response could not be parsed",
|
|
100150
100301
|
evidencePath: evidencePath2
|
|
100151
100302
|
};
|
|
100152
100303
|
}
|
|
100153
|
-
const evidencePath = await
|
|
100304
|
+
const evidencePath = await _internals45.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
|
|
100154
100305
|
return {
|
|
100155
100306
|
verdict: parsed.verdict,
|
|
100156
100307
|
reason: parsed.reason,
|
|
@@ -100656,7 +100807,7 @@ ${fileList}
|
|
|
100656
100807
|
|
|
100657
100808
|
// src/tools/lean-turbo-run-phase.ts
|
|
100658
100809
|
init_create_tool();
|
|
100659
|
-
var
|
|
100810
|
+
var _internals46 = {
|
|
100660
100811
|
LeanTurboRunner,
|
|
100661
100812
|
loadPluginConfigWithMeta
|
|
100662
100813
|
};
|
|
@@ -100666,9 +100817,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
100666
100817
|
let runError = null;
|
|
100667
100818
|
let runner = null;
|
|
100668
100819
|
try {
|
|
100669
|
-
const { config: config3 } =
|
|
100820
|
+
const { config: config3 } = _internals46.loadPluginConfigWithMeta(directory);
|
|
100670
100821
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
100671
|
-
runner = new
|
|
100822
|
+
runner = new _internals46.LeanTurboRunner({
|
|
100672
100823
|
directory,
|
|
100673
100824
|
sessionID,
|
|
100674
100825
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -101022,7 +101173,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
101022
101173
|
const strippedMutated = stripCode(mutatedCode);
|
|
101023
101174
|
return strippedOriginal === strippedMutated;
|
|
101024
101175
|
}
|
|
101025
|
-
var
|
|
101176
|
+
var _internals47 = {
|
|
101026
101177
|
isStaticallyEquivalent,
|
|
101027
101178
|
checkEquivalence,
|
|
101028
101179
|
batchCheckEquivalence
|
|
@@ -101062,7 +101213,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
101062
101213
|
const results = [];
|
|
101063
101214
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
101064
101215
|
try {
|
|
101065
|
-
const result = await
|
|
101216
|
+
const result = await _internals47.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
101066
101217
|
results.push(result);
|
|
101067
101218
|
} catch (err3) {
|
|
101068
101219
|
results.push({
|
|
@@ -101362,7 +101513,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
101362
101513
|
}
|
|
101363
101514
|
|
|
101364
101515
|
// src/mutation/gate.ts
|
|
101365
|
-
var
|
|
101516
|
+
var _internals48 = {
|
|
101366
101517
|
evaluateMutationGate,
|
|
101367
101518
|
buildTestImprovementPrompt,
|
|
101368
101519
|
buildMessage
|
|
@@ -101383,8 +101534,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
101383
101534
|
} else {
|
|
101384
101535
|
verdict = "fail";
|
|
101385
101536
|
}
|
|
101386
|
-
const testImprovementPrompt =
|
|
101387
|
-
const message =
|
|
101537
|
+
const testImprovementPrompt = _internals48.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
101538
|
+
const message = _internals48.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
101388
101539
|
return {
|
|
101389
101540
|
verdict,
|
|
101390
101541
|
killRate: report.killRate,
|
|
@@ -102001,7 +102152,7 @@ import * as path132 from "node:path";
|
|
|
102001
102152
|
init_bun_compat();
|
|
102002
102153
|
import * as fs102 from "node:fs";
|
|
102003
102154
|
import * as path131 from "node:path";
|
|
102004
|
-
var
|
|
102155
|
+
var _internals49 = { bunSpawn };
|
|
102005
102156
|
var _swarmGitExcludedChecked = false;
|
|
102006
102157
|
function fileCoversSwarm(content) {
|
|
102007
102158
|
for (const rawLine of content.split(`
|
|
@@ -102034,7 +102185,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102034
102185
|
checkIgnoreExitCode
|
|
102035
102186
|
] = await Promise.all([
|
|
102036
102187
|
(async () => {
|
|
102037
|
-
const proc =
|
|
102188
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
102038
102189
|
try {
|
|
102039
102190
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
102040
102191
|
} finally {
|
|
@@ -102044,7 +102195,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102044
102195
|
}
|
|
102045
102196
|
})(),
|
|
102046
102197
|
(async () => {
|
|
102047
|
-
const proc =
|
|
102198
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
102048
102199
|
try {
|
|
102049
102200
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
102050
102201
|
} finally {
|
|
@@ -102054,7 +102205,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102054
102205
|
}
|
|
102055
102206
|
})(),
|
|
102056
102207
|
(async () => {
|
|
102057
|
-
const proc =
|
|
102208
|
+
const proc = _internals49.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
102058
102209
|
try {
|
|
102059
102210
|
return await proc.exited;
|
|
102060
102211
|
} finally {
|
|
@@ -102093,7 +102244,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102093
102244
|
}
|
|
102094
102245
|
} catch {}
|
|
102095
102246
|
}
|
|
102096
|
-
const trackedProc =
|
|
102247
|
+
const trackedProc = _internals49.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
102097
102248
|
let trackedExitCode;
|
|
102098
102249
|
let trackedOutput;
|
|
102099
102250
|
try {
|
|
@@ -102118,7 +102269,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
102118
102269
|
}
|
|
102119
102270
|
|
|
102120
102271
|
// src/hooks/diff-scope.ts
|
|
102121
|
-
var
|
|
102272
|
+
var _internals50 = { bunSpawn };
|
|
102122
102273
|
function getDeclaredScope(taskId, directory) {
|
|
102123
102274
|
try {
|
|
102124
102275
|
const planPath = path132.join(directory, ".swarm", "plan.json");
|
|
@@ -102153,7 +102304,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
102153
102304
|
};
|
|
102154
102305
|
async function getChangedFiles(directory) {
|
|
102155
102306
|
try {
|
|
102156
|
-
const proc =
|
|
102307
|
+
const proc = _internals50.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
102157
102308
|
cwd: directory,
|
|
102158
102309
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
102159
102310
|
});
|
|
@@ -102170,7 +102321,7 @@ async function getChangedFiles(directory) {
|
|
|
102170
102321
|
return stdout.trim().split(`
|
|
102171
102322
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
102172
102323
|
}
|
|
102173
|
-
const proc2 =
|
|
102324
|
+
const proc2 = _internals50.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
102174
102325
|
cwd: directory,
|
|
102175
102326
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
102176
102327
|
});
|
|
@@ -102228,7 +102379,7 @@ init_telemetry();
|
|
|
102228
102379
|
init_file_locks();
|
|
102229
102380
|
import * as fs104 from "node:fs";
|
|
102230
102381
|
import * as path133 from "node:path";
|
|
102231
|
-
var
|
|
102382
|
+
var _internals51 = {
|
|
102232
102383
|
listActiveLocks,
|
|
102233
102384
|
verifyLeanTurboTaskCompletion
|
|
102234
102385
|
};
|
|
@@ -102370,7 +102521,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
102370
102521
|
}
|
|
102371
102522
|
};
|
|
102372
102523
|
}
|
|
102373
|
-
const activeLocks =
|
|
102524
|
+
const activeLocks = _internals51.listActiveLocks(directory);
|
|
102374
102525
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
102375
102526
|
if (laneLocks.length > 0) {
|
|
102376
102527
|
return {
|