@genesislcap/ai-assistant 15.78.0 → 15.78.2
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 +64 -4
- package/dist/ai-assistant.d.ts +32 -9
- package/dist/chat-driver.cjs +24 -8
- package/dist/chat-driver.cjs.map +2 -2
- package/dist/chat-driver.mjs +24 -8
- package/dist/chat-driver.mjs.map +2 -2
- package/dist/custom-elements.json +568 -440
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts +2 -2
- package/dist/dts/config/define-stateful-agent.d.ts +1 -1
- package/dist/dts/main/main.d.ts +23 -5
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/state/ai-assistant-slice.d.ts +4 -5
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
- package/dist/dts/state/persistence/session-snapshot.d.ts +19 -6
- package/dist/dts/state/persistence/session-snapshot.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/dts/utils/attachment-note.d.ts +18 -0
- package/dist/dts/utils/attachment-note.d.ts.map +1 -0
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +40 -3
- package/dist/esm/main/main.js +58 -15
- package/dist/esm/main/main.template.js +2 -2
- package/dist/esm/state/persistence/session-persister.js +24 -21
- package/dist/esm/state/persistence/session-snapshot.js +20 -7
- package/dist/esm/utils/attachment-note.js +19 -0
- package/docs/styling.md +1 -1
- package/package.json +17 -17
- package/sandbox/fixtures.ts +3 -3
|
@@ -17451,10 +17451,70 @@
|
|
|
17451
17451
|
"isProtected": false,
|
|
17452
17452
|
"isAbstract": false
|
|
17453
17453
|
},
|
|
17454
|
+
{
|
|
17455
|
+
"kind": "Property",
|
|
17456
|
+
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#agentButtonColour:member",
|
|
17457
|
+
"docComment": "/**\n * The chip's glyph colour: the pin's tint, for the agent the chip shows.\n */\n",
|
|
17458
|
+
"excerptTokens": [
|
|
17459
|
+
{
|
|
17460
|
+
"kind": "Content",
|
|
17461
|
+
"text": "get agentButtonColour(): "
|
|
17462
|
+
},
|
|
17463
|
+
{
|
|
17464
|
+
"kind": "Content",
|
|
17465
|
+
"text": "string | undefined"
|
|
17466
|
+
},
|
|
17467
|
+
{
|
|
17468
|
+
"kind": "Content",
|
|
17469
|
+
"text": ";"
|
|
17470
|
+
}
|
|
17471
|
+
],
|
|
17472
|
+
"isReadonly": true,
|
|
17473
|
+
"isOptional": false,
|
|
17474
|
+
"releaseTag": "Beta",
|
|
17475
|
+
"name": "agentButtonColour",
|
|
17476
|
+
"propertyTypeTokenRange": {
|
|
17477
|
+
"startIndex": 1,
|
|
17478
|
+
"endIndex": 2
|
|
17479
|
+
},
|
|
17480
|
+
"isStatic": false,
|
|
17481
|
+
"isProtected": false,
|
|
17482
|
+
"isAbstract": false
|
|
17483
|
+
},
|
|
17484
|
+
{
|
|
17485
|
+
"kind": "Property",
|
|
17486
|
+
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#agentButtonGlyph:member",
|
|
17487
|
+
"docComment": "/**\n * The chip's icon: orchestration's, or the pin for one agent getting every message.\n */\n",
|
|
17488
|
+
"excerptTokens": [
|
|
17489
|
+
{
|
|
17490
|
+
"kind": "Content",
|
|
17491
|
+
"text": "get agentButtonGlyph(): "
|
|
17492
|
+
},
|
|
17493
|
+
{
|
|
17494
|
+
"kind": "Content",
|
|
17495
|
+
"text": "'sitemap' | 'thumbtack'"
|
|
17496
|
+
},
|
|
17497
|
+
{
|
|
17498
|
+
"kind": "Content",
|
|
17499
|
+
"text": ";"
|
|
17500
|
+
}
|
|
17501
|
+
],
|
|
17502
|
+
"isReadonly": true,
|
|
17503
|
+
"isOptional": false,
|
|
17504
|
+
"releaseTag": "Beta",
|
|
17505
|
+
"name": "agentButtonGlyph",
|
|
17506
|
+
"propertyTypeTokenRange": {
|
|
17507
|
+
"startIndex": 1,
|
|
17508
|
+
"endIndex": 2
|
|
17509
|
+
},
|
|
17510
|
+
"isStatic": false,
|
|
17511
|
+
"isProtected": false,
|
|
17512
|
+
"isAbstract": false
|
|
17513
|
+
},
|
|
17454
17514
|
{
|
|
17455
17515
|
"kind": "Property",
|
|
17456
17516
|
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#agentButtonLabel:member",
|
|
17457
|
-
"docComment": "/**\n * Label beside the composer's agent glyph: the orchestration label (`Orchestration` unless the host renames it) while the orchestrator is routing, otherwise the pinned agent's name. The name is NOT shortened here — the button truncates with an ellipsis in CSS, so the full name stays available to a screen reader and to the `title` tooltip.\n */\n",
|
|
17517
|
+
"docComment": "/**\n * Label beside the composer's agent glyph: the orchestration label (`Orchestration` unless the host renames it) while the orchestrator is routing, otherwise the pinned agent's name. The name is NOT shortened here — the button truncates with an ellipsis in CSS, so the full name stays available to a screen reader and to the `title` tooltip.\n *\n * While a flow holds the picker, the flow owner is named instead: it gets every message.\n */\n",
|
|
17458
17518
|
"excerptTokens": [
|
|
17459
17519
|
{
|
|
17460
17520
|
"kind": "Content",
|
|
@@ -19825,7 +19885,7 @@
|
|
|
19825
19885
|
{
|
|
19826
19886
|
"kind": "Property",
|
|
19827
19887
|
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#effectivePlaceholder:member",
|
|
19828
|
-
"docComment": "/**\n * Placeholder shown in the chat input. Substitutes the pinned agent's name when one is selected so the user has a clearer signal of where their message will go; otherwise falls back to the host-provided placeholder.\n */\n",
|
|
19888
|
+
"docComment": "/**\n * Placeholder shown in the chat input. Substitutes the pinned agent's name when one is selected so the user has a clearer signal of where their message will go; otherwise falls back to the host-provided placeholder. While a flow holds the picker and the chip is shown, it names the flow owner, as the chip does.\n */\n",
|
|
19829
19889
|
"excerptTokens": [
|
|
19830
19890
|
{
|
|
19831
19891
|
"kind": "Content",
|
|
@@ -21903,7 +21963,7 @@
|
|
|
21903
21963
|
{
|
|
21904
21964
|
"kind": "Property",
|
|
21905
21965
|
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#pinnedAgentColour:member",
|
|
21906
|
-
"docComment": "/**\n *
|
|
21966
|
+
"docComment": "/**\n * The pinned agent's colour. Picked from the brand palette by agent position (modulo the palette length), so each agent gets a consistent colour across renders. `undefined` when nothing is pinned, the agent isn't in the current array, or the host has opted out via `chatConfig.picker.disablePinColours`. Kept for hosts; the chip's glyph uses {@link FoundationAiAssistant.agentButtonColour}, which follows the flow owner while it holds the picker.\n */\n",
|
|
21907
21967
|
"excerptTokens": [
|
|
21908
21968
|
{
|
|
21909
21969
|
"kind": "Content",
|
|
@@ -33419,7 +33479,7 @@
|
|
|
33419
33479
|
{
|
|
33420
33480
|
"kind": "PropertySignature",
|
|
33421
33481
|
"canonicalReference": "@genesislcap/ai-assistant!StatefulAgentInit#resumable:member",
|
|
33422
|
-
"docComment": "/**\n * Whether the agent's current state is resumable — worth persisting so the session restores mid-flow (GENC-1351 §5.9). Receives the **live** state bag `S` (like the other per-turn resolvers), so a machine agent gates on its step directly: `resumable: ({ state }) => state.machine.state !== 'confirm'`. Return `false` for a point that shouldn't resume — the session isn't persisted, and on return the assistant shows {@link StatefulAgentInit.notResumableMessage} (or a default) and pre-fills the composer with the
|
|
33482
|
+
"docComment": "/**\n * Whether the agent's current state is resumable — worth persisting so the session restores mid-flow (GENC-1351 §5.9). Receives the **live** state bag `S` (like the other per-turn resolvers), so a machine agent gates on its step directly: `resumable: ({ state }) => state.machine.state !== 'confirm'`. Return `false` for a point that shouldn't resume — the session isn't persisted, and on return the assistant shows {@link StatefulAgentInit.notResumableMessage} (or a default) and pre-fills the composer with the user's last message. Only consulted with persistence enabled; a thrown error is treated as `true` (fail-safe — never drop a resumable chat on a predicate bug).\n */\n",
|
|
33423
33483
|
"excerptTokens": [
|
|
33424
33484
|
{
|
|
33425
33485
|
"kind": "Content",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -2252,8 +2252,8 @@ declare interface BaseAgentConfig {
|
|
|
2252
2252
|
* (or leave the field absent) to persist and resume normally; return `false`
|
|
2253
2253
|
* for a point that shouldn't be resumed — the session is not persisted, and on
|
|
2254
2254
|
* return the assistant shows {@link AgentConfig.notResumableMessage} (or a
|
|
2255
|
-
* default) and pre-fills the composer with the
|
|
2256
|
-
*
|
|
2255
|
+
* default) and pre-fills the composer with the user's last message so they can
|
|
2256
|
+
* re-run it.
|
|
2257
2257
|
*
|
|
2258
2258
|
* Only consulted when the user has persistence enabled. Must be a **pure
|
|
2259
2259
|
* function of `ctx.state`** — it may be re-evaluated on a restored snapshot, so
|
|
@@ -6116,21 +6116,37 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
6116
6116
|
* user might change their mind and unpin without anything to clean up.
|
|
6117
6117
|
*/
|
|
6118
6118
|
get pinLocked(): boolean;
|
|
6119
|
+
/**
|
|
6120
|
+
* The agent holding the flow lock, by its `displayName` when that is a plain string (the
|
|
6121
|
+
* function form needs the agent's state, so it falls back to `name`, as the driver does).
|
|
6122
|
+
*/
|
|
6123
|
+
private get flowOwnerLabel();
|
|
6119
6124
|
/** Tooltip shown on the picker toggle button. */
|
|
6120
6125
|
get agentToggleTitle(): string;
|
|
6126
|
+
/** The agent the chip shows: the flow owner while it holds the picker, else the pin. */
|
|
6127
|
+
private get chipAgentName();
|
|
6121
6128
|
/**
|
|
6122
|
-
*
|
|
6123
|
-
*
|
|
6124
|
-
*
|
|
6125
|
-
*
|
|
6126
|
-
*
|
|
6129
|
+
* The pinned agent's colour. Picked from the brand palette by agent position
|
|
6130
|
+
* (modulo the palette length), so each agent gets a consistent colour across
|
|
6131
|
+
* renders. `undefined` when nothing is pinned, the agent isn't in the current
|
|
6132
|
+
* array, or the host has opted out via `chatConfig.picker.disablePinColours`.
|
|
6133
|
+
* Kept for hosts; the chip's glyph uses
|
|
6134
|
+
* {@link FoundationAiAssistant.agentButtonColour}, which follows the flow
|
|
6135
|
+
* owner while it holds the picker.
|
|
6127
6136
|
*/
|
|
6128
6137
|
get pinnedAgentColour(): string | undefined;
|
|
6138
|
+
/** The chip's glyph colour: the pin's tint, for the agent the chip shows. */
|
|
6139
|
+
get agentButtonColour(): string | undefined;
|
|
6140
|
+
private agentColour;
|
|
6141
|
+
/** The chip's icon: orchestration's, or the pin for one agent getting every message. */
|
|
6142
|
+
get agentButtonGlyph(): 'sitemap' | 'thumbtack';
|
|
6129
6143
|
/**
|
|
6130
6144
|
* Label beside the composer's agent glyph: the orchestration label (`Orchestration` unless the
|
|
6131
6145
|
* host renames it) while the orchestrator is routing, otherwise the pinned agent's name. The name is NOT shortened here —
|
|
6132
6146
|
* the button truncates with an ellipsis in CSS, so the full name stays
|
|
6133
6147
|
* available to a screen reader and to the `title` tooltip.
|
|
6148
|
+
*
|
|
6149
|
+
* While a flow holds the picker, the flow owner is named instead: it gets every message.
|
|
6134
6150
|
*/
|
|
6135
6151
|
get agentButtonLabel(): string;
|
|
6136
6152
|
/**
|
|
@@ -6146,6 +6162,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
6146
6162
|
* Placeholder shown in the chat input. Substitutes the pinned agent's name
|
|
6147
6163
|
* when one is selected so the user has a clearer signal of where their
|
|
6148
6164
|
* message will go; otherwise falls back to the host-provided placeholder.
|
|
6165
|
+
* While a flow holds the picker and the chip is shown, it names the flow
|
|
6166
|
+
* owner, as the chip does.
|
|
6149
6167
|
*/
|
|
6150
6168
|
get effectivePlaceholder(): string;
|
|
6151
6169
|
toggleShowToolCalls(): void;
|
|
@@ -7554,7 +7572,12 @@ export declare interface PersistedSession {
|
|
|
7554
7572
|
interrupted?: {
|
|
7555
7573
|
/** Shown as an assistant message on return. */
|
|
7556
7574
|
message: string;
|
|
7557
|
-
/**
|
|
7575
|
+
/**
|
|
7576
|
+
* The user's last message before the save, as the transcript holds it, or the prompt
|
|
7577
|
+
* captured when the flow took the lock if the transcript has no user message. Pre-filled
|
|
7578
|
+
* into the composer on return without the line naming any files: the files stay on the
|
|
7579
|
+
* transcript message and are not put back in the composer.
|
|
7580
|
+
*/
|
|
7558
7581
|
prompt?: string;
|
|
7559
7582
|
};
|
|
7560
7583
|
}
|
|
@@ -8324,7 +8347,7 @@ export declare interface StatefulAgentInit<S> {
|
|
|
8324
8347
|
* directly: `resumable: ({ state }) => state.machine.state !== 'confirm'`.
|
|
8325
8348
|
* Return `false` for a point that shouldn't resume — the session isn't persisted,
|
|
8326
8349
|
* and on return the assistant shows {@link StatefulAgentInit.notResumableMessage}
|
|
8327
|
-
* (or a default) and pre-fills the composer with the
|
|
8350
|
+
* (or a default) and pre-fills the composer with the user's last message.
|
|
8328
8351
|
* Only consulted with persistence enabled; a thrown error is treated as `true`
|
|
8329
8352
|
* (fail-safe — never drop a resumable chat on a predicate bug).
|
|
8330
8353
|
*/
|
package/dist/chat-driver.cjs
CHANGED
|
@@ -2493,7 +2493,12 @@ var AnthropicTransport = class _AnthropicTransport {
|
|
|
2493
2493
|
* Append never-stored tail context (already framed by the caller) as the final block of the
|
|
2494
2494
|
* outbound messages. Called AFTER `applyCacheControl`, so any `'history'` breakpoint sits
|
|
2495
2495
|
* on the last *stored* block and this per-turn volatile block stays outside the cached prefix.
|
|
2496
|
-
*
|
|
2496
|
+
*
|
|
2497
|
+
* Joins the last message when it is user-role (a new user message, or tool results). Otherwise
|
|
2498
|
+
* it opens a user turn of its own, and that is not a defensive branch: a continuation with no
|
|
2499
|
+
* user input — every ai-assistant agent handoff — reaches here with history ending on an
|
|
2500
|
+
* assistant turn, and this block is what keeps the request from ending there, which Anthropic
|
|
2501
|
+
* refuses as a prefill.
|
|
2497
2502
|
*/
|
|
2498
2503
|
appendTailContext(body, tailContext) {
|
|
2499
2504
|
const block = { type: "text", text: tailContext };
|
|
@@ -9563,6 +9568,13 @@ Politely let the user know what you can help with and invite them to rephrase th
|
|
|
9563
9568
|
|
|
9564
9569
|
${UNROUTABLE_INSTRUCTION}`;
|
|
9565
9570
|
}
|
|
9571
|
+
function handoffTailNote(agent, remainingTask) {
|
|
9572
|
+
if (isFallback(agent)) {
|
|
9573
|
+
return "[Hand-off]: no specialist here can take on what remains. Reply to the user now, as the routing note says.";
|
|
9574
|
+
}
|
|
9575
|
+
const work = remainingTask?.trim();
|
|
9576
|
+
return work ? `[Hand-off]: the previous agent passed the rest of this request to you. What remains: ${work}` : "[Hand-off]: the previous agent passed the rest of this request to you without saying what remains. Carry on with the user's request above.";
|
|
9577
|
+
}
|
|
9566
9578
|
var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator {
|
|
9567
9579
|
constructor(providerRegistry, agents, options = {}) {
|
|
9568
9580
|
super(_OrchestratingDriver.createInner(providerRegistry, agents, options));
|
|
@@ -9685,6 +9697,7 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
|
|
|
9685
9697
|
detail: [...history, { role: "user", content: input, attachments, ...delegated }]
|
|
9686
9698
|
})
|
|
9687
9699
|
);
|
|
9700
|
+
const routingInput = delegated.delegate ? frameDelegatedContent(input, delegated.delegateFraming) : input;
|
|
9688
9701
|
const pinned = this.resolvePinnedAgent();
|
|
9689
9702
|
if (!pinned) this.dispatchEvent(new CustomEvent("orchestrating-start"));
|
|
9690
9703
|
let routed;
|
|
@@ -9692,11 +9705,7 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
|
|
|
9692
9705
|
this.recordRouting("pinned", pinned, { durationMs: 0 });
|
|
9693
9706
|
routed = { agent: pinned, decision: "pinned" };
|
|
9694
9707
|
} else {
|
|
9695
|
-
routed = await this.classify(
|
|
9696
|
-
delegated.delegate ? frameDelegatedContent(input, delegated.delegateFraming) : input,
|
|
9697
|
-
history,
|
|
9698
|
-
this.activeAgent
|
|
9699
|
-
);
|
|
9708
|
+
routed = await this.classify(routingInput, history, this.activeAgent);
|
|
9700
9709
|
}
|
|
9701
9710
|
let currentAgent = routed.agent;
|
|
9702
9711
|
let isHandoff = false;
|
|
@@ -9720,7 +9729,9 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
|
|
|
9720
9729
|
` : "[Routing note]: no specialist is available for the work that remains.\n") + "Tell the user plainly what was established, that this part falls outside what any specialist here can do, and what they could do next. Do not claim you will do it yourself, and do not return an empty response."
|
|
9721
9730
|
});
|
|
9722
9731
|
}
|
|
9723
|
-
result = await this.chatDriver.continueFromHistory(contextPrimer
|
|
9732
|
+
result = await this.chatDriver.continueFromHistory(contextPrimer, {
|
|
9733
|
+
tailNote: handoffTailNote(currentAgent, remainingTask)
|
|
9734
|
+
});
|
|
9724
9735
|
} else {
|
|
9725
9736
|
this.userMessageAppended = true;
|
|
9726
9737
|
result = await this.chatDriver.sendMessage(input, attachments, options);
|
|
@@ -9749,7 +9760,12 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
|
|
|
9749
9760
|
}
|
|
9750
9761
|
const updatedHistory = this.chatDriver.getHistory();
|
|
9751
9762
|
this.dispatchEvent(new CustomEvent("orchestrating-start"));
|
|
9752
|
-
routed = await this.classify(
|
|
9763
|
+
routed = await this.classify(
|
|
9764
|
+
remainingTask?.trim() || routingInput,
|
|
9765
|
+
updatedHistory,
|
|
9766
|
+
void 0,
|
|
9767
|
+
attempted
|
|
9768
|
+
);
|
|
9753
9769
|
currentAgent = routed.agent;
|
|
9754
9770
|
}
|
|
9755
9771
|
if (this.cancelled && !this.userMessageAppended) {
|