@opengeni/react 0.9.1 → 0.12.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/LICENSE +190 -0
- package/dist/{chunk-5C7RGAWA.js → chunk-5TIXRCSI.js} +21 -1
- package/dist/chunk-5TIXRCSI.js.map +1 -0
- package/dist/index.d.ts +42 -5
- package/dist/index.js +94 -9
- package/dist/index.js.map +1 -1
- package/dist/machines.js +1 -1
- package/package.json +4 -31
- package/src/components/message-timeline.tsx +43 -3
- package/src/index.ts +2 -1
- package/src/lib/format.ts +41 -3
- package/src/timeline/index.ts +1 -1
- package/src/timeline/projection.ts +84 -3
- package/src/timeline/turn-summary.tsx +9 -2
- package/src/timeline/types.ts +1 -0
- package/dist/chunk-5C7RGAWA.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Cloudgeni-ai
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -202,10 +202,28 @@ function tryParseJson(text) {
|
|
|
202
202
|
return void 0;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
var CREDIT_EXHAUSTION_MESSAGE = "Out of OpenGeni credits \u2014 this workspace's balance is empty. Add credits to continue; the conversation is preserved.";
|
|
206
|
+
function isCreditExhaustion(input) {
|
|
207
|
+
if (typeof input === "string") {
|
|
208
|
+
return input.toLowerCase().includes("insufficient opengeni credits");
|
|
209
|
+
}
|
|
210
|
+
if (input.segmentLimit === "budget_exhausted") {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
for (const text of [input.error, input.detail]) {
|
|
214
|
+
if (typeof text === "string" && text.toLowerCase().includes("insufficient opengeni credits")) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
205
220
|
function humanizeFailureReason(reason) {
|
|
206
221
|
if (!reason) {
|
|
207
222
|
return reason;
|
|
208
223
|
}
|
|
224
|
+
if (isCreditExhaustion(reason)) {
|
|
225
|
+
return CREDIT_EXHAUSTION_MESSAGE;
|
|
226
|
+
}
|
|
209
227
|
const normalized = reason.toLowerCase();
|
|
210
228
|
const authFailure = normalized.includes("incorrect api key") || normalized.includes("invalid api key") || normalized.includes("invalid_api_key") || normalized.includes("platform.openai.com/account/api-keys") || normalized.includes("401") && (normalized.includes("api key") || normalized.includes("unauthorized"));
|
|
211
229
|
if (authFailure) {
|
|
@@ -1251,6 +1269,8 @@ export {
|
|
|
1251
1269
|
truncate,
|
|
1252
1270
|
stringifyPayload,
|
|
1253
1271
|
tryParseJson,
|
|
1272
|
+
CREDIT_EXHAUSTION_MESSAGE,
|
|
1273
|
+
isCreditExhaustion,
|
|
1254
1274
|
humanizeFailureReason,
|
|
1255
1275
|
cn,
|
|
1256
1276
|
connectionStatusForState,
|
|
@@ -1268,4 +1288,4 @@ export {
|
|
|
1268
1288
|
EnrollmentConsent,
|
|
1269
1289
|
useMachines
|
|
1270
1290
|
};
|
|
1271
|
-
//# sourceMappingURL=chunk-
|
|
1291
|
+
//# sourceMappingURL=chunk-5TIXRCSI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/machines.ts","../src/lib/cn.ts","../src/components/machine-status-pill.tsx","../src/lib/format.ts","../src/components/machine-metrics.tsx","../src/components/machine-card.tsx","../src/components/machines-dashboard.tsx","../src/components/machine-dock-bar.tsx","../src/components/enrollment-device-flow.tsx","../src/components/enrollment-consent.tsx","../src/hooks/use-machines.ts","../src/provider.tsx","../src/hooks/internal.ts"],"sourcesContent":["// ----------------------------------------------------------------------------\n// Bring-your-own-compute — Machines view-model.\n//\n// The data-contract types (MachineView / MetricSample / MachinesResponse /\n// MachineMetricsSeriesResponse / MachineKind / MachineState) are the\n// orchestrator-owned SHARED DATA CONTRACT that M10 ships in `@opengeni/sdk`\n// (hand-written mirrors of `@opengeni/contracts`, pinned by contract-parity).\n// M9 RE-EXPORTS them here so the dashboard UI imports a single, stable name and\n// never drifts from the API — exactly as the contract intends.\n//\n// (During concurrent M9/M10 development this module briefly carried a local\n// view-model with the same field names; once M10 landed the SDK types we\n// reconciled to re-export them — the field names were identical by design.)\n//\n// Endpoints these model (M10 owns the SDK client methods):\n// GET /v1/workspaces/:ws/machines -> MachinesResponse\n// GET /v1/workspaces/:ws/machines/:enrollmentId/metrics/series?window=1h\n// -> { samples: MetricSample[] }\n// ----------------------------------------------------------------------------\nimport type {\n MachineKind,\n MachineMetricsSeriesResponse,\n MachinesResponse,\n MachineState,\n MachineView,\n MetricSample,\n} from \"@opengeni/sdk\";\n\nexport type {\n MachineKind,\n MachineMetricsSeriesResponse,\n MachinesResponse,\n MachineState,\n MachineView,\n MetricSample,\n};\n\n// --- connection-status grouping (a PURE UI projection — not a contract type) --\n\n/**\n * The three connection-status pill values the UI surfaces across the dashboard,\n * the dock, and the timeline. `consent_required` / `display_unavailable` /\n * `enrolling` are NOT connection states — they map onto a connection state for\n * the pill and carry their own badge separately.\n */\nexport type ConnectionStatus = \"online\" | \"reconnecting\" | \"offline\";\n\n/** Project a machine `state` onto its connection-status pill value. */\nexport function connectionStatusForState(state: MachineState): ConnectionStatus {\n switch (state) {\n case \"online\":\n case \"consent_required\":\n case \"display_unavailable\":\n // The control plane is reachable; the limitation is consent / no display.\n return \"online\";\n case \"reconnecting\":\n case \"enrolling\":\n return \"reconnecting\";\n case \"offline\":\n return \"offline\";\n default: {\n // Exhaustiveness guard — a new state must be classified explicitly.\n const _never: never = state;\n return _never;\n }\n }\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\n/* ----------------------------------------------------------------------------\n tailwind-merge, taught our design tokens.\n\n Our type scale and color ramp share the `og-` prefix: `text-og-base` is a\n FONT SIZE, `text-og-fg-muted` is a COLOR. Stock tailwind-merge can't tell\n them apart — it lumps every `text-og-*` into one `font-size` group and, when\n two land in the same class list, drops the earlier one. That silently ate the\n size off rows like `text-og-base text-og-fg-muted`, leaving titles at the\n browser-default 16px. Register the custom font-size scale so the size and the\n color live in different conflict groups and both survive a merge.\n -------------------------------------------------------------------------- */\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n \"font-size\": [{ text: [\"og-xs\", \"og-sm\", \"og-base\", \"og-md\"] }],\n },\n },\n});\n\n/** Merge class names with Tailwind-aware conflict resolution. */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { cn } from \"../lib/cn\";\nimport {\n type ConnectionStatus,\n connectionStatusForState,\n type MachineState,\n} from \"../types/machines\";\n\nexport type ConnectionStatusMeta = {\n label: string;\n dotClassName: string;\n badgeClassName: string;\n /** Live/transient states breathe; settled states hold still. */\n pulse: boolean;\n};\n\n/** Token-backed meta for the three connection-status pill values. */\nexport const CONNECTION_STATUS_META: Record<ConnectionStatus, ConnectionStatusMeta> = {\n online: {\n label: \"Online\",\n dotClassName: \"bg-og-status-running\",\n badgeClassName: \"text-og-status-running border-og-status-running/30 bg-og-status-running/10\",\n pulse: false,\n },\n reconnecting: {\n label: \"Reconnecting\",\n dotClassName: \"bg-og-status-waiting\",\n badgeClassName: \"text-og-status-waiting border-og-status-waiting/35 bg-og-status-waiting/10\",\n pulse: true,\n },\n offline: {\n label: \"Offline\",\n dotClassName: \"bg-og-status-failed\",\n badgeClassName: \"text-og-fg-subtle border-og-border bg-og-status-failed/10\",\n pulse: false,\n },\n};\n\nexport type MachineStateBadgeMeta = {\n label: string;\n badgeClassName: string;\n};\n\n/**\n * The non-connection state badges that ride ALONGSIDE the connection pill —\n * `consent_required` / `display_unavailable` / `enrolling` describe a capability\n * limitation, not reachability, so they render as their own tinted chip.\n */\nexport const MACHINE_STATE_BADGE_META: Partial<Record<MachineState, MachineStateBadgeMeta>> = {\n consent_required: {\n label: \"Consent required\",\n badgeClassName: \"text-og-status-waiting border-og-status-waiting/35 bg-og-status-waiting/10\",\n },\n display_unavailable: {\n label: \"No display\",\n badgeClassName: \"text-og-fg-muted border-og-border bg-og-surface-2\",\n },\n enrolling: {\n label: \"Enrolling\",\n badgeClassName: \"text-og-accent border-og-accent/30 bg-og-accent-soft\",\n },\n};\n\nexport type ConnectionStatusPillProps = {\n status: ConnectionStatus;\n /** Override the label (\"Online\" -> \"Connected\", ...). */\n label?: string | undefined;\n size?: \"sm\" | \"md\" | undefined;\n className?: string | undefined;\n};\n\n/**\n * The connection-status pill (online / reconnecting / offline) surfaced across\n * the Machines dashboard, the dock header, and the session timeline. Reconnecting\n * breathes (the resiliency-as-headline blip), online/offline hold still.\n */\nexport function ConnectionStatusPill({ status, label, size = \"md\", className }: ConnectionStatusPillProps) {\n const meta = CONNECTION_STATUS_META[status];\n return (\n <span\n data-connection-status={status}\n className={cn(\n \"og-root inline-flex shrink-0 items-center rounded-full border font-medium\",\n size === \"sm\" ? \"gap-1 px-1.5 py-px text-og-xs\" : \"gap-1.5 px-2 py-0.5 text-og-sm\",\n meta.badgeClassName,\n className,\n )}\n >\n <ConnectionDot status={status} className={size === \"sm\" ? \"size-1\" : \"size-1.5\"} />\n {label ?? meta.label}\n </span>\n );\n}\n\nexport type ConnectionDotProps = {\n status: ConnectionStatus;\n className?: string | undefined;\n};\n\n/** Just the dot — for dense rows, the dock header, and timeline notices. */\nexport function ConnectionDot({ status, className }: ConnectionDotProps) {\n const meta = CONNECTION_STATUS_META[status];\n return (\n <span className={cn(\"relative inline-flex size-1.5 shrink-0 rounded-full\", meta.dotClassName, className)}>\n {meta.pulse ? <span className={cn(\"absolute inset-0 animate-og-pulse rounded-full\", meta.dotClassName)} /> : null}\n </span>\n );\n}\n\nexport type MachineStatusPillProps = {\n /** The machine's full state — drives the connection pill + any state badge. */\n state: MachineState;\n /** How many live sessions share this lease (renders a \"Shared\" chip when >1). */\n sharedSessionCount?: number | undefined;\n size?: \"sm\" | \"md\" | undefined;\n className?: string | undefined;\n};\n\n/**\n * The composite machine status surface: the connection pill PLUS any\n * consent/display/enrolling badge PLUS a shared-in-use chip. One component the\n * dashboard row, the dock header, and the timeline all reuse so the status\n * language is identical everywhere.\n */\nexport function MachineStatusPill({ state, sharedSessionCount, size = \"md\", className }: MachineStatusPillProps) {\n const stateBadge = MACHINE_STATE_BADGE_META[state];\n const shared = (sharedSessionCount ?? 0) > 1;\n return (\n <span className={cn(\"og-root inline-flex flex-wrap items-center gap-1\", className)} data-machine-state={state}>\n <ConnectionStatusPill status={connectionStatusForState(state)} size={size} />\n {stateBadge ? (\n <span\n data-state-badge={state}\n className={cn(\n \"inline-flex shrink-0 items-center rounded-full border font-medium\",\n size === \"sm\" ? \"px-1.5 py-px text-og-xs\" : \"px-2 py-0.5 text-og-sm\",\n stateBadge.badgeClassName,\n )}\n >\n {stateBadge.label}\n </span>\n ) : null}\n {shared ? (\n <span\n data-shared-chip\n className={cn(\n \"inline-flex shrink-0 items-center gap-1 rounded-full border font-medium\",\n \"text-og-accent border-og-accent/30 bg-og-accent-soft\",\n size === \"sm\" ? \"px-1.5 py-px text-og-xs\" : \"px-2 py-0.5 text-og-sm\",\n )}\n title={`${sharedSessionCount} sessions are on this machine`}\n >\n Shared · {sharedSessionCount}\n </span>\n ) : null}\n </span>\n );\n}\n","/** Compact relative time: \"now\", \"42s\", \"7m\", \"3h\", \"2d\", then a date. */\nexport function formatRelativeTime(iso: string, now: Date = new Date()): string {\n const then = new Date(iso).getTime();\n if (Number.isNaN(then)) {\n return \"\";\n }\n const seconds = Math.max(0, Math.floor((now.getTime() - then) / 1000));\n if (seconds < 10) {\n return \"now\";\n }\n if (seconds < 60) {\n return `${seconds}s`;\n }\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) {\n return `${minutes}m`;\n }\n const hours = Math.floor(minutes / 60);\n if (hours < 24) {\n return `${hours}h`;\n }\n const days = Math.floor(hours / 24);\n if (days < 14) {\n return `${days}d`;\n }\n return new Date(iso).toLocaleDateString();\n}\n\n/** Human-readable byte size: \"512 B\", \"8.0 KB\", \"1.4 MB\", \"3 GB\". */\nexport function formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n const units = [\"KB\", \"MB\", \"GB\"] as const;\n let value = bytes / 1024;\n for (const unit of units) {\n if (value < 1024 || unit === \"GB\") {\n return `${value.toFixed(value < 10 ? 1 : 0)} ${unit}`;\n }\n value /= 1024;\n }\n return `${bytes} B`;\n}\n\n/** Single-line preview of arbitrary text, for tiles and collapsed rows. */\nexport function truncate(text: string, maxLength: number): string {\n const collapsed = text.replace(/\\s+/g, \" \").trim();\n if (collapsed.length <= maxLength) {\n return collapsed;\n }\n return `${collapsed.slice(0, Math.max(0, maxLength - 1)).trimEnd()}…`;\n}\n\n/** Render an unknown payload as readable text (pretty JSON when possible). */\nexport function stringifyPayload(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"string\") {\n const parsed = tryParseJson(value);\n if (parsed !== undefined && typeof parsed === \"object\") {\n return stringifyPayload(parsed);\n }\n return value;\n }\n try {\n return JSON.stringify(value, null, 2) ?? String(value);\n } catch {\n return String(value);\n }\n}\n\n/** JSON.parse that returns `undefined` instead of throwing. */\nexport function tryParseJson(text: string): unknown {\n const trimmed = text.trim();\n if (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\") && !trimmed.startsWith('\"')) {\n return undefined;\n }\n try {\n return JSON.parse(trimmed) as unknown;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The canonical credit-death sentence. Credit exhaustion is the one failure a\n * user can fix themselves — the copy must say what happened (empty balance),\n * what to do (add credits), and what is safe (nothing was lost). Crucially it\n * must NOT say \"send a message to revive\": a revive turn burns credits the\n * workspace no longer has.\n */\nexport const CREDIT_EXHAUSTION_MESSAGE =\n \"Out of OpenGeni credits — this workspace's balance is empty. Add credits to continue; the conversation is preserved.\";\n\n/**\n * Does this failure/completion payload (or raw error string) mean the\n * workspace ran out of OpenGeni credits? Matches the engine's\n * \"insufficient OpenGeni credits\" text (case-insensitive, substring — it\n * arrives both bare and wrapped in \"Activity task failed: …\") and the\n * budget-exhausted segment limit the engine stamps on a turn it ended early.\n */\nexport function isCreditExhaustion(\n input: { error?: string | null; detail?: string | null; segmentLimit?: string | null } | string,\n): boolean {\n if (typeof input === \"string\") {\n return input.toLowerCase().includes(\"insufficient opengeni credits\");\n }\n if (input.segmentLimit === \"budget_exhausted\") {\n return true;\n }\n for (const text of [input.error, input.detail]) {\n if (typeof text === \"string\" && text.toLowerCase().includes(\"insufficient opengeni credits\")) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Humanize engine/provider failure text before it reaches the timeline or a\n * failure banner. Raw provider errors leak the wrong audience's instructions —\n * \"Incorrect API key … find your API key at platform.openai.com\" tells a\n * managed-deployment USER to fix credentials only an OPERATOR controls (and is\n * flatly wrong for Azure or subscription-backed engines). Auth, quota, and\n * credit-exhaustion failures collapse to one neutral, honest sentence; every\n * other reason passes through untouched. Raw payloads stay available in the\n * debug surfaces.\n */\nexport function humanizeFailureReason(reason: string | null): string | null {\n if (!reason) {\n return reason;\n }\n if (isCreditExhaustion(reason)) {\n return CREDIT_EXHAUSTION_MESSAGE;\n }\n const normalized = reason.toLowerCase();\n const authFailure =\n normalized.includes(\"incorrect api key\") ||\n normalized.includes(\"invalid api key\") ||\n normalized.includes(\"invalid_api_key\") ||\n normalized.includes(\"platform.openai.com/account/api-keys\") ||\n (normalized.includes(\"401\") && (normalized.includes(\"api key\") || normalized.includes(\"unauthorized\")));\n if (authFailure) {\n return \"The model provider rejected this deployment's engine credentials. Sending messages won't help until the deployment's engine configuration is fixed.\";\n }\n const quotaFailure =\n normalized.includes(\"insufficient_quota\") ||\n normalized.includes(\"exceeded your current quota\");\n if (quotaFailure) {\n return \"The model provider refused the request: this deployment's provider quota is exhausted.\";\n }\n return reason;\n}\n","import { cn } from \"../lib/cn\";\nimport { formatBytes } from \"../lib/format\";\nimport type { MetricSample } from \"../types/machines\";\n\nexport type MachineMetricsProps = {\n /** The latest metric sample, or null when the machine hasn't reported yet. */\n metrics: MetricSample | null;\n /** Compact (dashboard row) vs full (the dock detail). */\n density?: \"compact\" | \"full\" | undefined;\n className?: string | undefined;\n};\n\n/** Clamp a 0..100-ish percent into the bar range. */\nfunction pct(value: number): number {\n if (!Number.isFinite(value)) return 0;\n return Math.max(0, Math.min(100, value));\n}\n\n/** A label/value pair with a token-tinted utilisation bar. */\nfunction Meter({\n label,\n value,\n fillPct,\n tone,\n}: {\n label: string;\n value: string;\n fillPct: number;\n tone: \"ok\" | \"warn\" | \"hot\";\n}) {\n const fillClass =\n tone === \"hot\" ? \"bg-og-status-failed\" : tone === \"warn\" ? \"bg-og-status-waiting\" : \"bg-og-status-running\";\n return (\n <div className=\"flex min-w-0 flex-col gap-1\" data-metric={label.toLowerCase()}>\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"text-[10px] font-medium uppercase tracking-wide text-og-fg-subtle\">{label}</span>\n <span className=\"font-og-mono text-[11px] tabular-nums text-og-fg-muted\">{value}</span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-og-surface-2\">\n <div\n className={cn(\"h-full rounded-full transition-[width] duration-500\", fillClass)}\n style={{ width: `${pct(fillPct)}%` }}\n />\n </div>\n </div>\n );\n}\n\n/** Map a percent to a calm/warn/hot tone (no color invented — token classes). */\nfunction toneFor(p: number): \"ok\" | \"warn\" | \"hot\" {\n if (p >= 90) return \"hot\";\n if (p >= 70) return \"warn\";\n return \"ok\";\n}\n\n/** The token text color for a tone (matches the `Meter` fill ramp). */\nfunction toneTextClass(tone: \"ok\" | \"warn\" | \"hot\"): string {\n return tone === \"hot\" ? \"text-og-status-failed\" : tone === \"warn\" ? \"text-og-status-waiting\" : \"text-og-status-running\";\n}\n\n/**\n * Load average as three labeled mini-stats (1m / 5m / 15m) — an honest triple of\n * numbers, NOT a fake gauge. The whole triple is tinted by `load1`'s tone (load\n * isn't a 0..100 ratio, so we tone it but never draw a bar). Run queue rides\n * alongside as a quiet chip when there's pending work.\n */\nfunction StatTriple({\n load1,\n load5,\n load15,\n runQueue,\n}: {\n load1: number;\n load5: number;\n load15: number;\n runQueue: number;\n}) {\n // Load isn't a percent — tone by load1 against a nominal single-core ceiling\n // (≥0.9/core ≈ saturated). Used only to tint the labels/values, never a bar.\n const tone = toneFor(load1 * 100);\n const stats: Array<{ label: string; value: number }> = [\n { label: \"1m\", value: load1 },\n { label: \"5m\", value: load5 },\n { label: \"15m\", value: load15 },\n ];\n return (\n <div className=\"flex items-center justify-between gap-3\" data-metric=\"load\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <span className=\"text-[10px] font-medium uppercase tracking-wide text-og-fg-subtle\">Load</span>\n <div className=\"flex items-baseline gap-3\">\n {stats.map((s) => (\n <div key={s.label} className=\"flex items-baseline gap-1\">\n <span className={cn(\"text-[10px] font-medium uppercase tracking-wide\", toneTextClass(tone))}>\n {s.label}\n </span>\n <span className={cn(\"font-og-mono text-[12px] tabular-nums\", toneTextClass(tone))}>\n {s.value.toFixed(2)}\n </span>\n </div>\n ))}\n </div>\n </div>\n {runQueue > 0 ? (\n <div\n className=\"flex shrink-0 items-baseline gap-1.5 rounded-og-sm bg-og-surface-2 px-2 py-1 text-[11px] text-og-fg-subtle\"\n data-metric=\"runqueue\"\n >\n <span className=\"font-medium uppercase tracking-wide\">Queue</span>\n <span className=\"font-og-mono tabular-nums text-og-fg-muted\">{runQueue}</span>\n </div>\n ) : null}\n </div>\n );\n}\n\n/**\n * Per-machine resource meters: CPU%, load average, memory, disk, and GPU when\n * present. Renders the M2 `machine_metrics_latest` sample. When `metrics` is\n * null the panel shows a quiet \"no samples yet\" placeholder (offline / just\n * enrolled). GPU rows only render when `gpuUtilPct` is non-null.\n */\nexport function MachineMetrics({ metrics, density = \"compact\", className }: MachineMetricsProps) {\n if (!metrics) {\n return (\n <div className={cn(\"text-[11px] text-og-fg-subtle\", className)} data-metrics-empty>\n No metrics yet\n </div>\n );\n }\n\n const memPct = metrics.memTotalBytes > 0 ? (metrics.memUsedBytes / metrics.memTotalBytes) * 100 : 0;\n const diskPct = metrics.diskTotalBytes > 0 ? (metrics.diskUsedBytes / metrics.diskTotalBytes) * 100 : 0;\n const hasGpu = metrics.gpuUtilPct !== null;\n const gpuMemLabel = metrics.gpuMemBytes !== null ? formatBytes(metrics.gpuMemBytes) : null;\n // Memory & disk are honest used/total ratios → full-width meters; stack them in\n // the dock detail, two-up in the dashboard row.\n const ratioGridClass = density === \"full\" ? \"grid-cols-1\" : \"grid-cols-1 sm:grid-cols-2\";\n\n return (\n <div className={cn(\"flex flex-col gap-3\", className)} data-machine-metrics>\n {/* Resources — used/total ratios with real 0..100% bars. */}\n <div className={cn(\"grid gap-x-4 gap-y-2.5\", ratioGridClass)}>\n <Meter\n label=\"Memory\"\n value={`${formatBytes(metrics.memUsedBytes)} / ${formatBytes(metrics.memTotalBytes)}`}\n fillPct={memPct}\n tone={toneFor(memPct)}\n />\n <Meter\n label=\"Disk\"\n value={`${formatBytes(metrics.diskUsedBytes)} / ${formatBytes(metrics.diskTotalBytes)}`}\n fillPct={diskPct}\n tone={toneFor(diskPct)}\n />\n </div>\n\n {/* Utilization — CPU% (and GPU% when present) as honest percent gauges. */}\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-2.5\">\n <Meter\n label=\"CPU\"\n value={`${metrics.cpuPct.toFixed(0)}%`}\n fillPct={metrics.cpuPct}\n tone={toneFor(metrics.cpuPct)}\n />\n {hasGpu ? (\n <Meter\n label=\"GPU\"\n value={gpuMemLabel ? `${metrics.gpuUtilPct!.toFixed(0)}% · ${gpuMemLabel}` : `${metrics.gpuUtilPct!.toFixed(0)}%`}\n fillPct={metrics.gpuUtilPct!}\n tone={toneFor(metrics.gpuUtilPct!)}\n />\n ) : null}\n </div>\n\n {/* Activity — load average as labeled mini-stats (no fake bar) + run queue. */}\n <StatTriple\n load1={metrics.load1}\n load5={metrics.load5}\n load15={metrics.load15}\n runQueue={metrics.runQueue}\n />\n </div>\n );\n}\n","import {\n CpuIcon,\n LaptopIcon,\n MonitorIcon,\n MonitorOffIcon,\n ServerIcon,\n UsersIcon,\n} from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { formatRelativeTime } from \"../lib/format\";\nimport type { MachineView } from \"../types/machines\";\nimport { MachineMetrics } from \"./machine-metrics\";\nimport { MachineStatusPill } from \"./machine-status-pill\";\n\nexport type MachineCardProps = {\n machine: MachineView;\n /** Attach/swap the session's active sandbox to this machine. */\n onAttach?: ((machine: MachineView) => void) | undefined;\n /** Whether an attach/swap is currently in flight (disables the affordance). */\n attaching?: boolean | undefined;\n className?: string | undefined;\n};\n\nfunction KindIcon({ machine }: { machine: MachineView }) {\n if (machine.isSessionGroup) return <ServerIcon className=\"size-4 text-og-fg-subtle\" aria-hidden />;\n if (machine.kind === \"modal\") return <CpuIcon className=\"size-4 text-og-fg-subtle\" aria-hidden />;\n return <LaptopIcon className=\"size-4 text-og-fg-subtle\" aria-hidden />;\n}\n\n/**\n * One machine in the Machines dashboard: name + kind + OS/arch, the composite\n * connection/state/shared status, latest resource meters, last-seen recency, and\n * an attach/swap affordance. The session's currently-active sandbox carries an\n * accent edge + an \"Active\" marker (never an attach button — it's already active).\n */\nexport function MachineCard({ machine, onAttach, attaching, className }: MachineCardProps) {\n const offline = machine.state === \"offline\";\n const attachable = !machine.active && !offline && Boolean(onAttach);\n const shared = machine.sharedSessionCount > 1;\n\n return (\n <div\n data-machine-card={machine.sandboxId}\n data-active={machine.active ? \"true\" : \"false\"}\n className={cn(\n \"og-root relative flex flex-col gap-3 overflow-hidden rounded-og-lg border border-og-border\",\n \"bg-og-surface-1 p-4 shadow-og-sm\",\n machine.active && \"border-og-accent/40\",\n className,\n )}\n >\n {machine.active ? (\n <span aria-hidden className=\"absolute inset-y-0 left-0 w-0.5 bg-og-accent\" />\n ) : null}\n\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-2.5\">\n <span className=\"mt-0.5 shrink-0\">\n <KindIcon machine={machine} />\n </span>\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"truncate text-og-base font-medium text-og-fg\">{machine.name}</span>\n {machine.active ? (\n <span\n data-active-marker\n className=\"shrink-0 rounded-full border border-og-accent/30 bg-og-accent-soft px-1.5 py-px text-og-xs font-medium text-og-accent\"\n >\n Active\n </span>\n ) : null}\n </div>\n <div className=\"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-og-xs text-og-fg-subtle\">\n <span className=\"capitalize\">{machine.isSessionGroup ? \"session sandbox\" : machine.kind}</span>\n <span aria-hidden>·</span>\n <span className=\"font-og-mono\">\n {machine.os}/{machine.arch}\n </span>\n <span aria-hidden>·</span>\n <span className=\"inline-flex items-center gap-1\">\n {machine.hasDisplay ? (\n <MonitorIcon className=\"size-3\" aria-hidden />\n ) : (\n <MonitorOffIcon className=\"size-3\" aria-hidden />\n )}\n {machine.hasDisplay ? \"display\" : \"headless\"}\n </span>\n </div>\n </div>\n </div>\n <MachineStatusPill state={machine.state} sharedSessionCount={machine.sharedSessionCount} size=\"sm\" className=\"shrink-0\" />\n </div>\n\n {shared ? (\n <p\n data-shared-disclosure\n className=\"flex items-center gap-1.5 rounded-og-md border border-og-accent/25 bg-og-accent-soft px-2.5 py-1.5 text-og-xs text-og-fg-muted\"\n >\n <UsersIcon className=\"size-3.5 shrink-0 text-og-accent\" aria-hidden />\n Shared — {machine.sharedSessionCount} sessions are on this machine.\n </p>\n ) : null}\n\n <MachineMetrics metrics={machine.metrics} />\n\n <div className=\"mt-1 flex items-center justify-between gap-3 text-og-xs text-og-fg-subtle\">\n <span>\n {machine.lastSeenAt ? <>Last seen {formatRelativeTime(machine.lastSeenAt)}</> : \"Never connected\"}\n </span>\n {machine.active ? (\n <span className=\"text-og-accent\">Routing here</span>\n ) : attachable ? (\n <button\n type=\"button\"\n data-attach\n disabled={attaching}\n onClick={() => onAttach?.(machine)}\n className={cn(\n \"rounded-og-sm border border-og-border px-2.5 py-1 text-og-xs font-medium text-og-fg-muted transition-colors pointer-coarse:min-h-10\",\n \"hover:border-og-border-strong hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n >\n {attaching ? \"Switching…\" : \"Attach\"}\n </button>\n ) : (\n <span className=\"text-og-fg-subtle/70\">{offline ? \"Unavailable\" : \"—\"}</span>\n )}\n </div>\n </div>\n );\n}\n","import { type ReactNode } from \"react\";\nimport { LaptopIcon, PlusIcon, RefreshCwIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport type { MachineView } from \"../types/machines\";\nimport { MachineCard } from \"./machine-card\";\n\nexport type MachinesDashboardProps = {\n machines: MachineView[];\n /** The session's active sandbox id (drives the per-card \"Active\" marker). */\n activeSandboxId?: string | null | undefined;\n loading?: boolean | undefined;\n error?: Error | null | undefined;\n /** Attach/swap the session's active sandbox to a machine. */\n onAttach?: ((machine: MachineView) => void) | undefined;\n /** The sandbox id currently being attached/swapped to (disables that card). */\n attachingSandboxId?: string | null | undefined;\n /** Open the enrollment flow (the \"Enroll a machine\" CTA). */\n onEnroll?: (() => void) | undefined;\n onRefresh?: (() => void) | undefined;\n className?: string | undefined;\n};\n\nfunction EmptyState({ onEnroll }: { onEnroll?: (() => void) | undefined }) {\n return (\n <div\n data-machines-empty\n className=\"flex flex-col items-center justify-center gap-3 rounded-og-lg border border-dashed border-og-border bg-og-surface-1 px-6 py-12 text-center\"\n >\n <span className=\"flex size-10 items-center justify-center rounded-full bg-og-surface-2 text-og-fg-subtle\">\n <LaptopIcon className=\"size-5\" aria-hidden />\n </span>\n <div className=\"space-y-1\">\n <p className=\"text-og-base font-medium text-og-fg\">No machines yet</p>\n <p className=\"max-w-xs text-og-sm text-og-fg-muted\">\n Enroll your own computer to run the agent on it — your files, your terminal, your desktop.\n </p>\n </div>\n {onEnroll ? (\n <button\n type=\"button\"\n data-enroll-cta\n onClick={onEnroll}\n className=\"inline-flex items-center gap-1.5 rounded-og-sm bg-og-accent px-3 py-1.5 text-og-sm font-medium text-og-accent-fg transition-colors hover:bg-og-accent-strong pointer-coarse:min-h-10\"\n >\n <PlusIcon className=\"size-3.5\" aria-hidden />\n Enroll a machine\n </button>\n ) : null}\n </div>\n );\n}\n\nfunction Header({\n count,\n onEnroll,\n onRefresh,\n loading,\n}: {\n count: number;\n onEnroll?: (() => void) | undefined;\n onRefresh?: (() => void) | undefined;\n loading?: boolean | undefined;\n}): ReactNode {\n return (\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-baseline gap-2\">\n <h2 className=\"text-og-base font-semibold text-og-fg\">Machines</h2>\n <span className=\"font-og-mono text-og-xs text-og-fg-subtle\">{count}</span>\n </div>\n <div className=\"flex items-center gap-1.5\">\n {onRefresh ? (\n <button\n type=\"button\"\n data-refresh\n onClick={onRefresh}\n title=\"Refresh\"\n className=\"rounded-og-sm p-1.5 text-og-fg-subtle transition-colors hover:bg-og-surface-2 hover:text-og-fg\"\n >\n <RefreshCwIcon className={cn(\"size-3.5\", loading && \"animate-og-spin\")} aria-hidden />\n </button>\n ) : null}\n {onEnroll ? (\n <button\n type=\"button\"\n data-enroll-cta\n onClick={onEnroll}\n className=\"inline-flex items-center gap-1.5 rounded-og-sm border border-og-border px-2.5 py-1 text-og-sm font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg pointer-coarse:min-h-10\"\n >\n <PlusIcon className=\"size-3.5\" aria-hidden />\n Enroll machine\n </button>\n ) : null}\n </div>\n </div>\n );\n}\n\n/**\n * The workspace Machines dashboard: the fleet of selfhosted enrollments + the\n * session's managed sandbox, each with its connection-status pill, state badges,\n * latest metrics, and an attach/swap affordance. Renders the empty state (no\n * machines → enroll CTA), a load error, and the populated grid. The component\n * is purely presentational — feed it `MachinesResponse` data via `useMachines`.\n */\nexport function MachinesDashboard({\n machines,\n activeSandboxId,\n loading,\n error,\n onAttach,\n attachingSandboxId,\n onEnroll,\n onRefresh,\n className,\n}: MachinesDashboardProps) {\n const isEmpty = !loading && !error && machines.length === 0;\n\n return (\n <section data-machines-dashboard className={cn(\"og-root flex flex-col gap-3\", className)}>\n <Header count={machines.length} onEnroll={onEnroll} onRefresh={onRefresh} loading={loading} />\n\n {error ? (\n <div\n data-machines-error\n className=\"flex flex-wrap items-center justify-between gap-2 rounded-og-md border border-og-status-failed/30 bg-og-status-failed/10 px-3 py-2 text-og-sm text-og-status-failed\"\n >\n <span>Could not load machines: {error.message}</span>\n {onRefresh ? (\n <button\n type=\"button\"\n data-machines-retry\n onClick={onRefresh}\n disabled={loading}\n className=\"inline-flex items-center gap-1.5 rounded-og-sm border border-og-status-failed/30 px-2 py-1 text-og-xs font-medium transition-colors hover:border-og-status-failed/50 disabled:cursor-not-allowed disabled:opacity-60 pointer-coarse:min-h-10\"\n >\n <RefreshCwIcon className={cn(\"size-3.5\", loading && \"animate-og-spin\")} aria-hidden />\n {loading ? \"Retrying…\" : \"Retry\"}\n </button>\n ) : null}\n </div>\n ) : null}\n\n {loading && machines.length === 0 ? (\n <div data-machines-loading className=\"grid gap-3 sm:grid-cols-2\">\n {[0, 1].map((i) => (\n <div key={i} className=\"h-36 animate-og-pulse rounded-og-lg border border-og-border bg-og-surface-1\" />\n ))}\n </div>\n ) : isEmpty ? (\n <EmptyState onEnroll={onEnroll} />\n ) : (\n <div className=\"grid gap-3 sm:grid-cols-2 xl:grid-cols-3\" data-machines-grid>\n {machines.map((machine) => (\n <MachineCard\n key={machine.sandboxId}\n machine={{ ...machine, active: machine.active || machine.sandboxId === activeSandboxId }}\n onAttach={onAttach}\n attaching={attachingSandboxId === machine.sandboxId}\n />\n ))}\n </div>\n )}\n </section>\n );\n}\n","import { LaptopIcon, CpuIcon, UsersIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport type { MachineKind, MachineState } from \"../types/machines\";\nimport { ConnectionStatusPill, MACHINE_STATE_BADGE_META } from \"./machine-status-pill\";\nimport { connectionStatusForState } from \"../types/machines\";\n\nexport type MachineDockBarProps = {\n /** The active machine's display name. */\n name: string;\n kind: MachineKind;\n state: MachineState;\n /** Live sessions sharing this whole-machine lease (>1 ⇒ shared disclosure). */\n sharedSessionCount?: number | undefined;\n className?: string | undefined;\n};\n\n/**\n * A slim bar that surfaces WHICH machine the dock surfaces (Files/Terminal/\n * Desktop) are bound to + its connection status. Mounted above the dock tabs so\n * the user always knows whether they are looking at the Modal box or their own\n * machine, and whether it is online / reconnecting / offline. The surfaces below\n * render IDENTICALLY regardless of backend — this bar is the only backend-aware\n * chrome (the dock-parity contract: selfhosted == Modal for the surfaces).\n */\nexport function MachineDockBar({ name, kind, state, sharedSessionCount, className }: MachineDockBarProps) {\n const Icon = kind === \"selfhosted\" ? LaptopIcon : CpuIcon;\n const stateBadge = MACHINE_STATE_BADGE_META[state];\n const shared = (sharedSessionCount ?? 0) > 1;\n return (\n <div\n data-machine-dock-bar\n className={cn(\n \"flex shrink-0 items-center justify-between gap-2 border-b border-og-border bg-og-surface-1 px-2.5 py-1\",\n className,\n )}\n >\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <Icon className=\"size-3.5 shrink-0 text-og-fg-subtle\" aria-hidden />\n <span className=\"truncate text-[11px] font-medium text-og-fg\">{name}</span>\n {stateBadge ? (\n <span\n data-state-badge={state}\n className={cn(\"shrink-0 rounded-full border px-1.5 py-px text-[10px] font-medium\", stateBadge.badgeClassName)}\n >\n {stateBadge.label}\n </span>\n ) : null}\n </div>\n <ConnectionStatusPill status={connectionStatusForState(state)} size=\"sm\" className=\"shrink-0\" />\n </div>\n );\n}\n\nexport type SharedMachineDisclosureProps = {\n sharedSessionCount: number;\n /** Compact (inline strip) vs full (a notice block). */\n density?: \"compact\" | \"full\" | undefined;\n className?: string | undefined;\n};\n\n/**\n * The \"shared — another session is on this machine\" disclosure. Surfaced in the\n * dock (and reused on the desktop take-control gate) so the user knows others are\n * driving the same whole-machine lease. Render when `sharedSessionCount > 1`.\n */\nexport function SharedMachineDisclosure({ sharedSessionCount, density = \"compact\", className }: SharedMachineDisclosureProps) {\n const others = Math.max(0, sharedSessionCount - 1);\n return (\n <div\n data-shared-disclosure\n className={cn(\n \"flex items-center gap-1.5 border-og-accent/25 bg-og-accent-soft text-og-fg-muted\",\n density === \"full\" ? \"rounded-og-md border px-3 py-2 text-[12px]\" : \"border-b px-2.5 py-1 text-[11px]\",\n className,\n )}\n >\n <UsersIcon className=\"size-3.5 shrink-0 text-og-accent\" aria-hidden />\n <span>\n Shared — {others === 1 ? \"another session is\" : `${others} other sessions are`} on this machine. They see the same\n terminal, files, and desktop.\n </span>\n </div>\n );\n}\n","import { type ReactNode } from \"react\";\nimport { CopyIcon, ExternalLinkIcon, LaptopIcon, TerminalIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport type { MachineState } from \"../types/machines\";\nimport { ConnectionStatusPill } from \"./machine-status-pill\";\n\n/** The poll state of an in-flight device-flow enrollment. */\nexport type DeviceFlowPhase = \"pending\" | \"authorized\" | \"denied\" | \"expired\" | \"disabled\";\n\nexport type EnrollmentDeviceFlowProps = {\n /** The short user code the agent printed (shown big for the human to confirm). */\n userCode: string;\n /** Where the user approves — the same-origin device page. */\n verificationUri: string;\n /** The complete URI (code pre-filled) for a one-click / QR open. */\n verificationUriComplete?: string | undefined;\n /** The install one-liner the user ran (echoed for context). Optional. */\n installCommand?: string | undefined;\n phase?: DeviceFlowPhase | undefined;\n /** Seconds remaining before the code expires (drives a quiet countdown). */\n expiresInSeconds?: number | undefined;\n onCopyCode?: (() => void) | undefined;\n onCopyInstall?: (() => void) | undefined;\n onOpenVerification?: (() => void) | undefined;\n className?: string | undefined;\n};\n\nconst PHASE_TO_STATE: Record<DeviceFlowPhase, MachineState> = {\n pending: \"enrolling\",\n authorized: \"online\",\n denied: \"offline\",\n expired: \"offline\",\n disabled: \"offline\",\n};\n\nfunction PhaseLabel({ phase }: { phase: DeviceFlowPhase }): ReactNode {\n const text: Record<DeviceFlowPhase, string> = {\n pending: \"Waiting for approval\",\n authorized: \"Connected\",\n denied: \"Denied\",\n expired: \"Code expired\",\n disabled: \"Enrollment disabled\",\n };\n return <span>{text[phase]}</span>;\n}\n\n/**\n * The IN-SESSION device-flow panel: the agent (after the install one-liner) prints\n * a short `userCode` + a `verificationUri`; this surfaces them so the user can open\n * the approve page and confirm the code. Polls in the caller; this renders the\n * pending → authorized/denied/expired progression with a connection pill. This is\n * the FIRST step of the IA flow (device-flow → Machines list → attach/swap).\n */\nexport function EnrollmentDeviceFlow({\n userCode,\n verificationUri,\n verificationUriComplete,\n installCommand,\n phase = \"pending\",\n expiresInSeconds,\n onCopyCode,\n onCopyInstall,\n onOpenVerification,\n className,\n}: EnrollmentDeviceFlowProps) {\n const href = verificationUriComplete ?? verificationUri;\n // Before the one-liner runs the caller passes a placeholder (dashes) for the\n // code — surface that as an explicit waiting state rather than dashes that look\n // like a real code to type.\n const codeIsPlaceholder = !/[A-Za-z0-9]/.test(userCode);\n const awaitingCode = phase === \"pending\" && codeIsPlaceholder;\n return (\n <div\n data-enrollment-device-flow\n className={cn(\n \"og-root flex w-full max-w-md flex-col gap-4 rounded-og-lg border border-og-border bg-og-surface-1 p-5 shadow-og-sm\",\n className,\n )}\n >\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex size-7 items-center justify-center rounded-full bg-og-surface-2 text-og-fg-muted\">\n <LaptopIcon className=\"size-4\" aria-hidden />\n </span>\n <h2 className=\"text-sm font-semibold text-og-fg\">Connect a machine</h2>\n </div>\n <ConnectionStatusPill\n status={\n PHASE_TO_STATE[phase] === \"online\"\n ? \"online\"\n : PHASE_TO_STATE[phase] === \"offline\"\n ? \"offline\"\n : \"reconnecting\"\n }\n label={(<PhaseLabel phase={phase} />) as unknown as string}\n size=\"sm\"\n />\n </div>\n\n {installCommand ? (\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-og-fg-subtle\">1 · Run on the machine</span>\n <div className=\"flex items-center justify-between gap-2 overflow-hidden rounded-og-md border border-og-border bg-og-bg px-2.5 py-1.5\">\n <code className=\"flex min-w-0 items-center gap-2 overflow-x-auto font-og-mono text-[12px] text-og-fg\">\n <TerminalIcon className=\"size-3.5 shrink-0 text-og-fg-subtle\" aria-hidden />\n {installCommand}\n </code>\n <button\n type=\"button\"\n data-copy-install\n onClick={onCopyInstall}\n title=\"Copy command\"\n className=\"shrink-0 rounded-og-sm p-1.5 text-og-fg-subtle transition-colors hover:bg-og-surface-2 hover:text-og-fg\"\n >\n <CopyIcon className=\"size-4\" aria-hidden />\n </button>\n </div>\n </div>\n ) : null}\n\n <div className=\"flex flex-col gap-1.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-og-fg-subtle\">\n {installCommand ? \"2 · Approve the machine\" : \"Approve the machine\"}\n </span>\n <div className=\"flex items-center justify-between gap-3 rounded-og-md border border-og-border bg-og-bg px-3 py-2.5\">\n {awaitingCode ? (\n <span data-user-code className=\"font-og-mono text-[13px] text-og-fg-subtle\">\n Run the command above — your code appears here\n </span>\n ) : (\n <span\n data-user-code\n className=\"select-all font-og-mono text-2xl font-semibold tracking-[0.25em] text-og-fg\"\n >\n {userCode}\n </span>\n )}\n <button\n type=\"button\"\n data-copy-code\n onClick={onCopyCode}\n disabled={awaitingCode}\n title=\"Copy code\"\n className=\"shrink-0 rounded-og-sm p-1.5 text-og-fg-subtle transition-colors hover:bg-og-surface-2 hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-og-fg-subtle\"\n >\n <CopyIcon className=\"size-4\" aria-hidden />\n </button>\n </div>\n </div>\n\n <a\n href={href}\n data-open-verification\n target=\"_blank\"\n rel=\"noreferrer\"\n onClick={onOpenVerification}\n className=\"inline-flex items-center justify-center gap-1.5 rounded-og-sm bg-og-accent px-3 py-2 text-sm font-medium text-og-accent-fg transition-colors hover:bg-og-accent-strong\"\n >\n Open approval page\n <ExternalLinkIcon className=\"size-3.5\" aria-hidden />\n </a>\n\n <p className=\"text-center text-[11px] text-og-fg-subtle\">\n {awaitingCode ? (\n <>\n The one-liner prints a short code. Open{\" \"}\n <span className=\"font-og-mono text-og-fg-muted\">{verificationUri}</span> and confirm the code shown there\n matches.\n </>\n ) : (\n <>\n Confirm code <span className=\"font-og-mono text-og-fg-muted\">{userCode}</span> — the one printed by the\n one-liner — at <span className=\"font-og-mono text-og-fg-muted\">{verificationUri}</span>.\n {typeof expiresInSeconds === \"number\" ? (\n <> Expires in {Math.max(0, Math.round(expiresInSeconds / 60))} min.</>\n ) : null}\n </>\n )}\n </p>\n </div>\n );\n}\n","import { type ReactNode, useState } from \"react\";\nimport {\n CircleAlertIcon,\n LaptopIcon,\n MonitorIcon,\n ScreenShareIcon,\n ShieldAlertIcon,\n TerminalIcon,\n UsersIcon,\n} from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\n\n/** The machine identity surfaced to the approver, from the device-flow start. */\nexport type EnrollmentConsentMachine = {\n /** Human-friendly name (hostname by default). */\n machineName: string;\n os: string;\n arch: string;\n /** The agent can offer a display (a real screen / Xvfb is available). */\n canOfferDisplay: boolean;\n /** The agent requests screen control (computer-use). */\n requestsScreenControl: boolean;\n};\n\n/** The phase of the approve page (drives the rendered panel). */\nexport type EnrollmentConsentPhase = \"review\" | \"approving\" | \"approved\" | \"denied\" | \"error\";\n\nexport type EnrollmentConsentProps = {\n /** The short code the user typed / scanned (echoed back for confirmation). */\n userCode: string;\n machine: EnrollmentConsentMachine;\n phase?: EnrollmentConsentPhase | undefined;\n /** Approve with the chosen screen-control consent. */\n onApprove?: ((allowScreenControl: boolean) => void) | undefined;\n onDeny?: (() => void) | undefined;\n /** Error message when phase === \"error\". */\n errorMessage?: string | undefined;\n className?: string | undefined;\n};\n\nfunction Capability({ icon, title, body }: { icon: ReactNode; title: string; body: string }) {\n return (\n <li className=\"flex items-start gap-2.5\">\n <span className=\"mt-0.5 shrink-0 text-og-status-failed\">{icon}</span>\n <span className=\"min-w-0\">\n <span className=\"block text-og-base font-medium text-og-fg\">{title}</span>\n <span className=\"block text-og-sm text-og-fg-muted\">{body}</span>\n </span>\n </li>\n );\n}\n\n/**\n * The user-facing APPROVE page for the device-flow enrollment: a LOUD,\n * un-minimised whole-machine consent. Approving grants the agent FULL access to\n * this machine — exec, files, terminal — and (when toggled) live screen control.\n * The danger framing is deliberate (§18 hardening: whole-machine = loud consent),\n * never buried. Renders review / approving / approved / denied / error phases.\n */\nexport function EnrollmentConsent({\n userCode,\n machine,\n phase = \"review\",\n onApprove,\n onDeny,\n errorMessage,\n className,\n}: EnrollmentConsentProps) {\n const [allowScreenControl, setAllowScreenControl] = useState(machine.requestsScreenControl);\n const busy = phase === \"approving\";\n\n if (phase === \"approved\") {\n return (\n <ConsentResult\n className={className}\n tone=\"ok\"\n title=\"Machine connected\"\n body={`${machine.machineName} is now enrolled in this workspace. You can close this page — it will appear in your Machines dashboard.`}\n />\n );\n }\n if (phase === \"denied\") {\n return (\n <ConsentResult\n className={className}\n tone=\"muted\"\n title=\"Enrollment denied\"\n body={`You declined to connect ${machine.machineName}. The agent has no access to this machine. You can re-run the install one-liner to try again.`}\n />\n );\n }\n if (phase === \"error\") {\n return (\n <ConsentResult\n className={className}\n tone=\"danger\"\n title=\"Could not complete enrollment\"\n body={errorMessage ?? \"The code may have expired. Re-run the install one-liner on the machine for a fresh code.\"}\n />\n );\n }\n\n return (\n <div\n data-enrollment-consent\n className={cn(\n \"og-root mx-auto flex w-full max-w-md flex-col gap-5 rounded-og-lg border border-og-status-failed/30 bg-og-surface-1 p-6 shadow-og-md\",\n className,\n )}\n >\n <div className=\"flex items-start gap-3\">\n <span className=\"flex size-9 shrink-0 items-center justify-center rounded-full bg-og-status-failed/15 text-og-status-failed\">\n <ShieldAlertIcon className=\"size-5\" aria-hidden />\n </span>\n <div className=\"min-w-0\">\n <h1 className=\"text-og-md font-semibold text-og-fg\">Give the agent your whole machine?</h1>\n <p className=\"mt-1 text-og-base text-og-fg-muted\">\n Approving lets the OpenGeni agent run on <span className=\"font-medium text-og-fg\">{machine.machineName}</span> with\n full access. This is your real computer — not a sandbox.\n </p>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2 rounded-og-md border border-og-border bg-og-surface-2 px-3 py-2 text-og-sm\">\n <LaptopIcon className=\"size-4 text-og-fg-subtle\" aria-hidden />\n <span className=\"font-medium text-og-fg\">{machine.machineName}</span>\n <span className=\"font-og-mono text-og-fg-subtle\">\n {machine.os}/{machine.arch}\n </span>\n <span aria-hidden className=\"text-og-fg-subtle\">·</span>\n <span className=\"text-og-fg-subtle\">\n code <span className=\"font-og-mono font-medium text-og-fg\">{userCode}</span>\n </span>\n </div>\n\n <ul className=\"flex flex-col gap-3\">\n <Capability\n icon={<TerminalIcon className=\"size-4\" aria-hidden />}\n title=\"Read, write & run anything\"\n body=\"The agent can read and modify any file, run any command, and use your git credentials — as if it were you at the keyboard.\"\n />\n {machine.canOfferDisplay ? (\n <Capability\n icon={<MonitorIcon className=\"size-4\" aria-hidden />}\n title=\"See your screen\"\n body=\"The agent can capture this machine's display to watch what it is doing.\"\n />\n ) : null}\n <Capability\n icon={<UsersIcon className=\"size-4\" aria-hidden />}\n title=\"Shared while connected\"\n body=\"Any session in this workspace can use this machine while it is online. Disconnect the agent to revoke access instantly.\"\n />\n </ul>\n\n {machine.canOfferDisplay ? (\n <label\n data-screen-control-toggle\n className=\"flex cursor-pointer items-start gap-3 rounded-og-md border border-og-border bg-og-bg px-3 py-2.5\"\n >\n <input\n type=\"checkbox\"\n checked={allowScreenControl}\n disabled={busy}\n onChange={(e) => setAllowScreenControl(e.target.checked)}\n className=\"mt-0.5 size-4 accent-og-accent\"\n />\n <span className=\"min-w-0\">\n <span className=\"flex items-center gap-1.5 text-og-base font-medium text-og-fg\">\n <ScreenShareIcon className=\"size-3.5 text-og-fg-muted\" aria-hidden />\n Also let the agent control my mouse & keyboard\n </span>\n <span className=\"mt-0.5 block text-og-sm text-og-fg-muted\">\n Optional. Enables computer-use — the agent can move the pointer, type, and click on this machine's desktop. Leave\n off to let it only watch.\n </span>\n </span>\n </label>\n ) : (\n <p className=\"flex items-start gap-2 rounded-og-md border border-og-border bg-og-bg px-3 py-2 text-og-sm text-og-fg-muted\">\n <CircleAlertIcon className=\"mt-px size-3.5 shrink-0 text-og-fg-subtle\" aria-hidden />\n This machine has no display, so screen control isn't available — files, terminal, and git only.\n </p>\n )}\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n data-deny\n disabled={busy}\n onClick={() => onDeny?.()}\n className=\"flex-1 rounded-og-sm border border-og-border px-3 py-2 text-og-sm font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg disabled:opacity-50 pointer-coarse:min-h-10\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n data-approve\n disabled={busy}\n onClick={() => onApprove?.(allowScreenControl)}\n className=\"flex-1 rounded-og-sm bg-og-status-failed px-3 py-2 text-og-sm font-semibold text-og-accent-fg transition-colors hover:opacity-90 disabled:opacity-50 pointer-coarse:min-h-10\"\n >\n {busy ? \"Connecting…\" : \"Grant full access\"}\n </button>\n </div>\n </div>\n );\n}\n\nfunction ConsentResult({\n tone,\n title,\n body,\n className,\n}: {\n tone: \"ok\" | \"muted\" | \"danger\";\n title: string;\n body: string;\n className?: string | undefined;\n}) {\n const ring =\n tone === \"ok\"\n ? \"border-og-status-running/30\"\n : tone === \"danger\"\n ? \"border-og-status-failed/30\"\n : \"border-og-border\";\n const iconClass =\n tone === \"ok\" ? \"text-og-status-running\" : tone === \"danger\" ? \"text-og-status-failed\" : \"text-og-fg-subtle\";\n return (\n <div\n data-enrollment-result={tone}\n className={cn(\n \"og-root mx-auto flex w-full max-w-md flex-col items-center gap-3 rounded-og-lg border bg-og-surface-1 p-6 text-center shadow-og-md\",\n ring,\n className,\n )}\n >\n <span className={cn(\"flex size-10 items-center justify-center rounded-full bg-og-surface-2\", iconClass)}>\n <LaptopIcon className=\"size-5\" aria-hidden />\n </span>\n <h1 className=\"text-og-md font-semibold text-og-fg\">{title}</h1>\n <p className=\"max-w-sm text-og-base text-og-fg-muted\">{body}</p>\n </div>\n );\n}\n","import { useCallback, useState } from \"react\";\nimport { useOpenGeni, type ClientOverride } from \"../provider\";\nimport { useMutationRunner, usePolledValue } from \"./internal\";\nimport type { MachinesResponse, MachineView, MetricSample } from \"../types/machines\";\n\n/**\n * The slice of the SDK client the Machines surface needs. The method NAMES +\n * SIGNATURES match M10's `OpenGeniClient` (`listMachines`, `machineMetricsSeries`)\n * so the real SDK client satisfies this surface DIRECTLY for the read paths — no\n * adapter needed. It is declared structurally (not a hard `OpenGeniClient` Pick)\n * so a test/demo/Geni-frontend client can stand in, keeping the hook dual-consumer\n * safe (works in apps/web AND the separate Geni frontend).\n *\n * The active-sandbox SWAP is now a typed SDK call (`swapActiveSandbox`, the M7\n * user-authenticated REST equivalent of the `sandbox_swap` MCP tool). The real\n * SDK client satisfies it structurally, so the default attach path is wired\n * WHENEVER a sessionId is in scope (the swap is session-scoped). `attachMachine`\n * stays an OPTIONAL escape hatch for a host that wants to supply its own swap\n * adapter; when neither it nor a sessionId is present, attach is a no-op and the\n * card hides the button.\n */\nexport type MachinesClientLike = {\n /** GET /v1/workspaces/:ws/machines — the dashboard list + active pointer. */\n listMachines: (workspaceId: string, options?: { sessionId?: string }) => Promise<MachinesResponse>;\n /** GET .../machines/:enrollmentId/metrics/series — the downsampled history. */\n machineMetricsSeries?: (\n workspaceId: string,\n enrollmentId: string,\n options?: { window?: \"15m\" | \"1h\" | \"6h\" | \"24h\" },\n ) => Promise<MetricSample[]>;\n /**\n * POST .../sessions/:sessionId/active-sandbox — swap the session's active\n * sandbox to a machine. The default swap path; the real SDK client provides it.\n */\n swapActiveSandbox?: (\n workspaceId: string,\n sessionId: string,\n request: { target: string },\n ) => Promise<unknown>;\n /**\n * Host-supplied swap adapter (an escape hatch). When present it wins over the\n * default `swapActiveSandbox` path. Session-scoped, like the swap it backs.\n */\n attachMachine?: (workspaceId: string, sessionId: string, sandboxId: string) => Promise<unknown>;\n};\n\nexport type UseMachinesOptions = ClientOverride & {\n pollIntervalMs?: number | undefined;\n enabled?: boolean | undefined;\n /** Scope the list to a session (adds the synthetic Modal group box + pointer). */\n sessionId?: string | undefined;\n /**\n * Override the client with one implementing `MachinesClientLike`. Defaults to\n * the provider client cast to the surface (the real SDK client satisfies the\n * read paths). An app supplies an adapter to wire `attachMachine` (the swap).\n */\n machinesClient?: MachinesClientLike | undefined;\n};\n\nexport type UseMachinesResult = {\n machines: MachineView[];\n activeSandboxId: string | null;\n activeEpoch: number;\n loading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Attach/swap the session's active sandbox to a machine (returns the new pointer). */\n attach: (sandboxId: string) => Promise<boolean>;\n /** Whether the host wired an attach/swap path (drives the card affordance). */\n canAttach: boolean;\n /** Fetch a downsampled metric series for one enrolled machine. */\n fetchSeries: (enrollmentId: string, window?: \"15m\" | \"1h\" | \"6h\" | \"24h\") => Promise<MetricSample[]>;\n attaching: boolean;\n /** The sandbox id of the in-flight attach (for per-card spinner gating). */\n attachingSandboxId: string | null;\n mutationError: Error | null;\n clearMutationError: () => void;\n};\n\nconst EMPTY: MachinesResponse = { activeSandboxId: null, activeEpoch: 0, machines: [] };\n\n/**\n * The workspace Machines fleet: the selfhosted enrollments + the session's Modal\n * box, each with latest metrics + state, plus the active-sandbox pointer. Polls\n * the M10 `GET /machines` endpoint and exposes attach/swap + a metric-series\n * fetch. Renders via `<MachinesDashboard>`. Dual-consumer safe: it reads only the\n * structural `MachinesClientLike` surface, so it works in apps/web AND the Geni\n * frontend (each provides its own client/adapter).\n */\nexport function useMachines(options: UseMachinesOptions = {}): UseMachinesResult {\n const { client, workspaceId } = useOpenGeni(options);\n const machinesClient = (options.machinesClient ?? (client as unknown as MachinesClientLike)) satisfies MachinesClientLike;\n const sessionId = options.sessionId;\n\n const load = useCallback(async () => {\n return await machinesClient.listMachines(workspaceId, sessionId ? { sessionId } : undefined);\n }, [machinesClient, workspaceId, sessionId]);\n\n const state = usePolledValue(load, { pollIntervalMs: options.pollIntervalMs, enabled: options.enabled });\n const mutation = useMutationRunner();\n // The sandbox id of the in-flight attach (drives the per-card spinner).\n const [attachingSandboxId, setAttachingSandboxId] = useState<string | null>(null);\n\n const data = state.data ?? EMPTY;\n // The swap is session-scoped: a host adapter (`attachMachine`) wins; otherwise\n // the default `swapActiveSandbox` path is wired whenever a sessionId is in\n // scope. Either way attach needs a sessionId to point at.\n const canAttach =\n sessionId !== undefined &&\n (typeof machinesClient.attachMachine === \"function\" ||\n typeof machinesClient.swapActiveSandbox === \"function\");\n\n const attach = useCallback(\n async (sandboxId: string): Promise<boolean> => {\n if (sessionId === undefined) return false;\n const runSwap = machinesClient.attachMachine\n ? () => machinesClient.attachMachine!(workspaceId, sessionId, sandboxId)\n : machinesClient.swapActiveSandbox\n ? () => machinesClient.swapActiveSandbox!(workspaceId, sessionId, { target: sandboxId })\n : null;\n if (!runSwap) return false;\n setAttachingSandboxId(sandboxId);\n const result = await mutation.run(async () => {\n await runSwap();\n return true;\n });\n setAttachingSandboxId(null);\n if (result) await state.refresh();\n return result === true;\n },\n [machinesClient, workspaceId, sessionId, mutation.run, state.refresh],\n );\n\n const fetchSeries = useCallback(\n async (enrollmentId: string, window: \"15m\" | \"1h\" | \"6h\" | \"24h\" = \"1h\"): Promise<MetricSample[]> => {\n if (!machinesClient.machineMetricsSeries) return [];\n return await machinesClient.machineMetricsSeries(workspaceId, enrollmentId, { window });\n },\n [machinesClient, workspaceId],\n );\n\n return {\n machines: data.machines,\n activeSandboxId: data.activeSandboxId,\n activeEpoch: data.activeEpoch,\n loading: state.loading,\n error: state.error,\n refresh: state.refresh,\n attach,\n canAttach,\n fetchSeries,\n attaching: mutation.mutating,\n attachingSandboxId,\n mutationError: mutation.mutationError,\n clearMutationError: mutation.clearMutationError,\n };\n}\n","import { createContext, useContext, useMemo, type ReactNode } from \"react\";\nimport type { SessionClientLike } from \"./client\";\n\nexport type OpenGeniContextValue = {\n client: SessionClientLike;\n workspaceId: string;\n};\n\nconst OpenGeniContext = createContext<OpenGeniContextValue | null>(null);\n\nexport type OpenGeniProviderProps = {\n client: SessionClientLike;\n workspaceId: string;\n children?: ReactNode;\n};\n\n/**\n * Supplies the OpenGeni client + workspace to all hooks below it. Hooks also\n * accept `{ client, workspaceId }` overrides per call for multi-workspace UIs.\n */\nexport function OpenGeniProvider({ client, workspaceId, children }: OpenGeniProviderProps) {\n const value = useMemo(() => ({ client, workspaceId }), [client, workspaceId]);\n return <OpenGeniContext.Provider value={value}>{children}</OpenGeniContext.Provider>;\n}\n\nexport type ClientOverride = {\n client?: SessionClientLike | undefined;\n workspaceId?: string | undefined;\n};\n\n/** Resolve client + workspace from explicit overrides or the provider. */\nexport function useOpenGeni(override: ClientOverride = {}): OpenGeniContextValue {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n const workspaceId = override.workspaceId ?? context?.workspaceId;\n if (!client || !workspaceId) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client/workspace available. Wrap the tree in <OpenGeniProvider> or pass { client, workspaceId } to the hook.\",\n );\n }\n return { client, workspaceId };\n}\n\n/**\n * Resolve the client only — for hooks that are not workspace-scoped\n * (`useWorkspaces`, `useBillingUsage`).\n */\nexport function useOpenGeniClient(override: Pick<ClientOverride, \"client\"> = {}): SessionClientLike {\n const context = useContext(OpenGeniContext);\n const client = override.client ?? context?.client;\n if (!client) {\n throw new Error(\n \"@opengeni/react: no OpenGeni client available. Wrap the tree in <OpenGeniProvider> or pass { client } to the hook.\",\n );\n }\n return client;\n}\n","import type { SessionEvent } from \"@opengeni/sdk\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { SessionClientLike } from \"../client\";\n\nexport type AsyncListState<T> = {\n data: T | null;\n loading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n};\n\n/**\n * Shared fetch + optional polling loop for the list/read hooks. Stale\n * responses (superseded by a newer load or an unmount) are dropped.\n */\nexport function usePolledValue<T>(load: () => Promise<T>, options: { pollIntervalMs?: number | undefined; enabled?: boolean | undefined } = {}): AsyncListState<T> {\n const enabled = options.enabled ?? true;\n const pollIntervalMs = options.pollIntervalMs;\n const [data, setData] = useState<T | null>(null);\n const [loading, setLoading] = useState(enabled);\n const [error, setError] = useState<Error | null>(null);\n const generation = useRef(0);\n const loadRef = useRef(load);\n\n // A new loader identity means a new query (different session/workspace/...):\n // drop the previous result instead of showing it as the new query's data.\n useEffect(() => {\n if (loadRef.current !== load) {\n loadRef.current = load;\n setData(null);\n setError(null);\n }\n }, [load]);\n\n const run = useCallback(async () => {\n const ticket = ++generation.current;\n try {\n const result = await load();\n if (ticket === generation.current) {\n setData(result);\n setError(null);\n setLoading(false);\n }\n } catch (cause) {\n if (ticket === generation.current) {\n setError(cause instanceof Error ? cause : new Error(String(cause)));\n setLoading(false);\n }\n }\n }, [load]);\n\n useEffect(() => {\n if (!enabled) {\n setLoading(false);\n return;\n }\n setLoading(true);\n void run();\n if (pollIntervalMs === undefined || pollIntervalMs <= 0) {\n return () => {\n generation.current += 1;\n };\n }\n const timer = setInterval(() => void run(), pollIntervalMs);\n return () => {\n clearInterval(timer);\n generation.current += 1;\n };\n }, [run, enabled, pollIntervalMs]);\n\n return { data, loading, error, refresh: run };\n}\n\nexport type MutationState = {\n mutating: boolean;\n mutationError: Error | null;\n clearMutationError: () => void;\n};\n\n/**\n * Shared async mutation runner for the write hooks. `run` resolves with the\n * operation's value, or `null` after capturing the error in `mutationError`\n * (callers then roll back optimistic state).\n */\nexport function useMutationRunner(): MutationState & {\n run: <T>(operation: () => Promise<T>) => Promise<T | null>;\n} {\n const [mutating, setMutating] = useState(false);\n const [mutationError, setMutationError] = useState<Error | null>(null);\n const inFlight = useRef(0);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const run = useCallback(async <T,>(operation: () => Promise<T>): Promise<T | null> => {\n inFlight.current += 1;\n if (mounted.current) {\n setMutating(true);\n setMutationError(null);\n }\n try {\n return await operation();\n } catch (cause) {\n if (mounted.current) {\n setMutationError(cause instanceof Error ? cause : new Error(String(cause)));\n }\n return null;\n } finally {\n inFlight.current -= 1;\n if (mounted.current && inFlight.current === 0) {\n setMutating(false);\n }\n }\n }, []);\n return {\n mutating,\n mutationError,\n clearMutationError: useCallback(() => setMutationError(null), []),\n run,\n };\n}\n\nexport type SessionEventFeedOptions = {\n /**\n * Share an existing event log (from `useSessionEvents`) instead of opening\n * a second stream. When omitted the hook tails the session's event stream\n * itself, starting at the current `lastSequence`.\n */\n events?: SessionEvent[] | undefined;\n enabled?: boolean | undefined;\n};\n\n/**\n * Invoke `onEvent` for every session event matching `match` — the live-update\n * primitive behind `useTurnQueue` and `useGoal`. Either watches a shared\n * `events` log or tails the stream directly (reconnect handled by the SDK).\n */\nexport function useSessionEventTrigger(\n client: SessionClientLike,\n workspaceId: string,\n sessionId: string | null | undefined,\n match: (event: SessionEvent) => boolean,\n onEvent: (event: SessionEvent) => void,\n options: SessionEventFeedOptions = {},\n): void {\n const enabled = options.enabled ?? true;\n const events = options.events;\n const sharedFeed = events !== undefined;\n const matchRef = useRef(match);\n matchRef.current = match;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const consumedRef = useRef(0);\n const feedKeyRef = useRef<string | null>(null);\n\n // Shared-log mode: scan only the unseen tail on every append.\n useEffect(() => {\n if (!sharedFeed || !enabled || !sessionId) {\n return;\n }\n const feedKey = `${workspaceId}\\u0000${sessionId}`;\n const firstSequence = events[0]?.sequence ?? 0;\n // A new session target or a log reset (sequence restarted below the\n // cursor) restarts consumption from the top of the shared log.\n if (feedKeyRef.current !== feedKey || firstSequence > consumedRef.current + 1) {\n feedKeyRef.current = feedKey;\n consumedRef.current = 0;\n }\n for (const event of events) {\n if (event.sequence <= consumedRef.current) {\n continue;\n }\n consumedRef.current = event.sequence;\n if (matchRef.current(event)) {\n onEventRef.current(event);\n }\n }\n }, [sharedFeed, enabled, events, workspaceId, sessionId]);\n\n // Self-stream mode: tail from the session's current lastSequence.\n useEffect(() => {\n if (sharedFeed || !enabled || !sessionId) {\n return;\n }\n const controller = new AbortController();\n void (async () => {\n try {\n const session = await client.getSession(workspaceId, sessionId);\n if (controller.signal.aborted) {\n return;\n }\n const stream = client.streamEvents(workspaceId, sessionId, {\n after: session.lastSequence,\n signal: controller.signal,\n });\n for await (const event of stream) {\n if (matchRef.current(event)) {\n onEventRef.current(event);\n }\n }\n } catch {\n // Live updates are best-effort: the read hooks still expose refresh()\n // and the initial load already populated state.\n }\n })();\n return () => {\n controller.abort();\n };\n }, [sharedFeed, enabled, client, workspaceId, sessionId]);\n}\n\n/** Debounce rapid event bursts into one trailing call (default 150ms). */\nexport function useDebouncedCallback(callback: () => void, delayMs = 150): () => void {\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => {\n return () => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n };\n }, []);\n return useCallback(() => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n callbackRef.current();\n }, delayMs);\n }, [delayMs]);\n}\n"],"mappings":";AAgDO,SAAS,yBAAyB,OAAuC;AAC9E,UAAQ,OAAO;AAAA,IACb,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAEH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,SAAS;AAEP,YAAM,SAAgB;AACtB,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;AClEA,SAAS,YAA6B;AACtC,SAAS,2BAA2B;AAapC,IAAM,UAAU,oBAAoB;AAAA,EAClC,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,aAAa,CAAC,EAAE,MAAM,CAAC,SAAS,SAAS,WAAW,OAAO,EAAE,CAAC;AAAA,IAChE;AAAA,EACF;AACF,CAAC;AAGM,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACqDI,SASE,KATF;AA9DG,IAAM,yBAAyE;AAAA,EACpF,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,OAAO;AAAA,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U,eAAe,gBAC3B,MAAM,eAAe,cAAe,aAAa,WAAW,SAAS,IACrE,eAAe,oBACb,MAAM,eAAe,kBAAmB,aAAa,WAAW,EAAE,QAAQ,UAAU,CAAC,IACrF;AACN,UAAI,CAAC,QAAS,QAAO;AACrB,4BAAsB,SAAS;AAC/B,YAAM,SAAS,MAAM,SAAS,IAAI,YAAY;AAC5C,cAAM,QAAQ;AACd,eAAO;AAAA,MACT,CAAC;AACD,4BAAsB,IAAI;AAC1B,UAAI,OAAQ,OAAM,MAAM,QAAQ;AAChC,aAAO,WAAW;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,aAAa,WAAW,SAAS,KAAK,MAAM,OAAO;AAAA,EACtE;AAEA,QAAM,cAAcA;AAAA,IAClB,OAAO,cAAsB,SAAsC,SAAkC;AACnG,UAAI,CAAC,eAAe,qBAAsB,QAAO,CAAC;AAClD,aAAO,MAAM,eAAe,qBAAqB,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,IACxF;AAAA,IACA,CAAC,gBAAgB,WAAW;AAAA,EAC9B;AAEA,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,iBAAiB,KAAK;AAAA,IACtB,aAAa,KAAK;AAAA,IAClB,SAAS,MAAM;AAAA,IACf,OAAO,MAAM;AAAA,IACb,SAAS,MAAM;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,SAAS;AAAA,IACpB;AAAA,IACA,eAAe,SAAS;AAAA,IACxB,oBAAoB,SAAS;AAAA,EAC/B;AACF;","names":["jsx","jsxs","jsx","jsxs","LaptopIcon","jsx","jsxs","LaptopIcon","LaptopIcon","CpuIcon","UsersIcon","jsx","jsxs","LaptopIcon","CpuIcon","UsersIcon","LaptopIcon","Fragment","jsx","jsxs","LaptopIcon","LaptopIcon","MonitorIcon","TerminalIcon","UsersIcon","jsx","jsxs","LaptopIcon","TerminalIcon","MonitorIcon","UsersIcon","useCallback","useState","jsx","useState","useCallback","useState"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,10 @@ type NoticeItem = {
|
|
|
137
137
|
id: string;
|
|
138
138
|
tone: "waiting" | "cancelled" | "failed";
|
|
139
139
|
text: string;
|
|
140
|
+
action?: {
|
|
141
|
+
label: string;
|
|
142
|
+
url: string;
|
|
143
|
+
};
|
|
140
144
|
occurredAt: string;
|
|
141
145
|
};
|
|
142
146
|
type TurnOutcome = "complete" | "failed" | "cancelled";
|
|
@@ -171,6 +175,13 @@ type TimelineGroup = {
|
|
|
171
175
|
};
|
|
172
176
|
|
|
173
177
|
declare function buildTimeline(events: SessionEvent[]): TimelineItem[];
|
|
178
|
+
/**
|
|
179
|
+
* Whether the session's most recent turn ended in credit exhaustion — the
|
|
180
|
+
* terminal credit state apps key their "add credits" affordances on. Derived
|
|
181
|
+
* from the LAST turn-end event (completed/failed/cancelled): a later turn that
|
|
182
|
+
* settles any other way (someone topped up and kept working) clears it.
|
|
183
|
+
*/
|
|
184
|
+
declare function creditExhaustedFromEvents(events: SessionEvent[]): boolean;
|
|
174
185
|
/** The latest session status carried in the event log, if any. */
|
|
175
186
|
declare function sessionStatusFromEvents(events: SessionEvent[]): SessionStatus$1 | null;
|
|
176
187
|
declare function groupTimeline(items: TimelineItem[]): TimelineGroup[];
|
|
@@ -399,7 +410,12 @@ declare function DisclosureDefaultsProvider({ defaultOpen, children }: {
|
|
|
399
410
|
type TurnSummaryProps = {
|
|
400
411
|
/** The activity items in the turn (used only to compute the facet counts). */
|
|
401
412
|
items: ActivityItem[];
|
|
402
|
-
|
|
413
|
+
/**
|
|
414
|
+
* The settled verdict — or absent for a completed CLUSTER of a still-running
|
|
415
|
+
* turn, which folds neutrally: no verdict glyph (the turn has none yet), a
|
|
416
|
+
* quiet pulse dot in its place so alignment and the running feel both hold.
|
|
417
|
+
*/
|
|
418
|
+
outcome?: TurnOutcome | undefined;
|
|
403
419
|
/** A short failure reason shown inline on a failed chip (never hidden). */
|
|
404
420
|
failureText?: string | undefined;
|
|
405
421
|
/** Elapsed turn duration; shown as a trailing facet when at least 1s. */
|
|
@@ -2157,15 +2173,36 @@ declare function truncate(text: string, maxLength: number): string;
|
|
|
2157
2173
|
declare function stringifyPayload(value: unknown): string;
|
|
2158
2174
|
/** JSON.parse that returns `undefined` instead of throwing. */
|
|
2159
2175
|
declare function tryParseJson(text: string): unknown;
|
|
2176
|
+
/**
|
|
2177
|
+
* The canonical credit-death sentence. Credit exhaustion is the one failure a
|
|
2178
|
+
* user can fix themselves — the copy must say what happened (empty balance),
|
|
2179
|
+
* what to do (add credits), and what is safe (nothing was lost). Crucially it
|
|
2180
|
+
* must NOT say "send a message to revive": a revive turn burns credits the
|
|
2181
|
+
* workspace no longer has.
|
|
2182
|
+
*/
|
|
2183
|
+
declare const CREDIT_EXHAUSTION_MESSAGE = "Out of OpenGeni credits \u2014 this workspace's balance is empty. Add credits to continue; the conversation is preserved.";
|
|
2184
|
+
/**
|
|
2185
|
+
* Does this failure/completion payload (or raw error string) mean the
|
|
2186
|
+
* workspace ran out of OpenGeni credits? Matches the engine's
|
|
2187
|
+
* "insufficient OpenGeni credits" text (case-insensitive, substring — it
|
|
2188
|
+
* arrives both bare and wrapped in "Activity task failed: …") and the
|
|
2189
|
+
* budget-exhausted segment limit the engine stamps on a turn it ended early.
|
|
2190
|
+
*/
|
|
2191
|
+
declare function isCreditExhaustion(input: {
|
|
2192
|
+
error?: string | null;
|
|
2193
|
+
detail?: string | null;
|
|
2194
|
+
segmentLimit?: string | null;
|
|
2195
|
+
} | string): boolean;
|
|
2160
2196
|
/**
|
|
2161
2197
|
* Humanize engine/provider failure text before it reaches the timeline or a
|
|
2162
2198
|
* failure banner. Raw provider errors leak the wrong audience's instructions —
|
|
2163
2199
|
* "Incorrect API key … find your API key at platform.openai.com" tells a
|
|
2164
2200
|
* managed-deployment USER to fix credentials only an OPERATOR controls (and is
|
|
2165
|
-
* flatly wrong for Azure or subscription-backed engines). Auth and
|
|
2166
|
-
* failures collapse to one neutral, honest sentence; every
|
|
2167
|
-
* through untouched. Raw payloads stay available in the
|
|
2201
|
+
* flatly wrong for Azure or subscription-backed engines). Auth, quota, and
|
|
2202
|
+
* credit-exhaustion failures collapse to one neutral, honest sentence; every
|
|
2203
|
+
* other reason passes through untouched. Raw payloads stay available in the
|
|
2204
|
+
* debug surfaces.
|
|
2168
2205
|
*/
|
|
2169
2206
|
declare function humanizeFailureReason(reason: string | null): string | null;
|
|
2170
2207
|
|
|
2171
|
-
export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, BodyNote, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type ComposerMode, type ComposerSendExtras, type ComposerState, type ConfirmState, type CreateToolRegistryOptions, DesktopViewer, type DesktopViewerProps, type DesktopWebSocketFactory, type DesktopWebSocketLike, type DiffTheme, DiffView, type DiffViewProps, type DisclosureChip, DisclosureDefaultsProvider, FILE_ONLY_MESSAGE_TEXT, type FileAttachment, FileBrowser, type FileBrowserProps, type FileTreeNode, type FileTreeStatus, FleetTile, type FleetTileProps, type GoalItem, LightboxProvider, Markdown, type MarkdownProps, MediaEmpty, MediaSkeleton, MessageTimeline, type MessageTimelineProps, ModelPicker, type ModelPickerProps, type Notice, type NoticeItem, type ParsedCommandLine, PayloadBlock, type PendingApproval, PierreDiff, type PierreDiffProps, PierreFile, type PierreFileProps, type ReasoningItem, SESSION_STATUS_META, SandboxFiles, type SandboxFilesProps, type SandboxItem, SandboxTerminal, type SandboxTerminalProps, ScreenshotFigure, type SessionCapabilitiesState, SessionClientLike, type SessionEventsConnectionState, SessionStatus, type SessionStatusItem, type SessionStatusMeta, type SessionStatusProps, type SlashArg, type SlashCommand, type SlashCommandContext, type SlashCommandHandlers, StatusDot, type StatusDotProps, TermBlock, type TerminalChunk, type TerminalStreamStatus, Thumbnail, type TimelineGroup, type TimelineItem, TimelineRow, type ToolCallItem, type ToolRegistry, type ToolRegistryEntry, type ToolRenderer, type ToolRendererProps, type TurnEndItem, type TurnOutcome, TurnSummary, type TurnSummaryProps, type UseAvailableModelsOptions, type UseAvailableModelsResult, type UseBillingUsageOptions, type UseBillingUsageResult, type UseCodexAccountsOptions, type UseCodexAccountsResult, type UseComposerOptions, type UseDesktopStreamOptions, type UseDesktopStreamResult, type UseEnvironmentsOptions, type UseEnvironmentsResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseGoalOptions, type UseGoalResult, type UsePacksOptions, type UsePacksResult, type UseRelayFrameStreamOptions, type UseRelayFrameStreamResult, type UseSandboxFilesOptions, type UseSandboxFilesResult, type UseSandboxGitOptions, type UseSandboxGitResult, type UseSandboxTerminalOptions, type UseSandboxTerminalResult, type UseScheduledTasksOptions, type UseScheduledTasksResult, type UseSessionCapabilitiesOptions, type UseSessionCapabilitiesResult, type UseSessionControlOptions, type UseSessionControlResult, type UseSessionEventsOptions, type UseSessionEventsResult, type UseSessionOptions, type UseSessionResult, type UseSlashCommandsOptions, type UseSlashCommandsResult, type UseTerminalStreamOptions, type UseTerminalStreamResult, type UseTurnQueueOptions, type UseTurnQueueResult, type UseWorkspaceSessionsOptions, type UseWorkspaceSessionsResult, type UseWorkspacesOptions, type UseWorkspacesResult, type UserMessageItem, type WorkerItem, WorkspaceDock, type WorkspaceDockProps, type WorkspaceTab, type XtermTheme, activeTurnFromTurns, applyPatchOps, applyTurnEdit, applyTurnRemoval, applyTurnReorder, approvalsFromRequiresAction, argHint, buildTimeline, cn, composeSendInput, controlCaret, createDefaultToolRegistry, createToolRegistry, defaultCommands, defaultToolRegistry, execTruncated, extractSessionRef, filterCommands, firstMissingRequiredArg, formatBytes, formatRelativeTime, gitFileDiffToPatch, groupTimeline, hasPermission, humanizeFailureReason, isApplyPatch, isCodexAccountEvent, isExecSessionLostBanner, isGoalEvent, isTitleEvent, isTurnQueueEvent, languageForPath, looksBinary, matchCommand, parseCommandLine, parseExecBannerSessionId, parseToolArgs, projectPendingApprovals, queueFromTurns, rawTypeOf, redactSecrets, sandboxCommandExitCode, sessionDisplayTitle, sessionStatusFromEvents, shouldSubmitOnKey, stringifyPayload, stripExecBanner, tailPeek, toolDisplayName, truncate, tryParseJson, unwrapMcpOutput, useAvailableModels, useBillingUsage, useCodexAccounts, useComposer, useDesktopStream, useEnvironments, useFileAttachments, useGoal, useLightbox, useLightboxOptional, usePacks, useRelayFrameStream, useSandboxFiles, useSandboxGit, useSandboxTerminal, useScheduledTasks, useSession, useSessionCapabilities, useSessionControl, useSessionEvents, useSlashCommands, useTerminalStream, useTurnQueue, useWorkspaceSessions, useWorkspaces, v4aToGitFileDiff, xtermThemeFromTokens };
|
|
2208
|
+
export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, BodyNote, CREDIT_EXHAUSTION_MESSAGE, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type ComposerMode, type ComposerSendExtras, type ComposerState, type ConfirmState, type CreateToolRegistryOptions, DesktopViewer, type DesktopViewerProps, type DesktopWebSocketFactory, type DesktopWebSocketLike, type DiffTheme, DiffView, type DiffViewProps, type DisclosureChip, DisclosureDefaultsProvider, FILE_ONLY_MESSAGE_TEXT, type FileAttachment, FileBrowser, type FileBrowserProps, type FileTreeNode, type FileTreeStatus, FleetTile, type FleetTileProps, type GoalItem, LightboxProvider, Markdown, type MarkdownProps, MediaEmpty, MediaSkeleton, MessageTimeline, type MessageTimelineProps, ModelPicker, type ModelPickerProps, type Notice, type NoticeItem, type ParsedCommandLine, PayloadBlock, type PendingApproval, PierreDiff, type PierreDiffProps, PierreFile, type PierreFileProps, type ReasoningItem, SESSION_STATUS_META, SandboxFiles, type SandboxFilesProps, type SandboxItem, SandboxTerminal, type SandboxTerminalProps, ScreenshotFigure, type SessionCapabilitiesState, SessionClientLike, type SessionEventsConnectionState, SessionStatus, type SessionStatusItem, type SessionStatusMeta, type SessionStatusProps, type SlashArg, type SlashCommand, type SlashCommandContext, type SlashCommandHandlers, StatusDot, type StatusDotProps, TermBlock, type TerminalChunk, type TerminalStreamStatus, Thumbnail, type TimelineGroup, type TimelineItem, TimelineRow, type ToolCallItem, type ToolRegistry, type ToolRegistryEntry, type ToolRenderer, type ToolRendererProps, type TurnEndItem, type TurnOutcome, TurnSummary, type TurnSummaryProps, type UseAvailableModelsOptions, type UseAvailableModelsResult, type UseBillingUsageOptions, type UseBillingUsageResult, type UseCodexAccountsOptions, type UseCodexAccountsResult, type UseComposerOptions, type UseDesktopStreamOptions, type UseDesktopStreamResult, type UseEnvironmentsOptions, type UseEnvironmentsResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseGoalOptions, type UseGoalResult, type UsePacksOptions, type UsePacksResult, type UseRelayFrameStreamOptions, type UseRelayFrameStreamResult, type UseSandboxFilesOptions, type UseSandboxFilesResult, type UseSandboxGitOptions, type UseSandboxGitResult, type UseSandboxTerminalOptions, type UseSandboxTerminalResult, type UseScheduledTasksOptions, type UseScheduledTasksResult, type UseSessionCapabilitiesOptions, type UseSessionCapabilitiesResult, type UseSessionControlOptions, type UseSessionControlResult, type UseSessionEventsOptions, type UseSessionEventsResult, type UseSessionOptions, type UseSessionResult, type UseSlashCommandsOptions, type UseSlashCommandsResult, type UseTerminalStreamOptions, type UseTerminalStreamResult, type UseTurnQueueOptions, type UseTurnQueueResult, type UseWorkspaceSessionsOptions, type UseWorkspaceSessionsResult, type UseWorkspacesOptions, type UseWorkspacesResult, type UserMessageItem, type WorkerItem, WorkspaceDock, type WorkspaceDockProps, type WorkspaceTab, type XtermTheme, activeTurnFromTurns, applyPatchOps, applyTurnEdit, applyTurnRemoval, applyTurnReorder, approvalsFromRequiresAction, argHint, buildTimeline, cn, composeSendInput, controlCaret, createDefaultToolRegistry, createToolRegistry, creditExhaustedFromEvents, defaultCommands, defaultToolRegistry, execTruncated, extractSessionRef, filterCommands, firstMissingRequiredArg, formatBytes, formatRelativeTime, gitFileDiffToPatch, groupTimeline, hasPermission, humanizeFailureReason, isApplyPatch, isCodexAccountEvent, isCreditExhaustion, isExecSessionLostBanner, isGoalEvent, isTitleEvent, isTurnQueueEvent, languageForPath, looksBinary, matchCommand, parseCommandLine, parseExecBannerSessionId, parseToolArgs, projectPendingApprovals, queueFromTurns, rawTypeOf, redactSecrets, sandboxCommandExitCode, sessionDisplayTitle, sessionStatusFromEvents, shouldSubmitOnKey, stringifyPayload, stripExecBanner, tailPeek, toolDisplayName, truncate, tryParseJson, unwrapMcpOutput, useAvailableModels, useBillingUsage, useCodexAccounts, useComposer, useDesktopStream, useEnvironments, useFileAttachments, useGoal, useLightbox, useLightboxOptional, usePacks, useRelayFrameStream, useSandboxFiles, useSandboxGit, useSandboxTerminal, useScheduledTasks, useSession, useSessionCapabilities, useSessionControl, useSessionEvents, useSlashCommands, useTerminalStream, useTurnQueue, useWorkspaceSessions, useWorkspaces, v4aToGitFileDiff, xtermThemeFromTokens };
|