@box-kite/react 2.0.1 → 2.1.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 (100) hide show
  1. package/.claude/rules/box-kite-rules.md +16 -0
  2. package/.claude/skills/box-kite/SKILL.md +16 -0
  3. package/.claude/skills/box-kite/references/components.md +8 -3
  4. package/.claude/skills/box-kite/references/patterns.md +23 -0
  5. package/.cursor/rules/box-kite.mdc +16 -0
  6. package/AGENTS.md +19 -0
  7. package/BOX_AI_CONTEXT.md +562 -1
  8. package/BOX_KITE_AI_CONTEXT.md +562 -1
  9. package/README.md +39 -7
  10. package/catalog.cjs +1 -0
  11. package/catalog.d.ts +8 -0
  12. package/catalog.mjs +2333 -0
  13. package/client.cjs +1 -1
  14. package/client.mjs +40 -42
  15. package/components/agent.cjs +1 -0
  16. package/components/agent.d.ts +215 -0
  17. package/components/agent.mjs +405 -0
  18. package/components/chart.d.ts +1 -0
  19. package/components/dashboard.cjs +1 -0
  20. package/components/dashboard.d.ts +121 -0
  21. package/components/dashboard.mjs +690 -0
  22. package/components/dataGrid/components/dataGridBody.d.ts +2 -1
  23. package/components/dataGrid/components/dataGridDetailRow.d.ts +13 -2
  24. package/components/dataGrid/components/dataGridGroupRow.d.ts +13 -2
  25. package/components/dataGrid/components/dataGridRow.d.ts +13 -2
  26. package/components/dataGrid/contracts/dataGridContract.d.ts +66 -2
  27. package/components/dataGrid/models/cellModel.d.ts +3 -0
  28. package/components/dataGrid/models/editModel.d.ts +27 -0
  29. package/components/dataGrid/models/exportModel.d.ts +2 -1
  30. package/components/dataGrid/models/gridModel.d.ts +3 -0
  31. package/components/dataGrid/models/rangeModel.d.ts +119 -0
  32. package/components/dataGrid/models/viewportModel.d.ts +23 -2
  33. package/components/dataGrid/useGridNavigation.d.ts +10 -2
  34. package/components/dataGrid.cjs +4 -1
  35. package/components/dataGrid.d.ts +3 -0
  36. package/components/dataGrid.mjs +1056 -765
  37. package/components/markdown.cjs +1 -0
  38. package/components/markdown.d.ts +55 -0
  39. package/components/markdown.mjs +179 -0
  40. package/components/semantics.d.ts +29 -29
  41. package/components/skeleton.cjs +1 -0
  42. package/components/skeleton.d.ts +34 -0
  43. package/components/skeleton.mjs +25 -0
  44. package/dashboardSchema.cjs +1 -0
  45. package/dashboardSchema.mjs +78 -0
  46. package/docs/a11y.md +2 -3
  47. package/docs/catalog.md +451 -0
  48. package/docs/components.md +4 -0
  49. package/docs/index.md +3 -0
  50. package/docs/interop.md +237 -0
  51. package/docs/mcp.md +69 -0
  52. package/docs/props.md +3 -3
  53. package/interop.cjs +1 -0
  54. package/interop.d.ts +51 -0
  55. package/interop.mjs +454 -0
  56. package/mcp/src/data.d.ts +88 -0
  57. package/mcp/src/data.test.d.ts +1 -0
  58. package/mcp/src/engine.d.ts +23 -0
  59. package/mcp/src/index.d.ts +1 -0
  60. package/mcp/src/search.d.ts +26 -0
  61. package/mcp/src/search.test.d.ts +1 -0
  62. package/mcp/src/server.d.ts +18 -0
  63. package/mcp/src/server.test.d.ts +1 -0
  64. package/mcp/src/styles.d.ts +27 -0
  65. package/mcp/src/styles.test.d.ts +1 -0
  66. package/mcp/src/tools.d.ts +18 -0
  67. package/mcp/src/vocabulary.d.ts +41 -0
  68. package/package.json +124 -17
  69. package/react/spec/renderSpec.d.ts +51 -0
  70. package/react/spec/specBoundary.d.ts +25 -0
  71. package/react/spec/specRegistry.d.ts +42 -0
  72. package/react/spec/specRenderer.d.ts +10 -0
  73. package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +22 -0
  74. package/registry/blocks/dashboard-shell/dashboard-stats.d.ts +13 -0
  75. package/registry/blocks/data-grid/invoice-rows.d.ts +15 -0
  76. package/registry/blocks/data-grid/invoices-grid.d.ts +1 -0
  77. package/registry/blocks/settings-form/settings-form.d.ts +17 -0
  78. package/spec.cjs +2 -0
  79. package/spec.d.ts +12 -0
  80. package/spec.mjs +382 -0
  81. package/specData.cjs +1 -0
  82. package/specData.mjs +69 -0
  83. package/specDefs.cjs +1 -0
  84. package/specDefs.mjs +33 -0
  85. package/specSchema.cjs +1 -0
  86. package/specSchema.mjs +88 -0
  87. package/utils/agent/agentUtils.d.ts +81 -0
  88. package/utils/catalog/catalogContracts.d.ts +19 -0
  89. package/utils/catalog/catalogManifest.d.ts +8 -0
  90. package/utils/dashboard/dashboardSchema.d.ts +18 -0
  91. package/utils/dashboard/dashboardUtils.d.ts +97 -0
  92. package/utils/interop/a2uiInterop.d.ts +82 -0
  93. package/utils/interop/assistantUiInterop.d.ts +34 -0
  94. package/utils/interop/toolInterop.d.ts +30 -0
  95. package/utils/spec/specData.d.ts +19 -0
  96. package/utils/spec/specDefs.d.ts +11 -0
  97. package/utils/spec/specProps.d.ts +15 -0
  98. package/utils/spec/specSchema.d.ts +23 -0
  99. package/utils/spec/specTypes.d.ts +71 -0
  100. package/utils/spec/specValidate.d.ts +10 -0
package/interop.mjs ADDED
@@ -0,0 +1,454 @@
1
+ import { t as e } from "./specDefs.mjs";
2
+ import { t } from "./specData.mjs";
3
+ //#region src/utils/interop/toolInterop.ts
4
+ var n;
5
+ (function(e) {
6
+ let t = {
7
+ "input-streaming": "pending",
8
+ "input-available": "running",
9
+ "output-available": "success",
10
+ "output-error": "error",
11
+ "approval-requested": "approval",
12
+ "approval-responded": "approval"
13
+ }, n = {
14
+ inProgress: "pending",
15
+ executing: "running",
16
+ complete: "success"
17
+ }, r = {
18
+ running: "running",
19
+ complete: "success",
20
+ incomplete: "error",
21
+ "requires-action": "pending"
22
+ };
23
+ function i(e) {
24
+ return typeof e == "object" && e && !Array.isArray(e) ? e : null;
25
+ }
26
+ function a(e) {
27
+ return typeof e == "string" && e !== "" ? e : void 0;
28
+ }
29
+ function o(e) {
30
+ return e.input ?? e.args ?? e.argsText;
31
+ }
32
+ function s(e) {
33
+ return e.output ?? e.result;
34
+ }
35
+ function c(e) {
36
+ let c = i(e);
37
+ if (c === null) return null;
38
+ let l = o(c), u = s(c), d = a(c.state);
39
+ if (d !== void 0 && d in t) {
40
+ let e = t[d];
41
+ if (e !== "approval") return {
42
+ kind: "call",
43
+ status: e,
44
+ decision: null,
45
+ input: l,
46
+ output: u,
47
+ error: a(c.errorText)
48
+ };
49
+ let n = i(c.approval)?.approved;
50
+ return {
51
+ kind: "approval",
52
+ status: "pending",
53
+ decision: typeof n == "boolean" ? n ? "approved" : "rejected" : null,
54
+ input: l
55
+ };
56
+ }
57
+ let f = c.status, p = i(f);
58
+ if (p !== null) {
59
+ let e = a(p.type) ?? "";
60
+ return {
61
+ kind: e === "requires-action" ? "approval" : "call",
62
+ status: r[e] ?? "pending",
63
+ decision: null,
64
+ input: l,
65
+ output: u,
66
+ error: a(i(p.error)?.message) ?? a(p.error)
67
+ };
68
+ }
69
+ let m = a(f);
70
+ if (m !== void 0 && m in n) {
71
+ let e = typeof c.respond == "function" && m === "executing";
72
+ return {
73
+ kind: e ? "approval" : "call",
74
+ status: e ? "pending" : n[m],
75
+ decision: null,
76
+ input: l,
77
+ output: u
78
+ };
79
+ }
80
+ return null;
81
+ }
82
+ e.toolPart = c;
83
+ function l(e, t) {
84
+ let n = i(t), r = a(n?.toolCallId);
85
+ if (n === null || r === void 0) return e;
86
+ let o = a(n.type), s = e[r] ?? {
87
+ kind: "call",
88
+ status: "pending",
89
+ decision: null
90
+ };
91
+ return o === "TOOL_CALL_START" ? {
92
+ ...e,
93
+ [r]: {
94
+ ...s,
95
+ kind: "call",
96
+ status: "pending"
97
+ }
98
+ } : o === "TOOL_CALL_ARGS" ? {
99
+ ...e,
100
+ [r]: {
101
+ ...s,
102
+ status: "pending"
103
+ }
104
+ } : o === "TOOL_CALL_END" ? {
105
+ ...e,
106
+ [r]: {
107
+ ...s,
108
+ status: "running"
109
+ }
110
+ } : o === "TOOL_CALL_RESULT" ? {
111
+ ...e,
112
+ [r]: {
113
+ ...s,
114
+ status: "success",
115
+ output: n.content ?? n.result
116
+ }
117
+ } : o === "INTERRUPT" || o === "RUN_INTERRUPT" ? {
118
+ ...e,
119
+ [r]: {
120
+ ...s,
121
+ kind: "approval",
122
+ status: "pending"
123
+ }
124
+ } : o === "RUN_ERROR" ? {
125
+ ...e,
126
+ [r]: {
127
+ ...s,
128
+ status: "error",
129
+ error: a(n.message)
130
+ }
131
+ } : e;
132
+ }
133
+ e.applyEvent = l;
134
+ })(n ||= {});
135
+ var r = n, i;
136
+ (function(t) {
137
+ let n = t.ROOT_ID = "root", r = t.DEFAULT_SURFACE = "main";
138
+ t.EMPTY = {
139
+ surfaces: {},
140
+ order: []
141
+ };
142
+ function i(e) {
143
+ return typeof e == "object" && e && !Array.isArray(e) ? e : null;
144
+ }
145
+ function a(e) {
146
+ return typeof e == "string" && e !== "" ? e : void 0;
147
+ }
148
+ function o(e) {
149
+ return {
150
+ id: e,
151
+ components: {},
152
+ data: {}
153
+ };
154
+ }
155
+ function s(e, t, n) {
156
+ return {
157
+ surfaces: {
158
+ ...e.surfaces,
159
+ [t]: n
160
+ },
161
+ order: e.order.includes(t) ? e.order : [...e.order, t]
162
+ };
163
+ }
164
+ function c(e) {
165
+ let t = i(e), n = a(t?.id);
166
+ if (t === null || n === void 0) return null;
167
+ let r = t.component;
168
+ if (typeof r == "string") {
169
+ let { id: e, component: i, ...a } = t;
170
+ return {
171
+ id: n,
172
+ component: r,
173
+ ...a
174
+ };
175
+ }
176
+ let o = i(r), [s] = o ? Object.keys(o) : [];
177
+ return o === null || s === void 0 ? null : {
178
+ id: n,
179
+ component: s,
180
+ ...i(o[s]) ?? {}
181
+ };
182
+ }
183
+ function l(e) {
184
+ return e.replace(/~1/g, "/").replace(/~0/g, "~");
185
+ }
186
+ function u(e) {
187
+ return e === void 0 || e === "" || e === "/" ? [] : (e.startsWith("/") ? e.slice(1) : e).split("/").map(l);
188
+ }
189
+ function d(e, t) {
190
+ return t.reduce((e, t) => i(e)?.[t], e);
191
+ }
192
+ function f(e, t, n) {
193
+ if (t.length === 0) return n;
194
+ let [r, ...a] = t, o = i(e) ?? {};
195
+ if (a.length > 0) return {
196
+ ...o,
197
+ [r]: f(o[r], a, n)
198
+ };
199
+ if (n !== void 0) return {
200
+ ...o,
201
+ [r]: n
202
+ };
203
+ let { [r]: s, ...c } = o;
204
+ return c;
205
+ }
206
+ function p(e) {
207
+ if (!Array.isArray(e)) return {};
208
+ let t = {};
209
+ for (let n of e) {
210
+ let e = i(n), r = a(e?.key);
211
+ e !== null && r !== void 0 && ("valueString" in e ? t[r] = e.valueString : "valueNumber" in e ? t[r] = e.valueNumber : "valueBoolean" in e ? t[r] = e.valueBoolean : "valueMap" in e && (t[r] = p(e.valueMap)));
212
+ }
213
+ return t;
214
+ }
215
+ function m(e, t) {
216
+ let n = i(t);
217
+ if (n === null) return e;
218
+ let l = i(n.createSurface) ?? i(n.beginRendering);
219
+ if (l !== null) {
220
+ let t = a(l.surfaceId) ?? r, n = e.surfaces[t] ?? o(t);
221
+ return s(e, t, {
222
+ ...n,
223
+ catalogId: a(l.catalogId) ?? n.catalogId,
224
+ root: a(l.root) ?? n.root,
225
+ theme: i(l.theme) ?? i(l.styles) ?? n.theme
226
+ });
227
+ }
228
+ let m = i(n.updateComponents) ?? i(n.surfaceUpdate);
229
+ if (m !== null) {
230
+ let t = a(m.surfaceId) ?? r, n = e.surfaces[t] ?? o(t), i = { ...n.components }, l = !1;
231
+ for (let e of Array.isArray(m.components) ? m.components : []) {
232
+ let t = c(e);
233
+ t !== null && (i[t.id] = t, l = !0);
234
+ }
235
+ return l || !e.surfaces[t] ? s(e, t, {
236
+ ...n,
237
+ components: i
238
+ }) : e;
239
+ }
240
+ let h = i(n.updateDataModel) ?? i(n.dataModelUpdate);
241
+ if (h !== null) {
242
+ let t = a(h.surfaceId) ?? r, n = e.surfaces[t] ?? o(t), c = u(a(h.path)), l = "contents" in h ? {
243
+ ...i(d(n.data, c)) ?? {},
244
+ ...p(h.contents)
245
+ } : void 0, m = f(n.data, c, l ?? h.value);
246
+ return s(e, t, {
247
+ ...n,
248
+ data: i(m) ?? {}
249
+ });
250
+ }
251
+ let g = i(n.deleteSurface);
252
+ if (g !== null) {
253
+ let t = a(g.surfaceId) ?? r;
254
+ if (!e.surfaces[t]) return e;
255
+ let { [t]: n, ...i } = e.surfaces;
256
+ return {
257
+ surfaces: i,
258
+ order: e.order.filter((e) => e !== t)
259
+ };
260
+ }
261
+ return e;
262
+ }
263
+ t.apply = m;
264
+ function h(e, t) {
265
+ return t.reduce(m, e);
266
+ }
267
+ t.applyAll = h;
268
+ function g(e, t) {
269
+ return t === void 0 ? e.surfaces[e.order[0]] ?? null : e.surfaces[t] ?? null;
270
+ }
271
+ t.surface = g;
272
+ function _(e) {
273
+ let t = i(e);
274
+ return t === null ? e : "literalString" in t ? t.literalString : "literalNumber" in t ? t.literalNumber : "literalBoolean" in t ? t.literalBoolean : typeof t.path == "string" ? { $data: t.path } : e;
275
+ }
276
+ function v(e) {
277
+ let t = i(e);
278
+ return t === null ? a(e) : a(i(t.event)?.name) ?? a(t.name);
279
+ }
280
+ function y(e) {
281
+ let t = a(e.child);
282
+ if (t !== void 0) return { ids: [t] };
283
+ let n = e.children;
284
+ if (Array.isArray(n)) return { ids: n.filter((e) => typeof e == "string") };
285
+ let r = i(n);
286
+ if (r === null) return { ids: [] };
287
+ if (Array.isArray(r.explicitList)) return { ids: r.explicitList.filter((e) => typeof e == "string") };
288
+ let o = i(r.template) ?? r, s = a(o.componentId), c = a(o.path) ?? a(o.dataBinding);
289
+ return s !== void 0 && c !== void 0 ? {
290
+ ids: [],
291
+ template: {
292
+ componentId: s,
293
+ path: c
294
+ }
295
+ } : { ids: [] };
296
+ }
297
+ let b = /* @__PURE__ */ new Set([
298
+ "id",
299
+ "component",
300
+ "child",
301
+ "children",
302
+ "action"
303
+ ]);
304
+ function x(e, t, n, r, i) {
305
+ let a = e.components[t];
306
+ if (a === void 0 || i > 32 || r.has(t)) return null;
307
+ let o = new Set(n.catalog?.components[a.component]?.events ?? []), s = {}, c = {};
308
+ for (let [e, t] of Object.entries(a)) {
309
+ if (b.has(e)) continue;
310
+ if (!o.has(e)) {
311
+ s[e] = _(t);
312
+ continue;
313
+ }
314
+ let n = v(t);
315
+ n !== void 0 && (c[e] = n);
316
+ }
317
+ let l = v(a.action);
318
+ l !== void 0 && (c.action = l);
319
+ let { ids: u, template: d } = y(a), f = /* @__PURE__ */ new Set([...r, t]), p = [];
320
+ for (let t of u) {
321
+ let r = x(e, t, n, f, i + 1);
322
+ r !== null && p.push(r);
323
+ }
324
+ if (d !== void 0) {
325
+ let t = x(e, d.componentId, n, f, i + 1);
326
+ t !== null && p.push({
327
+ ...t,
328
+ repeat: { $data: d.path }
329
+ });
330
+ }
331
+ return {
332
+ type: a.component,
333
+ key: t,
334
+ ...Object.keys(s).length ? { props: s } : {},
335
+ ...p.length ? { children: p } : {},
336
+ ...Object.keys(c).length ? { on: c } : {}
337
+ };
338
+ }
339
+ function S(e, t = {}) {
340
+ return e === null ? null : x(e, t.root ?? e.root ?? n, t, /* @__PURE__ */ new Set(), 0);
341
+ }
342
+ t.toSpec = S;
343
+ let C = {
344
+ type: "array",
345
+ items: { type: "string" },
346
+ description: "The ids of this component’s children, each a component of its own in the same surface."
347
+ }, w = {
348
+ type: "string",
349
+ description: "The name of an action the host handles."
350
+ };
351
+ function T(e, t) {
352
+ let n = i(i(e.components)?.[t]);
353
+ if (n === null) return null;
354
+ let r = i(e.$defs);
355
+ return r === null ? n : {
356
+ ...n,
357
+ $defs: r
358
+ };
359
+ }
360
+ t.componentSchema = T;
361
+ function E(t, n = {}) {
362
+ let r = n.catalogId ?? `urn:box-kite:catalog:${t.version}`, i = {}, a = {};
363
+ for (let [n, r] of Object.entries(t.components)) {
364
+ let t = e.hoist(r.props, i);
365
+ a[n] = {
366
+ type: "object",
367
+ description: r.description,
368
+ properties: {
369
+ id: {
370
+ type: "string",
371
+ description: "This component’s id, unique within the surface."
372
+ },
373
+ component: {
374
+ type: "string",
375
+ enum: [n]
376
+ },
377
+ ...t.properties ?? {},
378
+ ...Object.fromEntries(r.events.map((e) => [e, w])),
379
+ ...r.slots.length ? { children: C } : {}
380
+ },
381
+ required: [
382
+ "id",
383
+ "component",
384
+ ...t.required ?? []
385
+ ],
386
+ additionalProperties: !1
387
+ };
388
+ }
389
+ return {
390
+ $schema: "https://json-schema.org/draft/2020-12/schema",
391
+ $id: r,
392
+ catalogId: r,
393
+ title: n.title ?? `${t.library} catalog`,
394
+ description: n.description ?? t.rules.join(" "),
395
+ ...Object.keys(i).length ? { $defs: i } : {},
396
+ components: a
397
+ };
398
+ }
399
+ t.catalogDocument = E;
400
+ })(i ||= {});
401
+ var a = i, o;
402
+ (function(e) {
403
+ function n(e, t) {
404
+ if (typeof e == "string") return e;
405
+ if (t > 32 || typeof e != "object" || !e || typeof e.component != "string") return null;
406
+ let r = (e.children ?? []).map((e) => n(e, t + 1)).filter((e) => e !== null);
407
+ return {
408
+ type: e.component,
409
+ ...e.key === void 0 ? {} : { key: e.key },
410
+ ...e.props ? { props: e.props } : {},
411
+ ...r.length ? { children: r } : {}
412
+ };
413
+ }
414
+ function r(e) {
415
+ return e == null ? [] : (Array.isArray(e.root) ? e.root : [e.root]).map((e) => n(e, 0)).filter((e) => typeof e == "object" && !!e);
416
+ }
417
+ e.toSpec = r;
418
+ function i(e, n, r, a) {
419
+ if (e == null) return null;
420
+ if (typeof e == "string") return e;
421
+ if (typeof e == "number" || typeof e == "boolean") return String(e);
422
+ if (t.isRef(e)) return r.push({
423
+ code: "data-binding",
424
+ path: n
425
+ }), null;
426
+ if (a > 32 || typeof e.type != "string") return null;
427
+ let o = e;
428
+ if (o.repeat && r.push({
429
+ code: "repeat",
430
+ path: n
431
+ }), o.on) for (let e of Object.keys(o.on)) r.push({
432
+ code: "event",
433
+ path: `${n}.on.${e}`
434
+ });
435
+ let s = (o.children === void 0 ? [] : Array.isArray(o.children) ? o.children : [o.children]).map((e, t) => i(e, `${n}.children.${t}`, r, a + 1)).filter((e) => e !== null);
436
+ return {
437
+ component: o.type,
438
+ ...o.key === void 0 ? {} : { key: o.key },
439
+ ...o.props ? { props: o.props } : {},
440
+ ...s.length ? { children: s } : {}
441
+ };
442
+ }
443
+ function a(e) {
444
+ let t = [];
445
+ return {
446
+ spec: { root: (Array.isArray(e) ? e : [e]).map((e, n) => i(e, `root.${n}`, t, 0)).filter((e) => e !== null) },
447
+ losses: t
448
+ };
449
+ }
450
+ e.fromSpec = a;
451
+ })(o ||= {});
452
+ var s = o, c = r.toolPart, l = r.applyEvent, u = a.apply, d = a.applyAll, f = a.surface, p = a.toSpec, m = a.catalogDocument, h = a.componentSchema, g = a.EMPTY, _ = s.toSpec, v = s.fromSpec;
453
+ //#endregion
454
+ export { a as A2uiInterop, s as AssistantUiInterop, r as ToolInterop, u as a2uiApply, d as a2uiApplyAll, m as a2uiCatalog, h as a2uiComponentSchema, g as a2uiEmpty, f as a2uiSurface, p as a2uiToSpec, l as applyToolEvent, _ as fromGenerativeUi, v as toGenerativeUi, c as toolPart };
@@ -0,0 +1,88 @@
1
+ import { RegistryItem } from '../../pages/site/registry';
2
+ /**
3
+ * The corpora, all of them generated somewhere else in this repository: the prop reference F3
4
+ * measures off the engine, the component reference G4 extracts from the sources, the rules file AI3
5
+ * installs as a skill, and F4's registry items. Nothing here is written down a second time — a
6
+ * transcribed fact is the one an agent trusts over its priors and the one that goes stale.
7
+ */
8
+ export interface PropExample {
9
+ value: unknown;
10
+ css: string;
11
+ }
12
+ export interface PropRecord {
13
+ name: string;
14
+ description: string;
15
+ /** The CSS properties it writes. More than one when the prop composes (`shadow`, the filters). */
16
+ properties: string[];
17
+ example: PropExample;
18
+ /** Whether a number is accepted, and whether values outside the listed set are. */
19
+ numeric: boolean;
20
+ open: boolean;
21
+ /** The listed values, or a count alone where the reference cut a long list short. Numeric scales list numbers. */
22
+ values?: (string | number)[];
23
+ valueCount?: number;
24
+ }
25
+ export interface ComponentProp {
26
+ name: string;
27
+ type: string;
28
+ required: boolean;
29
+ default: string | null;
30
+ description: string;
31
+ }
32
+ export interface ComponentPart {
33
+ name: string;
34
+ description: string;
35
+ props: ComponentProp[];
36
+ }
37
+ export interface ComponentKey {
38
+ mode: string | null;
39
+ keys: string;
40
+ action: string;
41
+ }
42
+ export interface ComponentRecord {
43
+ name: string;
44
+ route: string;
45
+ import: string;
46
+ description: string;
47
+ pattern?: string;
48
+ props: ComponentProp[];
49
+ parts?: ComponentPart[];
50
+ keyboard?: ComponentKey[];
51
+ a11y?: string[];
52
+ styleTree?: string[];
53
+ }
54
+ export interface RuleRecord {
55
+ number: number;
56
+ /** The bolded lead sentence — what the rule is about, without its 300 words of detail. */
57
+ heading: string;
58
+ body: string;
59
+ }
60
+ export declare const packageName: string;
61
+ export declare const packageVersion: string;
62
+ export declare const siteUrl = "https://www.box-kite.dev";
63
+ export declare const props: readonly PropRecord[];
64
+ export declare const prop: (name: string) => PropRecord | undefined;
65
+ export declare const components: readonly ComponentRecord[];
66
+ /** Case-insensitive, because a model asks for `datagrid` as readily as `DataGrid`. */
67
+ export declare const component: (name: string) => ComponentRecord | undefined;
68
+ export declare const rules: readonly RuleRecord[];
69
+ /**
70
+ * Those bullets, verbatim — the server's `instructions`, which a client puts in front of the model
71
+ * before it calls anything. `scripts/agentSources.mjs` reads the same block for `llms.txt` and the
72
+ * skill; `data.test.ts` pins this reader to that one, because two parsers of one file is how a fact
73
+ * comes to be stated two ways.
74
+ */
75
+ export declare const priorFacts: readonly string[];
76
+ export declare const blocks: readonly RegistryItem[];
77
+ export declare const blockInstall: (name: string) => string;
78
+ /**
79
+ * A fresh engine with readable class names and no DOM: what `check_styles` judges a value with. One
80
+ * per call rather than one for the process, so a caller's `vars` or `css` cannot leak into the next
81
+ * answer through the rule registry.
82
+ */
83
+ export declare const styleEngine: () => import('../../src/core').StyleEngine;
84
+ /**
85
+ * Every style prop's accepted values, live off the registry rather than out of `props.json`, which
86
+ * cuts a list over 40 short — and a colour prop's 295 tokens are exactly the list worth having.
87
+ */
88
+ export declare function acceptedValues(name: string): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * What one prop writes, measured. Every answer this server gives about a value — the example, the
3
+ * scale, the verdict — comes through here rather than out of a table, so a changed divider changes
4
+ * the documentation in the same commit and a rejected value is reported as what it is: nothing.
5
+ */
6
+ /**
7
+ * The sheet as a list of top-level rules. A brace counter rather than a split on `}`, because a
8
+ * `@media`, `@container` or `@scope` block carries rules of its own and a nested one must stay with
9
+ * its wrapper — and because the sink writes several rules to a line, so a line is not a rule.
10
+ */
11
+ export declare function splitRules(css: string): string[];
12
+ export interface Measured {
13
+ /** The rules this prop added, at-rules included — empty when the value was not accepted. */
14
+ css: string;
15
+ /** The class names it produced, without the base class every Box carries. */
16
+ classNames: string[];
17
+ }
18
+ /** One prop resolved on an engine of its own, so nothing it writes can hide behind another prop's class. */
19
+ export declare function measure(name: string, value: unknown): Measured;
20
+ /** Just the declarations, for a table where the selector is noise: `padding:1rem`. */
21
+ export declare function declarations(name: string, value: unknown): string;
22
+ /** How a value is written in JSX — a string in quotes, everything else in braces. */
23
+ export declare const written: (name: string, value: unknown) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * One entry point over the four corpora, because an agent mid-task knows what it wants the UI to do
3
+ * and not which of them holds the answer. Ranked rather than filtered: a query with no exact hit
4
+ * should still come back with the three things most worth reading, since an empty result sends the
5
+ * model back to its priors — which is the failure this whole package exists to prevent.
6
+ */
7
+ export type HitKind = 'prop' | 'component' | 'nesting' | 'rule';
8
+ export interface Hit {
9
+ kind: HitKind;
10
+ /** What to pass to `get_props`, `get_component` or `get_rules` for the whole record. */
11
+ name: string;
12
+ summary: string;
13
+ score: number;
14
+ }
15
+ /** The four corpora, ranked together. `kind` narrows it when the caller already knows which it wants. */
16
+ export declare function search(query: string, options?: {
17
+ kind?: HitKind;
18
+ limit?: number;
19
+ }): Hit[];
20
+ /**
21
+ * The components whose own props a name belongs to — what a search for `onValueChange` should answer
22
+ * with, since the same prop name lives on six widgets and none of them is in the prop registry.
23
+ */
24
+ export declare function componentsWithProp(name: string): string[];
25
+ /** Case-insensitive component lookup that also answers for a part (`Tabs.Tab` → `Tabs`). */
26
+ export declare function resolveComponent(name: string): import('./data').ComponentRecord | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * `@box-kite/mcp` — the retrieval channel for an agent mid-task.
4
+ *
5
+ * Deliberately six tools at *capability* level rather than one per document: what may I write, what
6
+ * does this component take, and — the one no docs mirror can answer — does this value actually work.
7
+ * The package is built from this repository, so every answer is the reference the same commit
8
+ * generated: `api/props.json` measured off the engine, `api/components/*.json` extracted from the
9
+ * sources, the rules file the skill installs, and the engine itself for `check_styles`.
10
+ */
11
+ /**
12
+ * What a client puts in front of the model before it calls anything. The facts are `AGENTS.md`'s own
13
+ * lead block — the four a model's memory of a library with these prop names gets wrong — because an
14
+ * agent that never calls a tool should still be told the dividers differ.
15
+ */
16
+ export declare const instructions: string;
17
+ /** The server, transport-free so a test can drive it over an in-memory pair. */
18
+ export declare function createServer(): McpServer;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `check_styles`: the answer an agent cannot get from prose. A value this library does not accept
3
+ * produces **no rule and no class name** — silently, by design — so the only honest way to say
4
+ * whether `bgColor="blue-550"` works is to hand it to the engine and look at what came back.
5
+ *
6
+ * Each prop is measured on its own, because one bag would let a rejected value hide behind an
7
+ * accepted one in the same class list.
8
+ */
9
+ export type Verdict = 'ok' | 'rejected-value' | 'unknown-prop' | 'html-attribute' | 'reserved';
10
+ export interface PropCheck {
11
+ name: string;
12
+ verdict: Verdict;
13
+ /** The rules this prop wrote, at-rules included. Empty unless `ok`. */
14
+ css: string;
15
+ /** What to do about it, when the verdict is not `ok`. */
16
+ note?: string;
17
+ /** Prop names worth trying instead, closest first. */
18
+ suggestions?: string[];
19
+ }
20
+ export interface StyleCheck {
21
+ checks: PropCheck[];
22
+ /** The class attribute the whole bag resolves to — what `<Box {...props}>` would render. */
23
+ className: string;
24
+ ok: boolean;
25
+ }
26
+ /** Judge a whole prop bag: one verdict per prop, plus the class attribute the bag as a whole resolves to. */
27
+ export declare function checkStyles(bag: Record<string, unknown>): StyleCheck;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ComponentRecord } from './data';
2
+ import { Hit } from './search';
3
+ /** `search_docs` — the entry point when the caller knows the goal and not the name. */
4
+ export declare function searchDocs(query: string, kind?: Hit['kind'], limit?: number): string;
5
+ /** `get_props` — the record for named style props, with the scale measured rather than stated. */
6
+ export declare function getProps(names: string[]): string;
7
+ export type ComponentSection = 'props' | 'parts' | 'keyboard' | 'a11y' | 'styles';
8
+ /** `get_component` — one component's whole contract: props, parts, the keyboard map and the ARIA. */
9
+ export declare function getComponent(name: string, include?: ComponentSection[]): string;
10
+ /** `check_styles` — the engine's own answer, which is the only one that counts. */
11
+ export declare function checkStylesTool(bag: Record<string, unknown>): string;
12
+ /** `get_rules` — the numbered rules, or the index of them. */
13
+ export declare function getRules(numbers?: number[]): string;
14
+ /** `get_blocks` — F4's registry: whole sections the shadcn CLI installs, wired and compiling. */
15
+ export declare function getBlocks(name?: string): string;
16
+ /** Every nesting key, for the tool description's "what else can I write" — small enough to state whole. */
17
+ export declare const nestingSummary: () => string;
18
+ export type { ComponentRecord };