@opengeni/react 0.15.0 → 0.20.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.
Files changed (101) hide show
  1. package/README.md +110 -10
  2. package/dist/{chunk-TOJR776I.js → chunk-6BXBGJ3B.js} +45 -369
  3. package/dist/chunk-6BXBGJ3B.js.map +1 -0
  4. package/dist/chunk-6UT5OC3P.js +2133 -0
  5. package/dist/chunk-6UT5OC3P.js.map +1 -0
  6. package/dist/chunk-EBTT3MYN.js +92 -0
  7. package/dist/chunk-EBTT3MYN.js.map +1 -0
  8. package/dist/chunk-HHFA4AFX.js +425 -0
  9. package/dist/chunk-HHFA4AFX.js.map +1 -0
  10. package/dist/chunk-LAZ2A743.js +2393 -0
  11. package/dist/chunk-LAZ2A743.js.map +1 -0
  12. package/dist/chunk-MRSECXRP.js +563 -0
  13. package/dist/chunk-MRSECXRP.js.map +1 -0
  14. package/dist/chunk-TK7G6XLT.js +18 -0
  15. package/dist/chunk-TK7G6XLT.js.map +1 -0
  16. package/dist/composer-DvUaa5ki.d.ts +585 -0
  17. package/dist/composer.d.ts +6 -0
  18. package/dist/composer.js +56 -0
  19. package/dist/composer.js.map +1 -0
  20. package/dist/index.d.ts +1288 -1785
  21. package/dist/index.js +7015 -8806
  22. package/dist/index.js.map +1 -1
  23. package/dist/machines.d.ts +412 -3
  24. package/dist/machines.js +3 -1
  25. package/dist/noto-sans-arabic-loader-IA2T4X2A.js +21 -0
  26. package/dist/noto-sans-arabic-loader-IA2T4X2A.js.map +1 -0
  27. package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js +292 -0
  28. package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js.map +1 -0
  29. package/dist/queue-surface-implementation-NQMV2ML3.js +890 -0
  30. package/dist/queue-surface-implementation-NQMV2ML3.js.map +1 -0
  31. package/dist/session-Gd4iVPYw.d.ts +425 -0
  32. package/dist/session-context-DIFFlXKc.d.ts +52 -0
  33. package/dist/session.d.ts +4 -0
  34. package/dist/session.js +50 -0
  35. package/dist/session.js.map +1 -0
  36. package/dist/use-composer-BCfm4mzX.d.ts +112 -0
  37. package/package.json +20 -4
  38. package/src/approvals.ts +5 -3
  39. package/src/client.ts +40 -0
  40. package/src/components/approval-surface.tsx +198 -0
  41. package/src/components/chat-composer.tsx +94 -993
  42. package/src/components/code-editor.tsx +104 -26
  43. package/src/components/command-palette.tsx +8 -2
  44. package/src/components/composer-transcription-control.tsx +211 -0
  45. package/src/components/composer.tsx +1536 -0
  46. package/src/components/desktop-viewer.tsx +3 -3
  47. package/src/components/enrollment-consent.tsx +2 -2
  48. package/src/components/file-browser.tsx +367 -29
  49. package/src/components/human-input-form.tsx +417 -0
  50. package/src/components/machine-card.tsx +1 -1
  51. package/src/components/machines-dashboard.tsx +3 -3
  52. package/src/components/message-timeline.tsx +15 -7
  53. package/src/components/model-picker.tsx +12 -3
  54. package/src/components/pierre-diff.tsx +32 -6
  55. package/src/components/queue-surface-implementation.tsx +1041 -0
  56. package/src/components/queue-surface-state.tsx +94 -0
  57. package/src/components/queue-surface.tsx +41 -559
  58. package/src/components/sandbox-files.tsx +138 -14
  59. package/src/components/sandbox-terminal.tsx +8 -2
  60. package/src/components/sandbox-workspace.tsx +339 -119
  61. package/src/components/workbench-changes.tsx +84 -33
  62. package/src/components/workspace-dock.tsx +188 -18
  63. package/src/composer.ts +60 -0
  64. package/src/hooks/internal.ts +115 -34
  65. package/src/hooks/use-composer.ts +335 -104
  66. package/src/hooks/use-human-input.ts +131 -0
  67. package/src/hooks/use-machine-chip.ts +2 -2
  68. package/src/hooks/use-machines.ts +27 -11
  69. package/src/hooks/use-sandbox-files.ts +310 -62
  70. package/src/hooks/use-sandbox-git.ts +154 -40
  71. package/src/hooks/use-sandbox-terminal.ts +28 -6
  72. package/src/hooks/use-session-capabilities.ts +38 -9
  73. package/src/hooks/use-session-control.ts +37 -8
  74. package/src/hooks/use-session-events.ts +522 -48
  75. package/src/hooks/use-slash-commands.ts +38 -38
  76. package/src/hooks/use-transcription.ts +757 -0
  77. package/src/hooks/use-turn-queue.ts +134 -66
  78. package/src/hooks/use-windowed-sections.ts +2 -2
  79. package/src/hooks/use-workspace-capture.ts +146 -40
  80. package/src/hooks/use-workspace-edit.ts +50 -14
  81. package/src/hooks/use-workspace-sessions.ts +3 -0
  82. package/src/human-input.ts +72 -0
  83. package/src/index.ts +76 -6
  84. package/src/lib/noto-sans-arabic-loader.ts +21 -0
  85. package/src/lib/noto-sans-jp-loader.generated.ts +295 -0
  86. package/src/lib/use-portal-token-style.ts +51 -0
  87. package/src/lib/use-unicode-fonts.ts +57 -0
  88. package/src/provider.tsx +4 -69
  89. package/src/session-context.ts +135 -0
  90. package/src/session.ts +79 -0
  91. package/src/timeline/parsers.ts +35 -0
  92. package/src/timeline/projection.ts +12 -4
  93. package/src/timeline/tool-renderers.tsx +41 -0
  94. package/src/timeline/turn-summary.tsx +2 -2
  95. package/src/timeline/types.ts +16 -8
  96. package/styles/index.css +56 -0
  97. package/styles/index.d.ts +2 -0
  98. package/styles/tokens.css +11 -6
  99. package/styles/tokens.d.ts +2 -0
  100. package/dist/chunk-TOJR776I.js.map +0 -1
  101. package/dist/machines-BpdwuQcD.d.ts +0 -449
@@ -1,449 +0,0 @@
1
- import { OpenGeniClient, WorkspaceControlEvent, StreamConnectionState, MachineState, MetricSample, MachineView, MachineKind, MachinesResponse } from '@opengeni/sdk';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { ReactNode } from 'react';
4
-
5
- /**
6
- * The slice of `OpenGeniClient` the hooks depend on. Structural, so apps can
7
- * pass the real SDK client, a proxy-backed client that routes through their
8
- * own API, or a scripted client in tests/demos.
9
- */
10
- type SessionClientLike = Pick<OpenGeniClient, "getClientConfig" | "getSession" | "getSessionLineage" | "updateSession" | "updateSessionPin" | "listSessions" | "listSessionPage" | "sendMessage" | "steerMessage" | "pauseSession" | "resumeSession" | "sendApprovalDecision" | "listEvents" | "streamEvents" | "getQueue" | "moveQueueItem" | "editQueueItem" | "steerQueueItem" | "deleteQueueItem" | "getComposerDraft" | "saveComposerDraft" | "listTurns" | "getGoal" | "updateGoal" | "deleteGoal" | "clearSessionContext" | "compactSessionContext" | "listScheduledTasks" | "uploadFile" | "getFile" | "createFileDownloadUrl" | "listVariableSets" | "createVariableSet" | "updateVariableSet" | "deleteVariableSet" | "setVariableSetVariable" | "deleteVariableSetVariable" | "listEnvironments" | "createEnvironment" | "updateEnvironment" | "deleteEnvironment" | "setEnvironmentVariable" | "deleteEnvironmentVariable" | "listRigs" | "createRig" | "getRig" | "updateRig" | "deleteRig" | "listRigVersions" | "activateRigVersion" | "listRigChanges" | "proposeRigChange" | "getRigChange" | "verifyRigChange" | "promoteRigChange" | "verifyRig" | "listPacks" | "registerPack" | "enablePack" | "deletePack" | "listWorkspaces" | "createWorkspace" | "updateWorkspace" | "setWorkspaceInferenceState" | "getWorkspace" | "listWorkspaceControlEvents" | "streamWorkspaceControlEvents" | "getBillingUsage" | "getClientConfig" | "getStreamCapabilities" | "acknowledgeStream" | "attachViewer" | "heartbeatViewer" | "detachViewer" | "fsList" | "fsRead" | "fsWrite" | "fsDelete" | "fsMove" | "fsMkdir" | "gitStatus" | "gitDiff" | "getWorkspaceCapture" | "getWorkspaceCaptureFile" | "terminalExec" | "terminalPtyOpen" | "terminalPtyWrite" | "terminalPtyResize" | "terminalPtyClose">;
11
-
12
- type OpenGeniContextValue = {
13
- client: SessionClientLike;
14
- workspaceId: string;
15
- workspaceControlEvent: WorkspaceControlEvent | null;
16
- workspaceControlConnectionState: StreamConnectionState | "idle" | "error";
17
- registerSessionReconciler: (sessionId: string, key: string, reconcile: () => Promise<void>) => () => void;
18
- reconcileSession: (sessionId: string) => Promise<void>;
19
- };
20
- type OpenGeniProviderProps = {
21
- client: SessionClientLike;
22
- workspaceId: string;
23
- onWorkspaceControlEvent?: ((event: WorkspaceControlEvent) => void) | undefined;
24
- children?: ReactNode;
25
- };
26
- /**
27
- * Supplies the OpenGeni client + workspace to all hooks below it. Hooks also
28
- * accept `{ client, workspaceId }` overrides per call for multi-workspace UIs.
29
- */
30
- declare function OpenGeniProvider({ client, workspaceId, onWorkspaceControlEvent, children, }: OpenGeniProviderProps): react_jsx_runtime.JSX.Element;
31
- type ClientOverride = {
32
- client?: SessionClientLike | undefined;
33
- workspaceId?: string | undefined;
34
- };
35
- /** Resolve client + workspace from explicit overrides or the provider. */
36
- declare function useOpenGeni(override?: ClientOverride): OpenGeniContextValue;
37
- /**
38
- * Resolve the client only — for hooks that are not workspace-scoped
39
- * (`useWorkspaces`, `useBillingUsage`).
40
- */
41
- declare function useOpenGeniClient(override?: Pick<ClientOverride, "client">): SessionClientLike;
42
-
43
- /**
44
- * The three connection-status pill values the UI surfaces across the dashboard,
45
- * the dock, and the timeline. `consent_required` / `display_unavailable` /
46
- * `enrolling` are NOT connection states — they map onto a connection state for
47
- * the pill and carry their own badge separately.
48
- */
49
- type ConnectionStatus = "online" | "reconnecting" | "offline";
50
- /** Project a machine `state` onto its connection-status pill value. */
51
- declare function connectionStatusForState(state: MachineState): ConnectionStatus;
52
-
53
- type ConnectionStatusMeta = {
54
- label: string;
55
- dotClassName: string;
56
- badgeClassName: string;
57
- /** Live/transient states breathe; settled states hold still. */
58
- pulse: boolean;
59
- };
60
- /** Token-backed meta for the three connection-status pill values. */
61
- declare const CONNECTION_STATUS_META: Record<ConnectionStatus, ConnectionStatusMeta>;
62
- type MachineStateBadgeMeta = {
63
- label: string;
64
- badgeClassName: string;
65
- };
66
- /**
67
- * The non-connection state badges that ride ALONGSIDE the connection pill —
68
- * `consent_required` / `display_unavailable` / `enrolling` describe a capability
69
- * limitation, not reachability, so they render as their own tinted chip.
70
- */
71
- declare const MACHINE_STATE_BADGE_META: Partial<Record<MachineState, MachineStateBadgeMeta>>;
72
- type ConnectionStatusPillProps = {
73
- status: ConnectionStatus;
74
- /** Override the label ("Online" -> "Connected", ...). */
75
- label?: string | undefined;
76
- size?: "sm" | "md" | undefined;
77
- className?: string | undefined;
78
- };
79
- /**
80
- * The connection-status pill (online / reconnecting / offline) surfaced across
81
- * the Machines dashboard, the dock header, and the session timeline. Reconnecting
82
- * breathes (the resiliency-as-headline blip), online/offline hold still.
83
- */
84
- declare function ConnectionStatusPill({ status, label, size, className, }: ConnectionStatusPillProps): react_jsx_runtime.JSX.Element;
85
- type ConnectionDotProps = {
86
- status: ConnectionStatus;
87
- className?: string | undefined;
88
- };
89
- /** Just the dot — for dense rows, the dock header, and timeline notices. */
90
- declare function ConnectionDot({ status, className }: ConnectionDotProps): react_jsx_runtime.JSX.Element;
91
- type MachineStatusPillProps = {
92
- /** The machine's full state — drives the connection pill + any state badge. */
93
- state: MachineState;
94
- /** How many live sessions share this lease (renders a "Shared" chip when >1). */
95
- sharedSessionCount?: number | undefined;
96
- size?: "sm" | "md" | undefined;
97
- className?: string | undefined;
98
- };
99
- /**
100
- * The composite machine status surface: the connection pill PLUS any
101
- * consent/display/enrolling badge PLUS a shared-in-use chip. One component the
102
- * dashboard row, the dock header, and the timeline all reuse so the status
103
- * language is identical everywhere.
104
- */
105
- declare function MachineStatusPill({ state, sharedSessionCount, size, className, }: MachineStatusPillProps): react_jsx_runtime.JSX.Element;
106
-
107
- type MachineMetricsProps = {
108
- /** The latest metric sample, or null when the machine hasn't reported yet. */
109
- metrics: MetricSample | null;
110
- /** Compact (dashboard row) vs full (the dock detail). */
111
- density?: "compact" | "full" | undefined;
112
- className?: string | undefined;
113
- };
114
- /**
115
- * Per-machine resource meters: CPU%, load average, memory, disk, and GPU when
116
- * present. Renders the M2 `machine_metrics_latest` sample. When `metrics` is
117
- * null the panel shows a quiet "no samples yet" placeholder (offline / just
118
- * enrolled). GPU rows only render when `gpuUtilPct` is non-null.
119
- */
120
- declare function MachineMetrics({ metrics, density, className }: MachineMetricsProps): react_jsx_runtime.JSX.Element;
121
-
122
- type MachineCardProps = {
123
- machine: MachineView;
124
- /** Attach/swap the session's active sandbox to this machine. */
125
- onAttach?: ((machine: MachineView) => void) | undefined;
126
- /** Whether an attach/swap is currently in flight (disables the affordance). */
127
- attaching?: boolean | undefined;
128
- /** Short recent history (e.g. 15m) — drives the card's CPU trend + preview. */
129
- series?: MetricSample[] | undefined;
130
- /** Open the full per-machine telemetry detail. Makes the whole card actionable. */
131
- onOpenDetail?: ((machine: MachineView) => void) | undefined;
132
- now?: number | undefined;
133
- className?: string | undefined;
134
- };
135
- /**
136
- * One machine in the Machines dashboard: name + kind + OS/arch, the fused HEALTH
137
- * verdict, latest resource meters, a CPU trend that previews the history, live
138
- * freshness, and attach/swap. The whole card opens the telemetry detail when
139
- * `onOpenDetail` is wired. The session's active sandbox carries an accent edge.
140
- */
141
- declare function MachineCard({ machine, onAttach, attaching, series, onOpenDetail, now, className, }: MachineCardProps): react_jsx_runtime.JSX.Element;
142
-
143
- type MachineHealthPillProps = {
144
- state: MachineState;
145
- metrics: MetricSample | null;
146
- now?: number | undefined;
147
- size?: "sm" | "md" | undefined;
148
- className?: string | undefined;
149
- };
150
- declare function MachineHealthPill({ state, metrics, now, size, className, }: MachineHealthPillProps): react_jsx_runtime.JSX.Element;
151
-
152
- type HealthLevel = "healthy" | "degraded" | "critical" | "offline" | "unknown";
153
- type HealthVerdict = {
154
- level: HealthLevel;
155
- /** Title-case label for the pill ("Healthy", "Under load", "Critical", …). */
156
- label: string;
157
- /** One short human clause naming the dominant cause ("Memory 94%", "No display"…). */
158
- reason: string;
159
- /** The latest sample is older than we'd expect from a live agent (~5s cadence). */
160
- stale: boolean;
161
- };
162
- /** Fold a machine's reachability + latest sample + wall-clock into one verdict. */
163
- declare function deriveHealth(state: MachineState, metrics: MetricSample | null, now?: number): HealthVerdict;
164
- /**
165
- * The token color ramp for a health level. Green/amber/red/grey is the
166
- * universally-legible traffic model; we reserve it for the HEALTH verdict
167
- * specifically (per-resource meters keep their own ramp in `machine-metrics`).
168
- */
169
- declare const HEALTH_TOKEN: Record<HealthLevel, {
170
- text: string;
171
- dot: string;
172
- soft: string;
173
- }>;
174
- /** Live/transient levels breathe; settled levels hold still. */
175
- declare function healthPulses(level: HealthLevel): boolean;
176
-
177
- type SeriesPoint = {
178
- t: number;
179
- v: number | null;
180
- };
181
- type MetricHistoryChartProps = {
182
- points: SeriesPoint[];
183
- /** Fixed ceiling (100 for %) or "auto" to fit the data with headroom. */
184
- yMax?: number | "auto";
185
- yMin?: number;
186
- /** Format a value for the axis + readout (default: rounded + unit). */
187
- format?: (v: number) => string;
188
- unit?: string;
189
- /** Stroke/fill hue — any CSS color; pass a token var to stay theme-safe. */
190
- color?: string;
191
- thresholds?: {
192
- warn?: number | undefined;
193
- crit?: number | undefined;
194
- } | undefined;
195
- height?: number;
196
- /** Human range label for the empty state ("in the last hour"). */
197
- rangeLabel?: string | undefined;
198
- className?: string | undefined;
199
- };
200
- declare function MetricHistoryChart({ points, yMax, yMin, format, unit, color, thresholds, height, rangeLabel, className, }: MetricHistoryChartProps): react_jsx_runtime.JSX.Element;
201
-
202
- type MetricSparklineProps = {
203
- points: SeriesPoint[];
204
- color?: string;
205
- yMax?: number | "auto";
206
- height?: number;
207
- className?: string | undefined;
208
- };
209
- declare function MetricSparkline({ points, color, yMax, height, className, }: MetricSparklineProps): react_jsx_runtime.JSX.Element;
210
-
211
- type MetricWindow = "15m" | "1h" | "6h" | "24h";
212
- declare const METRIC_WINDOWS: MetricWindow[];
213
- declare const WINDOW_LABEL: Record<MetricWindow, string>;
214
- type MetricKey = "cpu" | "mem" | "disk" | "load" | "gpu";
215
- type MetricDef = {
216
- key: MetricKey;
217
- title: string;
218
- unit: string;
219
- yMax: number | "auto";
220
- color: string;
221
- thresholds?: {
222
- warn?: number;
223
- crit?: number;
224
- };
225
- pick: (s: MetricSample) => number | null;
226
- /** Big current-value string for tiles/badges. */
227
- current: (s: MetricSample) => string;
228
- /** Optional sub-line under the current value. */
229
- sub?: (s: MetricSample) => string | null;
230
- };
231
- declare const METRICS: MetricDef[];
232
- declare function pointsFor(def: MetricDef, samples: MetricSample[]): SeriesPoint[];
233
-
234
- type MachineDetailProps = {
235
- machine: MachineView;
236
- /** Downsampled history for the active window (from `fetchSeries`). */
237
- series: MetricSample[];
238
- window: MetricWindow;
239
- onWindowChange: (w: MetricWindow) => void;
240
- loadingSeries?: boolean | undefined;
241
- onBack?: (() => void) | undefined;
242
- now?: number | undefined;
243
- className?: string | undefined;
244
- };
245
- declare function MachineDetail({ machine, series, window, onWindowChange, loadingSeries, onBack, now, className, }: MachineDetailProps): react_jsx_runtime.JSX.Element;
246
-
247
- type MachinesDashboardProps = {
248
- machines: MachineView[];
249
- /** The session's active sandbox id (drives the per-card "Active" marker). */
250
- activeSandboxId?: string | null | undefined;
251
- loading?: boolean | undefined;
252
- error?: Error | null | undefined;
253
- /** Attach/swap the session's active sandbox to a machine. */
254
- onAttach?: ((machine: MachineView) => void) | undefined;
255
- /** The sandbox id currently being attached/swapped to (disables that card). */
256
- attachingSandboxId?: string | null | undefined;
257
- /** Short recent history per machine (keyed by sandboxId) — drives card sparklines. */
258
- seriesByMachine?: Record<string, MetricSample[]> | undefined;
259
- /** Open the per-machine telemetry detail (makes each card actionable). */
260
- onOpenDetail?: ((machine: MachineView) => void) | undefined;
261
- /** Shared clock so freshness/relative times render consistently across cards. */
262
- now?: number | undefined;
263
- /** Open the enrollment flow (the "Enroll a machine" CTA). */
264
- onEnroll?: (() => void) | undefined;
265
- onRefresh?: (() => void) | undefined;
266
- className?: string | undefined;
267
- };
268
- /**
269
- * The workspace Machines dashboard: the fleet of selfhosted enrollments + the
270
- * session's managed sandbox, each with its connection-status pill, state badges,
271
- * latest metrics, and an attach/swap affordance. Renders the empty state (no
272
- * machines → enroll CTA), a load error, and the populated grid. The component
273
- * is purely presentational — feed it `MachinesResponse` data via `useMachines`.
274
- */
275
- declare function MachinesDashboard({ machines, activeSandboxId, loading, error, onAttach, attachingSandboxId, seriesByMachine, onOpenDetail, now, onEnroll, onRefresh, className, }: MachinesDashboardProps): react_jsx_runtime.JSX.Element;
276
-
277
- type MachineDockBarProps = {
278
- /** The active machine's display name. */
279
- name: string;
280
- kind: MachineKind;
281
- state: MachineState;
282
- /** Live sessions sharing this whole-machine lease (>1 ⇒ shared disclosure). */
283
- sharedSessionCount?: number | undefined;
284
- className?: string | undefined;
285
- };
286
- /**
287
- * A slim bar that surfaces WHICH machine the dock surfaces (Files/Terminal/
288
- * Desktop) are bound to + its connection status. Mounted above the dock tabs so
289
- * the user always knows whether they are looking at the Modal box or their own
290
- * machine, and whether it is online / reconnecting / offline. The surfaces below
291
- * render IDENTICALLY regardless of backend — this bar is the only backend-aware
292
- * chrome (the dock-parity contract: selfhosted == Modal for the surfaces).
293
- */
294
- declare function MachineDockBar({ name, kind, state, className }: MachineDockBarProps): react_jsx_runtime.JSX.Element;
295
- type SharedMachineDisclosureProps = {
296
- sharedSessionCount: number;
297
- /** Compact (inline strip) vs full (a notice block). */
298
- density?: "compact" | "full" | undefined;
299
- className?: string | undefined;
300
- };
301
- /**
302
- * The "shared — another session is on this machine" disclosure. Surfaced in the
303
- * dock (and reused on the desktop take-control gate) so the user knows others are
304
- * driving the same whole-machine lease. Render when `sharedSessionCount > 1`.
305
- */
306
- declare function SharedMachineDisclosure({ sharedSessionCount, density, className, }: SharedMachineDisclosureProps): react_jsx_runtime.JSX.Element;
307
-
308
- /** The poll state of an in-flight device-flow enrollment. */
309
- type DeviceFlowPhase = "pending" | "authorized" | "denied" | "expired" | "disabled";
310
- type EnrollmentDeviceFlowProps = {
311
- /** The short user code the agent printed (shown big for the human to confirm). */
312
- userCode: string;
313
- /** Where the user approves — the same-origin device page. */
314
- verificationUri: string;
315
- /** The complete URI (code pre-filled) for a one-click / QR open. */
316
- verificationUriComplete?: string | undefined;
317
- /** The install one-liner the user ran (echoed for context). Optional. */
318
- installCommand?: string | undefined;
319
- phase?: DeviceFlowPhase | undefined;
320
- /** Seconds remaining before the code expires (drives a quiet countdown). */
321
- expiresInSeconds?: number | undefined;
322
- onCopyCode?: (() => void) | undefined;
323
- onCopyInstall?: (() => void) | undefined;
324
- onOpenVerification?: (() => void) | undefined;
325
- className?: string | undefined;
326
- };
327
- /**
328
- * The IN-SESSION device-flow panel: the agent (after the install one-liner) prints
329
- * a short `userCode` + a `verificationUri`; this surfaces them so the user can open
330
- * the approve page and confirm the code. Polls in the caller; this renders the
331
- * pending → authorized/denied/expired progression with a connection pill. This is
332
- * the FIRST step of the IA flow (device-flow → Machines list → attach/swap).
333
- */
334
- declare function EnrollmentDeviceFlow({ userCode, verificationUri, verificationUriComplete, installCommand, phase, expiresInSeconds, onCopyCode, onCopyInstall, onOpenVerification, className, }: EnrollmentDeviceFlowProps): react_jsx_runtime.JSX.Element;
335
-
336
- /** The machine identity surfaced to the approver, from the device-flow start. */
337
- type EnrollmentConsentMachine = {
338
- /** Human-friendly name (hostname by default). */
339
- machineName: string;
340
- os: string;
341
- arch: string;
342
- /** The agent can offer a display (a real screen / Xvfb is available). */
343
- canOfferDisplay: boolean;
344
- /** The agent requests screen control (computer-use). */
345
- requestsScreenControl: boolean;
346
- };
347
- /** The phase of the approve page (drives the rendered panel). */
348
- type EnrollmentConsentPhase = "review" | "approving" | "approved" | "denied" | "error";
349
- type EnrollmentConsentProps = {
350
- /** The short code the user typed / scanned (echoed back for confirmation). */
351
- userCode: string;
352
- machine: EnrollmentConsentMachine;
353
- phase?: EnrollmentConsentPhase | undefined;
354
- /** Approve with the chosen screen-control consent. */
355
- onApprove?: ((allowScreenControl: boolean) => void) | undefined;
356
- onDeny?: (() => void) | undefined;
357
- /** Error message when phase === "error". */
358
- errorMessage?: string | undefined;
359
- className?: string | undefined;
360
- };
361
- /**
362
- * The user-facing APPROVE page for the device-flow enrollment: a LOUD,
363
- * un-minimised whole-machine consent. Approving grants the agent FULL access to
364
- * this machine — exec, files, terminal — and (when toggled) live screen control.
365
- * The danger framing is deliberate (§18 hardening: whole-machine = loud consent),
366
- * never buried. Renders review / approving / approved / denied / error phases.
367
- */
368
- declare function EnrollmentConsent({ userCode, machine, phase, onApprove, onDeny, errorMessage, className, }: EnrollmentConsentProps): react_jsx_runtime.JSX.Element;
369
-
370
- /**
371
- * The slice of the SDK client the Machines surface needs. The method NAMES +
372
- * SIGNATURES match M10's `OpenGeniClient` (`listMachines`, `machineMetricsSeries`)
373
- * so the real SDK client satisfies this surface DIRECTLY for the read paths — no
374
- * adapter needed. It is declared structurally (not a hard `OpenGeniClient` Pick)
375
- * so a test/demo/Geni-frontend client can stand in, keeping the hook dual-consumer
376
- * safe (works in apps/web AND the separate Geni frontend).
377
- *
378
- * The active-sandbox SWAP is now a typed SDK call (`swapActiveSandbox`, the M7
379
- * user-authenticated REST equivalent of the `sandbox_swap` MCP tool). The real
380
- * SDK client satisfies it structurally, so the default attach path is wired
381
- * WHENEVER a sessionId is in scope (the swap is session-scoped). `attachMachine`
382
- * stays an OPTIONAL escape hatch for a host that wants to supply its own swap
383
- * adapter; when neither it nor a sessionId is present, attach is a no-op and the
384
- * card hides the button.
385
- */
386
- type MachinesClientLike = {
387
- /** GET /v1/workspaces/:ws/machines — the dashboard list + active pointer. */
388
- listMachines: (workspaceId: string, options?: {
389
- sessionId?: string;
390
- }) => Promise<MachinesResponse>;
391
- /** GET .../machines/:enrollmentId/metrics/series — the downsampled history. */
392
- machineMetricsSeries?: (workspaceId: string, enrollmentId: string, options?: {
393
- window?: "15m" | "1h" | "6h" | "24h";
394
- }) => Promise<MetricSample[]>;
395
- /**
396
- * POST .../sessions/:sessionId/active-sandbox — swap the session's active
397
- * sandbox to a machine. The default swap path; the real SDK client provides it.
398
- */
399
- swapActiveSandbox?: (workspaceId: string, sessionId: string, request: {
400
- target: string;
401
- }) => Promise<unknown>;
402
- /**
403
- * Host-supplied swap adapter (an escape hatch). When present it wins over the
404
- * default `swapActiveSandbox` path. Session-scoped, like the swap it backs.
405
- */
406
- attachMachine?: (workspaceId: string, sessionId: string, sandboxId: string) => Promise<unknown>;
407
- };
408
- type UseMachinesOptions = ClientOverride & {
409
- pollIntervalMs?: number | undefined;
410
- enabled?: boolean | undefined;
411
- /** Scope the list to a session (adds the synthetic Modal group box + pointer). */
412
- sessionId?: string | undefined;
413
- /**
414
- * Override the client with one implementing `MachinesClientLike`. Defaults to
415
- * the provider client cast to the surface (the real SDK client satisfies the
416
- * read paths). An app supplies an adapter to wire `attachMachine` (the swap).
417
- */
418
- machinesClient?: MachinesClientLike | undefined;
419
- };
420
- type UseMachinesResult = {
421
- machines: MachineView[];
422
- activeSandboxId: string | null;
423
- activeEpoch: number;
424
- loading: boolean;
425
- error: Error | null;
426
- refresh: () => Promise<void>;
427
- /** Attach/swap the session's active sandbox to a machine (returns the new pointer). */
428
- attach: (sandboxId: string) => Promise<boolean>;
429
- /** Whether the host wired an attach/swap path (drives the card affordance). */
430
- canAttach: boolean;
431
- /** Fetch a downsampled metric series for one enrolled machine. */
432
- fetchSeries: (enrollmentId: string, window?: "15m" | "1h" | "6h" | "24h") => Promise<MetricSample[]>;
433
- attaching: boolean;
434
- /** The sandbox id of the in-flight attach (for per-card spinner gating). */
435
- attachingSandboxId: string | null;
436
- mutationError: Error | null;
437
- clearMutationError: () => void;
438
- };
439
- /**
440
- * The workspace Machines fleet: the selfhosted enrollments + the session's Modal
441
- * box, each with latest metrics + state, plus the active-sandbox pointer. Polls
442
- * the M10 `GET /machines` endpoint and exposes attach/swap + a metric-series
443
- * fetch. Renders via `<MachinesDashboard>`. Dual-consumer safe: it reads only the
444
- * structural `MachinesClientLike` surface, so it works in apps/web AND the Geni
445
- * frontend (each provides its own client/adapter).
446
- */
447
- declare function useMachines(options?: UseMachinesOptions): UseMachinesResult;
448
-
449
- export { WINDOW_LABEL as $, type MachineStateBadgeMeta as A, MachineStatusPill as B, type ClientOverride as C, type DeviceFlowPhase as D, EnrollmentConsent as E, type MachineStatusPillProps as F, type MachinesClientLike as G, HEALTH_TOKEN as H, MachinesDashboard as I, type MachinesDashboardProps as J, type MetricDef as K, MetricHistoryChart as L, MACHINE_STATE_BADGE_META as M, type MetricHistoryChartProps as N, type MetricKey as O, MetricSparkline as P, type MetricSparklineProps as Q, type MetricWindow as R, type SessionClientLike as S, type OpenGeniContextValue as T, OpenGeniProvider as U, type OpenGeniProviderProps as V, type SeriesPoint as W, SharedMachineDisclosure as X, type SharedMachineDisclosureProps as Y, type UseMachinesOptions as Z, type UseMachinesResult as _, CONNECTION_STATUS_META as a, connectionStatusForState as a0, deriveHealth as a1, healthPulses as a2, pointsFor as a3, useMachines as a4, useOpenGeni as a5, useOpenGeniClient as a6, ConnectionDot as b, type ConnectionDotProps as c, type ConnectionStatus as d, type ConnectionStatusMeta as e, ConnectionStatusPill as f, type ConnectionStatusPillProps as g, type EnrollmentConsentMachine as h, type EnrollmentConsentPhase as i, type EnrollmentConsentProps as j, EnrollmentDeviceFlow as k, type EnrollmentDeviceFlowProps as l, type HealthLevel as m, type HealthVerdict as n, METRICS as o, METRIC_WINDOWS as p, MachineCard as q, type MachineCardProps as r, MachineDetail as s, type MachineDetailProps as t, MachineDockBar as u, type MachineDockBarProps as v, MachineHealthPill as w, type MachineHealthPillProps as x, MachineMetrics as y, type MachineMetricsProps as z };