@pylonsync/react 0.4.22 → 0.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/useAgentRun.d.ts +47 -0
- package/package.json +3 -3
- package/src/index.ts +8 -0
- package/src/useAgentRun.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type { PylonRouter } from "./useRouter";
|
|
|
16
16
|
import { type Storage as PylonStorage } from "@pylonsync/sync";
|
|
17
17
|
export { useQuery, useQueryOne, useReactiveQuery, useMutation, useInfiniteQuery, usePaginatedQuery, useEntityMutation, useAction, useQueryRaw, useQueryOneRaw, useLiveList, useLiveRow, useInsert, useUpdate, useDelete, useFn, useAggregate, useSearch, } from "./hooks";
|
|
18
18
|
export type { QueryOptions, QueryFilter, IncludeSpec, UseQueryReturn, UseQueryOneReturn, UseReactiveQueryReturn, UseMutationReturn, UseInfiniteQueryReturn, UsePaginatedQueryReturn, PaginatedQueryStatus, UseFnReturn, AggregateSpec, UseAggregateReturn, SearchSpec, UseSearchReturn, } from "./hooks";
|
|
19
|
+
export { useAgentRun } from "./useAgentRun";
|
|
20
|
+
export type { AgentRunRow, AgentMessageRow, UseAgentRunReturn, } from "./useAgentRun";
|
|
19
21
|
export { useRoom, useRoomMessages } from "./useRoom";
|
|
20
22
|
export type { RoomPeer, RoomSnapshot, UseRoomOptions, UseRoomReturn, } from "./useRoom";
|
|
21
23
|
export type { RoomMessage } from "@pylonsync/sync";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live view of an `agent()` run — the AgentRun row plus its ordered
|
|
3
|
+
* transcript — straight from the synced replica. Because AgentRun and
|
|
4
|
+
* AgentMessage are ordinary synced entities (owner-scoped by policy),
|
|
5
|
+
* this updates in real time on every one of the user's devices as the
|
|
6
|
+
* loop persists turns: user input, assistant text, tool calls, tool
|
|
7
|
+
* results.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const { run, messages } = useAgentRun(runId);
|
|
11
|
+
* // messages[i]: { role: "user" | "assistant", content: string | LlmContentBlock[] , seq, ... }
|
|
12
|
+
* // run.status: "idle" | "running" | "completed" | "failed"
|
|
13
|
+
* // run.streamId: attach to live tokens with resumeStream(run.streamId)
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Start or continue a run with `streamFn("<agentName>", { input, runId? })`
|
|
17
|
+
* — tokens stream on that connection; the persisted transcript arrives
|
|
18
|
+
* here.
|
|
19
|
+
*/
|
|
20
|
+
export interface AgentRunRow {
|
|
21
|
+
id: string;
|
|
22
|
+
agent: string;
|
|
23
|
+
status: "idle" | "running" | "completed" | "failed" | string;
|
|
24
|
+
userId?: string | null;
|
|
25
|
+
title?: string | null;
|
|
26
|
+
/** Resumable-stream id of the current/last generation. */
|
|
27
|
+
streamId?: string | null;
|
|
28
|
+
error?: string | null;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AgentMessageRow {
|
|
33
|
+
id: string;
|
|
34
|
+
runId: string;
|
|
35
|
+
seq: number;
|
|
36
|
+
role: "user" | "assistant" | string;
|
|
37
|
+
/** A string for plain turns, or LlmContentBlock[] for assistant
|
|
38
|
+
* turns with tool_use and tool_result batches. */
|
|
39
|
+
content: unknown;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
}
|
|
42
|
+
export interface UseAgentRunReturn {
|
|
43
|
+
run: AgentRunRow | null;
|
|
44
|
+
messages: AgentMessageRow[];
|
|
45
|
+
loading: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function useAgentRun(runId: string | null | undefined): UseAgentRunReturn;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.4.
|
|
6
|
+
"version": "0.4.23",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"prepack": "bun run build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pylonsync/sdk": "0.4.
|
|
18
|
-
"@pylonsync/sync": "0.4.
|
|
17
|
+
"@pylonsync/sdk": "0.4.23",
|
|
18
|
+
"@pylonsync/sync": "0.4.23"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": ">=19.0.0"
|
package/src/index.ts
CHANGED
|
@@ -107,6 +107,14 @@ export type {
|
|
|
107
107
|
UseSearchReturn,
|
|
108
108
|
} from "./hooks";
|
|
109
109
|
|
|
110
|
+
// Agent run hook — live transcript + status for agent() runs
|
|
111
|
+
export { useAgentRun } from "./useAgentRun";
|
|
112
|
+
export type {
|
|
113
|
+
AgentRunRow,
|
|
114
|
+
AgentMessageRow,
|
|
115
|
+
UseAgentRunReturn,
|
|
116
|
+
} from "./useAgentRun";
|
|
117
|
+
|
|
110
118
|
// Room hook
|
|
111
119
|
export { useRoom, useRoomMessages } from "./useRoom";
|
|
112
120
|
export type {
|
|
Binary file
|