@wrongstack/core 0.7.4 → 0.7.6
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/agent-subagent-runner-BOBYkW_r.d.ts +174 -0
- package/dist/coordination/index.d.ts +5 -4
- package/dist/defaults/index.d.ts +8 -7
- package/dist/defaults/index.js +324 -38
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +4 -3
- package/dist/execution/index.js +11 -9
- package/dist/execution/index.js.map +1 -1
- package/dist/{goal-store-HHgaq5ue.d.ts → goal-store-C7jcumEh.d.ts} +2 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.js +344 -53
- package/dist/index.js.map +1 -1
- package/dist/{multi-agent-coordinator-D8PLzfz6.d.ts → multi-agent-coordinator-3Ypfg-hr.d.ts} +2 -173
- package/dist/{null-fleet-bus-Bkk3gafb.d.ts → null-fleet-bus-JdTSYJv9.d.ts} +2 -1
- package/dist/permission-policy-D5Gj1o2K.d.ts +111 -0
- package/dist/{plan-templates-DWbEIJvV.d.ts → plan-templates-C-IOLJ8Q.d.ts} +1 -1
- package/dist/sdd/index.d.ts +173 -2
- package/dist/sdd/index.js +3619 -1
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +6 -109
- package/dist/security/index.js +35 -11
- package/dist/security/index.js.map +1 -1
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +5 -4
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.js +25 -10
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +6 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BGu2INTm.d.ts → wstack-paths-gCrJ631C.d.ts} +10 -0
- package/package.json +1 -1
package/dist/{multi-agent-coordinator-D8PLzfz6.d.ts → multi-agent-coordinator-3Ypfg-hr.d.ts}
RENAMED
|
@@ -1,177 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as EventBus } from './events-D4pGukpI.js';
|
|
3
|
-
import { m as SubagentConfig, u as TaskSpec, s as SubagentRunner, k as MultiAgentCoordinator, M as MultiAgentConfig, S as SpawnResult, B as BridgeMessage, A as AgentBridge, j as CoordinatorStatus, t as TaskResult } from './multi-agent-7OK4pEKW.js';
|
|
1
|
+
import { m as SubagentConfig, k as MultiAgentCoordinator, M as MultiAgentConfig, s as SubagentRunner, S as SpawnResult, u as TaskSpec, B as BridgeMessage, A as AgentBridge, j as CoordinatorStatus, t as TaskResult } from './multi-agent-7OK4pEKW.js';
|
|
4
2
|
import { EventEmitter } from 'node:events';
|
|
5
3
|
|
|
6
|
-
/**
|
|
7
|
-
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
8
|
-
* agent emits on its own EventBus gets re-published here, prefixed with
|
|
9
|
-
* `subagentId` so a single subscriber can multiplex across the fleet.
|
|
10
|
-
*
|
|
11
|
-
* The director uses `FleetBus.filter('tool.executed', …)` to see every
|
|
12
|
-
* tool call across the fleet; the TUI uses
|
|
13
|
-
* `FleetBus.subscribe(id, handler)` to render a per-subagent panel.
|
|
14
|
-
*/
|
|
15
|
-
interface FleetEvent {
|
|
16
|
-
subagentId: string;
|
|
17
|
-
taskId?: string;
|
|
18
|
-
ts: number;
|
|
19
|
-
type: string;
|
|
20
|
-
payload: unknown;
|
|
21
|
-
}
|
|
22
|
-
type FleetHandler = (event: FleetEvent) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Fan-in for per-subagent EventBuses. Each subagent's bus is plugged in
|
|
25
|
-
* via `attach()`; the FleetBus re-emits every event with subagent
|
|
26
|
-
* attribution. Detachment is automatic via the returned disposer — call
|
|
27
|
-
* it when a subagent terminates so we don't leak listeners.
|
|
28
|
-
*
|
|
29
|
-
* The bus exposes two subscription modes: by `subagentId` (everything
|
|
30
|
-
* from one child) and by `type` (one event-type across the fleet). They
|
|
31
|
-
* compose — if you need a per-subagent + per-type slice, subscribe by
|
|
32
|
-
* type and filter on `event.subagentId` in your handler.
|
|
33
|
-
*/
|
|
34
|
-
declare class FleetBus {
|
|
35
|
-
private readonly byId;
|
|
36
|
-
private readonly byType;
|
|
37
|
-
private readonly any;
|
|
38
|
-
/**
|
|
39
|
-
* Hook a subagent's EventBus into the fleet. EventBus is strongly
|
|
40
|
-
* typed and doesn't expose an `onAny` hook, so we subscribe to the
|
|
41
|
-
* canonical set of event types a subagent emits during a run. New
|
|
42
|
-
* event types added to the kernel must be added here too — but the
|
|
43
|
-
* cost is a tiny single line per type, and the explicit list keeps
|
|
44
|
-
* the wire format clear.
|
|
45
|
-
*
|
|
46
|
-
* Returns a disposer that detaches every subscription; call on
|
|
47
|
-
* subagent teardown so the listeners don't outlive the run.
|
|
48
|
-
*/
|
|
49
|
-
attach(subagentId: string, bus: EventBus, taskId?: string): () => void;
|
|
50
|
-
/** Subscribe to every event from one subagent. */
|
|
51
|
-
subscribe(subagentId: string, handler: FleetHandler): () => void;
|
|
52
|
-
/** Subscribe to one event type across all subagents. */
|
|
53
|
-
filter(type: string, handler: FleetHandler): () => void;
|
|
54
|
-
/** Subscribe to literally everything. The fleet roll-up uses this. */
|
|
55
|
-
onAny(handler: FleetHandler): () => void;
|
|
56
|
-
emit(event: FleetEvent): void;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Roll-up of token usage + cost across an entire director run. The
|
|
60
|
-
* director's `fleet_status` tool returns this so the model can reason
|
|
61
|
-
* about budget in its next turn ("the researcher already burned $0.40,
|
|
62
|
-
* lean on summaries for the next task").
|
|
63
|
-
*/
|
|
64
|
-
interface FleetUsage {
|
|
65
|
-
total: {
|
|
66
|
-
input: number;
|
|
67
|
-
output: number;
|
|
68
|
-
cacheRead: number;
|
|
69
|
-
cacheWrite: number;
|
|
70
|
-
cost: number;
|
|
71
|
-
};
|
|
72
|
-
perSubagent: Record<string, SubagentUsageSnapshot>;
|
|
73
|
-
}
|
|
74
|
-
interface SubagentUsageSnapshot {
|
|
75
|
-
subagentId: string;
|
|
76
|
-
provider?: string;
|
|
77
|
-
model?: string;
|
|
78
|
-
input: number;
|
|
79
|
-
output: number;
|
|
80
|
-
cacheRead: number;
|
|
81
|
-
cacheWrite: number;
|
|
82
|
-
cost: number;
|
|
83
|
-
toolCalls: number;
|
|
84
|
-
iterations: number;
|
|
85
|
-
startedAt: number;
|
|
86
|
-
lastEventAt: number;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Aggregates provider.response + tool.executed events from the FleetBus
|
|
90
|
-
* into a live `FleetUsage` snapshot. Costs are computed by the caller
|
|
91
|
-
* via a `priceLookup(subagentId)` so we don't bake provider-pricing
|
|
92
|
-
* coupling into core; the CLI/tests supply a function that resolves
|
|
93
|
-
* each subagent's per-token rates from the models registry.
|
|
94
|
-
*/
|
|
95
|
-
declare class FleetUsageAggregator {
|
|
96
|
-
private readonly bus;
|
|
97
|
-
private readonly priceLookup?;
|
|
98
|
-
private readonly metaLookup?;
|
|
99
|
-
private readonly perSubagent;
|
|
100
|
-
private readonly total;
|
|
101
|
-
constructor(bus: FleetBus, priceLookup?: ((subagentId: string) => {
|
|
102
|
-
input?: number;
|
|
103
|
-
output?: number;
|
|
104
|
-
cacheRead?: number;
|
|
105
|
-
cacheWrite?: number;
|
|
106
|
-
} | undefined) | undefined, metaLookup?: ((subagentId: string) => {
|
|
107
|
-
provider?: string;
|
|
108
|
-
model?: string;
|
|
109
|
-
} | undefined) | undefined);
|
|
110
|
-
/** Live snapshot — safe to call from a tool's execute() body. */
|
|
111
|
-
snapshot(): FleetUsage;
|
|
112
|
-
private ensure;
|
|
113
|
-
private onProviderResponse;
|
|
114
|
-
private onToolExecuted;
|
|
115
|
-
private onIterationStarted;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Caller-supplied factory that builds an isolated `Agent` for a subagent.
|
|
120
|
-
* The factory MUST construct a fresh `Context` per call — sharing context
|
|
121
|
-
* between subagents defeats isolation. Each Agent should also use either
|
|
122
|
-
* its own `EventBus` or a forwarded view, so per-subagent metrics can be
|
|
123
|
-
* attributed correctly.
|
|
124
|
-
*/
|
|
125
|
-
type AgentFactory = (config: SubagentConfig) => Promise<AgentFactoryResult>;
|
|
126
|
-
interface AgentFactoryResult {
|
|
127
|
-
agent: Agent;
|
|
128
|
-
/** Event bus the factory wired to this agent — required for budget hookup. */
|
|
129
|
-
events: EventBus;
|
|
130
|
-
/**
|
|
131
|
-
* Optional cleanup hook invoked in the runner's `finally` block once
|
|
132
|
-
* the task ends (success, failure, abort — same exit path). Factories
|
|
133
|
-
* that own resources scoped to a single task (per-subagent JSONL
|
|
134
|
-
* writers, transient providers, throwaway containers) implement this
|
|
135
|
-
* to close them deterministically instead of relying on GC. Errors
|
|
136
|
-
* thrown here are swallowed so a flaky cleanup can't mask the task's
|
|
137
|
-
* real result.
|
|
138
|
-
*/
|
|
139
|
-
dispose?: () => Promise<void> | void;
|
|
140
|
-
}
|
|
141
|
-
interface AgentRunnerOptions {
|
|
142
|
-
factory: AgentFactory;
|
|
143
|
-
/**
|
|
144
|
-
* Format a TaskSpec into the user input the agent will receive. Defaults
|
|
145
|
-
* to `task.description ?? ''`. Override when subagents expect structured
|
|
146
|
-
* input (e.g. JSON contracts, role-prefixed prompts).
|
|
147
|
-
*/
|
|
148
|
-
formatTaskInput?: (task: TaskSpec, config: SubagentConfig) => AgentInput;
|
|
149
|
-
/**
|
|
150
|
-
* When set, the runner attaches the subagent's EventBus to this FleetBus
|
|
151
|
-
* on task start and detaches it when the task finishes. This is the
|
|
152
|
-
* injection seam that lets the TUI fleet panel observe subagent activity
|
|
153
|
-
* live — without it, FleetBus stays empty.
|
|
154
|
-
*/
|
|
155
|
-
fleetBus?: FleetBus;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Builds a `SubagentRunner` that drives a real `Agent` per task while honoring
|
|
159
|
-
* the coordinator's budget and abort signal. This is the production adapter —
|
|
160
|
-
* the coordinator's `runner` option in CLI/TUI assemblies points here.
|
|
161
|
-
*
|
|
162
|
-
* Lifecycle per task:
|
|
163
|
-
* 1. factory(config) → fresh Agent + EventBus.
|
|
164
|
-
* 2. Subscribe to events to feed the budget (tool calls, token usage).
|
|
165
|
-
* 3. Call agent.run(input, { signal }) — the coordinator's signal cancels.
|
|
166
|
-
* 4. Map RunResult.status onto a `SubagentRunOutcome` or throw on failure.
|
|
167
|
-
* 5. Unsubscribe and let the factory's resources be GC'd.
|
|
168
|
-
*
|
|
169
|
-
* The budget is checked synchronously from event handlers — a runaway agent
|
|
170
|
-
* that crosses its tool-call limit triggers `BudgetExceededError`, which the
|
|
171
|
-
* coordinator surfaces as `status: 'failed'` on the task result.
|
|
172
|
-
*/
|
|
173
|
-
declare function makeAgentSubagentRunner(opts: AgentRunnerOptions): SubagentRunner;
|
|
174
|
-
|
|
175
4
|
/**
|
|
176
5
|
* Catalog types for the WrongStack agent fleet.
|
|
177
6
|
*
|
|
@@ -445,4 +274,4 @@ declare class DefaultMultiAgentCoordinator extends EventEmitter implements Multi
|
|
|
445
274
|
private isDone;
|
|
446
275
|
}
|
|
447
276
|
|
|
448
|
-
export { type AgentBudgetTier as A, DEFAULT_DISPATCH_ROLE as D,
|
|
277
|
+
export { type AgentBudgetTier as A, DEFAULT_DISPATCH_ROLE as D, HEAVY_BUDGET as H, LIGHT_BUDGET as L, MEDIUM_BUDGET as M, TOOLS as T, type AgentCapability as a, type AgentDefinition as b, type AgentPhase as c, DefaultMultiAgentCoordinator as d, type DispatchCandidate as e, type DispatchClassifier as f, type DispatchMethod as g, type DispatchOptions as h, type DispatchResult as i, type MultiAgentCoordinatorOptions as j, dispatchAgent as k, makeLLMClassifier as m, scoreAgents as s };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as AgentPhase, b as AgentDefinition } from './multi-agent-coordinator-3Ypfg-hr.js';
|
|
2
2
|
import { m as SubagentConfig, t as TaskResult, j as CoordinatorStatus, u as TaskSpec, M as MultiAgentConfig, s as SubagentRunner } from './multi-agent-7OK4pEKW.js';
|
|
3
3
|
import { B as SessionWriter, Q as Tool, y as SessionStore } from './context-z2x5gv_V.js';
|
|
4
4
|
import { a as DirectorStateSnapshot } from './director-state-BmYi3DGA.js';
|
|
5
5
|
import { I as InMemoryAgentBridge } from './agent-bridge-hXRN-GO_.js';
|
|
6
|
+
import { F as FleetBus, e as FleetUsage, f as FleetUsageAggregator } from './agent-subagent-runner-BOBYkW_r.js';
|
|
6
7
|
import { E as EventBus } from './events-D4pGukpI.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Q as Tool, d as Context } from './context-z2x5gv_V.js';
|
|
2
|
+
import { I as InputReader } from './input-reader-E-ffP2ee.js';
|
|
3
|
+
import { a as PermissionPolicy, P as PermissionDecision } from './secret-scrubber-nI8qjaqW.js';
|
|
4
|
+
|
|
5
|
+
interface PermissionPolicyOptions {
|
|
6
|
+
trustFile: string;
|
|
7
|
+
yolo?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* When true, YOLO mode allows even `destructive` tools without confirm.
|
|
10
|
+
* Corresponds to the `--force-all-yolo` CLI flag.
|
|
11
|
+
*/
|
|
12
|
+
forceAllYolo?: boolean;
|
|
13
|
+
promptDelegate?: (tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>;
|
|
14
|
+
inputReader?: InputReader;
|
|
15
|
+
}
|
|
16
|
+
declare class DefaultPermissionPolicy implements PermissionPolicy {
|
|
17
|
+
private policy;
|
|
18
|
+
private loaded;
|
|
19
|
+
private readonly trustFile;
|
|
20
|
+
private yolo;
|
|
21
|
+
private forceAllYolo;
|
|
22
|
+
/**
|
|
23
|
+
* Session-scoped "soft deny" map. When the user presses 'n' (block once),
|
|
24
|
+
* the tool+pattern is added here. If the LLM retries in the same session,
|
|
25
|
+
* we return deny directly without asking again.
|
|
26
|
+
*
|
|
27
|
+
* Cleared on reload() since reload = fresh trust file snapshot.
|
|
28
|
+
*/
|
|
29
|
+
private sessionDenied;
|
|
30
|
+
/**
|
|
31
|
+
* Session-scoped "soft trust" map. When the user presses 'a' (allow once),
|
|
32
|
+
* the tool+pattern is added here. If the LLM retries in the same session,
|
|
33
|
+
* we return auto directly without asking again.
|
|
34
|
+
*
|
|
35
|
+
* Cleared on reload().
|
|
36
|
+
*/
|
|
37
|
+
private sessionAllowed;
|
|
38
|
+
/**
|
|
39
|
+
* Interactive prompt delegate. When set, `evaluate()` calls it to get a
|
|
40
|
+
* user decision synchronously (CLI REPL path). When cleared (TUI / WebUI),
|
|
41
|
+
* `evaluate()` returns `confirm` so the caller can emit
|
|
42
|
+
* `tool.confirm_needed` for the UI layer to handle.
|
|
43
|
+
*
|
|
44
|
+
* Mutable so the host can switch from CLI-prompt to event-driven
|
|
45
|
+
* confirmation at runtime (e.g. when `--goal` forces TUI mode after
|
|
46
|
+
* the agent was already constructed).
|
|
47
|
+
*/
|
|
48
|
+
private promptDelegate?;
|
|
49
|
+
/** Pre-compiled wildcard patterns — rebuilt on reload for O(1) lookup. */
|
|
50
|
+
private wildcardEntries;
|
|
51
|
+
constructor(opts: PermissionPolicyOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Replace (or clear) the interactive prompt delegate at runtime.
|
|
54
|
+
* Used by the CLI to switch from inline prompts (REPL) to event-driven
|
|
55
|
+
* confirmation (TUI) when the run mode is determined after the policy
|
|
56
|
+
* was constructed (e.g. `--goal` auto-flipping to TUI).
|
|
57
|
+
*/
|
|
58
|
+
setPromptDelegate(delegate: PermissionPolicyOptions['promptDelegate']): void;
|
|
59
|
+
/** Toggle YOLO (auto-approve) mode at runtime. */
|
|
60
|
+
setYolo(enabled: boolean): void;
|
|
61
|
+
/** Check whether YOLO mode is currently active. */
|
|
62
|
+
getYolo(): boolean;
|
|
63
|
+
/** Toggle force-all-YOLO at runtime. */
|
|
64
|
+
setForceAllYolo(enabled: boolean): void;
|
|
65
|
+
/** Check whether force-all-YOLO is active. */
|
|
66
|
+
getForceAllYolo(): boolean;
|
|
67
|
+
reload(): Promise<void>;
|
|
68
|
+
evaluate(tool: Tool, input: unknown, ctx: Context): Promise<PermissionDecision>;
|
|
69
|
+
trust(rule: {
|
|
70
|
+
tool: string;
|
|
71
|
+
pattern: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/** Persist a deny rule — this tool+pattern pair is permanently blocked. */
|
|
74
|
+
deny(rule: {
|
|
75
|
+
tool: string;
|
|
76
|
+
pattern: string;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
/** Block this tool+pattern for the rest of this session (no trust file). */
|
|
79
|
+
denyOnce(rule: {
|
|
80
|
+
tool: string;
|
|
81
|
+
pattern: string;
|
|
82
|
+
}): void;
|
|
83
|
+
/** Auto-approve this tool+pattern for the rest of this session (no trust file). */
|
|
84
|
+
allowOnce(rule: {
|
|
85
|
+
tool: string;
|
|
86
|
+
pattern: string;
|
|
87
|
+
}): void;
|
|
88
|
+
private subjectFor;
|
|
89
|
+
private findNamespaceEntry;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Auto-approving PermissionPolicy used for subagents. Subagents run
|
|
93
|
+
* non-interactively under a director — they cannot answer permission
|
|
94
|
+
* prompts, so a non-YOLO policy on the leader would silently hang the
|
|
95
|
+
* delegated run on the first sensitive tool call. The user already
|
|
96
|
+
* authorized the delegation when they invoked the leader; subagents
|
|
97
|
+
* inherit that authorization automatically.
|
|
98
|
+
*
|
|
99
|
+
* Tool defaults of `permission: 'deny'` are still honored (this is a
|
|
100
|
+
* subagent capability override, not a deny-bypass).
|
|
101
|
+
*/
|
|
102
|
+
declare class AutoApprovePermissionPolicy implements PermissionPolicy {
|
|
103
|
+
evaluate(tool: Tool): Promise<PermissionDecision>;
|
|
104
|
+
trust(): Promise<void>;
|
|
105
|
+
deny(): Promise<void>;
|
|
106
|
+
denyOnce(): void;
|
|
107
|
+
allowOnce(): void;
|
|
108
|
+
reload(): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { AutoApprovePermissionPolicy as A, DefaultPermissionPolicy as D, type PermissionPolicyOptions as P };
|
|
@@ -2,7 +2,7 @@ import { E as EventBus } from './events-D4pGukpI.js';
|
|
|
2
2
|
import { y as SessionStore, x as SessionMetadata, B as SessionWriter, r as ResumedSession, S as SessionData, z as SessionSummary, c as ContentBlock, w as SessionEvent, N as TodoItem, f as ConversationState } from './context-z2x5gv_V.js';
|
|
3
3
|
import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-DsadjyF9.js';
|
|
4
4
|
import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
|
|
5
|
-
import { a as WstackPaths } from './wstack-paths-
|
|
5
|
+
import { a as WstackPaths } from './wstack-paths-gCrJ631C.js';
|
|
6
6
|
import { c as ConfigStore, a as Config, b as ConfigLoader } from './config-Bi4Q0fnz.js';
|
|
7
7
|
import { S as SecretVault } from './secret-vault-DoISxaKO.js';
|
|
8
8
|
|
package/dist/sdd/index.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, l as TaskGraph, m as TaskNode, k as TaskFilter, p as TaskSort, o as TaskProgress, r as TaskType, n as TaskPriority, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../task-graph-D1YQbpxF.js';
|
|
2
2
|
import { E as EventBus } from '../events-D4pGukpI.js';
|
|
3
|
-
import { D as DoneCondition } from '../multi-agent-7OK4pEKW.js';
|
|
3
|
+
import { D as DoneCondition, t as TaskResult } from '../multi-agent-7OK4pEKW.js';
|
|
4
|
+
import { c as Agent } from '../index-BUHs7xJ9.js';
|
|
5
|
+
import { A as AgentFactory } from '../agent-subagent-runner-BOBYkW_r.js';
|
|
4
6
|
import '../context-z2x5gv_V.js';
|
|
7
|
+
import '../logger-DDd5C--Z.js';
|
|
8
|
+
import '../system-prompt-CWA6ml-d.js';
|
|
9
|
+
import '../observability-BhnVLBLS.js';
|
|
10
|
+
import '../secret-scrubber-nI8qjaqW.js';
|
|
11
|
+
import '../config-Bi4Q0fnz.js';
|
|
12
|
+
import '../models-registry-BcYJDKLm.js';
|
|
5
13
|
|
|
6
14
|
declare class SpecParser {
|
|
7
15
|
parse(content: string): Specification;
|
|
@@ -624,4 +632,167 @@ declare function createAutoExecutor(opts: {
|
|
|
624
632
|
maxRetries?: number;
|
|
625
633
|
}): AutoExecutor;
|
|
626
634
|
|
|
627
|
-
|
|
635
|
+
/**
|
|
636
|
+
* SddTaskDecomposer
|
|
637
|
+
*
|
|
638
|
+
* Converts a TaskGraph (from SDD's TaskGenerator) into a dependency-aware
|
|
639
|
+
* sequence of batches for ParallelEternalEngine.
|
|
640
|
+
*
|
|
641
|
+
* Key behaviour:
|
|
642
|
+
* - Each `nextBatch()` call returns up to `parallelSlots` ready tasks
|
|
643
|
+
* (all blockers completed, sorted by priority).
|
|
644
|
+
* - Tasks that are blocked by an in-progress task are NOT included
|
|
645
|
+
* in the batch — they wait for the blocker to complete.
|
|
646
|
+
* - When `isDone()` returns true the whole graph is either completed
|
|
647
|
+
* or deadlocked (all remaining tasks are blocked by failed tasks).
|
|
648
|
+
*
|
|
649
|
+
* Usage:
|
|
650
|
+
* ```
|
|
651
|
+
* const decomposer = new SddTaskDecomposer(tracker, graph, { parallelSlots: 4 });
|
|
652
|
+
* while (!decomposer.isDone()) {
|
|
653
|
+
* const batch = decomposer.nextBatch();
|
|
654
|
+
* if (batch.length === 0) break; // deadlock
|
|
655
|
+
* await fanOut(batch);
|
|
656
|
+
* decomposer.acknowledgeBatch(batch.map(t => t.id));
|
|
657
|
+
* }
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
interface SddTaskDecomposerOptions {
|
|
662
|
+
/** Max tasks per batch. Default: 4. Range 1–16. */
|
|
663
|
+
parallelSlots?: number;
|
|
664
|
+
}
|
|
665
|
+
interface TaskBatch {
|
|
666
|
+
/** Tasks ready to execute in this wave. */
|
|
667
|
+
tasks: TaskNode[];
|
|
668
|
+
/** 0-based wave number since the decomposer was constructed. */
|
|
669
|
+
wave: number;
|
|
670
|
+
/** True when every node in the graph is either completed or failed. */
|
|
671
|
+
allDone: boolean;
|
|
672
|
+
/** True when no batch was produced because remaining tasks are all blocked by failed nodes. */
|
|
673
|
+
deadlocked: boolean;
|
|
674
|
+
}
|
|
675
|
+
declare class SddTaskDecomposer {
|
|
676
|
+
private readonly tracker;
|
|
677
|
+
private readonly graph;
|
|
678
|
+
private readonly slots;
|
|
679
|
+
private wave;
|
|
680
|
+
constructor(tracker: TaskTracker, graph: TaskGraph, opts?: SddTaskDecomposerOptions);
|
|
681
|
+
/**
|
|
682
|
+
* Return the next batch of runnable tasks.
|
|
683
|
+
* Returns `allDone: true` when every node is completed.
|
|
684
|
+
* Returns `deadlocked: true` when no batch can be produced because
|
|
685
|
+
* all remaining tasks are blocked by failed nodes.
|
|
686
|
+
*/
|
|
687
|
+
nextBatch(): TaskBatch;
|
|
688
|
+
/**
|
|
689
|
+
* Advance the wave counter after a batch completes.
|
|
690
|
+
* Call this once per `nextBatch()` result that was fan-out.
|
|
691
|
+
*/
|
|
692
|
+
acknowledgeBatch(_completedTaskIds: string[]): void;
|
|
693
|
+
/**
|
|
694
|
+
* True when every node in the graph is completed.
|
|
695
|
+
* Use this to exit the fan-out loop after `isDone() || deadlocked`.
|
|
696
|
+
*/
|
|
697
|
+
isDone(): boolean;
|
|
698
|
+
/**
|
|
699
|
+
* Total waves produced so far.
|
|
700
|
+
*/
|
|
701
|
+
getWaveCount(): number;
|
|
702
|
+
/**
|
|
703
|
+
* Return pending nodes whose blockers are all completed.
|
|
704
|
+
* Sorted by priority (critical first), then by creation time.
|
|
705
|
+
*/
|
|
706
|
+
private pendingReadyNodes;
|
|
707
|
+
/** True when at least one non-completed, non-failed task is blocked. */
|
|
708
|
+
private hasAnyBlockedTasks;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* SddParallelRun
|
|
713
|
+
*
|
|
714
|
+
* Drives a TaskGraph through ParallelEternalEngine's infrastructure
|
|
715
|
+
* (DefaultMultiAgentCoordinator + AgentSubagentRunner) but powered by
|
|
716
|
+
* SddTaskDecomposer — producing dependency-aware waves instead of
|
|
717
|
+
* goal-driven iterations.
|
|
718
|
+
*
|
|
719
|
+
* One-shot: completes when all tasks are done OR a deadlock is detected.
|
|
720
|
+
* Does NOT loop — each run() call is a discrete execution.
|
|
721
|
+
*
|
|
722
|
+
* Usage:
|
|
723
|
+
* ```
|
|
724
|
+
* const run = new SddParallelRun({ tracker, graph, agent, projectRoot });
|
|
725
|
+
* await run.run({ onWave });
|
|
726
|
+
* // or with progress callback:
|
|
727
|
+
* await run.run({ onProgress: (p) => console.log(renderProgress(p)) });
|
|
728
|
+
* ```
|
|
729
|
+
*/
|
|
730
|
+
|
|
731
|
+
interface SddParallelRunOptions {
|
|
732
|
+
/** Pre-constructed TaskTracker (must already hold the graph's initial state). */
|
|
733
|
+
tracker: TaskTracker;
|
|
734
|
+
/** The TaskGraph produced by TaskGenerator from an approved spec. */
|
|
735
|
+
graph: TaskGraph;
|
|
736
|
+
/** The main agent — used as the subagent factory. */
|
|
737
|
+
agent: Agent;
|
|
738
|
+
/** Project root (used for coordinator id). */
|
|
739
|
+
projectRoot: string;
|
|
740
|
+
/** Override default parallel slots (1–16). Default: 4. */
|
|
741
|
+
parallelSlots?: number;
|
|
742
|
+
/** Per-task timeout in ms. Default: 300_000 (5 min). */
|
|
743
|
+
taskTimeoutMs?: number;
|
|
744
|
+
/** Override the default agent factory. */
|
|
745
|
+
subagentFactory?: AgentFactory;
|
|
746
|
+
/** Called after each wave completes. */
|
|
747
|
+
onWave?: (wave: WaveResult) => void;
|
|
748
|
+
/** Called with progress stats every ~2s during execution. */
|
|
749
|
+
onProgress?: (progress: SddProgress) => void;
|
|
750
|
+
}
|
|
751
|
+
interface SddProgress {
|
|
752
|
+
wave: number;
|
|
753
|
+
total: number;
|
|
754
|
+
completed: number;
|
|
755
|
+
inProgress: number;
|
|
756
|
+
failed: number;
|
|
757
|
+
blocked: number;
|
|
758
|
+
pending: number;
|
|
759
|
+
percent: number;
|
|
760
|
+
deadlocked: boolean;
|
|
761
|
+
}
|
|
762
|
+
interface WaveResult {
|
|
763
|
+
wave: number;
|
|
764
|
+
batch: TaskBatch;
|
|
765
|
+
results: TaskResult[];
|
|
766
|
+
successCount: number;
|
|
767
|
+
failCount: number;
|
|
768
|
+
durationMs: number;
|
|
769
|
+
stopRequested: boolean;
|
|
770
|
+
}
|
|
771
|
+
interface RunResult {
|
|
772
|
+
totalWaves: number;
|
|
773
|
+
totalCompleted: number;
|
|
774
|
+
totalFailed: number;
|
|
775
|
+
totalDurationMs: number;
|
|
776
|
+
deadlocked: boolean;
|
|
777
|
+
stopRequested: boolean;
|
|
778
|
+
finalProgress: TaskProgress;
|
|
779
|
+
}
|
|
780
|
+
declare class SddParallelRun {
|
|
781
|
+
private readonly opts;
|
|
782
|
+
private readonly slots;
|
|
783
|
+
private readonly timeoutMs;
|
|
784
|
+
private decomposer;
|
|
785
|
+
private coordinator;
|
|
786
|
+
private stopRequested;
|
|
787
|
+
constructor(opts: SddParallelRunOptions);
|
|
788
|
+
/** Trigger stop — causes run() to abort after the current wave. */
|
|
789
|
+
stop(): void;
|
|
790
|
+
/** Execute all waves until completion or deadlock. Returns final summary. */
|
|
791
|
+
run(): Promise<RunResult>;
|
|
792
|
+
private buildCoordinator;
|
|
793
|
+
private defaultFactory;
|
|
794
|
+
executeWave(batch: TaskBatch): Promise<WaveResult>;
|
|
795
|
+
private buildProgress;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export { AISpecBuilder, type AISpecBuilderOptions, type AISpecPhase, type AISpecSession, AutoExecutor, type AutoExecutorOptions, type BottleneckTask, type CollectedAnswer, type CriticalPathAnalysis, DefaultTaskStore, type ExecutionSummary, type GeneratedTask, type RunResult, SPEC_TEMPLATES, SddParallelRun, type SddParallelRunOptions, type SddProgress, SddTaskDecomposer, type SddTaskDecomposerOptions, type SpecDiff, SpecDrivenDev, type SpecDrivenDevOptions, type SpecIndexEntry, SpecParser, SpecStore, type SpecStoreOptions, type SpecVersion, SpecVersioning, type TaskBatch, type TaskExecutionContext, type TaskExecutionResult, TaskFlow, type TaskFlowEventMap, type TaskFlowEventName, type TaskFlowExecutionContext, type TaskFlowOptions, type TaskFlowPhase, TaskGenerator, type TaskGeneratorOptions, type TaskGraphIndexEntry, TaskGraphStore, type TaskGraphStoreOptions, type TaskStore, TaskTracker, type TaskTrackerOptions, type TaskTransition, type WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown };
|