@opengeni/react 0.29.0 → 0.33.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-CSJBF3QJ.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-AVLMIWYO.js → chunk-KZRUYCL4.js} +12 -6
- package/dist/chunk-KZRUYCL4.js.map +1 -0
- package/dist/{chunk-IPVOVOW6.js → chunk-MS3FBZ6A.js} +2539 -2174
- package/dist/chunk-MS3FBZ6A.js.map +1 -0
- package/dist/{chunk-OKXCECLG.js → chunk-TCCE5ZU5.js} +171 -22
- 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-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-D_1a8W_l.d.ts → timeline/types.d.ts} +41 -69
- 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 +1304 -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 +23 -3
- 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 +47 -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/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 +9 -1
- package/src/timeline/projection.ts +226 -41
- 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 +21 -0
- package/styles/index.css +99 -7
- package/styles/tokens.css +44 -3
- package/dist/chunk-AVLMIWYO.js.map +0 -1
- package/dist/chunk-CSJBF3QJ.js.map +0 -1
- package/dist/chunk-IPVOVOW6.js.map +0 -1
- package/dist/chunk-M7X4JZOD.js.map +0 -1
- package/dist/chunk-OKXCECLG.js.map +0 -1
- package/dist/chunk-ZMNPFZWL.js +0 -3918
- package/dist/chunk-ZMNPFZWL.js.map +0 -1
- package/dist/composer-BMzimGTO.d.ts +0 -528
- package/dist/session-DaONt-dY.d.ts +0 -264
- package/dist/session-context-CAjlaeZb.d.ts +0 -84
- package/dist/session-ui-B5_roA95.d.ts +0 -259
- /package/dist/{chunk-BC6RKIHS.js.map → chunk-GZ4KR67U.js.map} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { SessionEvent } from "@opengeni/sdk";
|
|
2
|
+
import { type ClientOverride } from "../provider";
|
|
3
|
+
export type TerminalChunk = {
|
|
4
|
+
/** Stable key (the source event id) so the xterm writer tracks a written-cursor. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Raw output bytes (utf-8 lossy) — written verbatim into xterm. */
|
|
7
|
+
text: string;
|
|
8
|
+
/** stdout vs stderr (drives optional tinting). */
|
|
9
|
+
stream: "stdout" | "stderr";
|
|
10
|
+
/** Global ordering: the source event sequence. */
|
|
11
|
+
seq: number;
|
|
12
|
+
};
|
|
13
|
+
export type UseSandboxTerminalOptions = ClientOverride & {
|
|
14
|
+
/** The live session event log (usually `useSessionEvents().events`). */
|
|
15
|
+
events: SessionEvent[];
|
|
16
|
+
/** Restrict to one PTY (by ptyId). Omit to interleave the agent firehose +
|
|
17
|
+
* every PTY. */
|
|
18
|
+
ptyId?: string | undefined;
|
|
19
|
+
/** Include the agent's command-output firehose (sandbox.command.output.delta).
|
|
20
|
+
* Default true — the read-only "terminal-as-events" the data path settled on. */
|
|
21
|
+
includeAgentFirehose?: boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* OPEN an interactive PTY against the box so the user can type, not just watch.
|
|
24
|
+
* When true (and the session is live) the hook calls `terminalPtyOpen` once,
|
|
25
|
+
* tracks the returned ptyId, exposes `write` immediately (bound to that ptyId),
|
|
26
|
+
* and closes the PTY on unmount. The PTY's banner + every output delta ride the
|
|
27
|
+
* SSE spine (`terminal.pty.*`) back into `events`, so xterm fills in. Default
|
|
28
|
+
* false — a caller that only wants the read-only firehose stays projection-only.
|
|
29
|
+
*/
|
|
30
|
+
interactive?: boolean | undefined;
|
|
31
|
+
/** Lease liveness ("cold" | "warm" | "draining"). The interactive PTY is only
|
|
32
|
+
* opened once the box is warm — opening on a cold box (ptyCapable is advertised
|
|
33
|
+
* cold too) races the box and leaves a dead read-only terminal. */
|
|
34
|
+
liveness?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type UseSandboxTerminalResult = {
|
|
37
|
+
/** Ordered, deduped output chunks to write() into xterm.js. */
|
|
38
|
+
chunks: TerminalChunk[];
|
|
39
|
+
/** Whether a PTY is currently open (drives the prompt/cursor affordance). */
|
|
40
|
+
running: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Interactive write fn when a PTY is open and the backend supports stdin
|
|
43
|
+
* (`terminal.transport === "pty-ws"` / `PtyOpenResponse.supportsInput`). Null
|
|
44
|
+
* in the read-only event-projection case (v1 default).
|
|
45
|
+
*/
|
|
46
|
+
write: ((data: string) => void) | null;
|
|
47
|
+
/** The active PTY id, if one is open. */
|
|
48
|
+
activePtyId: string | null;
|
|
49
|
+
/** Close the active PTY (no-op when none is open). */
|
|
50
|
+
close: () => void;
|
|
51
|
+
/** A PTY-open failure (interactive mode), if any. */
|
|
52
|
+
error: Error | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Project the Channel-A event log into an xterm-writable byte stream. The
|
|
56
|
+
* terminal is "terminal-as-events": there is NO new socket in v1 — the agent's
|
|
57
|
+
* command output (`sandbox.command.output.delta`) and any interactive PTY
|
|
58
|
+
* (`terminal.pty.output.delta`) ride the existing SSE spine. When a PTY is open
|
|
59
|
+
* and the backend accepts stdin, `write` pipes keystrokes via the SDK
|
|
60
|
+
* `terminalPtyWrite` (the synchronous Channel-A control path).
|
|
61
|
+
*/
|
|
62
|
+
export declare function useSandboxTerminal(sessionId: string | null | undefined, options: UseSandboxTerminalOptions): UseSandboxTerminalResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ScheduledTask } from "@opengeni/sdk";
|
|
2
|
+
import { type ClientOverride } from "../provider";
|
|
3
|
+
export type UseScheduledTasksOptions = ClientOverride & {
|
|
4
|
+
limit?: number | undefined;
|
|
5
|
+
pollIntervalMs?: number | undefined;
|
|
6
|
+
enabled?: boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type UseScheduledTasksResult = {
|
|
9
|
+
tasks: ScheduledTask[];
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
refresh: () => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
/** List the workspace's scheduled tasks (drift checks, sentinels, reapers, ...). */
|
|
15
|
+
export declare function useScheduledTasks(options?: UseScheduledTasksOptions): UseScheduledTasksResult;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type SessionCapabilities, type SessionEvent } from "@opengeni/sdk";
|
|
2
|
+
import { type ClientOverride } from "../provider";
|
|
3
|
+
export type SessionCapabilitiesState = "idle" | "negotiating" | "ready" | "cold" | "on-demand" | "error";
|
|
4
|
+
export type UseSessionCapabilitiesOptions = ClientOverride & {
|
|
5
|
+
/**
|
|
6
|
+
* Live event log to fold `stream.url.rotated` from (usually
|
|
7
|
+
* `useSessionEvents().events`). When present the desktop socket stays fresh on
|
|
8
|
+
* a box rollover without a round-trip; stale-epoch rotations are dropped.
|
|
9
|
+
*/
|
|
10
|
+
events?: SessionEvent[] | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to acquire a viewer holder for the desktop pixel plane. Requires the
|
|
13
|
+
* un-redacted acknowledgment to have been recorded (else the attach 409s and
|
|
14
|
+
* the hook surfaces the consent requirement). Default false: read-only
|
|
15
|
+
* negotiation (no holder, no warm) — terminal/files/git work without it.
|
|
16
|
+
*/
|
|
17
|
+
attachDesktop?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to acquire a viewer holder to warm the box for the REAL interactive
|
|
20
|
+
* terminal (the ttyd pty-ws plane). Symmetric with `attachDesktop` and shares
|
|
21
|
+
* the SAME viewer attach (one warm box serves both planes), but needs NO
|
|
22
|
+
* un-redacted acknowledgment — a shell is interactive by nature, and the gate
|
|
23
|
+
* is the scoped tunnel URL + stream token. Default false: the terminal stays on
|
|
24
|
+
* the read-only Channel-A firehose until the user opens/focuses it. The attach
|
|
25
|
+
* folds the minted `pty-ws` url+token into the `Terminal` cell.
|
|
26
|
+
*/
|
|
27
|
+
attachTerminal?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to acquire a viewer holder to warm the box for a FILE WRITE — the
|
|
30
|
+
* wake-on-edit INTENT (a first keystroke in the editor), NOT passive browsing.
|
|
31
|
+
* Shares the SAME viewer attach as the desktop/terminal (one warm box, one
|
|
32
|
+
* holder) and — like the terminal — needs NO un-redacted acknowledgment:
|
|
33
|
+
* reading/writing files is the ordinary Channel-A control plane, not the pixel
|
|
34
|
+
* plane. It folds NO live URL (files ride the stateless HTTP plane) — it only
|
|
35
|
+
* refcounts liveness. Unlike desktop/terminal it warms even a COLD box: an edit
|
|
36
|
+
* legitimately cold-creates (that IS the wake), so the write lands ~100ms warm
|
|
37
|
+
* instead of paying the ~5s cold resume. Default false. IMPORTANT: merely
|
|
38
|
+
* opening/reading the Files tab must NOT set this — browsing capture-served
|
|
39
|
+
* trees/diffs needs no box, and warming one on a cold glance burns box-hours to
|
|
40
|
+
* serve reads the capture already answers for free.
|
|
41
|
+
*/
|
|
42
|
+
attachFiles?: boolean | undefined;
|
|
43
|
+
/** Hold off negotiating (e.g. the workbench panel is collapsed). Default true. */
|
|
44
|
+
enabled?: boolean | undefined;
|
|
45
|
+
/** Poll cadence (ms) while the lease is cold/warming. Default 1500. */
|
|
46
|
+
warmingPollMs?: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Give up waiting for `warm` after this long while polling (ms) and surface a
|
|
49
|
+
* stalled error with a manual `renegotiate`. Default 30000. This is a UI
|
|
50
|
+
* patience deadline, independent from the worker's sandbox warming timeout.
|
|
51
|
+
* 0 disables the deadline.
|
|
52
|
+
*/
|
|
53
|
+
warmingDeadlineMs?: number | undefined;
|
|
54
|
+
};
|
|
55
|
+
export type UseSessionCapabilitiesResult = {
|
|
56
|
+
/** The negotiated capability doc — the single source of UI truth. */
|
|
57
|
+
capabilities: SessionCapabilities | null;
|
|
58
|
+
state: SessionCapabilitiesState;
|
|
59
|
+
error: Error | null;
|
|
60
|
+
/**
|
|
61
|
+
* 409 from the desktop attach: the un-redacted (or shared) plane needs explicit
|
|
62
|
+
* acknowledgment before a viewer holder is granted. Drives the consent prompt.
|
|
63
|
+
*/
|
|
64
|
+
acknowledgmentRequired: "unredacted" | "shared" | null;
|
|
65
|
+
/** 429 from the desktop attach: the per-session viewer cap is reached. */
|
|
66
|
+
viewerCapReached: boolean;
|
|
67
|
+
/** The viewer holder id minted on a desktop attach (for detach/heartbeat). */
|
|
68
|
+
viewerId: string | null;
|
|
69
|
+
/** Force a re-negotiation (after acknowledging, a resolution change, etc.). */
|
|
70
|
+
renegotiate: () => void;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The capability-negotiation hook. Discovers what THIS session+backend+OS
|
|
74
|
+
* supports (FileSystem/Terminal/Git always-ish; DesktopStream/Recording
|
|
75
|
+
* sometimes), drives capability-gated rendering, and — when `attachDesktop` —
|
|
76
|
+
* holds a viewer lease + heartbeats it so the box stays warm while watched.
|
|
77
|
+
*
|
|
78
|
+
* Degradation is a value, never a crash: an unsupported surface comes back
|
|
79
|
+
* `available:false`/`transport:null` + a `reason`; the components render the
|
|
80
|
+
* reason-aware empty state. 409 (consent) and 429 (viewer cap) are surfaced as
|
|
81
|
+
* typed signals, not thrown.
|
|
82
|
+
*/
|
|
83
|
+
export declare function useSessionCapabilities(sessionId: string | null | undefined, options?: UseSessionCapabilitiesOptions): UseSessionCapabilitiesResult;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SessionControlResponse, SessionEvent } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionClientOverride } from "../session-context";
|
|
3
|
+
export type UseSessionControlOptions = EmbeddedSessionClientOverride;
|
|
4
|
+
export type UseSessionControlResult = {
|
|
5
|
+
pause: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
6
|
+
resume: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
7
|
+
controlling: boolean;
|
|
8
|
+
/** Approve a pending `requires_action` approval. */
|
|
9
|
+
approve: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
10
|
+
/** Reject a pending `requires_action` approval. */
|
|
11
|
+
reject: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
12
|
+
/** True while an approval decision is in flight. */
|
|
13
|
+
responding: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
clearError: () => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Session pause/resume and approval decisions. Pair with
|
|
19
|
+
* `useSessionEvents` (for `session.requiresAction` payloads carrying the
|
|
20
|
+
* `approvalId`) to render an approval bar.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSessionControl(sessionId: string | null | undefined, options?: UseSessionControlOptions): UseSessionControlResult;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { SessionEvent, SessionStatus, StreamConnectionState } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionClientOverride } from "../session-context";
|
|
3
|
+
import type { TimelineItem } from "../timeline/types";
|
|
4
|
+
export type SessionEventsConnectionState = StreamConnectionState | "idle" | "ended" | "error";
|
|
5
|
+
export type UseSessionEventsOptions = EmbeddedSessionClientOverride & {
|
|
6
|
+
/** Resume after this sequence (exclusive). Nonzero keeps full replay/resume semantics. */
|
|
7
|
+
after?: number | undefined;
|
|
8
|
+
/** Load a bounded tail by default, or opt back into full replay from `after`. */
|
|
9
|
+
replay?: "windowed" | "full" | undefined;
|
|
10
|
+
/** Pause the stream without unmounting (e.g. hidden tab). Defaults to true. */
|
|
11
|
+
enabled?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type UseSessionEventsResult = {
|
|
14
|
+
/** Replayed + live events, ordered by sequence, no gaps, no duplicates. */
|
|
15
|
+
events: SessionEvent[];
|
|
16
|
+
/** Projected, renderable timeline (memoized over `events`). */
|
|
17
|
+
timeline: TimelineItem[];
|
|
18
|
+
/** Latest session status observed in the event log, if any. */
|
|
19
|
+
sessionStatus: SessionStatus | null;
|
|
20
|
+
connectionState: SessionEventsConnectionState;
|
|
21
|
+
/** Highest sequence seen so far (0 before the first event). */
|
|
22
|
+
lastSequence: number;
|
|
23
|
+
/** Exact serialized bytes retained in the current browser event window. */
|
|
24
|
+
windowBytes: number;
|
|
25
|
+
/** Whether older delivered events were evicted from the browser window. */
|
|
26
|
+
windowTruncated: boolean;
|
|
27
|
+
/** True until the initial tail window has been applied (windowed mode). */
|
|
28
|
+
initialLoading: boolean;
|
|
29
|
+
/** Whether older durable events are available before the current window. */
|
|
30
|
+
hasOlder: boolean;
|
|
31
|
+
/** True while an older window is being fetched. */
|
|
32
|
+
loadingOlder: boolean;
|
|
33
|
+
/** Prepend an older density-bounded window; resolves true when more remain. */
|
|
34
|
+
loadOlder: () => Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Durable events exist after the current window (history view jumped away
|
|
37
|
+
* from the live tip, or a forward page is incomplete).
|
|
38
|
+
*/
|
|
39
|
+
hasNewer: boolean;
|
|
40
|
+
/** True while a newer history page is being fetched. */
|
|
41
|
+
loadingNewer: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Append one density-bounded newer page without pulling the whole gap.
|
|
44
|
+
* Resolves true when more newer history remains.
|
|
45
|
+
*/
|
|
46
|
+
loadNewer: () => Promise<boolean>;
|
|
47
|
+
/** True while replacing the window with the session start. */
|
|
48
|
+
loadingOldest: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Jump to the durable session start: one bounded oldest window, no middle.
|
|
51
|
+
* Leaves live streaming until {@link jumpToLatest} (or loadNewer catches up).
|
|
52
|
+
*/
|
|
53
|
+
loadOldest: () => Promise<boolean>;
|
|
54
|
+
/** True while reloading the live tip window. */
|
|
55
|
+
loadingLatest: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Reload the newest bounded tip and resume live streaming. Use for
|
|
58
|
+
* "Jump to latest" when the tip is not in memory (history view).
|
|
59
|
+
*/
|
|
60
|
+
jumpToLatest: () => Promise<void>;
|
|
61
|
+
error: Error | null;
|
|
62
|
+
};
|
|
63
|
+
export declare const SESSION_EVENT_BROWSER_MAX_BYTES: number;
|
|
64
|
+
export declare const SESSION_EVENT_BROWSER_MAX_COUNT = 10000;
|
|
65
|
+
export declare const SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES: number;
|
|
66
|
+
export declare const SESSION_EVENT_BROWSER_PENDING_MAX_BYTES: number;
|
|
67
|
+
export declare const SESSION_EVENT_BROWSER_PENDING_MAX_COUNT = 256;
|
|
68
|
+
export type BrowserSessionEventWindow = {
|
|
69
|
+
events: SessionEvent[];
|
|
70
|
+
bytes: number;
|
|
71
|
+
truncated: boolean;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Live-stream a session's event log with replay-by-sequence, reconnect, and
|
|
75
|
+
* batched React updates. Fresh loads default to a bounded tail window; pass
|
|
76
|
+
* `replay: "full"` or a nonzero `after` for the previous full replay path.
|
|
77
|
+
*/
|
|
78
|
+
export declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
|
|
79
|
+
/**
|
|
80
|
+
* Keep one direction-aware count+byte-bounded browser window. Live/default
|
|
81
|
+
* accumulation retains the newest suffix; backward paging retains the oldest
|
|
82
|
+
* prefix so newly fetched history cannot be immediately evicted. This is
|
|
83
|
+
* deliberately separate from durable history and transport paging: when a
|
|
84
|
+
* backward page evicts the live tail, the hook reconnects from the retained
|
|
85
|
+
* high-water mark while preserving the highest-ever-observed sequence
|
|
86
|
+
* separately. The source event remains durable in PostgreSQL throughout.
|
|
87
|
+
*/
|
|
88
|
+
export declare function boundBrowserSessionEventWindow(events: readonly SessionEvent[], options?: {
|
|
89
|
+
maxBytes?: number;
|
|
90
|
+
maxCount?: number;
|
|
91
|
+
direction?: "newest" | "oldest";
|
|
92
|
+
}): BrowserSessionEventWindow;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SessionEvent, SessionLineageResponse } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionLineageClientOverride } from "../session-context";
|
|
3
|
+
export type UseSessionLineageOptions = EmbeddedSessionLineageClientOverride & {
|
|
4
|
+
events?: SessionEvent[] | undefined;
|
|
5
|
+
/** Refresh interval (ms). Off by default. */
|
|
6
|
+
pollIntervalMs?: number | undefined;
|
|
7
|
+
enabled?: boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type UseSessionLineageResult = {
|
|
10
|
+
lineage: SessionLineageResponse | null;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
refresh: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export declare function isLineageRefreshEvent(event: SessionEvent): boolean;
|
|
16
|
+
/** Read the ancestors + descendant tree for one session. Data-only; no UI state. */
|
|
17
|
+
export declare function useSessionLineage(sessionId: string | null | undefined, options?: UseSessionLineageOptions): UseSessionLineageResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SessionEvent, SessionMcpApprovalPolicy, SessionMcpServerMetadata, UpdateSessionMcpApprovalPolicyResponse } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionMcpApprovalPolicyClientOverride } from "../session-context";
|
|
3
|
+
import { type SessionEventFeedOptions } from "./internal";
|
|
4
|
+
export declare function isSessionMcpApprovalPolicyEvent(event: Pick<SessionEvent, "type" | "payload">, serverId?: string): boolean;
|
|
5
|
+
export type UseSessionMcpApprovalPolicyOptions = EmbeddedSessionMcpApprovalPolicyClientOverride & SessionEventFeedOptions & {
|
|
6
|
+
/** Optional safety-net polling (ms). Off by default; policy events drive refreshes. */
|
|
7
|
+
pollIntervalMs?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type UseSessionMcpApprovalPolicyResult = {
|
|
10
|
+
server: SessionMcpServerMetadata | null;
|
|
11
|
+
policy: SessionMcpApprovalPolicy | null;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
refresh: () => Promise<void>;
|
|
15
|
+
update: (policy: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResponse | null>;
|
|
16
|
+
updating: boolean;
|
|
17
|
+
clearError: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Read and update one existing session MCP server's approval policy. Updates
|
|
21
|
+
* become effective for the next claimed attempt; current work is unchanged.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSessionMcpApprovalPolicy(sessionId: string | null | undefined, serverId: string | null | undefined, options?: UseSessionMcpApprovalPolicyOptions): UseSessionMcpApprovalPolicyResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Session, SessionEvent } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionReadClientOverride } from "../session-context";
|
|
3
|
+
import { type SessionEventFeedOptions } from "./internal";
|
|
4
|
+
export type UseSessionOptions = EmbeddedSessionReadClientOverride & SessionEventFeedOptions & {
|
|
5
|
+
/** Re-fetch on an interval (ms). Off by default — pair with `useSessionEvents` for live status. */
|
|
6
|
+
pollIntervalMs?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type UseSessionResult = {
|
|
9
|
+
session: Session | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
refresh: () => Promise<void>;
|
|
13
|
+
/** Manually rename the session (PATCH, source='user'). Returns the updated session, or null on failure. */
|
|
14
|
+
updateTitle: (title: string) => Promise<Session | null>;
|
|
15
|
+
/** True while a rename is in flight. */
|
|
16
|
+
updating: boolean;
|
|
17
|
+
mutationError: Error | null;
|
|
18
|
+
clearMutationError: () => void;
|
|
19
|
+
};
|
|
20
|
+
/** Event types that change the session title (auto + cross-client renames). */
|
|
21
|
+
export declare function isTitleEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
22
|
+
/** Fetch one session (with optional polling), live-patching its title on `session.title_set`. */
|
|
23
|
+
export declare function useSession(sessionId: string | null | undefined, options?: UseSessionOptions): UseSessionResult;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { KeyboardEvent } from "react";
|
|
2
|
+
import type { CommandContext, SlashCommand } from "../commands/types";
|
|
3
|
+
/**
|
|
4
|
+
* Context the composer supplies for command execution and visibility. The
|
|
5
|
+
* composer owns the UI affordances (notice/openHelp/clearView/confirm), so they
|
|
6
|
+
* are NOT part of this slice — the hook closes over them via `handlers`.
|
|
7
|
+
*/
|
|
8
|
+
export type SlashCommandContext = Pick<CommandContext, "client" | "workspaceId" | "sessionId" | "status" | "permissions">;
|
|
9
|
+
/**
|
|
10
|
+
* UI affordances the composer supplies. `confirm` differs from the registry-
|
|
11
|
+
* facing {@link CommandContext.confirm} (which takes no args): the composer's
|
|
12
|
+
* confirm receives the command being run so the confirm bar renders from that
|
|
13
|
+
* exact command's identity. The hook bridges the two in {@link buildContext}.
|
|
14
|
+
*/
|
|
15
|
+
export type SlashCommandHandlers = Pick<CommandContext, "notice" | "openHelp" | "clearView"> & {
|
|
16
|
+
confirm: (command: SlashCommand) => Promise<boolean>;
|
|
17
|
+
};
|
|
18
|
+
export type ConfirmState = {
|
|
19
|
+
command: SlashCommand;
|
|
20
|
+
/** Resolve the pending confirm() promise. */
|
|
21
|
+
resolve: (confirmed: boolean) => void;
|
|
22
|
+
} | null;
|
|
23
|
+
export type UseSlashCommandsOptions = {
|
|
24
|
+
commands: readonly SlashCommand[];
|
|
25
|
+
context: SlashCommandContext | undefined;
|
|
26
|
+
handlers: SlashCommandHandlers;
|
|
27
|
+
/** The current composer draft. */
|
|
28
|
+
value: string;
|
|
29
|
+
/** Replace the composer draft (autocomplete writes through this). */
|
|
30
|
+
setValue: (value: string) => void;
|
|
31
|
+
};
|
|
32
|
+
export type UseSlashCommandsResult = {
|
|
33
|
+
/** Whether the palette is open (a command token is being typed). */
|
|
34
|
+
open: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the draft is a slash-command attempt (matches a registered command)
|
|
37
|
+
* — true even after Escape dismisses the popover. The composer blocks its send
|
|
38
|
+
* path while this holds so a command can't be delivered to the agent as chat.
|
|
39
|
+
*/
|
|
40
|
+
isCommandDraft: boolean;
|
|
41
|
+
/** Commands shown for the current token + context, in display order. */
|
|
42
|
+
items: SlashCommand[];
|
|
43
|
+
/** Index into `items` of the highlighted row. */
|
|
44
|
+
highlight: number;
|
|
45
|
+
setHighlight: (index: number) => void;
|
|
46
|
+
/** The matched command once the name is closed by a space (arg-hint mode). */
|
|
47
|
+
activeCommand: SlashCommand | null;
|
|
48
|
+
/** The arg hint string for the active command (footer), or "". */
|
|
49
|
+
activeArgHint: string;
|
|
50
|
+
/**
|
|
51
|
+
* Key handler for the textarea. Returns true when it consumed the event
|
|
52
|
+
* (the composer must then NOT run its send path). Only consumes while open.
|
|
53
|
+
*/
|
|
54
|
+
onKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
55
|
+
/** Run the highlighted command (or the active command in arg-hint mode). */
|
|
56
|
+
runHighlighted: () => Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Run the command at an explicitly chosen index (a pointer click on a row).
|
|
59
|
+
* Bypasses the exact-match token heuristic that runHighlighted uses for
|
|
60
|
+
* keyboard Enter, so an explicit click always runs the clicked command.
|
|
61
|
+
*/
|
|
62
|
+
runAt: (index: number) => Promise<void>;
|
|
63
|
+
/** Autocomplete the highlighted command name + a trailing space. */
|
|
64
|
+
autocompleteHighlighted: () => void;
|
|
65
|
+
};
|
|
66
|
+
export declare function useSlashCommands(options: UseSlashCommandsOptions): UseSlashCommandsResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TerminalCapability } from "@opengeni/sdk";
|
|
2
|
+
/** The ttyd connection lifecycle as surfaced to the component. */
|
|
3
|
+
export type TerminalStreamStatus = "connecting" | "open" | "closed" | "error";
|
|
4
|
+
export type UseTerminalStreamOptions = {
|
|
5
|
+
/** The Terminal cell of the negotiated capabilities (`capabilities.Terminal`).
|
|
6
|
+
* The stream connects ONLY when `transport === "pty-ws"` and `url` is set; on a
|
|
7
|
+
* cold box (`transport === "sse-events"` / no url) it stays idle and the caller
|
|
8
|
+
* falls back to the Channel-A read-only firehose. */
|
|
9
|
+
capability: Pick<TerminalCapability, "transport" | "url" | "token"> | null;
|
|
10
|
+
/** Called for each OUTPUT payload from ttyd (write verbatim into xterm). */
|
|
11
|
+
onOutput?: ((data: string) => void) | undefined;
|
|
12
|
+
/** Called when ttyd sends a SET_WINDOW_TITLE frame. */
|
|
13
|
+
onTitle?: ((title: string) => void) | undefined;
|
|
14
|
+
/** Initial PTY size to seed the ttyd auth frame + first resize. */
|
|
15
|
+
initialCols?: number | undefined;
|
|
16
|
+
initialRows?: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type UseTerminalStreamResult = {
|
|
19
|
+
/** True once the ttyd socket is open (and the auth frame has been sent). */
|
|
20
|
+
connected: boolean;
|
|
21
|
+
status: TerminalStreamStatus;
|
|
22
|
+
/** Pipe a keystroke/paste to the PTY stdin. No-op until the socket is open. */
|
|
23
|
+
write: (data: string) => void;
|
|
24
|
+
/** Tell ttyd the PTY window changed size (on xterm fit/resize). */
|
|
25
|
+
resize: (cols: number, rows: number) => void;
|
|
26
|
+
/** Tear the socket down (the effect also tears down on unmount / url change). */
|
|
27
|
+
disconnect: () => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Drive a ttyd PTY-over-websocket connection from a `pty-ws` Terminal capability,
|
|
31
|
+
* symmetric with `use-desktop-stream` (the noVNC-over-tunnel hook). The scoped
|
|
32
|
+
* stream token is already embedded in the minted tunnel `url`; the WebSocket is
|
|
33
|
+
* opened with the REQUIRED ttyd subprotocol "tty".
|
|
34
|
+
*
|
|
35
|
+
* ttyd wire protocol (see `@opengeni/sdk/terminal`):
|
|
36
|
+
* - first frame: `JSON.stringify({ AuthToken: "" })` (+ optional columns/rows).
|
|
37
|
+
* - client→server: INPUT = "0"+data ; RESIZE = "1"+JSON({columns,rows}).
|
|
38
|
+
* - server→client: "0" = OUTPUT (→ xterm) ; "1" = SET_WINDOW_TITLE ;
|
|
39
|
+
* "2" = SET_PREFERENCES (ignored). Binary frames are decoded the same way.
|
|
40
|
+
*
|
|
41
|
+
* On a `url`/`token` rotation (a box rollover folds a fresh address into the cell)
|
|
42
|
+
* the effect re-runs: the old socket closes and a fresh one connects — a brief
|
|
43
|
+
* terminal blink, acceptable on rollover (mirrors the desktop's RFB hot-swap).
|
|
44
|
+
* SSR-safe: the socket open lives in `useEffect`, so a server render is a no-op.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useTerminalStream(options: UseTerminalStreamOptions): UseTerminalStreamResult;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type TranscriptionAdapter, type TranscriptionDiagnostic, type TranscriptionErrorCode, type TranscriptionEvent, type TranscriptionLifecycleStatus, type TranscriptionPolicyBlockReason, type TranscriptionTargetSelection, type WorkspaceTranscriptionPolicy } from "@opengeni/sdk";
|
|
2
|
+
export type TranscriptionControlState = {
|
|
3
|
+
status: TranscriptionLifecycleStatus;
|
|
4
|
+
generation: number;
|
|
5
|
+
localSessionId: string | null;
|
|
6
|
+
providerSessionId: string | null;
|
|
7
|
+
lastSequence: number;
|
|
8
|
+
partial: string;
|
|
9
|
+
error: {
|
|
10
|
+
code: TranscriptionErrorCode;
|
|
11
|
+
recoverable: boolean;
|
|
12
|
+
} | null;
|
|
13
|
+
acceptedFinalIds: string[];
|
|
14
|
+
audioMilliseconds: number;
|
|
15
|
+
costUsd: number | null;
|
|
16
|
+
};
|
|
17
|
+
export declare const INITIAL_TRANSCRIPTION_CONTROL_STATE: TranscriptionControlState;
|
|
18
|
+
export type TranscriptionControlAction = {
|
|
19
|
+
type: "start";
|
|
20
|
+
generation: number;
|
|
21
|
+
localSessionId: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "event";
|
|
24
|
+
generation: number;
|
|
25
|
+
event: TranscriptionEvent;
|
|
26
|
+
} | {
|
|
27
|
+
type: "start.failed";
|
|
28
|
+
generation: number;
|
|
29
|
+
code: TranscriptionErrorCode;
|
|
30
|
+
} | {
|
|
31
|
+
type: "cancel";
|
|
32
|
+
generation: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: "cancel.settled";
|
|
35
|
+
generation: number;
|
|
36
|
+
} | {
|
|
37
|
+
type: "reset";
|
|
38
|
+
};
|
|
39
|
+
export type TranscriptionControlTransition = {
|
|
40
|
+
state: TranscriptionControlState;
|
|
41
|
+
/** A newly accepted final to append to the current editable draft once. */
|
|
42
|
+
commit: string | null;
|
|
43
|
+
};
|
|
44
|
+
export declare function transitionTranscriptionControl(state: TranscriptionControlState, action: TranscriptionControlAction): TranscriptionControlTransition;
|
|
45
|
+
export declare function appendFinalTranscript(draft: string, transcript: string): string;
|
|
46
|
+
export type UseTranscriptionOptions = {
|
|
47
|
+
adapter: TranscriptionAdapter | null;
|
|
48
|
+
policy: WorkspaceTranscriptionPolicy;
|
|
49
|
+
selection?: TranscriptionTargetSelection | undefined;
|
|
50
|
+
value: string;
|
|
51
|
+
setValue: (value: string) => void;
|
|
52
|
+
focusInput: () => void;
|
|
53
|
+
disabled?: boolean | undefined;
|
|
54
|
+
createLocalSessionId?: (() => string) | undefined;
|
|
55
|
+
lifecycleTimeouts?: Partial<TranscriptionLifecycleTimeouts> | undefined;
|
|
56
|
+
/** Receives bounded, redacted diagnostics; this detail is never rendered by the hook. */
|
|
57
|
+
onDiagnostic?: ((diagnostic: TranscriptionDiagnostic) => void) | undefined;
|
|
58
|
+
};
|
|
59
|
+
export type TranscriptionLifecycleTimeouts = {
|
|
60
|
+
startMs: number;
|
|
61
|
+
cleanupMs: number;
|
|
62
|
+
};
|
|
63
|
+
export type UseTranscriptionResult = {
|
|
64
|
+
state: TranscriptionControlState;
|
|
65
|
+
available: boolean;
|
|
66
|
+
unavailableReason: TranscriptionPolicyBlockReason | "adapter_missing" | "composer_disabled" | null;
|
|
67
|
+
start: () => Promise<boolean>;
|
|
68
|
+
cancel: () => Promise<boolean>;
|
|
69
|
+
reset: () => void;
|
|
70
|
+
};
|
|
71
|
+
export declare function useTranscription({ adapter, policy, selection, value, setValue, focusInput, disabled, createLocalSessionId, lifecycleTimeouts, onDiagnostic, }: UseTranscriptionOptions): UseTranscriptionResult;
|
|
72
|
+
export declare function normalizeTranscriptionErrorCode(code: unknown): TranscriptionErrorCode;
|
|
73
|
+
export declare function sanitizeTranscriptionDiagnostic(diagnostic: unknown): TranscriptionDiagnostic;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ComposerDraft, EffectiveSessionControl, SessionEvent, SessionQueueSnapshot, SessionPendingInputPreview, SessionTurn } from "@opengeni/sdk";
|
|
2
|
+
import { type EmbeddedSessionClientOverride } from "../session-context";
|
|
3
|
+
import { type SessionEventFeedOptions } from "./internal";
|
|
4
|
+
/** Events that can change the authoritative prompt queue or effective control. */
|
|
5
|
+
export declare function isTurnQueueEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
6
|
+
export type QueueMutationKind = "move" | "edit" | "steer" | "delete";
|
|
7
|
+
export type UseTurnQueueOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & {
|
|
8
|
+
pollIntervalMs?: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type UseTurnQueueResult = {
|
|
11
|
+
snapshot: SessionQueueSnapshot | null;
|
|
12
|
+
/** Human/API prompts exactly in server execution order. Never client-sorted. */
|
|
13
|
+
queue: SessionTurn[];
|
|
14
|
+
/** Canonical pending machine inputs. Events only trigger an authoritative refresh. */
|
|
15
|
+
pendingInputs: SessionPendingInputPreview[];
|
|
16
|
+
/** Exact pending members projected to join an already-waiting prompt. */
|
|
17
|
+
pendingInputAttachment: SessionQueueSnapshot["pendingInputAttachment"];
|
|
18
|
+
effectiveControl: EffectiveSessionControl | null;
|
|
19
|
+
/** The latest interrupted attempt has not yet durably proved physical quiescence. */
|
|
20
|
+
stoppingPreviousAttempt: boolean;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
error: Error | null;
|
|
23
|
+
refresh: () => Promise<void>;
|
|
24
|
+
moveTurn: (turnId: string, beforeTurnId: string | null) => Promise<boolean>;
|
|
25
|
+
/** Atomically withdraw a waiting prompt into the private durable composer draft. */
|
|
26
|
+
editTurn: (turnId: string, options: {
|
|
27
|
+
expectedDraftRevision: number;
|
|
28
|
+
replaceDraft: boolean;
|
|
29
|
+
}) => Promise<ComposerDraft | null>;
|
|
30
|
+
/** Advance the same durable waiting prompt; no duplicate prompt is created. */
|
|
31
|
+
steerTurn: (turnId: string) => Promise<boolean>;
|
|
32
|
+
removeTurn: (turnId: string) => Promise<boolean>;
|
|
33
|
+
pendingByTurn: Readonly<Record<string, QueueMutationKind>>;
|
|
34
|
+
mutationFor: (turnId: string) => QueueMutationKind | null;
|
|
35
|
+
mutating: boolean;
|
|
36
|
+
mutationError: Error | null;
|
|
37
|
+
clearMutationError: () => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The one authoritative human prompt queue. Every mutation carries the exact
|
|
41
|
+
* server versions the operator saw and accepts only monotonic snapshots. A
|
|
42
|
+
* conflict immediately reloads server truth; the client never invents order.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useTurnQueue(sessionId: string | null | undefined, options?: UseTurnQueueOptions): UseTurnQueueResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ClientVoiceInputConfig, OpenGeniClient } from "@opengeni/sdk";
|
|
2
|
+
export type VoiceInputStatus = "idle" | "requesting-permission" | "recording" | "transcribing" | "error";
|
|
3
|
+
export type UseVoiceInputOptions = {
|
|
4
|
+
client: Pick<OpenGeniClient, "transcribeAudio"> | null;
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
capability: ClientVoiceInputConfig | null;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
value: string;
|
|
9
|
+
setValue: (value: string) => void;
|
|
10
|
+
focusInput: () => void;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type UseVoiceInputResult = {
|
|
14
|
+
status: VoiceInputStatus;
|
|
15
|
+
error: string | null;
|
|
16
|
+
available: boolean;
|
|
17
|
+
/** Live mic stream while recording; null once stopped/cancelled. */
|
|
18
|
+
stream: MediaStream | null;
|
|
19
|
+
start: () => Promise<boolean>;
|
|
20
|
+
/** Stop capture and immediately upload/transcribe into the draft (no Send). */
|
|
21
|
+
stop: () => void;
|
|
22
|
+
/** Discard the in-flight recording or transcription; Escape also cancels. */
|
|
23
|
+
cancel: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare function useVoiceInput({ client, workspaceId, capability, enabled, value, setValue, focusInput, disabled, }: UseVoiceInputOptions): UseVoiceInputResult;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type WindowRange = {
|
|
2
|
+
/** First mounted index (inclusive). */
|
|
3
|
+
start: number;
|
|
4
|
+
/** One past the last mounted index (exclusive). */
|
|
5
|
+
end: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Pure windowing math: given each section's height (px), the scroll offset, the
|
|
9
|
+
* viewport height, and an overscan count, return the `[start, end)` index window
|
|
10
|
+
* to mount. Robust to a zero viewport (a headless/pre-layout pass) — it then
|
|
11
|
+
* mounts a small overscan window anchored at the item under `scrollTop` rather
|
|
12
|
+
* than the whole list.
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeWindowRange(heights: readonly number[], scrollTop: number, viewport: number, overscan: number): WindowRange;
|
|
15
|
+
export type WindowedSections = {
|
|
16
|
+
/** Attach to the scroll container. */
|
|
17
|
+
scrollRef: React.RefObject<HTMLDivElement | null>;
|
|
18
|
+
/** The mounted window `[start, end)`. */
|
|
19
|
+
range: WindowRange;
|
|
20
|
+
/** Prefix offsets: `offsets[i]` is the top px of section `i`; `offsets[count]`
|
|
21
|
+
* is the total content height. */
|
|
22
|
+
offsets: number[];
|
|
23
|
+
/** Total content height (px) — set on the spacer so scroll length is stable. */
|
|
24
|
+
totalHeight: number;
|
|
25
|
+
/** Report a MOUNTED section's real height (px) so the layout refines as async
|
|
26
|
+
* content — e.g. Pierre's Shiki render — grows. Drive it from a ResizeObserver;
|
|
27
|
+
* a zero/idle value is ignored so a headless pass keeps the estimate. */
|
|
28
|
+
measure: (index: number, height: number) => void;
|
|
29
|
+
/** Scroll section `index` to the top of the pane (the rail-jump). */
|
|
30
|
+
scrollToIndex: (index: number) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Variable-height section windowing over a scroll container. Seeds every section
|
|
34
|
+
* to `estimateHeight(i)`, mounts only `range`, and refines heights from real
|
|
35
|
+
* measurements (a no-op in a zero-layout headless pass, which keeps the estimate
|
|
36
|
+
* — deterministic for tests). Pass a STABLE `estimateHeight` (wrap in useCallback).
|
|
37
|
+
*/
|
|
38
|
+
export declare function useWindowedSections(opts: {
|
|
39
|
+
count: number;
|
|
40
|
+
estimateHeight: (index: number) => number;
|
|
41
|
+
overscan?: number | undefined;
|
|
42
|
+
}): WindowedSections;
|