@prbe.ai/electron-sdk 0.1.16 → 0.1.18

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 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-Cyfgy1uD.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, U as TicketStatusOut, V as ToolName, W as ToolParamType, X as WSMessage, Y as WSMessageType, Z as redactPII, _ as serializePRBEState } from './types-Cyfgy1uD.mjs';
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, A as AgentHistoryResponse } from './types-BeZ2nQ9x.mjs';
2
+ export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, C as ContextRequestOut, n as ConversationEntry, o as ConversationRole, 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, S as ResolvedInteraction, T as TicketInfoOut, V as ToolName, W as ToolParamType, X as WSMessage, Y as WSMessageType, Z as redactPII, _ as serializePRBEState } from './types-BeZ2nQ9x.mjs';
3
3
  import 'events';
4
4
 
5
- var version = "0.1.16";
5
+ var version = "0.1.18";
6
6
 
7
7
  /**
8
8
  * tools/index.ts — Tool interface, registry, and closure tool
@@ -148,15 +148,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
148
148
  private persistedData;
149
149
  private fetchAbortController;
150
150
  private currentInvestigationSource;
151
- private currentCRId;
152
- private readonly historyStore;
151
+ private currentBackgroundId;
153
152
  /** Files flagged during the current tool call — uploaded immediately after the tool returns. */
154
153
  private pendingFlaggedFiles;
154
+ private userEmail?;
155
+ private userId?;
155
156
  private get agentID();
156
- private get trackedSessionIDs();
157
- private set trackedSessionIDs(value);
158
- private syncPolling;
159
- private addTrackedSession;
160
157
  constructor(config: PRBEAgentConfig);
161
158
  private hookElectronLog;
162
159
  private hookRendererLogs;
@@ -173,18 +170,31 @@ declare class PRBEAgent implements PRBEInteractionRequester {
173
170
  * Call this to add user profile data, app version, etc. after async initialization.
174
171
  */
175
172
  updateSessionMetadata(metadata: Record<string, unknown>): void;
173
+ /**
174
+ * Set a user identifier for this agent. Persists to the backend agents table.
175
+ * Can be called multiple times with different types to set both email and ID.
176
+ * Also auto-injects user_email and/or user_id into session metadata for investigations.
177
+ */
178
+ setUserIdentifier(type: UserIdentifierType, value: string): void;
179
+ /**
180
+ * Clear user identifier(s) for this agent.
181
+ * Pass a specific type to clear only that identifier, or omit to clear both email and ID.
182
+ */
183
+ clearUserIdentifier(type?: UserIdentifierType): void;
184
+ private syncUserIdentifierToBackend;
176
185
  /**
177
186
  * Register a custom tool that the middleware can invoke during investigations.
178
187
  */
179
188
  registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
180
189
  interactive?: boolean;
181
190
  }): void;
191
+ private runInvestigation;
182
192
  /**
183
193
  * User-initiated investigation. Updates `state` events/report directly.
184
194
  */
185
195
  investigate(query: string, contextRequestID?: string): Promise<void>;
186
196
  /**
187
- * Cancel user-initiated investigation only (does not cancel background CRs).
197
+ * Cancel user-initiated investigation only (does not cancel background investigations).
188
198
  */
189
199
  cancelInvestigation(): void;
190
200
  /**
@@ -192,15 +202,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
192
202
  */
193
203
  cancel(): void;
194
204
  /**
195
- * Poll the backend for context requests on tracked tickets.
196
- * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
205
+ * Poll the backend for context requests and external requests.
197
206
  */
198
207
  poll(): Promise<PollResponse | null>;
199
208
  /**
200
- * Fetch ticket display info for all tracked sessions.
201
- * Resolves session IDs → ticket IDs first, then fetches ticket info.
209
+ * Fetch agent history (tickets + sessions) from the backend.
202
210
  */
203
- fetchTicketInfo(): Promise<TicketInfoOut[]>;
211
+ fetchHistory(): Promise<AgentHistoryResponse | null>;
204
212
  stopPolling(): void;
205
213
  resumePolling(): void;
206
214
  /**
@@ -217,13 +225,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
217
225
  */
218
226
  static clearPersistedData(): void;
219
227
  private investigateForCR;
228
+ private investigateForER;
220
229
  private connectToProxy;
221
230
  private handleMessage;
222
231
  private extractArgs;
223
232
  private extractUploadPrefix;
224
233
  private static backgroundUpload;
225
234
  private startPolling;
226
- private resolveSessions;
227
235
  /**
228
236
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
229
237
  * that can crash the c-ares resolver during process shutdown.
@@ -346,4 +354,4 @@ declare class BashExecuteTool implements PRBETool {
346
354
  */
347
355
  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
356
 
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 };
357
+ export { AgentHistoryResponse, 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, 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-Cyfgy1uD.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, U as TicketStatusOut, V as ToolName, W as ToolParamType, X as WSMessage, Y as WSMessageType, Z as redactPII, _ as serializePRBEState } from './types-Cyfgy1uD.js';
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, A as AgentHistoryResponse } from './types-BeZ2nQ9x.js';
2
+ export { h as API_URL, i as AgentHistoryRequest, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, C as ContextRequestOut, n as ConversationEntry, o as ConversationRole, 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, S as ResolvedInteraction, T as TicketInfoOut, V as ToolName, W as ToolParamType, X as WSMessage, Y as WSMessageType, Z as redactPII, _ as serializePRBEState } from './types-BeZ2nQ9x.js';
3
3
  import 'events';
4
4
 
5
- var version = "0.1.16";
5
+ var version = "0.1.18";
6
6
 
7
7
  /**
8
8
  * tools/index.ts — Tool interface, registry, and closure tool
@@ -148,15 +148,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
148
148
  private persistedData;
149
149
  private fetchAbortController;
150
150
  private currentInvestigationSource;
151
- private currentCRId;
152
- private readonly historyStore;
151
+ private currentBackgroundId;
153
152
  /** Files flagged during the current tool call — uploaded immediately after the tool returns. */
154
153
  private pendingFlaggedFiles;
154
+ private userEmail?;
155
+ private userId?;
155
156
  private get agentID();
156
- private get trackedSessionIDs();
157
- private set trackedSessionIDs(value);
158
- private syncPolling;
159
- private addTrackedSession;
160
157
  constructor(config: PRBEAgentConfig);
161
158
  private hookElectronLog;
162
159
  private hookRendererLogs;
@@ -173,18 +170,31 @@ declare class PRBEAgent implements PRBEInteractionRequester {
173
170
  * Call this to add user profile data, app version, etc. after async initialization.
174
171
  */
175
172
  updateSessionMetadata(metadata: Record<string, unknown>): void;
173
+ /**
174
+ * Set a user identifier for this agent. Persists to the backend agents table.
175
+ * Can be called multiple times with different types to set both email and ID.
176
+ * Also auto-injects user_email and/or user_id into session metadata for investigations.
177
+ */
178
+ setUserIdentifier(type: UserIdentifierType, value: string): void;
179
+ /**
180
+ * Clear user identifier(s) for this agent.
181
+ * Pass a specific type to clear only that identifier, or omit to clear both email and ID.
182
+ */
183
+ clearUserIdentifier(type?: UserIdentifierType): void;
184
+ private syncUserIdentifierToBackend;
176
185
  /**
177
186
  * Register a custom tool that the middleware can invoke during investigations.
178
187
  */
179
188
  registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
180
189
  interactive?: boolean;
181
190
  }): void;
191
+ private runInvestigation;
182
192
  /**
183
193
  * User-initiated investigation. Updates `state` events/report directly.
184
194
  */
185
195
  investigate(query: string, contextRequestID?: string): Promise<void>;
186
196
  /**
187
- * Cancel user-initiated investigation only (does not cancel background CRs).
197
+ * Cancel user-initiated investigation only (does not cancel background investigations).
188
198
  */
189
199
  cancelInvestigation(): void;
190
200
  /**
@@ -192,15 +202,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
192
202
  */
193
203
  cancel(): void;
194
204
  /**
195
- * Poll the backend for context requests on tracked tickets.
196
- * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
205
+ * Poll the backend for context requests and external requests.
197
206
  */
198
207
  poll(): Promise<PollResponse | null>;
199
208
  /**
200
- * Fetch ticket display info for all tracked sessions.
201
- * Resolves session IDs → ticket IDs first, then fetches ticket info.
209
+ * Fetch agent history (tickets + sessions) from the backend.
202
210
  */
203
- fetchTicketInfo(): Promise<TicketInfoOut[]>;
211
+ fetchHistory(): Promise<AgentHistoryResponse | null>;
204
212
  stopPolling(): void;
205
213
  resumePolling(): void;
206
214
  /**
@@ -217,13 +225,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
217
225
  */
218
226
  static clearPersistedData(): void;
219
227
  private investigateForCR;
228
+ private investigateForER;
220
229
  private connectToProxy;
221
230
  private handleMessage;
222
231
  private extractArgs;
223
232
  private extractUploadPrefix;
224
233
  private static backgroundUpload;
225
234
  private startPolling;
226
- private resolveSessions;
227
235
  /**
228
236
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
229
237
  * that can crash the c-ares resolver during process shutdown.
@@ -346,4 +354,4 @@ declare class BashExecuteTool implements PRBETool {
346
354
  */
347
355
  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
356
 
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 };
357
+ export { AgentHistoryResponse, 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, UserIdentifierType, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };