@relayfx/sdk 0.2.11 → 0.2.13

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.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  __export,
4
4
  exports_model_registry
5
- } from "./index-fhqr1n44.js";
5
+ } from "./index-3e4cs8s6.js";
6
6
 
7
7
  // ../ai/src/language-model/language-model-registration.ts
8
8
  var exports_language_model_registration = {};
@@ -24,7 +24,7 @@ __export(exports_language_model_registration, {
24
24
  anthropic: () => anthropic
25
25
  });
26
26
 
27
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/anthropic.js
27
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/anthropic.js
28
28
  import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
29
29
  import { Config, Layer, Redacted } from "effect";
30
30
  import { FetchHttpClient } from "effect/unstable/http";
@@ -40,13 +40,13 @@ var anthropic = (input) => exports_model_registry.registrationFromLayer({
40
40
  });
41
41
  var anthropicClientLayerConfig = AnthropicClient.layerConfig;
42
42
  var withAnthropic = (options) => exports_model_registry.layerFromRegistrationEffects([anthropic(options)]).pipe(Layer.provide(AnthropicClient.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer.provide(FetchHttpClient.layer));
43
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/deterministic.js
43
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/deterministic.js
44
44
  import { OpenAiClient as OpenAiClient2 } from "@effect/ai-openai";
45
45
  import { Effect, Layer as Layer3, Option, Stream } from "effect";
46
46
  import { LanguageModel, Response } from "effect/unstable/ai";
47
47
  import { FetchHttpClient as FetchHttpClient3 } from "effect/unstable/http";
48
48
 
49
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/openai.js
49
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/openai.js
50
50
  import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai";
51
51
  import { Config as Config2, Layer as Layer2, Redacted as Redacted2 } from "effect";
52
52
  import { FetchHttpClient as FetchHttpClient2 } from "effect/unstable/http";
@@ -63,7 +63,7 @@ var openAi = (input) => exports_model_registry.registrationFromLayer({
63
63
  var openAiClientLayerConfig = OpenAiClient.layerConfig;
64
64
  var withOpenAi = (options) => exports_model_registry.layerFromRegistrationEffects([openAi(options)]).pipe(Layer2.provide(OpenAiClient.layerConfig({ ...options.clientConfig, apiKey: options.apiKey })), Layer2.provide(FetchHttpClient2.layer));
65
65
 
66
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/deterministic.js
66
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/deterministic.js
67
67
  var deterministicModelLayer = Layer3.effect(LanguageModel.LanguageModel, LanguageModel.make({
68
68
  generateText: () => Effect.succeed([{ type: "text", text: "deterministic response" }]),
69
69
  streamText: () => Stream.make(Response.makePart("text-delta", { id: "text", delta: "deterministic response" }))
@@ -87,7 +87,7 @@ var withOpenAiOrDeterministic = (options) => Layer3.unwrap(Effect.gen(function*
87
87
  ...Option.isSome(openAiRegistration) ? [openAiRegistration.value] : []
88
88
  ]);
89
89
  }));
90
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/openai-compat.js
90
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/openai-compat.js
91
91
  import { OpenAiClient as OpenAiClient3, OpenAiLanguageModel as OpenAiLanguageModel2 } from "@effect/ai-openai-compat";
92
92
  import { Config as Config3, Layer as Layer4, Redacted as Redacted3 } from "effect";
93
93
  import { FetchHttpClient as FetchHttpClient4 } from "effect/unstable/http";
@@ -108,7 +108,7 @@ var clientLayerConfig = (options) => OpenAiClient3.layerConfig({
108
108
  ...options.baseUrl === undefined ? {} : { apiUrl: Config3.succeed(options.baseUrl) }
109
109
  });
110
110
  var withOpenAiCompatible = (options) => exports_model_registry.layerFromRegistrationEffects([openAiCompatible(options)]).pipe(Layer4.provide(clientLayerConfig(options)), Layer4.provide(FetchHttpClient4.layer));
111
- // ../../node_modules/.bun/@batonfx+providers@0.4.2/node_modules/@batonfx/providers/dist/openrouter.js
111
+ // ../../node_modules/.bun/@batonfx+providers@0.4.3/node_modules/@batonfx/providers/dist/openrouter.js
112
112
  import { OpenRouterClient, OpenRouterLanguageModel } from "@effect/ai-openrouter";
113
113
  import { Config as Config4, Layer as Layer5, Redacted as Redacted4 } from "effect";
114
114
  import { FetchHttpClient as FetchHttpClient5 } from "effect/unstable/http";
@@ -48,7 +48,7 @@ import {
48
48
  exports_wait_service,
49
49
  exports_wait_signal,
50
50
  exports_workflow_definition_repository
51
- } from "./index-fhqr1n44.js";
51
+ } from "./index-3e4cs8s6.js";
52
52
 
53
53
  // src/operation.ts
54
54
  var exports_operation = {};
@@ -416,6 +416,7 @@ var SpawnChildRunInput = Schema.Struct({
416
416
  preset_name: Schema.optionalKey(exports_shared_schema.NonEmptyString),
417
417
  instructions: Schema.optionalKey(Schema.String),
418
418
  model: Schema.optionalKey(exports_agent_schema.ModelSelection),
419
+ compaction_policy: Schema.optionalKey(exports_agent_schema.CompactionPolicy),
419
420
  tool_names: Schema.optionalKey(Schema.Array(Schema.String)),
420
421
  permissions: Schema.optionalKey(Schema.Array(Schema.String)),
421
422
  workspace_policy: Schema.optionalKey(exports_agent_schema.ChildRunWorkspacePolicy),
@@ -1042,7 +1043,7 @@ var startExecutionByAgentDefinitionPayload = (input, definition) => ({
1042
1043
  started_at: input.started_at,
1043
1044
  completed_at: input.completed_at,
1044
1045
  agent_id: input.agent_id,
1045
- agent_revision: definition.current_revision,
1046
+ agent_revision: definition.revision,
1046
1047
  agent_snapshot: definition.definition,
1047
1048
  ...definition.tool_input_schema_digests === undefined ? {} : { agent_tool_input_schema_digests: definition.tool_input_schema_digests },
1048
1049
  ...input.wait_id === undefined ? {} : { wait_id: input.wait_id },
@@ -1146,6 +1147,7 @@ var registerAgentPayload = Effect.fn("Client.registerAgentPayload")(function* (i
1146
1147
  permissions: input.permissions ?? [],
1147
1148
  ...input.skill_definition_ids === undefined ? {} : { skill_definition_ids: input.skill_definition_ids },
1148
1149
  ...input.permission_rules === undefined ? {} : { permission_rules: input.permission_rules },
1150
+ ...input.compaction_policy === undefined ? {} : { compaction_policy: input.compaction_policy },
1149
1151
  ...turnPolicy,
1150
1152
  ...input.max_wait_turns === undefined ? {} : { max_wait_turns: input.max_wait_turns },
1151
1153
  ...input.token_budget === undefined ? {} : { token_budget: input.token_budget },
@@ -1155,7 +1157,6 @@ var registerAgentPayload = Effect.fn("Client.registerAgentPayload")(function* (i
1155
1157
  ...metadata === undefined ? {} : { metadata }
1156
1158
  });
1157
1159
  });
1158
- var agentDefinitionNotFound = (id) => new ClientError({ message: `Agent not found: ${id}` });
1159
1160
  var wakeMetadata = (input) => ({
1160
1161
  ...input.metadata,
1161
1162
  ...input.from === undefined ? {} : { from: input.from },
@@ -1336,6 +1337,7 @@ var childExecutionIdForSpawn = (input) => input.child_execution_id ?? exports_id
1336
1337
  var parentContextFromDefinition = (definition, fingerprint) => ({
1337
1338
  ...definition.instructions === undefined ? {} : { instructions: definition.instructions },
1338
1339
  model: definition.model,
1340
+ ...definition.compaction_policy === undefined ? {} : { compaction_policy: definition.compaction_policy },
1339
1341
  tool_names: definition.tool_names,
1340
1342
  permissions: definition.permissions.map((permission) => permission.name),
1341
1343
  ...definition.output_schema_ref === undefined ? {} : { output_schema_ref: definition.output_schema_ref },
@@ -1350,6 +1352,7 @@ var internalSpawnChildRunInput = (input, pin, createdAt) => ({
1350
1352
  ...input.preset_name === undefined ? {} : { preset_name: input.preset_name },
1351
1353
  ...input.instructions === undefined ? {} : { instructions: input.instructions },
1352
1354
  ...input.model === undefined ? {} : { model: input.model },
1355
+ ...input.compaction_policy === undefined ? {} : { compaction_policy: input.compaction_policy },
1353
1356
  ...input.tool_names === undefined ? {} : { tool_names: input.tool_names },
1354
1357
  ...input.permissions === undefined ? {} : { permissions: input.permissions },
1355
1358
  ...input.workspace_policy === undefined ? {} : { workspace_policy: input.workspace_policy },
@@ -1429,6 +1432,7 @@ var parentDefinitionPin = Effect.fn("Client.parentDefinitionPin")(function* (exe
1429
1432
  var childStartInput = (input, accepted, pin, definition, createdAt, parentWaitId) => ({
1430
1433
  execution_id: exports_ids_schema.ExecutionId.make(accepted.child_execution_id),
1431
1434
  root_address_id: input.address_id,
1435
+ session_id: exports_execution_schema.childSessionId(accepted.child_execution_id),
1432
1436
  input: input.input === undefined ? [] : [...input.input],
1433
1437
  event_sequence: 0,
1434
1438
  started_at: createdAt,
@@ -1689,9 +1693,10 @@ var layerFromRuntime = Layer.effect(Service, Effect.gen(function* () {
1689
1693
  yield* rejectReserved(input.execution_id, "execution:entity:");
1690
1694
  if (input.session_id !== undefined)
1691
1695
  yield* rejectReserved(input.session_id, "session:entity:");
1692
- const definition = yield* agentRegistry.get(input.agent_id).pipe(Effect.mapError(toClientError));
1693
- if (definition === undefined)
1694
- return yield* Effect.fail(agentDefinitionNotFound(input.agent_id));
1696
+ const definition = yield* agentRegistry.getRevision({ id: input.agent_id, revision: input.agent_revision }).pipe(Effect.mapError(toClientError));
1697
+ if (definition === undefined) {
1698
+ return yield* Effect.fail(new ClientError({ message: `Agent revision not found: ${input.agent_id}@${input.agent_revision}` }));
1699
+ }
1695
1700
  const payload = startExecutionByAgentDefinitionPayload(input, definition);
1696
1701
  const client = makeExecutionClient(payload.execution_id);
1697
1702
  return yield* client.start(payload).pipe(Effect.mapError(toClientError));
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_language_model_registration
4
- } from "./index-tpwr0wmj.js";
4
+ } from "./index-kghdnamr.js";
5
5
  import {
6
6
  Service,
7
7
  exports_client,
8
8
  exports_command,
9
9
  exports_operation
10
- } from "./index-jg4xh3fx.js";
10
+ } from "./index-rmaq3qc8.js";
11
11
  import {
12
12
  Dialect,
13
13
  __export,
@@ -59,7 +59,7 @@ import {
59
59
  fromDbTimestamp,
60
60
  fromNullableDbTimestamp,
61
61
  timestampParam
62
- } from "./index-fhqr1n44.js";
62
+ } from "./index-3e4cs8s6.js";
63
63
 
64
64
  // src/adapter-outbox.ts
65
65
  var exports_adapter_outbox = {};
package/dist/sqlite.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exports_client,
4
4
  exports_operation
5
- } from "./index-jg4xh3fx.js";
5
+ } from "./index-rmaq3qc8.js";
6
6
  import {
7
7
  __export,
8
8
  exports_activity_version_registry,
@@ -46,7 +46,7 @@ import {
46
46
  exports_wait_service,
47
47
  exports_workflow_definition_repository,
48
48
  exports_workflow_schema
49
- } from "./index-fhqr1n44.js";
49
+ } from "./index-3e4cs8s6.js";
50
50
  // src/sqlite-runtime.ts
51
51
  var exports_sqlite_runtime = {};
52
52
  __export(exports_sqlite_runtime, {
@@ -64,6 +64,7 @@ export interface StartExecutionByAgentDefinitionInput {
64
64
  readonly root_address_id: Ids.AddressId;
65
65
  readonly session_id?: Ids.SessionId;
66
66
  readonly agent_id: Ids.AgentId;
67
+ readonly agent_revision: Agent.DefinitionRevision;
67
68
  readonly input?: ReadonlyArray<Content.Part>;
68
69
  readonly idempotency_key: Shared.NonEmptyString;
69
70
  readonly execution_id?: Ids.ExecutionId;
@@ -84,6 +85,7 @@ export interface RegisterBatonAgentInput {
84
85
  readonly permissions?: ReadonlyArray<Tool.Permission>;
85
86
  readonly skill_definition_ids?: ReadonlyArray<Ids.SkillDefinitionId>;
86
87
  readonly permission_rules?: Agent.PermissionRuleset;
88
+ readonly compaction_policy?: Agent.CompactionPolicy;
87
89
  readonly max_tool_turns?: number;
88
90
  readonly max_wait_turns?: number;
89
91
  readonly token_budget?: number;
@@ -231,7 +233,7 @@ export declare const followExecution: (input: FollowExecutionInput) => Stream.St
231
233
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
232
234
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
233
235
  }>;
234
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
236
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
235
237
  readonly sequence: Schema.Int;
236
238
  readonly cursor: Schema.String;
237
239
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -351,7 +353,7 @@ export declare const streamSession: (input: StreamSessionInput) => Stream.Stream
351
353
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
352
354
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
353
355
  }>;
354
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
356
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
355
357
  readonly sequence: Schema.Int;
356
358
  readonly cursor: Schema.String;
357
359
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -91,6 +91,11 @@ export declare const StartExecutionInput: Schema.Struct<{
91
91
  readonly [x: string]: Schema.Json;
92
92
  };
93
93
  readonly instructions?: string;
94
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
95
+ readonly context_window: Schema.Number;
96
+ readonly reserve_tokens: Schema.Number;
97
+ readonly keep_recent_tokens: Schema.Number;
98
+ }, "Encoded">;
94
99
  readonly output_schema_ref?: string;
95
100
  readonly skill_definition_ids?: readonly string[];
96
101
  readonly permission_rules?: {
@@ -123,6 +128,11 @@ export declare const StartExecutionInput: Schema.Struct<{
123
128
  };
124
129
  };
125
130
  readonly instructions?: string;
131
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
132
+ readonly context_window: Schema.Number;
133
+ readonly reserve_tokens: Schema.Number;
134
+ readonly keep_recent_tokens: Schema.Number;
135
+ }, "Encoded">;
126
136
  readonly tool_names?: readonly string[];
127
137
  readonly workspace_policy?: {
128
138
  readonly mode: "share" | "fork";
@@ -612,7 +622,7 @@ export declare const FollowExecutionItem: Schema.Union<readonly [Schema.Struct<{
612
622
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
613
623
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
614
624
  }>;
615
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
625
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
616
626
  readonly sequence: Schema.Int;
617
627
  readonly cursor: Schema.String;
618
628
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -1074,6 +1084,11 @@ export declare const SpawnChildRunInput: Schema.Struct<{
1074
1084
  readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1075
1085
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1076
1086
  }>>;
1087
+ readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
1088
+ readonly context_window: Schema.Number;
1089
+ readonly reserve_tokens: Schema.Number;
1090
+ readonly keep_recent_tokens: Schema.Number;
1091
+ }>>;
1077
1092
  readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
1078
1093
  readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
1079
1094
  readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
@@ -1158,6 +1173,11 @@ export declare const CreateChildFanOutInput: Schema.Struct<{
1158
1173
  readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1159
1174
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1160
1175
  }>>;
1176
+ readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
1177
+ readonly context_window: Schema.Number;
1178
+ readonly reserve_tokens: Schema.Number;
1179
+ readonly keep_recent_tokens: Schema.Number;
1180
+ }>>;
1161
1181
  readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
1162
1182
  readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
1163
1183
  readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
@@ -1322,6 +1342,11 @@ export declare const CancelChildFanOutResult: Schema.Struct<{
1322
1342
  readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1323
1343
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1324
1344
  }>>;
1345
+ readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
1346
+ readonly context_window: Schema.Number;
1347
+ readonly reserve_tokens: Schema.Number;
1348
+ readonly keep_recent_tokens: Schema.Number;
1349
+ }>>;
1325
1350
  readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
1326
1351
  readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
1327
1352
  readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
@@ -1485,6 +1510,11 @@ export declare const InspectChildFanOutResult: Schema.Struct<{
1485
1510
  readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1486
1511
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1487
1512
  }>>;
1513
+ readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
1514
+ readonly context_window: Schema.Number;
1515
+ readonly reserve_tokens: Schema.Number;
1516
+ readonly keep_recent_tokens: Schema.Number;
1517
+ }>>;
1488
1518
  readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
1489
1519
  readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
1490
1520
  readonly workspace_policy: Schema.optionalKey<Schema.Struct<{
@@ -2312,7 +2342,7 @@ export declare const SessionStreamItem: Schema.Union<readonly [Schema.TaggedStru
2312
2342
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
2313
2343
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
2314
2344
  }>;
2315
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
2345
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
2316
2346
  readonly sequence: Schema.Int;
2317
2347
  readonly cursor: Schema.String;
2318
2348
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -2623,7 +2653,7 @@ export declare const ReplayExecutionResult: Schema.Struct<{
2623
2653
  readonly child_execution_id: Schema.optionalKey<Schema.brand<Schema.String, "Relay.ChildExecutionId"> & {
2624
2654
  make: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => string & import("effect/Brand").Brand<"Relay.ChildExecutionId">;
2625
2655
  }>;
2626
- readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
2656
+ readonly type: Schema.Literals<readonly ["execution.accepted", "execution.started", "execution.completed", "execution.failed", "execution.cancelled", "model.input.prepared", "model.output.delta", "model.reasoning.delta", "model.toolcall.delta", "model.output.completed", "model.usage.reported", "budget.exceeded", "tool.call.requested", "tool.result.received", "tool.approval.requested", "tool.approval.resolved", "permission.ask.requested", "permission.ask.resolved", "steering.received", "state.updated", "state.deleted", "inbox.enqueued", "inbox.drained", "entity.created", "entity.destroyed", "envelope.accepted", "envelope.routed", "envelope.ready", "delivery.attempt", "wait.created", "wait.woken", "wait.timed_out", "wait.cancelled", "child_run.spawned", "child_run.event", "child_fan_out.created", "child_fan_out.member.admitted", "child_fan_out.member.terminal", "child_fan_out.terminal", "workspace.lease.planned", "workspace.lease.acquired", "workspace.suspended", "workspace.resumed", "workspace.snapshot.created", "workspace.lease.released", "workspace.lease.failed"]>;
2627
2657
  readonly sequence: Schema.Int;
2628
2658
  readonly cursor: Schema.String;
2629
2659
  readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -79,6 +79,11 @@ export declare const LocalAgentTarget: Schema.Struct<{
79
79
  readonly [x: string]: Schema.Json;
80
80
  };
81
81
  readonly instructions?: string;
82
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
83
+ readonly context_window: Schema.Number;
84
+ readonly reserve_tokens: Schema.Number;
85
+ readonly keep_recent_tokens: Schema.Number;
86
+ }, "Encoded">;
82
87
  readonly output_schema_ref?: string;
83
88
  readonly skill_definition_ids?: readonly string[];
84
89
  readonly permission_rules?: {
@@ -111,6 +116,11 @@ export declare const LocalAgentTarget: Schema.Struct<{
111
116
  };
112
117
  };
113
118
  readonly instructions?: string;
119
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
120
+ readonly context_window: Schema.Number;
121
+ readonly reserve_tokens: Schema.Number;
122
+ readonly keep_recent_tokens: Schema.Number;
123
+ }, "Encoded">;
114
124
  readonly tool_names?: readonly string[];
115
125
  readonly workspace_policy?: {
116
126
  readonly mode: "share" | "fork";
@@ -1,6 +1,6 @@
1
1
  import { Agent, Content, Execution, Ids, Shared, Tool } from "../../schema/index";
2
2
  import { AgentChatRepository } from "../../store-sql/portable";
3
- import { Context, Effect, Layer, Schema } from "effect";
3
+ import { Cause, Context, Effect, Layer, Schema } from "effect";
4
4
  import { Tool as AiTool } from "effect/unstable/ai";
5
5
  import type { DispatchInput } from "../child/spawn-child-run-tool";
6
6
  import { Service as EventLogService } from "../execution/event-log-service";
@@ -9,11 +9,10 @@ import { Service as ModelCallPolicyService } from "../model/model-call-policy";
9
9
  import { Service as SchemaRegistryService } from "../schema-registry/schema-registry-service";
10
10
  import { Service as ToolRuntimeService } from "../tool/tool-runtime-service";
11
11
  import { Service as PromptAssemblerService } from "./prompt-assembler-service";
12
- import type { Options } from "./relay-compaction";
13
12
  declare const AgentLoopError_base: Schema.Class<AgentLoopError, Schema.TaggedStruct<"AgentLoopError", {
14
13
  readonly message: Schema.String;
15
14
  readonly next_event_sequence: Schema.optionalKey<Schema.Int>;
16
- }>, import("effect/Cause").YieldableError>;
15
+ }>, Cause.YieldableError>;
17
16
  export declare class AgentLoopError extends AgentLoopError_base {
18
17
  }
19
18
  declare const AgentLoopWaitRequested_base: Schema.Class<AgentLoopWaitRequested, Schema.TaggedStruct<"AgentLoopWaitRequested", {
@@ -29,14 +28,14 @@ declare const AgentLoopWaitRequested_base: Schema.Class<AgentLoopWaitRequested,
29
28
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
30
29
  }>;
31
30
  readonly next_event_sequence: Schema.Int;
32
- }>, import("effect/Cause").YieldableError>;
31
+ }>, Cause.YieldableError>;
33
32
  export declare class AgentLoopWaitRequested extends AgentLoopWaitRequested_base {
34
33
  }
35
34
  declare const AgentLoopBudgetExceeded_base: Schema.Class<AgentLoopBudgetExceeded, Schema.TaggedStruct<"AgentLoopBudgetExceeded", {
36
35
  readonly tokens_used: Schema.Int;
37
36
  readonly token_budget: Schema.Int;
38
37
  readonly next_event_sequence: Schema.Int;
39
- }>, import("effect/Cause").YieldableError>;
38
+ }>, Cause.YieldableError>;
40
39
  export declare class AgentLoopBudgetExceeded extends AgentLoopBudgetExceeded_base {
41
40
  }
42
41
  export interface RunInput {
@@ -54,7 +53,6 @@ export interface RunInput {
54
53
  readonly completedAt: number;
55
54
  readonly steeringEnabled?: boolean;
56
55
  readonly toolOutputMaxBytes?: number | null;
57
- readonly compaction?: Options | null;
58
56
  readonly sessionEntryScope?: string;
59
57
  readonly dispatchChildRun?: (input: DispatchInput) => Effect.Effect<void, unknown, any>;
60
58
  }
@@ -29,6 +29,7 @@ export declare class ChildRunModelMissing extends ChildRunModelMissing_base {
29
29
  export interface AgentContext {
30
30
  readonly instructions?: string;
31
31
  readonly model?: Agent.ModelSelection;
32
+ readonly compactionPolicy?: Agent.CompactionPolicy;
32
33
  readonly toolNames: ReadonlyArray<string>;
33
34
  readonly permissions: ReadonlyArray<string>;
34
35
  readonly outputSchemaRef?: string;
@@ -37,6 +38,7 @@ export interface AgentContext {
37
38
  export interface ChildRunOverride {
38
39
  readonly instructions?: string;
39
40
  readonly model?: Agent.ModelSelection;
41
+ readonly compactionPolicy?: Agent.CompactionPolicy;
40
42
  readonly toolNames?: ReadonlyArray<string>;
41
43
  readonly permissions?: ReadonlyArray<string>;
42
44
  readonly workspacePolicy?: Agent.ChildRunWorkspacePolicy;
@@ -74,6 +76,7 @@ export declare class Service extends Service_base {
74
76
  export interface ResolvedChildContext {
75
77
  readonly instructions?: string;
76
78
  readonly model?: Agent.ModelSelection;
79
+ readonly compactionPolicy?: Agent.CompactionPolicy;
77
80
  readonly toolNames: ReadonlyArray<string>;
78
81
  readonly permissions: ReadonlyArray<string>;
79
82
  readonly workspacePolicy?: Agent.ChildRunWorkspacePolicy;
@@ -16,6 +16,11 @@ export declare const Input: Schema.Struct<{
16
16
  readonly request_options: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
17
17
  readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
18
18
  }>>;
19
+ readonly compaction_policy: Schema.optionalKey<Schema.Struct<{
20
+ readonly context_window: Schema.Number;
21
+ readonly reserve_tokens: Schema.Number;
22
+ readonly keep_recent_tokens: Schema.Number;
23
+ }>>;
19
24
  readonly tool_names: Schema.optionalKey<Schema.$Array<Schema.String>>;
20
25
  readonly permissions: Schema.optionalKey<Schema.$Array<Schema.String>>;
21
26
  readonly output_schema_ref: Schema.optionalKey<Schema.String>;
@@ -185,6 +190,7 @@ export interface TransferInput extends Schema.Schema.Type<typeof TransferInput>
185
190
  export interface DispatchInput {
186
191
  readonly executionId: Ids.ExecutionId;
187
192
  readonly rootAddressId: Ids.AddressId;
193
+ readonly sessionId: Ids.SessionId;
188
194
  readonly input: ReadonlyArray<Content.Part>;
189
195
  readonly eventSequence: Execution.ExecutionEventSequence;
190
196
  readonly startedAt: number;
@@ -103,6 +103,11 @@ export declare const StartInput: Schema.Struct<{
103
103
  readonly [x: string]: Schema.Json;
104
104
  };
105
105
  readonly instructions?: string;
106
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
107
+ readonly context_window: Schema.Number;
108
+ readonly reserve_tokens: Schema.Number;
109
+ readonly keep_recent_tokens: Schema.Number;
110
+ }, "Encoded">;
106
111
  readonly output_schema_ref?: string;
107
112
  readonly skill_definition_ids?: readonly string[];
108
113
  readonly permission_rules?: {
@@ -135,6 +140,11 @@ export declare const StartInput: Schema.Struct<{
135
140
  };
136
141
  };
137
142
  readonly instructions?: string;
143
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
144
+ readonly context_window: Schema.Number;
145
+ readonly reserve_tokens: Schema.Number;
146
+ readonly keep_recent_tokens: Schema.Number;
147
+ }, "Encoded">;
138
148
  readonly tool_names?: readonly string[];
139
149
  readonly workspace_policy?: {
140
150
  readonly mode: "share" | "fork";
@@ -361,6 +371,11 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
361
371
  readonly [x: string]: Schema.Json;
362
372
  };
363
373
  readonly instructions?: string;
374
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
375
+ readonly context_window: Schema.Number;
376
+ readonly reserve_tokens: Schema.Number;
377
+ readonly keep_recent_tokens: Schema.Number;
378
+ }, "Encoded">;
364
379
  readonly output_schema_ref?: string;
365
380
  readonly skill_definition_ids?: readonly string[];
366
381
  readonly permission_rules?: {
@@ -393,6 +408,11 @@ export declare const StartExecutionWorkflow: Workflow.Workflow<"Relay/Execution/
393
408
  };
394
409
  };
395
410
  readonly instructions?: string;
411
+ readonly compaction_policy?: Schema.Struct.ReadonlySide<{
412
+ readonly context_window: Schema.Number;
413
+ readonly reserve_tokens: Schema.Number;
414
+ readonly keep_recent_tokens: Schema.Number;
415
+ }, "Encoded">;
396
416
  readonly tool_names?: readonly string[];
397
417
  readonly workspace_policy?: {
398
418
  readonly mode: "share" | "fork";