@phuetz/code-buddy 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -13
- package/dist/agent/architect-mode.d.ts +11 -0
- package/dist/agent/architect-mode.js +133 -25
- package/dist/agent/architect-mode.js.map +1 -1
- package/dist/agent/codebuddy-agent.d.ts +24 -0
- package/dist/agent/codebuddy-agent.js +118 -16
- package/dist/agent/codebuddy-agent.js.map +1 -1
- package/dist/agent/execution/agent-executor.d.ts +9 -0
- package/dist/agent/execution/agent-executor.js +61 -0
- package/dist/agent/execution/agent-executor.js.map +1 -1
- package/dist/agent/message-queue.d.ts +77 -0
- package/dist/agent/message-queue.js +116 -0
- package/dist/agent/message-queue.js.map +1 -0
- package/dist/agent/middleware/auto-observation.d.ts +37 -0
- package/dist/agent/middleware/auto-observation.js +231 -0
- package/dist/agent/middleware/auto-observation.js.map +1 -0
- package/dist/agent/middleware/index.d.ts +2 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/index.js.map +1 -1
- package/dist/agent/tool-handler.js +3 -2
- package/dist/agent/tool-handler.js.map +1 -1
- package/dist/agent/types.d.ts +7 -2
- package/dist/analytics/budget-alerts.d.ts +81 -0
- package/dist/analytics/budget-alerts.js +126 -0
- package/dist/analytics/budget-alerts.js.map +1 -0
- package/dist/analytics/cost-predictor.d.ts +79 -0
- package/dist/analytics/cost-predictor.js +150 -0
- package/dist/analytics/cost-predictor.js.map +1 -0
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.js +2 -0
- package/dist/analytics/index.js.map +1 -1
- package/dist/auth/profile-manager.d.ts +205 -0
- package/dist/auth/profile-manager.js +484 -0
- package/dist/auth/profile-manager.js.map +1 -0
- package/dist/browser-automation/browser-manager.d.ts +79 -1
- package/dist/browser-automation/browser-manager.js +265 -2
- package/dist/browser-automation/browser-manager.js.map +1 -1
- package/dist/browser-automation/profile-manager.d.ts +32 -0
- package/dist/browser-automation/profile-manager.js +83 -0
- package/dist/browser-automation/profile-manager.js.map +1 -0
- package/dist/browser-automation/route-interceptor.d.ts +29 -0
- package/dist/browser-automation/route-interceptor.js +103 -0
- package/dist/browser-automation/route-interceptor.js.map +1 -0
- package/dist/browser-automation/screenshot-annotator.d.ts +23 -0
- package/dist/browser-automation/screenshot-annotator.js +86 -0
- package/dist/browser-automation/screenshot-annotator.js.map +1 -0
- package/dist/browser-automation/types.d.ts +47 -0
- package/dist/channels/discord/client.d.ts +2 -1
- package/dist/channels/discord/client.js +28 -16
- package/dist/channels/discord/client.js.map +1 -1
- package/dist/channels/google-chat/index.d.ts +210 -0
- package/dist/channels/google-chat/index.js +505 -0
- package/dist/channels/google-chat/index.js.map +1 -0
- package/dist/channels/group-security.d.ts +182 -0
- package/dist/channels/group-security.js +407 -0
- package/dist/channels/group-security.js.map +1 -0
- package/dist/channels/index.d.ts +17 -1
- package/dist/channels/index.js +16 -0
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/matrix/index.d.ts +181 -0
- package/dist/channels/matrix/index.js +643 -0
- package/dist/channels/matrix/index.js.map +1 -0
- package/dist/channels/offline-queue.d.ts +92 -0
- package/dist/channels/offline-queue.js +112 -0
- package/dist/channels/offline-queue.js.map +1 -0
- package/dist/channels/reconnection-manager.d.ts +117 -0
- package/dist/channels/reconnection-manager.js +179 -0
- package/dist/channels/reconnection-manager.js.map +1 -0
- package/dist/channels/signal/index.d.ts +184 -0
- package/dist/channels/signal/index.js +488 -0
- package/dist/channels/signal/index.js.map +1 -0
- package/dist/channels/slack/client.d.ts +2 -1
- package/dist/channels/slack/client.js +30 -20
- package/dist/channels/slack/client.js.map +1 -1
- package/dist/channels/teams/index.d.ts +196 -0
- package/dist/channels/teams/index.js +477 -0
- package/dist/channels/teams/index.js.map +1 -0
- package/dist/channels/telegram/client.d.ts +3 -1
- package/dist/channels/telegram/client.js +29 -2
- package/dist/channels/telegram/client.js.map +1 -1
- package/dist/channels/webchat/index.d.ts +103 -0
- package/dist/channels/webchat/index.js +697 -0
- package/dist/channels/webchat/index.js.map +1 -0
- package/dist/channels/whatsapp/index.d.ts +105 -0
- package/dist/channels/whatsapp/index.js +533 -0
- package/dist/channels/whatsapp/index.js.map +1 -0
- package/dist/codebuddy/client.js +6 -3
- package/dist/codebuddy/client.js.map +1 -1
- package/dist/codebuddy/tool-definitions/advanced-tools.d.ts +1 -0
- package/dist/codebuddy/tool-definitions/advanced-tools.js +103 -3
- package/dist/codebuddy/tool-definitions/advanced-tools.js.map +1 -1
- package/dist/codebuddy/tool-definitions/index.d.ts +1 -1
- package/dist/codebuddy/tool-definitions/index.js +1 -1
- package/dist/codebuddy/tool-definitions/index.js.map +1 -1
- package/dist/codebuddy/tools.js +3 -1
- package/dist/codebuddy/tools.js.map +1 -1
- package/dist/commands/cli/config-command.d.ts +8 -0
- package/dist/commands/cli/config-command.js +90 -0
- package/dist/commands/cli/config-command.js.map +1 -0
- package/dist/commands/cli/openclaw-commands.d.ts +12 -0
- package/dist/commands/cli/openclaw-commands.js +446 -0
- package/dist/commands/cli/openclaw-commands.js.map +1 -0
- package/dist/commands/cli/utility-commands.js +30 -0
- package/dist/commands/cli/utility-commands.js.map +1 -1
- package/dist/commands/client-dispatcher.js +22 -2
- package/dist/commands/client-dispatcher.js.map +1 -1
- package/dist/commands/enhanced-command-handler.js +21 -2
- package/dist/commands/enhanced-command-handler.js.map +1 -1
- package/dist/commands/handlers/extra-handlers.d.ts +30 -0
- package/dist/commands/handlers/extra-handlers.js +547 -0
- package/dist/commands/handlers/extra-handlers.js.map +1 -0
- package/dist/commands/handlers/index.d.ts +1 -0
- package/dist/commands/handlers/index.js +2 -0
- package/dist/commands/handlers/index.js.map +1 -1
- package/dist/commands/slash/builtin-commands.js +41 -34
- package/dist/commands/slash/builtin-commands.js.map +1 -1
- package/dist/config/env-schema.d.ts +58 -0
- package/dist/config/env-schema.js +789 -0
- package/dist/config/env-schema.js.map +1 -0
- package/dist/config/feature-flags.js +2 -1
- package/dist/config/feature-flags.js.map +1 -1
- package/dist/context/bootstrap-loader.d.ts +48 -0
- package/dist/context/bootstrap-loader.js +123 -0
- package/dist/context/bootstrap-loader.js.map +1 -0
- package/dist/copilot/copilot-proxy.d.ts +15 -1
- package/dist/copilot/copilot-proxy.js +81 -22
- package/dist/copilot/copilot-proxy.js.map +1 -1
- package/dist/daemon/heartbeat.d.ts +112 -0
- package/dist/daemon/heartbeat.js +339 -0
- package/dist/daemon/heartbeat.js.map +1 -0
- package/dist/desktop-automation/smart-snapshot.d.ts +11 -0
- package/dist/desktop-automation/smart-snapshot.js +28 -0
- package/dist/desktop-automation/smart-snapshot.js.map +1 -1
- package/dist/identity/identity-manager.d.ts +95 -0
- package/dist/identity/identity-manager.js +242 -0
- package/dist/identity/identity-manager.js.map +1 -0
- package/dist/index.js +147 -17
- package/dist/index.js.map +1 -1
- package/dist/integrations/github-integration.js +1 -1
- package/dist/integrations/github-integration.js.map +1 -1
- package/dist/persistence/conversation-branches.js +2 -1
- package/dist/persistence/conversation-branches.js.map +1 -1
- package/dist/persistence/session-store.d.ts +1 -1
- package/dist/persistence/session-store.js +1 -1
- package/dist/persistence/session-store.js.map +1 -1
- package/dist/sandbox/auto-sandbox.d.ts +59 -0
- package/dist/sandbox/auto-sandbox.js +145 -0
- package/dist/sandbox/auto-sandbox.js.map +1 -0
- package/dist/security/audit-logger.d.ts +127 -0
- package/dist/security/audit-logger.js +194 -0
- package/dist/security/audit-logger.js.map +1 -0
- package/dist/security/bash-allowlist/allowlist-store.js +3 -2
- package/dist/security/bash-allowlist/allowlist-store.js.map +1 -1
- package/dist/security/bash-parser.js +0 -2
- package/dist/security/bash-parser.js.map +1 -1
- package/dist/security/code-validator.d.ts +51 -0
- package/dist/security/code-validator.js +185 -0
- package/dist/security/code-validator.js.map +1 -0
- package/dist/security/dangerous-patterns.d.ts +68 -0
- package/dist/security/dangerous-patterns.js +218 -0
- package/dist/security/dangerous-patterns.js.map +1 -0
- package/dist/security/remote-approval.d.ts +65 -0
- package/dist/security/remote-approval.js +138 -0
- package/dist/security/remote-approval.js.map +1 -0
- package/dist/security/security-audit.d.ts +7 -0
- package/dist/security/security-audit.js +23 -0
- package/dist/security/security-audit.js.map +1 -1
- package/dist/security/syntax-validator.d.ts +17 -0
- package/dist/security/syntax-validator.js +292 -0
- package/dist/security/syntax-validator.js.map +1 -0
- package/dist/server/index.js +277 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/prompt-builder.js +16 -0
- package/dist/services/prompt-builder.js.map +1 -1
- package/dist/skills/hub.d.ts +231 -0
- package/dist/skills/hub.js +694 -0
- package/dist/skills/hub.js.map +1 -0
- package/dist/skills/skill-loader.js +1 -1
- package/dist/skills/skill-loader.js.map +1 -1
- package/dist/skills/skill-manager.js +2 -1
- package/dist/skills/skill-manager.js.map +1 -1
- package/dist/tools/apply-patch.d.ts +1 -0
- package/dist/tools/apply-patch.js +57 -10
- package/dist/tools/apply-patch.js.map +1 -1
- package/dist/tools/bash/bash-tool.d.ts +123 -0
- package/dist/tools/bash/bash-tool.js +549 -0
- package/dist/tools/bash/bash-tool.js.map +1 -0
- package/dist/tools/bash/command-validator.d.ts +49 -0
- package/dist/tools/bash/command-validator.js +223 -0
- package/dist/tools/bash/command-validator.js.map +1 -0
- package/dist/tools/bash/index.d.ts +7 -0
- package/dist/tools/bash/index.js +8 -0
- package/dist/tools/bash/index.js.map +1 -0
- package/dist/tools/bash/security-patterns.d.ts +44 -0
- package/dist/tools/bash/security-patterns.js +234 -0
- package/dist/tools/bash/security-patterns.js.map +1 -0
- package/dist/tools/bash/streaming-executor.d.ts +23 -0
- package/dist/tools/bash/streaming-executor.js +134 -0
- package/dist/tools/bash/streaming-executor.js.map +1 -0
- package/dist/tools/code-formatter.js +41 -27
- package/dist/tools/code-formatter.js.map +1 -1
- package/dist/tools/code-review.js +1 -1
- package/dist/tools/code-review.js.map +1 -1
- package/dist/tools/computer-control-tool.js +21 -0
- package/dist/tools/computer-control-tool.js.map +1 -1
- package/dist/tools/document-tool.js +3 -2
- package/dist/tools/document-tool.js.map +1 -1
- package/dist/tools/git-tool.d.ts +45 -0
- package/dist/tools/git-tool.js +222 -0
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/multi-edit.js +31 -3
- package/dist/tools/multi-edit.js.map +1 -1
- package/dist/tools/process-tool.d.ts +69 -0
- package/dist/tools/process-tool.js +222 -0
- package/dist/tools/process-tool.js.map +1 -0
- package/dist/tools/registry/git-tools.d.ts +32 -0
- package/dist/tools/registry/git-tools.js +211 -0
- package/dist/tools/registry/git-tools.js.map +1 -0
- package/dist/tools/registry/index.d.ts +2 -0
- package/dist/tools/registry/index.js +8 -0
- package/dist/tools/registry/index.js.map +1 -1
- package/dist/tools/registry/misc-tools.d.ts +32 -4
- package/dist/tools/registry/misc-tools.js +230 -90
- package/dist/tools/registry/misc-tools.js.map +1 -1
- package/dist/tools/registry/process-tools.d.ts +20 -0
- package/dist/tools/registry/process-tools.js +141 -0
- package/dist/tools/registry/process-tools.js.map +1 -0
- package/dist/tools/registry/types.d.ts +2 -0
- package/dist/ui/components/ChatInterface.js +9 -0
- package/dist/ui/components/ChatInterface.js.map +1 -1
- package/dist/utils/autonomy-manager.js +3 -2
- package/dist/utils/autonomy-manager.js.map +1 -1
- package/dist/utils/config-validation/schema.d.ts +15 -15
- package/dist/utils/confirmation-service.d.ts +16 -0
- package/dist/utils/confirmation-service.js +37 -3
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/custom-instructions.js +2 -1
- package/dist/utils/custom-instructions.js.map +1 -1
- package/dist/utils/graceful-shutdown.js +9 -9
- package/dist/utils/graceful-shutdown.js.map +1 -1
- package/dist/utils/head-tail-truncation.d.ts +18 -0
- package/dist/utils/head-tail-truncation.js +127 -0
- package/dist/utils/head-tail-truncation.js.map +1 -1
- package/dist/utils/history-manager.js +3 -2
- package/dist/utils/history-manager.js.map +1 -1
- package/dist/utils/performance.js +16 -15
- package/dist/utils/performance.js.map +1 -1
- package/dist/utils/update-notifier.js +2 -1
- package/dist/utils/update-notifier.js.map +1 -1
- package/dist/workflows/pipeline.d.ts +54 -1
- package/dist/workflows/pipeline.js +128 -7
- package/dist/workflows/pipeline.js.map +1 -1
- package/dist/workflows/step-manager.js +2 -1
- package/dist/workflows/step-manager.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process Management Tool
|
|
3
|
+
*
|
|
4
|
+
* OpenClaw-inspired process management: list, poll, log, write (stdin), kill, clear, remove.
|
|
5
|
+
* Manages both OS processes (via ps) and tracked managed processes (from BashTool).
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from 'child_process';
|
|
8
|
+
import { logger } from '../utils/logger.js';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Process Tool
|
|
11
|
+
// ============================================================================
|
|
12
|
+
export class ProcessTool {
|
|
13
|
+
managed = new Map();
|
|
14
|
+
maxBufferLines = 1000;
|
|
15
|
+
/**
|
|
16
|
+
* List OS processes, optionally filtered
|
|
17
|
+
*/
|
|
18
|
+
async list(filter) {
|
|
19
|
+
try {
|
|
20
|
+
const output = execSync('ps aux', {
|
|
21
|
+
encoding: 'utf-8',
|
|
22
|
+
timeout: 5000,
|
|
23
|
+
});
|
|
24
|
+
const lines = output.trim().split('\n');
|
|
25
|
+
const header = lines[0];
|
|
26
|
+
let dataLines = lines.slice(1);
|
|
27
|
+
if (filter) {
|
|
28
|
+
const lowerFilter = filter.toLowerCase();
|
|
29
|
+
dataLines = dataLines.filter(line => line.toLowerCase().includes(lowerFilter));
|
|
30
|
+
}
|
|
31
|
+
const result = [header, ...dataLines.slice(0, 50)].join('\n');
|
|
32
|
+
const total = dataLines.length;
|
|
33
|
+
return {
|
|
34
|
+
success: true,
|
|
35
|
+
output: `${result}\n\n${total} process(es) found${total > 50 ? ' (showing first 50)' : ''}`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
error: `Failed to list processes: ${error instanceof Error ? error.message : String(error)}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Poll whether a process is still running
|
|
47
|
+
*/
|
|
48
|
+
async poll(pid) {
|
|
49
|
+
try {
|
|
50
|
+
process.kill(pid, 0);
|
|
51
|
+
const managed = this.managed.get(pid);
|
|
52
|
+
return {
|
|
53
|
+
success: true,
|
|
54
|
+
output: `Process ${pid} is running${managed ? ` (managed: "${managed.command}")` : ''}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return {
|
|
59
|
+
success: true,
|
|
60
|
+
output: `Process ${pid} is not running`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get log buffer for a managed process
|
|
66
|
+
*/
|
|
67
|
+
async log(pid, opts) {
|
|
68
|
+
const managed = this.managed.get(pid);
|
|
69
|
+
if (!managed) {
|
|
70
|
+
return {
|
|
71
|
+
success: false,
|
|
72
|
+
error: `Process ${pid} is not a managed process. Only processes started via BashTool can have logs.`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const buffer = opts?.stderr ? managed.stderrLines : managed.stdoutLines;
|
|
76
|
+
const limit = opts?.lines ?? 100;
|
|
77
|
+
const lines = buffer.slice(-limit);
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
output: lines.length > 0 ? lines.join('\n') : '(no output)',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Write to stdin of a managed process
|
|
85
|
+
*/
|
|
86
|
+
async write(pid, input) {
|
|
87
|
+
const managed = this.managed.get(pid);
|
|
88
|
+
if (!managed) {
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: `Process ${pid} is not a managed process.`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (!managed.process.stdin || managed.process.stdin.destroyed) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
error: `Process ${pid} stdin is not writable.`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
managed.process.stdin.write(input + '\n');
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
output: `Wrote ${input.length + 1} bytes to process ${pid} stdin`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return {
|
|
109
|
+
success: false,
|
|
110
|
+
error: `Failed to write to process ${pid}: ${error instanceof Error ? error.message : String(error)}`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Kill a process
|
|
116
|
+
*/
|
|
117
|
+
async kill(pid, signal) {
|
|
118
|
+
try {
|
|
119
|
+
const sig = signal || 'SIGTERM';
|
|
120
|
+
process.kill(pid, sig);
|
|
121
|
+
return {
|
|
122
|
+
success: true,
|
|
123
|
+
output: `Sent ${sig} to process ${pid}`,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
error: `Failed to kill process ${pid}: ${error instanceof Error ? error.message : String(error)}`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Clear log buffer for a managed process
|
|
135
|
+
*/
|
|
136
|
+
async clear(pid) {
|
|
137
|
+
const managed = this.managed.get(pid);
|
|
138
|
+
if (!managed) {
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: `Process ${pid} is not a managed process.`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const clearedStdout = managed.stdoutLines.length;
|
|
145
|
+
const clearedStderr = managed.stderrLines.length;
|
|
146
|
+
managed.stdoutLines.length = 0;
|
|
147
|
+
managed.stderrLines.length = 0;
|
|
148
|
+
return {
|
|
149
|
+
success: true,
|
|
150
|
+
output: `Cleared ${clearedStdout} stdout and ${clearedStderr} stderr lines for process ${pid}`,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Remove a managed process from tracking
|
|
155
|
+
*/
|
|
156
|
+
async remove(pid) {
|
|
157
|
+
if (!this.managed.has(pid)) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
error: `Process ${pid} is not a managed process.`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
this.managed.delete(pid);
|
|
164
|
+
return {
|
|
165
|
+
success: true,
|
|
166
|
+
output: `Untracked process ${pid}`,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Register a process for tracking (called from BashTool for background processes)
|
|
171
|
+
*/
|
|
172
|
+
trackProcess(pid, cmd, proc) {
|
|
173
|
+
const managed = {
|
|
174
|
+
pid,
|
|
175
|
+
command: cmd,
|
|
176
|
+
process: proc,
|
|
177
|
+
stdoutLines: [],
|
|
178
|
+
stderrLines: [],
|
|
179
|
+
startedAt: new Date(),
|
|
180
|
+
};
|
|
181
|
+
proc.stdout?.on('data', (data) => {
|
|
182
|
+
const lines = data.toString().split('\n').filter(l => l.length > 0);
|
|
183
|
+
managed.stdoutLines.push(...lines);
|
|
184
|
+
// Trim buffer
|
|
185
|
+
if (managed.stdoutLines.length > this.maxBufferLines) {
|
|
186
|
+
managed.stdoutLines.splice(0, managed.stdoutLines.length - this.maxBufferLines);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
proc.stderr?.on('data', (data) => {
|
|
190
|
+
const lines = data.toString().split('\n').filter(l => l.length > 0);
|
|
191
|
+
managed.stderrLines.push(...lines);
|
|
192
|
+
if (managed.stderrLines.length > this.maxBufferLines) {
|
|
193
|
+
managed.stderrLines.splice(0, managed.stderrLines.length - this.maxBufferLines);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
proc.on('exit', (code) => {
|
|
197
|
+
logger.debug(`Managed process ${pid} exited with code ${code}`);
|
|
198
|
+
});
|
|
199
|
+
this.managed.set(pid, managed);
|
|
200
|
+
logger.debug(`Tracking managed process ${pid}: ${cmd}`);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get list of managed processes
|
|
204
|
+
*/
|
|
205
|
+
getManagedProcesses() {
|
|
206
|
+
return this.managed;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// ============================================================================
|
|
210
|
+
// Singleton
|
|
211
|
+
// ============================================================================
|
|
212
|
+
let processToolInstance = null;
|
|
213
|
+
export function getProcessTool() {
|
|
214
|
+
if (!processToolInstance) {
|
|
215
|
+
processToolInstance = new ProcessTool();
|
|
216
|
+
}
|
|
217
|
+
return processToolInstance;
|
|
218
|
+
}
|
|
219
|
+
export function resetProcessTool() {
|
|
220
|
+
processToolInstance = null;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=process-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tool.js","sourceRoot":"","sources":["../../src/tools/process-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAwB5C,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,OAAO,WAAW;IACd,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC5C,cAAc,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAAe;QACxB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE;gBAChC,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,IAAI;aACd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vB,MAAM,CAAC,KAAK,CAAC,mBAAmB,GAAG,qBAAqB,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,4BAA4B,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,IAAI,mBAAmB,GAAuB,IAAI,CAAC;AAEnD,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,mBAAmB,GAAG,IAAI,WAAW,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,mBAAmB,GAAG,IAAI,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tool Adapters
|
|
3
|
+
*
|
|
4
|
+
* ITool-compliant adapter for GitTool operations.
|
|
5
|
+
* This adapter wraps the existing GitTool methods to conform
|
|
6
|
+
* to the formal ITool interface for use with the FormalToolRegistry.
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolResult } from '../../types/index.js';
|
|
9
|
+
import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Reset the shared GitTool instance (for testing)
|
|
12
|
+
*/
|
|
13
|
+
export declare function resetGitInstance(): void;
|
|
14
|
+
/**
|
|
15
|
+
* GitOperationTool - ITool adapter for Git operations
|
|
16
|
+
*
|
|
17
|
+
* Unified tool that handles all Git operations via an operation parameter.
|
|
18
|
+
*/
|
|
19
|
+
export declare class GitOperationTool implements ITool {
|
|
20
|
+
readonly name = "git";
|
|
21
|
+
readonly description = "Execute Git version control operations: status, diff, add, commit, push, pull, branch, checkout, stash, blame, cherry-pick, bisect";
|
|
22
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
23
|
+
getSchema(): ToolSchema;
|
|
24
|
+
validate(input: unknown): IValidationResult;
|
|
25
|
+
getMetadata(): IToolMetadata;
|
|
26
|
+
isAvailable(): boolean;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create all git tool instances
|
|
31
|
+
*/
|
|
32
|
+
export declare function createGitTools(): ITool[];
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Tool Adapters
|
|
3
|
+
*
|
|
4
|
+
* ITool-compliant adapter for GitTool operations.
|
|
5
|
+
* This adapter wraps the existing GitTool methods to conform
|
|
6
|
+
* to the formal ITool interface for use with the FormalToolRegistry.
|
|
7
|
+
*/
|
|
8
|
+
import { GitTool } from '../git-tool.js';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Shared GitTool Instance
|
|
11
|
+
// ============================================================================
|
|
12
|
+
let gitInstance = null;
|
|
13
|
+
function getGit() {
|
|
14
|
+
if (!gitInstance) {
|
|
15
|
+
gitInstance = new GitTool();
|
|
16
|
+
}
|
|
17
|
+
return gitInstance;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reset the shared GitTool instance (for testing)
|
|
21
|
+
*/
|
|
22
|
+
export function resetGitInstance() {
|
|
23
|
+
gitInstance = null;
|
|
24
|
+
}
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Valid operations
|
|
27
|
+
// ============================================================================
|
|
28
|
+
const VALID_OPERATIONS = [
|
|
29
|
+
'status',
|
|
30
|
+
'diff',
|
|
31
|
+
'add',
|
|
32
|
+
'commit',
|
|
33
|
+
'push',
|
|
34
|
+
'pull',
|
|
35
|
+
'branch',
|
|
36
|
+
'checkout',
|
|
37
|
+
'stash',
|
|
38
|
+
'auto_commit',
|
|
39
|
+
'blame',
|
|
40
|
+
'cherry_pick',
|
|
41
|
+
'bisect_start',
|
|
42
|
+
'bisect_step',
|
|
43
|
+
'bisect_reset',
|
|
44
|
+
];
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// GitOperationTool
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* GitOperationTool - ITool adapter for Git operations
|
|
50
|
+
*
|
|
51
|
+
* Unified tool that handles all Git operations via an operation parameter.
|
|
52
|
+
*/
|
|
53
|
+
export class GitOperationTool {
|
|
54
|
+
name = 'git';
|
|
55
|
+
description = 'Execute Git version control operations: status, diff, add, commit, push, pull, branch, checkout, stash, blame, cherry-pick, bisect';
|
|
56
|
+
async execute(input) {
|
|
57
|
+
const operation = input.operation;
|
|
58
|
+
const args = input.args || {};
|
|
59
|
+
const git = getGit();
|
|
60
|
+
switch (operation) {
|
|
61
|
+
case 'status': {
|
|
62
|
+
const status = await git.getStatus();
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
output: git.formatStatus(status),
|
|
66
|
+
data: status,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
case 'diff':
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
output: await git.getDiff(args.staged) || 'No differences',
|
|
73
|
+
};
|
|
74
|
+
case 'add':
|
|
75
|
+
return await git.add(args.files || 'all');
|
|
76
|
+
case 'commit':
|
|
77
|
+
return await git.commit(args.message);
|
|
78
|
+
case 'push':
|
|
79
|
+
return await git.push();
|
|
80
|
+
case 'pull':
|
|
81
|
+
return await git.pull();
|
|
82
|
+
case 'branch':
|
|
83
|
+
return await git.branch(args.branch, args.delete);
|
|
84
|
+
case 'checkout':
|
|
85
|
+
return await git.checkout(args.branch, args.create);
|
|
86
|
+
case 'stash':
|
|
87
|
+
if (args.pop) {
|
|
88
|
+
return await git.stashPop();
|
|
89
|
+
}
|
|
90
|
+
return await git.stash(args.message);
|
|
91
|
+
case 'auto_commit':
|
|
92
|
+
return await git.autoCommit({
|
|
93
|
+
message: args.message,
|
|
94
|
+
push: args.push,
|
|
95
|
+
});
|
|
96
|
+
case 'blame':
|
|
97
|
+
return await git.blame(args.file, {
|
|
98
|
+
startLine: args.start_line,
|
|
99
|
+
endLine: args.end_line,
|
|
100
|
+
});
|
|
101
|
+
case 'cherry_pick':
|
|
102
|
+
return await git.cherryPick(args.commit, {
|
|
103
|
+
noCommit: args.no_commit,
|
|
104
|
+
});
|
|
105
|
+
case 'bisect_start':
|
|
106
|
+
return await git.bisectStart(args.bad_ref, args.good_ref);
|
|
107
|
+
case 'bisect_step':
|
|
108
|
+
return await git.bisectStep(args.result);
|
|
109
|
+
case 'bisect_reset':
|
|
110
|
+
return await git.bisectReset();
|
|
111
|
+
default:
|
|
112
|
+
return {
|
|
113
|
+
success: false,
|
|
114
|
+
error: `Unknown git operation: ${operation}`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
getSchema() {
|
|
119
|
+
return {
|
|
120
|
+
name: this.name,
|
|
121
|
+
description: this.description,
|
|
122
|
+
parameters: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
properties: {
|
|
125
|
+
operation: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Git operation to perform',
|
|
128
|
+
enum: [...VALID_OPERATIONS],
|
|
129
|
+
},
|
|
130
|
+
args: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
description: 'Operation-specific arguments',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
required: ['operation'],
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
validate(input) {
|
|
140
|
+
if (typeof input !== 'object' || input === null) {
|
|
141
|
+
return { valid: false, errors: ['Input must be an object'] };
|
|
142
|
+
}
|
|
143
|
+
const data = input;
|
|
144
|
+
if (typeof data.operation !== 'string' || data.operation.trim() === '') {
|
|
145
|
+
return { valid: false, errors: ['operation must be a non-empty string'] };
|
|
146
|
+
}
|
|
147
|
+
if (!VALID_OPERATIONS.includes(data.operation)) {
|
|
148
|
+
return { valid: false, errors: [`Unknown operation: ${data.operation}`] };
|
|
149
|
+
}
|
|
150
|
+
// Validate required args for specific operations
|
|
151
|
+
const args = data.args || {};
|
|
152
|
+
switch (data.operation) {
|
|
153
|
+
case 'commit':
|
|
154
|
+
if (typeof args.message !== 'string' || args.message.trim() === '') {
|
|
155
|
+
return { valid: false, errors: ['commit requires args.message'] };
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
case 'blame':
|
|
159
|
+
if (typeof args.file !== 'string' || args.file.trim() === '') {
|
|
160
|
+
return { valid: false, errors: ['blame requires args.file'] };
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case 'cherry_pick':
|
|
164
|
+
if (typeof args.commit !== 'string' || args.commit.trim() === '') {
|
|
165
|
+
return { valid: false, errors: ['cherry_pick requires args.commit'] };
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case 'bisect_step':
|
|
169
|
+
if (!['good', 'bad', 'skip'].includes(args.result)) {
|
|
170
|
+
return { valid: false, errors: ['bisect_step requires args.result to be "good", "bad", or "skip"'] };
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
case 'checkout':
|
|
174
|
+
if (typeof args.branch !== 'string' || args.branch.trim() === '') {
|
|
175
|
+
return { valid: false, errors: ['checkout requires args.branch'] };
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
return { valid: true };
|
|
180
|
+
}
|
|
181
|
+
getMetadata() {
|
|
182
|
+
return {
|
|
183
|
+
name: this.name,
|
|
184
|
+
description: this.description,
|
|
185
|
+
category: 'git',
|
|
186
|
+
keywords: ['git', 'version-control', 'commit', 'branch', 'diff', 'blame', 'cherry-pick', 'bisect'],
|
|
187
|
+
priority: 7,
|
|
188
|
+
requiresConfirmation: true,
|
|
189
|
+
modifiesFiles: false,
|
|
190
|
+
makesNetworkRequests: false,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
isAvailable() {
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
dispose() {
|
|
197
|
+
resetGitInstance();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// Factory Function
|
|
202
|
+
// ============================================================================
|
|
203
|
+
/**
|
|
204
|
+
* Create all git tool instances
|
|
205
|
+
*/
|
|
206
|
+
export function createGitTools() {
|
|
207
|
+
return [
|
|
208
|
+
new GitOperationTool(),
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=git-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tools.js","sourceRoot":"","sources":["../../../src/tools/registry/git-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,IAAI,WAAW,GAAmB,IAAI,CAAC;AAEvC,SAAS,MAAM;IACb,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,gBAAgB,GAAG;IACvB,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;IACP,aAAa;IACb,OAAO;IACP,aAAa;IACb,cAAc;IACd,aAAa;IACb,cAAc;CACN,CAAC;AAIX,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAClB,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YAC7B,QAAQ,EAAE,KAAyB;YACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC;YAClG,QAAQ,EAAE,CAAC;YACX,oBAAoB,EAAE,IAAI;YAC1B,aAAa,EAAE,KAAK;YACpB,oBAAoB,EAAE,KAAK;SAC5B,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,gBAAgB,EAAE,CAAC;IACrB,CAAC;CACF;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,gBAAgB,EAAE;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -16,7 +16,9 @@ export { WebSearchExecuteTool, WebFetchTool, createWebTools, resetWebSearchInsta
|
|
|
16
16
|
export { CreateTodoListTool, UpdateTodoListTool, createTodoTools, resetTodoInstance, } from './todo-tools.js';
|
|
17
17
|
export { DockerOperationTool, createDockerTools, resetDockerInstance, } from './docker-tools.js';
|
|
18
18
|
export { KubernetesOperationTool, createKubernetesTools, resetKubernetesInstance, } from './kubernetes-tools.js';
|
|
19
|
+
export { GitOperationTool, createGitTools, resetGitInstance, } from './git-tools.js';
|
|
19
20
|
export { BrowserExecuteTool, ReasoningExecuteTool, createMiscTools, resetMiscInstances, } from './misc-tools.js';
|
|
21
|
+
export { ProcessOperationTool, createProcessTools, resetProcessInstance, } from './process-tools.js';
|
|
20
22
|
export type { JsonSchema, JsonSchemaProperty, ToolSchema, ToolCategoryType, ITool, IToolMetadata, IValidationResult, ToolExecutorFn, IToolExecutionContext, IToolExecutionResult, IToolRegistrationOptions, IRegisteredTool, IToolQueryOptions, IToolRegistry, IRegistryStats, IToolRegistryEvents, ToolRegistryEventHandler, } from './types.js';
|
|
21
23
|
/**
|
|
22
24
|
* Create all tool instances for registration (async for lazy loading)
|
|
@@ -24,8 +24,12 @@ export { CreateTodoListTool, UpdateTodoListTool, createTodoTools, resetTodoInsta
|
|
|
24
24
|
export { DockerOperationTool, createDockerTools, resetDockerInstance, } from './docker-tools.js';
|
|
25
25
|
// Tool Adapters - Kubernetes
|
|
26
26
|
export { KubernetesOperationTool, createKubernetesTools, resetKubernetesInstance, } from './kubernetes-tools.js';
|
|
27
|
+
// Tool Adapters - Git
|
|
28
|
+
export { GitOperationTool, createGitTools, resetGitInstance, } from './git-tools.js';
|
|
27
29
|
// Tool Adapters - Misc (Browser, Reasoning)
|
|
28
30
|
export { BrowserExecuteTool, ReasoningExecuteTool, createMiscTools, resetMiscInstances, } from './misc-tools.js';
|
|
31
|
+
// Tool Adapters - Process
|
|
32
|
+
export { ProcessOperationTool, createProcessTools, resetProcessInstance, } from './process-tools.js';
|
|
29
33
|
/**
|
|
30
34
|
* Create all tool instances for registration (async for lazy loading)
|
|
31
35
|
*/
|
|
@@ -37,7 +41,9 @@ export async function createAllToolsAsync() {
|
|
|
37
41
|
const { createTodoTools } = await import('./todo-tools.js');
|
|
38
42
|
const { createDockerTools } = await import('./docker-tools.js');
|
|
39
43
|
const { createKubernetesTools } = await import('./kubernetes-tools.js');
|
|
44
|
+
const { createGitTools } = await import('./git-tools.js');
|
|
40
45
|
const { createMiscTools } = await import('./misc-tools.js');
|
|
46
|
+
const { createProcessTools } = await import('./process-tools.js');
|
|
41
47
|
return [
|
|
42
48
|
...createTextEditorTools(),
|
|
43
49
|
...createBashTools(),
|
|
@@ -46,7 +52,9 @@ export async function createAllToolsAsync() {
|
|
|
46
52
|
...createTodoTools(),
|
|
47
53
|
...createDockerTools(),
|
|
48
54
|
...createKubernetesTools(),
|
|
55
|
+
...createGitTools(),
|
|
49
56
|
...createMiscTools(),
|
|
57
|
+
...createProcessTools(),
|
|
50
58
|
];
|
|
51
59
|
}
|
|
52
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEvG,8BAA8B;AAC9B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,uBAAuB;AACvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,uBAAuB;AACvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,6BAA6B;AAC7B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,4CAA4C;AAC5C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE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AAe,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC5D,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAChE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC1D,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC5D,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAChE,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACxE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC1D,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC5D,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAElE,OAAO;QACL,GAAG,qBAAqB,EAAE;QAC1B,GAAG,eAAe,EAAE;QACpB,GAAG,iBAAiB,EAAE;QACtB,GAAG,cAAc,EAAE;QACnB,GAAG,eAAe,EAAE;QACpB,GAAG,iBAAiB,EAAE;QACtB,GAAG,qBAAqB,EAAE;QAC1B,GAAG,cAAc,EAAE;QACnB,GAAG,eAAe,EAAE;QACpB,GAAG,kBAAkB,EAAE;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Miscellaneous Tool Adapters
|
|
3
3
|
*
|
|
4
|
-
* ITool-compliant adapters for BrowserTool
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* ITool-compliant adapters for BrowserTool (accessibility-based),
|
|
5
|
+
* ComputerControlTool, ScreenshotTool, and ReasoningTool.
|
|
6
|
+
*
|
|
7
|
+
* BrowserExecuteTool is wired to src/browser-automation/ (OpenClaw-inspired
|
|
8
|
+
* accessibility tree + ref numbering) instead of the old CSS-selector-only
|
|
9
|
+
* src/tools/browser-tool.ts.
|
|
7
10
|
*/
|
|
8
11
|
import type { ToolResult } from '../../types/index.js';
|
|
9
12
|
import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
|
|
@@ -13,10 +16,11 @@ import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './type
|
|
|
13
16
|
export declare function resetMiscInstances(): void;
|
|
14
17
|
/**
|
|
15
18
|
* BrowserExecuteTool - ITool adapter for browser automation
|
|
19
|
+
* Uses browser-automation module with accessibility tree + ref numbering
|
|
16
20
|
*/
|
|
17
21
|
export declare class BrowserExecuteTool implements ITool {
|
|
18
22
|
readonly name = "browser";
|
|
19
|
-
readonly description = "Automate web browser
|
|
23
|
+
readonly description = "Automate web browser with accessibility-based element refs. Snapshot \u2192 ref-based click/type/fill.";
|
|
20
24
|
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
21
25
|
getSchema(): ToolSchema;
|
|
22
26
|
validate(input: unknown): IValidationResult;
|
|
@@ -24,6 +28,30 @@ export declare class BrowserExecuteTool implements ITool {
|
|
|
24
28
|
isAvailable(): boolean;
|
|
25
29
|
dispose(): Promise<void>;
|
|
26
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* ComputerControlExecuteTool - ITool adapter for desktop computer control
|
|
33
|
+
*/
|
|
34
|
+
export declare class ComputerControlExecuteTool implements ITool {
|
|
35
|
+
readonly name = "computer_control";
|
|
36
|
+
readonly description = "Control the computer: mouse, keyboard, window management, system actions. Use snapshot to detect UI elements with refs.";
|
|
37
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
38
|
+
getSchema(): ToolSchema;
|
|
39
|
+
validate(input: unknown): IValidationResult;
|
|
40
|
+
getMetadata(): IToolMetadata;
|
|
41
|
+
isAvailable(): boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* ScreenshotExecuteTool - ITool adapter for screen capture
|
|
45
|
+
*/
|
|
46
|
+
export declare class ScreenshotExecuteTool implements ITool {
|
|
47
|
+
readonly name = "screenshot";
|
|
48
|
+
readonly description = "Capture screenshots of the screen, a window, or a region. Supports LLM-optimized output.";
|
|
49
|
+
execute(input: Record<string, unknown>): Promise<ToolResult>;
|
|
50
|
+
getSchema(): ToolSchema;
|
|
51
|
+
validate(input: unknown): IValidationResult;
|
|
52
|
+
getMetadata(): IToolMetadata;
|
|
53
|
+
isAvailable(): boolean;
|
|
54
|
+
}
|
|
27
55
|
/**
|
|
28
56
|
* ReasoningExecuteTool - ITool adapter for Tree-of-Thought reasoning
|
|
29
57
|
*/
|