@wrongstack/core 0.298.3 → 0.300.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/chronicle/index.js +4 -1
- package/dist/coordination/agents/index.js +4 -1
- package/dist/coordination/director.d.ts +8 -0
- package/dist/coordination/fleet-manager.d.ts +48 -3
- package/dist/coordination/ifleet-manager.d.ts +2 -0
- package/dist/coordination/index.js +127 -24
- package/dist/coordination/multi-agent-coordinator.d.ts +1 -0
- package/dist/core/fallback-model.d.ts +48 -0
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +288 -34
- package/dist/core/instruction-template.d.ts +80 -0
- package/dist/core/system-prompt-blocks.d.ts +10 -1
- package/dist/core/system-prompt-builder.d.ts +35 -1
- package/dist/defaults/index.js +358 -117
- package/dist/design/index.js +4 -1
- package/dist/execution/autonomy-brain.d.ts +7 -0
- package/dist/execution/council-brain.d.ts +17 -2
- package/dist/execution/council-orchestrator.d.ts +23 -4
- package/dist/execution/council-personas.d.ts +10 -0
- package/dist/execution/council-prompts.d.ts +12 -1
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.js +412 -145
- package/dist/fleet-notifier.d.ts +9 -2
- package/dist/goal/index.js +4 -1
- package/dist/hooks/index.js +140 -10
- package/dist/hq/exposure.d.ts +0 -11
- package/dist/hq/index.js +34 -8
- package/dist/hq/protocol/client.d.ts +14 -1
- package/dist/hq/protocol/fleet.d.ts +22 -0
- package/dist/hq/protocol.js +12 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1718 -753
- package/dist/infrastructure/index.js +50 -2
- package/dist/infrastructure/mcp-servers.d.ts +35 -0
- package/dist/kernel/events/brain-events.d.ts +9 -0
- package/dist/kernel/events/provider-events.d.ts +49 -2
- package/dist/kernel/events/sdd-events.d.ts +2 -0
- package/dist/models/index.js +1 -1
- package/dist/plugin/api.d.ts +6 -0
- package/dist/plugin/config.d.ts +55 -0
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js +138 -22
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +157 -42
- package/dist/security/permission-helpers.d.ts +23 -6
- package/dist/security/permission-policy.d.ts +16 -0
- package/dist/security/totp.d.ts +14 -0
- package/dist/storage/director-state.d.ts +7 -0
- package/dist/storage/index.js +46 -9
- package/dist/tools/council-tool.d.ts +1 -1
- package/dist/tools/fallback-system-config-view-tool.d.ts +1 -1
- package/dist/tools/index.js +449 -112
- package/dist/types/config/skills-fleet-brain.d.ts +4 -2
- package/dist/types/config/tools.d.ts +99 -0
- package/dist/types/council.d.ts +11 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.js +3 -3
- package/dist/types/multi-agent.d.ts +10 -0
- package/dist/types/one-shot-llm.d.ts +31 -3
- package/dist/types/plugin.d.ts +28 -0
- package/dist/types/session.d.ts +5 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/wstack-paths.d.ts +2 -0
- package/dist/worktree/index.js +47 -25
- package/dist/worktree/worktree-manager.d.ts +16 -10
- package/instructions/coordination/subagent-baseline.md +8 -0
- package/instructions/system-lite.md +83 -3
- package/instructions/system-pro.md +286 -97
- package/instructions/system.md +236 -85
- package/package.json +3 -3
package/dist/design/index.js
CHANGED
|
@@ -91,7 +91,9 @@ function safeProfileName(name) {
|
|
|
91
91
|
function activeProfileName(globalRoot) {
|
|
92
92
|
try {
|
|
93
93
|
const parsed = JSON.parse(fs.readFileSync(path.join(globalRoot, "config.json"), "utf8"));
|
|
94
|
-
return safeProfileName(
|
|
94
|
+
return safeProfileName(
|
|
95
|
+
typeof parsed.activeProfile === "string" ? parsed.activeProfile : void 0
|
|
96
|
+
);
|
|
95
97
|
} catch {
|
|
96
98
|
return "default";
|
|
97
99
|
}
|
|
@@ -171,6 +173,7 @@ function resolveWstackPaths(opts) {
|
|
|
171
173
|
projectPlan: path.join(projectDir, "plan.json"),
|
|
172
174
|
projectAutophase: path.join(projectDir, "autophase"),
|
|
173
175
|
projectSddBoards: path.join(projectDir, "sdd-boards"),
|
|
176
|
+
projectRequirementIntakes: path.join(projectDir, "requirement-intakes"),
|
|
174
177
|
syncConfig: path.join(profileDir, "sync.json"),
|
|
175
178
|
configHistoryDir: path.join(globalRoot, "config-history"),
|
|
176
179
|
projectStatus: (projectHash2) => path.join(globalRoot, "projects", projectHash2, "status.json")
|
|
@@ -218,6 +218,8 @@ export declare function completeBrainLlm(target: BrainLlmTarget, input: {
|
|
|
218
218
|
user: string;
|
|
219
219
|
timeoutMs: number;
|
|
220
220
|
maxTokens?: number | undefined;
|
|
221
|
+
/** External cancellation (e.g. a council's overall budget or user abort). */
|
|
222
|
+
signal?: AbortSignal | undefined;
|
|
221
223
|
}): Promise<string>;
|
|
222
224
|
/** Text plus the observable call metadata a trace/quality gate needs. */
|
|
223
225
|
interface BrainLlmCallResult {
|
|
@@ -237,12 +239,17 @@ interface BrainLlmCallResult {
|
|
|
237
239
|
* Usage was previously thrown away at this boundary, which is why the council
|
|
238
240
|
* adapter reported hardcoded zero tokens for every seat and why "what do
|
|
239
241
|
* Brain decisions cost" had no answer.
|
|
242
|
+
*
|
|
243
|
+
* The per-call timeout is composed with any caller-supplied `signal` so an
|
|
244
|
+
* external abort (the council's overall budget, a user cancel) interrupts an
|
|
245
|
+
* in-flight provider call instead of waiting out the per-call timeout.
|
|
240
246
|
*/
|
|
241
247
|
export declare function completeBrainLlmDetailed(target: BrainLlmTarget, input: {
|
|
242
248
|
system: string;
|
|
243
249
|
user: string;
|
|
244
250
|
timeoutMs: number;
|
|
245
251
|
maxTokens?: number | undefined;
|
|
252
|
+
signal?: AbortSignal | undefined;
|
|
246
253
|
}): Promise<BrainLlmCallResult>;
|
|
247
254
|
/**
|
|
248
255
|
* Output budget for a Brain decision call.
|
|
@@ -13,10 +13,15 @@
|
|
|
13
13
|
* - maintainer — evaluates complexity, compatibility, long-term ownership.
|
|
14
14
|
* - user-advocate — evaluates from the affected user's perspective.
|
|
15
15
|
*
|
|
16
|
+
* Any other persona string is registered as an ad-hoc lens instead of being
|
|
17
|
+
* rejected — see `resolvePersonaRegistry`.
|
|
18
|
+
*
|
|
16
19
|
* @module council-brain
|
|
17
20
|
*/
|
|
18
21
|
import type { BrainArbiter, BrainDecisionRequest } from '../coordination/brain.js';
|
|
22
|
+
import { type BrainLlmTarget } from './autonomy-brain.js';
|
|
19
23
|
import type { EventBus } from '../kernel/events.js';
|
|
24
|
+
import type { CouncilLLMCaller } from '../types/council.js';
|
|
20
25
|
import type { Provider } from '../types/provider.js';
|
|
21
26
|
/**
|
|
22
27
|
* Refusal option id used by the Brain adapter. Re-exported from the
|
|
@@ -30,8 +35,9 @@ export interface CouncilVoter {
|
|
|
30
35
|
/** Model id this voter uses. */
|
|
31
36
|
model: string;
|
|
32
37
|
/**
|
|
33
|
-
* Decision lens. Built-ins: 'executor', 'skeptic', 'auditor'
|
|
34
|
-
* string is
|
|
38
|
+
* Decision lens. Built-ins: 'executor', 'skeptic', 'auditor', 'security',
|
|
39
|
+
* 'maintainer', 'user-advocate'. Any other string is registered as an ad-hoc
|
|
40
|
+
* lens whose instruction is the string itself (see `resolvePersonaRegistry`).
|
|
35
41
|
*/
|
|
36
42
|
persona?: string | undefined;
|
|
37
43
|
/** Vote weight. Default 1. */
|
|
@@ -71,6 +77,15 @@ export interface CouncilBrainOptions {
|
|
|
71
77
|
*/
|
|
72
78
|
traceContent?: boolean | undefined;
|
|
73
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Build the per-seat LLM caller that wraps `completeBrainLlmDetailed` for
|
|
82
|
+
* one BrainLlmTarget. Exported so tests can drive the exact production
|
|
83
|
+
* wiring: it forwards the orchestrator's `input.signal` (overall budget +
|
|
84
|
+
* caller cancellation) into the provider call so an in-flight seat is
|
|
85
|
+
* interrupted on timeout/cancel instead of running out its per-call
|
|
86
|
+
* timeout.
|
|
87
|
+
*/
|
|
88
|
+
export declare function makeSeatCallerForVoter(target: BrainLlmTarget): CouncilLLMCaller;
|
|
74
89
|
/**
|
|
75
90
|
* Create a council-of-LLMs Brain arbiter backed by CouncilOrchestrator
|
|
76
91
|
* with per-seat LLM callers — each voter's own Provider is used for its
|
|
@@ -53,17 +53,36 @@ export declare class CouncilOrchestrator {
|
|
|
53
53
|
private readonly fallbackProfileManager;
|
|
54
54
|
private readonly seatCaller;
|
|
55
55
|
private readonly judgeCaller;
|
|
56
|
+
/**
|
|
57
|
+
* Normalized ad-hoc profiles keyed by the caller's config object identity.
|
|
58
|
+
* The Brain adapter reuses ONE profile object for every decision, so this
|
|
59
|
+
* avoids re-validating + re-freezing it on every ask() without caching
|
|
60
|
+
* string-keyed registry lookups (those are already O(1)).
|
|
61
|
+
*
|
|
62
|
+
* Hosts must treat ad-hoc profile configs as IMMUTABLE once passed to
|
|
63
|
+
* ask(): the cache is keyed by object identity and never invalidated, so
|
|
64
|
+
* mutating a cached profile would silently serve the first snapshot.
|
|
65
|
+
*/
|
|
66
|
+
private readonly profileCache;
|
|
56
67
|
constructor(opts: CouncilOrchestratorOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the effective profile for a question. String ids and the default
|
|
70
|
+
* go through the registry (already O(1)); ad-hoc config objects are
|
|
71
|
+
* normalized once per stable object identity and cached, because hosts such
|
|
72
|
+
* as the Brain adapter pass the same profile object on every ask().
|
|
73
|
+
*/
|
|
74
|
+
private resolveProfile;
|
|
57
75
|
ask(question: CouncilQuestion): Promise<CouncilResult>;
|
|
58
76
|
private callSeat;
|
|
59
77
|
private resolveOptionQuestion;
|
|
60
78
|
private resolveOpenQuestion;
|
|
61
79
|
private callJudge;
|
|
62
80
|
/**
|
|
63
|
-
* Resolve the effective LLM caller for a call. Voter seats
|
|
64
|
-
* `seatCaller(seatIndex)` when wired
|
|
65
|
-
*
|
|
66
|
-
*
|
|
81
|
+
* Resolve the effective LLM caller for a call. Voter seats (defined
|
|
82
|
+
* seatIndex) use `seatCaller(seatIndex)` when wired, otherwise the shared
|
|
83
|
+
* `caller` — a seat never falls through to the judge caller. Judge seats
|
|
84
|
+
* (seatIndex undefined) use `judgeCaller` if set, otherwise `seatCaller(0)`
|
|
85
|
+
* if set, otherwise the shared `caller`.
|
|
67
86
|
*/
|
|
68
87
|
private resolveCaller;
|
|
69
88
|
private safeCall;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { CouncilPersona } from '../types/council.js';
|
|
2
2
|
/** Provider-neutral personas shipped with every Council installation. */
|
|
3
3
|
export declare const BUILTIN_COUNCIL_PERSONAS: readonly CouncilPersona[];
|
|
4
|
+
/**
|
|
5
|
+
* Built-in persona ids in display order.
|
|
6
|
+
*
|
|
7
|
+
* The single source every surface cycles through. The TUI panel, the WebUI
|
|
8
|
+
* settings section and `/brain council` each used to hard-code
|
|
9
|
+
* `['executor','skeptic','auditor']`, which is why `security`, `maintainer`
|
|
10
|
+
* and `user-advocate` shipped in the registry but were unreachable from any
|
|
11
|
+
* UI — exactly the lenses `risk-review` is built around.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BUILTIN_COUNCIL_PERSONA_IDS: readonly string[];
|
|
4
14
|
/** Immutable registry of trusted Council persona definitions. */
|
|
5
15
|
export declare class CouncilPersonaRegistry {
|
|
6
16
|
private readonly byId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CouncilPersona, CouncilQuestion, CouncilVoteResult, ResolvedCouncilSeat } from '../types/council.js';
|
|
1
|
+
import type { CouncilOption, CouncilPersona, CouncilQuestion, CouncilVoteResult, ResolvedCouncilSeat } from '../types/council.js';
|
|
2
2
|
export declare const COUNCIL_VOTER_PROMPT_PATH = "llm/council-voter.md";
|
|
3
3
|
export declare const COUNCIL_JUDGE_PROMPT_PATH = "llm/council-judge.md";
|
|
4
4
|
/** Build the trusted system instruction for one independent seat. */
|
|
@@ -18,4 +18,15 @@ export declare function buildCouncilJudgeUserPrompt(question: CouncilQuestion, v
|
|
|
18
18
|
reason?: string | undefined;
|
|
19
19
|
refusalOptionId?: string | undefined;
|
|
20
20
|
}): string;
|
|
21
|
+
/**
|
|
22
|
+
* Validate a Council option list; returns human-readable problems (empty
|
|
23
|
+
* array = valid). Single source of the id/label/duplicate rules shared by the
|
|
24
|
+
* `council` tool validator (fixable errors returned to the caller) and the
|
|
25
|
+
* prompt builder (which throws with every problem joined).
|
|
26
|
+
*
|
|
27
|
+
* Note: empty ids are added to the `seen` set, so two empty-id options also
|
|
28
|
+
* report `Duplicate option id ""` next to the empty-id error — harmless noise
|
|
29
|
+
* that preserves the historical tool-validator behavior exactly.
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateCouncilOptions(options: readonly CouncilOption[] | undefined): string[];
|
|
21
32
|
//# sourceMappingURL=council-prompts.d.ts.map
|
|
@@ -7,7 +7,7 @@ export { BRAIN_EVALUATION_CASE_VERSION, type BrainEvaluationCaseResult, type Bra
|
|
|
7
7
|
export { type BrainApplyResult, type BrainConfigPatch, type BrainConfigSnapshot, type BrainCouncilMinRisk, type BrainCouncilPatch, type BrainDefaultsContext, type BrainPoolStrategy, type BrainRuntime, type BrainRuntimeLedgerHost, type BrainRuntimeOptions, createBrainRuntime, resolveBrainConfigDefaults, } from './brain-runtime.js';
|
|
8
8
|
export { COUNCIL_REFUSE_OPTION_ID, type CouncilBrainOptions, type CouncilVoter, createCouncilBrainArbiter, } from './council-brain.js';
|
|
9
9
|
export { type CouncilResolution, type CouncilResolutionInput, type CouncilResolutionSeat, type CouncilResolutionVote, resolveCouncilVotes, } from './council-resolution.js';
|
|
10
|
-
export { BUILTIN_COUNCIL_PERSONAS, CouncilPersonaRegistry, createCouncilPersonaRegistry, DEFAULT_COUNCIL_PERSONA_REGISTRY, } from './council-personas.js';
|
|
10
|
+
export { BUILTIN_COUNCIL_PERSONA_IDS, BUILTIN_COUNCIL_PERSONAS, CouncilPersonaRegistry, createCouncilPersonaRegistry, DEFAULT_COUNCIL_PERSONA_REGISTRY, } from './council-personas.js';
|
|
11
11
|
export { BUILTIN_COUNCIL_PROFILES, CouncilProfileRegistry, createCouncilProfileRegistry, DEFAULT_COUNCIL_APPROVAL_FRACTION, DEFAULT_COUNCIL_JUDGE_MAX_TOKENS, DEFAULT_COUNCIL_OVERALL_TIMEOUT_MS, DEFAULT_COUNCIL_PER_CALL_TIMEOUT_MS, DEFAULT_COUNCIL_PROFILE_REGISTRY, DEFAULT_COUNCIL_QUORUM_FRACTION, DEFAULT_COUNCIL_VOTER_MAX_TOKENS, normalizeCouncilProfile, resolveCouncilProfile, } from './council-profiles.js';
|
|
12
12
|
export { buildCouncilJudgeSystemPrompt, buildCouncilJudgeUserPrompt, buildCouncilQuestionPrompt, buildCouncilVoterSystemPrompt, buildCouncilVoterUserPrompt, COUNCIL_JUDGE_PROMPT_PATH, COUNCIL_VOTER_PROMPT_PATH, } from './council-prompts.js';
|
|
13
13
|
export { COUNCIL_REFUSAL_OPTION_ID, CouncilOrchestrator, type CouncilOrchestratorOptions, DEFAULT_COUNCIL_MAX_CONCURRENCY, MAX_COUNCIL_CONCURRENCY, } from './council-orchestrator.js';
|