@prbe.ai/electron-sdk 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-CwYRJCG0.mjs';
2
- export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolvedInteraction, J as TicketInfoRequest, K as TicketInfoResponse, L as TicketStatusOut, N as ToolName, O as ToolParamType, W as WSMessage, Q as WSMessageType, S as redactPII, U as serializePRBEState } from './types-CwYRJCG0.mjs';
1
+ import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-CeIldtlI.mjs';
2
+ export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-CeIldtlI.mjs';
3
3
  import 'events';
4
4
 
5
5
  /**
@@ -21,7 +21,9 @@ declare class PRBEToolRegistry {
21
21
  declare class PRBEClosureTool implements PRBETool {
22
22
  readonly declaration: PRBEToolDeclaration;
23
23
  private readonly handler;
24
- constructor(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>);
24
+ constructor(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
25
+ interactive?: boolean;
26
+ });
25
27
  execute(args: Record<string, unknown>): Promise<string>;
26
28
  }
27
29
  /**
@@ -148,12 +150,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
148
150
  /** Files flagged during the current tool call — uploaded immediately after the tool returns. */
149
151
  private pendingFlaggedFiles;
150
152
  private get agentID();
151
- private get trackedTicketIDs();
152
- private set trackedTicketIDs(value);
153
+ private get trackedSessionIDs();
154
+ private set trackedSessionIDs(value);
153
155
  private get respondedCRIDs();
154
156
  private set respondedCRIDs(value);
155
157
  private syncPolling;
156
- private addTrackedTicket;
158
+ private addTrackedSession;
157
159
  constructor(config: PRBEAgentConfig);
158
160
  private hookElectronLog;
159
161
  private hookRendererLogs;
@@ -167,7 +169,9 @@ declare class PRBEAgent implements PRBEInteractionRequester {
167
169
  /**
168
170
  * Register a custom tool that the middleware can invoke during investigations.
169
171
  */
170
- registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>): void;
172
+ registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
173
+ interactive?: boolean;
174
+ }): void;
171
175
  /**
172
176
  * User-initiated investigation. Updates `state` events/report directly.
173
177
  */
@@ -182,10 +186,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
182
186
  cancel(): void;
183
187
  /**
184
188
  * Poll the backend for context requests on tracked tickets.
189
+ * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
185
190
  */
186
191
  poll(): Promise<PollResponse | null>;
187
192
  /**
188
- * Fetch ticket display info for all tracked tickets.
193
+ * Fetch ticket display info for all tracked sessions.
194
+ * Resolves session IDs → ticket IDs first, then fetches ticket info.
189
195
  */
190
196
  fetchTicketInfo(): Promise<TicketInfoOut[]>;
191
197
  stopPolling(): void;
@@ -210,6 +216,7 @@ declare class PRBEAgent implements PRBEInteractionRequester {
210
216
  private extractUploadPrefix;
211
217
  private static backgroundUpload;
212
218
  private startPolling;
219
+ private resolveSessions;
213
220
  /**
214
221
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
215
222
  * that can crash the c-ares resolver during process shutdown.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-CwYRJCG0.js';
2
- export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolvedInteraction, J as TicketInfoRequest, K as TicketInfoResponse, L as TicketStatusOut, N as ToolName, O as ToolParamType, W as WSMessage, Q as WSMessageType, S as redactPII, U as serializePRBEState } from './types-CwYRJCG0.js';
1
+ import { P as PRBEToolDeclaration, a as PRBEToolParameter, b as PRBEInteractionRequester, F as FlaggedFileIn, c as PRBEAgentState, d as PRBEAgentConfig, I as InvestigationSource, e as InteractionPayload, f as InteractionResponse, g as PollResponse, T as TicketInfoOut } from './types-CeIldtlI.js';
2
+ export { A as API_URL, h as AskQuestionPayload, i as AskQuestionResponse, C as ContextRequestOut, D as DEFAULT_PRBE_STATE, j as InteractionType, k as InvestigationResult, M as MIDDLEWARE_URL, l as PRBEAgentConfigKey, m as PRBEAgentError, n as PRBEAgentErrorType, o as PRBEAgentStatus, p as PRBEAgentStatusType, q as PRBECRInvestigation, r as PRBECompletedInvestigation, s as PRBEInteractionHandler, t as PRBESerializedCR, u as PRBESerializedCompletedInvestigation, v as PRBESerializedState, w as PRBESerializedTicket, x as PRBEStateEvent, y as PRBEStatusEvent, z as PollRequest, R as RequestPathAccessPayload, B as RequestPathAccessResponse, E as RequestPermissionPayload, G as RequestPermissionResponse, H as ResolveSessionsRequest, J as ResolveSessionsResponse, K as ResolvedInteraction, L as ResolvedTicketOut, N as TicketInfoRequest, O as TicketInfoResponse, Q as TicketStatusOut, S as ToolName, U as ToolParamType, W as WSMessage, V as WSMessageType, X as redactPII, Y as serializePRBEState } from './types-CeIldtlI.js';
3
3
  import 'events';
4
4
 
5
5
  /**
@@ -21,7 +21,9 @@ declare class PRBEToolRegistry {
21
21
  declare class PRBEClosureTool implements PRBETool {
22
22
  readonly declaration: PRBEToolDeclaration;
23
23
  private readonly handler;
24
- constructor(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>);
24
+ constructor(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
25
+ interactive?: boolean;
26
+ });
25
27
  execute(args: Record<string, unknown>): Promise<string>;
26
28
  }
27
29
  /**
@@ -148,12 +150,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
148
150
  /** Files flagged during the current tool call — uploaded immediately after the tool returns. */
149
151
  private pendingFlaggedFiles;
150
152
  private get agentID();
151
- private get trackedTicketIDs();
152
- private set trackedTicketIDs(value);
153
+ private get trackedSessionIDs();
154
+ private set trackedSessionIDs(value);
153
155
  private get respondedCRIDs();
154
156
  private set respondedCRIDs(value);
155
157
  private syncPolling;
156
- private addTrackedTicket;
158
+ private addTrackedSession;
157
159
  constructor(config: PRBEAgentConfig);
158
160
  private hookElectronLog;
159
161
  private hookRendererLogs;
@@ -167,7 +169,9 @@ declare class PRBEAgent implements PRBEInteractionRequester {
167
169
  /**
168
170
  * Register a custom tool that the middleware can invoke during investigations.
169
171
  */
170
- registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>): void;
172
+ registerTool(name: string, description: string, parameters: PRBEToolParameter[], handler: (args: Record<string, unknown>) => Promise<string>, options?: {
173
+ interactive?: boolean;
174
+ }): void;
171
175
  /**
172
176
  * User-initiated investigation. Updates `state` events/report directly.
173
177
  */
@@ -182,10 +186,12 @@ declare class PRBEAgent implements PRBEInteractionRequester {
182
186
  cancel(): void;
183
187
  /**
184
188
  * Poll the backend for context requests on tracked tickets.
189
+ * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
185
190
  */
186
191
  poll(): Promise<PollResponse | null>;
187
192
  /**
188
- * Fetch ticket display info for all tracked tickets.
193
+ * Fetch ticket display info for all tracked sessions.
194
+ * Resolves session IDs → ticket IDs first, then fetches ticket info.
189
195
  */
190
196
  fetchTicketInfo(): Promise<TicketInfoOut[]>;
191
197
  stopPolling(): void;
@@ -210,6 +216,7 @@ declare class PRBEAgent implements PRBEInteractionRequester {
210
216
  private extractUploadPrefix;
211
217
  private static backgroundUpload;
212
218
  private startPolling;
219
+ private resolveSessions;
213
220
  /**
214
221
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
215
222
  * that can crash the c-ares resolver during process shutdown.
package/dist/index.js CHANGED
@@ -192,7 +192,7 @@ var PRBEAgentState = class extends import_events.EventEmitter {
192
192
  activeCRs = /* @__PURE__ */ new Map();
193
193
  completedCRs = [];
194
194
  // Tracked tickets
195
- trackedTicketIDs = [];
195
+ trackedSessionIDs = [];
196
196
  ticketInfo = [];
197
197
  // Computed
198
198
  get hasActiveWork() {
@@ -420,8 +420,8 @@ var PRBEAgentState = class extends import_events.EventEmitter {
420
420
  this.emit("status" /* STATUS */);
421
421
  }
422
422
  // ---------- Tickets ----------
423
- updateTrackedTicketIDs(ids) {
424
- this.trackedTicketIDs = ids;
423
+ updateTrackedSessionIDs(ids) {
424
+ this.trackedSessionIDs = ids;
425
425
  this.emit("tickets-changed" /* TICKETS_CHANGED */, ids);
426
426
  this.emit("status" /* STATUS */);
427
427
  }
@@ -469,8 +469,13 @@ var PRBEToolRegistry = class {
469
469
  var PRBEClosureTool = class {
470
470
  declaration;
471
471
  handler;
472
- constructor(name, description, parameters, handler) {
473
- this.declaration = { name, description, parameters };
472
+ constructor(name, description, parameters, handler, options) {
473
+ this.declaration = {
474
+ name,
475
+ description,
476
+ parameters,
477
+ ...options?.interactive ? { interactive: true } : {}
478
+ };
474
479
  this.handler = handler;
475
480
  }
476
481
  async execute(args) {
@@ -1805,13 +1810,13 @@ var PRBEAgent = class _PRBEAgent {
1805
1810
  savePersistedData(this.persistedData);
1806
1811
  return newID;
1807
1812
  }
1808
- get trackedTicketIDs() {
1809
- return this.persistedData.ticketIds ?? [];
1813
+ get trackedSessionIDs() {
1814
+ return this.persistedData.sessionIds ?? [];
1810
1815
  }
1811
- set trackedTicketIDs(ids) {
1812
- this.persistedData.ticketIds = ids;
1816
+ set trackedSessionIDs(ids) {
1817
+ this.persistedData.sessionIds = ids;
1813
1818
  savePersistedData(this.persistedData);
1814
- this.state.updateTrackedTicketIDs(ids);
1819
+ this.state.updateTrackedSessionIDs(ids);
1815
1820
  this.syncPolling(ids.length > 0);
1816
1821
  }
1817
1822
  get respondedCRIDs() {
@@ -1821,19 +1826,19 @@ var PRBEAgent = class _PRBEAgent {
1821
1826
  this.persistedData.respondedCRIds = Array.from(ids);
1822
1827
  savePersistedData(this.persistedData);
1823
1828
  }
1824
- syncPolling(hasTickets) {
1825
- if (this.config.backgroundPolling && hasTickets) {
1829
+ syncPolling(hasSessions) {
1830
+ if (this.config.backgroundPolling && hasSessions) {
1826
1831
  if (this.pollingTimer === null) {
1827
1832
  this.startPolling();
1828
1833
  }
1829
- } else if (!hasTickets) {
1834
+ } else if (!hasSessions) {
1830
1835
  this.stopPolling();
1831
1836
  }
1832
1837
  }
1833
- addTrackedTicket(id) {
1834
- const ids = this.trackedTicketIDs;
1838
+ addTrackedSession(id) {
1839
+ const ids = this.trackedSessionIDs;
1835
1840
  if (!ids.includes(id)) {
1836
- this.trackedTicketIDs = [...ids, id];
1841
+ this.trackedSessionIDs = [...ids, id];
1837
1842
  }
1838
1843
  }
1839
1844
  // ---------- Constructor ----------
@@ -1891,9 +1896,9 @@ var PRBEAgent = class _PRBEAgent {
1891
1896
  if (config.ipcMain) {
1892
1897
  this.hookRendererLogs(config.ipcMain, config.rendererLogChannel ?? "prbe-renderer-log");
1893
1898
  }
1894
- const existingTickets = this.trackedTicketIDs;
1895
- if (existingTickets.length > 0) {
1896
- this.trackedTicketIDs = existingTickets;
1899
+ const existingSessions = this.trackedSessionIDs;
1900
+ if (existingSessions.length > 0) {
1901
+ this.trackedSessionIDs = existingSessions;
1897
1902
  }
1898
1903
  }
1899
1904
  // ---------- Log integration ----------
@@ -1978,9 +1983,9 @@ var PRBEAgent = class _PRBEAgent {
1978
1983
  /**
1979
1984
  * Register a custom tool that the middleware can invoke during investigations.
1980
1985
  */
1981
- registerTool(name, description, parameters, handler) {
1986
+ registerTool(name, description, parameters, handler, options) {
1982
1987
  this.registry.register(
1983
- new PRBEClosureTool(name, description, parameters, handler)
1988
+ new PRBEClosureTool(name, description, parameters, handler, options)
1984
1989
  );
1985
1990
  }
1986
1991
  /**
@@ -2024,8 +2029,8 @@ var PRBEAgent = class _PRBEAgent {
2024
2029
  );
2025
2030
  this.currentInvestigationSource = "user" /* USER */;
2026
2031
  this.currentCRId = null;
2027
- if (result?.ticketId) {
2028
- this.addTrackedTicket(result.ticketId);
2032
+ if (result?.sessionId) {
2033
+ this.addTrackedSession(result.sessionId);
2029
2034
  } else if (!result) {
2030
2035
  if (this.state.isInvestigating) {
2031
2036
  const message = this.userCancelled ? "Investigation cancelled" : "Investigation ended unexpectedly";
@@ -2057,33 +2062,37 @@ var PRBEAgent = class _PRBEAgent {
2057
2062
  }
2058
2063
  /**
2059
2064
  * Poll the backend for context requests on tracked tickets.
2065
+ * Resolves session IDs → ticket IDs first, then polls with ticket IDs.
2060
2066
  */
2061
2067
  async poll() {
2062
- const ticketIDs = this.trackedTicketIDs;
2063
- if (ticketIDs.length === 0) return null;
2064
- const request = {
2065
- agent_id: this.agentID,
2066
- ticket_ids: ticketIDs
2067
- };
2068
+ const sessionIDs = this.trackedSessionIDs;
2069
+ if (sessionIDs.length === 0) return null;
2068
2070
  try {
2071
+ const resolved = await this.resolveSessions(sessionIDs);
2072
+ const returnedSessionIDs = new Set(
2073
+ resolved.tickets.flatMap((t) => t.session_ids)
2074
+ );
2075
+ const resolvedSessionIDs = new Set(
2076
+ resolved.tickets.filter((t) => t.status === "resolved").flatMap((t) => t.session_ids)
2077
+ );
2078
+ const survivingSessions = sessionIDs.filter(
2079
+ (id) => returnedSessionIDs.has(id) && !resolvedSessionIDs.has(id)
2080
+ );
2081
+ if (survivingSessions.length !== sessionIDs.length) {
2082
+ this.trackedSessionIDs = survivingSessions;
2083
+ }
2084
+ const ticketIDs = resolved.tickets.filter((t) => t.status !== "resolved").map((t) => t.ticket_id);
2085
+ if (ticketIDs.length === 0) return { tickets: [] };
2086
+ const request = {
2087
+ agent_id: this.agentID,
2088
+ ticket_ids: ticketIDs
2089
+ };
2069
2090
  const response = await this.post(
2070
2091
  "/api/agent/poll",
2071
2092
  request
2072
2093
  );
2073
- const returnedIDs = new Set(response.tickets.map((t) => t.ticket_id));
2074
- const orphaned = ticketIDs.filter((id) => !returnedIDs.has(id));
2075
- if (orphaned.length > 0) {
2076
- this.trackedTicketIDs = this.trackedTicketIDs.filter(
2077
- (id) => !orphaned.includes(id)
2078
- );
2079
- }
2080
2094
  const knownCRIDs = /* @__PURE__ */ new Set();
2081
2095
  for (const ticket of response.tickets) {
2082
- if (ticket.status === "resolved") {
2083
- this.trackedTicketIDs = this.trackedTicketIDs.filter(
2084
- (id) => id !== ticket.ticket_id
2085
- );
2086
- }
2087
2096
  for (const cr of ticket.context_requests) {
2088
2097
  knownCRIDs.add(cr.id);
2089
2098
  if (!cr.is_active || this.respondedCRIDs.has(cr.id)) continue;
@@ -2109,13 +2118,17 @@ var PRBEAgent = class _PRBEAgent {
2109
2118
  }
2110
2119
  }
2111
2120
  /**
2112
- * Fetch ticket display info for all tracked tickets.
2121
+ * Fetch ticket display info for all tracked sessions.
2122
+ * Resolves session IDs → ticket IDs first, then fetches ticket info.
2113
2123
  */
2114
2124
  async fetchTicketInfo() {
2115
- const ticketIDs = this.trackedTicketIDs;
2116
- if (ticketIDs.length === 0) return [];
2117
- const request = { ticket_ids: ticketIDs };
2125
+ const sessionIDs = this.trackedSessionIDs;
2126
+ if (sessionIDs.length === 0) return [];
2118
2127
  try {
2128
+ const resolved = await this.resolveSessions(sessionIDs);
2129
+ const ticketIDs = resolved.tickets.map((t) => t.ticket_id);
2130
+ if (ticketIDs.length === 0) return [];
2131
+ const request = { ticket_ids: ticketIDs };
2119
2132
  const response = await this.post(
2120
2133
  "/api/agent/tickets",
2121
2134
  request
@@ -2133,7 +2146,7 @@ var PRBEAgent = class _PRBEAgent {
2133
2146
  }
2134
2147
  }
2135
2148
  resumePolling() {
2136
- if (this.trackedTicketIDs.length === 0) return;
2149
+ if (this.trackedSessionIDs.length === 0) return;
2137
2150
  this.startPolling();
2138
2151
  }
2139
2152
  /**
@@ -2156,7 +2169,7 @@ var PRBEAgent = class _PRBEAgent {
2156
2169
  this.state.completedInvestigations = [];
2157
2170
  this.state.activeCRs.clear();
2158
2171
  this.state.completedCRs = [];
2159
- this.state.trackedTicketIDs = [];
2172
+ this.state.trackedSessionIDs = [];
2160
2173
  this.state.ticketInfo = [];
2161
2174
  this.state.emit("status" /* STATUS */);
2162
2175
  }
@@ -2215,8 +2228,8 @@ var PRBEAgent = class _PRBEAgent {
2215
2228
  );
2216
2229
  this.currentInvestigationSource = "user" /* USER */;
2217
2230
  this.currentCRId = null;
2218
- if (result?.ticketId) {
2219
- this.addTrackedTicket(result.ticketId);
2231
+ if (result?.sessionId) {
2232
+ this.addTrackedSession(result.sessionId);
2220
2233
  }
2221
2234
  }
2222
2235
  // ---------- WebSocket Investigation ----------
@@ -2393,6 +2406,7 @@ var PRBEAgent = class _PRBEAgent {
2393
2406
  const report = msg.content ?? "";
2394
2407
  const userSummary = msg.metadata?.["user_summary"] ?? "";
2395
2408
  const ticketId2 = msg.metadata?.["ticket_id"];
2409
+ const sessionId = msg.metadata?.["session_id"];
2396
2410
  emit({
2397
2411
  type: "completed" /* COMPLETED */,
2398
2412
  report,
@@ -2400,7 +2414,7 @@ var PRBEAgent = class _PRBEAgent {
2400
2414
  ticketId: ticketId2
2401
2415
  });
2402
2416
  ws.close(1e3, "Complete");
2403
- finish({ report, userSummary, ticketId: ticketId2 });
2417
+ finish({ report, userSummary, ticketId: ticketId2, sessionId });
2404
2418
  break;
2405
2419
  }
2406
2420
  case "error" /* ERROR */:
@@ -2511,12 +2525,23 @@ var PRBEAgent = class _PRBEAgent {
2511
2525
  this.stopPolling();
2512
2526
  this.pollingTimer = setInterval(() => {
2513
2527
  void this.poll().then(() => {
2514
- if (this.trackedTicketIDs.length === 0) {
2528
+ if (this.trackedSessionIDs.length === 0) {
2515
2529
  this.stopPolling();
2516
2530
  }
2517
2531
  });
2518
2532
  }, this.config.pollingInterval);
2519
2533
  }
2534
+ // ---------- Session Resolution ----------
2535
+ async resolveSessions(sessionIDs) {
2536
+ const request = {
2537
+ agent_id: this.agentID,
2538
+ session_ids: sessionIDs
2539
+ };
2540
+ return this.post(
2541
+ "/api/agent/resolve-sessions",
2542
+ request
2543
+ );
2544
+ }
2520
2545
  // ---------- Networking ----------
2521
2546
  /**
2522
2547
  * Abort all in-flight fetch requests to prevent orphaned DNS lookups
@@ -2571,7 +2596,7 @@ var DEFAULT_PRBE_STATE = {
2571
2596
  completedInvestigations: [],
2572
2597
  activeCRs: [],
2573
2598
  completedCRs: [],
2574
- trackedTicketIDs: [],
2599
+ trackedSessionIDs: [],
2575
2600
  ticketInfo: [],
2576
2601
  hasActiveWork: false
2577
2602
  };
@@ -2615,7 +2640,7 @@ function serializePRBEState(state) {
2615
2640
  })),
2616
2641
  activeCRs: Array.from(state.activeCRs.values()).map(serializeCR),
2617
2642
  completedCRs: state.completedCRs.map(serializeCR),
2618
- trackedTicketIDs: state.trackedTicketIDs,
2643
+ trackedSessionIDs: state.trackedSessionIDs,
2619
2644
  ticketInfo: state.ticketInfo,
2620
2645
  hasActiveWork: state.hasActiveWork
2621
2646
  };