@agent-native/core 0.111.4 → 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 +34 -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 +8 -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 +35 -15
- package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/corpus/core/src/cli/code-agent-runs.ts +70 -36
- package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
- package/corpus/core/src/cli/multi-frontier-runs.ts +1952 -0
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
- package/corpus/core/src/coding-tools/index.ts +27 -8
- package/corpus/core/src/embeddings/index.ts +233 -0
- package/corpus/core/src/index.ts +2 -0
- 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/search/index.ts +413 -0
- 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/brain/RUNBOOK.md +48 -5
- package/corpus/templates/brain/.agents/skills/brain/SKILL.md +46 -14
- 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/README.md +34 -3
- package/corpus/templates/brain/actions/_schemas.ts +13 -7
- package/corpus/templates/brain/actions/approve-proposal.ts +2 -0
- package/corpus/templates/brain/actions/claim-distillation.ts +24 -27
- package/corpus/templates/brain/actions/create-source.ts +1 -1
- package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/brain/actions/get-knowledge.ts +6 -2
- package/corpus/templates/brain/actions/get-pilot-report.ts +44 -8
- package/corpus/templates/brain/actions/import-capture.ts +21 -9
- package/corpus/templates/brain/actions/import-transcript.ts +42 -14
- package/corpus/templates/brain/actions/list-captures.ts +10 -1
- package/corpus/templates/brain/actions/list-distillation-queue.ts +39 -14
- package/corpus/templates/brain/actions/list-projects.ts +51 -0
- package/corpus/templates/brain/actions/list-proposals.ts +80 -4
- package/corpus/templates/brain/actions/list-sources.ts +17 -3
- package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/brain/actions/manage-project.ts +118 -0
- package/corpus/templates/brain/actions/mark-capture-distilled.ts +68 -20
- package/corpus/templates/brain/actions/navigate.ts +1 -0
- 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/reject-proposal.ts +6 -1
- package/corpus/templates/brain/actions/resanitize-captures.ts +159 -33
- package/corpus/templates/brain/actions/review-proposal.ts +2 -0
- package/corpus/templates/brain/actions/search-everything.ts +10 -1
- package/corpus/templates/brain/actions/search-knowledge.ts +1 -1
- package/corpus/templates/brain/actions/set-settings.ts +36 -1
- package/corpus/templates/brain/actions/update-proposal.ts +2 -0
- 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/hooks/use-distillation-bridge.ts +18 -9
- package/corpus/templates/brain/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/brain/app/i18n-data.ts +731 -2
- package/corpus/templates/brain/app/lib/brain.ts +88 -1
- package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
- package/corpus/templates/brain/app/routes/ops.tsx +47 -0
- package/corpus/templates/brain/app/routes/review.tsx +41 -2
- package/corpus/templates/brain/app/routes/search.tsx +33 -2
- package/corpus/templates/brain/app/routes/settings.tsx +158 -0
- package/corpus/templates/brain/app/routes/sources.tsx +31 -0
- package/corpus/templates/brain/changelog/2026-07-19-added-private-source-safe-semantic-search.md +6 -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/jobs/process-ingest-queue.ts +270 -36
- package/corpus/templates/brain/package.json +1 -0
- package/corpus/templates/brain/server/db/index.ts +18 -0
- package/corpus/templates/brain/server/db/schema.ts +197 -1
- package/corpus/templates/brain/server/jobs/distillation-queue.ts +12 -5
- package/corpus/templates/brain/server/lib/audiences.ts +708 -0
- package/corpus/templates/brain/server/lib/brain-health.ts +251 -38
- package/corpus/templates/brain/server/lib/brain.ts +877 -50
- package/corpus/templates/brain/server/lib/capture-sanitization.ts +217 -53
- package/corpus/templates/brain/server/lib/connectors.ts +609 -72
- package/corpus/templates/brain/server/lib/demo.ts +17 -4
- package/corpus/templates/brain/server/lib/hybrid-search.ts +363 -0
- package/corpus/templates/brain/server/lib/ingest-queue.ts +104 -0
- package/corpus/templates/brain/server/lib/privacy-readiness.ts +24 -0
- package/corpus/templates/brain/server/lib/search-index-contracts.ts +72 -0
- package/corpus/templates/brain/server/lib/search-index.ts +714 -0
- package/corpus/templates/brain/server/lib/search.ts +120 -4
- package/corpus/templates/brain/server/lib/sensitivity-policy.ts +174 -0
- package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
- package/corpus/templates/brain/server/lib/slack-events.ts +281 -0
- package/corpus/templates/brain/server/onboarding.ts +29 -0
- package/corpus/templates/brain/server/plugins/db.ts +204 -0
- package/corpus/templates/brain/server/register-secrets.ts +46 -0
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/ingest.post.ts +36 -16
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/slack-events.post.ts +28 -0
- package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
- package/corpus/templates/brain/shared/types.ts +10 -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 +8 -9
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +27 -13
- 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 +5 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +51 -33
- 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 +246 -0
- package/dist/cli/multi-frontier-runs.d.ts.map +1 -0
- package/dist/cli/multi-frontier-runs.js +1247 -0
- package/dist/cli/multi-frontier-runs.js.map +1 -0
- 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/coding-tools/index.d.ts +1 -0
- package/dist/coding-tools/index.d.ts.map +1 -1
- package/dist/coding-tools/index.js +25 -7
- package/dist/coding-tools/index.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/embeddings/index.d.ts +24 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +172 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.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/progress/routes.d.ts +1 -1
- 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/resources/handlers.d.ts +1 -1
- 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/search/index.d.ts +88 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +267 -0
- package/dist/search/index.js.map +1 -0
- 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 +9 -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,253 @@
|
|
|
1
|
+
import { TextSelection } from "@tiptap/pm/state";
|
|
2
|
+
import type { Editor } from "@tiptap/react";
|
|
3
|
+
import { useEffect, useState, type CSSProperties } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../utils.js";
|
|
6
|
+
|
|
7
|
+
/** A bubble-toolbar button or a divider. */
|
|
8
|
+
export type BubbleToolbarItem =
|
|
9
|
+
| {
|
|
10
|
+
/** Short label/glyph shown on the button. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Accessible/title text. */
|
|
13
|
+
title: string;
|
|
14
|
+
action: () => void;
|
|
15
|
+
isActive: () => boolean;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
| { type: "divider" };
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Builds the default selection-toolbar items (Plan's current set): bold,
|
|
22
|
+
* italic, strike, code, headings 1-3, and a link toggle. `toggleLink` is
|
|
23
|
+
* supplied by the toolbar so the link-editor input can be opened.
|
|
24
|
+
*/
|
|
25
|
+
export function buildDefaultBubbleItems(
|
|
26
|
+
editor: Editor,
|
|
27
|
+
toggleLink: () => void,
|
|
28
|
+
): BubbleToolbarItem[] {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
label: "B",
|
|
32
|
+
title: "Bold",
|
|
33
|
+
action: () => editor.chain().focus().toggleBold().run(),
|
|
34
|
+
isActive: () => editor.isActive("bold"),
|
|
35
|
+
style: { fontWeight: 700 },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "I",
|
|
39
|
+
title: "Italic",
|
|
40
|
+
action: () => editor.chain().focus().toggleItalic().run(),
|
|
41
|
+
isActive: () => editor.isActive("italic"),
|
|
42
|
+
style: { fontStyle: "italic" },
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "S",
|
|
46
|
+
title: "Strikethrough",
|
|
47
|
+
action: () => editor.chain().focus().toggleStrike().run(),
|
|
48
|
+
isActive: () => editor.isActive("strike"),
|
|
49
|
+
style: { textDecoration: "line-through" },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "<>",
|
|
53
|
+
title: "Code",
|
|
54
|
+
action: () => editor.chain().focus().toggleCode().run(),
|
|
55
|
+
isActive: () => editor.isActive("code"),
|
|
56
|
+
style: { fontFamily: "monospace", fontSize: 11 },
|
|
57
|
+
},
|
|
58
|
+
{ type: "divider" },
|
|
59
|
+
{
|
|
60
|
+
label: "H1",
|
|
61
|
+
title: "Heading 1",
|
|
62
|
+
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
63
|
+
isActive: () => editor.isActive("heading", { level: 1 }),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "H2",
|
|
67
|
+
title: "Heading 2",
|
|
68
|
+
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
69
|
+
isActive: () => editor.isActive("heading", { level: 2 }),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: "H3",
|
|
73
|
+
title: "Heading 3",
|
|
74
|
+
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
75
|
+
isActive: () => editor.isActive("heading", { level: 3 }),
|
|
76
|
+
},
|
|
77
|
+
{ type: "divider" },
|
|
78
|
+
{
|
|
79
|
+
label: "Link",
|
|
80
|
+
title: "Link",
|
|
81
|
+
action: toggleLink,
|
|
82
|
+
isActive: () => editor.isActive("link"),
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface BubbleToolbarProps {
|
|
88
|
+
editor: Editor;
|
|
89
|
+
/**
|
|
90
|
+
* Custom item builder. Receives the editor and the `toggleLink` helper (so a
|
|
91
|
+
* custom set can still open the built-in link editor). Defaults to
|
|
92
|
+
* {@link buildDefaultBubbleItems}.
|
|
93
|
+
*/
|
|
94
|
+
buildItems?: (editor: Editor, toggleLink: () => void) => BubbleToolbarItem[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The shared floating selection toolbar. Tracks the current text selection and
|
|
99
|
+
* positions a fixed toolbar above it, with an inline link editor. Extracted
|
|
100
|
+
* from the inline plan toolbar so embedders share one implementation; apps swap
|
|
101
|
+
* the item set via `buildItems`.
|
|
102
|
+
*/
|
|
103
|
+
export function BubbleToolbar({
|
|
104
|
+
editor,
|
|
105
|
+
buildItems = buildDefaultBubbleItems,
|
|
106
|
+
}: BubbleToolbarProps) {
|
|
107
|
+
const [visible, setVisible] = useState(false);
|
|
108
|
+
const [coords, setCoords] = useState({ top: 0, left: 0 });
|
|
109
|
+
const [showLinkInput, setShowLinkInput] = useState(false);
|
|
110
|
+
const [linkUrl, setLinkUrl] = useState("");
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const update = () => {
|
|
114
|
+
const selectionState = editor.state.selection;
|
|
115
|
+
const { from, to } = selectionState;
|
|
116
|
+
const selection = window.getSelection();
|
|
117
|
+
const selectionInsideEditor =
|
|
118
|
+
!!selection?.anchorNode &&
|
|
119
|
+
!!selection.focusNode &&
|
|
120
|
+
editor.view.dom.contains(selection.anchorNode) &&
|
|
121
|
+
editor.view.dom.contains(selection.focusNode);
|
|
122
|
+
if (
|
|
123
|
+
!(selectionState instanceof TextSelection) ||
|
|
124
|
+
from === to ||
|
|
125
|
+
!selectionInsideEditor
|
|
126
|
+
) {
|
|
127
|
+
setVisible(false);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!selection || selection.rangeCount === 0) {
|
|
131
|
+
setVisible(false);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const rect = selection.getRangeAt(0).getBoundingClientRect();
|
|
135
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
136
|
+
setVisible(false);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
setCoords({
|
|
140
|
+
top: rect.top - 8,
|
|
141
|
+
left: rect.left + rect.width / 2,
|
|
142
|
+
});
|
|
143
|
+
setVisible(true);
|
|
144
|
+
};
|
|
145
|
+
editor.on("selectionUpdate", update);
|
|
146
|
+
editor.on("transaction", update);
|
|
147
|
+
document.addEventListener("selectionchange", update);
|
|
148
|
+
const onBlur = () => {
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
if (!editor.isFocused) setVisible(false);
|
|
151
|
+
}, 140);
|
|
152
|
+
};
|
|
153
|
+
editor.on("blur", onBlur);
|
|
154
|
+
return () => {
|
|
155
|
+
editor.off("selectionUpdate", update);
|
|
156
|
+
editor.off("transaction", update);
|
|
157
|
+
document.removeEventListener("selectionchange", update);
|
|
158
|
+
editor.off("blur", onBlur);
|
|
159
|
+
};
|
|
160
|
+
}, [editor]);
|
|
161
|
+
|
|
162
|
+
const handleSetLink = () => {
|
|
163
|
+
if (linkUrl.trim()) {
|
|
164
|
+
editor
|
|
165
|
+
.chain()
|
|
166
|
+
.focus()
|
|
167
|
+
.extendMarkRange("link")
|
|
168
|
+
.setLink({ href: linkUrl.trim() })
|
|
169
|
+
.run();
|
|
170
|
+
} else {
|
|
171
|
+
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
172
|
+
}
|
|
173
|
+
setShowLinkInput(false);
|
|
174
|
+
setLinkUrl("");
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const toggleLink = () => {
|
|
178
|
+
if (editor.isActive("link")) {
|
|
179
|
+
editor.chain().focus().unsetLink().run();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
setLinkUrl(editor.getAttributes("link").href || "");
|
|
183
|
+
setShowLinkInput(true);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const items = buildItems(editor, toggleLink);
|
|
187
|
+
|
|
188
|
+
if (!visible) return null;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div
|
|
192
|
+
className="an-rich-md-bubble-toolbar"
|
|
193
|
+
style={{
|
|
194
|
+
position: "fixed",
|
|
195
|
+
top: coords.top,
|
|
196
|
+
left: coords.left,
|
|
197
|
+
transform: "translate(-50%, -100%)",
|
|
198
|
+
}}
|
|
199
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
200
|
+
data-plan-interactive
|
|
201
|
+
>
|
|
202
|
+
{showLinkInput ? (
|
|
203
|
+
<div className="an-rich-md-link-editor">
|
|
204
|
+
<input
|
|
205
|
+
autoFocus
|
|
206
|
+
type="url"
|
|
207
|
+
placeholder="Paste link..."
|
|
208
|
+
value={linkUrl}
|
|
209
|
+
onChange={(event) => setLinkUrl(event.target.value)}
|
|
210
|
+
onKeyDown={(event) => {
|
|
211
|
+
if (event.key === "Enter") handleSetLink();
|
|
212
|
+
if (event.key === "Escape") {
|
|
213
|
+
setShowLinkInput(false);
|
|
214
|
+
setLinkUrl("");
|
|
215
|
+
}
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
<button type="button" onClick={handleSetLink}>
|
|
219
|
+
Apply
|
|
220
|
+
</button>
|
|
221
|
+
</div>
|
|
222
|
+
) : (
|
|
223
|
+
<div className="an-rich-md-bubble-items">
|
|
224
|
+
{items.map((item, index) => {
|
|
225
|
+
if ("type" in item) {
|
|
226
|
+
return (
|
|
227
|
+
<span
|
|
228
|
+
key={`divider-${index}`}
|
|
229
|
+
className="an-rich-md-bubble-divider"
|
|
230
|
+
/>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return (
|
|
234
|
+
<button
|
|
235
|
+
key={item.title}
|
|
236
|
+
type="button"
|
|
237
|
+
title={item.title}
|
|
238
|
+
className={cn(
|
|
239
|
+
"an-rich-md-bubble-button",
|
|
240
|
+
item.isActive() && "an-rich-md-bubble-button--active",
|
|
241
|
+
)}
|
|
242
|
+
style={item.style}
|
|
243
|
+
onClick={item.action}
|
|
244
|
+
>
|
|
245
|
+
{item.label}
|
|
246
|
+
</button>
|
|
247
|
+
);
|
|
248
|
+
})}
|
|
249
|
+
</div>
|
|
250
|
+
)}
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { IconCheck, IconChevronDown } from "@tabler/icons-react";
|
|
2
|
+
import type { Node as TiptapNode } from "@tiptap/core";
|
|
3
|
+
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
4
|
+
import {
|
|
5
|
+
NodeViewContent,
|
|
6
|
+
NodeViewWrapper,
|
|
7
|
+
ReactNodeViewRenderer,
|
|
8
|
+
type NodeViewProps,
|
|
9
|
+
} from "@tiptap/react";
|
|
10
|
+
import type { createLowlight } from "lowlight";
|
|
11
|
+
import { useMemo, useState } from "react";
|
|
12
|
+
|
|
13
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
14
|
+
import { cn } from "../utils.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A selectable language for the code-block picker. `value === null` is the
|
|
18
|
+
* "Auto" sentinel: the block stores no language and the lowlight plugin
|
|
19
|
+
* auto-detects (biased toward the editor's registered, web-leaning grammar
|
|
20
|
+
* set). Keeping it first makes Auto the default, matching how plans skew toward
|
|
21
|
+
* JS/TS/JSON without the author having to choose.
|
|
22
|
+
*/
|
|
23
|
+
export interface CodeLanguageOption {
|
|
24
|
+
value: string | null;
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Default picker list — Auto first, then the web-leaning grammars plans use. */
|
|
29
|
+
export const DEFAULT_CODE_LANGUAGES: CodeLanguageOption[] = [
|
|
30
|
+
{ value: null, label: "Auto" },
|
|
31
|
+
{ value: "typescript", label: "TypeScript" },
|
|
32
|
+
{ value: "javascript", label: "JavaScript" },
|
|
33
|
+
{ value: "tsx", label: "TSX" },
|
|
34
|
+
{ value: "jsx", label: "JSX" },
|
|
35
|
+
{ value: "json", label: "JSON" },
|
|
36
|
+
{ value: "html", label: "HTML" },
|
|
37
|
+
{ value: "css", label: "CSS" },
|
|
38
|
+
{ value: "bash", label: "Bash" },
|
|
39
|
+
{ value: "python", label: "Python" },
|
|
40
|
+
{ value: "sql", label: "SQL" },
|
|
41
|
+
{ value: "yaml", label: "YAML" },
|
|
42
|
+
{ value: "markdown", label: "Markdown" },
|
|
43
|
+
{ value: "graphql", label: "GraphQL" },
|
|
44
|
+
{ value: "go", label: "Go" },
|
|
45
|
+
{ value: "rust", label: "Rust" },
|
|
46
|
+
{ value: "diff", label: "Diff" },
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/** Class hooks so each app themes the shared node with its own palette. */
|
|
50
|
+
export interface CodeBlockClassNames {
|
|
51
|
+
wrapper: string;
|
|
52
|
+
header: string;
|
|
53
|
+
langButton: string;
|
|
54
|
+
langButtonReadonly: string;
|
|
55
|
+
picker: string;
|
|
56
|
+
search: string;
|
|
57
|
+
list: string;
|
|
58
|
+
option: string;
|
|
59
|
+
optionActive: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const DEFAULT_CLASS_NAMES: CodeBlockClassNames = {
|
|
63
|
+
wrapper: "an-code-block",
|
|
64
|
+
header: "an-code-block__header",
|
|
65
|
+
langButton: "an-code-block__lang",
|
|
66
|
+
langButtonReadonly: "an-code-block__lang--readonly",
|
|
67
|
+
picker: "an-code-block__picker",
|
|
68
|
+
search: "an-code-block__search",
|
|
69
|
+
list: "an-code-block__list",
|
|
70
|
+
option: "an-code-block__option",
|
|
71
|
+
optionActive: "is-active",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export interface CreateCodeBlockNodeOptions {
|
|
75
|
+
/** Lowlight instance backing syntax highlighting (same one the app registers). */
|
|
76
|
+
lowlight: ReturnType<typeof createLowlight>;
|
|
77
|
+
/** Picker languages. Defaults to {@link DEFAULT_CODE_LANGUAGES} (Auto first). */
|
|
78
|
+
languages?: CodeLanguageOption[];
|
|
79
|
+
/** Class hooks for per-app theming. Defaults to the shared `an-code-block__*`. */
|
|
80
|
+
classNames?: Partial<CodeBlockClassNames>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function optionLabel(
|
|
84
|
+
language: string | null,
|
|
85
|
+
languages: CodeLanguageOption[],
|
|
86
|
+
): string {
|
|
87
|
+
if (!language) return languages[0]?.label ?? "Auto";
|
|
88
|
+
const match = languages.find((option) => option.value === language);
|
|
89
|
+
return match?.label ?? language;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface CodeBlockNodeViewExtraOptions {
|
|
93
|
+
languagePickerOptions: CodeLanguageOption[];
|
|
94
|
+
codeBlockClassNames: CodeBlockClassNames;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function CodeBlockView({
|
|
98
|
+
node,
|
|
99
|
+
updateAttributes,
|
|
100
|
+
editor,
|
|
101
|
+
extension,
|
|
102
|
+
}: NodeViewProps) {
|
|
103
|
+
const options = extension.options as unknown as CodeBlockNodeViewExtraOptions;
|
|
104
|
+
const languages = options.languagePickerOptions;
|
|
105
|
+
const classNames = options.codeBlockClassNames;
|
|
106
|
+
|
|
107
|
+
const [open, setOpen] = useState(false);
|
|
108
|
+
const [filter, setFilter] = useState("");
|
|
109
|
+
const isEditable = editor.isEditable;
|
|
110
|
+
|
|
111
|
+
const current = (node.attrs.language as string | null) || null;
|
|
112
|
+
const label = optionLabel(current, languages);
|
|
113
|
+
|
|
114
|
+
const filtered = useMemo(() => {
|
|
115
|
+
const query = filter.trim().toLowerCase();
|
|
116
|
+
if (!query) return languages;
|
|
117
|
+
return languages.filter((option) =>
|
|
118
|
+
option.label.toLowerCase().includes(query),
|
|
119
|
+
);
|
|
120
|
+
}, [filter, languages]);
|
|
121
|
+
|
|
122
|
+
const select = (value: string | null) => {
|
|
123
|
+
// Store `""` for Auto so tiptap-markdown emits a bare fence (no language),
|
|
124
|
+
// matching the auto-detect read path.
|
|
125
|
+
updateAttributes({ language: value ?? "" });
|
|
126
|
+
setFilter("");
|
|
127
|
+
setOpen(false);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<NodeViewWrapper className={classNames.wrapper}>
|
|
132
|
+
<div className={classNames.header} contentEditable={false}>
|
|
133
|
+
{isEditable ? (
|
|
134
|
+
<Popover
|
|
135
|
+
open={open}
|
|
136
|
+
onOpenChange={(next) => {
|
|
137
|
+
setOpen(next);
|
|
138
|
+
if (!next) setFilter("");
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<PopoverTrigger asChild>
|
|
142
|
+
<button type="button" className={classNames.langButton}>
|
|
143
|
+
{label}
|
|
144
|
+
<IconChevronDown className="size-3" />
|
|
145
|
+
</button>
|
|
146
|
+
</PopoverTrigger>
|
|
147
|
+
<PopoverContent align="start" side="bottom" className="w-52 p-0">
|
|
148
|
+
<input
|
|
149
|
+
autoFocus
|
|
150
|
+
type="text"
|
|
151
|
+
value={filter}
|
|
152
|
+
onChange={(event) => setFilter(event.target.value)}
|
|
153
|
+
onKeyDown={(event) => {
|
|
154
|
+
if (event.key === "Enter" && filtered.length > 0) {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
select(filtered[0].value);
|
|
157
|
+
}
|
|
158
|
+
}}
|
|
159
|
+
placeholder="Search languages…"
|
|
160
|
+
className={classNames.search}
|
|
161
|
+
/>
|
|
162
|
+
<div className={classNames.list}>
|
|
163
|
+
{filtered.map((option) => {
|
|
164
|
+
const active =
|
|
165
|
+
option.value === current || (!option.value && !current);
|
|
166
|
+
return (
|
|
167
|
+
<button
|
|
168
|
+
key={option.value ?? "auto"}
|
|
169
|
+
type="button"
|
|
170
|
+
className={cn(
|
|
171
|
+
classNames.option,
|
|
172
|
+
active && classNames.optionActive,
|
|
173
|
+
)}
|
|
174
|
+
onClick={() => select(option.value)}
|
|
175
|
+
>
|
|
176
|
+
{option.label}
|
|
177
|
+
{active && <IconCheck className="size-3.5" />}
|
|
178
|
+
</button>
|
|
179
|
+
);
|
|
180
|
+
})}
|
|
181
|
+
</div>
|
|
182
|
+
</PopoverContent>
|
|
183
|
+
</Popover>
|
|
184
|
+
) : (
|
|
185
|
+
label && (
|
|
186
|
+
<span
|
|
187
|
+
className={cn(
|
|
188
|
+
classNames.langButton,
|
|
189
|
+
classNames.langButtonReadonly,
|
|
190
|
+
)}
|
|
191
|
+
>
|
|
192
|
+
{label}
|
|
193
|
+
</span>
|
|
194
|
+
)
|
|
195
|
+
)}
|
|
196
|
+
</div>
|
|
197
|
+
<pre>
|
|
198
|
+
<NodeViewContent as={"code" as never} />
|
|
199
|
+
</pre>
|
|
200
|
+
</NodeViewWrapper>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The shared Notion-style code block: {@link CodeBlockLowlight} (so fenced
|
|
206
|
+
* markdown round-trips byte-identically — the node name and `language` attr are
|
|
207
|
+
* unchanged) plus a React node view that adds a language picker header instead
|
|
208
|
+
* of a bare highlighted `<pre>`. "Auto" stores no language and the lowlight
|
|
209
|
+
* plugin auto-detects.
|
|
210
|
+
*
|
|
211
|
+
* Lifted from the Content editor's bespoke code block so Plans (and any app
|
|
212
|
+
* opting into `features.codeBlock`) share one implementation. Theming is fully
|
|
213
|
+
* class-driven via {@link CreateCodeBlockNodeOptions.classNames}, so each app
|
|
214
|
+
* maps the hooks onto its own palette.
|
|
215
|
+
*/
|
|
216
|
+
export function createCodeBlockNode({
|
|
217
|
+
lowlight,
|
|
218
|
+
languages = DEFAULT_CODE_LANGUAGES,
|
|
219
|
+
classNames,
|
|
220
|
+
}: CreateCodeBlockNodeOptions): TiptapNode {
|
|
221
|
+
const resolvedClassNames: CodeBlockClassNames = {
|
|
222
|
+
...DEFAULT_CLASS_NAMES,
|
|
223
|
+
...(classNames ?? {}),
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
return CodeBlockLowlight.extend({
|
|
227
|
+
addOptions() {
|
|
228
|
+
return {
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
230
|
+
...this.parent!(),
|
|
231
|
+
languagePickerOptions: languages,
|
|
232
|
+
codeBlockClassNames: resolvedClassNames,
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
addNodeView() {
|
|
236
|
+
return ReactNodeViewRenderer(CodeBlockView);
|
|
237
|
+
},
|
|
238
|
+
addKeyboardShortcuts() {
|
|
239
|
+
return {
|
|
240
|
+
...this.parent?.(),
|
|
241
|
+
Tab: ({ editor }) => {
|
|
242
|
+
if (editor.isActive(this.name)) {
|
|
243
|
+
editor.commands.insertContent("\t");
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
}).configure({
|
|
251
|
+
lowlight,
|
|
252
|
+
defaultLanguage: null,
|
|
253
|
+
}) as unknown as TiptapNode;
|
|
254
|
+
}
|