@xandreed/sdk 0.13.0 → 0.15.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/agent.adapter.d.ts +111 -11
  3. package/dist/agent.adapter.js +80 -34
  4. package/dist/conformance/index.d.ts +2 -0
  5. package/dist/conformance/index.js +1 -0
  6. package/dist/inbox-runner.adapter.d.ts +18 -0
  7. package/dist/inbox-runner.adapter.js +8 -0
  8. package/dist/index.d.ts +34 -1
  9. package/dist/index.js +58 -1
  10. package/dist/task-executor.adapter.d.ts +32 -0
  11. package/dist/task-executor.adapter.js +10 -0
  12. package/dist/task-inbox-runner.adapter.d.ts +11 -0
  13. package/dist/task-inbox-runner.adapter.js +22 -0
  14. package/dist/turn/memory-checkpoint.adapter.d.ts +17 -0
  15. package/dist/turn/memory-checkpoint.adapter.js +62 -0
  16. package/dist/turn/model-call-recorder.adapter.d.ts +9 -0
  17. package/dist/turn/model-call-recorder.adapter.js +93 -0
  18. package/dist/turn/model-call-recorder.entity.d.ts +145 -0
  19. package/dist/turn/model-call-recorder.entity.functions.d.ts +5 -0
  20. package/dist/turn/model-call-recorder.entity.functions.js +4 -0
  21. package/dist/turn/model-call-recorder.entity.js +8 -0
  22. package/dist/turn/tool-registry.conformance.d.ts +61 -0
  23. package/dist/turn/tool-registry.conformance.js +547 -0
  24. package/dist/turn/turn-after-reply.entity.functions.d.ts +9 -0
  25. package/dist/turn/turn-after-reply.entity.functions.js +4 -0
  26. package/dist/turn/turn-lifecycle.usecase.functions.d.ts +135 -0
  27. package/dist/turn/turn-lifecycle.usecase.functions.js +131 -0
  28. package/dist/turn/turn-observation.entity.d.ts +28 -0
  29. package/dist/turn/turn-observation.entity.functions.d.ts +15 -0
  30. package/dist/turn/turn-observation.entity.functions.js +17 -0
  31. package/dist/turn/turn-observation.entity.js +12 -0
  32. package/dist/turn/turn-overflow.entity.d.ts +7 -0
  33. package/dist/turn/turn-overflow.entity.functions.d.ts +11 -0
  34. package/dist/turn/turn-overflow.entity.functions.js +12 -0
  35. package/dist/turn/turn-overflow.entity.js +5 -0
  36. package/dist/turn/turn-phase.entity.d.ts +462 -0
  37. package/dist/turn/turn-phase.entity.functions.d.ts +44 -0
  38. package/dist/turn/turn-phase.entity.functions.js +49 -0
  39. package/dist/turn/turn-phase.entity.js +13 -0
  40. package/dist/turn/turn-run.usecase.functions.d.ts +72 -0
  41. package/dist/turn/turn-run.usecase.functions.js +329 -0
  42. package/dist/turn/turn.adapter.d.ts +26 -0
  43. package/dist/turn/turn.adapter.js +225 -0
  44. package/package.json +10 -4
  45. package/dist/agent.adapter.test.d.ts +0 -1
  46. package/dist/agent.backends.test.d.ts +0 -1
  47. package/dist/agent.golden.test.d.ts +0 -190
  48. package/dist/memory.conformance.test.d.ts +0 -1
  49. package/dist/plugin-stack.test.d.ts +0 -1
  50. package/dist/testing.port.d.ts +0 -16
  51. package/dist/testing.port.js +0 -7
  52. package/dist/turn-composition.test.d.ts +0 -1
@@ -1,190 +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
- } | {
72
- readonly _tag: "TurnContext";
73
- readonly sectionId: string;
74
- readonly version: string;
75
- readonly text: string;
76
- } | {
77
- readonly _tag: "Message";
78
- readonly message: {
79
- readonly role: "user";
80
- readonly content: string;
81
- readonly providerOptions?: unknown;
82
- } | {
83
- readonly role: "assistant";
84
- readonly content: readonly ({
85
- readonly type: "text";
86
- readonly text: string;
87
- readonly providerOptions?: unknown;
88
- } | {
89
- readonly type: "reasoning";
90
- readonly text: string;
91
- readonly providerOptions?: unknown;
92
- } | {
93
- readonly type: "tool-call";
94
- readonly toolCallId: string;
95
- readonly toolName: string;
96
- readonly input: unknown;
97
- readonly providerOptions?: unknown;
98
- readonly providerExecuted?: boolean | undefined;
99
- })[];
100
- readonly providerOptions?: unknown;
101
- } | {
102
- readonly role: "tool";
103
- readonly content: readonly {
104
- readonly type: "tool-result";
105
- readonly toolCallId: string;
106
- readonly toolName: string;
107
- readonly output: unknown;
108
- readonly providerOptions?: unknown;
109
- readonly isError?: boolean | undefined;
110
- }[];
111
- readonly providerOptions?: unknown;
112
- };
113
- } | {
114
- readonly _tag: "ToolResult";
115
- readonly toolCallId: string;
116
- readonly toolName: string;
117
- readonly isError: boolean;
118
- readonly encoded: unknown;
119
- readonly view: string;
120
- readonly viewVersion: string;
121
- readonly subjects: readonly {
122
- readonly kind: string;
123
- readonly id: string;
124
- readonly label: string | null;
125
- readonly data: unknown;
126
- }[];
127
- readonly artifacts: readonly {
128
- readonly id: string;
129
- readonly kind: "image" | "file";
130
- readonly mediaType: string;
131
- readonly url: string;
132
- readonly alt: string | null;
133
- }[];
134
- readonly pinned: boolean;
135
- } | {
136
- readonly _tag: "ToolDigest";
137
- readonly entry: string;
138
- readonly version: string;
139
- readonly mode: "select" | "summarize";
140
- readonly keep: readonly string[];
141
- readonly text: string;
142
- readonly digester: string;
143
- readonly trigger: "write" | "compaction";
144
- } | {
145
- readonly _tag: "StepContext";
146
- readonly step: number;
147
- readonly text: string;
148
- } | {
149
- readonly _tag: "ToolsActivated";
150
- readonly skills: readonly string[];
151
- readonly tools: readonly string[];
152
- readonly source: "always" | "matcher" | "load_skill" | "host";
153
- readonly decision: string | null;
154
- } | {
155
- readonly _tag: "Compaction";
156
- readonly strategy: string;
157
- readonly version: string;
158
- readonly action: {
159
- readonly _tag: "CompactViews";
160
- readonly entries: readonly string[];
161
- readonly texts: readonly string[];
162
- } | {
163
- readonly _tag: "Spill";
164
- readonly entry: string;
165
- readonly preview: string;
166
- } | {
167
- readonly _tag: "DropTurns";
168
- readonly throughTurn: number;
169
- readonly ledger: string;
170
- } | {
171
- readonly _tag: "Summarize";
172
- readonly keepFromTurn: number;
173
- readonly summary: string;
174
- };
175
- } | {
176
- readonly _tag: "TurnEnded";
177
- readonly outcome: "partial" | "completed" | "failed";
178
- readonly reply: string | null;
179
- };
180
- }[];
181
- requests: readonly unknown[];
182
- }, unknown, never>;
183
- /** The golden conversation's two halves, each as the exact text of its file. */
184
- export declare const goldenTexts: (result: Effect.Success<ReturnType<typeof runGolden>>) => {
185
- model: string;
186
- journal: string;
187
- };
188
- /** Compare a run with both golden files (and rewrite the ones the environment asks for). */
189
- export declare const expectGolden: (result: Effect.Success<ReturnType<typeof runGolden>>) => Promise<void>;
190
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -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 {};
@@ -1,7 +0,0 @@
1
- import { Context } from "effect";
2
-
3
- export class Tally extends Context.Service()("test/Tally") {
4
- }
5
-
6
- export class Stamp extends Context.Service()("test/Stamp") {
7
- }
@@ -1 +0,0 @@
1
- export {};