@cellarnode/ui 0.201.1 → 0.203.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/agent/composer.d.ts +6 -1
  2. package/dist/agent/composer.d.ts.map +1 -1
  3. package/dist/agent/composer.js +43 -9
  4. package/dist/agent/composer.js.map +1 -1
  5. package/dist/agent/conversation.d.ts +20 -2
  6. package/dist/agent/conversation.d.ts.map +1 -1
  7. package/dist/agent/conversation.js +39 -5
  8. package/dist/agent/conversation.js.map +1 -1
  9. package/dist/agent/copy.d.ts +7 -0
  10. package/dist/agent/copy.d.ts.map +1 -1
  11. package/dist/agent/copy.js +9 -0
  12. package/dist/agent/copy.js.map +1 -1
  13. package/dist/agent/fixtures.d.ts +34 -0
  14. package/dist/agent/fixtures.d.ts.map +1 -1
  15. package/dist/agent/fixtures.js +83 -0
  16. package/dist/agent/fixtures.js.map +1 -1
  17. package/dist/agent/index.d.ts +18 -1
  18. package/dist/agent/index.d.ts.map +1 -1
  19. package/dist/agent/index.js +18 -1
  20. package/dist/agent/index.js.map +1 -1
  21. package/dist/agent/markdown.d.ts +64 -0
  22. package/dist/agent/markdown.d.ts.map +1 -0
  23. package/dist/agent/markdown.js +338 -0
  24. package/dist/agent/markdown.js.map +1 -0
  25. package/dist/agent/masked-value.d.ts +1 -0
  26. package/dist/agent/masked-value.d.ts.map +1 -1
  27. package/dist/agent/masked-value.js +4 -1
  28. package/dist/agent/masked-value.js.map +1 -1
  29. package/dist/agent/message.d.ts +26 -6
  30. package/dist/agent/message.d.ts.map +1 -1
  31. package/dist/agent/message.js +47 -11
  32. package/dist/agent/message.js.map +1 -1
  33. package/dist/agent/panel-frame.js +1 -1
  34. package/dist/agent/panel-frame.js.map +1 -1
  35. package/dist/agent/role-cards/card-kit.d.ts +111 -0
  36. package/dist/agent/role-cards/card-kit.d.ts.map +1 -0
  37. package/dist/agent/role-cards/card-kit.js +68 -0
  38. package/dist/agent/role-cards/card-kit.js.map +1 -0
  39. package/dist/agent/role-cards/data-table-card.d.ts +80 -0
  40. package/dist/agent/role-cards/data-table-card.d.ts.map +1 -0
  41. package/dist/agent/role-cards/data-table-card.js +214 -0
  42. package/dist/agent/role-cards/data-table-card.js.map +1 -0
  43. package/dist/agent/role-cards/fixtures.d.ts +124 -0
  44. package/dist/agent/role-cards/fixtures.d.ts.map +1 -0
  45. package/dist/agent/role-cards/fixtures.js +401 -0
  46. package/dist/agent/role-cards/fixtures.js.map +1 -0
  47. package/dist/agent/role-cards/host-contract.d.ts +214 -0
  48. package/dist/agent/role-cards/host-contract.d.ts.map +1 -0
  49. package/dist/agent/role-cards/host-contract.js +348 -0
  50. package/dist/agent/role-cards/host-contract.js.map +1 -0
  51. package/dist/agent/role-cards/inspector-drawer.d.ts +42 -0
  52. package/dist/agent/role-cards/inspector-drawer.d.ts.map +1 -0
  53. package/dist/agent/role-cards/inspector-drawer.js +68 -0
  54. package/dist/agent/role-cards/inspector-drawer.js.map +1 -0
  55. package/dist/agent/role-cards/inspector-fixtures.d.ts +84 -0
  56. package/dist/agent/role-cards/inspector-fixtures.d.ts.map +1 -0
  57. package/dist/agent/role-cards/inspector-fixtures.js +162 -0
  58. package/dist/agent/role-cards/inspector-fixtures.js.map +1 -0
  59. package/dist/agent/role-cards/inspector-record.d.ts +109 -0
  60. package/dist/agent/role-cards/inspector-record.d.ts.map +1 -0
  61. package/dist/agent/role-cards/inspector-record.js +346 -0
  62. package/dist/agent/role-cards/inspector-record.js.map +1 -0
  63. package/dist/agent/role-cards/inspector-view.d.ts +137 -0
  64. package/dist/agent/role-cards/inspector-view.d.ts.map +1 -0
  65. package/dist/agent/role-cards/inspector-view.js +261 -0
  66. package/dist/agent/role-cards/inspector-view.js.map +1 -0
  67. package/dist/agent/role-cards/match-card.d.ts +21 -0
  68. package/dist/agent/role-cards/match-card.d.ts.map +1 -0
  69. package/dist/agent/role-cards/match-card.js +30 -0
  70. package/dist/agent/role-cards/match-card.js.map +1 -0
  71. package/dist/agent/role-cards/offer-card.d.ts +27 -0
  72. package/dist/agent/role-cards/offer-card.d.ts.map +1 -0
  73. package/dist/agent/role-cards/offer-card.js +68 -0
  74. package/dist/agent/role-cards/offer-card.js.map +1 -0
  75. package/dist/agent/role-cards/opportunity-card.d.ts +26 -0
  76. package/dist/agent/role-cards/opportunity-card.d.ts.map +1 -0
  77. package/dist/agent/role-cards/opportunity-card.js +50 -0
  78. package/dist/agent/role-cards/opportunity-card.js.map +1 -0
  79. package/dist/agent/role-cards/product-card.d.ts +32 -0
  80. package/dist/agent/role-cards/product-card.d.ts.map +1 -0
  81. package/dist/agent/role-cards/product-card.js +50 -0
  82. package/dist/agent/role-cards/product-card.js.map +1 -0
  83. package/dist/agent/role-cards/proposal-diff.d.ts +38 -0
  84. package/dist/agent/role-cards/proposal-diff.d.ts.map +1 -0
  85. package/dist/agent/role-cards/proposal-diff.js +74 -0
  86. package/dist/agent/role-cards/proposal-diff.js.map +1 -0
  87. package/dist/agent/role-cards/registry.d.ts +43 -0
  88. package/dist/agent/role-cards/registry.d.ts.map +1 -0
  89. package/dist/agent/role-cards/registry.js +46 -0
  90. package/dist/agent/role-cards/registry.js.map +1 -0
  91. package/dist/agent/role-cards/score-meter.d.ts +12 -0
  92. package/dist/agent/role-cards/score-meter.d.ts.map +1 -0
  93. package/dist/agent/role-cards/score-meter.js +17 -0
  94. package/dist/agent/role-cards/score-meter.js.map +1 -0
  95. package/dist/agent/role-cards/surface-links.d.ts +54 -0
  96. package/dist/agent/role-cards/surface-links.d.ts.map +1 -0
  97. package/dist/agent/role-cards/surface-links.js +149 -0
  98. package/dist/agent/role-cards/surface-links.js.map +1 -0
  99. package/dist/agent/role-cards/text-safety.d.ts +27 -0
  100. package/dist/agent/role-cards/text-safety.d.ts.map +1 -0
  101. package/dist/agent/role-cards/text-safety.js +77 -0
  102. package/dist/agent/role-cards/text-safety.js.map +1 -0
  103. package/dist/agent/schema.d.ts +10 -0
  104. package/dist/agent/schema.d.ts.map +1 -1
  105. package/dist/agent/schema.js +31 -3
  106. package/dist/agent/schema.js.map +1 -1
  107. package/dist/agent/states.d.ts +1 -0
  108. package/dist/agent/states.d.ts.map +1 -1
  109. package/dist/agent/states.js +1 -1
  110. package/dist/agent/states.js.map +1 -1
  111. package/dist/agent/thinking.d.ts +13 -4
  112. package/dist/agent/thinking.d.ts.map +1 -1
  113. package/dist/agent/thinking.js +15 -6
  114. package/dist/agent/thinking.js.map +1 -1
  115. package/dist/agent/thread-list.d.ts +45 -2
  116. package/dist/agent/thread-list.d.ts.map +1 -1
  117. package/dist/agent/thread-list.js +175 -8
  118. package/dist/agent/thread-list.js.map +1 -1
  119. package/dist/agent/thread-title.d.ts +46 -0
  120. package/dist/agent/thread-title.d.ts.map +1 -0
  121. package/dist/agent/thread-title.js +99 -0
  122. package/dist/agent/thread-title.js.map +1 -0
  123. package/dist/agent/tool-activity-model.d.ts +136 -0
  124. package/dist/agent/tool-activity-model.d.ts.map +1 -0
  125. package/dist/agent/tool-activity-model.js +288 -0
  126. package/dist/agent/tool-activity-model.js.map +1 -0
  127. package/dist/agent/tool-activity.d.ts +61 -0
  128. package/dist/agent/tool-activity.d.ts.map +1 -0
  129. package/dist/agent/tool-activity.js +199 -0
  130. package/dist/agent/tool-activity.js.map +1 -0
  131. package/dist/agent/tool-call-card.d.ts +11 -1
  132. package/dist/agent/tool-call-card.d.ts.map +1 -1
  133. package/dist/agent/tool-call-card.js +19 -4
  134. package/dist/agent/tool-call-card.js.map +1 -1
  135. package/dist/agent/ui.js +1 -1
  136. package/dist/agent/ui.js.map +1 -1
  137. package/dist/agent/use-motion.d.ts +15 -0
  138. package/dist/agent/use-motion.d.ts.map +1 -0
  139. package/dist/agent/use-motion.js +52 -0
  140. package/dist/agent/use-motion.js.map +1 -0
  141. package/dist/chat/use-stick-to-bottom.d.ts +5 -0
  142. package/dist/chat/use-stick-to-bottom.d.ts.map +1 -1
  143. package/dist/chat/use-stick-to-bottom.js +11 -1
  144. package/dist/chat/use-stick-to-bottom.js.map +1 -1
  145. package/dist/components/sheet.d.ts +3 -1
  146. package/dist/components/sheet.d.ts.map +1 -1
  147. package/dist/components/sheet.js +2 -2
  148. package/dist/components/sheet.js.map +1 -1
  149. package/dist/portfolio-import/import-job-panels.d.ts +6 -0
  150. package/dist/portfolio-import/import-job-panels.d.ts.map +1 -1
  151. package/dist/portfolio-import/import-job-panels.js +11 -4
  152. package/dist/portfolio-import/import-job-panels.js.map +1 -1
  153. package/dist/portfolio-import/job-error-copy.d.ts +62 -0
  154. package/dist/portfolio-import/job-error-copy.d.ts.map +1 -0
  155. package/dist/portfolio-import/job-error-copy.js +78 -0
  156. package/dist/portfolio-import/job-error-copy.js.map +1 -0
  157. package/dist/realtime/organisation-events/schemas.d.ts +2 -2
  158. package/package.json +4 -1
  159. package/src/theme/tokens.css +66 -0
@@ -1,10 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
2
3
  import { RotateCw } from "lucide-react";
3
4
  import { CopyButton } from "../components/copy-button.js";
4
5
  import { cn } from "../lib/utils.js";
5
6
  import { useCopy } from "./copy.js";
6
7
  import { AgentConfirmCard } from "./confirm-card.js";
7
- import { AgentToolCallCard } from "./tool-call-card.js";
8
+ import { AgentMarkdown } from "./markdown.js";
9
+ import { AgentToolActivity } from "./tool-activity.js";
10
+ import { planMessageParts } from "./tool-activity-model.js";
8
11
  import { agentButton } from "./ui.js";
9
12
  const DEFAULT_COPY = {
10
13
  userLabel: "You",
@@ -18,29 +21,62 @@ const DEFAULT_COPY = {
18
21
  };
19
22
  const partKey = (part, i) => `${part.type}:${i}`;
20
23
  /**
21
- * @internal One message. Assistant messages are append-only (text keeps a stable
22
- * DOM so assistive tech does not re-read), user messages are a right-aligned bubble.
24
+ * @internal One message. Assistant messages are append-only (text keeps a stable DOM so assistive tech does not
25
+ * re-read) and render as markdown; user messages are plain text in a right-aligned bubble. A run of tool calls is one
26
+ * activity row, never a card per call; approvals and domain cards stay in place, prominent.
23
27
  */
24
- export function AgentMessage({ message, approvalStatus, onApproval, onRetry, onRetryTool, renderCard, nowMs, copy, className, }) {
28
+ export function AgentMessage({ message, approvalStatus, onApproval, onRetry, onRetryTool, renderCard, toolLabels, formatToolLabel, cardLabels, toolWording, cardCoversCall, onNavigate, linkPolicy, locale, activityCopy, markdownCopy, entering, nowMs, copy, className, }) {
25
29
  const c = useCopy(DEFAULT_COPY, copy);
26
30
  const user = message.role === "user";
27
31
  const text = message.parts.flatMap((p) => (p.type === "text" ? [p.text] : [])).join("\n\n");
28
- return (_jsxs("article", { "aria-label": user ? c.userLabel : c.assistantLabel, "data-role": message.role, className: cn("flex flex-col gap-2", user ? "items-end" : "items-stretch", className), children: [message.parts.map((part, i) => {
32
+ // The host's cards are drawn once, here: whether a card drew anything decides whether its step is marked "shown below".
33
+ const cards = useMemo(() => message.parts.map((p) => (p.type === "card" ? renderCard?.(p.cardType, p.data) : undefined)), [message.parts, renderCard]);
34
+ const items = useMemo(() => {
35
+ const renderedCards = new Set();
36
+ cards.forEach((node, i) => {
37
+ if (node !== null && node !== undefined && node !== false)
38
+ renderedCards.add(i);
39
+ });
40
+ return planMessageParts(message.parts, {
41
+ covers: cardCoversCall,
42
+ streaming: message.streaming,
43
+ renderedCards,
44
+ cardLabels,
45
+ toolWording,
46
+ });
47
+ }, [message.parts, message.streaming, cards, cardCoversCall, cardLabels, toolWording]);
48
+ // One entrance per element: parts that were here when the message mounted ride the message's own entrance; only a
49
+ // part that arrives afterwards fades in by itself.
50
+ const [mountedParts] = useState(message.parts.length);
51
+ const lastIndex = message.parts.length - 1;
52
+ return (_jsxs("article", { "aria-label": user ? c.userLabel : c.assistantLabel, "data-role": message.role, className: cn("flex flex-col gap-2", user ? "items-end" : "items-stretch", entering && "agent-enter", className), children: [items.map((item) => {
53
+ if (item.kind === "activity") {
54
+ return (_jsx(AgentToolActivity, { steps: item.steps, toolLabels: toolLabels, formatToolLabel: formatToolLabel, cardLabels: cardLabels, toolWording: toolWording, onRetry: onRetryTool, locale: locale, copy: activityCopy, className: item.startIndex >= mountedParts ? "agent-fade-in" : undefined }, item.key));
55
+ }
56
+ const { part, index: i } = item;
29
57
  const key = partKey(part, i);
58
+ const later = i >= mountedParts;
30
59
  switch (part.type) {
31
60
  case "text":
32
- return (_jsx("p", { className: cn("whitespace-pre-wrap text-sm/6 text-foreground", user &&
33
- "max-w-5/6 rounded-2xl rounded-br-sm bg-primary px-3.5 py-2 text-primary-foreground"), children: part.text }, key));
61
+ if (user)
62
+ return (_jsx("p", { className: "max-w-5/6 rounded-2xl rounded-br-sm bg-primary px-3.5 py-2 text-sm/6 whitespace-pre-wrap text-primary-foreground", children: part.text }, key));
63
+ if (part.text.trim() === "")
64
+ return null;
65
+ return (_jsx(AgentMarkdown, { text: part.text, streaming: Boolean(message.streaming) && i === lastIndex, onNavigate: onNavigate, linkPolicy: linkPolicy, copy: markdownCopy, className: later ? "agent-fade-in" : undefined }, key));
34
66
  case "thinking":
35
- return (_jsxs("p", { className: "text-xs/5 text-muted-foreground", children: [_jsxs("span", { className: "sr-only", children: [c.thinking, ": "] }), part.summary] }, key));
67
+ return null; // a thought is a step in the activity trail
36
68
  case "toolCall":
37
- return _jsx(AgentToolCallCard, { call: part.call, onRetry: onRetryTool }, part.call.id);
69
+ return null;
38
70
  case "approval": {
39
71
  const status = approvalStatus?.get(part.approval.approvalId) ?? part.approval.status;
40
72
  return (_jsx(AgentConfirmCard, { approval: { ...part.approval, status }, nowMs: nowMs, onDecision: (d, typed, attestations) => onApproval?.(part.approval.approvalId, d, typed, attestations) }, part.approval.approvalId));
41
73
  }
42
- case "card":
43
- return _jsx("div", { children: renderCard?.(part.cardType, part.data) }, key);
74
+ case "card": {
75
+ const card = cards[i];
76
+ if (card === null || card === undefined || card === false)
77
+ return null;
78
+ return (_jsx("div", { className: later ? "agent-fade-in" : undefined, children: card }, key));
79
+ }
44
80
  }
45
81
  }), !user && message.stopped && _jsx("p", { className: "text-xs/4 text-muted-foreground", children: c.stopped }), !user && message.failed && (_jsxs("div", { className: "flex items-center gap-2 text-xs/5 text-[var(--tone-danger-fg)]", children: [_jsx("span", { children: c.failed }), onRetry && (_jsxs("button", { type: "button", className: agentButton.ghost, onClick: () => onRetry(message.id), children: [_jsx(RotateCw, { "aria-hidden": true, className: "size-3.5" }), c.retry] }))] })), !user && !message.streaming && text && (_jsx("div", { className: "self-start", children: _jsx(CopyButton, { value: text, label: c.copy, copiedLabel: c.copied }) }))] }));
46
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/agent/message.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAYnC,MAAM,YAAY,GAAqB;IACrC,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAsBF,MAAM,OAAO,GAAG,CAAC,IAAuC,EAAE,CAAS,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;AAEpG;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,cAAc,EACd,UAAU,EACV,OAAO,EACP,WAAW,EACX,UAAU,EACV,K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KAAC,UAAU,IAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,GAAI,GAC7D,CACP,IACO,CACX,CAAC;AACJ,CAAC"}
@@ -12,6 +12,6 @@ const DEFAULT_COPY = {
12
12
  /** @internal Panel frame. Sizes with container queries, so it behaves the same at 440 px in a drawer and full width on a page. */
13
13
  export function AgentPanelFrame({ mode = "docked", pageContextChip, unavailable, onClose, headerActions, children, copy, className, }) {
14
14
  const c = useCopy(DEFAULT_COPY, copy);
15
- return (_jsxs("section", { "aria-label": c.title, "data-mode": mode, className: cn("@container flex h-full min-h-0 flex-col bg-background", mode === "docked" ? "w-full max-w-110 border-l border-border/60" : "w-full", className), children: [_jsxs("header", { className: "flex items-center gap-2 border-b border-border/60 px-4 py-2.5", children: [_jsx("h2", { className: "text-sm/5 font-semibold text-foreground", children: c.title }), pageContextChip && (_jsxs("span", { className: "min-w-0 truncate rounded-full bg-muted px-2 py-0.5 text-xs/4 text-muted-foreground", title: pageContextChip, children: [_jsxs("span", { className: "sr-only", children: [c.pageContext, ": "] }), pageContextChip] })), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [headerActions, onClose && (_jsx("button", { type: "button", "aria-label": c.close, onClick: onClose, className: cn("inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground", focusRing), children: _jsx(PanelRightClose, { "aria-hidden": true, className: "size-4" }) }))] })] }), unavailable ? _jsx(AgentError, { kind: "unavailable", className: "m-4" }) : children] }));
15
+ return (_jsxs("section", { "aria-label": c.title, "data-mode": mode, className: cn("@container flex h-full min-h-0 flex-col bg-background", mode === "docked" ? "w-full max-w-110 border-l border-border/60" : "w-full", className), children: [_jsxs("header", { className: "flex min-h-14 items-center gap-2 border-b border-border/60 px-4 py-3", children: [_jsx("h2", { className: "text-sm/5 font-semibold text-foreground", children: c.title }), pageContextChip && (_jsxs("span", { className: "min-w-0 truncate rounded-full bg-muted px-2 py-0.5 text-xs/4 text-muted-foreground", title: pageContextChip, children: [_jsxs("span", { className: "sr-only", children: [c.pageContext, ": "] }), pageContextChip] })), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [headerActions, onClose && (_jsx("button", { type: "button", "aria-label": c.close, onClick: onClose, className: cn("inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground", focusRing), children: _jsx(PanelRightClose, { "aria-hidden": true, className: "size-4" }) }))] })] }), unavailable ? _jsx(AgentError, { kind: "unavailable", className: "m-4" }) : children] }));
16
16
  }
17
17
  //# sourceMappingURL=panel-frame.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"panel-frame.js","sourceRoot":"","sources":["../../src/agent/panel-frame.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAOjC,MAAM,YAAY,GAAwB;IACxC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,cAAc;CAC5B,CAAC;AAiBF,kIAAkI;AAClI,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,GAAG,QAAQ,EACf,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,GACY;IACrB,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACtC,OAAO,CACL,iCACc,CAAC,CAAC,KAAK,eACR,IAAI,EACf,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,QAAQ,EA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aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,GACY;IACrB,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACtC,OAAO,CACL,iCACc,CAAC,CAAC,KAAK,eACR,IAAI,EACf,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,QAAQ,EAC3E,SAAS,CACV,aAED,kBAAQ,SAAS,EAAC,sEAAsE,aACtF,aAAI,SAAS,EAAC,yCAAyC,YAAE,CAAC,CAAC,KAAK,GAAM,EACrE,eAAe,IAAI,CAClB,gBACE,SAAS,EAAC,oFAAoF,EAC9F,KAAK,EAAE,eAAe,aAEtB,gBAAM,SAAS,EAAC,SAAS,aAAE,CAAC,CAAC,WAAW,UAAU,EACjD,eAAe,IACX,CACR,EACD,eAAK,SAAS,EAAC,iCAAiC,aAC7C,aAAa,EACb,OAAO,IAAI,CACV,iBACE,IAAI,EAAC,QAAQ,gBACD,CAAC,CAAC,KAAK,EACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,EAAE,CACX,sHAAsH,EACtH,SAAS,CACV,YAED,KAAC,eAAe,yBAAa,SAAS,EAAC,QAAQ,GAAG,GAC3C,CACV,IACG,IACC,EACR,WAAW,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,IAAI,EAAC,aAAa,EAAC,SAAS,EAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,IACnE,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { type ReactNode } from "react";
2
+ import type { CardAction, CardDetail, CardProposal } from "@cellarnode/agent-cards/zod4";
3
+ import { type MaskedValueCopy } from "../masked-value.js";
4
+ import { type CellValue } from "../schema.js";
5
+ import { type Tone } from "../ui.js";
6
+ import { subjectOf, type AgentToolCatalog, type BuildConfirmFailure, type CardConfirmPlan, type DetailKind, type ProposalApplyPlan } from "./host-contract.js";
7
+ import { type AgentProposalDiffCopy } from "./proposal-diff.js";
8
+ /**
9
+ * @internal Shared kit for the role-agent result cards (CEL-2445): frame, field grid, chip, actions, detail pointer.
10
+ * Pure props in, events out. Cards never fetch, never run a tool and never build a link from model text: a link renders
11
+ * only when the host's `allowLink` accepts the path, otherwise the label is plain text.
12
+ */
13
+ export interface AgentCardLinkProps {
14
+ /** The host's route allowlist. With no `allowLink` NO link renders (secure default). */
15
+ allowLink?: (path: string) => boolean;
16
+ /** How the host renders an accepted internal link (router `<Link>`); defaults to a plain anchor. */
17
+ renderLink?: (path: string, children: ReactNode, className: string) => ReactNode;
18
+ }
19
+ export declare function AgentCardLink({ path, allowLink, renderLink, className, children, }: AgentCardLinkProps & {
20
+ path: string | undefined;
21
+ className?: string;
22
+ children: ReactNode;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ export declare function AgentCardFrame({ title, eyebrow, badge, children, footer, className, }: {
25
+ title: ReactNode;
26
+ /** A small kind label above the title ("Offer") when the title is the record's own name. */
27
+ eyebrow?: ReactNode;
28
+ badge?: ReactNode;
29
+ children: ReactNode;
30
+ footer?: ReactNode;
31
+ className?: string;
32
+ }): import("react/jsx-runtime").JSX.Element;
33
+ export declare function AgentChip({ tone, className, children, }: {
34
+ tone?: Tone;
35
+ className?: string;
36
+ children: ReactNode;
37
+ }): import("react/jsx-runtime").JSX.Element;
38
+ export declare function AgentFieldGrid({ children }: {
39
+ children: ReactNode;
40
+ }): import("react/jsx-runtime").JSX.Element;
41
+ /** One labelled value. Renders nothing for an absent field, so a sparse card stays compact. A masked cell renders as masked and takes a full row (the mask pill does not wrap, so it never spills into its neighbour at 320px). */
42
+ export declare function AgentField({ label, value, wide, maskedCopy, }: {
43
+ label: string;
44
+ value: CellValue | undefined;
45
+ wide?: boolean;
46
+ /** The mask pill's strings, in the host's language. */
47
+ maskedCopy?: Partial<MaskedValueCopy>;
48
+ }): import("react/jsx-runtime").JSX.Element | null;
49
+ export interface AgentCardActionsCopy {
50
+ needsConfirm: string;
51
+ openDetail: string;
52
+ }
53
+ export declare const ACTIONS_COPY: AgentCardActionsCopy;
54
+ /**
55
+ * What every role card needs from its host. The host owns the catalog, the record fetch and what happens after a confirm
56
+ * plan exists; the card owns nothing that writes.
57
+ */
58
+ export interface AgentRoleCardHostProps extends AgentCardLinkProps {
59
+ /** The mask pill's strings (its accessible name and tooltip), in the host's language. Every masked value on the card uses them. */
60
+ maskedCopy?: Partial<MaskedValueCopy>;
61
+ /** The host's tool catalog. Without it no tool action and no proposal can be used. */
62
+ catalog?: AgentToolCatalog;
63
+ /** Fetch the full record for a proposal's Apply (the host's own authenticated read). */
64
+ fetchRecord?: (kind: DetailKind, id: string) => Promise<unknown>;
65
+ /** Called ONLY with a successful confirm plan built from the catalog; never with the raw model action. */
66
+ onAction?: (result: {
67
+ action: CardAction;
68
+ plan: CardConfirmPlan;
69
+ }) => void;
70
+ /** Called when a clicked action could not be turned into a plan (the catalog changed under it, or the args no longer validate). */
71
+ onActionRefused?: (action: CardAction, reason: BuildConfirmFailure) => void;
72
+ /**
73
+ * Open the inspector drawer / canvas for the record the pointer names; the host fetches the record itself. `opener` is the button
74
+ * that was pressed: hand it back to the drawer's `returnFocus` so focus returns to it on close even where the browser did not
75
+ * focus the button on click (Safari) or the card re-rendered in between.
76
+ */
77
+ onOpenDetail?: (detail: CardDetail, opener?: HTMLElement) => void;
78
+ /** Called ONLY with the `planProposalApply` result; never with the raw proposal. */
79
+ onApplyProposal?: (result: ProposalApplyPlan) => void;
80
+ /**
81
+ * Edit before applying. The edited proposal is a NEW claim: saving it MUST go back through `planProposalApply` (re-fetch, stale
82
+ * check, subject and targetKind binding, input schema) and the confirm flow, exactly like the original. Never apply an edited
83
+ * proposal directly.
84
+ */
85
+ onEditProposal?: (proposal: CardProposal) => void;
86
+ onRejectProposal?: (proposal: CardProposal) => void;
87
+ proposalCopy?: Partial<AgentProposalDiffCopy>;
88
+ }
89
+ export interface AgentCardActionsProps extends AgentCardLinkProps {
90
+ actions?: CardAction[];
91
+ detail?: CardDetail;
92
+ catalog?: AgentToolCatalog;
93
+ onAction?: AgentRoleCardHostProps["onAction"];
94
+ onActionRefused?: AgentRoleCardHostProps["onActionRefused"];
95
+ onOpenDetail?: AgentRoleCardHostProps["onOpenDetail"];
96
+ copy?: Partial<AgentCardActionsCopy>;
97
+ }
98
+ export declare function AgentCardActions({ actions, detail, catalog, onAction, onActionRefused, onOpenDetail, allowLink, renderLink, copy, }: AgentCardActionsProps): import("react/jsx-runtime").JSX.Element | null;
99
+ /** The proposal diff and the action row every role card ends with, wired to the host contract. */
100
+ export declare function AgentCardExtras({ data, subject, host, }: {
101
+ data: {
102
+ actions?: CardAction[];
103
+ detail?: CardDetail;
104
+ proposal?: CardProposal;
105
+ };
106
+ /** The record THIS card is about; a proposal for any other record is refused at Apply. */
107
+ subject: Pick<CardDetail, "kind" | "id"> | undefined;
108
+ host: AgentRoleCardHostProps;
109
+ }): import("react/jsx-runtime").JSX.Element;
110
+ export { subjectOf };
111
+ //# sourceMappingURL=card-kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-kit.d.ts","sourceRoot":"","sources":["../../../src/agent/role-cards/card-kit.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGzF,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAGL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK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CAAC;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,YAAY,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,IAAI,GACL,EAAE,qBAAqB,kDAsDvB;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,IAAI,GACL,EAAE;IACD,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;KAAE,CAAC;IAC/E,0FAA0F;IAC1F,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACrD,IAAI,EAAE,sBAAsB,CAAC;CAC9B,2CA2BA;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ import { fmt, useCopy } from "../copy.js";
5
+ import { MaskedValue } from "../masked-value.js";
6
+ import { isMasked } from "../schema.js";
7
+ import { agentButton, bezel, toneChip } from "../ui.js";
8
+ import { buildConfirm, offeredActions, subjectOf, } from "./host-contract.js";
9
+ import { AgentProposalDiff } from "./proposal-diff.js";
10
+ export function AgentCardLink({ path, allowLink, renderLink, className, children, }) {
11
+ const cls = cn("rounded-sm underline-offset-2 hover:underline pointer-coarse:inline-flex pointer-coarse:min-h-11 pointer-coarse:items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className);
12
+ if (!path || !allowLink?.(path))
13
+ return _jsx(_Fragment, { children: children });
14
+ if (renderLink)
15
+ return _jsx(_Fragment, { children: renderLink(path, children, cls) });
16
+ return (_jsx("a", { href: path, className: cls, children: children }));
17
+ }
18
+ export function AgentCardFrame({ title, eyebrow, badge, children, footer, className, }) {
19
+ const id = useId();
20
+ return (_jsxs("section", { "aria-labelledby": id, className: cn("@container flex flex-col gap-3 p-4 text-sm/5 text-foreground", bezel, className), children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [eyebrow && _jsx("p", { className: "text-xs/4 text-muted-foreground", children: eyebrow }), _jsx("h3", { id: id, className: "min-w-0 text-sm/5 font-semibold text-balance", children: title })] }), badge] }), children, footer] }));
21
+ }
22
+ export function AgentChip({ tone = "neutral", className, children, }) {
23
+ return (_jsx("span", { className: cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs/4 font-medium", toneChip[tone], className), children: children }));
24
+ }
25
+ export function AgentFieldGrid({ children }) {
26
+ return _jsx("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-2 @sm:grid-cols-3", children: children });
27
+ }
28
+ /** One labelled value. Renders nothing for an absent field, so a sparse card stays compact. A masked cell renders as masked and takes a full row (the mask pill does not wrap, so it never spills into its neighbour at 320px). */
29
+ export function AgentField({ label, value, wide, maskedCopy, }) {
30
+ if (value === undefined || value === null || value === "")
31
+ return null;
32
+ return (_jsxs("div", { className: cn("flex min-w-0 flex-col gap-0.5", (wide || isMasked(value)) && "col-span-2 @sm:col-span-3"), children: [_jsx("dt", { className: "text-xs/4 text-muted-foreground", children: label }), _jsx("dd", { className: "min-w-0 text-sm/5 break-words", children: _jsx(MaskedValue, { value: value, copy: maskedCopy }) })] }));
33
+ }
34
+ export const ACTIONS_COPY = {
35
+ needsConfirm: "Asks you to confirm",
36
+ openDetail: "Open full details",
37
+ };
38
+ export function AgentCardActions({ actions, detail, catalog, onAction, onActionRefused, onOpenDetail, allowLink, renderLink, copy, }) {
39
+ const c = useCopy(ACTIONS_COPY, copy);
40
+ // Rules 1 to 3: only what the catalog accepts, labelled and tiered by the catalog.
41
+ const visible = offeredActions(actions, catalog, { canRunTools: !!onAction, allowLink });
42
+ const showDetail = detail !== undefined && onOpenDetail !== undefined;
43
+ if (visible.length === 0 && !showDetail)
44
+ return null;
45
+ return (_jsxs("div", { className: "flex flex-wrap items-center gap-2 border-t border-border/60 pt-3", children: [showDetail && (_jsx("button", { type: "button", className: agentButton.quiet, onClick: (event) => onOpenDetail(detail, event.currentTarget), children: c.openDetail })), visible.map((a) => {
46
+ const gated = a.tier === "destructive" || a.tier === "costly";
47
+ const cls = gated ? agentButton.danger : agentButton.quiet;
48
+ const hint = gated
49
+ ? fmt("{label}. {hint}", { label: a.label, hint: c.needsConfirm })
50
+ : a.label;
51
+ if (a.tool && onAction) {
52
+ return (_jsx("button", { type: "button", className: cls, "aria-label": hint, onClick: () => {
53
+ const built = buildConfirm(a, catalog ?? {});
54
+ if (built.ok)
55
+ onAction({ action: a, plan: built.plan });
56
+ else
57
+ onActionRefused?.(a, built.reason);
58
+ }, children: a.label }, a.id));
59
+ }
60
+ return (_jsx(AgentCardLink, { path: a.href, allowLink: allowLink, renderLink: renderLink, className: cls, children: a.label }, a.id));
61
+ })] }));
62
+ }
63
+ /** The proposal diff and the action row every role card ends with, wired to the host contract. */
64
+ export function AgentCardExtras({ data, subject, host, }) {
65
+ return (_jsxs(_Fragment, { children: [data.proposal && (_jsx(AgentProposalDiff, { proposal: data.proposal, catalog: host.catalog, fetchRecord: host.fetchRecord, expected: subject, onApply: host.onApplyProposal, onEdit: host.onEditProposal, onReject: host.onRejectProposal, copy: host.proposalCopy })), _jsx(AgentCardActions, { actions: data.actions, detail: data.detail, catalog: host.catalog, onAction: host.onAction, onActionRefused: host.onActionRefused, onOpenDetail: host.onOpenDetail, allowLink: host.allowLink, renderLink: host.renderLink })] }));
66
+ }
67
+ export { subjectOf };
68
+ //# sourceMappingURL=card-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-kit.js","sourceRoot":"","sources":["../../../src/agent/role-cards/card-kit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAwB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAkB,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,SAAS,GAMV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAA8B,MAAM,iBAAiB,CAAC;AAehF,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,GAKT;IACC,MAAM,GAAG,GAAG,EAAE,CACZ,gNAAgN,EAChN,SAAS,CACV,CAAC;IACF,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACxD,IAAI,UAAU;QAAE,OAAO,4BAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,GAA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,OAAO,EACP,IAAI,GAML;IACC,OAAO,CACL,8BACG,IAAI,CAAC,QAAQ,IAAI,CAChB,KAAC,iBAAiB,IAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,MAAM,EAAE,IAAI,CAAC,cAAc,EAC3B,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAC/B,IAAI,EAAE,IAAI,CAAC,YAAY,GACvB,CACH,EACD,KAAC,gBAAgB,IACf,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,UAAU,EAAE,IAAI,CAAC,UAAU,GAC3B,IACD,CACJ,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { DataTableData } from "@cellarnode/agent-cards/zod4";
2
+ import { type AgentRoleCardHostProps } from "./card-kit.js";
3
+ export interface AgentDataTableCardCopy {
4
+ title: string;
5
+ /** The table's name for a screen reader. */
6
+ caption: string;
7
+ /** What the card says when there are no rows. */
8
+ empty: string;
9
+ /** What a cell with nothing in it shows. */
10
+ emptyCell: string;
11
+ /** `{shown}` rows are drawn out of `{total}`. */
12
+ capped: string;
13
+ /** A column whose label is empty once cleaned: `{n}` is its position. */
14
+ column: string;
15
+ yes: string;
16
+ no: string;
17
+ /** What a plain value in a column the server marked masked is replaced with. */
18
+ hidden: string;
19
+ /** How text written by someone else is set off: `{text}` is the text. */
20
+ quote: string;
21
+ /** The name of the card's deep link, by the kind of page it opens (the link's text, so it reads on its own). */
22
+ openOffer: string;
23
+ openProducer: string;
24
+ openOrganisation: string;
25
+ openPortfolio: string;
26
+ openProduct: string;
27
+ openProductGallery: string;
28
+ openLabels: string;
29
+ openImports: string;
30
+ openElabelHome: string;
31
+ /** Any other page of the e-label app. */
32
+ openElabel: string;
33
+ /** A link to a route the host added itself. */
34
+ openOther: string;
35
+ }
36
+ /**
37
+ * Columns whose text is obviously someone else's, quoted without the host having to say so: a buyer, a counterparty, the
38
+ * opportunity an offer answers, and the columns the cellarnode-mcp agents key by author (`counterpartyFile`: the other side's offer
39
+ * file; `producerFile` and `producerBeverage`: a producer's public documents and beverages as an importer sees them; `file` is the
40
+ * caller's own and is not here). `thirdPartyColumns` EXTENDS these (`surfaceThirdPartyColumns` is the per-surface list). A
41
+ * `DataTable` has no flag that marks a column untrusted, so the column's key is what says whose words it carries.
42
+ */
43
+ export declare const DEFAULT_THIRD_PARTY_COLUMNS: readonly string[];
44
+ /** Rows drawn. The schema allows 500, the agents emit at most 51 (50 and a marker row), a chat card is not a data grid. */
45
+ export declare const MAX_AGENT_TABLE_ROWS = 100;
46
+ export interface AgentDataTableCardProps extends AgentRoleCardHostProps {
47
+ data: DataTableData;
48
+ copy?: Partial<AgentDataTableCardCopy>;
49
+ /** More column keys whose text someone else wrote, on top of `DEFAULT_THIRD_PARTY_COLUMNS`. Matched on the column's `key`. */
50
+ thirdPartyColumns?: readonly string[];
51
+ /** The host's own label for a column, by its `key`. It wins over the label the agent sent (which is in the agent's language). */
52
+ columnLabels?: Readonly<Record<string, string>>;
53
+ /**
54
+ * The host's display text for a cell (a date, a currency, a number in the viewer's locale), or `undefined` for the default. Never
55
+ * called for a mask, an empty cell or a plain value in a masked column. Text from a column quoted as third-party stays quoted. A
56
+ * hook that throws is skipped: it cannot take the card down.
57
+ */
58
+ formatCell?: (key: string, value: string | number | boolean) => string | undefined;
59
+ /**
60
+ * A BCP 47 tag for the numbers in cells. Set, a number shows with that locale's decimal separator and never grouped (a year or an
61
+ * id stays `2022`); unset, a number shows as JavaScript spells it. Use `formatCell` for grouping or a currency.
62
+ */
63
+ locale?: string;
64
+ }
65
+ /**
66
+ * @internal Read card for a table the agent shows (CEL-2488): the file link tools, a producer's documents and showcase. Pure props in,
67
+ * events out, drawn on the card kit like every role card.
68
+ *
69
+ * - Cells are inert text, never markup or links. A mask stays a mask; a plain value in a column marked `masked` is replaced by a mask
70
+ * (the server is the one that masks, so a plain value there is a contract break, and it is not shown). Text someone else wrote
71
+ * renders quoted when its column is in `DEFAULT_THIRD_PARTY_COLUMNS` or the host's `thirdPartyColumns`.
72
+ * - The table's `link` is a visible link under the table, named for the page it opens ("Open offer", from `copy`), and it is drawn
73
+ * only when the host's `allowLink` accepts the path: a refused link draws nothing. Rows carry no link of their own (the schema has
74
+ * none).
75
+ * - Read-only: a `detail` pointer and a `proposal` are not drawn, because a table is a list, not one record (`readRoleCard` drops
76
+ * them). `actions` go through the same catalog and `allowLink` rules as every card.
77
+ * - Rows past `MAX_AGENT_TABLE_ROWS` are left out and the card says so.
78
+ */
79
+ export declare function AgentDataTableCard({ data, copy, thirdPartyColumns, columnLabels, formatCell, locale, ...host }: AgentDataTableCardProps): import("react/jsx-runtime").JSX.Element;
80
+ //# sourceMappingURL=data-table-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-card.d.ts","sourceRoot":"","sources":["../../../src/agent/role-cards/data-table-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAMlE,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IA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