@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,343 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
type ComponentType,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
} from "react";
|
|
7
|
+
|
|
8
|
+
export type ComposerTranslate = (
|
|
9
|
+
key: string,
|
|
10
|
+
options?: Record<string, unknown>,
|
|
11
|
+
) => string;
|
|
12
|
+
|
|
13
|
+
export type ReasoningEffort =
|
|
14
|
+
| "auto"
|
|
15
|
+
| "none"
|
|
16
|
+
| "minimal"
|
|
17
|
+
| "low"
|
|
18
|
+
| "medium"
|
|
19
|
+
| "high"
|
|
20
|
+
| "xhigh"
|
|
21
|
+
| "max";
|
|
22
|
+
|
|
23
|
+
export interface EngineModelGroup {
|
|
24
|
+
engine: string;
|
|
25
|
+
label: string;
|
|
26
|
+
models: string[];
|
|
27
|
+
configured: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ComposerModelState {
|
|
31
|
+
selectedModel: string;
|
|
32
|
+
selectedEngine: string;
|
|
33
|
+
selectedEffort: ReasoningEffort;
|
|
34
|
+
availableModels: EngineModelGroup[];
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
onModelChange: (model: string, engine: string) => void;
|
|
37
|
+
onEffortChange: (effort: ReasoningEffort) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ComposerBuilderConnectFlow {
|
|
41
|
+
hasFetchedStatus: boolean;
|
|
42
|
+
configured: boolean;
|
|
43
|
+
envManaged: boolean;
|
|
44
|
+
connecting: boolean;
|
|
45
|
+
statusResolved: boolean;
|
|
46
|
+
start: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface AgentChatContextItem {
|
|
50
|
+
key: string;
|
|
51
|
+
title: string;
|
|
52
|
+
context: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ComposerAgentChatMessage {
|
|
56
|
+
message: string;
|
|
57
|
+
context?: string;
|
|
58
|
+
mode?: "plan" | "act";
|
|
59
|
+
submit?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ComposerAgentChatContextSetOptions extends AgentChatContextItem {
|
|
63
|
+
openSidebar?: boolean;
|
|
64
|
+
focus?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ComposerAgentChatOpenThreadRequest {
|
|
68
|
+
threadId: string;
|
|
69
|
+
onlyIfActiveThreadId?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ComposerBuilderConnectFlowOptions {
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
popupUrl?: string;
|
|
75
|
+
trackingSource?: string;
|
|
76
|
+
trackingFlow?: string;
|
|
77
|
+
onConnected?: (state: { orgName: string | null }) => void | Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface AgentComposerReference {
|
|
81
|
+
label: string;
|
|
82
|
+
icon?: string;
|
|
83
|
+
source?: string;
|
|
84
|
+
refType: string;
|
|
85
|
+
refId?: string | null;
|
|
86
|
+
refPath?: string | null;
|
|
87
|
+
slotKey?: string;
|
|
88
|
+
slotLabel?: string;
|
|
89
|
+
metadata?: Record<string, unknown>;
|
|
90
|
+
clearsSlots?: string[];
|
|
91
|
+
relatedReferences?: AgentComposerReference[];
|
|
92
|
+
}
|
|
93
|
+
export interface AgentComposerReferenceInsertPayload extends AgentComposerReference {
|
|
94
|
+
insertMessageId: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface VoiceContextPack {
|
|
98
|
+
surface?: string;
|
|
99
|
+
mode?: string;
|
|
100
|
+
snippets?: Array<{ label: string; value: string }>;
|
|
101
|
+
terms?: Array<{ term: string; replacement?: string }>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface ComposerRuntimeAdapters {
|
|
105
|
+
resolvePath?: (path: string) => string;
|
|
106
|
+
translate?: ComposerTranslate;
|
|
107
|
+
models?: {
|
|
108
|
+
useChatModels?: (options: { enabled: boolean }) => ComposerModelState;
|
|
109
|
+
useAgentEngineConfigured?: (enabled: boolean) => {
|
|
110
|
+
missing: boolean;
|
|
111
|
+
state: string;
|
|
112
|
+
};
|
|
113
|
+
fetchAgentEngineConfiguredState?: (
|
|
114
|
+
enabled: boolean,
|
|
115
|
+
options: { timeoutMs: number },
|
|
116
|
+
) => Promise<"missing" | "configured" | string>;
|
|
117
|
+
BuilderSetupCard?: ComponentType<any>;
|
|
118
|
+
BuilderSetupContent?: ComponentType<any>;
|
|
119
|
+
reasoning?: {
|
|
120
|
+
defaultEffort?: ReasoningEffort;
|
|
121
|
+
getOptionsForModel?: (model?: string) => ReasoningEffort[];
|
|
122
|
+
label?: (effort: ReasoningEffort) => string;
|
|
123
|
+
resolve?: (model: string, effort?: ReasoningEffort) => ReasoningEffort;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
agentChat?: {
|
|
127
|
+
sendToAgentChat?: (input: ComposerAgentChatMessage) => void;
|
|
128
|
+
setContextItem?: (input: ComposerAgentChatContextSetOptions) => void;
|
|
129
|
+
requestThreadOpen?: (input: ComposerAgentChatOpenThreadRequest) => void;
|
|
130
|
+
formatContextItems?: (
|
|
131
|
+
items: readonly AgentChatContextItem[] | undefined,
|
|
132
|
+
) => string;
|
|
133
|
+
normalizeReference?: (reference: unknown) => AgentComposerReference | null;
|
|
134
|
+
StaleIndexBoundary?: ComponentType<any>;
|
|
135
|
+
};
|
|
136
|
+
builder?: {
|
|
137
|
+
useConnectFlow?: (
|
|
138
|
+
options: ComposerBuilderConnectFlowOptions,
|
|
139
|
+
) => ComposerBuilderConnectFlow;
|
|
140
|
+
tryDelegateBuildRequest?: (text: string) => boolean;
|
|
141
|
+
isTrustedFrameMessage?: (event: MessageEvent) => boolean;
|
|
142
|
+
isTrustedBuilderMessage?: (event: MessageEvent) => boolean;
|
|
143
|
+
};
|
|
144
|
+
resources?: {
|
|
145
|
+
useOrg?: () => {
|
|
146
|
+
data?: { orgId?: string | null; role?: string | null } | null;
|
|
147
|
+
};
|
|
148
|
+
isMcpIntegrationAvailable?: () => boolean;
|
|
149
|
+
useCreateMcpServer?: () => {
|
|
150
|
+
mutateAsync: (input: any) => Promise<unknown>;
|
|
151
|
+
};
|
|
152
|
+
McpIntegrationDialog?: ComponentType<any>;
|
|
153
|
+
};
|
|
154
|
+
voice?: {
|
|
155
|
+
useProviderStatus?: () => {
|
|
156
|
+
status: { builder?: boolean; openai?: boolean } | null;
|
|
157
|
+
refresh: () => void;
|
|
158
|
+
};
|
|
159
|
+
getBrowserTabId?: () => string;
|
|
160
|
+
readAppState?: <T>(
|
|
161
|
+
key: string,
|
|
162
|
+
) => T | null | undefined | Promise<T | null | undefined>;
|
|
163
|
+
setAppState?: (key: string, value: unknown) => void | Promise<unknown>;
|
|
164
|
+
subscribeSidebarState?: (
|
|
165
|
+
listener: (detail: { open?: boolean } | undefined) => void,
|
|
166
|
+
) => () => void;
|
|
167
|
+
applyContextReplacements?: (
|
|
168
|
+
text: string,
|
|
169
|
+
context: VoiceContextPack | undefined,
|
|
170
|
+
) => string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const identityPath = (path: string) => path;
|
|
175
|
+
const fallbackTranslate: ComposerTranslate = (key, options) =>
|
|
176
|
+
typeof options?.defaultValue === "string" ? options.defaultValue : key;
|
|
177
|
+
const fallbackModels = {
|
|
178
|
+
useChatModels: () => ({
|
|
179
|
+
selectedModel: "auto",
|
|
180
|
+
selectedEngine: "auto",
|
|
181
|
+
selectedEffort: "medium" as ReasoningEffort,
|
|
182
|
+
availableModels: [],
|
|
183
|
+
isLoading: false,
|
|
184
|
+
onModelChange: () => {},
|
|
185
|
+
onEffortChange: () => {},
|
|
186
|
+
}),
|
|
187
|
+
useAgentEngineConfigured: () => ({ missing: false, state: "configured" }),
|
|
188
|
+
fetchAgentEngineConfiguredState: async () => "configured",
|
|
189
|
+
};
|
|
190
|
+
const FragmentBoundary: ComponentType<{ children?: ReactNode }> = ({
|
|
191
|
+
children,
|
|
192
|
+
}) => <>{children}</>;
|
|
193
|
+
const fallbackBuilderFlow = {
|
|
194
|
+
hasFetchedStatus: false,
|
|
195
|
+
configured: false,
|
|
196
|
+
envManaged: false,
|
|
197
|
+
connecting: false,
|
|
198
|
+
statusResolved: false,
|
|
199
|
+
start: () => {},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const fallbackAdapters: Required<Pick<ComposerRuntimeAdapters, "resolvePath">> &
|
|
203
|
+
ComposerRuntimeAdapters = {
|
|
204
|
+
resolvePath: identityPath,
|
|
205
|
+
translate: fallbackTranslate,
|
|
206
|
+
models: fallbackModels,
|
|
207
|
+
agentChat: {
|
|
208
|
+
sendToAgentChat: () => {},
|
|
209
|
+
setContextItem: () => {},
|
|
210
|
+
requestThreadOpen: () => {},
|
|
211
|
+
formatContextItems: () => "",
|
|
212
|
+
normalizeReference: (reference) =>
|
|
213
|
+
reference &&
|
|
214
|
+
typeof reference === "object" &&
|
|
215
|
+
typeof (reference as AgentComposerReference).label === "string" &&
|
|
216
|
+
typeof (reference as AgentComposerReference).refType === "string"
|
|
217
|
+
? (reference as AgentComposerReference)
|
|
218
|
+
: null,
|
|
219
|
+
StaleIndexBoundary: FragmentBoundary,
|
|
220
|
+
},
|
|
221
|
+
builder: {
|
|
222
|
+
useConnectFlow: () => fallbackBuilderFlow,
|
|
223
|
+
tryDelegateBuildRequest: () => false,
|
|
224
|
+
isTrustedFrameMessage: () => false,
|
|
225
|
+
isTrustedBuilderMessage: () => false,
|
|
226
|
+
},
|
|
227
|
+
resources: {
|
|
228
|
+
useOrg: () => ({ data: null }),
|
|
229
|
+
isMcpIntegrationAvailable: () => false,
|
|
230
|
+
useCreateMcpServer: () => ({ mutateAsync: async () => undefined }),
|
|
231
|
+
},
|
|
232
|
+
voice: {
|
|
233
|
+
useProviderStatus: () => ({ status: null, refresh: () => {} }),
|
|
234
|
+
getBrowserTabId: () => "",
|
|
235
|
+
readAppState: () => undefined,
|
|
236
|
+
setAppState: () => {},
|
|
237
|
+
subscribeSidebarState: () => () => {},
|
|
238
|
+
applyContextReplacements: applyVoiceContextReplacements,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const ComposerRuntimeAdaptersContext =
|
|
243
|
+
createContext<ComposerRuntimeAdapters>(fallbackAdapters);
|
|
244
|
+
|
|
245
|
+
export function ComposerRuntimeAdaptersProvider({
|
|
246
|
+
adapters,
|
|
247
|
+
children,
|
|
248
|
+
}: {
|
|
249
|
+
adapters: ComposerRuntimeAdapters;
|
|
250
|
+
children: ReactNode;
|
|
251
|
+
}) {
|
|
252
|
+
return (
|
|
253
|
+
<ComposerRuntimeAdaptersContext.Provider
|
|
254
|
+
value={{
|
|
255
|
+
...fallbackAdapters,
|
|
256
|
+
...adapters,
|
|
257
|
+
models: { ...fallbackModels, ...adapters.models },
|
|
258
|
+
agentChat: { ...fallbackAdapters.agentChat, ...adapters.agentChat },
|
|
259
|
+
builder: { ...fallbackAdapters.builder, ...adapters.builder },
|
|
260
|
+
resources: { ...fallbackAdapters.resources, ...adapters.resources },
|
|
261
|
+
voice: { ...fallbackAdapters.voice, ...adapters.voice },
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
{children}
|
|
265
|
+
</ComposerRuntimeAdaptersContext.Provider>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function useComposerRuntimeAdapters() {
|
|
270
|
+
return useContext(ComposerRuntimeAdaptersContext);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export const DEFAULT_REASONING_EFFORT: ReasoningEffort = "medium";
|
|
274
|
+
export function getReasoningEffortOptionsForModel(
|
|
275
|
+
_model?: string,
|
|
276
|
+
): ReasoningEffort[] {
|
|
277
|
+
return ["low", "medium", "high"];
|
|
278
|
+
}
|
|
279
|
+
export function reasoningEffortLabel(effort: ReasoningEffort): string {
|
|
280
|
+
return effort === "xhigh"
|
|
281
|
+
? "Extra high"
|
|
282
|
+
: effort[0].toUpperCase() + effort.slice(1);
|
|
283
|
+
}
|
|
284
|
+
export function resolveReasoningEffortSelection(
|
|
285
|
+
_model: string,
|
|
286
|
+
effort?: ReasoningEffort,
|
|
287
|
+
): ReasoningEffort {
|
|
288
|
+
return effort ?? DEFAULT_REASONING_EFFORT;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export const AGENT_CHAT_INSERT_REFERENCE_EVENT =
|
|
292
|
+
"agent-native:insert-composer-reference";
|
|
293
|
+
export const AGENT_CHAT_INSERT_REFERENCE_MESSAGE_TYPE =
|
|
294
|
+
"agent-native:insert-composer-reference";
|
|
295
|
+
|
|
296
|
+
export function formatPromptContextItems(
|
|
297
|
+
items: AgentChatContextItem[] | undefined,
|
|
298
|
+
): string {
|
|
299
|
+
return (
|
|
300
|
+
items
|
|
301
|
+
?.map((item) => item.context ?? item.title ?? "")
|
|
302
|
+
.filter(Boolean)
|
|
303
|
+
.join("\n\n") ?? ""
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function applyVoiceContextReplacements(
|
|
308
|
+
text: string,
|
|
309
|
+
context: VoiceContextPack | undefined,
|
|
310
|
+
): string {
|
|
311
|
+
const isAlphaNumeric = (value: string | undefined) =>
|
|
312
|
+
value != null && /[\p{L}\p{N}_]/u.test(value);
|
|
313
|
+
const isSafeBoundary = (
|
|
314
|
+
value: string,
|
|
315
|
+
index: number,
|
|
316
|
+
direction: "before" | "after",
|
|
317
|
+
) => {
|
|
318
|
+
const char = value[index];
|
|
319
|
+
if (char == null) return true;
|
|
320
|
+
if (isAlphaNumeric(char) || "@/\\:".includes(char)) return false;
|
|
321
|
+
if (".-+".includes(char)) {
|
|
322
|
+
const neighbor =
|
|
323
|
+
direction === "before" ? value[index - 1] : value[index + 1];
|
|
324
|
+
return !isAlphaNumeric(neighbor);
|
|
325
|
+
}
|
|
326
|
+
return true;
|
|
327
|
+
};
|
|
328
|
+
let next = text;
|
|
329
|
+
for (const term of context?.terms ?? []) {
|
|
330
|
+
const source = term.term.trim();
|
|
331
|
+
const replacement = term.replacement?.trim();
|
|
332
|
+
if (!replacement || source.length < 2 || replacement === source) continue;
|
|
333
|
+
const escaped = source.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
334
|
+
next = next.replace(new RegExp(escaped, "giu"), (match, offset: number) => {
|
|
335
|
+
const end = offset + match.length;
|
|
336
|
+
return isSafeBoundary(next, offset - 1, "before") &&
|
|
337
|
+
isSafeBoundary(next, end, "after")
|
|
338
|
+
? replacement
|
|
339
|
+
: match;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
return next;
|
|
343
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface FileResult {
|
|
2
|
+
path: string;
|
|
3
|
+
name: string;
|
|
4
|
+
source: "codebase" | "resource";
|
|
5
|
+
type: "file" | "folder";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SkillResult {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
path: string;
|
|
12
|
+
source: "codebase" | "resource";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MentionItem {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
source: string;
|
|
21
|
+
refType: string;
|
|
22
|
+
refPath?: string;
|
|
23
|
+
refId?: string;
|
|
24
|
+
section?: string;
|
|
25
|
+
slotKey?: string;
|
|
26
|
+
slotLabel?: string;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
clearsSlots?: string[];
|
|
29
|
+
relatedReferences?: MentionReferenceInsert[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Reference {
|
|
33
|
+
type: "file" | "skill" | "mention" | "agent" | "custom-agent";
|
|
34
|
+
path: string;
|
|
35
|
+
name: string;
|
|
36
|
+
source: string;
|
|
37
|
+
refType?: string;
|
|
38
|
+
refId?: string;
|
|
39
|
+
slotKey?: string;
|
|
40
|
+
slotLabel?: string;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface MentionReferenceInsert {
|
|
45
|
+
label: string;
|
|
46
|
+
icon?: string;
|
|
47
|
+
source?: string;
|
|
48
|
+
refType: string;
|
|
49
|
+
refId?: string | null;
|
|
50
|
+
refPath?: string | null;
|
|
51
|
+
slotKey?: string;
|
|
52
|
+
slotLabel?: string;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
clearsSlots?: string[];
|
|
55
|
+
relatedReferences?: MentionReferenceInsert[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SlashCommand {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
icon?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ComposerMode = "skill" | "job" | "automation" | "extension";
|
|
65
|
+
|
|
66
|
+
export type AgentComposerLayoutVariant = "default" | "compact" | "hero";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { useComposerRuntimeAdapters } from "./runtime-adapters.js";
|
|
4
|
+
import type { FileResult } from "./types.js";
|
|
5
|
+
|
|
6
|
+
export function useFileSearch(query: string, enabled: boolean) {
|
|
7
|
+
const { resolvePath = (path) => path } = useComposerRuntimeAdapters();
|
|
8
|
+
const [files, setFiles] = useState<FileResult[]>([]);
|
|
9
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
10
|
+
const requestIdRef = useRef(0);
|
|
11
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!enabled) {
|
|
15
|
+
setFiles([]);
|
|
16
|
+
setIsLoading(false);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setIsLoading(true);
|
|
21
|
+
const id = ++requestIdRef.current;
|
|
22
|
+
// Abort any in-flight request so a superseded/unmounted query stops fetching
|
|
23
|
+
// (mirrors use-mention-search). The requestId guard still protects state.
|
|
24
|
+
abortRef.current?.abort();
|
|
25
|
+
const abort = new AbortController();
|
|
26
|
+
abortRef.current = abort;
|
|
27
|
+
|
|
28
|
+
const timer = setTimeout(
|
|
29
|
+
async () => {
|
|
30
|
+
try {
|
|
31
|
+
const res = await fetch(
|
|
32
|
+
resolvePath(
|
|
33
|
+
`/_agent-native/agent-chat/files?q=${encodeURIComponent(query)}`,
|
|
34
|
+
),
|
|
35
|
+
{ signal: abort.signal },
|
|
36
|
+
);
|
|
37
|
+
if (!res.ok) throw new Error();
|
|
38
|
+
const data = await res.json();
|
|
39
|
+
// Only update if this is still the latest request
|
|
40
|
+
if (id === requestIdRef.current) {
|
|
41
|
+
setFiles(data.files || []);
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if ((err as Error)?.name === "AbortError") return;
|
|
45
|
+
if (id === requestIdRef.current) {
|
|
46
|
+
setFiles([]);
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
if (id === requestIdRef.current) {
|
|
50
|
+
setIsLoading(false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
query.length === 0 ? 0 : 200,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return () => {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
abort.abort();
|
|
60
|
+
};
|
|
61
|
+
}, [query, enabled, resolvePath]);
|
|
62
|
+
|
|
63
|
+
return { files, isLoading };
|
|
64
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { useComposerRuntimeAdapters } from "./runtime-adapters.js";
|
|
4
|
+
import type { MentionItem } from "./types.js";
|
|
5
|
+
|
|
6
|
+
export function useMentionSearch(
|
|
7
|
+
query: string,
|
|
8
|
+
enabled: boolean,
|
|
9
|
+
resolvePathOverride?: (path: string) => string,
|
|
10
|
+
) {
|
|
11
|
+
const { resolvePath = (path) => path } = useComposerRuntimeAdapters();
|
|
12
|
+
const resolveRequestPath = resolvePathOverride ?? resolvePath;
|
|
13
|
+
const [items, setItems] = useState<MentionItem[]>([]);
|
|
14
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
15
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
16
|
+
const requestIdRef = useRef(0);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!enabled) {
|
|
20
|
+
setItems([]);
|
|
21
|
+
setIsLoading(false);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Cancel any in-flight stream
|
|
26
|
+
abortRef.current?.abort();
|
|
27
|
+
const abort = new AbortController();
|
|
28
|
+
abortRef.current = abort;
|
|
29
|
+
const id = ++requestIdRef.current;
|
|
30
|
+
|
|
31
|
+
setItems([]);
|
|
32
|
+
setIsLoading(true);
|
|
33
|
+
|
|
34
|
+
const debounceMs = query.length === 0 ? 0 : 150;
|
|
35
|
+
|
|
36
|
+
const timer = setTimeout(async () => {
|
|
37
|
+
try {
|
|
38
|
+
const res = await fetch(
|
|
39
|
+
resolveRequestPath(
|
|
40
|
+
`/_agent-native/agent-chat/mentions?q=${encodeURIComponent(query)}`,
|
|
41
|
+
),
|
|
42
|
+
{ signal: abort.signal },
|
|
43
|
+
);
|
|
44
|
+
if (!res.ok || !res.body) throw new Error();
|
|
45
|
+
|
|
46
|
+
const reader = res.body.getReader();
|
|
47
|
+
const decoder = new TextDecoder();
|
|
48
|
+
let buf = "";
|
|
49
|
+
|
|
50
|
+
while (true) {
|
|
51
|
+
const { done, value } = await reader.read();
|
|
52
|
+
if (done) break;
|
|
53
|
+
|
|
54
|
+
buf += decoder.decode(value, { stream: true });
|
|
55
|
+
const lines = buf.split("\n");
|
|
56
|
+
buf = lines.pop()!; // last line may be incomplete
|
|
57
|
+
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
if (!line.trim()) continue;
|
|
60
|
+
try {
|
|
61
|
+
const { items: batch } = JSON.parse(line) as {
|
|
62
|
+
items: MentionItem[];
|
|
63
|
+
};
|
|
64
|
+
if (id === requestIdRef.current && batch?.length) {
|
|
65
|
+
setItems((prev) => {
|
|
66
|
+
// Deduplicate by id
|
|
67
|
+
const seen = new Set(prev.map((x) => x.id));
|
|
68
|
+
const fresh = batch.filter((x) => !seen.has(x.id));
|
|
69
|
+
return fresh.length ? [...prev, ...fresh] : prev;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (err: unknown) {
|
|
76
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
77
|
+
if (id === requestIdRef.current) setItems([]);
|
|
78
|
+
} finally {
|
|
79
|
+
if (id === requestIdRef.current) setIsLoading(false);
|
|
80
|
+
}
|
|
81
|
+
}, debounceMs);
|
|
82
|
+
|
|
83
|
+
return () => {
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
abort.abort();
|
|
86
|
+
};
|
|
87
|
+
}, [query, enabled, resolveRequestPath]);
|
|
88
|
+
|
|
89
|
+
return { items, isLoading };
|
|
90
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { useComposerRuntimeAdapters } from "./runtime-adapters.js";
|
|
4
|
+
import type { SkillResult } from "./types.js";
|
|
5
|
+
|
|
6
|
+
export function useSkills(enabled: boolean) {
|
|
7
|
+
const { resolvePath = (path) => path } = useComposerRuntimeAdapters();
|
|
8
|
+
const [skills, setSkills] = useState<SkillResult[]>([]);
|
|
9
|
+
const [hint, setHint] = useState<string | undefined>();
|
|
10
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
11
|
+
const requestIdRef = useRef(0);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!enabled) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setIsLoading(true);
|
|
19
|
+
const id = ++requestIdRef.current;
|
|
20
|
+
|
|
21
|
+
fetch(resolvePath("/_agent-native/agent-chat/skills"))
|
|
22
|
+
.then((res) => {
|
|
23
|
+
if (!res.ok) throw new Error();
|
|
24
|
+
return res.json();
|
|
25
|
+
})
|
|
26
|
+
.then((data) => {
|
|
27
|
+
if (id === requestIdRef.current) {
|
|
28
|
+
setSkills(data.skills || []);
|
|
29
|
+
setHint(data.hint);
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.catch(() => {
|
|
33
|
+
if (id === requestIdRef.current) {
|
|
34
|
+
setSkills([]);
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.finally(() => {
|
|
38
|
+
if (id === requestIdRef.current) {
|
|
39
|
+
setIsLoading(false);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}, [enabled, resolvePath]);
|
|
43
|
+
|
|
44
|
+
return { skills, hint, isLoading };
|
|
45
|
+
}
|