@artooi/ag-ui-web-component 0.23.0 → 0.24.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +149 -36
  2. package/README.md +140 -9
  3. package/dist/ag-ui-web-component.bundle.js +113 -122
  4. package/dist/ag-ui-web-component.bundle.js.map +3 -3
  5. package/dist/constants.d.ts +71 -85
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/core/ag_ui_chat.d.ts +105 -127
  8. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  9. package/dist/core/agui_client.d.ts +24 -30
  10. package/dist/core/agui_client.d.ts.map +1 -1
  11. package/dist/core/attachment.d.ts +9 -14
  12. package/dist/core/attachment.d.ts.map +1 -1
  13. package/dist/core/conversation_store.d.ts +38 -27
  14. package/dist/core/conversation_store.d.ts.map +1 -1
  15. package/dist/core/create_http_agent.d.ts +13 -15
  16. package/dist/core/create_http_agent.d.ts.map +1 -1
  17. package/dist/core/remote_conversation_store.d.ts +10 -9
  18. package/dist/core/remote_conversation_store.d.ts.map +1 -1
  19. package/dist/core/run_index.d.ts +11 -20
  20. package/dist/core/run_index.d.ts.map +1 -1
  21. package/dist/core/transcribe_audio.d.ts +8 -8
  22. package/dist/core/transcribe_audio.d.ts.map +1 -1
  23. package/dist/core/upload_attachment.d.ts +15 -18
  24. package/dist/core/upload_attachment.d.ts.map +1 -1
  25. package/dist/core/utils.d.ts +4 -6
  26. package/dist/core/utils.d.ts.map +1 -1
  27. package/dist/dom/animations.d.ts +22 -30
  28. package/dist/dom/animations.d.ts.map +1 -1
  29. package/dist/dom/dom_driver.d.ts +7 -7
  30. package/dist/dom/native_setter.d.ts +2 -2
  31. package/dist/dom/native_setter.d.ts.map +1 -1
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +357 -383
  35. package/dist/index.js.map +2 -2
  36. package/dist/skills/fill_template.d.ts +4 -5
  37. package/dist/skills/fill_template.d.ts.map +1 -1
  38. package/dist/skills/parse_skills.d.ts.map +1 -1
  39. package/dist/skills/skill.d.ts +7 -8
  40. package/dist/skills/skill.d.ts.map +1 -1
  41. package/dist/tools/client_tool_registry.d.ts +2 -2
  42. package/dist/tools/page_action_tools.d.ts +7 -10
  43. package/dist/tools/page_action_tools.d.ts.map +1 -1
  44. package/dist/tools/page_state.d.ts +5 -8
  45. package/dist/tools/page_state.d.ts.map +1 -1
  46. package/dist/tools/route_map.d.ts +7 -10
  47. package/dist/tools/route_map.d.ts.map +1 -1
  48. package/dist/ui/approval_card.d.ts +15 -20
  49. package/dist/ui/approval_card.d.ts.map +1 -1
  50. package/dist/ui/attach_copy_buttons.d.ts +4 -10
  51. package/dist/ui/attach_copy_buttons.d.ts.map +1 -1
  52. package/dist/ui/attachment_chips.d.ts +7 -10
  53. package/dist/ui/attachment_chips.d.ts.map +1 -1
  54. package/dist/ui/attachment_tray.d.ts +6 -6
  55. package/dist/ui/checkpoint_menu.d.ts +7 -8
  56. package/dist/ui/checkpoint_menu.d.ts.map +1 -1
  57. package/dist/ui/confirmation_card.d.ts +10 -15
  58. package/dist/ui/confirmation_card.d.ts.map +1 -1
  59. package/dist/ui/question_card.d.ts +12 -15
  60. package/dist/ui/question_card.d.ts.map +1 -1
  61. package/dist/ui/relative_time.d.ts +5 -7
  62. package/dist/ui/relative_time.d.ts.map +1 -1
  63. package/dist/ui/render_markdown.d.ts +8 -8
  64. package/dist/ui/render_markdown.d.ts.map +1 -1
  65. package/dist/ui/resize_handle.d.ts +21 -34
  66. package/dist/ui/resize_handle.d.ts.map +1 -1
  67. package/dist/ui/run_notice.d.ts +5 -7
  68. package/dist/ui/run_notice.d.ts.map +1 -1
  69. package/dist/ui/skills_menu.d.ts +4 -5
  70. package/dist/ui/skills_menu.d.ts.map +1 -1
  71. package/dist/ui/styles.d.ts +1 -1
  72. package/dist/ui/styles.d.ts.map +1 -1
  73. package/dist/ui/thoughts_block.d.ts +9 -11
  74. package/dist/ui/thoughts_block.d.ts.map +1 -1
  75. package/dist/ui/thread_drawer.d.ts +6 -5
  76. package/dist/ui/thread_drawer.d.ts.map +1 -1
  77. package/dist/ui/tool_call_card.d.ts +17 -25
  78. package/dist/ui/tool_call_card.d.ts.map +1 -1
  79. package/dist/ui/ui_strings.d.ts +6 -12
  80. package/dist/ui/ui_strings.d.ts.map +1 -1
  81. package/dist/ui/voice_input.d.ts +10 -11
  82. package/dist/ui/voice_input.d.ts.map +1 -1
  83. package/package.json +1 -1
  84. package/src/constants.ts +74 -87
  85. package/src/core/ag_ui_chat.ts +313 -269
  86. package/src/core/agui_client.ts +60 -71
  87. package/src/core/attachment.ts +9 -14
  88. package/src/core/conversation_store.ts +55 -33
  89. package/src/core/create_http_agent.ts +18 -22
  90. package/src/core/remote_conversation_store.ts +28 -15
  91. package/src/core/run_index.ts +14 -23
  92. package/src/core/transcribe_audio.ts +9 -10
  93. package/src/core/upload_attachment.ts +18 -21
  94. package/src/core/utils.ts +4 -6
  95. package/src/dom/animations.ts +33 -43
  96. package/src/dom/dom_driver.ts +7 -7
  97. package/src/dom/native_setter.ts +11 -12
  98. package/src/index.ts +3 -0
  99. package/src/skills/fill_template.ts +4 -5
  100. package/src/skills/parse_skills.ts +3 -4
  101. package/src/skills/skill.ts +7 -8
  102. package/src/tools/client_tool_registry.ts +2 -2
  103. package/src/tools/page_action_tools.ts +12 -15
  104. package/src/tools/page_state.ts +5 -8
  105. package/src/tools/route_map.ts +15 -19
  106. package/src/ui/approval_card.ts +15 -20
  107. package/src/ui/attach_copy_buttons.ts +9 -18
  108. package/src/ui/attachment_chips.ts +7 -10
  109. package/src/ui/attachment_tray.ts +6 -6
  110. package/src/ui/checkpoint_menu.ts +7 -8
  111. package/src/ui/confirmation_card.ts +10 -15
  112. package/src/ui/question_card.ts +12 -15
  113. package/src/ui/relative_time.ts +5 -7
  114. package/src/ui/render_markdown.ts +25 -51
  115. package/src/ui/resize_handle.ts +25 -38
  116. package/src/ui/run_notice.ts +9 -12
  117. package/src/ui/skills_menu.ts +4 -5
  118. package/src/ui/styles.ts +92 -101
  119. package/src/ui/thoughts_block.ts +11 -13
  120. package/src/ui/thread_drawer.ts +6 -5
  121. package/src/ui/tool_call_card.ts +22 -32
  122. package/src/ui/ui_strings.ts +6 -12
  123. package/src/ui/voice_input.ts +10 -11
  124. package/src/version.ts +1 -1
@@ -5,14 +5,9 @@
5
5
  * or its `data-strings` JSON attribute) and the rest fall back to the English
6
6
  * defaults.
7
7
  *
8
- * A handful of values are **templates** carrying `{token}` placeholders the call
9
- * site fills in (e.g. `minutesAgo` → `"{n}m ago"`); the token names are noted on
10
- * each key. Translators keep the token verbatim.
11
- *
12
- * This module is one cohesive unit — the `UiStrings` shape, its `DEFAULT_UI_STRINGS`
13
- * constant-like backing, and the {@link mergeUiStrings} merge over those defaults —
14
- * so it bends the one-symbol-per-file rule the way `tool_call_card.ts` (class +
15
- * its types) and `route_map.ts` (factory + its types) already do.
8
+ * Some values are templates carrying `{token}` placeholders the call site fills
9
+ * in; the token names are noted on each key, and a translation must keep them
10
+ * verbatim.
16
11
  */
17
12
  export interface UiStrings {
18
13
  /** Default header title (the `title-text` attribute overrides per element). */
@@ -26,10 +21,9 @@ export interface UiStrings {
26
21
  /** Expand affordance (the launcher, and the sidebar rail). */
27
22
  expand: string;
28
23
  /**
29
- * The launcher's label while unread answers are waiting behind it, with
30
- * `{count}` replaced by how many. It replaces {@link expand} rather than
31
- * appending to it, so a translation can order the two parts as its language
32
- * needs.
24
+ * The launcher's label while unread answers wait behind it. Token: `{count}`.
25
+ * Replaces {@link expand} rather than appending to it, so a translation can
26
+ * order the two parts as its language needs.
33
27
  */
34
28
  expandUnread: string;
35
29
  /** Built-in header theme toggle (light ⇄ dark). */
@@ -1 +1 @@
1
- {"version":3,"file":"ui_strings.d.ts","sourceRoot":"","sources":["../../src/ui/ui_strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,W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AgD;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;IAClB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,SA6FhC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CASvE"}
@@ -14,13 +14,13 @@ export interface VoiceInputOptions {
14
14
  * `MediaRecorder`, then POSTs the clip through a {@link TranscribeHandler} and
15
15
  * hands the transcript back via `onText`.
16
16
  *
17
- * Click to start recording (browser mic permission prompt), click again to stop
18
- * the clip is transcribed and dropped into the composer. The button reflects
19
- * its `idle` / `recording` / `transcribing` state on `data-state` for theming
20
- * and is exposed as `part="voice-button"`. A capture or transcription failure
21
- * returns the button to idle and surfaces the message on its tooltip.
17
+ * Click to start recording, which prompts for mic permission, and again to stop
18
+ * and transcribe. The button reflects its `idle` / `recording` / `transcribing`
19
+ * state on `data-state` for theming and is exposed as `part="voice-button"`; a
20
+ * capture or transcription failure returns it to idle and surfaces the message
21
+ * on its tooltip.
22
22
  *
23
- * Pure DOM (no framework); the host mounts {@link element} in the input row.
23
+ * Pure DOM. The host mounts {@link element} in the input row.
24
24
  */
25
25
  export declare class VoiceInput {
26
26
  #private;
@@ -30,11 +30,10 @@ export declare class VoiceInput {
30
30
  /** Start recording when idle, stop (and transcribe) when recording. */
31
31
  toggle(): Promise<void>;
32
32
  /**
33
- * Tear the control down the teardown path when the host element is removed
34
- * mid-recording. Stops any live `MediaRecorder`, releases the mic tracks (so
35
- * the browser's recording indicator clears), and suppresses the pending
36
- * transcription: a disconnected control must not fire `onText` back into a
37
- * detached element.
33
+ * Tear the control down, for a host element removed mid-recording. Stops any
34
+ * live `MediaRecorder`, releases the mic tracks so the browser's recording
35
+ * indicator clears, and suppresses the pending transcription — a
36
+ * disconnected control must not fire `onText` into a detached element.
38
37
  */
39
38
  dispose(): void;
40
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"voice_input.d.ts","sourceRoot":"","sources":["../../src/ui/voice_input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKrE,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAU;;IACrB,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAWpC,YAAY,OAAO,EAAE,iBAAiB,EAmBrC;IAED,uEAAuE;IACjE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAS5B;IA6BD;;;;;;OAMG;IACH,OAAO,IAAI,IAAI,CAOd;CAyDF"}
1
+ {"version":3,"file":"voice_input.d.ts","sourceRoot":"","sources":["../../src/ui/voice_input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKrE,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAU;;IACrB,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAWpC,YAAY,OAAO,EAAE,iBAAiB,EAmBrC;IAED,uEAAuE;IACjE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAS5B;IA6BD;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAOd;CAyDF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artooi/ag-ui-web-component",
3
- "version": "0.23.0",
3
+ "version": "0.24.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",
package/src/constants.ts CHANGED
@@ -1,58 +1,59 @@
1
- // The package's single home for enums and constant-like values. Per
2
- // CLAUDE.md this is the only file allowed to export multiple symbols.
1
+ // The package's single home for enums and constant-like values, and per
2
+ // CLAUDE.md the only file allowed to export multiple symbols.
3
3
 
4
4
  /** The Custom Element tag name registered by {@link defineAgUiChat}. */
5
5
  export const ELEMENT_TAG = "ag-ui-chat";
6
6
 
7
- /**
8
- * Event dispatched by `<ag-ui-chat>` when the user submits a message.
9
- * `detail` carries `{ content: string }`. Later phases wire this to the
10
- * AG-UI client; for now it is the public seam for host integration.
11
- */
7
+ /** User submitted a message. `detail` is {@link SubmitDetail}. */
12
8
  export const SUBMIT_EVENT = "ag-ui-submit";
13
9
 
14
10
  /**
15
- * Event dispatched by `<ag-ui-chat>` when its collapsed state changes (via the
16
- * built-in toggle or {@link setCollapsed}). `detail` carries
17
- * `{ collapsed: boolean }`. A host can listen to drive its own chrome, or hide
18
- * the built-in toggle and drive the `collapsed` attribute itself.
11
+ * Collapsed state changed, via the built-in toggle or `setCollapsed`.
12
+ * `detail` is {@link ToggleDetail}.
19
13
  */
20
14
  export const TOGGLE_EVENT = "ag-ui-toggle";
21
15
 
22
16
  /**
23
- * Event dispatched by `<ag-ui-chat>` when the number of answers that arrived
24
- * while it was collapsed changes one more finished, or expanding cleared them
25
- * all. `detail` carries `{ unread: number }`.
26
- *
27
- * The built-in badge on the launcher renders exactly this. A host driving its
28
- * own chrome can turn the badge off with `data-unread-badge="false"` and listen
29
- * here instead.
17
+ * The count of answers that arrived while collapsed changed. `detail` is
18
+ * {@link UnreadDetail}. The built-in launcher badge renders exactly this; a
19
+ * host driving its own chrome sets `data-unread-badge="false"` and listens.
30
20
  */
31
21
  export const UNREAD_EVENT = "ag-ui-unread";
32
22
 
33
23
  /**
34
- * Event dispatched by `<ag-ui-chat>` when AG-UI **shared state** changesthe
35
- * server streamed a `STATE_SNAPSHOT` / `STATE_DELTA`, or the host assigned
36
- * {@link AgUiChat.sharedState}. `detail` carries `{ state }`.
24
+ * AG-UI shared state changeda streamed `STATE_SNAPSHOT` / `STATE_DELTA`, or
25
+ * a host assignment to `sharedState`. `detail` is {@link StateDetail}.
37
26
  *
38
- * This is the protocol's own state channel, distinct from `registerPageState`,
39
- * which exposes host state to the agent as ordinary *tools*.
27
+ * The protocol's own state channel, distinct from `registerPageState`, which
28
+ * exposes host state to the agent as ordinary tools.
40
29
  */
41
30
  export const STATE_EVENT = "ag-ui-state";
42
31
 
43
32
  /**
44
- * Event dispatched by `<ag-ui-chat>` whenever the attachment tray changes a
45
- * file queued, an upload finishing or failing, a chip removed, the tray
46
- * cleared after a send. `detail` carries `{ attachments, pending }`:
47
- * the durable refs of everything that has finished uploading, and how many are
48
- * still in flight.
49
- *
50
- * This is the seam for a host that drives its own composer: without it the tray
51
- * only ever spoke to the built-in Send button, so a custom send had no way to
52
- * know whether a file was ready or still uploading.
33
+ * The attachment tray changed a file queued, an upload finishing or failing,
34
+ * a chip removed, the tray cleared after a send. `detail` is
35
+ * {@link AttachmentsDetail}, carrying the refs that finished uploading and how
36
+ * many are still in flight. A host driving its own composer uses this to know
37
+ * whether a send would leave files behind.
53
38
  */
54
39
  export const ATTACHMENT_EVENT = "ag-ui-attachments";
55
40
 
41
+ /**
42
+ * An interaction has finished, whatever ended it. `detail` is
43
+ * {@link RunFinishedDetail}, listing the tools that ran and which side ran them.
44
+ *
45
+ * For hosts that render data the agent can change. A server-side tool writes
46
+ * without the page's knowledge — nothing else the element dispatches implies
47
+ * "something may have moved underneath you", so a page showing that data has no
48
+ * reason to refetch and quietly goes stale. Shared state
49
+ * ({@link STATE_EVENT}) is the richer channel, but it needs the agent to emit
50
+ * state; this needs nothing of the agent at all.
51
+ *
52
+ * Fires once per interaction rather than once per tool round, on completion,
53
+ * error and cancellation alike, since a partial write is still a write.
54
+ */
55
+ export const RUN_FINISHED_EVENT = "ag-ui-run-finished";
56
+
56
57
  /** Roles a chat message can take. */
57
58
  export const MESSAGE_ROLE = {
58
59
  USER: "user",
@@ -60,43 +61,35 @@ export const MESSAGE_ROLE = {
60
61
  } as const;
61
62
 
62
63
  /**
63
- * JSON-Schema extension key marking a tool as destructive. Mirrors the
64
- * `django-ag-ui` server side. When a tool's `parameters` carries
65
- * `{ "x-destructive": true }`, the element gates its execution behind the
66
- * confirmation modal (unless `autoConfirm` is set).
64
+ * Schema-root key marking a tool destructive: the element gates its execution
65
+ * behind the confirmation card unless `autoConfirm` is set. All four `x-*` keys
66
+ * below mirror the `django-ag-ui` server side.
67
67
  */
68
68
  export const X_DESTRUCTIVE_KEY = "x-destructive";
69
69
 
70
70
  /**
71
- * JSON-Schema extension key carrying a human-readable confirmation prompt for a
72
- * destructive tool (e.g. `"Activate this project?"`). Mirrors the `django-ag-ui`
73
- * server side. When present, the inline confirmation card shows this instead of
74
- * the generic `Run "<tool>"?`.
71
+ * Schema-root key holding a confirmation prompt (e.g. `"Activate this
72
+ * project?"`), shown instead of the generic `Run "<tool>"?`.
75
73
  */
76
74
  export const X_CONFIRM_KEY = "x-confirm";
77
75
 
78
76
  /**
79
- * JSON-Schema extension key carrying a short human-readable label for a tool
80
- * (e.g. `"Query orders"` for `query_model`). Mirrors the `django-ag-ui` server
81
- * side; the tool-call card shows it instead of the raw tool name when present.
77
+ * Schema-root key holding a short label for a tool (e.g. `"Query orders"` for
78
+ * `query_model`), shown on the card instead of the raw tool name.
82
79
  */
83
80
  export const X_SUMMARY_KEY = "x-summary";
84
81
 
85
82
  /**
86
- * JSON-Schema extension key marking a tool as navigating — its handler triggers
87
- * a full page reload (an MPA navigation). When a tool's `parameters` carries
88
- * `{ "x-navigates": true }`, the element checkpoints the call before the reload
89
- * and resumes the run loop once the next page mounts. Mirrors `x-destructive`.
83
+ * Schema-root key marking a tool as navigating — its handler triggers a full
84
+ * page reload. The element checkpoints the call before the reload and resumes
85
+ * the run loop once the next page mounts.
90
86
  */
91
87
  export const X_NAVIGATES_KEY = "x-navigates";
92
88
 
93
89
  /**
94
- * Name of the built-in tool that re-reads the current page.
95
- *
96
- * Registered only when a page-map provider is set. Named here because it is
97
- * also the documented recovery from a stale page, so the stale-page guard has
98
- * to exempt it — refusing the very call that would refresh the agent's view
99
- * would be a deadlock.
90
+ * The built-in tool that re-reads the current page, registered only when a
91
+ * page-map provider is set. Named here because the stale-page guard must exempt
92
+ * it: refusing the one call that would refresh the agent's view deadlocks.
100
93
  */
101
94
  export const READ_PAGE_TOOL = "read_page";
102
95
 
@@ -127,23 +120,20 @@ export const ATTACHMENT_STATUS = {
127
120
 
128
121
  /**
129
122
  * Default client-side upload size cap (10 MiB), matching django-ag-ui's
130
- * `ATTACHMENT_MAX_BYTES` default. Overridable per element via
131
- * `data-attachment-max-bytes`; the server stays authoritative.
123
+ * `ATTACHMENT_MAX_BYTES`. Overridable via `data-attachment-max-bytes`; the
124
+ * server stays authoritative.
132
125
  */
133
126
  export const DEFAULT_ATTACHMENT_MAX_BYTES = 10 * 1024 * 1024;
134
127
 
135
128
  /**
136
- * How much detail a tool-call card shows. Set via the `data-tool-display`
137
- * attribute on `<ag-ui-chat>`; defaults to `full` (back-compatible).
129
+ * How much detail a tool-call card shows. Set via `data-tool-display`; the
130
+ * default is `full`.
138
131
  *
139
- * - `inline` — the lightest mode: a single status row (icon + summary) with no
140
- * surrounding card chrome, the result tucked behind its own toggle. Reads as
141
- * one line of the answer rather than a boxed card pairs with the answer
142
- * well (page mode).
143
- * - `minimal` — just the tool name + status pill. No args, no result body.
144
- * - `compact` — name + status, with args *and* result tucked behind a single
145
- * collapsed "Details" toggle. The light default for dense UIs.
146
- * - `full` — args shown inline, result behind its own toggle (the original).
132
+ * - `inline` — one status row (icon + summary), no card chrome, result behind
133
+ * its own toggle. Reads as a line of the answer rather than a boxed card.
134
+ * - `minimal` tool name + status pill only. No args, no result body.
135
+ * - `compact` — name + status, args and result behind one "Details" toggle.
136
+ * - `full` — args inline, result behind its own toggle.
147
137
  */
148
138
  export const TOOL_DISPLAY = {
149
139
  INLINE: "inline",
@@ -153,32 +143,32 @@ export const TOOL_DISPLAY = {
153
143
  } as const;
154
144
 
155
145
  /**
156
- * `activityType` of the AG-UI `ACTIVITY_SNAPSHOT` event `django-ag-ui` emits
157
- * when a compaction capability trimmed the message history. Its `content`
158
- * carries `{ removed, before, after }`.
146
+ * `activityType` of the `ACTIVITY_SNAPSHOT` event django-ag-ui emits when a
147
+ * compaction capability trimmed the history. `content` carries
148
+ * `{ removed, before, after }`.
159
149
  */
160
150
  export const COMPACTION_ACTIVITY_TYPE = "compaction";
161
151
 
162
152
  /**
163
- * Pydantic-AI's built-in tool the model calls to load a *deferred* capability,
164
- * with `{ id }` naming it. Agent skills are deferred capabilities whose id is
165
- * the skill name, so a call to this tool is how "the agent picked skill X"
166
- * reaches the client — there is no separate event for it.
153
+ * Pydantic-AI's built-in tool for loading a deferred capability, with `{ id }`
154
+ * naming it. Agent skills are deferred capabilities keyed by skill name, so a
155
+ * call to this tool is the only signal that the agent picked a skill.
167
156
  *
168
- * Not to be confused with the host-provided {@link Skill} catalog, which is a
169
- * *human* affordance (a prompt the user launches from the `/`-palette).
157
+ * Distinct from the host-provided {@link Skill} catalog, which is a human
158
+ * affordance launched from the slash palette.
170
159
  */
171
160
  export const LOAD_CAPABILITY_TOOL = "load_capability";
172
161
 
173
162
  /**
174
163
  * The chrome's glyphs, as inline SVG markup.
175
164
  *
176
- * Static, author-written markup assigned to a `<slot>`'s fallback content, so
177
- * it never passes through the sanitiser — nothing here is user or server data.
178
- * Each icon is a 24x24 viewBox carrying the shared `glyph` class, which
179
- * `STYLES` sizes and paints from `currentColor`; `glyph--solid` fills instead
180
- * of stroking. A host that wants its own mark projects a matching
181
- * `slot="icon-…"` child rather than editing these.
165
+ * Static author-written markup assigned as a `<slot>`'s fallback content, so it
166
+ * never passes through the sanitiser — nothing here is user or server data, and
167
+ * nothing user-supplied may be interpolated into it. Each icon is a 24x24
168
+ * viewBox carrying the shared `glyph` class, which `STYLES` sizes and paints
169
+ * from `currentColor`; `glyph--solid` fills instead of stroking. A host wanting
170
+ * its own mark projects a matching `slot="icon-…"` child instead of editing
171
+ * these.
182
172
  */
183
173
  export const ICON_SEND = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19.5V5m-6.5 6.5L12 5l6.5 6.5"/></svg>`;
184
174
 
@@ -195,13 +185,10 @@ export const ICON_VOICE = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="t
195
185
  export const ICON_LAUNCHER = `<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H9l-5 4z"/></svg>`;
196
186
 
197
187
  /**
198
- * The attachment-chip type marks, one per coarse file family. Same contract as
199
- * the chrome's glyphs above: static author-written markup on a 24x24 viewBox
200
- * carrying the shared `glyph` class. A chip picks one by MIME family through
201
- * `iconFor`; the MIME string selects a constant and is never interpolated into
202
- * one, so nothing user- or server-supplied reaches the markup.
203
- *
204
- * The generic mark, for a family with nothing more specific to say.
188
+ * The generic attachment-chip mark, for a file family with nothing more
189
+ * specific to say. The chip marks share the contract of the chrome glyphs
190
+ * above; `iconFor` selects one by MIME family, never interpolating the MIME
191
+ * string into the markup.
205
192
  */
206
193
  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>`;
207
194