@iota-uz/sdk 0.4.24 → 0.4.25

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.
@@ -38,21 +38,18 @@ interface SessionStore {
38
38
  deletedMessages: number;
39
39
  deletedArtifacts: number;
40
40
  }>;
41
- compactSessionHistory(sessionId: string): Promise<{
42
- success: boolean;
43
- summary: string;
44
- deletedMessages: number;
45
- deletedArtifacts: number;
46
- }>;
41
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
47
42
  }
48
43
  interface MessageTransport {
49
44
  sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
50
45
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
51
46
  success: boolean;
47
+ data?: AsyncRunAccepted;
52
48
  error?: string;
53
49
  }>;
54
50
  rejectPendingQuestion(sessionId: string): Promise<{
55
51
  success: boolean;
52
+ data?: AsyncRunAccepted;
56
53
  error?: string;
57
54
  }>;
58
55
  }
@@ -393,6 +390,13 @@ interface StreamStatus {
393
390
  snapshot?: StreamSnapshotPayload;
394
391
  startedAt?: number;
395
392
  }
393
+ interface AsyncRunAccepted {
394
+ accepted: true;
395
+ operation: 'question_submit' | 'question_reject' | 'session_compact';
396
+ sessionId: string;
397
+ runId: string;
398
+ startedAt: number;
399
+ }
396
400
  /**
397
401
  * @deprecated Use `StreamEvent` instead. `StreamChunk` is kept for backwards
398
402
  * compatibility but the flat all-optional shape is unsound.
@@ -584,23 +588,15 @@ interface ChatDataSource {
584
588
  deletedMessages: number;
585
589
  deletedArtifacts: number;
586
590
  }>;
587
- compactSessionHistory(sessionId: string): Promise<{
588
- success: boolean;
589
- summary: string;
590
- deletedMessages: number;
591
- deletedArtifacts: number;
592
- }>;
591
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
593
592
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
594
593
  success: boolean;
594
+ data?: AsyncRunAccepted;
595
595
  error?: string;
596
- data?: {
597
- session: Session$1;
598
- turns: ConversationTurn$1[];
599
- pendingQuestion?: PendingQuestion$1 | null;
600
- };
601
596
  }>;
602
597
  rejectPendingQuestion(sessionId: string): Promise<{
603
598
  success: boolean;
599
+ data?: AsyncRunAccepted;
604
600
  error?: string;
605
601
  }>;
606
602
  /**
@@ -619,12 +615,6 @@ interface ChatDataSource {
619
615
  * Optional; if absent, resume is not supported.
620
616
  */
621
617
  resumeStream?(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
622
- /**
623
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
624
- * This method couples navigation to the data source, causing component
625
- * remounts during active streams.
626
- */
627
- navigateToSession?(sessionId: string): void;
628
618
  listSessions(options?: {
629
619
  limit?: number;
630
620
  offset?: number;
@@ -758,8 +748,6 @@ interface ChatSessionProps {
758
748
  /**
759
749
  * Called when a new session is created (e.g. on first message in a "new
760
750
  * chat"). Use this to navigate your SPA router to the new session URL.
761
- *
762
- * Replaces the deprecated `dataSource.navigateToSession`.
763
751
  */
764
752
  onSessionCreated?: (sessionId: string) => void;
765
753
  /** Alias for isReadOnly (preferred) */
@@ -2708,11 +2696,11 @@ type BichatRPC = {
2708
2696
  };
2709
2697
  "bichat.question.reject": {
2710
2698
  params: QuestionCancelParams;
2711
- result: SessionGetResult;
2699
+ result: AsyncRunAcceptedResult;
2712
2700
  };
2713
2701
  "bichat.question.submit": {
2714
2702
  params: QuestionSubmitParams;
2715
- result: SessionGetResult;
2703
+ result: AsyncRunAcceptedResult;
2716
2704
  };
2717
2705
  "bichat.session.archive": {
2718
2706
  params: SessionIDParams;
@@ -2728,7 +2716,7 @@ type BichatRPC = {
2728
2716
  };
2729
2717
  "bichat.session.compact": {
2730
2718
  params: SessionIDParams;
2731
- result: SessionCompactResult;
2719
+ result: AsyncRunAcceptedResult;
2732
2720
  };
2733
2721
  "bichat.session.create": {
2734
2722
  params: SessionCreateParams;
@@ -2791,7 +2779,7 @@ type BichatRPC = {
2791
2779
  result: SessionUploadArtifactsResult;
2792
2780
  };
2793
2781
  "bichat.user.list": {
2794
- params: PingParams;
2782
+ params: UserListParams;
2795
2783
  result: UserListResult;
2796
2784
  };
2797
2785
  };
@@ -2832,6 +2820,13 @@ interface AssistantTurn {
2832
2820
  codeOutputs: CodeOutput[];
2833
2821
  createdAt: string;
2834
2822
  }
2823
+ interface AsyncRunAcceptedResult {
2824
+ accepted: boolean;
2825
+ operation: string;
2826
+ sessionId: string;
2827
+ runId: string;
2828
+ startedAt: number;
2829
+ }
2835
2830
  interface Attachment {
2836
2831
  id: string;
2837
2832
  uploadId?: number | null;
@@ -3011,12 +3006,6 @@ interface SessionClearResult {
3011
3006
  deletedMessages: number;
3012
3007
  deletedArtifacts: number;
3013
3008
  }
3014
- interface SessionCompactResult {
3015
- success: boolean;
3016
- summary: string;
3017
- deletedMessages: number;
3018
- deletedArtifacts: number;
3019
- }
3020
3009
  interface SessionCreateParams {
3021
3010
  title: string;
3022
3011
  }
@@ -3101,6 +3090,7 @@ interface ToolCall {
3101
3090
  error?: string;
3102
3091
  durationMs?: number;
3103
3092
  }
3093
+ type UserListParams = Record<string, never>;
3104
3094
  interface UserListResult {
3105
3095
  users: SessionUser[];
3106
3096
  }
@@ -3145,13 +3135,8 @@ interface HttpDataSourceConfig {
3145
3135
  uploadEndpoint?: string;
3146
3136
  csrfToken?: string | (() => string);
3147
3137
  headers?: Record<string, string>;
3148
- timeout?: number;
3149
- /**
3150
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` or
3151
- * `ChatSession` instead. Coupling navigation to the data source causes
3152
- * component remounts during active streams.
3153
- */
3154
- navigateToSession?: (sessionId: string) => void;
3138
+ rpcTimeoutMs?: number;
3139
+ streamConnectTimeoutMs?: number;
3155
3140
  }
3156
3141
  declare class HttpDataSource implements ChatDataSource {
3157
3142
  private config;
@@ -3183,12 +3168,7 @@ declare class HttpDataSource implements ChatDataSource {
3183
3168
  deletedMessages: number;
3184
3169
  deletedArtifacts: number;
3185
3170
  }>;
3186
- compactSessionHistory(sessionId: string): Promise<{
3187
- success: boolean;
3188
- summary: string;
3189
- deletedMessages: number;
3190
- deletedArtifacts: number;
3191
- }>;
3171
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
3192
3172
  listUsers(): Promise<SessionUser$1[]>;
3193
3173
  listAllSessions(options?: {
3194
3174
  limit?: number;
@@ -3211,15 +3191,12 @@ declare class HttpDataSource implements ChatDataSource {
3211
3191
  cancelStream(): void;
3212
3192
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3213
3193
  success: boolean;
3194
+ data?: AsyncRunAccepted;
3214
3195
  error?: string;
3215
- data?: {
3216
- session: Session$1;
3217
- turns: ConversationTurn$1[];
3218
- pendingQuestion?: PendingQuestion$1 | null;
3219
- };
3220
3196
  }>;
3221
3197
  rejectPendingQuestion(sessionId: string): Promise<{
3222
3198
  success: boolean;
3199
+ data?: AsyncRunAccepted;
3223
3200
  error?: string;
3224
3201
  }>;
3225
3202
  fetchSessionArtifacts(sessionId: string, options?: {
@@ -3235,10 +3212,6 @@ declare class HttpDataSource implements ChatDataSource {
3235
3212
  }>;
3236
3213
  renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3237
3214
  deleteSessionArtifact(artifactId: string): Promise<void>;
3238
- /**
3239
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
3240
- */
3241
- navigateToSession?(sessionId: string): void;
3242
3215
  }
3243
3216
  /**
3244
3217
  * Factory function to create HttpDataSource
@@ -3261,7 +3234,8 @@ declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSou
3261
3234
  * @throws Error if window.__APPLET_CONTEXT__ is not available
3262
3235
  */
3263
3236
  declare function useHttpDataSourceConfigFromApplet(options?: {
3264
- timeout?: number;
3237
+ rpcTimeoutMs?: number;
3238
+ streamConnectTimeoutMs?: number;
3265
3239
  }): HttpDataSourceConfig;
3266
3240
 
3267
3241
  /**
@@ -3639,8 +3613,6 @@ interface ChatSessionProviderProps {
3639
3613
  /**
3640
3614
  * Called when the machine creates a new session (e.g. on first message in a
3641
3615
  * "new chat"). Use this to navigate your SPA router to the new session URL.
3642
- *
3643
- * Replaces the deprecated `dataSource.navigateToSession`.
3644
3616
  */
3645
3617
  onSessionCreated?: (sessionId: string) => void;
3646
3618
  children: ReactNode;
@@ -4054,6 +4026,7 @@ declare class ChatMachine {
4054
4026
  private _stopPassivePolling;
4055
4027
  private _startPassivePolling;
4056
4028
  private _runResumeStream;
4029
+ private _resumeAcceptedRunOrPoll;
4057
4030
  private _setError;
4058
4031
  private _retryFetchSession;
4059
4032
  private _clearStreamError;
@@ -38,21 +38,18 @@ interface SessionStore {
38
38
  deletedMessages: number;
39
39
  deletedArtifacts: number;
40
40
  }>;
41
- compactSessionHistory(sessionId: string): Promise<{
42
- success: boolean;
43
- summary: string;
44
- deletedMessages: number;
45
- deletedArtifacts: number;
46
- }>;
41
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
47
42
  }
48
43
  interface MessageTransport {
49
44
  sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
50
45
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
51
46
  success: boolean;
47
+ data?: AsyncRunAccepted;
52
48
  error?: string;
53
49
  }>;
54
50
  rejectPendingQuestion(sessionId: string): Promise<{
55
51
  success: boolean;
52
+ data?: AsyncRunAccepted;
56
53
  error?: string;
57
54
  }>;
58
55
  }
@@ -393,6 +390,13 @@ interface StreamStatus {
393
390
  snapshot?: StreamSnapshotPayload;
394
391
  startedAt?: number;
395
392
  }
393
+ interface AsyncRunAccepted {
394
+ accepted: true;
395
+ operation: 'question_submit' | 'question_reject' | 'session_compact';
396
+ sessionId: string;
397
+ runId: string;
398
+ startedAt: number;
399
+ }
396
400
  /**
397
401
  * @deprecated Use `StreamEvent` instead. `StreamChunk` is kept for backwards
398
402
  * compatibility but the flat all-optional shape is unsound.
@@ -584,23 +588,15 @@ interface ChatDataSource {
584
588
  deletedMessages: number;
585
589
  deletedArtifacts: number;
586
590
  }>;
587
- compactSessionHistory(sessionId: string): Promise<{
588
- success: boolean;
589
- summary: string;
590
- deletedMessages: number;
591
- deletedArtifacts: number;
592
- }>;
591
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
593
592
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
594
593
  success: boolean;
594
+ data?: AsyncRunAccepted;
595
595
  error?: string;
596
- data?: {
597
- session: Session$1;
598
- turns: ConversationTurn$1[];
599
- pendingQuestion?: PendingQuestion$1 | null;
600
- };
601
596
  }>;
602
597
  rejectPendingQuestion(sessionId: string): Promise<{
603
598
  success: boolean;
599
+ data?: AsyncRunAccepted;
604
600
  error?: string;
605
601
  }>;
606
602
  /**
@@ -619,12 +615,6 @@ interface ChatDataSource {
619
615
  * Optional; if absent, resume is not supported.
620
616
  */
621
617
  resumeStream?(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
622
- /**
623
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
624
- * This method couples navigation to the data source, causing component
625
- * remounts during active streams.
626
- */
627
- navigateToSession?(sessionId: string): void;
628
618
  listSessions(options?: {
629
619
  limit?: number;
630
620
  offset?: number;
@@ -758,8 +748,6 @@ interface ChatSessionProps {
758
748
  /**
759
749
  * Called when a new session is created (e.g. on first message in a "new
760
750
  * chat"). Use this to navigate your SPA router to the new session URL.
761
- *
762
- * Replaces the deprecated `dataSource.navigateToSession`.
763
751
  */
764
752
  onSessionCreated?: (sessionId: string) => void;
765
753
  /** Alias for isReadOnly (preferred) */
@@ -2708,11 +2696,11 @@ type BichatRPC = {
2708
2696
  };
2709
2697
  "bichat.question.reject": {
2710
2698
  params: QuestionCancelParams;
2711
- result: SessionGetResult;
2699
+ result: AsyncRunAcceptedResult;
2712
2700
  };
2713
2701
  "bichat.question.submit": {
2714
2702
  params: QuestionSubmitParams;
2715
- result: SessionGetResult;
2703
+ result: AsyncRunAcceptedResult;
2716
2704
  };
2717
2705
  "bichat.session.archive": {
2718
2706
  params: SessionIDParams;
@@ -2728,7 +2716,7 @@ type BichatRPC = {
2728
2716
  };
2729
2717
  "bichat.session.compact": {
2730
2718
  params: SessionIDParams;
2731
- result: SessionCompactResult;
2719
+ result: AsyncRunAcceptedResult;
2732
2720
  };
2733
2721
  "bichat.session.create": {
2734
2722
  params: SessionCreateParams;
@@ -2791,7 +2779,7 @@ type BichatRPC = {
2791
2779
  result: SessionUploadArtifactsResult;
2792
2780
  };
2793
2781
  "bichat.user.list": {
2794
- params: PingParams;
2782
+ params: UserListParams;
2795
2783
  result: UserListResult;
2796
2784
  };
2797
2785
  };
@@ -2832,6 +2820,13 @@ interface AssistantTurn {
2832
2820
  codeOutputs: CodeOutput[];
2833
2821
  createdAt: string;
2834
2822
  }
2823
+ interface AsyncRunAcceptedResult {
2824
+ accepted: boolean;
2825
+ operation: string;
2826
+ sessionId: string;
2827
+ runId: string;
2828
+ startedAt: number;
2829
+ }
2835
2830
  interface Attachment {
2836
2831
  id: string;
2837
2832
  uploadId?: number | null;
@@ -3011,12 +3006,6 @@ interface SessionClearResult {
3011
3006
  deletedMessages: number;
3012
3007
  deletedArtifacts: number;
3013
3008
  }
3014
- interface SessionCompactResult {
3015
- success: boolean;
3016
- summary: string;
3017
- deletedMessages: number;
3018
- deletedArtifacts: number;
3019
- }
3020
3009
  interface SessionCreateParams {
3021
3010
  title: string;
3022
3011
  }
@@ -3101,6 +3090,7 @@ interface ToolCall {
3101
3090
  error?: string;
3102
3091
  durationMs?: number;
3103
3092
  }
3093
+ type UserListParams = Record<string, never>;
3104
3094
  interface UserListResult {
3105
3095
  users: SessionUser[];
3106
3096
  }
@@ -3145,13 +3135,8 @@ interface HttpDataSourceConfig {
3145
3135
  uploadEndpoint?: string;
3146
3136
  csrfToken?: string | (() => string);
3147
3137
  headers?: Record<string, string>;
3148
- timeout?: number;
3149
- /**
3150
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` or
3151
- * `ChatSession` instead. Coupling navigation to the data source causes
3152
- * component remounts during active streams.
3153
- */
3154
- navigateToSession?: (sessionId: string) => void;
3138
+ rpcTimeoutMs?: number;
3139
+ streamConnectTimeoutMs?: number;
3155
3140
  }
3156
3141
  declare class HttpDataSource implements ChatDataSource {
3157
3142
  private config;
@@ -3183,12 +3168,7 @@ declare class HttpDataSource implements ChatDataSource {
3183
3168
  deletedMessages: number;
3184
3169
  deletedArtifacts: number;
3185
3170
  }>;
3186
- compactSessionHistory(sessionId: string): Promise<{
3187
- success: boolean;
3188
- summary: string;
3189
- deletedMessages: number;
3190
- deletedArtifacts: number;
3191
- }>;
3171
+ compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
3192
3172
  listUsers(): Promise<SessionUser$1[]>;
3193
3173
  listAllSessions(options?: {
3194
3174
  limit?: number;
@@ -3211,15 +3191,12 @@ declare class HttpDataSource implements ChatDataSource {
3211
3191
  cancelStream(): void;
3212
3192
  submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3213
3193
  success: boolean;
3194
+ data?: AsyncRunAccepted;
3214
3195
  error?: string;
3215
- data?: {
3216
- session: Session$1;
3217
- turns: ConversationTurn$1[];
3218
- pendingQuestion?: PendingQuestion$1 | null;
3219
- };
3220
3196
  }>;
3221
3197
  rejectPendingQuestion(sessionId: string): Promise<{
3222
3198
  success: boolean;
3199
+ data?: AsyncRunAccepted;
3223
3200
  error?: string;
3224
3201
  }>;
3225
3202
  fetchSessionArtifacts(sessionId: string, options?: {
@@ -3235,10 +3212,6 @@ declare class HttpDataSource implements ChatDataSource {
3235
3212
  }>;
3236
3213
  renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3237
3214
  deleteSessionArtifact(artifactId: string): Promise<void>;
3238
- /**
3239
- * @deprecated Pass `onSessionCreated` to `ChatSessionProvider` instead.
3240
- */
3241
- navigateToSession?(sessionId: string): void;
3242
3215
  }
3243
3216
  /**
3244
3217
  * Factory function to create HttpDataSource
@@ -3261,7 +3234,8 @@ declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSou
3261
3234
  * @throws Error if window.__APPLET_CONTEXT__ is not available
3262
3235
  */
3263
3236
  declare function useHttpDataSourceConfigFromApplet(options?: {
3264
- timeout?: number;
3237
+ rpcTimeoutMs?: number;
3238
+ streamConnectTimeoutMs?: number;
3265
3239
  }): HttpDataSourceConfig;
3266
3240
 
3267
3241
  /**
@@ -3639,8 +3613,6 @@ interface ChatSessionProviderProps {
3639
3613
  /**
3640
3614
  * Called when the machine creates a new session (e.g. on first message in a
3641
3615
  * "new chat"). Use this to navigate your SPA router to the new session URL.
3642
- *
3643
- * Replaces the deprecated `dataSource.navigateToSession`.
3644
3616
  */
3645
3617
  onSessionCreated?: (sessionId: string) => void;
3646
3618
  children: ReactNode;
@@ -4054,6 +4026,7 @@ declare class ChatMachine {
4054
4026
  private _stopPassivePolling;
4055
4027
  private _startPassivePolling;
4056
4028
  private _runResumeStream;
4029
+ private _resumeAcceptedRunOrPoll;
4057
4030
  private _setError;
4058
4031
  private _retryFetchSession;
4059
4032
  private _clearStreamError;