@univerjs/protocol 0.1.47 → 0.1.49

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 (32) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +22 -22
  3. package/lib/types/index.d.ts +5 -4
  4. package/lib/types/ts/univer/changeset.d.ts +5 -0
  5. package/lib/types/ts/univer/constants/biz.d.ts +1 -0
  6. package/lib/types/ts/univer/constants/errors.d.ts +12 -0
  7. package/lib/types/ts/univer/event_sync.d.ts +2 -5
  8. package/lib/types/ts/univer/initial_sheet.d.ts +2 -0
  9. package/lib/types/ts/univer/workbook.d.ts +2 -0
  10. package/lib/types/ts/universer/v1/activity.d.ts +22 -0
  11. package/lib/types/ts/universer/v1/analyse_data_source.d.ts +12 -1
  12. package/lib/types/ts/universer/v1/authz.d.ts +1 -0
  13. package/lib/types/ts/universer/v1/comment.d.ts +1 -1
  14. package/lib/types/ts/universer/v1/conf.d.ts +78 -0
  15. package/lib/types/ts/universer/v1/conversation.d.ts +161 -15
  16. package/lib/types/ts/universer/v1/entitlement.d.ts +238 -0
  17. package/lib/types/ts/universer/v1/exchange.d.ts +4 -0
  18. package/lib/types/ts/universer/v1/file.d.ts +20 -0
  19. package/lib/types/ts/universer/v1/frontend_logs.d.ts +36 -0
  20. package/lib/types/ts/universer/v1/history.d.ts +50 -0
  21. package/lib/types/ts/universer/v1/oidc.d.ts +53 -0
  22. package/lib/types/ts/universer/v1/referral.d.ts +55 -0
  23. package/lib/types/ts/universer/v1/scraper.d.ts +144 -0
  24. package/lib/types/ts/universer/v1/snapshot.d.ts +25 -0
  25. package/lib/types/ts/universer/v1/toolkit.d.ts +8 -0
  26. package/lib/types/ts/universer/v1/user.d.ts +97 -0
  27. package/lib/types/ts/universer/v1/user_event.d.ts +23 -0
  28. package/lib/types/ts/universer/v1/usip.d.ts +7 -0
  29. package/lib/types/ts/universer/v1/video_task.d.ts +196 -0
  30. package/lib/types/ts/universer/v1/workspace.d.ts +1 -1
  31. package/lib/umd/index.js +1 -1
  32. package/package.json +4 -4
@@ -1,6 +1,7 @@
1
1
  import { Metadata } from '@grpc/grpc-js';
2
2
  import { Observable } from 'rxjs';
3
- import { SystemHint } from '../../ai_common/common';
3
+ import { OpenAIMessage, SystemHint } from '../../ai_common/common';
4
+ import { Changeset } from '../../univer/changeset';
4
5
  import { Error } from '../../univer/constants/errors';
5
6
  import { DataFragmentationType } from './analyse_cmn';
6
7
  import { RateDetail } from './entitlement';
@@ -10,6 +11,8 @@ export declare enum CompletionStatus {
10
11
  Completion_Completed = 1,
11
12
  Completion_UserCancelled = 2,
12
13
  Completion_SystemErr = 3,
14
+ /** Completion_Interrupted - like hunman in the loop, and etc... */
15
+ Completion_Interrupted = 4,
13
16
  UNRECOGNIZED = -1
14
17
  }
15
18
  export declare enum ConversationRoleType {
@@ -23,6 +26,22 @@ export declare enum ContentBlockType {
23
26
  ContentBlockType_Prompt = 1,
24
27
  ContentBlockType_Thinking = 2,
25
28
  ContentBlockType_Report = 3,
29
+ /** ContentBlockType_PromptV2 - map to json string of the orig SubmitPromptRequest */
30
+ ContentBlockType_PromptV2 = 4,
31
+ /** ContentBlockType_HITL - HITL event */
32
+ ContentBlockType_HITL = 103,
33
+ /** ContentBlockType_ToolCallStart - tool call start */
34
+ ContentBlockType_ToolCallStart = 105,
35
+ /** ContentBlockType_ToolCallResult - tool call end */
36
+ ContentBlockType_ToolCallResult = 106,
37
+ /** ContentBlockType_SubAgentsCallStart - sub-agents calls start */
38
+ ContentBlockType_SubAgentsCallStart = 107,
39
+ /** ContentBlockType_SubAgentsCallResult - sub-agents calls end */
40
+ ContentBlockType_SubAgentsCallResult = 108,
41
+ /** ContentBlockType_SubAgentRunStarted - sub-agent started event */
42
+ ContentBlockType_SubAgentRunStarted = 109,
43
+ /** ContentBlockType_SubAgentRunFinished - sub-agent finished event */
44
+ ContentBlockType_SubAgentRunFinished = 110,
26
45
  UNRECOGNIZED = -1
27
46
  }
28
47
  export declare enum ContentType {
@@ -36,6 +55,7 @@ export declare enum AttachmentType {
36
55
  AttachmentType_Unit = 1,
37
56
  AttachmentType_Recommendation = 3,
38
57
  AttachmentType_DataSource = 4,
58
+ AttachmentType_HitlAnswer = 5,
39
59
  UNRECOGNIZED = -1
40
60
  }
41
61
  export declare enum MessageReaction {
@@ -66,6 +86,32 @@ export declare enum ChatSSEBlockType {
66
86
  ChatSSEBlockType_ChatThinking = 9,
67
87
  /** ChatSSEBlockType_Fragmentation - content data fragmentation */
68
88
  ChatSSEBlockType_Fragmentation = 10,
89
+ /**
90
+ * ChatSSEBlockType_RawMessage - deprecated, raw message from model, just use tool message body, use ChatSSEBlockType_ToolCall instead
91
+ *
92
+ * @deprecated
93
+ */
94
+ ChatSSEBlockType_RawMessage = 101,
95
+ /**
96
+ * ChatSSEBlockType_EditThinking - deprecated, use ChatSSEBlockType_ChatThinking instead
97
+ *
98
+ * @deprecated
99
+ */
100
+ ChatSSEBlockType_EditThinking = 102,
101
+ /** ChatSSEBlockType_HITL - HITL event */
102
+ ChatSSEBlockType_HITL = 103,
103
+ /** ChatSSEBlockType_ToolCallStart - tool call start */
104
+ ChatSSEBlockType_ToolCallStart = 105,
105
+ /** ChatSSEBlockType_ToolCallResult - tool call end */
106
+ ChatSSEBlockType_ToolCallResult = 106,
107
+ /** ChatSSEBlockType_SubAgentsCallStart - sub-agents calls start */
108
+ ChatSSEBlockType_SubAgentsCallStart = 107,
109
+ /** ChatSSEBlockType_SubAgentsCallResult - sub-agents calls end */
110
+ ChatSSEBlockType_SubAgentsCallResult = 108,
111
+ /** ChatSSEBlockType_SubAgentRunStarted - sub-agent started event */
112
+ ChatSSEBlockType_SubAgentRunStarted = 109,
113
+ /** ChatSSEBlockType_SubAgentRunFinished - sub-agent finished event */
114
+ ChatSSEBlockType_SubAgentRunFinished = 110,
69
115
  UNRECOGNIZED = -1
70
116
  }
71
117
  export declare enum ChatSSEStatus {
@@ -128,8 +174,28 @@ export interface Conversation {
128
174
  title: string;
129
175
  creatorUid: string;
130
176
  expireTime: string;
177
+ /**
178
+ * version history:
179
+ * 2512--不支持unit编辑类会话
180
+ * 2601--统一分析和编辑会话
181
+ */
182
+ agentVersion: number;
183
+ /** this field is nil for old version conversations */
184
+ limits: ConversationLimits | undefined;
185
+ /** this field is nil for old version conversations */
186
+ settings: ConversationSettings | undefined;
131
187
  shared: boolean;
132
188
  }
189
+ export interface ConversationLimits {
190
+ /** cumulative tokens used in this conversation */
191
+ cumulativeTokens: number;
192
+ /** max allowed tokens in this conversation */
193
+ maxAllowedTokens: number;
194
+ }
195
+ export interface ConversationSettings {
196
+ /** add here if more settings needed in the future. */
197
+ model: string;
198
+ }
133
199
  export interface GetConversationRequest {
134
200
  conversationId: string;
135
201
  }
@@ -154,6 +220,24 @@ export interface ListConversationsResponse {
154
220
  nextBatchId: string;
155
221
  error: Error | undefined;
156
222
  }
223
+ export interface ListConversationsByUnitRequest {
224
+ /**
225
+ * batchId,
226
+ * set to empty in the 1st scroller request,
227
+ * then set to nextBatchId(which was returned by the previous request) in the following scroller request.
228
+ */
229
+ batchId: string;
230
+ /** limit, specify how many records needed. */
231
+ limit: number;
232
+ /** required */
233
+ unitId: string;
234
+ }
235
+ export interface ListConversationsByUnitResponse {
236
+ conversations: Conversation[];
237
+ hasMore: boolean;
238
+ nextBatchId: string;
239
+ error: Error | undefined;
240
+ }
157
241
  export interface RenameConversationRequest {
158
242
  conversationId: string;
159
243
  newTitle: string;
@@ -190,6 +274,7 @@ export interface ConversationMessage {
190
274
  completionStatus: CompletionStatus;
191
275
  contents: ContentBlock[];
192
276
  attachments: Attachment[];
277
+ respMeta: ChatRespMeta | undefined;
193
278
  }
194
279
  export interface ContentBlock {
195
280
  blockType: ContentBlockType;
@@ -204,8 +289,9 @@ export interface Attachment {
204
289
  * id of the Attachment,
205
290
  * vary with the AttachmentType,
206
291
  * AttachmentType_Unit -> unitId;
207
- * AttachmentType_Recommendation -> no ID;
292
+ * AttachmentType_Recommendation -> no ID needed;
208
293
  * AttachmentType_DataSource -> dataSourceId;
294
+ * AttachmentType_HitlAnswer -> no ID needed;
209
295
  */
210
296
  id: string;
211
297
  /**
@@ -213,7 +299,8 @@ export interface Attachment {
213
299
  * vary with the AttachmentType,
214
300
  * AttachmentType_Unit -> empty;
215
301
  * AttachmentType_Recommendation -> json string of recommendations(json string array);
216
- * AttachmentType_DataSource -> json string of v1.DataSource
302
+ * AttachmentType_DataSource -> json string of v1.DataSource;
303
+ * AttachmentType_HitlAnswer -> orig string of the hitl answer;
217
304
  */
218
305
  content: string;
219
306
  }
@@ -257,6 +344,12 @@ export interface SubmitPromptRequest {
257
344
  systemHints: SystemHint[];
258
345
  /** Locale Code */
259
346
  locale?: string | undefined;
347
+ /** optional, if provided, promptText will be ignored */
348
+ messages: OpenAIMessage[];
349
+ /** optional, json string array of SelectedRange, only used when messages is provided */
350
+ selectedRanges: string[];
351
+ /** optional, eg. "plan", "ask", "agent", "brainstorm" */
352
+ mode?: string | undefined;
260
353
  }
261
354
  /** SSE api: /universer-api/conversation/resume */
262
355
  export interface ResumeConversationRequest {
@@ -268,6 +361,8 @@ export interface ResumeConversationRequest {
268
361
  /** Locale Code */
269
362
  locale?: string | undefined;
270
363
  model?: string | undefined;
364
+ /** the question's owner message id which is answer to. */
365
+ answerToMessageId: string;
271
366
  }
272
367
  /** SSE api: /universer-api/conversation/reconnect */
273
368
  export interface ReconnectConversationRequest {
@@ -277,18 +372,13 @@ export interface ReconnectConversationRequest {
277
372
  export interface ChatSSEBlock {
278
373
  blockType: ChatSSEBlockType;
279
374
  /**
280
- * body,
281
- * json string identicated by blockType,
282
- * ChatSSEBlockType_EndOfStream -> empty;
283
- * ChatSSEBlockType_StreamErr -> json string of error reason: univer.constants.Error;
284
- * ChatSSEBlockType_Reject -> json string of reject reason: univer.constants.Error;
285
- * ChatSSEBlockType_ModConversation -> json string of Conversation;
286
- * ChatSSEBlockType_PromptAck -> json string of PromptAck;
287
- * ChatSSEBlockType_ChatContent -> json string of ChatContentSSEBlock;
288
- * ChatSSEBlockType_Attachment -> json string of Attachment;
289
- * ChatSSEBlockType_RespMeta -> json string of ChatRespMeta;
290
- * ChatSSEBlockType_ChatThinking -> json string of ChatThinkingSSEBlock;
291
- * ChatSSEBlockType_Fragmentation -> json string of ChatFragmentationSSEBlock;
375
+ * see ai_common/common.proto
376
+ * ChatSSEBlockType_ToolCallStart -> json string of ChatToolCallStartSSEBlock;
377
+ * ChatSSEBlockType_ToolCallResult -> json string of ChatToolCallResultSSEBlock;
378
+ * ChatSSEBlockType_SubAgentsCallStart -> json string of ChatSubAgentsCallStartSSEBlock;
379
+ * ChatSSEBlockType_SubAgentsCallResult -> json string of ChatSubAgentsCallResultSSEBlock;
380
+ * ChatSSEBlockType_SubAgentRunStarted -> json string of ChatSubAgentRunStartedSSEBlock;
381
+ * ChatSSEBlockType_SubAgentRunFinished -> json string of ChatSubAgentRunFinishedSSEBlock;
292
382
  */
293
383
  body: string;
294
384
  status: ChatSSEStatus;
@@ -314,6 +404,11 @@ export interface PromptAck {
314
404
  }
315
405
  export interface ChatRespMeta {
316
406
  messageId: string;
407
+ /** cumulative tokens used in this conversation */
408
+ cumulativeTokens: number;
409
+ /** max allowed tokens in this conversation */
410
+ maxAllowedTokens: number;
411
+ reportable: boolean;
317
412
  }
318
413
  export interface ConversationDataFragmentation {
319
414
  conversationId: string;
@@ -376,6 +471,14 @@ export interface CreateReportResponse {
376
471
  report: Report | undefined;
377
472
  error: Error | undefined;
378
473
  }
474
+ export interface RedoReportRequest {
475
+ reportId: string;
476
+ conversationId: string;
477
+ }
478
+ export interface PollingReportRequest {
479
+ reportId: string;
480
+ conversationId: string;
481
+ }
379
482
  export interface Report {
380
483
  reportId: string;
381
484
  conversationId: string;
@@ -388,13 +491,25 @@ export interface Report {
388
491
  title: string;
389
492
  summary: string;
390
493
  }
494
+ export interface ReportList {
495
+ reports: Report[];
496
+ }
391
497
  export interface ListReportsRequest {
392
498
  conversationId: string;
393
499
  }
394
500
  export interface ListReportsResponse {
501
+ /** @deprecated */
395
502
  reports: Report[];
503
+ /** messageId -> ReportList */
504
+ reportsMap: {
505
+ [key: string]: ReportList;
506
+ };
396
507
  error: Error | undefined;
397
508
  }
509
+ export interface ListReportsResponse_ReportsMapEntry {
510
+ key: string;
511
+ value: ReportList | undefined;
512
+ }
398
513
  export interface FinishReportRequest {
399
514
  reportId: string;
400
515
  status: string;
@@ -405,10 +520,36 @@ export interface FinishReportRequest {
405
520
  export interface FinishReportResponse {
406
521
  error: Error | undefined;
407
522
  }
523
+ export interface GetDashboardRequest {
524
+ conversationId: string;
525
+ }
526
+ export interface GetDashboardResponse {
527
+ conversationId: string;
528
+ dashboardJson: string;
529
+ error: Error | undefined;
530
+ }
531
+ export interface SaveDashboardRequest {
532
+ conversationId: string;
533
+ dashboardJson: string;
534
+ }
535
+ export interface SaveDashboardResponse {
536
+ error: Error | undefined;
537
+ }
538
+ export interface GetConversationCsRequest {
539
+ conversationId: string;
540
+ messageIds: string[];
541
+ }
542
+ export interface GetConversationCsResponse {
543
+ changesets: Changeset[];
544
+ startRevision: number;
545
+ endRevision: number;
546
+ error: Error | undefined;
547
+ }
408
548
  export interface ConversationService {
409
549
  GetConversation(request: GetConversationRequest, metadata?: Metadata): Observable<GetConversationResponse>;
410
550
  /** the conversation list is order by lastUpdate desc default. */
411
551
  ListConversations(request: ListConversationsRequest, metadata?: Metadata): Observable<ListConversationsResponse>;
552
+ ListConversationsByUnit(request: ListConversationsByUnitRequest, metadata?: Metadata): Observable<ListConversationsByUnitResponse>;
412
553
  RenameConversation(request: RenameConversationRequest, metadata?: Metadata): Observable<RenameConversationResponse>;
413
554
  ShareConversation(request: ShareConversationRequest, metadata?: Metadata): Observable<ShareConversationResponse>;
414
555
  UnshareConversation(request: UnshareConversationRequest, metadata?: Metadata): Observable<UnshareConversationResponse>;
@@ -427,6 +568,11 @@ export interface ConversationService {
427
568
  CancelConversation(request: CancelConversationRequest, metadata?: Metadata): Observable<CancelConversationResponse>;
428
569
  NeedReconnectConversation(request: NeedReconnectConversationRequest, metadata?: Metadata): Observable<NeedReconnectConversationResponse>;
429
570
  CreateReport(request: CreateReportRequest, metadata?: Metadata): Observable<CreateReportResponse>;
571
+ RedoReport(request: RedoReportRequest, metadata?: Metadata): Observable<CreateReportResponse>;
572
+ PollingReport(request: PollingReportRequest, metadata?: Metadata): Observable<CreateReportResponse>;
430
573
  ListReports(request: ListReportsRequest, metadata?: Metadata): Observable<ListReportsResponse>;
431
574
  FinishReport(request: FinishReportRequest, metadata?: Metadata): Observable<FinishReportResponse>;
575
+ GetDashboard(request: GetDashboardRequest, metadata?: Metadata): Observable<GetDashboardResponse>;
576
+ SaveDashboard(request: SaveDashboardRequest, metadata?: Metadata): Observable<SaveDashboardResponse>;
577
+ GetConversationCs(request: GetConversationCsRequest, metadata?: Metadata): Observable<GetConversationCsResponse>;
432
578
  }