@artooi/ag-ui-web-component 0.31.1 → 0.32.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 +36 -1
- package/dist/ag-ui-web-component.bundle.js +48 -48
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +26 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +25 -0
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/index.js +110 -1
- package/dist/index.js.map +2 -2
- package/dist/ui/subagent_panel.d.ts +9 -0
- package/dist/ui/subagent_panel.d.ts.map +1 -1
- package/dist/ui/subagent_update.d.ts +9 -0
- package/dist/ui/subagent_update.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +19 -0
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/constants.ts +26 -7
- package/src/core/ag_ui_chat.ts +91 -1
- package/src/core/agui_client.ts +41 -0
- package/src/ui/subagent_panel.ts +14 -0
- package/src/ui/subagent_update.ts +9 -0
- package/src/ui/ui_strings.ts +22 -0
- package/src/version.ts +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ export declare const SUGGESTIONS_ACTIVITY_TYPE = "suggestions";
|
|
|
105
105
|
*/
|
|
106
106
|
export declare const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
107
107
|
/**
|
|
108
|
-
* The AG-UI `CUSTOM` event `name` carrying a delegated sub-agent
|
|
108
|
+
* The AG-UI `CUSTOM` event `name` carrying one step a delegated sub-agent took.
|
|
109
109
|
*
|
|
110
110
|
* Matched exactly, and namespaced the way {@link INVALIDATE_CUSTOM_NAME} is, so
|
|
111
111
|
* it cannot collide with a host's own custom events on the same open field.
|
|
@@ -115,24 +115,43 @@ export declare const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
|
115
115
|
* describes is already on screen and the progress belongs beside it. Every other
|
|
116
116
|
* name still reaches the host as {@link CUSTOM_AGENT_EVENT}.
|
|
117
117
|
*
|
|
118
|
+
* **This carries the steps only.** The delegation's own lifetime arrives on the
|
|
119
|
+
* protocol's `SUBAGENT_STARTED` / `SUBAGENT_FINISHED` / `SUBAGENT_ERROR` events,
|
|
120
|
+
* which name the same card through their `parentToolCallId`. The two are joined
|
|
121
|
+
* by that id, which is why the panel is keyed on it rather than on the
|
|
122
|
+
* `subagentRunId` the protocol's events carry.
|
|
123
|
+
*
|
|
118
124
|
* Deliberately on the imperative carrier and not on an activity, which means it
|
|
119
125
|
* is **never persisted and never replayed**. That is the right half of the
|
|
120
126
|
* split: a delegation that was live an hour ago is not live now, and replaying
|
|
121
127
|
* its progress on a thread restore would be a lie about a run that is over. On a
|
|
122
|
-
* reload mid-run the nested detail is gone and the tool card remains.
|
|
128
|
+
* reload mid-run the nested detail is gone and the tool card remains. The three
|
|
129
|
+
* lifecycle events share that property -- `@ag-ui/client` dispatches them to
|
|
130
|
+
* subscribers without writing them into `agent.messages` -- which is what made
|
|
131
|
+
* them safe to adopt while the steps stayed here.
|
|
123
132
|
*/
|
|
124
133
|
export declare const SUBAGENT_CUSTOM_NAME = "ag_ui.subagent";
|
|
125
134
|
/**
|
|
126
|
-
* The phases one delegation moves through, as the
|
|
135
|
+
* The phases one delegation moves through, as the panel draws them.
|
|
127
136
|
*
|
|
128
137
|
* Exactly one `STARTED` opens a delegation and exactly one `FINISHED` or
|
|
129
138
|
* `FAILED` closes it; the two tool phases repeat in between, once per call the
|
|
130
139
|
* child makes and once per result it gets back.
|
|
131
140
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
141
|
+
* **These are this element's five visual states, and they no longer come off one
|
|
142
|
+
* wire.** `TOOL_CALL` and `TOOL_RESULT` are spelled by the server, on the
|
|
143
|
+
* {@link SUBAGENT_CUSTOM_NAME} payload's `phase` field. The other three are this
|
|
144
|
+
* element's own names for the protocol's `SUBAGENT_STARTED` / `SUBAGENT_FINISHED`
|
|
145
|
+
* / `SUBAGENT_ERROR` events, which carry no phase field of their own because the
|
|
146
|
+
* event type *is* the phase. Keeping one vocabulary is what lets the panel stay
|
|
147
|
+
* a single state machine with one `data-phase` attribute for a host to style.
|
|
148
|
+
*
|
|
149
|
+
* `FAILED` carries **no exception text** from us — the protocol's error event
|
|
150
|
+
* has a required `message`, and the server sends only the sub-agent's name in
|
|
151
|
+
* it, on the same reasoning that redacts a `RUN_ERROR`, since an exception's
|
|
152
|
+
* words are written for an operator. The detail rides the ordinary
|
|
153
|
+
* `TOOL_CALL_RESULT` for that delegation, on the card the progress is already
|
|
154
|
+
* attached to.
|
|
136
155
|
*/
|
|
137
156
|
export declare const SUBAGENT_PHASE: {
|
|
138
157
|
readonly STARTED: "started";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,wEAAwE;AACxE,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,c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AAO,MAAM,SAAS,qJAAqI,CAAC;AAE5J,2CAA2C;AAC3C,eAAO,MAAM,WAAW,wJAAgJ,CAAC;AAEzK,yDAAyD;AACzD,eAAO,MAAM,UAAU,0MAA8L,CAAC;AAEtN,mFAAmF;AACnF,eAAO,MAAM,aAAa,2KAAmK,CAAC;AAE9L;;;;;GAKG;AACH,eAAO,MAAM,SAAS,0KAAgK,CAAC;AAEvL,sEAAsE;AACtE,eAAO,MAAM,eAAe,kOAA0M,CAAC;AAEvO,sEAAsE;AACtE,eAAO,MAAM,aAAa,iQAA2O,CAAC;AAEtQ,gDAAgD;AAChD,eAAO,MAAM,cAAc,8MAAkM,CAAC;AAE9N;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAiBL,YAAY,
|
|
1
|
+
{"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAiBL,YAAY,EAcb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM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6 +117,31 @@ export interface AgUiClientHandlers {
|
|
|
117
117
|
* be the thing the open field exists to avoid.
|
|
118
118
|
*/
|
|
119
119
|
onCustomEvent(name: string, value: unknown): void;
|
|
120
|
+
/**
|
|
121
|
+
* A delegated sub-agent started, inside the run.
|
|
122
|
+
*
|
|
123
|
+
* The protocol's own event, unlike the steps that follow it on
|
|
124
|
+
* {@link SUBAGENT_CUSTOM_NAME}. `parentToolCallId` links the delegation to the
|
|
125
|
+
* `delegate_task` call that spawned it -- the field AG-UI provides for the
|
|
126
|
+
* "agents as tools" shape -- and is `null` when the server did not send one,
|
|
127
|
+
* which a host reads as a delegation it has nothing to attach to.
|
|
128
|
+
*
|
|
129
|
+
* `subagentRunId` names the child run and is the only id the two closing
|
|
130
|
+
* events carry, so a host that wants to close what it opened has to remember
|
|
131
|
+
* the pairing.
|
|
132
|
+
*/
|
|
133
|
+
onSubAgentStarted(subagentRunId: string, name: string, parentToolCallId: string | null): void;
|
|
134
|
+
/** The delegation named by `subagentRunId` completed. */
|
|
135
|
+
onSubAgentFinished(subagentRunId: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* The delegation named by `subagentRunId` failed.
|
|
138
|
+
*
|
|
139
|
+
* `message` is server text and required by the protocol, but it is not an
|
|
140
|
+
* exception's words: `django-ag-ui` sends only which sub-agent failed, on the
|
|
141
|
+
* same reasoning that redacts a `RUN_ERROR`. Render it as text, never as
|
|
142
|
+
* markup.
|
|
143
|
+
*/
|
|
144
|
+
onSubAgentError(subagentRunId: string, message: string): void;
|
|
120
145
|
onError(message: string): void;
|
|
121
146
|
/**
|
|
122
147
|
* Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,SAA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,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAEvD;IAED,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAEjC;IAED;;;;;;;;;;;OAWG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,aAAa,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,kBAAkB,IAAI,SAAS,OAAO,EAAE,GAAG,IAAI,CAkB9C;IAED;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAED,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGvD;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAGb;CAiRF"}
|
package/dist/index.js
CHANGED
|
@@ -601,6 +601,9 @@ var DEFAULT_UI_STRINGS = {
|
|
|
601
601
|
declinedLabel: "Declined",
|
|
602
602
|
details: "Details",
|
|
603
603
|
subAgentWorking: "Working\u2026",
|
|
604
|
+
subAgentDelegatedTo: "Delegated to {agent}",
|
|
605
|
+
subAgentFinished: "{agent} finished",
|
|
606
|
+
subAgentFailed: "The sub-agent failed",
|
|
604
607
|
subAgentSteps: "Steps the sub-agent took",
|
|
605
608
|
approvalEditArgs: "Edit the arguments before approving",
|
|
606
609
|
approvalArgsInvalid: "That is not valid JSON, so nothing was sent.",
|
|
@@ -8201,6 +8204,17 @@ var STYLES = `
|
|
|
8201
8204
|
var SubAgentPanel = class {
|
|
8202
8205
|
/** The panel's root; append this into the delegating card's slot. */
|
|
8203
8206
|
element;
|
|
8207
|
+
/**
|
|
8208
|
+
* The child agent's name, as the last update that carried one gave it.
|
|
8209
|
+
*
|
|
8210
|
+
* Read back rather than only written to the DOM, because the two carriers
|
|
8211
|
+
* split the name away from the close: `SUBAGENT_STARTED` names the agent and
|
|
8212
|
+
* `SUBAGENT_FINISHED` carries only an id, so whoever words the closing line
|
|
8213
|
+
* has to recover the name from what the delegation already told it.
|
|
8214
|
+
*/
|
|
8215
|
+
get agent() {
|
|
8216
|
+
return this.#agent;
|
|
8217
|
+
}
|
|
8204
8218
|
/**
|
|
8205
8219
|
* The collapsed row, which is the expander as well as the status.
|
|
8206
8220
|
*
|
|
@@ -8213,6 +8227,7 @@ var SubAgentPanel = class {
|
|
|
8213
8227
|
#steps;
|
|
8214
8228
|
/** The child's tool calls, keyed by the child's own call id. */
|
|
8215
8229
|
#stepRows = /* @__PURE__ */ new Map();
|
|
8230
|
+
#agent = null;
|
|
8216
8231
|
constructor(strings = DEFAULT_UI_STRINGS) {
|
|
8217
8232
|
this.element = document.createElement("div");
|
|
8218
8233
|
this.element.className = "subagent";
|
|
@@ -8254,6 +8269,7 @@ var SubAgentPanel = class {
|
|
|
8254
8269
|
report(update) {
|
|
8255
8270
|
this.element.setAttribute("data-phase", update.phase);
|
|
8256
8271
|
if (update.agent !== null) {
|
|
8272
|
+
this.#agent = update.agent;
|
|
8257
8273
|
this.element.setAttribute("data-agent", update.agent);
|
|
8258
8274
|
}
|
|
8259
8275
|
if (update.status !== null) {
|
|
@@ -9398,6 +9414,22 @@ var AgUiClient = class {
|
|
|
9398
9414
|
onCustomEvent({ event }) {
|
|
9399
9415
|
h.onCustomEvent(event.name, event.value);
|
|
9400
9416
|
},
|
|
9417
|
+
// The delegation lifecycle. Forwarded rather than interpreted here, for
|
|
9418
|
+
// the reason every other subscriber in this block is thin: this file
|
|
9419
|
+
// adapts the protocol to the handler surface, and what a delegation looks
|
|
9420
|
+
// like on screen is the element's business.
|
|
9421
|
+
//
|
|
9422
|
+
// `parentToolCallId` is optional on the wire and normalised to `null` so
|
|
9423
|
+
// the handler has one absent-value to check rather than two.
|
|
9424
|
+
onSubagentStartedEvent({ event }) {
|
|
9425
|
+
h.onSubAgentStarted(event.subagentRunId, event.name, event.parentToolCallId ?? null);
|
|
9426
|
+
},
|
|
9427
|
+
onSubagentFinishedEvent({ event }) {
|
|
9428
|
+
h.onSubAgentFinished(event.subagentRunId);
|
|
9429
|
+
},
|
|
9430
|
+
onSubagentErrorEvent({ event }) {
|
|
9431
|
+
h.onSubAgentError(event.subagentRunId, event.message);
|
|
9432
|
+
},
|
|
9401
9433
|
onMessagesSnapshotEvent({ event }) {
|
|
9402
9434
|
h.onMessagesSnapshot(event.messages);
|
|
9403
9435
|
},
|
|
@@ -10380,6 +10412,17 @@ var AgUiChat = class extends HTMLElement {
|
|
|
10380
10412
|
* approval prompt already uses.
|
|
10381
10413
|
*/
|
|
10382
10414
|
#subagentPanels = /* @__PURE__ */ new Map();
|
|
10415
|
+
/**
|
|
10416
|
+
* Which delegation each live `subagentRunId` belongs to.
|
|
10417
|
+
*
|
|
10418
|
+
* The protocol's closing events -- `SUBAGENT_FINISHED` and `SUBAGENT_ERROR`
|
|
10419
|
+
* -- carry the child's run id and nothing else, while everything drawn here
|
|
10420
|
+
* is keyed on the parent's `delegate_task` call id. `SUBAGENT_STARTED` is the
|
|
10421
|
+
* one event carrying both, so the pairing is recorded there and read back on
|
|
10422
|
+
* the close. A close naming a run this never saw open is dropped, which is
|
|
10423
|
+
* the same refusal a step for an undrawn card gets.
|
|
10424
|
+
*/
|
|
10425
|
+
#subagentRunDelegations = /* @__PURE__ */ new Map();
|
|
10383
10426
|
/**
|
|
10384
10427
|
* Call ids whose card was already settled from a streamed server-side result
|
|
10385
10428
|
* (`TOOL_CALL_RESULT`), so the post-run executeTool sweep doesn't overwrite
|
|
@@ -11955,6 +11998,7 @@ ${quoted}`;
|
|
|
11955
11998
|
this.#hidePending();
|
|
11956
11999
|
this.#toolCards.clear();
|
|
11957
12000
|
this.#subagentPanels.clear();
|
|
12001
|
+
this.#subagentRunDelegations.clear();
|
|
11958
12002
|
this.#serverSettled.clear();
|
|
11959
12003
|
this.#cardElements.clear();
|
|
11960
12004
|
this.#activityBlocks.clear();
|
|
@@ -13081,6 +13125,27 @@ ${quoted}`;
|
|
|
13081
13125
|
})
|
|
13082
13126
|
);
|
|
13083
13127
|
},
|
|
13128
|
+
// The delegation's own lifetime, on the protocol's events rather than the
|
|
13129
|
+
// CUSTOM channel its steps ride. Both end at the same panel.
|
|
13130
|
+
onSubAgentStarted: (subagentRunId, agent, parentToolCallId) => {
|
|
13131
|
+
if (parentToolCallId === null) {
|
|
13132
|
+
return;
|
|
13133
|
+
}
|
|
13134
|
+
this.#subagentRunDelegations.set(subagentRunId, parentToolCallId);
|
|
13135
|
+
this.#applySubAgent({
|
|
13136
|
+
delegationId: parentToolCallId,
|
|
13137
|
+
agent: agent === "" ? null : agent,
|
|
13138
|
+
phase: SUBAGENT_PHASE.STARTED,
|
|
13139
|
+
status: this.#strings.subAgentDelegatedTo.replace("{agent}", agent),
|
|
13140
|
+
tool: null
|
|
13141
|
+
});
|
|
13142
|
+
},
|
|
13143
|
+
onSubAgentFinished: (subagentRunId) => {
|
|
13144
|
+
this.#closeSubAgent(subagentRunId, SUBAGENT_PHASE.FINISHED, null);
|
|
13145
|
+
},
|
|
13146
|
+
onSubAgentError: (subagentRunId, message) => {
|
|
13147
|
+
this.#closeSubAgent(subagentRunId, SUBAGENT_PHASE.FAILED, message);
|
|
13148
|
+
},
|
|
13084
13149
|
onMessagesSnapshot: () => {
|
|
13085
13150
|
this.#appendNotice("\u{1F504}", this.#strings.historyReplaced, "history-replaced");
|
|
13086
13151
|
},
|
|
@@ -13221,6 +13286,50 @@ ${quoted}`;
|
|
|
13221
13286
|
if (update === null) {
|
|
13222
13287
|
return;
|
|
13223
13288
|
}
|
|
13289
|
+
this.#applySubAgent(update);
|
|
13290
|
+
}
|
|
13291
|
+
/**
|
|
13292
|
+
* Fold one already-narrowed update into the delegation's panel.
|
|
13293
|
+
*
|
|
13294
|
+
* The join point of the two carriers, and the reason it is separate from
|
|
13295
|
+
* {@link #reportSubAgent}: a `CUSTOM` step arrives as `unknown` and has to be
|
|
13296
|
+
* vouched for, while a lifecycle event arrives typed off the protocol and has
|
|
13297
|
+
* nothing left to check. Both end up here, so the panel has one way in and
|
|
13298
|
+
* the phases stay a single state machine regardless of which wire they came
|
|
13299
|
+
* from.
|
|
13300
|
+
*/
|
|
13301
|
+
/**
|
|
13302
|
+
* Settle the delegation a closing lifecycle event names.
|
|
13303
|
+
*
|
|
13304
|
+
* `status` is the server's text on a failure and `null` on a success, where
|
|
13305
|
+
* the wording is this element's own -- the protocol's finish event carries no
|
|
13306
|
+
* message, which is the better shape for a localised UI and the reason
|
|
13307
|
+
* {@link UiStrings.subAgentFinished} exists.
|
|
13308
|
+
*
|
|
13309
|
+
* The pairing is deliberately not deleted on close. A panel outlives the
|
|
13310
|
+
* delegation it drew, the map is cleared with the transcript alongside the
|
|
13311
|
+
* panels, and forgetting the id here would only make a duplicate close draw
|
|
13312
|
+
* nothing instead of drawing the same settled row again.
|
|
13313
|
+
*/
|
|
13314
|
+
#closeSubAgent(subagentRunId, phase, status) {
|
|
13315
|
+
const delegationId = this.#subagentRunDelegations.get(subagentRunId);
|
|
13316
|
+
if (delegationId === void 0) {
|
|
13317
|
+
return;
|
|
13318
|
+
}
|
|
13319
|
+
const agent = this.#subagentPanels.get(delegationId)?.agent ?? null;
|
|
13320
|
+
this.#applySubAgent({
|
|
13321
|
+
delegationId,
|
|
13322
|
+
agent,
|
|
13323
|
+
phase,
|
|
13324
|
+
status: status === null ? this.#finishedLine(agent) : status,
|
|
13325
|
+
tool: null
|
|
13326
|
+
});
|
|
13327
|
+
}
|
|
13328
|
+
/** The row's line for a delegation that completed, named if its name is known. */
|
|
13329
|
+
#finishedLine(agent) {
|
|
13330
|
+
return agent === null ? this.#strings.subAgentWorking : this.#strings.subAgentFinished.replace("{agent}", agent);
|
|
13331
|
+
}
|
|
13332
|
+
#applySubAgent(update) {
|
|
13224
13333
|
const card = this.#toolCards.get(update.delegationId);
|
|
13225
13334
|
if (card === void 0) {
|
|
13226
13335
|
return;
|
|
@@ -13649,7 +13758,7 @@ function setControlValue(el2, value) {
|
|
|
13649
13758
|
}
|
|
13650
13759
|
|
|
13651
13760
|
// src/version.ts
|
|
13652
|
-
var VERSION = "0.
|
|
13761
|
+
var VERSION = "0.32.0";
|
|
13653
13762
|
export {
|
|
13654
13763
|
ATTACHMENT_EVENT,
|
|
13655
13764
|
AgUiChat,
|