opencode-swarm 7.42.0 → 7.43.1
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/README.md +16 -0
- package/dist/cli/index.js +1576 -1225
- package/dist/config/schema.d.ts +2 -0
- package/dist/hooks/curator-types.d.ts +2 -0
- package/dist/hooks/curator.d.ts +18 -0
- package/dist/hooks/knowledge-application.d.ts +1 -0
- package/dist/hooks/knowledge-store.d.ts +21 -0
- package/dist/hooks/skill-usage-log.d.ts +48 -0
- package/dist/index.js +2489 -2239
- package/dist/services/skill-generator.d.ts +23 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/skill-regenerate.d.ts +14 -0
- package/dist/tools/skill-retire.d.ts +12 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +2 -1
package/dist/config/schema.d.ts
CHANGED
|
@@ -590,6 +590,7 @@ export declare const KnowledgeApplicationConfigSchema: z.ZodObject<{
|
|
|
590
590
|
min_confidence: z.ZodDefault<z.ZodNumber>;
|
|
591
591
|
critical_requires_ack: z.ZodDefault<z.ZodBoolean>;
|
|
592
592
|
require_skill_refs: z.ZodDefault<z.ZodBoolean>;
|
|
593
|
+
high_risk_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
593
594
|
}, z.core.$strip>;
|
|
594
595
|
export type KnowledgeApplicationConfig = z.infer<typeof KnowledgeApplicationConfigSchema>;
|
|
595
596
|
export declare const SkillImproverConfigSchema: z.ZodObject<{
|
|
@@ -1272,6 +1273,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
1272
1273
|
min_confidence: z.ZodDefault<z.ZodNumber>;
|
|
1273
1274
|
critical_requires_ack: z.ZodDefault<z.ZodBoolean>;
|
|
1274
1275
|
require_skill_refs: z.ZodDefault<z.ZodBoolean>;
|
|
1276
|
+
high_risk_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1275
1277
|
}, z.core.$strip>>;
|
|
1276
1278
|
skill_improver: z.ZodOptional<z.ZodObject<{
|
|
1277
1279
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -94,6 +94,8 @@ export interface CuratorPhaseResult {
|
|
|
94
94
|
compliance: ComplianceObservation[];
|
|
95
95
|
knowledge_recommendations: KnowledgeRecommendation[];
|
|
96
96
|
summary_updated: boolean;
|
|
97
|
+
/** True when this phase was already digested in a prior call. */
|
|
98
|
+
already_digested?: boolean;
|
|
97
99
|
/** v2: per-knowledge-entry application audit (applied/ignored/violated/n/a). */
|
|
98
100
|
knowledge_application_findings?: KnowledgeApplicationFinding[];
|
|
99
101
|
/** v2: candidate clusters the curator suggests compiling into SKILL.md. */
|
package/dist/hooks/curator.d.ts
CHANGED
|
@@ -24,8 +24,11 @@
|
|
|
24
24
|
* This dual dispatch means agent lists are incomplete — they capture factory-dispatched
|
|
25
25
|
* curators but omit hook-dispatched ones. This is by design for hook-internal operations.
|
|
26
26
|
*/
|
|
27
|
+
import { listSkills, parseDraftFrontmatter, retireSkill } from '../services/skill-generator.js';
|
|
27
28
|
import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
|
|
29
|
+
import { readKnowledge } from './knowledge-store.js';
|
|
28
30
|
import type { KnowledgeConfig } from './knowledge-types.js';
|
|
31
|
+
import { readSkillUsageEntries } from './skill-usage-log.js';
|
|
29
32
|
/**
|
|
30
33
|
* Optional LLM delegate callback type.
|
|
31
34
|
* Takes a system prompt and user input, returns the LLM output text.
|
|
@@ -39,7 +42,22 @@ export declare const _internals: {
|
|
|
39
42
|
filterPhaseEvents: typeof filterPhaseEvents;
|
|
40
43
|
checkPhaseCompliance: typeof checkPhaseCompliance;
|
|
41
44
|
normalizeAgentName: typeof normalizeAgentName;
|
|
45
|
+
autoRetireSkills: typeof autoRetireSkills;
|
|
46
|
+
readSkillUsageEntries: typeof readSkillUsageEntries;
|
|
47
|
+
listSkills: typeof listSkills;
|
|
48
|
+
parseDraftFrontmatter: typeof parseDraftFrontmatter;
|
|
49
|
+
retireSkill: typeof retireSkill;
|
|
50
|
+
readFileAsync: (filePath: string, encoding: string) => Promise<string>;
|
|
51
|
+
readKnowledge: typeof readKnowledge;
|
|
42
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Auto-retire generated skills whose violation rate exceeds 30% or
|
|
55
|
+
* whose source knowledge entries are all archived.
|
|
56
|
+
*
|
|
57
|
+
* Non-blocking: errors are caught and logged but never propagated.
|
|
58
|
+
* Returns an array of observation strings to include in the phase digest.
|
|
59
|
+
*/
|
|
60
|
+
declare function autoRetireSkills(directory: string, curatorKnowledgePath: string): Promise<string[]>;
|
|
43
61
|
/**
|
|
44
62
|
* Parse OBSERVATIONS section from curator LLM output.
|
|
45
63
|
* Expected format per line: "- entry <uuid> (<observable>): [text]"
|
|
@@ -65,6 +65,7 @@ export interface KnowledgeApplicationConfig {
|
|
|
65
65
|
min_confidence: number;
|
|
66
66
|
critical_requires_ack: boolean;
|
|
67
67
|
require_skill_refs: boolean;
|
|
68
|
+
high_risk_tools?: string[];
|
|
68
69
|
}
|
|
69
70
|
export declare const DEFAULT_KNOWLEDGE_APPLICATION_CONFIG: KnowledgeApplicationConfig;
|
|
70
71
|
export interface GateResult {
|
|
@@ -41,6 +41,26 @@ export declare function findNearDuplicate<T extends {
|
|
|
41
41
|
}>(candidate: string, entries: T[], threshold?: number): T | undefined;
|
|
42
42
|
export declare function computeConfidence(confirmedByCount: number, autoGenerated: boolean): number;
|
|
43
43
|
export declare function inferTags(lesson: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Batch-update confidence scores on knowledge entries identified by their UUIDs.
|
|
46
|
+
*
|
|
47
|
+
* For each delta, the function:
|
|
48
|
+
* 1. Searches the swarm knowledge file for an entry with the given `id`.
|
|
49
|
+
* 2. Falls back to the hive knowledge file if not found in swarm.
|
|
50
|
+
* 3. Clamps the resulting confidence to [0.1, 1.0].
|
|
51
|
+
* 4. Updates `confidence` and `updated_at`, then rewrites the file.
|
|
52
|
+
*
|
|
53
|
+
* The full read-modify-write cycle is atomic under a directory lock
|
|
54
|
+
* (same pattern as `enforceKnowledgeCap`). Errors are logged but never
|
|
55
|
+
* thrown — the function is fail-open.
|
|
56
|
+
*
|
|
57
|
+
* @param directory - Project root directory (used to resolve `.swarm/knowledge.jsonl`).
|
|
58
|
+
* @param deltas - Array of {id, delta} tuples. Delta may be positive (boost) or negative (decay).
|
|
59
|
+
*/
|
|
60
|
+
export declare function bumpKnowledgeConfidenceBatch(directory: string, deltas: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
delta: number;
|
|
63
|
+
}>): Promise<void>;
|
|
44
64
|
export declare const _internals: {
|
|
45
65
|
getPlatformConfigDir: typeof getPlatformConfigDir;
|
|
46
66
|
resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
|
|
@@ -61,4 +81,5 @@ export declare const _internals: {
|
|
|
61
81
|
findNearDuplicate: typeof findNearDuplicate;
|
|
62
82
|
computeConfidence: typeof computeConfidence;
|
|
63
83
|
inferTags: typeof inferTags;
|
|
84
|
+
bumpKnowledgeConfidenceBatch: typeof bumpKnowledgeConfidenceBatch;
|
|
64
85
|
};
|
|
@@ -66,6 +66,9 @@ export declare const _internals: {
|
|
|
66
66
|
openSync: typeof fs.openSync;
|
|
67
67
|
readSync: typeof fs.readSync;
|
|
68
68
|
closeSync: typeof fs.closeSync;
|
|
69
|
+
resolveSourceKnowledgeIds: typeof resolveSourceKnowledgeIds;
|
|
70
|
+
applySkillUsageFeedback: typeof applySkillUsageFeedback;
|
|
71
|
+
parseGeneratedFromKnowledge: typeof parseGeneratedFromKnowledge;
|
|
69
72
|
};
|
|
70
73
|
/**
|
|
71
74
|
* Validate and append a single skill-usage entry to the JSONL log.
|
|
@@ -107,3 +110,48 @@ export declare function readSkillUsageEntriesTail(directory: string, filters: {
|
|
|
107
110
|
* @returns Stats about how many entries were pruned and how many remain.
|
|
108
111
|
*/
|
|
109
112
|
export declare function pruneSkillUsageLog(directory: string, maxEntriesPerSkill?: number): PruneResult;
|
|
113
|
+
/**
|
|
114
|
+
* Read a SKILL.md file and extract the `generated_from_knowledge` UUIDs
|
|
115
|
+
* from its YAML frontmatter.
|
|
116
|
+
*
|
|
117
|
+
* Expected frontmatter shape:
|
|
118
|
+
* ```yaml
|
|
119
|
+
* ---
|
|
120
|
+
* name: some-skill
|
|
121
|
+
* generated_from_knowledge:
|
|
122
|
+
* - uuid-1
|
|
123
|
+
* - uuid-2
|
|
124
|
+
* ---
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* Returns an empty array if the file doesn't exist, has no frontmatter,
|
|
128
|
+
* or the `generated_from_knowledge` key is absent.
|
|
129
|
+
*/
|
|
130
|
+
export declare function resolveSourceKnowledgeIds(directory: string, skillPath: string): Promise<string[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Pure helper: parse `generated_from_knowledge:` YAML list from frontmatter.
|
|
133
|
+
* Uses a minimal regex-based parser — the SKILL.md format is well-known and narrow.
|
|
134
|
+
* Does NOT use a full YAML parser to avoid adding a dependency.
|
|
135
|
+
*/
|
|
136
|
+
declare function parseGeneratedFromKnowledge(content: string): string[];
|
|
137
|
+
/**
|
|
138
|
+
* Read skill-usage entries, resolve source knowledge IDs for each skill,
|
|
139
|
+
* and apply confidence bumps/decays to the originating knowledge entries.
|
|
140
|
+
*
|
|
141
|
+
* For each unique skillPath with at least one compliance or violation entry:
|
|
142
|
+
* 1. Resolve source knowledge UUIDs from the skill's SKILL.md frontmatter.
|
|
143
|
+
* 2. Count compliant and violation events for that skill.
|
|
144
|
+
* 3. Compute net delta: if compliant count > violation count → +0.05; else → -0.1.
|
|
145
|
+
* 4. Call `bumpKnowledgeConfidenceBatch` with the aggregated deltas.
|
|
146
|
+
*
|
|
147
|
+
* @param directory - Project root directory.
|
|
148
|
+
* @param options.sinceTimestamp - Optional ISO 8601 cutoff; only process entries after this time.
|
|
149
|
+
* @returns Count of processed skills and total confidence bumps/decays applied.
|
|
150
|
+
*/
|
|
151
|
+
export declare function applySkillUsageFeedback(directory: string, options?: {
|
|
152
|
+
sinceTimestamp?: string;
|
|
153
|
+
}): Promise<{
|
|
154
|
+
processed: number;
|
|
155
|
+
bumps: number;
|
|
156
|
+
}>;
|
|
157
|
+
export {};
|