opencode-swarm 6.40.1 → 6.40.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/index.js +36 -24
- package/dist/index.js +3896 -3870
- package/dist/quality/index.d.ts +1 -1
- package/dist/quality/metrics.d.ts +5 -0
- package/dist/services/handoff-service.d.ts +5 -0
- package/dist/session/snapshot-writer.d.ts +4 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16671,13 +16671,21 @@ function createConfigBackup(directory) {
|
|
|
16671
16671
|
if (fs4.existsSync(projectConfigPath)) {
|
|
16672
16672
|
try {
|
|
16673
16673
|
content = fs4.readFileSync(projectConfigPath, "utf-8");
|
|
16674
|
-
} catch {
|
|
16674
|
+
} catch (error93) {
|
|
16675
|
+
log("[ConfigDoctor] project config read failed", {
|
|
16676
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
16677
|
+
});
|
|
16678
|
+
}
|
|
16675
16679
|
}
|
|
16676
16680
|
if (content === null && fs4.existsSync(userConfigPath)) {
|
|
16677
16681
|
configPath = userConfigPath;
|
|
16678
16682
|
try {
|
|
16679
16683
|
content = fs4.readFileSync(userConfigPath, "utf-8");
|
|
16680
|
-
} catch {
|
|
16684
|
+
} catch (error93) {
|
|
16685
|
+
log("[ConfigDoctor] user config read failed", {
|
|
16686
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
16687
|
+
});
|
|
16688
|
+
}
|
|
16681
16689
|
}
|
|
16682
16690
|
if (content === null) {
|
|
16683
16691
|
return null;
|
|
@@ -17228,6 +17236,7 @@ async function runConfigDoctorWithFixes(directory, config3, autoFix = false) {
|
|
|
17228
17236
|
}
|
|
17229
17237
|
var VALID_CONFIG_PATTERNS, DANGEROUS_PATH_SEGMENTS;
|
|
17230
17238
|
var init_config_doctor = __esm(() => {
|
|
17239
|
+
init_utils();
|
|
17231
17240
|
VALID_CONFIG_PATTERNS = [
|
|
17232
17241
|
/^\.config[\\/]opencode[\\/]opencode-swarm\.json$/,
|
|
17233
17242
|
/\.opencode[\\/]opencode-swarm\.json$/
|
|
@@ -18227,7 +18236,7 @@ var KnowledgeConfigSchema = exports_external.object({
|
|
|
18227
18236
|
max_encounter_score: exports_external.number().min(1).max(20).default(10)
|
|
18228
18237
|
});
|
|
18229
18238
|
var CuratorConfigSchema = exports_external.object({
|
|
18230
|
-
enabled: exports_external.boolean().default(
|
|
18239
|
+
enabled: exports_external.boolean().default(false),
|
|
18231
18240
|
init_enabled: exports_external.boolean().default(true),
|
|
18232
18241
|
phase_enabled: exports_external.boolean().default(true),
|
|
18233
18242
|
max_summary_tokens: exports_external.number().min(500).max(8000).default(2000),
|
|
@@ -32435,16 +32444,18 @@ function formatCurationSummary(summary) {
|
|
|
32435
32444
|
import path10 from "path";
|
|
32436
32445
|
|
|
32437
32446
|
// src/tools/co-change-analyzer.ts
|
|
32438
|
-
import
|
|
32447
|
+
import * as child_process from "child_process";
|
|
32439
32448
|
import { randomUUID } from "crypto";
|
|
32440
32449
|
import { readdir, readFile as readFile2, stat } from "fs/promises";
|
|
32441
32450
|
import * as path9 from "path";
|
|
32442
32451
|
import { promisify } from "util";
|
|
32443
|
-
|
|
32452
|
+
function getExecFileAsync() {
|
|
32453
|
+
return promisify(child_process.execFile);
|
|
32454
|
+
}
|
|
32444
32455
|
async function parseGitLog(directory, maxCommits) {
|
|
32445
32456
|
const commitMap = new Map;
|
|
32446
32457
|
try {
|
|
32447
|
-
const { stdout } = await
|
|
32458
|
+
const { stdout } = await getExecFileAsync()("git", [
|
|
32448
32459
|
"log",
|
|
32449
32460
|
"--name-only",
|
|
32450
32461
|
"--pretty=format:COMMIT:%H",
|
|
@@ -32643,7 +32654,7 @@ async function detectDarkMatter(directory, options) {
|
|
|
32643
32654
|
const npmiThreshold = options?.npmiThreshold ?? 0.5;
|
|
32644
32655
|
const maxCommitsToAnalyze = options?.maxCommitsToAnalyze ?? 500;
|
|
32645
32656
|
try {
|
|
32646
|
-
const { stdout } = await
|
|
32657
|
+
const { stdout } = await getExecFileAsync()("git", ["rev-list", "--count", "HEAD"], {
|
|
32647
32658
|
cwd: directory,
|
|
32648
32659
|
timeout: 1e4
|
|
32649
32660
|
});
|
|
@@ -32803,7 +32814,7 @@ async function handleDarkMatterCommand(directory, args) {
|
|
|
32803
32814
|
[${entries.length} dark matter finding(s) saved to .swarm/knowledge.jsonl]`;
|
|
32804
32815
|
}
|
|
32805
32816
|
} catch (err) {
|
|
32806
|
-
console.warn("dark-matter: failed to save knowledge entries:", err
|
|
32817
|
+
console.warn("dark-matter: failed to save knowledge entries:", err);
|
|
32807
32818
|
return output;
|
|
32808
32819
|
}
|
|
32809
32820
|
}
|
|
@@ -33770,6 +33781,7 @@ import { renameSync as renameSync4 } from "fs";
|
|
|
33770
33781
|
// src/services/handoff-service.ts
|
|
33771
33782
|
init_utils2();
|
|
33772
33783
|
init_manager2();
|
|
33784
|
+
init_utils();
|
|
33773
33785
|
var RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
33774
33786
|
var MAX_TASK_ID_LENGTH = 100;
|
|
33775
33787
|
var MAX_DECISION_LENGTH = 500;
|
|
@@ -33886,7 +33898,10 @@ function parseSessionState(content) {
|
|
|
33886
33898
|
}
|
|
33887
33899
|
}
|
|
33888
33900
|
return { activeAgent, delegationState, pendingQA };
|
|
33889
|
-
} catch {
|
|
33901
|
+
} catch (error93) {
|
|
33902
|
+
log("[HandoffService] state extraction failed", {
|
|
33903
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
33904
|
+
});
|
|
33890
33905
|
return null;
|
|
33891
33906
|
}
|
|
33892
33907
|
}
|
|
@@ -34068,8 +34083,8 @@ function formatHandoffMarkdown(data) {
|
|
|
34068
34083
|
init_utils2();
|
|
34069
34084
|
import { mkdirSync as mkdirSync4, renameSync as renameSync3 } from "fs";
|
|
34070
34085
|
import * as path14 from "path";
|
|
34071
|
-
|
|
34072
|
-
var
|
|
34086
|
+
init_utils();
|
|
34087
|
+
var _writeInFlight = Promise.resolve();
|
|
34073
34088
|
function serializeAgentSession(s) {
|
|
34074
34089
|
const gateLog = {};
|
|
34075
34090
|
const rawGateLog = s.gateLog ?? new Map;
|
|
@@ -34159,19 +34174,14 @@ async function writeSnapshot(directory, state) {
|
|
|
34159
34174
|
await Bun.write(tempPath, content);
|
|
34160
34175
|
renameSync3(tempPath, resolvedPath);
|
|
34161
34176
|
} catch (error93) {
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
}
|
|
34177
|
+
log("[snapshot-writer] write failed", {
|
|
34178
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
34179
|
+
});
|
|
34165
34180
|
}
|
|
34166
34181
|
}
|
|
34167
34182
|
async function flushPendingSnapshot(directory) {
|
|
34168
|
-
|
|
34169
|
-
|
|
34170
|
-
pendingWrite = null;
|
|
34171
|
-
await writeSnapshot(directory, swarmState).catch(() => {});
|
|
34172
|
-
} else {
|
|
34173
|
-
await lastWritePromise;
|
|
34174
|
-
}
|
|
34183
|
+
_writeInFlight = _writeInFlight.then(() => writeSnapshot(directory, swarmState), () => writeSnapshot(directory, swarmState));
|
|
34184
|
+
await _writeInFlight;
|
|
34175
34185
|
}
|
|
34176
34186
|
|
|
34177
34187
|
// src/commands/handoff.ts
|
|
@@ -38886,17 +38896,19 @@ class CircuitBreaker {
|
|
|
38886
38896
|
this.successCount = 0;
|
|
38887
38897
|
this.onStateChange?.("closed", {
|
|
38888
38898
|
timestamp: Date.now(),
|
|
38889
|
-
successCount: 0
|
|
38899
|
+
successCount: 0,
|
|
38900
|
+
oldState
|
|
38890
38901
|
});
|
|
38891
38902
|
} else if (newState === "open") {
|
|
38892
38903
|
this.successCount = 0;
|
|
38893
38904
|
this.onStateChange?.("opened", {
|
|
38894
38905
|
timestamp: Date.now(),
|
|
38895
|
-
failureCount: this.failureCount
|
|
38906
|
+
failureCount: this.failureCount,
|
|
38907
|
+
oldState
|
|
38896
38908
|
});
|
|
38897
38909
|
} else if (newState === "half-open") {
|
|
38898
38910
|
this.successCount = 0;
|
|
38899
|
-
this.onStateChange?.("half-open", { timestamp: Date.now() });
|
|
38911
|
+
this.onStateChange?.("half-open", { timestamp: Date.now(), oldState });
|
|
38900
38912
|
}
|
|
38901
38913
|
}
|
|
38902
38914
|
reset() {
|