@prbe.ai/electron-sdk 0.1.16 → 0.1.17
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 +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +62 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{types-Cyfgy1uD.d.mts → types-BmH_CmsO.d.mts} +5 -1
- package/dist/{types-Cyfgy1uD.d.ts → types-BmH_CmsO.d.ts} +5 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- 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, 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, j as ConversationEntry, k as ConversationRole, D as DEFAULT_PRBE_STATE, l as InteractionType, m as InvestigationResult, M as MIDDLEWARE_URL, n as PRBEAgentConfigKey, o as PRBEAgentError, p as PRBEAgentErrorType, q as PRBEAgentStatus, r as PRBEAgentStatusType, s as PRBECRInvestigation, t as PRBECompletedInvestigation, u as PRBEInteractionHandler, v as PRBESerializedCR, w as PRBESerializedCompletedInvestigation, x as PRBESerializedState, y as PRBESerializedTicket, z as PRBEStateEvent, B as PRBEStatusEvent, E as PollRequest, R as RequestPathAccessPayload, G as RequestPathAccessResponse, H as RequestPermissionPayload, J as RequestPermissionResponse, K as ResolveSessionsRequest, L as ResolveSessionsResponse, N as ResolvedInteraction, O as ResolvedTicketOut, Q as TicketInfoRequest, S as TicketInfoResponse,
|
|
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, U as UserIdentifierType, g as PollResponse, T as TicketInfoOut } from './types-BmH_CmsO.mjs';
|
|
2
|
+
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, j as ConversationEntry, k as ConversationRole, D as DEFAULT_PRBE_STATE, l as InteractionType, m as InvestigationResult, M as MIDDLEWARE_URL, n as PRBEAgentConfigKey, o as PRBEAgentError, p as PRBEAgentErrorType, q as PRBEAgentStatus, r as PRBEAgentStatusType, s as PRBECRInvestigation, t as PRBECompletedInvestigation, u as PRBEInteractionHandler, v as PRBESerializedCR, w as PRBESerializedCompletedInvestigation, x as PRBESerializedState, y as PRBESerializedTicket, z as PRBEStateEvent, B as PRBEStatusEvent, E as PollRequest, R as RequestPathAccessPayload, G as RequestPathAccessResponse, H as RequestPermissionPayload, J as RequestPermissionResponse, K as ResolveSessionsRequest, L as ResolveSessionsResponse, N as ResolvedInteraction, O as ResolvedTicketOut, Q as TicketInfoRequest, S as TicketInfoResponse, V as TicketStatusOut, W as ToolName, X as ToolParamType, Y as WSMessage, Z as WSMessageType, _ as redactPII, $ as serializePRBEState } from './types-BmH_CmsO.mjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
|
-
var version = "0.1.
|
|
5
|
+
var version = "0.1.17";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* tools/index.ts — Tool interface, registry, and closure tool
|
|
@@ -152,6 +152,8 @@ declare class PRBEAgent implements PRBEInteractionRequester {
|
|
|
152
152
|
private readonly historyStore;
|
|
153
153
|
/** Files flagged during the current tool call — uploaded immediately after the tool returns. */
|
|
154
154
|
private pendingFlaggedFiles;
|
|
155
|
+
private userEmail?;
|
|
156
|
+
private userId?;
|
|
155
157
|
private get agentID();
|
|
156
158
|
private get trackedSessionIDs();
|
|
157
159
|
private set trackedSessionIDs(value);
|
|
@@ -173,6 +175,18 @@ declare class PRBEAgent implements PRBEInteractionRequester {
|
|
|
173
175
|
* Call this to add user profile data, app version, etc. after async initialization.
|
|
174
176
|
*/
|
|
175
177
|
updateSessionMetadata(metadata: Record<string, unknown>): void;
|
|
178
|
+
/**
|
|
179
|
+
* Set a user identifier for this agent. Persists to the backend agents table.
|
|
180
|
+
* Can be called multiple times with different types to set both email and ID.
|
|
181
|
+
* Also auto-injects user_email and/or user_id into session metadata for investigations.
|
|
182
|
+
*/
|
|
183
|
+
setUserIdentifier(type: UserIdentifierType, value: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Clear user identifier(s) for this agent.
|
|
186
|
+
* Pass a specific type to clear only that identifier, or omit to clear both email and ID.
|
|
187
|
+
*/
|
|
188
|
+
clearUserIdentifier(type?: UserIdentifierType): void;
|
|
189
|
+
private syncUserIdentifierToBackend;
|
|
176
190
|
/**
|
|
177
191
|
* Register a custom tool that the middleware can invoke during investigations.
|
|
178
192
|
*/
|
|
@@ -346,4 +360,4 @@ declare class BashExecuteTool implements PRBETool {
|
|
|
346
360
|
*/
|
|
347
361
|
declare const PROBE_MARK_SVG = "<svg width=\"256\" height=\"256\" viewBox=\"0 0 256 256\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M50 112 L114 148 L50 184 Z\" fill=\"#111111\" opacity=\"0.07\"/>\n <path d=\"M70 86 L148 134 L70 182 Z\" fill=\"#111111\" opacity=\"0.18\"/>\n <path d=\"M92 56 L192 118 L92 180 Z\" fill=\"#111111\"/>\n</svg>";
|
|
348
362
|
|
|
349
|
-
export { AskUserTool, BashExecuteTool, ClearAppLogsTool, FindFilesTool, FlagAppLogsTool, FlagFileTool, FlaggedFileIn, InteractionPayload, InteractionResponse, InvestigationSource, ListDirectoryTool, type LogEntry, PRBEAgent, PRBEAgentConfig, PRBEAgentState, PRBEClosureTool, PRBEInteractionRequester, PRBELogCapture, type PRBETool, PRBEToolDeclaration, PRBEToolParameter, PRBEToolRegistry, PROBE_MARK_SVG, PollResponse, ReadAppLogsTool, ReadFileTool, version as SDK_VERSION, SearchAppLogsTool, SearchContentTool, TicketInfoOut, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };
|
|
363
|
+
export { AskUserTool, BashExecuteTool, ClearAppLogsTool, FindFilesTool, FlagAppLogsTool, FlagFileTool, FlaggedFileIn, InteractionPayload, InteractionResponse, InvestigationSource, ListDirectoryTool, type LogEntry, PRBEAgent, PRBEAgentConfig, PRBEAgentState, PRBEClosureTool, PRBEInteractionRequester, PRBELogCapture, type PRBETool, PRBEToolDeclaration, PRBEToolParameter, PRBEToolRegistry, PROBE_MARK_SVG, PollResponse, ReadAppLogsTool, ReadFileTool, version as SDK_VERSION, SearchAppLogsTool, SearchContentTool, TicketInfoOut, UserIdentifierType, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };
|
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, 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, j as ConversationEntry, k as ConversationRole, D as DEFAULT_PRBE_STATE, l as InteractionType, m as InvestigationResult, M as MIDDLEWARE_URL, n as PRBEAgentConfigKey, o as PRBEAgentError, p as PRBEAgentErrorType, q as PRBEAgentStatus, r as PRBEAgentStatusType, s as PRBECRInvestigation, t as PRBECompletedInvestigation, u as PRBEInteractionHandler, v as PRBESerializedCR, w as PRBESerializedCompletedInvestigation, x as PRBESerializedState, y as PRBESerializedTicket, z as PRBEStateEvent, B as PRBEStatusEvent, E as PollRequest, R as RequestPathAccessPayload, G as RequestPathAccessResponse, H as RequestPermissionPayload, J as RequestPermissionResponse, K as ResolveSessionsRequest, L as ResolveSessionsResponse, N as ResolvedInteraction, O as ResolvedTicketOut, Q as TicketInfoRequest, S as TicketInfoResponse,
|
|
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, U as UserIdentifierType, g as PollResponse, T as TicketInfoOut } from './types-BmH_CmsO.js';
|
|
2
|
+
export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, j as ConversationEntry, k as ConversationRole, D as DEFAULT_PRBE_STATE, l as InteractionType, m as InvestigationResult, M as MIDDLEWARE_URL, n as PRBEAgentConfigKey, o as PRBEAgentError, p as PRBEAgentErrorType, q as PRBEAgentStatus, r as PRBEAgentStatusType, s as PRBECRInvestigation, t as PRBECompletedInvestigation, u as PRBEInteractionHandler, v as PRBESerializedCR, w as PRBESerializedCompletedInvestigation, x as PRBESerializedState, y as PRBESerializedTicket, z as PRBEStateEvent, B as PRBEStatusEvent, E as PollRequest, R as RequestPathAccessPayload, G as RequestPathAccessResponse, H as RequestPermissionPayload, J as RequestPermissionResponse, K as ResolveSessionsRequest, L as ResolveSessionsResponse, N as ResolvedInteraction, O as ResolvedTicketOut, Q as TicketInfoRequest, S as TicketInfoResponse, V as TicketStatusOut, W as ToolName, X as ToolParamType, Y as WSMessage, Z as WSMessageType, _ as redactPII, $ as serializePRBEState } from './types-BmH_CmsO.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
|
|
5
|
-
var version = "0.1.
|
|
5
|
+
var version = "0.1.17";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* tools/index.ts — Tool interface, registry, and closure tool
|
|
@@ -152,6 +152,8 @@ declare class PRBEAgent implements PRBEInteractionRequester {
|
|
|
152
152
|
private readonly historyStore;
|
|
153
153
|
/** Files flagged during the current tool call — uploaded immediately after the tool returns. */
|
|
154
154
|
private pendingFlaggedFiles;
|
|
155
|
+
private userEmail?;
|
|
156
|
+
private userId?;
|
|
155
157
|
private get agentID();
|
|
156
158
|
private get trackedSessionIDs();
|
|
157
159
|
private set trackedSessionIDs(value);
|
|
@@ -173,6 +175,18 @@ declare class PRBEAgent implements PRBEInteractionRequester {
|
|
|
173
175
|
* Call this to add user profile data, app version, etc. after async initialization.
|
|
174
176
|
*/
|
|
175
177
|
updateSessionMetadata(metadata: Record<string, unknown>): void;
|
|
178
|
+
/**
|
|
179
|
+
* Set a user identifier for this agent. Persists to the backend agents table.
|
|
180
|
+
* Can be called multiple times with different types to set both email and ID.
|
|
181
|
+
* Also auto-injects user_email and/or user_id into session metadata for investigations.
|
|
182
|
+
*/
|
|
183
|
+
setUserIdentifier(type: UserIdentifierType, value: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Clear user identifier(s) for this agent.
|
|
186
|
+
* Pass a specific type to clear only that identifier, or omit to clear both email and ID.
|
|
187
|
+
*/
|
|
188
|
+
clearUserIdentifier(type?: UserIdentifierType): void;
|
|
189
|
+
private syncUserIdentifierToBackend;
|
|
176
190
|
/**
|
|
177
191
|
* Register a custom tool that the middleware can invoke during investigations.
|
|
178
192
|
*/
|
|
@@ -346,4 +360,4 @@ declare class BashExecuteTool implements PRBETool {
|
|
|
346
360
|
*/
|
|
347
361
|
declare const PROBE_MARK_SVG = "<svg width=\"256\" height=\"256\" viewBox=\"0 0 256 256\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M50 112 L114 148 L50 184 Z\" fill=\"#111111\" opacity=\"0.07\"/>\n <path d=\"M70 86 L148 134 L70 182 Z\" fill=\"#111111\" opacity=\"0.18\"/>\n <path d=\"M92 56 L192 118 L92 180 Z\" fill=\"#111111\"/>\n</svg>";
|
|
348
362
|
|
|
349
|
-
export { AskUserTool, BashExecuteTool, ClearAppLogsTool, FindFilesTool, FlagAppLogsTool, FlagFileTool, FlaggedFileIn, InteractionPayload, InteractionResponse, InvestigationSource, ListDirectoryTool, type LogEntry, PRBEAgent, PRBEAgentConfig, PRBEAgentState, PRBEClosureTool, PRBEInteractionRequester, PRBELogCapture, type PRBETool, PRBEToolDeclaration, PRBEToolParameter, PRBEToolRegistry, PROBE_MARK_SVG, PollResponse, ReadAppLogsTool, ReadFileTool, version as SDK_VERSION, SearchAppLogsTool, SearchContentTool, TicketInfoOut, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };
|
|
363
|
+
export { AskUserTool, BashExecuteTool, ClearAppLogsTool, FindFilesTool, FlagAppLogsTool, FlagFileTool, FlaggedFileIn, InteractionPayload, InteractionResponse, InvestigationSource, ListDirectoryTool, type LogEntry, PRBEAgent, PRBEAgentConfig, PRBEAgentState, PRBEClosureTool, PRBEInteractionRequester, PRBELogCapture, type PRBETool, PRBEToolDeclaration, PRBEToolParameter, PRBEToolRegistry, PROBE_MARK_SVG, PollResponse, ReadAppLogsTool, ReadFileTool, version as SDK_VERSION, SearchAppLogsTool, SearchContentTool, TicketInfoOut, UserIdentifierType, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ __export(src_exports, {
|
|
|
61
61
|
SearchContentTool: () => SearchContentTool,
|
|
62
62
|
ToolName: () => ToolName,
|
|
63
63
|
ToolParamType: () => ToolParamType,
|
|
64
|
+
UserIdentifierType: () => UserIdentifierType,
|
|
64
65
|
WSMessageType: () => WSMessageType,
|
|
65
66
|
humanReadableSize: () => humanReadableSize,
|
|
66
67
|
redactPII: () => redactPII,
|
|
@@ -71,7 +72,7 @@ __export(src_exports, {
|
|
|
71
72
|
module.exports = __toCommonJS(src_exports);
|
|
72
73
|
|
|
73
74
|
// package.json
|
|
74
|
-
var version = "0.1.
|
|
75
|
+
var version = "0.1.17";
|
|
75
76
|
|
|
76
77
|
// src/agent.ts
|
|
77
78
|
var fs3 = __toESM(require("fs"));
|
|
@@ -125,6 +126,11 @@ var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
|
125
126
|
ToolName2["CLIENT_MESSAGE_USER"] = "client_message_user";
|
|
126
127
|
return ToolName2;
|
|
127
128
|
})(ToolName || {});
|
|
129
|
+
var UserIdentifierType = /* @__PURE__ */ ((UserIdentifierType2) => {
|
|
130
|
+
UserIdentifierType2["EMAIL"] = "email";
|
|
131
|
+
UserIdentifierType2["ID"] = "id";
|
|
132
|
+
return UserIdentifierType2;
|
|
133
|
+
})(UserIdentifierType || {});
|
|
128
134
|
var PRBEAgentConfigKey = /* @__PURE__ */ ((PRBEAgentConfigKey3) => {
|
|
129
135
|
PRBEAgentConfigKey3["API_KEY"] = "apiKey";
|
|
130
136
|
PRBEAgentConfigKey3["AUTO_APPROVED_DIRS"] = "autoApprovedDirs";
|
|
@@ -1988,6 +1994,9 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
1988
1994
|
historyStore;
|
|
1989
1995
|
/** Files flagged during the current tool call — uploaded immediately after the tool returns. */
|
|
1990
1996
|
pendingFlaggedFiles = [];
|
|
1997
|
+
// ---------- User Identifier ----------
|
|
1998
|
+
userEmail;
|
|
1999
|
+
userId;
|
|
1991
2000
|
// ---------- Persistence ----------
|
|
1992
2001
|
get agentID() {
|
|
1993
2002
|
if (this.persistedData.agentId) {
|
|
@@ -2042,6 +2051,7 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
2042
2051
|
this.logCapture = new PRBELogCapture(this.config.maxLogEntries);
|
|
2043
2052
|
this.persistedData = loadPersistedData();
|
|
2044
2053
|
this.historyStore = new HistoryStore(this.config.apiKey);
|
|
2054
|
+
void this.agentID;
|
|
2045
2055
|
const history = this.historyStore.load();
|
|
2046
2056
|
this.state.completedInvestigations = history.investigations;
|
|
2047
2057
|
this.state.completedCRs = history.crs;
|
|
@@ -2195,6 +2205,47 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
2195
2205
|
updateSessionMetadata(metadata) {
|
|
2196
2206
|
this.sessionMetadata = { ...this.sessionMetadata, ...metadata };
|
|
2197
2207
|
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Set a user identifier for this agent. Persists to the backend agents table.
|
|
2210
|
+
* Can be called multiple times with different types to set both email and ID.
|
|
2211
|
+
* Also auto-injects user_email and/or user_id into session metadata for investigations.
|
|
2212
|
+
*/
|
|
2213
|
+
setUserIdentifier(type, value) {
|
|
2214
|
+
if (type === "email" /* EMAIL */) {
|
|
2215
|
+
this.userEmail = value;
|
|
2216
|
+
} else {
|
|
2217
|
+
this.userId = value;
|
|
2218
|
+
}
|
|
2219
|
+
this.syncUserIdentifierToBackend(type, value);
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Clear user identifier(s) for this agent.
|
|
2223
|
+
* Pass a specific type to clear only that identifier, or omit to clear both email and ID.
|
|
2224
|
+
*/
|
|
2225
|
+
clearUserIdentifier(type) {
|
|
2226
|
+
if (type) {
|
|
2227
|
+
if (type === "email" /* EMAIL */) {
|
|
2228
|
+
this.userEmail = void 0;
|
|
2229
|
+
} else {
|
|
2230
|
+
this.userId = void 0;
|
|
2231
|
+
}
|
|
2232
|
+
this.syncUserIdentifierToBackend(type, null);
|
|
2233
|
+
} else {
|
|
2234
|
+
this.userEmail = void 0;
|
|
2235
|
+
this.userId = void 0;
|
|
2236
|
+
this.syncUserIdentifierToBackend("email" /* EMAIL */, null);
|
|
2237
|
+
this.syncUserIdentifierToBackend("id" /* ID */, null);
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
syncUserIdentifierToBackend(type, value) {
|
|
2241
|
+
void this.post("/api/agent/update-user", {
|
|
2242
|
+
agent_id: this.agentID,
|
|
2243
|
+
identifier_type: type,
|
|
2244
|
+
identifier_value: value
|
|
2245
|
+
}).catch((err) => {
|
|
2246
|
+
console.error(`[PRBEAgent] Failed to sync user identifier: ${err}`);
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2198
2249
|
/**
|
|
2199
2250
|
* Register a custom tool that the middleware can invoke during investigations.
|
|
2200
2251
|
*/
|
|
@@ -2495,8 +2546,15 @@ var PRBEAgent = class _PRBEAgent {
|
|
|
2495
2546
|
if (contextRequestID) startMetadata["context_request_id"] = contextRequestID;
|
|
2496
2547
|
if (ticketId) startMetadata["ticket_id"] = ticketId;
|
|
2497
2548
|
if (this.appDataPath) startMetadata["app_data_path"] = this.appDataPath;
|
|
2498
|
-
|
|
2499
|
-
|
|
2549
|
+
const enrichedMetadata = { ...this.sessionMetadata };
|
|
2550
|
+
if (this.userEmail) {
|
|
2551
|
+
enrichedMetadata["user_email"] = this.userEmail;
|
|
2552
|
+
}
|
|
2553
|
+
if (this.userId) {
|
|
2554
|
+
enrichedMetadata["user_id"] = this.userId;
|
|
2555
|
+
}
|
|
2556
|
+
if (Object.keys(enrichedMetadata).length > 0) {
|
|
2557
|
+
startMetadata["session_metadata"] = enrichedMetadata;
|
|
2500
2558
|
}
|
|
2501
2559
|
if (!conn.send({ type: "start" /* START */, content: query, metadata: startMetadata })) {
|
|
2502
2560
|
emit({ type: "error" /* ERROR */, message: "Failed to send start message" });
|
|
@@ -2802,6 +2860,7 @@ var PROBE_MARK_SVG = `<svg width="256" height="256" viewBox="0 0 256 256" fill="
|
|
|
2802
2860
|
SearchContentTool,
|
|
2803
2861
|
ToolName,
|
|
2804
2862
|
ToolParamType,
|
|
2863
|
+
UserIdentifierType,
|
|
2805
2864
|
WSMessageType,
|
|
2806
2865
|
humanReadableSize,
|
|
2807
2866
|
redactPII,
|