@artooi/ag-ui-web-component 0.31.1 → 0.33.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 +197 -1
- package/README.md +182 -23
- package/dist/ag-ui-web-component.bundle.js +352 -128
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +34 -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 +1367 -388
- package/dist/index.js.map +4 -4
- package/dist/ui/clamp_launcher.d.ts +15 -0
- package/dist/ui/clamp_launcher.d.ts.map +1 -0
- package/dist/ui/copy_payload.d.ts +30 -0
- package/dist/ui/copy_payload.d.ts.map +1 -0
- package/dist/ui/launcher_drag.d.ts +43 -0
- package/dist/ui/launcher_drag.d.ts.map +1 -0
- package/dist/ui/launcher_placement.d.ts +64 -0
- package/dist/ui/launcher_placement.d.ts.map +1 -0
- package/dist/ui/message_actions.d.ts +30 -2
- package/dist/ui/message_actions.d.ts.map +1 -1
- package/dist/ui/resize_handle.d.ts +32 -26
- package/dist/ui/resize_handle.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- 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 +38 -7
- package/src/core/ag_ui_chat.ts +570 -24
- package/src/core/agui_client.ts +41 -0
- package/src/ui/clamp_launcher.ts +20 -0
- package/src/ui/copy_payload.ts +156 -0
- package/src/ui/launcher_drag.ts +182 -0
- package/src/ui/launcher_placement.ts +143 -0
- package/src/ui/message_actions.ts +93 -19
- package/src/ui/resize_handle.ts +109 -73
- package/src/ui/styles.ts +283 -81
- 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/src/constants.ts
CHANGED
|
@@ -120,7 +120,7 @@ export const SUGGESTIONS_ACTIVITY_TYPE = "suggestions";
|
|
|
120
120
|
export const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* The AG-UI `CUSTOM` event `name` carrying a delegated sub-agent
|
|
123
|
+
* The AG-UI `CUSTOM` event `name` carrying one step a delegated sub-agent took.
|
|
124
124
|
*
|
|
125
125
|
* Matched exactly, and namespaced the way {@link INVALIDATE_CUSTOM_NAME} is, so
|
|
126
126
|
* it cannot collide with a host's own custom events on the same open field.
|
|
@@ -130,25 +130,44 @@ export const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
|
130
130
|
* describes is already on screen and the progress belongs beside it. Every other
|
|
131
131
|
* name still reaches the host as {@link CUSTOM_AGENT_EVENT}.
|
|
132
132
|
*
|
|
133
|
+
* **This carries the steps only.** The delegation's own lifetime arrives on the
|
|
134
|
+
* protocol's `SUBAGENT_STARTED` / `SUBAGENT_FINISHED` / `SUBAGENT_ERROR` events,
|
|
135
|
+
* which name the same card through their `parentToolCallId`. The two are joined
|
|
136
|
+
* by that id, which is why the panel is keyed on it rather than on the
|
|
137
|
+
* `subagentRunId` the protocol's events carry.
|
|
138
|
+
*
|
|
133
139
|
* Deliberately on the imperative carrier and not on an activity, which means it
|
|
134
140
|
* is **never persisted and never replayed**. That is the right half of the
|
|
135
141
|
* split: a delegation that was live an hour ago is not live now, and replaying
|
|
136
142
|
* its progress on a thread restore would be a lie about a run that is over. On a
|
|
137
|
-
* reload mid-run the nested detail is gone and the tool card remains.
|
|
143
|
+
* reload mid-run the nested detail is gone and the tool card remains. The three
|
|
144
|
+
* lifecycle events share that property -- `@ag-ui/client` dispatches them to
|
|
145
|
+
* subscribers without writing them into `agent.messages` -- which is what made
|
|
146
|
+
* them safe to adopt while the steps stayed here.
|
|
138
147
|
*/
|
|
139
148
|
export const SUBAGENT_CUSTOM_NAME = "ag_ui.subagent";
|
|
140
149
|
|
|
141
150
|
/**
|
|
142
|
-
* The phases one delegation moves through, as the
|
|
151
|
+
* The phases one delegation moves through, as the panel draws them.
|
|
143
152
|
*
|
|
144
153
|
* Exactly one `STARTED` opens a delegation and exactly one `FINISHED` or
|
|
145
154
|
* `FAILED` closes it; the two tool phases repeat in between, once per call the
|
|
146
155
|
* child makes and once per result it gets back.
|
|
147
156
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
157
|
+
* **These are this element's five visual states, and they no longer come off one
|
|
158
|
+
* wire.** `TOOL_CALL` and `TOOL_RESULT` are spelled by the server, on the
|
|
159
|
+
* {@link SUBAGENT_CUSTOM_NAME} payload's `phase` field. The other three are this
|
|
160
|
+
* element's own names for the protocol's `SUBAGENT_STARTED` / `SUBAGENT_FINISHED`
|
|
161
|
+
* / `SUBAGENT_ERROR` events, which carry no phase field of their own because the
|
|
162
|
+
* event type *is* the phase. Keeping one vocabulary is what lets the panel stay
|
|
163
|
+
* a single state machine with one `data-phase` attribute for a host to style.
|
|
164
|
+
*
|
|
165
|
+
* `FAILED` carries **no exception text** from us — the protocol's error event
|
|
166
|
+
* has a required `message`, and the server sends only the sub-agent's name in
|
|
167
|
+
* it, on the same reasoning that redacts a `RUN_ERROR`, since an exception's
|
|
168
|
+
* words are written for an operator. The detail rides the ordinary
|
|
169
|
+
* `TOOL_CALL_RESULT` for that delegation, on the card the progress is already
|
|
170
|
+
* attached to.
|
|
152
171
|
*/
|
|
153
172
|
export const SUBAGENT_PHASE = {
|
|
154
173
|
STARTED: "started",
|
|
@@ -327,6 +346,18 @@ export const ICON_LAUNCHER = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden
|
|
|
327
346
|
* above; `iconFor` selects one by MIME family, never interpolating the MIME
|
|
328
347
|
* string into the markup.
|
|
329
348
|
*/
|
|
349
|
+
/** Copy: two overlapping sheets, the shape every toolbar uses for it. */
|
|
350
|
+
export const ICON_COPY: string = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h8"/></svg>`;
|
|
351
|
+
|
|
352
|
+
/** Retry: a circular arrow. */
|
|
353
|
+
export const ICON_RETRY: string = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.5-5.8"/><path d="M20 4v4h-4"/></svg>`;
|
|
354
|
+
|
|
355
|
+
/** Rate up. */
|
|
356
|
+
export const ICON_THUMB_UP: string = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10v10H4V10z"/><path d="M7 10l4.5-7a2 2 0 0 1 3.4 2L13.5 9H19a2 2 0 0 1 2 2.3l-1.1 6.4A2 2 0 0 1 17.9 20H7"/></svg>`;
|
|
357
|
+
|
|
358
|
+
/** Rate down: the up mark turned over, so the pair reads as one control. */
|
|
359
|
+
export const ICON_THUMB_DOWN: string = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M17 14V4h3v10z"/><path d="M17 14l-4.5 7a2 2 0 0 1-3.4-2l1.4-4H5a2 2 0 0 1-2-2.3l1.1-6.4A2 2 0 0 1 6.1 4H17"/></svg>`;
|
|
360
|
+
|
|
330
361
|
export const ICON_FILE = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/></svg>`;
|
|
331
362
|
|
|
332
363
|
/** An image attachment: a framed picture with a horizon and a sun. */
|