@wrongstack/core 0.1.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.
@@ -0,0 +1,16 @@
1
+ import { a2 as Tool, a0 as TextBlock } from './secret-scrubber-Dax_Ou_o.js';
2
+
3
+ interface BuildContext {
4
+ cwd: string;
5
+ projectRoot: string;
6
+ tools: Tool[];
7
+ /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
8
+ provider?: string;
9
+ /** Model id (e.g. "claude-sonnet-4-6", "MiniMax-M2.7"). */
10
+ model?: string;
11
+ }
12
+ interface SystemPromptBuilder {
13
+ build(ctx: BuildContext): Promise<TextBlock[]>;
14
+ }
15
+
16
+ export type { BuildContext as B, SystemPromptBuilder as S };
@@ -0,0 +1,689 @@
1
+ import { f as ContentBlock, ag as Context, a2 as Tool, a9 as WireFamily, z as ProviderConfig, y as Provider, ah as Container, ai as EventBus, au as Pipeline, D as Request, K as Response, a5 as ToolUseBlock, a4 as ToolResultBlock, a0 as TextBlock, aw as RunOptions, az as ReadonlyPipeline, d as Config, j as Logger, aj as EventName, ak as Listener, v as PermissionPolicy, S as SecretScrubber, R as Renderer } from './secret-scrubber-Dax_Ou_o.js';
2
+
3
+ type AttachmentKind = 'text' | 'image' | 'file';
4
+ interface AttachmentMeta {
5
+ /** Display label for the placeholder e.g. "123 lines" or "PNG 412 KB". */
6
+ label?: string;
7
+ /** Original filename if known. */
8
+ filename?: string;
9
+ /** MIME type if known. Required for images. */
10
+ mediaType?: string;
11
+ }
12
+ interface Attachment {
13
+ readonly id: string;
14
+ readonly kind: AttachmentKind;
15
+ readonly meta: AttachmentMeta;
16
+ /** In-memory payload. For images this is base64; for text/file it's the raw text. */
17
+ readonly data?: string;
18
+ /** Disk location if spooled. Mutually exclusive with `data` for large payloads. */
19
+ readonly path?: string;
20
+ readonly bytes: number;
21
+ readonly createdAt: string;
22
+ }
23
+ interface AttachmentRef {
24
+ readonly id: string;
25
+ readonly kind: AttachmentKind;
26
+ /** Index for display, e.g. `#1`. Stable for the lifetime of a session. */
27
+ readonly seq: number;
28
+ readonly meta: AttachmentMeta;
29
+ }
30
+ interface AddAttachmentInput {
31
+ kind: AttachmentKind;
32
+ data: string;
33
+ meta?: AttachmentMeta;
34
+ }
35
+ /**
36
+ * Session-scoped store for content that is too big to inline in display
37
+ * but must be sent to the model as a real ContentBlock. The input layer
38
+ * (CLI/TUI) puts pasted text, dropped files, and pasted images here, gets
39
+ * back a stable AttachmentRef, and shows a placeholder like `[pasted #1]`
40
+ * to the user. At submit time, `expand()` swaps placeholders for the real
41
+ * payload as ContentBlock[].
42
+ */
43
+ interface AttachmentStore {
44
+ add(input: AddAttachmentInput): Promise<AttachmentRef>;
45
+ get(id: string): Promise<Attachment | undefined>;
46
+ list(): AttachmentRef[];
47
+ /**
48
+ * Replace all known placeholder tokens in `text` (e.g. `[pasted #1]`,
49
+ * `[image #2]`) with the corresponding ContentBlock(s) and return the
50
+ * mixed array. Unknown placeholders are left as plain text.
51
+ */
52
+ expand(text: string): Promise<ContentBlock[]>;
53
+ clear(): Promise<void>;
54
+ }
55
+
56
+ /**
57
+ * SecretVault encrypts secrets-at-rest in config files. The wire format is
58
+ * `enc:v1:<base64-iv>:<base64-tag>:<base64-ciphertext>`. Plaintext strings
59
+ * (those that do not match this prefix) are passed through unchanged so that
60
+ * existing configs and env-var-derived values keep working.
61
+ *
62
+ * The vault is intentionally NOT designed to defeat a determined local
63
+ * attacker who can read both the config file and the key file — that level
64
+ * of secrecy needs the OS keychain. The goal is to keep keys from being
65
+ * visible in screen shares, accidental log captures, and `cat config.json`
66
+ * over someone's shoulder.
67
+ */
68
+ interface SecretVault {
69
+ encrypt(plaintext: string): string;
70
+ decrypt(value: string): string;
71
+ isEncrypted(value: string): boolean;
72
+ }
73
+ declare const ENCRYPTED_PREFIX = "enc:v1:";
74
+
75
+ /**
76
+ * A slash command registered with the CLI or available to plugins.
77
+ * Plugins receive a view of the registry via PluginAPI.slashCommands.
78
+ *
79
+ * Commands registered by plugins use a namespaced name: `pluginName:commandName`.
80
+ * This prevents collisions with built-in commands and other plugins.
81
+ */
82
+ interface SlashCommand {
83
+ /** Unique command name. For plugins: `pluginName:commandName`. */
84
+ name: string;
85
+ /** Short aliases — also prefixed automatically: `pluginName:alias`. */
86
+ aliases?: string[];
87
+ description: string;
88
+ /**
89
+ * Execute the command.
90
+ * @param args Everything after the command name (trimmed by dispatch).
91
+ * @param ctx The current agent context.
92
+ * @returns `{ exit: true }` to quit the REPL. `{ message }` to print and continue.
93
+ */
94
+ run(args: string, ctx: Context): Promise<{
95
+ exit?: boolean;
96
+ message?: string;
97
+ } | void>;
98
+ }
99
+
100
+ declare class ToolRegistry {
101
+ private readonly tools;
102
+ register(tool: Tool, owner?: string): void;
103
+ /**
104
+ * Register a tool as a default. If the tool name is already registered,
105
+ * this is a no-op — the existing registration (from core or another
106
+ * plugin) takes precedence. Use `override` to intentionally replace.
107
+ */
108
+ registerDefault(tool: Tool, owner?: string): void;
109
+ unregister(name: string): boolean;
110
+ /**
111
+ * Override an existing tool. Throws if the tool is not already registered.
112
+ * Plugins use this to replace built-in tools with custom implementations.
113
+ */
114
+ override(name: string, tool: Tool, owner?: string): void;
115
+ get(name: string): Tool | undefined;
116
+ ownerOf(name: string): string | undefined;
117
+ list(): Tool[];
118
+ listWithOwner(): {
119
+ tool: Tool;
120
+ owner: string;
121
+ }[];
122
+ clear(): void;
123
+ }
124
+
125
+ /**
126
+ * Factory for constructing a Provider instance. The `family` field
127
+ * declares the wire protocol so callers can route without inspecting
128
+ * the returned instance. The `type` is the registry key (e.g. a
129
+ * provider's models.dev id or a user-chosen alias).
130
+ */
131
+ interface ProviderFactory$1 {
132
+ /**
133
+ * Unique identifier used as the registry key. When registered via
134
+ * a plugin, this becomes `cfg.type` in `ProviderRegistry.create(cfg)`.
135
+ */
136
+ type: string;
137
+ /**
138
+ * Declares the wire protocol family so consumers can route based on
139
+ * capability (e.g. which tool-format converter to use) without
140
+ * instantiating the provider.
141
+ */
142
+ family: WireFamily;
143
+ create(cfg: ProviderConfig): Provider;
144
+ }
145
+ declare class ProviderRegistry {
146
+ private readonly factories;
147
+ register(f: ProviderFactory$1): void;
148
+ has(type: string): boolean;
149
+ create(cfg: ProviderConfig): Provider;
150
+ list(): string[];
151
+ }
152
+
153
+ /** Default iteration cap. Use 0 or Infinity via config to disable. */
154
+ declare const DEFAULT_MAX_ITERATIONS = 100;
155
+ interface RunResult {
156
+ status: 'done' | 'failed' | 'max_iterations' | 'aborted';
157
+ error?: unknown;
158
+ finalText?: string;
159
+ iterations: number;
160
+ }
161
+ interface AgentInit {
162
+ container: Container;
163
+ tools: ToolRegistry;
164
+ providers: ProviderRegistry;
165
+ events: EventBus;
166
+ pipelines: AgentPipelines;
167
+ context: Context;
168
+ maxIterations?: number;
169
+ iterationTimeoutMs?: number;
170
+ executionStrategy?: 'parallel' | 'sequential' | 'smart';
171
+ perIterationOutputCapBytes?: number;
172
+ /**
173
+ * When true (default), the agent automatically extends its iteration
174
+ * limit by 100 when hit, without asking the user. Set to false to
175
+ * emit `iteration.limit_reached` and wait for a listener to grant/deny.
176
+ */
177
+ autoExtendLimit?: boolean;
178
+ }
179
+ interface AgentPipelines {
180
+ request: Pipeline<Request>;
181
+ response: Pipeline<Response>;
182
+ toolCall: Pipeline<ToolCallPipelinePayload>;
183
+ userInput: Pipeline<UserInputPayload>;
184
+ assistantOutput: Pipeline<TextBlock>;
185
+ contextWindow: Pipeline<Context>;
186
+ }
187
+ interface UserInputPayload {
188
+ content: ContentBlock[];
189
+ /** Concatenation of text blocks — convenience for middleware that only cares about text. */
190
+ text: string;
191
+ ctx: Context;
192
+ }
193
+ type AgentInput = string | ContentBlock[];
194
+ interface ToolCallPipelinePayload {
195
+ toolUse: ToolUseBlock;
196
+ result: ToolResultBlock;
197
+ ctx: Context;
198
+ /** Undefined when the model invoked a tool name we don't know. */
199
+ tool?: Tool;
200
+ }
201
+ declare function createDefaultPipelines(): AgentPipelines;
202
+ declare class Agent {
203
+ readonly container: Container;
204
+ readonly tools: ToolRegistry;
205
+ readonly providers: ProviderRegistry;
206
+ readonly events: EventBus;
207
+ readonly pipelines: AgentPipelines;
208
+ readonly ctx: Context;
209
+ private readonly maxIterations;
210
+ private readonly iterationTimeoutMs;
211
+ private readonly executionStrategy;
212
+ private readonly perIterationOutputCapBytes;
213
+ private readonly plugins;
214
+ private readonly toolExecutor;
215
+ private readonly autoExtendLimit;
216
+ constructor(init: AgentInit);
217
+ private get logger();
218
+ private get retry();
219
+ private get errorHandler();
220
+ private get permission();
221
+ private get scrubber();
222
+ private get compactor();
223
+ private get renderer();
224
+ register(tool: Tool): void;
225
+ use(plugin: Plugin, api: PluginAPI): Promise<void>;
226
+ run(userInput: AgentInput, opts?: RunOptions): Promise<RunResult>;
227
+ private runInner;
228
+ /**
229
+ * Emit an event asking listeners (CLI/TUI) whether to extend the iteration
230
+ * limit. Returns the number of additional iterations granted. If no listener
231
+ * responds or the user declines, returns 0.
232
+ */
233
+ private requestLimitExtension;
234
+ /**
235
+ * Consume a Provider.stream() into a Response, emitting text_delta and
236
+ * tool_use lifecycle events to the EventBus as they arrive. This is the
237
+ * canonical path when the provider declares `capabilities.streaming`;
238
+ * complete() is only used as a fallback for legacy providers.
239
+ */
240
+ private streamProviderToResponse;
241
+ private callProviderWithRetry;
242
+ private executeTools;
243
+ }
244
+
245
+ interface ToolRegistryView {
246
+ register(t: Tool): void;
247
+ unregister(name: string): void;
248
+ get(name: string): Tool | undefined;
249
+ list(): Tool[];
250
+ }
251
+ interface ProviderFactory {
252
+ type: string;
253
+ family: WireFamily;
254
+ create(cfg: unknown): Provider;
255
+ }
256
+ interface ProviderRegistryView {
257
+ register(f: ProviderFactory): void;
258
+ create(cfg: {
259
+ type: string;
260
+ } & Record<string, unknown>): Provider;
261
+ list(): string[];
262
+ }
263
+ interface MCPRegistryView {
264
+ start(cfg: unknown): Promise<void>;
265
+ stop(name: string): Promise<void>;
266
+ restart(name: string): Promise<void>;
267
+ list(): {
268
+ name: string;
269
+ state: string;
270
+ toolCount: number;
271
+ }[];
272
+ }
273
+ interface SlashCommandRegistryView {
274
+ register(cmd: SlashCommand): void;
275
+ unregister(name: string): boolean;
276
+ get(name: string): SlashCommand | undefined;
277
+ list(): SlashCommand[];
278
+ }
279
+ interface PluginPipelines {
280
+ request: ReadonlyPipeline<Request>;
281
+ response: ReadonlyPipeline<Response>;
282
+ toolCall: ReadonlyPipeline<ToolCallPipelinePayload>;
283
+ userInput: ReadonlyPipeline<{
284
+ content: ContentBlock[];
285
+ text: string;
286
+ ctx: Context;
287
+ }>;
288
+ assistantOutput: ReadonlyPipeline<TextBlock>;
289
+ contextWindow: ReadonlyPipeline<Context>;
290
+ [k: string]: ReadonlyPipeline<any>;
291
+ }
292
+ interface PluginAPI {
293
+ container: Container;
294
+ pipelines: PluginPipelines;
295
+ events: EventBus;
296
+ tools: ToolRegistryView;
297
+ providers: ProviderRegistryView;
298
+ mcp: MCPRegistryView;
299
+ slashCommands: SlashCommandRegistryView;
300
+ config: Config;
301
+ log: Logger;
302
+ /**
303
+ * Register a one-time event listener. The handler is automatically removed
304
+ * after the first emission, or when the plugin is uninstalled — whichever
305
+ * comes first.
306
+ */
307
+ onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
308
+ }
309
+ interface Plugin {
310
+ name: string;
311
+ version?: string;
312
+ apiVersion: string;
313
+ /** Mandatory plugin dependencies — loading fails if any are absent. */
314
+ dependsOn?: string[];
315
+ /** Optional plugin dependencies — silently skipped if absent. */
316
+ optionalDeps?: string[];
317
+ conflictsWith?: string[];
318
+ setup(api: PluginAPI): void | Promise<void>;
319
+ teardown?(api: PluginAPI): void | Promise<void>;
320
+ }
321
+
322
+ interface Mode {
323
+ id: string;
324
+ name: string;
325
+ description: string;
326
+ /** Additional prompt text injected into system prompt when mode is active */
327
+ prompt: string;
328
+ /** Tags for tool_search filtering */
329
+ tags?: string[];
330
+ /** Tools that should be prioritized/highlighted when this mode is active */
331
+ toolPreferences?: string[];
332
+ }
333
+ interface ModeManifest {
334
+ modes: Mode[];
335
+ defaultMode?: string;
336
+ }
337
+ interface ModeStore {
338
+ getActiveMode(): Promise<Mode | null>;
339
+ setActiveMode(modeId: string | null): Promise<void>;
340
+ listModes(): Promise<Mode[]>;
341
+ getMode(modeId: string): Promise<Mode | null>;
342
+ }
343
+ interface ModeConfig {
344
+ directory: string;
345
+ }
346
+ declare const DEFAULT_MODES: Mode[];
347
+
348
+ type BridgeMessageType = 'task' | 'result' | 'progress' | 'error' | 'heartbeat' | 'stop' | 'delegate';
349
+ interface BridgeMessage<T = unknown> {
350
+ id: string;
351
+ type: BridgeMessageType;
352
+ from: string;
353
+ to?: string;
354
+ payload: T;
355
+ timestamp: number;
356
+ priority?: 'low' | 'normal' | 'high' | 'critical';
357
+ }
358
+ interface AgentBridgeConfig {
359
+ agentId: string;
360
+ coordinatorId: string;
361
+ timeoutMs?: number;
362
+ bufferSize?: number;
363
+ }
364
+ interface AgentBridge {
365
+ readonly agentId: string;
366
+ readonly coordinatorId: string;
367
+ send(msg: BridgeMessage): Promise<void>;
368
+ broadcast(msg: BridgeMessage): Promise<void>;
369
+ subscribe(handler: (msg: BridgeMessage) => void | Promise<void>): () => void;
370
+ request<T>(msg: BridgeMessage, timeoutMs?: number): Promise<BridgeMessage<T>>;
371
+ stop(): Promise<void>;
372
+ }
373
+ interface BridgeTransport {
374
+ send(msg: BridgeMessage, to: string): Promise<void>;
375
+ subscribe(agentId: string, handler: (msg: BridgeMessage) => void | Promise<void>): () => void;
376
+ close(agentId: string): Promise<void>;
377
+ }
378
+
379
+ interface SubagentConfig {
380
+ id: string;
381
+ name: string;
382
+ role: string;
383
+ prompt?: string;
384
+ maxIterations?: number;
385
+ maxToolCalls?: number;
386
+ timeoutMs?: number;
387
+ tools?: string[];
388
+ model?: string;
389
+ priority?: number;
390
+ }
391
+ interface TaskResult<T = unknown> {
392
+ subagentId: string;
393
+ taskId: string;
394
+ status: 'success' | 'failed' | 'timeout' | 'stopped';
395
+ result?: T;
396
+ error?: string;
397
+ iterations: number;
398
+ toolCalls: number;
399
+ durationMs: number;
400
+ }
401
+ interface TaskSpec {
402
+ id: string;
403
+ description: string;
404
+ subagentId?: string;
405
+ priority?: number;
406
+ maxToolCalls?: number;
407
+ timeoutMs?: number;
408
+ context?: Record<string, unknown>;
409
+ }
410
+ interface DoneCondition {
411
+ type: 'iterations' | 'tool_calls' | 'output_match' | 'custom' | 'all_tasks_done';
412
+ maxIterations?: number;
413
+ maxToolCalls?: number;
414
+ pattern?: string;
415
+ predicate?: string;
416
+ }
417
+ interface MultiAgentConfig {
418
+ coordinatorId: string;
419
+ leaderSystemPrompt?: string;
420
+ subagents?: SubagentConfig[];
421
+ maxConcurrent?: number;
422
+ doneCondition: DoneCondition;
423
+ timeoutMs?: number;
424
+ }
425
+ interface SpawnResult {
426
+ subagentId: string;
427
+ agentId: string;
428
+ }
429
+ interface TaskDelegation {
430
+ task: TaskSpec;
431
+ subagentId: string;
432
+ }
433
+ interface CoordinatorEvents {
434
+ 'task.assigned': {
435
+ task: TaskSpec;
436
+ subagentId: string;
437
+ };
438
+ 'task.completed': {
439
+ task: TaskSpec;
440
+ result: TaskResult;
441
+ };
442
+ 'subagent.started': {
443
+ subagent: SubagentConfig;
444
+ };
445
+ 'subagent.stopped': {
446
+ subagentId: string;
447
+ reason: string;
448
+ };
449
+ 'done': {
450
+ results: TaskResult[];
451
+ totalIterations: number;
452
+ };
453
+ }
454
+ interface MultiAgentCoordinator {
455
+ readonly coordinatorId: string;
456
+ readonly config: MultiAgentConfig;
457
+ spawn(subagent: SubagentConfig): Promise<SpawnResult>;
458
+ assign(task: TaskSpec): Promise<void>;
459
+ delegate(to: string, msg: BridgeMessage): Promise<void>;
460
+ stop(subagentId: string): Promise<void>;
461
+ stopAll(): Promise<void>;
462
+ getStatus(): CoordinatorStatus;
463
+ }
464
+ interface CoordinatorStatus {
465
+ coordinatorId: string;
466
+ subagents: {
467
+ id: string;
468
+ name: string;
469
+ status: 'running' | 'idle' | 'stopped' | 'error';
470
+ currentTask?: string;
471
+ }[];
472
+ pendingTasks: number;
473
+ completedTasks: number;
474
+ totalIterations: number;
475
+ done: boolean;
476
+ }
477
+ interface SubagentContext {
478
+ subagentId: string;
479
+ tasks: TaskSpec[];
480
+ parentBridge: AgentBridge;
481
+ doneCondition: DoneCondition;
482
+ maxConcurrent: number;
483
+ }
484
+
485
+ type SpecStatus = 'draft' | 'review' | 'approved' | 'implemented' | 'deprecated';
486
+ type SpecSectionType = 'overview' | 'requirements' | 'architecture' | 'api' | 'data' | 'security' | 'acceptance';
487
+ interface SpecSection {
488
+ type: SpecSectionType;
489
+ title: string;
490
+ content: string;
491
+ level: number;
492
+ children?: SpecSection[];
493
+ }
494
+ interface SpecRequirement {
495
+ id: string;
496
+ type: 'functional' | 'non-functional' | 'security' | 'performance' | 'ux';
497
+ priority: 'critical' | 'high' | 'medium' | 'low';
498
+ description: string;
499
+ acceptanceCriteria: string[];
500
+ blockedBy?: string[];
501
+ implements?: string[];
502
+ }
503
+ interface SpecApiEndpoint {
504
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
505
+ path: string;
506
+ description: string;
507
+ request?: Record<string, unknown>;
508
+ response?: Record<string, unknown>;
509
+ auth?: boolean;
510
+ }
511
+ interface Specification {
512
+ id: string;
513
+ title: string;
514
+ version: string;
515
+ status: SpecStatus;
516
+ overview: string;
517
+ sections: SpecSection[];
518
+ requirements: SpecRequirement[];
519
+ apiEndpoints?: SpecApiEndpoint[];
520
+ dependencies?: string[];
521
+ createdAt: number;
522
+ updatedAt: number;
523
+ metadata?: Record<string, unknown>;
524
+ }
525
+ interface SpecAnalysis {
526
+ specId: string;
527
+ completeness: number;
528
+ coverage: {
529
+ requirements: number;
530
+ apiEndpoints: number;
531
+ edgeCases: number;
532
+ errorHandling: number;
533
+ };
534
+ gaps: string[];
535
+ risks: {
536
+ requirement: string;
537
+ risk: string;
538
+ severity: 'high' | 'medium' | 'low';
539
+ }[];
540
+ suggestions: string[];
541
+ }
542
+ interface SpecValidationResult {
543
+ valid: boolean;
544
+ errors: {
545
+ path: string;
546
+ message: string;
547
+ }[];
548
+ warnings: {
549
+ path: string;
550
+ message: string;
551
+ }[];
552
+ }
553
+ interface SpecTemplate {
554
+ id: string;
555
+ name: string;
556
+ description: string;
557
+ sections: Omit<SpecSection, 'content'>[];
558
+ defaultRequirements: Omit<SpecRequirement, 'id' | 'description'>[];
559
+ }
560
+ declare const DEFAULT_SPEC_TEMPLATE: SpecTemplate;
561
+
562
+ type TaskStatus = 'pending' | 'in_progress' | 'blocked' | 'failed' | 'review' | 'completed';
563
+ type TaskPriority = 'critical' | 'high' | 'medium' | 'low';
564
+ type TaskType = 'feature' | 'bugfix' | 'refactor' | 'docs' | 'test' | 'chore';
565
+ interface TaskNode {
566
+ id: string;
567
+ title: string;
568
+ description: string;
569
+ type: TaskType;
570
+ priority: TaskPriority;
571
+ status: TaskStatus;
572
+ assignee?: string;
573
+ estimateHours?: number;
574
+ actualHours?: number;
575
+ tags?: string[];
576
+ specRequirementId?: string;
577
+ parentId?: string;
578
+ children?: string[];
579
+ createdAt: number;
580
+ updatedAt: number;
581
+ completedAt?: number;
582
+ metadata?: Record<string, unknown>;
583
+ }
584
+ interface TaskEdge {
585
+ id: string;
586
+ from: string;
587
+ to: string;
588
+ type: 'blocks' | 'depends_on' | 'relates_to' | 'implements';
589
+ weight?: number;
590
+ }
591
+ interface TaskGraph {
592
+ id: string;
593
+ specId: string;
594
+ title: string;
595
+ nodes: Map<string, TaskNode>;
596
+ edges: TaskEdge[];
597
+ rootNodes: string[];
598
+ createdAt: number;
599
+ updatedAt: number;
600
+ }
601
+ interface TaskDependency {
602
+ taskId: string;
603
+ blockedBy: string[];
604
+ blocking: string[];
605
+ }
606
+ interface TaskAssignment {
607
+ taskId: string;
608
+ assignee: string;
609
+ assignedAt: number;
610
+ }
611
+ interface TaskProgress {
612
+ total: number;
613
+ pending: number;
614
+ inProgress: number;
615
+ blocked: number;
616
+ failed: number;
617
+ review: number;
618
+ completed: number;
619
+ percentComplete: number;
620
+ estimatedHours: number;
621
+ actualHours: number;
622
+ }
623
+ interface TaskFilter {
624
+ status?: TaskStatus[];
625
+ priority?: TaskPriority[];
626
+ type?: TaskType[];
627
+ assignee?: string[];
628
+ tags?: string[];
629
+ specRequirementId?: string;
630
+ }
631
+ interface TaskSort {
632
+ field: 'priority' | 'createdAt' | 'updatedAt' | 'status';
633
+ direction: 'asc' | 'desc';
634
+ }
635
+ interface CriticalPathResult {
636
+ taskIds: string[];
637
+ totalEstimateHours: number;
638
+ bottleneckTasks: string[];
639
+ }
640
+ declare function computeTaskProgress(graph: TaskGraph): TaskProgress;
641
+ declare function findCriticalPath(graph: TaskGraph): CriticalPathResult;
642
+ declare function topologicalSort(graph: TaskGraph): string[];
643
+
644
+ /**
645
+ * Input for a single tool execution, scoped to a single iteration's budget.
646
+ */
647
+ interface ToolExecution {
648
+ toolUse: ToolUseBlock;
649
+ result: ToolResultBlock;
650
+ /** True if the tool was not found in the registry. */
651
+ unknownTool?: boolean;
652
+ /** True if the tool execution threw an exception. */
653
+ threw?: boolean;
654
+ }
655
+ /**
656
+ * Output from a single tool execution.
657
+ */
658
+ interface ToolExecutionOutput {
659
+ result: ToolResultBlock;
660
+ tool?: Tool;
661
+ durationMs: number;
662
+ }
663
+ /**
664
+ * Result of running a batch of tools for a single agent iteration.
665
+ */
666
+ interface ToolBatchResult {
667
+ outputs: ToolExecutionOutput[];
668
+ remainingBudget: number;
669
+ }
670
+ interface ToolExecutorOptions {
671
+ permissionPolicy: PermissionPolicy;
672
+ secretScrubber: SecretScrubber;
673
+ renderer?: Renderer | undefined;
674
+ /**
675
+ * Optional event bus. When provided, the executor emits `tool.started`
676
+ * before invoking each tool's `execute()`. Closes the observability gap
677
+ * between "model decided to call tool" and "tool finished".
678
+ */
679
+ events?: EventBus | undefined;
680
+ iterationTimeoutMs?: number;
681
+ perIterationOutputCapBytes?: number;
682
+ }
683
+ interface ToolExecutorInit {
684
+ registry: ToolRegistry;
685
+ options: ToolExecutorOptions;
686
+ }
687
+ type ToolExecutorStrategy = 'parallel' | 'sequential' | 'smart';
688
+
689
+ export { type TaskProgress as $, type AddAttachmentInput as A, type BridgeMessage as B, type CoordinatorEvents as C, DEFAULT_MODES as D, ENCRYPTED_PREFIX as E, type SpecAnalysis as F, type SpecApiEndpoint as G, type SpecRequirement as H, type SpecSection as I, type SpecSectionType as J, type SpecStatus as K, type SpecTemplate as L, type MCPRegistryView as M, type SpecValidationResult as N, type Specification as O, type Plugin as P, type SubagentConfig as Q, type SubagentContext as R, type SecretVault as S, type TaskAssignment as T, type TaskDelegation as U, type TaskDependency as V, type TaskEdge as W, type TaskFilter as X, type TaskGraph as Y, type TaskNode as Z, type TaskPriority as _, type AgentBridge as a, type TaskResult as a0, type TaskSort as a1, type TaskSpec as a2, type TaskStatus as a3, type TaskType as a4, type ToolBatchResult as a5, type ToolExecution as a6, type ToolExecutionOutput as a7, type ToolExecutorInit as a8, type ToolExecutorOptions as a9, type ToolExecutorStrategy as aa, type ToolRegistryView as ab, computeTaskProgress as ac, findCriticalPath as ad, topologicalSort as ae, ToolRegistry as af, ProviderRegistry as ag, Agent as ah, type AgentInit as ai, type AgentInput as aj, type AgentPipelines as ak, DEFAULT_MAX_ITERATIONS as al, type ProviderFactory$1 as am, type RunResult as an, type UserInputPayload as ao, createDefaultPipelines as ap, type AgentBridgeConfig as b, type Attachment as c, type AttachmentKind as d, type AttachmentMeta as e, type AttachmentRef as f, type AttachmentStore as g, type BridgeMessageType as h, type BridgeTransport as i, type CoordinatorStatus as j, type CriticalPathResult as k, DEFAULT_SPEC_TEMPLATE as l, type DoneCondition as m, type Mode as n, type ModeConfig as o, type ModeManifest as p, type ModeStore as q, type MultiAgentConfig as r, type MultiAgentCoordinator as s, type PluginAPI as t, type PluginPipelines as u, type ProviderFactory as v, type ProviderRegistryView as w, type SlashCommand as x, type SlashCommandRegistryView as y, type SpawnResult as z };