@opengeni/react 0.11.0 → 0.13.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 (85) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-5C7RGAWA.js → chunk-NFYVQWIB.js} +170 -64
  3. package/dist/chunk-NFYVQWIB.js.map +1 -0
  4. package/dist/index.d.ts +791 -145
  5. package/dist/index.js +5447 -2213
  6. package/dist/index.js.map +1 -1
  7. package/dist/{machines-BeZ3bD3t.d.ts → machines-CnlMb7E-.d.ts} +5 -5
  8. package/dist/machines.d.ts +1 -1
  9. package/dist/machines.js +1 -1
  10. package/package.json +17 -12
  11. package/src/approvals.ts +16 -4
  12. package/src/client.ts +32 -5
  13. package/src/commands/index.ts +1 -7
  14. package/src/commands/registry.ts +46 -12
  15. package/src/components/chat-composer.tsx +135 -39
  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 +16 -4
  25. package/src/components/machine-dock-bar.tsx +20 -8
  26. package/src/components/machine-metrics.tsx +31 -8
  27. package/src/components/machine-status-pill.tsx +26 -5
  28. package/src/components/machines-dashboard.tsx +8 -2
  29. package/src/components/markdown.tsx +39 -9
  30. package/src/components/message-timeline.tsx +633 -109
  31. package/src/components/pierre-diff.tsx +83 -15
  32. package/src/components/pierre-file.tsx +10 -9
  33. package/src/components/sandbox-files.tsx +110 -227
  34. package/src/components/sandbox-terminal.tsx +256 -88
  35. package/src/components/sandbox-workspace.tsx +823 -0
  36. package/src/components/session-status.tsx +28 -2
  37. package/src/components/workbench-changes.tsx +541 -0
  38. package/src/components/workspace-dock.tsx +85 -22
  39. package/src/hooks/internal.ts +5 -2
  40. package/src/hooks/use-available-models.ts +7 -2
  41. package/src/hooks/use-billing-usage.ts +4 -1
  42. package/src/hooks/use-codex-accounts.ts +74 -44
  43. package/src/hooks/use-composer.ts +57 -36
  44. package/src/hooks/use-environments.ts +92 -47
  45. package/src/hooks/use-file-attachments.ts +101 -55
  46. package/src/hooks/use-goal.ts +52 -16
  47. package/src/hooks/use-machine-chip.ts +134 -0
  48. package/src/hooks/use-machines.ts +34 -16
  49. package/src/hooks/use-packs.ts +24 -19
  50. package/src/hooks/use-relay-frame-stream.ts +5 -2
  51. package/src/hooks/use-rigs.ts +335 -0
  52. package/src/hooks/use-sandbox-files.ts +213 -39
  53. package/src/hooks/use-sandbox-git.ts +188 -11
  54. package/src/hooks/use-sandbox-terminal.ts +18 -14
  55. package/src/hooks/use-scheduled-tasks.ts +10 -2
  56. package/src/hooks/use-session-capabilities.ts +77 -20
  57. package/src/hooks/use-session-control.ts +49 -21
  58. package/src/hooks/use-session-events.ts +48 -20
  59. package/src/hooks/use-session-lineage.ts +119 -0
  60. package/src/hooks/use-session.ts +43 -28
  61. package/src/hooks/use-slash-commands.ts +6 -4
  62. package/src/hooks/use-turn-queue.ts +74 -147
  63. package/src/hooks/use-windowed-sections.ts +204 -0
  64. package/src/hooks/use-workspace-capture.ts +233 -0
  65. package/src/hooks/use-workspace-edit.ts +231 -0
  66. package/src/hooks/use-workspace-sessions.ts +48 -5
  67. package/src/hooks/use-workspaces.ts +18 -15
  68. package/src/index.ts +128 -23
  69. package/src/lib/format.ts +44 -6
  70. package/src/lib/xterm-renderer.ts +65 -0
  71. package/src/lib/xterm-theme.ts +224 -18
  72. package/src/machines.ts +13 -3
  73. package/src/provider.tsx +3 -1
  74. package/src/timeline/activity-rail.tsx +213 -54
  75. package/src/timeline/disclosure-context.tsx +12 -2
  76. package/src/timeline/index.ts +21 -2
  77. package/src/timeline/parsers.ts +44 -10
  78. package/src/timeline/projection.ts +435 -84
  79. package/src/timeline/shared.tsx +111 -24
  80. package/src/timeline/tool-diff.tsx +24 -20
  81. package/src/timeline/tool-renderers.tsx +98 -21
  82. package/src/timeline/turn-summary.tsx +76 -23
  83. package/src/timeline/types.ts +96 -12
  84. package/styles/tokens.css +2 -2
  85. package/dist/chunk-5C7RGAWA.js.map +0 -1
@@ -37,6 +37,14 @@ export type PierreDiffProps = {
37
37
  loading?: ReactNode | undefined;
38
38
  /** Rendered if `@pierre/diffs/react` is not installed / fails to import. */
39
39
  fallback?: ReactNode | undefined;
40
+ /** Skip the Shiki renderer entirely and show the plain-text degrade (the old
41
+ * `usePierre={false}` path — one renderer, opted out of highlighting). */
42
+ plain?: boolean | undefined;
43
+ /** Long-line handling: `"wrap"` soft-wraps (the default — a diff in a narrow
44
+ * dock pane should be readable without a horizontal-scroll tax), `"scroll"`
45
+ * keeps lines on one row behind a horizontal scrollbar (better for a wide
46
+ * viewport or pathological minified lines). */
47
+ overflow?: "wrap" | "scroll" | undefined;
40
48
  className?: string | undefined;
41
49
  };
42
50
 
@@ -54,8 +62,8 @@ const LazyPatchDiff = lazy(async () => {
54
62
  /**
55
63
  * The Pierre-backed diff: Shiki-highlighted, virtualized, unified/split. Renders
56
64
  * one `PatchDiff` per changed file (a reconstructed unified patch from the
57
- * `GitFileDiff` hunks). This sits behind `DiffView`'s `fallback` seam so a host
58
- * that lacks `@pierre/diffs` keeps the hand-rolled renderer.
65
+ * `GitFileDiff` hunks). The ONE workbench diff renderer; a host without
66
+ * `@pierre/diffs` gets the built-in plain-text degrade (`PlainPatch`).
59
67
  */
60
68
  export function PierreDiff({
61
69
  diff,
@@ -65,13 +73,16 @@ export function PierreDiff({
65
73
  disableWorkerPool,
66
74
  loading,
67
75
  fallback,
76
+ plain,
77
+ overflow = "wrap",
68
78
  className,
69
79
  }: PierreDiffProps) {
70
80
  const [failed, setFailed] = useState(false);
71
81
 
72
82
  // Probe the import once so a hard failure (peer missing) shows `fallback`
73
- // rather than a Suspense boundary that never resolves.
83
+ // rather than a Suspense boundary that never resolves. Skipped when `plain`.
74
84
  useEffect(() => {
85
+ if (plain) return;
75
86
  let cancelled = false;
76
87
  void import("@pierre/diffs/react").catch(() => {
77
88
  if (!cancelled) setFailed(true);
@@ -79,10 +90,13 @@ export function PierreDiff({
79
90
  return () => {
80
91
  cancelled = true;
81
92
  };
82
- }, []);
93
+ }, [plain]);
83
94
 
84
- if (failed && fallback !== undefined) {
85
- return <div className={className}>{fallback}</div>;
95
+ if (plain || failed) {
96
+ // `plain` opts out of highlighting; `failed` = `@pierre/diffs` not installed.
97
+ // Render the caller's fallback, or a plain (unhighlighted) patch dump — NOT a
98
+ // second hunk renderer. One highlighted renderer (Pierre) + a text degrade.
99
+ return <div className={className}>{fallback ?? <PlainPatch diff={diff} />}</div>;
86
100
  }
87
101
 
88
102
  // Default to the dark theme: the host UI is dark-first, and Pierre's own
@@ -90,9 +104,16 @@ export function PierreDiff({
90
104
  // inside a dark dock). Callers pass `themeType="light"` to opt into light.
91
105
  const options = {
92
106
  diffStyle: layout,
93
- overflow: "scroll" as const,
107
+ overflow,
94
108
  stickyHeader: true,
95
- ...(theme ? { theme } : { theme: { dark: "github-dark", light: "github-light" } }),
109
+ ...(theme
110
+ ? { theme }
111
+ : {
112
+ theme: {
113
+ dark: "github-dark-high-contrast",
114
+ light: "github-light-high-contrast",
115
+ },
116
+ }),
96
117
  themeType: themeType ?? "dark",
97
118
  };
98
119
 
@@ -105,16 +126,24 @@ export function PierreDiff({
105
126
  "--diffs-light-bg": "var(--og-color-bg)",
106
127
  "--diffs-bg-buffer-override": "var(--og-color-surface-1)",
107
128
  "--diffs-bg-separator-override": "var(--og-color-surface-1)",
129
+ "--diffs-addition-color-override": "var(--og-color-status-idle)",
130
+ "--diffs-deletion-color-override": "var(--og-color-status-failed)",
131
+ "--diffs-fg-number-addition-override": "var(--og-color-status-idle)",
132
+ "--diffs-fg-number-deletion-override": "var(--og-color-status-failed)",
133
+ "--diffs-bg-addition-override":
134
+ "color-mix(in oklch, var(--og-color-status-idle) 12%, var(--og-color-bg))",
135
+ "--diffs-bg-deletion-override":
136
+ "color-mix(in oklch, var(--og-color-status-failed) 12%, var(--og-color-bg))",
137
+ "--diffs-bg-addition-emphasis-override":
138
+ "color-mix(in oklch, var(--og-color-status-idle) 22%, var(--og-color-bg))",
139
+ "--diffs-bg-deletion-emphasis-override":
140
+ "color-mix(in oklch, var(--og-color-status-failed) 22%, var(--og-color-bg))",
108
141
  "--diffs-font-size": "var(--og-code-font-size)",
109
142
  "--diffs-line-height": "var(--og-code-line-height)",
110
143
  } as CSSProperties;
111
144
 
112
145
  return (
113
- <div
114
- className={cn("min-w-0", className)}
115
- data-opengeni-pierre-diff
116
- style={pierreVars}
117
- >
146
+ <div className={cn("min-w-0", className)} data-opengeni-pierre-diff style={pierreVars}>
118
147
  <Suspense fallback={loading ?? <DiffSkeleton />}>
119
148
  {diff.map((file) => (
120
149
  <div key={file.path} className="mb-2">
@@ -131,9 +160,48 @@ export function PierreDiff({
131
160
  }
132
161
 
133
162
  function DiffSkeleton() {
163
+ return <div className="p-3 text-og-sm text-og-fg-subtle">Loading diff…</div>;
164
+ }
165
+
166
+ /**
167
+ * The unhighlighted degrade for a host without `@pierre/diffs`: the reconstructed
168
+ * unified patch as monospace text with +/−/@@ tinting. Deliberately NOT a
169
+ * structured hunk renderer — the workbench keeps exactly one of those (Pierre).
170
+ */
171
+ function PlainPatch({ diff }: { diff: GitFileDiff[] }) {
172
+ if (diff.length === 0) {
173
+ return <div className="p-3 text-og-sm text-og-fg-subtle">No changes</div>;
174
+ }
134
175
  return (
135
- <div className="p-3 text-og-sm text-og-fg-subtle">
136
- Loading diff…
176
+ <div className="min-w-0">
177
+ {diff.map((file) => (
178
+ <pre
179
+ key={file.path}
180
+ className="mb-2 overflow-auto whitespace-pre rounded-og-sm border border-og-border bg-og-bg/60 p-2.5 font-og-mono text-og-xs leading-5"
181
+ >
182
+ {gitFileDiffToPatch(file)
183
+ .split("\n")
184
+ .map((line, index) => (
185
+ <span
186
+ // Patch line position is the stable identity in this immutable plain-text fallback.
187
+ // oxlint-disable-next-line react/no-array-index-key
188
+ key={index}
189
+ className={cn(
190
+ "block",
191
+ line.startsWith("@@")
192
+ ? "text-og-accent"
193
+ : line.startsWith("+")
194
+ ? "text-og-status-idle"
195
+ : line.startsWith("-")
196
+ ? "text-og-status-failed"
197
+ : "text-og-fg-muted",
198
+ )}
199
+ >
200
+ {line || " "}
201
+ </span>
202
+ ))}
203
+ </pre>
204
+ ))}
137
205
  </div>
138
206
  );
139
207
  }
@@ -82,9 +82,7 @@ export function PierreFile({
82
82
 
83
83
  if (failed) {
84
84
  return (
85
- <div className={className}>
86
- {fallback ?? <PlainFile name={name} contents={contents} />}
87
- </div>
85
+ <div className={className}>{fallback ?? <PlainFile name={name} contents={contents} />}</div>
88
86
  );
89
87
  }
90
88
 
@@ -92,7 +90,14 @@ export function PierreFile({
92
90
  overflow: "scroll" as const,
93
91
  stickyHeader: true,
94
92
  showLineNumbers: true,
95
- ...(theme ? { theme } : { theme: { dark: "github-dark", light: "github-light" } }),
93
+ ...(theme
94
+ ? { theme }
95
+ : {
96
+ theme: {
97
+ dark: "github-dark-high-contrast",
98
+ light: "github-light-high-contrast",
99
+ },
100
+ }),
96
101
  themeType: themeType ?? "dark",
97
102
  };
98
103
 
@@ -134,9 +139,5 @@ function PlainFile({ name, contents }: { name: string; contents: string }) {
134
139
  }
135
140
 
136
141
  function FileSkeleton() {
137
- return (
138
- <div className="p-3 text-og-sm text-og-fg-subtle">
139
- Loading file…
140
- </div>
141
- );
142
+ return <div className="p-3 text-og-sm text-og-fg-subtle">Loading file…</div>;
142
143
  }