@opengeni/react 3.7.0-canary.5 → 3.7.0-canary.7

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 (61) hide show
  1. package/README.md +43 -3
  2. package/dist/artifacts.js +7 -7
  3. package/dist/{browser-viewer-NTD6UIPR.js → browser-viewer-SS46LUAC.js} +3 -3
  4. package/dist/chat.d.ts +37 -0
  5. package/dist/chat.js +315 -0
  6. package/dist/chat.js.map +1 -0
  7. package/dist/{chunk-LUYB4SRW.js → chunk-3HIF5IFC.js} +1048 -2439
  8. package/dist/chunk-3HIF5IFC.js.map +1 -0
  9. package/dist/{chunk-3IY6UZI6.js → chunk-BQGIXRKV.js} +288 -396
  10. package/dist/chunk-BQGIXRKV.js.map +1 -0
  11. package/dist/{chunk-MOWYEBCQ.js → chunk-BXJOQFCD.js} +5 -4
  12. package/dist/chunk-BXJOQFCD.js.map +1 -0
  13. package/dist/{chunk-BV5A4OTE.js → chunk-ELIYWBZR.js} +4 -4
  14. package/dist/chunk-F2CFHN3Y.js +1415 -0
  15. package/dist/chunk-F2CFHN3Y.js.map +1 -0
  16. package/dist/chunk-HQV2I5HV.js +124 -0
  17. package/dist/chunk-HQV2I5HV.js.map +1 -0
  18. package/dist/{chunk-JT33KZZN.js → chunk-R4KRSFGA.js} +11 -20
  19. package/dist/chunk-R4KRSFGA.js.map +1 -0
  20. package/dist/{chunk-KWEZ4MPF.js → chunk-UMECRJRV.js} +63 -60
  21. package/dist/chunk-UMECRJRV.js.map +1 -0
  22. package/dist/{chunk-24M4YBCL.js → chunk-VEPNNDNG.js} +4 -4
  23. package/dist/{chunk-WMGF4Z7X.js → chunk-VRBL3F5E.js} +23 -3
  24. package/dist/{chunk-WMGF4Z7X.js.map → chunk-VRBL3F5E.js.map} +1 -1
  25. package/dist/components/model-policy-picker.d.ts +4 -0
  26. package/dist/components/sandbox-files.d.ts +3 -1
  27. package/dist/composer.js +6 -5
  28. package/dist/{computer-viewer-7TEZC6Y2.js → computer-viewer-FWEZISW4.js} +3 -3
  29. package/dist/hooks/use-session-events.d.ts +2 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +92 -36
  32. package/dist/index.js.map +1 -1
  33. package/dist/interaction.js +8 -8
  34. package/dist/{model-policy-picker-menu-R6WXNWJL.js → model-policy-picker-menu-3R336DP2.js} +4 -4
  35. package/dist/model-policy.d.ts +2 -0
  36. package/dist/model-policy.js +3 -1
  37. package/dist/realtime.js +5 -5
  38. package/dist/session-ui.js +11 -8
  39. package/dist/session.js +1 -1
  40. package/package.json +6 -2
  41. package/src/chat.tsx +393 -0
  42. package/src/components/model-policy-picker-menu.tsx +92 -71
  43. package/src/components/model-policy-picker.tsx +21 -18
  44. package/src/components/sandbox-files.tsx +90 -14
  45. package/src/components/sandbox-workspace.tsx +16 -1
  46. package/src/hooks/use-session-events.ts +3 -0
  47. package/src/hooks/use-session.ts +10 -3
  48. package/src/index.ts +1 -0
  49. package/src/model-policy.ts +26 -2
  50. package/styles/compiled.css +40 -8
  51. package/styles/tokens.css +2 -2
  52. package/dist/chunk-3IY6UZI6.js.map +0 -1
  53. package/dist/chunk-JT33KZZN.js.map +0 -1
  54. package/dist/chunk-KWEZ4MPF.js.map +0 -1
  55. package/dist/chunk-LUYB4SRW.js.map +0 -1
  56. package/dist/chunk-MOWYEBCQ.js.map +0 -1
  57. /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-SS46LUAC.js.map} +0 -0
  58. /package/dist/{chunk-BV5A4OTE.js.map → chunk-ELIYWBZR.js.map} +0 -0
  59. /package/dist/{chunk-24M4YBCL.js.map → chunk-VEPNNDNG.js.map} +0 -0
  60. /package/dist/{computer-viewer-7TEZC6Y2.js.map → computer-viewer-FWEZISW4.js.map} +0 -0
  61. /package/dist/{model-policy-picker-menu-R6WXNWJL.js.map → model-policy-picker-menu-3R336DP2.js.map} +0 -0
package/dist/index.js CHANGED
@@ -44,20 +44,16 @@ import {
44
44
  } from "./chunk-5YK2ZDIG.js";
45
45
  import {
46
46
  ModelPolicyPickerMenu
47
- } from "./chunk-KWEZ4MPF.js";
47
+ } from "./chunk-UMECRJRV.js";
48
48
  import {
49
49
  ActivityDisclosure,
50
50
  ActivityRail,
51
51
  BUILT_IN_TURN_SUMMARY_FACET_IDS,
52
52
  BodyNote,
53
53
  ChatComposer,
54
- CopyButton,
55
- CopyHoverFrame,
56
54
  DisclosureDefaultsProvider,
57
55
  GeneratedVideoPlayer,
58
- HumanInputForm,
59
56
  HumanInputSurface,
60
- Markdown,
61
57
  MediaEmpty,
62
58
  MediaSkeleton,
63
59
  MessageTimeline,
@@ -76,13 +72,11 @@ import {
76
72
  TimelineRow,
77
73
  TurnSummary,
78
74
  UserMessageBody,
79
- answersFromDrafts,
80
75
  applyPatchOps,
81
76
  applyPatchOpsFromToolItem,
82
77
  controlCaret,
83
78
  createDefaultToolRegistry,
84
79
  createToolRegistry,
85
- defaultHumanInputFormMessages,
86
80
  defaultToolRegistry,
87
81
  execTruncated,
88
82
  gitFileDiffToPatch,
@@ -92,11 +86,8 @@ import {
92
86
  parseExecBannerSessionId,
93
87
  parseFreeformApplyPatch,
94
88
  parseToolArgs,
95
- prefersReducedMotion,
96
89
  rawTypeOf,
97
90
  sandboxCommandExitCode,
98
- sandboxFileLocationFromHref,
99
- sandboxFilePathFromHref,
100
91
  sessionChromeGoalPillExplanation,
101
92
  sessionChromeGoalPillLabel,
102
93
  sessionChromeGoalPillState,
@@ -108,15 +99,11 @@ import {
108
99
  useWorkspaceModelCatalog,
109
100
  userMessageLikelyNeedsDisclosure,
110
101
  v4aToGitFileDiff
111
- } from "./chunk-LUYB4SRW.js";
102
+ } from "./chunk-3HIF5IFC.js";
112
103
  import "./chunk-W3OUAH6M.js";
113
104
  import {
114
105
  OpenGeniProvider
115
106
  } from "./chunk-PAJU5KKL.js";
116
- import {
117
- copyTextToClipboard,
118
- tableElementToTsv
119
- } from "./chunk-JVYQRRC4.js";
120
107
  import {
121
108
  CommandPalette,
122
109
  ComposerTranscriptionControl,
@@ -125,10 +112,6 @@ import {
125
112
  LightboxProvider,
126
113
  ModelPicker,
127
114
  OPEN_WORKSTREAM_CONTROL_EVENT,
128
- Tooltip,
129
- TooltipContent,
130
- TooltipProvider,
131
- TooltipTrigger,
132
115
  VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
133
116
  VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
134
117
  VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
@@ -156,7 +139,7 @@ import {
156
139
  useSlashCommands,
157
140
  useTranscription,
158
141
  useVoiceInput
159
- } from "./chunk-3IY6UZI6.js";
142
+ } from "./chunk-BQGIXRKV.js";
160
143
  import {
161
144
  BillingClassMark,
162
145
  ModelPolicyPicker,
@@ -164,11 +147,7 @@ import {
164
147
  PickerBackHeader,
165
148
  PickerNavRow,
166
149
  defaultModelPolicyPickerMessages
167
- } from "./chunk-JT33KZZN.js";
168
- import {
169
- usePortalTokenSource,
170
- usePortalTokenStyle
171
- } from "./chunk-VZTQ73XT.js";
150
+ } from "./chunk-R4KRSFGA.js";
172
151
  import {
173
152
  approvalsFromRequiresAction,
174
153
  createEmbeddedSessionClient,
@@ -205,7 +184,7 @@ import {
205
184
  useSession,
206
185
  useSessionEvents,
207
186
  useTurnQueue
208
- } from "./chunk-MOWYEBCQ.js";
187
+ } from "./chunk-BXJOQFCD.js";
209
188
  import {
210
189
  FILE_ONLY_MESSAGE_TEXT,
211
190
  composeSendInput,
@@ -237,6 +216,31 @@ import {
237
216
  useOpenGeni,
238
217
  useOpenGeniClient
239
218
  } from "./chunk-NEXLLTP4.js";
219
+ import {
220
+ CopyButton,
221
+ CopyHoverFrame,
222
+ HumanInputForm,
223
+ Markdown,
224
+ answersFromDrafts,
225
+ defaultHumanInputFormMessages,
226
+ prefersReducedMotion,
227
+ sandboxFileLocationFromHref,
228
+ sandboxFilePathFromHref
229
+ } from "./chunk-F2CFHN3Y.js";
230
+ import {
231
+ copyTextToClipboard,
232
+ tableElementToTsv
233
+ } from "./chunk-JVYQRRC4.js";
234
+ import {
235
+ Tooltip,
236
+ TooltipContent,
237
+ TooltipProvider,
238
+ TooltipTrigger
239
+ } from "./chunk-HQV2I5HV.js";
240
+ import {
241
+ usePortalTokenSource,
242
+ usePortalTokenStyle
243
+ } from "./chunk-VZTQ73XT.js";
240
244
  import {
241
245
  advancedSourceSummary,
242
246
  availabilityReasonLabel,
@@ -249,12 +253,13 @@ import {
249
253
  groupPickerRowsByBillingClass,
250
254
  labelLatencyMode,
251
255
  labelReasoningEffort,
256
+ modelUsesCredits,
252
257
  payerSummaryForModel,
253
258
  projectClientModelRows,
254
259
  projectPickerRows,
255
260
  runnableLatencyModesForModel,
256
261
  sortPickerRows
257
- } from "./chunk-WMGF4Z7X.js";
262
+ } from "./chunk-VRBL3F5E.js";
258
263
  import {
259
264
  cn
260
265
  } from "./chunk-22KP6LR5.js";
@@ -7073,6 +7078,7 @@ function SandboxFiles({
7073
7078
  workspaceResting = false,
7074
7079
  workspaceWaking = false,
7075
7080
  liveWorkspaceReady = true,
7081
+ workspaceError = null,
7076
7082
  onWakeWorkspace,
7077
7083
  themeType,
7078
7084
  className
@@ -7196,7 +7202,13 @@ function SandboxFiles({
7196
7202
  const canEdit = editable && viewPath !== null && !fileView.loading && fileView.error === null && !fileView.isBinary && !fileView.truncated && fileView.content !== null;
7197
7203
  const showEditor = canEdit && editMode;
7198
7204
  const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
7199
- const waitingForSelectedFile = liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
7205
+ const waitingForSelectedFile = !workspaceError && liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
7206
+ if (workspaceError && !liveWorkspaceReady && files.source !== "capture") {
7207
+ return /* @__PURE__ */ jsxs7(Notice, { className, title: "Could not open live workspace", announce: "alert", children: [
7208
+ /* @__PURE__ */ jsx9("p", { children: workspaceError.message }),
7209
+ onWakeWorkspace ? /* @__PURE__ */ jsx9(WakeButton, { onClick: onWakeWorkspace, children: "Retry live workspace" }) : null
7210
+ ] });
7211
+ }
7200
7212
  if (workspaceResting || workspaceWaking) {
7201
7213
  return /* @__PURE__ */ jsx9("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs7(
7202
7214
  Notice,
@@ -7335,7 +7347,10 @@ function SandboxFiles({
7335
7347
  className: "h-full"
7336
7348
  },
7337
7349
  viewPath
7338
- ) : waitingForSelectedFile ? /* @__PURE__ */ jsxs7(
7350
+ ) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */ jsxs7(Notice, { title: "Could not open live file", announce: "alert", children: [
7351
+ /* @__PURE__ */ jsx9("p", { children: workspaceError.message }),
7352
+ onWakeWorkspace ? /* @__PURE__ */ jsx9(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
7353
+ ] }) : waitingForSelectedFile ? /* @__PURE__ */ jsxs7(
7339
7354
  Notice,
7340
7355
  {
7341
7356
  icon: /* @__PURE__ */ jsx9(
@@ -7375,7 +7390,14 @@ function SandboxFiles({
7375
7390
  "Loading ",
7376
7391
  viewPath,
7377
7392
  "\u2026"
7378
- ] }) : fileView.isBinary ? /* @__PURE__ */ jsxs7(Notice, { children: [
7393
+ ] }) : fileView.imageUrl ? /* @__PURE__ */ jsx9(
7394
+ RasterFilePreview,
7395
+ {
7396
+ src: fileView.imageUrl,
7397
+ path: viewPath
7398
+ },
7399
+ fileView.imageUrl
7400
+ ) : fileView.isBinary ? /* @__PURE__ */ jsxs7(Notice, { children: [
7379
7401
  viewPath,
7380
7402
  " is a binary file (",
7381
7403
  fileView.sizeBytes ?? 0,
@@ -7410,7 +7432,10 @@ function SandboxFiles({
7410
7432
  "\u2026"
7411
7433
  ] }) : (
7412
7434
  // Nothing selected — the tree shows the whole workspace; pick a file.
7413
- requestedPath && !requestedPathReady ? /* @__PURE__ */ jsxs7(
7435
+ requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */ jsxs7(Notice, { title: "Could not open live file", announce: "alert", children: [
7436
+ /* @__PURE__ */ jsx9("p", { children: workspaceError.message }),
7437
+ onWakeWorkspace ? /* @__PURE__ */ jsx9(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
7438
+ ] }) : /* @__PURE__ */ jsxs7(
7414
7439
  Notice,
7415
7440
  {
7416
7441
  icon: /* @__PURE__ */ jsx9(
@@ -7543,11 +7568,11 @@ function GitHeader({ git, loading }) {
7543
7568
  /* @__PURE__ */ jsx9("span", { className: "sr-only", children: dirty ? `Uncommitted changes in ${git.dirtyCount} files` : "No uncommitted changes" }),
7544
7569
  /* @__PURE__ */ jsx9("span", { className: "truncate font-og-mono text-og-fg", children: git.repoCount > 1 ? `${git.repoCount} repositories` : git.branch ?? (git.isRepo ? "(detached)" : "no repo") }),
7545
7570
  (git.ahead > 0 || git.behind > 0) && /* @__PURE__ */ jsxs7("span", { className: "flex shrink-0 items-center gap-1.5 text-og-xs text-og-fg-subtle", children: [
7546
- git.ahead > 0 && /* @__PURE__ */ jsxs7("span", { children: [
7571
+ git.ahead > 0 && /* @__PURE__ */ jsxs7("span", { "data-contrast-audited": true, children: [
7547
7572
  "\u2191",
7548
7573
  git.ahead
7549
7574
  ] }),
7550
- git.behind > 0 && /* @__PURE__ */ jsxs7("span", { children: [
7575
+ git.behind > 0 && /* @__PURE__ */ jsxs7("span", { "data-contrast-audited": true, children: [
7551
7576
  "\u2193",
7552
7577
  git.behind
7553
7578
  ] })
@@ -7629,6 +7654,7 @@ function useFileView(path, readFile, reloadRevision = 0) {
7629
7654
  const content = res.isBinary ? null : res.encoding === "base64" ? decodeBase64Utf8(res.content) : res.content;
7630
7655
  setState({
7631
7656
  content,
7657
+ imageUrl: !res.truncated && res.encoding === "base64" ? rasterImageUrl(path, res.content) : null,
7632
7658
  isBinary: res.isBinary,
7633
7659
  truncated: res.truncated,
7634
7660
  sizeBytes: res.sizeBytes,
@@ -7656,6 +7682,27 @@ function useFileView(path, readFile, reloadRevision = 0) {
7656
7682
  }, [path, readFile, reloadRevision]);
7657
7683
  return state;
7658
7684
  }
7685
+ function rasterImageUrl(path, content) {
7686
+ const extension = path.split(".").pop()?.toLowerCase();
7687
+ const mime = extension === "png" ? "image/png" : extension === "jpg" || extension === "jpeg" ? "image/jpeg" : extension === "gif" ? "image/gif" : extension === "webp" ? "image/webp" : null;
7688
+ return mime ? `data:${mime};base64,${content}` : null;
7689
+ }
7690
+ function RasterFilePreview({ src, path }) {
7691
+ const [failed, setFailed] = useState15(false);
7692
+ return failed ? /* @__PURE__ */ jsxs7(Notice, { title: "Image preview unavailable", announce: "alert", children: [
7693
+ "Could not decode ",
7694
+ path,
7695
+ " as an image."
7696
+ ] }) : /* @__PURE__ */ jsx9(
7697
+ "img",
7698
+ {
7699
+ src,
7700
+ alt: path,
7701
+ onError: () => setFailed(true),
7702
+ className: "max-w-full object-contain"
7703
+ }
7704
+ );
7705
+ }
7659
7706
  function decodeBase64Utf8(b64) {
7660
7707
  try {
7661
7708
  if (typeof atob === "function") {
@@ -8281,11 +8328,11 @@ import {
8281
8328
  } from "lucide-react";
8282
8329
  import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
8283
8330
  var LazyBrowserViewer = lazy2(async () => {
8284
- const { BrowserViewer } = await import("./browser-viewer-NTD6UIPR.js");
8331
+ const { BrowserViewer } = await import("./browser-viewer-SS46LUAC.js");
8285
8332
  return { default: BrowserViewer };
8286
8333
  });
8287
8334
  var LazyComputerViewer = lazy2(async () => {
8288
- const { ComputerViewer } = await import("./computer-viewer-7TEZC6Y2.js");
8335
+ const { ComputerViewer } = await import("./computer-viewer-FWEZISW4.js");
8289
8336
  return { default: ComputerViewer };
8290
8337
  });
8291
8338
  var WORKBENCH_TAB_CHANGES = "changes";
@@ -8697,7 +8744,13 @@ function useSandboxWorkspaceTabs(options) {
8697
8744
  workspaceResting: !liveWorkspaceExpected && liveness !== void 0 && !capturePending && !captureAvailable && !workspaceWaking,
8698
8745
  workspaceWaking: !liveWorkspaceExpected && !captureAvailable && workspaceWaking,
8699
8746
  liveWorkspaceReady: liveWorkspaceExpected,
8700
- onWakeWorkspace: () => requestWarmIntent("warmFiles"),
8747
+ workspaceError: caps.error ?? (caps.viewerCapReached ? new Error(
8748
+ "The live workspace viewer limit has been reached. Close another viewer and retry."
8749
+ ) : filesWarmRequested && caps.state === "on-demand" && !fileSystemOn ? new Error("This machine does not currently expose a live file system.") : null),
8750
+ onWakeWorkspace: () => {
8751
+ if (filesWarmRequested) caps.renegotiate();
8752
+ else requestWarmIntent("warmFiles");
8753
+ },
8701
8754
  ...requestedFilePath ? {
8702
8755
  requestedPath: requestedFilePath,
8703
8756
  ...requestedFileRequestId !== null && requestedFileRequestId !== void 0 ? { requestedPathRequestId: requestedFileRequestId } : {},
@@ -8826,6 +8879,8 @@ function useSandboxWorkspaceTabs(options) {
8826
8879
  caps.state,
8827
8880
  caps.error,
8828
8881
  caps.viewerCapReached,
8882
+ caps.renegotiate,
8883
+ filesWarmRequested,
8829
8884
  requestWarmIntent,
8830
8885
  createLinkedComputer
8831
8886
  ]);
@@ -9545,6 +9600,7 @@ export {
9545
9600
  languageForPath,
9546
9601
  looksBinary,
9547
9602
  matchCommand,
9603
+ modelUsesCredits,
9548
9604
  parseCommandLine,
9549
9605
  parseExecBannerSessionId,
9550
9606
  parseFreeformApplyPatch,