lcclaude 1.0.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/.env.example +21 -0
- package/README.en.md +333 -0
- package/README.md +333 -0
- package/bin/lcclaude.js +30 -0
- package/dist/preload.js +15 -0
- package/dist/runtime/bun-bundle-shim.js +10 -0
- package/dist/runtime/bun-wrap-shim.js +63 -0
- package/dist/src/QueryEngine.js +804 -0
- package/dist/src/Task.js +40 -0
- package/dist/src/Tool.js +33 -0
- package/dist/src/assistant/sessionHistory.js +39 -0
- package/dist/src/bootstrap/state.js +985 -0
- package/dist/src/bridge/bridgeApi.js +254 -0
- package/dist/src/bridge/bridgeConfig.js +14 -0
- package/dist/src/bridge/bridgeDebug.js +64 -0
- package/dist/src/bridge/bridgeEnabled.js +55 -0
- package/dist/src/bridge/bridgeMain.js +1547 -0
- package/dist/src/bridge/bridgeMessaging.js +249 -0
- package/dist/src/bridge/bridgePermissionCallbacks.js +7 -0
- package/dist/src/bridge/bridgePointer.js +105 -0
- package/dist/src/bridge/bridgeStatusUtil.js +81 -0
- package/dist/src/bridge/bridgeUI.js +375 -0
- package/dist/src/bridge/capacityWake.js +26 -0
- package/dist/src/bridge/codeSessionApi.js +78 -0
- package/dist/src/bridge/createSession.js +227 -0
- package/dist/src/bridge/debugUtils.js +80 -0
- package/dist/src/bridge/envLessBridgeConfig.js +61 -0
- package/dist/src/bridge/flushGate.js +32 -0
- package/dist/src/bridge/inboundAttachments.js +106 -0
- package/dist/src/bridge/inboundMessages.js +38 -0
- package/dist/src/bridge/initReplBridge.js +276 -0
- package/dist/src/bridge/jwtUtils.js +131 -0
- package/dist/src/bridge/pollConfig.js +28 -0
- package/dist/src/bridge/pollConfigDefaults.js +15 -0
- package/dist/src/bridge/remoteBridgeCore.js +511 -0
- package/dist/src/bridge/replBridge.js +1098 -0
- package/dist/src/bridge/replBridgeHandle.js +14 -0
- package/dist/src/bridge/replBridgeTransport.js +147 -0
- package/dist/src/bridge/sessionIdCompat.js +16 -0
- package/dist/src/bridge/sessionRunner.js +349 -0
- package/dist/src/bridge/trustedDevice.js +113 -0
- package/dist/src/bridge/types.js +6 -0
- package/dist/src/bridge/workSecret.js +51 -0
- package/dist/src/buddy/CompanionSprite.js +435 -0
- package/dist/src/buddy/companion.js +104 -0
- package/dist/src/buddy/prompt.js +31 -0
- package/dist/src/buddy/sprites.js +500 -0
- package/dist/src/buddy/types.js +85 -0
- package/dist/src/buddy/useBuddyNotification.js +93 -0
- package/dist/src/cli/exit.js +13 -0
- package/dist/src/cli/handlers/agents.js +55 -0
- package/dist/src/cli/handlers/auth.js +255 -0
- package/dist/src/cli/handlers/autoMode.js +117 -0
- package/dist/src/cli/handlers/mcp.js +304 -0
- package/dist/src/cli/handlers/plugins.js +538 -0
- package/dist/src/cli/handlers/util.js +119 -0
- package/dist/src/cli/ndjsonSafeStringify.js +8 -0
- package/dist/src/cli/print.js +3112 -0
- package/dist/src/cli/remoteIO.js +161 -0
- package/dist/src/cli/structuredIO.js +489 -0
- package/dist/src/cli/transports/HybridTransport.js +145 -0
- package/dist/src/cli/transports/SSETransport.js +403 -0
- package/dist/src/cli/transports/SerialBatchEventUploader.js +154 -0
- package/dist/src/cli/transports/WebSocketTransport.js +497 -0
- package/dist/src/cli/transports/WorkerStateUploader.js +69 -0
- package/dist/src/cli/transports/ccrClient.js +522 -0
- package/dist/src/cli/transports/transportUtils.js +25 -0
- package/dist/src/cli/update.js +361 -0
- package/dist/src/commands/add-dir/add-dir.js +140 -0
- package/dist/src/commands/add-dir/index.js +8 -0
- package/dist/src/commands/add-dir/validation.js +67 -0
- package/dist/src/commands/advisor.js +96 -0
- package/dist/src/commands/agents/agents.js +12 -0
- package/dist/src/commands/agents/index.js +7 -0
- package/dist/src/commands/ant-trace/index.js +1 -0
- package/dist/src/commands/autofix-pr/index.js +1 -0
- package/dist/src/commands/backfill-sessions/index.js +1 -0
- package/dist/src/commands/branch/branch.js +168 -0
- package/dist/src/commands/branch/index.js +9 -0
- package/dist/src/commands/break-cache/index.js +1 -0
- package/dist/src/commands/bridge/bridge.js +519 -0
- package/dist/src/commands/bridge/index.js +21 -0
- package/dist/src/commands/bridge-kick.js +145 -0
- package/dist/src/commands/brief.js +66 -0
- package/dist/src/commands/btw/btw.js +281 -0
- package/dist/src/commands/btw/index.js +9 -0
- package/dist/src/commands/bughunter/index.js +1 -0
- package/dist/src/commands/chrome/chrome.js +394 -0
- package/dist/src/commands/chrome/index.js +10 -0
- package/dist/src/commands/clear/caches.js +69 -0
- package/dist/src/commands/clear/clear.js +5 -0
- package/dist/src/commands/clear/conversation.js +156 -0
- package/dist/src/commands/clear/index.js +9 -0
- package/dist/src/commands/color/color.js +57 -0
- package/dist/src/commands/color/index.js +9 -0
- package/dist/src/commands/commit-push-pr.js +145 -0
- package/dist/src/commands/commit.js +83 -0
- package/dist/src/commands/compact/compact.js +161 -0
- package/dist/src/commands/compact/index.js +11 -0
- package/dist/src/commands/config/config.js +9 -0
- package/dist/src/commands/config/index.js +8 -0
- package/dist/src/commands/context/context-noninteractive.js +256 -0
- package/dist/src/commands/context/context.js +33 -0
- package/dist/src/commands/context/index.js +21 -0
- package/dist/src/commands/copy/copy.js +397 -0
- package/dist/src/commands/copy/index.js +7 -0
- package/dist/src/commands/cost/cost.js +21 -0
- package/dist/src/commands/cost/index.js +15 -0
- package/dist/src/commands/createMovedToPluginCommand.js +40 -0
- package/dist/src/commands/ctx_viz/index.js +1 -0
- package/dist/src/commands/debug-tool-call/index.js +1 -0
- package/dist/src/commands/desktop/desktop.js +7 -0
- package/dist/src/commands/desktop/index.js +22 -0
- package/dist/src/commands/diff/diff.js +10 -0
- package/dist/src/commands/diff/index.js +6 -0
- package/dist/src/commands/doctor/doctor.js +7 -0
- package/dist/src/commands/doctor/index.js +9 -0
- package/dist/src/commands/effort/effort.js +181 -0
- package/dist/src/commands/effort/index.js +11 -0
- package/dist/src/commands/env/index.js +1 -0
- package/dist/src/commands/exit/exit.js +25 -0
- package/dist/src/commands/exit/index.js +9 -0
- package/dist/src/commands/export/export.js +79 -0
- package/dist/src/commands/export/index.js +8 -0
- package/dist/src/commands/extra-usage/extra-usage-core.js +85 -0
- package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +11 -0
- package/dist/src/commands/extra-usage/extra-usage.js +17 -0
- package/dist/src/commands/extra-usage/index.js +27 -0
- package/dist/src/commands/fast/fast.js +345 -0
- package/dist/src/commands/fast/index.js +23 -0
- package/dist/src/commands/feedback/feedback.js +15 -0
- package/dist/src/commands/feedback/index.js +13 -0
- package/dist/src/commands/files/files.js +13 -0
- package/dist/src/commands/files/index.js +9 -0
- package/dist/src/commands/good-claude/index.js +1 -0
- package/dist/src/commands/heapdump/heapdump.js +15 -0
- package/dist/src/commands/heapdump/index.js +9 -0
- package/dist/src/commands/help/help.js +12 -0
- package/dist/src/commands/help/index.js +7 -0
- package/dist/src/commands/hooks/hooks.js +14 -0
- package/dist/src/commands/hooks/index.js +8 -0
- package/dist/src/commands/ide/ide.js +702 -0
- package/dist/src/commands/ide/index.js +8 -0
- package/dist/src/commands/init-verifiers.js +258 -0
- package/dist/src/commands/init.js +240 -0
- package/dist/src/commands/insights.js +2212 -0
- package/dist/src/commands/install-github-app/ApiKeyStep.js +290 -0
- package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +265 -0
- package/dist/src/commands/install-github-app/CheckGitHubStep.js +16 -0
- package/dist/src/commands/install-github-app/ChooseRepoStep.js +282 -0
- package/dist/src/commands/install-github-app/CreatingStep.js +87 -0
- package/dist/src/commands/install-github-app/ErrorStep.js +157 -0
- package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +164 -0
- package/dist/src/commands/install-github-app/InstallAppStep.js +166 -0
- package/dist/src/commands/install-github-app/OAuthFlowStep.js +335 -0
- package/dist/src/commands/install-github-app/SuccessStep.js +173 -0
- package/dist/src/commands/install-github-app/WarningsStep.js +140 -0
- package/dist/src/commands/install-github-app/index.js +10 -0
- package/dist/src/commands/install-github-app/install-github-app.js +612 -0
- package/dist/src/commands/install-github-app/setupGitHubActions.js +223 -0
- package/dist/src/commands/install-slack-app/index.js +9 -0
- package/dist/src/commands/install-slack-app/install-slack-app.js +23 -0
- package/dist/src/commands/install.js +348 -0
- package/dist/src/commands/issue/index.js +1 -0
- package/dist/src/commands/keybindings/index.js +10 -0
- package/dist/src/commands/keybindings/keybindings.js +43 -0
- package/dist/src/commands/login/index.js +9 -0
- package/dist/src/commands/login/login.js +105 -0
- package/dist/src/commands/logout/index.js +8 -0
- package/dist/src/commands/logout/logout.js +68 -0
- package/dist/src/commands/mcp/addCommand.js +157 -0
- package/dist/src/commands/mcp/index.js +9 -0
- package/dist/src/commands/mcp/mcp.js +85 -0
- package/dist/src/commands/mcp/xaaIdpCommand.js +135 -0
- package/dist/src/commands/memory/index.js +7 -0
- package/dist/src/commands/memory/memory.js +95 -0
- package/dist/src/commands/mobile/index.js +8 -0
- package/dist/src/commands/mobile/mobile.js +324 -0
- package/dist/src/commands/mock-limits/index.js +1 -0
- package/dist/src/commands/model/index.js +14 -0
- package/dist/src/commands/model/model.js +289 -0
- package/dist/src/commands/oauth-refresh/index.js +1 -0
- package/dist/src/commands/onboarding/index.js +1 -0
- package/dist/src/commands/output-style/index.js +8 -0
- package/dist/src/commands/output-style/output-style.js +5 -0
- package/dist/src/commands/passes/index.js +20 -0
- package/dist/src/commands/passes/passes.js +23 -0
- package/dist/src/commands/perf-issue/index.js +1 -0
- package/dist/src/commands/permissions/index.js +8 -0
- package/dist/src/commands/permissions/permissions.js +11 -0
- package/dist/src/commands/plan/index.js +8 -0
- package/dist/src/commands/plan/plan.js +151 -0
- package/dist/src/commands/plugin/AddMarketplace.js +202 -0
- package/dist/src/commands/plugin/BrowseMarketplace.js +918 -0
- package/dist/src/commands/plugin/DiscoverPlugins.js +935 -0
- package/dist/src/commands/plugin/ManageMarketplaces.js +1018 -0
- package/dist/src/commands/plugin/ManagePlugins.js +2230 -0
- package/dist/src/commands/plugin/PluginErrors.js +118 -0
- package/dist/src/commands/plugin/PluginOptionsDialog.js +396 -0
- package/dist/src/commands/plugin/PluginOptionsFlow.js +80 -0
- package/dist/src/commands/plugin/PluginSettings.js +1313 -0
- package/dist/src/commands/plugin/PluginTrustWarning.js +50 -0
- package/dist/src/commands/plugin/UnifiedInstalledCell.js +749 -0
- package/dist/src/commands/plugin/ValidatePlugin.js +113 -0
- package/dist/src/commands/plugin/index.js +9 -0
- package/dist/src/commands/plugin/parseArgs.js +61 -0
- package/dist/src/commands/plugin/plugin.js +8 -0
- package/dist/src/commands/plugin/pluginDetailsHelpers.js +114 -0
- package/dist/src/commands/plugin/usePagination.js +75 -0
- package/dist/src/commands/pr_comments/index.js +49 -0
- package/dist/src/commands/privacy-settings/index.js +11 -0
- package/dist/src/commands/privacy-settings/privacy-settings.js +58 -0
- package/dist/src/commands/rate-limit-options/index.js +15 -0
- package/dist/src/commands/rate-limit-options/rate-limit-options.js +211 -0
- package/dist/src/commands/release-notes/index.js +8 -0
- package/dist/src/commands/release-notes/release-notes.js +38 -0
- package/dist/src/commands/reload-plugins/index.js +8 -0
- package/dist/src/commands/reload-plugins/reload-plugins.js +27 -0
- package/dist/src/commands/remote-env/index.js +12 -0
- package/dist/src/commands/remote-env/remote-env.js +7 -0
- package/dist/src/commands/remote-setup/api.js +121 -0
- package/dist/src/commands/remote-setup/index.js +14 -0
- package/dist/src/commands/remote-setup/remote-setup.js +173 -0
- package/dist/src/commands/rename/generateSessionName.js +51 -0
- package/dist/src/commands/rename/index.js +9 -0
- package/dist/src/commands/rename/rename.js +52 -0
- package/dist/src/commands/reset-limits/index.js +4 -0
- package/dist/src/commands/resume/index.js +9 -0
- package/dist/src/commands/resume/resume.js +281 -0
- package/dist/src/commands/review/UltrareviewOverageDialog.js +112 -0
- package/dist/src/commands/review/reviewRemote.js +193 -0
- package/dist/src/commands/review/ultrareviewCommand.js +50 -0
- package/dist/src/commands/review/ultrareviewEnabled.js +5 -0
- package/dist/src/commands/review.js +45 -0
- package/dist/src/commands/rewind/index.js +10 -0
- package/dist/src/commands/rewind/rewind.js +6 -0
- package/dist/src/commands/sandbox-toggle/index.js +35 -0
- package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +61 -0
- package/dist/src/commands/security-review.js +228 -0
- package/dist/src/commands/session/index.js +13 -0
- package/dist/src/commands/session/session.js +185 -0
- package/dist/src/commands/share/index.js +1 -0
- package/dist/src/commands/skills/index.js +7 -0
- package/dist/src/commands/skills/skills.js +8 -0
- package/dist/src/commands/stats/index.js +7 -0
- package/dist/src/commands/stats/stats.js +7 -0
- package/dist/src/commands/status/index.js +8 -0
- package/dist/src/commands/status/status.js +9 -0
- package/dist/src/commands/statusline.js +20 -0
- package/dist/src/commands/stickers/index.js +8 -0
- package/dist/src/commands/stickers/stickers.js +13 -0
- package/dist/src/commands/summary/index.js +1 -0
- package/dist/src/commands/tag/index.js +9 -0
- package/dist/src/commands/tag/tag.js +250 -0
- package/dist/src/commands/tasks/index.js +8 -0
- package/dist/src/commands/tasks/tasks.js +8 -0
- package/dist/src/commands/teleport/index.js +1 -0
- package/dist/src/commands/terminalSetup/index.js +15 -0
- package/dist/src/commands/terminalSetup/terminalSetup.js +425 -0
- package/dist/src/commands/theme/index.js +7 -0
- package/dist/src/commands/theme/theme.js +58 -0
- package/dist/src/commands/thinkback/index.js +9 -0
- package/dist/src/commands/thinkback/thinkback.js +569 -0
- package/dist/src/commands/thinkback-play/index.js +11 -0
- package/dist/src/commands/thinkback-play/thinkback-play.js +31 -0
- package/dist/src/commands/ultraplan.js +361 -0
- package/dist/src/commands/upgrade/index.js +11 -0
- package/dist/src/commands/upgrade/upgrade.js +37 -0
- package/dist/src/commands/usage/index.js +7 -0
- package/dist/src/commands/usage/usage.js +9 -0
- package/dist/src/commands/version.js +15 -0
- package/dist/src/commands/vim/index.js +8 -0
- package/dist/src/commands/vim/vim.js +24 -0
- package/dist/src/commands/voice/index.js +17 -0
- package/dist/src/commands/voice/voice.js +117 -0
- package/dist/src/commands.js +476 -0
- package/dist/src/components/AgentProgressLine.js +202 -0
- package/dist/src/components/App.js +53 -0
- package/dist/src/components/ApproveApiKey.js +156 -0
- package/dist/src/components/AutoModeOptInDialog.js +154 -0
- package/dist/src/components/AutoUpdater.js +178 -0
- package/dist/src/components/AutoUpdaterWrapper.js +91 -0
- package/dist/src/components/AwsAuthStatusBox.js +119 -0
- package/dist/src/components/BaseTextInput.js +158 -0
- package/dist/src/components/BashModeProgress.js +65 -0
- package/dist/src/components/BridgeDialog.js +460 -0
- package/dist/src/components/BypassPermissionsModeDialog.js +111 -0
- package/dist/src/components/ChannelDowngradeDialog.js +114 -0
- package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +120 -0
- package/dist/src/components/ClaudeInChromeOnboarding.js +176 -0
- package/dist/src/components/ClaudeMdExternalIncludesDialog.js +172 -0
- package/dist/src/components/ClickableImageRef.js +74 -0
- package/dist/src/components/CompactSummary.js +220 -0
- package/dist/src/components/ConfigurableShortcutHint.js +33 -0
- package/dist/src/components/ConsoleOAuthFlow.js +841 -0
- package/dist/src/components/ContextSuggestions.js +85 -0
- package/dist/src/components/ContextVisualization.js +878 -0
- package/dist/src/components/CoordinatorAgentStatus.js +304 -0
- package/dist/src/components/CostThresholdDialog.js +66 -0
- package/dist/src/components/CtrlOToExpand.js +56 -0
- package/dist/src/components/CustomSelect/SelectMulti.js +246 -0
- package/dist/src/components/CustomSelect/index.js +2 -0
- package/dist/src/components/CustomSelect/option-map.js +32 -0
- package/dist/src/components/CustomSelect/select-input-option.js +558 -0
- package/dist/src/components/CustomSelect/select-option.js +39 -0
- package/dist/src/components/CustomSelect/select.js +803 -0
- package/dist/src/components/CustomSelect/use-multi-select-state.js +175 -0
- package/dist/src/components/CustomSelect/use-select-input.js +163 -0
- package/dist/src/components/CustomSelect/use-select-navigation.js +334 -0
- package/dist/src/components/CustomSelect/use-select-state.js +30 -0
- package/dist/src/components/DesktopHandoff.js +214 -0
- package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +185 -0
- package/dist/src/components/DevBar.js +53 -0
- package/dist/src/components/DevChannelsDialog.js +128 -0
- package/dist/src/components/DiagnosticsDisplay.js +149 -0
- package/dist/src/components/EffortCallout.js +302 -0
- package/dist/src/components/EffortIndicator.js +30 -0
- package/dist/src/components/ExitFlow.js +45 -0
- package/dist/src/components/ExportDialog.js +160 -0
- package/dist/src/components/FallbackToolUseErrorMessage.js +149 -0
- package/dist/src/components/FallbackToolUseRejectedMessage.js +18 -0
- package/dist/src/components/FastIcon.js +49 -0
- package/dist/src/components/Feedback.js +589 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +219 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +168 -0
- package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +147 -0
- package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +70 -0
- package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +45 -0
- package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +242 -0
- package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +188 -0
- package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +200 -0
- package/dist/src/components/FeedbackSurvey/useSurveyState.js +81 -0
- package/dist/src/components/FileEditToolDiff.js +193 -0
- package/dist/src/components/FileEditToolUpdatedMessage.js +162 -0
- package/dist/src/components/FileEditToolUseRejectedMessage.js +215 -0
- package/dist/src/components/FilePathLink.js +33 -0
- package/dist/src/components/FullscreenLayout.js +592 -0
- package/dist/src/components/GlobalSearchDialog.js +371 -0
- package/dist/src/components/HelpV2/Commands.js +99 -0
- package/dist/src/components/HelpV2/General.js +48 -0
- package/dist/src/components/HelpV2/HelpV2.js +231 -0
- package/dist/src/components/HighlightedCode/Fallback.js +200 -0
- package/dist/src/components/HighlightedCode.js +219 -0
- package/dist/src/components/HistorySearchDialog.js +144 -0
- package/dist/src/components/IdeAutoConnectDialog.js +172 -0
- package/dist/src/components/IdeOnboardingDialog.js +249 -0
- package/dist/src/components/IdeStatusIndicator.js +68 -0
- package/dist/src/components/IdleReturnDialog.js +126 -0
- package/dist/src/components/InterruptedByUser.js +25 -0
- package/dist/src/components/InvalidConfigDialog.js +173 -0
- package/dist/src/components/InvalidSettingsDialog.js +94 -0
- package/dist/src/components/KeybindingWarnings.js +144 -0
- package/dist/src/components/LanguagePicker.js +112 -0
- package/dist/src/components/LogSelector.js +1775 -0
- package/dist/src/components/LogoV2/AnimatedAsterisk.js +49 -0
- package/dist/src/components/LogoV2/AnimatedClawd.js +105 -0
- package/dist/src/components/LogoV2/ChannelsNotice.js +334 -0
- package/dist/src/components/LogoV2/Clawd.js +285 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +218 -0
- package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
- package/dist/src/components/LogoV2/Feed.js +140 -0
- package/dist/src/components/LogoV2/FeedColumn.js +67 -0
- package/dist/src/components/LogoV2/GuestPassesUpsell.js +90 -0
- package/dist/src/components/LogoV2/LogoV2.js +774 -0
- package/dist/src/components/LogoV2/Opus1mMergeNotice.js +68 -0
- package/dist/src/components/LogoV2/OverageCreditUpsell.js +154 -0
- package/dist/src/components/LogoV2/VoiceModeNotice.js +75 -0
- package/dist/src/components/LogoV2/WelcomeV2.js +976 -0
- package/dist/src/components/LogoV2/feedConfigs.js +89 -0
- package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +128 -0
- package/dist/src/components/MCPServerApprovalDialog.js +121 -0
- package/dist/src/components/MCPServerDesktopImportDialog.js +249 -0
- package/dist/src/components/MCPServerDialogCopy.js +24 -0
- package/dist/src/components/MCPServerMultiselectDialog.js +173 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +199 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +75 -0
- package/dist/src/components/Markdown.js +200 -0
- package/dist/src/components/MarkdownTable.js +215 -0
- package/dist/src/components/MemoryUsageIndicator.js +33 -0
- package/dist/src/components/Message.js +638 -0
- package/dist/src/components/MessageModel.js +43 -0
- package/dist/src/components/MessageResponse.js +99 -0
- package/dist/src/components/MessageRow.js +350 -0
- package/dist/src/components/MessageSelector.js +1021 -0
- package/dist/src/components/MessageTimestamp.js +63 -0
- package/dist/src/components/Messages.js +576 -0
- package/dist/src/components/ModelPicker.js +582 -0
- package/dist/src/components/NativeAutoUpdater.js +169 -0
- package/dist/src/components/NotebookEditToolUseRejectedMessage.js +123 -0
- package/dist/src/components/OffscreenFreeze.js +21 -0
- package/dist/src/components/Onboarding.js +307 -0
- package/dist/src/components/OutputStylePicker.js +128 -0
- package/dist/src/components/PackageManagerAutoUpdater.js +116 -0
- package/dist/src/components/Passes/Passes.js +242 -0
- package/dist/src/components/PrBadge.js +119 -0
- package/dist/src/components/PressEnterToContinue.js +24 -0
- package/dist/src/components/PromptInput/HistorySearchInput.js +64 -0
- package/dist/src/components/PromptInput/IssueFlagBanner.js +6 -0
- package/dist/src/components/PromptInput/Notifications.js +343 -0
- package/dist/src/components/PromptInput/PromptInput.js +1837 -0
- package/dist/src/components/PromptInput/PromptInputFooter.js +192 -0
- package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +504 -0
- package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +296 -0
- package/dist/src/components/PromptInput/PromptInputHelpMenu.js +508 -0
- package/dist/src/components/PromptInput/PromptInputModeIndicator.js +92 -0
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +90 -0
- package/dist/src/components/PromptInput/PromptInputStashNotice.js +30 -0
- package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +80 -0
- package/dist/src/components/PromptInput/ShimmeredInput.js +157 -0
- package/dist/src/components/PromptInput/VoiceIndicator.js +138 -0
- package/dist/src/components/PromptInput/inputModes.js +24 -0
- package/dist/src/components/PromptInput/inputPaste.js +46 -0
- package/dist/src/components/PromptInput/useMaybeTruncateInput.js +36 -0
- package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +39 -0
- package/dist/src/components/PromptInput/useShowFastIconHint.js +19 -0
- package/dist/src/components/PromptInput/useSwarmBanner.js +99 -0
- package/dist/src/components/PromptInput/utils.js +25 -0
- package/dist/src/components/QuickOpenDialog.js +272 -0
- package/dist/src/components/RemoteCallout.js +81 -0
- package/dist/src/components/RemoteEnvironmentDialog.js +451 -0
- package/dist/src/components/ResumeTask.js +361 -0
- package/dist/src/components/SandboxViolationExpandedView.js +134 -0
- package/dist/src/components/ScrollKeybindingHandler.js +589 -0
- package/dist/src/components/SearchBox.js +111 -0
- package/dist/src/components/SentryErrorBoundary.js +17 -0
- package/dist/src/components/SessionBackgroundHint.js +103 -0
- package/dist/src/components/SessionPreview.js +263 -0
- package/dist/src/components/Settings/Config.js +1776 -0
- package/dist/src/components/Settings/Settings.js +159 -0
- package/dist/src/components/Settings/Status.js +315 -0
- package/dist/src/components/Settings/Usage.js +503 -0
- package/dist/src/components/ShowInIDEPrompt.js +212 -0
- package/dist/src/components/SkillImprovementSurvey.js +204 -0
- package/dist/src/components/Spinner/FlashingChar.js +60 -0
- package/dist/src/components/Spinner/GlimmerMessage.js +391 -0
- package/dist/src/components/Spinner/ShimmerChar.js +30 -0
- package/dist/src/components/Spinner/SpinnerAnimationRow.js +248 -0
- package/dist/src/components/Spinner/SpinnerGlyph.js +105 -0
- package/dist/src/components/Spinner/TeammateSpinnerLine.js +243 -0
- package/dist/src/components/Spinner/TeammateSpinnerTree.js +360 -0
- package/dist/src/components/Spinner/index.js +7 -0
- package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
- package/dist/src/components/Spinner/useShimmerAnimation.js +17 -0
- package/dist/src/components/Spinner/useStalledAnimation.js +47 -0
- package/dist/src/components/Spinner/utils.js +65 -0
- package/dist/src/components/Spinner.js +596 -0
- package/dist/src/components/Stats.js +1415 -0
- package/dist/src/components/StatusLine.js +264 -0
- package/dist/src/components/StatusNotices.js +50 -0
- package/dist/src/components/StructuredDiff/Fallback.js +379 -0
- package/dist/src/components/StructuredDiff/colorDiff.js +21 -0
- package/dist/src/components/StructuredDiff.js +170 -0
- package/dist/src/components/StructuredDiffList.js +30 -0
- package/dist/src/components/TagTabs.js +124 -0
- package/dist/src/components/TaskListV2.js +430 -0
- package/dist/src/components/TeammateViewHeader.js +112 -0
- package/dist/src/components/TeleportError.js +200 -0
- package/dist/src/components/TeleportProgress.js +175 -0
- package/dist/src/components/TeleportRepoMismatchDialog.js +160 -0
- package/dist/src/components/TeleportResumeWrapper.js +207 -0
- package/dist/src/components/TeleportStash.js +159 -0
- package/dist/src/components/TextInput.js +94 -0
- package/dist/src/components/ThemePicker.js +428 -0
- package/dist/src/components/ThinkingToggle.js +233 -0
- package/dist/src/components/TokenWarning.js +165 -0
- package/dist/src/components/ToolUseLoader.js +44 -0
- package/dist/src/components/TrustDialog/TrustDialog.js +337 -0
- package/dist/src/components/TrustDialog/utils.js +149 -0
- package/dist/src/components/ValidationErrorsList.js +169 -0
- package/dist/src/components/VimTextInput.js +142 -0
- package/dist/src/components/VirtualMessageList.js +745 -0
- package/dist/src/components/WorkflowMultiselectDialog.js +173 -0
- package/dist/src/components/WorktreeExitDialog.js +228 -0
- package/dist/src/components/agents/AgentDetail.js +371 -0
- package/dist/src/components/agents/AgentEditor.js +191 -0
- package/dist/src/components/agents/AgentNavigationFooter.js +28 -0
- package/dist/src/components/agents/AgentsList.js +623 -0
- package/dist/src/components/agents/AgentsMenu.js +897 -0
- package/dist/src/components/agents/ColorPicker.js +170 -0
- package/dist/src/components/agents/ModelSelector.js +79 -0
- package/dist/src/components/agents/ToolSelector.js +581 -0
- package/dist/src/components/agents/agentFileUtils.js +142 -0
- package/dist/src/components/agents/generateAgent.js +160 -0
- package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +101 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +108 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +551 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +73 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +104 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +136 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +105 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +75 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +185 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +81 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +146 -0
- package/dist/src/components/agents/types.js +4 -0
- package/dist/src/components/agents/utils.js +14 -0
- package/dist/src/components/agents/validateAgent.js +66 -0
- package/dist/src/components/design-system/Byline.js +53 -0
- package/dist/src/components/design-system/Dialog.js +171 -0
- package/dist/src/components/design-system/Divider.js +107 -0
- package/dist/src/components/design-system/FuzzyPicker.js +316 -0
- package/dist/src/components/design-system/KeyboardShortcutHint.js +63 -0
- package/dist/src/components/design-system/ListItem.js +186 -0
- package/dist/src/components/design-system/LoadingState.js +72 -0
- package/dist/src/components/design-system/Pane.js +67 -0
- package/dist/src/components/design-system/ProgressBar.js +67 -0
- package/dist/src/components/design-system/Ratchet.js +83 -0
- package/dist/src/components/design-system/StatusIcon.js +60 -0
- package/dist/src/components/design-system/Tabs.js +332 -0
- package/dist/src/components/design-system/ThemeProvider.js +117 -0
- package/dist/src/components/design-system/ThemedBox.js +123 -0
- package/dist/src/components/design-system/ThemedText.js +68 -0
- package/dist/src/components/design-system/color.js +13 -0
- package/dist/src/components/diff/DiffDetailView.js +388 -0
- package/dist/src/components/diff/DiffDialog.js +489 -0
- package/dist/src/components/diff/DiffFileList.js +359 -0
- package/dist/src/components/grove/Grove.js +710 -0
- package/dist/src/components/hooks/HooksConfigMenu.js +626 -0
- package/dist/src/components/hooks/PromptDialog.js +96 -0
- package/dist/src/components/hooks/SelectEventMode.js +169 -0
- package/dist/src/components/hooks/SelectHookMode.js +127 -0
- package/dist/src/components/hooks/SelectMatcherMode.js +156 -0
- package/dist/src/components/hooks/ViewHookMode.js +275 -0
- package/dist/src/components/mcp/CapabilitiesSection.js +68 -0
- package/dist/src/components/mcp/ElicitationDialog.js +1330 -0
- package/dist/src/components/mcp/MCPAgentServerMenu.js +275 -0
- package/dist/src/components/mcp/MCPListPanel.js +671 -0
- package/dist/src/components/mcp/MCPReconnect.js +210 -0
- package/dist/src/components/mcp/MCPRemoteServerMenu.js +906 -0
- package/dist/src/components/mcp/MCPSettings.js +415 -0
- package/dist/src/components/mcp/MCPStdioServerMenu.js +276 -0
- package/dist/src/components/mcp/MCPToolDetailView.js +316 -0
- package/dist/src/components/mcp/MCPToolListView.js +169 -0
- package/dist/src/components/mcp/McpParsingWarnings.js +319 -0
- package/dist/src/components/mcp/index.js +8 -0
- package/dist/src/components/mcp/utils/reconnectHelpers.js +28 -0
- package/dist/src/components/memory/MemoryFileSelector.js +459 -0
- package/dist/src/components/memory/MemoryUpdateNotification.js +51 -0
- package/dist/src/components/messageActions.js +464 -0
- package/dist/src/components/messages/AdvisorMessage.js +202 -0
- package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +34 -0
- package/dist/src/components/messages/AssistantTextMessage.js +373 -0
- package/dist/src/components/messages/AssistantThinkingMessage.js +105 -0
- package/dist/src/components/messages/AssistantToolUseMessage.js +414 -0
- package/dist/src/components/messages/AttachmentMessage.js +764 -0
- package/dist/src/components/messages/CollapsedReadSearchContent.js +651 -0
- package/dist/src/components/messages/CompactBoundaryMessage.js +27 -0
- package/dist/src/components/messages/GroupedToolUseContent.js +42 -0
- package/dist/src/components/messages/HighlightedThinkingText.js +215 -0
- package/dist/src/components/messages/HookProgressMessage.js +150 -0
- package/dist/src/components/messages/PlanApprovalMessage.js +294 -0
- package/dist/src/components/messages/RateLimitMessage.js +164 -0
- package/dist/src/components/messages/ShutdownMessage.js +180 -0
- package/dist/src/components/messages/SystemAPIErrorMessage.js +162 -0
- package/dist/src/components/messages/SystemTextMessage.js +1145 -0
- package/dist/src/components/messages/TaskAssignmentMessage.js +100 -0
- package/dist/src/components/messages/UserAgentNotificationMessage.js +89 -0
- package/dist/src/components/messages/UserBashInputMessage.js +67 -0
- package/dist/src/components/messages/UserBashOutputMessage.js +56 -0
- package/dist/src/components/messages/UserChannelMessage.js +145 -0
- package/dist/src/components/messages/UserCommandMessage.js +146 -0
- package/dist/src/components/messages/UserImageMessage.js +59 -0
- package/dist/src/components/messages/UserLocalCommandOutputMessage.js +226 -0
- package/dist/src/components/messages/UserMemoryInputMessage.js +101 -0
- package/dist/src/components/messages/UserPlanMessage.js +56 -0
- package/dist/src/components/messages/UserPromptMessage.js +54 -0
- package/dist/src/components/messages/UserResourceUpdateMessage.js +131 -0
- package/dist/src/components/messages/UserTeammateMessage.js +215 -0
- package/dist/src/components/messages/UserTextMessage.js +207 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +46 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +21 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +18 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +90 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +80 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +116 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +73 -0
- package/dist/src/components/messages/UserToolResultMessage/utils.js +41 -0
- package/dist/src/components/messages/nullRenderingAttachments.js +40 -0
- package/dist/src/components/messages/teamMemCollapsed.js +160 -0
- package/dist/src/components/messages/teamMemSaved.js +9 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +696 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +263 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +384 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +228 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +611 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +218 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +98 -0
- package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +458 -0
- package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +90 -0
- package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +567 -0
- package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +175 -0
- package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +728 -0
- package/dist/src/components/permissions/FallbackPermissionRequest.js +385 -0
- package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +205 -0
- package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +188 -0
- package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +159 -0
- package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +129 -0
- package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +100 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +186 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +110 -0
- package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +143 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +194 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +278 -0
- package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +709 -0
- package/dist/src/components/permissions/PermissionDialog.js +90 -0
- package/dist/src/components/permissions/PermissionExplanation.js +298 -0
- package/dist/src/components/permissions/PermissionPrompt.js +327 -0
- package/dist/src/components/permissions/PermissionRequest.js +164 -0
- package/dist/src/components/permissions/PermissionRequestTitle.js +85 -0
- package/dist/src/components/permissions/PermissionRuleExplanation.js +112 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +263 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +70 -0
- package/dist/src/components/permissions/SandboxPermissionRequest.js +205 -0
- package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +259 -0
- package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +424 -0
- package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +299 -0
- package/dist/src/components/permissions/WorkerBadge.js +56 -0
- package/dist/src/components/permissions/WorkerPendingPermission.js +158 -0
- package/dist/src/components/permissions/hooks.js +128 -0
- package/dist/src/components/permissions/rules/AddPermissionRules.js +203 -0
- package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +437 -0
- package/dist/src/components/permissions/rules/PermissionRuleDescription.js +101 -0
- package/dist/src/components/permissions/rules/PermissionRuleInput.js +208 -0
- package/dist/src/components/permissions/rules/PermissionRuleList.js +1382 -0
- package/dist/src/components/permissions/rules/RecentDenialsTab.js +229 -0
- package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +123 -0
- package/dist/src/components/permissions/rules/WorkspaceTab.js +161 -0
- package/dist/src/components/permissions/shellPermissionHelpers.js +219 -0
- package/dist/src/components/permissions/useShellPermissionFeedback.js +98 -0
- package/dist/src/components/permissions/utils.js +18 -0
- package/dist/src/components/sandbox/SandboxConfigTab.js +195 -0
- package/dist/src/components/sandbox/SandboxDependenciesTab.js +265 -0
- package/dist/src/components/sandbox/SandboxDoctorSection.js +80 -0
- package/dist/src/components/sandbox/SandboxOverridesTab.js +272 -0
- package/dist/src/components/sandbox/SandboxSettings.js +374 -0
- package/dist/src/components/shell/ExpandShellOutputContext.js +25 -0
- package/dist/src/components/shell/OutputLine.js +107 -0
- package/dist/src/components/shell/ShellProgressMessage.js +189 -0
- package/dist/src/components/shell/ShellTimeDisplay.js +78 -0
- package/dist/src/components/skills/SkillsMenu.js +310 -0
- package/dist/src/components/tasks/AsyncAgentDetailDialog.js +353 -0
- package/dist/src/components/tasks/BackgroundTask.js +428 -0
- package/dist/src/components/tasks/BackgroundTaskStatus.js +522 -0
- package/dist/src/components/tasks/BackgroundTasksDialog.js +784 -0
- package/dist/src/components/tasks/DreamDetailDialog.js +353 -0
- package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +393 -0
- package/dist/src/components/tasks/RemoteSessionDetailDialog.js +1188 -0
- package/dist/src/components/tasks/RemoteSessionProgress.js +310 -0
- package/dist/src/components/tasks/ShellDetailDialog.js +511 -0
- package/dist/src/components/tasks/ShellProgress.js +93 -0
- package/dist/src/components/tasks/renderToolActivity.js +34 -0
- package/dist/src/components/tasks/taskStatusUtils.js +77 -0
- package/dist/src/components/teams/TeamStatus.js +95 -0
- package/dist/src/components/teams/TeamsDialog.js +734 -0
- package/dist/src/components/ui/OrderedList.js +74 -0
- package/dist/src/components/ui/OrderedListItem.js +53 -0
- package/dist/src/components/ui/TreeSelect.js +307 -0
- package/dist/src/components/wizard/WizardDialogLayout.js +71 -0
- package/dist/src/components/wizard/WizardNavigationFooter.js +36 -0
- package/dist/src/components/wizard/WizardProvider.js +211 -0
- package/dist/src/components/wizard/index.js +4 -0
- package/dist/src/components/wizard/useWizard.js +9 -0
- package/dist/src/constants/apiLimits.js +11 -0
- package/dist/src/constants/betas.js +28 -0
- package/dist/src/constants/common.js +16 -0
- package/dist/src/constants/cyberRiskInstruction.js +1 -0
- package/dist/src/constants/errorIds.js +1 -0
- package/dist/src/constants/figures.js +31 -0
- package/dist/src/constants/files.js +115 -0
- package/dist/src/constants/github-app.js +139 -0
- package/dist/src/constants/keys.js +4 -0
- package/dist/src/constants/messages.js +1 -0
- package/dist/src/constants/oauth.js +141 -0
- package/dist/src/constants/outputStyles.js +155 -0
- package/dist/src/constants/product.js +25 -0
- package/dist/src/constants/prompts.js +544 -0
- package/dist/src/constants/spinnerVerbs.js +201 -0
- package/dist/src/constants/system.js +46 -0
- package/dist/src/constants/systemPromptSections.js +27 -0
- package/dist/src/constants/toolLimits.js +6 -0
- package/dist/src/constants/tools.js +75 -0
- package/dist/src/constants/turnCompletionVerbs.js +10 -0
- package/dist/src/constants/xml.js +54 -0
- package/dist/src/context/QueuedMessageContext.js +57 -0
- package/dist/src/context/fpsMetrics.js +26 -0
- package/dist/src/context/mailbox.js +37 -0
- package/dist/src/context/modalContext.js +26 -0
- package/dist/src/context/notifications.js +176 -0
- package/dist/src/context/overlayContext.js +92 -0
- package/dist/src/context/promptOverlayContext.js +99 -0
- package/dist/src/context/stats.js +203 -0
- package/dist/src/context/voice.js +62 -0
- package/dist/src/context.js +119 -0
- package/dist/src/coordinator/coordinatorMode.js +323 -0
- package/dist/src/cost-tracker.js +234 -0
- package/dist/src/costHook.js +19 -0
- package/dist/src/dialogLaunchers.js +92 -0
- package/dist/src/entrypoints/agentSdkTypes.js +51 -0
- package/dist/src/entrypoints/cli.js +92 -0
- package/dist/src/entrypoints/init.js +199 -0
- package/dist/src/entrypoints/mcp.js +132 -0
- package/dist/src/entrypoints/npm-bin.js +6 -0
- package/dist/src/entrypoints/sandboxTypes.js +34 -0
- package/dist/src/entrypoints/sdk/controlSchemas.js +347 -0
- package/dist/src/entrypoints/sdk/coreSchemas.js +1019 -0
- package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/coreTypes.js +38 -0
- package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/dist/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
- package/dist/src/history.js +297 -0
- package/dist/src/hooks/fileSuggestions.js +460 -0
- package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +39 -0
- package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +64 -0
- package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/dist/src/hooks/notifs/useFastModeNotification.js +161 -0
- package/dist/src/hooks/notifs/useIDEStatusIndicator.js +187 -0
- package/dist/src/hooks/notifs/useInstallMessages.js +25 -0
- package/dist/src/hooks/notifs/useLspInitializationNotification.js +147 -0
- package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +154 -0
- package/dist/src/hooks/notifs/useModelMigrationNotifications.js +45 -0
- package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
- package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +93 -0
- package/dist/src/hooks/notifs/usePluginInstallationStatus.js +143 -0
- package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
- package/dist/src/hooks/notifs/useSettingsErrors.js +67 -0
- package/dist/src/hooks/notifs/useStartupNotification.js +24 -0
- package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +61 -0
- package/dist/src/hooks/renderPlaceholder.js +27 -0
- package/dist/src/hooks/toolPermission/PermissionContext.js +186 -0
- package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +22 -0
- package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +194 -0
- package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +79 -0
- package/dist/src/hooks/toolPermission/permissionLogging.js +114 -0
- package/dist/src/hooks/unifiedSuggestions.js +115 -0
- package/dist/src/hooks/useAfterFirstRender.js +12 -0
- package/dist/src/hooks/useApiKeyVerification.js +58 -0
- package/dist/src/hooks/useArrowKeyHistory.js +176 -0
- package/dist/src/hooks/useAssistantHistory.js +150 -0
- package/dist/src/hooks/useAwaySummary.js +95 -0
- package/dist/src/hooks/useBackgroundTaskNavigation.js +163 -0
- package/dist/src/hooks/useBlink.js +10 -0
- package/dist/src/hooks/useCanUseTool.js +144 -0
- package/dist/src/hooks/useCancelRequest.js +165 -0
- package/dist/src/hooks/useChromeExtensionNotification.js +55 -0
- package/dist/src/hooks/useClaudeCodeHintRecommendation.js +113 -0
- package/dist/src/hooks/useClipboardImageHint.js +45 -0
- package/dist/src/hooks/useCommandKeybindings.js +81 -0
- package/dist/src/hooks/useCommandQueue.js +8 -0
- package/dist/src/hooks/useCopyOnSelect.js +44 -0
- package/dist/src/hooks/useDeferredHookMessages.js +35 -0
- package/dist/src/hooks/useDiffData.js +62 -0
- package/dist/src/hooks/useDiffInIDE.js +197 -0
- package/dist/src/hooks/useDirectConnect.js +154 -0
- package/dist/src/hooks/useDoublePress.js +36 -0
- package/dist/src/hooks/useDynamicConfig.js +10 -0
- package/dist/src/hooks/useElapsedTime.js +12 -0
- package/dist/src/hooks/useExitOnCtrlCD.js +27 -0
- package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +5 -0
- package/dist/src/hooks/useFileHistorySnapshotInit.js +17 -0
- package/dist/src/hooks/useGlobalKeybindings.js +132 -0
- package/dist/src/hooks/useHistorySearch.js +219 -0
- package/dist/src/hooks/useIDEIntegration.js +60 -0
- package/dist/src/hooks/useIdeAtMentioned.js +42 -0
- package/dist/src/hooks/useIdeConnectionStatus.js +18 -0
- package/dist/src/hooks/useIdeLogging.js +26 -0
- package/dist/src/hooks/useIdeSelection.js +78 -0
- package/dist/src/hooks/useInboxPoller.js +626 -0
- package/dist/src/hooks/useInputBuffer.js +69 -0
- package/dist/src/hooks/useIssueFlagBanner.js +101 -0
- package/dist/src/hooks/useLogMessages.js +47 -0
- package/dist/src/hooks/useLspPluginRecommendation.js +163 -0
- package/dist/src/hooks/useMailboxBridge.js +15 -0
- package/dist/src/hooks/useMainLoopModel.js +15 -0
- package/dist/src/hooks/useManagePlugins.js +195 -0
- package/dist/src/hooks/useMemoryUsage.js +17 -0
- package/dist/src/hooks/useMergedClients.js +11 -0
- package/dist/src/hooks/useMergedCommands.js +10 -0
- package/dist/src/hooks/useMergedTools.js +18 -0
- package/dist/src/hooks/useMinDisplayTime.js +19 -0
- package/dist/src/hooks/useNotifyAfterTimeout.js +34 -0
- package/dist/src/hooks/useOfficialMarketplaceNotification.js +50 -0
- package/dist/src/hooks/usePasteHandler.js +129 -0
- package/dist/src/hooks/usePluginRecommendationBase.js +98 -0
- package/dist/src/hooks/usePrStatus.js +77 -0
- package/dist/src/hooks/usePromptSuggestion.js +124 -0
- package/dist/src/hooks/usePromptsFromClaudeInChrome.js +60 -0
- package/dist/src/hooks/useQueueProcessor.js +29 -0
- package/dist/src/hooks/useRemoteSession.js +313 -0
- package/dist/src/hooks/useReplBridge.js +59 -0
- package/dist/src/hooks/useSSHSession.js +161 -0
- package/dist/src/hooks/useScheduledTasks.js +68 -0
- package/dist/src/hooks/useSearchInput.js +285 -0
- package/dist/src/hooks/useSessionBackgrounding.js +120 -0
- package/dist/src/hooks/useSettings.js +4 -0
- package/dist/src/hooks/useSettingsChange.js +10 -0
- package/dist/src/hooks/useSkillImprovementSurvey.js +61 -0
- package/dist/src/hooks/useSkillsChange.js +39 -0
- package/dist/src/hooks/useSwarmInitialization.js +39 -0
- package/dist/src/hooks/useSwarmPermissionPoller.js +141 -0
- package/dist/src/hooks/useTaskListWatcher.js +124 -0
- package/dist/src/hooks/useTasksV2.js +161 -0
- package/dist/src/hooks/useTeammateViewAutoExit.js +35 -0
- package/dist/src/hooks/useTeleportResume.js +75 -0
- package/dist/src/hooks/useTerminalSize.js +11 -0
- package/dist/src/hooks/useTextInput.js +353 -0
- package/dist/src/hooks/useTimeout.js +10 -0
- package/dist/src/hooks/useTurnDiffs.js +131 -0
- package/dist/src/hooks/useTypeahead.js +993 -0
- package/dist/src/hooks/useUpdateNotification.js +21 -0
- package/dist/src/hooks/useVimInput.js +210 -0
- package/dist/src/hooks/useVirtualScroll.js +282 -0
- package/dist/src/hooks/useVoice.js +675 -0
- package/dist/src/hooks/useVoiceEnabled.js +12 -0
- package/dist/src/hooks/useVoiceIntegration.js +391 -0
- package/dist/src/ink/Ansi.js +290 -0
- package/dist/src/ink/bidi.js +72 -0
- package/dist/src/ink/clearTerminal.js +42 -0
- package/dist/src/ink/colorize.js +119 -0
- package/dist/src/ink/components/AlternateScreen.js +60 -0
- package/dist/src/ink/components/App.js +375 -0
- package/dist/src/ink/components/AppContext.js +6 -0
- package/dist/src/ink/components/Box.js +181 -0
- package/dist/src/ink/components/Button.js +167 -0
- package/dist/src/ink/components/ClockContext.js +100 -0
- package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
- package/dist/src/ink/components/ErrorOverview.js +152 -0
- package/dist/src/ink/components/Link.js +42 -0
- package/dist/src/ink/components/Newline.js +29 -0
- package/dist/src/ink/components/NoSelect.js +40 -0
- package/dist/src/ink/components/RawAnsi.js +36 -0
- package/dist/src/ink/components/ScrollBox.js +139 -0
- package/dist/src/ink/components/Spacer.js +16 -0
- package/dist/src/ink/components/StdinContext.js +12 -0
- package/dist/src/ink/components/TerminalFocusContext.js +43 -0
- package/dist/src/ink/components/TerminalSizeContext.js +2 -0
- package/dist/src/ink/components/Text.js +196 -0
- package/dist/src/ink/constants.js +1 -0
- package/dist/src/ink/dom.js +230 -0
- package/dist/src/ink/events/click-event.js +15 -0
- package/dist/src/ink/events/dispatcher.js +126 -0
- package/dist/src/ink/events/emitter.js +26 -0
- package/dist/src/ink/events/event-handlers.js +22 -0
- package/dist/src/ink/events/event.js +9 -0
- package/dist/src/ink/events/focus-event.js +9 -0
- package/dist/src/ink/events/input-event.js +83 -0
- package/dist/src/ink/events/keyboard-event.js +31 -0
- package/dist/src/ink/events/terminal-event.js +60 -0
- package/dist/src/ink/events/terminal-focus-event.js +9 -0
- package/dist/src/ink/focus.js +127 -0
- package/dist/src/ink/frame.js +22 -0
- package/dist/src/ink/get-max-width.js +5 -0
- package/dist/src/ink/hit-test.js +76 -0
- package/dist/src/ink/hooks/use-animation-frame.js +23 -0
- package/dist/src/ink/hooks/use-app.js +4 -0
- package/dist/src/ink/hooks/use-declared-cursor.js +27 -0
- package/dist/src/ink/hooks/use-input.js +31 -0
- package/dist/src/ink/hooks/use-interval.js +38 -0
- package/dist/src/ink/hooks/use-search-highlight.js +21 -0
- package/dist/src/ink/hooks/use-selection.js +47 -0
- package/dist/src/ink/hooks/use-stdin.js +4 -0
- package/dist/src/ink/hooks/use-tab-status.js +48 -0
- package/dist/src/ink/hooks/use-terminal-focus.js +6 -0
- package/dist/src/ink/hooks/use-terminal-title.js +17 -0
- package/dist/src/ink/hooks/use-terminal-viewport.js +40 -0
- package/dist/src/ink/ink.js +978 -0
- package/dist/src/ink/instances.js +2 -0
- package/dist/src/ink/layout/engine.js +4 -0
- package/dist/src/ink/layout/geometry.js +55 -0
- package/dist/src/ink/layout/node.js +60 -0
- package/dist/src/ink/layout/yoga.js +232 -0
- package/dist/src/ink/line-width-cache.js +14 -0
- package/dist/src/ink/log-update.js +408 -0
- package/dist/src/ink/measure-element.js +5 -0
- package/dist/src/ink/measure-text.js +30 -0
- package/dist/src/ink/node-cache.js +19 -0
- package/dist/src/ink/optimizer.js +52 -0
- package/dist/src/ink/output.js +399 -0
- package/dist/src/ink/parse-keypress.js +525 -0
- package/dist/src/ink/reconciler.js +359 -0
- package/dist/src/ink/render-border.js +110 -0
- package/dist/src/ink/render-node-to-output.js +710 -0
- package/dist/src/ink/render-to-screen.js +124 -0
- package/dist/src/ink/renderer.js +73 -0
- package/dist/src/ink/root.js +73 -0
- package/dist/src/ink/screen.js +823 -0
- package/dist/src/ink/searchHighlight.js +48 -0
- package/dist/src/ink/selection.js +507 -0
- package/dist/src/ink/squash-text-nodes.js +40 -0
- package/dist/src/ink/stringWidth.js +134 -0
- package/dist/src/ink/styles.js +279 -0
- package/dist/src/ink/supports-hyperlinks.js +29 -0
- package/dist/src/ink/tabstops.js +35 -0
- package/dist/src/ink/terminal-focus-state.js +33 -0
- package/dist/src/ink/terminal-querier.js +89 -0
- package/dist/src/ink/terminal.js +128 -0
- package/dist/src/ink/termio/ansi.js +53 -0
- package/dist/src/ink/termio/csi.js +158 -0
- package/dist/src/ink/termio/dec.js +31 -0
- package/dist/src/ink/termio/esc.js +36 -0
- package/dist/src/ink/termio/osc.js +275 -0
- package/dist/src/ink/termio/parser.js +293 -0
- package/dist/src/ink/termio/sgr.js +264 -0
- package/dist/src/ink/termio/tokenize.js +176 -0
- package/dist/src/ink/termio/types.js +33 -0
- package/dist/src/ink/termio.js +2 -0
- package/dist/src/ink/useTerminalNotification.js +61 -0
- package/dist/src/ink/warn.js +10 -0
- package/dist/src/ink/widest-line.js +15 -0
- package/dist/src/ink/wrap-text.js +50 -0
- package/dist/src/ink/wrapAnsi.js +5 -0
- package/dist/src/ink.js +55 -0
- package/dist/src/interactiveHelpers.js +231 -0
- package/dist/src/keybindings/KeybindingContext.js +170 -0
- package/dist/src/keybindings/KeybindingProviderSetup.js +225 -0
- package/dist/src/keybindings/defaultBindings.js +228 -0
- package/dist/src/keybindings/loadUserBindings.js +276 -0
- package/dist/src/keybindings/match.js +73 -0
- package/dist/src/keybindings/parser.js +152 -0
- package/dist/src/keybindings/reservedShortcuts.js +82 -0
- package/dist/src/keybindings/resolver.js +116 -0
- package/dist/src/keybindings/schema.js +143 -0
- package/dist/src/keybindings/shortcutFormat.js +24 -0
- package/dist/src/keybindings/template.js +28 -0
- package/dist/src/keybindings/useKeybinding.js +100 -0
- package/dist/src/keybindings/useShortcutDisplay.js +24 -0
- package/dist/src/keybindings/validate.js +313 -0
- package/dist/src/localRecoveryCli.js +256 -0
- package/dist/src/main.js +2489 -0
- package/dist/src/memdir/findRelevantMemories.js +76 -0
- package/dist/src/memdir/memdir.js +264 -0
- package/dist/src/memdir/memoryAge.js +24 -0
- package/dist/src/memdir/memoryScan.js +36 -0
- package/dist/src/memdir/memoryTypes.js +190 -0
- package/dist/src/memdir/paths.js +106 -0
- package/dist/src/memdir/teamMemPaths.js +133 -0
- package/dist/src/memdir/teamMemPrompts.js +87 -0
- package/dist/src/migrations/migrateAutoUpdatesToSettings.js +41 -0
- package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +29 -0
- package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +70 -0
- package/dist/src/migrations/migrateFennecToOpus.js +27 -0
- package/dist/src/migrations/migrateLegacyOpusToCurrent.js +30 -0
- package/dist/src/migrations/migrateOpusToOpus1m.js +23 -0
- package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +13 -0
- package/dist/src/migrations/migrateSonnet1mToSonnet45.js +29 -0
- package/dist/src/migrations/migrateSonnet45ToSonnet46.js +41 -0
- package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +11 -0
- package/dist/src/migrations/resetProToOpusDefault.js +42 -0
- package/dist/src/moreright/useMoreRight.js +7 -0
- package/dist/src/native-ts/color-diff/index.js +729 -0
- package/dist/src/native-ts/file-index/index.js +246 -0
- package/dist/src/native-ts/yoga-layout/enums.js +96 -0
- package/dist/src/native-ts/yoga-layout/index.js +1638 -0
- package/dist/src/outputStyles/loadOutputStylesDir.js +47 -0
- package/dist/src/plugins/builtinPlugins.js +86 -0
- package/dist/src/plugins/bundled/index.js +1 -0
- package/dist/src/projectOnboardingState.js +56 -0
- package/dist/src/query/config.js +14 -0
- package/dist/src/query/deps.js +12 -0
- package/dist/src/query/stopHooks.js +251 -0
- package/dist/src/query/tokenBudget.js +47 -0
- package/dist/src/query.js +813 -0
- package/dist/src/remote/RemoteSessionManager.js +144 -0
- package/dist/src/remote/SessionsWebSocket.js +231 -0
- package/dist/src/remote/remotePermissionBridge.js +57 -0
- package/dist/src/remote/sdkMessageAdapter.js +161 -0
- package/dist/src/replLauncher.js +15 -0
- package/dist/src/schemas/hooks.js +71 -0
- package/dist/src/screens/Doctor.js +988 -0
- package/dist/src/screens/REPL.js +3588 -0
- package/dist/src/screens/ResumeConversation.js +396 -0
- package/dist/src/server/createDirectConnectSession.js +55 -0
- package/dist/src/server/directConnectManager.js +131 -0
- package/dist/src/server/types.js +7 -0
- package/dist/src/services/AgentSummary/agentSummary.js +114 -0
- package/dist/src/services/MagicDocs/magicDocs.js +151 -0
- package/dist/src/services/MagicDocs/prompts.js +85 -0
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +350 -0
- package/dist/src/services/PromptSuggestion/speculation.js +590 -0
- package/dist/src/services/SessionMemory/prompts.js +220 -0
- package/dist/src/services/SessionMemory/sessionMemory.js +277 -0
- package/dist/src/services/SessionMemory/sessionMemoryUtils.js +94 -0
- package/dist/src/services/analytics/config.js +8 -0
- package/dist/src/services/analytics/datadog.js +217 -0
- package/dist/src/services/analytics/firstPartyEventLogger.js +223 -0
- package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +500 -0
- package/dist/src/services/analytics/growthbook.js +597 -0
- package/dist/src/services/analytics/index.js +56 -0
- package/dist/src/services/analytics/metadata.js +507 -0
- package/dist/src/services/analytics/sink.js +44 -0
- package/dist/src/services/analytics/sinkKillswitch.js +6 -0
- package/dist/src/services/api/adminRequests.js +40 -0
- package/dist/src/services/api/bootstrap.js +104 -0
- package/dist/src/services/api/claude.js +1851 -0
- package/dist/src/services/api/client.js +209 -0
- package/dist/src/services/api/dumpPrompts.js +145 -0
- package/dist/src/services/api/emptyUsage.js +15 -0
- package/dist/src/services/api/errorUtils.js +137 -0
- package/dist/src/services/api/errors.js +641 -0
- package/dist/src/services/api/filesApi.js +409 -0
- package/dist/src/services/api/firstTokenDate.js +42 -0
- package/dist/src/services/api/grove.js +222 -0
- package/dist/src/services/api/logging.js +478 -0
- package/dist/src/services/api/metricsOptOut.js +87 -0
- package/dist/src/services/api/overageCreditGrant.js +83 -0
- package/dist/src/services/api/promptCacheBreakDetection.js +411 -0
- package/dist/src/services/api/referral.js +178 -0
- package/dist/src/services/api/sessionIngress.js +264 -0
- package/dist/src/services/api/ultrareviewQuota.js +23 -0
- package/dist/src/services/api/usage.js +34 -0
- package/dist/src/services/api/withRetry.js +454 -0
- package/dist/src/services/autoDream/autoDream.js +197 -0
- package/dist/src/services/autoDream/config.js +9 -0
- package/dist/src/services/autoDream/consolidationLock.js +76 -0
- package/dist/src/services/autoDream/consolidationPrompt.js +61 -0
- package/dist/src/services/awaySummary.js +58 -0
- package/dist/src/services/claudeAiLimits.js +269 -0
- package/dist/src/services/claudeAiLimitsHook.js +18 -0
- package/dist/src/services/compact/apiMicrocompact.js +82 -0
- package/dist/src/services/compact/autoCompact.js +151 -0
- package/dist/src/services/compact/compact.js +957 -0
- package/dist/src/services/compact/compactWarningHook.js +5 -0
- package/dist/src/services/compact/compactWarningState.js +8 -0
- package/dist/src/services/compact/grouping.js +20 -0
- package/dist/src/services/compact/microCompact.js +265 -0
- package/dist/src/services/compact/postCompactCleanup.js +23 -0
- package/dist/src/services/compact/prompt.js +303 -0
- package/dist/src/services/compact/sessionMemoryCompact.js +316 -0
- package/dist/src/services/compact/timeBasedMCConfig.js +9 -0
- package/dist/src/services/diagnosticTracking.js +195 -0
- package/dist/src/services/extractMemories/extractMemories.js +309 -0
- package/dist/src/services/extractMemories/prompts.js +113 -0
- package/dist/src/services/internalLogging.js +53 -0
- package/dist/src/services/lsp/LSPClient.js +252 -0
- package/dist/src/services/lsp/LSPDiagnosticRegistry.js +179 -0
- package/dist/src/services/lsp/LSPServerInstance.js +245 -0
- package/dist/src/services/lsp/LSPServerManager.js +217 -0
- package/dist/src/services/lsp/config.js +38 -0
- package/dist/src/services/lsp/manager.js +132 -0
- package/dist/src/services/lsp/passiveFeedback.js +150 -0
- package/dist/src/services/mcp/InProcessTransport.js +37 -0
- package/dist/src/services/mcp/MCPConnectionManager.js +56 -0
- package/dist/src/services/mcp/SdkControlTransport.js +54 -0
- package/dist/src/services/mcp/auth.js +1419 -0
- package/dist/src/services/mcp/channelAllowlist.js +24 -0
- package/dist/src/services/mcp/channelNotification.js +118 -0
- package/dist/src/services/mcp/channelPermissions.js +89 -0
- package/dist/src/services/mcp/claudeai.js +95 -0
- package/dist/src/services/mcp/client.js +1896 -0
- package/dist/src/services/mcp/config.js +942 -0
- package/dist/src/services/mcp/elicitationHandler.js +171 -0
- package/dist/src/services/mcp/envExpansion.js +19 -0
- package/dist/src/services/mcp/headersHelper.js +64 -0
- package/dist/src/services/mcp/mcpStringUtils.js +33 -0
- package/dist/src/services/mcp/normalization.js +8 -0
- package/dist/src/services/mcp/oauthPort.js +47 -0
- package/dist/src/services/mcp/officialRegistry.js +42 -0
- package/dist/src/services/mcp/types.js +82 -0
- package/dist/src/services/mcp/useManageMCPConnections.js +536 -0
- package/dist/src/services/mcp/utils.js +284 -0
- package/dist/src/services/mcp/vscodeSdkMcp.js +55 -0
- package/dist/src/services/mcp/xaa.js +237 -0
- package/dist/src/services/mcp/xaaIdpLogin.js +286 -0
- package/dist/src/services/mcpServerApproval.js +39 -0
- package/dist/src/services/mockRateLimits.js +548 -0
- package/dist/src/services/notifier.js +112 -0
- package/dist/src/services/oauth/auth-code-listener.js +129 -0
- package/dist/src/services/oauth/client.js +341 -0
- package/dist/src/services/oauth/crypto.js +15 -0
- package/dist/src/services/oauth/getOauthProfile.js +44 -0
- package/dist/src/services/oauth/index.js +98 -0
- package/dist/src/services/plugins/PluginInstallationManager.js +111 -0
- package/dist/src/services/plugins/pluginCliCommands.js +173 -0
- package/dist/src/services/plugins/pluginOperations.js +597 -0
- package/dist/src/services/policyLimits/index.js +418 -0
- package/dist/src/services/policyLimits/types.js +5 -0
- package/dist/src/services/preventSleep.js +95 -0
- package/dist/src/services/rateLimitMessages.js +194 -0
- package/dist/src/services/rateLimitMocking.js +58 -0
- package/dist/src/services/remoteManagedSettings/index.js +368 -0
- package/dist/src/services/remoteManagedSettings/securityCheck.js +52 -0
- package/dist/src/services/remoteManagedSettings/syncCache.js +50 -0
- package/dist/src/services/remoteManagedSettings/syncCacheState.js +48 -0
- package/dist/src/services/remoteManagedSettings/types.js +7 -0
- package/dist/src/services/settingsSync/index.js +368 -0
- package/dist/src/services/settingsSync/types.js +18 -0
- package/dist/src/services/teamMemorySync/index.js +731 -0
- package/dist/src/services/teamMemorySync/secretScanner.js +210 -0
- package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +4 -0
- package/dist/src/services/teamMemorySync/types.js +23 -0
- package/dist/src/services/teamMemorySync/watcher.js +197 -0
- package/dist/src/services/tips/tipHistory.js +17 -0
- package/dist/src/services/tips/tipRegistry.js +578 -0
- package/dist/src/services/tips/tipScheduler.js +37 -0
- package/dist/src/services/tokenEstimation.js +283 -0
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +75 -0
- package/dist/src/services/tools/StreamingToolExecutor.js +311 -0
- package/dist/src/services/tools/toolExecution.js +1009 -0
- package/dist/src/services/tools/toolHooks.js +384 -0
- package/dist/src/services/tools/toolOrchestration.js +96 -0
- package/dist/src/services/vcr.js +233 -0
- package/dist/src/services/voice.js +315 -0
- package/dist/src/services/voiceKeyterms.js +57 -0
- package/dist/src/services/voiceStreamSTT.js +265 -0
- package/dist/src/setup.js +235 -0
- package/dist/src/skills/bundled/batch.js +114 -0
- package/dist/src/skills/bundled/claudeApi.js +149 -0
- package/dist/src/skills/bundled/claudeApiContent.js +63 -0
- package/dist/src/skills/bundled/claudeInChrome.js +31 -0
- package/dist/src/skills/bundled/debug.js +89 -0
- package/dist/src/skills/bundled/index.js +22 -0
- package/dist/src/skills/bundled/keybindings.js +303 -0
- package/dist/src/skills/bundled/loop.js +86 -0
- package/dist/src/skills/bundled/loremIpsum.js +257 -0
- package/dist/src/skills/bundled/remember.js +78 -0
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +360 -0
- package/dist/src/skills/bundled/simplify.js +70 -0
- package/dist/src/skills/bundled/skillify.js +179 -0
- package/dist/src/skills/bundled/stuck.js +76 -0
- package/dist/src/skills/bundled/updateConfig.js +471 -0
- package/dist/src/skills/bundled/verify/SKILL.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/cli.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/server.md.js +1 -0
- package/dist/src/skills/bundled/verify.js +27 -0
- package/dist/src/skills/bundled/verifyContent.js +8 -0
- package/dist/src/skills/bundledSkills.js +114 -0
- package/dist/src/skills/loadSkillsDir.js +583 -0
- package/dist/src/skills/mcpSkillBuilders.js +10 -0
- package/dist/src/state/AppState.js +153 -0
- package/dist/src/state/AppStateStore.js +115 -0
- package/dist/src/state/onChangeAppState.js +94 -0
- package/dist/src/state/selectors.js +29 -0
- package/dist/src/state/store.js +21 -0
- package/dist/src/state/teammateViewHelpers.js +89 -0
- package/dist/src/tasks/DreamTask/DreamTask.js +79 -0
- package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +70 -0
- package/dist/src/tasks/InProcessTeammateTask/types.js +15 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +444 -0
- package/dist/src/tasks/LocalMainSessionTask.js +262 -0
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +419 -0
- package/dist/src/tasks/LocalShellTask/guards.js +3 -0
- package/dist/src/tasks/LocalShellTask/killShellTasks.js +44 -0
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +550 -0
- package/dist/src/tasks/pillLabel.js +53 -0
- package/dist/src/tasks/stopTask.js +53 -0
- package/dist/src/tasks/types.js +9 -0
- package/dist/src/tasks.js +22 -0
- package/dist/src/tools/AgentTool/AgentTool.js +919 -0
- package/dist/src/tools/AgentTool/UI.js +912 -0
- package/dist/src/tools/AgentTool/agentColorManager.js +42 -0
- package/dist/src/tools/AgentTool/agentDisplay.js +45 -0
- package/dist/src/tools/AgentTool/agentMemory.js +85 -0
- package/dist/src/tools/AgentTool/agentMemorySnapshot.js +109 -0
- package/dist/src/tools/AgentTool/agentToolUtils.js +387 -0
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +159 -0
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +66 -0
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +26 -0
- package/dist/src/tools/AgentTool/built-in/planAgent.js +81 -0
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/dist/src/tools/AgentTool/builtInAgents.js +32 -0
- package/dist/src/tools/AgentTool/constants.js +7 -0
- package/dist/src/tools/AgentTool/forkSubagent.js +108 -0
- package/dist/src/tools/AgentTool/loadAgentsDir.js +409 -0
- package/dist/src/tools/AgentTool/prompt.js +194 -0
- package/dist/src/tools/AgentTool/resumeAgent.js +169 -0
- package/dist/src/tools/AgentTool/runAgent.js +457 -0
- package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +282 -0
- package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/dist/src/tools/BashTool/BashTool.js +867 -0
- package/dist/src/tools/BashTool/BashToolResultMessage.js +208 -0
- package/dist/src/tools/BashTool/UI.js +189 -0
- package/dist/src/tools/BashTool/bashCommandHelpers.js +145 -0
- package/dist/src/tools/BashTool/bashPermissions.js +1193 -0
- package/dist/src/tools/BashTool/bashSecurity.js +1464 -0
- package/dist/src/tools/BashTool/commandSemantics.js +70 -0
- package/dist/src/tools/BashTool/commentLabel.js +8 -0
- package/dist/src/tools/BashTool/destructiveCommandWarning.js +74 -0
- package/dist/src/tools/BashTool/modeValidation.js +65 -0
- package/dist/src/tools/BashTool/pathValidation.js +771 -0
- package/dist/src/tools/BashTool/prompt.js +307 -0
- package/dist/src/tools/BashTool/readOnlyValidation.js +1312 -0
- package/dist/src/tools/BashTool/sedEditParser.js +179 -0
- package/dist/src/tools/BashTool/sedValidation.js +379 -0
- package/dist/src/tools/BashTool/shouldUseSandbox.js +102 -0
- package/dist/src/tools/BashTool/toolName.js +1 -0
- package/dist/src/tools/BashTool/utils.js +145 -0
- package/dist/src/tools/BriefTool/BriefTool.js +106 -0
- package/dist/src/tools/BriefTool/UI.js +158 -0
- package/dist/src/tools/BriefTool/attachments.js +54 -0
- package/dist/src/tools/BriefTool/prompt.js +19 -0
- package/dist/src/tools/BriefTool/upload.js +37 -0
- package/dist/src/tools/ConfigTool/ConfigTool.js +304 -0
- package/dist/src/tools/ConfigTool/UI.js +76 -0
- package/dist/src/tools/ConfigTool/constants.js +1 -0
- package/dist/src/tools/ConfigTool/prompt.js +76 -0
- package/dist/src/tools/ConfigTool/supportedSettings.js +141 -0
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +91 -0
- package/dist/src/tools/EnterPlanModeTool/UI.js +49 -0
- package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/dist/src/tools/EnterPlanModeTool/prompt.js +154 -0
- package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +97 -0
- package/dist/src/tools/EnterWorktreeTool/UI.js +25 -0
- package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +287 -0
- package/dist/src/tools/ExitPlanModeTool/UI.js +128 -0
- package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/dist/src/tools/ExitPlanModeTool/prompt.js +25 -0
- package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +217 -0
- package/dist/src/tools/ExitWorktreeTool/UI.js +36 -0
- package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/dist/src/tools/FileEditTool/FileEditTool.js +447 -0
- package/dist/src/tools/FileEditTool/UI.js +289 -0
- package/dist/src/tools/FileEditTool/constants.js +4 -0
- package/dist/src/tools/FileEditTool/prompt.js +22 -0
- package/dist/src/tools/FileEditTool/types.js +37 -0
- package/dist/src/tools/FileEditTool/utils.js +411 -0
- package/dist/src/tools/FileReadTool/FileReadTool.js +759 -0
- package/dist/src/tools/FileReadTool/UI.js +232 -0
- package/dist/src/tools/FileReadTool/imageProcessor.js +34 -0
- package/dist/src/tools/FileReadTool/limits.js +28 -0
- package/dist/src/tools/FileReadTool/prompt.js +25 -0
- package/dist/src/tools/FileWriteTool/FileWriteTool.js +300 -0
- package/dist/src/tools/FileWriteTool/UI.js +460 -0
- package/dist/src/tools/FileWriteTool/prompt.js +16 -0
- package/dist/src/tools/GlobTool/GlobTool.js +155 -0
- package/dist/src/tools/GlobTool/UI.js +58 -0
- package/dist/src/tools/GlobTool/prompt.js +6 -0
- package/dist/src/tools/GrepTool/GrepTool.js +390 -0
- package/dist/src/tools/GrepTool/UI.js +254 -0
- package/dist/src/tools/GrepTool/prompt.js +16 -0
- package/dist/src/tools/LSPTool/LSPTool.js +541 -0
- package/dist/src/tools/LSPTool/UI.js +275 -0
- package/dist/src/tools/LSPTool/formatters.js +353 -0
- package/dist/src/tools/LSPTool/prompt.js +20 -0
- package/dist/src/tools/LSPTool/schemas.js +82 -0
- package/dist/src/tools/LSPTool/symbolContext.js +43 -0
- package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +91 -0
- package/dist/src/tools/ListMcpResourcesTool/UI.js +26 -0
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/dist/src/tools/MCPTool/MCPTool.js +57 -0
- package/dist/src/tools/MCPTool/UI.js +433 -0
- package/dist/src/tools/MCPTool/classifyForCollapse.js +509 -0
- package/dist/src/tools/MCPTool/prompt.js +2 -0
- package/dist/src/tools/McpAuthTool/McpAuthTool.js +139 -0
- package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +364 -0
- package/dist/src/tools/NotebookEditTool/UI.js +115 -0
- package/dist/src/tools/NotebookEditTool/constants.js +1 -0
- package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +700 -0
- package/dist/src/tools/PowerShellTool/UI.js +154 -0
- package/dist/src/tools/PowerShellTool/clmTypes.js +147 -0
- package/dist/src/tools/PowerShellTool/commandSemantics.js +37 -0
- package/dist/src/tools/PowerShellTool/commonParameters.js +17 -0
- package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +70 -0
- package/dist/src/tools/PowerShellTool/gitSafety.js +102 -0
- package/dist/src/tools/PowerShellTool/modeValidation.js +203 -0
- package/dist/src/tools/PowerShellTool/pathValidation.js +1259 -0
- package/dist/src/tools/PowerShellTool/powershellPermissions.js +791 -0
- package/dist/src/tools/PowerShellTool/powershellSecurity.js +612 -0
- package/dist/src/tools/PowerShellTool/prompt.js +130 -0
- package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1000 -0
- package/dist/src/tools/PowerShellTool/toolName.js +1 -0
- package/dist/src/tools/REPLTool/constants.js +27 -0
- package/dist/src/tools/REPLTool/primitiveTools.js +21 -0
- package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +115 -0
- package/dist/src/tools/ReadMcpResourceTool/UI.js +37 -0
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +138 -0
- package/dist/src/tools/RemoteTriggerTool/UI.js +28 -0
- package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +117 -0
- package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +83 -0
- package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/dist/src/tools/ScheduleCronTool/UI.js +73 -0
- package/dist/src/tools/ScheduleCronTool/prompt.js +67 -0
- package/dist/src/tools/SendMessageTool/SendMessageTool.js +561 -0
- package/dist/src/tools/SendMessageTool/UI.js +30 -0
- package/dist/src/tools/SendMessageTool/constants.js +1 -0
- package/dist/src/tools/SendMessageTool/prompt.js +32 -0
- package/dist/src/tools/SkillTool/SkillTool.js +614 -0
- package/dist/src/tools/SkillTool/UI.js +141 -0
- package/dist/src/tools/SkillTool/constants.js +1 -0
- package/dist/src/tools/SkillTool/prompt.js +161 -0
- package/dist/src/tools/SleepTool/prompt.js +14 -0
- package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +120 -0
- package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +106 -0
- package/dist/src/tools/TaskCreateTool/constants.js +1 -0
- package/dist/src/tools/TaskCreateTool/prompt.js +48 -0
- package/dist/src/tools/TaskGetTool/TaskGetTool.js +110 -0
- package/dist/src/tools/TaskGetTool/constants.js +1 -0
- package/dist/src/tools/TaskGetTool/prompt.js +23 -0
- package/dist/src/tools/TaskListTool/TaskListTool.js +92 -0
- package/dist/src/tools/TaskListTool/constants.js +1 -0
- package/dist/src/tools/TaskListTool/prompt.js +38 -0
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +688 -0
- package/dist/src/tools/TaskOutputTool/constants.js +1 -0
- package/dist/src/tools/TaskStopTool/TaskStopTool.js +97 -0
- package/dist/src/tools/TaskStopTool/UI.js +39 -0
- package/dist/src/tools/TaskStopTool/prompt.js +7 -0
- package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +279 -0
- package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
- package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +161 -0
- package/dist/src/tools/TeamCreateTool/UI.js +4 -0
- package/dist/src/tools/TeamCreateTool/constants.js +1 -0
- package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
- package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +96 -0
- package/dist/src/tools/TeamDeleteTool/UI.js +14 -0
- package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
- package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +86 -0
- package/dist/src/tools/TodoWriteTool/constants.js +1 -0
- package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
- package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +266 -0
- package/dist/src/tools/ToolSearchTool/constants.js +1 -0
- package/dist/src/tools/ToolSearchTool/prompt.js +40 -0
- package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +4 -0
- package/dist/src/tools/TungstenTool/TungstenTool.js +39 -0
- package/dist/src/tools/WebFetchTool/UI.js +91 -0
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +234 -0
- package/dist/src/tools/WebFetchTool/preapproved.js +122 -0
- package/dist/src/tools/WebFetchTool/prompt.js +37 -0
- package/dist/src/tools/WebFetchTool/utils.js +303 -0
- package/dist/src/tools/WebSearchTool/UI.js +109 -0
- package/dist/src/tools/WebSearchTool/WebSearchTool.js +313 -0
- package/dist/src/tools/WebSearchTool/prompt.js +32 -0
- package/dist/src/tools/WorkflowTool/constants.js +1 -0
- package/dist/src/tools/shared/gitOperationTracking.js +158 -0
- package/dist/src/tools/shared/spawnMultiAgent.js +630 -0
- package/dist/src/tools/testing/TestingPermissionTool.js +66 -0
- package/dist/src/tools/utils.js +15 -0
- package/dist/src/tools.js +184 -0
- package/dist/src/types/command.js +6 -0
- package/dist/src/types/connectorText.js +3 -0
- package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +525 -0
- package/dist/src/types/generated/events_mono/common/v1/auth.js +38 -0
- package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +112 -0
- package/dist/src/types/generated/google/protobuf/timestamp.js +33 -0
- package/dist/src/types/hooks.js +121 -0
- package/dist/src/types/ids.js +10 -0
- package/dist/src/types/logs.js +9 -0
- package/dist/src/types/permissions.js +12 -0
- package/dist/src/types/plugin.js +64 -0
- package/dist/src/types/textInputTypes.js +10 -0
- package/dist/src/upstreamproxy/relay.js +274 -0
- package/dist/src/upstreamproxy/upstreamproxy.js +161 -0
- package/dist/src/utils/CircularBuffer.js +51 -0
- package/dist/src/utils/Cursor.js +1006 -0
- package/dist/src/utils/QueryGuard.js +57 -0
- package/dist/src/utils/Shell.js +260 -0
- package/dist/src/utils/ShellCommand.js +277 -0
- package/dist/src/utils/abortController.js +31 -0
- package/dist/src/utils/activityManager.js +91 -0
- package/dist/src/utils/advisor.js +63 -0
- package/dist/src/utils/agentContext.js +36 -0
- package/dist/src/utils/agentId.js +36 -0
- package/dist/src/utils/agentSwarmsEnabled.js +17 -0
- package/dist/src/utils/agenticSessionSearch.js +194 -0
- package/dist/src/utils/analyzeContext.js +692 -0
- package/dist/src/utils/ansiToPng.js +211 -0
- package/dist/src/utils/ansiToSvg.js +171 -0
- package/dist/src/utils/api.js +435 -0
- package/dist/src/utils/apiPreconnect.js +19 -0
- package/dist/src/utils/appleTerminalBackup.js +91 -0
- package/dist/src/utils/argumentSubstitution.js +58 -0
- package/dist/src/utils/array.js +12 -0
- package/dist/src/utils/asciicast.js +149 -0
- package/dist/src/utils/attachments.js +1854 -0
- package/dist/src/utils/attribution.js +215 -0
- package/dist/src/utils/auth.js +1197 -0
- package/dist/src/utils/authFileDescriptor.js +106 -0
- package/dist/src/utils/authPortable.js +14 -0
- package/dist/src/utils/autoModeDenials.js +10 -0
- package/dist/src/utils/autoRunIssue.js +126 -0
- package/dist/src/utils/autoUpdater.js +339 -0
- package/dist/src/utils/aws.js +30 -0
- package/dist/src/utils/awsAuthStatusManager.js +55 -0
- package/dist/src/utils/background/remote/preconditions.js +134 -0
- package/dist/src/utils/background/remote/remoteSession.js +42 -0
- package/dist/src/utils/backgroundHousekeeping.js +47 -0
- package/dist/src/utils/bash/ParsedCommand.js +194 -0
- package/dist/src/utils/bash/ShellSnapshot.js +333 -0
- package/dist/src/utils/bash/ast.js +1422 -0
- package/dist/src/utils/bash/bashParser.js +3625 -0
- package/dist/src/utils/bash/bashPipeCommand.js +138 -0
- package/dist/src/utils/bash/commands.js +668 -0
- package/dist/src/utils/bash/heredoc.js +288 -0
- package/dist/src/utils/bash/parser.js +110 -0
- package/dist/src/utils/bash/prefix.js +119 -0
- package/dist/src/utils/bash/registry.js +20 -0
- package/dist/src/utils/bash/shellCompletion.js +127 -0
- package/dist/src/utils/bash/shellPrefix.js +11 -0
- package/dist/src/utils/bash/shellQuote.js +159 -0
- package/dist/src/utils/bash/shellQuoting.js +43 -0
- package/dist/src/utils/bash/specs/alias.js +11 -0
- package/dist/src/utils/bash/specs/index.js +16 -0
- package/dist/src/utils/bash/specs/nohup.js +10 -0
- package/dist/src/utils/bash/specs/pyright.js +88 -0
- package/dist/src/utils/bash/specs/sleep.js +10 -0
- package/dist/src/utils/bash/specs/srun.js +28 -0
- package/dist/src/utils/bash/specs/time.js +10 -0
- package/dist/src/utils/bash/specs/timeout.js +17 -0
- package/dist/src/utils/bash/treeSitterAnalysis.js +259 -0
- package/dist/src/utils/betas.js +199 -0
- package/dist/src/utils/billing.js +47 -0
- package/dist/src/utils/binaryCheck.js +25 -0
- package/dist/src/utils/browser.js +47 -0
- package/dist/src/utils/bufferedWriter.js +73 -0
- package/dist/src/utils/bundledMode.js +6 -0
- package/dist/src/utils/caCerts.js +47 -0
- package/dist/src/utils/caCertsConfig.js +32 -0
- package/dist/src/utils/cachePaths.js +22 -0
- package/dist/src/utils/classifierApprovals.js +61 -0
- package/dist/src/utils/classifierApprovalsHook.js +8 -0
- package/dist/src/utils/claudeCodeHints.js +83 -0
- package/dist/src/utils/claudeDesktop.js +87 -0
- package/dist/src/utils/claudeInChrome/chromeNativeHost.js +353 -0
- package/dist/src/utils/claudeInChrome/common.js +416 -0
- package/dist/src/utils/claudeInChrome/mcpServer.js +190 -0
- package/dist/src/utils/claudeInChrome/prompt.js +60 -0
- package/dist/src/utils/claudeInChrome/setup.js +239 -0
- package/dist/src/utils/claudeInChrome/setupPortable.js +133 -0
- package/dist/src/utils/claudeInChrome/toolRendering.js +224 -0
- package/dist/src/utils/claudemd.js +727 -0
- package/dist/src/utils/cleanup.js +423 -0
- package/dist/src/utils/cleanupRegistry.js +8 -0
- package/dist/src/utils/cliArgs.js +21 -0
- package/dist/src/utils/cliHighlight.js +27 -0
- package/dist/src/utils/codeIndexing.js +92 -0
- package/dist/src/utils/collapseBackgroundBashNotifications.js +58 -0
- package/dist/src/utils/collapseHookSummaries.js +38 -0
- package/dist/src/utils/collapseReadSearch.js +569 -0
- package/dist/src/utils/collapseTeammateShutdowns.js +34 -0
- package/dist/src/utils/combinedAbortSignal.js +28 -0
- package/dist/src/utils/commandLifecycle.js +7 -0
- package/dist/src/utils/commitAttribution.js +510 -0
- package/dist/src/utils/completionCache.js +126 -0
- package/dist/src/utils/computerUse/appNames.js +104 -0
- package/dist/src/utils/computerUse/cleanup.js +37 -0
- package/dist/src/utils/computerUse/common.js +25 -0
- package/dist/src/utils/computerUse/computerUseLock.js +117 -0
- package/dist/src/utils/computerUse/drainRunLoop.js +44 -0
- package/dist/src/utils/computerUse/escHotkey.js +33 -0
- package/dist/src/utils/computerUse/executor.js +303 -0
- package/dist/src/utils/computerUse/gates.js +40 -0
- package/dist/src/utils/computerUse/hostAdapter.js +48 -0
- package/dist/src/utils/computerUse/inputLoader.js +10 -0
- package/dist/src/utils/computerUse/mcpServer.js +61 -0
- package/dist/src/utils/computerUse/setup.js +25 -0
- package/dist/src/utils/computerUse/swiftLoader.js +7 -0
- package/dist/src/utils/computerUse/toolRendering.js +96 -0
- package/dist/src/utils/computerUse/wrapper.js +242 -0
- package/dist/src/utils/concurrentSessions.js +108 -0
- package/dist/src/utils/config.js +801 -0
- package/dist/src/utils/configConstants.js +11 -0
- package/dist/src/utils/contentArray.js +19 -0
- package/dist/src/utils/context.js +135 -0
- package/dist/src/utils/contextAnalysis.js +152 -0
- package/dist/src/utils/contextSuggestions.js +141 -0
- package/dist/src/utils/controlMessageCompat.js +17 -0
- package/dist/src/utils/conversationRecovery.js +278 -0
- package/dist/src/utils/cron.js +182 -0
- package/dist/src/utils/cronJitterConfig.js +22 -0
- package/dist/src/utils/cronScheduler.js +295 -0
- package/dist/src/utils/cronTasks.js +183 -0
- package/dist/src/utils/cronTasksLock.js +116 -0
- package/dist/src/utils/crossProjectResume.js +36 -0
- package/dist/src/utils/crypto.js +3 -0
- package/dist/src/utils/cwd.js +16 -0
- package/dist/src/utils/debug.js +170 -0
- package/dist/src/utils/debugFilter.js +69 -0
- package/dist/src/utils/deepLink/banner.js +52 -0
- package/dist/src/utils/deepLink/parseDeepLink.js +68 -0
- package/dist/src/utils/deepLink/protocolHandler.js +66 -0
- package/dist/src/utils/deepLink/registerProtocol.js +206 -0
- package/dist/src/utils/deepLink/terminalLauncher.js +321 -0
- package/dist/src/utils/deepLink/terminalPreference.js +26 -0
- package/dist/src/utils/desktopDeepLink.js +154 -0
- package/dist/src/utils/detectRepository.js +98 -0
- package/dist/src/utils/diagLogs.js +47 -0
- package/dist/src/utils/diff.js +92 -0
- package/dist/src/utils/directMemberMessage.js +27 -0
- package/dist/src/utils/displayTags.js +12 -0
- package/dist/src/utils/doctorContextWarnings.js +151 -0
- package/dist/src/utils/doctorDiagnostic.js +388 -0
- package/dist/src/utils/dxt/helpers.js +36 -0
- package/dist/src/utils/dxt/zip.js +112 -0
- package/dist/src/utils/earlyInput.js +98 -0
- package/dist/src/utils/editor.js +105 -0
- package/dist/src/utils/effort.js +188 -0
- package/dist/src/utils/embeddedTools.js +10 -0
- package/dist/src/utils/env.js +284 -0
- package/dist/src/utils/envDynamic.js +91 -0
- package/dist/src/utils/envUtils.js +88 -0
- package/dist/src/utils/envValidation.js +26 -0
- package/dist/src/utils/errorLogSink.js +142 -0
- package/dist/src/utils/errors.js +123 -0
- package/dist/src/utils/exampleCommands.js +133 -0
- package/dist/src/utils/execFileNoThrow.js +82 -0
- package/dist/src/utils/execFileNoThrowPortable.js +52 -0
- package/dist/src/utils/execSyncWrapper.js +16 -0
- package/dist/src/utils/exportRenderer.js +78 -0
- package/dist/src/utils/extraUsage.js +16 -0
- package/dist/src/utils/fastMode.js +331 -0
- package/dist/src/utils/file.js +318 -0
- package/dist/src/utils/fileHistory.js +662 -0
- package/dist/src/utils/fileOperationAnalytics.js +23 -0
- package/dist/src/utils/filePersistence/filePersistence.js +165 -0
- package/dist/src/utils/filePersistence/outputsScanner.js +72 -0
- package/dist/src/utils/filePersistence/types.js +3 -0
- package/dist/src/utils/fileRead.js +53 -0
- package/dist/src/utils/fileReadCache.js +54 -0
- package/dist/src/utils/fileStateCache.js +79 -0
- package/dist/src/utils/findExecutable.js +5 -0
- package/dist/src/utils/fingerprint.js +30 -0
- package/dist/src/utils/forkedAgent.js +253 -0
- package/dist/src/utils/format.js +200 -0
- package/dist/src/utils/formatBriefTimestamp.js +49 -0
- package/dist/src/utils/fpsTracker.js +32 -0
- package/dist/src/utils/frontmatterParser.js +159 -0
- package/dist/src/utils/fsOperations.js +548 -0
- package/dist/src/utils/fullscreen.js +83 -0
- package/dist/src/utils/generatedFiles.js +96 -0
- package/dist/src/utils/generators.js +60 -0
- package/dist/src/utils/genericProcessUtils.js +96 -0
- package/dist/src/utils/getWorktreePaths.js +30 -0
- package/dist/src/utils/getWorktreePathsPortable.js +14 -0
- package/dist/src/utils/ghPrStatus.js +51 -0
- package/dist/src/utils/git/gitConfigParser.js +166 -0
- package/dist/src/utils/git/gitFilesystem.js +413 -0
- package/dist/src/utils/git/gitignore.js +52 -0
- package/dist/src/utils/git.js +520 -0
- package/dist/src/utils/gitDiff.js +291 -0
- package/dist/src/utils/gitSettings.js +10 -0
- package/dist/src/utils/github/ghAuthStatus.js +15 -0
- package/dist/src/utils/githubRepoPathMapping.js +92 -0
- package/dist/src/utils/glob.js +65 -0
- package/dist/src/utils/gracefulShutdown.js +274 -0
- package/dist/src/utils/groupToolUses.js +107 -0
- package/dist/src/utils/handlePromptSubmit.js +323 -0
- package/dist/src/utils/hash.js +21 -0
- package/dist/src/utils/headlessProfiler.js +95 -0
- package/dist/src/utils/heapDumpService.js +157 -0
- package/dist/src/utils/heatmap.js +118 -0
- package/dist/src/utils/highlightMatch.js +28 -0
- package/dist/src/utils/hooks/AsyncHookRegistry.js +190 -0
- package/dist/src/utils/hooks/apiQueryHookHelper.js +67 -0
- package/dist/src/utils/hooks/execAgentHook.js +216 -0
- package/dist/src/utils/hooks/execHttpHook.js +106 -0
- package/dist/src/utils/hooks/execPromptHook.js +153 -0
- package/dist/src/utils/hooks/fileChangedWatcher.js +154 -0
- package/dist/src/utils/hooks/hookEvents.js +92 -0
- package/dist/src/utils/hooks/hookHelpers.js +43 -0
- package/dist/src/utils/hooks/hooksConfigManager.js +386 -0
- package/dist/src/utils/hooks/hooksConfigSnapshot.js +52 -0
- package/dist/src/utils/hooks/hooksSettings.js +175 -0
- package/dist/src/utils/hooks/postSamplingHooks.js +26 -0
- package/dist/src/utils/hooks/registerFrontmatterHooks.js +34 -0
- package/dist/src/utils/hooks/registerSkillHooks.js +24 -0
- package/dist/src/utils/hooks/sessionHooks.js +176 -0
- package/dist/src/utils/hooks/skillImprovement.js +200 -0
- package/dist/src/utils/hooks/ssrfGuard.js +157 -0
- package/dist/src/utils/hooks.js +2879 -0
- package/dist/src/utils/horizontalScroll.js +72 -0
- package/dist/src/utils/http.js +80 -0
- package/dist/src/utils/hyperlink.js +13 -0
- package/dist/src/utils/iTermBackup.js +46 -0
- package/dist/src/utils/ide.js +938 -0
- package/dist/src/utils/idePathConversion.js +47 -0
- package/dist/src/utils/idleTimeout.js +33 -0
- package/dist/src/utils/imagePaste.js +190 -0
- package/dist/src/utils/imageResizer.js +459 -0
- package/dist/src/utils/imageStore.js +109 -0
- package/dist/src/utils/imageValidation.js +61 -0
- package/dist/src/utils/immediateCommand.js +4 -0
- package/dist/src/utils/inProcessTeammateHelpers.js +28 -0
- package/dist/src/utils/ink.js +14 -0
- package/dist/src/utils/intl.js +61 -0
- package/dist/src/utils/jetbrains.js +130 -0
- package/dist/src/utils/json.js +182 -0
- package/dist/src/utils/jsonRead.js +4 -0
- package/dist/src/utils/keyboardShortcuts.js +8 -0
- package/dist/src/utils/lazySchema.js +4 -0
- package/dist/src/utils/listSessionsImpl.js +219 -0
- package/dist/src/utils/localInstaller.js +86 -0
- package/dist/src/utils/lockfile.js +19 -0
- package/dist/src/utils/log.js +164 -0
- package/dist/src/utils/logoV2Utils.js +192 -0
- package/dist/src/utils/mailbox.js +51 -0
- package/dist/src/utils/managedEnv.js +90 -0
- package/dist/src/utils/managedEnvConstants.js +136 -0
- package/dist/src/utils/markdown.js +216 -0
- package/dist/src/utils/markdownConfigLoader.js +293 -0
- package/dist/src/utils/mcp/dateTimeParser.js +73 -0
- package/dist/src/utils/mcp/elicitationValidation.js +208 -0
- package/dist/src/utils/mcpInstructionsDelta.js +71 -0
- package/dist/src/utils/mcpOutputStorage.js +124 -0
- package/dist/src/utils/mcpValidation.js +138 -0
- package/dist/src/utils/mcpWebSocketTransport.js +152 -0
- package/dist/src/utils/memoize.js +125 -0
- package/dist/src/utils/memory/types.js +8 -0
- package/dist/src/utils/memory/versions.js +4 -0
- package/dist/src/utils/memoryFileDetection.js +151 -0
- package/dist/src/utils/messagePredicates.js +3 -0
- package/dist/src/utils/messageQueueManager.js +267 -0
- package/dist/src/utils/messages/mappers.js +198 -0
- package/dist/src/utils/messages/systemInit.js +47 -0
- package/dist/src/utils/messages.js +3450 -0
- package/dist/src/utils/model/agent.js +91 -0
- package/dist/src/utils/model/aliases.js +16 -0
- package/dist/src/utils/model/antModels.js +23 -0
- package/dist/src/utils/model/bedrock.js +158 -0
- package/dist/src/utils/model/check1mAccess.js +49 -0
- package/dist/src/utils/model/configs.js +81 -0
- package/dist/src/utils/model/contextWindowUpgradeCheck.js +32 -0
- package/dist/src/utils/model/deprecation.js +56 -0
- package/dist/src/utils/model/model.js +377 -0
- package/dist/src/utils/model/modelAllowlist.js +91 -0
- package/dist/src/utils/model/modelCapabilities.js +97 -0
- package/dist/src/utils/model/modelOptions.js +403 -0
- package/dist/src/utils/model/modelStrings.js +112 -0
- package/dist/src/utils/model/modelSupportOverrides.js +32 -0
- package/dist/src/utils/model/providers.js +23 -0
- package/dist/src/utils/model/validateModel.js +108 -0
- package/dist/src/utils/modelCost.js +135 -0
- package/dist/src/utils/modifiers.js +22 -0
- package/dist/src/utils/mtls.js +101 -0
- package/dist/src/utils/nativeInstaller/download.js +309 -0
- package/dist/src/utils/nativeInstaller/index.js +9 -0
- package/dist/src/utils/nativeInstaller/installer.js +1104 -0
- package/dist/src/utils/nativeInstaller/packageManagers.js +174 -0
- package/dist/src/utils/nativeInstaller/pidLock.js +230 -0
- package/dist/src/utils/notebook.js +170 -0
- package/dist/src/utils/objectGroupBy.js +12 -0
- package/dist/src/utils/pasteStore.js +61 -0
- package/dist/src/utils/path.js +65 -0
- package/dist/src/utils/pdf.js +199 -0
- package/dist/src/utils/pdfUtils.js +36 -0
- package/dist/src/utils/peerAddress.js +9 -0
- package/dist/src/utils/permissions/PermissionMode.js +82 -0
- package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +62 -0
- package/dist/src/utils/permissions/PermissionResult.js +10 -0
- package/dist/src/utils/permissions/PermissionRule.js +7 -0
- package/dist/src/utils/permissions/PermissionUpdate.js +219 -0
- package/dist/src/utils/permissions/PermissionUpdateSchema.js +49 -0
- package/dist/src/utils/permissions/autoModeState.js +26 -0
- package/dist/src/utils/permissions/bashClassifier.js +29 -0
- package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +69 -0
- package/dist/src/utils/permissions/classifierDecision.js +56 -0
- package/dist/src/utils/permissions/classifierShared.js +14 -0
- package/dist/src/utils/permissions/dangerousPatterns.js +44 -0
- package/dist/src/utils/permissions/denialTracking.js +28 -0
- package/dist/src/utils/permissions/filesystem.js +889 -0
- package/dist/src/utils/permissions/getNextPermissionMode.js +51 -0
- package/dist/src/utils/permissions/pathValidation.js +230 -0
- package/dist/src/utils/permissions/permissionExplainer.js +162 -0
- package/dist/src/utils/permissions/permissionRuleParser.js +90 -0
- package/dist/src/utils/permissions/permissionSetup.js +770 -0
- package/dist/src/utils/permissions/permissions.js +585 -0
- package/dist/src/utils/permissions/permissionsLoader.js +160 -0
- package/dist/src/utils/permissions/shadowedRuleDetection.js +81 -0
- package/dist/src/utils/permissions/shellRuleMatching.js +108 -0
- package/dist/src/utils/permissions/yoloClassifier.js +868 -0
- package/dist/src/utils/planModeV2.js +45 -0
- package/dist/src/utils/plans.js +232 -0
- package/dist/src/utils/platform.js +102 -0
- package/dist/src/utils/plugins/addDirPluginSettings.js +30 -0
- package/dist/src/utils/plugins/cacheUtils.js +144 -0
- package/dist/src/utils/plugins/dependencyResolver.js +118 -0
- package/dist/src/utils/plugins/fetchTelemetry.js +65 -0
- package/dist/src/utils/plugins/gitAvailability.js +18 -0
- package/dist/src/utils/plugins/headlessPluginInstall.js +92 -0
- package/dist/src/utils/plugins/hintRecommendation.js +95 -0
- package/dist/src/utils/plugins/installCounts.js +144 -0
- package/dist/src/utils/plugins/installedPluginsManager.js +645 -0
- package/dist/src/utils/plugins/loadPluginAgents.js +197 -0
- package/dist/src/utils/plugins/loadPluginCommands.js +488 -0
- package/dist/src/utils/plugins/loadPluginHooks.js +170 -0
- package/dist/src/utils/plugins/loadPluginOutputStyles.js +98 -0
- package/dist/src/utils/plugins/lspPluginIntegration.js +216 -0
- package/dist/src/utils/plugins/lspRecommendation.js +193 -0
- package/dist/src/utils/plugins/managedPlugins.js +18 -0
- package/dist/src/utils/plugins/marketplaceHelpers.js +309 -0
- package/dist/src/utils/plugins/marketplaceManager.js +1225 -0
- package/dist/src/utils/plugins/mcpPluginIntegration.js +336 -0
- package/dist/src/utils/plugins/mcpbHandler.js +487 -0
- package/dist/src/utils/plugins/officialMarketplace.js +5 -0
- package/dist/src/utils/plugins/officialMarketplaceGcs.js +118 -0
- package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +267 -0
- package/dist/src/utils/plugins/orphanedPluginFilter.js +47 -0
- package/dist/src/utils/plugins/parseMarketplaceInput.js +75 -0
- package/dist/src/utils/plugins/performStartupChecks.js +34 -0
- package/dist/src/utils/plugins/pluginAutoupdate.js +130 -0
- package/dist/src/utils/plugins/pluginBlocklist.js +66 -0
- package/dist/src/utils/plugins/pluginDirectories.js +78 -0
- package/dist/src/utils/plugins/pluginFlagging.js +122 -0
- package/dist/src/utils/plugins/pluginIdentifier.js +37 -0
- package/dist/src/utils/plugins/pluginInstallationHelpers.js +281 -0
- package/dist/src/utils/plugins/pluginLoader.js +1596 -0
- package/dist/src/utils/plugins/pluginOptionsStorage.js +162 -0
- package/dist/src/utils/plugins/pluginPolicy.js +5 -0
- package/dist/src/utils/plugins/pluginStartupCheck.js +176 -0
- package/dist/src/utils/plugins/pluginVersioning.js +53 -0
- package/dist/src/utils/plugins/reconciler.js +133 -0
- package/dist/src/utils/plugins/refresh.js +96 -0
- package/dist/src/utils/plugins/schemas.js +411 -0
- package/dist/src/utils/plugins/validatePlugin.js +573 -0
- package/dist/src/utils/plugins/walkPluginMarkdown.js +30 -0
- package/dist/src/utils/plugins/zipCache.js +211 -0
- package/dist/src/utils/plugins/zipCacheAdapters.js +93 -0
- package/dist/src/utils/powershell/dangerousCmdlets.js +97 -0
- package/dist/src/utils/powershell/parser.js +929 -0
- package/dist/src/utils/powershell/staticPrefix.js +142 -0
- package/dist/src/utils/preflightChecks.js +196 -0
- package/dist/src/utils/privacyLevel.js +21 -0
- package/dist/src/utils/process.js +42 -0
- package/dist/src/utils/processUserInput/processBashCommand.js +109 -0
- package/dist/src/utils/processUserInput/processSlashCommand.js +600 -0
- package/dist/src/utils/processUserInput/processTextPrompt.js +54 -0
- package/dist/src/utils/processUserInput/processUserInput.js +272 -0
- package/dist/src/utils/profilerBase.js +15 -0
- package/dist/src/utils/promptCategory.js +21 -0
- package/dist/src/utils/promptEditor.js +115 -0
- package/dist/src/utils/promptShellExecution.js +76 -0
- package/dist/src/utils/proxy.js +228 -0
- package/dist/src/utils/queryContext.js +83 -0
- package/dist/src/utils/queryHelpers.js +329 -0
- package/dist/src/utils/queryProfiler.js +177 -0
- package/dist/src/utils/queueProcessor.js +41 -0
- package/dist/src/utils/readEditContext.js +131 -0
- package/dist/src/utils/readFileInRange.js +212 -0
- package/dist/src/utils/releaseNotes.js +186 -0
- package/dist/src/utils/renderOptions.js +45 -0
- package/dist/src/utils/ripgrep.js +383 -0
- package/dist/src/utils/sandbox/sandbox-adapter.js +505 -0
- package/dist/src/utils/sandbox/sandbox-ui-utils.js +3 -0
- package/dist/src/utils/sanitization.js +33 -0
- package/dist/src/utils/screenshotClipboard.js +73 -0
- package/dist/src/utils/sdkEventQueue.js +36 -0
- package/dist/src/utils/secureStorage/fallbackStorage.js +45 -0
- package/dist/src/utils/secureStorage/index.js +9 -0
- package/dist/src/utils/secureStorage/keychainPrefetch.js +43 -0
- package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +42 -0
- package/dist/src/utils/secureStorage/macOsKeychainStorage.js +147 -0
- package/dist/src/utils/secureStorage/plainTextStorage.js +77 -0
- package/dist/src/utils/semanticBoolean.js +4 -0
- package/dist/src/utils/semanticNumber.js +11 -0
- package/dist/src/utils/semver.js +43 -0
- package/dist/src/utils/sequential.js +30 -0
- package/dist/src/utils/sessionActivity.js +95 -0
- package/dist/src/utils/sessionEnvVars.js +13 -0
- package/dist/src/utils/sessionEnvironment.js +113 -0
- package/dist/src/utils/sessionFileAccessHooks.js +150 -0
- package/dist/src/utils/sessionIngressAuth.js +79 -0
- package/dist/src/utils/sessionRestore.js +205 -0
- package/dist/src/utils/sessionStart.js +119 -0
- package/dist/src/utils/sessionState.js +48 -0
- package/dist/src/utils/sessionStorage.js +2891 -0
- package/dist/src/utils/sessionStoragePortable.js +486 -0
- package/dist/src/utils/sessionTitle.js +89 -0
- package/dist/src/utils/sessionUrl.js +33 -0
- package/dist/src/utils/set.js +38 -0
- package/dist/src/utils/settings/allErrors.js +11 -0
- package/dist/src/utils/settings/applySettingsChange.js +40 -0
- package/dist/src/utils/settings/changeDetector.js +279 -0
- package/dist/src/utils/settings/constants.js +119 -0
- package/dist/src/utils/settings/internalWrites.js +15 -0
- package/dist/src/utils/settings/managedPath.js +19 -0
- package/dist/src/utils/settings/mdm/constants.js +33 -0
- package/dist/src/utils/settings/mdm/rawRead.js +72 -0
- package/dist/src/utils/settings/mdm/settings.js +160 -0
- package/dist/src/utils/settings/permissionValidation.js +169 -0
- package/dist/src/utils/settings/pluginOnlyPolicy.js +19 -0
- package/dist/src/utils/settings/schemaOutput.js +7 -0
- package/dist/src/utils/settings/settings.js +530 -0
- package/dist/src/utils/settings/settingsCache.js +36 -0
- package/dist/src/utils/settings/toolValidationConfig.js +58 -0
- package/dist/src/utils/settings/types.js +224 -0
- package/dist/src/utils/settings/validateEditTool.js +26 -0
- package/dist/src/utils/settings/validation.js +160 -0
- package/dist/src/utils/settings/validationTips.js +94 -0
- package/dist/src/utils/shell/bashProvider.js +123 -0
- package/dist/src/utils/shell/outputLimits.js +7 -0
- package/dist/src/utils/shell/powershellDetection.js +50 -0
- package/dist/src/utils/shell/powershellProvider.js +50 -0
- package/dist/src/utils/shell/prefix.js +183 -0
- package/dist/src/utils/shell/readOnlyCommandValidation.js +1347 -0
- package/dist/src/utils/shell/resolveDefaultShell.js +4 -0
- package/dist/src/utils/shell/shellProvider.js +2 -0
- package/dist/src/utils/shell/shellToolUtils.js +10 -0
- package/dist/src/utils/shell/specPrefix.js +152 -0
- package/dist/src/utils/shellConfig.js +88 -0
- package/dist/src/utils/sideQuery.js +108 -0
- package/dist/src/utils/sideQuestion.js +78 -0
- package/dist/src/utils/signal.js +18 -0
- package/dist/src/utils/sinks.js +6 -0
- package/dist/src/utils/skills/skillChangeDetector.js +184 -0
- package/dist/src/utils/slashCommandParsing.js +25 -0
- package/dist/src/utils/sleep.js +43 -0
- package/dist/src/utils/sliceAnsi.js +48 -0
- package/dist/src/utils/slowOperations.js +165 -0
- package/dist/src/utils/standaloneAgent.js +7 -0
- package/dist/src/utils/startupProfiler.js +106 -0
- package/dist/src/utils/staticRender.js +78 -0
- package/dist/src/utils/stats.js +598 -0
- package/dist/src/utils/statsCache.js +223 -0
- package/dist/src/utils/status.js +361 -0
- package/dist/src/utils/statusNoticeDefinitions.js +280 -0
- package/dist/src/utils/statusNoticeHelpers.js +10 -0
- package/dist/src/utils/stream.js +72 -0
- package/dist/src/utils/streamJsonStdoutGuard.js +73 -0
- package/dist/src/utils/streamlinedTransform.js +130 -0
- package/dist/src/utils/stringUtils.js +108 -0
- package/dist/src/utils/subprocessEnv.js +42 -0
- package/dist/src/utils/suggestions/commandSuggestions.js +301 -0
- package/dist/src/utils/suggestions/directoryCompletion.js +134 -0
- package/dist/src/utils/suggestions/shellHistoryCompletion.js +65 -0
- package/dist/src/utils/suggestions/skillUsageTracking.js +33 -0
- package/dist/src/utils/suggestions/slackChannelSuggestions.js +141 -0
- package/dist/src/utils/swarm/It2SetupPrompt.js +537 -0
- package/dist/src/utils/swarm/backends/ITermBackend.js +153 -0
- package/dist/src/utils/swarm/backends/InProcessBackend.js +160 -0
- package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +171 -0
- package/dist/src/utils/swarm/backends/TmuxBackend.js +458 -0
- package/dist/src/utils/swarm/backends/detection.js +43 -0
- package/dist/src/utils/swarm/backends/it2Setup.js +134 -0
- package/dist/src/utils/swarm/backends/registry.js +220 -0
- package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +33 -0
- package/dist/src/utils/swarm/backends/types.js +3 -0
- package/dist/src/utils/swarm/constants.js +11 -0
- package/dist/src/utils/swarm/inProcessRunner.js +818 -0
- package/dist/src/utils/swarm/leaderPermissionBridge.js +20 -0
- package/dist/src/utils/swarm/permissionSync.js +474 -0
- package/dist/src/utils/swarm/reconnection.js +55 -0
- package/dist/src/utils/swarm/spawnInProcess.js +164 -0
- package/dist/src/utils/swarm/spawnUtils.js +76 -0
- package/dist/src/utils/swarm/teamHelpers.js +320 -0
- package/dist/src/utils/swarm/teammateInit.js +65 -0
- package/dist/src/utils/swarm/teammateLayoutManager.js +40 -0
- package/dist/src/utils/swarm/teammateModel.js +5 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +11 -0
- package/dist/src/utils/systemDirectories.js +42 -0
- package/dist/src/utils/systemPrompt.js +41 -0
- package/dist/src/utils/systemPromptType.js +3 -0
- package/dist/src/utils/systemTheme.js +61 -0
- package/dist/src/utils/taggedId.js +27 -0
- package/dist/src/utils/task/TaskOutput.js +244 -0
- package/dist/src/utils/task/diskOutput.js +267 -0
- package/dist/src/utils/task/framework.js +178 -0
- package/dist/src/utils/task/outputFormatting.js +21 -0
- package/dist/src/utils/task/sdkProgress.js +18 -0
- package/dist/src/utils/tasks.js +481 -0
- package/dist/src/utils/teamDiscovery.js +33 -0
- package/dist/src/utils/teamMemoryOps.js +40 -0
- package/dist/src/utils/teammate.js +132 -0
- package/dist/src/utils/teammateContext.js +17 -0
- package/dist/src/utils/teammateMailbox.js +541 -0
- package/dist/src/utils/telemetry/betaSessionTracing.js +255 -0
- package/dist/src/utils/telemetry/bigqueryExporter.js +162 -0
- package/dist/src/utils/telemetry/events.js +46 -0
- package/dist/src/utils/telemetry/instrumentation.js +534 -0
- package/dist/src/utils/telemetry/logger.js +26 -0
- package/dist/src/utils/telemetry/perfettoTracing.js +636 -0
- package/dist/src/utils/telemetry/pluginTelemetry.js +99 -0
- package/dist/src/utils/telemetry/sessionTracing.js +564 -0
- package/dist/src/utils/telemetry/skillLoadedEvent.js +22 -0
- package/dist/src/utils/telemetryAttributes.js +50 -0
- package/dist/src/utils/teleport/api.js +236 -0
- package/dist/src/utils/teleport/environmentSelection.js +42 -0
- package/dist/src/utils/teleport/environments.js +74 -0
- package/dist/src/utils/teleport/gitBundle.js +153 -0
- package/dist/src/utils/teleport.js +856 -0
- package/dist/src/utils/tempfile.js +7 -0
- package/dist/src/utils/terminal.js +65 -0
- package/dist/src/utils/terminalPanel.js +133 -0
- package/dist/src/utils/textHighlighting.js +109 -0
- package/dist/src/utils/theme.js +465 -0
- package/dist/src/utils/thinking.js +92 -0
- package/dist/src/utils/timeouts.js +22 -0
- package/dist/src/utils/tmuxSocket.js +216 -0
- package/dist/src/utils/todo/types.js +9 -0
- package/dist/src/utils/tokenBudget.js +54 -0
- package/dist/src/utils/tokens.js +123 -0
- package/dist/src/utils/toolErrors.js +87 -0
- package/dist/src/utils/toolPool.js +22 -0
- package/dist/src/utils/toolResultStorage.js +444 -0
- package/dist/src/utils/toolSchemaCache.js +7 -0
- package/dist/src/utils/toolSearch.js +314 -0
- package/dist/src/utils/transcriptSearch.js +143 -0
- package/dist/src/utils/treeify.js +89 -0
- package/dist/src/utils/truncate.js +113 -0
- package/dist/src/utils/ultraplan/ccrSession.js +187 -0
- package/dist/src/utils/ultraplan/keyword.js +81 -0
- package/dist/src/utils/ultraplan/prompt.txt.js +1 -0
- package/dist/src/utils/unaryLogging.js +15 -0
- package/dist/src/utils/undercover.js +57 -0
- package/dist/src/utils/user.js +111 -0
- package/dist/src/utils/userAgent.js +3 -0
- package/dist/src/utils/userPromptKeywords.js +13 -0
- package/dist/src/utils/uuid.js +11 -0
- package/dist/src/utils/warningHandler.js +74 -0
- package/dist/src/utils/which.js +50 -0
- package/dist/src/utils/windowsPaths.js +104 -0
- package/dist/src/utils/withResolvers.js +9 -0
- package/dist/src/utils/words.js +763 -0
- package/dist/src/utils/workloadContext.js +9 -0
- package/dist/src/utils/worktree.js +841 -0
- package/dist/src/utils/worktreeModeEnabled.js +3 -0
- package/dist/src/utils/xdg.js +24 -0
- package/dist/src/utils/xml.js +6 -0
- package/dist/src/utils/yaml.js +6 -0
- package/dist/src/utils/zodToJsonSchema.js +10 -0
- package/dist/src/vim/motions.js +54 -0
- package/dist/src/vim/operators.js +329 -0
- package/dist/src/vim/textObjects.js +137 -0
- package/dist/src/vim/transitions.js +324 -0
- package/dist/src/vim/types.js +60 -0
- package/dist/src/voice/voiceModeEnabled.js +18 -0
- package/dist/stubs/ant-claude-for-chrome-mcp.js +6 -0
- package/dist/stubs/color-diff-napi.js +30 -0
- package/litellm.yaml +25 -0
- package/package.json +93 -0
|
@@ -0,0 +1,2212 @@
|
|
|
1
|
+
import { execFileSync } from "child_process";
|
|
2
|
+
import { diffLines } from "diff";
|
|
3
|
+
import { constants as fsConstants } from "fs";
|
|
4
|
+
import {
|
|
5
|
+
copyFile,
|
|
6
|
+
mkdir,
|
|
7
|
+
mkdtemp,
|
|
8
|
+
readdir,
|
|
9
|
+
readFile,
|
|
10
|
+
rm,
|
|
11
|
+
unlink,
|
|
12
|
+
writeFile
|
|
13
|
+
} from "fs/promises";
|
|
14
|
+
import { tmpdir } from "os";
|
|
15
|
+
import { extname, join } from "path";
|
|
16
|
+
import { queryWithModel } from "../services/api/claude.js";
|
|
17
|
+
import {
|
|
18
|
+
AGENT_TOOL_NAME,
|
|
19
|
+
LEGACY_AGENT_TOOL_NAME
|
|
20
|
+
} from "../tools/AgentTool/constants.js";
|
|
21
|
+
import { getClaudeConfigHomeDir } from "../utils/envUtils.js";
|
|
22
|
+
import { toError } from "../utils/errors.js";
|
|
23
|
+
import { execFileNoThrow } from "../utils/execFileNoThrow.js";
|
|
24
|
+
import { logError } from "../utils/log.js";
|
|
25
|
+
import { extractTextContent } from "../utils/messages.js";
|
|
26
|
+
import { getDefaultOpusModel } from "../utils/model/model.js";
|
|
27
|
+
import {
|
|
28
|
+
getProjectsDir,
|
|
29
|
+
getSessionFilesWithMtime,
|
|
30
|
+
getSessionIdFromLog,
|
|
31
|
+
loadAllLogsFromSessionFile
|
|
32
|
+
} from "../utils/sessionStorage.js";
|
|
33
|
+
import { jsonParse, jsonStringify } from "../utils/slowOperations.js";
|
|
34
|
+
import { countCharInString } from "../utils/stringUtils.js";
|
|
35
|
+
import { asSystemPrompt } from "../utils/systemPromptType.js";
|
|
36
|
+
import { escapeXmlAttr as escapeHtml } from "../utils/xml.js";
|
|
37
|
+
function getAnalysisModel() {
|
|
38
|
+
return getDefaultOpusModel();
|
|
39
|
+
}
|
|
40
|
+
function getInsightsModel() {
|
|
41
|
+
return getDefaultOpusModel();
|
|
42
|
+
}
|
|
43
|
+
const getRunningRemoteHosts = process.env.USER_TYPE === "ant" ? async () => {
|
|
44
|
+
const { stdout, code } = await execFileNoThrow("coder", ["list", "-o", "json"], { timeout: 30000 });
|
|
45
|
+
if (code !== 0)
|
|
46
|
+
return [];
|
|
47
|
+
try {
|
|
48
|
+
const workspaces = jsonParse(stdout);
|
|
49
|
+
return workspaces.filter((w) => w.latest_build?.status === "running").map((w) => w.name);
|
|
50
|
+
} catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
} : async () => [];
|
|
54
|
+
const getRemoteHostSessionCount = process.env.USER_TYPE === "ant" ? async (homespace) => {
|
|
55
|
+
const { stdout, code } = await execFileNoThrow("ssh", [
|
|
56
|
+
`${homespace}.coder`,
|
|
57
|
+
'find /root/.claude/projects -name "*.jsonl" 2>/dev/null | wc -l'
|
|
58
|
+
], { timeout: 30000 });
|
|
59
|
+
if (code !== 0)
|
|
60
|
+
return 0;
|
|
61
|
+
return parseInt(stdout.trim(), 10) || 0;
|
|
62
|
+
} : async () => 0;
|
|
63
|
+
const collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
64
|
+
const result = { copied: 0, skipped: 0 };
|
|
65
|
+
const tempDir = await mkdtemp(join(tmpdir(), "claude-hs-"));
|
|
66
|
+
try {
|
|
67
|
+
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.claude/projects/`, tempDir], { timeout: 300000 });
|
|
68
|
+
if (scpResult.code !== 0) {
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
const projectsDir = join(tempDir, "projects");
|
|
72
|
+
let projectDirents;
|
|
73
|
+
try {
|
|
74
|
+
projectDirents = await readdir(projectsDir, { withFileTypes: true });
|
|
75
|
+
} catch {
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
await Promise.all(projectDirents.map(async (dirent) => {
|
|
79
|
+
const projectName = dirent.name;
|
|
80
|
+
const projectPath = join(projectsDir, projectName);
|
|
81
|
+
if (!dirent.isDirectory())
|
|
82
|
+
return;
|
|
83
|
+
const destProjectName = `${projectName}__${homespace}`;
|
|
84
|
+
const destProjectPath = join(destDir, destProjectName);
|
|
85
|
+
try {
|
|
86
|
+
await mkdir(destProjectPath, { recursive: true });
|
|
87
|
+
} catch {}
|
|
88
|
+
let files;
|
|
89
|
+
try {
|
|
90
|
+
files = await readdir(projectPath, { withFileTypes: true });
|
|
91
|
+
} catch {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await Promise.all(files.map(async (fileDirent) => {
|
|
95
|
+
const fileName = fileDirent.name;
|
|
96
|
+
if (!fileName.endsWith(".jsonl"))
|
|
97
|
+
return;
|
|
98
|
+
const srcFile = join(projectPath, fileName);
|
|
99
|
+
const destFile = join(destProjectPath, fileName);
|
|
100
|
+
try {
|
|
101
|
+
await copyFile(srcFile, destFile, fsConstants.COPYFILE_EXCL);
|
|
102
|
+
result.copied++;
|
|
103
|
+
} catch {
|
|
104
|
+
result.skipped++;
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
}));
|
|
108
|
+
} finally {
|
|
109
|
+
try {
|
|
110
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
111
|
+
} catch {}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
} : async () => ({ copied: 0, skipped: 0 });
|
|
115
|
+
const collectAllRemoteHostData = process.env.USER_TYPE === "ant" ? async (destDir) => {
|
|
116
|
+
const rHosts = await getRunningRemoteHosts();
|
|
117
|
+
const result = [];
|
|
118
|
+
let totalCopied = 0;
|
|
119
|
+
let totalSkipped = 0;
|
|
120
|
+
const hostResults = await Promise.all(rHosts.map(async (hs) => {
|
|
121
|
+
const sessionCount = await getRemoteHostSessionCount(hs);
|
|
122
|
+
if (sessionCount > 0) {
|
|
123
|
+
const { copied, skipped } = await collectFromRemoteHost(hs, destDir);
|
|
124
|
+
return { name: hs, sessionCount, copied, skipped };
|
|
125
|
+
}
|
|
126
|
+
return { name: hs, sessionCount, copied: 0, skipped: 0 };
|
|
127
|
+
}));
|
|
128
|
+
for (const hr of hostResults) {
|
|
129
|
+
result.push({ name: hr.name, sessionCount: hr.sessionCount });
|
|
130
|
+
totalCopied += hr.copied;
|
|
131
|
+
totalSkipped += hr.skipped;
|
|
132
|
+
}
|
|
133
|
+
return { hosts: result, totalCopied, totalSkipped };
|
|
134
|
+
} : async () => ({ hosts: [], totalCopied: 0, totalSkipped: 0 });
|
|
135
|
+
const EXTENSION_TO_LANGUAGE = {
|
|
136
|
+
".ts": "TypeScript",
|
|
137
|
+
".tsx": "TypeScript",
|
|
138
|
+
".js": "JavaScript",
|
|
139
|
+
".jsx": "JavaScript",
|
|
140
|
+
".py": "Python",
|
|
141
|
+
".rb": "Ruby",
|
|
142
|
+
".go": "Go",
|
|
143
|
+
".rs": "Rust",
|
|
144
|
+
".java": "Java",
|
|
145
|
+
".md": "Markdown",
|
|
146
|
+
".json": "JSON",
|
|
147
|
+
".yaml": "YAML",
|
|
148
|
+
".yml": "YAML",
|
|
149
|
+
".sh": "Shell",
|
|
150
|
+
".css": "CSS",
|
|
151
|
+
".html": "HTML"
|
|
152
|
+
};
|
|
153
|
+
const LABEL_MAP = {
|
|
154
|
+
debug_investigate: "Debug/Investigate",
|
|
155
|
+
implement_feature: "Implement Feature",
|
|
156
|
+
fix_bug: "Fix Bug",
|
|
157
|
+
write_script_tool: "Write Script/Tool",
|
|
158
|
+
refactor_code: "Refactor Code",
|
|
159
|
+
configure_system: "Configure System",
|
|
160
|
+
create_pr_commit: "Create PR/Commit",
|
|
161
|
+
analyze_data: "Analyze Data",
|
|
162
|
+
understand_codebase: "Understand Codebase",
|
|
163
|
+
write_tests: "Write Tests",
|
|
164
|
+
write_docs: "Write Docs",
|
|
165
|
+
deploy_infra: "Deploy/Infra",
|
|
166
|
+
warmup_minimal: "Cache Warmup",
|
|
167
|
+
fast_accurate_search: "Fast/Accurate Search",
|
|
168
|
+
correct_code_edits: "Correct Code Edits",
|
|
169
|
+
good_explanations: "Good Explanations",
|
|
170
|
+
proactive_help: "Proactive Help",
|
|
171
|
+
multi_file_changes: "Multi-file Changes",
|
|
172
|
+
handled_complexity: "Multi-file Changes",
|
|
173
|
+
good_debugging: "Good Debugging",
|
|
174
|
+
misunderstood_request: "Misunderstood Request",
|
|
175
|
+
wrong_approach: "Wrong Approach",
|
|
176
|
+
buggy_code: "Buggy Code",
|
|
177
|
+
user_rejected_action: "User Rejected Action",
|
|
178
|
+
claude_got_blocked: "Claude Got Blocked",
|
|
179
|
+
user_stopped_early: "User Stopped Early",
|
|
180
|
+
wrong_file_or_location: "Wrong File/Location",
|
|
181
|
+
excessive_changes: "Excessive Changes",
|
|
182
|
+
slow_or_verbose: "Slow/Verbose",
|
|
183
|
+
tool_failed: "Tool Failed",
|
|
184
|
+
user_unclear: "User Unclear",
|
|
185
|
+
external_issue: "External Issue",
|
|
186
|
+
frustrated: "Frustrated",
|
|
187
|
+
dissatisfied: "Dissatisfied",
|
|
188
|
+
likely_satisfied: "Likely Satisfied",
|
|
189
|
+
satisfied: "Satisfied",
|
|
190
|
+
happy: "Happy",
|
|
191
|
+
unsure: "Unsure",
|
|
192
|
+
neutral: "Neutral",
|
|
193
|
+
delighted: "Delighted",
|
|
194
|
+
single_task: "Single Task",
|
|
195
|
+
multi_task: "Multi Task",
|
|
196
|
+
iterative_refinement: "Iterative Refinement",
|
|
197
|
+
exploration: "Exploration",
|
|
198
|
+
quick_question: "Quick Question",
|
|
199
|
+
fully_achieved: "Fully Achieved",
|
|
200
|
+
mostly_achieved: "Mostly Achieved",
|
|
201
|
+
partially_achieved: "Partially Achieved",
|
|
202
|
+
not_achieved: "Not Achieved",
|
|
203
|
+
unclear_from_transcript: "Unclear",
|
|
204
|
+
unhelpful: "Unhelpful",
|
|
205
|
+
slightly_helpful: "Slightly Helpful",
|
|
206
|
+
moderately_helpful: "Moderately Helpful",
|
|
207
|
+
very_helpful: "Very Helpful",
|
|
208
|
+
essential: "Essential"
|
|
209
|
+
};
|
|
210
|
+
function getDataDir() {
|
|
211
|
+
return join(getClaudeConfigHomeDir(), "usage-data");
|
|
212
|
+
}
|
|
213
|
+
function getFacetsDir() {
|
|
214
|
+
return join(getDataDir(), "facets");
|
|
215
|
+
}
|
|
216
|
+
function getSessionMetaDir() {
|
|
217
|
+
return join(getDataDir(), "session-meta");
|
|
218
|
+
}
|
|
219
|
+
const FACET_EXTRACTION_PROMPT = `Analyze this Claude Code session and extract structured facets.
|
|
220
|
+
|
|
221
|
+
CRITICAL GUIDELINES:
|
|
222
|
+
|
|
223
|
+
1. **goal_categories**: Count ONLY what the USER explicitly asked for.
|
|
224
|
+
- DO NOT count Claude's autonomous codebase exploration
|
|
225
|
+
- DO NOT count work Claude decided to do on its own
|
|
226
|
+
- ONLY count when user says "can you...", "please...", "I need...", "let's..."
|
|
227
|
+
|
|
228
|
+
2. **user_satisfaction_counts**: Base ONLY on explicit user signals.
|
|
229
|
+
- "Yay!", "great!", "perfect!" → happy
|
|
230
|
+
- "thanks", "looks good", "that works" → satisfied
|
|
231
|
+
- "ok, now let's..." (continuing without complaint) → likely_satisfied
|
|
232
|
+
- "that's not right", "try again" → dissatisfied
|
|
233
|
+
- "this is broken", "I give up" → frustrated
|
|
234
|
+
|
|
235
|
+
3. **friction_counts**: Be specific about what went wrong.
|
|
236
|
+
- misunderstood_request: Claude interpreted incorrectly
|
|
237
|
+
- wrong_approach: Right goal, wrong solution method
|
|
238
|
+
- buggy_code: Code didn't work correctly
|
|
239
|
+
- user_rejected_action: User said no/stop to a tool call
|
|
240
|
+
- excessive_changes: Over-engineered or changed too much
|
|
241
|
+
|
|
242
|
+
4. If very short or just warmup, use warmup_minimal for goal_category
|
|
243
|
+
|
|
244
|
+
SESSION:
|
|
245
|
+
`;
|
|
246
|
+
function getLanguageFromPath(filePath) {
|
|
247
|
+
const ext = extname(filePath).toLowerCase();
|
|
248
|
+
return EXTENSION_TO_LANGUAGE[ext] || null;
|
|
249
|
+
}
|
|
250
|
+
function extractToolStats(log) {
|
|
251
|
+
const toolCounts = {};
|
|
252
|
+
const languages = {};
|
|
253
|
+
let gitCommits = 0;
|
|
254
|
+
let gitPushes = 0;
|
|
255
|
+
let inputTokens = 0;
|
|
256
|
+
let outputTokens = 0;
|
|
257
|
+
let userInterruptions = 0;
|
|
258
|
+
const userResponseTimes = [];
|
|
259
|
+
let toolErrors = 0;
|
|
260
|
+
const toolErrorCategories = {};
|
|
261
|
+
let usesTaskAgent = false;
|
|
262
|
+
let linesAdded = 0;
|
|
263
|
+
let linesRemoved = 0;
|
|
264
|
+
const filesModified = new Set;
|
|
265
|
+
const messageHours = [];
|
|
266
|
+
const userMessageTimestamps = [];
|
|
267
|
+
let usesMcp = false;
|
|
268
|
+
let usesWebSearch = false;
|
|
269
|
+
let usesWebFetch = false;
|
|
270
|
+
let lastAssistantTimestamp = null;
|
|
271
|
+
for (const msg of log.messages) {
|
|
272
|
+
const msgTimestamp = msg.timestamp;
|
|
273
|
+
if (msg.type === "assistant" && msg.message) {
|
|
274
|
+
if (msgTimestamp) {
|
|
275
|
+
lastAssistantTimestamp = msgTimestamp;
|
|
276
|
+
}
|
|
277
|
+
const usage = msg.message.usage;
|
|
278
|
+
if (usage) {
|
|
279
|
+
inputTokens += usage.input_tokens || 0;
|
|
280
|
+
outputTokens += usage.output_tokens || 0;
|
|
281
|
+
}
|
|
282
|
+
const content = msg.message.content;
|
|
283
|
+
if (Array.isArray(content)) {
|
|
284
|
+
for (const block of content) {
|
|
285
|
+
if (block.type === "tool_use" && "name" in block) {
|
|
286
|
+
const toolName = block.name;
|
|
287
|
+
toolCounts[toolName] = (toolCounts[toolName] || 0) + 1;
|
|
288
|
+
if (toolName === AGENT_TOOL_NAME || toolName === LEGACY_AGENT_TOOL_NAME)
|
|
289
|
+
usesTaskAgent = true;
|
|
290
|
+
if (toolName.startsWith("mcp__"))
|
|
291
|
+
usesMcp = true;
|
|
292
|
+
if (toolName === "WebSearch")
|
|
293
|
+
usesWebSearch = true;
|
|
294
|
+
if (toolName === "WebFetch")
|
|
295
|
+
usesWebFetch = true;
|
|
296
|
+
const input = block.input;
|
|
297
|
+
if (input) {
|
|
298
|
+
const filePath = input.file_path || "";
|
|
299
|
+
if (filePath) {
|
|
300
|
+
const lang = getLanguageFromPath(filePath);
|
|
301
|
+
if (lang) {
|
|
302
|
+
languages[lang] = (languages[lang] || 0) + 1;
|
|
303
|
+
}
|
|
304
|
+
if (toolName === "Edit" || toolName === "Write") {
|
|
305
|
+
filesModified.add(filePath);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (toolName === "Edit") {
|
|
309
|
+
const oldString = input.old_string || "";
|
|
310
|
+
const newString = input.new_string || "";
|
|
311
|
+
for (const change of diffLines(oldString, newString)) {
|
|
312
|
+
if (change.added)
|
|
313
|
+
linesAdded += change.count || 0;
|
|
314
|
+
if (change.removed)
|
|
315
|
+
linesRemoved += change.count || 0;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (toolName === "Write") {
|
|
319
|
+
const writeContent = input.content || "";
|
|
320
|
+
if (writeContent) {
|
|
321
|
+
linesAdded += countCharInString(writeContent, `
|
|
322
|
+
`) + 1;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const command = input.command || "";
|
|
326
|
+
if (command.includes("git commit"))
|
|
327
|
+
gitCommits++;
|
|
328
|
+
if (command.includes("git push"))
|
|
329
|
+
gitPushes++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (msg.type === "user" && msg.message) {
|
|
336
|
+
const content = msg.message.content;
|
|
337
|
+
let isHumanMessage = false;
|
|
338
|
+
if (typeof content === "string" && content.trim()) {
|
|
339
|
+
isHumanMessage = true;
|
|
340
|
+
} else if (Array.isArray(content)) {
|
|
341
|
+
for (const block of content) {
|
|
342
|
+
if (block.type === "text" && "text" in block) {
|
|
343
|
+
isHumanMessage = true;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (isHumanMessage) {
|
|
349
|
+
if (msgTimestamp) {
|
|
350
|
+
try {
|
|
351
|
+
const msgDate = new Date(msgTimestamp);
|
|
352
|
+
const hour = msgDate.getHours();
|
|
353
|
+
messageHours.push(hour);
|
|
354
|
+
userMessageTimestamps.push(msgTimestamp);
|
|
355
|
+
} catch {}
|
|
356
|
+
}
|
|
357
|
+
if (lastAssistantTimestamp && msgTimestamp) {
|
|
358
|
+
const assistantTime = new Date(lastAssistantTimestamp).getTime();
|
|
359
|
+
const userTime = new Date(msgTimestamp).getTime();
|
|
360
|
+
const responseTimeSec = (userTime - assistantTime) / 1000;
|
|
361
|
+
if (responseTimeSec > 2 && responseTimeSec < 3600) {
|
|
362
|
+
userResponseTimes.push(responseTimeSec);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (Array.isArray(content)) {
|
|
367
|
+
for (const block of content) {
|
|
368
|
+
if (block.type === "tool_result" && "content" in block) {
|
|
369
|
+
const isError = block.is_error;
|
|
370
|
+
if (isError) {
|
|
371
|
+
toolErrors++;
|
|
372
|
+
const resultContent = block.content;
|
|
373
|
+
let category = "Other";
|
|
374
|
+
if (typeof resultContent === "string") {
|
|
375
|
+
const lowerContent = resultContent.toLowerCase();
|
|
376
|
+
if (lowerContent.includes("exit code")) {
|
|
377
|
+
category = "Command Failed";
|
|
378
|
+
} else if (lowerContent.includes("rejected") || lowerContent.includes("doesn't want")) {
|
|
379
|
+
category = "User Rejected";
|
|
380
|
+
} else if (lowerContent.includes("string to replace not found") || lowerContent.includes("no changes")) {
|
|
381
|
+
category = "Edit Failed";
|
|
382
|
+
} else if (lowerContent.includes("modified since read")) {
|
|
383
|
+
category = "File Changed";
|
|
384
|
+
} else if (lowerContent.includes("exceeds maximum") || lowerContent.includes("too large")) {
|
|
385
|
+
category = "File Too Large";
|
|
386
|
+
} else if (lowerContent.includes("file not found") || lowerContent.includes("does not exist")) {
|
|
387
|
+
category = "File Not Found";
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
toolErrorCategories[category] = (toolErrorCategories[category] || 0) + 1;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (typeof content === "string") {
|
|
396
|
+
if (content.includes("[Request interrupted by user")) {
|
|
397
|
+
userInterruptions++;
|
|
398
|
+
}
|
|
399
|
+
} else if (Array.isArray(content)) {
|
|
400
|
+
for (const block of content) {
|
|
401
|
+
if (block.type === "text" && "text" in block && block.text.includes("[Request interrupted by user")) {
|
|
402
|
+
userInterruptions++;
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
toolCounts,
|
|
411
|
+
languages,
|
|
412
|
+
gitCommits,
|
|
413
|
+
gitPushes,
|
|
414
|
+
inputTokens,
|
|
415
|
+
outputTokens,
|
|
416
|
+
userInterruptions,
|
|
417
|
+
userResponseTimes,
|
|
418
|
+
toolErrors,
|
|
419
|
+
toolErrorCategories,
|
|
420
|
+
usesTaskAgent,
|
|
421
|
+
usesMcp,
|
|
422
|
+
usesWebSearch,
|
|
423
|
+
usesWebFetch,
|
|
424
|
+
linesAdded,
|
|
425
|
+
linesRemoved,
|
|
426
|
+
filesModified,
|
|
427
|
+
messageHours,
|
|
428
|
+
userMessageTimestamps
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function hasValidDates(log) {
|
|
432
|
+
return !Number.isNaN(log.created.getTime()) && !Number.isNaN(log.modified.getTime());
|
|
433
|
+
}
|
|
434
|
+
function logToSessionMeta(log) {
|
|
435
|
+
const stats = extractToolStats(log);
|
|
436
|
+
const sessionId = getSessionIdFromLog(log) || "unknown";
|
|
437
|
+
const startTime = log.created.toISOString();
|
|
438
|
+
const durationMinutes = Math.round((log.modified.getTime() - log.created.getTime()) / 1000 / 60);
|
|
439
|
+
let userMessageCount = 0;
|
|
440
|
+
let assistantMessageCount = 0;
|
|
441
|
+
for (const msg of log.messages) {
|
|
442
|
+
if (msg.type === "assistant")
|
|
443
|
+
assistantMessageCount++;
|
|
444
|
+
if (msg.type === "user" && msg.message) {
|
|
445
|
+
const content = msg.message.content;
|
|
446
|
+
let isHumanMessage = false;
|
|
447
|
+
if (typeof content === "string" && content.trim()) {
|
|
448
|
+
isHumanMessage = true;
|
|
449
|
+
} else if (Array.isArray(content)) {
|
|
450
|
+
for (const block of content) {
|
|
451
|
+
if (block.type === "text" && "text" in block) {
|
|
452
|
+
isHumanMessage = true;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (isHumanMessage) {
|
|
458
|
+
userMessageCount++;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
session_id: sessionId,
|
|
464
|
+
project_path: log.projectPath || "",
|
|
465
|
+
start_time: startTime,
|
|
466
|
+
duration_minutes: durationMinutes,
|
|
467
|
+
user_message_count: userMessageCount,
|
|
468
|
+
assistant_message_count: assistantMessageCount,
|
|
469
|
+
tool_counts: stats.toolCounts,
|
|
470
|
+
languages: stats.languages,
|
|
471
|
+
git_commits: stats.gitCommits,
|
|
472
|
+
git_pushes: stats.gitPushes,
|
|
473
|
+
input_tokens: stats.inputTokens,
|
|
474
|
+
output_tokens: stats.outputTokens,
|
|
475
|
+
first_prompt: log.firstPrompt || "",
|
|
476
|
+
summary: log.summary,
|
|
477
|
+
user_interruptions: stats.userInterruptions,
|
|
478
|
+
user_response_times: stats.userResponseTimes,
|
|
479
|
+
tool_errors: stats.toolErrors,
|
|
480
|
+
tool_error_categories: stats.toolErrorCategories,
|
|
481
|
+
uses_task_agent: stats.usesTaskAgent,
|
|
482
|
+
uses_mcp: stats.usesMcp,
|
|
483
|
+
uses_web_search: stats.usesWebSearch,
|
|
484
|
+
uses_web_fetch: stats.usesWebFetch,
|
|
485
|
+
lines_added: stats.linesAdded,
|
|
486
|
+
lines_removed: stats.linesRemoved,
|
|
487
|
+
files_modified: stats.filesModified.size,
|
|
488
|
+
message_hours: stats.messageHours,
|
|
489
|
+
user_message_timestamps: stats.userMessageTimestamps
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
export function deduplicateSessionBranches(entries) {
|
|
493
|
+
const bestBySession = new Map;
|
|
494
|
+
for (const entry of entries) {
|
|
495
|
+
const id = entry.meta.session_id;
|
|
496
|
+
const existing = bestBySession.get(id);
|
|
497
|
+
if (!existing || entry.meta.user_message_count > existing.meta.user_message_count || entry.meta.user_message_count === existing.meta.user_message_count && entry.meta.duration_minutes > existing.meta.duration_minutes) {
|
|
498
|
+
bestBySession.set(id, entry);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return [...bestBySession.values()];
|
|
502
|
+
}
|
|
503
|
+
function formatTranscriptForFacets(log) {
|
|
504
|
+
const lines = [];
|
|
505
|
+
const meta = logToSessionMeta(log);
|
|
506
|
+
lines.push(`Session: ${meta.session_id.slice(0, 8)}`);
|
|
507
|
+
lines.push(`Date: ${meta.start_time}`);
|
|
508
|
+
lines.push(`Project: ${meta.project_path}`);
|
|
509
|
+
lines.push(`Duration: ${meta.duration_minutes} min`);
|
|
510
|
+
lines.push("");
|
|
511
|
+
for (const msg of log.messages) {
|
|
512
|
+
if (msg.type === "user" && msg.message) {
|
|
513
|
+
const content = msg.message.content;
|
|
514
|
+
if (typeof content === "string") {
|
|
515
|
+
lines.push(`[User]: ${content.slice(0, 500)}`);
|
|
516
|
+
} else if (Array.isArray(content)) {
|
|
517
|
+
for (const block of content) {
|
|
518
|
+
if (block.type === "text" && "text" in block) {
|
|
519
|
+
lines.push(`[User]: ${block.text.slice(0, 500)}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
} else if (msg.type === "assistant" && msg.message) {
|
|
524
|
+
const content = msg.message.content;
|
|
525
|
+
if (Array.isArray(content)) {
|
|
526
|
+
for (const block of content) {
|
|
527
|
+
if (block.type === "text" && "text" in block) {
|
|
528
|
+
lines.push(`[Assistant]: ${block.text.slice(0, 300)}`);
|
|
529
|
+
} else if (block.type === "tool_use" && "name" in block) {
|
|
530
|
+
lines.push(`[Tool: ${block.name}]`);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return lines.join(`
|
|
537
|
+
`);
|
|
538
|
+
}
|
|
539
|
+
const SUMMARIZE_CHUNK_PROMPT = `Summarize this portion of a Claude Code session transcript. Focus on:
|
|
540
|
+
1. What the user asked for
|
|
541
|
+
2. What Claude did (tools used, files modified)
|
|
542
|
+
3. Any friction or issues
|
|
543
|
+
4. The outcome
|
|
544
|
+
|
|
545
|
+
Keep it concise - 3-5 sentences. Preserve specific details like file names, error messages, and user feedback.
|
|
546
|
+
|
|
547
|
+
TRANSCRIPT CHUNK:
|
|
548
|
+
`;
|
|
549
|
+
async function summarizeTranscriptChunk(chunk) {
|
|
550
|
+
try {
|
|
551
|
+
const result = await queryWithModel({
|
|
552
|
+
systemPrompt: asSystemPrompt([]),
|
|
553
|
+
userPrompt: SUMMARIZE_CHUNK_PROMPT + chunk,
|
|
554
|
+
signal: new AbortController().signal,
|
|
555
|
+
options: {
|
|
556
|
+
model: getAnalysisModel(),
|
|
557
|
+
querySource: "insights",
|
|
558
|
+
agents: [],
|
|
559
|
+
isNonInteractiveSession: true,
|
|
560
|
+
hasAppendSystemPrompt: false,
|
|
561
|
+
mcpTools: [],
|
|
562
|
+
maxOutputTokensOverride: 500
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
const text = extractTextContent(result.message.content);
|
|
566
|
+
return text || chunk.slice(0, 2000);
|
|
567
|
+
} catch {
|
|
568
|
+
return chunk.slice(0, 2000);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
async function formatTranscriptWithSummarization(log) {
|
|
572
|
+
const fullTranscript = formatTranscriptForFacets(log);
|
|
573
|
+
if (fullTranscript.length <= 30000) {
|
|
574
|
+
return fullTranscript;
|
|
575
|
+
}
|
|
576
|
+
const CHUNK_SIZE = 25000;
|
|
577
|
+
const chunks = [];
|
|
578
|
+
for (let i = 0;i < fullTranscript.length; i += CHUNK_SIZE) {
|
|
579
|
+
chunks.push(fullTranscript.slice(i, i + CHUNK_SIZE));
|
|
580
|
+
}
|
|
581
|
+
const summaries = await Promise.all(chunks.map(summarizeTranscriptChunk));
|
|
582
|
+
const meta = logToSessionMeta(log);
|
|
583
|
+
const header = [
|
|
584
|
+
`Session: ${meta.session_id.slice(0, 8)}`,
|
|
585
|
+
`Date: ${meta.start_time}`,
|
|
586
|
+
`Project: ${meta.project_path}`,
|
|
587
|
+
`Duration: ${meta.duration_minutes} min`,
|
|
588
|
+
`[Long session - ${chunks.length} parts summarized]`,
|
|
589
|
+
""
|
|
590
|
+
].join(`
|
|
591
|
+
`);
|
|
592
|
+
return header + summaries.join(`
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
`);
|
|
597
|
+
}
|
|
598
|
+
async function loadCachedFacets(sessionId) {
|
|
599
|
+
const facetPath = join(getFacetsDir(), `${sessionId}.json`);
|
|
600
|
+
try {
|
|
601
|
+
const content = await readFile(facetPath, { encoding: "utf-8" });
|
|
602
|
+
const parsed = jsonParse(content);
|
|
603
|
+
if (!isValidSessionFacets(parsed)) {
|
|
604
|
+
try {
|
|
605
|
+
await unlink(facetPath);
|
|
606
|
+
} catch {}
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
return parsed;
|
|
610
|
+
} catch {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
async function saveFacets(facets) {
|
|
615
|
+
try {
|
|
616
|
+
await mkdir(getFacetsDir(), { recursive: true });
|
|
617
|
+
} catch {}
|
|
618
|
+
const facetPath = join(getFacetsDir(), `${facets.session_id}.json`);
|
|
619
|
+
await writeFile(facetPath, jsonStringify(facets, null, 2), {
|
|
620
|
+
encoding: "utf-8",
|
|
621
|
+
mode: 384
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
async function loadCachedSessionMeta(sessionId) {
|
|
625
|
+
const metaPath = join(getSessionMetaDir(), `${sessionId}.json`);
|
|
626
|
+
try {
|
|
627
|
+
const content = await readFile(metaPath, { encoding: "utf-8" });
|
|
628
|
+
return jsonParse(content);
|
|
629
|
+
} catch {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
async function saveSessionMeta(meta) {
|
|
634
|
+
try {
|
|
635
|
+
await mkdir(getSessionMetaDir(), { recursive: true });
|
|
636
|
+
} catch {}
|
|
637
|
+
const metaPath = join(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
638
|
+
await writeFile(metaPath, jsonStringify(meta, null, 2), {
|
|
639
|
+
encoding: "utf-8",
|
|
640
|
+
mode: 384
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
async function extractFacetsFromAPI(log, sessionId) {
|
|
644
|
+
try {
|
|
645
|
+
const transcript = await formatTranscriptWithSummarization(log);
|
|
646
|
+
const jsonPrompt = `${FACET_EXTRACTION_PROMPT}${transcript}
|
|
647
|
+
|
|
648
|
+
RESPOND WITH ONLY A VALID JSON OBJECT matching this schema:
|
|
649
|
+
{
|
|
650
|
+
"underlying_goal": "What the user fundamentally wanted to achieve",
|
|
651
|
+
"goal_categories": {"category_name": count, ...},
|
|
652
|
+
"outcome": "fully_achieved|mostly_achieved|partially_achieved|not_achieved|unclear_from_transcript",
|
|
653
|
+
"user_satisfaction_counts": {"level": count, ...},
|
|
654
|
+
"claude_helpfulness": "unhelpful|slightly_helpful|moderately_helpful|very_helpful|essential",
|
|
655
|
+
"session_type": "single_task|multi_task|iterative_refinement|exploration|quick_question",
|
|
656
|
+
"friction_counts": {"friction_type": count, ...},
|
|
657
|
+
"friction_detail": "One sentence describing friction or empty",
|
|
658
|
+
"primary_success": "none|fast_accurate_search|correct_code_edits|good_explanations|proactive_help|multi_file_changes|good_debugging",
|
|
659
|
+
"brief_summary": "One sentence: what user wanted and whether they got it"
|
|
660
|
+
}`;
|
|
661
|
+
const result = await queryWithModel({
|
|
662
|
+
systemPrompt: asSystemPrompt([]),
|
|
663
|
+
userPrompt: jsonPrompt,
|
|
664
|
+
signal: new AbortController().signal,
|
|
665
|
+
options: {
|
|
666
|
+
model: getAnalysisModel(),
|
|
667
|
+
querySource: "insights",
|
|
668
|
+
agents: [],
|
|
669
|
+
isNonInteractiveSession: true,
|
|
670
|
+
hasAppendSystemPrompt: false,
|
|
671
|
+
mcpTools: [],
|
|
672
|
+
maxOutputTokensOverride: 4096
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
const text = extractTextContent(result.message.content);
|
|
676
|
+
const jsonMatch = text.match(/\{[\s\S]*\}/);
|
|
677
|
+
if (!jsonMatch)
|
|
678
|
+
return null;
|
|
679
|
+
const parsed = jsonParse(jsonMatch[0]);
|
|
680
|
+
if (!isValidSessionFacets(parsed))
|
|
681
|
+
return null;
|
|
682
|
+
const facets = { ...parsed, session_id: sessionId };
|
|
683
|
+
return facets;
|
|
684
|
+
} catch (err) {
|
|
685
|
+
logError(new Error(`Facet extraction failed: ${toError(err).message}`));
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
export function detectMultiClauding(sessions) {
|
|
690
|
+
const OVERLAP_WINDOW_MS = 30 * 60000;
|
|
691
|
+
const allSessionMessages = [];
|
|
692
|
+
for (const session of sessions) {
|
|
693
|
+
for (const timestamp of session.user_message_timestamps) {
|
|
694
|
+
try {
|
|
695
|
+
const ts = new Date(timestamp).getTime();
|
|
696
|
+
allSessionMessages.push({ ts, sessionId: session.session_id });
|
|
697
|
+
} catch {}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
allSessionMessages.sort((a, b) => a.ts - b.ts);
|
|
701
|
+
const multiClaudeSessionPairs = new Set;
|
|
702
|
+
const messagesDuringMulticlaude = new Set;
|
|
703
|
+
let windowStart = 0;
|
|
704
|
+
const sessionLastIndex = new Map;
|
|
705
|
+
for (let i = 0;i < allSessionMessages.length; i++) {
|
|
706
|
+
const msg = allSessionMessages[i];
|
|
707
|
+
while (windowStart < i && msg.ts - allSessionMessages[windowStart].ts > OVERLAP_WINDOW_MS) {
|
|
708
|
+
const expiring = allSessionMessages[windowStart];
|
|
709
|
+
if (sessionLastIndex.get(expiring.sessionId) === windowStart) {
|
|
710
|
+
sessionLastIndex.delete(expiring.sessionId);
|
|
711
|
+
}
|
|
712
|
+
windowStart++;
|
|
713
|
+
}
|
|
714
|
+
const prevIndex = sessionLastIndex.get(msg.sessionId);
|
|
715
|
+
if (prevIndex !== undefined) {
|
|
716
|
+
for (let j = prevIndex + 1;j < i; j++) {
|
|
717
|
+
const between = allSessionMessages[j];
|
|
718
|
+
if (between.sessionId !== msg.sessionId) {
|
|
719
|
+
const pair = [msg.sessionId, between.sessionId].sort().join(":");
|
|
720
|
+
multiClaudeSessionPairs.add(pair);
|
|
721
|
+
messagesDuringMulticlaude.add(`${allSessionMessages[prevIndex].ts}:${msg.sessionId}`);
|
|
722
|
+
messagesDuringMulticlaude.add(`${between.ts}:${between.sessionId}`);
|
|
723
|
+
messagesDuringMulticlaude.add(`${msg.ts}:${msg.sessionId}`);
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
sessionLastIndex.set(msg.sessionId, i);
|
|
729
|
+
}
|
|
730
|
+
const sessionsWithOverlaps = new Set;
|
|
731
|
+
for (const pair of multiClaudeSessionPairs) {
|
|
732
|
+
const [s1, s2] = pair.split(":");
|
|
733
|
+
if (s1)
|
|
734
|
+
sessionsWithOverlaps.add(s1);
|
|
735
|
+
if (s2)
|
|
736
|
+
sessionsWithOverlaps.add(s2);
|
|
737
|
+
}
|
|
738
|
+
return {
|
|
739
|
+
overlap_events: multiClaudeSessionPairs.size,
|
|
740
|
+
sessions_involved: sessionsWithOverlaps.size,
|
|
741
|
+
user_messages_during: messagesDuringMulticlaude.size
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
function aggregateData(sessions, facets) {
|
|
745
|
+
const result = {
|
|
746
|
+
total_sessions: sessions.length,
|
|
747
|
+
sessions_with_facets: facets.size,
|
|
748
|
+
date_range: { start: "", end: "" },
|
|
749
|
+
total_messages: 0,
|
|
750
|
+
total_duration_hours: 0,
|
|
751
|
+
total_input_tokens: 0,
|
|
752
|
+
total_output_tokens: 0,
|
|
753
|
+
tool_counts: {},
|
|
754
|
+
languages: {},
|
|
755
|
+
git_commits: 0,
|
|
756
|
+
git_pushes: 0,
|
|
757
|
+
projects: {},
|
|
758
|
+
goal_categories: {},
|
|
759
|
+
outcomes: {},
|
|
760
|
+
satisfaction: {},
|
|
761
|
+
helpfulness: {},
|
|
762
|
+
session_types: {},
|
|
763
|
+
friction: {},
|
|
764
|
+
success: {},
|
|
765
|
+
session_summaries: [],
|
|
766
|
+
total_interruptions: 0,
|
|
767
|
+
total_tool_errors: 0,
|
|
768
|
+
tool_error_categories: {},
|
|
769
|
+
user_response_times: [],
|
|
770
|
+
median_response_time: 0,
|
|
771
|
+
avg_response_time: 0,
|
|
772
|
+
sessions_using_task_agent: 0,
|
|
773
|
+
sessions_using_mcp: 0,
|
|
774
|
+
sessions_using_web_search: 0,
|
|
775
|
+
sessions_using_web_fetch: 0,
|
|
776
|
+
total_lines_added: 0,
|
|
777
|
+
total_lines_removed: 0,
|
|
778
|
+
total_files_modified: 0,
|
|
779
|
+
days_active: 0,
|
|
780
|
+
messages_per_day: 0,
|
|
781
|
+
message_hours: [],
|
|
782
|
+
multi_clauding: {
|
|
783
|
+
overlap_events: 0,
|
|
784
|
+
sessions_involved: 0,
|
|
785
|
+
user_messages_during: 0
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
const dates = [];
|
|
789
|
+
const allResponseTimes = [];
|
|
790
|
+
const allMessageHours = [];
|
|
791
|
+
for (const session of sessions) {
|
|
792
|
+
dates.push(session.start_time);
|
|
793
|
+
result.total_messages += session.user_message_count;
|
|
794
|
+
result.total_duration_hours += session.duration_minutes / 60;
|
|
795
|
+
result.total_input_tokens += session.input_tokens;
|
|
796
|
+
result.total_output_tokens += session.output_tokens;
|
|
797
|
+
result.git_commits += session.git_commits;
|
|
798
|
+
result.git_pushes += session.git_pushes;
|
|
799
|
+
result.total_interruptions += session.user_interruptions;
|
|
800
|
+
result.total_tool_errors += session.tool_errors;
|
|
801
|
+
for (const [cat, count] of Object.entries(session.tool_error_categories)) {
|
|
802
|
+
result.tool_error_categories[cat] = (result.tool_error_categories[cat] || 0) + count;
|
|
803
|
+
}
|
|
804
|
+
allResponseTimes.push(...session.user_response_times);
|
|
805
|
+
if (session.uses_task_agent)
|
|
806
|
+
result.sessions_using_task_agent++;
|
|
807
|
+
if (session.uses_mcp)
|
|
808
|
+
result.sessions_using_mcp++;
|
|
809
|
+
if (session.uses_web_search)
|
|
810
|
+
result.sessions_using_web_search++;
|
|
811
|
+
if (session.uses_web_fetch)
|
|
812
|
+
result.sessions_using_web_fetch++;
|
|
813
|
+
result.total_lines_added += session.lines_added;
|
|
814
|
+
result.total_lines_removed += session.lines_removed;
|
|
815
|
+
result.total_files_modified += session.files_modified;
|
|
816
|
+
allMessageHours.push(...session.message_hours);
|
|
817
|
+
for (const [tool, count] of Object.entries(session.tool_counts)) {
|
|
818
|
+
result.tool_counts[tool] = (result.tool_counts[tool] || 0) + count;
|
|
819
|
+
}
|
|
820
|
+
for (const [lang, count] of Object.entries(session.languages)) {
|
|
821
|
+
result.languages[lang] = (result.languages[lang] || 0) + count;
|
|
822
|
+
}
|
|
823
|
+
if (session.project_path) {
|
|
824
|
+
result.projects[session.project_path] = (result.projects[session.project_path] || 0) + 1;
|
|
825
|
+
}
|
|
826
|
+
const sessionFacets = facets.get(session.session_id);
|
|
827
|
+
if (sessionFacets) {
|
|
828
|
+
for (const [cat, count] of safeEntries(sessionFacets.goal_categories)) {
|
|
829
|
+
if (count > 0) {
|
|
830
|
+
result.goal_categories[cat] = (result.goal_categories[cat] || 0) + count;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
result.outcomes[sessionFacets.outcome] = (result.outcomes[sessionFacets.outcome] || 0) + 1;
|
|
834
|
+
for (const [level, count] of safeEntries(sessionFacets.user_satisfaction_counts)) {
|
|
835
|
+
if (count > 0) {
|
|
836
|
+
result.satisfaction[level] = (result.satisfaction[level] || 0) + count;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
result.helpfulness[sessionFacets.claude_helpfulness] = (result.helpfulness[sessionFacets.claude_helpfulness] || 0) + 1;
|
|
840
|
+
result.session_types[sessionFacets.session_type] = (result.session_types[sessionFacets.session_type] || 0) + 1;
|
|
841
|
+
for (const [type, count] of safeEntries(sessionFacets.friction_counts)) {
|
|
842
|
+
if (count > 0) {
|
|
843
|
+
result.friction[type] = (result.friction[type] || 0) + count;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
if (sessionFacets.primary_success !== "none") {
|
|
847
|
+
result.success[sessionFacets.primary_success] = (result.success[sessionFacets.primary_success] || 0) + 1;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (result.session_summaries.length < 50) {
|
|
851
|
+
result.session_summaries.push({
|
|
852
|
+
id: session.session_id.slice(0, 8),
|
|
853
|
+
date: session.start_time.split("T")[0] || "",
|
|
854
|
+
summary: session.summary || session.first_prompt.slice(0, 100),
|
|
855
|
+
goal: sessionFacets?.underlying_goal
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
dates.sort();
|
|
860
|
+
result.date_range.start = dates[0]?.split("T")[0] || "";
|
|
861
|
+
result.date_range.end = dates[dates.length - 1]?.split("T")[0] || "";
|
|
862
|
+
result.user_response_times = allResponseTimes;
|
|
863
|
+
if (allResponseTimes.length > 0) {
|
|
864
|
+
const sorted = [...allResponseTimes].sort((a, b) => a - b);
|
|
865
|
+
result.median_response_time = sorted[Math.floor(sorted.length / 2)] || 0;
|
|
866
|
+
result.avg_response_time = allResponseTimes.reduce((a, b) => a + b, 0) / allResponseTimes.length;
|
|
867
|
+
}
|
|
868
|
+
const uniqueDays = new Set(dates.map((d) => d.split("T")[0]));
|
|
869
|
+
result.days_active = uniqueDays.size;
|
|
870
|
+
result.messages_per_day = result.days_active > 0 ? Math.round(result.total_messages / result.days_active * 10) / 10 : 0;
|
|
871
|
+
result.message_hours = allMessageHours;
|
|
872
|
+
result.multi_clauding = detectMultiClauding(sessions);
|
|
873
|
+
return result;
|
|
874
|
+
}
|
|
875
|
+
const INSIGHT_SECTIONS = [
|
|
876
|
+
{
|
|
877
|
+
name: "project_areas",
|
|
878
|
+
prompt: `Analyze this Claude Code usage data and identify project areas.
|
|
879
|
+
|
|
880
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
881
|
+
{
|
|
882
|
+
"areas": [
|
|
883
|
+
{"name": "Area name", "session_count": N, "description": "2-3 sentences about what was worked on and how Claude Code was used."}
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
Include 4-5 areas. Skip internal CC operations.`,
|
|
888
|
+
maxTokens: 8192
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: "interaction_style",
|
|
892
|
+
prompt: `Analyze this Claude Code usage data and describe the user's interaction style.
|
|
893
|
+
|
|
894
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
895
|
+
{
|
|
896
|
+
"narrative": "2-3 paragraphs analyzing HOW the user interacts with Claude Code. Use second person 'you'. Describe patterns: iterate quickly vs detailed upfront specs? Interrupt often or let Claude run? Include specific examples. Use **bold** for key insights.",
|
|
897
|
+
"key_pattern": "One sentence summary of most distinctive interaction style"
|
|
898
|
+
}`,
|
|
899
|
+
maxTokens: 8192
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
name: "what_works",
|
|
903
|
+
prompt: `Analyze this Claude Code usage data and identify what's working well for this user. Use second person ("you").
|
|
904
|
+
|
|
905
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
906
|
+
{
|
|
907
|
+
"intro": "1 sentence of context",
|
|
908
|
+
"impressive_workflows": [
|
|
909
|
+
{"title": "Short title (3-6 words)", "description": "2-3 sentences describing the impressive workflow or approach. Use 'you' not 'the user'."}
|
|
910
|
+
]
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
Include 3 impressive workflows.`,
|
|
914
|
+
maxTokens: 8192
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: "friction_analysis",
|
|
918
|
+
prompt: `Analyze this Claude Code usage data and identify friction points for this user. Use second person ("you").
|
|
919
|
+
|
|
920
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
921
|
+
{
|
|
922
|
+
"intro": "1 sentence summarizing friction patterns",
|
|
923
|
+
"categories": [
|
|
924
|
+
{"category": "Concrete category name", "description": "1-2 sentences explaining this category and what could be done differently. Use 'you' not 'the user'.", "examples": ["Specific example with consequence", "Another example"]}
|
|
925
|
+
]
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
Include 3 friction categories with 2 examples each.`,
|
|
929
|
+
maxTokens: 8192
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: "suggestions",
|
|
933
|
+
prompt: `Analyze this Claude Code usage data and suggest improvements.
|
|
934
|
+
|
|
935
|
+
## CC FEATURES REFERENCE (pick from these for features_to_try):
|
|
936
|
+
1. **MCP Servers**: Connect Claude to external tools, databases, and APIs via Model Context Protocol.
|
|
937
|
+
- How to use: Run \`claude mcp add <server-name> -- <command>\`
|
|
938
|
+
- Good for: database queries, Slack integration, GitHub issue lookup, connecting to internal APIs
|
|
939
|
+
|
|
940
|
+
2. **Custom Skills**: Reusable prompts you define as markdown files that run with a single /command.
|
|
941
|
+
- How to use: Create \`.claude/skills/commit/SKILL.md\` with instructions. Then type \`/commit\` to run it.
|
|
942
|
+
- Good for: repetitive workflows - /commit, /review, /test, /deploy, /pr, or complex multi-step workflows
|
|
943
|
+
|
|
944
|
+
3. **Hooks**: Shell commands that auto-run at specific lifecycle events.
|
|
945
|
+
- How to use: Add to \`.claude/settings.json\` under "hooks" key.
|
|
946
|
+
- Good for: auto-formatting code, running type checks, enforcing conventions
|
|
947
|
+
|
|
948
|
+
4. **Headless Mode**: Run Claude non-interactively from scripts and CI/CD.
|
|
949
|
+
- How to use: \`claude -p "fix lint errors" --allowedTools "Edit,Read,Bash"\`
|
|
950
|
+
- Good for: CI/CD integration, batch code fixes, automated reviews
|
|
951
|
+
|
|
952
|
+
5. **Task Agents**: Claude spawns focused sub-agents for complex exploration or parallel work.
|
|
953
|
+
- How to use: Claude auto-invokes when helpful, or ask "use an agent to explore X"
|
|
954
|
+
- Good for: codebase exploration, understanding complex systems
|
|
955
|
+
|
|
956
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
957
|
+
{
|
|
958
|
+
"claude_md_additions": [
|
|
959
|
+
{"addition": "A specific line or block to add to CLAUDE.md based on workflow patterns. E.g., 'Always run tests after modifying auth-related files'", "why": "1 sentence explaining why this would help based on actual sessions", "prompt_scaffold": "Instructions for where to add this in CLAUDE.md. E.g., 'Add under ## Testing section'"}
|
|
960
|
+
],
|
|
961
|
+
"features_to_try": [
|
|
962
|
+
{"feature": "Feature name from CC FEATURES REFERENCE above", "one_liner": "What it does", "why_for_you": "Why this would help YOU based on your sessions", "example_code": "Actual command or config to copy"}
|
|
963
|
+
],
|
|
964
|
+
"usage_patterns": [
|
|
965
|
+
{"title": "Short title", "suggestion": "1-2 sentence summary", "detail": "3-4 sentences explaining how this applies to YOUR work", "copyable_prompt": "A specific prompt to copy and try"}
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
IMPORTANT for claude_md_additions: PRIORITIZE instructions that appear MULTIPLE TIMES in the user data. If user told Claude the same thing in 2+ sessions (e.g., 'always run tests', 'use TypeScript'), that's a PRIME candidate - they shouldn't have to repeat themselves.
|
|
970
|
+
|
|
971
|
+
IMPORTANT for features_to_try: Pick 2-3 from the CC FEATURES REFERENCE above. Include 2-3 items for each category.`,
|
|
972
|
+
maxTokens: 8192
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
name: "on_the_horizon",
|
|
976
|
+
prompt: `Analyze this Claude Code usage data and identify future opportunities.
|
|
977
|
+
|
|
978
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
979
|
+
{
|
|
980
|
+
"intro": "1 sentence about evolving AI-assisted development",
|
|
981
|
+
"opportunities": [
|
|
982
|
+
{"title": "Short title (4-8 words)", "whats_possible": "2-3 ambitious sentences about autonomous workflows", "how_to_try": "1-2 sentences mentioning relevant tooling", "copyable_prompt": "Detailed prompt to try"}
|
|
983
|
+
]
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
Include 3 opportunities. Think BIG - autonomous workflows, parallel agents, iterating against tests.`,
|
|
987
|
+
maxTokens: 8192
|
|
988
|
+
},
|
|
989
|
+
...process.env.USER_TYPE === "ant" ? [
|
|
990
|
+
{
|
|
991
|
+
name: "cc_team_improvements",
|
|
992
|
+
prompt: `Analyze this Claude Code usage data and suggest product improvements for the CC team.
|
|
993
|
+
|
|
994
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
995
|
+
{
|
|
996
|
+
"improvements": [
|
|
997
|
+
{"title": "Product/tooling improvement", "detail": "3-4 sentences describing the improvement", "evidence": "3-4 sentences with specific session examples"}
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
Include 2-3 improvements based on friction patterns observed.`,
|
|
1002
|
+
maxTokens: 8192
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
name: "model_behavior_improvements",
|
|
1006
|
+
prompt: `Analyze this Claude Code usage data and suggest model behavior improvements.
|
|
1007
|
+
|
|
1008
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
1009
|
+
{
|
|
1010
|
+
"improvements": [
|
|
1011
|
+
{"title": "Model behavior change", "detail": "3-4 sentences describing what the model should do differently", "evidence": "3-4 sentences with specific examples"}
|
|
1012
|
+
]
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
Include 2-3 improvements based on friction patterns observed.`,
|
|
1016
|
+
maxTokens: 8192
|
|
1017
|
+
}
|
|
1018
|
+
] : [],
|
|
1019
|
+
{
|
|
1020
|
+
name: "fun_ending",
|
|
1021
|
+
prompt: `Analyze this Claude Code usage data and find a memorable moment.
|
|
1022
|
+
|
|
1023
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
1024
|
+
{
|
|
1025
|
+
"headline": "A memorable QUALITATIVE moment from the transcripts - not a statistic. Something human, funny, or surprising.",
|
|
1026
|
+
"detail": "Brief context about when/where this happened"
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
Find something genuinely interesting or amusing from the session summaries.`,
|
|
1030
|
+
maxTokens: 8192
|
|
1031
|
+
}
|
|
1032
|
+
];
|
|
1033
|
+
async function generateSectionInsight(section, dataContext) {
|
|
1034
|
+
try {
|
|
1035
|
+
const result = await queryWithModel({
|
|
1036
|
+
systemPrompt: asSystemPrompt([]),
|
|
1037
|
+
userPrompt: section.prompt + `
|
|
1038
|
+
|
|
1039
|
+
DATA:
|
|
1040
|
+
` + dataContext,
|
|
1041
|
+
signal: new AbortController().signal,
|
|
1042
|
+
options: {
|
|
1043
|
+
model: getInsightsModel(),
|
|
1044
|
+
querySource: "insights",
|
|
1045
|
+
agents: [],
|
|
1046
|
+
isNonInteractiveSession: true,
|
|
1047
|
+
hasAppendSystemPrompt: false,
|
|
1048
|
+
mcpTools: [],
|
|
1049
|
+
maxOutputTokensOverride: section.maxTokens
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
const text = extractTextContent(result.message.content);
|
|
1053
|
+
if (text) {
|
|
1054
|
+
const jsonMatch = text.match(/\{[\s\S]*\}/);
|
|
1055
|
+
if (jsonMatch) {
|
|
1056
|
+
try {
|
|
1057
|
+
return { name: section.name, result: jsonParse(jsonMatch[0]) };
|
|
1058
|
+
} catch {
|
|
1059
|
+
return { name: section.name, result: null };
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
return { name: section.name, result: null };
|
|
1064
|
+
} catch (err) {
|
|
1065
|
+
logError(new Error(`${section.name} failed: ${toError(err).message}`));
|
|
1066
|
+
return { name: section.name, result: null };
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
async function generateParallelInsights(data, facets) {
|
|
1070
|
+
const facetSummaries = Array.from(facets.values()).slice(0, 50).map((f) => `- ${f.brief_summary} (${f.outcome}, ${f.claude_helpfulness})`).join(`
|
|
1071
|
+
`);
|
|
1072
|
+
const frictionDetails = Array.from(facets.values()).filter((f) => f.friction_detail).slice(0, 20).map((f) => `- ${f.friction_detail}`).join(`
|
|
1073
|
+
`);
|
|
1074
|
+
const userInstructions = Array.from(facets.values()).flatMap((f) => f.user_instructions_to_claude || []).slice(0, 15).map((i) => `- ${i}`).join(`
|
|
1075
|
+
`);
|
|
1076
|
+
const dataContext = jsonStringify({
|
|
1077
|
+
sessions: data.total_sessions,
|
|
1078
|
+
analyzed: data.sessions_with_facets,
|
|
1079
|
+
date_range: data.date_range,
|
|
1080
|
+
messages: data.total_messages,
|
|
1081
|
+
hours: Math.round(data.total_duration_hours),
|
|
1082
|
+
commits: data.git_commits,
|
|
1083
|
+
top_tools: Object.entries(data.tool_counts).sort((a, b) => b[1] - a[1]).slice(0, 8),
|
|
1084
|
+
top_goals: Object.entries(data.goal_categories).sort((a, b) => b[1] - a[1]).slice(0, 8),
|
|
1085
|
+
outcomes: data.outcomes,
|
|
1086
|
+
satisfaction: data.satisfaction,
|
|
1087
|
+
friction: data.friction,
|
|
1088
|
+
success: data.success,
|
|
1089
|
+
languages: data.languages
|
|
1090
|
+
}, null, 2);
|
|
1091
|
+
const fullContext = dataContext + `
|
|
1092
|
+
|
|
1093
|
+
SESSION SUMMARIES:
|
|
1094
|
+
` + facetSummaries + `
|
|
1095
|
+
|
|
1096
|
+
FRICTION DETAILS:
|
|
1097
|
+
` + frictionDetails + `
|
|
1098
|
+
|
|
1099
|
+
USER INSTRUCTIONS TO CLAUDE:
|
|
1100
|
+
` + (userInstructions || "None captured");
|
|
1101
|
+
const results = await Promise.all(INSIGHT_SECTIONS.map((section) => generateSectionInsight(section, fullContext)));
|
|
1102
|
+
const insights = {};
|
|
1103
|
+
for (const { name, result } of results) {
|
|
1104
|
+
if (result) {
|
|
1105
|
+
insights[name] = result;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
const projectAreasText = insights.project_areas?.areas?.map((a) => `- ${a.name}: ${a.description}`).join(`
|
|
1109
|
+
`) || "";
|
|
1110
|
+
const bigWinsText = insights.what_works?.impressive_workflows?.map((w) => `- ${w.title}: ${w.description}`).join(`
|
|
1111
|
+
`) || "";
|
|
1112
|
+
const frictionText = insights.friction_analysis?.categories?.map((c) => `- ${c.category}: ${c.description}`).join(`
|
|
1113
|
+
`) || "";
|
|
1114
|
+
const featuresText = insights.suggestions?.features_to_try?.map((f) => `- ${f.feature}: ${f.one_liner}`).join(`
|
|
1115
|
+
`) || "";
|
|
1116
|
+
const patternsText = insights.suggestions?.usage_patterns?.map((p) => `- ${p.title}: ${p.suggestion}`).join(`
|
|
1117
|
+
`) || "";
|
|
1118
|
+
const horizonText = insights.on_the_horizon?.opportunities?.map((o) => `- ${o.title}: ${o.whats_possible}`).join(`
|
|
1119
|
+
`) || "";
|
|
1120
|
+
const atAGlancePrompt = `You're writing an "At a Glance" summary for a Claude Code usage insights report for Claude Code users. The goal is to help them understand their usage and improve how they can use Claude better, especially as models improve.
|
|
1121
|
+
|
|
1122
|
+
Use this 4-part structure:
|
|
1123
|
+
|
|
1124
|
+
1. **What's working** - What is the user's unique style of interacting with Claude and what are some impactful things they've done? You can include one or two details, but keep it high level since things might not be fresh in the user's memory. Don't be fluffy or overly complimentary. Also, don't focus on the tool calls they use.
|
|
1125
|
+
|
|
1126
|
+
2. **What's hindering you** - Split into (a) Claude's fault (misunderstandings, wrong approaches, bugs) and (b) user-side friction (not providing enough context, environment issues -- ideally more general than just one project). Be honest but constructive.
|
|
1127
|
+
|
|
1128
|
+
3. **Quick wins to try** - Specific Claude Code features they could try from the examples below, or a workflow technique if you think it's really compelling. (Avoid stuff like "Ask Claude to confirm before taking actions" or "Type out more context up front" which are less compelling.)
|
|
1129
|
+
|
|
1130
|
+
4. **Ambitious workflows for better models** - As we move to much more capable models over the next 3-6 months, what should they prepare for? What workflows that seem impossible now will become possible? Draw from the appropriate section below.
|
|
1131
|
+
|
|
1132
|
+
Keep each section to 2-3 not-too-long sentences. Don't overwhelm the user. Don't mention specific numerical stats or underlined_categories from the session data below. Use a coaching tone.
|
|
1133
|
+
|
|
1134
|
+
RESPOND WITH ONLY A VALID JSON OBJECT:
|
|
1135
|
+
{
|
|
1136
|
+
"whats_working": "(refer to instructions above)",
|
|
1137
|
+
"whats_hindering": "(refer to instructions above)",
|
|
1138
|
+
"quick_wins": "(refer to instructions above)",
|
|
1139
|
+
"ambitious_workflows": "(refer to instructions above)"
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
SESSION DATA:
|
|
1143
|
+
${fullContext}
|
|
1144
|
+
|
|
1145
|
+
## Project Areas (what user works on)
|
|
1146
|
+
${projectAreasText}
|
|
1147
|
+
|
|
1148
|
+
## Big Wins (impressive accomplishments)
|
|
1149
|
+
${bigWinsText}
|
|
1150
|
+
|
|
1151
|
+
## Friction Categories (where things go wrong)
|
|
1152
|
+
${frictionText}
|
|
1153
|
+
|
|
1154
|
+
## Features to Try
|
|
1155
|
+
${featuresText}
|
|
1156
|
+
|
|
1157
|
+
## Usage Patterns to Adopt
|
|
1158
|
+
${patternsText}
|
|
1159
|
+
|
|
1160
|
+
## On the Horizon (ambitious workflows for better models)
|
|
1161
|
+
${horizonText}`;
|
|
1162
|
+
const atAGlanceSection = {
|
|
1163
|
+
name: "at_a_glance",
|
|
1164
|
+
prompt: atAGlancePrompt,
|
|
1165
|
+
maxTokens: 8192
|
|
1166
|
+
};
|
|
1167
|
+
const atAGlanceResult = await generateSectionInsight(atAGlanceSection, "");
|
|
1168
|
+
if (atAGlanceResult.result) {
|
|
1169
|
+
insights.at_a_glance = atAGlanceResult.result;
|
|
1170
|
+
}
|
|
1171
|
+
return insights;
|
|
1172
|
+
}
|
|
1173
|
+
function escapeHtmlWithBold(text) {
|
|
1174
|
+
const escaped = escapeHtml(text);
|
|
1175
|
+
return escaped.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
|
|
1176
|
+
}
|
|
1177
|
+
const SATISFACTION_ORDER = [
|
|
1178
|
+
"frustrated",
|
|
1179
|
+
"dissatisfied",
|
|
1180
|
+
"likely_satisfied",
|
|
1181
|
+
"satisfied",
|
|
1182
|
+
"happy",
|
|
1183
|
+
"unsure"
|
|
1184
|
+
];
|
|
1185
|
+
const OUTCOME_ORDER = [
|
|
1186
|
+
"not_achieved",
|
|
1187
|
+
"partially_achieved",
|
|
1188
|
+
"mostly_achieved",
|
|
1189
|
+
"fully_achieved",
|
|
1190
|
+
"unclear_from_transcript"
|
|
1191
|
+
];
|
|
1192
|
+
function generateBarChart(data, color, maxItems = 6, fixedOrder) {
|
|
1193
|
+
let entries;
|
|
1194
|
+
if (fixedOrder) {
|
|
1195
|
+
entries = fixedOrder.filter((key) => (key in data) && (data[key] ?? 0) > 0).map((key) => [key, data[key] ?? 0]);
|
|
1196
|
+
} else {
|
|
1197
|
+
entries = Object.entries(data).sort((a, b) => b[1] - a[1]).slice(0, maxItems);
|
|
1198
|
+
}
|
|
1199
|
+
if (entries.length === 0)
|
|
1200
|
+
return '<p class="empty">No data</p>';
|
|
1201
|
+
const maxVal = Math.max(...entries.map((e) => e[1]));
|
|
1202
|
+
return entries.map(([label, count]) => {
|
|
1203
|
+
const pct = count / maxVal * 100;
|
|
1204
|
+
const cleanLabel = LABEL_MAP[label] || label.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
1205
|
+
return `<div class="bar-row">
|
|
1206
|
+
<div class="bar-label">${escapeHtml(cleanLabel)}</div>
|
|
1207
|
+
<div class="bar-track"><div class="bar-fill" style="width:${pct}%;background:${color}"></div></div>
|
|
1208
|
+
<div class="bar-value">${count}</div>
|
|
1209
|
+
</div>`;
|
|
1210
|
+
}).join(`
|
|
1211
|
+
`);
|
|
1212
|
+
}
|
|
1213
|
+
function generateResponseTimeHistogram(times) {
|
|
1214
|
+
if (times.length === 0)
|
|
1215
|
+
return '<p class="empty">No response time data</p>';
|
|
1216
|
+
const buckets = {
|
|
1217
|
+
"2-10s": 0,
|
|
1218
|
+
"10-30s": 0,
|
|
1219
|
+
"30s-1m": 0,
|
|
1220
|
+
"1-2m": 0,
|
|
1221
|
+
"2-5m": 0,
|
|
1222
|
+
"5-15m": 0,
|
|
1223
|
+
">15m": 0
|
|
1224
|
+
};
|
|
1225
|
+
for (const t of times) {
|
|
1226
|
+
if (t < 10)
|
|
1227
|
+
buckets["2-10s"] = (buckets["2-10s"] ?? 0) + 1;
|
|
1228
|
+
else if (t < 30)
|
|
1229
|
+
buckets["10-30s"] = (buckets["10-30s"] ?? 0) + 1;
|
|
1230
|
+
else if (t < 60)
|
|
1231
|
+
buckets["30s-1m"] = (buckets["30s-1m"] ?? 0) + 1;
|
|
1232
|
+
else if (t < 120)
|
|
1233
|
+
buckets["1-2m"] = (buckets["1-2m"] ?? 0) + 1;
|
|
1234
|
+
else if (t < 300)
|
|
1235
|
+
buckets["2-5m"] = (buckets["2-5m"] ?? 0) + 1;
|
|
1236
|
+
else if (t < 900)
|
|
1237
|
+
buckets["5-15m"] = (buckets["5-15m"] ?? 0) + 1;
|
|
1238
|
+
else
|
|
1239
|
+
buckets[">15m"] = (buckets[">15m"] ?? 0) + 1;
|
|
1240
|
+
}
|
|
1241
|
+
const maxVal = Math.max(...Object.values(buckets));
|
|
1242
|
+
if (maxVal === 0)
|
|
1243
|
+
return '<p class="empty">No response time data</p>';
|
|
1244
|
+
return Object.entries(buckets).map(([label, count]) => {
|
|
1245
|
+
const pct = count / maxVal * 100;
|
|
1246
|
+
return `<div class="bar-row">
|
|
1247
|
+
<div class="bar-label">${label}</div>
|
|
1248
|
+
<div class="bar-track"><div class="bar-fill" style="width:${pct}%;background:#6366f1"></div></div>
|
|
1249
|
+
<div class="bar-value">${count}</div>
|
|
1250
|
+
</div>`;
|
|
1251
|
+
}).join(`
|
|
1252
|
+
`);
|
|
1253
|
+
}
|
|
1254
|
+
function generateTimeOfDayChart(messageHours) {
|
|
1255
|
+
if (messageHours.length === 0)
|
|
1256
|
+
return '<p class="empty">No time data</p>';
|
|
1257
|
+
const periods = [
|
|
1258
|
+
{ label: "Morning (6-12)", range: [6, 7, 8, 9, 10, 11] },
|
|
1259
|
+
{ label: "Afternoon (12-18)", range: [12, 13, 14, 15, 16, 17] },
|
|
1260
|
+
{ label: "Evening (18-24)", range: [18, 19, 20, 21, 22, 23] },
|
|
1261
|
+
{ label: "Night (0-6)", range: [0, 1, 2, 3, 4, 5] }
|
|
1262
|
+
];
|
|
1263
|
+
const hourCounts = {};
|
|
1264
|
+
for (const h of messageHours) {
|
|
1265
|
+
hourCounts[h] = (hourCounts[h] || 0) + 1;
|
|
1266
|
+
}
|
|
1267
|
+
const periodCounts = periods.map((p) => ({
|
|
1268
|
+
label: p.label,
|
|
1269
|
+
count: p.range.reduce((sum, h) => sum + (hourCounts[h] || 0), 0)
|
|
1270
|
+
}));
|
|
1271
|
+
const maxVal = Math.max(...periodCounts.map((p) => p.count)) || 1;
|
|
1272
|
+
const barsHtml = periodCounts.map((p) => `
|
|
1273
|
+
<div class="bar-row">
|
|
1274
|
+
<div class="bar-label">${p.label}</div>
|
|
1275
|
+
<div class="bar-track"><div class="bar-fill" style="width:${p.count / maxVal * 100}%;background:#8b5cf6"></div></div>
|
|
1276
|
+
<div class="bar-value">${p.count}</div>
|
|
1277
|
+
</div>`).join(`
|
|
1278
|
+
`);
|
|
1279
|
+
return `<div id="hour-histogram">${barsHtml}</div>`;
|
|
1280
|
+
}
|
|
1281
|
+
function getHourCountsJson(messageHours) {
|
|
1282
|
+
const hourCounts = {};
|
|
1283
|
+
for (const h of messageHours) {
|
|
1284
|
+
hourCounts[h] = (hourCounts[h] || 0) + 1;
|
|
1285
|
+
}
|
|
1286
|
+
return jsonStringify(hourCounts);
|
|
1287
|
+
}
|
|
1288
|
+
function generateHtmlReport(data, insights) {
|
|
1289
|
+
const markdownToHtml = (md) => {
|
|
1290
|
+
if (!md)
|
|
1291
|
+
return "";
|
|
1292
|
+
return md.split(`
|
|
1293
|
+
|
|
1294
|
+
`).map((p) => {
|
|
1295
|
+
let html = escapeHtml(p);
|
|
1296
|
+
html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
|
|
1297
|
+
html = html.replace(/^- /gm, "• ");
|
|
1298
|
+
html = html.replace(/\n/g, "<br>");
|
|
1299
|
+
return `<p>${html}</p>`;
|
|
1300
|
+
}).join(`
|
|
1301
|
+
`);
|
|
1302
|
+
};
|
|
1303
|
+
const atAGlance = insights.at_a_glance;
|
|
1304
|
+
const atAGlanceHtml = atAGlance ? `
|
|
1305
|
+
<div class="at-a-glance">
|
|
1306
|
+
<div class="glance-title">At a Glance</div>
|
|
1307
|
+
<div class="glance-sections">
|
|
1308
|
+
${atAGlance.whats_working ? `<div class="glance-section"><strong>What's working:</strong> ${escapeHtmlWithBold(atAGlance.whats_working)} <a href="#section-wins" class="see-more">Impressive Things You Did →</a></div>` : ""}
|
|
1309
|
+
${atAGlance.whats_hindering ? `<div class="glance-section"><strong>What's hindering you:</strong> ${escapeHtmlWithBold(atAGlance.whats_hindering)} <a href="#section-friction" class="see-more">Where Things Go Wrong →</a></div>` : ""}
|
|
1310
|
+
${atAGlance.quick_wins ? `<div class="glance-section"><strong>Quick wins to try:</strong> ${escapeHtmlWithBold(atAGlance.quick_wins)} <a href="#section-features" class="see-more">Features to Try →</a></div>` : ""}
|
|
1311
|
+
${atAGlance.ambitious_workflows ? `<div class="glance-section"><strong>Ambitious workflows:</strong> ${escapeHtmlWithBold(atAGlance.ambitious_workflows)} <a href="#section-horizon" class="see-more">On the Horizon →</a></div>` : ""}
|
|
1312
|
+
</div>
|
|
1313
|
+
</div>
|
|
1314
|
+
` : "";
|
|
1315
|
+
const projectAreas = insights.project_areas?.areas || [];
|
|
1316
|
+
const projectAreasHtml = projectAreas.length > 0 ? `
|
|
1317
|
+
<h2 id="section-work">What You Work On</h2>
|
|
1318
|
+
<div class="project-areas">
|
|
1319
|
+
${projectAreas.map((area) => `
|
|
1320
|
+
<div class="project-area">
|
|
1321
|
+
<div class="area-header">
|
|
1322
|
+
<span class="area-name">${escapeHtml(area.name)}</span>
|
|
1323
|
+
<span class="area-count">~${area.session_count} sessions</span>
|
|
1324
|
+
</div>
|
|
1325
|
+
<div class="area-desc">${escapeHtml(area.description)}</div>
|
|
1326
|
+
</div>
|
|
1327
|
+
`).join("")}
|
|
1328
|
+
</div>
|
|
1329
|
+
` : "";
|
|
1330
|
+
const interactionStyle = insights.interaction_style;
|
|
1331
|
+
const interactionHtml = interactionStyle?.narrative ? `
|
|
1332
|
+
<h2 id="section-usage">How You Use Claude Code</h2>
|
|
1333
|
+
<div class="narrative">
|
|
1334
|
+
${markdownToHtml(interactionStyle.narrative)}
|
|
1335
|
+
${interactionStyle.key_pattern ? `<div class="key-insight"><strong>Key pattern:</strong> ${escapeHtml(interactionStyle.key_pattern)}</div>` : ""}
|
|
1336
|
+
</div>
|
|
1337
|
+
` : "";
|
|
1338
|
+
const whatWorks = insights.what_works;
|
|
1339
|
+
const whatWorksHtml = whatWorks?.impressive_workflows && whatWorks.impressive_workflows.length > 0 ? `
|
|
1340
|
+
<h2 id="section-wins">Impressive Things You Did</h2>
|
|
1341
|
+
${whatWorks.intro ? `<p class="section-intro">${escapeHtml(whatWorks.intro)}</p>` : ""}
|
|
1342
|
+
<div class="big-wins">
|
|
1343
|
+
${whatWorks.impressive_workflows.map((wf) => `
|
|
1344
|
+
<div class="big-win">
|
|
1345
|
+
<div class="big-win-title">${escapeHtml(wf.title || "")}</div>
|
|
1346
|
+
<div class="big-win-desc">${escapeHtml(wf.description || "")}</div>
|
|
1347
|
+
</div>
|
|
1348
|
+
`).join("")}
|
|
1349
|
+
</div>
|
|
1350
|
+
` : "";
|
|
1351
|
+
const frictionAnalysis = insights.friction_analysis;
|
|
1352
|
+
const frictionHtml = frictionAnalysis?.categories && frictionAnalysis.categories.length > 0 ? `
|
|
1353
|
+
<h2 id="section-friction">Where Things Go Wrong</h2>
|
|
1354
|
+
${frictionAnalysis.intro ? `<p class="section-intro">${escapeHtml(frictionAnalysis.intro)}</p>` : ""}
|
|
1355
|
+
<div class="friction-categories">
|
|
1356
|
+
${frictionAnalysis.categories.map((cat) => `
|
|
1357
|
+
<div class="friction-category">
|
|
1358
|
+
<div class="friction-title">${escapeHtml(cat.category || "")}</div>
|
|
1359
|
+
<div class="friction-desc">${escapeHtml(cat.description || "")}</div>
|
|
1360
|
+
${cat.examples ? `<ul class="friction-examples">${cat.examples.map((ex) => `<li>${escapeHtml(ex)}</li>`).join("")}</ul>` : ""}
|
|
1361
|
+
</div>
|
|
1362
|
+
`).join("")}
|
|
1363
|
+
</div>
|
|
1364
|
+
` : "";
|
|
1365
|
+
const suggestions = insights.suggestions;
|
|
1366
|
+
const suggestionsHtml = suggestions ? `
|
|
1367
|
+
${suggestions.claude_md_additions && suggestions.claude_md_additions.length > 0 ? `
|
|
1368
|
+
<h2 id="section-features">Existing CC Features to Try</h2>
|
|
1369
|
+
<div class="claude-md-section">
|
|
1370
|
+
<h3>Suggested CLAUDE.md Additions</h3>
|
|
1371
|
+
<p style="font-size: 12px; color: #64748b; margin-bottom: 12px;">Just copy this into Claude Code to add it to your CLAUDE.md.</p>
|
|
1372
|
+
<div class="claude-md-actions">
|
|
1373
|
+
<button class="copy-all-btn" onclick="copyAllCheckedClaudeMd()">Copy All Checked</button>
|
|
1374
|
+
</div>
|
|
1375
|
+
${suggestions.claude_md_additions.map((add, i) => `
|
|
1376
|
+
<div class="claude-md-item">
|
|
1377
|
+
<input type="checkbox" id="cmd-${i}" class="cmd-checkbox" checked data-text="${escapeHtml(add.prompt_scaffold || add.where || "Add to CLAUDE.md")}\\n\\n${escapeHtml(add.addition)}">
|
|
1378
|
+
<label for="cmd-${i}">
|
|
1379
|
+
<code class="cmd-code">${escapeHtml(add.addition)}</code>
|
|
1380
|
+
<button class="copy-btn" onclick="copyCmdItem(${i})">Copy</button>
|
|
1381
|
+
</label>
|
|
1382
|
+
<div class="cmd-why">${escapeHtml(add.why)}</div>
|
|
1383
|
+
</div>
|
|
1384
|
+
`).join("")}
|
|
1385
|
+
</div>
|
|
1386
|
+
` : ""}
|
|
1387
|
+
${suggestions.features_to_try && suggestions.features_to_try.length > 0 ? `
|
|
1388
|
+
<p style="font-size: 13px; color: #64748b; margin-bottom: 12px;">Just copy this into Claude Code and it'll set it up for you.</p>
|
|
1389
|
+
<div class="features-section">
|
|
1390
|
+
${suggestions.features_to_try.map((feat) => `
|
|
1391
|
+
<div class="feature-card">
|
|
1392
|
+
<div class="feature-title">${escapeHtml(feat.feature || "")}</div>
|
|
1393
|
+
<div class="feature-oneliner">${escapeHtml(feat.one_liner || "")}</div>
|
|
1394
|
+
<div class="feature-why"><strong>Why for you:</strong> ${escapeHtml(feat.why_for_you || "")}</div>
|
|
1395
|
+
${feat.example_code ? `
|
|
1396
|
+
<div class="feature-examples">
|
|
1397
|
+
<div class="feature-example">
|
|
1398
|
+
<div class="example-code-row">
|
|
1399
|
+
<code class="example-code">${escapeHtml(feat.example_code)}</code>
|
|
1400
|
+
<button class="copy-btn" onclick="copyText(this)">Copy</button>
|
|
1401
|
+
</div>
|
|
1402
|
+
</div>
|
|
1403
|
+
</div>
|
|
1404
|
+
` : ""}
|
|
1405
|
+
</div>
|
|
1406
|
+
`).join("")}
|
|
1407
|
+
</div>
|
|
1408
|
+
` : ""}
|
|
1409
|
+
${suggestions.usage_patterns && suggestions.usage_patterns.length > 0 ? `
|
|
1410
|
+
<h2 id="section-patterns">New Ways to Use Claude Code</h2>
|
|
1411
|
+
<p style="font-size: 13px; color: #64748b; margin-bottom: 12px;">Just copy this into Claude Code and it'll walk you through it.</p>
|
|
1412
|
+
<div class="patterns-section">
|
|
1413
|
+
${suggestions.usage_patterns.map((pat) => `
|
|
1414
|
+
<div class="pattern-card">
|
|
1415
|
+
<div class="pattern-title">${escapeHtml(pat.title || "")}</div>
|
|
1416
|
+
<div class="pattern-summary">${escapeHtml(pat.suggestion || "")}</div>
|
|
1417
|
+
${pat.detail ? `<div class="pattern-detail">${escapeHtml(pat.detail)}</div>` : ""}
|
|
1418
|
+
${pat.copyable_prompt ? `
|
|
1419
|
+
<div class="copyable-prompt-section">
|
|
1420
|
+
<div class="prompt-label">Paste into Claude Code:</div>
|
|
1421
|
+
<div class="copyable-prompt-row">
|
|
1422
|
+
<code class="copyable-prompt">${escapeHtml(pat.copyable_prompt)}</code>
|
|
1423
|
+
<button class="copy-btn" onclick="copyText(this)">Copy</button>
|
|
1424
|
+
</div>
|
|
1425
|
+
</div>
|
|
1426
|
+
` : ""}
|
|
1427
|
+
</div>
|
|
1428
|
+
`).join("")}
|
|
1429
|
+
</div>
|
|
1430
|
+
` : ""}
|
|
1431
|
+
` : "";
|
|
1432
|
+
const horizonData = insights.on_the_horizon;
|
|
1433
|
+
const horizonHtml = horizonData?.opportunities && horizonData.opportunities.length > 0 ? `
|
|
1434
|
+
<h2 id="section-horizon">On the Horizon</h2>
|
|
1435
|
+
${horizonData.intro ? `<p class="section-intro">${escapeHtml(horizonData.intro)}</p>` : ""}
|
|
1436
|
+
<div class="horizon-section">
|
|
1437
|
+
${horizonData.opportunities.map((opp) => `
|
|
1438
|
+
<div class="horizon-card">
|
|
1439
|
+
<div class="horizon-title">${escapeHtml(opp.title || "")}</div>
|
|
1440
|
+
<div class="horizon-possible">${escapeHtml(opp.whats_possible || "")}</div>
|
|
1441
|
+
${opp.how_to_try ? `<div class="horizon-tip"><strong>Getting started:</strong> ${escapeHtml(opp.how_to_try)}</div>` : ""}
|
|
1442
|
+
${opp.copyable_prompt ? `<div class="pattern-prompt"><div class="prompt-label">Paste into Claude Code:</div><code>${escapeHtml(opp.copyable_prompt)}</code><button class="copy-btn" onclick="copyText(this)">Copy</button></div>` : ""}
|
|
1443
|
+
</div>
|
|
1444
|
+
`).join("")}
|
|
1445
|
+
</div>
|
|
1446
|
+
` : "";
|
|
1447
|
+
const ccImprovements = process.env.USER_TYPE === "ant" ? insights.cc_team_improvements?.improvements || [] : [];
|
|
1448
|
+
const modelImprovements = process.env.USER_TYPE === "ant" ? insights.model_behavior_improvements?.improvements || [] : [];
|
|
1449
|
+
const teamFeedbackHtml = ccImprovements.length > 0 || modelImprovements.length > 0 ? `
|
|
1450
|
+
<h2 id="section-feedback" class="feedback-header">Closing the Loop: Feedback for Other Teams</h2>
|
|
1451
|
+
<p class="feedback-intro">Suggestions for the CC product and model teams based on your usage patterns. Click to expand.</p>
|
|
1452
|
+
${ccImprovements.length > 0 ? `
|
|
1453
|
+
<div class="collapsible-section">
|
|
1454
|
+
<div class="collapsible-header" onclick="toggleCollapsible(this)">
|
|
1455
|
+
<span class="collapsible-arrow">▶</span>
|
|
1456
|
+
<h3>Product Improvements for CC Team</h3>
|
|
1457
|
+
</div>
|
|
1458
|
+
<div class="collapsible-content">
|
|
1459
|
+
<div class="suggestions-section">
|
|
1460
|
+
${ccImprovements.map((imp) => `
|
|
1461
|
+
<div class="feedback-card team-card">
|
|
1462
|
+
<div class="feedback-title">${escapeHtml(imp.title || "")}</div>
|
|
1463
|
+
<div class="feedback-detail">${escapeHtml(imp.detail || "")}</div>
|
|
1464
|
+
${imp.evidence ? `<div class="feedback-evidence"><em>Evidence:</em> ${escapeHtml(imp.evidence)}</div>` : ""}
|
|
1465
|
+
</div>
|
|
1466
|
+
`).join("")}
|
|
1467
|
+
</div>
|
|
1468
|
+
</div>
|
|
1469
|
+
</div>
|
|
1470
|
+
` : ""}
|
|
1471
|
+
${modelImprovements.length > 0 ? `
|
|
1472
|
+
<div class="collapsible-section">
|
|
1473
|
+
<div class="collapsible-header" onclick="toggleCollapsible(this)">
|
|
1474
|
+
<span class="collapsible-arrow">▶</span>
|
|
1475
|
+
<h3>Model Behavior Improvements</h3>
|
|
1476
|
+
</div>
|
|
1477
|
+
<div class="collapsible-content">
|
|
1478
|
+
<div class="suggestions-section">
|
|
1479
|
+
${modelImprovements.map((imp) => `
|
|
1480
|
+
<div class="feedback-card model-card">
|
|
1481
|
+
<div class="feedback-title">${escapeHtml(imp.title || "")}</div>
|
|
1482
|
+
<div class="feedback-detail">${escapeHtml(imp.detail || "")}</div>
|
|
1483
|
+
${imp.evidence ? `<div class="feedback-evidence"><em>Evidence:</em> ${escapeHtml(imp.evidence)}</div>` : ""}
|
|
1484
|
+
</div>
|
|
1485
|
+
`).join("")}
|
|
1486
|
+
</div>
|
|
1487
|
+
</div>
|
|
1488
|
+
</div>
|
|
1489
|
+
` : ""}
|
|
1490
|
+
` : "";
|
|
1491
|
+
const funEnding = insights.fun_ending;
|
|
1492
|
+
const funEndingHtml = funEnding?.headline ? `
|
|
1493
|
+
<div class="fun-ending">
|
|
1494
|
+
<div class="fun-headline">"${escapeHtml(funEnding.headline)}"</div>
|
|
1495
|
+
${funEnding.detail ? `<div class="fun-detail">${escapeHtml(funEnding.detail)}</div>` : ""}
|
|
1496
|
+
</div>
|
|
1497
|
+
` : "";
|
|
1498
|
+
const css = `
|
|
1499
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1500
|
+
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: #f8fafc; color: #334155; line-height: 1.65; padding: 48px 24px; }
|
|
1501
|
+
.container { max-width: 800px; margin: 0 auto; }
|
|
1502
|
+
h1 { font-size: 32px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
|
|
1503
|
+
h2 { font-size: 20px; font-weight: 600; color: #0f172a; margin-top: 48px; margin-bottom: 16px; }
|
|
1504
|
+
.subtitle { color: #64748b; font-size: 15px; margin-bottom: 32px; }
|
|
1505
|
+
.nav-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 32px 0; padding: 16px; background: white; border-radius: 8px; border: 1px solid #e2e8f0; }
|
|
1506
|
+
.nav-toc a { font-size: 12px; color: #64748b; text-decoration: none; padding: 6px 12px; border-radius: 6px; background: #f1f5f9; transition: all 0.15s; }
|
|
1507
|
+
.nav-toc a:hover { background: #e2e8f0; color: #334155; }
|
|
1508
|
+
.stats-row { display: flex; gap: 24px; margin-bottom: 40px; padding: 20px 0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
|
|
1509
|
+
.stat { text-align: center; }
|
|
1510
|
+
.stat-value { font-size: 24px; font-weight: 700; color: #0f172a; }
|
|
1511
|
+
.stat-label { font-size: 11px; color: #64748b; text-transform: uppercase; }
|
|
1512
|
+
.at-a-glance { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 1px solid #f59e0b; border-radius: 12px; padding: 20px 24px; margin-bottom: 32px; }
|
|
1513
|
+
.glance-title { font-size: 16px; font-weight: 700; color: #92400e; margin-bottom: 16px; }
|
|
1514
|
+
.glance-sections { display: flex; flex-direction: column; gap: 12px; }
|
|
1515
|
+
.glance-section { font-size: 14px; color: #78350f; line-height: 1.6; }
|
|
1516
|
+
.glance-section strong { color: #92400e; }
|
|
1517
|
+
.see-more { color: #b45309; text-decoration: none; font-size: 13px; white-space: nowrap; }
|
|
1518
|
+
.see-more:hover { text-decoration: underline; }
|
|
1519
|
+
.project-areas { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
|
|
1520
|
+
.project-area { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
|
|
1521
|
+
.area-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
|
1522
|
+
.area-name { font-weight: 600; font-size: 15px; color: #0f172a; }
|
|
1523
|
+
.area-count { font-size: 12px; color: #64748b; background: #f1f5f9; padding: 2px 8px; border-radius: 4px; }
|
|
1524
|
+
.area-desc { font-size: 14px; color: #475569; line-height: 1.5; }
|
|
1525
|
+
.narrative { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin-bottom: 24px; }
|
|
1526
|
+
.narrative p { margin-bottom: 12px; font-size: 14px; color: #475569; line-height: 1.7; }
|
|
1527
|
+
.key-insight { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 16px; margin-top: 12px; font-size: 14px; color: #166534; }
|
|
1528
|
+
.section-intro { font-size: 14px; color: #64748b; margin-bottom: 16px; }
|
|
1529
|
+
.big-wins { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
|
|
1530
|
+
.big-win { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 16px; }
|
|
1531
|
+
.big-win-title { font-weight: 600; font-size: 15px; color: #166534; margin-bottom: 8px; }
|
|
1532
|
+
.big-win-desc { font-size: 14px; color: #15803d; line-height: 1.5; }
|
|
1533
|
+
.friction-categories { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
|
|
1534
|
+
.friction-category { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; padding: 16px; }
|
|
1535
|
+
.friction-title { font-weight: 600; font-size: 15px; color: #991b1b; margin-bottom: 6px; }
|
|
1536
|
+
.friction-desc { font-size: 13px; color: #7f1d1d; margin-bottom: 10px; }
|
|
1537
|
+
.friction-examples { margin: 0 0 0 20px; font-size: 13px; color: #334155; }
|
|
1538
|
+
.friction-examples li { margin-bottom: 4px; }
|
|
1539
|
+
.claude-md-section { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
|
|
1540
|
+
.claude-md-section h3 { font-size: 14px; font-weight: 600; color: #1e40af; margin: 0 0 12px 0; }
|
|
1541
|
+
.claude-md-actions { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #dbeafe; }
|
|
1542
|
+
.copy-all-btn { background: #2563eb; color: white; border: none; border-radius: 4px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-weight: 500; transition: all 0.2s; }
|
|
1543
|
+
.copy-all-btn:hover { background: #1d4ed8; }
|
|
1544
|
+
.copy-all-btn.copied { background: #16a34a; }
|
|
1545
|
+
.claude-md-item { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 10px 0; border-bottom: 1px solid #dbeafe; }
|
|
1546
|
+
.claude-md-item:last-child { border-bottom: none; }
|
|
1547
|
+
.cmd-checkbox { margin-top: 2px; }
|
|
1548
|
+
.cmd-code { background: white; padding: 8px 12px; border-radius: 4px; font-size: 12px; color: #1e40af; border: 1px solid #bfdbfe; font-family: monospace; display: block; white-space: pre-wrap; word-break: break-word; flex: 1; }
|
|
1549
|
+
.cmd-why { font-size: 12px; color: #64748b; width: 100%; padding-left: 24px; margin-top: 4px; }
|
|
1550
|
+
.features-section, .patterns-section { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
|
|
1551
|
+
.feature-card { background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; padding: 16px; }
|
|
1552
|
+
.pattern-card { background: #f0f9ff; border: 1px solid #7dd3fc; border-radius: 8px; padding: 16px; }
|
|
1553
|
+
.feature-title, .pattern-title { font-weight: 600; font-size: 15px; color: #0f172a; margin-bottom: 6px; }
|
|
1554
|
+
.feature-oneliner { font-size: 14px; color: #475569; margin-bottom: 8px; }
|
|
1555
|
+
.pattern-summary { font-size: 14px; color: #475569; margin-bottom: 8px; }
|
|
1556
|
+
.feature-why, .pattern-detail { font-size: 13px; color: #334155; line-height: 1.5; }
|
|
1557
|
+
.feature-examples { margin-top: 12px; }
|
|
1558
|
+
.feature-example { padding: 8px 0; border-top: 1px solid #d1fae5; }
|
|
1559
|
+
.feature-example:first-child { border-top: none; }
|
|
1560
|
+
.example-desc { font-size: 13px; color: #334155; margin-bottom: 6px; }
|
|
1561
|
+
.example-code-row { display: flex; align-items: flex-start; gap: 8px; }
|
|
1562
|
+
.example-code { flex: 1; background: #f1f5f9; padding: 8px 12px; border-radius: 4px; font-family: monospace; font-size: 12px; color: #334155; overflow-x: auto; white-space: pre-wrap; }
|
|
1563
|
+
.copyable-prompt-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
|
|
1564
|
+
.copyable-prompt-row { display: flex; align-items: flex-start; gap: 8px; }
|
|
1565
|
+
.copyable-prompt { flex: 1; background: #f8fafc; padding: 10px 12px; border-radius: 4px; font-family: monospace; font-size: 12px; color: #334155; border: 1px solid #e2e8f0; white-space: pre-wrap; line-height: 1.5; }
|
|
1566
|
+
.feature-code { background: #f8fafc; padding: 12px; border-radius: 6px; margin-top: 12px; border: 1px solid #e2e8f0; display: flex; align-items: flex-start; gap: 8px; }
|
|
1567
|
+
.feature-code code { flex: 1; font-family: monospace; font-size: 12px; color: #334155; white-space: pre-wrap; }
|
|
1568
|
+
.pattern-prompt { background: #f8fafc; padding: 12px; border-radius: 6px; margin-top: 12px; border: 1px solid #e2e8f0; }
|
|
1569
|
+
.pattern-prompt code { font-family: monospace; font-size: 12px; color: #334155; display: block; white-space: pre-wrap; margin-bottom: 8px; }
|
|
1570
|
+
.prompt-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
|
|
1571
|
+
.copy-btn { background: #e2e8f0; border: none; border-radius: 4px; padding: 4px 8px; font-size: 11px; cursor: pointer; color: #475569; flex-shrink: 0; }
|
|
1572
|
+
.copy-btn:hover { background: #cbd5e1; }
|
|
1573
|
+
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
|
|
1574
|
+
.chart-card { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }
|
|
1575
|
+
.chart-title { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; margin-bottom: 12px; }
|
|
1576
|
+
.bar-row { display: flex; align-items: center; margin-bottom: 6px; }
|
|
1577
|
+
.bar-label { width: 100px; font-size: 11px; color: #475569; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1578
|
+
.bar-track { flex: 1; height: 6px; background: #f1f5f9; border-radius: 3px; margin: 0 8px; }
|
|
1579
|
+
.bar-fill { height: 100%; border-radius: 3px; }
|
|
1580
|
+
.bar-value { width: 28px; font-size: 11px; font-weight: 500; color: #64748b; text-align: right; }
|
|
1581
|
+
.empty { color: #94a3b8; font-size: 13px; }
|
|
1582
|
+
.horizon-section { display: flex; flex-direction: column; gap: 16px; }
|
|
1583
|
+
.horizon-card { background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%); border: 1px solid #c4b5fd; border-radius: 8px; padding: 16px; }
|
|
1584
|
+
.horizon-title { font-weight: 600; font-size: 15px; color: #5b21b6; margin-bottom: 8px; }
|
|
1585
|
+
.horizon-possible { font-size: 14px; color: #334155; margin-bottom: 10px; line-height: 1.5; }
|
|
1586
|
+
.horizon-tip { font-size: 13px; color: #6b21a8; background: rgba(255,255,255,0.6); padding: 8px 12px; border-radius: 4px; }
|
|
1587
|
+
.feedback-header { margin-top: 48px; color: #64748b; font-size: 16px; }
|
|
1588
|
+
.feedback-intro { font-size: 13px; color: #94a3b8; margin-bottom: 16px; }
|
|
1589
|
+
.feedback-section { margin-top: 16px; }
|
|
1590
|
+
.feedback-section h3 { font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 12px; }
|
|
1591
|
+
.feedback-card { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; margin-bottom: 12px; }
|
|
1592
|
+
.feedback-card.team-card { background: #eff6ff; border-color: #bfdbfe; }
|
|
1593
|
+
.feedback-card.model-card { background: #faf5ff; border-color: #e9d5ff; }
|
|
1594
|
+
.feedback-title { font-weight: 600; font-size: 14px; color: #0f172a; margin-bottom: 6px; }
|
|
1595
|
+
.feedback-detail { font-size: 13px; color: #475569; line-height: 1.5; }
|
|
1596
|
+
.feedback-evidence { font-size: 12px; color: #64748b; margin-top: 8px; }
|
|
1597
|
+
.fun-ending { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 1px solid #fbbf24; border-radius: 12px; padding: 24px; margin-top: 40px; text-align: center; }
|
|
1598
|
+
.fun-headline { font-size: 18px; font-weight: 600; color: #78350f; margin-bottom: 8px; }
|
|
1599
|
+
.fun-detail { font-size: 14px; color: #92400e; }
|
|
1600
|
+
.collapsible-section { margin-top: 16px; }
|
|
1601
|
+
.collapsible-header { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
|
|
1602
|
+
.collapsible-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #475569; }
|
|
1603
|
+
.collapsible-arrow { font-size: 12px; color: #94a3b8; transition: transform 0.2s; }
|
|
1604
|
+
.collapsible-content { display: none; padding-top: 16px; }
|
|
1605
|
+
.collapsible-content.open { display: block; }
|
|
1606
|
+
.collapsible-header.open .collapsible-arrow { transform: rotate(90deg); }
|
|
1607
|
+
@media (max-width: 640px) { .charts-row { grid-template-columns: 1fr; } .stats-row { justify-content: center; } }
|
|
1608
|
+
`;
|
|
1609
|
+
const hourCountsJson = getHourCountsJson(data.message_hours);
|
|
1610
|
+
const js = `
|
|
1611
|
+
function toggleCollapsible(header) {
|
|
1612
|
+
header.classList.toggle('open');
|
|
1613
|
+
const content = header.nextElementSibling;
|
|
1614
|
+
content.classList.toggle('open');
|
|
1615
|
+
}
|
|
1616
|
+
function copyText(btn) {
|
|
1617
|
+
const code = btn.previousElementSibling;
|
|
1618
|
+
navigator.clipboard.writeText(code.textContent).then(() => {
|
|
1619
|
+
btn.textContent = 'Copied!';
|
|
1620
|
+
setTimeout(() => { btn.textContent = 'Copy'; }, 2000);
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
function copyCmdItem(idx) {
|
|
1624
|
+
const checkbox = document.getElementById('cmd-' + idx);
|
|
1625
|
+
if (checkbox) {
|
|
1626
|
+
const text = checkbox.dataset.text;
|
|
1627
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
1628
|
+
const btn = checkbox.nextElementSibling.querySelector('.copy-btn');
|
|
1629
|
+
if (btn) { btn.textContent = 'Copied!'; setTimeout(() => { btn.textContent = 'Copy'; }, 2000); }
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
function copyAllCheckedClaudeMd() {
|
|
1634
|
+
const checkboxes = document.querySelectorAll('.cmd-checkbox:checked');
|
|
1635
|
+
const texts = [];
|
|
1636
|
+
checkboxes.forEach(cb => {
|
|
1637
|
+
if (cb.dataset.text) { texts.push(cb.dataset.text); }
|
|
1638
|
+
});
|
|
1639
|
+
const combined = texts.join('\\n');
|
|
1640
|
+
const btn = document.querySelector('.copy-all-btn');
|
|
1641
|
+
if (btn) {
|
|
1642
|
+
navigator.clipboard.writeText(combined).then(() => {
|
|
1643
|
+
btn.textContent = 'Copied ' + texts.length + ' items!';
|
|
1644
|
+
btn.classList.add('copied');
|
|
1645
|
+
setTimeout(() => { btn.textContent = 'Copy All Checked'; btn.classList.remove('copied'); }, 2000);
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
// Timezone selector for time of day chart (data is from our own analytics, not user input)
|
|
1650
|
+
const rawHourCounts = ${hourCountsJson};
|
|
1651
|
+
function updateHourHistogram(offsetFromPT) {
|
|
1652
|
+
const periods = [
|
|
1653
|
+
{ label: "Morning (6-12)", range: [6,7,8,9,10,11] },
|
|
1654
|
+
{ label: "Afternoon (12-18)", range: [12,13,14,15,16,17] },
|
|
1655
|
+
{ label: "Evening (18-24)", range: [18,19,20,21,22,23] },
|
|
1656
|
+
{ label: "Night (0-6)", range: [0,1,2,3,4,5] }
|
|
1657
|
+
];
|
|
1658
|
+
const adjustedCounts = {};
|
|
1659
|
+
for (const [hour, count] of Object.entries(rawHourCounts)) {
|
|
1660
|
+
const newHour = (parseInt(hour) + offsetFromPT + 24) % 24;
|
|
1661
|
+
adjustedCounts[newHour] = (adjustedCounts[newHour] || 0) + count;
|
|
1662
|
+
}
|
|
1663
|
+
const periodCounts = periods.map(p => ({
|
|
1664
|
+
label: p.label,
|
|
1665
|
+
count: p.range.reduce((sum, h) => sum + (adjustedCounts[h] || 0), 0)
|
|
1666
|
+
}));
|
|
1667
|
+
const maxCount = Math.max(...periodCounts.map(p => p.count)) || 1;
|
|
1668
|
+
const container = document.getElementById('hour-histogram');
|
|
1669
|
+
container.textContent = '';
|
|
1670
|
+
periodCounts.forEach(p => {
|
|
1671
|
+
const row = document.createElement('div');
|
|
1672
|
+
row.className = 'bar-row';
|
|
1673
|
+
const label = document.createElement('div');
|
|
1674
|
+
label.className = 'bar-label';
|
|
1675
|
+
label.textContent = p.label;
|
|
1676
|
+
const track = document.createElement('div');
|
|
1677
|
+
track.className = 'bar-track';
|
|
1678
|
+
const fill = document.createElement('div');
|
|
1679
|
+
fill.className = 'bar-fill';
|
|
1680
|
+
fill.style.width = (p.count / maxCount) * 100 + '%';
|
|
1681
|
+
fill.style.background = '#8b5cf6';
|
|
1682
|
+
track.appendChild(fill);
|
|
1683
|
+
const value = document.createElement('div');
|
|
1684
|
+
value.className = 'bar-value';
|
|
1685
|
+
value.textContent = p.count;
|
|
1686
|
+
row.appendChild(label);
|
|
1687
|
+
row.appendChild(track);
|
|
1688
|
+
row.appendChild(value);
|
|
1689
|
+
container.appendChild(row);
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
document.getElementById('timezone-select').addEventListener('change', function() {
|
|
1693
|
+
const customInput = document.getElementById('custom-offset');
|
|
1694
|
+
if (this.value === 'custom') {
|
|
1695
|
+
customInput.style.display = 'inline-block';
|
|
1696
|
+
customInput.focus();
|
|
1697
|
+
} else {
|
|
1698
|
+
customInput.style.display = 'none';
|
|
1699
|
+
updateHourHistogram(parseInt(this.value));
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
document.getElementById('custom-offset').addEventListener('change', function() {
|
|
1703
|
+
const offset = parseInt(this.value) + 8;
|
|
1704
|
+
updateHourHistogram(offset);
|
|
1705
|
+
});
|
|
1706
|
+
`;
|
|
1707
|
+
return `<!DOCTYPE html>
|
|
1708
|
+
<html>
|
|
1709
|
+
<head>
|
|
1710
|
+
<meta charset="utf-8">
|
|
1711
|
+
<title>Claude Code Insights</title>
|
|
1712
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
1713
|
+
<style>${css}</style>
|
|
1714
|
+
</head>
|
|
1715
|
+
<body>
|
|
1716
|
+
<div class="container">
|
|
1717
|
+
<h1>Claude Code Insights</h1>
|
|
1718
|
+
<p class="subtitle">${data.total_messages.toLocaleString()} messages across ${data.total_sessions} sessions${data.total_sessions_scanned && data.total_sessions_scanned > data.total_sessions ? ` (${data.total_sessions_scanned.toLocaleString()} total)` : ""} | ${data.date_range.start} to ${data.date_range.end}</p>
|
|
1719
|
+
|
|
1720
|
+
${atAGlanceHtml}
|
|
1721
|
+
|
|
1722
|
+
<nav class="nav-toc">
|
|
1723
|
+
<a href="#section-work">What You Work On</a>
|
|
1724
|
+
<a href="#section-usage">How You Use CC</a>
|
|
1725
|
+
<a href="#section-wins">Impressive Things</a>
|
|
1726
|
+
<a href="#section-friction">Where Things Go Wrong</a>
|
|
1727
|
+
<a href="#section-features">Features to Try</a>
|
|
1728
|
+
<a href="#section-patterns">New Usage Patterns</a>
|
|
1729
|
+
<a href="#section-horizon">On the Horizon</a>
|
|
1730
|
+
<a href="#section-feedback">Team Feedback</a>
|
|
1731
|
+
</nav>
|
|
1732
|
+
|
|
1733
|
+
<div class="stats-row">
|
|
1734
|
+
<div class="stat"><div class="stat-value">${data.total_messages.toLocaleString()}</div><div class="stat-label">Messages</div></div>
|
|
1735
|
+
<div class="stat"><div class="stat-value">+${data.total_lines_added.toLocaleString()}/-${data.total_lines_removed.toLocaleString()}</div><div class="stat-label">Lines</div></div>
|
|
1736
|
+
<div class="stat"><div class="stat-value">${data.total_files_modified}</div><div class="stat-label">Files</div></div>
|
|
1737
|
+
<div class="stat"><div class="stat-value">${data.days_active}</div><div class="stat-label">Days</div></div>
|
|
1738
|
+
<div class="stat"><div class="stat-value">${data.messages_per_day}</div><div class="stat-label">Msgs/Day</div></div>
|
|
1739
|
+
</div>
|
|
1740
|
+
|
|
1741
|
+
${projectAreasHtml}
|
|
1742
|
+
|
|
1743
|
+
<div class="charts-row">
|
|
1744
|
+
<div class="chart-card">
|
|
1745
|
+
<div class="chart-title">What You Wanted</div>
|
|
1746
|
+
${generateBarChart(data.goal_categories, "#2563eb")}
|
|
1747
|
+
</div>
|
|
1748
|
+
<div class="chart-card">
|
|
1749
|
+
<div class="chart-title">Top Tools Used</div>
|
|
1750
|
+
${generateBarChart(data.tool_counts, "#0891b2")}
|
|
1751
|
+
</div>
|
|
1752
|
+
</div>
|
|
1753
|
+
|
|
1754
|
+
<div class="charts-row">
|
|
1755
|
+
<div class="chart-card">
|
|
1756
|
+
<div class="chart-title">Languages</div>
|
|
1757
|
+
${generateBarChart(data.languages, "#10b981")}
|
|
1758
|
+
</div>
|
|
1759
|
+
<div class="chart-card">
|
|
1760
|
+
<div class="chart-title">Session Types</div>
|
|
1761
|
+
${generateBarChart(data.session_types || {}, "#8b5cf6")}
|
|
1762
|
+
</div>
|
|
1763
|
+
</div>
|
|
1764
|
+
|
|
1765
|
+
${interactionHtml}
|
|
1766
|
+
|
|
1767
|
+
<!-- Response Time Distribution -->
|
|
1768
|
+
<div class="chart-card" style="margin: 24px 0;">
|
|
1769
|
+
<div class="chart-title">User Response Time Distribution</div>
|
|
1770
|
+
${generateResponseTimeHistogram(data.user_response_times)}
|
|
1771
|
+
<div style="font-size: 12px; color: #64748b; margin-top: 8px;">
|
|
1772
|
+
Median: ${data.median_response_time.toFixed(1)}s • Average: ${data.avg_response_time.toFixed(1)}s
|
|
1773
|
+
</div>
|
|
1774
|
+
</div>
|
|
1775
|
+
|
|
1776
|
+
<!-- Multi-clauding Section (matching Python reference) -->
|
|
1777
|
+
<div class="chart-card" style="margin: 24px 0;">
|
|
1778
|
+
<div class="chart-title">Multi-Clauding (Parallel Sessions)</div>
|
|
1779
|
+
${data.multi_clauding.overlap_events === 0 ? `
|
|
1780
|
+
<p style="font-size: 14px; color: #64748b; padding: 8px 0;">
|
|
1781
|
+
No parallel session usage detected. You typically work with one Claude Code session at a time.
|
|
1782
|
+
</p>
|
|
1783
|
+
` : `
|
|
1784
|
+
<div style="display: flex; gap: 24px; margin: 12px 0;">
|
|
1785
|
+
<div style="text-align: center;">
|
|
1786
|
+
<div style="font-size: 24px; font-weight: 700; color: #7c3aed;">${data.multi_clauding.overlap_events}</div>
|
|
1787
|
+
<div style="font-size: 11px; color: #64748b; text-transform: uppercase;">Overlap Events</div>
|
|
1788
|
+
</div>
|
|
1789
|
+
<div style="text-align: center;">
|
|
1790
|
+
<div style="font-size: 24px; font-weight: 700; color: #7c3aed;">${data.multi_clauding.sessions_involved}</div>
|
|
1791
|
+
<div style="font-size: 11px; color: #64748b; text-transform: uppercase;">Sessions Involved</div>
|
|
1792
|
+
</div>
|
|
1793
|
+
<div style="text-align: center;">
|
|
1794
|
+
<div style="font-size: 24px; font-weight: 700; color: #7c3aed;">${data.total_messages > 0 ? Math.round(100 * data.multi_clauding.user_messages_during / data.total_messages) : 0}%</div>
|
|
1795
|
+
<div style="font-size: 11px; color: #64748b; text-transform: uppercase;">Of Messages</div>
|
|
1796
|
+
</div>
|
|
1797
|
+
</div>
|
|
1798
|
+
<p style="font-size: 13px; color: #475569; margin-top: 12px;">
|
|
1799
|
+
You run multiple Claude Code sessions simultaneously. Multi-clauding is detected when sessions
|
|
1800
|
+
overlap in time, suggesting parallel workflows.
|
|
1801
|
+
</p>
|
|
1802
|
+
`}
|
|
1803
|
+
</div>
|
|
1804
|
+
|
|
1805
|
+
<!-- Time of Day & Tool Errors -->
|
|
1806
|
+
<div class="charts-row">
|
|
1807
|
+
<div class="chart-card">
|
|
1808
|
+
<div class="chart-title" style="display: flex; align-items: center; gap: 12px;">
|
|
1809
|
+
User Messages by Time of Day
|
|
1810
|
+
<select id="timezone-select" style="font-size: 12px; padding: 4px 8px; border-radius: 4px; border: 1px solid #e2e8f0;">
|
|
1811
|
+
<option value="0">PT (UTC-8)</option>
|
|
1812
|
+
<option value="3">ET (UTC-5)</option>
|
|
1813
|
+
<option value="8">London (UTC)</option>
|
|
1814
|
+
<option value="9">CET (UTC+1)</option>
|
|
1815
|
+
<option value="17">Tokyo (UTC+9)</option>
|
|
1816
|
+
<option value="custom">Custom offset...</option>
|
|
1817
|
+
</select>
|
|
1818
|
+
<input type="number" id="custom-offset" placeholder="UTC offset" style="display: none; width: 80px; font-size: 12px; padding: 4px; border-radius: 4px; border: 1px solid #e2e8f0;">
|
|
1819
|
+
</div>
|
|
1820
|
+
${generateTimeOfDayChart(data.message_hours)}
|
|
1821
|
+
</div>
|
|
1822
|
+
<div class="chart-card">
|
|
1823
|
+
<div class="chart-title">Tool Errors Encountered</div>
|
|
1824
|
+
${Object.keys(data.tool_error_categories).length > 0 ? generateBarChart(data.tool_error_categories, "#dc2626") : '<p class="empty">No tool errors</p>'}
|
|
1825
|
+
</div>
|
|
1826
|
+
</div>
|
|
1827
|
+
|
|
1828
|
+
${whatWorksHtml}
|
|
1829
|
+
|
|
1830
|
+
<div class="charts-row">
|
|
1831
|
+
<div class="chart-card">
|
|
1832
|
+
<div class="chart-title">What Helped Most (Claude's Capabilities)</div>
|
|
1833
|
+
${generateBarChart(data.success, "#16a34a")}
|
|
1834
|
+
</div>
|
|
1835
|
+
<div class="chart-card">
|
|
1836
|
+
<div class="chart-title">Outcomes</div>
|
|
1837
|
+
${generateBarChart(data.outcomes, "#8b5cf6", 6, OUTCOME_ORDER)}
|
|
1838
|
+
</div>
|
|
1839
|
+
</div>
|
|
1840
|
+
|
|
1841
|
+
${frictionHtml}
|
|
1842
|
+
|
|
1843
|
+
<div class="charts-row">
|
|
1844
|
+
<div class="chart-card">
|
|
1845
|
+
<div class="chart-title">Primary Friction Types</div>
|
|
1846
|
+
${generateBarChart(data.friction, "#dc2626")}
|
|
1847
|
+
</div>
|
|
1848
|
+
<div class="chart-card">
|
|
1849
|
+
<div class="chart-title">Inferred Satisfaction (model-estimated)</div>
|
|
1850
|
+
${generateBarChart(data.satisfaction, "#eab308", 6, SATISFACTION_ORDER)}
|
|
1851
|
+
</div>
|
|
1852
|
+
</div>
|
|
1853
|
+
|
|
1854
|
+
${suggestionsHtml}
|
|
1855
|
+
|
|
1856
|
+
${horizonHtml}
|
|
1857
|
+
|
|
1858
|
+
${funEndingHtml}
|
|
1859
|
+
|
|
1860
|
+
${teamFeedbackHtml}
|
|
1861
|
+
</div>
|
|
1862
|
+
<script>${js}</script>
|
|
1863
|
+
</body>
|
|
1864
|
+
</html>`;
|
|
1865
|
+
}
|
|
1866
|
+
export function buildExportData(data, insights, facets, remoteStats) {
|
|
1867
|
+
const version = typeof MACRO !== "undefined" ? MACRO.VERSION : "unknown";
|
|
1868
|
+
const remote_hosts_collected = remoteStats?.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name);
|
|
1869
|
+
const facets_summary = {
|
|
1870
|
+
total: facets.size,
|
|
1871
|
+
goal_categories: {},
|
|
1872
|
+
outcomes: {},
|
|
1873
|
+
satisfaction: {},
|
|
1874
|
+
friction: {}
|
|
1875
|
+
};
|
|
1876
|
+
for (const f of facets.values()) {
|
|
1877
|
+
for (const [cat, count] of safeEntries(f.goal_categories)) {
|
|
1878
|
+
if (count > 0) {
|
|
1879
|
+
facets_summary.goal_categories[cat] = (facets_summary.goal_categories[cat] || 0) + count;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
facets_summary.outcomes[f.outcome] = (facets_summary.outcomes[f.outcome] || 0) + 1;
|
|
1883
|
+
for (const [level, count] of safeEntries(f.user_satisfaction_counts)) {
|
|
1884
|
+
if (count > 0) {
|
|
1885
|
+
facets_summary.satisfaction[level] = (facets_summary.satisfaction[level] || 0) + count;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
for (const [type, count] of safeEntries(f.friction_counts)) {
|
|
1889
|
+
if (count > 0) {
|
|
1890
|
+
facets_summary.friction[type] = (facets_summary.friction[type] || 0) + count;
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
return {
|
|
1895
|
+
metadata: {
|
|
1896
|
+
username: process.env.SAFEUSER || process.env.USER || "unknown",
|
|
1897
|
+
generated_at: new Date().toISOString(),
|
|
1898
|
+
claude_code_version: version,
|
|
1899
|
+
date_range: data.date_range,
|
|
1900
|
+
session_count: data.total_sessions,
|
|
1901
|
+
...remote_hosts_collected && remote_hosts_collected.length > 0 && {
|
|
1902
|
+
remote_hosts_collected
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
aggregated_data: data,
|
|
1906
|
+
insights,
|
|
1907
|
+
facets_summary
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
async function scanAllSessions() {
|
|
1911
|
+
const projectsDir = getProjectsDir();
|
|
1912
|
+
let dirents;
|
|
1913
|
+
try {
|
|
1914
|
+
dirents = await readdir(projectsDir, { withFileTypes: true });
|
|
1915
|
+
} catch {
|
|
1916
|
+
return [];
|
|
1917
|
+
}
|
|
1918
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join(projectsDir, dirent.name));
|
|
1919
|
+
const allSessions = [];
|
|
1920
|
+
for (let i = 0;i < projectDirs.length; i++) {
|
|
1921
|
+
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i]);
|
|
1922
|
+
for (const [sessionId, fileInfo] of sessionFiles) {
|
|
1923
|
+
allSessions.push({
|
|
1924
|
+
sessionId,
|
|
1925
|
+
path: fileInfo.path,
|
|
1926
|
+
mtime: fileInfo.mtime,
|
|
1927
|
+
size: fileInfo.size
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
if (i % 10 === 9) {
|
|
1931
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
allSessions.sort((a, b) => b.mtime - a.mtime);
|
|
1935
|
+
return allSessions;
|
|
1936
|
+
}
|
|
1937
|
+
export async function generateUsageReport(options) {
|
|
1938
|
+
let remoteStats;
|
|
1939
|
+
if (process.env.USER_TYPE === "ant" && options?.collectRemote) {
|
|
1940
|
+
const destDir = join(getClaudeConfigHomeDir(), "projects");
|
|
1941
|
+
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
1942
|
+
remoteStats = { hosts, totalCopied };
|
|
1943
|
+
}
|
|
1944
|
+
const allScannedSessions = await scanAllSessions();
|
|
1945
|
+
const totalSessionsScanned = allScannedSessions.length;
|
|
1946
|
+
const META_BATCH_SIZE = 50;
|
|
1947
|
+
const MAX_SESSIONS_TO_LOAD = 200;
|
|
1948
|
+
let allMetas = [];
|
|
1949
|
+
const uncachedSessions = [];
|
|
1950
|
+
for (let i = 0;i < allScannedSessions.length; i += META_BATCH_SIZE) {
|
|
1951
|
+
const batch = allScannedSessions.slice(i, i + META_BATCH_SIZE);
|
|
1952
|
+
const results = await Promise.all(batch.map(async (sessionInfo) => ({
|
|
1953
|
+
sessionInfo,
|
|
1954
|
+
cached: await loadCachedSessionMeta(sessionInfo.sessionId)
|
|
1955
|
+
})));
|
|
1956
|
+
for (const { sessionInfo, cached } of results) {
|
|
1957
|
+
if (cached) {
|
|
1958
|
+
allMetas.push(cached);
|
|
1959
|
+
} else if (uncachedSessions.length < MAX_SESSIONS_TO_LOAD) {
|
|
1960
|
+
uncachedSessions.push(sessionInfo);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
const logsForFacets = new Map;
|
|
1965
|
+
const isMetaSession = (log) => {
|
|
1966
|
+
for (const msg of log.messages.slice(0, 5)) {
|
|
1967
|
+
if (msg.type === "user" && msg.message) {
|
|
1968
|
+
const content = msg.message.content;
|
|
1969
|
+
if (typeof content === "string") {
|
|
1970
|
+
if (content.includes("RESPOND WITH ONLY A VALID JSON OBJECT") || content.includes("record_facets")) {
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
return false;
|
|
1977
|
+
};
|
|
1978
|
+
const LOAD_BATCH_SIZE = 10;
|
|
1979
|
+
for (let i = 0;i < uncachedSessions.length; i += LOAD_BATCH_SIZE) {
|
|
1980
|
+
const batch = uncachedSessions.slice(i, i + LOAD_BATCH_SIZE);
|
|
1981
|
+
const batchResults = await Promise.all(batch.map(async (sessionInfo) => {
|
|
1982
|
+
try {
|
|
1983
|
+
return await loadAllLogsFromSessionFile(sessionInfo.path);
|
|
1984
|
+
} catch {
|
|
1985
|
+
return [];
|
|
1986
|
+
}
|
|
1987
|
+
}));
|
|
1988
|
+
const metasToSave = [];
|
|
1989
|
+
for (const logs of batchResults) {
|
|
1990
|
+
for (const log of logs) {
|
|
1991
|
+
if (isMetaSession(log) || !hasValidDates(log))
|
|
1992
|
+
continue;
|
|
1993
|
+
const meta = logToSessionMeta(log);
|
|
1994
|
+
allMetas.push(meta);
|
|
1995
|
+
metasToSave.push(meta);
|
|
1996
|
+
logsForFacets.set(meta.session_id, log);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
await Promise.all(metasToSave.map((meta) => saveSessionMeta(meta)));
|
|
2000
|
+
}
|
|
2001
|
+
const bestBySession = new Map;
|
|
2002
|
+
for (const meta of allMetas) {
|
|
2003
|
+
const existing = bestBySession.get(meta.session_id);
|
|
2004
|
+
if (!existing || meta.user_message_count > existing.user_message_count || meta.user_message_count === existing.user_message_count && meta.duration_minutes > existing.duration_minutes) {
|
|
2005
|
+
bestBySession.set(meta.session_id, meta);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
const keptSessionIds = new Set(bestBySession.keys());
|
|
2009
|
+
allMetas = [...bestBySession.values()];
|
|
2010
|
+
for (const sessionId of logsForFacets.keys()) {
|
|
2011
|
+
if (!keptSessionIds.has(sessionId)) {
|
|
2012
|
+
logsForFacets.delete(sessionId);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
allMetas.sort((a, b) => b.start_time.localeCompare(a.start_time));
|
|
2016
|
+
const isSubstantiveSession = (meta) => {
|
|
2017
|
+
if (meta.user_message_count < 2)
|
|
2018
|
+
return false;
|
|
2019
|
+
if (meta.duration_minutes < 1)
|
|
2020
|
+
return false;
|
|
2021
|
+
return true;
|
|
2022
|
+
};
|
|
2023
|
+
const substantiveMetas = allMetas.filter(isSubstantiveSession);
|
|
2024
|
+
const facets = new Map;
|
|
2025
|
+
const toExtract = [];
|
|
2026
|
+
const MAX_FACET_EXTRACTIONS = 50;
|
|
2027
|
+
const cachedFacetResults = await Promise.all(substantiveMetas.map(async (meta) => ({
|
|
2028
|
+
sessionId: meta.session_id,
|
|
2029
|
+
cached: await loadCachedFacets(meta.session_id)
|
|
2030
|
+
})));
|
|
2031
|
+
for (const { sessionId, cached } of cachedFacetResults) {
|
|
2032
|
+
if (cached) {
|
|
2033
|
+
facets.set(sessionId, cached);
|
|
2034
|
+
} else {
|
|
2035
|
+
const log = logsForFacets.get(sessionId);
|
|
2036
|
+
if (log && toExtract.length < MAX_FACET_EXTRACTIONS) {
|
|
2037
|
+
toExtract.push({ log, sessionId });
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
const CONCURRENCY = 50;
|
|
2042
|
+
for (let i = 0;i < toExtract.length; i += CONCURRENCY) {
|
|
2043
|
+
const batch = toExtract.slice(i, i + CONCURRENCY);
|
|
2044
|
+
const results = await Promise.all(batch.map(async ({ log, sessionId }) => {
|
|
2045
|
+
const newFacets = await extractFacetsFromAPI(log, sessionId);
|
|
2046
|
+
return { sessionId, newFacets };
|
|
2047
|
+
}));
|
|
2048
|
+
const facetsToSave = [];
|
|
2049
|
+
for (const { sessionId, newFacets } of results) {
|
|
2050
|
+
if (newFacets) {
|
|
2051
|
+
facets.set(sessionId, newFacets);
|
|
2052
|
+
facetsToSave.push(newFacets);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
await Promise.all(facetsToSave.map((f) => saveFacets(f)));
|
|
2056
|
+
}
|
|
2057
|
+
const isMinimalSession = (sessionId) => {
|
|
2058
|
+
const sessionFacets = facets.get(sessionId);
|
|
2059
|
+
if (!sessionFacets)
|
|
2060
|
+
return false;
|
|
2061
|
+
const cats = sessionFacets.goal_categories;
|
|
2062
|
+
const catKeys = safeKeys(cats).filter((k) => (cats[k] ?? 0) > 0);
|
|
2063
|
+
return catKeys.length === 1 && catKeys[0] === "warmup_minimal";
|
|
2064
|
+
};
|
|
2065
|
+
const substantiveSessions = substantiveMetas.filter((s) => !isMinimalSession(s.session_id));
|
|
2066
|
+
const substantiveFacets = new Map;
|
|
2067
|
+
for (const [sessionId, f] of facets) {
|
|
2068
|
+
if (!isMinimalSession(sessionId)) {
|
|
2069
|
+
substantiveFacets.set(sessionId, f);
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
const aggregated = aggregateData(substantiveSessions, substantiveFacets);
|
|
2073
|
+
aggregated.total_sessions_scanned = totalSessionsScanned;
|
|
2074
|
+
const insights = await generateParallelInsights(aggregated, facets);
|
|
2075
|
+
const htmlReport = generateHtmlReport(aggregated, insights);
|
|
2076
|
+
try {
|
|
2077
|
+
await mkdir(getDataDir(), { recursive: true });
|
|
2078
|
+
} catch {}
|
|
2079
|
+
const htmlPath = join(getDataDir(), "report.html");
|
|
2080
|
+
await writeFile(htmlPath, htmlReport, {
|
|
2081
|
+
encoding: "utf-8",
|
|
2082
|
+
mode: 384
|
|
2083
|
+
});
|
|
2084
|
+
return {
|
|
2085
|
+
insights,
|
|
2086
|
+
htmlPath,
|
|
2087
|
+
data: aggregated,
|
|
2088
|
+
remoteStats,
|
|
2089
|
+
facets: substantiveFacets
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
function safeEntries(obj) {
|
|
2093
|
+
return obj ? Object.entries(obj) : [];
|
|
2094
|
+
}
|
|
2095
|
+
function safeKeys(obj) {
|
|
2096
|
+
return obj ? Object.keys(obj) : [];
|
|
2097
|
+
}
|
|
2098
|
+
const usageReport = {
|
|
2099
|
+
type: "prompt",
|
|
2100
|
+
name: "insights",
|
|
2101
|
+
description: "Generate a report analyzing your Claude Code sessions",
|
|
2102
|
+
contentLength: 0,
|
|
2103
|
+
progressMessage: "analyzing your sessions",
|
|
2104
|
+
source: "builtin",
|
|
2105
|
+
async getPromptForCommand(args) {
|
|
2106
|
+
let collectRemote = false;
|
|
2107
|
+
let remoteHosts = [];
|
|
2108
|
+
let hasRemoteHosts = false;
|
|
2109
|
+
if (process.env.USER_TYPE === "ant") {
|
|
2110
|
+
collectRemote = args?.includes("--homespaces") ?? false;
|
|
2111
|
+
remoteHosts = await getRunningRemoteHosts();
|
|
2112
|
+
hasRemoteHosts = remoteHosts.length > 0;
|
|
2113
|
+
if (collectRemote && hasRemoteHosts) {
|
|
2114
|
+
console.error(`Collecting sessions from ${remoteHosts.length} homespace(s): ${remoteHosts.join(", ")}...`);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
const { insights, htmlPath, data, remoteStats } = await generateUsageReport({ collectRemote });
|
|
2118
|
+
let reportUrl = `file://${htmlPath}`;
|
|
2119
|
+
let uploadHint = "";
|
|
2120
|
+
if (process.env.USER_TYPE === "ant") {
|
|
2121
|
+
const timestamp = new Date().toISOString().replace(/[-:]/g, "").replace("T", "_").slice(0, 15);
|
|
2122
|
+
const username = process.env.SAFEUSER || process.env.USER || "unknown";
|
|
2123
|
+
const filename = `${username}_insights_${timestamp}.html`;
|
|
2124
|
+
const s3Path = `s3://anthropic-serve/atamkin/cc-user-reports/${filename}`;
|
|
2125
|
+
const s3Url = `https://s3-frontend.infra.ant.dev/anthropic-serve/atamkin/cc-user-reports/${filename}`;
|
|
2126
|
+
reportUrl = s3Url;
|
|
2127
|
+
try {
|
|
2128
|
+
execFileSync("ff", ["cp", htmlPath, s3Path], {
|
|
2129
|
+
timeout: 60000,
|
|
2130
|
+
stdio: "pipe"
|
|
2131
|
+
});
|
|
2132
|
+
} catch {
|
|
2133
|
+
reportUrl = `file://${htmlPath}`;
|
|
2134
|
+
uploadHint = `
|
|
2135
|
+
Automatic upload failed. Are you on the boron namespace? Try \`use-bo\` and ensure you've run \`sso\`.
|
|
2136
|
+
To share, run: ff cp ${htmlPath} ${s3Path}
|
|
2137
|
+
Then access at: ${s3Url}`;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
const sessionLabel = data.total_sessions_scanned && data.total_sessions_scanned > data.total_sessions ? `${data.total_sessions_scanned.toLocaleString()} sessions total · ${data.total_sessions} analyzed` : `${data.total_sessions} sessions`;
|
|
2141
|
+
const stats = [
|
|
2142
|
+
sessionLabel,
|
|
2143
|
+
`${data.total_messages.toLocaleString()} messages`,
|
|
2144
|
+
`${Math.round(data.total_duration_hours)}h`,
|
|
2145
|
+
`${data.git_commits} commits`
|
|
2146
|
+
].join(" · ");
|
|
2147
|
+
let remoteInfo = "";
|
|
2148
|
+
if (process.env.USER_TYPE === "ant") {
|
|
2149
|
+
if (remoteStats && remoteStats.totalCopied > 0) {
|
|
2150
|
+
const hsNames = remoteStats.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name).join(", ");
|
|
2151
|
+
remoteInfo = `
|
|
2152
|
+
_Collected ${remoteStats.totalCopied} new sessions from: ${hsNames}_
|
|
2153
|
+
`;
|
|
2154
|
+
} else if (!collectRemote && hasRemoteHosts) {
|
|
2155
|
+
remoteInfo = `
|
|
2156
|
+
_Tip: Run \`/insights --homespaces\` to include sessions from your ${remoteHosts.length} running homespace(s)_
|
|
2157
|
+
`;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
const atAGlance = insights.at_a_glance;
|
|
2161
|
+
const summaryText = atAGlance ? `## At a Glance
|
|
2162
|
+
|
|
2163
|
+
${atAGlance.whats_working ? `**What's working:** ${atAGlance.whats_working} See _Impressive Things You Did_.` : ""}
|
|
2164
|
+
|
|
2165
|
+
${atAGlance.whats_hindering ? `**What's hindering you:** ${atAGlance.whats_hindering} See _Where Things Go Wrong_.` : ""}
|
|
2166
|
+
|
|
2167
|
+
${atAGlance.quick_wins ? `**Quick wins to try:** ${atAGlance.quick_wins} See _Features to Try_.` : ""}
|
|
2168
|
+
|
|
2169
|
+
${atAGlance.ambitious_workflows ? `**Ambitious workflows:** ${atAGlance.ambitious_workflows} See _On the Horizon_.` : ""}` : "_No insights generated_";
|
|
2170
|
+
const header = `# Claude Code Insights
|
|
2171
|
+
|
|
2172
|
+
${stats}
|
|
2173
|
+
${data.date_range.start} to ${data.date_range.end}
|
|
2174
|
+
${remoteInfo}
|
|
2175
|
+
`;
|
|
2176
|
+
const userSummary = `${header}${summaryText}
|
|
2177
|
+
|
|
2178
|
+
Your full shareable insights report is ready: ${reportUrl}${uploadHint}`;
|
|
2179
|
+
return [
|
|
2180
|
+
{
|
|
2181
|
+
type: "text",
|
|
2182
|
+
text: `The user just ran /insights to generate a usage report analyzing their Claude Code sessions.
|
|
2183
|
+
|
|
2184
|
+
Here is the full insights data:
|
|
2185
|
+
${jsonStringify(insights, null, 2)}
|
|
2186
|
+
|
|
2187
|
+
Report URL: ${reportUrl}
|
|
2188
|
+
HTML file: ${htmlPath}
|
|
2189
|
+
Facets directory: ${getFacetsDir()}
|
|
2190
|
+
|
|
2191
|
+
Here is what the user sees:
|
|
2192
|
+
${userSummary}
|
|
2193
|
+
|
|
2194
|
+
Now output the following message exactly:
|
|
2195
|
+
|
|
2196
|
+
<message>
|
|
2197
|
+
Your shareable insights report is ready:
|
|
2198
|
+
${reportUrl}${uploadHint}
|
|
2199
|
+
|
|
2200
|
+
Want to dig into any section or try one of the suggestions?
|
|
2201
|
+
</message>`
|
|
2202
|
+
}
|
|
2203
|
+
];
|
|
2204
|
+
}
|
|
2205
|
+
};
|
|
2206
|
+
function isValidSessionFacets(obj) {
|
|
2207
|
+
if (!obj || typeof obj !== "object")
|
|
2208
|
+
return false;
|
|
2209
|
+
const o = obj;
|
|
2210
|
+
return typeof o.underlying_goal === "string" && typeof o.outcome === "string" && typeof o.brief_summary === "string" && o.goal_categories !== null && typeof o.goal_categories === "object" && o.user_satisfaction_counts !== null && typeof o.user_satisfaction_counts === "object" && o.friction_counts !== null && typeof o.friction_counts === "object";
|
|
2211
|
+
}
|
|
2212
|
+
export default usageReport;
|