@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.
@@ -78,6 +78,15 @@ export declare class SubAgentPanel {
78
78
  #private;
79
79
  /** The panel's root; append this into the delegating card's slot. */
80
80
  readonly element: HTMLDivElement;
81
+ /**
82
+ * The child agent's name, as the last update that carried one gave it.
83
+ *
84
+ * Read back rather than only written to the DOM, because the two carriers
85
+ * split the name away from the close: `SUBAGENT_STARTED` names the agent and
86
+ * `SUBAGENT_FINISHED` carries only an id, so whoever words the closing line
87
+ * has to recover the name from what the delegation already told it.
88
+ */
89
+ get agent(): string | null;
81
90
  constructor(strings?: UiStrings);
82
91
  /**
83
92
  * Fold one announcement in.
@@ -1 +1 @@
1
- {"version":3,"file":"subagent_panel.d.ts","sourceRoot":"","sources":["../../src/ui/subagent_panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAErE,iEAAiE;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,4EAA4E;IAC5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IAAI,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,aAAa;;IACxB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAEjC;;;;;;;OAOG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAEzB;IAgBD,YAAY,OAAO,GAAE,SAA8B,EA2ClD;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAYnC;CAmDF"}
@@ -5,6 +5,15 @@
5
5
  * renderer: the panel's job is drawing, and a value that reaches it has already
6
6
  * been vouched for.
7
7
  *
8
+ * **The three lifecycle phases are still accepted here, deliberately.** A current
9
+ * server sends only `tool_call` and `tool_result` on this carrier -- the
10
+ * delegation's lifetime moved to the protocol's `SUBAGENT_*` events -- but a
11
+ * server one release older sends all five, and this element is published and
12
+ * vendored separately from it. Continuing to narrow the older shape costs
13
+ * nothing (the panel needs those phases as visual states regardless) and is the
14
+ * difference between a mixed-version pair that degrades and one that shows a
15
+ * delegation which never opens.
16
+ *
8
17
  * Defensive about the payload, not about the name. A `CUSTOM` event's `value` is
9
18
  * `unknown` by the protocol, so a server can put anything there, and a malformed
10
19
  * announcement must not take a run down with it — the same rule the invalidation
@@ -1 +1 @@
1
- {"version":3,"file":"subagent_update.d.ts","sourceRoot":"","sources":["../../src/ui/subagent_update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAA+B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4CvF,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAiBpE"}
1
+ {"version":3,"file":"subagent_update.d.ts","sourceRoot":"","sources":["../../src/ui/subagent_update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAA+B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4CvF,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAiBpE"}
@@ -131,6 +131,25 @@ export interface UiStrings {
131
131
  * must never be blank.
132
132
  */
133
133
  subAgentWorking: string;
134
+ /**
135
+ * The row's line while a delegation is running. Token: `{agent}`.
136
+ *
137
+ * Worded here rather than on the wire, unlike the two step phases. The
138
+ * protocol's `SUBAGENT_STARTED` carries the sub-agent's `name` and no rendered
139
+ * status -- which is the better shape for a localised UI, and the reason this
140
+ * string exists at all.
141
+ */
142
+ subAgentDelegatedTo: string;
143
+ /** The row's line once a delegation completed. Token: `{agent}`. */
144
+ subAgentFinished: string;
145
+ /**
146
+ * The row's line for a delegation that failed and named no agent.
147
+ *
148
+ * A fallback only: `SUBAGENT_ERROR` carries a required `message`, which the
149
+ * server fills with the sub-agent's name and nothing else, and that text is
150
+ * what the row shows. This covers a server that sent an empty one.
151
+ */
152
+ subAgentFailed: string;
134
153
  /** `aria-label` of the region holding the sub-agent's own tool calls. */
135
154
  subAgentSteps: string;
136
155
  /** `aria-label` of the editable arguments field on an approval card. */
@@ -1 +1 @@
1
- {"version":3,"file":"ui_strings.d.ts","sourceRoot":"","sources":["../../src/ui/ui_strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IAExB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IAGpB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC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,CAAC;IAGrB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,CAAC;IAGzB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IAGnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAGlB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,SAyHhC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CASvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artooi/ag-ui-web-component",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "Framework-free <ag-ui-chat> Web Component over the AG-UI protocol. Drop-in chat sidebar with a pluggable client-side tool registry, DOM driver primitives, animations, and destructive-action confirmation modal.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,8 +54,8 @@
54
54
  "node": ">=22"
55
55
  },
56
56
  "dependencies": {
57
- "@ag-ui/client": ">=0.0.54 <0.1",
58
- "@ag-ui/core": ">=0.0.54 <0.1",
57
+ "@ag-ui/client": ">=0.0.59 <0.1",
58
+ "@ag-ui/core": ">=0.0.59 <0.1",
59
59
  "dompurify": "^3.4.13",
60
60
  "marked": "^18.0.9"
61
61
  },
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's progress.
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 server spells them.
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
- * `FAILED` carries **no exception text**, deliberately the same reasoning that
149
- * redacts a `RUN_ERROR`, since an exception's words are written for an operator.
150
- * The detail rides the ordinary `TOOL_CALL_RESULT` for that delegation, on the
151
- * card the progress is already attached to.
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",
@@ -22,6 +22,7 @@ import {
22
22
  RUN_FINISHED_EVENT,
23
23
  STATE_EVENT,
24
24
  SUBAGENT_CUSTOM_NAME,
25
+ SUBAGENT_PHASE,
25
26
  SUBMIT_EVENT,
26
27
  SUGGESTIONS_ACTIVITY_TYPE,
27
28
  TOGGLE_EVENT,
@@ -82,7 +83,7 @@ import { renderRunNotice } from "../ui/run_notice.js";
82
83
  import { SkillsMenu } from "../ui/skills_menu.js";
83
84
  import { createStickToBottom, type StickToBottom } from "../ui/stick_to_bottom.js";
84
85
  import { STYLES } from "../ui/styles.js";
85
- import { SubAgentPanel } from "../ui/subagent_panel.js";
86
+ import { SubAgentPanel, type SubAgentPhase, type SubAgentUpdate } from "../ui/subagent_panel.js";
86
87
  import { subAgentUpdate } from "../ui/subagent_update.js";
87
88
  import { renderSuggestionChips } from "../ui/suggestion_chips.js";
88
89
  import { ThoughtsBlock } from "../ui/thoughts_block.js";
@@ -630,6 +631,17 @@ export class AgUiChat extends HTMLElement {
630
631
  * approval prompt already uses.
631
632
  */
632
633
  readonly #subagentPanels = new Map<string, SubAgentPanel>();
634
+ /**
635
+ * Which delegation each live `subagentRunId` belongs to.
636
+ *
637
+ * The protocol's closing events -- `SUBAGENT_FINISHED` and `SUBAGENT_ERROR`
638
+ * -- carry the child's run id and nothing else, while everything drawn here
639
+ * is keyed on the parent's `delegate_task` call id. `SUBAGENT_STARTED` is the
640
+ * one event carrying both, so the pairing is recorded there and read back on
641
+ * the close. A close naming a run this never saw open is dropped, which is
642
+ * the same refusal a step for an undrawn card gets.
643
+ */
644
+ readonly #subagentRunDelegations = new Map<string, string>();
633
645
  /**
634
646
  * Call ids whose card was already settled from a streamed server-side result
635
647
  * (`TOOL_CALL_RESULT`), so the post-run executeTool sweep doesn't overwrite
@@ -2473,6 +2485,7 @@ export class AgUiChat extends HTMLElement {
2473
2485
  // the correct half of that split -- a delegation that was live before this
2474
2486
  // transcript was wiped is not live now.
2475
2487
  this.#subagentPanels.clear();
2488
+ this.#subagentRunDelegations.clear();
2476
2489
  this.#serverSettled.clear();
2477
2490
  this.#cardElements.clear();
2478
2491
  this.#activityBlocks.clear();
@@ -3945,6 +3958,32 @@ export class AgUiChat extends HTMLElement {
3945
3958
  }),
3946
3959
  );
3947
3960
  },
3961
+ // The delegation's own lifetime, on the protocol's events rather than the
3962
+ // CUSTOM channel its steps ride. Both end at the same panel.
3963
+ onSubAgentStarted: (subagentRunId, agent, parentToolCallId) => {
3964
+ // A delegation naming no parent call names no card, and a floating
3965
+ // panel is exactly what attaching to the card was chosen over.
3966
+ if (parentToolCallId === null) {
3967
+ return;
3968
+ }
3969
+ this.#subagentRunDelegations.set(subagentRunId, parentToolCallId);
3970
+ this.#applySubAgent({
3971
+ delegationId: parentToolCallId,
3972
+ agent: agent === "" ? null : agent,
3973
+ phase: SUBAGENT_PHASE.STARTED,
3974
+ status: this.#strings.subAgentDelegatedTo.replace("{agent}", agent),
3975
+ tool: null,
3976
+ });
3977
+ },
3978
+ onSubAgentFinished: (subagentRunId) => {
3979
+ this.#closeSubAgent(subagentRunId, SUBAGENT_PHASE.FINISHED, null);
3980
+ },
3981
+ onSubAgentError: (subagentRunId, message) => {
3982
+ // The server's own words, which the contract keeps to the sub-agent's
3983
+ // name. Passed through as the status line and set with textContent
3984
+ // downstream, never parsed as markup.
3985
+ this.#closeSubAgent(subagentRunId, SUBAGENT_PHASE.FAILED, message);
3986
+ },
3948
3987
  onMessagesSnapshot: () => {
3949
3988
  // Honoured for persistence and announced, not re-rendered.
3950
3989
  //
@@ -4144,6 +4183,57 @@ export class AgUiChat extends HTMLElement {
4144
4183
  if (update === null) {
4145
4184
  return;
4146
4185
  }
4186
+ this.#applySubAgent(update);
4187
+ }
4188
+
4189
+ /**
4190
+ * Fold one already-narrowed update into the delegation's panel.
4191
+ *
4192
+ * The join point of the two carriers, and the reason it is separate from
4193
+ * {@link #reportSubAgent}: a `CUSTOM` step arrives as `unknown` and has to be
4194
+ * vouched for, while a lifecycle event arrives typed off the protocol and has
4195
+ * nothing left to check. Both end up here, so the panel has one way in and
4196
+ * the phases stay a single state machine regardless of which wire they came
4197
+ * from.
4198
+ */
4199
+ /**
4200
+ * Settle the delegation a closing lifecycle event names.
4201
+ *
4202
+ * `status` is the server's text on a failure and `null` on a success, where
4203
+ * the wording is this element's own -- the protocol's finish event carries no
4204
+ * message, which is the better shape for a localised UI and the reason
4205
+ * {@link UiStrings.subAgentFinished} exists.
4206
+ *
4207
+ * The pairing is deliberately not deleted on close. A panel outlives the
4208
+ * delegation it drew, the map is cleared with the transcript alongside the
4209
+ * panels, and forgetting the id here would only make a duplicate close draw
4210
+ * nothing instead of drawing the same settled row again.
4211
+ */
4212
+ #closeSubAgent(subagentRunId: string, phase: SubAgentPhase, status: string | null): void {
4213
+ const delegationId = this.#subagentRunDelegations.get(subagentRunId);
4214
+ if (delegationId === undefined) {
4215
+ // A close naming a delegation this never saw open -- the same refusal a
4216
+ // step for an undrawn card gets, and the same reason.
4217
+ return;
4218
+ }
4219
+ const agent = this.#subagentPanels.get(delegationId)?.agent ?? null;
4220
+ this.#applySubAgent({
4221
+ delegationId,
4222
+ agent,
4223
+ phase,
4224
+ status: status === null ? this.#finishedLine(agent) : status,
4225
+ tool: null,
4226
+ });
4227
+ }
4228
+
4229
+ /** The row's line for a delegation that completed, named if its name is known. */
4230
+ #finishedLine(agent: string | null): string {
4231
+ return agent === null
4232
+ ? this.#strings.subAgentWorking
4233
+ : this.#strings.subAgentFinished.replace("{agent}", agent);
4234
+ }
4235
+
4236
+ #applySubAgent(update: SubAgentUpdate): void {
4147
4237
  const card = this.#toolCards.get(update.delegationId);
4148
4238
  if (card === undefined) {
4149
4239
  return;
@@ -127,6 +127,31 @@ export interface AgUiClientHandlers {
127
127
  * be the thing the open field exists to avoid.
128
128
  */
129
129
  onCustomEvent(name: string, value: unknown): void;
130
+ /**
131
+ * A delegated sub-agent started, inside the run.
132
+ *
133
+ * The protocol's own event, unlike the steps that follow it on
134
+ * {@link SUBAGENT_CUSTOM_NAME}. `parentToolCallId` links the delegation to the
135
+ * `delegate_task` call that spawned it -- the field AG-UI provides for the
136
+ * "agents as tools" shape -- and is `null` when the server did not send one,
137
+ * which a host reads as a delegation it has nothing to attach to.
138
+ *
139
+ * `subagentRunId` names the child run and is the only id the two closing
140
+ * events carry, so a host that wants to close what it opened has to remember
141
+ * the pairing.
142
+ */
143
+ onSubAgentStarted(subagentRunId: string, name: string, parentToolCallId: string | null): void;
144
+ /** The delegation named by `subagentRunId` completed. */
145
+ onSubAgentFinished(subagentRunId: string): void;
146
+ /**
147
+ * The delegation named by `subagentRunId` failed.
148
+ *
149
+ * `message` is server text and required by the protocol, but it is not an
150
+ * exception's words: `django-ag-ui` sends only which sub-agent failed, on the
151
+ * same reasoning that redacts a `RUN_ERROR`. Render it as text, never as
152
+ * markup.
153
+ */
154
+ onSubAgentError(subagentRunId: string, message: string): void;
130
155
  onError(message: string): void;
131
156
  /**
132
157
  * Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
@@ -567,6 +592,22 @@ export class AgUiClient {
567
592
  onCustomEvent({ event }) {
568
593
  h.onCustomEvent(event.name, event.value);
569
594
  },
595
+ // The delegation lifecycle. Forwarded rather than interpreted here, for
596
+ // the reason every other subscriber in this block is thin: this file
597
+ // adapts the protocol to the handler surface, and what a delegation looks
598
+ // like on screen is the element's business.
599
+ //
600
+ // `parentToolCallId` is optional on the wire and normalised to `null` so
601
+ // the handler has one absent-value to check rather than two.
602
+ onSubagentStartedEvent({ event }) {
603
+ h.onSubAgentStarted(event.subagentRunId, event.name, event.parentToolCallId ?? null);
604
+ },
605
+ onSubagentFinishedEvent({ event }) {
606
+ h.onSubAgentFinished(event.subagentRunId);
607
+ },
608
+ onSubagentErrorEvent({ event }) {
609
+ h.onSubAgentError(event.subagentRunId, event.message);
610
+ },
570
611
  onMessagesSnapshotEvent({ event }) {
571
612
  h.onMessagesSnapshot(event.messages as readonly Message[]);
572
613
  },
@@ -82,6 +82,18 @@ export class SubAgentPanel {
82
82
  /** The panel's root; append this into the delegating card's slot. */
83
83
  readonly element: HTMLDivElement;
84
84
 
85
+ /**
86
+ * The child agent's name, as the last update that carried one gave it.
87
+ *
88
+ * Read back rather than only written to the DOM, because the two carriers
89
+ * split the name away from the close: `SUBAGENT_STARTED` names the agent and
90
+ * `SUBAGENT_FINISHED` carries only an id, so whoever words the closing line
91
+ * has to recover the name from what the delegation already told it.
92
+ */
93
+ get agent(): string | null {
94
+ return this.#agent;
95
+ }
96
+
85
97
  /**
86
98
  * The collapsed row, which is the expander as well as the status.
87
99
  *
@@ -94,6 +106,7 @@ export class SubAgentPanel {
94
106
  readonly #steps: HTMLDivElement;
95
107
  /** The child's tool calls, keyed by the child's own call id. */
96
108
  readonly #stepRows = new Map<string, HTMLDivElement>();
109
+ #agent: string | null = null;
97
110
 
98
111
  constructor(strings: UiStrings = DEFAULT_UI_STRINGS) {
99
112
  this.element = document.createElement("div");
@@ -151,6 +164,7 @@ export class SubAgentPanel {
151
164
  report(update: SubAgentUpdate): void {
152
165
  this.element.setAttribute("data-phase", update.phase);
153
166
  if (update.agent !== null) {
167
+ this.#agent = update.agent;
154
168
  this.element.setAttribute("data-agent", update.agent);
155
169
  }
156
170
  if (update.status !== null) {
@@ -5,6 +5,15 @@
5
5
  * renderer: the panel's job is drawing, and a value that reaches it has already
6
6
  * been vouched for.
7
7
  *
8
+ * **The three lifecycle phases are still accepted here, deliberately.** A current
9
+ * server sends only `tool_call` and `tool_result` on this carrier -- the
10
+ * delegation's lifetime moved to the protocol's `SUBAGENT_*` events -- but a
11
+ * server one release older sends all five, and this element is published and
12
+ * vendored separately from it. Continuing to narrow the older shape costs
13
+ * nothing (the panel needs those phases as visual states regardless) and is the
14
+ * difference between a mixed-version pair that degrades and one that shows a
15
+ * delegation which never opens.
16
+ *
8
17
  * Defensive about the payload, not about the name. A `CUSTOM` event's `value` is
9
18
  * `unknown` by the protocol, so a server can put anything there, and a malformed
10
19
  * announcement must not take a run down with it — the same rule the invalidation
@@ -140,6 +140,25 @@ export interface UiStrings {
140
140
  * must never be blank.
141
141
  */
142
142
  subAgentWorking: string;
143
+ /**
144
+ * The row's line while a delegation is running. Token: `{agent}`.
145
+ *
146
+ * Worded here rather than on the wire, unlike the two step phases. The
147
+ * protocol's `SUBAGENT_STARTED` carries the sub-agent's `name` and no rendered
148
+ * status -- which is the better shape for a localised UI, and the reason this
149
+ * string exists at all.
150
+ */
151
+ subAgentDelegatedTo: string;
152
+ /** The row's line once a delegation completed. Token: `{agent}`. */
153
+ subAgentFinished: string;
154
+ /**
155
+ * The row's line for a delegation that failed and named no agent.
156
+ *
157
+ * A fallback only: `SUBAGENT_ERROR` carries a required `message`, which the
158
+ * server fills with the sub-agent's name and nothing else, and that text is
159
+ * what the row shows. This covers a server that sent an empty one.
160
+ */
161
+ subAgentFailed: string;
143
162
  /** `aria-label` of the region holding the sub-agent's own tool calls. */
144
163
  subAgentSteps: string;
145
164
 
@@ -332,6 +351,9 @@ export const DEFAULT_UI_STRINGS: UiStrings = {
332
351
  details: "Details",
333
352
 
334
353
  subAgentWorking: "Working…",
354
+ subAgentDelegatedTo: "Delegated to {agent}",
355
+ subAgentFinished: "{agent} finished",
356
+ subAgentFailed: "The sub-agent failed",
335
357
  subAgentSteps: "Steps the sub-agent took",
336
358
 
337
359
  approvalEditArgs: "Edit the arguments before approving",
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION: string = "0.31.1";
1
+ export const VERSION: string = "0.32.0";