@cossistant/react 0.0.32 → 0.0.33

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 (111) hide show
  1. package/hooks/index.d.ts +2 -2
  2. package/hooks/index.js +2 -2
  3. package/hooks/private/use-grouped-messages.d.ts +27 -2
  4. package/hooks/private/use-grouped-messages.d.ts.map +1 -1
  5. package/hooks/private/use-grouped-messages.js +154 -106
  6. package/hooks/private/use-grouped-messages.js.map +1 -1
  7. package/hooks/use-new-message-sound.d.ts.map +1 -1
  8. package/hooks/use-new-message-sound.js +2 -2
  9. package/hooks/use-new-message-sound.js.map +1 -1
  10. package/hooks/use-typing-sound.d.ts.map +1 -1
  11. package/hooks/use-typing-sound.js +2 -2
  12. package/hooks/use-typing-sound.js.map +1 -1
  13. package/index.d.ts +2 -2
  14. package/index.js +2 -2
  15. package/package.json +3 -5
  16. package/packages/tiny-markdown/src/context/index.d.ts +1 -0
  17. package/packages/tiny-markdown/src/context/tiny-markdown-context.d.ts +3 -0
  18. package/packages/tiny-markdown/src/hooks/index.d.ts +4 -0
  19. package/packages/tiny-markdown/src/hooks/use-caret-position.d.ts +1 -0
  20. package/packages/tiny-markdown/src/hooks/use-tiny-markdown.d.ts +1 -0
  21. package/packages/tiny-markdown/src/hooks/use-tiny-mention.d.ts +1 -0
  22. package/packages/tiny-markdown/src/hooks/use-tiny-shortcuts.d.ts +1 -0
  23. package/packages/tiny-markdown/src/index.d.ts +4 -0
  24. package/packages/tiny-markdown/src/types.d.ts +75 -0
  25. package/packages/tiny-markdown/src/types.d.ts.map +1 -0
  26. package/packages/tiny-markdown/src/utils/index.d.ts +3 -0
  27. package/packages/tiny-markdown/src/utils/markdown-parser.d.ts +1 -0
  28. package/packages/tiny-markdown/src/utils/mention-parser.d.ts +1 -0
  29. package/packages/tiny-markdown/src/utils/merge-refs.d.ts +1 -0
  30. package/packages/types/src/api/conversation.d.ts +304 -4
  31. package/packages/types/src/api/conversation.d.ts.map +1 -1
  32. package/packages/types/src/api/timeline-item.d.ts +228 -3
  33. package/packages/types/src/api/timeline-item.d.ts.map +1 -1
  34. package/packages/types/src/realtime-events.d.ts +229 -4
  35. package/packages/types/src/realtime-events.d.ts.map +1 -1
  36. package/packages/types/src/schemas.d.ts +76 -1
  37. package/packages/types/src/schemas.d.ts.map +1 -1
  38. package/primitives/command-block-utils.d.ts +26 -0
  39. package/primitives/command-block-utils.d.ts.map +1 -0
  40. package/primitives/command-block-utils.js +310 -0
  41. package/primitives/command-block-utils.js.map +1 -0
  42. package/primitives/index.d.ts +7 -3
  43. package/primitives/index.js +11 -2
  44. package/primitives/index.parts.d.ts +6 -2
  45. package/primitives/index.parts.js +5 -1
  46. package/primitives/multimodal-input.d.ts +2 -2
  47. package/primitives/multimodal-input.d.ts.map +1 -1
  48. package/primitives/timeline-code-block.d.ts +32 -0
  49. package/primitives/timeline-code-block.d.ts.map +1 -0
  50. package/primitives/timeline-code-block.js +66 -0
  51. package/primitives/timeline-code-block.js.map +1 -0
  52. package/primitives/timeline-command-block.d.ts +29 -0
  53. package/primitives/timeline-command-block.d.ts.map +1 -0
  54. package/primitives/timeline-command-block.js +97 -0
  55. package/primitives/timeline-command-block.js.map +1 -0
  56. package/primitives/timeline-item-group.d.ts.map +1 -1
  57. package/primitives/timeline-item-group.js +5 -15
  58. package/primitives/timeline-item-group.js.map +1 -1
  59. package/primitives/timeline-item.d.ts +21 -1
  60. package/primitives/timeline-item.d.ts.map +1 -1
  61. package/primitives/timeline-item.js +148 -83
  62. package/primitives/timeline-item.js.map +1 -1
  63. package/primitives/timeline-message-layout.d.ts +9 -0
  64. package/primitives/timeline-message-layout.d.ts.map +1 -0
  65. package/primitives/timeline-message-layout.js +20 -0
  66. package/primitives/timeline-message-layout.js.map +1 -0
  67. package/realtime/event-filter.js +4 -3
  68. package/realtime/event-filter.js.map +1 -1
  69. package/sounds/sound-data.d.ts +6 -0
  70. package/sounds/sound-data.d.ts.map +1 -0
  71. package/sounds/sound-data.js +7 -0
  72. package/sounds/sound-data.js.map +1 -0
  73. package/support/components/button.d.ts +2 -2
  74. package/support/components/button.d.ts.map +1 -1
  75. package/support/components/button.js +1 -0
  76. package/support/components/button.js.map +1 -1
  77. package/support/components/conversation-event.d.ts +3 -0
  78. package/support/components/conversation-event.d.ts.map +1 -1
  79. package/support/components/conversation-event.js +46 -15
  80. package/support/components/conversation-event.js.map +1 -1
  81. package/support/components/conversation-timeline.d.ts.map +1 -1
  82. package/support/components/conversation-timeline.js +12 -0
  83. package/support/components/conversation-timeline.js.map +1 -1
  84. package/support/components/index.d.ts +2 -1
  85. package/support/components/index.js +2 -1
  86. package/support/components/timeline-activity-group.d.ts +25 -0
  87. package/support/components/timeline-activity-group.d.ts.map +1 -0
  88. package/support/components/timeline-activity-group.js +104 -0
  89. package/support/components/timeline-activity-group.js.map +1 -0
  90. package/support/components/timeline-code-block.d.ts +14 -0
  91. package/support/components/timeline-code-block.d.ts.map +1 -0
  92. package/support/components/timeline-code-block.js +44 -0
  93. package/support/components/timeline-code-block.js.map +1 -0
  94. package/support/components/timeline-command-block.d.ts +12 -0
  95. package/support/components/timeline-command-block.d.ts.map +1 -0
  96. package/support/components/timeline-command-block.js +42 -0
  97. package/support/components/timeline-command-block.js.map +1 -0
  98. package/support/components/timeline-message-item.d.ts +2 -1
  99. package/support/components/timeline-message-item.d.ts.map +1 -1
  100. package/support/components/timeline-message-item.js +23 -3
  101. package/support/components/timeline-message-item.js.map +1 -1
  102. package/support/index.d.ts +4 -4
  103. package/support/store/support-store.d.ts +5 -5
  104. package/utils/metadata-hash.d.ts +1 -1
  105. package/utils/metadata-hash.js +9 -4
  106. package/utils/metadata-hash.js.map +1 -1
  107. package/utils/timeline-item-sender.d.ts +17 -0
  108. package/utils/timeline-item-sender.d.ts.map +1 -0
  109. package/utils/timeline-item-sender.js +43 -0
  110. package/utils/timeline-item-sender.js.map +1 -0
  111. package/utils/use-render-element.d.ts.map +1 -1
@@ -0,0 +1,310 @@
1
+ //#region src/primitives/command-block-utils.ts
2
+ const COMMAND_PREFERENCE_STORAGE_KEY = "cossistant:package-manager";
3
+ const COMMAND_PREFERENCE_EVENT = "cossistant:package-manager-change";
4
+ const DEFAULT_PACKAGE_MANAGER = "npm";
5
+ const COMMAND_PACKAGE_MANAGERS = [
6
+ "npm",
7
+ "yarn",
8
+ "pnpm",
9
+ "bun"
10
+ ];
11
+ function isCommandPackageManager(value) {
12
+ return COMMAND_PACKAGE_MANAGERS.includes(value);
13
+ }
14
+ function normalizeInput(input) {
15
+ const normalized = input.replace(/\s+/g, " ").trim();
16
+ if (!normalized || normalized.includes("\n") || normalized.includes("\r")) return null;
17
+ return normalized;
18
+ }
19
+ function splitCommand(command) {
20
+ return command.split(/\s+/).filter(Boolean);
21
+ }
22
+ function joinArgs(tokens) {
23
+ if (tokens.length === 0) return null;
24
+ const args = tokens.join(" ").trim();
25
+ return args.length > 0 ? args : null;
26
+ }
27
+ function getNormalizedFromNpx(tokens) {
28
+ const firstArg = tokens[1];
29
+ if (!firstArg) return null;
30
+ if (firstArg.startsWith("create-")) {
31
+ const createdName = firstArg.slice(7);
32
+ if (!createdName) return null;
33
+ const args$1 = joinArgs([createdName, ...tokens.slice(2)]);
34
+ if (!args$1) return null;
35
+ return {
36
+ intent: "npx-create",
37
+ args: args$1
38
+ };
39
+ }
40
+ const args = joinArgs(tokens.slice(1));
41
+ if (!args) return null;
42
+ return {
43
+ intent: "exec",
44
+ args
45
+ };
46
+ }
47
+ function getNormalizedFromNpm(tokens) {
48
+ const action = tokens[1];
49
+ if (!action) return null;
50
+ if (action === "install") {
51
+ const args = joinArgs(tokens.slice(2));
52
+ return args ? {
53
+ intent: "install",
54
+ args
55
+ } : null;
56
+ }
57
+ if (action === "run") {
58
+ const args = joinArgs(tokens.slice(2));
59
+ return args ? {
60
+ intent: "run",
61
+ args
62
+ } : null;
63
+ }
64
+ if (action === "create") {
65
+ const args = joinArgs(tokens.slice(2));
66
+ return args ? {
67
+ intent: "create",
68
+ args
69
+ } : null;
70
+ }
71
+ return null;
72
+ }
73
+ function getNormalizedFromPnpm(tokens) {
74
+ const action = tokens[1];
75
+ if (!action) return null;
76
+ if (action === "add") {
77
+ const args = joinArgs(tokens.slice(2));
78
+ return args ? {
79
+ intent: "install",
80
+ args
81
+ } : null;
82
+ }
83
+ if (action === "run") {
84
+ const args = joinArgs(tokens.slice(2));
85
+ return args ? {
86
+ intent: "run",
87
+ args
88
+ } : null;
89
+ }
90
+ if (action === "create") {
91
+ const args = joinArgs(tokens.slice(2));
92
+ return args ? {
93
+ intent: "create",
94
+ args
95
+ } : null;
96
+ }
97
+ if (action === "dlx") {
98
+ const args = joinArgs(tokens.slice(2));
99
+ if (!args) return null;
100
+ if (tokens[2]?.startsWith("create-")) {
101
+ const createArgs = joinArgs([tokens[2].slice(7), ...tokens.slice(3)]);
102
+ return createArgs ? {
103
+ intent: "npx-create",
104
+ args: createArgs
105
+ } : null;
106
+ }
107
+ return {
108
+ intent: "exec",
109
+ args
110
+ };
111
+ }
112
+ if (action.startsWith("-")) return null;
113
+ const shorthandRunArgs = joinArgs(tokens.slice(1));
114
+ return shorthandRunArgs ? {
115
+ intent: "run",
116
+ args: shorthandRunArgs
117
+ } : null;
118
+ }
119
+ function getNormalizedFromYarn(tokens) {
120
+ const action = tokens[1];
121
+ if (!action) return null;
122
+ if (action === "add") {
123
+ const args = joinArgs(tokens.slice(2));
124
+ return args ? {
125
+ intent: "install",
126
+ args
127
+ } : null;
128
+ }
129
+ if (action === "run") {
130
+ const args = joinArgs(tokens.slice(2));
131
+ return args ? {
132
+ intent: "run",
133
+ args
134
+ } : null;
135
+ }
136
+ if (action === "create") {
137
+ const args = joinArgs(tokens.slice(2));
138
+ return args ? {
139
+ intent: "create",
140
+ args
141
+ } : null;
142
+ }
143
+ if (action === "dlx") {
144
+ const args = joinArgs(tokens.slice(2));
145
+ if (!args) return null;
146
+ if (tokens[2]?.startsWith("create-")) {
147
+ const createArgs = joinArgs([tokens[2].slice(7), ...tokens.slice(3)]);
148
+ return createArgs ? {
149
+ intent: "npx-create",
150
+ args: createArgs
151
+ } : null;
152
+ }
153
+ return {
154
+ intent: "exec",
155
+ args
156
+ };
157
+ }
158
+ if (action.startsWith("-")) return null;
159
+ const shorthandRunArgs = joinArgs(tokens.slice(1));
160
+ return shorthandRunArgs ? {
161
+ intent: "run",
162
+ args: shorthandRunArgs
163
+ } : null;
164
+ }
165
+ function getNormalizedFromBun(tokens) {
166
+ const action = tokens[1];
167
+ if (!action) return null;
168
+ if (action === "add") {
169
+ const args = joinArgs(tokens.slice(2));
170
+ return args ? {
171
+ intent: "install",
172
+ args
173
+ } : null;
174
+ }
175
+ if (action === "run") {
176
+ const args = joinArgs(tokens.slice(2));
177
+ return args ? {
178
+ intent: "run",
179
+ args
180
+ } : null;
181
+ }
182
+ if (action === "create") {
183
+ const args = joinArgs(tokens.slice(2));
184
+ return args ? {
185
+ intent: "create",
186
+ args
187
+ } : null;
188
+ }
189
+ if (action.startsWith("-")) return null;
190
+ const shorthandRunArgs = joinArgs(tokens.slice(1));
191
+ return shorthandRunArgs ? {
192
+ intent: "run",
193
+ args: shorthandRunArgs
194
+ } : null;
195
+ }
196
+ function getNormalizedFromBunx(tokens) {
197
+ let startIndex = 1;
198
+ if (tokens[1] === "--bun") startIndex = 2;
199
+ const firstArg = tokens[startIndex];
200
+ if (!firstArg) return null;
201
+ if (firstArg.startsWith("create-")) {
202
+ const createTarget = firstArg.slice(7);
203
+ if (!createTarget) return null;
204
+ const args$1 = joinArgs([createTarget, ...tokens.slice(startIndex + 1)]);
205
+ return args$1 ? {
206
+ intent: "npx-create",
207
+ args: args$1
208
+ } : null;
209
+ }
210
+ const args = joinArgs(tokens.slice(startIndex));
211
+ return args ? {
212
+ intent: "exec",
213
+ args
214
+ } : null;
215
+ }
216
+ function normalizeCommand(input) {
217
+ const normalizedInput = normalizeInput(input);
218
+ if (!normalizedInput) return null;
219
+ const tokens = splitCommand(normalizedInput);
220
+ const command = tokens[0];
221
+ if (!command) return null;
222
+ if (command === "npm") return getNormalizedFromNpm(tokens);
223
+ if (command === "npx") return getNormalizedFromNpx(tokens);
224
+ if (command === "pnpm") return getNormalizedFromPnpm(tokens);
225
+ if (command === "yarn") return getNormalizedFromYarn(tokens);
226
+ if (command === "bun") return getNormalizedFromBun(tokens);
227
+ if (command === "bunx") return getNormalizedFromBunx(tokens);
228
+ return null;
229
+ }
230
+ function toCommandVariants(command) {
231
+ switch (command.intent) {
232
+ case "install": return {
233
+ npm: `npm install ${command.args}`,
234
+ yarn: `yarn add ${command.args}`,
235
+ pnpm: `pnpm add ${command.args}`,
236
+ bun: `bun add ${command.args}`
237
+ };
238
+ case "run": return {
239
+ npm: `npm run ${command.args}`,
240
+ yarn: `yarn ${command.args}`,
241
+ pnpm: `pnpm ${command.args}`,
242
+ bun: `bun ${command.args}`
243
+ };
244
+ case "create": return {
245
+ npm: `npm create ${command.args}`,
246
+ yarn: `yarn create ${command.args}`,
247
+ pnpm: `pnpm create ${command.args}`,
248
+ bun: `bun create ${command.args}`
249
+ };
250
+ case "npx-create": return {
251
+ npm: `npx create-${command.args}`,
252
+ yarn: `yarn create ${command.args}`,
253
+ pnpm: `pnpm create ${command.args}`,
254
+ bun: `bunx --bun create-${command.args}`
255
+ };
256
+ case "exec": return {
257
+ npm: `npx ${command.args}`,
258
+ yarn: `yarn ${command.args}`,
259
+ pnpm: `pnpm dlx ${command.args}`,
260
+ bun: `bunx --bun ${command.args}`
261
+ };
262
+ default: {
263
+ const exhaustiveCheck = command.intent;
264
+ throw new Error(`Unhandled command intent: ${String(exhaustiveCheck)}`);
265
+ }
266
+ }
267
+ }
268
+ function mapCommandVariants(input) {
269
+ const normalizedCommand = normalizeCommand(input);
270
+ if (!normalizedCommand) return null;
271
+ return toCommandVariants(normalizedCommand);
272
+ }
273
+ function mapStandaloneInlineCommandFromParagraphChildren(children) {
274
+ let inlineCommand = null;
275
+ for (const child of children) {
276
+ if (child.type === "text" && child.content.trim().length === 0) continue;
277
+ if (child.type === "code" && child.inline) {
278
+ if (inlineCommand !== null) return null;
279
+ inlineCommand = child.content;
280
+ continue;
281
+ }
282
+ return null;
283
+ }
284
+ if (!inlineCommand) return null;
285
+ const variants = mapCommandVariants(inlineCommand);
286
+ if (!variants) return null;
287
+ return {
288
+ command: inlineCommand,
289
+ variants
290
+ };
291
+ }
292
+ function mapInlineCommandFromParagraphChildren(children) {
293
+ let inlineCommand = null;
294
+ for (const [index, child] of children.entries()) {
295
+ if (child.type !== "code" || !child.inline) continue;
296
+ const variants = mapCommandVariants(child.content);
297
+ if (!variants) continue;
298
+ if (inlineCommand) return null;
299
+ inlineCommand = {
300
+ command: child.content,
301
+ variants,
302
+ index
303
+ };
304
+ }
305
+ return inlineCommand;
306
+ }
307
+
308
+ //#endregion
309
+ export { COMMAND_PACKAGE_MANAGERS, COMMAND_PREFERENCE_EVENT, COMMAND_PREFERENCE_STORAGE_KEY, DEFAULT_PACKAGE_MANAGER, isCommandPackageManager, mapCommandVariants, mapInlineCommandFromParagraphChildren, mapStandaloneInlineCommandFromParagraphChildren };
310
+ //# sourceMappingURL=command-block-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-block-utils.js","names":["args","exhaustiveCheck: never","inlineCommand: string | null","inlineCommand: InlineParagraphCommand | null"],"sources":["../../src/primitives/command-block-utils.ts"],"sourcesContent":["import type { MarkdownToken } from \"@cossistant/tiny-markdown\";\n\nexport const COMMAND_PREFERENCE_STORAGE_KEY = \"cossistant:package-manager\";\nexport const COMMAND_PREFERENCE_EVENT = \"cossistant:package-manager-change\";\nexport const DEFAULT_PACKAGE_MANAGER = \"npm\" as const;\n\nexport const COMMAND_PACKAGE_MANAGERS = [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as const;\n\nexport type CommandPackageManager = (typeof COMMAND_PACKAGE_MANAGERS)[number];\n\nexport type CommandVariants = Record<CommandPackageManager, string>;\n\nexport function isCommandPackageManager(\n\tvalue: string\n): value is CommandPackageManager {\n\treturn (COMMAND_PACKAGE_MANAGERS as readonly string[]).includes(value);\n}\n\ntype CommandIntent = \"install\" | \"run\" | \"create\" | \"npx-create\" | \"exec\";\n\ntype NormalizedCommand = {\n\tintent: CommandIntent;\n\targs: string;\n};\n\nexport type StandaloneInlineCommand = {\n\tcommand: string;\n\tvariants: CommandVariants;\n};\n\nexport type InlineParagraphCommand = {\n\tcommand: string;\n\tvariants: CommandVariants;\n\tindex: number;\n};\n\nfunction normalizeInput(input: string): string | null {\n\tconst normalized = input.replace(/\\s+/g, \" \").trim();\n\tif (!normalized || normalized.includes(\"\\n\") || normalized.includes(\"\\r\")) {\n\t\treturn null;\n\t}\n\n\treturn normalized;\n}\n\nfunction splitCommand(command: string): string[] {\n\treturn command.split(/\\s+/).filter(Boolean);\n}\n\nfunction joinArgs(tokens: string[]): string | null {\n\tif (tokens.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst args = tokens.join(\" \").trim();\n\treturn args.length > 0 ? args : null;\n}\n\nfunction getNormalizedFromNpx(tokens: string[]): NormalizedCommand | null {\n\tconst firstArg = tokens[1];\n\tif (!firstArg) {\n\t\treturn null;\n\t}\n\n\tif (firstArg.startsWith(\"create-\")) {\n\t\tconst createdName = firstArg.slice(\"create-\".length);\n\t\tif (!createdName) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst args = joinArgs([createdName, ...tokens.slice(2)]);\n\t\tif (!args) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { intent: \"npx-create\", args };\n\t}\n\n\tconst args = joinArgs(tokens.slice(1));\n\tif (!args) {\n\t\treturn null;\n\t}\n\n\treturn { intent: \"exec\", args };\n}\n\nfunction getNormalizedFromNpm(tokens: string[]): NormalizedCommand | null {\n\tconst action = tokens[1];\n\tif (!action) {\n\t\treturn null;\n\t}\n\n\tif (action === \"install\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"install\", args } : null;\n\t}\n\n\tif (action === \"run\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"run\", args } : null;\n\t}\n\n\tif (action === \"create\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"create\", args } : null;\n\t}\n\n\treturn null;\n}\n\nfunction getNormalizedFromPnpm(tokens: string[]): NormalizedCommand | null {\n\tconst action = tokens[1];\n\tif (!action) {\n\t\treturn null;\n\t}\n\n\tif (action === \"add\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"install\", args } : null;\n\t}\n\n\tif (action === \"run\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"run\", args } : null;\n\t}\n\n\tif (action === \"create\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"create\", args } : null;\n\t}\n\n\tif (action === \"dlx\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\tif (!args) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (tokens[2]?.startsWith(\"create-\")) {\n\t\t\tconst createTarget = tokens[2].slice(\"create-\".length);\n\t\t\tconst createArgs = joinArgs([createTarget, ...tokens.slice(3)]);\n\t\t\treturn createArgs ? { intent: \"npx-create\", args: createArgs } : null;\n\t\t}\n\n\t\treturn { intent: \"exec\", args };\n\t}\n\n\tif (action.startsWith(\"-\")) {\n\t\treturn null;\n\t}\n\n\tconst shorthandRunArgs = joinArgs(tokens.slice(1));\n\treturn shorthandRunArgs ? { intent: \"run\", args: shorthandRunArgs } : null;\n}\n\nfunction getNormalizedFromYarn(tokens: string[]): NormalizedCommand | null {\n\tconst action = tokens[1];\n\tif (!action) {\n\t\treturn null;\n\t}\n\n\tif (action === \"add\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"install\", args } : null;\n\t}\n\n\tif (action === \"run\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"run\", args } : null;\n\t}\n\n\tif (action === \"create\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"create\", args } : null;\n\t}\n\n\tif (action === \"dlx\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\tif (!args) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (tokens[2]?.startsWith(\"create-\")) {\n\t\t\tconst createTarget = tokens[2].slice(\"create-\".length);\n\t\t\tconst createArgs = joinArgs([createTarget, ...tokens.slice(3)]);\n\t\t\treturn createArgs ? { intent: \"npx-create\", args: createArgs } : null;\n\t\t}\n\n\t\treturn { intent: \"exec\", args };\n\t}\n\n\tif (action.startsWith(\"-\")) {\n\t\treturn null;\n\t}\n\n\tconst shorthandRunArgs = joinArgs(tokens.slice(1));\n\treturn shorthandRunArgs ? { intent: \"run\", args: shorthandRunArgs } : null;\n}\n\nfunction getNormalizedFromBun(tokens: string[]): NormalizedCommand | null {\n\tconst action = tokens[1];\n\tif (!action) {\n\t\treturn null;\n\t}\n\n\tif (action === \"add\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"install\", args } : null;\n\t}\n\n\tif (action === \"run\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"run\", args } : null;\n\t}\n\n\tif (action === \"create\") {\n\t\tconst args = joinArgs(tokens.slice(2));\n\t\treturn args ? { intent: \"create\", args } : null;\n\t}\n\n\tif (action.startsWith(\"-\")) {\n\t\treturn null;\n\t}\n\n\tconst shorthandRunArgs = joinArgs(tokens.slice(1));\n\treturn shorthandRunArgs ? { intent: \"run\", args: shorthandRunArgs } : null;\n}\n\nfunction getNormalizedFromBunx(tokens: string[]): NormalizedCommand | null {\n\tlet startIndex = 1;\n\tif (tokens[1] === \"--bun\") {\n\t\tstartIndex = 2;\n\t}\n\n\tconst firstArg = tokens[startIndex];\n\tif (!firstArg) {\n\t\treturn null;\n\t}\n\n\tif (firstArg.startsWith(\"create-\")) {\n\t\tconst createTarget = firstArg.slice(\"create-\".length);\n\t\tif (!createTarget) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst args = joinArgs([createTarget, ...tokens.slice(startIndex + 1)]);\n\t\treturn args ? { intent: \"npx-create\", args } : null;\n\t}\n\n\tconst args = joinArgs(tokens.slice(startIndex));\n\treturn args ? { intent: \"exec\", args } : null;\n}\n\nfunction normalizeCommand(input: string): NormalizedCommand | null {\n\tconst normalizedInput = normalizeInput(input);\n\tif (!normalizedInput) {\n\t\treturn null;\n\t}\n\n\tconst tokens = splitCommand(normalizedInput);\n\tconst command = tokens[0];\n\tif (!command) {\n\t\treturn null;\n\t}\n\n\tif (command === \"npm\") {\n\t\treturn getNormalizedFromNpm(tokens);\n\t}\n\n\tif (command === \"npx\") {\n\t\treturn getNormalizedFromNpx(tokens);\n\t}\n\n\tif (command === \"pnpm\") {\n\t\treturn getNormalizedFromPnpm(tokens);\n\t}\n\n\tif (command === \"yarn\") {\n\t\treturn getNormalizedFromYarn(tokens);\n\t}\n\n\tif (command === \"bun\") {\n\t\treturn getNormalizedFromBun(tokens);\n\t}\n\n\tif (command === \"bunx\") {\n\t\treturn getNormalizedFromBunx(tokens);\n\t}\n\n\treturn null;\n}\n\nfunction toCommandVariants(command: NormalizedCommand): CommandVariants {\n\tswitch (command.intent) {\n\t\tcase \"install\":\n\t\t\treturn {\n\t\t\t\tnpm: `npm install ${command.args}`,\n\t\t\t\tyarn: `yarn add ${command.args}`,\n\t\t\t\tpnpm: `pnpm add ${command.args}`,\n\t\t\t\tbun: `bun add ${command.args}`,\n\t\t\t};\n\t\tcase \"run\":\n\t\t\treturn {\n\t\t\t\tnpm: `npm run ${command.args}`,\n\t\t\t\tyarn: `yarn ${command.args}`,\n\t\t\t\tpnpm: `pnpm ${command.args}`,\n\t\t\t\tbun: `bun ${command.args}`,\n\t\t\t};\n\t\tcase \"create\":\n\t\t\treturn {\n\t\t\t\tnpm: `npm create ${command.args}`,\n\t\t\t\tyarn: `yarn create ${command.args}`,\n\t\t\t\tpnpm: `pnpm create ${command.args}`,\n\t\t\t\tbun: `bun create ${command.args}`,\n\t\t\t};\n\t\tcase \"npx-create\":\n\t\t\treturn {\n\t\t\t\tnpm: `npx create-${command.args}`,\n\t\t\t\tyarn: `yarn create ${command.args}`,\n\t\t\t\tpnpm: `pnpm create ${command.args}`,\n\t\t\t\tbun: `bunx --bun create-${command.args}`,\n\t\t\t};\n\t\tcase \"exec\":\n\t\t\treturn {\n\t\t\t\tnpm: `npx ${command.args}`,\n\t\t\t\tyarn: `yarn ${command.args}`,\n\t\t\t\tpnpm: `pnpm dlx ${command.args}`,\n\t\t\t\tbun: `bunx --bun ${command.args}`,\n\t\t\t};\n\t\tdefault: {\n\t\t\tconst exhaustiveCheck: never = command.intent;\n\t\t\tthrow new Error(`Unhandled command intent: ${String(exhaustiveCheck)}`);\n\t\t}\n\t}\n}\n\nexport function mapCommandVariants(input: string): CommandVariants | null {\n\tconst normalizedCommand = normalizeCommand(input);\n\tif (!normalizedCommand) {\n\t\treturn null;\n\t}\n\n\treturn toCommandVariants(normalizedCommand);\n}\n\nexport function mapStandaloneInlineCommandFromParagraphChildren(\n\tchildren: MarkdownToken[]\n): StandaloneInlineCommand | null {\n\tlet inlineCommand: string | null = null;\n\n\tfor (const child of children) {\n\t\tif (child.type === \"text\" && child.content.trim().length === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (child.type === \"code\" && child.inline) {\n\t\t\tif (inlineCommand !== null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tinlineCommand = child.content;\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif (!inlineCommand) {\n\t\treturn null;\n\t}\n\n\tconst variants = mapCommandVariants(inlineCommand);\n\tif (!variants) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tcommand: inlineCommand,\n\t\tvariants,\n\t};\n}\n\nexport function mapInlineCommandFromParagraphChildren(\n\tchildren: MarkdownToken[]\n): InlineParagraphCommand | null {\n\tlet inlineCommand: InlineParagraphCommand | null = null;\n\n\tfor (const [index, child] of children.entries()) {\n\t\tif (child.type !== \"code\" || !child.inline) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst variants = mapCommandVariants(child.content);\n\t\tif (!variants) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (inlineCommand) {\n\t\t\treturn null;\n\t\t}\n\n\t\tinlineCommand = {\n\t\t\tcommand: child.content,\n\t\t\tvariants,\n\t\t\tindex,\n\t\t};\n\t}\n\n\treturn inlineCommand;\n}\n"],"mappings":";AAEA,MAAa,iCAAiC;AAC9C,MAAa,2BAA2B;AACxC,MAAa,0BAA0B;AAEvC,MAAa,2BAA2B;CAAC;CAAO;CAAQ;CAAQ;CAAM;AAMtE,SAAgB,wBACf,OACiC;AACjC,QAAQ,yBAA+C,SAAS,MAAM;;AAqBvE,SAAS,eAAe,OAA8B;CACrD,MAAM,aAAa,MAAM,QAAQ,QAAQ,IAAI,CAAC,MAAM;AACpD,KAAI,CAAC,cAAc,WAAW,SAAS,KAAK,IAAI,WAAW,SAAS,KAAK,CACxE,QAAO;AAGR,QAAO;;AAGR,SAAS,aAAa,SAA2B;AAChD,QAAO,QAAQ,MAAM,MAAM,CAAC,OAAO,QAAQ;;AAG5C,SAAS,SAAS,QAAiC;AAClD,KAAI,OAAO,WAAW,EACrB,QAAO;CAGR,MAAM,OAAO,OAAO,KAAK,IAAI,CAAC,MAAM;AACpC,QAAO,KAAK,SAAS,IAAI,OAAO;;AAGjC,SAAS,qBAAqB,QAA4C;CACzE,MAAM,WAAW,OAAO;AACxB,KAAI,CAAC,SACJ,QAAO;AAGR,KAAI,SAAS,WAAW,UAAU,EAAE;EACnC,MAAM,cAAc,SAAS,MAAM,EAAiB;AACpD,MAAI,CAAC,YACJ,QAAO;EAGR,MAAMA,SAAO,SAAS,CAAC,aAAa,GAAG,OAAO,MAAM,EAAE,CAAC,CAAC;AACxD,MAAI,CAACA,OACJ,QAAO;AAGR,SAAO;GAAE,QAAQ;GAAc;GAAM;;CAGtC,MAAM,OAAO,SAAS,OAAO,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BAAkB;;AAG5C,SAAgB,gDACf,UACiC;CACjC,IAAIC,gBAA+B;AAEnC,MAAK,MAAM,SAAS,UAAU;AAC7B,MAAI,MAAM,SAAS,UAAU,MAAM,QAAQ,MAAM,CAAC,WAAW,EAC5D;AAGD,MAAI,MAAM,SAAS,UAAU,MAAM,QAAQ;AAC1C,OAAI,kBAAkB,KACrB,QAAO;AAGR,mBAAgB,MAAM;AACtB;;AAGD,SAAO;;AAGR,KAAI,CAAC,cACJ,QAAO;CAGR,MAAM,WAAW,mBAAmB,cAAc;AAClD,KAAI,CAAC,SACJ,QAAO;AAGR,QAAO;EACN,SAAS;EACT;EACA;;AAGF,SAAgB,sCACf,UACgC;CAChC,IAAIC,gBAA+C;AAEnD,MAAK,MAAM,CAAC,OAAO,UAAU,SAAS,SAAS,EAAE;AAChD,MAAI,MAAM,SAAS,UAAU,CAAC,MAAM,OACnC;EAGD,MAAM,WAAW,mBAAmB,MAAM,QAAQ;AAClD,MAAI,CAAC,SACJ;AAGD,MAAI,cACH,QAAO;AAGR,kBAAgB;GACf,SAAS,MAAM;GACf;GACA;GACA;;AAGF,QAAO"}
@@ -4,21 +4,25 @@ import { Avatar } from "./avatar/avatar.js";
4
4
  import { AvatarFallback } from "./avatar/fallback.js";
5
5
  import { AvatarImage } from "./avatar/image.js";
6
6
  import { Button } from "./button.js";
7
+ import { CommandPackageManager, CommandVariants, DEFAULT_PACKAGE_MANAGER, mapCommandVariants } from "./command-block-utils.js";
7
8
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
8
9
  import { DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, defaultFormatDate } from "./day-separator.js";
9
10
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
11
  import { PageDefinition, Router, RouterProps } from "./router.js";
11
- import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
12
+ import { TimelineCodeBlock, TimelineCodeBlockProps } from "./timeline-code-block.js";
13
+ import { TimelineCommandBlock, TimelineCommandBlockProps } from "./timeline-command-block.js";
14
+ import { TimelineItem, TimelineItemContent, TimelineItemContentMarkdownRenderers, TimelineItemTimestamp } from "./timeline-item.js";
12
15
  import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
13
16
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
17
+ import { hasExpandedTimelineContent } from "./timeline-message-layout.js";
14
18
  import { SupportTrigger, TriggerProps, TriggerRenderProps } from "./trigger.js";
15
19
  import { SupportWindow } from "./window.js";
16
20
  import "./index.parts.js";
17
21
 
18
22
  //#region src/primitives/index.d.ts
19
23
  declare namespace index_d_exports {
20
- export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments };
24
+ export { Avatar, AvatarFallback, AvatarImage, Button, CommandPackageManager, CommandVariants, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DEFAULT_PACKAGE_MANAGER, DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineCodeBlock, TimelineCodeBlockProps, TimelineCommandBlock, TimelineCommandBlockProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemContentMarkdownRenderers, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, hasExpandedTimelineContent, mapCommandVariants };
21
25
  }
22
26
  //#endregion
23
- export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, index_d_exports };
27
+ export { Avatar, AvatarFallback, AvatarImage, Button, CommandPackageManager, CommandVariants, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DEFAULT_PACKAGE_MANAGER, DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineCodeBlock, TimelineCodeBlockProps, TimelineCommandBlock, TimelineCommandBlockProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemContentMarkdownRenderers, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, hasExpandedTimelineContent, index_d_exports, mapCommandVariants };
24
28
  //# sourceMappingURL=index.d.ts.map
@@ -5,13 +5,17 @@ import { AvatarImage } from "./avatar/image.js";
5
5
  import { TypingIndicator } from "../support/components/typing-indicator.js";
6
6
  import { SupportConfig } from "../support-config.js";
7
7
  import { Button } from "./button.js";
8
+ import { DEFAULT_PACKAGE_MANAGER, mapCommandVariants } from "./command-block-utils.js";
8
9
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
10
  import { DaySeparator, DaySeparatorLabel, DaySeparatorLine, defaultFormatDate } from "./day-separator.js";
10
11
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
11
12
  import { Router } from "./router.js";
13
+ import { TimelineCodeBlock } from "./timeline-code-block.js";
14
+ import { TimelineCommandBlock } from "./timeline-command-block.js";
12
15
  import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
13
16
  import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
14
17
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
18
+ import { hasExpandedTimelineContent } from "./timeline-message-layout.js";
15
19
  import { SupportTrigger } from "./trigger.js";
16
20
  import { SupportWindow } from "./window.js";
17
21
 
@@ -26,6 +30,7 @@ var primitives_exports = /* @__PURE__ */ __export({
26
30
  ConversationTimelineContainer: () => ConversationTimelineContainer,
27
31
  ConversationTimelineEmpty: () => ConversationTimelineEmpty,
28
32
  ConversationTimelineLoading: () => ConversationTimelineLoading,
33
+ DEFAULT_PACKAGE_MANAGER: () => DEFAULT_PACKAGE_MANAGER,
29
34
  DaySeparator: () => DaySeparator,
30
35
  DaySeparatorLabel: () => DaySeparatorLabel,
31
36
  DaySeparatorLine: () => DaySeparatorLine,
@@ -33,6 +38,8 @@ var primitives_exports = /* @__PURE__ */ __export({
33
38
  Input: () => SupportInput,
34
39
  MultimodalInput: () => MultimodalInput,
35
40
  Router: () => Router,
41
+ TimelineCodeBlock: () => TimelineCodeBlock,
42
+ TimelineCommandBlock: () => TimelineCommandBlock,
36
43
  TimelineItem: () => TimelineItem,
37
44
  TimelineItemAttachments: () => TimelineItemAttachments,
38
45
  TimelineItemContent: () => TimelineItemContent,
@@ -51,9 +58,11 @@ var primitives_exports = /* @__PURE__ */ __export({
51
58
  defaultFormatDate: () => defaultFormatDate,
52
59
  extractFileParts: () => extractFileParts,
53
60
  extractImageParts: () => extractImageParts,
54
- hasAttachments: () => hasAttachments
61
+ hasAttachments: () => hasAttachments,
62
+ hasExpandedTimelineContent: () => hasExpandedTimelineContent,
63
+ mapCommandVariants: () => mapCommandVariants
55
64
  });
56
65
 
57
66
  //#endregion
58
- export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DaySeparator, DaySeparatorLabel, DaySeparatorLine, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TypingIndicator, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, primitives_exports };
67
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DEFAULT_PACKAGE_MANAGER, DaySeparator, DaySeparatorLabel, DaySeparatorLine, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineCodeBlock, TimelineCommandBlock, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TypingIndicator, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, hasExpandedTimelineContent, mapCommandVariants, primitives_exports };
59
68
  //# sourceMappingURL=index.js.map
@@ -5,13 +5,17 @@ import { AvatarFallback } from "./avatar/fallback.js";
5
5
  import { AvatarImage } from "./avatar/image.js";
6
6
  import "./avatar/index.js";
7
7
  import { Button } from "./button.js";
8
+ import { CommandPackageManager, CommandVariants, DEFAULT_PACKAGE_MANAGER, mapCommandVariants } from "./command-block-utils.js";
8
9
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
10
  import { DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, defaultFormatDate } from "./day-separator.js";
10
11
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
11
12
  import { PageDefinition, Router, RouterProps } from "./router.js";
12
- import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
13
+ import { TimelineCodeBlock, TimelineCodeBlockProps } from "./timeline-code-block.js";
14
+ import { TimelineCommandBlock, TimelineCommandBlockProps } from "./timeline-command-block.js";
15
+ import { TimelineItem, TimelineItemContent, TimelineItemContentMarkdownRenderers, TimelineItemTimestamp } from "./timeline-item.js";
13
16
  import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
14
17
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
18
+ import { hasExpandedTimelineContent } from "./timeline-message-layout.js";
15
19
  import { SupportTrigger, TriggerProps, TriggerRenderProps } from "./trigger.js";
16
20
  import { SupportWindow } from "./window.js";
17
- export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DaySeparator, DaySeparatorLabel, type DaySeparatorLabelProps, DaySeparatorLine, type DaySeparatorLineProps, type DaySeparatorProps, type DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, type PageDefinition, Router, type RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, type TriggerProps, type TriggerRenderProps, TypingIndicator, type TypingIndicatorProps, type TypingParticipant, type TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments };
21
+ export { Avatar, AvatarFallback, AvatarImage, Button, type CommandPackageManager, type CommandVariants, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DEFAULT_PACKAGE_MANAGER, DaySeparator, DaySeparatorLabel, type DaySeparatorLabelProps, DaySeparatorLine, type DaySeparatorLineProps, type DaySeparatorProps, type DaySeparatorRenderProps, FileInput, SupportInput as Input, MultimodalInput, type PageDefinition, Router, type RouterProps, TimelineCodeBlock, type TimelineCodeBlockProps, TimelineCommandBlock, type TimelineCommandBlockProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, type TimelineItemContentMarkdownRenderers, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, type TriggerProps, type TriggerRenderProps, TypingIndicator, type TypingIndicatorProps, type TypingParticipant, type TypingParticipantType, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, hasExpandedTimelineContent, mapCommandVariants };
@@ -4,14 +4,18 @@ import { AvatarImage } from "./avatar/image.js";
4
4
  import { TypingIndicator } from "../support/components/typing-indicator.js";
5
5
  import { SupportConfig } from "../support-config.js";
6
6
  import { Button } from "./button.js";
7
+ import { DEFAULT_PACKAGE_MANAGER, mapCommandVariants } from "./command-block-utils.js";
7
8
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
8
9
  import { DaySeparator, DaySeparatorLabel, DaySeparatorLine, defaultFormatDate } from "./day-separator.js";
9
10
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
11
  import { Router } from "./router.js";
12
+ import { TimelineCodeBlock } from "./timeline-code-block.js";
13
+ import { TimelineCommandBlock } from "./timeline-command-block.js";
11
14
  import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
12
15
  import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
13
16
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
17
+ import { hasExpandedTimelineContent } from "./timeline-message-layout.js";
14
18
  import { SupportTrigger } from "./trigger.js";
15
19
  import { SupportWindow } from "./window.js";
16
20
 
17
- export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DaySeparator, DaySeparatorLabel, DaySeparatorLine, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TypingIndicator, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments };
21
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, DEFAULT_PACKAGE_MANAGER, DaySeparator, DaySeparatorLabel, DaySeparatorLine, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineCodeBlock, TimelineCommandBlock, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TypingIndicator, SupportWindow as Window, defaultFormatDate, extractFileParts, extractImageParts, hasAttachments, hasExpandedTimelineContent, mapCommandVariants };
@@ -16,7 +16,7 @@ type MultimodalInputProps = Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElem
16
16
  * clipboard uploads and auto-resizing while remaining composable via
17
17
  * `asChild`.
18
18
  */
19
- declare const MultimodalInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "value"> & {
19
+ declare const MultimodalInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
20
20
  value: string;
21
21
  onChange: (value: string) => void;
22
22
  onSubmit?: () => void;
@@ -38,7 +38,7 @@ declare const FileInput: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttr
38
38
  onFileSelect?: (files: File[]) => void;
39
39
  asChild?: boolean;
40
40
  } & React$1.RefAttributes<HTMLInputElement>>;
41
- declare const SupportInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "value"> & {
41
+ declare const SupportInput: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "onChange"> & {
42
42
  value: string;
43
43
  onChange: (value: string) => void;
44
44
  onSubmit?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"multimodal-input.d.ts","names":[],"sources":["../../src/primitives/multimodal-input.tsx"],"sourcesContent":[],"mappings":";;;KAGY,oBAAA,GAAuB,KAClC,OAAA,CAAM,uBAAuB;;EADlB,QAAA,EAAA,CAAA,KAAA,EAAA,MAAoB,EAAA,GAAA,IAAA;EACF,QAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAA7B,YAAM,CAAA,EAAA,CAAA,KAAA,EAMiB,IANjB,EAAA,EAAA,GAAA,IAAA;EAD4B,OAAA,CAAA,EAAA,OAAA;EAOX,SAAA,CAAA,EAAA,MAAA;EAGf,KAAA,CAAA,EAAA,KAAA,GAAA,IAAA;EAAK,QAAA,CAAA,EAAA,OAAA;AASd,CAAA;;;;;;cAAa,iBAA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,yBAnKhB,CAmKgB,IAnKhB,CAmKgB,OAAA,CAAA,sBAnKhB,CAmKgB,mBAnKhB,CAAA,EAAA,OAAA,GAAA,UAAA,CAAA,GAAA;;;EAmKgB,QAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAAA,YAAA,CAAA,EAAA,CAAA,KAAA,EAtKD,IAsKC,EAAA,EAAA,GAAA,IAAA;;;UAnKhB"}
@@ -0,0 +1,32 @@
1
+ import * as React$1 from "react";
2
+
3
+ //#region src/primitives/timeline-code-block.d.ts
4
+ type TimelineCodeBlockRenderState = {
5
+ code: string;
6
+ language?: string;
7
+ languageLabel: string;
8
+ codeClassName?: string;
9
+ fileName?: string;
10
+ hasCopied: boolean;
11
+ onCopy: () => Promise<boolean>;
12
+ };
13
+ type TimelineCodeBlockProps = {
14
+ code: string;
15
+ language?: string;
16
+ fileName?: string;
17
+ className?: string;
18
+ children?: (state: TimelineCodeBlockRenderState) => React$1.ReactNode;
19
+ };
20
+ /**
21
+ * Shared timeline code block UI with filename/language metadata and copy action.
22
+ */
23
+ declare function TimelineCodeBlock({
24
+ code,
25
+ language,
26
+ fileName,
27
+ className,
28
+ children
29
+ }: TimelineCodeBlockProps): React$1.ReactElement;
30
+ //#endregion
31
+ export { TimelineCodeBlock, TimelineCodeBlockProps, TimelineCodeBlockRenderState };
32
+ //# sourceMappingURL=timeline-code-block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-code-block.d.ts","names":[],"sources":["../../src/primitives/timeline-code-block.tsx"],"sourcesContent":[],"mappings":";;;KAEY,4BAAA;;EAAA,QAAA,CAAA,EAAA,MAAA;EAUA,aAAA,EAAA,MAAA;EAgCI,aAAA,CAAA,EAAA,MAAiB;EAChC,QAAA,CAAA,EAAA,MAAA;EACA,SAAA,EAAA,OAAA;EACA,MAAA,EAAA,GAAA,GAtCc,OAsCd,CAAA,OAAA,CAAA;CACA;AACA,KArCW,sBAAA,GAqCX;EACE,IAAA,EAAA,MAAA;EAAyB,QAAM,CAAA,EAAA,MAAA;EAAY,QAAA,CAAA,EAAA,MAAA;;qBAjC1B,iCAAiC,OAAA,CAAM;;;;;iBA2B3C,iBAAA;;;;;;GAMb,yBAAyB,OAAA,CAAM"}
@@ -0,0 +1,66 @@
1
+ import * as React$1 from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+
4
+ //#region src/primitives/timeline-code-block.tsx
5
+ function getLanguageLabel(language) {
6
+ if (!language) return "TEXT";
7
+ return language.toUpperCase();
8
+ }
9
+ async function copyToClipboard(value) {
10
+ if (typeof navigator === "undefined" || !navigator.clipboard) return false;
11
+ try {
12
+ await navigator.clipboard.writeText(value);
13
+ return true;
14
+ } catch {
15
+ return false;
16
+ }
17
+ }
18
+ /**
19
+ * Shared timeline code block UI with filename/language metadata and copy action.
20
+ */
21
+ function TimelineCodeBlock({ code, language, fileName, className, children }) {
22
+ const [hasCopied, setHasCopied] = React$1.useState(false);
23
+ React$1.useEffect(() => {
24
+ if (!hasCopied) return;
25
+ const timer = window.setTimeout(() => {
26
+ setHasCopied(false);
27
+ }, 1800);
28
+ return () => {
29
+ window.clearTimeout(timer);
30
+ };
31
+ }, [hasCopied]);
32
+ const codeClassName = language ? `language-${language}` : void 0;
33
+ const languageLabel = getLanguageLabel(language);
34
+ const onCopy = React$1.useCallback(async () => {
35
+ const didCopy = await copyToClipboard(code);
36
+ if (didCopy) setHasCopied(true);
37
+ return didCopy;
38
+ }, [code]);
39
+ const renderState = {
40
+ code,
41
+ language,
42
+ languageLabel,
43
+ codeClassName,
44
+ fileName,
45
+ hasCopied,
46
+ onCopy
47
+ };
48
+ return /* @__PURE__ */ jsx("div", {
49
+ className,
50
+ "data-co-code-block": "",
51
+ children: typeof children === "function" ? children(renderState) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", { children: [fileName ? /* @__PURE__ */ jsx("span", { children: fileName }) : null, /* @__PURE__ */ jsx("span", { children: languageLabel })] }), /* @__PURE__ */ jsx("button", {
52
+ onClick: () => {
53
+ onCopy();
54
+ },
55
+ type: "button",
56
+ children: hasCopied ? "Copied" : "Copy"
57
+ })] }), /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", {
58
+ className: codeClassName,
59
+ children: code
60
+ }) })] })
61
+ });
62
+ }
63
+
64
+ //#endregion
65
+ export { TimelineCodeBlock };
66
+ //# sourceMappingURL=timeline-code-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-code-block.js","names":["React","renderState: TimelineCodeBlockRenderState"],"sources":["../../src/primitives/timeline-code-block.tsx"],"sourcesContent":["import * as React from \"react\";\n\nexport type TimelineCodeBlockRenderState = {\n\tcode: string;\n\tlanguage?: string;\n\tlanguageLabel: string;\n\tcodeClassName?: string;\n\tfileName?: string;\n\thasCopied: boolean;\n\tonCopy: () => Promise<boolean>;\n};\n\nexport type TimelineCodeBlockProps = {\n\tcode: string;\n\tlanguage?: string;\n\tfileName?: string;\n\tclassName?: string;\n\tchildren?: (state: TimelineCodeBlockRenderState) => React.ReactNode;\n};\n\nfunction getLanguageLabel(language?: string): string {\n\tif (!language) {\n\t\treturn \"TEXT\";\n\t}\n\n\treturn language.toUpperCase();\n}\n\nasync function copyToClipboard(value: string): Promise<boolean> {\n\tif (typeof navigator === \"undefined\" || !navigator.clipboard) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tawait navigator.clipboard.writeText(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Shared timeline code block UI with filename/language metadata and copy action.\n */\nexport function TimelineCodeBlock({\n\tcode,\n\tlanguage,\n\tfileName,\n\tclassName,\n\tchildren,\n}: TimelineCodeBlockProps): React.ReactElement {\n\tconst [hasCopied, setHasCopied] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tif (!hasCopied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = window.setTimeout(() => {\n\t\t\tsetHasCopied(false);\n\t\t}, 1800);\n\n\t\treturn () => {\n\t\t\twindow.clearTimeout(timer);\n\t\t};\n\t}, [hasCopied]);\n\n\tconst codeClassName = language ? `language-${language}` : undefined;\n\tconst languageLabel = getLanguageLabel(language);\n\n\tconst onCopy = React.useCallback(async () => {\n\t\tconst didCopy = await copyToClipboard(code);\n\t\tif (didCopy) {\n\t\t\tsetHasCopied(true);\n\t\t}\n\n\t\treturn didCopy;\n\t}, [code]);\n\n\tconst renderState: TimelineCodeBlockRenderState = {\n\t\tcode,\n\t\tlanguage,\n\t\tlanguageLabel,\n\t\tcodeClassName,\n\t\tfileName,\n\t\thasCopied,\n\t\tonCopy,\n\t};\n\n\treturn (\n\t\t<div className={className} data-co-code-block=\"\">\n\t\t\t{typeof children === \"function\" ? (\n\t\t\t\tchildren(renderState)\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{fileName ? <span>{fileName}</span> : null}\n\t\t\t\t\t\t\t<span>{languageLabel}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tvoid onCopy();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{hasCopied ? \"Copied\" : \"Copy\"}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<pre>\n\t\t\t\t\t\t<code className={codeClassName}>{code}</code>\n\t\t\t\t\t</pre>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAoBA,SAAS,iBAAiB,UAA2B;AACpD,KAAI,CAAC,SACJ,QAAO;AAGR,QAAO,SAAS,aAAa;;AAG9B,eAAe,gBAAgB,OAAiC;AAC/D,KAAI,OAAO,cAAc,eAAe,CAAC,UAAU,UAClD,QAAO;AAGR,KAAI;AACH,QAAM,UAAU,UAAU,UAAU,MAAM;AAC1C,SAAO;SACA;AACP,SAAO;;;;;;AAOT,SAAgB,kBAAkB,EACjC,MACA,UACA,UACA,WACA,YAC8C;CAC9C,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,MAAM;AAEvD,SAAM,gBAAgB;AACrB,MAAI,CAAC,UACJ;EAGD,MAAM,QAAQ,OAAO,iBAAiB;AACrC,gBAAa,MAAM;KACjB,KAAK;AAER,eAAa;AACZ,UAAO,aAAa,MAAM;;IAEzB,CAAC,UAAU,CAAC;CAEf,MAAM,gBAAgB,WAAW,YAAY,aAAa;CAC1D,MAAM,gBAAgB,iBAAiB,SAAS;CAEhD,MAAM,SAASA,QAAM,YAAY,YAAY;EAC5C,MAAM,UAAU,MAAM,gBAAgB,KAAK;AAC3C,MAAI,QACH,cAAa,KAAK;AAGnB,SAAO;IACL,CAAC,KAAK,CAAC;CAEV,MAAMC,cAA4C;EACjD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAED,QACC,oBAAC;EAAe;EAAW,sBAAmB;YAC5C,OAAO,aAAa,aACpB,SAAS,YAAY,GAErB,4CACC,qBAAC,oBACA,qBAAC,oBACC,WAAW,oBAAC,oBAAM,WAAgB,GAAG,MACtC,oBAAC,oBAAM,gBAAqB,IACvB,EACN,oBAAC;GACA,eAAe;AACd,IAAK,QAAQ;;GAEd,MAAK;aAEJ,YAAY,WAAW;IAChB,IACJ,EAEN,oBAAC,mBACA,oBAAC;GAAK,WAAW;aAAgB;IAAY,GACxC,IACJ;GAEC"}
@@ -0,0 +1,29 @@
1
+ import { CommandPackageManager, CommandVariants } from "./command-block-utils.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/timeline-command-block.d.ts
5
+ type TimelineCommandBlockRenderState = {
6
+ commands: CommandVariants;
7
+ packageManagers: readonly CommandPackageManager[];
8
+ activePackageManager: CommandPackageManager;
9
+ activeCommand: string;
10
+ setPackageManager: (packageManager: CommandPackageManager) => void;
11
+ hasCopied: boolean;
12
+ onCopy: () => Promise<boolean>;
13
+ };
14
+ type TimelineCommandBlockProps = {
15
+ commands: CommandVariants;
16
+ className?: string;
17
+ children?: (state: TimelineCommandBlockRenderState) => React$1.ReactNode;
18
+ };
19
+ /**
20
+ * Shared command block UI with package-manager tabs and copy action.
21
+ */
22
+ declare function TimelineCommandBlock({
23
+ commands,
24
+ className,
25
+ children
26
+ }: TimelineCommandBlockProps): React$1.ReactElement;
27
+ //#endregion
28
+ export { TimelineCommandBlock, TimelineCommandBlockProps, TimelineCommandBlockRenderState };
29
+ //# sourceMappingURL=timeline-command-block.d.ts.map