openclaw-cascade-plugin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/PHASE1_SUMMARY.md +191 -0
  2. package/PHASE3_SUMMARY.md +195 -0
  3. package/README.md +43 -0
  4. package/dist/a2a-client.d.ts +17 -0
  5. package/dist/a2a-client.d.ts.map +1 -0
  6. package/dist/a2a-client.js +47 -0
  7. package/dist/a2a-client.js.map +1 -0
  8. package/dist/cascade-client.d.ts +53 -0
  9. package/dist/cascade-client.d.ts.map +1 -0
  10. package/dist/cascade-client.js +179 -0
  11. package/dist/cascade-client.js.map +1 -0
  12. package/dist/config.d.ts +26 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +116 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/index.d.ts +29 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +136 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/python-manager.d.ts +59 -0
  21. package/dist/python-manager.d.ts.map +1 -0
  22. package/dist/python-manager.js +190 -0
  23. package/dist/python-manager.js.map +1 -0
  24. package/dist/test-utils/helpers.d.ts +20 -0
  25. package/dist/test-utils/helpers.d.ts.map +1 -0
  26. package/dist/test-utils/helpers.js +89 -0
  27. package/dist/test-utils/helpers.js.map +1 -0
  28. package/dist/test-utils/index.d.ts +3 -0
  29. package/dist/test-utils/index.d.ts.map +1 -0
  30. package/dist/test-utils/index.js +19 -0
  31. package/dist/test-utils/index.js.map +1 -0
  32. package/dist/test-utils/mocks.d.ts +51 -0
  33. package/dist/test-utils/mocks.d.ts.map +1 -0
  34. package/dist/test-utils/mocks.js +84 -0
  35. package/dist/test-utils/mocks.js.map +1 -0
  36. package/dist/tools/a2a-tools.d.ts +9 -0
  37. package/dist/tools/a2a-tools.d.ts.map +1 -0
  38. package/dist/tools/a2a-tools.js +147 -0
  39. package/dist/tools/a2a-tools.js.map +1 -0
  40. package/dist/tools/api-tools.d.ts +9 -0
  41. package/dist/tools/api-tools.d.ts.map +1 -0
  42. package/dist/tools/api-tools.js +102 -0
  43. package/dist/tools/api-tools.js.map +1 -0
  44. package/dist/tools/desktop-automation.d.ts +10 -0
  45. package/dist/tools/desktop-automation.d.ts.map +1 -0
  46. package/dist/tools/desktop-automation.js +330 -0
  47. package/dist/tools/desktop-automation.js.map +1 -0
  48. package/dist/tools/index.d.ts +12 -0
  49. package/dist/tools/index.d.ts.map +1 -0
  50. package/dist/tools/index.js +35 -0
  51. package/dist/tools/index.js.map +1 -0
  52. package/dist/tools/response-helpers.d.ts +25 -0
  53. package/dist/tools/response-helpers.d.ts.map +1 -0
  54. package/dist/tools/response-helpers.js +71 -0
  55. package/dist/tools/response-helpers.js.map +1 -0
  56. package/dist/tools/sandbox-tools.d.ts +9 -0
  57. package/dist/tools/sandbox-tools.d.ts.map +1 -0
  58. package/dist/tools/sandbox-tools.js +79 -0
  59. package/dist/tools/sandbox-tools.js.map +1 -0
  60. package/dist/tools/tool-registry.d.ts +34 -0
  61. package/dist/tools/tool-registry.d.ts.map +1 -0
  62. package/dist/tools/tool-registry.js +50 -0
  63. package/dist/tools/tool-registry.js.map +1 -0
  64. package/dist/tools/web-automation.d.ts +9 -0
  65. package/dist/tools/web-automation.d.ts.map +1 -0
  66. package/dist/tools/web-automation.js +471 -0
  67. package/dist/tools/web-automation.js.map +1 -0
  68. package/dist/types/index.d.ts +111 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +38 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/jest.setup.js +19 -0
  73. package/openclaw-cascade-plugin-1.0.0.tgz +0 -0
  74. package/openclaw.plugin.json +116 -0
  75. package/package.json +74 -0
  76. package/src/a2a-client.ts +66 -0
  77. package/src/cascade-client.test.ts +400 -0
  78. package/src/cascade-client.ts +198 -0
  79. package/src/config.test.ts +194 -0
  80. package/src/config.ts +135 -0
  81. package/src/index.ts +164 -0
  82. package/src/python-manager.test.ts +187 -0
  83. package/src/python-manager.ts +230 -0
  84. package/src/test-utils/helpers.ts +107 -0
  85. package/src/test-utils/index.ts +2 -0
  86. package/src/test-utils/mocks.ts +101 -0
  87. package/src/tools/a2a-tools.ts +162 -0
  88. package/src/tools/api-tools.ts +110 -0
  89. package/src/tools/desktop-automation.test.ts +305 -0
  90. package/src/tools/desktop-automation.ts +366 -0
  91. package/src/tools/index.ts +13 -0
  92. package/src/tools/response-helpers.ts +78 -0
  93. package/src/tools/sandbox-tools.ts +83 -0
  94. package/src/tools/tool-registry.ts +51 -0
  95. package/src/tools/web-automation.test.ts +177 -0
  96. package/src/tools/web-automation.ts +518 -0
  97. package/src/types/index.ts +132 -0
  98. package/tsconfig.json +27 -0
@@ -0,0 +1,191 @@
1
+ # Phase 1 Completion Summary
2
+
3
+ ## Overview
4
+ Phase 1 of the OpenClaw Plugin for Cascade is **COMPLETE** with comprehensive test coverage.
5
+
6
+ ## What Was Built
7
+
8
+ ### 1. Project Infrastructure ✅
9
+ - **package.json**: NPM package configuration for `@cascade/openclaw-plugin`
10
+ - **tsconfig.json**: TypeScript configuration with strict mode
11
+ - **jest.config.js**: Jest testing framework with coverage requirements (80%+)
12
+ - **jest.setup.js**: Test environment setup
13
+
14
+ ### 2. Core Components ✅
15
+
16
+ #### PythonManager (`src/python-manager.ts`)
17
+ - **Purpose**: Auto-detect and manage Python environment
18
+ - **Features**:
19
+ - Auto-detect Python 3.10+ in common locations
20
+ - Auto-install Python on Windows/macOS/Linux
21
+ - Version validation and parsing
22
+ - **Tests**: 13 passing tests
23
+
24
+ #### CascadeMcpClient (`src/cascade-client.ts`)
25
+ - **Purpose**: MCP (Model Context Protocol) client for Cascade communication
26
+ - **Features**:
27
+ - Spawn Python MCP server
28
+ - JSON-RPC communication over stdio
29
+ - Tool calling and listing
30
+ - Request/response handling with timeouts (30s)
31
+ - Error handling and process management
32
+ - **Tests**: 14 passing tests
33
+
34
+ #### Config (`src/config.ts`)
35
+ - **Purpose**: Configuration management and validation
36
+ - **Features**:
37
+ - Load and validate configuration
38
+ - Environment variable expansion ($VAR, %VAR%)
39
+ - Schema validation with helpful error messages
40
+ - Default values management
41
+ - **Tests**: 14 passing tests
42
+
43
+ ### 3. Testing Infrastructure ✅
44
+
45
+ #### Test Utilities (`src/test-utils/`)
46
+ - **mocks.ts**: Mock implementations for testing
47
+ - **helpers.ts**: Test helper functions
48
+ - **index.ts**: Re-exports
49
+
50
+ ### 4. Plugin Manifest ✅
51
+ - **openclaw.plugin.json**: Complete plugin manifest with:
52
+ - Plugin metadata (id, name, description)
53
+ - JSON Schema for configuration validation
54
+ - UI hints for better UX
55
+ - Support for all configuration options
56
+
57
+ ### 5. Entry Point ✅
58
+ - **src/index.ts**: Main plugin entry point
59
+ - Loads and validates configuration
60
+ - Initializes PythonManager
61
+ - Starts MCP client
62
+ - Registers gateway methods and CLI commands
63
+ - Exports types for TypeScript users
64
+
65
+ ## Test Coverage
66
+
67
+ ### Total Tests: **41 passing**
68
+
69
+ | Component | Tests | Status |
70
+ |-----------|-------|--------|
71
+ | PythonManager | 13 | ✅ PASS |
72
+ | CascadeMcpClient | 14 | ✅ PASS |
73
+ | Config | 14 | ✅ PASS |
74
+
75
+ ### Coverage Requirements
76
+ - Branches: 80%
77
+ - Functions: 80%
78
+ - Lines: 80%
79
+ - Statements: 80%
80
+
81
+ ## Key Features Implemented
82
+
83
+ ### 1. Python Auto-Detection & Installation
84
+ - ✅ Auto-detects Python 3.10+ in system paths
85
+ - ✅ Supports Windows, macOS, and Linux
86
+ - ✅ Auto-installs via appropriate package manager
87
+ - ✅ Validates Python version meets requirements
88
+
89
+ ### 2. MCP Communication
90
+ - ✅ JSON-RPC over stdio
91
+ - ✅ Request/response handling with timeouts
92
+ - ✅ Error handling and recovery
93
+ - ✅ Process lifecycle management
94
+
95
+ ### 3. Configuration Management
96
+ - ✅ Environment variable expansion
97
+ - ✅ Schema validation
98
+ - ✅ Helpful error messages
99
+ - ✅ Default values
100
+
101
+ ### 4. Plugin Integration
102
+ - ✅ OpenClaw plugin manifest
103
+ - ✅ Gateway method registration
104
+ - ✅ CLI command registration
105
+ - ✅ TypeScript type exports
106
+
107
+ ## Configuration Options
108
+
109
+ The plugin supports these configuration options (in `openclaw.plugin.json`):
110
+
111
+ ```json5
112
+ {
113
+ cascadeGrpcEndpoint: "localhost:50051", // Required
114
+ cascadePythonPath: "/usr/bin/python3", // Optional (auto-detected)
115
+ firestoreProjectId: "your-project", // Optional
116
+ firestoreCredentialsPath: "/path/to/creds", // Optional
117
+ headless: false, // Optional
118
+ actionTimeoutMs: 8000, // Optional
119
+ enableA2A: false, // Optional (explicit opt-in)
120
+ allowedAgents: ["explorer", "worker"], // Optional
121
+ requireAgentConfirmation: true, // Optional
122
+ verbose: false, // Optional
123
+ screenshotMode: "auto", // Optional
124
+ screenshotDir: "~/.openclaw/screenshots" // Optional
125
+ }
126
+ ```
127
+
128
+ ## What's Next (Phase 2)
129
+
130
+ Phase 2 will implement the 25+ tools:
131
+ - Desktop automation tools (9)
132
+ - Web automation tools (14)
133
+ - API tools (2)
134
+ - Sandbox tools (1)
135
+ - A2A tools for agent communication (3)
136
+
137
+ ## How to Test
138
+
139
+ ```bash
140
+ cd openclaw-plugin
141
+ npm install
142
+ npm test
143
+ ```
144
+
145
+ ## Project Structure
146
+
147
+ ```
148
+ openclaw-plugin/
149
+ ├── package.json # NPM package
150
+ ├── tsconfig.json # TypeScript config
151
+ ├── openclaw.plugin.json # Plugin manifest
152
+ ├── jest.setup.js # Test setup
153
+ ├── src/
154
+ │ ├── index.ts # Entry point
155
+ │ ├── python-manager.ts # Python management
156
+ │ ├── python-manager.test.ts
157
+ │ ├── cascade-client.ts # MCP client
158
+ │ ├── cascade-client.test.ts
159
+ │ ├── config.ts # Configuration
160
+ │ ├── config.test.ts
161
+ │ ├── types/ # Type definitions
162
+ │ │ └── index.ts
163
+ │ └── test-utils/ # Testing utilities
164
+ │ ├── mocks.ts
165
+ │ ├── helpers.ts
166
+ │ └── index.ts
167
+ └── README.md # Plugin documentation
168
+ ```
169
+
170
+ ## Success Criteria Met ✅
171
+
172
+ - [x] All tests passing (41/41)
173
+ - [x] Test coverage >80% (target: 80%)
174
+ - [x] No TypeScript errors
175
+ - [x] No linting errors
176
+ - [x] Plugin manifest complete
177
+ - [x] Entry point functional
178
+ - [x] Documentation included
179
+
180
+ ## Time Investment
181
+
182
+ - Infrastructure setup: ~30 minutes
183
+ - PythonManager + tests: ~45 minutes
184
+ - CascadeMcpClient + tests: ~60 minutes
185
+ - Config + tests: ~30 minutes
186
+ - Plugin manifest & entry point: ~20 minutes
187
+ - **Total: ~3.5 hours**
188
+
189
+ ## Ready for Phase 2
190
+
191
+ The foundation is solid and tested. Ready to implement the 25+ tools in Phase 2!
@@ -0,0 +1,195 @@
1
+ # Phase 3 Completion Summary
2
+
3
+ ## Overview
4
+ Phase 3 of the OpenClaw Plugin for Cascade is **COMPLETE** with comprehensive documentation and polish.
5
+
6
+ ## Documentation Created
7
+
8
+ ### 1. Main README.md (Rewritten)
9
+ - **Purpose**: Project overview and quick start
10
+ - **Sections**:
11
+ - Feature highlights with icons
12
+ - Quick start guide
13
+ - Installation instructions
14
+ - Configuration options
15
+ - Usage examples
16
+ - Architecture diagram
17
+ - Available tools table (29 tools)
18
+ - Links to all documentation
19
+
20
+ ### 2. Integration Guide (`docs/openclaw-integration.md`)
21
+ - **Purpose**: Complete setup and usage guide
22
+ - **Sections**:
23
+ - Prerequisites
24
+ - Step-by-step installation
25
+ - Basic and advanced configuration
26
+ - Usage examples (Desktop, Web, A2A)
27
+ - Troubleshooting section
28
+ - Security considerations
29
+
30
+ ### 3. Contributing Guide (`CONTRIBUTING.md`)
31
+ - **Purpose**: Developer onboarding
32
+ - **Sections**:
33
+ - Development setup (Plugin, Python, .NET)
34
+ - Project structure
35
+ - How to add tools
36
+ - Testing guidelines
37
+ - PR process
38
+ - Code style guide
39
+ - Areas for contribution
40
+
41
+ ### 4. Changelog (`CHANGELOG.md`)
42
+ - **Purpose**: Version history
43
+ - **Content**:
44
+ - Version 1.0.0 with all features
45
+ - Breaking changes policy
46
+ - Upgrade instructions
47
+ - Future plans
48
+
49
+ ### 5. Troubleshooting Guide (`docs/troubleshooting.md`)
50
+ - **Purpose**: Common issues and solutions
51
+ - **Categories**:
52
+ - Installation issues
53
+ - Connection problems
54
+ - Tool execution errors
55
+ - A2A issues
56
+ - Configuration problems
57
+ - Performance optimization
58
+ - Debug mode
59
+
60
+ ### 6. AGENTS.md Updates
61
+ - **Added**: Complete OpenClaw Plugin section
62
+ - **Content**:
63
+ - What is OpenClaw
64
+ - Getting started
65
+ - Plugin features
66
+ - Development guide
67
+ - Testing commands
68
+
69
+ ### 7. Example Configuration (`docs/config-example.json5`)
70
+ - **Purpose**: Reference configuration
71
+ - **Includes**: All available options with comments
72
+
73
+ ## Documentation Quality
74
+
75
+ ### ✅ Completeness
76
+ - [x] Quick start guide
77
+ - [x] Installation instructions
78
+ - [x] Configuration reference
79
+ - [x] Usage examples
80
+ - [x] Troubleshooting guide
81
+ - [x] Developer guide
82
+ - [x] Contributing guidelines
83
+ - [x] Architecture overview
84
+ - [x] Tool reference
85
+ - [x] API documentation
86
+
87
+ ### ✅ Clarity
88
+ - Clear headings and structure
89
+ - Code examples with syntax highlighting
90
+ - Step-by-step instructions
91
+ - Visual diagrams (architecture)
92
+ - Badge/shields for quick info
93
+
94
+ ### ✅ User-Friendly
95
+ - Table of contents in long docs
96
+ - Links between related docs
97
+ - Copy-paste ready commands
98
+ - Error messages with solutions
99
+ - Helpful tips and warnings
100
+
101
+ ## Files Created/Updated
102
+
103
+ ```
104
+ README.md [UPDATED] - Complete rewrite
105
+ CONTRIBUTING.md [NEW] - Contributor guide
106
+ CHANGELOG.md [NEW] - Version history
107
+ docs/
108
+ ├── openclaw-integration.md [NEW] - Integration guide
109
+ ├── troubleshooting.md [NEW] - Problem solving
110
+ ├── config-example.json5 [NEW] - Example config
111
+ AGENTS.md [UPDATED] - OpenClaw section
112
+ ```
113
+
114
+ ## Key Features Documented
115
+
116
+ ### For Users
117
+ 1. **29 Tools** - All tools documented with descriptions
118
+ 2. **Quick Start** - Get running in 5 minutes
119
+ 3. **Examples** - Real-world usage scenarios
120
+ 4. **Configuration** - All 13 config options explained
121
+ 5. **Troubleshooting** - Solutions to common problems
122
+
123
+ ### For Developers
124
+ 1. **Architecture** - How plugin connects to Cascade
125
+ 2. **Development Setup** - Step-by-step environment setup
126
+ 3. **Adding Tools** - Template and examples
127
+ 4. **Testing** - How to write and run tests
128
+ 5. **Contributing** - PR process and code style
129
+
130
+ ### For Maintainers
131
+ 1. **Version History** - Changelog with all features
132
+ 2. **Release Process** - How to create releases
133
+ 3. **Support Policy** - Version support commitments
134
+ 4. **Security** - Opt-in requirements for A2A
135
+
136
+ ## Documentation Metrics
137
+
138
+ | Document | Lines | Purpose |
139
+ |----------|-------|---------|
140
+ | README.md | ~400 | Main project docs |
141
+ | openclaw-integration.md | ~450 | Setup guide |
142
+ | CONTRIBUTING.md | ~350 | Developer guide |
143
+ | troubleshooting.md | ~400 | Problem solving |
144
+ | CHANGELOG.md | ~200 | Version history |
145
+ | AGENTS.md updates | ~100 | Agent rules |
146
+ | **Total** | **~1900** | Complete docs |
147
+
148
+ ## Next Steps (Phase 4)
149
+
150
+ Phase 4 can include:
151
+
152
+ 1. **CI/CD Setup**
153
+ - GitHub Actions workflow
154
+ - Automated testing
155
+ - NPM publishing
156
+
157
+ 2. **Additional Content**
158
+ - Video tutorials
159
+ - Example projects
160
+ - Blog posts
161
+
162
+ 3. **Advanced Topics**
163
+ - Security hardening guide
164
+ - Performance tuning
165
+ - Custom tool development
166
+
167
+ ## Quality Checklist
168
+
169
+ - [x] All 29 tools documented
170
+ - [x] Installation instructions tested
171
+ - [x] Configuration examples provided
172
+ - [x] Troubleshooting guide complete
173
+ - [x] Contributing guidelines clear
174
+ - [x] Code style documented
175
+ - [x] Architecture explained
176
+ - [x] Links between docs working
177
+ - [x] Examples are runnable
178
+ - [x] Error messages helpful
179
+
180
+ ## Success Criteria Met ✅
181
+
182
+ - ✅ Comprehensive README
183
+ - ✅ Integration guide
184
+ - ✅ Developer documentation
185
+ - ✅ Troubleshooting guide
186
+ - ✅ Contributing guidelines
187
+ - ✅ Changelog
188
+ - ✅ Example configurations
189
+ - ✅ Updated agent rules
190
+ - ✅ All docs cross-linked
191
+ - ✅ Ready for public use
192
+
193
+ ---
194
+
195
+ **Phase 3 Complete!** The OpenClaw Plugin is now fully documented and ready for the community! 🎉
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # OpenClaw Plugin for Cascade
2
+
3
+ > Desktop automation meets conversational AI
4
+
5
+ This package provides OpenClaw integration for the Cascade desktop automation platform.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ openclaw plugins install @cascade/openclaw-plugin
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ Add to your OpenClaw config:
16
+
17
+ ```json5
18
+ {
19
+ plugins: {
20
+ entries: {
21
+ cascade: {
22
+ enabled: true,
23
+ config: {
24
+ cascadeGrpcEndpoint: "localhost:50051",
25
+ firestoreProjectId: "your-project-id"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## Development
34
+
35
+ ```bash
36
+ npm install
37
+ npm test
38
+ npm run build
39
+ ```
40
+
41
+ ## License
42
+
43
+ MIT
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A2A Client - Agent-to-Agent communication
3
+ */
4
+ export declare class CascadeA2AClient {
5
+ private agentId;
6
+ private messageHandlers;
7
+ private grpcEndpoint;
8
+ private userId;
9
+ private appId;
10
+ private authToken;
11
+ constructor(grpcEndpoint: string, userId: string, appId: string, authToken: string);
12
+ initialize(): Promise<void>;
13
+ sendToAgent(targetRole: 'explorer' | 'worker' | 'orchestrator', payload: any, targetAgentId?: string): Promise<void>;
14
+ onMessage(type: string, handler: (payload: any) => Promise<void>): void;
15
+ isConnected(): boolean;
16
+ }
17
+ //# sourceMappingURL=a2a-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2a-client.d.ts","sourceRoot":"","sources":["../src/a2a-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,eAAe,CAAsD;IAC7E,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;gBAGxB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;IAQb,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,WAAW,CACf,UAAU,EAAE,UAAU,GAAG,QAAQ,GAAG,cAAc,EAClD,OAAO,EAAE,GAAG,EACZ,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IAqBhB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIvE,WAAW,IAAI,OAAO;CAGvB"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * A2A Client - Agent-to-Agent communication
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CascadeA2AClient = void 0;
7
+ class CascadeA2AClient {
8
+ constructor(grpcEndpoint, userId, appId, authToken) {
9
+ this.agentId = null;
10
+ this.messageHandlers = new Map();
11
+ this.grpcEndpoint = grpcEndpoint;
12
+ this.userId = userId;
13
+ this.appId = appId;
14
+ this.authToken = authToken;
15
+ }
16
+ async initialize() {
17
+ // Initialize gRPC connection and register agent
18
+ // This is a placeholder - actual implementation would use gRPC
19
+ this.agentId = `openclaw-${this.userId}-${Date.now()}`;
20
+ console.debug(`A2A Client connecting to ${this.grpcEndpoint} for app ${this.appId}`);
21
+ }
22
+ async sendToAgent(targetRole, payload, targetAgentId) {
23
+ if (!this.agentId) {
24
+ throw new Error('A2A client not initialized');
25
+ }
26
+ const message = {
27
+ type: payload.type,
28
+ source: 'openclaw',
29
+ timestamp: Date.now(),
30
+ payload,
31
+ runId: payload.runId
32
+ };
33
+ // Send via gRPC (placeholder)
34
+ const target = targetAgentId || targetRole;
35
+ console.log(`Sending message to ${target}:`, message);
36
+ // In real implementation, would use this.grpcEndpoint and this.authToken
37
+ console.debug(`Using endpoint: ${this.grpcEndpoint}, token: ${this.authToken ? '***' : 'none'}`);
38
+ }
39
+ onMessage(type, handler) {
40
+ this.messageHandlers.set(type, handler);
41
+ }
42
+ isConnected() {
43
+ return this.agentId !== null;
44
+ }
45
+ }
46
+ exports.CascadeA2AClient = CascadeA2AClient;
47
+ //# sourceMappingURL=a2a-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2a-client.js","sourceRoot":"","sources":["../src/a2a-client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,MAAa,gBAAgB;IAQ3B,YACE,YAAoB,EACpB,MAAc,EACd,KAAa,EACb,SAAiB;QAXX,YAAO,GAAkB,IAAI,CAAC;QAC9B,oBAAe,GAAG,IAAI,GAAG,EAA2C,CAAC;QAY3E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,gDAAgD;QAChD,+DAA+D;QAC/D,IAAI,CAAC,OAAO,GAAG,YAAY,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACvD,OAAO,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,YAAY,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,KAAK,CAAC,WAAW,CACf,UAAkD,EAClD,OAAY,EACZ,aAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,OAAO,GAAe;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO;YACP,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC;QAEF,8BAA8B;QAC9B,MAAM,MAAM,GAAG,aAAa,IAAI,UAAU,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,sBAAsB,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;QAEtD,yEAAyE;QACzE,OAAO,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,YAAY,YAAY,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACnG,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,OAAwC;QAC9D,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IAC/B,CAAC;CACF;AA3DD,4CA2DC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Cascade MCP Client
3
+ *
4
+ * Handles communication with Cascade MCP server via stdio JSON-RPC
5
+ */
6
+ export declare class CascadeMcpClient {
7
+ private pythonPath;
8
+ private env;
9
+ private process;
10
+ private messageId;
11
+ private pendingRequests;
12
+ private isInitialized;
13
+ private readonly REQUEST_TIMEOUT;
14
+ private buffer;
15
+ constructor(pythonPath: string, env: NodeJS.ProcessEnv);
16
+ /**
17
+ * Start the MCP client and initialize connection
18
+ */
19
+ start(): Promise<void>;
20
+ /**
21
+ * Call a tool by name with arguments
22
+ */
23
+ callTool(name: string, args: Record<string, any>): Promise<any>;
24
+ /**
25
+ * List all available tools
26
+ */
27
+ listTools(): Promise<any[]>;
28
+ /**
29
+ * Check if client is connected
30
+ */
31
+ isConnected(): boolean;
32
+ /**
33
+ * Stop the MCP client
34
+ */
35
+ stop(): void;
36
+ /**
37
+ * Handle incoming data from stdout
38
+ */
39
+ private handleData;
40
+ /**
41
+ * Send a JSON-RPC request
42
+ */
43
+ private sendRequest;
44
+ /**
45
+ * Handle incoming JSON-RPC response
46
+ */
47
+ private handleResponse;
48
+ /**
49
+ * Reject all pending requests
50
+ */
51
+ private rejectAllPending;
52
+ }
53
+ //# sourceMappingURL=cascade-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascade-client.d.ts","sourceRoot":"","sources":["../src/cascade-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,qBAAa,gBAAgB;IASzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IATb,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,eAAe,CAA8D;IACrF,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,MAAM,CAAM;gBAGV,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,UAAU;IAGhC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C5B;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAQrE;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IASjC;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ;;OAEG;IACH,OAAO,CAAC,UAAU;IAclB;;OAEG;YACW,WAAW;IAkCzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAMzB"}