opencode-swarm 6.40.1 → 6.40.2
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 +28 -18
- package/dist/index.js +4462 -4439
- package/dist/quality/index.d.ts +1 -1
- package/dist/quality/metrics.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$/
|
|
@@ -33770,6 +33779,7 @@ import { renameSync as renameSync4 } from "fs";
|
|
|
33770
33779
|
// src/services/handoff-service.ts
|
|
33771
33780
|
init_utils2();
|
|
33772
33781
|
init_manager2();
|
|
33782
|
+
init_utils();
|
|
33773
33783
|
var RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
33774
33784
|
var MAX_TASK_ID_LENGTH = 100;
|
|
33775
33785
|
var MAX_DECISION_LENGTH = 500;
|
|
@@ -33886,7 +33896,10 @@ function parseSessionState(content) {
|
|
|
33886
33896
|
}
|
|
33887
33897
|
}
|
|
33888
33898
|
return { activeAgent, delegationState, pendingQA };
|
|
33889
|
-
} catch {
|
|
33899
|
+
} catch (error93) {
|
|
33900
|
+
log("[HandoffService] state extraction failed", {
|
|
33901
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
33902
|
+
});
|
|
33890
33903
|
return null;
|
|
33891
33904
|
}
|
|
33892
33905
|
}
|
|
@@ -34068,8 +34081,8 @@ function formatHandoffMarkdown(data) {
|
|
|
34068
34081
|
init_utils2();
|
|
34069
34082
|
import { mkdirSync as mkdirSync4, renameSync as renameSync3 } from "fs";
|
|
34070
34083
|
import * as path14 from "path";
|
|
34071
|
-
|
|
34072
|
-
var
|
|
34084
|
+
init_utils();
|
|
34085
|
+
var _writeInFlight = Promise.resolve();
|
|
34073
34086
|
function serializeAgentSession(s) {
|
|
34074
34087
|
const gateLog = {};
|
|
34075
34088
|
const rawGateLog = s.gateLog ?? new Map;
|
|
@@ -34159,19 +34172,14 @@ async function writeSnapshot(directory, state) {
|
|
|
34159
34172
|
await Bun.write(tempPath, content);
|
|
34160
34173
|
renameSync3(tempPath, resolvedPath);
|
|
34161
34174
|
} catch (error93) {
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
}
|
|
34175
|
+
log("[snapshot-writer] write failed", {
|
|
34176
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
34177
|
+
});
|
|
34165
34178
|
}
|
|
34166
34179
|
}
|
|
34167
34180
|
async function flushPendingSnapshot(directory) {
|
|
34168
|
-
|
|
34169
|
-
|
|
34170
|
-
pendingWrite = null;
|
|
34171
|
-
await writeSnapshot(directory, swarmState).catch(() => {});
|
|
34172
|
-
} else {
|
|
34173
|
-
await lastWritePromise;
|
|
34174
|
-
}
|
|
34181
|
+
_writeInFlight = _writeInFlight.then(() => writeSnapshot(directory, swarmState), () => writeSnapshot(directory, swarmState));
|
|
34182
|
+
await _writeInFlight;
|
|
34175
34183
|
}
|
|
34176
34184
|
|
|
34177
34185
|
// src/commands/handoff.ts
|
|
@@ -38886,17 +38894,19 @@ class CircuitBreaker {
|
|
|
38886
38894
|
this.successCount = 0;
|
|
38887
38895
|
this.onStateChange?.("closed", {
|
|
38888
38896
|
timestamp: Date.now(),
|
|
38889
|
-
successCount: 0
|
|
38897
|
+
successCount: 0,
|
|
38898
|
+
oldState
|
|
38890
38899
|
});
|
|
38891
38900
|
} else if (newState === "open") {
|
|
38892
38901
|
this.successCount = 0;
|
|
38893
38902
|
this.onStateChange?.("opened", {
|
|
38894
38903
|
timestamp: Date.now(),
|
|
38895
|
-
failureCount: this.failureCount
|
|
38904
|
+
failureCount: this.failureCount,
|
|
38905
|
+
oldState
|
|
38896
38906
|
});
|
|
38897
38907
|
} else if (newState === "half-open") {
|
|
38898
38908
|
this.successCount = 0;
|
|
38899
|
-
this.onStateChange?.("half-open", { timestamp: Date.now() });
|
|
38909
|
+
this.onStateChange?.("half-open", { timestamp: Date.now(), oldState });
|
|
38900
38910
|
}
|
|
38901
38911
|
}
|
|
38902
38912
|
reset() {
|