@relayfx/sdk 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.js +2 -2
- package/dist/{index-hwxe2yyg.js → index-4dv9n6af.js} +2 -2
- package/dist/{index-dghk1gr5.js → index-pw4pwy28.js} +1 -1
- package/dist/{index-fjds2dhd.js → index-wa9tmzad.js} +28 -8
- package/dist/index.js +3 -3
- package/dist/migrations/sqlite/0008_child_fan_out.sql +3 -3
- package/dist/sqlite.js +3 -3
- package/dist/types/relay/sqlite-migrations.d.ts +1 -1
- package/dist/types/schema/agent-schema.d.ts +2 -2
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./index-
|
|
2
|
+
import"./index-pw4pwy28.js";
|
|
3
3
|
import {
|
|
4
4
|
AiError,
|
|
5
5
|
Chat,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
exports_tool_executor,
|
|
35
35
|
exports_tool_output,
|
|
36
36
|
exports_turn_policy
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-wa9tmzad.js";
|
|
38
38
|
|
|
39
39
|
// src/ai.ts
|
|
40
40
|
var relayAiPackage = "@relayfx/sdk/ai";
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
exports_wait_service,
|
|
49
49
|
exports_wait_signal,
|
|
50
50
|
exports_workflow_definition_repository
|
|
51
|
-
} from "./index-
|
|
51
|
+
} from "./index-wa9tmzad.js";
|
|
52
52
|
|
|
53
53
|
// src/operation.ts
|
|
54
54
|
var exports_operation = {};
|
|
@@ -1124,7 +1124,7 @@ var turnPolicyFieldsFromRegisterInput = Effect.fn("Client.turnPolicyFieldsFromRe
|
|
|
1124
1124
|
return yield* Effect.fail(batonTurnPolicyInvalid("opaque policies require an explicit max_tool_turns replacement"));
|
|
1125
1125
|
}
|
|
1126
1126
|
const durable = yield* turnPolicySnapshotFromBaton(snapshot);
|
|
1127
|
-
if (durable.kind === "recurs" && durable.count ===
|
|
1127
|
+
if (durable.kind === "recurs" && durable.count === 8)
|
|
1128
1128
|
return {};
|
|
1129
1129
|
if (durable.kind === "recurs" && durable.count > 0)
|
|
1130
1130
|
return { max_tool_turns: durable.count };
|
|
@@ -402,8 +402,8 @@ var makeTurnPolicySnapshotTree = () => {
|
|
|
402
402
|
return tree;
|
|
403
403
|
};
|
|
404
404
|
var TurnPolicySnapshot = makeTurnPolicySnapshotTree().check(turnPolicySnapshotNodeCount).annotate({ identifier: "Relay.Agent.TurnPolicySnapshot" });
|
|
405
|
-
var defaultMaxToolTurns =
|
|
406
|
-
var defaultMaxWaitTurns =
|
|
405
|
+
var defaultMaxToolTurns = Number.POSITIVE_INFINITY;
|
|
406
|
+
var defaultMaxWaitTurns = Number.POSITIVE_INFINITY;
|
|
407
407
|
var DefinitionSchema = Schema5.Struct({
|
|
408
408
|
name: NonEmptyString,
|
|
409
409
|
instructions: Schema5.optionalKey(Schema5.String),
|
|
@@ -14894,6 +14894,23 @@ var Output2 = Schema73.Struct({
|
|
|
14894
14894
|
var TransferInput = Schema73.Struct({
|
|
14895
14895
|
input: Schema73.optionalKey(Schema73.Array(exports_content_schema.Part))
|
|
14896
14896
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.TransferInput" });
|
|
14897
|
+
var ModelInput = Schema73.Struct({
|
|
14898
|
+
preset_name: Schema73.optionalKey(Schema73.String),
|
|
14899
|
+
instructions: Schema73.optionalKey(Schema73.String),
|
|
14900
|
+
model: Schema73.optionalKey(Schema73.Struct({
|
|
14901
|
+
provider: Schema73.String,
|
|
14902
|
+
model: Schema73.String,
|
|
14903
|
+
registration_key: Schema73.optionalKey(Schema73.String)
|
|
14904
|
+
})),
|
|
14905
|
+
tool_names: Schema73.optionalKey(Schema73.Array(Schema73.String)),
|
|
14906
|
+
permissions: Schema73.optionalKey(Schema73.Array(Schema73.String)),
|
|
14907
|
+
output_schema_ref: Schema73.optionalKey(Schema73.String),
|
|
14908
|
+
metadata: Schema73.optionalKey(Schema73.Record(Schema73.String, Schema73.String)),
|
|
14909
|
+
input: Schema73.optionalKey(Schema73.Array(Schema73.Struct({ type: Schema73.Literal("text"), text: Schema73.String })))
|
|
14910
|
+
});
|
|
14911
|
+
var ModelTransferInput = Schema73.Struct({
|
|
14912
|
+
input: Schema73.optionalKey(Schema73.Array(Schema73.Struct({ type: Schema73.Literal("text"), text: Schema73.String })))
|
|
14913
|
+
});
|
|
14897
14914
|
var enabled = (agent) => agent.metadata?.multi_agent_enabled === true;
|
|
14898
14915
|
var parentContext = (agent) => ({
|
|
14899
14916
|
...agent.instructions === undefined ? {} : { instructions: agent.instructions },
|
|
@@ -15057,24 +15074,24 @@ var run3 = Effect66.fn("SpawnChildRunTool.run")(function* (config, activeToolNam
|
|
|
15057
15074
|
});
|
|
15058
15075
|
var registeredTool2 = (config) => tool(toolName2, {
|
|
15059
15076
|
description: "Spawn a durable child run and wait for its terminal output.",
|
|
15060
|
-
input:
|
|
15077
|
+
input: ModelInput,
|
|
15061
15078
|
output: Output2,
|
|
15062
15079
|
permissions: [{ name: permissionName2, value: true }],
|
|
15063
15080
|
requiredPermissions: [permissionName2],
|
|
15064
15081
|
metadata: { relay_core_tool: true },
|
|
15065
|
-
run: (input, context) => run3(config, toolName2,
|
|
15082
|
+
run: (input, context) => Schema73.decodeUnknownEffect(Input2)(input).pipe(Effect66.flatMap((decoded) => run3(config, toolName2, decoded, context, true)))
|
|
15066
15083
|
});
|
|
15067
15084
|
var transferToolName2 = (name) => `transfer_to_${name.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "")}`;
|
|
15068
15085
|
var transferTools = (config) => (config.agent.handoff_targets ?? []).map((target) => {
|
|
15069
15086
|
const name = transferToolName2(target.name);
|
|
15070
15087
|
return tool(name, {
|
|
15071
15088
|
description: "Transfer to a durable child run preset and wait for its terminal output.",
|
|
15072
|
-
input:
|
|
15089
|
+
input: ModelTransferInput,
|
|
15073
15090
|
output: Output2,
|
|
15074
15091
|
permissions: [{ name: permissionName2, value: true }],
|
|
15075
15092
|
requiredPermissions: [permissionName2],
|
|
15076
15093
|
metadata: { relay_core_tool: true, handoff_target: target.name, preset_name: target.preset_name },
|
|
15077
|
-
run: (input, context) => run3(config, name, { preset_name: target.preset_name, input:
|
|
15094
|
+
run: (input, context) => Schema73.decodeUnknownEffect(TransferInput)(input).pipe(Effect66.flatMap((decoded) => run3(config, name, { preset_name: target.preset_name, input: decoded.input ?? [] }, context, false)))
|
|
15078
15095
|
});
|
|
15079
15096
|
});
|
|
15080
15097
|
|
|
@@ -16922,8 +16939,11 @@ var turnPolicyFromSnapshot = (snapshot2) => {
|
|
|
16922
16939
|
}
|
|
16923
16940
|
};
|
|
16924
16941
|
var turnPolicyFromDefinition = (agent) => {
|
|
16925
|
-
const
|
|
16926
|
-
|
|
16942
|
+
const policy = agent.turn_policy === undefined ? undefined : turnPolicyFromSnapshot(agent.turn_policy);
|
|
16943
|
+
if (agent.max_tool_turns === undefined)
|
|
16944
|
+
return policy ?? exports_turn_policy.recurs(Number.POSITIVE_INFINITY);
|
|
16945
|
+
const cap = exports_turn_policy.recurs(agent.max_tool_turns);
|
|
16946
|
+
return policy === undefined ? cap : exports_turn_policy.both(cap, policy);
|
|
16927
16947
|
};
|
|
16928
16948
|
var availableRegisteredTools = (agent, registered) => {
|
|
16929
16949
|
const names = toolNames(agent);
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exports_language_model_registration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-pw4pwy28.js";
|
|
5
5
|
import {
|
|
6
6
|
Service,
|
|
7
7
|
exports_client,
|
|
8
8
|
exports_command,
|
|
9
9
|
exports_operation
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-4dv9n6af.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-
|
|
62
|
+
} from "./index-wa9tmzad.js";
|
|
63
63
|
|
|
64
64
|
// src/adapter-outbox.ts
|
|
65
65
|
var exports_adapter_outbox = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
CREATE TABLE `relay_child_fan_outs` (
|
|
1
|
+
CREATE TABLE IF NOT EXISTS `relay_child_fan_outs` (
|
|
2
2
|
`tenant_id` text NOT NULL DEFAULT 'system',
|
|
3
3
|
`id` text NOT NULL,
|
|
4
4
|
`parent_execution_id` text NOT NULL,
|
|
@@ -11,9 +11,9 @@ CREATE TABLE `relay_child_fan_outs` (
|
|
|
11
11
|
PRIMARY KEY (`tenant_id`, `id`)
|
|
12
12
|
);
|
|
13
13
|
--> statement-breakpoint
|
|
14
|
-
CREATE INDEX `idx_relay_child_fan_outs_parent` ON `relay_child_fan_outs` (`tenant_id`, `parent_execution_id`);
|
|
14
|
+
CREATE INDEX IF NOT EXISTS `idx_relay_child_fan_outs_parent` ON `relay_child_fan_outs` (`tenant_id`, `parent_execution_id`);
|
|
15
15
|
--> statement-breakpoint
|
|
16
|
-
CREATE TABLE `relay_child_fan_out_members` (
|
|
16
|
+
CREATE TABLE IF NOT EXISTS `relay_child_fan_out_members` (
|
|
17
17
|
`tenant_id` text NOT NULL DEFAULT 'system',
|
|
18
18
|
`fan_out_id` text NOT NULL,
|
|
19
19
|
`child_execution_id` text NOT NULL,
|
package/dist/sqlite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
exports_client,
|
|
4
4
|
exports_operation
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-4dv9n6af.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-
|
|
49
|
+
} from "./index-wa9tmzad.js";
|
|
50
50
|
// src/sqlite-runtime.ts
|
|
51
51
|
var exports_sqlite_runtime = {};
|
|
52
52
|
__export(exports_sqlite_runtime, {
|
|
@@ -625,7 +625,7 @@ CREATE INDEX idx_relay_topic_subscriptions_subscriber ON relay_topic_subscriptio
|
|
|
625
625
|
`;
|
|
626
626
|
|
|
627
627
|
// ../../migrations/sqlite/0008_child_fan_out.sql
|
|
628
|
-
var _0008_child_fan_out_default = "CREATE TABLE `relay_child_fan_outs` (\n `tenant_id` text NOT NULL DEFAULT 'system',\n `id` text NOT NULL,\n `parent_execution_id` text NOT NULL,\n `definition_json` text NOT NULL,\n `state` text NOT NULL DEFAULT 'joining',\n `satisfied_at` integer,\n `failed_at` integer,\n `cancelled_at` integer,\n `created_at` integer NOT NULL,\n PRIMARY KEY (`tenant_id`, `id`)\n);\n--> statement-breakpoint\nCREATE INDEX `idx_relay_child_fan_outs_parent` ON `relay_child_fan_outs` (`tenant_id`, `parent_execution_id`);\n--> statement-breakpoint\nCREATE TABLE `relay_child_fan_out_members` (\n `tenant_id` text NOT NULL DEFAULT 'system',\n `fan_out_id` text NOT NULL,\n `child_execution_id` text NOT NULL,\n `ordinal` integer NOT NULL,\n `state` text NOT NULL DEFAULT 'queued',\n `output_json` text,\n `error` text,\n `completed_at` integer,\n PRIMARY KEY (`tenant_id`, `fan_out_id`, `child_execution_id`),\n UNIQUE (`tenant_id`, `fan_out_id`, `ordinal`)\n);\n";
|
|
628
|
+
var _0008_child_fan_out_default = "CREATE TABLE IF NOT EXISTS `relay_child_fan_outs` (\n `tenant_id` text NOT NULL DEFAULT 'system',\n `id` text NOT NULL,\n `parent_execution_id` text NOT NULL,\n `definition_json` text NOT NULL,\n `state` text NOT NULL DEFAULT 'joining',\n `satisfied_at` integer,\n `failed_at` integer,\n `cancelled_at` integer,\n `created_at` integer NOT NULL,\n PRIMARY KEY (`tenant_id`, `id`)\n);\n--> statement-breakpoint\nCREATE INDEX IF NOT EXISTS `idx_relay_child_fan_outs_parent` ON `relay_child_fan_outs` (`tenant_id`, `parent_execution_id`);\n--> statement-breakpoint\nCREATE TABLE IF NOT EXISTS `relay_child_fan_out_members` (\n `tenant_id` text NOT NULL DEFAULT 'system',\n `fan_out_id` text NOT NULL,\n `child_execution_id` text NOT NULL,\n `ordinal` integer NOT NULL,\n `state` text NOT NULL DEFAULT 'queued',\n `output_json` text,\n `error` text,\n `completed_at` integer,\n PRIMARY KEY (`tenant_id`, `fan_out_id`, `child_execution_id`),\n UNIQUE (`tenant_id`, `fan_out_id`, `ordinal`)\n);\n";
|
|
629
629
|
|
|
630
630
|
// ../../migrations/sqlite/0009_workflow_definitions.sql
|
|
631
631
|
var _0009_workflow_definitions_default = `CREATE TABLE IF NOT EXISTS relay_workflow_definition_revisions (tenant_id TEXT NOT NULL, workflow_definition_id TEXT NOT NULL, revision INTEGER NOT NULL, digest TEXT NOT NULL, definition_json TEXT NOT NULL, created_at INTEGER NOT NULL, PRIMARY KEY (tenant_id, workflow_definition_id, revision), UNIQUE (tenant_id, workflow_definition_id, digest));
|
|
@@ -51,4 +51,4 @@ export declare const migrations: readonly [{
|
|
|
51
51
|
readonly file: "0010_workflow_runtime.sql";
|
|
52
52
|
readonly source: string;
|
|
53
53
|
}];
|
|
54
|
-
export declare const loader: Effect.Effect<(readonly [1 | 2 | 6 | 3 | 4 | 7 |
|
|
54
|
+
export declare const loader: Effect.Effect<(readonly [1 | 2 | 6 | 3 | 4 | 7 | 5 | 8 | 9 | 10, "baseline" | "durable_tool_placement" | "durable_inbox" | "execution_state" | "durable_entities" | "ephemeral_presence" | "topic_subscriptions" | "child_fan_out" | "workflow_definitions" | "workflow_runtime", Effect.Effect<Effect.Effect<void, import("effect/unstable/sql/SqlError").SqlError, SqlClient>, never, never>])[], never, never>;
|
|
@@ -84,8 +84,8 @@ export type TurnPolicySnapshot = RecursTurnPolicySnapshot | UntilToolCallTurnPol
|
|
|
84
84
|
export declare const maxTurnPolicySnapshotDepth = 16;
|
|
85
85
|
export declare const maxTurnPolicySnapshotNodes = 64;
|
|
86
86
|
export declare const TurnPolicySnapshot: Schema.Codec<TurnPolicySnapshot>;
|
|
87
|
-
export declare const defaultMaxToolTurns
|
|
88
|
-
export declare const defaultMaxWaitTurns
|
|
87
|
+
export declare const defaultMaxToolTurns: number;
|
|
88
|
+
export declare const defaultMaxWaitTurns: number;
|
|
89
89
|
declare const DefinitionSchema: Schema.Struct<{
|
|
90
90
|
readonly name: Schema.String;
|
|
91
91
|
readonly instructions: Schema.optionalKey<Schema.String>;
|
package/package.json
CHANGED