@prbe.ai/electron-sdk 0.1.17 → 0.1.19

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, 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';
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-9iQH0zmA.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-9iQH0zmA.mjs';
3
3
  import 'events';
4
4
 
5
- var version = "0.1.17";
5
+ var version = "0.1.19";
6
6
 
7
7
  /**
8
8
  * tools/index.ts — Tool interface, registry, and closure tool
@@ -148,23 +148,18 @@ 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;
155
154
  private userEmail?;
156
155
  private userId?;
157
156
  private get agentID();
158
- private get trackedSessionIDs();
159
- private set trackedSessionIDs(value);
160
- private syncPolling;
161
- private addTrackedSession;
162
157
  constructor(config: PRBEAgentConfig);
163
158
  private hookElectronLog;
164
159
  private hookRendererLogs;
165
160
  private static mapElectronLogLevel;
166
161
  get investigationSource(): InvestigationSource;
167
- sendConversationMessage(content: string): void;
162
+ sendConversationMessage(content: string, role?: ConversationRole, label?: string): void;
168
163
  requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
169
164
  /**
170
165
  * Add an additional root directory to the runtime allowed roots.
@@ -193,12 +188,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
193
188
  registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
194
189
  interactive?: boolean;
195
190
  }): void;
191
+ private runInvestigation;
196
192
  /**
197
193
  * User-initiated investigation. Updates `state` events/report directly.
198
194
  */
199
195
  investigate(query: string, contextRequestID?: string): Promise<void>;
200
196
  /**
201
- * Cancel user-initiated investigation only (does not cancel background CRs).
197
+ * Cancel user-initiated investigation only (does not cancel background investigations).
202
198
  */
203
199
  cancelInvestigation(): void;
204
200
  /**
@@ -206,15 +202,19 @@ declare class PRBEAgent implements PRBEInteractionRequester {
206
202
  */
207
203
  cancel(): void;
208
204
  /**
209
- * Poll the backend for context requests on tracked tickets.
210
- * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
205
+ * Poll the backend for context requests and external requests.
211
206
  */
212
207
  poll(): Promise<PollResponse | null>;
213
208
  /**
214
- * Fetch ticket display info for all tracked sessions.
215
- * Resolves session IDs → ticket IDs first, then fetches ticket info.
209
+ * Fetch agent history (tickets + sessions) from the backend.
216
210
  */
217
- fetchTicketInfo(): Promise<TicketInfoOut[]>;
211
+ fetchHistory(): Promise<AgentHistoryResponse | null>;
212
+ fetchSanitizedFile(url: string): Promise<SanitizedFileResult>;
213
+ /**
214
+ * Detect whether a buffer contains text by checking for null bytes
215
+ * and verifying the content is valid UTF-8.
216
+ */
217
+ private static isTextContent;
218
218
  stopPolling(): void;
219
219
  resumePolling(): void;
220
220
  /**
@@ -231,13 +231,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
231
231
  */
232
232
  static clearPersistedData(): void;
233
233
  private investigateForCR;
234
+ private investigateForER;
234
235
  private connectToProxy;
235
236
  private handleMessage;
236
237
  private extractArgs;
237
238
  private extractUploadPrefix;
238
239
  private static backgroundUpload;
239
240
  private startPolling;
240
- private resolveSessions;
241
241
  /**
242
242
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
243
243
  * that can crash the c-ares resolver during process shutdown.
@@ -360,4 +360,4 @@ declare class BashExecuteTool implements PRBETool {
360
360
  */
361
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>";
362
362
 
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 };
363
+ export { AgentHistoryResponse, AskUserTool, BashExecuteTool, ClearAppLogsTool, ConversationRole, 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, SanitizedFileResult, 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, 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';
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-9iQH0zmA.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-9iQH0zmA.js';
3
3
  import 'events';
4
4
 
5
- var version = "0.1.17";
5
+ var version = "0.1.19";
6
6
 
7
7
  /**
8
8
  * tools/index.ts — Tool interface, registry, and closure tool
@@ -148,23 +148,18 @@ 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;
155
154
  private userEmail?;
156
155
  private userId?;
157
156
  private get agentID();
158
- private get trackedSessionIDs();
159
- private set trackedSessionIDs(value);
160
- private syncPolling;
161
- private addTrackedSession;
162
157
  constructor(config: PRBEAgentConfig);
163
158
  private hookElectronLog;
164
159
  private hookRendererLogs;
165
160
  private static mapElectronLogLevel;
166
161
  get investigationSource(): InvestigationSource;
167
- sendConversationMessage(content: string): void;
162
+ sendConversationMessage(content: string, role?: ConversationRole, label?: string): void;
168
163
  requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
169
164
  /**
170
165
  * Add an additional root directory to the runtime allowed roots.
@@ -193,12 +188,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
193
188
  registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
194
189
  interactive?: boolean;
195
190
  }): void;
191
+ private runInvestigation;
196
192
  /**
197
193
  * User-initiated investigation. Updates `state` events/report directly.
198
194
  */
199
195
  investigate(query: string, contextRequestID?: string): Promise<void>;
200
196
  /**
201
- * Cancel user-initiated investigation only (does not cancel background CRs).
197
+ * Cancel user-initiated investigation only (does not cancel background investigations).
202
198
  */
203
199
  cancelInvestigation(): void;
204
200
  /**
@@ -206,15 +202,19 @@ declare class PRBEAgent implements PRBEInteractionRequester {
206
202
  */
207
203
  cancel(): void;
208
204
  /**
209
- * Poll the backend for context requests on tracked tickets.
210
- * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
205
+ * Poll the backend for context requests and external requests.
211
206
  */
212
207
  poll(): Promise<PollResponse | null>;
213
208
  /**
214
- * Fetch ticket display info for all tracked sessions.
215
- * Resolves session IDs → ticket IDs first, then fetches ticket info.
209
+ * Fetch agent history (tickets + sessions) from the backend.
216
210
  */
217
- fetchTicketInfo(): Promise<TicketInfoOut[]>;
211
+ fetchHistory(): Promise<AgentHistoryResponse | null>;
212
+ fetchSanitizedFile(url: string): Promise<SanitizedFileResult>;
213
+ /**
214
+ * Detect whether a buffer contains text by checking for null bytes
215
+ * and verifying the content is valid UTF-8.
216
+ */
217
+ private static isTextContent;
218
218
  stopPolling(): void;
219
219
  resumePolling(): void;
220
220
  /**
@@ -231,13 +231,13 @@ declare class PRBEAgent implements PRBEInteractionRequester {
231
231
  */
232
232
  static clearPersistedData(): void;
233
233
  private investigateForCR;
234
+ private investigateForER;
234
235
  private connectToProxy;
235
236
  private handleMessage;
236
237
  private extractArgs;
237
238
  private extractUploadPrefix;
238
239
  private static backgroundUpload;
239
240
  private startPolling;
240
- private resolveSessions;
241
241
  /**
242
242
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
243
243
  * that can crash the c-ares resolver during process shutdown.
@@ -360,4 +360,4 @@ declare class BashExecuteTool implements PRBETool {
360
360
  */
361
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>";
362
362
 
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 };
363
+ export { AgentHistoryResponse, AskUserTool, BashExecuteTool, ClearAppLogsTool, ConversationRole, 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, SanitizedFileResult, SearchAppLogsTool, SearchContentTool, UserIdentifierType, humanReadableSize, resolveAndValidate, resolveWithAccessRequest };