@cellarnode/ui 0.201.0 → 0.202.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.
- package/dist/agent/composer.d.ts +6 -1
- package/dist/agent/composer.d.ts.map +1 -1
- package/dist/agent/composer.js +43 -9
- package/dist/agent/composer.js.map +1 -1
- package/dist/agent/conversation.d.ts +20 -2
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/conversation.js +37 -5
- package/dist/agent/conversation.js.map +1 -1
- package/dist/agent/copy.d.ts +7 -0
- package/dist/agent/copy.d.ts.map +1 -1
- package/dist/agent/copy.js +9 -0
- package/dist/agent/copy.js.map +1 -1
- package/dist/agent/fixtures.d.ts +34 -0
- package/dist/agent/fixtures.d.ts.map +1 -1
- package/dist/agent/fixtures.js +77 -0
- package/dist/agent/fixtures.js.map +1 -1
- package/dist/agent/index.d.ts +18 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +18 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/markdown.d.ts +64 -0
- package/dist/agent/markdown.d.ts.map +1 -0
- package/dist/agent/markdown.js +220 -0
- package/dist/agent/markdown.js.map +1 -0
- package/dist/agent/masked-value.d.ts +1 -0
- package/dist/agent/masked-value.d.ts.map +1 -1
- package/dist/agent/masked-value.js +4 -1
- package/dist/agent/masked-value.js.map +1 -1
- package/dist/agent/message.d.ts +26 -6
- package/dist/agent/message.d.ts.map +1 -1
- package/dist/agent/message.js +47 -11
- package/dist/agent/message.js.map +1 -1
- package/dist/agent/panel-frame.js +1 -1
- package/dist/agent/panel-frame.js.map +1 -1
- package/dist/agent/role-cards/card-kit.d.ts +111 -0
- package/dist/agent/role-cards/card-kit.d.ts.map +1 -0
- package/dist/agent/role-cards/card-kit.js +68 -0
- package/dist/agent/role-cards/card-kit.js.map +1 -0
- package/dist/agent/role-cards/data-table-card.d.ts +80 -0
- package/dist/agent/role-cards/data-table-card.d.ts.map +1 -0
- package/dist/agent/role-cards/data-table-card.js +214 -0
- package/dist/agent/role-cards/data-table-card.js.map +1 -0
- package/dist/agent/role-cards/fixtures.d.ts +124 -0
- package/dist/agent/role-cards/fixtures.d.ts.map +1 -0
- package/dist/agent/role-cards/fixtures.js +401 -0
- package/dist/agent/role-cards/fixtures.js.map +1 -0
- package/dist/agent/role-cards/host-contract.d.ts +214 -0
- package/dist/agent/role-cards/host-contract.d.ts.map +1 -0
- package/dist/agent/role-cards/host-contract.js +348 -0
- package/dist/agent/role-cards/host-contract.js.map +1 -0
- package/dist/agent/role-cards/inspector-drawer.d.ts +42 -0
- package/dist/agent/role-cards/inspector-drawer.d.ts.map +1 -0
- package/dist/agent/role-cards/inspector-drawer.js +68 -0
- package/dist/agent/role-cards/inspector-drawer.js.map +1 -0
- package/dist/agent/role-cards/inspector-fixtures.d.ts +84 -0
- package/dist/agent/role-cards/inspector-fixtures.d.ts.map +1 -0
- package/dist/agent/role-cards/inspector-fixtures.js +162 -0
- package/dist/agent/role-cards/inspector-fixtures.js.map +1 -0
- package/dist/agent/role-cards/inspector-record.d.ts +109 -0
- package/dist/agent/role-cards/inspector-record.d.ts.map +1 -0
- package/dist/agent/role-cards/inspector-record.js +346 -0
- package/dist/agent/role-cards/inspector-record.js.map +1 -0
- package/dist/agent/role-cards/inspector-view.d.ts +137 -0
- package/dist/agent/role-cards/inspector-view.d.ts.map +1 -0
- package/dist/agent/role-cards/inspector-view.js +261 -0
- package/dist/agent/role-cards/inspector-view.js.map +1 -0
- package/dist/agent/role-cards/match-card.d.ts +21 -0
- package/dist/agent/role-cards/match-card.d.ts.map +1 -0
- package/dist/agent/role-cards/match-card.js +30 -0
- package/dist/agent/role-cards/match-card.js.map +1 -0
- package/dist/agent/role-cards/offer-card.d.ts +27 -0
- package/dist/agent/role-cards/offer-card.d.ts.map +1 -0
- package/dist/agent/role-cards/offer-card.js +68 -0
- package/dist/agent/role-cards/offer-card.js.map +1 -0
- package/dist/agent/role-cards/opportunity-card.d.ts +26 -0
- package/dist/agent/role-cards/opportunity-card.d.ts.map +1 -0
- package/dist/agent/role-cards/opportunity-card.js +50 -0
- package/dist/agent/role-cards/opportunity-card.js.map +1 -0
- package/dist/agent/role-cards/product-card.d.ts +32 -0
- package/dist/agent/role-cards/product-card.d.ts.map +1 -0
- package/dist/agent/role-cards/product-card.js +50 -0
- package/dist/agent/role-cards/product-card.js.map +1 -0
- package/dist/agent/role-cards/proposal-diff.d.ts +38 -0
- package/dist/agent/role-cards/proposal-diff.d.ts.map +1 -0
- package/dist/agent/role-cards/proposal-diff.js +74 -0
- package/dist/agent/role-cards/proposal-diff.js.map +1 -0
- package/dist/agent/role-cards/registry.d.ts +43 -0
- package/dist/agent/role-cards/registry.d.ts.map +1 -0
- package/dist/agent/role-cards/registry.js +46 -0
- package/dist/agent/role-cards/registry.js.map +1 -0
- package/dist/agent/role-cards/score-meter.d.ts +12 -0
- package/dist/agent/role-cards/score-meter.d.ts.map +1 -0
- package/dist/agent/role-cards/score-meter.js +17 -0
- package/dist/agent/role-cards/score-meter.js.map +1 -0
- package/dist/agent/role-cards/surface-links.d.ts +54 -0
- package/dist/agent/role-cards/surface-links.d.ts.map +1 -0
- package/dist/agent/role-cards/surface-links.js +149 -0
- package/dist/agent/role-cards/surface-links.js.map +1 -0
- package/dist/agent/role-cards/text-safety.d.ts +24 -0
- package/dist/agent/role-cards/text-safety.d.ts.map +1 -0
- package/dist/agent/role-cards/text-safety.js +61 -0
- package/dist/agent/role-cards/text-safety.js.map +1 -0
- package/dist/agent/schema.d.ts +7 -0
- package/dist/agent/schema.d.ts.map +1 -1
- package/dist/agent/schema.js +25 -2
- package/dist/agent/schema.js.map +1 -1
- package/dist/agent/states.d.ts +1 -0
- package/dist/agent/states.d.ts.map +1 -1
- package/dist/agent/states.js +1 -1
- package/dist/agent/states.js.map +1 -1
- package/dist/agent/thinking.d.ts +13 -4
- package/dist/agent/thinking.d.ts.map +1 -1
- package/dist/agent/thinking.js +15 -6
- package/dist/agent/thinking.js.map +1 -1
- package/dist/agent/thread-list.d.ts +33 -2
- package/dist/agent/thread-list.d.ts.map +1 -1
- package/dist/agent/thread-list.js +158 -8
- package/dist/agent/thread-list.js.map +1 -1
- package/dist/agent/tool-activity-model.d.ts +136 -0
- package/dist/agent/tool-activity-model.d.ts.map +1 -0
- package/dist/agent/tool-activity-model.js +288 -0
- package/dist/agent/tool-activity-model.js.map +1 -0
- package/dist/agent/tool-activity.d.ts +55 -0
- package/dist/agent/tool-activity.d.ts.map +1 -0
- package/dist/agent/tool-activity.js +159 -0
- package/dist/agent/tool-activity.js.map +1 -0
- package/dist/agent/tool-call-card.d.ts +9 -1
- package/dist/agent/tool-call-card.d.ts.map +1 -1
- package/dist/agent/tool-call-card.js +7 -1
- package/dist/agent/tool-call-card.js.map +1 -1
- package/dist/agent/ui.js +1 -1
- package/dist/agent/ui.js.map +1 -1
- package/dist/agent/use-motion.d.ts +15 -0
- package/dist/agent/use-motion.d.ts.map +1 -0
- package/dist/agent/use-motion.js +52 -0
- package/dist/agent/use-motion.js.map +1 -0
- package/dist/chat/chat-composer.d.ts.map +1 -1
- package/dist/chat/chat-composer.js +1 -1
- package/dist/chat/chat-composer.js.map +1 -1
- package/dist/chat/use-stick-to-bottom.d.ts +5 -0
- package/dist/chat/use-stick-to-bottom.d.ts.map +1 -1
- package/dist/chat/use-stick-to-bottom.js +11 -1
- package/dist/chat/use-stick-to-bottom.js.map +1 -1
- package/dist/components/sheet.d.ts +3 -1
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +2 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/portfolio-import/import-job-panels.d.ts +6 -0
- package/dist/portfolio-import/import-job-panels.d.ts.map +1 -1
- package/dist/portfolio-import/import-job-panels.js +11 -4
- package/dist/portfolio-import/import-job-panels.js.map +1 -1
- package/dist/portfolio-import/job-error-copy.d.ts +62 -0
- package/dist/portfolio-import/job-error-copy.d.ts.map +1 -0
- package/dist/portfolio-import/job-error-copy.js +78 -0
- package/dist/portfolio-import/job-error-copy.js.map +1 -0
- package/dist/realtime/organisation-events/schemas.d.ts +2 -2
- package/package.json +4 -1
- package/src/theme/tokens.css +66 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { DEFAULT_QUOTE, fmt, quoteText } from "../copy.js";
|
|
4
|
+
import { isMasked } from "../schema.js";
|
|
5
|
+
import { MaskedValue } from "../masked-value.js";
|
|
6
|
+
import { AgentChip, AgentField, AgentFieldGrid } from "./card-kit.js";
|
|
7
|
+
import { lookupPath } from "./host-contract.js";
|
|
8
|
+
import { cleanInline, cleanValue } from "./text-safety.js";
|
|
9
|
+
export const DEFAULT_INSPECTOR_RECORD_COPY = {
|
|
10
|
+
highlighted: "Highlighted by the agent",
|
|
11
|
+
details: "Details",
|
|
12
|
+
notSet: "Not set",
|
|
13
|
+
notShown: "Not shown",
|
|
14
|
+
yes: "Yes",
|
|
15
|
+
no: "No",
|
|
16
|
+
item: "Item {n}",
|
|
17
|
+
trail: "{parent} / {child}",
|
|
18
|
+
quote: DEFAULT_QUOTE,
|
|
19
|
+
truncated: "This record is large. Some fields are not shown.",
|
|
20
|
+
};
|
|
21
|
+
const MAX_DEPTH = 3;
|
|
22
|
+
const MAX_LIST = 20;
|
|
23
|
+
const MAX_NODES = 200;
|
|
24
|
+
const MAX_TEXT = 2000;
|
|
25
|
+
const MAX_CHIP = 120;
|
|
26
|
+
const MAX_LABEL = 120;
|
|
27
|
+
const MAX_MASKED = 200;
|
|
28
|
+
/** A value longer than this takes the whole row. */
|
|
29
|
+
const WIDE_TEXT = 48;
|
|
30
|
+
const UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
31
|
+
const ACRONYMS = new Set(["id", "abv", "vat", "url", "sku", "ean", "gtin", "moq", "iban"]);
|
|
32
|
+
/** `validThrough`, `valid_through` and `valid-through` all read "Valid through"; a short known acronym is upper-cased. */
|
|
33
|
+
export function humanizeKey(key) {
|
|
34
|
+
const words = key
|
|
35
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
36
|
+
.replace(/[_\-\s]+/g, " ")
|
|
37
|
+
.trim()
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.split(" ")
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.map((w) => (ACRONYMS.has(w) ? w.toUpperCase() : w));
|
|
42
|
+
if (words.length === 0)
|
|
43
|
+
return key;
|
|
44
|
+
const first = words[0];
|
|
45
|
+
words[0] = ACRONYMS.has(first)
|
|
46
|
+
? first.toUpperCase()
|
|
47
|
+
: first.charAt(0).toUpperCase() + first.slice(1);
|
|
48
|
+
return words.join(" ");
|
|
49
|
+
}
|
|
50
|
+
/** `rounds[].note` is `["rounds", "*", "note"]`; `rounds[0].note` is `["rounds", "0", "note"]`. */
|
|
51
|
+
const toSegments = (path) => path
|
|
52
|
+
.replace(/\[(\d*)\]/g, (_, d) => (d === "" ? ".*" : `.${d}`))
|
|
53
|
+
.split(".")
|
|
54
|
+
.filter(Boolean);
|
|
55
|
+
/**
|
|
56
|
+
* Does a record path fall under one of the patterns? A path matches a pattern when the pattern names the path OR any ancestor of
|
|
57
|
+
* it, so `counterparty` covers `counterparty.name` and `rounds[].note` covers `rounds[1].note`. A pattern of one name matches that
|
|
58
|
+
* name at any depth; a longer pattern is anchored at the root, and `[]` stands for any list position (a trailing `[]` also covers the
|
|
59
|
+
* list itself).
|
|
60
|
+
*/
|
|
61
|
+
export function compilePathMatcher(patterns) {
|
|
62
|
+
// A trailing `[]` names a list's items and the list itself (`requirements[]` also covers `requirements`).
|
|
63
|
+
const compiled = patterns.flatMap((raw) => {
|
|
64
|
+
const p = toSegments(raw);
|
|
65
|
+
if (p.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
return p.length > 1 && p[p.length - 1] === "*" ? [p, p.slice(0, -1)] : [p];
|
|
68
|
+
});
|
|
69
|
+
if (compiled.length === 0)
|
|
70
|
+
return () => false;
|
|
71
|
+
return (path) => {
|
|
72
|
+
const s = toSegments(path);
|
|
73
|
+
return compiled.some((p) => p.length === 1
|
|
74
|
+
? s.includes(p[0])
|
|
75
|
+
: p.length <= s.length &&
|
|
76
|
+
p.every((seg, i) => (seg === "*" ? /^\d+$/.test(s[i]) : seg === s[i])));
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const isLeaf = (v) => v === null ||
|
|
80
|
+
typeof v === "string" ||
|
|
81
|
+
typeof v === "number" ||
|
|
82
|
+
typeof v === "boolean" ||
|
|
83
|
+
isMasked(v);
|
|
84
|
+
const isEmptyLeaf = (v) => v === null || v === "";
|
|
85
|
+
const isPlainObject = (v) => {
|
|
86
|
+
const proto = Object.getPrototypeOf(v);
|
|
87
|
+
return proto === Object.prototype || proto === null;
|
|
88
|
+
};
|
|
89
|
+
const clipCell = (v, maxText) => {
|
|
90
|
+
if (typeof v === "string")
|
|
91
|
+
return cleanValue(v, maxText);
|
|
92
|
+
if (typeof v === "number" && !Number.isFinite(v))
|
|
93
|
+
return String(v);
|
|
94
|
+
if (isMasked(v))
|
|
95
|
+
return { masked: true, display: cleanValue(v.display, MAX_MASKED) };
|
|
96
|
+
return v;
|
|
97
|
+
};
|
|
98
|
+
const hasValue = (node) => node.kind === "field"
|
|
99
|
+
? !isEmptyLeaf(node.value)
|
|
100
|
+
: node.kind === "list"
|
|
101
|
+
? node.items.length > 0
|
|
102
|
+
: node.nodes.some(hasValue);
|
|
103
|
+
/** Drop what has no value (an empty field or list, a group with nothing in it), keep the shape of the rest. */
|
|
104
|
+
function prune(nodes) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const n of nodes) {
|
|
107
|
+
if (n.kind === "group") {
|
|
108
|
+
const inner = prune(n.nodes);
|
|
109
|
+
if (inner.length > 0)
|
|
110
|
+
out.push({ ...n, nodes: inner });
|
|
111
|
+
}
|
|
112
|
+
else if (hasValue(n))
|
|
113
|
+
out.push(n);
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
const isStrictAncestor = (ancestor, path) => path.length > ancestor.length &&
|
|
118
|
+
path.startsWith(ancestor) &&
|
|
119
|
+
(path[ancestor.length] === "." || path[ancestor.length] === "[");
|
|
120
|
+
/**
|
|
121
|
+
* The record as labelled nodes. Own enumerable keys only; `__proto__`, `constructor`, `prototype` and keys starting with `_`
|
|
122
|
+
* (internal bookkeeping) are skipped. Objects become groups, a list of scalars a chip list, a list of objects numbered groups, a
|
|
123
|
+
* Date its ISO text, anything that is not plain data a placeholder. Empty values are dropped unless the card's `focus` named them.
|
|
124
|
+
*
|
|
125
|
+
* `focus` paths are resolved FIRST with `lookupPath`, each on its own budget, and kept out of the main walk: the agent's pointer
|
|
126
|
+
* survives a record that is otherwise capped.
|
|
127
|
+
*/
|
|
128
|
+
export function buildRecordView(record, { focus, labels, itemLabel = (n) => fmt(DEFAULT_INSPECTOR_RECORD_COPY.item, { n }), trail = (parent, child) => fmt(DEFAULT_INSPECTOR_RECORD_COPY.trail, { parent, child }), notShown = DEFAULT_INSPECTOR_RECORD_COPY.notShown, hidden, } = {}) {
|
|
129
|
+
const empty = { highlighted: [], nodes: [], omitted: 0, isEmpty: true };
|
|
130
|
+
if (typeof record !== "object" || record === null || Array.isArray(record) || isMasked(record))
|
|
131
|
+
return empty;
|
|
132
|
+
const labelFor = (path, key) => {
|
|
133
|
+
const custom = labels && Object.hasOwn(labels, path)
|
|
134
|
+
? labels[path]
|
|
135
|
+
: labels && Object.hasOwn(labels, key)
|
|
136
|
+
? labels[key]
|
|
137
|
+
: undefined;
|
|
138
|
+
return {
|
|
139
|
+
text: cleanInline(custom ?? humanizeKey(key), MAX_LABEL, true) ?? "-",
|
|
140
|
+
data: custom === undefined,
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const itemLabelFor = (n) => ({
|
|
144
|
+
text: cleanInline(itemLabel(n), MAX_LABEL, true) ?? "-",
|
|
145
|
+
data: false,
|
|
146
|
+
});
|
|
147
|
+
const walkObject = (obj, base, depth, w, skip) => {
|
|
148
|
+
const out = [];
|
|
149
|
+
const keys = Object.keys(obj);
|
|
150
|
+
for (let i = 0; i < keys.length; i++) {
|
|
151
|
+
if (w.budget <= 0) {
|
|
152
|
+
w.omitted += keys.length - i;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
const key = keys[i];
|
|
156
|
+
if (UNSAFE_KEYS.has(key) || key.startsWith("_"))
|
|
157
|
+
continue;
|
|
158
|
+
const path = base === "" ? key : `${base}.${key}`;
|
|
159
|
+
const node = walkValue(obj[key], path, labelFor(path, key), depth, w, skip);
|
|
160
|
+
if (node)
|
|
161
|
+
out.push(node);
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
};
|
|
165
|
+
const walkValue = (value, path, label, depth, w, skip) => {
|
|
166
|
+
if (value === undefined || typeof value === "function" || typeof value === "symbol")
|
|
167
|
+
return null;
|
|
168
|
+
if (skip(path))
|
|
169
|
+
return null;
|
|
170
|
+
if (w.budget <= 0) {
|
|
171
|
+
w.omitted += 1;
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
w.budget -= 1;
|
|
175
|
+
const field = (v) => ({
|
|
176
|
+
kind: "field",
|
|
177
|
+
path,
|
|
178
|
+
label: label.text,
|
|
179
|
+
dataLabel: label.data,
|
|
180
|
+
value: v,
|
|
181
|
+
});
|
|
182
|
+
if (isLeaf(value))
|
|
183
|
+
return field(clipCell(value, MAX_TEXT));
|
|
184
|
+
if (typeof value === "bigint")
|
|
185
|
+
return field(String(value));
|
|
186
|
+
if (typeof value !== "object")
|
|
187
|
+
return null;
|
|
188
|
+
if (value instanceof Date)
|
|
189
|
+
return field(Number.isNaN(value.getTime()) ? notShown : value.toISOString());
|
|
190
|
+
if (Array.isArray(value)) {
|
|
191
|
+
const shown = value.slice(0, MAX_LIST);
|
|
192
|
+
w.omitted += value.length - shown.length;
|
|
193
|
+
if (shown.every(isLeaf)) {
|
|
194
|
+
// Every item is a node of its own: a list cannot dodge the cap by being one field.
|
|
195
|
+
w.budget -= shown.length;
|
|
196
|
+
return {
|
|
197
|
+
kind: "list",
|
|
198
|
+
path,
|
|
199
|
+
label: label.text,
|
|
200
|
+
dataLabel: label.data,
|
|
201
|
+
items: shown.map((i) => clipCell(i, MAX_CHIP)),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (depth >= MAX_DEPTH) {
|
|
205
|
+
w.omitted += 1;
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const nodes = [];
|
|
209
|
+
shown.forEach((item, i) => {
|
|
210
|
+
const node = walkValue(item, `${path}[${i}]`, itemLabelFor(i + 1), depth + 1, w, skip);
|
|
211
|
+
if (node)
|
|
212
|
+
nodes.push(node);
|
|
213
|
+
});
|
|
214
|
+
return { kind: "group", path, label: label.text, dataLabel: label.data, nodes };
|
|
215
|
+
}
|
|
216
|
+
if (!isPlainObject(value))
|
|
217
|
+
return field(notShown);
|
|
218
|
+
if (depth >= MAX_DEPTH) {
|
|
219
|
+
w.omitted += 1;
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
kind: "group",
|
|
224
|
+
path,
|
|
225
|
+
label: label.text,
|
|
226
|
+
dataLabel: label.data,
|
|
227
|
+
nodes: walkObject(value, path, depth + 1, w, skip),
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
const isHidden = (path) => hidden?.(path) === true;
|
|
231
|
+
// 1. The pointer's fields, on their own budget, outermost first.
|
|
232
|
+
const focused = (focus ?? []).flatMap((p) => {
|
|
233
|
+
const segments = p.split(/[.[\]]/).filter((s) => s !== "");
|
|
234
|
+
// `_` keys are internal bookkeeping: the main walk skips them, so a pointer cannot lift one either.
|
|
235
|
+
if (segments.length === 0 || segments.some((seg) => seg.startsWith("_")))
|
|
236
|
+
return [];
|
|
237
|
+
const found = lookupPath(record, p);
|
|
238
|
+
if (!found.found)
|
|
239
|
+
return [];
|
|
240
|
+
let cur = record;
|
|
241
|
+
let path = "";
|
|
242
|
+
const parts = [];
|
|
243
|
+
for (const seg of segments) {
|
|
244
|
+
if (Array.isArray(cur)) {
|
|
245
|
+
path += `[${seg}]`;
|
|
246
|
+
parts.push(itemLabelFor(Number(seg) + 1));
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
path = path === "" ? seg : `${path}.${seg}`;
|
|
250
|
+
parts.push(labelFor(path, seg));
|
|
251
|
+
}
|
|
252
|
+
cur = cur[seg];
|
|
253
|
+
}
|
|
254
|
+
const last = parts[parts.length - 1];
|
|
255
|
+
const text = parts.map((x) => x.text).reduce((a, b) => trail(a, b));
|
|
256
|
+
return [{ path, label: { text, data: last.data }, value: found.value }];
|
|
257
|
+
});
|
|
258
|
+
const outermost = focused.filter((f, i) => !isHidden(f.path) &&
|
|
259
|
+
focused.findIndex((o) => o.path === f.path) === i &&
|
|
260
|
+
!focused.some((o) => isStrictAncestor(o.path, f.path)));
|
|
261
|
+
const focusWalk = { budget: MAX_NODES, omitted: 0 };
|
|
262
|
+
const lifted = outermost.flatMap((f) => {
|
|
263
|
+
const node = walkValue(f.value, f.path, f.label, 0, focusWalk, isHidden);
|
|
264
|
+
return node ? [node] : [];
|
|
265
|
+
});
|
|
266
|
+
// A focused field or list is kept even when empty (the agent pointed at it); a focused group keeps only what has a value.
|
|
267
|
+
const highlighted = lifted.flatMap((n) => {
|
|
268
|
+
if (n.kind !== "group")
|
|
269
|
+
return [n];
|
|
270
|
+
const inner = prune(n.nodes);
|
|
271
|
+
return inner.length > 0 ? [{ ...n, nodes: inner }] : [];
|
|
272
|
+
});
|
|
273
|
+
// 2. Everything else.
|
|
274
|
+
const focusedPaths = new Set(outermost.map((f) => f.path));
|
|
275
|
+
const mainWalk = { budget: MAX_NODES, omitted: 0 };
|
|
276
|
+
const nodes = prune(walkObject(record, "", 0, mainWalk, (path) => isHidden(path) || focusedPaths.has(path)));
|
|
277
|
+
return {
|
|
278
|
+
highlighted,
|
|
279
|
+
nodes,
|
|
280
|
+
omitted: mainWalk.omitted + focusWalk.omitted,
|
|
281
|
+
isEmpty: highlighted.length === 0 && nodes.length === 0,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/** What a value reads as: the host's text, else a word for a boolean, else the value; quoted when someone else wrote it. */
|
|
285
|
+
function display(path, v, p) {
|
|
286
|
+
if (isMasked(v))
|
|
287
|
+
return v;
|
|
288
|
+
const formatted = p.formatValue?.(path, v);
|
|
289
|
+
const base = formatted !== undefined
|
|
290
|
+
? cleanValue(formatted, MAX_TEXT)
|
|
291
|
+
: typeof v === "boolean"
|
|
292
|
+
? v
|
|
293
|
+
? p.copy.yes
|
|
294
|
+
: p.copy.no
|
|
295
|
+
: v;
|
|
296
|
+
return typeof base === "string" && p.isThirdParty(path) ? quoteText(base, p.copy.quote) : base;
|
|
297
|
+
}
|
|
298
|
+
function fieldValue(node, p, focused) {
|
|
299
|
+
if (isEmptyLeaf(node.value))
|
|
300
|
+
return focused ? p.copy.notSet : undefined;
|
|
301
|
+
return display(node.path, node.value, p);
|
|
302
|
+
}
|
|
303
|
+
/** A stable key per list item without using its index: the item's text, numbered when the same text repeats. */
|
|
304
|
+
function keyed(items) {
|
|
305
|
+
const seen = new Map();
|
|
306
|
+
return items.map((item) => {
|
|
307
|
+
const base = isMasked(item) ? `masked:${item.display}` : String(item);
|
|
308
|
+
const n = seen.get(base) ?? 0;
|
|
309
|
+
seen.set(base, n + 1);
|
|
310
|
+
return { key: `${base}#${n}`, item };
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/** The record path of the object a node sits in: `rounds[1].note` is in `rounds[1]`, a top-level key in `""`. */
|
|
314
|
+
const parentPath = (path) => {
|
|
315
|
+
const i = Math.max(path.lastIndexOf("."), path.lastIndexOf("["));
|
|
316
|
+
return i <= 0 ? "" : path.slice(0, i);
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* A node's label. A label made from a key of the record is data, and inside text someone else wrote (a node strictly below a
|
|
320
|
+
* third-party path) the key is theirs too: it renders quoted, like the value. A label the host supplied is the app's own word.
|
|
321
|
+
*/
|
|
322
|
+
function shownLabel(n, p) {
|
|
323
|
+
return n.dataLabel && p.isThirdParty(parentPath(n.path))
|
|
324
|
+
? quoteText(n.label, p.copy.quote)
|
|
325
|
+
: n.label;
|
|
326
|
+
}
|
|
327
|
+
const wide = (v) => typeof v === "string" && v.length > WIDE_TEXT;
|
|
328
|
+
function Nodes({ nodes, level, focused, p, }) {
|
|
329
|
+
const flat = nodes.filter((n) => n.kind !== "group");
|
|
330
|
+
const groups = nodes.filter((n) => n.kind === "group");
|
|
331
|
+
const Heading = `h${level}`;
|
|
332
|
+
return (_jsxs(_Fragment, { children: [flat.length > 0 && (_jsx(AgentFieldGrid, { children: flat.map((n) => {
|
|
333
|
+
if (n.kind === "list")
|
|
334
|
+
return (_jsxs("div", { className: "col-span-2 flex min-w-0 flex-col gap-1 @sm:col-span-3", children: [_jsx("dt", { className: "text-xs/4 text-muted-foreground", children: shownLabel(n, p) }), _jsx("dd", { children: _jsx("ul", { className: "flex flex-wrap gap-2", children: keyed(n.items).map(({ key, item }) => (_jsx("li", { className: "max-w-full", children: _jsx(AgentChip, { className: "max-w-full rounded-lg text-left wrap-anywhere", children: _jsx(MaskedValue, { value: display(n.path, item, p), copy: p.maskedCopy }) }) }, key))) }) })] }, n.path));
|
|
335
|
+
if (n.kind !== "field")
|
|
336
|
+
return null;
|
|
337
|
+
const value = fieldValue(n, p, focused);
|
|
338
|
+
return (_jsx(AgentField, { label: shownLabel(n, p), value: value, wide: wide(value), maskedCopy: p.maskedCopy }, n.path));
|
|
339
|
+
}) })), groups.map((g) => (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Heading, { className: "text-xs/4 font-medium text-muted-foreground", children: shownLabel(g, p) }), _jsx(Nodes, { nodes: g.nodes, level: Math.min(level + 1, 6), focused: focused, p: p })] }, g.path)))] }));
|
|
340
|
+
}
|
|
341
|
+
/** The labelled fields of a record: the highlighted ones first, then everything else. Presentational; `buildRecordView` decides what is in it. */
|
|
342
|
+
export function AgentInspectorRecord(p) {
|
|
343
|
+
const { view, copy, headingId } = p;
|
|
344
|
+
return (_jsxs(Fragment, { children: [view.highlighted.length > 0 && (_jsxs("section", { "aria-labelledby": headingId("highlighted"), className: "flex flex-col gap-2 rounded-xl bg-muted/50 p-3", children: [_jsx("h3", { id: headingId("highlighted"), className: "text-xs/4 font-medium text-muted-foreground", children: copy.highlighted }), _jsx(Nodes, { nodes: view.highlighted, level: 4, focused: true, p: p })] })), view.nodes.length > 0 && (_jsxs("section", { "aria-labelledby": headingId("details"), className: "flex flex-col gap-3", children: [_jsx("h3", { id: headingId("details"), className: "text-xs/4 font-medium text-muted-foreground", children: copy.details }), _jsx(Nodes, { nodes: view.nodes, level: 4, focused: false, p: p })] })), view.omitted > 0 && _jsx("p", { className: "text-xs/4 text-muted-foreground", children: copy.truncated })] }));
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=inspector-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector-record.js","sourceRoot":"","sources":["../../../src/agent/role-cards/inspector-record.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAkB,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAwB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA+BxD,MAAM,CAAC,MAAM,6BAA6B,GAA6B;I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cellarnode/agent-cards/zod4";
|
|
3
|
+
import { type MaskedValueCopy } from "../masked-value.js";
|
|
4
|
+
import type { CellValue } from "../schema.js";
|
|
5
|
+
import { type AgentErrorCopy } from "../states.js";
|
|
6
|
+
import { type AgentCardActionsCopy, type AgentRoleCardHostProps } from "./card-kit.js";
|
|
7
|
+
import { type AgentToolCatalog, type DetailKind } from "./host-contract.js";
|
|
8
|
+
import { type AgentInspectorRecordCopy } from "./inspector-record.js";
|
|
9
|
+
export interface AgentInspectorViewCopy extends AgentInspectorRecordCopy {
|
|
10
|
+
/** What the surface is, for a screen reader. */
|
|
11
|
+
description: string;
|
|
12
|
+
/** What the record's kind is called, by `detail.kind`. */
|
|
13
|
+
kinds: Record<DetailKind, string>;
|
|
14
|
+
/** The accessible name of the scrollable body. */
|
|
15
|
+
detailsRegion: string;
|
|
16
|
+
loading: string;
|
|
17
|
+
emptyHeadline: string;
|
|
18
|
+
emptyBody: string;
|
|
19
|
+
missingHeadline: string;
|
|
20
|
+
missingBody: string;
|
|
21
|
+
/** A clicked action the catalog no longer accepts. */
|
|
22
|
+
actionRefused: string;
|
|
23
|
+
matchScore: string;
|
|
24
|
+
declined: string;
|
|
25
|
+
}
|
|
26
|
+
declare const DEFAULT_COPY: AgentInspectorViewCopy;
|
|
27
|
+
export { DEFAULT_COPY as DEFAULT_INSPECTOR_VIEW_COPY };
|
|
28
|
+
/** The error banner says what failed to load (the record), not what failed in the conversation. */
|
|
29
|
+
declare const DEFAULT_ERROR_COPY: AgentErrorCopy;
|
|
30
|
+
export { DEFAULT_ERROR_COPY as DEFAULT_INSPECTOR_ERROR_COPY };
|
|
31
|
+
export type AgentInspectorViewCopyOverride = Partial<Omit<AgentInspectorViewCopy, "kinds">> & {
|
|
32
|
+
/** Merged over the defaults one kind at a time. */
|
|
33
|
+
kinds?: Partial<AgentInspectorViewCopy["kinds"]>;
|
|
34
|
+
/** The error banner's strings (`AgentError`'s copy). */
|
|
35
|
+
errorCopy?: Partial<AgentErrorCopy>;
|
|
36
|
+
/** The action row's strings (`AgentCardActions`' copy). */
|
|
37
|
+
actionsCopy?: Partial<AgentCardActionsCopy>;
|
|
38
|
+
/** The mask pill's strings. */
|
|
39
|
+
maskedCopy?: Partial<MaskedValueCopy>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The record the card's `detail` names, as the HOST fetched it. The view never fetches: it takes the reduced state, so the host
|
|
43
|
+
* keeps its own cache, auth and retry. `for` is the pointer the record was fetched FOR: a `ready` state for another record than the
|
|
44
|
+
* open card's `detail` (the host switched cards and the fetch has not caught up) shows as loading, never as the wrong record.
|
|
45
|
+
* `record` is whatever the host's authenticated read returned (masked cells included); `null` means the host looked and found nothing.
|
|
46
|
+
*/
|
|
47
|
+
export type AgentInspectorRecordState = {
|
|
48
|
+
status: "loading";
|
|
49
|
+
} | {
|
|
50
|
+
status: "error";
|
|
51
|
+
kind?: "generic" | "authExpired" | "unavailable";
|
|
52
|
+
} | {
|
|
53
|
+
status: "ready";
|
|
54
|
+
for: Pick<CardDetail, "kind" | "id">;
|
|
55
|
+
record: unknown;
|
|
56
|
+
};
|
|
57
|
+
/** What the view handed to the host: a confirm plan (`action`), an Apply, Edit before applying or Reject, or a followed link. */
|
|
58
|
+
export type AgentInspectorHandOff = "action" | "apply" | "edit" | "reject" | "link";
|
|
59
|
+
export interface AgentInspectorHeadingParts {
|
|
60
|
+
/** The record's kind ("Offer"); absent when the title already is it. */
|
|
61
|
+
eyebrow?: string;
|
|
62
|
+
/** The record's name, already rendered (masked cells stay masked). */
|
|
63
|
+
title: ReactNode;
|
|
64
|
+
/** What the surface is, for a screen reader. */
|
|
65
|
+
description: string;
|
|
66
|
+
/** The match score and the like, already rendered. */
|
|
67
|
+
aside?: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
type Subject = Pick<CardDetail, "kind" | "id">;
|
|
70
|
+
/**
|
|
71
|
+
* Text that was written by someone else, by record path, per record kind. It renders as quoted text, never as the app's own words
|
|
72
|
+
* (agent-cards README, "Third-party text"). A path counts when it OR any ancestor is listed, so `counterparty` covers
|
|
73
|
+
* `counterparty.name`; a bare name matches at any depth, a longer path is anchored at the root, and `[]` is any list position.
|
|
74
|
+
* `thirdPartyPaths` EXTENDS these.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DEFAULT_THIRD_PARTY_PATHS: Readonly<Partial<Record<DetailKind, readonly string[]>>>;
|
|
77
|
+
/** What the view needs from the card, after the same read a card gets (`readRoleCard`). */
|
|
78
|
+
interface InspectorCard {
|
|
79
|
+
detail: CardDetail;
|
|
80
|
+
/** The record THIS card is about; a proposal for any other record is refused at Apply. */
|
|
81
|
+
subject: Subject;
|
|
82
|
+
/** The card's own headline and the record key it stands for; absent when the card carries none. */
|
|
83
|
+
title?: CellValue;
|
|
84
|
+
titleKey: string;
|
|
85
|
+
score?: number;
|
|
86
|
+
declined?: boolean;
|
|
87
|
+
actions?: CardAction[];
|
|
88
|
+
proposal?: CardProposal;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `null` for an unknown type, data that fails the schema, a card whose `detail` disagrees with it, or a card with no `detail`
|
|
92
|
+
* pointer: there is nothing to inspect. Everything else is what `readRoleCard` made safe.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readInspectorCard(cardType: string, data: unknown, catalog: AgentToolCatalog | undefined): InspectorCard | null;
|
|
95
|
+
/** The hook the drawer and the view share, so one card is read once per change of its data. */
|
|
96
|
+
export declare function useInspectorCard(cardType: string, data: unknown, catalog: AgentToolCatalog | undefined): InspectorCard | null;
|
|
97
|
+
export interface AgentInspectorViewProps extends Omit<AgentRoleCardHostProps, "onOpenDetail"> {
|
|
98
|
+
/** The card that is being inspected: its `cardType` and the data the agent sent. Read exactly like `renderRoleAgentCard` reads it. */
|
|
99
|
+
cardType: string;
|
|
100
|
+
data: unknown;
|
|
101
|
+
record: AgentInspectorRecordState;
|
|
102
|
+
/** The error state's one action, as `AgentError` defines it: retry for a generic or unavailable error, sign in for an expired session. */
|
|
103
|
+
onErrorAction?: () => void;
|
|
104
|
+
/** Labels for record fields, by dotted path first and by bare key second. Anything else is humanised from the key. */
|
|
105
|
+
fieldLabels?: Readonly<Record<string, string>>;
|
|
106
|
+
/** The same, for one kind of record only; wins over `fieldLabels`. */
|
|
107
|
+
fieldLabelsByKind?: Readonly<Partial<Record<DetailKind, Readonly<Record<string, string>>>>>;
|
|
108
|
+
/** More record paths whose text someone else wrote, on top of `DEFAULT_THIRD_PARTY_PATHS` for the record's kind. */
|
|
109
|
+
thirdPartyPaths?: readonly string[];
|
|
110
|
+
/** Record paths to keep out of the view (internal ids, cost prices). Same matching as `thirdPartyPaths`. */
|
|
111
|
+
hiddenPaths?: readonly string[];
|
|
112
|
+
/** The host's own display text for a value (a date, a currency), or `undefined` for the default. Never called for a masked cell. */
|
|
113
|
+
formatValue?: (path: string, value: CellValue, kind: DetailKind) => string | undefined;
|
|
114
|
+
/** Replace the heading block. The drawer puts its dialog title and description here. */
|
|
115
|
+
heading?: (parts: AgentInspectorHeadingParts) => ReactNode;
|
|
116
|
+
/** Called after the view handed something to the host (a confirm plan, an applied, edited or rejected proposal, a followed link). */
|
|
117
|
+
onHandOff?: (what: AgentInspectorHandOff) => void;
|
|
118
|
+
/**
|
|
119
|
+
* `false` once the surface that holds the view is closing: a hand-off that resolves late (an Apply whose re-fetch finishes after
|
|
120
|
+
* the person closed it) is dropped instead of reaching the host. Default `true`.
|
|
121
|
+
*/
|
|
122
|
+
active?: boolean;
|
|
123
|
+
copy?: AgentInspectorViewCopyOverride;
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @internal The inspector (CEL-2487): the full record behind a role card's `detail` pointer, the card's typed `actions[]` and its
|
|
128
|
+
* `proposal`, with no dialog parts, so a drawer (`AgentInspectorDrawer`) or the tier-3 canvas can hold it. It owns the content and
|
|
129
|
+
* the host contract; the surface owns the chrome and what a hand-off does to it (`onHandOff`).
|
|
130
|
+
*
|
|
131
|
+
* Pure props in, events out. It never fetches (the host passes `record`) and never runs a tool. Everything that writes goes through
|
|
132
|
+
* the same host contract as the inline card: `AgentCardActions` hands the host a catalog-built confirm plan, never the model's
|
|
133
|
+
* action; `AgentProposalDiff` re-fetches the record and hands over `planProposalApply`'s result. A refused action stays in the view
|
|
134
|
+
* and says so. Renders nothing for a card it cannot inspect (see `readInspectorCard`).
|
|
135
|
+
*/
|
|
136
|
+
export declare function AgentInspectorView({ cardType, data, record, onErrorAction, fieldLabels, fieldLabelsByKind, thirdPartyPaths, hiddenPaths, formatValue, heading, onHandOff, active, copy, className, ...host }: AgentInspectorViewProps): import("react/jsx-runtime").JSX.Element | null;
|
|
137
|
+
//# sourceMappingURL=inspector-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector-view.d.ts","sourceRoot":"","sources":["../../../src/agent/role-cards/inspector-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAKzF,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAML,KAAK,wBAAwB,EAC9B,MAAM,oBAAoB,CAAC;AAK5B,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB;IACtE,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE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