@opengeni/react 0.28.2 → 0.32.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/dist/approvals.d.ts +14 -0
- package/dist/{chunk-M7X4JZOD.js → chunk-4QOQ2DSR.js} +8 -1
- package/dist/chunk-4QOQ2DSR.js.map +1 -0
- package/dist/{chunk-HQFPO7VX.js → chunk-7CJOAW3V.js} +24 -3
- package/dist/{chunk-HQFPO7VX.js.map → chunk-7CJOAW3V.js.map} +1 -1
- package/dist/{chunk-PMSGE233.js → chunk-A2WITZTI.js} +377 -113
- package/dist/chunk-A2WITZTI.js.map +1 -0
- package/dist/{chunk-BC6RKIHS.js → chunk-GZ4KR67U.js} +11 -11
- package/dist/{chunk-4F2YLLHP.js → chunk-KZRUYCL4.js} +14 -17
- package/dist/chunk-KZRUYCL4.js.map +1 -0
- package/dist/{chunk-OCHBZ2X7.js → chunk-TCCE5ZU5.js} +192 -28
- package/dist/chunk-TCCE5ZU5.js.map +1 -0
- package/dist/chunk-U255M5EZ.js +178 -0
- package/dist/chunk-U255M5EZ.js.map +1 -0
- package/dist/{chunk-XVVQP7A4.js → chunk-WY2QN2CX.js} +2539 -2174
- package/dist/chunk-WY2QN2CX.js.map +1 -0
- package/dist/chunk-ZNNE2VES.js +6413 -0
- package/dist/chunk-ZNNE2VES.js.map +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/registry.d.ts +41 -0
- package/dist/commands/types.d.ts +85 -0
- package/dist/components/approval-surface.d.ts +28 -0
- package/dist/components/chat-composer.d.ts +51 -0
- package/dist/components/code-editor.d.ts +43 -0
- package/dist/components/command-palette.d.ts +25 -0
- package/dist/components/composer-transcription-control.d.ts +36 -0
- package/dist/components/composer.d.ts +277 -0
- package/dist/components/copy-button.d.ts +26 -0
- package/dist/components/desktop-viewer.d.ts +85 -0
- package/dist/components/diff-view.d.ts +38 -0
- package/dist/components/enrollment-consent.d.ts +33 -0
- package/dist/components/enrollment-device-flow.d.ts +27 -0
- package/dist/components/file-browser.d.ts +47 -0
- package/dist/components/fleet-tile.d.ts +18 -0
- package/dist/components/human-input-form.d.ts +47 -0
- package/dist/components/machine-card.d.ts +21 -0
- package/dist/components/machine-dock-bar.d.ts +31 -0
- package/dist/components/machine-health-pill.d.ts +9 -0
- package/dist/components/machine-metrics.d.ts +15 -0
- package/dist/components/machine-status-pill.d.ts +54 -0
- package/dist/components/machines/health.d.ts +25 -0
- package/dist/components/machines/machine-detail.d.ts +14 -0
- package/dist/components/machines/metric-history-chart.d.ts +24 -0
- package/dist/components/machines/metric-sparkline.d.ts +9 -0
- package/dist/components/machines/series.d.ts +24 -0
- package/dist/components/machines-dashboard.d.ts +30 -0
- package/dist/components/markdown.d.ts +31 -0
- package/dist/components/message-timeline.d.ts +98 -0
- package/dist/components/model-picker.d.ts +19 -0
- package/dist/components/pierre-diff.d.ts +34 -0
- package/dist/components/pierre-file.d.ts +27 -0
- package/dist/components/queue-draft-policy.d.ts +7 -0
- package/dist/components/queue-surface-implementation.d.ts +20 -0
- package/dist/components/queue-surface-state.d.ts +12 -0
- package/dist/components/queue-surface.d.ts +12 -0
- package/dist/components/sandbox-files.d.ts +49 -0
- package/dist/components/sandbox-terminal.d.ts +123 -0
- package/dist/components/sandbox-workspace.d.ts +128 -0
- package/dist/components/session-chrome.d.ts +70 -0
- package/dist/components/session-status.d.ts +25 -0
- package/dist/components/soften-streaming-markdown.d.ts +13 -0
- package/dist/components/stream-reveal.d.ts +37 -0
- package/dist/components/tip-follow.d.ts +139 -0
- package/dist/components/tooltip.d.ts +16 -0
- package/dist/components/workbench-changes.d.ts +34 -0
- package/dist/components/workspace-dock.d.ts +35 -0
- package/dist/composer.d.ts +11 -7
- package/dist/composer.js +9 -6
- package/dist/hooks/internal.d.ts +46 -0
- package/dist/hooks/use-available-models.d.ts +37 -0
- package/dist/hooks/use-billing-usage.d.ts +26 -0
- package/dist/hooks/use-codex-accounts.d.ts +69 -0
- package/dist/{use-composer-ClHy1rkL.d.ts → hooks/use-composer.d.ts} +16 -24
- package/dist/hooks/use-desktop-stream.d.ts +43 -0
- package/dist/hooks/use-environments.d.ts +35 -0
- package/dist/{use-file-attachments-BmT8WtqO.d.ts → hooks/use-file-attachments.d.ts} +6 -9
- package/dist/hooks/use-goal.d.ts +46 -0
- package/dist/hooks/use-human-input.d.ts +26 -0
- package/dist/hooks/use-last-started-turn-policy.d.ts +27 -0
- package/dist/hooks/use-machine-chip.d.ts +54 -0
- package/dist/hooks/use-machines.d.ts +81 -0
- package/dist/hooks/use-packs.d.ts +27 -0
- package/dist/hooks/use-relay-frame-stream.d.ts +53 -0
- package/dist/hooks/use-rigs.d.ts +87 -0
- package/dist/hooks/use-sandbox-files.d.ts +108 -0
- package/dist/hooks/use-sandbox-git.d.ts +58 -0
- package/dist/hooks/use-sandbox-terminal.d.ts +62 -0
- package/dist/hooks/use-scheduled-tasks.d.ts +15 -0
- package/dist/hooks/use-session-capabilities.d.ts +83 -0
- package/dist/hooks/use-session-control.d.ts +22 -0
- package/dist/hooks/use-session-events.d.ts +92 -0
- package/dist/hooks/use-session-lineage.d.ts +17 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +23 -0
- package/dist/hooks/use-session.d.ts +23 -0
- package/dist/hooks/use-slash-commands.d.ts +66 -0
- package/dist/hooks/use-terminal-stream.d.ts +46 -0
- package/dist/hooks/use-transcription.d.ts +73 -0
- package/dist/hooks/use-turn-queue.d.ts +44 -0
- package/dist/hooks/use-voice-input.d.ts +25 -0
- package/dist/hooks/use-windowed-sections.d.ts +42 -0
- package/dist/hooks/use-workspace-capture.d.ts +49 -0
- package/dist/hooks/use-workspace-edit.d.ts +73 -0
- package/dist/hooks/use-workspace-sessions.d.ts +30 -0
- package/dist/hooks/use-workspaces.d.ts +22 -0
- package/dist/human-input.d.ts +18 -0
- package/dist/index.d.ts +144 -2119
- package/dist/index.js +421 -324
- package/dist/index.js.map +1 -1
- package/dist/lib/clipboard.d.ts +7 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/format.d.ts +48 -0
- package/dist/lib/git-patch.d.ts +8 -0
- package/dist/lib/motion-inspect.d.ts +5 -0
- package/dist/lib/motion.d.ts +14 -0
- package/dist/lib/noto-sans-arabic-loader.d.ts +1 -0
- package/dist/lib/noto-sans-jp-loader.generated.d.ts +1 -0
- package/dist/lib/relay-wire.d.ts +30 -0
- package/dist/lib/use-portal-token-style.d.ts +9 -0
- package/dist/lib/use-theme-type.d.ts +5 -0
- package/dist/lib/use-unicode-fonts.d.ts +12 -0
- package/dist/lib/xterm-renderer.d.ts +19 -0
- package/dist/lib/xterm-theme.d.ts +75 -0
- package/dist/machines.d.ts +30 -413
- package/dist/machines.js +3 -3
- package/dist/model-policy.d.ts +32 -0
- package/dist/model-policy.js +33 -0
- package/dist/model-policy.js.map +1 -0
- package/dist/provider.d.ts +16 -0
- package/dist/{queue-surface-implementation-UQ535OKQ.js → queue-surface-implementation-THPAKGMD.js} +2 -2
- package/dist/{queue-surface-implementation-UQ535OKQ.js.map → queue-surface-implementation-THPAKGMD.js.map} +1 -1
- package/dist/session-context.d.ts +82 -0
- package/dist/session-ui.d.ts +10 -7
- package/dist/session-ui.js +9 -5
- package/dist/session.d.ts +28 -6
- package/dist/session.js +11 -11
- package/dist/timeline/activity-rail.d.ts +19 -0
- package/dist/timeline/disclosure-context.d.ts +14 -0
- package/dist/timeline/entrance.d.ts +14 -0
- package/dist/timeline/fleet-decision-projection.d.ts +9 -0
- package/dist/timeline/fleet-decision-row.d.ts +11 -0
- package/dist/timeline/fold-memory.d.ts +15 -0
- package/dist/timeline/index.d.ts +18 -0
- package/dist/timeline/parsers.d.ts +96 -0
- package/dist/timeline/projection.d.ts +38 -0
- package/dist/timeline/registry.d.ts +40 -0
- package/dist/timeline/screenshot-lightbox.d.ts +26 -0
- package/dist/timeline/seen-activity-ids.d.ts +2 -0
- package/dist/timeline/shared.d.ts +125 -0
- package/dist/timeline/tool-diff.d.ts +8 -0
- package/dist/timeline/tool-display-name.d.ts +10 -0
- package/dist/timeline/tool-renderers.d.ts +5 -0
- package/dist/timeline/turn-summary.d.ts +116 -0
- package/dist/{use-turn-queue-Drm_ypue.d.ts → timeline/types.d.ts} +57 -67
- package/dist/types/machines.d.ts +11 -0
- package/package.json +8 -4
- package/src/client.ts +1 -0
- package/src/components/composer-transcription-control.tsx +278 -130
- package/src/components/composer.tsx +20 -15
- package/src/components/copy-button.tsx +127 -0
- package/src/components/markdown.tsx +231 -32
- package/src/components/message-timeline.tsx +1382 -378
- package/src/components/model-picker.tsx +83 -43
- package/src/components/queue-surface-implementation.tsx +1 -1
- package/src/components/session-chrome.tsx +942 -0
- package/src/components/soften-streaming-markdown.ts +205 -0
- package/src/components/stream-reveal.ts +195 -0
- package/src/components/tip-follow.ts +459 -0
- package/src/components/tooltip.tsx +103 -0
- package/src/composer.ts +6 -0
- package/src/hooks/internal.ts +30 -4
- package/src/hooks/use-available-models.ts +51 -4
- package/src/hooks/use-composer.ts +24 -18
- package/src/hooks/use-last-started-turn-policy.ts +95 -0
- package/src/hooks/use-session-events.ts +359 -5
- package/src/hooks/use-voice-input.ts +232 -0
- package/src/index.ts +49 -1
- package/src/lib/clipboard.ts +58 -0
- package/src/lib/format.ts +18 -0
- package/src/lib/motion-inspect.ts +5 -0
- package/src/lib/motion.ts +80 -0
- package/src/model-policy.ts +210 -0
- package/src/session-ui.ts +7 -0
- package/src/session.ts +2 -0
- package/src/timeline/activity-rail.tsx +46 -7
- package/src/timeline/entrance.tsx +10 -0
- package/src/timeline/fold-memory.ts +52 -0
- package/src/timeline/index.ts +11 -1
- package/src/timeline/projection.ts +252 -47
- package/src/timeline/seen-activity-ids.ts +19 -0
- package/src/timeline/shared.tsx +1 -1
- package/src/timeline/tool-renderers.tsx +75 -6
- package/src/timeline/turn-summary.tsx +387 -97
- package/src/timeline/types.ts +47 -0
- package/styles/index.css +99 -7
- package/styles/tokens.css +44 -3
- package/dist/chunk-4F2YLLHP.js.map +0 -1
- package/dist/chunk-M7X4JZOD.js.map +0 -1
- package/dist/chunk-OCHBZ2X7.js.map +0 -1
- package/dist/chunk-PMSGE233.js.map +0 -1
- package/dist/chunk-WAA247AB.js +0 -3858
- package/dist/chunk-WAA247AB.js.map +0 -1
- package/dist/chunk-XVVQP7A4.js.map +0 -1
- package/dist/composer-BMzimGTO.d.ts +0 -528
- package/dist/session-C3tIXLim.d.ts +0 -264
- package/dist/session-context-CAjlaeZb.d.ts +0 -84
- package/dist/session-ui-B_7cfN5u.d.ts +0 -259
- /package/dist/{chunk-BC6RKIHS.js.map → chunk-GZ4KR67U.js.map} +0 -0
|
@@ -19,7 +19,7 @@ export type UseComposerOptions = EmbeddedSessionClientOverride &
|
|
|
19
19
|
/** Called with the exact accepted wire input after a successful send. */
|
|
20
20
|
onSent?: ((text: string, input: SendMessageInput) => void) | undefined;
|
|
21
21
|
/**
|
|
22
|
-
* Extra message fields (resources, tools, model, reasoningEffort) merged
|
|
22
|
+
* Extra message fields (resources, tools, model, reasoningEffort, latencyMode) merged
|
|
23
23
|
* into every send. A function is evaluated at send time so it can read the
|
|
24
24
|
* surrounding UI state (attachment pickers, model selectors, ...).
|
|
25
25
|
*/
|
|
@@ -448,12 +448,21 @@ export function useComposer(
|
|
|
448
448
|
replaceLocal ||
|
|
449
449
|
(!localWasDirtyAtStart && localAtStart === localEditRevision.current)
|
|
450
450
|
) {
|
|
451
|
+
// Model/effort ride in sendExtras (outside localEditRevision). If
|
|
452
|
+
// the picker changed during this fetch, skip onDraftApplied so a
|
|
453
|
+
// stale server model/effort cannot undo the operator's pick.
|
|
454
|
+
const extrasNow = resolveSendExtras(sendExtrasRef.current);
|
|
455
|
+
const pickerChangedDuringFetch =
|
|
456
|
+
extrasNow.model !== extrasAtStart.model ||
|
|
457
|
+
extrasNow.reasoningEffort !== extrasAtStart.reasoningEffort;
|
|
451
458
|
valueRef.current = fetched.text;
|
|
452
459
|
restoredResourcesRef.current = fetched.resources;
|
|
453
460
|
lastSavedSignature.current = draftSignature(draftPayload(fetched));
|
|
454
461
|
setValue(fetched.text);
|
|
455
462
|
setRestoredResources(fetched.resources);
|
|
456
|
-
|
|
463
|
+
if (replaceLocal || !pickerChangedDuringFetch) {
|
|
464
|
+
onDraftAppliedRef.current?.(fetched);
|
|
465
|
+
}
|
|
457
466
|
}
|
|
458
467
|
}
|
|
459
468
|
} catch (cause) {
|
|
@@ -773,14 +782,8 @@ export function useComposer(
|
|
|
773
782
|
// The wire contract requires non-empty text (z.string().min(1)) and the
|
|
774
783
|
// worker rejects whitespace-only text; a file-only message therefore
|
|
775
784
|
// carries a minimal default so the attachments still get delivered.
|
|
776
|
-
const acknowledgedDraft = draftRef.current;
|
|
777
|
-
const sendExtras =
|
|
778
|
-
acknowledgedDraft?.toolsProvided === true &&
|
|
779
|
-
!Object.prototype.hasOwnProperty.call(extras, "tools")
|
|
780
|
-
? { ...extras, tools: acknowledgedDraft.tools }
|
|
781
|
-
: extras;
|
|
782
785
|
pendingClientEventId.current ??= generateClientEventId();
|
|
783
|
-
const input = composeSendInput(sendText, pendingClientEventId.current,
|
|
786
|
+
const input = composeSendInput(sendText, pendingClientEventId.current, extras, {
|
|
784
787
|
...(options.effectiveControl?.controlEtag
|
|
785
788
|
? { controlEtag: options.effectiveControl.controlEtag }
|
|
786
789
|
: {}),
|
|
@@ -1033,13 +1036,10 @@ export function useComposer(
|
|
|
1033
1036
|
const hasDraftContent = useCallback((): boolean => {
|
|
1034
1037
|
const current = draftRef.current;
|
|
1035
1038
|
const extras = resolveSendExtras(sendExtrasRef.current);
|
|
1036
|
-
const toolsProvidedByHost = Object.prototype.hasOwnProperty.call(extras, "tools");
|
|
1037
|
-
const tools = toolsProvidedByHost ? (extras.tools ?? []) : (current?.tools ?? []);
|
|
1038
1039
|
return (
|
|
1039
1040
|
valueRef.current.length > 0 ||
|
|
1040
1041
|
restoredResourcesRef.current.length > 0 ||
|
|
1041
1042
|
(extras.resources?.length ?? 0) > 0 ||
|
|
1042
|
-
tools.length > 0 ||
|
|
1043
1043
|
(current?.sourceTurnId !== null && current?.sourceTurnId !== undefined)
|
|
1044
1044
|
);
|
|
1045
1045
|
}, []);
|
|
@@ -1201,10 +1201,9 @@ function draftPayload(draft: ComposerDraft): SaveComposerDraftRequest {
|
|
|
1201
1201
|
expectedRevision: draft.revision,
|
|
1202
1202
|
text: draft.text,
|
|
1203
1203
|
resources: draft.resources,
|
|
1204
|
-
tools: draft.tools,
|
|
1205
|
-
toolsProvided: draft.toolsProvided,
|
|
1206
1204
|
model: draft.model,
|
|
1207
1205
|
reasoningEffort: draft.reasoningEffort,
|
|
1206
|
+
latencyMode: draft.latencyMode ?? "standard",
|
|
1208
1207
|
};
|
|
1209
1208
|
}
|
|
1210
1209
|
|
|
@@ -1214,15 +1213,13 @@ function composerDraftPayload(
|
|
|
1214
1213
|
restoredResources: ResourceRef[],
|
|
1215
1214
|
extras: ComposerSendExtras,
|
|
1216
1215
|
): SaveComposerDraftRequest {
|
|
1217
|
-
const toolsProvidedByHost = Object.prototype.hasOwnProperty.call(extras, "tools");
|
|
1218
1216
|
return {
|
|
1219
1217
|
expectedRevision: base.revision,
|
|
1220
1218
|
text,
|
|
1221
1219
|
resources: mergeResources(restoredResources, extras.resources ?? []),
|
|
1222
|
-
tools: toolsProvidedByHost ? (extras.tools ?? []) : base.tools,
|
|
1223
|
-
toolsProvided: toolsProvidedByHost ? true : base.toolsProvided,
|
|
1224
1220
|
model: extras.model ?? base.model,
|
|
1225
1221
|
reasoningEffort: extras.reasoningEffort ?? base.reasoningEffort,
|
|
1222
|
+
latencyMode: extras.latencyMode ?? base.latencyMode ?? "standard",
|
|
1226
1223
|
};
|
|
1227
1224
|
}
|
|
1228
1225
|
|
|
@@ -1234,7 +1231,16 @@ function draftSignature(payload: SaveComposerDraftRequest): string {
|
|
|
1234
1231
|
function mergeResources(base: ResourceRef[], additions: ResourceRef[]): ResourceRef[] {
|
|
1235
1232
|
const seen = new Set<string>();
|
|
1236
1233
|
return [...base, ...additions].filter((resource) => {
|
|
1237
|
-
|
|
1234
|
+
// Reconnect reconciliation can restore the canonical server form while
|
|
1235
|
+
// the still-mounted upload card supplies the same ready file without its
|
|
1236
|
+
// default mount. Treat those two wire shapes as one selected attachment;
|
|
1237
|
+
// preserving the first representation keeps custom mounts and ordering
|
|
1238
|
+
// intact while preventing the draft and command paths from seeing
|
|
1239
|
+
// different duplicate counts after server normalization.
|
|
1240
|
+
const key =
|
|
1241
|
+
resource.kind === "file"
|
|
1242
|
+
? `file:${resource.fileId}\u0000${resource.mountPath ?? `files/${resource.fileId}`}`
|
|
1243
|
+
: JSON.stringify(resource);
|
|
1238
1244
|
if (seen.has(key)) return false;
|
|
1239
1245
|
seen.add(key);
|
|
1240
1246
|
return true;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { LatencyMode, ReasoningEffort, SessionEvent, SessionTurn } from "@opengeni/sdk";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { useOpenGeni, type ClientOverride } from "../session-context";
|
|
4
|
+
import { usePolledValue, useSessionEventTrigger, type SessionEventFeedOptions } from "./internal";
|
|
5
|
+
|
|
6
|
+
/** Refresh when a turn actually admits — not on composer picker / queue-only changes. */
|
|
7
|
+
export function isLastStartedTurnPolicyEvent(event: Pick<SessionEvent, "type">): boolean {
|
|
8
|
+
return event.type === "turn.started";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type LastStartedTurnPolicy = {
|
|
12
|
+
model: string;
|
|
13
|
+
reasoningEffort: ReasoningEffort;
|
|
14
|
+
latencyMode: LatencyMode;
|
|
15
|
+
turnId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type UseLastStartedTurnPolicyOptions = ClientOverride &
|
|
19
|
+
SessionEventFeedOptions & {
|
|
20
|
+
pollIntervalMs?: number | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type UseLastStartedTurnPolicyResult = {
|
|
24
|
+
/** Null until some turn has durably emitted `turn.started`. */
|
|
25
|
+
policy: LastStartedTurnPolicy | null;
|
|
26
|
+
loading: boolean;
|
|
27
|
+
error: Error | null;
|
|
28
|
+
refresh: () => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function policyFromTurn(turn: SessionTurn | null | undefined): LastStartedTurnPolicy | null {
|
|
32
|
+
if (!turn) return null;
|
|
33
|
+
return {
|
|
34
|
+
model: turn.model,
|
|
35
|
+
reasoningEffort: turn.reasoningEffort,
|
|
36
|
+
latencyMode: turn.latencyMode ?? "standard",
|
|
37
|
+
turnId: turn.id,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Model·effort·latency of the newest admitted turn (`turn.started`). This is
|
|
43
|
+
* historical runtime truth for the session header — not the composer next-turn
|
|
44
|
+
* picker and not the frozen session creation defaults.
|
|
45
|
+
*/
|
|
46
|
+
export function useLastStartedTurnPolicy(
|
|
47
|
+
sessionId: string | null | undefined,
|
|
48
|
+
options: UseLastStartedTurnPolicyOptions = {},
|
|
49
|
+
): UseLastStartedTurnPolicyResult {
|
|
50
|
+
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } =
|
|
51
|
+
useOpenGeni(options);
|
|
52
|
+
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
53
|
+
|
|
54
|
+
const load = useCallback(async (): Promise<LastStartedTurnPolicy | null> => {
|
|
55
|
+
if (!sessionId) return null;
|
|
56
|
+
const turns = await client.listTurns(workspaceId, sessionId, { latestStarted: true });
|
|
57
|
+
return policyFromTurn(turns[0]);
|
|
58
|
+
}, [client, workspaceId, sessionId]);
|
|
59
|
+
|
|
60
|
+
const { data, loading, error, refresh } = usePolledValue(load, {
|
|
61
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
62
|
+
enabled,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (enabled && workspaceControlEvent) void refresh();
|
|
67
|
+
}, [enabled, refresh, workspaceControlEvent]);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!sessionId || !enabled) return;
|
|
71
|
+
return registerSessionReconciler(sessionId, "last-started-turn-policy", refresh);
|
|
72
|
+
}, [enabled, refresh, registerSessionReconciler, sessionId]);
|
|
73
|
+
|
|
74
|
+
// Shared-feed only: the session header lives outside the route event log and
|
|
75
|
+
// must not open a second SSE. Without `events`, rely on the initial fetch +
|
|
76
|
+
// optional poll / workspace-control / reconciler.
|
|
77
|
+
useSessionEventTrigger(
|
|
78
|
+
client,
|
|
79
|
+
workspaceId,
|
|
80
|
+
sessionId,
|
|
81
|
+
isLastStartedTurnPolicyEvent,
|
|
82
|
+
() => void refresh(),
|
|
83
|
+
{
|
|
84
|
+
events: options.events,
|
|
85
|
+
enabled: enabled && options.events !== undefined,
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
policy: enabled ? data : null,
|
|
91
|
+
loading,
|
|
92
|
+
error,
|
|
93
|
+
refresh,
|
|
94
|
+
};
|
|
95
|
+
}
|