opencode-swarm 7.9.0 → 7.11.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.
- package/dist/agents/architect.d.ts +1 -0
- package/dist/agents/skill-improver.d.ts +12 -0
- package/dist/agents/spec-writer.d.ts +8 -0
- package/dist/cli/index.js +1115 -709
- package/dist/config/constants.d.ts +2 -2
- package/dist/config/schema.d.ts +103 -0
- package/dist/git/branch.d.ts +19 -0
- package/dist/hooks/curator-types.d.ts +25 -0
- package/dist/hooks/curator.d.ts +33 -1
- package/dist/hooks/knowledge-application-gate.d.ts +61 -0
- package/dist/hooks/knowledge-application.d.ts +103 -0
- package/dist/hooks/knowledge-reader.d.ts +18 -1
- package/dist/hooks/knowledge-store.d.ts +1 -0
- package/dist/hooks/knowledge-types.d.ts +96 -1
- package/dist/hooks/knowledge-validator.d.ts +16 -1
- package/dist/hooks/skill-improver-llm-factory.d.ts +30 -0
- package/dist/index.js +5973 -3534
- package/dist/plan/manager.d.ts +13 -0
- package/dist/services/skill-generator.d.ts +120 -0
- package/dist/services/skill-improver-quota.d.ts +57 -0
- package/dist/services/skill-improver.d.ts +102 -0
- package/dist/state.d.ts +40 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/knowledge-ack.d.ts +15 -0
- package/dist/tools/skill-apply.d.ts +11 -0
- package/dist/tools/skill-generate.d.ts +16 -0
- package/dist/tools/skill-improve.d.ts +16 -0
- package/dist/tools/skill-inspect.d.ts +9 -0
- package/dist/tools/skill-list.d.ts +8 -0
- package/dist/tools/spec-write.d.ts +13 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +1 -1
package/dist/plan/manager.d.ts
CHANGED
|
@@ -97,6 +97,19 @@ export declare function updateTaskStatus(directory: string, taskId: string, stat
|
|
|
97
97
|
* Ensures stable ordering: phases by ID (ascending), tasks by ID (natural numeric).
|
|
98
98
|
*/
|
|
99
99
|
export declare function derivePlanMarkdown(plan: Plan): string;
|
|
100
|
+
/**
|
|
101
|
+
* Return the id of the current task within the plan's current phase, or
|
|
102
|
+
* undefined if no incomplete task can be identified. PURE function — no I/O.
|
|
103
|
+
*
|
|
104
|
+
* Resolution: among tasks of the current phase, pick the first
|
|
105
|
+
* in_progress task; otherwise the first non-completed task; otherwise
|
|
106
|
+
* undefined (between phases / phase exhausted).
|
|
107
|
+
*
|
|
108
|
+
* Used by the v2 knowledge-injector to populate `taskId` in the retrieval
|
|
109
|
+
* context so action-aware ranking and shown-set keying can scope to a
|
|
110
|
+
* specific task.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getCurrentTaskId(plan: Plan | null | undefined): string | undefined;
|
|
100
113
|
/**
|
|
101
114
|
* Convert existing plan.md to plan.json. PURE function — no I/O.
|
|
102
115
|
*/
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge-to-skill compiler.
|
|
3
|
+
*
|
|
4
|
+
* Selects mature, high-confidence knowledge entries (with optional actionable
|
|
5
|
+
* directive metadata), clusters them, and emits SKILL.md files either as draft
|
|
6
|
+
* proposals (.swarm/skills/proposals/<slug>.md) or active generated skills
|
|
7
|
+
* (.opencode/skills/generated/<slug>/SKILL.md).
|
|
8
|
+
*
|
|
9
|
+
* Safety:
|
|
10
|
+
* - slug sanitizer rejects path traversal / control chars / absolute paths
|
|
11
|
+
* - active mode never overwrites a manually edited skill unless force=true
|
|
12
|
+
* - generated files always carry an explicit "<!-- generated -->" header
|
|
13
|
+
* - file writes are atomic (write to .tmp, rename)
|
|
14
|
+
*/
|
|
15
|
+
import type { KnowledgeEntryBase } from '../hooks/knowledge-types.js';
|
|
16
|
+
export declare function sanitizeSlug(input: string): string;
|
|
17
|
+
export declare function isValidSlug(slug: string): boolean;
|
|
18
|
+
export declare function proposalPath(directory: string, slug: string): string;
|
|
19
|
+
export declare function activePath(directory: string, slug: string): string;
|
|
20
|
+
/** Repo-relative path used inside SKILLS: file: references and entry metadata. */
|
|
21
|
+
export declare function activeRepoRelativePath(slug: string): string;
|
|
22
|
+
export interface CandidateSelectionOptions {
|
|
23
|
+
minConfidence: number;
|
|
24
|
+
minConfirmations: number;
|
|
25
|
+
}
|
|
26
|
+
export interface KnowledgeCluster {
|
|
27
|
+
slug: string;
|
|
28
|
+
title: string;
|
|
29
|
+
entries: KnowledgeEntryBase[];
|
|
30
|
+
triggers: string[];
|
|
31
|
+
required_actions: string[];
|
|
32
|
+
forbidden_actions: string[];
|
|
33
|
+
target_agents: string[];
|
|
34
|
+
verification_checks: string[];
|
|
35
|
+
avgConfidence: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function selectCandidateEntries(directory: string, opts: CandidateSelectionOptions): Promise<KnowledgeEntryBase[]>;
|
|
38
|
+
export declare function clusterEntries(entries: KnowledgeEntryBase[]): KnowledgeCluster[];
|
|
39
|
+
export declare function renderSkillMarkdown(cluster: KnowledgeCluster, mode?: GenerateMode): string;
|
|
40
|
+
export type GenerateMode = 'draft' | 'active';
|
|
41
|
+
export interface GenerateRequest {
|
|
42
|
+
directory: string;
|
|
43
|
+
mode: GenerateMode;
|
|
44
|
+
slug?: string;
|
|
45
|
+
sourceKnowledgeIds?: string[];
|
|
46
|
+
force?: boolean;
|
|
47
|
+
minConfidence?: number;
|
|
48
|
+
minConfirmations?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface GenerateResult {
|
|
51
|
+
written: Array<{
|
|
52
|
+
slug: string;
|
|
53
|
+
path: string;
|
|
54
|
+
mode: GenerateMode;
|
|
55
|
+
sourceKnowledgeIds: string[];
|
|
56
|
+
preserved: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
skipped: Array<{
|
|
59
|
+
slug: string;
|
|
60
|
+
reason: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export declare function generateSkills(req: GenerateRequest): Promise<GenerateResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Stamp source knowledge entries with `generated_skill_slug` and
|
|
66
|
+
* `generated_skill_path` metadata. Refactored in Phase G′ to take
|
|
67
|
+
* `(directory, slug, ids)` so it can be called both from direct active-mode
|
|
68
|
+
* generation AND from `activateProposal` after parsing the draft frontmatter.
|
|
69
|
+
*/
|
|
70
|
+
declare function stampSourceEntries(directory: string, slug: string, ids: string[]): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Bounded YAML frontmatter parser for generated drafts. Recognises the exact
|
|
73
|
+
* shape we emit in renderSkillMarkdown — no full YAML lib required.
|
|
74
|
+
*
|
|
75
|
+
* Returns null when the document does not begin with a `---` frontmatter
|
|
76
|
+
* fence or the closing fence is missing.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseDraftFrontmatter(content: string): {
|
|
79
|
+
name?: string;
|
|
80
|
+
status?: string;
|
|
81
|
+
sourceKnowledgeIds: string[];
|
|
82
|
+
} | null;
|
|
83
|
+
export declare function activateProposal(directory: string, slug: string, force?: boolean): Promise<{
|
|
84
|
+
activated: boolean;
|
|
85
|
+
from: string;
|
|
86
|
+
to: string;
|
|
87
|
+
reason?: string;
|
|
88
|
+
stamped?: boolean;
|
|
89
|
+
stampedIds?: string[];
|
|
90
|
+
}>;
|
|
91
|
+
export declare function listSkills(directory: string): Promise<{
|
|
92
|
+
proposals: Array<{
|
|
93
|
+
slug: string;
|
|
94
|
+
path: string;
|
|
95
|
+
}>;
|
|
96
|
+
active: Array<{
|
|
97
|
+
slug: string;
|
|
98
|
+
path: string;
|
|
99
|
+
}>;
|
|
100
|
+
}>;
|
|
101
|
+
export declare function inspectSkill(directory: string, slug: string, prefer?: 'auto' | 'proposal' | 'active'): Promise<{
|
|
102
|
+
found: boolean;
|
|
103
|
+
path?: string;
|
|
104
|
+
content?: string;
|
|
105
|
+
mode?: GenerateMode;
|
|
106
|
+
}>;
|
|
107
|
+
export declare const _internals: {
|
|
108
|
+
sanitizeSlug: typeof sanitizeSlug;
|
|
109
|
+
isValidSlug: typeof isValidSlug;
|
|
110
|
+
selectCandidateEntries: typeof selectCandidateEntries;
|
|
111
|
+
clusterEntries: typeof clusterEntries;
|
|
112
|
+
renderSkillMarkdown: typeof renderSkillMarkdown;
|
|
113
|
+
generateSkills: typeof generateSkills;
|
|
114
|
+
activateProposal: typeof activateProposal;
|
|
115
|
+
listSkills: typeof listSkills;
|
|
116
|
+
inspectSkill: typeof inspectSkill;
|
|
117
|
+
stampSourceEntries: typeof stampSourceEntries;
|
|
118
|
+
parseDraftFrontmatter: typeof parseDraftFrontmatter;
|
|
119
|
+
};
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill-improver daily-quota tracker.
|
|
3
|
+
*
|
|
4
|
+
* State file: .swarm/skill-improver-quota.json
|
|
5
|
+
* Counts every LLM-credentialed call by the skill_improver agent.
|
|
6
|
+
* The window is configurable: 'utc' (default) resets at 00:00 UTC; 'local'
|
|
7
|
+
* resets at the host's local midnight.
|
|
8
|
+
*/
|
|
9
|
+
export type QuotaWindow = 'utc' | 'local';
|
|
10
|
+
export interface QuotaState {
|
|
11
|
+
/** YYYY-MM-DD in the chosen window */
|
|
12
|
+
date: string;
|
|
13
|
+
calls_used: number;
|
|
14
|
+
max_calls: number;
|
|
15
|
+
last_run_at?: string;
|
|
16
|
+
window: QuotaWindow;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolveQuotaPath(directory: string): string;
|
|
19
|
+
export declare function todayKey(window: QuotaWindow, now?: Date): string;
|
|
20
|
+
export interface QuotaCheckOptions {
|
|
21
|
+
maxCalls: number;
|
|
22
|
+
window: QuotaWindow;
|
|
23
|
+
now?: Date;
|
|
24
|
+
}
|
|
25
|
+
export interface QuotaCheckResult {
|
|
26
|
+
allowed: boolean;
|
|
27
|
+
state: QuotaState;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Read the quota state, rolling over the day if needed. Does not increment. */
|
|
31
|
+
export declare function getQuotaState(directory: string, opts: QuotaCheckOptions): Promise<QuotaState>;
|
|
32
|
+
/**
|
|
33
|
+
* Atomically reserve `nCalls` quota slots, holding a directory-level lockfile
|
|
34
|
+
* for the read-modify-write so parallel skill_improve invocations cannot
|
|
35
|
+
* lost-update each other. Returns { allowed: false } and leaves state
|
|
36
|
+
* unchanged if the reservation would exceed max_calls.
|
|
37
|
+
*/
|
|
38
|
+
export declare function reserveQuota(directory: string, opts: QuotaCheckOptions & {
|
|
39
|
+
nCalls: number;
|
|
40
|
+
}): Promise<QuotaCheckResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Release `nCalls` previously-reserved quota slots. Floors at zero. Used by
|
|
43
|
+
* the skill_improver service when an LLM call fails BEFORE any network I/O
|
|
44
|
+
* (e.g. delegate construction error, no client wired). Once network I/O has
|
|
45
|
+
* begun, the slot stays consumed — see runSkillImprover for the policy.
|
|
46
|
+
*/
|
|
47
|
+
export declare function releaseQuota(directory: string, opts: QuotaCheckOptions & {
|
|
48
|
+
nCalls: number;
|
|
49
|
+
}): Promise<QuotaState>;
|
|
50
|
+
export declare const _internals: {
|
|
51
|
+
resolveQuotaPath: typeof resolveQuotaPath;
|
|
52
|
+
todayKey: typeof todayKey;
|
|
53
|
+
getQuotaState: typeof getQuotaState;
|
|
54
|
+
reserveQuota: typeof reserveQuota;
|
|
55
|
+
releaseQuota: typeof releaseQuota;
|
|
56
|
+
LOCK_ACQUIRE_TIMEOUT_MS: number;
|
|
57
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill-improver service — produces a proposal markdown reviewing accumulated
|
|
3
|
+
* knowledge, generated skills, the spec, and the architect prompt. When an
|
|
4
|
+
* LLM delegate is available the body is generated by the configured
|
|
5
|
+
* skill_improver agent (issue #629). When no delegate is wired and the
|
|
6
|
+
* `allow_deterministic_fallback` flag is true, a deterministic offline body
|
|
7
|
+
* is written, clearly tagged.
|
|
8
|
+
*
|
|
9
|
+
* Quota policy:
|
|
10
|
+
* - Reservation happens BEFORE any network I/O.
|
|
11
|
+
* - If the delegate is undefined and fallback is disabled, no quota is
|
|
12
|
+
* reserved — we refuse early with `no_llm_client`.
|
|
13
|
+
* - If the delegate construction itself fails before any network call
|
|
14
|
+
* (extremely unlikely in practice), we release the quota.
|
|
15
|
+
* - Once `client.session.prompt` has begun, the slot stays consumed even
|
|
16
|
+
* on failure: a flaky model must not burn unbounded retries within a
|
|
17
|
+
* window.
|
|
18
|
+
*/
|
|
19
|
+
import type { SwarmKnowledgeEntry } from '../hooks/knowledge-types.js';
|
|
20
|
+
import { type SkillImproverLLMDelegate } from '../hooks/skill-improver-llm-factory.js';
|
|
21
|
+
import { type QuotaWindow } from './skill-improver-quota.js';
|
|
22
|
+
export interface SkillImproverConfigInput {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
model: string | null;
|
|
25
|
+
fallback_models: string[];
|
|
26
|
+
max_calls_per_day: number;
|
|
27
|
+
trigger: 'manual' | 'scheduled';
|
|
28
|
+
targets: Array<'skills' | 'spec' | 'architect_prompt' | 'knowledge'>;
|
|
29
|
+
write_mode: 'proposal' | 'draft_skills';
|
|
30
|
+
require_user_approval: boolean;
|
|
31
|
+
quota_window: QuotaWindow;
|
|
32
|
+
allow_deterministic_fallback: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type SkillImproverTarget = 'skills' | 'spec' | 'architect_prompt' | 'knowledge';
|
|
35
|
+
export interface SkillImproveRequest {
|
|
36
|
+
directory: string;
|
|
37
|
+
config: SkillImproverConfigInput;
|
|
38
|
+
targets?: SkillImproverTarget[];
|
|
39
|
+
mode?: 'proposal' | 'draft_skills';
|
|
40
|
+
maxCalls?: number;
|
|
41
|
+
now?: Date;
|
|
42
|
+
sessionId?: string;
|
|
43
|
+
/** Test-only seam: inject a delegate. When undefined, the service uses
|
|
44
|
+
* createSkillImproverLLMDelegate(directory, sessionId) which returns
|
|
45
|
+
* undefined unless swarmState.opencodeClient is wired. */
|
|
46
|
+
delegate?: SkillImproverLLMDelegate;
|
|
47
|
+
}
|
|
48
|
+
export interface SkillImproveResult {
|
|
49
|
+
ran: boolean;
|
|
50
|
+
reason?: string;
|
|
51
|
+
proposalPath?: string;
|
|
52
|
+
source?: 'llm' | 'deterministic_fallback';
|
|
53
|
+
quota: {
|
|
54
|
+
date: string;
|
|
55
|
+
calls_used: number;
|
|
56
|
+
max_calls: number;
|
|
57
|
+
};
|
|
58
|
+
draftSkillsWritten?: Array<{
|
|
59
|
+
slug: string;
|
|
60
|
+
path: string;
|
|
61
|
+
sourceKnowledgeIds: string[];
|
|
62
|
+
}>;
|
|
63
|
+
model?: string;
|
|
64
|
+
}
|
|
65
|
+
interface InventorySnapshot {
|
|
66
|
+
knowledge: {
|
|
67
|
+
swarm: number;
|
|
68
|
+
hive: number;
|
|
69
|
+
archived: number;
|
|
70
|
+
};
|
|
71
|
+
skills: {
|
|
72
|
+
proposals: number;
|
|
73
|
+
active: number;
|
|
74
|
+
};
|
|
75
|
+
highConfidenceClusters: number;
|
|
76
|
+
matureCandidates: SwarmKnowledgeEntry[];
|
|
77
|
+
}
|
|
78
|
+
declare function gatherInventory(directory: string): Promise<InventorySnapshot>;
|
|
79
|
+
declare function buildSystemPrompt(targets: SkillImproverTarget[], cfg: SkillImproverConfigInput): string;
|
|
80
|
+
declare function buildUserPrompt(inv: InventorySnapshot): string;
|
|
81
|
+
declare function buildDeterministicProposal(args: {
|
|
82
|
+
targets: SkillImproverTarget[];
|
|
83
|
+
inventory: InventorySnapshot;
|
|
84
|
+
model: string | null;
|
|
85
|
+
now: Date;
|
|
86
|
+
}): string;
|
|
87
|
+
declare function buildLLMProposalFrame(args: {
|
|
88
|
+
body: string;
|
|
89
|
+
targets: SkillImproverTarget[];
|
|
90
|
+
model: string | null;
|
|
91
|
+
now: Date;
|
|
92
|
+
}): string;
|
|
93
|
+
export declare function runSkillImprover(req: SkillImproveRequest): Promise<SkillImproveResult>;
|
|
94
|
+
export declare const _internals: {
|
|
95
|
+
runSkillImprover: typeof runSkillImprover;
|
|
96
|
+
buildDeterministicProposal: typeof buildDeterministicProposal;
|
|
97
|
+
buildLLMProposalFrame: typeof buildLLMProposalFrame;
|
|
98
|
+
buildSystemPrompt: typeof buildSystemPrompt;
|
|
99
|
+
buildUserPrompt: typeof buildUserPrompt;
|
|
100
|
+
gatherInventory: typeof gatherInventory;
|
|
101
|
+
};
|
|
102
|
+
export {};
|
package/dist/state.d.ts
CHANGED
|
@@ -269,6 +269,28 @@ export declare const swarmState: {
|
|
|
269
269
|
* name at call time by matching the active session's agent prefix. */
|
|
270
270
|
curatorInitAgentNames: string[];
|
|
271
271
|
curatorPhaseAgentNames: string[];
|
|
272
|
+
/** All registered skill_improver / spec_writer agent names across swarms,
|
|
273
|
+
* mirroring curatorInitAgentNames so the LLM delegate factory can resolve
|
|
274
|
+
* the correct prefixed agent under multi-swarm configs. */
|
|
275
|
+
skillImproverAgentNames: string[];
|
|
276
|
+
specWriterAgentNames: string[];
|
|
277
|
+
/** v2: in-memory cache of "currently-active critical directive ids" per
|
|
278
|
+
* session+task, populated by the knowledge-injector when it injects a
|
|
279
|
+
* critical+matching directive. Read by the toolBefore enforcement gate
|
|
280
|
+
* so we don't re-scan the entire knowledge file on every high-risk tool
|
|
281
|
+
* call. Cleared by phase change, curator commits, knowledge mutations,
|
|
282
|
+
* and resetSwarmState. FIFO-capped — see setCriticalShownIds. */
|
|
283
|
+
currentCriticalShownIds: Map<string, {
|
|
284
|
+
ids: string[];
|
|
285
|
+
taskId?: string;
|
|
286
|
+
phase?: string;
|
|
287
|
+
generatedAt: number;
|
|
288
|
+
}>;
|
|
289
|
+
/** v2: dedup set for ack records. Key = `${sessionId}|${id}|${result}|${dayKey}`.
|
|
290
|
+
* Prevents the chat.messages.transform path AND a knowledge_ack tool call
|
|
291
|
+
* from double-counting the same ack within a session-day. FIFO-capped —
|
|
292
|
+
* see addKnowledgeAckDedup. */
|
|
293
|
+
knowledgeAckDedup: Set<string>;
|
|
272
294
|
/**
|
|
273
295
|
* All generated agent names registered with OpenCode at plugin init.
|
|
274
296
|
* Used by Full-Auto v2 delegation guard to apply strict registry-aware
|
|
@@ -514,6 +536,24 @@ export declare function hasActiveFullAuto(sessionID?: string): boolean;
|
|
|
514
536
|
export declare function setSessionEnvironment(sessionId: string, profile: EnvironmentProfile): void;
|
|
515
537
|
export declare function getSessionEnvironment(sessionId: string): EnvironmentProfile | undefined;
|
|
516
538
|
export declare function ensureSessionEnvironment(sessionId: string): EnvironmentProfile;
|
|
539
|
+
export declare const MAX_TRACKED_CRITICAL_SHOWN = 500;
|
|
540
|
+
export declare const MAX_TRACKED_KNOWLEDGE_ACKS = 5000;
|
|
541
|
+
/** Set the critical shown ids for a session, FIFO-evicting the oldest entry
|
|
542
|
+
* if the cap is exceeded. Re-setting an existing key keeps insertion order
|
|
543
|
+
* fresh for that key (delete-then-set). */
|
|
544
|
+
export declare function setCriticalShownIds(sessionID: string, value: {
|
|
545
|
+
ids: string[];
|
|
546
|
+
taskId?: string;
|
|
547
|
+
phase?: string;
|
|
548
|
+
generatedAt: number;
|
|
549
|
+
}): void;
|
|
550
|
+
/** Clear the critical shown ids for a session. Centralised so call sites do
|
|
551
|
+
* not bypass the FIFO-cap pathway with a direct `.delete()`. Returns
|
|
552
|
+
* whether an entry was removed. */
|
|
553
|
+
export declare function clearCriticalShownIds(sessionID: string): boolean;
|
|
554
|
+
/** Add a knowledge ack dedup key, FIFO-evicting the oldest if the cap is
|
|
555
|
+
* exceeded. Sets preserve insertion order in JS. */
|
|
556
|
+
export declare function addKnowledgeAckDedup(key: string): void;
|
|
517
557
|
/**
|
|
518
558
|
* Test-only dependency-injection seam. Production code calls
|
|
519
559
|
* `_internals.*` for key exported functions and objects so tests can replace
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { get_approved_plan } from './get-approved-plan';
|
|
|
20
20
|
export { get_qa_gate_profile } from './get-qa-gate-profile';
|
|
21
21
|
export { fetchGitingest, type GitingestArgs, gitingest } from './gitingest';
|
|
22
22
|
export { imports } from './imports';
|
|
23
|
+
export { knowledge_ack } from './knowledge-ack';
|
|
23
24
|
export { knowledge_add } from './knowledge-add';
|
|
24
25
|
export { knowledge_query } from './knowledge-query';
|
|
25
26
|
export { knowledge_recall } from './knowledge-recall';
|
|
@@ -42,6 +43,12 @@ export { schema_drift } from './schema-drift';
|
|
|
42
43
|
export { search } from './search';
|
|
43
44
|
export { type SecretFinding, type SecretscanResult, secretscan, } from './secretscan';
|
|
44
45
|
export { set_qa_gates } from './set-qa-gates';
|
|
46
|
+
export { skill_apply } from './skill-apply';
|
|
47
|
+
export { skill_generate } from './skill-generate';
|
|
48
|
+
export { skill_improve } from './skill-improve';
|
|
49
|
+
export { skill_inspect } from './skill-inspect';
|
|
50
|
+
export { skill_list } from './skill-list';
|
|
51
|
+
export { spec_write } from './spec-write';
|
|
45
52
|
export { submit_phase_council_verdicts } from './submit-phase-council-verdicts';
|
|
46
53
|
import { suggestPatch } from './suggest-patch';
|
|
47
54
|
export { suggestPatch };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge_ack — Architect-facing tool to record an explicit acknowledgment
|
|
3
|
+
* outcome for an injected knowledge directive.
|
|
4
|
+
*
|
|
5
|
+
* The same outcome can also be expressed inline in chat with markers like
|
|
6
|
+
* KNOWLEDGE_APPLIED: <id>
|
|
7
|
+
* KNOWLEDGE_IGNORED: <id> reason=<reason>
|
|
8
|
+
* but this tool gives a deterministic, auditable surface that doesn't depend
|
|
9
|
+
* on chat-text scanning.
|
|
10
|
+
*/
|
|
11
|
+
import { createSwarmTool } from './create-tool.js';
|
|
12
|
+
export declare const knowledge_ack: ReturnType<typeof createSwarmTool>;
|
|
13
|
+
export declare const _internals: {
|
|
14
|
+
knowledge_ack: typeof knowledge_ack;
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill_apply — Activate a draft proposal into the active generated skills tree.
|
|
3
|
+
*
|
|
4
|
+
* Refuses to overwrite an active SKILL.md that lacks the generator stamp
|
|
5
|
+
* (i.e., one a human has authored or edited) unless force=true is passed.
|
|
6
|
+
*/
|
|
7
|
+
import { createSwarmTool } from './create-tool.js';
|
|
8
|
+
export declare const skill_apply: ReturnType<typeof createSwarmTool>;
|
|
9
|
+
export declare const _internals: {
|
|
10
|
+
skill_apply: typeof skill_apply;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill_generate — Compile mature knowledge into a SKILL.md.
|
|
3
|
+
*
|
|
4
|
+
* Modes:
|
|
5
|
+
* - draft → writes .swarm/skills/proposals/<slug>.md
|
|
6
|
+
* - active → writes .opencode/skills/generated/<slug>/SKILL.md and stamps
|
|
7
|
+
* source knowledge entries with generated_skill_path metadata.
|
|
8
|
+
*
|
|
9
|
+
* Refuses to overwrite a manually edited active SKILL.md unless force=true.
|
|
10
|
+
* Slugs are sanitized; path traversal is rejected at the validator layer.
|
|
11
|
+
*/
|
|
12
|
+
import { createSwarmTool } from './create-tool.js';
|
|
13
|
+
export declare const skill_generate: ReturnType<typeof createSwarmTool>;
|
|
14
|
+
export declare const _internals: {
|
|
15
|
+
skill_generate: typeof skill_generate;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill_improve — Run the skill_improver agent / service under daily quota.
|
|
3
|
+
*
|
|
4
|
+
* Default write_mode is 'proposal' — writes only to
|
|
5
|
+
* .swarm/skill-improver/proposals/<ts>.md and never mutates source code.
|
|
6
|
+
* 'draft_skills' mode additionally calls skill_generate (draft mode) for
|
|
7
|
+
* mature, un-compiled clusters.
|
|
8
|
+
*
|
|
9
|
+
* Closes issue #629: lets users wire an expensive OpenRouter model and cap
|
|
10
|
+
* its usage to e.g. 10 calls/day.
|
|
11
|
+
*/
|
|
12
|
+
import { createSwarmTool } from './create-tool.js';
|
|
13
|
+
export declare const skill_improve: ReturnType<typeof createSwarmTool>;
|
|
14
|
+
export declare const _internals: {
|
|
15
|
+
skill_improve: typeof skill_improve;
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill_inspect — Print a generated skill (active or draft) with its source
|
|
3
|
+
* knowledge IDs.
|
|
4
|
+
*/
|
|
5
|
+
import { createSwarmTool } from './create-tool.js';
|
|
6
|
+
export declare const skill_inspect: ReturnType<typeof createSwarmTool>;
|
|
7
|
+
export declare const _internals: {
|
|
8
|
+
skill_inspect: typeof skill_inspect;
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill_list — List generator-emitted skill drafts and active SKILL.md files.
|
|
3
|
+
*/
|
|
4
|
+
import { createSwarmTool } from './create-tool.js';
|
|
5
|
+
export declare const skill_list: ReturnType<typeof createSwarmTool>;
|
|
6
|
+
export declare const _internals: {
|
|
7
|
+
skill_list: typeof skill_list;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spec_write — Safe writer for `.swarm/spec.md`.
|
|
3
|
+
*
|
|
4
|
+
* Allows the spec_writer agent (or architect) to update the project spec
|
|
5
|
+
* without granting general filesystem write access. Validates target path is
|
|
6
|
+
* `.swarm/spec.md`, performs an atomic rename, and rejects content that would
|
|
7
|
+
* break the basic shape (must be markdown, must contain a top-level heading).
|
|
8
|
+
*/
|
|
9
|
+
import { createSwarmTool } from './create-tool.js';
|
|
10
|
+
export declare const spec_write: ReturnType<typeof createSwarmTool>;
|
|
11
|
+
export declare const _internals: {
|
|
12
|
+
spec_write: typeof spec_write;
|
|
13
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Used for constants and agent setup references.
|
|
4
4
|
*/
|
|
5
5
|
/** Union type of all valid tool names */
|
|
6
|
-
export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence';
|
|
6
|
+
export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_improve' | 'spec_write' | 'knowledge_ack';
|
|
7
7
|
/** Readonly array of all tool names */
|
|
8
8
|
export declare const TOOL_NAMES: readonly ToolName[];
|
|
9
9
|
/** Set for O(1) tool name validation */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.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",
|