@prbe.ai/electron-sdk 0.1.4 → 0.1.6

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 (61) hide show
  1. package/dist/index.d.mts +332 -0
  2. package/dist/index.d.ts +331 -15
  3. package/dist/index.js +2471 -60
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +2402 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/types-DHT-JxMT.d.mts +401 -0
  8. package/dist/types-DHT-JxMT.d.ts +401 -0
  9. package/dist/types.d.mts +2 -0
  10. package/dist/types.d.ts +2 -14
  11. package/dist/types.js +160 -30
  12. package/dist/types.js.map +1 -1
  13. package/dist/types.mjs +125 -0
  14. package/dist/types.mjs.map +1 -0
  15. package/package.json +22 -8
  16. package/dist/agent.d.ts +0 -106
  17. package/dist/agent.d.ts.map +0 -1
  18. package/dist/agent.js +0 -878
  19. package/dist/agent.js.map +0 -1
  20. package/dist/assets/index.d.ts +0 -6
  21. package/dist/assets/index.d.ts.map +0 -1
  22. package/dist/assets/index.js +0 -13
  23. package/dist/assets/index.js.map +0 -1
  24. package/dist/index.d.ts.map +0 -1
  25. package/dist/interactions.d.ts +0 -63
  26. package/dist/interactions.d.ts.map +0 -1
  27. package/dist/interactions.js +0 -27
  28. package/dist/interactions.js.map +0 -1
  29. package/dist/models.d.ts +0 -218
  30. package/dist/models.d.ts.map +0 -1
  31. package/dist/models.js +0 -121
  32. package/dist/models.js.map +0 -1
  33. package/dist/serialization.d.ts +0 -51
  34. package/dist/serialization.d.ts.map +0 -1
  35. package/dist/serialization.js +0 -72
  36. package/dist/serialization.js.map +0 -1
  37. package/dist/state.d.ts +0 -70
  38. package/dist/state.d.ts.map +0 -1
  39. package/dist/state.js +0 -303
  40. package/dist/state.js.map +0 -1
  41. package/dist/tools/bash.d.ts +0 -30
  42. package/dist/tools/bash.d.ts.map +0 -1
  43. package/dist/tools/bash.js +0 -248
  44. package/dist/tools/bash.js.map +0 -1
  45. package/dist/tools/filesystem.d.ts +0 -63
  46. package/dist/tools/filesystem.d.ts.map +0 -1
  47. package/dist/tools/filesystem.js +0 -573
  48. package/dist/tools/filesystem.js.map +0 -1
  49. package/dist/tools/index.d.ts +0 -46
  50. package/dist/tools/index.d.ts.map +0 -1
  51. package/dist/tools/index.js +0 -171
  52. package/dist/tools/index.js.map +0 -1
  53. package/dist/tools/interactive.d.ts +0 -15
  54. package/dist/tools/interactive.d.ts.map +0 -1
  55. package/dist/tools/interactive.js +0 -58
  56. package/dist/tools/interactive.js.map +0 -1
  57. package/dist/tools/logs.d.ts +0 -72
  58. package/dist/tools/logs.d.ts.map +0 -1
  59. package/dist/tools/logs.js +0 -366
  60. package/dist/tools/logs.js.map +0 -1
  61. package/dist/types.d.ts.map +0 -1
@@ -1,248 +0,0 @@
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
- autoApprovedDirs;
97
- grantedPaths;
98
- constructor(requester, autoApprovedDirs, grantedPaths) {
99
- this.requester = requester;
100
- this.autoApprovedDirs = autoApprovedDirs;
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
- interactive: true,
108
- parameters: [
109
- {
110
- name: "command",
111
- type: models_1.ToolParamType.STRING,
112
- description: "The shell command to execute",
113
- required: true,
114
- },
115
- {
116
- name: "cwd",
117
- type: models_1.ToolParamType.STRING,
118
- description: "Working directory for the command (must be within auto-approved directories)",
119
- required: false,
120
- },
121
- {
122
- name: "timeout",
123
- type: models_1.ToolParamType.INTEGER,
124
- description: "Timeout in seconds (default 30, max 120)",
125
- required: false,
126
- },
127
- ],
128
- };
129
- }
130
- async execute(args) {
131
- const command = args["command"];
132
- if (!command)
133
- return "Error: 'command' parameter is required";
134
- const cwdArg = args["cwd"];
135
- const timeoutSec = typeof args["timeout"] === "number" ? args["timeout"] : DEFAULT_TIMEOUT_MS / 1000;
136
- const timeoutMs = Math.min(timeoutSec * 1000, MAX_TIMEOUT_MS);
137
- // Validate cwd if provided
138
- let cwd;
139
- if (cwdArg) {
140
- const allRoots = [...this.autoApprovedDirs, ...this.grantedPaths];
141
- const resolved = (0, index_1.resolveAndValidate)(cwdArg, allRoots);
142
- if (!resolved) {
143
- return `Error: working directory '${cwdArg}' is outside auto-approved directories`;
144
- }
145
- cwd = resolved;
146
- }
147
- // Check if command is safe (whitelist-only)
148
- const isSafe = this.isCommandSafe(command);
149
- if (!isSafe) {
150
- const response = await this.requester.requestUserInteraction({
151
- type: interactions_1.InteractionType.REQUEST_PERMISSION,
152
- interactionId: (0, crypto_1.randomUUID)(),
153
- action: "Execute shell command",
154
- command,
155
- reason: `The agent wants to run this command${cwd ? ` in ${cwd}` : ""}.`,
156
- });
157
- const permResponse = response;
158
- if (!permResponse.approved) {
159
- return "Command execution denied by user.";
160
- }
161
- }
162
- // Execute the command
163
- return new Promise((resolve) => {
164
- (0, child_process_1.exec)(command, {
165
- cwd,
166
- timeout: timeoutMs,
167
- maxBuffer: MAX_OUTPUT_BYTES,
168
- env: process.env,
169
- // On Windows, use PowerShell for more consistent behavior
170
- ...(IS_WINDOWS ? { shell: "powershell.exe" } : {}),
171
- }, (error, stdout, stderr) => {
172
- let output = "";
173
- if (stdout) {
174
- output += stdout;
175
- }
176
- if (stderr) {
177
- if (output)
178
- output += "\n--- stderr ---\n";
179
- output += stderr;
180
- }
181
- if (error) {
182
- if (error.killed) {
183
- output += `\n[Command timed out after ${timeoutSec}s]`;
184
- }
185
- else if (!stdout && !stderr) {
186
- output = `Error: ${error.message}`;
187
- }
188
- }
189
- // Truncate if too large
190
- if (Buffer.byteLength(output, "utf-8") > MAX_OUTPUT_BYTES) {
191
- output = output.slice(0, MAX_OUTPUT_BYTES) + "\n[Output truncated at 100KB]";
192
- }
193
- resolve(output || "(no output)");
194
- });
195
- });
196
- }
197
- /**
198
- * Check if a command is on the safe whitelist.
199
- */
200
- isCommandSafe(command) {
201
- const trimmed = command.trim();
202
- // Check two-word prefixes first (e.g. "git status")
203
- for (const prefix of SAFE_COMMAND_PREFIXES) {
204
- if (trimmed === prefix || trimmed.startsWith(prefix + " ")) {
205
- return true;
206
- }
207
- }
208
- // Extract base command
209
- const firstCommand = IS_WINDOWS
210
- ? trimmed.split(/[|;]/, 1)[0].trim() // PowerShell uses | and ;
211
- : trimmed.split(/[|;&]/, 1)[0].trim(); // bash uses |, ;, &
212
- const baseCommand = firstCommand.split(/\s+/, 1)[0];
213
- const commandName = IS_WINDOWS
214
- ? baseCommand.toLowerCase() // Windows commands are case-insensitive
215
- : path.basename(baseCommand);
216
- if (SAFE_COMMANDS.has(commandName)) {
217
- return this.areAllPipeSegmentsSafe(trimmed);
218
- }
219
- return false;
220
- }
221
- /**
222
- * For piped commands, check that every segment uses a safe command.
223
- */
224
- areAllPipeSegmentsSafe(command) {
225
- // Chained commands (;, &&, ||) require permission
226
- if (IS_WINDOWS) {
227
- if (/;/.test(command) && command.split("|").length <= 1)
228
- return false;
229
- }
230
- else {
231
- if (/[;&]|&&|\|\|/.test(command))
232
- return false;
233
- }
234
- const segments = command.split("|").map((s) => s.trim());
235
- for (const segment of segments) {
236
- const baseCommand = segment.split(/\s+/, 1)[0];
237
- const commandName = IS_WINDOWS
238
- ? baseCommand.toLowerCase()
239
- : path.basename(baseCommand);
240
- if (!SAFE_COMMANDS.has(commandName)) {
241
- return false;
242
- }
243
- }
244
- return true;
245
- }
246
- }
247
- exports.BashExecuteTool = BashExecuteTool;
248
- //# sourceMappingURL=bash.js.map
@@ -1 +0,0 @@
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,IAAI,GAAG,CAAC;IACjC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EA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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;AAhLD,0CAgLC"}
@@ -1,63 +0,0 @@
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 autoApprovedDirs;
14
- private readonly requester?;
15
- private readonly grantedPaths?;
16
- constructor(autoApprovedDirs: 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 autoApprovedDirs;
24
- private readonly requester?;
25
- private readonly grantedPaths?;
26
- constructor(autoApprovedDirs: 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 autoApprovedDirs;
32
- private readonly requester?;
33
- private readonly grantedPaths?;
34
- constructor(autoApprovedDirs: 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 autoApprovedDirs;
41
- private readonly requester?;
42
- private readonly grantedPaths?;
43
- constructor(autoApprovedDirs: 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 autoApprovedDirs;
55
- private readonly onFlag;
56
- private readonly requester?;
57
- private readonly grantedPaths?;
58
- private static readonly MAX_BINARY_SIZE;
59
- constructor(autoApprovedDirs: 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
@@ -1 +0,0 @@
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,gBAAgB,CAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA2B;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAc;gBAEhC,gBAAgB,EAAE,MAAM,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