@relayfx/sdk 0.0.6 → 0.0.8
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/dist/index.js +8850 -4110
- package/dist/migrations/20260705003847_nervous_banshee/migration.sql +11 -0
- package/dist/migrations/20260705003847_nervous_banshee/snapshot.json +2954 -0
- package/dist/migrations/20260705012626_common_stryfe/migration.sql +31 -0
- package/dist/migrations/20260705012626_common_stryfe/snapshot.json +3378 -0
- package/dist/migrations/20260705015420_sweet_captain_marvel/migration.sql +10 -0
- package/dist/migrations/20260705015420_sweet_captain_marvel/snapshot.json +3485 -0
- package/dist/migrations/20260705023041_chunky_scalphunter/migration.sql +22 -0
- package/dist/migrations/20260705023041_chunky_scalphunter/snapshot.json +3753 -0
- package/dist/migrations/20260705030344_short_patriot/migration.sql +11 -0
- package/dist/migrations/20260705030344_short_patriot/snapshot.json +3873 -0
- package/dist/migrations/20260705045546_heavy_ben_grimm/migration.sql +30 -0
- package/dist/migrations/20260705045546_heavy_ben_grimm/snapshot.json +4193 -0
- package/dist/migrations/20260706185931_regular_shadow_king/migration.sql +166 -0
- package/dist/migrations/20260706185931_regular_shadow_king/snapshot.json +4844 -0
- package/dist/types/ai/embedding-model/embedding-model-registration.d.ts +45 -0
- package/dist/types/ai/index.d.ts +1 -0
- package/dist/types/relay/client.d.ts +20 -4
- package/dist/types/relay/index.d.ts +3 -3
- package/dist/types/relay/operation.d.ts +242 -1
- package/dist/types/runtime/address/address-resolution-service.d.ts +15 -0
- package/dist/types/runtime/agent/agent-loop-service.d.ts +39 -10
- package/dist/types/runtime/agent/relay-approvals.d.ts +15 -3
- package/dist/types/runtime/agent/relay-compaction.d.ts +22 -0
- package/dist/types/runtime/agent/relay-instructions.d.ts +22 -0
- package/dist/types/runtime/agent/relay-permissions.d.ts +25 -0
- package/dist/types/runtime/agent/relay-steering.d.ts +17 -0
- package/dist/types/runtime/agent/relay-tool-executor.d.ts +3 -0
- package/dist/types/runtime/agent/relay-tool-output.d.ts +7 -0
- package/dist/types/runtime/child/spawn-child-run-tool.d.ts +209 -0
- package/dist/types/runtime/cluster/execution-entity.d.ts +101 -2
- package/dist/types/runtime/execution/event-log-service.d.ts +6 -0
- package/dist/types/runtime/execution/execution-service.d.ts +1 -0
- package/dist/types/runtime/index.d.ts +10 -0
- package/dist/types/runtime/memory/memory-service.d.ts +20 -0
- package/dist/types/runtime/model/embedding-model-service.d.ts +68 -0
- package/dist/types/runtime/model/model-call-policy.d.ts +30 -11
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +41 -21
- package/dist/types/runtime/schedule/scheduler-service.d.ts +4 -4
- package/dist/types/runtime/session/session-store-service.d.ts +14 -0
- package/dist/types/runtime/skill/skill-registry-service.d.ts +44 -0
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +5 -0
- package/dist/types/runtime/wait/wait-signal.d.ts +2 -1
- package/dist/types/runtime/workflow/activity-version-registry.d.ts +89 -0
- package/dist/types/runtime/workflow/execution-workflow.d.ts +109 -4
- package/dist/types/schema/agent-schema.d.ts +130 -0
- package/dist/types/schema/content-schema.d.ts +12 -0
- package/dist/types/schema/envelope-schema.d.ts +12 -0
- package/dist/types/schema/execution-schema.d.ts +32 -2
- package/dist/types/schema/ids-schema.d.ts +21 -0
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/schedule-schema.d.ts +6 -0
- package/dist/types/schema/skill-schema.d.ts +260 -0
- package/dist/types/schema/tool-schema.d.ts +2 -0
- package/dist/types/store-sql/child/child-execution-repository.d.ts +1 -0
- package/dist/types/store-sql/compaction/compaction-repository.d.ts +37 -0
- package/dist/types/store-sql/execution/execution-repository.d.ts +3 -0
- package/dist/types/store-sql/index.d.ts +8 -0
- package/dist/types/store-sql/memory/memory-repository.d.ts +50 -0
- package/dist/types/store-sql/permission/permission-rule-repository.d.ts +37 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +1542 -91
- package/dist/types/store-sql/session/context-epoch-repository.d.ts +33 -0
- package/dist/types/store-sql/session/session-repository.d.ts +139 -0
- package/dist/types/store-sql/skill/skill-definition-repository.d.ts +71 -0
- package/dist/types/store-sql/steering/steering-repository.d.ts +59 -0
- package/dist/types/store-sql/tenant/tenant-id.d.ts +15 -0
- package/package.json +3 -3
|
@@ -70,6 +70,17 @@ export declare const LocalAgentTarget: Schema.Struct<{
|
|
|
70
70
|
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
71
71
|
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
72
72
|
}>>;
|
|
73
|
+
readonly skill_definition_ids: Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
|
|
74
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
|
|
75
|
+
}>>;
|
|
76
|
+
readonly permission_rules: Schema.optionalKey<Schema.Struct<{
|
|
77
|
+
readonly rules: Schema.$Array<Schema.Struct<{
|
|
78
|
+
readonly pattern: Schema.String;
|
|
79
|
+
readonly level: Schema.Literals<readonly ["allow", "deny", "ask"]>;
|
|
80
|
+
readonly reason: Schema.optionalKey<Schema.String>;
|
|
81
|
+
}>>;
|
|
82
|
+
readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["allow", "deny", "ask"]>>;
|
|
83
|
+
}>>;
|
|
73
84
|
readonly max_tool_turns: Schema.optionalKey<Schema.Int>;
|
|
74
85
|
readonly max_wait_turns: Schema.optionalKey<Schema.Int>;
|
|
75
86
|
readonly token_budget: Schema.optionalKey<Schema.Int>;
|
|
@@ -91,6 +102,10 @@ export declare const LocalAgentTarget: Schema.Struct<{
|
|
|
91
102
|
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
92
103
|
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
93
104
|
}>>>;
|
|
105
|
+
readonly handoff_targets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
106
|
+
readonly name: Schema.String;
|
|
107
|
+
readonly preset_name: Schema.String;
|
|
108
|
+
}>>>;
|
|
94
109
|
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
95
110
|
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
96
111
|
}>;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Agent, Content, Execution, Ids, Shared, Tool } from "../../schema/index";
|
|
2
2
|
import { AgentChatRepository } from "../../store-sql/index";
|
|
3
|
-
import {
|
|
3
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
4
|
+
import * as Ai from "effect/unstable/ai";
|
|
5
|
+
import * as SpawnChildRunTool from "../child/spawn-child-run-tool";
|
|
4
6
|
import * as EventLog from "../execution/event-log-service";
|
|
5
7
|
import * as LanguageModelService from "../model/language-model-service";
|
|
6
8
|
import * as ModelCallPolicy from "../model/model-call-policy";
|
|
7
9
|
import * as SchemaRegistry from "../schema-registry/schema-registry-service";
|
|
8
10
|
import * as ToolRuntime from "../tool/tool-runtime-service";
|
|
9
11
|
import * as PromptAssembler from "./prompt-assembler-service";
|
|
12
|
+
import * as RelayCompaction from "./relay-compaction";
|
|
10
13
|
declare const AgentLoopError_base: Schema.Class<AgentLoopError, Schema.TaggedStruct<"AgentLoopError", {
|
|
11
14
|
readonly message: Schema.String;
|
|
12
15
|
readonly next_event_sequence: Schema.optionalKey<Schema.Int>;
|
|
13
|
-
}>, Cause.YieldableError>;
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
14
17
|
export declare class AgentLoopError extends AgentLoopError_base {
|
|
15
18
|
}
|
|
16
19
|
declare const AgentLoopWaitRequested_base: Schema.Class<AgentLoopWaitRequested, Schema.TaggedStruct<"AgentLoopWaitRequested", {
|
|
@@ -26,29 +29,33 @@ declare const AgentLoopWaitRequested_base: Schema.Class<AgentLoopWaitRequested,
|
|
|
26
29
|
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
27
30
|
}>;
|
|
28
31
|
readonly next_event_sequence: Schema.Int;
|
|
29
|
-
}>, Cause.YieldableError>;
|
|
32
|
+
}>, import("effect/Cause").YieldableError>;
|
|
30
33
|
export declare class AgentLoopWaitRequested extends AgentLoopWaitRequested_base {
|
|
31
34
|
}
|
|
32
35
|
declare const AgentLoopBudgetExceeded_base: Schema.Class<AgentLoopBudgetExceeded, Schema.TaggedStruct<"AgentLoopBudgetExceeded", {
|
|
33
36
|
readonly tokens_used: Schema.Int;
|
|
34
37
|
readonly token_budget: Schema.Int;
|
|
35
38
|
readonly next_event_sequence: Schema.Int;
|
|
36
|
-
}>, Cause.YieldableError>;
|
|
37
|
-
/**
|
|
38
|
-
* Raised when an agent's per-execution `token_budget` is reached. Checked
|
|
39
|
-
* between turns at durable boundaries (never mid-stream); the execution fails
|
|
40
|
-
* terminally, exactly like `AgentLoopError` (docs/spec/07 + ADR-0021).
|
|
41
|
-
*/
|
|
39
|
+
}>, import("effect/Cause").YieldableError>;
|
|
42
40
|
export declare class AgentLoopBudgetExceeded extends AgentLoopBudgetExceeded_base {
|
|
43
41
|
}
|
|
44
42
|
export interface RunInput {
|
|
45
43
|
readonly executionId: Ids.ExecutionId;
|
|
44
|
+
readonly sessionId?: Ids.SessionId;
|
|
46
45
|
readonly agent: Agent.Definition;
|
|
46
|
+
readonly agentDefinitionId?: Ids.AgentDefinitionId;
|
|
47
|
+
readonly agentDefinitionRevision?: Agent.DefinitionRevision;
|
|
47
48
|
readonly input: ReadonlyArray<Content.Part>;
|
|
48
49
|
readonly resumeToolCall?: Tool.Call;
|
|
50
|
+
readonly memorySubjectId?: Ids.MemorySubjectId;
|
|
49
51
|
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
50
52
|
readonly startedAt: number;
|
|
51
53
|
readonly completedAt: number;
|
|
54
|
+
readonly steeringEnabled?: boolean;
|
|
55
|
+
readonly toolOutputMaxBytes?: number | null;
|
|
56
|
+
readonly compaction?: RelayCompaction.Options | null;
|
|
57
|
+
readonly sessionEntryScope?: string;
|
|
58
|
+
readonly dispatchChildRun?: (input: SpawnChildRunTool.DispatchInput) => Effect.Effect<void, unknown, any>;
|
|
52
59
|
}
|
|
53
60
|
export interface RunResult {
|
|
54
61
|
readonly metadata: Shared.Metadata;
|
|
@@ -68,7 +75,29 @@ export declare class Service extends Service_base {
|
|
|
68
75
|
* @experimental
|
|
69
76
|
*/
|
|
70
77
|
export declare const STRUCTURED_TURN_PROMPT = "Return the final structured output for the task above.";
|
|
71
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Converts a Relay `Tool.Definition` into the `Ai.Tool` Baton's toolkit
|
|
80
|
+
* consumes. Exported for direct unit testing of the `needsApproval` mapping
|
|
81
|
+
* (see `agent-loop-service.test.ts`) — `Tool.Definition.needs_approval` must
|
|
82
|
+
* reach the constructed tool honestly so Relay tools self-describe correctly
|
|
83
|
+
* even outside Relay's own durable approval gate (docs/spec/27).
|
|
84
|
+
*
|
|
85
|
+
* @experimental
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Build the model-facing `Ai.Tool` from a bare `Tool.Definition`, delegating to
|
|
89
|
+
* the single canonical mapping in `ToolRuntime` so the parameters schema is a real
|
|
90
|
+
* object AST (not the `Schema.Unknown` placeholder that breaks OpenRouter/Anthropic
|
|
91
|
+
* tool preparation). Retained and exported only for the unit tests that assert the
|
|
92
|
+
* `needs_approval` mapping; the run loop builds its toolkit from `RegisteredTool`s
|
|
93
|
+
* (which may carry a tool's own concrete `aiTool`), not from definitions.
|
|
94
|
+
*
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
export declare const aiToolFromDefinition: (definition: Tool.Definition) => Ai.Tool.Any;
|
|
98
|
+
/** Map a Baton run failure (or an upstream model error) to the public error types. */
|
|
99
|
+
export declare const mapBoundaryError: (error: unknown, current: Execution.ExecutionEventSequence) => AgentLoopError | AgentLoopWaitRequested | AgentLoopBudgetExceeded;
|
|
100
|
+
export declare const layer: Layer.Layer<Service, never, AgentChatRepository.Service | EventLog.Service | ToolRuntime.Service | LanguageModelService.Service | ModelCallPolicy.Service | SchemaRegistry.Service | PromptAssembler.Service>;
|
|
72
101
|
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
73
102
|
export declare const run: (input: RunInput) => Effect.Effect<RunResult, AgentLoopError | AgentLoopWaitRequested | AgentLoopBudgetExceeded, Service>;
|
|
74
103
|
export {};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { Approvals } from "@batonfx/core";
|
|
2
2
|
/**
|
|
3
|
-
* Relay's binding for Baton's `Approvals` seam
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Relay's binding for Baton's `Approvals` seam: a DELIBERATE, PERMANENT
|
|
4
|
+
* auto-approving pass-through, not a placeholder.
|
|
5
|
+
*
|
|
6
|
+
* Decision authority for `needs_approval` tools lives one seam downstream, in
|
|
7
|
+
* the durable `ToolRuntime.run` gate (docs/spec/27-tool-approvals.md) — a
|
|
8
|
+
* deterministic `wait:approval:${tool_call_id}` row plus
|
|
9
|
+
* `tool.approval.requested` / `tool.approval.resolved` events. Baton dispatches
|
|
10
|
+
* a `needsApproval` tool call to `Approvals.check` first and, on `Approved`,
|
|
11
|
+
* hands off to `ToolExecutor.execute` (`RelayToolExecutor`, wrapping
|
|
12
|
+
* `ToolRuntime.run`) — where the REAL gate runs and suspends the call via
|
|
13
|
+
* Baton's `Suspend` outcome (`ToolExecutionWaitRequested`) until a decision is
|
|
14
|
+
* recorded. Auto-approving here just clears Baton's own pre-execution check so
|
|
15
|
+
* every call reaches that durable gate; it does not skip approval enforcement.
|
|
16
|
+
* Moving the gate into `Approvals.check` instead would change the durable
|
|
17
|
+
* event order that `test/e2e/tool-approval-durability.e2e.test.ts` depends on.
|
|
6
18
|
*
|
|
7
19
|
* @experimental
|
|
8
20
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Compaction } from "@batonfx/core";
|
|
2
|
+
import { Ids } from "../../schema/index";
|
|
3
|
+
import { CompactionRepository } from "../../store-sql/index";
|
|
4
|
+
import { Layer } from "effect";
|
|
5
|
+
export interface Options {
|
|
6
|
+
readonly contextWindow?: number;
|
|
7
|
+
readonly reserveTokens?: number;
|
|
8
|
+
readonly keepRecentTokens?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Config {
|
|
11
|
+
readonly executionId: Ids.ExecutionId;
|
|
12
|
+
readonly repository: CompactionRepository.Interface;
|
|
13
|
+
readonly options?: Options;
|
|
14
|
+
}
|
|
15
|
+
export declare const checkpointId: (input: {
|
|
16
|
+
readonly executionId: Ids.ExecutionId;
|
|
17
|
+
readonly turn: number;
|
|
18
|
+
readonly firstKeptEntryId: Ids.SessionEntryId | string;
|
|
19
|
+
}) => string;
|
|
20
|
+
export declare const strategy: (config: Config) => Compaction.Strategy;
|
|
21
|
+
export declare const make: (config: Config) => Compaction.Interface;
|
|
22
|
+
export declare const layer: (config: Config) => Layer.Layer<Compaction.Compaction>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Instructions } from "@batonfx/core";
|
|
2
|
+
export interface ContextEpoch {
|
|
3
|
+
readonly baseline: string;
|
|
4
|
+
readonly dynamicSourceIds: ReadonlyArray<string>;
|
|
5
|
+
}
|
|
6
|
+
export declare const layerFromEpoch: (epoch: ContextEpoch) => import("effect/Layer").Layer<Instructions.Instructions, never, never>;
|
|
7
|
+
/**
|
|
8
|
+
* Delivers the assembled turn-zero system prompt through Baton's `Instructions`
|
|
9
|
+
* seam instead of `Baton.Agent.RunOptions.system` (which makes Baton ignore its
|
|
10
|
+
* `Instructions` registry entirely). Only the assembled SYSTEM STRING moves
|
|
11
|
+
* through this seam — `PromptAssembler`'s blob/artifact prompt resolution has
|
|
12
|
+
* no Baton equivalent and remains a permanent Relay responsibility
|
|
13
|
+
* (docs/spec/28-prompt-assembly.md).
|
|
14
|
+
*
|
|
15
|
+
* Provided per-run, for fresh runs only: on resume, Baton ignores `Instructions`
|
|
16
|
+
* once `RunOptions.history` is set (the durable transcript already carries the
|
|
17
|
+
* assembled system message), so `agent-loop-service.ts` does not provide this
|
|
18
|
+
* layer on the resume branch.
|
|
19
|
+
*
|
|
20
|
+
* @experimental
|
|
21
|
+
*/
|
|
22
|
+
export declare const layer: (system: string) => import("effect/Layer").Layer<Instructions.Instructions, never, never>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Permissions } from "@batonfx/core";
|
|
2
|
+
import { Agent, Execution, Ids } from "../../schema/index";
|
|
3
|
+
import { PermissionRuleRepository } from "../../store-sql/index";
|
|
4
|
+
import { Effect, Layer } from "effect";
|
|
5
|
+
import * as EventLog from "../execution/event-log-service";
|
|
6
|
+
import * as WaitService from "../wait/wait-service";
|
|
7
|
+
export interface SequenceAllocator {
|
|
8
|
+
readonly allocate: (count: number) => Effect.Effect<Execution.ExecutionEventSequence>;
|
|
9
|
+
readonly current: Effect.Effect<Execution.ExecutionEventSequence>;
|
|
10
|
+
readonly resetTo: (sequence: Execution.ExecutionEventSequence) => Effect.Effect<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface Config {
|
|
13
|
+
readonly ruleset: Agent.PermissionRuleset;
|
|
14
|
+
readonly repository: PermissionRuleRepository.Interface;
|
|
15
|
+
readonly waits: WaitService.Interface;
|
|
16
|
+
readonly eventLog: EventLog.Interface;
|
|
17
|
+
readonly allocator: SequenceAllocator;
|
|
18
|
+
readonly executionId: Ids.ExecutionId;
|
|
19
|
+
readonly agentName: string;
|
|
20
|
+
readonly scope: string;
|
|
21
|
+
readonly startedAt: number;
|
|
22
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
23
|
+
}
|
|
24
|
+
export declare const waitIdForToolCall: (toolCallId: string) => string & import("effect/Brand").Brand<"Relay.WaitId">;
|
|
25
|
+
export declare const layer: (config: Config) => Layer.Layer<Permissions.Permissions | Permissions.RuleStore, never, never>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Steering } from "@batonfx/core";
|
|
2
|
+
import { Execution, Ids } from "../../schema/index";
|
|
3
|
+
import { SteeringRepository } from "../../store-sql/index";
|
|
4
|
+
import { Effect, Layer } from "effect";
|
|
5
|
+
import * as EventLog from "../execution/event-log-service";
|
|
6
|
+
export interface SequenceAllocator {
|
|
7
|
+
readonly allocate: (count: number) => Effect.Effect<Execution.ExecutionEventSequence>;
|
|
8
|
+
}
|
|
9
|
+
export interface Config {
|
|
10
|
+
readonly repository: SteeringRepository.Interface;
|
|
11
|
+
readonly eventLog: EventLog.Interface;
|
|
12
|
+
readonly allocator: SequenceAllocator;
|
|
13
|
+
readonly executionId: Ids.ExecutionId;
|
|
14
|
+
readonly startedAt: number;
|
|
15
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
16
|
+
}
|
|
17
|
+
export declare const layer: (config: Config) => Layer.Layer<Steering.Steering>;
|
|
@@ -20,6 +20,9 @@ export interface Config {
|
|
|
20
20
|
readonly permissions: ReadonlyArray<Tool.Permission>;
|
|
21
21
|
readonly startedAt: number;
|
|
22
22
|
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
23
|
+
readonly toolOutputMaxBytes?: number;
|
|
24
|
+
readonly resumedToolCallId?: Ids.ToolCallId;
|
|
25
|
+
readonly extraTools?: ReadonlyArray<ToolRuntime.RegisteredTool>;
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Baton `ToolExecutor` over Relay's `ToolRuntime`. Allocates sequences and maps
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ToolOutput } from "@batonfx/core";
|
|
2
|
+
import { Effect, Layer, Option } from "effect";
|
|
3
|
+
import * as BlobStore from "../content/blob-store-service";
|
|
4
|
+
export declare const store: (blobStore: BlobStore.Interface, toolCallId: string, content: unknown) => Effect.Effect<Option.Option<string>, ToolOutput.ToolOutputError>;
|
|
5
|
+
export declare const make: (blobStore: BlobStore.Interface) => ToolOutput.StoreInterface;
|
|
6
|
+
export declare const layerFromBlobStore: (blobStore: BlobStore.Interface) => Layer.Layer<ToolOutput.ToolOutputStore>;
|
|
7
|
+
export declare const layer: Layer.Layer<ToolOutput.ToolOutputStore, never, BlobStore.Service>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Agent, Content, Execution, Ids, Shared } from "../../schema/index";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import * as EventLog from "../execution/event-log-service";
|
|
4
|
+
import * as ToolRuntime from "../tool/tool-runtime-service";
|
|
5
|
+
import * as WaitService from "../wait/wait-service";
|
|
6
|
+
import * as ChildRunService from "./child-run-service";
|
|
7
|
+
export declare const toolName = "spawn_child_run";
|
|
8
|
+
export declare const permissionName = "relay.child_run.spawn";
|
|
9
|
+
export declare const Input: Schema.Struct<{
|
|
10
|
+
readonly preset_name: Schema.optionalKey<Schema.String>;
|
|
11
|
+
readonly instructions: Schema.optionalKey<Schema.String>;
|
|
12
|
+
readonly model: Schema.optionalKey<Schema.Struct<{
|
|
13
|
+
readonly provider: Schema.String;
|
|
14
|
+
readonly model: Schema.String;
|
|
15
|
+
readonly registration_key: Schema.optionalKey<Schema.String>;
|
|
16
|
+
readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
17
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
18
|
+
}>>;
|
|
19
|
+
readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
20
|
+
readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
21
|
+
readonly output_schema_ref: Schema.optionalKey<Schema.String>;
|
|
22
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
23
|
+
readonly input: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
24
|
+
readonly type: Schema.Literal<"text">;
|
|
25
|
+
readonly text: Schema.String;
|
|
26
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
27
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"structured">;
|
|
30
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
31
|
+
readonly schema_ref: Schema.optionalKey<Schema.String>;
|
|
32
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
33
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
34
|
+
}>, Schema.Struct<{
|
|
35
|
+
readonly type: Schema.Literal<"blob-reference">;
|
|
36
|
+
readonly uri: Schema.String;
|
|
37
|
+
readonly media_type: Schema.String;
|
|
38
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
39
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
40
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly type: Schema.Literal<"artifact-reference">;
|
|
43
|
+
readonly artifact_id: Schema.String;
|
|
44
|
+
readonly media_type: Schema.optionalKey<Schema.String>;
|
|
45
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
46
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
47
|
+
}>, Schema.Struct<{
|
|
48
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
49
|
+
readonly call: Schema.Struct<{
|
|
50
|
+
readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
51
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
52
|
+
};
|
|
53
|
+
readonly name: Schema.String;
|
|
54
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
55
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
56
|
+
}>;
|
|
57
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
58
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
59
|
+
}>, Schema.Struct<{
|
|
60
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
61
|
+
readonly result: Schema.Struct<{
|
|
62
|
+
readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
63
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
64
|
+
};
|
|
65
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
66
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
67
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
68
|
+
}>;
|
|
69
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
70
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
71
|
+
}>]>>>;
|
|
72
|
+
}>;
|
|
73
|
+
export interface Input extends Schema.Schema.Type<typeof Input> {
|
|
74
|
+
}
|
|
75
|
+
export declare const Output: Schema.Struct<{
|
|
76
|
+
readonly child_execution_id: Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
|
|
77
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
|
|
78
|
+
};
|
|
79
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled"]>;
|
|
80
|
+
readonly output: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
81
|
+
readonly type: Schema.Literal<"text">;
|
|
82
|
+
readonly text: Schema.String;
|
|
83
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
84
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"structured">;
|
|
87
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
88
|
+
readonly schema_ref: Schema.optionalKey<Schema.String>;
|
|
89
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
90
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
91
|
+
}>, Schema.Struct<{
|
|
92
|
+
readonly type: Schema.Literal<"blob-reference">;
|
|
93
|
+
readonly uri: Schema.String;
|
|
94
|
+
readonly media_type: Schema.String;
|
|
95
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
96
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
97
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
98
|
+
}>, Schema.Struct<{
|
|
99
|
+
readonly type: Schema.Literal<"artifact-reference">;
|
|
100
|
+
readonly artifact_id: Schema.String;
|
|
101
|
+
readonly media_type: Schema.optionalKey<Schema.String>;
|
|
102
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
103
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
104
|
+
}>, Schema.Struct<{
|
|
105
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
106
|
+
readonly call: Schema.Struct<{
|
|
107
|
+
readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
108
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
109
|
+
};
|
|
110
|
+
readonly name: Schema.String;
|
|
111
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
112
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
113
|
+
}>;
|
|
114
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
115
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
118
|
+
readonly result: Schema.Struct<{
|
|
119
|
+
readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
120
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
121
|
+
};
|
|
122
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
123
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
124
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
125
|
+
}>;
|
|
126
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
127
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
128
|
+
}>]>>;
|
|
129
|
+
}>;
|
|
130
|
+
export interface Output extends Schema.Schema.Type<typeof Output> {
|
|
131
|
+
}
|
|
132
|
+
export declare const TransferInput: Schema.Struct<{
|
|
133
|
+
readonly input: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
134
|
+
readonly type: Schema.Literal<"text">;
|
|
135
|
+
readonly text: Schema.String;
|
|
136
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
137
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly type: Schema.Literal<"structured">;
|
|
140
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
141
|
+
readonly schema_ref: Schema.optionalKey<Schema.String>;
|
|
142
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
143
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly type: Schema.Literal<"blob-reference">;
|
|
146
|
+
readonly uri: Schema.String;
|
|
147
|
+
readonly media_type: Schema.String;
|
|
148
|
+
readonly filename: Schema.optionalKey<Schema.String>;
|
|
149
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
150
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly type: Schema.Literal<"artifact-reference">;
|
|
153
|
+
readonly artifact_id: Schema.String;
|
|
154
|
+
readonly media_type: Schema.optionalKey<Schema.String>;
|
|
155
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
156
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
157
|
+
}>, Schema.Struct<{
|
|
158
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
159
|
+
readonly call: Schema.Struct<{
|
|
160
|
+
readonly id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
161
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
162
|
+
};
|
|
163
|
+
readonly name: Schema.String;
|
|
164
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
165
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
166
|
+
}>;
|
|
167
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
168
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
169
|
+
}>, Schema.Struct<{
|
|
170
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
171
|
+
readonly result: Schema.Struct<{
|
|
172
|
+
readonly call_id: Schema.brand<Schema.String, "Relay.ToolCallId"> & {
|
|
173
|
+
make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ToolCallId">;
|
|
174
|
+
};
|
|
175
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
176
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
177
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
178
|
+
}>;
|
|
179
|
+
readonly provider_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
180
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
181
|
+
}>]>>>;
|
|
182
|
+
}>;
|
|
183
|
+
export interface TransferInput extends Schema.Schema.Type<typeof TransferInput> {
|
|
184
|
+
}
|
|
185
|
+
export interface DispatchInput {
|
|
186
|
+
readonly executionId: Ids.ExecutionId;
|
|
187
|
+
readonly rootAddressId: Ids.AddressId;
|
|
188
|
+
readonly input: ReadonlyArray<Content.Part>;
|
|
189
|
+
readonly eventSequence: Execution.ExecutionEventSequence;
|
|
190
|
+
readonly startedAt: number;
|
|
191
|
+
readonly completedAt: number;
|
|
192
|
+
readonly agentDefinitionId: Ids.AgentDefinitionId;
|
|
193
|
+
readonly agentDefinitionRevision: Agent.DefinitionRevision;
|
|
194
|
+
readonly agentDefinitionSnapshot: Agent.Definition;
|
|
195
|
+
readonly metadata: Shared.Metadata;
|
|
196
|
+
}
|
|
197
|
+
export interface Config {
|
|
198
|
+
readonly agent: Agent.Definition;
|
|
199
|
+
readonly agentDefinitionId: Ids.AgentDefinitionId;
|
|
200
|
+
readonly agentDefinitionRevision: Agent.DefinitionRevision;
|
|
201
|
+
readonly childRuns: ChildRunService.Interface;
|
|
202
|
+
readonly eventLog: EventLog.Interface;
|
|
203
|
+
readonly waits: WaitService.Interface;
|
|
204
|
+
readonly dispatch: (input: DispatchInput) => Effect.Effect<void, unknown, any>;
|
|
205
|
+
}
|
|
206
|
+
export declare const enabled: (agent: Agent.Definition) => boolean;
|
|
207
|
+
export declare const registeredTool: (config: Config) => ToolRuntime.RegisteredTool;
|
|
208
|
+
export declare const transferToolName: (name: string) => string;
|
|
209
|
+
export declare const transferTools: (config: Config) => ReadonlyArray<ToolRuntime.RegisteredTool>;
|