@volter-ai-dev/supercode-ui 0.1.18 → 0.1.21
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/README.md +9 -0
- package/components.mjs +602 -348
- package/composer.mjs +209 -34
- package/controller.mjs +21 -2
- package/conversation.mjs +226 -201
- package/core.mjs +13 -1
- package/embed.mjs +604 -350
- package/icon.mjs +6 -0
- package/index.d.ts +17 -4
- package/messenger.mjs +602 -348
- package/package.json +1 -1
- package/sessions.mjs +47 -37
- package/styles.css +5 -1
package/icon.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/icon.jsx
|
|
2
2
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
3
3
|
var ICONS = {
|
|
4
|
+
attach: () => /* @__PURE__ */ jsx("path", { d: "M6.25 9.75 10.6 5.4a2.1 2.1 0 0 1 2.97 2.97l-5.4 5.4a3.3 3.3 0 0 1-4.67-4.66l5.52-5.52" }),
|
|
4
5
|
back: () => /* @__PURE__ */ jsx("path", { d: "m11.5 4.5-4.5 4.5 4.5 4.5" }),
|
|
5
6
|
check: () => /* @__PURE__ */ jsx("path", { d: "m4 9 3.25 3.25L14 5.5" }),
|
|
6
7
|
chevron: () => /* @__PURE__ */ jsx("path", { d: "m7 4.5 4.5 4.5L7 13.5" }),
|
|
@@ -16,6 +17,11 @@ var ICONS = {
|
|
|
16
17
|
/* @__PURE__ */ jsx("path", { d: "M9 3.5v10" }),
|
|
17
18
|
/* @__PURE__ */ jsx("path", { d: "m4.75 9.5 4.25 4 4.25-4" })
|
|
18
19
|
] }),
|
|
20
|
+
image: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3.5", width: "12", height: "11", rx: "1.75" }),
|
|
22
|
+
/* @__PURE__ */ jsx("circle", { cx: "6.5", cy: "7", r: "1.25" }),
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: "m4.5 13 3.25-3 2.1 1.85 1.65-1.5L14 13" })
|
|
24
|
+
] }),
|
|
19
25
|
menu: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
26
|
/* @__PURE__ */ jsx("circle", { cx: "4", cy: "9", r: "1.25", fill: "currentColor", stroke: "none" }),
|
|
21
27
|
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "9", r: "1.25", fill: "currentColor", stroke: "none" }),
|
package/index.d.ts
CHANGED
|
@@ -46,6 +46,14 @@ export interface TranscriptContext {
|
|
|
46
46
|
detail: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export interface TranscriptImage {
|
|
50
|
+
id?: string;
|
|
51
|
+
label: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type TranscriptAttachment = TranscriptContext | (TranscriptImage & { url: string });
|
|
56
|
+
|
|
49
57
|
export interface RequestOption {
|
|
50
58
|
optionId: string;
|
|
51
59
|
name: string;
|
|
@@ -78,6 +86,7 @@ export interface TranscriptEntryModel {
|
|
|
78
86
|
request?: TranscriptRequest;
|
|
79
87
|
code?: string;
|
|
80
88
|
context?: TranscriptContext[];
|
|
89
|
+
images?: TranscriptImage[];
|
|
81
90
|
presentation?: ToolPresentationModel;
|
|
82
91
|
}
|
|
83
92
|
|
|
@@ -211,8 +220,8 @@ export type SupercodeUiIntent =
|
|
|
211
220
|
| { action: 'loadSessions' }
|
|
212
221
|
| { action: 'loadEarlier' }
|
|
213
222
|
| { action: 'draft'; text: string }
|
|
214
|
-
| { action: 'send'; text: string }
|
|
215
|
-
| { action: 'new'; harness: HarnessId; text: string }
|
|
223
|
+
| { action: 'send'; text: string; context?: TranscriptContext[]; images?: Array<TranscriptImage & { url: string }> }
|
|
224
|
+
| { action: 'new'; harness: HarnessId; text: string; context?: TranscriptContext[]; images?: Array<TranscriptImage & { url: string }> }
|
|
216
225
|
| { action: 'resume' }
|
|
217
226
|
| { action: 'join' }
|
|
218
227
|
| { action: 'detach' }
|
|
@@ -227,6 +236,8 @@ export type SupercodeUiIntent =
|
|
|
227
236
|
|
|
228
237
|
export interface UiAdapter {
|
|
229
238
|
onIntent(intent: SupercodeUiIntent): void | Promise<void>;
|
|
239
|
+
/** Ask the embedding host for explicit user-selected text or image context. */
|
|
240
|
+
pickContext?(): TranscriptAttachment | TranscriptAttachment[] | null | Promise<TranscriptAttachment | TranscriptAttachment[] | null>;
|
|
230
241
|
onClose?(): void;
|
|
231
242
|
onOpen?(): void;
|
|
232
243
|
copyText?(value: string): void | Promise<void>;
|
|
@@ -245,6 +256,8 @@ export interface MessengerLabels {
|
|
|
245
256
|
|
|
246
257
|
export interface PendingMessageModel {
|
|
247
258
|
text: string;
|
|
259
|
+
context?: TranscriptContext[];
|
|
260
|
+
images?: TranscriptImage[];
|
|
248
261
|
status: 'sending' | 'failed';
|
|
249
262
|
onRetry?(): void;
|
|
250
263
|
onEdit?(): void;
|
|
@@ -341,7 +354,7 @@ export function terminalCommand(handoff: NonNullable<SupercodeUiState['terminalH
|
|
|
341
354
|
export function isSendKey(event: Pick<KeyboardEvent, 'key' | 'shiftKey' | 'isComposing'>): boolean;
|
|
342
355
|
|
|
343
356
|
export function HarnessLogo(props: { id: HarnessId; activity?: SessionActivity; size?: number; onMissingLogo?(id: string): void }): VNode | null;
|
|
344
|
-
export type UiIconName = 'back' | 'check' | 'chevron' | 'close' | 'copy' | 'down' | 'menu' | 'plus' | 'search' | 'send' | 'stop';
|
|
357
|
+
export type UiIconName = 'attach' | 'back' | 'check' | 'chevron' | 'close' | 'copy' | 'down' | 'menu' | 'plus' | 'search' | 'send' | 'stop';
|
|
345
358
|
export function UiIcon(props: { name: UiIconName; size?: number; class?: string }): VNode | null;
|
|
346
359
|
export function hasHarnessLogo(id: string): boolean;
|
|
347
360
|
export function LoadingStatus(props: { state: SupercodeUiState; compact?: boolean }): VNode;
|
|
@@ -355,7 +368,7 @@ export function Conversation(props: { state: SupercodeUiState; adapter: UiAdapte
|
|
|
355
368
|
export function SessionRow(props: { row: SessionRowModel; state: SupercodeUiState; adapter: UiAdapter; onOpen(row: SessionRowModel): void }): VNode;
|
|
356
369
|
export function SessionList(props: { state: SupercodeUiState; adapter: UiAdapter; onOpen(row: SessionRowModel): void; onNew?(): void; onClose?(): void; components?: MessengerComponents; labels?: MessengerLabels; focusKey?: string | null; memoryKey?: string }): VNode;
|
|
357
370
|
export function ContinuationBar(props: { state: SupercodeUiState; adapter: UiAdapter; labels?: MessengerLabels }): VNode | null;
|
|
358
|
-
export function Composer(props: { state: SupercodeUiState; adapter: UiAdapter; labels?: MessengerLabels; memoryKey?: string; pendingStatus?: PendingMessageModel['status'] | 'editing' | null; restoreDraft?: { id: string | number; text: string } | null; onPending?(text: string): void; onDraftRestored?(id: string | number): void }): VNode;
|
|
371
|
+
export function Composer(props: { state: SupercodeUiState; adapter: UiAdapter; labels?: MessengerLabels; memoryKey?: string; pendingStatus?: PendingMessageModel['status'] | 'editing' | null; restoreDraft?: { id: string | number; text: string; context?: TranscriptContext[]; images?: TranscriptImage[] } | null; onPending?(text: string, context?: TranscriptContext[], images?: TranscriptImage[]): void; onDraftRestored?(id: string | number): void }): VNode;
|
|
359
372
|
export function SupercodeMessenger(props: MessengerProps): VNode;
|
|
360
373
|
|
|
361
374
|
export interface MountedMessenger {
|