opencode-swarm 7.0.0 → 7.0.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/README.md +4 -3
- package/dist/__tests__/convene-general-council.test.d.ts +4 -2
- package/dist/agents/council-prompts.d.ts +26 -0
- package/dist/agents/council-prompts.test.d.ts +9 -0
- package/dist/agents/council-registration.test.d.ts +23 -0
- package/dist/agents/index.d.ts +1 -2
- package/dist/cli/index.d.ts +30 -0
- package/dist/cli/index.js +300 -73
- package/dist/commands/registry.d.ts +3 -3
- package/dist/commands/reset.d.ts +1 -1
- package/dist/config/cache-paths.d.ts +6 -0
- package/dist/config/constants.d.ts +2 -2
- package/dist/council/general-council-advisory.d.ts +1 -1
- package/dist/council/general-council-types.d.ts +44 -17
- package/dist/index.js +683 -686
- package/dist/plan/checkpoint.d.ts +2 -2
- package/dist/tools/checkpoint.d.ts +10 -0
- package/dist/tools/convene-general-council.d.ts +5 -4
- package/dist/tools/web-search.d.ts +1 -1
- package/package.json +1 -1
- package/dist/agents/council-member.d.ts +0 -30
- package/dist/agents/council-member.test.d.ts +0 -8
- package/dist/agents/council-moderator.d.ts +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Plan } from '../config/plan-schema';
|
|
2
2
|
/**
|
|
3
|
-
* Write SWARM_PLAN.json and SWARM_PLAN.md
|
|
3
|
+
* Write SWARM_PLAN.json and SWARM_PLAN.md inside the .swarm/ directory under the project root.
|
|
4
4
|
* Non-blocking: logs a warning on failure but never throws.
|
|
5
5
|
* @param directory - The working directory (project root)
|
|
6
6
|
*/
|
|
@@ -14,7 +14,7 @@ export interface ImportCheckpointResult {
|
|
|
14
14
|
error?: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Import a checkpoint from SWARM_PLAN.json
|
|
17
|
+
* Import a checkpoint from .swarm/SWARM_PLAN.json (with backward-compat fallback to project root).
|
|
18
18
|
* Validates the checkpoint against PlanSchema, persists it as the live plan
|
|
19
19
|
* via savePlan, and appends a 'plan_rebuilt' ledger event.
|
|
20
20
|
*
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
2
|
+
/**
|
|
3
|
+
* Record a checkpoint without staging or committing changes.
|
|
4
|
+
* Writes only to .swarm/checkpoints.json with the current HEAD SHA.
|
|
5
|
+
* Used by spiral detection to avoid silently committing mid-flight user work.
|
|
6
|
+
*/
|
|
7
|
+
export declare function saveCheckpointRecord(label: string, directory: string): {
|
|
8
|
+
success: boolean;
|
|
9
|
+
sha?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
};
|
|
2
12
|
export declare const checkpoint: ToolDefinition;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* General Council Mode — architect-only synthesis tool.
|
|
3
3
|
*
|
|
4
|
-
* The architect spawns
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The architect spawns council_generalist / council_skeptic /
|
|
5
|
+
* council_domain_expert subagents in parallel for Round 1, collects their
|
|
6
|
+
* JSON responses, and calls this tool to synthesize results. If the tool
|
|
7
|
+
* detects disagreements and Round 2 deliberation is configured, the
|
|
8
|
+
* architect re-delegates to disputing members and calls this tool again
|
|
8
9
|
* with both round1Responses and round2Responses populated.
|
|
9
10
|
*
|
|
10
11
|
* Mirrors the convene-council.ts skeleton but explicitly does NOT inherit
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web_search tool —
|
|
2
|
+
* web_search tool — owned by the architect for MODE: COUNCIL pre-search.
|
|
3
3
|
*
|
|
4
4
|
* Thin wrapper around `src/council/web-search-provider.ts`. Returns structured
|
|
5
5
|
* results on success and structured errors on failure (never throws). Config-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.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",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General Council member agent.
|
|
3
|
-
*
|
|
4
|
-
* Implements the NSED peer-review protocol (arXiv:2601.16863):
|
|
5
|
-
* - Round 1: independent search + answer with self-reported confidence
|
|
6
|
-
* - Round 2: targeted deliberation on disagreements with explicit MAINTAIN /
|
|
7
|
-
* CONCEDE / NUANCE stance (ConfMAD)
|
|
8
|
-
*
|
|
9
|
-
* Tools: web_search ONLY. No write tools, no orchestration tools. The architect
|
|
10
|
-
* spawns members in parallel via the OpenCode subagent task system, collects
|
|
11
|
-
* structured JSON responses, and synthesizes via convene_general_council.
|
|
12
|
-
*
|
|
13
|
-
* Prompt template variables (substituted by the architect at delegation time):
|
|
14
|
-
* {{MEMBER_ID}} — the council member identifier
|
|
15
|
-
* {{ROLE}} — generalist | skeptic | domain_expert | devil_advocate | synthesizer
|
|
16
|
-
* {{PERSONA_BLOCK}} — optional persona instructions (omitted if undefined)
|
|
17
|
-
* {{ROUND}} — "1" or "2"
|
|
18
|
-
* {{DISAGREEMENT_BLOCK}} — Round 2 only: opposing position(s) to address
|
|
19
|
-
*/
|
|
20
|
-
import type { AgentDefinition } from './architect';
|
|
21
|
-
export declare const COUNCIL_MEMBER_PROMPT = "You are Council Member {{MEMBER_ID}} ({{ROLE}}) on a multi-model General Council.\n\n{{PERSONA_BLOCK}}\n\nYou are participating in Round {{ROUND}} of a structured deliberation. Your job is to give your independent, evidence-grounded perspective \u2014 not to agree with the group.\n\n================================================================\nROUND {{ROUND}} PROTOCOL\n================================================================\n\nROUND 1 \u2014 Independent Research and Answer\n- Issue 1\u20133 targeted web_search calls to gather evidence relevant to the question.\n- Cite EVERY factual claim with a source URL from your search results.\n- State your confidence (0.0\u20131.0) explicitly. Be honest \u2014 overconfident answers hurt the council.\n- Enumerate areas of uncertainty so the architect knows where you're guessing vs. where you're sure.\n- Do NOT coordinate with other members. You will not see their responses until Round 2.\n- Do NOT pad. Be concise. Substance over volume.\n\nROUND 2 \u2014 Targeted Deliberation (ONLY when this round is invoked for you)\n- {{DISAGREEMENT_BLOCK}}\n- Issue at most 1 additional web_search call.\n- Declare your stance explicitly using one of these keywords as the FIRST word of a paragraph:\n MAINTAIN \u2014 your Round 1 position holds; cite the new evidence supporting it\n CONCEDE \u2014 the opposing position is correct; state specifically what you got wrong\n NUANCE \u2014 both positions are partially right; state the boundary condition that distinguishes them\n- Never CONCEDE without evidence. Sycophantic capitulation degrades the council below an individual member's baseline (NSED arXiv:2601.16863).\n- Never MAINTAIN without engaging the opposing argument on its merits.\n\n================================================================\nRESPONSE FORMAT (always \u2014 both rounds)\n================================================================\n\nReply with a single fenced JSON block. No prose outside the block.\n\n```json\n{\n \"memberId\": \"{{MEMBER_ID}}\",\n \"role\": \"{{ROLE}}\",\n \"round\": {{ROUND}},\n \"response\": \"Your full answer (Round 1) or stance + reasoning (Round 2). Markdown OK inside the string.\",\n \"searchQueries\": [\"query 1\", \"query 2\"],\n \"sources\": [\n { \"title\": \"...\", \"url\": \"...\", \"snippet\": \"...\", \"query\": \"...\" }\n ],\n \"confidence\": 0.85,\n \"areasOfUncertainty\": [\n \"What I'm not sure about, in plain language.\"\n ],\n \"disagreementTopics\": []\n}\n```\n\nFor Round 1: leave `disagreementTopics` as []. For Round 2: list the specific disagreement topics this response addresses.\n\n================================================================\nHARD RULES\n================================================================\n- web_search is your ONLY tool. You cannot read or write files, run commands, or delegate.\n- Never invent sources. If a search returns nothing useful, say so in `areasOfUncertainty`.\n- Never echo other members' responses verbatim. Paraphrase or quote with attribution.\n- Stay within your role and persona. The architect chose you for a specific perspective.\n";
|
|
22
|
-
/**
|
|
23
|
-
* Factory for the council_member agent definition. The factory mirrors other
|
|
24
|
-
* agent factories (createSMEAgent, createReviewerAgent) for consistency.
|
|
25
|
-
*
|
|
26
|
-
* Per-member context (memberId, role, persona, round, disagreement) is supplied
|
|
27
|
-
* by the architect at delegation time via prompt-string substitution; the
|
|
28
|
-
* factory itself produces the unparameterized template.
|
|
29
|
-
*/
|
|
30
|
-
export declare function createCouncilMemberAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for src/agents/council-member.ts and src/agents/council-moderator.ts.
|
|
3
|
-
*
|
|
4
|
-
* Covers prompt template content (NSED protocol markers), AGENT_TOOL_MAP
|
|
5
|
-
* enforcement (web_search-only for member, empty for moderator), and the
|
|
6
|
-
* persona-block insertion path.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General Council moderator agent.
|
|
3
|
-
*
|
|
4
|
-
* Receives the structural synthesis output from convene_general_council
|
|
5
|
-
* (consensus / disagreements / sources) and produces a coherent, well-structured
|
|
6
|
-
* final answer for the user. Empty tool list — moderation is synthesis-only;
|
|
7
|
-
* it does NOT need web_search because every claim it works with has already
|
|
8
|
-
* been searched and cited by council members.
|
|
9
|
-
*
|
|
10
|
-
* Confidence-weighted (Quadratic Voting from NSED arXiv:2601.16863): higher-
|
|
11
|
-
* confidence members carry more weight, but evidence quality matters more
|
|
12
|
-
* than confidence alone. The moderator must NOT favor a position purely
|
|
13
|
-
* because its proponent was confident.
|
|
14
|
-
*/
|
|
15
|
-
import type { AgentDefinition } from './architect';
|
|
16
|
-
export declare const COUNCIL_MODERATOR_PROMPT = "You are the General Council Moderator.\n\nYou are receiving the structural synthesis from a multi-model council deliberation:\n- Question (and mode: general or spec_review)\n- All member Round 1 responses with sources\n- Detected disagreements\n- Round 2 deliberation responses (if any)\n- Confidence-weighted consensus claims\n- Persisting disagreements after deliberation\n\nYour job: produce a coherent, well-structured final answer for the user.\n\n================================================================\nRULES\n================================================================\n\n1. LEAD WITH CONSENSUS \u2014 open with the strongest consensus position. Use the\n confidence-weighted ordering (Quadratic Voting): higher-confidence claims\n from multiple members rank higher, but evidence quality outranks raw\n confidence. Never elevate a single confident voice over a well-evidenced\n contrary majority.\n\n2. ACKNOWLEDGE DISAGREEMENT HONESTLY \u2014 for each persisting disagreement, write\n \"experts disagree on X because\u2026\" and present the strongest version of each\n side. Do NOT pretend disagreements are resolved when they are not. Do NOT\n silently pick a winner.\n\n3. CITE THE STRONGEST SOURCES \u2014 link key claims with [title](url) format from\n the deduplicated source list. Pick the most reputable source for each claim;\n do not cite duplicates.\n\n4. BE CONCISE \u2014 the user wants an answer, not a committee report. Default\n length: a few short paragraphs plus a bulleted summary. Expand only when\n the question genuinely requires it.\n\n================================================================\nHARD CONSTRAINTS\n================================================================\n\n- You MUST NOT invent claims that are not present in the council's responses.\n- You MUST NOT add new web research. If something was missed, say so.\n- You MUST NOT favor a position based on member confidence alone \u2014 evidence\n quality is the tie-breaker.\n- You have NO tools. You write the final synthesis from the input given.\n\n================================================================\nOUTPUT FORMAT\n================================================================\n\nPlain markdown. No code fences. No JSON. Suggested structure:\n\n# Answer\n\n<lead consensus position with citation(s)>\n\n<remaining consensus / context paragraphs as needed>\n\n## Where Experts Disagree\n\n- <topic 1>: <position A> vs <position B>, with sources for each\n- <topic 2>: ...\n\n## Sources\n\n- [title](url)\n- ...\n\n(Omit any section that is empty.)\n";
|
|
17
|
-
/**
|
|
18
|
-
* Factory for the council_moderator agent definition. No tools — synthesis only.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createCouncilModeratorAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
|