@wrongstack/core 0.41.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-D_XcS2HL.d.ts → agent-bridge-Dnhw4tnM.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C66vi4Gq.d.ts → agent-subagent-runner-By7jruZ_.d.ts} +3 -3
- package/dist/{compactor-D1RHFRmF.d.ts → compactor-Duhsf0ge.d.ts} +1 -1
- package/dist/{config-ZRCf7sTu.d.ts → config-bht0txXS.d.ts} +33 -2
- package/dist/{context-7u93AcGD.d.ts → context-DtPKqKYV.d.ts} +1 -0
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js +234 -32
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +23 -23
- package/dist/defaults/index.js +182 -75
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BrQiweXN.d.ts → events-CbHTS4ZZ.d.ts} +136 -2
- package/dist/execution/index.d.ts +42 -16
- package/dist/execution/index.js +61 -28
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{goal-store-BeRsj7YX.d.ts → goal-store-DwcTDDiX.d.ts} +1 -1
- package/dist/{index-6_csX32J.d.ts → index-CI271MjL.d.ts} +5 -5
- package/dist/{index-DkVgH3wC.d.ts → index-ge5F2dnc.d.ts} +10 -8
- package/dist/index.d.ts +113 -37
- package/dist/index.js +601 -149
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DONdo-XM.d.ts → mcp-servers-DE6gzBry.d.ts} +3 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +36 -18
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-gwMAo6E3.d.ts → models-registry-Cuq1C8V9.d.ts} +7 -0
- package/dist/{multi-agent-C8Z1i__e.d.ts → multi-agent-BmC_xiog.d.ts} +2 -2
- package/dist/{multi-agent-coordinator-BUsjiRWl.d.ts → multi-agent-coordinator-CjNX4uBD.d.ts} +2 -2
- package/dist/{null-fleet-bus-FvgHnZah.d.ts → null-fleet-bus-BNiSlTna.d.ts} +23 -11
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-DumKAi0n.d.ts → path-resolver-Bax85amb.d.ts} +2 -2
- package/dist/{permission-B6sldrSp.d.ts → permission-Drm7LpPo.d.ts} +1 -1
- package/dist/{permission-policy-CtNscWOA.d.ts → permission-policy-CU6sqWxF.d.ts} +2 -2
- package/dist/{plan-templates-DYCeRCDN.d.ts → plan-templates-CLRcurWN.d.ts} +4 -4
- package/dist/{provider-runner-Dlv8Fvw9.d.ts → provider-runner-BikCxGCx.d.ts} +3 -3
- package/dist/{retry-policy-KF18W4dg.d.ts → retry-policy-Chtlvr5b.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-DmXxpFyM.d.ts → selector-BvSPdJj6.d.ts} +1 -1
- package/dist/{session-reader-bfgsy2a0.d.ts → session-reader-BGhzMir4.d.ts} +1 -1
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/index.js +57 -37
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CM6zOhd2.d.ts → system-prompt-dtzV_mLm.d.ts} +1 -1
- package/dist/{tool-executor-BpK-SWtJ.d.ts → tool-executor-CgU0yWpB.d.ts} +4 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/types/index.js +36 -18
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +14 -2
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,106 @@
|
|
|
1
|
-
import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-
|
|
1
|
+
import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-DtPKqKYV.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Brain coordination primitives.
|
|
5
|
+
*
|
|
6
|
+
* Brain is an authority layer above a leader/director but below the human. It is
|
|
7
|
+
* intentionally modeled as a decision interface first, not as an autonomous
|
|
8
|
+
* bypass: callers ask for a decision, Brain either answers within policy or
|
|
9
|
+
* escalates to the human.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
type BrainDecisionSource = 'autophase' | 'director' | 'tool' | 'user' | 'system';
|
|
13
|
+
type BrainRisk = 'low' | 'medium' | 'high' | 'critical';
|
|
14
|
+
type BrainFallback = 'ask_human' | 'deny' | 'continue';
|
|
15
|
+
interface BrainDecisionOption {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
consequence?: string;
|
|
19
|
+
risk?: BrainRisk;
|
|
20
|
+
recommended?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface BrainDecisionRequest {
|
|
23
|
+
id: string;
|
|
24
|
+
source: BrainDecisionSource;
|
|
25
|
+
question: string;
|
|
26
|
+
context?: string;
|
|
27
|
+
options?: BrainDecisionOption[];
|
|
28
|
+
risk: BrainRisk;
|
|
29
|
+
/** What a non-LLM/default Brain should do when policy cannot decide safely. */
|
|
30
|
+
fallback: BrainFallback;
|
|
31
|
+
}
|
|
32
|
+
type BrainDecision = {
|
|
33
|
+
type: 'answer';
|
|
34
|
+
optionId?: string;
|
|
35
|
+
text: string;
|
|
36
|
+
rationale?: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'ask_human';
|
|
39
|
+
prompt: string;
|
|
40
|
+
options?: BrainDecisionOption[];
|
|
41
|
+
rationale?: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'deny';
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
46
|
+
interface BrainArbiter {
|
|
47
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Event-emitting decorator for any Brain implementation. Hosts wire this around
|
|
51
|
+
* their actual arbiter so TUI/session surfaces can render Brain decisions
|
|
52
|
+
* without coupling to the caller that requested the decision.
|
|
53
|
+
*/
|
|
54
|
+
declare class ObservableBrainArbiter implements BrainArbiter {
|
|
55
|
+
private readonly inner;
|
|
56
|
+
private readonly events;
|
|
57
|
+
constructor(inner: BrainArbiter, events: EventBus);
|
|
58
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
59
|
+
}
|
|
60
|
+
interface BrainDecisionQueueOptions {
|
|
61
|
+
/** Safety fallback if the human never answers. Default: no timeout. */
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Bridge between an `ask_human` Brain decision and the UI. It emits the visible
|
|
66
|
+
* ask-human event, then resolves when the TUI emits `brain.human_answered`.
|
|
67
|
+
*/
|
|
68
|
+
declare class BrainDecisionQueue {
|
|
69
|
+
private readonly events;
|
|
70
|
+
private readonly opts;
|
|
71
|
+
private readonly pending;
|
|
72
|
+
private readonly offAnswer;
|
|
73
|
+
constructor(events: EventBus, opts?: BrainDecisionQueueOptions);
|
|
74
|
+
requestHumanDecision(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
75
|
+
dispose(): void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Decorator that turns `ask_human` into an actual awaited human decision.
|
|
79
|
+
* The wrapped Brain remains policy-only; this layer owns the UI/event bridge.
|
|
80
|
+
*/
|
|
81
|
+
declare class HumanEscalatingBrainArbiter implements BrainArbiter {
|
|
82
|
+
private readonly inner;
|
|
83
|
+
private readonly queue;
|
|
84
|
+
constructor(inner: BrainArbiter, queue: BrainDecisionQueue);
|
|
85
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
86
|
+
}
|
|
87
|
+
interface DefaultBrainArbiterOptions {
|
|
88
|
+
/** Allow deterministic auto-answering for low-risk requests. Default true. */
|
|
89
|
+
allowLowRiskAutoAnswer?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Conservative deterministic Brain implementation.
|
|
93
|
+
*
|
|
94
|
+
* It only auto-answers low-risk requests when the caller provided a recommended
|
|
95
|
+
* option. Everything else follows the request fallback. This gives hosts a safe
|
|
96
|
+
* policy object to wire before an LLM-backed Brain exists.
|
|
97
|
+
*/
|
|
98
|
+
declare class DefaultBrainArbiter implements BrainArbiter {
|
|
99
|
+
private readonly allowLowRiskAutoAnswer;
|
|
100
|
+
constructor(opts?: DefaultBrainArbiterOptions);
|
|
101
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
102
|
+
}
|
|
103
|
+
declare function formatHumanPrompt(request: BrainDecisionRequest): string;
|
|
2
104
|
|
|
3
105
|
/**
|
|
4
106
|
* EventBus — observe-only typed event bus.
|
|
@@ -6,6 +108,32 @@ import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './c
|
|
|
6
108
|
*/
|
|
7
109
|
|
|
8
110
|
interface EventMap {
|
|
111
|
+
'brain.decision_requested': {
|
|
112
|
+
request: BrainDecisionRequest;
|
|
113
|
+
at: number;
|
|
114
|
+
};
|
|
115
|
+
'brain.decision_answered': {
|
|
116
|
+
request: BrainDecisionRequest;
|
|
117
|
+
decision: BrainDecision;
|
|
118
|
+
at: number;
|
|
119
|
+
};
|
|
120
|
+
'brain.decision_ask_human': {
|
|
121
|
+
request: BrainDecisionRequest;
|
|
122
|
+
decision: BrainDecision;
|
|
123
|
+
at: number;
|
|
124
|
+
};
|
|
125
|
+
'brain.human_answered': {
|
|
126
|
+
id: string;
|
|
127
|
+
optionId?: string;
|
|
128
|
+
deny?: boolean;
|
|
129
|
+
text?: string;
|
|
130
|
+
at: number;
|
|
131
|
+
};
|
|
132
|
+
'brain.decision_denied': {
|
|
133
|
+
request: BrainDecisionRequest;
|
|
134
|
+
decision: BrainDecision;
|
|
135
|
+
at: number;
|
|
136
|
+
};
|
|
9
137
|
'session.started': {
|
|
10
138
|
id: string;
|
|
11
139
|
};
|
|
@@ -174,6 +302,12 @@ interface EventMap {
|
|
|
174
302
|
/** Provider's max context window. */
|
|
175
303
|
maxContext: number;
|
|
176
304
|
};
|
|
305
|
+
/** Fired when the active model's resolved context window changes. */
|
|
306
|
+
'ctx.max_context': {
|
|
307
|
+
providerId: string;
|
|
308
|
+
modelId: string;
|
|
309
|
+
maxContext: number;
|
|
310
|
+
};
|
|
177
311
|
'token.threshold': {
|
|
178
312
|
used: number;
|
|
179
313
|
limit: number;
|
|
@@ -654,4 +788,4 @@ declare class ScopedEventBus extends EventBus {
|
|
|
654
788
|
get scopedListenerCount(): number;
|
|
655
789
|
}
|
|
656
790
|
|
|
657
|
-
export { EventBus as E, type Listener as L, ScopedEventBus as S, type
|
|
791
|
+
export { type BrainArbiter as B, DefaultBrainArbiter as D, EventBus as E, HumanEscalatingBrainArbiter as H, type Listener as L, ObservableBrainArbiter as O, ScopedEventBus as S, type BrainDecision as a, type BrainDecisionOption as b, BrainDecisionQueue as c, type BrainDecisionRequest as d, type BrainDecisionSource as e, type BrainFallback as f, type BrainRisk as g, type DefaultBrainArbiterOptions as h, type EventLogger as i, type EventMap as j, type EventName as k, formatHumanPrompt as l };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
2
|
-
import { m as Provider, d as Context } from '../context-
|
|
3
|
-
import { a as Compactor, C as CompactReport } from '../compactor-
|
|
4
|
-
import { M as MessageSelector } from '../selector-
|
|
5
|
-
import { E as EventBus } from '../events-
|
|
6
|
-
import { b as MiddlewareHandler } from '../system-prompt-
|
|
7
|
-
import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-
|
|
8
|
-
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-
|
|
9
|
-
import { c as Agent, R as RunResult, w as SystemPromptContributor } from '../index-
|
|
10
|
-
import { D as DoneCondition } from '../multi-agent-
|
|
11
|
-
import { A as AgentFactory } from '../agent-subagent-runner-
|
|
12
|
-
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-
|
|
1
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CgU0yWpB.js';
|
|
2
|
+
import { m as Provider, d as Context } from '../context-DtPKqKYV.js';
|
|
3
|
+
import { a as Compactor, C as CompactReport } from '../compactor-Duhsf0ge.js';
|
|
4
|
+
import { M as MessageSelector } from '../selector-BvSPdJj6.js';
|
|
5
|
+
import { E as EventBus } from '../events-CbHTS4ZZ.js';
|
|
6
|
+
import { b as MiddlewareHandler } from '../system-prompt-dtzV_mLm.js';
|
|
7
|
+
import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-DwcTDDiX.js';
|
|
8
|
+
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-bht0txXS.js';
|
|
9
|
+
import { c as Agent, R as RunResult, w as SystemPromptContributor } from '../index-CI271MjL.js';
|
|
10
|
+
import { D as DoneCondition } from '../multi-agent-BmC_xiog.js';
|
|
11
|
+
import { A as AgentFactory } from '../agent-subagent-runner-By7jruZ_.js';
|
|
12
|
+
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-CjNX4uBD.js';
|
|
13
13
|
import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
|
|
14
14
|
import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
|
|
15
|
-
import '../retry-policy-
|
|
15
|
+
import '../retry-policy-Chtlvr5b.js';
|
|
16
16
|
import '../models-registry-BcYJDKLm.js';
|
|
17
17
|
import '../logger-DDd5C--Z.js';
|
|
18
18
|
import '../observability-BhnVLBLS.js';
|
|
19
19
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
20
|
-
import '../permission-
|
|
20
|
+
import '../permission-Drm7LpPo.js';
|
|
21
21
|
import 'node:events';
|
|
22
22
|
|
|
23
23
|
interface SkillLoaderOptions {
|
|
@@ -566,6 +566,30 @@ declare class EternalAutonomyEngine {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
type ParallelEngineState = 'idle' | 'running' | 'stopped';
|
|
569
|
+
type ParallelIterationStage = {
|
|
570
|
+
phase: 'idle';
|
|
571
|
+
} | {
|
|
572
|
+
phase: 'decompose';
|
|
573
|
+
} | {
|
|
574
|
+
phase: 'fanout';
|
|
575
|
+
slots: number;
|
|
576
|
+
} | {
|
|
577
|
+
phase: 'await';
|
|
578
|
+
taskIds: string[];
|
|
579
|
+
} | {
|
|
580
|
+
phase: 'aggregate';
|
|
581
|
+
successCount: number;
|
|
582
|
+
total: number;
|
|
583
|
+
goalComplete: boolean;
|
|
584
|
+
} | {
|
|
585
|
+
phase: 'sleep';
|
|
586
|
+
ms: number;
|
|
587
|
+
} | {
|
|
588
|
+
phase: 'stopped';
|
|
589
|
+
} | {
|
|
590
|
+
phase: 'error';
|
|
591
|
+
message: string;
|
|
592
|
+
};
|
|
569
593
|
interface ParallelEternalOptions {
|
|
570
594
|
/** The coordinating agent — NOT a subagent. Owns container/tools/providers. */
|
|
571
595
|
agent: Agent;
|
|
@@ -586,6 +610,8 @@ interface ParallelEternalOptions {
|
|
|
586
610
|
iterationTimeoutMs?: number;
|
|
587
611
|
onIteration?: (entry: JournalEntry) => void;
|
|
588
612
|
onError?: (err: Error, iteration: number) => void;
|
|
613
|
+
/** Per-tick phase notifications for live UI/status updates. */
|
|
614
|
+
onStage?: (stage: ParallelIterationStage) => void;
|
|
589
615
|
gitStatusReader?: () => Promise<string>;
|
|
590
616
|
now?: () => Date;
|
|
591
617
|
compactor?: Compactor;
|
|
@@ -685,7 +711,7 @@ interface AutonomyPromptContributorOptions {
|
|
|
685
711
|
* leak into interactive runs that happen to have a goal on disk and
|
|
686
712
|
* teach the model loop-control markers it shouldn't emit.
|
|
687
713
|
*
|
|
688
|
-
* Typical wiring: `
|
|
714
|
+
* Typical wiring: enable while `eternal` or `eternal-parallel` autonomy is active.
|
|
689
715
|
*/
|
|
690
716
|
enabled: () => boolean;
|
|
691
717
|
/** Number of journal entries to include in the recent-tail block. Default 5. */
|
|
@@ -728,4 +754,4 @@ declare function makeAutonomyPromptContributor(opts: AutonomyPromptContributorOp
|
|
|
728
754
|
*/
|
|
729
755
|
declare function buildGoalPreamble(goal: string): string;
|
|
730
756
|
|
|
731
|
-
export { AutoCompactionMiddleware, AutonomousRunner, type AutonomousRunnerOptions, type AutonomyPromptContributorOptions, DefaultSkillLoader, type DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, type EternalAutonomyOptions, type EternalEngineState, IntelligentCompactor, type IntelligentCompactorOptions, type IterationStage, type ParallelEngineState, ParallelEternalEngine, type ParallelEternalOptions, SelectiveCompactor, type SelectiveCompactorOptions, type SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor };
|
|
757
|
+
export { AutoCompactionMiddleware, AutonomousRunner, type AutonomousRunnerOptions, type AutonomyPromptContributorOptions, DefaultSkillLoader, type DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, type EternalAutonomyOptions, type EternalEngineState, IntelligentCompactor, type IntelligentCompactorOptions, type IterationStage, type ParallelEngineState, ParallelEternalEngine, type ParallelEternalOptions, type ParallelIterationStage, SelectiveCompactor, type SelectiveCompactorOptions, type SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor };
|
package/dist/execution/index.js
CHANGED
|
@@ -6521,8 +6521,14 @@ var ParallelEternalEngine = class {
|
|
|
6521
6521
|
await this.runOneIteration();
|
|
6522
6522
|
} catch (err) {
|
|
6523
6523
|
this.consecutiveFailures++;
|
|
6524
|
-
this.opts.onError?.(
|
|
6525
|
-
|
|
6524
|
+
this.opts.onError?.(
|
|
6525
|
+
err instanceof Error ? err : new Error(String(err)),
|
|
6526
|
+
this.consecutiveFailures
|
|
6527
|
+
);
|
|
6528
|
+
await this.appendFailure(
|
|
6529
|
+
"engine error",
|
|
6530
|
+
err instanceof Error ? err.message : String(err)
|
|
6531
|
+
);
|
|
6526
6532
|
}
|
|
6527
6533
|
if (this.stopRequested) break;
|
|
6528
6534
|
await sleep2(2e3);
|
|
@@ -6538,14 +6544,19 @@ var ParallelEternalEngine = class {
|
|
|
6538
6544
|
* Called by the REPL in its main loop (REPL drives, engine is stateless per tick).
|
|
6539
6545
|
*/
|
|
6540
6546
|
async runOneIteration() {
|
|
6547
|
+
const emit = (stage) => {
|
|
6548
|
+
this.opts.onStage?.(stage);
|
|
6549
|
+
};
|
|
6541
6550
|
this.iterations++;
|
|
6542
6551
|
const goal = await loadGoal(this.goalPath);
|
|
6543
6552
|
if (!goal) {
|
|
6544
6553
|
this.stopRequested = true;
|
|
6554
|
+
emit({ phase: "stopped" });
|
|
6545
6555
|
return false;
|
|
6546
6556
|
}
|
|
6547
6557
|
if (goal.goalState !== "active") {
|
|
6548
6558
|
this.stopRequested = true;
|
|
6559
|
+
emit({ phase: "stopped" });
|
|
6549
6560
|
return false;
|
|
6550
6561
|
}
|
|
6551
6562
|
if (!this.coordinator) {
|
|
@@ -6558,10 +6569,13 @@ var ParallelEternalEngine = class {
|
|
|
6558
6569
|
const runner = makeAgentSubagentRunner({ factory: this.agentFactory });
|
|
6559
6570
|
this.coordinator.setRunner?.(runner);
|
|
6560
6571
|
}
|
|
6572
|
+
emit({ phase: "decompose" });
|
|
6561
6573
|
const tasks = await this.decomposeGoal(goal);
|
|
6562
6574
|
if (!tasks || tasks.length === 0) {
|
|
6575
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
6563
6576
|
return false;
|
|
6564
6577
|
}
|
|
6578
|
+
emit({ phase: "fanout", slots: Math.min(this.slots, tasks.length) });
|
|
6565
6579
|
const fanOut = await this.fanOut(goal, tasks);
|
|
6566
6580
|
this.iterationsSinceCompact++;
|
|
6567
6581
|
const successCount = fanOut.results.filter((r) => r.status === "success").length;
|
|
@@ -6578,12 +6592,20 @@ var ParallelEternalEngine = class {
|
|
|
6578
6592
|
status,
|
|
6579
6593
|
note
|
|
6580
6594
|
});
|
|
6595
|
+
emit({
|
|
6596
|
+
phase: "aggregate",
|
|
6597
|
+
successCount,
|
|
6598
|
+
total: fanOut.results.length,
|
|
6599
|
+
goalComplete: fanOut.goalComplete
|
|
6600
|
+
});
|
|
6581
6601
|
if (fanOut.goalComplete) {
|
|
6582
6602
|
this.stopRequested = true;
|
|
6583
6603
|
this.state = "stopped";
|
|
6604
|
+
emit({ phase: "stopped" });
|
|
6584
6605
|
return true;
|
|
6585
6606
|
}
|
|
6586
6607
|
await this.maybeCompact();
|
|
6608
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
6587
6609
|
return fanOut.allSuccessful;
|
|
6588
6610
|
}
|
|
6589
6611
|
// -------------------------------------------------------------------------
|
|
@@ -6597,7 +6619,9 @@ var ParallelEternalEngine = class {
|
|
|
6597
6619
|
(t) => dispatchAgent(t, { classifier: this.dispatchClassifier }).catch(() => null)
|
|
6598
6620
|
)
|
|
6599
6621
|
) : [];
|
|
6600
|
-
const recentJournal = goal.journal.slice(-5).map(
|
|
6622
|
+
const recentJournal = goal.journal.slice(-5).map(
|
|
6623
|
+
(e) => ` #${e.iteration} [${e.status}] ${e.task}${e.note ? ` \u2014 ${e.note.slice(0, 80)}` : ""}`
|
|
6624
|
+
).join("\n");
|
|
6601
6625
|
const directivePreamble = [
|
|
6602
6626
|
"\u2550\u2550\u2550 ETERNAL AUTONOMY \u2014 parallel task slot \u2550\u2550\u2550",
|
|
6603
6627
|
"",
|
|
@@ -6640,35 +6664,44 @@ ${personaLine}Task: ${task}
|
|
|
6640
6664
|
role: route?.role ?? "generic",
|
|
6641
6665
|
method: route?.method ?? "none"
|
|
6642
6666
|
});
|
|
6643
|
-
spawnPromises.push(
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
+
spawnPromises.push(
|
|
6668
|
+
(async () => {
|
|
6669
|
+
try {
|
|
6670
|
+
await coordinator.spawn(
|
|
6671
|
+
route ? {
|
|
6672
|
+
id: subagentId,
|
|
6673
|
+
name: route.definition.config.name,
|
|
6674
|
+
role: route.role,
|
|
6675
|
+
tools: route.definition.config.tools,
|
|
6676
|
+
systemPromptOverride: route.definition.config.prompt,
|
|
6677
|
+
timeoutMs: this.timeoutMs
|
|
6678
|
+
} : {
|
|
6679
|
+
id: subagentId,
|
|
6680
|
+
name: `slot-${subagentId.slice(-6)}`,
|
|
6681
|
+
// Let the coordinator apply its default budget (roster or generic).
|
|
6682
|
+
// Hardcoding low limits here defeats the x10 budget improvement.
|
|
6683
|
+
timeoutMs: this.timeoutMs
|
|
6684
|
+
}
|
|
6685
|
+
);
|
|
6686
|
+
subagentIds.push(subagentId);
|
|
6687
|
+
taskIds.push(taskId);
|
|
6688
|
+
await coordinator.assign(spec);
|
|
6689
|
+
} catch {
|
|
6690
|
+
}
|
|
6691
|
+
})()
|
|
6692
|
+
);
|
|
6667
6693
|
}
|
|
6668
6694
|
await Promise.all(spawnPromises);
|
|
6669
6695
|
if (taskIds.length === 0) {
|
|
6670
|
-
return {
|
|
6696
|
+
return {
|
|
6697
|
+
results: [],
|
|
6698
|
+
allSuccessful: false,
|
|
6699
|
+
goalComplete: false,
|
|
6700
|
+
partialOutput: "",
|
|
6701
|
+
routes: routeInfo
|
|
6702
|
+
};
|
|
6671
6703
|
}
|
|
6704
|
+
this.opts.onStage?.({ phase: "await", taskIds: [...taskIds] });
|
|
6672
6705
|
let results = [];
|
|
6673
6706
|
try {
|
|
6674
6707
|
const ctrl = new AbortController();
|