@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.
- package/CHANGELOG.md +56 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
- package/dist/types/components/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- package/dist/types/components/composer/composer.d.ts +736 -0
- package/dist/types/components/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- package/dist/types/components/source-list/source-list.d.ts +177 -0
- package/dist/types/core/messages.d.ts +135 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/presence-loop.d.ts +148 -0
- package/dist/zx-zeyos.esm.js +4648 -4513
- package/dist/zx-zeyos.esm.min.js +2 -2
- package/dist/zx.css +1927 -1
- package/dist/zx.esm.js +15769 -9194
- package/dist/zx.esm.min.js +27 -8
- package/dist/zx.global.js +15769 -9194
- package/dist/zx.global.min.js +27 -8
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1166 -5
- package/docs/llms.md +455 -2
- package/docs/llms.txt +10 -1
- package/package.json +1 -1
- package/src/components/agent-thread/agent-thread.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1365 -0
- package/src/components/approval-card/approval-card.css +289 -0
- package/src/components/approval-card/approval-card.js +1377 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +523 -0
- package/src/components/composer/composer.css +403 -0
- package/src/components/composer/composer.js +1441 -0
- package/src/components/run-status/run-status.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- package/src/components/source-list/source-list.css +208 -0
- package/src/components/source-list/source-list.js +355 -0
- package/src/core/messages.js +143 -0
- package/src/index.js +8 -0
- package/src/internal/agent-model.js +488 -0
- package/src/internal/highlight.js +104 -0
- package/src/internal/presence-loop.js +343 -0
- package/styles/zx.css +7 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export type AgentActivity = import('./agent-model.js').AgentActivity;
|
|
2
|
+
export type PresencePose = {
|
|
3
|
+
y: number;
|
|
4
|
+
r: number;
|
|
5
|
+
s: number;
|
|
6
|
+
w: number;
|
|
7
|
+
blink: number;
|
|
8
|
+
};
|
|
9
|
+
export type PresenceHandle = {
|
|
10
|
+
/**
|
|
11
|
+
* Changes
|
|
12
|
+
* what the avatar is doing, and its phase when `options.phase` is given; the loop eases it into
|
|
13
|
+
* the new pose.
|
|
14
|
+
*/
|
|
15
|
+
set: (activity: AgentActivity | string | null, options?: TrackOptions) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Leaves the loop and puts the avatar back at rest. Safe to call
|
|
18
|
+
* more than once.
|
|
19
|
+
*/
|
|
20
|
+
untrack: () => void;
|
|
21
|
+
};
|
|
22
|
+
export type TrackOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* Where in its cycle this avatar moves, as a fraction of the cycle
|
|
25
|
+
* from 0 up to 1 (whole turns wrap; anything that is not a finite number is 0). Avatars in the same
|
|
26
|
+
* activity at different phases never move in step: 0.5 is half a cycle apart, whatever the
|
|
27
|
+
* activity. `presencePhase(key)` derives one from a stable key.
|
|
28
|
+
*/
|
|
29
|
+
phase?: number;
|
|
30
|
+
};
|
|
31
|
+
/** @typedef {import('./agent-model.js').AgentActivity} AgentActivity */
|
|
32
|
+
/**
|
|
33
|
+
* Where an avatar wants to be at one moment: a vertical offset in pixels, a rotation in degrees, a
|
|
34
|
+
* scale, how much a blink may squash it (`w`, eased like the rest), and the blink's depth now.
|
|
35
|
+
* @typedef {{y: number, r: number, s: number, w: number, blink: number}} PresencePose
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {Object} PresenceHandle
|
|
39
|
+
* @property {(activity: AgentActivity|string|null, options?: TrackOptions) => void} set Changes
|
|
40
|
+
* what the avatar is doing, and its phase when `options.phase` is given; the loop eases it into
|
|
41
|
+
* the new pose.
|
|
42
|
+
* @property {() => void} untrack Leaves the loop and puts the avatar back at rest. Safe to call
|
|
43
|
+
* more than once.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {Object} TrackOptions
|
|
47
|
+
* @property {number} [phase=0] Where in its cycle this avatar moves, as a fraction of the cycle
|
|
48
|
+
* from 0 up to 1 (whole turns wrap; anything that is not a finite number is 0). Avatars in the same
|
|
49
|
+
* activity at different phases never move in step: 0.5 is half a cycle apart, whatever the
|
|
50
|
+
* activity. `presencePhase(key)` derives one from a stable key.
|
|
51
|
+
*/
|
|
52
|
+
/** The longest step one frame may take, so a frame after a stall eases instead of jumping. */
|
|
53
|
+
export declare const MAX_FRAME_MS = 50;
|
|
54
|
+
/**
|
|
55
|
+
* The pose of an avatar doing `activity` at time `t`. Pure: the same input always gives the same
|
|
56
|
+
* pose. Idle breathes, thinking sways, working bobs, and needs-you leans and blinks; blocked,
|
|
57
|
+
* offline, and anything unknown stay at rest.
|
|
58
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
59
|
+
* @param {number} t Seconds.
|
|
60
|
+
* @returns {PresencePose}
|
|
61
|
+
*/
|
|
62
|
+
export declare function presencePose(activity: AgentActivity | string | null | undefined, t: number): PresencePose;
|
|
63
|
+
/**
|
|
64
|
+
* A stable phase for a key, as a fraction of the cycle from 0 up to 1, so two avatars never move in
|
|
65
|
+
* step and the same avatar always moves the same way.
|
|
66
|
+
* @param {unknown} key
|
|
67
|
+
* @returns {number}
|
|
68
|
+
*/
|
|
69
|
+
export declare function presencePhase(key: unknown): number;
|
|
70
|
+
/**
|
|
71
|
+
* Reads a phase: a finite number wrapped into a fraction from 0 up to 1 (`1.25` is `0.25`, `-0.25`
|
|
72
|
+
* is `0.75`), or null for anything else.
|
|
73
|
+
* @param {unknown} phase
|
|
74
|
+
* @returns {number|null}
|
|
75
|
+
*/
|
|
76
|
+
export declare function normalizePhase(phase: unknown): number | null;
|
|
77
|
+
/**
|
|
78
|
+
* How long one cycle of an activity takes, in seconds; 0 for one that stays at rest.
|
|
79
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
export declare function presencePeriod(activity: AgentActivity | string | null | undefined): number;
|
|
83
|
+
/**
|
|
84
|
+
* The seconds a phase moves an avatar along its activity's cycle.
|
|
85
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
86
|
+
* @param {unknown} phase A fraction of the cycle; see `normalizePhase()`.
|
|
87
|
+
* @returns {number}
|
|
88
|
+
*/
|
|
89
|
+
export declare function presenceOffset(activity: AgentActivity | string | null | undefined, phase: unknown): number;
|
|
90
|
+
export type Entry = {
|
|
91
|
+
activity: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* A fraction of the cycle.
|
|
94
|
+
*/
|
|
95
|
+
phase: number;
|
|
96
|
+
pose: {
|
|
97
|
+
y: number;
|
|
98
|
+
r: number;
|
|
99
|
+
s: number;
|
|
100
|
+
w: number;
|
|
101
|
+
};
|
|
102
|
+
visible: boolean;
|
|
103
|
+
reduced: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the loop has written a transform it has not cleared.
|
|
106
|
+
*/
|
|
107
|
+
moved: boolean;
|
|
108
|
+
unwatch: () => void;
|
|
109
|
+
};
|
|
110
|
+
export type Loop = {
|
|
111
|
+
document: Document;
|
|
112
|
+
entries: Map<HTMLElement, Entry>;
|
|
113
|
+
observer: IntersectionObserver;
|
|
114
|
+
abort: AbortController;
|
|
115
|
+
frame: number;
|
|
116
|
+
last: number;
|
|
117
|
+
time: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @typedef {Object} Entry
|
|
121
|
+
* @property {string|null} activity
|
|
122
|
+
* @property {number} phase A fraction of the cycle.
|
|
123
|
+
* @property {{y: number, r: number, s: number, w: number}} pose
|
|
124
|
+
* @property {boolean} visible
|
|
125
|
+
* @property {boolean} reduced
|
|
126
|
+
* @property {boolean} moved Whether the loop has written a transform it has not cleared.
|
|
127
|
+
* @property {() => void} unwatch
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* @typedef {Object} Loop
|
|
131
|
+
* @property {Document} document
|
|
132
|
+
* @property {Map<HTMLElement, Entry>} entries
|
|
133
|
+
* @property {IntersectionObserver} observer
|
|
134
|
+
* @property {AbortController} abort
|
|
135
|
+
* @property {number} frame
|
|
136
|
+
* @property {number} last
|
|
137
|
+
* @property {number} time
|
|
138
|
+
*/
|
|
139
|
+
/**
|
|
140
|
+
* Adds an element to its document's presence loop. The element's `transform` belongs to the loop
|
|
141
|
+
* while it is tracked; `untrack()` clears it. Where `requestAnimationFrame` or
|
|
142
|
+
* `IntersectionObserver` is missing the handle does nothing.
|
|
143
|
+
* @param {HTMLElement} element What moves: the avatar's root.
|
|
144
|
+
* @param {AgentActivity|string|null} activity What the avatar is doing.
|
|
145
|
+
* @param {TrackOptions} [options={}]
|
|
146
|
+
* @returns {PresenceHandle}
|
|
147
|
+
*/
|
|
148
|
+
export declare function trackPresence(element: HTMLElement, activity: AgentActivity | string | null, options?: TrackOptions): PresenceHandle;
|