@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
|
@@ -8,16 +8,47 @@ from approved company knowledge, with links back to the source.
|
|
|
8
8
|
|
|
9
9
|
Brain ingests approved Slack channels, meetings, transcripts, GitHub issues/PRs,
|
|
10
10
|
and webhook captures, distills them into reviewable knowledge, and answers with
|
|
11
|
-
exact evidence quotes and source links instead of guesses.
|
|
11
|
+
exact evidence quotes and source links instead of guesses. It can search both
|
|
12
|
+
organization-wide material and explicitly invited private channels or
|
|
13
|
+
attendee-scoped meetings without widening their audience.
|
|
12
14
|
|
|
13
15
|
## Features
|
|
14
16
|
|
|
15
17
|
- Company chat that answers from cited, reviewed knowledge — not hallucinations.
|
|
16
18
|
- Source connectors for Slack, Granola, GitHub, Clips, and generic webhooks.
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
+
- Deterministic privacy screening before storage, with an optional approved
|
|
20
|
+
privacy classifier for richer review decisions.
|
|
21
|
+
- Hybrid full-text and semantic search over allowed captures and knowledge,
|
|
22
|
+
filtered by the requesting user's evidence audience before ranking.
|
|
23
|
+
- Private-channel and meeting evidence stays audience-scoped; multi-source
|
|
24
|
+
answers use only the intersection of their evidence audiences.
|
|
25
|
+
- Sensitive sources are suppressed or quarantined before search, citations,
|
|
26
|
+
distillation, and source editors can see their content.
|
|
19
27
|
- Read-only, citation-backed retrieval exposed to other apps over A2A.
|
|
20
28
|
|
|
29
|
+
## Privacy posture
|
|
30
|
+
|
|
31
|
+
Brain never treats a connected provider as permission to index everything.
|
|
32
|
+
Slack public-channel discovery is configurable, while private channels require a
|
|
33
|
+
manual app invite and membership sync. Meetings use their attendee audience.
|
|
34
|
+
|
|
35
|
+
Hard privacy categories such as performance discussions, layoffs, compensation,
|
|
36
|
+
recruiting, health accommodations, investigations, privileged legal material,
|
|
37
|
+
and credentials are blocked before they become searchable content. Re-fetchable
|
|
38
|
+
providers keep only a metadata receipt in quarantine. Push-only generic and
|
|
39
|
+
Clips payloads use an encrypted, short-lived private quarantine store and turn
|
|
40
|
+
into a suppression receipt at expiry.
|
|
41
|
+
|
|
42
|
+
Without an approved privacy classifier, Brain runs in deterministic-only
|
|
43
|
+
degraded mode: clearly clean, company-relevant material may proceed; ambiguous
|
|
44
|
+
or sensitive-looking material is quarantined and health surfaces the setup
|
|
45
|
+
warning. Configure the classifier before relying on higher-throughput ingest.
|
|
46
|
+
|
|
47
|
+
`sanitizeBeforeStorage: false` only disables relevance-oriented transcript
|
|
48
|
+
cleanup. Brain still runs deterministic privacy and PII scrubbing before
|
|
49
|
+
persisting titles, content, metadata, safe segments, or search artifacts; the
|
|
50
|
+
setting never retains raw input.
|
|
51
|
+
|
|
21
52
|
## Develop locally
|
|
22
53
|
|
|
23
54
|
Scaffold your own copy and run it:
|
|
@@ -49,16 +49,22 @@ export const evidenceSchema = z.object({
|
|
|
49
49
|
.describe("Optional timestamp for meeting/call citations"),
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
const MAX_JSON_STRING_UNWRAPS = 2;
|
|
53
|
+
|
|
52
54
|
export function parseJsonCliInput(value: unknown) {
|
|
53
55
|
if (value === undefined) return undefined;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
let parsed = value;
|
|
57
|
+
for (let attempt = 0; attempt < MAX_JSON_STRING_UNWRAPS; attempt += 1) {
|
|
58
|
+
if (typeof parsed !== "string") return parsed;
|
|
59
|
+
const trimmed = parsed.trim();
|
|
60
|
+
if (!trimmed) return undefined;
|
|
61
|
+
try {
|
|
62
|
+
parsed = JSON.parse(trimmed);
|
|
63
|
+
} catch {
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
61
66
|
}
|
|
67
|
+
return parsed;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
export const jsonRecordSchema = z.preprocess(
|
|
@@ -6,6 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
|
|
7
7
|
import { getDb, schema } from "../server/db/index.js";
|
|
8
8
|
import {
|
|
9
|
+
assertDerivedAudienceAccess,
|
|
9
10
|
nowIso,
|
|
10
11
|
parseJson,
|
|
11
12
|
serializeProposal,
|
|
@@ -30,6 +31,7 @@ export default defineAction({
|
|
|
30
31
|
run: async ({ proposalId, reviewerNotes, publishCanonical }) => {
|
|
31
32
|
const access = await assertAccess("brain-proposal", proposalId, "editor");
|
|
32
33
|
const proposal = access.resource;
|
|
34
|
+
await assertDerivedAudienceAccess(proposal);
|
|
33
35
|
if (proposal.status !== "pending") {
|
|
34
36
|
throw new Error(`Proposal ${proposalId} is already ${proposal.status}`);
|
|
35
37
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { getDbExec } from "@agent-native/core/db";
|
|
2
3
|
import { and, desc, eq } from "drizzle-orm";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
stableJson,
|
|
13
14
|
} from "../server/lib/brain.js";
|
|
14
15
|
|
|
16
|
+
const LEASE_MS = 15 * 60 * 1000;
|
|
17
|
+
|
|
15
18
|
export default defineAction({
|
|
16
19
|
description:
|
|
17
20
|
"Claim a queued Brain capture distillation item before handing it to an agent worker.",
|
|
@@ -41,45 +44,39 @@ export default defineAction({
|
|
|
41
44
|
|
|
42
45
|
const now = nowIso();
|
|
43
46
|
const claimToken = nanoid(16);
|
|
47
|
+
const leaseExpiresAt = new Date(Date.parse(now) + LEASE_MS).toISOString();
|
|
44
48
|
const payload = parseJson<Record<string, unknown>>(queue.payloadJson, {});
|
|
45
|
-
await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
eq(schema.brainIngestQueue.status, "queued"),
|
|
64
|
-
),
|
|
65
|
-
);
|
|
49
|
+
const result = await getDbExec().execute({
|
|
50
|
+
sql: `UPDATE brain_ingest_queue
|
|
51
|
+
SET status = ?, attempts = ?, payload_json = ?, error = NULL,
|
|
52
|
+
run_after = NULL, lease_token = ?, lease_expires_at = ?, updated_at = ?
|
|
53
|
+
WHERE id = ? AND status = ? AND updated_at = ?`,
|
|
54
|
+
args: [
|
|
55
|
+
"processing",
|
|
56
|
+
queue.attempts + 1,
|
|
57
|
+
stableJson({ ...payload, claimedAt: now, claimedBy: "brain-agent" }),
|
|
58
|
+
claimToken,
|
|
59
|
+
leaseExpiresAt,
|
|
60
|
+
now,
|
|
61
|
+
queue.id,
|
|
62
|
+
"queued",
|
|
63
|
+
queue.updatedAt,
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
if (result.rowsAffected === 0) return { claimed: false, queueItem: null };
|
|
66
67
|
|
|
67
68
|
const [updated] = await db
|
|
68
69
|
.select()
|
|
69
70
|
.from(schema.brainIngestQueue)
|
|
70
71
|
.where(eq(schema.brainIngestQueue.id, queue.id))
|
|
71
72
|
.limit(1);
|
|
72
|
-
const updatedPayload = parseJson<Record<string, unknown>>(
|
|
73
|
-
updated?.payloadJson,
|
|
74
|
-
{},
|
|
75
|
-
);
|
|
76
73
|
const claimed =
|
|
77
|
-
updated?.status === "processing" &&
|
|
78
|
-
updatedPayload.claimToken === claimToken;
|
|
74
|
+
updated?.status === "processing" && updated?.leaseToken === claimToken;
|
|
79
75
|
|
|
80
76
|
return {
|
|
81
77
|
claimed,
|
|
82
78
|
queueItem: updated ? serializeDistillationQueue(updated) : null,
|
|
79
|
+
claimToken: claimed ? claimToken : null,
|
|
83
80
|
};
|
|
84
81
|
},
|
|
85
82
|
});
|
|
@@ -26,7 +26,7 @@ export default defineAction({
|
|
|
26
26
|
.string()
|
|
27
27
|
.optional()
|
|
28
28
|
.describe("Optional signed-ingest bearer token; stored only as a hash"),
|
|
29
|
-
visibility: z.enum(["private", "org"
|
|
29
|
+
visibility: z.enum(["private", "org"]).default("org"),
|
|
30
30
|
}),
|
|
31
31
|
run: async (args) => {
|
|
32
32
|
const config = { ...args.config };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Thin Brain re-export of staged dataset deletion, pre-bound to appId="brain".
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { deleteStagedDataset } from "@agent-native/core/provider-api/staged-datasets-store";
|
|
6
|
-
import { getCredentialContext } from "@agent-native/core/server/request-context";
|
|
4
|
+
import { createDeleteStagedDatasetAction } from "@agent-native/core/provider-api/actions/staged-datasets";
|
|
7
5
|
import { z } from "zod";
|
|
8
6
|
|
|
9
7
|
import { BRAIN_APP_ID } from "../server/lib/provider-api.js";
|
|
10
8
|
|
|
11
|
-
export default
|
|
9
|
+
export default createDeleteStagedDatasetAction({
|
|
12
10
|
description:
|
|
13
11
|
"Delete a staged dataset by id, freeing its scratch storage. Use after analysis is complete or before re-staging under the same name. Only the owner who staged the dataset can delete it.",
|
|
14
12
|
schema: z.object({
|
|
@@ -20,24 +18,5 @@ export default defineAction({
|
|
|
20
18
|
),
|
|
21
19
|
}),
|
|
22
20
|
http: false,
|
|
23
|
-
|
|
24
|
-
const ctx = getCredentialContext();
|
|
25
|
-
if (!ctx) {
|
|
26
|
-
throw new Error("No authenticated context for delete-staged-dataset.");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const deleted = await deleteStagedDataset({
|
|
30
|
-
id: args.datasetId,
|
|
31
|
-
appId: BRAIN_APP_ID,
|
|
32
|
-
ownerEmail: ctx.userEmail,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (!deleted) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Dataset ${args.datasetId} not found (or belongs to a different owner/app).`,
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return { deleted: true, datasetId: args.datasetId };
|
|
42
|
-
},
|
|
21
|
+
appId: BRAIN_APP_ID,
|
|
43
22
|
});
|
|
@@ -2,7 +2,10 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { resolveAccess } from "@agent-native/core/sharing";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
assertDerivedAudienceAccess,
|
|
7
|
+
serializeKnowledge,
|
|
8
|
+
} from "../server/lib/brain.js";
|
|
6
9
|
|
|
7
10
|
export default defineAction({
|
|
8
11
|
description: "Get one Brain knowledge item by ID.",
|
|
@@ -14,12 +17,13 @@ export default defineAction({
|
|
|
14
17
|
publicAgent: {
|
|
15
18
|
expose: true,
|
|
16
19
|
readOnly: true,
|
|
17
|
-
requiresAuth:
|
|
20
|
+
requiresAuth: true,
|
|
18
21
|
isConsequential: false,
|
|
19
22
|
},
|
|
20
23
|
run: async ({ id }) => {
|
|
21
24
|
const access = await resolveAccess("brain-knowledge", id);
|
|
22
25
|
if (!access) return { knowledge: null };
|
|
26
|
+
await assertDerivedAudienceAccess(access.resource);
|
|
23
27
|
return {
|
|
24
28
|
knowledge: serializeKnowledge(access.resource),
|
|
25
29
|
accessRole: access.role,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
2
|
import { accessFilter } from "@agent-native/core/sharing";
|
|
3
|
-
import { and, desc, eq, inArray, or } from "drizzle-orm";
|
|
3
|
+
import { and, desc, eq, inArray, isNull, or, sql } from "drizzle-orm";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
import { getDb, schema } from "../server/db/index.js";
|
|
7
|
+
import { listAccessibleAudienceIds } from "../server/lib/audiences.js";
|
|
7
8
|
import {
|
|
8
9
|
getAccessibleSource,
|
|
9
10
|
parseJson,
|
|
@@ -451,6 +452,22 @@ export default defineAction({
|
|
|
451
452
|
run: async ({ sourceId, targetChannel }) => {
|
|
452
453
|
const access = await getAccessibleSource(sourceId);
|
|
453
454
|
const db = getDb();
|
|
455
|
+
const accessibleAudienceIds = await listAccessibleAudienceIds([sourceId]);
|
|
456
|
+
const accessibleCaptureAudienceFilter = accessibleAudienceIds.length
|
|
457
|
+
? inArray(schema.brainCaptureAudiences.audienceId, accessibleAudienceIds)
|
|
458
|
+
: sql`1=0`;
|
|
459
|
+
const accessibleDerivedAudienceFilter = or(
|
|
460
|
+
isNull(schema.brainKnowledge.captureId),
|
|
461
|
+
accessibleAudienceIds.length
|
|
462
|
+
? inArray(schema.brainKnowledge.audienceId, accessibleAudienceIds)
|
|
463
|
+
: sql`1=0`,
|
|
464
|
+
)!;
|
|
465
|
+
const accessibleProposalAudienceFilter = or(
|
|
466
|
+
isNull(schema.brainProposals.captureId),
|
|
467
|
+
accessibleAudienceIds.length
|
|
468
|
+
? inArray(schema.brainProposals.audienceId, accessibleAudienceIds)
|
|
469
|
+
: sql`1=0`,
|
|
470
|
+
)!;
|
|
454
471
|
|
|
455
472
|
const [latestSyncRun] = await db
|
|
456
473
|
.select()
|
|
@@ -465,7 +482,17 @@ export default defineAction({
|
|
|
465
482
|
status: schema.brainRawCaptures.status,
|
|
466
483
|
})
|
|
467
484
|
.from(schema.brainRawCaptures)
|
|
468
|
-
.
|
|
485
|
+
.innerJoin(
|
|
486
|
+
schema.brainCaptureAudiences,
|
|
487
|
+
eq(schema.brainCaptureAudiences.captureId, schema.brainRawCaptures.id),
|
|
488
|
+
)
|
|
489
|
+
.where(
|
|
490
|
+
and(
|
|
491
|
+
eq(schema.brainRawCaptures.sourceId, sourceId),
|
|
492
|
+
eq(schema.brainRawCaptures.sensitivityDisposition, "allowed"),
|
|
493
|
+
accessibleCaptureAudienceFilter,
|
|
494
|
+
),
|
|
495
|
+
);
|
|
469
496
|
|
|
470
497
|
const recentCaptureRows = await db
|
|
471
498
|
.select({
|
|
@@ -480,17 +507,24 @@ export default defineAction({
|
|
|
480
507
|
updatedAt: schema.brainRawCaptures.updatedAt,
|
|
481
508
|
})
|
|
482
509
|
.from(schema.brainRawCaptures)
|
|
483
|
-
.
|
|
510
|
+
.innerJoin(
|
|
511
|
+
schema.brainCaptureAudiences,
|
|
512
|
+
eq(schema.brainCaptureAudiences.captureId, schema.brainRawCaptures.id),
|
|
513
|
+
)
|
|
514
|
+
.where(
|
|
515
|
+
and(
|
|
516
|
+
eq(schema.brainRawCaptures.sourceId, sourceId),
|
|
517
|
+
eq(schema.brainRawCaptures.sensitivityDisposition, "allowed"),
|
|
518
|
+
accessibleCaptureAudienceFilter,
|
|
519
|
+
),
|
|
520
|
+
)
|
|
484
521
|
.orderBy(desc(schema.brainRawCaptures.capturedAt))
|
|
485
522
|
.limit(RECENT_LIMIT);
|
|
486
523
|
|
|
487
524
|
const captureIds = captureRows.map((capture) => capture.id);
|
|
488
525
|
const queueSourceFilter = captureIds.length
|
|
489
|
-
?
|
|
490
|
-
|
|
491
|
-
inArray(schema.brainIngestQueue.captureId, captureIds),
|
|
492
|
-
)!
|
|
493
|
-
: eq(schema.brainIngestQueue.sourceId, sourceId);
|
|
526
|
+
? inArray(schema.brainIngestQueue.captureId, captureIds)
|
|
527
|
+
: sql`1=0`;
|
|
494
528
|
|
|
495
529
|
const queueRows = await db
|
|
496
530
|
.select({
|
|
@@ -532,6 +566,7 @@ export default defineAction({
|
|
|
532
566
|
and(
|
|
533
567
|
accessFilter(schema.brainKnowledge, schema.brainKnowledgeShares),
|
|
534
568
|
eq(schema.brainKnowledge.sourceId, sourceId),
|
|
569
|
+
accessibleDerivedAudienceFilter,
|
|
535
570
|
),
|
|
536
571
|
)
|
|
537
572
|
.orderBy(desc(schema.brainKnowledge.updatedAt));
|
|
@@ -556,6 +591,7 @@ export default defineAction({
|
|
|
556
591
|
and(
|
|
557
592
|
accessFilter(schema.brainProposals, schema.brainProposalShares),
|
|
558
593
|
eq(schema.brainProposals.sourceId, sourceId),
|
|
594
|
+
accessibleProposalAudienceFilter,
|
|
559
595
|
),
|
|
560
596
|
)
|
|
561
597
|
.orderBy(desc(schema.brainProposals.updatedAt));
|
|
@@ -2,6 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
BrainCaptureBlockedError,
|
|
5
6
|
createCapture,
|
|
6
7
|
ensureManualSource,
|
|
7
8
|
serializeCapture,
|
|
@@ -31,15 +32,26 @@ export default defineAction({
|
|
|
31
32
|
? null
|
|
32
33
|
: await ensureManualSource(args.sourceTitle ?? "Manual imports");
|
|
33
34
|
const sourceId = args.sourceId ?? source!.id;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
let capture;
|
|
36
|
+
try {
|
|
37
|
+
capture = await createCapture({
|
|
38
|
+
sourceId,
|
|
39
|
+
externalId: args.externalId,
|
|
40
|
+
title: args.title,
|
|
41
|
+
kind: args.kind,
|
|
42
|
+
content: args.content,
|
|
43
|
+
capturedAt: args.capturedAt,
|
|
44
|
+
metadata: args.metadata,
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (!(error instanceof BrainCaptureBlockedError)) throw error;
|
|
48
|
+
return {
|
|
49
|
+
source: source ? serializeSource(source) : undefined,
|
|
50
|
+
capture: undefined,
|
|
51
|
+
sensitivityReceipt: error.receipt,
|
|
52
|
+
nextAction: undefined,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
43
55
|
return {
|
|
44
56
|
source: source ? serializeSource(source) : undefined,
|
|
45
57
|
capture: serializeCapture(capture),
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { getRequestUserEmail } from "@agent-native/core/server/request-context";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
|
|
4
5
|
import {
|
|
6
|
+
BrainCaptureBlockedError,
|
|
5
7
|
createCapture,
|
|
6
8
|
ensureManualSource,
|
|
7
9
|
serializeCapture,
|
|
@@ -26,23 +28,49 @@ export default defineAction({
|
|
|
26
28
|
enqueueDistillation: z.coerce.boolean().default(true),
|
|
27
29
|
}),
|
|
28
30
|
run: async (args) => {
|
|
31
|
+
const importerEmail = getRequestUserEmail()?.trim().toLowerCase();
|
|
32
|
+
let participants = args.participants;
|
|
33
|
+
if (!participants.length) {
|
|
34
|
+
if (!importerEmail) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Importing a transcript without participants requires an authenticated importer.",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
participants = [importerEmail];
|
|
40
|
+
}
|
|
29
41
|
const source = args.sourceId
|
|
30
42
|
? null
|
|
31
43
|
: await ensureManualSource(args.sourceTitle);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
let capture;
|
|
45
|
+
try {
|
|
46
|
+
capture = await createCapture({
|
|
47
|
+
sourceId: args.sourceId ?? source!.id,
|
|
48
|
+
externalId: args.externalId,
|
|
49
|
+
title: args.title,
|
|
50
|
+
kind: "transcript",
|
|
51
|
+
content: args.transcript,
|
|
52
|
+
capturedAt: args.capturedAt,
|
|
53
|
+
metadata: {
|
|
54
|
+
...(args.metadata ?? {}),
|
|
55
|
+
participants,
|
|
56
|
+
sourceUrl: args.sourceUrl,
|
|
57
|
+
tags: args.tags,
|
|
58
|
+
},
|
|
59
|
+
audience: {
|
|
60
|
+
kind: "meeting",
|
|
61
|
+
memberEmails: participants,
|
|
62
|
+
upstreamRefHash: args.externalId,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (!(error instanceof BrainCaptureBlockedError)) throw error;
|
|
67
|
+
return {
|
|
68
|
+
source: source ? serializeSource(source) : undefined,
|
|
69
|
+
capture: undefined,
|
|
70
|
+
sensitivityReceipt: error.receipt,
|
|
71
|
+
nextAction: undefined,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
46
74
|
return {
|
|
47
75
|
source: source ? serializeSource(source) : undefined,
|
|
48
76
|
capture: serializeCapture(capture),
|
|
@@ -4,6 +4,7 @@ import { and, desc, eq, inArray, sql } from "drizzle-orm";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
import { getDb, schema } from "../server/db/index.js";
|
|
7
|
+
import { listAccessibleAudienceIds } from "../server/lib/audiences.js";
|
|
7
8
|
import {
|
|
8
9
|
latestDistillationQueuesForCaptures,
|
|
9
10
|
parseJson,
|
|
@@ -98,9 +99,13 @@ export default defineAction({
|
|
|
98
99
|
|
|
99
100
|
const sourceIds = sourceRows.map((source) => source.id);
|
|
100
101
|
if (!sourceIds.length) return { count: 0, captures: [] };
|
|
102
|
+
const audienceIds = await listAccessibleAudienceIds(sourceIds);
|
|
103
|
+
if (!audienceIds.length) return { count: 0, captures: [] };
|
|
101
104
|
const sourceMap = new Map(sourceRows.map((source) => [source.id, source]));
|
|
102
105
|
const captureClauses = [
|
|
103
106
|
inArray(schema.brainRawCaptures.sourceId, sourceIds),
|
|
107
|
+
eq(schema.brainRawCaptures.sensitivityDisposition, "allowed"),
|
|
108
|
+
inArray(schema.brainCaptureAudiences.audienceId, audienceIds),
|
|
104
109
|
];
|
|
105
110
|
if (args.status) {
|
|
106
111
|
captureClauses.push(eq(schema.brainRawCaptures.status, args.status));
|
|
@@ -118,7 +123,7 @@ export default defineAction({
|
|
|
118
123
|
? Math.min(args.previewLength * 4, 4000)
|
|
119
124
|
: 0;
|
|
120
125
|
const rows = await db
|
|
121
|
-
.
|
|
126
|
+
.selectDistinct({
|
|
122
127
|
id: schema.brainRawCaptures.id,
|
|
123
128
|
sourceId: schema.brainRawCaptures.sourceId,
|
|
124
129
|
externalId: schema.brainRawCaptures.externalId,
|
|
@@ -136,6 +141,10 @@ export default defineAction({
|
|
|
136
141
|
: {}),
|
|
137
142
|
})
|
|
138
143
|
.from(schema.brainRawCaptures)
|
|
144
|
+
.innerJoin(
|
|
145
|
+
schema.brainCaptureAudiences,
|
|
146
|
+
eq(schema.brainCaptureAudiences.captureId, schema.brainRawCaptures.id),
|
|
147
|
+
)
|
|
139
148
|
.where(and(...captureClauses))
|
|
140
149
|
.orderBy(desc(schema.brainRawCaptures.capturedAt))
|
|
141
150
|
.limit(args.limit);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
2
|
import { accessFilter } from "@agent-native/core/sharing";
|
|
3
|
-
import { and, desc, eq, lte, or } from "drizzle-orm";
|
|
3
|
+
import { and, desc, eq, inArray, isNull, lte, or } from "drizzle-orm";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
import { getDb, schema } from "../server/db/index.js";
|
|
7
|
+
import { listAccessibleAudienceIds } from "../server/lib/audiences.js";
|
|
7
8
|
import { redactSensitiveText } from "../server/lib/search.js";
|
|
8
9
|
|
|
9
10
|
const queueStatuses = ["queued", "processing", "done", "failed"] as const;
|
|
@@ -118,27 +119,45 @@ export async function readDistillationQueue(
|
|
|
118
119
|
const staleCutoff = staleProcessingCutoff(now);
|
|
119
120
|
const issue = args.staleOnly ? "stale" : (args.issue ?? "all");
|
|
120
121
|
const limit = args.limit ?? 100;
|
|
122
|
+
const accessibleAudienceIds = await listAccessibleAudienceIds();
|
|
123
|
+
const captureVisibility = or(
|
|
124
|
+
isNull(schema.brainIngestQueue.captureId),
|
|
125
|
+
accessibleAudienceIds.length
|
|
126
|
+
? and(
|
|
127
|
+
eq(schema.brainRawCaptures.sensitivityDisposition, "allowed"),
|
|
128
|
+
inArray(
|
|
129
|
+
schema.brainCaptureAudiences.audienceId,
|
|
130
|
+
accessibleAudienceIds,
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
: undefined,
|
|
134
|
+
);
|
|
121
135
|
const baseClauses = [
|
|
122
136
|
eq(schema.brainIngestQueue.operation, "distill"),
|
|
123
137
|
accessFilter(schema.brainSources, schema.brainSourceShares),
|
|
138
|
+
captureVisibility,
|
|
124
139
|
];
|
|
125
140
|
if (args.sourceId) {
|
|
126
141
|
baseClauses.push(eq(schema.brainSources.id, args.sourceId));
|
|
127
142
|
}
|
|
128
143
|
|
|
129
144
|
const summaryRows = await db
|
|
130
|
-
.
|
|
145
|
+
.selectDistinct({
|
|
131
146
|
status: schema.brainIngestQueue.status,
|
|
132
147
|
updatedAt: schema.brainIngestQueue.updatedAt,
|
|
133
148
|
})
|
|
134
149
|
.from(schema.brainIngestQueue)
|
|
135
150
|
.innerJoin(
|
|
151
|
+
schema.brainSources,
|
|
152
|
+
eq(schema.brainIngestQueue.sourceId, schema.brainSources.id),
|
|
153
|
+
)
|
|
154
|
+
.leftJoin(
|
|
136
155
|
schema.brainRawCaptures,
|
|
137
156
|
eq(schema.brainIngestQueue.captureId, schema.brainRawCaptures.id),
|
|
138
157
|
)
|
|
139
|
-
.
|
|
140
|
-
schema.
|
|
141
|
-
eq(schema.
|
|
158
|
+
.leftJoin(
|
|
159
|
+
schema.brainCaptureAudiences,
|
|
160
|
+
eq(schema.brainCaptureAudiences.captureId, schema.brainRawCaptures.id),
|
|
142
161
|
)
|
|
143
162
|
.where(and(...baseClauses));
|
|
144
163
|
|
|
@@ -164,7 +183,7 @@ export async function readDistillationQueue(
|
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
const rows = await db
|
|
167
|
-
.
|
|
186
|
+
.selectDistinct({
|
|
168
187
|
id: schema.brainIngestQueue.id,
|
|
169
188
|
sourceId: schema.brainIngestQueue.sourceId,
|
|
170
189
|
captureId: schema.brainIngestQueue.captureId,
|
|
@@ -184,12 +203,16 @@ export async function readDistillationQueue(
|
|
|
184
203
|
})
|
|
185
204
|
.from(schema.brainIngestQueue)
|
|
186
205
|
.innerJoin(
|
|
206
|
+
schema.brainSources,
|
|
207
|
+
eq(schema.brainIngestQueue.sourceId, schema.brainSources.id),
|
|
208
|
+
)
|
|
209
|
+
.leftJoin(
|
|
187
210
|
schema.brainRawCaptures,
|
|
188
211
|
eq(schema.brainIngestQueue.captureId, schema.brainRawCaptures.id),
|
|
189
212
|
)
|
|
190
|
-
.
|
|
191
|
-
schema.
|
|
192
|
-
eq(schema.
|
|
213
|
+
.leftJoin(
|
|
214
|
+
schema.brainCaptureAudiences,
|
|
215
|
+
eq(schema.brainCaptureAudiences.captureId, schema.brainRawCaptures.id),
|
|
193
216
|
)
|
|
194
217
|
.where(and(...clauses))
|
|
195
218
|
.orderBy(desc(schema.brainIngestQueue.updatedAt))
|
|
@@ -223,11 +246,13 @@ export async function readDistillationQueue(
|
|
|
223
246
|
provider: row.sourceProvider,
|
|
224
247
|
status: row.sourceStatus,
|
|
225
248
|
},
|
|
226
|
-
capture:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
249
|
+
capture: row.captureId
|
|
250
|
+
? {
|
|
251
|
+
id: row.captureId,
|
|
252
|
+
title: redactOptionalText(row.captureTitle),
|
|
253
|
+
status: row.captureStatus,
|
|
254
|
+
}
|
|
255
|
+
: null,
|
|
231
256
|
};
|
|
232
257
|
});
|
|
233
258
|
|