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
package/server/lib/skills-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Skill 动态装卸 API —— 扫描并移动 `.claude/skills/` 和 `.claude/skills-skip/` 之间的 skill 文件夹。
|
|
2
|
-
// 纯 Node 实现,无 React / 浏览器 依赖,方便 test/skills-api.test.js 直接 import。
|
|
2
|
+
// 纯 Node 实现,无 React / 浏览器 依赖,方便 packages/app/test/skills-api.test.js 直接 import。
|
|
3
3
|
|
|
4
4
|
import { existsSync, readdirSync, readFileSync, lstatSync, mkdirSync, renameSync, cpSync, rmSync, realpathSync } from 'node:fs';
|
|
5
5
|
import { join, basename, sep, normalize, isAbsolute } from 'node:path';
|
|
@@ -9,12 +9,21 @@
|
|
|
9
9
|
//
|
|
10
10
|
// Signal priority (best-effort heuristic — the shell-env vs settings.json-env ordering is
|
|
11
11
|
// a repo convention, not documented Claude Code semantics; a mismatch merely means "no
|
|
12
|
-
// injection" or "same-family entry", both harmless)
|
|
13
|
-
//
|
|
14
|
-
//
|
|
12
|
+
// injection" or "same-family entry", both harmless).
|
|
13
|
+
// Base model, most spawn-specific first:
|
|
14
|
+
// 1. the MERGED --settings launch object (opts.launchSettings — pty-manager folds the
|
|
15
|
+
// user's/launcher's --settings into the injected one): env.CLAUDE_MODEL >
|
|
16
|
+
// env.ANTHROPIC_MODEL. Wrappers like cfuse deliver the real model EXCLUSIVELY
|
|
17
|
+
// inside this blob, and claude applies a settings env block over the inherited
|
|
18
|
+
// shell env — so this outranks process env.
|
|
15
19
|
// 2. env CLAUDE_MODEL > env ANTHROPIC_MODEL (shell exports inherited by the spawn)
|
|
16
|
-
// 3.
|
|
20
|
+
// 3. launchSettings top-level `model` (below the inherited env vars, mirroring
|
|
21
|
+
// Claude Code's own env-over-settings precedence)
|
|
22
|
+
// 4. settings.json `env.ANTHROPIC_MODEL` > settings.json top-level `model`
|
|
17
23
|
// (the env block outranks the top-level field, mirroring how Claude Code applies it)
|
|
24
|
+
// Then the active third-party proxy profile for the spawned workspace rewrites the base
|
|
25
|
+
// via family mapping (resolveProfileModel — the model the ccv proxy will actually
|
|
26
|
+
// route to).
|
|
18
27
|
// Known limitation: a `--model` flag passed through extraArgs is not consulted.
|
|
19
28
|
//
|
|
20
29
|
// Pure disk reads — deliberately NOT importing server/interceptor.js: its module-level
|
|
@@ -79,7 +88,10 @@ function readActiveProfile(spawnDir, logDir) {
|
|
|
79
88
|
*
|
|
80
89
|
* @param {string} spawnDir workspace being launched (absolute path)
|
|
81
90
|
* @param {Object} [env] environment (default process.env)
|
|
82
|
-
* @param {{ logDir?: string, configDir?: string }} [opts]
|
|
91
|
+
* @param {{ logDir?: string, configDir?: string, launchSettings?: Object|null }} [opts]
|
|
92
|
+
* logDir/configDir: test seams for the data roots;
|
|
93
|
+
* launchSettings: the merged --settings object this spawn will run with
|
|
94
|
+
* (highest-priority base-model signal — see header)
|
|
83
95
|
* @returns {string|null}
|
|
84
96
|
*/
|
|
85
97
|
export function resolveSpawnModel(spawnDir, env = process.env, opts = {}) {
|
|
@@ -87,7 +99,10 @@ export function resolveSpawnModel(spawnDir, env = process.env, opts = {}) {
|
|
|
87
99
|
const configDir = opts.configDir || getClaudeConfigDir();
|
|
88
100
|
|
|
89
101
|
// Base model: what claude itself is configured to request.
|
|
90
|
-
|
|
102
|
+
const launch = (opts.launchSettings && typeof opts.launchSettings === 'object') ? opts.launchSettings : null;
|
|
103
|
+
let base = nonEmpty(launch?.env?.CLAUDE_MODEL) || nonEmpty(launch?.env?.ANTHROPIC_MODEL)
|
|
104
|
+
|| nonEmpty(env?.CLAUDE_MODEL) || nonEmpty(env?.ANTHROPIC_MODEL)
|
|
105
|
+
|| nonEmpty(launch?.model);
|
|
91
106
|
if (!base) {
|
|
92
107
|
const settings = readJson(join(configDir, 'settings.json'));
|
|
93
108
|
base = nonEmpty(settings?.env?.ANTHROPIC_MODEL) || nonEmpty(settings?.model);
|
|
@@ -10,12 +10,12 @@ import { join, basename } from 'node:path';
|
|
|
10
10
|
import { readJsonlTolerant, listSessionIds } from './v2/replay.js';
|
|
11
11
|
import { dirSizeSync } from './v2/layout.js';
|
|
12
12
|
import { isDiscardableSession } from './v2/session-select.js';
|
|
13
|
-
import { reportSwallowed } from '
|
|
13
|
+
import { reportSwallowed } from '@ccv/core/error-report';
|
|
14
14
|
import {
|
|
15
15
|
INTER_SESSION_TYPES, isSystemText, extractUserTexts, isSuggestionMode,
|
|
16
16
|
collectPromptsFromEvents, sortEpochFiles,
|
|
17
17
|
} from './user-prompt-extract.js';
|
|
18
|
-
import { aggregateRecords, mergeProxyFileCache, parseDailyFileName } from './proxy-stats.js';
|
|
18
|
+
import { aggregateRecords, mergeProxyFileCache, parseDailyFileName } from './proxy/proxy-stats.js';
|
|
19
19
|
|
|
20
20
|
// Prompt/preview extraction moved to the shared server/lib/user-prompt-extract.js
|
|
21
21
|
// (also feeds the V2Writer prompts.jsonl cache and the log-list read side).
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, writeFileSync, rmSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { MODEL_PROMPT_DIR, matchModelPrompt } from './model-system-prompts.js';
|
|
4
|
+
import { isNonEmptyFile } from './file-api.js';
|
|
5
|
+
|
|
6
|
+
// isNonEmptyFile lives in file-api.js (shared leaf, cycle break:
|
|
7
|
+
// model-system-prompts.js must not import this module). Re-exported here so
|
|
8
|
+
// existing consumers (routes/expert.js) keep their module path.
|
|
9
|
+
export { isNonEmptyFile } from './file-api.js';
|
|
4
10
|
|
|
5
11
|
// 启动目录里检查的「全大写 sentinel」文件名:多词约定用下划线连接
|
|
6
12
|
// (对齐 CLAUDE.md / GitHub CODE_OF_CONDUCT.md 等惯例)。
|
|
@@ -14,17 +20,12 @@ export const DISABLE_AUTO_SYSTEM_PROMPT_ENV = 'CCV_DISABLE_AUTO_SYSTEM_PROMPT';
|
|
|
14
20
|
|
|
15
21
|
// 文件需存在、是普通文件且非空(size>0)才算数:空文件会把 system prompt 抹空,跳过更安全。
|
|
16
22
|
// 坏符号链接 / 不存在 / 目录 → statSync 抛错或 isFile()=false → 返回 false。
|
|
17
|
-
export
|
|
18
|
-
try {
|
|
19
|
-
const st = statSync(p);
|
|
20
|
-
return st.isFile() && st.size > 0;
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
23
|
+
// (implementation: file-api.js — see the re-export above)
|
|
25
24
|
|
|
26
25
|
// args 里是否已含某个 flag(同时匹配 `--x` 与 `--x=value` 两种写法,检测更稳)。
|
|
27
|
-
|
|
26
|
+
// Exported for pty-manager's pin path: a manually-passed flag suppresses the matching
|
|
27
|
+
// pinned entry with the same semantics as the fresh-build path.
|
|
28
|
+
export function hasArg(args, ...names) {
|
|
28
29
|
if (!Array.isArray(args)) return false;
|
|
29
30
|
return args.some(a =>
|
|
30
31
|
typeof a === 'string' && names.some(n => a === n || a.startsWith(n + '='))
|
|
@@ -39,25 +39,36 @@ export function renderedPromptDir(pid = process.pid) {
|
|
|
39
39
|
* modelId: resolved model id from the last launch — becomes ${model.name} (the [1m]
|
|
40
40
|
* context-window suffix is stripped: it is a claude-code UI notation, not a model name);
|
|
41
41
|
* variablesFactory: test seam replacing createSystemPromptVariables.
|
|
42
|
-
* @returns {{ args: string[], loaded: string[], model: string|null }}
|
|
43
|
-
* whose content was rendered point at the temp copy
|
|
42
|
+
* @returns {{ args: string[], loaded: string[], model: string|null, entries: Array }}
|
|
43
|
+
* same shape; file paths whose content was rendered point at the temp copy
|
|
44
|
+
* instead. `entries` records the FINAL content of every injected file —
|
|
45
|
+
* [{flag, basename, content}] for successfully read files (rendered text when
|
|
46
|
+
* rendered, raw text when passed through — the launch-time bytes are what a
|
|
47
|
+
* later `-c`/`-r` pin must reuse, not whatever the source file says by then),
|
|
48
|
+
* or {flag, basename, content: null, unavailable: true} when the file could
|
|
49
|
+
* not be read/rendered (the arg falls back to the raw path; snapshot writers
|
|
50
|
+
* skip unavailable entries). Consumers that don't care can ignore the field.
|
|
44
51
|
*/
|
|
45
52
|
export function renderSystemPromptFileArgs(sysPrompt, opts = {}) {
|
|
46
53
|
// Defensive: null / non-object → safe default, so the caller always gets a valid
|
|
47
54
|
// spread target and the "loaded" notice guard (sysPrompt.loaded.length) can't throw.
|
|
48
|
-
if (!sysPrompt || typeof sysPrompt !== 'object') return { args: [], loaded: [], model: null };
|
|
55
|
+
if (!sysPrompt || typeof sysPrompt !== 'object') return { args: [], loaded: [], model: null, entries: [] };
|
|
49
56
|
const args = Array.isArray(sysPrompt.args) ? sysPrompt.args : [];
|
|
50
|
-
if (args.length === 0) return sysPrompt;
|
|
57
|
+
if (args.length === 0) return { entries: [], ...sysPrompt };
|
|
51
58
|
|
|
52
59
|
let variables = null; // lazy: collected once, and only if some file actually has placeholders
|
|
53
60
|
const out = [...args];
|
|
61
|
+
const entries = [];
|
|
54
62
|
for (let i = 0; i + 1 < out.length; i += 2) {
|
|
55
63
|
const flag = out[i];
|
|
56
64
|
if (flag !== '--system-prompt-file' && flag !== '--append-system-prompt-file') continue;
|
|
57
65
|
const path = out[i + 1];
|
|
58
66
|
try {
|
|
59
67
|
const text = readFileSync(path, 'utf-8');
|
|
60
|
-
if (!TEMPLATE_VARIABLE_RE.test(text))
|
|
68
|
+
if (!TEMPLATE_VARIABLE_RE.test(text)) {
|
|
69
|
+
entries.push({ flag, basename: basename(path), content: text }); // pass-through: pin the launch-time bytes
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
61
72
|
if (!variables) {
|
|
62
73
|
const factory = opts.variablesFactory || createSystemPromptVariables;
|
|
63
74
|
const overrides = {};
|
|
@@ -65,15 +76,20 @@ export function renderSystemPromptFileArgs(sysPrompt, opts = {}) {
|
|
|
65
76
|
variables = factory(overrides, { cwd: opts.cwd });
|
|
66
77
|
}
|
|
67
78
|
const rendered = createSystemPrompt(text, { variables, missingVariableMode: 'keep' });
|
|
68
|
-
if (rendered === text)
|
|
79
|
+
if (rendered === text) { // every placeholder unknown → nothing changed, keep raw path
|
|
80
|
+
entries.push({ flag, basename: basename(path), content: text });
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
69
83
|
const dir = renderedPromptDir();
|
|
70
84
|
mkdirSync(dir, { recursive: true });
|
|
71
85
|
const target = join(dir, basename(path));
|
|
72
86
|
writeFileSync(target, rendered, 'utf-8');
|
|
73
87
|
out[i + 1] = target;
|
|
88
|
+
entries.push({ flag, basename: basename(path), content: rendered });
|
|
74
89
|
} catch (e) {
|
|
90
|
+
entries.push({ flag, basename: basename(path), content: null, unavailable: true });
|
|
75
91
|
console.warn(`[CC Viewer] system-prompt template render failed for ${path} (injecting the raw file):`, e?.message || e);
|
|
76
92
|
}
|
|
77
93
|
}
|
|
78
|
-
return { ...sysPrompt, args: out };
|
|
94
|
+
return { ...sysPrompt, args: out, entries };
|
|
79
95
|
}
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
// Per-project store of the RENDERED system-prompt content each claude session was
|
|
2
|
+
// launched with — the "snapshot" that lets `-c`/`-r` resumes re-inject byte-identical
|
|
3
|
+
// text instead of re-rendering `${...}` template variables (which change between
|
|
4
|
+
// launches and bust the whole prompt-prefix KV cache; git.status/recentCommits/dates
|
|
5
|
+
// are the usual drifters).
|
|
6
|
+
//
|
|
7
|
+
// Layout under <LOG_DIR>/<projectKey>/system-prompt-snapshots/:
|
|
8
|
+
// <transcriptUuid>.json — { v, entries:[{flag, basename, content}], model, createdAt, boundVia }
|
|
9
|
+
// Only sessions that actually had an injection get records:
|
|
10
|
+
// empty-entries snapshots are never persisted (a resume target
|
|
11
|
+
// with no record simply follows the no-record path every time —
|
|
12
|
+
// same outcome, zero poisoning surface).
|
|
13
|
+
// pending.json — FIFO queue (cap PENDING_CAP) of launches awaiting binding:
|
|
14
|
+
// { entries, model, cwd, createdAt, pid, resumeExpected, resolvedUuid, fork }
|
|
15
|
+
//
|
|
16
|
+
// Binding channels (both consume the queue):
|
|
17
|
+
// - Bind A (wire): v2-writer sees a session's first MAIN request and matches its
|
|
18
|
+
// system text against pending contents — content is the capability, so teammate /
|
|
19
|
+
// subagent requests can never steal a bind. Fresh sessions: wire sid == transcript uuid.
|
|
20
|
+
// - Bind B (hook): the SessionStart hook reports the resumed conversation's transcript
|
|
21
|
+
// uuid; a resume launch's pending is consumed EXACTLY by resolvedUuid (source
|
|
22
|
+
// 'resume') or by fork flag (source 'fork'). Non-matching hooks consume nothing —
|
|
23
|
+
// a stolen in-terminal /resume hook or an out-of-order racing hook can neither
|
|
24
|
+
// poison an innocent conversation's record nor cascade-destroy the queue.
|
|
25
|
+
//
|
|
26
|
+
// Failure philosophy: every public function is total (returns null/false on error,
|
|
27
|
+
// never throws) — a lost snapshot only means a later resume falls back to the
|
|
28
|
+
// no-record path, never a broken spawn or a dropped log entry.
|
|
29
|
+
//
|
|
30
|
+
// GC (lazy, spawn-path only): appendPending drops records whose transcript file is
|
|
31
|
+
// gone (past a 1h grace window — bind-before-transcript races) or older than 30 days.
|
|
32
|
+
// Identical re-binds refresh createdAt, so actively-resumed conversations stay alive.
|
|
33
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync, readdirSync, statSync, realpathSync, openSync, readSync, closeSync } from 'node:fs';
|
|
34
|
+
import { join, basename, dirname } from 'node:path';
|
|
35
|
+
import { randomBytes } from 'node:crypto';
|
|
36
|
+
import { reportSwallowed } from '@ccv/core/error-report';
|
|
37
|
+
import { LOG_DIR, getClaudeConfigDir } from '../../findcc.js';
|
|
38
|
+
import { renameSyncWithRetry } from './file-api.js';
|
|
39
|
+
|
|
40
|
+
const STORE_DIR_NAME = 'system-prompt-snapshots';
|
|
41
|
+
const PENDING_FILE = 'pending.json';
|
|
42
|
+
const PENDING_CAP = 16; // generous headroom for sequential launches; FIFO beyond
|
|
43
|
+
// Bind B freshness window: a resume launch's hook lands seconds after spawn; the TTL
|
|
44
|
+
// only bounds how long an abandoned pending (crashed launch, hook never fired) stays
|
|
45
|
+
// consumable. Bind A ignores age — content matching is self-validating regardless of
|
|
46
|
+
// how long the user waited to send the first message.
|
|
47
|
+
const RESUME_PENDING_TTL_MS = 15 * 60 * 1000;
|
|
48
|
+
const QUEUE_GC_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
49
|
+
const SNAPSHOT_GC_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
50
|
+
// A just-bound record can predate claude's transcript flush (fork hooks fire before the
|
|
51
|
+
// first message; /compact rename windows). Records younger than this are never
|
|
52
|
+
// transcript-gone-collected.
|
|
53
|
+
const GC_TRANSCRIPT_GRACE_MS = 60 * 60 * 1000;
|
|
54
|
+
const MAX_STORE_FILE_BYTES = 8 * 1024 * 1024; // corrupt multi-GB files must not stall spawns
|
|
55
|
+
const MAX_ENTRY_CONTENT_BYTES = 256 * 1024; // rendered prompts are KB-scale; bigger = junk
|
|
56
|
+
const TRANSCRIPT_HEAD_BYTES = 64 * 1024; // -c candidate filter reads only the head
|
|
57
|
+
|
|
58
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
59
|
+
const KNOWN_FLAGS = new Set(['--system-prompt-file', '--append-system-prompt-file']);
|
|
60
|
+
// `-c` candidate filter: teammate and sidechain transcripts share the project's
|
|
61
|
+
// transcript dir but are never claude's continue target (mirrors claude's own filter).
|
|
62
|
+
const TRANSCRIPT_SKIP_MARKERS = ['"isSidechain":true', '"teamName"'];
|
|
63
|
+
|
|
64
|
+
// Test seam (repo _setXxxForTests style): the clock. The projects dir is steered via
|
|
65
|
+
// CCV_PROJECTS_DIR / CLAUDE_CONFIG_DIR envs (findcc's test barriers apply).
|
|
66
|
+
let _now = Date.now;
|
|
67
|
+
export function _setSnapshotDepsForTests({ now } = {}) {
|
|
68
|
+
_now = typeof now === 'function' ? now : Date.now;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** projectName derivation — same algorithm as interceptor.js (basename + sanitize). */
|
|
72
|
+
export function projectKeyForCwd(cwd) {
|
|
73
|
+
if (!cwd || typeof cwd !== 'string') return '';
|
|
74
|
+
const key = basename(cwd).replace(/[^a-zA-Z0-9_\-\.]/g, '_');
|
|
75
|
+
// Parity with v2/layout.js sanitizePathComponent: all-dots degenerate names must not
|
|
76
|
+
// become path traversal segments.
|
|
77
|
+
return (!key || /^\.+$/.test(key)) ? '_' : key;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** claude transcript projects root: CCV_PROJECTS_DIR override, else <config>/projects. */
|
|
81
|
+
function projectsDir() {
|
|
82
|
+
return process.env.CCV_PROJECTS_DIR || join(getClaudeConfigDir(), 'projects');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** claude transcript dir for a launch cwd: <projects>/<slug>/ (slug = non-alnum → '-'). */
|
|
86
|
+
export function transcriptDirForCwd(cwd) {
|
|
87
|
+
if (!cwd || typeof cwd !== 'string') return '';
|
|
88
|
+
return join(projectsDir(), cwd.replace(/[^A-Za-z0-9]/g, '-'));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Flatten a request body's system field (string | array of text blocks) for matching. */
|
|
92
|
+
export function systemTextOfBody(body) {
|
|
93
|
+
const system = body && body.system;
|
|
94
|
+
if (typeof system === 'string') return system;
|
|
95
|
+
if (Array.isArray(system)) return system.map(s => (s && s.text) || '').join('');
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The spawn side learns cwd from the launch, the hook side from claude's payload —
|
|
100
|
+
// symlinks (/tmp → /private/tmp on macOS) and trailing separators would silently break
|
|
101
|
+
// the byte-equality the queue matching relies on. Best-effort realpath both sides.
|
|
102
|
+
function normalizeCwd(cwd) {
|
|
103
|
+
if (!cwd || typeof cwd !== 'string') return '';
|
|
104
|
+
let out = cwd;
|
|
105
|
+
try { out = realpathSync.native(out); } catch { /* path may not exist yet — keep raw */ }
|
|
106
|
+
return out.length > 1 ? out.replace(/[\\/]+$/, '') : out;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function storeDirForKey(projectKey, logDir = LOG_DIR) {
|
|
110
|
+
return projectKey ? join(logDir, projectKey, STORE_DIR_NAME) : '';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Validate + normalize a raw entries array → [{flag, basename, content}] (drops junk).
|
|
115
|
+
* Beyond shape: flags are whitelisted and basenames must be bare filenames — a corrupted
|
|
116
|
+
* or planted record must never become a path escape (materialize joins it) or an
|
|
117
|
+
* arbitrary claude argv flag (materialize pushes it).
|
|
118
|
+
*/
|
|
119
|
+
function sanitizeEntries(raw) {
|
|
120
|
+
if (!Array.isArray(raw)) return [];
|
|
121
|
+
const out = [];
|
|
122
|
+
for (const e of raw) {
|
|
123
|
+
if (!e || typeof e !== 'object') continue;
|
|
124
|
+
if (!KNOWN_FLAGS.has(e.flag)) continue;
|
|
125
|
+
if (typeof e.basename !== 'string' || !e.basename) continue;
|
|
126
|
+
if (basename(e.basename) !== e.basename || e.basename.startsWith('.')) continue;
|
|
127
|
+
if (typeof e.content !== 'string') continue; // unavailable entries never reach the store
|
|
128
|
+
if (Buffer.byteLength(e.content, 'utf-8') > MAX_ENTRY_CONTENT_BYTES) continue;
|
|
129
|
+
out.push({ flag: e.flag, basename: e.basename, content: e.content });
|
|
130
|
+
}
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function entriesEqual(a, b) {
|
|
135
|
+
if (a.length !== b.length) return false;
|
|
136
|
+
return a.every((e, i) => e.flag === b[i].flag && e.basename === b[i].basename && e.content === b[i].content);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function readJsonFileCapped(file) {
|
|
140
|
+
try {
|
|
141
|
+
if (statSync(file).size > MAX_STORE_FILE_BYTES) return null;
|
|
142
|
+
return JSON.parse(readFileSync(file, 'utf-8'));
|
|
143
|
+
} catch { return null; }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function atomicWriteJson(file, obj) {
|
|
147
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
148
|
+
const tmp = `${file}.tmp-${process.pid}-${randomBytes(4).toString('hex')}`;
|
|
149
|
+
try {
|
|
150
|
+
writeFileSync(tmp, JSON.stringify(obj));
|
|
151
|
+
renameSyncWithRetry(tmp, file);
|
|
152
|
+
} catch (err) {
|
|
153
|
+
try { unlinkSync(tmp); } catch { /* already absent */ }
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Read a conversation's snapshot by project key. Missing / corrupt / wrong shape → null.
|
|
160
|
+
* @returns {{entries:Array, model:string|null, createdAt:number, boundVia:string}|null}
|
|
161
|
+
*/
|
|
162
|
+
export function readSnapshotByKey(projectKey, uuid, logDir) {
|
|
163
|
+
try {
|
|
164
|
+
if (!UUID_RE.test(String(uuid || ''))) return null;
|
|
165
|
+
const dir = storeDirForKey(projectKey, logDir);
|
|
166
|
+
if (!dir) return null;
|
|
167
|
+
const obj = readJsonFileCapped(join(dir, `${uuid}.json`));
|
|
168
|
+
if (!obj || typeof obj !== 'object' || !Array.isArray(obj.entries)) return null;
|
|
169
|
+
return {
|
|
170
|
+
entries: sanitizeEntries(obj.entries),
|
|
171
|
+
model: typeof obj.model === 'string' ? obj.model : null,
|
|
172
|
+
createdAt: typeof obj.createdAt === 'number' ? obj.createdAt : 0,
|
|
173
|
+
boundVia: obj.boundVia === 'hook' ? 'hook' : 'wire',
|
|
174
|
+
};
|
|
175
|
+
} catch (err) {
|
|
176
|
+
reportSwallowed('sys-prompt-snap.read', err);
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function readSnapshot(cwd, uuid) {
|
|
182
|
+
return readSnapshotByKey(projectKeyForCwd(cwd), uuid);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Persist a conversation's snapshot by project key. Empty-entries records are refused
|
|
187
|
+
* ('empty'): a resume target with no injection history is indistinguishable from an
|
|
188
|
+
* unrecorded one by design — both take the no-record path, and no stored record can
|
|
189
|
+
* later mislabel a session. Default skipIfPresent: an existing record whose entries
|
|
190
|
+
* DIFFER is kept (first bind wins — a later conflicting bind means a resolution
|
|
191
|
+
* mistake, and the warning is the diagnostic); identical content rewrites the file
|
|
192
|
+
* just to refresh createdAt (otherwise gc would age out actively-resumed conversations
|
|
193
|
+
* 30 days after their FIRST bind).
|
|
194
|
+
* @returns {{written:boolean, reason?:'identical'|'exists'|'invalid'|'empty'}}
|
|
195
|
+
*/
|
|
196
|
+
export function writeSnapshotByKey(projectKey, uuid, rec, { skipIfPresent = true, logDir } = {}) {
|
|
197
|
+
try {
|
|
198
|
+
if (!UUID_RE.test(String(uuid || ''))) return { written: false, reason: 'invalid' };
|
|
199
|
+
const dir = storeDirForKey(projectKey, logDir);
|
|
200
|
+
if (!dir) return { written: false, reason: 'invalid' };
|
|
201
|
+
const entries = sanitizeEntries(rec && rec.entries);
|
|
202
|
+
if (entries.length === 0) return { written: false, reason: 'empty' };
|
|
203
|
+
const next = {
|
|
204
|
+
v: 1,
|
|
205
|
+
entries,
|
|
206
|
+
model: rec && typeof rec.model === 'string' ? rec.model : null,
|
|
207
|
+
createdAt: _now(),
|
|
208
|
+
boundVia: rec && rec.boundVia === 'hook' ? 'hook' : 'wire',
|
|
209
|
+
};
|
|
210
|
+
const prev = readSnapshotByKey(projectKey, uuid, logDir);
|
|
211
|
+
if (prev) {
|
|
212
|
+
if (entriesEqual(prev.entries, next.entries)) {
|
|
213
|
+
// Refresh the clock so active conversations survive age-based gc.
|
|
214
|
+
atomicWriteJson(join(dir, `${uuid}.json`), next);
|
|
215
|
+
return { written: false, reason: 'identical' };
|
|
216
|
+
}
|
|
217
|
+
if (skipIfPresent) {
|
|
218
|
+
console.warn(`[CC Viewer] system-prompt snapshot for ${uuid} already exists with different content — keeping the first bind`);
|
|
219
|
+
return { written: false, reason: 'exists' };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
atomicWriteJson(join(dir, `${uuid}.json`), next);
|
|
223
|
+
// No gc() here: binding fires at session-start time when claude's transcript may
|
|
224
|
+
// not be visible to us yet (bind-before-transcript would self-collect the record
|
|
225
|
+
// we just wrote). Hygiene runs on the spawn path (appendPending) instead, where
|
|
226
|
+
// every stored record refers to a long-settled conversation.
|
|
227
|
+
return { written: true };
|
|
228
|
+
} catch (err) {
|
|
229
|
+
reportSwallowed('sys-prompt-snap.write', err);
|
|
230
|
+
return { written: false, reason: 'invalid' };
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function writeSnapshot(cwd, uuid, rec, opts) {
|
|
235
|
+
return writeSnapshotByKey(projectKeyForCwd(cwd), uuid, rec, opts);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ─── pending queue ────────────────────────────────────────────────────────────
|
|
239
|
+
|
|
240
|
+
function readPendingsByKey(projectKey, logDir) {
|
|
241
|
+
try {
|
|
242
|
+
const dir = storeDirForKey(projectKey, logDir);
|
|
243
|
+
if (!dir) return [];
|
|
244
|
+
const obj = readJsonFileCapped(join(dir, PENDING_FILE));
|
|
245
|
+
const list = obj && Array.isArray(obj.pendings) ? obj.pendings : [];
|
|
246
|
+
return list.filter(p => p && typeof p === 'object' && typeof p.cwd === 'string');
|
|
247
|
+
} catch (err) {
|
|
248
|
+
reportSwallowed('sys-prompt-snap.pending-read', err);
|
|
249
|
+
return [];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function writePendingsByKey(projectKey, list, logDir) {
|
|
254
|
+
const dir = storeDirForKey(projectKey, logDir);
|
|
255
|
+
if (!dir) return;
|
|
256
|
+
atomicWriteJson(join(dir, PENDING_FILE), { v: 1, pendings: list });
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Enqueue a launch's effective injection content for later binding.
|
|
261
|
+
* rec: { entries, model, resumeExpected, resolvedUuid, fork } — cwd/createdAt/pid stamped here.
|
|
262
|
+
*/
|
|
263
|
+
export function appendPending(cwd, rec = {}, logDir) {
|
|
264
|
+
try {
|
|
265
|
+
const projectKey = projectKeyForCwd(cwd);
|
|
266
|
+
if (!projectKey) return false;
|
|
267
|
+
const list = readPendingsByKey(projectKey, logDir);
|
|
268
|
+
const cutoff = _now() - QUEUE_GC_AGE_MS;
|
|
269
|
+
const kept = list.filter(p => (typeof p.createdAt === 'number' ? p.createdAt : 0) >= cutoff);
|
|
270
|
+
kept.push({
|
|
271
|
+
entries: sanitizeEntries(rec.entries),
|
|
272
|
+
model: typeof rec.model === 'string' ? rec.model : null,
|
|
273
|
+
cwd: normalizeCwd(cwd),
|
|
274
|
+
createdAt: _now(),
|
|
275
|
+
pid: process.pid,
|
|
276
|
+
resumeExpected: rec.resumeExpected === true,
|
|
277
|
+
resolvedUuid: typeof rec.resolvedUuid === 'string' ? rec.resolvedUuid : null,
|
|
278
|
+
fork: rec.fork === true,
|
|
279
|
+
});
|
|
280
|
+
while (kept.length > PENDING_CAP) kept.shift();
|
|
281
|
+
writePendingsByKey(projectKey, kept, logDir);
|
|
282
|
+
gc(cwd, logDir);
|
|
283
|
+
return true;
|
|
284
|
+
} catch (err) {
|
|
285
|
+
reportSwallowed('sys-prompt-snap.pending-append', err);
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Bind A (wire): match a session's first main request's system text against the queue.
|
|
292
|
+
* Non-empty pendings require EVERY entry content to appear in systemText (content is
|
|
293
|
+
* the capability — only the process we injected can present it); among matches the
|
|
294
|
+
* LONGEST total content wins, so a superset launch can never be claimed by a subset
|
|
295
|
+
* pending. When no content match exists, the oldest EMPTY pending is consumed (empty
|
|
296
|
+
* records are interchangeable — a mismatch binds "no injection" to a session that had
|
|
297
|
+
* none). resumeExpected pendings are reserved for Bind B and never consumed here.
|
|
298
|
+
* @returns {object|null} the consumed pending
|
|
299
|
+
*/
|
|
300
|
+
export function consumePendingForWireByKey(projectKey, systemText, logDir) {
|
|
301
|
+
try {
|
|
302
|
+
if (!projectKey || typeof systemText !== 'string') return null;
|
|
303
|
+
const list = readPendingsByKey(projectKey, logDir);
|
|
304
|
+
if (list.length === 0) return null;
|
|
305
|
+
const eligible = p => p.resumeExpected !== true;
|
|
306
|
+
let hitIdx = -1;
|
|
307
|
+
let hitLen = -1;
|
|
308
|
+
for (let i = 0; i < list.length; i++) {
|
|
309
|
+
const p = list[i];
|
|
310
|
+
if (!eligible(p) || p.entries.length === 0) continue;
|
|
311
|
+
if (!p.entries.every(e => e.content && systemText.includes(e.content))) continue;
|
|
312
|
+
const total = p.entries.reduce((n, e) => n + e.content.length, 0);
|
|
313
|
+
if (total > hitLen) { hitLen = total; hitIdx = i; }
|
|
314
|
+
}
|
|
315
|
+
if (hitIdx === -1) hitIdx = list.findIndex(p => eligible(p) && p.entries.length === 0);
|
|
316
|
+
if (hitIdx === -1) return null;
|
|
317
|
+
const [hit] = list.splice(hitIdx, 1);
|
|
318
|
+
writePendingsByKey(projectKey, list, logDir);
|
|
319
|
+
return hit;
|
|
320
|
+
} catch (err) {
|
|
321
|
+
reportSwallowed('sys-prompt-snap.wire-consume', err);
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Bind B (hook): consume the pending that belongs to THIS hook's conversation.
|
|
328
|
+
* source 'resume' → exact resolvedUuid match only;
|
|
329
|
+
* source 'fork' → the oldest fork pending (fork hooks carry the fork's NEW
|
|
330
|
+
* transcript uuid, which the spawn could not have known).
|
|
331
|
+
* Anything else consumes NOTHING: a stolen in-terminal /resume hook or an out-of-order
|
|
332
|
+
* racing hook finds no exact match and leaves the queue intact — no cascade of
|
|
333
|
+
* guard-refusals, no destroyed pendings (strays age out via RESUME_PENDING_TTL_MS).
|
|
334
|
+
* @returns {object|null} { hit } | { mismatch: resolvedUuid } | null
|
|
335
|
+
*/
|
|
336
|
+
export function consumePendingForResume(cwd, transcriptUuid, source, logDir) {
|
|
337
|
+
try {
|
|
338
|
+
const normCwd = normalizeCwd(cwd);
|
|
339
|
+
if (!normCwd) return null;
|
|
340
|
+
const projectKey = projectKeyForCwd(cwd);
|
|
341
|
+
const list = readPendingsByKey(projectKey, logDir);
|
|
342
|
+
if (list.length === 0) return null;
|
|
343
|
+
const cutoff = _now() - RESUME_PENDING_TTL_MS;
|
|
344
|
+
const kept = list.filter(p => {
|
|
345
|
+
if (p.resumeExpected !== true) return true;
|
|
346
|
+
return (typeof p.createdAt === 'number' ? p.createdAt : 0) >= cutoff; // stale strays drop out
|
|
347
|
+
});
|
|
348
|
+
const changed = kept.length !== list.length;
|
|
349
|
+
let idx = -1;
|
|
350
|
+
if (source === 'fork') {
|
|
351
|
+
idx = kept.findIndex(p => p.resumeExpected === true && p.fork === true && p.cwd === normCwd);
|
|
352
|
+
} else {
|
|
353
|
+
idx = kept.findIndex(p => p.resumeExpected === true && p.fork !== true
|
|
354
|
+
&& p.cwd === normCwd && p.resolvedUuid === transcriptUuid);
|
|
355
|
+
}
|
|
356
|
+
if (idx === -1) {
|
|
357
|
+
if (changed) writePendingsByKey(projectKey, kept, logDir);
|
|
358
|
+
// Diagnostic surface for a -c mis-resolution: a RESUME hook arrived but the
|
|
359
|
+
// only resume pendings for this cwd name a DIFFERENT conversation than the
|
|
360
|
+
// one claude actually resumed. Fork hooks never warn (their new uuid differs
|
|
361
|
+
// from resolvedUuid by design); equal-uuid leftovers aren't mismatches either.
|
|
362
|
+
const other = source !== 'fork' && kept.find(p => p.resumeExpected === true && p.fork !== true
|
|
363
|
+
&& p.cwd === normCwd && p.resolvedUuid && p.resolvedUuid !== transcriptUuid);
|
|
364
|
+
return other ? { mismatch: other.resolvedUuid } : null;
|
|
365
|
+
}
|
|
366
|
+
const [hit] = kept.splice(idx, 1);
|
|
367
|
+
writePendingsByKey(projectKey, kept, logDir);
|
|
368
|
+
return { hit };
|
|
369
|
+
} catch (err) {
|
|
370
|
+
reportSwallowed('sys-prompt-snap.resume-consume', err);
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Bounded head read (transcripts can reach GB scale — never whole-file them here). */
|
|
376
|
+
function readHead(file, maxBytes) {
|
|
377
|
+
let fd;
|
|
378
|
+
try {
|
|
379
|
+
fd = openSync(file, 'r');
|
|
380
|
+
const buf = Buffer.alloc(maxBytes);
|
|
381
|
+
const n = readSync(fd, buf, 0, maxBytes, 0);
|
|
382
|
+
return buf.toString('utf-8', 0, n);
|
|
383
|
+
} finally {
|
|
384
|
+
if (fd !== undefined) try { closeSync(fd); } catch { /* best-effort */ }
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Resolve which conversation `claude -c` would continue in cwd: the newest-mtime
|
|
390
|
+
* uuid-named transcript in <projects>/<slug>/, skipping teammate/sidechain transcripts
|
|
391
|
+
* (they share the dir but are never continue targets). Missing dir / no candidates /
|
|
392
|
+
* fs error → null (caller treats as "target unidentifiable" → fresh-launch behavior).
|
|
393
|
+
*/
|
|
394
|
+
export function resolveContinueTargetUuid(cwd) {
|
|
395
|
+
try {
|
|
396
|
+
const dir = transcriptDirForCwd(cwd);
|
|
397
|
+
if (!dir || !existsSync(dir)) return null;
|
|
398
|
+
let best = null;
|
|
399
|
+
for (const name of readdirSync(dir)) {
|
|
400
|
+
if (!name.endsWith('.jsonl')) continue;
|
|
401
|
+
const uuid = basename(name, '.jsonl');
|
|
402
|
+
if (!UUID_RE.test(uuid)) continue;
|
|
403
|
+
const file = join(dir, name);
|
|
404
|
+
let stat;
|
|
405
|
+
try { stat = statSync(file); } catch { continue; }
|
|
406
|
+
if (best && stat.mtimeMs <= best.mtimeMs) continue;
|
|
407
|
+
try {
|
|
408
|
+
const head = readHead(file, TRANSCRIPT_HEAD_BYTES);
|
|
409
|
+
if (TRANSCRIPT_SKIP_MARKERS.some(m => head.includes(m))) continue;
|
|
410
|
+
} catch { continue; }
|
|
411
|
+
best = { uuid, mtimeMs: stat.mtimeMs };
|
|
412
|
+
}
|
|
413
|
+
return best ? best.uuid : null;
|
|
414
|
+
} catch (err) {
|
|
415
|
+
reportSwallowed('sys-prompt-snap.resolve-continue', err);
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Lazy hygiene, invoked from the spawn path (appendPending): drop snapshot files whose
|
|
422
|
+
* transcript is gone (past the grace window) or older than SNAPSHOT_GC_AGE_MS. Queue
|
|
423
|
+
* aging is handled inside the queue readers/writers themselves.
|
|
424
|
+
*/
|
|
425
|
+
export function gc(cwd, logDir) {
|
|
426
|
+
try {
|
|
427
|
+
const projectKey = projectKeyForCwd(cwd);
|
|
428
|
+
const dir = storeDirForKey(projectKey, logDir);
|
|
429
|
+
if (!dir || !existsSync(dir)) return 0;
|
|
430
|
+
const tDir = transcriptDirForCwd(cwd);
|
|
431
|
+
const cutoff = _now() - SNAPSHOT_GC_AGE_MS;
|
|
432
|
+
const graceCutoff = _now() - GC_TRANSCRIPT_GRACE_MS;
|
|
433
|
+
let removed = 0;
|
|
434
|
+
for (const name of readdirSync(dir)) {
|
|
435
|
+
if (!name.endsWith('.json') || name === PENDING_FILE) continue;
|
|
436
|
+
const uuid = basename(name, '.json');
|
|
437
|
+
if (!UUID_RE.test(uuid)) continue;
|
|
438
|
+
const rec = readSnapshotByKey(projectKey, uuid, logDir);
|
|
439
|
+
if (!rec) continue; // corrupt → leave it for a human, don't churn
|
|
440
|
+
const stale = rec.createdAt > 0 && rec.createdAt < cutoff;
|
|
441
|
+
const transcriptGone = rec.createdAt < graceCutoff
|
|
442
|
+
&& tDir && !existsSync(join(tDir, `${uuid}.jsonl`));
|
|
443
|
+
if (stale || transcriptGone) {
|
|
444
|
+
try { unlinkSync(join(dir, name)); removed++; } catch { /* best-effort */ }
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return removed;
|
|
448
|
+
} catch (err) {
|
|
449
|
+
reportSwallowed('sys-prompt-snap.gc', err);
|
|
450
|
+
return 0;
|
|
451
|
+
}
|
|
452
|
+
}
|