@vertesia/common 0.24.0-dev.202601221707
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/LICENSE +13 -0
- package/README.md +53 -0
- package/lib/cjs/Progress.js +61 -0
- package/lib/cjs/Progress.js.map +1 -0
- package/lib/cjs/access-control.js +56 -0
- package/lib/cjs/access-control.js.map +1 -0
- package/lib/cjs/analytics.js +3 -0
- package/lib/cjs/analytics.js.map +1 -0
- package/lib/cjs/apikey.js +16 -0
- package/lib/cjs/apikey.js.map +1 -0
- package/lib/cjs/apps.js +35 -0
- package/lib/cjs/apps.js.map +1 -0
- package/lib/cjs/ask-user.js +8 -0
- package/lib/cjs/ask-user.js.map +1 -0
- package/lib/cjs/channels.js +63 -0
- package/lib/cjs/channels.js.map +1 -0
- package/lib/cjs/common.js +3 -0
- package/lib/cjs/common.js.map +1 -0
- package/lib/cjs/data-platform.js +127 -0
- package/lib/cjs/data-platform.js.map +1 -0
- package/lib/cjs/email.js +20 -0
- package/lib/cjs/email.js.map +1 -0
- package/lib/cjs/environment.js +44 -0
- package/lib/cjs/environment.js.map +1 -0
- package/lib/cjs/facets.js +3 -0
- package/lib/cjs/facets.js.map +1 -0
- package/lib/cjs/group.js +5 -0
- package/lib/cjs/group.js.map +1 -0
- package/lib/cjs/index.js +55 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/integrations.js +14 -0
- package/lib/cjs/integrations.js.map +1 -0
- package/lib/cjs/interaction.js +97 -0
- package/lib/cjs/interaction.js.map +1 -0
- package/lib/cjs/json-schema.js +3 -0
- package/lib/cjs/json-schema.js.map +1 -0
- package/lib/cjs/json.js +3 -0
- package/lib/cjs/json.js.map +1 -0
- package/lib/cjs/meters.js +13 -0
- package/lib/cjs/meters.js.map +1 -0
- package/lib/cjs/model_utility.js +6 -0
- package/lib/cjs/model_utility.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/payload.js +3 -0
- package/lib/cjs/payload.js.map +1 -0
- package/lib/cjs/pending-asks.js +7 -0
- package/lib/cjs/pending-asks.js.map +1 -0
- package/lib/cjs/project.js +107 -0
- package/lib/cjs/project.js.map +1 -0
- package/lib/cjs/prompt.js +21 -0
- package/lib/cjs/prompt.js.map +1 -0
- package/lib/cjs/query.js +3 -0
- package/lib/cjs/query.js.map +1 -0
- package/lib/cjs/rate-limiter.js +6 -0
- package/lib/cjs/rate-limiter.js.map +1 -0
- package/lib/cjs/refs.js +14 -0
- package/lib/cjs/refs.js.map +1 -0
- package/lib/cjs/runs.js +3 -0
- package/lib/cjs/runs.js.map +1 -0
- package/lib/cjs/skill.js +14 -0
- package/lib/cjs/skill.js.map +1 -0
- package/lib/cjs/store/activity-catalog.js +3 -0
- package/lib/cjs/store/activity-catalog.js.map +1 -0
- package/lib/cjs/store/collections.js +9 -0
- package/lib/cjs/store/collections.js.map +1 -0
- package/lib/cjs/store/common.js +3 -0
- package/lib/cjs/store/common.js.map +1 -0
- package/lib/cjs/store/conversation-state.js +3 -0
- package/lib/cjs/store/conversation-state.js.map +1 -0
- package/lib/cjs/store/doc-analyzer.js +3 -0
- package/lib/cjs/store/doc-analyzer.js.map +1 -0
- package/lib/cjs/store/dsl-workflow.js +5 -0
- package/lib/cjs/store/dsl-workflow.js.map +1 -0
- package/lib/cjs/store/index.js +30 -0
- package/lib/cjs/store/index.js.map +1 -0
- package/lib/cjs/store/object-types.js +98 -0
- package/lib/cjs/store/object-types.js.map +1 -0
- package/lib/cjs/store/schedule.js +32 -0
- package/lib/cjs/store/schedule.js.map +1 -0
- package/lib/cjs/store/signals.js +3 -0
- package/lib/cjs/store/signals.js.map +1 -0
- package/lib/cjs/store/store.js +166 -0
- package/lib/cjs/store/store.js.map +1 -0
- package/lib/cjs/store/temporalio.js +44 -0
- package/lib/cjs/store/temporalio.js.map +1 -0
- package/lib/cjs/store/worker.js +3 -0
- package/lib/cjs/store/worker.js.map +1 -0
- package/lib/cjs/store/workflow.js +241 -0
- package/lib/cjs/store/workflow.js.map +1 -0
- package/lib/cjs/sts-token-types.js +32 -0
- package/lib/cjs/sts-token-types.js.map +1 -0
- package/lib/cjs/tenant.js +3 -0
- package/lib/cjs/tenant.js.map +1 -0
- package/lib/cjs/tool-execution.js +6 -0
- package/lib/cjs/tool-execution.js.map +1 -0
- package/lib/cjs/training.js +14 -0
- package/lib/cjs/training.js.map +1 -0
- package/lib/cjs/transient-tokens.js +9 -0
- package/lib/cjs/transient-tokens.js.map +1 -0
- package/lib/cjs/user.js +25 -0
- package/lib/cjs/user.js.map +1 -0
- package/lib/cjs/utils/auth.js +15 -0
- package/lib/cjs/utils/auth.js.map +1 -0
- package/lib/cjs/utils/schemas.js +114 -0
- package/lib/cjs/utils/schemas.js.map +1 -0
- package/lib/cjs/utils/type-helpers.js +3 -0
- package/lib/cjs/utils/type-helpers.js.map +1 -0
- package/lib/cjs/versions.js +8 -0
- package/lib/cjs/versions.js.map +1 -0
- package/lib/cjs/workflow-analytics.js +52 -0
- package/lib/cjs/workflow-analytics.js.map +1 -0
- package/lib/esm/Progress.js +57 -0
- package/lib/esm/Progress.js.map +1 -0
- package/lib/esm/access-control.js +53 -0
- package/lib/esm/access-control.js.map +1 -0
- package/lib/esm/analytics.js +2 -0
- package/lib/esm/analytics.js.map +1 -0
- package/lib/esm/apikey.js +13 -0
- package/lib/esm/apikey.js.map +1 -0
- package/lib/esm/apps.js +32 -0
- package/lib/esm/apps.js.map +1 -0
- package/lib/esm/ask-user.js +7 -0
- package/lib/esm/ask-user.js.map +1 -0
- package/lib/esm/channels.js +57 -0
- package/lib/esm/channels.js.map +1 -0
- package/lib/esm/common.js +2 -0
- package/lib/esm/common.js.map +1 -0
- package/lib/esm/data-platform.js +124 -0
- package/lib/esm/data-platform.js.map +1 -0
- package/lib/esm/email.js +16 -0
- package/lib/esm/email.js.map +1 -0
- package/lib/esm/environment.js +41 -0
- package/lib/esm/environment.js.map +1 -0
- package/lib/esm/facets.js +2 -0
- package/lib/esm/facets.js.map +1 -0
- package/lib/esm/group.js +2 -0
- package/lib/esm/group.js.map +1 -0
- package/lib/esm/index.js +39 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/integrations.js +11 -0
- package/lib/esm/integrations.js.map +1 -0
- package/lib/esm/interaction.js +92 -0
- package/lib/esm/interaction.js.map +1 -0
- package/lib/esm/json-schema.js +2 -0
- package/lib/esm/json-schema.js.map +1 -0
- package/lib/esm/json.js +2 -0
- package/lib/esm/json.js.map +1 -0
- package/lib/esm/meters.js +10 -0
- package/lib/esm/meters.js.map +1 -0
- package/lib/esm/model_utility.js +2 -0
- package/lib/esm/model_utility.js.map +1 -0
- package/lib/esm/payload.js +2 -0
- package/lib/esm/payload.js.map +1 -0
- package/lib/esm/pending-asks.js +6 -0
- package/lib/esm/pending-asks.js.map +1 -0
- package/lib/esm/project.js +102 -0
- package/lib/esm/project.js.map +1 -0
- package/lib/esm/prompt.js +18 -0
- package/lib/esm/prompt.js.map +1 -0
- package/lib/esm/query.js +2 -0
- package/lib/esm/query.js.map +1 -0
- package/lib/esm/rate-limiter.js +5 -0
- package/lib/esm/rate-limiter.js.map +1 -0
- package/lib/esm/refs.js +11 -0
- package/lib/esm/refs.js.map +1 -0
- package/lib/esm/runs.js +2 -0
- package/lib/esm/runs.js.map +1 -0
- package/lib/esm/skill.js +13 -0
- package/lib/esm/skill.js.map +1 -0
- package/lib/esm/store/activity-catalog.js +2 -0
- package/lib/esm/store/activity-catalog.js.map +1 -0
- package/lib/esm/store/collections.js +6 -0
- package/lib/esm/store/collections.js.map +1 -0
- package/lib/esm/store/common.js +2 -0
- package/lib/esm/store/common.js.map +1 -0
- package/lib/esm/store/conversation-state.js +2 -0
- package/lib/esm/store/conversation-state.js.map +1 -0
- package/lib/esm/store/doc-analyzer.js +2 -0
- package/lib/esm/store/doc-analyzer.js.map +1 -0
- package/lib/esm/store/dsl-workflow.js +2 -0
- package/lib/esm/store/dsl-workflow.js.map +1 -0
- package/lib/esm/store/index.js +14 -0
- package/lib/esm/store/index.js.map +1 -0
- package/lib/esm/store/object-types.js +95 -0
- package/lib/esm/store/object-types.js.map +1 -0
- package/lib/esm/store/schedule.js +29 -0
- package/lib/esm/store/schedule.js.map +1 -0
- package/lib/esm/store/signals.js +2 -0
- package/lib/esm/store/signals.js.map +1 -0
- package/lib/esm/store/store.js +160 -0
- package/lib/esm/store/store.js.map +1 -0
- package/lib/esm/store/temporalio.js +41 -0
- package/lib/esm/store/temporalio.js.map +1 -0
- package/lib/esm/store/worker.js +2 -0
- package/lib/esm/store/worker.js.map +1 -0
- package/lib/esm/store/workflow.js +228 -0
- package/lib/esm/store/workflow.js.map +1 -0
- package/lib/esm/sts-token-types.js +24 -0
- package/lib/esm/sts-token-types.js.map +1 -0
- package/lib/esm/tenant.js +2 -0
- package/lib/esm/tenant.js.map +1 -0
- package/lib/esm/tool-execution.js +5 -0
- package/lib/esm/tool-execution.js.map +1 -0
- package/lib/esm/training.js +11 -0
- package/lib/esm/training.js.map +1 -0
- package/lib/esm/transient-tokens.js +6 -0
- package/lib/esm/transient-tokens.js.map +1 -0
- package/lib/esm/user.js +22 -0
- package/lib/esm/user.js.map +1 -0
- package/lib/esm/utils/auth.js +11 -0
- package/lib/esm/utils/auth.js.map +1 -0
- package/lib/esm/utils/schemas.js +107 -0
- package/lib/esm/utils/schemas.js.map +1 -0
- package/lib/esm/utils/type-helpers.js +2 -0
- package/lib/esm/utils/type-helpers.js.map +1 -0
- package/lib/esm/versions.js +5 -0
- package/lib/esm/versions.js.map +1 -0
- package/lib/esm/workflow-analytics.js +49 -0
- package/lib/esm/workflow-analytics.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/Progress.d.ts +21 -0
- package/lib/types/Progress.d.ts.map +1 -0
- package/lib/types/access-control.d.ts +73 -0
- package/lib/types/access-control.d.ts.map +1 -0
- package/lib/types/analytics.d.ts +87 -0
- package/lib/types/analytics.d.ts.map +1 -0
- package/lib/types/apikey.d.ts +98 -0
- package/lib/types/apikey.d.ts.map +1 -0
- package/lib/types/apps.d.ts +236 -0
- package/lib/types/apps.d.ts.map +1 -0
- package/lib/types/ask-user.d.ts +32 -0
- package/lib/types/ask-user.d.ts.map +1 -0
- package/lib/types/channels.d.ts +21 -0
- package/lib/types/channels.d.ts.map +1 -0
- package/lib/types/common.d.ts +31 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/data-platform.d.ts +860 -0
- package/lib/types/data-platform.d.ts.map +1 -0
- package/lib/types/email.d.ts +66 -0
- package/lib/types/email.d.ts.map +1 -0
- package/lib/types/environment.d.ts +106 -0
- package/lib/types/environment.d.ts.map +1 -0
- package/lib/types/facets.d.ts +34 -0
- package/lib/types/facets.d.ts.map +1 -0
- package/lib/types/group.d.ts +21 -0
- package/lib/types/group.d.ts.map +1 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/integrations.d.ts +60 -0
- package/lib/types/integrations.d.ts.map +1 -0
- package/lib/types/interaction.d.ts +958 -0
- package/lib/types/interaction.d.ts.map +1 -0
- package/lib/types/json-schema.d.ts +1 -0
- package/lib/types/json-schema.d.ts.map +1 -0
- package/lib/types/json.d.ts +1 -0
- package/lib/types/json.d.ts.map +1 -0
- package/lib/types/meters.d.ts +23 -0
- package/lib/types/meters.d.ts.map +1 -0
- package/lib/types/model_utility.d.ts +1 -0
- package/lib/types/model_utility.d.ts.map +1 -0
- package/lib/types/payload.d.ts +60 -0
- package/lib/types/payload.d.ts.map +1 -0
- package/lib/types/pending-asks.d.ts +93 -0
- package/lib/types/pending-asks.d.ts.map +1 -0
- package/lib/types/project.d.ts +179 -0
- package/lib/types/project.d.ts.map +1 -0
- package/lib/types/prompt.d.ts +78 -0
- package/lib/types/prompt.d.ts.map +1 -0
- package/lib/types/query.d.ts +118 -0
- package/lib/types/query.d.ts.map +1 -0
- package/lib/types/rate-limiter.d.ts +28 -0
- package/lib/types/rate-limiter.d.ts.map +1 -0
- package/lib/types/refs.d.ts +22 -0
- package/lib/types/refs.d.ts.map +1 -0
- package/lib/types/runs.d.ts +32 -0
- package/lib/types/runs.d.ts.map +1 -0
- package/lib/types/skill.d.ts +78 -0
- package/lib/types/skill.d.ts.map +1 -0
- package/lib/types/store/activity-catalog.d.ts +26 -0
- package/lib/types/store/activity-catalog.d.ts.map +1 -0
- package/lib/types/store/collections.d.ts +78 -0
- package/lib/types/store/collections.d.ts.map +1 -0
- package/lib/types/store/common.d.ts +22 -0
- package/lib/types/store/common.d.ts.map +1 -0
- package/lib/types/store/conversation-state.d.ts +120 -0
- package/lib/types/store/conversation-state.d.ts.map +1 -0
- package/lib/types/store/doc-analyzer.d.ts +140 -0
- package/lib/types/store/doc-analyzer.d.ts.map +1 -0
- package/lib/types/store/dsl-workflow.d.ts +244 -0
- package/lib/types/store/dsl-workflow.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +13 -0
- package/lib/types/store/index.d.ts.map +1 -0
- package/lib/types/store/object-types.d.ts +23 -0
- package/lib/types/store/object-types.d.ts.map +1 -0
- package/lib/types/store/schedule.d.ts +182 -0
- package/lib/types/store/schedule.d.ts.map +1 -0
- package/lib/types/store/signals.d.ts +24 -0
- package/lib/types/store/signals.d.ts.map +1 -0
- package/lib/types/store/store.d.ts +407 -0
- package/lib/types/store/store.d.ts.map +1 -0
- package/lib/types/store/temporalio.d.ts +16 -0
- package/lib/types/store/temporalio.d.ts.map +1 -0
- package/lib/types/store/worker.d.ts +18 -0
- package/lib/types/store/worker.d.ts.map +1 -0
- package/lib/types/store/workflow.d.ts +730 -0
- package/lib/types/store/workflow.d.ts.map +1 -0
- package/lib/types/sts-token-types.d.ts +72 -0
- package/lib/types/sts-token-types.d.ts.map +1 -0
- package/lib/types/tenant.d.ts +10 -0
- package/lib/types/tenant.d.ts.map +1 -0
- package/lib/types/tool-execution.d.ts +45 -0
- package/lib/types/tool-execution.d.ts.map +1 -0
- package/lib/types/training.d.ts +38 -0
- package/lib/types/training.d.ts.map +1 -0
- package/lib/types/transient-tokens.d.ts +24 -0
- package/lib/types/transient-tokens.d.ts.map +1 -0
- package/lib/types/user.d.ts +116 -0
- package/lib/types/user.d.ts.map +1 -0
- package/lib/types/utils/auth.d.ts +3 -0
- package/lib/types/utils/auth.d.ts.map +1 -0
- package/lib/types/utils/schemas.d.ts +9 -0
- package/lib/types/utils/schemas.d.ts.map +1 -0
- package/lib/types/utils/type-helpers.d.ts +3 -0
- package/lib/types/utils/type-helpers.d.ts.map +1 -0
- package/lib/types/versions.d.ts +3 -0
- package/lib/types/versions.d.ts.map +1 -0
- package/lib/types/workflow-analytics.d.ts +777 -0
- package/lib/types/workflow-analytics.d.ts.map +1 -0
- package/lib/vertesia-common.js +2 -0
- package/lib/vertesia-common.js.map +1 -0
- package/package.json +54 -0
- package/src/Progress.ts +57 -0
- package/src/access-control.ts +98 -0
- package/src/analytics.ts +106 -0
- package/src/apikey.ts +116 -0
- package/src/apps.ts +296 -0
- package/src/ask-user.ts +35 -0
- package/src/channels.ts +70 -0
- package/src/common.ts +37 -0
- package/src/data-platform.ts +976 -0
- package/src/email.ts +80 -0
- package/src/environment.ts +137 -0
- package/src/facets.ts +44 -0
- package/src/group.ts +26 -0
- package/src/index.ts +40 -0
- package/src/integrations.ts +72 -0
- package/src/interaction.ts +1182 -0
- package/src/json-schema.ts +7 -0
- package/src/json.ts +4 -0
- package/src/meters.ts +30 -0
- package/src/model_utility.ts +1 -0
- package/src/payload.ts +83 -0
- package/src/pending-asks.ts +106 -0
- package/src/project.ts +263 -0
- package/src/prompt.ts +103 -0
- package/src/query.ts +137 -0
- package/src/rate-limiter.ts +34 -0
- package/src/refs.ts +30 -0
- package/src/runs.ts +36 -0
- package/src/skill.ts +90 -0
- package/src/store/activity-catalog.ts +44 -0
- package/src/store/collections.ts +87 -0
- package/src/store/common.ts +30 -0
- package/src/store/conversation-state.ts +146 -0
- package/src/store/doc-analyzer.ts +161 -0
- package/src/store/dsl-workflow.ts +288 -0
- package/src/store/index.ts +14 -0
- package/src/store/ms.d.ts +11 -0
- package/src/store/object-types.ts +127 -0
- package/src/store/schedule.ts +238 -0
- package/src/store/signals.ts +25 -0
- package/src/store/store.ts +579 -0
- package/src/store/temporalio.ts +54 -0
- package/src/store/worker.ts +19 -0
- package/src/store/workflow.test.ts +578 -0
- package/src/store/workflow.ts +973 -0
- package/src/sts-token-types.ts +117 -0
- package/src/tenant.ts +10 -0
- package/src/tool-execution.ts +47 -0
- package/src/training.ts +44 -0
- package/src/transient-tokens.ts +30 -0
- package/src/user.ts +153 -0
- package/src/utils/auth.ts +12 -0
- package/src/utils/schemas.ts +108 -0
- package/src/utils/type-helpers.ts +6 -0
- package/src/versions.ts +3 -0
- package/src/workflow-analytics.ts +925 -0
- package/tsconfig.dist.json +20 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STS Token Request Types
|
|
3
|
+
* These types define the structure for token requests to the Security Token Service
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type TokenType = 'apikey' | 'user' | 'project' | 'environment' | 'agent' | 'service_account';
|
|
7
|
+
export type SigningAlgorithm = 'ES256' | 'RS256';
|
|
8
|
+
|
|
9
|
+
interface BaseTokenRequest {
|
|
10
|
+
type: TokenType;
|
|
11
|
+
audience?: string;
|
|
12
|
+
/** Signing algorithm - defaults to ES256. Use RS256 for Azure AD compatibility. */
|
|
13
|
+
algorithm?: SigningAlgorithm;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// API key doesn't need account/project as it's determined from the key
|
|
17
|
+
export interface ApiKeyTokenRequest extends BaseTokenRequest {
|
|
18
|
+
type: 'apikey';
|
|
19
|
+
key: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// User token needs optional account/project for scoping
|
|
23
|
+
export interface UserTokenRequest extends BaseTokenRequest {
|
|
24
|
+
type: 'user';
|
|
25
|
+
user_id?: string; // Optional - can be determined from auth token
|
|
26
|
+
account_id?: string; // Optional - for scoping to specific account
|
|
27
|
+
project_id?: string; // Optional - for scoping to specific project
|
|
28
|
+
expires_at?: number;
|
|
29
|
+
|
|
30
|
+
on_behalf_of?: string; // Optional - user ID when acting on behalf of another user
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Project token requires project_id and account_id
|
|
34
|
+
export interface ProjectTokenRequest extends BaseTokenRequest {
|
|
35
|
+
type: 'project';
|
|
36
|
+
project_id: string;
|
|
37
|
+
account_id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Environment token requires IDs - names fetched from DB
|
|
41
|
+
export interface EnvironmentTokenRequest extends BaseTokenRequest {
|
|
42
|
+
type: 'environment';
|
|
43
|
+
environment_id: string;
|
|
44
|
+
environment_name: string; // Still required as environments may not be in DB
|
|
45
|
+
project_id: string; // Will fetch name and verify account
|
|
46
|
+
account_id: string; // Will fetch name and verify project belongs to it
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Agent token for service accounts acting as agents
|
|
50
|
+
export interface AgentTokenRequest extends BaseTokenRequest {
|
|
51
|
+
type: 'agent';
|
|
52
|
+
account_id: string;
|
|
53
|
+
project_id: string; // Will verify it belongs to account
|
|
54
|
+
name?: string;
|
|
55
|
+
on_behalf_of: string; // Required: signed Vertesia token to verify user context
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Service account token
|
|
59
|
+
export interface ServiceAccountTokenRequest extends BaseTokenRequest {
|
|
60
|
+
type: 'service_account';
|
|
61
|
+
account_id: string;
|
|
62
|
+
project_id: string; // Will verify it belongs to account
|
|
63
|
+
roles?: string[]; // Optional - roles for the service account token
|
|
64
|
+
name?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type IssueTokenRequest =
|
|
68
|
+
| ApiKeyTokenRequest
|
|
69
|
+
| UserTokenRequest
|
|
70
|
+
| ProjectTokenRequest
|
|
71
|
+
| EnvironmentTokenRequest
|
|
72
|
+
| AgentTokenRequest
|
|
73
|
+
| ServiceAccountTokenRequest;
|
|
74
|
+
|
|
75
|
+
export interface RefreshTokenRequest {
|
|
76
|
+
token: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface RevokeTokenRequest {
|
|
80
|
+
token: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Helper type guards for type narrowing
|
|
84
|
+
export function isApiKeyRequest(req: IssueTokenRequest): req is ApiKeyTokenRequest {
|
|
85
|
+
return req.type === 'apikey';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function isUserRequest(req: IssueTokenRequest): req is UserTokenRequest {
|
|
89
|
+
return req.type === 'user';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function isProjectRequest(req: IssueTokenRequest): req is ProjectTokenRequest {
|
|
93
|
+
return req.type === 'project';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isEnvironmentRequest(req: IssueTokenRequest): req is EnvironmentTokenRequest {
|
|
97
|
+
return req.type === 'environment';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function isAgentRequest(req: IssueTokenRequest): req is AgentTokenRequest {
|
|
101
|
+
return req.type === 'agent';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function isServiceAccountRequest(req: IssueTokenRequest): req is ServiceAccountTokenRequest {
|
|
105
|
+
return req.type === 'service_account';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Response types
|
|
109
|
+
export interface TokenResponse {
|
|
110
|
+
token: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ValidateTokenResponse {
|
|
114
|
+
valid: boolean;
|
|
115
|
+
payload?: any;
|
|
116
|
+
error?: string;
|
|
117
|
+
}
|
package/src/tenant.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface is used only on the client side and is shared between @vertesia/ui/session and the main app.
|
|
3
|
+
*/
|
|
4
|
+
export interface UIResolvedTenant {
|
|
5
|
+
firebaseTenantId: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
logo?: string;
|
|
8
|
+
provider?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for tool execution payloads shared between workflows and tool servers
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint configuration that can override JWT-embedded endpoints
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolEndpointOverrides {
|
|
9
|
+
/**
|
|
10
|
+
* Studio server URL
|
|
11
|
+
*/
|
|
12
|
+
studio?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Store/Zeno server URL
|
|
15
|
+
*/
|
|
16
|
+
store?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Token server URL
|
|
19
|
+
*/
|
|
20
|
+
token?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Metadata passed with tool execution requests from workflows to tool servers
|
|
25
|
+
*/
|
|
26
|
+
export interface ToolExecutionMetadata {
|
|
27
|
+
/**
|
|
28
|
+
* Workflow run ID
|
|
29
|
+
*/
|
|
30
|
+
run_id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* App installation ID
|
|
33
|
+
*/
|
|
34
|
+
app_install_id?: string;
|
|
35
|
+
/**
|
|
36
|
+
* App-specific settings
|
|
37
|
+
*/
|
|
38
|
+
app_settings?: Record<string, any>;
|
|
39
|
+
/**
|
|
40
|
+
* Endpoint overrides from workflow config (takes precedence over JWT endpoints)
|
|
41
|
+
*/
|
|
42
|
+
endpoints?: ToolEndpointOverrides;
|
|
43
|
+
/**
|
|
44
|
+
* Additional metadata fields
|
|
45
|
+
*/
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
package/src/training.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TrainingJob } from "@llumiverse/common";
|
|
2
|
+
import { ExecutionEnvironmentRef } from "./environment.js";
|
|
3
|
+
|
|
4
|
+
export enum TrainingSessionStatus {
|
|
5
|
+
'created' = 'created',
|
|
6
|
+
'building' = 'building',
|
|
7
|
+
'prepared' = 'prepared',
|
|
8
|
+
'processing' = 'processing',
|
|
9
|
+
'completed' = 'completed',
|
|
10
|
+
'cancelled' = 'cancelled',
|
|
11
|
+
'failed' = 'failed'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface TrainingSession {
|
|
15
|
+
id: string;
|
|
16
|
+
project: string;
|
|
17
|
+
name: string
|
|
18
|
+
env: ExecutionEnvironmentRef,
|
|
19
|
+
model: string,
|
|
20
|
+
status: TrainingSessionStatus,
|
|
21
|
+
runs: string[],
|
|
22
|
+
dataset: string, //the name of the file dataset which was generated in GCS
|
|
23
|
+
job: TrainingJob,
|
|
24
|
+
created_by: string,
|
|
25
|
+
updated_by: string,
|
|
26
|
+
created_at: Date,
|
|
27
|
+
updated_at: Date,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TrainingSessionRef extends Omit<TrainingSession, 'runs'> {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export interface TrainingSessionCreatePayload {
|
|
35
|
+
name: string
|
|
36
|
+
env: string,
|
|
37
|
+
model: string,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ListTrainingSessionsQuery {
|
|
41
|
+
limit?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
status?: TrainingSessionStatus;
|
|
44
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProjectRef, ProjectRoles } from "./project.js";
|
|
2
|
+
import { AccountRef, UserRef } from "./user.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export enum TransientTokenType {
|
|
6
|
+
userInvite = 'user-invite',
|
|
7
|
+
migration = 'migration',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TransientToken<T> {
|
|
11
|
+
id: string;
|
|
12
|
+
type: TransientTokenType;
|
|
13
|
+
data: T;
|
|
14
|
+
expires: Date;
|
|
15
|
+
account?: string;
|
|
16
|
+
created_at: Date;
|
|
17
|
+
updated_at: Date;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export interface CreateOrUpdateTransientTokenPayload<T> extends Partial<TransientToken<T>> {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UserInviteTokenData {
|
|
25
|
+
email: string;
|
|
26
|
+
role: ProjectRoles;
|
|
27
|
+
account: AccountRef;
|
|
28
|
+
project: ProjectRef;
|
|
29
|
+
invited_by: UserRef;
|
|
30
|
+
}
|
package/src/user.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ApiKey } from "./apikey.js";
|
|
2
|
+
import { ProjectRoles } from "./project.js";
|
|
3
|
+
|
|
4
|
+
export interface UserWithAccounts extends User {
|
|
5
|
+
accounts: AccountRef[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface User {
|
|
10
|
+
id: string;
|
|
11
|
+
externalId: string;
|
|
12
|
+
email: string;
|
|
13
|
+
name: string;
|
|
14
|
+
username?: string;
|
|
15
|
+
picture?: string;
|
|
16
|
+
language?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
sign_in_provider?: string;
|
|
19
|
+
last_selected_account?: string;
|
|
20
|
+
source?: 'firebase' | 'scim';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export interface UserRef {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
email: string;
|
|
28
|
+
picture?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const UserRefPopulate = "id name email picture";
|
|
32
|
+
|
|
33
|
+
export enum Datacenters {
|
|
34
|
+
aws = 'aws',
|
|
35
|
+
gcp = 'gcp',
|
|
36
|
+
azure = 'azure'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export enum BillingMethod {
|
|
41
|
+
stripe = 'stripe',
|
|
42
|
+
invoice = 'invoice'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum AccountType {
|
|
46
|
+
vertesia = 'vertesia',
|
|
47
|
+
partner = 'partner',
|
|
48
|
+
free = 'free',
|
|
49
|
+
customer = 'customer',
|
|
50
|
+
unknown = 'unknown'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface AccountBilling {
|
|
54
|
+
method: BillingMethod;
|
|
55
|
+
stripe_customer_id?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export interface Account {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
|
|
63
|
+
email_domains: string[];
|
|
64
|
+
|
|
65
|
+
onboarding: {
|
|
66
|
+
completed: boolean,
|
|
67
|
+
completed_at: Date,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
datacenter: string;
|
|
71
|
+
|
|
72
|
+
account_type: AccountType;
|
|
73
|
+
|
|
74
|
+
billing: AccountBilling;
|
|
75
|
+
|
|
76
|
+
created_by: string;
|
|
77
|
+
updated_by: string;
|
|
78
|
+
created_at: string;
|
|
79
|
+
updated_at: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export interface UpdateAccountPayload {
|
|
84
|
+
name?: string;
|
|
85
|
+
email_domains?: string[];
|
|
86
|
+
billing?: AccountBilling;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
export interface AccountRef {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const AccountRefPopulate = "id name";
|
|
96
|
+
|
|
97
|
+
export interface InviteUserRequestPayload {
|
|
98
|
+
email: string;
|
|
99
|
+
role: ProjectRoles;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
export interface InviteUserResponsePayload {
|
|
104
|
+
action: 'invited' | 'added';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
type UserOrApiKey<T extends User | ApiKey> = T extends User ? User : ApiKey;
|
|
110
|
+
type SessionType<T extends User | ApiKey> = T extends User ? "user" : "apikey";
|
|
111
|
+
export interface SessionInfo<T extends User | ApiKey> {
|
|
112
|
+
isNew?: boolean;
|
|
113
|
+
type: SessionType<T>;
|
|
114
|
+
subject: UserOrApiKey<T>;
|
|
115
|
+
//User | ApiKey; // no user if using an apikey
|
|
116
|
+
current_account: Account;
|
|
117
|
+
//role: string; // TODO the role on the selected account
|
|
118
|
+
accounts: AccountRef[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
export interface UserSessionInfo extends SessionInfo<User> { }
|
|
123
|
+
export interface ApiKeySessionInfo extends SessionInfo<ApiKey> { }
|
|
124
|
+
|
|
125
|
+
export interface OnboardingProgress {
|
|
126
|
+
interactions: boolean,
|
|
127
|
+
prompts: boolean,
|
|
128
|
+
environments: boolean,
|
|
129
|
+
default_environment_defined: boolean
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Data collected at signup
|
|
136
|
+
* used for onboarding and segments
|
|
137
|
+
**/
|
|
138
|
+
export interface SignupData {
|
|
139
|
+
accountType: string;
|
|
140
|
+
companyName?: string;
|
|
141
|
+
companySize?: number;
|
|
142
|
+
companyWebsite?: string;
|
|
143
|
+
maturity?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Signup Payload: used to create a new user
|
|
149
|
+
*/
|
|
150
|
+
export interface SignupPayload {
|
|
151
|
+
firebaseToken: string;
|
|
152
|
+
signupData: SignupData;
|
|
153
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ProjectRef } from "../project.js";
|
|
2
|
+
|
|
3
|
+
export function getTenantId(accountId: string, projectId: string): string {
|
|
4
|
+
//use the last 6 characters of the accountId as the db name
|
|
5
|
+
//as in mongo the last 6 char are an incrementing counter
|
|
6
|
+
const accountLast6 = accountId.slice(-6);
|
|
7
|
+
const projectLast6 = projectId.slice(-6);
|
|
8
|
+
return accountLast6 + '_' + projectLast6;
|
|
9
|
+
}
|
|
10
|
+
export function getTenantIdFromProject(project: ProjectRef): string {
|
|
11
|
+
return getTenantId(project.account, project.id);
|
|
12
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { JSONSchema } from "@llumiverse/common";
|
|
2
|
+
import { PromptRole } from "@llumiverse/common";
|
|
3
|
+
import type { JSONSchema4 } from "json-schema";
|
|
4
|
+
import { InCodePrompt, InteractionRefWithSchema, PopulatedInteraction } from "../interaction.js";
|
|
5
|
+
import { ExecutablePromptSegmentDef, PromptSegmentDefType } from "../prompt.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// Remove custom properties from the JSON before sending further down execution pipeline
|
|
9
|
+
export function removeExtraProperties<T>(schema: T): T {
|
|
10
|
+
if (!schema) return schema;
|
|
11
|
+
if (Array.isArray(schema)) {
|
|
12
|
+
for (const item of schema) {
|
|
13
|
+
removeExtraProperties(item);
|
|
14
|
+
}
|
|
15
|
+
} else if (typeof schema === 'object') {
|
|
16
|
+
const obj = schema as Record<string, any>;
|
|
17
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
18
|
+
if (key === 'editor' && (value === 'textarea' || value === 'document' || value === 'media')) {
|
|
19
|
+
delete obj[key];
|
|
20
|
+
} else if (key === 'format' && (value === 'textarea' || value === 'document' || value === 'media')) {
|
|
21
|
+
delete obj[key];
|
|
22
|
+
} else if (typeof value === 'object') {
|
|
23
|
+
removeExtraProperties(value)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return schema;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function mergeJSONSchemas(schemas: JSONSchema[]) {
|
|
31
|
+
const props: Record<string, JSONSchema4> = {};
|
|
32
|
+
let required: string[] = [];
|
|
33
|
+
for (const schema of schemas) {
|
|
34
|
+
if (schema.properties) {
|
|
35
|
+
if (schema.required) {
|
|
36
|
+
for (const prop of schema.required as string[]) {
|
|
37
|
+
if (!required.includes(prop)) required.push(prop);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
Object.assign(props, schema.properties);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const schema = Object.keys(props).length > 0 ? { properties: props, required, type: 'object' } as JSONSchema : null;
|
|
44
|
+
return schema;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function _mergePromptsSchema(prompts: ExecutablePromptSegmentDef[]) {
|
|
48
|
+
const props: Record<string, JSONSchema4> = {};
|
|
49
|
+
let required = new Set<String>();
|
|
50
|
+
for (const prompt of prompts) {
|
|
51
|
+
if (prompt.template?.inputSchema?.properties) {
|
|
52
|
+
const schema = prompt.template?.inputSchema;
|
|
53
|
+
if (schema.required) {
|
|
54
|
+
for (const prop of schema.required as string[]) {
|
|
55
|
+
required.add(prop);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
Object.assign(props, schema.properties);
|
|
59
|
+
} else if (prompt.type === PromptSegmentDefType.chat) {
|
|
60
|
+
Object.assign(props, {
|
|
61
|
+
chat: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
role: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
enum: [PromptRole.assistant, PromptRole.user]
|
|
69
|
+
},
|
|
70
|
+
content: { type: 'string' },
|
|
71
|
+
},
|
|
72
|
+
required: ['role', 'content']
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
required.add('chat');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return Object.keys(props).length > 0 ? {
|
|
80
|
+
properties: props,
|
|
81
|
+
required: Array.from(required)
|
|
82
|
+
} as JSONSchema4 : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function mergePromptsSchema(interaction: InteractionRefWithSchema | PopulatedInteraction) {
|
|
86
|
+
if (!interaction.prompts) return null;
|
|
87
|
+
return _mergePromptsSchema(interaction.prompts as ExecutablePromptSegmentDef[]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function mergeInCodePromptSchemas(prompts: InCodePrompt[]) {
|
|
91
|
+
const props: Record<string, JSONSchema> = {};
|
|
92
|
+
let required = new Set<String>();
|
|
93
|
+
for (const prompt of prompts) {
|
|
94
|
+
if (prompt.schema?.properties) {
|
|
95
|
+
const schema = prompt.schema;
|
|
96
|
+
if (schema.required) {
|
|
97
|
+
for (const prop of schema.required as string[]) {
|
|
98
|
+
required.add(prop);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
Object.assign(props, schema.properties);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return Object.keys(props).length > 0 ? {
|
|
105
|
+
properties: props,
|
|
106
|
+
required: Array.from(required)
|
|
107
|
+
} as JSONSchema : null;
|
|
108
|
+
}
|
package/src/versions.ts
ADDED