@genesislcap/ai-assistant 15.19.6 → 15.20.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/ai-assistant.api.json +605 -72
- package/dist/ai-assistant.d.ts +404 -25
- package/dist/chat-driver.cjs +341 -28
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +341 -28
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +630 -20
- package/dist/dts/components/ai-driver/ai-driver.d.ts +33 -7
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +63 -2
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +9 -3
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +44 -0
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +187 -5
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/utils/condense-history.d.ts.map +1 -1
- package/dist/dts/utils/context-tokens.d.ts +156 -0
- package/dist/dts/utils/context-tokens.d.ts.map +1 -0
- package/dist/dts/utils/history-transform.d.ts +76 -14
- package/dist/dts/utils/history-transform.d.ts.map +1 -1
- package/dist/dts/utils/resolve-context-budget.d.ts +98 -0
- package/dist/dts/utils/resolve-context-budget.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +179 -34
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +12 -4
- package/dist/esm/main/main.js +391 -21
- package/dist/esm/main/main.styles.js +128 -0
- package/dist/esm/main/main.template.js +64 -29
- package/dist/esm/state/debug-event-log.js +1 -1
- package/dist/esm/utils/condense-history.js +1 -5
- package/dist/esm/utils/context-tokens.js +339 -0
- package/dist/esm/utils/history-transform.js +101 -19
- package/dist/esm/utils/resolve-context-budget.js +84 -0
- package/package.json +16 -16
- package/sandbox/README.md +93 -4
- package/sandbox/controls.ts +77 -10
- package/sandbox/fixtures.ts +163 -6
- package/sandbox/sandbox.css +54 -1
- package/sandbox/sandbox.ts +384 -7
|
@@ -2,7 +2,9 @@ import type { ChatAttachment, ChatDriverResult, ChatMessage, ChatToolDefinition
|
|
|
2
2
|
import type { AgentConfig } from '../../config/config';
|
|
3
3
|
import type { DiagnosticEntry } from '../../state/persistence/diagnostics';
|
|
4
4
|
import type { InteractionContext } from '../../types/interaction-context';
|
|
5
|
-
import type {
|
|
5
|
+
import type { CompactionProjection } from '../../utils/context-tokens';
|
|
6
|
+
import type { CompactionPlanOptions } from '../../utils/history-transform';
|
|
7
|
+
import type { ContextGuardPolicy, TurnSnapshot } from '../chat-driver/chat-driver';
|
|
6
8
|
/** @internal */
|
|
7
9
|
export interface AllAgentSummary {
|
|
8
10
|
name: string;
|
|
@@ -77,6 +79,16 @@ export interface AiDriver extends EventTarget {
|
|
|
77
79
|
* retain the active config implement it.
|
|
78
80
|
*/
|
|
79
81
|
getActiveAgent?(): AgentConfig | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Set the mid-loop context guard (GENC-1567). `undefined` disables it.
|
|
84
|
+
*
|
|
85
|
+
* Carries a margin rather than an absolute threshold: the window belongs to
|
|
86
|
+
* whichever provider the next call resolves to, which the driver learns during
|
|
87
|
+
* the call and the host cannot know until afterwards. The host owns the policy;
|
|
88
|
+
* the driver applies it against the model actually being addressed. Optional —
|
|
89
|
+
* only drivers that own a tool loop implement it.
|
|
90
|
+
*/
|
|
91
|
+
setContextGuard?(policy?: ContextGuardPolicy): void;
|
|
80
92
|
/**
|
|
81
93
|
* Destructively compact older conversation turns into a single
|
|
82
94
|
* `compacted-summary` message (GENC-1351 §5.7), summarizing them via the
|
|
@@ -84,15 +96,29 @@ export interface AiDriver extends EventTarget {
|
|
|
84
96
|
* success. Resolves to the created summary message, or `null` when there is
|
|
85
97
|
* nothing worth compacting or the provider cannot summarize. Optional — only
|
|
86
98
|
* drivers that own history implement it.
|
|
99
|
+
*
|
|
100
|
+
* Pass the same `options` used for {@link AiDriver.getCompactionPlan} so the
|
|
101
|
+
* action does exactly what the affordance advertised.
|
|
102
|
+
*/
|
|
103
|
+
compact?(options?: CompactionPlanOptions): Promise<ChatMessage | null>;
|
|
104
|
+
/**
|
|
105
|
+
* What compacting right now would cost and reclaim, without running the
|
|
106
|
+
* summarizer (GENC-1567) — or `null` when there is no safe cut, or the
|
|
107
|
+
* projected reclaim is not worth the call.
|
|
108
|
+
*
|
|
109
|
+
* The single source of truth for every compaction affordance: the menu's
|
|
110
|
+
* enabled state, its tooltip, the context gate's banner copy, and the action
|
|
111
|
+
* itself all read this, so none of them can promise a reclaim the action does
|
|
112
|
+
* not deliver. Optional — only history-owning drivers implement it.
|
|
87
113
|
*/
|
|
88
|
-
|
|
114
|
+
getCompactionPlan?(options?: CompactionPlanOptions): CompactionProjection | null;
|
|
89
115
|
/**
|
|
90
|
-
* Whether `compact()` would compact something right now
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
116
|
+
* Whether `compact()` would compact something right now. Convenience over
|
|
117
|
+
* {@link AiDriver.getCompactionPlan} — prefer the plan where the caller needs
|
|
118
|
+
* to say how much would be reclaimed. Optional — only history-owning drivers
|
|
119
|
+
* implement it.
|
|
94
120
|
*/
|
|
95
|
-
canCompact?(): boolean;
|
|
121
|
+
canCompact?(options?: CompactionPlanOptions): boolean;
|
|
96
122
|
/**
|
|
97
123
|
* Returns true if the driver is currently processing a request.
|
|
98
124
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/ai-driver/ai-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EACnB,MA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;IAErB;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,sBAAsB,CAAC,IAAI,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,qBAAqB,IAAI,MAAM,CAAC;IAEhC;;;;OAIG;IACH,OAAO,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,MAAM,CAAC,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -4,6 +4,8 @@ import { type ActivityBus } from '../../channel/ai-activity-bus';
|
|
|
4
4
|
import type { AgentConfig, SystemPromptInput, ToolDefinitionsInput, ToolHandlersInput } from '../../config/config';
|
|
5
5
|
import type { DiagnosticEntry } from '../../state/persistence/diagnostics';
|
|
6
6
|
import type { InteractionContext } from '../../types/interaction-context';
|
|
7
|
+
import { type CompactionProjection } from '../../utils/context-tokens';
|
|
8
|
+
import { type CompactionPlanOptions } from '../../utils/history-transform';
|
|
7
9
|
import type { AiDriver, AllAgentSummary } from '../ai-driver/ai-driver';
|
|
8
10
|
/**
|
|
9
11
|
* The `budget` payload carried on a `'budget-exhausted'` {@link ChatDriverResult}.
|
|
@@ -213,6 +215,23 @@ export interface ChatDriverConfig {
|
|
|
213
215
|
*
|
|
214
216
|
* @beta
|
|
215
217
|
*/
|
|
218
|
+
/**
|
|
219
|
+
* Mid-loop context guard policy, pushed down by the host (GENC-1567).
|
|
220
|
+
*
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
export interface ContextGuardPolicy {
|
|
224
|
+
/**
|
|
225
|
+
* How close to the model's context window a running tool loop may get before
|
|
226
|
+
* it is stopped.
|
|
227
|
+
*/
|
|
228
|
+
marginTokens: number;
|
|
229
|
+
/**
|
|
230
|
+
* Window to assume when the resolved provider reports none. Consulted only in
|
|
231
|
+
* that case — a provider that states its own window always wins.
|
|
232
|
+
*/
|
|
233
|
+
fallbackLimit?: number;
|
|
234
|
+
}
|
|
216
235
|
export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
217
236
|
private readonly providerRegistry;
|
|
218
237
|
private history;
|
|
@@ -821,6 +840,39 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
821
840
|
* Optional transform applied to conversation history immediately before each LLM request.
|
|
822
841
|
* Cleared when `undefined`. Does not alter stored history.
|
|
823
842
|
*/
|
|
843
|
+
/**
|
|
844
|
+
* Mid-loop context guard policy (GENC-1567). `undefined` disables the guard.
|
|
845
|
+
*
|
|
846
|
+
* Carries a MARGIN rather than an absolute threshold, and the difference is the
|
|
847
|
+
* whole point: the threshold depends on the window of whichever provider the
|
|
848
|
+
* next call resolves to, which the driver learns during the call and the host
|
|
849
|
+
* cannot know until afterwards. The host owns the policy; the driver applies it
|
|
850
|
+
* against the model actually being addressed.
|
|
851
|
+
*/
|
|
852
|
+
private contextGuard?;
|
|
853
|
+
/** Window of the provider the current call resolved to, if it reports one. */
|
|
854
|
+
private lastResolvedContextLimit?;
|
|
855
|
+
/**
|
|
856
|
+
* Set the mid-loop context guard. Its margin is deliberately far smaller than
|
|
857
|
+
* the reserve that blocks NEW turns: that reserve exists so an accepted turn can
|
|
858
|
+
* spend it, and a guard set at the same line would kill every turn that used
|
|
859
|
+
* the headroom it was given.
|
|
860
|
+
*/
|
|
861
|
+
setContextGuard(policy?: ContextGuardPolicy): void;
|
|
862
|
+
/**
|
|
863
|
+
* Whether issuing `requestHistory` would run the context window out.
|
|
864
|
+
*
|
|
865
|
+
* Inert unless a margin has been set AND the resolved provider reports a
|
|
866
|
+
* window — with no window there is nothing to measure against, and inventing
|
|
867
|
+
* one to refuse a request is worse than letting the provider answer.
|
|
868
|
+
*
|
|
869
|
+
* Stopping here is strictly better than letting the request go: the provider
|
|
870
|
+
* would reject an oversized prompt outright, leaving a transcript still too
|
|
871
|
+
* large to retry and no explanation the user can act on, whereas ending the
|
|
872
|
+
* turn keeps history intact so compaction is still available and the work so
|
|
873
|
+
* far is not lost.
|
|
874
|
+
*/
|
|
875
|
+
private contextExhausted;
|
|
824
876
|
setProviderHistoryTransform(transform?: (history: ChatMessage[]) => ChatMessage[]): void;
|
|
825
877
|
getHistory(): ReadonlyArray<ChatMessage>;
|
|
826
878
|
getRawHistory(): readonly ChatMessage[];
|
|
@@ -832,7 +884,16 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
832
884
|
* turns exists behind a clean boundary. Uses the same `history` `compact()`
|
|
833
885
|
* acts on, so the UI's gate can't disagree with the action (GENC-1351 follow-up).
|
|
834
886
|
*/
|
|
835
|
-
canCompact(): boolean;
|
|
887
|
+
canCompact(options?: CompactionPlanOptions): boolean;
|
|
888
|
+
/**
|
|
889
|
+
* {@inheritDoc AiDriver.getCompactionPlan}
|
|
890
|
+
*
|
|
891
|
+
* Runs against the driver's own `history` — the exact list `compact()` acts on
|
|
892
|
+
* — so a projection and the compaction it describes can never be computed from
|
|
893
|
+
* different transcripts (the GENC-1351 follow-up that first made `canCompact`
|
|
894
|
+
* read `history` rather than a mirrored copy).
|
|
895
|
+
*/
|
|
896
|
+
getCompactionPlan(options?: CompactionPlanOptions): CompactionProjection | null;
|
|
836
897
|
/**
|
|
837
898
|
* Destructively compact older turns into a single `compacted-summary` message
|
|
838
899
|
* (GENC-1351 §5.7). Summarizes everything before a clean recent-tail boundary
|
|
@@ -842,7 +903,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
842
903
|
* the new one. Returns the created summary message, or `null` when there is
|
|
843
904
|
* nothing worth compacting or the default provider cannot summarize.
|
|
844
905
|
*/
|
|
845
|
-
compact(): Promise<ChatMessage | null>;
|
|
906
|
+
compact(options?: CompactionPlanOptions): Promise<ChatMessage | null>;
|
|
846
907
|
isBusy(): boolean;
|
|
847
908
|
/**
|
|
848
909
|
* Wire a parent driver as the host for this driver's interactions. When set,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEd,cAAc,EACd,gBAAgB,EAGhB,WAAW,EAIX,cAAc,EAKd,yBAAyB,EAEzB,qBAAqB,EAGtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,
|
|
1
|
+
{"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEd,cAAc,EACd,gBAAgB,EAGhB,WAAW,EAIX,cAAc,EAKd,yBAAyB,EAEzB,qBAAqB,EAGtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EAUrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EACV,WAAW,EAKX,iBAAiB,EAKjB,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;AAgB7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,KAAK,oBAAoB,EAAyB,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAGL,KAAK,qBAAqB,EAG3B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAExE;;;GAGG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,gBAAgB,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzF,oGAAoG;AACpG,KAAK,qBAAqB,GAAG,WAAW,CACtC,OAAO,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Aa,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAyInE;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAInF;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IASjC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAS3C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwD/F;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,mBAAmB;IAoG3B;;;;;OAKG;YACW,cAAc;IAyP5B;;;OAGG;IACG,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsDrF,wFAAwF;IACxF,OAAO,CAAC,OAAO;IAKf;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+BxB,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAsChB,OAAO,CAAC,aAAa;IAQrB,8EAA8E;IAC9E,OAAO,CAAC,SAAS;IAWjB,mFAAmF;IACnF,OAAO,CAAC,2BAA2B;YAkCrB,WAAW;IAwpCzB,OAAO,CAAC,eAAe;CAoBxB"}
|
|
@@ -3,8 +3,10 @@ import type { ActivityBus } from '../../channel/ai-activity-bus';
|
|
|
3
3
|
import type { AgentConfig } from '../../config/config';
|
|
4
4
|
import type { DiagnosticEntry } from '../../state/persistence/diagnostics';
|
|
5
5
|
import type { InteractionContext } from '../../types/interaction-context';
|
|
6
|
+
import type { CompactionProjection } from '../../utils/context-tokens';
|
|
7
|
+
import type { CompactionPlanOptions } from '../../utils/history-transform';
|
|
6
8
|
import type { AiDriver, AllAgentSummary } from '../ai-driver/ai-driver';
|
|
7
|
-
import { type TurnSnapshot } from '../chat-driver/chat-driver';
|
|
9
|
+
import { type ContextGuardPolicy, type TurnSnapshot } from '../chat-driver/chat-driver';
|
|
8
10
|
/**
|
|
9
11
|
* Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
|
|
10
12
|
* and `ChatDriver`, classifying each user message and routing it to the right
|
|
@@ -104,10 +106,14 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
104
106
|
setFlowOwner(name: string | null): void;
|
|
105
107
|
loadHistory(messages: ChatMessage[]): void;
|
|
106
108
|
getRawHistory(): readonly ChatMessage[];
|
|
109
|
+
/** {@inheritDoc AiDriver.setContextGuard} */
|
|
110
|
+
setContextGuard(policy?: ContextGuardPolicy): void;
|
|
107
111
|
/** {@inheritDoc AiDriver.compact} */
|
|
108
|
-
compact(): Promise<ChatMessage | null>;
|
|
112
|
+
compact(options?: CompactionPlanOptions): Promise<ChatMessage | null>;
|
|
109
113
|
/** {@inheritDoc AiDriver.canCompact} */
|
|
110
|
-
canCompact(): boolean;
|
|
114
|
+
canCompact(options?: CompactionPlanOptions): boolean;
|
|
115
|
+
/** {@inheritDoc AiDriver.getCompactionPlan} */
|
|
116
|
+
getCompactionPlan(options?: CompactionPlanOptions): CompactionProjection | null;
|
|
111
117
|
/** Delegates to the inner {@link ChatDriver} — turns are captured there. */
|
|
112
118
|
getTurnSnapshots(): ReadonlyArray<TurnSnapshot>;
|
|
113
119
|
/** Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,C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xB;;;;;;;;;;OAUG;YACW,kBAAkB;IAuBhC;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAKd;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAmBhB,QAAQ;IA4HtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,mBAAmB;CAU5B"}
|
|
@@ -117,6 +117,22 @@ export type ProviderInput = string | ((ctx: SystemPromptContext) => string | Pro
|
|
|
117
117
|
* @beta
|
|
118
118
|
*/
|
|
119
119
|
export type TemperatureInput = number | ((ctx: SystemPromptContext) => number | Promise<number>);
|
|
120
|
+
/**
|
|
121
|
+
* Context headroom an agent reserves for itself, in tokens.
|
|
122
|
+
*
|
|
123
|
+
* A plain number, unlike the value-or-resolver shape `provider` / `temperature` /
|
|
124
|
+
* `resumable` use. The resolver form was drafted for it and removed before
|
|
125
|
+
* release: the gate is recomputed from a synchronous getter with no turn context
|
|
126
|
+
* to resolve against, so no path could ever have invoked one. Accepting a
|
|
127
|
+
* type-correct option that is guaranteed to do nothing is worse than not
|
|
128
|
+
* offering it — a warning after the fact still leaves the configuration inert.
|
|
129
|
+
*
|
|
130
|
+
* It can widen to a resolver later without breaking a caller, since every
|
|
131
|
+
* existing `number` stays valid.
|
|
132
|
+
*
|
|
133
|
+
* @beta
|
|
134
|
+
*/
|
|
135
|
+
export type ContextReserveInput = number;
|
|
120
136
|
/**
|
|
121
137
|
* Tool-call mode for an agent. Either a static `ChatToolChoice` (resolved
|
|
122
138
|
* once) or a function resolved each tool-loop iteration — pick the function form
|
|
@@ -479,6 +495,34 @@ interface BaseAgentConfig {
|
|
|
479
495
|
* @beta
|
|
480
496
|
*/
|
|
481
497
|
notResumableMessage?: string;
|
|
498
|
+
/**
|
|
499
|
+
* Tokens this agent wants kept free for one of its turns (GENC-1567).
|
|
500
|
+
* Overrides `chatConfig.context.reserveTokens` while this agent is active;
|
|
501
|
+
* leave unset to inherit it.
|
|
502
|
+
*
|
|
503
|
+
* The third member of the flow-safety group, alongside
|
|
504
|
+
* {@link BaseAgentConfig.resumable} and {@link BaseAgentConfig.notResumableMessage}:
|
|
505
|
+
* `resumable` says whether the agent may be interrupted, and this says how much
|
|
506
|
+
* room it needs so that it does not have to be. An agent whose flow runs a long
|
|
507
|
+
* tool loop, or returns large payloads, needs more than the global default.
|
|
508
|
+
*
|
|
509
|
+
* **When it takes effect.** The reserve is read from the agent that is already
|
|
510
|
+
* ACTIVE, so it governs the gate from that agent's next send onwards — one turn
|
|
511
|
+
* later than a true pre-flight. It is deliberately not enforced at flow entry:
|
|
512
|
+
* `flow-owner-changed` fires while the driver is already routing the turn, so
|
|
513
|
+
* gating there would mean aborting a turn in flight. An agent that activates
|
|
514
|
+
* mid-turn therefore gets its first turn under the global reserve; the mid-loop
|
|
515
|
+
* context guard is what stops that turn running away.
|
|
516
|
+
*
|
|
517
|
+
* **Set this from measurement, not from a guess.** Per-turn `inputTokens` is
|
|
518
|
+
* recorded for every call, so a single real run of the flow tells you its peak
|
|
519
|
+
* growth; a number invented up front will be wrong in whichever direction is
|
|
520
|
+
* least convenient. Leaving it unset and inheriting the global default is the
|
|
521
|
+
* right starting position.
|
|
522
|
+
*
|
|
523
|
+
* @beta
|
|
524
|
+
*/
|
|
525
|
+
contextReserve?: ContextReserveInput;
|
|
482
526
|
}
|
|
483
527
|
/**
|
|
484
528
|
* Configuration for a specialist agent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,kBAAkB,EAClB,cAAc,GACf,CAAC;AAEF;;;;GAIG;AACH,MAA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AAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAErE"}
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ import type { VendorBudgetFigures } from '../state/ai-assistant-slice';
|
|
|
9
9
|
import type { DebugLog } from '../state/persistence/diagnostics';
|
|
10
10
|
import type { SessionPersistenceConfig } from '../state/persistence/session-persistence-provider';
|
|
11
11
|
import type { InteractionContext } from '../types/interaction-context';
|
|
12
|
+
import { type CompactionProjection } from '../utils/context-tokens';
|
|
12
13
|
import { type CostSessionModelEntry, type CostSessionRecord } from '../utils/cost-session-history';
|
|
14
|
+
import { type ResolvedContextBudget } from '../utils/resolve-context-budget';
|
|
13
15
|
import { type ResolvedCostHistoryConfig } from '../utils/resolve-cost-history-config';
|
|
14
16
|
import type { AgentPickerMode, AiAssistantAnimation, AiAssistantState, PopoutMode, SettingsBudgetRow, SubmitMessageResult, SuggestionsState } from './main.types';
|
|
15
17
|
/** Design-system tabs element bound to the settings modal tab bar. */
|
|
@@ -1305,6 +1307,27 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1305
1307
|
sessionKeyChanged(_oldValue: string | undefined, _newValue: string | undefined): void;
|
|
1306
1308
|
disconnectedCallback(): void;
|
|
1307
1309
|
private resolveContextLimit;
|
|
1310
|
+
/**
|
|
1311
|
+
* Push the mid-loop context guard down to the driver (GENC-1567).
|
|
1312
|
+
*
|
|
1313
|
+
* Called wherever the inputs can change — the resolved provider status, and a
|
|
1314
|
+
* freshly built driver. A driver that never receives one simply runs without
|
|
1315
|
+
* the guard, which is the right default: it fires only when a real context
|
|
1316
|
+
* window is known.
|
|
1317
|
+
*/
|
|
1318
|
+
private syncContextGuard;
|
|
1319
|
+
/**
|
|
1320
|
+
* Guard policy pushed to the driver, or `undefined` when the host has switched
|
|
1321
|
+
* the gate off — so `enabled: false` really does mean no local blocking of any
|
|
1322
|
+
* kind, UI or mid-loop.
|
|
1323
|
+
*
|
|
1324
|
+
* A MARGIN, not a threshold: the driver resolves the window of the provider
|
|
1325
|
+
* each call actually goes to. The fallback window rides along because the
|
|
1326
|
+
* driver cannot learn it any other way — without it, a host that knows its
|
|
1327
|
+
* window while its provider does not report one had `fallbackContextLimit`
|
|
1328
|
+
* protecting the composer and nothing else.
|
|
1329
|
+
*/
|
|
1330
|
+
private get contextGuardPolicy();
|
|
1308
1331
|
private loadProviderStatuses;
|
|
1309
1332
|
chatConfigChanged(): void;
|
|
1310
1333
|
/**
|
|
@@ -1436,16 +1459,175 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
1436
1459
|
* clearing/compacting mid-journey would be disruptive).
|
|
1437
1460
|
*/
|
|
1438
1461
|
get sessionMenuEnabled(): boolean;
|
|
1462
|
+
/**
|
|
1463
|
+
* Whether the menu is on screen ONLY because the context gate put it there.
|
|
1464
|
+
*
|
|
1465
|
+
* @internal
|
|
1466
|
+
*/
|
|
1467
|
+
get sessionMenuForcedByContext(): boolean;
|
|
1468
|
+
/**
|
|
1469
|
+
* Whether to withhold Clear from a menu the context gate forced open.
|
|
1470
|
+
*
|
|
1471
|
+
* The hosts who hid this menu did so to protect a flow from being cleared
|
|
1472
|
+
* mid-journey, and handing someone a Clear button at the moment they are stuck
|
|
1473
|
+
* hunting for a way out is how a conversation gets destroyed by accident.
|
|
1474
|
+
*
|
|
1475
|
+
* But only **while Compact is a real escape**. When the plan says compacting
|
|
1476
|
+
* would not free enough, starting a new conversation is the only way out — and
|
|
1477
|
+
* the blocked copy says exactly that, pointing the user at this menu to do it.
|
|
1478
|
+
* Withholding Clear there would send them to a menu that does not contain the
|
|
1479
|
+
* action they were just told to take.
|
|
1480
|
+
*
|
|
1481
|
+
* @internal
|
|
1482
|
+
*/
|
|
1483
|
+
get clearWithheldByContext(): boolean;
|
|
1439
1484
|
/** The persistence toggle row renders only when a provider is configured. */
|
|
1440
1485
|
get persistenceToggleable(): boolean;
|
|
1441
1486
|
/** Whether persistence is currently active (on + a provider) for this session. */
|
|
1442
1487
|
get persistenceActive(): boolean;
|
|
1443
1488
|
/**
|
|
1444
|
-
*
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1489
|
+
* Context-headroom thresholds for the active model (GENC-1567) — the warning
|
|
1490
|
+
* and block lines, plus the tail budget compaction aims at.
|
|
1491
|
+
*
|
|
1492
|
+
* The agent's own `contextReserve` is deliberately NOT folded in here. This is
|
|
1493
|
+
* the AMBIENT budget, which protects any turn from any agent; a per-agent
|
|
1494
|
+
* reserve is an additional, larger requirement checked when that agent takes
|
|
1495
|
+
* ownership of a flow, where there is a turn context to resolve its function
|
|
1496
|
+
* form against.
|
|
1497
|
+
*
|
|
1498
|
+
* Overhead is read off `messages` (the Redux mirror) rather than the driver's
|
|
1499
|
+
* own history, which the compaction plan uses. That is safe rather than sloppy:
|
|
1500
|
+
* `estimateSystemOverhead` only looks at messages BEFORE the first usage-bearing
|
|
1501
|
+
* one, and the two lists agree completely that early — the drift between mirror
|
|
1502
|
+
* and driver history is only ever at the tail.
|
|
1503
|
+
*/
|
|
1504
|
+
get contextBudget(): ResolvedContextBudget;
|
|
1505
|
+
/**
|
|
1506
|
+
* The active agent's declared `contextReserve`, when it is a plain number.
|
|
1507
|
+
*
|
|
1508
|
+
* Read off the LIVE active agent rather than checked at flow entry, which is
|
|
1509
|
+
* where the design first put it. `flow-owner-changed` turned out to fire while
|
|
1510
|
+
* the driver is already routing the turn — after the send was allowed — so it
|
|
1511
|
+
* is not a pre-flight hook, and gating there would mean aborting a turn in
|
|
1512
|
+
* flight. Reading the active agent instead means a hungry agent's reserve
|
|
1513
|
+
* governs the gate from its next send onwards: one turn later than a true
|
|
1514
|
+
* pre-flight, but synchronous, and it never has to interrupt anything.
|
|
1515
|
+
*
|
|
1516
|
+
* `contextReserve` is a plain number by design — see `ContextReserveInput` for
|
|
1517
|
+
* why a resolver form was dropped rather than accepted and ignored.
|
|
1518
|
+
*
|
|
1519
|
+
* @internal
|
|
1520
|
+
*/
|
|
1521
|
+
private get activeAgentReserveTokens();
|
|
1522
|
+
/**
|
|
1523
|
+
* What compacting right now would reclaim, or `null` when it would not be
|
|
1524
|
+
* worth it (GENC-1567). Sized against {@link FoundationAiAssistant.contextBudget},
|
|
1525
|
+
* so the plan aims at this model's window rather than a fixed default.
|
|
1526
|
+
*
|
|
1527
|
+
* Reads `messages` to stay reactive as the conversation grows: the driver's
|
|
1528
|
+
* history is not a tracked observable, so every consumer of this keys its
|
|
1529
|
+
* re-evaluation off the Redux mirror.
|
|
1530
|
+
*/
|
|
1531
|
+
get compactionPlan(): CompactionProjection | null;
|
|
1532
|
+
/**
|
|
1533
|
+
* Tooltip and hint for the Compact row — why it is or is not available.
|
|
1534
|
+
*
|
|
1535
|
+
* Replaces a fixed "Not enough conversation yet to be worth compacting", which
|
|
1536
|
+
* since GENC-1567 could be flatly wrong: a long conversation whose tail is one
|
|
1537
|
+
* indivisible tool result has plenty of conversation and still cannot be
|
|
1538
|
+
* compacted. Reading the plan means the hint states the actual reason.
|
|
1539
|
+
*
|
|
1540
|
+
* @internal
|
|
1541
|
+
*/
|
|
1542
|
+
get compactHint(): string;
|
|
1543
|
+
/**
|
|
1544
|
+
* How close this conversation is to the model's context window (GENC-1567).
|
|
1545
|
+
*
|
|
1546
|
+
* **Derived, never latched** — the opposite of {@link FoundationAiAssistant.blocked}.
|
|
1547
|
+
* A budget wall stays set because nothing the user does fixes it; this clears
|
|
1548
|
+
* itself the moment the conversation shrinks, which is precisely what the user
|
|
1549
|
+
* is being asked to do. The two must not be conflated: `blocked` is also
|
|
1550
|
+
* deliberately preserved across `resetSession`, and a context gate obviously
|
|
1551
|
+
* must not survive starting a new chat.
|
|
1552
|
+
*
|
|
1553
|
+
* **A flow in progress is never blocked, only warned.** Machine state lives
|
|
1554
|
+
* outside the transcript, so a stateful flow is not desynced by compaction —
|
|
1555
|
+
* but the summary can still drop detail the flow's own prompt leans on, and
|
|
1556
|
+
* blocking mid-journey would strand the user between a flow they cannot finish
|
|
1557
|
+
* and a compaction that is a poor idea right there. Letting the flow complete
|
|
1558
|
+
* and gating on the way out is the lesser harm; the headroom reserve exists so
|
|
1559
|
+
* this is rare rather than routine.
|
|
1560
|
+
*/
|
|
1561
|
+
get contextGate(): 'ok' | 'warn' | 'blocked';
|
|
1562
|
+
/**
|
|
1563
|
+
* What the composer notice says about the context gate.
|
|
1564
|
+
*
|
|
1565
|
+
* The copy is a function of whether compaction can actually clear the gate,
|
|
1566
|
+
* which is why it reads {@link FoundationAiAssistant.compactionPlan} rather
|
|
1567
|
+
* than assuming. Telling someone to compact when the projection says it would
|
|
1568
|
+
* not free enough — a tail that is one indivisible tool result, say — sends
|
|
1569
|
+
* them into a summarizer call that leaves them exactly where they were.
|
|
1570
|
+
*
|
|
1571
|
+
* @internal
|
|
1572
|
+
*/
|
|
1573
|
+
get contextGateReason(): string;
|
|
1574
|
+
/**
|
|
1575
|
+
* Short label the session-menu pill wears while the gate is active — the
|
|
1576
|
+
* primary visible signal, in place of a banner.
|
|
1577
|
+
*
|
|
1578
|
+
* Borrowed from the agent pin, which is the established way this composer says
|
|
1579
|
+
* "a mode is in force": a pill that grows a label rather than a strip of prose
|
|
1580
|
+
* above the input. It states the CONDITION only; the remedy lives in the
|
|
1581
|
+
* placeholder once the composer is actually blocked, which is the moment the
|
|
1582
|
+
* user needs to be told what to do rather than merely warned.
|
|
1583
|
+
*
|
|
1584
|
+
* @internal
|
|
1585
|
+
*/
|
|
1586
|
+
get contextGateLabel(): string;
|
|
1587
|
+
/**
|
|
1588
|
+
* Whether the composer notice has anything to show — a budget wall or the
|
|
1589
|
+
* context gate. One region for both, so the live region stays single and
|
|
1590
|
+
* registered (see the banner template's accessibility note).
|
|
1591
|
+
*
|
|
1592
|
+
* @internal
|
|
1593
|
+
*/
|
|
1594
|
+
get composerNoticeVisible(): boolean;
|
|
1595
|
+
/**
|
|
1596
|
+
* Text for that region. A budget wall outranks the context gate: it is the
|
|
1597
|
+
* condition the user cannot clear, so it must not be hidden behind advice
|
|
1598
|
+
* about compacting that would not restore sending anyway.
|
|
1599
|
+
*
|
|
1600
|
+
* For the context gate the region is present and announced but not drawn — see
|
|
1601
|
+
* {@link FoundationAiAssistant.composerNoticeSrOnly}.
|
|
1602
|
+
*
|
|
1603
|
+
* @internal
|
|
1604
|
+
*/
|
|
1605
|
+
get composerNoticeText(): string;
|
|
1606
|
+
/**
|
|
1607
|
+
* Whether the notice region should be announced but not drawn.
|
|
1608
|
+
*
|
|
1609
|
+
* The context gate shows itself visually through the pill's label, the
|
|
1610
|
+
* composer outline and the placeholder — a strip of prose on top of those
|
|
1611
|
+
* would be a fourth statement of the same thing. But dropping the region
|
|
1612
|
+
* outright would be an accessibility regression, and a documented one: a
|
|
1613
|
+
* `role="status"` region announces MUTATIONS to a region already being
|
|
1614
|
+
* observed, and it is the only announcement available here, because the
|
|
1615
|
+
* composer flips to `disabled` at the same moment and a disabled control is out
|
|
1616
|
+
* of the tab order — so neither the placeholder nor an `aria-label` on it is
|
|
1617
|
+
* ever voiced.
|
|
1618
|
+
*
|
|
1619
|
+
* So the region stays mounted, keeps its text and keeps announcing; only the
|
|
1620
|
+
* visual treatment is withheld. A budget wall still draws its banner, because
|
|
1621
|
+
* that condition has no other visible expression.
|
|
1622
|
+
*
|
|
1623
|
+
* @internal
|
|
1624
|
+
*/
|
|
1625
|
+
get composerNoticeSrOnly(): boolean;
|
|
1626
|
+
/**
|
|
1627
|
+
* Whether the menu's "Compact" action would do anything (GENC-1351 §5.7,
|
|
1628
|
+
* GENC-1567). Delegates to the driver's plan so the gate uses the exact same
|
|
1629
|
+
* history `compact()` acts on, judged against the same budget — one source of
|
|
1630
|
+
* truth for both whether a cut is legal and whether it reclaims enough.
|
|
1449
1631
|
*/
|
|
1450
1632
|
get compactable(): boolean;
|
|
1451
1633
|
toggleSessionMenu(): void;
|