opencode-swarm 7.107.2 → 7.107.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/{curator-6zvpn7fs.js → curator-1nr4qszq.js} +6 -6
- package/dist/cli/{curator-drift-6ad8mxxb.js → curator-drift-ed7p5mfy.js} +2 -2
- package/dist/cli/{curator-llm-factory-r3m5e7n8.js → curator-llm-factory-x9tk7e6m.js} +6 -6
- package/dist/cli/{evidence-summary-service-7nwhd8s4.js → evidence-summary-service-9r28ds8t.js} +3 -3
- package/dist/cli/{guardrail-explain-zajegz3a.js → guardrail-explain-etdrhd4d.js} +7 -7
- package/dist/cli/{guardrail-log-fsc85hwa.js → guardrail-log-2rns4g6d.js} +2 -2
- package/dist/cli/{hive-promoter-nwcsha2j.js → hive-promoter-j4e6rfa6.js} +6 -6
- package/dist/cli/{index-r87xhtmx.js → index-502f6np6.js} +8 -8
- package/dist/cli/{index-mpe0yk9s.js → index-57ymmh7h.js} +5 -3
- package/dist/cli/{index-357p0baj.js → index-91j1sqzm.js} +14 -2
- package/dist/cli/{index-168p3bfr.js → index-cyzzdbvw.js} +573 -509
- package/dist/cli/{index-t4hbye3v.js → index-hkpw4wwa.js} +1 -1
- package/dist/cli/{index-f12bmedv.js → index-kzfkggjx.js} +88 -31
- package/dist/cli/{index-w8dzxnx4.js → index-m1xjr58n.js} +1 -1
- package/dist/cli/{index-fxtrk7y8.js → index-tgtmbf3r.js} +1 -1
- package/dist/cli/{index-jr54w7pb.js → index-w15984gg.js} +2 -2
- package/dist/cli/index.js +6 -6
- package/dist/cli/{pending-delegations-46xf2n2e.js → pending-delegations-ws51m1e1.js} +1 -1
- package/dist/cli/{pr-subscriptions-3c34rnm1.js → pr-subscriptions-0dpn4epk.js} +2 -2
- package/dist/hooks/guardrails/file-authority.d.ts +1 -1
- package/dist/hooks/knowledge-injector.d.ts +3 -0
- package/dist/hooks/knowledge-reader.d.ts +17 -0
- package/dist/hooks/semantic-diff-injection.d.ts +19 -0
- package/dist/index.js +236 -237
- package/dist/services/directive-predicate-runner.d.ts +1 -1
- package/dist/tools/knowledge-remove.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
readEffectiveSpecSync
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-91j1sqzm.js";
|
|
5
5
|
import {
|
|
6
6
|
isValidTaskId,
|
|
7
7
|
readTaskEvidence,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
readSwarmFileAsync,
|
|
13
13
|
validateSwarmPath
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-57ymmh7h.js";
|
|
15
15
|
import {
|
|
16
16
|
readCachedParsedFile
|
|
17
17
|
} from "./index-jtqkh8jf.js";
|
|
@@ -1740,6 +1740,49 @@ var CAS_BACKOFF_START_MS = 5;
|
|
|
1740
1740
|
var CAS_BACKOFF_CAP_MS = 250;
|
|
1741
1741
|
var CAS_BACKOFF_JITTER = 0.25;
|
|
1742
1742
|
var CAS_MAX_RETRIES = 3;
|
|
1743
|
+
function derivePhaseStatusesInPlace(plan) {
|
|
1744
|
+
for (const phase of plan.phases) {
|
|
1745
|
+
const tasks = phase.tasks;
|
|
1746
|
+
if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
|
|
1747
|
+
phase.status = "complete";
|
|
1748
|
+
} else if (tasks.some((t) => t.status === "in_progress")) {
|
|
1749
|
+
phase.status = "in_progress";
|
|
1750
|
+
} else if (tasks.some((t) => t.status === "blocked")) {
|
|
1751
|
+
phase.status = "blocked";
|
|
1752
|
+
} else {
|
|
1753
|
+
phase.status = "pending";
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
function overlayLedgerStatuses(validated, replayed, ledgerStatusTaskIds) {
|
|
1758
|
+
const projected = structuredClone(validated);
|
|
1759
|
+
const statusByTaskId = new Map;
|
|
1760
|
+
for (const phase of replayed.phases) {
|
|
1761
|
+
for (const task of phase.tasks) {
|
|
1762
|
+
if (ledgerStatusTaskIds.has(task.id)) {
|
|
1763
|
+
statusByTaskId.set(task.id, task.status);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
for (const phase of projected.phases) {
|
|
1768
|
+
for (const task of phase.tasks) {
|
|
1769
|
+
const replayedStatus = statusByTaskId.get(task.id);
|
|
1770
|
+
if (replayedStatus)
|
|
1771
|
+
task.status = replayedStatus;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
derivePhaseStatusesInPlace(projected);
|
|
1775
|
+
return projected;
|
|
1776
|
+
}
|
|
1777
|
+
function collectLedgerStatusTaskIds(events) {
|
|
1778
|
+
const statusTaskIds = new Set;
|
|
1779
|
+
for (const event of events) {
|
|
1780
|
+
if (event.event_type === "task_status_changed" && typeof event.task_id === "string") {
|
|
1781
|
+
statusTaskIds.add(event.task_id);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
return statusTaskIds;
|
|
1785
|
+
}
|
|
1743
1786
|
async function retryCasWithBackoff(directory, eventInput, options) {
|
|
1744
1787
|
const maxRetries = options.maxRetries ?? CAS_MAX_RETRIES;
|
|
1745
1788
|
let currentExpected = options.expectedHash;
|
|
@@ -2182,18 +2225,7 @@ async function savePlan(directory, plan, options) {
|
|
|
2182
2225
|
}
|
|
2183
2226
|
} catch {}
|
|
2184
2227
|
}
|
|
2185
|
-
|
|
2186
|
-
const tasks = phase.tasks;
|
|
2187
|
-
if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
|
|
2188
|
-
phase.status = "complete";
|
|
2189
|
-
} else if (tasks.some((t) => t.status === "in_progress")) {
|
|
2190
|
-
phase.status = "in_progress";
|
|
2191
|
-
} else if (tasks.some((t) => t.status === "blocked")) {
|
|
2192
|
-
phase.status = "blocked";
|
|
2193
|
-
} else {
|
|
2194
|
-
phase.status = "pending";
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2228
|
+
derivePhaseStatusesInPlace(validated);
|
|
2197
2229
|
const currentPlan = await _internals4.loadPlanJsonOnly(directory);
|
|
2198
2230
|
const planId = derivePlanId(validated);
|
|
2199
2231
|
const planHashForInit = computePlanHash(validated);
|
|
@@ -2399,7 +2431,16 @@ async function savePlan(directory, plan, options) {
|
|
|
2399
2431
|
throw error2;
|
|
2400
2432
|
}
|
|
2401
2433
|
}
|
|
2402
|
-
const
|
|
2434
|
+
const ledgerStatusTaskIds = collectLedgerStatusTaskIds(await readLedgerEvents(directory));
|
|
2435
|
+
const replayedBeforeProjection = await replayFromLedger(directory);
|
|
2436
|
+
const projectionCandidate = replayedBeforeProjection ? overlayLedgerStatuses(validated, replayedBeforeProjection, ledgerStatusTaskIds) : validated;
|
|
2437
|
+
if (replayedBeforeProjection && computePlanHash(replayedBeforeProjection) !== computePlanHash(projectionCandidate)) {
|
|
2438
|
+
await takeSnapshotEvent(directory, projectionCandidate, {
|
|
2439
|
+
planHashAfter: computePlanHash(projectionCandidate),
|
|
2440
|
+
source: "savePlan_structural_projection"
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
const projectedPlan = await replayFromLedger(directory) ?? projectionCandidate;
|
|
2403
2444
|
const SNAPSHOT_INTERVAL = 50;
|
|
2404
2445
|
const latestSeq = await getLatestLedgerSeq(directory);
|
|
2405
2446
|
if (latestSeq > 0 && latestSeq % SNAPSHOT_INTERVAL === 0) {
|
|
@@ -2881,6 +2922,7 @@ import {
|
|
|
2881
2922
|
statSync as statSync2
|
|
2882
2923
|
} from "fs";
|
|
2883
2924
|
import * as fs5 from "fs/promises";
|
|
2925
|
+
import * as os from "os";
|
|
2884
2926
|
import * as path6 from "path";
|
|
2885
2927
|
|
|
2886
2928
|
// src/config/evidence-schema.ts
|
|
@@ -3199,6 +3241,30 @@ var PROJECT_INDICATORS = [
|
|
|
3199
3241
|
"build.gradle",
|
|
3200
3242
|
"CMakeLists.txt"
|
|
3201
3243
|
];
|
|
3244
|
+
function isWeakConfigContainerRoot(directory) {
|
|
3245
|
+
try {
|
|
3246
|
+
const resolved = realpathSync(directory);
|
|
3247
|
+
return resolved === realpathSync(os.tmpdir()) || resolved === realpathSync(os.homedir());
|
|
3248
|
+
} catch {
|
|
3249
|
+
const resolved = path6.resolve(directory);
|
|
3250
|
+
return resolved === path6.resolve(os.tmpdir()) || resolved === path6.resolve(os.homedir());
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
function hasAccessibleProjectIndicator(directory, options = {}) {
|
|
3254
|
+
const allowConfigOnly = options.allowConfigOnly ?? true;
|
|
3255
|
+
for (const indicator of PROJECT_INDICATORS) {
|
|
3256
|
+
if (!allowConfigOnly && indicator === ".opencode") {
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3259
|
+
try {
|
|
3260
|
+
const indicatorStat = statSync2(path6.join(directory, indicator));
|
|
3261
|
+
if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
|
|
3262
|
+
return true;
|
|
3263
|
+
}
|
|
3264
|
+
} catch {}
|
|
3265
|
+
}
|
|
3266
|
+
return false;
|
|
3267
|
+
}
|
|
3202
3268
|
function validateProjectRoot(directory) {
|
|
3203
3269
|
let resolved;
|
|
3204
3270
|
try {
|
|
@@ -3216,25 +3282,16 @@ function validateProjectRoot(directory) {
|
|
|
3216
3282
|
const parent = path6.dirname(current);
|
|
3217
3283
|
if (parent === current)
|
|
3218
3284
|
break;
|
|
3285
|
+
if (path6.dirname(parent) === parent) {
|
|
3286
|
+
current = parent;
|
|
3287
|
+
continue;
|
|
3288
|
+
}
|
|
3219
3289
|
const parentSwarm = path6.join(parent, ".swarm");
|
|
3220
3290
|
try {
|
|
3221
3291
|
if (statSync2(parentSwarm).isDirectory()) {
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
const indicatorStat = statSync2(path6.join(parent, indicator));
|
|
3226
|
-
if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
|
|
3227
|
-
hasProjectIndicator = true;
|
|
3228
|
-
break;
|
|
3229
|
-
}
|
|
3230
|
-
} catch (error2) {
|
|
3231
|
-
if (error2 instanceof Error && "code" in error2 && error2.code === "ENOENT") {} else {
|
|
3232
|
-
hasProjectIndicator = true;
|
|
3233
|
-
break;
|
|
3234
|
-
}
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
if (hasProjectIndicator) {
|
|
3292
|
+
if (hasAccessibleProjectIndicator(parent, {
|
|
3293
|
+
allowConfigOnly: !isWeakConfigContainerRoot(parent)
|
|
3294
|
+
})) {
|
|
3238
3295
|
warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
|
|
3239
3296
|
throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
|
|
3240
3297
|
}
|
|
@@ -2050,7 +2050,7 @@ function normalizePathWithCache(filePath, cwd) {
|
|
|
2050
2050
|
return fallback;
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
function getGlobMatcher(pattern, caseInsensitive =
|
|
2053
|
+
function getGlobMatcher(pattern, caseInsensitive = true) {
|
|
2054
2054
|
const cacheKey = `${caseInsensitive ? "nocase" : "case"}\x00${pattern}`;
|
|
2055
2055
|
const cached = globMatcherCache.get(cacheKey);
|
|
2056
2056
|
if (cached !== undefined) {
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-cyzzdbvw.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-tgtmbf3r.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|
package/dist/cli/index.js
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
package_default,
|
|
9
9
|
resolveCommand
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-cyzzdbvw.js";
|
|
11
11
|
import"./index-esg1554h.js";
|
|
12
|
-
import"./index-
|
|
12
|
+
import"./index-kzfkggjx.js";
|
|
13
13
|
import"./index-8w4d325g.js";
|
|
14
|
-
import"./index-
|
|
14
|
+
import"./index-tgtmbf3r.js";
|
|
15
15
|
import"./index-09xpycan.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_AGENT_CONFIGS
|
|
@@ -19,12 +19,12 @@ import {
|
|
|
19
19
|
import"./index-9wstcavp.js";
|
|
20
20
|
import"./index-f7nma02k.js";
|
|
21
21
|
import"./index-c8s9a3zh.js";
|
|
22
|
-
import"./index-
|
|
22
|
+
import"./index-91j1sqzm.js";
|
|
23
23
|
import"./index-v4fcn4tr.js";
|
|
24
24
|
import"./index-r8f89sm9.js";
|
|
25
25
|
import"./index-9b7qp18e.js";
|
|
26
|
-
import"./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
import"./index-hkpw4wwa.js";
|
|
27
|
+
import"./index-57ymmh7h.js";
|
|
28
28
|
import"./index-5e4e2hvv.js";
|
|
29
29
|
import"./index-p0arc26j.js";
|
|
30
30
|
import"./index-jtqkh8jf.js";
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
sweepStale,
|
|
10
10
|
unsubscribe,
|
|
11
11
|
updateSnapshot
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
} from "./index-hkpw4wwa.js";
|
|
13
|
+
import"./index-57ymmh7h.js";
|
|
14
14
|
import"./index-5e4e2hvv.js";
|
|
15
15
|
import"./index-p0arc26j.js";
|
|
16
16
|
import"./index-jtqkh8jf.js";
|
|
@@ -63,7 +63,7 @@ export declare function normalizePathWithCache(filePath: string, cwd: string): s
|
|
|
63
63
|
/**
|
|
64
64
|
* Gets or creates a cached picomatch matcher for a glob pattern.
|
|
65
65
|
* @param pattern Glob pattern to compile
|
|
66
|
-
* @param caseInsensitive Whether to use case-insensitive matching (default: true
|
|
66
|
+
* @param caseInsensitive Whether to use case-insensitive matching (default: true for cross-platform policy consistency)
|
|
67
67
|
* @returns Matcher function that returns true if path matches the pattern
|
|
68
68
|
*/
|
|
69
69
|
export declare function getGlobMatcher(pattern: string, caseInsensitive?: boolean): (path: string) => boolean;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* to prevent re-learning loops.
|
|
7
7
|
*/
|
|
8
8
|
import { recordKnowledgeShown } from './knowledge-application.js';
|
|
9
|
+
import { buildEscalationBriefing, readRecentEscalations } from './knowledge-escalator.js';
|
|
9
10
|
import { recordKnowledgeEvent } from './knowledge-events.js';
|
|
10
11
|
import type { RankedEntry } from './knowledge-reader.js';
|
|
11
12
|
import type { DirectivePriority, KnowledgeConfig, MessageWithParts } from './knowledge-types.js';
|
|
@@ -94,4 +95,6 @@ export declare const _internals: {
|
|
|
94
95
|
searchKnowledge: typeof searchKnowledge;
|
|
95
96
|
recordKnowledgeEvent: typeof recordKnowledgeEvent;
|
|
96
97
|
recordKnowledgeShown: typeof recordKnowledgeShown;
|
|
98
|
+
readRecentEscalations: typeof readRecentEscalations;
|
|
99
|
+
buildEscalationBriefing: typeof buildEscalationBriefing;
|
|
97
100
|
};
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Merges swarm + hive knowledge, deduplicates (hive wins), ranks by composite score,
|
|
3
3
|
* and provides utility tracking.
|
|
4
4
|
*/
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { atomicWriteFile } from '../evidence/task-file.js';
|
|
8
|
+
import { warn } from '../utils/logger.js';
|
|
5
9
|
import { recordKnowledgeEvent } from './knowledge-events.js';
|
|
10
|
+
import { jaccardBigram, normalize, readKnowledge, readRetractionRecords, resolveHiveKnowledgePath, resolveSwarmKnowledgePath, transactFile, wordBigrams } from './knowledge-store.js';
|
|
6
11
|
import type { KnowledgeConfig, KnowledgeEntryBase, KnowledgeRetrievalContext } from './knowledge-types.js';
|
|
7
12
|
export interface ProjectContext {
|
|
8
13
|
projectName: string;
|
|
@@ -37,6 +42,18 @@ export declare const _internals: {
|
|
|
37
42
|
updateRetrievalOutcome: typeof updateRetrievalOutcome;
|
|
38
43
|
scoreDirectiveAgainstContext: typeof scoreDirectiveAgainstContext;
|
|
39
44
|
transactShownFile: typeof transactShownFile;
|
|
45
|
+
existsSync: typeof existsSync;
|
|
46
|
+
readFile: typeof readFile;
|
|
47
|
+
atomicWriteFile: typeof atomicWriteFile;
|
|
48
|
+
transactFile: typeof transactFile;
|
|
49
|
+
warn: typeof warn;
|
|
50
|
+
readKnowledge: typeof readKnowledge;
|
|
51
|
+
readRetractionRecords: typeof readRetractionRecords;
|
|
52
|
+
resolveHiveKnowledgePath: typeof resolveHiveKnowledgePath;
|
|
53
|
+
resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
|
|
54
|
+
jaccardBigram: typeof jaccardBigram;
|
|
55
|
+
normalize: typeof normalize;
|
|
56
|
+
wordBigrams: typeof wordBigrams;
|
|
40
57
|
recordKnowledgeEvent: typeof recordKnowledgeEvent;
|
|
41
58
|
};
|
|
42
59
|
export {};
|
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
* Failure mode: silent. If git is unavailable or AST diff fails,
|
|
8
8
|
* returns null — the reviewer simply doesn't get the extra context.
|
|
9
9
|
*/
|
|
10
|
+
import * as child_process from 'node:child_process';
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import { computeASTDiff } from '../diff/ast-diff.js';
|
|
13
|
+
import { classifyChanges } from '../diff/semantic-classifier.js';
|
|
14
|
+
import { generateSummary, generateSummaryMarkdown } from '../diff/summary-generator.js';
|
|
15
|
+
import { getImporters, normalizeGraphPath } from '../tools/repo-graph.js';
|
|
16
|
+
import { getCachedGraph } from './repo-graph-injection.js';
|
|
17
|
+
export declare const _internals: {
|
|
18
|
+
execFile: typeof child_process.execFile;
|
|
19
|
+
realpathSync: typeof fs.realpathSync;
|
|
20
|
+
readFile: typeof fs.promises.readFile;
|
|
21
|
+
computeASTDiff: typeof computeASTDiff;
|
|
22
|
+
classifyChanges: typeof classifyChanges;
|
|
23
|
+
generateSummary: typeof generateSummary;
|
|
24
|
+
generateSummaryMarkdown: typeof generateSummaryMarkdown;
|
|
25
|
+
getCachedGraph: typeof getCachedGraph;
|
|
26
|
+
getImporters: typeof getImporters;
|
|
27
|
+
normalizeGraphPath: typeof normalizeGraphPath;
|
|
28
|
+
};
|
|
10
29
|
/**
|
|
11
30
|
* Build a semantic diff summary block for the given changed files.
|
|
12
31
|
*
|