@fragno-dev/pi-fragment 0.0.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/LICENSE.md +16 -0
- package/README.md +107 -0
- package/bin/run.js +72 -0
- package/dist/browser/client/react.d.ts +264 -0
- package/dist/browser/client/react.d.ts.map +1 -0
- package/dist/browser/client/react.js +84 -0
- package/dist/browser/client/react.js.map +1 -0
- package/dist/browser/client/solid.d.ts +266 -0
- package/dist/browser/client/solid.d.ts.map +1 -0
- package/dist/browser/client/solid.js +122 -0
- package/dist/browser/client/solid.js.map +1 -0
- package/dist/browser/client/svelte.d.ts +261 -0
- package/dist/browser/client/svelte.d.ts.map +1 -0
- package/dist/browser/client/svelte.js +126 -0
- package/dist/browser/client/svelte.js.map +1 -0
- package/dist/browser/client/vanilla.d.ts +238 -0
- package/dist/browser/client/vanilla.d.ts.map +1 -0
- package/dist/browser/client/vanilla.js +11 -0
- package/dist/browser/client/vanilla.js.map +1 -0
- package/dist/browser/client/vue.d.ts +264 -0
- package/dist/browser/client/vue.d.ts.map +1 -0
- package/dist/browser/client/vue.js +125 -0
- package/dist/browser/client/vue.js.map +1 -0
- package/dist/browser/client-Bk-J98pf.d.ts +679 -0
- package/dist/browser/client-Bk-J98pf.d.ts.map +1 -0
- package/dist/browser/factory-DKoO_lRA.js +2470 -0
- package/dist/browser/factory-DKoO_lRA.js.map +1 -0
- package/dist/browser/index.d.ts +776 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +3 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +10 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.d.ts +13 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +64 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/http/client.js +95 -0
- package/dist/cli/http/client.js.map +1 -0
- package/dist/cli/mod.d.ts +62 -0
- package/dist/cli/mod.d.ts.map +1 -0
- package/dist/cli/mod.js +644 -0
- package/dist/cli/mod.js.map +1 -0
- package/dist/cli/render/index.d.ts +23 -0
- package/dist/cli/render/index.d.ts.map +1 -0
- package/dist/cli/render/index.js +37 -0
- package/dist/cli/render/index.js.map +1 -0
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.js +9 -0
- package/dist/node/pi/clients.d.ts +240 -0
- package/dist/node/pi/clients.d.ts.map +1 -0
- package/dist/node/pi/clients.js +18 -0
- package/dist/node/pi/clients.js.map +1 -0
- package/dist/node/pi/constants.d.ts +9 -0
- package/dist/node/pi/constants.d.ts.map +1 -0
- package/dist/node/pi/constants.js +22 -0
- package/dist/node/pi/constants.js.map +1 -0
- package/dist/node/pi/definition.d.ts +13 -0
- package/dist/node/pi/definition.d.ts.map +1 -0
- package/dist/node/pi/definition.js +10 -0
- package/dist/node/pi/definition.js.map +1 -0
- package/dist/node/pi/dsl.d.ts +24 -0
- package/dist/node/pi/dsl.d.ts.map +1 -0
- package/dist/node/pi/dsl.js +57 -0
- package/dist/node/pi/dsl.js.map +1 -0
- package/dist/node/pi/factory.d.ts +220 -0
- package/dist/node/pi/factory.d.ts.map +1 -0
- package/dist/node/pi/factory.js +12 -0
- package/dist/node/pi/factory.js.map +1 -0
- package/dist/node/pi/mappers.js +47 -0
- package/dist/node/pi/mappers.js.map +1 -0
- package/dist/node/pi/route-schemas.js +112 -0
- package/dist/node/pi/route-schemas.js.map +1 -0
- package/dist/node/pi/types.d.ts +67 -0
- package/dist/node/pi/types.d.ts.map +1 -0
- package/dist/node/pi/workflow.d.ts +31 -0
- package/dist/node/pi/workflow.d.ts.map +1 -0
- package/dist/node/pi/workflow.js +242 -0
- package/dist/node/pi/workflow.js.map +1 -0
- package/dist/node/routes.d.ts +217 -0
- package/dist/node/routes.d.ts.map +1 -0
- package/dist/node/routes.js +328 -0
- package/dist/node/routes.js.map +1 -0
- package/dist/node/schema.js +12 -0
- package/dist/node/schema.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
import { n as FragnoClientMutatorData, o as NonGetHTTPMethod, s as FragnoPublicClientConfig, t as FragnoClientHookData } from "./client-Bk-J98pf.js";
|
|
2
|
+
import * as _fragno_dev_core0 from "@fragno-dev/core";
|
|
3
|
+
import { FragnoRouteConfig, InstantiatedFragmentFromDefinition } from "@fragno-dev/core";
|
|
4
|
+
import * as zod from "zod";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { AgentEvent, AgentMessage, AgentOptions, AgentTool, StreamFn, ThinkingLevel } from "@mariozechner/pi-agent-core";
|
|
7
|
+
import { Api, Model } from "@mariozechner/pi-ai";
|
|
8
|
+
import * as _fragno_dev_workflows0 from "@fragno-dev/workflows";
|
|
9
|
+
import { InstanceStatus, WorkflowsHistoryStep, workflowsFragmentDefinition } from "@fragno-dev/workflows";
|
|
10
|
+
import * as _fragno_dev_db_schema0 from "@fragno-dev/db/schema";
|
|
11
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
12
|
+
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
13
|
+
import * as _fragno_dev_db0 from "@fragno-dev/db";
|
|
14
|
+
import { FragnoPublicConfigWithDatabase, TxResult } from "@fragno-dev/db";
|
|
15
|
+
import * as _fragno_dev_db_fragment_definition_builder0 from "@fragno-dev/db/fragment-definition-builder";
|
|
16
|
+
|
|
17
|
+
//#region src/pi/clients.d.ts
|
|
18
|
+
declare function createPiFragmentClients(fragnoConfig: FragnoPublicClientConfig): {
|
|
19
|
+
useSessions: FragnoClientHookData<"GET", "/sessions", zod.ZodArray<zod.ZodObject<{
|
|
20
|
+
id: zod.ZodString;
|
|
21
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
22
|
+
status: zod.ZodEnum<{
|
|
23
|
+
active: "active";
|
|
24
|
+
paused: "paused";
|
|
25
|
+
errored: "errored";
|
|
26
|
+
terminated: "terminated";
|
|
27
|
+
complete: "complete";
|
|
28
|
+
waiting: "waiting";
|
|
29
|
+
}>;
|
|
30
|
+
agent: zod.ZodString;
|
|
31
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
32
|
+
steeringMode: zod.ZodEnum<{
|
|
33
|
+
all: "all";
|
|
34
|
+
"one-at-a-time": "one-at-a-time";
|
|
35
|
+
}>;
|
|
36
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
37
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
38
|
+
createdAt: zod.ZodDate;
|
|
39
|
+
updatedAt: zod.ZodDate;
|
|
40
|
+
}, zod_v4_core0.$strip>>, string, "limit">;
|
|
41
|
+
useSession: FragnoClientHookData<"GET", "/sessions/:sessionId", zod.ZodObject<{
|
|
42
|
+
id: zod.ZodString;
|
|
43
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
44
|
+
status: zod.ZodEnum<{
|
|
45
|
+
active: "active";
|
|
46
|
+
paused: "paused";
|
|
47
|
+
errored: "errored";
|
|
48
|
+
terminated: "terminated";
|
|
49
|
+
complete: "complete";
|
|
50
|
+
waiting: "waiting";
|
|
51
|
+
}>;
|
|
52
|
+
agent: zod.ZodString;
|
|
53
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
54
|
+
steeringMode: zod.ZodEnum<{
|
|
55
|
+
all: "all";
|
|
56
|
+
"one-at-a-time": "one-at-a-time";
|
|
57
|
+
}>;
|
|
58
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
59
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
60
|
+
createdAt: zod.ZodDate;
|
|
61
|
+
updatedAt: zod.ZodDate;
|
|
62
|
+
workflow: zod.ZodObject<{
|
|
63
|
+
status: zod.ZodEnum<{
|
|
64
|
+
active: "active";
|
|
65
|
+
paused: "paused";
|
|
66
|
+
errored: "errored";
|
|
67
|
+
terminated: "terminated";
|
|
68
|
+
complete: "complete";
|
|
69
|
+
waiting: "waiting";
|
|
70
|
+
}>;
|
|
71
|
+
error: zod.ZodOptional<zod.ZodObject<{
|
|
72
|
+
name: zod.ZodString;
|
|
73
|
+
message: zod.ZodString;
|
|
74
|
+
}, zod_v4_core0.$strip>>;
|
|
75
|
+
output: zod.ZodOptional<zod.ZodAny>;
|
|
76
|
+
}, zod_v4_core0.$strip>;
|
|
77
|
+
messages: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
78
|
+
role: zod.ZodLiteral<"user">;
|
|
79
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
80
|
+
type: zod.ZodLiteral<"text">;
|
|
81
|
+
text: zod.ZodString;
|
|
82
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
83
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
84
|
+
type: zod.ZodLiteral<"thinking">;
|
|
85
|
+
thinking: zod.ZodString;
|
|
86
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
87
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
88
|
+
type: zod.ZodLiteral<"image">;
|
|
89
|
+
data: zod.ZodString;
|
|
90
|
+
mimeType: zod.ZodString;
|
|
91
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
92
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
93
|
+
id: zod.ZodString;
|
|
94
|
+
name: zod.ZodString;
|
|
95
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
96
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
97
|
+
}, zod_v4_core0.$strip>]>>]>;
|
|
98
|
+
timestamp: zod.ZodNumber;
|
|
99
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
100
|
+
role: zod.ZodLiteral<"assistant">;
|
|
101
|
+
content: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
102
|
+
type: zod.ZodLiteral<"text">;
|
|
103
|
+
text: zod.ZodString;
|
|
104
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
105
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
106
|
+
type: zod.ZodLiteral<"thinking">;
|
|
107
|
+
thinking: zod.ZodString;
|
|
108
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
109
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
110
|
+
type: zod.ZodLiteral<"image">;
|
|
111
|
+
data: zod.ZodString;
|
|
112
|
+
mimeType: zod.ZodString;
|
|
113
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
114
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
115
|
+
id: zod.ZodString;
|
|
116
|
+
name: zod.ZodString;
|
|
117
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
118
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
119
|
+
}, zod_v4_core0.$strip>]>>;
|
|
120
|
+
api: zod.ZodString;
|
|
121
|
+
provider: zod.ZodString;
|
|
122
|
+
model: zod.ZodString;
|
|
123
|
+
usage: zod.ZodObject<{
|
|
124
|
+
input: zod.ZodNumber;
|
|
125
|
+
output: zod.ZodNumber;
|
|
126
|
+
cacheRead: zod.ZodNumber;
|
|
127
|
+
cacheWrite: zod.ZodNumber;
|
|
128
|
+
totalTokens: zod.ZodNumber;
|
|
129
|
+
cost: zod.ZodObject<{
|
|
130
|
+
input: zod.ZodNumber;
|
|
131
|
+
output: zod.ZodNumber;
|
|
132
|
+
cacheRead: zod.ZodNumber;
|
|
133
|
+
cacheWrite: zod.ZodNumber;
|
|
134
|
+
total: zod.ZodNumber;
|
|
135
|
+
}, zod_v4_core0.$strip>;
|
|
136
|
+
}, zod_v4_core0.$strip>;
|
|
137
|
+
stopReason: zod.ZodString;
|
|
138
|
+
errorMessage: zod.ZodOptional<zod.ZodString>;
|
|
139
|
+
timestamp: zod.ZodNumber;
|
|
140
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
141
|
+
role: zod.ZodLiteral<"toolResult">;
|
|
142
|
+
toolCallId: zod.ZodString;
|
|
143
|
+
toolName: zod.ZodString;
|
|
144
|
+
content: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
145
|
+
type: zod.ZodLiteral<"text">;
|
|
146
|
+
text: zod.ZodString;
|
|
147
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
148
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
149
|
+
type: zod.ZodLiteral<"thinking">;
|
|
150
|
+
thinking: zod.ZodString;
|
|
151
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
152
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
153
|
+
type: zod.ZodLiteral<"image">;
|
|
154
|
+
data: zod.ZodString;
|
|
155
|
+
mimeType: zod.ZodString;
|
|
156
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
157
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
158
|
+
id: zod.ZodString;
|
|
159
|
+
name: zod.ZodString;
|
|
160
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
161
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
162
|
+
}, zod_v4_core0.$strip>]>>;
|
|
163
|
+
details: zod.ZodOptional<zod.ZodUnknown>;
|
|
164
|
+
isError: zod.ZodBoolean;
|
|
165
|
+
timestamp: zod.ZodNumber;
|
|
166
|
+
}, zod_v4_core0.$strip>]>>;
|
|
167
|
+
trace: zod.ZodArray<zod.ZodObject<{
|
|
168
|
+
type: zod.ZodString;
|
|
169
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
170
|
+
}, zod_v4_core0.$strip>>;
|
|
171
|
+
summaries: zod.ZodArray<zod.ZodObject<{
|
|
172
|
+
turn: zod.ZodNumber;
|
|
173
|
+
assistant: zod.ZodNullable<zod.ZodAny>;
|
|
174
|
+
summary: zod.ZodNullable<zod.ZodString>;
|
|
175
|
+
}, zod_v4_core0.$strip>>;
|
|
176
|
+
}, zod_v4_core0.$strip>, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string>;
|
|
177
|
+
useCreateSession: FragnoClientMutatorData<NonGetHTTPMethod, "/sessions", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | zod.ZodObject<{
|
|
178
|
+
agent: zod.ZodString;
|
|
179
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
180
|
+
metadata: zod.ZodOptional<zod.ZodAny>;
|
|
181
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
182
|
+
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
183
|
+
all: "all";
|
|
184
|
+
"one-at-a-time": "one-at-a-time";
|
|
185
|
+
}>>;
|
|
186
|
+
}, zod_v4_core0.$strip> | undefined, zod.ZodObject<{
|
|
187
|
+
id: zod.ZodString;
|
|
188
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
189
|
+
status: zod.ZodEnum<{
|
|
190
|
+
active: "active";
|
|
191
|
+
paused: "paused";
|
|
192
|
+
errored: "errored";
|
|
193
|
+
terminated: "terminated";
|
|
194
|
+
complete: "complete";
|
|
195
|
+
waiting: "waiting";
|
|
196
|
+
}>;
|
|
197
|
+
agent: zod.ZodString;
|
|
198
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
199
|
+
steeringMode: zod.ZodEnum<{
|
|
200
|
+
all: "all";
|
|
201
|
+
"one-at-a-time": "one-at-a-time";
|
|
202
|
+
}>;
|
|
203
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
204
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
205
|
+
createdAt: zod.ZodDate;
|
|
206
|
+
updatedAt: zod.ZodDate;
|
|
207
|
+
}, zod_v4_core0.$strip> | zod.ZodArray<zod.ZodObject<{
|
|
208
|
+
id: zod.ZodString;
|
|
209
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
210
|
+
status: zod.ZodEnum<{
|
|
211
|
+
active: "active";
|
|
212
|
+
paused: "paused";
|
|
213
|
+
errored: "errored";
|
|
214
|
+
terminated: "terminated";
|
|
215
|
+
complete: "complete";
|
|
216
|
+
waiting: "waiting";
|
|
217
|
+
}>;
|
|
218
|
+
agent: zod.ZodString;
|
|
219
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
220
|
+
steeringMode: zod.ZodEnum<{
|
|
221
|
+
all: "all";
|
|
222
|
+
"one-at-a-time": "one-at-a-time";
|
|
223
|
+
}>;
|
|
224
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
225
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
226
|
+
createdAt: zod.ZodDate;
|
|
227
|
+
updatedAt: zod.ZodDate;
|
|
228
|
+
}, zod_v4_core0.$strip>> | undefined, string, string>;
|
|
229
|
+
useSendMessage: FragnoClientMutatorData<NonGetHTTPMethod, "/sessions/:sessionId/messages", zod.ZodObject<{
|
|
230
|
+
text: zod.ZodString;
|
|
231
|
+
done: zod.ZodOptional<zod.ZodBoolean>;
|
|
232
|
+
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
233
|
+
all: "all";
|
|
234
|
+
"one-at-a-time": "one-at-a-time";
|
|
235
|
+
}>>;
|
|
236
|
+
}, zod_v4_core0.$strip> | undefined, zod.ZodObject<{
|
|
237
|
+
status: zod.ZodEnum<{
|
|
238
|
+
active: "active";
|
|
239
|
+
paused: "paused";
|
|
240
|
+
errored: "errored";
|
|
241
|
+
terminated: "terminated";
|
|
242
|
+
complete: "complete";
|
|
243
|
+
waiting: "waiting";
|
|
244
|
+
}>;
|
|
245
|
+
}, zod_v4_core0.$strip> | undefined, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string>;
|
|
246
|
+
};
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/pi/constants.d.ts
|
|
249
|
+
declare const SESSION_STATUSES: readonly ["active", "paused", "errored", "terminated", "complete", "waiting"];
|
|
250
|
+
declare const STEERING_MODES: readonly ["all", "one-at-a-time"];
|
|
251
|
+
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
252
|
+
type PiSessionStatus = (typeof SESSION_STATUSES)[number];
|
|
253
|
+
type PiSteeringMode = (typeof STEERING_MODES)[number];
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/pi/types.d.ts
|
|
256
|
+
type WorkflowsService = InstantiatedFragmentFromDefinition<typeof workflowsFragmentDefinition>["services"];
|
|
257
|
+
type PiSession = {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string | null;
|
|
260
|
+
status: PiSessionStatus;
|
|
261
|
+
agent: string;
|
|
262
|
+
workflowInstanceId: string | null;
|
|
263
|
+
steeringMode: PiSteeringMode;
|
|
264
|
+
metadata: unknown;
|
|
265
|
+
tags: string[];
|
|
266
|
+
createdAt: Date;
|
|
267
|
+
updatedAt: Date;
|
|
268
|
+
};
|
|
269
|
+
type PiTurnSummary = {
|
|
270
|
+
turn: number;
|
|
271
|
+
assistant: AgentMessage | null;
|
|
272
|
+
summary: string | null;
|
|
273
|
+
};
|
|
274
|
+
type PiWorkflowsInstanceStatus = InstanceStatus;
|
|
275
|
+
type PiWorkflowHistoryStep = WorkflowsHistoryStep;
|
|
276
|
+
type PiWorkflowsService = Pick<WorkflowsService, "createInstance" | "getInstanceStatus" | "getInstanceRunNumber" | "sendEvent" | "listHistory"> & {
|
|
277
|
+
getInstanceStatusBatch?: (workflowName: string, instanceIds: string[]) => TxResult<PiWorkflowsInstanceStatus[], PiWorkflowsInstanceStatus[]>;
|
|
278
|
+
};
|
|
279
|
+
type PiAgentDefinition = {
|
|
280
|
+
name: string;
|
|
281
|
+
systemPrompt: string;
|
|
282
|
+
model: Model<Api>;
|
|
283
|
+
thinkingLevel?: ThinkingLevel;
|
|
284
|
+
tools?: string[];
|
|
285
|
+
toolConfig?: unknown;
|
|
286
|
+
maxTraceEvents?: number;
|
|
287
|
+
streamFn?: StreamFn;
|
|
288
|
+
convertToLlm?: AgentOptions["convertToLlm"];
|
|
289
|
+
transformContext?: AgentOptions["transformContext"];
|
|
290
|
+
getApiKey?: AgentOptions["getApiKey"];
|
|
291
|
+
thinkingBudgets?: AgentOptions["thinkingBudgets"];
|
|
292
|
+
maxRetryDelayMs?: AgentOptions["maxRetryDelayMs"];
|
|
293
|
+
onEvent?: (event: AgentEvent, ctx: {
|
|
294
|
+
sessionId: string;
|
|
295
|
+
turnId: string;
|
|
296
|
+
}) => void;
|
|
297
|
+
};
|
|
298
|
+
type PiAgentRegistry = Record<string, PiAgentDefinition>;
|
|
299
|
+
type PiToolFactoryContext = {
|
|
300
|
+
session: PiSession;
|
|
301
|
+
turnId: string;
|
|
302
|
+
toolConfig: unknown;
|
|
303
|
+
messages: AgentMessage[];
|
|
304
|
+
};
|
|
305
|
+
type PiToolFactory = AgentTool | ((ctx: PiToolFactoryContext) => AgentTool | Promise<AgentTool>);
|
|
306
|
+
type PiToolRegistry = Record<string, PiToolFactory>;
|
|
307
|
+
interface PiFragmentConfig {
|
|
308
|
+
agents: PiAgentRegistry;
|
|
309
|
+
tools: PiToolRegistry;
|
|
310
|
+
defaultSteeringMode?: PiSteeringMode;
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/pi/workflow.d.ts
|
|
314
|
+
declare const PI_WORKFLOW_NAME = "agent-loop-workflow";
|
|
315
|
+
type PiAgentLoopParams = {
|
|
316
|
+
sessionId: string;
|
|
317
|
+
agentName: string;
|
|
318
|
+
systemPrompt?: string;
|
|
319
|
+
initialMessages?: AgentMessage[];
|
|
320
|
+
};
|
|
321
|
+
type PiWorkflowsOptions = {
|
|
322
|
+
agents: PiAgentRegistry;
|
|
323
|
+
tools: PiToolRegistry;
|
|
324
|
+
};
|
|
325
|
+
declare const agentLoopWorkflow: (options: PiWorkflowsOptions) => _fragno_dev_workflows0.WorkflowDefinition<PiAgentLoopParams, {
|
|
326
|
+
messages: AgentMessage[];
|
|
327
|
+
}, z.ZodType<PiAgentLoopParams, unknown, z.core.$ZodTypeInternals<PiAgentLoopParams, unknown>>, undefined>;
|
|
328
|
+
type PiWorkflowsRegistry = {
|
|
329
|
+
agentLoop: ReturnType<typeof agentLoopWorkflow>;
|
|
330
|
+
};
|
|
331
|
+
declare const createPiWorkflows: (options: PiWorkflowsOptions) => {
|
|
332
|
+
agentLoop: _fragno_dev_workflows0.WorkflowDefinition<PiAgentLoopParams, {
|
|
333
|
+
messages: AgentMessage[];
|
|
334
|
+
}, z.ZodType<PiAgentLoopParams, unknown, z.core.$ZodTypeInternals<PiAgentLoopParams, unknown>>, undefined>;
|
|
335
|
+
};
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/pi/dsl.d.ts
|
|
338
|
+
type PiAgentDefinitionInput = Omit<PiAgentDefinition, "name"> & {
|
|
339
|
+
name?: string;
|
|
340
|
+
};
|
|
341
|
+
type PiRuntime = {
|
|
342
|
+
config: PiFragmentConfig;
|
|
343
|
+
workflows: PiWorkflowsRegistry;
|
|
344
|
+
};
|
|
345
|
+
declare const defineAgent: (name: string, definition: PiAgentDefinitionInput) => PiAgentDefinition;
|
|
346
|
+
declare const createPi: () => {
|
|
347
|
+
agent(definition: PiAgentDefinition): /*elided*/any;
|
|
348
|
+
agents(registry: PiAgentRegistry): /*elided*/any;
|
|
349
|
+
tool(name: string, tool: PiToolFactory): /*elided*/any;
|
|
350
|
+
tools(registry: PiToolRegistry): /*elided*/any;
|
|
351
|
+
defaultSteeringMode(mode: PiSteeringMode): /*elided*/any;
|
|
352
|
+
build(): PiRuntime;
|
|
353
|
+
};
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/pi/definition.d.ts
|
|
356
|
+
declare const piFragmentDefinition: _fragno_dev_core0.FragmentDefinition<PiFragmentConfig, _fragno_dev_db0.FragnoPublicConfigWithDatabase, _fragno_dev_db0.ImplicitDatabaseDependencies<_fragno_dev_db_schema0.Schema<Record<"session", _fragno_dev_db_schema0.Table<Record<string, _fragno_dev_db_schema0.AnyColumn> & Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"agent", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"workflowInstanceId", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"steeringMode", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"metadata", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"tags", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_session_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"idx_session_created", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["createdAt"]>>>>>>, {}, {}, {
|
|
357
|
+
workflows: PiWorkflowsService;
|
|
358
|
+
}, {}, _fragno_dev_db0.DatabaseServiceContext<_fragno_dev_db0.HooksMap>, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>, _fragno_dev_db_fragment_definition_builder0.DatabaseRequestStorage, []>;
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/pi/factory.d.ts
|
|
361
|
+
type PiFragmentServices = {
|
|
362
|
+
workflows: PiWorkflowsService;
|
|
363
|
+
};
|
|
364
|
+
declare function createPiFragment(config: PiFragmentConfig, options: FragnoPublicConfigWithDatabase, services: PiFragmentServices): _fragno_dev_core0.FragnoInstantiatedFragment<readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/sessions", zod.ZodObject<{
|
|
365
|
+
agent: zod.ZodString;
|
|
366
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
367
|
+
metadata: zod.ZodOptional<zod.ZodAny>;
|
|
368
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
369
|
+
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
370
|
+
all: "all";
|
|
371
|
+
"one-at-a-time": "one-at-a-time";
|
|
372
|
+
}>>;
|
|
373
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
374
|
+
id: zod.ZodString;
|
|
375
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
376
|
+
status: zod.ZodEnum<{
|
|
377
|
+
active: "active";
|
|
378
|
+
paused: "paused";
|
|
379
|
+
errored: "errored";
|
|
380
|
+
terminated: "terminated";
|
|
381
|
+
complete: "complete";
|
|
382
|
+
waiting: "waiting";
|
|
383
|
+
}>;
|
|
384
|
+
agent: zod.ZodString;
|
|
385
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
386
|
+
steeringMode: zod.ZodEnum<{
|
|
387
|
+
all: "all";
|
|
388
|
+
"one-at-a-time": "one-at-a-time";
|
|
389
|
+
}>;
|
|
390
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
391
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
392
|
+
createdAt: zod.ZodDate;
|
|
393
|
+
updatedAt: zod.ZodDate;
|
|
394
|
+
}, zod_v4_core0.$strip>, "AGENT_NOT_FOUND" | "WORKFLOWS_REQUIRED" | "WORKFLOW_CREATE_FAILED", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/sessions", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodArray<zod.ZodObject<{
|
|
395
|
+
id: zod.ZodString;
|
|
396
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
397
|
+
status: zod.ZodEnum<{
|
|
398
|
+
active: "active";
|
|
399
|
+
paused: "paused";
|
|
400
|
+
errored: "errored";
|
|
401
|
+
terminated: "terminated";
|
|
402
|
+
complete: "complete";
|
|
403
|
+
waiting: "waiting";
|
|
404
|
+
}>;
|
|
405
|
+
agent: zod.ZodString;
|
|
406
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
407
|
+
steeringMode: zod.ZodEnum<{
|
|
408
|
+
all: "all";
|
|
409
|
+
"one-at-a-time": "one-at-a-time";
|
|
410
|
+
}>;
|
|
411
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
412
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
413
|
+
createdAt: zod.ZodDate;
|
|
414
|
+
updatedAt: zod.ZodDate;
|
|
415
|
+
}, zod_v4_core0.$strip>>, string, "limit", _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/sessions/:sessionId", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
|
|
416
|
+
id: zod.ZodString;
|
|
417
|
+
name: zod.ZodNullable<zod.ZodString>;
|
|
418
|
+
status: zod.ZodEnum<{
|
|
419
|
+
active: "active";
|
|
420
|
+
paused: "paused";
|
|
421
|
+
errored: "errored";
|
|
422
|
+
terminated: "terminated";
|
|
423
|
+
complete: "complete";
|
|
424
|
+
waiting: "waiting";
|
|
425
|
+
}>;
|
|
426
|
+
agent: zod.ZodString;
|
|
427
|
+
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
428
|
+
steeringMode: zod.ZodEnum<{
|
|
429
|
+
all: "all";
|
|
430
|
+
"one-at-a-time": "one-at-a-time";
|
|
431
|
+
}>;
|
|
432
|
+
metadata: zod.ZodNullable<zod.ZodAny>;
|
|
433
|
+
tags: zod.ZodArray<zod.ZodString>;
|
|
434
|
+
createdAt: zod.ZodDate;
|
|
435
|
+
updatedAt: zod.ZodDate;
|
|
436
|
+
workflow: zod.ZodObject<{
|
|
437
|
+
status: zod.ZodEnum<{
|
|
438
|
+
active: "active";
|
|
439
|
+
paused: "paused";
|
|
440
|
+
errored: "errored";
|
|
441
|
+
terminated: "terminated";
|
|
442
|
+
complete: "complete";
|
|
443
|
+
waiting: "waiting";
|
|
444
|
+
}>;
|
|
445
|
+
error: zod.ZodOptional<zod.ZodObject<{
|
|
446
|
+
name: zod.ZodString;
|
|
447
|
+
message: zod.ZodString;
|
|
448
|
+
}, zod_v4_core0.$strip>>;
|
|
449
|
+
output: zod.ZodOptional<zod.ZodAny>;
|
|
450
|
+
}, zod_v4_core0.$strip>;
|
|
451
|
+
messages: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
452
|
+
role: zod.ZodLiteral<"user">;
|
|
453
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
454
|
+
type: zod.ZodLiteral<"text">;
|
|
455
|
+
text: zod.ZodString;
|
|
456
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
457
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
458
|
+
type: zod.ZodLiteral<"thinking">;
|
|
459
|
+
thinking: zod.ZodString;
|
|
460
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
461
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
462
|
+
type: zod.ZodLiteral<"image">;
|
|
463
|
+
data: zod.ZodString;
|
|
464
|
+
mimeType: zod.ZodString;
|
|
465
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
466
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
467
|
+
id: zod.ZodString;
|
|
468
|
+
name: zod.ZodString;
|
|
469
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
470
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
471
|
+
}, zod_v4_core0.$strip>]>>]>;
|
|
472
|
+
timestamp: zod.ZodNumber;
|
|
473
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
474
|
+
role: zod.ZodLiteral<"assistant">;
|
|
475
|
+
content: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
476
|
+
type: zod.ZodLiteral<"text">;
|
|
477
|
+
text: zod.ZodString;
|
|
478
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
479
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
480
|
+
type: zod.ZodLiteral<"thinking">;
|
|
481
|
+
thinking: zod.ZodString;
|
|
482
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
483
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
484
|
+
type: zod.ZodLiteral<"image">;
|
|
485
|
+
data: zod.ZodString;
|
|
486
|
+
mimeType: zod.ZodString;
|
|
487
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
488
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
489
|
+
id: zod.ZodString;
|
|
490
|
+
name: zod.ZodString;
|
|
491
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
492
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
493
|
+
}, zod_v4_core0.$strip>]>>;
|
|
494
|
+
api: zod.ZodString;
|
|
495
|
+
provider: zod.ZodString;
|
|
496
|
+
model: zod.ZodString;
|
|
497
|
+
usage: zod.ZodObject<{
|
|
498
|
+
input: zod.ZodNumber;
|
|
499
|
+
output: zod.ZodNumber;
|
|
500
|
+
cacheRead: zod.ZodNumber;
|
|
501
|
+
cacheWrite: zod.ZodNumber;
|
|
502
|
+
totalTokens: zod.ZodNumber;
|
|
503
|
+
cost: zod.ZodObject<{
|
|
504
|
+
input: zod.ZodNumber;
|
|
505
|
+
output: zod.ZodNumber;
|
|
506
|
+
cacheRead: zod.ZodNumber;
|
|
507
|
+
cacheWrite: zod.ZodNumber;
|
|
508
|
+
total: zod.ZodNumber;
|
|
509
|
+
}, zod_v4_core0.$strip>;
|
|
510
|
+
}, zod_v4_core0.$strip>;
|
|
511
|
+
stopReason: zod.ZodString;
|
|
512
|
+
errorMessage: zod.ZodOptional<zod.ZodString>;
|
|
513
|
+
timestamp: zod.ZodNumber;
|
|
514
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
515
|
+
role: zod.ZodLiteral<"toolResult">;
|
|
516
|
+
toolCallId: zod.ZodString;
|
|
517
|
+
toolName: zod.ZodString;
|
|
518
|
+
content: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
519
|
+
type: zod.ZodLiteral<"text">;
|
|
520
|
+
text: zod.ZodString;
|
|
521
|
+
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
522
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
523
|
+
type: zod.ZodLiteral<"thinking">;
|
|
524
|
+
thinking: zod.ZodString;
|
|
525
|
+
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
526
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
527
|
+
type: zod.ZodLiteral<"image">;
|
|
528
|
+
data: zod.ZodString;
|
|
529
|
+
mimeType: zod.ZodString;
|
|
530
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
531
|
+
type: zod.ZodLiteral<"toolCall">;
|
|
532
|
+
id: zod.ZodString;
|
|
533
|
+
name: zod.ZodString;
|
|
534
|
+
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
535
|
+
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
536
|
+
}, zod_v4_core0.$strip>]>>;
|
|
537
|
+
details: zod.ZodOptional<zod.ZodUnknown>;
|
|
538
|
+
isError: zod.ZodBoolean;
|
|
539
|
+
timestamp: zod.ZodNumber;
|
|
540
|
+
}, zod_v4_core0.$strip>]>>;
|
|
541
|
+
trace: zod.ZodArray<zod.ZodObject<{
|
|
542
|
+
type: zod.ZodString;
|
|
543
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
544
|
+
}, zod_v4_core0.$strip>>;
|
|
545
|
+
summaries: zod.ZodArray<zod.ZodObject<{
|
|
546
|
+
turn: zod.ZodNumber;
|
|
547
|
+
assistant: zod.ZodNullable<zod.ZodAny>;
|
|
548
|
+
summary: zod.ZodNullable<zod.ZodString>;
|
|
549
|
+
}, zod_v4_core0.$strip>>;
|
|
550
|
+
}, zod_v4_core0.$strip>, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/sessions/:sessionId/messages", zod.ZodObject<{
|
|
551
|
+
text: zod.ZodString;
|
|
552
|
+
done: zod.ZodOptional<zod.ZodBoolean>;
|
|
553
|
+
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
554
|
+
all: "all";
|
|
555
|
+
"one-at-a-time": "one-at-a-time";
|
|
556
|
+
}>>;
|
|
557
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
558
|
+
status: zod.ZodEnum<{
|
|
559
|
+
active: "active";
|
|
560
|
+
paused: "paused";
|
|
561
|
+
errored: "errored";
|
|
562
|
+
terminated: "terminated";
|
|
563
|
+
complete: "complete";
|
|
564
|
+
waiting: "waiting";
|
|
565
|
+
}>;
|
|
566
|
+
}, zod_v4_core0.$strip>, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>], _fragno_dev_db0.ImplicitDatabaseDependencies<_fragno_dev_db_schema0.Schema<Record<"session", _fragno_dev_db_schema0.Table<Record<string, _fragno_dev_db_schema0.AnyColumn> & Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"agent", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"workflowInstanceId", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"steeringMode", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"metadata", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"tags", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_session_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"idx_session_created", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["createdAt"]>>>>>>, _fragno_dev_core0.BoundServices<{}>, _fragno_dev_db0.DatabaseServiceContext<_fragno_dev_db0.HooksMap>, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>, _fragno_dev_db_fragment_definition_builder0.DatabaseRequestStorage, FragnoPublicConfigWithDatabase>;
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/routes.d.ts
|
|
569
|
+
declare const piRoutesFactory: _fragno_dev_core0.RouteFactory<PiFragmentConfig, _fragno_dev_db0.ImplicitDatabaseDependencies<_fragno_dev_db_schema0.Schema<Record<"session", _fragno_dev_db_schema0.Table<Record<string, _fragno_dev_db_schema0.AnyColumn> & Record<"id", _fragno_dev_db_schema0.IdColumn<"varchar(128)", string | _fragno_dev_db_schema0.FragnoId | null, _fragno_dev_db_schema0.FragnoId>> & Record<"name", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"agent", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"status", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"workflowInstanceId", _fragno_dev_db_schema0.Column<"string", string | null, string | null>> & Record<"steeringMode", _fragno_dev_db_schema0.Column<"string", string, string>> & Record<"metadata", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"tags", _fragno_dev_db_schema0.Column<"json", unknown, unknown>> & Record<"createdAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>> & Record<"updatedAt", _fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>>, Record<string, _fragno_dev_db_schema0.AnyRelation>, Record<string, _fragno_dev_db_schema0.Index<_fragno_dev_db_schema0.AnyColumn[], readonly string[]>> & Record<"idx_session_status", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"string", string, string>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["status"]>> & Record<"idx_session_created", _fragno_dev_db_schema0.Index<readonly [_fragno_dev_db_schema0.Column<"timestamp", (_fragno_dev_db0.DbNow | Date) | null, Date>] & _fragno_dev_db_schema0.AnyColumn[], readonly ["createdAt"]>>>>>>, _fragno_dev_core0.BoundServices<{}>, {
|
|
570
|
+
workflows: PiWorkflowsService;
|
|
571
|
+
}, readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/sessions", z.ZodObject<{
|
|
572
|
+
agent: z.ZodString;
|
|
573
|
+
name: z.ZodOptional<z.ZodString>;
|
|
574
|
+
metadata: z.ZodOptional<z.ZodAny>;
|
|
575
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
576
|
+
steeringMode: z.ZodOptional<z.ZodEnum<{
|
|
577
|
+
all: "all";
|
|
578
|
+
"one-at-a-time": "one-at-a-time";
|
|
579
|
+
}>>;
|
|
580
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
581
|
+
id: z.ZodString;
|
|
582
|
+
name: z.ZodNullable<z.ZodString>;
|
|
583
|
+
status: z.ZodEnum<{
|
|
584
|
+
active: "active";
|
|
585
|
+
paused: "paused";
|
|
586
|
+
errored: "errored";
|
|
587
|
+
terminated: "terminated";
|
|
588
|
+
complete: "complete";
|
|
589
|
+
waiting: "waiting";
|
|
590
|
+
}>;
|
|
591
|
+
agent: z.ZodString;
|
|
592
|
+
workflowInstanceId: z.ZodNullable<z.ZodString>;
|
|
593
|
+
steeringMode: z.ZodEnum<{
|
|
594
|
+
all: "all";
|
|
595
|
+
"one-at-a-time": "one-at-a-time";
|
|
596
|
+
}>;
|
|
597
|
+
metadata: z.ZodNullable<z.ZodAny>;
|
|
598
|
+
tags: z.ZodArray<z.ZodString>;
|
|
599
|
+
createdAt: z.ZodDate;
|
|
600
|
+
updatedAt: z.ZodDate;
|
|
601
|
+
}, z.core.$strip>, "AGENT_NOT_FOUND" | "WORKFLOWS_REQUIRED" | "WORKFLOW_CREATE_FAILED", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/sessions", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, z.ZodArray<z.ZodObject<{
|
|
602
|
+
id: z.ZodString;
|
|
603
|
+
name: z.ZodNullable<z.ZodString>;
|
|
604
|
+
status: z.ZodEnum<{
|
|
605
|
+
active: "active";
|
|
606
|
+
paused: "paused";
|
|
607
|
+
errored: "errored";
|
|
608
|
+
terminated: "terminated";
|
|
609
|
+
complete: "complete";
|
|
610
|
+
waiting: "waiting";
|
|
611
|
+
}>;
|
|
612
|
+
agent: z.ZodString;
|
|
613
|
+
workflowInstanceId: z.ZodNullable<z.ZodString>;
|
|
614
|
+
steeringMode: z.ZodEnum<{
|
|
615
|
+
all: "all";
|
|
616
|
+
"one-at-a-time": "one-at-a-time";
|
|
617
|
+
}>;
|
|
618
|
+
metadata: z.ZodNullable<z.ZodAny>;
|
|
619
|
+
tags: z.ZodArray<z.ZodString>;
|
|
620
|
+
createdAt: z.ZodDate;
|
|
621
|
+
updatedAt: z.ZodDate;
|
|
622
|
+
}, z.core.$strip>>, string, "limit", _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/sessions/:sessionId", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, z.ZodObject<{
|
|
623
|
+
id: z.ZodString;
|
|
624
|
+
name: z.ZodNullable<z.ZodString>;
|
|
625
|
+
status: z.ZodEnum<{
|
|
626
|
+
active: "active";
|
|
627
|
+
paused: "paused";
|
|
628
|
+
errored: "errored";
|
|
629
|
+
terminated: "terminated";
|
|
630
|
+
complete: "complete";
|
|
631
|
+
waiting: "waiting";
|
|
632
|
+
}>;
|
|
633
|
+
agent: z.ZodString;
|
|
634
|
+
workflowInstanceId: z.ZodNullable<z.ZodString>;
|
|
635
|
+
steeringMode: z.ZodEnum<{
|
|
636
|
+
all: "all";
|
|
637
|
+
"one-at-a-time": "one-at-a-time";
|
|
638
|
+
}>;
|
|
639
|
+
metadata: z.ZodNullable<z.ZodAny>;
|
|
640
|
+
tags: z.ZodArray<z.ZodString>;
|
|
641
|
+
createdAt: z.ZodDate;
|
|
642
|
+
updatedAt: z.ZodDate;
|
|
643
|
+
workflow: z.ZodObject<{
|
|
644
|
+
status: z.ZodEnum<{
|
|
645
|
+
active: "active";
|
|
646
|
+
paused: "paused";
|
|
647
|
+
errored: "errored";
|
|
648
|
+
terminated: "terminated";
|
|
649
|
+
complete: "complete";
|
|
650
|
+
waiting: "waiting";
|
|
651
|
+
}>;
|
|
652
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
653
|
+
name: z.ZodString;
|
|
654
|
+
message: z.ZodString;
|
|
655
|
+
}, z.core.$strip>>;
|
|
656
|
+
output: z.ZodOptional<z.ZodAny>;
|
|
657
|
+
}, z.core.$strip>;
|
|
658
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
659
|
+
role: z.ZodLiteral<"user">;
|
|
660
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
661
|
+
type: z.ZodLiteral<"text">;
|
|
662
|
+
text: z.ZodString;
|
|
663
|
+
textSignature: z.ZodOptional<z.ZodString>;
|
|
664
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
665
|
+
type: z.ZodLiteral<"thinking">;
|
|
666
|
+
thinking: z.ZodString;
|
|
667
|
+
thinkingSignature: z.ZodOptional<z.ZodString>;
|
|
668
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
669
|
+
type: z.ZodLiteral<"image">;
|
|
670
|
+
data: z.ZodString;
|
|
671
|
+
mimeType: z.ZodString;
|
|
672
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
673
|
+
type: z.ZodLiteral<"toolCall">;
|
|
674
|
+
id: z.ZodString;
|
|
675
|
+
name: z.ZodString;
|
|
676
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
677
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
678
|
+
}, z.core.$strip>]>>]>;
|
|
679
|
+
timestamp: z.ZodNumber;
|
|
680
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
681
|
+
role: z.ZodLiteral<"assistant">;
|
|
682
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
683
|
+
type: z.ZodLiteral<"text">;
|
|
684
|
+
text: z.ZodString;
|
|
685
|
+
textSignature: z.ZodOptional<z.ZodString>;
|
|
686
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
687
|
+
type: z.ZodLiteral<"thinking">;
|
|
688
|
+
thinking: z.ZodString;
|
|
689
|
+
thinkingSignature: z.ZodOptional<z.ZodString>;
|
|
690
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
691
|
+
type: z.ZodLiteral<"image">;
|
|
692
|
+
data: z.ZodString;
|
|
693
|
+
mimeType: z.ZodString;
|
|
694
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
695
|
+
type: z.ZodLiteral<"toolCall">;
|
|
696
|
+
id: z.ZodString;
|
|
697
|
+
name: z.ZodString;
|
|
698
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
699
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
700
|
+
}, z.core.$strip>]>>;
|
|
701
|
+
api: z.ZodString;
|
|
702
|
+
provider: z.ZodString;
|
|
703
|
+
model: z.ZodString;
|
|
704
|
+
usage: z.ZodObject<{
|
|
705
|
+
input: z.ZodNumber;
|
|
706
|
+
output: z.ZodNumber;
|
|
707
|
+
cacheRead: z.ZodNumber;
|
|
708
|
+
cacheWrite: z.ZodNumber;
|
|
709
|
+
totalTokens: z.ZodNumber;
|
|
710
|
+
cost: z.ZodObject<{
|
|
711
|
+
input: z.ZodNumber;
|
|
712
|
+
output: z.ZodNumber;
|
|
713
|
+
cacheRead: z.ZodNumber;
|
|
714
|
+
cacheWrite: z.ZodNumber;
|
|
715
|
+
total: z.ZodNumber;
|
|
716
|
+
}, z.core.$strip>;
|
|
717
|
+
}, z.core.$strip>;
|
|
718
|
+
stopReason: z.ZodString;
|
|
719
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
720
|
+
timestamp: z.ZodNumber;
|
|
721
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
722
|
+
role: z.ZodLiteral<"toolResult">;
|
|
723
|
+
toolCallId: z.ZodString;
|
|
724
|
+
toolName: z.ZodString;
|
|
725
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
726
|
+
type: z.ZodLiteral<"text">;
|
|
727
|
+
text: z.ZodString;
|
|
728
|
+
textSignature: z.ZodOptional<z.ZodString>;
|
|
729
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
730
|
+
type: z.ZodLiteral<"thinking">;
|
|
731
|
+
thinking: z.ZodString;
|
|
732
|
+
thinkingSignature: z.ZodOptional<z.ZodString>;
|
|
733
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
734
|
+
type: z.ZodLiteral<"image">;
|
|
735
|
+
data: z.ZodString;
|
|
736
|
+
mimeType: z.ZodString;
|
|
737
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
738
|
+
type: z.ZodLiteral<"toolCall">;
|
|
739
|
+
id: z.ZodString;
|
|
740
|
+
name: z.ZodString;
|
|
741
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
742
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
743
|
+
}, z.core.$strip>]>>;
|
|
744
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
745
|
+
isError: z.ZodBoolean;
|
|
746
|
+
timestamp: z.ZodNumber;
|
|
747
|
+
}, z.core.$strip>]>>;
|
|
748
|
+
trace: z.ZodArray<z.ZodObject<{
|
|
749
|
+
type: z.ZodString;
|
|
750
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
751
|
+
}, z.core.$strip>>;
|
|
752
|
+
summaries: z.ZodArray<z.ZodObject<{
|
|
753
|
+
turn: z.ZodNumber;
|
|
754
|
+
assistant: z.ZodNullable<z.ZodAny>;
|
|
755
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
756
|
+
}, z.core.$strip>>;
|
|
757
|
+
}, z.core.$strip>, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/sessions/:sessionId/messages", z.ZodObject<{
|
|
758
|
+
text: z.ZodString;
|
|
759
|
+
done: z.ZodOptional<z.ZodBoolean>;
|
|
760
|
+
steeringMode: z.ZodOptional<z.ZodEnum<{
|
|
761
|
+
all: "all";
|
|
762
|
+
"one-at-a-time": "one-at-a-time";
|
|
763
|
+
}>>;
|
|
764
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
765
|
+
status: z.ZodEnum<{
|
|
766
|
+
active: "active";
|
|
767
|
+
paused: "paused";
|
|
768
|
+
errored: "errored";
|
|
769
|
+
terminated: "terminated";
|
|
770
|
+
complete: "complete";
|
|
771
|
+
waiting: "waiting";
|
|
772
|
+
}>;
|
|
773
|
+
}, z.core.$strip>, "WORKFLOWS_REQUIRED" | "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string, _fragno_dev_db0.DatabaseRequestContext<_fragno_dev_db0.HooksMap>>]>;
|
|
774
|
+
//#endregion
|
|
775
|
+
export { type FragnoRouteConfig, PI_WORKFLOW_NAME, type PiAgentDefinition, type PiAgentDefinitionInput, type PiAgentRegistry, type PiFragmentConfig, type PiRuntime, type PiSession, type PiSessionStatus, type PiSteeringMode, type PiToolFactory, type PiToolFactoryContext, type PiToolRegistry, type PiTurnSummary, type PiWorkflowHistoryStep, type PiWorkflowsInstanceStatus, type PiWorkflowsRegistry, type PiWorkflowsService, SESSION_STATUSES, STEERING_MODES, THINKING_LEVELS, createPi, createPiFragment, createPiFragmentClients, createPiWorkflows, defineAgent, piFragmentDefinition, piRoutesFactory };
|
|
776
|
+
//# sourceMappingURL=index.d.ts.map
|