@relayfx/sdk 0.3.1 → 0.3.3
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 +67 -37
- package/dist/http-server.js +22 -0
- package/dist/index-25gwk9tj.js +3423 -0
- package/dist/{index-3sv8mmz5.js → index-49fm2rdv.js} +23 -30
- package/dist/{index-c2skef55.js → index-8pa5e2yn.js} +16521 -18783
- package/dist/index-cphmds30.js +2852 -0
- package/dist/index-nb39b5ae.js +17 -0
- package/dist/index.js +315 -844
- package/dist/mysql.js +18 -18
- package/dist/postgres.js +724 -24
- package/dist/sqlite.js +57 -168
- package/dist/types/ai/index.d.ts +2 -1
- package/dist/types/ai/language-model/language-model-registration.d.ts +9 -6
- package/dist/types/relay/adapter-outbox.d.ts +1 -1
- package/dist/types/relay/ai.d.ts +34 -2
- package/dist/types/relay/child-fan-out-admission.d.ts +5 -0
- package/dist/types/relay/child-fan-out-host.d.ts +73 -0
- package/dist/types/relay/client-public.d.ts +481 -0
- package/dist/types/relay/client.d.ts +1 -478
- package/dist/types/relay/database-identity.d.ts +4 -0
- package/dist/types/relay/http-server.d.ts +95 -0
- package/dist/types/relay/index.d.ts +37 -14
- package/dist/types/relay/internal-client.d.ts +22 -0
- package/dist/types/relay/language-model-registration.d.ts +13 -0
- package/dist/types/relay/mysql.d.ts +6 -7
- package/dist/types/relay/operation.d.ts +4 -4
- package/dist/types/relay/postgres.d.ts +10 -7
- package/dist/types/relay/runtime-acquisition-error.d.ts +61 -0
- package/dist/types/relay/runtime-database-adapter.d.ts +8 -5
- package/dist/types/relay/runtime-database-owner.d.ts +13 -0
- package/dist/types/relay/runtime-database-public.d.ts +10 -0
- package/dist/types/relay/runtime.d.ts +77 -72
- package/dist/types/relay/sqlite-runtime.d.ts +5 -18
- package/dist/types/relay/sqlite.d.ts +4 -31
- package/dist/types/relay/state-version-conflict.d.ts +12 -0
- package/dist/types/relay/tool-runtime.d.ts +44 -0
- package/dist/types/relay/tool-worker.d.ts +2 -2
- package/dist/types/relay/workflow-definition-host.d.ts +32 -0
- package/dist/types/runtime/agent/agent-loop-error.d.ts +21 -0
- package/dist/types/runtime/agent/agent-loop-service.d.ts +6 -16
- package/dist/types/runtime/agent/prompt-assembler-service.d.ts +3 -3
- package/dist/types/runtime/cluster/execution-entity.d.ts +3 -3
- package/dist/types/runtime/execution/execution-service.d.ts +3 -0
- package/dist/types/runtime/index.d.ts +1 -0
- package/dist/types/runtime/model/language-model-service.d.ts +5 -12
- package/dist/types/runtime/model/model-hub.d.ts +27 -0
- package/dist/types/runtime/presence/presence-contract.d.ts +24 -0
- package/dist/types/runtime/presence/presence-service.d.ts +6 -24
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +29 -13
- package/dist/types/runtime/session/session-store-service.d.ts +4 -1
- package/dist/types/runtime/tool/tool-runtime-contract.d.ts +121 -0
- package/dist/types/runtime/tool/tool-runtime-service.d.ts +6 -120
- package/dist/types/runtime/workflow/execution-workflow.d.ts +22 -24
- package/dist/types/schema/agent-schema.d.ts +4 -1
- package/dist/types/schema/execution-schema.d.ts +13 -2
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/pagination-schema.d.ts +17 -0
- package/dist/types/schema/shared-schema.d.ts +4 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +12 -12
- package/dist/types/store-sql/session/session-repository.d.ts +54 -11
- package/package.json +17 -14
- package/dist/index-9k4k3wq1.js +0 -2860
- package/dist/index-d3dme13d.js +0 -141
- package/dist/types/relay/database.d.ts +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ids, Shared } from "../../schema/index";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
-
import
|
|
3
|
+
import { Prompt } from "effect/unstable/ai";
|
|
4
4
|
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
5
5
|
declare const SessionRepositoryError_base: Schema.Class<SessionRepositoryError, Schema.TaggedStruct<"SessionRepositoryError", {
|
|
6
6
|
readonly message: Schema.String;
|
|
@@ -14,6 +14,12 @@ declare const DuplicateSession_base: Schema.Class<DuplicateSession, Schema.Tagge
|
|
|
14
14
|
}>, import("effect/Cause").YieldableError>;
|
|
15
15
|
export declare class DuplicateSession extends DuplicateSession_base {
|
|
16
16
|
}
|
|
17
|
+
declare const SessionConflict_base: Schema.Class<SessionConflict, Schema.TaggedStruct<"SessionConflict", {
|
|
18
|
+
readonly reason: Schema.Literals<readonly ["stale-leaf", "checkpoint-id-reused", "checkpoint-not-on-active-path"]>;
|
|
19
|
+
readonly message: Schema.String;
|
|
20
|
+
}>, import("effect/Cause").YieldableError>;
|
|
21
|
+
export declare class SessionConflict extends SessionConflict_base {
|
|
22
|
+
}
|
|
17
23
|
export interface SessionRecord {
|
|
18
24
|
readonly id: Ids.SessionId;
|
|
19
25
|
readonly rootAddressId: Ids.AddressId;
|
|
@@ -53,15 +59,15 @@ export interface ListSessionsResult {
|
|
|
53
59
|
}
|
|
54
60
|
export type AppendSessionEntryInput = {
|
|
55
61
|
readonly _tag: "Message";
|
|
56
|
-
readonly message: Message;
|
|
62
|
+
readonly message: Prompt.Message;
|
|
57
63
|
readonly metadata?: Shared.Metadata;
|
|
58
64
|
} | {
|
|
59
65
|
readonly _tag: "ToolCall";
|
|
60
|
-
readonly part: ToolCallPart;
|
|
66
|
+
readonly part: Prompt.ToolCallPart;
|
|
61
67
|
readonly metadata?: Shared.Metadata;
|
|
62
68
|
} | {
|
|
63
69
|
readonly _tag: "ToolResult";
|
|
64
|
-
readonly part: ToolResultPart;
|
|
70
|
+
readonly part: Prompt.ToolResultPart;
|
|
65
71
|
readonly metadata?: Shared.Metadata;
|
|
66
72
|
} | {
|
|
67
73
|
readonly _tag: "Memory";
|
|
@@ -74,7 +80,7 @@ export type AppendSessionEntryInput = {
|
|
|
74
80
|
readonly metadata?: Shared.Metadata;
|
|
75
81
|
} | {
|
|
76
82
|
readonly _tag: "Steering";
|
|
77
|
-
readonly message: Message;
|
|
83
|
+
readonly message: Prompt.Message;
|
|
78
84
|
readonly metadata?: Shared.Metadata;
|
|
79
85
|
} | {
|
|
80
86
|
readonly _tag: "Handoff";
|
|
@@ -83,9 +89,16 @@ export type AppendSessionEntryInput = {
|
|
|
83
89
|
readonly metadata?: Shared.Metadata;
|
|
84
90
|
} | {
|
|
85
91
|
readonly _tag: "Compaction";
|
|
92
|
+
readonly version?: 1;
|
|
86
93
|
readonly summary: string;
|
|
87
94
|
readonly firstKeptEntryId: Ids.SessionEntryId;
|
|
88
95
|
readonly metadata?: Shared.Metadata;
|
|
96
|
+
} | {
|
|
97
|
+
readonly _tag: "Compaction";
|
|
98
|
+
readonly version: 2;
|
|
99
|
+
readonly projectedHistory: Prompt.Prompt;
|
|
100
|
+
readonly summary?: string;
|
|
101
|
+
readonly metadata?: Shared.Metadata;
|
|
89
102
|
} | {
|
|
90
103
|
readonly _tag: "BranchSummary";
|
|
91
104
|
readonly summary: string;
|
|
@@ -96,7 +109,7 @@ export type SessionEntryRecord = {
|
|
|
96
109
|
readonly sessionId: Ids.SessionId;
|
|
97
110
|
readonly parentId: Ids.SessionEntryId | null;
|
|
98
111
|
readonly _tag: "Message";
|
|
99
|
-
readonly message: Message;
|
|
112
|
+
readonly message: Prompt.Message;
|
|
100
113
|
readonly metadata?: Shared.Metadata;
|
|
101
114
|
readonly createdAt: number;
|
|
102
115
|
} | {
|
|
@@ -104,7 +117,7 @@ export type SessionEntryRecord = {
|
|
|
104
117
|
readonly sessionId: Ids.SessionId;
|
|
105
118
|
readonly parentId: Ids.SessionEntryId | null;
|
|
106
119
|
readonly _tag: "ToolCall";
|
|
107
|
-
readonly part: ToolCallPart;
|
|
120
|
+
readonly part: Prompt.ToolCallPart;
|
|
108
121
|
readonly metadata?: Shared.Metadata;
|
|
109
122
|
readonly createdAt: number;
|
|
110
123
|
} | {
|
|
@@ -112,7 +125,7 @@ export type SessionEntryRecord = {
|
|
|
112
125
|
readonly sessionId: Ids.SessionId;
|
|
113
126
|
readonly parentId: Ids.SessionEntryId | null;
|
|
114
127
|
readonly _tag: "ToolResult";
|
|
115
|
-
readonly part: ToolResultPart;
|
|
128
|
+
readonly part: Prompt.ToolResultPart;
|
|
116
129
|
readonly metadata?: Shared.Metadata;
|
|
117
130
|
readonly createdAt: number;
|
|
118
131
|
} | {
|
|
@@ -137,7 +150,7 @@ export type SessionEntryRecord = {
|
|
|
137
150
|
readonly sessionId: Ids.SessionId;
|
|
138
151
|
readonly parentId: Ids.SessionEntryId | null;
|
|
139
152
|
readonly _tag: "Steering";
|
|
140
|
-
readonly message: Message;
|
|
153
|
+
readonly message: Prompt.Message;
|
|
141
154
|
readonly metadata?: Shared.Metadata;
|
|
142
155
|
readonly createdAt: number;
|
|
143
156
|
} | {
|
|
@@ -154,10 +167,21 @@ export type SessionEntryRecord = {
|
|
|
154
167
|
readonly sessionId: Ids.SessionId;
|
|
155
168
|
readonly parentId: Ids.SessionEntryId | null;
|
|
156
169
|
readonly _tag: "Compaction";
|
|
170
|
+
readonly version?: 1;
|
|
157
171
|
readonly summary: string;
|
|
158
172
|
readonly firstKeptEntryId: Ids.SessionEntryId;
|
|
159
173
|
readonly metadata?: Shared.Metadata;
|
|
160
174
|
readonly createdAt: number;
|
|
175
|
+
} | {
|
|
176
|
+
readonly id: Ids.SessionEntryId;
|
|
177
|
+
readonly sessionId: Ids.SessionId;
|
|
178
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
179
|
+
readonly _tag: "Compaction";
|
|
180
|
+
readonly version: 2;
|
|
181
|
+
readonly projectedHistory: Prompt.Prompt;
|
|
182
|
+
readonly summary?: string;
|
|
183
|
+
readonly metadata?: Shared.Metadata;
|
|
184
|
+
readonly createdAt: number;
|
|
161
185
|
} | {
|
|
162
186
|
readonly id: Ids.SessionEntryId;
|
|
163
187
|
readonly sessionId: Ids.SessionId;
|
|
@@ -173,6 +197,23 @@ export interface AppendEntryInput {
|
|
|
173
197
|
readonly parentId: Ids.SessionEntryId | null;
|
|
174
198
|
readonly input: AppendSessionEntryInput;
|
|
175
199
|
readonly createdAt: number;
|
|
200
|
+
readonly expectedLeafId?: Ids.SessionEntryId | null;
|
|
201
|
+
}
|
|
202
|
+
export interface AppendCheckpointInput {
|
|
203
|
+
readonly id: Ids.SessionEntryId;
|
|
204
|
+
readonly sessionId: Ids.SessionId;
|
|
205
|
+
readonly parentId: Ids.SessionEntryId | null;
|
|
206
|
+
readonly projectedHistory: Prompt.Prompt;
|
|
207
|
+
readonly summary?: string;
|
|
208
|
+
readonly createdAt: number;
|
|
209
|
+
}
|
|
210
|
+
export interface AppendCheckpointResult {
|
|
211
|
+
readonly _tag: "Appended" | "AlreadyPresent";
|
|
212
|
+
readonly checkpoint: Extract<SessionEntryRecord, {
|
|
213
|
+
readonly _tag: "Compaction";
|
|
214
|
+
readonly version: 2;
|
|
215
|
+
}>;
|
|
216
|
+
readonly leafId: Ids.SessionEntryId;
|
|
176
217
|
}
|
|
177
218
|
export interface PathInput {
|
|
178
219
|
readonly sessionId: Ids.SessionId;
|
|
@@ -189,7 +230,8 @@ export interface Interface {
|
|
|
189
230
|
readonly get: (id: Ids.SessionId) => Effect.Effect<SessionRecord | undefined, SessionRepositoryError>;
|
|
190
231
|
readonly list: (input: ListSessionsInput) => Effect.Effect<ListSessionsResult, SessionRepositoryError>;
|
|
191
232
|
readonly touch: (input: TouchSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError>;
|
|
192
|
-
readonly appendEntry: (input: AppendEntryInput) => Effect.Effect<SessionEntryRecord, SessionRepositoryError>;
|
|
233
|
+
readonly appendEntry: (input: AppendEntryInput) => Effect.Effect<SessionEntryRecord, SessionRepositoryError | SessionConflict>;
|
|
234
|
+
readonly appendCheckpoint: (input: AppendCheckpointInput) => Effect.Effect<AppendCheckpointResult, SessionRepositoryError | SessionConflict>;
|
|
193
235
|
readonly countEntries: (sessionId: Ids.SessionId) => Effect.Effect<number, SessionRepositoryError>;
|
|
194
236
|
readonly path: (input: PathInput) => Effect.Effect<ReadonlyArray<SessionEntryRecord>, SessionRepositoryError>;
|
|
195
237
|
readonly setLeaf: (input: SetLeafInput) => Effect.Effect<void, SessionRepositoryError>;
|
|
@@ -223,7 +265,8 @@ export declare const ensure: (input: EnsureSessionInput) => Effect.Effect<Sessio
|
|
|
223
265
|
export declare const get: (id: string & import("effect/Brand").Brand<"Relay.SessionId">) => Effect.Effect<SessionRecord | undefined, SessionRepositoryError, Service>;
|
|
224
266
|
export declare const list: (input: ListSessionsInput) => Effect.Effect<ListSessionsResult, SessionRepositoryError, Service>;
|
|
225
267
|
export declare const touch: (input: TouchSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError, Service>;
|
|
226
|
-
export declare const appendEntry: (input: AppendEntryInput) => Effect.Effect<SessionEntryRecord, SessionRepositoryError, Service>;
|
|
268
|
+
export declare const appendEntry: (input: AppendEntryInput) => Effect.Effect<SessionEntryRecord, SessionConflict | SessionRepositoryError, Service>;
|
|
269
|
+
export declare const appendCheckpoint: (input: AppendCheckpointInput) => Effect.Effect<AppendCheckpointResult, SessionConflict | SessionRepositoryError, Service>;
|
|
227
270
|
export declare const countEntries: (sessionId: string & import("effect/Brand").Brand<"Relay.SessionId">) => Effect.Effect<number, SessionRepositoryError, Service>;
|
|
228
271
|
export declare const path: (input: PathInput) => Effect.Effect<readonly SessionEntryRecord[], SessionRepositoryError, Service>;
|
|
229
272
|
export declare const setLeaf: (input: SetLeafInput) => Effect.Effect<void, SessionRepositoryError, Service>;
|
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.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"description": "Effect-native durable execution SDK for addressable agents and tools",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
"import": "./dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"./ai": {
|
|
13
|
-
"types": "./dist/types/ai
|
|
13
|
+
"types": "./dist/types/relay/ai.d.ts",
|
|
14
14
|
"import": "./dist/ai.js"
|
|
15
15
|
},
|
|
16
|
+
"./http-server": {
|
|
17
|
+
"types": "./dist/types/relay/http-server.d.ts",
|
|
18
|
+
"import": "./dist/http-server.js"
|
|
19
|
+
},
|
|
16
20
|
"./sqlite": {
|
|
17
21
|
"types": "./dist/types/relay/sqlite.d.ts",
|
|
18
22
|
"import": "./dist/sqlite.js"
|
|
@@ -47,24 +51,23 @@
|
|
|
47
51
|
"url": "https://github.com/In-Time-Tec/relayfx/issues"
|
|
48
52
|
},
|
|
49
53
|
"scripts": {
|
|
50
|
-
"build": "rm -rf dist && bun build ./src/index.ts ./src/ai.ts ./src/sqlite.ts ./src/postgres.ts ./src/mysql.ts --outdir dist --target bun --format esm --splitting --external effect --external 'effect/*' --external '@effect/*' --external drizzle-orm --external 'drizzle-orm/*' --external pg && mkdir -p dist/migrations && cp -R ../../migrations/pg dist/migrations/pg && bun scripts/build-types.ts",
|
|
54
|
+
"build": "rm -rf dist && bun build ./src/index.ts ./src/ai.ts ./src/http-server.ts ./src/sqlite.ts ./src/postgres.ts ./src/mysql.ts --outdir dist --target bun --format esm --splitting --external effect --external 'effect/*' --external '@effect/*' --external drizzle-orm --external 'drizzle-orm/*' --external pg && mkdir -p dist/migrations && cp -R ../../migrations/pg dist/migrations/pg && bun scripts/build-types.ts",
|
|
51
55
|
"lint": "bun --cwd ../.. oxlint packages/relay/src packages/relay/scripts packages/relay/test",
|
|
52
56
|
"test": "bun --cwd ../.. vitest run packages/relay/test --passWithNoTests && bun test/sqlite.integration.ts",
|
|
53
|
-
"test:package-consumer": "bun --cwd ../.. scripts/package-consumer.ts",
|
|
54
57
|
"typecheck": "bun tsc --noEmit"
|
|
55
58
|
},
|
|
56
59
|
"dependencies": {
|
|
57
|
-
"@batonfx/core": "0.
|
|
58
|
-
"@batonfx/providers": "0.
|
|
59
|
-
"@effect/ai-anthropic": "4.0.0-beta.
|
|
60
|
-
"@effect/ai-openai": "4.0.0-beta.
|
|
61
|
-
"@effect/ai-openai-compat": "4.0.0-beta.
|
|
62
|
-
"@effect/ai-openrouter": "4.0.0-beta.
|
|
63
|
-
"@effect/sql-pg": "4.0.0-beta.
|
|
64
|
-
"@effect/sql-mysql2": "4.0.0-beta.
|
|
65
|
-
"@effect/sql-sqlite-bun": "4.0.0-beta.
|
|
60
|
+
"@batonfx/core": "0.6.1",
|
|
61
|
+
"@batonfx/providers": "0.6.1",
|
|
62
|
+
"@effect/ai-anthropic": "4.0.0-beta.98",
|
|
63
|
+
"@effect/ai-openai": "4.0.0-beta.98",
|
|
64
|
+
"@effect/ai-openai-compat": "4.0.0-beta.98",
|
|
65
|
+
"@effect/ai-openrouter": "4.0.0-beta.98",
|
|
66
|
+
"@effect/sql-pg": "4.0.0-beta.98",
|
|
67
|
+
"@effect/sql-mysql2": "4.0.0-beta.98",
|
|
68
|
+
"@effect/sql-sqlite-bun": "4.0.0-beta.98",
|
|
66
69
|
"drizzle-orm": "1.0.0-rc.3",
|
|
67
|
-
"effect": "4.0.0-beta.
|
|
70
|
+
"effect": "4.0.0-beta.98",
|
|
68
71
|
"pg": "8.21.0"
|
|
69
72
|
}
|
|
70
73
|
}
|