@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,1182 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CompletionResult,
|
|
3
|
+
JSONObject,
|
|
4
|
+
JSONSchema,
|
|
5
|
+
Modalities,
|
|
6
|
+
ModelOptions,
|
|
7
|
+
PromptRole,
|
|
8
|
+
StatelessExecutionOptions,
|
|
9
|
+
ToolDefinition,
|
|
10
|
+
ToolUse,
|
|
11
|
+
} from "@llumiverse/common";
|
|
12
|
+
import type { JSONSchema4 } from "json-schema";
|
|
13
|
+
|
|
14
|
+
import { ExecutionTokenUsage } from "@llumiverse/common";
|
|
15
|
+
|
|
16
|
+
import { ExecutionEnvironmentRef } from "./environment.js";
|
|
17
|
+
import { ProjectRef } from "./project.js";
|
|
18
|
+
import {
|
|
19
|
+
ExecutablePromptSegmentDef,
|
|
20
|
+
PopulatedPromptSegmentDef,
|
|
21
|
+
PromptSegmentDef,
|
|
22
|
+
PromptTemplateRef,
|
|
23
|
+
PromptTemplateRefWithSchema,
|
|
24
|
+
TemplateType,
|
|
25
|
+
} from "./prompt.js";
|
|
26
|
+
import { ExecutionRunDocRef } from "./runs.js";
|
|
27
|
+
import { ConversationState } from "./store/conversation-state.js";
|
|
28
|
+
import { AccountRef } from "./user.js";
|
|
29
|
+
import { LlmCallType } from "./workflow-analytics.js";
|
|
30
|
+
|
|
31
|
+
export interface InteractionExecutionError {
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
data?: any;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Configuration for stripping large data from conversation history
|
|
39
|
+
* to prevent JSON serialization issues and reduce storage bloat.
|
|
40
|
+
*/
|
|
41
|
+
export interface ConversationStripOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Number of turns to keep images before stripping them.
|
|
44
|
+
* - 0: Strip images immediately after each turn (default)
|
|
45
|
+
* - N > 0: Keep images for N turns before stripping
|
|
46
|
+
* - Infinity: Never strip images
|
|
47
|
+
*/
|
|
48
|
+
images_after_turns?: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Maximum tokens for text content before truncation.
|
|
52
|
+
* Text content exceeding this limit will be truncated with a marker.
|
|
53
|
+
* Uses ~4 characters per token estimate.
|
|
54
|
+
*/
|
|
55
|
+
text_max_tokens?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// ------------------ in code interactions -----------------
|
|
60
|
+
/**
|
|
61
|
+
* Reference to an interaction in the catalog.
|
|
62
|
+
* Used in catalog listing. The id is composed of the namespace and the interaction name.
|
|
63
|
+
* Stored interactions can use `oid:` prefix.
|
|
64
|
+
* If no prefix is used it fallback on `oid:`.
|
|
65
|
+
*/
|
|
66
|
+
export interface CatalogInteractionRef {
|
|
67
|
+
/**
|
|
68
|
+
* The type of interaction
|
|
69
|
+
*/
|
|
70
|
+
type: "sys" | "app" | "stored" | "draft";
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* the interaction id that can be used to execute the interaction.
|
|
74
|
+
*/
|
|
75
|
+
id: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The interaction name which identify the interaction in the provider interaction list.
|
|
79
|
+
* For the stored interactions this is the same as the endpoint property.
|
|
80
|
+
* For other types of interactions this is the local name of the interaction.
|
|
81
|
+
*/
|
|
82
|
+
name: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Only applies for stored interactions. The version of the interaction.
|
|
86
|
+
* Undefined for non stored interactions
|
|
87
|
+
*/
|
|
88
|
+
version?: number;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Only applies for stored interactions. Whether the interaction is published or not.
|
|
92
|
+
*/
|
|
93
|
+
published?: boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The tags associated with the interaction.
|
|
97
|
+
*/
|
|
98
|
+
tags: string[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Agent Runner configuration options.
|
|
102
|
+
*/
|
|
103
|
+
agent_runner_options?: AgentRunnerOptions;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The name of the interaction. For display purposes only.
|
|
107
|
+
*/
|
|
108
|
+
title: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Optional description of the interaction.
|
|
112
|
+
*/
|
|
113
|
+
description?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface InCodePrompt {
|
|
117
|
+
role: PromptRole,
|
|
118
|
+
content: string,
|
|
119
|
+
content_type: TemplateType;
|
|
120
|
+
schema?: JSONSchema;
|
|
121
|
+
/**
|
|
122
|
+
* optional name of the prompt segment. Use kebab case for prompt names
|
|
123
|
+
*/
|
|
124
|
+
name?: string;
|
|
125
|
+
/**
|
|
126
|
+
* optional reference to an external resource if any.
|
|
127
|
+
* Used internally by the system to synchronize stored prompts with in-code prompts.
|
|
128
|
+
*/
|
|
129
|
+
externalId?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface InCodeInteraction {
|
|
132
|
+
/**
|
|
133
|
+
* The interaction type.
|
|
134
|
+
*/
|
|
135
|
+
type: "sys" | "app" | "stored" | "draft";
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The id of the interaction. Required.
|
|
139
|
+
* The id is a unique identifier for the interaction.
|
|
140
|
+
* It is recommended to use a URL safe string and not include spaces.
|
|
141
|
+
* The id composaed by some namespace or prefix and the interaction name.
|
|
142
|
+
* Example: sys:generic_question, app:review_contract, tmp:my_temp_interaction
|
|
143
|
+
*/
|
|
144
|
+
id: string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The interaction code name. Required.
|
|
148
|
+
* Should be a URL safe string and not include spaces. It is recommended to use kebab-case or camel-case.
|
|
149
|
+
* The endpoints must satisfy the following regexp: /^[a-zA-Z0-9-_]+$/. No whitespaces or special characters are allowed.
|
|
150
|
+
*/
|
|
151
|
+
name: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Only applies for stored interactions. The version of the interaction.
|
|
155
|
+
* Undefined for non stored interactions
|
|
156
|
+
*/
|
|
157
|
+
version?: number;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Only applies for stored interactions. Whether the interaction is published or not.
|
|
161
|
+
*/
|
|
162
|
+
published?: boolean;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* A title for the interaction. If not provided, the endpoint will be used.
|
|
166
|
+
*/
|
|
167
|
+
title?: string;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* An optional description of the interaction.
|
|
171
|
+
*/
|
|
172
|
+
description?: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The JSON schema to be used for the result if any.
|
|
176
|
+
*/
|
|
177
|
+
result_schema?: JSONSchema | SchemaRef;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The modality of the interaction output.
|
|
181
|
+
* If not specified Modalities.Text is assumed.
|
|
182
|
+
*/
|
|
183
|
+
output_modality?: Modalities,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* How to store the run data for executions of this interaction.
|
|
187
|
+
* Defaults to STANDARD.
|
|
188
|
+
*/
|
|
189
|
+
storage?: RunDataStorageLevel;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Optional tags for the interaction.
|
|
193
|
+
*/
|
|
194
|
+
tags?: string[];
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Agent Runner configuration options.
|
|
198
|
+
*/
|
|
199
|
+
agent_runner_options?: AgentRunnerOptions;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Default options for the model to be used when executing this interaction.
|
|
203
|
+
* (like temperature etc)
|
|
204
|
+
*/
|
|
205
|
+
model_options?: ModelOptions;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The prompts composing the interaction. Required.
|
|
209
|
+
*/
|
|
210
|
+
prompts: InCodePrompt[]
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Optional reference to an external resource if any.
|
|
214
|
+
* Used internally by the system to synchronize stored interactions with in-code interactions.
|
|
215
|
+
*/
|
|
216
|
+
externalId?: string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Runtime configuration (system use only)
|
|
220
|
+
*
|
|
221
|
+
* This field is populated by the system when converting stored interactions
|
|
222
|
+
* and contains runtime-specific defaults like target model/environment IDs.
|
|
223
|
+
*
|
|
224
|
+
* DO NOT set this field manually when writing interaction definitions.
|
|
225
|
+
* These values are environment-specific and not portable.
|
|
226
|
+
*
|
|
227
|
+
* @internal
|
|
228
|
+
*/
|
|
229
|
+
runtime?: {
|
|
230
|
+
/**
|
|
231
|
+
* Default target environment for the interaction execution
|
|
232
|
+
*/
|
|
233
|
+
environment?: string;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Default (recommended) target model for the interaction execution
|
|
237
|
+
*/
|
|
238
|
+
model?: string;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
export interface InteractionSpec extends Omit<InCodeInteraction, 'id' | 'runtime' | 'type' | 'published' | 'version'> {
|
|
242
|
+
}
|
|
243
|
+
// ---------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* The payload to query the interaction endpoints
|
|
247
|
+
*/
|
|
248
|
+
export interface InteractionEndpointQuery {
|
|
249
|
+
limit?: number;
|
|
250
|
+
offset?: number;
|
|
251
|
+
|
|
252
|
+
status?: InteractionStatus;
|
|
253
|
+
visibility?: InteractionVisibility;
|
|
254
|
+
version?: number;
|
|
255
|
+
tags?: string[];
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Filter by interaction endpoint name to include only the specified endpoints
|
|
259
|
+
* * If both includes and excludes are specified then only the includes filter will be used.
|
|
260
|
+
*/
|
|
261
|
+
includes?: string[];
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Filter by interaction endpoint name to excludes the specified endpoints.
|
|
265
|
+
* If both includes and excludes are specified then only the includes filter will be used.
|
|
266
|
+
*/
|
|
267
|
+
excludes?: string[];
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Whether or not to return the parameters schema.
|
|
271
|
+
* The parameters schema is an array of JSON schemas.
|
|
272
|
+
* Each schema is a JSON schema that describes the parameters of an interaction prompt.
|
|
273
|
+
*/
|
|
274
|
+
include_params_schema?: boolean;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Whether or not to return the result schema
|
|
278
|
+
*/
|
|
279
|
+
include_result_schema?: boolean;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* A description of an interaction endpoint.
|
|
284
|
+
*/
|
|
285
|
+
export interface InteractionEndpoint {
|
|
286
|
+
id: string;
|
|
287
|
+
name: string;
|
|
288
|
+
endpoint: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
status: InteractionStatus;
|
|
291
|
+
visibility?: InteractionVisibility;
|
|
292
|
+
version: number;
|
|
293
|
+
tags: string[];
|
|
294
|
+
agent_runner_options?: AgentRunnerOptions;
|
|
295
|
+
/**
|
|
296
|
+
* @deprecated This is deprecated. Use CompletionResult.type information instead.
|
|
297
|
+
*/
|
|
298
|
+
output_modality?: Modalities;
|
|
299
|
+
result_schema?: JSONSchema;
|
|
300
|
+
params_schema?: JSONSchema;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface InteractionTags {
|
|
304
|
+
tag: string;
|
|
305
|
+
count: number;
|
|
306
|
+
interactions: InteractionRef[];
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export interface InteractionRef {
|
|
310
|
+
id: string;
|
|
311
|
+
name: string;
|
|
312
|
+
endpoint: string;
|
|
313
|
+
parent?: string;
|
|
314
|
+
description?: string;
|
|
315
|
+
status: InteractionStatus;
|
|
316
|
+
visibility?: InteractionVisibility;
|
|
317
|
+
version: number;
|
|
318
|
+
tags: string[];
|
|
319
|
+
agent_runner_options?: AgentRunnerOptions;
|
|
320
|
+
prompts?: PromptSegmentDef<PromptTemplateRef>[];
|
|
321
|
+
updated_at: Date;
|
|
322
|
+
}
|
|
323
|
+
export const InteractionRefPopulate =
|
|
324
|
+
"id name endpoint parent description status version visibility tags agent_runner_options updated_at prompts";
|
|
325
|
+
|
|
326
|
+
export const InteractionRefWithSchemaPopulate =
|
|
327
|
+
`${InteractionRefPopulate} result_schema`;
|
|
328
|
+
|
|
329
|
+
export interface InteractionRefWithSchema extends Omit<InteractionRef, "prompts"> {
|
|
330
|
+
result_schema?: JSONSchema4;
|
|
331
|
+
prompts?: PromptSegmentDef<PromptTemplateRefWithSchema>[];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface InteractionsExportPayload {
|
|
335
|
+
/**
|
|
336
|
+
* The name of the interaction. If not specified all the interactions in the current project will be exported
|
|
337
|
+
*/
|
|
338
|
+
name?: string;
|
|
339
|
+
/*
|
|
340
|
+
* tags to filter the exported interactions
|
|
341
|
+
*/
|
|
342
|
+
tags?: string[];
|
|
343
|
+
/*
|
|
344
|
+
* if not specified, all versions will be exported
|
|
345
|
+
*/
|
|
346
|
+
versions?: (number | "draft" | "latest")[];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export enum InteractionStatus {
|
|
350
|
+
draft = "draft",
|
|
351
|
+
published = "published",
|
|
352
|
+
archived = "archived",
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export enum ExecutionRunStatus {
|
|
356
|
+
created = "created",
|
|
357
|
+
processing = "processing",
|
|
358
|
+
completed = "completed",
|
|
359
|
+
failed = "failed",
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export enum RunDataStorageLevel {
|
|
363
|
+
STANDARD = "STANDARD",
|
|
364
|
+
RESTRICTED = "RESTRICTED",
|
|
365
|
+
DEBUG = "DEBUG",
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export enum RunDataStorageDescription {
|
|
369
|
+
STANDARD = "Run data is stored for both the model inputs and output.",
|
|
370
|
+
RESTRICTED = "No run data is stored for the model inputs — only the model output.",
|
|
371
|
+
DEBUG = "Run data is stored for the model inputs and output, schema, and final prompt.",
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export const RunDataStorageOptions: Record<RunDataStorageLevel, RunDataStorageDescription> = {
|
|
375
|
+
[RunDataStorageLevel.STANDARD]: RunDataStorageDescription.STANDARD,
|
|
376
|
+
[RunDataStorageLevel.RESTRICTED]: RunDataStorageDescription.RESTRICTED,
|
|
377
|
+
[RunDataStorageLevel.DEBUG]: RunDataStorageDescription.DEBUG,
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Schema can be stored or specified as a reference to an external schema.
|
|
382
|
+
* We only support "store:" references for now
|
|
383
|
+
*/
|
|
384
|
+
export interface SchemaRef {
|
|
385
|
+
$uri: string;
|
|
386
|
+
}
|
|
387
|
+
export interface CachePolicy {
|
|
388
|
+
type: "cache" | "no_cache" | "cache_and_refresh";
|
|
389
|
+
refresh_probability: number;
|
|
390
|
+
varies_on: string[];
|
|
391
|
+
ttl: number;
|
|
392
|
+
}
|
|
393
|
+
export type InteractionVisibility = "public" | "private";
|
|
394
|
+
|
|
395
|
+
export interface InteractionData {
|
|
396
|
+
readonly id: string;
|
|
397
|
+
name: string;
|
|
398
|
+
endpoint: string;
|
|
399
|
+
description?: string;
|
|
400
|
+
project: string | ProjectRef;
|
|
401
|
+
tags: string[];
|
|
402
|
+
agent_runner_options?: AgentRunnerOptions;
|
|
403
|
+
result_schema?: JSONSchema4 | SchemaRef;
|
|
404
|
+
environment?: string | ExecutionEnvironmentRef;
|
|
405
|
+
model?: string;
|
|
406
|
+
model_options?: ModelOptions;
|
|
407
|
+
restriction?: RunDataStorageLevel;
|
|
408
|
+
/**
|
|
409
|
+
* @deprecated This is deprecated. Use CompletionResult.type information instead.
|
|
410
|
+
*/
|
|
411
|
+
output_modality?: Modalities;
|
|
412
|
+
}
|
|
413
|
+
export interface Interaction extends InteractionData {
|
|
414
|
+
status: InteractionStatus;
|
|
415
|
+
parent?: string;
|
|
416
|
+
// only used for versions (status === "published")
|
|
417
|
+
visibility: InteractionVisibility;
|
|
418
|
+
version: number;
|
|
419
|
+
test_data?: JSONObject;
|
|
420
|
+
interaction_schema?: JSONSchema4 | SchemaRef;
|
|
421
|
+
cache_policy?: CachePolicy;
|
|
422
|
+
prompts: PromptSegmentDef[];
|
|
423
|
+
// only for drafts - when it was last published
|
|
424
|
+
last_published_at?: Date;
|
|
425
|
+
created_by: string;
|
|
426
|
+
updated_by: string;
|
|
427
|
+
created_at: Date;
|
|
428
|
+
updated_at: Date;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
|
|
432
|
+
prompts: PopulatedPromptSegmentDef[];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Used to describe an interaction that can be executed. Contains only the interaction data useful
|
|
437
|
+
* to execute the interaction plus the prompt templates
|
|
438
|
+
*/
|
|
439
|
+
export interface ExecutableInteraction extends InteractionData {
|
|
440
|
+
prompts: ExecutablePromptSegmentDef[];
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface InteractionCreatePayload
|
|
444
|
+
extends Omit<
|
|
445
|
+
Interaction,
|
|
446
|
+
| "id"
|
|
447
|
+
| "created_at"
|
|
448
|
+
| "updated_at"
|
|
449
|
+
| "created_by"
|
|
450
|
+
| "updated_by"
|
|
451
|
+
| "project"
|
|
452
|
+
| "formatter"
|
|
453
|
+
| "tags"
|
|
454
|
+
| "parent"
|
|
455
|
+
| "version"
|
|
456
|
+
| "visibility"
|
|
457
|
+
| "endpoint"
|
|
458
|
+
> {
|
|
459
|
+
visibility?: InteractionVisibility;
|
|
460
|
+
tags?: string[];
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export interface InteractionUpdatePayload
|
|
464
|
+
extends Partial<
|
|
465
|
+
Omit<
|
|
466
|
+
Interaction,
|
|
467
|
+
"result_schema" | "id" | "created_at" | "updated_at" | "created_by" | "updated_by" | "project"
|
|
468
|
+
>
|
|
469
|
+
> {
|
|
470
|
+
result_schema?: JSONSchema4 | null;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export interface InteractionPublishPayload {
|
|
474
|
+
visibility?: InteractionVisibility;
|
|
475
|
+
tags?: string[];
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface InteractionForkPayload {
|
|
479
|
+
keepTags?: boolean;
|
|
480
|
+
forkPrompts?: boolean;
|
|
481
|
+
targetProject?: string;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface InteractionExecutionPayload {
|
|
485
|
+
/**
|
|
486
|
+
* If a `@memory` property exists on the input data then the value will be used as the value of a memory pack location.
|
|
487
|
+
* and the other properties of the data will contain the memory pack mapping.
|
|
488
|
+
*/
|
|
489
|
+
data?: Record<string, any> | `memory:${string}`;
|
|
490
|
+
config?: InteractionExecutionConfiguration;
|
|
491
|
+
//Use null to explicitly state no schema, will not fallback to interaction schema
|
|
492
|
+
result_schema?: JSONSchema4 | null;
|
|
493
|
+
stream?: boolean;
|
|
494
|
+
do_validate?: boolean;
|
|
495
|
+
tags?: string | string[]; // tags to be added to the execution run
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* The conversation state to be used in the execution if any.
|
|
499
|
+
* If the `true` is passed then the conversation will be returned in the result.
|
|
500
|
+
* The true value must be used for the first execution that starts the conversation.
|
|
501
|
+
* If conversation is falsy then no conversation is returned back.
|
|
502
|
+
* For regular executions the conversation is not returned back to save memory.
|
|
503
|
+
*/
|
|
504
|
+
conversation?: true | unknown;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* The tools to be used in the execution
|
|
508
|
+
*/
|
|
509
|
+
tool_definitions?: ToolDefinition[];
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* The workflow related to this Interaction Run.
|
|
513
|
+
*/
|
|
514
|
+
workflow?: ExecutionRunWorkflow;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Only used by ad-hoc interactions which defines the prompt in the execution payload itself
|
|
518
|
+
* These are temporary interactions using "tmp:" suffix.
|
|
519
|
+
*/
|
|
520
|
+
prompts?: InCodePrompt[];
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Options for async completion and/or streaming LLM response chunks to Redis.
|
|
524
|
+
* Used by agent workflows for async activity completion and real-time streaming.
|
|
525
|
+
*/
|
|
526
|
+
asyncCompletion?: AsyncCompletionOptions;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
|
|
530
|
+
/**
|
|
531
|
+
* The interaction name and suffixed by an optional tag or version separated from the name using a @ character
|
|
532
|
+
* If no version/tag part is specified then the latest version is used.
|
|
533
|
+
* Example: ReviewContract, ReviewContract@draft, ReviewContract@1, ReviewContract@some-tag
|
|
534
|
+
*/
|
|
535
|
+
interaction: string;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// ================= async execution payloads ====================
|
|
539
|
+
export type ToolRef = string | { name: string; description: string };
|
|
540
|
+
|
|
541
|
+
interface AsyncExecutionPayloadBase extends Omit<NamedInteractionExecutionPayload, "toolDefinitions" | "stream"> {
|
|
542
|
+
type: "conversation" | "interaction";
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* An array of endpoint URLs to be notified upon execution
|
|
546
|
+
*/
|
|
547
|
+
notify_endpoints?: string[];
|
|
548
|
+
|
|
549
|
+
task_queue?: string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export type ConversationVisibility = 'private' | 'project';
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Defines the scope for agent search operations.
|
|
556
|
+
*/
|
|
557
|
+
export enum AgentSearchScope {
|
|
558
|
+
/**
|
|
559
|
+
* Search is scoped to a specific collection.
|
|
560
|
+
*/
|
|
561
|
+
Collection = 'collection'
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Context triggers for auto-injection of skills.
|
|
566
|
+
* When these conditions match, the skill is automatically injected into the agent context.
|
|
567
|
+
*/
|
|
568
|
+
export interface SkillContextTriggers {
|
|
569
|
+
/**
|
|
570
|
+
* Keywords in user input that should trigger this skill
|
|
571
|
+
*/
|
|
572
|
+
keywords?: string[];
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* If these tools are being used, suggest this skill
|
|
576
|
+
*/
|
|
577
|
+
tool_names?: string[];
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Regex patterns to match against input data
|
|
581
|
+
*/
|
|
582
|
+
data_patterns?: string[];
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Configuration options for Agent Runner functionality.
|
|
587
|
+
* These options control how interactions are exposed and executed in the Agent Runner.
|
|
588
|
+
*/
|
|
589
|
+
export interface AgentRunnerOptions {
|
|
590
|
+
/**
|
|
591
|
+
* Whether this interaction is an agent (executable in Agent Runner).
|
|
592
|
+
*/
|
|
593
|
+
is_agent?: boolean;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Whether this interaction is available as a tool (sub-agent).
|
|
597
|
+
*/
|
|
598
|
+
is_tool?: boolean;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Whether this interaction is a skill (provides instructions without execution).
|
|
602
|
+
* Skills are injected into the agent's context based on context_triggers.
|
|
603
|
+
*/
|
|
604
|
+
is_skill?: boolean;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Context triggers for auto-injection of this skill.
|
|
608
|
+
* Only used when is_skill is true.
|
|
609
|
+
*/
|
|
610
|
+
context_triggers?: SkillContextTriggers;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Injection priority for skills (higher = more likely to be selected when multiple match).
|
|
614
|
+
* Only used when is_skill is true.
|
|
615
|
+
*/
|
|
616
|
+
skill_priority?: number;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Array of default tool names available to this agent.
|
|
620
|
+
* For interactions: defines default tools.
|
|
621
|
+
* For execution payloads: you can use + and - to add or remove from default,
|
|
622
|
+
* if no sign, then list replaces default.
|
|
623
|
+
*/
|
|
624
|
+
tool_names?: string[];
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* On which scope should the search be applied by the search_tool.
|
|
628
|
+
* Only supports 'collection' scope or undefined for now.
|
|
629
|
+
*/
|
|
630
|
+
search_scope?: AgentSearchScope;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* The ID of the collection to restrict agent operations to.
|
|
634
|
+
* When specified, the agent's search and retrieval operations are limited to documents
|
|
635
|
+
* within this collection'.
|
|
636
|
+
*/
|
|
637
|
+
collection_id?: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// ================= User Communication Channels ====================
|
|
641
|
+
// Import for local use
|
|
642
|
+
import type { UserChannel } from "./email.js";
|
|
643
|
+
// Re-exported from email.ts for backwards compatibility
|
|
644
|
+
export type {
|
|
645
|
+
EmailChannel,
|
|
646
|
+
InteractiveChannel,
|
|
647
|
+
UserChannel,
|
|
648
|
+
EmailRouteData,
|
|
649
|
+
} from "./email.js";
|
|
650
|
+
export {
|
|
651
|
+
isEmailChannel,
|
|
652
|
+
isInteractiveChannel,
|
|
653
|
+
} from "./email.js";
|
|
654
|
+
// ================= end user communication channels ====================
|
|
655
|
+
|
|
656
|
+
export interface AsyncConversationExecutionPayload extends AsyncExecutionPayloadBase {
|
|
657
|
+
type: "conversation";
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Visibility determine if the conversation should be seen by the user only or by anyone with access to the project
|
|
661
|
+
* If not specified, the default is project
|
|
662
|
+
**/
|
|
663
|
+
visibility?: ConversationVisibility;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* The tools to use, list of tool or function names.
|
|
667
|
+
* You can use + and - to add or remove from default, if no sign, then list replaces default
|
|
668
|
+
*/
|
|
669
|
+
tool_names?: string[];
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* The maximum number of iterations in case of a conversation. If <=0 the default of 20 will be used.
|
|
673
|
+
*/
|
|
674
|
+
max_iterations?: number;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Whether the conversation should be interactive or not
|
|
678
|
+
*/
|
|
679
|
+
interactive?: boolean;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Array of channels to use for user communication.
|
|
683
|
+
* Multiple channels can be active simultaneously (e.g., both email and interactive).
|
|
684
|
+
* Each channel contains its own configuration and state (e.g., email threading info).
|
|
685
|
+
*/
|
|
686
|
+
user_channels?: UserChannel[];
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Whether to disable the generation of interaction tools or not.
|
|
690
|
+
*/
|
|
691
|
+
disable_interaction_tools?: boolean;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* On which scope should the searched by applied, by the search_tool.
|
|
695
|
+
* Only supports collection scope or null for now.
|
|
696
|
+
*/
|
|
697
|
+
search_scope?: AgentSearchScope.Collection;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* The collection in which this workflow is executing
|
|
701
|
+
*/
|
|
702
|
+
collection_id?: string;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* The token threshold in thousands (K) for creating checkpoints.
|
|
706
|
+
* If total tokens exceed this value, a checkpoint will be created.
|
|
707
|
+
* If not specified, default value of 150K tokens will be used.
|
|
708
|
+
*/
|
|
709
|
+
checkpoint_tokens?: number;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Configuration for stripping large data (images, text) from conversation history
|
|
713
|
+
* to prevent JSON serialization issues and reduce storage bloat.
|
|
714
|
+
*/
|
|
715
|
+
strip_options?: ConversationStripOptions;
|
|
716
|
+
|
|
717
|
+
/** In child execution workflow, this is the curent task_id */
|
|
718
|
+
task_id?: string;
|
|
719
|
+
|
|
720
|
+
/** Whether to enable debug mode */
|
|
721
|
+
debug_mode?: boolean;
|
|
722
|
+
|
|
723
|
+
/** Maximum depth for nested conversations to prevent infinite recursion (default: 5) */
|
|
724
|
+
max_nested_conversation_depth?: number;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Metadata inherited from parent workflow.
|
|
728
|
+
* Used to propagate context (e.g., apiKey, session info) to child workflows/workstreams.
|
|
729
|
+
* When a workstream is spawned, the parent's `data` is preserved here so that
|
|
730
|
+
* child tools can access it via metadata.parent_metadata.
|
|
731
|
+
*/
|
|
732
|
+
parent_metadata?: Record<string, any>;
|
|
733
|
+
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
export interface AsyncInteractionExecutionPayload extends AsyncExecutionPayloadBase {
|
|
737
|
+
type: "interaction";
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Only used for non conversation workflows to include the error on next retry.
|
|
741
|
+
* If tools is defined this is not used
|
|
742
|
+
*/
|
|
743
|
+
include_previous_error?: boolean;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export type AsyncExecutionPayload = AsyncConversationExecutionPayload | AsyncInteractionExecutionPayload;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Telemetry context for streaming mode.
|
|
750
|
+
* Contains info not available in current_state needed to send LlmCallEvent.
|
|
751
|
+
*/
|
|
752
|
+
export interface StreamingTelemetryContext {
|
|
753
|
+
/** Workflow ID for ingestEvents API call */
|
|
754
|
+
workflowId: string;
|
|
755
|
+
/** Type of LLM call: start, resume after user message, or resume after tool results */
|
|
756
|
+
callType: LlmCallType;
|
|
757
|
+
/** Activity retry attempt number */
|
|
758
|
+
attemptNumber?: number;
|
|
759
|
+
/** Timestamp when inference started (for duration calculation) */
|
|
760
|
+
inferenceStartTime: number;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Options for storing inference results to cloud storage
|
|
765
|
+
*/
|
|
766
|
+
export interface ResultStorageOptions {
|
|
767
|
+
/** Full storage path for the result (e.g., "pages/doc123/page-1.md") */
|
|
768
|
+
path: string;
|
|
769
|
+
// Note: content_type is inferred from execution context:
|
|
770
|
+
// - If result_schema → application/json
|
|
771
|
+
// - Otherwise → text/markdown or text/plain
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Streaming-specific options (only needed when stream=true)
|
|
776
|
+
*/
|
|
777
|
+
export interface StreamingOptions {
|
|
778
|
+
/** Redis channel to publish streaming chunks to */
|
|
779
|
+
redis_channel: string;
|
|
780
|
+
/** Optional workstream ID for multi-workstream agents */
|
|
781
|
+
workstream_id?: string;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Options for async completion and/or streaming LLM responses
|
|
786
|
+
*/
|
|
787
|
+
export interface AsyncCompletionOptions {
|
|
788
|
+
/** Workflow run ID for message context */
|
|
789
|
+
run_id: string;
|
|
790
|
+
/** Whether to stream chunks to Redis */
|
|
791
|
+
stream?: boolean;
|
|
792
|
+
/** Streaming-specific options (required if stream=true) */
|
|
793
|
+
streaming?: StreamingOptions;
|
|
794
|
+
/**
|
|
795
|
+
* Temporal task token for async activity completion (base64url encoded).
|
|
796
|
+
* When provided, Studio will complete the activity after execution finishes,
|
|
797
|
+
* allowing the worker to release the activity slot immediately.
|
|
798
|
+
*/
|
|
799
|
+
task_token?: string;
|
|
800
|
+
/**
|
|
801
|
+
* Activity ID for idempotency metadata when storing conversation.
|
|
802
|
+
* Required when task_token is provided.
|
|
803
|
+
*/
|
|
804
|
+
activity_id?: string;
|
|
805
|
+
/**
|
|
806
|
+
* Current conversation state to merge with execution result.
|
|
807
|
+
* Studio will store the conversation and complete the activity with merged state.
|
|
808
|
+
* Required when task_token is provided.
|
|
809
|
+
*/
|
|
810
|
+
current_state?: ConversationState;
|
|
811
|
+
/**
|
|
812
|
+
* Interval in milliseconds for sending heartbeats to Temporal during streaming.
|
|
813
|
+
* When provided, Studio will send periodic heartbeats to keep the activity alive.
|
|
814
|
+
* Recommended: 10000 (10 seconds). Activity heartbeat timeout should be ~3x this value.
|
|
815
|
+
*/
|
|
816
|
+
heartbeat_interval_ms?: number;
|
|
817
|
+
/**
|
|
818
|
+
* Telemetry context for sending LlmCallEvent after streaming completes.
|
|
819
|
+
* Studio will use this to send token usage telemetry since the activity
|
|
820
|
+
* exits before the response is available in async completion mode.
|
|
821
|
+
*/
|
|
822
|
+
telemetry?: StreamingTelemetryContext;
|
|
823
|
+
/**
|
|
824
|
+
* Storage options for inference result.
|
|
825
|
+
* When provided, Studio will store the result to the specified path
|
|
826
|
+
* after inference completes (before completing the Temporal activity).
|
|
827
|
+
*/
|
|
828
|
+
result_storage?: ResultStorageOptions;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
interface ResumeConversationPayload {
|
|
832
|
+
run: ExecutionRunDocRef; // the run created by the first execution.
|
|
833
|
+
environment: string; // the environment ID
|
|
834
|
+
options: StatelessExecutionOptions; // the options used on the first execution
|
|
835
|
+
conversation: unknown; // the conversation state
|
|
836
|
+
tools: ToolDefinition[]; // the tools to be used
|
|
837
|
+
/** Configuration for stripping large data from conversation history */
|
|
838
|
+
strip_options?: ConversationStripOptions;
|
|
839
|
+
/** Options for async completion and/or streaming LLM response chunks to Redis */
|
|
840
|
+
asyncCompletion?: AsyncCompletionOptions;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
export interface ToolResultContent {
|
|
845
|
+
content: string;
|
|
846
|
+
is_error: boolean;
|
|
847
|
+
files?: string[];
|
|
848
|
+
/**
|
|
849
|
+
* Can contain metadata returned by the tool executor.
|
|
850
|
+
*/
|
|
851
|
+
meta?: Record<string, any>;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
export interface ToolResult extends ToolResultContent {
|
|
855
|
+
tool_use_id: string;
|
|
856
|
+
/**
|
|
857
|
+
* Gemini thinking models require thought_signature to be passed back with tool results.
|
|
858
|
+
* Copy this from the ToolUse.thought_signature that requested this tool call.
|
|
859
|
+
*/
|
|
860
|
+
thought_signature?: string;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* The payload to sent the tool responses back to the target LLM
|
|
865
|
+
*/
|
|
866
|
+
export interface ToolResultsPayload extends ResumeConversationPayload {
|
|
867
|
+
results: ToolResult[];
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
export interface UserMessagePayload extends ResumeConversationPayload {
|
|
871
|
+
message: string;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results" | "tools">
|
|
875
|
+
|
|
876
|
+
// ================= end async execution payloads ====================
|
|
877
|
+
|
|
878
|
+
export enum RunSourceTypes {
|
|
879
|
+
api = "api",
|
|
880
|
+
cli = "cli",
|
|
881
|
+
ui = "ui",
|
|
882
|
+
webhook = "webhook",
|
|
883
|
+
test = "test-data",
|
|
884
|
+
system = "system",
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
export interface RunSource {
|
|
888
|
+
type: RunSourceTypes;
|
|
889
|
+
label: string;
|
|
890
|
+
principal_type: "user" | "apikey";
|
|
891
|
+
principal_id: string;
|
|
892
|
+
client_ip: string;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
export interface BaseExecutionRun<P = any> {
|
|
896
|
+
readonly id: string;
|
|
897
|
+
/**
|
|
898
|
+
* Only used by runs that were created by a virtual run to point toward the virtual run parent
|
|
899
|
+
*/
|
|
900
|
+
parent?: string | ExecutionRun;
|
|
901
|
+
evaluation?: {
|
|
902
|
+
score?: number;
|
|
903
|
+
selected?: boolean;
|
|
904
|
+
scores?: Record<string, number>;
|
|
905
|
+
};
|
|
906
|
+
result: CompletionResult[] // Any new result will actually be CompletionResult[], the old typing is R, and R used to default to any.
|
|
907
|
+
/**
|
|
908
|
+
* The parameters used to create the interaction.
|
|
909
|
+
* If the parameters contains the special property "@memory" it will be used
|
|
910
|
+
* to locate a memory pack and the other properties will be used as the memory pack mapping.
|
|
911
|
+
*/
|
|
912
|
+
parameters: P; //params used to create the interaction, only in varies on?
|
|
913
|
+
tags?: string[];
|
|
914
|
+
// only set when the target interaction is a stored interaction
|
|
915
|
+
//TODO check the code where Interaction type is used (should be in run details)
|
|
916
|
+
// TODO when execution string is passed as the type of interaction
|
|
917
|
+
interaction?: string | Interaction;
|
|
918
|
+
// only set when the target interaction is an in-code interaction
|
|
919
|
+
interaction_code?: string; // Interaction code name in case of in-code interaction (not stored in the DB as an Interaction document)
|
|
920
|
+
/** Environment reference - populated with full object in API responses */
|
|
921
|
+
environment: ExecutionEnvironmentRef;
|
|
922
|
+
modelId: string;
|
|
923
|
+
result_schema: JSONSchema4;
|
|
924
|
+
ttl: number;
|
|
925
|
+
status: ExecutionRunStatus;
|
|
926
|
+
finish_reason?: string;
|
|
927
|
+
prompt: any;
|
|
928
|
+
token_use?: ExecutionTokenUsage;
|
|
929
|
+
chunks?: number;
|
|
930
|
+
execution_time?: number; // ms
|
|
931
|
+
created_at: Date;
|
|
932
|
+
updated_at: Date;
|
|
933
|
+
account: AccountRef;
|
|
934
|
+
project: ProjectRef;
|
|
935
|
+
config: InteractionExecutionConfiguration;
|
|
936
|
+
error?: InteractionExecutionError;
|
|
937
|
+
source: RunSource;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* @deprecated This is deprecated. Use CompletionResult.type information instead.
|
|
941
|
+
*/
|
|
942
|
+
output_modality?: Modalities;
|
|
943
|
+
created_by: string;
|
|
944
|
+
updated_by: string;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* The Vertesia Workflow related to this Interaction Run.
|
|
948
|
+
*
|
|
949
|
+
* This is only set when the interaction is executed as part of a workflow.
|
|
950
|
+
*
|
|
951
|
+
* @since 0.60.0
|
|
952
|
+
*/
|
|
953
|
+
workflow?: ExecutionRunWorkflow;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
export interface ExecutionRun<P = any> extends BaseExecutionRun<P> {
|
|
957
|
+
interaction?: Interaction;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export interface PopulatedExecutionRun<P = any> extends BaseExecutionRun<P> {
|
|
961
|
+
interaction?: Interaction;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
export interface ExecutionRunWorkflow {
|
|
965
|
+
/**
|
|
966
|
+
* The Temporal Workflow Run ID related to this Interaction Run.
|
|
967
|
+
*
|
|
968
|
+
* A Run ID is a globally unique, platform-level identifier for a Workflow Execution.
|
|
969
|
+
*
|
|
970
|
+
* @example 01970d37-a890-70c0-9f44-1256d063e69a
|
|
971
|
+
* @see https://docs.temporal.io/workflow-execution/workflowid-runid
|
|
972
|
+
*/
|
|
973
|
+
run_id: string;
|
|
974
|
+
/**
|
|
975
|
+
* The Temporal Workflow ID related to this Interaction Run.
|
|
976
|
+
*
|
|
977
|
+
* @example Standard Document Intake:6834841e4f828d4e36192796
|
|
978
|
+
* @see https://docs.temporal.io/workflow-execution/workflowid-runid
|
|
979
|
+
*/
|
|
980
|
+
workflow_id: string;
|
|
981
|
+
/**
|
|
982
|
+
* The Temporal Activity Type used for executing this Interaction. Undefined if the interaction
|
|
983
|
+
* was not executed as part of a workflow (such as Agent Runner).
|
|
984
|
+
*
|
|
985
|
+
* @example generateDocumentProperties
|
|
986
|
+
*/
|
|
987
|
+
activity_type?: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
export interface PromptModalities {
|
|
991
|
+
hasVideo: boolean;
|
|
992
|
+
hasImage: boolean;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
export interface InteractionExecutionResult<P = any> extends ExecutionRun<P> {
|
|
996
|
+
tool_use?: ToolUse[];
|
|
997
|
+
conversation?: unknown;
|
|
998
|
+
options?: StatelessExecutionOptions;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
|
|
1002
|
+
interaction?: InteractionRef;
|
|
1003
|
+
interaction_code?: string;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt";
|
|
1007
|
+
|
|
1008
|
+
export enum ConfigModes {
|
|
1009
|
+
RUN_AND_INTERACTION_CONFIG = "RUN_AND_INTERACTION_CONFIG",
|
|
1010
|
+
RUN_CONFIG_ONLY = "RUN_CONFIG_ONLY",
|
|
1011
|
+
INTERACTION_CONFIG_ONLY = "INTERACTION_CONFIG_ONLY",
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
export enum ConfigModesDescription {
|
|
1015
|
+
RUN_AND_INTERACTION_CONFIG = "This run configuration is used. Undefined options are filled with interaction configuration.",
|
|
1016
|
+
RUN_CONFIG_ONLY = "Only this run configuration is used. Undefined options remain undefined.",
|
|
1017
|
+
INTERACTION_CONFIG_ONLY = "Only interaction configuration is used.",
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
export const ConfigModesOptions: Record<ConfigModes, ConfigModesDescription> = {
|
|
1021
|
+
[ConfigModes.RUN_AND_INTERACTION_CONFIG]: ConfigModesDescription.RUN_AND_INTERACTION_CONFIG,
|
|
1022
|
+
[ConfigModes.RUN_CONFIG_ONLY]: ConfigModesDescription.RUN_CONFIG_ONLY,
|
|
1023
|
+
[ConfigModes.INTERACTION_CONFIG_ONLY]: ConfigModesDescription.INTERACTION_CONFIG_ONLY,
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
export interface InteractionExecutionConfiguration {
|
|
1027
|
+
environment?: string;
|
|
1028
|
+
model?: string;
|
|
1029
|
+
do_validate?: boolean;
|
|
1030
|
+
run_data?: RunDataStorageLevel;
|
|
1031
|
+
configMode?: ConfigModes;
|
|
1032
|
+
model_options?: ModelOptions;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export interface GenerateInteractionPayload {
|
|
1036
|
+
description: string;
|
|
1037
|
+
config: InteractionExecutionConfiguration;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export interface GenerateTestDataPayload {
|
|
1041
|
+
message?: string;
|
|
1042
|
+
count?: number;
|
|
1043
|
+
config: InteractionExecutionConfiguration;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export interface ImprovePromptPayloadConfig {
|
|
1047
|
+
config: InteractionExecutionConfiguration;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
export interface ImprovePromptPayload extends ImprovePromptPayloadConfig {
|
|
1051
|
+
interaction_name: string; // name of the interaction to improve
|
|
1052
|
+
context?: string,
|
|
1053
|
+
prompt: { name: string, content: string }[]; // prompt array
|
|
1054
|
+
result_schema?: JSONSchema, // optional interactionr result schema
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
export interface RateLimitRequestPayload {
|
|
1058
|
+
interaction: string,
|
|
1059
|
+
environment_id?: string,
|
|
1060
|
+
model_id?: string,
|
|
1061
|
+
workflow_run_id?: string,
|
|
1062
|
+
modalities?: PromptModalities;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
export interface RateLimitRequestResponse {
|
|
1066
|
+
delay_ms: number;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Source of the resolved model configuration
|
|
1071
|
+
*/
|
|
1072
|
+
export enum ModelSource {
|
|
1073
|
+
/** Model was explicitly provided in the execution config */
|
|
1074
|
+
config = "config",
|
|
1075
|
+
/** Model comes from the interaction definition */
|
|
1076
|
+
interaction = "interaction",
|
|
1077
|
+
/** Model comes from environment's default_model */
|
|
1078
|
+
environmentDefault = "environmentDefault",
|
|
1079
|
+
/** Model comes from project system interaction defaults */
|
|
1080
|
+
projectSystemDefault = "projectSystemDefault",
|
|
1081
|
+
/** Model comes from project base defaults */
|
|
1082
|
+
projectBaseDefault = "projectBaseDefault",
|
|
1083
|
+
/** Model comes from project modality-specific defaults */
|
|
1084
|
+
projectModalityDefault = "projectModalityDefault",
|
|
1085
|
+
/** Model comes from legacy project defaults */
|
|
1086
|
+
projectLegacyDefault = "projectLegacyDefault",
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Resolved environment information
|
|
1091
|
+
*/
|
|
1092
|
+
export interface ResolvedEnvironmentInfo {
|
|
1093
|
+
id: string;
|
|
1094
|
+
name: string;
|
|
1095
|
+
provider: string;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Resolved runtime configuration for an interaction
|
|
1100
|
+
*/
|
|
1101
|
+
export interface ResolvedRuntimeConfig {
|
|
1102
|
+
environment: ResolvedEnvironmentInfo;
|
|
1103
|
+
model?: string;
|
|
1104
|
+
model_source: ModelSource;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Resolved execution info for an interaction.
|
|
1109
|
+
* Contains the interaction ID, basic metadata, and the resolved runtime configuration
|
|
1110
|
+
* (environment, model) that would be used at execution time.
|
|
1111
|
+
*/
|
|
1112
|
+
export interface ResolvedInteractionExecutionInfo {
|
|
1113
|
+
/**
|
|
1114
|
+
* The resolved interaction ID
|
|
1115
|
+
*/
|
|
1116
|
+
id: string;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* The interaction endpoint name
|
|
1120
|
+
*/
|
|
1121
|
+
name: string;
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* The interaction version number
|
|
1125
|
+
*/
|
|
1126
|
+
version: number;
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* The interaction status (draft or published)
|
|
1130
|
+
*/
|
|
1131
|
+
status: InteractionStatus;
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* The interaction tags (can include version tags like "production", "staging")
|
|
1135
|
+
*/
|
|
1136
|
+
tags: string[];
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* The resolved runtime configuration
|
|
1140
|
+
*/
|
|
1141
|
+
resolved: ResolvedRuntimeConfig;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* A builtin tool definition from the tools catalog
|
|
1146
|
+
*/
|
|
1147
|
+
export interface BuiltinToolDefinition {
|
|
1148
|
+
/**
|
|
1149
|
+
* The unique tool name
|
|
1150
|
+
*/
|
|
1151
|
+
name: string;
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Human-readable description of what the tool does
|
|
1155
|
+
*/
|
|
1156
|
+
description: string;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* JSON schema for the tool's parameters
|
|
1160
|
+
*/
|
|
1161
|
+
params: JSONSchema;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Response from the builtin tools catalog endpoint
|
|
1166
|
+
*/
|
|
1167
|
+
export interface BuiltinToolsCatalogResponse {
|
|
1168
|
+
/**
|
|
1169
|
+
* List of available builtin tools
|
|
1170
|
+
*/
|
|
1171
|
+
tools: BuiltinToolDefinition[];
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* When the catalog was generated
|
|
1175
|
+
*/
|
|
1176
|
+
generated_at: string;
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Total number of tools in the catalog
|
|
1180
|
+
*/
|
|
1181
|
+
total_tools: number;
|
|
1182
|
+
}
|