@prbe.ai/electron-sdk 0.1.19 → 0.1.21
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{types-9iQH0zmA.d.mts → types-CtT5RMCX.d.mts} +3 -1
- package/dist/{types-9iQH0zmA.d.ts → types-CtT5RMCX.d.ts} +3 -1
- 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,8 +1,8 @@
|
|
|
1
|
-
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, C as ConversationRole, e as InteractionPayload, f as InteractionResponse, U as UserIdentifierType, g as PollResponse, A as AgentHistoryResponse, S as SanitizedFileResult } from './types-
|
|
2
|
-
export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, n as ContextRequestOut, o as ConversationEntry, D as DEFAULT_PRBE_STATE, E as ExternalRequestOut, p as InteractionType, q as InvestigationResult, M as MIDDLEWARE_URL, r as PRBEAgentConfigKey, s as PRBEAgentError, t as PRBEAgentErrorType, u as PRBEAgentStatus, v as PRBEAgentStatusType, w as PRBEBackgroundInvestigation, x as PRBECompletedInvestigation, y as PRBEInteractionHandler, z as PRBESerializedBackgroundInvestigation, B as PRBESerializedCompletedInvestigation, G as PRBESerializedState, H as PRBESerializedTicket, J as PRBEStateEvent, K as PRBEStatusEvent, L as PollRequest, R as RequestPathAccessPayload, N as RequestPathAccessResponse, O as RequestPermissionPayload, Q as RequestPermissionResponse, T as ResolvedInteraction, V as ReviewSanitizedOutputPayload, W as ReviewSanitizedOutputResponse, X as SanitizationIssue, Y as SanitizedFileRef, Z as TicketInfoOut, _ as ToolName, $ as ToolParamType, a0 as WSMessage, a1 as WSMessageType, a2 as redactPII, a3 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, C as ConversationRole, e as InteractionPayload, f as InteractionResponse, U as UserIdentifierType, g as PollResponse, A as AgentHistoryResponse, S as SanitizedFileResult } from './types-CtT5RMCX.mjs';
|
|
2
|
+
export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, n as ContextRequestOut, o as ConversationEntry, D as DEFAULT_PRBE_STATE, E as ExternalRequestOut, p as InteractionType, q as InvestigationResult, M as MIDDLEWARE_URL, r as PRBEAgentConfigKey, s as PRBEAgentError, t as PRBEAgentErrorType, u as PRBEAgentStatus, v as PRBEAgentStatusType, w as PRBEBackgroundInvestigation, x as PRBECompletedInvestigation, y as PRBEInteractionHandler, z as PRBESerializedBackgroundInvestigation, B as PRBESerializedCompletedInvestigation, G as PRBESerializedState, H as PRBESerializedTicket, J as PRBEStateEvent, K as PRBEStatusEvent, L as PollRequest, R as RequestPathAccessPayload, N as RequestPathAccessResponse, O as RequestPermissionPayload, Q as RequestPermissionResponse, T as ResolvedInteraction, V as ReviewSanitizedOutputPayload, W as ReviewSanitizedOutputResponse, X as SanitizationIssue, Y as SanitizedFileRef, Z as TicketInfoOut, _ as ToolName, $ as ToolParamType, a0 as WSMessage, a1 as WSMessageType, a2 as redactPII, a3 as serializePRBEState } from './types-CtT5RMCX.mjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
|
-
var version = "0.1.
|
|
5
|
+
var version = "0.1.21";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* tools/index.ts — Tool interface, registry, and closure tool
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, C as ConversationRole, e as InteractionPayload, f as InteractionResponse, U as UserIdentifierType, g as PollResponse, A as AgentHistoryResponse, S as SanitizedFileResult } from './types-
|
|
2
|
-
export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, n as ContextRequestOut, o as ConversationEntry, D as DEFAULT_PRBE_STATE, E as ExternalRequestOut, p as InteractionType, q as InvestigationResult, M as MIDDLEWARE_URL, r as PRBEAgentConfigKey, s as PRBEAgentError, t as PRBEAgentErrorType, u as PRBEAgentStatus, v as PRBEAgentStatusType, w as PRBEBackgroundInvestigation, x as PRBECompletedInvestigation, y as PRBEInteractionHandler, z as PRBESerializedBackgroundInvestigation, B as PRBESerializedCompletedInvestigation, G as PRBESerializedState, H as PRBESerializedTicket, J as PRBEStateEvent, K as PRBEStatusEvent, L as PollRequest, R as RequestPathAccessPayload, N as RequestPathAccessResponse, O as RequestPermissionPayload, Q as RequestPermissionResponse, T as ResolvedInteraction, V as ReviewSanitizedOutputPayload, W as ReviewSanitizedOutputResponse, X as SanitizationIssue, Y as SanitizedFileRef, Z as TicketInfoOut, _ as ToolName, $ as ToolParamType, a0 as WSMessage, a1 as WSMessageType, a2 as redactPII, a3 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, C as ConversationRole, e as InteractionPayload, f as InteractionResponse, U as UserIdentifierType, g as PollResponse, A as AgentHistoryResponse, S as SanitizedFileResult } from './types-CtT5RMCX.js';
|
|
2
|
+
export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, n as ContextRequestOut, o as ConversationEntry, D as DEFAULT_PRBE_STATE, E as ExternalRequestOut, p as InteractionType, q as InvestigationResult, M as MIDDLEWARE_URL, r as PRBEAgentConfigKey, s as PRBEAgentError, t as PRBEAgentErrorType, u as PRBEAgentStatus, v as PRBEAgentStatusType, w as PRBEBackgroundInvestigation, x as PRBECompletedInvestigation, y as PRBEInteractionHandler, z as PRBESerializedBackgroundInvestigation, B as PRBESerializedCompletedInvestigation, G as PRBESerializedState, H as PRBESerializedTicket, J as PRBEStateEvent, K as PRBEStatusEvent, L as PollRequest, R as RequestPathAccessPayload, N as RequestPathAccessResponse, O as RequestPermissionPayload, Q as RequestPermissionResponse, T as ResolvedInteraction, V as ReviewSanitizedOutputPayload, W as ReviewSanitizedOutputResponse, X as SanitizationIssue, Y as SanitizedFileRef, Z as TicketInfoOut, _ as ToolName, $ as ToolParamType, a0 as WSMessage, a1 as WSMessageType, a2 as redactPII, a3 as serializePRBEState } from './types-CtT5RMCX.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
|
-
var version = "0.1.
|
|
5
|
+
var version = "0.1.21";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* tools/index.ts — Tool interface, registry, and closure tool
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ __export(src_exports, {
|
|
|
72
72
|
module.exports = __toCommonJS(src_exports);
|
|
73
73
|
|
|
74
74
|
// package.json
|
|
75
|
-
var version = "0.1.
|
|
75
|
+
var version = "0.1.21";
|
|
76
76
|
|
|
77
77
|
// src/agent.ts
|
|
78
78
|
var fs2 = __toESM(require("fs"));
|
|
@@ -127,6 +127,8 @@ var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
|
127
127
|
ToolName2["CLIENT_ASK_USER"] = "client_ask_user";
|
|
128
128
|
ToolName2["CLIENT_BASH_EXECUTE"] = "client_bash_execute";
|
|
129
129
|
ToolName2["CLIENT_MESSAGE_USER"] = "client_message_user";
|
|
130
|
+
ToolName2["SDK_MESSAGE_USER"] = "sdk_message_user";
|
|
131
|
+
ToolName2["SDK_ASK_USER"] = "sdk_ask_user";
|
|
130
132
|
return ToolName2;
|
|
131
133
|
})(ToolName || {});
|
|
132
134
|
var UserIdentifierType = /* @__PURE__ */ ((UserIdentifierType2) => {
|
|
@@ -198,7 +200,9 @@ var InvestigationConnection = class {
|
|
|
198
200
|
if (!raw) return;
|
|
199
201
|
try {
|
|
200
202
|
const msg = JSON.parse(raw);
|
|
201
|
-
this.onMessage(msg)
|
|
203
|
+
Promise.resolve(this.onMessage(msg)).catch((err) => {
|
|
204
|
+
this.onError(`Message handler error: ${err instanceof Error ? err.message : String(err)}`);
|
|
205
|
+
});
|
|
202
206
|
} catch {
|
|
203
207
|
}
|
|
204
208
|
};
|
|
@@ -1473,7 +1477,7 @@ var AskUserTool = class {
|
|
|
1473
1477
|
}
|
|
1474
1478
|
get declaration() {
|
|
1475
1479
|
return {
|
|
1476
|
-
name: "
|
|
1480
|
+
name: "sdk_ask_user" /* SDK_ASK_USER */,
|
|
1477
1481
|
description: "Ask the user a question and wait for their response. Use this when you need clarification or additional information from the user to continue the investigation.",
|
|
1478
1482
|
interactive: true,
|
|
1479
1483
|
parameters: [
|
|
@@ -1912,7 +1916,7 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
1912
1916
|
}
|
|
1913
1917
|
this.registry.register(
|
|
1914
1918
|
new PRBEClosureTool(
|
|
1915
|
-
"
|
|
1919
|
+
"sdk_message_user" /* SDK_MESSAGE_USER */,
|
|
1916
1920
|
"Send a message to the user.",
|
|
1917
1921
|
[{ name: "message", type: "STRING" /* STRING */, description: "Message for the user", required: true }],
|
|
1918
1922
|
async (args) => {
|
|
@@ -2002,9 +2006,6 @@ ${p.reason}` : p.command;
|
|
|
2002
2006
|
|
|
2003
2007
|
${p.reason}` : p.path;
|
|
2004
2008
|
this.sendConversationMessage(content, "agent" /* Agent */, "Request path access");
|
|
2005
|
-
} else if (payload.type === "ask_question" /* ASK_QUESTION */) {
|
|
2006
|
-
const p = payload;
|
|
2007
|
-
this.sendConversationMessage(p.question, "agent" /* Agent */);
|
|
2008
2009
|
}
|
|
2009
2010
|
if (this.currentInvestigationSource !== "user" /* USER */ && this.currentBackgroundId) {
|
|
2010
2011
|
this.state.setBackgroundPendingInteraction(this.currentBackgroundId, payload);
|
|
@@ -2398,6 +2399,8 @@ ${p.reason}` : p.path;
|
|
|
2398
2399
|
}));
|
|
2399
2400
|
const startMetadata = {
|
|
2400
2401
|
agent_id: this.agentID,
|
|
2402
|
+
sdk_name: "electron",
|
|
2403
|
+
supports_chat: true,
|
|
2401
2404
|
custom_tools: toolDeclarations,
|
|
2402
2405
|
platform: os.platform(),
|
|
2403
2406
|
os_version: os.release(),
|
|
@@ -2446,7 +2449,12 @@ ${p.reason}` : p.path;
|
|
|
2446
2449
|
const args = this.extractArgs(msg.metadata);
|
|
2447
2450
|
emit({ type: "tool_call" /* TOOL_CALL */, name: toolName, label: msg.content ?? `Running ${toolName}` });
|
|
2448
2451
|
this.pendingFlaggedFiles = [];
|
|
2449
|
-
|
|
2452
|
+
let toolResult;
|
|
2453
|
+
try {
|
|
2454
|
+
toolResult = redactPII(await this.registry.execute(toolName, args));
|
|
2455
|
+
} catch (err) {
|
|
2456
|
+
toolResult = `Error: Tool execution failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
2457
|
+
}
|
|
2450
2458
|
emit({ type: "observation" /* OBSERVATION */, text: toolResult.substring(0, 200) });
|
|
2451
2459
|
let resultMetadata;
|
|
2452
2460
|
const uploadBaseUrl = getUploadBaseUrl();
|