opencode-swarm 7.43.1 → 7.44.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/cli/index.js +594 -377
- package/dist/hooks/knowledge-events.d.ts +193 -0
- package/dist/hooks/knowledge-reader.d.ts +3 -10
- package/dist/hooks/knowledge-store.d.ts +4 -1
- package/dist/hooks/knowledge-types.d.ts +2 -0
- package/dist/hooks/search-knowledge.d.ts +74 -0
- package/dist/index.js +2020 -1447
- package/dist/services/knowledge-diagnostics.d.ts +46 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/knowledge-archive.d.ts +18 -0
- package/dist/tools/knowledge-receipt.d.ts +19 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge-system diagnostics: a reusable debug-metadata helper that any
|
|
3
|
+
* knowledge tool can surface, plus a `/swarm diagnose` health summary.
|
|
4
|
+
*
|
|
5
|
+
* Path/version drift is a documented diagnostic concern (a stale plugin cache or
|
|
6
|
+
* a mismatched resolved directory can make the knowledge store look broken).
|
|
7
|
+
* This module reports the exact resolved paths, raw-vs-normalized entry counts,
|
|
8
|
+
* status breakdown, event volume, and cache freshness so those issues surface.
|
|
9
|
+
*/
|
|
10
|
+
export interface KnowledgeDebugMeta {
|
|
11
|
+
plugin_version: string;
|
|
12
|
+
directory: string;
|
|
13
|
+
swarm_path: string;
|
|
14
|
+
hive_path: string;
|
|
15
|
+
events_path: string;
|
|
16
|
+
raw_entry_count: number;
|
|
17
|
+
normalized_entry_count: number;
|
|
18
|
+
corrupt_line_count: number;
|
|
19
|
+
schema_versions: Record<string, number>;
|
|
20
|
+
entries_missing_v2_counters: number;
|
|
21
|
+
status_breakdown: {
|
|
22
|
+
active: number;
|
|
23
|
+
archived: number;
|
|
24
|
+
quarantined: number;
|
|
25
|
+
rejected: number;
|
|
26
|
+
};
|
|
27
|
+
event_count: number;
|
|
28
|
+
retrieval_events_7d: number;
|
|
29
|
+
cache_status: 'fresh' | 'stale' | 'unknown';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Compute the debug-metadata block for the knowledge system. Best-effort: never
|
|
33
|
+
* throws (each I/O step degrades to zero/empty). Aggregates swarm + hive tiers.
|
|
34
|
+
*/
|
|
35
|
+
export declare function computeKnowledgeDebug(directory: string): Promise<KnowledgeDebugMeta>;
|
|
36
|
+
export interface KnowledgeHealth {
|
|
37
|
+
name: string;
|
|
38
|
+
status: '✅' | '❌' | '⚠️' | '⬜';
|
|
39
|
+
detail: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build the "Knowledge health" diagnose check from the debug metadata. Warns on
|
|
43
|
+
* raw-vs-normalized mismatch (corrupt lines), entries missing v2 counters, or a
|
|
44
|
+
* stale plugin cache; otherwise reports a healthy summary.
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkKnowledgeHealth(directory: string): Promise<KnowledgeHealth>;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -22,8 +22,10 @@ export { fetchGitingest, type GitingestArgs, gitingest } from './gitingest';
|
|
|
22
22
|
export { imports } from './imports';
|
|
23
23
|
export { knowledge_ack } from './knowledge-ack';
|
|
24
24
|
export { knowledge_add } from './knowledge-add';
|
|
25
|
+
export { knowledge_archive } from './knowledge-archive';
|
|
25
26
|
export { knowledge_query } from './knowledge-query';
|
|
26
27
|
export { knowledge_recall } from './knowledge-recall';
|
|
28
|
+
export { knowledge_receipt } from './knowledge-receipt';
|
|
27
29
|
export { knowledge_remove } from './knowledge-remove';
|
|
28
30
|
export { lint } from './lint';
|
|
29
31
|
export { phase_complete } from './phase-complete';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge_archive — archival-by-default removal with audit tombstones.
|
|
3
|
+
*
|
|
4
|
+
* Unlike knowledge_remove (which hard-deletes a swarm entry), this tool defaults
|
|
5
|
+
* to a reversible status transition and always appends an immutable `archived`
|
|
6
|
+
* event to `.swarm/knowledge-events.jsonl` recording the actor, reason, evidence,
|
|
7
|
+
* and previous status.
|
|
8
|
+
*
|
|
9
|
+
* Modes:
|
|
10
|
+
* - 'archive' (default): set status='archived' — TTL-exempt, hidden from recall.
|
|
11
|
+
* - 'quarantine': set status='quarantined' — suspected-bad, hidden from recall.
|
|
12
|
+
* - 'purge': hard-delete the JSONL line. Requires allow_purge:true.
|
|
13
|
+
*/
|
|
14
|
+
import { createSwarmTool } from './create-tool.js';
|
|
15
|
+
export declare const knowledge_archive: ReturnType<typeof createSwarmTool>;
|
|
16
|
+
export declare const _internals: {
|
|
17
|
+
knowledge_archive: typeof knowledge_archive;
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge_receipt — the strong successor to knowledge_ack.
|
|
3
|
+
*
|
|
4
|
+
* An agent files a single receipt summarizing how it considered the knowledge
|
|
5
|
+
* surfaced by a retrieval (referenced by `trace_id`): which entries were
|
|
6
|
+
* applied, which were ignored (with a reason), which were contradicted by
|
|
7
|
+
* current evidence (with a proposed remediation), and any new lessons learned.
|
|
8
|
+
*
|
|
9
|
+
* Each applied/ignored/contradicted item becomes one immutable event in
|
|
10
|
+
* `.swarm/knowledge-events.jsonl`. New lessons are persisted through the normal
|
|
11
|
+
* knowledge_add validation/dedup path. When a retrieval surfaced nothing
|
|
12
|
+
* relevant, the receipt can set `no_relevant_knowledge: true` — the point is to
|
|
13
|
+
* force explicit consideration, not fake usage.
|
|
14
|
+
*/
|
|
15
|
+
import { createSwarmTool } from './create-tool.js';
|
|
16
|
+
export declare const knowledge_receipt: ReturnType<typeof createSwarmTool>;
|
|
17
|
+
export declare const _internals: {
|
|
18
|
+
knowledge_receipt: typeof knowledge_receipt;
|
|
19
|
+
};
|
|
@@ -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' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_regenerate' | 'skill_retire' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'swarm_memory_recall' | 'swarm_memory_propose' | 'swarm_command' | 'summarize_work' | 'write_architecture_supervisor_evidence' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
|
|
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_regenerate' | 'skill_retire' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'knowledge_receipt' | 'knowledge_archive' | 'swarm_memory_recall' | 'swarm_memory_propose' | 'swarm_command' | 'summarize_work' | 'write_architecture_supervisor_evidence' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
|
|
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.44.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",
|