@artooi/ag-ui-web-component 0.2.0 → 0.2.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/CHANGELOG.md +24 -1
- package/README.md +7 -3
- package/dist/ag-ui-web-component.bundle.js +7 -7
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +13 -0
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/index.js +72 -9
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/ag_ui_chat.ts +73 -8
- package/src/core/agui_client.ts +18 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,YAAY,EAOb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAM9E,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO7E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,wBAAwB,CAAC;AAE5E,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAA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C,KAAK,EAAE,eAAe,EAErC;IAED,iBAAiB,IAAI,IAAI;IAUzB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI;IAoEzC,gFAAgF;IAChF,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAgBtC,qEAAqE;IACrE,eAAe,IAAI,IAAI;IAIvB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAqGf;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc;CA0UlE"}
|
|
@@ -40,8 +40,21 @@ export interface AgUiClientHandlers {
|
|
|
40
40
|
onTextEnd(buffer: string): void;
|
|
41
41
|
/** Fired when the agent finishes calling a tool (server- or frontend-side). */
|
|
42
42
|
onToolCall(call: AgUiToolCall): void;
|
|
43
|
+
/**
|
|
44
|
+
* Fired when a server-side tool's result streams back (AG-UI's
|
|
45
|
+
* `TOOL_CALL_RESULT`). Frontend tools don't emit this — the client supplies
|
|
46
|
+
* their result itself — so this is the channel for server-executed output.
|
|
47
|
+
*/
|
|
48
|
+
onToolResult(toolCallId: string, content: string): void;
|
|
43
49
|
onRunEnd(): void;
|
|
44
50
|
onError(message: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Fired exactly once when the whole interaction settles — after the run loop
|
|
53
|
+
* ends for any reason (a server-only round, frontend-tool rounds exhausted,
|
|
54
|
+
* or an error). The terminal guarantee that the UI returns to rest (pending
|
|
55
|
+
* indicator cleared, input re-enabled) no matter how the run finished.
|
|
56
|
+
*/
|
|
57
|
+
onSettled(): void;
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
47
60
|
* Provider of the per-run frontend tool catalog and context. Both are read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoC,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAG1D,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,IAAI,IAAI,CAAC;IACnB,yEAAyE;IACzE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gFAAgF;IAChF,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,+EAA+E;IAC/E,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IACrC,QAAQ,IAAI,IAAI,CAAC;IACjB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoC,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,EAAE,OAA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AAW,gBAAiB,SAAQ,aAAa;IACrD,sEAAsE;IACtE,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,oEAAoE;IACpE,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;;gBAQT,MAAM,EAAE,gBAAgB;IASpC,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAEjC;IAED;;;;;;OAMG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CAoFzD"}
|
package/dist/index.js
CHANGED
|
@@ -3669,6 +3669,8 @@ var AgUiClient = class {
|
|
|
3669
3669
|
await this.#runLoop();
|
|
3670
3670
|
} catch (error) {
|
|
3671
3671
|
this.#handlers.onError(error instanceof Error ? error.message : String(error));
|
|
3672
|
+
} finally {
|
|
3673
|
+
this.#handlers.onSettled();
|
|
3672
3674
|
}
|
|
3673
3675
|
}
|
|
3674
3676
|
async #runLoop() {
|
|
@@ -3726,6 +3728,9 @@ var AgUiClient = class {
|
|
|
3726
3728
|
pending.push(call);
|
|
3727
3729
|
h.onToolCall(call);
|
|
3728
3730
|
},
|
|
3731
|
+
onToolCallResultEvent({ event }) {
|
|
3732
|
+
h.onToolResult(event.toolCallId, event.content);
|
|
3733
|
+
},
|
|
3729
3734
|
onRunErrorEvent({ event }) {
|
|
3730
3735
|
h.onError(event.message);
|
|
3731
3736
|
},
|
|
@@ -3880,6 +3885,12 @@ var AgUiChat = class extends HTMLElement {
|
|
|
3880
3885
|
#toolRegistry = new ClientToolRegistry();
|
|
3881
3886
|
/** Tool-call cards awaiting execution, keyed by call id. */
|
|
3882
3887
|
#toolCards = /* @__PURE__ */ new Map();
|
|
3888
|
+
/**
|
|
3889
|
+
* Call ids whose card was already settled from a streamed server-side result
|
|
3890
|
+
* (`TOOL_CALL_RESULT`), so the post-run executeTool sweep doesn't overwrite
|
|
3891
|
+
* the real output with the generic "executed on the server" fallback.
|
|
3892
|
+
*/
|
|
3893
|
+
#serverSettled = /* @__PURE__ */ new Set();
|
|
3883
3894
|
#root;
|
|
3884
3895
|
#chat;
|
|
3885
3896
|
#messages;
|
|
@@ -4107,6 +4118,7 @@ var AgUiChat = class extends HTMLElement {
|
|
|
4107
4118
|
this.#streamingBubble = null;
|
|
4108
4119
|
this.#hidePending();
|
|
4109
4120
|
this.#toolCards.clear();
|
|
4121
|
+
this.#serverSettled.clear();
|
|
4110
4122
|
this.#initialMessages = [];
|
|
4111
4123
|
this.#messages.replaceChildren();
|
|
4112
4124
|
this.#threadId = this.conversationStore.threadId();
|
|
@@ -4130,17 +4142,54 @@ var AgUiChat = class extends HTMLElement {
|
|
|
4130
4142
|
await this.#resumeFrom(checkpoint);
|
|
4131
4143
|
}
|
|
4132
4144
|
}
|
|
4133
|
-
/**
|
|
4145
|
+
/**
|
|
4146
|
+
* Replay a restored message: text bubbles *and* tool activity. An assistant
|
|
4147
|
+
* turn may carry `toolCalls` (rendered as cards) and/or text; a `tool` turn
|
|
4148
|
+
* carries a result that settles the matching card. So a refreshed page shows
|
|
4149
|
+
* the full transcript — tool calls and their results — not just the prose.
|
|
4150
|
+
*/
|
|
4134
4151
|
#renderHistoricMessage(message) {
|
|
4135
|
-
|
|
4152
|
+
const text2 = typeof message.content === "string" ? message.content : "";
|
|
4153
|
+
if (message.role === MESSAGE_ROLE.USER) {
|
|
4154
|
+
if (text2 !== "") {
|
|
4155
|
+
this.appendMessage(MESSAGE_ROLE.USER, text2);
|
|
4156
|
+
}
|
|
4136
4157
|
return;
|
|
4137
4158
|
}
|
|
4138
|
-
if (message.role === MESSAGE_ROLE.
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4159
|
+
if (message.role === MESSAGE_ROLE.ASSISTANT) {
|
|
4160
|
+
if (text2 !== "") {
|
|
4161
|
+
this.#revealWords(this.appendMessage(MESSAGE_ROLE.ASSISTANT, text2));
|
|
4162
|
+
}
|
|
4163
|
+
const toolCalls = message.toolCalls;
|
|
4164
|
+
if (toolCalls !== void 0) {
|
|
4165
|
+
for (const call of toolCalls) {
|
|
4166
|
+
this.#cardFor({
|
|
4167
|
+
id: call.id,
|
|
4168
|
+
name: call.function.name,
|
|
4169
|
+
args: this.#parseArgs(call.function.arguments)
|
|
4170
|
+
});
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
return;
|
|
4174
|
+
}
|
|
4175
|
+
if (message.role === "tool") {
|
|
4176
|
+
const card = this.#toolCards.get(message.toolCallId);
|
|
4177
|
+
if (card !== void 0) {
|
|
4178
|
+
card.settle(TOOL_CALL_STATUS.DONE, message.content);
|
|
4179
|
+
}
|
|
4142
4180
|
}
|
|
4143
4181
|
}
|
|
4182
|
+
/** Parse a tool call's JSON `arguments` string from history into an object. */
|
|
4183
|
+
#parseArgs(raw) {
|
|
4184
|
+
try {
|
|
4185
|
+
const parsed = JSON.parse(raw);
|
|
4186
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
4187
|
+
return parsed;
|
|
4188
|
+
}
|
|
4189
|
+
} catch {
|
|
4190
|
+
}
|
|
4191
|
+
return {};
|
|
4192
|
+
}
|
|
4144
4193
|
/**
|
|
4145
4194
|
* Word-by-word reveal for the `word` text-animation mode, applied to a
|
|
4146
4195
|
* completed assistant bubble. `fade` is pure CSS (no JS); `none` is a no-op.
|
|
@@ -4305,8 +4354,9 @@ var AgUiChat = class extends HTMLElement {
|
|
|
4305
4354
|
this.#toolCards.delete(call.id);
|
|
4306
4355
|
const tool = this.#resolveTool(call.name);
|
|
4307
4356
|
if (tool === null) {
|
|
4308
|
-
|
|
4309
|
-
|
|
4357
|
+
if (!this.#serverSettled.has(call.id)) {
|
|
4358
|
+
card.settle(TOOL_CALL_STATUS.DONE, "Executed on the server.");
|
|
4359
|
+
}
|
|
4310
4360
|
return null;
|
|
4311
4361
|
}
|
|
4312
4362
|
if (await this.#needsConfirmation(call, tool)) {
|
|
@@ -4367,6 +4417,14 @@ var AgUiChat = class extends HTMLElement {
|
|
|
4367
4417
|
this.#hidePending();
|
|
4368
4418
|
this.#cardFor(call);
|
|
4369
4419
|
},
|
|
4420
|
+
onToolResult: (toolCallId, content) => {
|
|
4421
|
+
const card = this.#toolCards.get(toolCallId);
|
|
4422
|
+
if (card === void 0) {
|
|
4423
|
+
return;
|
|
4424
|
+
}
|
|
4425
|
+
card.settle(TOOL_CALL_STATUS.DONE, content);
|
|
4426
|
+
this.#serverSettled.add(toolCallId);
|
|
4427
|
+
},
|
|
4370
4428
|
onRunEnd: () => {
|
|
4371
4429
|
this.#hidePending();
|
|
4372
4430
|
this.#send.disabled = false;
|
|
@@ -4377,6 +4435,11 @@ var AgUiChat = class extends HTMLElement {
|
|
|
4377
4435
|
this.#revealWords(this.appendMessage(MESSAGE_ROLE.ASSISTANT, `\u26A0\uFE0F ${message}`));
|
|
4378
4436
|
this.#send.disabled = false;
|
|
4379
4437
|
this.#streamingBubble = null;
|
|
4438
|
+
},
|
|
4439
|
+
onSettled: () => {
|
|
4440
|
+
this.#hidePending();
|
|
4441
|
+
this.#send.disabled = false;
|
|
4442
|
+
this.#streamingBubble = null;
|
|
4380
4443
|
}
|
|
4381
4444
|
};
|
|
4382
4445
|
}
|
|
@@ -4604,7 +4667,7 @@ function setControlValue(el, value) {
|
|
|
4604
4667
|
}
|
|
4605
4668
|
|
|
4606
4669
|
// src/version.ts
|
|
4607
|
-
var VERSION = "0.2.
|
|
4670
|
+
var VERSION = "0.2.1";
|
|
4608
4671
|
export {
|
|
4609
4672
|
AgUiChat,
|
|
4610
4673
|
AgUiClient,
|