@adapttable/ai-react 0.2.3 → 0.2.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @adapttable/ai-react
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 3bb83b4: The table agent reads server-data tables whose rows hold a `BigInt` or a circular reference; it no longer throws while building the manifest.
8
+
9
+ ## 0.2.4
10
+
11
+ ### Patch Changes
12
+
13
+ - cbe937e: The docs and live demo now live at [adapttable.orwamahmoud.com](https://adapttable.orwamahmoud.com/), with React docs under `/react/`. Package homepages and README links point there; the previous addresses redirect.
14
+ - Updated dependencies [cbe937e]
15
+ - @adapttable/ai@0.2.3
16
+ - @adapttable/core@3.2.2
17
+ - @adapttable/react@1.3.2
18
+
3
19
  ## 0.2.3
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@adapttable/ai-react`
2
2
 
3
- [![AdaptTable AI — ask the table to filter, group, and aggregate](https://orwa-mahmoud.github.io/adapttable/media/ai/demo.gif)](https://orwa-mahmoud.github.io/adapttable/demo/mantine/ai/)
3
+ [![AdaptTable AI — ask the table to filter, group, and aggregate](https://adapttable.orwamahmoud.com/media/ai/demo.gif)](https://adapttable.orwamahmoud.com/react/demo/mantine/ai/)
4
4
 
5
5
  React bindings for AdaptTable AI. `tableAgent` publishes a live capability
6
6
  manifest from a table. `useTableAssistant` owns the conversation.
@@ -27,19 +27,19 @@ Requires Node.js **22.12.0 or newer**; packed releases are tested on Node 22.12
27
27
 
28
28
  **Filter, sort, and page size** — active people, salary high first, then 10 rows a page
29
29
 
30
- ![filter-sort](https://orwa-mahmoud.github.io/adapttable/media/ai/parts/filter-sort.gif)
30
+ ![filter-sort](https://adapttable.orwamahmoud.com/media/ai/parts/filter-sort.gif)
31
31
 
32
32
  **Group and aggregate** — group by team, average then min salary, then only active
33
33
 
34
- ![group-average](https://orwa-mahmoud.github.io/adapttable/media/ai/parts/group-average.gif)
34
+ ![group-average](https://adapttable.orwamahmoud.com/media/ai/parts/group-average.gif)
35
35
 
36
36
  **Date range** — only rows that started between 2020 and 2022
37
37
 
38
- ![date-range](https://orwa-mahmoud.github.io/adapttable/media/ai/parts/date-range.gif)
38
+ ![date-range](https://adapttable.orwamahmoud.com/media/ai/parts/date-range.gif)
39
39
 
40
40
  **Column management** — hide Person, show it again, Status first, then pin it
41
41
 
42
- ![column-management](https://orwa-mahmoud.github.io/adapttable/media/ai/parts/column-management.gif)
42
+ ![column-management](https://adapttable.orwamahmoud.com/media/ai/parts/column-management.gif)
43
43
 
44
- [Integration guide](https://orwa-mahmoud.github.io/adapttable/ai-integrations/) ·
45
- [API reference](https://orwa-mahmoud.github.io/adapttable/ai/)
44
+ [Integration guide](https://adapttable.orwamahmoud.com/ai-integrations/) ·
45
+ [API reference](https://adapttable.orwamahmoud.com/ai/)
package/dist/index.cjs CHANGED
@@ -163,13 +163,29 @@ function cellRecord(row, columns, wanted) {
163
163
  }
164
164
  return cells;
165
165
  }
166
+ /**
167
+ * `JSON.stringify` that never throws on host rows: a BigInt is written as its
168
+ * digits with an `n`, and a value that contains itself is written once, not
169
+ * followed back in.
170
+ */
171
+ function stampJson(value) {
172
+ const ancestors = [];
173
+ return JSON.stringify(value, function replace(_key, next) {
174
+ if (typeof next === "bigint") return `${next.toString()}n`;
175
+ if (typeof next !== "object" || next === null) return next;
176
+ while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();
177
+ if (ancestors.includes(next)) return void 0;
178
+ ancestors.push(next);
179
+ return next;
180
+ });
181
+ }
166
182
  function viewRevisionStamp(view) {
167
183
  const table = view?.neutralTable;
168
184
  if (table) return (0, _adapttable_ai.monotonicRevision)(table.revisions, void 0).token;
169
185
  const rows = view?.rows ?? [];
170
186
  const getRowId = view?.getRowId;
171
187
  const query = view?.query;
172
- return JSON.stringify({
188
+ return stampJson({
173
189
  ids: rows.map((row) => getRowId ? getRowId(row) : null),
174
190
  payloads: rows,
175
191
  page: query?.page ?? 1,
@@ -562,7 +578,7 @@ function exclusionKey(keys) {
562
578
  * What a capability does to the table, from the live catalog.
563
579
  *
564
580
  * Read through the session rather than kept in a list here: the definition is
565
- * the only thing that knows, and item 11 published it on the catalog entry so
581
+ * the only thing that knows, and it is published on the catalog entry so
566
582
  * every surface reads the same answer.
567
583
  */
568
584
  function capabilityKind(session, capability) {