@agent-native/toolkit 0.10.0 → 0.10.2

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 (49) hide show
  1. package/dist/chat-history.css +2 -2
  2. package/dist/composer/PromptComposer.d.ts.map +1 -1
  3. package/dist/composer/PromptComposer.js +1 -24
  4. package/dist/composer/PromptComposer.js.map +1 -1
  5. package/dist/composer/RealtimeVoiceMode.d.ts.map +1 -1
  6. package/dist/composer/RealtimeVoiceMode.js +59 -11
  7. package/dist/composer/RealtimeVoiceMode.js.map +1 -1
  8. package/dist/composer/RealtimeVoiceMode.spec.js +68 -7
  9. package/dist/composer/RealtimeVoiceMode.spec.js.map +1 -1
  10. package/dist/composer/useRealtimeVoiceMode.d.ts.map +1 -1
  11. package/dist/composer/useRealtimeVoiceMode.js +32 -0
  12. package/dist/composer/useRealtimeVoiceMode.js.map +1 -1
  13. package/dist/composer/useRealtimeVoiceMode.spec.js +25 -2
  14. package/dist/composer/useRealtimeVoiceMode.spec.js.map +1 -1
  15. package/dist/conformance/conformance.spec.js +30 -1
  16. package/dist/conformance/conformance.spec.js.map +1 -1
  17. package/dist/conformance/runner.d.ts.map +1 -1
  18. package/dist/conformance/runner.js +75 -1
  19. package/dist/conformance/runner.js.map +1 -1
  20. package/dist/editor/SharedRichEditor.d.ts.map +1 -1
  21. package/dist/editor/SharedRichEditor.js +3 -2
  22. package/dist/editor/SharedRichEditor.js.map +1 -1
  23. package/dist/editor/SlashCommandMenu.d.ts +8 -0
  24. package/dist/editor/SlashCommandMenu.d.ts.map +1 -1
  25. package/dist/editor/SlashCommandMenu.js +6 -0
  26. package/dist/editor/SlashCommandMenu.js.map +1 -1
  27. package/dist/editor/SlashCommandMenu.spec.d.ts +2 -0
  28. package/dist/editor/SlashCommandMenu.spec.d.ts.map +1 -0
  29. package/dist/editor/SlashCommandMenu.spec.js +20 -0
  30. package/dist/editor/SlashCommandMenu.spec.js.map +1 -0
  31. package/dist/editor/index.d.ts +1 -1
  32. package/dist/editor/index.d.ts.map +1 -1
  33. package/dist/editor/index.js +1 -1
  34. package/dist/editor/index.js.map +1 -1
  35. package/dist/styles.css +197 -21
  36. package/package.json +1 -1
  37. package/src/chat-history.css +2 -2
  38. package/src/composer/PromptComposer.tsx +0 -27
  39. package/src/composer/RealtimeVoiceMode.spec.tsx +131 -9
  40. package/src/composer/RealtimeVoiceMode.tsx +124 -31
  41. package/src/composer/useRealtimeVoiceMode.spec.ts +28 -2
  42. package/src/composer/useRealtimeVoiceMode.tsx +30 -0
  43. package/src/conformance/conformance.spec.tsx +61 -1
  44. package/src/conformance/runner.tsx +153 -1
  45. package/src/editor/SharedRichEditor.tsx +13 -2
  46. package/src/editor/SlashCommandMenu.spec.ts +33 -0
  47. package/src/editor/SlashCommandMenu.tsx +20 -0
  48. package/src/editor/index.ts +2 -0
  49. package/src/styles.css +197 -21
@@ -22,9 +22,26 @@ export interface SlashCommandItem {
22
22
  searchText?: string;
23
23
  /** Short text glyph shown in the menu (T, H1, tbl, …). */
24
24
  icon: string;
25
+ /** Hide this command when the shared editor feature is disabled. */
26
+ requires?: "tables" | "tasks" | "codeBlock";
25
27
  action: (editor: Editor) => void;
26
28
  }
27
29
 
30
+ export interface SlashCommandFeatureFlags {
31
+ tables?: boolean;
32
+ tasks?: boolean;
33
+ codeBlock?: boolean;
34
+ }
35
+
36
+ export function filterSlashCommandItems(
37
+ items: readonly SlashCommandItem[],
38
+ features?: SlashCommandFeatureFlags,
39
+ ): SlashCommandItem[] {
40
+ return items.filter(
41
+ (item) => !item.requires || features?.[item.requires] !== false,
42
+ );
43
+ }
44
+
28
45
  /**
29
46
  * The default block commands — Plan's current set. Apps pass their own `items`
30
47
  * (typically `[...DEFAULT_SLASH_COMMANDS, ...extra]`) to extend it.
@@ -73,6 +90,7 @@ export const DEFAULT_SLASH_COMMANDS: SlashCommandItem[] = [
73
90
  title: "To-do list",
74
91
  description: "Checklist items",
75
92
  icon: "[]",
93
+ requires: "tasks",
76
94
  action: (editor) => editor.chain().focus().toggleTaskList().run(),
77
95
  },
78
96
  {
@@ -85,6 +103,7 @@ export const DEFAULT_SLASH_COMMANDS: SlashCommandItem[] = [
85
103
  title: "Code block",
86
104
  description: "Code snippet",
87
105
  icon: "<>",
106
+ requires: "codeBlock",
88
107
  action: (editor) => editor.chain().focus().toggleCodeBlock().run(),
89
108
  },
90
109
  {
@@ -97,6 +116,7 @@ export const DEFAULT_SLASH_COMMANDS: SlashCommandItem[] = [
97
116
  title: "Table",
98
117
  description: "Three by three table",
99
118
  icon: "tbl",
119
+ requires: "tables",
100
120
  action: (editor) =>
101
121
  editor
102
122
  .chain()
@@ -25,8 +25,10 @@ export {
25
25
  SlashCommandMenu,
26
26
  DEFAULT_SLASH_COMMANDS,
27
27
  createImageSlashCommand,
28
+ filterSlashCommandItems,
28
29
  type SlashCommandItem,
29
30
  type SlashCommandMenuProps,
31
+ type SlashCommandFeatureFlags,
30
32
  } from "./SlashCommandMenu.js";
31
33
  export {
32
34
  SharedImage,
package/src/styles.css CHANGED
@@ -20,37 +20,213 @@
20
20
  */
21
21
  @source "./**/*.{js,ts,tsx}";
22
22
 
23
- .agent-realtime-voice-working::after {
23
+ @property --agent-realtime-voice-angle {
24
+ syntax: "<angle>";
25
+ inherits: true;
26
+ initial-value: 0deg;
27
+ }
28
+
29
+ .agent-realtime-voice-glow {
30
+ --agent-realtime-voice-angle: 0deg;
31
+ --agent-realtime-voice-proximity: 72;
32
+ --agent-realtime-voice-edge-sensitivity: 30;
33
+ --agent-realtime-voice-color-sensitivity: 50;
34
+ --agent-realtime-voice-cone-spread: 25;
35
+ --agent-realtime-voice-fill-opacity: 0.5;
36
+ --agent-realtime-voice-card-bg: hsl(var(--background));
37
+ --agent-realtime-voice-glow-color: 40 80% 80%;
38
+ --agent-realtime-voice-glow-padding: 18px;
39
+ --agent-realtime-voice-gradient-one: radial-gradient(
40
+ at 80% 55%,
41
+ #c084fc 0,
42
+ transparent 50%
43
+ );
44
+ --agent-realtime-voice-gradient-two: radial-gradient(
45
+ at 69% 34%,
46
+ #f472b6 0,
47
+ transparent 50%
48
+ );
49
+ --agent-realtime-voice-gradient-three: radial-gradient(
50
+ at 8% 6%,
51
+ #38bdf8 0,
52
+ transparent 50%
53
+ );
54
+ --agent-realtime-voice-gradient-four: radial-gradient(
55
+ at 41% 38%,
56
+ #c084fc 0,
57
+ transparent 50%
58
+ );
59
+ --agent-realtime-voice-gradient-five: radial-gradient(
60
+ at 86% 85%,
61
+ #f472b6 0,
62
+ transparent 50%
63
+ );
64
+ --agent-realtime-voice-gradient-six: radial-gradient(
65
+ at 82% 18%,
66
+ #38bdf8 0,
67
+ transparent 50%
68
+ );
69
+ --agent-realtime-voice-gradient-seven: radial-gradient(
70
+ at 51% 4%,
71
+ #f472b6 0,
72
+ transparent 50%
73
+ );
24
74
  position: absolute;
25
75
  z-index: 0;
76
+ inset: -1px;
77
+ border-radius: inherit;
78
+ isolation: isolate;
79
+ pointer-events: none;
80
+ transform: translate3d(0, 0, 0.01px);
81
+ }
82
+
83
+ .agent-realtime-voice-working {
84
+ --agent-realtime-voice-proximity: 96;
85
+ }
86
+
87
+ .agent-realtime-voice-glow::before,
88
+ .agent-realtime-voice-glow::after {
89
+ position: absolute;
26
90
  inset: 0;
91
+ z-index: 0;
27
92
  border-radius: inherit;
28
93
  pointer-events: none;
29
94
  content: "";
95
+ transition: opacity 250ms ease-out;
96
+ }
97
+
98
+ .agent-realtime-voice-glow::before {
99
+ border: 1px solid transparent;
100
+ background:
101
+ linear-gradient(
102
+ var(--agent-realtime-voice-card-bg),
103
+ var(--agent-realtime-voice-card-bg)
104
+ )
105
+ padding-box,
106
+ linear-gradient(transparent 0 100%) border-box,
107
+ var(--agent-realtime-voice-gradient-one) border-box,
108
+ var(--agent-realtime-voice-gradient-two) border-box,
109
+ var(--agent-realtime-voice-gradient-three) border-box,
110
+ var(--agent-realtime-voice-gradient-four) border-box,
111
+ var(--agent-realtime-voice-gradient-five) border-box,
112
+ var(--agent-realtime-voice-gradient-six) border-box,
113
+ var(--agent-realtime-voice-gradient-seven) border-box,
114
+ linear-gradient(#c084fc 0 100%) border-box;
115
+ opacity: calc(
116
+ (
117
+ var(--agent-realtime-voice-proximity) -
118
+ var(--agent-realtime-voice-color-sensitivity)
119
+ ) /
120
+ (100 - var(--agent-realtime-voice-color-sensitivity))
121
+ );
122
+ mask-image: conic-gradient(
123
+ from var(--agent-realtime-voice-angle) at center,
124
+ #000 calc(var(--agent-realtime-voice-cone-spread) * 1%),
125
+ rgb(0 0 0 / 75%) calc((var(--agent-realtime-voice-cone-spread) + 4) * 1%),
126
+ rgb(0 0 0 / 45%) calc((var(--agent-realtime-voice-cone-spread) + 8) * 1%),
127
+ rgb(0 0 0 / 18%) calc((var(--agent-realtime-voice-cone-spread) + 12) * 1%),
128
+ transparent calc((var(--agent-realtime-voice-cone-spread) + 15) * 1%),
129
+ transparent calc((100 - var(--agent-realtime-voice-cone-spread) - 15) * 1%),
130
+ rgb(0 0 0 / 18%)
131
+ calc((100 - var(--agent-realtime-voice-cone-spread) - 12) * 1%),
132
+ rgb(0 0 0 / 45%)
133
+ calc((100 - var(--agent-realtime-voice-cone-spread) - 8) * 1%),
134
+ rgb(0 0 0 / 75%)
135
+ calc((100 - var(--agent-realtime-voice-cone-spread) - 4) * 1%),
136
+ #000 calc((100 - var(--agent-realtime-voice-cone-spread)) * 1%)
137
+ );
30
138
  }
31
139
 
32
- @media (prefers-reduced-motion: no-preference) {
33
- .agent-realtime-voice-working::after {
34
- background: linear-gradient(
35
- 90deg,
36
- transparent 0%,
37
- transparent 36%,
38
- hsl(var(--foreground) / 0.14) 50%,
39
- transparent 64%,
40
- transparent 100%
140
+ .agent-realtime-voice-glow::after {
141
+ border: 1px solid transparent;
142
+ background:
143
+ var(--agent-realtime-voice-gradient-one) padding-box,
144
+ var(--agent-realtime-voice-gradient-two) padding-box,
145
+ var(--agent-realtime-voice-gradient-three) padding-box,
146
+ var(--agent-realtime-voice-gradient-four) padding-box,
147
+ var(--agent-realtime-voice-gradient-five) padding-box,
148
+ var(--agent-realtime-voice-gradient-six) padding-box,
149
+ var(--agent-realtime-voice-gradient-seven) padding-box,
150
+ linear-gradient(#c084fc 0 100%) padding-box;
151
+ mask-image:
152
+ linear-gradient(to bottom, #000, #000),
153
+ radial-gradient(ellipse at 50% 50%, #000 40%, transparent 65%),
154
+ radial-gradient(ellipse at 66% 66%, #000 5%, transparent 40%),
155
+ radial-gradient(ellipse at 33% 33%, #000 5%, transparent 40%),
156
+ radial-gradient(ellipse at 66% 33%, #000 5%, transparent 40%),
157
+ radial-gradient(ellipse at 33% 66%, #000 5%, transparent 40%),
158
+ conic-gradient(
159
+ from var(--agent-realtime-voice-angle) at center,
160
+ transparent 5%,
161
+ #000 15%,
162
+ #000 85%,
163
+ transparent 95%
41
164
  );
42
- background-repeat: repeat;
43
- background-size: 14rem 100%;
44
- animation: agent-realtime-voice-shine 2.6s linear infinite;
45
- }
165
+ mask-composite: subtract, add, add, add, add, add;
166
+ opacity: calc(
167
+ var(--agent-realtime-voice-fill-opacity) *
168
+ (
169
+ var(--agent-realtime-voice-proximity) -
170
+ var(--agent-realtime-voice-color-sensitivity)
171
+ ) /
172
+ (100 - var(--agent-realtime-voice-color-sensitivity))
173
+ );
174
+ mix-blend-mode: soft-light;
175
+ }
46
176
 
47
- @keyframes agent-realtime-voice-shine {
48
- from {
49
- background-position: 0 0;
50
- }
177
+ .agent-realtime-voice-edge-light {
178
+ position: absolute;
179
+ z-index: 1;
180
+ inset: calc(var(--agent-realtime-voice-glow-padding) * -1);
181
+ border-radius: inherit;
182
+ pointer-events: none;
183
+ opacity: calc(
184
+ (
185
+ var(--agent-realtime-voice-proximity) -
186
+ var(--agent-realtime-voice-edge-sensitivity)
187
+ ) /
188
+ (100 - var(--agent-realtime-voice-edge-sensitivity))
189
+ );
190
+ mask-image: conic-gradient(
191
+ from var(--agent-realtime-voice-angle) at center,
192
+ #000 2.5%,
193
+ rgb(0 0 0 / 85%) 4%,
194
+ rgb(0 0 0 / 55%) 7%,
195
+ rgb(0 0 0 / 25%) 11%,
196
+ transparent 15%,
197
+ transparent 85%,
198
+ rgb(0 0 0 / 25%) 89%,
199
+ rgb(0 0 0 / 55%) 93%,
200
+ rgb(0 0 0 / 85%) 96%,
201
+ #000 97.5%
202
+ );
203
+ mix-blend-mode: plus-lighter;
204
+ transition: opacity 250ms ease-out;
205
+ }
206
+
207
+ .agent-realtime-voice-edge-light::before {
208
+ position: absolute;
209
+ inset: var(--agent-realtime-voice-glow-padding);
210
+ border-radius: inherit;
211
+ content: "";
212
+ box-shadow:
213
+ inset 0 0 0 1px hsl(var(--agent-realtime-voice-glow-color) / 100%),
214
+ inset 0 0 1px hsl(var(--agent-realtime-voice-glow-color) / 60%),
215
+ inset 0 0 3px hsl(var(--agent-realtime-voice-glow-color) / 50%),
216
+ inset 0 0 6px hsl(var(--agent-realtime-voice-glow-color) / 40%),
217
+ inset 0 0 15px hsl(var(--agent-realtime-voice-glow-color) / 30%),
218
+ inset 0 0 25px 2px hsl(var(--agent-realtime-voice-glow-color) / 20%),
219
+ inset 0 0 50px 2px hsl(var(--agent-realtime-voice-glow-color) / 10%),
220
+ 0 0 1px hsl(var(--agent-realtime-voice-glow-color) / 60%),
221
+ 0 0 3px hsl(var(--agent-realtime-voice-glow-color) / 50%),
222
+ 0 0 6px hsl(var(--agent-realtime-voice-glow-color) / 40%),
223
+ 0 0 15px hsl(var(--agent-realtime-voice-glow-color) / 30%),
224
+ 0 0 25px 2px hsl(var(--agent-realtime-voice-glow-color) / 20%),
225
+ 0 0 50px 2px hsl(var(--agent-realtime-voice-glow-color) / 10%);
226
+ }
51
227
 
52
- to {
53
- background-position: 14rem 0;
54
- }
228
+ @media (prefers-reduced-motion: reduce) {
229
+ .agent-realtime-voice-glow {
230
+ --agent-realtime-voice-angle: 35deg;
55
231
  }
56
232
  }