@fragno-dev/pi-fragment 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -3
- package/dist/browser/client/react.d.ts +44 -36
- package/dist/browser/client/react.d.ts.map +1 -1
- package/dist/browser/client/react.js +105 -22
- package/dist/browser/client/react.js.map +1 -1
- package/dist/browser/client/solid.d.ts +42 -36
- package/dist/browser/client/solid.d.ts.map +1 -1
- package/dist/browser/client/solid.js +27 -13
- package/dist/browser/client/solid.js.map +1 -1
- package/dist/browser/client/svelte.d.ts +42 -36
- package/dist/browser/client/svelte.d.ts.map +1 -1
- package/dist/browser/client/svelte.js +14 -6
- package/dist/browser/client/svelte.js.map +1 -1
- package/dist/browser/client/vanilla.d.ts +99 -39
- package/dist/browser/client/vanilla.d.ts.map +1 -1
- package/dist/browser/client/vanilla.js +151 -3
- package/dist/browser/client/vanilla.js.map +1 -1
- package/dist/browser/client/vue.d.ts +54 -38
- package/dist/browser/client/vue.d.ts.map +1 -1
- package/dist/browser/client/vue.js +25 -17
- package/dist/browser/client/vue.js.map +1 -1
- package/dist/browser/{factory-DKoO_lRA.js → clients-BscY_HVe.js} +1051 -799
- package/dist/browser/clients-BscY_HVe.js.map +1 -0
- package/dist/browser/index.d.ts +3 -776
- package/dist/browser/index.js +801 -2
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/routes-CpL_YGWK.d.ts +1560 -0
- package/dist/browser/routes-CpL_YGWK.d.ts.map +1 -0
- package/dist/cli/mod.d.ts.map +1 -1
- package/dist/cli/mod.js +245 -7
- package/dist/cli/mod.js.map +1 -1
- package/dist/node/{pi → client}/clients.d.ts +46 -36
- package/dist/node/client/clients.d.ts.map +1 -0
- package/dist/node/client/clients.js +54 -0
- package/dist/node/client/clients.js.map +1 -0
- package/dist/node/client/session-controller.d.ts +31 -0
- package/dist/node/client/session-controller.d.ts.map +1 -0
- package/dist/node/client/session-controller.js +33 -0
- package/dist/node/client/session-controller.js.map +1 -0
- package/dist/node/client/session-store.d.ts +71 -0
- package/dist/node/client/session-store.d.ts.map +1 -0
- package/dist/node/client/session-store.js +637 -0
- package/dist/node/client/session-store.js.map +1 -0
- package/dist/node/debug-log.d.ts +9 -0
- package/dist/node/debug-log.d.ts.map +1 -0
- package/dist/node/debug-log.js +58 -0
- package/dist/node/debug-log.js.map +1 -0
- package/dist/node/index.d.ts +5 -4
- package/dist/node/index.js +5 -3
- package/dist/node/pi/definition.d.ts +1 -1
- package/dist/node/pi/definition.d.ts.map +1 -1
- package/dist/node/pi/dsl.d.ts +5 -2
- package/dist/node/pi/dsl.d.ts.map +1 -1
- package/dist/node/pi/dsl.js +22 -3
- package/dist/node/pi/dsl.js.map +1 -1
- package/dist/node/pi/factory.d.ts +37 -34
- package/dist/node/pi/factory.d.ts.map +1 -1
- package/dist/node/pi/factory.js.map +1 -1
- package/dist/node/pi/mappers.js +0 -1
- package/dist/node/pi/mappers.js.map +1 -1
- package/dist/node/pi/route-schemas.js +42 -10
- package/dist/node/pi/route-schemas.js.map +1 -1
- package/dist/node/pi/types.d.ts +155 -7
- package/dist/node/pi/types.d.ts.map +1 -1
- package/dist/node/pi/types.js +6 -0
- package/dist/node/pi/types.js.map +1 -0
- package/dist/node/pi/workflow/active-session.d.ts +2 -0
- package/dist/node/pi/workflow/active-session.js +107 -0
- package/dist/node/pi/workflow/active-session.js.map +1 -0
- package/dist/node/pi/workflow/agent-runner.d.ts +13 -0
- package/dist/node/pi/workflow/agent-runner.d.ts.map +1 -0
- package/dist/node/pi/workflow/agent-runner.js +228 -0
- package/dist/node/pi/workflow/agent-runner.js.map +1 -0
- package/dist/node/pi/workflow/tool-journal.js +157 -0
- package/dist/node/pi/workflow/tool-journal.js.map +1 -0
- package/dist/node/pi/workflow/workflow.d.ts +29 -0
- package/dist/node/pi/workflow/workflow.d.ts.map +1 -0
- package/dist/node/pi/workflow/workflow.js +219 -0
- package/dist/node/pi/workflow/workflow.js.map +1 -0
- package/dist/node/routes.d.ts +38 -35
- package/dist/node/routes.d.ts.map +1 -1
- package/dist/node/routes.js +203 -132
- package/dist/node/routes.js.map +1 -1
- package/dist/node/schema.js +1 -1
- package/dist/node/schema.js.map +1 -1
- package/package.json +30 -29
- package/dist/browser/client-Bk-J98pf.d.ts +0 -679
- package/dist/browser/client-Bk-J98pf.d.ts.map +0 -1
- package/dist/browser/factory-DKoO_lRA.js.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/node/pi/clients.d.ts.map +0 -1
- package/dist/node/pi/clients.js +0 -18
- package/dist/node/pi/clients.js.map +0 -1
- package/dist/node/pi/workflow.d.ts +0 -31
- package/dist/node/pi/workflow.d.ts.map +0 -1
- package/dist/node/pi/workflow.js +0 -242
- package/dist/node/pi/workflow.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -5,8 +5,10 @@ A Fragno fragment that runs Pi agents using workflow-backed sessions with regist
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Session lifecycle (create, list, fetch)
|
|
8
|
-
- Workflow-backed agent turns
|
|
8
|
+
- Workflow-backed agent turns with restorable current-run inspection state
|
|
9
9
|
- Registry-driven agent + tool configuration
|
|
10
|
+
- Automatic tool call capture + deterministic replay from persisted workflow step state
|
|
11
|
+
- Framework-level side-effect reducers (including built-in bash VFS reconstruction)
|
|
10
12
|
- Minimal API surface for sessions + messages
|
|
11
13
|
|
|
12
14
|
## Server usage
|
|
@@ -59,8 +61,41 @@ Workflows are executed via the workflows fragment durable hook dispatcher. For a
|
|
|
59
61
|
|
|
60
62
|
- `agents`: registry of agent definitions (name, system prompt, model, tools)
|
|
61
63
|
- `tools`: registry of tool factories
|
|
64
|
+
- `toolSideEffectReducers`: optional reducers keyed by tool name for reconstructing runtime state
|
|
62
65
|
- `defaultSteeringMode`: optional default for agent steering mode
|
|
63
66
|
|
|
67
|
+
## Tool Replay Middleware Contract
|
|
68
|
+
|
|
69
|
+
Tool calls are persisted automatically in each `assistant-*` workflow step result. Tools do not need
|
|
70
|
+
to write workflow state directly.
|
|
71
|
+
|
|
72
|
+
- Stable key: `sessionId:turnId:toolCallId`
|
|
73
|
+
- Journal fields: `version`, `toolName`, `args`, `result`, `isError`, `source`, `capturedAt`, `seq`
|
|
74
|
+
- Replay: duplicate tool calls with the same stable key are short-circuited and reuse persisted
|
|
75
|
+
results
|
|
76
|
+
- Error parity: replayed failed calls preserve `isError` behavior
|
|
77
|
+
|
|
78
|
+
### Reducers for Stateful Tools
|
|
79
|
+
|
|
80
|
+
For stateful runtimes (for example bash virtual filesystems), register a reducer so tool factories
|
|
81
|
+
receive reconstructed state through `ctx.replay.sideEffects`.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const pi = createPi()
|
|
85
|
+
.toolSideEffectReducer("bash", (state, entry) => {
|
|
86
|
+
// Apply persisted bash tool details in deterministic order.
|
|
87
|
+
const previous = typeof state === "object" && state ? state : {};
|
|
88
|
+
const details =
|
|
89
|
+
entry.result.details && typeof entry.result.details === "object" ? entry.result.details : {};
|
|
90
|
+
return { ...previous, ...details };
|
|
91
|
+
})
|
|
92
|
+
.build();
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`@fragno-dev/pi-fragment` includes a default `bash` reducer that replays common
|
|
96
|
+
`cwd/files/writes/deletes` detail payloads. Custom reducers can extend or override this behavior per
|
|
97
|
+
tool.
|
|
98
|
+
|
|
64
99
|
## Routes
|
|
65
100
|
|
|
66
101
|
- `POST /sessions`
|
|
@@ -69,8 +104,9 @@ Workflows are executed via the workflows fragment durable hook dispatcher. For a
|
|
|
69
104
|
- `POST /sessions/:sessionId/messages`
|
|
70
105
|
|
|
71
106
|
`POST /sessions/:sessionId/messages` is asynchronous. It returns `202 Accepted` with a status-only
|
|
72
|
-
ACK payload. Fetch `GET /sessions/:sessionId` to read
|
|
73
|
-
the workflow processes the
|
|
107
|
+
ACK payload. Fetch `GET /sessions/:sessionId` to read the restored current-run detail payload
|
|
108
|
+
(messages, events, trace, summaries, phase, and waiting markers) once the workflow processes the
|
|
109
|
+
message.
|
|
74
110
|
|
|
75
111
|
## Client usage
|
|
76
112
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as InferOr, Q as FragnoClientError, X as FetcherValue, Z as NonGetHTTPMethod, c as PiFragmentClientConfig, d as PiSessionStoreView, et as ExtractPathParamsOrWiden, nt as MaybeExtractPathParamsOrWiden, rt as QueryParamsHint, tt as HasPathParams, u as PiSessionStoreHookArgs, y as PiActiveSessionProtocolMessage } from "../routes-CpL_YGWK.js";
|
|
2
|
+
import "../index.js";
|
|
3
|
+
import { ReadableAtom, Store, StoreValue } from "nanostores";
|
|
2
4
|
import * as zod from "zod";
|
|
5
|
+
import * as _mariozechner_pi_agent_core0 from "@mariozechner/pi-agent-core";
|
|
3
6
|
import "react";
|
|
4
7
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
8
|
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
@@ -28,9 +31,11 @@ type FragnoReactMutator<_TMethod extends NonGetHTTPMethod, TPath$1 extends strin
|
|
|
28
31
|
/**
|
|
29
32
|
* Type helper that unwraps any Store fields of the object into StoreValues
|
|
30
33
|
*/
|
|
34
|
+
type FragnoReactStoreValue<T extends object> = T extends Store<infer TStore> ? StoreValue<TStore> : { [K in keyof T]: T[K] extends Store ? StoreValue<T[K]> : T[K] };
|
|
35
|
+
type FragnoReactStore<T extends object, TArgs extends unknown[] = []> = (...args: TArgs) => FragnoReactStoreValue<T>;
|
|
31
36
|
//#endregion
|
|
32
37
|
//#region src/client/react.d.ts
|
|
33
|
-
declare function createPiFragmentClient(config?:
|
|
38
|
+
declare function createPiFragmentClient(config?: PiFragmentClientConfig): {
|
|
34
39
|
useSessions: FragnoReactHook<"GET", "/sessions", zod.ZodArray<zod.ZodObject<{
|
|
35
40
|
id: zod.ZodString;
|
|
36
41
|
name: zod.ZodNullable<zod.ZodString>;
|
|
@@ -43,7 +48,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
43
48
|
waiting: "waiting";
|
|
44
49
|
}>;
|
|
45
50
|
agent: zod.ZodString;
|
|
46
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
47
51
|
steeringMode: zod.ZodEnum<{
|
|
48
52
|
all: "all";
|
|
49
53
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -53,7 +57,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
53
57
|
createdAt: zod.ZodDate;
|
|
54
58
|
updatedAt: zod.ZodDate;
|
|
55
59
|
}, zod_v4_core0.$strip>>, string, "limit">;
|
|
56
|
-
|
|
60
|
+
useSessionDetail: FragnoReactHook<"GET", "/sessions/:sessionId", zod.ZodObject<{
|
|
57
61
|
id: zod.ZodString;
|
|
58
62
|
name: zod.ZodNullable<zod.ZodString>;
|
|
59
63
|
status: zod.ZodEnum<{
|
|
@@ -65,7 +69,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
65
69
|
waiting: "waiting";
|
|
66
70
|
}>;
|
|
67
71
|
agent: zod.ZodString;
|
|
68
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
69
72
|
steeringMode: zod.ZodEnum<{
|
|
70
73
|
all: "all";
|
|
71
74
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -95,20 +98,10 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
95
98
|
type: zod.ZodLiteral<"text">;
|
|
96
99
|
text: zod.ZodString;
|
|
97
100
|
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
98
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
99
|
-
type: zod.ZodLiteral<"thinking">;
|
|
100
|
-
thinking: zod.ZodString;
|
|
101
|
-
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
102
101
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
103
102
|
type: zod.ZodLiteral<"image">;
|
|
104
103
|
data: zod.ZodString;
|
|
105
104
|
mimeType: zod.ZodString;
|
|
106
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
107
|
-
type: zod.ZodLiteral<"toolCall">;
|
|
108
|
-
id: zod.ZodString;
|
|
109
|
-
name: zod.ZodString;
|
|
110
|
-
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
111
|
-
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
112
105
|
}, zod_v4_core0.$strip>]>>]>;
|
|
113
106
|
timestamp: zod.ZodNumber;
|
|
114
107
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
@@ -121,10 +114,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
121
114
|
type: zod.ZodLiteral<"thinking">;
|
|
122
115
|
thinking: zod.ZodString;
|
|
123
116
|
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
124
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
125
|
-
type: zod.ZodLiteral<"image">;
|
|
126
|
-
data: zod.ZodString;
|
|
127
|
-
mimeType: zod.ZodString;
|
|
128
117
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
129
118
|
type: zod.ZodLiteral<"toolCall">;
|
|
130
119
|
id: zod.ZodString;
|
|
@@ -149,7 +138,13 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
149
138
|
total: zod.ZodNumber;
|
|
150
139
|
}, zod_v4_core0.$strip>;
|
|
151
140
|
}, zod_v4_core0.$strip>;
|
|
152
|
-
stopReason: zod.
|
|
141
|
+
stopReason: zod.ZodEnum<{
|
|
142
|
+
length: "length";
|
|
143
|
+
error: "error";
|
|
144
|
+
stop: "stop";
|
|
145
|
+
toolUse: "toolUse";
|
|
146
|
+
aborted: "aborted";
|
|
147
|
+
}>;
|
|
153
148
|
errorMessage: zod.ZodOptional<zod.ZodString>;
|
|
154
149
|
timestamp: zod.ZodNumber;
|
|
155
150
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
@@ -160,38 +155,52 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
160
155
|
type: zod.ZodLiteral<"text">;
|
|
161
156
|
text: zod.ZodString;
|
|
162
157
|
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
163
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
164
|
-
type: zod.ZodLiteral<"thinking">;
|
|
165
|
-
thinking: zod.ZodString;
|
|
166
|
-
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
167
158
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
168
159
|
type: zod.ZodLiteral<"image">;
|
|
169
160
|
data: zod.ZodString;
|
|
170
161
|
mimeType: zod.ZodString;
|
|
171
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
172
|
-
type: zod.ZodLiteral<"toolCall">;
|
|
173
|
-
id: zod.ZodString;
|
|
174
|
-
name: zod.ZodString;
|
|
175
|
-
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
176
|
-
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
177
162
|
}, zod_v4_core0.$strip>]>>;
|
|
178
163
|
details: zod.ZodOptional<zod.ZodUnknown>;
|
|
179
164
|
isError: zod.ZodBoolean;
|
|
180
165
|
timestamp: zod.ZodNumber;
|
|
181
166
|
}, zod_v4_core0.$strip>]>>;
|
|
182
|
-
|
|
167
|
+
events: zod.ZodArray<zod.ZodObject<{
|
|
168
|
+
id: zod.ZodString;
|
|
169
|
+
runNumber: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
|
|
183
170
|
type: zod.ZodString;
|
|
184
|
-
|
|
171
|
+
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
172
|
+
createdAt: zod.ZodDate;
|
|
173
|
+
deliveredAt: zod.ZodNullable<zod.ZodDate>;
|
|
174
|
+
consumedByStepKey: zod.ZodNullable<zod.ZodString>;
|
|
185
175
|
}, zod_v4_core0.$strip>>;
|
|
176
|
+
trace: zod.ZodArray<zod.ZodType<_mariozechner_pi_agent_core0.AgentEvent, unknown, zod_v4_core0.$ZodTypeInternals<_mariozechner_pi_agent_core0.AgentEvent, unknown>>>;
|
|
177
|
+
turn: zod.ZodNumber;
|
|
178
|
+
phase: zod.ZodEnum<{
|
|
179
|
+
complete: "complete";
|
|
180
|
+
"waiting-for-user": "waiting-for-user";
|
|
181
|
+
"running-agent": "running-agent";
|
|
182
|
+
}>;
|
|
183
|
+
waitingFor: zod.ZodNullable<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
184
|
+
type: zod.ZodLiteral<"user_message">;
|
|
185
|
+
turn: zod.ZodNumber;
|
|
186
|
+
stepKey: zod.ZodString;
|
|
187
|
+
timeoutMs: zod.ZodNullable<zod.ZodNumber>;
|
|
188
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
189
|
+
type: zod.ZodLiteral<"assistant">;
|
|
190
|
+
turn: zod.ZodNumber;
|
|
191
|
+
stepKey: zod.ZodString;
|
|
192
|
+
}, zod_v4_core0.$strip>]>>;
|
|
186
193
|
summaries: zod.ZodArray<zod.ZodObject<{
|
|
187
194
|
turn: zod.ZodNumber;
|
|
188
195
|
assistant: zod.ZodNullable<zod.ZodAny>;
|
|
189
196
|
summary: zod.ZodNullable<zod.ZodString>;
|
|
190
197
|
}, zod_v4_core0.$strip>>;
|
|
191
|
-
}, zod_v4_core0.$strip>, "
|
|
198
|
+
}, zod_v4_core0.$strip>, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", "events" | "trace" | "summaries">;
|
|
199
|
+
useSession: FragnoReactStore<PiSessionStoreView, [args: PiSessionStoreHookArgs]>;
|
|
192
200
|
useCreateSession: FragnoReactMutator<NonGetHTTPMethod, "/sessions", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | zod.ZodObject<{
|
|
193
201
|
agent: zod.ZodString;
|
|
194
202
|
name: zod.ZodOptional<zod.ZodString>;
|
|
203
|
+
systemMessage: zod.ZodOptional<zod.ZodString>;
|
|
195
204
|
metadata: zod.ZodOptional<zod.ZodAny>;
|
|
196
205
|
tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
197
206
|
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -210,7 +219,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
210
219
|
waiting: "waiting";
|
|
211
220
|
}>;
|
|
212
221
|
agent: zod.ZodString;
|
|
213
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
214
222
|
steeringMode: zod.ZodEnum<{
|
|
215
223
|
all: "all";
|
|
216
224
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -231,7 +239,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
231
239
|
waiting: "waiting";
|
|
232
240
|
}>;
|
|
233
241
|
agent: zod.ZodString;
|
|
234
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
235
242
|
steeringMode: zod.ZodEnum<{
|
|
236
243
|
all: "all";
|
|
237
244
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -241,6 +248,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
241
248
|
createdAt: zod.ZodDate;
|
|
242
249
|
updatedAt: zod.ZodDate;
|
|
243
250
|
}, zod_v4_core0.$strip>> | undefined, string, string>;
|
|
251
|
+
useActiveSession: FragnoReactHook<"GET", "/sessions/:sessionId/active", zod.ZodArray<zod.ZodType<PiActiveSessionProtocolMessage, unknown, zod_v4_core0.$ZodTypeInternals<PiActiveSessionProtocolMessage, unknown>>>, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string>;
|
|
244
252
|
useSendMessage: FragnoReactMutator<NonGetHTTPMethod, "/sessions/:sessionId/messages", zod.ZodObject<{
|
|
245
253
|
text: zod.ZodString;
|
|
246
254
|
done: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -257,7 +265,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
257
265
|
complete: "complete";
|
|
258
266
|
waiting: "waiting";
|
|
259
267
|
}>;
|
|
260
|
-
}, zod_v4_core0.$strip> | undefined, "
|
|
268
|
+
}, zod_v4_core0.$strip> | undefined, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING" | "SESSION_NOT_READY", string>;
|
|
261
269
|
};
|
|
262
270
|
//#endregion
|
|
263
271
|
export { createPiFragmentClient };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","names":["ExtractPathParamsOrWiden","HasPathParams","MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":["ExtractPathParamsOrWiden","HasPathParams","MaybeExtractPathParamsOrWiden","QueryParamsHint","InferOr","FragnoClientError","FragnoClientHookData","FragnoClientMutatorData","FragnoStoreFactoryData","FragnoStoreObjectData","NonGetHTTPMethod","ReadableAtom","Store","StoreValue","FetcherValue","react0","DependencyList","StandardSchemaV1","FragnoReactHook","_TMethod","TPath$1","TOutputSchema$1","TErrorCode$1","TQueryParameters$1","InferOutput","NonNullable","path","query","args","FragnoReactMutator","TInputSchema","body","Promise","mutate","loading","error","data","FragnoReactStoreValue","T","TStore","K","FragnoReactStore","TArgs","useFragno","Record","TPath","TOutputSchema","TErrorCode","TQueryParameters","TMethod","TInput","TOutput","TError","TStoreObj","TStoreArgs","clientObj","StoreKeys","setKey","k","v","UseStoreOptions","SomeStore","deps","keys","useStore","store","options","FragnoHydrator","children","React","ReactNode"],"sources":["../../../../fragno/dist/client/react.d.ts","../../../src/client/react.ts"],"mappings":";;;;;;;;;;;;KAYKkB,eAAAA,yEAAwFD,gBAAAA,qEAAqFW,IAAAA;EAChLF,IAAAA,GAAOxB,6BAAAA,CAA8BkB,OAAAA,WA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d as isStore, f as isReadableAtom, l as isGetHook, t as createPiFragmentClients, u as isMutatorHook } from "../clients-BscY_HVe.js";
|
|
2
|
+
import { listenKeys } from "nanostores";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
4
4
|
|
|
5
|
-
//#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js
|
|
6
|
-
function listenKeys($store, keys, listener) {
|
|
7
|
-
let keysSet = new Set(keys).add(void 0);
|
|
8
|
-
return $store.listen((value, oldValue, changed) => {
|
|
9
|
-
if (keysSet.has(changed)) listener(value, oldValue, changed);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
5
|
//#region ../fragno/dist/client/react.js
|
|
15
6
|
function createReactHook(hook) {
|
|
16
7
|
return ({ path, query } = {}) => {
|
|
@@ -29,17 +20,109 @@ function createReactMutator(hook) {
|
|
|
29
20
|
return useStore(useMemo(() => hook.mutatorStore, [hook]));
|
|
30
21
|
};
|
|
31
22
|
}
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
const isPlainObject = (value) => {
|
|
24
|
+
if (!value || typeof value !== "object") return false;
|
|
25
|
+
const prototype = Object.getPrototypeOf(value);
|
|
26
|
+
return prototype === Object.prototype || prototype === null;
|
|
27
|
+
};
|
|
28
|
+
const areStoreFactoryValuesEqual = (left, right) => {
|
|
29
|
+
if (Object.is(left, right)) return true;
|
|
30
|
+
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));
|
|
31
|
+
if (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();
|
|
32
|
+
if (isReadableAtom(left) || isReadableAtom(right)) return left === right;
|
|
33
|
+
if (typeof left === "function" || typeof right === "function") return left === right;
|
|
34
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
35
|
+
const leftKeys = Object.keys(left).sort();
|
|
36
|
+
const rightKeys = Object.keys(right).sort();
|
|
37
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
const areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));
|
|
42
|
+
const getStoreDisposer = (value) => {
|
|
43
|
+
const disposer = value[Symbol.dispose];
|
|
44
|
+
return typeof disposer === "function" ? disposer.bind(value) : void 0;
|
|
45
|
+
};
|
|
46
|
+
const createReactStoreObjectView = (value, getAtomValue) => {
|
|
47
|
+
const atomValues = /* @__PURE__ */ new Map();
|
|
48
|
+
const boundMethods = /* @__PURE__ */ new Map();
|
|
49
|
+
return new Proxy(value, { get(target, property, _receiver) {
|
|
50
|
+
const propertyValue = Reflect.get(target, property, target);
|
|
51
|
+
if (isReadableAtom(propertyValue)) {
|
|
52
|
+
if (atomValues.has(propertyValue)) return atomValues.get(propertyValue);
|
|
53
|
+
const atomValue = getAtomValue(propertyValue);
|
|
54
|
+
atomValues.set(propertyValue, atomValue);
|
|
55
|
+
return atomValue;
|
|
41
56
|
}
|
|
42
|
-
|
|
57
|
+
if (typeof propertyValue === "function") {
|
|
58
|
+
if (boundMethods.has(property)) return boundMethods.get(property);
|
|
59
|
+
const boundMethod = propertyValue.bind(target);
|
|
60
|
+
boundMethods.set(property, boundMethod);
|
|
61
|
+
return boundMethod;
|
|
62
|
+
}
|
|
63
|
+
return propertyValue;
|
|
64
|
+
} });
|
|
65
|
+
};
|
|
66
|
+
function unwrapReactStoreValueOnServer(value) {
|
|
67
|
+
if (isReadableAtom(value)) return value.get();
|
|
68
|
+
return createReactStoreObjectView(value, (store) => store.get());
|
|
69
|
+
}
|
|
70
|
+
function unwrapReactStoreValue(value) {
|
|
71
|
+
if (isReadableAtom(value)) return useStore(value);
|
|
72
|
+
const atomEntries = Object.keys(value).flatMap((key) => {
|
|
73
|
+
const fieldValue = value[key];
|
|
74
|
+
return isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];
|
|
75
|
+
});
|
|
76
|
+
const snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));
|
|
77
|
+
const getSnapshot = () => {
|
|
78
|
+
const nextSnapshot = atomEntries.map(([, store]) => store.get());
|
|
79
|
+
const previousSnapshot = snapshotRef.current;
|
|
80
|
+
if (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;
|
|
81
|
+
snapshotRef.current = nextSnapshot;
|
|
82
|
+
return nextSnapshot;
|
|
83
|
+
};
|
|
84
|
+
const atomValues = useSyncExternalStore((onStoreChange) => {
|
|
85
|
+
const unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));
|
|
86
|
+
return () => {
|
|
87
|
+
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
88
|
+
};
|
|
89
|
+
}, getSnapshot, getSnapshot);
|
|
90
|
+
return useMemo(() => createReactStoreObjectView(value, (store) => {
|
|
91
|
+
const atomIndex = atomEntries.findIndex(([, entryStore]) => entryStore === store);
|
|
92
|
+
return atomIndex === -1 ? store.get() : atomValues[atomIndex];
|
|
93
|
+
}), [
|
|
94
|
+
value,
|
|
95
|
+
atomEntries,
|
|
96
|
+
atomValues
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
function createReactStore(hook) {
|
|
100
|
+
return (...args) => {
|
|
101
|
+
const stableArgsRef = useRef(args);
|
|
102
|
+
const pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());
|
|
103
|
+
if (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;
|
|
104
|
+
const value = useMemo(() => {
|
|
105
|
+
if ("factory" in hook) return hook.factory(...stableArgsRef.current);
|
|
106
|
+
return hook.obj;
|
|
107
|
+
}, [hook, stableArgsRef.current]);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const disposer = getStoreDisposer(value);
|
|
110
|
+
const pendingTimeout = pendingDisposalsRef.current.get(value);
|
|
111
|
+
if (pendingTimeout !== void 0) {
|
|
112
|
+
clearTimeout(pendingTimeout);
|
|
113
|
+
pendingDisposalsRef.current.delete(value);
|
|
114
|
+
}
|
|
115
|
+
return () => {
|
|
116
|
+
if (!disposer) return;
|
|
117
|
+
const timeoutId = setTimeout(() => {
|
|
118
|
+
pendingDisposalsRef.current.delete(value);
|
|
119
|
+
disposer();
|
|
120
|
+
}, 0);
|
|
121
|
+
pendingDisposalsRef.current.set(value, timeoutId);
|
|
122
|
+
};
|
|
123
|
+
}, [value]);
|
|
124
|
+
if (typeof window === "undefined") return unwrapReactStoreValueOnServer(value);
|
|
125
|
+
return unwrapReactStoreValue(value);
|
|
43
126
|
};
|
|
44
127
|
}
|
|
45
128
|
function useFragno(clientObj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","names":["listenKeys","$store","keys","listener","keysSet","Set","add","undefined","listen","value","oldValue","changed","has","subscribeKeys","unbind","hydrateFromWindow","isReadableAtom","isGetHook","isMutatorHook","isStore","listenKeys","useCallback","useMemo","useRef","useSyncExternalStore","createReactHook","hook","path","query","pathParamValues","Object","values","queryParamValues","store","window","get","useStore","createReactMutator","mutatorStore","createReactStore","obj","result","key","prototype","hasOwnProperty","call","value","useFragno","clientObj","options","snapshotRef","keys","deps","subscribe","onChange","emitChange","current","length","listen","FragnoHydrator","children","useFragno","FragnoPublicClientConfig","createPiFragmentClients","createPiFragmentClient","config"],"sources":["../../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js","../../../../fragno/dist/client/react.js","../../../src/client/react.ts"],"sourcesContent":["export function listenKeys($store, keys, listener) {\n let keysSet = new Set(keys).add(undefined)\n return $store.listen((value, oldValue, changed) => {\n if (keysSet.has(changed)) {\n listener(value, oldValue, changed)\n }\n })\n}\n\nexport function subscribeKeys($store, keys, listener) {\n let unbind = listenKeys($store, keys, listener)\n listener($store.value)\n return unbind\n}\n","import { hydrateFromWindow } from \"../util/ssr.js\";\nimport { isReadableAtom } from \"../util/nanostores.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { listenKeys } from \"nanostores\";\nimport { useCallback, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/client/react.ts\nfunction createReactHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParamValues = path ? Object.values(path) : [];\n\t\tconst queryParamValues = query ? Object.values(query) : [];\n\t\tconst store = useMemo(() => hook.store({\n\t\t\tpath,\n\t\t\tquery\n\t\t}), [hook, ...[...pathParamValues, ...queryParamValues]]);\n\t\tif (typeof window === \"undefined\") return store.get();\n\t\treturn useStore(store);\n\t};\n}\nfunction createReactMutator(hook) {\n\treturn () => {\n\t\treturn useStore(useMemo(() => hook.mutatorStore, [hook]));\n\t};\n}\nfunction createReactStore(hook) {\n\tif (isReadableAtom(hook.obj)) return () => useStore(hook.obj);\n\treturn () => {\n\t\tconst result = {};\n\t\tfor (const key in hook.obj) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(hook.obj, key)) continue;\n\t\t\tconst value = hook.obj[key];\n\t\t\tif (isReadableAtom(value)) result[key] = useStore(value);\n\t\t\telse result[key] = value;\n\t\t}\n\t\treturn result;\n\t};\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createReactHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createReactMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createReactStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store, options = {}) {\n\tconst snapshotRef = useRef(store.get());\n\tconst { keys, deps = [store, keys] } = options;\n\tconst subscribe = useCallback((onChange) => {\n\t\tconst emitChange = (value) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\t\temitChange(store.value);\n\t\tif (keys?.length) return listenKeys(store, keys, emitChange);\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\tconst get = () => snapshotRef.current;\n\treturn useSyncExternalStore(subscribe, get, () => {\n\t\treturn get();\n\t});\n}\nfunction FragnoHydrator({ children }) {\n\tuseMemo(() => {\n\t\thydrateFromWindow();\n\t}, []);\n\treturn children;\n}\n\n//#endregion\nexport { FragnoHydrator, useFragno, useStore };\n//# sourceMappingURL=react.js.map","import { useFragno } from \"@fragno-dev/core/react\";\nimport type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\nimport { createPiFragmentClients } from \"..\";\n\nexport function createPiFragmentClient(config: FragnoPublicClientConfig = {}) {\n return useFragno(createPiFragmentClients(config));\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAAA,SAAgBA,WAAWC,QAAQC,MAAMC,UAAU;CACjD,IAAIC,UAAU,IAAIC,IAAIH,KAAK,CAACI,IAAIC,OAAU;AAC1C,QAAON,OAAOO,QAAQC,OAAOC,UAAUC,YAAY;AACjD,MAAIP,QAAQQ,IAAID,QAAQ,CACtBR,UAASM,OAAOC,UAAUC,QAAQ;GAEpC;;;;;ACCJ,SAASc,gBAAgBC,MAAM;AAC9B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,kBAAkBF,OAAOG,OAAOC,OAAOJ,KAAK,GAAG,EAAE;EACvD,MAAMK,mBAAmBJ,QAAQE,OAAOC,OAAOH,MAAM,GAAG,EAAE;EAC1D,MAAMK,QAAQX,cAAcI,KAAKO,MAAM;GACtCN;GACAC;GACA,CAAC,EAAE,CAACF,MAAM,GAAG,CAAC,GAAGG,iBAAiB,GAAGG,iBAAiB,CAAC,CAAC;AACzD,MAAI,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eAAYM,UAAUV;AACtBQ,aAAU;;AAEXC,aAAWtB,MAAMa,MAAM;AACvB,MAAIK,MAAMM,OAAQ,QAAOrC,WAAWa,OAAOkB,MAAMI,WAAW;AAC5D,SAAOtB,MAAMyB,OAAOH,WAAW;IAC7BH,KAAK;CACR,MAAMjB,YAAYe,YAAYM;AAC9B,QAAOhC,qBAAqB6B,WAAWlB,WAAW;AACjD,SAAOA,KAAK;GACX;;;;;AC7DH,SAAgB6B,uBAAuBC,SAAmC,EAAE,EAAE;AAC5E,QAAOJ,UAAUE,wBAAwBE,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"react.js","names":["isReadableAtom","hydrateFromWindow","isGetHook","isMutatorHook","isStore","listenKeys","useCallback","useEffect","useMemo","useRef","useSyncExternalStore","createReactHook","hook","path","query","pathParamValues","Object","values","queryParamValues","store","window","get","useStore","createReactMutator","mutatorStore","isPlainObject","value","prototype","getPrototypeOf","areStoreFactoryValuesEqual","left","right","is","Array","isArray","length","every","index","Date","getTime","leftKeys","keys","sort","rightKeys","key","areStoreFactoryArgsEqual","getStoreDisposer","disposer","Symbol","dispose","bind","createReactStoreObjectView","getAtomValue","atomValues","Map","boundMethods","Proxy","target","property","_receiver","propertyValue","Reflect","has","atomValue","set","boundMethod","unwrapReactStoreValueOnServer","unwrapReactStoreValue","atomEntries","flatMap","fieldValue","snapshotRef","map","getSnapshot","nextSnapshot","previousSnapshot","current","entry","onStoreChange","unsubscribes","listen","unsubscribe","atomIndex","findIndex","entryStore","createReactStore","args","stableArgsRef","pendingDisposalsRef","factory","obj","pendingTimeout","clearTimeout","delete","timeoutId","setTimeout","useFragno","clientObj","result","hasOwnProperty","call","options","deps","subscribe","onChange","emitChange","FragnoHydrator","children","useFragno","createPiFragmentClients","PiFragmentClientConfig","createPiFragmentClient","config"],"sources":["../../../../fragno/dist/client/react.js","../../../src/client/react.ts"],"sourcesContent":["import { isReadableAtom } from \"../util/nanostores.js\";\nimport { hydrateFromWindow } from \"../util/ssr.js\";\nimport { isGetHook, isMutatorHook, isStore } from \"./client.js\";\nimport { listenKeys } from \"nanostores\";\nimport { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/client/react.ts\nfunction createReactHook(hook) {\n\treturn ({ path, query } = {}) => {\n\t\tconst pathParamValues = path ? Object.values(path) : [];\n\t\tconst queryParamValues = query ? Object.values(query) : [];\n\t\tconst store = useMemo(() => hook.store({\n\t\t\tpath,\n\t\t\tquery\n\t\t}), [hook, ...[...pathParamValues, ...queryParamValues]]);\n\t\tif (typeof window === \"undefined\") return store.get();\n\t\treturn useStore(store);\n\t};\n}\nfunction createReactMutator(hook) {\n\treturn () => {\n\t\treturn useStore(useMemo(() => hook.mutatorStore, [hook]));\n\t};\n}\nconst isPlainObject = (value) => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n};\nconst areStoreFactoryValuesEqual = (left, right) => {\n\tif (Object.is(left, right)) return true;\n\tif (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\n\tif (left instanceof Date && right instanceof Date) return left.getTime() === right.getTime();\n\tif (isReadableAtom(left) || isReadableAtom(right)) return left === right;\n\tif (typeof left === \"function\" || typeof right === \"function\") return left === right;\n\tif (isPlainObject(left) && isPlainObject(right)) {\n\t\tconst leftKeys = Object.keys(left).sort();\n\t\tconst rightKeys = Object.keys(right).sort();\n\t\treturn leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && areStoreFactoryValuesEqual(left[key], right[key]));\n\t}\n\treturn false;\n};\nconst areStoreFactoryArgsEqual = (left, right) => left.length === right.length && left.every((value, index) => areStoreFactoryValuesEqual(value, right[index]));\nconst getStoreDisposer = (value) => {\n\tconst disposer = value[Symbol.dispose];\n\treturn typeof disposer === \"function\" ? disposer.bind(value) : void 0;\n};\nconst createReactStoreObjectView = (value, getAtomValue) => {\n\tconst atomValues = /* @__PURE__ */ new Map();\n\tconst boundMethods = /* @__PURE__ */ new Map();\n\treturn new Proxy(value, { get(target, property, _receiver) {\n\t\tconst propertyValue = Reflect.get(target, property, target);\n\t\tif (isReadableAtom(propertyValue)) {\n\t\t\tif (atomValues.has(propertyValue)) return atomValues.get(propertyValue);\n\t\t\tconst atomValue = getAtomValue(propertyValue);\n\t\t\tatomValues.set(propertyValue, atomValue);\n\t\t\treturn atomValue;\n\t\t}\n\t\tif (typeof propertyValue === \"function\") {\n\t\t\tif (boundMethods.has(property)) return boundMethods.get(property);\n\t\t\tconst boundMethod = propertyValue.bind(target);\n\t\t\tboundMethods.set(property, boundMethod);\n\t\t\treturn boundMethod;\n\t\t}\n\t\treturn propertyValue;\n\t} });\n};\nfunction unwrapReactStoreValueOnServer(value) {\n\tif (isReadableAtom(value)) return value.get();\n\treturn createReactStoreObjectView(value, (store) => store.get());\n}\nfunction unwrapReactStoreValue(value) {\n\tif (isReadableAtom(value)) return useStore(value);\n\tconst atomEntries = Object.keys(value).flatMap((key) => {\n\t\tconst fieldValue = value[key];\n\t\treturn isReadableAtom(fieldValue) ? [[key, fieldValue]] : [];\n\t});\n\tconst snapshotRef = useRef(atomEntries.map(([, store]) => store.get()));\n\tconst getSnapshot = () => {\n\t\tconst nextSnapshot = atomEntries.map(([, store]) => store.get());\n\t\tconst previousSnapshot = snapshotRef.current;\n\t\tif (previousSnapshot.length === nextSnapshot.length && previousSnapshot.every((entry, index) => Object.is(entry, nextSnapshot[index]))) return previousSnapshot;\n\t\tsnapshotRef.current = nextSnapshot;\n\t\treturn nextSnapshot;\n\t};\n\tconst atomValues = useSyncExternalStore((onStoreChange) => {\n\t\tconst unsubscribes = atomEntries.map(([, store]) => store.listen(onStoreChange));\n\t\treturn () => {\n\t\t\tfor (const unsubscribe of unsubscribes) unsubscribe();\n\t\t};\n\t}, getSnapshot, getSnapshot);\n\treturn useMemo(() => createReactStoreObjectView(value, (store) => {\n\t\tconst atomIndex = atomEntries.findIndex(([, entryStore]) => entryStore === store);\n\t\treturn atomIndex === -1 ? store.get() : atomValues[atomIndex];\n\t}), [\n\t\tvalue,\n\t\tatomEntries,\n\t\tatomValues\n\t]);\n}\nfunction createReactStore(hook) {\n\treturn ((...args) => {\n\t\tconst stableArgsRef = useRef(args);\n\t\tconst pendingDisposalsRef = useRef(/* @__PURE__ */ new Map());\n\t\tif (!areStoreFactoryArgsEqual(stableArgsRef.current, args)) stableArgsRef.current = args;\n\t\tconst value = useMemo(() => {\n\t\t\tif (\"factory\" in hook) return hook.factory(...stableArgsRef.current);\n\t\t\treturn hook.obj;\n\t\t}, [hook, stableArgsRef.current]);\n\t\tuseEffect(() => {\n\t\t\tconst disposer = getStoreDisposer(value);\n\t\t\tconst pendingTimeout = pendingDisposalsRef.current.get(value);\n\t\t\tif (pendingTimeout !== void 0) {\n\t\t\t\tclearTimeout(pendingTimeout);\n\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tif (!disposer) return;\n\t\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\t\tpendingDisposalsRef.current.delete(value);\n\t\t\t\t\tdisposer();\n\t\t\t\t}, 0);\n\t\t\t\tpendingDisposalsRef.current.set(value, timeoutId);\n\t\t\t};\n\t\t}, [value]);\n\t\tif (typeof window === \"undefined\") return unwrapReactStoreValueOnServer(value);\n\t\treturn unwrapReactStoreValue(value);\n\t});\n}\nfunction useFragno(clientObj) {\n\tconst result = {};\n\tfor (const key in clientObj) {\n\t\tif (!Object.prototype.hasOwnProperty.call(clientObj, key)) continue;\n\t\tconst hook = clientObj[key];\n\t\tif (isGetHook(hook)) result[key] = createReactHook(hook);\n\t\telse if (isMutatorHook(hook)) result[key] = createReactMutator(hook);\n\t\telse if (isStore(hook)) result[key] = createReactStore(hook);\n\t\telse result[key] = hook;\n\t}\n\treturn result;\n}\nfunction useStore(store, options = {}) {\n\tconst snapshotRef = useRef(store.get());\n\tconst { keys, deps = [store, keys] } = options;\n\tconst subscribe = useCallback((onChange) => {\n\t\tconst emitChange = (value) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\t\temitChange(store.value);\n\t\tif (keys?.length) return listenKeys(store, keys, emitChange);\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\tconst get = () => snapshotRef.current;\n\treturn useSyncExternalStore(subscribe, get, () => {\n\t\treturn get();\n\t});\n}\nfunction FragnoHydrator({ children }) {\n\tuseMemo(() => {\n\t\thydrateFromWindow();\n\t}, []);\n\treturn children;\n}\n\n//#endregion\nexport { FragnoHydrator, useFragno, useStore };\n//# sourceMappingURL=react.js.map","import { useFragno } from \"@fragno-dev/core/react\";\n\nimport { createPiFragmentClients, type PiFragmentClientConfig } from \"./clients\";\n\nexport function createPiFragmentClient(config: PiFragmentClientConfig = {}) {\n return useFragno(createPiFragmentClients(config));\n}\n"],"mappings":";;;;;AAOA,SAASW,gBAAgBC,MAAM;AAC9B,SAAQ,EAAEC,MAAMC,UAAU,EAAE,KAAK;EAChC,MAAMC,kBAAkBF,OAAOG,OAAOC,OAAOJ,KAAK,GAAG,EAAE;EACvD,MAAMK,mBAAmBJ,QAAQE,OAAOC,OAAOH,MAAM,GAAG,EAAE;EAC1D,MAAMK,QAAQX,cAAcI,KAAKO,MAAM;GACtCN;GACAC;GACA,CAAC,EAAE,CAACF,MAAM,GAAG,CAAC,GAAGG,iBAAiB,GAAGG,iBAAiB,CAAC,CAAC;AACzD,MAAI,OAAOE,WAAW,YAAa,QAAOD,MAAME,KAAK;AACrD,SAAOC,SAASH,MAAM;;;AAGxB,SAASI,mBAAmBX,MAAM;AACjC,cAAa;AACZ,SAAOU,SAASd,cAAcI,KAAKY,cAAc,CAACZ,KAAK,CAAC,CAAC;;;AAG3D,MAAMa,iBAAiBC,UAAU;AAChC,KAAI,CAACA,SAAS,OAAOA,UAAU,SAAU,QAAO;CAChD,MAAMC,YAAYX,OAAO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AAOJ,UAAUC,wBAAwBG,OAAO,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as InferOr, Q as FragnoClientError, Y as FragnoStoreFactoryData, Z as NonGetHTTPMethod, c as PiFragmentClientConfig, d as PiSessionStoreView, nt as MaybeExtractPathParamsOrWiden, rt as QueryParamsHint, u as PiSessionStoreHookArgs, y as PiActiveSessionProtocolMessage } from "../routes-CpL_YGWK.js";
|
|
2
|
+
import "../index.js";
|
|
3
|
+
import { ReadableAtom, Store, StoreValue } from "nanostores";
|
|
2
4
|
import * as zod from "zod";
|
|
5
|
+
import * as _mariozechner_pi_agent_core0 from "@mariozechner/pi-agent-core";
|
|
3
6
|
import { Accessor } from "solid-js";
|
|
4
7
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
8
|
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
@@ -32,7 +35,7 @@ type FragnoSolidMutator<_TMethod extends NonGetHTTPMethod, TPath$1 extends strin
|
|
|
32
35
|
*/
|
|
33
36
|
//#endregion
|
|
34
37
|
//#region src/client/solid.d.ts
|
|
35
|
-
declare function createPiFragmentClient(config?:
|
|
38
|
+
declare function createPiFragmentClient(config?: PiFragmentClientConfig): {
|
|
36
39
|
useSessions: FragnoSolidHook<"GET", "/sessions", zod.ZodArray<zod.ZodObject<{
|
|
37
40
|
id: zod.ZodString;
|
|
38
41
|
name: zod.ZodNullable<zod.ZodString>;
|
|
@@ -45,7 +48,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
45
48
|
waiting: "waiting";
|
|
46
49
|
}>;
|
|
47
50
|
agent: zod.ZodString;
|
|
48
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
49
51
|
steeringMode: zod.ZodEnum<{
|
|
50
52
|
all: "all";
|
|
51
53
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -55,7 +57,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
55
57
|
createdAt: zod.ZodDate;
|
|
56
58
|
updatedAt: zod.ZodDate;
|
|
57
59
|
}, zod_v4_core0.$strip>>, string, "limit">;
|
|
58
|
-
|
|
60
|
+
useSessionDetail: FragnoSolidHook<"GET", "/sessions/:sessionId", zod.ZodObject<{
|
|
59
61
|
id: zod.ZodString;
|
|
60
62
|
name: zod.ZodNullable<zod.ZodString>;
|
|
61
63
|
status: zod.ZodEnum<{
|
|
@@ -67,7 +69,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
67
69
|
waiting: "waiting";
|
|
68
70
|
}>;
|
|
69
71
|
agent: zod.ZodString;
|
|
70
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
71
72
|
steeringMode: zod.ZodEnum<{
|
|
72
73
|
all: "all";
|
|
73
74
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -97,20 +98,10 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
97
98
|
type: zod.ZodLiteral<"text">;
|
|
98
99
|
text: zod.ZodString;
|
|
99
100
|
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
100
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
101
|
-
type: zod.ZodLiteral<"thinking">;
|
|
102
|
-
thinking: zod.ZodString;
|
|
103
|
-
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
104
101
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
105
102
|
type: zod.ZodLiteral<"image">;
|
|
106
103
|
data: zod.ZodString;
|
|
107
104
|
mimeType: zod.ZodString;
|
|
108
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
109
|
-
type: zod.ZodLiteral<"toolCall">;
|
|
110
|
-
id: zod.ZodString;
|
|
111
|
-
name: zod.ZodString;
|
|
112
|
-
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
113
|
-
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
114
105
|
}, zod_v4_core0.$strip>]>>]>;
|
|
115
106
|
timestamp: zod.ZodNumber;
|
|
116
107
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
@@ -123,10 +114,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
123
114
|
type: zod.ZodLiteral<"thinking">;
|
|
124
115
|
thinking: zod.ZodString;
|
|
125
116
|
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
126
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
127
|
-
type: zod.ZodLiteral<"image">;
|
|
128
|
-
data: zod.ZodString;
|
|
129
|
-
mimeType: zod.ZodString;
|
|
130
117
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
131
118
|
type: zod.ZodLiteral<"toolCall">;
|
|
132
119
|
id: zod.ZodString;
|
|
@@ -151,7 +138,13 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
151
138
|
total: zod.ZodNumber;
|
|
152
139
|
}, zod_v4_core0.$strip>;
|
|
153
140
|
}, zod_v4_core0.$strip>;
|
|
154
|
-
stopReason: zod.
|
|
141
|
+
stopReason: zod.ZodEnum<{
|
|
142
|
+
length: "length";
|
|
143
|
+
error: "error";
|
|
144
|
+
stop: "stop";
|
|
145
|
+
toolUse: "toolUse";
|
|
146
|
+
aborted: "aborted";
|
|
147
|
+
}>;
|
|
155
148
|
errorMessage: zod.ZodOptional<zod.ZodString>;
|
|
156
149
|
timestamp: zod.ZodNumber;
|
|
157
150
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
@@ -162,38 +155,52 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
162
155
|
type: zod.ZodLiteral<"text">;
|
|
163
156
|
text: zod.ZodString;
|
|
164
157
|
textSignature: zod.ZodOptional<zod.ZodString>;
|
|
165
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
166
|
-
type: zod.ZodLiteral<"thinking">;
|
|
167
|
-
thinking: zod.ZodString;
|
|
168
|
-
thinkingSignature: zod.ZodOptional<zod.ZodString>;
|
|
169
158
|
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
170
159
|
type: zod.ZodLiteral<"image">;
|
|
171
160
|
data: zod.ZodString;
|
|
172
161
|
mimeType: zod.ZodString;
|
|
173
|
-
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
174
|
-
type: zod.ZodLiteral<"toolCall">;
|
|
175
|
-
id: zod.ZodString;
|
|
176
|
-
name: zod.ZodString;
|
|
177
|
-
arguments: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
178
|
-
thoughtSignature: zod.ZodOptional<zod.ZodString>;
|
|
179
162
|
}, zod_v4_core0.$strip>]>>;
|
|
180
163
|
details: zod.ZodOptional<zod.ZodUnknown>;
|
|
181
164
|
isError: zod.ZodBoolean;
|
|
182
165
|
timestamp: zod.ZodNumber;
|
|
183
166
|
}, zod_v4_core0.$strip>]>>;
|
|
184
|
-
|
|
167
|
+
events: zod.ZodArray<zod.ZodObject<{
|
|
168
|
+
id: zod.ZodString;
|
|
169
|
+
runNumber: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
|
|
185
170
|
type: zod.ZodString;
|
|
186
|
-
|
|
171
|
+
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
172
|
+
createdAt: zod.ZodDate;
|
|
173
|
+
deliveredAt: zod.ZodNullable<zod.ZodDate>;
|
|
174
|
+
consumedByStepKey: zod.ZodNullable<zod.ZodString>;
|
|
187
175
|
}, zod_v4_core0.$strip>>;
|
|
176
|
+
trace: zod.ZodArray<zod.ZodType<_mariozechner_pi_agent_core0.AgentEvent, unknown, zod_v4_core0.$ZodTypeInternals<_mariozechner_pi_agent_core0.AgentEvent, unknown>>>;
|
|
177
|
+
turn: zod.ZodNumber;
|
|
178
|
+
phase: zod.ZodEnum<{
|
|
179
|
+
complete: "complete";
|
|
180
|
+
"waiting-for-user": "waiting-for-user";
|
|
181
|
+
"running-agent": "running-agent";
|
|
182
|
+
}>;
|
|
183
|
+
waitingFor: zod.ZodNullable<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
184
|
+
type: zod.ZodLiteral<"user_message">;
|
|
185
|
+
turn: zod.ZodNumber;
|
|
186
|
+
stepKey: zod.ZodString;
|
|
187
|
+
timeoutMs: zod.ZodNullable<zod.ZodNumber>;
|
|
188
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
189
|
+
type: zod.ZodLiteral<"assistant">;
|
|
190
|
+
turn: zod.ZodNumber;
|
|
191
|
+
stepKey: zod.ZodString;
|
|
192
|
+
}, zod_v4_core0.$strip>]>>;
|
|
188
193
|
summaries: zod.ZodArray<zod.ZodObject<{
|
|
189
194
|
turn: zod.ZodNumber;
|
|
190
195
|
assistant: zod.ZodNullable<zod.ZodAny>;
|
|
191
196
|
summary: zod.ZodNullable<zod.ZodString>;
|
|
192
197
|
}, zod_v4_core0.$strip>>;
|
|
193
|
-
}, zod_v4_core0.$strip>, "
|
|
198
|
+
}, zod_v4_core0.$strip>, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", "events" | "trace" | "summaries">;
|
|
199
|
+
useSession: FragnoStoreFactoryData<PiSessionStoreView, [args: PiSessionStoreHookArgs]>;
|
|
194
200
|
useCreateSession: FragnoSolidMutator<NonGetHTTPMethod, "/sessions", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | zod.ZodObject<{
|
|
195
201
|
agent: zod.ZodString;
|
|
196
202
|
name: zod.ZodOptional<zod.ZodString>;
|
|
203
|
+
systemMessage: zod.ZodOptional<zod.ZodString>;
|
|
197
204
|
metadata: zod.ZodOptional<zod.ZodAny>;
|
|
198
205
|
tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
199
206
|
steeringMode: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -212,7 +219,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
212
219
|
waiting: "waiting";
|
|
213
220
|
}>;
|
|
214
221
|
agent: zod.ZodString;
|
|
215
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
216
222
|
steeringMode: zod.ZodEnum<{
|
|
217
223
|
all: "all";
|
|
218
224
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -233,7 +239,6 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
233
239
|
waiting: "waiting";
|
|
234
240
|
}>;
|
|
235
241
|
agent: zod.ZodString;
|
|
236
|
-
workflowInstanceId: zod.ZodNullable<zod.ZodString>;
|
|
237
242
|
steeringMode: zod.ZodEnum<{
|
|
238
243
|
all: "all";
|
|
239
244
|
"one-at-a-time": "one-at-a-time";
|
|
@@ -243,6 +248,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
243
248
|
createdAt: zod.ZodDate;
|
|
244
249
|
updatedAt: zod.ZodDate;
|
|
245
250
|
}, zod_v4_core0.$strip>> | undefined, string, string>;
|
|
251
|
+
useActiveSession: FragnoSolidHook<"GET", "/sessions/:sessionId/active", zod.ZodArray<zod.ZodType<PiActiveSessionProtocolMessage, unknown, zod_v4_core0.$ZodTypeInternals<PiActiveSessionProtocolMessage, unknown>>>, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING", string>;
|
|
246
252
|
useSendMessage: FragnoSolidMutator<NonGetHTTPMethod, "/sessions/:sessionId/messages", zod.ZodObject<{
|
|
247
253
|
text: zod.ZodString;
|
|
248
254
|
done: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -259,7 +265,7 @@ declare function createPiFragmentClient(config?: FragnoPublicClientConfig): {
|
|
|
259
265
|
complete: "complete";
|
|
260
266
|
waiting: "waiting";
|
|
261
267
|
}>;
|
|
262
|
-
}, zod_v4_core0.$strip> | undefined, "
|
|
268
|
+
}, zod_v4_core0.$strip> | undefined, "SESSION_NOT_FOUND" | "WORKFLOW_INSTANCE_MISSING" | "SESSION_NOT_READY", string>;
|
|
263
269
|
};
|
|
264
270
|
//#endregion
|
|
265
271
|
export { createPiFragmentClient };
|