@opengeni/react 0.12.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +20 -14
  2. package/dist/chunk-TOJR776I.js +2280 -0
  3. package/dist/chunk-TOJR776I.js.map +1 -0
  4. package/dist/index.d.ts +1040 -363
  5. package/dist/index.js +10938 -6281
  6. package/dist/index.js.map +1 -1
  7. package/dist/{machines-BeZ3bD3t.d.ts → machines-BpdwuQcD.d.ts} +134 -14
  8. package/dist/machines.d.ts +1 -1
  9. package/dist/machines.js +23 -1
  10. package/package.json +20 -12
  11. package/src/approvals.ts +16 -4
  12. package/src/client.ts +41 -5
  13. package/src/commands/index.ts +1 -7
  14. package/src/commands/registry.ts +46 -12
  15. package/src/components/chat-composer.tsx +417 -69
  16. package/src/components/code-editor.tsx +28 -36
  17. package/src/components/command-palette.tsx +26 -5
  18. package/src/components/desktop-viewer.tsx +29 -16
  19. package/src/components/diff-view.tsx +27 -189
  20. package/src/components/enrollment-consent.tsx +28 -10
  21. package/src/components/enrollment-device-flow.tsx +8 -5
  22. package/src/components/file-browser.tsx +190 -56
  23. package/src/components/fleet-tile.tsx +13 -4
  24. package/src/components/machine-card.tsx +93 -15
  25. package/src/components/machine-dock-bar.tsx +20 -8
  26. package/src/components/machine-health-pill.tsx +68 -0
  27. package/src/components/machine-metrics.tsx +28 -19
  28. package/src/components/machine-status-pill.tsx +26 -5
  29. package/src/components/machines/health.ts +146 -0
  30. package/src/components/machines/machine-detail.tsx +220 -0
  31. package/src/components/machines/metric-history-chart.tsx +298 -0
  32. package/src/components/machines/metric-sparkline.tsx +76 -0
  33. package/src/components/machines/series.ts +113 -0
  34. package/src/components/machines-dashboard.tsx +21 -3
  35. package/src/components/markdown.tsx +39 -9
  36. package/src/components/message-timeline.tsx +633 -109
  37. package/src/components/pierre-diff.tsx +83 -15
  38. package/src/components/pierre-file.tsx +10 -9
  39. package/src/components/queue-surface.tsx +578 -0
  40. package/src/components/sandbox-files.tsx +193 -225
  41. package/src/components/sandbox-terminal.tsx +256 -88
  42. package/src/components/sandbox-workspace.tsx +957 -0
  43. package/src/components/session-status.tsx +22 -2
  44. package/src/components/workbench-changes.tsx +585 -0
  45. package/src/components/workspace-dock.tsx +213 -59
  46. package/src/hooks/internal.ts +5 -2
  47. package/src/hooks/use-available-models.ts +7 -2
  48. package/src/hooks/use-billing-usage.ts +4 -1
  49. package/src/hooks/use-codex-accounts.ts +74 -44
  50. package/src/hooks/use-composer.ts +414 -63
  51. package/src/hooks/use-environments.ts +92 -47
  52. package/src/hooks/use-file-attachments.ts +101 -55
  53. package/src/hooks/use-goal.ts +52 -16
  54. package/src/hooks/use-machine-chip.ts +134 -0
  55. package/src/hooks/use-machines.ts +34 -16
  56. package/src/hooks/use-packs.ts +24 -19
  57. package/src/hooks/use-relay-frame-stream.ts +5 -2
  58. package/src/hooks/use-rigs.ts +335 -0
  59. package/src/hooks/use-sandbox-files.ts +213 -39
  60. package/src/hooks/use-sandbox-git.ts +188 -11
  61. package/src/hooks/use-sandbox-terminal.ts +18 -14
  62. package/src/hooks/use-scheduled-tasks.ts +10 -2
  63. package/src/hooks/use-session-capabilities.ts +77 -20
  64. package/src/hooks/use-session-control.ts +50 -23
  65. package/src/hooks/use-session-events.ts +50 -21
  66. package/src/hooks/use-session-lineage.ts +128 -0
  67. package/src/hooks/use-session.ts +53 -30
  68. package/src/hooks/use-slash-commands.ts +6 -4
  69. package/src/hooks/use-turn-queue.ts +202 -147
  70. package/src/hooks/use-windowed-sections.ts +204 -0
  71. package/src/hooks/use-workspace-capture.ts +233 -0
  72. package/src/hooks/use-workspace-edit.ts +231 -0
  73. package/src/hooks/use-workspace-sessions.ts +48 -5
  74. package/src/hooks/use-workspaces.ts +18 -15
  75. package/src/index.ts +133 -23
  76. package/src/lib/format.ts +3 -3
  77. package/src/lib/xterm-renderer.ts +65 -0
  78. package/src/lib/xterm-theme.ts +224 -18
  79. package/src/machines.ts +29 -3
  80. package/src/provider.tsx +195 -6
  81. package/src/timeline/activity-rail.tsx +213 -54
  82. package/src/timeline/disclosure-context.tsx +12 -2
  83. package/src/timeline/index.ts +21 -2
  84. package/src/timeline/parsers.ts +87 -16
  85. package/src/timeline/projection.ts +412 -87
  86. package/src/timeline/shared.tsx +111 -24
  87. package/src/timeline/tool-diff.tsx +24 -20
  88. package/src/timeline/tool-renderers.tsx +98 -21
  89. package/src/timeline/turn-summary.tsx +76 -23
  90. package/src/timeline/types.ts +96 -12
  91. package/styles/index.css +22 -0
  92. package/styles/tokens.css +2 -2
  93. package/dist/chunk-5TIXRCSI.js +0 -1291
  94. package/dist/chunk-5TIXRCSI.js.map +0 -1
@@ -29,7 +29,8 @@ export function sandboxCommandExitCode(out: unknown): number | null {
29
29
  export function parseExecBannerSessionId(out: unknown): number | null {
30
30
  const text = String(out ?? "");
31
31
  const outputIdx = text.indexOf("\nOutput:\n");
32
- const banner = outputIdx >= 0 ? text.slice(0, outputIdx) : text.startsWith("Output:\n") ? "" : text;
32
+ const banner =
33
+ outputIdx >= 0 ? text.slice(0, outputIdx) : text.startsWith("Output:\n") ? "" : text;
33
34
  const match = banner.match(/Process running with session ID (\d+)/);
34
35
  if (!match) {
35
36
  return null;
@@ -53,7 +54,9 @@ export function stripExecBanner(out: unknown): string {
53
54
 
54
55
  /** The sandbox clamped the output (token/line truncation markers in the banner). */
55
56
  export function execTruncated(out: unknown): boolean {
56
- return /Total output lines:|\.{3}\d+ tokens truncated\.{3}|\[\.{3}\d+ characters truncated/.test(String(out ?? ""));
57
+ return /Total output lines:|\.{3}\d+ tokens truncated\.{3}|\[\.{3}\d+ characters truncated/.test(
58
+ String(out ?? ""),
59
+ );
57
60
  }
58
61
 
59
62
  /** A `write_stdin` whose target PTY vanished (`write_stdin failed: session not found: N`). */
@@ -71,7 +74,10 @@ export function looksBinary(text: string): boolean {
71
74
  * `write_stdin` keystroke payload reads cleanly in the row title.
72
75
  */
73
76
  export function controlCaret(printable: string): string {
74
- return String(printable).replace(/[\u0000-\u001f]/g, (c) => `^${String.fromCharCode(c.charCodeAt(0) + 64)}`);
77
+ return String(printable).replace(
78
+ /[\u0000-\u001f]/g,
79
+ (c) => `^${String.fromCharCode(c.charCodeAt(0) + 64)}`,
80
+ );
75
81
  }
76
82
 
77
83
  /* --- V4A apply_patch diff -> GitFileDiff ------------------------------------ */
@@ -100,7 +106,13 @@ export type ApplyPatchOperation = {
100
106
  */
101
107
  export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
102
108
  const status: GitFileDiff["status"] =
103
- op.type === "create_file" ? "added" : op.type === "delete_file" ? "deleted" : op.moveTo ? "renamed" : "modified";
109
+ op.type === "create_file"
110
+ ? "added"
111
+ : op.type === "delete_file"
112
+ ? "deleted"
113
+ : op.moveTo
114
+ ? "renamed"
115
+ : "modified";
104
116
  const oldPath = op.moveTo ? op.path : null;
105
117
  const path = op.moveTo || op.path;
106
118
 
@@ -136,21 +148,43 @@ export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
136
148
  // `@@ -0,0 +1,N @@` from the range fields once newLines is counted — a
137
149
  // pre-baked partial header (e.g. `@@ +1 @@`) renders zero lines in a
138
150
  // generic unified-diff parser.
139
- cur = { oldStart: 0, oldLines: 0, newStart: 1, newLines: 0, header: "", lines: [] };
151
+ cur = {
152
+ oldStart: 0,
153
+ oldLines: 0,
154
+ newStart: 1,
155
+ newLines: 0,
156
+ header: "",
157
+ lines: [],
158
+ };
140
159
  hunks.push(cur);
141
160
  oldNo = 0;
142
161
  newNo = 1;
143
162
  }
144
163
  if (raw.startsWith("+")) {
145
- cur.lines.push({ type: "add", oldNo: null, newNo: newNo++, text: raw.slice(1) });
164
+ cur.lines.push({
165
+ type: "add",
166
+ oldNo: null,
167
+ newNo: newNo++,
168
+ text: raw.slice(1),
169
+ });
146
170
  cur.newLines += 1;
147
171
  additions += 1;
148
172
  } else if (raw.startsWith("-")) {
149
- cur.lines.push({ type: "del", oldNo: oldNo++, newNo: null, text: raw.slice(1) });
173
+ cur.lines.push({
174
+ type: "del",
175
+ oldNo: oldNo++,
176
+ newNo: null,
177
+ text: raw.slice(1),
178
+ });
150
179
  cur.oldLines += 1;
151
180
  deletions += 1;
152
181
  } else {
153
- cur.lines.push({ type: "context", oldNo: oldNo++, newNo: newNo++, text: raw.replace(/^ /, "") });
182
+ cur.lines.push({
183
+ type: "context",
184
+ oldNo: oldNo++,
185
+ newNo: newNo++,
186
+ text: raw.replace(/^ /, ""),
187
+ });
154
188
  cur.oldLines += 1;
155
189
  cur.newLines += 1;
156
190
  }
@@ -163,7 +197,17 @@ export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
163
197
  }
164
198
  }
165
199
 
166
- return { path, oldPath, status, isBinary: false, isImage: false, additions, deletions, hunks, truncated: false };
200
+ return {
201
+ path,
202
+ oldPath,
203
+ status,
204
+ isBinary: false,
205
+ isImage: false,
206
+ additions,
207
+ deletions,
208
+ hunks,
209
+ truncated: false,
210
+ };
167
211
  }
168
212
 
169
213
  /**
@@ -173,7 +217,10 @@ export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
173
217
  * renderer and the turn-summary facet counter never drift.
174
218
  */
175
219
  export function applyPatchOps(raw: unknown): ApplyPatchOperation[] {
176
- const r = (raw ?? {}) as { operation?: ApplyPatchOperation; operations?: ApplyPatchOperation[] };
220
+ const r = (raw ?? {}) as {
221
+ operation?: ApplyPatchOperation;
222
+ operations?: ApplyPatchOperation[];
223
+ };
177
224
  if (Array.isArray(r.operations)) {
178
225
  return r.operations;
179
226
  }
@@ -186,7 +233,8 @@ export function applyPatchOps(raw: unknown): ApplyPatchOperation[] {
186
233
  * replays that omit `raw`). Centralizes the rawType-or-name check.
187
234
  */
188
235
  export function isApplyPatch(item: { name: string; raw: unknown }): boolean {
189
- const type = item.raw && typeof item.raw === "object" ? (item.raw as { type?: unknown }).type : undefined;
236
+ const type =
237
+ item.raw && typeof item.raw === "object" ? (item.raw as { type?: unknown }).type : undefined;
190
238
  return type === "apply_patch_call" || item.name === "apply_patch_call";
191
239
  }
192
240
 
@@ -236,7 +284,21 @@ export function tailPeek(text: string): string {
236
284
  * into a flat `{ text, isError }`. Non-MCP outputs pass through as their string
237
285
  * form.
238
286
  */
239
- export function unwrapMcpOutput(output: unknown): { text: string; isError: boolean } {
287
+ export function unwrapMcpOutput(output: unknown): {
288
+ text: string;
289
+ isError: boolean;
290
+ } {
291
+ // Managed MCP events persist a normalized single text part as
292
+ // `{ type: "text", text }`; accept it alongside the SDK-native content array.
293
+ if (
294
+ output &&
295
+ typeof output === "object" &&
296
+ (output as { type?: unknown }).type === "text" &&
297
+ typeof (output as { text?: unknown }).text === "string"
298
+ ) {
299
+ const record = output as { text: string; isError?: unknown };
300
+ return { text: record.text, isError: Boolean(record.isError) };
301
+ }
240
302
  if (output && typeof output === "object" && "content" in output) {
241
303
  const record = output as { content?: unknown; isError?: unknown };
242
304
  const isError = Boolean(record.isError);
@@ -245,11 +307,17 @@ export function unwrapMcpOutput(output: unknown): { text: string; isError: boole
245
307
  (part): part is { type: string; text: string } =>
246
308
  !!part && typeof part === "object" && (part as { type?: unknown }).type === "text",
247
309
  );
248
- return { text: textPart ? String(textPart.text) : JSON.stringify(output), isError };
310
+ return {
311
+ text: textPart ? String(textPart.text) : JSON.stringify(output),
312
+ isError,
313
+ };
249
314
  }
250
315
  return { text: JSON.stringify(output), isError };
251
316
  }
252
- return { text: typeof output === "string" ? output : output == null ? "" : JSON.stringify(output), isError: false };
317
+ return {
318
+ text: typeof output === "string" ? output : output == null ? "" : JSON.stringify(output),
319
+ isError: false,
320
+ };
253
321
  }
254
322
 
255
323
  /* --- computer-use screenshot extraction ------------------------------------- */
@@ -322,7 +390,8 @@ export function screenshotDataUrl(out: unknown): string | null {
322
390
  /** Serialize whatever a Uint8Array became in JSON (number[], {"0":n,…} index
323
391
  * map, or Buffer-JSON {type:"Buffer",data:[…]}) back into base64. */
324
392
  function bytesToBase64(data: unknown): string | null {
325
- const isByte = (n: unknown): n is number => typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 255;
393
+ const isByte = (n: unknown): n is number =>
394
+ typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 255;
326
395
  let bytes: number[] | null = null;
327
396
  if (Array.isArray(data) && data.every(isByte)) {
328
397
  bytes = data;
@@ -349,7 +418,9 @@ function bytesToBase64(data: unknown): string | null {
349
418
  for (let i = 0; i < bytes.length; i += CHUNK) {
350
419
  binary += String.fromCharCode(...bytes.slice(i, i + CHUNK));
351
420
  }
352
- return typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
421
+ return typeof btoa === "function"
422
+ ? btoa(binary)
423
+ : Buffer.from(binary, "binary").toString("base64");
353
424
  } catch {
354
425
  // A hostile/absurd payload must degrade to "no image", never crash a render.
355
426
  return null;