@agent-native/core 0.112.0 → 0.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +4 -2
- package/corpus/core/CHANGELOG.md +22 -0
- package/corpus/core/docs/AGENTS.md +7 -0
- package/corpus/core/docs/content/integrations.mdx +63 -2
- package/corpus/core/docs/design/provider-integration-authority.md +117 -0
- package/corpus/core/package.json +6 -1
- package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
- package/corpus/core/src/cli/atomic-json-file.ts +324 -0
- package/corpus/core/src/cli/claude-code-participant.ts +515 -0
- package/corpus/core/src/cli/code-agent-executor.ts +18 -10
- package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/corpus/core/src/cli/code-agent-runs.ts +55 -62
- package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
- package/corpus/core/src/cli/multi-frontier-runs.ts +1246 -135
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
- package/corpus/core/src/integrations/index.ts +10 -0
- package/corpus/core/src/integrations/slack-oauth.ts +1 -0
- package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
- package/corpus/core/src/notifications/channels.ts +4 -10
- package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
- package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
- package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
- package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
- package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
- package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
- package/corpus/core/src/provider-api/gong.ts +108 -0
- package/corpus/core/src/scripts/docs/source-search.ts +2 -1
- package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
- package/corpus/core/src/server/index.ts +6 -0
- package/corpus/core/src/styles/chat-history-list.css +1 -313
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/default/AGENTS.md +25 -18
- package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/headless/AGENTS.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
- package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
- package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
- package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/brain/actions/_schemas.ts +13 -7
- package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
- package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/brain/actions/update-source.ts +5 -1
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
- package/corpus/templates/brain/app/lib/brain.ts +55 -0
- package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
- package/corpus/templates/brain/server/lib/connectors.ts +53 -2
- package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
- package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
- package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
- package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
- package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/chat/AGENTS.md +5 -2
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/clips/AGENTS.md +11 -0
- package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
- package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
- package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
- package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
- package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
- package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
- package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
- package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/content/actions/provider-api-request.ts +3 -37
- package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/design/actions/provider-api-request.ts +140 -164
- package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
- package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
- package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/forms/server/lib/integrations.ts +23 -22
- package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
- package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/mail/server/handlers/gong.ts +6 -61
- package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
- package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +125 -0
- package/corpus/toolkit/README.md +60 -0
- package/corpus/toolkit/export-snapshot.json +35 -0
- package/corpus/toolkit/migration-manifest.json +4 -0
- package/corpus/toolkit/package.json +281 -0
- package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
- package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
- package/corpus/toolkit/src/app-shell/index.ts +1 -0
- package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
- package/corpus/toolkit/src/chat-history/index.ts +7 -0
- package/corpus/toolkit/src/chat-history.css +314 -0
- package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
- package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
- package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
- package/corpus/toolkit/src/collab-ui/index.ts +39 -0
- package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
- package/corpus/toolkit/src/collab-ui/types.ts +96 -0
- package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
- package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
- package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
- package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
- package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
- package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
- package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
- package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
- package/corpus/toolkit/src/composer/draft-key.ts +7 -0
- package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
- package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
- package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
- package/corpus/toolkit/src/composer/index.ts +79 -0
- package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
- package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
- package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
- package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
- package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
- package/corpus/toolkit/src/composer/types.ts +66 -0
- package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
- package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
- package/corpus/toolkit/src/composer/use-skills.ts +45 -0
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
- package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
- package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
- package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
- package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
- package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
- package/corpus/toolkit/src/context-ui/format.ts +42 -0
- package/corpus/toolkit/src/context-ui/index.ts +15 -0
- package/corpus/toolkit/src/context-ui/types.ts +43 -0
- package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
- package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
- package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
- package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
- package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
- package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
- package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
- package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
- package/corpus/toolkit/src/editor/RunId.ts +61 -0
- package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
- package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
- package/corpus/toolkit/src/editor/extensions.ts +402 -0
- package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
- package/corpus/toolkit/src/editor/index.ts +93 -0
- package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
- package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
- package/corpus/toolkit/src/editor.css +510 -0
- package/corpus/toolkit/src/hooks/index.ts +2 -0
- package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
- package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
- package/corpus/toolkit/src/index.ts +8 -0
- package/corpus/toolkit/src/onboarding/index.ts +1 -0
- package/corpus/toolkit/src/provider.tsx +47 -0
- package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
- package/corpus/toolkit/src/sharing/index.ts +4 -0
- package/corpus/toolkit/src/styles.css +21 -0
- package/corpus/toolkit/src/ui/accordion.tsx +56 -0
- package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
- package/corpus/toolkit/src/ui/alert.tsx +59 -0
- package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
- package/corpus/toolkit/src/ui/avatar.tsx +48 -0
- package/corpus/toolkit/src/ui/badge.tsx +37 -0
- package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
- package/corpus/toolkit/src/ui/button.tsx +78 -0
- package/corpus/toolkit/src/ui/calendar.tsx +214 -0
- package/corpus/toolkit/src/ui/card.tsx +86 -0
- package/corpus/toolkit/src/ui/carousel.tsx +260 -0
- package/corpus/toolkit/src/ui/chart.tsx +375 -0
- package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
- package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
- package/corpus/toolkit/src/ui/command.tsx +174 -0
- package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
- package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
- package/corpus/toolkit/src/ui/dialog.tsx +146 -0
- package/corpus/toolkit/src/ui/drawer.tsx +126 -0
- package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
- package/corpus/toolkit/src/ui/form.tsx +177 -0
- package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
- package/corpus/toolkit/src/ui/index.ts +52 -0
- package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
- package/corpus/toolkit/src/ui/input.tsx +22 -0
- package/corpus/toolkit/src/ui/label.tsx +24 -0
- package/corpus/toolkit/src/ui/logo.tsx +36 -0
- package/corpus/toolkit/src/ui/menubar.tsx +235 -0
- package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
- package/corpus/toolkit/src/ui/pagination.tsx +121 -0
- package/corpus/toolkit/src/ui/popover.tsx +44 -0
- package/corpus/toolkit/src/ui/progress.tsx +26 -0
- package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
- package/corpus/toolkit/src/ui/resizable.tsx +43 -0
- package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
- package/corpus/toolkit/src/ui/select.tsx +158 -0
- package/corpus/toolkit/src/ui/separator.tsx +29 -0
- package/corpus/toolkit/src/ui/sheet.tsx +160 -0
- package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
- package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
- package/corpus/toolkit/src/ui/slider.tsx +26 -0
- package/corpus/toolkit/src/ui/sonner.tsx +58 -0
- package/corpus/toolkit/src/ui/spinner.tsx +17 -0
- package/corpus/toolkit/src/ui/switch.tsx +27 -0
- package/corpus/toolkit/src/ui/table.tsx +117 -0
- package/corpus/toolkit/src/ui/tabs.tsx +53 -0
- package/corpus/toolkit/src/ui/textarea.tsx +23 -0
- package/corpus/toolkit/src/ui/toast.tsx +127 -0
- package/corpus/toolkit/src/ui/toaster.tsx +33 -0
- package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
- package/corpus/toolkit/src/ui/toggle.tsx +43 -0
- package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
- package/corpus/toolkit/src/ui/use-toast.ts +3 -0
- package/corpus/toolkit/src/utils.ts +8 -0
- package/corpus/toolkit/tsconfig.json +23 -0
- package/dist/cli/atomic-json-file.d.ts +30 -0
- package/dist/cli/atomic-json-file.d.ts.map +1 -0
- package/dist/cli/atomic-json-file.js +240 -0
- package/dist/cli/atomic-json-file.js.map +1 -0
- package/dist/cli/claude-code-participant.d.ts +77 -0
- package/dist/cli/claude-code-participant.d.ts.map +1 -0
- package/dist/cli/claude-code-participant.js +355 -0
- package/dist/cli/claude-code-participant.js.map +1 -0
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +18 -10
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +43 -56
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/codex-cli-participant.d.ts +77 -0
- package/dist/cli/codex-cli-participant.d.ts.map +1 -0
- package/dist/cli/codex-cli-participant.js +354 -0
- package/dist/cli/codex-cli-participant.js.map +1 -0
- package/dist/cli/multi-frontier-runs.d.ts +115 -0
- package/dist/cli/multi-frontier-runs.d.ts.map +1 -1
- package/dist/cli/multi-frontier-runs.js +831 -113
- package/dist/cli/multi-frontier-runs.js.map +1 -1
- package/dist/client/chat/ChatHistoryList.d.ts +1 -87
- package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
- package/dist/client/chat/ChatHistoryList.js +1 -82
- package/dist/client/chat/ChatHistoryList.js.map +1 -1
- package/dist/integrations/index.d.ts +2 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/slack-manifest.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts.map +1 -1
- package/dist/integrations/slack-oauth.js +1 -0
- package/dist/integrations/slack-oauth.js.map +1 -1
- package/dist/integrations/webhook-delivery.d.ts +23 -0
- package/dist/integrations/webhook-delivery.d.ts.map +1 -0
- package/dist/integrations/webhook-delivery.js +32 -0
- package/dist/integrations/webhook-delivery.js.map +1 -0
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +4 -9
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.js +154 -0
- package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
- package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
- package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
- package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.js +3 -40
- package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
- package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
- package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api-audit.js +74 -0
- package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
- package/dist/provider-api/actions/provider-api.d.ts +370 -0
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api.js +280 -0
- package/dist/provider-api/actions/provider-api.js.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.js +3 -116
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
- package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
- package/dist/provider-api/actions/staged-datasets.js +210 -0
- package/dist/provider-api/actions/staged-datasets.js.map +1 -0
- package/dist/provider-api/gong.d.ts +44 -0
- package/dist/provider-api/gong.d.ts.map +1 -0
- package/dist/provider-api/gong.js +56 -0
- package/dist/provider-api/gong.js.map +1 -0
- package/dist/scripts/docs/source-search.d.ts +2 -1
- package/dist/scripts/docs/source-search.d.ts.map +1 -1
- package/dist/scripts/docs/source-search.js +2 -1
- package/dist/scripts/docs/source-search.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/google-oauth-credentials.d.ts +35 -0
- package/dist/server/google-oauth-credentials.d.ts.map +1 -1
- package/dist/server/google-oauth-credentials.js +48 -2
- package/dist/server/google-oauth-credentials.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/styles/chat-history-list.css +1 -313
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/chat/AGENTS.md +5 -2
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/default/AGENTS.md +25 -18
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/headless/AGENTS.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/workspace-core/AGENTS.md +4 -0
- package/dist/templates/workspace-root/AGENTS.md +4 -0
- package/docs/AGENTS.md +7 -0
- package/docs/content/integrations.mdx +63 -2
- package/docs/design/provider-integration-authority.md +117 -0
- package/package.json +7 -2
- package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/chat/AGENTS.md +5 -2
- package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/default/AGENTS.md +25 -18
- package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/headless/AGENTS.md +7 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/workspace-core/AGENTS.md +4 -0
- package/src/templates/workspace-root/AGENTS.md +4 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { execFile as execFileCallback, spawn } from "node:child_process";
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import type { Readable, Writable } from "node:stream";
|
|
4
|
+
import { StringDecoder } from "node:string_decoder";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
|
|
7
|
+
const execFile = promisify(execFileCallback);
|
|
8
|
+
|
|
9
|
+
const CLAUDE_CODE_VERSION = "2.1.208";
|
|
10
|
+
const WATCHDOG_TOOLS = "Read,Glob,Grep";
|
|
11
|
+
const WATCHDOG_DENIED_TOOLS = "Edit,Write,NotebookEdit,Bash";
|
|
12
|
+
const DRIVER_TOOLS = "Read,Glob,Grep,Edit,Write";
|
|
13
|
+
const DEFAULT_MAX_EVENTS = 2_000;
|
|
14
|
+
const DEFAULT_MAX_STREAM_BYTES = 8 * 1024 * 1024;
|
|
15
|
+
const DEFAULT_MAX_STDERR_BYTES = 128 * 1024;
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = 30 * 60 * 1_000;
|
|
17
|
+
const DEFAULT_TERMINATION_GRACE_MS = 2_000;
|
|
18
|
+
const DEFAULT_FORCE_SETTLE_MS = 250;
|
|
19
|
+
const MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
20
|
+
|
|
21
|
+
const SAFE_ENVIRONMENT_KEYS = [
|
|
22
|
+
"PATH",
|
|
23
|
+
"HOME",
|
|
24
|
+
"LANG",
|
|
25
|
+
"LC_ALL",
|
|
26
|
+
"LC_CTYPE",
|
|
27
|
+
"TMPDIR",
|
|
28
|
+
"TMP",
|
|
29
|
+
"TEMP",
|
|
30
|
+
"TERM",
|
|
31
|
+
"NO_COLOR",
|
|
32
|
+
"FORCE_COLOR",
|
|
33
|
+
"USER",
|
|
34
|
+
"LOGNAME",
|
|
35
|
+
"SHELL",
|
|
36
|
+
// Claude Code uses this as its config root; HOME remains required for its
|
|
37
|
+
// default config and macOS Keychain-backed subscription login.
|
|
38
|
+
"CLAUDE_CONFIG_DIR",
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
export type ClaudeCodeParticipantRole = "watchdog" | "driver";
|
|
42
|
+
|
|
43
|
+
export interface ClaudeCodeSubscriptionStatus {
|
|
44
|
+
loggedIn: boolean;
|
|
45
|
+
authMethod?: string;
|
|
46
|
+
apiProvider?: string;
|
|
47
|
+
subscriptionType?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ClaudeCodeParticipantSession {
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
resumeSessionId?: string;
|
|
53
|
+
persist?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ClaudeCodeParticipantEvent {
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ClaudeCodeParticipantResult {
|
|
61
|
+
exitCode: number;
|
|
62
|
+
events: ClaudeCodeParticipantEvent[];
|
|
63
|
+
stderr: string;
|
|
64
|
+
stderrTruncated: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ClaudeCodeParticipantChild {
|
|
68
|
+
stdin: Writable;
|
|
69
|
+
stdout: Readable;
|
|
70
|
+
stderr: Readable;
|
|
71
|
+
kill(signal?: NodeJS.Signals): boolean;
|
|
72
|
+
once(event: "error", listener: (error: Error) => void): unknown;
|
|
73
|
+
once(
|
|
74
|
+
event: "close",
|
|
75
|
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
|
76
|
+
): unknown;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ClaudeCodeParticipantSpawnOptions {
|
|
80
|
+
cwd: string;
|
|
81
|
+
env: NodeJS.ProcessEnv;
|
|
82
|
+
shell: false;
|
|
83
|
+
stdio: ["pipe", "pipe", "pipe"];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type ClaudeCodeParticipantSpawn = (
|
|
87
|
+
command: string,
|
|
88
|
+
args: string[],
|
|
89
|
+
options: ClaudeCodeParticipantSpawnOptions,
|
|
90
|
+
) => ClaudeCodeParticipantChild;
|
|
91
|
+
|
|
92
|
+
export interface RunClaudeCodeParticipantOptions {
|
|
93
|
+
role: ClaudeCodeParticipantRole;
|
|
94
|
+
prompt: string;
|
|
95
|
+
cwd: string;
|
|
96
|
+
model?: string;
|
|
97
|
+
session?: ClaudeCodeParticipantSession;
|
|
98
|
+
/** Either the fixed CLI name or an absolute executable path for packaged apps. */
|
|
99
|
+
command?: string;
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
env?: NodeJS.ProcessEnv;
|
|
102
|
+
maxEvents?: number;
|
|
103
|
+
maxStreamBytes?: number;
|
|
104
|
+
maxStderrBytes?: number;
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
terminationGraceMs?: number;
|
|
107
|
+
forceSettleMs?: number;
|
|
108
|
+
onEvent?: (event: ClaudeCodeParticipantEvent) => void;
|
|
109
|
+
preflight?: (
|
|
110
|
+
context: ClaudeCodeParticipantPreflightContext,
|
|
111
|
+
) => Promise<ClaudeCodeSubscriptionStatus>;
|
|
112
|
+
spawnProcess?: ClaudeCodeParticipantSpawn;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ClaudeCodeParticipantPreflightContext {
|
|
116
|
+
command: string;
|
|
117
|
+
env: NodeJS.ProcessEnv;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export class ClaudeCodeSubscriptionRequiredError extends Error {
|
|
121
|
+
constructor(message: string) {
|
|
122
|
+
super(message);
|
|
123
|
+
this.name = "ClaudeCodeSubscriptionRequiredError";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ClaudeCodeSubscriptionStatusOptions {
|
|
128
|
+
command?: string;
|
|
129
|
+
env?: NodeJS.ProcessEnv;
|
|
130
|
+
execute?: typeof execFile;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export async function readClaudeCodeSubscriptionStatus(
|
|
134
|
+
options: ClaudeCodeSubscriptionStatusOptions = {},
|
|
135
|
+
): Promise<ClaudeCodeSubscriptionStatus> {
|
|
136
|
+
const execute = options.execute ?? execFile;
|
|
137
|
+
const { stdout } = await execute(
|
|
138
|
+
resolveCommand(options.command, "claude"),
|
|
139
|
+
["auth", "status", "--json"],
|
|
140
|
+
{
|
|
141
|
+
encoding: "utf8",
|
|
142
|
+
maxBuffer: 128 * 1024,
|
|
143
|
+
env: safeEnvironment(options.env ?? process.env),
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
const parsed = JSON.parse(stdout) as unknown;
|
|
147
|
+
const status = asRecord(parsed);
|
|
148
|
+
if (!status || typeof status.loggedIn !== "boolean") {
|
|
149
|
+
throw new Error("Claude Code returned an invalid authentication status.");
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
loggedIn: status.loggedIn,
|
|
153
|
+
authMethod: readString(status.authMethod),
|
|
154
|
+
apiProvider: readString(status.apiProvider),
|
|
155
|
+
subscriptionType: readString(status.subscriptionType),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export async function runClaudeCodeParticipant(
|
|
160
|
+
options: RunClaudeCodeParticipantOptions,
|
|
161
|
+
): Promise<ClaudeCodeParticipantResult> {
|
|
162
|
+
validateInput(options);
|
|
163
|
+
const env = safeEnvironment(options.env ?? process.env);
|
|
164
|
+
const command = resolveCommand(options.command, "claude");
|
|
165
|
+
const subscription = await (options.preflight
|
|
166
|
+
? options.preflight({ command, env })
|
|
167
|
+
: readClaudeCodeSubscriptionStatus({ command, env }));
|
|
168
|
+
assertClaudeCodeSubscription(subscription);
|
|
169
|
+
if (options.signal?.aborted) throw createAbortError();
|
|
170
|
+
|
|
171
|
+
const args = buildClaudeCodeParticipantArgs(options);
|
|
172
|
+
const spawnProcess =
|
|
173
|
+
options.spawnProcess ??
|
|
174
|
+
((command, commandArgs, spawnOptions) =>
|
|
175
|
+
spawn(command, commandArgs, spawnOptions));
|
|
176
|
+
const child = spawnProcess(command, args, {
|
|
177
|
+
cwd: options.cwd,
|
|
178
|
+
env,
|
|
179
|
+
shell: false,
|
|
180
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
return collectClaudeCodeParticipantResult(child, options);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function buildClaudeCodeParticipantArgs(
|
|
187
|
+
options: Pick<RunClaudeCodeParticipantOptions, "role" | "model" | "session">,
|
|
188
|
+
): string[] {
|
|
189
|
+
const args = [
|
|
190
|
+
"--print",
|
|
191
|
+
"--input-format",
|
|
192
|
+
"text",
|
|
193
|
+
"--output-format",
|
|
194
|
+
"stream-json",
|
|
195
|
+
"--verbose",
|
|
196
|
+
"--no-chrome",
|
|
197
|
+
"--disable-slash-commands",
|
|
198
|
+
"--strict-mcp-config",
|
|
199
|
+
"--setting-sources",
|
|
200
|
+
"",
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
if (options.role === "watchdog") {
|
|
204
|
+
args.push(
|
|
205
|
+
"--permission-mode",
|
|
206
|
+
"plan",
|
|
207
|
+
"--tools",
|
|
208
|
+
WATCHDOG_TOOLS,
|
|
209
|
+
"--disallowedTools",
|
|
210
|
+
WATCHDOG_DENIED_TOOLS,
|
|
211
|
+
);
|
|
212
|
+
} else {
|
|
213
|
+
args.push("--permission-mode", "acceptEdits", "--tools", DRIVER_TOOLS);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const model = readString(options.model);
|
|
217
|
+
if (model) args.push("--model", model);
|
|
218
|
+
const sessionId = readString(options.session?.sessionId);
|
|
219
|
+
const resumeSessionId = readString(options.session?.resumeSessionId);
|
|
220
|
+
if (sessionId) args.push("--session-id", sessionId);
|
|
221
|
+
if (resumeSessionId) args.push("--resume", resumeSessionId);
|
|
222
|
+
if (options.session?.persist !== true) args.push("--no-session-persistence");
|
|
223
|
+
return args;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function collectClaudeCodeParticipantResult(
|
|
227
|
+
child: ClaudeCodeParticipantChild,
|
|
228
|
+
options: RunClaudeCodeParticipantOptions,
|
|
229
|
+
): Promise<ClaudeCodeParticipantResult> {
|
|
230
|
+
const maxEvents = boundedLimit(options.maxEvents, DEFAULT_MAX_EVENTS);
|
|
231
|
+
const maxStreamBytes = boundedLimit(
|
|
232
|
+
options.maxStreamBytes,
|
|
233
|
+
DEFAULT_MAX_STREAM_BYTES,
|
|
234
|
+
);
|
|
235
|
+
const maxStderrBytes = boundedLimit(
|
|
236
|
+
options.maxStderrBytes,
|
|
237
|
+
DEFAULT_MAX_STDERR_BYTES,
|
|
238
|
+
);
|
|
239
|
+
const timeoutMs = boundedDuration(options.timeoutMs, DEFAULT_TIMEOUT_MS);
|
|
240
|
+
const terminationGraceMs = boundedDuration(
|
|
241
|
+
options.terminationGraceMs,
|
|
242
|
+
DEFAULT_TERMINATION_GRACE_MS,
|
|
243
|
+
);
|
|
244
|
+
const forceSettleMs = boundedDuration(
|
|
245
|
+
options.forceSettleMs,
|
|
246
|
+
DEFAULT_FORCE_SETTLE_MS,
|
|
247
|
+
);
|
|
248
|
+
const decoder = new StringDecoder("utf8");
|
|
249
|
+
const stderrDecoder = new StringDecoder("utf8");
|
|
250
|
+
const events: ClaudeCodeParticipantEvent[] = [];
|
|
251
|
+
let pending = "";
|
|
252
|
+
let streamBytes = 0;
|
|
253
|
+
let stderr = "";
|
|
254
|
+
let stderrBytes = 0;
|
|
255
|
+
let stderrTruncated = false;
|
|
256
|
+
let fatalError: Error | undefined;
|
|
257
|
+
|
|
258
|
+
return new Promise((resolve, reject) => {
|
|
259
|
+
let settled = false;
|
|
260
|
+
let terminationTimer: NodeJS.Timeout | undefined;
|
|
261
|
+
let forceSettleTimer: NodeJS.Timeout | undefined;
|
|
262
|
+
const timeoutTimer = setTimeout(() => {
|
|
263
|
+
stopWithError(new Error(`Claude Code timed out after ${timeoutMs}ms.`));
|
|
264
|
+
}, timeoutMs);
|
|
265
|
+
timeoutTimer.unref?.();
|
|
266
|
+
const cleanup = () => {
|
|
267
|
+
options.signal?.removeEventListener("abort", abort);
|
|
268
|
+
clearTimeout(timeoutTimer);
|
|
269
|
+
if (terminationTimer) clearTimeout(terminationTimer);
|
|
270
|
+
if (forceSettleTimer) clearTimeout(forceSettleTimer);
|
|
271
|
+
};
|
|
272
|
+
const finishError = (error: Error) => {
|
|
273
|
+
if (settled) return;
|
|
274
|
+
settled = true;
|
|
275
|
+
cleanup();
|
|
276
|
+
reject(safeError(error));
|
|
277
|
+
};
|
|
278
|
+
const stopWithError = (error: Error) => {
|
|
279
|
+
if (fatalError) return;
|
|
280
|
+
fatalError = error;
|
|
281
|
+
terminationTimer = setTimeout(() => {
|
|
282
|
+
if (settled) return;
|
|
283
|
+
forceSettleTimer = setTimeout(() => {
|
|
284
|
+
finishError(fatalError ?? error);
|
|
285
|
+
}, forceSettleMs);
|
|
286
|
+
forceSettleTimer.unref?.();
|
|
287
|
+
child.kill("SIGKILL");
|
|
288
|
+
}, terminationGraceMs);
|
|
289
|
+
terminationTimer.unref?.();
|
|
290
|
+
child.kill("SIGTERM");
|
|
291
|
+
};
|
|
292
|
+
const abort = () => stopWithError(createAbortError());
|
|
293
|
+
const streamError = (error: Error) => {
|
|
294
|
+
if (!settled) stopWithError(error);
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
child.stdin.on("error", streamError);
|
|
298
|
+
child.stdout.on("error", streamError);
|
|
299
|
+
child.stderr.on("error", streamError);
|
|
300
|
+
|
|
301
|
+
if (options.signal) {
|
|
302
|
+
if (options.signal.aborted) abort();
|
|
303
|
+
else options.signal.addEventListener("abort", abort, { once: true });
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
child.stdout.on("data", (chunk: Buffer | string) => {
|
|
307
|
+
if (fatalError) return;
|
|
308
|
+
const bytes = Buffer.isBuffer(chunk)
|
|
309
|
+
? chunk.length
|
|
310
|
+
: Buffer.byteLength(chunk);
|
|
311
|
+
streamBytes += bytes;
|
|
312
|
+
if (streamBytes > maxStreamBytes) {
|
|
313
|
+
stopWithError(
|
|
314
|
+
new Error(`Claude Code stream exceeded ${maxStreamBytes} bytes.`),
|
|
315
|
+
);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
pending += decoder.write(
|
|
319
|
+
Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk),
|
|
320
|
+
);
|
|
321
|
+
try {
|
|
322
|
+
pending = consumeJsonLines(pending, events, maxEvents, options.onEvent);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
stopWithError(toError(error));
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
child.stderr.on("data", (chunk: Buffer | string) => {
|
|
328
|
+
const encoded = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
329
|
+
const remaining = Math.max(0, maxStderrBytes - stderrBytes);
|
|
330
|
+
if (remaining === 0) {
|
|
331
|
+
stderrTruncated = true;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
stderr += stderrDecoder.write(encoded.subarray(0, remaining));
|
|
335
|
+
stderrBytes += Math.min(encoded.length, remaining);
|
|
336
|
+
if (encoded.length > remaining) stderrTruncated = true;
|
|
337
|
+
});
|
|
338
|
+
child.once("error", finishError);
|
|
339
|
+
child.once("close", (exitCode, exitSignal) => {
|
|
340
|
+
if (settled) return;
|
|
341
|
+
try {
|
|
342
|
+
pending += decoder.end();
|
|
343
|
+
stderr += stderrDecoder.end();
|
|
344
|
+
if (pending.trim()) {
|
|
345
|
+
consumeJsonLine(pending, events, maxEvents, options.onEvent);
|
|
346
|
+
}
|
|
347
|
+
} catch (error) {
|
|
348
|
+
fatalError ??= toError(error);
|
|
349
|
+
}
|
|
350
|
+
if (fatalError) {
|
|
351
|
+
finishError(fatalError);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (exitCode !== 0) {
|
|
355
|
+
finishError(
|
|
356
|
+
new Error(
|
|
357
|
+
`Claude Code exited with ${exitSignal ?? exitCode ?? "unknown"}${stderr ? `: ${summarizeStderr(stderr)}` : ""}`,
|
|
358
|
+
),
|
|
359
|
+
);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
settled = true;
|
|
363
|
+
cleanup();
|
|
364
|
+
resolve({
|
|
365
|
+
exitCode: 0,
|
|
366
|
+
events,
|
|
367
|
+
stderr: sanitizeStderr(stderr),
|
|
368
|
+
stderrTruncated,
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
try {
|
|
372
|
+
child.stdin.end(options.prompt);
|
|
373
|
+
} catch (error) {
|
|
374
|
+
stopWithError(toError(error));
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function consumeJsonLines(
|
|
380
|
+
value: string,
|
|
381
|
+
events: ClaudeCodeParticipantEvent[],
|
|
382
|
+
maxEvents: number,
|
|
383
|
+
onEvent?: (event: ClaudeCodeParticipantEvent) => void,
|
|
384
|
+
): string {
|
|
385
|
+
let start = 0;
|
|
386
|
+
let newline = value.indexOf("\n", start);
|
|
387
|
+
while (newline !== -1) {
|
|
388
|
+
consumeJsonLine(value.slice(start, newline), events, maxEvents, onEvent);
|
|
389
|
+
start = newline + 1;
|
|
390
|
+
newline = value.indexOf("\n", start);
|
|
391
|
+
}
|
|
392
|
+
return value.slice(start);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function consumeJsonLine(
|
|
396
|
+
line: string,
|
|
397
|
+
events: ClaudeCodeParticipantEvent[],
|
|
398
|
+
maxEvents: number,
|
|
399
|
+
onEvent?: (event: ClaudeCodeParticipantEvent) => void,
|
|
400
|
+
): void {
|
|
401
|
+
const trimmed = line.trim();
|
|
402
|
+
if (!trimmed) return;
|
|
403
|
+
if (events.length >= maxEvents) {
|
|
404
|
+
throw new Error(`Claude Code stream exceeded ${maxEvents} events.`);
|
|
405
|
+
}
|
|
406
|
+
const parsed = JSON.parse(trimmed) as unknown;
|
|
407
|
+
const event = asRecord(parsed);
|
|
408
|
+
if (!event) throw new Error("Claude Code emitted a non-object JSON event.");
|
|
409
|
+
events.push(event);
|
|
410
|
+
onEvent?.(event);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function assertClaudeCodeSubscription(
|
|
414
|
+
status: ClaudeCodeSubscriptionStatus,
|
|
415
|
+
): void {
|
|
416
|
+
if (
|
|
417
|
+
!status.loggedIn ||
|
|
418
|
+
status.authMethod !== "claude.ai" ||
|
|
419
|
+
status.apiProvider !== "firstParty" ||
|
|
420
|
+
!readString(status.subscriptionType)
|
|
421
|
+
) {
|
|
422
|
+
throw new ClaudeCodeSubscriptionRequiredError(
|
|
423
|
+
"Claude Code must be signed in with a Claude subscription. API-key and third-party provider fallback are disabled.",
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function safeEnvironment(input: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
429
|
+
return Object.fromEntries(
|
|
430
|
+
SAFE_ENVIRONMENT_KEYS.flatMap((key) =>
|
|
431
|
+
typeof input[key] === "string" ? [[key, input[key]]] : [],
|
|
432
|
+
),
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function validateInput(options: RunClaudeCodeParticipantOptions): void {
|
|
437
|
+
if (!readString(options.prompt))
|
|
438
|
+
throw new Error("Claude Code prompt is required.");
|
|
439
|
+
if (!readString(options.cwd)) throw new Error("Claude Code cwd is required.");
|
|
440
|
+
if (options.session?.sessionId && options.session.resumeSessionId) {
|
|
441
|
+
throw new Error("Choose either a new Claude session id or a resume id.");
|
|
442
|
+
}
|
|
443
|
+
resolveCommand(options.command, "claude");
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function boundedLimit(value: number | undefined, maximum: number): number {
|
|
447
|
+
return Number.isSafeInteger(value) && (value ?? 0) > 0
|
|
448
|
+
? Math.min(value as number, maximum)
|
|
449
|
+
: maximum;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function boundedDuration(value: number | undefined, fallback: number): number {
|
|
453
|
+
return Number.isSafeInteger(value) && (value ?? 0) > 0
|
|
454
|
+
? Math.min(value as number, DEFAULT_TIMEOUT_MS)
|
|
455
|
+
: fallback;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function resolveCommand(
|
|
459
|
+
command: string | undefined,
|
|
460
|
+
defaultCommand: string,
|
|
461
|
+
): string {
|
|
462
|
+
const value = readString(command) ?? defaultCommand;
|
|
463
|
+
if (value === defaultCommand) return value;
|
|
464
|
+
if (value.includes("\0") || !isAbsolute(value)) {
|
|
465
|
+
throw new Error("Claude Code command must be an absolute executable path.");
|
|
466
|
+
}
|
|
467
|
+
return value;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function createAbortError(): Error {
|
|
471
|
+
const error = new Error("Claude Code participant was canceled.");
|
|
472
|
+
error.name = "AbortError";
|
|
473
|
+
return error;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function toError(value: unknown): Error {
|
|
477
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function safeError(error: Error): Error {
|
|
481
|
+
const safe = new Error(summarizeStderr(error.message));
|
|
482
|
+
safe.name = error.name;
|
|
483
|
+
return safe;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function summarizeStderr(value: string): string {
|
|
487
|
+
return sanitizeStderr(value)
|
|
488
|
+
.replace(/\s+/g, " ")
|
|
489
|
+
.trim()
|
|
490
|
+
.slice(0, MAX_ERROR_MESSAGE_LENGTH);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function sanitizeStderr(value: string): string {
|
|
494
|
+
return value
|
|
495
|
+
.replace(/\bBearer\s+\S+/gi, "Bearer <redacted>")
|
|
496
|
+
.replace(
|
|
497
|
+
/(["']?)([A-Za-z_]*(?:token|key|secret|password)[A-Za-z_]*)\1\s*([=:])\s*(?:"[^"]*"|'[^']*'|[^\s,;}\]]+)/gi,
|
|
498
|
+
'$1$2$1$3"<redacted>"',
|
|
499
|
+
)
|
|
500
|
+
.replace(/\b(?:sk|rk)-[A-Za-z0-9_-]{8,}\b/g, "<redacted>");
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function readString(value: unknown): string | undefined {
|
|
504
|
+
if (typeof value !== "string") return undefined;
|
|
505
|
+
const trimmed = value.trim();
|
|
506
|
+
return trimmed || undefined;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
510
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
511
|
+
? (value as Record<string, unknown>)
|
|
512
|
+
: undefined;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export const CLAUDE_CODE_PARTICIPANT_TESTED_VERSION = CLAUDE_CODE_VERSION;
|
|
@@ -617,36 +617,44 @@ async function executeCodexCliRun(options: {
|
|
|
617
617
|
});
|
|
618
618
|
|
|
619
619
|
if (result.exitCode !== 0) {
|
|
620
|
+
const interrupted = options.signal?.aborted === true;
|
|
620
621
|
const message =
|
|
621
622
|
result.error ??
|
|
622
623
|
result.stderr.trim() ??
|
|
623
624
|
`Codex CLI exited with ${result.exitSignal ?? result.exitCode}.`;
|
|
624
|
-
|
|
625
|
+
const summary = interrupted
|
|
626
|
+
? "Codex CLI run paused."
|
|
627
|
+
: `Codex CLI run failed: ${message}`;
|
|
628
|
+
options.stdout?.write(`\n${summary}\n`);
|
|
625
629
|
appendCodeAgentTranscriptEvent({
|
|
626
630
|
runId: options.run.id,
|
|
627
631
|
kind: "status",
|
|
628
|
-
message:
|
|
632
|
+
message: summary,
|
|
629
633
|
metadata: {
|
|
630
|
-
status: "errored",
|
|
631
|
-
phase: "error",
|
|
634
|
+
status: interrupted ? "paused" : "errored",
|
|
635
|
+
phase: interrupted ? "paused" : "error",
|
|
632
636
|
engine: CODEX_CLI_ENGINE_NAME,
|
|
633
637
|
exitCode: result.exitCode,
|
|
634
638
|
exitSignal: result.exitSignal,
|
|
635
639
|
},
|
|
636
640
|
});
|
|
637
641
|
return updateCodeAgentRunRecord(options.run.id, {
|
|
638
|
-
status:
|
|
639
|
-
phase:
|
|
642
|
+
status: interrupted ? "paused" : "errored",
|
|
643
|
+
phase: interrupted ? "paused" : "error",
|
|
640
644
|
progress: {
|
|
641
|
-
label:
|
|
645
|
+
label: interrupted ? "Paused" : "Error",
|
|
642
646
|
completed: 0,
|
|
643
647
|
total: 1,
|
|
644
|
-
failed:
|
|
648
|
+
failed: interrupted ? 0 : 1,
|
|
645
649
|
percent: 0,
|
|
646
650
|
},
|
|
647
651
|
metadata: {
|
|
648
|
-
|
|
649
|
-
|
|
652
|
+
...(interrupted
|
|
653
|
+
? { executionPausedAt: new Date().toISOString() }
|
|
654
|
+
: {
|
|
655
|
+
executionError: message,
|
|
656
|
+
executionErroredAt: new Date().toISOString(),
|
|
657
|
+
}),
|
|
650
658
|
engine: CODEX_CLI_ENGINE_NAME,
|
|
651
659
|
model: model ?? "codex-default",
|
|
652
660
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addCodeAgentCommandToAllowlist,
|
|
3
|
+
appendCodeAgentTranscriptEvent,
|
|
4
|
+
updateCodeAgentRunRecord,
|
|
5
|
+
} from "./code-agent-runs.js";
|
|
6
|
+
import { appendMultiFrontierParticipantEvent } from "./multi-frontier-runs.js";
|
|
7
|
+
|
|
8
|
+
const [operation, runId, value] = process.argv.slice(2);
|
|
9
|
+
|
|
10
|
+
if (operation === "code-update") {
|
|
11
|
+
updateCodeAgentRunRecord(runId, (record) => ({
|
|
12
|
+
metadata: { [value]: true },
|
|
13
|
+
}));
|
|
14
|
+
} else if (operation === "code-event") {
|
|
15
|
+
appendCodeAgentTranscriptEvent({
|
|
16
|
+
id: value,
|
|
17
|
+
runId,
|
|
18
|
+
kind: "status",
|
|
19
|
+
message: "Concurrent event",
|
|
20
|
+
});
|
|
21
|
+
} else if (operation === "multi-event") {
|
|
22
|
+
appendMultiFrontierParticipantEvent({
|
|
23
|
+
id: value,
|
|
24
|
+
collaborationId: runId,
|
|
25
|
+
participantId: "codex",
|
|
26
|
+
generation: 1,
|
|
27
|
+
permission: "workspace_write",
|
|
28
|
+
});
|
|
29
|
+
} else if (operation === "allowlist") {
|
|
30
|
+
addCodeAgentCommandToAllowlist(value);
|
|
31
|
+
} else {
|
|
32
|
+
throw new Error(`Unknown concurrency worker operation: ${operation}`);
|
|
33
|
+
}
|