cc-viewer 1.7.22 → 1.8.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/README.md +19 -0
- package/cli.js +92 -11
- package/concepts/ar/GlobalSettings.md +2 -2
- package/concepts/ar/Tool-Artifact.md +7 -0
- package/concepts/ar/Tool-EndConversation.md +35 -0
- package/concepts/ar/Tool-LSP.md +6 -1
- package/concepts/ar/Tool-ListAgents.md +35 -0
- package/concepts/ar/Tool-ListConnectors.md +34 -0
- package/concepts/ar/Tool-ListMcpResources.md +35 -0
- package/concepts/ar/Tool-ListPlugins.md +35 -0
- package/concepts/ar/Tool-ListSkills.md +37 -0
- package/concepts/ar/Tool-Monitor.md +7 -0
- package/concepts/ar/Tool-Projects.md +46 -0
- package/concepts/ar/Tool-ProposeGoal.md +43 -0
- package/concepts/ar/Tool-PushNotification.md +6 -0
- package/concepts/ar/Tool-REPL.md +47 -0
- package/concepts/ar/Tool-ReadMcpResource.md +32 -0
- package/concepts/ar/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/ar/Tool-ReadNotifications.md +27 -0
- package/concepts/ar/Tool-RemoteTrigger.md +7 -0
- package/concepts/ar/Tool-ScheduleWakeup.md +5 -0
- package/concepts/ar/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/ar/Tool-SendFeedback.md +38 -0
- package/concepts/ar/Tool-SendFile.md +36 -0
- package/concepts/ar/Tool-SendMessage.md +5 -0
- package/concepts/ar/Tool-SendUserFile.md +38 -0
- package/concepts/ar/Tool-SendUserMessage.md +38 -0
- package/concepts/ar/Tool-SuggestConnectors.md +28 -0
- package/concepts/ar/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/ar/Tool-SuggestSkills.md +33 -0
- package/concepts/ar/Tool-TaskCreate.md +6 -0
- package/concepts/ar/Tool-TaskGet.md +6 -0
- package/concepts/ar/Tool-TaskList.md +6 -0
- package/concepts/ar/Tool-TaskUpdate.md +6 -0
- package/concepts/ar/Tool-TodoWrite.md +43 -0
- package/concepts/ar/Tool-ToolSearch.md +5 -0
- package/concepts/ar/Tool-WebSearch.md +6 -0
- package/concepts/ar/Tools.md +26 -4
- package/concepts/da/GlobalSettings.md +2 -2
- package/concepts/da/Tool-Artifact.md +8 -1
- package/concepts/da/Tool-EndConversation.md +35 -0
- package/concepts/da/Tool-LSP.md +6 -1
- package/concepts/da/Tool-ListAgents.md +35 -0
- package/concepts/da/Tool-ListConnectors.md +34 -0
- package/concepts/da/Tool-ListMcpResources.md +35 -0
- package/concepts/da/Tool-ListPlugins.md +35 -0
- package/concepts/da/Tool-ListSkills.md +37 -0
- package/concepts/da/Tool-Monitor.md +7 -0
- package/concepts/da/Tool-Projects.md +46 -0
- package/concepts/da/Tool-ProposeGoal.md +43 -0
- package/concepts/da/Tool-PushNotification.md +6 -0
- package/concepts/da/Tool-REPL.md +47 -0
- package/concepts/da/Tool-ReadMcpResource.md +32 -0
- package/concepts/da/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/da/Tool-ReadNotifications.md +27 -0
- package/concepts/da/Tool-RemoteTrigger.md +7 -0
- package/concepts/da/Tool-ScheduleWakeup.md +5 -0
- package/concepts/da/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/da/Tool-SendFeedback.md +38 -0
- package/concepts/da/Tool-SendFile.md +36 -0
- package/concepts/da/Tool-SendMessage.md +5 -0
- package/concepts/da/Tool-SendUserFile.md +38 -0
- package/concepts/da/Tool-SendUserMessage.md +38 -0
- package/concepts/da/Tool-SuggestConnectors.md +28 -0
- package/concepts/da/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/da/Tool-SuggestSkills.md +33 -0
- package/concepts/da/Tool-TaskCreate.md +6 -0
- package/concepts/da/Tool-TaskGet.md +6 -0
- package/concepts/da/Tool-TaskList.md +6 -0
- package/concepts/da/Tool-TaskUpdate.md +6 -0
- package/concepts/da/Tool-TodoWrite.md +43 -0
- package/concepts/da/Tool-ToolSearch.md +5 -0
- package/concepts/da/Tool-WebSearch.md +6 -0
- package/concepts/da/Tools.md +26 -4
- package/concepts/de/GlobalSettings.md +2 -2
- package/concepts/de/Tool-Artifact.md +7 -0
- package/concepts/de/Tool-EndConversation.md +35 -0
- package/concepts/de/Tool-LSP.md +6 -1
- package/concepts/de/Tool-ListAgents.md +35 -0
- package/concepts/de/Tool-ListConnectors.md +34 -0
- package/concepts/de/Tool-ListMcpResources.md +35 -0
- package/concepts/de/Tool-ListPlugins.md +35 -0
- package/concepts/de/Tool-ListSkills.md +37 -0
- package/concepts/de/Tool-Monitor.md +7 -0
- package/concepts/de/Tool-Projects.md +46 -0
- package/concepts/de/Tool-ProposeGoal.md +43 -0
- package/concepts/de/Tool-PushNotification.md +6 -0
- package/concepts/de/Tool-REPL.md +47 -0
- package/concepts/de/Tool-ReadMcpResource.md +32 -0
- package/concepts/de/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/de/Tool-ReadNotifications.md +27 -0
- package/concepts/de/Tool-RemoteTrigger.md +7 -0
- package/concepts/de/Tool-ScheduleWakeup.md +5 -0
- package/concepts/de/Tool-SearchMcpRegistry.md +30 -0
- package/concepts/de/Tool-SendFeedback.md +38 -0
- package/concepts/de/Tool-SendFile.md +36 -0
- package/concepts/de/Tool-SendMessage.md +5 -0
- package/concepts/de/Tool-SendUserFile.md +38 -0
- package/concepts/de/Tool-SendUserMessage.md +38 -0
- package/concepts/de/Tool-SuggestConnectors.md +28 -0
- package/concepts/de/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/de/Tool-SuggestSkills.md +33 -0
- package/concepts/de/Tool-TaskCreate.md +6 -0
- package/concepts/de/Tool-TaskGet.md +6 -0
- package/concepts/de/Tool-TaskList.md +6 -0
- package/concepts/de/Tool-TaskUpdate.md +6 -0
- package/concepts/de/Tool-TodoWrite.md +43 -0
- package/concepts/de/Tool-ToolSearch.md +5 -0
- package/concepts/de/Tool-WebSearch.md +6 -0
- package/concepts/de/Tools.md +26 -4
- package/concepts/en/GlobalSettings.md +2 -2
- package/concepts/en/Tool-Artifact.md +7 -0
- package/concepts/en/Tool-EndConversation.md +35 -0
- package/concepts/en/Tool-LSP.md +5 -0
- package/concepts/en/Tool-ListAgents.md +35 -0
- package/concepts/en/Tool-ListConnectors.md +34 -0
- package/concepts/en/Tool-ListMcpResources.md +35 -0
- package/concepts/en/Tool-ListPlugins.md +35 -0
- package/concepts/en/Tool-ListSkills.md +37 -0
- package/concepts/en/Tool-Monitor.md +7 -0
- package/concepts/en/Tool-Projects.md +46 -0
- package/concepts/en/Tool-ProposeGoal.md +43 -0
- package/concepts/en/Tool-PushNotification.md +6 -0
- package/concepts/en/Tool-REPL.md +47 -0
- package/concepts/en/Tool-ReadMcpResource.md +32 -0
- package/concepts/en/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/en/Tool-ReadNotifications.md +27 -0
- package/concepts/en/Tool-RemoteTrigger.md +7 -0
- package/concepts/en/Tool-ScheduleWakeup.md +5 -0
- package/concepts/en/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/en/Tool-SendFeedback.md +38 -0
- package/concepts/en/Tool-SendFile.md +36 -0
- package/concepts/en/Tool-SendMessage.md +5 -0
- package/concepts/en/Tool-SendUserFile.md +38 -0
- package/concepts/en/Tool-SendUserMessage.md +38 -0
- package/concepts/en/Tool-SuggestConnectors.md +28 -0
- package/concepts/en/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/en/Tool-SuggestSkills.md +33 -0
- package/concepts/en/Tool-TaskCreate.md +6 -0
- package/concepts/en/Tool-TaskGet.md +6 -0
- package/concepts/en/Tool-TaskList.md +6 -0
- package/concepts/en/Tool-TaskUpdate.md +6 -0
- package/concepts/en/Tool-TodoWrite.md +43 -0
- package/concepts/en/Tool-ToolSearch.md +5 -0
- package/concepts/en/Tool-WebSearch.md +6 -0
- package/concepts/en/Tools.md +26 -4
- package/concepts/es/GlobalSettings.md +2 -2
- package/concepts/es/Tool-Artifact.md +7 -0
- package/concepts/es/Tool-EndConversation.md +35 -0
- package/concepts/es/Tool-LSP.md +5 -0
- package/concepts/es/Tool-ListAgents.md +35 -0
- package/concepts/es/Tool-ListConnectors.md +34 -0
- package/concepts/es/Tool-ListMcpResources.md +35 -0
- package/concepts/es/Tool-ListPlugins.md +35 -0
- package/concepts/es/Tool-ListSkills.md +37 -0
- package/concepts/es/Tool-Monitor.md +7 -0
- package/concepts/es/Tool-Projects.md +46 -0
- package/concepts/es/Tool-ProposeGoal.md +43 -0
- package/concepts/es/Tool-PushNotification.md +6 -0
- package/concepts/es/Tool-REPL.md +47 -0
- package/concepts/es/Tool-ReadMcpResource.md +32 -0
- package/concepts/es/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/es/Tool-ReadNotifications.md +27 -0
- package/concepts/es/Tool-RemoteTrigger.md +7 -0
- package/concepts/es/Tool-ScheduleWakeup.md +5 -0
- package/concepts/es/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/es/Tool-SendFeedback.md +38 -0
- package/concepts/es/Tool-SendFile.md +36 -0
- package/concepts/es/Tool-SendMessage.md +5 -0
- package/concepts/es/Tool-SendUserFile.md +38 -0
- package/concepts/es/Tool-SendUserMessage.md +38 -0
- package/concepts/es/Tool-SuggestConnectors.md +28 -0
- package/concepts/es/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/es/Tool-SuggestSkills.md +33 -0
- package/concepts/es/Tool-TaskCreate.md +6 -0
- package/concepts/es/Tool-TaskGet.md +6 -0
- package/concepts/es/Tool-TaskList.md +6 -0
- package/concepts/es/Tool-TaskUpdate.md +6 -0
- package/concepts/es/Tool-TodoWrite.md +43 -0
- package/concepts/es/Tool-ToolSearch.md +5 -0
- package/concepts/es/Tool-WebSearch.md +6 -0
- package/concepts/es/Tools.md +26 -4
- package/concepts/fr/GlobalSettings.md +2 -2
- package/concepts/fr/Tool-Artifact.md +7 -0
- package/concepts/fr/Tool-EndConversation.md +35 -0
- package/concepts/fr/Tool-LSP.md +5 -0
- package/concepts/fr/Tool-ListAgents.md +35 -0
- package/concepts/fr/Tool-ListConnectors.md +34 -0
- package/concepts/fr/Tool-ListMcpResources.md +35 -0
- package/concepts/fr/Tool-ListPlugins.md +35 -0
- package/concepts/fr/Tool-ListSkills.md +37 -0
- package/concepts/fr/Tool-Monitor.md +7 -0
- package/concepts/fr/Tool-Projects.md +46 -0
- package/concepts/fr/Tool-ProposeGoal.md +43 -0
- package/concepts/fr/Tool-PushNotification.md +6 -0
- package/concepts/fr/Tool-REPL.md +47 -0
- package/concepts/fr/Tool-ReadMcpResource.md +32 -0
- package/concepts/fr/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/fr/Tool-ReadNotifications.md +27 -0
- package/concepts/fr/Tool-RemoteTrigger.md +7 -0
- package/concepts/fr/Tool-ScheduleWakeup.md +5 -0
- package/concepts/fr/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/fr/Tool-SendFeedback.md +38 -0
- package/concepts/fr/Tool-SendFile.md +36 -0
- package/concepts/fr/Tool-SendMessage.md +5 -0
- package/concepts/fr/Tool-SendUserFile.md +38 -0
- package/concepts/fr/Tool-SendUserMessage.md +38 -0
- package/concepts/fr/Tool-SuggestConnectors.md +28 -0
- package/concepts/fr/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/fr/Tool-SuggestSkills.md +33 -0
- package/concepts/fr/Tool-TaskCreate.md +6 -0
- package/concepts/fr/Tool-TaskGet.md +6 -0
- package/concepts/fr/Tool-TaskList.md +6 -0
- package/concepts/fr/Tool-TaskUpdate.md +6 -0
- package/concepts/fr/Tool-TodoWrite.md +43 -0
- package/concepts/fr/Tool-ToolSearch.md +5 -0
- package/concepts/fr/Tool-WebSearch.md +6 -0
- package/concepts/fr/Tools.md +26 -4
- package/concepts/it/GlobalSettings.md +2 -2
- package/concepts/it/Tool-Artifact.md +7 -0
- package/concepts/it/Tool-EndConversation.md +35 -0
- package/concepts/it/Tool-LSP.md +5 -0
- package/concepts/it/Tool-ListAgents.md +35 -0
- package/concepts/it/Tool-ListConnectors.md +34 -0
- package/concepts/it/Tool-ListMcpResources.md +35 -0
- package/concepts/it/Tool-ListPlugins.md +35 -0
- package/concepts/it/Tool-ListSkills.md +37 -0
- package/concepts/it/Tool-Monitor.md +7 -0
- package/concepts/it/Tool-Projects.md +46 -0
- package/concepts/it/Tool-ProposeGoal.md +43 -0
- package/concepts/it/Tool-PushNotification.md +6 -0
- package/concepts/it/Tool-REPL.md +47 -0
- package/concepts/it/Tool-ReadMcpResource.md +32 -0
- package/concepts/it/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/it/Tool-ReadNotifications.md +27 -0
- package/concepts/it/Tool-RemoteTrigger.md +7 -0
- package/concepts/it/Tool-ScheduleWakeup.md +5 -0
- package/concepts/it/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/it/Tool-SendFeedback.md +38 -0
- package/concepts/it/Tool-SendFile.md +36 -0
- package/concepts/it/Tool-SendMessage.md +5 -0
- package/concepts/it/Tool-SendUserFile.md +38 -0
- package/concepts/it/Tool-SendUserMessage.md +38 -0
- package/concepts/it/Tool-SuggestConnectors.md +28 -0
- package/concepts/it/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/it/Tool-SuggestSkills.md +33 -0
- package/concepts/it/Tool-TaskCreate.md +6 -0
- package/concepts/it/Tool-TaskGet.md +6 -0
- package/concepts/it/Tool-TaskList.md +6 -0
- package/concepts/it/Tool-TaskUpdate.md +6 -0
- package/concepts/it/Tool-TodoWrite.md +43 -0
- package/concepts/it/Tool-ToolSearch.md +5 -0
- package/concepts/it/Tool-WebSearch.md +6 -0
- package/concepts/it/Tools.md +26 -4
- package/concepts/ja/GlobalSettings.md +2 -2
- package/concepts/ja/Tool-Artifact.md +7 -0
- package/concepts/ja/Tool-EndConversation.md +35 -0
- package/concepts/ja/Tool-LSP.md +5 -0
- package/concepts/ja/Tool-ListAgents.md +35 -0
- package/concepts/ja/Tool-ListConnectors.md +34 -0
- package/concepts/ja/Tool-ListMcpResources.md +35 -0
- package/concepts/ja/Tool-ListPlugins.md +35 -0
- package/concepts/ja/Tool-ListSkills.md +37 -0
- package/concepts/ja/Tool-Monitor.md +7 -0
- package/concepts/ja/Tool-Projects.md +46 -0
- package/concepts/ja/Tool-ProposeGoal.md +43 -0
- package/concepts/ja/Tool-PushNotification.md +6 -0
- package/concepts/ja/Tool-REPL.md +47 -0
- package/concepts/ja/Tool-ReadMcpResource.md +32 -0
- package/concepts/ja/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/ja/Tool-ReadNotifications.md +27 -0
- package/concepts/ja/Tool-RemoteTrigger.md +7 -0
- package/concepts/ja/Tool-ScheduleWakeup.md +5 -0
- package/concepts/ja/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/ja/Tool-SendFeedback.md +38 -0
- package/concepts/ja/Tool-SendFile.md +36 -0
- package/concepts/ja/Tool-SendMessage.md +5 -0
- package/concepts/ja/Tool-SendUserFile.md +38 -0
- package/concepts/ja/Tool-SendUserMessage.md +38 -0
- package/concepts/ja/Tool-SuggestConnectors.md +28 -0
- package/concepts/ja/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/ja/Tool-SuggestSkills.md +33 -0
- package/concepts/ja/Tool-TaskCreate.md +6 -0
- package/concepts/ja/Tool-TaskGet.md +6 -0
- package/concepts/ja/Tool-TaskList.md +6 -0
- package/concepts/ja/Tool-TaskUpdate.md +6 -0
- package/concepts/ja/Tool-TodoWrite.md +43 -0
- package/concepts/ja/Tool-ToolSearch.md +5 -0
- package/concepts/ja/Tool-WebSearch.md +6 -0
- package/concepts/ja/Tools.md +26 -4
- package/concepts/ko/GlobalSettings.md +2 -2
- package/concepts/ko/Tool-Artifact.md +7 -0
- package/concepts/ko/Tool-EndConversation.md +35 -0
- package/concepts/ko/Tool-LSP.md +5 -0
- package/concepts/ko/Tool-ListAgents.md +35 -0
- package/concepts/ko/Tool-ListConnectors.md +34 -0
- package/concepts/ko/Tool-ListMcpResources.md +35 -0
- package/concepts/ko/Tool-ListPlugins.md +35 -0
- package/concepts/ko/Tool-ListSkills.md +37 -0
- package/concepts/ko/Tool-Monitor.md +7 -0
- package/concepts/ko/Tool-Projects.md +46 -0
- package/concepts/ko/Tool-ProposeGoal.md +43 -0
- package/concepts/ko/Tool-PushNotification.md +6 -0
- package/concepts/ko/Tool-REPL.md +47 -0
- package/concepts/ko/Tool-ReadMcpResource.md +32 -0
- package/concepts/ko/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/ko/Tool-ReadNotifications.md +27 -0
- package/concepts/ko/Tool-RemoteTrigger.md +7 -0
- package/concepts/ko/Tool-ScheduleWakeup.md +5 -0
- package/concepts/ko/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/ko/Tool-SendFeedback.md +38 -0
- package/concepts/ko/Tool-SendFile.md +36 -0
- package/concepts/ko/Tool-SendMessage.md +5 -0
- package/concepts/ko/Tool-SendUserFile.md +38 -0
- package/concepts/ko/Tool-SendUserMessage.md +38 -0
- package/concepts/ko/Tool-SuggestConnectors.md +28 -0
- package/concepts/ko/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/ko/Tool-SuggestSkills.md +33 -0
- package/concepts/ko/Tool-TaskCreate.md +6 -0
- package/concepts/ko/Tool-TaskGet.md +6 -0
- package/concepts/ko/Tool-TaskList.md +6 -0
- package/concepts/ko/Tool-TaskUpdate.md +6 -0
- package/concepts/ko/Tool-TodoWrite.md +43 -0
- package/concepts/ko/Tool-ToolSearch.md +5 -0
- package/concepts/ko/Tool-WebSearch.md +6 -0
- package/concepts/ko/Tools.md +26 -4
- package/concepts/no/GlobalSettings.md +2 -2
- package/concepts/no/Tool-Artifact.md +7 -0
- package/concepts/no/Tool-EndConversation.md +35 -0
- package/concepts/no/Tool-LSP.md +7 -2
- package/concepts/no/Tool-ListAgents.md +35 -0
- package/concepts/no/Tool-ListConnectors.md +34 -0
- package/concepts/no/Tool-ListMcpResources.md +35 -0
- package/concepts/no/Tool-ListPlugins.md +35 -0
- package/concepts/no/Tool-ListSkills.md +37 -0
- package/concepts/no/Tool-Monitor.md +7 -0
- package/concepts/no/Tool-Projects.md +46 -0
- package/concepts/no/Tool-ProposeGoal.md +43 -0
- package/concepts/no/Tool-PushNotification.md +6 -0
- package/concepts/no/Tool-REPL.md +47 -0
- package/concepts/no/Tool-ReadMcpResource.md +32 -0
- package/concepts/no/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/no/Tool-ReadNotifications.md +27 -0
- package/concepts/no/Tool-RemoteTrigger.md +7 -0
- package/concepts/no/Tool-ScheduleWakeup.md +5 -0
- package/concepts/no/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/no/Tool-SendFeedback.md +38 -0
- package/concepts/no/Tool-SendFile.md +36 -0
- package/concepts/no/Tool-SendMessage.md +5 -0
- package/concepts/no/Tool-SendUserFile.md +38 -0
- package/concepts/no/Tool-SendUserMessage.md +38 -0
- package/concepts/no/Tool-SuggestConnectors.md +28 -0
- package/concepts/no/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/no/Tool-SuggestSkills.md +33 -0
- package/concepts/no/Tool-TaskCreate.md +6 -0
- package/concepts/no/Tool-TaskGet.md +6 -0
- package/concepts/no/Tool-TaskList.md +6 -0
- package/concepts/no/Tool-TaskUpdate.md +6 -0
- package/concepts/no/Tool-TodoWrite.md +43 -0
- package/concepts/no/Tool-ToolSearch.md +5 -0
- package/concepts/no/Tool-WebSearch.md +6 -0
- package/concepts/no/Tools.md +26 -4
- package/concepts/pl/GlobalSettings.md +2 -2
- package/concepts/pl/Tool-Artifact.md +7 -0
- package/concepts/pl/Tool-EndConversation.md +35 -0
- package/concepts/pl/Tool-LSP.md +5 -0
- package/concepts/pl/Tool-ListAgents.md +35 -0
- package/concepts/pl/Tool-ListConnectors.md +34 -0
- package/concepts/pl/Tool-ListMcpResources.md +35 -0
- package/concepts/pl/Tool-ListPlugins.md +35 -0
- package/concepts/pl/Tool-ListSkills.md +37 -0
- package/concepts/pl/Tool-Monitor.md +7 -0
- package/concepts/pl/Tool-Projects.md +46 -0
- package/concepts/pl/Tool-ProposeGoal.md +43 -0
- package/concepts/pl/Tool-PushNotification.md +6 -0
- package/concepts/pl/Tool-REPL.md +47 -0
- package/concepts/pl/Tool-ReadMcpResource.md +32 -0
- package/concepts/pl/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/pl/Tool-ReadNotifications.md +27 -0
- package/concepts/pl/Tool-RemoteTrigger.md +7 -0
- package/concepts/pl/Tool-ScheduleWakeup.md +5 -0
- package/concepts/pl/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/pl/Tool-SendFeedback.md +38 -0
- package/concepts/pl/Tool-SendFile.md +36 -0
- package/concepts/pl/Tool-SendMessage.md +5 -0
- package/concepts/pl/Tool-SendUserFile.md +38 -0
- package/concepts/pl/Tool-SendUserMessage.md +38 -0
- package/concepts/pl/Tool-SuggestConnectors.md +28 -0
- package/concepts/pl/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/pl/Tool-SuggestSkills.md +33 -0
- package/concepts/pl/Tool-TaskCreate.md +6 -0
- package/concepts/pl/Tool-TaskGet.md +6 -0
- package/concepts/pl/Tool-TaskList.md +6 -0
- package/concepts/pl/Tool-TaskUpdate.md +6 -0
- package/concepts/pl/Tool-TodoWrite.md +43 -0
- package/concepts/pl/Tool-ToolSearch.md +5 -0
- package/concepts/pl/Tool-WebSearch.md +6 -0
- package/concepts/pl/Tools.md +26 -4
- package/concepts/pt-BR/GlobalSettings.md +2 -2
- package/concepts/pt-BR/Tool-Artifact.md +7 -0
- package/concepts/pt-BR/Tool-EndConversation.md +35 -0
- package/concepts/pt-BR/Tool-LSP.md +5 -0
- package/concepts/pt-BR/Tool-ListAgents.md +35 -0
- package/concepts/pt-BR/Tool-ListConnectors.md +34 -0
- package/concepts/pt-BR/Tool-ListMcpResources.md +35 -0
- package/concepts/pt-BR/Tool-ListPlugins.md +35 -0
- package/concepts/pt-BR/Tool-ListSkills.md +37 -0
- package/concepts/pt-BR/Tool-Monitor.md +7 -0
- package/concepts/pt-BR/Tool-Projects.md +46 -0
- package/concepts/pt-BR/Tool-ProposeGoal.md +43 -0
- package/concepts/pt-BR/Tool-PushNotification.md +6 -0
- package/concepts/pt-BR/Tool-REPL.md +47 -0
- package/concepts/pt-BR/Tool-ReadMcpResource.md +32 -0
- package/concepts/pt-BR/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/pt-BR/Tool-ReadNotifications.md +27 -0
- package/concepts/pt-BR/Tool-RemoteTrigger.md +7 -0
- package/concepts/pt-BR/Tool-ScheduleWakeup.md +5 -0
- package/concepts/pt-BR/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/pt-BR/Tool-SendFeedback.md +38 -0
- package/concepts/pt-BR/Tool-SendFile.md +36 -0
- package/concepts/pt-BR/Tool-SendMessage.md +5 -0
- package/concepts/pt-BR/Tool-SendUserFile.md +38 -0
- package/concepts/pt-BR/Tool-SendUserMessage.md +38 -0
- package/concepts/pt-BR/Tool-SuggestConnectors.md +28 -0
- package/concepts/pt-BR/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/pt-BR/Tool-SuggestSkills.md +33 -0
- package/concepts/pt-BR/Tool-TaskCreate.md +6 -0
- package/concepts/pt-BR/Tool-TaskGet.md +6 -0
- package/concepts/pt-BR/Tool-TaskList.md +6 -0
- package/concepts/pt-BR/Tool-TaskUpdate.md +6 -0
- package/concepts/pt-BR/Tool-TodoWrite.md +43 -0
- package/concepts/pt-BR/Tool-ToolSearch.md +5 -0
- package/concepts/pt-BR/Tool-WebSearch.md +6 -0
- package/concepts/pt-BR/Tools.md +26 -4
- package/concepts/ru/GlobalSettings.md +2 -2
- package/concepts/ru/Tool-Artifact.md +7 -0
- package/concepts/ru/Tool-EndConversation.md +35 -0
- package/concepts/ru/Tool-LSP.md +5 -0
- package/concepts/ru/Tool-ListAgents.md +35 -0
- package/concepts/ru/Tool-ListConnectors.md +34 -0
- package/concepts/ru/Tool-ListMcpResources.md +35 -0
- package/concepts/ru/Tool-ListPlugins.md +35 -0
- package/concepts/ru/Tool-ListSkills.md +37 -0
- package/concepts/ru/Tool-Monitor.md +7 -0
- package/concepts/ru/Tool-Projects.md +46 -0
- package/concepts/ru/Tool-ProposeGoal.md +43 -0
- package/concepts/ru/Tool-PushNotification.md +6 -0
- package/concepts/ru/Tool-REPL.md +47 -0
- package/concepts/ru/Tool-ReadMcpResource.md +32 -0
- package/concepts/ru/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/ru/Tool-ReadNotifications.md +27 -0
- package/concepts/ru/Tool-RemoteTrigger.md +7 -0
- package/concepts/ru/Tool-ScheduleWakeup.md +5 -0
- package/concepts/ru/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/ru/Tool-SendFeedback.md +38 -0
- package/concepts/ru/Tool-SendFile.md +36 -0
- package/concepts/ru/Tool-SendMessage.md +5 -0
- package/concepts/ru/Tool-SendUserFile.md +38 -0
- package/concepts/ru/Tool-SendUserMessage.md +38 -0
- package/concepts/ru/Tool-SuggestConnectors.md +28 -0
- package/concepts/ru/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/ru/Tool-SuggestSkills.md +33 -0
- package/concepts/ru/Tool-TaskCreate.md +6 -0
- package/concepts/ru/Tool-TaskGet.md +6 -0
- package/concepts/ru/Tool-TaskList.md +6 -0
- package/concepts/ru/Tool-TaskUpdate.md +6 -0
- package/concepts/ru/Tool-TodoWrite.md +43 -0
- package/concepts/ru/Tool-ToolSearch.md +5 -0
- package/concepts/ru/Tool-WebSearch.md +6 -0
- package/concepts/ru/Tools.md +26 -4
- package/concepts/th/GlobalSettings.md +2 -2
- package/concepts/th/Tool-Artifact.md +7 -0
- package/concepts/th/Tool-EndConversation.md +35 -0
- package/concepts/th/Tool-LSP.md +5 -0
- package/concepts/th/Tool-ListAgents.md +35 -0
- package/concepts/th/Tool-ListConnectors.md +34 -0
- package/concepts/th/Tool-ListMcpResources.md +35 -0
- package/concepts/th/Tool-ListPlugins.md +35 -0
- package/concepts/th/Tool-ListSkills.md +37 -0
- package/concepts/th/Tool-Monitor.md +7 -0
- package/concepts/th/Tool-Projects.md +46 -0
- package/concepts/th/Tool-ProposeGoal.md +43 -0
- package/concepts/th/Tool-PushNotification.md +6 -0
- package/concepts/th/Tool-REPL.md +47 -0
- package/concepts/th/Tool-ReadMcpResource.md +32 -0
- package/concepts/th/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/th/Tool-ReadNotifications.md +27 -0
- package/concepts/th/Tool-RemoteTrigger.md +7 -0
- package/concepts/th/Tool-ScheduleWakeup.md +5 -0
- package/concepts/th/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/th/Tool-SendFeedback.md +38 -0
- package/concepts/th/Tool-SendFile.md +36 -0
- package/concepts/th/Tool-SendMessage.md +5 -0
- package/concepts/th/Tool-SendUserFile.md +38 -0
- package/concepts/th/Tool-SendUserMessage.md +38 -0
- package/concepts/th/Tool-SuggestConnectors.md +28 -0
- package/concepts/th/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/th/Tool-SuggestSkills.md +33 -0
- package/concepts/th/Tool-TaskCreate.md +6 -0
- package/concepts/th/Tool-TaskGet.md +6 -0
- package/concepts/th/Tool-TaskList.md +6 -0
- package/concepts/th/Tool-TaskUpdate.md +6 -0
- package/concepts/th/Tool-TodoWrite.md +43 -0
- package/concepts/th/Tool-ToolSearch.md +5 -0
- package/concepts/th/Tool-WebSearch.md +13 -7
- package/concepts/th/Tools.md +26 -4
- package/concepts/tr/GlobalSettings.md +2 -2
- package/concepts/tr/Tool-Artifact.md +7 -0
- package/concepts/tr/Tool-EndConversation.md +35 -0
- package/concepts/tr/Tool-LSP.md +5 -0
- package/concepts/tr/Tool-ListAgents.md +35 -0
- package/concepts/tr/Tool-ListConnectors.md +34 -0
- package/concepts/tr/Tool-ListMcpResources.md +35 -0
- package/concepts/tr/Tool-ListPlugins.md +35 -0
- package/concepts/tr/Tool-ListSkills.md +37 -0
- package/concepts/tr/Tool-Monitor.md +7 -0
- package/concepts/tr/Tool-Projects.md +46 -0
- package/concepts/tr/Tool-ProposeGoal.md +43 -0
- package/concepts/tr/Tool-PushNotification.md +6 -0
- package/concepts/tr/Tool-REPL.md +47 -0
- package/concepts/tr/Tool-ReadMcpResource.md +32 -0
- package/concepts/tr/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/tr/Tool-ReadNotifications.md +27 -0
- package/concepts/tr/Tool-RemoteTrigger.md +7 -0
- package/concepts/tr/Tool-ScheduleWakeup.md +5 -0
- package/concepts/tr/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/tr/Tool-SendFeedback.md +38 -0
- package/concepts/tr/Tool-SendFile.md +36 -0
- package/concepts/tr/Tool-SendMessage.md +5 -0
- package/concepts/tr/Tool-SendUserFile.md +38 -0
- package/concepts/tr/Tool-SendUserMessage.md +38 -0
- package/concepts/tr/Tool-SuggestConnectors.md +28 -0
- package/concepts/tr/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/tr/Tool-SuggestSkills.md +33 -0
- package/concepts/tr/Tool-TaskCreate.md +6 -0
- package/concepts/tr/Tool-TaskGet.md +6 -0
- package/concepts/tr/Tool-TaskList.md +6 -0
- package/concepts/tr/Tool-TaskUpdate.md +6 -0
- package/concepts/tr/Tool-TodoWrite.md +43 -0
- package/concepts/tr/Tool-ToolSearch.md +5 -0
- package/concepts/tr/Tool-WebSearch.md +6 -0
- package/concepts/tr/Tools.md +26 -4
- package/concepts/uk/GlobalSettings.md +2 -2
- package/concepts/uk/Tool-Artifact.md +7 -0
- package/concepts/uk/Tool-EndConversation.md +35 -0
- package/concepts/uk/Tool-LSP.md +5 -0
- package/concepts/uk/Tool-ListAgents.md +35 -0
- package/concepts/uk/Tool-ListConnectors.md +34 -0
- package/concepts/uk/Tool-ListMcpResources.md +35 -0
- package/concepts/uk/Tool-ListPlugins.md +35 -0
- package/concepts/uk/Tool-ListSkills.md +37 -0
- package/concepts/uk/Tool-Monitor.md +7 -0
- package/concepts/uk/Tool-Projects.md +46 -0
- package/concepts/uk/Tool-ProposeGoal.md +43 -0
- package/concepts/uk/Tool-PushNotification.md +6 -0
- package/concepts/uk/Tool-REPL.md +47 -0
- package/concepts/uk/Tool-ReadMcpResource.md +32 -0
- package/concepts/uk/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/uk/Tool-ReadNotifications.md +27 -0
- package/concepts/uk/Tool-RemoteTrigger.md +7 -0
- package/concepts/uk/Tool-ScheduleWakeup.md +5 -0
- package/concepts/uk/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/uk/Tool-SendFeedback.md +38 -0
- package/concepts/uk/Tool-SendFile.md +36 -0
- package/concepts/uk/Tool-SendMessage.md +5 -0
- package/concepts/uk/Tool-SendUserFile.md +38 -0
- package/concepts/uk/Tool-SendUserMessage.md +38 -0
- package/concepts/uk/Tool-SuggestConnectors.md +28 -0
- package/concepts/uk/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/uk/Tool-SuggestSkills.md +33 -0
- package/concepts/uk/Tool-TaskCreate.md +6 -0
- package/concepts/uk/Tool-TaskGet.md +6 -0
- package/concepts/uk/Tool-TaskList.md +6 -0
- package/concepts/uk/Tool-TaskUpdate.md +6 -0
- package/concepts/uk/Tool-TodoWrite.md +43 -0
- package/concepts/uk/Tool-ToolSearch.md +5 -0
- package/concepts/uk/Tool-WebSearch.md +6 -0
- package/concepts/uk/Tools.md +26 -4
- package/concepts/zh/GlobalSettings.md +2 -2
- package/concepts/zh/Tool-Artifact.md +7 -0
- package/concepts/zh/Tool-EndConversation.md +35 -0
- package/concepts/zh/Tool-LSP.md +5 -0
- package/concepts/zh/Tool-ListAgents.md +35 -0
- package/concepts/zh/Tool-ListConnectors.md +34 -0
- package/concepts/zh/Tool-ListMcpResources.md +35 -0
- package/concepts/zh/Tool-ListPlugins.md +35 -0
- package/concepts/zh/Tool-ListSkills.md +37 -0
- package/concepts/zh/Tool-Monitor.md +7 -0
- package/concepts/zh/Tool-Projects.md +46 -0
- package/concepts/zh/Tool-ProposeGoal.md +43 -0
- package/concepts/zh/Tool-PushNotification.md +6 -0
- package/concepts/zh/Tool-REPL.md +47 -0
- package/concepts/zh/Tool-ReadMcpResource.md +32 -0
- package/concepts/zh/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/zh/Tool-ReadNotifications.md +27 -0
- package/concepts/zh/Tool-RemoteTrigger.md +7 -0
- package/concepts/zh/Tool-ScheduleWakeup.md +5 -0
- package/concepts/zh/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/zh/Tool-SendFeedback.md +38 -0
- package/concepts/zh/Tool-SendFile.md +36 -0
- package/concepts/zh/Tool-SendMessage.md +5 -0
- package/concepts/zh/Tool-SendUserFile.md +38 -0
- package/concepts/zh/Tool-SendUserMessage.md +38 -0
- package/concepts/zh/Tool-SuggestConnectors.md +28 -0
- package/concepts/zh/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/zh/Tool-SuggestSkills.md +33 -0
- package/concepts/zh/Tool-TaskCreate.md +6 -0
- package/concepts/zh/Tool-TaskGet.md +6 -0
- package/concepts/zh/Tool-TaskList.md +6 -0
- package/concepts/zh/Tool-TaskUpdate.md +6 -0
- package/concepts/zh/Tool-TodoWrite.md +43 -0
- package/concepts/zh/Tool-ToolSearch.md +5 -0
- package/concepts/zh/Tool-WebSearch.md +6 -0
- package/concepts/zh/Tools.md +26 -4
- package/concepts/zh-TW/GlobalSettings.md +2 -2
- package/concepts/zh-TW/Tool-Artifact.md +7 -0
- package/concepts/zh-TW/Tool-EndConversation.md +35 -0
- package/concepts/zh-TW/Tool-LSP.md +5 -0
- package/concepts/zh-TW/Tool-ListAgents.md +35 -0
- package/concepts/zh-TW/Tool-ListConnectors.md +34 -0
- package/concepts/zh-TW/Tool-ListMcpResources.md +35 -0
- package/concepts/zh-TW/Tool-ListPlugins.md +35 -0
- package/concepts/zh-TW/Tool-ListSkills.md +37 -0
- package/concepts/zh-TW/Tool-Monitor.md +7 -0
- package/concepts/zh-TW/Tool-Projects.md +46 -0
- package/concepts/zh-TW/Tool-ProposeGoal.md +43 -0
- package/concepts/zh-TW/Tool-PushNotification.md +6 -0
- package/concepts/zh-TW/Tool-REPL.md +47 -0
- package/concepts/zh-TW/Tool-ReadMcpResource.md +32 -0
- package/concepts/zh-TW/Tool-ReadMcpResourceDir.md +32 -0
- package/concepts/zh-TW/Tool-ReadNotifications.md +27 -0
- package/concepts/zh-TW/Tool-RemoteTrigger.md +7 -0
- package/concepts/zh-TW/Tool-ScheduleWakeup.md +5 -0
- package/concepts/zh-TW/Tool-SearchMcpRegistry.md +31 -0
- package/concepts/zh-TW/Tool-SendFeedback.md +38 -0
- package/concepts/zh-TW/Tool-SendFile.md +36 -0
- package/concepts/zh-TW/Tool-SendMessage.md +5 -0
- package/concepts/zh-TW/Tool-SendUserFile.md +38 -0
- package/concepts/zh-TW/Tool-SendUserMessage.md +38 -0
- package/concepts/zh-TW/Tool-SuggestConnectors.md +28 -0
- package/concepts/zh-TW/Tool-SuggestPluginInstall.md +39 -0
- package/concepts/zh-TW/Tool-SuggestSkills.md +33 -0
- package/concepts/zh-TW/Tool-TaskCreate.md +6 -0
- package/concepts/zh-TW/Tool-TaskGet.md +6 -0
- package/concepts/zh-TW/Tool-TaskList.md +6 -0
- package/concepts/zh-TW/Tool-TaskUpdate.md +6 -0
- package/concepts/zh-TW/Tool-TodoWrite.md +43 -0
- package/concepts/zh-TW/Tool-ToolSearch.md +5 -0
- package/concepts/zh-TW/Tool-WebSearch.md +6 -0
- package/concepts/zh-TW/Tools.md +26 -4
- package/dist/assets/{App-BaKGIW0-.js → App-CCu0y2Cq.js} +2 -2
- package/dist/assets/{MdxEditorPanel-DG-UE0PC.js → MdxEditorPanel-BBhgTmDk.js} +1 -1
- package/dist/assets/{Mobile-CQaUYdaf.js → Mobile-vN4lyiaz.js} +1 -1
- package/dist/assets/{ProxyStatsModal-j-Aty9Lu.js → ProxyStatsModal-BOflqr0R.js} +1 -1
- package/dist/assets/index-C3BRHDVF.js +2 -0
- package/dist/assets/seqResourceLoaders-DI0G5nu1.css +41 -0
- package/dist/assets/seqResourceLoaders-DpYqp6SP.js +2 -0
- package/dist/index.html +1 -1
- package/findcc.js +17 -8
- package/node_modules/@ccv/core/package.json +13 -0
- package/{server/lib → node_modules/@ccv/core/src}/approval-modal-prefs.js +1 -1
- package/node_modules/@ccv/core/src/clearCheckpoint.js +7 -0
- package/{src/utils → node_modules/@ccv/core/src}/contentFilter.js +207 -141
- package/{server/lib → node_modules/@ccv/core/src}/context-rules.js +2 -2
- package/{server/lib → node_modules/@ccv/core/src}/delta-reconstructor.js +60 -4
- package/{server/lib → node_modules/@ccv/core/src}/error-report.js +5 -4
- package/{server/lib → node_modules/@ccv/core/src}/session-boundary.js +3 -3
- package/{src/utils → node_modules/@ccv/core/src}/teammateDetector.js +9 -0
- package/{server/lib → node_modules/@ccv/core/src}/tools-xml-formatter.js +3 -3
- package/{server/lib → node_modules/@ccv/core/src}/v2-transcript-normalizer.js +1 -1
- package/{server/lib → node_modules/@ccv/core/src}/voice-pack-events.js +2 -2
- package/package.json +11 -96
- package/server/_paths.js +28 -7
- package/server/i18n.js +60 -0
- package/server/interceptor.js +36 -11
- package/server/lib/adapters/dingtalk-adapter.js +2 -2
- package/server/lib/adapters/discord-adapter.js +2 -2
- package/server/lib/adapters/feishu-adapter.js +2 -2
- package/server/lib/adapters/wecom-adapter.js +2 -2
- package/server/lib/approval-policy.js +29 -0
- package/server/lib/{ask-store.js → ask/ask-store.js} +3 -3
- package/server/lib/{perm-bridge.js → ask/perm-bridge.js} +5 -5
- package/server/lib/chat-queue.js +341 -0
- package/server/lib/cli-inject.js +1 -1
- package/server/lib/context-watcher.js +3 -3
- package/server/lib/create_system_prompt.js +0 -9
- package/server/lib/enrich-plan-input.js +1 -1
- package/server/lib/ensure-hooks.js +2 -2
- package/server/lib/file-access-policy.js +6 -1
- package/server/lib/file-api.js +17 -1
- package/server/lib/{dingtalk-bridge.js → im/dingtalk-bridge.js} +1 -1
- package/server/lib/{im-append-system.js → im/im-append-system.js} +5 -13
- package/server/lib/{im-bridge-core.js → im/im-bridge-core.js} +12 -6
- package/server/lib/{im-config.js → im/im-config.js} +1 -1
- package/server/lib/im/im-deny.js +4 -0
- package/server/lib/{im-lang.js → im/im-lang.js} +1 -1
- package/server/lib/{im-lock.js → im/im-lock.js} +2 -2
- package/server/lib/{im-process-manager.js → im/im-process-manager.js} +1 -1
- package/server/lib/{im-senders.js → im/im-senders.js} +1 -1
- package/server/lib/{im-skills.js → im/im-skills.js} +2 -2
- package/server/lib/interceptor-core.js +8 -5
- package/server/lib/kv-cache-analyzer.js +6 -5
- package/server/lib/launch-config.js +321 -0
- package/server/lib/log-file-utils.js +21 -0
- package/server/lib/log-management.js +6 -17
- package/server/lib/log-stream.js +1 -1
- package/server/lib/log-watcher.js +1 -1
- package/server/lib/model-system-prompts.js +1 -1
- package/server/lib/prefs-store.js +2 -2
- package/server/lib/project-prefs.js +6 -6
- package/server/lib/project-state.js +15 -0
- package/server/lib/{proxy-retry.js → proxy/proxy-retry.js} +2 -2
- package/server/lib/{proxy-stats.js → proxy/proxy-stats.js} +3 -3
- package/server/lib/sdk-adapter.js +6 -74
- package/server/lib/sdk-manager.js +383 -278
- package/server/lib/skills-api.js +1 -1
- package/server/lib/spawn-model-resolver.js +21 -6
- package/server/lib/stats-worker.js +2 -2
- package/server/lib/system-prompt-files.js +11 -10
- package/server/lib/system-prompt-render.js +23 -7
- package/server/lib/system-prompt-snapshots.js +452 -0
- package/server/lib/updater.js +63 -3
- package/server/lib/user-prompt-extract.js +5 -5
- package/server/lib/v2/adapter.js +3 -3
- package/server/lib/v2/conversation-store.js +1 -1
- package/server/lib/v2/convert.js +3 -3
- package/server/lib/v2/jsonl-read.js +1 -1
- package/server/lib/v2/live-feed.js +3 -3
- package/server/lib/v2/meta-rows.js +3 -3
- package/server/lib/v2/replay.js +1 -1
- package/server/lib/v2/session-list.js +1 -1
- package/server/lib/v2/session-owner.js +1 -1
- package/server/lib/v2/v2-writer.js +26 -1
- package/server/lib/v2/verify.js +1 -1
- package/server/lib/voice-pack-manager.js +4 -5
- package/server/lib/wire-compress.js +1 -1
- package/server/proxy.js +5 -5
- package/server/pty-manager.js +282 -184
- package/server/routes/ask-perm.js +1 -1
- package/server/routes/dingtalk.js +3 -3
- package/server/routes/events.js +2 -2
- package/server/routes/im.js +5 -5
- package/server/routes/preferences.js +3 -3
- package/server/routes/workspaces.js +1 -1
- package/server/server.js +207 -58
- package/server/system-prompt-templates/systemPromptModel.md +0 -8
- package/server/system-prompt-templates/systemPromptVariables.ar.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.da.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.de.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.es.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.fr.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.it.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.ja.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.ko.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.no.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.pl.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.pt-BR.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.ru.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.th.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.tr.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.uk.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.zh-TW.md +0 -7
- package/server/system-prompt-templates/systemPromptVariables.zh.md +0 -7
- package/concepts/ar/Tool-TeamCreate.md +0 -53
- package/concepts/ar/Tool-TeamDelete.md +0 -44
- package/concepts/ar/Tool-executeCode.md +0 -47
- package/concepts/ar/Tool-getDiagnostics.md +0 -44
- package/concepts/da/Tool-TeamCreate.md +0 -53
- package/concepts/da/Tool-TeamDelete.md +0 -44
- package/concepts/da/Tool-executeCode.md +0 -47
- package/concepts/da/Tool-getDiagnostics.md +0 -44
- package/concepts/de/Tool-TeamCreate.md +0 -53
- package/concepts/de/Tool-TeamDelete.md +0 -44
- package/concepts/de/Tool-executeCode.md +0 -47
- package/concepts/de/Tool-getDiagnostics.md +0 -44
- package/concepts/en/Tool-TeamCreate.md +0 -53
- package/concepts/en/Tool-TeamDelete.md +0 -44
- package/concepts/en/Tool-executeCode.md +0 -47
- package/concepts/en/Tool-getDiagnostics.md +0 -44
- package/concepts/es/Tool-TeamCreate.md +0 -53
- package/concepts/es/Tool-TeamDelete.md +0 -44
- package/concepts/es/Tool-executeCode.md +0 -47
- package/concepts/es/Tool-getDiagnostics.md +0 -44
- package/concepts/fr/Tool-TeamCreate.md +0 -53
- package/concepts/fr/Tool-TeamDelete.md +0 -44
- package/concepts/fr/Tool-executeCode.md +0 -47
- package/concepts/fr/Tool-getDiagnostics.md +0 -44
- package/concepts/it/Tool-TeamCreate.md +0 -53
- package/concepts/it/Tool-TeamDelete.md +0 -44
- package/concepts/it/Tool-executeCode.md +0 -47
- package/concepts/it/Tool-getDiagnostics.md +0 -44
- package/concepts/ja/Tool-TeamCreate.md +0 -53
- package/concepts/ja/Tool-TeamDelete.md +0 -44
- package/concepts/ja/Tool-executeCode.md +0 -47
- package/concepts/ja/Tool-getDiagnostics.md +0 -44
- package/concepts/ko/Tool-TeamCreate.md +0 -53
- package/concepts/ko/Tool-TeamDelete.md +0 -44
- package/concepts/ko/Tool-executeCode.md +0 -47
- package/concepts/ko/Tool-getDiagnostics.md +0 -44
- package/concepts/no/Tool-TeamCreate.md +0 -53
- package/concepts/no/Tool-TeamDelete.md +0 -44
- package/concepts/no/Tool-executeCode.md +0 -47
- package/concepts/no/Tool-getDiagnostics.md +0 -44
- package/concepts/pl/Tool-TeamCreate.md +0 -53
- package/concepts/pl/Tool-TeamDelete.md +0 -44
- package/concepts/pl/Tool-executeCode.md +0 -47
- package/concepts/pl/Tool-getDiagnostics.md +0 -44
- package/concepts/pt-BR/Tool-TeamCreate.md +0 -53
- package/concepts/pt-BR/Tool-TeamDelete.md +0 -44
- package/concepts/pt-BR/Tool-executeCode.md +0 -47
- package/concepts/pt-BR/Tool-getDiagnostics.md +0 -44
- package/concepts/ru/Tool-TeamCreate.md +0 -53
- package/concepts/ru/Tool-TeamDelete.md +0 -44
- package/concepts/ru/Tool-executeCode.md +0 -47
- package/concepts/ru/Tool-getDiagnostics.md +0 -44
- package/concepts/th/Tool-TeamCreate.md +0 -53
- package/concepts/th/Tool-TeamDelete.md +0 -44
- package/concepts/th/Tool-executeCode.md +0 -41
- package/concepts/th/Tool-getDiagnostics.md +0 -32
- package/concepts/tr/Tool-TeamCreate.md +0 -53
- package/concepts/tr/Tool-TeamDelete.md +0 -44
- package/concepts/tr/Tool-executeCode.md +0 -47
- package/concepts/tr/Tool-getDiagnostics.md +0 -44
- package/concepts/uk/Tool-TeamCreate.md +0 -53
- package/concepts/uk/Tool-TeamDelete.md +0 -44
- package/concepts/uk/Tool-executeCode.md +0 -47
- package/concepts/uk/Tool-getDiagnostics.md +0 -44
- package/concepts/zh/Tool-TeamCreate.md +0 -53
- package/concepts/zh/Tool-TeamDelete.md +0 -44
- package/concepts/zh/Tool-executeCode.md +0 -47
- package/concepts/zh/Tool-getDiagnostics.md +0 -44
- package/concepts/zh-TW/Tool-TeamCreate.md +0 -53
- package/concepts/zh-TW/Tool-TeamDelete.md +0 -44
- package/concepts/zh-TW/Tool-executeCode.md +0 -47
- package/concepts/zh-TW/Tool-getDiagnostics.md +0 -44
- package/dist/assets/index-CyiyzBfV.js +0 -2
- package/dist/assets/seqResourceLoaders-BgD_Rwvc.css +0 -41
- package/dist/assets/seqResourceLoaders-XMiEIVyV.js +0 -2
- package/src/utils/apiUrl.js +0 -26
- package/src/utils/askFallback.js +0 -21
- package/src/utils/askOptionDesc.js +0 -55
- package/src/utils/askPortalMatcher.js +0 -54
- package/src/utils/autoApproveOptions.js +0 -27
- package/src/utils/avatarAnimationPostPass.js +0 -49
- package/src/utils/builtinPresets.js +0 -18
- package/src/utils/clearCheckpoint.js +0 -7
- package/src/utils/commandValidator.js +0 -45
- package/src/utils/contextRaw.js +0 -18
- package/src/utils/contextSidebarNavigation.js +0 -16
- package/src/utils/contextTurns.js +0 -117
- package/src/utils/displayScaleHelper.js +0 -47
- package/src/utils/effectiveModel.js +0 -17
- package/src/utils/entry-slim.js +0 -563
- package/src/utils/entryCache.js +0 -144
- package/src/utils/errorReport.js +0 -6
- package/src/utils/fileExpandedPathsStorage.js +0 -70
- package/src/utils/fileIcons.jsx +0 -36
- package/src/utils/fileOpen.js +0 -37
- package/src/utils/formatters.js +0 -48
- package/src/utils/gitApi.js +0 -50
- package/src/utils/gitTreeBuilder.js +0 -19
- package/src/utils/helpers.js +0 -854
- package/src/utils/identityHeal.js +0 -108
- package/src/utils/imConnState.js +0 -59
- package/src/utils/imOrigin.js +0 -24
- package/src/utils/imTr.js +0 -7
- package/src/utils/imageCompress.js +0 -83
- package/src/utils/imageDownscale.js +0 -28
- package/src/utils/imageResize.js +0 -112
- package/src/utils/ingestPipeline.js +0 -47
- package/src/utils/isProxyMode.js +0 -11
- package/src/utils/lazyWithReload.js +0 -53
- package/src/utils/markdown.js +0 -30
- package/src/utils/markdownIncremental.js +0 -39
- package/src/utils/markdownProfiler.js +0 -113
- package/src/utils/mdExtensionDetect.js +0 -64
- package/src/utils/memoryLinkParser.js +0 -44
- package/src/utils/modalMask.js +0 -15
- package/src/utils/modelSuggestions.js +0 -48
- package/src/utils/monotime.js +0 -6
- package/src/utils/pinnedMenu.js +0 -55
- package/src/utils/presetShortcuts.js +0 -14
- package/src/utils/projectAlias.js +0 -135
- package/src/utils/promptClassifier.js +0 -112
- package/src/utils/promptDetect.js +0 -196
- package/src/utils/promptNav.js +0 -60
- package/src/utils/ptyChunkBuilder.js +0 -251
- package/src/utils/quickMenuHoverIntent.js +0 -35
- package/src/utils/rateLimitParser.js +0 -119
- package/src/utils/readResultPool.js +0 -106
- package/src/utils/refreshCachedItemProp.js +0 -30
- package/src/utils/resizeCalc.js +0 -21
- package/src/utils/resolveLocalized.js +0 -17
- package/src/utils/searchApi.js +0 -47
- package/src/utils/searchReplace.js +0 -51
- package/src/utils/seqResourceLoaders.js +0 -79
- package/src/utils/sessionManager.js +0 -482
- package/src/utils/sessionMerge.js +0 -239
- package/src/utils/skillModalController.js +0 -111
- package/src/utils/skillsParser.js +0 -116
- package/src/utils/slashCommandLabels.js +0 -80
- package/src/utils/splitDragCalc.js +0 -73
- package/src/utils/stickyBottomController.js +0 -643
- package/src/utils/svgSanitize.js +0 -48
- package/src/utils/systemTags.js +0 -47
- package/src/utils/tClaude.js +0 -20
- package/src/utils/teamModalBuilder.js +0 -351
- package/src/utils/teamSessionParser.js +0 -190
- package/src/utils/teammateAvatars.js +0 -194
- package/src/utils/termDiag.js +0 -114
- package/src/utils/terminalClipboard.js +0 -117
- package/src/utils/terminalWriteQueue.js +0 -398
- package/src/utils/thinkingMerge.js +0 -49
- package/src/utils/toolCatalog.js +0 -29
- package/src/utils/toolResultBuilder.js +0 -411
- package/src/utils/toolResultClassifier.js +0 -16
- package/src/utils/toolResultCore.js +0 -194
- package/src/utils/toolsDiff.js +0 -44
- package/src/utils/toolsXmlFormatter.js +0 -3
- package/src/utils/ultraplanController.js +0 -109
- package/src/utils/ultraplanExperts.js +0 -86
- package/src/utils/ultraplanTemplates.js +0 -154
- package/src/utils/userImageRefs.js +0 -49
- package/src/utils/v3Assembler.js +0 -125
- package/src/utils/v3Rows.js +0 -49
- package/src/utils/voicePackPlayer.js +0 -233
- package/src/utils/webSearchGrouping.js +0 -111
- package/src/utils/workflowFormat.js +0 -52
- package/src/utils/workflowRuns.js +0 -118
- package/src/utils/workflowStore.js +0 -94
- /package/{src/utils → node_modules/@ccv/core/src}/requestType.js +0 -0
- /package/server/lib/{ask-bridge.js → ask/ask-bridge.js} +0 -0
- /package/server/lib/{ask-constants.js → ask/ask-constants.js} +0 -0
- /package/server/lib/{ask-reaper.js → ask/ask-reaper.js} +0 -0
- /package/server/lib/{dingtalk-config.js → im/dingtalk-config.js} +0 -0
- /package/server/lib/{im-log-watcher.js → im/im-log-watcher.js} +0 -0
- /package/server/lib/{proxy-env.js → proxy/proxy-env.js} +0 -0
- /package/server/lib/{proxy-errors.js → proxy/proxy-errors.js} +0 -0
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
* sdk-manager.js — Agent SDK session lifecycle manager.
|
|
3
3
|
*
|
|
4
4
|
* Wraps @anthropic-ai/claude-agent-sdk query() to provide:
|
|
5
|
-
* -
|
|
5
|
+
* - User-message input and multi-turn conversation via session resume
|
|
6
6
|
* - canUseTool callback for AskUserQuestion + permission approval
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
7
|
+
* - Turn-end signaling (SDK 'result' message → Stop-hook equivalent)
|
|
8
|
+
*
|
|
9
|
+
* Display/persistence is NOT synthesized here: the SDK child process talks to
|
|
10
|
+
* the Anthropic API through cc-viewer's loopback proxy (ANTHROPIC_BASE_URL is
|
|
11
|
+
* injected via options.env + options.settings), so request/response capture,
|
|
12
|
+
* streaming typewriter chunks, and v2 storage all flow through the exact same
|
|
13
|
+
* wire path as PTY mode (proxy → fetch hook → V2Writer → SSE).
|
|
9
14
|
*/
|
|
10
15
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
16
|
+
import { ASK_TIMEOUT_MS } from './ask/ask-constants.js';
|
|
17
|
+
import { withDefaultThinkingDisplay, resolveLaunchSystemPrompt, launchArgsToExtraArgs } from './launch-config.js';
|
|
18
|
+
import { evaluateImDeny } from './im-deny.js';
|
|
19
|
+
import { APPROVAL_TOOLS, isPublishCommand } from './approval-policy.js';
|
|
13
20
|
|
|
14
21
|
let _query;
|
|
15
22
|
try {
|
|
@@ -19,45 +26,53 @@ try {
|
|
|
19
26
|
console.warn('[SDK] Agent SDK not available:', err.message);
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
// Test seam — inject a fake query() (
|
|
23
|
-
//
|
|
29
|
+
// Test seam — inject a fake query() (following im-bridge-core.js's __setFetchForTests
|
|
30
|
+
// convention). Only lets unit tests inject a fake async-generator; no business logic changes.
|
|
24
31
|
export function __setQueryForTests(fn) { _query = fn; }
|
|
25
32
|
|
|
26
|
-
// Interactive tool names — filtered from entries, handled via canUseTool → WS
|
|
27
|
-
const INTERACTIVE_TOOLS = new Set(['AskUserQuestion', 'ExitPlanMode']);
|
|
28
|
-
|
|
29
33
|
// Session state
|
|
30
34
|
let _sessionId = null;
|
|
31
|
-
let _model = null;
|
|
32
35
|
let _cwd = null;
|
|
33
|
-
let _projectName = null;
|
|
34
36
|
let _permissionMode = 'default';
|
|
35
|
-
let
|
|
37
|
+
let _childEnv = null; // env handed to the SDK child (proxy injection etc.)
|
|
38
|
+
let _settings = null; // merged Settings object for options.settings
|
|
39
|
+
let _launchModel = null; // --model lifted from user args (options.model)
|
|
40
|
+
let _launchResume = null; // startup continuation intent { continue, resumeId, forkSession } — first query only
|
|
41
|
+
let _userArgs = []; // remaining user args → options.extraArgs passthrough
|
|
42
|
+
let _claudeExecutable = null; // pathToClaudeCodeExecutable — resolved with the same priority as PTY mode (configured → codefuse → native → PATH → npm) so SDK sessions don't fall back to a PATH claude that host security policy may kill on headless spawn
|
|
36
43
|
let _activeQuery = null;
|
|
37
44
|
let _queryBusy = false; // concurrency guard
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
// Stable timestamp per conversation turn — used as dedup key by frontend
|
|
41
|
-
let _turnTimestamp = null;
|
|
42
|
-
|
|
43
|
-
// Streaming accumulation state
|
|
44
|
-
let _streamingContent = [];
|
|
45
|
-
let _currentBlockData = null;
|
|
46
|
-
let _streamingRequestId = null;
|
|
47
|
-
let _streamThrottleTimer = null;
|
|
45
|
+
let _initAnnouncedSid = ''; // sessionId whose slash-command surface was already announced (reset on full reset)
|
|
46
|
+
let _lastInitSnapshot = null; // last sdk-init payload for WS reconnect replay
|
|
48
47
|
|
|
49
|
-
// Callbacks registered by
|
|
50
|
-
let _onEntry = null;
|
|
51
|
-
let _onStreamingStatus = null;
|
|
48
|
+
// Callbacks registered by cli.js
|
|
52
49
|
let _onTurnEnd = null; // SDK mode has no Stop hook (ensureHooks() skipped) — fire turnEnd directly when the SDK 'result' message arrives
|
|
50
|
+
let _onQueryError = null; // query-level failure → (message: string) => void; cli.js forwards to a WS toast
|
|
53
51
|
let _broadcastWs = null;
|
|
54
52
|
let _runWaterfallHook = null;
|
|
55
53
|
|
|
56
|
-
//
|
|
54
|
+
// Display/persistence flows through the SAME wire path as PTY mode: the SDK child's API
|
|
55
|
+
// traffic reaches ccv's loopback proxy (verified — the injected ANTHROPIC_BASE_URL survives
|
|
56
|
+
// in the spawn env), the main-process fetch hook captures it, and `_v2Writer` writes the v2
|
|
57
|
+
// transcript that both panels + SSE read. The SDK channel here only carries what the wire
|
|
58
|
+
// path can't see: turn-end (no Stop hook in SDK mode), turn-level error toasts, the
|
|
59
|
+
// sdk-init/sdk-compact lifecycle metadata, and canUseTool approvals. It deliberately does
|
|
60
|
+
// NOT persist conversation content or drive streaming/typewriter — those are wire-owned.
|
|
61
|
+
|
|
62
|
+
// Pending canUseTool promises: id → { kind, resolve, replay, startedAt, timeoutMs }
|
|
63
|
+
// replay is the exact broadcast payload that announced this approval — retained so a
|
|
64
|
+
// fresh WS connection can re-announce it (server.js connection replay), otherwise a
|
|
65
|
+
// reconnect mid-approval orphans the modal and the wait silently times out to deny.
|
|
57
66
|
const _pendingApprovals = new Map();
|
|
58
67
|
|
|
59
|
-
// Message queue for messages sent while a query is running
|
|
68
|
+
// Message queue for messages sent while a query is running. Items are { id, text, ts } —
|
|
69
|
+
// the id lets web clients act on individual queued bubbles (send-now / remove) and the
|
|
70
|
+
// queue-state WS broadcast keeps every client in sync (server is the source of truth).
|
|
60
71
|
let _messageQueue = [];
|
|
72
|
+
// Stop semantics (product decision): Stop parks the queue instead of dropping it —
|
|
73
|
+
// interruptTurn sets this flag so sendUserMessage's drain loop exits without running the
|
|
74
|
+
// parked items; cleared when a fresh user message / send-now starts a new turn.
|
|
75
|
+
let _suppressDrain = false;
|
|
61
76
|
|
|
62
77
|
export function isSdkAvailable() {
|
|
63
78
|
return typeof _query === 'function';
|
|
@@ -66,16 +81,40 @@ export function isSdkAvailable() {
|
|
|
66
81
|
/**
|
|
67
82
|
* Initialize SDK session.
|
|
68
83
|
* Does NOT start a query — waits for the first user message via sendUserMessage().
|
|
84
|
+
*
|
|
85
|
+
* @param {string} cwd
|
|
86
|
+
* @param {string} projectName
|
|
87
|
+
* @param {object} deps
|
|
88
|
+
* @param {function} deps.onTurnEnd — ({sessionId, ts}) => void, fired on SDK 'result'
|
|
89
|
+
* @param {function} [deps.onQueryError] — (message: string) => void, fired when the
|
|
90
|
+
* query itself fails (spawn/protocol/iterator errors) — until this existed the only
|
|
91
|
+
* surfacing was console.error, invisible in the Web UI
|
|
92
|
+
* @param {function} deps.broadcastWs — (msg) => void, terminal-WS broadcast for approvals
|
|
93
|
+
* @param {string} [deps.permissionMode]
|
|
94
|
+
* @param {function} [deps.runWaterfallHook] — plugin waterfall (onPlanRequest/onAskRequest/onPermRequest)
|
|
95
|
+
* @param {object} [deps.env] — child env (must already contain ANTHROPIC_BASE_URL → ccv proxy)
|
|
96
|
+
* @param {object} [deps.settings] — merged Settings object (env.ANTHROPIC_BASE_URL double-injection)
|
|
97
|
+
* @param {string} [deps.model] — --model lifted from user args (options.model)
|
|
98
|
+
* @param {object} [deps.launchResume] — startup continuation { continue, resumeId, forkSession }
|
|
99
|
+
* @param {string[]} [deps.userArgs] — remaining user args (extraArgs passthrough)
|
|
100
|
+
* @param {string} [deps.claudeExecutable] — resolved claude binary (options.pathToClaudeCodeExecutable);
|
|
101
|
+
* must come from the same selection as PTY mode, else the SDK spawns a PATH claude that
|
|
102
|
+
* host security tooling (e.g. agent-security headless guards) may SIGKILL on spawn
|
|
69
103
|
*/
|
|
70
|
-
export function initSdkSession(cwd, projectName, {
|
|
104
|
+
export function initSdkSession(cwd, projectName, { onTurnEnd, onQueryError, broadcastWs, permissionMode, runWaterfallHook, env, settings, model, launchResume, userArgs, claudeExecutable }) {
|
|
71
105
|
_cwd = cwd;
|
|
72
|
-
|
|
73
|
-
_onEntry = onEntry;
|
|
74
|
-
_onStreamingStatus = onStreamingStatus;
|
|
106
|
+
void projectName; // reserved (display name comes from the wire path)
|
|
75
107
|
_onTurnEnd = onTurnEnd;
|
|
108
|
+
_onQueryError = onQueryError || null;
|
|
76
109
|
_broadcastWs = broadcastWs;
|
|
77
110
|
_permissionMode = permissionMode || 'default';
|
|
78
111
|
_runWaterfallHook = runWaterfallHook || null;
|
|
112
|
+
_childEnv = env || null;
|
|
113
|
+
_settings = settings || null;
|
|
114
|
+
_launchModel = model || null;
|
|
115
|
+
_launchResume = launchResume || null;
|
|
116
|
+
_userArgs = Array.isArray(userArgs) ? userArgs : [];
|
|
117
|
+
_claudeExecutable = claudeExecutable || null;
|
|
79
118
|
_resetFullState();
|
|
80
119
|
}
|
|
81
120
|
|
|
@@ -88,49 +127,102 @@ export async function sendUserMessage(text) {
|
|
|
88
127
|
|
|
89
128
|
// If a query is already running, queue this message and return
|
|
90
129
|
if (_queryBusy) {
|
|
91
|
-
_messageQueue.push(text);
|
|
130
|
+
_messageQueue.push(_makeQueueItem(text));
|
|
131
|
+
_broadcastQueueState();
|
|
92
132
|
return;
|
|
93
133
|
}
|
|
94
134
|
|
|
95
135
|
_queryBusy = true;
|
|
136
|
+
// A fresh user-initiated turn re-arms automatic draining of parked (Stop-kept) items.
|
|
137
|
+
_suppressDrain = false;
|
|
96
138
|
|
|
97
139
|
try {
|
|
98
140
|
await _executeQuery(text);
|
|
99
141
|
|
|
100
142
|
// Process any queued messages
|
|
101
|
-
while (_messageQueue.length > 0) {
|
|
143
|
+
while (_messageQueue.length > 0 && !_suppressDrain) {
|
|
102
144
|
const next = _messageQueue.shift();
|
|
103
|
-
|
|
145
|
+
_broadcastQueueState();
|
|
146
|
+
await _executeQuery(next.text);
|
|
104
147
|
}
|
|
105
148
|
} finally {
|
|
106
149
|
_queryBusy = false;
|
|
107
150
|
}
|
|
108
151
|
}
|
|
109
152
|
|
|
153
|
+
function _makeQueueItem(text) {
|
|
154
|
+
return {
|
|
155
|
+
id: 'q_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8),
|
|
156
|
+
text,
|
|
157
|
+
ts: Date.now(),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Broadcast the queue snapshot to all terminal-WS clients (drives the floating bubbles). */
|
|
162
|
+
function _broadcastQueueState() {
|
|
163
|
+
if (!_broadcastWs) return;
|
|
164
|
+
try {
|
|
165
|
+
_broadcastWs({ type: 'queue-state', items: _messageQueue.map(({ id, text, ts }) => ({ id, text, ts })) });
|
|
166
|
+
} catch (err) { console.warn('[sdk-manager] queue-state broadcast threw:', err?.message); }
|
|
167
|
+
}
|
|
168
|
+
|
|
110
169
|
/**
|
|
111
170
|
* Execute a single query for one user message.
|
|
112
171
|
*/
|
|
113
172
|
async function _executeQuery(text) {
|
|
114
|
-
// Generate stable timestamp for this turn — all entries share it for dedup
|
|
115
|
-
_turnTimestamp = new Date().toISOString();
|
|
116
|
-
_streamingRequestId = `sdk_${Date.now()}`;
|
|
117
|
-
|
|
118
|
-
// Accumulate user message BEFORE creating entries (this is the request)
|
|
119
|
-
_accumulatedMessages.push({ role: 'user', content: text });
|
|
120
|
-
|
|
121
173
|
const options = {
|
|
122
174
|
cwd: _cwd,
|
|
123
|
-
includePartialMessages: true,
|
|
124
175
|
permissionMode: _permissionMode,
|
|
125
|
-
canUseTool
|
|
176
|
+
// canUseTool is mounted in EVERY mode (including bypassPermissions) so the
|
|
177
|
+
// npm-publish hard gate survives --d, mirroring perm-bridge.js's bypass
|
|
178
|
+
// exemption. In bypass mode the callback early-allows everything except
|
|
179
|
+
// publish commands and the two interactive tools (see _handleCanUseTool).
|
|
180
|
+
canUseTool: _handleCanUseTool,
|
|
126
181
|
..._permissionMode === 'bypassPermissions' && { allowDangerouslySkipPermissions: true },
|
|
127
182
|
};
|
|
128
|
-
|
|
183
|
+
// env carries the loopback-proxy base URL — the SDK passes it through to the
|
|
184
|
+
// spawned CLI verbatim (verified against sdk.mjs: env defaults to process.env
|
|
185
|
+
// and is only ever added to, never filtered).
|
|
186
|
+
if (_childEnv) options.env = _childEnv;
|
|
187
|
+
if (_settings) options.settings = _settings;
|
|
188
|
+
if (_launchModel) options.model = _launchModel;
|
|
189
|
+
// Same executable priority as PTY mode — without this the SDK resolves claude from
|
|
190
|
+
// PATH, which on guarded hosts picks a binary that gets SIGKILLed on headless spawn.
|
|
191
|
+
if (_claudeExecutable) options.pathToClaudeCodeExecutable = _claudeExecutable;
|
|
192
|
+
|
|
193
|
+
// Resume semantics: mid-session turns resume the captured session id; the FIRST
|
|
194
|
+
// query of a startup-continuation launch (-c/-r/--fork-session) uses the launch intent.
|
|
195
|
+
let resumeIntent = null;
|
|
129
196
|
if (_sessionId) {
|
|
130
197
|
options.resume = _sessionId;
|
|
198
|
+
resumeIntent = { resumeValue: _sessionId, picker: false, fork: false };
|
|
199
|
+
} else if (_launchResume) {
|
|
200
|
+
if (_launchResume.resumeId) options.resume = _launchResume.resumeId;
|
|
201
|
+
else if (_launchResume.continue) options.continue = true;
|
|
202
|
+
if (_launchResume.forkSession) options.forkSession = true;
|
|
203
|
+
resumeIntent = { resumeValue: _launchResume.resumeId ?? null, picker: false, fork: !!_launchResume.forkSession };
|
|
131
204
|
}
|
|
132
205
|
|
|
133
|
-
|
|
206
|
+
// System-prompt injection, byte-identical to the PTY link (shared pipeline in
|
|
207
|
+
// lib/launch-config.js): fresh launch → sentinel/model-matched files (rendered);
|
|
208
|
+
// resume turn → pinned snapshot bytes (never re-rendered). Resume-turn pendings are
|
|
209
|
+
// NOT persisted — their only consumer (SessionStart-hook Bind B) is dormant in SDK mode.
|
|
210
|
+
// Injection failure must never block the query (PTY parity: PR#128 fallback).
|
|
211
|
+
const launchArgs = process.env.CCV_SKIP_THINKING_DISPLAY === '1' ? _userArgs : withDefaultThinkingDisplay(_userArgs);
|
|
212
|
+
try {
|
|
213
|
+
const lc = resolveLaunchSystemPrompt({
|
|
214
|
+
spawnDir: _cwd,
|
|
215
|
+
extraArgs: launchArgs,
|
|
216
|
+
env: _childEnv || process.env,
|
|
217
|
+
launchSettings: _settings,
|
|
218
|
+
resume: resumeIntent,
|
|
219
|
+
persistPending: !resumeIntent,
|
|
220
|
+
});
|
|
221
|
+
options.extraArgs = launchArgsToExtraArgs([...launchArgs, ...lc.sysPrompt.args]);
|
|
222
|
+
} catch (err) {
|
|
223
|
+
console.warn('[SDK] launch system-prompt resolution failed, querying without injected prompt:', err?.message || err);
|
|
224
|
+
options.extraArgs = launchArgsToExtraArgs(launchArgs);
|
|
225
|
+
}
|
|
134
226
|
|
|
135
227
|
try {
|
|
136
228
|
_activeQuery = _query({ prompt: text, options });
|
|
@@ -141,90 +233,68 @@ async function _executeQuery(text) {
|
|
|
141
233
|
} catch (err) {
|
|
142
234
|
if (err.name !== 'AbortError') {
|
|
143
235
|
console.error('[SDK] Query error:', err.message);
|
|
236
|
+
// Surface query-level failures to the Web UI — console.error is invisible there
|
|
237
|
+
// (a dead query otherwise looks exactly like a hung one). Callback throw must
|
|
238
|
+
// never mask the original error or break the finally cleanup.
|
|
239
|
+
if (_onQueryError) {
|
|
240
|
+
try { _onQueryError(String(err?.message || err)); }
|
|
241
|
+
catch (cbErr) { console.warn('[sdk-manager] onQueryError threw:', cbErr?.message); }
|
|
242
|
+
}
|
|
144
243
|
}
|
|
145
244
|
} finally {
|
|
146
|
-
_resetStreamingState();
|
|
147
245
|
_activeQuery = null;
|
|
148
|
-
if (_onStreamingStatus) _onStreamingStatus(buildStreamingStatus(false));
|
|
149
246
|
}
|
|
150
247
|
}
|
|
151
248
|
|
|
152
249
|
/**
|
|
153
|
-
* Process a single SDK message.
|
|
250
|
+
* Process a single SDK message. Display/persistence flows through the wire path
|
|
251
|
+
* (proxy → fetch hook → v2 transcript), same as PTY mode — here we only track session
|
|
252
|
+
* continuity, fire turn-end on 'result', surface turn errors, and broadcast the
|
|
253
|
+
* SDK-only lifecycle metadata (sdk-init / sdk-compact) the wire path never sees.
|
|
154
254
|
*/
|
|
155
255
|
function _processMessage(msg) {
|
|
156
256
|
switch (msg.type) {
|
|
157
257
|
case 'system':
|
|
158
258
|
if (msg.session_id) _sessionId = msg.session_id;
|
|
159
|
-
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (lastMsg && lastMsg.role === 'assistant' && Array.isArray(lastMsg.content) && Array.isArray(msg.message.content)) {
|
|
182
|
-
lastMsg.content = [...lastMsg.content, ...msg.message.content];
|
|
183
|
-
} else {
|
|
184
|
-
_accumulatedMessages.push({ role: 'assistant', content: msg.message.content });
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Only filter interactive tools from the RESPONSE content (Last Response rendering),
|
|
188
|
-
// NOT from body.messages (history) — filtering history creates orphaned tool_results
|
|
189
|
-
const filteredContent = _filterInteractiveContent(msg.message.content);
|
|
190
|
-
const displayMsg = { ...msg, message: { ...msg.message, content: filteredContent } };
|
|
191
|
-
|
|
192
|
-
// Convert to JSONL entry with stable turn timestamp and real SDK metadata
|
|
193
|
-
const entry = sdkToJSONLEntry(displayMsg, requestMessages, _model, _projectName, {
|
|
194
|
-
timestamp: _turnTimestamp,
|
|
195
|
-
tools: _sdkTools,
|
|
259
|
+
// Init carries the session's slash-command surface (no TUI `/` help in a
|
|
260
|
+
// headless session); compact_boundary is an SDK-only event (no wire delta)
|
|
261
|
+
// — broadcast both so clients see the same lifecycle cues PTY users get.
|
|
262
|
+
if (msg.subtype === 'init' && _broadcastWs
|
|
263
|
+
&& Array.isArray(msg.slash_commands) && msg.slash_commands.length > 0
|
|
264
|
+
&& msg.session_id !== _initAnnouncedSid) {
|
|
265
|
+
_initAnnouncedSid = msg.session_id;
|
|
266
|
+
_lastInitSnapshot = {
|
|
267
|
+
type: 'sdk-init',
|
|
268
|
+
sessionId: msg.session_id,
|
|
269
|
+
model: msg.model,
|
|
270
|
+
slashCommands: msg.slash_commands,
|
|
271
|
+
tools: msg.tools,
|
|
272
|
+
};
|
|
273
|
+
_broadcastWs(_lastInitSnapshot);
|
|
274
|
+
} else if (msg.subtype === 'compact_boundary' && _broadcastWs) {
|
|
275
|
+
const meta = msg.compact_metadata;
|
|
276
|
+
_broadcastWs({
|
|
277
|
+
type: 'sdk-compact',
|
|
278
|
+
trigger: meta && meta.trigger,
|
|
279
|
+
preTokens: meta && meta.pre_tokens,
|
|
280
|
+
postTokens: meta && meta.post_tokens,
|
|
196
281
|
});
|
|
197
|
-
if (_onEntry) _onEntry(entry);
|
|
198
282
|
}
|
|
199
|
-
if (msg.session_id) _sessionId = msg.session_id;
|
|
200
283
|
break;
|
|
201
284
|
|
|
202
285
|
case 'user':
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
} else {
|
|
210
|
-
_accumulatedMessages.push({ role: 'user', content: msg.message.content });
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
break;
|
|
214
|
-
|
|
215
|
-
case 'stream_event':
|
|
216
|
-
if (_onStreamingStatus) {
|
|
217
|
-
_onStreamingStatus(buildStreamingStatus(true, { model: _model }));
|
|
218
|
-
}
|
|
219
|
-
if (!msg.parent_tool_use_id) {
|
|
220
|
-
_processStreamEvent(msg.event);
|
|
221
|
-
}
|
|
286
|
+
case 'assistant':
|
|
287
|
+
// Conversation content is persisted by the wire path (proxy → fetch hook → v2),
|
|
288
|
+
// not here — the SDK child's API traffic reaches ccv's proxy and is captured with
|
|
289
|
+
// full fidelity (real user prompts + tool calls), so accumulating it again would
|
|
290
|
+
// double-write. Here we only track session continuity.
|
|
291
|
+
if (msg.session_id) _sessionId = msg.session_id;
|
|
222
292
|
break;
|
|
223
293
|
|
|
224
294
|
case 'result':
|
|
225
295
|
if (msg.session_id) _sessionId = msg.session_id;
|
|
226
|
-
|
|
227
|
-
// SDK turn-end signal
|
|
296
|
+
_notifyTurnError(msg);
|
|
297
|
+
// SDK turn-end signal. Equivalent to Claude Code's Stop hook
|
|
228
298
|
// in CLI mode — fires once per user-prompt response when the whole chain
|
|
229
299
|
// (assistant text + all tool calls + final reply) completes. SDK mode
|
|
230
300
|
// doesn't go through ensureHooks() so this in-process callback is the
|
|
@@ -241,124 +311,53 @@ function _processMessage(msg) {
|
|
|
241
311
|
}
|
|
242
312
|
|
|
243
313
|
/**
|
|
244
|
-
*
|
|
314
|
+
* Surface a failed turn to the Web UI — the wire path persists the failed entry but
|
|
315
|
+
* never pushes a toast, so a dead/errored turn would otherwise look like a hang.
|
|
245
316
|
*/
|
|
246
|
-
function
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
* Accumulates content blocks and pushes throttled in-progress entries.
|
|
255
|
-
*/
|
|
256
|
-
function _processStreamEvent(event) {
|
|
257
|
-
if (!event) return;
|
|
258
|
-
const type = event.type;
|
|
259
|
-
|
|
260
|
-
if (type === 'message_start') {
|
|
261
|
-
_streamingContent = [];
|
|
262
|
-
_currentBlockData = null;
|
|
263
|
-
} else if (type === 'content_block_start') {
|
|
264
|
-
const block = event.content_block;
|
|
265
|
-
if (!block) return;
|
|
266
|
-
if (block.type === 'text') {
|
|
267
|
-
_currentBlockData = { type: 'text', text: block.text || '' };
|
|
268
|
-
} else if (block.type === 'thinking') {
|
|
269
|
-
_currentBlockData = { type: 'thinking', thinking: block.thinking || '' };
|
|
270
|
-
} else if (block.type === 'tool_use') {
|
|
271
|
-
if (INTERACTIVE_TOOLS.has(block.name)) {
|
|
272
|
-
_currentBlockData = null;
|
|
273
|
-
} else {
|
|
274
|
-
_currentBlockData = { type: 'tool_use', id: block.id, name: block.name, input: {} };
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
_currentBlockData = null;
|
|
278
|
-
}
|
|
279
|
-
} else if (type === 'content_block_delta') {
|
|
280
|
-
const delta = event.delta;
|
|
281
|
-
if (!delta || !_currentBlockData) return;
|
|
282
|
-
if (delta.type === 'text_delta' && _currentBlockData.type === 'text') {
|
|
283
|
-
_currentBlockData.text += delta.text || '';
|
|
284
|
-
_pushStreamingEntry();
|
|
285
|
-
} else if (delta.type === 'thinking_delta' && _currentBlockData.type === 'thinking') {
|
|
286
|
-
_currentBlockData.thinking += delta.thinking || '';
|
|
287
|
-
} else if (delta.type === 'input_json_delta' && _currentBlockData.type === 'tool_use') {
|
|
288
|
-
if (!_currentBlockData._rawInput) _currentBlockData._rawInput = '';
|
|
289
|
-
_currentBlockData._rawInput += delta.partial_json || '';
|
|
290
|
-
}
|
|
291
|
-
} else if (type === 'content_block_stop') {
|
|
292
|
-
if (_currentBlockData) {
|
|
293
|
-
if (_currentBlockData.type === 'tool_use' && _currentBlockData._rawInput) {
|
|
294
|
-
try { _currentBlockData.input = JSON.parse(_currentBlockData._rawInput); } catch {}
|
|
295
|
-
delete _currentBlockData._rawInput;
|
|
296
|
-
}
|
|
297
|
-
_streamingContent.push(_currentBlockData);
|
|
298
|
-
_currentBlockData = null;
|
|
299
|
-
_pushStreamingEntry();
|
|
300
|
-
}
|
|
301
|
-
} else if (type === 'message_stop') {
|
|
302
|
-
_resetStreamingState();
|
|
317
|
+
function _notifyTurnError(resultMsg) {
|
|
318
|
+
const isError = resultMsg.is_error === true || (resultMsg.subtype && resultMsg.subtype !== 'success');
|
|
319
|
+
if (!isError) return;
|
|
320
|
+
const errs = Array.isArray(resultMsg.errors) && resultMsg.errors.length
|
|
321
|
+
? resultMsg.errors.join('; ')
|
|
322
|
+
: (typeof resultMsg.result === 'string' && resultMsg.result) || resultMsg.subtype || 'unknown error';
|
|
323
|
+
if (_broadcastWs) {
|
|
324
|
+
try { _broadcastWs({ type: 'sdk-error', message: String(errs) }); } catch (err) { console.warn('[sdk-manager] sdk-error broadcast threw:', err?.message); }
|
|
303
325
|
}
|
|
304
326
|
}
|
|
305
327
|
|
|
306
328
|
/**
|
|
307
|
-
*
|
|
329
|
+
* canUseTool callback — handles AskUserQuestion + permission approval.
|
|
330
|
+
*
|
|
331
|
+
* Check order mirrors perm-bridge.js precedence:
|
|
332
|
+
* 1. IM hard deny (CCV_IM_DENY=1 only) — beats everything, including the
|
|
333
|
+
* publish force-approval below (an IM worker gets a hard deny, not a modal);
|
|
334
|
+
* 2. npm-publish hard gate — forced through the perm approval branch even in
|
|
335
|
+
* bypassPermissions mode (perm-bridge.js's bypass exemption equivalent);
|
|
336
|
+
* 3. bypass early-allow — bypass auto-approves everything else, but NEVER
|
|
337
|
+
* short-circuits the ExitPlanMode/AskUserQuestion interactive branches;
|
|
338
|
+
* 4. the three regular branches (plan / ask / perm).
|
|
308
339
|
*/
|
|
309
|
-
function
|
|
310
|
-
|
|
311
|
-
_streamThrottleTimer = setTimeout(() => {
|
|
312
|
-
_streamThrottleTimer = null;
|
|
313
|
-
_flushStreamingEntry();
|
|
314
|
-
}, 100);
|
|
315
|
-
}
|
|
340
|
+
async function _handleCanUseTool(toolName, input, options) {
|
|
341
|
+
const id = options?.toolUseID || `sdk_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
316
342
|
|
|
317
|
-
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
content.push(clone);
|
|
343
|
+
// 1. IM worker hard deny — must run before any auto-allow (perm-bridge.js parity).
|
|
344
|
+
if (process.env.CCV_IM_DENY === '1') {
|
|
345
|
+
const verdict = evaluateImDeny(toolName, input);
|
|
346
|
+
if (verdict.deny) {
|
|
347
|
+
return { behavior: 'deny', message: `cc-viewer IM guard: ${verdict.reason}` };
|
|
348
|
+
}
|
|
324
349
|
}
|
|
325
|
-
if (content.length === 0) return;
|
|
326
|
-
|
|
327
|
-
const syntheticMsg = {
|
|
328
|
-
message: {
|
|
329
|
-
id: _streamingRequestId,
|
|
330
|
-
type: 'message',
|
|
331
|
-
role: 'assistant',
|
|
332
|
-
model: _model,
|
|
333
|
-
content,
|
|
334
|
-
stop_reason: null,
|
|
335
|
-
usage: { input_tokens: 0, output_tokens: 0 },
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
// Use the SAME stable turn timestamp so in-progress entries dedup with the final entry
|
|
339
|
-
const entry = sdkToJSONLEntry(syntheticMsg, [..._accumulatedMessages], _model, _projectName, {
|
|
340
|
-
inProgress: true,
|
|
341
|
-
tools: _sdkTools,
|
|
342
|
-
requestId: _streamingRequestId,
|
|
343
|
-
timestamp: _turnTimestamp,
|
|
344
|
-
});
|
|
345
|
-
_onEntry(entry);
|
|
346
|
-
}
|
|
347
350
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
_currentBlockData = null;
|
|
351
|
-
if (_streamThrottleTimer) {
|
|
352
|
-
clearTimeout(_streamThrottleTimer);
|
|
353
|
-
_streamThrottleTimer = null;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
351
|
+
// 2. npm publish is never auto-allowed, even under --d (safety floor).
|
|
352
|
+
const isPublish = isPublishCommand(toolName, input);
|
|
356
353
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
354
|
+
// 3. Bypass mode auto-approves everything except publish and the two
|
|
355
|
+
// interactive tools — those keep their UI channels so a forwarded
|
|
356
|
+
// ExitPlanMode/AskUserQuestion still reaches the user.
|
|
357
|
+
if (_permissionMode === 'bypassPermissions' && !isPublish
|
|
358
|
+
&& toolName !== 'ExitPlanMode' && toolName !== 'AskUserQuestion') {
|
|
359
|
+
return { behavior: 'allow', updatedInput: input };
|
|
360
|
+
}
|
|
362
361
|
|
|
363
362
|
if (toolName === 'ExitPlanMode') {
|
|
364
363
|
if (_runWaterfallHook) {
|
|
@@ -372,16 +371,17 @@ async function _handleCanUseTool(toolName, input, options) {
|
|
|
372
371
|
}
|
|
373
372
|
} catch {}
|
|
374
373
|
}
|
|
374
|
+
const planPayload = { type: 'sdk-plan-pending', id, input };
|
|
375
375
|
if (_broadcastWs) {
|
|
376
|
-
_broadcastWs(
|
|
376
|
+
_broadcastWs(planPayload);
|
|
377
377
|
}
|
|
378
|
-
const result = await _waitForApproval(id, 5 * 60 * 1000, 'plan');
|
|
378
|
+
const result = await _waitForApproval(id, 5 * 60 * 1000, 'plan', planPayload);
|
|
379
379
|
if (result === null) {
|
|
380
380
|
return { behavior: 'deny', message: 'Timeout waiting for plan approval' };
|
|
381
381
|
}
|
|
382
|
-
// cancel sentinel guard
|
|
383
|
-
//
|
|
384
|
-
//
|
|
382
|
+
// cancel sentinel guard: cancelApproval shares the _pendingApprovals Map; if an
|
|
383
|
+
// ask-cancel collides with a plan id (the kind tag already guards this, but the sentinel
|
|
384
|
+
// guard is kept as defensive depth), it must not fall through to allow.
|
|
385
385
|
if (result && typeof result === 'object' && result.__cancelled__ === true) {
|
|
386
386
|
return { behavior: 'deny', message: result.reason || 'User aborted' };
|
|
387
387
|
}
|
|
@@ -400,30 +400,33 @@ async function _handleCanUseTool(toolName, input, options) {
|
|
|
400
400
|
}
|
|
401
401
|
} catch {}
|
|
402
402
|
}
|
|
403
|
-
// 24h —
|
|
404
|
-
//
|
|
403
|
+
// 24h — same source as the hook path (server.js ASK_HOOK_TIMEOUT_MS), honoring the
|
|
404
|
+
// "GUI effectively has no timeout" promise. The actual constant lives in
|
|
405
|
+
// server/lib/ask/ask-constants.js.
|
|
405
406
|
const askTimeoutMs = ASK_TIMEOUT_MS;
|
|
406
407
|
const askStartedAt = Date.now();
|
|
408
|
+
const askPayload = { type: 'sdk-ask-pending', id, questions: input.questions, startedAt: askStartedAt, timeoutMs: askTimeoutMs };
|
|
407
409
|
if (_broadcastWs) {
|
|
408
|
-
_broadcastWs(
|
|
410
|
+
_broadcastWs(askPayload);
|
|
409
411
|
}
|
|
410
|
-
const answers = await _waitForApproval(id, askTimeoutMs, 'ask');
|
|
412
|
+
const answers = await _waitForApproval(id, askTimeoutMs, 'ask', askPayload);
|
|
411
413
|
if (answers === null) {
|
|
412
414
|
return { behavior: 'deny', message: 'Timeout waiting for user answer' };
|
|
413
415
|
}
|
|
414
|
-
// cancel sentinel
|
|
415
|
-
//
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
416
|
+
// cancel sentinel: the { __cancelled__: true, reason } injected by cancelApproval via
|
|
417
|
+
// _waitForApproval. Equivalent to terminal Claude Code's onAbort path — the SDK package
|
|
418
|
+
// turns this deny into tool_result.is_error=true before injecting it into the
|
|
419
|
+
// transcript, so the next request's transcript closes and the session does not wedge.
|
|
420
|
+
// The [cc-viewer:cancel] prefix is a protocol-level sentinel — toolResultBuilder.js uses
|
|
421
|
+
// prefix matching to tell cancelled vs rejected apart.
|
|
419
422
|
if (answers && typeof answers === 'object' && answers.__cancelled__ === true) {
|
|
420
423
|
return { behavior: 'deny', message: '[cc-viewer:cancel] ' + (answers.reason || 'User aborted') };
|
|
421
424
|
}
|
|
422
425
|
return { behavior: 'allow', updatedInput: { questions: input.questions, answers } };
|
|
423
426
|
}
|
|
424
427
|
|
|
425
|
-
// Tools that need explicit user approval via Web UI (mutating or external access)
|
|
426
|
-
|
|
428
|
+
// Tools that need explicit user approval via Web UI (mutating or external access).
|
|
429
|
+
// The six-tool set is shared with the PTY perm-bridge via approval-policy.js.
|
|
427
430
|
if (!APPROVAL_TOOLS.has(toolName)) {
|
|
428
431
|
return { behavior: 'allow', updatedInput: input };
|
|
429
432
|
}
|
|
@@ -446,15 +449,17 @@ async function _handleCanUseTool(toolName, input, options) {
|
|
|
446
449
|
// unknown decision → fall through to normal approval flow
|
|
447
450
|
} catch {}
|
|
448
451
|
}
|
|
452
|
+
const permPayload = { type: 'perm-hook-pending', id, toolName, input };
|
|
449
453
|
if (_broadcastWs) {
|
|
450
|
-
_broadcastWs(
|
|
454
|
+
_broadcastWs(permPayload);
|
|
451
455
|
}
|
|
452
456
|
|
|
453
|
-
const result = await _waitForApproval(id, 5 * 60 * 1000, 'perm');
|
|
457
|
+
const result = await _waitForApproval(id, 5 * 60 * 1000, 'perm', permPayload);
|
|
454
458
|
if (result === null) {
|
|
455
459
|
return { behavior: 'deny', message: 'Timeout waiting for user approval' };
|
|
456
460
|
}
|
|
457
|
-
// cancel sentinel guard
|
|
461
|
+
// cancel sentinel guard: same as the plan branch — prevents a cancelApproval colliding
|
|
462
|
+
// with a perm id from wrongly allowing
|
|
458
463
|
if (result && typeof result === 'object' && result.__cancelled__ === true) {
|
|
459
464
|
return { behavior: 'deny', message: result.reason || 'User aborted' };
|
|
460
465
|
}
|
|
@@ -470,14 +475,18 @@ async function _handleCanUseTool(toolName, input, options) {
|
|
|
470
475
|
return response;
|
|
471
476
|
}
|
|
472
477
|
|
|
473
|
-
function _waitForApproval(id, timeoutMs, kind) {
|
|
478
|
+
function _waitForApproval(id, timeoutMs, kind, replay = null) {
|
|
474
479
|
return new Promise((resolve) => {
|
|
475
480
|
const timer = setTimeout(() => {
|
|
476
481
|
_pendingApprovals.delete(id);
|
|
477
482
|
resolve(null);
|
|
478
483
|
}, timeoutMs);
|
|
479
484
|
_pendingApprovals.set(id, {
|
|
480
|
-
kind, // 'ask' | 'plan' | 'perm' —
|
|
485
|
+
kind, // 'ask' | 'plan' | 'perm' — lets cancelApproval distinguish types so an
|
|
486
|
+
// ask-cancel does not collide with a plan/perm id
|
|
487
|
+
replay, // exact broadcast payload announced to clients — replayed to a fresh WS connection
|
|
488
|
+
startedAt: Date.now(),
|
|
489
|
+
timeoutMs,
|
|
481
490
|
resolve: (value) => {
|
|
482
491
|
clearTimeout(timer);
|
|
483
492
|
_pendingApprovals.delete(id);
|
|
@@ -500,19 +509,40 @@ export function resolveApproval(id, value) {
|
|
|
500
509
|
return false;
|
|
501
510
|
}
|
|
502
511
|
|
|
512
|
+
/**
|
|
513
|
+
* Snapshot of pending approvals for WS-reconnect replay (server.js connection
|
|
514
|
+
* handler). Returns [ { id, kind, replay, startedAt, timeoutMs } ] with remaining
|
|
515
|
+
* time computed at call time; entries already past their timeout are excluded.
|
|
516
|
+
* The resolve closures are deliberately not exposed.
|
|
517
|
+
*/
|
|
518
|
+
export function getPendingApprovals() {
|
|
519
|
+
const now = Date.now();
|
|
520
|
+
const out = [];
|
|
521
|
+
for (const [id, p] of _pendingApprovals) {
|
|
522
|
+
const remaining = (p.timeoutMs ?? 0) - (now - (p.startedAt ?? now));
|
|
523
|
+
if (remaining <= 0) continue;
|
|
524
|
+
out.push({ id, kind: p.kind || null, replay: p.replay || null, remainingMs: remaining });
|
|
525
|
+
}
|
|
526
|
+
return out;
|
|
527
|
+
}
|
|
528
|
+
|
|
503
529
|
/**
|
|
504
530
|
* Cancel a pending canUseTool approval — used by ask-cancel WS handler
|
|
505
531
|
* (user clicked Cancel button or typed-interrupt in input bar).
|
|
506
532
|
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
533
|
+
* Not equivalent to resolveApproval(id, null): null already occupies the timeout semantics
|
|
534
|
+
* in _waitForApproval. Here we resolve a { __cancelled__: true, reason } sentinel so
|
|
535
|
+
* canUseTool takes the deny branch rather than allow (see the _handleCanUseTool
|
|
536
|
+
* AskUserQuestion block).
|
|
510
537
|
*
|
|
511
|
-
* kind
|
|
512
|
-
*
|
|
538
|
+
* kind check: the ask-cancel protocol only applies to ask-type approvals. Colliding with a
|
|
539
|
+
* plan / perm id returns false and is not handled — so a cancel-ask signal cannot be
|
|
540
|
+
* mistaken for "the user rejected the plan", which would write a wrong reason into the
|
|
541
|
+
* model context.
|
|
513
542
|
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
543
|
+
* Shares the same _pendingApprovals Map and the same first-wins atomic guard
|
|
544
|
+
* (pending.resolve clearTimeout + delete) as resolveApproval, so a cancel racing an answer
|
|
545
|
+
* is a no-op for whichever arrives second.
|
|
516
546
|
*/
|
|
517
547
|
export function cancelApproval(id, reason) {
|
|
518
548
|
const pending = _pendingApprovals.get(id);
|
|
@@ -522,51 +552,117 @@ export function cancelApproval(id, reason) {
|
|
|
522
552
|
return true;
|
|
523
553
|
}
|
|
524
554
|
|
|
555
|
+
/**
|
|
556
|
+
* Shared interrupt core: cancel in-flight approvals (else their canUseTool promises stay
|
|
557
|
+
* parked and the timeout timers leak, and clients keep a ghost approval modal open) and
|
|
558
|
+
* close the active query iterator. `_executeQuery`'s finally block then nulls
|
|
559
|
+
* `_activeQuery`; `sendUserMessage`'s finally clears `_queryBusy`.
|
|
560
|
+
*
|
|
561
|
+
* Returns the list of approvals that were pending (`[{ id, kind }]`) so the caller
|
|
562
|
+
* (server.js) can broadcast modal-close messages to every client. Always an array.
|
|
563
|
+
*/
|
|
564
|
+
function _interruptActiveQuery() {
|
|
565
|
+
const cancelled = Array.from(_pendingApprovals, ([id, pending]) => ({ id, kind: pending.kind || null }));
|
|
566
|
+
for (const { id } of cancelled) {
|
|
567
|
+
_pendingApprovals.get(id)?.resolve(null);
|
|
568
|
+
}
|
|
569
|
+
_pendingApprovals.clear();
|
|
570
|
+
|
|
571
|
+
if (_activeQuery) {
|
|
572
|
+
// Best-effort streaming-mode control request (no-op / rejects in single-prompt mode → swallow).
|
|
573
|
+
try { _activeQuery.interrupt?.().catch(() => {}); } catch {}
|
|
574
|
+
// Forcefully terminate the underlying CLI subprocess — aborts an in-flight query.
|
|
575
|
+
try { if (typeof _activeQuery.close === 'function') _activeQuery.close(); } catch {}
|
|
576
|
+
}
|
|
577
|
+
return cancelled;
|
|
578
|
+
}
|
|
579
|
+
|
|
525
580
|
/**
|
|
526
581
|
* Interrupt the current turn (user clicked the Stop button) while KEEPING the
|
|
527
582
|
* session alive so the next message resumes the same conversation.
|
|
528
583
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
* `streaming_status{active:false}`; `sendUserMessage`'s finally clears
|
|
532
|
-
* `_queryBusy`. Crucially we do NOT call `_resetFullState()`, so `_sessionId`
|
|
533
|
-
* is preserved and the next sendUserMessage resumes via `options.resume`.
|
|
584
|
+
* Crucially we do NOT call `_resetFullState()`, so `_sessionId` is preserved
|
|
585
|
+
* and the next sendUserMessage resumes via `options.resume`.
|
|
534
586
|
*
|
|
535
587
|
* Contrast with `stopSession()` below, which is the hard process-exit cleanup
|
|
536
588
|
* that also nulls `_sessionId` (loses conversation continuity).
|
|
537
589
|
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* a
|
|
542
|
-
* holds not-yet-started turns.
|
|
590
|
+
* Stop KEEPS queued messages (product decision, matching the web UX where queued bubbles
|
|
591
|
+
* stay parked after Stop): `_suppressDrain` stops sendUserMessage's drain loop from running
|
|
592
|
+
* them right after the interrupt; the park lifts when a fresh user message / send-now
|
|
593
|
+
* starts a new turn. The queue-state broadcast lets clients keep their bubbles.
|
|
543
594
|
*
|
|
544
595
|
* Returns the list of approvals that were pending at interrupt time
|
|
545
596
|
* (`[{ id, kind }]`) so the caller (server.js) can broadcast modal-close
|
|
546
597
|
* messages to every client. Always an array (empty when nothing was pending).
|
|
547
598
|
*/
|
|
548
599
|
export function interruptTurn() {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
600
|
+
const cancelled = _interruptActiveQuery();
|
|
601
|
+
_suppressDrain = true;
|
|
602
|
+
_broadcastQueueState();
|
|
603
|
+
return cancelled;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Send-now on a queued bubble: interrupt the running turn and make this message the next
|
|
608
|
+
* one executed. Unlike Stop, this does NOT suppress draining — the in-flight
|
|
609
|
+
* sendUserMessage loop picks the prioritized item up as soon as the abort settles
|
|
610
|
+
* (JS single-threading: the splice+unshift below is synchronous, so the drain's next
|
|
611
|
+
* iteration always sees it at the head).
|
|
612
|
+
*
|
|
613
|
+
* When no turn is running (parked queue after Stop), the message is executed immediately
|
|
614
|
+
* as a fresh turn.
|
|
615
|
+
*
|
|
616
|
+
* Known semantic: if the FIRST turn is interrupted before its system/init message was
|
|
617
|
+
* processed, `_sessionId` is still null and the prioritized message starts a fresh session
|
|
618
|
+
* (the aborted first turn is not resumable) — same as Stop-then-send on turn one.
|
|
619
|
+
*
|
|
620
|
+
* Returns the cancelled-approvals list (same shape as interruptTurn) so server.js can
|
|
621
|
+
* close approval modals on all clients.
|
|
622
|
+
*/
|
|
623
|
+
export function sendQueuedNow(id) {
|
|
624
|
+
const idx = _messageQueue.findIndex((it) => it.id === id);
|
|
625
|
+
if (idx < 0) return []; // unknown / already dispatched — no-op BEFORE any interrupt
|
|
626
|
+
const [item] = _messageQueue.splice(idx, 1);
|
|
627
|
+
// Send-now ALWAYS means "run this now" — lift a Stop-park even when the aborted turn's
|
|
628
|
+
// unwind is still in flight (_queryBusy still true). Without this, the drain loop's
|
|
629
|
+
// `!_suppressDrain` condition would exit with the item already spliced out → silent loss.
|
|
630
|
+
_suppressDrain = false;
|
|
631
|
+
|
|
632
|
+
if (!_queryBusy) {
|
|
633
|
+
// Parked queue, idle session: run it now (broadcast happens via the drain path —
|
|
634
|
+
// here we broadcast explicitly since the item left the queue).
|
|
635
|
+
_broadcastQueueState();
|
|
636
|
+
// Fire-and-forget matches sendUserMessage's existing call sites (WS handler does not await).
|
|
637
|
+
sendUserMessage(item.text).catch((err) => console.warn('[sdk-manager] send-now query failed:', err?.message));
|
|
638
|
+
return [];
|
|
556
639
|
}
|
|
557
|
-
_pendingApprovals.clear();
|
|
558
640
|
|
|
559
|
-
|
|
560
|
-
|
|
641
|
+
_messageQueue.unshift(item);
|
|
642
|
+
const cancelled = _interruptActiveQuery();
|
|
643
|
+
_broadcastQueueState();
|
|
644
|
+
return cancelled;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** Remove one queued message (bubble ×). Returns true when found. */
|
|
648
|
+
export function removeQueued(id) {
|
|
649
|
+
const idx = _messageQueue.findIndex((it) => it.id === id);
|
|
650
|
+
if (idx < 0) return false;
|
|
651
|
+
_messageQueue.splice(idx, 1);
|
|
652
|
+
_broadcastQueueState();
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** Drop all queued messages WITHOUT touching the running turn (session switch). */
|
|
657
|
+
export function clearQueued() {
|
|
658
|
+
if (_messageQueue.length === 0) return;
|
|
561
659
|
_messageQueue = [];
|
|
660
|
+
_broadcastQueueState();
|
|
661
|
+
}
|
|
562
662
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
// Forcefully terminate the underlying CLI subprocess — aborts an in-flight query.
|
|
567
|
-
try { if (typeof _activeQuery.close === 'function') _activeQuery.close(); } catch {}
|
|
568
|
-
}
|
|
569
|
-
return cancelled;
|
|
663
|
+
/** Queue snapshot for WS-reconnect replay (same pattern as getSdkInitSnapshot). */
|
|
664
|
+
export function getQueueSnapshot() {
|
|
665
|
+
return _messageQueue.map(({ id, text, ts }) => ({ id, text, ts }));
|
|
570
666
|
}
|
|
571
667
|
|
|
572
668
|
/**
|
|
@@ -586,14 +682,15 @@ export function stopSession() {
|
|
|
586
682
|
function _resetFullState() {
|
|
587
683
|
_activeQuery = null;
|
|
588
684
|
_sessionId = null;
|
|
589
|
-
_model = null;
|
|
590
|
-
_sdkTools = null;
|
|
591
685
|
_queryBusy = false;
|
|
592
|
-
|
|
593
|
-
|
|
686
|
+
_initAnnouncedSid = '';
|
|
687
|
+
_lastInitSnapshot = null;
|
|
688
|
+
const hadQueued = _messageQueue.length > 0;
|
|
594
689
|
_messageQueue = [];
|
|
595
|
-
|
|
596
|
-
|
|
690
|
+
_suppressDrain = false;
|
|
691
|
+
// Only broadcast on an actual change — initSdkSession calls this before any client cares,
|
|
692
|
+
// and an empty-to-empty broadcast would just be noise on the wire.
|
|
693
|
+
if (hadQueued) _broadcastQueueState();
|
|
597
694
|
// Reject all pending approvals
|
|
598
695
|
for (const [, pending] of _pendingApprovals) {
|
|
599
696
|
pending.resolve(null);
|
|
@@ -607,3 +704,11 @@ function _resetFullState() {
|
|
|
607
704
|
export function getSessionId() {
|
|
608
705
|
return _sessionId;
|
|
609
706
|
}
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Get the last sdk-init snapshot for WS reconnect replay.
|
|
710
|
+
* Returns null if no init has been announced yet (e.g. session without slash commands).
|
|
711
|
+
*/
|
|
712
|
+
export function getSdkInitSnapshot() {
|
|
713
|
+
return _lastInitSnapshot;
|
|
714
|
+
}
|