@xpert-ai/chatkit-types 0.6.1 → 0.6.3

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
@@ -187,6 +187,22 @@ export declare interface ChatEventEnvelope<T = unknown> {
187
187
  data: T;
188
188
  }
189
189
 
190
+ export declare type ChatFileChange = {
191
+ id: string;
192
+ workspacePath: string;
193
+ title: string;
194
+ operation: 'added' | 'modified' | 'deleted' | 'unknown';
195
+ before?: FileRevision | null;
196
+ after?: FileRevision | null;
197
+ resource?: Extract<ChatTaskSummaryResourceReference, {
198
+ type: 'file_change';
199
+ }>;
200
+ coverage: 'observed' | 'legacy';
201
+ messageId?: string;
202
+ startedAt?: string;
203
+ updatedAt?: string;
204
+ };
205
+
190
206
  export declare const CHATKIT_TASK_SUMMARY_OPEN_RESOURCE_EFFECT: "task_summary.open_resource";
191
207
 
192
208
  export declare type ChatKitClientSecretObject = {
@@ -388,6 +404,7 @@ export declare type ChatKitMcpAppsOptions = {
388
404
  };
389
405
 
390
406
  export declare interface ChatkitMessage {
407
+ taskSummary?: TChatTaskSummaryContribution;
391
408
  createdAt?: string | Date | null;
392
409
  updatedAt?: string | Date | null;
393
410
  historical?: boolean;
@@ -793,7 +810,7 @@ export declare type ChatKitQuoteReference = ChatKitReferenceBase & {
793
810
  source?: string;
794
811
  };
795
812
 
796
- export declare type ChatKitReference = ChatKitCodeReference | ChatKitQuoteReference | ChatKitImageReference | ChatKitElementReference | ChatKitFileElementReference;
813
+ export declare type ChatKitReference = ChatKitThreadReference | ChatKitCodeReference | ChatKitQuoteReference | ChatKitImageReference | ChatKitElementReference | ChatKitFileElementReference;
797
814
 
798
815
  export declare type ChatKitReferenceBase = {
799
816
  id?: string;
@@ -938,6 +955,15 @@ export declare type ChatKitTheme = {
938
955
  };
939
956
  };
940
957
 
958
+ /** A live reference to a conversation branch, never a client-supplied transcript. */
959
+ export declare type ChatKitThreadReference = {
960
+ type: 'thread';
961
+ id?: string;
962
+ label?: string;
963
+ conversationId: string;
964
+ threadId: string;
965
+ };
966
+
941
967
  export declare type ChatKitWorkbenchClientCommandRequest = {
942
968
  commandKey: string;
943
969
  payload?: unknown;
@@ -1129,6 +1155,23 @@ export declare type ChatRequestStorageFileHandle = ChatRequestFileBase & {
1129
1155
  storageProvider?: string;
1130
1156
  };
1131
1157
 
1158
+ /** Snapshot produced by the runtime after successfully loading skill instructions. */
1159
+ export declare type ChatSkillUsage = {
1160
+ skillId: string;
1161
+ name: string;
1162
+ version: string;
1163
+ source: {
1164
+ type: 'workspace' | 'project' | 'assistant' | 'plugin';
1165
+ id: string;
1166
+ };
1167
+ activation: 'read';
1168
+ toolCallId: string;
1169
+ executionId?: string;
1170
+ loadedAt: string;
1171
+ };
1172
+
1173
+ export declare function chatSkillUsageKey(usage: ChatSkillUsage): string;
1174
+
1132
1175
  export declare type ChatTaskSummaryOpenResourceEffect = {
1133
1176
  resource: ChatTaskSummaryResourceReference;
1134
1177
  conversationId?: string;
@@ -1145,6 +1188,12 @@ export declare type ChatTaskSummaryOutput = {
1145
1188
  resource?: ChatTaskSummaryResourceReference;
1146
1189
  messageId?: string;
1147
1190
  updatedAt?: string;
1191
+ /** Only host-verified, explicitly presented files get message-end cards. */
1192
+ origin?: 'tool' | 'integration' | 'legacy';
1193
+ workspacePath?: string;
1194
+ mimeType?: string;
1195
+ size?: number;
1196
+ sha256?: string;
1148
1197
  };
1149
1198
 
1150
1199
  export declare type ChatTaskSummaryOutputKind = 'file' | 'image' | 'document' | 'spreadsheet' | 'presentation' | 'site' | 'url' | 'mcp_app';
@@ -1169,7 +1218,8 @@ export declare type ChatTaskSummaryResourceReference = {
1169
1218
  } | {
1170
1219
  type: 'artifact';
1171
1220
  artifactId: string;
1172
- } | {
1221
+ artifactVersionId?: string;
1222
+ } | FileChangeResource | FileChangeSetResource | {
1173
1223
  type: 'browser';
1174
1224
  serviceId?: string;
1175
1225
  url?: string;
@@ -1260,6 +1310,9 @@ declare type ControlSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2
1260
1310
 
1261
1311
  declare type ControlVariant = 'solid' | 'soft' | 'outline' | 'ghost';
1262
1312
 
1313
+ /** Exact line LCS with bounded CPU/memory. Unknown text never becomes zero changes. */
1314
+ export declare function countFileChangeLines(report: FileChangeReport): FileChangeLineStats;
1315
+
1263
1316
  declare type CustomApiConfig = {
1264
1317
  /**
1265
1318
  * The URL (relative or absolute) of the ChatKit API. The configured endpoint
@@ -1367,6 +1420,85 @@ export declare type Entity = {
1367
1420
 
1368
1421
  export declare type EventHandler<K extends keyof ChatKitEvents> = (event: ChatKitEvents[K]) => any;
1369
1422
 
1423
+ export declare type FileActivityMessage = {
1424
+ id?: string;
1425
+ content?: unknown;
1426
+ taskSummary?: TChatTaskSummaryContribution;
1427
+ updatedAt?: string | Date;
1428
+ createdAt?: string | Date;
1429
+ };
1430
+
1431
+ /** Host-owned facts from a tool execution, never an additional tool invocation. */
1432
+ export declare type FileActivityReceipt = {
1433
+ version: 1;
1434
+ receiptId: string;
1435
+ toolCallId: string;
1436
+ updatedAt: string;
1437
+ } & ({
1438
+ kind: 'changes';
1439
+ coverage: 'bounded' | 'partial' | 'unavailable';
1440
+ fileChanges: ChatFileChange[];
1441
+ } | {
1442
+ kind: 'delivery';
1443
+ status: 'success';
1444
+ outputs: ChatTaskSummaryOutput[];
1445
+ } | {
1446
+ kind: 'delivery';
1447
+ status: 'error';
1448
+ error: string;
1449
+ });
1450
+
1451
+ export declare type FileChangeLineStats = {
1452
+ status: 'ready';
1453
+ added: number;
1454
+ removed: number;
1455
+ } | {
1456
+ status: 'unavailable';
1457
+ };
1458
+
1459
+ /** Stable cache identity for a fixed review range; never identifies mutable workspace bytes. */
1460
+ export declare function fileChangeRangeKey(resource: Extract<ChatTaskSummaryResourceReference, {
1461
+ type: 'file_change';
1462
+ }>): string;
1463
+
1464
+ /** Private review payload. Never include text/diffs in compact task summaries. */
1465
+ export declare type FileChangeReport = {
1466
+ schema: 'xpert.file-change.v1';
1467
+ workspacePath: string;
1468
+ before: (FileRevision & {
1469
+ text?: string;
1470
+ }) | null;
1471
+ after: (FileRevision & {
1472
+ text?: string;
1473
+ }) | null;
1474
+ };
1475
+
1476
+ export declare type FileChangeResource = {
1477
+ type: 'file_change';
1478
+ first: {
1479
+ artifactId: string;
1480
+ artifactVersionId: string;
1481
+ };
1482
+ last: {
1483
+ artifactId: string;
1484
+ artifactVersionId: string;
1485
+ };
1486
+ };
1487
+
1488
+ export declare type FileChangeSetResource = {
1489
+ type: 'file_change_set';
1490
+ messageId: string;
1491
+ changes: {
1492
+ workspacePath: string;
1493
+ resource?: FileChangeResource;
1494
+ }[];
1495
+ };
1496
+
1497
+ export declare type FileRevision = {
1498
+ sha256: string;
1499
+ size: number;
1500
+ };
1501
+
1370
1502
  export declare type FileUploadStrategy = {
1371
1503
  type: 'two_phase';
1372
1504
  } | {
@@ -1393,6 +1525,17 @@ export declare type Form = {
1393
1525
  direction?: 'row' | 'col';
1394
1526
  } & BoxBaseProps;
1395
1527
 
1528
+ export declare function getFileActivityContribution(value: unknown): TChatTaskSummaryContribution | null;
1529
+
1530
+ /** Compatibility uses explicit metadata and the original call identity, never labels or ID suffixes. */
1531
+ export declare function getLegacyFileActivityContribution(value: unknown): TChatTaskSummaryContribution | null;
1532
+
1533
+ /** Works for both streamed tool components and persisted message summaries. */
1534
+ export declare function getMessageSkillUsages(message: {
1535
+ content?: unknown;
1536
+ taskSummary?: unknown;
1537
+ }): ChatSkillUsage[];
1538
+
1396
1539
  export declare function getPinnedPetPosition(pin: ChatKitPetPin, size: PetSize, viewport: PetViewport, padding: ChatKitPetBoundsPadding): PetPosition;
1397
1540
 
1398
1541
  export declare type GrayscaleOptions = {
@@ -1637,6 +1780,8 @@ export declare function isClientToolInterruptTask(value: unknown): value is Clie
1637
1780
 
1638
1781
  export declare function isClientToolRequest(value: unknown): value is ClientToolRequest;
1639
1782
 
1783
+ export declare function isFileActivityContent(value: unknown): boolean;
1784
+
1640
1785
  export declare function isHITLDecisionType(value: unknown): value is HITLDecisionType;
1641
1786
 
1642
1787
  export declare function isHITLInterrupt(value: unknown): value is HITLInterrupt;
@@ -1728,6 +1873,12 @@ export declare type Markdown = {
1728
1873
  streaming?: boolean;
1729
1874
  };
1730
1875
 
1876
+ /** Merge only observations belonging to the same message. Keep the first read. */
1877
+ export declare function mergeChatSkillUsages(...groups: ReadonlyArray<readonly ChatSkillUsage[] | undefined>): ChatSkillUsage[];
1878
+
1879
+ /** Collapse observed operations to the net change, retaining immutable first/last review references. */
1880
+ export declare function mergeFileChanges(items: ChatFileChange[]): ChatFileChange[];
1881
+
1731
1882
  export declare function mergePetSpriteAtlas(override?: ChatKitPetSpriteAtlas): PetSpriteAtlasDefinition;
1732
1883
 
1733
1884
  export declare type MessageContentImageUrl = {
@@ -1743,6 +1894,17 @@ export declare type MessageContentText = {
1743
1894
  text: string;
1744
1895
  };
1745
1896
 
1897
+ export declare type MessageFileChangeStats = {
1898
+ messageId: string;
1899
+ items: {
1900
+ workspacePath: string;
1901
+ resource?: Extract<ChatTaskSummaryResourceReference, {
1902
+ type: 'file_change';
1903
+ }>;
1904
+ stats: FileChangeLineStats;
1905
+ }[];
1906
+ };
1907
+
1746
1908
  export declare type ModelOption = {
1747
1909
  /** Identifier used when submitting a message. */
1748
1910
  id: string;
@@ -1765,6 +1927,9 @@ export declare type ModelOption = {
1765
1927
 
1766
1928
  export declare function normalizeBoundsPadding(value?: number | Partial<ChatKitPetBoundsPadding>): ChatKitPetBoundsPadding;
1767
1929
 
1930
+ /** JSON boundary: allowlist fields rather than forwarding paths or raw tool data. */
1931
+ export declare function normalizeChatSkillUsages(value: unknown): ChatSkillUsage[];
1932
+
1768
1933
  export declare type NormalizedPetOptions = {
1769
1934
  character: ChatKitPetCharacter;
1770
1935
  position: Required<Pick<NonNullable<ChatKitPetOptions['position']>, 'draggable' | 'persist' | 'scale' | 'zIndex'>> & Pick<NonNullable<ChatKitPetOptions['position']>, 'pin' | 'boundsPadding'>;
@@ -1773,12 +1938,22 @@ export declare type NormalizedPetOptions = {
1773
1938
  imageRendering: NonNullable<ChatKitPetOptions['imageRendering']>;
1774
1939
  };
1775
1940
 
1941
+ export declare function normalizeFileChanges(value: unknown): ChatFileChange[];
1942
+
1943
+ export declare function normalizeFileOutputs(value: unknown): ChatTaskSummaryOutput[];
1944
+
1776
1945
  export declare function normalizeHITLRequest(value: unknown): HITLRequest | null;
1777
1946
 
1778
1947
  export declare function normalizePetOptions(pet: ChatKitOptions['pet'] | null): NormalizedPetOptions | null;
1779
1948
 
1780
1949
  export declare function normalizeRequestLanguage(locale?: string | null): string | undefined;
1781
1950
 
1951
+ export declare function normalizeThreadReference(value: unknown): ChatKitThreadReference | null;
1952
+
1953
+ export declare function parseFileActivityContent(value: unknown): TMessageContentFileActivity | null;
1954
+
1955
+ export declare function parseFileChangeReport(value: unknown): FileChangeReport | null;
1956
+
1782
1957
  export declare const PET_ANIMATION_NAMES: readonly ["idle", "running-right", "running-left", "waving", "jumping", "failed", "waiting", "running", "review"];
1783
1958
 
1784
1959
  export declare type PetFrameAnimationDefinition = {
@@ -1864,6 +2039,9 @@ export declare type PetViewport = {
1864
2039
  height: number;
1865
2040
  };
1866
2041
 
2042
+ /** Shared live/history projection. Proven tool writes move out of outputs, never filename-based classification. */
2043
+ export declare function projectMessageFileActivity(message: FileActivityMessage, contribution: TChatTaskSummaryContribution): TChatTaskSummaryContribution;
2044
+
1867
2045
  export declare type RadioGroup = {
1868
2046
  type: 'RadioGroup';
1869
2047
  key?: string;
@@ -2160,6 +2338,12 @@ export declare type TChatTaskSummaryContribution = {
2160
2338
  todos?: ChatTaskSummaryTodos;
2161
2339
  outputs?: ChatTaskSummaryOutput[];
2162
2340
  sources?: ChatTaskSummarySource[];
2341
+ skillUsages?: ChatSkillUsage[];
2342
+ /** Presence marks the new semantic projection; old writes are never deliveries. */
2343
+ fileActivityVersion?: 1;
2344
+ fileActivityToolCallId?: string;
2345
+ fileChangeCoverage?: 'bounded' | 'partial' | 'unavailable';
2346
+ fileChanges?: ChatFileChange[];
2163
2347
  };
2164
2348
 
2165
2349
  /**
@@ -2463,7 +2647,7 @@ export declare type TMessageContent = string | TMessageContentComplex[];
2463
2647
  /**
2464
2648
  * Enhance {@link MessageContentComplex} in Langchain.js
2465
2649
  */
2466
- export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
2650
+ export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentFileActivity | TMessageContentMemory | (Record<string, any> & {
2467
2651
  type?: 'text' | 'image_url' | string;
2468
2652
  }) | (Record<string, any> & {
2469
2653
  type?: never;
@@ -2491,6 +2675,17 @@ export declare type TMessageContentComponent<T extends object = object> = {
2491
2675
  runId?: string;
2492
2676
  };
2493
2677
 
2678
+ export declare type TMessageContentFileActivity = {
2679
+ id: string;
2680
+ type: 'file_activity';
2681
+ data: FileActivityReceipt;
2682
+ messageId?: string;
2683
+ executionId?: string;
2684
+ agentKey?: string;
2685
+ parentExecutionId?: string;
2686
+ runId?: string;
2687
+ };
2688
+
2494
2689
  /**
2495
2690
  * MCP App component item in a LangChain-compatible complex message content
2496
2691
  * array.
@@ -2714,6 +2909,9 @@ export declare type TXpertChatTarget = {
2714
2909
  executionId?: string;
2715
2910
  };
2716
2911
 
2912
+ /** Receipts are immutable terminal facts; replay replaces by identity, never appends a second operation. */
2913
+ export declare function upsertFileActivityContent<T>(content: T[], receipt: TMessageContentFileActivity): (T | TMessageContentFileActivity)[];
2914
+
2717
2915
  export declare type UserMessageContent = unknown;
2718
2916
 
2719
2917
  export declare type WidgetComponent = TextComponent | Title | Caption | Badge | Markdown | Box | Row | Col | Divider | Icon | Image_2 | Button | Checkbox | Spacer | Select | DatePicker | Form | Input | Label | RadioGroup | Textarea | Transition;