@agent-native/core 0.112.0 → 0.113.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.
- package/corpus/README.md +4 -2
- package/corpus/core/CHANGELOG.md +22 -0
- package/corpus/core/docs/AGENTS.md +7 -0
- package/corpus/core/docs/content/integrations.mdx +63 -2
- package/corpus/core/docs/design/provider-integration-authority.md +117 -0
- package/corpus/core/package.json +6 -1
- package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
- package/corpus/core/src/cli/atomic-json-file.ts +324 -0
- package/corpus/core/src/cli/claude-code-participant.ts +515 -0
- package/corpus/core/src/cli/code-agent-executor.ts +18 -10
- package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/corpus/core/src/cli/code-agent-runs.ts +55 -62
- package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
- package/corpus/core/src/cli/multi-frontier-runs.ts +1246 -135
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
- package/corpus/core/src/integrations/index.ts +10 -0
- package/corpus/core/src/integrations/slack-oauth.ts +1 -0
- package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
- package/corpus/core/src/notifications/channels.ts +4 -10
- package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
- package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
- package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
- package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
- package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
- package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
- package/corpus/core/src/provider-api/gong.ts +108 -0
- package/corpus/core/src/scripts/docs/source-search.ts +2 -1
- package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
- package/corpus/core/src/server/index.ts +6 -0
- package/corpus/core/src/styles/chat-history-list.css +1 -313
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/default/AGENTS.md +25 -18
- package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/headless/AGENTS.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
- package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
- package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
- package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/brain/actions/_schemas.ts +13 -7
- package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
- package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/brain/actions/update-source.ts +5 -1
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
- package/corpus/templates/brain/app/lib/brain.ts +55 -0
- package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
- package/corpus/templates/brain/server/lib/connectors.ts +53 -2
- package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
- package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
- package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
- package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
- package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/chat/AGENTS.md +5 -2
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/clips/AGENTS.md +11 -0
- package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
- package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
- package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
- package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
- package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
- package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
- package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
- package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/content/actions/provider-api-request.ts +3 -37
- package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/design/actions/provider-api-request.ts +140 -164
- package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
- package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
- package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/forms/server/lib/integrations.ts +23 -22
- package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
- package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/mail/server/handlers/gong.ts +6 -61
- package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
- package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +125 -0
- package/corpus/toolkit/README.md +60 -0
- package/corpus/toolkit/export-snapshot.json +35 -0
- package/corpus/toolkit/migration-manifest.json +4 -0
- package/corpus/toolkit/package.json +281 -0
- package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
- package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
- package/corpus/toolkit/src/app-shell/index.ts +1 -0
- package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
- package/corpus/toolkit/src/chat-history/index.ts +7 -0
- package/corpus/toolkit/src/chat-history.css +314 -0
- package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
- package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
- package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
- package/corpus/toolkit/src/collab-ui/index.ts +39 -0
- package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
- package/corpus/toolkit/src/collab-ui/types.ts +96 -0
- package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
- package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
- package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
- package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
- package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
- package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
- package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
- package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
- package/corpus/toolkit/src/composer/draft-key.ts +7 -0
- package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
- package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
- package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
- package/corpus/toolkit/src/composer/index.ts +79 -0
- package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
- package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
- package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
- package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
- package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
- package/corpus/toolkit/src/composer/types.ts +66 -0
- package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
- package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
- package/corpus/toolkit/src/composer/use-skills.ts +45 -0
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
- package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
- package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
- package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
- package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
- package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
- package/corpus/toolkit/src/context-ui/format.ts +42 -0
- package/corpus/toolkit/src/context-ui/index.ts +15 -0
- package/corpus/toolkit/src/context-ui/types.ts +43 -0
- package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
- package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
- package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
- package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
- package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
- package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
- package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
- package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
- package/corpus/toolkit/src/editor/RunId.ts +61 -0
- package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
- package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
- package/corpus/toolkit/src/editor/extensions.ts +402 -0
- package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
- package/corpus/toolkit/src/editor/index.ts +93 -0
- package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
- package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
- package/corpus/toolkit/src/editor.css +510 -0
- package/corpus/toolkit/src/hooks/index.ts +2 -0
- package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
- package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
- package/corpus/toolkit/src/index.ts +8 -0
- package/corpus/toolkit/src/onboarding/index.ts +1 -0
- package/corpus/toolkit/src/provider.tsx +47 -0
- package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
- package/corpus/toolkit/src/sharing/index.ts +4 -0
- package/corpus/toolkit/src/styles.css +21 -0
- package/corpus/toolkit/src/ui/accordion.tsx +56 -0
- package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
- package/corpus/toolkit/src/ui/alert.tsx +59 -0
- package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
- package/corpus/toolkit/src/ui/avatar.tsx +48 -0
- package/corpus/toolkit/src/ui/badge.tsx +37 -0
- package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
- package/corpus/toolkit/src/ui/button.tsx +78 -0
- package/corpus/toolkit/src/ui/calendar.tsx +214 -0
- package/corpus/toolkit/src/ui/card.tsx +86 -0
- package/corpus/toolkit/src/ui/carousel.tsx +260 -0
- package/corpus/toolkit/src/ui/chart.tsx +375 -0
- package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
- package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
- package/corpus/toolkit/src/ui/command.tsx +174 -0
- package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
- package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
- package/corpus/toolkit/src/ui/dialog.tsx +146 -0
- package/corpus/toolkit/src/ui/drawer.tsx +126 -0
- package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
- package/corpus/toolkit/src/ui/form.tsx +177 -0
- package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
- package/corpus/toolkit/src/ui/index.ts +52 -0
- package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
- package/corpus/toolkit/src/ui/input.tsx +22 -0
- package/corpus/toolkit/src/ui/label.tsx +24 -0
- package/corpus/toolkit/src/ui/logo.tsx +36 -0
- package/corpus/toolkit/src/ui/menubar.tsx +235 -0
- package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
- package/corpus/toolkit/src/ui/pagination.tsx +121 -0
- package/corpus/toolkit/src/ui/popover.tsx +44 -0
- package/corpus/toolkit/src/ui/progress.tsx +26 -0
- package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
- package/corpus/toolkit/src/ui/resizable.tsx +43 -0
- package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
- package/corpus/toolkit/src/ui/select.tsx +158 -0
- package/corpus/toolkit/src/ui/separator.tsx +29 -0
- package/corpus/toolkit/src/ui/sheet.tsx +160 -0
- package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
- package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
- package/corpus/toolkit/src/ui/slider.tsx +26 -0
- package/corpus/toolkit/src/ui/sonner.tsx +58 -0
- package/corpus/toolkit/src/ui/spinner.tsx +17 -0
- package/corpus/toolkit/src/ui/switch.tsx +27 -0
- package/corpus/toolkit/src/ui/table.tsx +117 -0
- package/corpus/toolkit/src/ui/tabs.tsx +53 -0
- package/corpus/toolkit/src/ui/textarea.tsx +23 -0
- package/corpus/toolkit/src/ui/toast.tsx +127 -0
- package/corpus/toolkit/src/ui/toaster.tsx +33 -0
- package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
- package/corpus/toolkit/src/ui/toggle.tsx +43 -0
- package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
- package/corpus/toolkit/src/ui/use-toast.ts +3 -0
- package/corpus/toolkit/src/utils.ts +8 -0
- package/corpus/toolkit/tsconfig.json +23 -0
- package/dist/cli/atomic-json-file.d.ts +30 -0
- package/dist/cli/atomic-json-file.d.ts.map +1 -0
- package/dist/cli/atomic-json-file.js +240 -0
- package/dist/cli/atomic-json-file.js.map +1 -0
- package/dist/cli/claude-code-participant.d.ts +77 -0
- package/dist/cli/claude-code-participant.d.ts.map +1 -0
- package/dist/cli/claude-code-participant.js +355 -0
- package/dist/cli/claude-code-participant.js.map +1 -0
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +18 -10
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +43 -56
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/codex-cli-participant.d.ts +77 -0
- package/dist/cli/codex-cli-participant.d.ts.map +1 -0
- package/dist/cli/codex-cli-participant.js +354 -0
- package/dist/cli/codex-cli-participant.js.map +1 -0
- package/dist/cli/multi-frontier-runs.d.ts +115 -0
- package/dist/cli/multi-frontier-runs.d.ts.map +1 -1
- package/dist/cli/multi-frontier-runs.js +831 -113
- package/dist/cli/multi-frontier-runs.js.map +1 -1
- package/dist/client/chat/ChatHistoryList.d.ts +1 -87
- package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
- package/dist/client/chat/ChatHistoryList.js +1 -82
- package/dist/client/chat/ChatHistoryList.js.map +1 -1
- package/dist/integrations/index.d.ts +2 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/slack-manifest.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts.map +1 -1
- package/dist/integrations/slack-oauth.js +1 -0
- package/dist/integrations/slack-oauth.js.map +1 -1
- package/dist/integrations/webhook-delivery.d.ts +23 -0
- package/dist/integrations/webhook-delivery.d.ts.map +1 -0
- package/dist/integrations/webhook-delivery.js +32 -0
- package/dist/integrations/webhook-delivery.js.map +1 -0
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +4 -9
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.js +154 -0
- package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
- package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
- package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
- package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.js +3 -40
- package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
- package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
- package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api-audit.js +74 -0
- package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
- package/dist/provider-api/actions/provider-api.d.ts +370 -0
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api.js +280 -0
- package/dist/provider-api/actions/provider-api.js.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.js +3 -116
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
- package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
- package/dist/provider-api/actions/staged-datasets.js +210 -0
- package/dist/provider-api/actions/staged-datasets.js.map +1 -0
- package/dist/provider-api/gong.d.ts +44 -0
- package/dist/provider-api/gong.d.ts.map +1 -0
- package/dist/provider-api/gong.js +56 -0
- package/dist/provider-api/gong.js.map +1 -0
- package/dist/scripts/docs/source-search.d.ts +2 -1
- package/dist/scripts/docs/source-search.d.ts.map +1 -1
- package/dist/scripts/docs/source-search.js +2 -1
- package/dist/scripts/docs/source-search.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/google-oauth-credentials.d.ts +35 -0
- package/dist/server/google-oauth-credentials.d.ts.map +1 -1
- package/dist/server/google-oauth-credentials.js +48 -2
- package/dist/server/google-oauth-credentials.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/styles/chat-history-list.css +1 -313
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/chat/AGENTS.md +5 -2
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/default/AGENTS.md +25 -18
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/headless/AGENTS.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/workspace-core/AGENTS.md +4 -0
- package/dist/templates/workspace-root/AGENTS.md +4 -0
- package/docs/AGENTS.md +7 -0
- package/docs/content/integrations.mdx +63 -2
- package/docs/design/provider-integration-authority.md +117 -0
- package/package.json +7 -2
- package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/chat/AGENTS.md +5 -2
- package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/default/AGENTS.md +25 -18
- package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/headless/AGENTS.md +7 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/workspace-core/AGENTS.md +4 -0
- package/src/templates/workspace-root/AGENTS.md +4 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Awareness } from "y-protocols/awareness";
|
|
2
|
+
import type { Doc as YDoc } from "yjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Back-compat surface for the shared rich markdown editor.
|
|
6
|
+
*
|
|
7
|
+
* The editor core now lives in dedicated modules:
|
|
8
|
+
* - {@link createSharedEditorExtensions} — the ONE extension factory.
|
|
9
|
+
* - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
|
|
10
|
+
* - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
|
|
11
|
+
* - {@link SharedRichEditor} — the editor component.
|
|
12
|
+
*
|
|
13
|
+
* This file keeps the historical `RichMarkdownEditor` component name (aliased to
|
|
14
|
+
* {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
|
|
15
|
+
* existing embedders and the round-trip / collab specs keep working unchanged.
|
|
16
|
+
*/
|
|
17
|
+
import {
|
|
18
|
+
createSharedEditorExtensions,
|
|
19
|
+
type RichMarkdownDialect,
|
|
20
|
+
type RichMarkdownEditorPreset,
|
|
21
|
+
type RichMarkdownCollabUser,
|
|
22
|
+
} from "./extensions.js";
|
|
23
|
+
import {
|
|
24
|
+
SharedRichEditor,
|
|
25
|
+
type SharedRichEditorProps,
|
|
26
|
+
} from "./SharedRichEditor.js";
|
|
27
|
+
|
|
28
|
+
export type {
|
|
29
|
+
RichMarkdownDialect,
|
|
30
|
+
RichMarkdownEditorPreset,
|
|
31
|
+
RichMarkdownCollabUser,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */
|
|
35
|
+
export interface CreateRichMarkdownExtensionsOptions {
|
|
36
|
+
dialect?: RichMarkdownDialect;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Yjs document for collaborative editing. When present, the editor binds the
|
|
40
|
+
* shared Collaboration + CollaborationCaret extensions and StarterKit's
|
|
41
|
+
* built-in undo/redo is disabled (Yjs owns history).
|
|
42
|
+
*/
|
|
43
|
+
ydoc?: YDoc | null;
|
|
44
|
+
/** Shared awareness instance for live multi-user cursors. */
|
|
45
|
+
awareness?: Awareness | null;
|
|
46
|
+
/** Current user info for the collaborative cursor label. */
|
|
47
|
+
user?: RichMarkdownCollabUser | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
|
|
52
|
+
* in terms of {@link createSharedEditorExtensions}: it maps the flat
|
|
53
|
+
* `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
|
|
54
|
+
* shared factory expects. The round-trip and collab specs build their `Editor`
|
|
55
|
+
* from this, so its output must stay byte-stable.
|
|
56
|
+
*/
|
|
57
|
+
export function createRichMarkdownExtensions({
|
|
58
|
+
dialect = "gfm",
|
|
59
|
+
placeholder = "Type '/' for commands...",
|
|
60
|
+
ydoc = null,
|
|
61
|
+
awareness = null,
|
|
62
|
+
user = null,
|
|
63
|
+
}: CreateRichMarkdownExtensionsOptions = {}) {
|
|
64
|
+
return createSharedEditorExtensions({
|
|
65
|
+
dialect,
|
|
66
|
+
placeholder,
|
|
67
|
+
collab: ydoc ? { ydoc, awareness, user } : null,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @deprecated Prefer {@link SharedRichEditorProps}. */
|
|
72
|
+
export type RichMarkdownEditorProps = SharedRichEditorProps;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Historical name for {@link SharedRichEditor}. Kept so existing imports
|
|
76
|
+
* (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
|
|
77
|
+
* plan editor tests (which assert the source mentions `RichMarkdownEditor`)
|
|
78
|
+
* keep working through the Core compatibility re-export. New code should import
|
|
79
|
+
* `SharedRichEditor` from `@agent-native/toolkit/editor`.
|
|
80
|
+
*/
|
|
81
|
+
export const RichMarkdownEditor = SharedRichEditor;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Node types that carry the optional `runId` attribute.
|
|
5
|
+
*
|
|
6
|
+
* These are exactly the top-level block nodes a plan's `rich-text` block can
|
|
7
|
+
* serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
|
|
8
|
+
* FIRST node of each rich-text run so a re-parse can map the run back to its
|
|
9
|
+
* originating block id (stable ids across edits). Atom/structured blocks live
|
|
10
|
+
* in their own `planBlock` node and do not need this attribute.
|
|
11
|
+
*/
|
|
12
|
+
export const RUN_ID_NODE_TYPES = [
|
|
13
|
+
"paragraph",
|
|
14
|
+
"heading",
|
|
15
|
+
"bulletList",
|
|
16
|
+
"orderedList",
|
|
17
|
+
"taskList",
|
|
18
|
+
"blockquote",
|
|
19
|
+
"codeBlock",
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
|
|
24
|
+
* block node types in {@link RUN_ID_NODE_TYPES}.
|
|
25
|
+
*
|
|
26
|
+
* - `renderHTML` emits `data-run-id` only when the attribute is set, so the
|
|
27
|
+
* live editor's DOM carries the id for the doc↔blocks bridge.
|
|
28
|
+
* - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
|
|
29
|
+
* - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
|
|
30
|
+
* `tiptap-markdown` drops attributes it has no serializer for, so we simply
|
|
31
|
+
* don't register a markdown serializer here — the attribute is invisible to
|
|
32
|
+
* the GFM round-trip and only lives in the ProseMirror JSON / DOM.
|
|
33
|
+
*
|
|
34
|
+
* Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
|
|
35
|
+
* schema is identical on both sides of the bridge.
|
|
36
|
+
*/
|
|
37
|
+
export const RunId = Extension.create({
|
|
38
|
+
name: "runId",
|
|
39
|
+
|
|
40
|
+
addGlobalAttributes() {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
types: [...RUN_ID_NODE_TYPES],
|
|
44
|
+
attributes: {
|
|
45
|
+
runId: {
|
|
46
|
+
default: null,
|
|
47
|
+
// Read the id off the rendered DOM so paste / re-parse round-trips.
|
|
48
|
+
parseHTML: (element) => element.getAttribute("data-run-id"),
|
|
49
|
+
// Only emit the attribute when set; an unset (null) runId adds
|
|
50
|
+
// nothing to the DOM so untouched nodes stay clean.
|
|
51
|
+
renderHTML: (attributes) => {
|
|
52
|
+
const runId = (attributes as { runId?: string | null }).runId;
|
|
53
|
+
if (!runId) return {};
|
|
54
|
+
return { "data-run-id": runId };
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import type { Extension, Node, Mark } from "@tiptap/core";
|
|
2
|
+
import { EditorContent, useEditor } from "@tiptap/react";
|
|
3
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
4
|
+
import type { Awareness } from "y-protocols/awareness";
|
|
5
|
+
import type { Doc as YDoc } from "yjs";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../utils.js";
|
|
8
|
+
import { BubbleToolbar, type BubbleToolbarItem } from "./BubbleToolbar.js";
|
|
9
|
+
import {
|
|
10
|
+
createSharedEditorExtensions,
|
|
11
|
+
type RichMarkdownDialect,
|
|
12
|
+
type RichMarkdownEditorPreset,
|
|
13
|
+
type RichMarkdownCollabUser,
|
|
14
|
+
type SharedEditorFeatures,
|
|
15
|
+
} from "./extensions.js";
|
|
16
|
+
import type { ImageUploadFn } from "./ImageExtension.js";
|
|
17
|
+
import { SlashCommandMenu, type SlashCommandItem } from "./SlashCommandMenu.js";
|
|
18
|
+
import {
|
|
19
|
+
useCollabReconcile,
|
|
20
|
+
getEditorMarkdown,
|
|
21
|
+
type UseCollabReconcileResult,
|
|
22
|
+
type UseCollabReconcileOptions,
|
|
23
|
+
} from "./useCollabReconcile.js";
|
|
24
|
+
|
|
25
|
+
export interface SharedRichEditorProps {
|
|
26
|
+
value: string;
|
|
27
|
+
onChange: (markdown: string) => void;
|
|
28
|
+
onBlur?: () => void;
|
|
29
|
+
contentUpdatedAt?: string | null;
|
|
30
|
+
editable?: boolean;
|
|
31
|
+
dialect?: RichMarkdownDialect;
|
|
32
|
+
preset?: RichMarkdownEditorPreset;
|
|
33
|
+
/** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */
|
|
34
|
+
features?: SharedEditorFeatures;
|
|
35
|
+
/**
|
|
36
|
+
* Injectable image uploader for the shared image block. Used only when
|
|
37
|
+
* `features.image` is on. Pass `uploadEditorImage` (the framework
|
|
38
|
+
* `upload-image` action) for a real uploading image block.
|
|
39
|
+
*/
|
|
40
|
+
onImageUpload?: ImageUploadFn | null;
|
|
41
|
+
/**
|
|
42
|
+
* App-specific extensions (Notion nodes, media, drag handles, comment
|
|
43
|
+
* anchors, …) appended after the shared base schema.
|
|
44
|
+
*/
|
|
45
|
+
extraExtensions?: Array<Extension | Node | Mark>;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
editorClassName?: string;
|
|
49
|
+
ariaLabel?: string;
|
|
50
|
+
interactive?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Yjs document for real-time multi-user editing. When provided, prose is
|
|
53
|
+
* authored against the shared Y.Doc and mirrored back to `value` as markdown
|
|
54
|
+
* (still the source of truth). When omitted, the editor is a plain controlled
|
|
55
|
+
* `value`/`onChange` editor — the existing, non-collaborative behavior.
|
|
56
|
+
*/
|
|
57
|
+
ydoc?: YDoc | null;
|
|
58
|
+
/** True after the collab provider has loaded persisted Y.Doc state. */
|
|
59
|
+
collabSynced?: boolean;
|
|
60
|
+
/** Shared awareness instance for live cursors/presence. */
|
|
61
|
+
awareness?: Awareness | null;
|
|
62
|
+
/** Current user info for the collaborative cursor label. */
|
|
63
|
+
user?: RichMarkdownCollabUser | null;
|
|
64
|
+
/**
|
|
65
|
+
* Disable StarterKit's built-in undo/redo for a controlled (non-collab)
|
|
66
|
+
* editor whose host owns its own undo authority (see
|
|
67
|
+
* {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a
|
|
68
|
+
* `ydoc` is present (Yjs always owns history then). Default `false`, so every
|
|
69
|
+
* existing embedder is unchanged.
|
|
70
|
+
*/
|
|
71
|
+
disableHistory?: boolean;
|
|
72
|
+
/** Override the slash-menu block command list. */
|
|
73
|
+
slashItems?: SlashCommandItem[];
|
|
74
|
+
/** Override the bubble-toolbar item builder. */
|
|
75
|
+
buildBubbleItems?: (
|
|
76
|
+
editor: import("@tiptap/react").Editor,
|
|
77
|
+
toggleLink: () => void,
|
|
78
|
+
) => BubbleToolbarItem[];
|
|
79
|
+
/**
|
|
80
|
+
* Override how the editor's content is read into the canonical `value`.
|
|
81
|
+
* Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk
|
|
82
|
+
* format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so
|
|
83
|
+
* seed/reconcile/onChange all speak the same value space.
|
|
84
|
+
*/
|
|
85
|
+
getMarkdown?: (editor: import("@tiptap/react").Editor) => string;
|
|
86
|
+
/** Override how the canonical `value` is applied into the editor (seed + reconcile). */
|
|
87
|
+
setContent?: (
|
|
88
|
+
editor: import("@tiptap/react").Editor,
|
|
89
|
+
value: string,
|
|
90
|
+
options: { emitUpdate?: boolean; addToHistory?: boolean },
|
|
91
|
+
) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Optional parser for surgical reconcile. Custom value formats that already
|
|
94
|
+
* handle surgical writes inside `setContent` can pass `false` so the default
|
|
95
|
+
* markdown parser never treats their source bytes as literal markdown.
|
|
96
|
+
*/
|
|
97
|
+
parseValue?: UseCollabReconcileOptions["parseValue"];
|
|
98
|
+
/** Canonicalize `value` for the echo / already-in-sync equality checks. */
|
|
99
|
+
normalizeValue?: (value: string) => string;
|
|
100
|
+
/** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */
|
|
101
|
+
shouldSeed?: (info: {
|
|
102
|
+
value: string;
|
|
103
|
+
currentMarkdown: string;
|
|
104
|
+
fragmentLength: number;
|
|
105
|
+
}) => boolean;
|
|
106
|
+
/** Initial "applied" watermark (see {@link useCollabReconcile}). */
|
|
107
|
+
initialAppliedUpdatedAt?: string | null;
|
|
108
|
+
/** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */
|
|
109
|
+
wrapperClassName?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Fires once the editor instance exists. Lets a host capture the root
|
|
112
|
+
* `editor.view` — e.g. to repaint the WHOLE document after a structural block
|
|
113
|
+
* move (a column emptied and its container dissolved) that a surgical
|
|
114
|
+
* per-region patch can't express, since the change is in the root doc itself.
|
|
115
|
+
*/
|
|
116
|
+
onEditorReady?: (editor: import("@tiptap/react").Editor) => void;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The single shared rich markdown editor surface. Combines
|
|
121
|
+
* {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +
|
|
122
|
+
* optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /
|
|
123
|
+
* lead-client logic), and the shared {@link SlashCommandMenu} +
|
|
124
|
+
* {@link BubbleToolbar}.
|
|
125
|
+
*
|
|
126
|
+
* With no `ydoc` it is a controlled `value`/`onChange` single-user editor.
|
|
127
|
+
* With a `ydoc` it binds the framework collaboration stack; markdown stays the
|
|
128
|
+
* canonical saved representation while the Y.Doc is transient live state.
|
|
129
|
+
*/
|
|
130
|
+
export function SharedRichEditor({
|
|
131
|
+
value,
|
|
132
|
+
onChange,
|
|
133
|
+
onBlur,
|
|
134
|
+
contentUpdatedAt,
|
|
135
|
+
editable = true,
|
|
136
|
+
dialect = "gfm",
|
|
137
|
+
preset = "plan",
|
|
138
|
+
features,
|
|
139
|
+
onImageUpload = null,
|
|
140
|
+
extraExtensions,
|
|
141
|
+
placeholder = "Type '/' for commands...",
|
|
142
|
+
className,
|
|
143
|
+
editorClassName,
|
|
144
|
+
ariaLabel,
|
|
145
|
+
interactive = editable,
|
|
146
|
+
ydoc = null,
|
|
147
|
+
collabSynced = true,
|
|
148
|
+
awareness = null,
|
|
149
|
+
user = null,
|
|
150
|
+
disableHistory = false,
|
|
151
|
+
slashItems,
|
|
152
|
+
buildBubbleItems,
|
|
153
|
+
getMarkdown,
|
|
154
|
+
setContent,
|
|
155
|
+
parseValue,
|
|
156
|
+
normalizeValue,
|
|
157
|
+
shouldSeed,
|
|
158
|
+
initialAppliedUpdatedAt,
|
|
159
|
+
wrapperClassName,
|
|
160
|
+
onEditorReady,
|
|
161
|
+
}: SharedRichEditorProps) {
|
|
162
|
+
const readMarkdown = getMarkdown ?? getEditorMarkdown;
|
|
163
|
+
const onChangeRef = useRef(onChange);
|
|
164
|
+
const onBlurRef = useRef(onBlur);
|
|
165
|
+
onChangeRef.current = onChange;
|
|
166
|
+
onBlurRef.current = onBlur;
|
|
167
|
+
|
|
168
|
+
const extensions = useMemo(
|
|
169
|
+
() =>
|
|
170
|
+
createSharedEditorExtensions({
|
|
171
|
+
dialect,
|
|
172
|
+
preset,
|
|
173
|
+
placeholder,
|
|
174
|
+
features,
|
|
175
|
+
extraExtensions,
|
|
176
|
+
onImageUpload,
|
|
177
|
+
collab: ydoc ? { ydoc, awareness, user } : null,
|
|
178
|
+
disableHistory,
|
|
179
|
+
}),
|
|
180
|
+
// `preset` is retained in the dependency list so future preset-specific
|
|
181
|
+
// schema branches re-create the editor; it is currently schema-neutral. The
|
|
182
|
+
// collab inputs are identity-stable per block (one Y.Doc per docId), so they
|
|
183
|
+
// only change on a genuine doc switch — exactly when the editor must
|
|
184
|
+
// re-create to rebind Collaboration.
|
|
185
|
+
[
|
|
186
|
+
dialect,
|
|
187
|
+
placeholder,
|
|
188
|
+
preset,
|
|
189
|
+
features,
|
|
190
|
+
extraExtensions,
|
|
191
|
+
onImageUpload,
|
|
192
|
+
ydoc,
|
|
193
|
+
awareness,
|
|
194
|
+
user?.name,
|
|
195
|
+
user?.email,
|
|
196
|
+
user?.color,
|
|
197
|
+
disableHistory,
|
|
198
|
+
],
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const collab = !!ydoc;
|
|
202
|
+
|
|
203
|
+
// The collab hook needs the editor, but useEditor's `onUpdate` needs the
|
|
204
|
+
// hook's guards. Break the cycle with a ref: `onUpdate` reads the guards
|
|
205
|
+
// through `guardsRef`, which is populated right after the hook runs below.
|
|
206
|
+
// `onUpdate` only ever fires after the editor exists, by which point the ref
|
|
207
|
+
// holds the real guards.
|
|
208
|
+
const guardsRef = useRef<UseCollabReconcileResult | null>(null);
|
|
209
|
+
|
|
210
|
+
const editor = useEditor(
|
|
211
|
+
{
|
|
212
|
+
extensions,
|
|
213
|
+
// With Collaboration active the prose is owned by the shared Y.XmlFragment.
|
|
214
|
+
// Seeding `content` here too would make the editor initialize from BOTH the
|
|
215
|
+
// prop and the Y.Doc, firing a spurious initial update that could autosave a
|
|
216
|
+
// stale value over newer SQL. The lead-client seed effect populates an empty
|
|
217
|
+
// doc instead. Non-collab editors keep initializing from `value`.
|
|
218
|
+
// With Collaboration the Y.Doc owns the prose (seeded by the lead client).
|
|
219
|
+
// With a custom `setContent` the reconcile seeds the editor too (the raw
|
|
220
|
+
// `value` is not directly settable content — e.g. the plan's blocks JSON),
|
|
221
|
+
// so only the plain markdown path seeds from `value` here.
|
|
222
|
+
content: collab || setContent ? null : value,
|
|
223
|
+
editable,
|
|
224
|
+
editorProps: {
|
|
225
|
+
attributes: {
|
|
226
|
+
class: cn("an-rich-md-prose", editorClassName),
|
|
227
|
+
...(ariaLabel ? { role: "textbox", "aria-label": ariaLabel } : {}),
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
onUpdate: ({ editor, transaction }) => {
|
|
231
|
+
const guards = guardsRef.current;
|
|
232
|
+
if (!guards || guards.shouldIgnoreUpdate(transaction)) return;
|
|
233
|
+
try {
|
|
234
|
+
const markdown = readMarkdown(editor);
|
|
235
|
+
if (!guards.registerEmitted(markdown)) return;
|
|
236
|
+
queueMicrotask(() => onChangeRef.current(markdown));
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.error("Markdown serialization error:", error);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
onBlur: () => {
|
|
242
|
+
onBlurRef.current?.();
|
|
243
|
+
},
|
|
244
|
+
// Recreate the editor when the shared Y.Doc identity changes — including
|
|
245
|
+
// null → doc. Extensions are baked in at creation, so a ydoc that arrives
|
|
246
|
+
// AFTER the first mount (fresh page load: the session/user resolves after
|
|
247
|
+
// the editor mounts) would otherwise never bind Collaboration: the editor
|
|
248
|
+
// looks fine but produces no Yjs updates and never receives peers' edits.
|
|
249
|
+
},
|
|
250
|
+
[ydoc],
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const collabState = useCollabReconcile({
|
|
254
|
+
editor,
|
|
255
|
+
ydoc,
|
|
256
|
+
collabSynced,
|
|
257
|
+
awareness,
|
|
258
|
+
value,
|
|
259
|
+
contentUpdatedAt,
|
|
260
|
+
editable,
|
|
261
|
+
getMarkdown: readMarkdown,
|
|
262
|
+
setContent,
|
|
263
|
+
parseValue,
|
|
264
|
+
normalizeValue,
|
|
265
|
+
shouldSeed,
|
|
266
|
+
initialAppliedUpdatedAt,
|
|
267
|
+
});
|
|
268
|
+
guardsRef.current = collabState;
|
|
269
|
+
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
if (!editor || editor.isDestroyed) return;
|
|
272
|
+
editor.setEditable(editable);
|
|
273
|
+
}, [editable, editor]);
|
|
274
|
+
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
if (editor) onEditorReady?.(editor);
|
|
277
|
+
}, [editor, onEditorReady]);
|
|
278
|
+
|
|
279
|
+
useEffect(() => () => editor?.destroy(), [editor]);
|
|
280
|
+
|
|
281
|
+
const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
282
|
+
if (!editable || !editor || editor.isDestroyed) return;
|
|
283
|
+
const target = event.target as HTMLElement;
|
|
284
|
+
if (
|
|
285
|
+
target.classList.contains("an-rich-md-wrapper") ||
|
|
286
|
+
target.classList.contains("an-rich-md-clickable")
|
|
287
|
+
) {
|
|
288
|
+
editor.chain().focus("end").run();
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
if (!editor) {
|
|
293
|
+
return (
|
|
294
|
+
<div
|
|
295
|
+
className={cn("an-rich-md-wrapper an-rich-md-loading", className)}
|
|
296
|
+
data-plan-interactive={interactive ? true : undefined}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div
|
|
303
|
+
className={cn(
|
|
304
|
+
"an-rich-md-wrapper an-rich-md-clickable",
|
|
305
|
+
!editable && "an-rich-md-wrapper--readonly",
|
|
306
|
+
wrapperClassName,
|
|
307
|
+
className,
|
|
308
|
+
)}
|
|
309
|
+
onClick={handleWrapperClick}
|
|
310
|
+
data-plan-interactive={interactive ? true : undefined}
|
|
311
|
+
>
|
|
312
|
+
{editable ? (
|
|
313
|
+
<BubbleToolbar editor={editor} buildItems={buildBubbleItems} />
|
|
314
|
+
) : null}
|
|
315
|
+
{editable ? (
|
|
316
|
+
<SlashCommandMenu editor={editor} items={slashItems} />
|
|
317
|
+
) : null}
|
|
318
|
+
<EditorContent editor={editor} />
|
|
319
|
+
</div>
|
|
320
|
+
);
|
|
321
|
+
}
|