@xandreed/sdk 0.14.0 → 0.15.1
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/README.md +1 -1
- package/dist/agent.adapter.d.ts +66 -34
- package/dist/agent.adapter.js +48 -37
- package/dist/conformance/index.d.ts +2 -0
- package/dist/conformance/index.js +1 -0
- package/dist/inbox-runner.adapter.d.ts +18 -0
- package/dist/inbox-runner.adapter.js +8 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +59 -2
- package/dist/task-executor.adapter.d.ts +32 -0
- package/dist/task-executor.adapter.js +10 -0
- package/dist/task-inbox-runner.adapter.d.ts +11 -0
- package/dist/task-inbox-runner.adapter.js +22 -0
- package/dist/turn/memory-checkpoint.adapter.d.ts +17 -0
- package/dist/turn/memory-checkpoint.adapter.js +62 -0
- package/dist/turn/model-call-recorder.adapter.d.ts +9 -0
- package/dist/turn/model-call-recorder.adapter.js +93 -0
- package/dist/turn/model-call-recorder.entity.d.ts +145 -0
- package/dist/turn/model-call-recorder.entity.functions.d.ts +5 -0
- package/dist/turn/model-call-recorder.entity.functions.js +4 -0
- package/dist/turn/model-call-recorder.entity.js +8 -0
- package/dist/turn/tool-registry.conformance.d.ts +61 -0
- package/dist/turn/tool-registry.conformance.js +547 -0
- package/dist/turn/turn-after-reply.entity.functions.d.ts +9 -0
- package/dist/turn/turn-after-reply.entity.functions.js +4 -0
- package/dist/turn/turn-lifecycle.usecase.functions.d.ts +135 -0
- package/dist/turn/turn-lifecycle.usecase.functions.js +131 -0
- package/dist/turn/turn-observation.entity.d.ts +28 -0
- package/dist/turn/turn-observation.entity.functions.d.ts +15 -0
- package/dist/turn/turn-observation.entity.functions.js +17 -0
- package/dist/turn/turn-observation.entity.js +12 -0
- package/dist/turn/turn-overflow.entity.d.ts +7 -0
- package/dist/turn/turn-overflow.entity.functions.d.ts +11 -0
- package/dist/turn/turn-overflow.entity.functions.js +12 -0
- package/dist/turn/turn-overflow.entity.js +5 -0
- package/dist/turn/turn-phase.entity.d.ts +462 -0
- package/dist/turn/turn-phase.entity.functions.d.ts +44 -0
- package/dist/turn/turn-phase.entity.functions.js +49 -0
- package/dist/turn/turn-phase.entity.js +13 -0
- package/dist/turn/turn-run.usecase.functions.d.ts +72 -0
- package/dist/turn/turn-run.usecase.functions.js +329 -0
- package/dist/turn/turn.adapter.d.ts +26 -0
- package/dist/turn/turn.adapter.js +225 -0
- package/package.json +10 -4
- package/dist/activity.test.d.ts +0 -1
- package/dist/agent.adapter.test.d.ts +0 -1
- package/dist/agent.backends.test.d.ts +0 -1
- package/dist/agent.golden.test.d.ts +0 -231
- package/dist/agent.trace.test.d.ts +0 -1
- package/dist/events-guide.test.d.ts +0 -207
- package/dist/journal-compat.test.d.ts +0 -1
- package/dist/memory.conformance.test.d.ts +0 -1
- package/dist/models-plugin.test.d.ts +0 -1
- package/dist/plugin-stack.test.d.ts +0 -1
- package/dist/resume.journey.test.d.ts +0 -1
- package/dist/testing.port.d.ts +0 -16
- package/dist/testing.port.js +0 -7
- package/dist/turn-composition.test.d.ts +0 -1
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { Tool } from "effect/ai";
|
|
2
|
-
import { Effect, Layer, Schema, Scope } from "effect";
|
|
3
|
-
import { HarnessError, SessionLog } from "@xandreed/core";
|
|
4
|
-
import { Agent } from "./agent.adapter.js";
|
|
5
|
-
import type { AgentConfig } from "./agent.adapter.js";
|
|
6
|
-
export declare const Lookup: Tool.Tool<"lookup", {
|
|
7
|
-
readonly parameters: Schema.Struct<{
|
|
8
|
-
readonly query: Schema.String;
|
|
9
|
-
}>;
|
|
10
|
-
readonly success: Schema.Struct<{
|
|
11
|
-
readonly items: Schema.$Array<Schema.Struct<{
|
|
12
|
-
readonly id: Schema.String;
|
|
13
|
-
readonly detail: Schema.String;
|
|
14
|
-
}>>;
|
|
15
|
-
}>;
|
|
16
|
-
readonly failure: Schema.Struct<{
|
|
17
|
-
readonly error: Schema.String;
|
|
18
|
-
readonly message: Schema.String;
|
|
19
|
-
}>;
|
|
20
|
-
readonly failureMode: "return";
|
|
21
|
-
}, never>;
|
|
22
|
-
export declare const Deliver: Tool.Tool<"deliver", {
|
|
23
|
-
readonly parameters: Schema.Struct<{
|
|
24
|
-
readonly text: Schema.String;
|
|
25
|
-
}>;
|
|
26
|
-
readonly success: Schema.Boolean;
|
|
27
|
-
readonly failure: Schema.Struct<{
|
|
28
|
-
readonly error: Schema.String;
|
|
29
|
-
readonly message: Schema.String;
|
|
30
|
-
}>;
|
|
31
|
-
readonly failureMode: "return";
|
|
32
|
-
}, never>;
|
|
33
|
-
export declare const goldenHost: import("@xandreed/core").Capability;
|
|
34
|
-
/** The agent every composition of the golden conversation reproduces. */
|
|
35
|
-
export declare const goldenConfig: AgentConfig;
|
|
36
|
-
/** What one turn left: its outcome (or failure), the events its host saw and what the memory held. */
|
|
37
|
-
interface Observed {
|
|
38
|
-
readonly runId: string;
|
|
39
|
-
readonly outcome: unknown;
|
|
40
|
-
readonly events: ReadonlyArray<string>;
|
|
41
|
-
readonly contextBuilt: ReadonlyArray<unknown>;
|
|
42
|
-
readonly entries: number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The golden conversation over `runner` — anything that runs a turn the way
|
|
46
|
-
* `Agent.turn` does, acquired in the conversation's scope — under the fixed
|
|
47
|
-
* clock, in one session of `log` (in memory unless given): every turn, then
|
|
48
|
-
* the session's events and the memory log they hold.
|
|
49
|
-
*/
|
|
50
|
-
export declare const runGolden: (runner: Effect.Effect<Pick<Agent, "turn">, HarnessError, Scope.Scope>, log?: Layer.Layer<SessionLog, unknown>) => Effect.Effect<{
|
|
51
|
-
turns: readonly Observed[];
|
|
52
|
-
journal: string[];
|
|
53
|
-
log: readonly {
|
|
54
|
-
readonly id: string;
|
|
55
|
-
readonly runId: string;
|
|
56
|
-
readonly turn: number;
|
|
57
|
-
readonly step: number;
|
|
58
|
-
readonly at: number;
|
|
59
|
-
readonly body: {
|
|
60
|
-
readonly _tag: "SystemPrepared";
|
|
61
|
-
readonly fingerprint: string;
|
|
62
|
-
readonly text: string;
|
|
63
|
-
readonly sections: readonly {
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly version: string;
|
|
66
|
-
readonly fingerprint: string;
|
|
67
|
-
}[];
|
|
68
|
-
} | {
|
|
69
|
-
readonly _tag: "TurnStarted";
|
|
70
|
-
readonly prompt: string;
|
|
71
|
-
readonly attachments?: readonly {
|
|
72
|
-
readonly type: "media";
|
|
73
|
-
readonly mediaType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
74
|
-
readonly data: string;
|
|
75
|
-
readonly fingerprint: string;
|
|
76
|
-
readonly bytes: number;
|
|
77
|
-
readonly name?: string;
|
|
78
|
-
readonly alt?: string;
|
|
79
|
-
}[];
|
|
80
|
-
} | {
|
|
81
|
-
readonly _tag: "TurnContext";
|
|
82
|
-
readonly sectionId: string;
|
|
83
|
-
readonly version: string;
|
|
84
|
-
readonly text: string;
|
|
85
|
-
} | {
|
|
86
|
-
readonly _tag: "Message";
|
|
87
|
-
readonly message: {
|
|
88
|
-
readonly role: "user";
|
|
89
|
-
readonly content: string | readonly ({
|
|
90
|
-
readonly type: "media";
|
|
91
|
-
readonly mediaType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
92
|
-
readonly data: string;
|
|
93
|
-
readonly fingerprint: string;
|
|
94
|
-
readonly bytes: number;
|
|
95
|
-
readonly name?: string;
|
|
96
|
-
readonly alt?: string;
|
|
97
|
-
} | {
|
|
98
|
-
readonly type: "text";
|
|
99
|
-
readonly text: string;
|
|
100
|
-
readonly providerOptions?: unknown;
|
|
101
|
-
})[];
|
|
102
|
-
readonly providerOptions?: unknown;
|
|
103
|
-
} | {
|
|
104
|
-
readonly role: "assistant";
|
|
105
|
-
readonly content: readonly ({
|
|
106
|
-
readonly type: "text";
|
|
107
|
-
readonly text: string;
|
|
108
|
-
readonly providerOptions?: unknown;
|
|
109
|
-
} | {
|
|
110
|
-
readonly type: "reasoning";
|
|
111
|
-
readonly text: string;
|
|
112
|
-
readonly providerOptions?: unknown;
|
|
113
|
-
} | {
|
|
114
|
-
readonly type: "tool-call";
|
|
115
|
-
readonly input: unknown;
|
|
116
|
-
readonly toolCallId: string;
|
|
117
|
-
readonly toolName: string;
|
|
118
|
-
readonly providerOptions?: unknown;
|
|
119
|
-
readonly providerExecuted?: boolean | undefined;
|
|
120
|
-
})[];
|
|
121
|
-
readonly providerOptions?: unknown;
|
|
122
|
-
} | {
|
|
123
|
-
readonly role: "tool";
|
|
124
|
-
readonly content: readonly {
|
|
125
|
-
readonly type: "tool-result";
|
|
126
|
-
readonly output: unknown;
|
|
127
|
-
readonly toolCallId: string;
|
|
128
|
-
readonly toolName: string;
|
|
129
|
-
readonly media?: readonly {
|
|
130
|
-
readonly type: "media";
|
|
131
|
-
readonly mediaType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
132
|
-
readonly data: string;
|
|
133
|
-
readonly fingerprint: string;
|
|
134
|
-
readonly bytes: number;
|
|
135
|
-
readonly name?: string;
|
|
136
|
-
readonly alt?: string;
|
|
137
|
-
}[];
|
|
138
|
-
readonly providerOptions?: unknown;
|
|
139
|
-
readonly isError?: boolean | undefined;
|
|
140
|
-
}[];
|
|
141
|
-
readonly providerOptions?: unknown;
|
|
142
|
-
};
|
|
143
|
-
} | {
|
|
144
|
-
readonly _tag: "ToolResult";
|
|
145
|
-
readonly toolCallId: string;
|
|
146
|
-
readonly toolName: string;
|
|
147
|
-
readonly isError: boolean;
|
|
148
|
-
readonly subjects: readonly {
|
|
149
|
-
readonly kind: string;
|
|
150
|
-
readonly id: string;
|
|
151
|
-
readonly label: string | null;
|
|
152
|
-
readonly data: unknown;
|
|
153
|
-
}[];
|
|
154
|
-
readonly artifacts: readonly {
|
|
155
|
-
readonly id: string;
|
|
156
|
-
readonly kind: "image" | "file";
|
|
157
|
-
readonly mediaType: string;
|
|
158
|
-
readonly url: string;
|
|
159
|
-
readonly alt: string | null;
|
|
160
|
-
}[];
|
|
161
|
-
readonly encoded: unknown;
|
|
162
|
-
readonly view: string;
|
|
163
|
-
readonly viewVersion: string;
|
|
164
|
-
readonly pinned: boolean;
|
|
165
|
-
readonly media?: readonly {
|
|
166
|
-
readonly path: readonly (string | number)[];
|
|
167
|
-
readonly fingerprint: string;
|
|
168
|
-
readonly mediaType: "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
169
|
-
readonly bytes: number;
|
|
170
|
-
}[];
|
|
171
|
-
readonly mediaNotes?: readonly string[];
|
|
172
|
-
} | {
|
|
173
|
-
readonly _tag: "ToolDigest";
|
|
174
|
-
readonly entry: string;
|
|
175
|
-
readonly version: string;
|
|
176
|
-
readonly mode: "select" | "summarize";
|
|
177
|
-
readonly keep: readonly string[];
|
|
178
|
-
readonly text: string;
|
|
179
|
-
readonly digester: string;
|
|
180
|
-
readonly trigger: "write" | "compaction";
|
|
181
|
-
} | {
|
|
182
|
-
readonly _tag: "StepContext";
|
|
183
|
-
readonly step: number;
|
|
184
|
-
readonly text: string;
|
|
185
|
-
} | {
|
|
186
|
-
readonly _tag: "ToolsActivated";
|
|
187
|
-
readonly skills: readonly string[];
|
|
188
|
-
readonly tools: readonly string[];
|
|
189
|
-
readonly source: "always" | "matcher" | "load_skill" | "host";
|
|
190
|
-
readonly decision: string | null;
|
|
191
|
-
} | {
|
|
192
|
-
readonly _tag: "Compaction";
|
|
193
|
-
readonly strategy: string;
|
|
194
|
-
readonly version: string;
|
|
195
|
-
readonly action: {
|
|
196
|
-
readonly _tag: "CompactViews";
|
|
197
|
-
readonly entries: readonly string[];
|
|
198
|
-
readonly texts: readonly string[];
|
|
199
|
-
} | {
|
|
200
|
-
readonly _tag: "Spill";
|
|
201
|
-
readonly entry: string;
|
|
202
|
-
readonly preview: string;
|
|
203
|
-
} | {
|
|
204
|
-
readonly _tag: "DropTurns";
|
|
205
|
-
readonly throughTurn: number;
|
|
206
|
-
readonly ledger: string;
|
|
207
|
-
} | {
|
|
208
|
-
readonly _tag: "Summarize";
|
|
209
|
-
readonly keepFromTurn: number;
|
|
210
|
-
readonly summary: string;
|
|
211
|
-
} | {
|
|
212
|
-
readonly _tag: "OmitMedia";
|
|
213
|
-
readonly entries: readonly string[];
|
|
214
|
-
readonly reason: string;
|
|
215
|
-
};
|
|
216
|
-
} | {
|
|
217
|
-
readonly _tag: "TurnEnded";
|
|
218
|
-
readonly outcome: "partial" | "completed" | "failed";
|
|
219
|
-
readonly reply: string | null;
|
|
220
|
-
};
|
|
221
|
-
}[];
|
|
222
|
-
requests: readonly unknown[];
|
|
223
|
-
}, unknown, never>;
|
|
224
|
-
/** The golden conversation's two halves, each as the exact text of its file. */
|
|
225
|
-
export declare const goldenTexts: (result: Effect.Success<ReturnType<typeof runGolden>>) => {
|
|
226
|
-
model: string;
|
|
227
|
-
journal: string;
|
|
228
|
-
};
|
|
229
|
-
/** Compare a run with both golden files (and rewrite the ones the environment asks for). */
|
|
230
|
-
export declare const expectGolden: (result: Effect.Success<ReturnType<typeof runGolden>>) => Promise<void>;
|
|
231
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { Context, Duration, Effect, Layer, Option, Schema, Scope, Stream } from "effect";
|
|
2
|
-
import { LanguageModel, Tool } from "effect/ai";
|
|
3
|
-
import { Agent, ConversationId, HarnessError, Sessions, TurnEvents } from "@xandreed/sdk";
|
|
4
|
-
import type { Capability, SessionAddress, SessionLog, Turn, TurnEvent, TurnEventOf, TurnEventsService, TurnOutcome } from "@xandreed/sdk";
|
|
5
|
-
import type { FeedOptions, FeedProjection, SsePeer } from "@xandreed/plugin-render";
|
|
6
|
-
/** What a server instance is built from. */
|
|
7
|
-
export interface HostOptions {
|
|
8
|
-
/** The session store every instance shares (your database; `SessionLogMemoryLive` is one process's). */
|
|
9
|
-
readonly log: Layer.Layer<SessionLog>;
|
|
10
|
-
/** From `@xandreed/plugin-models`, or any effect/ai provider. */
|
|
11
|
-
readonly model: LanguageModel.LanguageModel;
|
|
12
|
-
readonly capabilities?: ReadonlyArray<Capability>;
|
|
13
|
-
readonly feed?: FeedOptions;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* One server instance: the agent, the services it was given (the Sessions
|
|
17
|
-
* it writes through, and their activity probe), the journal feed and the model.
|
|
18
|
-
*/
|
|
19
|
-
export declare const makeHost: (options: HostOptions) => Effect.Effect<{
|
|
20
|
-
agent: Agent;
|
|
21
|
-
services: Context.Context<Sessions | import("@xandreed/core").TurnActivity>;
|
|
22
|
-
sessions: {
|
|
23
|
-
readonly create: (input: {
|
|
24
|
-
readonly owner: string;
|
|
25
|
-
readonly id?: ConversationId;
|
|
26
|
-
readonly origin?: string;
|
|
27
|
-
readonly meta?: import("@xandreed/core").JsonObject;
|
|
28
|
-
}) => Effect.Effect<import("@xandreed/core").SessionView, import("@xandreed/core").SessionExists | import("@xandreed/core").SessionLogError>;
|
|
29
|
-
readonly fork: (parent: SessionAddress, input: {
|
|
30
|
-
readonly id?: ConversationId;
|
|
31
|
-
readonly origin: string;
|
|
32
|
-
readonly meta?: import("@xandreed/core").JsonObject;
|
|
33
|
-
readonly inherit: boolean;
|
|
34
|
-
}) => Effect.Effect<import("@xandreed/core").SessionView, import("@xandreed/core").SessionExists | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
35
|
-
readonly get: (address: SessionAddress) => Effect.Effect<import("@xandreed/core").SessionView, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
36
|
-
readonly list: (query: {
|
|
37
|
-
readonly owner: string;
|
|
38
|
-
readonly limit?: number;
|
|
39
|
-
readonly before?: import("@xandreed/core").SessionListCursor;
|
|
40
|
-
readonly parent?: ConversationId;
|
|
41
|
-
}) => Effect.Effect<import("@xandreed/core").SessionPage, import("@xandreed/core").SessionLogError>;
|
|
42
|
-
readonly remove: (address: SessionAddress) => Effect.Effect<void, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
43
|
-
readonly read: (address: SessionAddress, query?: {
|
|
44
|
-
readonly after?: number;
|
|
45
|
-
readonly kinds?: ReadonlyArray<string>;
|
|
46
|
-
readonly limit?: number;
|
|
47
|
-
}) => Effect.Effect<ReadonlyArray<import("@xandreed/core").SessionLogEvent>, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
48
|
-
readonly changes: (address: SessionAddress) => Stream.Stream<void>;
|
|
49
|
-
readonly lookup: (address: SessionAddress, key: string) => Effect.Effect<Option.Option<number>, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
50
|
-
readonly transact: <A, E>(address: SessionAddress, decide: (view: import("@xandreed/core").SessionView) => Effect.Effect<import("@xandreed/core").Decision<A>, E>) => Effect.Effect<import("@xandreed/core").Decided<A>, E | import("@xandreed/core").ReservedKind | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
51
|
-
readonly cancel: (address: SessionAddress, turn: number) => Effect.Effect<{
|
|
52
|
-
readonly cancelled: boolean;
|
|
53
|
-
readonly pending: number;
|
|
54
|
-
}, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
55
|
-
readonly begin: (address: SessionAddress, input: import("@xandreed/core").BeginTurn) => Effect.Effect<import("@xandreed/core").TurnWriter, import("@xandreed/core").AttachmentRejected | import("@xandreed/core").SessionBusy | import("@xandreed/core").TurnDuplicate | import("@xandreed/core").KeyConflict | import("@xandreed/core").NothingPending | import("@xandreed/core").NotResumable | import("@xandreed/core").TurnRefused | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError, Scope.Scope>;
|
|
56
|
-
readonly deliver: (address: SessionAddress, item: import("@xandreed/core").InboxItem) => Effect.Effect<{
|
|
57
|
-
readonly delivered: boolean;
|
|
58
|
-
readonly pending: number;
|
|
59
|
-
}, import("@xandreed/core").InboxFull | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError>;
|
|
60
|
-
readonly drain: <E, R>(address: SessionAddress, run: (writer: import("@xandreed/core").TurnWriter) => Effect.Effect<void, E, R>, options?: {
|
|
61
|
-
readonly maxTurns?: number;
|
|
62
|
-
readonly meta?: import("@xandreed/core").JsonObject;
|
|
63
|
-
}) => Effect.Effect<{
|
|
64
|
-
readonly turns: number;
|
|
65
|
-
}, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError, R>;
|
|
66
|
-
};
|
|
67
|
-
feed: {
|
|
68
|
-
readonly frames: (feed: import("@xandreed/plugin-render").FeedScope, after: number, project: FeedProjection) => Stream.Stream<import("@xandreed/plugin-render").FeedFrame, import("@xandreed/plugin-render").RenderError>;
|
|
69
|
-
};
|
|
70
|
-
model: LanguageModel.LanguageModel;
|
|
71
|
-
}, HarnessError, Scope.Scope>;
|
|
72
|
-
export type Host = Effect.Success<ReturnType<typeof makeHost>>;
|
|
73
|
-
/** Built once per server instance (a module-level promise in Next.js); its scope is never closed. */
|
|
74
|
-
export declare const startHost: (options: HostOptions) => Promise<Host>;
|
|
75
|
-
/** One SSE frame for the client: an event name and its JSON data. */
|
|
76
|
-
export interface Frame {
|
|
77
|
-
readonly event: string;
|
|
78
|
-
readonly data: Readonly<Record<string, unknown>>;
|
|
79
|
-
}
|
|
80
|
-
/** The bus events a client is shown, as frames; `None` skips one. Tool input and output stay on the server. */
|
|
81
|
-
export declare const progressOf: (event: TurnEvent) => Option.Option<Frame>;
|
|
82
|
-
/** Sends one frame to the client. It must never fail (see `clientPush`). */
|
|
83
|
-
export type Push = (frame: Frame) => Effect.Effect<void>;
|
|
84
|
-
/**
|
|
85
|
-
* `use` for a turn streamed to a client: one background subscription (one
|
|
86
|
-
* ordered lane, off the loop's path) for every frame, each tagged with the
|
|
87
|
-
* turn's number, then the run.
|
|
88
|
-
*/
|
|
89
|
-
export declare const streamTo: (push: Push) => (turn: Turn) => Effect.Effect<TurnOutcome, HarnessError, Scope.Scope>;
|
|
90
|
-
/** Whether the client took `bytes` within `timeout`: a write still waiting then, or one that failed (the client left), was not. */
|
|
91
|
-
export declare const writeWithin: (writer: WritableStreamDefaultWriter<Uint8Array>, bytes: Uint8Array, timeout: Duration.Input) => Effect.Effect<boolean, never, never>;
|
|
92
|
-
/**
|
|
93
|
-
* Ends a client's stream without waiting: a stream aborted while a write
|
|
94
|
-
* still waits settles neither until the client reads again or leaves.
|
|
95
|
-
*/
|
|
96
|
-
export declare const closeStream: (writer: WritableStreamDefaultWriter<Uint8Array>) => Effect.Effect<Promise<undefined>, never, never>;
|
|
97
|
-
/**
|
|
98
|
-
* A client's stream as a `Push` that never fails and never holds the turn
|
|
99
|
-
* up: a write the client has not taken within `timeout` marks it gone and
|
|
100
|
-
* aborts the stream, and every later frame is dropped. A handler that fails
|
|
101
|
-
* fails the turn; one that never returns keeps it from recording its reply.
|
|
102
|
-
*/
|
|
103
|
-
export declare const clientPush: (writer: WritableStreamDefaultWriter<Uint8Array>, timeout?: Duration.Input) => Effect.Effect<Push, never, never>;
|
|
104
|
-
/** For the turn's `layer`: a subscription there sees `turn.started` (with `meta` and `resumes`), which `use` never does. */
|
|
105
|
-
export declare const onTurnStarted: (handle: (event: TurnEventOf<"turn.started">) => Effect.Effect<void>) => Layer.Layer<never, never, TurnEvents>;
|
|
106
|
-
/**
|
|
107
|
-
* From `use`: a subscription moved into `outer`, a scope the caller keeps
|
|
108
|
-
* open past the turn, the only kind that sees `turn.ended`. Its handler runs
|
|
109
|
-
* after the turn's own scopes have closed, and must not fail.
|
|
110
|
-
*/
|
|
111
|
-
export declare const onTurnEnded: (outer: Scope.Scope, handle: (event: TurnEventOf<"turn.ended">) => Effect.Effect<void>) => (turn: Turn) => Effect.Effect<void, never, never>;
|
|
112
|
-
export declare const Lookup: Tool.Tool<"lookup", {
|
|
113
|
-
readonly parameters: Schema.Struct<{
|
|
114
|
-
readonly query: Schema.String;
|
|
115
|
-
}>;
|
|
116
|
-
readonly success: Schema.Struct<{
|
|
117
|
-
readonly found: Schema.Number;
|
|
118
|
-
}>;
|
|
119
|
-
readonly failure: Schema.Struct<{
|
|
120
|
-
readonly error: Schema.String;
|
|
121
|
-
readonly message: Schema.String;
|
|
122
|
-
}>;
|
|
123
|
-
readonly failureMode: "return";
|
|
124
|
-
}, never>;
|
|
125
|
-
/** Typed reactions to `lookup`'s successful calls, and a line for every call refused or failed. */
|
|
126
|
-
export declare const watchTools: (turn: Turn, report: (line: string) => Effect.Effect<void>) => Effect.Effect<void, never, Scope.Scope>;
|
|
127
|
-
/** The application's own event: typed by its schema, journaled under its name, seen by the session's followers. */
|
|
128
|
-
export declare const Progress: {
|
|
129
|
-
name: string;
|
|
130
|
-
make: (data: {
|
|
131
|
-
readonly stage: string;
|
|
132
|
-
readonly done: number;
|
|
133
|
-
}) => Effect.Effect<TurnEvent, HarnessError>;
|
|
134
|
-
select: (event: TurnEvent) => Option.Option<{
|
|
135
|
-
readonly stage: string;
|
|
136
|
-
readonly done: number;
|
|
137
|
-
}>;
|
|
138
|
-
publish: (events: TurnEventsService, data: {
|
|
139
|
-
readonly stage: string;
|
|
140
|
-
readonly done: number;
|
|
141
|
-
}) => Effect.Effect<void, HarnessError, never>;
|
|
142
|
-
on: <R>(handle: (data: {
|
|
143
|
-
readonly stage: string;
|
|
144
|
-
readonly done: number;
|
|
145
|
-
}) => Effect.Effect<void, HarnessError, R>, options?: import("@xandreed/core").SubscribeOptions) => import("@xandreed/core").Subscription<R>;
|
|
146
|
-
};
|
|
147
|
-
/** Publish it from `use` (`turn.events`), a task, a tool (`RunContext.events`) or a session plugin (`TurnEvents`). */
|
|
148
|
-
export declare const reportStage: (events: TurnEventsService, stage: string, done: number) => Effect.Effect<void, HarnessError, never>;
|
|
149
|
-
/** The events stored after `cursor`, oldest first, and the cursor to read from next. */
|
|
150
|
-
export declare const readAfter: (sessions: typeof Sessions.Service, address: SessionAddress, cursor: number) => Effect.Effect<{
|
|
151
|
-
events: readonly {
|
|
152
|
-
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
153
|
-
readonly seq: number;
|
|
154
|
-
readonly turn: Option.Option<number>;
|
|
155
|
-
readonly kind: string;
|
|
156
|
-
readonly at: number;
|
|
157
|
-
readonly data: {
|
|
158
|
-
readonly [x: string]: unknown;
|
|
159
|
-
};
|
|
160
|
-
}[];
|
|
161
|
-
cursor: number;
|
|
162
|
-
}, import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError, never>;
|
|
163
|
-
/** How each turn of a session ended, as stored: the reason and, when it failed, the failing error's code. */
|
|
164
|
-
export declare const endingsOf: (sessions: typeof Sessions.Service, address: SessionAddress) => Effect.Effect<{
|
|
165
|
-
turn: number | null;
|
|
166
|
-
reason: "partial" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
167
|
-
code: string | null;
|
|
168
|
-
}[], Schema.SchemaError | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError, never>;
|
|
169
|
-
/** How a turn ended and what it replied, as the journal has it. */
|
|
170
|
-
export interface StoredAnswer {
|
|
171
|
-
readonly turn: number;
|
|
172
|
-
readonly reason: string;
|
|
173
|
-
readonly reply: string | null;
|
|
174
|
-
}
|
|
175
|
-
/** What the turn begun with `key` answered, from the journal: none until that turn has ended. */
|
|
176
|
-
export declare const storedAnswer: (sessions: typeof Sessions.Service, address: SessionAddress, key: string) => Effect.Effect<Option.None<StoredAnswer> | Option.Some<StoredAnswer>, Schema.SchemaError | import("@xandreed/core").SessionMissing | import("@xandreed/core").SessionLogError, never>;
|
|
177
|
-
/** The journal as a client sees it: each shown record with its turn, and the app's own `app.*` events as they are. */
|
|
178
|
-
export declare const clientProjection: FeedProjection;
|
|
179
|
-
export declare const statusOf: (code: string) => number;
|
|
180
|
-
export declare const problem: (status: number, code: string) => Response;
|
|
181
|
-
/**
|
|
182
|
-
* POST /sessions/:id/turns, `{ text, resumes? }` with an `Idempotency-Key`
|
|
183
|
-
* header: the turn as SSE frames, `started` first and `done` last. A turn
|
|
184
|
-
* that cannot begin is answered with its code's status before anything
|
|
185
|
-
* streams. `waitUntil` keeps the turn running after the client leaves.
|
|
186
|
-
*/
|
|
187
|
-
export declare const turnRoute: (host: Host, owner: string, id: string, request: Request, waitUntil: (work: Promise<unknown>) => void) => Promise<Response>;
|
|
188
|
-
/**
|
|
189
|
-
* POST /sessions, `{ id? }`: a new session, 201. A client that names the id
|
|
190
|
-
* may retry: its own session again is 200, an id another owner holds is 409.
|
|
191
|
-
*/
|
|
192
|
-
export declare const createSessionRoute: (host: Host, owner: string, request: Request) => Promise<Response>;
|
|
193
|
-
/**
|
|
194
|
-
* An SSE peer over a Web stream: a write never fails, and `closed` completes
|
|
195
|
-
* when the client leaves, or once a write has waited `timeout` on a client
|
|
196
|
-
* that stopped reading: the stream is then aborted, and the feed stops.
|
|
197
|
-
*/
|
|
198
|
-
export declare const webSsePeer: (writer: WritableStreamDefaultWriter<Uint8Array>, signal: AbortSignal, timeout?: Duration.Input) => SsePeer;
|
|
199
|
-
/**
|
|
200
|
-
* GET /sessions/:id/events: the session's journal from the client's cursor
|
|
201
|
-
* as SSE (`id: <seq>`, `event: <kind>`), polled, and woken by this
|
|
202
|
-
* instance's own commits, until the feed's `maxDurationMs` or a client that
|
|
203
|
-
* stopped reading is dropped; EventSource then reconnects with `Last-Event-ID`.
|
|
204
|
-
*/
|
|
205
|
-
export declare const eventsRoute: (host: Host, owner: string, id: string, request: Request, waitUntil: (work: Promise<unknown>) => void) => Promise<Response>;
|
|
206
|
-
/** GET /ping: what this instance has in flight, for a load balancer, or a deploy waiting to stop it. */
|
|
207
|
-
export declare const pingRoute: (host: Host) => Promise<Response>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/testing.port.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
import type { Ref } from "effect";
|
|
3
|
-
declare const Tally_base: Context.ServiceClass<Tally, "test/Tally", {
|
|
4
|
-
readonly runId: string;
|
|
5
|
-
readonly seen: Ref.Ref<ReadonlyArray<string>>;
|
|
6
|
-
}>;
|
|
7
|
-
/** A per-turn host service for the agent tests: built by the turn's layer, read by use, tools and subscriptions. */
|
|
8
|
-
export declare class Tally extends Tally_base {
|
|
9
|
-
}
|
|
10
|
-
declare const Stamp_base: Context.ServiceClass<Stamp, "test/Stamp", {
|
|
11
|
-
readonly label: string;
|
|
12
|
-
}>;
|
|
13
|
-
/** A service a turn-dependent plugin provides in the agent tests, read by the host's layer. */
|
|
14
|
-
export declare class Stamp extends Stamp_base {
|
|
15
|
-
}
|
|
16
|
-
export {};
|
package/dist/testing.port.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|