@xpert-ai/chatkit-types 0.6.2 → 0.7.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
@@ -19,6 +19,23 @@ export declare interface AgentPluginDiagnostic {
19
19
 
20
20
  declare type Alignment = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
21
21
 
22
+ export declare interface ApprovalActionRequest {
23
+ request: HITLRequest;
24
+ action: 'settings';
25
+ }
26
+
27
+ export declare interface ApprovalDecisionRequest {
28
+ request: HITLRequest;
29
+ decisions: HITLDecision[];
30
+ }
31
+
32
+ /** Opaque host resource reference; ChatKit never interprets resource-specific policy. */
33
+ export declare interface ApprovalHostReference {
34
+ kind: string;
35
+ id: string;
36
+ expiresAt: number;
37
+ }
38
+
22
39
  /**
23
40
  * strategies to host files before attaching them to messages.
24
41
  */
@@ -187,8 +204,33 @@ export declare interface ChatEventEnvelope<T = unknown> {
187
204
  data: T;
188
205
  }
189
206
 
207
+ export declare type ChatFileChange = {
208
+ id: string;
209
+ workspacePath: string;
210
+ title: string;
211
+ operation: 'added' | 'modified' | 'deleted' | 'unknown';
212
+ before?: FileRevision | null;
213
+ after?: FileRevision | null;
214
+ resource?: Extract<ChatTaskSummaryResourceReference, {
215
+ type: 'file_change';
216
+ }>;
217
+ coverage: 'observed' | 'legacy';
218
+ messageId?: string;
219
+ startedAt?: string;
220
+ updatedAt?: string;
221
+ };
222
+
190
223
  export declare const CHATKIT_TASK_SUMMARY_OPEN_RESOURCE_EFFECT: "task_summary.open_resource";
191
224
 
225
+ export declare interface ChatKitApprovalsOptions {
226
+ /** Existing integrations keep the composer placement by default. */
227
+ placement?: 'composer' | 'inline';
228
+ onDecision?: (input: ApprovalDecisionRequest) => Promise<{
229
+ accepted: boolean;
230
+ }>;
231
+ onAction?: (input: ApprovalActionRequest) => Promise<void> | void;
232
+ }
233
+
192
234
  export declare type ChatKitClientSecretObject = {
193
235
  secret: string;
194
236
  organizationId?: string;
@@ -232,6 +274,7 @@ export declare interface ChatKitElementEventMap {
232
274
  }>;
233
275
  'chatkit.project.change': CustomEvent<{
234
276
  projectId: string | null;
277
+ selection?: ProjectSelection;
235
278
  }>;
236
279
  'chatkit.connectors.change': CustomEvent<{
237
280
  connectorBindingIds: string[];
@@ -280,6 +323,7 @@ export declare type ChatKitEvents = {
280
323
  /** Emitted when the user changes the active Xpert project in the composer. */
281
324
  'chatkit.project.change': CustomEvent<{
282
325
  projectId: string | null;
326
+ selection?: ProjectSelection;
283
327
  }>;
284
328
  /** Emitted when the user changes the Connector bindings selected for the conversation. */
285
329
  'chatkit.connectors.change': CustomEvent<{
@@ -488,6 +532,8 @@ export declare type ChatKitOptions = {
488
532
  * Optional animated pet companion rendered by the ChatKit web component over
489
533
  * the host page viewport.
490
534
  * Passing `true` enables the default built-in pet.
535
+ * Explicit `false` disables pets and local pet controls in chat mode,
536
+ * overriding saved user preferences. Pet display mode still requires a pet.
491
537
  *
492
538
  * @default false
493
539
  */
@@ -499,6 +545,8 @@ export declare type ChatKitOptions = {
499
545
  * @default null
500
546
  */
501
547
  initialThread?: null | string;
548
+ /** Generic approval placement and host decision callbacks. */
549
+ approvals?: ChatKitApprovalsOptions;
502
550
  /**
503
551
  * A map of handlers for the client tools configured on your server. The keys
504
552
  * are the names of the client tools, and the values are functions that
@@ -528,6 +576,8 @@ export declare type ChatKitOptions = {
528
576
  */
529
577
  header?: {
530
578
  enabled?: boolean;
579
+ /** Enable native Electron dragging/OS double-click behavior on unused chat and Workbench header space. Defaults to false. */
580
+ windowDrag?: boolean;
531
581
  /**
532
582
  * Configuration for header title display, which defaults to showing thread titles.
533
583
  */
@@ -647,6 +697,12 @@ export declare type ChatKitOptions = {
647
697
  */
648
698
  projects?: {
649
699
  enabled?: boolean;
700
+ /** Initial conversation intent. Binding a running conversation does not change this option. */
701
+ selection?: ProjectSelection;
702
+ /** Offer automatic creation on first send when the Assistant supports it. */
703
+ autoNewEnabled?: boolean;
704
+ /** Hide the no-Project choice for Assistants requiring a Project workspace. */
705
+ allowNone?: boolean;
650
706
  /**
651
707
  * Allow the user to request Project creation from the selector.
652
708
  * Defaults to true when Project selection is enabled. Set this to false
@@ -956,6 +1012,16 @@ export declare type ChatKitWorkbenchClientCommandRequest = {
956
1012
  viewKey: string;
957
1013
  };
958
1014
 
1015
+ /** Authenticated host response consumed only by ChatKit, never forwarded to a plugin. */
1016
+ export declare type ChatKitWorkbenchNavigationSession = {
1017
+ assistantId: string;
1018
+ projectId: string | null;
1019
+ threadId: string | null;
1020
+ conversationId?: string;
1021
+ secret: string;
1022
+ organizationId?: string;
1023
+ };
1024
+
959
1025
  export declare type ChatKitWorkbenchOptions = {
960
1026
  /** Show external Assistant executions in a native workbench tab. Enabled by default. */
961
1027
  externalAssistants?: {
@@ -967,6 +1033,14 @@ export declare type ChatKitWorkbenchOptions = {
967
1033
  * @default false
968
1034
  */
969
1035
  enabled?: boolean;
1036
+ /**
1037
+ * Show a vertical strip of available remote-view icons at the right edge of
1038
+ * chat while the workbench is closed. Clicking an icon opens that view.
1039
+ * Requires `workbench.enabled`. Disabled by default.
1040
+ */
1041
+ viewRail?: {
1042
+ enabled?: boolean;
1043
+ };
970
1044
  /** Native side chat branched from the current thread. Disabled by default. */
971
1045
  sideChat?: {
972
1046
  enabled?: boolean;
@@ -974,6 +1048,13 @@ export declare type ChatKitWorkbenchOptions = {
974
1048
  /**
975
1049
  * Handles manifest-declared client commands that are not implemented by
976
1050
  * ChatKit itself.
1051
+ * For assistant.conversation/project navigation, resolve and authorize the
1052
+ * requested resource on the server, then return
1053
+ * `{ success: true, session: ChatKitWorkbenchNavigationSession }`.
1054
+ * ChatKit switches its runtime scope and uses the same callback to refresh
1055
+ * this scoped session. Credentials are stripped from the remote-view reply.
1056
+ * Hosts that perform navigation themselves may return
1057
+ * `{ success: true, status: 'opened' }` without a session.
977
1058
  */
978
1059
  onClientCommand?: (request: ChatKitWorkbenchClientCommandRequest) => unknown | Promise<unknown>;
979
1060
  };
@@ -1172,6 +1253,12 @@ export declare type ChatTaskSummaryOutput = {
1172
1253
  resource?: ChatTaskSummaryResourceReference;
1173
1254
  messageId?: string;
1174
1255
  updatedAt?: string;
1256
+ /** Only host-verified, explicitly presented files get message-end cards. */
1257
+ origin?: 'tool' | 'integration' | 'legacy';
1258
+ workspacePath?: string;
1259
+ mimeType?: string;
1260
+ size?: number;
1261
+ sha256?: string;
1175
1262
  };
1176
1263
 
1177
1264
  export declare type ChatTaskSummaryOutputKind = 'file' | 'image' | 'document' | 'spreadsheet' | 'presentation' | 'site' | 'url' | 'mcp_app';
@@ -1196,7 +1283,8 @@ export declare type ChatTaskSummaryResourceReference = {
1196
1283
  } | {
1197
1284
  type: 'artifact';
1198
1285
  artifactId: string;
1199
- } | {
1286
+ artifactVersionId?: string;
1287
+ } | FileChangeResource | FileChangeSetResource | {
1200
1288
  type: 'browser';
1201
1289
  serviceId?: string;
1202
1290
  url?: string;
@@ -1287,6 +1375,9 @@ declare type ControlSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2
1287
1375
 
1288
1376
  declare type ControlVariant = 'solid' | 'soft' | 'outline' | 'ghost';
1289
1377
 
1378
+ /** Exact line LCS with bounded CPU/memory. Unknown text never becomes zero changes. */
1379
+ export declare function countFileChangeLines(report: FileChangeReport): FileChangeLineStats;
1380
+
1290
1381
  declare type CustomApiConfig = {
1291
1382
  /**
1292
1383
  * The URL (relative or absolute) of the ChatKit API. The configured endpoint
@@ -1394,6 +1485,85 @@ export declare type Entity = {
1394
1485
 
1395
1486
  export declare type EventHandler<K extends keyof ChatKitEvents> = (event: ChatKitEvents[K]) => any;
1396
1487
 
1488
+ export declare type FileActivityMessage = {
1489
+ id?: string;
1490
+ content?: unknown;
1491
+ taskSummary?: TChatTaskSummaryContribution;
1492
+ updatedAt?: string | Date;
1493
+ createdAt?: string | Date;
1494
+ };
1495
+
1496
+ /** Host-owned facts from a tool execution, never an additional tool invocation. */
1497
+ export declare type FileActivityReceipt = {
1498
+ version: 1;
1499
+ receiptId: string;
1500
+ toolCallId: string;
1501
+ updatedAt: string;
1502
+ } & ({
1503
+ kind: 'changes';
1504
+ coverage: 'bounded' | 'partial' | 'unavailable';
1505
+ fileChanges: ChatFileChange[];
1506
+ } | {
1507
+ kind: 'delivery';
1508
+ status: 'success';
1509
+ outputs: ChatTaskSummaryOutput[];
1510
+ } | {
1511
+ kind: 'delivery';
1512
+ status: 'error';
1513
+ error: string;
1514
+ });
1515
+
1516
+ export declare type FileChangeLineStats = {
1517
+ status: 'ready';
1518
+ added: number;
1519
+ removed: number;
1520
+ } | {
1521
+ status: 'unavailable';
1522
+ };
1523
+
1524
+ /** Stable cache identity for a fixed review range; never identifies mutable workspace bytes. */
1525
+ export declare function fileChangeRangeKey(resource: Extract<ChatTaskSummaryResourceReference, {
1526
+ type: 'file_change';
1527
+ }>): string;
1528
+
1529
+ /** Private review payload. Never include text/diffs in compact task summaries. */
1530
+ export declare type FileChangeReport = {
1531
+ schema: 'xpert.file-change.v1';
1532
+ workspacePath: string;
1533
+ before: (FileRevision & {
1534
+ text?: string;
1535
+ }) | null;
1536
+ after: (FileRevision & {
1537
+ text?: string;
1538
+ }) | null;
1539
+ };
1540
+
1541
+ export declare type FileChangeResource = {
1542
+ type: 'file_change';
1543
+ first: {
1544
+ artifactId: string;
1545
+ artifactVersionId: string;
1546
+ };
1547
+ last: {
1548
+ artifactId: string;
1549
+ artifactVersionId: string;
1550
+ };
1551
+ };
1552
+
1553
+ export declare type FileChangeSetResource = {
1554
+ type: 'file_change_set';
1555
+ messageId: string;
1556
+ changes: {
1557
+ workspacePath: string;
1558
+ resource?: FileChangeResource;
1559
+ }[];
1560
+ };
1561
+
1562
+ export declare type FileRevision = {
1563
+ sha256: string;
1564
+ size: number;
1565
+ };
1566
+
1397
1567
  export declare type FileUploadStrategy = {
1398
1568
  type: 'two_phase';
1399
1569
  } | {
@@ -1420,6 +1590,11 @@ export declare type Form = {
1420
1590
  direction?: 'row' | 'col';
1421
1591
  } & BoxBaseProps;
1422
1592
 
1593
+ export declare function getFileActivityContribution(value: unknown): TChatTaskSummaryContribution | null;
1594
+
1595
+ /** Compatibility uses explicit metadata and the original call identity, never labels or ID suffixes. */
1596
+ export declare function getLegacyFileActivityContribution(value: unknown): TChatTaskSummaryContribution | null;
1597
+
1423
1598
  /** Works for both streamed tool components and persisted message summaries. */
1424
1599
  export declare function getMessageSkillUsages(message: {
1425
1600
  content?: unknown;
@@ -1486,6 +1661,8 @@ export declare interface HITLRejectDecision {
1486
1661
  }
1487
1662
 
1488
1663
  export declare interface HITLRequest {
1664
+ host?: ApprovalHostReference;
1665
+ toolCallId?: string;
1489
1666
  actionRequests: HITLActionRequest[];
1490
1667
  reviewConfigs: HITLReviewConfig[];
1491
1668
  elicitation?: HITLMCPElicitation;
@@ -1662,6 +1839,8 @@ export declare interface InterruptPayload extends LangGraphInterruptPayload<Inte
1662
1839
 
1663
1840
  export declare type InterruptRequest = ToolCallRequest | ClientToolRequest | HITLRequest;
1664
1841
 
1842
+ export declare function isApprovalHostReference(value: unknown): value is ApprovalHostReference;
1843
+
1665
1844
  export declare function isClientToolInterrupt(value: unknown): value is ClientToolInterrupt;
1666
1845
 
1667
1846
  export declare function isClientToolInterruptPayload(value: unknown): value is ClientToolInterruptPayload;
@@ -1670,6 +1849,8 @@ export declare function isClientToolInterruptTask(value: unknown): value is Clie
1670
1849
 
1671
1850
  export declare function isClientToolRequest(value: unknown): value is ClientToolRequest;
1672
1851
 
1852
+ export declare function isFileActivityContent(value: unknown): boolean;
1853
+
1673
1854
  export declare function isHITLDecisionType(value: unknown): value is HITLDecisionType;
1674
1855
 
1675
1856
  export declare function isHITLInterrupt(value: unknown): value is HITLInterrupt;
@@ -1764,6 +1945,9 @@ export declare type Markdown = {
1764
1945
  /** Merge only observations belonging to the same message. Keep the first read. */
1765
1946
  export declare function mergeChatSkillUsages(...groups: ReadonlyArray<readonly ChatSkillUsage[] | undefined>): ChatSkillUsage[];
1766
1947
 
1948
+ /** Collapse observed operations to the net change, retaining immutable first/last review references. */
1949
+ export declare function mergeFileChanges(items: ChatFileChange[]): ChatFileChange[];
1950
+
1767
1951
  export declare function mergePetSpriteAtlas(override?: ChatKitPetSpriteAtlas): PetSpriteAtlasDefinition;
1768
1952
 
1769
1953
  export declare type MessageContentImageUrl = {
@@ -1779,6 +1963,17 @@ export declare type MessageContentText = {
1779
1963
  text: string;
1780
1964
  };
1781
1965
 
1966
+ export declare type MessageFileChangeStats = {
1967
+ messageId: string;
1968
+ items: {
1969
+ workspacePath: string;
1970
+ resource?: Extract<ChatTaskSummaryResourceReference, {
1971
+ type: 'file_change';
1972
+ }>;
1973
+ stats: FileChangeLineStats;
1974
+ }[];
1975
+ };
1976
+
1782
1977
  export declare type ModelOption = {
1783
1978
  /** Identifier used when submitting a message. */
1784
1979
  id: string;
@@ -1812,6 +2007,10 @@ export declare type NormalizedPetOptions = {
1812
2007
  imageRendering: NonNullable<ChatKitPetOptions['imageRendering']>;
1813
2008
  };
1814
2009
 
2010
+ export declare function normalizeFileChanges(value: unknown): ChatFileChange[];
2011
+
2012
+ export declare function normalizeFileOutputs(value: unknown): ChatTaskSummaryOutput[];
2013
+
1815
2014
  export declare function normalizeHITLRequest(value: unknown): HITLRequest | null;
1816
2015
 
1817
2016
  export declare function normalizePetOptions(pet: ChatKitOptions['pet'] | null): NormalizedPetOptions | null;
@@ -1820,6 +2019,10 @@ export declare function normalizeRequestLanguage(locale?: string | null): string
1820
2019
 
1821
2020
  export declare function normalizeThreadReference(value: unknown): ChatKitThreadReference | null;
1822
2021
 
2022
+ export declare function parseFileActivityContent(value: unknown): TMessageContentFileActivity | null;
2023
+
2024
+ export declare function parseFileChangeReport(value: unknown): FileChangeReport | null;
2025
+
1823
2026
  export declare const PET_ANIMATION_NAMES: readonly ["idle", "running-right", "running-left", "waving", "jumping", "failed", "waiting", "running", "review"];
1824
2027
 
1825
2028
  export declare type PetFrameAnimationDefinition = {
@@ -1905,6 +2108,19 @@ export declare type PetViewport = {
1905
2108
  height: number;
1906
2109
  };
1907
2110
 
2111
+ /** Shared live/history projection. Proven tool writes move out of outputs, never filename-based classification. */
2112
+ export declare function projectMessageFileActivity(message: FileActivityMessage, contribution: TChatTaskSummaryContribution): TChatTaskSummaryContribution;
2113
+
2114
+ /** Explicit user intent for the next conversation; absence retains legacy host behavior. */
2115
+ export declare type ProjectSelection = {
2116
+ mode: 'auto-new';
2117
+ } | {
2118
+ mode: 'none';
2119
+ } | {
2120
+ mode: 'existing';
2121
+ projectId: string;
2122
+ };
2123
+
1908
2124
  export declare type RadioGroup = {
1909
2125
  type: 'RadioGroup';
1910
2126
  key?: string;
@@ -2154,6 +2370,7 @@ export declare type TChatRequest = {
2154
2370
  state?: TXpertChatState;
2155
2371
  agentKey?: string;
2156
2372
  projectId?: string;
2373
+ projectSelection?: ProjectSelection;
2157
2374
  conversationId?: string;
2158
2375
  environmentId?: string;
2159
2376
  id?: string;
@@ -2202,6 +2419,11 @@ export declare type TChatTaskSummaryContribution = {
2202
2419
  outputs?: ChatTaskSummaryOutput[];
2203
2420
  sources?: ChatTaskSummarySource[];
2204
2421
  skillUsages?: ChatSkillUsage[];
2422
+ /** Presence marks the new semantic projection; old writes are never deliveries. */
2423
+ fileActivityVersion?: 1;
2424
+ fileActivityToolCallId?: string;
2425
+ fileChangeCoverage?: 'bounded' | 'partial' | 'unavailable';
2426
+ fileChanges?: ChatFileChange[];
2205
2427
  };
2206
2428
 
2207
2429
  /**
@@ -2505,7 +2727,7 @@ export declare type TMessageContent = string | TMessageContentComplex[];
2505
2727
  /**
2506
2728
  * Enhance {@link MessageContentComplex} in Langchain.js
2507
2729
  */
2508
- export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
2730
+ export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentFileActivity | TMessageContentMemory | (Record<string, any> & {
2509
2731
  type?: 'text' | 'image_url' | string;
2510
2732
  }) | (Record<string, any> & {
2511
2733
  type?: never;
@@ -2533,6 +2755,17 @@ export declare type TMessageContentComponent<T extends object = object> = {
2533
2755
  runId?: string;
2534
2756
  };
2535
2757
 
2758
+ export declare type TMessageContentFileActivity = {
2759
+ id: string;
2760
+ type: 'file_activity';
2761
+ data: FileActivityReceipt;
2762
+ messageId?: string;
2763
+ executionId?: string;
2764
+ agentKey?: string;
2765
+ parentExecutionId?: string;
2766
+ runId?: string;
2767
+ };
2768
+
2536
2769
  /**
2537
2770
  * MCP App component item in a LangChain-compatible complex message content
2538
2771
  * array.
@@ -2756,6 +2989,9 @@ export declare type TXpertChatTarget = {
2756
2989
  executionId?: string;
2757
2990
  };
2758
2991
 
2992
+ /** Receipts are immutable terminal facts; replay replaces by identity, never appends a second operation. */
2993
+ export declare function upsertFileActivityContent<T>(content: T[], receipt: TMessageContentFileActivity): (T | TMessageContentFileActivity)[];
2994
+
2759
2995
  export declare type UserMessageContent = unknown;
2760
2996
 
2761
2997
  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;