aws-runtime-bridge 1.9.79 → 1.9.80
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/dist/adapter/AcodeSdkAdapter.d.ts +0 -1
- package/dist/adapter/AcodeSdkAdapter.js +11 -1986
- package/dist/adapter/AdapterRegistry.d.ts +0 -1
- package/dist/adapter/AdapterRegistry.js +2 -100
- package/dist/adapter/ClaudeSdkAdapter.d.ts +0 -1
- package/dist/adapter/ClaudeSdkAdapter.js +4 -1300
- package/dist/adapter/CodexSdkAdapter.d.ts +0 -1
- package/dist/adapter/CodexSdkAdapter.js +4 -836
- package/dist/adapter/OpencodeSdkAdapter.d.ts +0 -1
- package/dist/adapter/OpencodeSdkAdapter.js +4 -879
- package/dist/adapter/SdkProviderSpi.d.ts +0 -1
- package/dist/adapter/SdkProviderSpi.js +2 -55
- package/dist/adapter/acode-tool-names.d.ts +0 -1
- package/dist/adapter/acode-tool-names.js +2 -37
- package/dist/adapter/idle-poll-loop.d.ts +0 -1
- package/dist/adapter/idle-poll-loop.js +2 -59
- package/dist/adapter/index.d.ts +0 -1
- package/dist/adapter/index.js +2 -11
- package/dist/adapter/instance-ai-config-resolver.d.ts +0 -1
- package/dist/adapter/instance-ai-config-resolver.js +2 -46
- package/dist/adapter/types.d.ts +0 -1
- package/dist/adapter/types.js +2 -443
- package/dist/adapters/cc-switch/common.d.ts +0 -1
- package/dist/adapters/cc-switch/common.js +2 -61
- package/dist/adapters/cc-switch/index.d.ts +0 -1
- package/dist/adapters/cc-switch/index.js +2 -57
- package/dist/adapters/cc-switch/mcp-acode.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-acode.js +2 -71
- package/dist/adapters/cc-switch/mcp-claude.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-claude.js +2 -89
- package/dist/adapters/cc-switch/mcp-claudecode.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-claudecode.js +2 -77
- package/dist/adapters/cc-switch/mcp-codex.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-codex.js +11 -249
- package/dist/adapters/cc-switch/mcp-opencode.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-opencode.js +2 -97
- package/dist/adapters/cc-switch/mcp-placeholder.d.ts +0 -1
- package/dist/adapters/cc-switch/mcp-placeholder.js +2 -19
- package/dist/adapters/cc-switch/skill-acode.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-acode.js +2 -12
- package/dist/adapters/cc-switch/skill-claude.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-claude.js +2 -11
- package/dist/adapters/cc-switch/skill-claudecode.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-claudecode.js +2 -11
- package/dist/adapters/cc-switch/skill-codex.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-codex.js +2 -6
- package/dist/adapters/cc-switch/skill-directory.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-directory.js +3 -137
- package/dist/adapters/cc-switch/skill-opencode.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-opencode.js +2 -11
- package/dist/adapters/cc-switch/skill-placeholder.d.ts +0 -1
- package/dist/adapters/cc-switch/skill-placeholder.js +2 -19
- package/dist/config.d.ts +0 -1
- package/dist/config.js +2 -290
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -573
- package/dist/middleware/auth.d.ts +0 -1
- package/dist/middleware/auth.js +2 -98
- package/dist/routes/acode-todos.d.ts +0 -1
- package/dist/routes/acode-todos.js +2 -75
- package/dist/routes/ai-sources.d.ts +0 -1
- package/dist/routes/ai-sources.js +2 -132
- package/dist/routes/dashboard.d.ts +0 -1
- package/dist/routes/dashboard.js +182 -649
- package/dist/routes/events.d.ts +0 -1
- package/dist/routes/events.js +2 -22
- package/dist/routes/file-browser.d.ts +0 -1
- package/dist/routes/file-browser.js +2 -781
- package/dist/routes/file-diff-rollback.d.ts +0 -1
- package/dist/routes/file-diff-rollback.js +2 -301
- package/dist/routes/file-snapshot.d.ts +0 -1
- package/dist/routes/file-snapshot.js +2 -156
- package/dist/routes/git.d.ts +0 -1
- package/dist/routes/git.js +28 -1900
- package/dist/routes/instance.d.ts +0 -1
- package/dist/routes/instance.js +3 -748
- package/dist/routes/mcp.d.ts +0 -1
- package/dist/routes/mcp.js +2 -196
- package/dist/routes/processes.d.ts +0 -1
- package/dist/routes/processes.js +2 -252
- package/dist/routes/properties.d.ts +0 -1
- package/dist/routes/properties.js +2 -72
- package/dist/routes/pty.d.ts +0 -1
- package/dist/routes/pty.js +6 -560
- package/dist/routes/runtime-binding.d.ts +0 -1
- package/dist/routes/runtime-binding.js +2 -263
- package/dist/routes/sessions.d.ts +0 -1
- package/dist/routes/sessions.js +2 -758
- package/dist/routes/skills.d.ts +0 -1
- package/dist/routes/skills.js +2 -187
- package/dist/routes/sub-agents.d.ts +0 -1
- package/dist/routes/sub-agents.js +20 -279
- package/dist/routes/system-metrics.d.ts +0 -1
- package/dist/routes/system-metrics.js +2 -20
- package/dist/routes/task-context.d.ts +0 -1
- package/dist/routes/task-context.js +2 -78
- package/dist/routes/terminal.d.ts +0 -1
- package/dist/routes/terminal.js +54 -2882
- package/dist/routes/yml.d.ts +0 -1
- package/dist/routes/yml.js +2 -223
- package/dist/services/acode-package.d.ts +0 -1
- package/dist/services/acode-package.js +2 -111
- package/dist/services/agent-event-store.d.ts +0 -1
- package/dist/services/agent-event-store.js +2 -81
- package/dist/services/agent-process-manager.d.ts +0 -1
- package/dist/services/agent-process-manager.js +2 -796
- package/dist/services/ai-source-apply.d.ts +0 -1
- package/dist/services/ai-source-apply.js +2 -83
- package/dist/services/auto-register.d.ts +0 -1
- package/dist/services/auto-register.js +2 -1053
- package/dist/services/aws-client-agent-mcp.d.ts +0 -1
- package/dist/services/aws-client-agent-mcp.js +3 -337
- package/dist/services/bridge-package-publish-hooks.d.ts +0 -1
- package/dist/services/bridge-package-publish-hooks.js +2 -115
- package/dist/services/cc-switch-sdk.d.ts +0 -1
- package/dist/services/cc-switch-sdk.js +2 -135
- package/dist/services/cli-commands.d.ts +6 -1
- package/dist/services/cli-commands.js +6 -645
- package/dist/services/event-delta-pusher.d.ts +0 -1
- package/dist/services/event-delta-pusher.js +2 -95
- package/dist/services/fileSnapshotStore.d.ts +0 -1
- package/dist/services/fileSnapshotStore.js +2 -500
- package/dist/services/instance-ai-config-service.d.ts +0 -1
- package/dist/services/instance-ai-config-service.js +2 -174
- package/dist/services/instance-init-service.d.ts +0 -1
- package/dist/services/instance-init-service.js +2 -193
- package/dist/services/instance-service.d.ts +0 -1
- package/dist/services/instance-service.js +2 -237
- package/dist/services/instance-state.d.ts +0 -1
- package/dist/services/instance-state.js +2 -94
- package/dist/services/legacy-path-migration.d.ts +0 -1
- package/dist/services/legacy-path-migration.js +2 -66
- package/dist/services/lifecycle-state.d.ts +0 -1
- package/dist/services/lifecycle-state.js +3 -110
- package/dist/services/mcp-launch-binding-queue.d.ts +0 -1
- package/dist/services/mcp-launch-binding-queue.js +2 -175
- package/dist/services/orphan-monitor.d.ts +0 -1
- package/dist/services/orphan-monitor.js +2 -382
- package/dist/services/panel-auth.d.ts +0 -1
- package/dist/services/panel-auth.js +2 -168
- package/dist/services/process-detector.d.ts +0 -1
- package/dist/services/process-detector.js +18 -1019
- package/dist/services/process-registry.d.ts +0 -1
- package/dist/services/process-registry.js +2 -375
- package/dist/services/ring-buffer.d.ts +0 -1
- package/dist/services/ring-buffer.js +2 -103
- package/dist/services/runtime-binding.d.ts +0 -1
- package/dist/services/runtime-binding.js +6 -363
- package/dist/services/runtime-lifecycle-policy.d.ts +0 -1
- package/dist/services/runtime-lifecycle-policy.js +2 -35
- package/dist/services/session-output.d.ts +0 -1
- package/dist/services/session-output.js +5 -539
- package/dist/services/startup-config-wizard.d.ts +0 -1
- package/dist/services/startup-config-wizard.js +14 -258
- package/dist/services/sub-agent-manager-instance.d.ts +0 -1
- package/dist/services/sub-agent-manager-instance.js +2 -12
- package/dist/services/system-metrics.d.ts +0 -1
- package/dist/services/system-metrics.js +2 -252
- package/dist/services/terminal-persistence.d.ts +0 -1
- package/dist/services/terminal-persistence.js +2 -176
- package/dist/services/tool-installer.d.ts +0 -1
- package/dist/services/tool-installer.js +5 -751
- package/dist/services/tunnel-client.d.ts +0 -1
- package/dist/services/tunnel-client.js +2 -402
- package/dist/services/windows-service-manager.d.ts +3 -3
- package/dist/services/windows-service-manager.js +2 -59
- package/dist/services/workspace-files.d.ts +0 -1
- package/dist/services/workspace-files.js +2 -1275
- package/dist/services/workspace-watch.d.ts +0 -1
- package/dist/services/workspace-watch.js +2 -123
- package/dist/services/workspaceTaskChangeWatcher.d.ts +0 -1
- package/dist/services/workspaceTaskChangeWatcher.js +2 -483
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/file-utils.d.ts +0 -1
- package/dist/utils/file-utils.js +3 -208
- package/dist/utils/instance-ai-config-debug-logger.d.ts +0 -1
- package/dist/utils/instance-ai-config-debug-logger.js +4 -63
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +2 -154
- package/dist/utils/mcp-utils.d.ts +0 -1
- package/dist/utils/mcp-utils.js +2 -187
- package/dist/utils/path-utils.d.ts +0 -1
- package/dist/utils/path-utils.js +2 -44
- package/dist/utils/sdk-package-loader.d.ts +0 -1
- package/dist/utils/sdk-package-loader.js +2 -78
- package/dist/utils/validation.d.ts +0 -1
- package/dist/utils/validation.js +2 -53
- package/dist/utils/yaml-utils.d.ts +0 -1
- package/dist/utils/yaml-utils.js +2 -312
- package/node_modules/@cc-switch/sdk/dist/constants.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/constants.js +2 -63
- package/node_modules/@cc-switch/sdk/dist/errors.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/errors.js +2 -8
- package/node_modules/@cc-switch/sdk/dist/index.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/index.js +2 -9
- package/node_modules/@cc-switch/sdk/dist/schemas.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/schemas.js +2 -38
- package/node_modules/@cc-switch/sdk/dist/sdk.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/sdk.js +2 -470
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.js +4 -307
- package/node_modules/@cc-switch/sdk/dist/services/mcp-model.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/mcp-model.js +2 -37
- package/node_modules/@cc-switch/sdk/dist/services/mcp-service.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/mcp-service.js +2 -9
- package/node_modules/@cc-switch/sdk/dist/services/skill-model.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/skill-model.js +2 -41
- package/node_modules/@cc-switch/sdk/dist/services/skill-service.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/skill-service.js +2 -9
- package/node_modules/@cc-switch/sdk/dist/state.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/state.js +2 -19
- package/node_modules/@cc-switch/sdk/dist/types.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/types.js +1 -1
- package/node_modules/@cc-switch/sdk/dist/utils/fs.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/utils/fs.js +3 -114
- package/node_modules/@cc-switch/sdk/dist/utils/id.d.ts +0 -1
- package/node_modules/@cc-switch/sdk/dist/utils/id.js +2 -12
- package/node_modules/@cc-switch/sdk/package.json +1 -1
- package/package/acode/dist/ask-user-question-tool.d.ts +0 -1
- package/package/acode/dist/ask-user-question-tool.js +4 -233
- package/package/acode/dist/built-in-file-tools.d.ts +0 -1
- package/package/acode/dist/built-in-file-tools.js +4 -966
- package/package/acode/dist/built-in-symbols-tool.d.ts +0 -1
- package/package/acode/dist/built-in-symbols-tool.js +2 -117
- package/package/acode/dist/builtins/commandArtifacts.d.ts +0 -1
- package/package/acode/dist/builtins/commandArtifacts.js +9 -97
- package/package/acode/dist/builtins/commandOutputEvents.d.ts +0 -1
- package/package/acode/dist/builtins/commandOutputEvents.js +2 -56
- package/package/acode/dist/builtins/shellCommandPreparation.d.ts +0 -1
- package/package/acode/dist/builtins/shellCommandPreparation.js +5 -44
- package/package/acode/dist/builtins/shellCommandResult.d.ts +0 -1
- package/package/acode/dist/builtins/shellCommandResult.js +2 -71
- package/package/acode/dist/builtins/shellCommandRunner.d.ts +0 -1
- package/package/acode/dist/builtins/shellCommandRunner.js +2 -115
- package/package/acode/dist/builtins/shellOutputDecoder.d.ts +0 -1
- package/package/acode/dist/builtins/shellOutputDecoder.js +2 -94
- package/package/acode/dist/cli.d.ts +0 -1
- package/package/acode/dist/cli.js +4 -38
- package/package/acode/dist/commands/commandLoader.d.ts +0 -1
- package/package/acode/dist/commands/commandLoader.js +2 -33
- package/package/acode/dist/commands/commandParser.d.ts +0 -1
- package/package/acode/dist/commands/commandParser.js +3 -77
- package/package/acode/dist/commands/commandRegistry.d.ts +0 -1
- package/package/acode/dist/commands/commandRegistry.js +2 -30
- package/package/acode/dist/compaction.d.ts +0 -1
- package/package/acode/dist/compaction.js +7 -919
- package/package/acode/dist/config.d.ts +0 -1
- package/package/acode/dist/config.js +5 -105
- package/package/acode/dist/fs-utils.d.ts +0 -1
- package/package/acode/dist/fs-utils.js +2 -79
- package/package/acode/dist/hooks/hookBus.d.ts +0 -1
- package/package/acode/dist/hooks/hookBus.js +2 -40
- package/package/acode/dist/index.d.ts +0 -1
- package/package/acode/dist/index.js +2 -19
- package/package/acode/dist/mcpToolNames.d.ts +0 -1
- package/package/acode/dist/mcpToolNames.js +2 -17
- package/package/acode/dist/parsers/ast-cache.d.ts +0 -1
- package/package/acode/dist/parsers/ast-cache.js +2 -76
- package/package/acode/dist/parsers/language-detector.d.ts +0 -1
- package/package/acode/dist/parsers/language-detector.js +2 -44
- package/package/acode/dist/parsers/language-queries.d.ts +0 -1
- package/package/acode/dist/parsers/language-queries.js +12 -602
- package/package/acode/dist/parsers/symbol-extractor.d.ts +0 -1
- package/package/acode/dist/parsers/symbol-extractor.js +3 -164
- package/package/acode/dist/parsers/tree-sitter-loader.d.ts +0 -1
- package/package/acode/dist/parsers/tree-sitter-loader.js +2 -64
- package/package/acode/dist/parsers/types.d.ts +0 -1
- package/package/acode/dist/parsers/types.js +1 -7
- package/package/acode/dist/runtime.d.ts +0 -1
- package/package/acode/dist/runtime.js +86 -3771
- package/package/acode/dist/skill-tool.d.ts +0 -1
- package/package/acode/dist/skill-tool.js +5 -174
- package/package/acode/dist/sub-agent-manager.d.ts +0 -1
- package/package/acode/dist/sub-agent-manager.js +2 -1159
- package/package/acode/dist/sub-agent-store.d.ts +0 -1
- package/package/acode/dist/sub-agent-store.js +4 -236
- package/package/acode/dist/sub-agent-tools.d.ts +0 -1
- package/package/acode/dist/sub-agent-tools.js +15 -369
- package/package/acode/dist/sub-agent-types.d.ts +0 -1
- package/package/acode/dist/sub-agent-types.js +1 -8
- package/package/acode/dist/todo-store.d.ts +0 -1
- package/package/acode/dist/todo-store.js +2 -73
- package/package/acode/dist/todo-tool.d.ts +0 -1
- package/package/acode/dist/todo-tool.js +5 -121
- package/package/acode/dist/types.d.ts +0 -1
- package/package/acode/dist/types.js +1 -1
- package/package/acode/package.json +2 -2
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.js +2 -890
- package/package/aws-client-agent-mcp/dist/agent-client.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/config.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/config.js +2 -243
- package/package/aws-client-agent-mcp/dist/config.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/config.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/constants.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/constants.js +2 -24
- package/package/aws-client-agent-mcp/dist/context-manager.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.js +2 -477
- package/package/aws-client-agent-mcp/dist/context-manager.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.js +2 -446
- package/package/aws-client-agent-mcp/dist/http-client.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/index.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/index.js +2 -34
- package/package/aws-client-agent-mcp/dist/logger.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/logger.js +3 -178
- package/package/aws-client-agent-mcp/dist/logger.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/logger.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.js +38 -2709
- package/package/aws-client-agent-mcp/dist/mcp-server.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.js +22 -562
- package/package/aws-client-agent-mcp/dist/mcp-tools.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.js +4 -826
- package/package/aws-client-agent-mcp/dist/memory-store.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.js +31 -294
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.js +2 -288
- package/package/aws-client-agent-mcp/dist/message-buffer.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/messageContent.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/messageContent.js +2 -125
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.js +2 -103
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.js +2 -96
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.js +3 -327
- package/package/aws-client-agent-mcp/dist/status-reporter.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.test.js +0 -1
- package/package/aws-client-agent-mcp/dist/types.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/types.js +2 -9
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.js +2 -677
- package/package/aws-client-agent-mcp/dist/websocket-client.test.d.ts +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.test.js +0 -1
- package/package/aws-client-agent-mcp/package.json +1 -1
- package/package/cc-switch-sdk/dist/constants.d.ts +0 -1
- package/package/cc-switch-sdk/dist/constants.js +2 -63
- package/package/cc-switch-sdk/dist/errors.d.ts +0 -1
- package/package/cc-switch-sdk/dist/errors.js +2 -8
- package/package/cc-switch-sdk/dist/index.d.ts +0 -1
- package/package/cc-switch-sdk/dist/index.js +2 -9
- package/package/cc-switch-sdk/dist/schemas.d.ts +0 -1
- package/package/cc-switch-sdk/dist/schemas.js +2 -38
- package/package/cc-switch-sdk/dist/sdk.d.ts +0 -1
- package/package/cc-switch-sdk/dist/sdk.js +2 -470
- package/package/cc-switch-sdk/dist/services/ai-config-service.d.ts +0 -1
- package/package/cc-switch-sdk/dist/services/ai-config-service.js +4 -307
- package/package/cc-switch-sdk/dist/services/mcp-model.d.ts +0 -1
- package/package/cc-switch-sdk/dist/services/mcp-model.js +2 -37
- package/package/cc-switch-sdk/dist/services/mcp-service.d.ts +0 -1
- package/package/cc-switch-sdk/dist/services/mcp-service.js +2 -9
- package/package/cc-switch-sdk/dist/services/skill-model.d.ts +0 -1
- package/package/cc-switch-sdk/dist/services/skill-model.js +2 -41
- package/package/cc-switch-sdk/dist/services/skill-service.d.ts +0 -1
- package/package/cc-switch-sdk/dist/services/skill-service.js +2 -9
- package/package/cc-switch-sdk/dist/state.d.ts +0 -1
- package/package/cc-switch-sdk/dist/state.js +2 -19
- package/package/cc-switch-sdk/dist/types.d.ts +0 -1
- package/package/cc-switch-sdk/dist/types.js +1 -1
- package/package/cc-switch-sdk/dist/utils/fs.d.ts +0 -1
- package/package/cc-switch-sdk/dist/utils/fs.js +3 -114
- package/package/cc-switch-sdk/dist/utils/id.d.ts +0 -1
- package/package/cc-switch-sdk/dist/utils/id.js +2 -12
- package/package/cc-switch-sdk/package.json +1 -1
- package/package.json +4 -2
- package/dist/adapter/AcodeSdkAdapter.d.ts.map +0 -1
- package/dist/adapter/AdapterRegistry.d.ts.map +0 -1
- package/dist/adapter/ClaudeSdkAdapter.d.ts.map +0 -1
- package/dist/adapter/CodexSdkAdapter.d.ts.map +0 -1
- package/dist/adapter/OpencodeSdkAdapter.d.ts.map +0 -1
- package/dist/adapter/SdkProviderSpi.d.ts.map +0 -1
- package/dist/adapter/acode-tool-names.d.ts.map +0 -1
- package/dist/adapter/idle-poll-loop.d.ts.map +0 -1
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/instance-ai-config-resolver.d.ts.map +0 -1
- package/dist/adapter/types.d.ts.map +0 -1
- package/dist/adapters/cc-switch/common.d.ts.map +0 -1
- package/dist/adapters/cc-switch/index.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-acode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-claude.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-claudecode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-codex.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-opencode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-placeholder.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-acode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-claude.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-claudecode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-codex.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-directory.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-opencode.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-placeholder.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/middleware/auth.d.ts.map +0 -1
- package/dist/routes/acode-todos.d.ts.map +0 -1
- package/dist/routes/ai-sources.d.ts.map +0 -1
- package/dist/routes/dashboard.d.ts.map +0 -1
- package/dist/routes/events.d.ts.map +0 -1
- package/dist/routes/file-browser.d.ts.map +0 -1
- package/dist/routes/file-diff-rollback.d.ts.map +0 -1
- package/dist/routes/file-snapshot.d.ts.map +0 -1
- package/dist/routes/git.d.ts.map +0 -1
- package/dist/routes/instance.d.ts.map +0 -1
- package/dist/routes/mcp.d.ts.map +0 -1
- package/dist/routes/processes.d.ts.map +0 -1
- package/dist/routes/properties.d.ts.map +0 -1
- package/dist/routes/pty.d.ts.map +0 -1
- package/dist/routes/runtime-binding.d.ts.map +0 -1
- package/dist/routes/sessions.d.ts.map +0 -1
- package/dist/routes/skills.d.ts.map +0 -1
- package/dist/routes/sub-agents.d.ts.map +0 -1
- package/dist/routes/system-metrics.d.ts.map +0 -1
- package/dist/routes/task-context.d.ts.map +0 -1
- package/dist/routes/terminal.d.ts.map +0 -1
- package/dist/routes/yml.d.ts.map +0 -1
- package/dist/services/acode-package.d.ts.map +0 -1
- package/dist/services/agent-event-store.d.ts.map +0 -1
- package/dist/services/agent-process-manager.d.ts.map +0 -1
- package/dist/services/ai-source-apply.d.ts.map +0 -1
- package/dist/services/auto-register.d.ts.map +0 -1
- package/dist/services/aws-client-agent-mcp.d.ts.map +0 -1
- package/dist/services/bridge-package-publish-hooks.d.ts.map +0 -1
- package/dist/services/cc-switch-sdk.d.ts.map +0 -1
- package/dist/services/cli-commands.d.ts.map +0 -1
- package/dist/services/event-delta-pusher.d.ts.map +0 -1
- package/dist/services/fileSnapshotStore.d.ts.map +0 -1
- package/dist/services/instance-ai-config-service.d.ts.map +0 -1
- package/dist/services/instance-init-service.d.ts.map +0 -1
- package/dist/services/instance-service.d.ts.map +0 -1
- package/dist/services/instance-state.d.ts.map +0 -1
- package/dist/services/legacy-path-migration.d.ts.map +0 -1
- package/dist/services/lifecycle-state.d.ts.map +0 -1
- package/dist/services/mcp-launch-binding-queue.d.ts.map +0 -1
- package/dist/services/orphan-monitor.d.ts.map +0 -1
- package/dist/services/panel-auth.d.ts.map +0 -1
- package/dist/services/process-detector.d.ts.map +0 -1
- package/dist/services/process-registry.d.ts.map +0 -1
- package/dist/services/ring-buffer.d.ts.map +0 -1
- package/dist/services/runtime-binding.d.ts.map +0 -1
- package/dist/services/runtime-lifecycle-policy.d.ts.map +0 -1
- package/dist/services/session-output.d.ts.map +0 -1
- package/dist/services/startup-config-wizard.d.ts.map +0 -1
- package/dist/services/sub-agent-manager-instance.d.ts.map +0 -1
- package/dist/services/system-metrics.d.ts.map +0 -1
- package/dist/services/terminal-persistence.d.ts.map +0 -1
- package/dist/services/tool-installer.d.ts.map +0 -1
- package/dist/services/tunnel-client.d.ts.map +0 -1
- package/dist/services/windows-service-manager.d.ts.map +0 -1
- package/dist/services/workspace-files.d.ts.map +0 -1
- package/dist/services/workspace-watch.d.ts.map +0 -1
- package/dist/services/workspaceTaskChangeWatcher.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/file-utils.d.ts.map +0 -1
- package/dist/utils/instance-ai-config-debug-logger.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/mcp-utils.d.ts.map +0 -1
- package/dist/utils/path-utils.d.ts.map +0 -1
- package/dist/utils/sdk-package-loader.d.ts.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/yaml-utils.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/constants.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/errors.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/index.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/schemas.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/sdk.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/mcp-model.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/mcp-service.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/skill-model.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/services/skill-service.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/state.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/types.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/utils/fs.d.ts.map +0 -1
- package/node_modules/@cc-switch/sdk/dist/utils/id.d.ts.map +0 -1
- package/package/acode/dist/ask-user-question-tool.d.ts.map +0 -1
- package/package/acode/dist/built-in-file-tools.d.ts.map +0 -1
- package/package/acode/dist/built-in-symbols-tool.d.ts.map +0 -1
- package/package/acode/dist/builtins/commandArtifacts.d.ts.map +0 -1
- package/package/acode/dist/builtins/commandOutputEvents.d.ts.map +0 -1
- package/package/acode/dist/builtins/shellCommandPreparation.d.ts.map +0 -1
- package/package/acode/dist/builtins/shellCommandResult.d.ts.map +0 -1
- package/package/acode/dist/builtins/shellCommandRunner.d.ts.map +0 -1
- package/package/acode/dist/builtins/shellOutputDecoder.d.ts.map +0 -1
- package/package/acode/dist/cli.d.ts.map +0 -1
- package/package/acode/dist/commands/commandLoader.d.ts.map +0 -1
- package/package/acode/dist/commands/commandParser.d.ts.map +0 -1
- package/package/acode/dist/commands/commandRegistry.d.ts.map +0 -1
- package/package/acode/dist/compaction.d.ts.map +0 -1
- package/package/acode/dist/config.d.ts.map +0 -1
- package/package/acode/dist/fs-utils.d.ts.map +0 -1
- package/package/acode/dist/hooks/hookBus.d.ts.map +0 -1
- package/package/acode/dist/index.d.ts.map +0 -1
- package/package/acode/dist/mcpToolNames.d.ts.map +0 -1
- package/package/acode/dist/parsers/ast-cache.d.ts.map +0 -1
- package/package/acode/dist/parsers/language-detector.d.ts.map +0 -1
- package/package/acode/dist/parsers/language-queries.d.ts.map +0 -1
- package/package/acode/dist/parsers/symbol-extractor.d.ts.map +0 -1
- package/package/acode/dist/parsers/tree-sitter-loader.d.ts.map +0 -1
- package/package/acode/dist/parsers/types.d.ts.map +0 -1
- package/package/acode/dist/runtime.d.ts.map +0 -1
- package/package/acode/dist/skill-tool.d.ts.map +0 -1
- package/package/acode/dist/sub-agent-manager.d.ts.map +0 -1
- package/package/acode/dist/sub-agent-store.d.ts.map +0 -1
- package/package/acode/dist/sub-agent-tools.d.ts.map +0 -1
- package/package/acode/dist/sub-agent-types.d.ts.map +0 -1
- package/package/acode/dist/todo-store.d.ts.map +0 -1
- package/package/acode/dist/todo-tool.d.ts.map +0 -1
- package/package/acode/dist/types.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/agent-client.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/config.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/config.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/config.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/config.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/constants.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/constants.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/context-manager.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/http-client.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/index.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/index.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/logger.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/logger.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/logger.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/logger.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-store.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/messageContent.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/messageContent.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.test.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/types.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/types.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.js.map +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.test.d.ts.map +0 -1
- package/package/aws-client-agent-mcp/dist/websocket-client.test.js.map +0 -1
- package/package/cc-switch-sdk/dist/constants.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/errors.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/index.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/schemas.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/sdk.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/services/ai-config-service.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/services/mcp-model.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/services/mcp-service.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/services/skill-model.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/services/skill-service.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/state.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/types.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/utils/fs.d.ts.map +0 -1
- package/package/cc-switch-sdk/dist/utils/id.d.ts.map +0 -1
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
acode: z.boolean(),
|
|
4
|
-
claude: z.boolean(),
|
|
5
|
-
claudecode: z.boolean(),
|
|
6
|
-
codex: z.boolean(),
|
|
7
|
-
gemini: z.boolean(),
|
|
8
|
-
opencode: z.boolean(),
|
|
9
|
-
openclaw: z.boolean(),
|
|
10
|
-
});
|
|
11
|
-
export const mcpServerSpecSchema = z.object({
|
|
12
|
-
type: z.enum(["stdio", "sse", "http"]).optional(),
|
|
13
|
-
command: z.string().optional(),
|
|
14
|
-
args: z.array(z.string()).optional(),
|
|
15
|
-
env: z.record(z.string(), z.string()).optional(),
|
|
16
|
-
cwd: z.string().optional(),
|
|
17
|
-
url: z.string().optional(),
|
|
18
|
-
headers: z.record(z.string(), z.string()).optional(),
|
|
19
|
-
});
|
|
20
|
-
export const mcpServerSchema = z.object({
|
|
21
|
-
id: z.string(),
|
|
22
|
-
name: z.string(),
|
|
23
|
-
server: mcpServerSpecSchema,
|
|
24
|
-
description: z.string().optional(),
|
|
25
|
-
apps: appFlagsSchema,
|
|
26
|
-
});
|
|
27
|
-
export const installedSkillSchema = z.object({
|
|
28
|
-
id: z.string(),
|
|
29
|
-
name: z.string(),
|
|
30
|
-
directory: z.string(),
|
|
31
|
-
description: z.string().optional(),
|
|
32
|
-
apps: appFlagsSchema,
|
|
33
|
-
installedAt: z.number(),
|
|
34
|
-
});
|
|
35
|
-
export const sdkStateSchema = z.object({
|
|
36
|
-
mcpServers: z.record(z.string(), mcpServerSchema),
|
|
37
|
-
skills: z.record(z.string(), installedSkillSchema),
|
|
38
|
-
});
|
|
1
|
+
import{z as o}from"zod";const e=o.object({acode:o.boolean(),claude:o.boolean(),claudecode:o.boolean(),codex:o.boolean(),gemini:o.boolean(),opencode:o.boolean(),openclaw:o.boolean()}),t=o.object({type:o.enum(["stdio","sse","http"]).optional(),command:o.string().optional(),args:o.array(o.string()).optional(),env:o.record(o.string(),o.string()).optional(),cwd:o.string().optional(),url:o.string().optional(),headers:o.record(o.string(),o.string()).optional()}),n=o.object({id:o.string(),name:o.string(),server:t,description:o.string().optional(),apps:e}),r=o.object({id:o.string(),name:o.string(),directory:o.string(),description:o.string().optional(),apps:e,installedAt:o.number()}),a=o.object({mcpServers:o.record(o.string(),n),skills:o.record(o.string(),r)});export{e as appFlagsSchema,r as installedSkillSchema,n as mcpServerSchema,t as mcpServerSpecSchema,a as sdkStateSchema};
|
|
2
|
+
|
|
@@ -1,470 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { loadState, saveState } from "./state.js";
|
|
4
|
-
import { buildMcpFromInput, mergeMcp, applyMcpAppFlag, } from "./services/mcp-model.js";
|
|
5
|
-
import { syncMcpServerToApps } from "./services/mcp-service.js";
|
|
6
|
-
import { buildSkillFromInput, mergeSkill, applySkillAppFlag, skillSourceDir, } from "./services/skill-model.js";
|
|
7
|
-
import { syncSkillToApps } from "./services/skill-service.js";
|
|
8
|
-
import { copyDir, copyDirIfExists, copyFile, pathExists, removeIfExists, } from "./utils/fs.js";
|
|
9
|
-
import { SdkError } from "./errors.js";
|
|
10
|
-
/**
|
|
11
|
-
* 导入时合并 App 标记
|
|
12
|
-
* 注意:此函数移到 sdk.ts 中,因为它是导入逻辑的一部分
|
|
13
|
-
*/
|
|
14
|
-
function mergeAppFlagOnImport(server, appId) {
|
|
15
|
-
const canonicalAppId = appId === "claude" ? "claudecode" : appId;
|
|
16
|
-
return {
|
|
17
|
-
...server,
|
|
18
|
-
apps: {
|
|
19
|
-
...server.apps,
|
|
20
|
-
[canonicalAppId]: true,
|
|
21
|
-
claude: false,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export class CcSwitchSdk {
|
|
26
|
-
/**
|
|
27
|
-
* 创建 CcSwitchSdk 实例
|
|
28
|
-
*
|
|
29
|
-
* 注意:adapters 必须通过 options.adapters 注入,
|
|
30
|
-
* cc-switch-sdk 不再提供默认的 adapter 实现。
|
|
31
|
-
*
|
|
32
|
-
* @param options - SDK 配置选项
|
|
33
|
-
* @param options.adapters.mcp - MCP 适配器映射(必需)
|
|
34
|
-
* @param options.adapters.skill - Skill 适配器映射(必需)
|
|
35
|
-
*/
|
|
36
|
-
constructor(options) {
|
|
37
|
-
this.state = { mcpServers: {}, skills: {} };
|
|
38
|
-
this.operationQueue = Promise.resolve();
|
|
39
|
-
if (!options.adapters?.mcp || !options.adapters?.skill) {
|
|
40
|
-
throw new SdkError("ADAPTERS_REQUIRED", "Adapters are required. Please provide mcp and skill adapters via options.adapters.", { hasMcp: !!options.adapters?.mcp, hasSkill: !!options.adapters?.skill });
|
|
41
|
-
}
|
|
42
|
-
const resolved = resolvePaths(options);
|
|
43
|
-
this.paths = resolved.paths;
|
|
44
|
-
this.skillSyncMethod = resolved.skillSyncMethod;
|
|
45
|
-
this.mcpAdapters = options.adapters.mcp;
|
|
46
|
-
this.skillAdapters = options.adapters.skill;
|
|
47
|
-
}
|
|
48
|
-
async executeExclusive(operation) {
|
|
49
|
-
const previous = this.operationQueue;
|
|
50
|
-
let release;
|
|
51
|
-
this.operationQueue = new Promise((resolve) => {
|
|
52
|
-
release = resolve;
|
|
53
|
-
});
|
|
54
|
-
await previous;
|
|
55
|
-
try {
|
|
56
|
-
return await operation();
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
release();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async load() {
|
|
63
|
-
this.state = await loadState(this.paths.stateFile);
|
|
64
|
-
}
|
|
65
|
-
async save() {
|
|
66
|
-
await saveState(this.paths.stateFile, this.state);
|
|
67
|
-
}
|
|
68
|
-
getAiConfigPath(appId) {
|
|
69
|
-
if (appId === "opencode") {
|
|
70
|
-
return this.paths.opencodeConfigFile;
|
|
71
|
-
}
|
|
72
|
-
if (appId === "claudecode") {
|
|
73
|
-
return this.paths.claudecodeConfigFile;
|
|
74
|
-
}
|
|
75
|
-
if (appId === "codex") {
|
|
76
|
-
return this.paths.codexConfigFile;
|
|
77
|
-
}
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
getAiBackupPath(appId) {
|
|
81
|
-
const extension = appId === "codex" ? "toml" : "json";
|
|
82
|
-
return path.join(this.paths.backupDir, `${appId}.config.backup.${extension}`);
|
|
83
|
-
}
|
|
84
|
-
async backupAiConfigIfNeeded(appId) {
|
|
85
|
-
const configPath = this.getAiConfigPath(appId);
|
|
86
|
-
if (!configPath) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const backupPath = this.getAiBackupPath(appId);
|
|
90
|
-
if (await pathExists(backupPath)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (await pathExists(configPath)) {
|
|
94
|
-
await copyFile(configPath, backupPath);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async backupBeforeMcpSyncByApps(apps) {
|
|
98
|
-
const targets = ["acode", "opencode", "claudecode", "codex"];
|
|
99
|
-
for (const appId of targets) {
|
|
100
|
-
if (apps[appId]) {
|
|
101
|
-
await this.backupAiConfigIfNeeded(appId);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async backupBeforeMcpSync(server) {
|
|
106
|
-
await this.backupBeforeMcpSyncByApps(server.apps);
|
|
107
|
-
}
|
|
108
|
-
async backupAiConfigs(appIds = ["acode", "opencode", "claudecode", "codex"]) {
|
|
109
|
-
for (const appId of appIds) {
|
|
110
|
-
await this.backupAiConfigIfNeeded(appId);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async restoreAiConfig(appId) {
|
|
114
|
-
const configPath = this.getAiConfigPath(appId);
|
|
115
|
-
if (!configPath) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
const backupPath = this.getAiBackupPath(appId);
|
|
119
|
-
if (!(await pathExists(backupPath))) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
await copyFile(backupPath, configPath);
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
async restoreAiConfigs(appIds = ["acode", "opencode", "claudecode", "codex"]) {
|
|
126
|
-
const result = {};
|
|
127
|
-
for (const appId of appIds) {
|
|
128
|
-
result[appId] = await this.restoreAiConfig(appId);
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
getAllMcpServers() {
|
|
133
|
-
return Object.values(this.state.mcpServers);
|
|
134
|
-
}
|
|
135
|
-
getMcpServerById(id) {
|
|
136
|
-
return this.state.mcpServers[id];
|
|
137
|
-
}
|
|
138
|
-
async createMcpServer(input) {
|
|
139
|
-
return this.executeExclusive(async () => {
|
|
140
|
-
const server = buildMcpFromInput(input);
|
|
141
|
-
this.state.mcpServers[server.id] = server;
|
|
142
|
-
await this.backupBeforeMcpSync(server);
|
|
143
|
-
await syncMcpServerToApps(server, this.mcpAdapters);
|
|
144
|
-
await this.save();
|
|
145
|
-
return server;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
async updateMcpServer(id, patch) {
|
|
149
|
-
return this.executeExclusive(async () => {
|
|
150
|
-
const current = this.state.mcpServers[id];
|
|
151
|
-
if (!current) {
|
|
152
|
-
throw new SdkError("MCP_NOT_FOUND", `MCP server not found: ${id}`, { id });
|
|
153
|
-
}
|
|
154
|
-
const updated = mergeMcp(current, patch);
|
|
155
|
-
this.state.mcpServers[id] = updated;
|
|
156
|
-
await this.backupBeforeMcpSync(updated);
|
|
157
|
-
await syncMcpServerToApps(updated, this.mcpAdapters);
|
|
158
|
-
await this.save();
|
|
159
|
-
return updated;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
async deleteMcpServer(id) {
|
|
163
|
-
return this.executeExclusive(async () => {
|
|
164
|
-
const server = this.state.mcpServers[id];
|
|
165
|
-
if (!server) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const disabled = {
|
|
169
|
-
...server,
|
|
170
|
-
apps: {
|
|
171
|
-
claude: false,
|
|
172
|
-
acode: false,
|
|
173
|
-
claudecode: false,
|
|
174
|
-
codex: false,
|
|
175
|
-
gemini: false,
|
|
176
|
-
opencode: false,
|
|
177
|
-
openclaw: false,
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
await syncMcpServerToApps(disabled, this.mcpAdapters);
|
|
181
|
-
delete this.state.mcpServers[id];
|
|
182
|
-
await this.save();
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
async toggleMcpApp(serverId, appId, enabled) {
|
|
186
|
-
return this.executeExclusive(async () => {
|
|
187
|
-
const current = this.state.mcpServers[serverId];
|
|
188
|
-
if (!current) {
|
|
189
|
-
throw new SdkError("MCP_NOT_FOUND", `MCP server not found: ${serverId}`, {
|
|
190
|
-
serverId,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
const updated = applyMcpAppFlag(current, appId, enabled);
|
|
194
|
-
this.state.mcpServers[serverId] = updated;
|
|
195
|
-
await this.backupBeforeMcpSyncByApps({ [appId]: enabled });
|
|
196
|
-
await syncMcpServerToApps(updated, this.mcpAdapters);
|
|
197
|
-
await this.save();
|
|
198
|
-
return updated;
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
async importMcpFromApps() {
|
|
202
|
-
return this.executeExclusive(async () => {
|
|
203
|
-
let count = 0;
|
|
204
|
-
const apps = ["claude", "claudecode", "opencode", "codex", "gemini", "openclaw"];
|
|
205
|
-
for (const appId of apps) {
|
|
206
|
-
const imported = await this.mcpAdapters[appId].importServers();
|
|
207
|
-
for (const imp of imported) {
|
|
208
|
-
const existing = this.findMcpServerByName(imp.name);
|
|
209
|
-
if (existing) {
|
|
210
|
-
const merged = mergeAppFlagOnImport(existing, appId);
|
|
211
|
-
this.state.mcpServers[existing.id] = merged;
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
const withFlag = this.createMcpWithAppFlag(imp, appId);
|
|
215
|
-
this.state.mcpServers[withFlag.id] = withFlag;
|
|
216
|
-
count++;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
await this.save();
|
|
220
|
-
return count;
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* 从单个应用导入 MCP 服务器
|
|
225
|
-
*/
|
|
226
|
-
async importMcpFromApp(appId) {
|
|
227
|
-
let count = 0;
|
|
228
|
-
const imported = await this.mcpAdapters[appId].importServers();
|
|
229
|
-
for (const imp of imported) {
|
|
230
|
-
const isNew = await this.processImportedMcp(imp, appId);
|
|
231
|
-
if (isNew) {
|
|
232
|
-
count++;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return count;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* 处理导入的 MCP 服务器(合并或创建)
|
|
239
|
-
* @returns 是否为新创建的 MCP
|
|
240
|
-
*/
|
|
241
|
-
async processImportedMcp(imp, appId) {
|
|
242
|
-
const existing = this.findMcpServerByName(imp.name);
|
|
243
|
-
if (existing) {
|
|
244
|
-
const merged = mergeAppFlagOnImport(existing, appId);
|
|
245
|
-
this.state.mcpServers[existing.id] = merged;
|
|
246
|
-
await syncMcpServerToApps(merged, this.mcpAdapters);
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
const withFlag = this.createMcpWithAppFlag(imp, appId);
|
|
250
|
-
this.state.mcpServers[withFlag.id] = withFlag;
|
|
251
|
-
await syncMcpServerToApps(withFlag, this.mcpAdapters);
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* 根据名称查找 MCP 服务器
|
|
256
|
-
*/
|
|
257
|
-
findMcpServerByName(name) {
|
|
258
|
-
return Object.values(this.state.mcpServers).find((s) => s.name === name);
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* 创建带有应用标记的 MCP 服务器
|
|
262
|
-
*/
|
|
263
|
-
createMcpWithAppFlag(imp, appId) {
|
|
264
|
-
const canonicalAppId = appId === "claude" ? "claudecode" : appId;
|
|
265
|
-
return {
|
|
266
|
-
...imp,
|
|
267
|
-
apps: {
|
|
268
|
-
acode: false,
|
|
269
|
-
claude: false,
|
|
270
|
-
claudecode: false,
|
|
271
|
-
codex: false,
|
|
272
|
-
gemini: false,
|
|
273
|
-
opencode: false,
|
|
274
|
-
openclaw: false,
|
|
275
|
-
[canonicalAppId]: true,
|
|
276
|
-
},
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
getAllSkills() {
|
|
280
|
-
return Object.values(this.state.skills);
|
|
281
|
-
}
|
|
282
|
-
getSkillById(id) {
|
|
283
|
-
return this.state.skills[id];
|
|
284
|
-
}
|
|
285
|
-
async installSkill(input) {
|
|
286
|
-
return this.executeExclusive(async () => {
|
|
287
|
-
const ssotDir = this.paths.ssotSkillsDir;
|
|
288
|
-
const skill = buildSkillFromInput(input);
|
|
289
|
-
const targetSource = skillSourceDir(ssotDir, skill);
|
|
290
|
-
await copyDir(input.sourceDir, targetSource);
|
|
291
|
-
this.state.skills[skill.id] = skill;
|
|
292
|
-
await syncSkillToApps(skill, targetSource, this.skillSyncMethod, this.skillAdapters);
|
|
293
|
-
await this.save();
|
|
294
|
-
return skill;
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
async updateSkill(id, patch) {
|
|
298
|
-
return this.executeExclusive(async () => {
|
|
299
|
-
const current = this.state.skills[id];
|
|
300
|
-
if (!current) {
|
|
301
|
-
throw new SdkError("SKILL_NOT_FOUND", `Skill not found: ${id}`, { id });
|
|
302
|
-
}
|
|
303
|
-
const updated = mergeSkill(current, patch);
|
|
304
|
-
this.state.skills[id] = updated;
|
|
305
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, updated);
|
|
306
|
-
await syncSkillToApps(updated, source, this.skillSyncMethod, this.skillAdapters);
|
|
307
|
-
await this.save();
|
|
308
|
-
return updated;
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
async uninstallSkill(id) {
|
|
312
|
-
return this.executeExclusive(async () => {
|
|
313
|
-
const skill = this.state.skills[id];
|
|
314
|
-
if (!skill) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const disabled = {
|
|
318
|
-
...skill,
|
|
319
|
-
apps: {
|
|
320
|
-
acode: false,
|
|
321
|
-
claude: false,
|
|
322
|
-
claudecode: false,
|
|
323
|
-
codex: false,
|
|
324
|
-
gemini: false,
|
|
325
|
-
opencode: false,
|
|
326
|
-
openclaw: false,
|
|
327
|
-
},
|
|
328
|
-
};
|
|
329
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, skill);
|
|
330
|
-
await syncSkillToApps(disabled, source, this.skillSyncMethod, this.skillAdapters);
|
|
331
|
-
delete this.state.skills[id];
|
|
332
|
-
const sourceDir = skillSourceDir(this.paths.ssotSkillsDir, skill);
|
|
333
|
-
await removeIfExists(sourceDir);
|
|
334
|
-
await this.save();
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
async toggleSkillApp(skillId, appId, enabled) {
|
|
338
|
-
return this.executeExclusive(async () => {
|
|
339
|
-
const current = this.state.skills[skillId];
|
|
340
|
-
if (!current) {
|
|
341
|
-
throw new SdkError("SKILL_NOT_FOUND", `Skill not found: ${skillId}`, {
|
|
342
|
-
skillId,
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
const updated = applySkillAppFlag(current, appId, enabled);
|
|
346
|
-
this.state.skills[skillId] = updated;
|
|
347
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, updated);
|
|
348
|
-
await syncSkillToApps(updated, source, this.skillSyncMethod, this.skillAdapters);
|
|
349
|
-
await this.save();
|
|
350
|
-
return updated;
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
async importSkillsFromApps() {
|
|
354
|
-
return this.executeExclusive(async () => {
|
|
355
|
-
let count = 0;
|
|
356
|
-
const apps = ["claude", "claudecode", "opencode", "codex", "gemini", "openclaw"];
|
|
357
|
-
for (const appId of apps) {
|
|
358
|
-
const imported = await this.skillAdapters[appId].importSkills();
|
|
359
|
-
for (const imp of imported) {
|
|
360
|
-
const existing = this.findSkillByName(imp.name);
|
|
361
|
-
if (existing) {
|
|
362
|
-
if (!(await pathExists(imp.directory))) {
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
const canonicalAppId = appId === "claude" ? "claudecode" : appId;
|
|
366
|
-
const merged = {
|
|
367
|
-
...existing,
|
|
368
|
-
apps: { ...existing.apps, [canonicalAppId]: true, claude: false },
|
|
369
|
-
};
|
|
370
|
-
this.state.skills[existing.id] = merged;
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
const withFlag = this.createSkillWithAppFlag(imp, appId);
|
|
374
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, withFlag);
|
|
375
|
-
const copied = await copyDirIfExists(imp.directory, source);
|
|
376
|
-
if (!copied) {
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
this.state.skills[withFlag.id] = withFlag;
|
|
380
|
-
count++;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
await this.save();
|
|
384
|
-
return count;
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* 从单个应用导入 Skills
|
|
389
|
-
*/
|
|
390
|
-
async importSkillsFromApp(appId) {
|
|
391
|
-
let count = 0;
|
|
392
|
-
const imported = await this.skillAdapters[appId].importSkills();
|
|
393
|
-
for (const imp of imported) {
|
|
394
|
-
const isNew = await this.processImportedSkill(imp, appId);
|
|
395
|
-
if (isNew) {
|
|
396
|
-
count++;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return count;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* 处理导入的 Skill(合并或创建)
|
|
403
|
-
* @returns 是否为新创建的 Skill
|
|
404
|
-
*/
|
|
405
|
-
async processImportedSkill(imp, appId) {
|
|
406
|
-
const existing = this.findSkillByName(imp.name);
|
|
407
|
-
if (existing) {
|
|
408
|
-
await this.mergeExistingSkill(existing, appId);
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
await this.createNewImportedSkill(imp, appId);
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* 根据名称查找 Skill
|
|
416
|
-
*/
|
|
417
|
-
findSkillByName(name) {
|
|
418
|
-
return Object.values(this.state.skills).find((s) => s.name === name);
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* 合并已存在的 Skill
|
|
422
|
-
*/
|
|
423
|
-
async mergeExistingSkill(existing, appId) {
|
|
424
|
-
const canonicalAppId = appId === "claude" ? "claudecode" : appId;
|
|
425
|
-
const merged = {
|
|
426
|
-
...existing,
|
|
427
|
-
apps: { ...existing.apps, [canonicalAppId]: true, claude: false },
|
|
428
|
-
};
|
|
429
|
-
this.state.skills[existing.id] = merged;
|
|
430
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, merged);
|
|
431
|
-
await syncSkillToApps(merged, source, this.skillSyncMethod, this.skillAdapters);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* 创建新导入的 Skill
|
|
435
|
-
*/
|
|
436
|
-
async createNewImportedSkill(imp, appId) {
|
|
437
|
-
const withFlag = this.createSkillWithAppFlag(imp, appId);
|
|
438
|
-
this.state.skills[withFlag.id] = withFlag;
|
|
439
|
-
const source = skillSourceDir(this.paths.ssotSkillsDir, withFlag);
|
|
440
|
-
await copyDir(imp.directory, source);
|
|
441
|
-
await syncSkillToApps(withFlag, source, this.skillSyncMethod, this.skillAdapters);
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* 创建带有应用标记的 Skill
|
|
445
|
-
*/
|
|
446
|
-
createSkillWithAppFlag(imp, appId) {
|
|
447
|
-
const canonicalAppId = appId === "claude" ? "claudecode" : appId;
|
|
448
|
-
const now = Date.now();
|
|
449
|
-
return {
|
|
450
|
-
id: imp.id,
|
|
451
|
-
name: imp.name,
|
|
452
|
-
directory: imp.directory,
|
|
453
|
-
description: imp.description,
|
|
454
|
-
apps: {
|
|
455
|
-
acode: false,
|
|
456
|
-
claude: false,
|
|
457
|
-
claudecode: false,
|
|
458
|
-
codex: false,
|
|
459
|
-
gemini: false,
|
|
460
|
-
opencode: false,
|
|
461
|
-
openclaw: false,
|
|
462
|
-
[canonicalAppId]: true,
|
|
463
|
-
},
|
|
464
|
-
installedAt: now,
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
getPaths() {
|
|
468
|
-
return this.paths;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
1
|
+
import y from"node:path";import{resolvePaths as g}from"./constants.js";import{loadState as A,saveState as v}from"./state.js";import{buildMcpFromInput as x,mergeMcp as M,applyMcpAppFlag as F}from"./services/mcp-model.js";import{syncMcpServerToApps as l}from"./services/mcp-service.js";import{buildSkillFromInput as N,mergeSkill as D,applySkillAppFlag as b,skillSourceDir as r}from"./services/skill-model.js";import{syncSkillToApps as n}from"./services/skill-service.js";import{copyDir as f,copyDirIfExists as B,copyFile as m,pathExists as d,removeIfExists as E}from"./utils/fs.js";import{SdkError as p}from"./errors.js";function k(u,e){const t=e==="claude"?"claudecode":e;return{...u,apps:{...u.apps,[t]:!0,claude:!1}}}class L{constructor(e){if(this.state={mcpServers:{},skills:{}},this.operationQueue=Promise.resolve(),!e.adapters?.mcp||!e.adapters?.skill)throw new p("ADAPTERS_REQUIRED","Adapters are required. Please provide mcp and skill adapters via options.adapters.",{hasMcp:!!e.adapters?.mcp,hasSkill:!!e.adapters?.skill});const t=g(e);this.paths=t.paths,this.skillSyncMethod=t.skillSyncMethod,this.mcpAdapters=e.adapters.mcp,this.skillAdapters=e.adapters.skill}async executeExclusive(e){const t=this.operationQueue;let s;this.operationQueue=new Promise(i=>{s=i}),await t;try{return await e()}finally{s()}}async load(){this.state=await A(this.paths.stateFile)}async save(){await v(this.paths.stateFile,this.state)}getAiConfigPath(e){if(e==="opencode")return this.paths.opencodeConfigFile;if(e==="claudecode")return this.paths.claudecodeConfigFile;if(e==="codex")return this.paths.codexConfigFile}getAiBackupPath(e){const t=e==="codex"?"toml":"json";return y.join(this.paths.backupDir,`${e}.config.backup.${t}`)}async backupAiConfigIfNeeded(e){const t=this.getAiConfigPath(e);if(!t)return;const s=this.getAiBackupPath(e);await d(s)||await d(t)&&await m(t,s)}async backupBeforeMcpSyncByApps(e){const t=["acode","opencode","claudecode","codex"];for(const s of t)e[s]&&await this.backupAiConfigIfNeeded(s)}async backupBeforeMcpSync(e){await this.backupBeforeMcpSyncByApps(e.apps)}async backupAiConfigs(e=["acode","opencode","claudecode","codex"]){for(const t of e)await this.backupAiConfigIfNeeded(t)}async restoreAiConfig(e){const t=this.getAiConfigPath(e);if(!t)return!1;const s=this.getAiBackupPath(e);return await d(s)?(await m(s,t),!0):!1}async restoreAiConfigs(e=["acode","opencode","claudecode","codex"]){const t={};for(const s of e)t[s]=await this.restoreAiConfig(s);return t}getAllMcpServers(){return Object.values(this.state.mcpServers)}getMcpServerById(e){return this.state.mcpServers[e]}async createMcpServer(e){return this.executeExclusive(async()=>{const t=x(e);return this.state.mcpServers[t.id]=t,await this.backupBeforeMcpSync(t),await l(t,this.mcpAdapters),await this.save(),t})}async updateMcpServer(e,t){return this.executeExclusive(async()=>{const s=this.state.mcpServers[e];if(!s)throw new p("MCP_NOT_FOUND",`MCP server not found: ${e}`,{id:e});const i=M(s,t);return this.state.mcpServers[e]=i,await this.backupBeforeMcpSync(i),await l(i,this.mcpAdapters),await this.save(),i})}async deleteMcpServer(e){return this.executeExclusive(async()=>{const t=this.state.mcpServers[e];if(!t)return;const s={...t,apps:{claude:!1,acode:!1,claudecode:!1,codex:!1,gemini:!1,opencode:!1,openclaw:!1}};await l(s,this.mcpAdapters),delete this.state.mcpServers[e],await this.save()})}async toggleMcpApp(e,t,s){return this.executeExclusive(async()=>{const i=this.state.mcpServers[e];if(!i)throw new p("MCP_NOT_FOUND",`MCP server not found: ${e}`,{serverId:e});const a=F(i,t,s);return this.state.mcpServers[e]=a,await this.backupBeforeMcpSyncByApps({[t]:s}),await l(a,this.mcpAdapters),await this.save(),a})}async importMcpFromApps(){return this.executeExclusive(async()=>{let e=0;const t=["claude","claudecode","opencode","codex","gemini","openclaw"];for(const s of t){const i=await this.mcpAdapters[s].importServers();for(const a of i){const c=this.findMcpServerByName(a.name);if(c){const h=k(c,s);this.state.mcpServers[c.id]=h;continue}const o=this.createMcpWithAppFlag(a,s);this.state.mcpServers[o.id]=o,e++}}return await this.save(),e})}async importMcpFromApp(e){let t=0;const s=await this.mcpAdapters[e].importServers();for(const i of s)await this.processImportedMcp(i,e)&&t++;return t}async processImportedMcp(e,t){const s=this.findMcpServerByName(e.name);if(s){const a=k(s,t);return this.state.mcpServers[s.id]=a,await l(a,this.mcpAdapters),!1}const i=this.createMcpWithAppFlag(e,t);return this.state.mcpServers[i.id]=i,await l(i,this.mcpAdapters),!0}findMcpServerByName(e){return Object.values(this.state.mcpServers).find(t=>t.name===e)}createMcpWithAppFlag(e,t){return{...e,apps:{acode:!1,claude:!1,claudecode:!1,codex:!1,gemini:!1,opencode:!1,openclaw:!1,[t==="claude"?"claudecode":t]:!0}}}getAllSkills(){return Object.values(this.state.skills)}getSkillById(e){return this.state.skills[e]}async installSkill(e){return this.executeExclusive(async()=>{const t=this.paths.ssotSkillsDir,s=N(e),i=r(t,s);return await f(e.sourceDir,i),this.state.skills[s.id]=s,await n(s,i,this.skillSyncMethod,this.skillAdapters),await this.save(),s})}async updateSkill(e,t){return this.executeExclusive(async()=>{const s=this.state.skills[e];if(!s)throw new p("SKILL_NOT_FOUND",`Skill not found: ${e}`,{id:e});const i=D(s,t);this.state.skills[e]=i;const a=r(this.paths.ssotSkillsDir,i);return await n(i,a,this.skillSyncMethod,this.skillAdapters),await this.save(),i})}async uninstallSkill(e){return this.executeExclusive(async()=>{const t=this.state.skills[e];if(!t)return;const s={...t,apps:{acode:!1,claude:!1,claudecode:!1,codex:!1,gemini:!1,opencode:!1,openclaw:!1}},i=r(this.paths.ssotSkillsDir,t);await n(s,i,this.skillSyncMethod,this.skillAdapters),delete this.state.skills[e];const a=r(this.paths.ssotSkillsDir,t);await E(a),await this.save()})}async toggleSkillApp(e,t,s){return this.executeExclusive(async()=>{const i=this.state.skills[e];if(!i)throw new p("SKILL_NOT_FOUND",`Skill not found: ${e}`,{skillId:e});const a=b(i,t,s);this.state.skills[e]=a;const c=r(this.paths.ssotSkillsDir,a);return await n(a,c,this.skillSyncMethod,this.skillAdapters),await this.save(),a})}async importSkillsFromApps(){return this.executeExclusive(async()=>{let e=0;const t=["claude","claudecode","opencode","codex","gemini","openclaw"];for(const s of t){const i=await this.skillAdapters[s].importSkills();for(const a of i){const c=this.findSkillByName(a.name);if(c){if(!await d(a.directory))continue;const S=s==="claude"?"claudecode":s,w={...c,apps:{...c.apps,[S]:!0,claude:!1}};this.state.skills[c.id]=w;continue}const o=this.createSkillWithAppFlag(a,s),h=r(this.paths.ssotSkillsDir,o);await B(a.directory,h)&&(this.state.skills[o.id]=o,e++)}}return await this.save(),e})}async importSkillsFromApp(e){let t=0;const s=await this.skillAdapters[e].importSkills();for(const i of s)await this.processImportedSkill(i,e)&&t++;return t}async processImportedSkill(e,t){const s=this.findSkillByName(e.name);return s?(await this.mergeExistingSkill(s,t),!1):(await this.createNewImportedSkill(e,t),!0)}findSkillByName(e){return Object.values(this.state.skills).find(t=>t.name===e)}async mergeExistingSkill(e,t){const s=t==="claude"?"claudecode":t,i={...e,apps:{...e.apps,[s]:!0,claude:!1}};this.state.skills[e.id]=i;const a=r(this.paths.ssotSkillsDir,i);await n(i,a,this.skillSyncMethod,this.skillAdapters)}async createNewImportedSkill(e,t){const s=this.createSkillWithAppFlag(e,t);this.state.skills[s.id]=s;const i=r(this.paths.ssotSkillsDir,s);await f(e.directory,i),await n(s,i,this.skillSyncMethod,this.skillAdapters)}createSkillWithAppFlag(e,t){const s=t==="claude"?"claudecode":t,i=Date.now();return{id:e.id,name:e.name,directory:e.directory,description:e.description,apps:{acode:!1,claude:!1,claudecode:!1,codex:!1,gemini:!1,opencode:!1,openclaw:!1,[s]:!0},installedAt:i}}getPaths(){return this.paths}}export{L as CcSwitchSdk};
|
|
2
|
+
|