@prbe.ai/electron-sdk 0.1.3 → 0.1.5
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 +332 -0
- package/dist/index.d.ts +331 -20
- package/dist/index.js +2471 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2402 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types-DHT-JxMT.d.mts +401 -0
- package/dist/types-DHT-JxMT.d.ts +401 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.d.ts +2 -14
- package/dist/types.js +160 -30
- package/dist/types.js.map +1 -1
- package/dist/types.mjs +125 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +22 -12
- package/dist/agent.d.ts +0 -106
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -878
- package/dist/agent.js.map +0 -1
- package/dist/assets/index.d.ts +0 -6
- package/dist/assets/index.d.ts.map +0 -1
- package/dist/assets/index.js +0 -13
- package/dist/assets/index.js.map +0 -1
- package/dist/electron/channels.d.ts +0 -21
- package/dist/electron/channels.d.ts.map +0 -1
- package/dist/electron/channels.js +0 -25
- package/dist/electron/channels.js.map +0 -1
- package/dist/electron/index.d.ts +0 -12
- package/dist/electron/index.d.ts.map +0 -1
- package/dist/electron/index.js +0 -22
- package/dist/electron/index.js.map +0 -1
- package/dist/electron/ipc-interaction-handler.d.ts +0 -21
- package/dist/electron/ipc-interaction-handler.d.ts.map +0 -1
- package/dist/electron/ipc-interaction-handler.js +0 -48
- package/dist/electron/ipc-interaction-handler.js.map +0 -1
- package/dist/electron/preload.d.ts +0 -20
- package/dist/electron/preload.d.ts.map +0 -1
- package/dist/electron/preload.js +0 -72
- package/dist/electron/preload.js.map +0 -1
- package/dist/electron/setup-handlers.d.ts +0 -30
- package/dist/electron/setup-handlers.d.ts.map +0 -1
- package/dist/electron/setup-handlers.js +0 -111
- package/dist/electron/setup-handlers.js.map +0 -1
- package/dist/electron/types.d.ts +0 -56
- package/dist/electron/types.d.ts.map +0 -1
- package/dist/electron/types.js +0 -9
- package/dist/electron/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interactions.d.ts +0 -63
- package/dist/interactions.d.ts.map +0 -1
- package/dist/interactions.js +0 -27
- package/dist/interactions.js.map +0 -1
- package/dist/models.d.ts +0 -218
- package/dist/models.d.ts.map +0 -1
- package/dist/models.js +0 -121
- package/dist/models.js.map +0 -1
- package/dist/serialization.d.ts +0 -51
- package/dist/serialization.d.ts.map +0 -1
- package/dist/serialization.js +0 -72
- package/dist/serialization.js.map +0 -1
- package/dist/state.d.ts +0 -70
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -303
- package/dist/state.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -30
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -248
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/filesystem.d.ts +0 -63
- package/dist/tools/filesystem.d.ts.map +0 -1
- package/dist/tools/filesystem.js +0 -573
- package/dist/tools/filesystem.js.map +0 -1
- package/dist/tools/index.d.ts +0 -46
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -171
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/interactive.d.ts +0 -15
- package/dist/tools/interactive.d.ts.map +0 -1
- package/dist/tools/interactive.js +0 -58
- package/dist/tools/interactive.js.map +0 -1
- package/dist/tools/logs.d.ts +0 -72
- package/dist/tools/logs.d.ts.map +0 -1
- package/dist/tools/logs.js +0 -366
- package/dist/tools/logs.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* interactions.ts — Types for user interaction during investigations
|
|
5
|
+
*
|
|
6
|
+
* Defines the contract between tools (which request interactions) and
|
|
7
|
+
* host apps (which present UI and collect responses).
|
|
8
|
+
*/
|
|
9
|
+
declare enum InteractionType {
|
|
10
|
+
ASK_QUESTION = "ask_question",
|
|
11
|
+
REQUEST_PERMISSION = "request_permission",
|
|
12
|
+
REQUEST_PATH_ACCESS = "request_path_access"
|
|
13
|
+
}
|
|
14
|
+
interface AskQuestionPayload {
|
|
15
|
+
type: InteractionType.ASK_QUESTION;
|
|
16
|
+
interactionId: string;
|
|
17
|
+
question: string;
|
|
18
|
+
context?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RequestPermissionPayload {
|
|
21
|
+
type: InteractionType.REQUEST_PERMISSION;
|
|
22
|
+
interactionId: string;
|
|
23
|
+
action: string;
|
|
24
|
+
command: string;
|
|
25
|
+
reason?: string;
|
|
26
|
+
}
|
|
27
|
+
interface RequestPathAccessPayload {
|
|
28
|
+
type: InteractionType.REQUEST_PATH_ACCESS;
|
|
29
|
+
interactionId: string;
|
|
30
|
+
path: string;
|
|
31
|
+
reason: string;
|
|
32
|
+
}
|
|
33
|
+
type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload;
|
|
34
|
+
interface AskQuestionResponse {
|
|
35
|
+
type: InteractionType.ASK_QUESTION;
|
|
36
|
+
answer: string;
|
|
37
|
+
}
|
|
38
|
+
interface RequestPermissionResponse {
|
|
39
|
+
type: InteractionType.REQUEST_PERMISSION;
|
|
40
|
+
approved: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface RequestPathAccessResponse {
|
|
43
|
+
type: InteractionType.REQUEST_PATH_ACCESS;
|
|
44
|
+
granted: boolean;
|
|
45
|
+
}
|
|
46
|
+
type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse;
|
|
47
|
+
declare enum InvestigationSource {
|
|
48
|
+
USER = "user",
|
|
49
|
+
CONTEXT_REQUEST = "context_request"
|
|
50
|
+
}
|
|
51
|
+
interface PRBEInteractionRequester {
|
|
52
|
+
requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
|
|
53
|
+
readonly investigationSource: InvestigationSource;
|
|
54
|
+
}
|
|
55
|
+
interface PRBEInteractionHandler {
|
|
56
|
+
handleInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
|
|
57
|
+
}
|
|
58
|
+
interface ResolvedInteraction {
|
|
59
|
+
interactionId: string;
|
|
60
|
+
payload: InteractionPayload;
|
|
61
|
+
response: InteractionResponse;
|
|
62
|
+
/** Number of events at time of resolution — used to split thinking bubbles */
|
|
63
|
+
eventIndex: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* models.ts — WSMessage, WSMessageType, tool types, config, errors
|
|
68
|
+
*
|
|
69
|
+
* All types must match the Swift SDK + middleware protocol exactly.
|
|
70
|
+
*/
|
|
71
|
+
declare enum WSMessageType {
|
|
72
|
+
START = "start",
|
|
73
|
+
TOOL_RESULT = "tool_result",
|
|
74
|
+
UPLOAD_REQUEST = "upload_request",
|
|
75
|
+
CANCEL = "cancel",
|
|
76
|
+
PONG = "pong",
|
|
77
|
+
THOUGHT = "thought",
|
|
78
|
+
TOOL_CALL = "tool_call",
|
|
79
|
+
SERVER_TOOL_CALL = "server_tool_call",
|
|
80
|
+
SERVER_OBSERVATION = "server_observation",
|
|
81
|
+
UPLOAD_URL = "upload_url",
|
|
82
|
+
SESSION_CONFIG = "session_config",
|
|
83
|
+
COMPLETE = "complete",
|
|
84
|
+
ERROR = "error",
|
|
85
|
+
PING = "ping"
|
|
86
|
+
}
|
|
87
|
+
interface WSMessage {
|
|
88
|
+
type: WSMessageType;
|
|
89
|
+
id?: string;
|
|
90
|
+
name?: string;
|
|
91
|
+
content?: string;
|
|
92
|
+
metadata?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
declare enum ToolParamType {
|
|
95
|
+
STRING = "STRING",
|
|
96
|
+
BOOLEAN = "BOOLEAN",
|
|
97
|
+
INTEGER = "INTEGER"
|
|
98
|
+
}
|
|
99
|
+
interface PRBEToolParameter {
|
|
100
|
+
name: string;
|
|
101
|
+
type: ToolParamType;
|
|
102
|
+
description: string;
|
|
103
|
+
required: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface PRBEToolDeclaration {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
parameters: PRBEToolParameter[];
|
|
109
|
+
/** When true, the middleware uses a longer timeout for this tool (user interaction required). */
|
|
110
|
+
interactive?: boolean;
|
|
111
|
+
}
|
|
112
|
+
declare enum ToolName {
|
|
113
|
+
CLIENT_LIST_DIRECTORY = "client_list_directory",
|
|
114
|
+
CLIENT_READ_FILE = "client_read_file",
|
|
115
|
+
CLIENT_SEARCH_CONTENT = "client_search_content",
|
|
116
|
+
CLIENT_FIND_FILES = "client_find_files",
|
|
117
|
+
CLIENT_FLAG_FILE = "client_flag_file",
|
|
118
|
+
CLIENT_READ_APP_LOGS = "client_read_app_logs",
|
|
119
|
+
CLIENT_SEARCH_APP_LOGS = "client_search_app_logs",
|
|
120
|
+
CLIENT_CLEAR_APP_LOGS = "client_clear_app_logs",
|
|
121
|
+
CLIENT_FLAG_APP_LOGS = "client_flag_app_logs",
|
|
122
|
+
CLIENT_ASK_USER = "client_ask_user",
|
|
123
|
+
CLIENT_BASH_EXECUTE = "client_bash_execute"
|
|
124
|
+
}
|
|
125
|
+
declare enum PRBEAgentConfigKey {
|
|
126
|
+
API_KEY = "apiKey",
|
|
127
|
+
AUTO_APPROVED_DIRS = "autoApprovedDirs",
|
|
128
|
+
POLLING_INTERVAL = "pollingInterval",
|
|
129
|
+
MAX_LOG_ENTRIES = "maxLogEntries",
|
|
130
|
+
CAPTURE_CONSOLE = "captureConsole",
|
|
131
|
+
BACKGROUND_POLLING = "backgroundPolling",
|
|
132
|
+
INTERACTION_HANDLER = "interactionHandler",
|
|
133
|
+
ELECTRON_LOG = "electronLog",
|
|
134
|
+
IPC_MAIN = "ipcMain",
|
|
135
|
+
RENDERER_LOG_CHANNEL = "rendererLogChannel",
|
|
136
|
+
APP_DATA_PATH = "appDataPath"
|
|
137
|
+
}
|
|
138
|
+
interface PRBEAgentConfig {
|
|
139
|
+
[PRBEAgentConfigKey.API_KEY]: string;
|
|
140
|
+
[PRBEAgentConfigKey.AUTO_APPROVED_DIRS]: string[];
|
|
141
|
+
[PRBEAgentConfigKey.POLLING_INTERVAL]?: number;
|
|
142
|
+
[PRBEAgentConfigKey.MAX_LOG_ENTRIES]?: number;
|
|
143
|
+
[PRBEAgentConfigKey.CAPTURE_CONSOLE]?: boolean;
|
|
144
|
+
[PRBEAgentConfigKey.BACKGROUND_POLLING]?: boolean;
|
|
145
|
+
[PRBEAgentConfigKey.INTERACTION_HANDLER]?: PRBEInteractionHandler;
|
|
146
|
+
/** electron-log instance (v5) — SDK hooks into its transports to capture main-process logs */
|
|
147
|
+
[PRBEAgentConfigKey.ELECTRON_LOG]?: {
|
|
148
|
+
hooks: {
|
|
149
|
+
push: (hook: (...args: any[]) => any) => void;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
/** Electron ipcMain instance — SDK listens for renderer log forwarding */
|
|
153
|
+
[PRBEAgentConfigKey.IPC_MAIN]?: {
|
|
154
|
+
on: (channel: string, listener: (event: any, ...args: any[]) => void) => void;
|
|
155
|
+
};
|
|
156
|
+
/** IPC channel name for renderer log forwarding (default: "prbe-renderer-log") */
|
|
157
|
+
[PRBEAgentConfigKey.RENDERER_LOG_CHANNEL]?: string;
|
|
158
|
+
/** Path to the application's data directory (e.g. Electron userData). Sent to the agent so it explores this directory first. */
|
|
159
|
+
[PRBEAgentConfigKey.APP_DATA_PATH]?: string;
|
|
160
|
+
}
|
|
161
|
+
declare enum PRBEAgentStatusType {
|
|
162
|
+
STARTED = "started",
|
|
163
|
+
THINKING = "thinking",
|
|
164
|
+
TOOL_CALL = "tool_call",
|
|
165
|
+
THOUGHT = "thought",
|
|
166
|
+
OBSERVATION = "observation",
|
|
167
|
+
COMPLETED = "completed",
|
|
168
|
+
ERROR = "error",
|
|
169
|
+
AWAITING_INTERACTION = "awaiting_interaction"
|
|
170
|
+
}
|
|
171
|
+
type PRBEAgentStatus = {
|
|
172
|
+
type: PRBEAgentStatusType.STARTED;
|
|
173
|
+
} | {
|
|
174
|
+
type: PRBEAgentStatusType.THINKING;
|
|
175
|
+
} | {
|
|
176
|
+
type: PRBEAgentStatusType.TOOL_CALL;
|
|
177
|
+
name: string;
|
|
178
|
+
label: string;
|
|
179
|
+
} | {
|
|
180
|
+
type: PRBEAgentStatusType.THOUGHT;
|
|
181
|
+
text: string;
|
|
182
|
+
} | {
|
|
183
|
+
type: PRBEAgentStatusType.OBSERVATION;
|
|
184
|
+
text: string;
|
|
185
|
+
} | {
|
|
186
|
+
type: PRBEAgentStatusType.COMPLETED;
|
|
187
|
+
report: string;
|
|
188
|
+
userSummary: string;
|
|
189
|
+
} | {
|
|
190
|
+
type: PRBEAgentStatusType.ERROR;
|
|
191
|
+
message: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: PRBEAgentStatusType.AWAITING_INTERACTION;
|
|
194
|
+
interactionPayload: InteractionPayload;
|
|
195
|
+
};
|
|
196
|
+
interface InvestigationResult {
|
|
197
|
+
report: string;
|
|
198
|
+
userSummary: string;
|
|
199
|
+
ticketId?: string;
|
|
200
|
+
}
|
|
201
|
+
interface FlaggedFileIn {
|
|
202
|
+
originalPath: string;
|
|
203
|
+
reason?: string;
|
|
204
|
+
data: Buffer;
|
|
205
|
+
isText: boolean;
|
|
206
|
+
}
|
|
207
|
+
interface PollRequest {
|
|
208
|
+
agent_id: string;
|
|
209
|
+
ticket_ids: string[];
|
|
210
|
+
}
|
|
211
|
+
interface ContextRequestOut {
|
|
212
|
+
id: string;
|
|
213
|
+
query: string;
|
|
214
|
+
slug?: string;
|
|
215
|
+
is_active: boolean;
|
|
216
|
+
created_at: string;
|
|
217
|
+
}
|
|
218
|
+
interface TicketStatusOut {
|
|
219
|
+
ticket_id: string;
|
|
220
|
+
status: string;
|
|
221
|
+
context_requests: ContextRequestOut[];
|
|
222
|
+
}
|
|
223
|
+
interface PollResponse {
|
|
224
|
+
tickets: TicketStatusOut[];
|
|
225
|
+
}
|
|
226
|
+
interface TicketInfoRequest {
|
|
227
|
+
ticket_ids: string[];
|
|
228
|
+
}
|
|
229
|
+
interface TicketInfoOut {
|
|
230
|
+
ticket_id: string;
|
|
231
|
+
title: string;
|
|
232
|
+
status: string;
|
|
233
|
+
priority?: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
session_count: number;
|
|
236
|
+
}
|
|
237
|
+
interface TicketInfoResponse {
|
|
238
|
+
tickets: TicketInfoOut[];
|
|
239
|
+
}
|
|
240
|
+
interface PRBEStatusEvent {
|
|
241
|
+
id: string;
|
|
242
|
+
label: string;
|
|
243
|
+
detail?: string;
|
|
244
|
+
isCompleted: boolean;
|
|
245
|
+
isExpanded: boolean;
|
|
246
|
+
}
|
|
247
|
+
interface PRBECRInvestigation {
|
|
248
|
+
id: string;
|
|
249
|
+
query: string;
|
|
250
|
+
slug?: string;
|
|
251
|
+
events: PRBEStatusEvent[];
|
|
252
|
+
isRunning: boolean;
|
|
253
|
+
isCompleted: boolean;
|
|
254
|
+
isFailed: boolean;
|
|
255
|
+
report: string;
|
|
256
|
+
summary: string;
|
|
257
|
+
errorMessage?: string;
|
|
258
|
+
startedAt: Date;
|
|
259
|
+
pendingInteraction?: InteractionPayload;
|
|
260
|
+
resolvedInteractions?: ResolvedInteraction[];
|
|
261
|
+
}
|
|
262
|
+
interface PRBECompletedInvestigation {
|
|
263
|
+
id: string;
|
|
264
|
+
query: string;
|
|
265
|
+
report: string;
|
|
266
|
+
summary: string;
|
|
267
|
+
completedAt: Date;
|
|
268
|
+
}
|
|
269
|
+
declare enum PRBEAgentErrorType {
|
|
270
|
+
SERVER_ERROR = "server_error",
|
|
271
|
+
NETWORK_ERROR = "network_error",
|
|
272
|
+
CANCELLED = "cancelled",
|
|
273
|
+
MAX_ITERATIONS = "max_iterations"
|
|
274
|
+
}
|
|
275
|
+
declare class PRBEAgentError extends Error {
|
|
276
|
+
readonly errorType: PRBEAgentErrorType;
|
|
277
|
+
readonly statusCode?: number;
|
|
278
|
+
constructor(errorType: PRBEAgentErrorType, message: string, statusCode?: number);
|
|
279
|
+
}
|
|
280
|
+
declare function redactPII(text: string): string;
|
|
281
|
+
declare const API_URL = "https://api.prbe.ai";
|
|
282
|
+
declare const MIDDLEWARE_URL = "wss://middleware.prbe.ai";
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* state.ts — PRBEAgentState: EventEmitter-based observable investigation state
|
|
286
|
+
*
|
|
287
|
+
* Mirrors PRBEAgentState.swift but uses Node.js EventEmitter instead of Combine/@Published.
|
|
288
|
+
* Host apps subscribe to events for UI updates.
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
declare enum PRBEStateEvent {
|
|
292
|
+
/** Emitted on any state change. Payload: void */
|
|
293
|
+
STATUS = "status",
|
|
294
|
+
/** Emitted when a new event is appended. Payload: PRBEStatusEvent */
|
|
295
|
+
EVENT = "event",
|
|
296
|
+
/** Emitted when investigation completes. Payload: { report: string; summary: string } */
|
|
297
|
+
COMPLETE = "complete",
|
|
298
|
+
/** Emitted on error. Payload: { message: string } */
|
|
299
|
+
ERROR = "error",
|
|
300
|
+
/** Emitted when a background CR starts. Payload: PRBECRInvestigation */
|
|
301
|
+
CR_START = "cr-start",
|
|
302
|
+
/** Emitted when a background CR completes/fails. Payload: PRBECRInvestigation */
|
|
303
|
+
CR_COMPLETE = "cr-complete",
|
|
304
|
+
/** Emitted when tracked ticket IDs change. Payload: string[] */
|
|
305
|
+
TICKETS_CHANGED = "tickets-changed",
|
|
306
|
+
/** Emitted when ticket info is updated. Payload: TicketInfoOut[] */
|
|
307
|
+
TICKET_INFO = "ticket-info",
|
|
308
|
+
/** Emitted when an interaction is requested. Payload: InteractionPayload */
|
|
309
|
+
INTERACTION_REQUESTED = "interaction-requested",
|
|
310
|
+
/** Emitted when an interaction is resolved. Payload: void */
|
|
311
|
+
INTERACTION_RESOLVED = "interaction-resolved"
|
|
312
|
+
}
|
|
313
|
+
declare class PRBEAgentState extends EventEmitter {
|
|
314
|
+
isInvestigating: boolean;
|
|
315
|
+
events: PRBEStatusEvent[];
|
|
316
|
+
report: string;
|
|
317
|
+
summary: string;
|
|
318
|
+
currentQuery: string;
|
|
319
|
+
investigationError?: string;
|
|
320
|
+
pendingInteraction?: InteractionPayload;
|
|
321
|
+
resolvedInteractions: ResolvedInteraction[];
|
|
322
|
+
completedInvestigations: PRBECompletedInvestigation[];
|
|
323
|
+
activeCRs: Map<string, PRBECRInvestigation>;
|
|
324
|
+
completedCRs: PRBECRInvestigation[];
|
|
325
|
+
trackedTicketIDs: string[];
|
|
326
|
+
ticketInfo: TicketInfoOut[];
|
|
327
|
+
get hasActiveWork(): boolean;
|
|
328
|
+
get activeCRCount(): number;
|
|
329
|
+
get isActive(): boolean;
|
|
330
|
+
beginInvestigation(query: string): void;
|
|
331
|
+
resetInvestigation(): void;
|
|
332
|
+
appendEvent(label: string, detail?: string, completed?: boolean): void;
|
|
333
|
+
attachObservation(text: string): void;
|
|
334
|
+
completeInvestigation(report: string, summary: string): void;
|
|
335
|
+
failInvestigation(message: string): void;
|
|
336
|
+
setPendingInteraction(payload: InteractionPayload): void;
|
|
337
|
+
clearPendingInteraction(): void;
|
|
338
|
+
setCRPendingInteraction(crID: string, payload: InteractionPayload): void;
|
|
339
|
+
clearCRPendingInteraction(crID: string): void;
|
|
340
|
+
resolveInteraction(response: InteractionResponse): void;
|
|
341
|
+
resolveCRInteraction(crID: string, response: InteractionResponse): void;
|
|
342
|
+
toggleExpansion(eventId: string): void;
|
|
343
|
+
beginCR(id: string, query: string, slug?: string): void;
|
|
344
|
+
appendCREvent(crID: string, label: string, detail?: string, completed?: boolean): void;
|
|
345
|
+
attachCRObservation(crID: string, text: string): void;
|
|
346
|
+
completeCR(id: string, report: string, summary: string): void;
|
|
347
|
+
failCR(id: string, message: string): void;
|
|
348
|
+
updateTrackedTicketIDs(ids: string[]): void;
|
|
349
|
+
updateTicketInfo(info: TicketInfoOut[]): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* serialization.ts — IPC-safe serialization of agent state
|
|
354
|
+
*
|
|
355
|
+
* Converts live PRBEAgentState (with Map, Date, EventEmitter) into
|
|
356
|
+
* plain JSON-safe objects suitable for IPC or structured clone.
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
interface PRBESerializedCR {
|
|
360
|
+
id: string;
|
|
361
|
+
query: string;
|
|
362
|
+
slug?: string;
|
|
363
|
+
events: PRBEStatusEvent[];
|
|
364
|
+
isRunning: boolean;
|
|
365
|
+
isCompleted: boolean;
|
|
366
|
+
isFailed: boolean;
|
|
367
|
+
report: string;
|
|
368
|
+
summary: string;
|
|
369
|
+
errorMessage?: string;
|
|
370
|
+
startedAt: string;
|
|
371
|
+
pendingInteraction?: InteractionPayload;
|
|
372
|
+
resolvedInteractions?: ResolvedInteraction[];
|
|
373
|
+
}
|
|
374
|
+
type PRBESerializedTicket = TicketInfoOut;
|
|
375
|
+
interface PRBESerializedCompletedInvestigation {
|
|
376
|
+
id: string;
|
|
377
|
+
query: string;
|
|
378
|
+
report: string;
|
|
379
|
+
summary: string;
|
|
380
|
+
completedAt: string;
|
|
381
|
+
}
|
|
382
|
+
interface PRBESerializedState {
|
|
383
|
+
isInvestigating: boolean;
|
|
384
|
+
events: PRBEStatusEvent[];
|
|
385
|
+
report: string;
|
|
386
|
+
summary: string;
|
|
387
|
+
currentQuery: string;
|
|
388
|
+
investigationError?: string;
|
|
389
|
+
pendingInteraction?: InteractionPayload;
|
|
390
|
+
resolvedInteractions: ResolvedInteraction[];
|
|
391
|
+
completedInvestigations: PRBESerializedCompletedInvestigation[];
|
|
392
|
+
activeCRs: PRBESerializedCR[];
|
|
393
|
+
completedCRs: PRBESerializedCR[];
|
|
394
|
+
trackedTicketIDs: string[];
|
|
395
|
+
ticketInfo: PRBESerializedTicket[];
|
|
396
|
+
hasActiveWork: boolean;
|
|
397
|
+
}
|
|
398
|
+
declare const DEFAULT_PRBE_STATE: PRBESerializedState;
|
|
399
|
+
declare function serializePRBEState(state: PRBEAgentState): PRBESerializedState;
|
|
400
|
+
|
|
401
|
+
export { API_URL as A, type RequestPathAccessResponse as B, type ContextRequestOut as C, DEFAULT_PRBE_STATE as D, type RequestPermissionPayload as E, type FlaggedFileIn as F, type RequestPermissionResponse as G, type ResolvedInteraction as H, InvestigationSource as I, type TicketInfoRequest as J, type TicketInfoResponse as K, type TicketStatusOut as L, MIDDLEWARE_URL as M, ToolName as N, ToolParamType as O, type PRBEToolDeclaration as P, WSMessageType as Q, type RequestPathAccessPayload as R, redactPII as S, type TicketInfoOut as T, serializePRBEState as U, type WSMessage as W, 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, InteractionType as j, type InvestigationResult as k, PRBEAgentConfigKey as l, PRBEAgentError as m, PRBEAgentErrorType as n, type PRBEAgentStatus as o, PRBEAgentStatusType as p, type PRBECRInvestigation as q, type PRBECompletedInvestigation as r, type PRBEInteractionHandler as s, type PRBESerializedCR as t, type PRBESerializedCompletedInvestigation as u, type PRBESerializedState as v, type PRBESerializedTicket as w, PRBEStateEvent as x, type PRBEStatusEvent as y, type PollRequest as z };
|