@signal9/era-ui 34.2.9 → 34.4.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 +12 -0
- package/dist/ai/code-mode/code-mode.svelte +201 -0
- package/dist/ai/code-mode/code-mode.svelte.d.ts +15 -0
- package/dist/ai/code-mode/index.d.ts +2 -0
- package/dist/ai/code-mode/index.js +1 -0
- package/dist/ai/code-mode/types.d.ts +26 -0
- package/dist/ai/code-mode/types.js +1 -0
- package/dist/ai/confirmation/batch.d.ts +21 -0
- package/dist/ai/confirmation/batch.js +1 -0
- package/dist/ai/confirmation/confirmation-batch.svelte +190 -0
- package/dist/ai/confirmation/confirmation-batch.svelte.d.ts +17 -0
- package/dist/ai/confirmation/index.d.ts +2 -0
- package/dist/ai/confirmation/index.js +1 -0
- package/dist/ai/conversation/conversation-scroll-button.svelte +2 -2
- package/dist/ai/conversations/conversations-item.svelte +39 -0
- package/dist/ai/conversations/conversations-item.svelte.d.ts +12 -0
- package/dist/ai/conversations/conversations.svelte.d.ts +6 -0
- package/dist/ai/index.d.ts +3 -1
- package/dist/ai/index.js +1 -0
- package/dist/ai/model-selector/index.d.ts +1 -0
- package/dist/ai/model-selector/model-selector.svelte +65 -31
- package/dist/ai/model-selector/model-selector.svelte.d.ts +24 -7
- package/dist/ai/queue/index.d.ts +1 -1
- package/dist/ai/queue/queue-item.svelte +63 -6
- package/dist/ai/queue/queue-item.svelte.d.ts +12 -3
- package/dist/ai/queue/queue.svelte +33 -9
- package/dist/ai/queue/queue.svelte.d.ts +6 -2
- package/dist/ai/tool/index.d.ts +1 -1
- package/dist/ai/tool/index.js +1 -1
- package/dist/ai/tool/tool-chip.svelte +2 -12
- package/dist/ai/tool/tool-chip.svelte.d.ts +1 -1
- package/dist/ai/tool/tool.svelte +46 -16
- package/dist/ai/tool/tool.svelte.d.ts +11 -2
- package/dist/era-ui.css +1 -1
- package/dist/ui/file-diff/file-diff.svelte +243 -0
- package/dist/ui/file-diff/file-diff.svelte.d.ts +16 -0
- package/dist/ui/file-diff/fixture.svelte +76 -0
- package/dist/ui/file-diff/fixture.svelte.d.ts +3 -0
- package/dist/ui/file-diff/index.d.ts +2 -0
- package/dist/ui/file-diff/index.js +1 -0
- package/dist/ui/file-diff/types.d.ts +31 -0
- package/dist/ui/file-diff/types.js +1 -0
- package/dist/ui/tabs/tabs.svelte +7 -2
- package/dist/ui/tabs/tabs.svelte.d.ts +1 -1
- package/dist/ui/terminal/fixture.svelte +57 -0
- package/dist/ui/terminal/fixture.svelte.d.ts +3 -0
- package/dist/ui/terminal/index.d.ts +2 -0
- package/dist/ui/terminal/index.js +1 -0
- package/dist/ui/terminal/terminal.svelte +91 -0
- package/dist/ui/terminal/terminal.svelte.d.ts +18 -0
- package/dist/ui/terminal/types.d.ts +26 -0
- package/dist/ui/terminal/types.js +1 -0
- package/package.json +16 -1
- package/skills/era-ui/references/releases/34.md +12 -0
- package/skills/era-ui/references/releases/index.md +1 -1
package/dist/ai/index.d.ts
CHANGED
|
@@ -19,9 +19,11 @@ export * as RuntimeFeed from './runtime-feed/index.js';
|
|
|
19
19
|
export * as ErrorPanel from './error-panel/index.js';
|
|
20
20
|
export * as RunStatus from './run-status/index.js';
|
|
21
21
|
export * as Swarm from './swarm/index.js';
|
|
22
|
+
export * as CodeMode from './code-mode/index.js';
|
|
22
23
|
export { Response, repairStreamingMarkdown } from './response/index.js';
|
|
23
24
|
export { default as ContextGauge } from './context/context.svelte';
|
|
24
25
|
export { default as ModelSelector } from './model-selector/model-selector.svelte';
|
|
26
|
+
export type { ModelGroup, ModelOption } from './model-selector/index.js';
|
|
25
27
|
export { default as OpenInChat, providers as openInProviders } from './open-in-chat/open-in-chat.svelte';
|
|
26
28
|
export { default as WebPreview } from './web-preview/web-preview.svelte';
|
|
27
29
|
export * as ChainOfThought from './chain-of-thought/index.js';
|
|
@@ -33,7 +35,7 @@ export { CopyButton } from '../ui/copy-button/index.js';
|
|
|
33
35
|
export { StickToBottom } from './stick-to-bottom.svelte.js';
|
|
34
36
|
export type { PromptAttachment, PromptMessage, ChatStatus } from './prompt-input/index.js';
|
|
35
37
|
export type { MessageRole, MessageVersion } from './message/index.js';
|
|
36
|
-
export type { ToolState } from './tool/index.js';
|
|
38
|
+
export type { ToolState, ToolStatus } from './tool/index.js';
|
|
37
39
|
export type { UsageBreakdown } from './message/index.js';
|
|
38
40
|
export type { ConversationEntry, ConversationGroup, ConversationStatus, TimeBucket } from './conversations/index.js';
|
|
39
41
|
export type { RunState, LogTone, RunTools } from './run-status/index.js';
|
package/dist/ai/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * as RuntimeFeed from './runtime-feed/index.js';
|
|
|
24
24
|
export * as ErrorPanel from './error-panel/index.js';
|
|
25
25
|
export * as RunStatus from './run-status/index.js';
|
|
26
26
|
export * as Swarm from './swarm/index.js';
|
|
27
|
+
export * as CodeMode from './code-mode/index.js';
|
|
27
28
|
export { Response, repairStreamingMarkdown } from './response/index.js';
|
|
28
29
|
export { default as ContextGauge } from './context/context.svelte';
|
|
29
30
|
export { default as ModelSelector } from './model-selector/model-selector.svelte';
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface ModelOption {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
/** Consumer-rendered local icon; preferred over any remote logo. */
|
|
9
|
+
icon?: Snippet;
|
|
10
|
+
/** Short, optional secondary detail such as context window or price tier. */
|
|
11
|
+
metadata?: string;
|
|
12
|
+
/** Optional remote logo for applications that explicitly permit it. */
|
|
13
|
+
logo?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ModelGroup {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
models: ModelOption[];
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
1
23
|
<script lang="ts">
|
|
2
24
|
import * as Dialog from '../../ui/dialog/index.js';
|
|
3
25
|
import * as Command from '../../ui/command/index.js';
|
|
@@ -6,18 +28,26 @@
|
|
|
6
28
|
|
|
7
29
|
let {
|
|
8
30
|
open = $bindable(false),
|
|
9
|
-
models,
|
|
31
|
+
models = [],
|
|
32
|
+
groups,
|
|
10
33
|
value = $bindable(''),
|
|
34
|
+
offline = false,
|
|
11
35
|
onSelect,
|
|
12
36
|
class: className
|
|
13
37
|
}: {
|
|
14
38
|
open?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
models
|
|
39
|
+
/** Flat provider-neutral options; used as one ungrouped list unless groups is supplied. */
|
|
40
|
+
models?: ModelOption[];
|
|
41
|
+
/** Consumer-owned provider or capability groups. */
|
|
42
|
+
groups?: ModelGroup[];
|
|
17
43
|
value?: string;
|
|
18
|
-
|
|
44
|
+
/** Never loads remote logo URLs; local icon snippets continue to render. */
|
|
45
|
+
offline?: boolean;
|
|
46
|
+
onSelect?: (id: string, model: ModelOption) => void;
|
|
19
47
|
class?: string;
|
|
20
48
|
} = $props();
|
|
49
|
+
|
|
50
|
+
const visibleGroups = $derived(groups ?? [{ id: 'models', label: 'Models', models }]);
|
|
21
51
|
</script>
|
|
22
52
|
|
|
23
53
|
<Dialog.Root bind:open>
|
|
@@ -27,33 +57,37 @@
|
|
|
27
57
|
<Command.List>
|
|
28
58
|
<Command.Viewport>
|
|
29
59
|
<Command.Empty>No models found.</Command.Empty>
|
|
30
|
-
|
|
31
|
-
<Command.
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
onSelect
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
{#each visibleGroups as group (group.id)}
|
|
61
|
+
<Command.Group>
|
|
62
|
+
<Command.GroupHeading>{group.label}</Command.GroupHeading>
|
|
63
|
+
<Command.GroupItems>
|
|
64
|
+
{#each group.models as model (model.id)}
|
|
65
|
+
<Command.Item
|
|
66
|
+
value={model.id}
|
|
67
|
+
keywords={[model.name, model.provider ?? '', model.metadata ?? '']}
|
|
68
|
+
onSelect={() => {
|
|
69
|
+
value = model.id;
|
|
70
|
+
onSelect?.(model.id, model);
|
|
71
|
+
open = false;
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{#if model.icon}
|
|
75
|
+
{@render model.icon()}
|
|
76
|
+
{:else if model.logo && !offline}
|
|
77
|
+
<img src={model.logo} alt="" class="size-icon shrink-0 dark:invert" />
|
|
78
|
+
{/if}
|
|
79
|
+
<span class="min-w-0 flex-1 truncate">{model.name}</span>
|
|
80
|
+
{#if model.metadata}
|
|
81
|
+
<span class="shrink-0 text-body text-muted">{model.metadata}</span>
|
|
82
|
+
{/if}
|
|
83
|
+
{#if value === model.id}
|
|
84
|
+
<span class="shrink-0 text-body text-muted">current</span>
|
|
85
|
+
{/if}
|
|
86
|
+
</Command.Item>
|
|
87
|
+
{/each}
|
|
88
|
+
</Command.GroupItems>
|
|
89
|
+
</Command.Group>
|
|
90
|
+
{/each}
|
|
57
91
|
</Command.Viewport>
|
|
58
92
|
</Command.List>
|
|
59
93
|
</Command.Root>
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface ModelOption {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
provider?: string;
|
|
6
|
+
/** Consumer-rendered local icon; preferred over any remote logo. */
|
|
7
|
+
icon?: Snippet;
|
|
8
|
+
/** Short, optional secondary detail such as context window or price tier. */
|
|
9
|
+
metadata?: string;
|
|
10
|
+
/** Optional remote logo for applications that explicitly permit it. */
|
|
11
|
+
logo?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ModelGroup {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
models: ModelOption[];
|
|
17
|
+
}
|
|
1
18
|
type $$ComponentProps = {
|
|
2
19
|
open?: boolean;
|
|
3
|
-
/**
|
|
4
|
-
models
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
provider?: string;
|
|
8
|
-
}[];
|
|
20
|
+
/** Flat provider-neutral options; used as one ungrouped list unless groups is supplied. */
|
|
21
|
+
models?: ModelOption[];
|
|
22
|
+
/** Consumer-owned provider or capability groups. */
|
|
23
|
+
groups?: ModelGroup[];
|
|
9
24
|
value?: string;
|
|
10
|
-
|
|
25
|
+
/** Never loads remote logo URLs; local icon snippets continue to render. */
|
|
26
|
+
offline?: boolean;
|
|
27
|
+
onSelect?: (id: string, model: ModelOption) => void;
|
|
11
28
|
class?: string;
|
|
12
29
|
};
|
|
13
30
|
declare const ModelSelector: import("svelte").Component<$$ComponentProps, {}, "value" | "open">;
|
package/dist/ai/queue/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Root } from './queue.svelte';
|
|
2
|
-
export { default as Item } from './queue-item.svelte';
|
|
2
|
+
export { default as Item, type QueueStatus, type QueueTone } from './queue-item.svelte';
|
|
@@ -1,26 +1,83 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type QueueStatus = 'queued' | 'running' | 'complete' | 'cancelled' | 'error';
|
|
3
|
+
export type QueueTone = 'default' | 'accent' | 'success' | 'warning' | 'destructive' | 'info';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
1
6
|
<script lang="ts">
|
|
2
7
|
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
9
|
+
import X from '@lucide/svelte/icons/x';
|
|
10
|
+
import { Button } from '../../ui/button/index.js';
|
|
3
11
|
import { cn } from '../../utils/index.js';
|
|
4
12
|
|
|
5
13
|
let {
|
|
6
|
-
|
|
14
|
+
id,
|
|
15
|
+
status = 'queued',
|
|
16
|
+
tone,
|
|
17
|
+
label,
|
|
18
|
+
cancelLabel = 'Cancel queued work',
|
|
19
|
+
leading,
|
|
20
|
+
trailing,
|
|
7
21
|
children,
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
onCancel,
|
|
23
|
+
class: className,
|
|
24
|
+
...restProps
|
|
25
|
+
}: Omit<HTMLAttributes<HTMLLIElement>, 'id'> & {
|
|
26
|
+
id: string;
|
|
27
|
+
status?: QueueStatus;
|
|
28
|
+
tone?: QueueTone;
|
|
29
|
+
label?: string;
|
|
30
|
+
cancelLabel?: string;
|
|
31
|
+
leading?: Snippet;
|
|
32
|
+
trailing?: Snippet;
|
|
33
|
+
children?: Snippet;
|
|
34
|
+
onCancel?: (id: string) => void;
|
|
35
|
+
} = $props();
|
|
36
|
+
|
|
37
|
+
const visual = $derived(
|
|
38
|
+
tone ??
|
|
39
|
+
(
|
|
40
|
+
{
|
|
41
|
+
queued: 'warning',
|
|
42
|
+
running: 'accent',
|
|
43
|
+
complete: 'success',
|
|
44
|
+
cancelled: 'default',
|
|
45
|
+
error: 'destructive'
|
|
46
|
+
} as const
|
|
47
|
+
)[status]
|
|
48
|
+
);
|
|
49
|
+
const cancellable = $derived(status === 'queued' || status === 'running');
|
|
10
50
|
</script>
|
|
11
51
|
|
|
12
52
|
<li
|
|
53
|
+
data-queue-id={id}
|
|
54
|
+
data-status={status}
|
|
55
|
+
aria-label={label}
|
|
13
56
|
class={cn(
|
|
14
|
-
'flex min-w-0 items-center gap-gutter rounded-control px-inset-control py-gutter text-body hover:bg-highlight',
|
|
15
|
-
|
|
57
|
+
'flex min-w-0 items-center gap-gutter rounded-control px-inset-control py-gutter text-body hover:bg-highlight hover:shadow-highlight',
|
|
58
|
+
status === 'complete' || status === 'cancelled' ? 'text-muted line-through' : 'text-fg',
|
|
16
59
|
className
|
|
17
60
|
)}
|
|
61
|
+
{...restProps}
|
|
18
62
|
>
|
|
63
|
+
{#if leading}{@render leading()}{/if}
|
|
19
64
|
<span
|
|
20
65
|
class={cn(
|
|
21
66
|
'size-2 shrink-0 rounded-full',
|
|
22
|
-
|
|
67
|
+
visual === 'accent' && 'animate-pulse bg-primary',
|
|
68
|
+
visual === 'success' && 'bg-success',
|
|
69
|
+
visual === 'warning' && 'bg-warning',
|
|
70
|
+
visual === 'destructive' && 'bg-destructive',
|
|
71
|
+
visual === 'info' && 'bg-info',
|
|
72
|
+
visual === 'default' && 'border border-divider bg-transparent'
|
|
23
73
|
)}
|
|
74
|
+
aria-hidden="true"
|
|
24
75
|
></span>
|
|
25
76
|
<span class="min-w-0 flex-1 truncate">{@render children?.()}</span>
|
|
77
|
+
{#if trailing}{@render trailing()}{/if}
|
|
78
|
+
{#if cancellable && onCancel}
|
|
79
|
+
<Button icon size="pill" aria-label={cancelLabel} onclick={() => onCancel?.(id)}>
|
|
80
|
+
<X class="size-icon" />
|
|
81
|
+
</Button>
|
|
82
|
+
{/if}
|
|
26
83
|
</li>
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
export type QueueStatus = 'queued' | 'running' | 'complete' | 'cancelled' | 'error';
|
|
2
|
+
export type QueueTone = 'default' | 'accent' | 'success' | 'warning' | 'destructive' | 'info';
|
|
1
3
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
type $$ComponentProps = Omit<HTMLAttributes<HTMLLIElement>, 'id'> & {
|
|
6
|
+
id: string;
|
|
7
|
+
status?: QueueStatus;
|
|
8
|
+
tone?: QueueTone;
|
|
9
|
+
label?: string;
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
leading?: Snippet;
|
|
12
|
+
trailing?: Snippet;
|
|
4
13
|
children?: Snippet;
|
|
5
|
-
|
|
14
|
+
onCancel?: (id: string) => void;
|
|
6
15
|
};
|
|
7
16
|
declare const QueueItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
17
|
type QueueItem = ReturnType<typeof QueueItem>;
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
4
|
import { cn } from '../../utils/index.js';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
full = false,
|
|
8
|
+
fullLabel = 'Queue is full',
|
|
9
|
+
label = 'Queued work',
|
|
10
|
+
fullContent,
|
|
11
|
+
children,
|
|
12
|
+
class: className,
|
|
13
|
+
...restProps
|
|
14
|
+
}: HTMLAttributes<HTMLUListElement> & {
|
|
15
|
+
full?: boolean;
|
|
16
|
+
fullLabel?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
fullContent?: Snippet;
|
|
19
|
+
children?: Snippet;
|
|
20
|
+
} = $props();
|
|
5
21
|
</script>
|
|
6
22
|
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
<div data-queue-full={full || undefined} class="flex min-w-0 flex-col gap-gutter">
|
|
24
|
+
{#if full}
|
|
25
|
+
{#if fullContent}
|
|
26
|
+
{@render fullContent()}
|
|
27
|
+
{:else}
|
|
28
|
+
<p role="status" class="px-inset-control text-body text-warning">{fullLabel}</p>
|
|
29
|
+
{/if}
|
|
30
|
+
{/if}
|
|
31
|
+
<ul
|
|
32
|
+
aria-label={label}
|
|
33
|
+
class={cn('flex max-h-48 flex-col gap-gutter rounded-bar bg-well p-panel shadow-sm', className)}
|
|
34
|
+
{...restProps}
|
|
35
|
+
>
|
|
36
|
+
{@render children?.()}
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = HTMLAttributes<HTMLUListElement> & {
|
|
4
|
+
full?: boolean;
|
|
5
|
+
fullLabel?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
fullContent?: Snippet;
|
|
3
8
|
children?: Snippet;
|
|
4
|
-
class?: string;
|
|
5
9
|
};
|
|
6
10
|
declare const Queue: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
11
|
type Queue = ReturnType<typeof Queue>;
|
package/dist/ai/tool/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Root, type ToolState } from './tool.svelte';
|
|
1
|
+
export { default as Root, toolStepStatus, type ToolState, type ToolStatus } from './tool.svelte';
|
|
2
2
|
export { default as Header } from './tool-header.svelte';
|
|
3
3
|
export { default as Input } from './tool-input.svelte';
|
|
4
4
|
export { default as Output } from './tool-output.svelte';
|
package/dist/ai/tool/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Root } from './tool.svelte';
|
|
1
|
+
export { default as Root, toolStepStatus } from './tool.svelte';
|
|
2
2
|
export { default as Header } from './tool-header.svelte';
|
|
3
3
|
export { default as Input } from './tool-input.svelte';
|
|
4
4
|
export { default as Output } from './tool-output.svelte';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import Wrench from '@lucide/svelte/icons/wrench';
|
|
4
4
|
import { cn } from '../../utils/index.js';
|
|
5
|
-
import type
|
|
5
|
+
import { toolStepStatus, type ToolState } from './tool.svelte';
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
8
|
state: toolState = 'input-streaming',
|
|
@@ -25,17 +25,7 @@
|
|
|
25
25
|
class?: string;
|
|
26
26
|
} = $props();
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
const status = $derived(
|
|
30
|
-
(
|
|
31
|
-
{
|
|
32
|
-
'input-streaming': 'pending',
|
|
33
|
-
'input-available': 'running',
|
|
34
|
-
'output-available': 'done',
|
|
35
|
-
'output-error': 'error'
|
|
36
|
-
} as const
|
|
37
|
-
)[toolState]
|
|
38
|
-
);
|
|
28
|
+
const status = $derived(toolStepStatus(toolState));
|
|
39
29
|
</script>
|
|
40
30
|
|
|
41
31
|
<!-- Compact horizontal tool call: a quiet pill that brightens on hover and
|
package/dist/ai/tool/tool.svelte
CHANGED
|
@@ -1,37 +1,67 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
|
|
2
|
+
export type ToolStatus =
|
|
3
|
+
'pending' | 'running' | 'complete' | 'error' | 'approval-required' | 'cancelled';
|
|
3
4
|
export type ToolState =
|
|
4
|
-
'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
5
|
+
ToolStatus | 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
6
|
+
export function toolStepStatus(state: ToolState): 'pending' | 'running' | 'done' | 'error' {
|
|
7
|
+
return (
|
|
8
|
+
{
|
|
9
|
+
pending: 'pending',
|
|
10
|
+
running: 'running',
|
|
11
|
+
complete: 'done',
|
|
12
|
+
error: 'error',
|
|
13
|
+
'approval-required': 'pending',
|
|
14
|
+
cancelled: 'done',
|
|
15
|
+
'input-streaming': 'pending',
|
|
16
|
+
'input-available': 'running',
|
|
17
|
+
'output-available': 'done',
|
|
18
|
+
'output-error': 'error'
|
|
19
|
+
} as const
|
|
20
|
+
)[state];
|
|
21
|
+
}
|
|
5
22
|
</script>
|
|
6
23
|
|
|
7
24
|
<script lang="ts">
|
|
8
25
|
import type { Snippet } from 'svelte';
|
|
9
26
|
import * as Step from '../../ui/step/index.js';
|
|
10
|
-
|
|
11
27
|
let {
|
|
12
|
-
|
|
28
|
+
status,
|
|
29
|
+
state = 'pending',
|
|
13
30
|
open = $bindable(false),
|
|
31
|
+
header,
|
|
32
|
+
input,
|
|
33
|
+
progress,
|
|
34
|
+
approval,
|
|
35
|
+
result,
|
|
36
|
+
error,
|
|
37
|
+
actions,
|
|
14
38
|
children,
|
|
15
39
|
class: className
|
|
16
40
|
}: {
|
|
41
|
+
status?: ToolStatus;
|
|
17
42
|
state?: ToolState;
|
|
18
43
|
open?: boolean;
|
|
44
|
+
header?: Snippet;
|
|
45
|
+
input?: Snippet;
|
|
46
|
+
progress?: Snippet;
|
|
47
|
+
approval?: Snippet;
|
|
48
|
+
result?: Snippet;
|
|
49
|
+
error?: Snippet;
|
|
50
|
+
actions?: Snippet;
|
|
19
51
|
children?: Snippet;
|
|
20
52
|
class?: string;
|
|
21
53
|
} = $props();
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
{
|
|
26
|
-
'input-streaming': 'pending',
|
|
27
|
-
'input-available': 'running',
|
|
28
|
-
'output-available': 'done',
|
|
29
|
-
'output-error': 'error'
|
|
30
|
-
} as const
|
|
31
|
-
)[toolState]
|
|
32
|
-
);
|
|
54
|
+
const resolved = $derived(status ?? state);
|
|
55
|
+
const stepStatus = $derived(toolStepStatus(resolved));
|
|
33
56
|
</script>
|
|
34
57
|
|
|
35
|
-
<Step.Root {
|
|
58
|
+
<Step.Root status={stepStatus} bind:open class={className} data-tool-status={resolved}>
|
|
59
|
+
{@render header?.()}
|
|
60
|
+
{@render input?.()}
|
|
61
|
+
{@render progress?.()}
|
|
62
|
+
{@render approval?.()}
|
|
63
|
+
{@render result?.()}
|
|
64
|
+
{@render error?.()}
|
|
65
|
+
{@render actions?.()}
|
|
36
66
|
{@render children?.()}
|
|
37
67
|
</Step.Root>
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
export type ToolState = 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
1
|
+
export type ToolStatus = 'pending' | 'running' | 'complete' | 'error' | 'approval-required' | 'cancelled';
|
|
2
|
+
export type ToolState = ToolStatus | 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
3
|
+
export declare function toolStepStatus(state: ToolState): 'pending' | 'running' | 'done' | 'error';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
5
|
type $$ComponentProps = {
|
|
6
|
+
status?: ToolStatus;
|
|
5
7
|
state?: ToolState;
|
|
6
8
|
open?: boolean;
|
|
9
|
+
header?: Snippet;
|
|
10
|
+
input?: Snippet;
|
|
11
|
+
progress?: Snippet;
|
|
12
|
+
approval?: Snippet;
|
|
13
|
+
result?: Snippet;
|
|
14
|
+
error?: Snippet;
|
|
15
|
+
actions?: Snippet;
|
|
7
16
|
children?: Snippet;
|
|
8
17
|
class?: string;
|
|
9
18
|
};
|