@widgetic/chat 0.1.39 → 0.1.41
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 +71 -0
- package/dist/components/Chat.svelte +63 -4
- package/dist/components/Chat.svelte.d.ts +31 -0
- package/dist/components/ChatComposer.svelte +5 -1
- package/dist/components/ChatMessages.svelte +574 -214
- package/dist/components/ChatMessages.svelte.d.ts +18 -0
- package/dist/components/agent/AgentAvatar.svelte +153 -0
- package/dist/components/agent/AgentAvatar.svelte.d.ts +27 -0
- package/dist/components/agent/AgentTurn.svelte +64 -0
- package/dist/components/agent/AgentTurn.svelte.d.ts +32 -0
- package/dist/components/agent/AvatarBoundary.svelte +29 -0
- package/dist/components/agent/AvatarBoundary.svelte.d.ts +20 -0
- package/dist/components/agent/CodeCard.svelte +288 -0
- package/dist/components/agent/CodeCard.svelte.d.ts +12 -0
- package/dist/components/agent/GenerationModule.svelte +99 -0
- package/dist/components/agent/GenerationModule.svelte.d.ts +16 -0
- package/dist/components/agent/MemberAvatar.svelte +87 -0
- package/dist/components/agent/MemberAvatar.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +9 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/messages.d.ts +46 -9
- package/dist/i18n/messages.js +48 -10
- package/dist/i18n/sketchLocales.d.ts +2 -0
- package/dist/i18n/sketchLocales.js +83 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +3 -0
- package/dist/services/sketchAssistantClient.d.ts +68 -0
- package/dist/services/sketchAssistantClient.js +73 -0
- package/dist/services/sketchAssistantOrchestrator.d.ts +45 -0
- package/dist/services/sketchAssistantOrchestrator.js +128 -0
- package/dist/services/sketchAssistantReply.d.ts +12 -0
- package/dist/services/sketchAssistantReply.js +28 -0
- package/dist/stores/chatStore.d.ts +1 -0
- package/dist/stores/chatStore.js +21 -0
- package/dist/types/agent.d.ts +74 -0
- package/dist/types/agent.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/message.d.ts +2 -0
- package/dist/utils/agentTurn.d.ts +219 -0
- package/dist/utils/agentTurn.js +301 -0
- package/dist/utils/bubbleFit.d.ts +75 -0
- package/dist/utils/bubbleFit.js +116 -0
- package/dist/utils/bubbleShrinkWrap.d.ts +32 -0
- package/dist/utils/bubbleShrinkWrap.js +360 -0
- package/dist/utils/codeHighlight.d.ts +13 -0
- package/dist/utils/codeHighlight.js +61 -0
- package/dist/utils/codePrettier.d.ts +6 -0
- package/dist/utils/codePrettier.js +34 -0
- package/dist/utils/codeStreamFormat.d.ts +90 -0
- package/dist/utils/codeStreamFormat.js +429 -0
- package/dist/utils/generationArchiveStore.d.ts +5 -0
- package/dist/utils/generationArchiveStore.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/package.json +3 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* One part of the assistant's work, shown in the chat and folded away with one press: its thinking, as plain text like a
|
|
4
|
+
* message, or the code it wrote, as a code card (see `CodeCard`, which draws the code kind: Prettier lays the code out as it
|
|
5
|
+
* is written and highlight.js colours it).
|
|
6
|
+
*
|
|
7
|
+
* It is open while it is the part being written and closed once the next part (or the conclusion) has taken over; the
|
|
8
|
+
* person's own choice wins from the moment they press it. Under a conclusion it comes back closed, for the person to open.
|
|
9
|
+
*/
|
|
10
|
+
import { tick } from 'svelte';
|
|
11
|
+
import IconChevronRight from '@tabler/icons-svelte/icons/chevron-right';
|
|
12
|
+
import { useChatLanguage } from '../../i18n/language.js';
|
|
13
|
+
import { chatLog } from '../../utils/logger.js';
|
|
14
|
+
import CodeCard from './CodeCard.svelte';
|
|
15
|
+
|
|
16
|
+
// The words of the module, in the language of the chat above
|
|
17
|
+
const { t } = useChatLanguage();
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
/** What this part of the work is. */
|
|
21
|
+
kind: 'thinking' | 'code';
|
|
22
|
+
/** Everything written so far. */
|
|
23
|
+
text: string;
|
|
24
|
+
/** The text is still arriving: the title says so, and the newest line stays in view. */
|
|
25
|
+
streaming?: boolean;
|
|
26
|
+
/** Whole seconds the thinking took, once it is over. */
|
|
27
|
+
seconds?: number | null;
|
|
28
|
+
/** Open until the person chooses (the live part), or closed until they do (the part under a conclusion). */
|
|
29
|
+
openByDefault?: boolean;
|
|
30
|
+
class?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let { kind, text, streaming = false, seconds = null, openByDefault = false, class: className = '' }: Props = $props();
|
|
34
|
+
|
|
35
|
+
// What the person chose, once they have chosen: from then on it wins over the default
|
|
36
|
+
let chosenOpen = $state<boolean | null>(null);
|
|
37
|
+
const isOpen = $derived(chosenOpen ?? openByDefault);
|
|
38
|
+
|
|
39
|
+
const bodyId = $props.id();
|
|
40
|
+
let bodyElement = $state<HTMLElement | null>(null);
|
|
41
|
+
|
|
42
|
+
// (The code kind has its own card, which says what it is itself.)
|
|
43
|
+
const title = $derived.by(() => {
|
|
44
|
+
if (!streaming && seconds != null) return $t('chat.generation.thoughtFor', { seconds: String(seconds) });
|
|
45
|
+
return $t('chat.generation.thinking');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// What the button does, for a screen reader (the title says what it is)
|
|
49
|
+
const toggleLabel = $derived(isOpen ? $t('chat.generation.collapseThought') : $t('chat.generation.expandThought'));
|
|
50
|
+
|
|
51
|
+
function toggleOpen(): void {
|
|
52
|
+
chosenOpen = !isOpen;
|
|
53
|
+
chatLog('[Chat] generation module', kind, chosenOpen ? 'opened' : 'closed', 'by the person');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// While the text arrives, keep its newest line in view
|
|
57
|
+
$effect(() => {
|
|
58
|
+
if (!streaming || !isOpen || !bodyElement) return;
|
|
59
|
+
if (text.length === 0) return;
|
|
60
|
+
tick()
|
|
61
|
+
.then(() => {
|
|
62
|
+
if (bodyElement) bodyElement.scrollTop = bodyElement.scrollHeight;
|
|
63
|
+
})
|
|
64
|
+
.catch((error) => console.warn('[Chat] Could not keep the newest line in view:', error));
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
{#if kind === 'code'}
|
|
69
|
+
<!-- The code is a card of its own (open, closed, copy, the status line): see CodeCard -->
|
|
70
|
+
<CodeCard code={text} {streaming} {openByDefault} class={className} />
|
|
71
|
+
{:else}
|
|
72
|
+
<div class="flex min-w-0 flex-col {className}" data-testid="generation-module" data-generation-module={kind} data-open={isOpen}>
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
class="text-caption-medium text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-h-7 w-fit max-w-full items-center gap-1 rounded-sm text-start transition-colors focus-visible:ring-2 focus-visible:outline-none"
|
|
76
|
+
aria-expanded={isOpen}
|
|
77
|
+
aria-controls={bodyId}
|
|
78
|
+
onclick={toggleOpen}
|
|
79
|
+
>
|
|
80
|
+
<IconChevronRight
|
|
81
|
+
class="size-4 shrink-0 stroke-2 transition-transform motion-reduce:transition-none rtl:-scale-x-100 {isOpen
|
|
82
|
+
? 'rotate-90 rtl:-rotate-90'
|
|
83
|
+
: ''}"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
/>
|
|
86
|
+
<span class="min-w-0 truncate">{title}</span>
|
|
87
|
+
<span class="sr-only">{toggleLabel}</span>
|
|
88
|
+
</button>
|
|
89
|
+
<div id={bodyId} class="min-w-0">
|
|
90
|
+
{#if isOpen}
|
|
91
|
+
<div
|
|
92
|
+
bind:this={bodyElement}
|
|
93
|
+
class="text-caption text-muted-foreground max-h-40 overflow-auto ps-5 break-words whitespace-pre-wrap"
|
|
94
|
+
dir="auto"
|
|
95
|
+
data-testid="generation-thinking-text">{text}</div>
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** What this part of the work is. */
|
|
3
|
+
kind: 'thinking' | 'code';
|
|
4
|
+
/** Everything written so far. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** The text is still arriving: the title says so, and the newest line stays in view. */
|
|
7
|
+
streaming?: boolean;
|
|
8
|
+
/** Whole seconds the thinking took, once it is over. */
|
|
9
|
+
seconds?: number | null;
|
|
10
|
+
/** Open until the person chooses (the live part), or closed until they do (the part under a conclusion). */
|
|
11
|
+
openByDefault?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const GenerationModule: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type GenerationModule = ReturnType<typeof GenerationModule>;
|
|
16
|
+
export default GenerationModule;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The face next to a message a person of the team wrote: their picture, or their initials, and their e-mail when the pointer
|
|
4
|
+
* rests on it (or the keyboard is on it). The same tooltip as the member avatars in the project header of the Widgetic site,
|
|
5
|
+
* and the same click: with an e-mail the face is a link that writes to the person (`mailto:`, with the hand cursor), as
|
|
6
|
+
* in that header. Without one it is only a picture: nothing to click, nothing to reach with the keyboard.
|
|
7
|
+
*
|
|
8
|
+
* `Avatar` and `Tooltip` come from the components barrel of the design system, like the panel header's: its export map has
|
|
9
|
+
* no path to them anywhere else. Neither shows a word of its own (initials from a name, an e-mail address in the tooltip),
|
|
10
|
+
* so there are no words of the design system to hand over.
|
|
11
|
+
*/
|
|
12
|
+
import { Avatar, Tooltip } from '@widgetic/design-system/components';
|
|
13
|
+
import { useChatLanguage } from '../../i18n/language.js';
|
|
14
|
+
import type { ChatMember } from '../../types/agent.js';
|
|
15
|
+
import { memberDisplayName, memberMailtoHref, memberTooltipEmail } from '../../utils/agentTurn.js';
|
|
16
|
+
|
|
17
|
+
// The words of the avatar, in the language of the chat above
|
|
18
|
+
const { t } = useChatLanguage();
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
member: ChatMember;
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let { member, class: className = '' }: Props = $props();
|
|
26
|
+
|
|
27
|
+
const displayName = $derived(memberDisplayName(member));
|
|
28
|
+
// Null when the person has no e-mail (or a placeholder word for one): then there is nothing to show on hover, and nowhere to write to
|
|
29
|
+
const tooltipEmail = $derived(memberTooltipEmail(member.email));
|
|
30
|
+
const mailtoHref = $derived(memberMailtoHref(member.email));
|
|
31
|
+
// What a screen reader says: "Name (email)", just the name, just the e-mail, or that it is a person of the team
|
|
32
|
+
const accessibleLabel = $derived.by(() => {
|
|
33
|
+
if (displayName && tooltipEmail) return $t('chat.member.avatarLabel', { name: displayName, email: tooltipEmail });
|
|
34
|
+
return displayName || tooltipEmail || $t('chat.member.unknown');
|
|
35
|
+
});
|
|
36
|
+
// What it says when it is a link, as the header's does: "Email Name" (the e-mail itself when the person has no name)
|
|
37
|
+
const emailLabel = $derived($t('chat.member.emailLabel', { name: displayName || tooltipEmail || '' }));
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<!-- The picture, the same whether the face is a link or not -->
|
|
41
|
+
{#snippet face()}
|
|
42
|
+
<Avatar name={displayName} src={member.avatarUrl ?? undefined} size="sm" />
|
|
43
|
+
{/snippet}
|
|
44
|
+
|
|
45
|
+
<Tooltip.Provider delayDuration={200}>
|
|
46
|
+
<Tooltip.Root disabled={!tooltipEmail}>
|
|
47
|
+
<Tooltip.Trigger>
|
|
48
|
+
{#snippet child({ props }: { props: Record<string, unknown> })}
|
|
49
|
+
{#if mailtoHref}
|
|
50
|
+
<!-- A mail address, not a route of an app: SvelteKit's `resolve()` (the hint of the Svelte tools for any `href`) is for routes -->
|
|
51
|
+
<a
|
|
52
|
+
{...props}
|
|
53
|
+
href={mailtoHref}
|
|
54
|
+
class="ring-offset-background focus-visible:ring-ring inline-flex shrink-0 cursor-pointer rounded-full focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none {className}"
|
|
55
|
+
aria-label={emailLabel}
|
|
56
|
+
data-testid="chat-member-avatar"
|
|
57
|
+
>
|
|
58
|
+
{@render face()}
|
|
59
|
+
</a>
|
|
60
|
+
{:else}
|
|
61
|
+
<span
|
|
62
|
+
{...props}
|
|
63
|
+
class="inline-flex shrink-0 rounded-full {className}"
|
|
64
|
+
role="img"
|
|
65
|
+
aria-label={accessibleLabel}
|
|
66
|
+
data-testid="chat-member-avatar"
|
|
67
|
+
>
|
|
68
|
+
{@render face()}
|
|
69
|
+
</span>
|
|
70
|
+
{/if}
|
|
71
|
+
{/snippet}
|
|
72
|
+
</Tooltip.Trigger>
|
|
73
|
+
{#if tooltipEmail}
|
|
74
|
+
<Tooltip.Portal>
|
|
75
|
+
<Tooltip.Content
|
|
76
|
+
side="bottom"
|
|
77
|
+
align="center"
|
|
78
|
+
collisionPadding={8}
|
|
79
|
+
class="max-w-[min(20rem,calc(100vw-2rem))] break-all text-center"
|
|
80
|
+
data-testid="chat-member-email-tooltip"
|
|
81
|
+
>
|
|
82
|
+
{tooltipEmail}
|
|
83
|
+
</Tooltip.Content>
|
|
84
|
+
</Tooltip.Portal>
|
|
85
|
+
{/if}
|
|
86
|
+
</Tooltip.Root>
|
|
87
|
+
</Tooltip.Provider>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChatMember } from '../../types/agent.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
member: ChatMember;
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const MemberAvatar: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type MemberAvatar = ReturnType<typeof MemberAvatar>;
|
|
8
|
+
export default MemberAvatar;
|
|
@@ -9,4 +9,9 @@ export { default as AttachmentDisplay } from './AttachmentDisplay.svelte';
|
|
|
9
9
|
export { default as CodeBlock } from './CodeBlock.svelte';
|
|
10
10
|
export { default as StatusIndicator } from './StatusIndicator.svelte';
|
|
11
11
|
export { default as LoadingIndicator } from './LoadingIndicator.svelte';
|
|
12
|
+
export { default as AgentAvatar } from './agent/AgentAvatar.svelte';
|
|
13
|
+
export { default as AgentTurn } from './agent/AgentTurn.svelte';
|
|
14
|
+
export { default as CodeCard } from './agent/CodeCard.svelte';
|
|
15
|
+
export { default as GenerationModule } from './agent/GenerationModule.svelte';
|
|
16
|
+
export { default as MemberAvatar } from './agent/MemberAvatar.svelte';
|
|
12
17
|
export type { ComponentProps } from 'svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -10,3 +10,12 @@ export { default as AttachmentDisplay } from './AttachmentDisplay.svelte';
|
|
|
10
10
|
export { default as CodeBlock } from './CodeBlock.svelte';
|
|
11
11
|
export { default as StatusIndicator } from './StatusIndicator.svelte';
|
|
12
12
|
export { default as LoadingIndicator } from './LoadingIndicator.svelte';
|
|
13
|
+
// The assistant's turn, for a page that builds its own panel: the moving avatar, the turn around it (the avatar with its
|
|
14
|
+
// content beside it), the collapsible thinking and the code card (the code, laid out by Prettier as it is written), and a
|
|
15
|
+
// team member's avatar with the e-mail on hover.
|
|
16
|
+
// Inside `Chat` they speak the page's language; used on their own they speak English.
|
|
17
|
+
export { default as AgentAvatar } from './agent/AgentAvatar.svelte';
|
|
18
|
+
export { default as AgentTurn } from './agent/AgentTurn.svelte';
|
|
19
|
+
export { default as CodeCard } from './agent/CodeCard.svelte';
|
|
20
|
+
export { default as GenerationModule } from './agent/GenerationModule.svelte';
|
|
21
|
+
export { default as MemberAvatar } from './agent/MemberAvatar.svelte';
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CHAT_MESSAGES, type ChatMessageKey } from './messages.js';
|
|
2
2
|
export { PUBLISH_NUDGE_BY_LOCALE, PUBLISH_NUDGE_ENGLISH } from './publishNudgeLocales.js';
|
|
3
|
+
export { CHAT_SKETCH_LOCALE_MESSAGES } from './sketchLocales.js';
|
|
3
4
|
export { checkChatMessages, provideChatLanguage, useChatLanguage } from './language.js';
|
|
4
5
|
export { actionFailureKey, contextTypeLabel, fileSizeText, versionLabelText } from './labels.js';
|
|
5
6
|
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, } from './suggestions.js';
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CHAT_MESSAGES } from './messages.js';
|
|
2
2
|
export { PUBLISH_NUDGE_BY_LOCALE, PUBLISH_NUDGE_ENGLISH } from './publishNudgeLocales.js';
|
|
3
|
+
export { CHAT_SKETCH_LOCALE_MESSAGES } from './sketchLocales.js';
|
|
3
4
|
export { checkChatMessages, provideChatLanguage, useChatLanguage } from './language.js';
|
|
4
5
|
export { actionFailureKey, contextTypeLabel, fileSizeText, versionLabelText } from './labels.js';
|
|
5
6
|
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, } from './suggestions.js';
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -44,20 +44,43 @@ export declare const CHAT_MESSAGES: {
|
|
|
44
44
|
readonly 'chat.messages.emptyTitle': "What do you want to build?";
|
|
45
45
|
readonly 'chat.messages.emptyHint': "Sketch it on the canvas, or describe it here.";
|
|
46
46
|
readonly 'chat.messages.loadingHistory': "Loading chat history...";
|
|
47
|
-
/** Said while the assistant works on an answer. */
|
|
48
|
-
readonly 'chat.messages.thinking': "
|
|
47
|
+
/** Said while the assistant works on an answer (typed out, in a shimmer, by the avatar). */
|
|
48
|
+
readonly 'chat.messages.thinking': "Thinking…";
|
|
49
49
|
/** Header while streamed reasoning is visible during codegen. */
|
|
50
|
-
readonly 'chat.generation.thinking': "Thinking";
|
|
50
|
+
readonly 'chat.generation.thinking': "Thinking…";
|
|
51
51
|
/** Header while streamed code is visible during codegen. */
|
|
52
|
-
readonly 'chat.generation.writingCode': "Writing code";
|
|
52
|
+
readonly 'chat.generation.writingCode': "Writing code…";
|
|
53
53
|
/** Collapsed reasoning summary after code begins streaming. */
|
|
54
54
|
readonly 'chat.generation.thoughtFor': "Thought for {seconds} s";
|
|
55
55
|
readonly 'chat.generation.expandThought': "Show thinking";
|
|
56
56
|
readonly 'chat.generation.collapseThought': "Hide thinking";
|
|
57
57
|
/** Polite screen-reader line when codegen enters the thinking phase. */
|
|
58
|
-
readonly 'chat.generation.statusThinking': "
|
|
58
|
+
readonly 'chat.generation.statusThinking': "Thinking";
|
|
59
59
|
/** Polite screen-reader line when codegen enters the writing-code phase. */
|
|
60
|
-
readonly 'chat.generation.statusWritingCode': "
|
|
60
|
+
readonly 'chat.generation.statusWritingCode': "Writing code";
|
|
61
|
+
/** Title of the code the assistant wrote, once it has finished writing it (while it writes, the title is `chat.generation.writingCode`). */
|
|
62
|
+
readonly 'chat.generation.codeTitle': "Code";
|
|
63
|
+
/** The status line of the code card once the assistant has finished writing the code (while it writes, the line is `chat.generation.writingCode`). */
|
|
64
|
+
readonly 'chat.generation.codeWritten': "Code written";
|
|
65
|
+
/** The size of the code in the code card: its lines as they are laid out. */
|
|
66
|
+
readonly 'chat.generation.codeLineCount': "{count, plural, one {# line} other {# lines}}";
|
|
67
|
+
readonly 'chat.generation.expandCode': "Show code";
|
|
68
|
+
readonly 'chat.generation.collapseCode': "Hide code";
|
|
69
|
+
/**
|
|
70
|
+
* The conclusion line under the success avatar, when the assistant finished building and said nothing else the chat shows
|
|
71
|
+
* (the "Code generation completed" lines the host saves are not shown: they become the version label of the turn).
|
|
72
|
+
*/
|
|
73
|
+
readonly 'chat.generation.doneMessage': "Done. Your changes are ready.";
|
|
74
|
+
/** What a screen reader says about the avatar once what the assistant was asked to do is done. */
|
|
75
|
+
readonly 'chat.agent.avatar.success': "Done";
|
|
76
|
+
/** What a screen reader says about the avatar when the assistant's work failed. */
|
|
77
|
+
readonly 'chat.agent.avatar.error': "Something went wrong";
|
|
78
|
+
/** What a screen reader says about the avatar of a person of the team (`{name}` and `{email}`). */
|
|
79
|
+
readonly 'chat.member.avatarLabel': "{name} ({email})";
|
|
80
|
+
/** What a screen reader says about the avatar of a person of the team when it is a link that writes to them (`{name}`). */
|
|
81
|
+
readonly 'chat.member.emailLabel': "Email {name}";
|
|
82
|
+
/** The name of a person of the team the page did not tell the chat about. */
|
|
83
|
+
readonly 'chat.member.unknown': "Team member";
|
|
61
84
|
/** Heading when the gateway plan has no title. */
|
|
62
85
|
readonly 'chat.plan.title': "Build plan";
|
|
63
86
|
/** Progress badge on the plan card (`{current}` / `{total}`). */
|
|
@@ -69,9 +92,9 @@ export declare const CHAT_MESSAGES: {
|
|
|
69
92
|
readonly 'chat.messages.attachmentMissingTitle': "Attachment not available";
|
|
70
93
|
readonly 'chat.messages.attachmentMissingLabel': "Missing file attachment";
|
|
71
94
|
readonly 'chat.messages.attachmentMissingCaption': "Attachment not saved. Re-attach with Upload, then send it again.";
|
|
72
|
-
/**
|
|
95
|
+
/** A failed reply in the docked panel is one short line (this, or what the server said) with a refresh icon that runs the prompt again. */
|
|
73
96
|
readonly 'chat.messages.failedTitle': "Could not build the widget";
|
|
74
|
-
|
|
97
|
+
/** The name of the refresh icon next to a failure: its tooltip and what a screen reader says. */
|
|
75
98
|
readonly 'chat.messages.failedRetry': "Try again";
|
|
76
99
|
/** The line a build the person stopped leaves in the conversation (docked panel): it is their own command, not a failure. */
|
|
77
100
|
readonly 'chat.messages.stoppedByYou': "You stopped the build.";
|
|
@@ -145,7 +168,6 @@ export declare const CHAT_MESSAGES: {
|
|
|
145
168
|
readonly 'chat.input.send': "Send message";
|
|
146
169
|
readonly 'chat.input.tooLong': "Message is too long";
|
|
147
170
|
readonly 'chat.input.publishNudge': "First generate your widget, then you can publish it.";
|
|
148
|
-
readonly 'chat.composer.assistant': "Assistant";
|
|
149
171
|
readonly 'chat.messages.scrollToBottom': "Scroll to latest messages";
|
|
150
172
|
readonly 'chat.messages.clarificationPrompt': "Which option fits best?";
|
|
151
173
|
readonly 'chat.checkpoint.version': "Version {n}";
|
|
@@ -221,6 +243,21 @@ export declare const CHAT_MESSAGES: {
|
|
|
221
243
|
readonly 'chat.error.actionFailed': "The action failed. Please try again.";
|
|
222
244
|
readonly 'chat.error.statusUpdateFailed': "Failed to update conversation status";
|
|
223
245
|
readonly 'chat.error.restoreFailed': "Failed to restore checkpoint. Please try again.";
|
|
246
|
+
readonly 'chat.sketch.drewVideoPlayer': "Drew a video player: 16:9 thumbnail with a play button and a navigation bar below it.";
|
|
247
|
+
readonly 'chat.sketch.movedNavigation': "Moved the navigation bar below the video thumbnail.";
|
|
248
|
+
readonly 'chat.sketch.deletedAll': "Removed every sketch from the canvas.";
|
|
249
|
+
readonly 'chat.sketch.namedComponents': "Labelled each component and drew an arrow to it.";
|
|
250
|
+
readonly 'chat.sketch.addedShapes': "Added wireframe shapes on the canvas.";
|
|
251
|
+
readonly 'chat.sketch.followUp': "Ask me to move, label, or delete anything on the board.";
|
|
252
|
+
readonly 'chat.sketch.genericDone': "Updated the sketch on the canvas.";
|
|
253
|
+
readonly 'chat.sketch.failed': "Could not update the sketch: {detail}";
|
|
254
|
+
readonly 'chat.sketch.failedUnknown': "Could not update the sketch.";
|
|
255
|
+
readonly 'chat.sketch.stepCap': "Sketch assistant stopped after too many steps.";
|
|
256
|
+
readonly 'chat.sketch.noCredits': "You are out of credits, so I cannot draw right now. Add credits and ask me again.";
|
|
257
|
+
readonly 'chat.sketch.busy': "A sketch is already being drawn, or you have sent too many requests. Try again in a moment.";
|
|
258
|
+
readonly 'chat.sketch.unavailable': "The sketch assistant is not available right now. Please try again in a moment.";
|
|
259
|
+
readonly 'chat.sketch.stopped': "Stopped drawing.";
|
|
260
|
+
readonly 'chat.sketch.undoLabel': "Undo drawing";
|
|
224
261
|
};
|
|
225
262
|
/** The name of one message. */
|
|
226
263
|
export type ChatMessageKey = keyof typeof CHAT_MESSAGES;
|
package/dist/i18n/messages.js
CHANGED
|
@@ -48,20 +48,43 @@ export const CHAT_MESSAGES = {
|
|
|
48
48
|
'chat.messages.emptyTitle': 'What do you want to build?',
|
|
49
49
|
'chat.messages.emptyHint': 'Sketch it on the canvas, or describe it here.',
|
|
50
50
|
'chat.messages.loadingHistory': 'Loading chat history...',
|
|
51
|
-
/** Said while the assistant works on an answer. */
|
|
52
|
-
'chat.messages.thinking': '
|
|
51
|
+
/** Said while the assistant works on an answer (typed out, in a shimmer, by the avatar). */
|
|
52
|
+
'chat.messages.thinking': 'Thinking…',
|
|
53
53
|
/** Header while streamed reasoning is visible during codegen. */
|
|
54
|
-
'chat.generation.thinking': 'Thinking',
|
|
54
|
+
'chat.generation.thinking': 'Thinking…',
|
|
55
55
|
/** Header while streamed code is visible during codegen. */
|
|
56
|
-
'chat.generation.writingCode': 'Writing code',
|
|
56
|
+
'chat.generation.writingCode': 'Writing code…',
|
|
57
57
|
/** Collapsed reasoning summary after code begins streaming. */
|
|
58
58
|
'chat.generation.thoughtFor': 'Thought for {seconds} s',
|
|
59
59
|
'chat.generation.expandThought': 'Show thinking',
|
|
60
60
|
'chat.generation.collapseThought': 'Hide thinking',
|
|
61
61
|
/** Polite screen-reader line when codegen enters the thinking phase. */
|
|
62
|
-
'chat.generation.statusThinking': '
|
|
62
|
+
'chat.generation.statusThinking': 'Thinking',
|
|
63
63
|
/** Polite screen-reader line when codegen enters the writing-code phase. */
|
|
64
|
-
'chat.generation.statusWritingCode': '
|
|
64
|
+
'chat.generation.statusWritingCode': 'Writing code',
|
|
65
|
+
/** Title of the code the assistant wrote, once it has finished writing it (while it writes, the title is `chat.generation.writingCode`). */
|
|
66
|
+
'chat.generation.codeTitle': 'Code',
|
|
67
|
+
/** The status line of the code card once the assistant has finished writing the code (while it writes, the line is `chat.generation.writingCode`). */
|
|
68
|
+
'chat.generation.codeWritten': 'Code written',
|
|
69
|
+
/** The size of the code in the code card: its lines as they are laid out. */
|
|
70
|
+
'chat.generation.codeLineCount': '{count, plural, one {# line} other {# lines}}',
|
|
71
|
+
'chat.generation.expandCode': 'Show code',
|
|
72
|
+
'chat.generation.collapseCode': 'Hide code',
|
|
73
|
+
/**
|
|
74
|
+
* The conclusion line under the success avatar, when the assistant finished building and said nothing else the chat shows
|
|
75
|
+
* (the "Code generation completed" lines the host saves are not shown: they become the version label of the turn).
|
|
76
|
+
*/
|
|
77
|
+
'chat.generation.doneMessage': 'Done. Your changes are ready.',
|
|
78
|
+
/** What a screen reader says about the avatar once what the assistant was asked to do is done. */
|
|
79
|
+
'chat.agent.avatar.success': 'Done',
|
|
80
|
+
/** What a screen reader says about the avatar when the assistant's work failed. */
|
|
81
|
+
'chat.agent.avatar.error': 'Something went wrong',
|
|
82
|
+
/** What a screen reader says about the avatar of a person of the team (`{name}` and `{email}`). */
|
|
83
|
+
'chat.member.avatarLabel': '{name} ({email})',
|
|
84
|
+
/** What a screen reader says about the avatar of a person of the team when it is a link that writes to them (`{name}`). */
|
|
85
|
+
'chat.member.emailLabel': 'Email {name}',
|
|
86
|
+
/** The name of a person of the team the page did not tell the chat about. */
|
|
87
|
+
'chat.member.unknown': 'Team member',
|
|
65
88
|
/** Heading when the gateway plan has no title. */
|
|
66
89
|
'chat.plan.title': 'Build plan',
|
|
67
90
|
/** Progress badge on the plan card (`{current}` / `{total}`). */
|
|
@@ -73,9 +96,9 @@ export const CHAT_MESSAGES = {
|
|
|
73
96
|
'chat.messages.attachmentMissingTitle': 'Attachment not available',
|
|
74
97
|
'chat.messages.attachmentMissingLabel': 'Missing file attachment',
|
|
75
98
|
'chat.messages.attachmentMissingCaption': 'Attachment not saved. Re-attach with Upload, then send it again.',
|
|
76
|
-
/**
|
|
99
|
+
/** A failed reply in the docked panel is one short line (this, or what the server said) with a refresh icon that runs the prompt again. */
|
|
77
100
|
'chat.messages.failedTitle': 'Could not build the widget',
|
|
78
|
-
|
|
101
|
+
/** The name of the refresh icon next to a failure: its tooltip and what a screen reader says. */
|
|
79
102
|
'chat.messages.failedRetry': 'Try again',
|
|
80
103
|
/** The line a build the person stopped leaves in the conversation (docked panel): it is their own command, not a failure. */
|
|
81
104
|
'chat.messages.stoppedByYou': 'You stopped the build.',
|
|
@@ -151,7 +174,6 @@ export const CHAT_MESSAGES = {
|
|
|
151
174
|
'chat.input.send': 'Send message',
|
|
152
175
|
'chat.input.tooLong': 'Message is too long',
|
|
153
176
|
'chat.input.publishNudge': 'First generate your widget, then you can publish it.',
|
|
154
|
-
'chat.composer.assistant': 'Assistant',
|
|
155
177
|
'chat.messages.scrollToBottom': 'Scroll to latest messages',
|
|
156
178
|
'chat.messages.clarificationPrompt': 'Which option fits best?',
|
|
157
179
|
'chat.checkpoint.version': 'Version {n}',
|
|
@@ -231,5 +253,21 @@ export const CHAT_MESSAGES = {
|
|
|
231
253
|
'chat.error.recordingActionFailed': 'Recording action failed. Please try again.',
|
|
232
254
|
'chat.error.actionFailed': 'The action failed. Please try again.',
|
|
233
255
|
'chat.error.statusUpdateFailed': 'Failed to update conversation status',
|
|
234
|
-
'chat.error.restoreFailed': 'Failed to restore checkpoint. Please try again.'
|
|
256
|
+
'chat.error.restoreFailed': 'Failed to restore checkpoint. Please try again.',
|
|
257
|
+
// ===== Sketch assistant (canvas drawing turns) =====
|
|
258
|
+
'chat.sketch.drewVideoPlayer': 'Drew a video player: 16:9 thumbnail with a play button and a navigation bar below it.',
|
|
259
|
+
'chat.sketch.movedNavigation': 'Moved the navigation bar below the video thumbnail.',
|
|
260
|
+
'chat.sketch.deletedAll': 'Removed every sketch from the canvas.',
|
|
261
|
+
'chat.sketch.namedComponents': 'Labelled each component and drew an arrow to it.',
|
|
262
|
+
'chat.sketch.addedShapes': 'Added wireframe shapes on the canvas.',
|
|
263
|
+
'chat.sketch.followUp': 'Ask me to move, label, or delete anything on the board.',
|
|
264
|
+
'chat.sketch.genericDone': 'Updated the sketch on the canvas.',
|
|
265
|
+
'chat.sketch.failed': 'Could not update the sketch: {detail}',
|
|
266
|
+
'chat.sketch.failedUnknown': 'Could not update the sketch.',
|
|
267
|
+
'chat.sketch.stepCap': 'Sketch assistant stopped after too many steps.',
|
|
268
|
+
'chat.sketch.noCredits': 'You are out of credits, so I cannot draw right now. Add credits and ask me again.',
|
|
269
|
+
'chat.sketch.busy': 'A sketch is already being drawn, or you have sent too many requests. Try again in a moment.',
|
|
270
|
+
'chat.sketch.unavailable': 'The sketch assistant is not available right now. Please try again in a moment.',
|
|
271
|
+
'chat.sketch.stopped': 'Stopped drawing.',
|
|
272
|
+
'chat.sketch.undoLabel': 'Undo drawing'
|
|
235
273
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Partner-ready overrides for sketch assistant messages (matches ui-sdk locale tags). */
|
|
2
|
+
export const CHAT_SKETCH_LOCALE_MESSAGES = {
|
|
3
|
+
de: {
|
|
4
|
+
'chat.sketch.drewVideoPlayer': 'Video-Player gezeichnet: 16:9-Vorschaubild mit Play-Button und Navigationsleiste darunter.',
|
|
5
|
+
'chat.sketch.movedNavigation': 'Navigationsleiste unter das Vorschaubild verschoben.',
|
|
6
|
+
'chat.sketch.deletedAll': 'Alle Skizzen von der Leinwand entfernt.',
|
|
7
|
+
'chat.sketch.namedComponents': 'Jede Komponente beschriftet und mit einem Pfeil versehen.',
|
|
8
|
+
'chat.sketch.followUp': 'Bitte mich, etwas zu verschieben, zu beschriften oder zu löschen.',
|
|
9
|
+
'chat.sketch.failed': 'Skizze konnte nicht aktualisiert werden: {detail}',
|
|
10
|
+
'chat.sketch.failedUnknown': 'Skizze konnte nicht aktualisiert werden.',
|
|
11
|
+
'chat.sketch.undoLabel': 'Zeichnung rückgängig'
|
|
12
|
+
},
|
|
13
|
+
fr: {
|
|
14
|
+
'chat.sketch.drewVideoPlayer': 'Élément lecteur vidéo : vignette 16:9 avec bouton lecture et barre de navigation en dessous.',
|
|
15
|
+
'chat.sketch.movedNavigation': 'Barre de navigation déplacée sous la vignette.',
|
|
16
|
+
'chat.sketch.deletedAll': 'Toutes les esquisses ont été supprimées du canevas.',
|
|
17
|
+
'chat.sketch.namedComponents': 'Chaque composant est étiqueté avec une flèche.',
|
|
18
|
+
'chat.sketch.followUp': 'Demandez-moi de déplacer, étiqueter ou supprimer un élément.',
|
|
19
|
+
'chat.sketch.failed': "Impossible de mettre à jour l'esquisse : {detail}",
|
|
20
|
+
'chat.sketch.failedUnknown': "Impossible de mettre à jour l'esquisse.",
|
|
21
|
+
'chat.sketch.undoLabel': 'Annuler le dessin'
|
|
22
|
+
},
|
|
23
|
+
es: {
|
|
24
|
+
'chat.sketch.drewVideoPlayer': 'Reproductor dibujado: miniatura 16:9 con botón de reproducción y barra de navegación debajo.',
|
|
25
|
+
'chat.sketch.movedNavigation': 'Barra de navegación movida debajo de la miniatura.',
|
|
26
|
+
'chat.sketch.deletedAll': 'Se eliminaron todos los bocetos del lienzo.',
|
|
27
|
+
'chat.sketch.namedComponents': 'Cada componente tiene una etiqueta y una flecha.',
|
|
28
|
+
'chat.sketch.followUp': 'Pídeme mover, etiquetar o borrar algo del lienzo.',
|
|
29
|
+
'chat.sketch.failed': 'No se pudo actualizar el boceto: {detail}',
|
|
30
|
+
'chat.sketch.failedUnknown': 'No se pudo actualizar el boceto.',
|
|
31
|
+
'chat.sketch.undoLabel': 'Deshacer dibujo'
|
|
32
|
+
},
|
|
33
|
+
it: {
|
|
34
|
+
'chat.sketch.drewVideoPlayer': 'Video player disegnato: anteprima 16:9 con pulsante play e barra di navigazione sotto.',
|
|
35
|
+
'chat.sketch.movedNavigation': 'Barra di navigazione spostata sotto l’anteprima.',
|
|
36
|
+
'chat.sketch.deletedAll': 'Rimossi tutti gli schizzi dalla tela.',
|
|
37
|
+
'chat.sketch.namedComponents': 'Ogni componente ha un’etichetta e una freccia.',
|
|
38
|
+
'chat.sketch.followUp': 'Chiedimi di spostare, etichettare o cancellare qualcosa.',
|
|
39
|
+
'chat.sketch.failed': 'Impossibile aggiornare lo schizzo: {detail}',
|
|
40
|
+
'chat.sketch.failedUnknown': 'Impossibile aggiornare lo schizzo.',
|
|
41
|
+
'chat.sketch.undoLabel': 'Annulla disegno'
|
|
42
|
+
},
|
|
43
|
+
pt: {
|
|
44
|
+
'chat.sketch.drewVideoPlayer': 'Player de vídeo desenhado: miniatura 16:9 com botão play e barra de navegação abaixo.',
|
|
45
|
+
'chat.sketch.movedNavigation': 'Barra de navegação movida para abaixo da miniatura.',
|
|
46
|
+
'chat.sketch.deletedAll': 'Todos os rascunhos foram removidos da tela.',
|
|
47
|
+
'chat.sketch.namedComponents': 'Cada componente foi etiquetado com uma seta.',
|
|
48
|
+
'chat.sketch.followUp': 'Peça para mover, etiquetar ou apagar algo no quadro.',
|
|
49
|
+
'chat.sketch.failed': 'Não foi possível atualizar o rascunho: {detail}',
|
|
50
|
+
'chat.sketch.failedUnknown': 'Não foi possível atualizar o rascunho.',
|
|
51
|
+
'chat.sketch.undoLabel': 'Desfazer desenho'
|
|
52
|
+
},
|
|
53
|
+
pl: {
|
|
54
|
+
'chat.sketch.drewVideoPlayer': 'Narysowano odtwarzacz wideo: miniatura 16:9 z przyciskiem play i paskiem nawigacji poniżej.',
|
|
55
|
+
'chat.sketch.movedNavigation': 'Pasek nawigacji przeniesiony pod miniaturę.',
|
|
56
|
+
'chat.sketch.deletedAll': 'Usunięto wszystkie szkice z kanwy.',
|
|
57
|
+
'chat.sketch.namedComponents': 'Każdy element ma etykietę i strzałkę.',
|
|
58
|
+
'chat.sketch.followUp': 'Poproś o przesunięcie, opisanie lub usunięcie czegoś.',
|
|
59
|
+
'chat.sketch.failed': 'Nie udało się zaktualizować szkicu: {detail}',
|
|
60
|
+
'chat.sketch.failedUnknown': 'Nie udało się zaktualizować szkicu.',
|
|
61
|
+
'chat.sketch.undoLabel': 'Cofnij rysunek'
|
|
62
|
+
},
|
|
63
|
+
nl: {
|
|
64
|
+
'chat.sketch.drewVideoPlayer': 'Videospeler getekend: 16:9-miniatuur met afspeelknop en navigatiebalk eronder.',
|
|
65
|
+
'chat.sketch.movedNavigation': 'Navigatiebalk onder de miniatuur geplaatst.',
|
|
66
|
+
'chat.sketch.deletedAll': 'Alle schetsen van het canvas verwijderd.',
|
|
67
|
+
'chat.sketch.namedComponents': 'Elk onderdeel heeft een label en pijl.',
|
|
68
|
+
'chat.sketch.followUp': 'Vraag me om iets te verplaatsen, te labelen of te verwijderen.',
|
|
69
|
+
'chat.sketch.failed': 'Kon de schets niet bijwerken: {detail}',
|
|
70
|
+
'chat.sketch.failedUnknown': 'Kon de schets niet bijwerken.',
|
|
71
|
+
'chat.sketch.undoLabel': 'Tekening ongedaan maken'
|
|
72
|
+
},
|
|
73
|
+
ja: {
|
|
74
|
+
'chat.sketch.drewVideoPlayer': '動画プレーヤーを描画しました(16:9サムネイル、再生ボタン、下にナビ)。',
|
|
75
|
+
'chat.sketch.movedNavigation': 'ナビゲーションバーをサムネイルの外に移動しました。',
|
|
76
|
+
'chat.sketch.deletedAll': 'キャンバス上のスケッチをすべて削除しました。',
|
|
77
|
+
'chat.sketch.namedComponents': '各コンポーネントにラベルと矢印を追加しました。',
|
|
78
|
+
'chat.sketch.followUp': '移動・ラベル付け・削除を依頼できます。',
|
|
79
|
+
'chat.sketch.failed': 'スケッチを更新できませんでした: {detail}',
|
|
80
|
+
'chat.sketch.failedUnknown': 'スケッチを更新できませんでした。',
|
|
81
|
+
'chat.sketch.undoLabel': '描画を元に戻す'
|
|
82
|
+
}
|
|
83
|
+
};
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { WidgeticChatService, createChatService } from './chatService.js';
|
|
2
2
|
export type { ChatService, ChatInstance, ChatFactory } from '../types/index.js';
|
|
3
|
+
export { startSketchAssistantRequest, sketchAssistantStepRequest, SketchAssistantRequestError } from './sketchAssistantClient.js';
|
|
4
|
+
export type { SketchToolCall, SketchAssistantStartResponse, SketchSceneSummary } from './sketchAssistantClient.js';
|
|
5
|
+
export { runSketchAssistantLoop, describeSketchRequestFailure } from './sketchAssistantOrchestrator.js';
|
|
6
|
+
export type { CanvasSketchExecutor, SketchAssistantLoopResult } from './sketchAssistantOrchestrator.js';
|
|
7
|
+
export { buildSketchAssistantReply } from './sketchAssistantReply.js';
|
package/dist/services/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
// Chat Service
|
|
2
2
|
export { WidgeticChatService, createChatService } from './chatService.js';
|
|
3
|
+
export { startSketchAssistantRequest, sketchAssistantStepRequest, SketchAssistantRequestError } from './sketchAssistantClient.js';
|
|
4
|
+
export { runSketchAssistantLoop, describeSketchRequestFailure } from './sketchAssistantOrchestrator.js';
|
|
5
|
+
export { buildSketchAssistantReply } from './sketchAssistantReply.js';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed client for POST /agent/sketch (base URL already includes `/v1`) until the generated SDK exposes it.
|
|
3
|
+
*/
|
|
4
|
+
export interface SketchToolCall {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
arguments: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface SketchAssistantStartResponse {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
step: number;
|
|
12
|
+
status: 'tool_calls' | 'completed' | 'failed' | 'disabled';
|
|
13
|
+
toolCalls?: SketchToolCall[];
|
|
14
|
+
message?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SketchSceneSummary {
|
|
18
|
+
bounds?: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** How many top-level elements the canvas has when `elements` lists only some of them. */
|
|
23
|
+
totalCount?: number;
|
|
24
|
+
elements?: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
kind: string;
|
|
27
|
+
label: string;
|
|
28
|
+
bbox?: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/** The status of a request that got no answer at all (offline, the gateway down), which is no HTTP status. */
|
|
37
|
+
export declare const SKETCH_ASSISTANT_NO_ANSWER_STATUS = 0;
|
|
38
|
+
/**
|
|
39
|
+
* What the gateway answered when it did not take a request: the HTTP status, the code of its error envelope
|
|
40
|
+
* (for example `BILLING_INSUFFICIENT_CREDITS`) and its own sentence. A request that got no answer has the status
|
|
41
|
+
* `SKETCH_ASSISTANT_NO_ANSWER_STATUS`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class SketchAssistantRequestError extends Error {
|
|
44
|
+
readonly status: number;
|
|
45
|
+
readonly code: string | null;
|
|
46
|
+
constructor(message: string, status: number, code?: string | null);
|
|
47
|
+
}
|
|
48
|
+
export declare function startSketchAssistantRequest(input: {
|
|
49
|
+
apiBaseUrl: string;
|
|
50
|
+
authToken: string | null;
|
|
51
|
+
prompt: string;
|
|
52
|
+
sceneSummary?: SketchSceneSummary;
|
|
53
|
+
conversationId?: string | null;
|
|
54
|
+
canvasId?: string | null;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
}): Promise<SketchAssistantStartResponse>;
|
|
57
|
+
export declare function sketchAssistantStepRequest(input: {
|
|
58
|
+
apiBaseUrl: string;
|
|
59
|
+
authToken: string | null;
|
|
60
|
+
sessionId: string;
|
|
61
|
+
step: number;
|
|
62
|
+
toolResults?: Array<{
|
|
63
|
+
toolCallId: string;
|
|
64
|
+
result: Record<string, unknown>;
|
|
65
|
+
}>;
|
|
66
|
+
sceneSummary?: SketchSceneSummary;
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
}): Promise<SketchAssistantStartResponse>;
|