-
feat(plugin): support local plugin debug channel (#7176) · b32c2579
* feat(plugin): add local plugin debug session support Implement local plugin debugging capability by integrating with the plugin-server to create and manage debug sessions. This includes: - Adding API endpoints for session lifecycle (create, status, disconnect). - Providing a CLI connection bridge via one-time ticket exchange. - Adding support for debug tools in the workflow and tool selection. - Implementing local storage persistence for active debug sessions in the web UI. * feat(plugin): refactor plugin debug channel and connection flow - Replace single-use debug sessions with a persistent debug channel (enabled, revoked, refreshed). - Introduce long-term `connectionKey` for CLI authentication, replacing the one-time ticket mechanism. - Decouple source identification: debug source is now passed explicitly rather than being encoded into the plugin ID. - Add `DebugToolTag` for better visualization in the UI. * build(global): update @fastgpt-plugin/sdk-client to 0.0.1-alpha.10 * fix(openapi): use dev api tags for plugin debug docs * refactor(app): remove local storage based plugin debug session - Remove `useLocalPluginDebugSession` in favor of API-based state - Update plugin debug modal to fetch state directly from server - Simplify tool template retrieval by removing unnecessary local debug session dependencies - Standardize active debug source resolution in API handlers * refactor(core): refactor debug tool id and source handling - Standardize debug source prefix to `debug:tmbId:` - Simplify tool ID parsing logic by removing redundant debug-specific checks from `splitCombineToolId` - Update UI to strictly restrict system toolset creation to valid contexts - Improve debug tool detection and path resolution across service modules * feat(common): support localized plugin error messages - Implement `withPluginClientLocale` context to propagate locale to plugin requests. - Add `localizePluginErrorResponse` to automatically map plugin `reason` fields to localized `message`. - Enhance `getErrText` to parse nested i18n error objects. - Propagate `source` property in tool configuration to maintain state for debug plugins. - Introduce `ToastHandledError` class for custom error handling. * fix(service): normalize empty system tool preview version * feat(app): adjust system tool UI layout - Adjust button order in the toolkit header - Add centering to the plugin debug modal * feat(service): support local debug for system tools - Implement repository logic for local system tool configuration matching - Internationalize debug tool labels and descriptions - Add warning for publishing apps containing debug tools - Update system tool list key generation to support debug modes * feat(system): add remote debug support for plugins - Add `pluginRemoteDebug` config to system settings - Implement capability probe for plugin service features - Restrict debug channel access based on enabled status - Update `@fastgpt-plugin/sdk-client` to 0.0.1-alpha.11 - Fix child tool status application in `SystemToolRepo` * feat(service): ensure debug tools remain visible as normal Refactor `SystemToolRepo` to force debug tool status to `Normal` regardless of saved system configuration, preventing offline/soon-offline statuses from impacting the debugging experience. * test(service): remove obsolete fastgpt plugin test file * feat(app): add system tool remote debugging as commercial feature - Add commercial restriction for remote debugging APIs - Update docs to include remote debugging in commercial features - Implement permission check to prevent unauthorized access * docs(document): add remote debug suite configuration guide Add documentation for setting up the system plugin remote debugging suite in self-hosted environments, including component architecture, deployment steps, security notes, and FAQs. * test(app): fix debug channel test cases mock environment Mock `feConfigs.isPlus` in test setup to ensure plugin debug channel handlers behave correctly during tests, and restore the original state after each test to avoid side effects.
Finley Ge committed