@artooi/ag-ui-web-component 0.40.0 → 0.41.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/CHANGELOG.md +54 -1
- package/README.md +46 -24
- package/dist/ag-ui-web-component.bundle.js +118 -87
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +3 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +25 -16
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/attachment.d.ts +11 -4
- package/dist/core/attachment.d.ts.map +1 -1
- package/dist/core/tool_outcome.d.ts +4 -3
- package/dist/core/tool_outcome.d.ts.map +1 -1
- package/dist/core/utils.d.ts +19 -0
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/index.js +461 -452
- package/dist/index.js.map +4 -4
- package/dist/ui/history/conversation_history.d.ts +1 -1
- package/dist/ui/history/conversation_history.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/constants.ts +3 -2
- package/src/core/agui_client.ts +149 -131
- package/src/core/attachment.ts +13 -5
- package/src/core/tool_outcome.ts +4 -3
- package/src/core/utils.ts +23 -0
- package/src/ui/history/conversation_history.ts +25 -22
- package/src/version.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "@ag-ui/client";
|
|
2
|
-
import type
|
|
2
|
+
import { contentToText, type Message } from "@ag-ui/core";
|
|
3
3
|
import { MESSAGE_ROLE, TOOL_OUTCOME } from "../../constants.js";
|
|
4
4
|
import type { ActivityRegistry } from "../../core/activity_registry.js";
|
|
5
5
|
import type { AgUiClient } from "../../core/agui_client.js";
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
import type { MessageRole } from "../../core/message_role.js";
|
|
13
13
|
import { RunIndex } from "../../core/run_index.js";
|
|
14
14
|
import { toolStatusFromOutcome } from "../../core/tool_outcome.js";
|
|
15
|
-
import { answerUnansweredCalls, mintThread } from "../../core/utils.js";
|
|
15
|
+
import { answerUnansweredCalls, metadataOrTopLevel, mintThread } from "../../core/utils.js";
|
|
16
16
|
import type { ToolCatalog } from "../../tools/tool_catalog.js";
|
|
17
17
|
import type { AnswerActions } from "../transcript/answer_actions.js";
|
|
18
18
|
import { renderAttachmentChips } from "../transcript/attachment_chips.js";
|
|
@@ -365,7 +365,7 @@ export class ConversationHistory {
|
|
|
365
365
|
//
|
|
366
366
|
// All of it, even where this forks an earlier run and the server's
|
|
367
367
|
// snapshot stops there: what is saved is what the screen shows.
|
|
368
|
-
follows: this.#host.client()?.
|
|
368
|
+
follows: this.#host.client()?.messages ?? this.#restored,
|
|
369
369
|
onSaved: (conversation) => {
|
|
370
370
|
// A continuation stopped by New chat or a thread switch saves once its
|
|
371
371
|
// request closes, into its own thread; the conversation now on screen
|
|
@@ -487,16 +487,14 @@ export class ConversationHistory {
|
|
|
487
487
|
const restored = answerUnansweredCalls(
|
|
488
488
|
messages,
|
|
489
489
|
// The shape the store holds for a call the client answered the same way:
|
|
490
|
-
// its tool message, with the outcome
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
outcome: TOOL_OUTCOME.INTERRUPTED,
|
|
499
|
-
}) as Message,
|
|
490
|
+
// its tool message, with the outcome in its metadata.
|
|
491
|
+
(toolCallId) => ({
|
|
492
|
+
id: randomUUID(),
|
|
493
|
+
role: "tool",
|
|
494
|
+
content: unfinished,
|
|
495
|
+
toolCallId,
|
|
496
|
+
metadata: { outcome: TOOL_OUTCOME.INTERRUPTED },
|
|
497
|
+
}),
|
|
500
498
|
new Set(checkpoint === null ? [] : [checkpoint.toolCallId]),
|
|
501
499
|
);
|
|
502
500
|
this.#restored = restored;
|
|
@@ -611,16 +609,21 @@ export class ConversationHistory {
|
|
|
611
609
|
if (message.role === "tool") {
|
|
612
610
|
const card = this.#host.transcript.card(message.toolCallId);
|
|
613
611
|
if (card !== undefined) {
|
|
614
|
-
// The outcome
|
|
615
|
-
//
|
|
616
|
-
//
|
|
617
|
-
//
|
|
618
|
-
//
|
|
619
|
-
//
|
|
620
|
-
//
|
|
612
|
+
// The outcome in the message's metadata -- folded there from a server's
|
|
613
|
+
// result by `@ag-ui/client`, or written there by `AgUiClient` for a
|
|
614
|
+
// result it made itself -- read back through the same mapping the live
|
|
615
|
+
// path uses, so a card that said "declined" before the reload still
|
|
616
|
+
// says it after. History stored by an earlier release has it at the
|
|
617
|
+
// top level instead, which is read when the metadata has none. Narrowed
|
|
618
|
+
// off `unknown` rather than trusted, like every other field read out of
|
|
619
|
+
// the store: metadata is open by key, a host store may not round-trip
|
|
620
|
+
// it, and history written before outcomes existed has none. All three
|
|
621
|
+
// land on DONE, which is what this line did unconditionally.
|
|
621
622
|
card.settle(
|
|
622
|
-
toolStatusFromOutcome((message
|
|
623
|
-
|
|
623
|
+
toolStatusFromOutcome(metadataOrTopLevel(message, "outcome")),
|
|
624
|
+
// Flattened exactly as the live path flattens it, so a reload shows
|
|
625
|
+
// the card the user watched settle.
|
|
626
|
+
contentToText(message.content),
|
|
624
627
|
);
|
|
625
628
|
}
|
|
626
629
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION: string = "0.
|
|
1
|
+
export const VERSION: string = "0.41.0";
|