@agent-native/core 0.119.6 → 0.120.1

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 (91) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +19 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/cli/index.ts +64 -3
  5. package/corpus/core/src/client/MultiTabAssistantChat.tsx +45 -0
  6. package/corpus/core/src/client/use-chat-models.ts +45 -0
  7. package/corpus/core/src/server/analytics.ts +15 -0
  8. package/corpus/core/src/server/auth.ts +17 -13
  9. package/corpus/core/src/server/better-auth-instance.ts +13 -1
  10. package/corpus/core/src/templates/default/package.json +1 -1
  11. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +1 -1
  12. package/corpus/templates/assets/changelog/2026-07-23-new-chat-aligns-with-sidebar-controls.md +6 -0
  13. package/corpus/templates/assets/package.json +1 -1
  14. package/corpus/templates/brain/package.json +1 -1
  15. package/corpus/templates/calendar/package.json +1 -1
  16. package/corpus/templates/clips/package.json +1 -1
  17. package/corpus/templates/content/actions/add-database-item.ts +1 -0
  18. package/corpus/templates/content/actions/set-document-property.ts +0 -4
  19. package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +10 -1
  20. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +10 -4
  21. package/corpus/templates/content/app/components/editor/DocumentInfoPanel.tsx +5 -1
  22. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +6 -0
  23. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +52 -33
  24. package/corpus/templates/content/app/components/editor/previewDocumentSaveController.ts +16 -4
  25. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +16 -7
  26. package/corpus/templates/content/app/hooks/use-create-page.ts +8 -3
  27. package/corpus/templates/content/app/hooks/use-document-properties.ts +1 -0
  28. package/corpus/templates/content/app/hooks/use-documents.ts +3 -1
  29. package/corpus/templates/content/app/lib/optimistic-document.ts +29 -0
  30. package/corpus/templates/content/changelog/2026-07-21-editing-a-database-property-no-longer-refreshes-unrelated-co.md +6 -0
  31. package/corpus/templates/content/changelog/2026-07-23-new-database-ready.md +6 -0
  32. package/corpus/templates/content/package.json +1 -1
  33. package/corpus/templates/content/shared/api.ts +1 -0
  34. package/corpus/templates/design/package.json +1 -1
  35. package/corpus/templates/dispatch/package.json +1 -1
  36. package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +9 -3
  37. package/corpus/templates/forms/AGENTS.md +11 -1
  38. package/corpus/templates/forms/README.md +24 -1
  39. package/corpus/templates/forms/actions/update-form.ts +12 -5
  40. package/corpus/templates/forms/app/components/builder/FieldPropertiesPanel.tsx +199 -1
  41. package/corpus/templates/forms/app/i18n/en-US.ts +13 -1
  42. package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +35 -4
  43. package/corpus/templates/forms/app/pages/FormFillPage.tsx +7 -16
  44. package/corpus/templates/forms/changelog/2026-07-23-forms-can-branch-into-follow-up-questions-and-route-response.md +6 -0
  45. package/corpus/templates/forms/package.json +1 -1
  46. package/corpus/templates/forms/server/handlers/submissions.ts +22 -31
  47. package/corpus/templates/forms/server/lib/integrations.ts +11 -2
  48. package/corpus/templates/forms/server/lib/public-form-ssr.ts +26 -5
  49. package/corpus/templates/forms/server/lib/validate-fields.ts +48 -11
  50. package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
  51. package/corpus/templates/forms/shared/conditional.ts +67 -0
  52. package/corpus/templates/macros/package.json +1 -1
  53. package/corpus/templates/mail/package.json +1 -1
  54. package/corpus/templates/slides/package.json +1 -1
  55. package/dist/cli/index.js +53 -2
  56. package/dist/cli/index.js.map +1 -1
  57. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  58. package/dist/client/MultiTabAssistantChat.js +35 -0
  59. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  60. package/dist/client/use-chat-models.d.ts +1 -0
  61. package/dist/client/use-chat-models.d.ts.map +1 -1
  62. package/dist/client/use-chat-models.js +33 -0
  63. package/dist/client/use-chat-models.js.map +1 -1
  64. package/dist/collab/struct-routes.d.ts +1 -1
  65. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  66. package/dist/notifications/routes.d.ts +3 -3
  67. package/dist/provider-api/actions/custom-provider-registration.d.ts +6 -6
  68. package/dist/provider-api/actions/provider-api.d.ts +9 -9
  69. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  70. package/dist/secrets/routes.d.ts +3 -3
  71. package/dist/server/analytics.d.ts +8 -0
  72. package/dist/server/analytics.d.ts.map +1 -1
  73. package/dist/server/analytics.js +16 -0
  74. package/dist/server/analytics.js.map +1 -1
  75. package/dist/server/auth.d.ts.map +1 -1
  76. package/dist/server/auth.js +5 -4
  77. package/dist/server/auth.js.map +1 -1
  78. package/dist/server/better-auth-instance.d.ts +8 -0
  79. package/dist/server/better-auth-instance.d.ts.map +1 -1
  80. package/dist/server/better-auth-instance.js +10 -1
  81. package/dist/server/better-auth-instance.js.map +1 -1
  82. package/dist/server/realtime-token.d.ts +1 -1
  83. package/dist/templates/default/package.json +1 -1
  84. package/package.json +1 -1
  85. package/src/cli/index.ts +64 -3
  86. package/src/client/MultiTabAssistantChat.tsx +45 -0
  87. package/src/client/use-chat-models.ts +45 -0
  88. package/src/server/analytics.ts +15 -0
  89. package/src/server/auth.ts +17 -13
  90. package/src/server/better-auth-instance.ts +13 -1
  91. package/src/templates/default/package.json +1 -1
@@ -14,6 +14,7 @@ import { isTrustedFrameMessage } from "./frame.js";
14
14
  import { RunStuckBanner } from "./RunStuckBanner.js";
15
15
  import { callAction } from "./use-action.js";
16
16
  import { useChangeVersion } from "./use-change-version.js";
17
+ import { CHAT_MODEL_SELECTION_CHANGED_EVENT } from "./use-chat-models.js";
17
18
  import { useChatThreads, } from "./use-chat-threads.js";
18
19
  import { cn } from "./utils.js";
19
20
  /** The single path that hands a queued send to a mounted chat ref. */
@@ -66,6 +67,11 @@ function writeStoredModelSelection(key, selection) {
66
67
  return;
67
68
  try {
68
69
  window.localStorage.setItem(key, JSON.stringify(selection));
70
+ queueMicrotask(() => {
71
+ window.dispatchEvent(new CustomEvent(CHAT_MODEL_SELECTION_CHANGED_EVENT, {
72
+ detail: { key },
73
+ }));
74
+ });
69
75
  }
70
76
  catch { }
71
77
  }
@@ -520,6 +526,35 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
520
526
  const bumpModelSelectionVersion = useCallback(() => {
521
527
  setModelSelectionVersion((version) => version + 1);
522
528
  }, []);
529
+ useEffect(() => {
530
+ if (typeof window === "undefined")
531
+ return;
532
+ const syncPersistedSelection = (event) => {
533
+ const detail = event
534
+ ?.detail;
535
+ if (detail?.key && detail.key !== modelSelectionKey)
536
+ return;
537
+ const next = readStoredModelSelection(modelSelectionKey);
538
+ if (!next)
539
+ return;
540
+ const activeThreadId = activeThreadIdRef.current;
541
+ if (activeThreadId) {
542
+ threadModelRef.current.set(activeThreadId, next);
543
+ }
544
+ setPersistedModelSelection(next);
545
+ bumpModelSelectionVersion();
546
+ };
547
+ const handleStorage = (event) => {
548
+ if (event.key === modelSelectionKey)
549
+ syncPersistedSelection();
550
+ };
551
+ window.addEventListener(CHAT_MODEL_SELECTION_CHANGED_EVENT, syncPersistedSelection);
552
+ window.addEventListener("storage", handleStorage);
553
+ return () => {
554
+ window.removeEventListener(CHAT_MODEL_SELECTION_CHANGED_EVENT, syncPersistedSelection);
555
+ window.removeEventListener("storage", handleStorage);
556
+ };
557
+ }, [bumpModelSelectionVersion, modelSelectionKey]);
523
558
  const postMessageSubmissionsDisabled = props.composerDisabled === true;
524
559
  const setContextInTab = useCallback((threadId, item, options) => {
525
560
  const ref = chatRefs.current.get(threadId);