@vertesia/common 0.77.0 → 0.78.0-dev-715074d
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/package.json +43 -38
- package/src/access-control.ts +5 -4
- package/src/apikey.ts +23 -21
- package/src/apps.ts +66 -0
- package/src/index.ts +3 -1
- package/src/interaction.ts +140 -18
- package/src/payload.ts +2 -4
- package/src/project.ts +0 -2
- package/src/prompt.ts +16 -9
- package/src/query.ts +2 -0
- package/src/rate-limiter.ts +34 -0
- package/src/store/collections.ts +1 -0
- package/src/store/store.ts +12 -0
- package/src/store/workflow.ts +48 -6
- package/src/sts-token-types.ts +114 -0
- package/src/utils/schemas.ts +4 -4
- package/LICENSE +0 -13
- package/lib/cjs/Progress.js +0 -61
- package/lib/cjs/Progress.js.map +0 -1
- package/lib/cjs/access-control.js +0 -55
- package/lib/cjs/access-control.js.map +0 -1
- package/lib/cjs/analytics.js +0 -3
- package/lib/cjs/analytics.js.map +0 -1
- package/lib/cjs/apikey.js +0 -14
- package/lib/cjs/apikey.js.map +0 -1
- package/lib/cjs/apps.js +0 -3
- package/lib/cjs/apps.js.map +0 -1
- package/lib/cjs/common.js +0 -3
- package/lib/cjs/common.js.map +0 -1
- package/lib/cjs/environment.js +0 -44
- package/lib/cjs/environment.js.map +0 -1
- package/lib/cjs/facets.js +0 -3
- package/lib/cjs/facets.js.map +0 -1
- package/lib/cjs/group.js +0 -5
- package/lib/cjs/group.js.map +0 -1
- package/lib/cjs/index.js +0 -45
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/integrations.js +0 -12
- package/lib/cjs/integrations.js.map +0 -1
- package/lib/cjs/interaction.js +0 -64
- package/lib/cjs/interaction.js.map +0 -1
- package/lib/cjs/json-schema.js +0 -3
- package/lib/cjs/json-schema.js.map +0 -1
- package/lib/cjs/json.js +0 -3
- package/lib/cjs/json.js.map +0 -1
- package/lib/cjs/meters.js +0 -13
- package/lib/cjs/meters.js.map +0 -1
- package/lib/cjs/model_utility.js +0 -6
- package/lib/cjs/model_utility.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/payload.js +0 -3
- package/lib/cjs/payload.js.map +0 -1
- package/lib/cjs/project.js +0 -61
- package/lib/cjs/project.js.map +0 -1
- package/lib/cjs/prompt.js +0 -21
- package/lib/cjs/prompt.js.map +0 -1
- package/lib/cjs/query.js +0 -3
- package/lib/cjs/query.js.map +0 -1
- package/lib/cjs/refs.js +0 -14
- package/lib/cjs/refs.js.map +0 -1
- package/lib/cjs/runs.js +0 -3
- package/lib/cjs/runs.js.map +0 -1
- package/lib/cjs/store/activity-catalog.js +0 -3
- package/lib/cjs/store/activity-catalog.js.map +0 -1
- package/lib/cjs/store/agent.js +0 -3
- package/lib/cjs/store/agent.js.map +0 -1
- package/lib/cjs/store/collections.js +0 -9
- package/lib/cjs/store/collections.js.map +0 -1
- package/lib/cjs/store/common.js +0 -3
- package/lib/cjs/store/common.js.map +0 -1
- package/lib/cjs/store/doc-analyzer.js +0 -3
- package/lib/cjs/store/doc-analyzer.js.map +0 -1
- package/lib/cjs/store/dsl-workflow.js +0 -5
- package/lib/cjs/store/dsl-workflow.js.map +0 -1
- package/lib/cjs/store/index.js +0 -28
- package/lib/cjs/store/index.js.map +0 -1
- package/lib/cjs/store/object-types.js +0 -98
- package/lib/cjs/store/object-types.js.map +0 -1
- package/lib/cjs/store/signals.js +0 -3
- package/lib/cjs/store/signals.js.map +0 -1
- package/lib/cjs/store/store.js +0 -34
- package/lib/cjs/store/store.js.map +0 -1
- package/lib/cjs/store/temporalio.js +0 -44
- package/lib/cjs/store/temporalio.js.map +0 -1
- package/lib/cjs/store/workflow.js +0 -49
- package/lib/cjs/store/workflow.js.map +0 -1
- package/lib/cjs/tenant.js +0 -3
- package/lib/cjs/tenant.js.map +0 -1
- package/lib/cjs/training.js +0 -14
- package/lib/cjs/training.js.map +0 -1
- package/lib/cjs/transient-tokens.js +0 -9
- package/lib/cjs/transient-tokens.js.map +0 -1
- package/lib/cjs/user.js +0 -17
- package/lib/cjs/user.js.map +0 -1
- package/lib/cjs/utils/auth.js +0 -15
- package/lib/cjs/utils/auth.js.map +0 -1
- package/lib/cjs/utils/schemas.js +0 -66
- package/lib/cjs/utils/schemas.js.map +0 -1
- package/lib/cjs/utils/type-helpers.js +0 -3
- package/lib/cjs/utils/type-helpers.js.map +0 -1
- package/lib/esm/Progress.js +0 -57
- package/lib/esm/Progress.js.map +0 -1
- package/lib/esm/access-control.js +0 -52
- package/lib/esm/access-control.js.map +0 -1
- package/lib/esm/analytics.js +0 -2
- package/lib/esm/analytics.js.map +0 -1
- package/lib/esm/apikey.js +0 -11
- package/lib/esm/apikey.js.map +0 -1
- package/lib/esm/apps.js +0 -2
- package/lib/esm/apps.js.map +0 -1
- package/lib/esm/common.js +0 -2
- package/lib/esm/common.js.map +0 -1
- package/lib/esm/environment.js +0 -41
- package/lib/esm/environment.js.map +0 -1
- package/lib/esm/facets.js +0 -2
- package/lib/esm/facets.js.map +0 -1
- package/lib/esm/group.js +0 -2
- package/lib/esm/group.js.map +0 -1
- package/lib/esm/index.js +0 -29
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/integrations.js +0 -9
- package/lib/esm/integrations.js.map +0 -1
- package/lib/esm/interaction.js +0 -61
- package/lib/esm/interaction.js.map +0 -1
- package/lib/esm/json-schema.js +0 -2
- package/lib/esm/json-schema.js.map +0 -1
- package/lib/esm/json.js +0 -2
- package/lib/esm/json.js.map +0 -1
- package/lib/esm/meters.js +0 -10
- package/lib/esm/meters.js.map +0 -1
- package/lib/esm/model_utility.js +0 -2
- package/lib/esm/model_utility.js.map +0 -1
- package/lib/esm/payload.js +0 -2
- package/lib/esm/payload.js.map +0 -1
- package/lib/esm/project.js +0 -57
- package/lib/esm/project.js.map +0 -1
- package/lib/esm/prompt.js +0 -18
- package/lib/esm/prompt.js.map +0 -1
- package/lib/esm/query.js +0 -2
- package/lib/esm/query.js.map +0 -1
- package/lib/esm/refs.js +0 -11
- package/lib/esm/refs.js.map +0 -1
- package/lib/esm/runs.js +0 -2
- package/lib/esm/runs.js.map +0 -1
- package/lib/esm/store/activity-catalog.js +0 -2
- package/lib/esm/store/activity-catalog.js.map +0 -1
- package/lib/esm/store/agent.js +0 -2
- package/lib/esm/store/agent.js.map +0 -1
- package/lib/esm/store/collections.js +0 -6
- package/lib/esm/store/collections.js.map +0 -1
- package/lib/esm/store/common.js +0 -2
- package/lib/esm/store/common.js.map +0 -1
- package/lib/esm/store/doc-analyzer.js +0 -2
- package/lib/esm/store/doc-analyzer.js.map +0 -1
- package/lib/esm/store/dsl-workflow.js +0 -2
- package/lib/esm/store/dsl-workflow.js.map +0 -1
- package/lib/esm/store/index.js +0 -12
- package/lib/esm/store/index.js.map +0 -1
- package/lib/esm/store/object-types.js +0 -95
- package/lib/esm/store/object-types.js.map +0 -1
- package/lib/esm/store/signals.js +0 -2
- package/lib/esm/store/signals.js.map +0 -1
- package/lib/esm/store/store.js +0 -31
- package/lib/esm/store/store.js.map +0 -1
- package/lib/esm/store/temporalio.js +0 -41
- package/lib/esm/store/temporalio.js.map +0 -1
- package/lib/esm/store/workflow.js +0 -45
- package/lib/esm/store/workflow.js.map +0 -1
- package/lib/esm/tenant.js +0 -2
- package/lib/esm/tenant.js.map +0 -1
- package/lib/esm/training.js +0 -11
- package/lib/esm/training.js.map +0 -1
- package/lib/esm/transient-tokens.js +0 -6
- package/lib/esm/transient-tokens.js.map +0 -1
- package/lib/esm/user.js +0 -14
- package/lib/esm/user.js.map +0 -1
- package/lib/esm/utils/auth.js +0 -11
- package/lib/esm/utils/auth.js.map +0 -1
- package/lib/esm/utils/schemas.js +0 -61
- package/lib/esm/utils/schemas.js.map +0 -1
- package/lib/esm/utils/type-helpers.js +0 -2
- package/lib/esm/utils/type-helpers.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/Progress.d.ts +0 -21
- package/lib/types/Progress.d.ts.map +0 -1
- package/lib/types/access-control.d.ts +0 -72
- package/lib/types/access-control.d.ts.map +0 -1
- package/lib/types/analytics.d.ts +0 -36
- package/lib/types/analytics.d.ts.map +0 -1
- package/lib/types/apikey.d.ts +0 -75
- package/lib/types/apikey.d.ts.map +0 -1
- package/lib/types/apps.d.ts +0 -63
- package/lib/types/apps.d.ts.map +0 -1
- package/lib/types/common.d.ts +0 -31
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/environment.d.ts +0 -84
- package/lib/types/environment.d.ts.map +0 -1
- package/lib/types/facets.d.ts +0 -34
- package/lib/types/facets.d.ts.map +0 -1
- package/lib/types/group.d.ts +0 -21
- package/lib/types/group.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -29
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/integrations.d.ts +0 -28
- package/lib/types/integrations.d.ts.map +0 -1
- package/lib/types/interaction.d.ts +0 -427
- package/lib/types/interaction.d.ts.map +0 -1
- package/lib/types/json-schema.d.ts +0 -1
- package/lib/types/json-schema.d.ts.map +0 -1
- package/lib/types/json.d.ts +0 -1
- package/lib/types/json.d.ts.map +0 -1
- package/lib/types/meters.d.ts +0 -23
- package/lib/types/meters.d.ts.map +0 -1
- package/lib/types/model_utility.d.ts +0 -1
- package/lib/types/model_utility.d.ts.map +0 -1
- package/lib/types/payload.d.ts +0 -62
- package/lib/types/payload.d.ts.map +0 -1
- package/lib/types/project.d.ts +0 -116
- package/lib/types/project.d.ts.map +0 -1
- package/lib/types/prompt.d.ts +0 -70
- package/lib/types/prompt.d.ts.map +0 -1
- package/lib/types/query.d.ts +0 -114
- package/lib/types/query.d.ts.map +0 -1
- package/lib/types/refs.d.ts +0 -22
- package/lib/types/refs.d.ts.map +0 -1
- package/lib/types/runs.d.ts +0 -32
- package/lib/types/runs.d.ts.map +0 -1
- package/lib/types/store/activity-catalog.d.ts +0 -26
- package/lib/types/store/activity-catalog.d.ts.map +0 -1
- package/lib/types/store/agent.d.ts +0 -18
- package/lib/types/store/agent.d.ts.map +0 -1
- package/lib/types/store/collections.d.ts +0 -63
- package/lib/types/store/collections.d.ts.map +0 -1
- package/lib/types/store/common.d.ts +0 -22
- package/lib/types/store/common.d.ts.map +0 -1
- package/lib/types/store/doc-analyzer.d.ts +0 -132
- package/lib/types/store/doc-analyzer.d.ts.map +0 -1
- package/lib/types/store/dsl-workflow.d.ts +0 -238
- package/lib/types/store/dsl-workflow.d.ts.map +0 -1
- package/lib/types/store/index.d.ts +0 -11
- package/lib/types/store/index.d.ts.map +0 -1
- package/lib/types/store/object-types.d.ts +0 -23
- package/lib/types/store/object-types.d.ts.map +0 -1
- package/lib/types/store/signals.d.ts +0 -5
- package/lib/types/store/signals.d.ts.map +0 -1
- package/lib/types/store/store.d.ts +0 -294
- package/lib/types/store/store.d.ts.map +0 -1
- package/lib/types/store/temporalio.d.ts +0 -16
- package/lib/types/store/temporalio.d.ts.map +0 -1
- package/lib/types/store/workflow.d.ts +0 -345
- package/lib/types/store/workflow.d.ts.map +0 -1
- package/lib/types/tenant.d.ts +0 -10
- package/lib/types/tenant.d.ts.map +0 -1
- package/lib/types/training.d.ts +0 -38
- package/lib/types/training.d.ts.map +0 -1
- package/lib/types/transient-tokens.d.ts +0 -24
- package/lib/types/transient-tokens.d.ts.map +0 -1
- package/lib/types/user.d.ts +0 -113
- package/lib/types/user.d.ts.map +0 -1
- package/lib/types/utils/auth.d.ts +0 -3
- package/lib/types/utils/auth.d.ts.map +0 -1
- package/lib/types/utils/schemas.d.ts +0 -7
- package/lib/types/utils/schemas.d.ts.map +0 -1
- package/lib/types/utils/type-helpers.d.ts +0 -3
- package/lib/types/utils/type-helpers.d.ts.map +0 -1
- package/lib/vertesia-common.js +0 -2
- package/lib/vertesia-common.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"types": "./lib/types/index.d.ts",
|
|
6
|
-
"files": [
|
|
7
|
-
"lib",
|
|
8
|
-
"src",
|
|
9
|
-
"tsconfig.dist.json"
|
|
10
|
-
],
|
|
11
|
-
"exports": {
|
|
2
|
+
"name": "@vertesia/common",
|
|
3
|
+
"version": "0.78.0-dev-715074d",
|
|
4
|
+
"type": "module",
|
|
12
5
|
"types": "./lib/types/index.d.ts",
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"lib",
|
|
8
|
+
"src",
|
|
9
|
+
"tsconfig.dist.json"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"build": "pnpm exec tsmod build && pnpm exec rollup -c",
|
|
14
|
+
"clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
"types": "./lib/types/index.d.ts",
|
|
18
|
+
"import": "./lib/esm/index.js",
|
|
19
|
+
"require": "./lib/cjs/index.js"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
23
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
24
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
25
|
+
"@types/json-schema": "^7.0.15",
|
|
26
|
+
"rollup": "^4.40.2",
|
|
27
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
28
|
+
"ts-dual-module": "^0.6.3",
|
|
29
|
+
"typescript": "^5.0.2",
|
|
30
|
+
"vitest": "^3.0.9"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@llumiverse/common": "workspace:*",
|
|
34
|
+
"ajv": "^8.16.0",
|
|
35
|
+
"json-schema": "^0.4.0"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/vertesia/composableai.git",
|
|
40
|
+
"directory": "packages/common"
|
|
41
|
+
},
|
|
42
|
+
"ts_dual_module": {
|
|
43
|
+
"outDir": "lib"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/access-control.ts
CHANGED
|
@@ -43,9 +43,9 @@ export enum Permission {
|
|
|
43
43
|
workflow_run = "workflow:run",
|
|
44
44
|
workflow_admin = "workflow:admin",
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
iam_impersonate = "iam:impersonate",
|
|
47
|
+
|
|
48
|
+
/** whether the user has access to Sutdio App. */
|
|
49
49
|
studio_access = "studio:access",
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -60,6 +60,7 @@ export enum AccessControlResourceType {
|
|
|
60
60
|
export enum AccessControlPrincipalType {
|
|
61
61
|
user = "user",
|
|
62
62
|
group = "group",
|
|
63
|
+
apikey = "apikey",
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
|
|
@@ -93,4 +94,4 @@ export interface AcesQueryOptions {
|
|
|
93
94
|
role?: string
|
|
94
95
|
type?: AccessControlResourceType
|
|
95
96
|
|
|
96
|
-
}
|
|
97
|
+
}
|
package/src/apikey.ts
CHANGED
|
@@ -2,9 +2,8 @@ import { UserGroupRef } from "./group.js";
|
|
|
2
2
|
import { ProjectRef, ProjectRoles } from "./project.js";
|
|
3
3
|
import { AccountRef } from "./user.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
export enum ApiKeyTypes {
|
|
7
|
-
secret =
|
|
6
|
+
secret = "sk",
|
|
8
7
|
}
|
|
9
8
|
export interface ApiKey {
|
|
10
9
|
id: string;
|
|
@@ -15,27 +14,23 @@ export interface ApiKey {
|
|
|
15
14
|
account: string; // the account id
|
|
16
15
|
project: ProjectRef; // the project id if any
|
|
17
16
|
enabled: boolean;
|
|
18
|
-
created_by: string
|
|
19
|
-
updated_by: string
|
|
17
|
+
created_by: string;
|
|
18
|
+
updated_by: string;
|
|
20
19
|
created_at: Date;
|
|
21
20
|
updated_at: Date;
|
|
22
21
|
expires_at?: Date; // in case of public key only
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
export interface CreateOrUpdateApiKeyPayload extends Partial<ApiKey> {}
|
|
25
25
|
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ApiKeyWithValue extends Omit<ApiKey, 'maskedValue'> {
|
|
26
|
+
export interface ApiKeyWithValue extends Omit<ApiKey, "maskedValue"> {
|
|
31
27
|
value: string;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
|
|
35
30
|
export interface CreatePublicKeyPayload {
|
|
36
|
-
name?: string
|
|
37
|
-
projectId?: string
|
|
38
|
-
ttl?: number
|
|
31
|
+
name?: string;
|
|
32
|
+
projectId?: string;
|
|
33
|
+
ttl?: number;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
export interface AuthTokenResponse {
|
|
@@ -43,12 +38,12 @@ export interface AuthTokenResponse {
|
|
|
43
38
|
}
|
|
44
39
|
|
|
45
40
|
export interface AuthTokenPayload {
|
|
46
|
-
sub: string
|
|
41
|
+
sub: string;
|
|
47
42
|
name: string;
|
|
48
43
|
email?: string;
|
|
49
44
|
picture?: string;
|
|
50
45
|
|
|
51
|
-
type: PrincipalType
|
|
46
|
+
type: PrincipalType;
|
|
52
47
|
account: AccountRef;
|
|
53
48
|
|
|
54
49
|
account_roles: ProjectRoles[];
|
|
@@ -77,19 +72,26 @@ export interface AuthTokenPayload {
|
|
|
77
72
|
* Either a n API domain like 'api.vertesia.io' | 'api-preview.vertesia.io' | 'api-staging.vertesia.io' | 'local'
|
|
78
73
|
* or explicit studio and store URLs.
|
|
79
74
|
*/
|
|
80
|
-
endpoints?:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
endpoints?:
|
|
76
|
+
| string
|
|
77
|
+
| {
|
|
78
|
+
studio: string;
|
|
79
|
+
store: string;
|
|
80
|
+
};
|
|
84
81
|
|
|
85
82
|
iss: string; //issuer
|
|
86
83
|
aud: string; //audience
|
|
87
84
|
exp: number; //expires in (EPOC seconds)
|
|
88
|
-
|
|
85
|
+
tags?: string[]; //tags
|
|
89
86
|
|
|
87
|
+
permissions?: string[]; //permissions
|
|
88
|
+
scopes?: string[]; //scopes
|
|
89
|
+
}
|
|
90
90
|
|
|
91
91
|
export enum PrincipalType {
|
|
92
92
|
User = "user",
|
|
93
|
+
Group = "group",
|
|
93
94
|
ApiKey = "apikey",
|
|
94
95
|
ServiceAccount = "service_account",
|
|
95
|
-
|
|
96
|
+
Agent = "agent",
|
|
97
|
+
}
|
package/src/apps.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSONSchema } from "@llumiverse/common";
|
|
1
2
|
|
|
2
3
|
export interface AppUIConfig {
|
|
3
4
|
/**
|
|
@@ -14,6 +15,33 @@ export interface AppUIConfig {
|
|
|
14
15
|
isolation?: "shadow" | "css";
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
export interface AppInteractionRef {
|
|
19
|
+
/**
|
|
20
|
+
* The interaction code name
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The url to get the interaction specification
|
|
26
|
+
*/
|
|
27
|
+
url: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The interaction title. Optional. To be used in studio UI when the interaction is displayed
|
|
31
|
+
*/
|
|
32
|
+
title?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The interaction description. Optional. To be used in studio UI when the interaction is displayed
|
|
36
|
+
*/
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ResolvedAppInteractionRef extends AppInteractionRef {
|
|
40
|
+
/**
|
|
41
|
+
* The interaction unique name (can also be used as an ID) that can be used to execute the interaction.
|
|
42
|
+
*/
|
|
43
|
+
id: string;
|
|
44
|
+
}
|
|
17
45
|
export interface AppManifestData {
|
|
18
46
|
/**
|
|
19
47
|
* The name of the app, used as the id in the system.
|
|
@@ -36,6 +64,12 @@ export interface AppManifestData {
|
|
|
36
64
|
*/
|
|
37
65
|
icon?: string;
|
|
38
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A color name to be used as the color of the app card (e.g. blue, red, green, etc.)
|
|
69
|
+
* If not specified a random color will be picked.
|
|
70
|
+
*/
|
|
71
|
+
color?: string;
|
|
72
|
+
|
|
39
73
|
status: "beta" | "stable" | "deprecated"
|
|
40
74
|
|
|
41
75
|
ui?: AppUIConfig
|
|
@@ -46,6 +80,18 @@ export interface AppManifestData {
|
|
|
46
80
|
* If the `?import` query string is used the tool will be imported as a javascript module and not executed through a POST on the collections endpoint.
|
|
47
81
|
*/
|
|
48
82
|
tool_collections?: string[]
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* An URL providing interactions definitions in JSON format.
|
|
86
|
+
* GET interactions_url should return a JSON object with the interactions definitions.
|
|
87
|
+
* GET `${interactions_url}/${endpoint}` should return a JSON object with the interaction definition for the specified endpoint.
|
|
88
|
+
*/
|
|
89
|
+
interactions?: AppInteractionRef[];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A JSON chema for the app installation settings.
|
|
93
|
+
*/
|
|
94
|
+
settings_schema?: JSONSchema;
|
|
49
95
|
}
|
|
50
96
|
export interface AppManifest extends AppManifestData {
|
|
51
97
|
id: string;
|
|
@@ -73,3 +119,23 @@ export interface AppInstallationPayload {
|
|
|
73
119
|
}
|
|
74
120
|
|
|
75
121
|
export type AppInstallationKind = 'ui' | 'tools' | 'all';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A descriptiojn of the tools provided by an app
|
|
125
|
+
*/
|
|
126
|
+
export interface AppToolCollection {
|
|
127
|
+
/**
|
|
128
|
+
* The collection name
|
|
129
|
+
*/
|
|
130
|
+
name: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Optional collection description
|
|
134
|
+
*/
|
|
135
|
+
description?: string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* the tools provided by this collection
|
|
139
|
+
*/
|
|
140
|
+
tools: { name: string, description?: string }[]
|
|
141
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./Progress.js";
|
|
|
17
17
|
export * from './project.js';
|
|
18
18
|
export * from './prompt.js';
|
|
19
19
|
export * from './query.js';
|
|
20
|
+
export * from './rate-limiter.js';
|
|
20
21
|
export * from './refs.js';
|
|
21
22
|
export * from './runs.js';
|
|
22
23
|
export * from "./store/index.js";
|
|
@@ -26,4 +27,5 @@ export * from './transient-tokens.js';
|
|
|
26
27
|
export * from './user.js';
|
|
27
28
|
export * from './utils/auth.js';
|
|
28
29
|
export * from './utils/schemas.js';
|
|
29
|
-
export type * from './utils/type-helpers.js'
|
|
30
|
+
export type * from './utils/type-helpers.js';
|
|
31
|
+
export * from './sts-token-types.js';
|
package/src/interaction.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CompletionResult,
|
|
2
3
|
JSONObject,
|
|
3
4
|
JSONSchema,
|
|
4
5
|
Modalities,
|
|
5
6
|
ModelOptions,
|
|
7
|
+
PromptRole,
|
|
6
8
|
StatelessExecutionOptions,
|
|
7
9
|
ToolDefinition,
|
|
8
10
|
ToolUse,
|
|
@@ -14,10 +16,12 @@ import { ExecutionTokenUsage } from "@llumiverse/common";
|
|
|
14
16
|
import { ExecutionEnvironmentRef } from "./environment.js";
|
|
15
17
|
import { ProjectRef } from "./project.js";
|
|
16
18
|
import {
|
|
19
|
+
ExecutablePromptSegmentDef,
|
|
17
20
|
PopulatedPromptSegmentDef,
|
|
18
21
|
PromptSegmentDef,
|
|
19
22
|
PromptTemplateRef,
|
|
20
23
|
PromptTemplateRefWithSchema,
|
|
24
|
+
TemplateType,
|
|
21
25
|
} from "./prompt.js";
|
|
22
26
|
import { ExecutionRunDocRef } from "./runs.js";
|
|
23
27
|
import { AccountRef } from "./user.js";
|
|
@@ -28,6 +32,79 @@ export interface InteractionExecutionError {
|
|
|
28
32
|
data?: any;
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
|
|
36
|
+
// ------------------ in code interactions -----------------
|
|
37
|
+
export interface InCodePrompt {
|
|
38
|
+
role: PromptRole,
|
|
39
|
+
content: string,
|
|
40
|
+
content_type: TemplateType;
|
|
41
|
+
schema?: JSONSchema;
|
|
42
|
+
}
|
|
43
|
+
export interface InCodeInteraction {
|
|
44
|
+
/**
|
|
45
|
+
* The id of the interaction. Required.
|
|
46
|
+
* The id is a unique identifier for the interaction.
|
|
47
|
+
* It is recommended to use a URL safe string and not include spaces.
|
|
48
|
+
* The id composaed by some namespace or prefix and the interaction name.
|
|
49
|
+
* Example: sys:generic_question, app:review_contract, tmp:my_temp_interaction
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The interaction code name. Required.
|
|
55
|
+
* Should be a URL safe string and not include spaces. It is recommended to use kebab-case or camel-case.
|
|
56
|
+
* The endpoints must satisfy the following regexp: /^[a-zA-Z0-9-_]+$/. No whitespaces or special characters are allowed.
|
|
57
|
+
*/
|
|
58
|
+
name: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A title for the interaction. If not provided, the endpoint will be used.
|
|
62
|
+
*/
|
|
63
|
+
title?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* An optional description of the interaction.
|
|
67
|
+
*/
|
|
68
|
+
description?: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The JSON schema to be used for the result if any.
|
|
72
|
+
*/
|
|
73
|
+
result_schema?: JSONSchema;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The modality of the interaction output.
|
|
77
|
+
* If not specified Modalities.Text is assumed.
|
|
78
|
+
*/
|
|
79
|
+
output_modality?: Modalities,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* How to store the run data for executions of this interaction.
|
|
83
|
+
* Defaults to STANDARD.
|
|
84
|
+
*/
|
|
85
|
+
storage?: RunDataStorageLevel;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Optional tags for the interaction.
|
|
89
|
+
*/
|
|
90
|
+
tags?: string[];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Default options for the model to be used when executing this interaction.
|
|
94
|
+
* (like temperature etc)
|
|
95
|
+
*/
|
|
96
|
+
model_options?: ModelOptions;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The prompts composing the interaction. Required.
|
|
100
|
+
*/
|
|
101
|
+
prompts: InCodePrompt[]
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
export interface InteractionSpec extends Omit<InCodeInteraction, 'id'> {
|
|
105
|
+
}
|
|
106
|
+
// ---------------------------------------------------------
|
|
107
|
+
|
|
31
108
|
/**
|
|
32
109
|
* The payload to query the interaction endpoints
|
|
33
110
|
*/
|
|
@@ -166,28 +243,31 @@ export interface CachePolicy {
|
|
|
166
243
|
ttl: number;
|
|
167
244
|
}
|
|
168
245
|
export type InteractionVisibility = "public" | "private";
|
|
169
|
-
|
|
246
|
+
|
|
247
|
+
export interface InteractionData {
|
|
170
248
|
readonly id: string;
|
|
171
249
|
name: string;
|
|
172
250
|
endpoint: string;
|
|
173
251
|
description?: string;
|
|
252
|
+
project: string | ProjectRef;
|
|
253
|
+
tags: string[];
|
|
254
|
+
result_schema?: JSONSchema4 | SchemaRef;
|
|
255
|
+
environment?: string | ExecutionEnvironmentRef;
|
|
256
|
+
model?: string;
|
|
257
|
+
model_options?: ModelOptions;
|
|
258
|
+
restriction?: RunDataStorageLevel;
|
|
259
|
+
output_modality?: Modalities;
|
|
260
|
+
}
|
|
261
|
+
export interface Interaction extends InteractionData {
|
|
174
262
|
status: InteractionStatus;
|
|
175
263
|
parent?: string;
|
|
176
264
|
// only used for versions (status === "published")
|
|
177
265
|
visibility: InteractionVisibility;
|
|
178
266
|
version: number;
|
|
179
|
-
tags: string[];
|
|
180
267
|
test_data?: JSONObject;
|
|
181
268
|
interaction_schema?: JSONSchema4 | SchemaRef;
|
|
182
|
-
result_schema?: JSONSchema4 | SchemaRef;
|
|
183
269
|
cache_policy?: CachePolicy;
|
|
184
|
-
model: string;
|
|
185
|
-
model_options?: ModelOptions;
|
|
186
270
|
prompts: PromptSegmentDef[];
|
|
187
|
-
output_modality?: Modalities;
|
|
188
|
-
environment: string | ExecutionEnvironmentRef;
|
|
189
|
-
restriction?: RunDataStorageLevel;
|
|
190
|
-
project: string | ProjectRef;
|
|
191
271
|
// only for drafts - when it was last published
|
|
192
272
|
last_published_at?: Date;
|
|
193
273
|
created_by: string;
|
|
@@ -200,6 +280,14 @@ export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
|
|
|
200
280
|
prompts: PopulatedPromptSegmentDef[];
|
|
201
281
|
}
|
|
202
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Used to describe an interaction that can be executed. Contains only the interaction data useful
|
|
285
|
+
* to execute the interaction plus the prompt templates
|
|
286
|
+
*/
|
|
287
|
+
export interface ExecutableInteraction extends InteractionData {
|
|
288
|
+
prompts: ExecutablePromptSegmentDef[];
|
|
289
|
+
}
|
|
290
|
+
|
|
203
291
|
export interface InteractionCreatePayload
|
|
204
292
|
extends Omit<
|
|
205
293
|
Interaction,
|
|
@@ -270,6 +358,12 @@ export interface InteractionExecutionPayload {
|
|
|
270
358
|
* The workflow related to this Interaction Run.
|
|
271
359
|
*/
|
|
272
360
|
workflow?: ExecutionRunWorkflow;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Only used by ad-hoc interactions which defines the prompt in the execution payload itself
|
|
364
|
+
* These are temporary interactions using "tmp:" suffix.
|
|
365
|
+
*/
|
|
366
|
+
prompts?: InCodePrompt[];
|
|
273
367
|
}
|
|
274
368
|
|
|
275
369
|
export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
|
|
@@ -284,7 +378,7 @@ export interface NamedInteractionExecutionPayload extends InteractionExecutionPa
|
|
|
284
378
|
// ================= async execution payloads ====================
|
|
285
379
|
export type ToolRef = string | { name: string; description: string };
|
|
286
380
|
|
|
287
|
-
interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayload,"toolDefinitions" | "stream"> {
|
|
381
|
+
interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayload, "toolDefinitions" | "stream"> {
|
|
288
382
|
type: "conversation" | "interaction";
|
|
289
383
|
|
|
290
384
|
/**
|
|
@@ -381,6 +475,10 @@ export interface ToolResultContent {
|
|
|
381
475
|
content: string;
|
|
382
476
|
is_error: boolean;
|
|
383
477
|
files?: string[];
|
|
478
|
+
/**
|
|
479
|
+
* Can contain metadata returned by the tool executor.
|
|
480
|
+
*/
|
|
481
|
+
meta?: Record<string, any>;
|
|
384
482
|
}
|
|
385
483
|
|
|
386
484
|
export interface ToolResult extends ToolResultContent {
|
|
@@ -398,7 +496,7 @@ export interface UserMessagePayload extends ResumeConversationPayload {
|
|
|
398
496
|
message: string;
|
|
399
497
|
}
|
|
400
498
|
|
|
401
|
-
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results"
|
|
499
|
+
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results" | "tools">
|
|
402
500
|
|
|
403
501
|
// ================= end async execution payloads ====================
|
|
404
502
|
|
|
@@ -419,7 +517,7 @@ export interface RunSource {
|
|
|
419
517
|
client_ip: string;
|
|
420
518
|
}
|
|
421
519
|
|
|
422
|
-
export interface
|
|
520
|
+
export interface BaseExecutionRun<P = any> {
|
|
423
521
|
readonly id: string;
|
|
424
522
|
/**
|
|
425
523
|
* Only used by runs that were created by a virtual run to point toward the virtual run parent
|
|
@@ -430,7 +528,7 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
430
528
|
selected?: boolean;
|
|
431
529
|
scores?: Record<string, number>;
|
|
432
530
|
};
|
|
433
|
-
result: R
|
|
531
|
+
result: CompletionResult[] // Any new result will actually be CompletionResult[], the old typing is R, and R used to default to any.
|
|
434
532
|
/**
|
|
435
533
|
* The parameters used to create the interaction.
|
|
436
534
|
* If the parameters contains the special property "@memory" it will be used
|
|
@@ -438,8 +536,12 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
438
536
|
*/
|
|
439
537
|
parameters: P; //params used to create the interaction, only in varies on?
|
|
440
538
|
tags?: string[];
|
|
441
|
-
//
|
|
442
|
-
|
|
539
|
+
// only set when the target interaction is a stored interaction
|
|
540
|
+
//TODO check the code where Interaction type is used (should be in run details)
|
|
541
|
+
// TODO when execution string is passed as the type of interaction
|
|
542
|
+
interaction?: string | Interaction;
|
|
543
|
+
// only set when the target interaction is an in-code interaction
|
|
544
|
+
interaction_code?: string; // Interaction code name in case of in-code interaction (not stored in the DB as an Interaction document)
|
|
443
545
|
//TODO a string is returned when execution not the env object
|
|
444
546
|
environment: ExecutionEnvironmentRef;
|
|
445
547
|
modelId: string;
|
|
@@ -450,7 +552,7 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
450
552
|
prompt: any;
|
|
451
553
|
token_use?: ExecutionTokenUsage;
|
|
452
554
|
chunks?: number;
|
|
453
|
-
execution_time?: number; //
|
|
555
|
+
execution_time?: number; // ms
|
|
454
556
|
created_at: Date;
|
|
455
557
|
updated_at: Date;
|
|
456
558
|
account: AccountRef;
|
|
@@ -472,6 +574,14 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
472
574
|
workflow?: ExecutionRunWorkflow;
|
|
473
575
|
}
|
|
474
576
|
|
|
577
|
+
export interface ExecutionRun<P = any> extends BaseExecutionRun<P> {
|
|
578
|
+
interaction?: string;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export interface PopulatedExecutionRun<P = any> extends BaseExecutionRun<P> {
|
|
582
|
+
interaction?: Interaction;
|
|
583
|
+
}
|
|
584
|
+
|
|
475
585
|
export interface ExecutionRunWorkflow {
|
|
476
586
|
/**
|
|
477
587
|
* The Temporal Workflow Run ID related to this Interaction Run.
|
|
@@ -498,14 +608,15 @@ export interface ExecutionRunWorkflow {
|
|
|
498
608
|
activity_type?: string;
|
|
499
609
|
}
|
|
500
610
|
|
|
501
|
-
export interface InteractionExecutionResult<P = any
|
|
611
|
+
export interface InteractionExecutionResult<P = any> extends ExecutionRun<P> {
|
|
502
612
|
tool_use?: ToolUse[];
|
|
503
613
|
conversation?: unknown;
|
|
504
614
|
options?: StatelessExecutionOptions;
|
|
505
615
|
}
|
|
506
616
|
|
|
507
617
|
export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
|
|
508
|
-
interaction
|
|
618
|
+
interaction?: InteractionRef;
|
|
619
|
+
interaction_code?: string;
|
|
509
620
|
}
|
|
510
621
|
|
|
511
622
|
export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt";
|
|
@@ -551,3 +662,14 @@ export interface GenerateTestDataPayload {
|
|
|
551
662
|
export interface ImprovePromptPayload {
|
|
552
663
|
config: InteractionExecutionConfiguration;
|
|
553
664
|
}
|
|
665
|
+
|
|
666
|
+
export interface RateLimitRequestPayload {
|
|
667
|
+
interaction: string,
|
|
668
|
+
environment_id?: string,
|
|
669
|
+
model_id?: string,
|
|
670
|
+
workflow_run_id?: string
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export interface RateLimitRequestResponse {
|
|
674
|
+
delay_ms: number;
|
|
675
|
+
}
|
package/src/payload.ts
CHANGED
|
@@ -13,10 +13,8 @@ import {
|
|
|
13
13
|
export interface SearchPayload {
|
|
14
14
|
facets?: FacetSpec[];
|
|
15
15
|
/**
|
|
16
|
-
* If the facets should
|
|
17
|
-
*
|
|
18
|
-
* If false, the facet count will be calculated over all objects.
|
|
19
|
-
* Default is true.
|
|
16
|
+
* If the facets should be limited to the current page of results.
|
|
17
|
+
* Defaults to false. When false, the facets are independent of the search results page.
|
|
20
18
|
*/
|
|
21
19
|
limit_facets?: boolean;
|
|
22
20
|
query?: SimpleSearchQuery;
|
package/src/project.ts
CHANGED
|
@@ -142,9 +142,7 @@ export interface EmbeddingsStatusResponse {
|
|
|
142
142
|
status: string;
|
|
143
143
|
embeddingRunsInProgress: number;
|
|
144
144
|
totalRunsInProgress: number;
|
|
145
|
-
totalIndexableObjects: number;
|
|
146
145
|
embeddingsModels: string[];
|
|
147
|
-
objectsWithEmbeddings: number;
|
|
148
146
|
vectorIndex: {
|
|
149
147
|
status: "READY" | "PENDING" | "DELETING" | "ABSENT",
|
|
150
148
|
name?: string,
|
package/src/prompt.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { JSONSchema4 } from "json-schema";
|
|
2
1
|
import type { JSONObject } from "@llumiverse/common";
|
|
3
|
-
import { ProjectRef } from "./project.js";
|
|
4
2
|
import { PromptRole } from "@llumiverse/common";
|
|
3
|
+
import type { JSONSchema4 } from "json-schema";
|
|
4
|
+
import { ProjectRef } from "./project.js";
|
|
5
5
|
|
|
6
6
|
export interface ChatPromptSchema {
|
|
7
7
|
role: PromptRole.user | PromptRole.assistant;
|
|
@@ -31,6 +31,13 @@ export interface PopulatedPromptSegmentDef
|
|
|
31
31
|
extends Omit<PromptSegmentDef, "template"> {
|
|
32
32
|
template?: PromptTemplate;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Used for prompt rendering at interaction execution
|
|
36
|
+
*/
|
|
37
|
+
export interface ExecutablePromptSegmentDef
|
|
38
|
+
extends Omit<PromptSegmentDef, "template"> {
|
|
39
|
+
template?: ExecutablePromptTemplate;
|
|
40
|
+
}
|
|
34
41
|
|
|
35
42
|
export interface PromptTemplateRef {
|
|
36
43
|
id: string;
|
|
@@ -47,25 +54,25 @@ export interface PromptTemplateRefWithSchema extends PromptTemplateRef {
|
|
|
47
54
|
|
|
48
55
|
export enum TemplateType {
|
|
49
56
|
text = "text",
|
|
50
|
-
js = "js",
|
|
51
57
|
jst = "jst",
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
export interface ExecutablePromptTemplate {
|
|
60
|
+
role: PromptRole;
|
|
61
|
+
content: string;
|
|
62
|
+
content_type: TemplateType;
|
|
63
|
+
inputSchema?: JSONSchema4;
|
|
64
|
+
}
|
|
65
|
+
export interface PromptTemplate extends ExecutablePromptTemplate {
|
|
55
66
|
id: string;
|
|
56
67
|
name: string;
|
|
57
|
-
role: PromptRole;
|
|
58
68
|
status: PromptStatus;
|
|
59
69
|
version: number;
|
|
60
70
|
// only to be used by published versions
|
|
61
71
|
// the id draft version which is the source of this published version (only when published)
|
|
62
72
|
parent?: string;
|
|
63
73
|
description?: string;
|
|
64
|
-
content_type: TemplateType;
|
|
65
|
-
content: string;
|
|
66
74
|
test_data?: JSONObject; // optional test data satisfying the schema
|
|
67
75
|
script?: string; // cache the template output
|
|
68
|
-
inputSchema?: JSONSchema4;
|
|
69
76
|
project: string | ProjectRef; // or projectRef? ObjectIdType;
|
|
70
77
|
// The name of a field in the input data that is of the specified schema and on each the template will iterate.
|
|
71
78
|
// If not specified then the schema will define the whole input data
|