@zeyos/zx 5.6.0 → 5.7.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 +154 -0
- package/README.md +73 -7
- package/bin/zx-css.js +328 -0
- package/dist/types/components/account-menu/account-menu.d.ts +4 -2
- package/dist/types/components/activity-list/activity-list.d.ts +14 -8
- package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +142 -14
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
- package/dist/types/components/calendar/calendar-model.d.ts +9 -2
- package/dist/types/components/calendar/calendar.d.ts +12 -4
- package/dist/types/components/chart/chart.d.ts +25 -13
- package/dist/types/components/code-editor/code-editor.d.ts +7 -2
- package/dist/types/components/composer/composer.d.ts +206 -4
- package/dist/types/components/composer/queue.d.ts +76 -0
- package/dist/types/components/copy/copy-button.d.ts +6 -4
- package/dist/types/components/copy/copy-input.d.ts +10 -6
- package/dist/types/components/datebox/date-range-box.d.ts +33 -0
- package/dist/types/components/datebox/placeholder.d.ts +7 -0
- package/dist/types/components/dock/dock.d.ts +12 -3
- package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
- package/dist/types/components/field-upload/field-upload.d.ts +3 -2
- package/dist/types/components/file-item/file-item.d.ts +3 -2
- package/dist/types/components/file-list/file-list.d.ts +14 -8
- package/dist/types/components/filter/filter-model.d.ts +31 -1
- package/dist/types/components/filter/filter.d.ts +20 -2
- package/dist/types/components/finder/finder.d.ts +14 -6
- package/dist/types/components/flag/flag.d.ts +99 -0
- package/dist/types/components/grid/grid.d.ts +1 -1
- package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
- package/dist/types/components/launcher/launcher.d.ts +2 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +17 -6
- package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
- package/dist/types/components/prose/prose.d.ts +9 -6
- package/dist/types/components/questionnaire/conditions.d.ts +270 -0
- package/dist/types/components/questionnaire/items.d.ts +52 -30
- package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
- package/dist/types/components/rating/rating.d.ts +5 -3
- package/dist/types/components/select/country.d.ts +106 -0
- package/dist/types/components/select/field-adapter.d.ts +2 -1
- package/dist/types/components/select/locale.d.ts +102 -0
- package/dist/types/components/select/select.d.ts +41 -2
- package/dist/types/components/slider/slider.d.ts +1 -0
- package/dist/types/components/sort-control/sort-control.d.ts +7 -3
- package/dist/types/components/source-list/source-list.d.ts +7 -5
- package/dist/types/components/split-view/split-view.d.ts +5 -3
- package/dist/types/components/surface/catalog.d.ts +260 -0
- package/dist/types/components/surface/elicit.d.ts +81 -0
- package/dist/types/components/surface/mcp.d.ts +165 -0
- package/dist/types/components/surface/schema.d.ts +314 -0
- package/dist/types/components/surface/stream.d.ts +118 -0
- package/dist/types/components/surface/surface.d.ts +718 -0
- package/dist/types/components/surface/text.d.ts +277 -0
- package/dist/types/components/surface/validate.d.ts +339 -0
- package/dist/types/components/table/table.d.ts +55 -3
- package/dist/types/components/table/window.d.ts +203 -0
- package/dist/types/components/toolbar/toolbar.d.ts +10 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +20 -13
- package/dist/types/core/component.d.ts +10 -0
- package/dist/types/core/date.d.ts +8 -1
- package/dist/types/core/dom.d.ts +1 -0
- package/dist/types/core/http.d.ts +10 -0
- package/dist/types/core/i18n.d.ts +38 -0
- package/dist/types/core/messages.d.ts +344 -1
- package/dist/types/core/storage.d.ts +7 -2
- package/dist/types/elements/define.d.ts +21 -46
- package/dist/types/elements/definitions.d.ts +147 -0
- package/dist/types/elements/kit.d.ts +7 -0
- package/dist/types/elements/reflect.d.ts +6 -3
- package/dist/types/index.d.ts +10 -1
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/locales/de.d.ts +13 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/index.d.ts +823 -0
- package/dist/types/zeyos/view.d.ts +8 -1
- package/dist/zx-zeyos.esm.js +16802 -15180
- package/dist/zx-zeyos.esm.min.js +5 -5
- package/dist/zx.core.css +1276 -0
- package/dist/zx.core.min.css +1 -0
- package/dist/zx.css +498 -134
- package/dist/zx.esm.js +40778 -29654
- package/dist/zx.esm.min.js +36 -23
- package/dist/zx.global.js +40778 -29654
- package/dist/zx.global.min.js +36 -23
- package/dist/zx.layered.css +17302 -0
- package/dist/zx.layered.min.css +1 -0
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +12501 -0
- package/docs/agent-surfaces.md +340 -0
- package/docs/api.json +851 -121
- package/docs/llms.md +1018 -71
- package/docs/llms.txt +30 -9
- package/package.json +29 -6
- package/src/components/account-menu/account-menu.js +6 -3
- package/src/components/activity-item/activity-item.js +2 -1
- package/src/components/activity-list/activity-list.js +16 -10
- package/src/components/agent-thread/ag-ui.js +1439 -0
- package/src/components/agent-thread/agent-thread.js +359 -54
- package/src/components/agent-thread/ui-message-stream.js +1281 -0
- package/src/components/app-sidebar/app-sidebar.js +18 -8
- package/src/components/approval-card/approval-card.js +3 -2
- package/src/components/block-view/block-view.js +7 -6
- package/src/components/breadcrumb/breadcrumb.js +8 -5
- package/src/components/calendar/calendar-model.js +8 -2
- package/src/components/calendar/calendar.js +53 -18
- package/src/components/chart/chart.js +54 -23
- package/src/components/code-editor/code-editor.js +45 -8
- package/src/components/code-editor/field-adapter.js +1 -1
- package/src/components/composer/composer.css +80 -1
- package/src/components/composer/composer.js +390 -16
- package/src/components/composer/queue.js +78 -0
- package/src/components/context-menu/context-menu.js +12 -1
- package/src/components/copy/copy-button.js +9 -7
- package/src/components/copy/copy-input.js +10 -6
- package/src/components/date-picker/date-picker.js +2 -1
- package/src/components/date-picker/date-range-picker.js +8 -7
- package/src/components/datebox/date-range-box.js +3 -9
- package/src/components/datebox/datebox.js +18 -21
- package/src/components/datebox/placeholder.js +18 -0
- package/src/components/dialog/dialog.js +1 -1
- package/src/components/dock/dock.js +34 -13
- package/src/components/entity-ref/entity-ref.js +16 -5
- package/src/components/field-upload/field-upload.js +81 -38
- package/src/components/file-item/file-item.js +70 -40
- package/src/components/file-list/file-list.js +15 -9
- package/src/components/filter/filter-model.js +46 -8
- package/src/components/filter/filter.css +3 -3
- package/src/components/filter/filter.js +29 -10
- package/src/components/filter-panel/filter-panel.js +13 -5
- package/src/components/finder/finder.js +50 -26
- package/src/components/flag/flag.css +40 -0
- package/src/components/flag/flag.js +177 -0
- package/src/components/form/form.js +1 -1
- package/src/components/grid/grid.js +22 -8
- package/src/components/kanban-view/kanban-view.js +51 -81
- package/src/components/launcher/launcher.js +17 -2
- package/src/components/list-toolbar/list-toolbar.js +2 -1
- package/src/components/master-panel/master-panel.js +1 -1
- package/src/components/menu-button/menu-button.js +4 -0
- package/src/components/message/message.js +3 -0
- package/src/components/multi-value-editor/multi-value-editor.js +10 -9
- package/src/components/navigation-bar/navigation-bar.js +3 -3
- package/src/components/number-field/number-field.js +29 -13
- package/src/components/prompt-starters/prompt-starters.css +91 -0
- package/src/components/prompt-starters/prompt-starters.js +206 -0
- package/src/components/prose/prose.js +14 -10
- package/src/components/questionnaire/conditions.js +666 -0
- package/src/components/questionnaire/items.js +150 -41
- package/src/components/questionnaire/questionnaire.js +126 -32
- package/src/components/rating/rating.js +5 -4
- package/src/components/run-status/run-status.js +2 -2
- package/src/components/select/country.js +136 -0
- package/src/components/select/field-adapter.js +7 -2
- package/src/components/select/locale.js +219 -0
- package/src/components/select/select.css +20 -22
- package/src/components/select/select.js +94 -12
- package/src/components/sheet/sheet-stack.js +10 -1
- package/src/components/slider/slider.js +7 -2
- package/src/components/sort-control/sort-control.js +15 -5
- package/src/components/source-list/source-list.js +7 -4
- package/src/components/split-view/split-view.js +5 -3
- package/src/components/surface/catalog.js +1334 -0
- package/src/components/surface/elicit.js +107 -0
- package/src/components/surface/mcp.js +243 -0
- package/src/components/surface/schema.js +644 -0
- package/src/components/surface/stream.js +245 -0
- package/src/components/surface/surface.css +308 -0
- package/src/components/surface/surface.js +2291 -0
- package/src/components/surface/text.js +513 -0
- package/src/components/surface/validate.js +2218 -0
- package/src/components/tabbox/tabbox.js +9 -0
- package/src/components/table/table.css +63 -3
- package/src/components/table/table.js +167 -28
- package/src/components/table/window.js +317 -0
- package/src/components/toolbar/toolbar.js +12 -7
- package/src/components/tooltip/tooltip.css +2 -3
- package/src/components/tooltip/tooltip.js +32 -5
- package/src/components/tree/tree.js +53 -23
- package/src/core/component.js +25 -1
- package/src/core/date.js +62 -16
- package/src/core/dom.js +22 -2
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/keyboard.js +79 -8
- package/src/core/messages.js +376 -2
- package/src/core/overlay-host.js +1 -0
- package/src/core/storage.js +59 -6
- package/src/elements/define.js +178 -130
- package/src/elements/definitions.js +229 -0
- package/src/elements/kit.js +444 -0
- package/src/elements/reflect.js +8 -3
- package/src/index.js +10 -1
- package/src/internal/date-locale.js +11 -0
- package/src/internal/json-patch.js +405 -0
- package/src/locales/de.js +911 -0
- package/src/locales/en.js +2 -0
- package/src/locales/index.js +7 -0
- package/src/zeyos/calendar.js +2 -1
- package/src/zeyos/form.js +2 -1
- package/src/zeyos/launcher.js +7 -6
- package/src/zeyos/module-bar.js +2 -1
- package/src/zeyos/schema.js +37 -23
- package/src/zeyos/select.js +4 -3
- package/src/zeyos/table.js +2 -13
- package/src/zeyos/view.js +57 -17
- package/styles/core.css +11 -0
- package/styles/tokens/semantic.css +1 -0
- package/styles/zeyos.css +2 -0
- package/styles/zx.css +4 -8
- package/styles/zx.layered.css +1 -0
|
@@ -28,9 +28,10 @@ export type ActivityListOptions = {
|
|
|
28
28
|
*/
|
|
29
29
|
groupLabel?: ActivityGroupLabel | null;
|
|
30
30
|
/**
|
|
31
|
-
* Accessible collection name
|
|
31
|
+
* Accessible collection name; null reads the
|
|
32
|
+
* `activityList.label` message ("Activity").
|
|
32
33
|
*/
|
|
33
|
-
label?: string;
|
|
34
|
+
label?: string | null;
|
|
34
35
|
/**
|
|
35
36
|
* Entry layout, reflected as `data-variant` on
|
|
36
37
|
* the root. `'compact'` also makes an avatar descriptor without a `size` small.
|
|
@@ -45,11 +46,13 @@ export type ActivityListOptions = {
|
|
|
45
46
|
*/
|
|
46
47
|
loadingCount?: number;
|
|
47
48
|
/**
|
|
48
|
-
* Loading status text.
|
|
49
|
+
* Loading status text, by default the `activityList.loading`
|
|
50
|
+
* message ("Loading activity"). Null shows none.
|
|
49
51
|
*/
|
|
50
|
-
loadingText?: string;
|
|
52
|
+
loadingText?: string | null;
|
|
51
53
|
/**
|
|
52
|
-
* Empty-state content
|
|
54
|
+
* Empty-state content, by default the
|
|
55
|
+
* `activityList.empty` message ("No activity yet"). Null shows none.
|
|
53
56
|
*/
|
|
54
57
|
emptyText?: ActivityListContent;
|
|
55
58
|
/**
|
|
@@ -85,13 +88,16 @@ export type ActivityListOptions = {
|
|
|
85
88
|
* @property {ActivityItemOptions[]} [items=[]] Initial activities in host-supplied chronological order.
|
|
86
89
|
* @property {ActivityGroupReader} [groupBy=null] Property or resolver used for stable grouping.
|
|
87
90
|
* @property {ActivityGroupLabel|null} [groupLabel=null] Group-heading renderer.
|
|
88
|
-
* @property {string} [label=
|
|
91
|
+
* @property {string|null} [label=null] Accessible collection name; null reads the
|
|
92
|
+
* `activityList.label` message ("Activity").
|
|
89
93
|
* @property {ActivityListVariant} [variant='default'] Entry layout, reflected as `data-variant` on
|
|
90
94
|
* the root. `'compact'` also makes an avatar descriptor without a `size` small.
|
|
91
95
|
* @property {boolean} [loading=false] Whether initial or incremental activity is loading.
|
|
92
96
|
* @property {number} [loadingCount=3] Placeholder rows shown for an empty loading list.
|
|
93
|
-
* @property {string} [loadingText
|
|
94
|
-
*
|
|
97
|
+
* @property {string|null} [loadingText] Loading status text, by default the `activityList.loading`
|
|
98
|
+
* message ("Loading activity"). Null shows none.
|
|
99
|
+
* @property {ActivityListContent} [emptyText] Empty-state content, by default the
|
|
100
|
+
* `activityList.empty` message ("No activity yet"). Null shows none.
|
|
95
101
|
* @property {1|2|3|4|5|6} [groupHeadingLevel=2] Semantic group-heading level.
|
|
96
102
|
* @property {1|2|3|4|5|6} [itemHeadingLevel=3] Default item-heading level.
|
|
97
103
|
* @property {(event:CustomEvent<{items:ActivityItemOptions[]}>)=>void} [ondatachange]
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { inlineSplitter } from '../surface/stream.js';
|
|
2
|
+
export type AgentThread = import('./agent-thread.js').AgentThread;
|
|
3
|
+
export type ThreadItem = import('../../internal/agent-model.js').ThreadItem;
|
|
4
|
+
export type TraceStep = import('../../internal/agent-model.js').TraceStep;
|
|
5
|
+
export type RunState = import('../../internal/agent-model.js').RunState;
|
|
6
|
+
export type Author = import('../../internal/agent-model.js').Author;
|
|
7
|
+
export type SurfaceCatalog = import('../surface/catalog.js').SurfaceCatalog;
|
|
8
|
+
export type SurfaceError = import('../surface/validate.js').SurfaceError;
|
|
9
|
+
export type SurfaceReply = import('../surface/text.js').SurfaceReply;
|
|
10
|
+
/** @typedef {import('./agent-thread.js').AgentThread} AgentThread */
|
|
11
|
+
/** @typedef {import('../../internal/agent-model.js').ThreadItem} ThreadItem */
|
|
12
|
+
/** @typedef {import('../../internal/agent-model.js').TraceStep} TraceStep */
|
|
13
|
+
/** @typedef {import('../../internal/agent-model.js').RunState} RunState */
|
|
14
|
+
/** @typedef {import('../../internal/agent-model.js').Author} Author */
|
|
15
|
+
/** @typedef {import('../surface/catalog.js').SurfaceCatalog} SurfaceCatalog */
|
|
16
|
+
/** @typedef {import('../surface/validate.js').SurfaceError} SurfaceError */
|
|
17
|
+
/** @typedef {import('../surface/text.js').SurfaceReply} SurfaceReply */
|
|
18
|
+
/** The AG-UI protocol version the adapter implements. */
|
|
19
|
+
export declare const AG_UI_VERSION = "1.0";
|
|
20
|
+
export type AgUiEvent = {
|
|
21
|
+
type: string;
|
|
22
|
+
timestamp?: number;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
export type ToolCall = {
|
|
26
|
+
/**
|
|
27
|
+
* The call's `toolCallId`.
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* The tool's name.
|
|
32
|
+
*/
|
|
33
|
+
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* The parsed arguments once they are complete; `null` before, and when
|
|
36
|
+
* they are not JSON.
|
|
37
|
+
*/
|
|
38
|
+
args: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* The arguments as they arrived.
|
|
41
|
+
*/
|
|
42
|
+
argsText: string;
|
|
43
|
+
/**
|
|
44
|
+
* The `content` of the call's result event, unchanged (a string, or a
|
|
45
|
+
* list of content parts); for a surface tool, what `ontoolresult` received.
|
|
46
|
+
*/
|
|
47
|
+
result?: unknown;
|
|
48
|
+
/**
|
|
49
|
+
* Why the call failed.
|
|
50
|
+
*/
|
|
51
|
+
error?: string;
|
|
52
|
+
/**
|
|
53
|
+
* `queued` while the arguments arrive, `waiting` for an approval or an
|
|
54
|
+
* answer, `running` until the result, then `done`, `failed`, `skipped` when the approval was
|
|
55
|
+
* rejected, or `stopped` when the run ended without it.
|
|
56
|
+
*/
|
|
57
|
+
status: RunState;
|
|
58
|
+
};
|
|
59
|
+
export type ToolTileRenderer = (call: ToolCall) => ThreadItem | null;
|
|
60
|
+
export type AgUiProblem = {
|
|
61
|
+
/**
|
|
62
|
+
* What went wrong.
|
|
63
|
+
*/
|
|
64
|
+
code: string;
|
|
65
|
+
/**
|
|
66
|
+
* What went wrong, in English.
|
|
67
|
+
*/
|
|
68
|
+
message: string;
|
|
69
|
+
/**
|
|
70
|
+
* The event it concerns.
|
|
71
|
+
*/
|
|
72
|
+
event?: AgUiEvent;
|
|
73
|
+
/**
|
|
74
|
+
* The error thrown, for `renderer`, `approval-check` and `state`.
|
|
75
|
+
*/
|
|
76
|
+
cause?: unknown;
|
|
77
|
+
/**
|
|
78
|
+
* The surface's problems, for a surface tool's document.
|
|
79
|
+
*/
|
|
80
|
+
errors?: SurfaceError[];
|
|
81
|
+
};
|
|
82
|
+
export type AgUiOptions = {
|
|
83
|
+
/**
|
|
84
|
+
* A
|
|
85
|
+
* RunStatus the run's lifecycle drives: `running` when it starts, `done`, `waiting` (an
|
|
86
|
+
* interrupt, or calls of the run still without a result), `stopped` (cancelled) or `failed`.
|
|
87
|
+
*/
|
|
88
|
+
runStatus?: {
|
|
89
|
+
update: (values: Record<string, unknown>) => unknown;
|
|
90
|
+
} | null;
|
|
91
|
+
/**
|
|
92
|
+
* The thread's authors. A text message whose
|
|
93
|
+
* `name` is one of their keys is written by that author; every other item by `agent`.
|
|
94
|
+
*/
|
|
95
|
+
authors?: Record<string, Author>;
|
|
96
|
+
/**
|
|
97
|
+
* The author key of the agent's output; the thread's first
|
|
98
|
+
* agent when null.
|
|
99
|
+
*/
|
|
100
|
+
agent?: string | null;
|
|
101
|
+
/**
|
|
102
|
+
* Asked once a call's
|
|
103
|
+
* arguments are complete: any truthy answer holds the call at an ApprovalCard until the person
|
|
104
|
+
* decides. Nothing is approved by default: a check that throws holds the call too, and so does a
|
|
105
|
+
* Promise, whatever it resolves to, so an asynchronous check never lets a call through. Not asked
|
|
106
|
+
* for surface tools, whose surface is the person's say.
|
|
107
|
+
*/
|
|
108
|
+
requiresApproval?: ((call: ToolCall) => unknown) | null;
|
|
109
|
+
/**
|
|
110
|
+
* What
|
|
111
|
+
* the person decided, for the application to send back to the agent. An approval answers
|
|
112
|
+
* `{approved: true}` or `{approved: false, reason?}`; a surface tool its reply, with `errors`
|
|
113
|
+
* when the surface had any; a `show` surface with no actions answers at once with
|
|
114
|
+
* `{shown: true, surface, errors?}` and stays on screen; a surface tool whose arguments are not a
|
|
115
|
+
* surface answers at once with `{error: 'invalid-arguments'}`, and one the thread cannot draw
|
|
116
|
+
* with `{error: 'surface-unavailable'}`. It fires once for a call. In AG-UI 1.0 the application turns it into a `resume`
|
|
117
|
+
* entry (`{interruptId, status: 'resolved', payload}`) when the run ended with an interrupt for
|
|
118
|
+
* the call, or into a tool message (`{role: 'tool', toolCallId, content}`) when it ended with
|
|
119
|
+
* the call among its `pendingToolCallIds`; either goes in the next run's input.
|
|
120
|
+
*/
|
|
121
|
+
ontoolresult?: ((id: string, result: Record<string, unknown>) => void) | null;
|
|
122
|
+
/**
|
|
123
|
+
* The application state after each
|
|
124
|
+
* snapshot or delta.
|
|
125
|
+
*/
|
|
126
|
+
onstate?: ((state: unknown) => void) | null;
|
|
127
|
+
/**
|
|
128
|
+
* Every event the adapter does not
|
|
129
|
+
* draw: unknown types, and known ones without a place in the thread (steps, message snapshots,
|
|
130
|
+
* activities, raw and encrypted values, subagents, custom events of another name).
|
|
131
|
+
*/
|
|
132
|
+
onunknown?: ((event: AgUiEvent) => void) | null;
|
|
133
|
+
/**
|
|
134
|
+
* Problems found in the stream.
|
|
135
|
+
*/
|
|
136
|
+
onerror?: ((problem: AgUiProblem) => void) | null;
|
|
137
|
+
/**
|
|
138
|
+
* Show the reasoning text in its trace step. Without
|
|
139
|
+
* it, reasoning is one collapsed "Thought for 12 s" step.
|
|
140
|
+
*/
|
|
141
|
+
showReasoning?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* The name of the custom event that carries
|
|
144
|
+
* surface operations: its `value` is one operation, or `{ops: [...], token?}`. The token of the
|
|
145
|
+
* event that opens a surface is kept; later ones are ignored. Give these surfaces ids a model
|
|
146
|
+
* cannot predict: a surface belongs to the source that opened it, and a `begin` for an id the
|
|
147
|
+
* model already took is refused.
|
|
148
|
+
*/
|
|
149
|
+
surfaceEvent?: string;
|
|
150
|
+
/**
|
|
151
|
+
* The tools whose calls the application
|
|
152
|
+
* draws itself, by name. The renderer is called at each status change of the call, never while
|
|
153
|
+
* its arguments stream; its first item that is not `null` is inserted after the call's step,
|
|
154
|
+
* later ones replace it where it stands, and the step links to it.
|
|
155
|
+
*/
|
|
156
|
+
tools?: Record<string, ToolTileRenderer>;
|
|
157
|
+
/**
|
|
158
|
+
* The tools whose arguments are a
|
|
159
|
+
* whole surface document. The surface is drawn once the arguments are complete, and its reply is
|
|
160
|
+
* the call's result.
|
|
161
|
+
*/
|
|
162
|
+
surfaceTools?: string[];
|
|
163
|
+
/**
|
|
164
|
+
* Split surface fences out of answer text.
|
|
165
|
+
*/
|
|
166
|
+
inlineSurfaces?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* A narrowed catalog, given to every surface the adapter
|
|
169
|
+
* creates.
|
|
170
|
+
*/
|
|
171
|
+
catalog?: SurfaceCatalog;
|
|
172
|
+
};
|
|
173
|
+
export type AgUiConnection = {
|
|
174
|
+
/**
|
|
175
|
+
* Takes the next event, in stream order.
|
|
176
|
+
*/
|
|
177
|
+
handle: (event: AgUiEvent) => void;
|
|
178
|
+
/**
|
|
179
|
+
* The application state as it stands: a copy of the last
|
|
180
|
+
* snapshot with every delta since applied, `null` before the first.
|
|
181
|
+
*/
|
|
182
|
+
state: () => unknown;
|
|
183
|
+
/**
|
|
184
|
+
* Ends the connection without leaving anyone waiting: a run still
|
|
185
|
+
* open is closed as stopped, every unanswered surface-tool surface is cancelled (its reply, with
|
|
186
|
+
* `reason: 'stopped'`, still reaches `ontoolresult`), every undecided approval card expires, and
|
|
187
|
+
* then the thread is no longer listened to. Nothing of this is reported through `onerror`. Later
|
|
188
|
+
* events are ignored; the items stay.
|
|
189
|
+
*/
|
|
190
|
+
destroy: () => void;
|
|
191
|
+
};
|
|
192
|
+
export type Run = {
|
|
193
|
+
id: string;
|
|
194
|
+
/**
|
|
195
|
+
* The trace its steps go into now.
|
|
196
|
+
*/
|
|
197
|
+
traceId: string | null;
|
|
198
|
+
traces: number;
|
|
199
|
+
errors: number;
|
|
200
|
+
/**
|
|
201
|
+
* Surface items created in the run.
|
|
202
|
+
*/
|
|
203
|
+
surfaces: Set<string>;
|
|
204
|
+
/**
|
|
205
|
+
* Surfaces an unterminated fence left open, already reported.
|
|
206
|
+
*/
|
|
207
|
+
cancelAtEnd: Set<string>;
|
|
208
|
+
};
|
|
209
|
+
export type Message = {
|
|
210
|
+
id: string;
|
|
211
|
+
run: Run;
|
|
212
|
+
open: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* A message of a role the thread does not draw.
|
|
215
|
+
*/
|
|
216
|
+
ignored: boolean;
|
|
217
|
+
author: string | null;
|
|
218
|
+
/**
|
|
219
|
+
* Its answer items: the message id, then `<id>#2`, `<id>#3`…
|
|
220
|
+
*/
|
|
221
|
+
segments: string[];
|
|
222
|
+
/**
|
|
223
|
+
* Segments that received text.
|
|
224
|
+
*/
|
|
225
|
+
written: Set<string>;
|
|
226
|
+
/**
|
|
227
|
+
* A fence's lines came since the last prose.
|
|
228
|
+
*/
|
|
229
|
+
afterFence: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Surfaces its fences began and did not end.
|
|
232
|
+
*/
|
|
233
|
+
pending: Set<string>;
|
|
234
|
+
/**
|
|
235
|
+
* Surfaces its fences began.
|
|
236
|
+
*/
|
|
237
|
+
surfaces: number;
|
|
238
|
+
splitter: ReturnType<typeof inlineSplitter> | null;
|
|
239
|
+
};
|
|
240
|
+
export type Call = {
|
|
241
|
+
call: ToolCall;
|
|
242
|
+
kind: 'step' | 'tile' | 'surface';
|
|
243
|
+
run: Run;
|
|
244
|
+
traceId: string;
|
|
245
|
+
/**
|
|
246
|
+
* Its arguments are still arriving.
|
|
247
|
+
*/
|
|
248
|
+
open: boolean;
|
|
249
|
+
startedAt: {
|
|
250
|
+
source: boolean;
|
|
251
|
+
value: number;
|
|
252
|
+
};
|
|
253
|
+
gated: boolean;
|
|
254
|
+
decided: boolean;
|
|
255
|
+
tileId: string | null;
|
|
256
|
+
placeholder: string | null;
|
|
257
|
+
surfaceId: string | null;
|
|
258
|
+
/**
|
|
259
|
+
* The items drawn for the call — its approval, tile, stand-in or
|
|
260
|
+
* surface — in thread order.
|
|
261
|
+
*/
|
|
262
|
+
items: string[];
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* @typedef {Object} Run
|
|
266
|
+
* @property {string} id
|
|
267
|
+
* @property {string|null} traceId The trace its steps go into now.
|
|
268
|
+
* @property {number} traces
|
|
269
|
+
* @property {number} errors
|
|
270
|
+
* @property {Set<string>} surfaces Surface items created in the run.
|
|
271
|
+
* @property {Set<string>} cancelAtEnd Surfaces an unterminated fence left open, already reported.
|
|
272
|
+
*/
|
|
273
|
+
/**
|
|
274
|
+
* @typedef {Object} Message
|
|
275
|
+
* @property {string} id
|
|
276
|
+
* @property {Run} run
|
|
277
|
+
* @property {boolean} open
|
|
278
|
+
* @property {boolean} ignored A message of a role the thread does not draw.
|
|
279
|
+
* @property {string|null} author
|
|
280
|
+
* @property {string[]} segments Its answer items: the message id, then `<id>#2`, `<id>#3`…
|
|
281
|
+
* @property {Set<string>} written Segments that received text.
|
|
282
|
+
* @property {boolean} afterFence A fence's lines came since the last prose.
|
|
283
|
+
* @property {Set<string>} pending Surfaces its fences began and did not end.
|
|
284
|
+
* @property {number} surfaces Surfaces its fences began.
|
|
285
|
+
* @property {ReturnType<typeof inlineSplitter>|null} splitter
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* @typedef {Object} Call
|
|
289
|
+
* @property {ToolCall} call
|
|
290
|
+
* @property {'step'|'tile'|'surface'} kind
|
|
291
|
+
* @property {Run} run
|
|
292
|
+
* @property {string} traceId
|
|
293
|
+
* @property {boolean} open Its arguments are still arriving.
|
|
294
|
+
* @property {{source:boolean, value:number}} startedAt
|
|
295
|
+
* @property {boolean} gated
|
|
296
|
+
* @property {boolean} decided
|
|
297
|
+
* @property {string|null} tileId
|
|
298
|
+
* @property {string|null} placeholder
|
|
299
|
+
* @property {string|null} surfaceId
|
|
300
|
+
* @property {string[]} items The items drawn for the call — its approval, tile, stand-in or
|
|
301
|
+
* surface — in thread order.
|
|
302
|
+
*/
|
|
303
|
+
/**
|
|
304
|
+
* Connects an AG-UI 1.0 event stream to an AgentThread.
|
|
305
|
+
*
|
|
306
|
+
* - Run start, finish and error drive `runStatus`; an error also adds a `notice`. An error outside
|
|
307
|
+
* an open run closes nothing: an approval or a surface still waiting for a person stays open.
|
|
308
|
+
* - A text message is an `answer` streamed with `appendText()`; with `inlineSurfaces`, its
|
|
309
|
+
* surface fences become surfaces after the prose before them, and the prose after a fence
|
|
310
|
+
* continues in the answer `<messageId>#2` (then `#3`…), by the same author.
|
|
311
|
+
* - A tool call is a trace step: its arguments show once complete, its result fills it. A call in
|
|
312
|
+
* `tools` is also the application's tile `tool:<toolCallId>`; a call in `surfaceTools` is an
|
|
313
|
+
* `ask` step and a surface, a Skeleton while its arguments arrive.
|
|
314
|
+
* - Calls `requiresApproval` holds wait at an ApprovalCard (`approval:<toolCallId>`). AG-UI 1.0
|
|
315
|
+
* asks for approval by ending the run with an `interrupt` outcome, or with the call among the
|
|
316
|
+
* `pendingToolCallIds` of a frontend tool; either way the decision reaches the application
|
|
317
|
+
* through `ontoolresult` for its next run, and a later run's result for the call fills the step.
|
|
318
|
+
* A `tool_call` interrupt for a call `requiresApproval` let through gates it too; the
|
|
319
|
+
* application keeps each `interrupt.id` from the event for its `resume` entry. Every other
|
|
320
|
+
* interrupt is the application's: the event goes to `onunknown`. A result that arrives before
|
|
321
|
+
* the decision is drawn as it is, the card expires, and no decision is sent for that call; a
|
|
322
|
+
* surface still waiting is cancelled the same way.
|
|
323
|
+
* - A message id is the answer's item id. A start for a closed message or call reopens it, in this
|
|
324
|
+
* run or a later one, and its content continues: a reopened call is asked about again once its
|
|
325
|
+
* arguments are complete. A start for an id still open, or for a call already decided or
|
|
326
|
+
* answered, is ignored and reported: `ontoolresult` fires once for a call, and a receipt stays.
|
|
327
|
+
* - A surface is the thread item `surface:<runId>/<surface>`, so a model reusing `s1` in every
|
|
328
|
+
* run gets a new surface each run. Its token is the application's for a custom event, the tool
|
|
329
|
+
* call id for a surface tool, and the run id for an inline surface.
|
|
330
|
+
* - A state snapshot and its deltas keep the application state, reported through `onstate`.
|
|
331
|
+
* - Reasoning is one collapsed "Thought for N s" step, its text shown only with `showReasoning`.
|
|
332
|
+
* - `*_CHUNK` events are expanded into their start, content and end events.
|
|
333
|
+
* - Out of order: content, arguments or an end for something never started is dropped, not
|
|
334
|
+
* drawn; a second start for an open id is ignored. Both are reported through `onerror`.
|
|
335
|
+
*
|
|
336
|
+
* @param {AgentThread} thread The thread to draw in.
|
|
337
|
+
* @param {AgUiOptions} [options]
|
|
338
|
+
* @returns {AgUiConnection}
|
|
339
|
+
*/
|
|
340
|
+
export declare function connectAgUi(thread: AgentThread, options?: AgUiOptions): AgUiConnection;
|