@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.
Files changed (85) hide show
  1. package/dist/index.d.mts +332 -0
  2. package/dist/index.d.ts +331 -20
  3. package/dist/index.js +2471 -69
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +2402 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/types-DHT-JxMT.d.mts +401 -0
  8. package/dist/types-DHT-JxMT.d.ts +401 -0
  9. package/dist/types.d.mts +2 -0
  10. package/dist/types.d.ts +2 -14
  11. package/dist/types.js +160 -30
  12. package/dist/types.js.map +1 -1
  13. package/dist/types.mjs +125 -0
  14. package/dist/types.mjs.map +1 -0
  15. package/package.json +22 -12
  16. package/dist/agent.d.ts +0 -106
  17. package/dist/agent.d.ts.map +0 -1
  18. package/dist/agent.js +0 -878
  19. package/dist/agent.js.map +0 -1
  20. package/dist/assets/index.d.ts +0 -6
  21. package/dist/assets/index.d.ts.map +0 -1
  22. package/dist/assets/index.js +0 -13
  23. package/dist/assets/index.js.map +0 -1
  24. package/dist/electron/channels.d.ts +0 -21
  25. package/dist/electron/channels.d.ts.map +0 -1
  26. package/dist/electron/channels.js +0 -25
  27. package/dist/electron/channels.js.map +0 -1
  28. package/dist/electron/index.d.ts +0 -12
  29. package/dist/electron/index.d.ts.map +0 -1
  30. package/dist/electron/index.js +0 -22
  31. package/dist/electron/index.js.map +0 -1
  32. package/dist/electron/ipc-interaction-handler.d.ts +0 -21
  33. package/dist/electron/ipc-interaction-handler.d.ts.map +0 -1
  34. package/dist/electron/ipc-interaction-handler.js +0 -48
  35. package/dist/electron/ipc-interaction-handler.js.map +0 -1
  36. package/dist/electron/preload.d.ts +0 -20
  37. package/dist/electron/preload.d.ts.map +0 -1
  38. package/dist/electron/preload.js +0 -72
  39. package/dist/electron/preload.js.map +0 -1
  40. package/dist/electron/setup-handlers.d.ts +0 -30
  41. package/dist/electron/setup-handlers.d.ts.map +0 -1
  42. package/dist/electron/setup-handlers.js +0 -111
  43. package/dist/electron/setup-handlers.js.map +0 -1
  44. package/dist/electron/types.d.ts +0 -56
  45. package/dist/electron/types.d.ts.map +0 -1
  46. package/dist/electron/types.js +0 -9
  47. package/dist/electron/types.js.map +0 -1
  48. package/dist/index.d.ts.map +0 -1
  49. package/dist/interactions.d.ts +0 -63
  50. package/dist/interactions.d.ts.map +0 -1
  51. package/dist/interactions.js +0 -27
  52. package/dist/interactions.js.map +0 -1
  53. package/dist/models.d.ts +0 -218
  54. package/dist/models.d.ts.map +0 -1
  55. package/dist/models.js +0 -121
  56. package/dist/models.js.map +0 -1
  57. package/dist/serialization.d.ts +0 -51
  58. package/dist/serialization.d.ts.map +0 -1
  59. package/dist/serialization.js +0 -72
  60. package/dist/serialization.js.map +0 -1
  61. package/dist/state.d.ts +0 -70
  62. package/dist/state.d.ts.map +0 -1
  63. package/dist/state.js +0 -303
  64. package/dist/state.js.map +0 -1
  65. package/dist/tools/bash.d.ts +0 -30
  66. package/dist/tools/bash.d.ts.map +0 -1
  67. package/dist/tools/bash.js +0 -248
  68. package/dist/tools/bash.js.map +0 -1
  69. package/dist/tools/filesystem.d.ts +0 -63
  70. package/dist/tools/filesystem.d.ts.map +0 -1
  71. package/dist/tools/filesystem.js +0 -573
  72. package/dist/tools/filesystem.js.map +0 -1
  73. package/dist/tools/index.d.ts +0 -46
  74. package/dist/tools/index.d.ts.map +0 -1
  75. package/dist/tools/index.js +0 -171
  76. package/dist/tools/index.js.map +0 -1
  77. package/dist/tools/interactive.d.ts +0 -15
  78. package/dist/tools/interactive.d.ts.map +0 -1
  79. package/dist/tools/interactive.js +0 -58
  80. package/dist/tools/interactive.js.map +0 -1
  81. package/dist/tools/logs.d.ts +0 -72
  82. package/dist/tools/logs.d.ts.map +0 -1
  83. package/dist/tools/logs.js +0 -366
  84. package/dist/tools/logs.js.map +0 -1
  85. package/dist/types.d.ts.map +0 -1
@@ -1,63 +0,0 @@
1
- /**
2
- * interactions.ts — Types for user interaction during investigations
3
- *
4
- * Defines the contract between tools (which request interactions) and
5
- * host apps (which present UI and collect responses).
6
- */
7
- export declare enum InteractionType {
8
- ASK_QUESTION = "ask_question",
9
- REQUEST_PERMISSION = "request_permission",
10
- REQUEST_PATH_ACCESS = "request_path_access"
11
- }
12
- export interface AskQuestionPayload {
13
- type: InteractionType.ASK_QUESTION;
14
- interactionId: string;
15
- question: string;
16
- context?: string;
17
- }
18
- export interface RequestPermissionPayload {
19
- type: InteractionType.REQUEST_PERMISSION;
20
- interactionId: string;
21
- action: string;
22
- command: string;
23
- reason?: string;
24
- }
25
- export interface RequestPathAccessPayload {
26
- type: InteractionType.REQUEST_PATH_ACCESS;
27
- interactionId: string;
28
- path: string;
29
- reason: string;
30
- }
31
- export type InteractionPayload = AskQuestionPayload | RequestPermissionPayload | RequestPathAccessPayload;
32
- export interface AskQuestionResponse {
33
- type: InteractionType.ASK_QUESTION;
34
- answer: string;
35
- }
36
- export interface RequestPermissionResponse {
37
- type: InteractionType.REQUEST_PERMISSION;
38
- approved: boolean;
39
- }
40
- export interface RequestPathAccessResponse {
41
- type: InteractionType.REQUEST_PATH_ACCESS;
42
- granted: boolean;
43
- }
44
- export type InteractionResponse = AskQuestionResponse | RequestPermissionResponse | RequestPathAccessResponse;
45
- export declare enum InvestigationSource {
46
- USER = "user",
47
- CONTEXT_REQUEST = "context_request"
48
- }
49
- export interface PRBEInteractionRequester {
50
- requestUserInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
51
- readonly investigationSource: InvestigationSource;
52
- }
53
- export interface PRBEInteractionHandler {
54
- handleInteraction(payload: InteractionPayload): Promise<InteractionResponse>;
55
- }
56
- export interface ResolvedInteraction {
57
- interactionId: string;
58
- payload: InteractionPayload;
59
- response: InteractionResponse;
60
- /** Number of events at time of resolution — used to split thinking bubbles */
61
- eventIndex: number;
62
- }
63
- //# sourceMappingURL=interactions.d.ts.map
@@ -1 +0,0 @@
1
-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,eAAe,oBAAoB;CACpC;AAMD,MAAM,WAAW,wBAAwB;IACvC,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClF,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CACnD;AAMD,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E;AAMD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * interactions.ts — Types for user interaction during investigations
4
- *
5
- * Defines the contract between tools (which request interactions) and
6
- * host apps (which present UI and collect responses).
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.InvestigationSource = exports.InteractionType = void 0;
10
- // ---------------------------------------------------------------------------
11
- // Interaction Types
12
- // ---------------------------------------------------------------------------
13
- var InteractionType;
14
- (function (InteractionType) {
15
- InteractionType["ASK_QUESTION"] = "ask_question";
16
- InteractionType["REQUEST_PERMISSION"] = "request_permission";
17
- InteractionType["REQUEST_PATH_ACCESS"] = "request_path_access";
18
- })(InteractionType || (exports.InteractionType = InteractionType = {}));
19
- // ---------------------------------------------------------------------------
20
- // Investigation source
21
- // ---------------------------------------------------------------------------
22
- var InvestigationSource;
23
- (function (InvestigationSource) {
24
- InvestigationSource["USER"] = "user";
25
- InvestigationSource["CONTEXT_REQUEST"] = "context_request";
26
- })(InvestigationSource || (exports.InvestigationSource = InvestigationSource = {}));
27
- //# sourceMappingURL=interactions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interactions.js","sourceRoot":"","sources":["../src/interactions.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,gDAA6B,CAAA;IAC7B,4DAAyC,CAAA;IACzC,8DAA2C,CAAA;AAC7C,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAyDD,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0DAAmC,CAAA;AACrC,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"}
package/dist/models.d.ts DELETED
@@ -1,218 +0,0 @@
1
- /**
2
- * models.ts — WSMessage, WSMessageType, tool types, config, errors
3
- *
4
- * All types must match the Swift SDK + middleware protocol exactly.
5
- */
6
- export declare enum WSMessageType {
7
- START = "start",
8
- TOOL_RESULT = "tool_result",
9
- UPLOAD_REQUEST = "upload_request",
10
- CANCEL = "cancel",
11
- PONG = "pong",
12
- THOUGHT = "thought",
13
- TOOL_CALL = "tool_call",
14
- SERVER_TOOL_CALL = "server_tool_call",
15
- SERVER_OBSERVATION = "server_observation",
16
- UPLOAD_URL = "upload_url",
17
- SESSION_CONFIG = "session_config",
18
- COMPLETE = "complete",
19
- ERROR = "error",
20
- PING = "ping"
21
- }
22
- export interface WSMessage {
23
- type: WSMessageType;
24
- id?: string;
25
- name?: string;
26
- content?: string;
27
- metadata?: Record<string, unknown>;
28
- }
29
- export declare enum ToolParamType {
30
- STRING = "STRING",
31
- BOOLEAN = "BOOLEAN",
32
- INTEGER = "INTEGER"
33
- }
34
- export interface PRBEToolParameter {
35
- name: string;
36
- type: ToolParamType;
37
- description: string;
38
- required: boolean;
39
- }
40
- export interface PRBEToolDeclaration {
41
- name: string;
42
- description: string;
43
- parameters: PRBEToolParameter[];
44
- /** When true, the middleware uses a longer timeout for this tool (user interaction required). */
45
- interactive?: boolean;
46
- }
47
- export declare enum ToolName {
48
- CLIENT_LIST_DIRECTORY = "client_list_directory",
49
- CLIENT_READ_FILE = "client_read_file",
50
- CLIENT_SEARCH_CONTENT = "client_search_content",
51
- CLIENT_FIND_FILES = "client_find_files",
52
- CLIENT_FLAG_FILE = "client_flag_file",
53
- CLIENT_READ_APP_LOGS = "client_read_app_logs",
54
- CLIENT_SEARCH_APP_LOGS = "client_search_app_logs",
55
- CLIENT_CLEAR_APP_LOGS = "client_clear_app_logs",
56
- CLIENT_FLAG_APP_LOGS = "client_flag_app_logs",
57
- CLIENT_ASK_USER = "client_ask_user",
58
- CLIENT_BASH_EXECUTE = "client_bash_execute"
59
- }
60
- export declare enum PRBEAgentConfigKey {
61
- API_KEY = "apiKey",
62
- AUTO_APPROVED_DIRS = "autoApprovedDirs",
63
- POLLING_INTERVAL = "pollingInterval",
64
- MAX_LOG_ENTRIES = "maxLogEntries",
65
- CAPTURE_CONSOLE = "captureConsole",
66
- BACKGROUND_POLLING = "backgroundPolling",
67
- INTERACTION_HANDLER = "interactionHandler",
68
- ELECTRON_LOG = "electronLog",
69
- IPC_MAIN = "ipcMain",
70
- RENDERER_LOG_CHANNEL = "rendererLogChannel",
71
- APP_DATA_PATH = "appDataPath"
72
- }
73
- export interface PRBEAgentConfig {
74
- [PRBEAgentConfigKey.API_KEY]: string;
75
- [PRBEAgentConfigKey.AUTO_APPROVED_DIRS]: string[];
76
- [PRBEAgentConfigKey.POLLING_INTERVAL]?: number;
77
- [PRBEAgentConfigKey.MAX_LOG_ENTRIES]?: number;
78
- [PRBEAgentConfigKey.CAPTURE_CONSOLE]?: boolean;
79
- [PRBEAgentConfigKey.BACKGROUND_POLLING]?: boolean;
80
- [PRBEAgentConfigKey.INTERACTION_HANDLER]?: import("./interactions").PRBEInteractionHandler;
81
- /** electron-log instance (v5) — SDK hooks into its transports to capture main-process logs */
82
- [PRBEAgentConfigKey.ELECTRON_LOG]?: {
83
- hooks: {
84
- push: (hook: (...args: any[]) => any) => void;
85
- };
86
- };
87
- /** Electron ipcMain instance — SDK listens for renderer log forwarding */
88
- [PRBEAgentConfigKey.IPC_MAIN]?: {
89
- on: (channel: string, listener: (event: any, ...args: any[]) => void) => void;
90
- };
91
- /** IPC channel name for renderer log forwarding (default: "prbe-renderer-log") */
92
- [PRBEAgentConfigKey.RENDERER_LOG_CHANNEL]?: string;
93
- /** Path to the application's data directory (e.g. Electron userData). Sent to the agent so it explores this directory first. */
94
- [PRBEAgentConfigKey.APP_DATA_PATH]?: string;
95
- }
96
- export declare enum PRBEAgentStatusType {
97
- STARTED = "started",
98
- THINKING = "thinking",
99
- TOOL_CALL = "tool_call",
100
- THOUGHT = "thought",
101
- OBSERVATION = "observation",
102
- COMPLETED = "completed",
103
- ERROR = "error",
104
- AWAITING_INTERACTION = "awaiting_interaction"
105
- }
106
- export type PRBEAgentStatus = {
107
- type: PRBEAgentStatusType.STARTED;
108
- } | {
109
- type: PRBEAgentStatusType.THINKING;
110
- } | {
111
- type: PRBEAgentStatusType.TOOL_CALL;
112
- name: string;
113
- label: string;
114
- } | {
115
- type: PRBEAgentStatusType.THOUGHT;
116
- text: string;
117
- } | {
118
- type: PRBEAgentStatusType.OBSERVATION;
119
- text: string;
120
- } | {
121
- type: PRBEAgentStatusType.COMPLETED;
122
- report: string;
123
- userSummary: string;
124
- } | {
125
- type: PRBEAgentStatusType.ERROR;
126
- message: string;
127
- } | {
128
- type: PRBEAgentStatusType.AWAITING_INTERACTION;
129
- interactionPayload: import("./interactions").InteractionPayload;
130
- };
131
- export interface InvestigationResult {
132
- report: string;
133
- userSummary: string;
134
- ticketId?: string;
135
- }
136
- export interface FlaggedFileIn {
137
- originalPath: string;
138
- reason?: string;
139
- data: Buffer;
140
- isText: boolean;
141
- }
142
- export interface PollRequest {
143
- agent_id: string;
144
- ticket_ids: string[];
145
- }
146
- export interface ContextRequestOut {
147
- id: string;
148
- query: string;
149
- slug?: string;
150
- is_active: boolean;
151
- created_at: string;
152
- }
153
- export interface TicketStatusOut {
154
- ticket_id: string;
155
- status: string;
156
- context_requests: ContextRequestOut[];
157
- }
158
- export interface PollResponse {
159
- tickets: TicketStatusOut[];
160
- }
161
- export interface TicketInfoRequest {
162
- ticket_ids: string[];
163
- }
164
- export interface TicketInfoOut {
165
- ticket_id: string;
166
- title: string;
167
- status: string;
168
- priority?: string;
169
- description?: string;
170
- session_count: number;
171
- }
172
- export interface TicketInfoResponse {
173
- tickets: TicketInfoOut[];
174
- }
175
- export interface PRBEStatusEvent {
176
- id: string;
177
- label: string;
178
- detail?: string;
179
- isCompleted: boolean;
180
- isExpanded: boolean;
181
- }
182
- export interface PRBECRInvestigation {
183
- id: string;
184
- query: string;
185
- slug?: string;
186
- events: PRBEStatusEvent[];
187
- isRunning: boolean;
188
- isCompleted: boolean;
189
- isFailed: boolean;
190
- report: string;
191
- summary: string;
192
- errorMessage?: string;
193
- startedAt: Date;
194
- pendingInteraction?: import("./interactions").InteractionPayload;
195
- resolvedInteractions?: import("./interactions").ResolvedInteraction[];
196
- }
197
- export interface PRBECompletedInvestigation {
198
- id: string;
199
- query: string;
200
- report: string;
201
- summary: string;
202
- completedAt: Date;
203
- }
204
- export declare enum PRBEAgentErrorType {
205
- SERVER_ERROR = "server_error",
206
- NETWORK_ERROR = "network_error",
207
- CANCELLED = "cancelled",
208
- MAX_ITERATIONS = "max_iterations"
209
- }
210
- export declare class PRBEAgentError extends Error {
211
- readonly errorType: PRBEAgentErrorType;
212
- readonly statusCode?: number;
213
- constructor(errorType: PRBEAgentErrorType, message: string, statusCode?: number);
214
- }
215
- export declare function redactPII(text: string): string;
216
- export declare const API_URL = "https://api.prbe.ai";
217
- export declare const MIDDLEWARE_URL = "wss://middleware.prbe.ai";
218
- //# sourceMappingURL=models.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,oBAAY,aAAa;IAEvB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,MAAM,WAAW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WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,gBAAgB,EAAE,kBAAkB,CAAC;IACjE,oBAAoB,CAAC,EAAE,OAAO,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;CACvE;AAMD,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;CACnB;AAMD,oBAAY,kBAAkB;IAC5B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,cAAc,mBAAmB;CAClC;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,SAAS,EAAE,kBAAkB,CAAC;IAC9C,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAMhF;AAMD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAMD,eAAO,MAAM,OAAO,wBAAwB,CAAC;AAC7C,eAAO,MAAM,cAAc,6BAA6B,CAAC"}
package/dist/models.js DELETED
@@ -1,121 +0,0 @@
1
- "use strict";
2
- /**
3
- * models.ts — WSMessage, WSMessageType, tool types, config, errors
4
- *
5
- * All types must match the Swift SDK + middleware protocol exactly.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.MIDDLEWARE_URL = exports.API_URL = exports.PRBEAgentError = exports.PRBEAgentErrorType = exports.PRBEAgentStatusType = exports.PRBEAgentConfigKey = exports.ToolName = exports.ToolParamType = exports.WSMessageType = void 0;
9
- exports.redactPII = redactPII;
10
- // ---------------------------------------------------------------------------
11
- // WebSocket Message Types
12
- // ---------------------------------------------------------------------------
13
- var WSMessageType;
14
- (function (WSMessageType) {
15
- // SDK -> Middleware
16
- WSMessageType["START"] = "start";
17
- WSMessageType["TOOL_RESULT"] = "tool_result";
18
- WSMessageType["UPLOAD_REQUEST"] = "upload_request";
19
- WSMessageType["CANCEL"] = "cancel";
20
- WSMessageType["PONG"] = "pong";
21
- // Middleware -> SDK
22
- WSMessageType["THOUGHT"] = "thought";
23
- WSMessageType["TOOL_CALL"] = "tool_call";
24
- WSMessageType["SERVER_TOOL_CALL"] = "server_tool_call";
25
- WSMessageType["SERVER_OBSERVATION"] = "server_observation";
26
- WSMessageType["UPLOAD_URL"] = "upload_url";
27
- WSMessageType["SESSION_CONFIG"] = "session_config";
28
- WSMessageType["COMPLETE"] = "complete";
29
- WSMessageType["ERROR"] = "error";
30
- WSMessageType["PING"] = "ping";
31
- })(WSMessageType || (exports.WSMessageType = WSMessageType = {}));
32
- // ---------------------------------------------------------------------------
33
- // Tool System
34
- // ---------------------------------------------------------------------------
35
- var ToolParamType;
36
- (function (ToolParamType) {
37
- ToolParamType["STRING"] = "STRING";
38
- ToolParamType["BOOLEAN"] = "BOOLEAN";
39
- ToolParamType["INTEGER"] = "INTEGER";
40
- })(ToolParamType || (exports.ToolParamType = ToolParamType = {}));
41
- // ---------------------------------------------------------------------------
42
- // Tool Names (must match middleware exactly)
43
- // ---------------------------------------------------------------------------
44
- var ToolName;
45
- (function (ToolName) {
46
- ToolName["CLIENT_LIST_DIRECTORY"] = "client_list_directory";
47
- ToolName["CLIENT_READ_FILE"] = "client_read_file";
48
- ToolName["CLIENT_SEARCH_CONTENT"] = "client_search_content";
49
- ToolName["CLIENT_FIND_FILES"] = "client_find_files";
50
- ToolName["CLIENT_FLAG_FILE"] = "client_flag_file";
51
- ToolName["CLIENT_READ_APP_LOGS"] = "client_read_app_logs";
52
- ToolName["CLIENT_SEARCH_APP_LOGS"] = "client_search_app_logs";
53
- ToolName["CLIENT_CLEAR_APP_LOGS"] = "client_clear_app_logs";
54
- ToolName["CLIENT_FLAG_APP_LOGS"] = "client_flag_app_logs";
55
- ToolName["CLIENT_ASK_USER"] = "client_ask_user";
56
- ToolName["CLIENT_BASH_EXECUTE"] = "client_bash_execute";
57
- })(ToolName || (exports.ToolName = ToolName = {}));
58
- // ---------------------------------------------------------------------------
59
- // Agent Configuration
60
- // ---------------------------------------------------------------------------
61
- var PRBEAgentConfigKey;
62
- (function (PRBEAgentConfigKey) {
63
- PRBEAgentConfigKey["API_KEY"] = "apiKey";
64
- PRBEAgentConfigKey["AUTO_APPROVED_DIRS"] = "autoApprovedDirs";
65
- PRBEAgentConfigKey["POLLING_INTERVAL"] = "pollingInterval";
66
- PRBEAgentConfigKey["MAX_LOG_ENTRIES"] = "maxLogEntries";
67
- PRBEAgentConfigKey["CAPTURE_CONSOLE"] = "captureConsole";
68
- PRBEAgentConfigKey["BACKGROUND_POLLING"] = "backgroundPolling";
69
- PRBEAgentConfigKey["INTERACTION_HANDLER"] = "interactionHandler";
70
- PRBEAgentConfigKey["ELECTRON_LOG"] = "electronLog";
71
- PRBEAgentConfigKey["IPC_MAIN"] = "ipcMain";
72
- PRBEAgentConfigKey["RENDERER_LOG_CHANNEL"] = "rendererLogChannel";
73
- PRBEAgentConfigKey["APP_DATA_PATH"] = "appDataPath";
74
- })(PRBEAgentConfigKey || (exports.PRBEAgentConfigKey = PRBEAgentConfigKey = {}));
75
- // ---------------------------------------------------------------------------
76
- // Agent Status
77
- // ---------------------------------------------------------------------------
78
- var PRBEAgentStatusType;
79
- (function (PRBEAgentStatusType) {
80
- PRBEAgentStatusType["STARTED"] = "started";
81
- PRBEAgentStatusType["THINKING"] = "thinking";
82
- PRBEAgentStatusType["TOOL_CALL"] = "tool_call";
83
- PRBEAgentStatusType["THOUGHT"] = "thought";
84
- PRBEAgentStatusType["OBSERVATION"] = "observation";
85
- PRBEAgentStatusType["COMPLETED"] = "completed";
86
- PRBEAgentStatusType["ERROR"] = "error";
87
- PRBEAgentStatusType["AWAITING_INTERACTION"] = "awaiting_interaction";
88
- })(PRBEAgentStatusType || (exports.PRBEAgentStatusType = PRBEAgentStatusType = {}));
89
- // ---------------------------------------------------------------------------
90
- // Errors
91
- // ---------------------------------------------------------------------------
92
- var PRBEAgentErrorType;
93
- (function (PRBEAgentErrorType) {
94
- PRBEAgentErrorType["SERVER_ERROR"] = "server_error";
95
- PRBEAgentErrorType["NETWORK_ERROR"] = "network_error";
96
- PRBEAgentErrorType["CANCELLED"] = "cancelled";
97
- PRBEAgentErrorType["MAX_ITERATIONS"] = "max_iterations";
98
- })(PRBEAgentErrorType || (exports.PRBEAgentErrorType = PRBEAgentErrorType = {}));
99
- class PRBEAgentError extends Error {
100
- errorType;
101
- statusCode;
102
- constructor(errorType, message, statusCode) {
103
- super(message);
104
- this.name = "PRBEAgentError";
105
- this.errorType = errorType;
106
- this.statusCode = statusCode;
107
- }
108
- }
109
- exports.PRBEAgentError = PRBEAgentError;
110
- // ---------------------------------------------------------------------------
111
- // PII Redactor (pass-through stub, matches Swift SDK)
112
- // ---------------------------------------------------------------------------
113
- function redactPII(text) {
114
- return text;
115
- }
116
- // ---------------------------------------------------------------------------
117
- // Static URLs
118
- // ---------------------------------------------------------------------------
119
- exports.API_URL = "https://api.prbe.ai";
120
- exports.MIDDLEWARE_URL = "wss://middleware.prbe.ai";
121
- //# sourceMappingURL=models.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAqRH,8BAEC;AArRD,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,IAAY,aAiBX;AAjBD,WAAY,aAAa;IACvB,oBAAoB;IACpB,gCAAe,CAAA;IACf,4CAA2B,CAAA;IAC3B,kDAAiC,CAAA;IACjC,kCAAiB,CAAA;IACj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ATD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;IACrB,8CAAuB,CAAA;IACvB,0CAAmB,CAAA;IACnB,kDAA2B,CAAA;IAC3B,8CAAuB,CAAA;IACvB,sCAAe,CAAA;IACf,oEAA6C,CAAA;AAC/C,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B;AAyHD,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,mDAA6B,CAAA;IAC7B,qDAA+B,CAAA;IAC/B,6CAAuB,CAAA;IACvB,uDAAiC,CAAA;AACnC,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAED,MAAa,cAAe,SAAQ,KAAK;IACvB,SAAS,CAAqB;IAC9B,UAAU,CAAU;IAEpC,YAAY,SAA6B,EAAE,OAAe,EAAE,UAAmB;QAC7E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAVD,wCAUC;AAED,8EAA8E;AAC9E,sDAAsD;AACtD,8EAA8E;AAE9E,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAEjE,QAAA,OAAO,GAAG,qBAAqB,CAAC;AAChC,QAAA,cAAc,GAAG,0BAA0B,CAAC"}
@@ -1,51 +0,0 @@
1
- /**
2
- * serialization.ts — IPC-safe serialization of agent state
3
- *
4
- * Converts live PRBEAgentState (with Map, Date, EventEmitter) into
5
- * plain JSON-safe objects suitable for IPC or structured clone.
6
- */
7
- import type { PRBEAgentState } from "./state";
8
- import type { PRBEStatusEvent, TicketInfoOut } from "./models";
9
- import type { InteractionPayload, ResolvedInteraction } from "./interactions";
10
- export interface PRBESerializedCR {
11
- id: string;
12
- query: string;
13
- slug?: string;
14
- events: PRBEStatusEvent[];
15
- isRunning: boolean;
16
- isCompleted: boolean;
17
- isFailed: boolean;
18
- report: string;
19
- summary: string;
20
- errorMessage?: string;
21
- startedAt: string;
22
- pendingInteraction?: InteractionPayload;
23
- resolvedInteractions?: ResolvedInteraction[];
24
- }
25
- export type PRBESerializedTicket = TicketInfoOut;
26
- export interface PRBESerializedCompletedInvestigation {
27
- id: string;
28
- query: string;
29
- report: string;
30
- summary: string;
31
- completedAt: string;
32
- }
33
- export interface PRBESerializedState {
34
- isInvestigating: boolean;
35
- events: PRBEStatusEvent[];
36
- report: string;
37
- summary: string;
38
- currentQuery: string;
39
- investigationError?: string;
40
- pendingInteraction?: InteractionPayload;
41
- resolvedInteractions: ResolvedInteraction[];
42
- completedInvestigations: PRBESerializedCompletedInvestigation[];
43
- activeCRs: PRBESerializedCR[];
44
- completedCRs: PRBESerializedCR[];
45
- trackedTicketIDs: string[];
46
- ticketInfo: PRBESerializedTicket[];
47
- hasActiveWork: boolean;
48
- }
49
- export declare const DEFAULT_PRBE_STATE: PRBESerializedState;
50
- export declare function serializePRBEState(state: PRBEAgentState): PRBESerializedState;
51
- //# sourceMappingURL=serialization.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EACV,eAAe,EAEf,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAM9E,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,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use strict";
2
- /**
3
- * serialization.ts — IPC-safe serialization of agent state
4
- *
5
- * Converts live PRBEAgentState (with Map, Date, EventEmitter) into
6
- * plain JSON-safe objects suitable for IPC or structured clone.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DEFAULT_PRBE_STATE = void 0;
10
- exports.serializePRBEState = serializePRBEState;
11
- // ---------------------------------------------------------------------------
12
- // Default state (used before agent initializes)
13
- // ---------------------------------------------------------------------------
14
- exports.DEFAULT_PRBE_STATE = {
15
- isInvestigating: false,
16
- events: [],
17
- report: "",
18
- summary: "",
19
- currentQuery: "",
20
- resolvedInteractions: [],
21
- completedInvestigations: [],
22
- activeCRs: [],
23
- completedCRs: [],
24
- trackedTicketIDs: [],
25
- ticketInfo: [],
26
- hasActiveWork: false,
27
- };
28
- // ---------------------------------------------------------------------------
29
- // Converter: live state → IPC-safe plain object
30
- // ---------------------------------------------------------------------------
31
- function serializeCR(cr) {
32
- return {
33
- id: cr.id,
34
- query: cr.query,
35
- slug: cr.slug,
36
- events: cr.events,
37
- isRunning: cr.isRunning,
38
- isCompleted: cr.isCompleted,
39
- isFailed: cr.isFailed,
40
- report: cr.report,
41
- summary: cr.summary,
42
- errorMessage: cr.errorMessage,
43
- startedAt: cr.startedAt.toISOString(),
44
- pendingInteraction: cr.pendingInteraction,
45
- resolvedInteractions: cr.resolvedInteractions ?? [],
46
- };
47
- }
48
- function serializePRBEState(state) {
49
- return {
50
- isInvestigating: state.isInvestigating,
51
- events: state.events,
52
- report: state.report,
53
- summary: state.summary,
54
- currentQuery: state.currentQuery,
55
- investigationError: state.investigationError,
56
- pendingInteraction: state.pendingInteraction,
57
- resolvedInteractions: state.resolvedInteractions,
58
- completedInvestigations: state.completedInvestigations.map((inv) => ({
59
- id: inv.id,
60
- query: inv.query,
61
- report: inv.report,
62
- summary: inv.summary,
63
- completedAt: inv.completedAt.toISOString(),
64
- })),
65
- activeCRs: Array.from(state.activeCRs.values()).map(serializeCR),
66
- completedCRs: state.completedCRs.map(serializeCR),
67
- trackedTicketIDs: state.trackedTicketIDs,
68
- ticketInfo: state.ticketInfo,
69
- hasActiveWork: state.hasActiveWork,
70
- };
71
- }
72
- //# sourceMappingURL=serialization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA8GH,gDAuBC;AAhED,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAEjE,QAAA,kBAAkB,GAAwB;IACrD,eAAe,EAAE,KAAK;IACtB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,EAAE;IACX,YAAY,EAAE,EAAE;IAChB,oBAAoB,EAAE,EAAE;IACxB,uBAAuB,EAAE,EAAE;IAC3B,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,EAAE;IAChB,gBAAgB,EAAE,EAAE;IACpB,UAAU,EAAE,EAAE;IACd,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAE9E,SAAS,WAAW,CAAC,EAAuB;IAC1C,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,KAAK,EAAE,EAAE,CAAC,KAAK;QACf,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,SAAS,EAAE,EAAE,CAAC,SAAS;QACvB,WAAW,EAAE,EAAE,CAAC,WAAW;QAC3B,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,YAAY,EAAE,EAAE,CAAC,YAAY;QAC7B,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE;QACrC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB;QACzC,oBAAoB,EAAE,EAAE,CAAC,oBAAoB,IAAI,EAAE;KACpD,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,KAAqB;IACtD,OAAO;QACL,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,oBAAoB,EAAE,KAAK,CAAC,oBAAoB;QAChD,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACnE,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,WAAW,EAAE;SAC3C,CAAC,CAAC;QACH,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC;QAChE,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC;QACjD,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,aAAa,EAAE,KAAK,CAAC,aAAa;KACnC,CAAC;AACJ,CAAC"}
package/dist/state.d.ts DELETED
@@ -1,70 +0,0 @@
1
- /**
2
- * state.ts — PRBEAgentState: EventEmitter-based observable investigation state
3
- *
4
- * Mirrors PRBEAgentState.swift but uses Node.js EventEmitter instead of Combine/@Published.
5
- * Host apps subscribe to events for UI updates.
6
- */
7
- import { EventEmitter } from "events";
8
- import type { PRBEStatusEvent, PRBECRInvestigation, PRBECompletedInvestigation, TicketInfoOut } from "./models";
9
- import type { InteractionPayload, InteractionResponse, ResolvedInteraction } from "./interactions";
10
- export declare enum PRBEStateEvent {
11
- /** Emitted on any state change. Payload: void */
12
- STATUS = "status",
13
- /** Emitted when a new event is appended. Payload: PRBEStatusEvent */
14
- EVENT = "event",
15
- /** Emitted when investigation completes. Payload: { report: string; summary: string } */
16
- COMPLETE = "complete",
17
- /** Emitted on error. Payload: { message: string } */
18
- ERROR = "error",
19
- /** Emitted when a background CR starts. Payload: PRBECRInvestigation */
20
- CR_START = "cr-start",
21
- /** Emitted when a background CR completes/fails. Payload: PRBECRInvestigation */
22
- CR_COMPLETE = "cr-complete",
23
- /** Emitted when tracked ticket IDs change. Payload: string[] */
24
- TICKETS_CHANGED = "tickets-changed",
25
- /** Emitted when ticket info is updated. Payload: TicketInfoOut[] */
26
- TICKET_INFO = "ticket-info",
27
- /** Emitted when an interaction is requested. Payload: InteractionPayload */
28
- INTERACTION_REQUESTED = "interaction-requested",
29
- /** Emitted when an interaction is resolved. Payload: void */
30
- INTERACTION_RESOLVED = "interaction-resolved"
31
- }
32
- export declare class PRBEAgentState extends EventEmitter {
33
- isInvestigating: boolean;
34
- events: PRBEStatusEvent[];
35
- report: string;
36
- summary: string;
37
- currentQuery: string;
38
- investigationError?: string;
39
- pendingInteraction?: InteractionPayload;
40
- resolvedInteractions: ResolvedInteraction[];
41
- completedInvestigations: PRBECompletedInvestigation[];
42
- activeCRs: Map<string, PRBECRInvestigation>;
43
- completedCRs: PRBECRInvestigation[];
44
- trackedTicketIDs: string[];
45
- ticketInfo: TicketInfoOut[];
46
- get hasActiveWork(): boolean;
47
- get activeCRCount(): number;
48
- get isActive(): boolean;
49
- beginInvestigation(query: string): void;
50
- resetInvestigation(): void;
51
- appendEvent(label: string, detail?: string, completed?: boolean): void;
52
- attachObservation(text: string): void;
53
- completeInvestigation(report: string, summary: string): void;
54
- failInvestigation(message: string): void;
55
- setPendingInteraction(payload: InteractionPayload): void;
56
- clearPendingInteraction(): void;
57
- setCRPendingInteraction(crID: string, payload: InteractionPayload): void;
58
- clearCRPendingInteraction(crID: string): void;
59
- resolveInteraction(response: InteractionResponse): void;
60
- resolveCRInteraction(crID: string, response: InteractionResponse): void;
61
- toggleExpansion(eventId: string): void;
62
- beginCR(id: string, query: string, slug?: string): void;
63
- appendCREvent(crID: string, label: string, detail?: string, completed?: boolean): void;
64
- attachCRObservation(crID: string, text: string): void;
65
- completeCR(id: string, report: string, summary: string): void;
66
- failCR(id: string, message: string): void;
67
- updateTrackedTicketIDs(ids: string[]): void;
68
- updateTicketInfo(info: TicketInfoOut[]): void;
69
- }
70
- //# sourceMappingURL=state.d.ts.map