opencode-swarm 6.83.0 → 6.84.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 +3 -1
- package/dist/__tests__/convene-general-council.test.d.ts +10 -0
- package/dist/__tests__/disagreement-detector.test.d.ts +7 -0
- package/dist/__tests__/general-council-service.test.d.ts +7 -0
- package/dist/__tests__/qa-gate-hardening.test.d.ts +12 -0
- package/dist/__tests__/web-search-provider.test.d.ts +6 -0
- package/dist/agents/architect.d.ts +9 -1
- package/dist/agents/council-member.d.ts +30 -0
- package/dist/agents/council-member.test.d.ts +8 -0
- package/dist/agents/council-moderator.d.ts +20 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/cli/index.js +119 -8
- package/dist/commands/council.d.ts +17 -0
- package/dist/commands/council.test.d.ts +4 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/registry.d.ts +7 -1
- package/dist/config/constants.d.ts +3 -3
- package/dist/config/schema.d.ts +109 -0
- package/dist/council/disagreement-detector.d.ts +24 -0
- package/dist/council/general-council-advisory.d.ts +29 -0
- package/dist/council/general-council-service.d.ts +22 -0
- package/dist/council/general-council-types.d.ts +98 -0
- package/dist/council/web-search-provider.d.ts +35 -0
- package/dist/db/qa-gate-profile.d.ts +5 -1
- package/dist/index.js +1581 -393
- package/dist/tools/convene-general-council.d.ts +25 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/set-qa-gates.d.ts +1 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/dist/tools/web-search.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General Council Mode — advisory routing helper.
|
|
3
|
+
*
|
|
4
|
+
* Sibling to ./council-advisory.ts (which is hard-typed to CouncilSynthesis
|
|
5
|
+
* for the verdict-based Work Complete Council). This helper accepts a
|
|
6
|
+
* GeneralCouncilResult and renders an advisory body the architect will see
|
|
7
|
+
* on its next turn via the standard pendingAdvisoryMessages → ADVISORIES
|
|
8
|
+
* messagesTransform flow.
|
|
9
|
+
*
|
|
10
|
+
* Design choices:
|
|
11
|
+
* - No dedup. The general council is user-triggered (`/swarm council ...`);
|
|
12
|
+
* a user asking the same question twice expects two advisories. The
|
|
13
|
+
* QA-council dedup-by-taskId-and-round semantic doesn't apply here —
|
|
14
|
+
* general council has no taskId.
|
|
15
|
+
* - No "blocking" header. The general council is advisory by definition.
|
|
16
|
+
* Use a clear visual marker so the architect distinguishes it from the
|
|
17
|
+
* QA council's blocking advisories.
|
|
18
|
+
*/
|
|
19
|
+
import type { AgentSessionState } from '../state';
|
|
20
|
+
import type { GeneralCouncilResult } from './general-council-types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Push a GeneralCouncilResult into the architect's advisory queue. The body
|
|
23
|
+
* is the synthesis markdown plus the moderator output when present.
|
|
24
|
+
*
|
|
25
|
+
* Safe to call: missing session or empty advisory body silently skips.
|
|
26
|
+
* Always idempotent at the architect-prompt level (no duplicate-suppression
|
|
27
|
+
* here — see header comment for rationale).
|
|
28
|
+
*/
|
|
29
|
+
export declare function pushGeneralCouncilAdvisory(session: Pick<AgentSessionState, 'pendingAdvisoryMessages'>, result: GeneralCouncilResult): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General Council Mode — pure synthesis service.
|
|
3
|
+
*
|
|
4
|
+
* No I/O, no HTTP. Takes completed member responses for all rounds and
|
|
5
|
+
* produces the final `GeneralCouncilResult`. Mirrors the design of
|
|
6
|
+
* `./council-service.ts` (synthesizeCouncilVerdicts).
|
|
7
|
+
*
|
|
8
|
+
* Quadratic Voting (NSED arXiv:2601.16863): consensus claims are weighted by
|
|
9
|
+
* member confidence rather than counted by headcount. A claim is a consensus
|
|
10
|
+
* point only when its weighted agreement exceeds 0.6 across members.
|
|
11
|
+
*
|
|
12
|
+
* MAINTAIN/CONCEDE/NUANCE protocol (ConfMAD): a Round 2 response with the
|
|
13
|
+
* CONCEDE keyword on a topic resolves the corresponding Round 1 disagreement;
|
|
14
|
+
* MAINTAIN leaves it persisting; NUANCE marks it persisting-with-boundary.
|
|
15
|
+
*/
|
|
16
|
+
import type { GeneralCouncilDeliberationResponse, GeneralCouncilMemberResponse, GeneralCouncilResult } from './general-council-types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Pure synthesis. Given completed member responses, produces the final
|
|
19
|
+
* `GeneralCouncilResult` (without `moderatorOutput` — moderator is invoked
|
|
20
|
+
* by the architect after this returns and populated separately).
|
|
21
|
+
*/
|
|
22
|
+
export declare function synthesizeGeneralCouncil(question: string, mode: 'general' | 'spec_review', round1Responses: GeneralCouncilMemberResponse[], round2Responses: GeneralCouncilDeliberationResponse[]): GeneralCouncilResult;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General Council Mode — data contracts.
|
|
3
|
+
*
|
|
4
|
+
* Distinct from the Work Complete Council (`./types.ts`). The general council
|
|
5
|
+
* is an advisory deliberation system: user-selected models each independently
|
|
6
|
+
* web-search and answer a question, then optionally engage in a single
|
|
7
|
+
* disagreement-targeted reconciliation round. A moderator agent synthesizes
|
|
8
|
+
* the final user-facing answer.
|
|
9
|
+
*
|
|
10
|
+
* No business logic, no I/O. Only types, interfaces, and defaults.
|
|
11
|
+
*/
|
|
12
|
+
export type GeneralCouncilMemberRole = 'generalist' | 'skeptic' | 'domain_expert' | 'devil_advocate' | 'synthesizer';
|
|
13
|
+
export interface WebSearchResult {
|
|
14
|
+
title: string;
|
|
15
|
+
url: string;
|
|
16
|
+
snippet: string;
|
|
17
|
+
query: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GeneralCouncilMemberConfig {
|
|
20
|
+
memberId: string;
|
|
21
|
+
model: string;
|
|
22
|
+
role: GeneralCouncilMemberRole;
|
|
23
|
+
persona?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface GeneralCouncilMemberResponse {
|
|
26
|
+
memberId: string;
|
|
27
|
+
model: string;
|
|
28
|
+
role: GeneralCouncilMemberRole;
|
|
29
|
+
response: string;
|
|
30
|
+
sources: WebSearchResult[];
|
|
31
|
+
searchQueries: string[];
|
|
32
|
+
/** Self-reported confidence (0.0–1.0) — feeds Quadratic Voting weighted consensus */
|
|
33
|
+
confidence: number;
|
|
34
|
+
areasOfUncertainty: string[];
|
|
35
|
+
durationMs: number;
|
|
36
|
+
}
|
|
37
|
+
export interface GeneralCouncilDisagreementPosition {
|
|
38
|
+
memberId: string;
|
|
39
|
+
claim: string;
|
|
40
|
+
evidence: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GeneralCouncilDisagreement {
|
|
43
|
+
topic: string;
|
|
44
|
+
positions: GeneralCouncilDisagreementPosition[];
|
|
45
|
+
}
|
|
46
|
+
export interface GeneralCouncilDeliberationResponse extends GeneralCouncilMemberResponse {
|
|
47
|
+
/** Topics the member addressed in Round 2 (subset of Round 1 disagreements). */
|
|
48
|
+
disagreementTopics: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface GeneralCouncilResult {
|
|
51
|
+
question: string;
|
|
52
|
+
mode: 'general' | 'spec_review';
|
|
53
|
+
round1Responses: GeneralCouncilMemberResponse[];
|
|
54
|
+
disagreements: GeneralCouncilDisagreement[];
|
|
55
|
+
round2Responses: GeneralCouncilDeliberationResponse[];
|
|
56
|
+
/** Structural synthesis markdown (sections: consensus / disagreements / sources). */
|
|
57
|
+
synthesis: string;
|
|
58
|
+
consensusPoints: string[];
|
|
59
|
+
persistingDisagreements: string[];
|
|
60
|
+
allSources: WebSearchResult[];
|
|
61
|
+
/**
|
|
62
|
+
* Final moderator output (when council.general.moderator: true and a moderator
|
|
63
|
+
* model is configured). Populated by `convene-general-council.ts` after the
|
|
64
|
+
* architect delegates the moderator prompt to `council_moderator`. Undefined
|
|
65
|
+
* when no moderator pass is configured.
|
|
66
|
+
*/
|
|
67
|
+
moderatorOutput?: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Config shape — matched in schema.ts via GeneralCouncilConfigSchema.
|
|
72
|
+
*
|
|
73
|
+
* `enabled` defaults to false (feature gate). The moderator pass requires
|
|
74
|
+
* a configured `moderatorModel`; when set, the architect delegates the
|
|
75
|
+
* moderator prompt produced by `convene_general_council` to the dedicated
|
|
76
|
+
* `council_moderator` agent (no `web_search` access — synthesis only).
|
|
77
|
+
*/
|
|
78
|
+
export interface GeneralCouncilConfig {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
searchProvider: 'tavily' | 'brave';
|
|
81
|
+
/**
|
|
82
|
+
* Optional API key. When omitted, falls back to `TAVILY_API_KEY` or
|
|
83
|
+
* `BRAVE_SEARCH_API_KEY` env vars depending on `searchProvider`.
|
|
84
|
+
*/
|
|
85
|
+
searchApiKey?: string;
|
|
86
|
+
members: GeneralCouncilMemberConfig[];
|
|
87
|
+
/** Named groups of members for `/swarm council --preset <name>`. */
|
|
88
|
+
presets: Record<string, GeneralCouncilMemberConfig[]>;
|
|
89
|
+
/** When true, after Round 1 the architect routes disagreements back to disputing members. */
|
|
90
|
+
deliberate: boolean;
|
|
91
|
+
/** When true, the architect delegates a moderator pass to `council_moderator` after synthesis. */
|
|
92
|
+
moderator: boolean;
|
|
93
|
+
/** Required when `moderator: true` — model identifier for the council_moderator delegation. */
|
|
94
|
+
moderatorModel?: string;
|
|
95
|
+
/** Hard cap on results returned per member per search call (1–20). Defaults to 5. */
|
|
96
|
+
maxSourcesPerMember: number;
|
|
97
|
+
}
|
|
98
|
+
export declare const GENERAL_COUNCIL_DEFAULTS: GeneralCouncilConfig;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web search provider abstraction for the General Council Mode.
|
|
3
|
+
*
|
|
4
|
+
* Two concrete providers (Tavily, Brave) plus a factory that selects one
|
|
5
|
+
* based on `GeneralCouncilConfig.searchProvider`. Pure HTTP layer — no tool
|
|
6
|
+
* wiring or prompt rendering. Uses the native `fetch` API (Bun-compatible);
|
|
7
|
+
* no external HTTP libraries.
|
|
8
|
+
*
|
|
9
|
+
* Errors are surfaced as typed exceptions:
|
|
10
|
+
* - WebSearchConfigError — missing API key (factory)
|
|
11
|
+
* - WebSearchError — HTTP failure (4xx/5xx, network, timeout)
|
|
12
|
+
* Malformed but successful responses produce an empty result array, never throw.
|
|
13
|
+
*/
|
|
14
|
+
import type { GeneralCouncilConfig, WebSearchResult } from './general-council-types.js';
|
|
15
|
+
export declare class WebSearchError extends Error {
|
|
16
|
+
readonly cause?: unknown | undefined;
|
|
17
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
18
|
+
}
|
|
19
|
+
export declare class WebSearchConfigError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
export interface WebSearchProvider {
|
|
23
|
+
search(query: string, maxResults: number): Promise<WebSearchResult[]>;
|
|
24
|
+
}
|
|
25
|
+
export declare class TavilyProvider implements WebSearchProvider {
|
|
26
|
+
private readonly apiKey;
|
|
27
|
+
constructor(apiKey: string);
|
|
28
|
+
search(query: string, maxResults: number): Promise<WebSearchResult[]>;
|
|
29
|
+
}
|
|
30
|
+
export declare class BraveProvider implements WebSearchProvider {
|
|
31
|
+
private readonly apiKey;
|
|
32
|
+
constructor(apiKey: string);
|
|
33
|
+
search(query: string, maxResults: number): Promise<WebSearchResult[]>;
|
|
34
|
+
}
|
|
35
|
+
export declare function createWebSearchProvider(config: GeneralCouncilConfig): WebSearchProvider;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Sessions can only ratchet gates tighter (enable more), never disable them.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* QA gate flags. All
|
|
10
|
+
* QA gate flags. All nine gates are tracked explicitly.
|
|
11
11
|
*/
|
|
12
12
|
export interface QaGates {
|
|
13
13
|
reviewer: boolean;
|
|
@@ -18,6 +18,7 @@ export interface QaGates {
|
|
|
18
18
|
hallucination_guard: boolean;
|
|
19
19
|
sast_enabled: boolean;
|
|
20
20
|
mutation_test: boolean;
|
|
21
|
+
council_general_review: boolean;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Default QA gate configuration for newly-created profiles.
|
|
@@ -92,6 +93,9 @@ export declare function computeProfileHash(profile: QaGateProfile): string;
|
|
|
92
93
|
* until .swarm/evidence/{phase}/hallucination-guard.json has APPROVED verdict).
|
|
93
94
|
* - mutation_test — src/tools/phase-complete.ts Gate 4 (blocks phase_complete
|
|
94
95
|
* until .swarm/evidence/{phase}/mutation-gate.json has pass verdict; warn does not block)
|
|
96
|
+
* - council_general_review — src/agents/architect.ts SPECIFY-COUNCIL-REVIEW
|
|
97
|
+
* (fires when gate is true; runs convene_general_council on draft spec before
|
|
98
|
+
* critic-gate to fold multi-model deliberation into the spec).
|
|
95
99
|
*
|
|
96
100
|
* Session overrides are intentionally ephemeral — they live only in
|
|
97
101
|
* in-memory `AgentSessionState.qaGateSessionOverrides` and are NOT
|