opencode-swarm 6.47.1 → 6.47.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/hooks/curator-types.d.ts +3 -0
- package/dist/hooks/curator.d.ts +1 -1
- package/dist/index.js +46 -12
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Curator types — phase context consolidation and drift detection.
|
|
3
3
|
* No runtime logic. Types only.
|
|
4
4
|
*/
|
|
5
|
+
import type { KnowledgeCategory } from './knowledge-types.js';
|
|
5
6
|
/** Curator summary — anchored iterative format. Persisted to .swarm/curator-summary.json */
|
|
6
7
|
export interface CuratorSummary {
|
|
7
8
|
schema_version: 1;
|
|
@@ -39,6 +40,8 @@ export interface KnowledgeRecommendation {
|
|
|
39
40
|
entry_id?: string;
|
|
40
41
|
lesson: string;
|
|
41
42
|
reason: string;
|
|
43
|
+
category?: KnowledgeCategory;
|
|
44
|
+
confidence?: number;
|
|
42
45
|
}
|
|
43
46
|
/** Drift report — produced by critic after curator phase run */
|
|
44
47
|
export interface DriftReport {
|
package/dist/hooks/curator.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export declare function runCuratorPhase(directory: string, phase: number, agents
|
|
|
83
83
|
* @param knowledgeConfig - Knowledge configuration (for path resolution)
|
|
84
84
|
* @returns Counts of applied and skipped recommendations
|
|
85
85
|
*/
|
|
86
|
-
export declare function applyCuratorKnowledgeUpdates(directory: string, recommendations: KnowledgeRecommendation[],
|
|
86
|
+
export declare function applyCuratorKnowledgeUpdates(directory: string, recommendations: KnowledgeRecommendation[], knowledgeConfig: KnowledgeConfig): Promise<{
|
|
87
87
|
applied: number;
|
|
88
88
|
skipped: number;
|
|
89
89
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -48856,7 +48856,7 @@ ${phaseDigest.summary}`,
|
|
|
48856
48856
|
};
|
|
48857
48857
|
}
|
|
48858
48858
|
}
|
|
48859
|
-
async function applyCuratorKnowledgeUpdates(directory, recommendations,
|
|
48859
|
+
async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledgeConfig) {
|
|
48860
48860
|
let applied = 0;
|
|
48861
48861
|
let skipped = 0;
|
|
48862
48862
|
if (recommendations.length === 0) {
|
|
@@ -48918,6 +48918,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, _knowled
|
|
|
48918
48918
|
if (modified) {
|
|
48919
48919
|
await rewriteKnowledge(knowledgePath, updatedEntries);
|
|
48920
48920
|
}
|
|
48921
|
+
const existingLessons = entries.map((e) => e.lesson);
|
|
48921
48922
|
for (const rec of recommendations) {
|
|
48922
48923
|
if (rec.entry_id !== undefined)
|
|
48923
48924
|
continue;
|
|
@@ -48925,20 +48926,35 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, _knowled
|
|
|
48925
48926
|
skipped++;
|
|
48926
48927
|
continue;
|
|
48927
48928
|
}
|
|
48928
|
-
const lesson = rec.lesson?.trim() ?? "";
|
|
48929
|
+
const lesson = (rec.lesson?.trim() ?? "").slice(0, 280);
|
|
48929
48930
|
if (lesson.length < 15) {
|
|
48930
48931
|
skipped++;
|
|
48931
48932
|
continue;
|
|
48932
48933
|
}
|
|
48934
|
+
if (existingLessons.some((el) => el.toLowerCase() === lesson.toLowerCase())) {
|
|
48935
|
+
skipped++;
|
|
48936
|
+
continue;
|
|
48937
|
+
}
|
|
48938
|
+
if (knowledgeConfig.validation_enabled !== false) {
|
|
48939
|
+
const validation = validateLesson(lesson, existingLessons, {
|
|
48940
|
+
category: rec.category ?? "other",
|
|
48941
|
+
scope: "global",
|
|
48942
|
+
confidence: rec.confidence ?? 0.5
|
|
48943
|
+
});
|
|
48944
|
+
if (!validation.valid) {
|
|
48945
|
+
skipped++;
|
|
48946
|
+
continue;
|
|
48947
|
+
}
|
|
48948
|
+
}
|
|
48933
48949
|
const now = new Date().toISOString();
|
|
48934
48950
|
const newEntry = {
|
|
48935
48951
|
id: randomUUID(),
|
|
48936
48952
|
tier: "swarm",
|
|
48937
|
-
lesson
|
|
48938
|
-
category: "other",
|
|
48953
|
+
lesson,
|
|
48954
|
+
category: rec.category ?? "other",
|
|
48939
48955
|
tags: [],
|
|
48940
48956
|
scope: "global",
|
|
48941
|
-
confidence: 0.5,
|
|
48957
|
+
confidence: rec.confidence ?? 0.5,
|
|
48942
48958
|
status: "candidate",
|
|
48943
48959
|
confirmed_by: [],
|
|
48944
48960
|
retrieval_outcomes: {
|
|
@@ -48954,6 +48970,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, _knowled
|
|
|
48954
48970
|
};
|
|
48955
48971
|
await appendKnowledge(knowledgePath, newEntry);
|
|
48956
48972
|
applied++;
|
|
48973
|
+
existingLessons.push(lesson);
|
|
48957
48974
|
}
|
|
48958
48975
|
return { applied, skipped };
|
|
48959
48976
|
}
|
|
@@ -60763,7 +60780,19 @@ var curator_analyze = createSwarmTool({
|
|
|
60763
60780
|
]),
|
|
60764
60781
|
entry_id: tool.schema.string().optional(),
|
|
60765
60782
|
lesson: tool.schema.string(),
|
|
60766
|
-
reason: tool.schema.string()
|
|
60783
|
+
reason: tool.schema.string(),
|
|
60784
|
+
category: tool.schema.enum([
|
|
60785
|
+
"process",
|
|
60786
|
+
"architecture",
|
|
60787
|
+
"tooling",
|
|
60788
|
+
"security",
|
|
60789
|
+
"testing",
|
|
60790
|
+
"debugging",
|
|
60791
|
+
"performance",
|
|
60792
|
+
"integration",
|
|
60793
|
+
"other"
|
|
60794
|
+
]).optional(),
|
|
60795
|
+
confidence: tool.schema.number().min(0).max(1).optional()
|
|
60767
60796
|
})).optional().describe("Knowledge recommendations to apply. If omitted, only collects digest data.")
|
|
60768
60797
|
},
|
|
60769
60798
|
execute: async (args2, directory, ctx) => {
|
|
@@ -60782,6 +60811,16 @@ var curator_analyze = createSwarmTool({
|
|
|
60782
60811
|
}
|
|
60783
60812
|
}
|
|
60784
60813
|
}
|
|
60814
|
+
if (typedArgs.recommendations) {
|
|
60815
|
+
const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
60816
|
+
for (const rec of typedArgs.recommendations) {
|
|
60817
|
+
if (rec.entry_id !== undefined && !UUID_V4.test(rec.entry_id)) {
|
|
60818
|
+
return JSON.stringify({
|
|
60819
|
+
error: `Invalid entry_id '${rec.entry_id}': must be a UUID v4 or omitted. ` + `Use undefined/omit entry_id to create a new entry.`
|
|
60820
|
+
}, null, 2);
|
|
60821
|
+
}
|
|
60822
|
+
}
|
|
60823
|
+
}
|
|
60785
60824
|
const { config: config3 } = loadPluginConfigWithMeta(directory);
|
|
60786
60825
|
const curatorConfig = CuratorConfigSchema.parse(config3.curator ?? {});
|
|
60787
60826
|
const knowledgeConfig = KnowledgeConfigSchema.parse(config3.knowledge ?? {});
|
|
@@ -60822,12 +60861,7 @@ var curator_analyze = createSwarmTool({
|
|
|
60822
60861
|
let applied = 0;
|
|
60823
60862
|
let skipped = 0;
|
|
60824
60863
|
if (typedArgs.recommendations && typedArgs.recommendations.length > 0) {
|
|
60825
|
-
const
|
|
60826
|
-
const sanitizedRecs = typedArgs.recommendations.map((rec) => ({
|
|
60827
|
-
...rec,
|
|
60828
|
-
entry_id: rec.entry_id === undefined || UUID_V4.test(rec.entry_id) ? rec.entry_id : undefined
|
|
60829
|
-
}));
|
|
60830
|
-
const result = await applyCuratorKnowledgeUpdates(directory, sanitizedRecs, knowledgeConfig);
|
|
60864
|
+
const result = await applyCuratorKnowledgeUpdates(directory, typedArgs.recommendations, knowledgeConfig);
|
|
60831
60865
|
applied = result.applied;
|
|
60832
60866
|
skipped = result.skipped;
|
|
60833
60867
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.47.
|
|
3
|
+
"version": "6.47.2",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|