@opengeni/react 0.13.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.
- package/README.md +129 -23
- package/dist/chunk-6BXBGJ3B.js +1956 -0
- package/dist/chunk-6BXBGJ3B.js.map +1 -0
- package/dist/chunk-6UT5OC3P.js +2133 -0
- package/dist/chunk-6UT5OC3P.js.map +1 -0
- package/dist/chunk-EBTT3MYN.js +92 -0
- package/dist/chunk-EBTT3MYN.js.map +1 -0
- package/dist/chunk-HHFA4AFX.js +425 -0
- package/dist/chunk-HHFA4AFX.js.map +1 -0
- package/dist/chunk-LAZ2A743.js +2393 -0
- package/dist/chunk-LAZ2A743.js.map +1 -0
- package/dist/chunk-MRSECXRP.js +563 -0
- package/dist/chunk-MRSECXRP.js.map +1 -0
- package/dist/chunk-TK7G6XLT.js +18 -0
- package/dist/chunk-TK7G6XLT.js.map +1 -0
- package/dist/composer-DvUaa5ki.d.ts +585 -0
- package/dist/composer.d.ts +6 -0
- package/dist/composer.js +56 -0
- package/dist/composer.js.map +1 -0
- package/dist/index.d.ts +642 -1080
- package/dist/index.js +7672 -8005
- package/dist/index.js.map +1 -1
- package/dist/machines.d.ts +412 -3
- package/dist/machines.js +25 -1
- package/dist/noto-sans-arabic-loader-IA2T4X2A.js +21 -0
- package/dist/noto-sans-arabic-loader-IA2T4X2A.js.map +1 -0
- package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js +292 -0
- package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js.map +1 -0
- package/dist/queue-surface-implementation-NQMV2ML3.js +890 -0
- package/dist/queue-surface-implementation-NQMV2ML3.js.map +1 -0
- package/dist/session-Gd4iVPYw.d.ts +425 -0
- package/dist/session-context-DIFFlXKc.d.ts +52 -0
- package/dist/session.d.ts +4 -0
- package/dist/session.js +50 -0
- package/dist/session.js.map +1 -0
- package/dist/use-composer-BCfm4mzX.d.ts +112 -0
- package/package.json +23 -4
- package/src/approvals.ts +5 -3
- package/src/client.ts +50 -1
- package/src/components/approval-surface.tsx +198 -0
- package/src/components/chat-composer.tsx +104 -751
- package/src/components/code-editor.tsx +104 -26
- package/src/components/command-palette.tsx +8 -2
- package/src/components/composer-transcription-control.tsx +211 -0
- package/src/components/composer.tsx +1536 -0
- package/src/components/desktop-viewer.tsx +3 -3
- package/src/components/enrollment-consent.tsx +2 -2
- package/src/components/file-browser.tsx +367 -29
- package/src/components/human-input-form.tsx +417 -0
- package/src/components/machine-card.tsx +82 -16
- package/src/components/machine-health-pill.tsx +68 -0
- package/src/components/machine-metrics.tsx +10 -24
- package/src/components/machines/health.ts +146 -0
- package/src/components/machines/machine-detail.tsx +220 -0
- package/src/components/machines/metric-history-chart.tsx +298 -0
- package/src/components/machines/metric-sparkline.tsx +76 -0
- package/src/components/machines/series.ts +113 -0
- package/src/components/machines-dashboard.tsx +16 -4
- package/src/components/message-timeline.tsx +15 -7
- package/src/components/model-picker.tsx +12 -3
- package/src/components/pierre-diff.tsx +32 -6
- package/src/components/queue-surface-implementation.tsx +1041 -0
- package/src/components/queue-surface-state.tsx +94 -0
- package/src/components/queue-surface.tsx +60 -0
- package/src/components/sandbox-files.tsx +230 -21
- package/src/components/sandbox-terminal.tsx +8 -2
- package/src/components/sandbox-workspace.tsx +489 -135
- package/src/components/session-status.tsx +0 -6
- package/src/components/workbench-changes.tsx +145 -50
- package/src/components/workspace-dock.tsx +329 -68
- package/src/composer.ts +60 -0
- package/src/hooks/internal.ts +115 -34
- package/src/hooks/use-composer.ts +635 -74
- package/src/hooks/use-human-input.ts +131 -0
- package/src/hooks/use-machine-chip.ts +2 -2
- package/src/hooks/use-machines.ts +27 -11
- package/src/hooks/use-sandbox-files.ts +310 -62
- package/src/hooks/use-sandbox-git.ts +154 -40
- package/src/hooks/use-sandbox-terminal.ts +28 -6
- package/src/hooks/use-session-capabilities.ts +38 -9
- package/src/hooks/use-session-control.ts +43 -15
- package/src/hooks/use-session-events.ts +523 -48
- package/src/hooks/use-session-lineage.ts +15 -6
- package/src/hooks/use-session.ts +10 -2
- package/src/hooks/use-slash-commands.ts +38 -38
- package/src/hooks/use-transcription.ts +757 -0
- package/src/hooks/use-turn-queue.ts +273 -77
- package/src/hooks/use-windowed-sections.ts +2 -2
- package/src/hooks/use-workspace-capture.ts +146 -40
- package/src/hooks/use-workspace-edit.ts +50 -14
- package/src/hooks/use-workspace-sessions.ts +3 -0
- package/src/human-input.ts +72 -0
- package/src/index.ts +88 -12
- package/src/lib/noto-sans-arabic-loader.ts +21 -0
- package/src/lib/noto-sans-jp-loader.generated.ts +295 -0
- package/src/lib/use-portal-token-style.ts +51 -0
- package/src/lib/use-unicode-fonts.ts +57 -0
- package/src/machines.ts +16 -0
- package/src/provider.tsx +163 -41
- package/src/session-context.ts +135 -0
- package/src/session.ts +79 -0
- package/src/timeline/parsers.ts +78 -6
- package/src/timeline/projection.ts +36 -6
- package/src/timeline/tool-renderers.tsx +41 -0
- package/src/timeline/turn-summary.tsx +2 -2
- package/src/timeline/types.ts +16 -8
- package/styles/index.css +78 -0
- package/styles/index.d.ts +2 -0
- package/styles/tokens.css +11 -6
- package/styles/tokens.d.ts +2 -0
- package/dist/chunk-NFYVQWIB.js +0 -1377
- package/dist/chunk-NFYVQWIB.js.map +0 -1
- package/dist/machines-CnlMb7E-.d.ts +0 -329
package/dist/machines.d.ts
CHANGED
|
@@ -1,4 +1,413 @@
|
|
|
1
|
-
|
|
1
|
+
import { MachineState, MetricSample, MachineView, MachineKind, MachinesResponse } from '@opengeni/sdk';
|
|
2
2
|
export { MachineKind, MachineMetricsSeriesResponse, MachineState, MachineView, MachinesResponse, MetricSample } from '@opengeni/sdk';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import '
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { C as ClientOverride } from './session-context-DIFFlXKc.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The three connection-status pill values the UI surfaces across the dashboard,
|
|
8
|
+
* the dock, and the timeline. `consent_required` / `display_unavailable` /
|
|
9
|
+
* `enrolling` are NOT connection states — they map onto a connection state for
|
|
10
|
+
* the pill and carry their own badge separately.
|
|
11
|
+
*/
|
|
12
|
+
type ConnectionStatus = "online" | "reconnecting" | "offline";
|
|
13
|
+
/** Project a machine `state` onto its connection-status pill value. */
|
|
14
|
+
declare function connectionStatusForState(state: MachineState): ConnectionStatus;
|
|
15
|
+
|
|
16
|
+
type ConnectionStatusMeta = {
|
|
17
|
+
label: string;
|
|
18
|
+
dotClassName: string;
|
|
19
|
+
badgeClassName: string;
|
|
20
|
+
/** Live/transient states breathe; settled states hold still. */
|
|
21
|
+
pulse: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** Token-backed meta for the three connection-status pill values. */
|
|
24
|
+
declare const CONNECTION_STATUS_META: Record<ConnectionStatus, ConnectionStatusMeta>;
|
|
25
|
+
type MachineStateBadgeMeta = {
|
|
26
|
+
label: string;
|
|
27
|
+
badgeClassName: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The non-connection state badges that ride ALONGSIDE the connection pill —
|
|
31
|
+
* `consent_required` / `display_unavailable` / `enrolling` describe a capability
|
|
32
|
+
* limitation, not reachability, so they render as their own tinted chip.
|
|
33
|
+
*/
|
|
34
|
+
declare const MACHINE_STATE_BADGE_META: Partial<Record<MachineState, MachineStateBadgeMeta>>;
|
|
35
|
+
type ConnectionStatusPillProps = {
|
|
36
|
+
status: ConnectionStatus;
|
|
37
|
+
/** Override the label ("Online" -> "Connected", ...). */
|
|
38
|
+
label?: string | undefined;
|
|
39
|
+
size?: "sm" | "md" | undefined;
|
|
40
|
+
className?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The connection-status pill (online / reconnecting / offline) surfaced across
|
|
44
|
+
* the Machines dashboard, the dock header, and the session timeline. Reconnecting
|
|
45
|
+
* breathes (the resiliency-as-headline blip), online/offline hold still.
|
|
46
|
+
*/
|
|
47
|
+
declare function ConnectionStatusPill({ status, label, size, className, }: ConnectionStatusPillProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
type ConnectionDotProps = {
|
|
49
|
+
status: ConnectionStatus;
|
|
50
|
+
className?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
/** Just the dot — for dense rows, the dock header, and timeline notices. */
|
|
53
|
+
declare function ConnectionDot({ status, className }: ConnectionDotProps): react_jsx_runtime.JSX.Element;
|
|
54
|
+
type MachineStatusPillProps = {
|
|
55
|
+
/** The machine's full state — drives the connection pill + any state badge. */
|
|
56
|
+
state: MachineState;
|
|
57
|
+
/** How many live sessions share this lease (renders a "Shared" chip when >1). */
|
|
58
|
+
sharedSessionCount?: number | undefined;
|
|
59
|
+
size?: "sm" | "md" | undefined;
|
|
60
|
+
className?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The composite machine status surface: the connection pill PLUS any
|
|
64
|
+
* consent/display/enrolling badge PLUS a shared-in-use chip. One component the
|
|
65
|
+
* dashboard row, the dock header, and the timeline all reuse so the status
|
|
66
|
+
* language is identical everywhere.
|
|
67
|
+
*/
|
|
68
|
+
declare function MachineStatusPill({ state, sharedSessionCount, size, className, }: MachineStatusPillProps): react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
70
|
+
type MachineMetricsProps = {
|
|
71
|
+
/** The latest metric sample, or null when the machine hasn't reported yet. */
|
|
72
|
+
metrics: MetricSample | null;
|
|
73
|
+
/** Compact (dashboard row) vs full (the dock detail). */
|
|
74
|
+
density?: "compact" | "full" | undefined;
|
|
75
|
+
className?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Per-machine resource meters: CPU%, load average, memory, disk, and GPU when
|
|
79
|
+
* present. Renders the M2 `machine_metrics_latest` sample. When `metrics` is
|
|
80
|
+
* null the panel shows a quiet "no samples yet" placeholder (offline / just
|
|
81
|
+
* enrolled). GPU rows only render when `gpuUtilPct` is non-null.
|
|
82
|
+
*/
|
|
83
|
+
declare function MachineMetrics({ metrics, density, className }: MachineMetricsProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
|
|
85
|
+
type MachineCardProps = {
|
|
86
|
+
machine: MachineView;
|
|
87
|
+
/** Attach/swap the session's active sandbox to this machine. */
|
|
88
|
+
onAttach?: ((machine: MachineView) => void) | undefined;
|
|
89
|
+
/** Whether an attach/swap is currently in flight (disables the affordance). */
|
|
90
|
+
attaching?: boolean | undefined;
|
|
91
|
+
/** Short recent history (e.g. 15m) — drives the card's CPU trend + preview. */
|
|
92
|
+
series?: MetricSample[] | undefined;
|
|
93
|
+
/** Open the full per-machine telemetry detail. Makes the whole card actionable. */
|
|
94
|
+
onOpenDetail?: ((machine: MachineView) => void) | undefined;
|
|
95
|
+
now?: number | undefined;
|
|
96
|
+
className?: string | undefined;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* One machine in the Machines dashboard: name + kind + OS/arch, the fused HEALTH
|
|
100
|
+
* verdict, latest resource meters, a CPU trend that previews the history, live
|
|
101
|
+
* freshness, and attach/swap. The whole card opens the telemetry detail when
|
|
102
|
+
* `onOpenDetail` is wired. The session's active sandbox carries an accent edge.
|
|
103
|
+
*/
|
|
104
|
+
declare function MachineCard({ machine, onAttach, attaching, series, onOpenDetail, now, className, }: MachineCardProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
|
|
106
|
+
type MachineHealthPillProps = {
|
|
107
|
+
state: MachineState;
|
|
108
|
+
metrics: MetricSample | null;
|
|
109
|
+
now?: number | undefined;
|
|
110
|
+
size?: "sm" | "md" | undefined;
|
|
111
|
+
className?: string | undefined;
|
|
112
|
+
};
|
|
113
|
+
declare function MachineHealthPill({ state, metrics, now, size, className, }: MachineHealthPillProps): react_jsx_runtime.JSX.Element;
|
|
114
|
+
|
|
115
|
+
type HealthLevel = "healthy" | "degraded" | "critical" | "offline" | "unknown";
|
|
116
|
+
type HealthVerdict = {
|
|
117
|
+
level: HealthLevel;
|
|
118
|
+
/** Title-case label for the pill ("Healthy", "Under load", "Critical", …). */
|
|
119
|
+
label: string;
|
|
120
|
+
/** One short human clause naming the dominant cause ("Memory 94%", "No display"…). */
|
|
121
|
+
reason: string;
|
|
122
|
+
/** The latest sample is older than we'd expect from a live agent (~5s cadence). */
|
|
123
|
+
stale: boolean;
|
|
124
|
+
};
|
|
125
|
+
/** Fold a machine's reachability + latest sample + wall-clock into one verdict. */
|
|
126
|
+
declare function deriveHealth(state: MachineState, metrics: MetricSample | null, now?: number): HealthVerdict;
|
|
127
|
+
/**
|
|
128
|
+
* The token color ramp for a health level. Green/amber/red/grey is the
|
|
129
|
+
* universally-legible traffic model; we reserve it for the HEALTH verdict
|
|
130
|
+
* specifically (per-resource meters keep their own ramp in `machine-metrics`).
|
|
131
|
+
*/
|
|
132
|
+
declare const HEALTH_TOKEN: Record<HealthLevel, {
|
|
133
|
+
text: string;
|
|
134
|
+
dot: string;
|
|
135
|
+
soft: string;
|
|
136
|
+
}>;
|
|
137
|
+
/** Live/transient levels breathe; settled levels hold still. */
|
|
138
|
+
declare function healthPulses(level: HealthLevel): boolean;
|
|
139
|
+
|
|
140
|
+
type SeriesPoint = {
|
|
141
|
+
t: number;
|
|
142
|
+
v: number | null;
|
|
143
|
+
};
|
|
144
|
+
type MetricHistoryChartProps = {
|
|
145
|
+
points: SeriesPoint[];
|
|
146
|
+
/** Fixed ceiling (100 for %) or "auto" to fit the data with headroom. */
|
|
147
|
+
yMax?: number | "auto";
|
|
148
|
+
yMin?: number;
|
|
149
|
+
/** Format a value for the axis + readout (default: rounded + unit). */
|
|
150
|
+
format?: (v: number) => string;
|
|
151
|
+
unit?: string;
|
|
152
|
+
/** Stroke/fill hue — any CSS color; pass a token var to stay theme-safe. */
|
|
153
|
+
color?: string;
|
|
154
|
+
thresholds?: {
|
|
155
|
+
warn?: number | undefined;
|
|
156
|
+
crit?: number | undefined;
|
|
157
|
+
} | undefined;
|
|
158
|
+
height?: number;
|
|
159
|
+
/** Human range label for the empty state ("in the last hour"). */
|
|
160
|
+
rangeLabel?: string | undefined;
|
|
161
|
+
className?: string | undefined;
|
|
162
|
+
};
|
|
163
|
+
declare function MetricHistoryChart({ points, yMax, yMin, format, unit, color, thresholds, height, rangeLabel, className, }: MetricHistoryChartProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
|
|
165
|
+
type MetricSparklineProps = {
|
|
166
|
+
points: SeriesPoint[];
|
|
167
|
+
color?: string;
|
|
168
|
+
yMax?: number | "auto";
|
|
169
|
+
height?: number;
|
|
170
|
+
className?: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
declare function MetricSparkline({ points, color, yMax, height, className, }: MetricSparklineProps): react_jsx_runtime.JSX.Element;
|
|
173
|
+
|
|
174
|
+
type MetricWindow = "15m" | "1h" | "6h" | "24h";
|
|
175
|
+
declare const METRIC_WINDOWS: MetricWindow[];
|
|
176
|
+
declare const WINDOW_LABEL: Record<MetricWindow, string>;
|
|
177
|
+
type MetricKey = "cpu" | "mem" | "disk" | "load" | "gpu";
|
|
178
|
+
type MetricDef = {
|
|
179
|
+
key: MetricKey;
|
|
180
|
+
title: string;
|
|
181
|
+
unit: string;
|
|
182
|
+
yMax: number | "auto";
|
|
183
|
+
color: string;
|
|
184
|
+
thresholds?: {
|
|
185
|
+
warn?: number;
|
|
186
|
+
crit?: number;
|
|
187
|
+
};
|
|
188
|
+
pick: (s: MetricSample) => number | null;
|
|
189
|
+
/** Big current-value string for tiles/badges. */
|
|
190
|
+
current: (s: MetricSample) => string;
|
|
191
|
+
/** Optional sub-line under the current value. */
|
|
192
|
+
sub?: (s: MetricSample) => string | null;
|
|
193
|
+
};
|
|
194
|
+
declare const METRICS: MetricDef[];
|
|
195
|
+
declare function pointsFor(def: MetricDef, samples: MetricSample[]): SeriesPoint[];
|
|
196
|
+
|
|
197
|
+
type MachineDetailProps = {
|
|
198
|
+
machine: MachineView;
|
|
199
|
+
/** Downsampled history for the active window (from `fetchSeries`). */
|
|
200
|
+
series: MetricSample[];
|
|
201
|
+
window: MetricWindow;
|
|
202
|
+
onWindowChange: (w: MetricWindow) => void;
|
|
203
|
+
loadingSeries?: boolean | undefined;
|
|
204
|
+
onBack?: (() => void) | undefined;
|
|
205
|
+
now?: number | undefined;
|
|
206
|
+
className?: string | undefined;
|
|
207
|
+
};
|
|
208
|
+
declare function MachineDetail({ machine, series, window, onWindowChange, loadingSeries, onBack, now, className, }: MachineDetailProps): react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
type MachinesDashboardProps = {
|
|
211
|
+
machines: MachineView[];
|
|
212
|
+
/** The session's active sandbox id (drives the per-card "Active" marker). */
|
|
213
|
+
activeSandboxId?: string | null | undefined;
|
|
214
|
+
loading?: boolean | undefined;
|
|
215
|
+
error?: Error | null | undefined;
|
|
216
|
+
/** Attach/swap the session's active sandbox to a machine. */
|
|
217
|
+
onAttach?: ((machine: MachineView) => void) | undefined;
|
|
218
|
+
/** The sandbox id currently being attached/swapped to (disables that card). */
|
|
219
|
+
attachingSandboxId?: string | null | undefined;
|
|
220
|
+
/** Short recent history per machine (keyed by sandboxId) — drives card sparklines. */
|
|
221
|
+
seriesByMachine?: Record<string, MetricSample[]> | undefined;
|
|
222
|
+
/** Open the per-machine telemetry detail (makes each card actionable). */
|
|
223
|
+
onOpenDetail?: ((machine: MachineView) => void) | undefined;
|
|
224
|
+
/** Shared clock so freshness/relative times render consistently across cards. */
|
|
225
|
+
now?: number | undefined;
|
|
226
|
+
/** Open the enrollment flow (the "Enroll a machine" CTA). */
|
|
227
|
+
onEnroll?: (() => void) | undefined;
|
|
228
|
+
onRefresh?: (() => void) | undefined;
|
|
229
|
+
className?: string | undefined;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* The workspace Machines dashboard: the fleet of selfhosted enrollments + the
|
|
233
|
+
* session's managed sandbox, each with its connection-status pill, state badges,
|
|
234
|
+
* latest metrics, and an attach/swap affordance. Renders the empty state (no
|
|
235
|
+
* machines → enroll CTA), a load error, and the populated grid. The component
|
|
236
|
+
* is purely presentational — feed it `MachinesResponse` data via `useMachines`.
|
|
237
|
+
*/
|
|
238
|
+
declare function MachinesDashboard({ machines, activeSandboxId, loading, error, onAttach, attachingSandboxId, seriesByMachine, onOpenDetail, now, onEnroll, onRefresh, className, }: MachinesDashboardProps): react_jsx_runtime.JSX.Element;
|
|
239
|
+
|
|
240
|
+
type MachineDockBarProps = {
|
|
241
|
+
/** The active machine's display name. */
|
|
242
|
+
name: string;
|
|
243
|
+
kind: MachineKind;
|
|
244
|
+
state: MachineState;
|
|
245
|
+
/** Live sessions sharing this whole-machine lease (>1 ⇒ shared disclosure). */
|
|
246
|
+
sharedSessionCount?: number | undefined;
|
|
247
|
+
className?: string | undefined;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* A slim bar that surfaces WHICH machine the dock surfaces (Files/Terminal/
|
|
251
|
+
* Desktop) are bound to + its connection status. Mounted above the dock tabs so
|
|
252
|
+
* the user always knows whether they are looking at the Modal box or their own
|
|
253
|
+
* machine, and whether it is online / reconnecting / offline. The surfaces below
|
|
254
|
+
* render IDENTICALLY regardless of backend — this bar is the only backend-aware
|
|
255
|
+
* chrome (the dock-parity contract: selfhosted == Modal for the surfaces).
|
|
256
|
+
*/
|
|
257
|
+
declare function MachineDockBar({ name, kind, state, className }: MachineDockBarProps): react_jsx_runtime.JSX.Element;
|
|
258
|
+
type SharedMachineDisclosureProps = {
|
|
259
|
+
sharedSessionCount: number;
|
|
260
|
+
/** Compact (inline strip) vs full (a notice block). */
|
|
261
|
+
density?: "compact" | "full" | undefined;
|
|
262
|
+
className?: string | undefined;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* The "shared — another session is on this machine" disclosure. Surfaced in the
|
|
266
|
+
* dock (and reused on the desktop take-control gate) so the user knows others are
|
|
267
|
+
* driving the same whole-machine lease. Render when `sharedSessionCount > 1`.
|
|
268
|
+
*/
|
|
269
|
+
declare function SharedMachineDisclosure({ sharedSessionCount, density, className, }: SharedMachineDisclosureProps): react_jsx_runtime.JSX.Element;
|
|
270
|
+
|
|
271
|
+
/** The poll state of an in-flight device-flow enrollment. */
|
|
272
|
+
type DeviceFlowPhase = "pending" | "authorized" | "denied" | "expired" | "disabled";
|
|
273
|
+
type EnrollmentDeviceFlowProps = {
|
|
274
|
+
/** The short user code the agent printed (shown big for the human to confirm). */
|
|
275
|
+
userCode: string;
|
|
276
|
+
/** Where the user approves — the same-origin device page. */
|
|
277
|
+
verificationUri: string;
|
|
278
|
+
/** The complete URI (code pre-filled) for a one-click / QR open. */
|
|
279
|
+
verificationUriComplete?: string | undefined;
|
|
280
|
+
/** The install one-liner the user ran (echoed for context). Optional. */
|
|
281
|
+
installCommand?: string | undefined;
|
|
282
|
+
phase?: DeviceFlowPhase | undefined;
|
|
283
|
+
/** Seconds remaining before the code expires (drives a quiet countdown). */
|
|
284
|
+
expiresInSeconds?: number | undefined;
|
|
285
|
+
onCopyCode?: (() => void) | undefined;
|
|
286
|
+
onCopyInstall?: (() => void) | undefined;
|
|
287
|
+
onOpenVerification?: (() => void) | undefined;
|
|
288
|
+
className?: string | undefined;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* The IN-SESSION device-flow panel: the agent (after the install one-liner) prints
|
|
292
|
+
* a short `userCode` + a `verificationUri`; this surfaces them so the user can open
|
|
293
|
+
* the approve page and confirm the code. Polls in the caller; this renders the
|
|
294
|
+
* pending → authorized/denied/expired progression with a connection pill. This is
|
|
295
|
+
* the FIRST step of the IA flow (device-flow → Machines list → attach/swap).
|
|
296
|
+
*/
|
|
297
|
+
declare function EnrollmentDeviceFlow({ userCode, verificationUri, verificationUriComplete, installCommand, phase, expiresInSeconds, onCopyCode, onCopyInstall, onOpenVerification, className, }: EnrollmentDeviceFlowProps): react_jsx_runtime.JSX.Element;
|
|
298
|
+
|
|
299
|
+
/** The machine identity surfaced to the approver, from the device-flow start. */
|
|
300
|
+
type EnrollmentConsentMachine = {
|
|
301
|
+
/** Human-friendly name (hostname by default). */
|
|
302
|
+
machineName: string;
|
|
303
|
+
os: string;
|
|
304
|
+
arch: string;
|
|
305
|
+
/** The agent can offer a display (a real screen / Xvfb is available). */
|
|
306
|
+
canOfferDisplay: boolean;
|
|
307
|
+
/** The agent requests screen control (computer-use). */
|
|
308
|
+
requestsScreenControl: boolean;
|
|
309
|
+
};
|
|
310
|
+
/** The phase of the approve page (drives the rendered panel). */
|
|
311
|
+
type EnrollmentConsentPhase = "review" | "approving" | "approved" | "denied" | "error";
|
|
312
|
+
type EnrollmentConsentProps = {
|
|
313
|
+
/** The short code the user typed / scanned (echoed back for confirmation). */
|
|
314
|
+
userCode: string;
|
|
315
|
+
machine: EnrollmentConsentMachine;
|
|
316
|
+
phase?: EnrollmentConsentPhase | undefined;
|
|
317
|
+
/** Approve with the chosen screen-control consent. */
|
|
318
|
+
onApprove?: ((allowScreenControl: boolean) => void) | undefined;
|
|
319
|
+
onDeny?: (() => void) | undefined;
|
|
320
|
+
/** Error message when phase === "error". */
|
|
321
|
+
errorMessage?: string | undefined;
|
|
322
|
+
className?: string | undefined;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* The user-facing APPROVE page for the device-flow enrollment: a LOUD,
|
|
326
|
+
* un-minimised whole-machine consent. Approving grants the agent FULL access to
|
|
327
|
+
* this machine — exec, files, terminal — and (when toggled) live screen control.
|
|
328
|
+
* The danger framing is deliberate (§18 hardening: whole-machine = loud consent),
|
|
329
|
+
* never buried. Renders review / approving / approved / denied / error phases.
|
|
330
|
+
*/
|
|
331
|
+
declare function EnrollmentConsent({ userCode, machine, phase, onApprove, onDeny, errorMessage, className, }: EnrollmentConsentProps): react_jsx_runtime.JSX.Element;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The slice of the SDK client the Machines surface needs. The method NAMES +
|
|
335
|
+
* SIGNATURES match M10's `OpenGeniClient` (`listMachines`, `machineMetricsSeries`)
|
|
336
|
+
* so the real SDK client satisfies this surface DIRECTLY for the read paths — no
|
|
337
|
+
* adapter needed. It is declared structurally (not a hard `OpenGeniClient` Pick)
|
|
338
|
+
* so a test/demo/Geni-frontend client can stand in, keeping the hook dual-consumer
|
|
339
|
+
* safe (works in apps/web AND the separate Geni frontend).
|
|
340
|
+
*
|
|
341
|
+
* The active-sandbox SWAP is now a typed SDK call (`swapActiveSandbox`, the M7
|
|
342
|
+
* user-authenticated REST equivalent of the `sandbox_swap` MCP tool). The real
|
|
343
|
+
* SDK client satisfies it structurally, so the default attach path is wired
|
|
344
|
+
* WHENEVER a sessionId is in scope (the swap is session-scoped). `attachMachine`
|
|
345
|
+
* stays an OPTIONAL escape hatch for a host that wants to supply its own swap
|
|
346
|
+
* adapter; when neither it nor a sessionId is present, attach is a no-op and the
|
|
347
|
+
* card hides the button.
|
|
348
|
+
*/
|
|
349
|
+
type MachinesClientLike = {
|
|
350
|
+
/** GET /v1/workspaces/:ws/machines — the dashboard list + active pointer. */
|
|
351
|
+
listMachines: (workspaceId: string, options?: {
|
|
352
|
+
sessionId?: string;
|
|
353
|
+
signal?: AbortSignal;
|
|
354
|
+
}) => Promise<MachinesResponse>;
|
|
355
|
+
/** GET .../machines/:enrollmentId/metrics/series — the downsampled history. */
|
|
356
|
+
machineMetricsSeries?: (workspaceId: string, enrollmentId: string, options?: {
|
|
357
|
+
window?: "15m" | "1h" | "6h" | "24h";
|
|
358
|
+
}) => Promise<MetricSample[]>;
|
|
359
|
+
/**
|
|
360
|
+
* POST .../sessions/:sessionId/active-sandbox — swap the session's active
|
|
361
|
+
* sandbox to a machine. The default swap path; the real SDK client provides it.
|
|
362
|
+
*/
|
|
363
|
+
swapActiveSandbox?: (workspaceId: string, sessionId: string, request: {
|
|
364
|
+
target: string;
|
|
365
|
+
}) => Promise<unknown>;
|
|
366
|
+
/**
|
|
367
|
+
* Host-supplied swap adapter (an escape hatch). When present it wins over the
|
|
368
|
+
* default `swapActiveSandbox` path. Session-scoped, like the swap it backs.
|
|
369
|
+
*/
|
|
370
|
+
attachMachine?: (workspaceId: string, sessionId: string, sandboxId: string) => Promise<unknown>;
|
|
371
|
+
};
|
|
372
|
+
type UseMachinesOptions = ClientOverride & {
|
|
373
|
+
pollIntervalMs?: number | undefined;
|
|
374
|
+
enabled?: boolean | undefined;
|
|
375
|
+
/** Scope the list to a session (adds the synthetic Modal group box + pointer). */
|
|
376
|
+
sessionId?: string | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* Override the client with one implementing `MachinesClientLike`. Defaults to
|
|
379
|
+
* the provider client cast to the surface (the real SDK client satisfies the
|
|
380
|
+
* read paths). An app supplies an adapter to wire `attachMachine` (the swap).
|
|
381
|
+
*/
|
|
382
|
+
machinesClient?: MachinesClientLike | undefined;
|
|
383
|
+
};
|
|
384
|
+
type UseMachinesResult = {
|
|
385
|
+
machines: MachineView[];
|
|
386
|
+
activeSandboxId: string | null;
|
|
387
|
+
activeEpoch: number;
|
|
388
|
+
loading: boolean;
|
|
389
|
+
error: Error | null;
|
|
390
|
+
refresh: () => Promise<void>;
|
|
391
|
+
/** Attach/swap the session's active sandbox to a machine (returns the new pointer). */
|
|
392
|
+
attach: (sandboxId: string) => Promise<boolean>;
|
|
393
|
+
/** Whether the host wired an attach/swap path (drives the card affordance). */
|
|
394
|
+
canAttach: boolean;
|
|
395
|
+
/** Fetch a downsampled metric series for one enrolled machine. */
|
|
396
|
+
fetchSeries: (enrollmentId: string, window?: "15m" | "1h" | "6h" | "24h") => Promise<MetricSample[]>;
|
|
397
|
+
attaching: boolean;
|
|
398
|
+
/** The sandbox id of the in-flight attach (for per-card spinner gating). */
|
|
399
|
+
attachingSandboxId: string | null;
|
|
400
|
+
mutationError: Error | null;
|
|
401
|
+
clearMutationError: () => void;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* The workspace Machines fleet: the selfhosted enrollments + the session's Modal
|
|
405
|
+
* box, each with latest metrics + state, plus the active-sandbox pointer. Polls
|
|
406
|
+
* the M10 `GET /machines` endpoint and exposes attach/swap + a metric-series
|
|
407
|
+
* fetch. Renders via `<MachinesDashboard>`. Dual-consumer safe: it reads only the
|
|
408
|
+
* structural `MachinesClientLike` surface, so it works in apps/web AND the Geni
|
|
409
|
+
* frontend (each provides its own client/adapter).
|
|
410
|
+
*/
|
|
411
|
+
declare function useMachines(options?: UseMachinesOptions): UseMachinesResult;
|
|
412
|
+
|
|
413
|
+
export { CONNECTION_STATUS_META, ConnectionDot, type ConnectionDotProps, type ConnectionStatus, type ConnectionStatusMeta, ConnectionStatusPill, type ConnectionStatusPillProps, type DeviceFlowPhase, EnrollmentConsent, type EnrollmentConsentMachine, type EnrollmentConsentPhase, type EnrollmentConsentProps, EnrollmentDeviceFlow, type EnrollmentDeviceFlowProps, HEALTH_TOKEN, type HealthLevel, type HealthVerdict, MACHINE_STATE_BADGE_META, METRICS, METRIC_WINDOWS, MachineCard, type MachineCardProps, MachineDetail, type MachineDetailProps, MachineDockBar, type MachineDockBarProps, MachineHealthPill, type MachineHealthPillProps, MachineMetrics, type MachineMetricsProps, type MachineStateBadgeMeta, MachineStatusPill, type MachineStatusPillProps, type MachinesClientLike, MachinesDashboard, type MachinesDashboardProps, type MetricDef, MetricHistoryChart, type MetricHistoryChartProps, type MetricKey, MetricSparkline, type MetricSparklineProps, type MetricWindow, type SeriesPoint, SharedMachineDisclosure, type SharedMachineDisclosureProps, type UseMachinesOptions, type UseMachinesResult, WINDOW_LABEL, connectionStatusForState, deriveHealth, healthPulses, pointsFor, useMachines };
|
package/dist/machines.js
CHANGED
|
@@ -4,30 +4,54 @@ import {
|
|
|
4
4
|
ConnectionStatusPill,
|
|
5
5
|
EnrollmentConsent,
|
|
6
6
|
EnrollmentDeviceFlow,
|
|
7
|
+
HEALTH_TOKEN,
|
|
7
8
|
MACHINE_STATE_BADGE_META,
|
|
9
|
+
METRICS,
|
|
10
|
+
METRIC_WINDOWS,
|
|
8
11
|
MachineCard,
|
|
12
|
+
MachineDetail,
|
|
9
13
|
MachineDockBar,
|
|
14
|
+
MachineHealthPill,
|
|
10
15
|
MachineMetrics,
|
|
11
16
|
MachineStatusPill,
|
|
12
17
|
MachinesDashboard,
|
|
18
|
+
MetricHistoryChart,
|
|
19
|
+
MetricSparkline,
|
|
13
20
|
SharedMachineDisclosure,
|
|
21
|
+
WINDOW_LABEL,
|
|
14
22
|
connectionStatusForState,
|
|
23
|
+
deriveHealth,
|
|
24
|
+
healthPulses,
|
|
25
|
+
pointsFor,
|
|
15
26
|
useMachines
|
|
16
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6BXBGJ3B.js";
|
|
28
|
+
import "./chunk-TK7G6XLT.js";
|
|
29
|
+
import "./chunk-HHFA4AFX.js";
|
|
17
30
|
export {
|
|
18
31
|
CONNECTION_STATUS_META,
|
|
19
32
|
ConnectionDot,
|
|
20
33
|
ConnectionStatusPill,
|
|
21
34
|
EnrollmentConsent,
|
|
22
35
|
EnrollmentDeviceFlow,
|
|
36
|
+
HEALTH_TOKEN,
|
|
23
37
|
MACHINE_STATE_BADGE_META,
|
|
38
|
+
METRICS,
|
|
39
|
+
METRIC_WINDOWS,
|
|
24
40
|
MachineCard,
|
|
41
|
+
MachineDetail,
|
|
25
42
|
MachineDockBar,
|
|
43
|
+
MachineHealthPill,
|
|
26
44
|
MachineMetrics,
|
|
27
45
|
MachineStatusPill,
|
|
28
46
|
MachinesDashboard,
|
|
47
|
+
MetricHistoryChart,
|
|
48
|
+
MetricSparkline,
|
|
29
49
|
SharedMachineDisclosure,
|
|
50
|
+
WINDOW_LABEL,
|
|
30
51
|
connectionStatusForState,
|
|
52
|
+
deriveHealth,
|
|
53
|
+
healthPulses,
|
|
54
|
+
pointsFor,
|
|
31
55
|
useMachines
|
|
32
56
|
};
|
|
33
57
|
//# sourceMappingURL=machines.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/lib/noto-sans-arabic-loader.ts
|
|
2
|
+
import fontUrl from "@fontsource-variable/noto-sans-arabic/files/noto-sans-arabic-arabic-wght-normal.woff2";
|
|
3
|
+
import unicodeRanges from "@fontsource-variable/noto-sans-arabic/unicode.json";
|
|
4
|
+
var loading;
|
|
5
|
+
function loadNotoSansArabic() {
|
|
6
|
+
loading ??= new FontFace(
|
|
7
|
+
"Noto Sans Arabic Variable",
|
|
8
|
+
`url("${fontUrl}") format("woff2-variations")`,
|
|
9
|
+
{ style: "normal", weight: "100 900", unicodeRange: unicodeRanges.arabic }
|
|
10
|
+
).load().then((font) => {
|
|
11
|
+
document.fonts.add(font);
|
|
12
|
+
}).catch((error) => {
|
|
13
|
+
loading = void 0;
|
|
14
|
+
throw error;
|
|
15
|
+
});
|
|
16
|
+
return loading;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
loadNotoSansArabic
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=noto-sans-arabic-loader-IA2T4X2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/noto-sans-arabic-loader.ts"],"sourcesContent":["import fontUrl from \"@fontsource-variable/noto-sans-arabic/files/noto-sans-arabic-arabic-wght-normal.woff2\";\nimport unicodeRanges from \"@fontsource-variable/noto-sans-arabic/unicode.json\";\n\nlet loading: Promise<void> | undefined;\n\nexport function loadNotoSansArabic(): Promise<void> {\n loading ??= new FontFace(\n \"Noto Sans Arabic Variable\",\n `url(\"${fontUrl}\") format(\"woff2-variations\")`,\n { style: \"normal\", weight: \"100 900\", unicodeRange: unicodeRanges.arabic },\n )\n .load()\n .then((font) => {\n document.fonts.add(font);\n })\n .catch((error: unknown) => {\n loading = undefined;\n throw error;\n });\n return loading;\n}\n"],"mappings":";AAAA,OAAO,aAAa;AACpB,OAAO,mBAAmB;AAE1B,IAAI;AAEG,SAAS,qBAAoC;AAClD,cAAY,IAAI;AAAA,IACd;AAAA,IACA,QAAQ,OAAO;AAAA,IACf,EAAE,OAAO,UAAU,QAAQ,WAAW,cAAc,cAAc,OAAO;AAAA,EAC3E,EACG,KAAK,EACL,KAAK,CAAC,SAAS;AACd,aAAS,MAAM,IAAI,IAAI;AAAA,EACzB,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,cAAU;AACV,UAAM;AAAA,EACR,CAAC;AACH,SAAO;AACT;","names":[]}
|