@prbe.ai/electron-sdk 0.1.9 → 0.1.12
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +158 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -45
- package/dist/index.mjs.map +1 -1
- package/dist/{types-CeIldtlI.d.mts → types-B_KS1-FJ.d.mts} +11 -2
- package/dist/{types-CeIldtlI.d.ts → types-B_KS1-FJ.d.ts} +11 -2
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-
|
|
2
|
-
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-
|
|
1
|
+
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-B_KS1-FJ.mjs';
|
|
2
|
+
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-B_KS1-FJ.mjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-
|
|
2
|
-
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-
|
|
1
|
+
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-B_KS1-FJ.js';
|
|
2
|
+
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-B_KS1-FJ.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -110,6 +110,7 @@ var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
|
110
110
|
ToolName2["CLIENT_FLAG_APP_LOGS"] = "client_flag_app_logs";
|
|
111
111
|
ToolName2["CLIENT_ASK_USER"] = "client_ask_user";
|
|
112
112
|
ToolName2["CLIENT_BASH_EXECUTE"] = "client_bash_execute";
|
|
113
|
+
ToolName2["CLIENT_MESSAGE_USER"] = "client_message_user";
|
|
113
114
|
return ToolName2;
|
|
114
115
|
})(ToolName || {});
|
|
115
116
|
var PRBEAgentConfigKey = /* @__PURE__ */ ((PRBEAgentConfigKey3) => {
|
|
@@ -174,6 +175,7 @@ var PRBEStateEvent = /* @__PURE__ */ ((PRBEStateEvent2) => {
|
|
|
174
175
|
PRBEStateEvent2["TICKET_INFO"] = "ticket-info";
|
|
175
176
|
PRBEStateEvent2["INTERACTION_REQUESTED"] = "interaction-requested";
|
|
176
177
|
PRBEStateEvent2["INTERACTION_RESOLVED"] = "interaction-resolved";
|
|
178
|
+
PRBEStateEvent2["AGENT_MESSAGE"] = "agent-message";
|
|
177
179
|
return PRBEStateEvent2;
|
|
178
180
|
})(PRBEStateEvent || {});
|
|
179
181
|
var PRBEAgentState = class extends import_events.EventEmitter {
|
|
@@ -186,6 +188,7 @@ var PRBEAgentState = class extends import_events.EventEmitter {
|
|
|
186
188
|
investigationError;
|
|
187
189
|
pendingInteraction;
|
|
188
190
|
resolvedInteractions = [];
|
|
191
|
+
agentMessage;
|
|
189
192
|
// Completed user investigations (history)
|
|
190
193
|
completedInvestigations = [];
|
|
191
194
|
// Background context requests
|
|
@@ -213,6 +216,7 @@ var PRBEAgentState = class extends import_events.EventEmitter {
|
|
|
213
216
|
this.summary = "";
|
|
214
217
|
this.currentQuery = query;
|
|
215
218
|
this.investigationError = void 0;
|
|
219
|
+
this.agentMessage = void 0;
|
|
216
220
|
this.emit("status" /* STATUS */);
|
|
217
221
|
}
|
|
218
222
|
resetInvestigation() {
|
|
@@ -224,6 +228,7 @@ var PRBEAgentState = class extends import_events.EventEmitter {
|
|
|
224
228
|
this.currentQuery = "";
|
|
225
229
|
this.investigationError = void 0;
|
|
226
230
|
this.pendingInteraction = void 0;
|
|
231
|
+
this.agentMessage = void 0;
|
|
227
232
|
this.emit("status" /* STATUS */);
|
|
228
233
|
}
|
|
229
234
|
appendEvent(label, detail, completed = false) {
|
|
@@ -330,6 +335,18 @@ var PRBEAgentState = class extends import_events.EventEmitter {
|
|
|
330
335
|
this.emit("interaction-resolved" /* INTERACTION_RESOLVED */);
|
|
331
336
|
this.emit("status" /* STATUS */);
|
|
332
337
|
}
|
|
338
|
+
setAgentMessage(message) {
|
|
339
|
+
this.agentMessage = message;
|
|
340
|
+
this.emit("agent-message" /* AGENT_MESSAGE */, { message });
|
|
341
|
+
this.emit("status" /* STATUS */);
|
|
342
|
+
}
|
|
343
|
+
setCRAgentMessage(crID, message) {
|
|
344
|
+
const cr = this.activeCRs.get(crID);
|
|
345
|
+
if (!cr) return;
|
|
346
|
+
cr.agentMessage = message;
|
|
347
|
+
this.emit("agent-message" /* AGENT_MESSAGE */, { message });
|
|
348
|
+
this.emit("status" /* STATUS */);
|
|
349
|
+
}
|
|
333
350
|
toggleExpansion(eventId) {
|
|
334
351
|
const event = this.events.find((e) => e.id === eventId);
|
|
335
352
|
if (event) {
|
|
@@ -699,7 +716,8 @@ var SearchContentTool = class {
|
|
|
699
716
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Regex pattern", required: true },
|
|
700
717
|
{ name: "path", type: "STRING" /* STRING */, description: "File or directory to search", required: true },
|
|
701
718
|
{ name: "context_lines", type: "INTEGER" /* INTEGER */, description: "Context lines (default 2)", required: false },
|
|
702
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
719
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
720
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive search (default false)", required: false }
|
|
703
721
|
]
|
|
704
722
|
};
|
|
705
723
|
}
|
|
@@ -712,9 +730,10 @@ var SearchContentTool = class {
|
|
|
712
730
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
713
731
|
const contextLines = typeof args["context_lines"] === "number" ? args["context_lines"] : 2;
|
|
714
732
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
733
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
715
734
|
let regex;
|
|
716
735
|
try {
|
|
717
|
-
regex = new RegExp(pattern);
|
|
736
|
+
regex = new RegExp(pattern, caseSensitive ? "" : "i");
|
|
718
737
|
} catch {
|
|
719
738
|
return `Error: invalid regex pattern '${pattern}'`;
|
|
720
739
|
}
|
|
@@ -802,7 +821,8 @@ var FindFilesTool = class {
|
|
|
802
821
|
parameters: [
|
|
803
822
|
{ name: "pattern", type: "STRING" /* STRING */, description: "Glob pattern", required: true },
|
|
804
823
|
{ name: "path", type: "STRING" /* STRING */, description: "Directory to search", required: true },
|
|
805
|
-
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false }
|
|
824
|
+
{ name: "max_results", type: "INTEGER" /* INTEGER */, description: "Max results (default 50)", required: false },
|
|
825
|
+
{ name: "case_sensitive", type: "BOOLEAN" /* BOOLEAN */, description: "Case-sensitive matching (default false)", required: false }
|
|
806
826
|
]
|
|
807
827
|
};
|
|
808
828
|
}
|
|
@@ -814,8 +834,9 @@ var FindFilesTool = class {
|
|
|
814
834
|
const [resolved, resolveErr] = await resolvePath(pathStr, this.autoApprovedDirs, this.requester, this.grantedPaths);
|
|
815
835
|
if (!resolved) return `Error: ${resolveErr}`;
|
|
816
836
|
const maxResults = typeof args["max_results"] === "number" ? args["max_results"] : 50;
|
|
837
|
+
const caseSensitive = args["case_sensitive"] === true;
|
|
817
838
|
const matches = [];
|
|
818
|
-
this.walkAndMatch(resolved, pattern, matches);
|
|
839
|
+
this.walkAndMatch(resolved, pattern, matches, caseSensitive);
|
|
819
840
|
matches.sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
820
841
|
const limited = matches.slice(0, maxResults);
|
|
821
842
|
if (limited.length === 0) {
|
|
@@ -832,7 +853,7 @@ var FindFilesTool = class {
|
|
|
832
853
|
}
|
|
833
854
|
return result;
|
|
834
855
|
}
|
|
835
|
-
walkAndMatch(dirPath, pattern, matches) {
|
|
856
|
+
walkAndMatch(dirPath, pattern, matches, caseSensitive) {
|
|
836
857
|
let entries;
|
|
837
858
|
try {
|
|
838
859
|
entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
@@ -843,9 +864,9 @@ var FindFilesTool = class {
|
|
|
843
864
|
if (entry.name.startsWith(".")) continue;
|
|
844
865
|
const fullPath = path2.join(dirPath, entry.name);
|
|
845
866
|
if (entry.isDirectory()) {
|
|
846
|
-
this.walkAndMatch(fullPath, pattern, matches);
|
|
867
|
+
this.walkAndMatch(fullPath, pattern, matches, caseSensitive);
|
|
847
868
|
} else if (entry.isFile()) {
|
|
848
|
-
if (this.globMatch(entry.name, pattern)) {
|
|
869
|
+
if (this.globMatch(entry.name, pattern, caseSensitive)) {
|
|
849
870
|
try {
|
|
850
871
|
const stat = fs.statSync(fullPath);
|
|
851
872
|
matches.push({
|
|
@@ -863,7 +884,7 @@ var FindFilesTool = class {
|
|
|
863
884
|
* Simple glob matching: supports *, ?, and character classes [...].
|
|
864
885
|
* Converts glob to regex and tests against the filename.
|
|
865
886
|
*/
|
|
866
|
-
globMatch(filename, pattern) {
|
|
887
|
+
globMatch(filename, pattern, caseSensitive) {
|
|
867
888
|
let regexStr = "^";
|
|
868
889
|
for (let i = 0; i < pattern.length; i++) {
|
|
869
890
|
const c = pattern[i];
|
|
@@ -901,7 +922,7 @@ var FindFilesTool = class {
|
|
|
901
922
|
}
|
|
902
923
|
regexStr += "$";
|
|
903
924
|
try {
|
|
904
|
-
return new RegExp(regexStr).test(filename);
|
|
925
|
+
return new RegExp(regexStr, caseSensitive ? "" : "i").test(filename);
|
|
905
926
|
} catch {
|
|
906
927
|
return false;
|
|
907
928
|
}
|
|
@@ -1360,70 +1381,136 @@ var AskUserTool = class {
|
|
|
1360
1381
|
var import_child_process = require("child_process");
|
|
1361
1382
|
var import_crypto4 = require("crypto");
|
|
1362
1383
|
var path3 = __toESM(require("path"));
|
|
1363
|
-
|
|
1384
|
+
|
|
1385
|
+
// src/tools/safe-commands.ts
|
|
1364
1386
|
var UNIX_SAFE_COMMANDS = /* @__PURE__ */ new Set([
|
|
1387
|
+
// Filesystem (read-only)
|
|
1365
1388
|
"ls",
|
|
1366
1389
|
"cat",
|
|
1367
1390
|
"head",
|
|
1368
1391
|
"tail",
|
|
1369
|
-
"grep",
|
|
1370
|
-
"rg",
|
|
1371
1392
|
"find",
|
|
1372
|
-
"which",
|
|
1373
|
-
"whoami",
|
|
1374
|
-
"pwd",
|
|
1375
|
-
"echo",
|
|
1376
|
-
"printf",
|
|
1377
|
-
"wc",
|
|
1378
|
-
"sort",
|
|
1379
|
-
"uniq",
|
|
1380
|
-
"diff",
|
|
1381
1393
|
"file",
|
|
1382
1394
|
"stat",
|
|
1383
1395
|
"du",
|
|
1384
1396
|
"df",
|
|
1397
|
+
"wc",
|
|
1398
|
+
"sort",
|
|
1399
|
+
"uniq",
|
|
1400
|
+
"diff",
|
|
1401
|
+
"tree",
|
|
1402
|
+
// Search
|
|
1403
|
+
"grep",
|
|
1404
|
+
"rg",
|
|
1405
|
+
"which",
|
|
1406
|
+
// Text
|
|
1407
|
+
"echo",
|
|
1408
|
+
"printf",
|
|
1409
|
+
// Identity / environment
|
|
1410
|
+
"whoami",
|
|
1411
|
+
"pwd",
|
|
1412
|
+
"id",
|
|
1413
|
+
"hostname",
|
|
1385
1414
|
"uname",
|
|
1386
1415
|
"env",
|
|
1387
1416
|
"printenv",
|
|
1417
|
+
"locale",
|
|
1418
|
+
// System info (read-only reporters)
|
|
1388
1419
|
"date",
|
|
1389
|
-
"
|
|
1390
|
-
"
|
|
1420
|
+
"uptime",
|
|
1421
|
+
"free",
|
|
1391
1422
|
"ps",
|
|
1392
1423
|
"top",
|
|
1393
|
-
|
|
1394
|
-
"
|
|
1424
|
+
// macOS-specific (read-only only)
|
|
1425
|
+
"sw_vers",
|
|
1426
|
+
// macOS version
|
|
1427
|
+
"system_profiler",
|
|
1428
|
+
// hardware/software info
|
|
1429
|
+
"mdls",
|
|
1430
|
+
// Spotlight metadata for a file
|
|
1431
|
+
"mdfind",
|
|
1432
|
+
// Spotlight search
|
|
1433
|
+
"lsof",
|
|
1434
|
+
// list open files
|
|
1435
|
+
"ioreg",
|
|
1436
|
+
// I/O registry (hardware tree)
|
|
1437
|
+
"log",
|
|
1438
|
+
// macOS unified log (show, stream — read-only)
|
|
1439
|
+
// Linux-specific (read-only reporters)
|
|
1440
|
+
"lsb_release",
|
|
1441
|
+
// distro info
|
|
1442
|
+
"lscpu",
|
|
1443
|
+
// CPU info
|
|
1444
|
+
"lsblk",
|
|
1445
|
+
// block devices
|
|
1446
|
+
"lspci",
|
|
1447
|
+
// PCI devices
|
|
1448
|
+
"lsusb",
|
|
1449
|
+
// USB devices
|
|
1450
|
+
"lsmem",
|
|
1451
|
+
// memory ranges
|
|
1452
|
+
"dmidecode",
|
|
1453
|
+
// BIOS/hardware info
|
|
1454
|
+
"ss",
|
|
1455
|
+
// socket statistics
|
|
1456
|
+
"journalctl"
|
|
1457
|
+
// systemd logs (read-only)
|
|
1395
1458
|
]);
|
|
1396
1459
|
var WINDOWS_SAFE_COMMANDS = /* @__PURE__ */ new Set([
|
|
1460
|
+
// CMD — filesystem (read-only)
|
|
1397
1461
|
"dir",
|
|
1398
1462
|
"type",
|
|
1463
|
+
"tree",
|
|
1464
|
+
"more",
|
|
1399
1465
|
"findstr",
|
|
1400
1466
|
"where",
|
|
1467
|
+
// CMD — system info (read-only reporters)
|
|
1468
|
+
"systeminfo",
|
|
1469
|
+
"hostname",
|
|
1470
|
+
"ver",
|
|
1471
|
+
"vol",
|
|
1472
|
+
"date",
|
|
1473
|
+
"set",
|
|
1474
|
+
"path",
|
|
1475
|
+
"chcp",
|
|
1401
1476
|
"whoami",
|
|
1402
1477
|
"echo",
|
|
1403
1478
|
"sort",
|
|
1404
1479
|
"fc",
|
|
1405
|
-
|
|
1406
|
-
"date",
|
|
1407
|
-
"systeminfo",
|
|
1480
|
+
// CMD — processes
|
|
1408
1481
|
"tasklist",
|
|
1409
|
-
"
|
|
1410
|
-
|
|
1411
|
-
"
|
|
1412
|
-
|
|
1413
|
-
|
|
1482
|
+
"driverquery",
|
|
1483
|
+
// CMD — network (read-only)
|
|
1484
|
+
"netstat",
|
|
1485
|
+
// CMD — policy (read-only)
|
|
1486
|
+
"gpresult",
|
|
1487
|
+
// PowerShell — Get-* cmdlets (strictly read-only by convention)
|
|
1414
1488
|
"get-childitem",
|
|
1415
1489
|
"get-content",
|
|
1490
|
+
"get-item",
|
|
1491
|
+
"test-path",
|
|
1492
|
+
"resolve-path",
|
|
1493
|
+
"get-itemproperty",
|
|
1416
1494
|
"select-string",
|
|
1417
|
-
"
|
|
1418
|
-
"get-date",
|
|
1495
|
+
"measure-object",
|
|
1419
1496
|
"get-host",
|
|
1420
1497
|
"get-computerinfo",
|
|
1498
|
+
"get-date",
|
|
1421
1499
|
"get-volume",
|
|
1422
|
-
"
|
|
1423
|
-
"
|
|
1424
|
-
"
|
|
1500
|
+
"get-disk",
|
|
1501
|
+
"get-partition",
|
|
1502
|
+
"get-process",
|
|
1503
|
+
"get-service",
|
|
1504
|
+
"get-netadapter",
|
|
1505
|
+
"get-nettcpconnection",
|
|
1506
|
+
"get-netipaddress",
|
|
1507
|
+
"get-netroute",
|
|
1508
|
+
"get-hotfix",
|
|
1509
|
+
"get-eventlog",
|
|
1510
|
+
"get-winevent",
|
|
1511
|
+
"get-wmiobject",
|
|
1512
|
+
"get-ciminstance"
|
|
1425
1513
|
]);
|
|
1426
|
-
var SAFE_COMMANDS = IS_WINDOWS ? WINDOWS_SAFE_COMMANDS : UNIX_SAFE_COMMANDS;
|
|
1427
1514
|
var SAFE_COMMAND_PREFIXES = /* @__PURE__ */ new Set([
|
|
1428
1515
|
"git status",
|
|
1429
1516
|
"git log",
|
|
@@ -1435,6 +1522,11 @@ var SAFE_COMMAND_PREFIXES = /* @__PURE__ */ new Set([
|
|
|
1435
1522
|
"npm list",
|
|
1436
1523
|
"npm ls"
|
|
1437
1524
|
]);
|
|
1525
|
+
var IS_WINDOWS = process.platform === "win32";
|
|
1526
|
+
var SAFE_COMMANDS = IS_WINDOWS ? WINDOWS_SAFE_COMMANDS : UNIX_SAFE_COMMANDS;
|
|
1527
|
+
|
|
1528
|
+
// src/tools/bash.ts
|
|
1529
|
+
var IS_WINDOWS2 = process.platform === "win32";
|
|
1438
1530
|
var MAX_OUTPUT_BYTES = 100 * 1024;
|
|
1439
1531
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
1440
1532
|
var MAX_TIMEOUT_MS = 12e4;
|
|
@@ -1512,7 +1604,7 @@ var BashExecuteTool = class {
|
|
|
1512
1604
|
maxBuffer: MAX_OUTPUT_BYTES,
|
|
1513
1605
|
env: process.env,
|
|
1514
1606
|
// On Windows, use PowerShell for more consistent behavior
|
|
1515
|
-
...
|
|
1607
|
+
...IS_WINDOWS2 ? { shell: "powershell.exe" } : {}
|
|
1516
1608
|
},
|
|
1517
1609
|
(error, stdout, stderr) => {
|
|
1518
1610
|
let output = "";
|
|
@@ -1549,9 +1641,9 @@ var BashExecuteTool = class {
|
|
|
1549
1641
|
return true;
|
|
1550
1642
|
}
|
|
1551
1643
|
}
|
|
1552
|
-
const firstCommand =
|
|
1644
|
+
const firstCommand = IS_WINDOWS2 ? trimmed.split(/[|;]/, 1)[0].trim() : trimmed.split(/[|;&]/, 1)[0].trim();
|
|
1553
1645
|
const baseCommand = firstCommand.split(/\s+/, 1)[0];
|
|
1554
|
-
const commandName =
|
|
1646
|
+
const commandName = IS_WINDOWS2 ? baseCommand.toLowerCase() : path3.basename(baseCommand);
|
|
1555
1647
|
if (SAFE_COMMANDS.has(commandName)) {
|
|
1556
1648
|
return this.areAllPipeSegmentsSafe(trimmed);
|
|
1557
1649
|
}
|
|
@@ -1561,7 +1653,7 @@ var BashExecuteTool = class {
|
|
|
1561
1653
|
* For piped commands, check that every segment uses a safe command.
|
|
1562
1654
|
*/
|
|
1563
1655
|
areAllPipeSegmentsSafe(command) {
|
|
1564
|
-
if (
|
|
1656
|
+
if (IS_WINDOWS2) {
|
|
1565
1657
|
if (/;/.test(command) && command.split("|").length <= 1) return false;
|
|
1566
1658
|
} else {
|
|
1567
1659
|
if (/[;&]|&&|\|\|/.test(command)) return false;
|
|
@@ -1569,7 +1661,7 @@ var BashExecuteTool = class {
|
|
|
1569
1661
|
const segments = command.split("|").map((s) => s.trim());
|
|
1570
1662
|
for (const segment of segments) {
|
|
1571
1663
|
const baseCommand = segment.split(/\s+/, 1)[0];
|
|
1572
|
-
const commandName =
|
|
1664
|
+
const commandName = IS_WINDOWS2 ? baseCommand.toLowerCase() : path3.basename(baseCommand);
|
|
1573
1665
|
if (!SAFE_COMMANDS.has(commandName)) {
|
|
1574
1666
|
return false;
|
|
1575
1667
|
}
|
|
@@ -1887,6 +1979,22 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
1887
1979
|
this.registry.register(new AskUserTool(requester));
|
|
1888
1980
|
this.registry.register(new BashExecuteTool(requester, roots, grantedPaths));
|
|
1889
1981
|
}
|
|
1982
|
+
this.registry.register(
|
|
1983
|
+
new PRBEClosureTool(
|
|
1984
|
+
"client_message_user",
|
|
1985
|
+
"Send a message to the user.",
|
|
1986
|
+
[{ name: "message", type: "STRING" /* STRING */, description: "Message for the user", required: true }],
|
|
1987
|
+
async (args) => {
|
|
1988
|
+
const message = args["message"] ?? "";
|
|
1989
|
+
if (this.currentInvestigationSource === "context_request" /* CONTEXT_REQUEST */ && this.currentCRId) {
|
|
1990
|
+
this.state.setCRAgentMessage(this.currentCRId, message);
|
|
1991
|
+
} else {
|
|
1992
|
+
this.state.setAgentMessage(message);
|
|
1993
|
+
}
|
|
1994
|
+
return "Message delivered.";
|
|
1995
|
+
}
|
|
1996
|
+
)
|
|
1997
|
+
);
|
|
1890
1998
|
if (this.config.captureConsole) {
|
|
1891
1999
|
this.logCapture.startCapturing();
|
|
1892
2000
|
}
|
|
@@ -2274,7 +2382,10 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
2274
2382
|
}));
|
|
2275
2383
|
const startMetadata = {
|
|
2276
2384
|
agent_id: this.agentID,
|
|
2277
|
-
custom_tools: toolDeclarations
|
|
2385
|
+
custom_tools: toolDeclarations,
|
|
2386
|
+
platform: os2.platform(),
|
|
2387
|
+
os_version: os2.release(),
|
|
2388
|
+
arch: os2.arch()
|
|
2278
2389
|
};
|
|
2279
2390
|
if (contextRequestID) {
|
|
2280
2391
|
startMetadata["context_request_id"] = contextRequestID;
|
|
@@ -2613,6 +2724,7 @@ function serializeCR(cr) {
|
|
|
2613
2724
|
report: cr.report,
|
|
2614
2725
|
summary: cr.summary,
|
|
2615
2726
|
errorMessage: cr.errorMessage,
|
|
2727
|
+
agentMessage: cr.agentMessage,
|
|
2616
2728
|
startedAt: cr.startedAt.toISOString(),
|
|
2617
2729
|
pendingInteraction: cr.pendingInteraction,
|
|
2618
2730
|
resolvedInteractions: cr.resolvedInteractions ?? []
|
|
@@ -2628,6 +2740,7 @@ function serializePRBEState(state) {
|
|
|
2628
2740
|
investigationError: state.investigationError,
|
|
2629
2741
|
pendingInteraction: state.pendingInteraction,
|
|
2630
2742
|
resolvedInteractions: state.resolvedInteractions,
|
|
2743
|
+
agentMessage: state.agentMessage,
|
|
2631
2744
|
completedInvestigations: state.completedInvestigations.map((inv) => ({
|
|
2632
2745
|
id: inv.id,
|
|
2633
2746
|
query: inv.query,
|