@prbe.ai/electron-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/agent.d.ts +105 -0
  2. package/dist/agent.d.ts.map +1 -0
  3. package/dist/agent.js +861 -0
  4. package/dist/agent.js.map +1 -0
  5. package/dist/assets/index.d.ts +6 -0
  6. package/dist/assets/index.d.ts.map +1 -0
  7. package/dist/assets/index.js +13 -0
  8. package/dist/assets/index.js.map +1 -0
  9. package/dist/index.d.ts +16 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +62 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/interactions.d.ts +56 -0
  14. package/dist/interactions.d.ts.map +1 -0
  15. package/dist/interactions.js +27 -0
  16. package/dist/interactions.js.map +1 -0
  17. package/dist/models.d.ts +212 -0
  18. package/dist/models.d.ts.map +1 -0
  19. package/dist/models.js +120 -0
  20. package/dist/models.js.map +1 -0
  21. package/dist/serialization.d.ts +49 -0
  22. package/dist/serialization.d.ts.map +1 -0
  23. package/dist/serialization.js +69 -0
  24. package/dist/serialization.js.map +1 -0
  25. package/dist/state.d.ts +67 -0
  26. package/dist/state.d.ts.map +1 -0
  27. package/dist/state.js +270 -0
  28. package/dist/state.js.map +1 -0
  29. package/dist/tools/bash.d.ts +30 -0
  30. package/dist/tools/bash.d.ts.map +1 -0
  31. package/dist/tools/bash.js +247 -0
  32. package/dist/tools/bash.js.map +1 -0
  33. package/dist/tools/filesystem.d.ts +63 -0
  34. package/dist/tools/filesystem.d.ts.map +1 -0
  35. package/dist/tools/filesystem.js +573 -0
  36. package/dist/tools/filesystem.js.map +1 -0
  37. package/dist/tools/index.d.ts +46 -0
  38. package/dist/tools/index.d.ts.map +1 -0
  39. package/dist/tools/index.js +171 -0
  40. package/dist/tools/index.js.map +1 -0
  41. package/dist/tools/interactive.d.ts +15 -0
  42. package/dist/tools/interactive.d.ts.map +1 -0
  43. package/dist/tools/interactive.js +57 -0
  44. package/dist/tools/interactive.js.map +1 -0
  45. package/dist/tools/logs.d.ts +72 -0
  46. package/dist/tools/logs.d.ts.map +1 -0
  47. package/dist/tools/logs.js +366 -0
  48. package/dist/tools/logs.js.map +1 -0
  49. package/dist/types.d.ts +14 -0
  50. package/dist/types.d.ts.map +1 -0
  51. package/dist/types.js +32 -0
  52. package/dist/types.js.map +1 -0
  53. package/package.json +35 -0
  54. package/src/assets/probe-mark.svg +5 -0
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ /**
3
+ * tools/bash.ts — BashExecuteTool
4
+ *
5
+ * Allows the agent to execute shell commands during investigations.
6
+ * Uses a whitelist-only safety model: commands on the whitelist run without
7
+ * permission; everything else requires user approval.
8
+ *
9
+ * Platform-aware: uses separate whitelists for Unix and Windows, and
10
+ * runs commands via PowerShell on Windows for consistent behavior.
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.BashExecuteTool = void 0;
47
+ const child_process_1 = require("child_process");
48
+ const crypto_1 = require("crypto");
49
+ const path = __importStar(require("path"));
50
+ const models_1 = require("../models");
51
+ const interactions_1 = require("../interactions");
52
+ const index_1 = require("./index");
53
+ // ---------------------------------------------------------------------------
54
+ // Platform detection
55
+ // ---------------------------------------------------------------------------
56
+ const IS_WINDOWS = process.platform === "win32";
57
+ // ---------------------------------------------------------------------------
58
+ // Safe commands whitelist (read-only / informational only)
59
+ // ---------------------------------------------------------------------------
60
+ const UNIX_SAFE_COMMANDS = new Set([
61
+ "ls", "cat", "head", "tail", "grep", "rg", "find", "which",
62
+ "whoami", "pwd", "echo", "printf", "wc", "sort", "uniq",
63
+ "diff", "file", "stat", "du", "df", "uname", "env", "printenv",
64
+ "date", "id", "hostname", "ps", "top", "uptime", "free",
65
+ ]);
66
+ const WINDOWS_SAFE_COMMANDS = new Set([
67
+ "dir", "type", "findstr", "where", "whoami", "echo",
68
+ "sort", "fc", "hostname", "date", "systeminfo", "tasklist",
69
+ "set", "ver", "vol", "tree",
70
+ // PowerShell cmdlets (when shell is PowerShell)
71
+ "get-childitem", "get-content", "select-string", "get-process",
72
+ "get-date", "get-host", "get-computerinfo", "get-volume",
73
+ "test-path", "resolve-path", "measure-object",
74
+ ]);
75
+ const SAFE_COMMANDS = IS_WINDOWS ? WINDOWS_SAFE_COMMANDS : UNIX_SAFE_COMMANDS;
76
+ /** Two-word commands that are also safe (cross-platform — git/node/npm) */
77
+ const SAFE_COMMAND_PREFIXES = new Set([
78
+ "git status",
79
+ "git log",
80
+ "git diff",
81
+ "git show",
82
+ "git branch",
83
+ "node --version",
84
+ "npm --version",
85
+ "npm list",
86
+ "npm ls",
87
+ ]);
88
+ const MAX_OUTPUT_BYTES = 100 * 1024; // 100KB
89
+ const DEFAULT_TIMEOUT_MS = 30_000;
90
+ const MAX_TIMEOUT_MS = 120_000;
91
+ // ---------------------------------------------------------------------------
92
+ // BashExecuteTool
93
+ // ---------------------------------------------------------------------------
94
+ class BashExecuteTool {
95
+ requester;
96
+ allowedRoots;
97
+ grantedPaths;
98
+ constructor(requester, allowedRoots, grantedPaths) {
99
+ this.requester = requester;
100
+ this.allowedRoots = allowedRoots;
101
+ this.grantedPaths = grantedPaths;
102
+ }
103
+ get declaration() {
104
+ return {
105
+ name: models_1.ToolName.CLIENT_BASH_EXECUTE,
106
+ description: "Execute a shell command on the user's machine. Safe read-only commands run immediately; potentially destructive commands require user approval first.",
107
+ parameters: [
108
+ {
109
+ name: "command",
110
+ type: models_1.ToolParamType.STRING,
111
+ description: "The shell command to execute",
112
+ required: true,
113
+ },
114
+ {
115
+ name: "cwd",
116
+ type: models_1.ToolParamType.STRING,
117
+ description: "Working directory for the command (must be within allowed roots)",
118
+ required: false,
119
+ },
120
+ {
121
+ name: "timeout",
122
+ type: models_1.ToolParamType.INTEGER,
123
+ description: "Timeout in seconds (default 30, max 120)",
124
+ required: false,
125
+ },
126
+ ],
127
+ };
128
+ }
129
+ async execute(args) {
130
+ const command = args["command"];
131
+ if (!command)
132
+ return "Error: 'command' parameter is required";
133
+ const cwdArg = args["cwd"];
134
+ const timeoutSec = typeof args["timeout"] === "number" ? args["timeout"] : DEFAULT_TIMEOUT_MS / 1000;
135
+ const timeoutMs = Math.min(timeoutSec * 1000, MAX_TIMEOUT_MS);
136
+ // Validate cwd if provided
137
+ let cwd;
138
+ if (cwdArg) {
139
+ const allRoots = [...this.allowedRoots, ...this.grantedPaths];
140
+ const resolved = (0, index_1.resolveAndValidate)(cwdArg, allRoots);
141
+ if (!resolved) {
142
+ return `Error: working directory '${cwdArg}' is outside allowed roots`;
143
+ }
144
+ cwd = resolved;
145
+ }
146
+ // Check if command is safe (whitelist-only)
147
+ const isSafe = this.isCommandSafe(command);
148
+ if (!isSafe) {
149
+ const response = await this.requester.requestUserInteraction({
150
+ type: interactions_1.InteractionType.REQUEST_PERMISSION,
151
+ interactionId: (0, crypto_1.randomUUID)(),
152
+ action: "Execute shell command",
153
+ command,
154
+ reason: `The agent wants to run this command${cwd ? ` in ${cwd}` : ""}.`,
155
+ });
156
+ const permResponse = response;
157
+ if (!permResponse.approved) {
158
+ return "Command execution denied by user.";
159
+ }
160
+ }
161
+ // Execute the command
162
+ return new Promise((resolve) => {
163
+ (0, child_process_1.exec)(command, {
164
+ cwd,
165
+ timeout: timeoutMs,
166
+ maxBuffer: MAX_OUTPUT_BYTES,
167
+ env: process.env,
168
+ // On Windows, use PowerShell for more consistent behavior
169
+ ...(IS_WINDOWS ? { shell: "powershell.exe" } : {}),
170
+ }, (error, stdout, stderr) => {
171
+ let output = "";
172
+ if (stdout) {
173
+ output += stdout;
174
+ }
175
+ if (stderr) {
176
+ if (output)
177
+ output += "\n--- stderr ---\n";
178
+ output += stderr;
179
+ }
180
+ if (error) {
181
+ if (error.killed) {
182
+ output += `\n[Command timed out after ${timeoutSec}s]`;
183
+ }
184
+ else if (!stdout && !stderr) {
185
+ output = `Error: ${error.message}`;
186
+ }
187
+ }
188
+ // Truncate if too large
189
+ if (Buffer.byteLength(output, "utf-8") > MAX_OUTPUT_BYTES) {
190
+ output = output.slice(0, MAX_OUTPUT_BYTES) + "\n[Output truncated at 100KB]";
191
+ }
192
+ resolve(output || "(no output)");
193
+ });
194
+ });
195
+ }
196
+ /**
197
+ * Check if a command is on the safe whitelist.
198
+ */
199
+ isCommandSafe(command) {
200
+ const trimmed = command.trim();
201
+ // Check two-word prefixes first (e.g. "git status")
202
+ for (const prefix of SAFE_COMMAND_PREFIXES) {
203
+ if (trimmed === prefix || trimmed.startsWith(prefix + " ")) {
204
+ return true;
205
+ }
206
+ }
207
+ // Extract base command
208
+ const firstCommand = IS_WINDOWS
209
+ ? trimmed.split(/[|;]/, 1)[0].trim() // PowerShell uses | and ;
210
+ : trimmed.split(/[|;&]/, 1)[0].trim(); // bash uses |, ;, &
211
+ const baseCommand = firstCommand.split(/\s+/, 1)[0];
212
+ const commandName = IS_WINDOWS
213
+ ? baseCommand.toLowerCase() // Windows commands are case-insensitive
214
+ : path.basename(baseCommand);
215
+ if (SAFE_COMMANDS.has(commandName)) {
216
+ return this.areAllPipeSegmentsSafe(trimmed);
217
+ }
218
+ return false;
219
+ }
220
+ /**
221
+ * For piped commands, check that every segment uses a safe command.
222
+ */
223
+ areAllPipeSegmentsSafe(command) {
224
+ // Chained commands (;, &&, ||) require permission
225
+ if (IS_WINDOWS) {
226
+ if (/;/.test(command) && command.split("|").length <= 1)
227
+ return false;
228
+ }
229
+ else {
230
+ if (/[;&]|&&|\|\|/.test(command))
231
+ return false;
232
+ }
233
+ const segments = command.split("|").map((s) => s.trim());
234
+ for (const segment of segments) {
235
+ const baseCommand = segment.split(/\s+/, 1)[0];
236
+ const commandName = IS_WINDOWS
237
+ ? baseCommand.toLowerCase()
238
+ : path.basename(baseCommand);
239
+ if (!SAFE_COMMANDS.has(commandName)) {
240
+ return false;
241
+ }
242
+ }
243
+ return true;
244
+ }
245
+ }
246
+ exports.BashExecuteTool = BashExecuteTool;
247
+ //# sourceMappingURL=bash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAqC;AACrC,mCAAoC;AACpC,2CAA6B;AAE7B,sCAAoD;AACpD,kDAAkD;AAGlD,mCAA6C;AAE7C,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAEhD,8EAA8E;AAC9E,2DAA2D;AAC3D,8EAA8E;AAE9E,MAAM,kBAAkB,GAAG,IA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IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,WAAW,GAAG,UAAU;gBAC5B,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE;gBAC3B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAC/B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/KD,0CA+KC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * tools/filesystem.ts — Built-in filesystem tools
3
+ *
4
+ * Implements: client_list_directory, client_read_file, client_search_content,
5
+ * client_find_files, client_flag_file
6
+ *
7
+ * Mirrors PRBEAgentTools.swift filesystem tool implementations.
8
+ */
9
+ import type { PRBEToolDeclaration, FlaggedFileIn } from "../models";
10
+ import type { PRBEInteractionRequester } from "../interactions";
11
+ import type { PRBETool } from "./index";
12
+ export declare class ListDirectoryTool implements PRBETool {
13
+ private readonly allowedRoots;
14
+ private readonly requester?;
15
+ private readonly grantedPaths?;
16
+ constructor(allowedRoots: string[], requester?: PRBEInteractionRequester, grantedPaths?: Set<string>);
17
+ get declaration(): PRBEToolDeclaration;
18
+ execute(args: Record<string, unknown>): Promise<string>;
19
+ private static readonly MAX_ENTRIES;
20
+ private listDir;
21
+ }
22
+ export declare class ReadFileTool implements PRBETool {
23
+ private readonly allowedRoots;
24
+ private readonly requester?;
25
+ private readonly grantedPaths?;
26
+ constructor(allowedRoots: string[], requester?: PRBEInteractionRequester, grantedPaths?: Set<string>);
27
+ get declaration(): PRBEToolDeclaration;
28
+ execute(args: Record<string, unknown>): Promise<string>;
29
+ }
30
+ export declare class SearchContentTool implements PRBETool {
31
+ private readonly allowedRoots;
32
+ private readonly requester?;
33
+ private readonly grantedPaths?;
34
+ constructor(allowedRoots: string[], requester?: PRBEInteractionRequester, grantedPaths?: Set<string>);
35
+ get declaration(): PRBEToolDeclaration;
36
+ execute(args: Record<string, unknown>): Promise<string>;
37
+ private collectFiles;
38
+ }
39
+ export declare class FindFilesTool implements PRBETool {
40
+ private readonly allowedRoots;
41
+ private readonly requester?;
42
+ private readonly grantedPaths?;
43
+ constructor(allowedRoots: string[], requester?: PRBEInteractionRequester, grantedPaths?: Set<string>);
44
+ get declaration(): PRBEToolDeclaration;
45
+ execute(args: Record<string, unknown>): Promise<string>;
46
+ private walkAndMatch;
47
+ /**
48
+ * Simple glob matching: supports *, ?, and character classes [...].
49
+ * Converts glob to regex and tests against the filename.
50
+ */
51
+ private globMatch;
52
+ }
53
+ export declare class FlagFileTool implements PRBETool {
54
+ private readonly allowedRoots;
55
+ private readonly onFlag;
56
+ private readonly requester?;
57
+ private readonly grantedPaths?;
58
+ private static readonly MAX_BINARY_SIZE;
59
+ constructor(allowedRoots: string[], onFlag: (file: FlaggedFileIn) => void, requester?: PRBEInteractionRequester, grantedPaths?: Set<string>);
60
+ get declaration(): PRBEToolDeclaration;
61
+ execute(args: Record<string, unknown>): Promise<string>;
62
+ }
63
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/tools/filesystem.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAuBxC,qBAAa,iBAAkB,YAAW,QAAQ;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAW;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA2B;IACtD,OAAO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