@genesislcap/ai-assistant 15.27.0-agent-log-submit.3 → 15.27.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 +77 -838
- package/dist/ai-assistant.d.ts +23 -179
- package/dist/chat-driver.cjs +13 -14
- package/dist/chat-driver.cjs.map +2 -2
- package/dist/chat-driver.mjs +13 -14
- package/dist/chat-driver.mjs.map +2 -2
- package/dist/custom-elements.json +17 -454
- package/dist/dts/components/ai-driver/ai-driver.d.ts +11 -12
- package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
- package/dist/dts/components/ai-driver/stub-driver.d.ts +17 -0
- package/dist/dts/components/ai-driver/stub-driver.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +10 -11
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +2 -2
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.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 +0 -8
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
- package/dist/dts/index.d.ts +0 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +0 -148
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/esm/components/ai-driver/stub-driver.js +16 -0
- package/dist/esm/components/chat-driver/chat-driver.js +11 -12
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +5 -5
- package/dist/esm/components/settings-modal/settings-modal.js +0 -1
- package/dist/esm/components/settings-modal/settings-modal.styles.js +5 -85
- package/dist/esm/components/settings-modal/settings-modal.template.js +23 -167
- package/dist/esm/main/main.js +20 -444
- package/dist/esm/state/persistence/session-persister.js +20 -20
- package/docs/migration-GENC-1580.md +108 -58
- package/package.json +16 -16
- package/dist/dts/utils/resolve-debug-log-note.d.ts +0 -25
- package/dist/dts/utils/resolve-debug-log-note.d.ts.map +0 -1
- package/dist/esm/utils/resolve-debug-log-note.js +0 -37
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -760,12 +760,10 @@ export declare interface AiDriver extends EventTarget {
|
|
|
760
760
|
* (keyed by agent name) is handed to that agent's `onActivate`/`init` as
|
|
761
761
|
* `ctx.restored` on its next activation, then consumed.
|
|
762
762
|
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
* is exported and `@beta`, so requiring it would break any third party implementing it. The `?`
|
|
766
|
-
* comes off with the `installAgent` rename, which is the ticket's one breaking release.
|
|
763
|
+
* Required since GENC-1580's breaking release: every driver owns an `AgentSession`, so both
|
|
764
|
+
* shipped drivers implement it and a host no longer has to feature-detect before restoring.
|
|
767
765
|
*/
|
|
768
|
-
primeRestoredAgentState
|
|
766
|
+
primeRestoredAgentState(snapshots: Record<string, unknown>): void;
|
|
769
767
|
/**
|
|
770
768
|
* Return the full, unredacted conversation history.
|
|
771
769
|
*/
|
|
@@ -784,10 +782,10 @@ export declare interface AiDriver extends EventTarget {
|
|
|
784
782
|
* which may mint fresh, never-activated configs.
|
|
785
783
|
*
|
|
786
784
|
* `undefined` means no agent is active (before the first activation, after a release), which is
|
|
787
|
-
* a different statement from the driver not being able to answer
|
|
788
|
-
*
|
|
785
|
+
* a different statement from the driver not being able to answer — and since GENC-1580's
|
|
786
|
+
* breaking release the second case cannot arise, because the method is required.
|
|
789
787
|
*/
|
|
790
|
-
getActiveAgent
|
|
788
|
+
getActiveAgent(): AgentConfig | undefined;
|
|
791
789
|
/**
|
|
792
790
|
* Pin routing to an agent by name, or `null` for automatic routing. A pin is sticky: it
|
|
793
791
|
* survives a stateful flow completing, so the next turn starts fresh on the same agent.
|
|
@@ -796,18 +794,19 @@ export declare interface AiDriver extends EventTarget {
|
|
|
796
794
|
* belongs to the session, which outlives the question of which driver holds it.
|
|
797
795
|
*
|
|
798
796
|
* Added to the interface in GENC-1580 — it was previously reached by narrowing to
|
|
799
|
-
* `OrchestratingDriver` with `instanceof`.
|
|
797
|
+
* `OrchestratingDriver` with `instanceof`. Required since that ticket's breaking release.
|
|
800
798
|
*/
|
|
801
|
-
setPinnedAgent
|
|
799
|
+
setPinnedAgent(name: string | null): void;
|
|
802
800
|
/**
|
|
803
801
|
* Set the transient flow lock — used to restore state on driver reconstruction (agents-array
|
|
804
802
|
* changes, pop-in/pop-out), **not** to steer routing; that is
|
|
805
803
|
* {@link AiDriver.setPinnedAgent}'s job. Writes without firing lifecycle hooks, because the
|
|
806
804
|
* flow it names is already running.
|
|
807
805
|
*
|
|
808
|
-
* Added to the interface in GENC-1580, as for {@link AiDriver.setPinnedAgent}
|
|
806
|
+
* Added to the interface in GENC-1580, as for {@link AiDriver.setPinnedAgent}, and required
|
|
807
|
+
* since that ticket's breaking release.
|
|
809
808
|
*/
|
|
810
|
-
setFlowOwner
|
|
809
|
+
setFlowOwner(name: string | null): void;
|
|
811
810
|
/**
|
|
812
811
|
* Headroom the next turn could need, and which agent set that requirement
|
|
813
812
|
* (GENC-1582). `undefined` when no agent the turn could land on declares a
|
|
@@ -1541,7 +1540,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1541
1540
|
private turnSeq;
|
|
1542
1541
|
/**
|
|
1543
1542
|
* Monotonic agent-activation counter — the `agentEnd` clock. Advances when the
|
|
1544
|
-
* active flow ends: a swap to a different-named agent (`
|
|
1543
|
+
* active flow ends: a swap to a different-named agent (`installAgent`) OR an
|
|
1545
1544
|
* explicit `releaseAgent` / `completeSubAgent`. A stateful agent re-resolving
|
|
1546
1545
|
* the same name across turns keeps one activation. `agentEnd` fires for a
|
|
1547
1546
|
* payload once a LATER activation is current (`callActivation < currentActivation`)
|
|
@@ -1572,7 +1571,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1572
1571
|
* Union of every tool name advertised at any point during the current agent
|
|
1573
1572
|
* activation. Lets the unknown-tool path tell a *stale* call (a real tool from
|
|
1574
1573
|
* an earlier state, now retired — or one an open exclusive fold is hiding)
|
|
1575
|
-
* apart from a *hallucinated* one. Reset on agent swap in `
|
|
1574
|
+
* apart from a *hallucinated* one. Reset on agent swap in `installAgent`.
|
|
1576
1575
|
*/
|
|
1577
1576
|
private readonly everSeenToolNames;
|
|
1578
1577
|
/**
|
|
@@ -1689,7 +1688,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1689
1688
|
*/
|
|
1690
1689
|
private activeFallbacks?;
|
|
1691
1690
|
/**
|
|
1692
|
-
* Active agent's unresolved-tool hook, captured from `
|
|
1691
|
+
* Active agent's unresolved-tool hook, captured from `installAgent`. Consulted
|
|
1693
1692
|
* only when a tool call cannot be dispatched (a stale or hallucinated name);
|
|
1694
1693
|
* `undefined` keeps the framework's default messages. See
|
|
1695
1694
|
* `resolveUnresolvedToolContent`.
|
|
@@ -1697,7 +1696,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1697
1696
|
private activeOnUnresolvedTool?;
|
|
1698
1697
|
/**
|
|
1699
1698
|
* Caches validated provider lookups per name within the current agent. Cleared
|
|
1700
|
-
* by `
|
|
1699
|
+
* by `installAgent` so each new agent's static/function-resolved names are
|
|
1701
1700
|
* validated fresh.
|
|
1702
1701
|
*/
|
|
1703
1702
|
private resolvedProviderCache;
|
|
@@ -1795,7 +1794,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1795
1794
|
* would make that case stop ending the turn.
|
|
1796
1795
|
*
|
|
1797
1796
|
* It matters most for a sub-agent's wall. The child can sit on a different
|
|
1798
|
-
* vendor from its parent — `
|
|
1797
|
+
* vendor from its parent — `installAgent` reads `config.provider` — so without
|
|
1799
1798
|
* this the parent's short-circuit reports `lastResolvedProvider`, i.e. the one
|
|
1800
1799
|
* vendor that did NOT refuse. Under a mixed registry that walls Gemini because
|
|
1801
1800
|
* an Anthropic child 402'd, and if those are the only two reachable vendors the
|
|
@@ -1924,7 +1923,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1924
1923
|
* Make `config` the active agent, firing its lifecycle hooks — `onDeactivate` on the outgoing
|
|
1925
1924
|
* agent, then `onActivate` on this one — before installing it.
|
|
1926
1925
|
*
|
|
1927
|
-
* This is the entry point a host should use. {@link ChatDriver.
|
|
1926
|
+
* This is the entry point a host should use. {@link ChatDriver.installAgent} installs a config
|
|
1928
1927
|
* *without* firing hooks, which is right for the two callers that need it (the orchestrator,
|
|
1929
1928
|
* which fires them through the shared session, and `invokeSubAgent`, where a child's config is
|
|
1930
1929
|
* not an activation) and wrong for everyone else.
|
|
@@ -1967,11 +1966,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1967
1966
|
* {@link ChatDriver.agentSession} and then installs a decorated config, and `invokeSubAgent`,
|
|
1968
1967
|
* where the child driver's config is a tool surface rather than an activation.
|
|
1969
1968
|
*
|
|
1970
|
-
*
|
|
1971
|
-
*
|
|
1972
|
-
* without checking which of the two above it resembles.
|
|
1969
|
+
* Do not add a third caller to this path without checking which of the two above it resembles —
|
|
1970
|
+
* whether the hooks should fire is the whole difference between this and `activateAgent`.
|
|
1973
1971
|
*/
|
|
1974
|
-
|
|
1972
|
+
installAgent(config: AgentConfig): void;
|
|
1975
1973
|
/**
|
|
1976
1974
|
* Resolve the tool-result content for an unresolved tool call. Consults the
|
|
1977
1975
|
* active agent's `onUnresolvedTool` hook (if any) with the attempted tool
|
|
@@ -2296,7 +2294,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2296
2294
|
|
|
2297
2295
|
/**
|
|
2298
2296
|
* Construction-time configuration for {@link ChatDriver}. Everything except the provider
|
|
2299
|
-
* registry is optional — most fields are also settable per-agent via `
|
|
2297
|
+
* registry is optional — most fields are also settable per-agent via `installAgent`, so a
|
|
2300
2298
|
* bare `new ChatDriver(registry)` is valid. Mirrors the `(registry, options)` shape of
|
|
2301
2299
|
* `OrchestratingDriver`.
|
|
2302
2300
|
*
|
|
@@ -3610,38 +3608,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
3610
3608
|
* element has its own settings modal.
|
|
3611
3609
|
*/
|
|
3612
3610
|
downloadingDebugLog: boolean;
|
|
3613
|
-
/**
|
|
3614
|
-
* True while `submitDebugLog` is building and handing off the log. Same role as
|
|
3615
|
-
* `downloadingDebugLog` for the Send button: the lifetime-stitch and the host's
|
|
3616
|
-
* `send` callback are async, so the button needs a visible in-flight state.
|
|
3617
|
-
*/
|
|
3618
|
-
submittingDebugLog: boolean;
|
|
3619
|
-
/**
|
|
3620
|
-
* Outcome of the last log submission, shown briefly on the button ('Sent' /
|
|
3621
|
-
* 'Failed — retry') then cleared by `setDebugLogSubmitResult`'s timer. `null` when idle.
|
|
3622
|
-
*/
|
|
3623
|
-
debugLogSubmitResult: 'sent' | 'error' | null;
|
|
3624
|
-
/** Timer that clears `debugLogSubmitResult` back to idle. */
|
|
3625
|
-
private debugLogSubmitResultTimer?;
|
|
3626
|
-
/**
|
|
3627
|
-
* Whether the agent-log compose box (note + Send/Cancel) is open. Opened by the row's
|
|
3628
|
-
* Send button when `debugLogSubmit.note` is not `false`; closed by Cancel or a
|
|
3629
|
-
* successful send. Stays open after a failure so the typed note is not lost.
|
|
3630
|
-
*/
|
|
3631
|
-
debugLogComposeOpen: boolean;
|
|
3632
|
-
/** The note typed in the compose box, raw (trimmed only at submit time). */
|
|
3633
|
-
debugLogNote: string;
|
|
3634
|
-
/** Bound to the compose box's text-area via the template ref, for focus on open. */
|
|
3635
|
-
debugLogNoteEl?: HTMLElement;
|
|
3636
|
-
/** How long 'Sent' shows before idle. Overridable so tests need not wait 4 seconds. */
|
|
3637
|
-
debugLogSubmitResultFlashMs: number;
|
|
3638
|
-
/**
|
|
3639
|
-
* Bumped by `resetDebugLogSubmitState`. An in-flight `submitDebugLog` captures it and
|
|
3640
|
-
* drops its continuation when a reset (disconnect, session switch, Clear) happened
|
|
3641
|
-
* while it awaited — otherwise the stale submission would write state, arm a timer on
|
|
3642
|
-
* a torn-down element, or report 'Sent' into a session it never belonged to.
|
|
3643
|
-
*/
|
|
3644
|
-
private debugLogSubmitGeneration;
|
|
3645
3611
|
/** Active tab inside the settings modal. */
|
|
3646
3612
|
get settingsModalTab(): SettingsModalTab;
|
|
3647
3613
|
set settingsModalTab(value: SettingsModalTab);
|
|
@@ -4293,65 +4259,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
4293
4259
|
get settingsCostTabVisible(): boolean;
|
|
4294
4260
|
/** Whether session token usage should render on the Usage tab. */
|
|
4295
4261
|
get settingsSessionTokensVisible(): boolean;
|
|
4296
|
-
/**
|
|
4297
|
-
* Whether the settings "Agent log" section renders — shown when either action is
|
|
4298
|
-
* enabled: the download button (`allowDebugDownload`) or the host-transport Send
|
|
4299
|
-
* button (`debugLogSubmit`). Each button is additionally gated on its own flag
|
|
4300
|
-
* inside the section, so a host can enable one without the other.
|
|
4301
|
-
*/
|
|
4302
|
-
get settingsAgentLogSectionVisible(): boolean;
|
|
4303
|
-
/**
|
|
4304
|
-
* The resolved compose-box settings for the agent-log Send button, or `null` when the
|
|
4305
|
-
* host opted out (`debugLogSubmit.note: false`) and the button sends on first click.
|
|
4306
|
-
*/
|
|
4307
|
-
get debugLogNoteConfig(): ResolvedDebugLogNoteConfig | null;
|
|
4308
|
-
/**
|
|
4309
|
-
* Whether the typed note counts as empty — the ONE emptiness rule, shared by the
|
|
4310
|
-
* compose box's disabled state and its "required" hint so the two cannot drift apart.
|
|
4311
|
-
*/
|
|
4312
|
-
get debugLogNoteMissing(): boolean;
|
|
4313
|
-
/** The Send button's idle label, as the host configured it. */
|
|
4314
|
-
get debugLogSubmitLabel(): string;
|
|
4315
|
-
/**
|
|
4316
|
-
* Label on the agent-log row's Send button. While the compose box is open the row
|
|
4317
|
-
* button is just the (disabled) trigger, so it keeps its idle label; otherwise it
|
|
4318
|
-
* reflects the in-flight / flashed outcome of the last submission.
|
|
4319
|
-
*/
|
|
4320
|
-
get debugLogSubmitButtonLabel(): string;
|
|
4321
|
-
/**
|
|
4322
|
-
* The compose box's footer hint: a failure first, then the "required" nudge, else the
|
|
4323
|
-
* live counter. Visual only — the same information reaches assistive technology via
|
|
4324
|
-
* `debugLogNoteAriaLabel` (counter, required) and `debugLogSubmitAnnouncement` (outcome),
|
|
4325
|
-
* because IDREF attributes such as `aria-describedby` cannot point across the
|
|
4326
|
-
* design-system text-area's shadow boundary.
|
|
4327
|
-
*/
|
|
4328
|
-
get debugLogComposeHint(): string;
|
|
4329
|
-
/**
|
|
4330
|
-
* Accessible name for the note. Deliberately STATIC apart from "(required)": a name
|
|
4331
|
-
* that changed per keystroke would be re-read in full by NVDA on every key and never
|
|
4332
|
-
* updated by JAWS. The running count reaches AT through `debugLogSubmitAnnouncement`
|
|
4333
|
-
* at the thresholds where it matters.
|
|
4334
|
-
*/
|
|
4335
|
-
get debugLogNoteAriaLabel(): string;
|
|
4336
|
-
/**
|
|
4337
|
-
* Text for the always-present live region beside the agent-log row, so the outcome of
|
|
4338
|
-
* a submission is announced even when the compose box is closed or opted out
|
|
4339
|
-
* (`note: false`), where the only visible change is the button label.
|
|
4340
|
-
*/
|
|
4341
|
-
get debugLogSubmitAnnouncement(): string;
|
|
4342
|
-
/**
|
|
4343
|
-
* The agent-log row's description, phrased for whichever actions the host enabled.
|
|
4344
|
-
* Send is called out as transmitting: Download keeps the log on the user's machine,
|
|
4345
|
-
* Send hands the full conversation to wherever the host's transport delivers it.
|
|
4346
|
-
*/
|
|
4347
|
-
get debugLogRowDescription(): string;
|
|
4348
|
-
/**
|
|
4349
|
-
* Whether the compose box's Send button is inert: a send is already in flight, or the
|
|
4350
|
-
* host made the note required and it is still blank.
|
|
4351
|
-
*/
|
|
4352
|
-
get debugLogSendDisabled(): boolean;
|
|
4353
|
-
/** Live "typed / max" counter for the compose box. */
|
|
4354
|
-
get debugLogNoteCounter(): string;
|
|
4355
4262
|
/** Whether the chat header (and settings cog) should render. */
|
|
4356
4263
|
get settingsCogVisible(): boolean;
|
|
4357
4264
|
openSettingsModal(): void;
|
|
@@ -4422,62 +4329,6 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
4422
4329
|
*/
|
|
4423
4330
|
private buildMetaSnapshot;
|
|
4424
4331
|
downloadDebugLog(): Promise<void>;
|
|
4425
|
-
/**
|
|
4426
|
-
* Hand the agent log to the host's `ui.debugLogSubmit.send` callback — the Send
|
|
4427
|
-
* button next to Download. Reuses `buildDownloadLog`, so the submitted log is
|
|
4428
|
-
* byte-identical to what Download saves (lifetime-stitched when the provider
|
|
4429
|
-
* persists diagnostics). The assistant is vendor-agnostic: the callback owns the
|
|
4430
|
-
* transport (Sentry feedback, a support API, an upload endpoint). Outcome lands in
|
|
4431
|
-
* `debugLogSubmitResult` so the button can flash 'Sent'/'Failed'; failures also go
|
|
4432
|
-
* to the logger with the cause.
|
|
4433
|
-
*/
|
|
4434
|
-
submitDebugLog(): Promise<void>;
|
|
4435
|
-
/** The agent name stamped on the log: the active agent, else the header title. */
|
|
4436
|
-
private get debugLogAgentName();
|
|
4437
|
-
/**
|
|
4438
|
-
* Filename for the agent log — the ONE derivation Download saves under and Send hands
|
|
4439
|
-
* to the host, so `ChatDebugLogSubmission.filename`'s "same stem as the download"
|
|
4440
|
-
* promise is enforced rather than relying on two copies agreeing.
|
|
4441
|
-
*/
|
|
4442
|
-
private debugLogFilename;
|
|
4443
|
-
/**
|
|
4444
|
-
* Back to idle: nothing in flight, no flash, no open compose box, no note. Called on
|
|
4445
|
-
* disconnect and on a session switch / Clear (a note typed against one conversation
|
|
4446
|
-
* must not caption the next one's log). On disconnect — the
|
|
4447
|
-
* flash timer would otherwise fire against a torn-down element, and clearing ONLY the
|
|
4448
|
-
* timer would strand `debugLogSubmitResult` at 'sent'/'error' for good on a pop-out /
|
|
4449
|
-
* pop-in (nothing else resets it), with the box remounting open on a stale note.
|
|
4450
|
-
*/
|
|
4451
|
-
private resetDebugLogSubmitState;
|
|
4452
|
-
/**
|
|
4453
|
-
* The row's Send button. With a compose box configured (the default) it opens the box
|
|
4454
|
-
* and focuses the note so the user can caption the log; with `note: false` it sends
|
|
4455
|
-
* straight away, as before.
|
|
4456
|
-
*/
|
|
4457
|
-
openDebugLogCompose(): void;
|
|
4458
|
-
/** The note's `@input`: track the text, and let typing dismiss a standing failure. */
|
|
4459
|
-
noteDebugLogInput(value: string): void;
|
|
4460
|
-
/** Close the compose box and discard the typed note. */
|
|
4461
|
-
cancelDebugLogCompose(): void;
|
|
4462
|
-
/**
|
|
4463
|
-
* Closing the compose box unmounts the focused text-area, which drops focus to the
|
|
4464
|
-
* document body and strands keyboard and screen-reader users. Hand it back to the row's
|
|
4465
|
-
* Send button — next frame, once the `when` block has torn down and the button, disabled
|
|
4466
|
-
* while the box was open, is interactive again.
|
|
4467
|
-
*/
|
|
4468
|
-
private restoreDebugLogTriggerFocus;
|
|
4469
|
-
/**
|
|
4470
|
-
* After a FAILED send the controls come back but the element that started the send
|
|
4471
|
-
* was disabled meanwhile, so focus has already dropped to the document body. Put it
|
|
4472
|
-
* where the retry happens: the note when the box is open, else the row trigger.
|
|
4473
|
-
*/
|
|
4474
|
-
private restoreDebugLogRetryFocus;
|
|
4475
|
-
/**
|
|
4476
|
-
* Record the submit outcome. 'sent' flashes and falls back to idle; 'error' PERSISTS
|
|
4477
|
-
* until the user acts (types, reopens the box, cancels, or retries) — a failure that
|
|
4478
|
-
* silently reverted to the counter after four seconds left no trace it had happened.
|
|
4479
|
-
*/
|
|
4480
|
-
private setDebugLogSubmitResult;
|
|
4481
4332
|
/**
|
|
4482
4333
|
* The log to download (GENC-1351 §5.8). When the provider persists diagnostics,
|
|
4483
4334
|
* stitch the **whole lifetime** stream (every page load) rather than just the
|
|
@@ -4953,7 +4804,7 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
4953
4804
|
* **The inner driver's session, not one of our own.** One session is the invariant: two would
|
|
4954
4805
|
* let the outer and inner driver disagree about which agent is active, and the inner one would
|
|
4955
4806
|
* never be activated at all, because this driver installs a *decorated* config through
|
|
4956
|
-
* `
|
|
4807
|
+
* `installAgent` rather than going via `ChatDriver.activateAgent`. This driver keeps the routing
|
|
4957
4808
|
* decisions; the session owns the lifecycle.
|
|
4958
4809
|
*/
|
|
4959
4810
|
private get agentSession();
|
|
@@ -5060,7 +4911,7 @@ export declare class OrchestratingDriver extends EventTarget implements AiDriver
|
|
|
5060
4911
|
getContextReserve(): ContextReserveResolution | undefined;
|
|
5061
4912
|
/** {@inheritDoc AiDriver.getActiveAgent} */
|
|
5062
4913
|
getActiveAgent(): AgentConfig | undefined;
|
|
5063
|
-
private
|
|
4914
|
+
private installAgent;
|
|
5064
4915
|
/**
|
|
5065
4916
|
* Release the current stateful agent: fire `onDeactivate`, clear the
|
|
5066
4917
|
* flow-owner lock, dispatch events so the host (and Redux) reflect the
|
|
@@ -5294,13 +5145,6 @@ declare interface ResolvedCostHistoryConfig {
|
|
|
5294
5145
|
summaryHint?: string;
|
|
5295
5146
|
}
|
|
5296
5147
|
|
|
5297
|
-
/** `ChatDebugLogNoteConfig` with every option resolved. */
|
|
5298
|
-
export declare interface ResolvedDebugLogNoteConfig {
|
|
5299
|
-
placeholder: string;
|
|
5300
|
-
required: boolean;
|
|
5301
|
-
maxLength: number;
|
|
5302
|
-
}
|
|
5303
|
-
|
|
5304
5148
|
/**
|
|
5305
5149
|
* Structured-output schema for an agent. When set, the model's final (non-tool) answer is
|
|
5306
5150
|
* constrained to this JSON Schema instead of free text. Either a static schema or a function
|
package/dist/chat-driver.cjs
CHANGED
|
@@ -5304,7 +5304,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5304
5304
|
this.turnSeq = 0;
|
|
5305
5305
|
/**
|
|
5306
5306
|
* Monotonic agent-activation counter — the `agentEnd` clock. Advances when the
|
|
5307
|
-
* active flow ends: a swap to a different-named agent (`
|
|
5307
|
+
* active flow ends: a swap to a different-named agent (`installAgent`) OR an
|
|
5308
5308
|
* explicit `releaseAgent` / `completeSubAgent`. A stateful agent re-resolving
|
|
5309
5309
|
* the same name across turns keeps one activation. `agentEnd` fires for a
|
|
5310
5310
|
* payload once a LATER activation is current (`callActivation < currentActivation`)
|
|
@@ -5345,7 +5345,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5345
5345
|
* Union of every tool name advertised at any point during the current agent
|
|
5346
5346
|
* activation. Lets the unknown-tool path tell a *stale* call (a real tool from
|
|
5347
5347
|
* an earlier state, now retired — or one an open exclusive fold is hiding)
|
|
5348
|
-
* apart from a *hallucinated* one. Reset on agent swap in `
|
|
5348
|
+
* apart from a *hallucinated* one. Reset on agent swap in `installAgent`.
|
|
5349
5349
|
*/
|
|
5350
5350
|
this.everSeenToolNames = /* @__PURE__ */ new Set();
|
|
5351
5351
|
/**
|
|
@@ -5396,7 +5396,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5396
5396
|
this.turnCancelled = false;
|
|
5397
5397
|
/**
|
|
5398
5398
|
* Caches validated provider lookups per name within the current agent. Cleared
|
|
5399
|
-
* by `
|
|
5399
|
+
* by `installAgent` so each new agent's static/function-resolved names are
|
|
5400
5400
|
* validated fresh.
|
|
5401
5401
|
*/
|
|
5402
5402
|
this.resolvedProviderCache = /* @__PURE__ */ new Map();
|
|
@@ -5702,7 +5702,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5702
5702
|
* Make `config` the active agent, firing its lifecycle hooks — `onDeactivate` on the outgoing
|
|
5703
5703
|
* agent, then `onActivate` on this one — before installing it.
|
|
5704
5704
|
*
|
|
5705
|
-
* This is the entry point a host should use. {@link ChatDriver.
|
|
5705
|
+
* This is the entry point a host should use. {@link ChatDriver.installAgent} installs a config
|
|
5706
5706
|
* *without* firing hooks, which is right for the two callers that need it (the orchestrator,
|
|
5707
5707
|
* which fires them through the shared session, and `invokeSubAgent`, where a child's config is
|
|
5708
5708
|
* not an activation) and wrong for everyone else.
|
|
@@ -5711,7 +5711,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5711
5711
|
*/
|
|
5712
5712
|
async activateAgent(config) {
|
|
5713
5713
|
await this.agentSession.activate(config);
|
|
5714
|
-
this.
|
|
5714
|
+
this.installAgent(config);
|
|
5715
5715
|
}
|
|
5716
5716
|
/**
|
|
5717
5717
|
* {@inheritDoc AiDriver.getActiveAgent}
|
|
@@ -5756,11 +5756,10 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
5756
5756
|
* {@link ChatDriver.agentSession} and then installs a decorated config, and `invokeSubAgent`,
|
|
5757
5757
|
* where the child driver's config is a tool surface rather than an activation.
|
|
5758
5758
|
*
|
|
5759
|
-
*
|
|
5760
|
-
*
|
|
5761
|
-
* without checking which of the two above it resembles.
|
|
5759
|
+
* Do not add a third caller to this path without checking which of the two above it resembles —
|
|
5760
|
+
* whether the hooks should fire is the whole difference between this and `activateAgent`.
|
|
5762
5761
|
*/
|
|
5763
|
-
|
|
5762
|
+
installAgent(config) {
|
|
5764
5763
|
if (config.name !== this.activeAgentName) this.currentActivation += 1;
|
|
5765
5764
|
this.systemPrompt = config.systemPrompt;
|
|
5766
5765
|
if (typeof config.toolDefinitions === "function") {
|
|
@@ -6452,7 +6451,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
|
|
|
6452
6451
|
} else {
|
|
6453
6452
|
this.lifecycleController.signal.addEventListener("abort", disposeChild, { once: true });
|
|
6454
6453
|
}
|
|
6455
|
-
child.
|
|
6454
|
+
child.installAgent({ ...subConfig, primerHistory: effectivePrimer });
|
|
6456
6455
|
child.setHostInteractionRequester(
|
|
6457
6456
|
(componentName, data, opts) => this.requestInteraction(componentName, data, opts)
|
|
6458
6457
|
);
|
|
@@ -7507,7 +7506,7 @@ var OrchestratingDriver = class extends EventTarget {
|
|
|
7507
7506
|
* **The inner driver's session, not one of our own.** One session is the invariant: two would
|
|
7508
7507
|
* let the outer and inner driver disagree about which agent is active, and the inner one would
|
|
7509
7508
|
* never be activated at all, because this driver installs a *decorated* config through
|
|
7510
|
-
* `
|
|
7509
|
+
* `installAgent` rather than going via `ChatDriver.activateAgent`. This driver keeps the routing
|
|
7511
7510
|
* decisions; the session owns the lifecycle.
|
|
7512
7511
|
*/
|
|
7513
7512
|
get agentSession() {
|
|
@@ -7665,7 +7664,7 @@ var OrchestratingDriver = class extends EventTarget {
|
|
|
7665
7664
|
let lastResult;
|
|
7666
7665
|
while (true) {
|
|
7667
7666
|
if (this.cancelled) break;
|
|
7668
|
-
await this.
|
|
7667
|
+
await this.installAgent(currentAgent);
|
|
7669
7668
|
let result;
|
|
7670
7669
|
if (isHandoff) {
|
|
7671
7670
|
const contextPrimer = handoffSummary ? [{ role: "user", content: `[Context from previous agent]: ${handoffSummary}` }] : [];
|
|
@@ -7747,7 +7746,7 @@ var OrchestratingDriver = class extends EventTarget {
|
|
|
7747
7746
|
getActiveAgent() {
|
|
7748
7747
|
return this.agentSession.getActive();
|
|
7749
7748
|
}
|
|
7750
|
-
async
|
|
7749
|
+
async installAgent(agent) {
|
|
7751
7750
|
const { previousAgent, flowOwnerChangedTo } = await this.agentSession.activate(agent);
|
|
7752
7751
|
if (flowOwnerChangedTo !== void 0) {
|
|
7753
7752
|
this.dispatchEvent(new CustomEvent("flow-owner-changed", { detail: flowOwnerChangedTo }));
|
|
@@ -7772,7 +7771,7 @@ var OrchestratingDriver = class extends EventTarget {
|
|
|
7772
7771
|
]);
|
|
7773
7772
|
}
|
|
7774
7773
|
this.chatDriver.setProviderHistoryTransform((h) => transformHistoryForAgent(h, agent.name));
|
|
7775
|
-
this.chatDriver.
|
|
7774
|
+
this.chatDriver.installAgent(agentToApply);
|
|
7776
7775
|
this.dispatchEvent(new CustomEvent("orchestrating-stop"));
|
|
7777
7776
|
this.dispatchEvent(new CustomEvent("agent-changed", { detail: agent }));
|
|
7778
7777
|
}
|