@relayfx/sdk 0.7.11 → 0.7.12

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.
@@ -8,7 +8,7 @@ import {
8
8
  SqlFailure,
9
9
  make,
10
10
  normalizeAcquisitionCause
11
- } from "./index-d1je4njg.js";
11
+ } from "./index-chbsjf5d.js";
12
12
 
13
13
  // src/migration-errors.ts
14
14
  import { Cause, Effect, Function } from "effect";
@@ -12018,7 +12018,6 @@ var validateDefinition = Effect64.fn("AgentRegistry.validateDefinition")(functio
12018
12018
  if (duplicate !== undefined) {
12019
12019
  return yield* AgentDefinitionInvalid.make({ message: `Duplicate tool name: ${duplicate}` });
12020
12020
  }
12021
- const parentTools = HashSet4.fromIterable(definition.tool_names);
12022
12021
  const parentPermissions = HashSet4.fromIterable(definition.permissions.map((permission) => permission.name));
12023
12022
  const presetNames = HashSet4.fromIterable(Object.keys(definition.child_run_presets ?? {}));
12024
12023
  for (const [presetName, preset] of Object.entries(definition.child_run_presets ?? {})) {
@@ -12029,11 +12028,9 @@ var validateDefinition = Effect64.fn("AgentRegistry.validateDefinition")(functio
12029
12028
  yield* requireText(preset.model.provider, `definition.child_run_presets.${presetName}.model.provider`);
12030
12029
  yield* requireText(preset.model.model, `definition.child_run_presets.${presetName}.model.model`);
12031
12030
  }
12032
- const missingTool = missingFrom(preset.tool_names ?? [], parentTools);
12033
- if (missingTool !== undefined) {
12034
- return yield* AgentDefinitionInvalid.make({
12035
- message: `Child run preset ${presetName} cannot add tool ${missingTool}`
12036
- });
12031
+ const duplicatePresetTool = firstDuplicate(preset.tool_names ?? []);
12032
+ if (duplicatePresetTool !== undefined) {
12033
+ return yield* AgentDefinitionInvalid.make({ message: `Duplicate child run preset tool: ${duplicatePresetTool}` });
12037
12034
  }
12038
12035
  const missingPermission = missingFrom(preset.permissions ?? [], parentPermissions);
12039
12036
  if (missingPermission !== undefined) {
@@ -12065,9 +12062,14 @@ var layer40 = Layer51.effect(Service47, Effect64.gen(function* () {
12065
12062
  yield* validateDefinition(input.definition);
12066
12063
  const now = yield* Clock6.currentTimeMillis;
12067
12064
  const toolDefinitions = Option15.isNone(toolRuntime) ? [] : yield* toolRuntime.value.definitions;
12068
- const selectedToolNames = input.definition.tool_names.filter((toolName) => toolDefinitions.some((definition) => definition.name === toolName));
12065
+ const pinnedToolNames = [
12066
+ ...new Set([
12067
+ ...input.definition.tool_names,
12068
+ ...Object.values(input.definition.child_run_presets ?? {}).flatMap((preset) => preset.tool_names ?? [])
12069
+ ])
12070
+ ].filter((toolName) => toolDefinitions.some((definition) => definition.name === toolName));
12069
12071
  const crypto = yield* Effect64.serviceOption(Crypto2.Crypto);
12070
- const toolInputSchemaDigests = selectedToolNames.length === 0 ? {} : Option15.isNone(crypto) ? yield* AgentRegistryError.make({ message: "Tool input schema digest computation requires Crypto" }) : yield* digestDefinitions(toolDefinitions, selectedToolNames).pipe(Effect64.provideService(Crypto2.Crypto, crypto.value), Effect64.mapError((error5) => AgentRegistryError.make({ message: String(error5) })));
12072
+ const toolInputSchemaDigests = pinnedToolNames.length === 0 ? {} : Option15.isNone(crypto) ? yield* AgentRegistryError.make({ message: "Tool input schema digest computation requires Crypto" }) : yield* digestDefinitions(toolDefinitions, pinnedToolNames).pipe(Effect64.provideService(Crypto2.Crypto, crypto.value), Effect64.mapError((error5) => AgentRegistryError.make({ message: String(error5) })));
12071
12073
  const record2 = yield* repository.put({ id: input.id, definition: input.definition, toolInputSchemaDigests, now }).pipe(Effect64.mapError(mapRepositoryError3));
12072
12074
  return { record: toPublicRecord(record2) };
12073
12075
  }),
@@ -12222,7 +12224,7 @@ var subsetViolation = (parent, child) => {
12222
12224
  const allowed = HashSet5.fromIterable(parent);
12223
12225
  return child.find((value) => !HashSet5.has(allowed, value));
12224
12226
  };
12225
- var resolveContext = (parent, override) => {
12227
+ var resolveContext = (parent, override, allowStaticTools = false) => {
12226
12228
  const toolNames = override?.toolNames ?? parent.toolNames;
12227
12229
  const permissions = override?.permissions ?? parent.permissions;
12228
12230
  const instructions = override?.instructions ?? parent.instructions;
@@ -12231,7 +12233,7 @@ var resolveContext = (parent, override) => {
12231
12233
  const workspacePolicy = override?.workspacePolicy;
12232
12234
  const outputSchemaRef2 = override?.outputSchemaRef ?? parent.outputSchemaRef;
12233
12235
  const broadenedTool = subsetViolation(parent.toolNames, toolNames);
12234
- if (broadenedTool !== undefined) {
12236
+ if (!allowStaticTools && broadenedTool !== undefined) {
12235
12237
  return Effect66.fail(ChildRunScopeBroadened.make({ field: "tool_names", value: broadenedTool }));
12236
12238
  }
12237
12239
  const broadenedPermission = subsetViolation(parent.permissions, permissions);
@@ -12368,7 +12370,7 @@ var layer41 = Layer53.effect(Service49, Effect66.gen(function* () {
12368
12370
  if (preset === undefined) {
12369
12371
  return yield* StaticChildRunPresetNotFound.make({ preset_name: input.presetName });
12370
12372
  }
12371
- const context = yield* resolveContext(input.parent, preset);
12373
+ const context = yield* resolveContext(input.parent, preset, true);
12372
12374
  const accepted2 = yield* persistChild(repository, eventLog, input, "static", context, input.presetName);
12373
12375
  yield* recordChildRunSpawned("static");
12374
12376
  return accepted2;
@@ -12420,25 +12422,34 @@ var resolveForDispatch = Effect66.fn("ChildRunService.resolveForDispatch")(funct
12420
12422
  if (preset === undefined) {
12421
12423
  return yield* StaticChildRunPresetNotFound.make({ preset_name: input.preset_name });
12422
12424
  }
12423
- return yield* resolveContext(parent, overrideFromSchema(preset));
12425
+ return yield* resolveContext(parent, overrideFromSchema(preset), true);
12424
12426
  }
12425
12427
  return yield* resolveContext(parent, dynamicOverrideFromSpawn(input));
12426
12428
  });
12427
- var childDefinition = Function12.dual(2, (parentDefinition, context) => context.model === undefined ? Effect66.fail(ChildRunModelMissing.make({})) : Effect66.succeed({
12428
- name: `${parentDefinition.name}/child`,
12429
- model: context.model,
12430
- tool_names: [...context.toolNames],
12431
- permissions: parentDefinition.permissions.filter((permission) => context.permissions.includes(permission.name)),
12432
- child_run_presets: {},
12433
- ...context.compactionPolicy === undefined ? {} : { compaction_policy: context.compactionPolicy },
12434
- ...parentDefinition.turn_policy === undefined ? {} : { turn_policy: parentDefinition.turn_policy },
12435
- ...parentDefinition.tool_execution === undefined ? {} : { tool_execution: parentDefinition.tool_execution },
12436
- ...parentDefinition.max_tool_turns === undefined ? {} : { max_tool_turns: parentDefinition.max_tool_turns },
12437
- ...parentDefinition.max_wait_turns === undefined ? {} : { max_wait_turns: parentDefinition.max_wait_turns },
12438
- ...parentDefinition.token_budget === undefined ? {} : { token_budget: parentDefinition.token_budget },
12439
- ...context.instructions === undefined ? {} : { instructions: context.instructions },
12440
- ...context.outputSchemaRef === undefined ? {} : { output_schema_ref: context.outputSchemaRef }
12441
- }));
12429
+ var childDefinition = Function12.dual(2, (parentDefinition, context) => {
12430
+ if (context.model === undefined)
12431
+ return Effect66.fail(ChildRunModelMissing.make({}));
12432
+ const permissions = new Set(context.permissions);
12433
+ const childRunPresets = Object.fromEntries(Object.entries(parentDefinition.child_run_presets ?? {}).filter(([, preset]) => (preset.permissions ?? []).every((permission) => permissions.has(permission))));
12434
+ const presetNames = new Set(Object.keys(childRunPresets));
12435
+ const handoffTargets = (parentDefinition.handoff_targets ?? []).filter((target) => presetNames.has(target.preset_name));
12436
+ return Effect66.succeed({
12437
+ name: `${parentDefinition.name}/child`,
12438
+ model: context.model,
12439
+ tool_names: [...context.toolNames],
12440
+ permissions: parentDefinition.permissions.filter((permission) => context.permissions.includes(permission.name)),
12441
+ child_run_presets: childRunPresets,
12442
+ ...handoffTargets.length === 0 ? {} : { handoff_targets: handoffTargets },
12443
+ ...context.compactionPolicy === undefined ? {} : { compaction_policy: context.compactionPolicy },
12444
+ ...parentDefinition.turn_policy === undefined ? {} : { turn_policy: parentDefinition.turn_policy },
12445
+ ...parentDefinition.tool_execution === undefined ? {} : { tool_execution: parentDefinition.tool_execution },
12446
+ ...parentDefinition.max_tool_turns === undefined ? {} : { max_tool_turns: parentDefinition.max_tool_turns },
12447
+ ...parentDefinition.max_wait_turns === undefined ? {} : { max_wait_turns: parentDefinition.max_wait_turns },
12448
+ ...parentDefinition.token_budget === undefined ? {} : { token_budget: parentDefinition.token_budget },
12449
+ ...context.instructions === undefined ? {} : { instructions: context.instructions },
12450
+ ...context.outputSchemaRef === undefined ? {} : { output_schema_ref: context.outputSchemaRef }
12451
+ });
12452
+ });
12442
12453
  var spawnStatic = Effect66.fn("ChildRunService.spawnStatic.call")(function* (input) {
12443
12454
  const service = yield* Service49;
12444
12455
  return yield* service.spawnStatic(input);
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  exports_tool_runtime,
15
15
  exports_workflow_definition_host,
16
16
  makeDatabaseIdentity
17
- } from "./index-d1je4njg.js";
17
+ } from "./index-chbsjf5d.js";
18
18
  import {
19
19
  exports_context_overflow,
20
20
  exports_model_registry
package/dist/mysql.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-skcp0xvt.js";
5
+ } from "./index-agr4t5nk.js";
6
6
  import {
7
7
  MigratorError,
8
8
  RuntimeMigrationError,
9
9
  SqlFailure
10
- } from "./index-d1je4njg.js";
10
+ } from "./index-chbsjf5d.js";
11
11
  import"./index-d5563j6w.js";
12
12
  import"./index-j8k41y47.js";
13
13
  import"./index-nb39b5ae.js";
package/dist/postgres.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-skcp0xvt.js";
5
+ } from "./index-agr4t5nk.js";
6
6
  import {
7
7
  Dialect,
8
8
  RuntimeMigrationError,
@@ -14,7 +14,7 @@ import {
14
14
  fromDbTimestamp,
15
15
  fromNullableDbTimestamp,
16
16
  timestampParam
17
- } from "./index-d1je4njg.js";
17
+ } from "./index-chbsjf5d.js";
18
18
  import"./index-d5563j6w.js";
19
19
  import {
20
20
  exports_ids_schema
package/dist/sqlite.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  database,
4
4
  normalizeMigrationCause
5
- } from "./index-skcp0xvt.js";
5
+ } from "./index-agr4t5nk.js";
6
6
  import {
7
7
  DatabaseAlreadyOwned,
8
8
  RuntimeConfigurationError,
@@ -12,7 +12,7 @@ import {
12
12
  make,
13
13
  makeDatabaseIdentity,
14
14
  runtimeLayer
15
- } from "./index-d1je4njg.js";
15
+ } from "./index-chbsjf5d.js";
16
16
  import"./index-d5563j6w.js";
17
17
  import"./index-j8k41y47.js";
18
18
  import"./index-nb39b5ae.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@relayfx/sdk",
4
- "version": "0.7.11",
4
+ "version": "0.7.12",
5
5
  "description": "Effect-native durable execution SDK for addressable agents and tools",
6
6
  "type": "module",
7
7
  "exports": {
@@ -75,7 +75,7 @@
75
75
  "@effect/vitest": "4.0.0-beta.98",
76
76
  "@relayfx/ai": "0.0.0",
77
77
  "@relayfx/runtime": "0.0.0",
78
- "@relayfx/schema": "0.7.11",
78
+ "@relayfx/schema": "0.7.12",
79
79
  "@relayfx/store-sql": "0.0.0",
80
80
  "@types/bun": "1.3.14",
81
81
  "typescript": "7.0.2",