@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.
- package/CHANGELOG.md +149 -36
- package/README.md +140 -9
- package/dist/ag-ui-web-component.bundle.js +113 -122
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/constants.d.ts +71 -85
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +105 -127
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +24 -30
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/attachment.d.ts +9 -14
- package/dist/core/attachment.d.ts.map +1 -1
- package/dist/core/conversation_store.d.ts +38 -27
- package/dist/core/conversation_store.d.ts.map +1 -1
- package/dist/core/create_http_agent.d.ts +13 -15
- package/dist/core/create_http_agent.d.ts.map +1 -1
- package/dist/core/remote_conversation_store.d.ts +10 -9
- package/dist/core/remote_conversation_store.d.ts.map +1 -1
- package/dist/core/run_index.d.ts +11 -20
- package/dist/core/run_index.d.ts.map +1 -1
- package/dist/core/transcribe_audio.d.ts +8 -8
- package/dist/core/transcribe_audio.d.ts.map +1 -1
- package/dist/core/upload_attachment.d.ts +15 -18
- package/dist/core/upload_attachment.d.ts.map +1 -1
- package/dist/core/utils.d.ts +4 -6
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/dom/animations.d.ts +22 -30
- package/dist/dom/animations.d.ts.map +1 -1
- package/dist/dom/dom_driver.d.ts +7 -7
- package/dist/dom/native_setter.d.ts +2 -2
- package/dist/dom/native_setter.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +357 -383
- package/dist/index.js.map +2 -2
- package/dist/skills/fill_template.d.ts +4 -5
- package/dist/skills/fill_template.d.ts.map +1 -1
- package/dist/skills/parse_skills.d.ts.map +1 -1
- package/dist/skills/skill.d.ts +7 -8
- package/dist/skills/skill.d.ts.map +1 -1
- package/dist/tools/client_tool_registry.d.ts +2 -2
- package/dist/tools/page_action_tools.d.ts +7 -10
- package/dist/tools/page_action_tools.d.ts.map +1 -1
- package/dist/tools/page_state.d.ts +5 -8
- package/dist/tools/page_state.d.ts.map +1 -1
- package/dist/tools/route_map.d.ts +7 -10
- package/dist/tools/route_map.d.ts.map +1 -1
- package/dist/ui/approval_card.d.ts +15 -20
- package/dist/ui/approval_card.d.ts.map +1 -1
- package/dist/ui/attach_copy_buttons.d.ts +4 -10
- package/dist/ui/attach_copy_buttons.d.ts.map +1 -1
- package/dist/ui/attachment_chips.d.ts +7 -10
- package/dist/ui/attachment_chips.d.ts.map +1 -1
- package/dist/ui/attachment_tray.d.ts +6 -6
- package/dist/ui/checkpoint_menu.d.ts +7 -8
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/confirmation_card.d.ts +10 -15
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/question_card.d.ts +12 -15
- package/dist/ui/question_card.d.ts.map +1 -1
- package/dist/ui/relative_time.d.ts +5 -7
- package/dist/ui/relative_time.d.ts.map +1 -1
- package/dist/ui/render_markdown.d.ts +8 -8
- package/dist/ui/render_markdown.d.ts.map +1 -1
- package/dist/ui/resize_handle.d.ts +21 -34
- package/dist/ui/resize_handle.d.ts.map +1 -1
- package/dist/ui/run_notice.d.ts +5 -7
- package/dist/ui/run_notice.d.ts.map +1 -1
- package/dist/ui/skills_menu.d.ts +4 -5
- package/dist/ui/skills_menu.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/thoughts_block.d.ts +9 -11
- package/dist/ui/thoughts_block.d.ts.map +1 -1
- package/dist/ui/thread_drawer.d.ts +6 -5
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +17 -25
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +6 -12
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/dist/ui/voice_input.d.ts +10 -11
- package/dist/ui/voice_input.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +74 -87
- package/src/core/ag_ui_chat.ts +313 -269
- package/src/core/agui_client.ts +60 -71
- package/src/core/attachment.ts +9 -14
- package/src/core/conversation_store.ts +55 -33
- package/src/core/create_http_agent.ts +18 -22
- package/src/core/remote_conversation_store.ts +28 -15
- package/src/core/run_index.ts +14 -23
- package/src/core/transcribe_audio.ts +9 -10
- package/src/core/upload_attachment.ts +18 -21
- package/src/core/utils.ts +4 -6
- package/src/dom/animations.ts +33 -43
- package/src/dom/dom_driver.ts +7 -7
- package/src/dom/native_setter.ts +11 -12
- package/src/index.ts +3 -0
- package/src/skills/fill_template.ts +4 -5
- package/src/skills/parse_skills.ts +3 -4
- package/src/skills/skill.ts +7 -8
- package/src/tools/client_tool_registry.ts +2 -2
- package/src/tools/page_action_tools.ts +12 -15
- package/src/tools/page_state.ts +5 -8
- package/src/tools/route_map.ts +15 -19
- package/src/ui/approval_card.ts +15 -20
- package/src/ui/attach_copy_buttons.ts +9 -18
- package/src/ui/attachment_chips.ts +7 -10
- package/src/ui/attachment_tray.ts +6 -6
- package/src/ui/checkpoint_menu.ts +7 -8
- package/src/ui/confirmation_card.ts +10 -15
- package/src/ui/question_card.ts +12 -15
- package/src/ui/relative_time.ts +5 -7
- package/src/ui/render_markdown.ts +25 -51
- package/src/ui/resize_handle.ts +25 -38
- package/src/ui/run_notice.ts +9 -12
- package/src/ui/skills_menu.ts +4 -5
- package/src/ui/styles.ts +92 -101
- package/src/ui/thoughts_block.ts +11 -13
- package/src/ui/thread_drawer.ts +6 -5
- package/src/ui/tool_call_card.ts +22 -32
- package/src/ui/ui_strings.ts +6 -12
- package/src/ui/voice_input.ts +10 -11
- package/src/version.ts +1 -1
package/dist/ui/ui_strings.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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
|
|
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;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AAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CASvE"}
|
package/dist/ui/voice_input.d.ts
CHANGED
|
@@ -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
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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
|
|
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
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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;AACr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,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.
|
|
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
|
|
2
|
-
// CLAUDE.md
|
|
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
|
-
*
|
|
16
|
-
*
|
|
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
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
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
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* {@link AgUiChat.sharedState}. `detail` carries `{ state }`.
|
|
24
|
+
* AG-UI shared state changed — a streamed `STATE_SNAPSHOT` / `STATE_DELTA`, or
|
|
25
|
+
* a host assignment to `sharedState`. `detail` is {@link StateDetail}.
|
|
37
26
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
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
|
-
*
|
|
64
|
-
* `
|
|
65
|
-
*
|
|
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
|
-
*
|
|
72
|
-
*
|
|
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
|
-
*
|
|
80
|
-
*
|
|
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
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
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
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
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
|
|
131
|
-
*
|
|
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
|
|
137
|
-
*
|
|
129
|
+
* How much detail a tool-call card shows. Set via `data-tool-display`; the
|
|
130
|
+
* default is `full`.
|
|
138
131
|
*
|
|
139
|
-
* - `inline` —
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* - `
|
|
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
|
|
157
|
-
*
|
|
158
|
-
*
|
|
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
|
|
164
|
-
*
|
|
165
|
-
*
|
|
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
|
-
*
|
|
169
|
-
*
|
|
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
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* of stroking. A host
|
|
181
|
-
* `slot="icon-…"` child
|
|
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
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
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
|
|