@breign/db-schemas 0.1.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/.editorconfig ADDED
@@ -0,0 +1,10 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ max_line_length = 100
10
+ tab_width = 2
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,51 @@
1
+ image: node:22-alpine
2
+
3
+ default:
4
+ tags:
5
+ - cluster
6
+
7
+ stages:
8
+ - setup
9
+ - build
10
+ - publish
11
+
12
+ install:
13
+ stage: setup
14
+ script:
15
+ - npm ci
16
+ cache:
17
+ key: ${CI_COMMIT_REF_SLUG}
18
+ paths:
19
+ - node_modules/
20
+ only:
21
+ - main
22
+
23
+ build:
24
+ stage: build
25
+ script:
26
+ - npm run build
27
+ artifacts:
28
+ paths:
29
+ - dist/
30
+ cache:
31
+ key: ${CI_COMMIT_REF_SLUG}
32
+ paths:
33
+ - node_modules/
34
+ policy: pull
35
+ only:
36
+ - main
37
+
38
+ publish:
39
+ stage: publish
40
+ script:
41
+ - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
42
+ - NEW_VERSION=$(./scripts/compute-package-version.sh)
43
+ - npm version $NEW_VERSION --no-git-tag-version --allow-same-version
44
+ - npm publish --access public
45
+ cache:
46
+ key: ${CI_COMMIT_REF_SLUG}
47
+ paths:
48
+ - node_modules/
49
+ policy: pull
50
+ only:
51
+ - main
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v22.13.1
package/.prettierrc.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ semi: true,
3
+ trailingComma: 'all',
4
+ singleQuote: true,
5
+ tabWidth: 2,
6
+ };
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Brain DB Schemas
2
+
3
+ This repository contains the database schema definitions for the Brain project. These schemas are used to define the structure of data stored and managed within the Brain ecosystem.
4
+
5
+ ## Usage
6
+
7
+ Specific instructions for using or contributing to these schemas will depend on the exact technology and integration with other Brain components. Generally, these schemas serve as the foundation for data consistency across the system.
8
+
9
+ ## Local Development with @breign/client
10
+
11
+ This project depends on the `@breign/client` package. Several utility scripts are available to manage this dependency:
12
+
13
+ ### Available Scripts
14
+
15
+ - `npm run link-project:client`: Links the local `@breign/client` project for development
16
+ - `npm run install-latest:client`: Installs the latest published version of `@breign/client`
17
+ - `npm run reinstall:client`: Reinstalls the `@breign/client` package (useful for resolving dependency issues)
18
+
19
+ To work with a local version of `@breign/client`, use the `link-project:client` script. For production builds, use `install-latest:client` to ensure you're using the latest published version.
@@ -0,0 +1 @@
1
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,80 @@
1
+ import { AgentModuleTypeUio, AgentTypeUio } from '@breign/client';
2
+ import { FlowNode } from './flow';
3
+ export type Agent = {
4
+ id: string;
5
+ name: string;
6
+ engine?: AgentEngine;
7
+ organisationId: string;
8
+ modules: {
9
+ [name: string]: AgentModule;
10
+ };
11
+ tools?: AgentTool[];
12
+ knowledgeBaseIds: string[];
13
+ persona: {
14
+ default: string;
15
+ };
16
+ promptInit: {
17
+ [lang: string]: string;
18
+ default: string;
19
+ };
20
+ flow?: FlowNode['id'] | null;
21
+ subscription?: AgentSubscription;
22
+ speechOverrides?: {
23
+ [text: string]: string;
24
+ };
25
+ profilePicture?: string;
26
+ role?: string;
27
+ defaultLanguage?: string;
28
+ description?: string;
29
+ template?: string;
30
+ isTemplate?: boolean;
31
+ color?: string;
32
+ picture?: string;
33
+ createdAt?: string;
34
+ updatedAt?: string;
35
+ isActivated?: boolean;
36
+ agentType?: AgentTypeUio;
37
+ };
38
+ export type AgentKnowledgeBase = {
39
+ id: string;
40
+ name: string;
41
+ privacy: 'private' | 'public';
42
+ organisationId: string;
43
+ authorizedAgents: string[];
44
+ };
45
+ export type AgentEngine = {
46
+ providerId: string;
47
+ model: string;
48
+ };
49
+ export type AgentModule = {
50
+ type: AgentModuleTypeUio;
51
+ name: string;
52
+ configuration: Record<string, any>;
53
+ restricted?: boolean;
54
+ };
55
+ export type AgentTool = {
56
+ id: string;
57
+ name: string;
58
+ type: string;
59
+ orgId: string;
60
+ description: string;
61
+ configuration?: Record<string, unknown>;
62
+ manifest?: Record<string, unknown>;
63
+ restricted?: boolean;
64
+ };
65
+ export type AgentSubscription = {
66
+ textInteractions: Interaction;
67
+ voiceInteractions: Interaction;
68
+ canGoBeyondIncluded: boolean;
69
+ startDate?: Date;
70
+ endDate?: Date;
71
+ };
72
+ export type Interaction = {
73
+ included: number;
74
+ additional: Additional;
75
+ };
76
+ export type Additional = {
77
+ price: string;
78
+ amountForPrice: string;
79
+ currency: string;
80
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { ProviderTypeUio } from '@breign/client';
2
+ export type Provider = {
3
+ id: string;
4
+ name: string;
5
+ providerType: ProviderTypeUio;
6
+ models: string[];
7
+ apiKey: string;
8
+ endpoint?: string;
9
+ createdAt: Date;
10
+ organizationId: string;
11
+ };
12
+ export type ProviderSimple = Pick<Provider, 'id' | 'name' | 'providerType' | 'models'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { FileStatusUio } from '@breign/client';
2
+ export type File = {
3
+ id: string;
4
+ contentType: string;
5
+ ext: string;
6
+ hash: string;
7
+ size: number;
8
+ key: string;
9
+ createdAt: string;
10
+ status: FileStatusUio;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,68 @@
1
+ export type FlowNode = {
2
+ id: string;
3
+ brainId: string;
4
+ entrypoints?: {
5
+ nodes?: string[];
6
+ intents: string[];
7
+ };
8
+ exits?: FlowNodeExits;
9
+ contents?: FlowNodeContents;
10
+ options?: {
11
+ conditions: {
12
+ [property: string]: Record<string, any>;
13
+ };
14
+ exits?: FlowNodeExits;
15
+ contents?: FlowNodeContents;
16
+ }[];
17
+ };
18
+ export type FlowNodeContents = {
19
+ rephrase?: boolean;
20
+ text?: string;
21
+ texts?: string[];
22
+ instructions?: string;
23
+ tools?: {
24
+ /**
25
+ * Prevents the agent from using any tools other than those listed when at this node.
26
+ * Any tools marked as `restricted` listed in `exclusive` will be allowed as well (even if not specified in the `allowed` array).
27
+ */
28
+ exclusive?: string[];
29
+ /**
30
+ * Prevents the agent from using the tools listed when at this node.
31
+ */
32
+ forbidden?: string[];
33
+ /**
34
+ * By default, tools marked as `restricted` cannot be used by the agent. If a tool is listed in the `allowed` array, the agent can use it when at this node.
35
+ */
36
+ allowed?: string[];
37
+ };
38
+ suggestions?: {
39
+ id: string;
40
+ text: string;
41
+ }[];
42
+ };
43
+ export type FlowNodeExits = {
44
+ nodes?: string[];
45
+ /**
46
+ * Will force the brain to choose one of the nodes in the nodes array, or default to the defaultExitNode.
47
+ */
48
+ forceNodes?: boolean;
49
+ /**
50
+ * If forceNode is true, and no node intent match from the nodes array, the defaultExitNode will be used.
51
+ */
52
+ defaultExitNode?: string;
53
+ /**
54
+ * Add requirements to allow leaving the node. As long as the requirements are not met, the agent will not continue forward and will remain at this node
55
+ * attempting to fulfill the requirements, staying into a loop.
56
+ */
57
+ requirements?: {
58
+ maxIterations?: 5;
59
+ /**
60
+ * If the maxIterations is reached without satisfying the requirements, the agent will be forced to go to the onFailure node.
61
+ * The onFailure node doesn't have to be listed in the exits nodes array.
62
+ */
63
+ onFailure?: string;
64
+ evaluation: {
65
+ instructions: string[];
66
+ };
67
+ };
68
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export * from './agent';
2
+ export * from './flow';
3
+ export * from './file';
4
+ export * from './engine';
5
+ export * from './knowledge';
6
+ export * from './organization';
7
+ export * from './user';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./agent"), exports);
18
+ __exportStar(require("./flow"), exports);
19
+ __exportStar(require("./file"), exports);
20
+ __exportStar(require("./engine"), exports);
21
+ __exportStar(require("./knowledge"), exports);
22
+ __exportStar(require("./organization"), exports);
23
+ __exportStar(require("./user"), exports);
@@ -0,0 +1,36 @@
1
+ import { Agent } from './agent';
2
+ import { FileStatusUio } from '@breign/client';
3
+ export type KnowledgeBaseModule = {
4
+ type: string;
5
+ name: string;
6
+ configuration: {
7
+ [key: string]: unknown;
8
+ };
9
+ };
10
+ export type KnowledgeBase = {
11
+ id: string;
12
+ name: string;
13
+ organizationId: string;
14
+ authorizedAgents: Agent['id'][];
15
+ modules: {
16
+ [moduleName: string]: KnowledgeBaseModule;
17
+ };
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ };
21
+ export type Knowledge = {
22
+ id: string;
23
+ knowledgeBaseId: string;
24
+ key: string;
25
+ name: string;
26
+ uploadId?: string;
27
+ postURL?: string;
28
+ formData?: string;
29
+ contentType?: string;
30
+ ext?: string;
31
+ size?: number;
32
+ hash?: string;
33
+ status: FileStatusUio;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export type Organization = {
2
+ id: string;
3
+ slug: string;
4
+ name: string;
5
+ engine?: {
6
+ providerId: string;
7
+ model: string;
8
+ };
9
+ users: {
10
+ id: string;
11
+ role: 'admin' | 'user' | string;
12
+ }[];
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ export type ApiKey = {
2
+ id: string;
3
+ name: string;
4
+ keySecret: string;
5
+ };
6
+ export type User = {
7
+ id: string;
8
+ user: {
9
+ email: string;
10
+ };
11
+ isAdmin: boolean;
12
+ canCreateAgents: boolean;
13
+ maxAgents?: number;
14
+ agents: string[];
15
+ allAgents: boolean;
16
+ apiKeys: ApiKey[];
17
+ createdAt: string;
18
+ locked?: boolean;
19
+ lockDate?: string;
20
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@breign/db-schemas",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "watch": "tsc -w",
9
+ "link-project:client": "zx scripts/link-project.mjs",
10
+ "install-latest:client": "zx scripts/install-latest-client.mjs",
11
+ "reinstall:client": "zx scripts/reinstall-client.mjs"
12
+ },
13
+ "devDependencies": {
14
+ "typescript": "^5.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@breign/client": "^1.0.11",
18
+ "prettier": "^3.5.3",
19
+ "zx": "^8.5.5"
20
+ }
21
+ }
@@ -0,0 +1,14 @@
1
+ CURRENT_VERSION=$(npm view @breign/db-schemas version || echo "0.1.0")
2
+ LOCAL_VERSION=$(node -p "require('./package.json').version")
3
+ LOCAL_MAJOR=$(echo $LOCAL_VERSION | cut -d. -f1)
4
+ LOCAL_MINOR=$(echo $LOCAL_VERSION | cut -d. -f2)
5
+ CURRENT_MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
6
+ CURRENT_MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
7
+ CURRENT_PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
8
+
9
+ if [ "$LOCAL_MAJOR" -eq "$CURRENT_MAJOR" ] && [ "$LOCAL_MINOR" -eq "$CURRENT_MINOR" ]; then
10
+ NEW_VERSION="$CURRENT_MAJOR.$(($CURRENT_MINOR)).$((CURRENT_PATCH + 1))"
11
+ else
12
+ NEW_VERSION="$LOCAL_MAJOR.$LOCAL_MINOR.0"
13
+ fi
14
+ echo "$NEW_VERSION"
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env zx
2
+ import { $, echo, spinner } from 'zx';
3
+
4
+ echo(`Installing latest version of @breign/client`);
5
+
6
+ await spinner(async () => {
7
+ await $`yalc remove @breign/client`;
8
+ await $`npm uninstall @breign/client`;
9
+ await $`npm install @breign/client`;
10
+ });
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env zx
2
+ import { echo, spinner, $, cd } from 'zx';
3
+ import path from 'path';
4
+
5
+ echo('Linking Brain Client local package');
6
+
7
+ // get project path
8
+ const currentPath = path.resolve(path.dirname('.'));
9
+
10
+ // change directory back to current directory
11
+ cd(path.join(currentPath, '..', 'brain-client'));
12
+
13
+ echo('Publish local package');
14
+ await spinner(() => $`yalc publish`);
15
+
16
+ cd(currentPath);
17
+ echo('Installing local package');
18
+ await spinner(() => $`yalc add @breign/client`);
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env zx
2
+ import path from 'node:path';
3
+ import { $, echo, fs, spinner } from 'zx';
4
+
5
+ (async () => {
6
+ await $`yalc remove @breign/client`;
7
+ const { dependencies } = await fs.readJSON(
8
+ path.join(path.dirname('..'), 'package.json')
9
+ );
10
+ const cleanedVersion = String(
11
+ dependencies['@breign/client']
12
+ ).replace('^', '');
13
+
14
+ echo(
15
+ `Reinstalling version "${cleanedVersion}" of @breign/client`
16
+ );
17
+
18
+ await spinner(async () => {
19
+ await $`npm uninstall @breign/client`;
20
+ await $`npm install @breign/client@${cleanedVersion}`;
21
+ });
22
+ })();
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,83 @@
1
+ import { AgentModuleTypeUio, AgentTypeUio } from '@breign/client';
2
+ import { FlowNode } from './flow';
3
+
4
+ export type Agent = {
5
+ id: string;
6
+ name: string;
7
+ engine?: AgentEngine;
8
+ organisationId: string;
9
+ modules: { [name: string]: AgentModule };
10
+ tools?: AgentTool[];
11
+ knowledgeBaseIds: string[];
12
+ persona: { default: string };
13
+ promptInit: { [lang: string]: string; default: string };
14
+ flow?: FlowNode['id'] | null;
15
+ subscription?: AgentSubscription;
16
+ /*
17
+ * The following properties are used to override the default speech synthesis pronounciation of certain words.
18
+ * Exemple: { "mehera": "mera" }
19
+ */
20
+ speechOverrides?: { [text: string]: string };
21
+ profilePicture?: string;
22
+ role?: string;
23
+ defaultLanguage?: string;
24
+ description?: string;
25
+ template?: string;
26
+ isTemplate?: boolean;
27
+ color?: string;
28
+ picture?: string;
29
+ createdAt?: string;
30
+ updatedAt?: string;
31
+ isActivated?: boolean;
32
+ agentType?: AgentTypeUio;
33
+ };
34
+
35
+ export type AgentKnowledgeBase = {
36
+ id: string;
37
+ name: string;
38
+ privacy: 'private' | 'public';
39
+ organisationId: string;
40
+ authorizedAgents: string[];
41
+ };
42
+
43
+ export type AgentEngine = {
44
+ providerId: string;
45
+ model: string;
46
+ };
47
+
48
+ export type AgentModule = {
49
+ type: AgentModuleTypeUio;
50
+ name: string;
51
+ configuration: Record<string, any>;
52
+ restricted?: boolean;
53
+ };
54
+
55
+ export type AgentTool = {
56
+ id: string;
57
+ name: string;
58
+ type: string;
59
+ orgId: string;
60
+ description: string;
61
+ configuration?: Record<string, unknown>;
62
+ manifest?: Record<string, unknown>;
63
+ restricted?: boolean;
64
+ };
65
+
66
+ export type AgentSubscription = {
67
+ textInteractions: Interaction;
68
+ voiceInteractions: Interaction;
69
+ canGoBeyondIncluded: boolean;
70
+ startDate?: Date;
71
+ endDate?: Date;
72
+ };
73
+
74
+ export type Interaction = {
75
+ included: number;
76
+ additional: Additional;
77
+ };
78
+
79
+ export type Additional = {
80
+ price: string;
81
+ amountForPrice: string;
82
+ currency: string;
83
+ };
@@ -0,0 +1,14 @@
1
+ import { ProviderTypeUio } from '@breign/client';
2
+
3
+ export type Provider = {
4
+ id: string;
5
+ name: string;
6
+ providerType: ProviderTypeUio;
7
+ models: string[];
8
+ apiKey: string;
9
+ endpoint?: string; // TODO: mandatory ?
10
+ createdAt: Date;
11
+ organizationId: string;
12
+ };
13
+
14
+ export type ProviderSimple = Pick<Provider, 'id' | 'name' | 'providerType' | 'models'>;
@@ -0,0 +1,12 @@
1
+ import { FileStatusUio } from '@breign/client';
2
+
3
+ export type File = {
4
+ id: string;
5
+ contentType: string;
6
+ ext: string;
7
+ hash: string;
8
+ size: number;
9
+ key: string;
10
+ createdAt: string;
11
+ status: FileStatusUio;
12
+ };
@@ -0,0 +1,72 @@
1
+ export type FlowNode = {
2
+ id: string;
3
+ brainId: string;
4
+ entrypoints?: {
5
+ nodes?: string[];
6
+ intents: string[];
7
+ };
8
+ exits?: FlowNodeExits;
9
+ contents?: FlowNodeContents;
10
+ options?: {
11
+ conditions: { [property: string]: Record<string, any> };
12
+ exits?: FlowNodeExits;
13
+ contents?: FlowNodeContents;
14
+ }[];
15
+ };
16
+
17
+ export type FlowNodeContents = {
18
+ rephrase?: boolean;
19
+ text?: string;
20
+ texts?: string[];
21
+ instructions?: string;
22
+ tools?: {
23
+ /**
24
+ * Prevents the agent from using any tools other than those listed when at this node.
25
+ * Any tools marked as `restricted` listed in `exclusive` will be allowed as well (even if not specified in the `allowed` array).
26
+ */
27
+ exclusive?: string[];
28
+
29
+ /**
30
+ * Prevents the agent from using the tools listed when at this node.
31
+ */
32
+ forbidden?: string[];
33
+
34
+ /**
35
+ * By default, tools marked as `restricted` cannot be used by the agent. If a tool is listed in the `allowed` array, the agent can use it when at this node.
36
+ */
37
+ allowed?: string[];
38
+ };
39
+ suggestions?: {
40
+ id: string;
41
+ text: string;
42
+ }[];
43
+ };
44
+
45
+ export type FlowNodeExits = {
46
+ nodes?: string[];
47
+ /**
48
+ * Will force the brain to choose one of the nodes in the nodes array, or default to the defaultExitNode.
49
+ */
50
+ forceNodes?: boolean;
51
+ /**
52
+ * If forceNode is true, and no node intent match from the nodes array, the defaultExitNode will be used.
53
+ */
54
+ defaultExitNode?: string;
55
+
56
+ /**
57
+ * Add requirements to allow leaving the node. As long as the requirements are not met, the agent will not continue forward and will remain at this node
58
+ * attempting to fulfill the requirements, staying into a loop.
59
+ */
60
+ requirements?: {
61
+ maxIterations?: 5; // Maximum number of iterations to perform before the agent is forced to abandon the node.
62
+
63
+ /**
64
+ * If the maxIterations is reached without satisfying the requirements, the agent will be forced to go to the onFailure node.
65
+ * The onFailure node doesn't have to be listed in the exits nodes array.
66
+ */
67
+ onFailure?: string;
68
+ evaluation: {
69
+ instructions: string[]; // // A set of instructions to evaluate the requirements. If each instruction is satisfied (check by AI), the agent can leave the node.
70
+ };
71
+ };
72
+ };
@@ -0,0 +1,7 @@
1
+ export * from './agent';
2
+ export * from './flow';
3
+ export * from './file';
4
+ export * from './engine';
5
+ export * from './knowledge';
6
+ export * from './organization';
7
+ export * from './user';
@@ -0,0 +1,38 @@
1
+ import { Agent } from './agent';
2
+ import { FileStatusUio } from '@breign/client';
3
+
4
+ export type KnowledgeBaseModule = {
5
+ type: string;
6
+ name: string;
7
+ configuration: { [key: string]: unknown };
8
+ };
9
+
10
+ export type KnowledgeBase = {
11
+ id: string;
12
+ name: string;
13
+ organizationId: string;
14
+ authorizedAgents: Agent['id'][];
15
+ modules: { [moduleName: string]: KnowledgeBaseModule };
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ };
19
+
20
+ export type Knowledge = {
21
+ id: string;
22
+ knowledgeBaseId: string;
23
+ key: string;
24
+ name: string;
25
+
26
+ uploadId?: string;
27
+ postURL?: string;
28
+ formData?: string;
29
+ contentType?: string;
30
+ ext?: string;
31
+ size?: number;
32
+ hash?: string;
33
+
34
+ status: FileStatusUio;
35
+
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ };
@@ -0,0 +1,13 @@
1
+ export type Organization = {
2
+ id: string;
3
+ slug: string;
4
+ name: string;
5
+ engine?: {
6
+ providerId: string;
7
+ model: string;
8
+ };
9
+ users: {
10
+ id: string;
11
+ role: 'admin' | 'user' | string;
12
+ }[];
13
+ };
@@ -0,0 +1,21 @@
1
+ export type ApiKey = {
2
+ id: string;
3
+ name: string;
4
+ keySecret: string;
5
+ };
6
+
7
+ export type User = {
8
+ id: string;
9
+ user: {
10
+ email: string;
11
+ };
12
+ isAdmin: boolean;
13
+ canCreateAgents: boolean;
14
+ maxAgents?: number;
15
+ agents: string[];
16
+ allAgents: boolean;
17
+ apiKeys: ApiKey[];
18
+ createdAt: string;
19
+ locked?: boolean;
20
+ lockDate?: string;
21
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2018",
4
+ "module": "commonjs",
5
+ "outDir": "./dist",
6
+ "rootDir": "./src",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "moduleResolution": "node",
12
+ "declaration": true
13
+ },
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules"]
16
+ }