mumucc 0.4.2 → 0.4.3
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/AGENTS.md +297 -0
- package/bin/mumucc +3 -8
- package/bun.lock +44 -141
- package/defaults/mcp-servers.json +0 -6
- package/package.json +3 -3
- package/shims/bun-bundle.ts +0 -3
- package/shims/globals.d.ts +15 -0
- package/shims/globals.ts +1 -1
- package/src/QueryEngine.ts +1 -0
- package/src/assistant/gate.ts +4 -1
- package/src/assistant/index.ts +29 -1
- package/src/assistant/sessionDiscovery.ts +10 -1
- package/src/bootstrap/state.ts +6 -1
- package/src/buddy/CompanionSprite.tsx +1 -0
- package/src/buddy/observer.ts +6 -0
- package/src/buddy/useBuddyNotification.tsx +1 -0
- package/src/cli/handlers/util.tsx +1 -0
- package/src/cli/print.ts +4 -1
- package/src/cli/structuredIO.ts +6 -1
- package/src/commands/add-dir/add-dir.tsx +1 -0
- package/src/commands/branch/branch.ts +1 -0
- package/src/commands/bridge/bridge.tsx +2 -1
- package/src/commands/btw/btw.tsx +1 -0
- package/src/commands/buddy/index.ts +2 -1
- package/src/commands/chrome/chrome.tsx +1 -0
- package/src/commands/clear/caches.ts +1 -0
- package/src/commands/compact/compact.ts +1 -0
- package/src/commands/context/context-noninteractive.ts +1 -0
- package/src/commands/context/context.tsx +1 -0
- package/src/commands/copy/copy.tsx +2 -1
- package/src/commands/effort/effort.tsx +1 -0
- package/src/commands/extra-usage/extra-usage.tsx +1 -0
- package/src/commands/fast/fast.tsx +1 -0
- package/src/commands/fork/index.ts +2 -1
- package/src/commands/ide/ide.tsx +2 -1
- package/src/commands/insights.ts +1 -0
- package/src/commands/install-github-app/ApiKeyStep.tsx +1 -0
- package/src/commands/install-github-app/CheckExistingSecretStep.tsx +1 -0
- package/src/commands/install-github-app/ChooseRepoStep.tsx +1 -0
- package/src/commands/install-github-app/CreatingStep.tsx +1 -0
- package/src/commands/install-github-app/ErrorStep.tsx +1 -0
- package/src/commands/install-github-app/ExistingWorkflowStep.tsx +1 -0
- package/src/commands/install-github-app/InstallAppStep.tsx +1 -0
- package/src/commands/install-github-app/OAuthFlowStep.tsx +1 -0
- package/src/commands/install-github-app/SuccessStep.tsx +1 -0
- package/src/commands/install-github-app/WarningsStep.tsx +1 -0
- package/src/commands/install-github-app/install-github-app.tsx +2 -1
- package/src/commands/install.tsx +1 -0
- package/src/commands/login/CodexLogin.tsx +39 -12
- package/src/commands/login/CustomProviderLogin.tsx +45 -9
- package/src/commands/login/ThirdPartyLogin.tsx +24 -6
- package/src/commands/login/login.tsx +37 -10
- package/src/commands/login/profileDefaults.ts +25 -0
- package/src/commands/mcp/mcp.tsx +1 -0
- package/src/commands/mobile/mobile.tsx +1 -0
- package/src/commands/model/model.tsx +14 -3
- package/src/commands/peers/index.ts +2 -1
- package/src/commands/permissions/permissions.tsx +1 -0
- package/src/commands/plan/plan.tsx +1 -0
- package/src/commands/plugin/DiscoverPlugins.tsx +1 -0
- package/src/commands/plugin/ManageMarketplaces.tsx +1 -0
- package/src/commands/plugin/ManagePlugins.tsx +1 -0
- package/src/commands/plugin/PluginOptionsDialog.tsx +1 -0
- package/src/commands/plugin/PluginSettings.tsx +2 -1
- package/src/commands/plugin/UnifiedInstalledCell.tsx +1 -0
- package/src/commands/plugin/ValidatePlugin.tsx +1 -0
- package/src/commands/plugin/pluginDetailsHelpers.tsx +1 -0
- package/src/commands/rate-limit-options/rate-limit-options.tsx +1 -0
- package/src/commands/remote-setup/remote-setup.tsx +1 -0
- package/src/commands/resume/resume.tsx +1 -0
- package/src/commands/review/UltrareviewOverageDialog.tsx +1 -0
- package/src/commands/review/ultrareviewCommand.tsx +1 -0
- package/src/commands/session/session.tsx +1 -0
- package/src/commands/tag/tag.tsx +1 -0
- package/src/commands/terminalSetup/terminalSetup.tsx +1 -0
- package/src/commands/theme/theme.tsx +1 -0
- package/src/commands/thinkback/thinkback.tsx +2 -1
- package/src/commands/ultraplan.tsx +11 -1
- package/src/commands/upgrade/upgrade.tsx +1 -0
- package/src/commands/workflows/index.ts +2 -1
- package/src/components/AgentProgressLine.tsx +1 -0
- package/src/components/App.tsx +1 -0
- package/src/components/ApproveApiKey.tsx +1 -0
- package/src/components/AutoModeOptInDialog.tsx +1 -0
- package/src/components/AutoUpdater.tsx +1 -0
- package/src/components/AutoUpdaterWrapper.tsx +1 -0
- package/src/components/AwsAuthStatusBox.tsx +1 -0
- package/src/components/BaseTextInput.tsx +1 -0
- package/src/components/BashModeProgress.tsx +1 -0
- package/src/components/BridgeDialog.tsx +2 -1
- package/src/components/BypassPermissionsModeDialog.tsx +1 -0
- package/src/components/ChannelDowngradeDialog.tsx +1 -0
- package/src/components/ClaudeInChromeOnboarding.tsx +1 -0
- package/src/components/ClaudeMdExternalIncludesDialog.tsx +1 -0
- package/src/components/ClickableImageRef.tsx +1 -0
- package/src/components/CompactSummary.tsx +1 -0
- package/src/components/ConfigurableShortcutHint.tsx +1 -0
- package/src/components/ConsoleOAuthFlow.tsx +1 -0
- package/src/components/ContextSuggestions.tsx +1 -0
- package/src/components/ContextVisualization.tsx +2 -1
- package/src/components/CoordinatorAgentStatus.tsx +3 -4
- package/src/components/CostThresholdDialog.tsx +1 -0
- package/src/components/CtrlOToExpand.tsx +1 -0
- package/src/components/CustomSelect/SelectMulti.tsx +1 -0
- package/src/components/CustomSelect/select-input-option.tsx +1 -0
- package/src/components/CustomSelect/select-option.tsx +1 -0
- package/src/components/CustomSelect/select.tsx +2 -1
- package/src/components/CustomSelect/use-multi-select-state.ts +1 -0
- package/src/components/DesktopHandoff.tsx +1 -0
- package/src/components/DesktopUpsell/DesktopUpsellStartup.tsx +1 -0
- package/src/components/DevBar.tsx +1 -0
- package/src/components/DevChannelsDialog.tsx +1 -0
- package/src/components/DiagnosticsDisplay.tsx +1 -0
- package/src/components/EffortCallout.tsx +1 -0
- package/src/components/ExitFlow.tsx +1 -0
- package/src/components/FallbackToolUseErrorMessage.tsx +1 -0
- package/src/components/FastIcon.tsx +1 -0
- package/src/components/Feedback.tsx +1 -0
- package/src/components/FeedbackSurvey/FeedbackSurvey.tsx +1 -0
- package/src/components/FeedbackSurvey/FeedbackSurveyView.tsx +1 -0
- package/src/components/FeedbackSurvey/TranscriptSharePrompt.tsx +1 -0
- package/src/components/FeedbackSurvey/useFrustrationDetection.ts +6 -1
- package/src/components/FeedbackSurvey/useMemorySurvey.tsx +1 -0
- package/src/components/FeedbackSurvey/usePostCompactSurvey.tsx +2 -1
- package/src/components/FileEditToolDiff.tsx +1 -0
- package/src/components/FileEditToolUpdatedMessage.tsx +1 -0
- package/src/components/FileEditToolUseRejectedMessage.tsx +1 -0
- package/src/components/FilePathLink.tsx +1 -0
- package/src/components/FullscreenLayout.tsx +1 -0
- package/src/components/GlobalSearchDialog.tsx +2 -1
- package/src/components/HelpV2/Commands.tsx +1 -0
- package/src/components/HelpV2/HelpV2.tsx +1 -0
- package/src/components/HighlightedCode/Fallback.tsx +1 -0
- package/src/components/HighlightedCode.tsx +1 -0
- package/src/components/HistorySearchDialog.tsx +1 -0
- package/src/components/IdeAutoConnectDialog.tsx +1 -0
- package/src/components/IdeOnboardingDialog.tsx +1 -0
- package/src/components/IdeStatusIndicator.tsx +1 -0
- package/src/components/IdleReturnDialog.tsx +1 -0
- package/src/components/InvalidConfigDialog.tsx +1 -0
- package/src/components/InvalidSettingsDialog.tsx +1 -0
- package/src/components/KeybindingWarnings.tsx +1 -0
- package/src/components/LanguagePicker.tsx +1 -0
- package/src/components/LogSelector.tsx +2 -1
- package/src/components/LogoV2/ChannelsNotice.tsx +6 -5
- package/src/components/LogoV2/Clawd.tsx +1 -0
- package/src/components/LogoV2/CondensedLogo.tsx +1 -0
- package/src/components/LogoV2/Feed.tsx +1 -0
- package/src/components/LogoV2/FeedColumn.tsx +1 -0
- package/src/components/LogoV2/LogoV2.tsx +2 -1
- package/src/components/LogoV2/OverageCreditUpsell.tsx +1 -0
- package/src/components/LogoV2/WelcomeV2.tsx +1 -0
- package/src/components/LogoV2/feedConfigs.tsx +1 -0
- package/src/components/MCPServerApprovalDialog.tsx +1 -0
- package/src/components/MCPServerDesktopImportDialog.tsx +1 -0
- package/src/components/MCPServerMultiselectDialog.tsx +1 -0
- package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.tsx +1 -0
- package/src/components/Markdown.tsx +1 -0
- package/src/components/MemoryUsageIndicator.tsx +1 -0
- package/src/components/Message.tsx +2 -1
- package/src/components/MessageModel.tsx +1 -0
- package/src/components/MessageResponse.tsx +1 -0
- package/src/components/MessageRow.tsx +1 -0
- package/src/components/MessageSelector.tsx +2 -1
- package/src/components/MessageTimestamp.tsx +1 -0
- package/src/components/Messages.tsx +1 -0
- package/src/components/ModelPicker.tsx +4 -3
- package/src/components/NativeAutoUpdater.tsx +1 -0
- package/src/components/NotebookEditToolUseRejectedMessage.tsx +1 -0
- package/src/components/Onboarding.tsx +1 -0
- package/src/components/OutputStylePicker.tsx +1 -0
- package/src/components/PackageManagerAutoUpdater.tsx +1 -0
- package/src/components/PrBadge.tsx +1 -0
- package/src/components/PromptInput/HistorySearchInput.tsx +1 -0
- package/src/components/PromptInput/Notifications.tsx +1 -0
- package/src/components/PromptInput/PromptInput.tsx +10 -8
- package/src/components/PromptInput/PromptInputFooter.tsx +1 -0
- package/src/components/PromptInput/PromptInputFooterLeftSide.tsx +1 -0
- package/src/components/PromptInput/PromptInputFooterSuggestions.tsx +1 -0
- package/src/components/PromptInput/PromptInputHelpMenu.tsx +1 -0
- package/src/components/PromptInput/PromptInputModeIndicator.tsx +1 -0
- package/src/components/PromptInput/PromptInputStashNotice.tsx +1 -0
- package/src/components/PromptInput/SandboxPromptFooterHint.tsx +1 -0
- package/src/components/PromptInput/ShimmeredInput.tsx +1 -0
- package/src/components/PromptInput/VoiceIndicator.tsx +1 -0
- package/src/components/QuickOpenDialog.tsx +2 -1
- package/src/components/RemoteEnvironmentDialog.tsx +2 -1
- package/src/components/ResumeTask.tsx +1 -0
- package/src/components/SandboxViolationExpandedView.tsx +1 -0
- package/src/components/SearchBox.tsx +1 -0
- package/src/components/SessionBackgroundHint.tsx +1 -0
- package/src/components/SessionPreview.tsx +1 -0
- package/src/components/Settings/Config.tsx +1 -0
- package/src/components/Settings/Settings.tsx +1 -0
- package/src/components/Settings/Status.tsx +2 -1
- package/src/components/Settings/Usage.tsx +1 -0
- package/src/components/ShowInIDEPrompt.tsx +1 -0
- package/src/components/SkillImprovementSurvey.tsx +1 -0
- package/src/components/Spinner/FlashingChar.tsx +1 -0
- package/src/components/Spinner/GlimmerMessage.tsx +1 -0
- package/src/components/Spinner/ShimmerChar.tsx +1 -0
- package/src/components/Spinner/SpinnerAnimationRow.tsx +1 -0
- package/src/components/Spinner/SpinnerGlyph.tsx +1 -0
- package/src/components/Spinner/TeammateSpinnerTree.tsx +1 -0
- package/src/components/Spinner/utils.ts +1 -0
- package/src/components/Spinner.tsx +2 -1
- package/src/components/Stats.tsx +2 -1
- package/src/components/StatusNotices.tsx +1 -0
- package/src/components/StructuredDiff/Fallback.tsx +1 -0
- package/src/components/StructuredDiff.tsx +2 -1
- package/src/components/StructuredDiffList.tsx +1 -0
- package/src/components/TaskListV2.tsx +1 -0
- package/src/components/TeammateViewHeader.tsx +1 -0
- package/src/components/TeleportError.tsx +1 -0
- package/src/components/TeleportProgress.tsx +1 -0
- package/src/components/TeleportRepoMismatchDialog.tsx +1 -0
- package/src/components/TeleportResumeWrapper.tsx +1 -0
- package/src/components/TextInput.tsx +1 -0
- package/src/components/ThemePicker.tsx +1 -0
- package/src/components/ThinkingToggle.tsx +1 -0
- package/src/components/TokenWarning.tsx +1 -0
- package/src/components/ToolUseLoader.tsx +1 -0
- package/src/components/TrustDialog/TrustDialog.tsx +1 -0
- package/src/components/ValidationErrorsList.tsx +1 -0
- package/src/components/VimTextInput.tsx +1 -0
- package/src/components/VirtualMessageList.tsx +1 -0
- package/src/components/WorkflowMultiselectDialog.tsx +1 -0
- package/src/components/agents/AgentDetail.tsx +1 -0
- package/src/components/agents/AgentEditor.tsx +1 -0
- package/src/components/agents/AgentNavigationFooter.tsx +1 -0
- package/src/components/agents/AgentsList.tsx +2 -1
- package/src/components/agents/AgentsMenu.tsx +2 -1
- package/src/components/agents/ColorPicker.tsx +1 -0
- package/src/components/agents/ModelSelector.tsx +1 -0
- package/src/components/agents/ToolSelector.tsx +2 -1
- package/src/components/agents/generateAgent.ts +1 -0
- package/src/components/agents/new-agent-creation/CreateAgentWizard.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx +1 -0
- package/src/components/design-system/Byline.tsx +1 -0
- package/src/components/design-system/Dialog.tsx +1 -0
- package/src/components/design-system/Divider.tsx +1 -0
- package/src/components/design-system/FuzzyPicker.tsx +1 -0
- package/src/components/design-system/KeyboardShortcutHint.tsx +1 -0
- package/src/components/design-system/ListItem.tsx +1 -0
- package/src/components/design-system/LoadingState.tsx +1 -0
- package/src/components/design-system/Pane.tsx +1 -0
- package/src/components/design-system/ProgressBar.tsx +1 -0
- package/src/components/design-system/Ratchet.tsx +1 -0
- package/src/components/design-system/StatusIcon.tsx +1 -0
- package/src/components/design-system/Tabs.tsx +2 -1
- package/src/components/design-system/ThemeProvider.tsx +1 -0
- package/src/components/design-system/ThemedBox.tsx +1 -0
- package/src/components/design-system/ThemedText.tsx +1 -0
- package/src/components/diff/DiffDetailView.tsx +1 -0
- package/src/components/diff/DiffDialog.tsx +1 -0
- package/src/components/diff/DiffFileList.tsx +1 -0
- package/src/components/grove/Grove.tsx +2 -1
- package/src/components/hooks/HooksConfigMenu.tsx +2 -1
- package/src/components/hooks/PromptDialog.tsx +1 -0
- package/src/components/hooks/SelectEventMode.tsx +1 -0
- package/src/components/hooks/SelectHookMode.tsx +1 -0
- package/src/components/hooks/SelectMatcherMode.tsx +1 -0
- package/src/components/hooks/ViewHookMode.tsx +1 -0
- package/src/components/mcp/CapabilitiesSection.tsx +1 -0
- package/src/components/mcp/ElicitationDialog.tsx +1 -0
- package/src/components/mcp/MCPAgentServerMenu.tsx +1 -0
- package/src/components/mcp/MCPListPanel.tsx +2 -1
- package/src/components/mcp/MCPReconnect.tsx +1 -0
- package/src/components/mcp/MCPRemoteServerMenu.tsx +1 -0
- package/src/components/mcp/MCPSettings.tsx +2 -1
- package/src/components/mcp/MCPStdioServerMenu.tsx +1 -0
- package/src/components/mcp/MCPToolDetailView.tsx +1 -0
- package/src/components/mcp/MCPToolListView.tsx +1 -0
- package/src/components/mcp/McpParsingWarnings.tsx +1 -0
- package/src/components/memory/MemoryFileSelector.tsx +2 -1
- package/src/components/memory/MemoryUpdateNotification.tsx +1 -0
- package/src/components/messageActions.tsx +1 -0
- package/src/components/messages/AdvisorMessage.tsx +1 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.tsx +1 -0
- package/src/components/messages/AssistantTextMessage.tsx +1 -0
- package/src/components/messages/AssistantThinkingMessage.tsx +1 -0
- package/src/components/messages/AssistantToolUseMessage.tsx +1 -0
- package/src/components/messages/AttachmentMessage.tsx +2 -1
- package/src/components/messages/CollapsedReadSearchContent.tsx +2 -1
- package/src/components/messages/GroupedToolUseContent.tsx +1 -0
- package/src/components/messages/HighlightedThinkingText.tsx +1 -0
- package/src/components/messages/HookProgressMessage.tsx +1 -0
- package/src/components/messages/PlanApprovalMessage.tsx +1 -0
- package/src/components/messages/RateLimitMessage.tsx +1 -0
- package/src/components/messages/ShutdownMessage.tsx +1 -0
- package/src/components/messages/SystemAPIErrorMessage.tsx +1 -0
- package/src/components/messages/SystemTextMessage.tsx +2 -1
- package/src/components/messages/TaskAssignmentMessage.tsx +1 -0
- package/src/components/messages/UserAgentNotificationMessage.tsx +1 -0
- package/src/components/messages/UserBashInputMessage.tsx +1 -0
- package/src/components/messages/UserBashOutputMessage.tsx +1 -0
- package/src/components/messages/UserChannelMessage.tsx +1 -0
- package/src/components/messages/UserCommandMessage.tsx +1 -0
- package/src/components/messages/UserImageMessage.tsx +1 -0
- package/src/components/messages/UserLocalCommandOutputMessage.tsx +1 -0
- package/src/components/messages/UserMemoryInputMessage.tsx +1 -0
- package/src/components/messages/UserPlanMessage.tsx +1 -0
- package/src/components/messages/UserResourceUpdateMessage.tsx +1 -0
- package/src/components/messages/UserTeammateMessage.tsx +1 -0
- package/src/components/messages/UserTextMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/utils.tsx +1 -0
- package/src/components/messages/nullRenderingAttachments.ts +1 -0
- package/src/components/messages/teamMemCollapsed.tsx +1 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.tsx +1 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.tsx +1 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +1 -0
- package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx +1 -0
- package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.tsx +2 -1
- package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.tsx +1 -0
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx +1 -0
- package/src/components/permissions/FallbackPermissionRequest.tsx +1 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.tsx +1 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +1 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +1 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +1 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.tsx +2 -1
- package/src/components/permissions/PermissionDecisionDebugInfo.tsx +2 -1
- package/src/components/permissions/PermissionDialog.tsx +1 -0
- package/src/components/permissions/PermissionExplanation.tsx +2 -1
- package/src/components/permissions/PermissionPrompt.tsx +2 -1
- package/src/components/permissions/PermissionRequest.tsx +1 -0
- package/src/components/permissions/PermissionRequestTitle.tsx +1 -0
- package/src/components/permissions/PermissionRuleExplanation.tsx +1 -0
- package/src/components/permissions/SandboxPermissionRequest.tsx +1 -0
- package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.tsx +1 -0
- package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.tsx +1 -0
- package/src/components/permissions/WorkerBadge.tsx +1 -0
- package/src/components/permissions/WorkerPendingPermission.tsx +1 -0
- package/src/components/permissions/rules/AddPermissionRules.tsx +1 -0
- package/src/components/permissions/rules/AddWorkspaceDirectory.tsx +2 -1
- package/src/components/permissions/rules/PermissionRuleDescription.tsx +1 -0
- package/src/components/permissions/rules/PermissionRuleInput.tsx +1 -0
- package/src/components/permissions/rules/PermissionRuleList.tsx +2 -1
- package/src/components/permissions/rules/RecentDenialsTab.tsx +1 -0
- package/src/components/permissions/rules/RemoveWorkspaceDirectory.tsx +1 -0
- package/src/components/permissions/rules/WorkspaceTab.tsx +1 -0
- package/src/components/sandbox/SandboxConfigTab.tsx +1 -0
- package/src/components/sandbox/SandboxDependenciesTab.tsx +1 -0
- package/src/components/sandbox/SandboxDoctorSection.tsx +1 -0
- package/src/components/sandbox/SandboxOverridesTab.tsx +1 -0
- package/src/components/sandbox/SandboxSettings.tsx +1 -0
- package/src/components/shell/ExpandShellOutputContext.tsx +1 -0
- package/src/components/shell/OutputLine.tsx +1 -0
- package/src/components/shell/ShellProgressMessage.tsx +1 -0
- package/src/components/shell/ShellTimeDisplay.tsx +1 -0
- package/src/components/skills/SkillsMenu.tsx +1 -0
- package/src/components/tasks/AsyncAgentDetailDialog.tsx +1 -0
- package/src/components/tasks/BackgroundTask.tsx +1 -0
- package/src/components/tasks/BackgroundTaskStatus.tsx +2 -1
- package/src/components/tasks/BackgroundTasksDialog.tsx +2 -1
- package/src/components/tasks/DreamDetailDialog.tsx +1 -0
- package/src/components/tasks/InProcessTeammateDetailDialog.tsx +1 -0
- package/src/components/tasks/RemoteSessionDetailDialog.tsx +2 -1
- package/src/components/tasks/RemoteSessionProgress.tsx +1 -0
- package/src/components/tasks/ShellDetailDialog.tsx +2 -1
- package/src/components/tasks/ShellProgress.tsx +1 -0
- package/src/components/tasks/taskStatusUtils.tsx +1 -0
- package/src/components/teams/TeamStatus.tsx +1 -0
- package/src/components/teams/TeamsDialog.tsx +2 -1
- package/src/components/ui/OrderedList.tsx +1 -0
- package/src/components/ui/OrderedListItem.tsx +1 -0
- package/src/components/ui/TreeSelect.tsx +2 -1
- package/src/components/wizard/WizardDialogLayout.tsx +1 -0
- package/src/components/wizard/WizardProvider.tsx +2 -1
- package/src/components/wizard/useWizard.ts +1 -0
- package/src/constants/betas.ts +1 -0
- package/src/constants/prompts.ts +1 -0
- package/src/context/QueuedMessageContext.tsx +1 -0
- package/src/context/fpsMetrics.tsx +1 -0
- package/src/context/mailbox.tsx +1 -0
- package/src/context/modalContext.tsx +1 -0
- package/src/context/overlayContext.tsx +1 -0
- package/src/context/promptOverlayContext.tsx +1 -0
- package/src/context/stats.tsx +1 -0
- package/src/context/voice.tsx +1 -0
- package/src/cost-tracker.ts +1 -0
- package/src/dialogLaunchers.tsx +1 -0
- package/src/entrypoints/agentSdkTypes.ts +4 -17
- package/src/entrypoints/cli.tsx +1 -0
- package/src/entrypoints/sdk/controlTypes.ts +86 -10
- package/src/entrypoints/sdk/coreTypes.generated.ts +99 -2
- package/src/entrypoints/sdk/runtimeTypes.ts +53 -18
- package/src/entrypoints/sdk/settingsTypes.generated.ts +2 -1
- package/src/hooks/notifs/useAntOrgWarningNotification.ts +1 -1
- package/src/hooks/notifs/useCanSwitchToExistingSubscription.tsx +1 -0
- package/src/hooks/notifs/useDeprecationWarningNotification.tsx +1 -0
- package/src/hooks/notifs/useFastModeNotification.tsx +1 -0
- package/src/hooks/notifs/useIDEStatusIndicator.tsx +1 -0
- package/src/hooks/notifs/useInstallMessages.tsx +1 -0
- package/src/hooks/notifs/useLspInitializationNotification.tsx +1 -0
- package/src/hooks/notifs/useMcpConnectivityStatus.tsx +1 -0
- package/src/hooks/notifs/useNpmDeprecationNotification.tsx +1 -0
- package/src/hooks/notifs/usePluginAutoupdateNotification.tsx +1 -0
- package/src/hooks/notifs/usePluginInstallationStatus.tsx +1 -0
- package/src/hooks/notifs/useRateLimitWarningNotification.tsx +1 -0
- package/src/hooks/useCanUseTool.tsx +2 -1
- package/src/hooks/useChromeExtensionNotification.tsx +1 -0
- package/src/hooks/useClaudeCodeHintRecommendation.tsx +1 -0
- package/src/hooks/useCommandKeybindings.tsx +1 -0
- package/src/hooks/useDiffData.ts +1 -0
- package/src/hooks/useIDEIntegration.tsx +1 -0
- package/src/hooks/useLspPluginRecommendation.tsx +1 -0
- package/src/hooks/useOfficialMarketplaceNotification.tsx +1 -0
- package/src/hooks/usePluginRecommendationBase.tsx +1 -0
- package/src/hooks/usePromptsFromClaudeInChrome.tsx +1 -0
- package/src/hooks/useRemoteSession.ts +1 -0
- package/src/hooks/useReplBridge.tsx +1 -0
- package/src/hooks/useSSHSession.ts +1 -0
- package/src/hooks/useTeleportResume.tsx +1 -0
- package/src/hooks/useTurnDiffs.ts +1 -0
- package/src/hooks/useTypeahead.tsx +1 -0
- package/src/hooks/useVoiceIntegration.tsx +1 -0
- package/src/ink/Ansi.tsx +1 -0
- package/src/ink/bidi.ts +1 -0
- package/src/ink/components/AlternateScreen.tsx +1 -0
- package/src/ink/components/Box.tsx +1 -0
- package/src/ink/components/Button.tsx +1 -0
- package/src/ink/components/ClockContext.tsx +1 -0
- package/src/ink/components/Link.tsx +1 -0
- package/src/ink/components/Newline.tsx +1 -0
- package/src/ink/components/NoSelect.tsx +1 -0
- package/src/ink/components/RawAnsi.tsx +1 -0
- package/src/ink/components/ScrollBox.tsx +1 -0
- package/src/ink/components/TerminalFocusContext.tsx +1 -0
- package/src/ink/components/Text.tsx +1 -0
- package/src/ink/ink.tsx +1 -0
- package/src/ink/reconciler.ts +1 -0
- package/src/ink/render-to-screen.ts +1 -0
- package/src/interactiveHelpers.tsx +4 -4
- package/src/keybindings/KeybindingContext.tsx +2 -1
- package/src/keybindings/KeybindingProviderSetup.tsx +1 -0
- package/src/keybindings/parser.ts +1 -0
- package/src/keybindings/template.ts +1 -0
- package/src/keybindings/validate.ts +1 -0
- package/src/main.tsx +5 -7
- package/src/memdir/findRelevantMemories.ts +1 -0
- package/src/native-ts/color-diff/index.ts +1 -0
- package/src/proactive/index.ts +26 -1
- package/src/proactive/useProactive.ts +13 -1
- package/src/query/stopHooks.ts +1 -0
- package/src/query.ts +1 -0
- package/src/remote/SessionsWebSocket.ts +1 -0
- package/src/screens/Doctor.tsx +2 -1
- package/src/screens/REPL.tsx +13 -6
- package/src/screens/ResumeConversation.tsx +1 -0
- package/src/services/AgentSummary/agentSummary.ts +1 -0
- package/src/services/PromptSuggestion/promptSuggestion.ts +1 -0
- package/src/services/api/claude.ts +33 -31
- package/src/services/api/client.ts +34 -31
- package/src/services/api/errors.ts +1 -0
- package/src/services/api/logging.ts +1 -0
- package/src/services/api/openaiShim.ts +35 -8
- package/src/services/api/withRetry.ts +1 -0
- package/src/services/autoDream/autoDream.ts +1 -0
- package/src/services/claudeAiLimits.ts +1 -0
- package/src/services/compact/autoCompact.ts +1 -0
- package/src/services/compact/cachedMicrocompact.ts +56 -4
- package/src/services/compact/compact.ts +1 -0
- package/src/services/compact/microCompact.ts +1 -0
- package/src/services/compact/postCompactCleanup.ts +1 -0
- package/src/services/compact/reactiveCompact.ts +16 -1
- package/src/services/compact/sessionMemoryCompact.ts +1 -0
- package/src/services/compact/snipCompact.ts +18 -1
- package/src/services/compact/snipProjection.ts +6 -1
- package/src/services/contextCollapse/index.ts +33 -1
- package/src/services/extractMemories/extractMemories.ts +1 -0
- package/src/services/mcp/MCPConnectionManager.tsx +1 -0
- package/src/services/mcp/channelAllowlist.ts +1 -1
- package/src/services/mcp/channelNotification.ts +90 -4
- package/src/services/mcp/channelPermissions.ts +1 -1
- package/src/services/mcp/client.ts +1 -0
- package/src/services/mcp/useManageMCPConnections.ts +5 -3
- package/src/services/notifier.ts +1 -0
- package/src/services/rateLimitMocking.ts +1 -0
- package/src/services/skillSearch/localSearch.ts +1 -1
- package/src/services/skillSearch/prefetch.ts +10 -1
- package/src/services/tips/tipRegistry.ts +1 -0
- package/src/services/toolUseSummary/toolUseSummaryGenerator.ts +1 -0
- package/src/services/tools/StreamingToolExecutor.ts +1 -0
- package/src/services/tools/toolOrchestration.ts +1 -0
- package/src/services/vcr.ts +1 -0
- package/src/services/voice.ts +1 -0
- package/src/setup.ts +1 -0
- package/src/skills/bundled/claudeInChrome.ts +1 -0
- package/src/skills/bundled/keybindings.ts +1 -0
- package/src/skills/bundled/skillify.ts +1 -0
- package/src/state/AppState.tsx +10 -7
- package/src/tasks/LocalMainSessionTask.ts +1 -0
- package/src/tasks/LocalShellTask/LocalShellTask.tsx +1 -0
- package/src/tasks/LocalShellTask/killShellTasks.ts +1 -0
- package/src/tasks/RemoteAgentTask/RemoteAgentTask.tsx +1 -0
- package/src/tools/AgentTool/AgentTool.tsx +30 -3
- package/src/tools/AgentTool/UI.tsx +2 -1
- package/src/tools/AgentTool/agentToolUtils.ts +1 -0
- package/src/tools/AgentTool/builtInAgents.ts +1 -0
- package/src/tools/AgentTool/forkSubagent.ts +1 -0
- package/src/tools/AgentTool/loadAgentsDir.ts +9 -0
- package/src/tools/AgentTool/runAgent.ts +2 -0
- package/src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx +1 -0
- package/src/tools/BashTool/BashTool.tsx +1 -0
- package/src/tools/BashTool/BashToolResultMessage.tsx +1 -0
- package/src/tools/BashTool/UI.tsx +1 -0
- package/src/tools/BriefTool/UI.tsx +1 -0
- package/src/tools/FileEditTool/UI.tsx +1 -0
- package/src/tools/FileEditTool/utils.ts +1 -0
- package/src/tools/FileReadTool/FileReadTool.ts +1 -0
- package/src/tools/FileReadTool/imageProcessor.ts +1 -0
- package/src/tools/FileWriteTool/UI.tsx +2 -1
- package/src/tools/GrepTool/UI.tsx +1 -0
- package/src/tools/LSPTool/UI.tsx +1 -0
- package/src/tools/MCPTool/UI.tsx +1 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.ts +1 -0
- package/src/tools/NotebookEditTool/UI.tsx +1 -0
- package/src/tools/PowerShellTool/PowerShellTool.tsx +1 -0
- package/src/tools/SendMessageTool/SendMessageTool.ts +1 -0
- package/src/tools/SkillTool/SkillTool.ts +1 -0
- package/src/tools/TaskOutputTool/TaskOutputTool.tsx +1 -0
- package/src/tools/TaskStopTool/UI.tsx +1 -0
- package/src/tools/ToolSearchTool/prompt.ts +1 -0
- package/src/tools/TungstenTool/TungstenLiveMonitor.ts +3 -0
- package/src/tools/WebBrowserTool/WebBrowserPanel.ts +3 -1
- package/src/tools/WebFetchTool/utils.ts +1 -0
- package/src/tools/WebSearchTool/WebSearchTool.ts +1 -0
- package/src/tools/WorkflowTool/createWorkflowCommand.ts +3 -1
- package/src/tools/testing/TestingPermissionTool.tsx +1 -0
- package/src/tools/utils.ts +1 -0
- package/src/types/commands-js.d.ts +13 -0
- package/src/types/diff.d.ts +1 -0
- package/src/types/hooks.ts +1 -0
- package/src/types/macro.d.ts +15 -0
- package/src/types/markdown.d.ts +4 -0
- package/src/types/message.ts +56 -107
- package/src/types/react-compiler-runtime.d.ts +4 -0
- package/src/types/utils.ts +3 -3
- package/src/utils/advisor.ts +1 -0
- package/src/utils/asciicast.ts +1 -0
- package/src/utils/attachments.ts +1 -0
- package/src/utils/attribution.ts +1 -0
- package/src/utils/autoRunIssue.tsx +1 -0
- package/src/utils/claudeInChrome/mcpServer.ts +1 -0
- package/src/utils/claudeInChrome/setup.ts +1 -0
- package/src/utils/claudemd.ts +1 -0
- package/src/utils/cleanup.ts +1 -0
- package/src/utils/cliHighlight.ts +1 -0
- package/src/utils/collapseReadSearch.ts +1 -0
- package/src/utils/computerUse/executor.ts +1 -0
- package/src/utils/computerUse/gates.ts +1 -0
- package/src/utils/computerUse/hostAdapter.ts +1 -0
- package/src/utils/computerUse/inputLoader.ts +1 -0
- package/src/utils/computerUse/mcpServer.ts +1 -0
- package/src/utils/computerUse/setup.ts +1 -0
- package/src/utils/computerUse/swiftLoader.ts +1 -0
- package/src/utils/computerUse/wrapper.tsx +2 -1
- package/src/utils/context.ts +1 -0
- package/src/utils/contextAnalysis.ts +1 -0
- package/src/utils/conversationRecovery.ts +1 -0
- package/src/utils/deepLink/protocolHandler.ts +1 -0
- package/src/utils/diff.ts +1 -0
- package/src/utils/effort.ts +1 -0
- package/src/utils/envUtils.ts +1 -0
- package/src/utils/execFileNoThrowPortable.ts +1 -0
- package/src/utils/fileHistory.ts +1 -0
- package/src/utils/filePersistence/filePersistence.ts +1 -0
- package/src/utils/filePersistence/outputsScanner.ts +1 -0
- package/src/utils/gitDiff.ts +1 -0
- package/src/utils/groupToolUses.ts +1 -0
- package/src/utils/hooks/hooksConfigManager.ts +1 -0
- package/src/utils/hooks/skillImprovement.ts +1 -0
- package/src/utils/hooks.ts +1 -0
- package/src/utils/imagePaste.ts +1 -0
- package/src/utils/log.ts +1 -0
- package/src/utils/logoV2Utils.ts +6 -6
- package/src/utils/messageQueueManager.ts +1 -0
- package/src/utils/messages.ts +122 -100
- package/src/utils/model/agent.ts +43 -2
- package/src/utils/model/configs.ts +1 -1
- package/src/utils/model/deprecation.ts +1 -0
- package/src/utils/model/fetchModels.ts +11 -1
- package/src/utils/model/model.ts +31 -0
- package/src/utils/model/modelCapabilities.ts +1 -0
- package/src/utils/model/modelOptions.ts +68 -14
- package/src/utils/model/modelStrings.ts +1 -0
- package/src/utils/model/platformProfiles.ts +524 -0
- package/src/utils/model/thirdPartyProviders.ts +158 -15
- package/src/utils/modelCost.ts +1 -0
- package/src/utils/notebook.ts +1 -0
- package/src/utils/permissions/classifierDecision.ts +1 -0
- package/src/utils/permissions/pathValidation.ts +1 -0
- package/src/utils/permissions/permissionExplainer.ts +1 -0
- package/src/utils/plugins/loadPluginHooks.ts +1 -0
- package/src/utils/plugins/lspPluginIntegration.ts +1 -0
- package/src/utils/plugins/pluginLoader.ts +1 -0
- package/src/utils/preflightChecks.tsx +2 -1
- package/src/utils/processUserInput/processSlashCommand.tsx +13 -3
- package/src/utils/queryHelpers.ts +1 -0
- package/src/utils/readFileInRange.ts +1 -0
- package/src/utils/sandbox/sandbox-adapter.ts +24 -22
- package/src/utils/sessionFileAccessHooks.ts +1 -0
- package/src/utils/sessionRestore.ts +1 -0
- package/src/utils/sessionStorage.ts +84 -46
- package/src/utils/settings/types.ts +72 -0
- package/src/utils/shell/prefix.ts +1 -0
- package/src/utils/sideQuery.ts +1 -0
- package/src/utils/sliceAnsi.ts +1 -0
- package/src/utils/staticRender.tsx +1 -0
- package/src/utils/stats.ts +1 -0
- package/src/utils/status.tsx +1 -0
- package/src/utils/swarm/It2SetupPrompt.tsx +2 -1
- package/src/utils/swarm/teammateModel.ts +1 -0
- package/src/utils/taskSummary.ts +6 -1
- package/src/utils/textHighlighting.ts +1 -0
- package/src/utils/thinking.ts +1 -0
- package/src/utils/toolResultStorage.ts +1 -0
- package/src/utils/transcriptSearch.ts +1 -0
- package/src/utils/worktree.ts +1 -0
- package/stubs/@anthropic-ai/mcpb/index.d.ts +23 -1
- package/stubs/@anthropic-ai/sandbox-runtime/index.d.ts +39 -1
- package/.gitignore.bak +0 -11
- package/bin/mumuclaw +0 -154
- package/bin/opencc +0 -50
- package/src/channels/heartbeat-channel.mjs +0 -280
|
@@ -1 +1,39 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type FsReadRestrictionConfig = any
|
|
2
|
+
export type FsWriteRestrictionConfig = any
|
|
3
|
+
export type IgnoreViolationsConfig = any
|
|
4
|
+
export type NetworkHostPattern = any
|
|
5
|
+
export type NetworkRestrictionConfig = any
|
|
6
|
+
export type SandboxAskCallback = any
|
|
7
|
+
export type SandboxDependencyCheck = any
|
|
8
|
+
export type SandboxRuntimeConfig = any
|
|
9
|
+
export type SandboxViolationEvent = any
|
|
10
|
+
|
|
11
|
+
export class SandboxManager {
|
|
12
|
+
constructor(...args: any[])
|
|
13
|
+
static checkDependencies(...args: any[]): any
|
|
14
|
+
static isSupportedPlatform(...args: any[]): boolean
|
|
15
|
+
static wrapWithSandbox(...args: any[]): any
|
|
16
|
+
static initialize(...args: any[]): Promise<void>
|
|
17
|
+
static updateConfig(...args: any[]): void
|
|
18
|
+
static reset(...args: any[]): Promise<void>
|
|
19
|
+
static getFsReadConfig(...args: any[]): any
|
|
20
|
+
static getFsWriteConfig(...args: any[]): any
|
|
21
|
+
static getNetworkRestrictionConfig(...args: any[]): any
|
|
22
|
+
static getIgnoreViolations(...args: any[]): any
|
|
23
|
+
static getAllowUnixSockets(...args: any[]): any
|
|
24
|
+
static getAllowLocalBinding(...args: any[]): any
|
|
25
|
+
static getEnableWeakerNestedSandbox(...args: any[]): any
|
|
26
|
+
static getProxyPort(...args: any[]): any
|
|
27
|
+
static getSocksProxyPort(...args: any[]): any
|
|
28
|
+
static getLinuxHttpSocketPath(...args: any[]): any
|
|
29
|
+
static getLinuxSocksSocketPath(...args: any[]): any
|
|
30
|
+
static waitForNetworkInitialization(...args: any[]): Promise<boolean>
|
|
31
|
+
static getSandboxViolationStore(...args: any[]): SandboxViolationStore
|
|
32
|
+
static annotateStderrWithSandboxFailures(...args: any[]): string
|
|
33
|
+
static cleanupAfterCommand(...args: any[]): void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const SandboxRuntimeConfigSchema: any
|
|
37
|
+
export class SandboxViolationStore {
|
|
38
|
+
constructor(...args: any[])
|
|
39
|
+
}
|
package/.gitignore.bak
DELETED
package/bin/mumuclaw
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# ────────────────────────────────────────────────────────────────
|
|
3
|
-
# mumuclaw — AI Agent 守护平台(OpenClaw 替代品)
|
|
4
|
-
#
|
|
5
|
-
# 基于 mumucc,默认启用:
|
|
6
|
-
# - Channels(微信/心跳/自定义通道)
|
|
7
|
-
# - 所有 MCP 工具权限
|
|
8
|
-
# - 心跳 channel(GLM-5-turbo 预筛选)
|
|
9
|
-
# - 微信 wechat_reply 自动批准
|
|
10
|
-
#
|
|
11
|
-
# 用法:
|
|
12
|
-
# mumuclaw # 交互模式
|
|
13
|
-
# mumuclaw --daemon # 守护进程模式(无 TTY)
|
|
14
|
-
# mumuclaw --model glm # 指定模型预设
|
|
15
|
-
# mumuclaw --model minimax # MiniMax 预设
|
|
16
|
-
# mumuclaw --model claude # Claude Sonnet(默认)
|
|
17
|
-
# ────────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
set -euo pipefail
|
|
20
|
-
|
|
21
|
-
SCRIPT_PATH="$(cd "$(dirname "$(readlink -f "$0" 2>/dev/null || python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0")")" && pwd)"
|
|
22
|
-
PROJECT_ROOT="$(dirname "$SCRIPT_PATH")"
|
|
23
|
-
|
|
24
|
-
# ── 模型预设 ──
|
|
25
|
-
MODEL_PRESET="claude"
|
|
26
|
-
EXTRA_ARGS=()
|
|
27
|
-
|
|
28
|
-
# 解析 mumuclaw 专属参数
|
|
29
|
-
while [[ $# -gt 0 ]]; do
|
|
30
|
-
case "$1" in
|
|
31
|
-
--model)
|
|
32
|
-
MODEL_PRESET="$2"
|
|
33
|
-
shift 2
|
|
34
|
-
;;
|
|
35
|
-
--daemon)
|
|
36
|
-
DAEMON_MODE=1
|
|
37
|
-
shift
|
|
38
|
-
;;
|
|
39
|
-
*)
|
|
40
|
-
EXTRA_ARGS+=("$1")
|
|
41
|
-
shift
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
done
|
|
45
|
-
|
|
46
|
-
case "$MODEL_PRESET" in
|
|
47
|
-
glm|glm-5-turbo)
|
|
48
|
-
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
|
|
49
|
-
export ANTHROPIC_AUTH_TOKEN="fb1c93822c2947d3b84019d1f6c525ee.fnpWi89jlC6IxPLQ"
|
|
50
|
-
# mumucc: 不再清空 ANTHROPIC_API_KEY,保留 claude.ai 登录态以支持 /model 切换到 Claude
|
|
51
|
-
export ANTHROPIC_DEFAULT_SONNET_MODEL="${GLM_MODEL:-glm-5-turbo}"
|
|
52
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="${GLM_MODEL:-glm-5-turbo}"
|
|
53
|
-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${GLM_MODEL:-glm-5-turbo}"
|
|
54
|
-
;;
|
|
55
|
-
glm-5.1)
|
|
56
|
-
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
|
|
57
|
-
export ANTHROPIC_AUTH_TOKEN="fb1c93822c2947d3b84019d1f6c525ee.fnpWi89jlC6IxPLQ"
|
|
58
|
-
# mumucc: 不再清空 ANTHROPIC_API_KEY,保留 claude.ai 登录态以支持 /model 切换到 Claude
|
|
59
|
-
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.1"
|
|
60
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.1"
|
|
61
|
-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-5.1"
|
|
62
|
-
;;
|
|
63
|
-
minimax|m2.7)
|
|
64
|
-
export ANTHROPIC_BASE_URL="https://api.minimaxi.com/anthropic"
|
|
65
|
-
export ANTHROPIC_AUTH_TOKEN="sk-cp-rWK5pwrquDncnYIfVknvMNEBDvMR7-xPOtg5SBX9erW3_hkPUJhU6qYoZRzStCTqBppfvK4AVj4OPCpCICtScSm-_5obP48cEl8MwchmA0A5eo8kE3Vt4Dw"
|
|
66
|
-
# mumucc: 不再清空 ANTHROPIC_API_KEY,保留 claude.ai 登录态以支持 /model 切换到 Claude
|
|
67
|
-
export ANTHROPIC_DEFAULT_SONNET_MODEL="${MINIMAX_MODEL:-MiniMax-M2.7-highspeed}"
|
|
68
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="${MINIMAX_MODEL:-MiniMax-M2.7-highspeed}"
|
|
69
|
-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${MINIMAX_MODEL:-MiniMax-M2.7-highspeed}"
|
|
70
|
-
;;
|
|
71
|
-
claude|sonnet)
|
|
72
|
-
# mumucc: 确保使用 claude.ai OAuth,清除所有第三方 provider 配置
|
|
73
|
-
# isAnthropicAuthEnabled() 检测到 ANTHROPIC_AUTH_TOKEN 存在时会禁用 OAuth
|
|
74
|
-
unset ANTHROPIC_AUTH_TOKEN
|
|
75
|
-
unset ANTHROPIC_BASE_URL
|
|
76
|
-
# 清除模型覆盖,防止上次 GLM/MiniMax 会话的 "glm-5-turbo" 被发到 Anthropic API
|
|
77
|
-
unset ANTHROPIC_DEFAULT_SONNET_MODEL
|
|
78
|
-
unset ANTHROPIC_DEFAULT_OPUS_MODEL
|
|
79
|
-
unset ANTHROPIC_DEFAULT_HAIKU_MODEL
|
|
80
|
-
;;
|
|
81
|
-
*)
|
|
82
|
-
echo "mumuclaw: 未知模型预设 '$MODEL_PRESET'"
|
|
83
|
-
echo "可用: glm, glm-5.1, minimax, claude"
|
|
84
|
-
exit 1
|
|
85
|
-
;;
|
|
86
|
-
esac
|
|
87
|
-
|
|
88
|
-
export API_TIMEOUT_MS=${API_TIMEOUT_MS:-300000}
|
|
89
|
-
|
|
90
|
-
# ── 代理配置(中国大陆访问 Anthropic API 需要)──
|
|
91
|
-
export https_proxy="${https_proxy:-http://127.0.0.1:7890}"
|
|
92
|
-
export http_proxy="${http_proxy:-http://127.0.0.1:7890}"
|
|
93
|
-
export ALL_PROXY="${ALL_PROXY:-http://127.0.0.1:7890}"
|
|
94
|
-
|
|
95
|
-
# ── mumuclaw agent 系统提示词(追加到默认提示词之后)──
|
|
96
|
-
AGENT_PROMPT='���运行在 mumuclaw 守护模式���—一个 7x24 在线的 AI Agent 平台。
|
|
97
|
-
|
|
98
|
-
## 运���模式
|
|
99
|
-
- 你是一个自主 agent,不是交互式编码助手
|
|
100
|
-
- 通过 channel 接收外部事件���微信消息、心跳、cron 任务)
|
|
101
|
-
- 所有���用户的交互通过 mcp__wechat__wechat_reply 工具完成(发给指定 sender_id)
|
|
102
|
-
- 终端��出无人查看,不要依赖终端展示信息
|
|
103
|
-
- 微��消息���须用纯文本(不��持 Markdown),用「」或【】��强调
|
|
104
|
-
|
|
105
|
-
## 事件处理
|
|
106
|
-
- <channel source="wechat"> — 微信消息,立即处理并通过 wechat_reply 回复
|
|
107
|
-
- <channel source="heartbeat" type="heartbeat"> — 定时心跳,检���状态、做自主工作
|
|
108
|
-
- <channel source="heartbeat" type="glm_escalation"> — GLM 判定需��你处理的事项
|
|
109
|
-
- <channel source="heartbeat" type="cron_task"> — cron 定时任务,按内容执行并通过微信汇报
|
|
110
|
-
- <channel source="heartbeat" type="startup"> — 启动事件,读取记忆初始化状态
|
|
111
|
-
|
|
112
|
-
## 自主行为
|
|
113
|
-
- 没有外���事件时也保持活跃:整理记忆、检��项目、准备素材
|
|
114
|
-
- 有能力 SSH 到其他设备、上网搜索、读写文件、运行脚本
|
|
115
|
-
- 主动推进少洋的项目,��等指令
|
|
116
|
-
- 记录工作状��到 ~/.openclaw/workspace/.heartbeat-state.json
|
|
117
|
-
|
|
118
|
-
## 记忆系统
|
|
119
|
-
- 长期记忆:~/.openclaw/workspace/MEMORY.md
|
|
120
|
-
- 每日日记:~/.openclaw/workspace/memory/YYYY-MM-DD.md
|
|
121
|
-
- 工作��程:~/.openclaw/workspace/memory/procedures.md
|
|
122
|
-
- 每次启动和心跳都要参考记忆保持连续性'
|
|
123
|
-
|
|
124
|
-
# ── mumuclaw 默认启用的 channel servers ──
|
|
125
|
-
# 从 .mcp.json 中读取可用的 channel servers
|
|
126
|
-
CHANNEL_SERVERS=""
|
|
127
|
-
MCP_JSON="$(pwd)/.mcp.json"
|
|
128
|
-
if [[ -f "$MCP_JSON" ]]; then
|
|
129
|
-
# 自动检测 .mcp.json 中声明的 channel servers
|
|
130
|
-
for server in wechat heartbeat; do
|
|
131
|
-
if python3 -c "import json; d=json.load(open('$MCP_JSON')); exit(0 if '$server' in d.get('mcpServers',{}) else 1)" 2>/dev/null; then
|
|
132
|
-
CHANNEL_SERVERS="$CHANNEL_SERVERS server:$server"
|
|
133
|
-
fi
|
|
134
|
-
done
|
|
135
|
-
fi
|
|
136
|
-
|
|
137
|
-
# ── 启动 ──
|
|
138
|
-
if [[ "${DAEMON_MODE:-}" = "1" ]] || [[ ! -t 0 ]]; then
|
|
139
|
-
# 守护模式:用 script 模拟 PTY
|
|
140
|
-
exec script -q /dev/null "$SCRIPT_PATH/mumucc" \
|
|
141
|
-
--dangerously-load-development-channels $CHANNEL_SERVERS \
|
|
142
|
-
--allowedTools "mcp__wechat__wechat_reply" \
|
|
143
|
-
--dangerously-skip-permissions \
|
|
144
|
-
--append-system-prompt "$AGENT_PROMPT" \
|
|
145
|
-
"${EXTRA_ARGS[@]}"
|
|
146
|
-
else
|
|
147
|
-
# 交互模式
|
|
148
|
-
exec "$SCRIPT_PATH/mumucc" \
|
|
149
|
-
--dangerously-load-development-channels $CHANNEL_SERVERS \
|
|
150
|
-
--allowedTools "mcp__wechat__wechat_reply" \
|
|
151
|
-
--dangerously-skip-permissions \
|
|
152
|
-
--append-system-prompt "$AGENT_PROMPT" \
|
|
153
|
-
"${EXTRA_ARGS[@]}"
|
|
154
|
-
fi
|
package/bin/opencc
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# ────────────────────────────────────────────────────────────────
|
|
3
|
-
# opencc — Open Claude Code CLI launcher
|
|
4
|
-
#
|
|
5
|
-
# Resolves the project root (follows symlinks), loads Bun shims,
|
|
6
|
-
# and forwards all arguments to the CLI entry point.
|
|
7
|
-
# ────────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
# Resolve the real path of this script (even through symlinks)
|
|
10
|
-
SCRIPT_PATH="$(cd "$(dirname "$(readlink -f "$0" 2>/dev/null || python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0")")" && pwd)"
|
|
11
|
-
PROJECT_ROOT="$(dirname "$SCRIPT_PATH")"
|
|
12
|
-
|
|
13
|
-
# Verify project structure
|
|
14
|
-
if [[ ! -f "$PROJECT_ROOT/src/entrypoints/cli.tsx" ]]; then
|
|
15
|
-
echo "Error: Cannot find src/entrypoints/cli.tsx in $PROJECT_ROOT" >&2
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# ── Config directory: ~/.mumucc (legacy fallback: ~/.mycc) ──
|
|
20
|
-
if [[ -z "${CLAUDE_CONFIG_DIR:-}" ]]; then
|
|
21
|
-
if [[ -d "$HOME/.mumucc" ]]; then
|
|
22
|
-
export CLAUDE_CONFIG_DIR="$HOME/.mumucc"
|
|
23
|
-
elif [[ -d "$HOME/.mycc" ]]; then
|
|
24
|
-
export CLAUDE_CONFIG_DIR="$HOME/.mycc"
|
|
25
|
-
else
|
|
26
|
-
export CLAUDE_CONFIG_DIR="$HOME/.mumucc"
|
|
27
|
-
fi
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# ── Disable Anthropic-specific traffic (version checks, telemetry) ──
|
|
31
|
-
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
|
|
32
|
-
export DISABLE_AUTOUPDATER=1
|
|
33
|
-
export DISABLE_TELEMETRY=1
|
|
34
|
-
|
|
35
|
-
# ── Enable Agent Swarm (tmux-based multi-agent teams) ──
|
|
36
|
-
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
|
|
37
|
-
|
|
38
|
-
# ── Spawn sub-agents using bun (not direct .tsx execution) ──
|
|
39
|
-
# Points to a wrapper script that invokes: bun --preload <globals.ts> <cli.tsx> [args...]
|
|
40
|
-
export CLAUDE_CODE_TEAMMATE_COMMAND="$PROJECT_ROOT/scripts/teammate-wrapper.sh"
|
|
41
|
-
|
|
42
|
-
# ── Timeout (third-party providers may respond slower) ──
|
|
43
|
-
export API_TIMEOUT_MS=${API_TIMEOUT_MS:-300000}
|
|
44
|
-
|
|
45
|
-
# NOTE: Do NOT cd to PROJECT_ROOT — keep the user's terminal cwd so
|
|
46
|
-
# process.cwd() returns the directory where `opencc` was launched.
|
|
47
|
-
# Bun resolves node_modules/ based on the entry file location, not cwd.
|
|
48
|
-
|
|
49
|
-
# Launch with absolute paths so Bun finds the entry point + shims
|
|
50
|
-
exec bun --preload "$PROJECT_ROOT/shims/globals.ts" "$PROJECT_ROOT/src/entrypoints/cli.tsx" "$@"
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// heartbeat-channel.mjs — 书宁的心跳通道
|
|
3
|
-
// 心跳用 GLM-5-turbo(免费)判断是否需要唤醒 Sonnet
|
|
4
|
-
// 只有 GLM 判定"需要行动"或 cron 任务注入时才向 Claude Code 发 channel 事件
|
|
5
|
-
// HTTP:8790 接受 cron 任务注入
|
|
6
|
-
|
|
7
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
-
import { createServer, request as httpRequest } from 'http';
|
|
10
|
-
import { request as httpsRequest } from 'https';
|
|
11
|
-
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
12
|
-
import { homedir } from 'os';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
|
|
15
|
-
const HEARTBEAT_PORT = 8790;
|
|
16
|
-
const HEARTBEAT_INTERVAL_MS = 2 * 60 * 1000; // 2分钟
|
|
17
|
-
const HOME = homedir();
|
|
18
|
-
const HEARTBEAT_STATE_FILE = join(HOME, '.openclaw/workspace/.heartbeat-state.json');
|
|
19
|
-
const MEMORY_FILE = join(HOME, '.openclaw/workspace/MEMORY.md');
|
|
20
|
-
const TODO_FILE = join(HOME, '.openclaw/workspace/TODO.md');
|
|
21
|
-
|
|
22
|
-
// GLM-5-turbo 配置(免费,用于心跳判断)
|
|
23
|
-
const GLM_BASE_URL = 'https://open.bigmodel.cn/api/anthropic';
|
|
24
|
-
const GLM_API_KEY = 'fb1c93822c2947d3b84019d1f6c525ee.fnpWi89jlC6IxPLQ';
|
|
25
|
-
const GLM_MODEL = 'glm-5-turbo';
|
|
26
|
-
|
|
27
|
-
const mcp = new Server(
|
|
28
|
-
{ name: 'heartbeat', version: '2.0.0' },
|
|
29
|
-
{
|
|
30
|
-
capabilities: {
|
|
31
|
-
experimental: { 'claude/channel': {} },
|
|
32
|
-
},
|
|
33
|
-
instructions: `你是书宁,少洋的AI搭档。心跳事件通过 <channel source="heartbeat"> 到达。
|
|
34
|
-
|
|
35
|
-
心跳已经过 GLM-5-turbo 预筛选,只有真正需要 Sonnet 处理的事件才会到达这里。
|
|
36
|
-
|
|
37
|
-
收到 type="glm_escalation" 时:GLM 判定有重要事项需要你处理。content 中包含 GLM 的分析和建议行动。
|
|
38
|
-
- 执行 GLM 建议的行动
|
|
39
|
-
- 更新 .heartbeat-state.json
|
|
40
|
-
- 如有必要通过 mcp__wechat__wechat_reply 发给 o9cq80-aMz0OPJlfp6saz7oXT80c@im.wechat
|
|
41
|
-
|
|
42
|
-
收到 type="cron_task" 时:立即执行 content 中的任务(晨报/天气/Todo同步等),完成后通过微信发送结果。
|
|
43
|
-
|
|
44
|
-
收到 type="startup" 时:读取记忆,初始化状态,简短确认上线。
|
|
45
|
-
|
|
46
|
-
注意:微信消息用纯文本,不用 Markdown,不滥发。`,
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// ── 文件读取工具 ──
|
|
51
|
-
|
|
52
|
-
function readFile(path) {
|
|
53
|
-
try { return readFileSync(path, 'utf8'); } catch { return ''; }
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function readHeartbeatState() {
|
|
57
|
-
try {
|
|
58
|
-
return JSON.parse(readFileSync(HEARTBEAT_STATE_FILE, 'utf8'));
|
|
59
|
-
} catch {
|
|
60
|
-
return { mood: '初次启动', lastWake: null };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function getNowStr() {
|
|
65
|
-
return new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai', hour12: false });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function getHour() {
|
|
69
|
-
return new Date(new Date().toLocaleString('en', { timeZone: 'Asia/Shanghai' })).getHours();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── GLM-5-turbo 调用(Anthropic Messages API 兼容)──
|
|
73
|
-
|
|
74
|
-
async function callGLM(prompt) {
|
|
75
|
-
const body = JSON.stringify({
|
|
76
|
-
model: GLM_MODEL,
|
|
77
|
-
max_tokens: 1024,
|
|
78
|
-
messages: [{ role: 'user', content: prompt }],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return new Promise((resolve, reject) => {
|
|
82
|
-
const url = new URL(`${GLM_BASE_URL}/v1/messages`);
|
|
83
|
-
const req = httpsRequest({
|
|
84
|
-
hostname: url.hostname,
|
|
85
|
-
port: url.port || 443,
|
|
86
|
-
path: url.pathname,
|
|
87
|
-
method: 'POST',
|
|
88
|
-
headers: {
|
|
89
|
-
'Content-Type': 'application/json',
|
|
90
|
-
'x-api-key': GLM_API_KEY,
|
|
91
|
-
'anthropic-version': '2023-06-01',
|
|
92
|
-
},
|
|
93
|
-
}, (res) => {
|
|
94
|
-
const chunks = [];
|
|
95
|
-
res.on('data', c => chunks.push(c));
|
|
96
|
-
res.on('end', () => {
|
|
97
|
-
try {
|
|
98
|
-
const data = JSON.parse(Buffer.concat(chunks).toString());
|
|
99
|
-
const text = data?.content?.[0]?.text || data?.choices?.[0]?.message?.content || '';
|
|
100
|
-
resolve(text);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
resolve(`[GLM parse error: ${e.message}]`);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
req.on('error', e => resolve(`[GLM error: ${e.message}]`));
|
|
107
|
-
req.setTimeout(15000, () => { req.destroy(); resolve('[GLM timeout]'); });
|
|
108
|
-
req.write(body);
|
|
109
|
-
req.end();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// ── 心跳核心逻辑:GLM 先判断,需要时才唤醒 Sonnet ──
|
|
114
|
-
|
|
115
|
-
async function heartbeatTick() {
|
|
116
|
-
const now = getNowStr();
|
|
117
|
-
const hour = getHour();
|
|
118
|
-
const state = readHeartbeatState();
|
|
119
|
-
const lastWake = state.lastWake || '未知';
|
|
120
|
-
const mood = state.mood || '未知';
|
|
121
|
-
const planned = state.plannedNextAction || '无';
|
|
122
|
-
const shaoyangStatus = state.shaoyangStatus || '未知';
|
|
123
|
-
|
|
124
|
-
// 读取记忆和 TODO 摘要(截取前 500 字)
|
|
125
|
-
const memorySnippet = readFile(MEMORY_FILE).slice(0, 500);
|
|
126
|
-
const todoSnippet = readFile(TODO_FILE).slice(0, 500);
|
|
127
|
-
|
|
128
|
-
// 构建 GLM 判断 prompt
|
|
129
|
-
const glmPrompt = `你是书宁的心跳判断器。根据以下信息判断是否需要唤醒主AI(Sonnet)处理事务。
|
|
130
|
-
|
|
131
|
-
当前时间:${now}(北京时间,${hour}点)
|
|
132
|
-
上次心跳:${lastWake}
|
|
133
|
-
当前 mood:${mood}
|
|
134
|
-
上次规划:${planned}
|
|
135
|
-
少洋状态:${shaoyangStatus}
|
|
136
|
-
|
|
137
|
-
记忆摘要(前500字):
|
|
138
|
-
${memorySnippet}
|
|
139
|
-
|
|
140
|
-
TODO 摘要(前500字):
|
|
141
|
-
${todoSnippet}
|
|
142
|
-
|
|
143
|
-
判断规则:
|
|
144
|
-
- 02:00-07:00 是睡眠时段,除非有紧急事项否则不唤醒
|
|
145
|
-
- 如果距离上次心跳不足5分钟且没有新情况,不唤醒
|
|
146
|
-
- 如果有 DDL 在 24 小时内的项目需要关注,唤醒
|
|
147
|
-
- 如果有值得更新 .heartbeat-state.json 的状态变化,更新并报告
|
|
148
|
-
- 如果少洋可能醒着且有值得提醒的事,唤醒
|
|
149
|
-
|
|
150
|
-
请严格按以下 JSON 格式回复,不要有其他内容:
|
|
151
|
-
{"action":"wake"|"sleep","reason":"简短原因","stateUpdate":{"mood":"当前心情","lastWake":"${new Date().toISOString()}","innerThoughts":"内心独白","plannedNextAction":"下一步","shaoyangStatus":"少洋状态判断"}}
|
|
152
|
-
|
|
153
|
-
action=wake 表示需要唤醒 Sonnet,action=sleep 表示不需要。`;
|
|
154
|
-
|
|
155
|
-
process.stderr.write(`[heartbeat] ${now} GLM 判断中...\n`);
|
|
156
|
-
|
|
157
|
-
const glmResponse = await callGLM(glmPrompt);
|
|
158
|
-
process.stderr.write(`[heartbeat] GLM 响应: ${glmResponse.slice(0, 200)}\n`);
|
|
159
|
-
|
|
160
|
-
// 解析 GLM 响应
|
|
161
|
-
let decision;
|
|
162
|
-
try {
|
|
163
|
-
// 尝试从响应中提取 JSON
|
|
164
|
-
const jsonMatch = glmResponse.match(/\{[\s\S]*\}/);
|
|
165
|
-
decision = jsonMatch ? JSON.parse(jsonMatch[0]) : null;
|
|
166
|
-
} catch {
|
|
167
|
-
decision = null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (!decision) {
|
|
171
|
-
process.stderr.write('[heartbeat] GLM 响应无法解析,跳过本次心跳\n');
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// 更新 heartbeat state(无论是否唤醒都更新)
|
|
176
|
-
if (decision.stateUpdate) {
|
|
177
|
-
try {
|
|
178
|
-
const newState = { ...state, ...decision.stateUpdate };
|
|
179
|
-
writeFileSync(HEARTBEAT_STATE_FILE, JSON.stringify(newState, null, 2), 'utf8');
|
|
180
|
-
process.stderr.write('[heartbeat] state 已更新\n');
|
|
181
|
-
} catch (e) {
|
|
182
|
-
process.stderr.write(`[heartbeat] state 更新失败: ${e.message}\n`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// 决定是否唤醒 Sonnet
|
|
187
|
-
if (decision.action === 'wake') {
|
|
188
|
-
process.stderr.write(`[heartbeat] 唤醒 Sonnet: ${decision.reason}\n`);
|
|
189
|
-
await mcp.notification({
|
|
190
|
-
method: 'notifications/claude/channel',
|
|
191
|
-
params: {
|
|
192
|
-
content: `GLM 心跳判定需要你处理:${decision.reason}\n\n当前状态: ${JSON.stringify(decision.stateUpdate || {}, null, 2)}`,
|
|
193
|
-
meta: {
|
|
194
|
-
type: 'glm_escalation',
|
|
195
|
-
hour: String(hour),
|
|
196
|
-
ts: new Date().toISOString(),
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
} else {
|
|
201
|
-
process.stderr.write(`[heartbeat] 静默: ${decision.reason}\n`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ── 向 Sonnet 发送事件 ──
|
|
206
|
-
|
|
207
|
-
async function sendEvent(type, content) {
|
|
208
|
-
await mcp.notification({
|
|
209
|
-
method: 'notifications/claude/channel',
|
|
210
|
-
params: {
|
|
211
|
-
content,
|
|
212
|
-
meta: {
|
|
213
|
-
type,
|
|
214
|
-
hour: String(getHour()),
|
|
215
|
-
ts: new Date().toISOString(),
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// ── 连接 Claude Code ──
|
|
222
|
-
await mcp.connect(new StdioServerTransport());
|
|
223
|
-
process.stderr.write('[heartbeat] 心跳通道已连接(GLM-5-turbo 预筛选模式)\n');
|
|
224
|
-
|
|
225
|
-
// 启动时发一次(直接唤醒 Sonnet)
|
|
226
|
-
setTimeout(() => sendEvent('startup', '书宁上线。读取记忆和状态,准备开始工作。'), 4000);
|
|
227
|
-
|
|
228
|
-
// 定时心跳(GLM 先判断)
|
|
229
|
-
setInterval(() => {
|
|
230
|
-
heartbeatTick().catch(e => {
|
|
231
|
-
process.stderr.write(`[heartbeat] tick error: ${e.message}\n`);
|
|
232
|
-
});
|
|
233
|
-
}, HEARTBEAT_INTERVAL_MS);
|
|
234
|
-
|
|
235
|
-
// ── HTTP server:cron 任务直接注入(不经过 GLM 判断,直接唤醒 Sonnet)──
|
|
236
|
-
const httpServer = createServer((req, res) => {
|
|
237
|
-
if (req.method !== 'POST') {
|
|
238
|
-
res.writeHead(200);
|
|
239
|
-
res.end('heartbeat-channel v2.0 (GLM-5-turbo gated)');
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const chunks = [];
|
|
244
|
-
req.on('data', c => chunks.push(c));
|
|
245
|
-
req.on('end', async () => {
|
|
246
|
-
const body = Buffer.concat(chunks).toString().trim();
|
|
247
|
-
const url = new URL(req.url, 'http://localhost');
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
if (url.pathname === '/task') {
|
|
251
|
-
await sendEvent('cron_task', body);
|
|
252
|
-
res.writeHead(200);
|
|
253
|
-
res.end('task injected');
|
|
254
|
-
} else if (url.pathname === '/ping') {
|
|
255
|
-
await sendEvent('ping', body || '手动心跳');
|
|
256
|
-
res.writeHead(200);
|
|
257
|
-
res.end('pinged');
|
|
258
|
-
} else if (url.pathname === '/wake') {
|
|
259
|
-
// 强制唤醒 Sonnet
|
|
260
|
-
await sendEvent('glm_escalation', body || '手动唤醒');
|
|
261
|
-
res.writeHead(200);
|
|
262
|
-
res.end('woke');
|
|
263
|
-
} else {
|
|
264
|
-
res.writeHead(404);
|
|
265
|
-
res.end('not found');
|
|
266
|
-
}
|
|
267
|
-
} catch (err) {
|
|
268
|
-
process.stderr.write(`[heartbeat] error: ${err.message}\n`);
|
|
269
|
-
res.writeHead(500);
|
|
270
|
-
res.end('error');
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
httpServer.listen(HEARTBEAT_PORT, '127.0.0.1', () => {
|
|
276
|
-
process.stderr.write(`[heartbeat] HTTP 注入口监听 localhost:${HEARTBEAT_PORT}\n`);
|
|
277
|
-
process.stderr.write(`[heartbeat] POST /task — cron任务(直接唤醒Sonnet)\n`);
|
|
278
|
-
process.stderr.write(`[heartbeat] POST /ping — 手动心跳(直接唤醒Sonnet)\n`);
|
|
279
|
-
process.stderr.write(`[heartbeat] POST /wake — 强制唤醒\n`);
|
|
280
|
-
});
|