@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.
@@ -9,7 +9,8 @@ import { EventEmitter } from 'events';
9
9
  declare enum InteractionType {
10
10
  ASK_QUESTION = "ask_question",
11
11
  REQUEST_PERMISSION = "request_permission",
12
- REQUEST_PATH_ACCESS = "request_path_access"
12
+ REQUEST_PATH_ACCESS = "request_path_access",
13
+ REVIEW_SANITIZED_OUTPUT = "review_sanitized_output"
13
14
  }
14
15
  interface AskQuestionPayload {
15
16
  type: InteractionType.ASK_QUESTION;
@@ -30,7 +31,19 @@ interface RequestPathAccessPayload {
30
31
  path: string;
31
32
  reason: string;
32
33
  }
33
- type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload;
34
+ interface SanitizedFileRef {
35
+ key: string;
36
+ url: string;
37
+ }
38
+ interface ReviewSanitizedOutputPayload {
39
+ type: InteractionType.REVIEW_SANITIZED_OUTPUT;
40
+ interactionId: string;
41
+ sanitizedAnalysis: string;
42
+ files: SanitizedFileRef[];
43
+ summary: string;
44
+ issues: SanitizationIssue[];
45
+ }
46
+ type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload | ReviewSanitizedOutputPayload;
34
47
  interface AskQuestionResponse {
35
48
  type: InteractionType.ASK_QUESTION;
36
49
  answer: string;
@@ -43,14 +56,20 @@ interface RequestPathAccessResponse {
43
56
  type: InteractionType.REQUEST_PATH_ACCESS;
44
57
  granted: boolean;
45
58
  }
46
- type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse;
59
+ interface ReviewSanitizedOutputResponse {
60
+ type: InteractionType.REVIEW_SANITIZED_OUTPUT;
61
+ approved: boolean;
62
+ editedText?: string;
63
+ }
64
+ type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse | ReviewSanitizedOutputResponse;
47
65
  declare enum InvestigationSource {
48
66
  USER = "user",
49
- CONTEXT_REQUEST = "context_request"
67
+ CONTEXT_REQUEST = "context_request",
68
+ EXTERNAL_REQUEST = "external_request"
50
69
  }
51
70
  interface PRBEInteractionRequester {
52
71
  requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
53
- sendConversationMessage(content: string): void;
72
+ sendConversationMessage(content: string, role?: ConversationRole, label?: string): void;
54
73
  readonly investigationSource: InvestigationSource;
55
74
  }
56
75
  interface PRBEInteractionHandler {
@@ -85,7 +104,10 @@ declare enum WSMessageType {
85
104
  CONVERSATION_UPDATE = "conversation_update",
86
105
  COMPLETE = "complete",
87
106
  ERROR = "error",
88
- PING = "ping"
107
+ PING = "ping",
108
+ PRIVACY_SANITIZING = "privacy_sanitizing",
109
+ PRIVACY_REVIEW = "privacy_review",
110
+ PRIVACY_REVIEW_RESPONSE = "privacy_review_response"
89
111
  }
90
112
  declare enum ConversationRole {
91
113
  User = "user",
@@ -179,6 +201,19 @@ interface PRBEAgentConfig {
179
201
  /** Custom metadata included in every session submission (e.g. user profile, app version). */
180
202
  [PRBEAgentConfigKey.SESSION_METADATA]?: Record<string, unknown>;
181
203
  }
204
+ interface SanitizationIssue {
205
+ type: "pii" | "ngram_overlap" | "incomplete";
206
+ detail: string;
207
+ severity: "high" | "medium" | "low";
208
+ }
209
+ type SanitizedFileResult = {
210
+ isText: true;
211
+ content: string;
212
+ url: string;
213
+ } | {
214
+ isText: false;
215
+ url: string;
216
+ };
182
217
  declare enum PRBEAgentStatusType {
183
218
  STARTED = "started",
184
219
  THINKING = "thinking",
@@ -187,7 +222,8 @@ declare enum PRBEAgentStatusType {
187
222
  OBSERVATION = "observation",
188
223
  COMPLETED = "completed",
189
224
  ERROR = "error",
190
- AWAITING_INTERACTION = "awaiting_interaction"
225
+ AWAITING_INTERACTION = "awaiting_interaction",
226
+ PRIVACY_SANITIZING = "privacy_sanitizing"
191
227
  }
192
228
  type PRBEAgentStatus = {
193
229
  type: PRBEAgentStatusType.STARTED;
@@ -213,6 +249,8 @@ type PRBEAgentStatus = {
213
249
  } | {
214
250
  type: PRBEAgentStatusType.AWAITING_INTERACTION;
215
251
  interactionPayload: InteractionPayload;
252
+ } | {
253
+ type: PRBEAgentStatusType.PRIVACY_SANITIZING;
216
254
  };
217
255
  interface InvestigationResult {
218
256
  report: string;
@@ -227,25 +265,26 @@ interface FlaggedFileIn {
227
265
  }
228
266
  interface PollRequest {
229
267
  agent_id: string;
230
- ticket_ids: string[];
231
268
  }
232
269
  interface ContextRequestOut {
233
270
  id: string;
234
271
  query: string;
235
272
  slug?: string;
273
+ ticket_id: string;
236
274
  is_active: boolean;
237
275
  created_at: string;
238
276
  }
239
- interface TicketStatusOut {
240
- ticket_id: string;
241
- status: string;
242
- context_requests: ContextRequestOut[];
277
+ interface ExternalRequestOut {
278
+ id: string;
279
+ query: string;
280
+ source: string;
281
+ source_detail?: string;
282
+ is_active: boolean;
283
+ created_at: string;
243
284
  }
244
285
  interface PollResponse {
245
- tickets: TicketStatusOut[];
246
- }
247
- interface TicketInfoRequest {
248
- ticket_ids: string[];
286
+ context_requests: ContextRequestOut[];
287
+ external_requests: ExternalRequestOut[];
249
288
  }
250
289
  interface TicketInfoOut {
251
290
  ticket_id: string;
@@ -255,8 +294,25 @@ interface TicketInfoOut {
255
294
  description?: string;
256
295
  session_count: number;
257
296
  }
258
- interface TicketInfoResponse {
259
- tickets: TicketInfoOut[];
297
+ interface AgentHistoryRequest {
298
+ agent_id: string;
299
+ }
300
+ interface AgentSessionOut {
301
+ session_id: string;
302
+ title: string;
303
+ status: string;
304
+ context_summary?: string;
305
+ created_at: string;
306
+ }
307
+ interface AgentTicketOut {
308
+ ticket_id: string;
309
+ title: string;
310
+ status: string;
311
+ priority?: string;
312
+ sessions: AgentSessionOut[];
313
+ }
314
+ interface AgentHistoryResponse {
315
+ tickets: AgentTicketOut[];
260
316
  }
261
317
  interface PRBEStatusEvent {
262
318
  id: string;
@@ -265,11 +321,13 @@ interface PRBEStatusEvent {
265
321
  isCompleted: boolean;
266
322
  isExpanded: boolean;
267
323
  }
268
- interface PRBECRInvestigation {
324
+ interface PRBEBackgroundInvestigation {
269
325
  id: string;
270
326
  query: string;
271
327
  slug?: string;
272
328
  ticketId?: string;
329
+ source?: string;
330
+ sourceDetail?: string;
273
331
  events: PRBEStatusEvent[];
274
332
  isRunning: boolean;
275
333
  isCompleted: boolean;
@@ -281,6 +339,7 @@ interface PRBECRInvestigation {
281
339
  startedAt: Date;
282
340
  pendingInteraction?: InteractionPayload;
283
341
  resolvedInteractions?: ResolvedInteraction[];
342
+ conversationHistory: ConversationEntry[];
284
343
  }
285
344
  interface PRBECompletedInvestigation {
286
345
  id: string;
@@ -293,18 +352,6 @@ interface PRBECompletedInvestigation {
293
352
  conversationHistory?: ConversationEntry[];
294
353
  completedAt: Date;
295
354
  }
296
- interface ResolveSessionsRequest {
297
- agent_id: string;
298
- session_ids: string[];
299
- }
300
- interface ResolvedTicketOut {
301
- ticket_id: string;
302
- status: string;
303
- session_ids: string[];
304
- }
305
- interface ResolveSessionsResponse {
306
- tickets: ResolvedTicketOut[];
307
- }
308
355
  declare enum PRBEAgentErrorType {
309
356
  SERVER_ERROR = "server_error",
310
357
  NETWORK_ERROR = "network_error",
@@ -336,10 +383,10 @@ declare enum PRBEStateEvent {
336
383
  COMPLETE = "complete",
337
384
  /** Emitted on error. Payload: { message: string } */
338
385
  ERROR = "error",
339
- /** Emitted when a background CR starts. Payload: PRBECRInvestigation */
340
- CR_START = "cr-start",
341
- /** Emitted when a background CR completes/fails. Payload: PRBECRInvestigation */
342
- CR_COMPLETE = "cr-complete",
386
+ /** Emitted when a background investigation starts. Payload: PRBEBackgroundInvestigation */
387
+ BACKGROUND_START = "background-start",
388
+ /** Emitted when a background investigation completes/fails. Payload: PRBEBackgroundInvestigation */
389
+ BACKGROUND_COMPLETE = "background-complete",
343
390
  /** Emitted when tracked ticket IDs change. Payload: string[] */
344
391
  TICKETS_CHANGED = "tickets-changed",
345
392
  /** Emitted when ticket info is updated. Payload: TicketInfoOut[] */
@@ -362,37 +409,42 @@ declare class PRBEAgentState extends EventEmitter {
362
409
  resolvedInteractions: ResolvedInteraction[];
363
410
  agentMessage?: string;
364
411
  conversationHistory: ConversationEntry[];
412
+ isPrivacySanitizing: boolean;
365
413
  completedInvestigations: PRBECompletedInvestigation[];
366
- activeCRs: Map<string, PRBECRInvestigation>;
367
- completedCRs: PRBECRInvestigation[];
414
+ activeBackgroundInvestigations: Map<string, PRBEBackgroundInvestigation>;
415
+ completedBackgroundInvestigations: PRBEBackgroundInvestigation[];
368
416
  trackedSessionIDs: string[];
369
417
  ticketInfo: TicketInfoOut[];
418
+ agentHistory: AgentTicketOut[];
370
419
  get hasActiveWork(): boolean;
371
- get activeCRCount(): number;
420
+ get activeBackgroundCount(): number;
372
421
  get isActive(): boolean;
373
422
  beginInvestigation(query: string): void;
374
423
  appendConversation(entry: ConversationEntry): void;
424
+ appendBackgroundConversation(backgroundId: string, entry: ConversationEntry): void;
375
425
  resetInvestigation(): void;
376
426
  appendEvent(label: string, detail?: string, completed?: boolean): void;
377
427
  attachObservation(text: string): void;
378
428
  completeInvestigation(report: string, ticketId?: string): void;
379
429
  failInvestigation(message: string): void;
430
+ setPrivacySanitizing(value: boolean): void;
380
431
  setPendingInteraction(payload: InteractionPayload): void;
381
432
  clearPendingInteraction(): void;
382
- setCRPendingInteraction(crID: string, payload: InteractionPayload): void;
383
- clearCRPendingInteraction(crID: string): void;
433
+ setBackgroundPendingInteraction(backgroundId: string, payload: InteractionPayload): void;
434
+ clearBackgroundPendingInteraction(backgroundId: string): void;
384
435
  resolveInteraction(response: InteractionResponse): void;
385
- resolveCRInteraction(crID: string, response: InteractionResponse): void;
436
+ resolveBackgroundInteraction(backgroundId: string, response: InteractionResponse): void;
386
437
  setAgentMessage(message: string): void;
387
- setCRAgentMessage(crID: string, message: string): void;
438
+ setBackgroundAgentMessage(backgroundId: string, message: string): void;
388
439
  toggleExpansion(eventId: string): void;
389
- beginCR(id: string, query: string, slug?: string, ticketId?: string): void;
390
- appendCREvent(crID: string, label: string, detail?: string, completed?: boolean): void;
391
- attachCRObservation(crID: string, text: string): void;
392
- completeCR(id: string, report: string): void;
393
- failCR(id: string, message: string): void;
440
+ beginBackgroundInvestigation(id: string, query: string, slug?: string, ticketId?: string, source?: string, sourceDetail?: string): void;
441
+ appendBackgroundEvent(backgroundId: string, label: string, detail?: string, completed?: boolean): void;
442
+ attachBackgroundObservation(backgroundId: string, text: string): void;
443
+ completeBackgroundInvestigation(id: string, report: string): void;
444
+ failBackgroundInvestigation(id: string, message: string): void;
394
445
  updateTrackedSessionIDs(ids: string[]): void;
395
446
  updateTicketInfo(info: TicketInfoOut[]): void;
447
+ updateAgentHistory(tickets: AgentTicketOut[]): void;
396
448
  }
397
449
 
398
450
  /**
@@ -402,11 +454,13 @@ declare class PRBEAgentState extends EventEmitter {
402
454
  * plain JSON-safe objects suitable for IPC or structured clone.
403
455
  */
404
456
 
405
- interface PRBESerializedCR {
457
+ interface PRBESerializedBackgroundInvestigation {
406
458
  id: string;
407
459
  query: string;
408
460
  slug?: string;
409
461
  ticketId?: string;
462
+ source?: string;
463
+ sourceDetail?: string;
410
464
  events: PRBEStatusEvent[];
411
465
  isRunning: boolean;
412
466
  isCompleted: boolean;
@@ -418,6 +472,7 @@ interface PRBESerializedCR {
418
472
  startedAt: string;
419
473
  pendingInteraction?: InteractionPayload;
420
474
  resolvedInteractions?: ResolvedInteraction[];
475
+ conversationHistory: ConversationEntry[];
421
476
  }
422
477
  type PRBESerializedTicket = TicketInfoOut;
423
478
  interface PRBESerializedCompletedInvestigation {
@@ -433,6 +488,7 @@ interface PRBESerializedCompletedInvestigation {
433
488
  }
434
489
  interface PRBESerializedState {
435
490
  isInvestigating: boolean;
491
+ isPrivacySanitizing: boolean;
436
492
  events: PRBEStatusEvent[];
437
493
  report: string;
438
494
  summary?: string;
@@ -443,13 +499,13 @@ interface PRBESerializedState {
443
499
  agentMessage?: string;
444
500
  conversationHistory: ConversationEntry[];
445
501
  completedInvestigations: PRBESerializedCompletedInvestigation[];
446
- activeCRs: PRBESerializedCR[];
447
- completedCRs: PRBESerializedCR[];
448
- trackedSessionIDs: string[];
502
+ activeBackgroundInvestigations: PRBESerializedBackgroundInvestigation[];
503
+ completedBackgroundInvestigations: PRBESerializedBackgroundInvestigation[];
449
504
  ticketInfo: PRBESerializedTicket[];
505
+ agentHistory: AgentTicketOut[];
450
506
  hasActiveWork: boolean;
451
507
  }
452
508
  declare const DEFAULT_PRBE_STATE: PRBESerializedState;
453
509
  declare function serializePRBEState(state: PRBEAgentState): PRBESerializedState;
454
510
 
455
- export { serializePRBEState as $, API_URL as A, type PRBEStatusEvent as B, type ContextRequestOut as C, DEFAULT_PRBE_STATE as D, type PollRequest as E, type FlaggedFileIn as F, type RequestPathAccessResponse as G, type RequestPermissionPayload as H, InvestigationSource as I, type RequestPermissionResponse as J, type ResolveSessionsRequest as K, type ResolveSessionsResponse as L, MIDDLEWARE_URL as M, type ResolvedInteraction as N, type ResolvedTicketOut as O, type PRBEToolDeclaration as P, type TicketInfoRequest as Q, type RequestPathAccessPayload as R, type TicketInfoResponse as S, type TicketInfoOut as T, UserIdentifierType as U, type TicketStatusOut as V, ToolName as W, ToolParamType as X, type WSMessage as Y, WSMessageType as Z, redactPII as _, type PRBEToolParameter as a, type PRBEInteractionRequester as b, PRBEAgentState as c, type PRBEAgentConfig as d, type InteractionPayload as e, type InteractionResponse as f, type PollResponse as g, type AskQuestionPayload as h, type AskQuestionResponse as i, type ConversationEntry as j, ConversationRole as k, InteractionType as l, type InvestigationResult as m, PRBEAgentConfigKey as n, PRBEAgentError as o, PRBEAgentErrorType as p, type PRBEAgentStatus as q, PRBEAgentStatusType as r, type PRBECRInvestigation as s, type PRBECompletedInvestigation as t, type PRBEInteractionHandler as u, type PRBESerializedCR as v, type PRBESerializedCompletedInvestigation as w, type PRBESerializedState as x, type PRBESerializedTicket as y, PRBEStateEvent as z };
511
+ export { ToolParamType as $, type AgentHistoryResponse as A, type PRBESerializedCompletedInvestigation as B, ConversationRole as C, DEFAULT_PRBE_STATE as D, type ExternalRequestOut as E, type FlaggedFileIn as F, type PRBESerializedState as G, type PRBESerializedTicket as H, InvestigationSource as I, PRBEStateEvent as J, type PRBEStatusEvent as K, type PollRequest as L, MIDDLEWARE_URL as M, type RequestPathAccessResponse as N, type RequestPermissionPayload as O, type PRBEToolDeclaration as P, type RequestPermissionResponse as Q, type RequestPathAccessPayload as R, type SanitizedFileResult as S, type ResolvedInteraction as T, UserIdentifierType as U, type ReviewSanitizedOutputPayload as V, type ReviewSanitizedOutputResponse as W, type SanitizationIssue as X, type SanitizedFileRef as Y, type TicketInfoOut as Z, ToolName as _, type PRBEToolParameter as a, type WSMessage as a0, WSMessageType as a1, redactPII as a2, serializePRBEState as a3, type PRBEInteractionRequester as b, PRBEAgentState as c, type PRBEAgentConfig as d, type InteractionPayload as e, type InteractionResponse as f, type PollResponse as g, API_URL as h, type AgentHistoryRequest as i, type AgentSessionOut as j, type AgentTicketOut as k, type AskQuestionPayload as l, type AskQuestionResponse as m, type ContextRequestOut as n, type ConversationEntry as o, InteractionType as p, type InvestigationResult as q, PRBEAgentConfigKey as r, PRBEAgentError as s, PRBEAgentErrorType as t, type PRBEAgentStatus as u, PRBEAgentStatusType as v, type PRBEBackgroundInvestigation as w, type PRBECompletedInvestigation as x, type PRBEInteractionHandler as y, type PRBESerializedBackgroundInvestigation as z };
@@ -9,7 +9,8 @@ import { EventEmitter } from 'events';
9
9
  declare enum InteractionType {
10
10
  ASK_QUESTION = "ask_question",
11
11
  REQUEST_PERMISSION = "request_permission",
12
- REQUEST_PATH_ACCESS = "request_path_access"
12
+ REQUEST_PATH_ACCESS = "request_path_access",
13
+ REVIEW_SANITIZED_OUTPUT = "review_sanitized_output"
13
14
  }
14
15
  interface AskQuestionPayload {
15
16
  type: InteractionType.ASK_QUESTION;
@@ -30,7 +31,19 @@ interface RequestPathAccessPayload {
30
31
  path: string;
31
32
  reason: string;
32
33
  }
33
- type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload;
34
+ interface SanitizedFileRef {
35
+ key: string;
36
+ url: string;
37
+ }
38
+ interface ReviewSanitizedOutputPayload {
39
+ type: InteractionType.REVIEW_SANITIZED_OUTPUT;
40
+ interactionId: string;
41
+ sanitizedAnalysis: string;
42
+ files: SanitizedFileRef[];
43
+ summary: string;
44
+ issues: SanitizationIssue[];
45
+ }
46
+ type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload | ReviewSanitizedOutputPayload;
34
47
  interface AskQuestionResponse {
35
48
  type: InteractionType.ASK_QUESTION;
36
49
  answer: string;
@@ -43,14 +56,20 @@ interface RequestPathAccessResponse {
43
56
  type: InteractionType.REQUEST_PATH_ACCESS;
44
57
  granted: boolean;
45
58
  }
46
- type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse;
59
+ interface ReviewSanitizedOutputResponse {
60
+ type: InteractionType.REVIEW_SANITIZED_OUTPUT;
61
+ approved: boolean;
62
+ editedText?: string;
63
+ }
64
+ type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse | ReviewSanitizedOutputResponse;
47
65
  declare enum InvestigationSource {
48
66
  USER = "user",
49
- CONTEXT_REQUEST = "context_request"
67
+ CONTEXT_REQUEST = "context_request",
68
+ EXTERNAL_REQUEST = "external_request"
50
69
  }
51
70
  interface PRBEInteractionRequester {
52
71
  requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
53
- sendConversationMessage(content: string): void;
72
+ sendConversationMessage(content: string, role?: ConversationRole, label?: string): void;
54
73
  readonly investigationSource: InvestigationSource;
55
74
  }
56
75
  interface PRBEInteractionHandler {
@@ -85,7 +104,10 @@ declare enum WSMessageType {
85
104
  CONVERSATION_UPDATE = "conversation_update",
86
105
  COMPLETE = "complete",
87
106
  ERROR = "error",
88
- PING = "ping"
107
+ PING = "ping",
108
+ PRIVACY_SANITIZING = "privacy_sanitizing",
109
+ PRIVACY_REVIEW = "privacy_review",
110
+ PRIVACY_REVIEW_RESPONSE = "privacy_review_response"
89
111
  }
90
112
  declare enum ConversationRole {
91
113
  User = "user",
@@ -179,6 +201,19 @@ interface PRBEAgentConfig {
179
201
  /** Custom metadata included in every session submission (e.g. user profile, app version). */
180
202
  [PRBEAgentConfigKey.SESSION_METADATA]?: Record<string, unknown>;
181
203
  }
204
+ interface SanitizationIssue {
205
+ type: "pii" | "ngram_overlap" | "incomplete";
206
+ detail: string;
207
+ severity: "high" | "medium" | "low";
208
+ }
209
+ type SanitizedFileResult = {
210
+ isText: true;
211
+ content: string;
212
+ url: string;
213
+ } | {
214
+ isText: false;
215
+ url: string;
216
+ };
182
217
  declare enum PRBEAgentStatusType {
183
218
  STARTED = "started",
184
219
  THINKING = "thinking",
@@ -187,7 +222,8 @@ declare enum PRBEAgentStatusType {
187
222
  OBSERVATION = "observation",
188
223
  COMPLETED = "completed",
189
224
  ERROR = "error",
190
- AWAITING_INTERACTION = "awaiting_interaction"
225
+ AWAITING_INTERACTION = "awaiting_interaction",
226
+ PRIVACY_SANITIZING = "privacy_sanitizing"
191
227
  }
192
228
  type PRBEAgentStatus = {
193
229
  type: PRBEAgentStatusType.STARTED;
@@ -213,6 +249,8 @@ type PRBEAgentStatus = {
213
249
  } | {
214
250
  type: PRBEAgentStatusType.AWAITING_INTERACTION;
215
251
  interactionPayload: InteractionPayload;
252
+ } | {
253
+ type: PRBEAgentStatusType.PRIVACY_SANITIZING;
216
254
  };
217
255
  interface InvestigationResult {
218
256
  report: string;
@@ -227,25 +265,26 @@ interface FlaggedFileIn {
227
265
  }
228
266
  interface PollRequest {
229
267
  agent_id: string;
230
- ticket_ids: string[];
231
268
  }
232
269
  interface ContextRequestOut {
233
270
  id: string;
234
271
  query: string;
235
272
  slug?: string;
273
+ ticket_id: string;
236
274
  is_active: boolean;
237
275
  created_at: string;
238
276
  }
239
- interface TicketStatusOut {
240
- ticket_id: string;
241
- status: string;
242
- context_requests: ContextRequestOut[];
277
+ interface ExternalRequestOut {
278
+ id: string;
279
+ query: string;
280
+ source: string;
281
+ source_detail?: string;
282
+ is_active: boolean;
283
+ created_at: string;
243
284
  }
244
285
  interface PollResponse {
245
- tickets: TicketStatusOut[];
246
- }
247
- interface TicketInfoRequest {
248
- ticket_ids: string[];
286
+ context_requests: ContextRequestOut[];
287
+ external_requests: ExternalRequestOut[];
249
288
  }
250
289
  interface TicketInfoOut {
251
290
  ticket_id: string;
@@ -255,8 +294,25 @@ interface TicketInfoOut {
255
294
  description?: string;
256
295
  session_count: number;
257
296
  }
258
- interface TicketInfoResponse {
259
- tickets: TicketInfoOut[];
297
+ interface AgentHistoryRequest {
298
+ agent_id: string;
299
+ }
300
+ interface AgentSessionOut {
301
+ session_id: string;
302
+ title: string;
303
+ status: string;
304
+ context_summary?: string;
305
+ created_at: string;
306
+ }
307
+ interface AgentTicketOut {
308
+ ticket_id: string;
309
+ title: string;
310
+ status: string;
311
+ priority?: string;
312
+ sessions: AgentSessionOut[];
313
+ }
314
+ interface AgentHistoryResponse {
315
+ tickets: AgentTicketOut[];
260
316
  }
261
317
  interface PRBEStatusEvent {
262
318
  id: string;
@@ -265,11 +321,13 @@ interface PRBEStatusEvent {
265
321
  isCompleted: boolean;
266
322
  isExpanded: boolean;
267
323
  }
268
- interface PRBECRInvestigation {
324
+ interface PRBEBackgroundInvestigation {
269
325
  id: string;
270
326
  query: string;
271
327
  slug?: string;
272
328
  ticketId?: string;
329
+ source?: string;
330
+ sourceDetail?: string;
273
331
  events: PRBEStatusEvent[];
274
332
  isRunning: boolean;
275
333
  isCompleted: boolean;
@@ -281,6 +339,7 @@ interface PRBECRInvestigation {
281
339
  startedAt: Date;
282
340
  pendingInteraction?: InteractionPayload;
283
341
  resolvedInteractions?: ResolvedInteraction[];
342
+ conversationHistory: ConversationEntry[];
284
343
  }
285
344
  interface PRBECompletedInvestigation {
286
345
  id: string;
@@ -293,18 +352,6 @@ interface PRBECompletedInvestigation {
293
352
  conversationHistory?: ConversationEntry[];
294
353
  completedAt: Date;
295
354
  }
296
- interface ResolveSessionsRequest {
297
- agent_id: string;
298
- session_ids: string[];
299
- }
300
- interface ResolvedTicketOut {
301
- ticket_id: string;
302
- status: string;
303
- session_ids: string[];
304
- }
305
- interface ResolveSessionsResponse {
306
- tickets: ResolvedTicketOut[];
307
- }
308
355
  declare enum PRBEAgentErrorType {
309
356
  SERVER_ERROR = "server_error",
310
357
  NETWORK_ERROR = "network_error",
@@ -336,10 +383,10 @@ declare enum PRBEStateEvent {
336
383
  COMPLETE = "complete",
337
384
  /** Emitted on error. Payload: { message: string } */
338
385
  ERROR = "error",
339
- /** Emitted when a background CR starts. Payload: PRBECRInvestigation */
340
- CR_START = "cr-start",
341
- /** Emitted when a background CR completes/fails. Payload: PRBECRInvestigation */
342
- CR_COMPLETE = "cr-complete",
386
+ /** Emitted when a background investigation starts. Payload: PRBEBackgroundInvestigation */
387
+ BACKGROUND_START = "background-start",
388
+ /** Emitted when a background investigation completes/fails. Payload: PRBEBackgroundInvestigation */
389
+ BACKGROUND_COMPLETE = "background-complete",
343
390
  /** Emitted when tracked ticket IDs change. Payload: string[] */
344
391
  TICKETS_CHANGED = "tickets-changed",
345
392
  /** Emitted when ticket info is updated. Payload: TicketInfoOut[] */
@@ -362,37 +409,42 @@ declare class PRBEAgentState extends EventEmitter {
362
409
  resolvedInteractions: ResolvedInteraction[];
363
410
  agentMessage?: string;
364
411
  conversationHistory: ConversationEntry[];
412
+ isPrivacySanitizing: boolean;
365
413
  completedInvestigations: PRBECompletedInvestigation[];
366
- activeCRs: Map<string, PRBECRInvestigation>;
367
- completedCRs: PRBECRInvestigation[];
414
+ activeBackgroundInvestigations: Map<string, PRBEBackgroundInvestigation>;
415
+ completedBackgroundInvestigations: PRBEBackgroundInvestigation[];
368
416
  trackedSessionIDs: string[];
369
417
  ticketInfo: TicketInfoOut[];
418
+ agentHistory: AgentTicketOut[];
370
419
  get hasActiveWork(): boolean;
371
- get activeCRCount(): number;
420
+ get activeBackgroundCount(): number;
372
421
  get isActive(): boolean;
373
422
  beginInvestigation(query: string): void;
374
423
  appendConversation(entry: ConversationEntry): void;
424
+ appendBackgroundConversation(backgroundId: string, entry: ConversationEntry): void;
375
425
  resetInvestigation(): void;
376
426
  appendEvent(label: string, detail?: string, completed?: boolean): void;
377
427
  attachObservation(text: string): void;
378
428
  completeInvestigation(report: string, ticketId?: string): void;
379
429
  failInvestigation(message: string): void;
430
+ setPrivacySanitizing(value: boolean): void;
380
431
  setPendingInteraction(payload: InteractionPayload): void;
381
432
  clearPendingInteraction(): void;
382
- setCRPendingInteraction(crID: string, payload: InteractionPayload): void;
383
- clearCRPendingInteraction(crID: string): void;
433
+ setBackgroundPendingInteraction(backgroundId: string, payload: InteractionPayload): void;
434
+ clearBackgroundPendingInteraction(backgroundId: string): void;
384
435
  resolveInteraction(response: InteractionResponse): void;
385
- resolveCRInteraction(crID: string, response: InteractionResponse): void;
436
+ resolveBackgroundInteraction(backgroundId: string, response: InteractionResponse): void;
386
437
  setAgentMessage(message: string): void;
387
- setCRAgentMessage(crID: string, message: string): void;
438
+ setBackgroundAgentMessage(backgroundId: string, message: string): void;
388
439
  toggleExpansion(eventId: string): void;
389
- beginCR(id: string, query: string, slug?: string, ticketId?: string): void;
390
- appendCREvent(crID: string, label: string, detail?: string, completed?: boolean): void;
391
- attachCRObservation(crID: string, text: string): void;
392
- completeCR(id: string, report: string): void;
393
- failCR(id: string, message: string): void;
440
+ beginBackgroundInvestigation(id: string, query: string, slug?: string, ticketId?: string, source?: string, sourceDetail?: string): void;
441
+ appendBackgroundEvent(backgroundId: string, label: string, detail?: string, completed?: boolean): void;
442
+ attachBackgroundObservation(backgroundId: string, text: string): void;
443
+ completeBackgroundInvestigation(id: string, report: string): void;
444
+ failBackgroundInvestigation(id: string, message: string): void;
394
445
  updateTrackedSessionIDs(ids: string[]): void;
395
446
  updateTicketInfo(info: TicketInfoOut[]): void;
447
+ updateAgentHistory(tickets: AgentTicketOut[]): void;
396
448
  }
397
449
 
398
450
  /**
@@ -402,11 +454,13 @@ declare class PRBEAgentState extends EventEmitter {
402
454
  * plain JSON-safe objects suitable for IPC or structured clone.
403
455
  */
404
456
 
405
- interface PRBESerializedCR {
457
+ interface PRBESerializedBackgroundInvestigation {
406
458
  id: string;
407
459
  query: string;
408
460
  slug?: string;
409
461
  ticketId?: string;
462
+ source?: string;
463
+ sourceDetail?: string;
410
464
  events: PRBEStatusEvent[];
411
465
  isRunning: boolean;
412
466
  isCompleted: boolean;
@@ -418,6 +472,7 @@ interface PRBESerializedCR {
418
472
  startedAt: string;
419
473
  pendingInteraction?: InteractionPayload;
420
474
  resolvedInteractions?: ResolvedInteraction[];
475
+ conversationHistory: ConversationEntry[];
421
476
  }
422
477
  type PRBESerializedTicket = TicketInfoOut;
423
478
  interface PRBESerializedCompletedInvestigation {
@@ -433,6 +488,7 @@ interface PRBESerializedCompletedInvestigation {
433
488
  }
434
489
  interface PRBESerializedState {
435
490
  isInvestigating: boolean;
491
+ isPrivacySanitizing: boolean;
436
492
  events: PRBEStatusEvent[];
437
493
  report: string;
438
494
  summary?: string;
@@ -443,13 +499,13 @@ interface PRBESerializedState {
443
499
  agentMessage?: string;
444
500
  conversationHistory: ConversationEntry[];
445
501
  completedInvestigations: PRBESerializedCompletedInvestigation[];
446
- activeCRs: PRBESerializedCR[];
447
- completedCRs: PRBESerializedCR[];
448
- trackedSessionIDs: string[];
502
+ activeBackgroundInvestigations: PRBESerializedBackgroundInvestigation[];
503
+ completedBackgroundInvestigations: PRBESerializedBackgroundInvestigation[];
449
504
  ticketInfo: PRBESerializedTicket[];
505
+ agentHistory: AgentTicketOut[];
450
506
  hasActiveWork: boolean;
451
507
  }
452
508
  declare const DEFAULT_PRBE_STATE: PRBESerializedState;
453
509
  declare function serializePRBEState(state: PRBEAgentState): PRBESerializedState;
454
510
 
455
- export { serializePRBEState as $, API_URL as A, type PRBEStatusEvent as B, type ContextRequestOut as C, DEFAULT_PRBE_STATE as D, type PollRequest as E, type FlaggedFileIn as F, type RequestPathAccessResponse as G, type RequestPermissionPayload as H, InvestigationSource as I, type RequestPermissionResponse as J, type ResolveSessionsRequest as K, type ResolveSessionsResponse as L, MIDDLEWARE_URL as M, type ResolvedInteraction as N, type ResolvedTicketOut as O, type PRBEToolDeclaration as P, type TicketInfoRequest as Q, type RequestPathAccessPayload as R, type TicketInfoResponse as S, type TicketInfoOut as T, UserIdentifierType as U, type TicketStatusOut as V, ToolName as W, ToolParamType as X, type WSMessage as Y, WSMessageType as Z, redactPII as _, type PRBEToolParameter as a, type PRBEInteractionRequester as b, PRBEAgentState as c, type PRBEAgentConfig as d, type InteractionPayload as e, type InteractionResponse as f, type PollResponse as g, type AskQuestionPayload as h, type AskQuestionResponse as i, type ConversationEntry as j, ConversationRole as k, InteractionType as l, type InvestigationResult as m, PRBEAgentConfigKey as n, PRBEAgentError as o, PRBEAgentErrorType as p, type PRBEAgentStatus as q, PRBEAgentStatusType as r, type PRBECRInvestigation as s, type PRBECompletedInvestigation as t, type PRBEInteractionHandler as u, type PRBESerializedCR as v, type PRBESerializedCompletedInvestigation as w, type PRBESerializedState as x, type PRBESerializedTicket as y, PRBEStateEvent as z };
511
+ export { ToolParamType as $, type AgentHistoryResponse as A, type PRBESerializedCompletedInvestigation as B, ConversationRole as C, DEFAULT_PRBE_STATE as D, type ExternalRequestOut as E, type FlaggedFileIn as F, type PRBESerializedState as G, type PRBESerializedTicket as H, InvestigationSource as I, PRBEStateEvent as J, type PRBEStatusEvent as K, type PollRequest as L, MIDDLEWARE_URL as M, type RequestPathAccessResponse as N, type RequestPermissionPayload as O, type PRBEToolDeclaration as P, type RequestPermissionResponse as Q, type RequestPathAccessPayload as R, type SanitizedFileResult as S, type ResolvedInteraction as T, UserIdentifierType as U, type ReviewSanitizedOutputPayload as V, type ReviewSanitizedOutputResponse as W, type SanitizationIssue as X, type SanitizedFileRef as Y, type TicketInfoOut as Z, ToolName as _, type PRBEToolParameter as a, type WSMessage as a0, WSMessageType as a1, redactPII as a2, serializePRBEState as a3, type PRBEInteractionRequester as b, PRBEAgentState as c, type PRBEAgentConfig as d, type InteractionPayload as e, type InteractionResponse as f, type PollResponse as g, API_URL as h, type AgentHistoryRequest as i, type AgentSessionOut as j, type AgentTicketOut as k, type AskQuestionPayload as l, type AskQuestionResponse as m, type ContextRequestOut as n, type ConversationEntry as o, InteractionType as p, type InvestigationResult as q, PRBEAgentConfigKey as r, PRBEAgentError as s, PRBEAgentErrorType as t, type PRBEAgentStatus as u, PRBEAgentStatusType as v, type PRBEBackgroundInvestigation as w, type PRBECompletedInvestigation as x, type PRBEInteractionHandler as y, type PRBESerializedBackgroundInvestigation as z };
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, F as FlaggedFileIn, e as InteractionPayload, f as InteractionResponse, l as InteractionType, m as InvestigationResult, M as MIDDLEWARE_URL, d as PRBEAgentConfig, n as PRBEAgentConfigKey, p as PRBEAgentErrorType, q as PRBEAgentStatus, r as PRBEAgentStatusType, s as PRBECRInvestigation, t as PRBECompletedInvestigation, u as PRBEInteractionHandler, b as PRBEInteractionRequester, v as PRBESerializedCR, w as PRBESerializedCompletedInvestigation, x as PRBESerializedState, y as PRBESerializedTicket, z as PRBEStateEvent, B as PRBEStatusEvent, P as PRBEToolDeclaration, a as PRBEToolParameter, E as PollRequest, g as PollResponse, R as RequestPathAccessPayload, G as RequestPathAccessResponse, H as RequestPermissionPayload, J as RequestPermissionResponse, N as ResolvedInteraction, T as TicketInfoOut, Q as TicketInfoRequest, S as TicketInfoResponse, V as TicketStatusOut, W as ToolName, X as ToolParamType, Y as WSMessage, Z as WSMessageType } from './types-BmH_CmsO.mjs';
1
+ export { h as API_URL, i as AgentHistoryRequest, A as AgentHistoryResponse, j as AgentSessionOut, k as AgentTicketOut, l as AskQuestionPayload, m as AskQuestionResponse, n as ContextRequestOut, D as DEFAULT_PRBE_STATE, E as ExternalRequestOut, F as FlaggedFileIn, e as InteractionPayload, f as InteractionResponse, p as InteractionType, q as InvestigationResult, M as MIDDLEWARE_URL, d as PRBEAgentConfig, r as PRBEAgentConfigKey, t as PRBEAgentErrorType, u as PRBEAgentStatus, v as PRBEAgentStatusType, w as PRBEBackgroundInvestigation, x as PRBECompletedInvestigation, y as PRBEInteractionHandler, b as PRBEInteractionRequester, z as PRBESerializedBackgroundInvestigation, B as PRBESerializedCompletedInvestigation, G as PRBESerializedState, H as PRBESerializedTicket, J as PRBEStateEvent, K as PRBEStatusEvent, P as PRBEToolDeclaration, a as PRBEToolParameter, L as PollRequest, g as PollResponse, 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, S as SanitizedFileResult, Z as TicketInfoOut, _ as ToolName, $ as ToolParamType, a0 as WSMessage, a1 as WSMessageType } from './types-9iQH0zmA.mjs';
2
2
  import 'events';