@opengeni/react 7.1.0 → 7.1.2-canary.36199476632001

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 (78) hide show
  1. package/dist/artifacts-document.js +2 -2
  2. package/dist/artifacts-presentation.js +2 -2
  3. package/dist/artifacts-spreadsheet.js +2 -2
  4. package/dist/artifacts.js +4 -4
  5. package/dist/{browser-viewer-MN7MOYQT.js → browser-viewer-K2H3SLIW.js} +2 -2
  6. package/dist/{chunk-KCGXPP5V.js → chunk-6P7T4RPE.js} +7 -3
  7. package/dist/chunk-6P7T4RPE.js.map +1 -0
  8. package/dist/{chunk-SHRCATV6.js → chunk-7J4DUR3E.js} +12 -5
  9. package/dist/chunk-7J4DUR3E.js.map +1 -0
  10. package/dist/{chunk-UQS7BGNQ.js → chunk-ETA37UZ7.js} +82 -11
  11. package/dist/chunk-ETA37UZ7.js.map +1 -0
  12. package/dist/{chunk-VR4Z73EU.js → chunk-G2SCXNXW.js} +9 -2
  13. package/dist/chunk-G2SCXNXW.js.map +1 -0
  14. package/dist/{chunk-5UONOQ3Y.js → chunk-K3MQZO7R.js} +150 -67
  15. package/dist/chunk-K3MQZO7R.js.map +1 -0
  16. package/dist/{chunk-OWHPKAOV.js → chunk-L6MYP3QU.js} +4 -2
  17. package/dist/{chunk-OWHPKAOV.js.map → chunk-L6MYP3QU.js.map} +1 -1
  18. package/dist/{chunk-ZC2DK5SC.js → chunk-RSFCYKA7.js} +88 -7
  19. package/dist/chunk-RSFCYKA7.js.map +1 -0
  20. package/dist/{chunk-VI7HELBI.js → chunk-SJ5HE4ZA.js} +21 -2
  21. package/dist/chunk-SJ5HE4ZA.js.map +1 -0
  22. package/dist/{chunk-4ACTWOOW.js → chunk-VDSZ3AVO.js} +41 -18
  23. package/dist/chunk-VDSZ3AVO.js.map +1 -0
  24. package/dist/{chunk-XMXRI5JK.js → chunk-ZZ4744OZ.js} +128 -71
  25. package/dist/chunk-ZZ4744OZ.js.map +1 -0
  26. package/dist/components/artifacts/artifact-surface.d.ts +3 -1
  27. package/dist/components/artifacts/document-editor.d.ts +4 -2
  28. package/dist/components/artifacts/editable-document.d.ts +1 -1
  29. package/dist/components/artifacts/editable-presentation.d.ts +1 -1
  30. package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
  31. package/dist/components/artifacts/presentation-editor.d.ts +4 -2
  32. package/dist/components/browser-viewer.d.ts +4 -1
  33. package/dist/components/markdown.d.ts +2 -0
  34. package/dist/components/session-capability-frame.d.ts +5 -1
  35. package/dist/composer.js +1 -1
  36. package/dist/connect.js +2 -2
  37. package/dist/hooks/use-browser-session.d.ts +3 -0
  38. package/dist/index.js +7 -6
  39. package/dist/index.js.map +1 -1
  40. package/dist/interaction.js +1 -1
  41. package/dist/session-ui.js +4 -4
  42. package/dist/session.js +1 -1
  43. package/dist/timeline/types.d.ts +2 -0
  44. package/package.json +5 -5
  45. package/src/components/artifacts/artifact-surface.tsx +39 -19
  46. package/src/components/artifacts/document-editor.tsx +77 -9
  47. package/src/components/artifacts/editable-document.tsx +3 -0
  48. package/src/components/artifacts/editable-presentation.tsx +3 -0
  49. package/src/components/artifacts/editable-spreadsheet.tsx +3 -0
  50. package/src/components/artifacts/presentation-editor.tsx +6 -0
  51. package/src/components/browser-viewer.tsx +11 -5
  52. package/src/components/composer-transcription-control.tsx +4 -2
  53. package/src/components/composer.tsx +45 -20
  54. package/src/components/markdown.tsx +9 -2
  55. package/src/components/sandbox-workspace.tsx +1 -0
  56. package/src/components/session-capability-frame.tsx +11 -3
  57. package/src/components/session-mcp-capability-card.tsx +174 -70
  58. package/src/hooks/use-browser-frame-stream.ts +3 -1
  59. package/src/hooks/use-browser-session.ts +107 -3
  60. package/src/hooks/use-voice-input.ts +12 -1
  61. package/src/timeline/compaction-copy.ts +2 -0
  62. package/src/timeline/parsers.ts +2 -2
  63. package/src/timeline/projection.ts +31 -5
  64. package/src/timeline/tool-renderers.tsx +105 -16
  65. package/src/timeline/turn-summary.tsx +10 -2
  66. package/src/timeline/types.ts +2 -0
  67. package/styles/compiled.css +6 -0
  68. package/styles/session-capability.css +2 -0
  69. package/dist/chunk-4ACTWOOW.js.map +0 -1
  70. package/dist/chunk-5UONOQ3Y.js.map +0 -1
  71. package/dist/chunk-KCGXPP5V.js.map +0 -1
  72. package/dist/chunk-SHRCATV6.js.map +0 -1
  73. package/dist/chunk-UQS7BGNQ.js.map +0 -1
  74. package/dist/chunk-VI7HELBI.js.map +0 -1
  75. package/dist/chunk-VR4Z73EU.js.map +0 -1
  76. package/dist/chunk-XMXRI5JK.js.map +0 -1
  77. package/dist/chunk-ZC2DK5SC.js.map +0 -1
  78. /package/dist/{browser-viewer-MN7MOYQT.js.map → browser-viewer-K2H3SLIW.js.map} +0 -0
@@ -92,7 +92,9 @@ function SessionCapabilityFrame({
92
92
  skill,
93
93
  expanded,
94
94
  complete,
95
+ completeLabel,
95
96
  actionLabel,
97
+ opensDialog = true,
96
98
  note,
97
99
  onOpen,
98
100
  onClose,
@@ -131,7 +133,7 @@ function SessionCapabilityFrame({
131
133
  identity,
132
134
  complete ? /* @__PURE__ */ jsx(CheckIcon, { size: 16, "aria-hidden": true }) : null
133
135
  ] }),
134
- complete ? /* @__PURE__ */ jsx("p", { role: "status", className: "og-session-capability-copy", children: skill ? "Installed \xB7 Workspace" : "Connected \xB7 Available in this conversation" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
136
+ complete ? /* @__PURE__ */ jsx("p", { role: "status", className: "og-session-capability-copy", children: completeLabel ?? (skill ? "Installed \xB7 Workspace" : "Connected \xB7 Available in this conversation") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
135
137
  /* @__PURE__ */ jsx("p", { className: "og-session-capability-copy", children: description }),
136
138
  /* @__PURE__ */ jsxs("div", { className: "og-session-capability-actions", children: [
137
139
  /* @__PURE__ */ jsxs("span", { children: [
@@ -144,8 +146,9 @@ function SessionCapabilityFrame({
144
146
  ref: buttonRef,
145
147
  type: "button",
146
148
  onClick: onOpen,
147
- "aria-haspopup": "dialog",
148
- "aria-expanded": expanded,
149
+ disabled: busy,
150
+ "aria-haspopup": opensDialog ? "dialog" : void 0,
151
+ "aria-expanded": opensDialog ? expanded : void 0,
149
152
  children: actionLabel
150
153
  }
151
154
  )
@@ -205,6 +208,7 @@ function SessionCapabilityFrame({
205
208
  // src/components/session-mcp-capability-card.tsx
206
209
  import {
207
210
  authorizeConnectAttempt,
211
+ ConnectPopupClosedError,
208
212
  ConnectController,
209
213
  createBrowserConnectNavigation,
210
214
  reserveBrowserConnectNavigation
@@ -272,22 +276,29 @@ function ScopedCard({
272
276
  const [complete, setComplete] = useState2(false);
273
277
  const [connected, setConnected] = useState2(false);
274
278
  const [waiting, setWaiting] = useState2(false);
279
+ const [reconciling, setReconciling] = useState2(false);
275
280
  const [busy, setBusy] = useState2(false);
276
281
  const [error, setError] = useState2(null);
282
+ const [notice, setNotice] = useState2(null);
283
+ const [retryFresh, setRetryFresh] = useState2(false);
277
284
  const [ownership, setOwnership] = useState2("workspace");
278
285
  const lifetime = useRef2(null);
279
- const operation = useRef2(false);
286
+ const authorization = useRef2(null);
287
+ const operation = useRef2(null);
288
+ const reservedPopup = useRef2(null);
280
289
  const startKey = useRef2(crypto.randomUUID());
281
290
  const advanceKey = useRef2(crypto.randomUUID());
291
+ const startInput = useRef2(null);
282
292
  const storageKey = sessionId ? `opengeni:session-connect:${workspaceId}:${sessionId}:${capabilityId}` : `opengeni:workspace-connect:${workspaceId}:${capabilityId}`;
283
293
  const current = () => !!lifetime.current && !lifetime.current.signal.aborted;
284
- async function load() {
294
+ async function load(active = current) {
285
295
  const invocation = lifetime.current;
286
296
  const [catalog, session] = await Promise.all([
287
297
  client.listCapabilities(workspaceId),
288
298
  sessionId ? client.getSession(workspaceId, sessionId) : Promise.resolve(null)
289
299
  ]);
290
- if (!invocation || invocation.signal.aborted || lifetime.current !== invocation) return null;
300
+ if (!invocation || invocation.signal.aborted || lifetime.current !== invocation || !active())
301
+ return null;
291
302
  const resolved = catalog.items.find((entry) => entry.id === capabilityId);
292
303
  if (!resolved || resolved.kind !== "mcp" || resolved.authKind !== "oauth2")
293
304
  throw new Error(
@@ -301,11 +312,11 @@ function ScopedCard({
301
312
  let accountReady = false;
302
313
  if (resolved.enabled && resolved.connectionRef) {
303
314
  const connections = resolved.connectionRef.subjectScope === "subject" ? await client.listOwnConnectionAccounts(workspaceId) : await client.listConnections(workspaceId);
304
- if (invocation.signal.aborted || lifetime.current !== invocation) return null;
315
+ if (invocation.signal.aborted || lifetime.current !== invocation || !active()) return null;
305
316
  const matches = matchingActiveMcpConnections(resolved, connections);
306
317
  accountReady = matches.length === 1;
307
318
  }
308
- if (invocation.signal.aborted || lifetime.current !== invocation) return null;
319
+ if (invocation.signal.aborted || lifetime.current !== invocation || !active()) return null;
309
320
  const selected = session?.toolPolicy.mode === "workspace_default" ? session.effectiveToolPolicy?.selectedIds : session?.tools.filter((tool) => tool.kind === "mcp").map((tool) => tool.id);
310
321
  setConnected(accountReady);
311
322
  setComplete(
@@ -353,19 +364,28 @@ function ScopedCard({
353
364
  }, [client, item?.logoAssetPath]);
354
365
  async function run(action) {
355
366
  if (operation.current || !current()) return;
356
- operation.current = true;
367
+ const pending = new AbortController();
368
+ operation.current = pending;
369
+ const active = () => current() && operation.current === pending && !pending.signal.aborted;
357
370
  setBusy(true);
358
371
  setError(null);
372
+ setNotice(null);
373
+ setRetryFresh(false);
359
374
  try {
360
- await action();
375
+ await action(active);
361
376
  } catch (failure) {
362
- if (current())
363
- setError(
364
- failure instanceof Error ? failure.message : "Connection setup could not finish. Try again."
365
- );
377
+ if (active()) {
378
+ if (failure instanceof ConnectPopupClosedError) setNotice(failure.message);
379
+ else
380
+ setError(
381
+ failure instanceof Error ? failure.message : "Connection setup could not finish. Try again."
382
+ );
383
+ }
366
384
  } finally {
367
- operation.current = false;
368
- if (current()) setBusy(false);
385
+ if (operation.current === pending) {
386
+ operation.current = null;
387
+ if (current()) setBusy(false);
388
+ }
369
389
  }
370
390
  }
371
391
  function remember(attemptId) {
@@ -374,15 +394,15 @@ function ScopedCard({
374
394
  } catch {
375
395
  }
376
396
  }
377
- async function reconcile(attempt) {
378
- if (!current()) return;
397
+ async function reconcile(attempt, active = current) {
398
+ if (!active()) return;
379
399
  if (attempt.state !== "complete" || !attempt.account || !attempt.credentialsCommitted) return;
380
- const resolved = await load();
381
- if (!resolved || !current()) return;
400
+ const resolved = await load(active);
401
+ if (!resolved || !active()) return;
382
402
  const connection = (await client.listConnections(workspaceId)).find(
383
403
  (entry) => entry.id === attempt.account.id
384
404
  );
385
- if (!current()) return;
405
+ if (!active()) return;
386
406
  if (!connection || connection.status !== "active" || connection.kind !== "oauth2" || connection.metadata.mcpUrl !== (resolved.mcpUrl ?? resolved.endpointUrl) || connection.subjectId !== null !== (attempt.ownership === "personal"))
387
407
  throw new Error(
388
408
  "The authorized account does not match this integration. Review its connection settings."
@@ -400,11 +420,12 @@ function ScopedCard({
400
420
  connectionId: connection.id
401
421
  }
402
422
  });
403
- if (!current()) return;
404
- const enabled = await load();
405
- if (enabled && current()) {
406
- await finishConnection(enabled);
423
+ if (!active()) return;
424
+ const enabled = await load(active);
425
+ if (enabled && active()) {
426
+ await finishConnection(enabled, active);
407
427
  }
428
+ if (!active()) return;
408
429
  try {
409
430
  sessionStorage.removeItem(storageKey);
410
431
  } catch {
@@ -412,13 +433,13 @@ function ScopedCard({
412
433
  }
413
434
  async function open() {
414
435
  setExpanded(true);
415
- await run(async () => {
416
- await load();
417
- if (!current()) return;
418
- await recoverSavedAttempt();
436
+ await run(async (active) => {
437
+ await load(active);
438
+ if (!active()) return;
439
+ await recoverSavedAttempt(active);
419
440
  });
420
441
  }
421
- async function recoverSavedAttempt() {
442
+ async function recoverSavedAttempt(active = current) {
422
443
  let saved = null;
423
444
  try {
424
445
  saved = sessionStorage.getItem(storageKey);
@@ -426,19 +447,27 @@ function ScopedCard({
426
447
  }
427
448
  if (saved) {
428
449
  const attempt = await controller.recover(saved);
429
- await reconcile(attempt);
450
+ if (!active()) return;
451
+ if (["failed", "expired", "cancelled"].includes(attempt.state)) setRetryFresh(true);
452
+ if (attempt.state === "complete") setReconciling(true);
453
+ try {
454
+ await reconcile(attempt, active);
455
+ } finally {
456
+ if (active()) setReconciling(false);
457
+ }
430
458
  }
431
459
  }
432
- async function begin() {
433
- await run(async () => {
434
- if (view.attempt && ["failed", "expired", "cancelled"].includes(view.attempt.state)) {
460
+ async function begin(fresh = false) {
461
+ await run(async (active) => {
462
+ if (fresh || view.attempt && ["failed", "expired", "cancelled"].includes(view.attempt.state)) {
435
463
  startKey.current = crypto.randomUUID();
436
464
  advanceKey.current = crypto.randomUUID();
437
465
  }
438
466
  const reserved = reserveBrowserConnectNavigation(window);
467
+ reservedPopup.current = reserved.close;
439
468
  try {
440
- const resolved = await load();
441
- if (!resolved || !current()) return;
469
+ const resolved = await load(active);
470
+ if (!resolved || !active()) return;
442
471
  if (resolved.connectionRef && ownership !== (resolved.connectionRef.subjectScope === "subject" ? "personal" : "workspace"))
443
472
  throw new Error(
444
473
  "The connection ownership changed. Review the current account before continuing."
@@ -453,13 +482,19 @@ function ScopedCard({
453
482
  const connections = (await client.listConnections(workspaceId)).filter(
454
483
  (entry) => entry.subjectId !== null && entry.kind === "oauth2" && entry.metadata.mcpUrl === mcpUrl
455
484
  );
456
- if (!current()) return;
485
+ if (!active()) return;
457
486
  if (connections.length > 1)
458
487
  throw new Error(
459
488
  "More than one personal account matches. Choose the account in connection settings before reconnecting."
460
489
  );
461
490
  reconnectAccountId = connections[0]?.id;
462
491
  }
492
+ const input = JSON.stringify({ ownership, returnUrl, reconnectAccountId, mcpUrl });
493
+ if (startInput.current !== null && startInput.current !== input) {
494
+ startKey.current = crypto.randomUUID();
495
+ advanceKey.current = crypto.randomUUID();
496
+ }
497
+ startInput.current = input;
463
498
  let attempt = await controller.begin({
464
499
  providerId: "mcp-oauth",
465
500
  ownership,
@@ -467,44 +502,67 @@ function ScopedCard({
467
502
  idempotencyKey: startKey.current,
468
503
  ...reconnectAccountId ? { reconnectAccountId } : {}
469
504
  });
470
- if (!current()) return;
505
+ if (!active()) return;
471
506
  remember(attempt.id);
472
507
  if (attempt.state === "credential_input")
473
508
  attempt = await controller.advance(
474
509
  { type: "credentials", values: { mcpUrl } },
475
510
  advanceKey.current
476
511
  );
512
+ if (!active()) return;
477
513
  if (attempt.nextAction.type === "authorize")
478
- await performAuthorization(attempt, reserved.navigation);
479
- else await reconcile(attempt);
514
+ await performAuthorization(attempt, reserved.navigation, active);
515
+ else await reconcile(attempt, active);
480
516
  } finally {
517
+ if (reservedPopup.current === reserved.close) reservedPopup.current = null;
481
518
  reserved.close();
482
519
  }
483
520
  });
484
521
  }
485
- async function performAuthorization(attempt, navigation) {
522
+ async function performAuthorization(attempt, navigation, active) {
523
+ if (!active()) return;
524
+ const pending = new AbortController();
525
+ authorization.current = pending;
526
+ const abortOnUnmount = () => pending.abort(lifetime.current?.signal.reason);
527
+ lifetime.current.signal.addEventListener("abort", abortOnUnmount, { once: true });
486
528
  setWaiting(true);
487
529
  try {
488
530
  const result = await authorizeConnectAttempt(controller.transport, attempt, navigation, {
489
531
  mode: "popup",
490
- signal: lifetime.current.signal
532
+ signal: pending.signal
491
533
  });
492
- if (!current() || !result) return;
493
- await controller.refresh();
494
- await reconcile(result);
495
- if (result.state !== "complete")
534
+ if (!active() || !result) return;
535
+ setWaiting(false);
536
+ setReconciling(true);
537
+ await reconcile(result, active);
538
+ if (!active()) return;
539
+ if (result.state === "cancelled") {
540
+ setNotice("Sign-in was cancelled. You can try connecting again.");
541
+ setRetryFresh(true);
542
+ return;
543
+ }
544
+ if (result.state !== "complete") {
545
+ if (["failed", "expired"].includes(result.state)) setRetryFresh(true);
496
546
  throw new Error("Sign-in did not finish. You can try connecting again.");
547
+ }
497
548
  } finally {
498
- if (current()) setWaiting(false);
549
+ lifetime.current?.signal.removeEventListener("abort", abortOnUnmount);
550
+ if (authorization.current === pending) authorization.current = null;
551
+ if (active()) {
552
+ setReconciling(false);
553
+ setWaiting(false);
554
+ }
499
555
  }
500
556
  }
501
557
  function authorize(attempt) {
502
- return run(() => performAuthorization(attempt, createBrowserConnectNavigation(window)));
558
+ return run(
559
+ (active) => performAuthorization(attempt, createBrowserConnectNavigation(window), active)
560
+ );
503
561
  }
504
- async function finishConnection(capability) {
562
+ async function finishConnection(capability, active = current) {
505
563
  if (!sessionId) {
506
564
  await onConfigured?.();
507
- if (!current()) return;
565
+ if (!active()) return;
508
566
  setComplete(true);
509
567
  setExpanded(false);
510
568
  onClose?.();
@@ -514,29 +572,44 @@ function ScopedCard({
514
572
  const selected = (await client.listConnections(workspaceId)).find(
515
573
  (entry) => entry.id === capability.connectionRef?.connectionId
516
574
  );
517
- if (!current()) return;
575
+ if (!active()) return;
518
576
  if (!selected || selected.status !== "active")
519
577
  throw new Error("This account needs reconnection before it can be used here.");
520
578
  }
521
579
  if (capability.connectionRef?.subjectScope === "subject") {
522
580
  const accounts = await client.listOwnConnectionAccounts(workspaceId);
523
- if (!current()) return;
581
+ if (!active()) return;
524
582
  if (matchingActiveMcpConnections(capability, accounts).length === 0)
525
583
  throw new Error("Your account needs reconnection before it can be used here.");
526
584
  }
527
- if (!current()) return;
528
- await attachSessionCapability(client, workspaceId, sessionId, capability, current);
529
- if (!current()) return;
585
+ if (!active()) return;
586
+ await attachSessionCapability(client, workspaceId, sessionId, capability, active);
587
+ if (!active()) return;
530
588
  await onConfigured?.();
531
- if (!current()) return;
589
+ if (!active()) return;
532
590
  setComplete(true);
533
591
  setExpanded(false);
534
592
  }
535
593
  async function useHere() {
536
- await run(async () => {
537
- if (item) await finishConnection(item);
594
+ await run(async (active) => {
595
+ if (item) await finishConnection(item, active);
538
596
  });
539
597
  }
598
+ function close() {
599
+ const pending = operation.current;
600
+ if (pending) {
601
+ operation.current = null;
602
+ pending.abort(new ConnectPopupClosedError());
603
+ authorization.current?.abort(new ConnectPopupClosedError());
604
+ authorization.current = null;
605
+ reservedPopup.current?.();
606
+ setBusy(false);
607
+ setWaiting(false);
608
+ setReconciling(false);
609
+ }
610
+ setExpanded(false);
611
+ onClose?.();
612
+ }
540
613
  return /* @__PURE__ */ jsx2(
541
614
  SessionCapabilityFrame,
542
615
  {
@@ -551,20 +624,28 @@ function ScopedCard({
551
624
  actionLabel: connected ? sessionId ? "Use in this conversation" : "Connected" : `Connect ${item?.name ?? name}`,
552
625
  note: sessionId ? "Review access before signing in. You'll return to this conversation after authorization." : "Review access before signing in. You'll return here after authorization.",
553
626
  onOpen: () => void open(),
554
- onClose: () => {
555
- setExpanded(false);
556
- onClose?.();
557
- },
558
- busy: busy || view.busy,
627
+ onClose: close,
559
628
  dialogOnly,
560
629
  children: /* @__PURE__ */ jsxs2("div", { className: "og-session-capability-setup", children: [
561
630
  error ? /* @__PURE__ */ jsx2("p", { role: "alert", children: error }) : null,
631
+ notice ? /* @__PURE__ */ jsx2("p", { role: "status", className: "og-session-capability-notice", children: notice }) : null,
562
632
  !item ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
563
633
  /* @__PURE__ */ jsx2("p", { role: "status", children: busy ? "Loading connection details\u2026" : "Connection details are unavailable." }),
564
634
  /* @__PURE__ */ jsx2("button", { disabled: busy, onClick: () => void open(), children: "Retry" })
565
635
  ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
566
636
  /* @__PURE__ */ jsx2("p", { children: item.description || rationale }),
567
- busy ? /* @__PURE__ */ jsx2("p", { role: "status", className: "og-session-capability-progress", children: waiting ? `Finish signing in with ${item.name} in the opened window. This will close automatically when you\u2019re connected.` : "Preparing your connection\u2026" }) : !connected ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
637
+ busy ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
638
+ /* @__PURE__ */ jsx2("p", { role: "status", className: "og-session-capability-progress", children: waiting ? `Finish signing in with ${item.name} in the opened window. This will close automatically when you\u2019re connected.` : reconciling ? "Finishing your connection\u2026" : "Preparing your connection\u2026" }),
639
+ waiting ? /* @__PURE__ */ jsx2(
640
+ "button",
641
+ {
642
+ type: "button",
643
+ className: "og-session-capability-stop",
644
+ onClick: () => authorization.current?.abort(new ConnectPopupClosedError()),
645
+ children: "Stop waiting"
646
+ }
647
+ ) : null
648
+ ] }) : !connected ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
568
649
  !item.connectionRef ? /* @__PURE__ */ jsxs2("fieldset", { disabled: busy, children: [
569
650
  /* @__PURE__ */ jsx2("legend", { children: "Who can use this connection?" }),
570
651
  /* @__PURE__ */ jsxs2("label", { children: [
@@ -598,10 +679,12 @@ function ScopedCard({
598
679
  {
599
680
  className: "og-session-capability-primary",
600
681
  onClick: () => {
601
- if (view.attempt?.nextAction.type === "authorize") void authorize(view.attempt);
682
+ if (notice || retryFresh) void begin(true);
683
+ else if (view.attempt?.nextAction.type === "authorize" && view.attempt.ownership === ownership)
684
+ void authorize(view.attempt);
602
685
  else void begin();
603
686
  },
604
- children: error && view.attempt?.nextAction.type === "authorize" ? "Try signing in again" : `Continue to ${item.name}`
687
+ children: retryFresh || (error || notice) && view.attempt?.nextAction.type === "authorize" ? "Try signing in again" : `Continue to ${item.name}`
605
688
  }
606
689
  )
607
690
  ] }) : null,
@@ -632,4 +715,4 @@ export {
632
715
  SessionMcpCapabilityCard,
633
716
  McpConnectionCard
634
717
  };
635
- //# sourceMappingURL=chunk-5UONOQ3Y.js.map
718
+ //# sourceMappingURL=chunk-K3MQZO7R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-connect.ts","../src/session-capability-policy.ts","../src/components/session-capability-frame.tsx","../src/components/session-mcp-capability-card.tsx","../src/mcp-connection-status.ts"],"sourcesContent":["import type { ConnectController } from \"@opengeni/connect\";\nimport { useMemo, useSyncExternalStore } from \"react\";\n\n/** Internal consumers import the hook directly so setup surfaces stay lazy. */\nexport function useConnect(controller: ConnectController) {\n const snapshot = useSyncExternalStore(\n controller.subscribe,\n controller.getSnapshot,\n controller.getSnapshot,\n );\n const actions = useMemo(\n () => ({\n begin: controller.begin.bind(controller),\n recover: controller.recover.bind(controller),\n refresh: controller.refresh.bind(controller),\n waitForAction: controller.waitForAction.bind(controller),\n advance: controller.advance.bind(controller),\n cancel: controller.cancel.bind(controller),\n }),\n [controller],\n );\n return useMemo(() => ({ ...snapshot, ...actions }), [snapshot, actions]);\n}\n","import type { FirstPartyMcpToolName, CapabilityCatalogItem } from \"@opengeni/sdk\";\nimport type { OpenGeniBrowserClient as OpenGeniClient } from \"@opengeni/sdk/browser\";\n\n/** Catalog tool discovery may be lazy; selecting the installed server does not\n * require its individual tool inventory to have been fetched. */\nexport function sessionCapabilityTools(item: CapabilityCatalogItem) {\n const serverId = item.kind === \"mcp\" ? item.runtime?.mcpServerId : undefined;\n return serverId && !item.tools.some((tool) => tool.kind === \"mcp\" && tool.id === serverId)\n ? [...item.tools, { kind: \"mcp\" as const, id: serverId }]\n : item.tools;\n}\n\n/** A connection never resets the human's existing tool selection. Default-mode\n * sessions discover newly enabled servers at admission; explicit/inherited\n * policies add only this reviewed capability, with the existing CAS fence. */\nexport async function attachSessionCapability(\n client: OpenGeniClient,\n workspaceId: string,\n sessionId: string,\n item: CapabilityCatalogItem,\n stillCurrent: () => boolean = () => true,\n): Promise<void> {\n const tools = sessionCapabilityTools(item);\n if (item.kind === \"skill\" || tools.length === 0) return;\n if (!stillCurrent()) throw new Error(\"Connection setup was interrupted.\");\n const session = await client.getSession(workspaceId, sessionId);\n if (!stillCurrent()) throw new Error(\"Connection setup was interrupted.\");\n // Session.tools includes mandatory runtime servers, which must never be\n // echoed into the human's explicit selection.\n let existing = session.tools.filter(\n (tool) => !session.effectiveToolPolicy?.mandatoryIds?.includes(tool.id),\n );\n if (session.toolPolicy.mode === \"workspace_default\") {\n const policy = session.effectiveToolPolicy;\n if (!policy || policy.idsTruncated)\n throw new Error(\n \"Connected, but the full session tool selection could not be read. Review the Tools picker before continuing.\",\n );\n // A workspace may choose a restricted default instead of all enabled servers.\n // Preserve that exact selection if this connection needs an explicit addition.\n // selectedIds contains only explicit additions, and is normally empty for\n // automatic selection. Compare against the resolved defaults instead.\n existing = policy.effectiveIds\n .filter((id) => !policy.mandatoryIds.includes(id))\n .map((id) => ({ kind: \"mcp\" as const, id }));\n }\n const additions = tools.filter(\n (tool) => !existing.some((current) => current.kind === tool.kind && current.id === tool.id),\n );\n const recommended = Array.isArray(item.metadata?.firstPartyMcpTools)\n ? (item.metadata.firstPartyMcpTools.filter(\n (name): name is string => typeof name === \"string\",\n ) as FirstPartyMcpToolName[])\n : [];\n const firstParty = [...new Set([...session.firstPartyMcpTools, ...recommended])];\n if (additions.length === 0 && firstParty.length === session.firstPartyMcpTools.length) return;\n await client.updateSessionToolPolicy(workspaceId, sessionId, {\n mode: \"explicit\",\n tools: [...existing, ...additions],\n firstPartyMcpTools: firstParty,\n expectedVersion: session.toolPolicyVersion,\n });\n}\n\n/** Native OAuth callbacks have already saved the provider connection. Finish\n * the separate, version-fenced session tool selection before reporting success. */\nexport async function completeSessionCapabilityOAuth(\n client: OpenGeniClient,\n workspaceId: string,\n sessionId: string,\n capabilityId: string | null,\n): Promise<void> {\n if (!capabilityId)\n throw new Error(\n \"The authorized integration could not be identified. Review its connection card to finish setup.\",\n );\n const connected = (await client.listCapabilities(workspaceId)).items.find(\n (item) => item.id === capabilityId,\n );\n if (!connected?.enabled)\n throw new Error(\"The connection was authorized, but enabling its tools could not be verified.\");\n await attachSessionCapability(client, workspaceId, sessionId, connected);\n}\n","import { CheckIcon, ShieldCheckIcon, XIcon } from \"lucide-react\";\nimport { Dialog } from \"radix-ui\";\nimport { useRef, useState, type ReactNode, type RefObject } from \"react\";\nimport { usePortalTokenStyle } from \"../lib/use-portal-token-style\";\n\nexport type SessionCapabilityFrameProps = {\n name: string;\n subtitle: string;\n logo: string | null;\n typeLabel: string;\n description: string;\n skill: boolean;\n expanded: boolean;\n complete: boolean;\n /** Completion copy must reflect the provider's actual scope of access. */\n completeLabel?: string;\n actionLabel: string;\n /** Direct navigation actions should not announce a dialog on the card. */\n opensDialog?: boolean;\n note: string;\n onOpen(): void;\n onClose(): void;\n busy?: boolean;\n opener?: RefObject<HTMLButtonElement | null>;\n cardRef?: RefObject<HTMLElement | null>;\n children?: ReactNode;\n /** A catalogue row can own the opener while reusing the same details dialog. */\n dialogOnly?: boolean;\n};\n\nfunction Mark({ src, name }: { src: string | null; name: string }) {\n const [failed, setFailed] = useState<string | null>(null);\n return (\n <span className=\"og-session-capability-logo\" aria-hidden>\n {src && failed !== src ? (\n <img src={src} alt=\"\" loading=\"lazy\" decoding=\"async\" onError={() => setFailed(src)} />\n ) : (\n name.trim().slice(0, 2).toUpperCase()\n )}\n </span>\n );\n}\n\n/** The same conversation card in the console and embedded clients. Setup\n * content owns the provider flow; this frame owns identity and protected focus. */\nexport function SessionCapabilityFrame({\n name,\n subtitle,\n logo,\n typeLabel,\n description,\n skill,\n expanded,\n complete,\n completeLabel,\n actionLabel,\n opensDialog = true,\n note,\n onOpen,\n onClose,\n busy = false,\n opener,\n cardRef,\n children,\n dialogOnly = false,\n}: SessionCapabilityFrameProps) {\n const localOpener = useRef<HTMLButtonElement>(null);\n const localCard = useRef<HTMLElement>(null);\n const buttonRef = opener ?? localOpener;\n const sectionRef = cardRef ?? localCard;\n const portalStyle = usePortalTokenStyle(sectionRef.current);\n const identity = (\n <>\n <Mark src={logo} name={name} />\n <div className=\"og-session-capability-identity\">\n <h3>{name}</h3>\n <span>{subtitle}</span>\n </div>\n <span className=\"og-session-capability-type\">{typeLabel}</span>\n </>\n );\n return (\n <div className=\"og-session-capability\">\n <section\n hidden={dialogOnly}\n style={dialogOnly ? { display: \"none\" } : undefined}\n ref={sectionRef}\n tabIndex={-1}\n aria-label={`${name} setup`}\n data-state={complete ? \"complete\" : expanded ? \"setup\" : \"suggested\"}\n className=\"og-session-capability-shell\"\n >\n <div className=\"og-session-capability-header\">\n {identity}\n {complete ? <CheckIcon size={16} aria-hidden /> : null}\n </div>\n {complete ? (\n <p role=\"status\" className=\"og-session-capability-copy\">\n {completeLabel ??\n (skill ? \"Installed · Workspace\" : \"Connected · Available in this conversation\")}\n </p>\n ) : (\n <>\n <p className=\"og-session-capability-copy\">{description}</p>\n <div className=\"og-session-capability-actions\">\n <span>\n <ShieldCheckIcon size={13} aria-hidden />\n {skill ? \"Guidance only · no account access\" : \"You choose what to authorize\"}\n </span>\n <button\n ref={buttonRef}\n type=\"button\"\n onClick={onOpen}\n disabled={busy}\n aria-haspopup={opensDialog ? \"dialog\" : undefined}\n aria-expanded={opensDialog ? expanded : undefined}\n >\n {actionLabel}\n </button>\n </div>\n </>\n )}\n </section>\n {!complete && !dialogOnly ? <p className=\"og-session-capability-note\">{note}</p> : null}\n <Dialog.Root\n open={expanded && !complete}\n onOpenChange={(open) => {\n if (!open && !busy) onClose();\n }}\n >\n <Dialog.Portal>\n <Dialog.Overlay className=\"og-root og-session-capability-overlay\" style={portalStyle} />\n <Dialog.Content\n className=\"og-root og-session-capability-dialog\"\n style={portalStyle}\n onEscapeKeyDown={(event) => {\n if (busy) event.preventDefault();\n }}\n onInteractOutside={(event) => {\n if (busy) event.preventDefault();\n }}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n const target = buttonRef.current?.isConnected\n ? buttonRef.current\n : sectionRef.current;\n if (target?.isConnected) target.focus();\n }}\n >\n <div className=\"og-session-capability-dialog-header\">\n <Mark src={logo} name={name} />\n <div>\n <Dialog.Title>{name}</Dialog.Title>\n <Dialog.Description>\n {typeLabel}\n {subtitle ? ` · ${subtitle}` : \"\"}\n </Dialog.Description>\n </div>\n {!busy ? (\n <Dialog.Close aria-label=\"Close connection setup\">\n <XIcon size={18} />\n </Dialog.Close>\n ) : null}\n </div>\n <div className=\"og-session-capability-dialog-body\">{children}</div>\n </Dialog.Content>\n </Dialog.Portal>\n </Dialog.Root>\n </div>\n );\n}\n","import {\n authorizeConnectAttempt,\n ConnectPopupClosedError,\n ConnectController,\n createBrowserConnectNavigation,\n reserveBrowserConnectNavigation,\n type ConnectAttempt,\n type ConnectNavigation,\n type ConnectOwnership,\n} from \"@opengeni/connect\";\nimport type { CapabilityCatalogItem } from \"@opengeni/sdk\";\nimport type { OpenGeniBrowserClient as OpenGeniClient } from \"@opengeni/sdk/browser\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useConnect } from \"../hooks/use-connect\";\nimport { attachSessionCapability, sessionCapabilityTools } from \"../session-capability-policy\";\nimport { SessionCapabilityFrame } from \"./session-capability-frame\";\nimport { matchingActiveMcpConnections } from \"../mcp-connection-status\";\n\nexport type SessionMcpCapabilityCardProps = {\n client: OpenGeniClient;\n workspaceId: string;\n sessionId: string;\n capabilityId: string;\n name: string;\n rationale?: string;\n /** Exact host route; no console-specific routing is assumed. */\n returnUrl: string;\n onConfigured?: (() => void | Promise<void>) | undefined;\n};\n\nexport type McpConnectionCardProps = Omit<SessionMcpCapabilityCardProps, \"sessionId\"> & {\n /** Omit for connection management: no session tool selection is written. */\n sessionId?: string;\n dialogOnly?: boolean;\n onClose?: (() => void) | undefined;\n};\n\n/** Native OAuth recommendation flow. Identity and endpoint come from the live\n * catalog, never from model-authored recommendation text. */\nexport function SessionMcpCapabilityCard(props: SessionMcpCapabilityCardProps) {\n return <McpConnectionCard {...props} />;\n}\n\nexport function McpConnectionCard(props: McpConnectionCardProps) {\n const [client, setClient] = useState(props.client);\n const [generation, setGeneration] = useState(0);\n if (client !== props.client) {\n setClient(props.client);\n setGeneration(generation + 1);\n }\n return (\n <ScopedCard\n key={`${generation}:${props.workspaceId}:${props.sessionId}:${props.capabilityId}`}\n {...props}\n />\n );\n}\n\nfunction ScopedCard({\n client,\n workspaceId,\n sessionId,\n capabilityId,\n name,\n rationale = \"\",\n returnUrl,\n onConfigured,\n dialogOnly = false,\n onClose,\n}: McpConnectionCardProps) {\n const [controller] = useState(\n () => new ConnectController(client.connectTransport(), workspaceId),\n );\n const view = useConnect(controller);\n const [item, setItem] = useState<CapabilityCatalogItem | null>(null);\n const [logo, setLogo] = useState<string | null>(null);\n const [expanded, setExpanded] = useState(dialogOnly);\n const [complete, setComplete] = useState(false);\n const [connected, setConnected] = useState(false);\n const [waiting, setWaiting] = useState(false);\n const [reconciling, setReconciling] = useState(false);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n const [retryFresh, setRetryFresh] = useState(false);\n const [ownership, setOwnership] = useState<ConnectOwnership>(\"workspace\");\n const lifetime = useRef<AbortController | null>(null);\n const authorization = useRef<AbortController | null>(null);\n const operation = useRef<AbortController | null>(null);\n const reservedPopup = useRef<(() => void) | null>(null);\n const startKey = useRef(crypto.randomUUID());\n const advanceKey = useRef(crypto.randomUUID());\n const startInput = useRef<string | null>(null);\n const storageKey = sessionId\n ? `opengeni:session-connect:${workspaceId}:${sessionId}:${capabilityId}`\n : `opengeni:workspace-connect:${workspaceId}:${capabilityId}`;\n const current = () => !!lifetime.current && !lifetime.current.signal.aborted;\n\n async function load(active: () => boolean = current) {\n const invocation = lifetime.current;\n const [catalog, session] = await Promise.all([\n client.listCapabilities(workspaceId),\n sessionId ? client.getSession(workspaceId, sessionId) : Promise.resolve(null),\n ]);\n if (!invocation || invocation.signal.aborted || lifetime.current !== invocation || !active())\n return null;\n const resolved = catalog.items.find((entry) => entry.id === capabilityId);\n if (!resolved || resolved.kind !== \"mcp\" || resolved.authKind !== \"oauth2\")\n throw new Error(\n \"This recommendation is not an available OAuth MCP integration. Review the current connection catalog.\",\n );\n setItem(resolved);\n if (resolved.connectionRef)\n setOwnership(resolved.connectionRef.subjectScope === \"subject\" ? \"personal\" : \"workspace\");\n else if (!item && resolved.metadata?.defaultConnectionOwnership === \"personal\")\n setOwnership(\"personal\");\n let accountReady = false;\n if (resolved.enabled && resolved.connectionRef) {\n const connections =\n resolved.connectionRef.subjectScope === \"subject\"\n ? await client.listOwnConnectionAccounts(workspaceId)\n : await client.listConnections(workspaceId);\n if (invocation.signal.aborted || lifetime.current !== invocation || !active()) return null;\n const matches = matchingActiveMcpConnections(resolved, connections);\n accountReady = matches.length === 1;\n }\n if (invocation.signal.aborted || lifetime.current !== invocation || !active()) return null;\n const selected =\n session?.toolPolicy.mode === \"workspace_default\"\n ? session.effectiveToolPolicy?.selectedIds\n : session?.tools.filter((tool) => tool.kind === \"mcp\").map((tool) => tool.id);\n setConnected(accountReady);\n setComplete(\n accountReady &&\n !!selected &&\n sessionCapabilityTools(resolved).every((tool) => selected.includes(tool.id)),\n );\n return resolved;\n }\n\n useEffect(() => {\n const abort = new AbortController();\n lifetime.current = abort;\n // Mount reads are scoped to this effect, not to the user-action lock.\n // Strict Mode may cancel the first mount while its promise is still in\n // flight; that must not suppress the replacement mount's initialization.\n if (dialogOnly) setBusy(true);\n void (async () => {\n await load();\n if (abort.signal.aborted || !dialogOnly) return;\n await recoverSavedAttempt();\n })()\n .catch((failure) => {\n if (!abort.signal.aborted)\n setError(\n failure instanceof Error ? failure.message : \"Couldn't load connection details.\",\n );\n })\n .finally(() => {\n if (!abort.signal.aborted && dialogOnly) setBusy(false);\n });\n return () => {\n abort.abort();\n };\n // ScopedCard remounts for client/workspace/session/capability changes.\n // These reads initialize that scope; rerunning on action closures would\n // cancel initialization whenever its own state updates render the card.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, workspaceId, sessionId, capabilityId, dialogOnly]);\n\n useEffect(() => {\n const path = item?.logoAssetPath;\n setLogo(null);\n if (!path?.startsWith(\"catalog-assets/\")) return;\n const abort = new AbortController();\n let objectUrl: string | null = null;\n // Embeds can require authentication even for the API's public catalog\n // asset route. Use the client's transport instead of an unauthenticated img.\n void client\n .downloadCatalogAsset(path, { signal: abort.signal })\n .then((blob) => {\n if (abort.signal.aborted || !blob.type.startsWith(\"image/\") || blob.size > 2_000_000)\n return;\n objectUrl = URL.createObjectURL(blob);\n setLogo(objectUrl);\n })\n .catch(() => {\n /* Keep the provider's initials if its passive mark is unavailable. */\n });\n return () => {\n abort.abort();\n if (objectUrl) URL.revokeObjectURL(objectUrl);\n };\n }, [client, item?.logoAssetPath]);\n\n async function run(action: (active: () => boolean) => Promise<void>) {\n if (operation.current || !current()) return;\n const pending = new AbortController();\n operation.current = pending;\n const active = () => current() && operation.current === pending && !pending.signal.aborted;\n setBusy(true);\n setError(null);\n setNotice(null);\n setRetryFresh(false);\n try {\n await action(active);\n } catch (failure) {\n if (active()) {\n if (failure instanceof ConnectPopupClosedError) setNotice(failure.message);\n else\n setError(\n failure instanceof Error\n ? failure.message\n : \"Connection setup could not finish. Try again.\",\n );\n }\n } finally {\n if (operation.current === pending) {\n operation.current = null;\n if (current()) setBusy(false);\n }\n }\n }\n\n function remember(attemptId: string) {\n // An opaque recovery hint only. The backend rechecks the authenticated\n // owner on recover; this value never grants access or proves completion.\n try {\n sessionStorage.setItem(storageKey, attemptId);\n } catch {\n /* Storage may be disabled. */\n }\n }\n\n async function reconcile(attempt: ConnectAttempt, active: () => boolean = current) {\n if (!active()) return;\n if (attempt.state !== \"complete\" || !attempt.account || !attempt.credentialsCommitted) return;\n const resolved = await load(active);\n if (!resolved || !active()) return;\n const connection = (await client.listConnections(workspaceId)).find(\n (entry) => entry.id === attempt.account!.id,\n );\n if (!active()) return;\n if (\n !connection ||\n connection.status !== \"active\" ||\n connection.kind !== \"oauth2\" ||\n connection.metadata.mcpUrl !== (resolved.mcpUrl ?? resolved.endpointUrl) ||\n (connection.subjectId !== null) !== (attempt.ownership === \"personal\")\n )\n throw new Error(\n \"The authorized account does not match this integration. Review its connection settings.\",\n );\n const previous = resolved.connectionRef;\n if (\n resolved.enabled &&\n previous?.subjectScope !== \"subject\" &&\n previous?.connectionId &&\n previous.connectionId !== connection.id\n )\n throw new Error(\n \"This integration's selected account changed during setup. Review it before continuing.\",\n );\n await client.enableCapability(workspaceId, capabilityId, {\n connectionRef:\n attempt.ownership === \"personal\"\n ? { providerDomain: connection.providerDomain, kind: \"oauth2\", subjectScope: \"subject\" }\n : {\n providerDomain: connection.providerDomain,\n kind: \"oauth2\",\n subjectScope: \"workspace\",\n connectionId: connection.id,\n },\n });\n if (!active()) return;\n const enabled = await load(active);\n if (enabled && active()) {\n await finishConnection(enabled, active);\n }\n if (!active()) return;\n try {\n sessionStorage.removeItem(storageKey);\n } catch {\n /* Recovery hint only. */\n }\n }\n\n async function open() {\n setExpanded(true);\n await run(async (active) => {\n await load(active);\n if (!active()) return;\n await recoverSavedAttempt(active);\n });\n }\n\n async function recoverSavedAttempt(active: () => boolean = current) {\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem(storageKey);\n } catch {\n /* No persisted attempt. */\n }\n if (saved) {\n const attempt = await controller.recover(saved);\n if (!active()) return;\n if ([\"failed\", \"expired\", \"cancelled\"].includes(attempt.state)) setRetryFresh(true);\n if (attempt.state === \"complete\") setReconciling(true);\n try {\n await reconcile(attempt, active);\n } finally {\n if (active()) setReconciling(false);\n }\n }\n }\n\n async function begin(fresh = false) {\n await run(async (active) => {\n if (\n fresh ||\n (view.attempt && [\"failed\", \"expired\", \"cancelled\"].includes(view.attempt.state))\n ) {\n startKey.current = crypto.randomUUID();\n advanceKey.current = crypto.randomUUID();\n }\n const reserved = reserveBrowserConnectNavigation(window);\n reservedPopup.current = reserved.close;\n try {\n const resolved = await load(active);\n if (!resolved || !active()) return;\n if (\n resolved.connectionRef &&\n ownership !==\n (resolved.connectionRef.subjectScope === \"subject\" ? \"personal\" : \"workspace\")\n )\n throw new Error(\n \"The connection ownership changed. Review the current account before continuing.\",\n );\n const mcpUrl = resolved.mcpUrl ?? resolved.endpointUrl;\n if (!mcpUrl)\n throw new Error(\n \"The current catalog has no authorization endpoint for this integration.\",\n );\n // Never silently replace an already selected account. Reauthorization\n // stays on its exact native connection ID.\n let reconnectAccountId = resolved.connectionRef?.connectionId ?? undefined;\n if (resolved.connectionRef?.subjectScope === \"subject\") {\n const connections = (await client.listConnections(workspaceId)).filter(\n (entry) =>\n entry.subjectId !== null &&\n entry.kind === \"oauth2\" &&\n entry.metadata.mcpUrl === mcpUrl,\n );\n if (!active()) return;\n if (connections.length > 1)\n throw new Error(\n \"More than one personal account matches. Choose the account in connection settings before reconnecting.\",\n );\n reconnectAccountId = connections[0]?.id;\n }\n // A closed request can still have reached the server. Keep its key for\n // an exact replay, but never reuse it when ownership or another input\n // changes while the user reopens setup.\n const input = JSON.stringify({ ownership, returnUrl, reconnectAccountId, mcpUrl });\n if (startInput.current !== null && startInput.current !== input) {\n startKey.current = crypto.randomUUID();\n advanceKey.current = crypto.randomUUID();\n }\n startInput.current = input;\n let attempt = await controller.begin({\n providerId: \"mcp-oauth\",\n ownership,\n returnUrl,\n idempotencyKey: startKey.current,\n ...(reconnectAccountId ? { reconnectAccountId } : {}),\n });\n if (!active()) return;\n remember(attempt.id);\n if (attempt.state === \"credential_input\")\n attempt = await controller.advance(\n { type: \"credentials\", values: { mcpUrl } },\n advanceKey.current,\n );\n if (!active()) return;\n if (attempt.nextAction.type === \"authorize\")\n await performAuthorization(attempt, reserved.navigation, active);\n else await reconcile(attempt, active);\n } finally {\n if (reservedPopup.current === reserved.close) reservedPopup.current = null;\n reserved.close();\n }\n });\n }\n\n async function performAuthorization(\n attempt: ConnectAttempt,\n navigation: ConnectNavigation,\n active: () => boolean,\n ) {\n if (!active()) return;\n const pending = new AbortController();\n authorization.current = pending;\n const abortOnUnmount = () => pending.abort(lifetime.current?.signal.reason);\n lifetime.current!.signal.addEventListener(\"abort\", abortOnUnmount, { once: true });\n setWaiting(true);\n try {\n const result = await authorizeConnectAttempt(controller.transport, attempt, navigation, {\n mode: \"popup\",\n signal: pending.signal,\n });\n if (!active() || !result) return;\n setWaiting(false);\n setReconciling(true);\n await reconcile(result, active);\n if (!active()) return;\n if (result.state === \"cancelled\") {\n setNotice(\"Sign-in was cancelled. You can try connecting again.\");\n setRetryFresh(true);\n return;\n }\n if (result.state !== \"complete\") {\n if ([\"failed\", \"expired\"].includes(result.state)) setRetryFresh(true);\n throw new Error(\"Sign-in did not finish. You can try connecting again.\");\n }\n } finally {\n lifetime.current?.signal.removeEventListener(\"abort\", abortOnUnmount);\n if (authorization.current === pending) authorization.current = null;\n if (active()) {\n setReconciling(false);\n setWaiting(false);\n }\n }\n }\n\n function authorize(attempt: ConnectAttempt) {\n // run invokes action synchronously, retaining the browser click gesture.\n return run((active) =>\n performAuthorization(attempt, createBrowserConnectNavigation(window), active),\n );\n }\n\n async function finishConnection(\n capability: CapabilityCatalogItem,\n active: () => boolean = current,\n ) {\n if (!sessionId) {\n // Connection management does not select session tools.\n await onConfigured?.();\n if (!active()) return;\n setComplete(true);\n setExpanded(false);\n onClose?.();\n return;\n }\n if (capability.connectionRef && capability.connectionRef.subjectScope !== \"subject\") {\n const selected = (await client.listConnections(workspaceId)).find(\n (entry) => entry.id === capability.connectionRef?.connectionId,\n );\n if (!active()) return;\n if (!selected || selected.status !== \"active\")\n throw new Error(\"This account needs reconnection before it can be used here.\");\n }\n if (capability.connectionRef?.subjectScope === \"subject\") {\n const accounts = await client.listOwnConnectionAccounts(workspaceId);\n if (!active()) return;\n if (matchingActiveMcpConnections(capability, accounts).length === 0)\n throw new Error(\"Your account needs reconnection before it can be used here.\");\n }\n if (!active()) return;\n await attachSessionCapability(client, workspaceId, sessionId, capability, active);\n if (!active()) return;\n await onConfigured?.();\n if (!active()) return;\n setComplete(true);\n setExpanded(false);\n }\n\n async function useHere() {\n await run(async (active) => {\n if (item) await finishConnection(item, active);\n });\n }\n\n function close() {\n const pending = operation.current;\n if (pending) {\n operation.current = null;\n pending.abort(new ConnectPopupClosedError());\n authorization.current?.abort(new ConnectPopupClosedError());\n authorization.current = null;\n reservedPopup.current?.();\n setBusy(false);\n setWaiting(false);\n setReconciling(false);\n }\n setExpanded(false);\n onClose?.();\n }\n\n return (\n <SessionCapabilityFrame\n name={item?.name ?? name}\n subtitle={item?.providerDomain ?? \"\"}\n logo={logo}\n typeLabel=\"MCP server\"\n description={item?.description || rationale}\n skill={false}\n expanded={expanded}\n complete={complete}\n actionLabel={\n connected\n ? sessionId\n ? \"Use in this conversation\"\n : \"Connected\"\n : `Connect ${item?.name ?? name}`\n }\n note={\n sessionId\n ? \"Review access before signing in. You'll return to this conversation after authorization.\"\n : \"Review access before signing in. You'll return here after authorization.\"\n }\n onOpen={() => void open()}\n onClose={close}\n dialogOnly={dialogOnly}\n >\n <div className=\"og-session-capability-setup\">\n {error ? <p role=\"alert\">{error}</p> : null}\n {notice ? (\n <p role=\"status\" className=\"og-session-capability-notice\">\n {notice}\n </p>\n ) : null}\n {!item ? (\n <>\n <p role=\"status\">\n {busy ? \"Loading connection details…\" : \"Connection details are unavailable.\"}\n </p>\n <button disabled={busy} onClick={() => void open()}>\n Retry\n </button>\n </>\n ) : (\n <>\n <p>{item.description || rationale}</p>\n {busy ? (\n <>\n <p role=\"status\" className=\"og-session-capability-progress\">\n {waiting\n ? `Finish signing in with ${item.name} in the opened window. This will close automatically when you’re connected.`\n : reconciling\n ? \"Finishing your connection…\"\n : \"Preparing your connection…\"}\n </p>\n {waiting ? (\n <button\n type=\"button\"\n className=\"og-session-capability-stop\"\n onClick={() => authorization.current?.abort(new ConnectPopupClosedError())}\n >\n Stop waiting\n </button>\n ) : null}\n </>\n ) : !connected ? (\n <>\n {!item.connectionRef ? (\n <fieldset disabled={busy}>\n <legend>Who can use this connection?</legend>\n <label>\n <input\n type=\"radio\"\n name={`${capabilityId}-ownership`}\n checked={ownership === \"workspace\"}\n onChange={() => setOwnership(\"workspace\")}\n />\n Everyone in this workspace\n </label>\n <label>\n <input\n type=\"radio\"\n name={`${capabilityId}-ownership`}\n checked={ownership === \"personal\"}\n onChange={() => setOwnership(\"personal\")}\n />\n Only me\n </label>\n </fieldset>\n ) : null}\n <p className=\"og-session-capability-scope\">\n {ownership === \"workspace\"\n ? sessionId\n ? \"This connection will be available to your workspace and used in this conversation.\"\n : \"This connection will be available to your workspace.\"\n : \"This connection belongs to you. Your messages can use it; other participants use their own accounts.\"}\n </p>\n <button\n className=\"og-session-capability-primary\"\n onClick={() => {\n if (notice || retryFresh) void begin(true);\n else if (\n view.attempt?.nextAction.type === \"authorize\" &&\n view.attempt.ownership === ownership\n )\n void authorize(view.attempt);\n else void begin();\n }}\n >\n {retryFresh ||\n ((error || notice) && view.attempt?.nextAction.type === \"authorize\")\n ? \"Try signing in again\"\n : `Continue to ${item.name}`}\n </button>\n </>\n ) : null}\n {connected && !busy ? (\n <>\n <p className=\"og-session-capability-scope\">\n {sessionId\n ? \"Your account is connected. Enable it for this conversation to finish.\"\n : \"Your account is connected.\"}\n </p>\n <button\n className=\"og-session-capability-primary\"\n disabled={busy || view.busy}\n onClick={() => void useHere()}\n >\n {sessionId ? \"Use in this conversation\" : \"Done\"}\n </button>\n </>\n ) : null}\n </>\n )}\n </div>\n </SessionCapabilityFrame>\n );\n}\n","import type { CapabilityCatalogItem, ConnectionMetadata } from \"@opengeni/sdk\";\n\n/** Status only; runtime use is authorized for the authenticated initiating user. */\nexport function matchingActiveMcpConnections(\n item: CapabilityCatalogItem,\n connections: ConnectionMetadata[],\n) {\n return matchingMcpConnections(item, connections).filter((entry) => entry.status === \"active\");\n}\n\nfunction matchingMcpConnections(item: CapabilityCatalogItem, connections: ConnectionMetadata[]) {\n const ref = item.connectionRef;\n if (!item.enabled || !ref) return [];\n return connections.filter(\n (entry) =>\n entry.status !== \"revoked\" &&\n entry.kind === \"oauth2\" &&\n entry.metadata.mcpUrl === (item.mcpUrl ?? item.endpointUrl) &&\n (ref.subjectScope !== \"subject\"\n ? entry.id === ref.connectionId && entry.subjectId === null\n : entry.subjectId !== null),\n );\n}\n\n/** Installation availability is not account readiness. Revoked history is not actionable. */\nexport function mcpConnectionDiscoveryState(\n item: CapabilityCatalogItem,\n connections: ConnectionMetadata[],\n) {\n const matching = matchingMcpConnections(item, connections);\n const active = matching.filter((entry) => entry.status === \"active\");\n if (active.length === 1) return { status: \"added\", label: \"Connected\" } as const;\n if (matching.length > 0) return { status: \"attention\", label: \"Review connection\" } as const;\n return { status: \"available\", label: \"Connect\" } as const;\n}\n"],"mappings":";;;;;AACA,SAAS,SAAS,4BAA4B;AAGvC,SAAS,WAA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V,sBACG,0EACA,8BACN;AAAA,YACA,gBAAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,UAAU,QAAQ,KAAK;AAAA,gBACvB,SAAS,MAAM,KAAK,QAAQ;AAAA,gBAE3B,sBAAY,6BAA6B;AAAA;AAAA,YAC5C;AAAA,aACF,IACE;AAAA,WACN;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;","names":["useRef","useState","Fragment","jsx","jsxs","useState","useRef"]}
@@ -4,7 +4,7 @@ import {
4
4
  editableArtifactAccessRevoked,
5
5
  editableArtifactStatusLabel,
6
6
  useEditableArtifactView
7
- } from "./chunk-KCGXPP5V.js";
7
+ } from "./chunk-6P7T4RPE.js";
8
8
  import {
9
9
  cn
10
10
  } from "./chunk-22KP6LR5.js";
@@ -2524,6 +2524,7 @@ function EditableSpreadsheetGrid({
2524
2524
  function EditableSpreadsheetArtifactSurface({
2525
2525
  session,
2526
2526
  title = "Workbook",
2527
+ showHeader,
2527
2528
  subtitle,
2528
2529
  actions,
2529
2530
  initialSheetId,
@@ -2599,6 +2600,7 @@ function EditableSpreadsheetArtifactSurface({
2599
2600
  {
2600
2601
  modality: "spreadsheet",
2601
2602
  title,
2603
+ showHeader,
2602
2604
  subtitle: subtitle ?? (accessRevoked ? editableArtifactStatusLabel(view) : metadata ? `${sheets.length} sheet${sheets.length === 1 ? "" : "s"}` : editableArtifactStatusLabel(view)),
2603
2605
  actions,
2604
2606
  footer: accessRevoked ? void 0 : footer,
@@ -2833,4 +2835,4 @@ export {
2833
2835
  EditableSpreadsheetGrid,
2834
2836
  EditableSpreadsheetArtifactSurface
2835
2837
  };
2836
- //# sourceMappingURL=chunk-OWHPKAOV.js.map
2838
+ //# sourceMappingURL=chunk-L6MYP3QU.js.map