@ai-matrx/records-ui 0.115.102 → 0.115.104

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/pickers.js CHANGED
@@ -26,7 +26,7 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
27
27
 
28
28
  // src/choiceLooks.ts
29
- import { newerKindOf } from "@ai-matrx/records";
29
+ import { newerKindOf } from "@ai-matrx/records/core";
30
30
  import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, STYLE_COLORS } from "@ai-matrx/design-system/data-table/table-style";
31
31
  function displayFormatOf(field) {
32
32
  const raw = field.display_format;
@@ -296,7 +296,7 @@ var init_plainWords = __esm({
296
296
  });
297
297
 
298
298
  // src/rights.ts
299
- import { atLeast } from "@ai-matrx/records";
299
+ import { atLeast } from "@ai-matrx/records/core";
300
300
  function sentenceFor(what, level) {
301
301
  if (level === null) return NOTHING_AT_ALL;
302
302
  const need = LEVEL_WORD[NEEDS[what]];
@@ -660,7 +660,7 @@ var init_docs = __esm({
660
660
  });
661
661
 
662
662
  // src/fieldTypes.ts
663
- import { DECLARABLE_FIELD_KINDS, NEWER_FIELD_KINDS, PARITY_FIELD_TYPES } from "@ai-matrx/records";
663
+ import { DECLARABLE_FIELD_KINDS, NEWER_FIELD_KINDS, PARITY_FIELD_TYPES } from "@ai-matrx/records/core";
664
664
  function declaredAsLook(kind) {
665
665
  return kind in LOOK_KINDS && !storePublishesKind(kind);
666
666
  }
@@ -757,8 +757,8 @@ import {
757
757
  PARITY_FIELD_TYPES as PARITY_FIELD_TYPES2,
758
758
  fieldKindFor,
759
759
  newerKindOf as newerKindOf3
760
- } from "@ai-matrx/records";
761
- import { isButtonField } from "@ai-matrx/records";
760
+ } from "@ai-matrx/records/core";
761
+ import { isButtonField } from "@ai-matrx/records/core";
762
762
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
763
763
  function editorKindFor(field) {
764
764
  return fieldKindFor(field, KERNEL);
@@ -6295,6 +6295,11 @@ import { useCallback as useCallback7, useEffect as useEffect19, useState as useS
6295
6295
  import { Button as Button15 } from "@ai-matrx/design-system";
6296
6296
  import { tableShapeChanged, useRecordsClient as useRecordsClient9 } from "@ai-matrx/records/react";
6297
6297
 
6298
+ // src/leadingBlank.ts
6299
+ function withoutLeadingBlank(text) {
6300
+ return text.replace(/^\s+/, "");
6301
+ }
6302
+
6298
6303
  // src/values.tsx
6299
6304
  init_personChip();
6300
6305
  import { SWATCH_CLASS as SWATCH_CLASS2, formatColumnValue } from "@ai-matrx/design-system/data-table";
@@ -6311,7 +6316,7 @@ init_parity();
6311
6316
  init_dates();
6312
6317
  import { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
6313
6318
  import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
6314
- import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records";
6319
+ import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records/core";
6315
6320
  var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
6316
6321
  function shownAsOf(field) {
6317
6322
  if (DRAWN_KINDS.has(String(editorKindFor(field)))) return void 0;
@@ -8254,9 +8259,9 @@ function RecordsTable({ items }) {
8254
8259
  const pictureFirst = [...keys].sort((a, b) => rank(a, items) - rank(b, items)).slice(0, TABLE_COLUMNS);
8255
8260
  const shown2 = all ? items : items.slice(0, TABLE_ROWS);
8256
8261
  return /* @__PURE__ */ jsxs26("div", { className: "min-w-0", "data-records-structured": "table", children: [
8257
- /* @__PURE__ */ jsx28("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", children: /* @__PURE__ */ jsxs26("table", { className: "w-full border-collapse text-xs", children: [
8262
+ /* @__PURE__ */ jsx28("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ jsxs26("table", { className: "w-full border-collapse text-xs", children: [
8258
8263
  /* @__PURE__ */ jsx28("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ jsx28("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("th", { scope: "col", className: "whitespace-nowrap px-2 py-1 font-medium text-muted-foreground", children: keyWords(k) }, k)) }) }),
8259
- /* @__PURE__ */ jsx28("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx28("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("td", { className: "min-w-[7rem] max-w-[18rem] px-2 py-1", children: k in item ? /* @__PURE__ */ jsx28(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
8264
+ /* @__PURE__ */ jsx28("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx28("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("td", { className: "min-w-[4rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ jsx28(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
8260
8265
  ] }) }),
8261
8266
  items.length > TABLE_ROWS ? /* @__PURE__ */ jsx28(Button14, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
8262
8267
  stop(e);
@@ -8667,7 +8672,7 @@ function scalarText(field, value, labels, stillWaitingFor) {
8667
8672
  }
8668
8673
  if (Array.isArray(value)) return value.length === 0 ? "" : structuredSummary(value);
8669
8674
  if (typeof value === "object") return structuredOf(value) ? structuredSummary(value) : "\u2026";
8670
- return String(value);
8675
+ return typeof value === "string" ? withoutLeadingBlank(value) : String(value);
8671
8676
  }
8672
8677
 
8673
8678
  // src/SourceArchivedNotice.tsx
@@ -11807,12 +11812,39 @@ function buttonPressWords(label, pressed) {
11807
11812
  }
11808
11813
  var POLL_EVERY_MS = 1200;
11809
11814
  var POLL_FOR_MS = 12e4;
11810
- function runAnswerWords(label, run) {
11815
+ var RUN_BOOKKEEPING = /* @__PURE__ */ new Set(["run_id", "conversation_id"]);
11816
+ function answerOf(output) {
11817
+ const raw = (output ?? "").trim();
11818
+ if (raw === "") return { words: "" };
11819
+ let parsed;
11820
+ try {
11821
+ parsed = JSON.parse(raw);
11822
+ } catch {
11823
+ return { words: raw };
11824
+ }
11825
+ if (typeof parsed === "string") return { words: parsed.trim() };
11826
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
11827
+ const shown2 = Object.fromEntries(Object.entries(parsed).filter(([k]) => !RUN_BOOKKEEPING.has(k)));
11828
+ const keys = Object.keys(shown2);
11829
+ if (keys.length === 1 && typeof shown2.text === "string") return { words: shown2.text.trim() };
11830
+ const value2 = structuredOf(shown2);
11831
+ return value2 ? { words: "", value: value2 } : { words: raw };
11832
+ }
11833
+ const value = structuredOf(parsed);
11834
+ return value ? { words: "", value } : { words: raw };
11835
+ }
11836
+ function runAnswer(label, run) {
11811
11837
  const steps = run.steps ?? [];
11812
11838
  const failedStep = [...steps].reverse().find((s) => s.status === "failed");
11813
- if (run.status === "failed") return [failedStep?.output_text ?? failedStep?.says, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.`;
11814
- const answered = [...steps].reverse().find((s) => s.output_text && s.output_text.trim() !== "");
11815
- return answered?.output_text?.trim() || run.says || `${label} ran.`;
11839
+ if (run.status === "failed") {
11840
+ const failed = answerOf(failedStep?.output_text).words || failedStep?.says;
11841
+ return { words: [failed, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.` };
11842
+ }
11843
+ for (const step of [...steps].reverse()) {
11844
+ const answered = answerOf(step.output_text);
11845
+ if (answered.words !== "" || answered.value) return answered;
11846
+ }
11847
+ return { words: run.says || `${label} ran.` };
11816
11848
  }
11817
11849
  var stop2 = (event) => event.stopPropagation();
11818
11850
  function ButtonValue({ field, recordId, inCell }) {
@@ -11859,7 +11891,8 @@ function ButtonValue({ field, recordId, inCell }) {
11859
11891
  const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
11860
11892
  if (run && run.status !== "waiting") {
11861
11893
  setBusy(false);
11862
- return setSaid(run.status === "ran" ? { kind: "ran", says: runAnswerWords(b.label, run) } : { kind: "failed", says: runAnswerWords(b.label, run) });
11894
+ const answer = runAnswer(b.label, run);
11895
+ return setSaid(run.status === "ran" ? { kind: "ran", says: answer.words, value: answer.value } : { kind: "failed", says: answer.words });
11863
11896
  }
11864
11897
  if (Date.now() > until) {
11865
11898
  setBusy(false);
@@ -11908,7 +11941,8 @@ function ButtonValue({ field, recordId, inCell }) {
11908
11941
  said2?.kind === "waiting" ? /* @__PURE__ */ jsx39("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
11909
11942
  said2?.kind === "failed" ? /* @__PURE__ */ jsx39("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
11910
11943
  said2?.kind === "public" ? /* @__PURE__ */ jsx39("p", { children: "Buttons run for signed-in people." }) : null,
11911
- said2?.kind === "ran" ? /* @__PURE__ */ jsxs37("p", { className: "break-words", children: [
11944
+ said2?.kind === "ran" ? /* @__PURE__ */ jsxs37("div", { className: "break-words", children: [
11945
+ said2.value ? /* @__PURE__ */ jsx39(StructuredValueView, { structured: said2.value, label: b.label }) : null,
11912
11946
  said2.says,
11913
11947
  " ",
11914
11948
  said2.link ? /* @__PURE__ */ jsx39(OutboundLink7, { href: said2.link, className: "text-primary underline", children: said2.link }) : null