@relayfx/sdk 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/ai.js +2050 -576
  2. package/dist/index.js +2879 -859
  3. package/dist/migrations/20260709214238_faithful_black_widow/migration.sql +53 -0
  4. package/dist/migrations/20260709214238_faithful_black_widow/snapshot.json +5426 -0
  5. package/dist/migrations/20260709220016_fearless_aaron_stack/migration.sql +2 -0
  6. package/dist/migrations/20260709220016_fearless_aaron_stack/snapshot.json +5426 -0
  7. package/dist/migrations/mysql/0002_durable_tool_placement.sql +75 -0
  8. package/dist/migrations/pg/20260709214238_faithful_black_widow/migration.sql +53 -0
  9. package/dist/migrations/pg/20260709214238_faithful_black_widow/snapshot.json +5426 -0
  10. package/dist/migrations/pg/20260709220016_fearless_aaron_stack/migration.sql +2 -0
  11. package/dist/migrations/pg/20260709220016_fearless_aaron_stack/snapshot.json +5426 -0
  12. package/dist/migrations/sqlite/0002_durable_tool_placement.sql +71 -0
  13. package/dist/types/relay/client.d.ts +27 -6
  14. package/dist/types/relay/index.d.ts +1 -0
  15. package/dist/types/relay/operation.d.ts +525 -53
  16. package/dist/types/relay/tool-worker.d.ts +19 -0
  17. package/dist/types/runtime/address/address-resolution-service.d.ts +69 -54
  18. package/dist/types/runtime/agent/relay-compaction.d.ts +1 -0
  19. package/dist/types/runtime/cluster/execution-entity.d.ts +10 -477
  20. package/dist/types/runtime/execution/event-log-service.d.ts +6 -0
  21. package/dist/types/runtime/index.d.ts +1 -0
  22. package/dist/types/runtime/runner/runner-runtime-service.d.ts +18 -15
  23. package/dist/types/runtime/tool/tool-runtime-service.d.ts +17 -1
  24. package/dist/types/runtime/tool/tool-transition-coordinator.d.ts +13 -0
  25. package/dist/types/runtime/workflow/execution-workflow.d.ts +146 -114
  26. package/dist/types/schema/agent-schema.d.ts +431 -320
  27. package/dist/types/schema/execution-schema.d.ts +69 -53
  28. package/dist/types/schema/ids-schema.d.ts +4 -0
  29. package/dist/types/schema/tool-schema.d.ts +29 -0
  30. package/dist/types/store-sql/envelope/envelope-repository.d.ts +6 -0
  31. package/dist/types/store-sql/execution/execution-event-repository.d.ts +6 -0
  32. package/dist/types/store-sql/schema/relay-schema.d.ts +386 -7
  33. package/dist/types/store-sql/tool/tool-call-repository.d.ts +160 -1
  34. package/package.json +3 -3
@@ -1,11 +1,12 @@
1
- import { Ids } from "../../schema/index";
2
- import { ChildExecutionRepository, ExecutionRepository } from "../../store-sql/index";
1
+ import { Agent, Ids } from "../../schema/index";
2
+ import { ChildExecutionRepository, EnvelopeRepository, ExecutionRepository, ToolCallRepository } from "../../store-sql/index";
3
3
  import { Workflow } from "effect/unstable/workflow";
4
4
  import { Effect, Layer, Option, Schema } from "effect";
5
5
  import { Service as AgentLoopService } from "../agent/agent-loop-service";
6
6
  import { ChildTerminalStatus } from "../child/parent-notifier-service";
7
7
  import { Service as EventLogService } from "../execution/event-log-service";
8
8
  import { Service as ToolRuntimeService } from "../tool/tool-runtime-service";
9
+ import { Service as ToolTransitionCoordinatorService } from "../tool/tool-transition-coordinator";
9
10
  declare const ExecutionWorkflowFailed_base: Schema.Class<ExecutionWorkflowFailed, Schema.TaggedStruct<"ExecutionWorkflowFailed", {
10
11
  readonly message: Schema.String;
11
12
  }>, import("effect/Cause").YieldableError>;
@@ -77,61 +78,76 @@ export declare const StartInput: Schema.Struct<{
77
78
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
78
79
  }>;
79
80
  readonly agent_revision: Schema.optionalKey<Schema.Int>;
80
- readonly agent_snapshot: Schema.optionalKey<Schema.Struct<{
81
- readonly name: Schema.String;
82
- readonly instructions: Schema.optionalKey<Schema.String>;
83
- readonly model: Schema.Struct<{
84
- readonly provider: Schema.String;
85
- readonly model: Schema.String;
86
- readonly registration_key: Schema.optionalKey<Schema.String>;
87
- readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
88
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
89
- }>;
90
- readonly tool_names: Schema.$Array<Schema.String>;
91
- readonly permissions: Schema.$Array<Schema.Struct<{
92
- readonly name: Schema.String;
93
- readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
94
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
95
- }>>;
96
- readonly skill_definition_ids: Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
97
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
98
- }>>;
99
- readonly permission_rules: Schema.optionalKey<Schema.Struct<{
100
- readonly rules: Schema.$Array<Schema.Struct<{
101
- readonly pattern: Schema.String;
102
- readonly level: Schema.Literals<readonly ["allow", "deny", "ask"]>;
103
- readonly reason: Schema.optionalKey<Schema.String>;
104
- }>>;
105
- readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["allow", "deny", "ask"]>>;
106
- }>>;
107
- readonly max_tool_turns: Schema.optionalKey<Schema.Int>;
108
- readonly max_wait_turns: Schema.optionalKey<Schema.Int>;
109
- readonly token_budget: Schema.optionalKey<Schema.Int>;
110
- readonly child_run_presets: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
111
- readonly instructions: Schema.optionalKey<Schema.String>;
112
- readonly model: Schema.optionalKey<Schema.Struct<{
113
- readonly provider: Schema.String;
114
- readonly model: Schema.String;
115
- readonly registration_key: Schema.optionalKey<Schema.String>;
116
- readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
117
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
118
- }>>;
119
- readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
120
- readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
121
- readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
122
- readonly mode: Schema.Literals<readonly ["share", "fork"]>;
123
- readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "fresh"]>>;
124
- }>>;
125
- readonly output_schema_ref: Schema.optionalKey<Schema.String>;
126
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
127
- }>>>;
128
- readonly handoff_targets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
81
+ readonly agent_snapshot: Schema.optionalKey<Schema.Codec<Agent.Definition, {
82
+ readonly name: string;
83
+ readonly permissions: readonly {
84
+ readonly name: string;
85
+ readonly value: Schema.Json;
86
+ readonly metadata?: {
87
+ readonly [x: string]: Schema.Json;
88
+ };
89
+ }[];
90
+ readonly model: {
91
+ readonly provider: string;
92
+ readonly model: string;
93
+ readonly metadata?: {
94
+ readonly [x: string]: Schema.Json;
95
+ };
96
+ readonly registration_key?: string;
97
+ readonly request_options?: {
98
+ readonly [x: string]: Schema.Json;
99
+ };
100
+ };
101
+ readonly tool_names: readonly string[];
102
+ readonly metadata?: {
103
+ readonly [x: string]: Schema.Json;
104
+ };
105
+ readonly instructions?: string;
106
+ readonly output_schema_ref?: string;
107
+ readonly skill_definition_ids?: readonly string[];
108
+ readonly permission_rules?: {
109
+ readonly rules: readonly {
110
+ readonly pattern: string;
111
+ readonly level: "allow" | "deny" | "ask";
112
+ readonly reason?: string;
113
+ }[];
114
+ readonly fallback?: "allow" | "deny" | "ask";
115
+ };
116
+ readonly turn_policy?: Agent.TurnPolicySnapshot;
117
+ readonly max_tool_turns?: number;
118
+ readonly max_wait_turns?: number;
119
+ readonly token_budget?: number;
120
+ readonly child_run_presets?: {
121
+ readonly [x: string]: {
122
+ readonly metadata?: {
123
+ readonly [x: string]: Schema.Json;
124
+ };
125
+ readonly permissions?: readonly string[];
126
+ readonly model?: {
127
+ readonly provider: string;
128
+ readonly model: string;
129
+ readonly metadata?: {
130
+ readonly [x: string]: Schema.Json;
131
+ };
132
+ readonly registration_key?: string;
133
+ readonly request_options?: {
134
+ readonly [x: string]: Schema.Json;
135
+ };
136
+ };
137
+ readonly instructions?: string;
138
+ readonly tool_names?: readonly string[];
139
+ readonly workspace_policy?: {
140
+ readonly mode: "share" | "fork";
141
+ readonly fallback?: "fail" | "fresh";
142
+ };
143
+ readonly output_schema_ref?: string;
144
+ };
145
+ };
146
+ readonly handoff_targets?: readonly Schema.Struct.ReadonlySide<{
129
147
  readonly name: Schema.String;
130
148
  readonly preset_name: Schema.String;
131
- }>>>;
132
- readonly output_schema_ref: Schema.optionalKey<Schema.String>;
133
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
134
- }>>;
149
+ }, "Encoded">[];
150
+ }, never, never>>;
135
151
  readonly agent_tool_input_schema_digests: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
136
152
  readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
137
153
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
@@ -320,61 +336,76 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
320
336
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.AgentId">;
321
337
  }>;
322
338
  readonly agent_revision: Schema.optionalKey<Schema.Int>;
323
- readonly agent_snapshot: Schema.optionalKey<Schema.Struct<{
324
- readonly name: Schema.String;
325
- readonly instructions: Schema.optionalKey<Schema.String>;
326
- readonly model: Schema.Struct<{
327
- readonly provider: Schema.String;
328
- readonly model: Schema.String;
329
- readonly registration_key: Schema.optionalKey<Schema.String>;
330
- readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
331
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
332
- }>;
333
- readonly tool_names: Schema.$Array<Schema.String>;
334
- readonly permissions: Schema.$Array<Schema.Struct<{
335
- readonly name: Schema.String;
336
- readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
337
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
338
- }>>;
339
- readonly skill_definition_ids: Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Relay.SkillDefinitionId"> & {
340
- make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.SkillDefinitionId">;
341
- }>>;
342
- readonly permission_rules: Schema.optionalKey<Schema.Struct<{
343
- readonly rules: Schema.$Array<Schema.Struct<{
344
- readonly pattern: Schema.String;
345
- readonly level: Schema.Literals<readonly ["allow", "deny", "ask"]>;
346
- readonly reason: Schema.optionalKey<Schema.String>;
347
- }>>;
348
- readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["allow", "deny", "ask"]>>;
349
- }>>;
350
- readonly max_tool_turns: Schema.optionalKey<Schema.Int>;
351
- readonly max_wait_turns: Schema.optionalKey<Schema.Int>;
352
- readonly token_budget: Schema.optionalKey<Schema.Int>;
353
- readonly child_run_presets: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
354
- readonly instructions: Schema.optionalKey<Schema.String>;
355
- readonly model: Schema.optionalKey<Schema.Struct<{
356
- readonly provider: Schema.String;
357
- readonly model: Schema.String;
358
- readonly registration_key: Schema.optionalKey<Schema.String>;
359
- readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
360
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
361
- }>>;
362
- readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
363
- readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
364
- readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
365
- readonly mode: Schema.Literals<readonly ["share", "fork"]>;
366
- readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "fresh"]>>;
367
- }>>;
368
- readonly output_schema_ref: Schema.optionalKey<Schema.String>;
369
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
370
- }>>>;
371
- readonly handoff_targets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
339
+ readonly agent_snapshot: Schema.optionalKey<Schema.Codec<Agent.Definition, {
340
+ readonly name: string;
341
+ readonly permissions: readonly {
342
+ readonly name: string;
343
+ readonly value: Schema.Json;
344
+ readonly metadata?: {
345
+ readonly [x: string]: Schema.Json;
346
+ };
347
+ }[];
348
+ readonly model: {
349
+ readonly provider: string;
350
+ readonly model: string;
351
+ readonly metadata?: {
352
+ readonly [x: string]: Schema.Json;
353
+ };
354
+ readonly registration_key?: string;
355
+ readonly request_options?: {
356
+ readonly [x: string]: Schema.Json;
357
+ };
358
+ };
359
+ readonly tool_names: readonly string[];
360
+ readonly metadata?: {
361
+ readonly [x: string]: Schema.Json;
362
+ };
363
+ readonly instructions?: string;
364
+ readonly output_schema_ref?: string;
365
+ readonly skill_definition_ids?: readonly string[];
366
+ readonly permission_rules?: {
367
+ readonly rules: readonly {
368
+ readonly pattern: string;
369
+ readonly level: "allow" | "deny" | "ask";
370
+ readonly reason?: string;
371
+ }[];
372
+ readonly fallback?: "allow" | "deny" | "ask";
373
+ };
374
+ readonly turn_policy?: Agent.TurnPolicySnapshot;
375
+ readonly max_tool_turns?: number;
376
+ readonly max_wait_turns?: number;
377
+ readonly token_budget?: number;
378
+ readonly child_run_presets?: {
379
+ readonly [x: string]: {
380
+ readonly metadata?: {
381
+ readonly [x: string]: Schema.Json;
382
+ };
383
+ readonly permissions?: readonly string[];
384
+ readonly model?: {
385
+ readonly provider: string;
386
+ readonly model: string;
387
+ readonly metadata?: {
388
+ readonly [x: string]: Schema.Json;
389
+ };
390
+ readonly registration_key?: string;
391
+ readonly request_options?: {
392
+ readonly [x: string]: Schema.Json;
393
+ };
394
+ };
395
+ readonly instructions?: string;
396
+ readonly tool_names?: readonly string[];
397
+ readonly workspace_policy?: {
398
+ readonly mode: "share" | "fork";
399
+ readonly fallback?: "fail" | "fresh";
400
+ };
401
+ readonly output_schema_ref?: string;
402
+ };
403
+ };
404
+ readonly handoff_targets?: readonly Schema.Struct.ReadonlySide<{
372
405
  readonly name: Schema.String;
373
406
  readonly preset_name: Schema.String;
374
- }>>>;
375
- readonly output_schema_ref: Schema.optionalKey<Schema.String>;
376
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
377
- }>>;
407
+ }, "Encoded">[];
408
+ }, never, never>>;
378
409
  readonly agent_tool_input_schema_digests: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
379
410
  readonly wait_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.WaitId"> & {
380
411
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.WaitId">;
@@ -401,12 +432,12 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
401
432
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
402
433
  }>, typeof ExecutionWorkflowFailed>;
403
434
  export declare const sessionEntryScope: (input: StartInput, turn: number) => string;
404
- export declare const layer: Layer.Layer<never, never, ChildExecutionRepository.Service | ExecutionRepository.Service | EventLogService | import("../wait/wait-service").Service | ToolRuntimeService | import("../address/address-resolution-service").Service | AgentLoopService | import("../skill/skill-registry-service").Service | import("../execution/execution-service").Service | import("../workspace/workspace-planner-service").Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
435
+ export declare const layer: Layer.Layer<never, never, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service | EventLogService | import("../wait/wait-service").Service | ToolRuntimeService | import("../address/address-resolution-service").Service | AgentLoopService | import("../skill/skill-registry-service").Service | import("../execution/execution-service").Service | ToolTransitionCoordinatorService | import("../workspace/workspace-planner-service").Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
405
436
  export declare const start: <const Discard extends boolean = false>(input: StartInput, options?: {
406
437
  readonly discard?: Discard;
407
438
  }) => Effect.Effect<Discard extends true ? string : {
408
439
  readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
409
- readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
440
+ readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
410
441
  readonly metadata?: {
411
442
  readonly [x: string]: Schema.Json;
412
443
  };
@@ -415,20 +446,21 @@ export declare const start: <const Discard extends boolean = false>(input: Start
415
446
  }, Discard extends true ? never : ExecutionWorkflowFailed, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
416
447
  export declare const startRequest: (input: StartInput) => Effect.Effect<{
417
448
  readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
418
- readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
449
+ readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
419
450
  readonly metadata?: {
420
451
  readonly [x: string]: Schema.Json;
421
452
  };
422
453
  readonly wait_id?: string & import("effect/Brand").Brand<"Relay.WaitId">;
423
454
  readonly wait_state?: "cancelled" | "resolved" | "timed_out";
424
455
  }, ExecutionWorkflowFailed, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
456
+ export declare const dispatchRequest: (input: StartInput) => Effect.Effect<void, never, import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
425
457
  export declare const cancelRequest: (input: CancelExecutionInput) => Effect.Effect<{
426
458
  execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
427
- status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
428
- }, ExecutionWorkflowFailed, ChildExecutionRepository.Service | ExecutionRepository.Service | EventLogService | import("../wait/wait-service").Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
459
+ status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
460
+ }, ExecutionWorkflowFailed, ChildExecutionRepository.Service | EnvelopeRepository.Service | ExecutionRepository.Service | ToolCallRepository.Service | EventLogService | import("../wait/wait-service").Service | ToolTransitionCoordinatorService | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine>;
429
461
  export declare const poll: (executionId: string) => Effect.Effect<Option.Option<Workflow.Result<{
430
462
  readonly execution_id: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
431
- readonly status: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
463
+ readonly status: "waiting" | "running" | "completed" | "failed" | "queued" | "cancelled";
432
464
  readonly metadata?: {
433
465
  readonly [x: string]: Schema.Json;
434
466
  };