@xpert-ai/chatkit-types 0.9.0 → 0.11.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/dist/index.d.ts CHANGED
@@ -36,6 +36,46 @@ export declare interface ApprovalHostReference {
36
36
  expiresAt: number;
37
37
  }
38
38
 
39
+ /** IDs are resource identifiers, not a closed list of bundled presets. */
40
+ export declare type AssistantAppearance = {
41
+ version: 1;
42
+ kind: 'image';
43
+ } | {
44
+ version: 1;
45
+ kind: 'character';
46
+ id: string;
47
+ color: string;
48
+ config?: AssistantCharacterConfig;
49
+ } | {
50
+ version: 1;
51
+ kind: 'pet';
52
+ id: string;
53
+ /** Sprite layout version; omitted by legacy v1 avatars. */
54
+ spriteVersionNumber?: 1 | 2;
55
+ asset?: {
56
+ type: 'sprite-atlas' | 'animated-image';
57
+ url: string;
58
+ };
59
+ };
60
+
61
+ export declare type AssistantCharacterConfig = {
62
+ shape: 'round' | 'pebble' | 'pill' | 'drop' | 'flame' | 'triangle' | 'square' | 'bag' | 'star' | 'heart' | 'cloud' | 'clover';
63
+ eyes: 'oval' | 'toon' | 'pill' | 'dot' | 'ring' | 'happy' | 'sleepy' | 'wink' | 'plus' | 'slash' | 'squint';
64
+ mouth: 'none' | 'smile' | 'open' | 'neutral' | 'o';
65
+ motion: 'float' | 'bounce' | 'sway' | 'none';
66
+ eyeSize: number;
67
+ eyeSpacing: number;
68
+ brows?: 'none' | 'flat' | 'angry' | 'worried' | 'raised';
69
+ ink?: 'auto' | 'dark' | 'light';
70
+ tilt?: number;
71
+ speed?: number;
72
+ blink?: boolean;
73
+ };
74
+
75
+ export declare type AssistantCustomizeEffect = {
76
+ assistantId: string;
77
+ };
78
+
39
79
  /**
40
80
  * strategies to host files before attaching them to messages.
41
81
  */
@@ -162,6 +202,15 @@ export declare type Button = {
162
202
  disabled?: boolean;
163
203
  };
164
204
 
205
+ /** A persisted timeline event. It is never submitted as a model input. */
206
+ export declare type CallEndedContent = {
207
+ type: 'call_ended';
208
+ sessionId: string;
209
+ startedAt: string | null;
210
+ endedAt: string;
211
+ durationSeconds: number;
212
+ };
213
+
165
214
  export declare type Caption = {
166
215
  type: 'Caption';
167
216
  key?: string;
@@ -220,6 +269,8 @@ export declare type ChatFileChange = {
220
269
  updatedAt?: string;
221
270
  };
222
271
 
272
+ export declare const CHATKIT_ASSISTANT_CUSTOMIZE_EFFECT = "assistant.customize";
273
+
223
274
  export declare const CHATKIT_TASK_SUMMARY_OPEN_RESOURCE_EFFECT: "task_summary.open_resource";
224
275
 
225
276
  export declare interface ChatKitApprovalsOptions {
@@ -231,6 +282,18 @@ export declare interface ChatKitApprovalsOptions {
231
282
  onAction?: (input: ApprovalActionRequest) => Promise<void> | void;
232
283
  }
233
284
 
285
+ /** Computer shortcuts in the Assistant details dialog. Remote targets use registered View keys. */
286
+ export declare type ChatKitAssistantComputers = {
287
+ cloud?: {
288
+ viewKey: string;
289
+ };
290
+ /** Host-reported local Shell state; opening emits assistant.computer.open with kind: local. */
291
+ local?: {
292
+ name?: string;
293
+ status: 'loading' | 'unavailable' | 'disabled' | 'ready' | 'connected' | 'error';
294
+ };
295
+ };
296
+
234
297
  export declare type ChatKitClientSecretObject = {
235
298
  secret: string;
236
299
  organizationId?: string;
@@ -543,6 +606,8 @@ export declare type ChatKitOptions = {
543
606
  * @default false
544
607
  */
545
608
  pet?: boolean | ChatKitPetOptions;
609
+ /** Realtime voice controls in the assistant's appearance panel. */
610
+ realtimeVoice?: RealtimeVoiceOptions;
546
611
  /**
547
612
  * The ID of the thread to show when ChatKit is mounted or opened for the first time.
548
613
  * Passing `null` will show the new thread view.
@@ -581,6 +646,15 @@ export declare type ChatKitOptions = {
581
646
  */
582
647
  header?: {
583
648
  enabled?: boolean;
649
+ /** Center the published Assistant character in bubble mode. Defaults to true. */
650
+ character?: {
651
+ enabled?: boolean;
652
+ /** Shows customization actions, emitted as the assistant.customize public effect. */
653
+ customizable?: boolean;
654
+ computers?: ChatKitAssistantComputers;
655
+ /** Honor an explicit reduced-animation preference in addition to the OS setting. */
656
+ reducedMotion?: boolean;
657
+ };
584
658
  /** Enable native Electron dragging/OS double-click behavior on unused chat and Workbench header space. Defaults to false. */
585
659
  windowDrag?: boolean;
586
660
  /**
@@ -796,6 +870,8 @@ export declare type ChatKitPetBoundsPadding = {
796
870
  export declare type ChatKitPetCharacter = {
797
871
  type: 'sprite-atlas';
798
872
  src: string;
873
+ /** v1: 8 × 9; v2: 8 × 11, with 16 directional poses in the final two rows. */
874
+ spriteVersionNumber?: 1 | 2;
799
875
  atlas?: ChatKitPetSpriteAtlas;
800
876
  };
801
877
 
@@ -1377,6 +1453,12 @@ export declare type Col = {
1377
1453
 
1378
1454
  export declare type ColorScheme = 'light' | 'dark';
1379
1455
 
1456
+ export declare type CompletedVoiceCall = {
1457
+ id: string;
1458
+ threadId: string;
1459
+ content: CallEndedContent;
1460
+ };
1461
+
1380
1462
  /** Reason codes emitted by context-compression events. */
1381
1463
  export declare type ContextCompressionReason = 'no_messages' | 'no_unprotected_history' | 'no_token_gain' | 'summary_invalid' | 'summary_input_budget' | 'summary_output_budget' | 'summary_work_limit' | 'summary_constraints_lost' | 'summary_service_error' | 'retry_deferred' | 'context_budget_exceeded' | 'context_validation_failed';
1382
1464
 
@@ -1434,6 +1516,10 @@ declare type CustomApiConfig = {
1434
1516
  xpertId?: string;
1435
1517
  };
1436
1518
 
1519
+ export declare function customCharacterSvg(appearance: Extract<AssistantAppearance, {
1520
+ kind: 'character';
1521
+ }>, state?: string, animate?: boolean): string;
1522
+
1437
1523
  export declare type DatePicker = {
1438
1524
  type: 'DatePicker';
1439
1525
  key?: string;
@@ -1465,6 +1551,8 @@ export declare const DEFAULT_PET_SPRITESHEET_URL = "/pets/boba/spritesheet.webp"
1465
1551
 
1466
1552
  export declare const DEFAULT_PET_STORAGE_KEY = "chatkit:pet:position:v1";
1467
1553
 
1554
+ export declare const defaultCharacterConfig: AssistantCharacterConfig;
1555
+
1468
1556
  export declare type Divider = {
1469
1557
  type: 'Divider';
1470
1558
  key?: string;
@@ -1866,6 +1954,8 @@ export declare type InterruptRequest = ToolCallRequest | ClientToolRequest | HIT
1866
1954
 
1867
1955
  export declare function isApprovalHostReference(value: unknown): value is ApprovalHostReference;
1868
1956
 
1957
+ export declare function isCallEndedContent(value: unknown): value is CallEndedContent;
1958
+
1869
1959
  export declare function isClientToolInterrupt(value: unknown): value is ClientToolInterrupt;
1870
1960
 
1871
1961
  export declare function isClientToolInterruptPayload(value: unknown): value is ClientToolInterruptPayload;
@@ -1975,7 +2065,7 @@ export declare function mergeChatSkillUsages(...groups: ReadonlyArray<readonly C
1975
2065
  /** Collapse observed operations to the net change, retaining immutable first/last review references. */
1976
2066
  export declare function mergeFileChanges(items: ChatFileChange[]): ChatFileChange[];
1977
2067
 
1978
- export declare function mergePetSpriteAtlas(override?: ChatKitPetSpriteAtlas): PetSpriteAtlasDefinition;
2068
+ export declare function mergePetSpriteAtlas(override?: ChatKitPetSpriteAtlas, spriteVersionNumber?: 1 | 2): PetSpriteAtlasDefinition;
1979
2069
 
1980
2070
  export declare type MessageContentImageUrl = {
1981
2071
  type: 'image_url';
@@ -2046,6 +2136,8 @@ export declare function normalizeRequestLanguage(locale?: string | null): string
2046
2136
 
2047
2137
  export declare function normalizeThreadReference(value: unknown): ChatKitThreadReference | null;
2048
2138
 
2139
+ export declare function parseAssistantAppearance(value: unknown): AssistantAppearance | undefined;
2140
+
2049
2141
  export declare function parseFileActivityContent(value: unknown): TMessageContentFileActivity | null;
2050
2142
 
2051
2143
  export declare function parseFileChangeReport(value: unknown): FileChangeReport | null;
@@ -2063,6 +2155,12 @@ export declare type PetFrameAnimationDefinition = {
2063
2155
  frameDurations: readonly number[];
2064
2156
  };
2065
2157
 
2158
+ /** v2's 16 poses are clockwise from up; a central dead zone restores idle. */
2159
+ export declare function petLookFrame(dx: number, dy: number, deadZone?: number): {
2160
+ row: number;
2161
+ column: number;
2162
+ } | null;
2163
+
2066
2164
  export declare type PetPosition = {
2067
2165
  x: number;
2068
2166
  y: number;
@@ -2173,6 +2271,47 @@ export declare type RadioGroup = {
2173
2271
 
2174
2272
  declare type RadiusValue = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full' | '100%' | 'none';
2175
2273
 
2274
+ export declare type RealtimeVoiceCall = {
2275
+ id: string;
2276
+ assistantId: string;
2277
+ threadId: string | null;
2278
+ name: string;
2279
+ state: 'connecting' | 'listening' | 'speaking' | 'ended' | 'error';
2280
+ muted: boolean;
2281
+ startedAt?: string;
2282
+ caption?: string;
2283
+ /** Safe, localized host diagnostic; never a raw supplier error. */
2284
+ notice?: string;
2285
+ tasks?: {
2286
+ id: string;
2287
+ label: string;
2288
+ text?: string;
2289
+ pending?: boolean;
2290
+ }[];
2291
+ };
2292
+
2293
+ export declare type RealtimeVoiceCommand = {
2294
+ type: 'start';
2295
+ assistantId: string;
2296
+ threadId: string | null;
2297
+ } | {
2298
+ type: 'mute';
2299
+ callId: string;
2300
+ muted: boolean;
2301
+ } | {
2302
+ type: 'interrupt' | 'end' | 'dismiss' | 'open';
2303
+ callId: string;
2304
+ };
2305
+
2306
+ /** The host owns audio and authentication; ChatKit owns the call surfaces. */
2307
+ export declare type RealtimeVoiceOptions = {
2308
+ enabled: boolean;
2309
+ call?: RealtimeVoiceCall | null;
2310
+ /** Server-confirmed records, merged by ID until conversation history catches up. */
2311
+ completed?: CompletedVoiceCall[];
2312
+ onCommand: (command: RealtimeVoiceCommand) => void | Promise<void>;
2313
+ };
2314
+
2176
2315
  export declare const REQUEST_USER_INPUT_RESULT_PURPOSE_IMPLEMENTATION_CONFIRMATION = "implementation_confirmation";
2177
2316
 
2178
2317
  export declare const REQUEST_USER_INPUT_RESULT_PURPOSE_PLAN_CLARIFICATION = "plan_clarification";
@@ -2774,7 +2913,7 @@ export declare type TMessageContent = string | TMessageContentComplex[];
2774
2913
  /**
2775
2914
  * Enhance {@link MessageContentComplex} in Langchain.js
2776
2915
  */
2777
- export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentFileActivity | TMessageContentResourceCard | TMessageContentMemory | (Record<string, any> & {
2916
+ export declare type TMessageContentComplex = (CallEndedContent | TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentFileActivity | TMessageContentResourceCard | TMessageContentMemory | (Record<string, any> & {
2778
2917
  type?: 'text' | 'image_url' | string;
2779
2918
  }) | (Record<string, any> & {
2780
2919
  type?: never;
package/dist/index.js CHANGED
@@ -415,6 +415,170 @@ function normalizeThreadReference(value) {
415
415
  function isLocator(value) {
416
416
  return typeof value === "string" && value.trim().length > 0 && value.length <= 128;
417
417
  }
418
+ const CHATKIT_ASSISTANT_CUSTOMIZE_EFFECT = "assistant.customize";
419
+ function parseAssistantAppearance(value) {
420
+ if (!value || typeof value !== "object" || !("version" in value) || value.version !== 1 || !("kind" in value))
421
+ return;
422
+ if (value.kind === "image") return { version: 1, kind: "image" };
423
+ if (!("id" in value) || typeof value.id !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,99}$/.test(value.id))
424
+ return;
425
+ if (value.kind === "character" && "color" in value && typeof value.color === "string" && /^#[0-9a-f]{6}$/i.test(value.color)) {
426
+ if ("config" in value && value.config !== void 0 && !isCharacterConfig(value.config))
427
+ return;
428
+ return value;
429
+ }
430
+ if (value.kind === "pet") {
431
+ if ("spriteVersionNumber" in value && value.spriteVersionNumber !== void 0 && value.spriteVersionNumber !== 1 && value.spriteVersionNumber !== 2) return;
432
+ if ("asset" in value && value.asset !== void 0) {
433
+ const asset = value.asset;
434
+ if (!asset || typeof asset !== "object" || !("type" in asset) || !["sprite-atlas", "animated-image"].includes(String(asset.type)) || !("url" in asset) || typeof asset.url !== "string" || asset.url.length > 4096 || !/^(https?:\/\/|\/(?!\/))/.test(asset.url))
435
+ return;
436
+ }
437
+ return value;
438
+ }
439
+ }
440
+ function isCharacterConfig(value) {
441
+ return !!value && typeof value === "object" && "shape" in value && [
442
+ "round",
443
+ "pebble",
444
+ "pill",
445
+ "drop",
446
+ "flame",
447
+ "triangle",
448
+ "square",
449
+ "bag",
450
+ "star",
451
+ "heart",
452
+ "cloud",
453
+ "clover"
454
+ ].includes(String(value.shape)) && "eyes" in value && [
455
+ "oval",
456
+ "toon",
457
+ "pill",
458
+ "dot",
459
+ "ring",
460
+ "happy",
461
+ "sleepy",
462
+ "wink",
463
+ "plus",
464
+ "slash",
465
+ "squint"
466
+ ].includes(String(value.eyes)) && "mouth" in value && ["none", "smile", "open", "neutral", "o"].includes(String(value.mouth)) && "motion" in value && ["float", "bounce", "sway", "none"].includes(String(value.motion)) && "eyeSize" in value && typeof value.eyeSize === "number" && Number.isFinite(value.eyeSize) && value.eyeSize >= 0.6 && value.eyeSize <= 1.5 && "eyeSpacing" in value && typeof value.eyeSpacing === "number" && Number.isFinite(value.eyeSpacing) && value.eyeSpacing >= 0.55 && value.eyeSpacing <= 1.6 && (!("brows" in value) || value.brows === void 0 || ["none", "flat", "angry", "worried", "raised"].includes(
467
+ String(value.brows)
468
+ )) && (!("ink" in value) || value.ink === void 0 || ["auto", "dark", "light"].includes(String(value.ink))) && (!("tilt" in value) || value.tilt === void 0 || typeof value.tilt === "number" && Number.isFinite(value.tilt) && value.tilt >= -15 && value.tilt <= 15) && (!("speed" in value) || value.speed === void 0 || typeof value.speed === "number" && Number.isFinite(value.speed) && value.speed >= 0.5 && value.speed <= 2) && (!("blink" in value) || value.blink === void 0 || typeof value.blink === "boolean");
469
+ }
470
+ const defaultCharacterConfig = {
471
+ shape: "round",
472
+ eyes: "oval",
473
+ mouth: "smile",
474
+ motion: "float",
475
+ eyeSize: 1,
476
+ eyeSpacing: 1,
477
+ brows: "none",
478
+ ink: "auto",
479
+ tilt: 0,
480
+ speed: 1,
481
+ blink: true
482
+ };
483
+ const shapes = {
484
+ round: '<circle cx="100" cy="100" r="65"/>',
485
+ pebble: '<path d="M34 96 C37 49 77 28 114 38 C161 42 177 84 163 128 C155 164 109 176 68 157 C43 149 30 121 34 96Z"/>',
486
+ pill: '<rect x="26" y="51" width="148" height="99" rx="49"/>',
487
+ drop: '<path d="M100 24 C87 46 39 72 39 111 C39 174 161 174 161 111 C161 72 113 46 100 24Z"/>',
488
+ flame: '<path d="M114 22 C108 59 159 57 164 109 C174 179 35 187 35 118 C34 94 45 79 62 64 C59 89 71 92 74 75 C76 48 96 30 114 22Z"/>',
489
+ triangle: '<path d="M86 35 Q100 13 114 35 L177 142 Q188 165 161 167 L39 167 Q12 165 24 142Z"/>',
490
+ square: '<rect x="37" y="37" width="126" height="126" rx="34"/>',
491
+ bag: '<path d="M78 56 V37 Q78 30 86 30 H114 Q122 30 122 37 V56" fill="none" stroke="currentColor" stroke-width="8"/><rect x="29" y="52" width="142" height="111" rx="22"/>',
492
+ star: '<path d="M92 30 Q100 14 108 30 L126 64 L166 70 Q185 72 171 87 L143 113 L149 152 Q153 172 135 164 L100 144 L65 164 Q47 172 51 152 L57 113 L29 87 Q15 72 34 70 L74 64Z"/>',
493
+ heart: '<path d="M100 60 C58 2 6 49 32 101 C45 129 71 151 100 171 C129 151 155 129 168 101 C194 49 142 2 100 60Z"/>',
494
+ cloud: '<path d="M48 153 C3 152 15 92 45 87 C42 40 93 30 114 58 C150 27 182 68 168 99 C199 139 163 165 133 152 C108 174 75 168 65 152Z"/>',
495
+ clover: '<path d="M100 49 C143 -1 200 63 151 100 C201 141 140 200 100 151 C60 200 -1 141 49 100 C0 60 60 0 100 49Z"/>'
496
+ };
497
+ const finite = (value, fallback, min, max) => typeof value === "number" && Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback;
498
+ function customCharacterSvg(appearance, state = "idle", animate = false) {
499
+ const config = { ...defaultCharacterConfig, ...appearance.config };
500
+ const color = /^#[0-9a-f]{6}$/i.test(appearance.color) ? appearance.color : "#7c6ee6";
501
+ const luminance = [1, 3, 5].map((start) => {
502
+ const channel = parseInt(color.slice(start, start + 2), 16) / 255;
503
+ return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
504
+ });
505
+ const darkBackground = luminance[0] * 0.2126 + luminance[1] * 0.7152 + luminance[2] * 0.0722 < 0.18;
506
+ const ink = config.ink === "light" ? "#ffffff" : config.ink === "dark" ? "#20212c" : darkBackground ? "#ffffff" : "#20212c";
507
+ const speed = finite(config.speed, 1, 0.5, 2);
508
+ const tilt = finite(config.tilt, 0, -15, 15);
509
+ const eyeSize = finite(config.eyeSize, 1, 0.6, 1.5);
510
+ const gap = finite(config.eyeSpacing, 1, 0.55, 1.6) * 18;
511
+ const moving = animate && config.motion !== "none";
512
+ const thinking = state === "review";
513
+ const working = state === "running" || state === "running-right" || state === "running-left";
514
+ const success = state === "waving" || state === "jumping";
515
+ const sleeping = state === "sleeping";
516
+ const alarm = state === "waiting";
517
+ const faceScale = [
518
+ "drop",
519
+ "flame",
520
+ "triangle",
521
+ "star",
522
+ "heart",
523
+ "clover"
524
+ ].includes(config.shape) ? 0.78 : 1;
525
+ const faceY = ["drop", "triangle", "flame"].includes(config.shape) ? 10 : 0;
526
+ const eyes = sleeping ? "sleepy" : success ? "happy" : config.eyes;
527
+ const brows = alarm || state === "failed" ? "worried" : config.brows;
528
+ const blink = moving && config.blink !== false && !sleeping ? `<animateTransform attributeName="transform" type="scale" values="1 1;1 1;1 .1;1 1;1 1" keyTimes="0;.83;.87;.91;1" dur="${4.5 / speed}s" repeatCount="indefinite"/>` : "";
529
+ const eye = (x, right) => {
530
+ let drawing;
531
+ switch (eyes) {
532
+ case "happy":
533
+ drawing = '<path d="M-7 1 Q0 -11 7 1"/>';
534
+ break;
535
+ case "sleepy":
536
+ drawing = '<path d="M-7 0 Q0 4 7 0"/>';
537
+ break;
538
+ case "plus":
539
+ drawing = '<path d="M-7 0 H7 M0 -7 V7"/>';
540
+ break;
541
+ case "slash":
542
+ drawing = '<path d="M-5 7 L5 -7"/>';
543
+ break;
544
+ case "squint":
545
+ drawing = `<path d="${right ? "M5 -7 L-3 0 L5 7" : "M-5 -7 L3 0 L-5 7"}"/>`;
546
+ break;
547
+ case "ring":
548
+ drawing = '<ellipse rx="6" ry="8" stroke-width="3"/>';
549
+ break;
550
+ case "dot":
551
+ drawing = `<circle r="4.5" fill="${ink}" stroke="none"/>`;
552
+ break;
553
+ case "pill":
554
+ drawing = `<rect x="-3" y="-9" width="6" height="18" rx="3" fill="${ink}" stroke="none"/>`;
555
+ break;
556
+ case "wink":
557
+ if (right) {
558
+ drawing = '<path d="M-6 -5 L3 0 L-6 5"/>';
559
+ break;
560
+ }
561
+ case "toon":
562
+ drawing = `<ellipse rx="9" ry="11" fill="#ffffff" stroke="#20212c" stroke-width="1"/><ellipse cx="${thinking ? 2 : 0}" cy="${thinking ? -3 : working ? 3 : 1}" rx="4" ry="6" fill="#20212c" stroke="none"/>`;
563
+ break;
564
+ default:
565
+ drawing = `<ellipse rx="5" ry="8" fill="${ink}" stroke="none"/>`;
566
+ }
567
+ return `<g transform="translate(${x} 97)"><g>${["oval", "toon", "dot", "ring", "pill", "wink"].includes(eyes) ? blink : ""}${drawing}</g></g>`;
568
+ };
569
+ const brow = (x, right) => {
570
+ const lift = right ? -1 : 1;
571
+ const path = brows === "flat" ? "M-8 -17 H8" : brows === "angry" ? `M-8 ${-21 - 4 * lift} L8 ${-21 + 4 * lift}` : brows === "worried" ? `M-8 ${-21 + 4 * lift} L8 ${-21 - 4 * lift}` : brows === "raised" ? right ? "M-8 -21 Q0 -30 8 -21" : "M-8 -18 H8" : "";
572
+ return path ? `<path transform="translate(${x} 97)" d="${path}" stroke-width="3"/>` : "";
573
+ };
574
+ const mouth = state === "failed" ? '<path d="M88 130 Q100 116 112 130"/>' : alarm || thinking ? '<ellipse cx="100" cy="127" rx="4" ry="5"/>' : success || config.mouth === "open" ? `<path d="M87 123 Q100 128 113 123 Q111 144 100 144 Q89 144 87 123Z" fill="${ink}"/>` : config.mouth === "none" ? "" : config.mouth === "neutral" || sleeping ? '<path d="M91 127 H109"/>' : config.mouth === "o" ? '<ellipse cx="100" cy="127" rx="5" ry="7"/>' : '<path d="M87 125 Q100 138 113 125"/>';
575
+ const animation = !moving ? "" : state === "failed" ? `<animateTransform attributeName="transform" type="translate" values="0 0;-3 0;3 0;0 0" dur="${0.4 / speed}s" repeatCount="2"/>` : config.motion === "sway" ? `<animateTransform attributeName="transform" type="rotate" values="-5 100 130;5 100 130;-5 100 130" dur="${2.4 / speed}s" repeatCount="indefinite"/>` : `<animateTransform attributeName="transform" type="translate" values="0 0;0 ${success || config.motion === "bounce" ? -12 : sleeping ? -2 : -5};0 0" dur="${(success || config.motion === "bounce" ? 1.1 : sleeping ? 4 : 3) / speed}s" repeatCount="indefinite"/>`;
576
+ const pulse = moving ? `<animate attributeName="opacity" values=".35;1;.35" dur="${1.5 / speed}s" repeatCount="indefinite"/>` : "";
577
+ const activity = thinking ? `<g fill="${ink}" opacity=".6"><circle cx="153" cy="49" r="3"/><circle cx="161" cy="39" r="5"/><circle cx="174" cy="26" r="7"/>${pulse}</g>` : working ? `<g fill="none" stroke="${ink}" stroke-width="3" stroke-linecap="round"><path d="M158 142 H175 M158 150 H183 M158 158 H171"/>${pulse}</g>` : alarm ? `<g fill="${ink}"><circle cx="161" cy="46" r="10"/><path d="M161 40 V47 M161 51 V52" stroke="${color}" stroke-width="2.5"/>${pulse}</g>` : sleeping ? `<path d="M150 60 H163 L151 72 H164 M169 35 H184 L170 48 H185" fill="none" stroke="${ink}" opacity=".5" stroke-width="3"/>` : state === "listening" ? `<g fill="none" stroke="${ink}" stroke-width="3" stroke-linecap="round"><path d="M167 84 V108 M175 91 V101"/>${pulse}</g>` : "";
578
+ const shift = thinking ? "3 -3" : working ? "1 3" : "0 0";
579
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><ellipse cx="100" cy="186" rx="42" ry="5" fill="${color}" opacity=".12"/><g>${animation}<g transform="rotate(${tilt} 100 100)"><g fill="${color}" color="${color}">${shapes[config.shape] ?? shapes.round}</g><g transform="translate(100 ${100 + faceY}) scale(${faceScale}) translate(-100 -100)"><g transform="translate(${shift})" fill="none" stroke="${ink}" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(100 97) scale(${eyeSize}) translate(-100 -97)">${eye(100 - gap, false)}${eye(100 + gap, true)}${brow(100 - gap, false)}${brow(100 + gap, true)}</g>${mouth}</g></g></g></g>${activity}</svg>`;
580
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
581
+ }
418
582
  const PET_ANIMATION_NAMES = [
419
583
  "idle",
420
584
  "running-right",
@@ -483,6 +647,11 @@ const DEFAULT_PET_SIZE = {
483
647
  width: petSpriteAtlas.cellWidth,
484
648
  height: petSpriteAtlas.cellHeight
485
649
  };
650
+ function petLookFrame(dx, dy, deadZone = 12) {
651
+ if (!Number.isFinite(dx) || !Number.isFinite(dy) || Math.hypot(dx, dy) <= deadZone) return null;
652
+ const index = (Math.round(Math.atan2(dx, -dy) / (Math.PI / 8)) + 16) % 16;
653
+ return { row: 9 + Math.floor(index / 8), column: index % 8 };
654
+ }
486
655
  const DEFAULT_PET_BOUNDS_PADDING = {
487
656
  top: 0,
488
657
  right: 0,
@@ -509,7 +678,7 @@ function mergeFrameAnimation(base, override) {
509
678
  frameDurations: (override == null ? void 0 : override.frameDurations) && override.frameDurations.length > 0 ? override.frameDurations : base.frameDurations
510
679
  };
511
680
  }
512
- function mergePetSpriteAtlas(override) {
681
+ function mergePetSpriteAtlas(override, spriteVersionNumber = 1) {
513
682
  var _a;
514
683
  const animations = {};
515
684
  for (const name of PET_ANIMATION_NAMES) {
@@ -520,7 +689,7 @@ function mergePetSpriteAtlas(override) {
520
689
  }
521
690
  return {
522
691
  columns: (override == null ? void 0 : override.columns) ?? petSpriteAtlas.columns,
523
- rows: (override == null ? void 0 : override.rows) ?? petSpriteAtlas.rows,
692
+ rows: (override == null ? void 0 : override.rows) ?? (spriteVersionNumber === 2 ? 11 : petSpriteAtlas.rows),
524
693
  cellWidth: (override == null ? void 0 : override.cellWidth) ?? petSpriteAtlas.cellWidth,
525
694
  cellHeight: (override == null ? void 0 : override.cellHeight) ?? petSpriteAtlas.cellHeight,
526
695
  animations
@@ -569,7 +738,7 @@ function resolvePetCharacter(character) {
569
738
  return {
570
739
  kind: "atlas",
571
740
  src: character.src,
572
- atlas: mergePetSpriteAtlas(character.atlas)
741
+ atlas: mergePetSpriteAtlas(character.atlas, character.spriteVersionNumber)
573
742
  };
574
743
  }
575
744
  function normalizeBoundsPadding(value) {
@@ -941,7 +1110,11 @@ function countFileChangeLines(report) {
941
1110
  }
942
1111
  return { status: "ready", added: m - previous[m], removed: n - previous[m] };
943
1112
  }
1113
+ function isCallEndedContent(value) {
1114
+ return !!value && typeof value === "object" && "type" in value && value.type === "call_ended" && "sessionId" in value && typeof value.sessionId === "string" && "startedAt" in value && (value.startedAt === null || typeof value.startedAt === "string" && Number.isFinite(Date.parse(value.startedAt))) && "endedAt" in value && typeof value.endedAt === "string" && Number.isFinite(Date.parse(value.endedAt)) && "durationSeconds" in value && typeof value.durationSeconds === "number" && Number.isFinite(value.durationSeconds) && value.durationSeconds >= 0;
1115
+ }
944
1116
  export {
1117
+ CHATKIT_ASSISTANT_CUSTOMIZE_EFFECT,
945
1118
  CHATKIT_TASK_SUMMARY_OPEN_RESOURCE_EFFECT,
946
1119
  CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED,
947
1120
  ChatMessageEventTypeEnum,
@@ -964,12 +1137,15 @@ export {
964
1137
  clampPetPosition,
965
1138
  countFileChangeLines,
966
1139
  createResourceCardContent,
1140
+ customCharacterSvg,
1141
+ defaultCharacterConfig,
967
1142
  fileChangeRangeKey,
968
1143
  getFileActivityContribution,
969
1144
  getLegacyFileActivityContribution,
970
1145
  getMessageSkillUsages,
971
1146
  getPinnedPetPosition,
972
1147
  isApprovalHostReference,
1148
+ isCallEndedContent,
973
1149
  isClientToolInterrupt,
974
1150
  isClientToolInterruptPayload,
975
1151
  isClientToolInterruptTask,
@@ -1001,10 +1177,12 @@ export {
1001
1177
  normalizePetOptions,
1002
1178
  normalizeRequestLanguage,
1003
1179
  normalizeThreadReference,
1180
+ parseAssistantAppearance,
1004
1181
  parseFileActivityContent,
1005
1182
  parseFileChangeReport,
1006
1183
  parseResourceCard,
1007
1184
  parseResourceCardContent,
1185
+ petLookFrame,
1008
1186
  petSpriteAtlas,
1009
1187
  projectMessageFileActivity,
1010
1188
  resolveLocalizedText,