@relayfx/sdk 0.0.40 → 0.0.42
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 +15458 -0
- package/dist/index.js +942 -589
- package/dist/types/ai/index.d.ts +1 -0
- package/dist/types/relay/ai.d.ts +2 -0
- package/dist/types/relay/client.d.ts +20 -2
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +15 -9
- package/package.json +8 -4
package/dist/types/ai/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * as EmbeddingModelRegistration from "./embedding-model/embedding-model-registration";
|
|
2
2
|
export * as LanguageModelRegistration from "./language-model/language-model-registration";
|
|
3
|
+
export { Agent, AgentEvent, AgentTool, AiError, Approvals, Chat, Compaction, EmbeddingModel, Guardrail, Handoff, IdGenerator, Instructions, LanguageModel, Memory, Model, ModelMiddleware, ModelRegistry, ModelResilience, Permissions, Prompt, Response, ResponseIdTracker, Session, SkillSource, Steering, Telemetry, Tokenizer, Tool, ToolContext, ToolExecutor, Toolkit, ToolOutput, TurnPolicy, } from "@batonfx/core";
|
|
3
4
|
export declare const aiPackage = "./index";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Agent, AgentEvent, AgentTool, AiError, Approvals, Chat, Compaction, EmbeddingModel, Guardrail, Handoff, IdGenerator, Instructions, LanguageModel, Memory, Model, ModelMiddleware, ModelRegistry, ModelResilience, Permissions, Prompt, Response, ResponseIdTracker, Session, SkillSource, Steering, Telemetry, Tokenizer, Tool, ToolContext, ToolExecutor, Toolkit, ToolOutput, TurnPolicy, } from "../ai/index";
|
|
2
|
+
export declare const relayAiPackage = "@relayfx/sdk/ai";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddressBook, AgentRegistry, EventLog, ExecutionService, SkillRegistry, WaitService } from "../runtime/index";
|
|
2
|
-
import {
|
|
2
|
+
import type { Agent as BatonAgent } from "@batonfx/core";
|
|
3
|
+
import { Address, Agent, Content, Envelope, Execution, Ids, Shared, Skill, Tool } from "../schema/index";
|
|
3
4
|
import { ClusterRegistryRepository, EnvelopeRepository, ExecutionRepository, ScheduleRepository, SessionRepository, SteeringRepository } from "../store-sql/index";
|
|
4
5
|
import { Context, Effect, Layer, Schema, Stream } from "effect";
|
|
5
6
|
import { Sharding, ShardingConfig } from "effect/unstable/cluster";
|
|
@@ -34,9 +35,26 @@ export interface StartExecutionByAgentDefinitionInput {
|
|
|
34
35
|
readonly wait_id?: Ids.WaitId;
|
|
35
36
|
readonly metadata?: Shared.Metadata;
|
|
36
37
|
}
|
|
37
|
-
export interface
|
|
38
|
+
export interface RegisterDefinedAgentInput extends Agent.DefineInput {
|
|
38
39
|
readonly address?: Ids.AddressId;
|
|
39
40
|
}
|
|
41
|
+
export interface RegisterBatonAgentInput {
|
|
42
|
+
readonly id: Ids.AgentId;
|
|
43
|
+
readonly address?: Ids.AddressId;
|
|
44
|
+
readonly agent: BatonAgent.Agent<any>;
|
|
45
|
+
readonly model: Agent.ModelSelection;
|
|
46
|
+
readonly permissions?: ReadonlyArray<Tool.Permission>;
|
|
47
|
+
readonly skill_definition_ids?: ReadonlyArray<Ids.SkillDefinitionId>;
|
|
48
|
+
readonly permission_rules?: Agent.PermissionRuleset;
|
|
49
|
+
readonly max_tool_turns?: number;
|
|
50
|
+
readonly max_wait_turns?: number;
|
|
51
|
+
readonly token_budget?: number;
|
|
52
|
+
readonly child_run_presets?: Readonly<Record<string, Agent.ChildRunPreset>>;
|
|
53
|
+
readonly handoff_targets?: ReadonlyArray<Agent.HandoffTarget>;
|
|
54
|
+
readonly output_schema_ref?: string;
|
|
55
|
+
readonly metadata?: Shared.Metadata;
|
|
56
|
+
}
|
|
57
|
+
export type RegisterAgentInput = RegisterDefinedAgentInput | RegisterBatonAgentInput;
|
|
40
58
|
export interface Interface {
|
|
41
59
|
readonly registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
|
|
42
60
|
readonly registerAgentDefinition: (input: Agent.RegisterDefinitionPayload) => Effect.Effect<Agent.DefinitionRegistered, ClientError>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Execution, Ids, Shared, Tool } from "../../schema/index";
|
|
2
|
-
import { ToolCallRepository } from "../../store-sql/index";
|
|
3
|
-
import { Tool as AiTool } from "effect/unstable/ai";
|
|
2
|
+
import { EnvelopeRepository, ScheduleRepository, ToolCallRepository } from "../../store-sql/index";
|
|
3
|
+
import { Tool as AiTool, Toolkit } from "effect/unstable/ai";
|
|
4
4
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
5
|
import { Service as EventLogService } from "../execution/event-log-service";
|
|
6
6
|
import { Service as WaitServiceService } from "../wait/wait-service";
|
|
@@ -53,7 +53,6 @@ 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;
|
|
57
56
|
readonly definition: Tool.Definition;
|
|
58
57
|
readonly tool: AiTool.Any;
|
|
59
58
|
readonly requiredPermissions?: ReadonlyArray<string>;
|
|
@@ -82,6 +81,14 @@ export interface DynamicToolOptions {
|
|
|
82
81
|
readonly metadata?: Shared.Metadata | undefined;
|
|
83
82
|
readonly run: (input: Shared.JsonValue, context: ToolExecutionContext) => Effect.Effect<Shared.JsonValue, unknown, any>;
|
|
84
83
|
}
|
|
84
|
+
export interface ToolkitToolOptions {
|
|
85
|
+
readonly permissions?: ReadonlyArray<Tool.Permission> | undefined;
|
|
86
|
+
readonly requiredPermissions?: ReadonlyArray<string> | undefined;
|
|
87
|
+
readonly requirements?: ReadonlyArray<Tool.RuntimeRequirement> | undefined;
|
|
88
|
+
readonly needsApproval?: boolean | undefined;
|
|
89
|
+
readonly metadata?: Shared.Metadata | undefined;
|
|
90
|
+
}
|
|
91
|
+
export type ToolkitRegistrationOptions = ToolkitToolOptions | ((tool: AiTool.Any) => ToolkitToolOptions);
|
|
85
92
|
export interface RunInput {
|
|
86
93
|
readonly executionId: Ids.ExecutionId;
|
|
87
94
|
readonly call: Tool.Call;
|
|
@@ -101,14 +108,13 @@ declare const Service_base: Context.ServiceClass<Service, "@relayfx/runtime/Tool
|
|
|
101
108
|
export declare class Service extends Service_base {
|
|
102
109
|
}
|
|
103
110
|
export declare const toolFromRegistered: (tool: RegisteredTool) => AiTool.Any;
|
|
104
|
-
export declare const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export declare const dynamicTool: <const Name extends string>(name: Name, options: DynamicToolOptions) => RegisteredTool & {
|
|
108
|
-
readonly name: Name;
|
|
109
|
-
};
|
|
111
|
+
export declare const toolsFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.WithHandler<Tools>, options?: ToolkitRegistrationOptions) => ReadonlyArray<RegisteredTool>;
|
|
112
|
+
export declare const tool: <const Name extends string, Input extends Schema.Constraint, Output extends Schema.Constraint>(name: Name, options: ToolOptions<Input, Output>) => RegisteredTool;
|
|
113
|
+
export declare const dynamicTool: <const Name extends string>(name: Name, options: DynamicToolOptions) => RegisteredTool;
|
|
110
114
|
export declare const layer: (initialTools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService>;
|
|
115
|
+
export declare const layerFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions) => Layer.Layer<Service, never, ToolCallRepository.Service | EventLogService | WaitServiceService | Exclude<AiTool.HandlersFor<Tools>, import("effect/Scope").Scope>>;
|
|
111
116
|
export declare const memoryLayer: (tools?: ReadonlyArray<RegisteredTool>) => Layer.Layer<Service, never, never>;
|
|
117
|
+
export declare const memoryLayerFromToolkit: <Tools extends Record<string, AiTool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: ToolkitRegistrationOptions) => Layer.Layer<Service, never, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<AiTool.HandlersFor<Tools>, import("effect/Scope").Scope>, WaitServiceService>, ToolCallRepository.Service>, EnvelopeRepository.Service>, ScheduleRepository.Service>, EventLogService>>;
|
|
112
118
|
export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
|
|
113
119
|
export declare const register: (registeredTool: RegisteredTool) => Effect.Effect<void, never, Service>;
|
|
114
120
|
export declare const definitions: () => Effect.Effect<readonly Tool.Definition[], never, Service>;
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@relayfx/sdk",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.42",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/types/relay/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
10
|
},
|
|
11
|
+
"./ai": {
|
|
12
|
+
"types": "./dist/types/ai/index.d.ts",
|
|
13
|
+
"import": "./dist/ai.js"
|
|
14
|
+
},
|
|
11
15
|
"./migrations/*": "./dist/migrations/*"
|
|
12
16
|
},
|
|
13
17
|
"types": "./dist/types/relay/index.d.ts",
|
|
@@ -15,14 +19,14 @@
|
|
|
15
19
|
"dist"
|
|
16
20
|
],
|
|
17
21
|
"scripts": {
|
|
18
|
-
"build": "bun build ./src/index.ts --outdir dist --target bun --format esm --external effect --external 'effect/*' --external '@effect/*' --external drizzle-orm --external 'drizzle-orm/*' --external pg && bun scripts/build-types.ts",
|
|
22
|
+
"build": "bun build ./src/index.ts ./src/ai.ts --outdir dist --target bun --format esm --external effect --external 'effect/*' --external '@effect/*' --external drizzle-orm --external 'drizzle-orm/*' --external pg && bun scripts/build-types.ts",
|
|
19
23
|
"lint": "bun --cwd ../.. oxlint packages/relay/src packages/relay/scripts packages/relay/test",
|
|
20
24
|
"test": "bun --cwd ../.. vitest run packages/relay/test --passWithNoTests",
|
|
21
25
|
"typecheck": "bun tsc --noEmit"
|
|
22
26
|
},
|
|
23
27
|
"dependencies": {
|
|
24
|
-
"@batonfx/core": "0.
|
|
25
|
-
"@batonfx/providers": "0.
|
|
28
|
+
"@batonfx/core": "0.3.1",
|
|
29
|
+
"@batonfx/providers": "0.3.1",
|
|
26
30
|
"@effect/ai-anthropic": "4.0.0-beta.93",
|
|
27
31
|
"@effect/ai-openai": "4.0.0-beta.93",
|
|
28
32
|
"@effect/ai-openai-compat": "4.0.0-beta.93",
|