@relayfx/sdk 0.4.2 → 0.6.0
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 +1 -1
- package/dist/http-server.js +1 -1
- package/dist/{index-4y9111jh.js → index-0jx86sx3.js} +1 -1
- package/dist/{index-y9ncz0zd.js → index-96b7htye.js} +893 -712
- package/dist/{index-x32kbvxv.js → index-c6jave5p.js} +989 -958
- package/dist/{index-3w6txjtg.js → index-fh2ftte9.js} +7 -2
- package/dist/index.js +254 -119
- package/dist/migrations/20260721120000_steering_delivered/migration.sql +3 -0
- package/dist/migrations/20260721170000_session_writer_ownership/migration.sql +5 -0
- package/dist/migrations/mysql/0013_steering_delivered.sql +3 -0
- package/dist/migrations/mysql/0014_session_writer_ownership.sql +5 -0
- package/dist/migrations/pg/20260721120000_steering_delivered/migration.sql +3 -0
- package/dist/migrations/pg/20260721170000_session_writer_ownership/migration.sql +5 -0
- package/dist/migrations/sqlite/0013_steering_delivered.sql +3 -0
- package/dist/migrations/sqlite/0014_session_writer_ownership.sql +5 -0
- package/dist/mysql.js +21 -5
- package/dist/postgres.js +10 -6
- package/dist/sqlite.js +21 -5
- package/dist/types/ai/language-model/language-model-registration.d.ts +23 -11
- package/dist/types/relay/client-public-executions.d.ts +2 -2
- package/dist/types/relay/language-model-registration.d.ts +25 -11
- package/dist/types/relay/mysql-migrations.d.ts +1 -1
- package/dist/types/relay/operation.d.ts +7 -4
- package/dist/types/relay/sqlite-migrations.d.ts +11 -1
- package/dist/types/relay/tool-worker.d.ts +1 -1
- package/dist/types/runtime/agent/agent-loop-error.d.ts +1 -1
- package/dist/types/runtime/agent/relay-permissions.d.ts +2 -2
- package/dist/types/runtime/execution/active-execution-registry.d.ts +1 -0
- package/dist/types/runtime/model/model-hub.d.ts +5 -5
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +4 -4
- package/dist/types/runtime/session/session-store-service.d.ts +1 -0
- package/dist/types/schema/execution-schema.d.ts +8 -3
- package/dist/types/schema/ids-schema.d.ts +4 -0
- package/dist/types/store-sql/schema/session-schema.d.ts +45 -0
- package/dist/types/store-sql/session/session-records.d.ts +5 -47
- package/dist/types/store-sql/session/session-repository.d.ts +35 -1
- package/dist/types/store-sql/session/session-row.d.ts +60 -0
- package/package.json +3 -3
|
@@ -62,6 +62,51 @@ export declare const relaySessions: import("drizzle-orm/pg-core").PgTableWithCol
|
|
|
62
62
|
identity: undefined;
|
|
63
63
|
generated: undefined;
|
|
64
64
|
}>;
|
|
65
|
+
ownerExecutionId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_sessions", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.ExecutionId">>, {
|
|
66
|
+
name: string;
|
|
67
|
+
tableName: "relay_sessions";
|
|
68
|
+
dataType: "string";
|
|
69
|
+
data: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
|
|
70
|
+
driverParam: string;
|
|
71
|
+
notNull: false;
|
|
72
|
+
hasDefault: false;
|
|
73
|
+
isPrimaryKey: false;
|
|
74
|
+
isAutoincrement: false;
|
|
75
|
+
hasRuntimeDefault: false;
|
|
76
|
+
enumValues: undefined;
|
|
77
|
+
identity: undefined;
|
|
78
|
+
generated: undefined;
|
|
79
|
+
}>;
|
|
80
|
+
ownerEpoch: import("drizzle-orm/pg-core").PgBuildColumn<"relay_sessions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>>, {
|
|
81
|
+
name: string;
|
|
82
|
+
tableName: "relay_sessions";
|
|
83
|
+
dataType: "number int53";
|
|
84
|
+
data: number;
|
|
85
|
+
driverParam: string | number;
|
|
86
|
+
notNull: true;
|
|
87
|
+
hasDefault: true;
|
|
88
|
+
isPrimaryKey: false;
|
|
89
|
+
isAutoincrement: false;
|
|
90
|
+
hasRuntimeDefault: false;
|
|
91
|
+
enumValues: undefined;
|
|
92
|
+
identity: undefined;
|
|
93
|
+
generated: undefined;
|
|
94
|
+
}>;
|
|
95
|
+
ownerReleased: import("drizzle-orm/pg-core").PgBuildColumn<"relay_sessions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBooleanBuilder>>, {
|
|
96
|
+
name: string;
|
|
97
|
+
tableName: "relay_sessions";
|
|
98
|
+
dataType: "boolean";
|
|
99
|
+
data: boolean;
|
|
100
|
+
driverParam: boolean;
|
|
101
|
+
notNull: true;
|
|
102
|
+
hasDefault: true;
|
|
103
|
+
isPrimaryKey: false;
|
|
104
|
+
isAutoincrement: false;
|
|
105
|
+
hasRuntimeDefault: false;
|
|
106
|
+
enumValues: undefined;
|
|
107
|
+
identity: undefined;
|
|
108
|
+
generated: undefined;
|
|
109
|
+
}>;
|
|
65
110
|
metadataJson: import("drizzle-orm/pg-core").PgBuildColumn<"relay_sessions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, {
|
|
66
111
|
readonly [x: string]: import("effect/Schema").Json;
|
|
67
112
|
}>>>, {
|
|
@@ -1,51 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
1
|
+
import { Effect } from "effect";
|
|
3
2
|
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
4
3
|
import { sessionEntryRow } from "./session-entry-records";
|
|
5
|
-
import type {
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly leaf_entry_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
|
|
10
|
-
readonly metadata_json: Schema.Unknown;
|
|
11
|
-
readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
12
|
-
readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
13
|
-
}>;
|
|
14
|
-
export declare const metadata: (input: Shared.Metadata | undefined) => {
|
|
15
|
-
readonly [x: string]: Schema.Json;
|
|
16
|
-
};
|
|
17
|
-
export declare const listLimit: (input: ListSessionsInput) => number;
|
|
18
|
-
declare const nextCursorOf: (records: ReadonlyArray<SessionRecord>, fetched: number, limit: number) => SessionCursor | undefined;
|
|
19
|
-
declare const compareDesc: (left: SessionRecord, right: SessionRecord) => number;
|
|
20
|
-
declare const afterCursor: (record: SessionRecord, cursor: SessionCursor | undefined) => boolean;
|
|
21
|
-
export declare const sessionRecordPaging: {
|
|
22
|
-
nextCursorOf: typeof nextCursorOf;
|
|
23
|
-
compareDesc: typeof compareDesc;
|
|
24
|
-
afterCursor: typeof afterCursor;
|
|
25
|
-
};
|
|
26
|
-
interface SessionRecordErrors {
|
|
27
|
-
readonly SessionRepositoryError: Schema.Schema<SessionRepositoryError> & {
|
|
28
|
-
readonly make: (input: {
|
|
29
|
-
readonly message: string;
|
|
30
|
-
}) => SessionRepositoryError;
|
|
31
|
-
};
|
|
32
|
-
readonly DuplicateSession: {
|
|
33
|
-
readonly make: (input: {
|
|
34
|
-
readonly id: Ids.SessionId;
|
|
35
|
-
}) => DuplicateSession;
|
|
36
|
-
};
|
|
37
|
-
readonly SessionConflict: {
|
|
38
|
-
readonly make: (input: {
|
|
39
|
-
readonly reason: SessionConflict["reason"];
|
|
40
|
-
readonly message: string;
|
|
41
|
-
}) => SessionConflict;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export declare const makeSessionRecordSupport: (errors: SessionRecordErrors) => {
|
|
45
|
-
missingSession: (id: Ids.SessionId) => SessionRepositoryError;
|
|
46
|
-
rootMismatch: (id: Ids.SessionId) => SessionRepositoryError;
|
|
47
|
-
cloneSession: (record: SessionRecord) => SessionRecord;
|
|
48
|
-
currentLeaf: (session: SessionRecord) => Ids.SessionEntryId | null;
|
|
49
|
-
};
|
|
4
|
+
import type { Interface } from "./session-repository";
|
|
5
|
+
export { listLimit, metadata, sessionRow, sessionRecordPaging, toSessionRecord } from "./session-row";
|
|
6
|
+
import { type SessionRecordErrors } from "./session-row";
|
|
7
|
+
export { makeSessionRecordSupport, type SessionRecordErrors } from "./session-row";
|
|
50
8
|
export declare const makeSessionRepository: (errors: SessionRecordErrors) => Effect.Effect<Interface, never, SqlClient>;
|
|
51
9
|
export { sessionEntryRow };
|
|
@@ -14,15 +14,42 @@ declare const DuplicateSession_base: Schema.Class<DuplicateSession, Schema.Tagge
|
|
|
14
14
|
export declare class DuplicateSession extends DuplicateSession_base {
|
|
15
15
|
}
|
|
16
16
|
declare const SessionConflict_base: Schema.Class<SessionConflict, Schema.TaggedStruct<"SessionConflict", {
|
|
17
|
-
readonly reason: Schema.Literals<readonly ["stale-leaf", "checkpoint-id-reused", "checkpoint-not-on-active-path"]>;
|
|
17
|
+
readonly reason: Schema.Literals<readonly ["stale-leaf", "checkpoint-id-reused", "checkpoint-not-on-active-path", "fenced"]>;
|
|
18
18
|
readonly message: Schema.String;
|
|
19
19
|
}>, import("effect/Cause").YieldableError>;
|
|
20
20
|
export declare class SessionConflict extends SessionConflict_base {
|
|
21
21
|
}
|
|
22
|
+
export interface SessionWriter {
|
|
23
|
+
readonly executionId: Ids.ExecutionId;
|
|
24
|
+
readonly epoch: number;
|
|
25
|
+
readonly released: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface ExpectedSessionWriter {
|
|
28
|
+
readonly executionId: Ids.ExecutionId;
|
|
29
|
+
readonly epoch: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ClaimSessionWriterInput {
|
|
32
|
+
readonly sessionId: Ids.SessionId;
|
|
33
|
+
readonly executionId: Ids.ExecutionId;
|
|
34
|
+
readonly now: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ReleaseSessionWriterInput {
|
|
37
|
+
readonly sessionId: Ids.SessionId;
|
|
38
|
+
readonly executionId: Ids.ExecutionId;
|
|
39
|
+
readonly now: number;
|
|
40
|
+
}
|
|
41
|
+
export type ClaimSessionWriterResult = {
|
|
42
|
+
readonly _tag: "Claimed";
|
|
43
|
+
readonly writer: SessionWriter;
|
|
44
|
+
} | {
|
|
45
|
+
readonly _tag: "Busy";
|
|
46
|
+
readonly writer: SessionWriter;
|
|
47
|
+
};
|
|
22
48
|
export interface SessionRecord {
|
|
23
49
|
readonly id: Ids.SessionId;
|
|
24
50
|
readonly rootAddressId: Ids.AddressId;
|
|
25
51
|
readonly leafEntryId?: Ids.SessionEntryId;
|
|
52
|
+
readonly writer?: SessionWriter;
|
|
26
53
|
readonly metadata: Shared.Metadata;
|
|
27
54
|
readonly createdAt: number;
|
|
28
55
|
readonly updatedAt: number;
|
|
@@ -197,6 +224,7 @@ export interface AppendEntryInput {
|
|
|
197
224
|
readonly input: AppendSessionEntryInput;
|
|
198
225
|
readonly createdAt: number;
|
|
199
226
|
readonly expectedLeafId?: Ids.SessionEntryId | null;
|
|
227
|
+
readonly expectedWriter?: ExpectedSessionWriter;
|
|
200
228
|
}
|
|
201
229
|
export interface AppendCheckpointInput {
|
|
202
230
|
readonly id: Ids.SessionEntryId;
|
|
@@ -205,6 +233,7 @@ export interface AppendCheckpointInput {
|
|
|
205
233
|
readonly projectedHistory: Prompt.Prompt;
|
|
206
234
|
readonly summary?: string;
|
|
207
235
|
readonly createdAt: number;
|
|
236
|
+
readonly expectedWriter?: ExpectedSessionWriter;
|
|
208
237
|
}
|
|
209
238
|
export interface AppendCheckpointResult {
|
|
210
239
|
readonly _tag: "Appended" | "AlreadyPresent";
|
|
@@ -226,6 +255,8 @@ export interface SetLeafInput {
|
|
|
226
255
|
export interface Interface {
|
|
227
256
|
readonly create: (input: CreateSessionInput) => Effect.Effect<SessionRecord, DuplicateSession | SessionRepositoryError>;
|
|
228
257
|
readonly ensure: (input: EnsureSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError>;
|
|
258
|
+
readonly claimWriter: (input: ClaimSessionWriterInput) => Effect.Effect<ClaimSessionWriterResult, SessionRepositoryError>;
|
|
259
|
+
readonly releaseWriter: (input: ReleaseSessionWriterInput) => Effect.Effect<void, SessionRepositoryError>;
|
|
229
260
|
readonly get: (id: Ids.SessionId) => Effect.Effect<SessionRecord | undefined, SessionRepositoryError>;
|
|
230
261
|
readonly list: (input: ListSessionsInput) => Effect.Effect<ListSessionsResult, SessionRepositoryError>;
|
|
231
262
|
readonly touch: (input: TouchSessionInput) => Effect.Effect<SessionRecord, SessionRepositoryError>;
|
|
@@ -243,6 +274,9 @@ export declare const SessionRow: Schema.Struct<{
|
|
|
243
274
|
readonly id: Schema.String;
|
|
244
275
|
readonly root_address_id: Schema.String;
|
|
245
276
|
readonly leaf_entry_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
|
|
277
|
+
readonly owner_execution_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
|
|
278
|
+
readonly owner_epoch: Schema.Union<readonly [Schema.Finite, Schema.String, Schema.BigInt]>;
|
|
279
|
+
readonly owner_released: Schema.Union<readonly [Schema.Boolean, Schema.Finite, Schema.String, Schema.BigInt]>;
|
|
246
280
|
readonly metadata_json: Schema.Unknown;
|
|
247
281
|
readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
248
282
|
readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Ids, Shared } from "../../schema/index";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import type { DuplicateSession, ExpectedSessionWriter, ListSessionsInput, SessionConflict, SessionCursor, SessionRecord, SessionRepositoryError, SessionWriter } from "./session-repository";
|
|
4
|
+
export declare const sessionRow: Schema.Struct<{
|
|
5
|
+
readonly id: Schema.String;
|
|
6
|
+
readonly root_address_id: Schema.String;
|
|
7
|
+
readonly leaf_entry_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
|
|
8
|
+
readonly owner_execution_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
|
|
9
|
+
readonly owner_epoch: Schema.Union<readonly [Schema.Finite, Schema.String, Schema.BigInt]>;
|
|
10
|
+
readonly owner_released: Schema.Union<readonly [Schema.Boolean, Schema.Finite, Schema.String, Schema.BigInt]>;
|
|
11
|
+
readonly metadata_json: Schema.Unknown;
|
|
12
|
+
readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
13
|
+
readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const CountRow: Schema.Struct<{
|
|
16
|
+
readonly value: Schema.Union<readonly [Schema.Finite, Schema.String, Schema.BigInt]>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const metadata: (input: Shared.Metadata | undefined) => {
|
|
19
|
+
readonly [x: string]: Schema.Json;
|
|
20
|
+
};
|
|
21
|
+
export declare const toSessionRecord: (row: typeof sessionRow.Type) => SessionRecord;
|
|
22
|
+
export declare const listLimit: (input: ListSessionsInput) => number;
|
|
23
|
+
declare const nextCursorOf: (records: ReadonlyArray<SessionRecord>, fetched: number, limit: number) => SessionCursor | undefined;
|
|
24
|
+
declare const compareDesc: (left: SessionRecord, right: SessionRecord) => number;
|
|
25
|
+
declare const afterCursor: (record: SessionRecord, cursor: SessionCursor | undefined) => boolean;
|
|
26
|
+
export declare const sessionRecordPaging: {
|
|
27
|
+
nextCursorOf: typeof nextCursorOf;
|
|
28
|
+
compareDesc: typeof compareDesc;
|
|
29
|
+
afterCursor: typeof afterCursor;
|
|
30
|
+
};
|
|
31
|
+
export interface SessionRecordErrors {
|
|
32
|
+
readonly SessionRepositoryError: Schema.Schema<SessionRepositoryError> & {
|
|
33
|
+
readonly make: (input: {
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}) => SessionRepositoryError;
|
|
36
|
+
};
|
|
37
|
+
readonly DuplicateSession: {
|
|
38
|
+
readonly make: (input: {
|
|
39
|
+
readonly id: Ids.SessionId;
|
|
40
|
+
}) => DuplicateSession;
|
|
41
|
+
};
|
|
42
|
+
readonly SessionConflict: {
|
|
43
|
+
readonly make: (input: {
|
|
44
|
+
readonly reason: SessionConflict["reason"];
|
|
45
|
+
readonly message: string;
|
|
46
|
+
}) => SessionConflict;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export declare const makeSessionRecordSupport: (errors: SessionRecordErrors) => {
|
|
50
|
+
missingSession: (id: Ids.SessionId) => SessionRepositoryError;
|
|
51
|
+
rootMismatch: (id: Ids.SessionId) => SessionRepositoryError;
|
|
52
|
+
cloneSession: (record: SessionRecord) => SessionRecord;
|
|
53
|
+
currentLeaf: (session: SessionRecord) => Ids.SessionEntryId | null;
|
|
54
|
+
writerFenceViolation: (session: SessionRecord, expected: ExpectedSessionWriter | undefined) => string | undefined;
|
|
55
|
+
nextWriterClaim: (current: SessionWriter | undefined, executionId: Ids.ExecutionId) => {
|
|
56
|
+
readonly _tag: "Claimed" | "Busy";
|
|
57
|
+
readonly writer: SessionWriter;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export {};
|
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.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "Effect-native durable execution SDK for addressable agents and tools",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"typecheck": "bun tsc --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@batonfx/core": "0.
|
|
61
|
-
"@batonfx/providers": "0.
|
|
60
|
+
"@batonfx/core": "0.9.0",
|
|
61
|
+
"@batonfx/providers": "0.9.0",
|
|
62
62
|
"@effect/ai-anthropic": "4.0.0-beta.98",
|
|
63
63
|
"@effect/ai-openai": "4.0.0-beta.98",
|
|
64
64
|
"@effect/ai-openai-compat": "4.0.0-beta.98",
|