@wrongstack/core 0.89.1 → 0.89.3
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-B8F2ORwg.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
- package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +433 -433
- package/dist/{events-DzyLtja6.d.ts → brain-s9DyD_Vf.d.ts} +179 -92
- package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
- package/dist/{config-_DZ7dN-T.d.ts → config-84VaZpH6.d.ts} +45 -38
- package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
- package/dist/coordination/index.d.ts +16 -17
- package/dist/coordination/index.js +25 -37
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +31 -33
- package/dist/defaults/index.js +476 -206
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
- package/dist/execution/index.d.ts +18 -19
- package/dist/execution/index.js +23 -45
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +9 -10
- package/dist/extension/index.js +8 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-Ca_lOmKl.d.ts → index-CqrroYcU.d.ts} +13 -15
- package/dist/{index-Dx-CnrDN.d.ts → index-D3Nax3YU.d.ts} +9 -10
- package/dist/index.d.ts +184 -174
- package/dist/index.js +973 -349
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -9
- package/dist/infrastructure/index.js +4 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +14 -16
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
- package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
- package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-D3E5ixAR.d.ts} +3 -3
- package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +8 -6
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
- package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
- package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-BzzciAc4.d.ts} +32 -31
- package/dist/observability/index.d.ts +3 -3
- package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
- package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +33 -33
- package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-B7hgMAVe.d.ts} +3 -3
- package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
- package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
- package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-C1Ad9OjI.d.ts} +73 -73
- package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
- package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-cqvlB_oS.d.ts} +5 -5
- package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
- package/dist/sdd/index.d.ts +12 -33
- package/dist/sdd/index.js +21 -31
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
- package/dist/security/index.d.ts +4 -5
- package/dist/security/index.js +4 -2
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
- package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-IVzs2GpE.d.ts} +1 -1
- package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
- package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.d.ts} +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +3 -9
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +132 -12
- package/dist/storage/index.js +834 -159
- package/dist/storage/index.js.map +1 -1
- package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
- package/dist/types/index.d.ts +25 -27
- package/dist/types/index.js +19 -31
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.d.ts +7 -0
- package/dist/utils/expect-defined.js +11 -0
- package/dist/utils/expect-defined.js.map +1 -0
- package/dist/utils/index.d.ts +6 -20
- package/dist/utils/index.js +11 -41
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/memory-CEXuo7sz.d.ts +0 -16
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
|
@@ -1,106 +1,87 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-CNRYfhUv.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
id: string;
|
|
24
|
-
source: BrainDecisionSource;
|
|
25
|
-
question: string;
|
|
26
|
-
context?: string | undefined;
|
|
27
|
-
options?: BrainDecisionOption[] | undefined;
|
|
28
|
-
risk: BrainRisk;
|
|
29
|
-
/** What a non-LLM/default Brain should do when policy cannot decide safely. */
|
|
30
|
-
fallback: BrainFallback;
|
|
3
|
+
type MemoryScope = 'project-agents' | 'project-memory' | 'user-memory';
|
|
4
|
+
type MemoryType = 'fact' | 'decision' | 'convention' | 'preference' | 'reference' | 'anti_pattern';
|
|
5
|
+
declare const MEMORY_TYPE_LABELS: Record<MemoryType, string>;
|
|
6
|
+
type MemoryPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
7
|
+
interface MemoryEntry {
|
|
8
|
+
scope: MemoryScope;
|
|
9
|
+
text: string;
|
|
10
|
+
ts: string;
|
|
11
|
+
/** Category — helps the agent decide whether to inject or ignore. */
|
|
12
|
+
type?: MemoryType | undefined;
|
|
13
|
+
/** Free-form tags for grouping (e.g. ["build", "pnpm", "typescript"]). */
|
|
14
|
+
tags?: string[] | undefined;
|
|
15
|
+
/** Priority — critical entries are always injected; low may be skipped. */
|
|
16
|
+
priority?: MemoryPriority | undefined;
|
|
17
|
+
/** Session or agent that created this entry. */
|
|
18
|
+
source?: string | undefined;
|
|
19
|
+
/** 0.0–1.0 confidence. Low-confidence entries are injected less often. */
|
|
20
|
+
confidence?: number | undefined;
|
|
21
|
+
/** ISO timestamp of last access (read or injection into context). */
|
|
22
|
+
lastAccessed?: string | undefined;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
optionId?: string | undefined;
|
|
24
|
+
interface MemoryRememberedPayload {
|
|
25
|
+
scope: MemoryScope;
|
|
35
26
|
text: string;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
options?: BrainDecisionOption[] | undefined;
|
|
41
|
-
rationale?: string | undefined;
|
|
42
|
-
} | {
|
|
43
|
-
type: 'deny';
|
|
44
|
-
reason: string;
|
|
45
|
-
};
|
|
46
|
-
interface BrainArbiter {
|
|
47
|
-
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
27
|
+
ts: string;
|
|
28
|
+
type?: MemoryType | undefined;
|
|
29
|
+
tags?: string[] | undefined;
|
|
30
|
+
priority?: MemoryPriority | undefined;
|
|
48
31
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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>;
|
|
32
|
+
interface MemoryForgottenPayload {
|
|
33
|
+
scope: MemoryScope;
|
|
34
|
+
query: string;
|
|
35
|
+
removed: number;
|
|
59
36
|
}
|
|
60
|
-
interface
|
|
61
|
-
/**
|
|
62
|
-
|
|
37
|
+
interface MemoryClearedPayload {
|
|
38
|
+
/** Scope that was cleared, or undefined when all scopes were cleared. */
|
|
39
|
+
scope?: MemoryScope | undefined;
|
|
63
40
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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;
|
|
41
|
+
interface MemoryConsolidatedPayload {
|
|
42
|
+
scope: MemoryScope;
|
|
43
|
+
/** Entries removed by deduplication. */
|
|
44
|
+
removed: number;
|
|
76
45
|
}
|
|
77
46
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
47
|
+
* Context used to score memory relevance for context injection.
|
|
48
|
+
* Passed by the system prompt builder.
|
|
80
49
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
50
|
+
interface MemoryRelevanceContext {
|
|
51
|
+
/** Current user message or task description. */
|
|
52
|
+
currentTask: string;
|
|
53
|
+
/** Active skills in this session (e.g. ["typescript-strict", "git-flow"]). */
|
|
54
|
+
activeSkills?: string[] | undefined;
|
|
55
|
+
/** Active mode (e.g. "Teach", "Brief", "Code Reviewer"). */
|
|
56
|
+
activeMode?: string | undefined;
|
|
57
|
+
/** Available tools — memories referencing relevant tools score higher. */
|
|
58
|
+
toolNames?: string[] | undefined;
|
|
86
59
|
}
|
|
87
|
-
interface
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
interface ScoredEntry extends MemoryEntry {
|
|
61
|
+
score: number;
|
|
62
|
+
matchReason: string;
|
|
90
63
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
64
|
+
interface MemoryStore {
|
|
65
|
+
readAll(): Promise<string>;
|
|
66
|
+
read(scope: MemoryScope): Promise<string>;
|
|
67
|
+
remember(text: string, scope?: MemoryScope, metadata?: Omit<Partial<MemoryEntry>, 'scope' | 'text' | 'ts'>): Promise<void>;
|
|
68
|
+
forget(query: string, scope?: MemoryScope): Promise<number>;
|
|
69
|
+
consolidate(scope: MemoryScope): Promise<void>;
|
|
70
|
+
clear(scope?: MemoryScope): Promise<void>;
|
|
71
|
+
/** List entries, newest first. */
|
|
72
|
+
list(scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
73
|
+
/** Search by content (substring or semantic). */
|
|
74
|
+
search(query: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
75
|
+
/** Access the backend for advanced queries. */
|
|
76
|
+
getBackend?(): unknown;
|
|
77
|
+
/** Graph-based related memory traversal. */
|
|
78
|
+
findRelated?(text: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Score and rank memories by relevance to the current context.
|
|
81
|
+
* Returns only entries that meet a relevance threshold.
|
|
82
|
+
*/
|
|
83
|
+
scoreRelevant?(ctx: MemoryRelevanceContext, scope?: MemoryScope, limit?: number): Promise<ScoredEntry[]>;
|
|
102
84
|
}
|
|
103
|
-
declare function formatHumanPrompt(request: BrainDecisionRequest): string;
|
|
104
85
|
|
|
105
86
|
/**
|
|
106
87
|
* EventBus — observe-only typed event bus.
|
|
@@ -705,6 +686,10 @@ interface EventMap {
|
|
|
705
686
|
branch?: string | undefined;
|
|
706
687
|
error: string;
|
|
707
688
|
};
|
|
689
|
+
'memory.remembered': MemoryRememberedPayload;
|
|
690
|
+
'memory.forgotten': MemoryForgottenPayload;
|
|
691
|
+
'memory.cleared': MemoryClearedPayload;
|
|
692
|
+
'memory.consolidated': MemoryConsolidatedPayload;
|
|
708
693
|
error: {
|
|
709
694
|
err: Error;
|
|
710
695
|
phase: string;
|
|
@@ -859,4 +844,106 @@ declare class ScopedEventBus extends EventBus {
|
|
|
859
844
|
get scopedListenerCount(): number;
|
|
860
845
|
}
|
|
861
846
|
|
|
862
|
-
|
|
847
|
+
/**
|
|
848
|
+
* Brain coordination primitives.
|
|
849
|
+
*
|
|
850
|
+
* Brain is an authority layer above a leader/director but below the human. It is
|
|
851
|
+
* intentionally modeled as a decision interface first, not as an autonomous
|
|
852
|
+
* bypass: callers ask for a decision, Brain either answers within policy or
|
|
853
|
+
* escalates to the human.
|
|
854
|
+
*/
|
|
855
|
+
|
|
856
|
+
type BrainDecisionSource = 'autophase' | 'director' | 'tool' | 'user' | 'system';
|
|
857
|
+
type BrainRisk = 'low' | 'medium' | 'high' | 'critical';
|
|
858
|
+
type BrainFallback = 'ask_human' | 'deny' | 'continue';
|
|
859
|
+
interface BrainDecisionOption {
|
|
860
|
+
id: string;
|
|
861
|
+
label: string;
|
|
862
|
+
consequence?: string | undefined;
|
|
863
|
+
risk?: BrainRisk | undefined;
|
|
864
|
+
recommended?: boolean | undefined;
|
|
865
|
+
}
|
|
866
|
+
interface BrainDecisionRequest {
|
|
867
|
+
id: string;
|
|
868
|
+
source: BrainDecisionSource;
|
|
869
|
+
question: string;
|
|
870
|
+
context?: string | undefined;
|
|
871
|
+
options?: BrainDecisionOption[] | undefined;
|
|
872
|
+
risk: BrainRisk;
|
|
873
|
+
/** What a non-LLM/default Brain should do when policy cannot decide safely. */
|
|
874
|
+
fallback: BrainFallback;
|
|
875
|
+
}
|
|
876
|
+
type BrainDecision = {
|
|
877
|
+
type: 'answer';
|
|
878
|
+
optionId?: string | undefined;
|
|
879
|
+
text: string;
|
|
880
|
+
rationale?: string | undefined;
|
|
881
|
+
} | {
|
|
882
|
+
type: 'ask_human';
|
|
883
|
+
prompt: string;
|
|
884
|
+
options?: BrainDecisionOption[] | undefined;
|
|
885
|
+
rationale?: string | undefined;
|
|
886
|
+
} | {
|
|
887
|
+
type: 'deny';
|
|
888
|
+
reason: string;
|
|
889
|
+
};
|
|
890
|
+
interface BrainArbiter {
|
|
891
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Event-emitting decorator for any Brain implementation. Hosts wire this around
|
|
895
|
+
* their actual arbiter so TUI/session surfaces can render Brain decisions
|
|
896
|
+
* without coupling to the caller that requested the decision.
|
|
897
|
+
*/
|
|
898
|
+
declare class ObservableBrainArbiter implements BrainArbiter {
|
|
899
|
+
private readonly inner;
|
|
900
|
+
private readonly events;
|
|
901
|
+
constructor(inner: BrainArbiter, events: EventBus);
|
|
902
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
903
|
+
}
|
|
904
|
+
interface BrainDecisionQueueOptions {
|
|
905
|
+
/** Safety fallback if the human never answers. Default: no timeout. */
|
|
906
|
+
timeoutMs?: number | undefined;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Bridge between an `ask_human` Brain decision and the UI. It emits the visible
|
|
910
|
+
* ask-human event, then resolves when the TUI emits `brain.human_answered`.
|
|
911
|
+
*/
|
|
912
|
+
declare class BrainDecisionQueue {
|
|
913
|
+
private readonly events;
|
|
914
|
+
private readonly opts;
|
|
915
|
+
private readonly pending;
|
|
916
|
+
private readonly offAnswer;
|
|
917
|
+
constructor(events: EventBus, opts?: BrainDecisionQueueOptions);
|
|
918
|
+
requestHumanDecision(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
919
|
+
dispose(): void;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Decorator that turns `ask_human` into an actual awaited human decision.
|
|
923
|
+
* The wrapped Brain remains policy-only; this layer owns the UI/event bridge.
|
|
924
|
+
*/
|
|
925
|
+
declare class HumanEscalatingBrainArbiter implements BrainArbiter {
|
|
926
|
+
private readonly inner;
|
|
927
|
+
private readonly queue;
|
|
928
|
+
constructor(inner: BrainArbiter, queue: BrainDecisionQueue);
|
|
929
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
930
|
+
}
|
|
931
|
+
interface DefaultBrainArbiterOptions {
|
|
932
|
+
/** Allow deterministic auto-answering for low-risk requests. Default true. */
|
|
933
|
+
allowLowRiskAutoAnswer?: boolean | undefined;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Conservative deterministic Brain implementation.
|
|
937
|
+
*
|
|
938
|
+
* It only auto-answers low-risk requests when the caller provided a recommended
|
|
939
|
+
* option. Everything else follows the request fallback. This gives hosts a safe
|
|
940
|
+
* policy object to wire before an LLM-backed Brain exists.
|
|
941
|
+
*/
|
|
942
|
+
declare class DefaultBrainArbiter implements BrainArbiter {
|
|
943
|
+
private readonly allowLowRiskAutoAnswer;
|
|
944
|
+
constructor(opts?: DefaultBrainArbiterOptions);
|
|
945
|
+
decide(request: BrainDecisionRequest): Promise<BrainDecision>;
|
|
946
|
+
}
|
|
947
|
+
declare function formatHumanPrompt(request: BrainDecisionRequest): string;
|
|
948
|
+
|
|
949
|
+
export { type BrainArbiter as B, DefaultBrainArbiter as D, EventBus as E, HumanEscalatingBrainArbiter as H, type Listener as L, type MemoryScope as M, ObservableBrainArbiter as O, type ScoredEntry as S, type EventName as a, type BrainDecision as b, type BrainDecisionOption as c, BrainDecisionQueue as d, type BrainDecisionRequest as e, type BrainDecisionSource as f, type BrainFallback as g, type BrainRisk as h, type DefaultBrainArbiterOptions as i, formatHumanPrompt as j, type MemoryEntry as k, type MemoryStore as l, type MemoryRelevanceContext as m, type EventLogger as n, type EventMap as o, MEMORY_TYPE_LABELS as p, type MemoryClearedPayload as q, type MemoryConsolidatedPayload as r, type MemoryForgottenPayload as s, type MemoryPriority as t, type MemoryRememberedPayload as u, type MemoryType as v, ScopedEventBus as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Context } from './context-CNRYfhUv.js';
|
|
2
2
|
|
|
3
3
|
interface CompactRepairReport {
|
|
4
4
|
removedToolUses: string[];
|
|
@@ -38,4 +38,4 @@ interface Compactor {
|
|
|
38
38
|
}): Promise<CompactReport>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export type {
|
|
41
|
+
export type { Compactor as C, CompactReport as a };
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import { W as WireFamily } from './models-registry-
|
|
2
|
-
import {
|
|
1
|
+
import { W as WireFamily } from './models-registry-B6_KfS65.js';
|
|
2
|
+
import { k as Capabilities, f as Permission } from './context-CNRYfhUv.js';
|
|
3
|
+
|
|
4
|
+
type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
|
|
5
|
+
type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
|
|
6
|
+
interface ContextWindowThresholds {
|
|
7
|
+
warn: number;
|
|
8
|
+
soft: number;
|
|
9
|
+
hard: number;
|
|
10
|
+
}
|
|
11
|
+
interface ContextWindowMode {
|
|
12
|
+
id: ContextWindowModeId;
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
thresholds: ContextWindowThresholds;
|
|
16
|
+
aggressiveOn: ContextWindowAggressiveOn;
|
|
17
|
+
preserveK: number;
|
|
18
|
+
eliseThreshold: number;
|
|
19
|
+
targetLoad: number;
|
|
20
|
+
}
|
|
21
|
+
interface ContextWindowPolicy extends ContextWindowMode {
|
|
22
|
+
}
|
|
23
|
+
interface ContextWindowConfigLike {
|
|
24
|
+
mode?: ContextWindowModeId | string | undefined;
|
|
25
|
+
warnThreshold?: number | undefined;
|
|
26
|
+
softThreshold?: number | undefined;
|
|
27
|
+
hardThreshold?: number | undefined;
|
|
28
|
+
preserveK?: number | undefined;
|
|
29
|
+
eliseThreshold?: number | undefined;
|
|
30
|
+
}
|
|
31
|
+
declare const DEFAULT_CONTEXT_WINDOW_MODE_ID: ContextWindowModeId;
|
|
32
|
+
declare const CONTEXT_WINDOW_MODES: readonly ContextWindowMode[];
|
|
33
|
+
declare function listContextWindowModes(): ContextWindowMode[];
|
|
34
|
+
declare function getContextWindowMode(id: string | null | undefined): ContextWindowMode | null;
|
|
35
|
+
declare function isContextWindowModeId(id: string): id is ContextWindowModeId;
|
|
36
|
+
declare function resolveContextWindowPolicy(config?: ContextWindowConfigLike, overrideMode?: string | null | undefined): ContextWindowPolicy;
|
|
37
|
+
declare function formatContextWindowModeList(activeId?: string | null): string;
|
|
3
38
|
|
|
4
39
|
/**
|
|
5
40
|
* Lifecycle hook types — the pure, serializable contract shared by the config
|
|
@@ -96,41 +131,6 @@ type HookEntry = {
|
|
|
96
131
|
timeoutMs?: number | undefined;
|
|
97
132
|
};
|
|
98
133
|
|
|
99
|
-
type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
|
|
100
|
-
type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
|
|
101
|
-
interface ContextWindowThresholds {
|
|
102
|
-
warn: number;
|
|
103
|
-
soft: number;
|
|
104
|
-
hard: number;
|
|
105
|
-
}
|
|
106
|
-
interface ContextWindowMode {
|
|
107
|
-
id: ContextWindowModeId;
|
|
108
|
-
name: string;
|
|
109
|
-
description: string;
|
|
110
|
-
thresholds: ContextWindowThresholds;
|
|
111
|
-
aggressiveOn: ContextWindowAggressiveOn;
|
|
112
|
-
preserveK: number;
|
|
113
|
-
eliseThreshold: number;
|
|
114
|
-
targetLoad: number;
|
|
115
|
-
}
|
|
116
|
-
interface ContextWindowPolicy extends ContextWindowMode {
|
|
117
|
-
}
|
|
118
|
-
interface ContextWindowConfigLike {
|
|
119
|
-
mode?: ContextWindowModeId | string | undefined;
|
|
120
|
-
warnThreshold?: number | undefined;
|
|
121
|
-
softThreshold?: number | undefined;
|
|
122
|
-
hardThreshold?: number | undefined;
|
|
123
|
-
preserveK?: number | undefined;
|
|
124
|
-
eliseThreshold?: number | undefined;
|
|
125
|
-
}
|
|
126
|
-
declare const DEFAULT_CONTEXT_WINDOW_MODE_ID: ContextWindowModeId;
|
|
127
|
-
declare const CONTEXT_WINDOW_MODES: readonly ContextWindowMode[];
|
|
128
|
-
declare function listContextWindowModes(): ContextWindowMode[];
|
|
129
|
-
declare function getContextWindowMode(id: string | null | undefined): ContextWindowMode | null;
|
|
130
|
-
declare function isContextWindowModeId(id: string): id is ContextWindowModeId;
|
|
131
|
-
declare function resolveContextWindowPolicy(config?: ContextWindowConfigLike, overrideMode?: string | null | undefined): ContextWindowPolicy;
|
|
132
|
-
declare function formatContextWindowModeList(activeId?: string | null): string;
|
|
133
|
-
|
|
134
134
|
interface ContextConfig {
|
|
135
135
|
/** Context-window policy mode. Controls compaction thresholds and preservation depth. */
|
|
136
136
|
mode?: ContextWindowModeId | undefined;
|
|
@@ -269,6 +269,13 @@ interface FeaturesConfig {
|
|
|
269
269
|
plugins: boolean;
|
|
270
270
|
/** Register `remember` / `forget` tools backed by memory store. */
|
|
271
271
|
memory: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Automatically consolidate session learnings into long-term memory
|
|
274
|
+
* after each completed run. The agent extracts key facts, conventions,
|
|
275
|
+
* and decisions via a lightweight LLM call and persists them.
|
|
276
|
+
* Enabled by default when `memory` is on; set to false to opt out.
|
|
277
|
+
*/
|
|
278
|
+
memoryConsolidation?: boolean | undefined;
|
|
272
279
|
/** Fetch the models.dev catalog at startup. When false, the provider
|
|
273
280
|
* must declare its `family` explicitly in `providers[<id>]`. */
|
|
274
281
|
modelsRegistry: boolean;
|
|
@@ -496,4 +503,4 @@ interface ConfigStore {
|
|
|
496
503
|
watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
497
504
|
}
|
|
498
505
|
|
|
499
|
-
export { type AutonomyConfig as A, listContextWindowModes as B,
|
|
506
|
+
export { type AutonomyConfig as A, listContextWindowModes as B, type Config as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, resolveContextWindowPolicy as E, type FeaturesConfig as F, type HookEvent as H, type InProcessHook as I, type LaunchConfig as L, type MCPServerConfig as M, type PluginConfig as P, type ShellHook as S, type ToolsConfig as T, type HookMatcher as a, type HookEntry as b, type ConfigStore as c, type ConfigLoader as d, type SyncConfig as e, type ModelMatrixEntry as f, type HookInput as g, type HookOutcome as h, CONTEXT_WINDOW_MODES as i, type ContextConfig as j, type ContextWindowAggressiveOn as k, type ContextWindowConfigLike as l, type ContextWindowMode as m, type ContextWindowModeId as n, type ContextWindowPolicy as o, type ContextWindowThresholds as p, type CustomModelDefinition as q, type IndexingConfig as r, type LogConfig as s, type ProviderApiKey as t, type ProviderConfig as u, type SessionLoggingConfig as v, type SyncCategory as w, formatContextWindowModeList as x, getContextWindowMode as y, isContextWindowModeId as z };
|
|
@@ -1218,4 +1218,4 @@ declare class Context implements RunEnv {
|
|
|
1218
1218
|
usage(): Usage;
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
-
export { type
|
|
1221
|
+
export { type ToolStreamEvent as $, AgentError as A, type MessageRole as B, Context as C, PluginError as D, ERROR_CODES as E, type FileSnapshot as F, type ProviderErrorBody as G, type ReadonlyConversationState as H, type ImageBlock as I, type JSONSchema as J, type RiskTier as K, type RunEnv as L, type Message as M, SessionError as N, type StateChange as O, type Provider as P, type StateChangeHandler as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type StopReason as V, type StreamEvent as W, type ThinkingBlock as X, type ToolCallContext as Y, ToolError as Z, type ToolFinalEvent as _, type SessionWriter as a, WrongStackError as a0, asBlocks as a1, asText as a2, extractRunEnv as a3, isAgentError as a4, isConfigError as a5, isFsError as a6, isImageBlock as a7, isPluginError as a8, isSessionError as a9, isTextBlock as aa, isThinkingBlock as ab, isToolError as ac, isToolResultBlock as ad, isToolUseBlock as ae, isWrongStackError as af, toWrongStackError as ag, wrapAsState as ah, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type Capabilities as k, type TextBlock as l, type ToolUseBlock as m, type ToolResultBlock as n, type RunOptions as o, type ResumedSession as p, type SessionData as q, type SessionSummary as r, type TodoItem as s, ConversationState as t, ConfigError as u, type ContextInit as v, type ErrorCode as w, type ErrorSeverity as x, type ErrorSubsystem as y, FsError as z };
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
export { B as BrainArbiter,
|
|
2
|
-
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
3
|
-
import {
|
|
4
|
-
export { T as AGENT_TOOL_PRESETS,
|
|
5
|
-
export {
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
7
|
-
import '../context-
|
|
1
|
+
export { B as BrainArbiter, b as BrainDecision, c as BrainDecisionOption, d as BrainDecisionQueue, e as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, j as formatHumanPrompt } from '../brain-s9DyD_Vf.js';
|
|
2
|
+
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BzzciAc4.js';
|
|
3
|
+
import { A as AgentDefinition } from '../multi-agent-coordinator-DHNrjPaA.js';
|
|
4
|
+
export { T as AGENT_TOOL_PRESETS, b as AgentBudgetTier, c as AgentCapability, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-DHNrjPaA.js';
|
|
5
|
+
export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, n as BudgetNegotiationMode, o as BudgetThresholdDecision, p as BudgetThresholdHandler, q as BudgetThresholdSignal, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-C6eqID1t.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DbVe1dHT.js';
|
|
7
|
+
import '../context-CNRYfhUv.js';
|
|
8
8
|
import 'node:events';
|
|
9
|
-
import '../director-state-
|
|
10
|
-
import '../config-
|
|
11
|
-
import '../models-registry-
|
|
12
|
-
import '../index-
|
|
13
|
-
import '../logger-
|
|
14
|
-
import '../
|
|
15
|
-
import '../observability-
|
|
16
|
-
import '../
|
|
17
|
-
import '../
|
|
18
|
-
import '../retry-policy-DSu6O6rD.js';
|
|
9
|
+
import '../director-state-BfeCUbmk.js';
|
|
10
|
+
import '../config-84VaZpH6.js';
|
|
11
|
+
import '../models-registry-B6_KfS65.js';
|
|
12
|
+
import '../index-D3Nax3YU.js';
|
|
13
|
+
import '../logger-B63L5bTg.js';
|
|
14
|
+
import '../pipeline-C1Ad9OjI.js';
|
|
15
|
+
import '../observability-D-HZN_mF.js';
|
|
16
|
+
import '../permission-BDv7z0mk.js';
|
|
17
|
+
import '../retry-policy-BcmuT_V0.js';
|
|
19
18
|
|
|
20
19
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
21
20
|
declare const DISCOVERY_AGENTS: AgentDefinition[];
|
|
@@ -2,15 +2,9 @@ import { randomUUID, randomBytes } from 'crypto';
|
|
|
2
2
|
import * as fsp6 from 'fs/promises';
|
|
3
3
|
import * as path4 from 'path';
|
|
4
4
|
import { isAbsolute, resolve } from 'path';
|
|
5
|
+
import { hostname } from 'os';
|
|
5
6
|
import { EventEmitter } from 'events';
|
|
6
7
|
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
8
|
// src/coordination/brain.ts
|
|
15
9
|
var ObservableBrainArbiter = class {
|
|
16
10
|
constructor(inner, events) {
|
|
@@ -236,7 +230,7 @@ async function acquireDirectorStateLock(lockPath, processId = process.pid) {
|
|
|
236
230
|
}
|
|
237
231
|
const lock = {
|
|
238
232
|
pid: processId,
|
|
239
|
-
hostname:
|
|
233
|
+
hostname: hostname(),
|
|
240
234
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
241
235
|
};
|
|
242
236
|
await atomicWrite(lockPath, JSON.stringify(lock), { mode: 384 });
|
|
@@ -543,7 +537,9 @@ function createMessage(type, from, payload, to) {
|
|
|
543
537
|
priority: "normal"
|
|
544
538
|
};
|
|
545
539
|
}
|
|
546
|
-
|
|
540
|
+
|
|
541
|
+
// src/utils/expect-defined.ts
|
|
542
|
+
function expectDefined(value, label) {
|
|
547
543
|
if (value === null || value === void 0) {
|
|
548
544
|
throw new Error("Expected value to be defined");
|
|
549
545
|
}
|
|
@@ -688,6 +684,7 @@ var CollabSession = class extends EventEmitter {
|
|
|
688
684
|
settled = false;
|
|
689
685
|
timeoutMs;
|
|
690
686
|
cancelled = false;
|
|
687
|
+
_raceResolved = false;
|
|
691
688
|
alerts = [];
|
|
692
689
|
snapshotWarnings = [];
|
|
693
690
|
/** Tracks tool call counts per subagent for progress-based timeout decisions. */
|
|
@@ -784,7 +781,7 @@ var CollabSession = class extends EventEmitter {
|
|
|
784
781
|
* Safe to call multiple times (idempotent after first call).
|
|
785
782
|
*/
|
|
786
783
|
cancel(reason = "Director cancelled collab session") {
|
|
787
|
-
if (this.
|
|
784
|
+
if (this.cancelled) return;
|
|
788
785
|
this.cancelled = true;
|
|
789
786
|
if (this._timeoutTimer) {
|
|
790
787
|
clearTimeout(this._timeoutTimer);
|
|
@@ -822,6 +819,7 @@ var CollabSession = class extends EventEmitter {
|
|
|
822
819
|
this.subagentIds.set("critic", criticId);
|
|
823
820
|
const timeout = new Promise((_, reject) => {
|
|
824
821
|
this._timeoutTimer = setTimeout(() => {
|
|
822
|
+
if (this._raceResolved) return;
|
|
825
823
|
this.cancel("Session-level timeout reached");
|
|
826
824
|
reject(new Error(`CollabSession timed out after ${this.timeoutMs}ms`));
|
|
827
825
|
}, this.timeoutMs);
|
|
@@ -837,6 +835,7 @@ var CollabSession = class extends EventEmitter {
|
|
|
837
835
|
timeout
|
|
838
836
|
]);
|
|
839
837
|
} catch (err) {
|
|
838
|
+
this._raceResolved = true;
|
|
840
839
|
if (this._timeoutTimer) {
|
|
841
840
|
clearTimeout(this._timeoutTimer);
|
|
842
841
|
this._timeoutTimer = void 0;
|
|
@@ -851,6 +850,7 @@ var CollabSession = class extends EventEmitter {
|
|
|
851
850
|
}
|
|
852
851
|
this.snapshotWarnings = await this.checkSnapshotFreshness();
|
|
853
852
|
const report = this.assembleReport();
|
|
853
|
+
this._raceResolved = true;
|
|
854
854
|
this.cleanup();
|
|
855
855
|
this.emit("session.done", report);
|
|
856
856
|
return report;
|
|
@@ -7598,15 +7598,7 @@ function makeAgentSubagentRunner(opts) {
|
|
|
7598
7598
|
let budgetError = null;
|
|
7599
7599
|
const onBudgetError = (err) => {
|
|
7600
7600
|
if (err instanceof BudgetThresholdSignal) {
|
|
7601
|
-
|
|
7602
|
-
if (decision === "stop") {
|
|
7603
|
-
budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
|
|
7604
|
-
aborter.abort();
|
|
7605
|
-
}
|
|
7606
|
-
}).catch(() => {
|
|
7607
|
-
budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
|
|
7608
|
-
aborter.abort();
|
|
7609
|
-
});
|
|
7601
|
+
budgetError = err;
|
|
7610
7602
|
return;
|
|
7611
7603
|
}
|
|
7612
7604
|
aborter.abort();
|
|
@@ -7714,15 +7706,23 @@ function makeAgentSubagentRunner(opts) {
|
|
|
7714
7706
|
}
|
|
7715
7707
|
if (budgetError) {
|
|
7716
7708
|
if ("decision" in budgetError) {
|
|
7717
|
-
|
|
7718
|
-
|
|
7709
|
+
try {
|
|
7710
|
+
const decision = await budgetError.decision;
|
|
7711
|
+
if (decision === "stop") {
|
|
7712
|
+
budgetError = new BudgetExceededError(
|
|
7713
|
+
budgetError.kind,
|
|
7714
|
+
budgetError.limit,
|
|
7715
|
+
budgetError.used
|
|
7716
|
+
);
|
|
7717
|
+
} else {
|
|
7718
|
+
budgetError = null;
|
|
7719
|
+
}
|
|
7720
|
+
} catch {
|
|
7719
7721
|
budgetError = new BudgetExceededError(
|
|
7720
7722
|
budgetError.kind,
|
|
7721
7723
|
budgetError.limit,
|
|
7722
7724
|
budgetError.used
|
|
7723
7725
|
);
|
|
7724
|
-
} else {
|
|
7725
|
-
budgetError = null;
|
|
7726
7726
|
}
|
|
7727
7727
|
}
|
|
7728
7728
|
if (budgetError) throw budgetError;
|
|
@@ -7756,12 +7756,6 @@ function defaultFormatTaskInput(task) {
|
|
|
7756
7756
|
}
|
|
7757
7757
|
|
|
7758
7758
|
// src/utils/message-invariants.ts
|
|
7759
|
-
function expectDefined2(value) {
|
|
7760
|
-
if (value === null || value === void 0) {
|
|
7761
|
-
throw new Error("Expected value to be defined");
|
|
7762
|
-
}
|
|
7763
|
-
return value;
|
|
7764
|
-
}
|
|
7765
7759
|
function repairToolUseAdjacency(messages) {
|
|
7766
7760
|
const removedToolUses = [];
|
|
7767
7761
|
const removedToolResults = [];
|
|
@@ -7769,7 +7763,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
7769
7763
|
let changed = false;
|
|
7770
7764
|
const out = [];
|
|
7771
7765
|
for (let i = 0; i < messages.length; i++) {
|
|
7772
|
-
const original =
|
|
7766
|
+
const original = expectDefined(messages[i]);
|
|
7773
7767
|
let msg = original;
|
|
7774
7768
|
if (hasToolUse(msg)) {
|
|
7775
7769
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -7854,12 +7848,6 @@ function isEmptyMessage(msg) {
|
|
|
7854
7848
|
}
|
|
7855
7849
|
|
|
7856
7850
|
// src/storage/session-store.ts
|
|
7857
|
-
function expectDefined3(value) {
|
|
7858
|
-
if (value === null || value === void 0) {
|
|
7859
|
-
throw new Error("Expected value to be defined");
|
|
7860
|
-
}
|
|
7861
|
-
return value;
|
|
7862
|
-
}
|
|
7863
7851
|
function sanitizeModel(model) {
|
|
7864
7852
|
return model.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
|
|
7865
7853
|
}
|
|
@@ -8570,7 +8558,7 @@ var FileSessionWriter = class {
|
|
|
8570
8558
|
let targetCheckpointLine = -1;
|
|
8571
8559
|
let afterTarget = false;
|
|
8572
8560
|
for (let i = 0; i < lines.length; i++) {
|
|
8573
|
-
const line =
|
|
8561
|
+
const line = expectDefined(lines[i]);
|
|
8574
8562
|
if (!line.trim()) continue;
|
|
8575
8563
|
let event;
|
|
8576
8564
|
try {
|