@trops/dash-core 0.1.546 → 0.1.547
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 +117 -47
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -29742,6 +29742,8 @@ const menuItemsController$1 = {
|
|
|
29742
29742
|
|
|
29743
29743
|
var menuItemsController_1 = menuItemsController$1;
|
|
29744
29744
|
|
|
29745
|
+
var cliController$3 = {exports: {}};
|
|
29746
|
+
|
|
29745
29747
|
var mcp = {};
|
|
29746
29748
|
|
|
29747
29749
|
var server$1 = {};
|
|
@@ -50366,6 +50368,78 @@ function safeSend(win, channel, data) {
|
|
|
50366
50368
|
}
|
|
50367
50369
|
}
|
|
50368
50370
|
|
|
50371
|
+
/**
|
|
50372
|
+
* Build the argv array for spawning the Claude Code CLI.
|
|
50373
|
+
*
|
|
50374
|
+
* Pure / no I/O — extracted as a top-level helper so it can be unit-
|
|
50375
|
+
* tested without spawning a child process.
|
|
50376
|
+
*
|
|
50377
|
+
* Defaults preserve AssistantPanel behavior: system prompt is APPENDED
|
|
50378
|
+
* to Claude Code's default (so the AI still sees its tool / MCP /
|
|
50379
|
+
* skill preamble) and built-in tools stay available. The widget
|
|
50380
|
+
* builder modal opts into a stricter mode by passing both
|
|
50381
|
+
* `replaceSystemPrompt: true` (replace the default rather than append
|
|
50382
|
+
* — strips the tool / skill preamble) and `disableTools: true` (deny
|
|
50383
|
+
* all built-in tools so the AI cannot invoke Skill / Bash / Read /
|
|
50384
|
+
* Glob / etc.).
|
|
50385
|
+
*
|
|
50386
|
+
* @param {object} opts
|
|
50387
|
+
* @param {string=} opts.model
|
|
50388
|
+
* @param {string=} opts.systemPrompt
|
|
50389
|
+
* @param {string=} opts.sessionId
|
|
50390
|
+
* @param {boolean=} opts.replaceSystemPrompt
|
|
50391
|
+
* @param {boolean=} opts.disableTools
|
|
50392
|
+
* @returns {string[]}
|
|
50393
|
+
*/
|
|
50394
|
+
function buildClaudeCliArgs({
|
|
50395
|
+
model,
|
|
50396
|
+
systemPrompt,
|
|
50397
|
+
sessionId,
|
|
50398
|
+
replaceSystemPrompt = false,
|
|
50399
|
+
disableTools = false,
|
|
50400
|
+
} = {}) {
|
|
50401
|
+
const args = [
|
|
50402
|
+
"-p",
|
|
50403
|
+
"--disable-slash-commands",
|
|
50404
|
+
"--permission-mode",
|
|
50405
|
+
"bypassPermissions",
|
|
50406
|
+
"--output-format",
|
|
50407
|
+
"stream-json",
|
|
50408
|
+
"--verbose",
|
|
50409
|
+
];
|
|
50410
|
+
|
|
50411
|
+
if (disableTools) {
|
|
50412
|
+
// Empty-string value documented in `claude --help` as "disable
|
|
50413
|
+
// all tools". Catches Skill / Bash / Read / Glob / Grep / Edit /
|
|
50414
|
+
// Write — every built-in tool the AI might otherwise invoke from
|
|
50415
|
+
// inside the modal where only text + code-block output is wanted.
|
|
50416
|
+
args.push("--tools", "");
|
|
50417
|
+
}
|
|
50418
|
+
|
|
50419
|
+
if (model) {
|
|
50420
|
+
args.push("--model", model);
|
|
50421
|
+
}
|
|
50422
|
+
|
|
50423
|
+
if (systemPrompt) {
|
|
50424
|
+
// --system-prompt REPLACES the default Claude Code preamble (the
|
|
50425
|
+
// one that introduces tools and auto-loads project skills by
|
|
50426
|
+
// description match). --append-system-prompt KEEPS the default
|
|
50427
|
+
// and adds ours below — fine for the assistant panel where MCP
|
|
50428
|
+
// tools are wanted, wrong for the widget builder modal where
|
|
50429
|
+
// any tool advertisement undermines the no-tools rule.
|
|
50430
|
+
args.push(
|
|
50431
|
+
replaceSystemPrompt ? "--system-prompt" : "--append-system-prompt",
|
|
50432
|
+
systemPrompt,
|
|
50433
|
+
);
|
|
50434
|
+
}
|
|
50435
|
+
|
|
50436
|
+
if (sessionId) {
|
|
50437
|
+
args.push("--resume", sessionId);
|
|
50438
|
+
}
|
|
50439
|
+
|
|
50440
|
+
return args;
|
|
50441
|
+
}
|
|
50442
|
+
|
|
50369
50443
|
const cliController$2 = {
|
|
50370
50444
|
/**
|
|
50371
50445
|
* isAvailable
|
|
@@ -50390,7 +50464,15 @@ const cliController$2 = {
|
|
|
50390
50464
|
* @param {object} params - { model, messages, systemPrompt, maxToolRounds, widgetUuid }
|
|
50391
50465
|
*/
|
|
50392
50466
|
sendMessage: async (win, requestId, params) => {
|
|
50393
|
-
const {
|
|
50467
|
+
const {
|
|
50468
|
+
model,
|
|
50469
|
+
messages,
|
|
50470
|
+
systemPrompt,
|
|
50471
|
+
widgetUuid,
|
|
50472
|
+
cwd,
|
|
50473
|
+
replaceSystemPrompt = false,
|
|
50474
|
+
disableTools = false,
|
|
50475
|
+
} = params;
|
|
50394
50476
|
|
|
50395
50477
|
const binaryPath = resolveCliBinary();
|
|
50396
50478
|
if (!binaryPath) {
|
|
@@ -50403,34 +50485,23 @@ const cliController$2 = {
|
|
|
50403
50485
|
return;
|
|
50404
50486
|
}
|
|
50405
50487
|
|
|
50406
|
-
// Build CLI args.
|
|
50407
|
-
//
|
|
50408
|
-
//
|
|
50409
|
-
//
|
|
50410
|
-
//
|
|
50411
|
-
// that skill's content even when the host app's system prompt says not
|
|
50412
|
-
// to — causing long reasoning loops or silent hangs. We pass only the
|
|
50413
|
-
// caller's `systemPrompt` as context.
|
|
50488
|
+
// Build CLI args via the pure helper (see top of file). Defaults
|
|
50489
|
+
// preserve the AssistantPanel behavior (append-system-prompt,
|
|
50490
|
+
// tools available, MCP wired). The widget builder modal opts
|
|
50491
|
+
// into `replaceSystemPrompt + disableTools` to lock the AI to
|
|
50492
|
+
// text + code-block output with no tool invocations.
|
|
50414
50493
|
//
|
|
50415
|
-
//
|
|
50416
|
-
//
|
|
50417
|
-
//
|
|
50418
|
-
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
|
|
50424
|
-
|
|
50425
|
-
|
|
50426
|
-
"-p",
|
|
50427
|
-
"--disable-slash-commands",
|
|
50428
|
-
"--permission-mode",
|
|
50429
|
-
"bypassPermissions",
|
|
50430
|
-
"--output-format",
|
|
50431
|
-
"stream-json",
|
|
50432
|
-
"--verbose",
|
|
50433
|
-
];
|
|
50494
|
+
// The model + systemPrompt + sessionId pieces are added inside
|
|
50495
|
+
// buildClaudeCliArgs; below we only add args that depend on
|
|
50496
|
+
// runtime state (MCP config file paths) the helper can't know.
|
|
50497
|
+
const sessionIdForResume = widgetUuid ? sessions.get(widgetUuid) : null;
|
|
50498
|
+
const args = buildClaudeCliArgs({
|
|
50499
|
+
model,
|
|
50500
|
+
systemPrompt,
|
|
50501
|
+
sessionId: sessionIdForResume,
|
|
50502
|
+
replaceSystemPrompt,
|
|
50503
|
+
disableTools,
|
|
50504
|
+
});
|
|
50434
50505
|
|
|
50435
50506
|
// Auto-wire the hosted Dash MCP server so the assistant can use Dash
|
|
50436
50507
|
// tools (apply_theme, create_dashboard, add_widget, etc.) without
|
|
@@ -50454,9 +50525,15 @@ const cliController$2 = {
|
|
|
50454
50525
|
// works for non-Dash queries, and the setup banner remains visible
|
|
50455
50526
|
// as a manual fallback.
|
|
50456
50527
|
let mcpConfigFilePath = null;
|
|
50528
|
+
// Skip MCP wiring entirely when the caller has asked for a
|
|
50529
|
+
// tool-free invocation. There's no point loading remote tools
|
|
50530
|
+
// the AI cannot call, and avoiding the temp-file write keeps
|
|
50531
|
+
// the lockdown mode side-effect-free.
|
|
50457
50532
|
try {
|
|
50458
50533
|
const mcpDashServerController = mcpDashServerController_1;
|
|
50459
|
-
const status =
|
|
50534
|
+
const status = disableTools
|
|
50535
|
+
? null
|
|
50536
|
+
: mcpDashServerController.getStatus?.(win);
|
|
50460
50537
|
if (status?.running) {
|
|
50461
50538
|
const token = mcpDashServerController.getOrCreateToken?.(win);
|
|
50462
50539
|
if (token) {
|
|
@@ -50511,20 +50588,6 @@ const cliController$2 = {
|
|
|
50511
50588
|
mcpConfigFilePath = null;
|
|
50512
50589
|
};
|
|
50513
50590
|
|
|
50514
|
-
if (model) {
|
|
50515
|
-
args.push("--model", model);
|
|
50516
|
-
}
|
|
50517
|
-
|
|
50518
|
-
if (systemPrompt) {
|
|
50519
|
-
args.push("--append-system-prompt", systemPrompt);
|
|
50520
|
-
}
|
|
50521
|
-
|
|
50522
|
-
// Resume existing session for conversation continuity
|
|
50523
|
-
const sessionId = widgetUuid ? sessions.get(widgetUuid) : null;
|
|
50524
|
-
if (sessionId) {
|
|
50525
|
-
args.push("--resume", sessionId);
|
|
50526
|
-
}
|
|
50527
|
-
|
|
50528
50591
|
// Extract the user message (last user message in the array)
|
|
50529
50592
|
const lastUserMsg = [...messages].reverse().find((m) => m.role === "user");
|
|
50530
50593
|
const userText =
|
|
@@ -50754,7 +50817,11 @@ const cliController$2 = {
|
|
|
50754
50817
|
|
|
50755
50818
|
if (code !== 0 && code !== null) {
|
|
50756
50819
|
// Check if resume failed and retry without it
|
|
50757
|
-
if (
|
|
50820
|
+
if (
|
|
50821
|
+
sessionIdForResume &&
|
|
50822
|
+
!retried &&
|
|
50823
|
+
stderrBuffer.includes("session")
|
|
50824
|
+
) {
|
|
50758
50825
|
retried = true;
|
|
50759
50826
|
if (widgetUuid) sessions.delete(widgetUuid);
|
|
50760
50827
|
// Retry without --resume
|
|
@@ -50877,7 +50944,10 @@ const cliController$2 = {
|
|
|
50877
50944
|
},
|
|
50878
50945
|
};
|
|
50879
50946
|
|
|
50880
|
-
|
|
50947
|
+
cliController$3.exports = cliController$2;
|
|
50948
|
+
cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
|
|
50949
|
+
|
|
50950
|
+
var cliControllerExports = cliController$3.exports;
|
|
50881
50951
|
|
|
50882
50952
|
/**
|
|
50883
50953
|
* toolDefinitions.js
|
|
@@ -56092,7 +56162,7 @@ var toolHandlers$1 = {
|
|
|
56092
56162
|
|
|
56093
56163
|
const Anthropic = require$$0$b;
|
|
56094
56164
|
const mcpController$2 = mcpControllerExports;
|
|
56095
|
-
const cliController$1 =
|
|
56165
|
+
const cliController$1 = cliControllerExports;
|
|
56096
56166
|
const toolDefinitions = toolDefinitions$1;
|
|
56097
56167
|
const toolHandlers = toolHandlers$1;
|
|
56098
56168
|
const {
|
|
@@ -68067,7 +68137,7 @@ const algoliaController = algoliaController_1;
|
|
|
68067
68137
|
const openaiController = openaiController_1;
|
|
68068
68138
|
const menuItemsController = menuItemsController_1;
|
|
68069
68139
|
const llmController = llmController_1;
|
|
68070
|
-
const cliController =
|
|
68140
|
+
const cliController = cliControllerExports;
|
|
68071
68141
|
const dashboardConfigController = dashboardConfigController$1;
|
|
68072
68142
|
const registryAuthController = registryAuthController$2;
|
|
68073
68143
|
const registryApiController = registryApiController$3;
|