@agent-native/core 0.81.3 → 0.83.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 (92) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +12 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/client/CommandMenu.tsx +34 -12
  5. package/corpus/core/src/file-upload/builder.ts +199 -37
  6. package/corpus/core/src/file-upload/index.ts +2 -0
  7. package/corpus/core/src/file-upload/types.ts +38 -0
  8. package/corpus/templates/analytics/actions/hubspot-deals.ts +64 -4
  9. package/corpus/templates/clips/actions/create-recording.ts +44 -0
  10. package/corpus/templates/clips/actions/finalize-recording.ts +198 -88
  11. package/corpus/templates/clips/actions/lib/create-recording-schema.ts +12 -0
  12. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +83 -29
  13. package/corpus/templates/clips/app/routes/record.tsx +12 -1
  14. package/corpus/templates/clips/server/lib/resumable-session.ts +39 -0
  15. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +2 -0
  16. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +186 -29
  17. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +4 -0
  18. package/corpus/templates/clips/shared/recording-core.ts +5 -0
  19. package/corpus/templates/content/.env.local.example +6 -0
  20. package/corpus/templates/content/AGENTS.md +10 -1
  21. package/corpus/templates/content/actions/_builder-cms-read-client.ts +14 -1
  22. package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +43 -0
  23. package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +79 -7
  24. package/corpus/templates/content/actions/_database-source-utils.ts +987 -22
  25. package/corpus/templates/content/actions/_database-utils.ts +41 -0
  26. package/corpus/templates/content/actions/_local-file-documents.ts +74 -1
  27. package/corpus/templates/content/actions/attach-content-database-source.ts +33 -8
  28. package/corpus/templates/content/actions/change-content-database-source-role.ts +14 -0
  29. package/corpus/templates/content/actions/disconnect-content-database-source.ts +3 -0
  30. package/corpus/templates/content/actions/execute-builder-source-execution.ts +71 -3
  31. package/corpus/templates/content/actions/list-content-databases.ts +41 -33
  32. package/corpus/templates/content/actions/process-builder-body-hydration.ts +47 -0
  33. package/corpus/templates/content/actions/update-document.ts +93 -0
  34. package/corpus/templates/content/app/blocks/SourceComponentBlock.tsx +277 -0
  35. package/corpus/templates/content/app/blocks/contentBlockRegistry.tsx +2 -0
  36. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +105 -17
  37. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +5 -1
  38. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +92 -0
  39. package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +5 -3
  40. package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +41 -0
  41. package/corpus/templates/content/app/components/editor/registrySlashItems.ts +4 -0
  42. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +28 -33
  43. package/corpus/templates/content/app/components/sidebar/document-sidebar-sections.ts +47 -0
  44. package/corpus/templates/content/app/global.css +10 -3
  45. package/corpus/templates/content/app/hooks/use-content-database.ts +24 -0
  46. package/corpus/templates/content/app/hooks/use-documents.ts +37 -0
  47. package/corpus/templates/content/app/i18n/zh-TW.ts +24 -0
  48. package/corpus/templates/content/app/i18n-data.ts +212 -0
  49. package/corpus/templates/content/app/lib/content-command-search.ts +64 -0
  50. package/corpus/templates/content/app/root.tsx +236 -8
  51. package/corpus/templates/content/changelog/2026-06-29-builder-cms-sources-now-sync-article-bodies-through-content.md +6 -0
  52. package/corpus/templates/content/changelog/2026-06-30-builder-article-media-now-render-as-images-and-embeds-when-r.md +6 -0
  53. package/corpus/templates/content/changelog/2026-06-30-builder-source-components-now-render-as-preserved-preview-bl.md +6 -0
  54. package/corpus/templates/content/changelog/2026-06-30-cmd-k-search-now-opens-from-the-editor-and-finds-real-content.md +6 -0
  55. package/corpus/templates/content/changelog/2026-06-30-sidebar-favorites-now-keep-long-titles-tidy-and-stay-in-sync.md +6 -0
  56. package/corpus/templates/content/package.json +3 -1
  57. package/corpus/templates/content/scripts/check-native-deps.mjs +57 -0
  58. package/corpus/templates/content/scripts/dev-database.mjs +83 -0
  59. package/corpus/templates/content/scripts/seed-demo-user.mjs +107 -0
  60. package/corpus/templates/content/server/db/schema.ts +27 -0
  61. package/corpus/templates/content/server/plugins/db.ts +33 -0
  62. package/corpus/templates/content/shared/api.ts +45 -0
  63. package/corpus/templates/content/shared/builder-mdx.ts +905 -5
  64. package/corpus/templates/content/shared/nfm-registry.ts +2 -0
  65. package/corpus/templates/content/shared/source-component-block.ts +141 -0
  66. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +5 -1
  67. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +229 -131
  68. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +103 -6
  69. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +6 -3
  70. package/corpus/templates/design/app/pages/DesignEditor.tsx +382 -72
  71. package/corpus/templates/design/changelog/2026-06-30-canvas-editing-now-keeps-undo-redo-and-cross-screen-layer-mo.md +6 -0
  72. package/dist/client/CommandMenu.d.ts +6 -2
  73. package/dist/client/CommandMenu.d.ts.map +1 -1
  74. package/dist/client/CommandMenu.js +25 -14
  75. package/dist/client/CommandMenu.js.map +1 -1
  76. package/dist/collab/awareness.d.ts +2 -2
  77. package/dist/collab/awareness.d.ts.map +1 -1
  78. package/dist/collab/routes.d.ts +1 -1
  79. package/dist/file-upload/builder.d.ts.map +1 -1
  80. package/dist/file-upload/builder.js +137 -25
  81. package/dist/file-upload/builder.js.map +1 -1
  82. package/dist/file-upload/index.d.ts +1 -1
  83. package/dist/file-upload/index.d.ts.map +1 -1
  84. package/dist/file-upload/index.js.map +1 -1
  85. package/dist/file-upload/types.d.ts +26 -0
  86. package/dist/file-upload/types.d.ts.map +1 -1
  87. package/dist/file-upload/types.js.map +1 -1
  88. package/dist/notifications/routes.d.ts +3 -3
  89. package/dist/progress/routes.d.ts +1 -1
  90. package/dist/resources/handlers.d.ts +3 -3
  91. package/dist/server/transcribe-voice.d.ts +1 -1
  92. package/package.json +1 -1
@@ -11,6 +11,7 @@
11
11
  * __TEXT_EDITING_ENABLED__ — boolean literal "true"/"false"
12
12
  * __EDITOR_CHROME_SCALE_X__ — number string, e.g. "1.5"
13
13
  * __EDITOR_CHROME_SCALE_Y__ — number string, e.g. "1.5"
14
+ * __DESIGN_CANVAS_SCREEN_ID__ — string literal for the owning screen/file id
14
15
  *
15
16
  * Rules:
16
17
  * • No import/require of any module (DOM globals only).
@@ -24,10 +25,12 @@ declare var __READ_ONLY__: boolean;
24
25
  declare var __TEXT_EDITING_ENABLED__: boolean;
25
26
  declare var __EDITOR_CHROME_SCALE_X__: string;
26
27
  declare var __EDITOR_CHROME_SCALE_Y__: string;
28
+ declare var __DESIGN_CANVAS_SCREEN_ID__: string;
27
29
 
28
30
  (function () {
29
31
  var readOnly = __READ_ONLY__;
30
32
  var textEditingEnabled = !readOnly && __TEXT_EDITING_ENABLED__;
33
+ var designCanvasScreenId = __DESIGN_CANVAS_SCREEN_ID__ || "";
31
34
  var scaleToolEnabled = false;
32
35
  var editorChromeScaleX = Math.max(
33
36
  0.05,
@@ -2533,6 +2536,43 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
2533
2536
  return true;
2534
2537
  }
2535
2538
 
2539
+ function isOutsideIframeViewport(clientX: number, clientY: number): boolean {
2540
+ return (
2541
+ clientX < 0 ||
2542
+ clientY < 0 ||
2543
+ clientX > window.innerWidth ||
2544
+ clientY > window.innerHeight
2545
+ );
2546
+ }
2547
+
2548
+ function postCrossScreenDrag(
2549
+ phase: "start" | "move" | "end" | "cancel",
2550
+ el?: Element | null,
2551
+ ev?: { clientX?: number; clientY?: number } | null,
2552
+ ): void {
2553
+ if (phase === "cancel") {
2554
+ (window.parent as Window).postMessage(
2555
+ { type: "agent-native:cross-screen-drag", phase: "cancel" },
2556
+ "*",
2557
+ );
2558
+ return;
2559
+ }
2560
+ (window.parent as Window).postMessage(
2561
+ {
2562
+ type: "agent-native:cross-screen-drag",
2563
+ phase,
2564
+ screenId: designCanvasScreenId,
2565
+ selector: getSelector(el ?? null),
2566
+ sourceId: getSourceId(el ?? null),
2567
+ iframeX: ev?.clientX ?? 0,
2568
+ iframeY: ev?.clientY ?? 0,
2569
+ viewportW: window.innerWidth,
2570
+ viewportH: window.innerHeight,
2571
+ },
2572
+ "*",
2573
+ );
2574
+ }
2575
+
2536
2576
  // keep in sync with EditPanel.tsx CONTAINER_TAGS/LEAF_TAGS (~line 1679)
2537
2577
  var BRIDGE_CONTAINER_TAGS = [
2538
2578
  "div",
@@ -3000,6 +3040,9 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3000
3040
  }
3001
3041
  ensurePositionable(selectedEl);
3002
3042
  var cs = window.getComputedStyle(selectedEl);
3043
+ var originalInlinePosition = (selectedEl as HTMLElement).style.position;
3044
+ var originalInlineLeft = (selectedEl as HTMLElement).style.left;
3045
+ var originalInlineTop = (selectedEl as HTMLElement).style.top;
3003
3046
  var originLeft = readPx((selectedEl as HTMLElement).style.left || cs.left);
3004
3047
  var originTop = readPx(selectedEl.style.top || cs.top);
3005
3048
  var startX = e.clientX;
@@ -3010,6 +3053,9 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3010
3053
  var dragEl = selectedEl;
3011
3054
  var moved = false;
3012
3055
  var DRAG_THRESHOLD = 3;
3056
+ if (!duplicatedForDrag) {
3057
+ postCrossScreenDrag("start", dragEl, e);
3058
+ }
3013
3059
  function onMove(ev) {
3014
3060
  if (
3015
3061
  !moved &&
@@ -3021,18 +3067,44 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3021
3067
  var nextTop = originTop + ev.clientY - startY;
3022
3068
  (dragEl as HTMLElement).style.left = Math.round(nextLeft) + "px";
3023
3069
  (dragEl as HTMLElement).style.top = Math.round(nextTop) + "px";
3024
- showTransformBadge(
3025
- "X " + Math.round(nextLeft) + " Y " + Math.round(nextTop),
3026
- ev.clientX,
3027
- ev.clientY,
3028
- );
3070
+ if (!duplicatedForDrag) {
3071
+ postCrossScreenDrag("move", dragEl, ev);
3072
+ }
3073
+ if (
3074
+ !duplicatedForDrag &&
3075
+ isOutsideIframeViewport(ev.clientX, ev.clientY)
3076
+ ) {
3077
+ showTransformBadge("Move layer", ev.clientX, ev.clientY);
3078
+ } else {
3079
+ showTransformBadge(
3080
+ "X " + Math.round(nextLeft) + " Y " + Math.round(nextTop),
3081
+ ev.clientX,
3082
+ ev.clientY,
3083
+ );
3084
+ }
3029
3085
  refreshOverlays();
3030
3086
  }
3031
- function onUp() {
3087
+ function restoreSourceDragPosition(): void {
3088
+ (dragEl as HTMLElement).style.position = originalInlinePosition;
3089
+ (dragEl as HTMLElement).style.left = originalInlineLeft;
3090
+ (dragEl as HTMLElement).style.top = originalInlineTop;
3091
+ selectedEl = originalSelectedEl;
3092
+ positionOverlay(selectionOverlay, selectedEl);
3093
+ }
3094
+ function onUp(ev) {
3032
3095
  document.removeEventListener(events.move, onMove, true);
3033
3096
  document.removeEventListener(events.up, onUp, true);
3034
3097
  hideTransformBadge();
3035
3098
  if (!dragEl) return;
3099
+ if (
3100
+ ev &&
3101
+ !duplicatedForDrag &&
3102
+ isOutsideIframeViewport(ev.clientX, ev.clientY)
3103
+ ) {
3104
+ postCrossScreenDrag("end", dragEl, ev);
3105
+ restoreSourceDragPosition();
3106
+ return;
3107
+ }
3036
3108
  if (duplicatedForDrag && !moved) {
3037
3109
  // Alt-click with no real drag — remove the premature clone and restore the original selection.
3038
3110
  if (dragEl.parentElement) dragEl.parentElement.removeChild(dragEl);
@@ -3060,6 +3132,7 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3060
3132
  },
3061
3133
  "*",
3062
3134
  );
3135
+ postCrossScreenDrag("cancel");
3063
3136
  }
3064
3137
  }
3065
3138
  document.addEventListener(events.move, onMove, true);
@@ -3274,6 +3347,14 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3274
3347
  pendingShieldDrag.onUp,
3275
3348
  true,
3276
3349
  );
3350
+ if (
3351
+ pendingShieldDrag.pointerId !== undefined &&
3352
+ shieldOverlay.releasePointerCapture
3353
+ ) {
3354
+ try {
3355
+ shieldOverlay.releasePointerCapture(pendingShieldDrag.pointerId);
3356
+ } catch (_err) {}
3357
+ }
3277
3358
  pendingShieldDrag = null;
3278
3359
  }
3279
3360
 
@@ -3299,6 +3380,18 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3299
3380
  ) {
3300
3381
  return;
3301
3382
  }
3383
+ if (
3384
+ e.pointerId !== undefined &&
3385
+ shieldOverlay.setPointerCapture &&
3386
+ !e.altKey
3387
+ ) {
3388
+ try {
3389
+ shieldOverlay.setPointerCapture(e.pointerId);
3390
+ } catch (_err) {}
3391
+ }
3392
+ if (!e.altKey) {
3393
+ postCrossScreenDrag("start", dragTarget, e);
3394
+ }
3302
3395
  var startX = e.clientX;
3303
3396
  var startY = e.clientY;
3304
3397
  var didStartDrag = false;
@@ -3321,6 +3414,9 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3321
3414
  function onUp(ev) {
3322
3415
  clearPendingShieldDrag();
3323
3416
  if (didStartDrag) return;
3417
+ if (!e.altKey) {
3418
+ postCrossScreenDrag("cancel");
3419
+ }
3324
3420
  if (ev) stopNativeInteraction(ev);
3325
3421
  selectTarget(clickTarget || dragTarget);
3326
3422
  suppressNextShieldClickBriefly();
@@ -3331,6 +3427,7 @@ declare var __EDITOR_CHROME_SCALE_Y__: string;
3331
3427
  up: events.up,
3332
3428
  onMove: onMove,
3333
3429
  onUp: onUp,
3430
+ pointerId: e.pointerId,
3334
3431
  };
3335
3432
  document.addEventListener(events.move, onMove, true);
3336
3433
  document.addEventListener(events.up, onUp, true);
@@ -1,4 +1,7 @@
1
- import { useEffect, useRef } from "react";
1
+ import { useEffect, useLayoutEffect, useRef } from "react";
2
+
3
+ const useIsomorphicLayoutEffect =
4
+ typeof window === "undefined" ? useEffect : useLayoutEffect;
2
5
 
3
6
  export type DesignHotkeyTool =
4
7
  | "move"
@@ -166,9 +169,9 @@ function isFocusableChromeTarget(target: EventTarget | null) {
166
169
  export function useDesignHotkeys(props: UseDesignHotkeysProps) {
167
170
  const propsRef = useRef(props);
168
171
 
169
- useEffect(() => {
172
+ useIsomorphicLayoutEffect(() => {
170
173
  propsRef.current = props;
171
- }, [props]);
174
+ });
172
175
 
173
176
  useEffect(() => {
174
177
  const eventTarget =