@wrongstack/core 0.283.1 → 0.284.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/{compactor-BxddyCFu.d.ts → compactor-DQLL4HTo.d.ts} +1 -1
- package/dist/{config-DkCbA3Bw.d.ts → config-MRqn1V-u.d.ts} +130 -22
- package/dist/coordination/index.d.ts +43 -20
- package/dist/coordination/index.js +1744 -912
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-Buho8yge.d.ts → default-config-B79_gJYv.d.ts} +7 -0
- package/dist/defaults/index.d.ts +25 -29
- package/dist/defaults/index.js +2546 -7396
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-B_GPa78Q.d.ts → director-state-CMS_bMs4.d.ts} +2 -0
- package/dist/{events-KmxSmvho.d.ts → events-Bgnh43r9.d.ts} +27 -10
- package/dist/execution/index.d.ts +15 -16
- package/dist/execution/index.js +534 -140
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-rWVt8YlO.d.ts → global-mailbox-sZwyI6CS.d.ts} +13 -2
- package/dist/{goal-store-8owBXJT2.d.ts → goal-store-Datpp-ar.d.ts} +1 -1
- package/dist/hq/index.d.ts +6 -6
- package/dist/hq/index.js +58 -7
- package/dist/hq/index.js.map +1 -1
- package/dist/{index-BhCteHAF.d.ts → index--Gm41aBJ.d.ts} +26 -11
- package/dist/{index-BEFWNZYs.d.ts → index-CbyuOE5y.d.ts} +5 -1
- package/dist/index.d.ts +50 -1015
- package/dist/index.js +21028 -27775
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -7
- package/dist/infrastructure/index.js +7 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +11 -11
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BUx9A_AQ.d.ts → mcp-servers-DEV4s6Ks.d.ts} +3 -3
- package/dist/models/index.d.ts +4 -4
- package/dist/models/index.js +18 -3
- package/dist/models/index.js.map +1 -1
- package/dist/{agent-subagent-runner-BsuWhB28.d.ts → multi-agent-coordinator-4RCRZKjN.d.ts} +417 -9
- package/dist/{null-fleet-bus-D4e9R7Qc.d.ts → null-fleet-bus-CFoNVQEK.d.ts} +53 -12
- package/dist/observability/index.d.ts +3 -3
- package/dist/{parallel-eternal-engine-iY2uxocj.d.ts → parallel-eternal-engine-HUrtePLd.d.ts} +4 -5
- package/dist/{permission-B6YAtNFz.d.ts → permission-ByDKXEcG.d.ts} +1 -1
- package/dist/{pipeline-ixSFe5jg.d.ts → pipeline-DGDyIohT.d.ts} +28 -7
- package/dist/{provider-model-resolve-DIxKL_T-.d.ts → provider-model-resolve-o2hHLs79.d.ts} +3 -3
- package/dist/{provider-runner-oQhDaZmH.d.ts → provider-runner-ChL-kVg6.d.ts} +3 -3
- package/dist/{retry-policy-V67lBOJz.d.ts → retry-policy-CQ7KwXJa.d.ts} +2 -2
- package/dist/{secret-vault-D7jeyXUQ.d.ts → secret-vault-DxohkUBc.d.ts} +3 -2
- package/dist/security/index.d.ts +4 -4
- package/dist/security/index.js +232 -2
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-Bx2HgUkU.d.ts → selector-D8O6B_Rm.d.ts} +1 -1
- package/dist/{session-event-bridge-Bkp7ORfc.d.ts → session-event-bridge-D_z_mBwk.d.ts} +3 -3
- package/dist/{session-reader-B-Fi9L6I.d.ts → session-reader-7Esxrkpw.d.ts} +1 -1
- package/dist/storage/index.d.ts +77 -39
- package/dist/storage/index.js +1223 -288
- package/dist/storage/index.js.map +1 -1
- package/dist/tasking/index.d.ts +124 -0
- package/dist/tasking/index.js +492 -0
- package/dist/tasking/index.js.map +1 -0
- package/dist/{todos-checkpoint-BwCrj4Cb.d.ts → todos-checkpoint-FY7PjmMx.d.ts} +13 -4
- package/dist/{tool-LVSLiE1s.d.ts → tool-BNlnIJvo.d.ts} +216 -17
- package/dist/{tool-executor-kElSEgO0.d.ts → tool-executor-CckSCM5E.d.ts} +12 -15
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +94 -19
- package/dist/types/index.js +76 -12
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +44 -10
- package/dist/utils/index.js +106 -17
- package/dist/utils/index.js.map +1 -1
- package/dist/{worktree-manager-BjyAW30D.d.ts → worktree-manager-DzwxKE35.d.ts} +1 -1
- package/instructions/coordination/subagent-baseline.md +5 -0
- package/instructions/llm/autonomy-brain.md +3 -2
- package/instructions/system.md +4 -0
- package/package.json +10 -3
- package/dist/multi-agent-coordinator-CrjeTB9i.d.ts +0 -357
- package/dist/sdd/index.d.ts +0 -1993
- package/dist/sdd/index.js +0 -9500
- package/dist/sdd/index.js.map +0 -1
- package/dist/spec-TBi3Jr6T.d.ts +0 -78
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { T as ToolCallPipelinePayload, a as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, b as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, c as ToolExecutorLike, d as AgentInit, e as AgentInput,
|
|
2
|
-
import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-
|
|
3
|
-
import { E as EventBus, a as EventName, L as Listener } from './events-
|
|
4
|
-
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-
|
|
1
|
+
import { T as ToolCallPipelinePayload, a as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, b as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, c as ToolExecutorLike, R as ResolvedLoopDetectionConfig, d as AgentInit, e as AgentInput, f as RunResult } from './index--Gm41aBJ.js';
|
|
2
|
+
import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-DGDyIohT.js';
|
|
3
|
+
import { E as EventBus, a as EventName, L as Listener } from './events-Bgnh43r9.js';
|
|
4
|
+
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-CQ7KwXJa.js';
|
|
5
5
|
import { L as Logger } from './logger-B63L5bTg.js';
|
|
6
6
|
import { T as Tracer } from './observability-D-HZN_mF.js';
|
|
7
|
-
import { P as PermissionPolicy } from './permission-
|
|
8
|
-
import { d as Context, J as JSONSchema, c as Request, e as Response, i as ContentBlock, s as TextBlock, g as Tool, P as Provider, t as RunOptions, U as Usage } from './tool-
|
|
9
|
-
import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, C as Config, M as ModelsRegistry, h as ModelRuntimeConfig } from './config-DkCbA3Bw.js';
|
|
7
|
+
import { P as PermissionPolicy } from './permission-ByDKXEcG.js';
|
|
8
|
+
import { d as Context, J as JSONSchema, c as Request, e as Response, i as ContentBlock, s as TextBlock, g as Tool, P as Provider, t as RunOptions, U as Usage } from './tool-BNlnIJvo.js';
|
|
10
9
|
import { b as Mailbox } from './mailbox-types-BGZWrYTJ.js';
|
|
10
|
+
import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, g as HookRegistrationOptions, j as Config, M as ModelsRegistry, k as ModelRuntimeConfig } from './config-MRqn1V-u.js';
|
|
11
|
+
import { EventEmitter } from 'node:events';
|
|
11
12
|
|
|
12
13
|
type BridgeMessageType = 'task' | 'result' | 'progress' | 'error' | 'heartbeat' | 'stop' | 'delegate' | 'budget_threshold';
|
|
13
14
|
interface BridgeMessage<T = unknown> {
|
|
@@ -260,7 +261,7 @@ interface PluginAPI {
|
|
|
260
261
|
* context — see `HookOutcome`. Automatically removed when the plugin is
|
|
261
262
|
* uninstalled. Returns an unregister function.
|
|
262
263
|
*/
|
|
263
|
-
registerHook(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook): () => void;
|
|
264
|
+
registerHook(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, options?: HookRegistrationOptions | undefined): () => void;
|
|
264
265
|
config: Config;
|
|
265
266
|
log: Logger;
|
|
266
267
|
/**
|
|
@@ -447,6 +448,8 @@ declare class Agent {
|
|
|
447
448
|
private readonly plugins;
|
|
448
449
|
readonly toolExecutor: ToolExecutorLike;
|
|
449
450
|
readonly autoExtendLimit: boolean;
|
|
451
|
+
/** Resolved loop-detector settings (see `tools.loopDetection`). */
|
|
452
|
+
readonly loopDetection: ResolvedLoopDetectionConfig;
|
|
450
453
|
private readonly autonomousContinue;
|
|
451
454
|
readonly tracer: Tracer | undefined;
|
|
452
455
|
readonly extensions: ExtensionRegistry;
|
|
@@ -788,6 +791,22 @@ declare class SubagentBudget {
|
|
|
788
791
|
usage(): BudgetUsage;
|
|
789
792
|
}
|
|
790
793
|
|
|
794
|
+
/** Internal, non-user-authored budget/depth inheritance for nested directors. */
|
|
795
|
+
interface SubagentSpawnLineage {
|
|
796
|
+
parentDirectorId: string;
|
|
797
|
+
/** Depth of the spawned child; root Director is depth 0. */
|
|
798
|
+
spawnDepth: number;
|
|
799
|
+
/** Hard ceiling inherited by descendants. */
|
|
800
|
+
maxSpawnDepth: number;
|
|
801
|
+
fleetBudget: {
|
|
802
|
+
maxSpawns?: number | undefined;
|
|
803
|
+
remainingSpawns?: number | undefined;
|
|
804
|
+
maxTokens?: number | undefined;
|
|
805
|
+
remainingTokens?: number | undefined;
|
|
806
|
+
maxCostUsd?: number | undefined;
|
|
807
|
+
remainingCostUsd?: number | undefined;
|
|
808
|
+
};
|
|
809
|
+
}
|
|
791
810
|
interface SubagentConfig {
|
|
792
811
|
id?: string | undefined;
|
|
793
812
|
name: string;
|
|
@@ -836,6 +855,11 @@ interface SubagentConfig {
|
|
|
836
855
|
allowedCapabilities?: readonly string[] | undefined;
|
|
837
856
|
model?: string | undefined;
|
|
838
857
|
priority?: number | undefined;
|
|
858
|
+
/**
|
|
859
|
+
* Director-authored recursion/budget inheritance. Director.spawn overwrites
|
|
860
|
+
* caller input so a model cannot forge a shallower depth or larger budget.
|
|
861
|
+
*/
|
|
862
|
+
spawnLineage?: SubagentSpawnLineage | undefined;
|
|
839
863
|
/**
|
|
840
864
|
* Working directory for this subagent's tools. Defaults to the factory's
|
|
841
865
|
* cwd. AutoPhase sets this to a per-phase git worktree so parallel phases
|
|
@@ -973,6 +997,30 @@ interface SubagentError {
|
|
|
973
997
|
stack?: string | undefined;
|
|
974
998
|
} | undefined;
|
|
975
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Bounded, best-effort work recovered before a non-successful task ended.
|
|
1002
|
+
* This is deliberately separate from `result`: callers must not mistake an
|
|
1003
|
+
* incomplete stream tail for a completed deliverable.
|
|
1004
|
+
*/
|
|
1005
|
+
interface SubagentPartialResult {
|
|
1006
|
+
/** Last useful assistant text observed, capped by the coordinator. */
|
|
1007
|
+
text: string;
|
|
1008
|
+
/** Where the snapshot came from. */
|
|
1009
|
+
source: 'stream' | 'run_result' | 'runner';
|
|
1010
|
+
capturedAt: number;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Compact machine-readable result submitted independently from the agent's
|
|
1014
|
+
* human-facing final text. Additive and optional for legacy/custom runners.
|
|
1015
|
+
*/
|
|
1016
|
+
interface SubagentStructuredReport {
|
|
1017
|
+
summary: string;
|
|
1018
|
+
findings: string[];
|
|
1019
|
+
files_examined: string[];
|
|
1020
|
+
/** 0.0 (uncertain) through 1.0 (fully verified). */
|
|
1021
|
+
confidence: number;
|
|
1022
|
+
suggested_next_steps: string[];
|
|
1023
|
+
}
|
|
976
1024
|
interface TaskResult<T = unknown> {
|
|
977
1025
|
subagentId: string;
|
|
978
1026
|
taskId: string;
|
|
@@ -983,6 +1031,10 @@ interface TaskResult<T = unknown> {
|
|
|
983
1031
|
* Prefer reading `error.kind` over substring-matching `error.message`.
|
|
984
1032
|
*/
|
|
985
1033
|
error?: SubagentError | undefined;
|
|
1034
|
+
/** Verified control-plane report, when the subagent called submit_result. */
|
|
1035
|
+
report?: SubagentStructuredReport | undefined;
|
|
1036
|
+
/** Useful incomplete work captured before timeout/abort/failure. */
|
|
1037
|
+
partial?: SubagentPartialResult | undefined;
|
|
986
1038
|
iterations: number;
|
|
987
1039
|
toolCalls: number;
|
|
988
1040
|
durationMs: number;
|
|
@@ -1131,9 +1183,12 @@ interface SubagentRunContext {
|
|
|
1131
1183
|
signal: AbortSignal;
|
|
1132
1184
|
/** Null until `setSubagentBridge` is called for this subagent. */
|
|
1133
1185
|
bridge: AgentBridge | null;
|
|
1186
|
+
/** Publish a bounded in-memory snapshot that survives timeout races. */
|
|
1187
|
+
reportProgress?: ((partial: SubagentPartialResult) => void) | undefined;
|
|
1134
1188
|
}
|
|
1135
1189
|
interface SubagentRunOutcome {
|
|
1136
1190
|
result?: unknown | undefined;
|
|
1191
|
+
report?: SubagentStructuredReport | undefined;
|
|
1137
1192
|
iterations: number;
|
|
1138
1193
|
toolCalls: number;
|
|
1139
1194
|
}
|
|
@@ -1359,4 +1414,357 @@ interface AgentRunnerOptions {
|
|
|
1359
1414
|
*/
|
|
1360
1415
|
declare function makeAgentSubagentRunner(opts: AgentRunnerOptions): SubagentRunner;
|
|
1361
1416
|
|
|
1362
|
-
|
|
1417
|
+
/**
|
|
1418
|
+
* Catalog types for the WrongStack agent fleet.
|
|
1419
|
+
*
|
|
1420
|
+
* An `AgentDefinition` bundles the runtime `SubagentConfig` (id/name/role/
|
|
1421
|
+
* prompt/tools) with two things the bare config lacks:
|
|
1422
|
+
* - a per-role `budget` tier (consumed by FLEET_ROSTER_BUDGETS), and
|
|
1423
|
+
* - dispatcher `capability` metadata (keywords + summary + phase) used by
|
|
1424
|
+
* the smart dispatcher to route a free-form task to the best agent.
|
|
1425
|
+
*
|
|
1426
|
+
* Phase files (`phase1-discovery.ts` … `phase9-meta.ts`) each export an
|
|
1427
|
+
* `AgentDefinition[]`; `index.ts` aggregates them into `AGENT_CATALOG`.
|
|
1428
|
+
* `fleet.ts` derives `FLEET_ROSTER` + `FLEET_ROSTER_BUDGETS` from the catalog.
|
|
1429
|
+
*/
|
|
1430
|
+
|
|
1431
|
+
/** Lifecycle phase grouping. Drives statusline labels + dispatcher tie-breaks. */
|
|
1432
|
+
type AgentPhase = 'discovery' | 'planning' | 'build' | 'verify' | 'review' | 'domain' | 'knowledge' | 'delivery' | 'meta';
|
|
1433
|
+
/** Per-role budget tier. Same shape as fleet.ts `FleetRosterBudget`. */
|
|
1434
|
+
interface AgentBudgetTier {
|
|
1435
|
+
timeoutMs?: number | undefined;
|
|
1436
|
+
maxIterations?: number | undefined;
|
|
1437
|
+
maxToolCalls?: number | undefined;
|
|
1438
|
+
maxTokens?: number | undefined;
|
|
1439
|
+
maxCostUsd?: number | undefined;
|
|
1440
|
+
}
|
|
1441
|
+
/** Dispatcher routing metadata. */
|
|
1442
|
+
interface AgentCapability {
|
|
1443
|
+
phase: AgentPhase;
|
|
1444
|
+
/**
|
|
1445
|
+
* One-line capability summary. Fed to the LLM dispatcher classifier as the
|
|
1446
|
+
* candidate's description, and shown to the user when explaining a routing
|
|
1447
|
+
* decision. Keep it concrete and distinct from sibling agents.
|
|
1448
|
+
*/
|
|
1449
|
+
summary: string;
|
|
1450
|
+
/**
|
|
1451
|
+
* Lowercased signal words/phrases for the heuristic dispatcher. A task whose
|
|
1452
|
+
* description contains these scores toward this agent. Order doesn't matter;
|
|
1453
|
+
* prefer specific terms ("graphql", "wcag") over generic ones ("code").
|
|
1454
|
+
*/
|
|
1455
|
+
keywords: string[];
|
|
1456
|
+
}
|
|
1457
|
+
/** A single catalog entry: runtime config + budget tier + routing metadata. */
|
|
1458
|
+
interface AgentDefinition {
|
|
1459
|
+
config: SubagentConfig;
|
|
1460
|
+
budget: AgentBudgetTier;
|
|
1461
|
+
capability: AgentCapability;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Budget tiers by workload weight. Deliberately generous — the project's
|
|
1465
|
+
* existing roster uses multi-hour ceilings to avoid spurious timeouts on
|
|
1466
|
+
* monorepo-scale work, and the auto-extend handshake raises them further when
|
|
1467
|
+
* a subagent is still making progress.
|
|
1468
|
+
*/
|
|
1469
|
+
declare const LIGHT_BUDGET: AgentBudgetTier;
|
|
1470
|
+
declare const MEDIUM_BUDGET: AgentBudgetTier;
|
|
1471
|
+
declare const HEAVY_BUDGET: AgentBudgetTier;
|
|
1472
|
+
/**
|
|
1473
|
+
* Tool allowlist presets. Agents pass the smallest set that covers their job —
|
|
1474
|
+
* a planning agent should not hold `write`/`bash`, a reviewer should be
|
|
1475
|
+
* read-only. Spread + extend per-agent where a role needs one extra tool.
|
|
1476
|
+
*/
|
|
1477
|
+
declare const TOOLS: {
|
|
1478
|
+
/** Pure read/inspect — safe for analysis and review agents. */
|
|
1479
|
+
readonly read: readonly ["read", "grep", "glob", "search", "tree", "mailbox"];
|
|
1480
|
+
/** Read + structured inspection (logs, diffs, json, dependency audit). */
|
|
1481
|
+
readonly inspect: readonly ["read", "grep", "glob", "search", "tree", "json", "diff", "logs", "audit", "mailbox"];
|
|
1482
|
+
/** Read + edit (no shell). For agents that write code/docs but don't run it. */
|
|
1483
|
+
readonly write: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "replace", "patch", "mailbox"];
|
|
1484
|
+
/** Full build loop: edit + run (lint/format/typecheck/test/bash). */
|
|
1485
|
+
readonly build: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "replace", "patch", "bash", "exec", "lint", "format", "typecheck", "test", "mailbox"];
|
|
1486
|
+
/** Version control. */
|
|
1487
|
+
readonly vcs: readonly ["read", "grep", "glob", "git", "diff"];
|
|
1488
|
+
/** Dependency management + CVE audit. */
|
|
1489
|
+
readonly deps: readonly ["read", "grep", "glob", "install", "outdated", "audit", "json", "mailbox"];
|
|
1490
|
+
/** Documentation authoring. */
|
|
1491
|
+
readonly docs: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "document", "mailbox"];
|
|
1492
|
+
/** Web research. */
|
|
1493
|
+
readonly research: readonly ["read", "grep", "glob", "search", "fetch", "mailbox"];
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Smart agent dispatcher.
|
|
1498
|
+
*
|
|
1499
|
+
* Routes a free-form task description to the best agent in the catalog using a
|
|
1500
|
+
* two-stage strategy:
|
|
1501
|
+
*
|
|
1502
|
+
* 1. Heuristic — keyword/phrase scoring against each agent's `capability`
|
|
1503
|
+
* metadata. Deterministic, instant, no provider call. Multi-word phrases
|
|
1504
|
+
* score higher than single words (they're more specific signals).
|
|
1505
|
+
*
|
|
1506
|
+
* 2. LLM fallback — when the heuristic is ambiguous (confidence below the
|
|
1507
|
+
* threshold, or no keyword hit at all) an injected `classifier` resolves
|
|
1508
|
+
* the tie. The classifier is provider-agnostic: callers wire it to any
|
|
1509
|
+
* `complete(prompt) => text` function via `makeLLMClassifier`, so core
|
|
1510
|
+
* stays free of provider dependencies and the path is unit-testable.
|
|
1511
|
+
*
|
|
1512
|
+
* If neither stage yields a confident pick, the dispatcher falls back to the
|
|
1513
|
+
* `executor` generalist rather than failing.
|
|
1514
|
+
*/
|
|
1515
|
+
|
|
1516
|
+
/** Default agent used when nothing else matches — the generalist builder. */
|
|
1517
|
+
declare const DEFAULT_DISPATCH_ROLE = "executor";
|
|
1518
|
+
interface DispatchCandidate {
|
|
1519
|
+
role: string;
|
|
1520
|
+
name: string;
|
|
1521
|
+
score: number;
|
|
1522
|
+
/** Capability keywords that matched the task text. */
|
|
1523
|
+
matched: string[];
|
|
1524
|
+
}
|
|
1525
|
+
type DispatchMethod = 'heuristic' | 'llm' | 'fallback';
|
|
1526
|
+
interface DispatchResult {
|
|
1527
|
+
role: string;
|
|
1528
|
+
definition: AgentDefinition;
|
|
1529
|
+
/** 0..1 — heuristic margin, or 1 when an LLM made a definite choice. */
|
|
1530
|
+
confidence: number;
|
|
1531
|
+
method: DispatchMethod;
|
|
1532
|
+
/** Human-readable explanation of why this agent was chosen. */
|
|
1533
|
+
reason: string;
|
|
1534
|
+
/** Runner-up candidates (top heuristic scorers), best-first. */
|
|
1535
|
+
alternatives: DispatchCandidate[];
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Provider-agnostic classifier seam. Given the task and the candidate agents
|
|
1539
|
+
* (role + summary), return the chosen role (and optional reason), or null to
|
|
1540
|
+
* decline. Wire via `makeLLMClassifier`.
|
|
1541
|
+
*/
|
|
1542
|
+
type DispatchClassifier = (task: string, candidates: {
|
|
1543
|
+
role: string;
|
|
1544
|
+
name: string;
|
|
1545
|
+
summary: string;
|
|
1546
|
+
}[]) => Promise<{
|
|
1547
|
+
role: string;
|
|
1548
|
+
reason?: string | undefined;
|
|
1549
|
+
} | null>;
|
|
1550
|
+
interface DispatchOptions {
|
|
1551
|
+
/** Optional LLM fallback for ambiguous tasks. */
|
|
1552
|
+
classifier?: DispatchClassifier | undefined;
|
|
1553
|
+
/** Heuristic confidence below this triggers the classifier. Default 0.4. */
|
|
1554
|
+
confidenceThreshold?: number | undefined;
|
|
1555
|
+
/** How many top candidates to offer the classifier. Default 6. */
|
|
1556
|
+
maxCandidates?: number | undefined;
|
|
1557
|
+
/** Override the catalog (testing). Defaults to the full `AGENT_CATALOG`. */
|
|
1558
|
+
catalog?: Record<string, AgentDefinition> | undefined;
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Score every agent against the task. A keyword hit adds 1 point; a multi-word
|
|
1562
|
+
* keyword phrase adds points equal to its word count (more specific = stronger
|
|
1563
|
+
* signal). Returns candidates sorted best-first, zero-score agents dropped.
|
|
1564
|
+
*/
|
|
1565
|
+
declare function scoreAgents(task: string, catalog?: Record<string, AgentDefinition>): DispatchCandidate[];
|
|
1566
|
+
/**
|
|
1567
|
+
* Route a task to the best agent. Async because the LLM fallback may run; the
|
|
1568
|
+
* pure-heuristic path resolves without awaiting anything.
|
|
1569
|
+
*/
|
|
1570
|
+
declare function dispatchAgent(task: string, opts?: DispatchOptions): Promise<DispatchResult>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Build a `DispatchClassifier` from a minimal `complete(prompt) => text`
|
|
1573
|
+
* function. The caller supplies the provider call; this owns the prompt and
|
|
1574
|
+
* the parsing. Keeps `dispatcher` free of any provider import.
|
|
1575
|
+
*/
|
|
1576
|
+
declare function makeLLMClassifier(complete: (prompt: string) => Promise<string>): DispatchClassifier;
|
|
1577
|
+
|
|
1578
|
+
interface MultiAgentCoordinatorOptions {
|
|
1579
|
+
/**
|
|
1580
|
+
* Callback that executes a task on behalf of a subagent. Required for
|
|
1581
|
+
* `assign()` to actually run anything — without it, tasks queue forever.
|
|
1582
|
+
* The coordinator provides per-subagent isolation (own budget, own signal,
|
|
1583
|
+
* own bridge) and enforces timeout + concurrency.
|
|
1584
|
+
*/
|
|
1585
|
+
runner?: SubagentRunner | undefined;
|
|
1586
|
+
/**
|
|
1587
|
+
* Session id for EventBus/FleetBus emissions produced by this coordinator.
|
|
1588
|
+
* Accepts a getter so a long-lived coordinator follows session resume/new.
|
|
1589
|
+
*/
|
|
1590
|
+
sessionId?: BudgetSessionIdSource | undefined;
|
|
1591
|
+
}
|
|
1592
|
+
declare class DefaultMultiAgentCoordinator extends EventEmitter implements MultiAgentCoordinator {
|
|
1593
|
+
readonly coordinatorId: string;
|
|
1594
|
+
readonly config: MultiAgentConfig;
|
|
1595
|
+
private runner?;
|
|
1596
|
+
private readonly sessionId;
|
|
1597
|
+
private fleetBus?;
|
|
1598
|
+
private readonly subagents;
|
|
1599
|
+
/**
|
|
1600
|
+
* Base nickname keys already handed out this run (e.g. `einstein`, `tesla`).
|
|
1601
|
+
* Prevents two workers sharing a name. Direct `coordinator.spawn()` callers
|
|
1602
|
+
* (parallel/eternal engine, SDD parallel run) don't go through
|
|
1603
|
+
* `Director.spawn()` where nicknames are normally assigned, so the
|
|
1604
|
+
* coordinator upgrades placeholder names ("Executor", "slot-ab12cd", role
|
|
1605
|
+
* names) to memorable ones here — that's what surfaces in the fleet monitor.
|
|
1606
|
+
*/
|
|
1607
|
+
private readonly usedNicknames;
|
|
1608
|
+
/** Maps subagentId → nickname key (e.g. 'einstein'). Used to free the slot on remove(). */
|
|
1609
|
+
private readonly subagentNicknames;
|
|
1610
|
+
private pendingTasks;
|
|
1611
|
+
private completedResults;
|
|
1612
|
+
/** Prevents completedResults from growing unbounded in long-running coordinators. */
|
|
1613
|
+
private static readonly MAX_COMPLETED_RESULTS;
|
|
1614
|
+
private totalIterations;
|
|
1615
|
+
private inFlight;
|
|
1616
|
+
/**
|
|
1617
|
+
* Subagents currently being stopped. Set on entry to `stop()`, cleared
|
|
1618
|
+
* once `recordCompletion` lands the terminal TaskResult. Used by
|
|
1619
|
+
* `runDispatched` and `findIdleSubagent` to refuse mid-flight dispatch
|
|
1620
|
+
* to a subagent the caller has already asked to terminate — closes the
|
|
1621
|
+
* assign+terminate race where a fresh task could land on a worker that
|
|
1622
|
+
* was about to be killed.
|
|
1623
|
+
*/
|
|
1624
|
+
private readonly terminating;
|
|
1625
|
+
constructor(config: MultiAgentConfig, options?: MultiAgentCoordinatorOptions);
|
|
1626
|
+
private currentSessionId;
|
|
1627
|
+
/**
|
|
1628
|
+
* Replace the runner after construction. Used when the runner depends
|
|
1629
|
+
* on infrastructure (e.g. FleetBus) that isn't available until after
|
|
1630
|
+
* the coordinator's owning Director is built.
|
|
1631
|
+
*/
|
|
1632
|
+
setRunner(runner: SubagentRunner): void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Wire a FleetBus for director-mode event emission. Call after the
|
|
1635
|
+
* FleetManager is constructed so the coordinator can emit lifecycle
|
|
1636
|
+
* events the TUI and monitoring tools subscribe to.
|
|
1637
|
+
*/
|
|
1638
|
+
setFleetBus(fleet: FleetBus): void;
|
|
1639
|
+
/**
|
|
1640
|
+
* Change the in-flight dispatch ceiling at runtime. Lowering does NOT
|
|
1641
|
+
* preempt running tasks — already-dispatched subagents finish their
|
|
1642
|
+
* current task; only future dispatches respect the new cap. Raising
|
|
1643
|
+
* immediately tries to fill the freed slots from the pending queue.
|
|
1644
|
+
*/
|
|
1645
|
+
setMaxConcurrent(n: number): void;
|
|
1646
|
+
/**
|
|
1647
|
+
* Upgrade a placeholder/role-derived name to a memorable scientist nickname
|
|
1648
|
+
* (e.g. "Einstein (Executor)"). A name is treated as a placeholder when it is
|
|
1649
|
+
* empty, equals the role (case-insensitive), is a generic default
|
|
1650
|
+
* ("subagent"/"adhoc"/"generic"), or is an auto-generated `slot-…` id.
|
|
1651
|
+
* Explicit, human-chosen names — including nicknames already assigned by
|
|
1652
|
+
* `Director.spawn()` — are left untouched, so this never double-assigns.
|
|
1653
|
+
*/
|
|
1654
|
+
private withNickname;
|
|
1655
|
+
spawn(subagent: SubagentConfig): Promise<SpawnResult>;
|
|
1656
|
+
assign(task: TaskSpec): Promise<void>;
|
|
1657
|
+
delegate(to: string, msg: BridgeMessage): Promise<void>;
|
|
1658
|
+
/**
|
|
1659
|
+
* Wire up the communication bridge for a subagent. Call after spawn() once
|
|
1660
|
+
* the caller has created the bidirectional connection.
|
|
1661
|
+
*/
|
|
1662
|
+
setSubagentBridge(subagentId: string, bridge: AgentBridge): void;
|
|
1663
|
+
stop(subagentId: string): Promise<void>;
|
|
1664
|
+
stopAll(): Promise<void>;
|
|
1665
|
+
/**
|
|
1666
|
+
* Get current coordinator stats for monitoring/debugging.
|
|
1667
|
+
*/
|
|
1668
|
+
getStats(): {
|
|
1669
|
+
total: number;
|
|
1670
|
+
running: number;
|
|
1671
|
+
idle: number;
|
|
1672
|
+
stopped: number;
|
|
1673
|
+
inFlight: number;
|
|
1674
|
+
pending: number;
|
|
1675
|
+
completed: number;
|
|
1676
|
+
};
|
|
1677
|
+
/** Emit a reactive coordinator.stats event on FleetBus so the TUI can subscribe. */
|
|
1678
|
+
private emitCoordinatorStats;
|
|
1679
|
+
getStatus(): CoordinatorStatus;
|
|
1680
|
+
/** Expose snapshot of completed results — useful for callers awaiting all done. */
|
|
1681
|
+
results(): readonly TaskResult[];
|
|
1682
|
+
/** Defensive snapshot of the still-queued (not yet dispatched) tasks. */
|
|
1683
|
+
listPendingTasks(): readonly TaskSpec[];
|
|
1684
|
+
/**
|
|
1685
|
+
* Re-pin a still-PENDING task to a different subagent (`undefined` =
|
|
1686
|
+
* unpin, any idle worker may take it), then try to dispatch. Returns
|
|
1687
|
+
* `false` when the task is not in the pending queue — already
|
|
1688
|
+
* dispatched, completed, or unknown. Running tasks can never be pulled;
|
|
1689
|
+
* they can only be steered or terminated. The mutation is synchronous
|
|
1690
|
+
* (same tick as the check), so it cannot race a concurrent dispatch:
|
|
1691
|
+
* `tryDispatchNext` runs on this same call stack or a later one.
|
|
1692
|
+
*
|
|
1693
|
+
* The task keeps its id, so waiters, the report-back notifier, and
|
|
1694
|
+
* checkpoint bookkeeping resolve unchanged when it eventually completes.
|
|
1695
|
+
*/
|
|
1696
|
+
retargetPendingTask(taskId: string, subagentId: string | undefined): boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* Wait for one or more tasks to complete and return their results.
|
|
1699
|
+
* If a task is already done when called, returns immediately.
|
|
1700
|
+
* Resolves to an array in the same order as `taskIds`.
|
|
1701
|
+
*/
|
|
1702
|
+
awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
|
|
1703
|
+
/**
|
|
1704
|
+
* Wait until AT LEAST ONE of the named tasks completes. Returns every
|
|
1705
|
+
* requested result already available at that moment (drain-what's-done)
|
|
1706
|
+
* plus the ids still outstanding, so callers can loop "handle finishers,
|
|
1707
|
+
* re-await the remainder" instead of blocking on the whole batch.
|
|
1708
|
+
*
|
|
1709
|
+
* Unlike `awaitTasks`, this never rejects and deliberately does NOT
|
|
1710
|
+
* inherit `config.timeoutMs` — a "return whatever is done" call has no
|
|
1711
|
+
* business timing out unless the caller asks for a window explicitly.
|
|
1712
|
+
*/
|
|
1713
|
+
awaitTasksAny(taskIds: string[], opts?: {
|
|
1714
|
+
timeoutMs?: number;
|
|
1715
|
+
}): Promise<AwaitAnyResult>;
|
|
1716
|
+
/**
|
|
1717
|
+
* Manual completion — for callers that drive subagents without a runner
|
|
1718
|
+
* (e.g. external orchestrators). When a runner is configured the coordinator
|
|
1719
|
+
* calls this itself.
|
|
1720
|
+
*/
|
|
1721
|
+
completeTask(result: TaskResult): void;
|
|
1722
|
+
private tryDispatchNext;
|
|
1723
|
+
private canDispatch;
|
|
1724
|
+
private takeNextDispatchableTask;
|
|
1725
|
+
private findIdleSubagent;
|
|
1726
|
+
private isIdleSubagent;
|
|
1727
|
+
/**
|
|
1728
|
+
* Returns true iff at least one spawned subagent could still
|
|
1729
|
+
* process a task. A "live" subagent is one that is not stopped
|
|
1730
|
+
* AND not mid-termination — `running` workers count because they
|
|
1731
|
+
* will eventually finish and become idle.
|
|
1732
|
+
*
|
|
1733
|
+
* When no subagent has ever been spawned, returns `true` so a
|
|
1734
|
+
* pre-spawn `assign()` simply queues (legacy behaviour). The
|
|
1735
|
+
* dead-end detection only fires after `stop()` has retired every
|
|
1736
|
+
* spawned worker.
|
|
1737
|
+
*
|
|
1738
|
+
* Used by `tryDispatchNext` to detect a dead-end pending queue.
|
|
1739
|
+
*/
|
|
1740
|
+
private hasLiveSubagent;
|
|
1741
|
+
/**
|
|
1742
|
+
* Drain every pending task with a synthetic `aborted_by_parent`
|
|
1743
|
+
* completion event. Same shape as the `stopAll()` drain — we go
|
|
1744
|
+
* around `recordCompletion` because pending tasks were never
|
|
1745
|
+
* counted in `inFlight` and routing them through would trip the
|
|
1746
|
+
* underflow guard on every task after the first.
|
|
1747
|
+
*/
|
|
1748
|
+
private drainPendingAsAborted;
|
|
1749
|
+
/**
|
|
1750
|
+
* Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
|
|
1751
|
+
* PENDING task — one that was never counted in `inFlight`. This MUST bypass
|
|
1752
|
+
* `recordCompletion`: that path does `inFlight--`, which for a pending task
|
|
1753
|
+
* steals a decrement from a genuinely in-flight task and trips the underflow
|
|
1754
|
+
* guard — suppressing that real task's `task.completed` and hanging its
|
|
1755
|
+
* `awaitTasks()` caller. Pushes the result and fires the event directly.
|
|
1756
|
+
*/
|
|
1757
|
+
private emitPendingAborted;
|
|
1758
|
+
private runDispatched;
|
|
1759
|
+
private executeWithTimeout;
|
|
1760
|
+
private recordCompletion;
|
|
1761
|
+
/**
|
|
1762
|
+
* Stop a subagent and remove it from the coordinator. Releases all
|
|
1763
|
+
* associated resources (AbortController, context, budget state).
|
|
1764
|
+
* The subagent entry is deleted so the id can be reused in a future spawn.
|
|
1765
|
+
*/
|
|
1766
|
+
remove(subagentId: string): Promise<void>;
|
|
1767
|
+
private isDone;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
export { type DispatchResult as $, Agent as A, type BridgeTransport as B, type CoordinatorStatus as C, type DispatchClassifier as D, type AgentBudgetTier as E, FleetBus as F, type AgentCapability as G, type AgentFactoryResult as H, type AgentRunnerOptions as I, BudgetExceededError as J, type BudgetKind as K, type BudgetLimits as L, type MultiAgentConfig as M, type BudgetNegotiationMode as N, type BudgetThresholdDecision as O, type PluginAPI as P, type BudgetThresholdHandler as Q, BudgetThresholdSignal as R, type SubagentRunner as S, type TaskSpec as T, type BudgetUsage as U, type CoordinatorEvents as V, DECISION_TIMEOUT_MS as W, DEFAULT_DISPATCH_ROLE as X, type DispatchCandidate as Y, type DispatchMethod as Z, type DispatchOptions as _, type AgentFactory as a, type FleetEvent as a0, type FleetHandler as a1, HEAVY_BUDGET as a2, LIGHT_BUDGET as a3, MEDIUM_BUDGET as a4, type MultiAgentCoordinator as a5, type MultiAgentCoordinatorOptions as a6, type PluginLLMOptions as a7, type PluginLLMResult as a8, type SpawnResult as a9, SubagentBudget as aa, type SubagentContext as ab, type SubagentError as ac, type SubagentErrorKind as ad, type SubagentPartialResult as ae, type SubagentRunContext as af, type SubagentRunOutcome as ag, type SubagentSpawnLineage as ah, type SubagentStructuredReport as ai, type SubagentUsageSnapshot as aj, TIMEOUT_PREEMPT_FRACTION as ak, type TaskDelegation as al, dispatchAgent as am, makeAgentSubagentRunner as an, makeLLMClassifier as ao, scoreAgents as ap, withDisabledToolFiltering as aq, type ProviderFactory as ar, DefaultMultiAgentCoordinator as b, type DoneCondition as c, type BridgeMessage as d, type AgentBridge as e, type AgentBridgeConfig as f, type AgentPhase as g, type AgentDefinition as h, type SubagentConfig as i, type FleetUsage as j, FleetUsageAggregator as k, type TaskResult as l, type AwaitAnyResult as m, type SlashCommand as n, type PluginPipelines as o, type ToolRegistryView as p, type ProviderRegistryView as q, type MCPRegistryView as r, type SlashCommandRegistryView as s, type SessionWriterView as t, type MetricsSinkView as u, type PluginLLM as v, type PluginCapabilities as w, type PluginDependency as x, type Plugin as y, TOOLS as z };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { b as SessionWriter, g as Tool, k as SessionStore } from './tool-LVSLiE1s.js';
|
|
1
|
+
import { B as BridgeTransport, d as BridgeMessage, e as AgentBridge, f as AgentBridgeConfig, g as AgentPhase, h as AgentDefinition, S as SubagentRunner, T as TaskSpec, i as SubagentConfig, F as FleetBus, j as FleetUsage, k as FleetUsageAggregator, b as DefaultMultiAgentCoordinator, l as TaskResult, C as CoordinatorStatus, D as DispatchClassifier, M as MultiAgentConfig, m as AwaitAnyResult } from './multi-agent-coordinator-4RCRZKjN.js';
|
|
2
|
+
import { E as EventBus, B as BrainArbiter } from './events-Bgnh43r9.js';
|
|
3
|
+
import { b as SessionWriter, g as Tool, k as SessionStore } from './tool-BNlnIJvo.js';
|
|
5
4
|
import { EventEmitter } from 'node:events';
|
|
6
|
-
import { D as DirectorStateSnapshot } from './director-state-
|
|
7
|
-
import { F as FleetConfig, a as ModelMatrixEntry } from './config-
|
|
5
|
+
import { D as DirectorStateSnapshot } from './director-state-CMS_bMs4.js';
|
|
6
|
+
import { F as FleetConfig, a as ModelMatrixEntry } from './config-MRqn1V-u.js';
|
|
8
7
|
import { L as Logger } from './logger-B63L5bTg.js';
|
|
9
|
-
import { W as WorktreeManager } from './worktree-manager-
|
|
8
|
+
import { W as WorktreeManager } from './worktree-manager-DzwxKE35.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -188,10 +187,22 @@ interface IFleetManager {
|
|
|
188
187
|
* internally.
|
|
189
188
|
*/
|
|
190
189
|
canSpawn(config: SubagentConfig): {
|
|
191
|
-
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_context_load';
|
|
190
|
+
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_tokens' | 'max_context_load';
|
|
192
191
|
limit: number;
|
|
193
192
|
observed: number;
|
|
194
193
|
} | null;
|
|
194
|
+
/** Current fleet-wide token/cost ceiling and remaining headroom. */
|
|
195
|
+
budgetSnapshot?: (() => {
|
|
196
|
+
maxSpawns: number;
|
|
197
|
+
usedSpawns: number;
|
|
198
|
+
remainingSpawns: number;
|
|
199
|
+
maxTokens: number;
|
|
200
|
+
usedTokens: number;
|
|
201
|
+
remainingTokens: number;
|
|
202
|
+
maxCostUsd: number;
|
|
203
|
+
usedCostUsd: number;
|
|
204
|
+
remainingCostUsd: number;
|
|
205
|
+
}) | undefined;
|
|
195
206
|
/**
|
|
196
207
|
* Update the leader agent's current context pressure (tokens used in the
|
|
197
208
|
* full API request: messages + systemPrompt + toolDefs). The fleet manager
|
|
@@ -328,6 +339,7 @@ interface FleetManagerOptions {
|
|
|
328
339
|
checkpointDebounceMs?: number | undefined;
|
|
329
340
|
directorBudget?: {
|
|
330
341
|
maxCostUsd?: number | undefined;
|
|
342
|
+
maxTokens?: number | undefined;
|
|
331
343
|
} | undefined;
|
|
332
344
|
/**
|
|
333
345
|
* Maximum context load (as a fraction of maxContext) the leader agent
|
|
@@ -389,6 +401,8 @@ declare class FleetManager implements IFleetManager {
|
|
|
389
401
|
/** Fleet-wide cost cap. Infinity = no cap. Distinct from SubagentBudget limits,
|
|
390
402
|
* which track per-subagent spend — this field caps the entire fleet total. */
|
|
391
403
|
private readonly maxFleetCostUsd;
|
|
404
|
+
/** Fleet-wide input+output token ceiling. Infinity = no cap. */
|
|
405
|
+
private readonly maxFleetTokens;
|
|
392
406
|
private readonly manifestEntries;
|
|
393
407
|
/** Pending tasks with their descriptions — populated by `addPendingTask`
|
|
394
408
|
* and cleared by `removePendingTask`. Replaces the host-side `pending`
|
|
@@ -426,10 +440,21 @@ declare class FleetManager implements IFleetManager {
|
|
|
426
440
|
* how to surface the rejection.
|
|
427
441
|
*/
|
|
428
442
|
canSpawn(_config: SubagentConfig): {
|
|
429
|
-
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_context_load';
|
|
443
|
+
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_tokens' | 'max_context_load';
|
|
430
444
|
limit: number;
|
|
431
445
|
observed: number;
|
|
432
446
|
} | null;
|
|
447
|
+
budgetSnapshot(): {
|
|
448
|
+
maxSpawns: number;
|
|
449
|
+
usedSpawns: number;
|
|
450
|
+
remainingSpawns: number;
|
|
451
|
+
maxTokens: number;
|
|
452
|
+
usedTokens: number;
|
|
453
|
+
remainingTokens: number;
|
|
454
|
+
maxCostUsd: number;
|
|
455
|
+
usedCostUsd: number;
|
|
456
|
+
remainingCostUsd: number;
|
|
457
|
+
};
|
|
433
458
|
setLeaderContextPressure(tokens: number): void;
|
|
434
459
|
private resolveMaxContext;
|
|
435
460
|
/**
|
|
@@ -672,6 +697,12 @@ declare class FleetCostCapError extends Error {
|
|
|
672
697
|
readonly observed: number;
|
|
673
698
|
constructor(limit: number, observed: number);
|
|
674
699
|
}
|
|
700
|
+
declare class FleetTokenCapError extends Error {
|
|
701
|
+
readonly kind: 'max_tokens';
|
|
702
|
+
readonly limit: number;
|
|
703
|
+
readonly observed: number;
|
|
704
|
+
constructor(limit: number, observed: number);
|
|
705
|
+
}
|
|
675
706
|
|
|
676
707
|
/**
|
|
677
708
|
* Director — high-level orchestrator that owns a `MultiAgentCoordinator`,
|
|
@@ -702,6 +733,10 @@ interface TaskResultNotification {
|
|
|
702
733
|
resultText?: string | undefined;
|
|
703
734
|
/** Flattened `kind: message` error string for non-success statuses. */
|
|
704
735
|
errorText?: string | undefined;
|
|
736
|
+
/** Bounded incomplete text recovered before a non-successful exit. */
|
|
737
|
+
partialText?: string | undefined;
|
|
738
|
+
/** Machine-readable result submitted through submit_result. */
|
|
739
|
+
report?: TaskResult['report'] | undefined;
|
|
705
740
|
iterations: number;
|
|
706
741
|
toolCalls: number;
|
|
707
742
|
durationMs: number;
|
|
@@ -771,7 +806,8 @@ interface DirectorOptions {
|
|
|
771
806
|
* user is at depth `spawnDepth` (default 0); any subagent that itself
|
|
772
807
|
* acts as a director would construct its own `Director` with
|
|
773
808
|
* `spawnDepth: parent.spawnDepth + 1`. When `spawnDepth >= maxSpawnDepth`,
|
|
774
|
-
* `spawn()` rejects.
|
|
809
|
+
* `spawn()` rejects. The process-wide hard ceiling is 2; configuration can
|
|
810
|
+
* narrow it but cannot widen it. Default: 2 (root director can spawn workers; a
|
|
775
811
|
* worker that becomes a sub-director cannot itself spawn further).
|
|
776
812
|
* This stops infinite recursive director chains from a hostile or
|
|
777
813
|
* confused prompt.
|
|
@@ -829,6 +865,8 @@ interface DirectorOptions {
|
|
|
829
865
|
* Default: Infinity (no cap).
|
|
830
866
|
*/
|
|
831
867
|
maxCostUsd?: number | undefined;
|
|
868
|
+
/** Maximum cumulative input+output tokens across the fleet. */
|
|
869
|
+
maxTokens?: number | undefined;
|
|
832
870
|
} | undefined;
|
|
833
871
|
/**
|
|
834
872
|
* Maximum auto-extensions per subagent per budget kind before the
|
|
@@ -1045,6 +1083,8 @@ declare class Director implements ICoordinator {
|
|
|
1045
1083
|
private readonly manifestDebounceMs;
|
|
1046
1084
|
/** Fleet-wide cost cap (entire fleet total, distinct from SubagentBudget limits). Infinity means no cap. */
|
|
1047
1085
|
private readonly maxFleetCostUsd;
|
|
1086
|
+
/** Fleet-wide input+output token cap. Infinity means no cap. */
|
|
1087
|
+
private readonly maxFleetTokens;
|
|
1048
1088
|
/** Max auto-extensions per subagent per budget kind before denying. */
|
|
1049
1089
|
private readonly maxBudgetExtensions;
|
|
1050
1090
|
/** Sessions root for direct subagent JSONL reads (fleet tool, action: session). */
|
|
@@ -1998,7 +2038,8 @@ declare function makeFleetTool(director: Director): Tool;
|
|
|
1998
2038
|
declare function makeCollabDebugTool(director: Director): Tool;
|
|
1999
2039
|
/**
|
|
2000
2040
|
* Tool for subagents to emit structured events on the FleetBus.
|
|
2001
|
-
*
|
|
2041
|
+
* Custom event types are extensible; known collab events are schema-validated
|
|
2042
|
+
* and restricted to their owning role before the Director routes them.
|
|
2002
2043
|
* Common event types in collaborative sessions:
|
|
2003
2044
|
* bug.found — BugHunter emits per-finding
|
|
2004
2045
|
* refactor.plan — RefactorPlanner emits per-plan
|
|
@@ -2083,4 +2124,4 @@ declare const FLEET_ROSTER_WITHACP: Record<string, SubagentConfig>;
|
|
|
2083
2124
|
*/
|
|
2084
2125
|
declare const NULL_FLEET_BUS: FleetBus;
|
|
2085
2126
|
|
|
2086
|
-
export {
|
|
2127
|
+
export { WorktreeIntegrationError as $, ACP_AGENTS as A, BUG_HUNTER_AGENT as B, type CollabBudgetConfig as C, DEFAULT_DIRECTOR_PREAMBLE as D, FLEET_ROSTER_WITHACP as E, FLEET_ROSTER as F, FleetCostCapError as G, FleetManager as H, type FleetManagerOptions as I, type FleetRosterBudget as J, FleetSpawnBudgetError as K, FleetTokenCapError as L, type FleetWorktreePolicy as M, type ICoordinator as N, type IFleetManager as O, InMemoryAgentBridge as P, InMemoryBridgeTransport as Q, LargeAnswerStore as R, NULL_FLEET_BUS as S, REFACTOR_PLANNER_AGENT as T, type RefactorPhase as U, type RefactorPlan as V, SECURITY_SCANNER_AGENT as W, type SharedFileEntry as X, type SharedFileSnapshot as Y, type SubagentPromptParts as Z, type TaskResultNotification as _, AGENTS_BY_PHASE as a, type WorktreeIsolationDecision as a0, type WorktreeTaskRunnerOptions as a1, type WorktreeTaskStateUpdate as a2, applyRosterBudget as a3, attachAutoExtend as a4, composeDirectorPrompt as a5, composeSubagentPrompt as a6, createDelegateTool as a7, createMessage as a8, getAgentDefinition as a9, makeAskResultTool as aa, makeAskTool as ab, makeAssignTool as ac, makeAwaitTasksTool as ad, makeCollabDebugTool as ae, makeDirectorSessionFactory as af, makeFleetEmitTool as ag, makeFleetTool as ah, makeKanbanQueueTool as ai, makeQualityGateTool as aj, makeRollUpTool as ak, makeSpawnTool as al, makeTerminateAllTool as am, makeTerminateTool as an, makeWorkCompleteTool as ao, resolveSubagentWorktreeDecision as ap, rosterSummaryFromConfigs as aq, subagentNeedsWorktree as ar, wrapSubagentRunnerWithWorktrees as as, AGENT_CATALOG as b, ALL_AGENT_DEFINITIONS as c, ALL_FLEET_AGENTS as d, AUDIT_LOG_AGENT as e, type AutoExtendCeiling as f, type AutoExtendPolicy as g, type BugFinding as h, type CollabBudgetOverrides as i, type CollabBudgetWarningPayload as j, type CollabDebugReport as k, CollabSession as l, type CollabSessionOptions as m, type CreateDelegateToolOptions as n, type CriticConcern as o, type CriticEvaluation as p, DEFAULT_SUBAGENT_BASELINE as q, type DelegateHost as r, Director as s, type DirectorAlert as t, DirectorAlertLevel as u, type DirectorCancelCollabPayload as v, type DirectorPromptParts as w, type DirectorSessionFactory as x, type DirectorSessionFactoryOptions as y, FLEET_ROSTER_BUDGETS as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { M as MetricsSink, d as MetricLabels, f as MetricsSnapshot, H as HealthRegistry, a as HealthCheck, A as AggregateHealth, T as Tracer, S as Span } from '../observability-D-HZN_mF.js';
|
|
2
|
-
import { E as EventBus } from '../events-
|
|
3
|
-
import '../tool-
|
|
4
|
-
import '../permission-
|
|
2
|
+
import { E as EventBus } from '../events-Bgnh43r9.js';
|
|
3
|
+
import '../tool-BNlnIJvo.js';
|
|
4
|
+
import '../permission-ByDKXEcG.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* In-memory metrics sink. Suitable for embedded use, tests, and /metrics
|