@burdenoff/microfe-vibecontrols 2026.1117.2 → 2026.1123.2

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.
@@ -6,18 +6,19 @@ import { Card as n } from "../shared/Card.js";
6
6
  import { ScorecardTier as r } from "../../generated/wspace-types.js";
7
7
  import { VIBE_PERMISSIONS as i } from "../../constants/permissions.js";
8
8
  import { EntityShareButton as a } from "../sharing/EntityShareButton.js";
9
- import { useAddScorecardMetricMutation as o, useApplyScorecardTemplateMutation as s, useGetScorecardQuery as c, useRemoveScorecardMetricMutation as ee, useUpdateScorecardMetricMutation as te, useUpsertScorecardMutation as ne } from "../../generated/wspace-operations.js";
10
- import { DIRECTION_OPTIONS as re, METRIC_TYPE_OPTIONS as ie, STATUS_OPTIONS as ae, deriveStatus as oe, statusConfig as l } from "./scorecardConstants.js";
11
- import { ScorecardEmptyState as se } from "./ScorecardEmptyState.js";
12
- import { ScorecardsOverviewPanel as ce } from "./ScorecardsOverviewPanel.js";
13
- import { MetricTrend as le } from "./MetricTrend.js";
14
- import { useCallback as u, useEffect as ue, useState as d } from "react";
15
- import { useI18n as de } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
16
- import { Info as fe, Pencil as pe, Plus as me, RefreshCw as he, ShieldCheck as f, Trash2 as ge, TrendingUp as _e } from "lucide-react";
17
- import { useActiveContext as ve, usePermissions as ye } from "@burdenoff/fe-libs/shared/providers/shell";
9
+ import { useAddScorecardMetricMutation as o, useApplyScorecardTemplateMutation as s, useGetScorecardQuery as ee, useRemoveScorecardMetricMutation as te, useUpdateScorecardMetricMutation as ne, useUpsertScorecardMutation as re } from "../../generated/wspace-operations.js";
10
+ import { DIRECTION_OPTIONS as ie, METRIC_TYPE_OPTIONS as ae, STATUS_OPTIONS as oe, deriveStatus as se, statusConfig as c } from "./scorecardConstants.js";
11
+ import { ScorecardEmptyState as ce } from "./ScorecardEmptyState.js";
12
+ import { ScorecardsOverviewPanel as le } from "./ScorecardsOverviewPanel.js";
13
+ import { MetricTrend as ue } from "./MetricTrend.js";
14
+ import { getSafeScorecardIframeUrl as l } from "../../utils/iframeUrl.js";
15
+ import { useCallback as u, useEffect as de, useState as d } from "react";
16
+ import { useI18n as fe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
+ import { Info as pe, Pencil as me, Plus as he, RefreshCw as ge, ShieldCheck as f, Trash2 as _e, TrendingUp as ve } from "lucide-react";
18
+ import { useActiveContext as ye, usePermissions as be } from "@burdenoff/fe-libs/shared/providers/shell";
18
19
  import { AnimatePresence as p, motion as m } from "framer-motion";
19
- import { Fragment as be, jsx as h, jsxs as g } from "react/jsx-runtime";
20
- import { MotionItem as xe, MotionList as Se } from "@burdenoff/fe-libs/shared/motion";
20
+ import { Fragment as xe, jsx as h, jsxs as g } from "react/jsx-runtime";
21
+ import { MotionItem as Se, MotionList as Ce } from "@burdenoff/fe-libs/shared/motion";
21
22
  // src/components/scorecard/ScorecardPanel.tsx
22
23
  var _ = {
23
24
  name: "",
@@ -33,21 +34,21 @@ var _ = {
33
34
  iframeUrl: "",
34
35
  iframeHeight: ""
35
36
  }, v = "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary outline-none focus:border-action-primary-bg", y = ({ ownerType: r, ownerId: f, onAddMetric: y }) => {
36
- let { t: b } = de(), x = u((e, t) => {
37
+ let { t: b } = fe(), x = u((e, t) => {
37
38
  let n = b(e);
38
39
  return n === e ? t : n;
39
- }, [b]), { workspaceId: we } = ve(), { hasPermission: S, permissions: C } = ye(), w = (Array.isArray(C) ? C : C?.permissionStrings)?.some?.((e) => e.startsWith("scorecard:")), Te = !w || S(i.SCORECARD_CREATE), Ee = !w || S(i.SCORECARD_UPDATE), De = !w || S(i.SCORECARD_DELETE), [Oe, T] = d(null), [ke, E] = d(!1), [D, O] = d(null), [k, A] = d(null), [j, M] = d(null), [N, P] = d(_), [F, I] = d(null), [Ae, L] = d(null), { data: je, loading: Me, error: R, refetch: z } = c({
40
+ }, [b]), { workspaceId: Te } = ye(), { hasPermission: S, permissions: C } = be(), w = (Array.isArray(C) ? C : C?.permissionStrings)?.some?.((e) => e.startsWith("scorecard:")), Ee = !w || S(i.SCORECARD_CREATE), De = !w || S(i.SCORECARD_UPDATE), Oe = !w || S(i.SCORECARD_DELETE), [ke, T] = d(null), [Ae, E] = d(!1), [D, O] = d(null), [k, A] = d(null), [j, M] = d(null), [N, P] = d(_), [F, I] = d(null), [je, L] = d(null), { data: Me, loading: Ne, error: R, refetch: z } = ee({
40
41
  variables: {
41
42
  ownerType: r,
42
43
  ownerId: f
43
44
  },
44
45
  skip: !f,
45
46
  fetchPolicy: "cache-and-network"
46
- }), [Ne, { loading: Pe }] = ne(), [Fe, { loading: Ie }] = o(), [Le, { loading: Re }] = te(), [ze, { loading: B }] = ee(), [Be] = s(), V = je?.vibecontrolsScorecard ?? null, H = Pe || Ie || Re, U = D !== null, W = () => {
47
+ }), [Pe, { loading: Fe }] = re(), [Ie, { loading: Le }] = o(), [Re, { loading: ze }] = ne(), [Be, { loading: B }] = te(), [Ve] = s(), V = Me?.vibecontrolsScorecard ?? null, H = Fe || Le || ze, U = D !== null, W = () => {
47
48
  P(_), I(null), O(null);
48
49
  }, G = () => {
49
50
  y ? y() : (W(), E(!0));
50
- }, Ve = (e, t) => {
51
+ }, He = (e, t) => {
51
52
  e.stopPropagation(), P({
52
53
  name: t.name,
53
54
  description: t.description ?? "",
@@ -62,7 +63,7 @@ var _ = {
62
63
  iframeUrl: t.iframeUrl ?? "",
63
64
  iframeHeight: t.iframeHeight !== null && t.iframeHeight !== void 0 ? String(t.iframeHeight) : ""
64
65
  }), I(null), O(t.id), E(!0);
65
- }, He = (e, t) => {
66
+ }, Ue = (e, t) => {
66
67
  e.stopPropagation(), M(null), A({
67
68
  id: t.id,
68
69
  name: t.name
@@ -72,18 +73,18 @@ var _ = {
72
73
  }, q = u(() => {
73
74
  B || (A(null), M(null));
74
75
  }, [B]);
75
- ue(() => {
76
+ de(() => {
76
77
  if (!k) return;
77
78
  let e = (e) => {
78
79
  e.key === "Escape" && q();
79
80
  };
80
81
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
81
82
  }, [k, q]);
82
- let Ue = async () => {
83
+ let We = async () => {
83
84
  if (k) {
84
85
  M(null);
85
86
  try {
86
- await ze({ variables: { id: k.id } }), await z(), A(null);
87
+ await Be({ variables: { id: k.id } }), await z(), A(null);
87
88
  } catch (e) {
88
89
  M(e instanceof Error ? e.message : "Failed to remove metric");
89
90
  }
@@ -99,18 +100,18 @@ var _ = {
99
100
  let r = Number(n);
100
101
  if (!Number.isFinite(r)) throw Error(`${t} must be a valid number`);
101
102
  return r;
102
- }, We = async () => {
103
+ }, Ge = async () => {
103
104
  if (V?.id) return V.id;
104
- let e = (await Ne({ variables: { input: {
105
+ let e = (await Pe({ variables: { input: {
105
106
  ownerType: r,
106
107
  ownerId: f
107
108
  } } })).data?.upsertVibecontrolsScorecard.id;
108
109
  if (!e) throw Error(x("scorecard.scorecardCreateFailed", "Unable to create scorecard"));
109
110
  return e;
110
- }, Ge = async (e) => {
111
+ }, Ke = async (e) => {
111
112
  L(e);
112
113
  try {
113
- await Be({ variables: {
114
+ await Ve({ variables: {
114
115
  templateId: e,
115
116
  ownerType: r,
116
117
  ownerId: f
@@ -118,14 +119,19 @@ var _ = {
118
119
  } finally {
119
120
  L(null);
120
121
  }
121
- }, Ke = async (e) => {
122
+ }, qe = async (e) => {
122
123
  e.preventDefault(), I(null);
123
124
  let t = N.name.trim();
124
125
  if (!t) {
125
126
  I(x("scorecard.metricNameRequired", "Metric name is required"));
126
127
  return;
127
128
  }
128
- let n = N.statusMode === "AUTO" ? void 0 : N.statusMode;
129
+ let n = N.iframeUrl.trim();
130
+ if (n && !l(n)) {
131
+ I(x("scorecard.invalidIframeUrl", "Embed URL must be a valid external HTTPS URL and cannot target a Burdenoff or VibeControls host"));
132
+ return;
133
+ }
134
+ let r = N.statusMode === "AUTO" ? void 0 : N.statusMode;
129
135
  try {
130
136
  let e = {
131
137
  name: t,
@@ -136,18 +142,18 @@ var _ = {
136
142
  unit: N.unit.trim() || null,
137
143
  direction: N.direction,
138
144
  weight: Y(N.weight, x("scorecard.weight", "Weight")) ?? 1,
139
- status: n ?? null,
145
+ status: r ?? null,
140
146
  remediation: N.remediation.trim() || null,
141
147
  iframeUrl: N.iframeUrl.trim() || null,
142
148
  iframeHeight: Y(N.iframeHeight, x("scorecard.iframeHeight", "Iframe height")) ?? null
143
149
  };
144
- if (D) await Le({ variables: {
150
+ if (D) await Re({ variables: {
145
151
  id: D,
146
152
  input: e
147
153
  } });
148
154
  else {
149
- let t = await We();
150
- await Fe({ variables: {
155
+ let t = await Ge();
156
+ await Ie({ variables: {
151
157
  scorecardId: t,
152
158
  input: e
153
159
  } });
@@ -156,7 +162,7 @@ var _ = {
156
162
  } catch (e) {
157
163
  I(e instanceof Error ? e.message : D ? "Failed to update metric" : "Failed to add metric");
158
164
  }
159
- }, qe = N.statusMode === "AUTO" ? oe(N.value.trim() ? Number(N.value) : null, N.threshold.trim() ? Number(N.threshold) : null, N.direction) : N.statusMode, X = () => /* @__PURE__ */ h(p, { children: k && /* @__PURE__ */ h(m.div, {
165
+ }, Je = N.statusMode === "AUTO" ? se(N.value.trim() ? Number(N.value) : null, N.threshold.trim() ? Number(N.threshold) : null, N.direction) : N.statusMode, X = () => /* @__PURE__ */ h(p, { children: k && /* @__PURE__ */ h(m.div, {
160
166
  initial: { opacity: 0 },
161
167
  animate: { opacity: 1 },
162
168
  exit: { opacity: 0 },
@@ -212,7 +218,7 @@ var _ = {
212
218
  children: x("common.cancel", "Cancel")
213
219
  }), /* @__PURE__ */ h("button", {
214
220
  type: "button",
215
- onClick: Ue,
221
+ onClick: We,
216
222
  disabled: B,
217
223
  className: "rounded-md bg-status-error-bg px-4 py-2 text-sm text-status-error-text hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
218
224
  children: B ? x("scorecard.removingMetric", "Removing...") : x("scorecard.removeMetric", "Remove metric")
@@ -221,8 +227,8 @@ var _ = {
221
227
  ]
222
228
  })
223
229
  }) }), Z = () => {
224
- let e = l[qe] ?? l.UNKNOWN;
225
- return /* @__PURE__ */ h(p, { children: ke && /* @__PURE__ */ h(m.div, {
230
+ let e = c[Je] ?? c.UNKNOWN;
231
+ return /* @__PURE__ */ h(p, { children: Ae && /* @__PURE__ */ h(m.div, {
226
232
  initial: { opacity: 0 },
227
233
  animate: { opacity: 1 },
228
234
  exit: { opacity: 0 },
@@ -244,7 +250,7 @@ var _ = {
244
250
  className: "w-full max-w-2xl rounded-xl border border-border-default bg-bg-surface shadow-xl",
245
251
  onClick: (e) => e.stopPropagation(),
246
252
  children: /* @__PURE__ */ g("form", {
247
- onSubmit: Ke,
253
+ onSubmit: qe,
248
254
  className: "flex max-h-[85vh] flex-col",
249
255
  children: [
250
256
  /* @__PURE__ */ g("div", {
@@ -301,7 +307,7 @@ var _ = {
301
307
  value: N.type,
302
308
  onChange: (e) => J("type", e.target.value),
303
309
  className: v,
304
- children: ie.map((e) => /* @__PURE__ */ h("option", {
310
+ children: ae.map((e) => /* @__PURE__ */ h("option", {
305
311
  value: e.value,
306
312
  children: e.label
307
313
  }, e.value))
@@ -315,7 +321,7 @@ var _ = {
315
321
  value: N.direction,
316
322
  onChange: (e) => J("direction", e.target.value),
317
323
  className: v,
318
- children: re.map((e) => /* @__PURE__ */ h("option", {
324
+ children: ie.map((e) => /* @__PURE__ */ h("option", {
319
325
  value: e.value,
320
326
  children: e.label
321
327
  }, e.value))
@@ -393,7 +399,7 @@ var _ = {
393
399
  value: N.statusMode,
394
400
  onChange: (e) => J("statusMode", e.target.value),
395
401
  className: v,
396
- children: ae.map((e) => /* @__PURE__ */ h("option", {
402
+ children: oe.map((e) => /* @__PURE__ */ h("option", {
397
403
  value: e.value,
398
404
  children: e.label
399
405
  }, e.value))
@@ -470,19 +476,19 @@ var _ = {
470
476
  })
471
477
  }) });
472
478
  };
473
- if (Me && !V) return /* @__PURE__ */ h(e, { message: x("scorecard.loading", "Loading scorecard...") });
479
+ if (Ne && !V) return /* @__PURE__ */ h(e, { message: x("scorecard.loading", "Loading scorecard...") });
474
480
  if (R && !V) return /* @__PURE__ */ h(t, {
475
481
  title: x("scorecard.failedLoad", "Failed to load scorecard"),
476
482
  message: R.message,
477
483
  onRetry: () => z()
478
484
  });
479
- if (!V || V.metrics.length === 0) return /* @__PURE__ */ g(be, { children: [
480
- /* @__PURE__ */ h(se, {
485
+ if (!V || V.metrics.length === 0) return /* @__PURE__ */ g(xe, { children: [
486
+ /* @__PURE__ */ h(ce, {
481
487
  ownerType: r,
482
488
  ownerId: f,
483
- workspaceId: we,
484
- applyingTemplateId: Ae,
485
- onApplyTemplate: Ge,
489
+ workspaceId: Te,
490
+ applyingTemplateId: je,
491
+ onApplyTemplate: Ke,
486
492
  onAddManual: G
487
493
  }),
488
494
  Z(),
@@ -500,7 +506,7 @@ var _ = {
500
506
  className: "flex items-center gap-1.5 text-sm font-medium text-text-secondary",
501
507
  children: [x("scorecard.overallScore", "Overall Score"), /* @__PURE__ */ h("span", {
502
508
  title: "Weighted average of each metric's score (0–100). Status is derived from value vs threshold.",
503
- children: /* @__PURE__ */ h(fe, { className: "size-3.5 text-text-muted" })
509
+ children: /* @__PURE__ */ h(pe, { className: "size-3.5 text-text-muted" })
504
510
  })]
505
511
  }), /* @__PURE__ */ g("p", {
506
512
  className: `text-4xl font-bold ${$}`,
@@ -511,8 +517,8 @@ var _ = {
511
517
  })] }), /* @__PURE__ */ g("div", {
512
518
  className: "flex items-center gap-2",
513
519
  children: [
514
- V.securityTier && /* @__PURE__ */ h(Ce, { tier: V.securityTier }),
515
- /* @__PURE__ */ h(_e, { className: `size-6 ${$}` }),
520
+ V.securityTier && /* @__PURE__ */ h(we, { tier: V.securityTier }),
521
+ /* @__PURE__ */ h(ve, { className: `size-6 ${$}` }),
516
522
  /* @__PURE__ */ h(a, {
517
523
  entity: "scorecard",
518
524
  resource: {
@@ -530,24 +536,24 @@ var _ = {
530
536
  onClick: () => z(),
531
537
  className: "rounded-md p-2 text-text-secondary transition-colors hover:bg-bg-sunken",
532
538
  title: x("common.refresh", "Refresh"),
533
- children: /* @__PURE__ */ h(he, { className: "size-4" })
539
+ children: /* @__PURE__ */ h(ge, { className: "size-4" })
534
540
  }),
535
- Te && /* @__PURE__ */ g("button", {
541
+ Ee && /* @__PURE__ */ g("button", {
536
542
  type: "button",
537
543
  onClick: G,
538
544
  className: "flex items-center gap-2 rounded-md bg-action-primary-bg px-3 py-2 text-sm text-action-primary-text transition-colors hover:bg-action-primary-bg-hover",
539
- children: [/* @__PURE__ */ h(me, { className: "size-4" }), x("scorecard.addMetric", "Add Metric")]
545
+ children: [/* @__PURE__ */ h(he, { className: "size-4" }), x("scorecard.addMetric", "Add Metric")]
540
546
  })
541
547
  ]
542
548
  })]
543
549
  })
544
550
  }),
545
- /* @__PURE__ */ h(Se, {
551
+ /* @__PURE__ */ h(Ce, {
546
552
  stagger: .04,
547
553
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
548
554
  children: V.metrics.map((e) => {
549
- let t = l[e.status] || l.UNKNOWN, r = t.icon, i = e.value ?? 0, a = e.threshold ?? 100, o = a > 0 ? Math.min(100, Math.max(0, i / a * 100)) : 0, s = Oe === e.id, c = e.remediation && (e.status === "WARNING" || e.status === "FAILING");
550
- return /* @__PURE__ */ h(xe, { children: /* @__PURE__ */ g(n, {
555
+ let t = c[e.status] || c.UNKNOWN, r = t.icon, i = e.value ?? 0, a = e.threshold ?? 100, o = a > 0 ? Math.min(100, Math.max(0, i / a * 100)) : 0, s = ke === e.id, ee = e.remediation && (e.status === "WARNING" || e.status === "FAILING");
556
+ return /* @__PURE__ */ h(Se, { children: /* @__PURE__ */ g(n, {
551
557
  hoverable: !0,
552
558
  padding: "none",
553
559
  children: [/* @__PURE__ */ g("div", {
@@ -579,21 +585,21 @@ var _ = {
579
585
  }), /* @__PURE__ */ g("div", {
580
586
  className: "flex flex-shrink-0 items-center gap-1",
581
587
  children: [
582
- Ee && /* @__PURE__ */ h("button", {
588
+ De && /* @__PURE__ */ h("button", {
583
589
  type: "button",
584
- onClick: (t) => Ve(t, e),
590
+ onClick: (t) => He(t, e),
585
591
  className: "rounded-md p-1 text-text-secondary hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
586
592
  "aria-label": x("scorecard.editMetric", "Edit metric"),
587
593
  title: x("scorecard.editMetric", "Edit metric"),
588
- children: /* @__PURE__ */ h(pe, { className: "size-4" })
594
+ children: /* @__PURE__ */ h(me, { className: "size-4" })
589
595
  }),
590
- De && /* @__PURE__ */ h("button", {
596
+ Oe && /* @__PURE__ */ h("button", {
591
597
  type: "button",
592
- onClick: (t) => He(t, e),
598
+ onClick: (t) => Ue(t, e),
593
599
  className: "rounded-md p-1 text-text-secondary hover:bg-status-error-bg hover:text-status-error-text focus:outline-none focus:ring-2 focus:ring-status-error-text",
594
600
  "aria-label": x("scorecard.removeMetric", "Remove metric"),
595
601
  title: x("scorecard.removeMetric", "Remove metric"),
596
- children: /* @__PURE__ */ h(ge, { className: "size-4" })
602
+ children: /* @__PURE__ */ h(_e, { className: "size-4" })
597
603
  }),
598
604
  /* @__PURE__ */ h("div", {
599
605
  className: `flex size-7 items-center justify-center rounded-full ${t.bg}`,
@@ -630,7 +636,7 @@ var _ = {
630
636
  })
631
637
  })]
632
638
  }),
633
- c && /* @__PURE__ */ h("p", {
639
+ ee && /* @__PURE__ */ h("p", {
634
640
  className: "mt-2 rounded-md border border-status-warning-border bg-status-warning-bg-subtle px-2 py-1.5 text-xs text-status-warning-text",
635
641
  children: e.remediation
636
642
  })
@@ -652,22 +658,26 @@ var _ = {
652
658
  className: "overflow-hidden border-t border-border-default",
653
659
  children: [/* @__PURE__ */ h("div", {
654
660
  className: "px-4 py-3",
655
- children: /* @__PURE__ */ h(le, {
661
+ children: /* @__PURE__ */ h(ue, {
656
662
  metricId: e.id,
657
663
  colorClass: t.text
658
664
  })
659
- }), e.iframeUrl && /* @__PURE__ */ h("iframe", {
660
- src: e.iframeUrl,
661
- className: "w-full border-0",
662
- style: { height: e.iframeHeight ? `${e.iframeHeight}px` : "200px" },
663
- title: `${e.name} embed`,
664
- sandbox: "allow-scripts allow-same-origin"
665
- })]
665
+ }), (() => {
666
+ let t = l(e.iframeUrl);
667
+ return t ? /* @__PURE__ */ h("iframe", {
668
+ src: t,
669
+ className: "w-full border-0",
670
+ style: { height: e.iframeHeight ? `${e.iframeHeight}px` : "200px" },
671
+ title: `${e.name} embed`,
672
+ sandbox: "allow-scripts",
673
+ referrerPolicy: "no-referrer"
674
+ }) : null;
675
+ })()]
666
676
  }) })]
667
677
  }) }, e.id);
668
678
  })
669
679
  }),
670
- /* @__PURE__ */ h(ce, {
680
+ /* @__PURE__ */ h(le, {
671
681
  ownerType: r,
672
682
  highlightOwnerId: f
673
683
  }),
@@ -688,7 +698,7 @@ var _ = {
688
698
  label: "Gold",
689
699
  cls: "bg-status-success-bg-subtle text-status-success-text border border-status-success-border"
690
700
  }
691
- }, Ce = ({ tier: e }) => {
701
+ }, we = ({ tier: e }) => {
692
702
  let t = b[e];
693
703
  return /* @__PURE__ */ g("span", {
694
704
  className: `inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-semibold ${t.cls}`,
@@ -1,25 +1,45 @@
1
1
  import { useTerminalCapabilityUrl as e } from "../../hooks/useTerminalCapabilityUrl.js";
2
- import { forwardRef as t, useEffect as n } from "react";
3
- import { Fragment as r, jsx as i } from "react/jsx-runtime";
2
+ import { getSafeTunnelIframeUrl as t } from "../../utils/iframeUrl.js";
3
+ import { forwardRef as n, useCallback as r, useEffect as i, useMemo as a, useRef as o } from "react";
4
+ import { Fragment as s, jsx as c } from "react/jsx-runtime";
4
5
  // src/components/sessions/TerminalIframe.tsx
5
- var a = t(function({ sessionId: t, agentId: a, profile: o, baseTtydUrl: s, title: c, className: l, allow: u, onLoad: d, onError: f, fallback: p }, m) {
6
- let { url: h, remint: g } = e(a, t, s, o || "default");
7
- return n(() => {
6
+ var l = n(function({ sessionId: n, agentId: l, profile: u, baseTtydUrl: d, title: f, className: p, allow: m, onLoad: h, onError: g, fallback: _ }, v) {
7
+ let { url: y, remint: b } = e(l, n, d, u || "default"), x = a(() => t(y), [y]), S = a(() => {
8
+ if (!x) return null;
9
+ try {
10
+ return new URL(x).origin;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }, [x]), C = o(null), w = r((e) => {
15
+ C.current = e, typeof v == "function" ? v(e) : v && (v.current = e);
16
+ }, [v]);
17
+ return i(() => {
18
+ if (!S) return;
8
19
  function e(e) {
9
- let n = e?.data;
10
- n && typeof n == "object" && n.type === "vt-token-request" && typeof n.sid == "string" && n.sid === t && g();
20
+ if (e.origin !== S) return;
21
+ let t = C.current?.contentWindow;
22
+ if (!t || e.source !== t) return;
23
+ let r = e?.data;
24
+ r && typeof r == "object" && r.type === "vt-token-request" && typeof r.sid == "string" && r.sid === n && b();
11
25
  }
12
26
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
13
- }, [t, g]), h ? /* @__PURE__ */ i("iframe", {
14
- ref: m,
15
- src: h,
16
- title: c,
17
- className: l,
18
- allow: u,
19
- onLoad: d,
27
+ }, [
28
+ S,
29
+ n,
30
+ b
31
+ ]), x ? /* @__PURE__ */ c("iframe", {
32
+ ref: w,
33
+ src: x,
34
+ title: f,
35
+ className: p,
36
+ allow: m,
37
+ sandbox: "allow-scripts allow-same-origin allow-forms",
38
+ referrerPolicy: "no-referrer",
39
+ onLoad: h,
20
40
  onError: () => {
21
- g(), f?.();
41
+ b(), g?.();
22
42
  }
23
- }) : /* @__PURE__ */ i(r, { children: p ?? null });
43
+ }) : /* @__PURE__ */ c(s, { children: _ ?? null });
24
44
  });
25
- export { a as TerminalIframe };
45
+ export { l as TerminalIframe };
@@ -504,7 +504,7 @@ function _({ tabs: _, activeTabId: Se, onTabSelect: Ce, onTabClose: v, onOpenExt
504
504
  baseTtydUrl: e.terminalUrl,
505
505
  title: `Terminal - ${e.name}`,
506
506
  className: "w-full h-full border-0",
507
- allow: "clipboard-read *; clipboard-write *",
507
+ allow: "clipboard-read; clipboard-write",
508
508
  onLoad: () => gt(e.sessionId),
509
509
  onError: () => _t(e.sessionId)
510
510
  }, `tif-${e.sessionId}-${it[e.sessionId] ?? 0}`),
@@ -1047,7 +1047,7 @@ function _({ tabs: _, activeTabId: Se, onTabSelect: Ce, onTabClose: v, onOpenExt
1047
1047
  baseTtydUrl: e.terminalUrl,
1048
1048
  title: `Terminal - ${e.name}`,
1049
1049
  className: "w-full h-full border-0",
1050
- allow: "clipboard-read *; clipboard-write *",
1050
+ allow: "clipboard-read; clipboard-write",
1051
1051
  onLoad: () => gt(e.sessionId),
1052
1052
  onError: () => _t(e.sessionId)
1053
1053
  }, `tif-${e.sessionId}-${it[e.sessionId] ?? 0}`),