@xpert-ai/chatkit-types 0.0.14 → 0.0.16

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +33 -4
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -179,6 +179,13 @@ export declare interface ChatEventEnvelope<T = unknown> {
179
179
  data: T;
180
180
  }
181
181
 
182
+ export declare type ChatKitClientSecretObject = {
183
+ secret: string;
184
+ organizationId?: string;
185
+ };
186
+
187
+ export declare type ChatKitClientSecretResult = string | ChatKitClientSecretObject;
188
+
182
189
  export declare interface ChatKitElementEventMap {
183
190
  'chatkit.error': CustomEvent<{
184
191
  error: Error;
@@ -431,16 +438,36 @@ export declare type ChatKitOptions = {
431
438
  };
432
439
  };
433
440
 
434
- export declare type ChatKitRequestOptions = {
441
+ export declare type ChatKitRequestContext = {
442
+ /**
443
+ * Request-scoped runtime env overrides.
444
+ * ChatKit forwards this field to LangGraph as `context.env`.
445
+ */
446
+ env?: Record<string, string>;
447
+ [key: string]: unknown;
448
+ };
449
+
450
+ export declare type ChatKitRequestOptions<TState = Record<string, any>, TContext extends ChatKitRequestContext = ChatKitRequestContext, TConfig extends Record<string, unknown> = Record<string, unknown>> = {
435
451
  /**
436
452
  * Custom graph state merged into every submitted message request.
437
453
  * The active user input is always written into `state.human.input`.
438
454
  */
439
- state?: Record<string, any>;
455
+ state?: TState;
440
456
  /**
441
457
  * Additional stream context merged into every submitted message request.
458
+ *
459
+ * Request-scoped runtime env overrides should be placed in `context.env`.
460
+ * Extend `TContext` with any other request-scoped context fields you need.
461
+ */
462
+ context?: TContext;
463
+ /**
464
+ * Additional LangGraph run config merged into every submitted message request.
465
+ *
466
+ * This is forwarded to the hosted `runs.stream` request as `config`.
467
+ * Use this for LangGraph runtime controls such as tags or configurable values,
468
+ * not request-scoped env overrides.
442
469
  */
443
- context?: Record<string, unknown>;
470
+ config?: TConfig;
444
471
  };
445
472
 
446
473
  export declare type ChatKitTheme = {
@@ -722,8 +749,10 @@ export declare type HeaderIcon = 'sidebar-left' | 'sidebar-right' | 'sidebar-ope
722
749
  declare type HostedApiConfig = {
723
750
  /**
724
751
  * Function to get a client token or refresh if the current token is expired.
752
+ * Returning an object also allows ChatKit to send the active organization id
753
+ * as the `organization-id` header on hosted API requests.
725
754
  */
726
- getClientSecret: (currentClientSecret: string | null) => Promise<string>;
755
+ getClientSecret: (currentClientSecret: string | null) => Promise<ChatKitClientSecretResult>;
727
756
  /**
728
757
  * The base URL for the XpertAI platform hosted API. Used for accessing xpert agents
729
758
  * and other platform features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/chatkit-types",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Type definitions for the ChatKit.",
5
5
  "sideEffects": false,
6
6
  "type": "module",