@trops/dash-core 0.1.49 → 0.1.50
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/electron/index.js +118 -6
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -528,6 +528,8 @@ const LLM_ABORT_REQUEST$1 = "llm-abort-request";
|
|
|
528
528
|
const LLM_LIST_CONNECTED_TOOLS$1 = "llm-list-connected-tools";
|
|
529
529
|
const LLM_CHECK_CLI_AVAILABLE$1 = "llm-check-cli-available";
|
|
530
530
|
const LLM_CLEAR_CLI_SESSION$1 = "llm-clear-cli-session";
|
|
531
|
+
const LLM_CLI_SESSION_STATUS$1 = "llm-cli-session-status";
|
|
532
|
+
const LLM_CLI_END_SESSION$1 = "llm-cli-end-session";
|
|
531
533
|
|
|
532
534
|
// --- Main → Renderer (send) ---
|
|
533
535
|
const LLM_STREAM_DELTA$3 = "llm-stream-delta";
|
|
@@ -547,6 +549,8 @@ var llmEvents$1 = {
|
|
|
547
549
|
LLM_STREAM_TOOL_RESULT: LLM_STREAM_TOOL_RESULT$3,
|
|
548
550
|
LLM_STREAM_COMPLETE: LLM_STREAM_COMPLETE$3,
|
|
549
551
|
LLM_STREAM_ERROR: LLM_STREAM_ERROR$3,
|
|
552
|
+
LLM_CLI_SESSION_STATUS: LLM_CLI_SESSION_STATUS$1,
|
|
553
|
+
LLM_CLI_END_SESSION: LLM_CLI_END_SESSION$1,
|
|
550
554
|
};
|
|
551
555
|
|
|
552
556
|
/**
|
|
@@ -6704,6 +6708,52 @@ const cliController$2 = {
|
|
|
6704
6708
|
}
|
|
6705
6709
|
return { success: false };
|
|
6706
6710
|
},
|
|
6711
|
+
|
|
6712
|
+
/**
|
|
6713
|
+
* getSessionStatus
|
|
6714
|
+
* Check if a CLI session exists and whether a process is active for a widget.
|
|
6715
|
+
*
|
|
6716
|
+
* @param {string} widgetUuid - the widget to check
|
|
6717
|
+
* @returns {{ hasSession: boolean, sessionId?: string, isProcessActive: boolean }}
|
|
6718
|
+
*/
|
|
6719
|
+
getSessionStatus: (widgetUuid) => {
|
|
6720
|
+
const sessionId = widgetUuid ? sessions.get(widgetUuid) : null;
|
|
6721
|
+
// Check if any active process belongs to this widget
|
|
6722
|
+
let isProcessActive = false;
|
|
6723
|
+
for (const [, child] of activeProcesses) {
|
|
6724
|
+
if (!child.killed) {
|
|
6725
|
+
isProcessActive = true;
|
|
6726
|
+
break;
|
|
6727
|
+
}
|
|
6728
|
+
}
|
|
6729
|
+
return {
|
|
6730
|
+
hasSession: !!sessionId,
|
|
6731
|
+
sessionId: sessionId || undefined,
|
|
6732
|
+
isProcessActive,
|
|
6733
|
+
};
|
|
6734
|
+
},
|
|
6735
|
+
|
|
6736
|
+
/**
|
|
6737
|
+
* endSession
|
|
6738
|
+
* Kill any active CLI process AND clear the session for a widget.
|
|
6739
|
+
*
|
|
6740
|
+
* @param {string} widgetUuid - the widget whose session to end
|
|
6741
|
+
* @returns {{ success: boolean }}
|
|
6742
|
+
*/
|
|
6743
|
+
endSession: (widgetUuid) => {
|
|
6744
|
+
// Kill any active processes for this widget
|
|
6745
|
+
for (const [reqId, child] of activeProcesses) {
|
|
6746
|
+
if (reqId.startsWith(widgetUuid)) {
|
|
6747
|
+
child.kill("SIGTERM");
|
|
6748
|
+
activeProcesses.delete(reqId);
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
// Clear the session
|
|
6752
|
+
if (widgetUuid && sessions.has(widgetUuid)) {
|
|
6753
|
+
sessions.delete(widgetUuid);
|
|
6754
|
+
}
|
|
6755
|
+
return { success: true };
|
|
6756
|
+
},
|
|
6707
6757
|
};
|
|
6708
6758
|
|
|
6709
6759
|
var cliController_1 = cliController$2;
|
|
@@ -8289,6 +8339,8 @@ const {
|
|
|
8289
8339
|
LLM_LIST_CONNECTED_TOOLS,
|
|
8290
8340
|
LLM_CHECK_CLI_AVAILABLE,
|
|
8291
8341
|
LLM_CLEAR_CLI_SESSION,
|
|
8342
|
+
LLM_CLI_SESSION_STATUS,
|
|
8343
|
+
LLM_CLI_END_SESSION,
|
|
8292
8344
|
LLM_STREAM_DELTA,
|
|
8293
8345
|
LLM_STREAM_TOOL_CALL,
|
|
8294
8346
|
LLM_STREAM_TOOL_RESULT,
|
|
@@ -8344,51 +8396,111 @@ const llmApi$2 = {
|
|
|
8344
8396
|
clearCliSession: (widgetUuid) =>
|
|
8345
8397
|
ipcRenderer$2.invoke(LLM_CLEAR_CLI_SESSION, { widgetUuid }),
|
|
8346
8398
|
|
|
8399
|
+
/**
|
|
8400
|
+
* getCliSessionStatus
|
|
8401
|
+
* Check if a CLI session is active for a widget.
|
|
8402
|
+
*
|
|
8403
|
+
* @param {string} widgetUuid - the widget to check
|
|
8404
|
+
* @returns {Promise<{ hasSession: boolean, sessionId?: string, isProcessActive: boolean }>}
|
|
8405
|
+
*/
|
|
8406
|
+
getCliSessionStatus: (widgetUuid) =>
|
|
8407
|
+
ipcRenderer$2.invoke(LLM_CLI_SESSION_STATUS, { widgetUuid }),
|
|
8408
|
+
|
|
8409
|
+
/**
|
|
8410
|
+
* endCliSession
|
|
8411
|
+
* Kill any active CLI process AND clear the session for a widget.
|
|
8412
|
+
*
|
|
8413
|
+
* @param {string} widgetUuid - the widget whose session to end
|
|
8414
|
+
* @returns {Promise<{ success: boolean }>}
|
|
8415
|
+
*/
|
|
8416
|
+
endCliSession: (widgetUuid) =>
|
|
8417
|
+
ipcRenderer$2.invoke(LLM_CLI_END_SESSION, { widgetUuid }),
|
|
8418
|
+
|
|
8347
8419
|
// --- Stream event listeners ---
|
|
8420
|
+
// Each on* method returns the wrapped callback so callers can remove
|
|
8421
|
+
// their own listener without nuking listeners from other widgets.
|
|
8348
8422
|
|
|
8349
8423
|
/**
|
|
8350
8424
|
* onStreamDelta
|
|
8351
8425
|
* Listen for text chunks as they stream in.
|
|
8426
|
+
* @returns {Function} wrapped callback for use with removeStreamListener
|
|
8352
8427
|
*/
|
|
8353
8428
|
onStreamDelta: (callback) => {
|
|
8354
|
-
|
|
8429
|
+
const wrapped = (_event, data) => callback(data);
|
|
8430
|
+
ipcRenderer$2.on(LLM_STREAM_DELTA, wrapped);
|
|
8431
|
+
return wrapped;
|
|
8355
8432
|
},
|
|
8356
8433
|
|
|
8357
8434
|
/**
|
|
8358
8435
|
* onStreamToolCall
|
|
8359
8436
|
* Listen for tool call notifications.
|
|
8437
|
+
* @returns {Function} wrapped callback for use with removeStreamListener
|
|
8360
8438
|
*/
|
|
8361
8439
|
onStreamToolCall: (callback) => {
|
|
8362
|
-
|
|
8440
|
+
const wrapped = (_event, data) => callback(data);
|
|
8441
|
+
ipcRenderer$2.on(LLM_STREAM_TOOL_CALL, wrapped);
|
|
8442
|
+
return wrapped;
|
|
8363
8443
|
},
|
|
8364
8444
|
|
|
8365
8445
|
/**
|
|
8366
8446
|
* onStreamToolResult
|
|
8367
8447
|
* Listen for tool result notifications.
|
|
8448
|
+
* @returns {Function} wrapped callback for use with removeStreamListener
|
|
8368
8449
|
*/
|
|
8369
8450
|
onStreamToolResult: (callback) => {
|
|
8370
|
-
|
|
8451
|
+
const wrapped = (_event, data) => callback(data);
|
|
8452
|
+
ipcRenderer$2.on(LLM_STREAM_TOOL_RESULT, wrapped);
|
|
8453
|
+
return wrapped;
|
|
8371
8454
|
},
|
|
8372
8455
|
|
|
8373
8456
|
/**
|
|
8374
8457
|
* onStreamComplete
|
|
8375
8458
|
* Listen for stream completion (final response).
|
|
8459
|
+
* @returns {Function} wrapped callback for use with removeStreamListener
|
|
8376
8460
|
*/
|
|
8377
8461
|
onStreamComplete: (callback) => {
|
|
8378
|
-
|
|
8462
|
+
const wrapped = (_event, data) => callback(data);
|
|
8463
|
+
ipcRenderer$2.on(LLM_STREAM_COMPLETE, wrapped);
|
|
8464
|
+
return wrapped;
|
|
8379
8465
|
},
|
|
8380
8466
|
|
|
8381
8467
|
/**
|
|
8382
8468
|
* onStreamError
|
|
8383
8469
|
* Listen for stream errors.
|
|
8470
|
+
* @returns {Function} wrapped callback for use with removeStreamListener
|
|
8384
8471
|
*/
|
|
8385
8472
|
onStreamError: (callback) => {
|
|
8386
|
-
|
|
8473
|
+
const wrapped = (_event, data) => callback(data);
|
|
8474
|
+
ipcRenderer$2.on(LLM_STREAM_ERROR, wrapped);
|
|
8475
|
+
return wrapped;
|
|
8476
|
+
},
|
|
8477
|
+
|
|
8478
|
+
/**
|
|
8479
|
+
* removeStreamListener
|
|
8480
|
+
* Remove a specific stream listener by channel and callback reference.
|
|
8481
|
+
*
|
|
8482
|
+
* @param {string} channel - the IPC channel name
|
|
8483
|
+
* @param {Function} wrapped - the callback returned by on*
|
|
8484
|
+
*/
|
|
8485
|
+
removeStreamListener: (channel, wrapped) => {
|
|
8486
|
+
ipcRenderer$2.removeListener(channel, wrapped);
|
|
8487
|
+
},
|
|
8488
|
+
|
|
8489
|
+
/**
|
|
8490
|
+
* Stream channel constants for use with removeStreamListener.
|
|
8491
|
+
*/
|
|
8492
|
+
streamChannels: {
|
|
8493
|
+
delta: LLM_STREAM_DELTA,
|
|
8494
|
+
toolCall: LLM_STREAM_TOOL_CALL,
|
|
8495
|
+
toolResult: LLM_STREAM_TOOL_RESULT,
|
|
8496
|
+
complete: LLM_STREAM_COMPLETE,
|
|
8497
|
+
error: LLM_STREAM_ERROR,
|
|
8387
8498
|
},
|
|
8388
8499
|
|
|
8389
8500
|
/**
|
|
8390
8501
|
* removeAllStreamListeners
|
|
8391
|
-
* Clean up
|
|
8502
|
+
* Clean up ALL LLM stream listeners (global).
|
|
8503
|
+
* Prefer removeStreamListener for scoped cleanup.
|
|
8392
8504
|
*/
|
|
8393
8505
|
removeAllStreamListeners: () => {
|
|
8394
8506
|
ipcRenderer$2.removeAllListeners(LLM_STREAM_DELTA);
|