@opengeni/react 0.26.1 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -4
- package/dist/{chunk-F4CFWKVI.js → chunk-4F2YLLHP.js} +2 -2
- package/dist/{chunk-YU5PGUK7.js → chunk-BC6RKIHS.js} +2 -2
- package/dist/{chunk-HIWPQYWI.js → chunk-HQFPO7VX.js} +78 -28
- package/dist/chunk-HQFPO7VX.js.map +1 -0
- package/dist/{chunk-MP6237JB.js → chunk-NBYNFI5T.js} +10 -7
- package/dist/chunk-NBYNFI5T.js.map +1 -0
- package/dist/{chunk-TMH6HZWF.js → chunk-XVVQP7A4.js} +2 -2
- package/dist/{composer-DoC4veX1.d.ts → composer-BMzimGTO.d.ts} +3 -3
- package/dist/composer.d.ts +4 -4
- package/dist/composer.js +3 -3
- package/dist/index.d.ts +14 -14
- package/dist/index.js +5 -5
- package/dist/machines.d.ts +1 -1
- package/dist/machines.js +2 -2
- package/dist/{session-Du_FsrZ1.d.ts → session-LsampPc6.d.ts} +7 -7
- package/dist/{session-context-rgrfElMl.d.ts → session-context-CAjlaeZb.d.ts} +31 -5
- package/dist/{session-ui-BqQDH7YV.d.ts → session-ui-BPOV-tuY.d.ts} +2 -2
- package/dist/session-ui.d.ts +4 -4
- package/dist/session.d.ts +5 -5
- package/dist/session.js +3 -3
- package/dist/{use-composer-BnEzheSk.d.ts → use-composer-ClHy1rkL.d.ts} +1 -1
- package/dist/{use-file-attachments-C0kpHrs9.d.ts → use-file-attachments-BmT8WtqO.d.ts} +2 -2
- package/dist/{use-turn-queue-3rkJwjFv.d.ts → use-turn-queue-aDnQvzVz.d.ts} +2 -2
- package/package.json +2 -2
- package/src/client.ts +23 -8
- package/src/hooks/internal.ts +2 -2
- package/src/hooks/use-file-attachments.ts +6 -3
- package/src/hooks/use-goal.ts +3 -3
- package/src/hooks/use-session-lineage.ts +6 -3
- package/src/hooks/use-session.ts +3 -3
- package/src/index.ts +5 -0
- package/src/session-context.ts +138 -40
- package/src/session.ts +8 -0
- package/dist/chunk-HIWPQYWI.js.map +0 -1
- package/dist/chunk-MP6237JB.js.map +0 -1
- /package/dist/{chunk-F4CFWKVI.js.map → chunk-4F2YLLHP.js.map} +0 -0
- /package/dist/{chunk-YU5PGUK7.js.map → chunk-BC6RKIHS.js.map} +0 -0
- /package/dist/{chunk-TMH6HZWF.js.map → chunk-XVVQP7A4.js.map} +0 -0
package/README.md
CHANGED
|
@@ -42,7 +42,13 @@ CSS, or their optional editor/terminal peers. Pass `{ client, workspaceId }` to
|
|
|
42
42
|
each hook when the host intentionally does not mount `OpenGeniProvider`. The
|
|
43
43
|
exported `SessionClientLike` is deliberately narrow: a tenant-safe proxy needs
|
|
44
44
|
only session events, composer draft/send, queue, pause/resume, and approval
|
|
45
|
-
operations.
|
|
45
|
+
operations. Hooks outside that baseline expose exact refinements rather than
|
|
46
|
+
requiring the full SDK client: `SessionReadClientLike`, `GoalClientLike`,
|
|
47
|
+
`SessionLineageClientLike`, `FileAttachmentClientLike`,
|
|
48
|
+
`HumanInputSessionClientLike`, and `SessionMcpApprovalPolicyClientLike`. A host
|
|
49
|
+
can therefore implement only the methods used by each hook. A shared event feed
|
|
50
|
+
also avoids requiring a client-owned event stream at runtime. Workspace-level
|
|
51
|
+
Resume is an optional authority.
|
|
46
52
|
|
|
47
53
|
The styled root surface uses Tailwind v4 and the package CSS entries:
|
|
48
54
|
|
|
@@ -77,9 +83,12 @@ import {
|
|
|
77
83
|
const client = new OpenGeniClient({ baseUrl: "/api/opengeni" }); // proxy through your API
|
|
78
84
|
|
|
79
85
|
function OpsChannel({ sessionId }: { sessionId: string }) {
|
|
80
|
-
const { timeline, sessionStatus, hasOlder, loadingOlder, loadOlder } =
|
|
86
|
+
const { timeline, sessionStatus, hasOlder, loadingOlder, loadOlder } =
|
|
87
|
+
useSessionEvents(sessionId);
|
|
81
88
|
const queue = useTurnQueue(sessionId);
|
|
82
|
-
const composer = useComposer(sessionId, {
|
|
89
|
+
const composer = useComposer(sessionId, {
|
|
90
|
+
effectiveControl: queue.effectiveControl,
|
|
91
|
+
});
|
|
83
92
|
return (
|
|
84
93
|
<div className="flex h-full flex-col">
|
|
85
94
|
{sessionStatus ? <SessionStatus status={sessionStatus} /> : null}
|
|
@@ -92,7 +101,10 @@ function OpsChannel({ sessionId }: { sessionId: string }) {
|
|
|
92
101
|
className="min-h-0 flex-1"
|
|
93
102
|
/>
|
|
94
103
|
<QueueSurface queue={queue} composer={composer} />
|
|
95
|
-
<ChatComposer
|
|
104
|
+
<ChatComposer
|
|
105
|
+
composer={composer}
|
|
106
|
+
effectiveControl={queue.effectiveControl}
|
|
107
|
+
/>
|
|
96
108
|
</div>
|
|
97
109
|
);
|
|
98
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useEmbeddedSession,
|
|
3
3
|
useSessionEventTrigger
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HQFPO7VX.js";
|
|
5
5
|
|
|
6
6
|
// src/hooks/use-composer.ts
|
|
7
7
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -858,4 +858,4 @@ export {
|
|
|
858
858
|
shouldSubmitOnKey,
|
|
859
859
|
shouldSteerOnKey
|
|
860
860
|
};
|
|
861
|
-
//# sourceMappingURL=chunk-
|
|
861
|
+
//# sourceMappingURL=chunk-4F2YLLHP.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useMutationRunner,
|
|
7
7
|
useOpenGeni,
|
|
8
8
|
usePolledValue
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HQFPO7VX.js";
|
|
10
10
|
import {
|
|
11
11
|
formatBytes,
|
|
12
12
|
formatRelativeTime
|
|
@@ -1955,4 +1955,4 @@ export {
|
|
|
1955
1955
|
EnrollmentDeviceFlow,
|
|
1956
1956
|
EnrollmentConsent
|
|
1957
1957
|
};
|
|
1958
|
-
//# sourceMappingURL=chunk-
|
|
1958
|
+
//# sourceMappingURL=chunk-BC6RKIHS.js.map
|
|
@@ -3,17 +3,24 @@ import { createContext, useContext } from "react";
|
|
|
3
3
|
var OpenGeniContext = createContext(null);
|
|
4
4
|
var NOOP_REGISTER_RECONCILER = () => () => void 0;
|
|
5
5
|
var NOOP_RECONCILE_SESSION = async () => void 0;
|
|
6
|
-
function
|
|
6
|
+
function useEmbeddedClientRefinement(override, requiredMethods, hookName) {
|
|
7
7
|
const context = useContext(OpenGeniContext);
|
|
8
|
-
const
|
|
8
|
+
const candidate = override.client ?? context?.client;
|
|
9
9
|
const workspaceId = override.workspaceId ?? context?.workspaceId;
|
|
10
|
-
if (!
|
|
10
|
+
if (!candidate || !workspaceId) {
|
|
11
11
|
throw new Error(
|
|
12
12
|
"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook."
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
|
+
const methods = candidate;
|
|
16
|
+
const missing = requiredMethods.filter((method) => typeof methods[method] !== "function");
|
|
17
|
+
if (missing.length > 0) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
`@opengeni/react: ${hookName} requires client method${missing.length === 1 ? "" : "s"} ${missing.join(", ")}.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
15
22
|
return {
|
|
16
|
-
client,
|
|
23
|
+
client: candidate,
|
|
17
24
|
workspaceId,
|
|
18
25
|
workspaceControlEvent: context?.workspaceControlEvent ?? null,
|
|
19
26
|
workspaceControlConnectionState: context?.workspaceControlConnectionState ?? "idle",
|
|
@@ -21,7 +28,11 @@ function useOpenGeni(override = {}) {
|
|
|
21
28
|
reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION
|
|
22
29
|
};
|
|
23
30
|
}
|
|
24
|
-
function
|
|
31
|
+
function eventClientMethods(override, directMethods) {
|
|
32
|
+
const hasSharedEventFeed = "events" in override && override.events !== void 0;
|
|
33
|
+
return hasSharedEventFeed ? directMethods : ["getSession", "streamEvents", ...directMethods];
|
|
34
|
+
}
|
|
35
|
+
function useOpenGeni(override = {}) {
|
|
25
36
|
const context = useContext(OpenGeniContext);
|
|
26
37
|
const client = override.client ?? context?.client;
|
|
27
38
|
const workspaceId = override.workspaceId ?? context?.workspaceId;
|
|
@@ -39,31 +50,66 @@ function useEmbeddedSession(override = {}) {
|
|
|
39
50
|
reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION
|
|
40
51
|
};
|
|
41
52
|
}
|
|
53
|
+
function useEmbeddedSession(override = {}) {
|
|
54
|
+
return useEmbeddedClientRefinement(
|
|
55
|
+
override,
|
|
56
|
+
[
|
|
57
|
+
"getSession",
|
|
58
|
+
"listEvents",
|
|
59
|
+
"streamEvents",
|
|
60
|
+
"getComposerDraft",
|
|
61
|
+
"saveComposerDraft",
|
|
62
|
+
"sendMessage",
|
|
63
|
+
"steerMessage",
|
|
64
|
+
"getQueue",
|
|
65
|
+
"moveQueueItem",
|
|
66
|
+
"editQueueItem",
|
|
67
|
+
"steerQueueItem",
|
|
68
|
+
"deleteQueueItem",
|
|
69
|
+
"pauseSession",
|
|
70
|
+
"resumeSession",
|
|
71
|
+
"sendApprovalDecision"
|
|
72
|
+
],
|
|
73
|
+
"session hooks"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function useEmbeddedSessionRead(override = {}) {
|
|
77
|
+
return useEmbeddedClientRefinement(
|
|
78
|
+
override,
|
|
79
|
+
eventClientMethods(override, ["getSession", "updateSession"]),
|
|
80
|
+
"useSession"
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function useEmbeddedGoal(override = {}) {
|
|
84
|
+
return useEmbeddedClientRefinement(
|
|
85
|
+
override,
|
|
86
|
+
eventClientMethods(override, ["getGoal", "updateGoal", "deleteGoal"]),
|
|
87
|
+
"useGoal"
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function useEmbeddedSessionLineage(override = {}) {
|
|
91
|
+
return useEmbeddedClientRefinement(
|
|
92
|
+
override,
|
|
93
|
+
eventClientMethods(override, ["getSessionLineage"]),
|
|
94
|
+
"useSessionLineage"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function useEmbeddedFileAttachments(override = {}) {
|
|
98
|
+
return useEmbeddedClientRefinement(override, ["uploadFile"], "useFileAttachments");
|
|
99
|
+
}
|
|
42
100
|
function useEmbeddedHumanInputSession(override = {}) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
...embedded,
|
|
52
|
-
client
|
|
53
|
-
};
|
|
101
|
+
return useEmbeddedClientRefinement(
|
|
102
|
+
override,
|
|
103
|
+
eventClientMethods(override, ["listHumanInputRequests", "submitHumanInputResponse"]),
|
|
104
|
+
"useHumanInputRequests"
|
|
105
|
+
);
|
|
54
106
|
}
|
|
55
107
|
function useEmbeddedSessionMcpApprovalPolicy(override = {}) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
...embedded,
|
|
65
|
-
client
|
|
66
|
-
};
|
|
108
|
+
return useEmbeddedClientRefinement(
|
|
109
|
+
override,
|
|
110
|
+
eventClientMethods(override, ["getSession", "updateSessionMcpApprovalPolicy"]),
|
|
111
|
+
"useSessionMcpApprovalPolicy"
|
|
112
|
+
);
|
|
67
113
|
}
|
|
68
114
|
function useOpenGeniClient(override = {}) {
|
|
69
115
|
const context = useContext(OpenGeniContext);
|
|
@@ -310,6 +356,10 @@ export {
|
|
|
310
356
|
OpenGeniContext,
|
|
311
357
|
useOpenGeni,
|
|
312
358
|
useEmbeddedSession,
|
|
359
|
+
useEmbeddedSessionRead,
|
|
360
|
+
useEmbeddedGoal,
|
|
361
|
+
useEmbeddedSessionLineage,
|
|
362
|
+
useEmbeddedFileAttachments,
|
|
313
363
|
useEmbeddedHumanInputSession,
|
|
314
364
|
useEmbeddedSessionMcpApprovalPolicy,
|
|
315
365
|
useOpenGeniClient,
|
|
@@ -318,4 +368,4 @@ export {
|
|
|
318
368
|
useSessionEventTrigger,
|
|
319
369
|
useDebouncedCallback
|
|
320
370
|
};
|
|
321
|
-
//# sourceMappingURL=chunk-
|
|
371
|
+
//# sourceMappingURL=chunk-HQFPO7VX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/session-context.ts","../src/hooks/internal.ts"],"sourcesContent":["import type { StreamConnectionState, WorkspaceControlEvent } from \"@opengeni/sdk\";\nimport { createContext, useContext } from \"react\";\nimport type {\n EmbeddedFileAttachmentClientLike,\n EmbeddedGoalClientLike,\n EmbeddedHumanInputSessionClientLike,\n EmbeddedSessionClientLike,\n EmbeddedSessionLineageClientLike,\n EmbeddedSessionMcpApprovalPolicyClientLike,\n EmbeddedSessionReadClientLike,\n SessionClientLike,\n} from \"./client\";\n\nexport type OpenGeniContextValue = {\n client: SessionClientLike;\n workspaceId: string;\n workspaceControlEvent: WorkspaceControlEvent | null;\n workspaceControlConnectionState: StreamConnectionState | \"idle\" | \"error\";\n registerSessionReconciler: (\n sessionId: string,\n key: string,\n reconcile: () => Promise<void>,\n ) => () => void;\n reconcileSession: (sessionId: string) => Promise<void>;\n};\n\nexport const OpenGeniContext = createContext<OpenGeniContextValue | null>(null);\n\nconst NOOP_REGISTER_RECONCILER: OpenGeniContextValue[\"registerSessionReconciler\"] = () => () =>\n undefined;\nconst NOOP_RECONCILE_SESSION: OpenGeniContextValue[\"reconcileSession\"] = async () => undefined;\n\nexport type ClientOverride = {\n client?: SessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionClientOverride = {\n client?: EmbeddedSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedHumanInputClientOverride = {\n client?: EmbeddedHumanInputSessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionMcpApprovalPolicyClientOverride = {\n client?: EmbeddedSessionMcpApprovalPolicyClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionReadClientOverride = {\n client?: EmbeddedSessionReadClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedGoalClientOverride = {\n client?: EmbeddedGoalClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionLineageClientOverride = {\n client?: EmbeddedSessionLineageClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedFileAttachmentClientOverride = {\n client?: EmbeddedFileAttachmentClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\nexport type EmbeddedSessionContextValue = Omit<OpenGeniContextValue, \"client\"> & {\n client: EmbeddedSessionClientLike;\n};\n\ntype EmbeddedClientOverride<TClient> = {\n client?: TClient | undefined;\n workspaceId?: string | undefined;\n};\n\ntype EmbeddedClientContextValue<TClient> = Omit<OpenGeniContextValue, \"client\"> & {\n client: TClient;\n};\n\nfunction useEmbeddedClientRefinement<TClient extends object>(\n override: EmbeddedClientOverride<TClient>,\n requiredMethods: readonly string[],\n hookName: string,\n): EmbeddedClientContextValue<TClient> {\n const context = useContext(OpenGeniContext);\n const candidate = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!candidate || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n const methods = candidate as Record<string, unknown>;\n const missing = requiredMethods.filter((method) => typeof methods[method] !== \"function\");\n if (missing.length > 0) {\n throw new Error(\n `@opengeni/react: ${hookName} requires client method${missing.length === 1 ? \"\" : \"s\"} ${missing.join(\", \")}.`,\n );\n }\n return {\n client: candidate as TClient,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\nfunction eventClientMethods(override: object, directMethods: readonly string[]): readonly string[] {\n const hasSharedEventFeed =\n \"events\" in override && (override as { events?: unknown }).events !== undefined;\n return hasSharedEventFeed ? directMethods : [\"getSession\", \"streamEvents\", ...directMethods];\n}\n\n/** Resolve client + workspace from explicit overrides or the provider. */\nexport function useOpenGeni(override: ClientOverride = {}): OpenGeniContextValue {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!client || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n return {\n client,\n workspaceId,\n workspaceControlEvent: context?.workspaceControlEvent ?? null,\n workspaceControlConnectionState: context?.workspaceControlConnectionState ?? \"idle\",\n registerSessionReconciler: context?.registerSessionReconciler ?? NOOP_REGISTER_RECONCILER,\n reconcileSession: context?.reconcileSession ?? NOOP_RECONCILE_SESSION,\n };\n}\n\n/**\n * Resolve the narrow client required by the session-only hooks. The full\n * provider client is structurally compatible, while an explicit host proxy\n * only needs to expose session/event/composer/queue/control operations.\n */\nexport function useEmbeddedSession(\n override: EmbeddedSessionClientOverride = {},\n): EmbeddedSessionContextValue {\n return useEmbeddedClientRefinement(\n override,\n [\n \"getSession\",\n \"listEvents\",\n \"streamEvents\",\n \"getComposerDraft\",\n \"saveComposerDraft\",\n \"sendMessage\",\n \"steerMessage\",\n \"getQueue\",\n \"moveQueueItem\",\n \"editQueueItem\",\n \"steerQueueItem\",\n \"deleteQueueItem\",\n \"pauseSession\",\n \"resumeSession\",\n \"sendApprovalDecision\",\n ],\n \"session hooks\",\n );\n}\n\n/** Resolve the exact client surface required by `useSession`. */\nexport function useEmbeddedSessionRead(\n override: EmbeddedSessionReadClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionReadClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSession\"]),\n \"useSession\",\n );\n}\n\n/** Resolve the exact client surface required by `useGoal`. */\nexport function useEmbeddedGoal(\n override: EmbeddedGoalClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedGoalClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getGoal\", \"updateGoal\", \"deleteGoal\"]),\n \"useGoal\",\n );\n}\n\n/** Resolve the exact client surface required by `useSessionLineage`. */\nexport function useEmbeddedSessionLineage(\n override: EmbeddedSessionLineageClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedSessionLineageClientLike> {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSessionLineage\"]),\n \"useSessionLineage\",\n );\n}\n\n/** Resolve the exact client surface required by `useFileAttachments`. */\nexport function useEmbeddedFileAttachments(\n override: EmbeddedFileAttachmentClientOverride = {},\n): EmbeddedClientContextValue<EmbeddedFileAttachmentClientLike> {\n return useEmbeddedClientRefinement(override, [\"uploadFile\"], \"useFileAttachments\");\n}\n\n/**\n * Resolve the structured-input refinement without widening the baseline\n * session-only proxy contract.\n */\nexport function useEmbeddedHumanInputSession(override: EmbeddedHumanInputClientOverride = {}): Omit<\n EmbeddedSessionContextValue,\n \"client\"\n> & {\n client: EmbeddedHumanInputSessionClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"listHumanInputRequests\", \"submitHumanInputResponse\"]),\n \"useHumanInputRequests\",\n );\n}\n\n/** Resolve the approval-policy refinement without widening session-only hosts. */\nexport function useEmbeddedSessionMcpApprovalPolicy(\n override: EmbeddedSessionMcpApprovalPolicyClientOverride = {},\n): Omit<EmbeddedSessionContextValue, \"client\"> & {\n client: EmbeddedSessionMcpApprovalPolicyClientLike;\n} {\n return useEmbeddedClientRefinement(\n override,\n eventClientMethods(override, [\"getSession\", \"updateSessionMcpApprovalPolicy\"]),\n \"useSessionMcpApprovalPolicy\",\n );\n}\n\n/**\n * Resolve the client only — for hooks that are not workspace-scoped\n * (`useWorkspaces`, `useBillingUsage`).\n */\nexport function useOpenGeniClient(\n override: Pick<ClientOverride, \"client\"> = {},\n): SessionClientLike {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n if (!client) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client available. Wrap the tree in <OpenGeniProvider> or pass { client } to the hook.\",\n );\n }\n return client;\n}\n","import type { SessionEvent } from \"@opengeni/sdk\";\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport type { EmbeddedSessionEventClientLike } from \"../client\";\n\nexport type AsyncListState<T> = {\n data: T | null;\n loading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n};\n\n/**\n * Shared fetch + optional polling loop for the list/read hooks. Stale\n * responses (superseded by a newer load or an unmount) are dropped.\n */\nexport function usePolledValue<T>(\n load: (signal?: AbortSignal) => Promise<T>,\n options: { pollIntervalMs?: number | undefined; enabled?: boolean | undefined } = {},\n): AsyncListState<T> {\n const enabled = options.enabled ?? true;\n const pollIntervalMs = options.pollIntervalMs;\n const [data, setData] = useState<T | null>(null);\n const [loading, setLoading] = useState(enabled);\n const [error, setError] = useState<Error | null>(null);\n const generation = useRef(0);\n const activeLoadRef = useRef(load);\n useLayoutEffect(() => {\n activeLoadRef.current = load;\n }, [load]);\n const requestAbortRef = useRef<AbortController | null>(null);\n const [stateIdentity, setStateIdentity] = useState<{ load: typeof load }>(() => ({ load }));\n\n // A new loader identity means a new query (different session/workspace/...):\n // drop the previous result instead of showing it as the new query's data.\n useEffect(() => {\n if (stateIdentity.load !== load) {\n setStateIdentity({ load });\n setData(null);\n setError(null);\n }\n }, [load, stateIdentity.load]);\n\n const run = useCallback(async () => {\n // A callback retained by a completed mutation from the previous query must\n // not supersede or settle the current query's request.\n if (activeLoadRef.current !== load) return;\n const ticket = ++generation.current;\n requestAbortRef.current?.abort();\n const requestAbort = new AbortController();\n requestAbortRef.current = requestAbort;\n try {\n const result = await load(requestAbort.signal);\n if (\n ticket === generation.current &&\n activeLoadRef.current === load &&\n !requestAbort.signal.aborted\n ) {\n setData(result);\n setError(null);\n setLoading(false);\n }\n } catch (cause) {\n if (\n ticket === generation.current &&\n activeLoadRef.current === load &&\n !requestAbort.signal.aborted\n ) {\n setError(cause instanceof Error ? cause : new Error(String(cause)));\n setLoading(false);\n }\n } finally {\n if (requestAbortRef.current === requestAbort) {\n requestAbortRef.current = null;\n }\n }\n }, [load]);\n\n useEffect(() => {\n if (!enabled) {\n setLoading(false);\n return;\n }\n setLoading(true);\n void run();\n if (pollIntervalMs === undefined || pollIntervalMs <= 0) {\n return () => {\n generation.current += 1;\n requestAbortRef.current?.abort();\n };\n }\n const timer = setInterval(() => void run(), pollIntervalMs);\n return () => {\n clearInterval(timer);\n generation.current += 1;\n requestAbortRef.current?.abort();\n };\n }, [run, enabled, pollIntervalMs]);\n\n const identityMatches = stateIdentity.load === load;\n return {\n data: identityMatches ? data : null,\n loading: identityMatches ? loading : enabled,\n error: identityMatches ? error : null,\n refresh: run,\n };\n}\n\nexport type MutationState = {\n mutating: boolean;\n mutationError: Error | null;\n clearMutationError: () => void;\n};\n\n/**\n * Shared async mutation runner for the write hooks. `run` resolves with the\n * operation's value, or `null` after capturing the error in `mutationError`\n * (callers then roll back optimistic state).\n */\nexport function useMutationRunner(identity: unknown = undefined): MutationState & {\n run: <T>(operation: () => Promise<T>) => Promise<T | null>;\n} {\n const [mutating, setMutating] = useState(false);\n const [mutationError, setMutationError] = useState<Error | null>(null);\n const [stateIdentity, setStateIdentity] = useState<unknown>(() => identity);\n const inFlight = useRef(0);\n const generation = useRef(0);\n const identityRef = useRef(identity);\n useLayoutEffect(() => {\n if (Object.is(identityRef.current, identity)) return;\n identityRef.current = identity;\n generation.current += 1;\n inFlight.current = 0;\n }, [identity]);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n useEffect(() => {\n if (!Object.is(stateIdentity, identity)) {\n setStateIdentity(() => identity);\n setMutating(false);\n setMutationError(null);\n }\n }, [identity, stateIdentity]);\n const run = useCallback(\n async <T>(operation: () => Promise<T>): Promise<T | null> => {\n const ownedIdentity = identity;\n const ownedGeneration = generation.current;\n if (!Object.is(identityRef.current, ownedIdentity)) return null;\n inFlight.current += 1;\n if (mounted.current) {\n setMutating(true);\n setMutationError(null);\n }\n try {\n const result = await operation();\n if (\n !mounted.current ||\n generation.current !== ownedGeneration ||\n !Object.is(identityRef.current, ownedIdentity)\n ) {\n return null;\n }\n return result;\n } catch (cause) {\n if (\n mounted.current &&\n generation.current === ownedGeneration &&\n Object.is(identityRef.current, ownedIdentity)\n ) {\n setMutationError(cause instanceof Error ? cause : new Error(String(cause)));\n }\n return null;\n } finally {\n if (\n generation.current === ownedGeneration &&\n Object.is(identityRef.current, ownedIdentity)\n ) {\n inFlight.current -= 1;\n if (mounted.current && inFlight.current === 0) {\n setMutating(false);\n }\n }\n }\n },\n [identity],\n );\n const identityMatches = Object.is(stateIdentity, identity);\n return {\n mutating: identityMatches && mutating,\n mutationError: identityMatches ? mutationError : null,\n clearMutationError: useCallback(() => {\n if (Object.is(identityRef.current, identity)) setMutationError(null);\n }, [identity]),\n run,\n };\n}\n\nexport type SessionEventFeedOptions = {\n /**\n * Share an existing event log (from `useSessionEvents`) instead of opening\n * a second stream. When omitted the hook tails the session's event stream\n * itself, starting at the current `lastSequence`.\n */\n events?: SessionEvent[] | undefined;\n enabled?: boolean | undefined;\n};\n\n/**\n * Invoke `onEvent` for every session event matching `match` — the live-update\n * primitive behind `useTurnQueue` and `useGoal`. Either watches a shared\n * `events` log or tails the stream directly (reconnect handled by the SDK).\n */\nexport function useSessionEventTrigger(\n client: EmbeddedSessionEventClientLike,\n workspaceId: string,\n sessionId: string | null | undefined,\n match: (event: SessionEvent) => boolean,\n onEvent: (event: SessionEvent) => void,\n options: SessionEventFeedOptions = {},\n reconcileBeforeLive?: (() => void | Promise<void>) | undefined,\n): void {\n const enabled = options.enabled ?? true;\n const events = options.events;\n const sharedFeed = events !== undefined;\n const matchRef = useRef(match);\n const onEventRef = useRef(onEvent);\n const reconcileBeforeLiveRef = useRef(reconcileBeforeLive);\n useLayoutEffect(() => {\n matchRef.current = match;\n onEventRef.current = onEvent;\n reconcileBeforeLiveRef.current = reconcileBeforeLive;\n }, [match, onEvent, reconcileBeforeLive]);\n const consumedRef = useRef(0);\n const feedKeyRef = useRef<string | null>(null);\n\n // Shared-log mode: scan only the unseen tail on every append.\n useEffect(() => {\n if (!sharedFeed || !enabled || !sessionId) {\n return;\n }\n const feedKey = `${workspaceId}\\u0000${sessionId}`;\n const firstSequence = events[0]?.sequence ?? 0;\n // A new session target or a log reset (sequence restarted below the\n // cursor) restarts consumption from the top of the shared log.\n if (feedKeyRef.current !== feedKey || firstSequence > consumedRef.current + 1) {\n feedKeyRef.current = feedKey;\n consumedRef.current = 0;\n }\n for (const event of events) {\n if (event.sequence <= consumedRef.current) {\n continue;\n }\n consumedRef.current = event.sequence;\n if (matchRef.current(event)) {\n onEventRef.current(event);\n }\n }\n }, [sharedFeed, enabled, events, workspaceId, sessionId]);\n\n // Self-stream mode: tail from the session's current lastSequence.\n useEffect(() => {\n if (sharedFeed || !enabled || !sessionId) {\n return;\n }\n const controller = new AbortController();\n void (async () => {\n try {\n const session = await client.getSession(workspaceId, sessionId);\n if (controller.signal.aborted) {\n return;\n }\n const stream = client.streamEvents(workspaceId, sessionId, {\n after: session.lastSequence,\n signal: controller.signal,\n beforeLive: async () => await reconcileBeforeLiveRef.current?.(),\n });\n for await (const event of stream) {\n if (matchRef.current(event)) {\n onEventRef.current(event);\n }\n }\n } catch {\n // Live updates are best-effort: the read hooks still expose refresh()\n // and the initial load already populated state.\n }\n })();\n return () => {\n controller.abort();\n };\n }, [sharedFeed, enabled, client, workspaceId, sessionId]);\n}\n\n/** Debounce rapid event bursts into one trailing call (default 150ms). */\nexport function useDebouncedCallback(callback: () => void, delayMs = 150): () => void {\n const callbackRef = useRef(callback);\n useLayoutEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => {\n return () => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n };\n }, []);\n return useCallback(() => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n callbackRef.current();\n }, delayMs);\n }, [delayMs]);\n}\n"],"mappings":";AACA,SAAS,eAAe,kBAAkB;AAyBnC,IAAM,kBAAkB,cAA2C,IAAI;AAE9E,IAAM,2BAA8E,MAAM,MACxF;AACF,IAAM,yBAAmE,YAAY;AAuDrF,SAAS,4BACP,UACA,iBACA,UACqC;AACrC,QAAM,UAAU,WAAW,eAAe;AAC1C,QAAM,YAAY,SAAS,UAAU,SAAS;AAC9C,QAAM,cAAc,SAAS,eAAe,SAAS;AACrD,MAAI,CAAC,aAAa,CAAC,aAAa;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,UAAU;AAChB,QAAM,UAAU,gBAAgB,OAAO,CAAC,WAAW,OAAO,QAAQ,MAAM,MAAM,UAAU;AACxF,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,IAAI;AAAA,MACR,oBAAoB,QAAQ,0BAA0B,QAAQ,WAAW,IAAI,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI,CAAC;AAAA,IAC7G;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,iCAAiC,SAAS,mCAAmC;AAAA,IAC7E,2BAA2B,SAAS,6BAA6B;AAAA,IACjE,kBAAkB,SAAS,oBAAoB;AAAA,EACjD;AACF;AAEA,SAAS,mBAAmB,UAAkB,eAAqD;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AsB,UAAU,KAAiB;AACpF,QAAM,cAAc,OAAO,QAAQ;AACnC,kBAAgB,MAAM;AACpB,gBAAY,UAAU;AAAA,EACxB,GAAG,CAAC,QAAQ,CAAC;AACb,QAAM,WAAW,OAA6C,IAAI;AAClE,YAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAI,SAAS,YAAY,MAAM;AAC7B,qBAAa,SAAS,OAAO;AAAA,MAC/B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO,YAAY,MAAM;AACvB,QAAI,SAAS,YAAY,MAAM;AAC7B,mBAAa,SAAS,OAAO;AAAA,IAC/B;AACA,aAAS,UAAU,WAAW,MAAM;AAClC,eAAS,UAAU;AACnB,kBAAY,QAAQ;AAAA,IACtB,GAAG,OAAO;AAAA,EACZ,GAAG,CAAC,OAAO,CAAC;AACd;","names":[]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDebouncedCallback,
|
|
3
|
+
useEmbeddedFileAttachments,
|
|
4
|
+
useEmbeddedGoal,
|
|
3
5
|
useEmbeddedHumanInputSession,
|
|
4
6
|
useEmbeddedSession,
|
|
7
|
+
useEmbeddedSessionLineage,
|
|
5
8
|
useEmbeddedSessionMcpApprovalPolicy,
|
|
9
|
+
useEmbeddedSessionRead,
|
|
6
10
|
useMutationRunner,
|
|
7
|
-
useOpenGeni,
|
|
8
11
|
usePolledValue,
|
|
9
12
|
useSessionEventTrigger
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HQFPO7VX.js";
|
|
11
14
|
import {
|
|
12
15
|
buildTimeline,
|
|
13
16
|
groupTimeline,
|
|
@@ -20,7 +23,7 @@ function isTitleEvent(event) {
|
|
|
20
23
|
return event.type === "session.title_set";
|
|
21
24
|
}
|
|
22
25
|
function useSession(sessionId, options = {}) {
|
|
23
|
-
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } =
|
|
26
|
+
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useEmbeddedSessionRead(options);
|
|
24
27
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
25
28
|
const [override, setOverride] = useState(null);
|
|
26
29
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
@@ -773,7 +776,7 @@ function abortError() {
|
|
|
773
776
|
import { useCallback as useCallback3, useRef as useRef2, useState as useState3 } from "react";
|
|
774
777
|
var isImage = (file) => file.type.startsWith("image/");
|
|
775
778
|
function useFileAttachments(options = {}) {
|
|
776
|
-
const { client, workspaceId } =
|
|
779
|
+
const { client, workspaceId } = useEmbeddedFileAttachments(options);
|
|
777
780
|
const pasteFilter = options.pasteFilter ?? isImage;
|
|
778
781
|
const [attachments, setAttachments] = useState3([]);
|
|
779
782
|
const sources = useRef2(/* @__PURE__ */ new Map());
|
|
@@ -1228,7 +1231,7 @@ function isGoalRefreshEvent(event) {
|
|
|
1228
1231
|
return isGoalEvent(event) || type.startsWith("turn.") || type.startsWith("session.") || type.startsWith("system.update.") || type.startsWith("workspace.inference.") || type.startsWith("user.");
|
|
1229
1232
|
}
|
|
1230
1233
|
function useGoal(sessionId, options = {}) {
|
|
1231
|
-
const { client, workspaceId } =
|
|
1234
|
+
const { client, workspaceId } = useEmbeddedGoal(options);
|
|
1232
1235
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
1233
1236
|
const sharedEvents = options.events;
|
|
1234
1237
|
const sharedFeed = sharedEvents !== void 0;
|
|
@@ -1579,7 +1582,7 @@ function isSessionCreateToolCallCreated(event) {
|
|
|
1579
1582
|
return name === "session_create" || name.endsWith("__session_create");
|
|
1580
1583
|
}
|
|
1581
1584
|
function useSessionLineage(sessionId, options = {}) {
|
|
1582
|
-
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } =
|
|
1585
|
+
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useEmbeddedSessionLineage(options);
|
|
1583
1586
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
1584
1587
|
const load = useCallback8(
|
|
1585
1588
|
async () => sessionId ? await client.getSessionLineage(workspaceId, sessionId) : { ancestors: [], children: [], truncated: false },
|
|
@@ -1830,4 +1833,4 @@ export {
|
|
|
1830
1833
|
isHumanInputEvent,
|
|
1831
1834
|
useHumanInputRequests
|
|
1832
1835
|
};
|
|
1833
|
-
//# sourceMappingURL=chunk-
|
|
1836
|
+
//# sourceMappingURL=chunk-NBYNFI5T.js.map
|