@genesislcap/ai-assistant 15.6.2 → 15.7.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/ai-assistant.api.json +422 -6
- package/dist/ai-assistant.d.ts +654 -19
- package/dist/chat-driver.cjs +285 -26
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +285 -26
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +289 -32
- package/dist/dts/channel/ai-activity-channel.d.ts +51 -1
- package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +99 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.test.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts +2 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts.map +1 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +14 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
- package/dist/dts/main/blocked-state.test.d.ts +2 -0
- package/dist/dts/main/blocked-state.test.d.ts.map +1 -0
- package/dist/dts/main/main.d.ts +435 -19
- 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.styles.test.d.ts +2 -0
- package/dist/dts/main/main.styles.test.d.ts.map +1 -0
- package/dist/dts/main/main.template.d.ts +53 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/state/ai-assistant-slice.d.ts +162 -6
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +6 -1
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts +11 -0
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/dts/utils/banked-usage-baselines.d.ts +51 -0
- package/dist/dts/utils/banked-usage-baselines.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +263 -21
- package/dist/esm/components/chat-driver/chat-driver.test.js +464 -1
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.budget.test.js +312 -0
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +89 -4
- package/dist/esm/components/settings-modal/settings-modal.styles.js +63 -18
- package/dist/esm/components/settings-modal/settings-modal.template.js +36 -7
- package/dist/esm/main/blocked-state.test.js +969 -0
- package/dist/esm/main/cost-session-banking.test.js +238 -8
- package/dist/esm/main/main.js +826 -48
- package/dist/esm/main/main.styles.js +72 -0
- package/dist/esm/main/main.styles.test.js +99 -0
- package/dist/esm/main/main.template.js +121 -4
- package/dist/esm/state/ai-assistant-slice.js +145 -7
- package/dist/esm/state/ai-assistant-slice.test.js +138 -1
- package/dist/esm/state/debug-event-log.js +7 -2
- package/dist/esm/state/debug-event-log.test.js +49 -1
- package/dist/esm/state/persistence/session-snapshot.test.js +18 -0
- package/dist/esm/utils/banked-usage-baselines.js +84 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/migration-GENC-1464.md +562 -0
- package/docs/sub_agent.md +20 -3
- package/package.json +17 -17
- package/src/channel/ai-activity-channel.ts +56 -2
- package/src/components/chat-driver/chat-driver.test.ts +549 -0
- package/src/components/chat-driver/chat-driver.ts +324 -14
- package/src/components/orchestrating-driver/orchestrating-driver.budget.test.ts +438 -0
- package/src/components/orchestrating-driver/orchestrating-driver.ts +101 -6
- package/src/components/settings-modal/settings-modal.styles.ts +63 -18
- package/src/components/settings-modal/settings-modal.template.ts +38 -7
- package/src/main/blocked-state.test.ts +1316 -0
- package/src/main/cost-session-banking.test.ts +283 -11
- package/src/main/main.styles.test.ts +130 -0
- package/src/main/main.styles.ts +72 -0
- package/src/main/main.template.ts +131 -4
- package/src/main/main.ts +827 -42
- package/src/state/ai-assistant-slice.test.ts +215 -0
- package/src/state/ai-assistant-slice.ts +218 -8
- package/src/state/debug-event-log.test.ts +63 -0
- package/src/state/debug-event-log.ts +7 -2
- package/src/state/persistence/session-snapshot.test.ts +22 -0
- package/src/utils/banked-usage-baselines.ts +90 -0
|
@@ -16,6 +16,59 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { ViewTemplate } from '@genesislcap/web-core';
|
|
18
18
|
import type { FoundationAiAssistant } from './main';
|
|
19
|
+
/**
|
|
20
|
+
* Class list for the banner below, joined rather than interpolated so an
|
|
21
|
+
* inapplicable modifier contributes nothing. Two interpolations directly in the
|
|
22
|
+
* attribute emitted `class="blocked-banner "` in the common (unblocked) case —
|
|
23
|
+
* harmless to the browser, but it shows up in every DOM snapshot and every
|
|
24
|
+
* innerHTML assertion a host writes against this element.
|
|
25
|
+
*
|
|
26
|
+
* The two modifiers name what they actually gate, which is why neither is
|
|
27
|
+
* `is-blocked`: `is-visible` means the banner has something to say, and that
|
|
28
|
+
* includes PARTIAL exhaustion — one vendor walled, composer still live, `blocked`
|
|
29
|
+
* false. `is-partial` then softens the treatment for exactly that case. Naming
|
|
30
|
+
* the first after `blocked` read as a contradiction beside the second, and made
|
|
31
|
+
* the styles say `.blocked-banner.is-blocked` to mean "visible".
|
|
32
|
+
*
|
|
33
|
+
* Exported for the unit test that pins the attribute; not part of the element
|
|
34
|
+
* API.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare const blockedBannerClasses: (x: FoundationAiAssistant) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Id of the blocked banner, referenced by the composer controls'
|
|
41
|
+
* `aria-describedby`. Shadow-DOM-scoped, so a fixed string cannot collide with
|
|
42
|
+
* the host page — and IDREF resolution is same-root, which is exactly where both
|
|
43
|
+
* ends of this reference live.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare const BLOCKED_BANNER_ID = "blocked-banner";
|
|
48
|
+
/**
|
|
49
|
+
* `aria-describedby` for the composer's textarea, send button and attach button:
|
|
50
|
+
* the banner's id whenever the banner has something to say, otherwise `null` (so
|
|
51
|
+
* the attribute is omitted rather than emitted empty).
|
|
52
|
+
*
|
|
53
|
+
* Keyed on `bannerVisible`, NOT on `blocked`, and that is the point. The
|
|
54
|
+
* PARTIAL state — some vendor walled, composer still live — is the state this
|
|
55
|
+
* feature exists to create, and it was the one state with no accessible
|
|
56
|
+
* explanation at all: `aria-disabled` and `aria-label` bind only on `blocked`, and
|
|
57
|
+
* a live composer keeps the host's own placeholder, so a screen-reader user
|
|
58
|
+
* arriving at the textarea heard "Type a message" with no hint that the next turn
|
|
59
|
+
* might be refused. The banner's `role="status"` announces the text when it
|
|
60
|
+
* CHANGES; this is what makes the same explanation reachable afterwards, on
|
|
61
|
+
* demand, from the control it is about.
|
|
62
|
+
*
|
|
63
|
+
* Applied in the fully blocked state too, where it is additive: the `aria-label`
|
|
64
|
+
* there states the reason as the control's name, and this restates it as its
|
|
65
|
+
* description for the send/attach buttons, which carry neither.
|
|
66
|
+
*
|
|
67
|
+
* Exported for the unit test that pins it; not part of the element API.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare const composerDescribedBy: (x: FoundationAiAssistant) => string | null;
|
|
19
72
|
/** @internal */
|
|
20
73
|
export declare const FoundationAiAssistantTemplate: (designSystemPrefix: string) => ViewTemplate<FoundationAiAssistant>;
|
|
21
74
|
//# sourceMappingURL=main.template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EAAuC,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EAAuC,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAyPpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,qBAAqB,KAAG,MAOlD,CAAC;AAEf;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,qBAAqB,KAAG,MAAM,GAAG,IAC5B,CAAC;AAoD7C,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CAwhBpC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AggregateUsage, AIProviderRegistryStatusEntry, ChatInputDuringExecutionMode, ChatMessage } from '@genesislcap/foundation-ai';
|
|
1
|
+
import type { AggregateUsage, AIProviderRegistryStatusEntry, AIProviderType, ChatInputDuringExecutionMode, ChatMessage } from '@genesislcap/foundation-ai';
|
|
2
2
|
import type { PayloadAction } from '@genesislcap/foundation-redux';
|
|
3
3
|
import type { AgentConfig } from '../config/config';
|
|
4
4
|
import type { AiAssistantAnimation, AiAssistantState, SuggestionsState } from '../main/main.types';
|
|
@@ -53,6 +53,10 @@ export interface AiAssistantSessionState {
|
|
|
53
53
|
* Snapshot of every registered provider's status, in registration order.
|
|
54
54
|
* Populated on connect (or on settings-open if not yet loaded) and reused
|
|
55
55
|
* for the lifetime of the session — provider registration is static.
|
|
56
|
+
*
|
|
57
|
+
* Describes the registry rather than the conversation, so it survives
|
|
58
|
+
* {@link resetSession} ("Clear" / "New chat"); see the reasoning there. Only
|
|
59
|
+
* a registry change (via the observable-registry subscription) rewrites it.
|
|
56
60
|
*/
|
|
57
61
|
providerStatuses: AIProviderRegistryStatusEntry[];
|
|
58
62
|
activeAgent: Omit<AgentConfig, 'toolHandlers'> | undefined;
|
|
@@ -108,6 +112,66 @@ export interface AiAssistantSessionState {
|
|
|
108
112
|
* being clobbered** when the restored history loads.
|
|
109
113
|
*/
|
|
110
114
|
restoring: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the assistant is **blocked by a backend condition** and cannot send
|
|
117
|
+
* at all — today, an exhausted AI-spend budget (GENC-1464). Unlike `compacting`
|
|
118
|
+
* and `restoring`, which are short-lived in-flight flags that clear
|
|
119
|
+
* themselves, this is a **latched** state: nothing the user or the element
|
|
120
|
+
* does clears it, because nothing they can do fixes it. It stays set until the
|
|
121
|
+
* host writes `blocked = false` (typically after a fresh pre-flight shows
|
|
122
|
+
* budget available again).
|
|
123
|
+
*
|
|
124
|
+
* Also unlike those two, it does **not** replace the transcript — the user
|
|
125
|
+
* keeps their conversation and gets a banner above a disabled composer.
|
|
126
|
+
*
|
|
127
|
+
* In the slice so the banner + input-disable stay in sync across pop-in/out.
|
|
128
|
+
* Preserved across `resetSession` ("Clear" / "New chat"): starting a new chat
|
|
129
|
+
* does not refill the budget.
|
|
130
|
+
*
|
|
131
|
+
* **Vendor-agnostic.** Under per-vendor budgets this means "blocked whatever
|
|
132
|
+
* vendor you use" — a host-set block, or a wall that could not be attributed
|
|
133
|
+
* to a vendor. A wall that WAS attributed lands in
|
|
134
|
+
* {@link AiAssistantSessionState.blockedVendors} instead, and the element
|
|
135
|
+
* derives its public `blocked` from the two together.
|
|
136
|
+
*/
|
|
137
|
+
blocked: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Host- or driver-supplied explanation shown in the blocked banner. `null`
|
|
140
|
+
* falls back to the element's default copy. Meaningless while
|
|
141
|
+
* {@link AiAssistantSessionState.blocked} is false.
|
|
142
|
+
*/
|
|
143
|
+
blockedReason: string | null;
|
|
144
|
+
/**
|
|
145
|
+
* Vendors walled by the AI-spend budget (GENC-1464 per-vendor), in the order they
|
|
146
|
+
* were walled.
|
|
147
|
+
*
|
|
148
|
+
* An **array**, not a `Set` and not one `Record<AIProviderType, {...}>`:
|
|
149
|
+
* a `Set` is neither plain JSON for the redux store nor structured-cloneable
|
|
150
|
+
* across the tab channel; the order is what the multi-vendor banner copy
|
|
151
|
+
* ("Anthropic and Gemini") reads; and a combined record would conflate "not
|
|
152
|
+
* walled" with "walled, no reason".
|
|
153
|
+
*
|
|
154
|
+
* Empty for every host that never adopts the per-vendor API — which is what
|
|
155
|
+
* makes the element's derived `blocked` byte-identical to the old stored one.
|
|
156
|
+
*/
|
|
157
|
+
blockedVendors: AIProviderType[];
|
|
158
|
+
/**
|
|
159
|
+
* The subset of {@link AiAssistantSessionState.blockedVendors} walled by the
|
|
160
|
+
* `otherVendorAvailable: false` SWEEP rather than by a refusal of their own.
|
|
161
|
+
* Provenance, not a second wall list: for locking, `blockedVendors` remains
|
|
162
|
+
* the whole truth. The distinction exists for the banner's unknown-reachability
|
|
163
|
+
* fallback — a refusal is a fact about a vendor the user just used and is
|
|
164
|
+
* nameable anywhere; a sweep entry is a headroom fact about the PROXY, and
|
|
165
|
+
* naming it before the statuses reveal whether the host even ships that vendor
|
|
166
|
+
* put a vendor in front of the user that may not be theirs.
|
|
167
|
+
*/
|
|
168
|
+
sweptVendors: AIProviderType[];
|
|
169
|
+
/**
|
|
170
|
+
* Per-vendor banner copy, keyed by a member of
|
|
171
|
+
* {@link AiAssistantSessionState.blockedVendors}. A missing entry falls back to
|
|
172
|
+
* copy composed from the vendor's display name.
|
|
173
|
+
*/
|
|
174
|
+
blockedVendorReasons: Partial<Record<AIProviderType, string>>;
|
|
111
175
|
/** Draft text in the input box — preserved across pop-in/pop-out cycles. */
|
|
112
176
|
inputValue: string;
|
|
113
177
|
/** Live trace from a currently-executing sub-agent. Cleared on sub-agent-stop. */
|
|
@@ -169,6 +233,68 @@ export declare const aiAssistantSlice: import("@reduxjs/toolkit").Slice<AiAssist
|
|
|
169
233
|
setSessionMenuOpen(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<boolean>): void;
|
|
170
234
|
setCompacting(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<boolean>): void;
|
|
171
235
|
setRestoring(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<boolean>): void;
|
|
236
|
+
/**
|
|
237
|
+
* Latch (or release) the backend-blocked state.
|
|
238
|
+
*
|
|
239
|
+
* `reason` is only meaningful while blocking, and it distinguishes three
|
|
240
|
+
* cases rather than two:
|
|
241
|
+
*
|
|
242
|
+
* - **omitted** — a re-latch that leaves the existing explanation intact.
|
|
243
|
+
* Load-bearing: the block has two writers (the host, and the driver's
|
|
244
|
+
* automatic latch), and the driver's write lands AFTER a bus-subscribed
|
|
245
|
+
* host has already set its own detailed copy. Treating "no reason" as
|
|
246
|
+
* "clear the reason" made that sequence replace the host's figures with
|
|
247
|
+
* generic copy every time, deterministically.
|
|
248
|
+
* - **a string** — replaces the explanation.
|
|
249
|
+
* - **`null`** — explicitly clears the explanation while staying blocked;
|
|
250
|
+
* the banner falls back to the element's default copy.
|
|
251
|
+
*
|
|
252
|
+
* Unblocking always clears it, so a stale explanation can never outlive the
|
|
253
|
+
* condition it described.
|
|
254
|
+
*
|
|
255
|
+
* Unblocking **also clears every per-vendor latch**, and that is the single
|
|
256
|
+
* rule that keeps per-vendor budgets non-breaking. A host asserting "the wall
|
|
257
|
+
* is gone" (the documented pre-flight, migration-GENC-1464 Option B) must not be
|
|
258
|
+
* silently overruled by a driver latch it cannot see; without this, the same
|
|
259
|
+
* `setBlocked(false)` that used to unblock would leave the composer locked.
|
|
260
|
+
*/
|
|
261
|
+
setBlocked(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<{
|
|
262
|
+
blocked: boolean;
|
|
263
|
+
reason?: string | null;
|
|
264
|
+
}>): void;
|
|
265
|
+
/**
|
|
266
|
+
* Write the banner explanation without touching the flag.
|
|
267
|
+
*
|
|
268
|
+
* Separate from {@link setBlocked} rather than expressed as
|
|
269
|
+
* `setBlocked({ blocked: current, reason })`, because the element's public
|
|
270
|
+
* `blocked` is now DERIVED: re-latching with the derived value would pass
|
|
271
|
+
* `false` for a partially-walled session and so clear every per-vendor latch
|
|
272
|
+
* as a side effect of setting a string.
|
|
273
|
+
*/
|
|
274
|
+
setBlockedReason(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string | null>): void;
|
|
275
|
+
/**
|
|
276
|
+
* Wall (or release) a single vendor's budget.
|
|
277
|
+
*
|
|
278
|
+
* The `reason` trichotomy mirrors {@link setBlocked}'s exactly, and for the
|
|
279
|
+
* same reason: the same two-writer race (the driver's latch landing after a
|
|
280
|
+
* bus-subscribed host has written its own copy) applies per vendor.
|
|
281
|
+
*
|
|
282
|
+
* Adding an already-walled vendor is idempotent — the array is a set with an
|
|
283
|
+
* order, so the vendor keeps the position it was first walled at.
|
|
284
|
+
*/
|
|
285
|
+
setVendorBlocked(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<{
|
|
286
|
+
vendor: AIProviderType;
|
|
287
|
+
blocked: boolean;
|
|
288
|
+
reason?: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* Marks the wall as SWEEP-derived (see `sweptVendors`). Only the
|
|
291
|
+
* element's `otherVendorAvailable: false` sweep passes `true`; a host
|
|
292
|
+
* call or a refusal latch leaves it unset, which also UPGRADES a
|
|
293
|
+
* previously swept vendor — a refusal (or an explicit host statement)
|
|
294
|
+
* is nameable evidence, and first-hand evidence beats the verdict.
|
|
295
|
+
*/
|
|
296
|
+
swept?: boolean;
|
|
297
|
+
}>): void;
|
|
172
298
|
setInputValue(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string>): void;
|
|
173
299
|
setLiveSubAgentTrace(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<ChatMessage[]>): void;
|
|
174
300
|
setLiveSubAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<string | null>): void;
|
|
@@ -185,11 +311,41 @@ export declare const aiAssistantSlice: import("@reduxjs/toolkit").Slice<AiAssist
|
|
|
185
311
|
loadSession(state: import("immer").WritableDraft<AiAssistantSessionState>, action: PayloadAction<LoadSessionPayload>): void;
|
|
186
312
|
/**
|
|
187
313
|
* Wipe the session back to a fresh default — the "Clear" / "New chat" action.
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
314
|
+
*
|
|
315
|
+
* Three categories survive, for three different reasons — keep them distinct:
|
|
316
|
+
*
|
|
317
|
+
* 1. The user's **display preferences** (tool-call / thinking / narration /
|
|
318
|
+
* agent-switch visibility + animations). They are settings, not
|
|
319
|
+
* conversation state, and are persisted independently of the snapshot
|
|
320
|
+
* (GENC-1351). Without this they'd flip to their all-off defaults in the
|
|
321
|
+
* live store on Clear, since `clearSession` re-applies no baseline and the
|
|
322
|
+
* idempotent setters suppress a re-apply.
|
|
323
|
+
* 2. The **backend block** (`blocked` / `blockedReason`, and the per-vendor
|
|
324
|
+
* latches beside them). Not a preference at
|
|
325
|
+
* all — a standing backend condition that Clear cannot change. It is here
|
|
326
|
+
* because starting a new chat does not refill the AI budget, so clearing
|
|
327
|
+
* it would hand the user a working-looking composer that fails on the very
|
|
328
|
+
* next send.
|
|
329
|
+
* 3. The **provider statuses**. They describe the REGISTRY, not the
|
|
330
|
+
* conversation — provider registration is static for the store's lifetime
|
|
331
|
+
* and this snapshot is refreshed from the registry, never from a turn. They
|
|
332
|
+
* are session state only because that is where the element's store lives.
|
|
333
|
+
*
|
|
334
|
+
* Dropping them on Clear is not cosmetic: the element derives `blocked`
|
|
335
|
+
* from "every REACHABLE vendor is walled", and an empty reachable set fails
|
|
336
|
+
* safe to "blocked". So wiping the statuses while keeping the per-vendor
|
|
337
|
+
* latches (category 2) escalated one walled vendor out of two into a fully
|
|
338
|
+
* locked composer, and nothing reloads them — `loadProviderStatuses()` runs
|
|
339
|
+
* only on connect/session-switch and from the observable-registry
|
|
340
|
+
* subscription, so a host with a static registry stayed locked until a
|
|
341
|
+
* remount. Preserving is the fix rather than re-loading after reset,
|
|
342
|
+
* because the reload is async: it would still flash a fully locked composer
|
|
343
|
+
* for a turn of the event loop, and would break a host whose registry is
|
|
344
|
+
* immutable (nothing to re-listen to) or whose `listStatuses()` rejects.
|
|
345
|
+
*
|
|
346
|
+
* Stated separately so a future contributor deciding what belongs in this
|
|
347
|
+
* list does not "tidy" the block out on the grounds that it is not a display
|
|
348
|
+
* preference.
|
|
193
349
|
*/
|
|
194
350
|
resetSession(state: import("immer").WritableDraft<AiAssistantSessionState>): void;
|
|
195
351
|
}, "aiAssistant", "aiAssistant", {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-assistant-slice.d.ts","sourceRoot":"","sources":["../../../src/state/ai-assistant-slice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGnG;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAA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CAAC;iGAGzB,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC;mGAG1B,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC;8FAGjC,aAAa,CAAC,OAAO,CAAC;8FAGtB,aAAa,CAAC,OAAO,CAAC;yFAG3B,aAAa,CAAC,OAAO,CAAC;wFAGvB,aAAa,CAAC,OAAO,CAAC;IAGlD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;sFACuB,aAAa,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAWrF;;;;;;;;OAQG;4FAC6B,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC;IAG5D;;;;;;;;;OASG;4FAGO,aAAa,CAAC;QACpB,MAAM,EAAE,cAAc,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB;;;;;;WAMG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;yFA2ByB,aAAa,CAAC,MAAM,CAAC;gGAGd,aAAa,CAAC,WAAW,EAAE,CAAC;+FAG7B,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC;4FAG/B,aAAa,CAAC,aAAa,CAAC;+FAGzB,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAGhE;;;;;OAKG;uFACwB,aAAa,CAAC,kBAAkB,CAAC;IAkB5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;;oCAwBL,CAAC"}
|
|
@@ -112,7 +112,12 @@ export declare function clearSession(key: string): void;
|
|
|
112
112
|
* Human/agent-facing guide emitted as the first key of the exported debug log,
|
|
113
113
|
* so whoever opens the JSON (often an AI agent) knows how to read it without
|
|
114
114
|
* reverse-engineering the shape. Kept here next to the event catalogue it
|
|
115
|
-
* describes
|
|
115
|
+
* describes — but proximity alone demonstrably did NOT keep the two in sync
|
|
116
|
+
* (`refusal` was missing from both reason lists for a whole release), so
|
|
117
|
+
* `debug-event-log.test.ts` now asserts that every `TurnFailureReason` and every
|
|
118
|
+
* `SubAgentFailureReason` is named here, and fails the build when one is added
|
|
119
|
+
* without a matching sentence. Enumerations below read as exhaustive and WILL be
|
|
120
|
+
* trusted by an agent reading the JSON — keep them so.
|
|
116
121
|
*/
|
|
117
122
|
export declare const DEBUG_LOG_README: readonly string[];
|
|
118
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAErB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GAEjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAEhB,eAAe,GACf,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GAEjB,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GAEnB,uBAAuB,GACvB,sBAAsB,GAEtB,6BAA6B,GAE7B,iBAAiB,GACjB,2BAA2B,GAC3B,mBAAmB,GACnB,mBAAmB,GAEnB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GAEpB,iBAAiB,GACjB,kBAAkB,GAClB,yBAAyB,GACzB,qBAAqB,GACrB,mBAAmB,GACnB,wBAAwB,GACxB,2BAA2B,GAC3B,sBAAsB,GACtB,4BAA4B,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;GASG;AACH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ED
|
|
1
|
+
{"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAErB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GAEjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAEhB,eAAe,GACf,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GAEjB,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GAEnB,uBAAuB,GACvB,sBAAsB,GAEtB,6BAA6B,GAE7B,iBAAiB,GACjB,2BAA2B,GAC3B,mBAAmB,GACnB,mBAAmB,GAEnB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GAEpB,iBAAiB,GACjB,kBAAkB,GAClB,yBAAyB,GACzB,qBAAqB,GACrB,mBAAmB,GACnB,wBAAwB,GACxB,2BAA2B,GAC3B,sBAAsB,GACtB,4BAA4B,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,aAAa,EAAE,mBAAmB,CA4C5E,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACxB,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,aAAa,CAAC;IACpB,6EAA6E;IAC7E,UAAU,EAAE,mBAAmB,CAAC;IAChC,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAmBD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAyBN;AAED;;;;;;;;GAQG;AACH,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAEN;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAEN;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAEnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CA0BrF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAc7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -23,6 +23,17 @@ declare function makeStore(devTools: boolean | undefined): import("@genesislcap/
|
|
|
23
23
|
setSessionMenuOpen(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<boolean>): void;
|
|
24
24
|
setCompacting(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<boolean>): void;
|
|
25
25
|
setRestoring(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<boolean>): void;
|
|
26
|
+
setBlocked(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<{
|
|
27
|
+
blocked: boolean;
|
|
28
|
+
reason?: string | null;
|
|
29
|
+
}>): void;
|
|
30
|
+
setBlockedReason(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string | null>): void;
|
|
31
|
+
setVendorBlocked(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<{
|
|
32
|
+
vendor: import("@genesislcap/foundation-ai").AIProviderType;
|
|
33
|
+
blocked: boolean;
|
|
34
|
+
reason?: string | null;
|
|
35
|
+
swept?: boolean;
|
|
36
|
+
}>): void;
|
|
26
37
|
setInputValue(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string>): void;
|
|
27
38
|
setLiveSubAgentTrace(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<import("@genesislcap/foundation-ai").ChatMessage[]>): void;
|
|
28
39
|
setLiveSubAgentName(state: import("immer").WritableDraft<AiAssistantSessionState>, action: import("@reduxjs/toolkit").PayloadAction<string | null>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/state/session-store.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAIvD,iBAAS,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS
|
|
1
|
+
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/state/session-store.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAIvD,iBAAS,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;cA6C+wa,CAAC;;;;;;cAAggD,CAAC;aAAob,CAAC;;;;;;;;;;;wCAvCrve;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAMnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AggregateUsage } from '@genesislcap/foundation-ai';
|
|
2
|
+
/**
|
|
3
|
+
* The baseline resolved for `key`, or `undefined` when this session has not resolved one yet.
|
|
4
|
+
*
|
|
5
|
+
* `undefined` rather than an empty usage: "nothing banked" is a legitimate resolved value (a
|
|
6
|
+
* project's first ever session), and it must not be mistaken for "not resolved", or every write
|
|
7
|
+
* would re-derive and hit the double-count above.
|
|
8
|
+
*
|
|
9
|
+
* Returns a copy — see `setBankedBaseline` for why both ends of this map are cloned.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function getBankedBaseline(key: string): AggregateUsage | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Record the baseline for `key`, replacing any previous one.
|
|
16
|
+
*
|
|
17
|
+
* Stores a copy, and `getBankedBaseline` hands back a copy, so nothing outside this module can
|
|
18
|
+
* reach the object the map holds. Both ends have to clone, because a baseline is aliased at both:
|
|
19
|
+
* `resolveBankedUsage` returns a *reference into a ledger row* (`row.banked` or `row.usage`),
|
|
20
|
+
* which is what gets stored here, and the caller then assigns what it reads back onto the NEXT
|
|
21
|
+
* row's `banked` field. Uncloned, one object is reachable from page-global state, two rows, and —
|
|
22
|
+
* since the row list is public and gets handed to a host's `saveCostHistory` — from host code.
|
|
23
|
+
* Whoever mutated it would silently rewrite this project's baseline for the rest of the page.
|
|
24
|
+
*
|
|
25
|
+
* A shallow spread is a complete copy: `AggregateUsage` is five flat numbers, no nested state.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function setBankedBaseline(key: string, usage: AggregateUsage): void;
|
|
30
|
+
/**
|
|
31
|
+
* Drop the baseline for `key`, so the next write re-derives it from the ledger rows.
|
|
32
|
+
*
|
|
33
|
+
* For when the pairing is broken deliberately at the *row* end — the row this baseline came from
|
|
34
|
+
* has been deleted, or the whole ledger cleared — and for a session teardown, where the store
|
|
35
|
+
* (and with it the transcript) is disposed and a later return re-restores from scratch.
|
|
36
|
+
*
|
|
37
|
+
* NOT for a mid-session reload of the rows: those rows already include this session's own
|
|
38
|
+
* upserts, so re-deriving from them folds the live transcript into its own baseline.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare function deleteBankedBaseline(key: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Forget every baseline — the page-load boundary, which production gets for free from module
|
|
45
|
+
* state dying with the realm. Exists so tests can model separate page loads (and so one test's
|
|
46
|
+
* session key cannot leak a baseline into the next).
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function resetBankedBaselines(): void;
|
|
51
|
+
//# sourceMappingURL=banked-usage-baselines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banked-usage-baselines.d.ts","sourceRoot":"","sources":["../../../src/utils/banked-usage-baselines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA6BjE;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAGzE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAE1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|