@breign/db-schemas 0.1.39 → 0.1.41

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.
@@ -0,0 +1,85 @@
1
+ import { ChatMessageRoleUio } from '@breign/client';
2
+ export type ConversationMessageReaction = 'positive' | 'negative';
3
+ export type ConversationAttachment = {
4
+ id: string;
5
+ type: string;
6
+ name: string;
7
+ mimeType: string;
8
+ ext: string;
9
+ size: number;
10
+ key: string;
11
+ status: 'TO_UPLOAD' | 'PROCESSING' | 'PROCESSED' | 'ERROR';
12
+ url?: string;
13
+ inlineDataUrl?: string;
14
+ processed?: Record<string, unknown>;
15
+ };
16
+ export type ConversationMessage = {
17
+ id: string;
18
+ role: ChatMessageRoleUio;
19
+ content: string;
20
+ reaction?: ConversationMessageReaction | null;
21
+ reasoning?: string;
22
+ askConfirmation?: boolean;
23
+ confirmationLink?: string;
24
+ toolResults?: {
25
+ tool: {
26
+ tool: string;
27
+ toolName?: string;
28
+ params?: string;
29
+ };
30
+ result?: Record<string, unknown>;
31
+ }[];
32
+ suggestions?: {
33
+ id: string;
34
+ text: string;
35
+ }[];
36
+ flowNode?: string;
37
+ flowNodeRequirementsChecked?: boolean;
38
+ flowNodeRequirementsMet?: boolean;
39
+ flowNodeRequirementsCheckReason?: string;
40
+ flowNodeIterations?: number;
41
+ timestamp: string;
42
+ actions?: Record<string, unknown>[];
43
+ attachments?: ConversationAttachment[];
44
+ status?: 'generating' | 'completed' | 'error' | 'tool_calling' | 'moderated';
45
+ toolCall?: {
46
+ name: string;
47
+ stepIndex: number;
48
+ };
49
+ error?: {
50
+ code: string;
51
+ message: string;
52
+ details?: Record<string, unknown>;
53
+ };
54
+ };
55
+ export type ConversationContext = {
56
+ attachments: ConversationAttachment[];
57
+ openaiThreadId?: string;
58
+ openaiPreviousResponseId?: string;
59
+ location?: {
60
+ latitude: string;
61
+ longitude: string;
62
+ };
63
+ custom?: Record<string, string>;
64
+ lastActivityAt?: string;
65
+ };
66
+ export type Conversation = {
67
+ id: string;
68
+ type?: 'chat' | 'task';
69
+ lang: string;
70
+ agentId: string;
71
+ appId?: string;
72
+ moderationTriggered?: boolean;
73
+ instanceId?: string;
74
+ userId?: string;
75
+ customUserId?: string;
76
+ summary?: string;
77
+ init?: string;
78
+ messages: ConversationMessage[];
79
+ createdAt: string;
80
+ updatedAt: string;
81
+ context: ConversationContext;
82
+ isAsync?: boolean;
83
+ ephemeral?: boolean;
84
+ title?: string;
85
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,6 +3,7 @@ export * from './app';
3
3
  export * from './flow';
4
4
  export * from './flow-editor';
5
5
  export * from './advanced-flow-editor';
6
+ export * from './conversation';
6
7
  export * from './file';
7
8
  export * from './engine';
8
9
  export * from './knowledge';
@@ -19,6 +19,7 @@ __exportStar(require("./app"), exports);
19
19
  __exportStar(require("./flow"), exports);
20
20
  __exportStar(require("./flow-editor"), exports);
21
21
  __exportStar(require("./advanced-flow-editor"), exports);
22
+ __exportStar(require("./conversation"), exports);
22
23
  __exportStar(require("./file"), exports);
23
24
  __exportStar(require("./engine"), exports);
24
25
  __exportStar(require("./knowledge"), exports);
@@ -1,9 +1,11 @@
1
+ export type ToolScope = 'organization' | 'user';
1
2
  export type Tool = {
2
3
  _id: string;
3
4
  orgId: string;
4
5
  type: string;
5
6
  name: string;
6
7
  description?: string;
8
+ scope?: ToolScope;
7
9
  configuration?: Record<string, unknown> & {
8
10
  url?: string;
9
11
  transport?: 'http' | 'sse';
@@ -14,6 +16,7 @@ export type Tool = {
14
16
  clientSecret?: string;
15
17
  clientName?: string;
16
18
  public?: boolean;
19
+ redirectUri?: string;
17
20
  authorizationServer: string;
18
21
  authorizationServerMetadata?: {
19
22
  issuer: string;
@@ -42,13 +45,13 @@ export type Tool = {
42
45
  */
43
46
  isSetup?: boolean;
44
47
  credentials?: {
45
- [userId: string]: {
46
- codeChallenge: string;
47
- codeVerifier: string;
48
- requestedAt: string;
49
- requestedBy: string;
50
- scope: string;
51
- state: string;
48
+ [credentialsId: string]: {
49
+ codeChallenge?: string;
50
+ codeVerifier?: string;
51
+ requestedAt?: string;
52
+ requestedBy?: string;
53
+ scope?: string;
54
+ state?: string;
52
55
  tokens?: {
53
56
  access_token: string;
54
57
  refresh_token?: string;
@@ -58,6 +61,8 @@ export type Tool = {
58
61
  scope: string;
59
62
  id_token: string;
60
63
  };
64
+ bearerToken?: string;
65
+ headerValue?: string;
61
66
  };
62
67
  };
63
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/db-schemas",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,83 @@
1
+ import { ChatMessageRoleUio } from '@breign/client';
2
+
3
+ export type ConversationMessageReaction = 'positive' | 'negative';
4
+
5
+ export type ConversationAttachment = {
6
+ id: string;
7
+ type: string;
8
+ name: string;
9
+ mimeType: string;
10
+ ext: string;
11
+ size: number;
12
+ key: string;
13
+ status: 'TO_UPLOAD' | 'PROCESSING' | 'PROCESSED' | 'ERROR';
14
+ url?: string;
15
+ inlineDataUrl?: string;
16
+ processed?: Record<string, unknown>;
17
+ };
18
+
19
+ export type ConversationMessage = {
20
+ id: string;
21
+ role: ChatMessageRoleUio;
22
+ content: string;
23
+ reaction?: ConversationMessageReaction | null;
24
+ reasoning?: string;
25
+ askConfirmation?: boolean;
26
+ confirmationLink?: string;
27
+ toolResults?: {
28
+ tool: { tool: string; toolName?: string; params?: string };
29
+ result?: Record<string, unknown>;
30
+ }[];
31
+ suggestions?: {
32
+ id: string;
33
+ text: string;
34
+ }[];
35
+ flowNode?: string;
36
+ flowNodeRequirementsChecked?: boolean;
37
+ flowNodeRequirementsMet?: boolean;
38
+ flowNodeRequirementsCheckReason?: string;
39
+ flowNodeIterations?: number;
40
+ timestamp: string;
41
+ actions?: Record<string, unknown>[];
42
+ attachments?: ConversationAttachment[];
43
+ status?: 'generating' | 'completed' | 'error' | 'tool_calling' | 'moderated';
44
+ toolCall?: { name: string; stepIndex: number };
45
+ error?: {
46
+ code: string;
47
+ message: string;
48
+ details?: Record<string, unknown>;
49
+ };
50
+ };
51
+
52
+ export type ConversationContext = {
53
+ attachments: ConversationAttachment[];
54
+ openaiThreadId?: string;
55
+ openaiPreviousResponseId?: string;
56
+ location?: {
57
+ latitude: string;
58
+ longitude: string;
59
+ };
60
+ custom?: Record<string, string>;
61
+ lastActivityAt?: string;
62
+ };
63
+
64
+ export type Conversation = {
65
+ id: string;
66
+ type?: 'chat' | 'task';
67
+ lang: string;
68
+ agentId: string;
69
+ appId?: string;
70
+ moderationTriggered?: boolean;
71
+ instanceId?: string;
72
+ userId?: string;
73
+ customUserId?: string;
74
+ summary?: string;
75
+ init?: string;
76
+ messages: ConversationMessage[];
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ context: ConversationContext;
80
+ isAsync?: boolean;
81
+ ephemeral?: boolean;
82
+ title?: string;
83
+ };
@@ -3,6 +3,7 @@ export * from './app';
3
3
  export * from './flow';
4
4
  export * from './flow-editor';
5
5
  export * from './advanced-flow-editor';
6
+ export * from './conversation';
6
7
  export * from './file';
7
8
  export * from './engine';
8
9
  export * from './knowledge';
package/src/types/tool.ts CHANGED
@@ -1,9 +1,12 @@
1
+ export type ToolScope = 'organization' | 'user';
2
+
1
3
  export type Tool = {
2
4
  _id: string;
3
5
  orgId: string;
4
6
  type: string;
5
7
  name: string;
6
8
  description?: string;
9
+ scope?: ToolScope;
7
10
  configuration?: Record<string, unknown> & {
8
11
  url?: string;
9
12
  transport?: 'http' | 'sse';
@@ -14,6 +17,7 @@ export type Tool = {
14
17
  clientSecret?: string;
15
18
  clientName?: string;
16
19
  public?: boolean;
20
+ redirectUri?: string;
17
21
  authorizationServer: string;
18
22
  authorizationServerMetadata?: {
19
23
  issuer: string;
@@ -42,13 +46,13 @@ export type Tool = {
42
46
  */
43
47
  isSetup?: boolean;
44
48
  credentials?: {
45
- [userId: string]: {
46
- codeChallenge: string;
47
- codeVerifier: string;
48
- requestedAt: string;
49
- requestedBy: string;
50
- scope: string;
51
- state: string;
49
+ [credentialsId: string]: {
50
+ codeChallenge?: string;
51
+ codeVerifier?: string;
52
+ requestedAt?: string;
53
+ requestedBy?: string;
54
+ scope?: string;
55
+ state?: string;
52
56
  tokens?: {
53
57
  access_token: string;
54
58
  refresh_token?: string;
@@ -58,6 +62,8 @@ export type Tool = {
58
62
  scope: string;
59
63
  id_token: string;
60
64
  };
65
+ bearerToken?: string;
66
+ headerValue?: string;
61
67
  };
62
68
  };
63
69
  };