opencode-swarm 7.67.0 → 7.68.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.
@@ -1,6 +1,17 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  type SpawnSyncFn = typeof spawnSync;
3
3
  export type MutationOutcome = 'killed' | 'survived' | 'timeout' | 'error' | 'equivalent' | 'skipped';
4
+ /**
5
+ * Known test runner executables permitted as the first element of testCommand.
6
+ * Validated as the basename (without extension) to support platform-specific
7
+ * variants like `bun.exe` on Windows or full paths like `/usr/local/bin/jest`.
8
+ */
9
+ export declare const ALLOWED_TEST_RUNNERS: Set<string>;
10
+ /**
11
+ * Validate that testCommand[0] is a known test runner.
12
+ * Returns an error string if invalid, or null if valid.
13
+ */
14
+ export declare function validateTestCommand(testCommand: string[]): string | null;
4
15
  export interface MutationPatch {
5
16
  id: string;
6
17
  filePath: string;
@@ -50,7 +61,7 @@ export declare const _internals: {
50
61
  executeMutationSuite: typeof executeMutationSuite;
51
62
  spawnSync: SpawnSyncFn;
52
63
  };
53
- export declare function executeMutation(patch: MutationPatch, testCommand: string[], _testFiles: string[], workingDir: string): Promise<MutationResult>;
64
+ export declare function executeMutation(patch: MutationPatch, testCommand: string[], testFiles: string[], workingDir: string): Promise<MutationResult>;
54
65
  export declare function computeReport(results: MutationResult[], durationMs: number, budgetMs?: number): MutationReport;
55
66
  export declare function executeMutationSuite(patches: MutationPatch[], testCommand: string[], testFiles: string[], workingDir: string, budgetMs?: number, onProgress?: (completed: number, total: number, result: MutationResult) => void, sourceFiles?: Map<string, string>): Promise<MutationReport>;
56
67
  export {};
@@ -0,0 +1,63 @@
1
+ export interface LearningMetrics {
2
+ violationTrends: ViolationTrend[];
3
+ overallViolationRate: {
4
+ window7d: number;
5
+ window30d: number;
6
+ };
7
+ applicationRateByPriority: Record<string, {
8
+ applied: number;
9
+ total: number;
10
+ rate: number;
11
+ }>;
12
+ timeToLatestApplication: TimeToApply[];
13
+ escalationFrequency: {
14
+ total: number;
15
+ last7d: number;
16
+ last30d: number;
17
+ };
18
+ unacknowledgedCriticalCount: number;
19
+ entryROI: EntryROI[];
20
+ neverApplied: NeverAppliedEntry[];
21
+ learningSummary: string;
22
+ sessionCount: number;
23
+ }
24
+ export interface ViolationTrend {
25
+ entryId: string;
26
+ lesson: string;
27
+ priority: string;
28
+ violationRate7d: number;
29
+ violationRate30d: number;
30
+ trend: 'improving' | 'worsening' | 'stable' | 'no_data';
31
+ }
32
+ export interface EntryROI {
33
+ entryId: string;
34
+ lesson: string;
35
+ appliedCount: number;
36
+ shownCount: number;
37
+ succeededCount: number;
38
+ failedCount: number;
39
+ roi: 'high' | 'medium' | 'low' | 'unused';
40
+ }
41
+ export interface TimeToApply {
42
+ entryId: string;
43
+ lesson: string;
44
+ daysToApply: number | null;
45
+ }
46
+ export interface NeverAppliedEntry {
47
+ entryId: string;
48
+ lesson: string;
49
+ phasesAlive: number;
50
+ }
51
+ export declare function computeLearningMetrics(directory: string, options?: {
52
+ now?: Date;
53
+ currentPhase?: number;
54
+ }): Promise<LearningMetrics>;
55
+ export declare function formatLearningMarkdown(metrics: LearningMetrics): string;
56
+ export declare function formatLearningJSON(metrics: LearningMetrics): object;
57
+ export declare function formatLearningSummary(metrics: LearningMetrics): string;
58
+ export declare const _internals: {
59
+ computeLearningMetrics: typeof computeLearningMetrics;
60
+ formatLearningMarkdown: typeof formatLearningMarkdown;
61
+ formatLearningJSON: typeof formatLearningJSON;
62
+ formatLearningSummary: typeof formatLearningSummary;
63
+ };
@@ -0,0 +1,21 @@
1
+ export declare const MAX_CHANGELOG_ENTRIES_PER_SKILL = 200;
2
+ export interface SkillChangelogEntry {
3
+ version: number;
4
+ timestamp: string;
5
+ action: 'generated' | 'regenerated' | 'revised' | 'promoted';
6
+ reason: string;
7
+ triggeringVerdicts?: {
8
+ taskId: string;
9
+ verdict: string;
10
+ agent: string;
11
+ }[];
12
+ sectionsChanged?: string[];
13
+ }
14
+ export declare function resolveSkillChangelogPath(directory: string, slug: string): string;
15
+ export declare function appendSkillChangelog(directory: string, slug: string, entry: SkillChangelogEntry): Promise<void>;
16
+ export declare function readSkillChangelog(directory: string, slug: string): Promise<SkillChangelogEntry[]>;
17
+ export declare const _internals: {
18
+ resolveSkillChangelogPath: typeof resolveSkillChangelogPath;
19
+ appendSkillChangelog: typeof appendSkillChangelog;
20
+ readSkillChangelog: typeof readSkillChangelog;
21
+ };
@@ -42,7 +42,11 @@ export declare function selectCandidateEntries(directory: string, opts: Candidat
42
42
  */
43
43
  declare function jaccardSimilarity(setA: string[], setB: string[]): number;
44
44
  export declare function clusterEntries(entries: KnowledgeEntryBase[]): KnowledgeCluster[];
45
- export declare function renderSkillMarkdown(cluster: KnowledgeCluster, mode?: GenerateMode, generatedAt?: string): string;
45
+ export interface SkillFrontmatterOverrides {
46
+ version?: number;
47
+ skillOrigin?: 'generated' | 'promoted_external';
48
+ }
49
+ export declare function renderSkillMarkdown(cluster: KnowledgeCluster, mode?: GenerateMode, generatedAt?: string, overrides?: SkillFrontmatterOverrides): string;
46
50
  export type GenerateMode = 'draft' | 'active';
47
51
  export interface GenerateRequest {
48
52
  directory: string;
@@ -86,6 +90,8 @@ export declare function parseDraftFrontmatter(content: string): {
86
90
  status?: string;
87
91
  generatedAt?: string;
88
92
  sourceKnowledgeIds: string[];
93
+ version?: number;
94
+ skillOrigin?: string;
89
95
  } | null;
90
96
  export declare function activateProposal(directory: string, slug: string, force?: boolean): Promise<{
91
97
  activated: boolean;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Skill revision service.
3
+ *
4
+ * When a skill's violation rate crosses a soft threshold (>15% but ≤30%),
5
+ * produces a revised version by feeding violation contexts into a bounded
6
+ * LLM rewrite of the violated sections. Reuses the skill_improver.max_calls_per_day
7
+ * quota budget but is capped to max 3 LLM calls per curator phase to avoid
8
+ * starving manual skill-improve runs.
9
+ *
10
+ * Falls back to deterministic revision (append revision notes) when no LLM
11
+ * delegate is available or quota is exhausted.
12
+ */
13
+ import type { SkillImproverLLMDelegate } from '../hooks/skill-improver-llm-factory.js';
14
+ import type { QuotaWindow } from './skill-improver-quota.js';
15
+ export declare const REVISION_VIOLATION_THRESHOLD = 0.15;
16
+ export declare const MAX_REVISION_CALLS_PER_PHASE = 3;
17
+ export interface ViolationContext {
18
+ taskId: string;
19
+ agent: string;
20
+ verdict: string;
21
+ reviewerNotes?: string;
22
+ timestamp: string;
23
+ }
24
+ export interface SkillRevisionResult {
25
+ revised: boolean;
26
+ reason: string;
27
+ newVersion?: number;
28
+ quotaConsumed: boolean;
29
+ }
30
+ export interface ReviseSkillParams {
31
+ directory: string;
32
+ slug: string;
33
+ skillPath: string;
34
+ violationContexts: ViolationContext[];
35
+ currentContent: string;
36
+ currentVersion: number;
37
+ maxCalls?: number;
38
+ quotaWindow?: QuotaWindow;
39
+ delegate?: SkillImproverLLMDelegate;
40
+ now?: Date;
41
+ }
42
+ export declare function getSkillVersion(skillPath: string): Promise<number>;
43
+ export declare function buildDeterministicRevision(currentContent: string, currentVersion: number, violationContexts: ViolationContext[]): string;
44
+ declare function buildLLMPrompt(currentContent: string, currentVersion: number, violationContexts: ViolationContext[]): {
45
+ systemPrompt: string;
46
+ userPrompt: string;
47
+ };
48
+ declare function validateLLMOutput(output: string): boolean;
49
+ export declare function reviseSkill(params: ReviseSkillParams): Promise<SkillRevisionResult>;
50
+ export declare const _internals: {
51
+ reviseSkill: typeof reviseSkill;
52
+ getSkillVersion: typeof getSkillVersion;
53
+ buildDeterministicRevision: typeof buildDeterministicRevision;
54
+ buildLLMPrompt: typeof buildLLMPrompt;
55
+ validateLLMOutput: typeof validateLLMOutput;
56
+ REVISION_VIOLATION_THRESHOLD: number;
57
+ MAX_REVISION_CALLS_PER_PHASE: number;
58
+ };
59
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.67.0",
3
+ "version": "7.68.0",
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",