@widgetic/chat 0.1.43 → 0.1.44

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.
@@ -2358,7 +2358,7 @@
2358
2358
  <div class="{panelLayout ? 'panel-messages-shell flex h-full min-h-0 w-full flex-1 flex-col' : 'contents'}">
2359
2359
  <div
2360
2360
  bind:this={messagesContainer}
2361
- class="{className ? className : 'prompt-chat-messages-ct'} prompt-chat-messages-scroll flex flex-col {panelLayout && showEmptyState && !isLoading && !isGenerating ? 'overflow-y-hidden pb-0' : 'overflow-y-auto'} {panelLayout ? (showEmptyState && !isLoading && !isGenerating ? 'min-h-0 flex-1' : 'min-h-0 flex-1 pb-4') : 'space-y-4 pb-3'}"
2361
+ class="{className ? className : 'prompt-chat-messages-ct'} prompt-chat-messages-scroll flex flex-col overflow-y-auto {panelLayout && showEmptyState && !isLoading && !isGenerating ? 'pb-0' : ''} {panelLayout ? (showEmptyState && !isLoading && !isGenerating ? 'min-h-0 flex-1' : 'min-h-0 flex-1 pb-4') : 'space-y-4 pb-3'}"
2362
2362
  class:loading={isLoading}
2363
2363
  style={panelLayout
2364
2364
  ? `padding: 8px 16px ${showEmptyState && !isLoading && !isGenerating ? 0 : 16}px; overflow-anchor: none;`
@@ -2373,9 +2373,13 @@
2373
2373
  <!-- Figma: Chat / Empty. The hero (a circle with the sparkles icon, the title and a line under it) sits in the
2374
2374
  middle of the messages, and the suggestions are pinned under it, above the composer. The block takes the
2375
2375
  free height with flex-1 (not min-h-full): the sticky scroll-to-bottom row below it needs its own room, and a
2376
- block as tall as the whole area would push it out and make the list scroll. -->
2377
- <div class="empty-state-ct flex w-full flex-col gap-4 {panelLayout ? 'shrink-0' : 'flex-1'}">
2378
- <div class="empty-state-hero flex shrink-0 flex-col items-center justify-center gap-3 text-center {panelLayout ? 'h-[508px]' : 'min-h-0 flex-1 px-2'}">
2376
+ block as tall as the whole area would push it out and make the list scroll.
2377
+ In the panel the hero takes whatever height the suggestions leave and keeps its content in the middle of it, so
2378
+ it stays centered whatever the height of the window is (at the Figma frame's 700px the hero is its 508px, as
2379
+ before). A fixed 508px kept it high in a tall chat and, in a short one, pushed it behind the composer. The 96px
2380
+ it never goes below (min-h-24) is the height of the circle, the title and the line; under that the list scrolls. -->
2381
+ <div class="empty-state-ct flex w-full flex-1 flex-col gap-4">
2382
+ <div class="empty-state-hero flex flex-col items-center justify-center gap-3 text-center {panelLayout ? 'min-h-24 flex-1' : 'min-h-0 flex-1 px-2'}">
2379
2383
  <span class="empty-state-icon-circle bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-full" aria-hidden="true">
2380
2384
  <IconSparkles class="size-4 stroke-2" />
2381
2385
  </span>
@@ -1,7 +1,7 @@
1
1
  export { WidgeticChatService, createChatService } from './chatService.js';
2
2
  export type { ChatService, ChatInstance, ChatFactory } from '../types/index.js';
3
3
  export { startSketchAssistantRequest, sketchAssistantStepRequest, SketchAssistantRequestError } from './sketchAssistantClient.js';
4
- export type { SketchToolCall, SketchAssistantStartResponse, SketchSceneSummary } from './sketchAssistantClient.js';
4
+ export type { SketchToolCall, SketchAssistantStartResponse, SketchSceneSummary, SketchAssistantContext } from './sketchAssistantClient.js';
5
5
  export { runSketchAssistantLoop, describeSketchRequestFailure } from './sketchAssistantOrchestrator.js';
6
6
  export type { CanvasSketchExecutor, SketchAssistantLoopResult } from './sketchAssistantOrchestrator.js';
7
7
  export { buildSketchAssistantReply } from './sketchAssistantReply.js';
@@ -33,6 +33,31 @@ export interface SketchSceneSummary {
33
33
  };
34
34
  }>;
35
35
  }
36
+ /**
37
+ * What the page tells the assistant about the person besides the canvas (`sketchContext` of `POST /agent/sketch`): the colours and
38
+ * fonts of their brand kit, and the pictures it may place with `add_asset` (SVG icons of the brand kit, files of their File Browser).
39
+ * The assistant is told the names and ids only: the canvas keeps the same list (`sketchAssets` of `@widgetic/canvas`) and draws the
40
+ * asset an id names. Sent with the start of a request, never with the steps (the model keeps the first message).
41
+ */
42
+ export interface SketchAssistantContext {
43
+ assets?: Array<{
44
+ id: string;
45
+ name: string;
46
+ source: 'brand-icon' | 'library';
47
+ mimeType?: string;
48
+ }>;
49
+ brand?: {
50
+ colors?: Array<{
51
+ name: string;
52
+ hex: string;
53
+ role?: string;
54
+ }>;
55
+ fonts?: Array<{
56
+ family: string;
57
+ role?: string;
58
+ }>;
59
+ };
60
+ }
36
61
  /** The status of a request that got no answer at all (offline, the gateway down), which is no HTTP status. */
37
62
  export declare const SKETCH_ASSISTANT_NO_ANSWER_STATUS = 0;
38
63
  /**
@@ -52,6 +77,8 @@ export declare function startSketchAssistantRequest(input: {
52
77
  sceneSummary?: SketchSceneSummary;
53
78
  conversationId?: string | null;
54
79
  canvasId?: string | null;
80
+ /** The brand colours, fonts and assets of the person (see `SketchAssistantContext`). Left out of the request when missing. */
81
+ sketchContext?: SketchAssistantContext;
55
82
  signal?: AbortSignal;
56
83
  }): Promise<SketchAssistantStartResponse>;
57
84
  export declare function sketchAssistantStepRequest(input: {
@@ -63,6 +63,7 @@ export async function startSketchAssistantRequest(input) {
63
63
  return postJson(input.apiBaseUrl, '/agent/sketch', {
64
64
  prompt: input.prompt,
65
65
  sceneSummary: input.sceneSummary,
66
+ sketchContext: input.sketchContext,
66
67
  conversationId: input.conversationId,
67
68
  canvasId: input.canvasId
68
69
  }, input.authToken, input.signal);
@@ -1,4 +1,4 @@
1
- import { type SketchSceneSummary } from './sketchAssistantClient.js';
1
+ import { type SketchAssistantContext, type SketchSceneSummary } from './sketchAssistantClient.js';
2
2
  import { type SketchToolTrace } from './sketchAssistantReply.js';
3
3
  import type { Translate } from '@widgetic/design-system/i18n';
4
4
  import type { ChatMessageKey } from '../i18n/messages.js';
@@ -33,6 +33,11 @@ export declare function runSketchAssistantLoop(input: {
33
33
  executor: CanvasSketchExecutor;
34
34
  conversationId?: string | null;
35
35
  canvasId?: string | null;
36
+ /**
37
+ * The brand colours and fonts of the person and the assets the model may place with `add_asset`: told to the model once, with the
38
+ * request (the canvas holds the same assets, see `sketchAssets` of `@widgetic/canvas`). Missing: the model draws without them.
39
+ */
40
+ sketchContext?: SketchAssistantContext;
36
41
  maxSteps?: number;
37
42
  translate?: Translate<ChatMessageKey>;
38
43
  /** Stops the run between requests, and the request that is on its way. */
@@ -53,6 +53,7 @@ export async function runSketchAssistantLoop(input) {
53
53
  sceneSummary: input.executor.getSceneSummary(),
54
54
  conversationId: input.conversationId,
55
55
  canvasId: input.canvasId,
56
+ sketchContext: input.sketchContext,
56
57
  signal: input.signal
57
58
  });
58
59
  input.executor.beginToolBatch?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/chat",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",