@agent-native/core 0.123.1 → 0.123.2

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 (80) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +8 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/deploy/build.ts +8 -0
  5. package/corpus/core/src/server/builder-browser.ts +76 -0
  6. package/corpus/core/src/server/core-routes-plugin.ts +15 -5
  7. package/corpus/templates/assets/app/global.css +0 -4
  8. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +195 -167
  9. package/corpus/templates/assets/changelog/2026-07-23-drafts-preview-panel-now-fills-the-full-width-with-a-large-p.md +6 -0
  10. package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
  11. package/corpus/templates/content/actions/_builder-cms-write-client.ts +55 -9
  12. package/corpus/templates/content/actions/_database-source-utils.ts +756 -182
  13. package/corpus/templates/content/actions/change-content-database-source-role.ts +21 -20
  14. package/corpus/templates/content/actions/execute-builder-source-execution.ts +49 -8
  15. package/corpus/templates/content/actions/materialize-builder-required-fields.ts +42 -9
  16. package/corpus/templates/content/actions/prepare-builder-source-review.ts +88 -90
  17. package/corpus/templates/content/actions/preview-builder-source-review.ts +4 -3
  18. package/corpus/templates/content/actions/refresh-content-database-source.ts +36 -9
  19. package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +28 -24
  20. package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +62 -12
  21. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +91 -16
  22. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +15 -1
  23. package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +234 -44
  24. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +194 -16
  25. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +95 -42
  26. package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +4 -2
  27. package/corpus/templates/content/app/components/editor/extensions/CodeBlockNode.tsx +10 -166
  28. package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +32 -8
  29. package/corpus/templates/content/app/components/editor/extensions/VideoNode.ts +14 -0
  30. package/corpus/templates/content/app/components/editor/registrySlashItems.ts +5 -1
  31. package/corpus/templates/content/app/hooks/use-content-database.ts +59 -2
  32. package/corpus/templates/content/app/hooks/use-documents.ts +18 -26
  33. package/corpus/templates/content/app/root.tsx +1 -6
  34. package/corpus/templates/content/changelog/2026-07-24-builder-can-now-publish-approved-updates-to-entries-that-are.md +6 -0
  35. package/corpus/templates/content/changelog/2026-07-24-builder-collection-loading-no-longer-restarts-from-the-begin.md +6 -0
  36. package/corpus/templates/content/changelog/2026-07-24-builder-connections-now-complete-securely-from-netlify-deplo.md +6 -0
  37. package/corpus/templates/content/changelog/2026-07-24-builder-draft-creation-now-scopes-execution-to-the-selected-.md +6 -0
  38. package/corpus/templates/content/changelog/2026-07-24-builder-review-now-distinguishes-preparing-a-safe-dry-run-from.md +6 -0
  39. package/corpus/templates/content/changelog/2026-07-24-builder-source-imports-now-recover-from-a-transient-paginati.md +6 -0
  40. package/corpus/templates/content/changelog/2026-07-24-builder-source-refresh-now-preserves-the-provider-bound-fiel.md +6 -0
  41. package/corpus/templates/content/changelog/2026-07-24-builder-update-reviews-now-open-reliably-on-large-collection.md +6 -0
  42. package/corpus/templates/content/changelog/2026-07-24-builder-write-policy-controls-now-reflect-successful-changes.md +6 -0
  43. package/corpus/templates/content/changelog/2026-07-24-date-properties-now-save-reliably-when-selected-with-the-nat.md +6 -0
  44. package/corpus/templates/content/changelog/2026-07-24-editor-slash-search-now-keeps-multi-word-block-names-open.md +6 -0
  45. package/corpus/templates/content/changelog/2026-07-24-exact-editor-slash-commands-now-execute-on-enter-even-if-the.md +6 -0
  46. package/corpus/templates/content/changelog/2026-07-24-new-collaborative-pages-now-save-their-first-edits.md +6 -0
  47. package/corpus/templates/content/changelog/2026-07-24-new-local-builder-rows-no-longer-remain-locked-behind-a-none.md +6 -0
  48. package/corpus/templates/content/changelog/2026-07-24-opening-or-closing-a-collaborative-document-no-longer-lets-u.md +6 -0
  49. package/corpus/templates/content/changelog/2026-07-24-selected-text-now-opens-the-link-editor-with-command-k-or-co.md +6 -0
  50. package/corpus/templates/content/changelog/2026-07-24-slash-menu-block-choices-no-longer-stall-pointer-interaction.md +6 -0
  51. package/corpus/templates/content/changelog/2026-07-24-uploaded-and-embedded-media-now-stay-intact-while-collaborative-document-drafts-save.md +6 -0
  52. package/corpus/templates/content/changelog/2026-07-24-video-link-insertion-now-keeps-its-source-panel-open-while-t.md +6 -0
  53. package/corpus/templates/content/changelog/2026-07-26-builder-publishing-now-shows-safe-validation-details-instead.md +6 -0
  54. package/corpus/templates/content/changelog/2026-07-26-builder-reviews-stay-responsive-on-large-collections-and-pre.md +6 -0
  55. package/corpus/templates/content/changelog/2026-07-26-collaborative-documents-no-longer-flash-duplicated-recent-bl.md +6 -0
  56. package/corpus/templates/content/changelog/2026-07-26-corrected-builder-updates-are-now-reviewed-separately-from-f.md +6 -0
  57. package/corpus/templates/content/changelog/2026-07-26-documents-now-remain-read-only-until-their-live-collaborativ.md +6 -0
  58. package/corpus/templates/content/changelog/2026-07-26-slash-command-menus-now-stay-reachable-when-editing-near-the.md +6 -0
  59. package/corpus/templates/content/changelog/2026-07-26-the-slash-menu-now-shows-one-clear-callout-choice-instead-of.md +6 -0
  60. package/corpus/templates/content/shared/api.ts +1 -0
  61. package/corpus/templates/content/shared/builder-mdx.ts +73 -16
  62. package/corpus/toolkit/CHANGELOG.md +6 -0
  63. package/corpus/toolkit/package.json +1 -1
  64. package/corpus/toolkit/src/editor/useCollabReconcile.ts +14 -1
  65. package/dist/collab/routes.d.ts +1 -1
  66. package/dist/deploy/build.js +6 -0
  67. package/dist/deploy/build.js.map +1 -1
  68. package/dist/resources/handlers.d.ts +1 -1
  69. package/dist/server/builder-browser.d.ts +13 -0
  70. package/dist/server/builder-browser.d.ts.map +1 -1
  71. package/dist/server/builder-browser.js +59 -0
  72. package/dist/server/builder-browser.js.map +1 -1
  73. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  74. package/dist/server/core-routes-plugin.js +10 -5
  75. package/dist/server/core-routes-plugin.js.map +1 -1
  76. package/dist/server/realtime-token.d.ts +1 -1
  77. package/package.json +2 -2
  78. package/src/deploy/build.ts +8 -0
  79. package/src/server/builder-browser.ts +76 -0
  80. package/src/server/core-routes-plugin.ts +15 -5
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-26
4
+ ---
5
+
6
+ Collaborative documents no longer flash duplicated recent blocks when reopened
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-26
4
+ ---
5
+
6
+ Corrected Builder updates are now reviewed separately from failed earlier attempts, slow hosted writes get a full provider response window, and uncertain outcomes still require reconciliation before retry.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-26
4
+ ---
5
+
6
+ Documents now remain read-only until their live collaborative content finishes initial sync.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-26
4
+ ---
5
+
6
+ Slash command menus now stay reachable when editing near the bottom of the screen.
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: fixed
3
+ date: 2026-07-26
4
+ ---
5
+
6
+ The slash menu now shows one clear Callout choice instead of duplicate actions
@@ -957,6 +957,7 @@ export interface RefreshContentDatabaseSourceRequest {
957
957
  documentId?: string;
958
958
  sourceId?: string;
959
959
  fullRefresh?: boolean;
960
+ expectedBuilderContinuationOffset?: number;
960
961
  }
961
962
 
962
963
  export interface DisconnectContentDatabaseSourceRequest {
@@ -1872,19 +1872,75 @@ function freshTextHtmlBlock(text: string, stableSource: string): unknown {
1872
1872
  };
1873
1873
  }
1874
1874
 
1875
- function assertSafeFreshCalloutNode(node: MdxNode) {
1876
- for (const child of node.children ?? []) {
1877
- if (
1878
- child.type === "mdxFlowExpression" ||
1879
- child.type === "mdxTextExpression" ||
1880
- child.type === "mdxjsEsm" ||
1881
- child.type === "mdxJsxFlowElement" ||
1882
- child.type === "mdxJsxTextElement"
1883
- ) {
1884
- throw new Error("Unsupported dynamic syntax inside Builder callout.");
1875
+ function assertSafeFreshCalloutNode(node: MdxNode, raw: string) {
1876
+ const rootStart = node.position?.start?.offset;
1877
+ const visit = (candidate: MdxNode) => {
1878
+ for (const child of candidate.children ?? []) {
1879
+ const childStart = child.position?.start?.offset;
1880
+ const childEnd = child.position?.end?.offset;
1881
+ const childRaw =
1882
+ typeof rootStart === "number" &&
1883
+ typeof childStart === "number" &&
1884
+ typeof childEnd === "number"
1885
+ ? raw.slice(childStart - rootStart, childEnd - rootStart).trim()
1886
+ : "";
1887
+ const emptyBlockNode =
1888
+ (child.type === "mdxJsxFlowElement" ||
1889
+ child.type === "mdxJsxTextElement") &&
1890
+ child.name === "empty-block";
1891
+ if (emptyBlockNode) {
1892
+ if (isEmptyEditorBlockSentinel(child, childRaw)) continue;
1893
+ throw new Error(
1894
+ "Unsupported Builder callout empty-block syntax. Only an attribute-free, self-closing Content editor sentinel can be omitted.",
1895
+ );
1896
+ }
1897
+ if (
1898
+ child.type === "mdxFlowExpression" ||
1899
+ child.type === "mdxTextExpression" ||
1900
+ child.type === "mdxjsEsm" ||
1901
+ child.type === "mdxJsxFlowElement" ||
1902
+ child.type === "mdxJsxTextElement"
1903
+ ) {
1904
+ throw new Error("Unsupported dynamic syntax inside Builder callout.");
1905
+ }
1906
+ visit(child);
1885
1907
  }
1886
- assertSafeFreshCalloutNode(child);
1887
- }
1908
+ };
1909
+ visit(node);
1910
+ }
1911
+
1912
+ function removeSafeCalloutEmptyBlockSentinels(node: MdxNode, raw: string) {
1913
+ const rootStart = node.position?.start?.offset;
1914
+ if (typeof rootStart !== "number") return raw;
1915
+ const ranges: Array<{ start: number; end: number }> = [];
1916
+
1917
+ const visit = (candidate: MdxNode) => {
1918
+ for (const child of candidate.children ?? []) {
1919
+ const start = child.position?.start?.offset;
1920
+ const end = child.position?.end?.offset;
1921
+ if (typeof start !== "number" || typeof end !== "number") {
1922
+ visit(child);
1923
+ continue;
1924
+ }
1925
+ const relativeStart = start - rootStart;
1926
+ const relativeEnd = end - rootStart;
1927
+ const childRaw = raw.slice(relativeStart, relativeEnd).trim();
1928
+ if (isEmptyEditorBlockSentinel(child, childRaw)) {
1929
+ ranges.push({ start: relativeStart, end: relativeEnd });
1930
+ continue;
1931
+ }
1932
+ visit(child);
1933
+ }
1934
+ };
1935
+ visit(node);
1936
+
1937
+ return ranges
1938
+ .sort((left, right) => right.start - left.start)
1939
+ .reduce(
1940
+ (current, range) =>
1941
+ `${current.slice(0, range.start)}${current.slice(range.end)}`,
1942
+ raw,
1943
+ );
1888
1944
  }
1889
1945
 
1890
1946
  function findMdxOpeningTagEnd(raw: string) {
@@ -1936,14 +1992,15 @@ function freshCalloutBlock(
1936
1992
  `Unsupported Builder callout attribute: ${attribute.name}.`,
1937
1993
  );
1938
1994
  }
1939
- assertSafeFreshCalloutNode(node);
1995
+ assertSafeFreshCalloutNode(node, raw);
1940
1996
 
1941
- const openingEnd = findMdxOpeningTagEnd(raw);
1942
- const closingStart = raw.lastIndexOf("</callout>");
1997
+ const contentRaw = removeSafeCalloutEmptyBlockSentinels(node, raw);
1998
+ const openingEnd = findMdxOpeningTagEnd(contentRaw);
1999
+ const closingStart = contentRaw.lastIndexOf("</callout>");
1943
2000
  if (openingEnd < 0 || closingStart < openingEnd) {
1944
2001
  throw new Error("Builder callout must have an explicit closing tag.");
1945
2002
  }
1946
- const markdown = raw
2003
+ const markdown = contentRaw
1947
2004
  .slice(openingEnd + 1, closingStart)
1948
2005
  .split(/\r?\n/)
1949
2006
  .map((line) => line.replace(/^(?:\t| {2})/, ""))
@@ -1,5 +1,11 @@
1
1
  # @agent-native/toolkit
2
2
 
3
+ ## 0.10.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 14818b6: Allow the first local edit in a newly synced empty collaborative document to reach the host application's canonical save path.
8
+
3
9
  ## 0.10.7
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/toolkit",
3
- "version": "0.10.7",
3
+ "version": "0.10.8",
4
4
  "description": "Reusable app-building UI and helpers for Agent-Native apps.",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -626,7 +626,20 @@ export function useCollabReconcile({
626
626
  // app's local mirror or autosave path (Content serializes an empty paragraph
627
627
  // as `<empty-block/>`, which is non-empty text and bypasses the generic
628
628
  // registerEmitted empty-string guard).
629
- if (collab && !seededRef.current) return true;
629
+ if (collab && !seededRef.current) {
630
+ // Passive effects normally mark a synced empty document initialized
631
+ // before a person can type. Keep the event boundary correct too: if a
632
+ // genuine local edit wins that tiny race, it is itself proof that the
633
+ // synced empty document is ready. Remote Yjs transactions stay ignored.
634
+ const firstSyncedEmptyUserEdit =
635
+ collabSynced &&
636
+ !value.trim() &&
637
+ transaction.docChanged &&
638
+ Boolean(transaction.getMeta("uiEvent")) &&
639
+ !isChangeOrigin(transaction);
640
+ if (!firstSyncedEmptyUserEdit) return true;
641
+ seededRef.current = true;
642
+ }
630
643
  if (transaction.getMeta(RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION)) {
631
644
  return true;
632
645
  }
@@ -41,9 +41,9 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
41
41
  * Body: { text: string, fieldName?: string, requestSource?: string }
42
42
  */
43
43
  export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
44
+ text?: undefined;
44
45
  ok?: undefined;
45
46
  error: string;
46
- text?: undefined;
47
47
  } | {
48
48
  error?: undefined;
49
49
  ok: boolean;
@@ -3075,6 +3075,12 @@ export default bundle;
3075
3075
  "virtual:agents-bundle": agentsBundleModuleSource,
3076
3076
  },
3077
3077
  replace: {
3078
+ // Netlify exposes DEPLOY_ID only while building. Embed it into the Nitro
3079
+ // function so preview OAuth relays can target this immutable deployment
3080
+ // even though the value is unavailable in the function runtime.
3081
+ "process.env.AGENT_NATIVE_BUILD_ID": JSON.stringify(process.env.DEPLOY_ID?.trim() ||
3082
+ process.env.AGENT_NATIVE_BUILD_ID?.trim() ||
3083
+ ""),
3078
3084
  "process.env.AGENT_NATIVE_BUILD_GA_MEASUREMENT_ID": JSON.stringify(process.env.GA_MEASUREMENT_ID?.trim() || ""),
3079
3085
  "process.env.AGENT_NATIVE_BUILD_GTM_CONTAINER_ID": JSON.stringify(process.env.GTM_CONTAINER_ID?.trim() || ""),
3080
3086
  "process.env.AGENT_NATIVE_BUILD_DEPLOY_CONTEXT": JSON.stringify(process.env.CONTEXT?.trim() || ""),