@relayfx/sdk 0.0.38 → 0.0.39

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.
@@ -24,7 +24,7 @@ export interface StartExecutionByAddressInput {
24
24
  export interface StartExecutionByAgentDefinitionInput {
25
25
  readonly root_address_id: Ids.AddressId;
26
26
  readonly session_id?: Ids.SessionId;
27
- readonly agent_definition_id: Ids.AgentDefinitionId;
27
+ readonly agent_definition_id: Ids.AgentId;
28
28
  readonly input?: ReadonlyArray<Content.Part>;
29
29
  readonly idempotency_key: Shared.NonEmptyString;
30
30
  readonly execution_id?: Ids.ExecutionId;
@@ -37,12 +37,41 @@ export interface StartExecutionByAgentDefinitionInput {
37
37
  export interface RegisterAgentInput extends Agent.DefineInput {
38
38
  readonly address?: Ids.AddressId;
39
39
  }
40
+ export interface AgentOptions extends Omit<Agent.DefineInput, "id" | "name" | "permissions"> {
41
+ readonly id?: Ids.AgentId;
42
+ readonly address?: Ids.AddressId;
43
+ readonly name?: Shared.NonEmptyString;
44
+ readonly permissions?: Agent.DefineInput["permissions"];
45
+ }
46
+ export interface RegisteredAgent {
47
+ readonly id: Ids.AgentId;
48
+ readonly address_id: Ids.AddressId;
49
+ readonly record: Agent.DefinitionRecord;
50
+ }
51
+ export type StartTarget = Ids.AddressId | RegisteredAgent | {
52
+ readonly address_id: Ids.AddressId;
53
+ };
54
+ export interface StartInput {
55
+ readonly session_id?: Ids.SessionId;
56
+ readonly input?: ReadonlyArray<Content.Part>;
57
+ readonly idempotency_key?: Shared.NonEmptyString;
58
+ readonly execution_id?: Ids.ExecutionId;
59
+ readonly event_sequence?: Execution.ExecutionEventSequence;
60
+ readonly started_at?: Shared.TimestampMillis;
61
+ readonly completed_at?: Shared.TimestampMillis;
62
+ readonly wait_id?: Ids.WaitId;
63
+ readonly metadata?: Shared.Metadata;
64
+ }
65
+ export interface RunInput extends StartInput {
66
+ readonly after_cursor?: Shared.NonEmptyString;
67
+ readonly limit?: number;
68
+ }
40
69
  export interface Interface {
41
70
  readonly registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
42
71
  readonly registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
43
- readonly getAgentDefinition: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError>;
72
+ readonly getAgentDefinition: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError>;
44
73
  readonly listAgentDefinitions: () => Effect.Effect<Agent.DefinitionList, ClientError>;
45
- readonly listAgentDefinitionRevisions: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRevisionList, ClientError>;
74
+ readonly listAgentDefinitionRevisions: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRevisionList, ClientError>;
46
75
  readonly getSkillDefinition: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRecord | undefined, ClientError>;
47
76
  readonly listSkillDefinitions: () => Effect.Effect<Skill.DefinitionList, ClientError>;
48
77
  readonly listSkillDefinitionRevisions: (id: Ids.SkillDefinitionId) => Effect.Effect<Skill.DefinitionRevisionList, ClientError>;
@@ -84,9 +113,91 @@ export declare const layerFromRuntime: Layer.Layer<Service, never, AgentRegistry
84
113
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
85
114
  export declare const registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError, Service>;
86
115
  export declare const registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent.DefinitionRegistered, ClientError, Service>;
87
- export declare const getAgentDefinition: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError, Service>;
116
+ export declare const agent: (slug: string, input: AgentOptions) => Effect.Effect<{
117
+ id: string & import("effect/Brand").Brand<"Relay.AgentId">;
118
+ address_id: string & import("effect/Brand").Brand<"Relay.AddressId">;
119
+ record: {
120
+ readonly id: string & import("effect/Brand").Brand<"Relay.AgentId">;
121
+ readonly created_at: number;
122
+ readonly updated_at: number;
123
+ readonly current_revision: number;
124
+ readonly definition: {
125
+ readonly name: string;
126
+ readonly permissions: readonly {
127
+ readonly name: string;
128
+ readonly value: Schema.Json;
129
+ readonly metadata?: {
130
+ readonly [x: string]: Schema.Json;
131
+ };
132
+ }[];
133
+ readonly model: {
134
+ readonly provider: string;
135
+ readonly model: string;
136
+ readonly metadata?: {
137
+ readonly [x: string]: Schema.Json;
138
+ };
139
+ readonly registration_key?: string;
140
+ readonly request_options?: {
141
+ readonly [x: string]: Schema.Json;
142
+ };
143
+ };
144
+ readonly tool_names: readonly string[];
145
+ readonly metadata?: {
146
+ readonly [x: string]: Schema.Json;
147
+ };
148
+ readonly instructions?: string;
149
+ readonly output_schema_ref?: string;
150
+ readonly skill_definition_ids?: readonly (string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">)[];
151
+ readonly permission_rules?: {
152
+ readonly rules: readonly {
153
+ readonly pattern: string;
154
+ readonly level: "allow" | "deny" | "ask";
155
+ readonly reason?: string;
156
+ }[];
157
+ readonly fallback?: "allow" | "deny" | "ask";
158
+ };
159
+ readonly max_tool_turns?: number;
160
+ readonly max_wait_turns?: number;
161
+ readonly token_budget?: number;
162
+ readonly child_run_presets?: {
163
+ readonly [x: string]: {
164
+ readonly metadata?: {
165
+ readonly [x: string]: Schema.Json;
166
+ };
167
+ readonly permissions?: readonly string[];
168
+ readonly model?: {
169
+ readonly provider: string;
170
+ readonly model: string;
171
+ readonly metadata?: {
172
+ readonly [x: string]: Schema.Json;
173
+ };
174
+ readonly registration_key?: string;
175
+ readonly request_options?: {
176
+ readonly [x: string]: Schema.Json;
177
+ };
178
+ };
179
+ readonly instructions?: string;
180
+ readonly tool_names?: readonly string[];
181
+ readonly workspace_policy?: {
182
+ readonly mode: "share" | "fork";
183
+ readonly fallback?: "fail" | "fresh";
184
+ };
185
+ readonly output_schema_ref?: string;
186
+ };
187
+ };
188
+ readonly handoff_targets?: readonly Schema.Struct.ReadonlySide<{
189
+ readonly name: Schema.String;
190
+ readonly preset_name: Schema.String;
191
+ }, "Type">[];
192
+ };
193
+ readonly tool_input_schema_digests?: {
194
+ readonly [x: string]: string;
195
+ };
196
+ };
197
+ }, ClientError, Service>;
198
+ export declare const getAgentDefinition: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<Agent.DefinitionRecord | undefined, ClientError, Service>;
88
199
  export declare const listAgentDefinitions: () => Effect.Effect<Agent.DefinitionList, ClientError, Service>;
89
- export declare const listAgentDefinitionRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRevisionList, ClientError, Service>;
200
+ export declare const listAgentDefinitionRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<Agent.DefinitionRevisionList, ClientError, Service>;
90
201
  export declare const getSkillDefinition: (id: string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">) => Effect.Effect<Skill.DefinitionRecord | undefined, ClientError, Service>;
91
202
  export declare const listSkillDefinitions: () => Effect.Effect<Skill.DefinitionList, ClientError, Service>;
92
203
  export declare const listSkillDefinitionRevisions: (id: string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">) => Effect.Effect<Skill.DefinitionRevisionList, ClientError, Service>;
@@ -96,6 +207,8 @@ export declare const listAddressBookRoutes: () => Effect.Effect<Address.RouteLis
96
207
  export declare const startExecution: (input: Operation.StartExecutionInput) => Effect.Effect<Operation.StartExecutionResult, ClientError, Service>;
97
208
  export declare const startExecutionByAddress: (input: StartExecutionByAddressInput) => Effect.Effect<Operation.StartExecutionResult, ClientError, Service>;
98
209
  export declare const startExecutionByAgentDefinition: (input: StartExecutionByAgentDefinitionInput) => Effect.Effect<Operation.StartExecutionResult, ClientError, Service>;
210
+ export declare const start: (target: StartTarget, input?: StartInput | undefined) => Effect.Effect<Operation.StartExecutionResult, ClientError, Service>;
211
+ export declare const run: (target: StartTarget, input?: RunInput) => Stream.Stream<Execution.ExecutionEvent, ClientError, Service>;
99
212
  export declare const cancelExecution: (input: Operation.CancelExecutionInput) => Effect.Effect<Operation.CancelExecutionAccepted, ClientError, Service>;
100
213
  export declare const steer: (input: Operation.SteerInput) => Effect.Effect<Operation.SteerAccepted, ClientError, Service>;
101
214
  export declare const getExecution: (id: string & import("effect/Brand").Brand<"Relay.ExecutionId">) => Effect.Effect<Execution.Execution | undefined, ClientError, Service>;
@@ -61,8 +61,8 @@ export declare const StartExecutionInput: Schema.Struct<{
61
61
  readonly event_sequence: Schema.Int;
62
62
  readonly started_at: Schema.Int;
63
63
  readonly completed_at: Schema.Int;
64
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
65
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
64
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
65
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
66
66
  }>;
67
67
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
68
68
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -942,8 +942,8 @@ export declare const ConversationSummary: Schema.Struct<{
942
942
  }>;
943
943
  readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
944
944
  readonly kind: Schema.Literals<readonly ["user-agent", "agent-agent"]>;
945
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
946
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
945
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
946
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
947
947
  }>;
948
948
  readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
949
949
  readonly created_at: Schema.Int;
@@ -964,8 +964,8 @@ export declare const ListExecutionsResult: Schema.Struct<{
964
964
  }>;
965
965
  readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
966
966
  readonly kind: Schema.Literals<readonly ["user-agent", "agent-agent"]>;
967
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
968
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
967
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
968
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
969
969
  }>;
970
970
  readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
971
971
  readonly created_at: Schema.Int;
@@ -1046,8 +1046,8 @@ export declare const GetSessionResult: Schema.Struct<{
1046
1046
  }>;
1047
1047
  readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
1048
1048
  readonly kind: Schema.Literals<readonly ["user-agent", "agent-agent"]>;
1049
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
1050
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
1049
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
1050
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
1051
1051
  }>;
1052
1052
  readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1053
1053
  readonly created_at: Schema.Int;
@@ -23,8 +23,8 @@ declare const AddressAgentDefinitionNotFound_base: Schema.Class<AddressAgentDefi
23
23
  readonly address_id: Schema.brand<Schema.String, "Relay.AddressId"> & {
24
24
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressId">;
25
25
  };
26
- readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
27
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
26
+ readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentId"> & {
27
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
28
28
  };
29
29
  }>, import("effect/Cause").YieldableError>;
30
30
  export declare class AddressAgentDefinitionNotFound extends AddressAgentDefinitionNotFound_base {
@@ -50,8 +50,8 @@ export declare const LocalAgentTarget: Schema.Struct<{
50
50
  readonly route_key: Schema.String;
51
51
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
52
52
  }>;
53
- readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
54
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
53
+ readonly agent_definition_id: Schema.brand<Schema.String, "Relay.AgentId"> & {
54
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
55
55
  };
56
56
  readonly agent_definition_revision: Schema.Int;
57
57
  readonly agent_definition_snapshot: Schema.Struct<{
@@ -43,7 +43,7 @@ export interface RunInput {
43
43
  readonly executionId: Ids.ExecutionId;
44
44
  readonly sessionId?: Ids.SessionId;
45
45
  readonly agent: Agent.Definition;
46
- readonly agentDefinitionId?: Ids.AgentDefinitionId;
46
+ readonly agentId?: Ids.AgentId;
47
47
  readonly agentDefinitionRevision?: Agent.DefinitionRevision;
48
48
  readonly agentDefinitionToolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
49
49
  readonly input: ReadonlyArray<Content.Part>;
@@ -76,26 +76,7 @@ export declare class Service extends Service_base {
76
76
  * @experimental
77
77
  */
78
78
  export declare const STRUCTURED_TURN_PROMPT = "Return the final structured output for the task above.";
79
- /**
80
- * Converts a Relay `Tool.Definition` into the `Ai.Tool` Baton's toolkit
81
- * consumes. Exported for direct unit testing of the `needsApproval` mapping
82
- * (see `agent-loop-service.test.ts`) — `Tool.Definition.needs_approval` must
83
- * reach the constructed tool honestly so Relay tools self-describe correctly
84
- * even outside Relay's own durable approval gate (docs/spec/27).
85
- *
86
- * @experimental
87
- */
88
- /**
89
- * Build the model-facing `Ai.Tool` from a bare `Tool.Definition`, delegating to
90
- * the single canonical mapping in `ToolRuntime` so the parameters schema is a real
91
- * object AST (not the `Schema.Unknown` placeholder that breaks OpenRouter/Anthropic
92
- * tool preparation). Retained and exported only for the unit tests that assert the
93
- * `needs_approval` mapping; the run loop builds its toolkit from `RegisteredTool`s
94
- * (which may carry a tool's own concrete `aiTool`), not from definitions.
95
- *
96
- * @experimental
97
- */
98
- export declare const aiToolFromDefinition: (definition: Tool.Definition) => Ai.Tool.Any;
79
+ export declare const toolFromDefinition: (definition: Tool.Definition) => Ai.Tool.Any;
99
80
  /** Map a Baton run failure (or an upstream model error) to the public error types. */
100
81
  export declare const mapBoundaryError: (error: unknown, current: Execution.ExecutionEventSequence) => AgentLoopError | AgentLoopWaitRequested | AgentLoopBudgetExceeded;
101
82
  export declare const layer: Layer.Layer<Service, never, AgentChatRepository.Service | EventLog.Service | ToolRuntime.Service | LanguageModelService.Service | ModelCallPolicy.Service | SchemaRegistry.Service | PromptAssembler.Service>;
@@ -13,10 +13,10 @@ export declare class AgentRegistryError extends AgentRegistryError_base {
13
13
  }
14
14
  export interface Interface {
15
15
  readonly register: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, AgentDefinitionInvalid | AgentRegistryError>;
16
- readonly get: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError>;
16
+ readonly get: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError>;
17
17
  readonly getRevision: (input: AgentDefinitionRepository.GetAgentDefinitionRevisionInput) => Effect.Effect<Agent.DefinitionRevisionRecord | undefined, AgentRegistryError>;
18
18
  readonly list: () => Effect.Effect<Agent.DefinitionList, AgentRegistryError>;
19
- readonly listRevisions: (id: Ids.AgentDefinitionId) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError>;
19
+ readonly listRevisions: (id: Ids.AgentId) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError>;
20
20
  }
21
21
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/AgentRegistry", Interface>;
22
22
  export declare class Service extends Service_base {
@@ -24,8 +24,8 @@ export declare class Service extends Service_base {
24
24
  export declare const layer: Layer.Layer<Service, never, AgentDefinitionRepository.Service>;
25
25
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
26
26
  export declare const register: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, AgentDefinitionInvalid | AgentRegistryError, Service>;
27
- export declare const get: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError, Service>;
27
+ export declare const get: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<Agent.DefinitionRecord | undefined, AgentRegistryError, Service>;
28
28
  export declare const getRevision: (input: AgentDefinitionRepository.GetAgentDefinitionRevisionInput) => Effect.Effect<Agent.DefinitionRevisionRecord | undefined, AgentRegistryError, Service>;
29
29
  export declare const list: () => Effect.Effect<Agent.DefinitionList, AgentRegistryError, Service>;
30
- export declare const listRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError, Service>;
30
+ export declare const listRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<Agent.DefinitionRevisionList, AgentRegistryError, Service>;
31
31
  export {};
@@ -189,7 +189,7 @@ export interface DispatchInput {
189
189
  readonly eventSequence: Execution.ExecutionEventSequence;
190
190
  readonly startedAt: number;
191
191
  readonly completedAt: number;
192
- readonly agentDefinitionId: Ids.AgentDefinitionId;
192
+ readonly agentId: Ids.AgentId;
193
193
  readonly agentDefinitionRevision: Agent.DefinitionRevision;
194
194
  readonly agentDefinitionSnapshot: Agent.Definition;
195
195
  readonly agentDefinitionToolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
@@ -197,7 +197,7 @@ export interface DispatchInput {
197
197
  }
198
198
  export interface Config {
199
199
  readonly agent: Agent.Definition;
200
- readonly agentDefinitionId: Ids.AgentDefinitionId;
200
+ readonly agentId: Ids.AgentId;
201
201
  readonly agentDefinitionRevision: Agent.DefinitionRevision;
202
202
  readonly agentDefinitionToolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
203
203
  readonly childRuns: ChildRunService.Interface;
@@ -69,8 +69,8 @@ export declare const Start: Rpc.Rpc<"start", Schema.Struct<{
69
69
  readonly event_sequence: Schema.Int;
70
70
  readonly started_at: Schema.Int;
71
71
  readonly completed_at: Schema.Int;
72
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
73
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
72
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
73
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
74
74
  }>;
75
75
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
76
76
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -235,8 +235,8 @@ export declare const entity: Entity.Entity<"Relay/Execution", Rpc.Rpc<"start", S
235
235
  readonly event_sequence: Schema.Int;
236
236
  readonly started_at: Schema.Int;
237
237
  readonly completed_at: Schema.Int;
238
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
239
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
238
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
239
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
240
240
  }>;
241
241
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
242
242
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -400,8 +400,8 @@ export declare const client: Effect.Effect<(entityId: string) => import("effect/
400
400
  readonly event_sequence: Schema.Int;
401
401
  readonly started_at: Schema.Int;
402
402
  readonly completed_at: Schema.Int;
403
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
404
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
403
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
404
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
405
405
  }>;
406
406
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
407
407
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -16,7 +16,7 @@ export interface AcceptInput {
16
16
  readonly sessionId?: Ids.SessionId;
17
17
  readonly eventSequence: Execution.ExecutionEventSequence;
18
18
  readonly createdAt: number;
19
- readonly agentDefinitionId?: Ids.AgentDefinitionId;
19
+ readonly agentId?: Ids.AgentId;
20
20
  readonly agentDefinitionRevision?: Agent.DefinitionRevision;
21
21
  readonly agentDefinitionSnapshot?: Agent.Definition;
22
22
  readonly agentDefinitionToolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
@@ -53,12 +53,34 @@ declare const ToolCallInfo_base: Context.ServiceClass<ToolCallInfo, "@relayfx/ru
53
53
  export declare class ToolCallInfo extends ToolCallInfo_base {
54
54
  }
55
55
  export interface RegisteredTool {
56
+ readonly name: Shared.NonEmptyString;
56
57
  readonly definition: Tool.Definition;
57
- readonly aiTool?: Ai.Tool.Any;
58
+ readonly tool: Ai.Tool.Any;
58
59
  readonly requiredPermissions?: ReadonlyArray<string>;
59
- readonly inputSchema?: Schema.ConstraintDecoder<unknown, never>;
60
- readonly handler?: (input: any, context: Ai.Toolkit.HandlerContext<Ai.Tool.Any>) => Effect.Effect<unknown, unknown, any>;
61
- readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, any>;
60
+ readonly validateInput?: (input: Shared.JsonValue) => Effect.Effect<void, ToolInputInvalid, any>;
61
+ readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, unknown, any>;
62
+ }
63
+ export interface ToolOptions<Input extends Schema.Constraint, Output extends Schema.Constraint> {
64
+ readonly description: string;
65
+ readonly input: Input;
66
+ readonly output: Output;
67
+ readonly permissions?: ReadonlyArray<Tool.Permission> | undefined;
68
+ readonly requiredPermissions?: ReadonlyArray<string> | undefined;
69
+ readonly requirements?: ReadonlyArray<Tool.RuntimeRequirement> | undefined;
70
+ readonly needsApproval?: boolean | undefined;
71
+ readonly metadata?: Shared.Metadata | undefined;
72
+ readonly run: (input: Input["Type"], context: ToolExecutionContext) => Effect.Effect<Output["Type"], unknown, any>;
73
+ }
74
+ export interface DynamicToolOptions {
75
+ readonly description: string;
76
+ readonly inputSchema: Shared.JsonValue;
77
+ readonly outputSchema: Shared.JsonValue;
78
+ readonly permissions?: ReadonlyArray<Tool.Permission> | undefined;
79
+ readonly requiredPermissions?: ReadonlyArray<string> | undefined;
80
+ readonly requirements?: ReadonlyArray<Tool.RuntimeRequirement> | undefined;
81
+ readonly needsApproval?: boolean | undefined;
82
+ readonly metadata?: Shared.Metadata | undefined;
83
+ readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, unknown, any>;
62
84
  }
63
85
  export interface RunInput {
64
86
  readonly executionId: Ids.ExecutionId;
@@ -73,18 +95,23 @@ export interface Interface {
73
95
  readonly register: (tool: RegisteredTool) => Effect.Effect<void>;
74
96
  readonly definitions: Effect.Effect<ReadonlyArray<Tool.Definition>>;
75
97
  readonly registeredTools: Effect.Effect<ReadonlyArray<RegisteredTool>>;
76
- readonly run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError>;
98
+ readonly run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, any>;
77
99
  }
78
100
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/ToolRuntime", Interface>;
79
101
  export declare class Service extends Service_base {
80
102
  }
81
- export declare const aiToolFromRegistered: (tool: RegisteredTool) => Ai.Tool.Any;
82
- export declare const definitionFromAiTool: (tool: Ai.Tool.Any, permissions?: ReadonlyArray<Tool.Permission>) => Tool.Definition;
103
+ export declare const toolFromRegistered: (tool: RegisteredTool) => Ai.Tool.Any;
104
+ export declare const tool: <const Name extends string, Input extends Schema.Constraint, Output extends Schema.Constraint>(name: Name, options: ToolOptions<Input, Output>) => RegisteredTool & {
105
+ readonly name: Name;
106
+ };
107
+ export declare const dynamicTool: <const Name extends string>(name: Name, options: DynamicToolOptions) => RegisteredTool & {
108
+ readonly name: Name;
109
+ };
83
110
  export declare const layer: (initialTools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLog.Service | WaitService.Service>;
84
111
  export declare const memoryLayer: (tools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, never>;
85
112
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
86
- export declare const register: (tool: RegisteredTool) => Effect.Effect<void, never, Service>;
113
+ export declare const register: (registeredTool: RegisteredTool) => Effect.Effect<void, never, Service>;
87
114
  export declare const definitions: () => Effect.Effect<readonly Tool.Definition[], never, Service>;
88
115
  export declare const registeredTools: () => Effect.Effect<readonly RegisteredTool[], never, Service>;
89
- export declare const run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, Service>;
116
+ export declare const run: (input: RunInput) => Effect.Effect<Tool.Result, ToolNotRegistered | ToolPermissionDenied | ToolInputInvalid | ToolExecutionFailed | ToolExecutionWaitRequested | ToolRuntimeError, any>;
90
117
  export {};
@@ -78,8 +78,8 @@ export declare const StartInput: Schema.Struct<{
78
78
  readonly event_sequence: Schema.Int;
79
79
  readonly started_at: Schema.Int;
80
80
  readonly completed_at: Schema.Int;
81
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
82
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
81
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
82
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
83
83
  }>;
84
84
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
85
85
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -321,8 +321,8 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
321
321
  readonly event_sequence: Schema.Int;
322
322
  readonly started_at: Schema.Int;
323
323
  readonly completed_at: Schema.Int;
324
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
325
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
324
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
325
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
326
326
  }>;
327
327
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
328
328
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { AgentDefinitionId, SkillDefinitionId } from "./ids-schema";
2
+ import { AgentId, SkillDefinitionId } from "./ids-schema";
3
3
  import { Metadata, NonEmptyString } from "./shared-schema";
4
4
  import { Permission } from "./tool-schema";
5
5
  export declare const DefinitionRevision: Schema.Int;
@@ -140,7 +140,7 @@ export type ToolRef = {
140
140
  readonly name: string;
141
141
  } & Readonly<Record<string, unknown>>);
142
142
  export interface DefineInput {
143
- readonly id: AgentDefinitionId;
143
+ readonly id: AgentId;
144
144
  readonly name: NonEmptyString;
145
145
  readonly instructions?: string;
146
146
  readonly model: ModelSelection;
@@ -158,8 +158,8 @@ export interface DefineInput {
158
158
  }
159
159
  export declare const define: (input: DefineInput) => RegisterDefinitionPayload;
160
160
  export declare const DefinitionRecord: Schema.Struct<{
161
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
162
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
161
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
162
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
163
163
  };
164
164
  readonly current_revision: Schema.Int;
165
165
  readonly definition: Schema.Struct<{
@@ -224,8 +224,8 @@ export declare const DefinitionRecord: Schema.Struct<{
224
224
  export interface DefinitionRecord extends Schema.Schema.Type<typeof DefinitionRecord> {
225
225
  }
226
226
  export declare const DefinitionRevisionRecord: Schema.Struct<{
227
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
228
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
227
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
228
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
229
229
  };
230
230
  readonly revision: Schema.Int;
231
231
  readonly definition: Schema.Struct<{
@@ -289,8 +289,8 @@ export declare const DefinitionRevisionRecord: Schema.Struct<{
289
289
  export interface DefinitionRevisionRecord extends Schema.Schema.Type<typeof DefinitionRevisionRecord> {
290
290
  }
291
291
  export declare const RegisterDefinitionPayload: Schema.Struct<{
292
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
293
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
292
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
293
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
294
294
  };
295
295
  readonly definition: Schema.Struct<{
296
296
  readonly name: Schema.String;
@@ -352,8 +352,8 @@ export interface RegisterDefinitionPayload extends Schema.Schema.Type<typeof Reg
352
352
  }
353
353
  export declare const DefinitionRegistered: Schema.Struct<{
354
354
  readonly record: Schema.Struct<{
355
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
356
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
355
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
356
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
357
357
  };
358
358
  readonly current_revision: Schema.Int;
359
359
  readonly definition: Schema.Struct<{
@@ -420,8 +420,8 @@ export interface DefinitionRegistered extends Schema.Schema.Type<typeof Definiti
420
420
  }
421
421
  export declare const DefinitionList: Schema.Struct<{
422
422
  readonly records: Schema.$Array<Schema.Struct<{
423
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
424
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
423
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
424
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
425
425
  };
426
426
  readonly current_revision: Schema.Int;
427
427
  readonly definition: Schema.Struct<{
@@ -488,8 +488,8 @@ export interface DefinitionList extends Schema.Schema.Type<typeof DefinitionList
488
488
  }
489
489
  export declare const DefinitionRevisionList: Schema.Struct<{
490
490
  readonly records: Schema.$Array<Schema.Struct<{
491
- readonly id: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
492
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
491
+ readonly id: Schema.brand<Schema.String, "Relay.AgentId"> & {
492
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
493
493
  };
494
494
  readonly revision: Schema.Int;
495
495
  readonly definition: Schema.Struct<{
@@ -12,8 +12,8 @@ export declare const Execution: Schema.Struct<{
12
12
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SessionId">;
13
13
  }>;
14
14
  readonly status: Schema.Literals<readonly ["queued", "running", "waiting", "completed", "failed", "cancelled"]>;
15
- readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
16
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
15
+ readonly agent_definition_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.AgentId"> & {
16
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
17
17
  }>;
18
18
  readonly agent_definition_revision: Schema.optionalKey<Schema.Int>;
19
19
  readonly agent_definition_snapshot: Schema.optionalKey<Schema.Struct<{
@@ -12,10 +12,10 @@ export declare const AddressBookEntryId: Schema.brand<Schema.String, "Relay.Addr
12
12
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AddressBookEntryId">;
13
13
  };
14
14
  export type AddressBookEntryId = typeof AddressBookEntryId.Type;
15
- export declare const AgentDefinitionId: Schema.brand<Schema.String, "Relay.AgentDefinitionId"> & {
16
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">;
15
+ export declare const AgentId: Schema.brand<Schema.String, "Relay.AgentId"> & {
16
+ make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
17
17
  };
18
- export type AgentDefinitionId = typeof AgentDefinitionId.Type;
18
+ export type AgentId = typeof AgentId.Type;
19
19
  export declare const SkillDefinitionId: Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
20
20
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
21
21
  };
@@ -7,7 +7,7 @@ declare const AgentDefinitionRepositoryError_base: Schema.Class<AgentDefinitionR
7
7
  export declare class AgentDefinitionRepositoryError extends AgentDefinitionRepositoryError_base {
8
8
  }
9
9
  export interface AgentDefinitionRecord {
10
- readonly id: Ids.AgentDefinitionId;
10
+ readonly id: Ids.AgentId;
11
11
  readonly currentRevision: Agent.DefinitionRevision;
12
12
  readonly definition: Agent.Definition;
13
13
  readonly toolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
@@ -15,28 +15,28 @@ export interface AgentDefinitionRecord {
15
15
  readonly updatedAt: number;
16
16
  }
17
17
  export interface AgentDefinitionRevisionRecord {
18
- readonly id: Ids.AgentDefinitionId;
18
+ readonly id: Ids.AgentId;
19
19
  readonly revision: Agent.DefinitionRevision;
20
20
  readonly definition: Agent.Definition;
21
21
  readonly toolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
22
22
  readonly createdAt: number;
23
23
  }
24
24
  export interface PutAgentDefinitionInput {
25
- readonly id: Ids.AgentDefinitionId;
25
+ readonly id: Ids.AgentId;
26
26
  readonly definition: Agent.Definition;
27
27
  readonly toolInputSchemaDigests?: Agent.ToolInputSchemaDigests;
28
28
  readonly now: number;
29
29
  }
30
30
  export interface GetAgentDefinitionRevisionInput {
31
- readonly id: Ids.AgentDefinitionId;
31
+ readonly id: Ids.AgentId;
32
32
  readonly revision: Agent.DefinitionRevision;
33
33
  }
34
34
  export interface Interface {
35
35
  readonly put: (input: PutAgentDefinitionInput) => Effect.Effect<AgentDefinitionRecord, AgentDefinitionRepositoryError>;
36
- readonly get: (id: Ids.AgentDefinitionId) => Effect.Effect<AgentDefinitionRecord | undefined, AgentDefinitionRepositoryError>;
36
+ readonly get: (id: Ids.AgentId) => Effect.Effect<AgentDefinitionRecord | undefined, AgentDefinitionRepositoryError>;
37
37
  readonly getRevision: (input: GetAgentDefinitionRevisionInput) => Effect.Effect<AgentDefinitionRevisionRecord | undefined, AgentDefinitionRepositoryError>;
38
38
  readonly list: () => Effect.Effect<ReadonlyArray<AgentDefinitionRecord>, AgentDefinitionRepositoryError>;
39
- readonly listRevisions: (id: Ids.AgentDefinitionId) => Effect.Effect<ReadonlyArray<AgentDefinitionRevisionRecord>, AgentDefinitionRepositoryError>;
39
+ readonly listRevisions: (id: Ids.AgentId) => Effect.Effect<ReadonlyArray<AgentDefinitionRevisionRecord>, AgentDefinitionRepositoryError>;
40
40
  }
41
41
  declare const Service_base: Context.ServiceClass<Service, "@relayfx/store-sql/AgentDefinitionRepository", Interface>;
42
42
  export declare class Service extends Service_base {
@@ -60,8 +60,8 @@ export declare const layer: Layer.Layer<Service, never, SqlClient.SqlClient>;
60
60
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
61
61
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
62
62
  export declare const put: (input: PutAgentDefinitionInput) => Effect.Effect<AgentDefinitionRecord, AgentDefinitionRepositoryError, Service>;
63
- export declare const get: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<AgentDefinitionRecord | undefined, AgentDefinitionRepositoryError, Service>;
63
+ export declare const get: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<AgentDefinitionRecord | undefined, AgentDefinitionRepositoryError, Service>;
64
64
  export declare const getRevision: (input: GetAgentDefinitionRevisionInput) => Effect.Effect<AgentDefinitionRevisionRecord | undefined, AgentDefinitionRepositoryError, Service>;
65
65
  export declare const list: () => Effect.Effect<readonly AgentDefinitionRecord[], AgentDefinitionRepositoryError, Service>;
66
- export declare const listRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentDefinitionId">) => Effect.Effect<readonly AgentDefinitionRevisionRecord[], AgentDefinitionRepositoryError, Service>;
66
+ export declare const listRevisions: (id: string & import("effect/Brand").Brand<"Relay.AgentId">) => Effect.Effect<readonly AgentDefinitionRevisionRecord[], AgentDefinitionRepositoryError, Service>;
67
67
  export {};