@theia/ai-terminal 1.76.0-next.6 → 1.76.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.
- package/lib/browser/abstract-shell-execution-tool.d.ts +39 -0
- package/lib/browser/abstract-shell-execution-tool.d.ts.map +1 -0
- package/lib/browser/abstract-shell-execution-tool.js +103 -0
- package/lib/browser/abstract-shell-execution-tool.js.map +1 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/predefined-shell-tool.d.ts +51 -0
- package/lib/browser/predefined-shell-tool.d.ts.map +1 -0
- package/lib/browser/predefined-shell-tool.js +77 -0
- package/lib/browser/predefined-shell-tool.js.map +1 -0
- package/lib/browser/predefined-shell-tool.spec.d.ts +2 -0
- package/lib/browser/predefined-shell-tool.spec.d.ts.map +1 -0
- package/lib/browser/predefined-shell-tool.spec.js +197 -0
- package/lib/browser/predefined-shell-tool.spec.js.map +1 -0
- package/lib/browser/shell-execution-tool.d.ts +4 -13
- package/lib/browser/shell-execution-tool.d.ts.map +1 -1
- package/lib/browser/shell-execution-tool.js +7 -91
- package/lib/browser/shell-execution-tool.js.map +1 -1
- package/lib/common/shell-execution-input-parser.spec.js +3 -3
- package/lib/common/shell-execution-input-parser.spec.js.map +1 -1
- package/lib/common/shell-execution-server.d.ts +18 -2
- package/lib/common/shell-execution-server.d.ts.map +1 -1
- package/lib/common/shell-execution-server.js +13 -9
- package/lib/common/shell-execution-server.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/abstract-shell-execution-tool.ts +127 -0
- package/src/browser/index.ts +1 -0
- package/src/browser/predefined-shell-tool.spec.ts +222 -0
- package/src/browser/predefined-shell-tool.ts +100 -0
- package/src/browser/shell-execution-tool.ts +10 -103
- package/src/common/shell-execution-input-parser.spec.ts +3 -3
- package/src/common/shell-execution-server.ts +31 -9
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
2
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
3
|
+
import { OutputTruncationOptions, ShellExecutionCanceledResult, ShellExecutionServer, ShellExecutionToolResult } from '../common/shell-execution-server';
|
|
4
|
+
/** A single shell command to run through {@link AbstractShellExecutionTool.runShellCommand}. */
|
|
5
|
+
export interface ShellCommandExecution {
|
|
6
|
+
command: string;
|
|
7
|
+
/** Absolute working directory. If omitted the command runs in the backend process' cwd. */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/** Timeout in milliseconds. Falls back to the backend default when omitted. */
|
|
10
|
+
timeout?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The invocation context, if any. Its tool call id makes the execution cancellable via
|
|
13
|
+
* {@link AbstractShellExecutionTool.cancelExecution}, and its cancellation token kills the
|
|
14
|
+
* underlying process when fired. Typed as `unknown` because tool handlers receive the context
|
|
15
|
+
* untyped; {@link ToolInvocationContext} narrows it.
|
|
16
|
+
*/
|
|
17
|
+
ctx?: unknown;
|
|
18
|
+
/** Overrides the default output truncation budget. */
|
|
19
|
+
truncation?: OutputTruncationOptions;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shared plumbing for tools that run a shell command through the {@link ShellExecutionServer}:
|
|
23
|
+
* execution-id bookkeeping, cancellation wiring, the canceled-result branch and output truncation.
|
|
24
|
+
*
|
|
25
|
+
* Subclasses only decide *which* command runs and how it is exposed to the LLM.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class AbstractShellExecutionTool implements ToolProvider {
|
|
28
|
+
protected readonly shellServer: ShellExecutionServer;
|
|
29
|
+
protected readonly workspaceService: WorkspaceService;
|
|
30
|
+
/** Maps tool call ids to the execution ids of their in-flight shell commands. */
|
|
31
|
+
protected readonly runningExecutions: Map<string, string>;
|
|
32
|
+
abstract getTool(): ToolRequest;
|
|
33
|
+
cancelExecution(toolCallId: string): Promise<boolean>;
|
|
34
|
+
isExecutionRunning(toolCallId: string): boolean;
|
|
35
|
+
/** Runs `execution` and maps the raw server result onto the tool result shape. */
|
|
36
|
+
protected runShellCommand(execution: ShellCommandExecution): Promise<ShellExecutionToolResult | ShellExecutionCanceledResult>;
|
|
37
|
+
protected combineAndTruncate(stdout: string, stderr: string, options?: OutputTruncationOptions): string;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=abstract-shell-execution-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-shell-execution-tool.d.ts","sourceRoot":"","sources":["../../src/browser/abstract-shell-execution-tool.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAyB,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EACH,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EAE3B,MAAM,kCAAkC,CAAC;AAE1C,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED;;;;;GAKG;AACH,8BACsB,0BAA2B,YAAW,YAAY;IAGpE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAGrD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,iFAAiF;IACjF,SAAS,CAAC,QAAQ,CAAC,iBAAiB,sBAA6B;IAEjE,QAAQ,CAAC,OAAO,IAAI,WAAW;IAEzB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAY3D,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI/C,kFAAkF;cAClE,eAAe,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC,wBAAwB,GAAG,4BAA4B,CAAC;IAwCnI,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM;CAG1G"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AbstractShellExecutionTool = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const core_1 = require("@theia/core");
|
|
22
|
+
const ai_core_1 = require("@theia/ai-core");
|
|
23
|
+
const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
|
|
24
|
+
const shell_execution_server_1 = require("../common/shell-execution-server");
|
|
25
|
+
/**
|
|
26
|
+
* Shared plumbing for tools that run a shell command through the {@link ShellExecutionServer}:
|
|
27
|
+
* execution-id bookkeeping, cancellation wiring, the canceled-result branch and output truncation.
|
|
28
|
+
*
|
|
29
|
+
* Subclasses only decide *which* command runs and how it is exposed to the LLM.
|
|
30
|
+
*/
|
|
31
|
+
let AbstractShellExecutionTool = class AbstractShellExecutionTool {
|
|
32
|
+
constructor() {
|
|
33
|
+
/** Maps tool call ids to the execution ids of their in-flight shell commands. */
|
|
34
|
+
this.runningExecutions = new Map();
|
|
35
|
+
}
|
|
36
|
+
async cancelExecution(toolCallId) {
|
|
37
|
+
const executionId = this.runningExecutions.get(toolCallId);
|
|
38
|
+
if (executionId) {
|
|
39
|
+
const canceled = await this.shellServer.cancel(executionId);
|
|
40
|
+
if (canceled) {
|
|
41
|
+
this.runningExecutions.delete(toolCallId);
|
|
42
|
+
}
|
|
43
|
+
return canceled;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
isExecutionRunning(toolCallId) {
|
|
48
|
+
return this.runningExecutions.has(toolCallId);
|
|
49
|
+
}
|
|
50
|
+
/** Runs `execution` and maps the raw server result onto the tool result shape. */
|
|
51
|
+
async runShellCommand(execution) {
|
|
52
|
+
const { command, cwd, timeout, ctx, truncation } = execution;
|
|
53
|
+
const toolCallId = ai_core_1.ToolInvocationContext.getToolCallId(ctx);
|
|
54
|
+
const cancellationToken = ai_core_1.ToolInvocationContext.getCancellationToken(ctx);
|
|
55
|
+
const executionId = (0, core_1.generateUuid)();
|
|
56
|
+
if (toolCallId) {
|
|
57
|
+
this.runningExecutions.set(toolCallId, executionId);
|
|
58
|
+
}
|
|
59
|
+
const cancellationListener = cancellationToken?.onCancellationRequested(() => {
|
|
60
|
+
this.shellServer.cancel(executionId);
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
const result = await this.shellServer.execute({ command, cwd, timeout, executionId });
|
|
64
|
+
if (result.canceled) {
|
|
65
|
+
return {
|
|
66
|
+
canceled: true,
|
|
67
|
+
output: this.combineAndTruncate(result.stdout, result.stderr, truncation) || undefined,
|
|
68
|
+
duration: result.duration
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
success: result.success,
|
|
73
|
+
exitCode: result.exitCode,
|
|
74
|
+
output: this.combineAndTruncate(result.stdout, result.stderr, truncation),
|
|
75
|
+
error: result.error,
|
|
76
|
+
duration: result.duration,
|
|
77
|
+
cwd: result.resolvedCwd
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
cancellationListener?.dispose();
|
|
82
|
+
if (toolCallId) {
|
|
83
|
+
this.runningExecutions.delete(toolCallId);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
combineAndTruncate(stdout, stderr, options) {
|
|
88
|
+
return (0, shell_execution_server_1.combineAndTruncate)(stdout, stderr, options);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
exports.AbstractShellExecutionTool = AbstractShellExecutionTool;
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, inversify_1.inject)(shell_execution_server_1.ShellExecutionServer),
|
|
94
|
+
tslib_1.__metadata("design:type", Object)
|
|
95
|
+
], AbstractShellExecutionTool.prototype, "shellServer", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, inversify_1.inject)(workspace_service_1.WorkspaceService),
|
|
98
|
+
tslib_1.__metadata("design:type", workspace_service_1.WorkspaceService)
|
|
99
|
+
], AbstractShellExecutionTool.prototype, "workspaceService", void 0);
|
|
100
|
+
exports.AbstractShellExecutionTool = AbstractShellExecutionTool = tslib_1.__decorate([
|
|
101
|
+
(0, inversify_1.injectable)()
|
|
102
|
+
], AbstractShellExecutionTool);
|
|
103
|
+
//# sourceMappingURL=abstract-shell-execution-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-shell-execution-tool.js","sourceRoot":"","sources":["../../src/browser/abstract-shell-execution-tool.ts"],"names":[],"mappings":";AAA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CAAC;IACL,CAAC;IAES,kBAAkB,CAAC,MAAc,EAAE,MAAc,EAAE,OAAiC;QAC1F,OAAO,IAAA,2CAAkB,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAzEqB,gEAA0B;AAGzB;IADlB,IAAA,kBAAM,EAAC,6CAAoB,CAAC;;+DACwB;AAGlC;IADlB,IAAA,kBAAM,EAAC,oCAAgB,CAAC;sCACY,oCAAgB;oEAAC;qCANpC,0BAA0B;IAD/C,IAAA,sBAAU,GAAE;GACS,0BAA0B,CAyE/C"}
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC"}
|
package/lib/browser/index.js
CHANGED
|
@@ -17,4 +17,5 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const tslib_1 = require("tslib");
|
|
19
19
|
tslib_1.__exportStar(require("./shell-command-permission-service"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./predefined-shell-tool"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/lib/browser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6EAAmD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6EAAmD;AACnD,kEAAwC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ToolInvocationContext, ToolRequest, ToolRequestParameters } from '@theia/ai-core';
|
|
2
|
+
import { AbstractShellExecutionTool } from './abstract-shell-execution-tool';
|
|
3
|
+
import { OutputTruncationOptions, ShellExecutionCanceledResult, ShellExecutionToolResult } from '../common/shell-execution-server';
|
|
4
|
+
/** `providerName` reported by tools that derive from {@link PredefinedShellTool}. */
|
|
5
|
+
export declare const PREDEFINED_SHELL_TOOL_PROVIDER = "ai-predefined-shell";
|
|
6
|
+
/**
|
|
7
|
+
* Base class for tools that execute a fixed, hardcoded shell command. A subclass declares its
|
|
8
|
+
* tool `id`, its parameters and a `buildCommand(args)` method that assembles the command from
|
|
9
|
+
* typed arguments. The LLM only supplies the typed arguments, so the subclass stays in control
|
|
10
|
+
* of the command.
|
|
11
|
+
*
|
|
12
|
+
* Unlike the general-purpose `shellExecute` tool, a {@link PredefinedShellTool} does not consult
|
|
13
|
+
* `ShellCommandPermissionService` and does not appear on the user's shell allow/deny lists. The
|
|
14
|
+
* safety boundary is the subclass `buildCommand`, which must not be coercible into running
|
|
15
|
+
* arbitrary commands.
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class PredefinedShellTool extends AbstractShellExecutionTool {
|
|
18
|
+
/** The unique identifier of this tool. Must not be `shellExecute`. */
|
|
19
|
+
abstract readonly id: string;
|
|
20
|
+
/** Human-readable description of this tool, shown to the LLM. */
|
|
21
|
+
abstract readonly description: string;
|
|
22
|
+
protected readonly parameters: ToolRequestParameters;
|
|
23
|
+
/** Timeout for the underlying shell execution, in milliseconds. */
|
|
24
|
+
protected readonly timeout: number;
|
|
25
|
+
/** Output truncation budget. `undefined` keeps the `shellExecute` defaults (first/last 50 lines). */
|
|
26
|
+
protected readonly truncation: OutputTruncationOptions | undefined;
|
|
27
|
+
/** Build the exact shell command to execute from the parsed arguments. */
|
|
28
|
+
protected abstract buildCommand(args: Record<string, unknown>): string;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the working directory for the shell command, given the same parsed arguments that
|
|
31
|
+
* {@link buildCommand} receives, so a tool can let the caller pick the folder it runs in.
|
|
32
|
+
*
|
|
33
|
+
* Deliberately abstract: the cwd materially affects most predefined commands (anything
|
|
34
|
+
* talking to a specific repository, build script, or per-folder tool), and silently
|
|
35
|
+
* defaulting to an arbitrary workspace root produces results that look plausible but describe
|
|
36
|
+
* the wrong folder.
|
|
37
|
+
*
|
|
38
|
+
* Subclasses that genuinely do not care about the cwd can return
|
|
39
|
+
* {@link firstWorkspaceRoot} or `undefined`.
|
|
40
|
+
*/
|
|
41
|
+
protected abstract resolveWorkspaceRoot(args: Record<string, unknown>): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The **first** workspace root, or `undefined` when no workspace is open. Only a sensible
|
|
44
|
+
* `resolveWorkspaceRoot` implementation for commands that produce the same output regardless
|
|
45
|
+
* of cwd. In a multi-root workspace the first root is arbitrary.
|
|
46
|
+
*/
|
|
47
|
+
protected firstWorkspaceRoot(): string | undefined;
|
|
48
|
+
getTool(): ToolRequest;
|
|
49
|
+
protected execute(argString: string, ctx?: ToolInvocationContext): Promise<ShellExecutionToolResult | ShellExecutionCanceledResult>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=predefined-shell-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-shell-tool.d.ts","sourceRoot":"","sources":["../../src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|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PredefinedShellTool = exports.PREDEFINED_SHELL_TOOL_PROVIDER = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const abstract_shell_execution_tool_1 = require("./abstract-shell-execution-tool");
|
|
22
|
+
/** `providerName` reported by tools that derive from {@link PredefinedShellTool}. */
|
|
23
|
+
exports.PREDEFINED_SHELL_TOOL_PROVIDER = 'ai-predefined-shell';
|
|
24
|
+
/**
|
|
25
|
+
* Base class for tools that execute a fixed, hardcoded shell command. A subclass declares its
|
|
26
|
+
* tool `id`, its parameters and a `buildCommand(args)` method that assembles the command from
|
|
27
|
+
* typed arguments. The LLM only supplies the typed arguments, so the subclass stays in control
|
|
28
|
+
* of the command.
|
|
29
|
+
*
|
|
30
|
+
* Unlike the general-purpose `shellExecute` tool, a {@link PredefinedShellTool} does not consult
|
|
31
|
+
* `ShellCommandPermissionService` and does not appear on the user's shell allow/deny lists. The
|
|
32
|
+
* safety boundary is the subclass `buildCommand`, which must not be coercible into running
|
|
33
|
+
* arbitrary commands.
|
|
34
|
+
*/
|
|
35
|
+
let PredefinedShellTool = class PredefinedShellTool extends abstract_shell_execution_tool_1.AbstractShellExecutionTool {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this.parameters = { type: 'object', properties: {} };
|
|
39
|
+
/** Timeout for the underlying shell execution, in milliseconds. */
|
|
40
|
+
this.timeout = 30_000;
|
|
41
|
+
/** Output truncation budget. `undefined` keeps the `shellExecute` defaults (first/last 50 lines). */
|
|
42
|
+
this.truncation = undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The **first** workspace root, or `undefined` when no workspace is open. Only a sensible
|
|
46
|
+
* `resolveWorkspaceRoot` implementation for commands that produce the same output regardless
|
|
47
|
+
* of cwd. In a multi-root workspace the first root is arbitrary.
|
|
48
|
+
*/
|
|
49
|
+
firstWorkspaceRoot() {
|
|
50
|
+
return this.workspaceService.getWorkspaceRootUri(undefined)?.path.fsPath();
|
|
51
|
+
}
|
|
52
|
+
getTool() {
|
|
53
|
+
return {
|
|
54
|
+
id: this.id,
|
|
55
|
+
name: this.id,
|
|
56
|
+
providerName: exports.PREDEFINED_SHELL_TOOL_PROVIDER,
|
|
57
|
+
description: this.description,
|
|
58
|
+
parameters: this.parameters,
|
|
59
|
+
handler: (argString, ctx) => this.execute(argString, ctx)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async execute(argString, ctx) {
|
|
63
|
+
const args = argString ? JSON.parse(argString) : {};
|
|
64
|
+
return this.runShellCommand({
|
|
65
|
+
command: this.buildCommand(args),
|
|
66
|
+
cwd: this.resolveWorkspaceRoot(args),
|
|
67
|
+
timeout: this.timeout,
|
|
68
|
+
ctx,
|
|
69
|
+
truncation: this.truncation
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.PredefinedShellTool = PredefinedShellTool;
|
|
74
|
+
exports.PredefinedShellTool = PredefinedShellTool = tslib_1.__decorate([
|
|
75
|
+
(0, inversify_1.injectable)()
|
|
76
|
+
], PredefinedShellTool);
|
|
77
|
+
//# sourceMappingURL=predefined-shell-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-shell-tool.js","sourceRoot":"","sources":["../../src/browser/predefined-shell-tool.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAE1D,mFAA6E;AAG7E,qFAAqF;AACxE,QAAA,8BAA8B,GAAG,qBAAqB,CAAC;AAEpE;;;;;;;;;;GAUG;AAEI,IAAe,mBAAmB,GAAlC,MAAe,mBAAoB,SAAQ,0DAA0B;IAArE;;QAQgB,eAAU,GAA0B,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QAE1F,mEAAmE;QAChD,YAAO,GAAW,MAAM,CAAC;QAE5C,qGAAqG;QAClF,eAAU,GAAwC,SAAS,CAAC;IAiDnF,CAAC;IA9BG;;;;OAIG;IACO,kBAAkB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/E,CAAC;IAED,OAAO;QACH,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,YAAY,EAAE,sCAA8B;YAC5C,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,CAAC,SAAiB,EAAE,GAA2B,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SAC5F,CAAC;IACN,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,GAA2B;QAClE,MAAM,IAAI,GAA4B,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,OAAO,IAAI,CAAC,eAAe,CAAC;YACxB,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAChC,GAAG,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC;YACpC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG;YACH,UAAU,EAAE,IAAI,CAAC,UAAU;SAC9B,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA/DqB,kDAAmB;8BAAnB,mBAAmB;IADxC,IAAA,sBAAU,GAAE;GACS,mBAAmB,CA+DxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-shell-tool.spec.d.ts","sourceRoot":"","sources":["../../src/browser/predefined-shell-tool.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
|
|
19
|
+
let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
20
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
21
|
+
frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const sinon = require("sinon");
|
|
24
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
25
|
+
const cancellation_1 = require("@theia/core/lib/common/cancellation");
|
|
26
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
27
|
+
const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
|
|
28
|
+
const shell_execution_server_1 = require("../common/shell-execution-server");
|
|
29
|
+
const predefined_shell_tool_1 = require("./predefined-shell-tool");
|
|
30
|
+
disableJSDOM();
|
|
31
|
+
class TestPredefinedShellTool extends predefined_shell_tool_1.PredefinedShellTool {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.id = 'test-predefined';
|
|
35
|
+
this.description = 'A test predefined shell tool that returns hello';
|
|
36
|
+
}
|
|
37
|
+
buildCommand(args) {
|
|
38
|
+
const upper = args.upper === true;
|
|
39
|
+
return upper ? 'echo HELLO' : 'echo hello';
|
|
40
|
+
}
|
|
41
|
+
resolveWorkspaceRoot(args) {
|
|
42
|
+
return typeof args.cwd === 'string' ? args.cwd : this.firstWorkspaceRoot();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function createResult(overrides = {}) {
|
|
46
|
+
return {
|
|
47
|
+
success: true,
|
|
48
|
+
exitCode: 0,
|
|
49
|
+
stdout: 'hello\n',
|
|
50
|
+
stderr: '',
|
|
51
|
+
duration: 5,
|
|
52
|
+
...overrides
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
describe('PredefinedShellTool', () => {
|
|
56
|
+
let container;
|
|
57
|
+
let shellServer;
|
|
58
|
+
let tool;
|
|
59
|
+
before(() => {
|
|
60
|
+
disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
61
|
+
});
|
|
62
|
+
after(() => {
|
|
63
|
+
disableJSDOM();
|
|
64
|
+
});
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
container = new inversify_1.Container();
|
|
67
|
+
shellServer = {
|
|
68
|
+
execute: sinon.stub().resolves(createResult()),
|
|
69
|
+
cancel: sinon.stub().resolves(true)
|
|
70
|
+
};
|
|
71
|
+
const workspaceService = {
|
|
72
|
+
getWorkspaceRootUri: () => new uri_1.default('file:///workspace')
|
|
73
|
+
};
|
|
74
|
+
container.bind(shell_execution_server_1.ShellExecutionServer).toConstantValue(shellServer);
|
|
75
|
+
container.bind(workspace_service_1.WorkspaceService).toConstantValue(workspaceService);
|
|
76
|
+
container.bind(TestPredefinedShellTool).toSelf();
|
|
77
|
+
tool = container.get(TestPredefinedShellTool);
|
|
78
|
+
});
|
|
79
|
+
it('exposes the subclass id and description on the tool', () => {
|
|
80
|
+
const request = tool.getTool();
|
|
81
|
+
(0, chai_1.expect)(request.id).to.equal('test-predefined');
|
|
82
|
+
(0, chai_1.expect)(request.name).to.equal('test-predefined');
|
|
83
|
+
(0, chai_1.expect)(request.description).to.equal('A test predefined shell tool that returns hello');
|
|
84
|
+
(0, chai_1.expect)(request.providerName).to.equal(predefined_shell_tool_1.PREDEFINED_SHELL_TOOL_PROVIDER);
|
|
85
|
+
});
|
|
86
|
+
it('does not declare checkAutoAction so confirmation flows through the normal ToolConfirmationManager', () => {
|
|
87
|
+
const request = tool.getTool();
|
|
88
|
+
(0, chai_1.expect)(request.checkAutoAction).to.be.undefined;
|
|
89
|
+
});
|
|
90
|
+
it('passes the hardcoded command, workspace root and a generated execution id to ShellExecutionServer', async () => {
|
|
91
|
+
const request = tool.getTool();
|
|
92
|
+
await request.handler('{}');
|
|
93
|
+
(0, chai_1.expect)(shellServer.execute.calledOnce).to.be.true;
|
|
94
|
+
const arg = shellServer.execute.firstCall.args[0];
|
|
95
|
+
(0, chai_1.expect)(arg.command).to.equal('echo hello');
|
|
96
|
+
// URI.fsPath() uses the platform-native separator, so the cwd comes back as
|
|
97
|
+
// `\workspace` on Windows. Normalize before asserting to keep the test platform-agnostic.
|
|
98
|
+
(0, chai_1.expect)(arg.cwd?.replace(/\\/g, '/')).to.equal('/workspace');
|
|
99
|
+
(0, chai_1.expect)(arg.timeout).to.equal(30_000);
|
|
100
|
+
(0, chai_1.expect)(typeof arg.executionId).to.equal('string');
|
|
101
|
+
(0, chai_1.expect)(arg.executionId.length).to.be.greaterThan(0);
|
|
102
|
+
});
|
|
103
|
+
it('forwards typed args to buildCommand', async () => {
|
|
104
|
+
const request = tool.getTool();
|
|
105
|
+
await request.handler(JSON.stringify({ upper: true }));
|
|
106
|
+
const arg = shellServer.execute.firstCall.args[0];
|
|
107
|
+
(0, chai_1.expect)(arg.command).to.equal('echo HELLO');
|
|
108
|
+
});
|
|
109
|
+
it('forwards the same typed args to resolveWorkspaceRoot, so the cwd can depend on them', async () => {
|
|
110
|
+
await tool.getTool().handler(JSON.stringify({ cwd: '/elsewhere' }));
|
|
111
|
+
const arg = shellServer.execute.firstCall.args[0];
|
|
112
|
+
(0, chai_1.expect)(arg.cwd).to.equal('/elsewhere');
|
|
113
|
+
});
|
|
114
|
+
it('handles an empty argument string as an empty args object', async () => {
|
|
115
|
+
const request = tool.getTool();
|
|
116
|
+
await request.handler('');
|
|
117
|
+
const arg = shellServer.execute.firstCall.args[0];
|
|
118
|
+
(0, chai_1.expect)(arg.command).to.equal('echo hello');
|
|
119
|
+
});
|
|
120
|
+
it('returns a formatted result with combined output', async () => {
|
|
121
|
+
shellServer.execute.resolves(createResult({ stdout: 'out\n', stderr: 'err\n' }));
|
|
122
|
+
const request = tool.getTool();
|
|
123
|
+
const raw = await request.handler('{}');
|
|
124
|
+
(0, chai_1.expect)(raw).to.deep.include({
|
|
125
|
+
success: true,
|
|
126
|
+
exitCode: 0
|
|
127
|
+
});
|
|
128
|
+
const result = raw;
|
|
129
|
+
(0, chai_1.expect)(result.output).to.contain('out');
|
|
130
|
+
(0, chai_1.expect)(result.output).to.contain('err');
|
|
131
|
+
});
|
|
132
|
+
it('returns a canceled result when the underlying execution is canceled', async () => {
|
|
133
|
+
shellServer.execute.resolves(createResult({ canceled: true, stdout: 'partial\n', stderr: '' }));
|
|
134
|
+
const request = tool.getTool();
|
|
135
|
+
const result = await request.handler('{}');
|
|
136
|
+
(0, chai_1.expect)(result.canceled).to.be.true;
|
|
137
|
+
(0, chai_1.expect)(result.output).to.contain('partial');
|
|
138
|
+
});
|
|
139
|
+
it('wires the invocation cancellation token to ShellExecutionServer.cancel', async () => {
|
|
140
|
+
const cts = new cancellation_1.CancellationTokenSource();
|
|
141
|
+
const request = tool.getTool();
|
|
142
|
+
let capturedExecutionId;
|
|
143
|
+
shellServer.execute.callsFake(async (req) => {
|
|
144
|
+
capturedExecutionId = req.executionId;
|
|
145
|
+
return new Promise(resolve => {
|
|
146
|
+
cts.token.onCancellationRequested(() => resolve(createResult({ canceled: true, stdout: '', stderr: '' })));
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
const handlerPromise = request.handler('{}', { toolCallId: 'tc-1', cancellationToken: cts.token });
|
|
150
|
+
cts.cancel();
|
|
151
|
+
await handlerPromise;
|
|
152
|
+
(0, chai_1.expect)(shellServer.cancel.calledOnce).to.be.true;
|
|
153
|
+
(0, chai_1.expect)(shellServer.cancel.firstCall.args[0]).to.equal(capturedExecutionId);
|
|
154
|
+
});
|
|
155
|
+
it('tracks the execution by tool call id so it can be cancelled by id', async () => {
|
|
156
|
+
let capturedExecutionId;
|
|
157
|
+
let release;
|
|
158
|
+
shellServer.execute.callsFake(async (req) => {
|
|
159
|
+
capturedExecutionId = req.executionId;
|
|
160
|
+
return new Promise(resolve => {
|
|
161
|
+
release = () => resolve(createResult());
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
const handlerPromise = tool.getTool().handler('{}', { toolCallId: 'tc-1' });
|
|
165
|
+
(0, chai_1.expect)(tool.isExecutionRunning('tc-1')).to.be.true;
|
|
166
|
+
(0, chai_1.expect)(await tool.cancelExecution('tc-1')).to.be.true;
|
|
167
|
+
(0, chai_1.expect)(shellServer.cancel.firstCall.args[0]).to.equal(capturedExecutionId);
|
|
168
|
+
release();
|
|
169
|
+
await handlerPromise;
|
|
170
|
+
(0, chai_1.expect)(tool.isExecutionRunning('tc-1')).to.be.false;
|
|
171
|
+
});
|
|
172
|
+
it('applies the default truncation budget, keeping only the first and last 50 lines', async () => {
|
|
173
|
+
const stdout = Array.from({ length: 500 }, (_unused, index) => `line ${index}`).join('\n');
|
|
174
|
+
shellServer.execute.resolves(createResult({ stdout }));
|
|
175
|
+
const result = await tool.getTool().handler('{}');
|
|
176
|
+
(0, chai_1.expect)(result.output).to.contain('line 0');
|
|
177
|
+
(0, chai_1.expect)(result.output).to.contain('line 499');
|
|
178
|
+
(0, chai_1.expect)(result.output).to.not.contain('line 250');
|
|
179
|
+
(0, chai_1.expect)(result.output).to.contain('400 lines omitted');
|
|
180
|
+
});
|
|
181
|
+
it('honours a raised truncation budget declared by the subclass', async () => {
|
|
182
|
+
class GenerousTool extends TestPredefinedShellTool {
|
|
183
|
+
constructor() {
|
|
184
|
+
super(...arguments);
|
|
185
|
+
this.truncation = { headLines: 400, tailLines: 100 };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
container.bind(GenerousTool).toSelf();
|
|
189
|
+
const generous = container.get(GenerousTool);
|
|
190
|
+
const stdout = Array.from({ length: 500 }, (_unused, index) => `line ${index}`).join('\n');
|
|
191
|
+
shellServer.execute.resolves(createResult({ stdout }));
|
|
192
|
+
const result = await generous.getTool().handler('{}');
|
|
193
|
+
(0, chai_1.expect)(result.output).to.contain('line 250');
|
|
194
|
+
(0, chai_1.expect)(result.output).to.not.contain('lines omitted');
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
//# sourceMappingURL=predefined-shell-tool.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-shell-tool.spec.js","sourceRoot":"","sources":["../../src/browser/predefined-shell-tool.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AACjC,uHAAiH;AACjH,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAE1C,+BAA8B;AAC9B,+BAA+B;AAC/B,4DAAyD;AACzD,sEAA8E;AAC9E,oDAA6C;AAC7C,sFAAkF;AAClF,6EAAqH;AACrH,mEAA8F;AAE9F,YAAY,EAAE,CAAC;AAEf,MAAM,uBAAwB,SAAQ,2CAAmB;IAAzD;;QACa,OAAE,GAAG,iBAAiB,CAAC;QACvB,gBAAW,GAAG,iDAAiD,CAAC;IAU7E,CAAC;IARa,YAAY,CAAC,IAA6B;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC;QAClC,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;IAC/C,CAAC;IAES,oBAAoB,CAAC,IAA6B;QACxD,OAAO,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC/E,CAAC;CACJ;AAED,SAAS,YAAY,CAAC,YAA2C,EAAE;IAC/D,OAAO;QACH,OAAO,EAAE,IAAI;QAC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AAM,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3F,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAEvD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAuB,CAAC;QAE5E,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ToolRequest } from '@theia/ai-core';
|
|
2
2
|
import { ShellCommandPermissionService } from './shell-command-permission-service';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare class ShellExecutionTool implements ToolProvider {
|
|
7
|
-
protected readonly shellServer: ShellExecutionServer;
|
|
8
|
-
protected readonly workspaceService: WorkspaceService;
|
|
3
|
+
import { AbstractShellExecutionTool } from './abstract-shell-execution-tool';
|
|
4
|
+
import { ShellExecutionToolResult, ShellExecutionCanceledResult } from '../common/shell-execution-server';
|
|
5
|
+
export declare class ShellExecutionTool extends AbstractShellExecutionTool {
|
|
9
6
|
protected readonly shellCommandPermissionService: ShellCommandPermissionService;
|
|
10
|
-
protected readonly runningExecutions: Map<string, string>;
|
|
11
|
-
cancelExecution(toolCallId: string): Promise<boolean>;
|
|
12
|
-
isExecutionRunning(toolCallId: string): boolean;
|
|
13
7
|
getTool(): ToolRequest;
|
|
14
8
|
protected executeCommand(argString: string, ctx?: unknown): Promise<ShellExecutionToolResult | ShellExecutionCanceledResult>;
|
|
15
9
|
/**
|
|
@@ -18,8 +12,5 @@ export declare class ShellExecutionTool implements ToolProvider {
|
|
|
18
12
|
* root-relative paths (<rootName>/...), and bare root names.
|
|
19
13
|
*/
|
|
20
14
|
private resolveCwd;
|
|
21
|
-
protected extractToolCallId(ctx?: unknown): string | undefined;
|
|
22
|
-
protected extractCancellationToken(ctx: unknown): CancellationToken | undefined;
|
|
23
|
-
protected combineAndTruncate(stdout: string, stderr: string): string;
|
|
24
15
|
}
|
|
25
16
|
//# sourceMappingURL=shell-execution-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-execution-tool.d.ts","sourceRoot":"","sources":["../../src/browser/shell-execution-tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shell-execution-tool.d.ts","sourceRoot":"","sources":["../../src/browser/shell-execution-tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAEH,wBAAwB,EACxB,4BAA4B,EAC/B,MAAM,kCAAkC,CAAC;AAG1C,qBACa,kBAAmB,SAAQ,0BAA0B;IAG9D,SAAS,CAAC,QAAQ,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;IAEhF,OAAO,IAAI,WAAW;cA2GN,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,GAAG,4BAA4B,CAAC;IAelI;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAyCrB"}
|