opencode-swarm 7.107.3 → 7.107.5
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/.opencode/skills/consult/SKILL.md +10 -0
- package/.opencode/skills/council/SKILL.md +10 -0
- package/.opencode/skills/engineering-conventions/SKILL.md +20 -0
- package/README.md +2 -2
- package/dist/agents/agent-output-schema.d.ts +1 -1
- package/dist/cli/{config-doctor-cntnpyvj.js → config-doctor-kdq3vae4.js} +3 -2
- package/dist/cli/{curator-1nr4qszq.js → curator-k9swkynp.js} +17 -12
- package/dist/cli/{curator-llm-factory-x9tk7e6m.js → curator-llm-factory-ed67kywr.js} +17 -12
- package/dist/cli/{dispatch-e4ejrsz8.js → dispatch-anmxxhen.js} +56 -13
- package/dist/cli/{evidence-summary-service-9r28ds8t.js → evidence-summary-service-6zsgw7x7.js} +3 -3
- package/dist/cli/{gate-evidence-ywys9vfs.js → gate-evidence-pgr7d942.js} +2 -2
- package/dist/cli/{guardrail-explain-etdrhd4d.js → guardrail-explain-vd6da30t.js} +18 -13
- package/dist/cli/{guardrail-log-2rns4g6d.js → guardrail-log-fjypsmek.js} +4 -3
- package/dist/cli/{hive-promoter-j4e6rfa6.js → hive-promoter-gh0nva5c.js} +17 -12
- package/dist/cli/{index-r8f89sm9.js → index-0kxc7t16.js} +2 -1
- package/dist/cli/{index-tgtmbf3r.js → index-4vsgp5a8.js} +1 -1
- package/dist/cli/{index-kzfkggjx.js → index-6h82c2h0.js} +28 -11
- package/dist/cli/index-bfwt3abw.js +14 -0
- package/dist/cli/{index-9wstcavp.js → index-bpgqbwmf.js} +115 -1019
- package/dist/cli/index-bq8kd9r9.js +199 -0
- package/dist/cli/index-dfdg4ws5.js +741 -0
- package/dist/cli/{index-w15984gg.js → index-jrka8jd4.js} +2 -2
- package/dist/cli/index-kxm3bdjh.js +631 -0
- package/dist/cli/index-n1sptn1w.js +147 -0
- package/dist/cli/{index-2560cctg.js → index-pchpahdf.js} +11 -0
- package/dist/cli/{index-cyzzdbvw.js → index-vzq4h90s.js} +354 -116
- package/dist/cli/{index-502f6np6.js → index-w1tvqh4x.js} +22 -17
- package/dist/cli/{index-esg1554h.js → index-wvxhynxq.js} +1 -1
- package/dist/cli/{index-8w4d325g.js → index-xg18az81.js} +61 -22
- package/dist/cli/{index-f7nma02k.js → index-xmarctsf.js} +137 -175
- package/dist/cli/{index-m1xjr58n.js → index-zej8cy0j.js} +1 -1
- package/dist/cli/index.js +18 -13
- package/dist/cli/knowledge-escalator-3sgwrgy9.js +32 -0
- package/dist/cli/knowledge-events-kfc6xmkw.js +62 -0
- package/dist/cli/{knowledge-store-tsa8ezka.js → knowledge-store-kyacem71.js} +3 -1
- package/dist/cli/knowledge-validator-ez3ws8ef.js +57 -0
- package/dist/cli/{pr-subscriptions-0dpn4epk.js → pr-subscriptions-bpvazmsw.js} +2 -2
- package/dist/cli/{schema-vw2ffhe9.js → schema-x0ekqzvs.js} +2 -1
- package/dist/cli/{skill-generator-y6mmq8n5.js → skill-generator-x83re96d.js} +6 -2
- package/dist/commands/knowledge.d.ts +5 -1
- package/dist/commands/registry.d.ts +2 -2
- package/dist/config/evidence-schema.d.ts +9 -9
- package/dist/config/schema.d.ts +42 -12
- package/dist/hooks/knowledge-curator.d.ts +27 -0
- package/dist/hooks/knowledge-escalator.d.ts +16 -0
- package/dist/hooks/knowledge-events.d.ts +11 -0
- package/dist/hooks/knowledge-reader.d.ts +0 -17
- package/dist/hooks/knowledge-store.d.ts +16 -1
- package/dist/hooks/knowledge-types.d.ts +85 -0
- package/dist/hooks/knowledge-validator.d.ts +15 -0
- package/dist/hooks/skill-usage-log.d.ts +3 -0
- package/dist/index.js +312 -310
- package/dist/memory/consolidation.d.ts +1 -1
- package/dist/memory/schema.d.ts +4 -4
- package/dist/sast/rules/rust.d.ts +6 -0
- package/dist/tools/knowledge-archive.d.ts +6 -2
- package/dist/tools/lint.d.ts +2 -2
- package/dist/tools/secretscan.d.ts +16 -0
- package/dist/tools/test-runner.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cli/{index-hkpw4wwa.js → index-4r5z8sgw.js} +3 -3
- package/dist/cli/{pending-delegations-ws51m1e1.js → pending-delegations-vfnpm8zt.js} +3 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
atomicWriteFile
|
|
4
|
+
} from "./index-9b7qp18e.js";
|
|
5
|
+
|
|
6
|
+
// src/hooks/knowledge-link.ts
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, rmSync } from "fs";
|
|
8
|
+
import * as os from "os";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
var LINK_POINTER_FILENAME = "link.json";
|
|
11
|
+
var MAX_LINK_ID_LENGTH = 64;
|
|
12
|
+
var WINDOWS_RESERVED_NAMES = new Set([
|
|
13
|
+
"con",
|
|
14
|
+
"prn",
|
|
15
|
+
"aux",
|
|
16
|
+
"nul",
|
|
17
|
+
"com0",
|
|
18
|
+
"com1",
|
|
19
|
+
"com2",
|
|
20
|
+
"com3",
|
|
21
|
+
"com4",
|
|
22
|
+
"com5",
|
|
23
|
+
"com6",
|
|
24
|
+
"com7",
|
|
25
|
+
"com8",
|
|
26
|
+
"com9",
|
|
27
|
+
"lpt0",
|
|
28
|
+
"lpt1",
|
|
29
|
+
"lpt2",
|
|
30
|
+
"lpt3",
|
|
31
|
+
"lpt4",
|
|
32
|
+
"lpt5",
|
|
33
|
+
"lpt6",
|
|
34
|
+
"lpt7",
|
|
35
|
+
"lpt8",
|
|
36
|
+
"lpt9"
|
|
37
|
+
]);
|
|
38
|
+
var CACHE_TTL_MS = 2000;
|
|
39
|
+
var MAX_CACHE_ENTRIES = 500;
|
|
40
|
+
function resolveDataDir() {
|
|
41
|
+
const platform = process.platform;
|
|
42
|
+
const home = process.env.HOME || os.homedir();
|
|
43
|
+
if (platform === "win32") {
|
|
44
|
+
return path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
45
|
+
} else if (platform === "darwin") {
|
|
46
|
+
return path.join(home, "Library", "Application Support", "opencode-swarm");
|
|
47
|
+
}
|
|
48
|
+
return path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
|
|
49
|
+
}
|
|
50
|
+
function resolveLinkBaseDir() {
|
|
51
|
+
return path.join(resolveDataDir(), "links");
|
|
52
|
+
}
|
|
53
|
+
function resolveLinkDir(linkId) {
|
|
54
|
+
return path.join(resolveLinkBaseDir(), linkId);
|
|
55
|
+
}
|
|
56
|
+
function sanitizeLinkId(name) {
|
|
57
|
+
if (typeof name !== "string")
|
|
58
|
+
return null;
|
|
59
|
+
const cleaned = name.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, MAX_LINK_ID_LENGTH).replace(/[-.]+$/g, "");
|
|
60
|
+
if (cleaned.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
const base = cleaned.split(".")[0];
|
|
63
|
+
if (WINDOWS_RESERVED_NAMES.has(base))
|
|
64
|
+
return null;
|
|
65
|
+
return cleaned;
|
|
66
|
+
}
|
|
67
|
+
function resolveLinkPointerPath(directory) {
|
|
68
|
+
return path.join(directory, ".swarm", LINK_POINTER_FILENAME);
|
|
69
|
+
}
|
|
70
|
+
function readLinkPointer(directory) {
|
|
71
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
72
|
+
if (!existsSync(pointerPath))
|
|
73
|
+
return null;
|
|
74
|
+
try {
|
|
75
|
+
const raw = JSON.parse(readFileSync(pointerPath, "utf-8"));
|
|
76
|
+
if (!raw || typeof raw !== "object")
|
|
77
|
+
return null;
|
|
78
|
+
const obj = raw;
|
|
79
|
+
const linkId = obj.linkId;
|
|
80
|
+
if (typeof linkId !== "string" || linkId.length === 0)
|
|
81
|
+
return null;
|
|
82
|
+
const safeId = sanitizeLinkId(linkId);
|
|
83
|
+
if (!safeId)
|
|
84
|
+
return null;
|
|
85
|
+
return {
|
|
86
|
+
version: 1,
|
|
87
|
+
linkId: safeId,
|
|
88
|
+
name: typeof obj.name === "string" ? obj.name : undefined,
|
|
89
|
+
createdAt: typeof obj.createdAt === "string" ? obj.createdAt : new Date(0).toISOString(),
|
|
90
|
+
source: obj.source === "auto" ? "auto" : "manual"
|
|
91
|
+
};
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async function writeLinkPointer(directory, pointer) {
|
|
97
|
+
const swarmDir = path.join(directory, ".swarm");
|
|
98
|
+
mkdirSync(swarmDir, { recursive: true });
|
|
99
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
100
|
+
await atomicWriteFile(pointerPath, JSON.stringify(pointer, null, 2));
|
|
101
|
+
invalidateKnowledgeStoreDirCache(directory);
|
|
102
|
+
}
|
|
103
|
+
async function removeLinkPointer(directory) {
|
|
104
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
105
|
+
try {
|
|
106
|
+
rmSync(pointerPath, { force: true });
|
|
107
|
+
} finally {
|
|
108
|
+
invalidateKnowledgeStoreDirCache(directory);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var _resolutionCache = new Map;
|
|
112
|
+
function resolveKnowledgeStoreDir(directory) {
|
|
113
|
+
const localSwarm = path.join(directory, ".swarm");
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
const cached = _resolutionCache.get(directory);
|
|
116
|
+
if (cached && now < cached.expires) {
|
|
117
|
+
return cached.linkDir ?? localSwarm;
|
|
118
|
+
}
|
|
119
|
+
let linkDir = null;
|
|
120
|
+
try {
|
|
121
|
+
const pointer = readLinkPointer(directory);
|
|
122
|
+
if (pointer) {
|
|
123
|
+
linkDir = path.resolve(resolveLinkDir(pointer.linkId));
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
linkDir = null;
|
|
127
|
+
}
|
|
128
|
+
if (!_resolutionCache.has(directory) && _resolutionCache.size >= MAX_CACHE_ENTRIES) {
|
|
129
|
+
const oldest = _resolutionCache.keys().next().value;
|
|
130
|
+
if (oldest !== undefined)
|
|
131
|
+
_resolutionCache.delete(oldest);
|
|
132
|
+
}
|
|
133
|
+
_resolutionCache.set(directory, { linkDir, expires: now + CACHE_TTL_MS });
|
|
134
|
+
return linkDir ?? localSwarm;
|
|
135
|
+
}
|
|
136
|
+
function invalidateKnowledgeStoreDirCache(directory) {
|
|
137
|
+
if (directory === undefined) {
|
|
138
|
+
_resolutionCache.clear();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
_resolutionCache.delete(directory);
|
|
142
|
+
}
|
|
143
|
+
function isLinked(directory) {
|
|
144
|
+
return readLinkPointer(directory) !== null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { resolveLinkDir, sanitizeLinkId, readLinkPointer, writeLinkPointer, removeLinkPointer, resolveKnowledgeStoreDir, isLinked };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
OUTCOME_BLOCK_THRESHOLD
|
|
4
|
+
} from "./index-bfwt3abw.js";
|
|
2
5
|
import {
|
|
3
6
|
exports_external
|
|
4
7
|
} from "./index-293f68mj.js";
|
|
@@ -1509,6 +1512,14 @@ var KnowledgeConfigSchema = exports_external.object({
|
|
|
1509
1512
|
default_max_phases: exports_external.number().int().positive().default(10),
|
|
1510
1513
|
todo_max_phases: exports_external.number().int().positive().default(3),
|
|
1511
1514
|
sweep_enabled: exports_external.boolean().default(true),
|
|
1515
|
+
confidence_floor_action: exports_external.enum(["none", "demote", "quarantine"]).default("demote"),
|
|
1516
|
+
confidence_floor_min_outcomes: exports_external.number().int().min(0).default(3),
|
|
1517
|
+
confidence_floor_signal_threshold: exports_external.number().min(-1).max(1).default(0),
|
|
1518
|
+
contradiction_threshold_action: exports_external.enum(["tag_only", "quarantine"]).default("quarantine"),
|
|
1519
|
+
contradiction_quarantine_threshold: exports_external.number().int().positive().default(3),
|
|
1520
|
+
contradiction_quarantine_window_days: exports_external.number().int().positive().default(30),
|
|
1521
|
+
promoted_demotion_min_negative_phases: exports_external.number().int().positive().default(3),
|
|
1522
|
+
promoted_demotion_signal_threshold: exports_external.number().min(-1).max(1).default(OUTCOME_BLOCK_THRESHOLD),
|
|
1512
1523
|
realtime_learning_nudge: exports_external.object({
|
|
1513
1524
|
enabled: exports_external.boolean().default(true),
|
|
1514
1525
|
first_after_tool_calls: exports_external.number().int().min(1).max(1000).default(10),
|