opencode-swarm 7.107.6 → 7.108.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/dist/cli/{capability-probe-wsjzcp48.js → capability-probe-sh9bwh39.js} +2 -1
- package/dist/cli/{config-doctor-kdq3vae4.js → config-doctor-q354tb2w.js} +2 -2
- package/dist/cli/core-vev13ej2.js +34 -0
- package/dist/cli/{curator-drift-ed7p5mfy.js → curator-drift-fdfgj9qf.js} +3 -3
- package/dist/cli/{curator-jpwvkpdv.js → curator-js92gc8a.js} +24 -20
- package/dist/cli/curator-llm-factory-n70bxf40.js +40 -0
- package/dist/cli/{dispatch-anmxxhen.js → dispatch-zr1xja4t.js} +2 -2
- package/dist/cli/{evidence-summary-service-6zsgw7x7.js → evidence-summary-service-bjhr75v0.js} +9 -7
- package/dist/cli/{gate-evidence-pgr7d942.js → gate-evidence-v6ds8rcp.js} +5 -4
- package/dist/cli/guardrail-explain-sn2a4pb7.js +41 -0
- package/dist/cli/{guardrail-log-fjypsmek.js → guardrail-log-8mqqsssq.js} +4 -4
- package/dist/cli/hive-promoter-3hh8ph4a.js +48 -0
- package/dist/cli/{index-9b7qp18e.js → index-1cn967sa.js} +2 -2
- package/dist/cli/{index-572t1qff.js → index-1emhz3zb.js} +1378 -2013
- package/dist/cli/{index-n1sptn1w.js → index-2nt4mq9n.js} +1 -1
- package/dist/cli/{index-6h82c2h0.js → index-48mc4d48.js} +1056 -192
- package/dist/cli/{index-bq8kd9r9.js → index-5gnp8fyw.js} +3 -3
- package/dist/cli/index-5mkc2f9z.js +154 -0
- package/dist/cli/{index-0kxc7t16.js → index-6jng9c8t.js} +1 -1
- package/dist/cli/{index-57rthc1z.js → index-7jyndvsy.js} +2 -2
- package/dist/cli/{index-b9v501fr.js → index-7xgqky26.js} +33 -5
- package/dist/cli/{index-4r5z8sgw.js → index-85bacexr.js} +2 -2
- package/dist/cli/{index-bpgqbwmf.js → index-9qxntjtx.js} +6 -6
- package/dist/cli/index-f1qyj61w.js +418 -0
- package/dist/cli/{index-wvxhynxq.js → index-fm7xz1ne.js} +1 -1
- package/dist/cli/{index-dfdg4ws5.js → index-fz1jgbvw.js} +6 -6
- package/dist/cli/{index-pchpahdf.js → index-h4c4rrwx.js} +20 -3
- package/dist/cli/{index-kxm3bdjh.js → index-mmny81g1.js} +6 -6
- package/dist/cli/{index-v4fcn4tr.js → index-q1exe2b3.js} +2 -198
- package/dist/cli/{index-57ymmh7h.js → index-r3j3458j.js} +4 -4
- package/dist/cli/{index-3naa2ajc.js → index-vvk2g744.js} +10 -156
- package/dist/cli/{index-zej8cy0j.js → index-vx76tcxe.js} +1 -1
- package/dist/cli/{index-xmarctsf.js → index-wg0665ft.js} +7 -7
- package/dist/cli/{index-4vsgp5a8.js → index-wj4jeavn.js} +1 -1
- package/dist/cli/index-wvrj16f0.js +206 -0
- package/dist/cli/{index-h28wfp7n.js → index-x06d2qqm.js} +28 -24
- package/dist/cli/index-x2q0gnt8.js +254 -0
- package/dist/cli/{index-xg18az81.js → index-yw8qpf51.js} +1 -1
- package/dist/cli/index.js +24 -20
- package/dist/cli/{knowledge-escalator-3sgwrgy9.js → knowledge-escalator-6v7sjprx.js} +8 -7
- package/dist/cli/{knowledge-events-kfc6xmkw.js → knowledge-events-6n3x3he2.js} +6 -5
- package/dist/cli/{knowledge-store-kyacem71.js → knowledge-store-exkw6yb1.js} +6 -5
- package/dist/cli/{knowledge-validator-ez3ws8ef.js → knowledge-validator-exymfcb9.js} +7 -6
- package/dist/cli/{pending-delegations-vfnpm8zt.js → pending-delegations-yyz3fcfn.js} +5 -4
- package/dist/cli/{pr-subscriptions-bpvazmsw.js → pr-subscriptions-vv8byxe6.js} +6 -5
- package/dist/cli/{schema-x0ekqzvs.js → schema-x17zmd03.js} +1 -1
- package/dist/cli/scope-persistence-6m5nsp1r.js +20 -0
- package/dist/cli/{skill-generator-x83re96d.js → skill-generator-mx9br4ty.js} +9 -8
- package/dist/commands/_shared/url-security.d.ts +13 -3
- package/dist/commands/close.d.ts +11 -0
- package/dist/commands/lanes.d.ts +35 -0
- package/dist/commands/registry.d.ts +7 -0
- package/dist/config/schema.d.ts +102 -0
- package/dist/git/branch.d.ts +53 -7
- package/dist/git/index.d.ts +5 -1
- package/dist/git/pr.d.ts +35 -2
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +118 -2
- package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +17 -0
- package/dist/hooks/init-orphan-recovery-advisory.d.ts +58 -0
- package/dist/hooks/init-orphan-recovery.d.ts +65 -0
- package/dist/index.js +427 -416
- package/dist/sandbox/executor.d.ts +11 -1
- package/dist/sandbox/linux/bubblewrap-executor.d.ts +3 -1
- package/dist/sandbox/macos/sandbox-exec-executor.d.ts +3 -1
- package/dist/sandbox/win32/native-sandbox-executor.d.ts +1 -1
- package/dist/sandbox/win32/restricted-environment-executor.d.ts +4 -1
- package/dist/turbo/lean/runner.d.ts +11 -20
- package/dist/turbo/lean/worktree.d.ts +9 -3
- package/dist/utils/bun-compat.d.ts +30 -0
- package/dist/worktree/core.d.ts +55 -0
- package/dist/worktree/merge.d.ts +5 -1
- package/dist/worktree/types.d.ts +38 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-9y15npd5.js +0 -36
- package/dist/cli/guardrail-explain-jk0amzae.js +0 -37
- package/dist/cli/hive-promoter-j2krbdn9.js +0 -44
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
countEntryViolationsInWindow,
|
|
5
5
|
readKnowledgeEvents,
|
|
6
6
|
recordKnowledgeEvent
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-mmny81g1.js";
|
|
8
8
|
import {
|
|
9
9
|
jaccardBigram,
|
|
10
10
|
readKnowledge,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveSwarmKnowledgePath,
|
|
13
13
|
transactKnowledge,
|
|
14
14
|
wordBigrams
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-wg0665ft.js";
|
|
16
16
|
import {
|
|
17
17
|
isActiveStatus
|
|
18
18
|
} from "./index-bfwt3abw.js";
|
|
@@ -188,7 +188,7 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
188
188
|
alreadyInactive: true
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
191
|
+
const { quarantineEntry } = await import("./knowledge-validator-exymfcb9.js");
|
|
192
192
|
await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto");
|
|
193
193
|
return { quarantined: true, entryId, contradictionsInWindow: count };
|
|
194
194
|
} catch {
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
emit
|
|
4
|
+
} from "./index-vn263hqt.js";
|
|
5
|
+
import {
|
|
6
|
+
require_proper_lockfile
|
|
7
|
+
} from "./index-vvk2g744.js";
|
|
8
|
+
import {
|
|
9
|
+
__toESM
|
|
10
|
+
} from "./index-a76rekgs.js";
|
|
11
|
+
|
|
12
|
+
// src/parallel/file-locks.ts
|
|
13
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
14
|
+
import * as fs from "fs";
|
|
15
|
+
import * as path from "path";
|
|
16
|
+
var LOCKS_DIR = ".swarm/locks";
|
|
17
|
+
var LOCK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
18
|
+
var _internals = {
|
|
19
|
+
tryAcquireLock,
|
|
20
|
+
writeFile: fs.promises.writeFile
|
|
21
|
+
};
|
|
22
|
+
function getLockFilePath(directory, filePath) {
|
|
23
|
+
const normalized = path.resolve(directory, filePath);
|
|
24
|
+
const baseDir = path.resolve(directory) + path.sep;
|
|
25
|
+
const pathOk = process.platform === "win32" ? normalized.toLowerCase().startsWith(baseDir.toLowerCase()) : normalized.startsWith(baseDir);
|
|
26
|
+
if (!pathOk) {
|
|
27
|
+
throw new Error("Invalid file path: path traversal not allowed");
|
|
28
|
+
}
|
|
29
|
+
const pathForHash = process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
30
|
+
const hash = Buffer.from(pathForHash).toString("base64").replace(/[/+=]/g, "_");
|
|
31
|
+
const lockPath = path.join(directory, LOCKS_DIR, `${hash}.lock`);
|
|
32
|
+
if (process.platform === "win32") {
|
|
33
|
+
const oldHash = Buffer.from(normalized).toString("base64").replace(/[/+=]/g, "_");
|
|
34
|
+
const oldLockPath = path.join(directory, LOCKS_DIR, `${oldHash}.lock`);
|
|
35
|
+
if (fs.existsSync(oldLockPath)) {
|
|
36
|
+
return oldLockPath;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return lockPath;
|
|
40
|
+
}
|
|
41
|
+
async function tryAcquireLock(directory, filePath, agent, taskId) {
|
|
42
|
+
const lockPath = getLockFilePath(directory, filePath);
|
|
43
|
+
const locksDir = path.dirname(lockPath);
|
|
44
|
+
if (!fs.existsSync(locksDir)) {
|
|
45
|
+
fs.mkdirSync(locksDir, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
if (!fs.existsSync(lockPath)) {
|
|
48
|
+
fs.writeFileSync(lockPath, "", "utf-8");
|
|
49
|
+
}
|
|
50
|
+
let release;
|
|
51
|
+
try {
|
|
52
|
+
release = await import_proper_lockfile.default.lock(lockPath, {
|
|
53
|
+
stale: LOCK_TIMEOUT_MS,
|
|
54
|
+
retries: {
|
|
55
|
+
retries: 5,
|
|
56
|
+
minTimeout: 10,
|
|
57
|
+
maxTimeout: 500,
|
|
58
|
+
factor: 2
|
|
59
|
+
},
|
|
60
|
+
realpath: false
|
|
61
|
+
});
|
|
62
|
+
} catch (err) {
|
|
63
|
+
const code = err.code;
|
|
64
|
+
if (code === "ELOCKED" || code === "EEXIST") {
|
|
65
|
+
return { acquired: false };
|
|
66
|
+
}
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
const lock = {
|
|
70
|
+
filePath,
|
|
71
|
+
agent,
|
|
72
|
+
taskId,
|
|
73
|
+
timestamp: new Date().toISOString(),
|
|
74
|
+
expiresAt: Date.now() + LOCK_TIMEOUT_MS,
|
|
75
|
+
_release: release
|
|
76
|
+
};
|
|
77
|
+
return { acquired: true, lock };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/evidence/lock.ts
|
|
81
|
+
class EvidenceLockTimeoutError extends Error {
|
|
82
|
+
directory;
|
|
83
|
+
evidencePath;
|
|
84
|
+
agent;
|
|
85
|
+
taskId;
|
|
86
|
+
constructor(directory, evidencePath, agent, taskId, timeoutMs) {
|
|
87
|
+
super(`Evidence lock timeout after ${timeoutMs}ms for ${evidencePath} (agent=${agent}, task=${taskId})`);
|
|
88
|
+
this.name = "EvidenceLockTimeoutError";
|
|
89
|
+
this.directory = directory;
|
|
90
|
+
this.evidencePath = evidencePath;
|
|
91
|
+
this.agent = agent;
|
|
92
|
+
this.taskId = taskId;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
var BACKOFF_START_MS = 50;
|
|
96
|
+
var BACKOFF_MAX_MS = 2000;
|
|
97
|
+
var BACKOFF_JITTER_RATIO = 0.25;
|
|
98
|
+
function backoffMs(attempt) {
|
|
99
|
+
const base = Math.min(BACKOFF_START_MS * 2 ** attempt, BACKOFF_MAX_MS);
|
|
100
|
+
const jitter = base * BACKOFF_JITTER_RATIO * (Math.random() * 2 - 1);
|
|
101
|
+
return Math.max(1, Math.round(base + jitter));
|
|
102
|
+
}
|
|
103
|
+
async function withEvidenceLock(directory, evidencePath, agent, taskId, fn, timeoutMs = 60000) {
|
|
104
|
+
const deadline = Date.now() + timeoutMs;
|
|
105
|
+
let attempt = 0;
|
|
106
|
+
while (true) {
|
|
107
|
+
const result = await tryAcquireLock(directory, evidencePath, agent, taskId);
|
|
108
|
+
if (result.acquired) {
|
|
109
|
+
const lock = result.lock;
|
|
110
|
+
if (attempt > 0) {
|
|
111
|
+
emit("evidence_lock_stale_recovered", {
|
|
112
|
+
directory,
|
|
113
|
+
evidencePath,
|
|
114
|
+
agent,
|
|
115
|
+
taskId,
|
|
116
|
+
attempt
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
emit("evidence_lock_acquired", {
|
|
120
|
+
directory,
|
|
121
|
+
evidencePath,
|
|
122
|
+
agent,
|
|
123
|
+
taskId,
|
|
124
|
+
attempt
|
|
125
|
+
});
|
|
126
|
+
try {
|
|
127
|
+
return await fn();
|
|
128
|
+
} finally {
|
|
129
|
+
if (lock._release) {
|
|
130
|
+
try {
|
|
131
|
+
await lock._release();
|
|
132
|
+
} catch {}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (Date.now() >= deadline) {
|
|
137
|
+
throw new EvidenceLockTimeoutError(directory, evidencePath, agent, taskId, timeoutMs);
|
|
138
|
+
}
|
|
139
|
+
emit("evidence_lock_contended", {
|
|
140
|
+
directory,
|
|
141
|
+
evidencePath,
|
|
142
|
+
agent,
|
|
143
|
+
taskId,
|
|
144
|
+
attempt
|
|
145
|
+
});
|
|
146
|
+
const delay = Math.min(backoffMs(attempt), deadline - Date.now());
|
|
147
|
+
if (delay > 0) {
|
|
148
|
+
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
149
|
+
}
|
|
150
|
+
attempt++;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { tryAcquireLock, withEvidenceLock };
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-1emhz3zb.js";
|
|
16
16
|
import {
|
|
17
17
|
checkFileAuthority,
|
|
18
18
|
classifyFile,
|
|
19
19
|
isInDeclaredScope,
|
|
20
20
|
redactPath,
|
|
21
21
|
redactShellCommand
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-wj4jeavn.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|
|
@@ -255,10 +255,34 @@ function streamFromBun(stream) {
|
|
|
255
255
|
}).getReader();
|
|
256
256
|
return { text, bytes, getReader };
|
|
257
257
|
}
|
|
258
|
+
function mergeEnvForChild(baseEnv, envOverrides) {
|
|
259
|
+
const hasExplicitBaseEnv = baseEnv !== undefined;
|
|
260
|
+
const baseSource = baseEnv ?? process.env;
|
|
261
|
+
const merged = {};
|
|
262
|
+
for (const [key, value] of Object.entries(baseSource)) {
|
|
263
|
+
if (typeof value === "string")
|
|
264
|
+
merged[key] = value;
|
|
265
|
+
}
|
|
266
|
+
if (envOverrides) {
|
|
267
|
+
for (const [key, value] of Object.entries(envOverrides)) {
|
|
268
|
+
if (value === null) {
|
|
269
|
+
delete merged[key];
|
|
270
|
+
} else {
|
|
271
|
+
merged[key] = value;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (Object.keys(merged).length === 0) {
|
|
276
|
+
return hasExplicitBaseEnv ? {} : undefined;
|
|
277
|
+
}
|
|
278
|
+
return merged;
|
|
279
|
+
}
|
|
258
280
|
function bunSpawn(cmd, options) {
|
|
259
281
|
const bun = getBun();
|
|
260
282
|
if (bun?.spawn) {
|
|
261
|
-
const
|
|
283
|
+
const mergedEnv2 = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
284
|
+
const spawnOpts = mergedEnv2 !== undefined ? { ...options, env: mergedEnv2 } : options;
|
|
285
|
+
const proc2 = bun.spawn(cmd, spawnOpts);
|
|
262
286
|
return {
|
|
263
287
|
stdout: streamFromBun(proc2.stdout),
|
|
264
288
|
stderr: streamFromBun(proc2.stderr),
|
|
@@ -277,9 +301,10 @@ function bunSpawn(cmd, options) {
|
|
|
277
301
|
}
|
|
278
302
|
const [file, ...args] = cmd;
|
|
279
303
|
const detached = options?.killProcessTree === true;
|
|
304
|
+
const mergedEnv = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
280
305
|
const proc = nodeSpawn(file, args, {
|
|
281
306
|
cwd: options?.cwd,
|
|
282
|
-
env:
|
|
307
|
+
env: mergedEnv,
|
|
283
308
|
detached,
|
|
284
309
|
windowsHide: true,
|
|
285
310
|
stdio: [
|
|
@@ -328,7 +353,9 @@ function bunSpawn(cmd, options) {
|
|
|
328
353
|
function bunSpawnSync(cmd, options) {
|
|
329
354
|
const bun = getBun();
|
|
330
355
|
if (bun?.spawnSync) {
|
|
331
|
-
const
|
|
356
|
+
const mergedEnv2 = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
357
|
+
const spawnOpts = mergedEnv2 !== undefined ? { ...options, env: mergedEnv2 } : options;
|
|
358
|
+
const result2 = bun.spawnSync(cmd, spawnOpts);
|
|
332
359
|
return result2;
|
|
333
360
|
}
|
|
334
361
|
let argv;
|
|
@@ -350,9 +377,10 @@ function bunSpawnSync(cmd, options) {
|
|
|
350
377
|
}
|
|
351
378
|
}
|
|
352
379
|
const [file, ...args] = argv;
|
|
380
|
+
const mergedEnv = mergeEnvForChild(mergedOptions.env, options?.envOverrides);
|
|
353
381
|
const result = nodeSpawnSync(file, args, {
|
|
354
382
|
cwd: mergedOptions.cwd,
|
|
355
|
-
env:
|
|
383
|
+
env: mergedEnv,
|
|
356
384
|
input: mergedOptions.stdin instanceof Uint8Array || typeof mergedOptions.stdin === "string" ? mergedOptions.stdin : undefined,
|
|
357
385
|
timeout: mergedOptions.timeout,
|
|
358
386
|
windowsHide: true
|
|
@@ -368,4 +396,4 @@ function bunSpawnSync(cmd, options) {
|
|
|
368
396
|
};
|
|
369
397
|
}
|
|
370
398
|
|
|
371
|
-
export { bunFile, bunWrite, bunHash, bunSpawn, bunSpawnSync };
|
|
399
|
+
export { bunFile, bunWrite, bunHash, mergeEnvForChild, bunSpawn, bunSpawnSync };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
validateSwarmPath
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-r3j3458j.js";
|
|
5
5
|
import {
|
|
6
6
|
log
|
|
7
7
|
} from "./index-zgwm4ryv.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./index-293f68mj.js";
|
|
11
11
|
import {
|
|
12
12
|
withEvidenceLock
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-5mkc2f9z.js";
|
|
14
14
|
|
|
15
15
|
// src/background/pr-subscriptions.ts
|
|
16
16
|
import * as fs from "fs";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
|
-
validateSkillPath
|
|
5
|
-
} from "./index-dfdg4ws5.js";
|
|
6
2
|
import {
|
|
7
3
|
effectiveRetrievalOutcomes,
|
|
8
4
|
readKnowledgeCounterRollups
|
|
9
|
-
} from "./index-
|
|
5
|
+
} from "./index-mmny81g1.js";
|
|
6
|
+
import {
|
|
7
|
+
ALLOWED_SKILL_PATH_PREFIXES,
|
|
8
|
+
validateSkillPath
|
|
9
|
+
} from "./index-fz1jgbvw.js";
|
|
10
10
|
import {
|
|
11
11
|
computeOutcomeSignal,
|
|
12
12
|
readKnowledge,
|
|
13
13
|
resolveHiveKnowledgePath,
|
|
14
14
|
resolveSwarmKnowledgePath,
|
|
15
15
|
rewriteKnowledge
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-wg0665ft.js";
|
|
17
17
|
import {
|
|
18
18
|
init_logger,
|
|
19
19
|
warn
|