opencode-swarm 7.87.1 → 7.87.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{evidence-summary-service-gg5m9z57.js → evidence-summary-service-5me91eq8.js} +1 -1
- package/dist/cli/{guardrail-explain-scym5r5y.js → guardrail-explain-2q9myk7c.js} +4 -4
- package/dist/cli/{index-s8bj492g.js → index-32axfg6h.js} +23 -7
- package/dist/cli/{index-89xjr3h4.js → index-8y7qetpg.js} +48 -19
- package/dist/cli/{index-ts2j1wjr.js → index-amwa268r.js} +1 -1
- package/dist/cli/{index-gwzpy671.js → index-kz1bmebr.js} +694 -322
- package/dist/cli/{index-dsjyfd3g.js → index-r3f47swm.js} +4 -4
- package/dist/cli/index.js +3 -3
- package/dist/cli/{skill-generator-3pvpk4y2.js → skill-generator-kz4q8e49.js} +3 -1
- package/dist/commands/close.d.ts +6 -0
- package/dist/git/branch.d.ts +5 -0
- package/dist/git/pr.d.ts +18 -0
- package/dist/hooks/knowledge-reader.d.ts +2 -0
- package/dist/hooks/knowledge-types.d.ts +3 -0
- package/dist/index.js +1281 -850
- package/dist/services/skill-generator.d.ts +10 -0
- package/dist/services/skill-improver.d.ts +25 -1
- package/dist/tools/checkpoint.d.ts +1 -0
- package/dist/utils/transient-retry.d.ts +30 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-amwa268r.js";
|
|
5
|
+
import"./index-kz1bmebr.js";
|
|
6
6
|
import"./index-5hvbw5xh.js";
|
|
7
7
|
import"./index-yhsmmv2z.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-32axfg6h.js";
|
|
9
9
|
import"./index-e8pk68cc.js";
|
|
10
10
|
import"./index-1cb4wxnm.js";
|
|
11
11
|
import"./index-q9h0wb04.js";
|
|
12
|
-
import"./index-
|
|
12
|
+
import"./index-8y7qetpg.js";
|
|
13
13
|
import"./index-adz3nk9b.js";
|
|
14
14
|
import"./index-v4fcn4tr.js";
|
|
15
15
|
import"./index-e7h9bb6v.js";
|
|
@@ -152,7 +152,13 @@ async function readCounterBaseline(directory) {
|
|
|
152
152
|
const filePath = resolveKnowledgeCounterBaselinePath(directory);
|
|
153
153
|
if (!existsSync(filePath))
|
|
154
154
|
return new Map;
|
|
155
|
-
|
|
155
|
+
let raw;
|
|
156
|
+
try {
|
|
157
|
+
raw = JSON.parse(await readFile(filePath, "utf-8"));
|
|
158
|
+
} catch (err) {
|
|
159
|
+
warn(`[knowledge-events] corrupted counter baseline at ${filePath}; ignoring folded baseline and replaying live events only: ${err instanceof Error ? err.message : String(err)}`);
|
|
160
|
+
return new Map;
|
|
161
|
+
}
|
|
156
162
|
const map = new Map;
|
|
157
163
|
for (const [id, rollup] of Object.entries(raw)) {
|
|
158
164
|
map.set(id, normalizeRollupTimestamps(cloneRollup(rollup)));
|
|
@@ -309,9 +315,12 @@ function effectiveRetrievalOutcomes(stored, rollup) {
|
|
|
309
315
|
};
|
|
310
316
|
if (!rollup)
|
|
311
317
|
return base;
|
|
318
|
+
const { n_a_count: _na, ...rollupWithoutNa } = rollup;
|
|
312
319
|
return {
|
|
313
320
|
...base,
|
|
314
|
-
...
|
|
321
|
+
...rollupWithoutNa,
|
|
322
|
+
succeeded_after_shown_count: (base.succeeded_after_shown_count ?? 0) + (rollup.succeeded_after_shown_count ?? 0),
|
|
323
|
+
failed_after_shown_count: (base.failed_after_shown_count ?? 0) + (rollup.failed_after_shown_count ?? 0)
|
|
315
324
|
};
|
|
316
325
|
}
|
|
317
326
|
|
|
@@ -1359,6 +1368,7 @@ function activeRepoRelativePath(slug) {
|
|
|
1359
1368
|
var DEFAULT_SKILL_MIN_CONFIDENCE = 0.7;
|
|
1360
1369
|
var DEFAULT_SKILL_MIN_CONFIRMATIONS = 2;
|
|
1361
1370
|
var STRONG_SKILL_OUTCOME_COUNT = 3;
|
|
1371
|
+
var HIGH_PRIORITY_SKILL_MIN_CONFIDENCE = 0.6;
|
|
1362
1372
|
async function selectCandidateEntries(directory, opts) {
|
|
1363
1373
|
const swarm = await readKnowledge(resolveSwarmKnowledgePath(directory));
|
|
1364
1374
|
const hivePath = resolveHiveKnowledgePath();
|
|
@@ -1391,10 +1401,12 @@ function isSkillMaturityEligible(entry, opts, outcomes = entry.retrieval_outcome
|
|
|
1391
1401
|
const strongOutcomes = hasStrongSkillOutcomeRecord(outcomes);
|
|
1392
1402
|
if (outcomeSignal > 0 && strongOutcomes)
|
|
1393
1403
|
return true;
|
|
1394
|
-
if (entry.confidence < opts.minConfidence && !strongOutcomes)
|
|
1395
|
-
return false;
|
|
1396
1404
|
const distinctPhases = new Set((entry.confirmed_by ?? []).map((c) => c.phase_number).filter((p) => typeof p === "number")).size;
|
|
1397
|
-
|
|
1405
|
+
const highPriorityPath = isHighPriorityDirective(entry) && distinctPhases >= 1 && entry.confidence >= HIGH_PRIORITY_SKILL_MIN_CONFIDENCE;
|
|
1406
|
+
if (entry.confidence < opts.minConfidence && !strongOutcomes && !highPriorityPath) {
|
|
1407
|
+
return false;
|
|
1408
|
+
}
|
|
1409
|
+
return distinctPhases >= opts.minConfirmations || strongOutcomes || highPriorityPath;
|
|
1398
1410
|
}
|
|
1399
1411
|
var MIN_CLUSTER_SIZE = 2;
|
|
1400
1412
|
var JACCARD_THRESHOLD = 0.5;
|
|
@@ -1591,7 +1603,11 @@ async function generateSkills(req) {
|
|
|
1591
1603
|
const swarm = await readKnowledge(resolveSwarmKnowledgePath(req.directory));
|
|
1592
1604
|
const hivePath = resolveHiveKnowledgePath();
|
|
1593
1605
|
const hive = existsSync3(hivePath) ? await readKnowledge(hivePath) : [];
|
|
1594
|
-
|
|
1606
|
+
const rollups = await readKnowledgeCounterRollups(req.directory);
|
|
1607
|
+
pool = [...swarm, ...hive].filter((e) => idSet.has(e.id) && e.status !== "archived").map((e) => ({
|
|
1608
|
+
...e,
|
|
1609
|
+
retrieval_outcomes: effectiveRetrievalOutcomes(e.retrieval_outcomes, rollups.get(e.id))
|
|
1610
|
+
}));
|
|
1595
1611
|
} else {
|
|
1596
1612
|
pool = candidates;
|
|
1597
1613
|
}
|
|
@@ -2311,4 +2327,4 @@ var _internals = {
|
|
|
2311
2327
|
unlinkSync
|
|
2312
2328
|
};
|
|
2313
2329
|
|
|
2314
|
-
export { resolveKnowledgeEventsPath, readKnowledgeEvents, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, validateLesson, validateActionableFields, validateActionability, resolveUnactionablePath, appendUnactionable, quarantineEntry, restoreEntry, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, listSkills, autoApplyProposals, inspectSkill, retireSkill, regenerateSkill, _internals };
|
|
2330
|
+
export { resolveKnowledgeEventsPath, readKnowledgeEvents, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, validateLesson, validateActionableFields, validateActionability, resolveUnactionablePath, appendUnactionable, quarantineEntry, restoreEntry, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, listSkills, autoApplyProposals, inspectSkill, retireSkill, regenerateSkill, _internals };
|
|
@@ -122,6 +122,27 @@ function isGitBinaryMissing(err) {
|
|
|
122
122
|
|
|
123
123
|
// src/git/branch.ts
|
|
124
124
|
init_logger();
|
|
125
|
+
|
|
126
|
+
// src/utils/transient-retry.ts
|
|
127
|
+
var MAX_TRANSIENT_RETRIES = 5;
|
|
128
|
+
var RETRY_BASE_DELAY_MS = 200;
|
|
129
|
+
function isTransientSpawnError(error2) {
|
|
130
|
+
if (!error2 || typeof error2 !== "object")
|
|
131
|
+
return false;
|
|
132
|
+
const code = error2.code;
|
|
133
|
+
return code === "ETIMEDOUT";
|
|
134
|
+
}
|
|
135
|
+
function transientBackoff(attempt) {
|
|
136
|
+
const delay = RETRY_BASE_DELAY_MS * 2 ** attempt;
|
|
137
|
+
try {
|
|
138
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, delay);
|
|
139
|
+
} catch {
|
|
140
|
+
const start = Date.now();
|
|
141
|
+
while (Date.now() - start < delay) {}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/git/branch.ts
|
|
125
146
|
var GIT_TIMEOUT_MS = 30000;
|
|
126
147
|
var GIT_MAX_BUFFER_BYTES = 5 * 1024 * 1024;
|
|
127
148
|
function unique(values) {
|
|
@@ -153,26 +174,34 @@ function gitExec(args, cwd) {
|
|
|
153
174
|
const subcommand = args[0];
|
|
154
175
|
const hardenedArgs = subcommand === "commit" || subcommand === "tag" ? ["-c", "commit.gpgsign=false", "-c", "tag.gpgsign=false", ...args] : args;
|
|
155
176
|
for (const command of windowsGitCandidates()) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
for (let attempt = 0;attempt < MAX_TRANSIENT_RETRIES; attempt++) {
|
|
178
|
+
const result = child_process.spawnSync(command, hardenedArgs, {
|
|
179
|
+
cwd,
|
|
180
|
+
encoding: "utf-8",
|
|
181
|
+
timeout: GIT_TIMEOUT_MS,
|
|
182
|
+
windowsHide: true,
|
|
183
|
+
maxBuffer: GIT_MAX_BUFFER_BYTES,
|
|
184
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
185
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
186
|
+
});
|
|
187
|
+
if (!result.error && result.status === 0) {
|
|
188
|
+
return result.stdout;
|
|
189
|
+
}
|
|
190
|
+
if (result.error) {
|
|
191
|
+
if (isGitBinaryMissing(result.error)) {
|
|
192
|
+
missingGitError ??= result.error;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
if (isTransientSpawnError(result.error) && attempt < MAX_TRANSIENT_RETRIES - 1) {
|
|
196
|
+
transientBackoff(attempt);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
throw new Error(errorMessage(result.error));
|
|
200
|
+
}
|
|
201
|
+
if (result.status !== 0) {
|
|
202
|
+
throw new Error(result.stderr || result.stdout || `git exited with ${result.status}`);
|
|
169
203
|
}
|
|
170
|
-
throw new Error(errorMessage(result.error));
|
|
171
|
-
}
|
|
172
|
-
if (result.status !== 0) {
|
|
173
|
-
throw new Error(result.stderr || result.stdout || `git exited with ${result.status}`);
|
|
174
204
|
}
|
|
175
|
-
return result.stdout;
|
|
176
205
|
}
|
|
177
206
|
throw new GitBinaryMissingError(process.platform === "win32" ? "git executable is not available on PATH or common Windows install locations" : "git executable is not available on PATH", { cause: missingGitError });
|
|
178
207
|
}
|
|
@@ -3859,4 +3888,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
|
|
|
3859
3888
|
return merged;
|
|
3860
3889
|
}
|
|
3861
3890
|
|
|
3862
|
-
export { PlanSchema, getGitRepositoryStatus, isGitRepo, resetToRemoteBranch, resetToMainAfterMerge, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, computeSpecHash, derivePlanId, computePlanHash, initLedger, appendLedgerEvent, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, RetrospectiveEvidenceSchema, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
3891
|
+
export { PlanSchema, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, resetToRemoteBranch, resetToMainAfterMerge, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, computeSpecHash, derivePlanId, computePlanHash, initLedger, appendLedgerEvent, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, RetrospectiveEvidenceSchema, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|