opencode-swarm 7.59.1 → 7.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/skills/brainstorm/SKILL.md +28 -17
- package/.opencode/skills/council/SKILL.md +3 -2
- package/.opencode/skills/execute/SKILL.md +12 -0
- package/.opencode/skills/phase-wrap/SKILL.md +12 -3
- package/.opencode/skills/plan/SKILL.md +9 -7
- package/.opencode/skills/specify/SKILL.md +17 -41
- package/dist/cli/index.js +320 -229
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/constants.d.ts +2 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +37 -0
- package/dist/council/types.d.ts +8 -2
- package/dist/db/qa-gate-profile.d.ts +8 -5
- package/dist/hooks/delegation-gate.d.ts +9 -0
- package/dist/index.js +3172 -2676
- package/dist/state.d.ts +3 -3
- package/dist/tools/convene-council.d.ts +1 -0
- package/dist/tools/phase-complete/gates/phase-council-gate.d.ts +1 -1
- package/dist/tools/set-qa-gates.d.ts +1 -1
- package/dist/tools/submit-phase-council-verdicts.d.ts +1 -0
- package/dist/tools/update-task-status.d.ts +8 -5
- package/dist/tools/write-final-council-evidence.d.ts +1 -0
- package/dist/turbo/lean/merge-back.d.ts +4 -179
- package/dist/turbo/lean/worktree.d.ts +5 -191
- package/dist/worktree/core.d.ts +194 -0
- package/dist/worktree/index.d.ts +5 -0
- package/dist/worktree/merge.d.ts +183 -0
- package/dist/worktree/types.d.ts +46 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "opencode-swarm",
|
|
55
|
-
version: "7.
|
|
55
|
+
version: "7.61.0",
|
|
56
56
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
57
57
|
main: "dist/index.js",
|
|
58
58
|
types: "dist/index.d.ts",
|
|
@@ -17046,11 +17046,11 @@ var init_tool_metadata = __esm(() => {
|
|
|
17046
17046
|
]
|
|
17047
17047
|
},
|
|
17048
17048
|
get_qa_gate_profile: {
|
|
17049
|
-
description: "retrieve the QA gate profile for the current plan: gates (reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test,
|
|
17049
|
+
description: "retrieve the QA gate profile for the current plan: gates (reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council), lock state, and profile hash. Read-only.",
|
|
17050
17050
|
agents: ["architect"]
|
|
17051
17051
|
},
|
|
17052
17052
|
set_qa_gates: {
|
|
17053
|
-
description: "configure the QA gate profile for the current plan. Architect-only. Ratchet-tighter only \u2014 rejected once the profile is locked after critic approval. Supports: reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test,
|
|
17053
|
+
description: "configure the QA gate profile for the current plan. Architect-only. Ratchet-tighter only \u2014 rejected once the profile is locked after critic approval. Supports: reviewer, test_engineer, sme_enabled, critic_pre_plan, sast_enabled, council_mode, hallucination_guard, mutation_test, phase_council, drift_check, final_council.",
|
|
17054
17054
|
agents: ["architect"]
|
|
17055
17055
|
},
|
|
17056
17056
|
web_search: {
|
|
@@ -17455,7 +17455,7 @@ function getCanonicalAgentRole(agentName, generatedAgentNames) {
|
|
|
17455
17455
|
function stripKnownSwarmPrefix(agentName) {
|
|
17456
17456
|
return getCanonicalAgentRole(agentName);
|
|
17457
17457
|
}
|
|
17458
|
-
var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
|
|
17458
|
+
var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
|
|
17459
17459
|
var init_schema = __esm(() => {
|
|
17460
17460
|
init_zod();
|
|
17461
17461
|
init_constants();
|
|
@@ -18122,7 +18122,7 @@ var init_schema = __esm(() => {
|
|
|
18122
18122
|
requireAllMembers: exports_external.boolean().default(false).describe("When true, submit_council_verdicts rejects if fewer than 5 member verdicts are provided. Equivalent to minimumMembers: 5."),
|
|
18123
18123
|
minimumMembers: exports_external.number().int().min(1).max(5).default(3).describe("Minimum distinct council member verdicts required for synthesis. Default 3. Set to 1 to disable quorum enforcement. requireAllMembers: true overrides this to 5 (stricter constraint wins)."),
|
|
18124
18124
|
escalateOnMaxRounds: exports_external.string().optional().describe("Optional webhook URL or handler name invoked when maxRounds is reached without APPROVE. Declared for forward compatibility; no behavior is implemented yet."),
|
|
18125
|
-
phaseConcernsAllowComplete: exports_external.boolean().default(true).describe("When true, a phase-level council CONCERNS verdict does NOT block phase completion \u2014 the advisory notes are logged as warnings and the phase proceeds. When false, CONCERNS blocks like REJECT.
|
|
18125
|
+
phaseConcernsAllowComplete: exports_external.boolean().default(true).describe("When true, a phase-level council CONCERNS verdict with only MEDIUM/LOW findings does NOT block phase completion \u2014 the advisory notes are logged as warnings and the phase proceeds. When false, CONCERNS blocks like REJECT. Note: HIGH/CRITICAL findings from CONCERNS members are always promoted to requiredFixes and block at the tool level regardless of this setting. Default: true."),
|
|
18126
18126
|
general: GeneralCouncilConfigSchema.optional()
|
|
18127
18127
|
}).strict();
|
|
18128
18128
|
ParallelizationConfigSchema = exports_external.object({
|
|
@@ -18132,6 +18132,12 @@ var init_schema = __esm(() => {
|
|
|
18132
18132
|
max_coders: exports_external.number().int().min(1).max(16).default(3),
|
|
18133
18133
|
max_reviewers: exports_external.number().int().min(1).max(16).default(2)
|
|
18134
18134
|
});
|
|
18135
|
+
WorktreeIsolationConfigSchema = exports_external.object({
|
|
18136
|
+
policy: exports_external.enum(["auto", "required", "disabled"]).default("auto"),
|
|
18137
|
+
merge_strategy: exports_external.enum(["merge", "rebase", "cherry-pick"]).default("merge"),
|
|
18138
|
+
worktree_dir: exports_external.string().optional(),
|
|
18139
|
+
deps_strategy: exports_external.enum(["skip", "copy", "link"]).default("skip")
|
|
18140
|
+
});
|
|
18135
18141
|
LeanTurboConfigSchema = exports_external.object({
|
|
18136
18142
|
max_parallel_coders: exports_external.number().int().min(1).max(6).default(4),
|
|
18137
18143
|
require_declared_scope: exports_external.boolean().default(true),
|
|
@@ -18229,6 +18235,7 @@ var init_schema = __esm(() => {
|
|
|
18229
18235
|
prm: PrmConfigSchema.optional(),
|
|
18230
18236
|
council: CouncilConfigSchema.optional(),
|
|
18231
18237
|
parallelization: ParallelizationConfigSchema.optional(),
|
|
18238
|
+
worktree: WorktreeIsolationConfigSchema.optional(),
|
|
18232
18239
|
turbo: TurboConfigSchema.optional(),
|
|
18233
18240
|
turbo_mode: exports_external.boolean().default(false).optional(),
|
|
18234
18241
|
quiet: exports_external.boolean().default(true).optional(),
|
|
@@ -21055,11 +21062,26 @@ import { createHash as createHash3 } from "crypto";
|
|
|
21055
21062
|
function rowToProfile(row) {
|
|
21056
21063
|
let parsed = {};
|
|
21057
21064
|
try {
|
|
21058
|
-
|
|
21065
|
+
const maybeGates = JSON.parse(row.gates);
|
|
21066
|
+
if (maybeGates && typeof maybeGates === "object" && !Array.isArray(maybeGates)) {
|
|
21067
|
+
parsed = maybeGates;
|
|
21068
|
+
}
|
|
21059
21069
|
} catch {
|
|
21060
21070
|
parsed = {};
|
|
21061
21071
|
}
|
|
21062
|
-
const
|
|
21072
|
+
const raw = parsed;
|
|
21073
|
+
if (raw.council_mode === true && raw.phase_council === undefined) {
|
|
21074
|
+
parsed.phase_council = true;
|
|
21075
|
+
parsed.council_mode = false;
|
|
21076
|
+
}
|
|
21077
|
+
const knownKeys = new Set(Object.keys(DEFAULT_QA_GATES));
|
|
21078
|
+
const filteredParsed = {};
|
|
21079
|
+
for (const key of Object.keys(parsed)) {
|
|
21080
|
+
if (knownKeys.has(key)) {
|
|
21081
|
+
filteredParsed[key] = parsed[key];
|
|
21082
|
+
}
|
|
21083
|
+
}
|
|
21084
|
+
const gates = { ...DEFAULT_QA_GATES, ...filteredParsed };
|
|
21063
21085
|
return {
|
|
21064
21086
|
id: row.id,
|
|
21065
21087
|
plan_id: row.plan_id,
|
|
@@ -21166,11 +21188,69 @@ var init_qa_gate_profile = __esm(() => {
|
|
|
21166
21188
|
hallucination_guard: false,
|
|
21167
21189
|
sast_enabled: true,
|
|
21168
21190
|
mutation_test: false,
|
|
21169
|
-
|
|
21191
|
+
phase_council: false,
|
|
21170
21192
|
drift_check: true,
|
|
21171
21193
|
final_council: false
|
|
21172
21194
|
};
|
|
21173
21195
|
});
|
|
21196
|
+
// src/worktree/core.ts
|
|
21197
|
+
import * as os3 from "os";
|
|
21198
|
+
async function runGit(args, cwd, timeoutMs = WORKTREE_TIMEOUT_MS) {
|
|
21199
|
+
const proc = _internals8.bunSpawn(["git", ...args], {
|
|
21200
|
+
cwd,
|
|
21201
|
+
timeout: timeoutMs,
|
|
21202
|
+
stdin: "ignore",
|
|
21203
|
+
stdout: "pipe",
|
|
21204
|
+
stderr: "pipe",
|
|
21205
|
+
env: { ...process.env, LC_ALL: "C" }
|
|
21206
|
+
});
|
|
21207
|
+
try {
|
|
21208
|
+
const exitCode = await proc.exited;
|
|
21209
|
+
const stdout = await proc.stdout.text();
|
|
21210
|
+
const stderr = await proc.stderr.text();
|
|
21211
|
+
return { exitCode, stdout, stderr };
|
|
21212
|
+
} finally {
|
|
21213
|
+
try {
|
|
21214
|
+
proc.kill();
|
|
21215
|
+
} catch {}
|
|
21216
|
+
}
|
|
21217
|
+
}
|
|
21218
|
+
var _internals8, WORKTREE_TIMEOUT_MS = 30000;
|
|
21219
|
+
var init_core3 = __esm(() => {
|
|
21220
|
+
init_bun_compat();
|
|
21221
|
+
_internals8 = {
|
|
21222
|
+
bunSpawn,
|
|
21223
|
+
platform: process.platform,
|
|
21224
|
+
sleep: (ms) => new Promise((resolve7) => setTimeout(resolve7, ms)),
|
|
21225
|
+
osTmpdir: () => os3.tmpdir(),
|
|
21226
|
+
getCoreLongPaths: async (directory) => {
|
|
21227
|
+
const result = await runGit(["config", "core.longpaths"], directory);
|
|
21228
|
+
if (result.exitCode !== 0) {
|
|
21229
|
+
return;
|
|
21230
|
+
}
|
|
21231
|
+
const value = result.stdout.trim().toLowerCase();
|
|
21232
|
+
return value === "" ? undefined : value;
|
|
21233
|
+
}
|
|
21234
|
+
};
|
|
21235
|
+
});
|
|
21236
|
+
|
|
21237
|
+
// src/worktree/merge.ts
|
|
21238
|
+
var _internals9;
|
|
21239
|
+
var init_merge = __esm(() => {
|
|
21240
|
+
init_bun_compat();
|
|
21241
|
+
init_core3();
|
|
21242
|
+
_internals9 = {
|
|
21243
|
+
bunSpawn,
|
|
21244
|
+
platform: process.platform,
|
|
21245
|
+
sleep: (ms) => new Promise((resolve7) => setTimeout(resolve7, ms))
|
|
21246
|
+
};
|
|
21247
|
+
});
|
|
21248
|
+
// src/worktree/index.ts
|
|
21249
|
+
var init_worktree = __esm(() => {
|
|
21250
|
+
init_core3();
|
|
21251
|
+
init_merge();
|
|
21252
|
+
});
|
|
21253
|
+
|
|
21174
21254
|
// node_modules/quick-lru/index.js
|
|
21175
21255
|
var QuickLRU;
|
|
21176
21256
|
var init_quick_lru = __esm(() => {
|
|
@@ -21904,15 +21984,22 @@ var init_guardrails = __esm(() => {
|
|
|
21904
21984
|
function clearPendingCoderScope() {
|
|
21905
21985
|
pendingCoderScopeByTaskId.clear();
|
|
21906
21986
|
}
|
|
21907
|
-
|
|
21987
|
+
function resetStandardWorktreeIsolationState() {
|
|
21988
|
+
standardWorktreeByCallID.clear();
|
|
21989
|
+
standardWorktreeSerializationSessions.clear();
|
|
21990
|
+
standardWorktreeMergeQueue = Promise.resolve();
|
|
21991
|
+
}
|
|
21992
|
+
var EvidenceTaskIdPlanSchema, pendingCoderScopeByTaskId, SWARM_BACKGROUND_TASK_BLOCKED_MESSAGE, ACTIVE_PARALLEL_TASK_STATES, standardWorktreeByCallID, standardWorktreeSerializationSessions, standardWorktreeMergeQueue;
|
|
21908
21993
|
var init_delegation_gate = __esm(() => {
|
|
21909
21994
|
init_zod();
|
|
21995
|
+
init_constants();
|
|
21910
21996
|
init_schema();
|
|
21911
21997
|
init_manager();
|
|
21912
21998
|
init_state();
|
|
21913
21999
|
init_telemetry();
|
|
21914
22000
|
init_logger();
|
|
21915
22001
|
init_task_id();
|
|
22002
|
+
init_worktree();
|
|
21916
22003
|
init_guardrails();
|
|
21917
22004
|
init_normalize_tool_name();
|
|
21918
22005
|
init_utils2();
|
|
@@ -21932,6 +22019,9 @@ var init_delegation_gate = __esm(() => {
|
|
|
21932
22019
|
"reviewer_run",
|
|
21933
22020
|
"tests_run"
|
|
21934
22021
|
]);
|
|
22022
|
+
standardWorktreeByCallID = new Map;
|
|
22023
|
+
standardWorktreeSerializationSessions = new Set;
|
|
22024
|
+
standardWorktreeMergeQueue = Promise.resolve();
|
|
21935
22025
|
});
|
|
21936
22026
|
|
|
21937
22027
|
// src/state/agent-run-context.ts
|
|
@@ -21976,6 +22066,7 @@ function resetSwarmState() {
|
|
|
21976
22066
|
swarmState.fullAutoEnabledInConfig = false;
|
|
21977
22067
|
swarmState.environmentProfiles.clear();
|
|
21978
22068
|
clearPendingCoderScope();
|
|
22069
|
+
resetStandardWorktreeIsolationState();
|
|
21979
22070
|
_councilDisagreementWarned.clear();
|
|
21980
22071
|
}
|
|
21981
22072
|
function getAgentSession(sessionId) {
|
|
@@ -22451,7 +22542,7 @@ function config2(newConfig) {
|
|
|
22451
22542
|
return globalConfig2;
|
|
22452
22543
|
}
|
|
22453
22544
|
var NEVER2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2;
|
|
22454
|
-
var
|
|
22545
|
+
var init_core4 = __esm(() => {
|
|
22455
22546
|
NEVER2 = Object.freeze({
|
|
22456
22547
|
status: "aborted"
|
|
22457
22548
|
});
|
|
@@ -23242,7 +23333,7 @@ var initializer3 = (inst, def) => {
|
|
|
23242
23333
|
});
|
|
23243
23334
|
}, $ZodError2, $ZodRealError2;
|
|
23244
23335
|
var init_errors4 = __esm(() => {
|
|
23245
|
-
|
|
23336
|
+
init_core4();
|
|
23246
23337
|
init_util2();
|
|
23247
23338
|
$ZodError2 = $constructor2("$ZodError", initializer3);
|
|
23248
23339
|
$ZodRealError2 = $constructor2("$ZodError", initializer3, { Parent: Error });
|
|
@@ -23313,7 +23404,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
23313
23404
|
return _safeParseAsync2(_Err)(schema, value, _ctx);
|
|
23314
23405
|
}, safeDecodeAsync3;
|
|
23315
23406
|
var init_parse3 = __esm(() => {
|
|
23316
|
-
|
|
23407
|
+
init_core4();
|
|
23317
23408
|
init_errors4();
|
|
23318
23409
|
init_util2();
|
|
23319
23410
|
parse6 = /* @__PURE__ */ _parse2($ZodRealError2);
|
|
@@ -23489,7 +23580,7 @@ function handleCheckPropertyResult2(result, payload, property) {
|
|
|
23489
23580
|
}
|
|
23490
23581
|
var $ZodCheck2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2;
|
|
23491
23582
|
var init_checks3 = __esm(() => {
|
|
23492
|
-
|
|
23583
|
+
init_core4();
|
|
23493
23584
|
init_regexes2();
|
|
23494
23585
|
init_util2();
|
|
23495
23586
|
$ZodCheck2 = /* @__PURE__ */ $constructor2("$ZodCheck", (inst, def) => {
|
|
@@ -24383,7 +24474,7 @@ function handleRefineResult2(result, payload, input, inst) {
|
|
|
24383
24474
|
var $ZodType2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, $ZodIPv62, $ZodCIDRv42, $ZodCIDRv62, $ZodBase642, $ZodBase64URL2, $ZodE1642, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2;
|
|
24384
24475
|
var init_schemas3 = __esm(() => {
|
|
24385
24476
|
init_checks3();
|
|
24386
|
-
|
|
24477
|
+
init_core4();
|
|
24387
24478
|
init_parse3();
|
|
24388
24479
|
init_regexes2();
|
|
24389
24480
|
init_util2();
|
|
@@ -32231,10 +32322,10 @@ function _property2(property, schema, params) {
|
|
|
32231
32322
|
...normalizeParams2(params)
|
|
32232
32323
|
});
|
|
32233
32324
|
}
|
|
32234
|
-
function _mime2(
|
|
32325
|
+
function _mime2(types2, params) {
|
|
32235
32326
|
return new $ZodCheckMimeType2({
|
|
32236
32327
|
check: "mime_type",
|
|
32237
|
-
mime:
|
|
32328
|
+
mime: types2,
|
|
32238
32329
|
...normalizeParams2(params)
|
|
32239
32330
|
});
|
|
32240
32331
|
}
|
|
@@ -33630,12 +33721,12 @@ __export(exports_core4, {
|
|
|
33630
33721
|
$ZodArray: () => $ZodArray2,
|
|
33631
33722
|
$ZodAny: () => $ZodAny2
|
|
33632
33723
|
});
|
|
33633
|
-
var
|
|
33724
|
+
var init_core5 = __esm(() => {
|
|
33634
33725
|
init_util2();
|
|
33635
33726
|
init_regexes2();
|
|
33636
33727
|
init_locales2();
|
|
33637
33728
|
init_json_schema2();
|
|
33638
|
-
|
|
33729
|
+
init_core4();
|
|
33639
33730
|
init_parse3();
|
|
33640
33731
|
init_errors4();
|
|
33641
33732
|
init_schemas3();
|
|
@@ -33648,7 +33739,7 @@ var init_core4 = __esm(() => {
|
|
|
33648
33739
|
|
|
33649
33740
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/checks.js
|
|
33650
33741
|
var init_checks4 = __esm(() => {
|
|
33651
|
-
|
|
33742
|
+
init_core5();
|
|
33652
33743
|
});
|
|
33653
33744
|
|
|
33654
33745
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/iso.js
|
|
@@ -33677,7 +33768,7 @@ function duration4(params) {
|
|
|
33677
33768
|
}
|
|
33678
33769
|
var ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2;
|
|
33679
33770
|
var init_iso2 = __esm(() => {
|
|
33680
|
-
|
|
33771
|
+
init_core5();
|
|
33681
33772
|
init_schemas4();
|
|
33682
33773
|
ZodISODateTime2 = /* @__PURE__ */ $constructor2("ZodISODateTime", (inst, def) => {
|
|
33683
33774
|
$ZodISODateTime2.init(inst, def);
|
|
@@ -33728,8 +33819,8 @@ var initializer4 = (inst, issues) => {
|
|
|
33728
33819
|
});
|
|
33729
33820
|
}, ZodError2, ZodRealError2;
|
|
33730
33821
|
var init_errors5 = __esm(() => {
|
|
33731
|
-
|
|
33732
|
-
|
|
33822
|
+
init_core5();
|
|
33823
|
+
init_core5();
|
|
33733
33824
|
init_util2();
|
|
33734
33825
|
ZodError2 = $constructor2("ZodError", initializer4);
|
|
33735
33826
|
ZodRealError2 = $constructor2("ZodError", initializer4, {
|
|
@@ -33740,7 +33831,7 @@ var init_errors5 = __esm(() => {
|
|
|
33740
33831
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/parse.js
|
|
33741
33832
|
var parse8, parseAsync4, safeParse4, safeParseAsync4, encode4, decode4, encodeAsync4, decodeAsync4, safeEncode4, safeDecode4, safeEncodeAsync4, safeDecodeAsync4;
|
|
33742
33833
|
var init_parse4 = __esm(() => {
|
|
33743
|
-
|
|
33834
|
+
init_core5();
|
|
33744
33835
|
init_errors5();
|
|
33745
33836
|
parse8 = /* @__PURE__ */ _parse2(ZodRealError2);
|
|
33746
33837
|
parseAsync4 = /* @__PURE__ */ _parseAsync2(ZodRealError2);
|
|
@@ -34189,8 +34280,8 @@ var ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodEmail2, ZodGUID2, Zo
|
|
|
34189
34280
|
String: ZodString2
|
|
34190
34281
|
}, ...args);
|
|
34191
34282
|
var init_schemas4 = __esm(() => {
|
|
34192
|
-
|
|
34193
|
-
|
|
34283
|
+
init_core5();
|
|
34284
|
+
init_core5();
|
|
34194
34285
|
init_checks4();
|
|
34195
34286
|
init_iso2();
|
|
34196
34287
|
init_parse4();
|
|
@@ -34626,7 +34717,7 @@ var init_schemas4 = __esm(() => {
|
|
|
34626
34717
|
ZodType2.init(inst, def);
|
|
34627
34718
|
inst.min = (size, params) => inst.check(_minSize2(size, params));
|
|
34628
34719
|
inst.max = (size, params) => inst.check(_maxSize2(size, params));
|
|
34629
|
-
inst.mime = (
|
|
34720
|
+
inst.mime = (types2, params) => inst.check(_mime2(Array.isArray(types2) ? types2 : [types2], params));
|
|
34630
34721
|
});
|
|
34631
34722
|
ZodTransform2 = /* @__PURE__ */ $constructor2("ZodTransform", (inst, def) => {
|
|
34632
34723
|
$ZodTransform2.init(inst, def);
|
|
@@ -34750,7 +34841,7 @@ function getErrorMap2() {
|
|
|
34750
34841
|
}
|
|
34751
34842
|
var ZodIssueCode2, ZodFirstPartyTypeKind2;
|
|
34752
34843
|
var init_compat2 = __esm(() => {
|
|
34753
|
-
|
|
34844
|
+
init_core5();
|
|
34754
34845
|
ZodIssueCode2 = {
|
|
34755
34846
|
invalid_type: "invalid_type",
|
|
34756
34847
|
too_big: "too_big",
|
|
@@ -34792,7 +34883,7 @@ function date8(params) {
|
|
|
34792
34883
|
return _coercedDate2(ZodDate2, params);
|
|
34793
34884
|
}
|
|
34794
34885
|
var init_coerce2 = __esm(() => {
|
|
34795
|
-
|
|
34886
|
+
init_core5();
|
|
34796
34887
|
init_schemas4();
|
|
34797
34888
|
});
|
|
34798
34889
|
|
|
@@ -35026,10 +35117,10 @@ __export(exports_external2, {
|
|
|
35026
35117
|
$brand: () => $brand2
|
|
35027
35118
|
});
|
|
35028
35119
|
var init_external2 = __esm(() => {
|
|
35029
|
-
|
|
35030
|
-
|
|
35120
|
+
init_core5();
|
|
35121
|
+
init_core5();
|
|
35031
35122
|
init_en2();
|
|
35032
|
-
|
|
35123
|
+
init_core5();
|
|
35033
35124
|
init_locales2();
|
|
35034
35125
|
init_iso2();
|
|
35035
35126
|
init_iso2();
|
|
@@ -35624,7 +35715,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
35624
35715
|
const prunedBranches = [];
|
|
35625
35716
|
try {
|
|
35626
35717
|
const currentBranch = getCurrentBranch(cwd);
|
|
35627
|
-
const defaultRemoteBranch =
|
|
35718
|
+
const defaultRemoteBranch = _internals10.detectDefaultRemoteBranch(cwd);
|
|
35628
35719
|
if (!defaultRemoteBranch) {
|
|
35629
35720
|
return {
|
|
35630
35721
|
success: false,
|
|
@@ -35806,7 +35897,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
35806
35897
|
function resetToMainAfterMerge(cwd, options) {
|
|
35807
35898
|
const warnings = [];
|
|
35808
35899
|
try {
|
|
35809
|
-
const defaultBranch =
|
|
35900
|
+
const defaultBranch = _internals10.detectDefaultRemoteBranch(cwd);
|
|
35810
35901
|
if (!defaultBranch) {
|
|
35811
35902
|
return {
|
|
35812
35903
|
success: false,
|
|
@@ -35833,7 +35924,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35833
35924
|
}
|
|
35834
35925
|
if (currentBranch === defaultBranch) {
|
|
35835
35926
|
try {
|
|
35836
|
-
const logOutput =
|
|
35927
|
+
const logOutput = _internals10.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
|
|
35837
35928
|
if (logOutput.trim().length > 0) {
|
|
35838
35929
|
return {
|
|
35839
35930
|
success: false,
|
|
@@ -35848,11 +35939,11 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35848
35939
|
} catch {}
|
|
35849
35940
|
} else {
|
|
35850
35941
|
try {
|
|
35851
|
-
|
|
35942
|
+
_internals10.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
|
|
35852
35943
|
} catch {
|
|
35853
35944
|
try {
|
|
35854
|
-
const localSha =
|
|
35855
|
-
const remoteSha =
|
|
35945
|
+
const localSha = _internals10.gitExec(["rev-parse", "HEAD"], cwd).trim();
|
|
35946
|
+
const remoteSha = _internals10.gitExec(["rev-parse", targetBranch], cwd).trim();
|
|
35856
35947
|
if (localSha !== remoteSha) {
|
|
35857
35948
|
return {
|
|
35858
35949
|
success: false,
|
|
@@ -35878,7 +35969,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35878
35969
|
}
|
|
35879
35970
|
}
|
|
35880
35971
|
try {
|
|
35881
|
-
|
|
35972
|
+
_internals10.gitExec(["fetch", "--prune", "origin"], cwd);
|
|
35882
35973
|
} catch (err) {
|
|
35883
35974
|
return {
|
|
35884
35975
|
success: false,
|
|
@@ -35894,7 +35985,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35894
35985
|
let switchedBranch = false;
|
|
35895
35986
|
if (currentBranch !== defaultBranch) {
|
|
35896
35987
|
try {
|
|
35897
|
-
|
|
35988
|
+
_internals10.gitExec(["checkout", defaultBranch], cwd);
|
|
35898
35989
|
switchedBranch = true;
|
|
35899
35990
|
} catch (err) {
|
|
35900
35991
|
return {
|
|
@@ -35909,7 +36000,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35909
36000
|
}
|
|
35910
36001
|
}
|
|
35911
36002
|
try {
|
|
35912
|
-
|
|
36003
|
+
_internals10.gitExec(["reset", "--hard", targetBranch], cwd);
|
|
35913
36004
|
} catch (err) {
|
|
35914
36005
|
return {
|
|
35915
36006
|
success: false,
|
|
@@ -35930,7 +36021,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35930
36021
|
while (Date.now() < endTime) {}
|
|
35931
36022
|
}
|
|
35932
36023
|
try {
|
|
35933
|
-
|
|
36024
|
+
_internals10.gitExec(["checkout", "--", "."], cwd);
|
|
35934
36025
|
discardSucceeded = true;
|
|
35935
36026
|
break;
|
|
35936
36027
|
} catch {}
|
|
@@ -35941,18 +36032,18 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35941
36032
|
changesDiscarded = discardSucceeded;
|
|
35942
36033
|
}
|
|
35943
36034
|
try {
|
|
35944
|
-
|
|
36035
|
+
_internals10.gitExec(["clean", "-fd"], cwd);
|
|
35945
36036
|
} catch {
|
|
35946
36037
|
warnings.push("Could not clean untracked files");
|
|
35947
36038
|
}
|
|
35948
36039
|
let branchDeleted = false;
|
|
35949
36040
|
if (switchedBranch && previousBranch !== defaultBranch) {
|
|
35950
36041
|
try {
|
|
35951
|
-
const mergedOutput =
|
|
36042
|
+
const mergedOutput = _internals10.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
35952
36043
|
const isMerged = mergedOutput.split(`
|
|
35953
36044
|
`).some((line) => line.trim() === previousBranch || line.trim() === `* ${previousBranch}`);
|
|
35954
36045
|
if (isMerged) {
|
|
35955
|
-
|
|
36046
|
+
_internals10.gitExec(["branch", "-d", previousBranch], cwd);
|
|
35956
36047
|
branchDeleted = true;
|
|
35957
36048
|
} else {
|
|
35958
36049
|
warnings.push(`Branch ${previousBranch} is not merged into ${defaultBranch} \u2014 keeping it`);
|
|
@@ -35963,7 +36054,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35963
36054
|
}
|
|
35964
36055
|
if (options?.pruneBranches) {
|
|
35965
36056
|
try {
|
|
35966
|
-
const mergedOutput =
|
|
36057
|
+
const mergedOutput = _internals10.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
35967
36058
|
const mergedLines = mergedOutput.split(`
|
|
35968
36059
|
`);
|
|
35969
36060
|
for (const line of mergedLines) {
|
|
@@ -35972,7 +36063,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
35972
36063
|
continue;
|
|
35973
36064
|
}
|
|
35974
36065
|
try {
|
|
35975
|
-
|
|
36066
|
+
_internals10.gitExec(["branch", "-d", trimmedLine], cwd);
|
|
35976
36067
|
} catch {
|
|
35977
36068
|
warnings.push(`Could not prune branch: ${trimmedLine}`);
|
|
35978
36069
|
}
|
|
@@ -36002,10 +36093,10 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
36002
36093
|
};
|
|
36003
36094
|
}
|
|
36004
36095
|
}
|
|
36005
|
-
var GIT_TIMEOUT_MS2 = 30000,
|
|
36096
|
+
var GIT_TIMEOUT_MS2 = 30000, _internals10;
|
|
36006
36097
|
var init_branch = __esm(() => {
|
|
36007
36098
|
init_logger();
|
|
36008
|
-
|
|
36099
|
+
_internals10 = {
|
|
36009
36100
|
gitExec: gitExec2,
|
|
36010
36101
|
detectDefaultRemoteBranch,
|
|
36011
36102
|
getDefaultBaseBranch,
|
|
@@ -36057,11 +36148,11 @@ class AutomationEventBus {
|
|
|
36057
36148
|
}));
|
|
36058
36149
|
}
|
|
36059
36150
|
}
|
|
36060
|
-
getHistory(
|
|
36061
|
-
if (!
|
|
36151
|
+
getHistory(types2) {
|
|
36152
|
+
if (!types2 || types2.length === 0) {
|
|
36062
36153
|
return [...this.eventHistory];
|
|
36063
36154
|
}
|
|
36064
|
-
return this.eventHistory.filter((e) =>
|
|
36155
|
+
return this.eventHistory.filter((e) => types2.includes(e.type));
|
|
36065
36156
|
}
|
|
36066
36157
|
clearHistory() {
|
|
36067
36158
|
this.eventHistory = [];
|
|
@@ -36097,18 +36188,18 @@ async function atomicWriteFile(targetPath, content) {
|
|
|
36097
36188
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
36098
36189
|
try {
|
|
36099
36190
|
await bunWrite(tempPath, content);
|
|
36100
|
-
|
|
36191
|
+
_internals11.renameSync(tempPath, targetPath);
|
|
36101
36192
|
} finally {
|
|
36102
36193
|
try {
|
|
36103
|
-
|
|
36194
|
+
_internals11.unlinkSync(tempPath);
|
|
36104
36195
|
} catch {}
|
|
36105
36196
|
}
|
|
36106
36197
|
}
|
|
36107
|
-
var
|
|
36198
|
+
var _internals11;
|
|
36108
36199
|
var init_task_file = __esm(() => {
|
|
36109
36200
|
init_bun_compat();
|
|
36110
36201
|
init_lock();
|
|
36111
|
-
|
|
36202
|
+
_internals11 = {
|
|
36112
36203
|
renameSync: renameSync5,
|
|
36113
36204
|
unlinkSync: unlinkSync4
|
|
36114
36205
|
};
|
|
@@ -36117,7 +36208,7 @@ var init_task_file = __esm(() => {
|
|
|
36117
36208
|
// src/hooks/knowledge-store.ts
|
|
36118
36209
|
import { existsSync as existsSync8 } from "fs";
|
|
36119
36210
|
import { appendFile as appendFile2, mkdir as mkdir2, readFile as readFile3 } from "fs/promises";
|
|
36120
|
-
import * as
|
|
36211
|
+
import * as os4 from "os";
|
|
36121
36212
|
import * as path12 from "path";
|
|
36122
36213
|
function resolveSwarmKnowledgePath(directory) {
|
|
36123
36214
|
return path12.join(directory, ".swarm", "knowledge.jsonl");
|
|
@@ -36130,7 +36221,7 @@ function resolveSwarmRetractionsPath(directory) {
|
|
|
36130
36221
|
}
|
|
36131
36222
|
function resolveHiveKnowledgePath() {
|
|
36132
36223
|
const platform = process.platform;
|
|
36133
|
-
const home = process.env.HOME ||
|
|
36224
|
+
const home = process.env.HOME || os4.homedir();
|
|
36134
36225
|
let dataDir;
|
|
36135
36226
|
if (platform === "win32") {
|
|
36136
36227
|
dataDir = path12.join(process.env.LOCALAPPDATA || path12.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
@@ -37304,10 +37395,10 @@ function resolveLogPath(directory) {
|
|
|
37304
37395
|
}
|
|
37305
37396
|
function readSkillUsageEntries(directory, options) {
|
|
37306
37397
|
const resolved = resolveLogPath(directory);
|
|
37307
|
-
if (!
|
|
37398
|
+
if (!_internals12.existsSync(resolved)) {
|
|
37308
37399
|
return [];
|
|
37309
37400
|
}
|
|
37310
|
-
const raw =
|
|
37401
|
+
const raw = _internals12.readFileSync(resolved, "utf-8");
|
|
37311
37402
|
const entries = [];
|
|
37312
37403
|
for (const line of raw.split(`
|
|
37313
37404
|
`)) {
|
|
@@ -37344,7 +37435,7 @@ function readSkillUsageEntries(directory, options) {
|
|
|
37344
37435
|
}
|
|
37345
37436
|
function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
37346
37437
|
const resolved = resolveLogPath(directory);
|
|
37347
|
-
if (!
|
|
37438
|
+
if (!_internals12.existsSync(resolved)) {
|
|
37348
37439
|
return { pruned: 0, remaining: 0 };
|
|
37349
37440
|
}
|
|
37350
37441
|
const allEntries = readSkillUsageEntries(directory);
|
|
@@ -37380,13 +37471,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
|
37380
37471
|
`).concat(`
|
|
37381
37472
|
`);
|
|
37382
37473
|
try {
|
|
37383
|
-
|
|
37384
|
-
|
|
37474
|
+
_internals12.writeFileSync(tmpPath, content, "utf-8");
|
|
37475
|
+
_internals12.renameSync(tmpPath, resolved);
|
|
37385
37476
|
} catch (writeErr) {
|
|
37386
37477
|
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
37387
37478
|
try {
|
|
37388
|
-
if (
|
|
37389
|
-
|
|
37479
|
+
if (_internals12.existsSync(tmpPath)) {
|
|
37480
|
+
_internals12.writeFileSync(tmpPath, "", "utf-8");
|
|
37390
37481
|
}
|
|
37391
37482
|
} catch {}
|
|
37392
37483
|
return { pruned: 0, remaining: allEntries.length, error: msg };
|
|
@@ -37408,10 +37499,10 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
|
|
|
37408
37499
|
if (!isContained) {
|
|
37409
37500
|
return [];
|
|
37410
37501
|
}
|
|
37411
|
-
if (!
|
|
37502
|
+
if (!_internals12.existsSync(absolute)) {
|
|
37412
37503
|
return [];
|
|
37413
37504
|
}
|
|
37414
|
-
const content =
|
|
37505
|
+
const content = _internals12.readFileSync(absolute, "utf-8");
|
|
37415
37506
|
return parseGeneratedFromKnowledge(content);
|
|
37416
37507
|
} catch (err) {
|
|
37417
37508
|
console.warn("[skill-usage-log] resolveSourceKnowledgeIds failed (fail-open):", err instanceof Error ? err.message : String(err));
|
|
@@ -37504,11 +37595,11 @@ async function applySkillUsageFeedback(directory, options) {
|
|
|
37504
37595
|
}
|
|
37505
37596
|
return { processed, bumps };
|
|
37506
37597
|
}
|
|
37507
|
-
var
|
|
37598
|
+
var _internals12, TAIL_BYTES_DEFAULT, SKILL_USAGE_LOG_ROTATE_BYTES, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
|
|
37508
37599
|
var init_skill_usage_log = __esm(() => {
|
|
37509
37600
|
init_knowledge_store();
|
|
37510
37601
|
init_utils2();
|
|
37511
|
-
|
|
37602
|
+
_internals12 = {
|
|
37512
37603
|
generateId: () => crypto3.randomUUID(),
|
|
37513
37604
|
appendFileSync: fs8.appendFileSync.bind(fs8),
|
|
37514
37605
|
readFileSync: fs8.readFileSync.bind(fs8),
|
|
@@ -38205,7 +38296,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
|
|
|
38205
38296
|
}
|
|
38206
38297
|
await enforceKnowledgeCap(knowledgePath, config3.swarm_max_entries);
|
|
38207
38298
|
if (!options?.skipAutoPromotion) {
|
|
38208
|
-
await
|
|
38299
|
+
await _internals13.runAutoPromotion(directory, config3);
|
|
38209
38300
|
}
|
|
38210
38301
|
return { stored, skipped, rejected };
|
|
38211
38302
|
}
|
|
@@ -38291,7 +38382,7 @@ function createKnowledgeCuratorHook(directory, config3) {
|
|
|
38291
38382
|
});
|
|
38292
38383
|
const projectName2 = evidenceData.project_name ?? "unknown";
|
|
38293
38384
|
const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
|
|
38294
|
-
await
|
|
38385
|
+
await _internals13.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
|
|
38295
38386
|
return;
|
|
38296
38387
|
}
|
|
38297
38388
|
const planContent = await readSwarmFileAsync(directory, "plan.md");
|
|
@@ -38313,18 +38404,18 @@ function createKnowledgeCuratorHook(directory, config3) {
|
|
|
38313
38404
|
const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
|
|
38314
38405
|
const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
|
|
38315
38406
|
const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
|
|
38316
|
-
await
|
|
38407
|
+
await _internals13.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
|
|
38317
38408
|
};
|
|
38318
38409
|
return safeHook(handler);
|
|
38319
38410
|
}
|
|
38320
|
-
var seenRetroSections, OUTCOME_PROMOTION_BLOCK = -0.3,
|
|
38411
|
+
var seenRetroSections, OUTCOME_PROMOTION_BLOCK = -0.3, _internals13;
|
|
38321
38412
|
var init_knowledge_curator = __esm(() => {
|
|
38322
38413
|
init_knowledge_events();
|
|
38323
38414
|
init_knowledge_store();
|
|
38324
38415
|
init_knowledge_validator();
|
|
38325
38416
|
init_utils2();
|
|
38326
38417
|
seenRetroSections = new Map;
|
|
38327
|
-
|
|
38418
|
+
_internals13 = {
|
|
38328
38419
|
isWriteToEvidenceFile,
|
|
38329
38420
|
curateAndStoreSwarm,
|
|
38330
38421
|
runAutoPromotion,
|
|
@@ -39258,7 +39349,7 @@ async function executeWriteRetro(args, directory) {
|
|
|
39258
39349
|
}, null, 2);
|
|
39259
39350
|
}
|
|
39260
39351
|
}
|
|
39261
|
-
var write_retro,
|
|
39352
|
+
var write_retro, _internals14;
|
|
39262
39353
|
var init_write_retro = __esm(() => {
|
|
39263
39354
|
init_zod();
|
|
39264
39355
|
init_evidence_schema();
|
|
@@ -39305,13 +39396,13 @@ var init_write_retro = __esm(() => {
|
|
|
39305
39396
|
task_id: args.task_id !== undefined ? String(args.task_id) : undefined,
|
|
39306
39397
|
metadata: args.metadata
|
|
39307
39398
|
};
|
|
39308
|
-
return await
|
|
39399
|
+
return await _internals14.executeWriteRetro(writeRetroArgs, directory);
|
|
39309
39400
|
} catch {
|
|
39310
39401
|
return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
|
|
39311
39402
|
}
|
|
39312
39403
|
}
|
|
39313
39404
|
});
|
|
39314
|
-
|
|
39405
|
+
_internals14 = {
|
|
39315
39406
|
executeWriteRetro,
|
|
39316
39407
|
write_retro
|
|
39317
39408
|
};
|
|
@@ -40201,10 +40292,10 @@ var init_concurrency = __esm(() => {
|
|
|
40201
40292
|
});
|
|
40202
40293
|
|
|
40203
40294
|
// src/commands/config.ts
|
|
40204
|
-
import * as
|
|
40295
|
+
import * as os5 from "os";
|
|
40205
40296
|
import * as path21 from "path";
|
|
40206
40297
|
function getUserConfigDir2() {
|
|
40207
|
-
return process.env.XDG_CONFIG_HOME || path21.join(
|
|
40298
|
+
return process.env.XDG_CONFIG_HOME || path21.join(os5.homedir(), ".config");
|
|
40208
40299
|
}
|
|
40209
40300
|
async function handleConfigCommand(directory, _args) {
|
|
40210
40301
|
const config3 = loadPluginConfig(directory);
|
|
@@ -40557,9 +40648,9 @@ async function detectDarkMatter(directory, options) {
|
|
|
40557
40648
|
} catch {
|
|
40558
40649
|
return [];
|
|
40559
40650
|
}
|
|
40560
|
-
const commitMap = await
|
|
40561
|
-
const matrix =
|
|
40562
|
-
const staticEdges = await
|
|
40651
|
+
const commitMap = await _internals15.parseGitLog(directory, maxCommitsToAnalyze);
|
|
40652
|
+
const matrix = _internals15.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
|
|
40653
|
+
const staticEdges = await _internals15.getStaticEdges(directory);
|
|
40563
40654
|
const results = [];
|
|
40564
40655
|
for (const entry of matrix.values()) {
|
|
40565
40656
|
const key = `${entry.fileA}::${entry.fileB}`;
|
|
@@ -40639,7 +40730,7 @@ ${rows}
|
|
|
40639
40730
|
These pairs likely share an architectural concern invisible to static analysis.
|
|
40640
40731
|
Consider adding explicit documentation or extracting the shared concern.`;
|
|
40641
40732
|
}
|
|
40642
|
-
var co_change_analyzer,
|
|
40733
|
+
var co_change_analyzer, _internals15;
|
|
40643
40734
|
var init_co_change_analyzer = __esm(() => {
|
|
40644
40735
|
init_zod();
|
|
40645
40736
|
init_create_tool();
|
|
@@ -40671,11 +40762,11 @@ var init_co_change_analyzer = __esm(() => {
|
|
|
40671
40762
|
npmiThreshold,
|
|
40672
40763
|
maxCommitsToAnalyze
|
|
40673
40764
|
};
|
|
40674
|
-
const pairs = await
|
|
40675
|
-
return
|
|
40765
|
+
const pairs = await _internals15.detectDarkMatter(directory, options);
|
|
40766
|
+
return _internals15.formatDarkMatterOutput(pairs);
|
|
40676
40767
|
}
|
|
40677
40768
|
});
|
|
40678
|
-
|
|
40769
|
+
_internals15 = {
|
|
40679
40770
|
parseGitLog,
|
|
40680
40771
|
buildCoChangeMatrix,
|
|
40681
40772
|
getStaticEdges,
|
|
@@ -40706,7 +40797,7 @@ async function handleDarkMatterCommand(directory, args) {
|
|
|
40706
40797
|
}
|
|
40707
40798
|
let pairs;
|
|
40708
40799
|
try {
|
|
40709
|
-
pairs = await
|
|
40800
|
+
pairs = await _internals15.detectDarkMatter(directory, options);
|
|
40710
40801
|
} catch (err) {
|
|
40711
40802
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
40712
40803
|
return `## Dark Matter Analysis Failed
|
|
@@ -40970,13 +41061,13 @@ var init_design_docs = __esm(() => {
|
|
|
40970
41061
|
});
|
|
40971
41062
|
|
|
40972
41063
|
// src/config/cache-paths.ts
|
|
40973
|
-
import * as
|
|
41064
|
+
import * as os6 from "os";
|
|
40974
41065
|
import * as path24 from "path";
|
|
40975
41066
|
function getPluginConfigDir() {
|
|
40976
|
-
return path24.join(process.env.XDG_CONFIG_HOME || path24.join(
|
|
41067
|
+
return path24.join(process.env.XDG_CONFIG_HOME || path24.join(os6.homedir(), ".config"), "opencode");
|
|
40977
41068
|
}
|
|
40978
41069
|
function getPluginCachePaths() {
|
|
40979
|
-
const cacheBase = process.env.XDG_CACHE_HOME || path24.join(
|
|
41070
|
+
const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os6.homedir(), ".cache");
|
|
40980
41071
|
const configDir = getPluginConfigDir();
|
|
40981
41072
|
const paths = [
|
|
40982
41073
|
path24.join(cacheBase, "opencode", "node_modules", "opencode-swarm"),
|
|
@@ -40984,18 +41075,18 @@ function getPluginCachePaths() {
|
|
|
40984
41075
|
path24.join(configDir, "node_modules", "opencode-swarm")
|
|
40985
41076
|
];
|
|
40986
41077
|
if (process.platform === "darwin") {
|
|
40987
|
-
const libCaches = path24.join(
|
|
41078
|
+
const libCaches = path24.join(os6.homedir(), "Library", "Caches");
|
|
40988
41079
|
paths.push(path24.join(libCaches, "opencode", "node_modules", "opencode-swarm"), path24.join(libCaches, "opencode", "packages", "opencode-swarm@latest"));
|
|
40989
41080
|
}
|
|
40990
41081
|
if (process.platform === "win32") {
|
|
40991
|
-
const localAppData = process.env.LOCALAPPDATA || path24.join(
|
|
40992
|
-
const appData = process.env.APPDATA || path24.join(
|
|
41082
|
+
const localAppData = process.env.LOCALAPPDATA || path24.join(os6.homedir(), "AppData", "Local");
|
|
41083
|
+
const appData = process.env.APPDATA || path24.join(os6.homedir(), "AppData", "Roaming");
|
|
40993
41084
|
paths.push(path24.join(localAppData, "opencode", "node_modules", "opencode-swarm"), path24.join(localAppData, "opencode", "packages", "opencode-swarm@latest"), path24.join(appData, "opencode", "node_modules", "opencode-swarm"));
|
|
40994
41085
|
}
|
|
40995
41086
|
return paths;
|
|
40996
41087
|
}
|
|
40997
41088
|
function getPluginLockFilePaths() {
|
|
40998
|
-
const cacheBase = process.env.XDG_CACHE_HOME || path24.join(
|
|
41089
|
+
const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os6.homedir(), ".cache");
|
|
40999
41090
|
const configDir = getPluginConfigDir();
|
|
41000
41091
|
const paths = [
|
|
41001
41092
|
path24.join(cacheBase, "opencode", "bun.lock"),
|
|
@@ -41003,11 +41094,11 @@ function getPluginLockFilePaths() {
|
|
|
41003
41094
|
path24.join(configDir, "package-lock.json")
|
|
41004
41095
|
];
|
|
41005
41096
|
if (process.platform === "darwin") {
|
|
41006
|
-
const libCaches = path24.join(
|
|
41097
|
+
const libCaches = path24.join(os6.homedir(), "Library", "Caches");
|
|
41007
41098
|
paths.push(path24.join(libCaches, "opencode", "bun.lock"), path24.join(libCaches, "opencode", "bun.lockb"));
|
|
41008
41099
|
}
|
|
41009
41100
|
if (process.platform === "win32") {
|
|
41010
|
-
const localAppData = process.env.LOCALAPPDATA || path24.join(
|
|
41101
|
+
const localAppData = process.env.LOCALAPPDATA || path24.join(os6.homedir(), "AppData", "Local");
|
|
41011
41102
|
paths.push(path24.join(localAppData, "opencode", "bun.lock"), path24.join(localAppData, "opencode", "bun.lockb"));
|
|
41012
41103
|
}
|
|
41013
41104
|
return paths;
|
|
@@ -42227,10 +42318,10 @@ __export(exports_config_doctor, {
|
|
|
42227
42318
|
});
|
|
42228
42319
|
import * as crypto4 from "crypto";
|
|
42229
42320
|
import * as fs10 from "fs";
|
|
42230
|
-
import * as
|
|
42321
|
+
import * as os7 from "os";
|
|
42231
42322
|
import * as path26 from "path";
|
|
42232
42323
|
function getUserConfigDir3() {
|
|
42233
|
-
return process.env.XDG_CONFIG_HOME || path26.join(
|
|
42324
|
+
return process.env.XDG_CONFIG_HOME || path26.join(os7.homedir(), ".config");
|
|
42234
42325
|
}
|
|
42235
42326
|
function getConfigPaths(directory) {
|
|
42236
42327
|
const userConfigPath = path26.join(getUserConfigDir3(), "opencode", "opencode-swarm.json");
|
|
@@ -44068,7 +44159,7 @@ function isCommandAvailable(command) {
|
|
|
44068
44159
|
const isWindows = process.platform === "win32";
|
|
44069
44160
|
const cmd = isWindows ? `${command}.exe` : command;
|
|
44070
44161
|
try {
|
|
44071
|
-
const result =
|
|
44162
|
+
const result = _internals16.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
|
|
44072
44163
|
cwd: process.cwd(),
|
|
44073
44164
|
stdin: "ignore",
|
|
44074
44165
|
stdout: "ignore",
|
|
@@ -44218,7 +44309,7 @@ async function discoverBuildCommands(workingDir, options) {
|
|
|
44218
44309
|
const scope = options?.scope ?? "all";
|
|
44219
44310
|
const changedFiles = options?.changedFiles ?? [];
|
|
44220
44311
|
const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
|
|
44221
|
-
const profileResult = await
|
|
44312
|
+
const profileResult = await _internals16.discoverBuildCommandsFromProfiles(workingDir);
|
|
44222
44313
|
const profileCommands = profileResult.commands;
|
|
44223
44314
|
const profileSkipped = profileResult.skipped;
|
|
44224
44315
|
const coveredEcosystems = new Set;
|
|
@@ -44281,7 +44372,7 @@ function clearToolchainCache() {
|
|
|
44281
44372
|
function getEcosystems() {
|
|
44282
44373
|
return ECOSYSTEMS.map((e) => e.ecosystem);
|
|
44283
44374
|
}
|
|
44284
|
-
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000,
|
|
44375
|
+
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals16, build_discovery;
|
|
44285
44376
|
var init_discovery = __esm(() => {
|
|
44286
44377
|
init_dist();
|
|
44287
44378
|
init_detector();
|
|
@@ -44399,7 +44490,7 @@ var init_discovery = __esm(() => {
|
|
|
44399
44490
|
php: ["php-composer"]
|
|
44400
44491
|
};
|
|
44401
44492
|
toolchainCache = new Map;
|
|
44402
|
-
|
|
44493
|
+
_internals16 = {
|
|
44403
44494
|
isCommandAvailable,
|
|
44404
44495
|
discoverBuildCommandsFromProfiles,
|
|
44405
44496
|
discoverBuildCommands,
|
|
@@ -44671,7 +44762,7 @@ var exports_evidence_summary_service = {};
|
|
|
44671
44762
|
__export(exports_evidence_summary_service, {
|
|
44672
44763
|
isAutoSummaryEnabled: () => isAutoSummaryEnabled,
|
|
44673
44764
|
buildEvidenceSummary: () => buildEvidenceSummary,
|
|
44674
|
-
_internals: () =>
|
|
44765
|
+
_internals: () => _internals17,
|
|
44675
44766
|
REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
|
|
44676
44767
|
EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
|
|
44677
44768
|
});
|
|
@@ -44709,7 +44800,7 @@ function getTaskStatus(task, bundle) {
|
|
|
44709
44800
|
if (task?.status) {
|
|
44710
44801
|
return task.status;
|
|
44711
44802
|
}
|
|
44712
|
-
const entries =
|
|
44803
|
+
const entries = _internals17.normalizeBundleEntries(bundle);
|
|
44713
44804
|
if (entries.length > 0) {
|
|
44714
44805
|
return "completed";
|
|
44715
44806
|
}
|
|
@@ -44735,7 +44826,7 @@ function evidenceCompleteFromEntries(entries) {
|
|
|
44735
44826
|
};
|
|
44736
44827
|
}
|
|
44737
44828
|
function isEvidenceComplete(bundle) {
|
|
44738
|
-
return evidenceCompleteFromEntries(
|
|
44829
|
+
return evidenceCompleteFromEntries(_internals17.normalizeBundleEntries(bundle));
|
|
44739
44830
|
}
|
|
44740
44831
|
function getTaskBlockers(task, summary, status) {
|
|
44741
44832
|
const blockers = [];
|
|
@@ -44755,9 +44846,9 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
44755
44846
|
const bundle = result.status === "found" ? result.bundle : null;
|
|
44756
44847
|
const gateEvidence = await readDurableGateEvidence(directory, taskId);
|
|
44757
44848
|
const phase = task?.phase ?? 0;
|
|
44758
|
-
const status =
|
|
44759
|
-
const entries = mergeDurableGateEntriesFromEvidence(taskId,
|
|
44760
|
-
let evidenceCheck =
|
|
44849
|
+
const status = _internals17.getTaskStatus(task, bundle);
|
|
44850
|
+
const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals17.normalizeBundleEntries(bundle), gateEvidence);
|
|
44851
|
+
let evidenceCheck = _internals17.evidenceCompleteFromEntries(entries);
|
|
44761
44852
|
if (gateEvidence) {
|
|
44762
44853
|
const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
|
|
44763
44854
|
evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
|
|
@@ -44765,7 +44856,7 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
44765
44856
|
missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
|
|
44766
44857
|
};
|
|
44767
44858
|
}
|
|
44768
|
-
const blockers =
|
|
44859
|
+
const blockers = _internals17.getTaskBlockers(task, evidenceCheck, status);
|
|
44769
44860
|
const hasReview = entries.some((e) => e.type === "review");
|
|
44770
44861
|
const hasTest = entries.some((e) => e.type === "test");
|
|
44771
44862
|
const hasApproval = entries.some((e) => e.type === "approval");
|
|
@@ -44794,12 +44885,12 @@ async function buildPhaseSummary(directory, phase) {
|
|
|
44794
44885
|
const taskSummaries = [];
|
|
44795
44886
|
const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
|
|
44796
44887
|
for (const task of phase.tasks) {
|
|
44797
|
-
const summary = await
|
|
44888
|
+
const summary = await _internals17.buildTaskSummary(directory, task, task.id);
|
|
44798
44889
|
taskSummaries.push(summary);
|
|
44799
44890
|
}
|
|
44800
44891
|
const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
|
|
44801
44892
|
for (const taskId of extraTaskIds) {
|
|
44802
|
-
const summary = await
|
|
44893
|
+
const summary = await _internals17.buildTaskSummary(directory, undefined, taskId);
|
|
44803
44894
|
if (summary.phase === phase.id) {
|
|
44804
44895
|
taskSummaries.push(summary);
|
|
44805
44896
|
}
|
|
@@ -44900,7 +44991,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
44900
44991
|
let totalTasks = 0;
|
|
44901
44992
|
let completedTasks = 0;
|
|
44902
44993
|
for (const phase of phasesToProcess) {
|
|
44903
|
-
const summary = await
|
|
44994
|
+
const summary = await _internals17.buildPhaseSummary(directory, phase);
|
|
44904
44995
|
phaseSummaries.push(summary);
|
|
44905
44996
|
totalTasks += summary.totalTasks;
|
|
44906
44997
|
completedTasks += summary.completedTasks;
|
|
@@ -44922,7 +45013,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
44922
45013
|
overallBlockers,
|
|
44923
45014
|
summaryText: ""
|
|
44924
45015
|
};
|
|
44925
|
-
artifact.summaryText =
|
|
45016
|
+
artifact.summaryText = _internals17.generateSummaryText(artifact);
|
|
44926
45017
|
log("[EvidenceSummary] Summary built", {
|
|
44927
45018
|
phases: phaseSummaries.length,
|
|
44928
45019
|
totalTasks,
|
|
@@ -44941,7 +45032,7 @@ function isAutoSummaryEnabled(automationConfig) {
|
|
|
44941
45032
|
}
|
|
44942
45033
|
return automationConfig.capabilities?.evidence_auto_summaries === true;
|
|
44943
45034
|
}
|
|
44944
|
-
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0",
|
|
45035
|
+
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals17;
|
|
44945
45036
|
var init_evidence_summary_service = __esm(() => {
|
|
44946
45037
|
init_gate_bridge();
|
|
44947
45038
|
init_manager2();
|
|
@@ -44956,7 +45047,7 @@ var init_evidence_summary_service = __esm(() => {
|
|
|
44956
45047
|
"retrospective"
|
|
44957
45048
|
]);
|
|
44958
45049
|
REQUIRED_EVIDENCE_TYPES = ["review", "test"];
|
|
44959
|
-
|
|
45050
|
+
_internals17 = {
|
|
44960
45051
|
buildEvidenceSummary,
|
|
44961
45052
|
isAutoSummaryEnabled,
|
|
44962
45053
|
normalizeBundleEntries,
|
|
@@ -45012,7 +45103,7 @@ function getVerdictEmoji(verdict) {
|
|
|
45012
45103
|
return getVerdictIcon(verdict);
|
|
45013
45104
|
}
|
|
45014
45105
|
async function getTaskEvidenceData(directory, taskId) {
|
|
45015
|
-
const result = await
|
|
45106
|
+
const result = await _internals18.loadEvidence(directory, taskId);
|
|
45016
45107
|
if (result.status !== "found") {
|
|
45017
45108
|
return {
|
|
45018
45109
|
hasEvidence: false,
|
|
@@ -45035,13 +45126,13 @@ async function getTaskEvidenceData(directory, taskId) {
|
|
|
45035
45126
|
};
|
|
45036
45127
|
}
|
|
45037
45128
|
async function getEvidenceListData(directory) {
|
|
45038
|
-
const taskIds = await
|
|
45129
|
+
const taskIds = await _internals18.listEvidenceTaskIds(directory);
|
|
45039
45130
|
if (taskIds.length === 0) {
|
|
45040
45131
|
return { hasEvidence: false, tasks: [] };
|
|
45041
45132
|
}
|
|
45042
45133
|
const tasks = [];
|
|
45043
45134
|
for (const taskId of taskIds) {
|
|
45044
|
-
const result = await
|
|
45135
|
+
const result = await _internals18.loadEvidence(directory, taskId);
|
|
45045
45136
|
if (result.status === "found") {
|
|
45046
45137
|
tasks.push({
|
|
45047
45138
|
taskId,
|
|
@@ -45155,10 +45246,10 @@ async function handleEvidenceSummaryCommand(directory) {
|
|
|
45155
45246
|
return lines.join(`
|
|
45156
45247
|
`);
|
|
45157
45248
|
}
|
|
45158
|
-
var
|
|
45249
|
+
var _internals18;
|
|
45159
45250
|
var init_evidence_service = __esm(() => {
|
|
45160
45251
|
init_manager2();
|
|
45161
|
-
|
|
45252
|
+
_internals18 = {
|
|
45162
45253
|
loadEvidence,
|
|
45163
45254
|
listEvidenceTaskIds
|
|
45164
45255
|
};
|
|
@@ -45565,7 +45656,7 @@ function extractCurrentPhaseFromPlan2(plan) {
|
|
|
45565
45656
|
if (!plan) {
|
|
45566
45657
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
45567
45658
|
}
|
|
45568
|
-
if (!
|
|
45659
|
+
if (!_internals19.validatePlanPhases(plan)) {
|
|
45569
45660
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
45570
45661
|
}
|
|
45571
45662
|
let currentPhase = null;
|
|
@@ -45707,9 +45798,9 @@ function extractPhaseMetrics(content) {
|
|
|
45707
45798
|
async function getHandoffData(directory) {
|
|
45708
45799
|
const now = new Date().toISOString();
|
|
45709
45800
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
45710
|
-
const sessionState =
|
|
45801
|
+
const sessionState = _internals19.parseSessionState(sessionContent);
|
|
45711
45802
|
const plan = await loadPlanJsonOnly(directory);
|
|
45712
|
-
const planInfo =
|
|
45803
|
+
const planInfo = _internals19.extractCurrentPhaseFromPlan(plan);
|
|
45713
45804
|
if (!plan) {
|
|
45714
45805
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
45715
45806
|
if (planMdContent) {
|
|
@@ -45728,8 +45819,8 @@ async function getHandoffData(directory) {
|
|
|
45728
45819
|
}
|
|
45729
45820
|
}
|
|
45730
45821
|
const contextContent = await readSwarmFileAsync(directory, "context.md");
|
|
45731
|
-
const recentDecisions =
|
|
45732
|
-
const rawPhaseMetrics =
|
|
45822
|
+
const recentDecisions = _internals19.extractDecisions(contextContent);
|
|
45823
|
+
const rawPhaseMetrics = _internals19.extractPhaseMetrics(contextContent);
|
|
45733
45824
|
const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
|
|
45734
45825
|
let delegationState = null;
|
|
45735
45826
|
if (sessionState?.delegationState) {
|
|
@@ -45893,13 +45984,13 @@ ${lines.join(`
|
|
|
45893
45984
|
`)}
|
|
45894
45985
|
\`\`\``;
|
|
45895
45986
|
}
|
|
45896
|
-
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20,
|
|
45987
|
+
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals19;
|
|
45897
45988
|
var init_handoff_service = __esm(() => {
|
|
45898
45989
|
init_utils2();
|
|
45899
45990
|
init_manager();
|
|
45900
45991
|
init_utils();
|
|
45901
45992
|
RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
45902
|
-
|
|
45993
|
+
_internals19 = {
|
|
45903
45994
|
getHandoffData,
|
|
45904
45995
|
formatHandoffMarkdown,
|
|
45905
45996
|
formatContinuationPrompt,
|
|
@@ -46036,22 +46127,22 @@ async function writeSnapshot(directory, state) {
|
|
|
46036
46127
|
}
|
|
46037
46128
|
function createSnapshotWriterHook(directory) {
|
|
46038
46129
|
return (_input, _output) => {
|
|
46039
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
46130
|
+
_writeInFlight = _writeInFlight.then(() => _internals20.writeSnapshot(directory, swarmState), () => _internals20.writeSnapshot(directory, swarmState));
|
|
46040
46131
|
return _writeInFlight;
|
|
46041
46132
|
};
|
|
46042
46133
|
}
|
|
46043
46134
|
async function flushPendingSnapshot(directory) {
|
|
46044
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
46135
|
+
_writeInFlight = _writeInFlight.then(() => _internals20.writeSnapshot(directory, swarmState), () => _internals20.writeSnapshot(directory, swarmState));
|
|
46045
46136
|
await _writeInFlight;
|
|
46046
46137
|
}
|
|
46047
|
-
var _writeInFlight,
|
|
46138
|
+
var _writeInFlight, _internals20;
|
|
46048
46139
|
var init_snapshot_writer = __esm(() => {
|
|
46049
46140
|
init_utils2();
|
|
46050
46141
|
init_state();
|
|
46051
46142
|
init_utils();
|
|
46052
46143
|
init_bun_compat();
|
|
46053
46144
|
_writeInFlight = Promise.resolve();
|
|
46054
|
-
|
|
46145
|
+
_internals20 = {
|
|
46055
46146
|
writeSnapshot,
|
|
46056
46147
|
createSnapshotWriterHook,
|
|
46057
46148
|
flushPendingSnapshot
|
|
@@ -46519,9 +46610,9 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
46519
46610
|
skippedReason: "empty-context"
|
|
46520
46611
|
};
|
|
46521
46612
|
}
|
|
46522
|
-
const rawEntries =
|
|
46613
|
+
const rawEntries = _internals21.parseContextMd(contextContent);
|
|
46523
46614
|
if (rawEntries.length === 0) {
|
|
46524
|
-
await
|
|
46615
|
+
await _internals21.writeSentinel(sentinelPath, 0, 0);
|
|
46525
46616
|
return {
|
|
46526
46617
|
migrated: true,
|
|
46527
46618
|
entriesMigrated: 0,
|
|
@@ -46532,10 +46623,10 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
46532
46623
|
const existing = await readKnowledge(knowledgePath);
|
|
46533
46624
|
let migrated = 0;
|
|
46534
46625
|
let dropped = 0;
|
|
46535
|
-
const projectName =
|
|
46626
|
+
const projectName = _internals21.inferProjectName(directory);
|
|
46536
46627
|
for (const raw of rawEntries) {
|
|
46537
46628
|
if (config3.validation_enabled !== false) {
|
|
46538
|
-
const category = raw.categoryHint ??
|
|
46629
|
+
const category = raw.categoryHint ?? _internals21.inferCategoryFromText(raw.text);
|
|
46539
46630
|
const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
|
|
46540
46631
|
category,
|
|
46541
46632
|
scope: "global",
|
|
@@ -46555,8 +46646,8 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
46555
46646
|
const entry = {
|
|
46556
46647
|
id: randomUUID3(),
|
|
46557
46648
|
tier: "swarm",
|
|
46558
|
-
lesson:
|
|
46559
|
-
category: raw.categoryHint ??
|
|
46649
|
+
lesson: _internals21.truncateLesson(raw.text),
|
|
46650
|
+
category: raw.categoryHint ?? _internals21.inferCategoryFromText(raw.text),
|
|
46560
46651
|
tags: [...inferredTags, `migration:${raw.sourceSection}`],
|
|
46561
46652
|
scope: "global",
|
|
46562
46653
|
confidence: 0.3,
|
|
@@ -46579,7 +46670,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
46579
46670
|
if (migrated > 0) {
|
|
46580
46671
|
await rewriteKnowledge(knowledgePath, existing);
|
|
46581
46672
|
}
|
|
46582
|
-
await
|
|
46673
|
+
await _internals21.writeSentinel(sentinelPath, migrated, dropped);
|
|
46583
46674
|
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
46584
46675
|
return {
|
|
46585
46676
|
migrated: true,
|
|
@@ -46589,7 +46680,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
46589
46680
|
};
|
|
46590
46681
|
}
|
|
46591
46682
|
function parseContextMd(content) {
|
|
46592
|
-
const sections =
|
|
46683
|
+
const sections = _internals21.splitIntoSections(content);
|
|
46593
46684
|
const entries = [];
|
|
46594
46685
|
const seen = new Set;
|
|
46595
46686
|
const sectionPatterns = [
|
|
@@ -46605,7 +46696,7 @@ function parseContextMd(content) {
|
|
|
46605
46696
|
const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
|
|
46606
46697
|
if (!match)
|
|
46607
46698
|
continue;
|
|
46608
|
-
const bullets =
|
|
46699
|
+
const bullets = _internals21.extractBullets(section.body);
|
|
46609
46700
|
for (const bullet of bullets) {
|
|
46610
46701
|
if (bullet.length < 15)
|
|
46611
46702
|
continue;
|
|
@@ -46614,9 +46705,9 @@ function parseContextMd(content) {
|
|
|
46614
46705
|
continue;
|
|
46615
46706
|
seen.add(normalized);
|
|
46616
46707
|
entries.push({
|
|
46617
|
-
text:
|
|
46708
|
+
text: _internals21.truncateLesson(bullet),
|
|
46618
46709
|
sourceSection: match.sourceSection,
|
|
46619
|
-
categoryHint:
|
|
46710
|
+
categoryHint: _internals21.inferCategoryFromText(bullet)
|
|
46620
46711
|
});
|
|
46621
46712
|
}
|
|
46622
46713
|
}
|
|
@@ -46709,12 +46800,12 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
46709
46800
|
await mkdir8(path30.dirname(sentinelPath), { recursive: true });
|
|
46710
46801
|
await writeFile7(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
46711
46802
|
}
|
|
46712
|
-
var
|
|
46803
|
+
var _internals21;
|
|
46713
46804
|
var init_knowledge_migrator = __esm(() => {
|
|
46714
46805
|
init_logger();
|
|
46715
46806
|
init_knowledge_store();
|
|
46716
46807
|
init_knowledge_validator();
|
|
46717
|
-
|
|
46808
|
+
_internals21 = {
|
|
46718
46809
|
migrateContextToKnowledge,
|
|
46719
46810
|
migrateKnowledgeToExternal,
|
|
46720
46811
|
parseContextMd,
|
|
@@ -49337,7 +49428,7 @@ var init_gateway = __esm(() => {
|
|
|
49337
49428
|
|
|
49338
49429
|
// src/memory/evaluation.ts
|
|
49339
49430
|
import * as fs13 from "fs/promises";
|
|
49340
|
-
import * as
|
|
49431
|
+
import * as os8 from "os";
|
|
49341
49432
|
import * as path34 from "path";
|
|
49342
49433
|
async function evaluateMemoryRecallFixtures(options) {
|
|
49343
49434
|
const fixtureDirectory = path34.resolve(options.fixtureDirectory);
|
|
@@ -49349,7 +49440,7 @@ async function evaluateMemoryRecallFixtures(options) {
|
|
|
49349
49440
|
for (const fixture of fixtures) {
|
|
49350
49441
|
const materialized = materializeFixture(fixture);
|
|
49351
49442
|
for (const providerName of providers) {
|
|
49352
|
-
const tempRoot = await fs13.realpath(await fs13.mkdtemp(path34.join(
|
|
49443
|
+
const tempRoot = await fs13.realpath(await fs13.mkdtemp(path34.join(os8.tmpdir(), "swarm-memory-eval-")));
|
|
49353
49444
|
const provider = createEvaluationProvider(providerName, tempRoot);
|
|
49354
49445
|
try {
|
|
49355
49446
|
await provider.initialize?.();
|
|
@@ -50181,9 +50272,9 @@ var init_memory2 = __esm(() => {
|
|
|
50181
50272
|
|
|
50182
50273
|
// src/services/plan-service.ts
|
|
50183
50274
|
async function getPlanData(directory, phaseArg) {
|
|
50184
|
-
const plan = await
|
|
50275
|
+
const plan = await _internals22.loadPlanJsonOnly(directory);
|
|
50185
50276
|
if (plan) {
|
|
50186
|
-
const fullMarkdown =
|
|
50277
|
+
const fullMarkdown = _internals22.derivePlanMarkdown(plan);
|
|
50187
50278
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
50188
50279
|
return {
|
|
50189
50280
|
hasPlan: true,
|
|
@@ -50226,7 +50317,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
50226
50317
|
isLegacy: false
|
|
50227
50318
|
};
|
|
50228
50319
|
}
|
|
50229
|
-
const planContent = await
|
|
50320
|
+
const planContent = await _internals22.readSwarmFileAsync(directory, "plan.md");
|
|
50230
50321
|
if (!planContent) {
|
|
50231
50322
|
return {
|
|
50232
50323
|
hasPlan: false,
|
|
@@ -50322,11 +50413,11 @@ async function handlePlanCommand(directory, args) {
|
|
|
50322
50413
|
const planData = await getPlanData(directory, phaseArg);
|
|
50323
50414
|
return formatPlanMarkdown(planData);
|
|
50324
50415
|
}
|
|
50325
|
-
var
|
|
50416
|
+
var _internals22;
|
|
50326
50417
|
var init_plan_service = __esm(() => {
|
|
50327
50418
|
init_utils2();
|
|
50328
50419
|
init_manager();
|
|
50329
|
-
|
|
50420
|
+
_internals22 = {
|
|
50330
50421
|
loadPlanJsonOnly,
|
|
50331
50422
|
derivePlanMarkdown,
|
|
50332
50423
|
readSwarmFileAsync
|
|
@@ -50462,7 +50553,7 @@ function parsePrRef(input, cwd) {
|
|
|
50462
50553
|
}
|
|
50463
50554
|
function detectGitRemote2(cwd) {
|
|
50464
50555
|
try {
|
|
50465
|
-
const remoteUrl =
|
|
50556
|
+
const remoteUrl = _internals23.execSync("git remote get-url origin", {
|
|
50466
50557
|
encoding: "utf-8",
|
|
50467
50558
|
stdio: ["pipe", "pipe", "pipe"],
|
|
50468
50559
|
timeout: 5000,
|
|
@@ -50518,9 +50609,9 @@ function resolvePrCommandInput(rest, cwd) {
|
|
|
50518
50609
|
}
|
|
50519
50610
|
return { prUrl: result.sanitized, instructions };
|
|
50520
50611
|
}
|
|
50521
|
-
var
|
|
50612
|
+
var _internals23, MAX_URL_LEN2 = 2048, MAX_INSTRUCTIONS_LEN = 1000;
|
|
50522
50613
|
var init_pr_ref = __esm(() => {
|
|
50523
|
-
|
|
50614
|
+
_internals23 = { execSync: execSync3 };
|
|
50524
50615
|
});
|
|
50525
50616
|
|
|
50526
50617
|
// src/commands/pr-feedback.ts
|
|
@@ -50995,7 +51086,7 @@ async function runAdditionalLint(linter, mode, cwd) {
|
|
|
50995
51086
|
};
|
|
50996
51087
|
}
|
|
50997
51088
|
}
|
|
50998
|
-
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint,
|
|
51089
|
+
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals24;
|
|
50999
51090
|
var init_lint = __esm(() => {
|
|
51000
51091
|
init_zod();
|
|
51001
51092
|
init_discovery();
|
|
@@ -51027,15 +51118,15 @@ var init_lint = __esm(() => {
|
|
|
51027
51118
|
}
|
|
51028
51119
|
const { mode } = args;
|
|
51029
51120
|
const cwd = directory;
|
|
51030
|
-
const linter = await
|
|
51121
|
+
const linter = await _internals24.detectAvailableLinter(directory);
|
|
51031
51122
|
if (linter) {
|
|
51032
|
-
const result = await
|
|
51123
|
+
const result = await _internals24.runLint(linter, mode, directory);
|
|
51033
51124
|
return JSON.stringify(result, null, 2);
|
|
51034
51125
|
}
|
|
51035
|
-
const additionalLinter =
|
|
51126
|
+
const additionalLinter = _internals24.detectAdditionalLinter(cwd);
|
|
51036
51127
|
if (additionalLinter) {
|
|
51037
51128
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
51038
|
-
const result = await
|
|
51129
|
+
const result = await _internals24.runAdditionalLint(additionalLinter, mode, cwd);
|
|
51039
51130
|
return JSON.stringify(result, null, 2);
|
|
51040
51131
|
}
|
|
51041
51132
|
const errorResult = {
|
|
@@ -51049,7 +51140,7 @@ For Rust: rustup component add clippy`
|
|
|
51049
51140
|
return JSON.stringify(errorResult, null, 2);
|
|
51050
51141
|
}
|
|
51051
51142
|
});
|
|
51052
|
-
|
|
51143
|
+
_internals24 = {
|
|
51053
51144
|
detectAvailableLinter,
|
|
51054
51145
|
runLint,
|
|
51055
51146
|
detectAdditionalLinter,
|
|
@@ -51363,7 +51454,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
51363
51454
|
}
|
|
51364
51455
|
async function runSecretscan(directory) {
|
|
51365
51456
|
try {
|
|
51366
|
-
const result = await
|
|
51457
|
+
const result = await _internals25.secretscan.execute({ directory }, {});
|
|
51367
51458
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
51368
51459
|
return JSON.parse(jsonStr);
|
|
51369
51460
|
} catch (e) {
|
|
@@ -51378,7 +51469,7 @@ async function runSecretscan(directory) {
|
|
|
51378
51469
|
return errorResult;
|
|
51379
51470
|
}
|
|
51380
51471
|
}
|
|
51381
|
-
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_PATTERNS2, O_NOFOLLOW, secretscan,
|
|
51472
|
+
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_PATTERNS2, O_NOFOLLOW, secretscan, _internals25;
|
|
51382
51473
|
var init_secretscan = __esm(() => {
|
|
51383
51474
|
init_zod();
|
|
51384
51475
|
init_path_security();
|
|
@@ -51750,7 +51841,7 @@ var init_secretscan = __esm(() => {
|
|
|
51750
51841
|
}
|
|
51751
51842
|
}
|
|
51752
51843
|
});
|
|
51753
|
-
|
|
51844
|
+
_internals25 = {
|
|
51754
51845
|
secretscan,
|
|
51755
51846
|
runSecretscan
|
|
51756
51847
|
};
|
|
@@ -52342,14 +52433,14 @@ function buildGoBackend() {
|
|
|
52342
52433
|
selectEntryPoints
|
|
52343
52434
|
};
|
|
52344
52435
|
}
|
|
52345
|
-
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE,
|
|
52436
|
+
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals26;
|
|
52346
52437
|
var init_go = __esm(() => {
|
|
52347
52438
|
init_default_backend();
|
|
52348
52439
|
init_profiles();
|
|
52349
52440
|
IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
|
|
52350
52441
|
IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
|
|
52351
52442
|
IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
|
|
52352
|
-
|
|
52443
|
+
_internals26 = { extractImports };
|
|
52353
52444
|
});
|
|
52354
52445
|
|
|
52355
52446
|
// src/lang/backends/python.ts
|
|
@@ -52461,13 +52552,13 @@ function buildPythonBackend() {
|
|
|
52461
52552
|
selectEntryPoints: selectEntryPoints2
|
|
52462
52553
|
};
|
|
52463
52554
|
}
|
|
52464
|
-
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT,
|
|
52555
|
+
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals27;
|
|
52465
52556
|
var init_python = __esm(() => {
|
|
52466
52557
|
init_default_backend();
|
|
52467
52558
|
init_profiles();
|
|
52468
52559
|
IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
|
|
52469
52560
|
IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
|
|
52470
|
-
|
|
52561
|
+
_internals27 = { extractImports: extractImports2 };
|
|
52471
52562
|
});
|
|
52472
52563
|
|
|
52473
52564
|
// src/test-impact/analyzer.ts
|
|
@@ -52691,7 +52782,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
52691
52782
|
return;
|
|
52692
52783
|
}
|
|
52693
52784
|
if (PYTHON_EXTENSIONS.has(ext)) {
|
|
52694
|
-
const modules =
|
|
52785
|
+
const modules = _internals27.extractImports(testFile, content);
|
|
52695
52786
|
for (const mod of modules) {
|
|
52696
52787
|
const resolved = resolvePythonImport(testDir, mod);
|
|
52697
52788
|
if (resolved !== null)
|
|
@@ -52700,7 +52791,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
52700
52791
|
return;
|
|
52701
52792
|
}
|
|
52702
52793
|
if (GO_EXTENSIONS.has(ext)) {
|
|
52703
|
-
const imports =
|
|
52794
|
+
const imports = _internals26.extractImports(testFile, content);
|
|
52704
52795
|
for (const importPath of imports) {
|
|
52705
52796
|
const sourceFiles = resolveGoImport(testDir, importPath);
|
|
52706
52797
|
for (const source of sourceFiles)
|
|
@@ -52727,8 +52818,8 @@ async function buildImpactMapInternal(cwd) {
|
|
|
52727
52818
|
return impactMap;
|
|
52728
52819
|
}
|
|
52729
52820
|
async function buildImpactMap(cwd) {
|
|
52730
|
-
const impactMap = await
|
|
52731
|
-
await
|
|
52821
|
+
const impactMap = await _internals28.buildImpactMapInternal(cwd);
|
|
52822
|
+
await _internals28.saveImpactMap(cwd, impactMap);
|
|
52732
52823
|
return impactMap;
|
|
52733
52824
|
}
|
|
52734
52825
|
async function loadImpactMap(cwd, options) {
|
|
@@ -52742,7 +52833,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
52742
52833
|
const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
52743
52834
|
if (hasValidValues) {
|
|
52744
52835
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
52745
|
-
if (!
|
|
52836
|
+
if (!_internals28.isCacheStale(map3, generatedAt)) {
|
|
52746
52837
|
return map3;
|
|
52747
52838
|
}
|
|
52748
52839
|
if (options?.skipRebuild) {
|
|
@@ -52762,13 +52853,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
52762
52853
|
if (options?.skipRebuild) {
|
|
52763
52854
|
return {};
|
|
52764
52855
|
}
|
|
52765
|
-
return
|
|
52856
|
+
return _internals28.buildImpactMap(cwd);
|
|
52766
52857
|
}
|
|
52767
52858
|
async function saveImpactMap(cwd, impactMap) {
|
|
52768
52859
|
if (!path41.isAbsolute(cwd)) {
|
|
52769
52860
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
52770
52861
|
}
|
|
52771
|
-
|
|
52862
|
+
_internals28.validateProjectRoot(cwd);
|
|
52772
52863
|
const cacheDir2 = path41.join(cwd, ".swarm", "cache");
|
|
52773
52864
|
const cachePath = path41.join(cacheDir2, "impact-map.json");
|
|
52774
52865
|
if (!fs19.existsSync(cacheDir2)) {
|
|
@@ -52792,7 +52883,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
52792
52883
|
};
|
|
52793
52884
|
}
|
|
52794
52885
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
52795
|
-
const impactMap = await
|
|
52886
|
+
const impactMap = await _internals28.loadImpactMap(cwd);
|
|
52796
52887
|
const impactedTestsSet = new Set;
|
|
52797
52888
|
const untestedFiles = [];
|
|
52798
52889
|
let visitedCount = 0;
|
|
@@ -52877,7 +52968,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
52877
52968
|
budgetExceeded
|
|
52878
52969
|
};
|
|
52879
52970
|
}
|
|
52880
|
-
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache,
|
|
52971
|
+
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals28;
|
|
52881
52972
|
var init_analyzer = __esm(() => {
|
|
52882
52973
|
init_manager2();
|
|
52883
52974
|
init_go();
|
|
@@ -52890,7 +52981,7 @@ var init_analyzer = __esm(() => {
|
|
|
52890
52981
|
GO_EXTENSIONS = new Set([".go"]);
|
|
52891
52982
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
52892
52983
|
goModuleCache = new Map;
|
|
52893
|
-
|
|
52984
|
+
_internals28 = {
|
|
52894
52985
|
validateProjectRoot,
|
|
52895
52986
|
normalizePath,
|
|
52896
52987
|
isCacheStale,
|
|
@@ -53226,7 +53317,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
53226
53317
|
}
|
|
53227
53318
|
const historyPath = getHistoryPath(workingDir);
|
|
53228
53319
|
const historyDir = path42.dirname(historyPath);
|
|
53229
|
-
|
|
53320
|
+
_internals29.validateProjectRoot(workingDir);
|
|
53230
53321
|
if (!fs20.existsSync(historyDir)) {
|
|
53231
53322
|
fs20.mkdirSync(historyDir, { recursive: true });
|
|
53232
53323
|
}
|
|
@@ -53349,7 +53440,7 @@ function getAllHistory(workingDir) {
|
|
|
53349
53440
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
53350
53441
|
return records;
|
|
53351
53442
|
}
|
|
53352
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES,
|
|
53443
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals29;
|
|
53353
53444
|
var init_history_store = __esm(() => {
|
|
53354
53445
|
init_manager2();
|
|
53355
53446
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
|
@@ -53357,7 +53448,7 @@ var init_history_store = __esm(() => {
|
|
|
53357
53448
|
"constructor",
|
|
53358
53449
|
"prototype"
|
|
53359
53450
|
]);
|
|
53360
|
-
|
|
53451
|
+
_internals29 = {
|
|
53361
53452
|
validateProjectRoot
|
|
53362
53453
|
};
|
|
53363
53454
|
});
|
|
@@ -53556,7 +53647,7 @@ function readPackageJsonRaw(dir) {
|
|
|
53556
53647
|
}
|
|
53557
53648
|
}
|
|
53558
53649
|
function readPackageJson(dir) {
|
|
53559
|
-
return
|
|
53650
|
+
return _internals30.readPackageJsonRaw(dir);
|
|
53560
53651
|
}
|
|
53561
53652
|
function readPackageJsonTestScript(dir) {
|
|
53562
53653
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -53726,7 +53817,7 @@ function buildTypescriptBackend() {
|
|
|
53726
53817
|
selectEntryPoints: selectEntryPoints3
|
|
53727
53818
|
};
|
|
53728
53819
|
}
|
|
53729
|
-
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2,
|
|
53820
|
+
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals30;
|
|
53730
53821
|
var init_typescript = __esm(() => {
|
|
53731
53822
|
init_default_backend();
|
|
53732
53823
|
init_profiles();
|
|
@@ -53735,7 +53826,7 @@ var init_typescript = __esm(() => {
|
|
|
53735
53826
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
53736
53827
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
53737
53828
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
53738
|
-
|
|
53829
|
+
_internals30 = {
|
|
53739
53830
|
readPackageJsonRaw,
|
|
53740
53831
|
readPackageJsonTestScript,
|
|
53741
53832
|
frameworkFromScriptsTest
|
|
@@ -53768,7 +53859,7 @@ __export(exports_dispatch, {
|
|
|
53768
53859
|
pickedProfiles: () => pickedProfiles,
|
|
53769
53860
|
pickBackend: () => pickBackend,
|
|
53770
53861
|
clearDispatchCache: () => clearDispatchCache,
|
|
53771
|
-
_internals: () =>
|
|
53862
|
+
_internals: () => _internals31
|
|
53772
53863
|
});
|
|
53773
53864
|
import * as fs24 from "fs";
|
|
53774
53865
|
import * as path46 from "path";
|
|
@@ -53823,7 +53914,7 @@ function findManifestRoot(start) {
|
|
|
53823
53914
|
return start;
|
|
53824
53915
|
}
|
|
53825
53916
|
function evictIfNeeded() {
|
|
53826
|
-
if (cache.size <=
|
|
53917
|
+
if (cache.size <= _internals31.cacheCapacity)
|
|
53827
53918
|
return;
|
|
53828
53919
|
let oldestKey;
|
|
53829
53920
|
let oldestOrder = Infinity;
|
|
@@ -53854,7 +53945,7 @@ async function pickBackend(dir) {
|
|
|
53854
53945
|
evictIfNeeded();
|
|
53855
53946
|
return null;
|
|
53856
53947
|
}
|
|
53857
|
-
const profiles = await
|
|
53948
|
+
const profiles = await _internals31.detectProjectLanguages(root);
|
|
53858
53949
|
if (profiles.length === 0) {
|
|
53859
53950
|
cache.set(cacheKey, {
|
|
53860
53951
|
hash: hash3,
|
|
@@ -53886,12 +53977,12 @@ function clearDispatchCache() {
|
|
|
53886
53977
|
manifestRootCache.clear();
|
|
53887
53978
|
insertCounter = 0;
|
|
53888
53979
|
}
|
|
53889
|
-
var
|
|
53980
|
+
var _internals31, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
53890
53981
|
var init_dispatch = __esm(() => {
|
|
53891
53982
|
init_backends();
|
|
53892
53983
|
init_detector();
|
|
53893
53984
|
init_registry_backend();
|
|
53894
|
-
|
|
53985
|
+
_internals31 = {
|
|
53895
53986
|
detectProjectLanguages,
|
|
53896
53987
|
cacheCapacity: 64
|
|
53897
53988
|
};
|
|
@@ -55746,9 +55837,9 @@ function getVersionFileVersion(dir) {
|
|
|
55746
55837
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
55747
55838
|
const startTime = Date.now();
|
|
55748
55839
|
try {
|
|
55749
|
-
const packageVersion =
|
|
55750
|
-
const changelogVersion =
|
|
55751
|
-
const versionFileVersion =
|
|
55840
|
+
const packageVersion = _internals32.getPackageVersion(dir);
|
|
55841
|
+
const changelogVersion = _internals32.getChangelogVersion(dir);
|
|
55842
|
+
const versionFileVersion = _internals32.getVersionFileVersion(dir);
|
|
55752
55843
|
const versions3 = [];
|
|
55753
55844
|
if (packageVersion)
|
|
55754
55845
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -56113,7 +56204,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56113
56204
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
56114
56205
|
let validatedDir;
|
|
56115
56206
|
try {
|
|
56116
|
-
validatedDir =
|
|
56207
|
+
validatedDir = _internals32.validateDirectoryPath(dir);
|
|
56117
56208
|
} catch (error93) {
|
|
56118
56209
|
return {
|
|
56119
56210
|
id: reportId,
|
|
@@ -56133,7 +56224,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56133
56224
|
}
|
|
56134
56225
|
let validatedTimeout;
|
|
56135
56226
|
try {
|
|
56136
|
-
validatedTimeout =
|
|
56227
|
+
validatedTimeout = _internals32.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
56137
56228
|
} catch (error93) {
|
|
56138
56229
|
return {
|
|
56139
56230
|
id: reportId,
|
|
@@ -56174,12 +56265,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56174
56265
|
});
|
|
56175
56266
|
const checks5 = [];
|
|
56176
56267
|
log("[Preflight] Running lint check...");
|
|
56177
|
-
const lintResult = await
|
|
56268
|
+
const lintResult = await _internals32.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
56178
56269
|
checks5.push(lintResult);
|
|
56179
56270
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
56180
56271
|
if (!cfg.skipTests) {
|
|
56181
56272
|
log("[Preflight] Running tests check...");
|
|
56182
|
-
const testsResult = await
|
|
56273
|
+
const testsResult = await _internals32.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
56183
56274
|
checks5.push(testsResult);
|
|
56184
56275
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
56185
56276
|
} else {
|
|
@@ -56191,7 +56282,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56191
56282
|
}
|
|
56192
56283
|
if (!cfg.skipSecrets) {
|
|
56193
56284
|
log("[Preflight] Running secrets check...");
|
|
56194
|
-
const secretsResult = await
|
|
56285
|
+
const secretsResult = await _internals32.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
56195
56286
|
checks5.push(secretsResult);
|
|
56196
56287
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
56197
56288
|
} else {
|
|
@@ -56203,7 +56294,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56203
56294
|
}
|
|
56204
56295
|
if (!cfg.skipEvidence) {
|
|
56205
56296
|
log("[Preflight] Running evidence check...");
|
|
56206
|
-
const evidenceResult = await
|
|
56297
|
+
const evidenceResult = await _internals32.runEvidenceCheck(validatedDir);
|
|
56207
56298
|
checks5.push(evidenceResult);
|
|
56208
56299
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
56209
56300
|
} else {
|
|
@@ -56214,12 +56305,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
56214
56305
|
});
|
|
56215
56306
|
}
|
|
56216
56307
|
log("[Preflight] Running requirement coverage check...");
|
|
56217
|
-
const reqCoverageResult = await
|
|
56308
|
+
const reqCoverageResult = await _internals32.runRequirementCoverageCheck(validatedDir, phase);
|
|
56218
56309
|
checks5.push(reqCoverageResult);
|
|
56219
56310
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
56220
56311
|
if (!cfg.skipVersion) {
|
|
56221
56312
|
log("[Preflight] Running version check...");
|
|
56222
|
-
const versionResult = await
|
|
56313
|
+
const versionResult = await _internals32.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
56223
56314
|
checks5.push(versionResult);
|
|
56224
56315
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
56225
56316
|
} else {
|
|
@@ -56282,10 +56373,10 @@ function formatPreflightMarkdown(report) {
|
|
|
56282
56373
|
async function handlePreflightCommand(directory, _args) {
|
|
56283
56374
|
const plan = await loadPlan(directory);
|
|
56284
56375
|
const phase = plan?.current_phase ?? 1;
|
|
56285
|
-
const report = await
|
|
56286
|
-
return
|
|
56376
|
+
const report = await _internals32.runPreflight(directory, phase);
|
|
56377
|
+
return _internals32.formatPreflightMarkdown(report);
|
|
56287
56378
|
}
|
|
56288
|
-
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG,
|
|
56379
|
+
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals32;
|
|
56289
56380
|
var init_preflight_service = __esm(() => {
|
|
56290
56381
|
init_gate_bridge();
|
|
56291
56382
|
init_manager2();
|
|
@@ -56303,7 +56394,7 @@ var init_preflight_service = __esm(() => {
|
|
|
56303
56394
|
testScope: "convention",
|
|
56304
56395
|
linter: "biome"
|
|
56305
56396
|
};
|
|
56306
|
-
|
|
56397
|
+
_internals32 = {
|
|
56307
56398
|
runPreflight,
|
|
56308
56399
|
formatPreflightMarkdown,
|
|
56309
56400
|
handlePreflightCommand,
|
|
@@ -56495,7 +56586,7 @@ var init_qa_gates = __esm(() => {
|
|
|
56495
56586
|
"hallucination_guard",
|
|
56496
56587
|
"sast_enabled",
|
|
56497
56588
|
"mutation_test",
|
|
56498
|
-
"
|
|
56589
|
+
"phase_council",
|
|
56499
56590
|
"drift_check",
|
|
56500
56591
|
"final_council"
|
|
56501
56592
|
];
|
|
@@ -57560,7 +57651,7 @@ async function handleSimulateCommand(directory, args) {
|
|
|
57560
57651
|
}
|
|
57561
57652
|
let darkMatterPairs;
|
|
57562
57653
|
try {
|
|
57563
|
-
darkMatterPairs = await
|
|
57654
|
+
darkMatterPairs = await _internals15.detectDarkMatter(directory, options);
|
|
57564
57655
|
} catch (err) {
|
|
57565
57656
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
57566
57657
|
return `## Simulate Report
|
|
@@ -57925,7 +58016,7 @@ async function getStatusData(directory, agents) {
|
|
|
57925
58016
|
}
|
|
57926
58017
|
function enrichWithLeanTurbo(status, directory) {
|
|
57927
58018
|
const turboMode = hasActiveTurboMode();
|
|
57928
|
-
const leanActive =
|
|
58019
|
+
const leanActive = _internals33.hasActiveLeanTurbo();
|
|
57929
58020
|
let turboStrategy = "off";
|
|
57930
58021
|
if (leanActive) {
|
|
57931
58022
|
turboStrategy = "lean";
|
|
@@ -57944,7 +58035,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
57944
58035
|
}
|
|
57945
58036
|
}
|
|
57946
58037
|
if (leanSessionID) {
|
|
57947
|
-
const runState =
|
|
58038
|
+
const runState = _internals33.loadLeanTurboRunState(directory, leanSessionID);
|
|
57948
58039
|
if (runState) {
|
|
57949
58040
|
status.leanTurboPhase = runState.phase;
|
|
57950
58041
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -57976,7 +58067,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
57976
58067
|
}
|
|
57977
58068
|
}
|
|
57978
58069
|
}
|
|
57979
|
-
status.fullAutoActive =
|
|
58070
|
+
status.fullAutoActive = _internals33.hasActiveFullAuto();
|
|
57980
58071
|
return status;
|
|
57981
58072
|
}
|
|
57982
58073
|
function formatStatusMarkdown(status) {
|
|
@@ -58058,7 +58149,7 @@ async function handleStatusCommand(directory, agents) {
|
|
|
58058
58149
|
}
|
|
58059
58150
|
return formatStatusMarkdown(statusData);
|
|
58060
58151
|
}
|
|
58061
|
-
var
|
|
58152
|
+
var _internals33;
|
|
58062
58153
|
var init_status_service = __esm(() => {
|
|
58063
58154
|
init_extractors();
|
|
58064
58155
|
init_utils2();
|
|
@@ -58067,7 +58158,7 @@ var init_status_service = __esm(() => {
|
|
|
58067
58158
|
init_state3();
|
|
58068
58159
|
init_compaction_service();
|
|
58069
58160
|
init_context_budget_service();
|
|
58070
|
-
|
|
58161
|
+
_internals33 = {
|
|
58071
58162
|
loadLeanTurboRunState,
|
|
58072
58163
|
hasActiveLeanTurbo,
|
|
58073
58164
|
hasActiveFullAuto
|
|
@@ -58158,7 +58249,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
58158
58249
|
if (arg0 === "on") {
|
|
58159
58250
|
let strategy = "standard";
|
|
58160
58251
|
try {
|
|
58161
|
-
const { config: config3 } =
|
|
58252
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
58162
58253
|
if (config3.turbo?.strategy === "lean") {
|
|
58163
58254
|
strategy = "lean";
|
|
58164
58255
|
}
|
|
@@ -58213,7 +58304,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
58213
58304
|
let maxParallelCoders = 4;
|
|
58214
58305
|
let conflictPolicy = "serialize";
|
|
58215
58306
|
try {
|
|
58216
|
-
const { config: config3 } =
|
|
58307
|
+
const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
|
|
58217
58308
|
const leanConfig = config3.turbo?.lean;
|
|
58218
58309
|
if (leanConfig) {
|
|
58219
58310
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -58283,13 +58374,13 @@ function buildStatusMessage2(session, directory, sessionID) {
|
|
|
58283
58374
|
].join(`
|
|
58284
58375
|
`);
|
|
58285
58376
|
}
|
|
58286
|
-
var
|
|
58377
|
+
var _internals34;
|
|
58287
58378
|
var init_turbo = __esm(() => {
|
|
58288
58379
|
init_config();
|
|
58289
58380
|
init_state();
|
|
58290
58381
|
init_state3();
|
|
58291
58382
|
init_logger();
|
|
58292
|
-
|
|
58383
|
+
_internals34 = {
|
|
58293
58384
|
loadPluginConfigWithMeta
|
|
58294
58385
|
};
|
|
58295
58386
|
});
|
|
@@ -58382,7 +58473,7 @@ function formatCommandNotFound(tokens) {
|
|
|
58382
58473
|
const attemptedCommand = tokens[0] || "";
|
|
58383
58474
|
const MAX_DISPLAY = 100;
|
|
58384
58475
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
58385
|
-
const similar =
|
|
58476
|
+
const similar = _internals35.findSimilarCommands(attemptedCommand);
|
|
58386
58477
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
58387
58478
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
58388
58479
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -58889,7 +58980,7 @@ async function buildSwarmCommandPrompt(args) {
|
|
|
58889
58980
|
packageRoot,
|
|
58890
58981
|
registeredAgents
|
|
58891
58982
|
} = args;
|
|
58892
|
-
const resolved =
|
|
58983
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
58893
58984
|
if (!resolved) {
|
|
58894
58985
|
if (tokens.length === 0) {
|
|
58895
58986
|
return buildHelpText();
|
|
@@ -59057,7 +59148,7 @@ function findSimilarCommands(query) {
|
|
|
59057
59148
|
}
|
|
59058
59149
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
59059
59150
|
const cmdLower = cmd.toLowerCase();
|
|
59060
|
-
const fullScore =
|
|
59151
|
+
const fullScore = _internals35.levenshteinDistance(q, cmdLower);
|
|
59061
59152
|
let tokenScore = Infinity;
|
|
59062
59153
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
59063
59154
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -59070,7 +59161,7 @@ function findSimilarCommands(query) {
|
|
|
59070
59161
|
for (const ct of cmdTokens) {
|
|
59071
59162
|
if (ct.length === 0)
|
|
59072
59163
|
continue;
|
|
59073
|
-
const dist =
|
|
59164
|
+
const dist = _internals35.levenshteinDistance(qt, ct);
|
|
59074
59165
|
if (dist < minDist)
|
|
59075
59166
|
minDist = dist;
|
|
59076
59167
|
}
|
|
@@ -59080,7 +59171,7 @@ function findSimilarCommands(query) {
|
|
|
59080
59171
|
}
|
|
59081
59172
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
59082
59173
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
59083
|
-
const dashScore =
|
|
59174
|
+
const dashScore = _internals35.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
59084
59175
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
59085
59176
|
return { cmd, score };
|
|
59086
59177
|
});
|
|
@@ -59112,11 +59203,11 @@ async function handleHelpCommand(ctx) {
|
|
|
59112
59203
|
return buildHelpText2();
|
|
59113
59204
|
}
|
|
59114
59205
|
const tokens = targetCommand.split(/\s+/);
|
|
59115
|
-
const resolved =
|
|
59206
|
+
const resolved = _internals35.resolveCommand(tokens);
|
|
59116
59207
|
if (resolved) {
|
|
59117
|
-
return
|
|
59208
|
+
return _internals35.buildDetailedHelp(resolved.key, resolved.entry);
|
|
59118
59209
|
}
|
|
59119
|
-
const similar =
|
|
59210
|
+
const similar = _internals35.findSimilarCommands(targetCommand);
|
|
59120
59211
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
59121
59212
|
if (similar.length > 0) {
|
|
59122
59213
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -59216,7 +59307,7 @@ function resolveCommand(tokens) {
|
|
|
59216
59307
|
}
|
|
59217
59308
|
return null;
|
|
59218
59309
|
}
|
|
59219
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
59310
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals35, validation;
|
|
59220
59311
|
var init_registry = __esm(() => {
|
|
59221
59312
|
init_bundled_skills();
|
|
59222
59313
|
init_acknowledge_spec_drift();
|
|
@@ -59292,7 +59383,7 @@ var init_registry = __esm(() => {
|
|
|
59292
59383
|
clashesWithNativeCcCommand: "/agents"
|
|
59293
59384
|
},
|
|
59294
59385
|
help: {
|
|
59295
|
-
handler: (ctx) =>
|
|
59386
|
+
handler: (ctx) => _internals35.handleHelpCommand(ctx),
|
|
59296
59387
|
description: "Show help for swarm commands",
|
|
59297
59388
|
category: "core",
|
|
59298
59389
|
args: "[command]",
|
|
@@ -59595,7 +59686,7 @@ Subcommands:
|
|
|
59595
59686
|
handler: (ctx) => handleQaGatesCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
59596
59687
|
description: "View or modify QA gate profile for the current plan [enable|override <gate>...]",
|
|
59597
59688
|
args: "[show|enable|override] <gate>...",
|
|
59598
|
-
details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled, mutation_test,
|
|
59689
|
+
details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled, mutation_test, phase_council, drift_check, final_council.",
|
|
59599
59690
|
category: "config"
|
|
59600
59691
|
},
|
|
59601
59692
|
promote: {
|
|
@@ -59784,7 +59875,7 @@ Subcommands:
|
|
|
59784
59875
|
}
|
|
59785
59876
|
};
|
|
59786
59877
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
59787
|
-
|
|
59878
|
+
_internals35 = {
|
|
59788
59879
|
handleHelpCommand,
|
|
59789
59880
|
validateAliases,
|
|
59790
59881
|
resolveCommand,
|
|
@@ -59792,7 +59883,7 @@ Subcommands:
|
|
|
59792
59883
|
findSimilarCommands,
|
|
59793
59884
|
buildDetailedHelp
|
|
59794
59885
|
};
|
|
59795
|
-
validation =
|
|
59886
|
+
validation = _internals35.validateAliases();
|
|
59796
59887
|
if (!validation.valid) {
|
|
59797
59888
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
59798
59889
|
${validation.errors.join(`
|
|
@@ -59811,7 +59902,7 @@ init_registry();
|
|
|
59811
59902
|
init_cache_paths();
|
|
59812
59903
|
init_constants();
|
|
59813
59904
|
import * as fs32 from "fs";
|
|
59814
|
-
import * as
|
|
59905
|
+
import * as os9 from "os";
|
|
59815
59906
|
import * as path56 from "path";
|
|
59816
59907
|
var { version: version5 } = package_default;
|
|
59817
59908
|
var CONFIG_DIR = getPluginConfigDir();
|
|
@@ -59822,7 +59913,7 @@ var OPENCODE_PLUGIN_CACHE_PATHS = getPluginCachePaths();
|
|
|
59822
59913
|
var OPENCODE_PLUGIN_LOCK_FILE_PATHS = getPluginLockFilePaths();
|
|
59823
59914
|
function isSafeCachePath(p) {
|
|
59824
59915
|
const resolved = path56.resolve(p);
|
|
59825
|
-
const home = path56.resolve(
|
|
59916
|
+
const home = path56.resolve(os9.homedir());
|
|
59826
59917
|
if (resolved === "/" || resolved === home || resolved.length <= home.length) {
|
|
59827
59918
|
return false;
|
|
59828
59919
|
}
|
|
@@ -59846,7 +59937,7 @@ function isSafeCachePath(p) {
|
|
|
59846
59937
|
}
|
|
59847
59938
|
function isSafeLockFilePath(p) {
|
|
59848
59939
|
const resolved = path56.resolve(p);
|
|
59849
|
-
const home = path56.resolve(
|
|
59940
|
+
const home = path56.resolve(os9.homedir());
|
|
59850
59941
|
if (resolved === "/" || resolved === home || resolved.length <= home.length) {
|
|
59851
59942
|
return false;
|
|
59852
59943
|
}
|