oh-my-claude-sisyphus 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/compatibility-security.test.d.ts +13 -0
- package/dist/__tests__/compatibility-security.test.d.ts.map +1 -0
- package/dist/__tests__/compatibility-security.test.js +403 -0
- package/dist/__tests__/compatibility-security.test.js.map +1 -0
- package/dist/__tests__/compatibility.test.d.ts +7 -0
- package/dist/__tests__/compatibility.test.d.ts.map +1 -0
- package/dist/__tests__/compatibility.test.js +484 -0
- package/dist/__tests__/compatibility.test.js.map +1 -0
- package/dist/__tests__/hud/analytics-display.test.js +4 -0
- package/dist/__tests__/hud/analytics-display.test.js.map +1 -1
- package/dist/cli/analytics.js +0 -0
- package/dist/cli/index.js +0 -0
- package/dist/compatibility/discovery.d.ts +58 -0
- package/dist/compatibility/discovery.d.ts.map +1 -0
- package/dist/compatibility/discovery.js +619 -0
- package/dist/compatibility/discovery.js.map +1 -0
- package/dist/compatibility/index.d.ts +51 -0
- package/dist/compatibility/index.d.ts.map +1 -0
- package/dist/compatibility/index.js +72 -0
- package/dist/compatibility/index.js.map +1 -0
- package/dist/compatibility/mcp-bridge.d.ts +138 -0
- package/dist/compatibility/mcp-bridge.d.ts.map +1 -0
- package/dist/compatibility/mcp-bridge.js +524 -0
- package/dist/compatibility/mcp-bridge.js.map +1 -0
- package/dist/compatibility/permission-adapter.d.ts +79 -0
- package/dist/compatibility/permission-adapter.d.ts.map +1 -0
- package/dist/compatibility/permission-adapter.js +369 -0
- package/dist/compatibility/permission-adapter.js.map +1 -0
- package/dist/compatibility/registry.d.ts +161 -0
- package/dist/compatibility/registry.d.ts.map +1 -0
- package/dist/compatibility/registry.js +389 -0
- package/dist/compatibility/registry.js.map +1 -0
- package/dist/compatibility/types.d.ts +249 -0
- package/dist/compatibility/types.d.ts.map +1 -0
- package/dist/compatibility/types.js +8 -0
- package/dist/compatibility/types.js.map +1 -0
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +3 -0
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/hud/analytics-display.d.ts +1 -1
- package/dist/hud/analytics-display.d.ts.map +1 -1
- package/dist/hud/analytics-display.js +24 -7
- package/dist/hud/analytics-display.js.map +1 -1
- package/docs/COMPATIBILITY.md +1051 -0
- package/package.json +3 -1
- package/dist/__tests__/analytics/analytics-summary.test.d.ts +0 -2
- package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/analytics-summary.test.js +0 -267
- package/dist/__tests__/analytics/analytics-summary.test.js.map +0 -1
- package/dist/__tests__/analytics/cost-estimator.test.d.ts +0 -2
- package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/cost-estimator.test.js +0 -212
- package/dist/__tests__/analytics/cost-estimator.test.js.map +0 -1
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +0 -7
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +0 -1
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js +0 -374
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +0 -1
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +0 -2
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +0 -1
- package/dist/__tests__/hud/auto-tracking.integration.test.js +0 -12
- package/dist/__tests__/hud/auto-tracking.integration.test.js.map +0 -1
- package/dist/__tests__/learned-skills/config.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/config.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/config.test.js +0 -37
- package/dist/__tests__/learned-skills/config.test.js.map +0 -1
- package/dist/__tests__/learned-skills/detector.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/detector.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/detector.test.js +0 -99
- package/dist/__tests__/learned-skills/detector.test.js.map +0 -1
- package/dist/__tests__/learned-skills/finder.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/finder.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/finder.test.js +0 -59
- package/dist/__tests__/learned-skills/finder.test.js.map +0 -1
- package/dist/__tests__/learned-skills/loader.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/loader.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/loader.test.js +0 -69
- package/dist/__tests__/learned-skills/loader.test.js.map +0 -1
- package/dist/__tests__/learned-skills/parser.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/parser.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/parser.test.js +0 -81
- package/dist/__tests__/learned-skills/parser.test.js.map +0 -1
- package/dist/__tests__/learned-skills/validator.test.d.ts +0 -2
- package/dist/__tests__/learned-skills/validator.test.d.ts.map +0 -1
- package/dist/__tests__/learned-skills/validator.test.js +0 -85
- package/dist/__tests__/learned-skills/validator.test.js.map +0 -1
- package/dist/agents/codex-agents.d.ts +0 -20
- package/dist/agents/codex-agents.d.ts.map +0 -1
- package/dist/agents/codex-agents.js +0 -36
- package/dist/agents/codex-agents.js.map +0 -1
- package/dist/agents/document-writer.d.ts +0 -11
- package/dist/agents/document-writer.d.ts.map +0 -1
- package/dist/agents/document-writer.js +0 -209
- package/dist/agents/document-writer.js.map +0 -1
- package/dist/agents/frontend-engineer.d.ts +0 -11
- package/dist/agents/frontend-engineer.d.ts.map +0 -1
- package/dist/agents/frontend-engineer.js +0 -115
- package/dist/agents/frontend-engineer.js.map +0 -1
- package/dist/agents/librarian.d.ts +0 -12
- package/dist/agents/librarian.d.ts.map +0 -1
- package/dist/agents/librarian.js +0 -103
- package/dist/agents/librarian.js.map +0 -1
- package/dist/agents/metis.d.ts +0 -12
- package/dist/agents/metis.d.ts.map +0 -1
- package/dist/agents/metis.js +0 -117
- package/dist/agents/metis.js.map +0 -1
- package/dist/agents/momus.d.ts +0 -12
- package/dist/agents/momus.d.ts.map +0 -1
- package/dist/agents/momus.js +0 -128
- package/dist/agents/momus.js.map +0 -1
- package/dist/agents/multimodal-looker.d.ts +0 -11
- package/dist/agents/multimodal-looker.d.ts.map +0 -1
- package/dist/agents/multimodal-looker.js +0 -70
- package/dist/agents/multimodal-looker.js.map +0 -1
- package/dist/agents/oracle.d.ts +0 -13
- package/dist/agents/oracle.d.ts.map +0 -1
- package/dist/agents/oracle.js +0 -191
- package/dist/agents/oracle.js.map +0 -1
- package/dist/agents/orchestrator-sisyphus.d.ts +0 -11
- package/dist/agents/orchestrator-sisyphus.d.ts.map +0 -1
- package/dist/agents/orchestrator-sisyphus.js +0 -115
- package/dist/agents/orchestrator-sisyphus.js.map +0 -1
- package/dist/agents/prometheus.d.ts +0 -12
- package/dist/agents/prometheus.d.ts.map +0 -1
- package/dist/agents/prometheus.js +0 -195
- package/dist/agents/prometheus.js.map +0 -1
- package/dist/agents/sisyphus-junior.d.ts +0 -12
- package/dist/agents/sisyphus-junior.d.ts.map +0 -1
- package/dist/agents/sisyphus-junior.js +0 -93
- package/dist/agents/sisyphus-junior.js.map +0 -1
- package/dist/cli/components/CostDashboard.d.ts +0 -15
- package/dist/cli/components/CostDashboard.d.ts.map +0 -1
- package/dist/cli/components/CostDashboard.js +0 -15
- package/dist/cli/components/CostDashboard.js.map +0 -1
- package/dist/cli/components/LiveStats.d.ts +0 -16
- package/dist/cli/components/LiveStats.d.ts.map +0 -1
- package/dist/cli/components/LiveStats.js +0 -16
- package/dist/cli/components/LiveStats.js.map +0 -1
- package/dist/cli/components/SessionBrowser.d.ts +0 -14
- package/dist/cli/components/SessionBrowser.d.ts.map +0 -1
- package/dist/cli/components/SessionBrowser.js +0 -14
- package/dist/cli/components/SessionBrowser.js.map +0 -1
- package/dist/cli/tui.d.ts +0 -21
- package/dist/cli/tui.d.ts.map +0 -1
- package/dist/cli/tui.js +0 -21
- package/dist/cli/tui.js.map +0 -1
- package/dist/hooks/autopilot/signals.d.ts +0 -20
- package/dist/hooks/autopilot/signals.d.ts.map +0 -1
- package/dist/hooks/autopilot/signals.js +0 -75
- package/dist/hooks/autopilot/signals.js.map +0 -1
- package/dist/hooks/autopilot/summary.d.ts +0 -27
- package/dist/hooks/autopilot/summary.d.ts.map +0 -1
- package/dist/hooks/autopilot/summary.js +0 -160
- package/dist/hooks/autopilot/summary.js.map +0 -1
- package/dist/hooks/autopilot/transition.d.ts +0 -39
- package/dist/hooks/autopilot/transition.d.ts.map +0 -1
- package/dist/hooks/autopilot/transition.js +0 -216
- package/dist/hooks/autopilot/transition.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +0 -28
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/constants.js +0 -85
- package/dist/hooks/context-window-limit-recovery/constants.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/index.d.ts +0 -62
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/index.js +0 -201
- package/dist/hooks/context-window-limit-recovery/index.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +0 -31
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/parser.js +0 -241
- package/dist/hooks/context-window-limit-recovery/parser.js.map +0 -1
- package/dist/hooks/context-window-limit-recovery/types.d.ts +0 -84
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +0 -1
- package/dist/hooks/context-window-limit-recovery/types.js +0 -34
- package/dist/hooks/context-window-limit-recovery/types.js.map +0 -1
- package/dist/hooks/edit-error-recovery/index.d.ts +0 -62
- package/dist/hooks/edit-error-recovery/index.d.ts.map +0 -1
- package/dist/hooks/edit-error-recovery/index.js +0 -89
- package/dist/hooks/edit-error-recovery/index.js.map +0 -1
- package/dist/hooks/learned-skills/config.d.ts +0 -53
- package/dist/hooks/learned-skills/config.d.ts.map +0 -1
- package/dist/hooks/learned-skills/config.js +0 -103
- package/dist/hooks/learned-skills/config.js.map +0 -1
- package/dist/hooks/learned-skills/constants.d.ts +0 -24
- package/dist/hooks/learned-skills/constants.d.ts.map +0 -1
- package/dist/hooks/learned-skills/constants.js +0 -26
- package/dist/hooks/learned-skills/constants.js.map +0 -1
- package/dist/hooks/learned-skills/detection-hook.d.ts +0 -39
- package/dist/hooks/learned-skills/detection-hook.d.ts.map +0 -1
- package/dist/hooks/learned-skills/detection-hook.js +0 -83
- package/dist/hooks/learned-skills/detection-hook.js.map +0 -1
- package/dist/hooks/learned-skills/detector.d.ts +0 -30
- package/dist/hooks/learned-skills/detector.d.ts.map +0 -1
- package/dist/hooks/learned-skills/detector.js +0 -150
- package/dist/hooks/learned-skills/detector.js.map +0 -1
- package/dist/hooks/learned-skills/finder.d.ts +0 -21
- package/dist/hooks/learned-skills/finder.d.ts.map +0 -1
- package/dist/hooks/learned-skills/finder.js +0 -117
- package/dist/hooks/learned-skills/finder.js.map +0 -1
- package/dist/hooks/learned-skills/index.d.ts +0 -62
- package/dist/hooks/learned-skills/index.d.ts.map +0 -1
- package/dist/hooks/learned-skills/index.js +0 -137
- package/dist/hooks/learned-skills/index.js.map +0 -1
- package/dist/hooks/learned-skills/loader.d.ts +0 -20
- package/dist/hooks/learned-skills/loader.d.ts.map +0 -1
- package/dist/hooks/learned-skills/loader.js +0 -107
- package/dist/hooks/learned-skills/loader.js.map +0 -1
- package/dist/hooks/learned-skills/parser.d.ts +0 -21
- package/dist/hooks/learned-skills/parser.d.ts.map +0 -1
- package/dist/hooks/learned-skills/parser.js +0 -190
- package/dist/hooks/learned-skills/parser.js.map +0 -1
- package/dist/hooks/learned-skills/promotion.d.ts +0 -29
- package/dist/hooks/learned-skills/promotion.d.ts.map +0 -1
- package/dist/hooks/learned-skills/promotion.js +0 -87
- package/dist/hooks/learned-skills/promotion.js.map +0 -1
- package/dist/hooks/learned-skills/types.d.ts +0 -109
- package/dist/hooks/learned-skills/types.d.ts.map +0 -1
- package/dist/hooks/learned-skills/types.js +0 -8
- package/dist/hooks/learned-skills/types.js.map +0 -1
- package/dist/hooks/learned-skills/validator.d.ts +0 -15
- package/dist/hooks/learned-skills/validator.d.ts.map +0 -1
- package/dist/hooks/learned-skills/validator.js +0 -87
- package/dist/hooks/learned-skills/validator.js.map +0 -1
- package/dist/hooks/learned-skills/writer.d.ts +0 -27
- package/dist/hooks/learned-skills/writer.d.ts.map +0 -1
- package/dist/hooks/learned-skills/writer.js +0 -126
- package/dist/hooks/learned-skills/writer.js.map +0 -1
- package/dist/hooks/mnemosyne/config.d.ts +0 -53
- package/dist/hooks/mnemosyne/config.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/config.js +0 -103
- package/dist/hooks/mnemosyne/config.js.map +0 -1
- package/dist/hooks/mnemosyne/constants.d.ts +0 -24
- package/dist/hooks/mnemosyne/constants.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/constants.js +0 -26
- package/dist/hooks/mnemosyne/constants.js.map +0 -1
- package/dist/hooks/mnemosyne/detection-hook.d.ts +0 -39
- package/dist/hooks/mnemosyne/detection-hook.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/detection-hook.js +0 -83
- package/dist/hooks/mnemosyne/detection-hook.js.map +0 -1
- package/dist/hooks/mnemosyne/detector.d.ts +0 -30
- package/dist/hooks/mnemosyne/detector.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/detector.js +0 -150
- package/dist/hooks/mnemosyne/detector.js.map +0 -1
- package/dist/hooks/mnemosyne/finder.d.ts +0 -21
- package/dist/hooks/mnemosyne/finder.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/finder.js +0 -117
- package/dist/hooks/mnemosyne/finder.js.map +0 -1
- package/dist/hooks/mnemosyne/index.d.ts +0 -62
- package/dist/hooks/mnemosyne/index.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/index.js +0 -137
- package/dist/hooks/mnemosyne/index.js.map +0 -1
- package/dist/hooks/mnemosyne/loader.d.ts +0 -20
- package/dist/hooks/mnemosyne/loader.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/loader.js +0 -113
- package/dist/hooks/mnemosyne/loader.js.map +0 -1
- package/dist/hooks/mnemosyne/parser.d.ts +0 -21
- package/dist/hooks/mnemosyne/parser.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/parser.js +0 -190
- package/dist/hooks/mnemosyne/parser.js.map +0 -1
- package/dist/hooks/mnemosyne/promotion.d.ts +0 -29
- package/dist/hooks/mnemosyne/promotion.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/promotion.js +0 -87
- package/dist/hooks/mnemosyne/promotion.js.map +0 -1
- package/dist/hooks/mnemosyne/types.d.ts +0 -109
- package/dist/hooks/mnemosyne/types.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/types.js +0 -8
- package/dist/hooks/mnemosyne/types.js.map +0 -1
- package/dist/hooks/mnemosyne/validator.d.ts +0 -15
- package/dist/hooks/mnemosyne/validator.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/validator.js +0 -87
- package/dist/hooks/mnemosyne/validator.js.map +0 -1
- package/dist/hooks/mnemosyne/writer.d.ts +0 -27
- package/dist/hooks/mnemosyne/writer.d.ts.map +0 -1
- package/dist/hooks/mnemosyne/writer.js +0 -126
- package/dist/hooks/mnemosyne/writer.js.map +0 -1
- package/dist/hooks/ralph-loop/index.d.ts +0 -116
- package/dist/hooks/ralph-loop/index.d.ts.map +0 -1
- package/dist/hooks/ralph-loop/index.js +0 -322
- package/dist/hooks/ralph-loop/index.js.map +0 -1
- package/dist/hooks/ralph-prd/index.d.ts +0 -130
- package/dist/hooks/ralph-prd/index.d.ts.map +0 -1
- package/dist/hooks/ralph-prd/index.js +0 -310
- package/dist/hooks/ralph-prd/index.js.map +0 -1
- package/dist/hooks/ralph-progress/index.d.ts +0 -102
- package/dist/hooks/ralph-progress/index.d.ts.map +0 -1
- package/dist/hooks/ralph-progress/index.js +0 -408
- package/dist/hooks/ralph-progress/index.js.map +0 -1
- package/dist/hooks/ralph-verifier/index.d.ts +0 -72
- package/dist/hooks/ralph-verifier/index.d.ts.map +0 -1
- package/dist/hooks/ralph-verifier/index.js +0 -223
- package/dist/hooks/ralph-verifier/index.js.map +0 -1
- package/dist/hooks/session-recovery/constants.d.ts +0 -56
- package/dist/hooks/session-recovery/constants.d.ts.map +0 -1
- package/dist/hooks/session-recovery/constants.js +0 -78
- package/dist/hooks/session-recovery/constants.js.map +0 -1
- package/dist/hooks/session-recovery/index.d.ts +0 -53
- package/dist/hooks/session-recovery/index.d.ts.map +0 -1
- package/dist/hooks/session-recovery/index.js +0 -321
- package/dist/hooks/session-recovery/index.js.map +0 -1
- package/dist/hooks/session-recovery/storage.d.ts +0 -76
- package/dist/hooks/session-recovery/storage.d.ts.map +0 -1
- package/dist/hooks/session-recovery/storage.js +0 -383
- package/dist/hooks/session-recovery/storage.js.map +0 -1
- package/dist/hooks/session-recovery/types.d.ts +0 -145
- package/dist/hooks/session-recovery/types.d.ts.map +0 -1
- package/dist/hooks/session-recovery/types.js +0 -8
- package/dist/hooks/session-recovery/types.js.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +0 -23
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/constants.js +0 -142
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +0 -113
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +0 -1
- package/dist/hooks/sisyphus-orchestrator/index.js +0 -309
- package/dist/hooks/sisyphus-orchestrator/index.js.map +0 -1
- package/dist/hooks/ultraqa-loop/index.d.ts +0 -94
- package/dist/hooks/ultraqa-loop/index.d.ts.map +0 -1
- package/dist/hooks/ultraqa-loop/index.js +0 -216
- package/dist/hooks/ultraqa-loop/index.js.map +0 -1
- package/dist/hooks/ultrawork-state/index.d.ts +0 -62
- package/dist/hooks/ultrawork-state/index.d.ts.map +0 -1
- package/dist/hooks/ultrawork-state/index.js +0 -208
- package/dist/hooks/ultrawork-state/index.js.map +0 -1
- package/dist/hud/sisyphus-state.d.ts +0 -31
- package/dist/hud/sisyphus-state.d.ts.map +0 -1
- package/dist/hud/sisyphus-state.js +0 -163
- package/dist/hud/sisyphus-state.js.map +0 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission Adapter for External Tools
|
|
3
|
+
*
|
|
4
|
+
* Integrates external plugins and MCP tools with OMC's permission system.
|
|
5
|
+
* Provides:
|
|
6
|
+
* - Safe command pattern registration from plugins
|
|
7
|
+
* - Permission inheritance for known-safe tools
|
|
8
|
+
* - Delegation-aware routing to avoid conflicts
|
|
9
|
+
*/
|
|
10
|
+
import safeRegex from 'safe-regex';
|
|
11
|
+
import { getRegistry } from './registry.js';
|
|
12
|
+
/**
|
|
13
|
+
* Built-in safe patterns for known external tools
|
|
14
|
+
*/
|
|
15
|
+
const BUILTIN_SAFE_PATTERNS = [
|
|
16
|
+
// Context7 MCP - documentation lookup (read-only)
|
|
17
|
+
{
|
|
18
|
+
tool: 'mcp__context7__resolve-library-id',
|
|
19
|
+
pattern: /.*/,
|
|
20
|
+
description: 'Context7 library resolution (read-only)',
|
|
21
|
+
source: 'builtin',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
tool: 'mcp__context7__query-docs',
|
|
25
|
+
pattern: /.*/,
|
|
26
|
+
description: 'Context7 documentation query (read-only)',
|
|
27
|
+
source: 'builtin',
|
|
28
|
+
},
|
|
29
|
+
// Filesystem MCP - read operations only
|
|
30
|
+
{
|
|
31
|
+
tool: 'mcp__filesystem__read_file',
|
|
32
|
+
pattern: /.*/,
|
|
33
|
+
description: 'Filesystem read (read-only)',
|
|
34
|
+
source: 'builtin',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
tool: 'mcp__filesystem__read_text_file',
|
|
38
|
+
pattern: /.*/,
|
|
39
|
+
description: 'Filesystem text read (read-only)',
|
|
40
|
+
source: 'builtin',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
tool: 'mcp__filesystem__list_directory',
|
|
44
|
+
pattern: /.*/,
|
|
45
|
+
description: 'Directory listing (read-only)',
|
|
46
|
+
source: 'builtin',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
tool: 'mcp__filesystem__search_files',
|
|
50
|
+
pattern: /.*/,
|
|
51
|
+
description: 'File search (read-only)',
|
|
52
|
+
source: 'builtin',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
tool: 'mcp__filesystem__get_file_info',
|
|
56
|
+
pattern: /.*/,
|
|
57
|
+
description: 'File info (read-only)',
|
|
58
|
+
source: 'builtin',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
tool: 'mcp__filesystem__directory_tree',
|
|
62
|
+
pattern: /.*/,
|
|
63
|
+
description: 'Directory tree (read-only)',
|
|
64
|
+
source: 'builtin',
|
|
65
|
+
},
|
|
66
|
+
// Exa MCP - web search (read-only, external)
|
|
67
|
+
{
|
|
68
|
+
tool: 'mcp__exa__search',
|
|
69
|
+
pattern: /.*/,
|
|
70
|
+
description: 'Exa web search (read-only)',
|
|
71
|
+
source: 'builtin',
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* Patterns that require explicit permission
|
|
76
|
+
*/
|
|
77
|
+
const REQUIRES_PERMISSION_PATTERNS = [
|
|
78
|
+
// Filesystem write operations
|
|
79
|
+
/mcp__filesystem__write/,
|
|
80
|
+
/mcp__filesystem__edit/,
|
|
81
|
+
/mcp__filesystem__create/,
|
|
82
|
+
/mcp__filesystem__move/,
|
|
83
|
+
/mcp__filesystem__delete/,
|
|
84
|
+
// Playwright browser operations (can interact with external sites)
|
|
85
|
+
/mcp__playwright/,
|
|
86
|
+
// Any bash/command execution
|
|
87
|
+
/bash/i,
|
|
88
|
+
/exec/i,
|
|
89
|
+
/run/i,
|
|
90
|
+
/command/i,
|
|
91
|
+
];
|
|
92
|
+
/**
|
|
93
|
+
* Registry of safe patterns (including plugin-contributed ones)
|
|
94
|
+
*/
|
|
95
|
+
const safePatterns = [...BUILTIN_SAFE_PATTERNS];
|
|
96
|
+
/**
|
|
97
|
+
* Cache of permission decisions
|
|
98
|
+
*/
|
|
99
|
+
const permissionCache = new Map();
|
|
100
|
+
/**
|
|
101
|
+
* Security Error for permission adapter operations
|
|
102
|
+
*/
|
|
103
|
+
export class PermissionSecurityError extends Error {
|
|
104
|
+
constructor(message) {
|
|
105
|
+
super(message);
|
|
106
|
+
this.name = 'PermissionSecurityError';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validate a regex pattern for ReDoS safety
|
|
111
|
+
* @returns true if the pattern is safe, false if it could cause ReDoS
|
|
112
|
+
*/
|
|
113
|
+
function isRegexSafe(pattern) {
|
|
114
|
+
try {
|
|
115
|
+
// First check if it's valid regex
|
|
116
|
+
new RegExp(pattern);
|
|
117
|
+
// Then check if it's safe from ReDoS
|
|
118
|
+
return safeRegex(pattern);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Register safe patterns from a plugin
|
|
126
|
+
*/
|
|
127
|
+
export function registerPluginSafePatterns(plugin) {
|
|
128
|
+
if (!plugin.manifest.permissions)
|
|
129
|
+
return;
|
|
130
|
+
for (const permission of plugin.manifest.permissions) {
|
|
131
|
+
if (permission.scope === 'read' && permission.patterns) {
|
|
132
|
+
for (const pattern of permission.patterns) {
|
|
133
|
+
// SECURITY: Validate regex pattern before creating RegExp
|
|
134
|
+
if (!isRegexSafe(pattern)) {
|
|
135
|
+
console.warn(`[Security] Skipping unsafe regex pattern from plugin ${plugin.name}: ${pattern}`);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
safePatterns.push({
|
|
139
|
+
tool: permission.tool,
|
|
140
|
+
pattern: new RegExp(pattern),
|
|
141
|
+
description: permission.reason || `Safe pattern from ${plugin.name}`,
|
|
142
|
+
source: plugin.name,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Check if a tool/action is allowed without prompting user
|
|
150
|
+
*/
|
|
151
|
+
export function checkPermission(toolName, input) {
|
|
152
|
+
// Check cache first
|
|
153
|
+
const cacheKey = `${toolName}:${JSON.stringify(input)}`;
|
|
154
|
+
const cached = permissionCache.get(cacheKey);
|
|
155
|
+
if (cached) {
|
|
156
|
+
return cached;
|
|
157
|
+
}
|
|
158
|
+
// Check if tool matches safe patterns
|
|
159
|
+
for (const pattern of safePatterns) {
|
|
160
|
+
if (toolName === pattern.tool || toolName.includes(pattern.tool)) {
|
|
161
|
+
const result = {
|
|
162
|
+
allowed: true,
|
|
163
|
+
reason: pattern.description,
|
|
164
|
+
};
|
|
165
|
+
permissionCache.set(cacheKey, result);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Check if tool requires explicit permission
|
|
170
|
+
for (const pattern of REQUIRES_PERMISSION_PATTERNS) {
|
|
171
|
+
if (pattern.test(toolName)) {
|
|
172
|
+
const result = {
|
|
173
|
+
allowed: false,
|
|
174
|
+
reason: `Tool ${toolName} requires explicit permission`,
|
|
175
|
+
askUser: true,
|
|
176
|
+
};
|
|
177
|
+
permissionCache.set(cacheKey, result);
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Check tool capabilities from registry
|
|
182
|
+
const registry = getRegistry();
|
|
183
|
+
const tool = registry.getTool(toolName);
|
|
184
|
+
if (tool) {
|
|
185
|
+
// Read-only and search tools are generally safe
|
|
186
|
+
const safeCapabilities = ['read', 'search', 'analyze'];
|
|
187
|
+
const isSafe = tool.capabilities?.every(c => safeCapabilities.includes(c)) ?? false;
|
|
188
|
+
if (isSafe) {
|
|
189
|
+
const result = {
|
|
190
|
+
allowed: true,
|
|
191
|
+
reason: `Tool ${toolName} has safe capabilities: ${tool.capabilities?.join(', ')}`,
|
|
192
|
+
};
|
|
193
|
+
permissionCache.set(cacheKey, result);
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
// Has dangerous capabilities
|
|
197
|
+
const result = {
|
|
198
|
+
allowed: false,
|
|
199
|
+
reason: `Tool ${toolName} has capabilities requiring permission: ${tool.capabilities?.join(', ')}`,
|
|
200
|
+
askUser: true,
|
|
201
|
+
};
|
|
202
|
+
permissionCache.set(cacheKey, result);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
// Unknown tool - ask user
|
|
206
|
+
return {
|
|
207
|
+
allowed: false,
|
|
208
|
+
reason: `Unknown tool: ${toolName}`,
|
|
209
|
+
askUser: true,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Grant permission for a tool (cache the decision)
|
|
214
|
+
*/
|
|
215
|
+
export function grantPermission(toolName, input) {
|
|
216
|
+
const cacheKey = `${toolName}:${JSON.stringify(input)}`;
|
|
217
|
+
permissionCache.set(cacheKey, {
|
|
218
|
+
allowed: true,
|
|
219
|
+
reason: 'User granted permission',
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Deny permission for a tool (cache the decision)
|
|
224
|
+
*/
|
|
225
|
+
export function denyPermission(toolName, input) {
|
|
226
|
+
const cacheKey = `${toolName}:${JSON.stringify(input)}`;
|
|
227
|
+
permissionCache.set(cacheKey, {
|
|
228
|
+
allowed: false,
|
|
229
|
+
reason: 'User denied permission',
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Clear permission cache
|
|
234
|
+
*/
|
|
235
|
+
export function clearPermissionCache() {
|
|
236
|
+
permissionCache.clear();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Get all registered safe patterns
|
|
240
|
+
*/
|
|
241
|
+
export function getSafePatterns() {
|
|
242
|
+
return [...safePatterns];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Add a custom safe pattern
|
|
246
|
+
*/
|
|
247
|
+
export function addSafePattern(pattern) {
|
|
248
|
+
safePatterns.push(pattern);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Remove safe patterns from a specific source
|
|
252
|
+
*/
|
|
253
|
+
export function removeSafePatternsFromSource(source) {
|
|
254
|
+
const toRemove = safePatterns.filter(p => p.source === source);
|
|
255
|
+
for (const pattern of toRemove) {
|
|
256
|
+
const index = safePatterns.indexOf(pattern);
|
|
257
|
+
if (index >= 0) {
|
|
258
|
+
safePatterns.splice(index, 1);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Check if tool should be delegated (not handled directly by OMC)
|
|
264
|
+
*/
|
|
265
|
+
export function shouldDelegate(toolName) {
|
|
266
|
+
const registry = getRegistry();
|
|
267
|
+
const tool = registry.getTool(toolName);
|
|
268
|
+
if (!tool) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
// External plugins should handle their own tools
|
|
272
|
+
if (tool.type === 'plugin') {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
// MCP tools are handled by MCP bridge
|
|
276
|
+
if (tool.type === 'mcp') {
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
// Skills and agents from external plugins
|
|
280
|
+
if ((tool.type === 'skill' || tool.type === 'agent') && tool.source !== 'oh-my-claudecode') {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get delegation target for a tool
|
|
287
|
+
*/
|
|
288
|
+
export function getDelegationTarget(toolName) {
|
|
289
|
+
const registry = getRegistry();
|
|
290
|
+
const tool = registry.getTool(toolName);
|
|
291
|
+
if (!tool) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
if (tool.type === 'plugin' || tool.type === 'skill' || tool.type === 'agent') {
|
|
295
|
+
return {
|
|
296
|
+
type: 'plugin',
|
|
297
|
+
target: tool.source,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
if (tool.type === 'mcp') {
|
|
301
|
+
return {
|
|
302
|
+
type: 'mcp',
|
|
303
|
+
target: tool.source,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
type: 'internal',
|
|
308
|
+
target: 'oh-my-claudecode',
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Integrate permission adapter with OMC's permission system
|
|
313
|
+
* Call this during initialization to register patterns from discovered plugins
|
|
314
|
+
*/
|
|
315
|
+
export function integrateWithPermissionSystem() {
|
|
316
|
+
const registry = getRegistry();
|
|
317
|
+
// Register safe patterns from all discovered plugins
|
|
318
|
+
for (const plugin of registry.getAllPlugins()) {
|
|
319
|
+
registerPluginSafePatterns(plugin);
|
|
320
|
+
}
|
|
321
|
+
// Register MCP tools as safe if they're read-only
|
|
322
|
+
for (const server of registry.getAllMcpServers()) {
|
|
323
|
+
for (const tool of server.tools) {
|
|
324
|
+
if (tool.capabilities?.every(c => c === 'read' || c === 'search')) {
|
|
325
|
+
safePatterns.push({
|
|
326
|
+
tool: tool.name,
|
|
327
|
+
pattern: /.*/,
|
|
328
|
+
description: `Read-only MCP tool from ${server.name}`,
|
|
329
|
+
source: server.name,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Process a permission request from hook system
|
|
337
|
+
* Returns hook-compatible output
|
|
338
|
+
*/
|
|
339
|
+
export function processExternalToolPermission(toolName, toolInput) {
|
|
340
|
+
const result = checkPermission(toolName, toolInput);
|
|
341
|
+
if (result.allowed) {
|
|
342
|
+
return {
|
|
343
|
+
continue: true,
|
|
344
|
+
hookSpecificOutput: {
|
|
345
|
+
hookEventName: 'PermissionRequest',
|
|
346
|
+
decision: {
|
|
347
|
+
behavior: 'allow',
|
|
348
|
+
reason: result.reason,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
if (result.askUser) {
|
|
354
|
+
return {
|
|
355
|
+
continue: true, // Let normal permission flow handle it
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
continue: true,
|
|
360
|
+
hookSpecificOutput: {
|
|
361
|
+
hookEventName: 'PermissionRequest',
|
|
362
|
+
decision: {
|
|
363
|
+
behavior: 'deny',
|
|
364
|
+
reason: result.reason,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=permission-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-adapter.js","sourceRoot":"","sources":["../../src/compatibility/permission-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AAQnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,qBAAqB,GAAyB;IAClD,kDAAkD;IAClD;QACE,IAAI,EAAE,mCAAmC;QACzC,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,yCAAyC;QACtD,MAAM,EAAE,SAAS;KAClB;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,0CAA0C;QACvD,MAAM,EAAE,SAAS;KAClB;IACD,wCAAwC;IACxC;QACE,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,6BAA6B;QAC1C,MAAM,EAAE,SAAS;KAClB;IACD;QACE,IAAI,EAAE,iCAAiC;QACvC,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,kCAAkC;QAC/C,MAAM,EAAE,SAAS;KAClB;IACD;QACE,IAAI,EAAE,iCA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ClE,YAAY,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,IAAI;oBACb,WAAW,EAAE,2BAA2B,MAAM,CAAC,IAAI,EAAE;oBACrD,MAAM,EAAE,MAAM,CAAC,IAAI;iBACpB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAAgB,EAChB,SAAmC;IAWnC,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEpD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,kBAAkB,EAAE;gBAClB,aAAa,EAAE,mBAAmB;gBAClC,QAAQ,EAAE;oBACR,QAAQ,EAAE,OAAO;oBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;aACF;SACF,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO;YACL,QAAQ,EAAE,IAAI,EAAE,uCAAuC;SACxD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,kBAAkB,EAAE;YAClB,aAAa,EAAE,mBAAmB;YAClC,QAAQ,EAAE;gBACR,QAAQ,EAAE,MAAM;gBAChB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry and Router
|
|
3
|
+
*
|
|
4
|
+
* Central registry for all external tools, plugins, and MCP servers.
|
|
5
|
+
* Handles tool registration, conflict resolution, and command routing.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExternalTool, DiscoveredPlugin, DiscoveredMcpServer, ToolRoute, ToolConflict, RegistryState, RegistryEventListener, DiscoveryOptions } from './types.js';
|
|
8
|
+
import { type DiscoveryResult } from './discovery.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tool Registry - Central hub for all external tools
|
|
11
|
+
*/
|
|
12
|
+
export declare class ToolRegistry {
|
|
13
|
+
private plugins;
|
|
14
|
+
private mcpServers;
|
|
15
|
+
private tools;
|
|
16
|
+
private conflicts;
|
|
17
|
+
private listeners;
|
|
18
|
+
private lastDiscovery;
|
|
19
|
+
private discoveryCache;
|
|
20
|
+
/**
|
|
21
|
+
* Get the singleton registry instance
|
|
22
|
+
*/
|
|
23
|
+
static getInstance(): ToolRegistry;
|
|
24
|
+
/**
|
|
25
|
+
* Reset the registry (for testing)
|
|
26
|
+
*/
|
|
27
|
+
static resetInstance(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Initialize the registry by discovering all external resources
|
|
30
|
+
*/
|
|
31
|
+
initialize(options?: DiscoveryOptions): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Register a discovered plugin
|
|
34
|
+
*/
|
|
35
|
+
registerPlugin(plugin: DiscoveredPlugin): void;
|
|
36
|
+
/**
|
|
37
|
+
* Register a discovered MCP server
|
|
38
|
+
*/
|
|
39
|
+
registerMcpServer(server: DiscoveredMcpServer): void;
|
|
40
|
+
/**
|
|
41
|
+
* Register a single tool
|
|
42
|
+
*/
|
|
43
|
+
registerTool(tool: ExternalTool): void;
|
|
44
|
+
/**
|
|
45
|
+
* Handle tool name conflict
|
|
46
|
+
*/
|
|
47
|
+
private handleConflict;
|
|
48
|
+
/**
|
|
49
|
+
* Get a tool by name (supports both namespaced and short names)
|
|
50
|
+
*/
|
|
51
|
+
getTool(name: string): ExternalTool | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Get all tools from a specific source
|
|
54
|
+
*/
|
|
55
|
+
getToolsBySource(source: string): ExternalTool[];
|
|
56
|
+
/**
|
|
57
|
+
* Get all tools of a specific type
|
|
58
|
+
*/
|
|
59
|
+
getToolsByType(type: ExternalTool['type']): ExternalTool[];
|
|
60
|
+
/**
|
|
61
|
+
* Get all registered tools
|
|
62
|
+
*/
|
|
63
|
+
getAllTools(): ExternalTool[];
|
|
64
|
+
/**
|
|
65
|
+
* Get all registered plugins
|
|
66
|
+
*/
|
|
67
|
+
getAllPlugins(): DiscoveredPlugin[];
|
|
68
|
+
/**
|
|
69
|
+
* Get all registered MCP servers
|
|
70
|
+
*/
|
|
71
|
+
getAllMcpServers(): DiscoveredMcpServer[];
|
|
72
|
+
/**
|
|
73
|
+
* Get all conflicts
|
|
74
|
+
*/
|
|
75
|
+
getConflicts(): ToolConflict[];
|
|
76
|
+
/**
|
|
77
|
+
* Route a command to the appropriate tool handler
|
|
78
|
+
*/
|
|
79
|
+
route(command: string): ToolRoute | null;
|
|
80
|
+
/**
|
|
81
|
+
* Enable or disable a tool
|
|
82
|
+
*/
|
|
83
|
+
setToolEnabled(name: string, enabled: boolean): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Check if a tool is enabled
|
|
86
|
+
*/
|
|
87
|
+
isToolEnabled(name: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Get plugin by name
|
|
90
|
+
*/
|
|
91
|
+
getPlugin(name: string): DiscoveredPlugin | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Get MCP server by name
|
|
94
|
+
*/
|
|
95
|
+
getMcpServer(name: string): DiscoveredMcpServer | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Update MCP server connection status and tools
|
|
98
|
+
*/
|
|
99
|
+
updateMcpServer(name: string, updates: Partial<Pick<DiscoveredMcpServer, 'connected' | 'tools' | 'error'>>): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get current registry state snapshot
|
|
102
|
+
*/
|
|
103
|
+
getState(): RegistryState;
|
|
104
|
+
/**
|
|
105
|
+
* Search tools by keyword
|
|
106
|
+
*/
|
|
107
|
+
searchTools(query: string): ExternalTool[];
|
|
108
|
+
/**
|
|
109
|
+
* Add event listener
|
|
110
|
+
*/
|
|
111
|
+
addEventListener(listener: RegistryEventListener): void;
|
|
112
|
+
/**
|
|
113
|
+
* Remove event listener
|
|
114
|
+
*/
|
|
115
|
+
removeEventListener(listener: RegistryEventListener): void;
|
|
116
|
+
/**
|
|
117
|
+
* Emit event to all listeners
|
|
118
|
+
*/
|
|
119
|
+
private emit;
|
|
120
|
+
/**
|
|
121
|
+
* Clear all registered resources
|
|
122
|
+
*/
|
|
123
|
+
clear(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Re-run discovery and update registry
|
|
126
|
+
*/
|
|
127
|
+
refresh(options?: DiscoveryOptions): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Get discovery cache if available
|
|
130
|
+
*/
|
|
131
|
+
getDiscoveryCache(): DiscoveryResult | null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the global registry instance
|
|
135
|
+
*/
|
|
136
|
+
export declare function getRegistry(): ToolRegistry;
|
|
137
|
+
/**
|
|
138
|
+
* Initialize the global registry
|
|
139
|
+
*/
|
|
140
|
+
export declare function initializeRegistry(options?: DiscoveryOptions): Promise<ToolRegistry>;
|
|
141
|
+
/**
|
|
142
|
+
* Quick access to route a command
|
|
143
|
+
*/
|
|
144
|
+
export declare function routeCommand(command: string): ToolRoute | null;
|
|
145
|
+
/**
|
|
146
|
+
* Quick access to get a tool
|
|
147
|
+
*/
|
|
148
|
+
export declare function getExternalTool(name: string): ExternalTool | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* List all available external tools
|
|
151
|
+
*/
|
|
152
|
+
export declare function listExternalTools(): ExternalTool[];
|
|
153
|
+
/**
|
|
154
|
+
* Check if any external plugins are installed
|
|
155
|
+
*/
|
|
156
|
+
export declare function hasExternalPlugins(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Check if any MCP servers are configured
|
|
159
|
+
*/
|
|
160
|
+
export declare function hasMcpServers(): boolean;
|
|
161
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":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