@prbe.ai/electron-sdk 0.1.4 → 0.1.6
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 -15
- package/dist/index.js +2471 -60
- 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 -8
- 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/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 };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +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, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, d as PRBEAgentConfig, l as PRBEAgentConfigKey, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, b as PRBEInteractionRequester, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, P as PRBEToolDeclaration, a as PRBEToolParameter, z as PollRequest, g as PollResponse, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolvedInteraction, T as TicketInfoOut, J as TicketInfoRequest, K as TicketInfoResponse, L as TicketStatusOut, N as ToolName, O as ToolParamType, W as WSMessage, Q as WSMessageType } from './types-DHT-JxMT.mjs';
|
|
2
|
+
import 'events';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This entry point exports only interfaces, type aliases, enums, and
|
|
5
|
-
* plain-object constants. It is safe to import from renderer/browser
|
|
6
|
-
* code that cannot access Node.js modules like fs, path, child_process.
|
|
7
|
-
*
|
|
8
|
-
* Usage: import { ... } from "@prbe/electron-sdk/types"
|
|
9
|
-
*/
|
|
10
|
-
export { InteractionType, type AskQuestionPayload, type RequestPermissionPayload, type RequestPathAccessPayload, type InteractionPayload, type AskQuestionResponse, type RequestPermissionResponse, type RequestPathAccessResponse, type InteractionResponse, type PRBEInteractionRequester, type PRBEInteractionHandler, } from "./interactions";
|
|
11
|
-
export { WSMessageType, type WSMessage, ToolParamType, ToolName, type PRBEToolParameter, type PRBEToolDeclaration, PRBEAgentConfigKey, type PRBEAgentConfig, PRBEAgentStatusType, type PRBEAgentStatus, PRBEAgentErrorType, type PRBEStatusEvent, type PRBECRInvestigation, type PRBECompletedInvestigation, type FlaggedFileIn, type InvestigationResult, type PollRequest, type PollResponse, type ContextRequestOut, type TicketStatusOut, type TicketInfoRequest, type TicketInfoOut, type TicketInfoResponse, API_URL, MIDDLEWARE_URL, } from "./models";
|
|
12
|
-
export { type PRBESerializedCR, type PRBESerializedTicket, type PRBESerializedCompletedInvestigation, type PRBESerializedState, DEFAULT_PRBE_STATE, } from "./serialization";
|
|
13
|
-
export { PRBEStateEvent } from "./state";
|
|
14
|
-
//# sourceMappingURL=types.d.ts.map
|
|
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, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, d as PRBEAgentConfig, l as PRBEAgentConfigKey, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, b as PRBEInteractionRequester, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, P as PRBEToolDeclaration, a as PRBEToolParameter, z as PollRequest, g as PollResponse, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolvedInteraction, T as TicketInfoOut, J as TicketInfoRequest, K as TicketInfoResponse, L as TicketStatusOut, N as ToolName, O as ToolParamType, W as WSMessage, Q as WSMessageType } from './types-DHT-JxMT.js';
|
|
2
|
+
import 'events';
|
package/dist/types.js
CHANGED
|
@@ -1,32 +1,162 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/types.ts
|
|
21
|
+
var types_exports = {};
|
|
22
|
+
__export(types_exports, {
|
|
23
|
+
API_URL: () => API_URL,
|
|
24
|
+
DEFAULT_PRBE_STATE: () => DEFAULT_PRBE_STATE,
|
|
25
|
+
InteractionType: () => InteractionType,
|
|
26
|
+
MIDDLEWARE_URL: () => MIDDLEWARE_URL,
|
|
27
|
+
PRBEAgentConfigKey: () => PRBEAgentConfigKey,
|
|
28
|
+
PRBEAgentErrorType: () => PRBEAgentErrorType,
|
|
29
|
+
PRBEAgentStatusType: () => PRBEAgentStatusType,
|
|
30
|
+
PRBEStateEvent: () => PRBEStateEvent,
|
|
31
|
+
ToolName: () => ToolName,
|
|
32
|
+
ToolParamType: () => ToolParamType,
|
|
33
|
+
WSMessageType: () => WSMessageType
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(types_exports);
|
|
36
|
+
|
|
37
|
+
// src/interactions.ts
|
|
38
|
+
var InteractionType = /* @__PURE__ */ ((InteractionType2) => {
|
|
39
|
+
InteractionType2["ASK_QUESTION"] = "ask_question";
|
|
40
|
+
InteractionType2["REQUEST_PERMISSION"] = "request_permission";
|
|
41
|
+
InteractionType2["REQUEST_PATH_ACCESS"] = "request_path_access";
|
|
42
|
+
return InteractionType2;
|
|
43
|
+
})(InteractionType || {});
|
|
44
|
+
|
|
45
|
+
// src/models.ts
|
|
46
|
+
var WSMessageType = /* @__PURE__ */ ((WSMessageType2) => {
|
|
47
|
+
WSMessageType2["START"] = "start";
|
|
48
|
+
WSMessageType2["TOOL_RESULT"] = "tool_result";
|
|
49
|
+
WSMessageType2["UPLOAD_REQUEST"] = "upload_request";
|
|
50
|
+
WSMessageType2["CANCEL"] = "cancel";
|
|
51
|
+
WSMessageType2["PONG"] = "pong";
|
|
52
|
+
WSMessageType2["THOUGHT"] = "thought";
|
|
53
|
+
WSMessageType2["TOOL_CALL"] = "tool_call";
|
|
54
|
+
WSMessageType2["SERVER_TOOL_CALL"] = "server_tool_call";
|
|
55
|
+
WSMessageType2["SERVER_OBSERVATION"] = "server_observation";
|
|
56
|
+
WSMessageType2["UPLOAD_URL"] = "upload_url";
|
|
57
|
+
WSMessageType2["SESSION_CONFIG"] = "session_config";
|
|
58
|
+
WSMessageType2["COMPLETE"] = "complete";
|
|
59
|
+
WSMessageType2["ERROR"] = "error";
|
|
60
|
+
WSMessageType2["PING"] = "ping";
|
|
61
|
+
return WSMessageType2;
|
|
62
|
+
})(WSMessageType || {});
|
|
63
|
+
var ToolParamType = /* @__PURE__ */ ((ToolParamType2) => {
|
|
64
|
+
ToolParamType2["STRING"] = "STRING";
|
|
65
|
+
ToolParamType2["BOOLEAN"] = "BOOLEAN";
|
|
66
|
+
ToolParamType2["INTEGER"] = "INTEGER";
|
|
67
|
+
return ToolParamType2;
|
|
68
|
+
})(ToolParamType || {});
|
|
69
|
+
var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
70
|
+
ToolName2["CLIENT_LIST_DIRECTORY"] = "client_list_directory";
|
|
71
|
+
ToolName2["CLIENT_READ_FILE"] = "client_read_file";
|
|
72
|
+
ToolName2["CLIENT_SEARCH_CONTENT"] = "client_search_content";
|
|
73
|
+
ToolName2["CLIENT_FIND_FILES"] = "client_find_files";
|
|
74
|
+
ToolName2["CLIENT_FLAG_FILE"] = "client_flag_file";
|
|
75
|
+
ToolName2["CLIENT_READ_APP_LOGS"] = "client_read_app_logs";
|
|
76
|
+
ToolName2["CLIENT_SEARCH_APP_LOGS"] = "client_search_app_logs";
|
|
77
|
+
ToolName2["CLIENT_CLEAR_APP_LOGS"] = "client_clear_app_logs";
|
|
78
|
+
ToolName2["CLIENT_FLAG_APP_LOGS"] = "client_flag_app_logs";
|
|
79
|
+
ToolName2["CLIENT_ASK_USER"] = "client_ask_user";
|
|
80
|
+
ToolName2["CLIENT_BASH_EXECUTE"] = "client_bash_execute";
|
|
81
|
+
return ToolName2;
|
|
82
|
+
})(ToolName || {});
|
|
83
|
+
var PRBEAgentConfigKey = /* @__PURE__ */ ((PRBEAgentConfigKey2) => {
|
|
84
|
+
PRBEAgentConfigKey2["API_KEY"] = "apiKey";
|
|
85
|
+
PRBEAgentConfigKey2["AUTO_APPROVED_DIRS"] = "autoApprovedDirs";
|
|
86
|
+
PRBEAgentConfigKey2["POLLING_INTERVAL"] = "pollingInterval";
|
|
87
|
+
PRBEAgentConfigKey2["MAX_LOG_ENTRIES"] = "maxLogEntries";
|
|
88
|
+
PRBEAgentConfigKey2["CAPTURE_CONSOLE"] = "captureConsole";
|
|
89
|
+
PRBEAgentConfigKey2["BACKGROUND_POLLING"] = "backgroundPolling";
|
|
90
|
+
PRBEAgentConfigKey2["INTERACTION_HANDLER"] = "interactionHandler";
|
|
91
|
+
PRBEAgentConfigKey2["ELECTRON_LOG"] = "electronLog";
|
|
92
|
+
PRBEAgentConfigKey2["IPC_MAIN"] = "ipcMain";
|
|
93
|
+
PRBEAgentConfigKey2["RENDERER_LOG_CHANNEL"] = "rendererLogChannel";
|
|
94
|
+
PRBEAgentConfigKey2["APP_DATA_PATH"] = "appDataPath";
|
|
95
|
+
return PRBEAgentConfigKey2;
|
|
96
|
+
})(PRBEAgentConfigKey || {});
|
|
97
|
+
var PRBEAgentStatusType = /* @__PURE__ */ ((PRBEAgentStatusType2) => {
|
|
98
|
+
PRBEAgentStatusType2["STARTED"] = "started";
|
|
99
|
+
PRBEAgentStatusType2["THINKING"] = "thinking";
|
|
100
|
+
PRBEAgentStatusType2["TOOL_CALL"] = "tool_call";
|
|
101
|
+
PRBEAgentStatusType2["THOUGHT"] = "thought";
|
|
102
|
+
PRBEAgentStatusType2["OBSERVATION"] = "observation";
|
|
103
|
+
PRBEAgentStatusType2["COMPLETED"] = "completed";
|
|
104
|
+
PRBEAgentStatusType2["ERROR"] = "error";
|
|
105
|
+
PRBEAgentStatusType2["AWAITING_INTERACTION"] = "awaiting_interaction";
|
|
106
|
+
return PRBEAgentStatusType2;
|
|
107
|
+
})(PRBEAgentStatusType || {});
|
|
108
|
+
var PRBEAgentErrorType = /* @__PURE__ */ ((PRBEAgentErrorType2) => {
|
|
109
|
+
PRBEAgentErrorType2["SERVER_ERROR"] = "server_error";
|
|
110
|
+
PRBEAgentErrorType2["NETWORK_ERROR"] = "network_error";
|
|
111
|
+
PRBEAgentErrorType2["CANCELLED"] = "cancelled";
|
|
112
|
+
PRBEAgentErrorType2["MAX_ITERATIONS"] = "max_iterations";
|
|
113
|
+
return PRBEAgentErrorType2;
|
|
114
|
+
})(PRBEAgentErrorType || {});
|
|
115
|
+
var API_URL = "https://api.prbe.ai";
|
|
116
|
+
var MIDDLEWARE_URL = "wss://middleware.prbe.ai";
|
|
117
|
+
|
|
118
|
+
// src/serialization.ts
|
|
119
|
+
var DEFAULT_PRBE_STATE = {
|
|
120
|
+
isInvestigating: false,
|
|
121
|
+
events: [],
|
|
122
|
+
report: "",
|
|
123
|
+
summary: "",
|
|
124
|
+
currentQuery: "",
|
|
125
|
+
resolvedInteractions: [],
|
|
126
|
+
completedInvestigations: [],
|
|
127
|
+
activeCRs: [],
|
|
128
|
+
completedCRs: [],
|
|
129
|
+
trackedTicketIDs: [],
|
|
130
|
+
ticketInfo: [],
|
|
131
|
+
hasActiveWork: false
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/state.ts
|
|
135
|
+
var PRBEStateEvent = /* @__PURE__ */ ((PRBEStateEvent2) => {
|
|
136
|
+
PRBEStateEvent2["STATUS"] = "status";
|
|
137
|
+
PRBEStateEvent2["EVENT"] = "event";
|
|
138
|
+
PRBEStateEvent2["COMPLETE"] = "complete";
|
|
139
|
+
PRBEStateEvent2["ERROR"] = "error";
|
|
140
|
+
PRBEStateEvent2["CR_START"] = "cr-start";
|
|
141
|
+
PRBEStateEvent2["CR_COMPLETE"] = "cr-complete";
|
|
142
|
+
PRBEStateEvent2["TICKETS_CHANGED"] = "tickets-changed";
|
|
143
|
+
PRBEStateEvent2["TICKET_INFO"] = "ticket-info";
|
|
144
|
+
PRBEStateEvent2["INTERACTION_REQUESTED"] = "interaction-requested";
|
|
145
|
+
PRBEStateEvent2["INTERACTION_RESOLVED"] = "interaction-resolved";
|
|
146
|
+
return PRBEStateEvent2;
|
|
147
|
+
})(PRBEStateEvent || {});
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
API_URL,
|
|
151
|
+
DEFAULT_PRBE_STATE,
|
|
152
|
+
InteractionType,
|
|
153
|
+
MIDDLEWARE_URL,
|
|
154
|
+
PRBEAgentConfigKey,
|
|
155
|
+
PRBEAgentErrorType,
|
|
156
|
+
PRBEAgentStatusType,
|
|
157
|
+
PRBEStateEvent,
|
|
158
|
+
ToolName,
|
|
159
|
+
ToolParamType,
|
|
160
|
+
WSMessageType
|
|
161
|
+
});
|
|
32
162
|
//# sourceMappingURL=types.js.map
|