@adoptai/genui-components 0.1.55 → 0.1.57

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 (38) hide show
  1. package/dist/builders/BuilderForm.d.ts.map +1 -1
  2. package/dist/composites/decision-card/resolver.cjs +634 -0
  3. package/dist/composites/decision-card/resolver.cjs.map +1 -0
  4. package/dist/composites/decision-card/resolver.d.ts +13 -0
  5. package/dist/composites/decision-card/resolver.d.ts.map +1 -0
  6. package/dist/composites/decision-card/resolver.js +627 -0
  7. package/dist/composites/decision-card/resolver.js.map +1 -0
  8. package/dist/composites/workflow-stepper/resolver.cjs +4 -1
  9. package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
  10. package/dist/composites/workflow-stepper/resolver.js +4 -1
  11. package/dist/composites/workflow-stepper/resolver.js.map +1 -1
  12. package/dist/index.cjs +522 -12
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +521 -13
  17. package/dist/index.js.map +1 -1
  18. package/dist/renderer.cjs +504 -8
  19. package/dist/renderer.cjs.map +1 -1
  20. package/dist/renderer.js +504 -8
  21. package/dist/renderer.js.map +1 -1
  22. package/dist/resolver.cjs +504 -8
  23. package/dist/resolver.cjs.map +1 -1
  24. package/dist/resolver.d.ts.map +1 -1
  25. package/dist/resolver.js +504 -8
  26. package/dist/resolver.js.map +1 -1
  27. package/dist/schemas/decision-card.d.ts +149 -0
  28. package/dist/schemas/decision-card.d.ts.map +1 -0
  29. package/dist/schemas/index.cjs +105 -1
  30. package/dist/schemas/index.cjs.map +1 -1
  31. package/dist/schemas/index.d.ts +149 -0
  32. package/dist/schemas/index.d.ts.map +1 -1
  33. package/dist/schemas/index.js +105 -1
  34. package/dist/schemas/index.js.map +1 -1
  35. package/dist/shared/InteractionContext.d.ts +10 -0
  36. package/dist/shared/InteractionContext.d.ts.map +1 -1
  37. package/dist/tool-definitions.json +135 -3
  38. package/package.json +1 -1
package/dist/resolver.cjs CHANGED
@@ -5305,6 +5305,109 @@ var workflowStepperTool = {
5305
5305
  required: ["type", "title", "steps"]
5306
5306
  }
5307
5307
  };
5308
+ var decisionCardSchema = zod.z.object({
5309
+ type: zod.z.literal("decision-card"),
5310
+ id: zod.z.string().optional(),
5311
+ decision_type: zod.z.string().optional(),
5312
+ title: zod.z.string(),
5313
+ question: zod.z.string(),
5314
+ amount: zod.z.number().optional(),
5315
+ currency: zod.z.string().optional(),
5316
+ amount_label: zod.z.string().optional(),
5317
+ severity: zod.z.enum(["low", "medium", "high"]).optional(),
5318
+ flags: zod.z.array(
5319
+ zod.z.object({
5320
+ field: zod.z.string().optional(),
5321
+ issue: zod.z.string(),
5322
+ severity: zod.z.enum(["low", "medium", "high"]).optional()
5323
+ })
5324
+ ).max(6).optional(),
5325
+ options: zod.z.array(
5326
+ zod.z.object({
5327
+ id: zod.z.string().optional(),
5328
+ label: zod.z.string(),
5329
+ recommended: zod.z.boolean().optional()
5330
+ })
5331
+ ).min(1).max(5),
5332
+ source: zod.z.object({
5333
+ label: zod.z.string().optional(),
5334
+ url: zod.z.string().optional()
5335
+ }).optional(),
5336
+ resolved: zod.z.object({
5337
+ option: zod.z.string()
5338
+ }).optional()
5339
+ });
5340
+ var decisionCardTool = {
5341
+ name: "render_decision_card",
5342
+ description: "Render an inline human-in-the-loop (HITL) decision card \u2014 a single judgment the agent needs from the user, resolved in-thread. Shows a titled question with an optional dollar amount at stake, optional data-quality flags, and 2-5 mutually-exclusive resolution options (the first or `recommended` one renders as the primary action), plus an optional 'view source' link. Use for inline approve/choose decisions the user resolves directly in the conversation. NOT for handing off to an external review portal (use escalation-card) and NOT for collecting multiple typed fields (use render_builder).",
5343
+ input_schema: {
5344
+ type: "object",
5345
+ properties: {
5346
+ type: { type: "string", enum: ["decision-card"] },
5347
+ id: { type: "string", description: "Stable id for update-in-place rendering" },
5348
+ decision_type: {
5349
+ type: "string",
5350
+ description: "Short category shown in the eyebrow, e.g. 'Cross-check', 'Allocation', 'Reserve'"
5351
+ },
5352
+ title: { type: "string", description: "The decision headline, e.g. 'AR reserve adequacy'" },
5353
+ question: { type: "string", description: "The full question / context the user must judge" },
5354
+ amount: { type: "number", description: "Dollar value at stake, e.g. 27100" },
5355
+ currency: { type: "string", description: "ISO currency code; defaults to USD" },
5356
+ amount_label: { type: "string", description: "Caption above the amount, e.g. 'At stake'" },
5357
+ severity: {
5358
+ type: "string",
5359
+ enum: ["low", "medium", "high"],
5360
+ description: "Severity of the decision; tints the accent rail"
5361
+ },
5362
+ flags: {
5363
+ type: "array",
5364
+ maxItems: 6,
5365
+ description: "Optional data-quality flags surfaced on the card",
5366
+ items: {
5367
+ type: "object",
5368
+ properties: {
5369
+ field: { type: "string" },
5370
+ issue: { type: "string" },
5371
+ severity: { type: "string", enum: ["low", "medium", "high"] }
5372
+ },
5373
+ required: ["issue"]
5374
+ }
5375
+ },
5376
+ options: {
5377
+ type: "array",
5378
+ minItems: 1,
5379
+ maxItems: 5,
5380
+ description: "Mutually-exclusive resolution choices; mark one `recommended` to make it primary",
5381
+ items: {
5382
+ type: "object",
5383
+ properties: {
5384
+ id: { type: "string" },
5385
+ label: { type: "string" },
5386
+ recommended: { type: "boolean" }
5387
+ },
5388
+ required: ["label"]
5389
+ }
5390
+ },
5391
+ source: {
5392
+ type: "object",
5393
+ description: "Optional provenance link for the figure",
5394
+ properties: {
5395
+ label: { type: "string" },
5396
+ url: { type: "string" }
5397
+ }
5398
+ },
5399
+ resolved: {
5400
+ type: "object",
5401
+ description: "Pre-resolved state for transcript replay",
5402
+ properties: {
5403
+ option: { type: "string" }
5404
+ },
5405
+ required: ["option"]
5406
+ }
5407
+ },
5408
+ required: ["type", "title", "question", "options"]
5409
+ }
5410
+ };
5308
5411
 
5309
5412
  // src/schemas/index.ts
5310
5413
  var schemaRegistry = {
@@ -5364,7 +5467,8 @@ var schemaRegistry = {
5364
5467
  "connect-integration": { schema: connectIntegrationSchema, tool: connectIntegrationTool },
5365
5468
  "integrations-list": { schema: integrationsListSchema, tool: integrationsListTool },
5366
5469
  "pipeline-preview": { schema: pipelinePreviewSchema, tool: pipelinePreviewTool },
5367
- "workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool }
5470
+ "workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
5471
+ "decision-card": { schema: decisionCardSchema, tool: decisionCardTool }
5368
5472
  };
5369
5473
 
5370
5474
  // src/schemas/coercePayload.ts
@@ -6102,17 +6206,17 @@ function SparklineTableResolver(p) {
6102
6206
  // src/composites/heatmap-table/resolver.tsx
6103
6207
  init_theme();
6104
6208
  init_ThemeContext();
6105
- function heatColor(z58) {
6106
- const clamped = Math.max(-3, Math.min(3, z58));
6209
+ function heatColor(z59) {
6210
+ const clamped = Math.max(-3, Math.min(3, z59));
6107
6211
  const abs = Math.abs(clamped);
6108
6212
  const lightness = 95 - abs * 8;
6109
6213
  const hue = clamped >= 0 ? 142 : 0;
6110
6214
  return `hsl(${hue} 60% ${lightness}%)`;
6111
6215
  }
6112
- function heatTextColor(z58) {
6113
- const abs = Math.abs(z58);
6114
- if (abs > 2) return z58 >= 0 ? "#14532d" : "#7f1d1d";
6115
- if (abs > 1) return z58 >= 0 ? "#166534" : "#991b1b";
6216
+ function heatTextColor(z59) {
6217
+ const abs = Math.abs(z59);
6218
+ if (abs > 2) return z59 >= 0 ? "#14532d" : "#7f1d1d";
6219
+ if (abs > 1) return z59 >= 0 ? "#166534" : "#991b1b";
6116
6220
  return "var(--foreground)";
6117
6221
  }
6118
6222
  var th2 = {
@@ -17157,7 +17261,10 @@ function PipelinePreviewResolver(p) {
17157
17261
  init_ThemeContext();
17158
17262
  var DEFAULT_INTERACTION = {
17159
17263
  selectedStepId: null,
17160
- onStepSelect: void 0
17264
+ onStepSelect: void 0,
17265
+ resolvedDecisions: void 0,
17266
+ onDecisionResolve: void 0,
17267
+ onDecisionSource: void 0
17161
17268
  };
17162
17269
  var GenUIInteractionContext = React41.createContext(DEFAULT_INTERACTION);
17163
17270
  function useGenUIInteraction() {
@@ -17876,6 +17983,393 @@ function WorkflowStepperResolver(p) {
17876
17983
  )
17877
17984
  ] }) });
17878
17985
  }
17986
+ init_ThemeContext();
17987
+ var SEVERITY_COLORS = {
17988
+ high: { color: "#dc2626", bg: "#fef2f2" },
17989
+ medium: { color: "#f59e0b", bg: "#fff7ed" },
17990
+ low: { color: "#777777", bg: "#f2f2f2" }
17991
+ };
17992
+ var GREEN3 = "#15803d";
17993
+ var GREEN_SOFT = "#dcfce7";
17994
+ var STACK_BELOW = 380;
17995
+ function formatAmount2(amount, currency = "USD") {
17996
+ var _a, _b;
17997
+ const abs = Math.abs(amount);
17998
+ const sign = amount < 0 ? "-" : "";
17999
+ let body;
18000
+ if (abs >= 1e6) body = `${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
18001
+ else if (abs >= 1e3) body = `${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
18002
+ else body = `${abs}`;
18003
+ let symbol = "$";
18004
+ try {
18005
+ const parts = new Intl.NumberFormat("en-US", {
18006
+ style: "currency",
18007
+ currency,
18008
+ maximumFractionDigits: 0
18009
+ }).formatToParts(0);
18010
+ symbol = (_b = (_a = parts.find((p) => p.type === "currency")) == null ? void 0 : _a.value) != null ? _b : "$";
18011
+ } catch (e) {
18012
+ symbol = "$";
18013
+ }
18014
+ return `${sign}${symbol}${body}`;
18015
+ }
18016
+ function useContainerWidth2(ref) {
18017
+ const [w, setW] = React41__default.default.useState(0);
18018
+ React41__default.default.useLayoutEffect(() => {
18019
+ const el = ref.current;
18020
+ if (!el || typeof ResizeObserver === "undefined") return;
18021
+ const ro = new ResizeObserver((entries) => {
18022
+ var _a;
18023
+ const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
18024
+ if (cr) setW(cr.width);
18025
+ });
18026
+ ro.observe(el);
18027
+ setW(el.getBoundingClientRect().width);
18028
+ return () => ro.disconnect();
18029
+ }, [ref]);
18030
+ return w;
18031
+ }
18032
+ var KEYFRAMES2 = `
18033
+ @keyframes dcRise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
18034
+ .dc-rise{animation:dcRise 0.28s cubic-bezier(0.22,1,0.36,1) both}
18035
+ @media (prefers-reduced-motion: reduce){
18036
+ .dc-rise{animation:none !important;opacity:1 !important;transform:none !important}
18037
+ }`;
18038
+ function SparkCheck({ size, color }) {
18039
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
18040
+ "path",
18041
+ {
18042
+ d: "M5 13l4 4L19 7",
18043
+ stroke: color,
18044
+ strokeWidth: 2.5,
18045
+ strokeLinecap: "round",
18046
+ strokeLinejoin: "round"
18047
+ }
18048
+ ) });
18049
+ }
18050
+ function FlagPill({ flag }) {
18051
+ var _a;
18052
+ const sev = (_a = flag.severity) != null ? _a : "medium";
18053
+ const { color, bg } = SEVERITY_COLORS[sev];
18054
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18055
+ "span",
18056
+ {
18057
+ style: {
18058
+ display: "inline-flex",
18059
+ alignItems: "center",
18060
+ gap: 5,
18061
+ fontSize: 11,
18062
+ fontWeight: 600,
18063
+ padding: "3px 9px",
18064
+ borderRadius: 9999,
18065
+ background: bg,
18066
+ color,
18067
+ lineHeight: 1.2
18068
+ },
18069
+ children: [
18070
+ /* @__PURE__ */ jsxRuntime.jsx(
18071
+ "span",
18072
+ {
18073
+ "aria-hidden": "true",
18074
+ style: { width: 6, height: 6, borderRadius: "50%", background: color, flexShrink: 0 }
18075
+ }
18076
+ ),
18077
+ flag.field ? `${flag.field}: ${flag.issue}` : flag.issue
18078
+ ]
18079
+ }
18080
+ );
18081
+ }
18082
+ function DecisionCardRenderer({
18083
+ data,
18084
+ resolved = null,
18085
+ onResolve,
18086
+ onOpenSource
18087
+ }) {
18088
+ var _a, _b;
18089
+ const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
18090
+ const rootRef = React41__default.default.useRef(null);
18091
+ const width = useContainerWidth2(rootRef);
18092
+ const stacked = width > 0 && width < STACK_BELOW;
18093
+ const options = (_a = data.options) != null ? _a : [];
18094
+ const recommendedIdx = Math.max(
18095
+ 0,
18096
+ options.findIndex((o) => o.recommended)
18097
+ );
18098
+ const railColor = data.severity ? SEVERITY_COLORS[data.severity].color : ACCENT2;
18099
+ const isResolved = Boolean(resolved);
18100
+ const amountNode = typeof data.amount === "number" ? /* @__PURE__ */ jsxRuntime.jsxs(
18101
+ "div",
18102
+ {
18103
+ style: {
18104
+ display: "flex",
18105
+ flexDirection: "column",
18106
+ alignItems: stacked ? "flex-start" : "flex-end",
18107
+ gap: 1,
18108
+ flexShrink: 0
18109
+ },
18110
+ children: [
18111
+ data.amount_label && /* @__PURE__ */ jsxRuntime.jsx(
18112
+ "span",
18113
+ {
18114
+ style: {
18115
+ fontSize: 10,
18116
+ textTransform: "uppercase",
18117
+ letterSpacing: "0.07em",
18118
+ fontWeight: 700,
18119
+ color: MUTED2
18120
+ },
18121
+ children: data.amount_label
18122
+ }
18123
+ ),
18124
+ /* @__PURE__ */ jsxRuntime.jsx(
18125
+ "span",
18126
+ {
18127
+ style: {
18128
+ fontSize: 18,
18129
+ fontWeight: 700,
18130
+ color: "var(--foreground)",
18131
+ fontVariantNumeric: "tabular-nums",
18132
+ letterSpacing: "-0.01em",
18133
+ lineHeight: 1.1
18134
+ },
18135
+ children: formatAmount2(data.amount, data.currency)
18136
+ }
18137
+ )
18138
+ ]
18139
+ }
18140
+ ) : null;
18141
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18142
+ "div",
18143
+ {
18144
+ ref: rootRef,
18145
+ className: "dc-rise",
18146
+ "data-testid": "decision-card",
18147
+ "data-resolved": isResolved || void 0,
18148
+ style: {
18149
+ position: "relative",
18150
+ width: "100%",
18151
+ minWidth: 0,
18152
+ boxSizing: "border-box",
18153
+ borderRadius: "0.75rem",
18154
+ border: `1px solid ${isResolved ? GREEN_SOFT : BORDER4}`,
18155
+ background: isResolved ? "#f6fef9" : "white",
18156
+ boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
18157
+ padding: "16px 18px 16px 20px",
18158
+ display: "flex",
18159
+ flexDirection: "column",
18160
+ gap: 12,
18161
+ overflow: "hidden"
18162
+ },
18163
+ children: [
18164
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES2 }),
18165
+ /* @__PURE__ */ jsxRuntime.jsx(
18166
+ "div",
18167
+ {
18168
+ "aria-hidden": "true",
18169
+ style: {
18170
+ position: "absolute",
18171
+ top: 0,
18172
+ left: 0,
18173
+ bottom: 0,
18174
+ width: 4,
18175
+ background: isResolved ? GREEN3 : railColor
18176
+ }
18177
+ }
18178
+ ),
18179
+ /* @__PURE__ */ jsxRuntime.jsxs(
18180
+ "div",
18181
+ {
18182
+ style: {
18183
+ display: "flex",
18184
+ flexDirection: stacked ? "column" : "row",
18185
+ alignItems: stacked ? "flex-start" : "flex-start",
18186
+ justifyContent: "space-between",
18187
+ gap: stacked ? 6 : 12
18188
+ },
18189
+ children: [
18190
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
18191
+ /* @__PURE__ */ jsxRuntime.jsx(
18192
+ "span",
18193
+ {
18194
+ style: {
18195
+ fontSize: 10.5,
18196
+ textTransform: "uppercase",
18197
+ letterSpacing: "0.07em",
18198
+ fontWeight: 700,
18199
+ color: ACCENT2
18200
+ },
18201
+ children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
18202
+ }
18203
+ ),
18204
+ /* @__PURE__ */ jsxRuntime.jsx(
18205
+ "p",
18206
+ {
18207
+ style: {
18208
+ fontFamily: "var(--font-serif)",
18209
+ fontSize: 17,
18210
+ fontWeight: 400,
18211
+ color: "var(--foreground)",
18212
+ letterSpacing: "-0.01em",
18213
+ margin: 0,
18214
+ lineHeight: 1.2
18215
+ },
18216
+ children: data.title
18217
+ }
18218
+ )
18219
+ ] }),
18220
+ amountNode
18221
+ ]
18222
+ }
18223
+ ),
18224
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: 13, lineHeight: 1.5, color: MUTED2, margin: 0 }, children: data.question }),
18225
+ data.flags && data.flags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: data.flags.map((flag, i) => {
18226
+ var _a2;
18227
+ return /* @__PURE__ */ jsxRuntime.jsx(FlagPill, { flag }, `${(_a2 = flag.field) != null ? _a2 : "flag"}-${i}`);
18228
+ }) }),
18229
+ isResolved ? /* @__PURE__ */ jsxRuntime.jsxs(
18230
+ "div",
18231
+ {
18232
+ style: {
18233
+ display: "inline-flex",
18234
+ alignItems: "center",
18235
+ gap: 7,
18236
+ fontSize: 13,
18237
+ fontWeight: 600,
18238
+ color: GREEN3
18239
+ },
18240
+ children: [
18241
+ /* @__PURE__ */ jsxRuntime.jsx(SparkCheck, { size: 16, color: GREEN3 }),
18242
+ "Resolved \xB7 ",
18243
+ resolved
18244
+ ]
18245
+ }
18246
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18247
+ /* @__PURE__ */ jsxRuntime.jsx(
18248
+ "div",
18249
+ {
18250
+ style: {
18251
+ display: "flex",
18252
+ flexDirection: stacked ? "column" : "row",
18253
+ flexWrap: stacked ? "nowrap" : "wrap",
18254
+ gap: 8
18255
+ },
18256
+ children: options.map((opt, idx) => {
18257
+ var _a2;
18258
+ const primary = idx === recommendedIdx;
18259
+ return /* @__PURE__ */ jsxRuntime.jsx(
18260
+ "button",
18261
+ {
18262
+ type: "button",
18263
+ onClick: () => onResolve == null ? void 0 : onResolve(opt.label),
18264
+ style: {
18265
+ width: stacked ? "100%" : "auto",
18266
+ textAlign: stacked ? "left" : "center",
18267
+ border: `1px solid ${primary ? ACCENT2 : BORDER4}`,
18268
+ background: primary ? ACCENT2 : "white",
18269
+ color: primary ? "white" : "var(--foreground)",
18270
+ borderRadius: 8,
18271
+ fontSize: 13,
18272
+ fontWeight: 600,
18273
+ padding: "9px 14px",
18274
+ cursor: "pointer",
18275
+ transition: "background 0.15s, border-color 0.15s, color 0.15s"
18276
+ },
18277
+ onMouseEnter: (e) => {
18278
+ if (primary) {
18279
+ e.currentTarget.style.background = ACCENT_SOFT2;
18280
+ } else {
18281
+ e.currentTarget.style.borderColor = ACCENT2;
18282
+ e.currentTarget.style.background = "#fafafa";
18283
+ }
18284
+ },
18285
+ onMouseLeave: (e) => {
18286
+ if (primary) {
18287
+ e.currentTarget.style.background = ACCENT2;
18288
+ } else {
18289
+ e.currentTarget.style.borderColor = BORDER4;
18290
+ e.currentTarget.style.background = "white";
18291
+ }
18292
+ },
18293
+ children: opt.label
18294
+ },
18295
+ (_a2 = opt.id) != null ? _a2 : opt.label
18296
+ );
18297
+ })
18298
+ }
18299
+ ),
18300
+ data.source && /* @__PURE__ */ jsxRuntime.jsxs(
18301
+ "button",
18302
+ {
18303
+ type: "button",
18304
+ onClick: onOpenSource,
18305
+ style: {
18306
+ alignSelf: "flex-start",
18307
+ display: "inline-flex",
18308
+ alignItems: "center",
18309
+ gap: 5,
18310
+ border: "none",
18311
+ background: "none",
18312
+ padding: 0,
18313
+ cursor: "pointer",
18314
+ fontSize: 12,
18315
+ fontWeight: 600,
18316
+ color: MUTED2,
18317
+ transition: "color 0.15s"
18318
+ },
18319
+ onMouseEnter: (e) => e.currentTarget.style.color = ACCENT2,
18320
+ onMouseLeave: (e) => e.currentTarget.style.color = MUTED2,
18321
+ children: [
18322
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 13, height: 13, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
18323
+ "path",
18324
+ {
18325
+ d: "M14 3v4a1 1 0 001 1h4M5 4a1 1 0 011-1h8l5 5v11a1 1 0 01-1 1H6a1 1 0 01-1-1V4z",
18326
+ stroke: "currentColor",
18327
+ strokeWidth: 1.8,
18328
+ strokeLinecap: "round",
18329
+ strokeLinejoin: "round"
18330
+ }
18331
+ ) }),
18332
+ (_b = data.source.label) != null ? _b : "View source for this figure"
18333
+ ]
18334
+ }
18335
+ )
18336
+ ] })
18337
+ ]
18338
+ }
18339
+ );
18340
+ }
18341
+ function DecisionCardResolver(p) {
18342
+ var _a, _b, _c, _d;
18343
+ const { resolvedDecisions, onDecisionResolve, onDecisionSource } = useGenUIInteraction();
18344
+ const decisionId = (_a = p.id) != null ? _a : p.title;
18345
+ const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
18346
+ const initial = (_c = hostResolved != null ? hostResolved : (_b = p.resolved) == null ? void 0 : _b.option) != null ? _c : null;
18347
+ const [localResolved, setLocalResolved] = React41__default.default.useState(initial);
18348
+ React41__default.default.useEffect(() => {
18349
+ if (hostResolved !== void 0) setLocalResolved(hostResolved);
18350
+ }, [hostResolved]);
18351
+ const resolved = hostResolved != null ? hostResolved : localResolved;
18352
+ const handleResolve = (option) => {
18353
+ setLocalResolved(option);
18354
+ onDecisionResolve == null ? void 0 : onDecisionResolve(decisionId, option);
18355
+ };
18356
+ const handleSource = () => {
18357
+ var _a2;
18358
+ onDecisionSource == null ? void 0 : onDecisionSource(decisionId, p.source);
18359
+ if (!onDecisionSource && ((_a2 = p.source) == null ? void 0 : _a2.url) && typeof window !== "undefined") {
18360
+ window.open(p.source.url, "_blank", "noopener,noreferrer");
18361
+ }
18362
+ };
18363
+ return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "decision-card", children: /* @__PURE__ */ jsxRuntime.jsx(
18364
+ DecisionCardRenderer,
18365
+ {
18366
+ data: p,
18367
+ resolved,
18368
+ onResolve: handleResolve,
18369
+ onOpenSource: handleSource
18370
+ }
18371
+ ) });
18372
+ }
17879
18373
  function resolveUI(rawPayload) {
17880
18374
  const payload = coercePayload(rawPayload);
17881
18375
  switch (payload.type) {
@@ -17993,6 +18487,8 @@ function resolveUI(rawPayload) {
17993
18487
  return /* @__PURE__ */ jsxRuntime.jsx(PipelinePreviewResolver, __spreadValues({}, payload));
17994
18488
  case "workflow-stepper":
17995
18489
  return /* @__PURE__ */ jsxRuntime.jsx(WorkflowStepperResolver, __spreadValues({}, payload));
18490
+ case "decision-card":
18491
+ return /* @__PURE__ */ jsxRuntime.jsx(DecisionCardResolver, __spreadValues({}, payload));
17996
18492
  default: {
17997
18493
  return /* @__PURE__ */ jsxRuntime.jsx(
17998
18494
  "div",