@vertesia/common 0.79.0 → 0.80.0-dev-20251118

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.
Files changed (107) hide show
  1. package/lib/cjs/access-control.js +3 -3
  2. package/lib/cjs/access-control.js.map +1 -1
  3. package/lib/cjs/apikey.js +1 -0
  4. package/lib/cjs/apikey.js.map +1 -1
  5. package/lib/cjs/index.js +1 -0
  6. package/lib/cjs/index.js.map +1 -1
  7. package/lib/cjs/interaction.js +12 -2
  8. package/lib/cjs/interaction.js.map +1 -1
  9. package/lib/cjs/prompt.js +0 -1
  10. package/lib/cjs/prompt.js.map +1 -1
  11. package/lib/cjs/store/store.js +13 -1
  12. package/lib/cjs/store/store.js.map +1 -1
  13. package/lib/cjs/store/workflow.js.map +1 -1
  14. package/lib/cjs/sts-token-types.js.map +1 -1
  15. package/lib/cjs/utils/schemas.js +27 -5
  16. package/lib/cjs/utils/schemas.js.map +1 -1
  17. package/lib/esm/access-control.js +3 -3
  18. package/lib/esm/access-control.js.map +1 -1
  19. package/lib/esm/apikey.js +1 -0
  20. package/lib/esm/apikey.js.map +1 -1
  21. package/lib/esm/index.js +1 -0
  22. package/lib/esm/index.js.map +1 -1
  23. package/lib/esm/interaction.js +11 -1
  24. package/lib/esm/interaction.js.map +1 -1
  25. package/lib/esm/prompt.js +0 -1
  26. package/lib/esm/prompt.js.map +1 -1
  27. package/lib/esm/store/store.js +12 -0
  28. package/lib/esm/store/store.js.map +1 -1
  29. package/lib/esm/store/workflow.js.map +1 -1
  30. package/lib/esm/sts-token-types.js.map +1 -1
  31. package/lib/esm/utils/schemas.js +26 -5
  32. package/lib/esm/utils/schemas.js.map +1 -1
  33. package/lib/tsconfig.tsbuildinfo +1 -1
  34. package/lib/types/Progress.d.ts +1 -0
  35. package/lib/types/access-control.d.ts +4 -3
  36. package/lib/types/access-control.d.ts.map +1 -1
  37. package/lib/types/analytics.d.ts +1 -0
  38. package/lib/types/apikey.d.ts +7 -2
  39. package/lib/types/apikey.d.ts.map +1 -1
  40. package/lib/types/apps.d.ts +8 -0
  41. package/lib/types/apps.d.ts.map +1 -1
  42. package/lib/types/common.d.ts +1 -0
  43. package/lib/types/environment.d.ts +1 -0
  44. package/lib/types/facets.d.ts +1 -0
  45. package/lib/types/group.d.ts +1 -0
  46. package/lib/types/index.d.ts +2 -0
  47. package/lib/types/index.d.ts.map +1 -1
  48. package/lib/types/integrations.d.ts +1 -0
  49. package/lib/types/interaction.d.ts +253 -18
  50. package/lib/types/interaction.d.ts.map +1 -1
  51. package/lib/types/json-schema.d.ts +1 -0
  52. package/lib/types/json.d.ts +1 -0
  53. package/lib/types/meters.d.ts +1 -0
  54. package/lib/types/model_utility.d.ts +1 -0
  55. package/lib/types/payload.d.ts +1 -0
  56. package/lib/types/project.d.ts +6 -5
  57. package/lib/types/project.d.ts.map +1 -1
  58. package/lib/types/prompt.d.ts +16 -8
  59. package/lib/types/prompt.d.ts.map +1 -1
  60. package/lib/types/query.d.ts +3 -0
  61. package/lib/types/query.d.ts.map +1 -1
  62. package/lib/types/rate-limiter.d.ts +1 -0
  63. package/lib/types/refs.d.ts +1 -0
  64. package/lib/types/runs.d.ts +1 -0
  65. package/lib/types/store/activity-catalog.d.ts +1 -0
  66. package/lib/types/store/agent.d.ts +1 -0
  67. package/lib/types/store/collections.d.ts +5 -2
  68. package/lib/types/store/collections.d.ts.map +1 -1
  69. package/lib/types/store/common.d.ts +1 -0
  70. package/lib/types/store/doc-analyzer.d.ts +1 -0
  71. package/lib/types/store/dsl-workflow.d.ts +1 -0
  72. package/lib/types/store/index.d.ts +1 -0
  73. package/lib/types/store/object-types.d.ts +1 -0
  74. package/lib/types/store/signals.d.ts +1 -0
  75. package/lib/types/store/store.d.ts +29 -5
  76. package/lib/types/store/store.d.ts.map +1 -1
  77. package/lib/types/store/temporalio.d.ts +1 -0
  78. package/lib/types/store/workflow.d.ts +65 -8
  79. package/lib/types/store/workflow.d.ts.map +1 -1
  80. package/lib/types/sts-token-types.d.ts +4 -0
  81. package/lib/types/sts-token-types.d.ts.map +1 -1
  82. package/lib/types/tenant.d.ts +1 -0
  83. package/lib/types/training.d.ts +1 -0
  84. package/lib/types/transient-tokens.d.ts +1 -0
  85. package/lib/types/user.d.ts +1 -0
  86. package/lib/types/utils/auth.d.ts +1 -0
  87. package/lib/types/utils/schemas.d.ts +5 -3
  88. package/lib/types/utils/schemas.d.ts.map +1 -1
  89. package/lib/types/utils/type-helpers.d.ts +1 -0
  90. package/lib/types/versions.d.ts +1 -0
  91. package/lib/vertesia-common.js +1 -1
  92. package/lib/vertesia-common.js.map +1 -1
  93. package/package.json +43 -38
  94. package/src/access-control.ts +5 -4
  95. package/src/apikey.ts +22 -21
  96. package/src/apps.ts +8 -0
  97. package/src/index.ts +1 -0
  98. package/src/interaction.ts +296 -18
  99. package/src/project.ts +7 -5
  100. package/src/prompt.ts +16 -9
  101. package/src/query.ts +2 -0
  102. package/src/store/collections.ts +16 -2
  103. package/src/store/store.ts +50 -13
  104. package/src/store/workflow.ts +79 -8
  105. package/src/sts-token-types.ts +117 -0
  106. package/src/utils/schemas.ts +32 -9
  107. package/LICENSE +0 -13
package/package.json CHANGED
@@ -1,40 +1,45 @@
1
1
  {
2
- "name": "@vertesia/common",
3
- "version": "0.79.0",
4
- "type": "module",
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.80.0-dev-20251118",
4
+ "type": "module",
12
5
  "types": "./lib/types/index.d.ts",
13
- "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js"
15
- },
16
- "devDependencies": {
17
- "@rollup/plugin-commonjs": "^28.0.3",
18
- "@rollup/plugin-node-resolve": "^16.0.1",
19
- "@rollup/plugin-typescript": "^12.1.2",
20
- "@types/json-schema": "^7.0.15",
21
- "rollup": "^4.40.2",
22
- "rollup-plugin-terser": "^7.0.2",
23
- "ts-dual-module": "^0.6.3",
24
- "typescript": "^5.0.2",
25
- "vitest": "^3.0.9"
26
- },
27
- "dependencies": {
28
- "ajv": "^8.16.0",
29
- "json-schema": "^0.4.0",
30
- "@llumiverse/common": "0.22.0"
31
- },
32
- "ts_dual_module": {
33
- "outDir": "lib"
34
- },
35
- "scripts": {
36
- "test": "vitest run",
37
- "build": "pnpm exec tsmod build && pnpm exec rollup -c",
38
- "clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
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
+ }
@@ -42,10 +42,11 @@ export enum Permission {
42
42
 
43
43
  workflow_run = "workflow:run",
44
44
  workflow_admin = "workflow:admin",
45
+ workflow_superadmin = "workflow:superadmin",
45
46
 
46
- /**
47
- * whether the user has access to Sutdio App.
48
- */
47
+ iam_impersonate = "iam:impersonate",
48
+
49
+ /** whether the user has access to Sutdio App. */
49
50
  studio_access = "studio:access",
50
51
  }
51
52
 
@@ -94,4 +95,4 @@ export interface AcesQueryOptions {
94
95
  role?: string
95
96
  type?: AccessControlResourceType
96
97
 
97
- }
98
+ }
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 = 'sk'
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 CreateOrUpdateApiKeyPayload extends Partial<ApiKey> {
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,20 +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?: string | {
81
- studio: string,
82
- store: string
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
93
  Group = "group",
94
94
  ApiKey = "apikey",
95
95
  ServiceAccount = "service_account",
96
- }
96
+ Agent = "agent",
97
+ }
package/src/apps.ts CHANGED
@@ -54,6 +54,14 @@ export interface AppManifestData {
54
54
  */
55
55
  tool_collections?: string[]
56
56
 
57
+ /**
58
+ * An URL providing interactions definitions in JSON format.
59
+ * The URL must provide 2 endpoints:
60
+ * 1. GET URL - must return a JSON array with the list of interactions (as AppInteractionRef[])
61
+ * 2. GET URL/{interaction_name} - must return the full interaction definition for the specified interaction.
62
+ */
63
+ interactions?: string;
64
+
57
65
  /**
58
66
  * A JSON chema for the app installation settings.
59
67
  */
package/src/index.ts CHANGED
@@ -28,5 +28,6 @@ export * from './user.js';
28
28
  export * from './utils/auth.js';
29
29
  export * from './utils/schemas.js';
30
30
  export type * from './utils/type-helpers.js';
31
+ export * from './sts-token-types.js';
31
32
  export * from './versions.js';
32
33
 
@@ -4,6 +4,7 @@ import type {
4
4
  JSONSchema,
5
5
  Modalities,
6
6
  ModelOptions,
7
+ PromptRole,
7
8
  StatelessExecutionOptions,
8
9
  ToolDefinition,
9
10
  ToolUse,
@@ -15,10 +16,12 @@ import { ExecutionTokenUsage } from "@llumiverse/common";
15
16
  import { ExecutionEnvironmentRef } from "./environment.js";
16
17
  import { ProjectRef } from "./project.js";
17
18
  import {
19
+ ExecutablePromptSegmentDef,
18
20
  PopulatedPromptSegmentDef,
19
21
  PromptSegmentDef,
20
22
  PromptTemplateRef,
21
23
  PromptTemplateRefWithSchema,
24
+ TemplateType,
22
25
  } from "./prompt.js";
23
26
  import { ExecutionRunDocRef } from "./runs.js";
24
27
  import { AccountRef } from "./user.js";
@@ -29,6 +32,193 @@ export interface InteractionExecutionError {
29
32
  data?: any;
30
33
  }
31
34
 
35
+
36
+ // ------------------ in code interactions -----------------
37
+ /**
38
+ * Reference to an interaction in the catalog.
39
+ * Used in catalog listing. The id is composed of the namespace and the interaction name.
40
+ * Stored interactions can use `oid:` prefix.
41
+ * If no prefix is used it fallback on `oid:`.
42
+ */
43
+ export interface CatalogInteractionRef {
44
+ /**
45
+ * The type of interaction
46
+ */
47
+ type: "sys" | "app" | "stored" | "draft";
48
+
49
+ /**
50
+ * the interaction id that can be used to execute the interaction.
51
+ */
52
+ id: string;
53
+
54
+ /**
55
+ * The interaction name which identify the interaction in the provider interaction list.
56
+ * For the stored interactions this is the same as the endpoint property.
57
+ * For other types of interactions this is the local name of the interaction.
58
+ */
59
+ name: string;
60
+
61
+ /**
62
+ * Only applies for stored interactions. The version of the interaction.
63
+ * Undefined for non stored interactions
64
+ */
65
+ version?: number;
66
+
67
+ /**
68
+ * Only applies for stored interactions. Whether the interaction is published or not.
69
+ */
70
+ published?: boolean;
71
+
72
+ /**
73
+ * The tags associated with the interaction.
74
+ */
75
+ tags: string[];
76
+
77
+ /**
78
+ * Agent Runner configuration options.
79
+ */
80
+ agent_runner_options?: AgentRunnerOptions;
81
+
82
+ /**
83
+ * The name of the interaction. For display purposes only.
84
+ */
85
+ title: string;
86
+
87
+ /**
88
+ * Optional description of the interaction.
89
+ */
90
+ description?: string;
91
+ }
92
+
93
+ export interface InCodePrompt {
94
+ role: PromptRole,
95
+ content: string,
96
+ content_type: TemplateType;
97
+ schema?: JSONSchema;
98
+ /**
99
+ * optional name of the prompt segment. Use kebab case for prompt names
100
+ */
101
+ name?: string;
102
+ /**
103
+ * optional reference to an external resource if any.
104
+ * Used internally by the system to synchronize stored prompts with in-code prompts.
105
+ */
106
+ externalId?: string;
107
+ }
108
+ export interface InCodeInteraction {
109
+ /**
110
+ * The interaction type.
111
+ */
112
+ type: "sys" | "app" | "stored" | "draft";
113
+
114
+ /**
115
+ * The id of the interaction. Required.
116
+ * The id is a unique identifier for the interaction.
117
+ * It is recommended to use a URL safe string and not include spaces.
118
+ * The id composaed by some namespace or prefix and the interaction name.
119
+ * Example: sys:generic_question, app:review_contract, tmp:my_temp_interaction
120
+ */
121
+ id: string;
122
+
123
+ /**
124
+ * The interaction code name. Required.
125
+ * Should be a URL safe string and not include spaces. It is recommended to use kebab-case or camel-case.
126
+ * The endpoints must satisfy the following regexp: /^[a-zA-Z0-9-_]+$/. No whitespaces or special characters are allowed.
127
+ */
128
+ name: string;
129
+
130
+ /**
131
+ * Only applies for stored interactions. The version of the interaction.
132
+ * Undefined for non stored interactions
133
+ */
134
+ version?: number;
135
+
136
+ /**
137
+ * Only applies for stored interactions. Whether the interaction is published or not.
138
+ */
139
+ published?: boolean;
140
+
141
+ /**
142
+ * A title for the interaction. If not provided, the endpoint will be used.
143
+ */
144
+ title?: string;
145
+
146
+ /**
147
+ * An optional description of the interaction.
148
+ */
149
+ description?: string;
150
+
151
+ /**
152
+ * The JSON schema to be used for the result if any.
153
+ */
154
+ result_schema?: JSONSchema | SchemaRef;
155
+
156
+ /**
157
+ * The modality of the interaction output.
158
+ * If not specified Modalities.Text is assumed.
159
+ */
160
+ output_modality?: Modalities,
161
+
162
+ /**
163
+ * How to store the run data for executions of this interaction.
164
+ * Defaults to STANDARD.
165
+ */
166
+ storage?: RunDataStorageLevel;
167
+
168
+ /**
169
+ * Optional tags for the interaction.
170
+ */
171
+ tags?: string[];
172
+
173
+ /**
174
+ * Agent Runner configuration options.
175
+ */
176
+ agent_runner_options?: AgentRunnerOptions;
177
+
178
+ /**
179
+ * Default options for the model to be used when executing this interaction.
180
+ * (like temperature etc)
181
+ */
182
+ model_options?: ModelOptions;
183
+
184
+ /**
185
+ * The prompts composing the interaction. Required.
186
+ */
187
+ prompts: InCodePrompt[]
188
+
189
+ /**
190
+ * Optional reference to an external resource if any.
191
+ * Used internally by the system to synchronize stored interactions with in-code interactions.
192
+ */
193
+ externalId?: string;
194
+
195
+ /**
196
+ * Runtime configuration (system use only)
197
+ *
198
+ * This field is populated by the system when converting stored interactions
199
+ * and contains runtime-specific defaults like target model/environment IDs.
200
+ *
201
+ * DO NOT set this field manually when writing interaction definitions.
202
+ * These values are environment-specific and not portable.
203
+ *
204
+ * @internal
205
+ */
206
+ runtime?: {
207
+ /**
208
+ * Default target environment for the interaction execution
209
+ */
210
+ environment?: string;
211
+
212
+ /**
213
+ * Default (recommended) target model for the interaction execution
214
+ */
215
+ model?: string;
216
+ }
217
+ }
218
+ export interface InteractionSpec extends Omit<InCodeInteraction, 'id' | 'runtime' | 'type' | 'published' | 'version'> {
219
+ }
220
+ // ---------------------------------------------------------
221
+
32
222
  /**
33
223
  * The payload to query the interaction endpoints
34
224
  */
@@ -78,6 +268,7 @@ export interface InteractionEndpoint {
78
268
  visibility?: InteractionVisibility;
79
269
  version: number;
80
270
  tags: string[];
271
+ agent_runner_options?: AgentRunnerOptions;
81
272
  output_modality?: Modalities;
82
273
  result_schema?: JSONSchema;
83
274
  params_schema?: JSONSchema;
@@ -93,11 +284,12 @@ export interface InteractionRef {
93
284
  visibility?: InteractionVisibility;
94
285
  version: number;
95
286
  tags: string[];
287
+ agent_runner_options?: AgentRunnerOptions;
96
288
  prompts?: PromptSegmentDef<PromptTemplateRef>[];
97
289
  updated_at: Date;
98
290
  }
99
291
  export const InteractionRefPopulate =
100
- "id name endpoint parent description status version visibility tags updated_at prompts";
292
+ "id name endpoint parent description status version visibility tags agent_runner_options updated_at prompts";
101
293
 
102
294
  export const InteractionRefWithSchemaPopulate =
103
295
  `${InteractionRefPopulate} result_schema`;
@@ -167,28 +359,32 @@ export interface CachePolicy {
167
359
  ttl: number;
168
360
  }
169
361
  export type InteractionVisibility = "public" | "private";
170
- export interface Interaction {
362
+
363
+ export interface InteractionData {
171
364
  readonly id: string;
172
365
  name: string;
173
366
  endpoint: string;
174
367
  description?: string;
368
+ project: string | ProjectRef;
369
+ tags: string[];
370
+ agent_runner_options?: AgentRunnerOptions;
371
+ result_schema?: JSONSchema4 | SchemaRef;
372
+ environment?: string | ExecutionEnvironmentRef;
373
+ model?: string;
374
+ model_options?: ModelOptions;
375
+ restriction?: RunDataStorageLevel;
376
+ output_modality?: Modalities;
377
+ }
378
+ export interface Interaction extends InteractionData {
175
379
  status: InteractionStatus;
176
380
  parent?: string;
177
381
  // only used for versions (status === "published")
178
382
  visibility: InteractionVisibility;
179
383
  version: number;
180
- tags: string[];
181
384
  test_data?: JSONObject;
182
385
  interaction_schema?: JSONSchema4 | SchemaRef;
183
- result_schema?: JSONSchema4 | SchemaRef;
184
386
  cache_policy?: CachePolicy;
185
- model: string;
186
- model_options?: ModelOptions;
187
387
  prompts: PromptSegmentDef[];
188
- output_modality?: Modalities;
189
- environment: string | ExecutionEnvironmentRef;
190
- restriction?: RunDataStorageLevel;
191
- project: string | ProjectRef;
192
388
  // only for drafts - when it was last published
193
389
  last_published_at?: Date;
194
390
  created_by: string;
@@ -201,6 +397,14 @@ export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
201
397
  prompts: PopulatedPromptSegmentDef[];
202
398
  }
203
399
 
400
+ /**
401
+ * Used to describe an interaction that can be executed. Contains only the interaction data useful
402
+ * to execute the interaction plus the prompt templates
403
+ */
404
+ export interface ExecutableInteraction extends InteractionData {
405
+ prompts: ExecutablePromptSegmentDef[];
406
+ }
407
+
204
408
  export interface InteractionCreatePayload
205
409
  extends Omit<
206
410
  Interaction,
@@ -218,6 +422,7 @@ export interface InteractionCreatePayload
218
422
  | "endpoint"
219
423
  > {
220
424
  visibility?: InteractionVisibility;
425
+ tags?: string[];
221
426
  }
222
427
 
223
428
  export interface InteractionUpdatePayload
@@ -271,6 +476,12 @@ export interface InteractionExecutionPayload {
271
476
  * The workflow related to this Interaction Run.
272
477
  */
273
478
  workflow?: ExecutionRunWorkflow;
479
+
480
+ /**
481
+ * Only used by ad-hoc interactions which defines the prompt in the execution payload itself
482
+ * These are temporary interactions using "tmp:" suffix.
483
+ */
484
+ prompts?: InCodePrompt[];
274
485
  }
275
486
 
276
487
  export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
@@ -298,11 +509,58 @@ interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayloa
298
509
 
299
510
  export type ConversationVisibility = 'private' | 'project';
300
511
 
512
+ /**
513
+ * Defines the scope for agent search operations.
514
+ */
515
+ export enum AgentSearchScope {
516
+ /**
517
+ * Search is scoped to a specific collection.
518
+ */
519
+ Collection = 'collection'
520
+ }
521
+
522
+ /**
523
+ * Configuration options for Agent Runner functionality.
524
+ * These options control how interactions are exposed and executed in the Agent Runner.
525
+ */
526
+ export interface AgentRunnerOptions {
527
+ /**
528
+ * Whether this interaction is an agent (executable in Agent Runner).
529
+ */
530
+ is_agent?: boolean;
531
+
532
+ /**
533
+ * Whether this interaction is available as a tool (sub-agent).
534
+ */
535
+ is_tool?: boolean;
536
+
537
+ /**
538
+ * Array of default tool names available to this agent.
539
+ * For interactions: defines default tools.
540
+ * For execution payloads: you can use + and - to add or remove from default,
541
+ * if no sign, then list replaces default.
542
+ */
543
+ tool_names?: string[];
544
+
545
+ /**
546
+ * On which scope should the search be applied by the search_tool.
547
+ * Only supports 'collection' scope or undefined for now.
548
+ */
549
+ search_scope?: AgentSearchScope;
550
+
551
+ /**
552
+ * The ID of the collection to restrict agent operations to.
553
+ * When specified, the agent's search and retrieval operations are limited to documents
554
+ * within this collection'.
555
+ */
556
+ collection_id?: string;
557
+ }
558
+
301
559
  export interface AsyncConversationExecutionPayload extends AsyncExecutionPayloadBase {
302
560
  type: "conversation";
303
561
 
304
- /**
305
- * Visibility determine if the conversation should be seen by the user only or by anyone with access to the project
562
+ /**
563
+ * Visibility determine if the conversation should be seen by the user only or by anyone with access to the project
306
564
  * If not specified, the default is project
307
565
  **/
308
566
  visibility?: ConversationVisibility;
@@ -332,7 +590,7 @@ export interface AsyncConversationExecutionPayload extends AsyncExecutionPayload
332
590
  * On which scope should the searched by applied, by the search_tool.
333
591
  * Only supports collection scope or null for now.
334
592
  */
335
- search_scope?: string;
593
+ search_scope?: AgentSearchScope.Collection;
336
594
 
337
595
  /**
338
596
  * The collection in which this workflow is executing
@@ -424,7 +682,7 @@ export interface RunSource {
424
682
  client_ip: string;
425
683
  }
426
684
 
427
- export interface ExecutionRun<P = any> {
685
+ export interface BaseExecutionRun<P = any> {
428
686
  readonly id: string;
429
687
  /**
430
688
  * Only used by runs that were created by a virtual run to point toward the virtual run parent
@@ -443,8 +701,12 @@ export interface ExecutionRun<P = any> {
443
701
  */
444
702
  parameters: P; //params used to create the interaction, only in varies on?
445
703
  tags?: string[];
446
- //TODO a string is returned when executing not the interaction object
447
- interaction: Interaction;
704
+ // only set when the target interaction is a stored interaction
705
+ //TODO check the code where Interaction type is used (should be in run details)
706
+ // TODO when execution string is passed as the type of interaction
707
+ interaction?: string | Interaction;
708
+ // only set when the target interaction is an in-code interaction
709
+ interaction_code?: string; // Interaction code name in case of in-code interaction (not stored in the DB as an Interaction document)
448
710
  //TODO a string is returned when execution not the env object
449
711
  environment: ExecutionEnvironmentRef;
450
712
  modelId: string;
@@ -477,6 +739,14 @@ export interface ExecutionRun<P = any> {
477
739
  workflow?: ExecutionRunWorkflow;
478
740
  }
479
741
 
742
+ export interface ExecutionRun<P = any> extends BaseExecutionRun<P> {
743
+ interaction?: Interaction;
744
+ }
745
+
746
+ export interface PopulatedExecutionRun<P = any> extends BaseExecutionRun<P> {
747
+ interaction?: Interaction;
748
+ }
749
+
480
750
  export interface ExecutionRunWorkflow {
481
751
  /**
482
752
  * The Temporal Workflow Run ID related to this Interaction Run.
@@ -510,7 +780,8 @@ export interface InteractionExecutionResult<P = any> extends ExecutionRun<P> {
510
780
  }
511
781
 
512
782
  export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
513
- interaction: InteractionRef;
783
+ interaction?: InteractionRef;
784
+ interaction_code?: string;
514
785
  }
515
786
 
516
787
  export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt";
@@ -553,10 +824,17 @@ export interface GenerateTestDataPayload {
553
824
  config: InteractionExecutionConfiguration;
554
825
  }
555
826
 
556
- export interface ImprovePromptPayload {
827
+ export interface ImprovePromptPayloadConfig {
557
828
  config: InteractionExecutionConfiguration;
558
829
  }
559
830
 
831
+ export interface ImprovePromptPayload extends ImprovePromptPayloadConfig {
832
+ interaction_name: string; // name of the interaction to improve
833
+ context?: string,
834
+ prompt: { name: string, content: string }[]; // prompt array
835
+ result_schema?: JSONSchema, // optional interactionr result schema
836
+ }
837
+
560
838
  export interface RateLimitRequestPayload {
561
839
  interaction: string,
562
840
  environment_id?: string,
package/src/project.ts CHANGED
@@ -69,6 +69,8 @@ export interface ProjectConfiguration {
69
69
  default_environment?: string;
70
70
  default_model?: string;
71
71
 
72
+ sync_content_properties?: boolean;
73
+
72
74
  embeddings: {
73
75
  text?: ProjectConfigurationEmbeddings;
74
76
  image?: ProjectConfigurationEmbeddings;
@@ -140,11 +142,11 @@ export const ProjectRefPopulate = "id name account";
140
142
 
141
143
  export interface EmbeddingsStatusResponse {
142
144
  status: string;
143
- embeddingRunsInProgress: number;
144
- totalRunsInProgress: number;
145
- totalIndexableObjects: number;
146
- embeddingsModels: string[];
147
- objectsWithEmbeddings: number;
145
+ embeddingRunsInProgress?: number;
146
+ totalRunsInProgress?: number;
147
+ totalIndexableObjects?: number;
148
+ embeddingsModels?: string[];
149
+ objectsWithEmbeddings?: number;
148
150
  vectorIndex: {
149
151
  status: "READY" | "PENDING" | "DELETING" | "ABSENT",
150
152
  name?: string,