@elizaos/plugin-shell 1.2.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/clearHistory.d.ts +4 -0
- package/dist/actions/clearHistory.d.ts.map +1 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/approvals/allowlist.d.ts +76 -0
- package/dist/approvals/allowlist.d.ts.map +1 -0
- package/dist/approvals/analysis.d.ts +76 -0
- package/dist/approvals/analysis.d.ts.map +1 -0
- package/dist/approvals/index.d.ts +12 -0
- package/dist/approvals/index.d.ts.map +1 -0
- package/dist/approvals/service.d.ts +121 -0
- package/dist/approvals/service.d.ts.map +1 -0
- package/dist/approvals/types.d.ts +219 -0
- package/dist/approvals/types.d.ts.map +1 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/generated/prompts/typescript/prompts.d.ts +12 -0
- package/dist/generated/prompts/typescript/prompts.d.ts.map +1 -0
- package/dist/generated/specs/spec-helpers.d.ts +49 -0
- package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
- package/dist/generated/specs/specs.d.ts +73 -0
- package/dist/generated/specs/specs.d.ts.map +1 -0
- package/dist/index.browser.d.ts +4 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +14 -106
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5161 -916
- package/dist/index.js.map +35 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/shellHistoryProvider.d.ts +4 -0
- package/dist/providers/shellHistoryProvider.d.ts.map +1 -0
- package/dist/providers/terminalUsage.d.ts +3 -0
- package/dist/providers/terminalUsage.d.ts.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/processRegistry.d.ts +25 -0
- package/dist/services/processRegistry.d.ts.map +1 -0
- package/dist/services/shellService.d.ts +91 -0
- package/dist/services/shellService.d.ts.map +1 -0
- package/dist/types/index.d.ts +144 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/pathUtils.d.ts +5 -0
- package/dist/utils/pathUtils.d.ts.map +1 -0
- package/dist/utils/processQueue.d.ts +136 -0
- package/dist/utils/processQueue.d.ts.map +1 -0
- package/dist/utils/ptyKeys.d.ts +23 -0
- package/dist/utils/ptyKeys.d.ts.map +1 -0
- package/dist/utils/shellArgv.d.ts +37 -0
- package/dist/utils/shellArgv.d.ts.map +1 -0
- package/dist/utils/shellUtils.d.ts +103 -0
- package/dist/utils/shellUtils.d.ts.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/package.json +125 -38
- package/LICENSE +0 -21
- package/README.md +0 -352
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated canonical action/provider/evaluator docs for plugin-shell.
|
|
3
|
+
* DO NOT EDIT - Generated from prompts/specs/**.
|
|
4
|
+
*/
|
|
5
|
+
export type ActionDoc = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
similes?: readonly string[];
|
|
9
|
+
parameters?: readonly unknown[];
|
|
10
|
+
examples?: readonly (readonly unknown[])[];
|
|
11
|
+
};
|
|
12
|
+
export type ProviderDoc = {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
position?: number;
|
|
16
|
+
dynamic?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type EvaluatorDoc = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
similes?: readonly string[];
|
|
22
|
+
alwaysRun?: boolean;
|
|
23
|
+
examples?: readonly unknown[];
|
|
24
|
+
};
|
|
25
|
+
export declare const coreActionsSpec: {
|
|
26
|
+
readonly version: "1.0.0";
|
|
27
|
+
readonly actions: readonly [{
|
|
28
|
+
readonly name: "CLEAR_SHELL_HISTORY";
|
|
29
|
+
readonly description: "Clears the recorded history of shell commands for the current conversation";
|
|
30
|
+
readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
|
|
31
|
+
readonly parameters: readonly [];
|
|
32
|
+
}];
|
|
33
|
+
};
|
|
34
|
+
export declare const allActionsSpec: {
|
|
35
|
+
readonly version: "1.0.0";
|
|
36
|
+
readonly actions: readonly [{
|
|
37
|
+
readonly name: "CLEAR_SHELL_HISTORY";
|
|
38
|
+
readonly description: "Clears the recorded history of shell commands for the current conversation";
|
|
39
|
+
readonly similes: readonly ["RESET_SHELL", "CLEAR_TERMINAL", "CLEAR_HISTORY", "RESET_HISTORY"];
|
|
40
|
+
readonly parameters: readonly [];
|
|
41
|
+
}];
|
|
42
|
+
};
|
|
43
|
+
export declare const coreProvidersSpec: {
|
|
44
|
+
readonly version: "1.0.0";
|
|
45
|
+
readonly providers: readonly [{
|
|
46
|
+
readonly name: "SHELL_HISTORY";
|
|
47
|
+
readonly description: "Provides recent shell command history, current working directory, and file operations within the restricted environment";
|
|
48
|
+
readonly dynamic: true;
|
|
49
|
+
}];
|
|
50
|
+
};
|
|
51
|
+
export declare const allProvidersSpec: {
|
|
52
|
+
readonly version: "1.0.0";
|
|
53
|
+
readonly providers: readonly [{
|
|
54
|
+
readonly name: "SHELL_HISTORY";
|
|
55
|
+
readonly description: "Provides recent shell command history, current working directory, and file operations within the restricted environment";
|
|
56
|
+
readonly dynamic: true;
|
|
57
|
+
}];
|
|
58
|
+
};
|
|
59
|
+
export declare const coreEvaluatorsSpec: {
|
|
60
|
+
readonly version: "1.0.0";
|
|
61
|
+
readonly evaluators: readonly [];
|
|
62
|
+
};
|
|
63
|
+
export declare const allEvaluatorsSpec: {
|
|
64
|
+
readonly version: "1.0.0";
|
|
65
|
+
readonly evaluators: readonly [];
|
|
66
|
+
};
|
|
67
|
+
export declare const coreActionDocs: readonly ActionDoc[];
|
|
68
|
+
export declare const allActionDocs: readonly ActionDoc[];
|
|
69
|
+
export declare const coreProviderDocs: readonly ProviderDoc[];
|
|
70
|
+
export declare const allProviderDocs: readonly ProviderDoc[];
|
|
71
|
+
export declare const coreEvaluatorDocs: readonly EvaluatorDoc[];
|
|
72
|
+
export declare const allEvaluatorDocs: readonly EvaluatorDoc[];
|
|
73
|
+
//# sourceMappingURL=specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../generated/specs/specs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;CAgBlB,CAAC;AACX,eAAO,MAAM,cAAc;;;;;;;;CAgBjB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;CAUpB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;CAUnB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAA4B,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAA2B,CAAC;AAC1E,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EACvB,CAAC;AAC7B,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EACvB,CAAC;AAC5B,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EACvB,CAAC;AAC/B,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAK3D,eAAO,MAAM,WAAW,EAAE,MAQzB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,106 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exitCode: number | null;
|
|
16
|
-
timestamp: number;
|
|
17
|
-
workingDirectory: string;
|
|
18
|
-
fileOperations?: FileOperation[];
|
|
19
|
-
}
|
|
20
|
-
interface FileOperation {
|
|
21
|
-
type: 'create' | 'write' | 'read' | 'delete' | 'mkdir' | 'move' | 'copy';
|
|
22
|
-
target: string;
|
|
23
|
-
secondaryTarget?: string;
|
|
24
|
-
}
|
|
25
|
-
declare class ShellService extends Service {
|
|
26
|
-
static serviceType: string;
|
|
27
|
-
private shellConfig;
|
|
28
|
-
private currentDirectory;
|
|
29
|
-
private commandHistory;
|
|
30
|
-
private maxHistoryPerConversation;
|
|
31
|
-
constructor(runtime: IAgentRuntime);
|
|
32
|
-
static start(runtime: IAgentRuntime): Promise<ShellService>;
|
|
33
|
-
stop(): Promise<void>;
|
|
34
|
-
get capabilityDescription(): string;
|
|
35
|
-
/**
|
|
36
|
-
* Executes a shell command within the allowed directory
|
|
37
|
-
* @param command The command to execute
|
|
38
|
-
* @param conversationId Optional conversation ID for history tracking
|
|
39
|
-
* @returns The command execution result
|
|
40
|
-
*/
|
|
41
|
-
executeCommand(command: string, conversationId?: string): Promise<CommandResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Handles the cd command to change directory within allowed bounds
|
|
44
|
-
* @param command The cd command
|
|
45
|
-
* @returns The command result
|
|
46
|
-
*/
|
|
47
|
-
private handleCdCommand;
|
|
48
|
-
/**
|
|
49
|
-
* Runs a command using cross-spawn
|
|
50
|
-
* @param command The command to run
|
|
51
|
-
* @returns The command result
|
|
52
|
-
*/
|
|
53
|
-
private runCommand;
|
|
54
|
-
/**
|
|
55
|
-
* Adds a command to the history
|
|
56
|
-
*/
|
|
57
|
-
private addToHistory;
|
|
58
|
-
/**
|
|
59
|
-
* Detects file operations from a command
|
|
60
|
-
*/
|
|
61
|
-
private detectFileOperations;
|
|
62
|
-
/**
|
|
63
|
-
* Resolves a path relative to the current working directory
|
|
64
|
-
*/
|
|
65
|
-
private resolvePath;
|
|
66
|
-
/**
|
|
67
|
-
* Gets command history for a conversation
|
|
68
|
-
*/
|
|
69
|
-
getCommandHistory(conversationId: string, limit?: number): CommandHistoryEntry[];
|
|
70
|
-
/**
|
|
71
|
-
* Clears command history for a conversation
|
|
72
|
-
*/
|
|
73
|
-
clearCommandHistory(conversationId: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* Gets the current working directory
|
|
76
|
-
* @param conversationId Optional conversation ID to get conversation-specific directory
|
|
77
|
-
* @returns The current directory path
|
|
78
|
-
*/
|
|
79
|
-
getCurrentDirectory(_conversationId?: string): string;
|
|
80
|
-
/**
|
|
81
|
-
* Gets the allowed directory
|
|
82
|
-
* @returns The allowed directory path
|
|
83
|
-
*/
|
|
84
|
-
getAllowedDirectory(): string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare const executeCommand: Action;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Shell plugin environment configuration
|
|
91
|
-
*/
|
|
92
|
-
interface ShellConfig {
|
|
93
|
-
enabled: boolean;
|
|
94
|
-
allowedDirectory: string;
|
|
95
|
-
timeout: number;
|
|
96
|
-
forbiddenCommands: string[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Loads and validates the shell plugin configuration
|
|
100
|
-
* @returns The validated configuration
|
|
101
|
-
*/
|
|
102
|
-
declare function loadShellConfig(): ShellConfig;
|
|
103
|
-
|
|
104
|
-
declare const shellPlugin: Plugin;
|
|
105
|
-
|
|
106
|
-
export { type CommandResult, type ShellConfig, ShellService, shellPlugin as default, executeCommand, loadShellConfig, shellPlugin };
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
export declare const shellPlugin: Plugin;
|
|
3
|
+
export default shellPlugin;
|
|
4
|
+
export { clearHistory } from "./actions/clearHistory";
|
|
5
|
+
export { addAllowlistEntry, analyzeShellCommand, type CommandCheckResult, type CommandResolution, DEFAULT_SAFE_BINS, EXEC_APPROVAL_DEFAULTS, type ExecAllowlistAnalysis, type ExecAllowlistEntry, type ExecAllowlistEvaluation, type ExecApprovalDecision, type ExecApprovalRequest, type ExecApprovalResult, ExecApprovalService, type ExecApprovalsAgent, type ExecApprovalsDefaults, type ExecApprovalsFile, type ExecApprovalsResolved, type ExecApprovalsSnapshot, type ExecAsk, type ExecCommandAnalysis, type ExecCommandSegment, type ExecHost, type ExecSecurity, ensureApprovals, evaluateExecAllowlist, evaluateShellAllowlist, getApprovalFilePath, getApprovalSocketPath, isSafeBinUsage, loadApprovals, matchAllowlist, maxAsk, minSecurity, normalizeApprovals, normalizeSafeBins, readApprovalsSnapshot, recordAllowlistUse, requiresExecApproval, resolveApprovals, resolveApprovalsFromFile, resolveCommandFromArgv, resolveCommandResolution, resolveSafeBins, saveApprovals, } from "./approvals";
|
|
6
|
+
export { terminalUsageProvider } from "./providers/terminalUsage";
|
|
7
|
+
export { shellHistoryProvider } from "./providers/shellHistoryProvider";
|
|
8
|
+
export { addSession, appendOutput, clearFinished, createSessionSlug, deleteSession, drainSession, getFinishedSession, getSession, listFinishedSessions, listRunningSessions, markBackgrounded, markExited, resetProcessRegistryForTests, setJobTtlMs, tail, trimWithCap, } from "./services/processRegistry";
|
|
9
|
+
export { ShellService } from "./services/shellService";
|
|
10
|
+
export type { CommandHistoryEntry, CommandResult, ExecResult, ExecuteOptions, FileOperation, FileOperationType, FinishedSession, ProcessAction, ProcessActionParams, ProcessSession, ProcessStatus, PtyExitEvent, PtyHandle, PtyListener, PtySpawn, SessionStdin, ShellConfig, } from "./types";
|
|
11
|
+
export { DEFAULT_FORBIDDEN_COMMANDS, extractBaseCommand, isForbiddenCommand, isSafeCommand, loadShellConfig, validatePath, } from "./utils";
|
|
12
|
+
export { BRACKETED_PASTE_END, BRACKETED_PASTE_START, buildCursorPositionResponse, encodeKeySequence, encodePaste, type KeyEncodingRequest, type KeyEncodingResult, stripDsrRequests, } from "./utils/ptyKeys";
|
|
13
|
+
export { chunkString, clampNumber, coerceEnv, deriveSessionName, formatDuration, formatSpawnError, getShellConfig, killProcessTree, killSession, pad, readEnvInt, resolveWorkdir, type SpawnFallback, type SpawnWithFallbackResult, sanitizeBinaryOutput, sliceLogLines, sliceUtf16Safe, spawnWithFallback, truncateMiddle, } from "./utils/shellUtils";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","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