@zeyos/zx 5.5.0 → 5.6.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 (48) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
  3. package/dist/types/components/approval-card/approval-card.d.ts +596 -0
  4. package/dist/types/components/avatar/avatar.d.ts +91 -4
  5. package/dist/types/components/block-view/block-view.d.ts +205 -0
  6. package/dist/types/components/composer/composer.d.ts +736 -0
  7. package/dist/types/components/run-status/run-status.d.ts +393 -0
  8. package/dist/types/components/run-trace/run-trace.d.ts +624 -0
  9. package/dist/types/components/source-list/source-list.d.ts +177 -0
  10. package/dist/types/core/messages.d.ts +135 -0
  11. package/dist/types/index.d.ts +8 -0
  12. package/dist/types/internal/agent-model.d.ts +587 -0
  13. package/dist/types/internal/highlight.d.ts +24 -0
  14. package/dist/types/internal/presence-loop.d.ts +148 -0
  15. package/dist/zx-zeyos.esm.js +4648 -4513
  16. package/dist/zx-zeyos.esm.min.js +2 -2
  17. package/dist/zx.css +1927 -1
  18. package/dist/zx.esm.js +15769 -9194
  19. package/dist/zx.esm.min.js +27 -8
  20. package/dist/zx.global.js +15769 -9194
  21. package/dist/zx.global.min.js +27 -8
  22. package/dist/zx.min.css +1 -1
  23. package/docs/api.json +1166 -5
  24. package/docs/llms.md +455 -2
  25. package/docs/llms.txt +10 -1
  26. package/package.json +1 -1
  27. package/src/components/agent-thread/agent-thread.css +417 -0
  28. package/src/components/agent-thread/agent-thread.js +1365 -0
  29. package/src/components/approval-card/approval-card.css +289 -0
  30. package/src/components/approval-card/approval-card.js +1377 -0
  31. package/src/components/avatar/avatar.css +56 -1
  32. package/src/components/avatar/avatar.js +148 -26
  33. package/src/components/block-view/block-view.css +300 -0
  34. package/src/components/block-view/block-view.js +523 -0
  35. package/src/components/composer/composer.css +403 -0
  36. package/src/components/composer/composer.js +1441 -0
  37. package/src/components/run-status/run-status.css +208 -0
  38. package/src/components/run-status/run-status.js +782 -0
  39. package/src/components/run-trace/run-trace.css +443 -0
  40. package/src/components/run-trace/run-trace.js +1209 -0
  41. package/src/components/source-list/source-list.css +208 -0
  42. package/src/components/source-list/source-list.js +355 -0
  43. package/src/core/messages.js +143 -0
  44. package/src/index.js +8 -0
  45. package/src/internal/agent-model.js +488 -0
  46. package/src/internal/highlight.js +104 -0
  47. package/src/internal/presence-loop.js +343 -0
  48. package/styles/zx.css +7 -0
@@ -0,0 +1,177 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { Tooltip } from '../tooltip/tooltip.js';
3
+ export type Source = import('../../internal/agent-model.js').Source;
4
+ export type SourceKind = 'web' | 'file' | 'record' | 'call';
5
+ export type SourceListOptions = {
6
+ /**
7
+ * The sources, in the order an answer's `[n]` citations number
8
+ * them. Model text is data: every string reaches the page as text.
9
+ */
10
+ sources?: Source[];
11
+ /**
12
+ * The visible label the list is named by. Empty hides it and
13
+ * names the list with the `sourceList.label` message instead.
14
+ */
15
+ label?: string;
16
+ /**
17
+ * `'chips'` wraps short chips beside the label;
18
+ * `'list'` gives each source a full-width row with its title and site.
19
+ */
20
+ layout?: 'chips' | 'list';
21
+ /**
22
+ * Whether each source shows its number.
23
+ */
24
+ numbered?: boolean;
25
+ /**
26
+ * Icon names per source kind, over the
27
+ * built-in `SOURCE_ICONS`.
28
+ */
29
+ icons?: Partial<Record<SourceKind, string>>;
30
+ /**
31
+ * Localized messages.
32
+ */
33
+ msg?: Record<string, string> | Record<string, Record<string, string>>;
34
+ /**
35
+ * Activation
36
+ * listener; `preventDefault()` keeps a web source from opening.
37
+ */
38
+ onselect?: (event: CustomEvent<{
39
+ source: Source;
40
+ n: number;
41
+ }>) => void;
42
+ };
43
+ /** @typedef {import('../../internal/agent-model.js').Source} Source */
44
+ /**
45
+ * What a source is: it picks the glyph, and whether activating it can open an address.
46
+ * @typedef {'web'|'file'|'record'|'call'} SourceKind
47
+ */
48
+ /**
49
+ * @typedef {Object} SourceListOptions
50
+ * @property {Source[]} [sources=[]] The sources, in the order an answer's `[n]` citations number
51
+ * them. Model text is data: every string reaches the page as text.
52
+ * @property {string} [label='Sources'] The visible label the list is named by. Empty hides it and
53
+ * names the list with the `sourceList.label` message instead.
54
+ * @property {'chips'|'list'} [layout='chips'] `'chips'` wraps short chips beside the label;
55
+ * `'list'` gives each source a full-width row with its title and site.
56
+ * @property {boolean} [numbered=true] Whether each source shows its number.
57
+ * @property {Partial<Record<SourceKind, string>>} [icons={}] Icon names per source kind, over the
58
+ * built-in `SOURCE_ICONS`.
59
+ * @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
60
+ * @property {(event: CustomEvent<{source: Source, n: number}>) => void} [onselect] Activation
61
+ * listener; `preventDefault()` keeps a web source from opening.
62
+ */
63
+ /** Built-in glyph per source kind. */
64
+ export declare const SOURCE_ICONS: Readonly<{
65
+ web: "link-2";
66
+ file: "file";
67
+ record: "table";
68
+ call: "gear";
69
+ }>;
70
+ /**
71
+ * The sources an answer cites: a numbered chip (or row) for each, naming its site or title, with a
72
+ * card of its title, site, and the passage used on hover and focus.
73
+ *
74
+ * Activating a source emits a preventable `select`. Unless it is prevented, a `web` source opens
75
+ * its address in a new tab — only an absolute `https:` address, and never with access back to this
76
+ * page; every other kind is left to the application, which might reveal the trace step the source
77
+ * came from. The list never loads a favicon, a thumbnail, or any other remote resource.
78
+ *
79
+ * @fires SourceList#select
80
+ * @extends {Component<SourceListOptions>}
81
+ */
82
+ export declare class SourceList extends Component<SourceListOptions> {
83
+ _original: import("../../core/dom.js").TargetSnapshot;
84
+ _destroyed: boolean;
85
+ /** @type {Array<Source & {id: string}>} */
86
+ _sources: Array<Source & {
87
+ id: string;
88
+ }>;
89
+ /** @type {HTMLButtonElement[]} */
90
+ _buttons: HTMLButtonElement[];
91
+ /** @type {Tooltip[]} */
92
+ _tooltips: Tooltip[];
93
+ /** @type {ReturnType<typeof setTimeout>|null} */
94
+ _highlightTimer: ReturnType<typeof setTimeout> | null;
95
+ _layout: string;
96
+ _list: HTMLElement;
97
+ static cssName: string;
98
+ /** @type {Readonly<SourceListOptions>} */
99
+ static defaults: Readonly<SourceListOptions>;
100
+ /** @returns {HTMLElement} */
101
+ render(): HTMLElement;
102
+ /**
103
+ * Replaces every source. Focus on a source stays on the source with the same `id`.
104
+ * @param {Source[]} sources
105
+ * @returns {this}
106
+ */
107
+ setSources(sources: Source[]): this;
108
+ /**
109
+ * Points at one source, as a citation `[n]` in the answer does: scrolls it into view, puts focus
110
+ * on it, and marks it with `data-state="highlighted"` for two seconds. A number is the source's
111
+ * position, from 1; a string is its `id`. Anything else does nothing.
112
+ * @param {number|string} n
113
+ * @returns {this}
114
+ */
115
+ highlight(n: number | string): this;
116
+ /** @returns {Source[]} Copies of the sources, in order. */
117
+ getSources(): Source[];
118
+ /** @returns {void} */
119
+ destroy(): void;
120
+ /**
121
+ * @private
122
+ * @param {unknown} sources
123
+ * @returns {void}
124
+ */
125
+ private _build;
126
+ /**
127
+ * @private
128
+ * @param {Source & {id: string}} source
129
+ * @param {number} index
130
+ * @returns {HTMLElement}
131
+ */
132
+ private _item;
133
+ /**
134
+ * The card a source shows on hover and focus: its title, where it is (the host of a web
135
+ * address), and the passage used.
136
+ * @private
137
+ * @param {Source & {id: string}} source
138
+ * @returns {HTMLElement}
139
+ */
140
+ private _card;
141
+ /** @private @param {SourceKind} kind @returns {string} */
142
+ private _icon;
143
+ /** @private @returns {void} */
144
+ private _releaseTooltips;
145
+ /**
146
+ * @private
147
+ * @param {MouseEvent} event
148
+ * @returns {void}
149
+ */
150
+ private _onClick;
151
+ }
152
+ /**
153
+ * A source's kind; a source without one is a web source.
154
+ * @param {Source|null|undefined} source
155
+ * @returns {SourceKind}
156
+ */
157
+ export declare function sourceKind(source: Source | null | undefined): SourceKind;
158
+ /**
159
+ * The address a source may open: a `web` source's `href`, only when it is an absolute `https:`
160
+ * URL that `safeHref()` accepts. Anything else — another kind, a relative or `http:` address, a
161
+ * script scheme — gives null.
162
+ * @param {Source|null|undefined} source
163
+ * @returns {string|null}
164
+ */
165
+ export declare function sourceHref(source: Source | null | undefined): string | null;
166
+ /**
167
+ * The host a web source opens, for its card: "bank.example". Null when it opens nothing.
168
+ * @param {Source|null|undefined} source
169
+ * @returns {string|null}
170
+ */
171
+ export declare function sourceHost(source: Source | null | undefined): string | null;
172
+ /**
173
+ * The short name a chip shows: the source's `site`, else its title.
174
+ * @param {Source|null|undefined} source
175
+ * @returns {string}
176
+ */
177
+ export declare function sourceName(source: Source | null | undefined): string;
@@ -22,6 +22,45 @@ export declare const defaultMessages: Readonly<{
22
22
  'activityItem.metadata': "Activity metadata";
23
23
  'activityItem.pending': "Sending…";
24
24
  'activityItem.untitled': "activity";
25
+ 'agent.activity.blocked': "Blocked";
26
+ 'agent.activity.idle': "Idle";
27
+ 'agent.activity.needsYou': "Needs you";
28
+ 'agent.activity.offline': "Offline";
29
+ 'agent.activity.thinking': "Thinking";
30
+ 'agent.activity.working': "Working";
31
+ 'agent.status.done': "Done";
32
+ 'agent.status.failed': "Failed";
33
+ 'agent.status.paused': "Paused";
34
+ 'agent.status.queued': "Not started";
35
+ 'agent.status.running': "Running";
36
+ 'agent.status.skipped': "Skipped";
37
+ 'agent.status.stopped': "Stopped";
38
+ 'agent.status.waiting': "Waiting for you";
39
+ 'agent.status.blocked': "Blocked";
40
+ 'agentThread.agent': "Agent";
41
+ 'agentThread.answered': "%1 answered";
42
+ 'agentThread.attachments': "Attachments";
43
+ 'agentThread.branch': "Branch into a new conversation";
44
+ 'agentThread.copy': "Copy answer";
45
+ 'agentThread.label': "Conversation";
46
+ 'agentThread.latest': "Jump to latest";
47
+ 'agentThread.needsApproval': "%1 needs your approval";
48
+ 'agentThread.nextVersion': "Next version";
49
+ 'agentThread.previousVersion': "Previous version";
50
+ 'agentThread.rateDown': "Not helpful";
51
+ 'agentThread.rateUp': "Helpful";
52
+ 'agentThread.regenerate': "Regenerate answer";
53
+ 'agentThread.sources': "Sources";
54
+ 'agentThread.stopped': "Stopped";
55
+ 'agentThread.stoppedAnnounce': "Stopped";
56
+ 'agentThread.version': "Version %1 of %2";
57
+ 'agentThread.via': "via %1";
58
+ 'agentThread.working': "%1 is working";
59
+ 'agentThread.writing': "%1 is writing an answer";
60
+ 'agentThread.you': "You";
61
+ 'agentThread.writingNow': "%1 is writing…";
62
+ 'agentThread.edit': "Edit message";
63
+ 'agentThread.copyMessage': "Copy message";
25
64
  'appRail.subNavigation': "%1 sub-navigation";
26
65
  'appSidebar.expand': "Expand application sidebar";
27
66
  'appSidebar.itemBadge': "%1 (%2)";
@@ -30,6 +69,42 @@ export declare const defaultMessages: Readonly<{
30
69
  'appSidebar.presentationCollapsed': "Both menus collapsed";
31
70
  'appSidebar.presentationCompact': "Module menu collapsed";
32
71
  'appSidebar.presentationExpanded': "Both menus expanded";
72
+ 'approvalCard.approve': "Approve";
73
+ 'approvalCard.approvedBy': "Approved by %1 at %2";
74
+ 'approvalCard.approvedByUndated': "Approved by %1";
75
+ 'approvalCard.cancel': "Cancel";
76
+ 'approvalCard.edit': "Edit";
77
+ 'approvalCard.editTitle': "Edit the request";
78
+ 'approvalCard.editedBy': "Edited by %1";
79
+ 'approvalCard.expiredAt': "Expired at %1";
80
+ 'approvalCard.expiredUndated': "Expired without an answer";
81
+ 'approvalCard.paused': "The run is paused until you answer.";
82
+ 'approvalCard.preview': "Preview";
83
+ 'approvalCard.reason': "Reason";
84
+ 'approvalCard.reasonLabel': "Why not?";
85
+ 'approvalCard.reasonMissing': "Say why, so the agent can do better next time.";
86
+ 'approvalCard.reasonOptional': "Optional. Your reason stays with the request.";
87
+ 'approvalCard.reasonRequired': "Your reason stays with the request.";
88
+ 'approvalCard.reject': "Reject";
89
+ 'approvalCard.rejectTitle': "Reject the request?";
90
+ 'approvalCard.rejectedBy': "Rejected by %1 at %2";
91
+ 'approvalCard.rejectedByUndated': "Rejected by %1";
92
+ 'approvalCard.required': "Fill this in to save.";
93
+ 'approvalCard.save': "Save changes";
94
+ 'approvalCard.status.approved': "Approved";
95
+ 'approvalCard.status.expired': "Expired";
96
+ 'approvalCard.status.pending': "Waiting for you";
97
+ 'approvalCard.status.rejected': "Rejected";
98
+ 'approvalCard.you': "you";
99
+ 'blockView.cite': "Source %1";
100
+ 'blockView.citeTitled': "Source %1: %2";
101
+ 'blockView.code': "Code";
102
+ 'blockView.copyCode': "Copy code";
103
+ 'blockView.document': "Document";
104
+ 'blockView.stopped': "Stopped here.";
105
+ 'blockView.table': "Table";
106
+ 'blockView.version': "1 version";
107
+ 'blockView.versions': "%1 versions";
33
108
  'breadcrumb.label': "Breadcrumb";
34
109
  'breadcrumb.more': "Show hidden levels";
35
110
  'calendar.agenda': "Agenda";
@@ -68,6 +143,19 @@ export declare const defaultMessages: Readonly<{
68
143
  'checklist.empty': "No matches";
69
144
  'checklist.label': "Checklist";
70
145
  'checklist.search': "Search";
146
+ 'composer.attach': "Attach files";
147
+ 'composer.attachments': "Attachments";
148
+ 'composer.commands': "Commands";
149
+ 'composer.commandsPlaceholder': "Search commands";
150
+ 'composer.context': "Context";
151
+ 'composer.drop': "Drop files to attach";
152
+ 'composer.label': "Message";
153
+ 'composer.match': "1 suggestion";
154
+ 'composer.matches': "%1 suggestions";
155
+ 'composer.remove': "Remove %1";
156
+ 'composer.send': "Send";
157
+ 'composer.stop': "Stop";
158
+ 'composer.suggestions': "Suggestions";
71
159
  'dataFilter.all': "All";
72
160
  'dataFilter.clear': "Clear";
73
161
  'datePicker.calendar': "Calendar";
@@ -245,6 +333,51 @@ export declare const defaultMessages: Readonly<{
245
333
  'recordView.fields': "Fields";
246
334
  'recordView.moveFieldDown': "Move %1 down";
247
335
  'recordView.moveFieldUp': "Move %1 up";
336
+ 'runStatus.cost': "%1 of %2";
337
+ 'runStatus.costLabel': "Cost";
338
+ 'runStatus.dateTimeFormat': "%e %b, %H:%M";
339
+ 'runStatus.failedAt': "Failed at";
340
+ 'runStatus.finished': "Finished";
341
+ 'runStatus.model': "Model";
342
+ 'runStatus.started': "Started";
343
+ 'runStatus.steps': "%1 of %2 steps";
344
+ 'runStatus.stepsLabel': "Steps done";
345
+ 'runStatus.stoppedAt': "Stopped at";
346
+ 'runStatus.timeFormat': "%H:%M";
347
+ 'runStatus.tokens': "Tokens";
348
+ 'runStatus.tokensValue': "%1 in · %2 out";
349
+ 'runStatus.waitingSince': "Waiting since";
350
+ 'runStatus.workingTime': "Working time";
351
+ 'runStatus.blockedSince': "Blocked since";
352
+ 'runStatus.tokenBudget': "%1 of %2 tokens";
353
+ 'runTrace.arguments': "Arguments";
354
+ 'runTrace.awaiting': "Waiting for the result…";
355
+ 'runTrace.call': "1 tool call";
356
+ 'runTrace.calls': "%1 tool calls";
357
+ 'runTrace.copied': "Copied";
358
+ 'runTrace.copyArguments': "Copy arguments";
359
+ 'runTrace.copyError': "Copy error";
360
+ 'runTrace.copyResult': "Copy result";
361
+ 'runTrace.doing': "%1…";
362
+ 'runTrace.error': "Error";
363
+ 'runTrace.failedAfter': "Failed after %1";
364
+ 'runTrace.handoff': "%1 handed over to %2";
365
+ 'runTrace.label': "Steps";
366
+ 'runTrace.result': "Result";
367
+ 'runTrace.retried': "Retried";
368
+ 'runTrace.retries': "%1 retries";
369
+ 'runTrace.retry': "1 retry";
370
+ 'runTrace.showAll': "Show all";
371
+ 'runTrace.source': "1 source";
372
+ 'runTrace.sources': "%1 sources";
373
+ 'runTrace.step': "1 step";
374
+ 'runTrace.steps': "%1 steps";
375
+ 'runTrace.stoppedAfter': "Stopped after %1";
376
+ 'runTrace.worked': "Worked for %1";
377
+ 'runTrace.working': "Working…";
378
+ 'runTrace.blockedAfter': "Blocked after %1";
379
+ 'runTrace.token': "1 token";
380
+ 'runTrace.tokens': "%1 tokens";
248
381
  'search.clear': "Clear search";
249
382
  'search.label': "Search";
250
383
  'search.submit': "Submit search";
@@ -255,6 +388,8 @@ export declare const defaultMessages: Readonly<{
255
388
  'select.none': "No selection";
256
389
  'select.toggle': "Toggle options";
257
390
  'sheet.resize': "Resize sheet";
391
+ 'sourceList.label': "Sources";
392
+ 'sourceList.source': "Source";
258
393
  'statTile.down': "down %1";
259
394
  'statTile.loading': "Loading";
260
395
  'statTile.unchanged': "no change";
@@ -62,6 +62,14 @@ export { FileItem, normalizeFileItem } from './components/file-item/file-item.js
62
62
  export { FileList, normalizeFileListItems } from './components/file-list/file-list.js';
63
63
  export { ActivityItem, resolveActivityActions, normalizeActivityAction, normalizeActivityTimestamp } from './components/activity-item/activity-item.js';
64
64
  export { ActivityList, groupActivityItems, normalizeActivityItems } from './components/activity-list/activity-list.js';
65
+ export { BlockView, renderBlocks } from './components/block-view/block-view.js';
66
+ export { blocksToMarkdown, blocksToText } from './internal/agent-model.js';
67
+ export { RunStatus } from './components/run-status/run-status.js';
68
+ export { Composer } from './components/composer/composer.js';
69
+ export { ApprovalCard } from './components/approval-card/approval-card.js';
70
+ export { RunTrace } from './components/run-trace/run-trace.js';
71
+ export { SourceList } from './components/source-list/source-list.js';
72
+ export { AgentThread } from './components/agent-thread/agent-thread.js';
65
73
  export { AccountMenu } from './components/account-menu/account-menu.js';
66
74
  export { WorkspaceSwitcher } from './components/workspace-switcher/workspace-switcher.js';
67
75
  export { normalizeAppItems } from './internal/app-rail.js';