@vertesia/common 0.78.0 → 0.79.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/lib/cjs/apikey.js +1 -0
- package/lib/cjs/apikey.js.map +1 -1
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/rate-limiter.js +6 -0
- package/lib/cjs/rate-limiter.js.map +1 -0
- package/lib/cjs/store/store.js +8 -1
- package/lib/cjs/store/store.js.map +1 -1
- package/lib/cjs/store/workflow.js.map +1 -1
- package/lib/cjs/sts-token-types.js +32 -0
- package/lib/cjs/sts-token-types.js.map +1 -0
- package/lib/cjs/versions.js +8 -0
- package/lib/cjs/versions.js.map +1 -0
- package/lib/esm/apikey.js +1 -0
- package/lib/esm/apikey.js.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/rate-limiter.js +5 -0
- package/lib/esm/rate-limiter.js.map +1 -0
- package/lib/esm/store/store.js +7 -0
- package/lib/esm/store/store.js.map +1 -1
- package/lib/esm/store/workflow.js.map +1 -1
- package/lib/esm/sts-token-types.js +24 -0
- package/lib/esm/sts-token-types.js.map +1 -0
- package/lib/esm/versions.js +5 -0
- package/lib/esm/versions.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/apikey.d.ts +1 -0
- package/lib/types/apikey.d.ts.map +1 -1
- package/lib/types/apps.d.ts +30 -0
- package/lib/types/apps.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interaction.d.ts +18 -5
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/payload.d.ts +2 -4
- package/lib/types/payload.d.ts.map +1 -1
- package/lib/types/query.d.ts +2 -0
- package/lib/types/query.d.ts.map +1 -1
- package/lib/types/rate-limiter.d.ts +28 -0
- package/lib/types/rate-limiter.d.ts.map +1 -0
- package/lib/types/store/collections.d.ts +1 -0
- package/lib/types/store/collections.d.ts.map +1 -1
- package/lib/types/store/store.d.ts +6 -0
- package/lib/types/store/store.d.ts.map +1 -1
- package/lib/types/store/workflow.d.ts +16 -5
- package/lib/types/store/workflow.d.ts.map +1 -1
- package/lib/types/sts-token-types.d.ts +69 -0
- package/lib/types/sts-token-types.d.ts.map +1 -0
- package/lib/types/versions.d.ts +3 -0
- package/lib/types/versions.d.ts.map +1 -0
- package/lib/vertesia-common.js +1 -1
- package/lib/vertesia-common.js.map +1 -1
- package/package.json +1 -1
- package/src/apikey.ts +1 -0
- package/src/apps.ts +32 -0
- package/src/index.ts +4 -1
- package/src/interaction.ts +22 -6
- package/src/payload.ts +2 -4
- 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 +7 -0
- package/src/store/workflow.ts +19 -5
- package/src/versions.ts +3 -0
package/package.json
CHANGED
package/src/apikey.ts
CHANGED
package/src/apps.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSONSchema } from "@llumiverse/common";
|
|
1
2
|
|
|
2
3
|
export interface AppUIConfig {
|
|
3
4
|
/**
|
|
@@ -36,6 +37,12 @@ export interface AppManifestData {
|
|
|
36
37
|
*/
|
|
37
38
|
icon?: string;
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A color name to be used as the color of the app card (e.g. blue, red, green, etc.)
|
|
42
|
+
* If not specified a random color will be picked.
|
|
43
|
+
*/
|
|
44
|
+
color?: string;
|
|
45
|
+
|
|
39
46
|
status: "beta" | "stable" | "deprecated"
|
|
40
47
|
|
|
41
48
|
ui?: AppUIConfig
|
|
@@ -46,6 +53,11 @@ export interface AppManifestData {
|
|
|
46
53
|
* 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
54
|
*/
|
|
48
55
|
tool_collections?: string[]
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A JSON chema for the app installation settings.
|
|
59
|
+
*/
|
|
60
|
+
settings_schema?: JSONSchema;
|
|
49
61
|
}
|
|
50
62
|
export interface AppManifest extends AppManifestData {
|
|
51
63
|
id: string;
|
|
@@ -73,3 +85,23 @@ export interface AppInstallationPayload {
|
|
|
73
85
|
}
|
|
74
86
|
|
|
75
87
|
export type AppInstallationKind = 'ui' | 'tools' | 'all';
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A descriptiojn of the tools provided by an app
|
|
91
|
+
*/
|
|
92
|
+
export interface AppToolCollection {
|
|
93
|
+
/**
|
|
94
|
+
* The collection name
|
|
95
|
+
*/
|
|
96
|
+
name: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Optional collection description
|
|
100
|
+
*/
|
|
101
|
+
description?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* the tools provided by this collection
|
|
105
|
+
*/
|
|
106
|
+
tools: { name: string, description?: string }[]
|
|
107
|
+
}
|
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,6 @@ 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 './versions.js';
|
|
32
|
+
|
package/src/interaction.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CompletionResult,
|
|
2
3
|
JSONObject,
|
|
3
4
|
JSONSchema,
|
|
4
5
|
Modalities,
|
|
@@ -284,7 +285,7 @@ export interface NamedInteractionExecutionPayload extends InteractionExecutionPa
|
|
|
284
285
|
// ================= async execution payloads ====================
|
|
285
286
|
export type ToolRef = string | { name: string; description: string };
|
|
286
287
|
|
|
287
|
-
interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayload,"toolDefinitions" | "stream"> {
|
|
288
|
+
interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayload, "toolDefinitions" | "stream"> {
|
|
288
289
|
type: "conversation" | "interaction";
|
|
289
290
|
|
|
290
291
|
/**
|
|
@@ -381,6 +382,10 @@ export interface ToolResultContent {
|
|
|
381
382
|
content: string;
|
|
382
383
|
is_error: boolean;
|
|
383
384
|
files?: string[];
|
|
385
|
+
/**
|
|
386
|
+
* Can contain metadata returned by the tool executor.
|
|
387
|
+
*/
|
|
388
|
+
meta?: Record<string, any>;
|
|
384
389
|
}
|
|
385
390
|
|
|
386
391
|
export interface ToolResult extends ToolResultContent {
|
|
@@ -398,7 +403,7 @@ export interface UserMessagePayload extends ResumeConversationPayload {
|
|
|
398
403
|
message: string;
|
|
399
404
|
}
|
|
400
405
|
|
|
401
|
-
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results"
|
|
406
|
+
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results" | "tools">
|
|
402
407
|
|
|
403
408
|
// ================= end async execution payloads ====================
|
|
404
409
|
|
|
@@ -419,7 +424,7 @@ export interface RunSource {
|
|
|
419
424
|
client_ip: string;
|
|
420
425
|
}
|
|
421
426
|
|
|
422
|
-
export interface ExecutionRun<P = any
|
|
427
|
+
export interface ExecutionRun<P = any> {
|
|
423
428
|
readonly id: string;
|
|
424
429
|
/**
|
|
425
430
|
* Only used by runs that were created by a virtual run to point toward the virtual run parent
|
|
@@ -430,7 +435,7 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
430
435
|
selected?: boolean;
|
|
431
436
|
scores?: Record<string, number>;
|
|
432
437
|
};
|
|
433
|
-
result: R
|
|
438
|
+
result: CompletionResult[] // Any new result will actually be CompletionResult[], the old typing is R, and R used to default to any.
|
|
434
439
|
/**
|
|
435
440
|
* The parameters used to create the interaction.
|
|
436
441
|
* If the parameters contains the special property "@memory" it will be used
|
|
@@ -450,7 +455,7 @@ export interface ExecutionRun<P = any, R = any> {
|
|
|
450
455
|
prompt: any;
|
|
451
456
|
token_use?: ExecutionTokenUsage;
|
|
452
457
|
chunks?: number;
|
|
453
|
-
execution_time?: number; //
|
|
458
|
+
execution_time?: number; // ms
|
|
454
459
|
created_at: Date;
|
|
455
460
|
updated_at: Date;
|
|
456
461
|
account: AccountRef;
|
|
@@ -498,7 +503,7 @@ export interface ExecutionRunWorkflow {
|
|
|
498
503
|
activity_type?: string;
|
|
499
504
|
}
|
|
500
505
|
|
|
501
|
-
export interface InteractionExecutionResult<P = any
|
|
506
|
+
export interface InteractionExecutionResult<P = any> extends ExecutionRun<P> {
|
|
502
507
|
tool_use?: ToolUse[];
|
|
503
508
|
conversation?: unknown;
|
|
504
509
|
options?: StatelessExecutionOptions;
|
|
@@ -551,3 +556,14 @@ export interface GenerateTestDataPayload {
|
|
|
551
556
|
export interface ImprovePromptPayload {
|
|
552
557
|
config: InteractionExecutionConfiguration;
|
|
553
558
|
}
|
|
559
|
+
|
|
560
|
+
export interface RateLimitRequestPayload {
|
|
561
|
+
interaction: string,
|
|
562
|
+
environment_id?: string,
|
|
563
|
+
model_id?: string,
|
|
564
|
+
workflow_run_id?: string
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface RateLimitRequestResponse {
|
|
568
|
+
delay_ms: number;
|
|
569
|
+
}
|
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/query.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface SimpleSearchQuery {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface ObjectSearchQuery extends SimpleSearchQuery {
|
|
46
|
+
id?: string;
|
|
46
47
|
createdFrom?: string;
|
|
47
48
|
createdTo?: string;
|
|
48
49
|
updatedFrom?: string;
|
|
@@ -86,6 +87,7 @@ export interface RunSearchQuery extends SimpleSearchQuery {
|
|
|
86
87
|
finish_reason?: string;
|
|
87
88
|
created_by?: string;
|
|
88
89
|
workflow_run_ids?: string[];
|
|
90
|
+
run_ids?: string[];
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
export interface WorkflowExecutionSearchQuery extends SimpleSearchQuery {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate Limiter Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface RateLimiterCapacity {
|
|
6
|
+
current: number;
|
|
7
|
+
base: number;
|
|
8
|
+
max: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RateLimiterBreakerState {
|
|
12
|
+
state: 'open' | 'closed';
|
|
13
|
+
is_open: boolean;
|
|
14
|
+
last_opened_at?: string;
|
|
15
|
+
consecutive_failures?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface RateLimiterModelStatus {
|
|
19
|
+
model_id: string;
|
|
20
|
+
admitted: number;
|
|
21
|
+
delayed: number;
|
|
22
|
+
capacity: RateLimiterCapacity;
|
|
23
|
+
breaker: RateLimiterBreakerState;
|
|
24
|
+
last_updated: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface RateLimiterStatus {
|
|
28
|
+
environment_id: string;
|
|
29
|
+
model_id: string;
|
|
30
|
+
status: RateLimiterModelStatus;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Always return an array for consistency
|
|
34
|
+
export type RateLimiterStatusResponse = RateLimiterStatus[];
|
package/src/store/collections.ts
CHANGED
package/src/store/store.ts
CHANGED
|
@@ -3,6 +3,13 @@ import { SupportedEmbeddingTypes } from "../project.js";
|
|
|
3
3
|
import { ComplexSearchQuery } from "../query.js";
|
|
4
4
|
import { BaseObject } from "./common.js";
|
|
5
5
|
|
|
6
|
+
export enum ContentObjectApiHeaders {
|
|
7
|
+
COLLECTION_ID = 'x-collection-id',
|
|
8
|
+
PROCESSING_PRIORITY = 'x-processing-priority',
|
|
9
|
+
CREATE_REVISION = 'x-create-revision',
|
|
10
|
+
REVISION_LABEL = 'x-revision-label',
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
export enum ContentObjectStatus {
|
|
7
14
|
created = "created",
|
|
8
15
|
processing = "processing", // the was created and still processing
|
package/src/store/workflow.ts
CHANGED
|
@@ -12,6 +12,13 @@ export enum ContentEventName {
|
|
|
12
12
|
api_request = "api_request",
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export interface Queue {
|
|
16
|
+
name: string;
|
|
17
|
+
// use either suffix or full name. fullname has precedence over suffix
|
|
18
|
+
queue_suffix?: string; // suffix to append to the base queue name
|
|
19
|
+
queue_full_name?: string; // full name
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
16
23
|
/**
|
|
17
24
|
* The ref of the user who initiated the workflow.
|
|
@@ -59,7 +66,7 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
|
59
66
|
* The list of endpoints to notify when the workflow finishes.
|
|
60
67
|
* It is handled by a sub-workflow execution, so the main workflow will not wait for the notification to be sent.
|
|
61
68
|
*/
|
|
62
|
-
notify_endpoints?: string[];
|
|
69
|
+
notify_endpoints?: (string | WebHookSpec)[];
|
|
63
70
|
|
|
64
71
|
/** If this is a child workflow, parent contains parent's ids */
|
|
65
72
|
parent?: {
|
|
@@ -72,14 +79,21 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
|
|
|
72
79
|
};
|
|
73
80
|
|
|
74
81
|
/**
|
|
75
|
-
*
|
|
82
|
+
* List of enabled processing queues. Managed by the application.
|
|
76
83
|
*/
|
|
77
|
-
|
|
84
|
+
_enabled_queues?: Queue[];
|
|
85
|
+
|
|
86
|
+
}
|
|
78
87
|
|
|
88
|
+
export interface WebHookSpec {
|
|
89
|
+
/**
|
|
90
|
+
* The webhook URL to call using POST method
|
|
91
|
+
*/
|
|
92
|
+
url: string;
|
|
79
93
|
/**
|
|
80
|
-
*
|
|
94
|
+
* the API version to use if any
|
|
81
95
|
*/
|
|
82
|
-
|
|
96
|
+
version?: number;
|
|
83
97
|
}
|
|
84
98
|
|
|
85
99
|
export interface WorkflowExecutionPayload<T = Record<string, any>> extends WorkflowExecutionBaseParams<T> {
|
package/src/versions.ts
ADDED