@rdmind/rdmind 0.1.8-alpha.10 → 0.1.8-alpha.11
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/cli.js +2142 -1800
- package/locales/en.js +90 -191
- package/locales/zh.js +102 -213
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -141204,10 +141204,18 @@ var init_pipeline = __esm({
|
|
|
141204
141204
|
userPromptId,
|
|
141205
141205
|
false,
|
|
141206
141206
|
async (openaiRequest) => {
|
|
141207
|
+
const extraBody = this.contentGeneratorConfig.model?.toLowerCase().includes("glm-4.7") ? {
|
|
141208
|
+
thinking: {
|
|
141209
|
+
type: "enabled",
|
|
141210
|
+
clear_thinking: false
|
|
141211
|
+
// Enable preserved/interleaved thinking
|
|
141212
|
+
}
|
|
141213
|
+
} : void 0;
|
|
141207
141214
|
const openaiResponse = await this.client.chat.completions.create(
|
|
141208
141215
|
openaiRequest,
|
|
141209
141216
|
{
|
|
141210
|
-
signal: request4.config?.abortSignal
|
|
141217
|
+
signal: request4.config?.abortSignal,
|
|
141218
|
+
...extraBody ? { extra_body: extraBody } : {}
|
|
141211
141219
|
}
|
|
141212
141220
|
);
|
|
141213
141221
|
const geminiResponse = this.converter.convertOpenAIResponseToGemini(openaiResponse);
|
|
@@ -141221,10 +141229,18 @@ var init_pipeline = __esm({
|
|
|
141221
141229
|
userPromptId,
|
|
141222
141230
|
true,
|
|
141223
141231
|
async (openaiRequest, context2) => {
|
|
141232
|
+
const extraBody = this.contentGeneratorConfig.model?.toLowerCase().includes("glm-4.7") ? {
|
|
141233
|
+
thinking: {
|
|
141234
|
+
type: "enabled",
|
|
141235
|
+
clear_thinking: false
|
|
141236
|
+
// Enable preserved/interleaved thinking
|
|
141237
|
+
}
|
|
141238
|
+
} : void 0;
|
|
141224
141239
|
const stream2 = await this.client.chat.completions.create(
|
|
141225
141240
|
openaiRequest,
|
|
141226
141241
|
{
|
|
141227
|
-
signal: request4.config?.abortSignal
|
|
141242
|
+
signal: request4.config?.abortSignal,
|
|
141243
|
+
...extraBody ? { extra_body: extraBody } : {}
|
|
141228
141244
|
}
|
|
141229
141245
|
);
|
|
141230
141246
|
return this.processStreamWithLogging(stream2, context2, request4);
|
|
@@ -156072,7 +156088,7 @@ __export(geminiContentGenerator_exports2, {
|
|
|
156072
156088
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
156073
156089
|
});
|
|
156074
156090
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
156075
|
-
const version2 = "0.1.8-alpha.
|
|
156091
|
+
const version2 = "0.1.8-alpha.11";
|
|
156076
156092
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
156077
156093
|
const baseHeaders = {
|
|
156078
156094
|
"User-Agent": userAgent2
|
|
@@ -233717,8 +233733,8 @@ var init_git_commit = __esm({
|
|
|
233717
233733
|
"packages/core/src/generated/git-commit.ts"() {
|
|
233718
233734
|
"use strict";
|
|
233719
233735
|
init_esbuild_shims();
|
|
233720
|
-
GIT_COMMIT_INFO = "
|
|
233721
|
-
CLI_VERSION = "0.1.8-alpha.
|
|
233736
|
+
GIT_COMMIT_INFO = "0d78b913";
|
|
233737
|
+
CLI_VERSION = "0.1.8-alpha.11";
|
|
233722
233738
|
}
|
|
233723
233739
|
});
|
|
233724
233740
|
|
|
@@ -304859,6 +304875,7 @@ var init_en3 = __esm({
|
|
|
304859
304875
|
"(Use Enter to select{{tabText}})": "(Use Enter to select{{tabText}})",
|
|
304860
304876
|
", Tab to change focus": ", Tab to change focus",
|
|
304861
304877
|
"To see changes, RDMind must be restarted. Press r to exit and apply changes now.": "To see changes, RDMind must be restarted. Press r to exit and apply changes now.",
|
|
304878
|
+
'The command "/{{command}}" is not supported in non-interactive mode.': 'The command "/{{command}}" is not supported in non-interactive mode.',
|
|
304862
304879
|
// ============================================================================
|
|
304863
304880
|
// Settings Labels
|
|
304864
304881
|
// ============================================================================
|
|
@@ -305090,6 +305107,10 @@ var init_en3 = __esm({
|
|
|
305090
305107
|
"Already generating summary, wait for previous request to complete": "Already generating summary, wait for previous request to complete",
|
|
305091
305108
|
"No conversation found to summarize.": "No conversation found to summarize.",
|
|
305092
305109
|
"Failed to generate project context summary: {{error}}": "Failed to generate project context summary: {{error}}",
|
|
305110
|
+
"Saved project summary to {{filePathForDisplay}}.": "Saved project summary to {{filePathForDisplay}}.",
|
|
305111
|
+
"Saving project summary...": "Saving project summary...",
|
|
305112
|
+
"Generating project summary...": "Generating project summary...",
|
|
305113
|
+
"Failed to generate summary - no text content received from LLM response": "Failed to generate summary - no text content received from LLM response",
|
|
305093
305114
|
// ============================================================================
|
|
305094
305115
|
// Commands - Model
|
|
305095
305116
|
// ============================================================================
|
|
@@ -305100,8 +305121,8 @@ var init_en3 = __esm({
|
|
|
305100
305121
|
// ============================================================================
|
|
305101
305122
|
// Commands - Clear
|
|
305102
305123
|
// ============================================================================
|
|
305103
|
-
"
|
|
305104
|
-
"
|
|
305124
|
+
"Starting a new session, resetting chat, and clearing terminal.": "Starting a new session, resetting chat, and clearing terminal.",
|
|
305125
|
+
"Starting a new session and clearing.": "Starting a new session and clearing.",
|
|
305105
305126
|
// ============================================================================
|
|
305106
305127
|
// Commands - Compress
|
|
305107
305128
|
// ============================================================================
|
|
@@ -305365,183 +305386,142 @@ var init_en3 = __esm({
|
|
|
305365
305386
|
// ============================================================================
|
|
305366
305387
|
"Waiting for user confirmation...": "Waiting for user confirmation...",
|
|
305367
305388
|
"(esc to cancel, {{time}})": "(esc to cancel, {{time}})",
|
|
305368
|
-
|
|
305369
|
-
|
|
305370
|
-
|
|
305371
|
-
|
|
305372
|
-
|
|
305373
|
-
|
|
305374
|
-
|
|
305375
|
-
|
|
305376
|
-
|
|
305377
|
-
|
|
305378
|
-
|
|
305379
|
-
|
|
305380
|
-
|
|
305381
|
-
|
|
305382
|
-
|
|
305383
|
-
|
|
305384
|
-
|
|
305385
|
-
|
|
305386
|
-
|
|
305387
|
-
|
|
305388
|
-
|
|
305389
|
-
|
|
305390
|
-
|
|
305391
|
-
|
|
305392
|
-
|
|
305393
|
-
|
|
305394
|
-
|
|
305395
|
-
|
|
305396
|
-
|
|
305397
|
-
|
|
305398
|
-
|
|
305399
|
-
|
|
305400
|
-
|
|
305401
|
-
|
|
305402
|
-
|
|
305403
|
-
|
|
305404
|
-
|
|
305405
|
-
|
|
305406
|
-
|
|
305407
|
-
|
|
305408
|
-
|
|
305409
|
-
|
|
305410
|
-
|
|
305411
|
-
|
|
305412
|
-
|
|
305413
|
-
|
|
305414
|
-
|
|
305415
|
-
|
|
305416
|
-
|
|
305417
|
-
|
|
305418
|
-
|
|
305419
|
-
|
|
305420
|
-
|
|
305421
|
-
|
|
305422
|
-
|
|
305423
|
-
|
|
305424
|
-
|
|
305425
|
-
|
|
305426
|
-
|
|
305427
|
-
|
|
305428
|
-
|
|
305429
|
-
|
|
305430
|
-
|
|
305431
|
-
|
|
305432
|
-
|
|
305433
|
-
|
|
305434
|
-
|
|
305435
|
-
|
|
305436
|
-
|
|
305437
|
-
|
|
305438
|
-
|
|
305439
|
-
|
|
305440
|
-
|
|
305441
|
-
|
|
305442
|
-
|
|
305443
|
-
|
|
305444
|
-
|
|
305445
|
-
|
|
305446
|
-
|
|
305447
|
-
|
|
305448
|
-
|
|
305449
|
-
|
|
305450
|
-
|
|
305451
|
-
|
|
305452
|
-
|
|
305453
|
-
|
|
305454
|
-
|
|
305455
|
-
|
|
305456
|
-
|
|
305457
|
-
|
|
305458
|
-
|
|
305459
|
-
|
|
305460
|
-
|
|
305461
|
-
|
|
305462
|
-
|
|
305463
|
-
|
|
305464
|
-
|
|
305465
|
-
|
|
305466
|
-
|
|
305467
|
-
|
|
305468
|
-
|
|
305469
|
-
|
|
305470
|
-
|
|
305471
|
-
|
|
305472
|
-
|
|
305473
|
-
|
|
305474
|
-
|
|
305475
|
-
|
|
305476
|
-
|
|
305477
|
-
|
|
305478
|
-
|
|
305479
|
-
|
|
305480
|
-
|
|
305481
|
-
|
|
305482
|
-
|
|
305483
|
-
|
|
305484
|
-
|
|
305485
|
-
|
|
305486
|
-
|
|
305487
|
-
|
|
305488
|
-
|
|
305489
|
-
|
|
305490
|
-
|
|
305491
|
-
|
|
305492
|
-
|
|
305493
|
-
|
|
305494
|
-
|
|
305495
|
-
|
|
305496
|
-
|
|
305497
|
-
|
|
305498
|
-
|
|
305499
|
-
|
|
305500
|
-
|
|
305501
|
-
|
|
305502
|
-
|
|
305503
|
-
|
|
305504
|
-
"Praying for no bugs...": "Praying for no bugs...",
|
|
305505
|
-
"Resolving dependencies...": "Resolving dependencies...",
|
|
305506
|
-
"Waiting for product manager to change requirements...": "Waiting for product manager to change requirements...",
|
|
305507
|
-
"Postponing project deadline...": "Postponing project deadline...",
|
|
305508
|
-
'Preparing another "almost done"...': 'Preparing another "almost done"...',
|
|
305509
|
-
"Taking a break...": "Taking a break...",
|
|
305510
|
-
"Making goji berry tea...": "Making goji berry tea...",
|
|
305511
|
-
"Ordering takeout...": "Ordering takeout...",
|
|
305512
|
-
"Pretending to be busy...": "Pretending to be busy...",
|
|
305513
|
-
"Recharging faith...": "Recharging faith...",
|
|
305514
|
-
"Downloading more RAM...": "Downloading more RAM...",
|
|
305515
|
-
"Feeding the server...": "Feeding the server...",
|
|
305516
|
-
"Waking up sleeping code...": "Waking up sleeping code...",
|
|
305517
|
-
"Feeding data to AI...": "Feeding data to AI...",
|
|
305518
|
-
"Opening imagination...": "Opening imagination...",
|
|
305519
|
-
"Boiling water for tea...": "Boiling water for tea...",
|
|
305520
|
-
"Waiting for the elevator...": "Waiting for the elevator...",
|
|
305521
|
-
"Taking a number in queue...": "Taking a number in queue...",
|
|
305522
|
-
"Waiting for traffic light...": "Waiting for traffic light...",
|
|
305523
|
-
"Charging...": "Charging...",
|
|
305524
|
-
"Buffering life...": "Buffering life...",
|
|
305525
|
-
"Contemplating the meaning of life...": "Contemplating the meaning of life...",
|
|
305526
|
-
"What to eat today? Thinking...": "What to eat today? Thinking...",
|
|
305527
|
-
"Pretending to work...": "Pretending to work...",
|
|
305528
|
-
"Let me think, just a moment...": "Let me think, just a moment...",
|
|
305529
|
-
"Brewing inspiration...": "Brewing inspiration...",
|
|
305530
|
-
"Take a deep breath, almost done...": "Take a deep breath, almost done...",
|
|
305531
|
-
"Don't worry, good things take time...": "Don't worry, good things take time...",
|
|
305532
|
-
"Stay calm, exciting things coming...": "Stay calm, exciting things coming...",
|
|
305533
|
-
"Greeting the server...": "Greeting the server...",
|
|
305534
|
-
"Organizing thoughts...": "Organizing thoughts...",
|
|
305535
|
-
"Preparing my words...": "Preparing my words...",
|
|
305536
|
-
"Looking up information...": "Looking up information...",
|
|
305537
|
-
"Sorting out my thoughts...": "Sorting out my thoughts...",
|
|
305538
|
-
"Analyzing the problem...": "Analyzing the problem...",
|
|
305539
|
-
"Looking for the best solution...": "Looking for the best solution...",
|
|
305540
|
-
"Loading...": "Loading...",
|
|
305541
|
-
"Processing, please wait...": "Processing, please wait...",
|
|
305542
|
-
"Almost there...": "Almost there...",
|
|
305543
|
-
"Working hard...": "Working hard...",
|
|
305544
|
-
"Almost... almost...": "Almost... almost...",
|
|
305389
|
+
// ============================================================================
|
|
305390
|
+
// Loading Phrases
|
|
305391
|
+
// ============================================================================
|
|
305392
|
+
WITTY_LOADING_PHRASES: [
|
|
305393
|
+
"I'm Feeling Lucky",
|
|
305394
|
+
"Shipping awesomeness... ",
|
|
305395
|
+
"Painting the serifs back on...",
|
|
305396
|
+
"Navigating the slime mold...",
|
|
305397
|
+
"Consulting the digital spirits...",
|
|
305398
|
+
"Reticulating splines...",
|
|
305399
|
+
"Warming up the AI hamsters...",
|
|
305400
|
+
"Asking the magic conch shell...",
|
|
305401
|
+
"Generating witty retort...",
|
|
305402
|
+
"Polishing the algorithms...",
|
|
305403
|
+
"Don't rush perfection (or my code)...",
|
|
305404
|
+
"Brewing fresh bytes...",
|
|
305405
|
+
"Counting electrons...",
|
|
305406
|
+
"Engaging cognitive processors...",
|
|
305407
|
+
"Checking for syntax errors in the universe...",
|
|
305408
|
+
"One moment, optimizing humor...",
|
|
305409
|
+
"Shuffling punchlines...",
|
|
305410
|
+
"Untangling neural nets...",
|
|
305411
|
+
"Compiling brilliance...",
|
|
305412
|
+
"Loading wit.exe...",
|
|
305413
|
+
"Summoning the cloud of wisdom...",
|
|
305414
|
+
"Preparing a witty response...",
|
|
305415
|
+
"Just a sec, I'm debugging reality...",
|
|
305416
|
+
"Confuzzling the options...",
|
|
305417
|
+
"Tuning the cosmic frequencies...",
|
|
305418
|
+
"Crafting a response worthy of your patience...",
|
|
305419
|
+
"Compiling the 1s and 0s...",
|
|
305420
|
+
"Resolving dependencies... and existential crises...",
|
|
305421
|
+
"Defragmenting memories... both RAM and personal...",
|
|
305422
|
+
"Rebooting the humor module...",
|
|
305423
|
+
"Caching the essentials (mostly cat memes)...",
|
|
305424
|
+
"Optimizing for ludicrous speed",
|
|
305425
|
+
"Swapping bits... don't tell the bytes...",
|
|
305426
|
+
"Garbage collecting... be right back...",
|
|
305427
|
+
"Assembling the interwebs...",
|
|
305428
|
+
"Converting coffee into code...",
|
|
305429
|
+
"Updating the syntax for reality...",
|
|
305430
|
+
"Rewiring the synapses...",
|
|
305431
|
+
"Looking for a misplaced semicolon...",
|
|
305432
|
+
"Greasin' the cogs of the machine...",
|
|
305433
|
+
"Pre-heating the servers...",
|
|
305434
|
+
"Calibrating the flux capacitor...",
|
|
305435
|
+
"Engaging the improbability drive...",
|
|
305436
|
+
"Channeling the Force...",
|
|
305437
|
+
"Aligning the stars for optimal response...",
|
|
305438
|
+
"So say we all...",
|
|
305439
|
+
"Loading the next great idea...",
|
|
305440
|
+
"Just a moment, I'm in the zone...",
|
|
305441
|
+
"Preparing to dazzle you with brilliance...",
|
|
305442
|
+
"Just a tick, I'm polishing my wit...",
|
|
305443
|
+
"Hold tight, I'm crafting a masterpiece...",
|
|
305444
|
+
"Just a jiffy, I'm debugging the universe...",
|
|
305445
|
+
"Just a moment, I'm aligning the pixels...",
|
|
305446
|
+
"Just a sec, I'm optimizing the humor...",
|
|
305447
|
+
"Just a moment, I'm tuning the algorithms...",
|
|
305448
|
+
"Warp speed engaged...",
|
|
305449
|
+
"Mining for more Dilithium crystals...",
|
|
305450
|
+
"Don't panic...",
|
|
305451
|
+
"Following the white rabbit...",
|
|
305452
|
+
"The truth is in here... somewhere...",
|
|
305453
|
+
"Blowing on the cartridge...",
|
|
305454
|
+
"Loading... Do a barrel roll!",
|
|
305455
|
+
"Waiting for the respawn...",
|
|
305456
|
+
"Finishing the Kessel Run in less than 12 parsecs...",
|
|
305457
|
+
"The cake is not a lie, it's just still loading...",
|
|
305458
|
+
"Fiddling with the character creation screen...",
|
|
305459
|
+
"Just a moment, I'm finding the right meme...",
|
|
305460
|
+
"Pressing 'A' to continue...",
|
|
305461
|
+
"Herding digital cats...",
|
|
305462
|
+
"Polishing the pixels...",
|
|
305463
|
+
"Finding a suitable loading screen pun...",
|
|
305464
|
+
"Distracting you with this witty phrase...",
|
|
305465
|
+
"Almost there... probably...",
|
|
305466
|
+
"Our hamsters are working as fast as they can...",
|
|
305467
|
+
"Giving Cloudy a pat on the head...",
|
|
305468
|
+
"Petting the cat...",
|
|
305469
|
+
"Rickrolling my boss...",
|
|
305470
|
+
"Never gonna give you up, never gonna let you down...",
|
|
305471
|
+
"Slapping the bass...",
|
|
305472
|
+
"Tasting the snozberries...",
|
|
305473
|
+
"I'm going the distance, I'm going for speed...",
|
|
305474
|
+
"Is this the real life? Is this just fantasy?...",
|
|
305475
|
+
"I've got a good feeling about this...",
|
|
305476
|
+
"Poking the bear...",
|
|
305477
|
+
"Doing research on the latest memes...",
|
|
305478
|
+
"Figuring out how to make this more witty...",
|
|
305479
|
+
"Hmmm... let me think...",
|
|
305480
|
+
"What do you call a fish with no eyes? A fsh...",
|
|
305481
|
+
"Why did the computer go to therapy? It had too many bytes...",
|
|
305482
|
+
"Why don't programmers like nature? It has too many bugs...",
|
|
305483
|
+
"Why do programmers prefer dark mode? Because light attracts bugs...",
|
|
305484
|
+
"Why did the developer go broke? Because they used up all their cache...",
|
|
305485
|
+
"What can you do with a broken pencil? Nothing, it's pointless...",
|
|
305486
|
+
"Applying percussive maintenance...",
|
|
305487
|
+
"Searching for the correct USB orientation...",
|
|
305488
|
+
"Ensuring the magic smoke stays inside the wires...",
|
|
305489
|
+
"Rewriting in Rust for no particular reason...",
|
|
305490
|
+
"Trying to exit Vim...",
|
|
305491
|
+
"Spinning up the hamster wheel...",
|
|
305492
|
+
"That's not a bug, it's an undocumented feature...",
|
|
305493
|
+
"Engage.",
|
|
305494
|
+
"I'll be back... with an answer.",
|
|
305495
|
+
"My other process is a TARDIS...",
|
|
305496
|
+
"Communing with the machine spirit...",
|
|
305497
|
+
"Letting the thoughts marinate...",
|
|
305498
|
+
"Just remembered where I put my keys...",
|
|
305499
|
+
"Pondering the orb...",
|
|
305500
|
+
"I've seen things you people wouldn't believe... like a user who reads loading messages.",
|
|
305501
|
+
"Initiating thoughtful gaze...",
|
|
305502
|
+
"What's a computer's favorite snack? Microchips.",
|
|
305503
|
+
"Why do Java developers wear glasses? Because they don't C#.",
|
|
305504
|
+
"Charging the laser... pew pew!",
|
|
305505
|
+
"Dividing by zero... just kidding!",
|
|
305506
|
+
"Looking for an adult superviso... I mean, processing.",
|
|
305507
|
+
"Making it go beep boop.",
|
|
305508
|
+
"Buffering... because even AIs need a moment.",
|
|
305509
|
+
"Entangling quantum particles for a faster response...",
|
|
305510
|
+
"Polishing the chrome... on the algorithms.",
|
|
305511
|
+
"Are you not entertained? (Working on it!)",
|
|
305512
|
+
"Summoning the code gremlins... to help, of course.",
|
|
305513
|
+
"Just waiting for the dial-up tone to finish...",
|
|
305514
|
+
"Recalibrating the humor-o-meter.",
|
|
305515
|
+
"My other loading screen is even funnier.",
|
|
305516
|
+
"Pretty sure there's a cat walking on the keyboard somewhere...",
|
|
305517
|
+
"Enhancing... Enhancing... Still loading.",
|
|
305518
|
+
"It's not a bug, it's a feature... of this loading screen.",
|
|
305519
|
+
"Have you tried turning it off and on again? (The loading screen, not me.)",
|
|
305520
|
+
"Constructing additional pylons..."
|
|
305521
|
+
],
|
|
305522
|
+
// ============================================================================
|
|
305523
|
+
// OpenSpec Commands
|
|
305524
|
+
// ============================================================================
|
|
305545
305525
|
"Initialize OpenSpec in a project with RDMind integration": "Initialize OpenSpec in a project with RDMind integration",
|
|
305546
305526
|
"Initialize OpenSpec in the current directory": "Initialize OpenSpec in the current directory",
|
|
305547
305527
|
"Scaffold a new OpenSpec change and validate strictly.": "Scaffold a new OpenSpec change and validate strictly.",
|
|
@@ -305647,7 +305627,7 @@ var init_zh = __esm({
|
|
|
305647
305627
|
"(empty prompt)": "(\u7A7A\u63D0\u793A\u8BCD)",
|
|
305648
305628
|
"No sessions found. Start a new session with {{cmd}}.": "\u672A\u53D1\u73B0\u4F1A\u8BDD\u3002\u8BF7\u4F7F\u7528 {{cmd}} \u5F00\u59CB\u65B0\u4F1A\u8BDD\u3002",
|
|
305649
305629
|
"No saved session found with ID {{sessionId}}. Run `rdmind --resume` without an ID to choose from existing sessions.": "\u672A\u53D1\u73B0 ID \u4E3A {{sessionId}} \u7684\u5DF2\u4FDD\u5B58\u4F1A\u8BDD\u3002\u8BF7\u8FD0\u884C\u4E0D\u5E26 ID \u7684 `rdmind --resume` \u4EE5\u4ECE\u73B0\u6709\u4F1A\u8BDD\u4E2D\u9009\u62E9\u3002",
|
|
305650
|
-
"Clear conversation history and free up context": "\u6E05\u9664\u5BF9\u8BDD\u5386\u53F2",
|
|
305630
|
+
"Clear conversation history and free up context": "\u6E05\u9664\u5BF9\u8BDD\u5386\u53F2\u5E76\u91CA\u653E\u4E0A\u4E0B\u6587",
|
|
305651
305631
|
"Compresses the context by replacing it with a summary.": "\u901A\u8FC7\u7528\u6458\u8981\u66FF\u6362\u6765\u538B\u7F29\u4E0A\u4E0B\u6587",
|
|
305652
305632
|
"open full RDMind documentation in your browser": "\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u5B8C\u6574\u7684 RDMind \u6587\u6863",
|
|
305653
305633
|
"Configuration not available.": "\u914D\u7F6E\u4E0D\u53EF\u7528",
|
|
@@ -305767,6 +305747,7 @@ var init_zh = __esm({
|
|
|
305767
305747
|
"(Use Enter to select{{tabText}})": "\uFF08\u4F7F\u7528 Enter \u9009\u62E9{{tabText}}\uFF09",
|
|
305768
305748
|
", Tab to change focus": "\uFF0CTab \u5207\u6362\u7126\u70B9",
|
|
305769
305749
|
"To see changes, RDMind must be restarted. Press r to exit and apply changes now.": "\u8981\u67E5\u770B\u66F4\u6539\uFF0C\u5FC5\u987B\u91CD\u542F RDMind\u3002\u6309 r \u9000\u51FA\u5E76\u7ACB\u5373\u5E94\u7528\u66F4\u6539\u3002",
|
|
305750
|
+
'The command "/{{command}}" is not supported in non-interactive mode.': '\u4E0D\u652F\u6301\u5728\u975E\u4EA4\u4E92\u6A21\u5F0F\u4E0B\u4F7F\u7528\u547D\u4EE4 "/{{command}}"\u3002',
|
|
305770
305751
|
// ============================================================================
|
|
305771
305752
|
// Settings Labels
|
|
305772
305753
|
// ============================================================================
|
|
@@ -305998,6 +305979,10 @@ var init_zh = __esm({
|
|
|
305998
305979
|
"Already generating summary, wait for previous request to complete": "\u6B63\u5728\u751F\u6210\u6458\u8981\uFF0C\u8BF7\u7B49\u5F85\u4E0A\u4E00\u4E2A\u8BF7\u6C42\u5B8C\u6210",
|
|
305999
305980
|
"No conversation found to summarize.": "\u672A\u627E\u5230\u8981\u603B\u7ED3\u7684\u5BF9\u8BDD",
|
|
306000
305981
|
"Failed to generate project context summary: {{error}}": "\u751F\u6210\u9879\u76EE\u4E0A\u4E0B\u6587\u6458\u8981\u5931\u8D25\uFF1A{{error}}",
|
|
305982
|
+
"Saved project summary to {{filePathForDisplay}}.": "\u9879\u76EE\u6458\u8981\u5DF2\u4FDD\u5B58\u5230 {{filePathForDisplay}}",
|
|
305983
|
+
"Saving project summary...": "\u6B63\u5728\u4FDD\u5B58\u9879\u76EE\u6458\u8981...",
|
|
305984
|
+
"Generating project summary...": "\u6B63\u5728\u751F\u6210\u9879\u76EE\u6458\u8981...",
|
|
305985
|
+
"Failed to generate summary - no text content received from LLM response": "\u751F\u6210\u6458\u8981\u5931\u8D25 - \u672A\u4ECE LLM \u54CD\u5E94\u4E2D\u63A5\u6536\u5230\u6587\u672C\u5185\u5BB9",
|
|
306001
305986
|
// ============================================================================
|
|
306002
305987
|
// Commands - Model
|
|
306003
305988
|
// ============================================================================
|
|
@@ -306008,8 +305993,8 @@ var init_zh = __esm({
|
|
|
306008
305993
|
// ============================================================================
|
|
306009
305994
|
// Commands - Clear
|
|
306010
305995
|
// ============================================================================
|
|
306011
|
-
"
|
|
306012
|
-
"
|
|
305996
|
+
"Starting a new session, resetting chat, and clearing terminal.": "\u6B63\u5728\u5F00\u59CB\u65B0\u4F1A\u8BDD\uFF0C\u91CD\u7F6E\u804A\u5929\u5E76\u6E05\u5C4F\u3002",
|
|
305997
|
+
"Starting a new session and clearing.": "\u6B63\u5728\u5F00\u59CB\u65B0\u4F1A\u8BDD\u5E76\u6E05\u5C4F\u3002",
|
|
306013
305998
|
// ============================================================================
|
|
306014
305999
|
// Commands - Compress
|
|
306015
306000
|
// ============================================================================
|
|
@@ -306273,183 +306258,90 @@ var init_zh = __esm({
|
|
|
306273
306258
|
// ============================================================================
|
|
306274
306259
|
"Waiting for user confirmation...": "\u7B49\u5F85\u7528\u6237\u786E\u8BA4...",
|
|
306275
306260
|
"(esc to cancel, {{time}})": "\uFF08\u6309 esc \u53D6\u6D88\uFF0C{{time}}\uFF09",
|
|
306276
|
-
|
|
306277
|
-
|
|
306278
|
-
|
|
306279
|
-
|
|
306280
|
-
|
|
306281
|
-
|
|
306282
|
-
|
|
306283
|
-
|
|
306284
|
-
|
|
306285
|
-
|
|
306286
|
-
|
|
306287
|
-
|
|
306288
|
-
|
|
306289
|
-
|
|
306290
|
-
|
|
306291
|
-
|
|
306292
|
-
|
|
306293
|
-
|
|
306294
|
-
|
|
306295
|
-
|
|
306296
|
-
|
|
306297
|
-
|
|
306298
|
-
|
|
306299
|
-
|
|
306300
|
-
|
|
306301
|
-
|
|
306302
|
-
|
|
306303
|
-
|
|
306304
|
-
|
|
306305
|
-
|
|
306306
|
-
|
|
306307
|
-
|
|
306308
|
-
|
|
306309
|
-
|
|
306310
|
-
|
|
306311
|
-
|
|
306312
|
-
|
|
306313
|
-
|
|
306314
|
-
|
|
306315
|
-
|
|
306316
|
-
|
|
306317
|
-
|
|
306318
|
-
|
|
306319
|
-
|
|
306320
|
-
|
|
306321
|
-
|
|
306322
|
-
|
|
306323
|
-
|
|
306324
|
-
|
|
306325
|
-
|
|
306326
|
-
|
|
306327
|
-
|
|
306328
|
-
|
|
306329
|
-
|
|
306330
|
-
|
|
306331
|
-
|
|
306332
|
-
|
|
306333
|
-
|
|
306334
|
-
|
|
306335
|
-
|
|
306336
|
-
|
|
306337
|
-
|
|
306338
|
-
|
|
306339
|
-
|
|
306340
|
-
|
|
306341
|
-
|
|
306342
|
-
|
|
306343
|
-
|
|
306344
|
-
|
|
306345
|
-
|
|
306346
|
-
|
|
306347
|
-
|
|
306348
|
-
|
|
306349
|
-
|
|
306350
|
-
|
|
306351
|
-
|
|
306352
|
-
|
|
306353
|
-
|
|
306354
|
-
|
|
306355
|
-
|
|
306356
|
-
|
|
306357
|
-
|
|
306358
|
-
|
|
306359
|
-
|
|
306360
|
-
"Doing research on the latest memes...": "\u6B63\u5728\u7814\u7A76\u6700\u65B0\u7684\u8868\u60C5\u5305...",
|
|
306361
|
-
"Figuring out how to make this more witty...": "\u6B63\u5728\u60F3\u529E\u6CD5\u8BA9\u8FD9\u66F4\u6709\u8DA3...",
|
|
306362
|
-
"Hmmm... let me think...": "\u55EF...\u8BA9\u6211\u60F3\u60F3...",
|
|
306363
|
-
"What do you call a fish with no eyes? A fsh...": "\u6CA1\u6709\u773C\u775B\u7684\u9C7C\u53EB\u4EC0\u4E48\uFF1F\u4E00\u6761\u9C7C...",
|
|
306364
|
-
"Why did the computer go to therapy? It had too many bytes...": "\u4E3A\u4EC0\u4E48\u7535\u8111\u53BB\u770B\u5FC3\u7406\u533B\u751F\uFF1F\u56E0\u4E3A\u5B83\u6709\u592A\u591A\u5B57\u8282...",
|
|
306365
|
-
"Why don't programmers like nature? It has too many bugs...": "\u4E3A\u4EC0\u4E48\u7A0B\u5E8F\u5458\u4E0D\u559C\u6B22\u5927\u81EA\u7136\uFF1F\u56E0\u4E3A\u866B\u5B50\u592A\u591A\u4E86...",
|
|
306366
|
-
"Why do programmers prefer dark mode? Because light attracts bugs...": "\u4E3A\u4EC0\u4E48\u7A0B\u5E8F\u5458\u559C\u6B22\u6697\u8272\u6A21\u5F0F\uFF1F\u56E0\u4E3A\u5149\u4F1A\u5438\u5F15\u866B\u5B50...",
|
|
306367
|
-
"Why did the developer go broke? Because they used up all their cache...": "\u4E3A\u4EC0\u4E48\u5F00\u53D1\u8005\u7834\u4EA7\u4E86\uFF1F\u56E0\u4E3A\u4ED6\u4EEC\u7528\u5B8C\u4E86\u6240\u6709\u7F13\u5B58...",
|
|
306368
|
-
"What can you do with a broken pencil? Nothing, it's pointless...": "\u4F60\u80FD\u7528\u65AD\u4E86\u7684\u94C5\u7B14\u505A\u4EC0\u4E48\uFF1F\u4EC0\u4E48\u90FD\u4E0D\u80FD\uFF0C\u56E0\u4E3A\u5B83\u6CA1\u6709\u7B14\u5C16...",
|
|
306369
|
-
"Applying percussive maintenance...": "\u6B63\u5728\u5E94\u7528\u6572\u51FB\u7EF4\u62A4...",
|
|
306370
|
-
"Searching for the correct USB orientation...": "\u6B63\u5728\u5BFB\u627E\u6B63\u786E\u7684 USB \u65B9\u5411...",
|
|
306371
|
-
"Ensuring the magic smoke stays inside the wires...": "\u786E\u4FDD\u9B54\u6CD5\u70DF\u96FE\u7559\u5728\u7535\u7EBF\u5185...",
|
|
306372
|
-
"Rewriting in Rust for no particular reason...": "\u6B63\u5728\u7528 Rust \u91CD\u5199\uFF0C\u6CA1\u6709\u7279\u522B\u7684\u539F\u56E0...",
|
|
306373
|
-
"Trying to exit Vim...": "\u6B63\u5728\u5C1D\u8BD5\u9000\u51FA Vim...",
|
|
306374
|
-
"Spinning up the hamster wheel...": "\u6B63\u5728\u542F\u52A8\u4ED3\u9F20\u8F6E...",
|
|
306375
|
-
"That's not a bug, it's an undocumented feature...": "\u8FD9\u4E0D\u662F\u4E00\u4E2A\u9519\u8BEF\uFF0C\u8FD9\u662F\u4E00\u4E2A\u672A\u8BB0\u5F55\u7684\u529F\u80FD...",
|
|
306376
|
-
"Engage.": "\u542F\u52A8\u3002",
|
|
306377
|
-
"I'll be back... with an answer.": "\u6211\u4F1A\u56DE\u6765\u7684...\u5E26\u7740\u7B54\u6848\u3002",
|
|
306378
|
-
"My other process is a TARDIS...": "\u6211\u7684\u53E6\u4E00\u4E2A\u8FDB\u7A0B\u662F TARDIS...",
|
|
306379
|
-
"Communing with the machine spirit...": "\u6B63\u5728\u4E0E\u673A\u5668\u7CBE\u795E\u4EA4\u6D41...",
|
|
306380
|
-
"Letting the thoughts marinate...": "\u8BA9\u60F3\u6CD5\u6162\u6162\u915D\u917F...",
|
|
306381
|
-
"Just remembered where I put my keys...": "\u521A\u521A\u60F3\u8D77\u6211\u628A\u94A5\u5319\u653E\u5728\u54EA\u91CC\u4E86...",
|
|
306382
|
-
"Pondering the orb...": "\u6B63\u5728\u601D\u8003\u7403\u4F53...",
|
|
306383
|
-
"I've seen things you people wouldn't believe... like a user who reads loading messages.": "\u6211\u89C1\u8FC7\u4F60\u4EEC\u4E0D\u4F1A\u76F8\u4FE1\u7684\u4E8B\u60C5...\u6BD4\u5982\u4E00\u4E2A\u9605\u8BFB\u52A0\u8F7D\u6D88\u606F\u7684\u7528\u6237\u3002",
|
|
306384
|
-
"Initiating thoughtful gaze...": "\u6B63\u5728\u542F\u52A8\u6DF1\u601D\u51DD\u89C6...",
|
|
306385
|
-
"What's a computer's favorite snack? Microchips.": "\u7535\u8111\u6700\u559C\u6B22\u7684\u96F6\u98DF\u662F\u4EC0\u4E48\uFF1F\u5FAE\u82AF\u7247\u3002",
|
|
306386
|
-
"Why do Java developers wear glasses? Because they don't C#.": "\u4E3A\u4EC0\u4E48 Java \u5F00\u53D1\u8005\u6234\u773C\u955C\uFF1F\u56E0\u4E3A\u4ED6\u4EEC\u4E0D\u4F1A C#\u3002",
|
|
306387
|
-
"Charging the laser... pew pew!": "\u6B63\u5728\u7ED9\u6FC0\u5149\u5145\u7535...\u7830\u7830\uFF01",
|
|
306388
|
-
"Dividing by zero... just kidding!": "\u9664\u4EE5\u96F6...\u53EA\u662F\u5F00\u73A9\u7B11\uFF01",
|
|
306389
|
-
"Looking for an adult superviso... I mean, processing.": "\u6B63\u5728\u5BFB\u627E\u6210\u4EBA\u76D1\u7763...\u6211\u662F\u8BF4\uFF0C\u5904\u7406\u4E2D\u3002",
|
|
306390
|
-
"Making it go beep boop.": "\u8BA9\u5B83\u53D1\u51FA\u54D4\u54D4\u58F0\u3002",
|
|
306391
|
-
"Buffering... because even AIs need a moment.": "\u6B63\u5728\u7F13\u51B2...\u56E0\u4E3A\u5373\u4F7F\u662F AI \u4E5F\u9700\u8981\u7247\u523B\u3002",
|
|
306392
|
-
"Entangling quantum particles for a faster response...": "\u6B63\u5728\u7EA0\u7F20\u91CF\u5B50\u7C92\u5B50\u4EE5\u83B7\u5F97\u66F4\u5FEB\u7684\u56DE\u590D...",
|
|
306393
|
-
"Polishing the chrome... on the algorithms.": "\u6B63\u5728\u6253\u78E8\u94EC...\u5728\u7B97\u6CD5\u4E0A\u3002",
|
|
306394
|
-
"Are you not entertained? (Working on it!)": "\u4F60\u4E0D\u89C9\u5F97\u6709\u8DA3\u5417\uFF1F\uFF08\u6B63\u5728\u52AA\u529B\uFF01\uFF09",
|
|
306395
|
-
"Summoning the code gremlins... to help, of course.": "\u6B63\u5728\u53EC\u5524\u4EE3\u7801\u5C0F\u7CBE\u7075...\u5F53\u7136\u662F\u6765\u5E2E\u5FD9\u7684\u3002",
|
|
306396
|
-
"Just waiting for the dial-up tone to finish...": "\u53EA\u662F\u7B49\u5F85\u62E8\u53F7\u97F3\u7ED3\u675F...",
|
|
306397
|
-
"Recalibrating the humor-o-meter.": "\u6B63\u5728\u91CD\u65B0\u6821\u51C6\u5E7D\u9ED8\u8BA1\u3002",
|
|
306398
|
-
"My other loading screen is even funnier.": "\u6211\u7684\u53E6\u4E00\u4E2A\u52A0\u8F7D\u5C4F\u5E55\u66F4\u6709\u8DA3\u3002",
|
|
306399
|
-
"Pretty sure there's a cat walking on the keyboard somewhere...": "\u5F88\u786E\u5B9A\u6709\u53EA\u732B\u5728\u67D0\u4E2A\u5730\u65B9\u952E\u76D8\u4E0A\u8D70...",
|
|
306400
|
-
"Enhancing... Enhancing... Still loading.": "\u6B63\u5728\u589E\u5F3A...\u6B63\u5728\u589E\u5F3A...\u4ECD\u5728\u52A0\u8F7D\u3002",
|
|
306401
|
-
"It's not a bug, it's a feature... of this loading screen.": "\u8FD9\u4E0D\u662F\u4E00\u4E2A\u9519\u8BEF\uFF0C\u8FD9\u662F\u4E00\u4E2A\u529F\u80FD...\u8FD9\u4E2A\u52A0\u8F7D\u5C4F\u5E55\u7684\u529F\u80FD\u3002",
|
|
306402
|
-
"Have you tried turning it off and on again? (The loading screen, not me.)": "\u4F60\u8BD5\u8FC7\u628A\u5B83\u5173\u6389\u518D\u6253\u5F00\u5417\uFF1F\uFF08\u52A0\u8F7D\u5C4F\u5E55\uFF0C\u4E0D\u662F\u6211\u3002\uFF09",
|
|
306403
|
-
"Constructing additional pylons...": "\u6B63\u5728\u5EFA\u9020\u989D\u5916\u7684\u80FD\u91CF\u5854...",
|
|
306404
|
-
"Summoning the soul of programmers...": "\u6B63\u5728\u53EC\u5524\u7A0B\u5E8F\u5458\u7684\u7075\u9B42...",
|
|
306405
|
-
"Fixing that bug that's not a bug, it's a feature...": "\u6B63\u5728\u4FEE\u590D\u90A3\u4E2A\u4E0D\u7B97 bug \u7684 feature...",
|
|
306406
|
-
"Removing pinyin comments from code...": "\u6B63\u5728\u6E05\u9664\u4EE3\u7801\u91CC\u7684\u62FC\u97F3\u6CE8\u91CA...",
|
|
306407
|
-
"Debating whether array index starts from 0 or 1...": "\u6B63\u5728\u4E89\u8BBA\u6570\u7EC4\u4E0B\u6807\u4ECE 0 \u8FD8\u662F\u4ECE 1...",
|
|
306408
|
-
"Thinking about refactoring...": "\u6B63\u5728\u601D\u8003\u8981\u4E0D\u8981\u91CD\u6784...",
|
|
306409
|
-
"Cleaning up stack overflow...": "\u6B63\u5728\u6E05\u7406\u5806\u6808\u6EA2\u51FA...",
|
|
306410
|
-
"Naming variables properly...": "\u6B63\u5728\u7ED9\u53D8\u91CF\u8D77\u4E2A\u597D\u540D\u5B57...",
|
|
306411
|
-
"Commenting code written 3 months ago...": "\u6B63\u5728\u6CE8\u91CA\u4E09\u4E2A\u6708\u524D\u5199\u7684\u4EE3\u7801...",
|
|
306412
|
-
"Praying for no bugs...": "\u6B63\u5728\u7948\u7977\u4E0D\u8981\u6709 bug...",
|
|
306413
|
-
"Resolving dependencies...": "\u6B63\u5728\u89E3\u51B3\u4F9D\u8D56\u5173\u7CFB...",
|
|
306414
|
-
"Waiting for product manager to change requirements...": "\u6B63\u5728\u7B49\u5F85\u4EA7\u54C1\u7ECF\u7406\u6539\u9700\u6C42...",
|
|
306415
|
-
"Postponing project deadline...": "\u6B63\u5728\u5EF6\u671F\u9879\u76EE\u622A\u6B62\u65E5\u671F...",
|
|
306416
|
-
'Preparing another "almost done"...': '\u6B63\u5728\u51C6\u5907\u53C8\u4E00\u6B21"\u5FEB\u597D\u4E86"...',
|
|
306417
|
-
"Taking a break...": "\u6B63\u5728\u6478\u9C7C...",
|
|
306418
|
-
"Making goji berry tea...": "\u6B63\u5728\u6CE1\u67B8\u675E...",
|
|
306419
|
-
"Ordering takeout...": "\u6B63\u5728\u70B9\u5916\u5356...",
|
|
306420
|
-
"Pretending to be busy...": "\u6B63\u5728\u5047\u88C5\u5F88\u5FD9...",
|
|
306421
|
-
"Recharging faith...": "\u6B63\u5728\u5145\u503C\u4FE1\u4EF0...",
|
|
306422
|
-
"Downloading more RAM...": "\u6B63\u5728\u4E0B\u8F7D\u66F4\u591A\u5185\u5B58...",
|
|
306423
|
-
"Feeding the server...": "\u6B63\u5728\u6295\u5582\u670D\u52A1\u5668...",
|
|
306424
|
-
"Waking up sleeping code...": "\u6B63\u5728\u5524\u9192\u6C89\u7761\u7684\u4EE3\u7801...",
|
|
306425
|
-
"Feeding data to AI...": "\u6B63\u5728\u7ED9 AI \u5582\u6570\u636E...",
|
|
306426
|
-
"Opening imagination...": "\u6B63\u5728\u6253\u5F00\u8111\u6D1E...",
|
|
306427
|
-
"Boiling water for tea...": "\u6B63\u5728\u70E7\u5F00\u6C34\u6CE1\u8336...",
|
|
306428
|
-
"Waiting for the elevator...": "\u6B63\u5728\u7B49\u7535\u68AF...",
|
|
306429
|
-
"Taking a number in queue...": "\u6B63\u5728\u6392\u961F\u53D6\u53F7...",
|
|
306430
|
-
"Waiting for traffic light...": "\u6B63\u5728\u7B49\u7EA2\u7EFF\u706F...",
|
|
306431
|
-
"Charging...": "\u6B63\u5728\u5145\u7535\u4E2D...",
|
|
306432
|
-
"Buffering life...": "\u6B63\u5728\u7F13\u51B2\u4EBA\u751F...",
|
|
306433
|
-
"Contemplating the meaning of life...": "\u6B63\u5728\u601D\u8003\u4EBA\u751F\u7684\u610F\u4E49...",
|
|
306434
|
-
"What to eat today? Thinking...": "\u4ECA\u5929\u5403\u4EC0\u4E48\uFF1F\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
306435
|
-
"Pretending to work...": "\u6B63\u5728\u5047\u88C5\u5728\u5DE5\u4F5C...",
|
|
306436
|
-
"Let me think, just a moment...": "\u8BA9\u6211\u60F3\u60F3\uFF0C\u7A0D\u7B49\u4E00\u4E0B...",
|
|
306437
|
-
"Brewing inspiration...": "\u6B63\u5728\u915D\u917F\u7075\u611F...",
|
|
306438
|
-
"Take a deep breath, almost done...": "\u6DF1\u547C\u5438\uFF0C\u9A6C\u4E0A\u5C31\u597D...",
|
|
306439
|
-
"Don't worry, good things take time...": "\u4E0D\u8981\u7740\u6025\uFF0C\u597D\u996D\u4E0D\u6015\u665A...",
|
|
306440
|
-
"Stay calm, exciting things coming...": "\u7A0D\u5B89\u52FF\u8E81\uFF0C\u7CBE\u5F69\u5373\u5C06\u5448\u73B0...",
|
|
306441
|
-
"Greeting the server...": "\u6B63\u5728\u5411\u670D\u52A1\u5668\u95EE\u597D...",
|
|
306442
|
-
"Organizing thoughts...": "\u6B63\u5728\u6574\u7406\u601D\u7EEA...",
|
|
306443
|
-
"Preparing my words...": "\u6B63\u5728\u7EC4\u7EC7\u8BED\u8A00...",
|
|
306444
|
-
"Looking up information...": "\u6B63\u5728\u67E5\u9605\u8D44\u6599...",
|
|
306445
|
-
"Sorting out my thoughts...": "\u8BA9\u6211\u7406\u4E00\u7406\u601D\u8DEF...",
|
|
306446
|
-
"Analyzing the problem...": "\u6B63\u5728\u5206\u6790\u95EE\u9898...",
|
|
306447
|
-
"Looking for the best solution...": "\u6B63\u5728\u5BFB\u627E\u6700\u4F73\u65B9\u6848...",
|
|
306448
|
-
"Loading...": "\u6B63\u5728\u52A0\u8F7D...",
|
|
306449
|
-
"Processing, please wait...": "\u5904\u7406\u4E2D\uFF0C\u8BF7\u7A0D\u5019...",
|
|
306450
|
-
"Almost there...": "\u9A6C\u4E0A\u5C31\u597D...",
|
|
306451
|
-
"Working hard...": "\u6B63\u5728\u52AA\u529B\u5DE5\u4F5C\u4E2D...",
|
|
306452
|
-
"Almost... almost...": "\u5FEB\u4E86\uFF0C\u5FEB\u4E86...",
|
|
306261
|
+
WITTY_LOADING_PHRASES: [
|
|
306262
|
+
// --- 编程/技术相关 ---
|
|
306263
|
+
"\u6B63\u5728\u53EC\u5524\u7A0B\u5E8F\u5458\u7684\u7075\u9B42...",
|
|
306264
|
+
"\u6B63\u5728\u4FEE\u590D\u90A3\u4E2A\u4E0D\u7B97 bug \u7684 feature...",
|
|
306265
|
+
"\u6B63\u5728\u6E05\u9664\u4EE3\u7801\u91CC\u7684\u62FC\u97F3\u6CE8\u91CA...",
|
|
306266
|
+
"\u6B63\u5728\u4E89\u8BBA\u6570\u7EC4\u4E0B\u6807\u4ECE 0 \u8FD8\u662F\u4ECE 1...",
|
|
306267
|
+
"\u6B63\u5728\u601D\u8003\u8981\u4E0D\u8981\u91CD\u6784...",
|
|
306268
|
+
"\u6B63\u5728\u5BFB\u627E\u6D88\u5931\u7684\u5206\u53F7...",
|
|
306269
|
+
"\u6B63\u5728\u6E05\u7406\u5806\u6808\u6EA2\u51FA...",
|
|
306270
|
+
"\u6B63\u5728\u7ED9\u53D8\u91CF\u8D77\u4E2A\u597D\u540D\u5B57...",
|
|
306271
|
+
"\u6B63\u5728\u6CE8\u91CA\u4E09\u4E2A\u6708\u524D\u5199\u7684\u4EE3\u7801...",
|
|
306272
|
+
"\u6B63\u5728\u7948\u7977\u4E0D\u8981\u6709 bug...",
|
|
306273
|
+
"\u6B63\u5728\u5C1D\u8BD5\u9000\u51FA Vim...",
|
|
306274
|
+
"\u6B63\u5728\u5BFB\u627E\u6B63\u786E\u7684 USB \u65B9\u5411...",
|
|
306275
|
+
"\u8FD9\u4E0D\u662F\u4E00\u4E2A\u9519\u8BEF\uFF0C\u8FD9\u662F\u4E00\u4E2A\u672A\u8BB0\u5F55\u7684\u529F\u80FD...",
|
|
306276
|
+
"\u6B63\u5728\u6253\u78E8\u7B97\u6CD5...",
|
|
306277
|
+
"\u6B63\u5728\u7F16\u8BD1\u667A\u6167...",
|
|
306278
|
+
"\u6B63\u5728\u89E3\u5F00\u795E\u7ECF\u7F51\u7EDC...",
|
|
306279
|
+
"\u6B63\u5728\u5783\u573E\u56DE\u6536...\u9A6C\u4E0A\u56DE\u6765...",
|
|
306280
|
+
"\u6B63\u5728\u89E3\u51B3\u4F9D\u8D56\u5173\u7CFB...",
|
|
306281
|
+
"\u6B63\u5728\u5C06\u5496\u5561\u8F6C\u6362\u4E3A\u4EE3\u7801...",
|
|
306282
|
+
// --- 工作/职场相关 ---
|
|
306283
|
+
"\u6B63\u5728\u7B49\u5F85\u4EA7\u54C1\u7ECF\u7406\u6539\u9700\u6C42...",
|
|
306284
|
+
"\u6B63\u5728\u5EF6\u671F\u9879\u76EE\u622A\u6B62\u65E5\u671F...",
|
|
306285
|
+
'\u6B63\u5728\u51C6\u5907\u53C8\u4E00\u6B21"\u5FEB\u597D\u4E86"...',
|
|
306286
|
+
"\u6B63\u5728\u6478\u9C7C...",
|
|
306287
|
+
"\u6B63\u5728\u6CE1\u67B8\u675E...",
|
|
306288
|
+
"\u6B63\u5728\u70B9\u5916\u5356...",
|
|
306289
|
+
"\u6B63\u5728\u5047\u88C5\u5F88\u5FD9...",
|
|
306290
|
+
// --- 合作愉快系列 ---
|
|
306291
|
+
"\u6B63\u5728\u8BE2\u95EE\u4EA7\u54C1\u7ECF\u7406\uFF1A\u8FD9\u9700\u6C42\u662F\u771F\u7684\u5417\uFF1F",
|
|
306292
|
+
"\u6B63\u5728\u7ED9\u4EA7\u54C1\u7ECF\u7406\u753B\u997C\uFF0C\u8BF7\u7A0D\u7B49...",
|
|
306293
|
+
// --- 温暖治愈系列 ---
|
|
306294
|
+
"\u6BCF\u4E00\u884C\u4EE3\u7801\uFF0C\u90FD\u5728\u52AA\u529B\u8BA9\u4E16\u754C\u53D8\u5F97\u66F4\u597D\u4E00\u70B9\u70B9...",
|
|
306295
|
+
"\u6BCF\u4E00\u4E2A\u4F1F\u5927\u7684\u60F3\u6CD5\uFF0C\u90FD\u503C\u5F97\u8FD9\u4EFD\u8010\u5FC3\u7684\u7B49\u5F85...",
|
|
306296
|
+
"\u522B\u6025\uFF0C\u7F8E\u597D\u7684\u4E8B\u7269\u603B\u662F\u9700\u8981\u4E00\u70B9\u65F6\u95F4\u53BB\u915D\u917F...",
|
|
306297
|
+
"\u613F\u4F60\u7684\u4EE3\u7801\u6C38\u65E0 Bug\uFF0C\u613F\u4F60\u7684\u68A6\u60F3\u7EC8\u5C06\u6210\u771F...",
|
|
306298
|
+
"\u54EA\u6015\u53EA\u6709 0.1% \u7684\u8FDB\u5EA6\uFF0C\u4E5F\u662F\u5728\u5411\u76EE\u6807\u9760\u8FD1...",
|
|
306299
|
+
"\u52A0\u8F7D\u7684\u662F\u5B57\u8282\uFF0C\u627F\u8F7D\u7684\u662F\u5BF9\u6280\u672F\u7684\u70ED\u7231...",
|
|
306300
|
+
// --- 互联网文化/梗 ---
|
|
306301
|
+
"\u6B63\u5728\u5145\u503C\u4FE1\u4EF0...",
|
|
306302
|
+
"\u6B63\u5728\u4E0B\u8F7D\u66F4\u591A\u5185\u5B58...",
|
|
306303
|
+
"\u6B63\u5728\u6295\u5582\u670D\u52A1\u5668...",
|
|
306304
|
+
"\u6B63\u5728\u5524\u9192\u6C89\u7761\u7684\u4EE3\u7801...",
|
|
306305
|
+
"\u6B63\u5728\u7ED9 AI \u5582\u6570\u636E...",
|
|
306306
|
+
"\u6B63\u5728\u6253\u5F00\u8111\u6D1E...",
|
|
306307
|
+
// --- 日常生活 ---
|
|
306308
|
+
"\u6B63\u5728\u70E7\u5F00\u6C34\u6CE1\u8336...",
|
|
306309
|
+
"\u6B63\u5728\u7B49\u7535\u68AF...",
|
|
306310
|
+
"\u6B63\u5728\u6392\u961F\u53D6\u53F7...",
|
|
306311
|
+
"\u6B63\u5728\u7B49\u7EA2\u7EFF\u706F...",
|
|
306312
|
+
"\u6B63\u5728\u5145\u7535\u4E2D...",
|
|
306313
|
+
"\u6B63\u5728\u7F13\u51B2\u4EBA\u751F...",
|
|
306314
|
+
// --- 轻松幽默 ---
|
|
306315
|
+
"\u6B63\u5728\u601D\u8003\u4EBA\u751F\u7684\u610F\u4E49...",
|
|
306316
|
+
"\u4ECA\u5929\u5403\u4EC0\u4E48\uFF1F\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
306317
|
+
"\u6B63\u5728\u5047\u88C5\u5728\u5DE5\u4F5C...",
|
|
306318
|
+
"\u8BA9\u6211\u60F3\u60F3\uFF0C\u7A0D\u7B49\u4E00\u4E0B...",
|
|
306319
|
+
"\u6B63\u5728\u915D\u917F\u7075\u611F...",
|
|
306320
|
+
"\u6DF1\u547C\u5438\uFF0C\u9A6C\u4E0A\u5C31\u597D...",
|
|
306321
|
+
"\u4E0D\u8981\u7740\u6025\uFF0C\u597D\u996D\u4E0D\u6015\u665A...",
|
|
306322
|
+
"\u7A0D\u5B89\u52FF\u8E81\uFF0C\u7CBE\u5F69\u5373\u5C06\u5448\u73B0...",
|
|
306323
|
+
"\u55EF...\u8BA9\u6211\u60F3\u60F3...",
|
|
306324
|
+
// --- 技术向但接地气 ---
|
|
306325
|
+
"\u6B63\u5728\u5411\u670D\u52A1\u5668\u95EE\u597D...",
|
|
306326
|
+
"\u6B63\u5728\u6574\u7406\u601D\u7EEA...",
|
|
306327
|
+
"\u6B63\u5728\u7EC4\u7EC7\u8BED\u8A00...",
|
|
306328
|
+
"\u6B63\u5728\u67E5\u9605\u8D44\u6599...",
|
|
306329
|
+
"\u8BA9\u6211\u7406\u4E00\u7406\u601D\u8DEF...",
|
|
306330
|
+
"\u6B63\u5728\u5206\u6790\u95EE\u9898...",
|
|
306331
|
+
"\u6B63\u5728\u5BFB\u627E\u6700\u4F73\u65B9\u6848...",
|
|
306332
|
+
"\u6B63\u5728\u542F\u52A8\u8BA4\u77E5\u5904\u7406\u5668...",
|
|
306333
|
+
"\u6B63\u5728\u5236\u4F5C\u503C\u5F97\u60A8\u8010\u5FC3\u7B49\u5F85\u7684\u56DE\u590D...",
|
|
306334
|
+
// --- 保持通用性 ---
|
|
306335
|
+
"\u6B63\u5728\u52A0\u8F7D...",
|
|
306336
|
+
"\u5904\u7406\u4E2D\uFF0C\u8BF7\u7A0D\u5019...",
|
|
306337
|
+
"\u9A6C\u4E0A\u5C31\u597D...",
|
|
306338
|
+
"\u6B63\u5728\u52AA\u529B\u5DE5\u4F5C\u4E2D...",
|
|
306339
|
+
"\u5FEB\u4E86\uFF0C\u5FEB\u4E86...",
|
|
306340
|
+
"\u5FEB\u5230\u4E86...\u53EF\u80FD..."
|
|
306341
|
+
],
|
|
306342
|
+
// ============================================================================
|
|
306343
|
+
// OpenSpec Commands
|
|
306344
|
+
// ============================================================================
|
|
306453
306345
|
"Initialize OpenSpec in a project with RDMind integration": "\u5728\u9879\u76EE\u4E2D\u521D\u59CB\u5316 OpenSpec\uFF08\u96C6\u6210 RDMind\uFF09",
|
|
306454
306346
|
"Initialize OpenSpec in the current directory": "\u5728\u5F53\u524D\u76EE\u5F55\u521D\u59CB\u5316 OpenSpec",
|
|
306455
306347
|
"Scaffold a new OpenSpec change and validate strictly.": "\u642D\u5EFA\u65B0\u7684 OpenSpec \u53D8\u66F4\u5E76\u4E25\u683C\u9A8C\u8BC1\u3002",
|
|
@@ -332090,7 +331982,7 @@ var loadYoga = (() => {
|
|
|
332090
331982
|
pa.unshift(a2);
|
|
332091
331983
|
}
|
|
332092
331984
|
__name(sa, "sa");
|
|
332093
|
-
var F4 = 0,
|
|
331985
|
+
var F4 = 0, ta2 = null, G2 = null;
|
|
332094
331986
|
function x3(a2) {
|
|
332095
331987
|
if (h3.onAbort) h3.onAbort(a2);
|
|
332096
331988
|
a2 = "Aborted(" + a2 + ")";
|
|
@@ -333233,7 +333125,7 @@ var loadYoga = (() => {
|
|
|
333233
333125
|
qa.unshift(h3.asm.F);
|
|
333234
333126
|
F4--;
|
|
333235
333127
|
h3.monitorRunDependencies && h3.monitorRunDependencies(F4);
|
|
333236
|
-
0 == F4 && (null !==
|
|
333128
|
+
0 == F4 && (null !== ta2 && (clearInterval(ta2), ta2 = null), G2 && (e4 = G2, G2 = null, e4()));
|
|
333237
333129
|
}
|
|
333238
333130
|
__name(a2, "a");
|
|
333239
333131
|
function b2(e4) {
|
|
@@ -344157,7 +344049,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
344157
344049
|
// packages/cli/src/utils/version.ts
|
|
344158
344050
|
async function getCliVersion() {
|
|
344159
344051
|
const pkgJson = await getPackageJson();
|
|
344160
|
-
return "0.1.8-alpha.
|
|
344052
|
+
return "0.1.8-alpha.11";
|
|
344161
344053
|
}
|
|
344162
344054
|
__name(getCliVersion, "getCliVersion");
|
|
344163
344055
|
|
|
@@ -348122,6 +348014,36 @@ import * as path83 from "node:path";
|
|
|
348122
348014
|
import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
348123
348015
|
import { homedir as homedir18 } from "node:os";
|
|
348124
348016
|
|
|
348017
|
+
// packages/cli/src/i18n/languages.ts
|
|
348018
|
+
init_esbuild_shims();
|
|
348019
|
+
var SUPPORTED_LANGUAGES = [
|
|
348020
|
+
{
|
|
348021
|
+
code: "en",
|
|
348022
|
+
id: "en-US",
|
|
348023
|
+
fullName: "English"
|
|
348024
|
+
},
|
|
348025
|
+
{
|
|
348026
|
+
code: "zh",
|
|
348027
|
+
id: "zh-CN",
|
|
348028
|
+
fullName: "Chinese"
|
|
348029
|
+
},
|
|
348030
|
+
{
|
|
348031
|
+
code: "ru",
|
|
348032
|
+
id: "ru-RU",
|
|
348033
|
+
fullName: "Russian"
|
|
348034
|
+
},
|
|
348035
|
+
{
|
|
348036
|
+
code: "de",
|
|
348037
|
+
id: "de-DE",
|
|
348038
|
+
fullName: "German"
|
|
348039
|
+
}
|
|
348040
|
+
];
|
|
348041
|
+
function getLanguageNameFromLocale(locale) {
|
|
348042
|
+
const lang = SUPPORTED_LANGUAGES.find((l3) => l3.code === locale);
|
|
348043
|
+
return lang?.fullName || "English";
|
|
348044
|
+
}
|
|
348045
|
+
__name(getLanguageNameFromLocale, "getLanguageNameFromLocale");
|
|
348046
|
+
|
|
348125
348047
|
// import("./locales/**/*.js") in packages/cli/src/i18n/index.ts
|
|
348126
348048
|
var globImport_locales_js = __glob({
|
|
348127
348049
|
"./locales/en.js": () => Promise.resolve().then(() => (init_en3(), en_exports)),
|
|
@@ -348249,9 +348171,20 @@ function getCurrentLanguage() {
|
|
|
348249
348171
|
__name(getCurrentLanguage, "getCurrentLanguage");
|
|
348250
348172
|
function t4(key, params) {
|
|
348251
348173
|
const translation = translations[key] ?? key;
|
|
348174
|
+
if (Array.isArray(translation)) {
|
|
348175
|
+
return key;
|
|
348176
|
+
}
|
|
348252
348177
|
return interpolate(translation, params);
|
|
348253
348178
|
}
|
|
348254
348179
|
__name(t4, "t");
|
|
348180
|
+
function ta(key) {
|
|
348181
|
+
const translation = translations[key];
|
|
348182
|
+
if (Array.isArray(translation)) {
|
|
348183
|
+
return translation;
|
|
348184
|
+
}
|
|
348185
|
+
return [];
|
|
348186
|
+
}
|
|
348187
|
+
__name(ta, "ta");
|
|
348255
348188
|
async function initializeI18n(lang) {
|
|
348256
348189
|
await setLanguageAsync(lang ?? "auto");
|
|
348257
348190
|
}
|
|
@@ -351625,10 +351558,346 @@ function validateTheme(settings) {
|
|
|
351625
351558
|
}
|
|
351626
351559
|
__name(validateTheme, "validateTheme");
|
|
351627
351560
|
|
|
351561
|
+
// packages/cli/src/ui/commands/languageCommand.ts
|
|
351562
|
+
init_esbuild_shims();
|
|
351563
|
+
|
|
351564
|
+
// packages/cli/src/ui/commands/types.ts
|
|
351565
|
+
init_esbuild_shims();
|
|
351566
|
+
|
|
351567
|
+
// packages/cli/src/ui/commands/languageCommand.ts
|
|
351568
|
+
init_settings();
|
|
351569
|
+
init_core5();
|
|
351570
|
+
import * as fs80 from "node:fs";
|
|
351571
|
+
import * as path86 from "node:path";
|
|
351572
|
+
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
351573
|
+
var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
|
|
351574
|
+
function parseUiLanguageArg(input) {
|
|
351575
|
+
const lowered = input.trim().toLowerCase();
|
|
351576
|
+
if (!lowered) return null;
|
|
351577
|
+
for (const lang of SUPPORTED_LANGUAGES) {
|
|
351578
|
+
if (lowered === lang.code || lowered === lang.id.toLowerCase() || lowered === lang.fullName.toLowerCase()) {
|
|
351579
|
+
return lang.code;
|
|
351580
|
+
}
|
|
351581
|
+
}
|
|
351582
|
+
return null;
|
|
351583
|
+
}
|
|
351584
|
+
__name(parseUiLanguageArg, "parseUiLanguageArg");
|
|
351585
|
+
function formatUiLanguageDisplay(lang) {
|
|
351586
|
+
const option2 = SUPPORTED_LANGUAGES.find((o3) => o3.code === lang);
|
|
351587
|
+
return option2 ? `${option2.fullName}\uFF08${option2.id}\uFF09` : lang;
|
|
351588
|
+
}
|
|
351589
|
+
__name(formatUiLanguageDisplay, "formatUiLanguageDisplay");
|
|
351590
|
+
function sanitizeLanguageForMarker(language) {
|
|
351591
|
+
return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
|
|
351592
|
+
}
|
|
351593
|
+
__name(sanitizeLanguageForMarker, "sanitizeLanguageForMarker");
|
|
351594
|
+
function generateLlmOutputLanguageRule(language) {
|
|
351595
|
+
const markerLanguage = sanitizeLanguageForMarker(language);
|
|
351596
|
+
return `# Output language preference: ${language}
|
|
351597
|
+
<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${markerLanguage} -->
|
|
351598
|
+
|
|
351599
|
+
## Goal
|
|
351600
|
+
Prefer responding in **${language}** for normal assistant messages and explanations.
|
|
351601
|
+
|
|
351602
|
+
## Keep technical artifacts unchanged
|
|
351603
|
+
Do **not** translate or rewrite:
|
|
351604
|
+
- Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
|
|
351605
|
+
- Exact quoted text from the user (keep quotes verbatim)
|
|
351606
|
+
|
|
351607
|
+
## When a conflict exists
|
|
351608
|
+
If higher-priority instructions (system/developer) require a different behavior, follow them.
|
|
351609
|
+
|
|
351610
|
+
## Tool / system outputs
|
|
351611
|
+
Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
|
|
351612
|
+
`;
|
|
351613
|
+
}
|
|
351614
|
+
__name(generateLlmOutputLanguageRule, "generateLlmOutputLanguageRule");
|
|
351615
|
+
function getLlmOutputLanguageRulePath() {
|
|
351616
|
+
return path86.join(
|
|
351617
|
+
Storage.getGlobalQwenDir(),
|
|
351618
|
+
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
351619
|
+
);
|
|
351620
|
+
}
|
|
351621
|
+
__name(getLlmOutputLanguageRulePath, "getLlmOutputLanguageRulePath");
|
|
351622
|
+
function normalizeLanguageName(language) {
|
|
351623
|
+
const lowered = language.toLowerCase();
|
|
351624
|
+
const fullName = getLanguageNameFromLocale(lowered);
|
|
351625
|
+
if (fullName !== "English" || lowered === "en") {
|
|
351626
|
+
return fullName;
|
|
351627
|
+
}
|
|
351628
|
+
return language;
|
|
351629
|
+
}
|
|
351630
|
+
__name(normalizeLanguageName, "normalizeLanguageName");
|
|
351631
|
+
function extractLlmOutputLanguageFromRuleFileContent(content) {
|
|
351632
|
+
const markerMatch = content.match(
|
|
351633
|
+
new RegExp(
|
|
351634
|
+
String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
|
|
351635
|
+
"i"
|
|
351636
|
+
)
|
|
351637
|
+
);
|
|
351638
|
+
if (markerMatch?.[1]) {
|
|
351639
|
+
const lang = markerMatch[1].trim();
|
|
351640
|
+
if (lang) return lang;
|
|
351641
|
+
}
|
|
351642
|
+
const headingMatch = content.match(
|
|
351643
|
+
/^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
|
|
351644
|
+
);
|
|
351645
|
+
if (headingMatch?.[1]) {
|
|
351646
|
+
const lang = headingMatch[1].trim();
|
|
351647
|
+
if (lang) return lang;
|
|
351648
|
+
}
|
|
351649
|
+
return null;
|
|
351650
|
+
}
|
|
351651
|
+
__name(extractLlmOutputLanguageFromRuleFileContent, "extractLlmOutputLanguageFromRuleFileContent");
|
|
351652
|
+
function initializeLlmOutputLanguage() {
|
|
351653
|
+
const filePath = getLlmOutputLanguageRulePath();
|
|
351654
|
+
if (fs80.existsSync(filePath)) {
|
|
351655
|
+
return;
|
|
351656
|
+
}
|
|
351657
|
+
const detectedLocale = detectSystemLanguage();
|
|
351658
|
+
const languageName = getLanguageNameFromLocale(detectedLocale);
|
|
351659
|
+
const content = generateLlmOutputLanguageRule(languageName);
|
|
351660
|
+
const dir = path86.dirname(filePath);
|
|
351661
|
+
fs80.mkdirSync(dir, { recursive: true });
|
|
351662
|
+
fs80.writeFileSync(filePath, content, "utf-8");
|
|
351663
|
+
}
|
|
351664
|
+
__name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
|
|
351665
|
+
function getCurrentLlmOutputLanguage() {
|
|
351666
|
+
const filePath = getLlmOutputLanguageRulePath();
|
|
351667
|
+
if (fs80.existsSync(filePath)) {
|
|
351668
|
+
try {
|
|
351669
|
+
const content = fs80.readFileSync(filePath, "utf-8");
|
|
351670
|
+
return extractLlmOutputLanguageFromRuleFileContent(content);
|
|
351671
|
+
} catch {
|
|
351672
|
+
}
|
|
351673
|
+
}
|
|
351674
|
+
return null;
|
|
351675
|
+
}
|
|
351676
|
+
__name(getCurrentLlmOutputLanguage, "getCurrentLlmOutputLanguage");
|
|
351677
|
+
async function setUiLanguage(context2, lang) {
|
|
351678
|
+
const { services } = context2;
|
|
351679
|
+
const { settings } = services;
|
|
351680
|
+
if (!services.config) {
|
|
351681
|
+
return {
|
|
351682
|
+
type: "message",
|
|
351683
|
+
messageType: "error",
|
|
351684
|
+
content: t4("Configuration not available.")
|
|
351685
|
+
};
|
|
351686
|
+
}
|
|
351687
|
+
await setLanguageAsync(lang);
|
|
351688
|
+
if (settings && typeof settings.setValue === "function") {
|
|
351689
|
+
try {
|
|
351690
|
+
settings.setValue("User" /* User */, "general.language", lang);
|
|
351691
|
+
} catch (error2) {
|
|
351692
|
+
console.warn("Failed to save language setting:", error2);
|
|
351693
|
+
}
|
|
351694
|
+
}
|
|
351695
|
+
context2.ui.reloadCommands();
|
|
351696
|
+
return {
|
|
351697
|
+
type: "message",
|
|
351698
|
+
messageType: "info",
|
|
351699
|
+
content: t4("UI language changed to {{lang}}", {
|
|
351700
|
+
lang: formatUiLanguageDisplay(lang)
|
|
351701
|
+
})
|
|
351702
|
+
};
|
|
351703
|
+
}
|
|
351704
|
+
__name(setUiLanguage, "setUiLanguage");
|
|
351705
|
+
function generateLlmOutputLanguageRuleFile(language) {
|
|
351706
|
+
try {
|
|
351707
|
+
const filePath = getLlmOutputLanguageRulePath();
|
|
351708
|
+
const normalizedLanguage = normalizeLanguageName(language);
|
|
351709
|
+
const content = generateLlmOutputLanguageRule(normalizedLanguage);
|
|
351710
|
+
const dir = path86.dirname(filePath);
|
|
351711
|
+
fs80.mkdirSync(dir, { recursive: true });
|
|
351712
|
+
fs80.writeFileSync(filePath, content, "utf-8");
|
|
351713
|
+
return Promise.resolve({
|
|
351714
|
+
type: "message",
|
|
351715
|
+
messageType: "info",
|
|
351716
|
+
content: [
|
|
351717
|
+
t4("LLM output language rule file generated at {{path}}", {
|
|
351718
|
+
path: filePath
|
|
351719
|
+
}),
|
|
351720
|
+
"",
|
|
351721
|
+
t4("Please restart the application for the changes to take effect.")
|
|
351722
|
+
].join("\n")
|
|
351723
|
+
});
|
|
351724
|
+
} catch (error2) {
|
|
351725
|
+
return Promise.resolve({
|
|
351726
|
+
type: "message",
|
|
351727
|
+
messageType: "error",
|
|
351728
|
+
content: t4(
|
|
351729
|
+
"Failed to generate LLM output language rule file: {{error}}",
|
|
351730
|
+
{
|
|
351731
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
351732
|
+
}
|
|
351733
|
+
)
|
|
351734
|
+
});
|
|
351735
|
+
}
|
|
351736
|
+
}
|
|
351737
|
+
__name(generateLlmOutputLanguageRuleFile, "generateLlmOutputLanguageRuleFile");
|
|
351738
|
+
var languageCommand = {
|
|
351739
|
+
name: "language",
|
|
351740
|
+
get description() {
|
|
351741
|
+
return t4("View or change the language setting");
|
|
351742
|
+
},
|
|
351743
|
+
kind: "built-in" /* BUILT_IN */,
|
|
351744
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
351745
|
+
const { services } = context2;
|
|
351746
|
+
if (!services.config) {
|
|
351747
|
+
return {
|
|
351748
|
+
type: "message",
|
|
351749
|
+
messageType: "error",
|
|
351750
|
+
content: t4("Configuration not available.")
|
|
351751
|
+
};
|
|
351752
|
+
}
|
|
351753
|
+
const trimmedArgs = args.trim();
|
|
351754
|
+
const parts = trimmedArgs.split(/\s+/);
|
|
351755
|
+
const firstArg = parts[0].toLowerCase();
|
|
351756
|
+
const subArgs = parts.slice(1).join(" ");
|
|
351757
|
+
if (firstArg === "ui" || firstArg === "output") {
|
|
351758
|
+
const subCommand = languageCommand.subCommands?.find(
|
|
351759
|
+
(s5) => s5.name === firstArg
|
|
351760
|
+
);
|
|
351761
|
+
if (subCommand?.action) {
|
|
351762
|
+
return subCommand.action(
|
|
351763
|
+
context2,
|
|
351764
|
+
subArgs
|
|
351765
|
+
);
|
|
351766
|
+
}
|
|
351767
|
+
}
|
|
351768
|
+
if (!trimmedArgs) {
|
|
351769
|
+
const currentUiLang = getCurrentLanguage();
|
|
351770
|
+
const currentLlmLang = getCurrentLlmOutputLanguage();
|
|
351771
|
+
const message = [
|
|
351772
|
+
t4("Current UI language: {{lang}}", {
|
|
351773
|
+
lang: formatUiLanguageDisplay(currentUiLang)
|
|
351774
|
+
}),
|
|
351775
|
+
currentLlmLang ? t4("Current LLM output language: {{lang}}", { lang: currentLlmLang }) : t4("LLM output language not set"),
|
|
351776
|
+
"",
|
|
351777
|
+
t4("Available subcommands:"),
|
|
351778
|
+
` /language ui [${SUPPORTED_LANGUAGES.map((o3) => o3.id).join("|")}] - ${t4("Set UI language")}`,
|
|
351779
|
+
` /language output <language> - ${t4("Set LLM output language")}`
|
|
351780
|
+
].join("\n");
|
|
351781
|
+
return {
|
|
351782
|
+
type: "message",
|
|
351783
|
+
messageType: "info",
|
|
351784
|
+
content: message
|
|
351785
|
+
};
|
|
351786
|
+
}
|
|
351787
|
+
const targetLang = parseUiLanguageArg(trimmedArgs);
|
|
351788
|
+
if (targetLang) {
|
|
351789
|
+
return setUiLanguage(context2, targetLang);
|
|
351790
|
+
}
|
|
351791
|
+
return {
|
|
351792
|
+
type: "message",
|
|
351793
|
+
messageType: "error",
|
|
351794
|
+
content: [
|
|
351795
|
+
t4("Invalid command. Available subcommands:"),
|
|
351796
|
+
` - /language ui [${SUPPORTED_LANGUAGES.map((o3) => o3.id).join("|")}] - ${t4("Set UI language")}`,
|
|
351797
|
+
" - /language output <language> - " + t4("Set LLM output language")
|
|
351798
|
+
].join("\n")
|
|
351799
|
+
};
|
|
351800
|
+
}, "action"),
|
|
351801
|
+
subCommands: [
|
|
351802
|
+
{
|
|
351803
|
+
name: "ui",
|
|
351804
|
+
get description() {
|
|
351805
|
+
return t4("Set UI language");
|
|
351806
|
+
},
|
|
351807
|
+
kind: "built-in" /* BUILT_IN */,
|
|
351808
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
351809
|
+
const trimmedArgs = args.trim();
|
|
351810
|
+
if (!trimmedArgs) {
|
|
351811
|
+
return {
|
|
351812
|
+
type: "message",
|
|
351813
|
+
messageType: "info",
|
|
351814
|
+
content: [
|
|
351815
|
+
t4("Set UI language"),
|
|
351816
|
+
"",
|
|
351817
|
+
t4("Usage: /language ui [{{options}}]", {
|
|
351818
|
+
options: SUPPORTED_LANGUAGES.map((o3) => o3.id).join("|")
|
|
351819
|
+
}),
|
|
351820
|
+
"",
|
|
351821
|
+
t4("Available options:"),
|
|
351822
|
+
...SUPPORTED_LANGUAGES.map(
|
|
351823
|
+
(o3) => ` - ${o3.id}: ${t4(o3.fullName)}`
|
|
351824
|
+
),
|
|
351825
|
+
"",
|
|
351826
|
+
t4(
|
|
351827
|
+
"To request additional UI language packs, please open an issue on GitHub."
|
|
351828
|
+
)
|
|
351829
|
+
].join("\n")
|
|
351830
|
+
};
|
|
351831
|
+
}
|
|
351832
|
+
const targetLang = parseUiLanguageArg(trimmedArgs);
|
|
351833
|
+
if (!targetLang) {
|
|
351834
|
+
return {
|
|
351835
|
+
type: "message",
|
|
351836
|
+
messageType: "error",
|
|
351837
|
+
content: t4("Invalid language. Available: {{options}}", {
|
|
351838
|
+
options: SUPPORTED_LANGUAGES.map((o3) => o3.id).join(",")
|
|
351839
|
+
})
|
|
351840
|
+
};
|
|
351841
|
+
}
|
|
351842
|
+
return setUiLanguage(context2, targetLang);
|
|
351843
|
+
}, "action"),
|
|
351844
|
+
subCommands: SUPPORTED_LANGUAGES.map(createUiLanguageSubCommand)
|
|
351845
|
+
},
|
|
351846
|
+
{
|
|
351847
|
+
name: "output",
|
|
351848
|
+
get description() {
|
|
351849
|
+
return t4("Set LLM output language");
|
|
351850
|
+
},
|
|
351851
|
+
kind: "built-in" /* BUILT_IN */,
|
|
351852
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
351853
|
+
const trimmedArgs = args.trim();
|
|
351854
|
+
if (!trimmedArgs) {
|
|
351855
|
+
return {
|
|
351856
|
+
type: "message",
|
|
351857
|
+
messageType: "info",
|
|
351858
|
+
content: [
|
|
351859
|
+
t4("Set LLM output language"),
|
|
351860
|
+
"",
|
|
351861
|
+
t4("Usage: /language output <language>"),
|
|
351862
|
+
` ${t4("Example: /language output \u4E2D\u6587")}`,
|
|
351863
|
+
` ${t4("Example: /language output English")}`,
|
|
351864
|
+
` ${t4("Example: /language output \u65E5\u672C\u8A9E")}`
|
|
351865
|
+
].join("\n")
|
|
351866
|
+
};
|
|
351867
|
+
}
|
|
351868
|
+
return generateLlmOutputLanguageRuleFile(trimmedArgs);
|
|
351869
|
+
}, "action")
|
|
351870
|
+
}
|
|
351871
|
+
]
|
|
351872
|
+
};
|
|
351873
|
+
function createUiLanguageSubCommand(option2) {
|
|
351874
|
+
return {
|
|
351875
|
+
name: option2.id,
|
|
351876
|
+
get description() {
|
|
351877
|
+
return t4("Set UI language to {{name}}", { name: option2.fullName });
|
|
351878
|
+
},
|
|
351879
|
+
kind: "built-in" /* BUILT_IN */,
|
|
351880
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
351881
|
+
if (args.trim().length > 0) {
|
|
351882
|
+
return {
|
|
351883
|
+
type: "message",
|
|
351884
|
+
messageType: "error",
|
|
351885
|
+
content: t4(
|
|
351886
|
+
"Language subcommands do not accept additional arguments."
|
|
351887
|
+
)
|
|
351888
|
+
};
|
|
351889
|
+
}
|
|
351890
|
+
return setUiLanguage(context2, option2.code);
|
|
351891
|
+
}, "action")
|
|
351892
|
+
};
|
|
351893
|
+
}
|
|
351894
|
+
__name(createUiLanguageSubCommand, "createUiLanguageSubCommand");
|
|
351895
|
+
|
|
351628
351896
|
// packages/cli/src/core/initializer.ts
|
|
351629
351897
|
async function initializeApp(config2, settings) {
|
|
351630
351898
|
const languageSetting = process.env["RDMind_LANG"] || settings.merged.general?.language || "auto";
|
|
351631
351899
|
await initializeI18n(languageSetting);
|
|
351900
|
+
initializeLlmOutputLanguage();
|
|
351632
351901
|
const authType = settings.merged.security?.auth?.selectedType;
|
|
351633
351902
|
const authError = await performInitialAuth(config2, authType);
|
|
351634
351903
|
if (authError) {
|
|
@@ -351761,6 +352030,108 @@ import { randomUUID as randomUUID7 } from "node:crypto";
|
|
|
351761
352030
|
init_esbuild_shims();
|
|
351762
352031
|
init_core5();
|
|
351763
352032
|
|
|
352033
|
+
// packages/cli/src/ui/utils/computeStats.ts
|
|
352034
|
+
init_esbuild_shims();
|
|
352035
|
+
function calculateErrorRate(metrics2) {
|
|
352036
|
+
if (metrics2.api.totalRequests === 0) {
|
|
352037
|
+
return 0;
|
|
352038
|
+
}
|
|
352039
|
+
return metrics2.api.totalErrors / metrics2.api.totalRequests * 100;
|
|
352040
|
+
}
|
|
352041
|
+
__name(calculateErrorRate, "calculateErrorRate");
|
|
352042
|
+
function calculateAverageLatency(metrics2) {
|
|
352043
|
+
if (metrics2.api.totalRequests === 0) {
|
|
352044
|
+
return 0;
|
|
352045
|
+
}
|
|
352046
|
+
return metrics2.api.totalLatencyMs / metrics2.api.totalRequests;
|
|
352047
|
+
}
|
|
352048
|
+
__name(calculateAverageLatency, "calculateAverageLatency");
|
|
352049
|
+
function calculateCacheHitRate(metrics2) {
|
|
352050
|
+
if (metrics2.tokens.prompt === 0) {
|
|
352051
|
+
return 0;
|
|
352052
|
+
}
|
|
352053
|
+
return metrics2.tokens.cached / metrics2.tokens.prompt * 100;
|
|
352054
|
+
}
|
|
352055
|
+
__name(calculateCacheHitRate, "calculateCacheHitRate");
|
|
352056
|
+
var computeSessionStats = /* @__PURE__ */ __name((metrics2) => {
|
|
352057
|
+
const { models, tools, files } = metrics2;
|
|
352058
|
+
const totalApiTime = Object.values(models).reduce(
|
|
352059
|
+
(acc, model) => acc + model.api.totalLatencyMs,
|
|
352060
|
+
0
|
|
352061
|
+
);
|
|
352062
|
+
const totalToolTime = tools.totalDurationMs;
|
|
352063
|
+
const agentActiveTime = totalApiTime + totalToolTime;
|
|
352064
|
+
const apiTimePercent = agentActiveTime > 0 ? totalApiTime / agentActiveTime * 100 : 0;
|
|
352065
|
+
const toolTimePercent = agentActiveTime > 0 ? totalToolTime / agentActiveTime * 100 : 0;
|
|
352066
|
+
const totalCachedTokens = Object.values(models).reduce(
|
|
352067
|
+
(acc, model) => acc + model.tokens.cached,
|
|
352068
|
+
0
|
|
352069
|
+
);
|
|
352070
|
+
const totalPromptTokens = Object.values(models).reduce(
|
|
352071
|
+
(acc, model) => acc + model.tokens.prompt,
|
|
352072
|
+
0
|
|
352073
|
+
);
|
|
352074
|
+
const cacheEfficiency = totalPromptTokens > 0 ? totalCachedTokens / totalPromptTokens * 100 : 0;
|
|
352075
|
+
const totalDecisions = tools.totalDecisions.accept + tools.totalDecisions.reject + tools.totalDecisions.modify;
|
|
352076
|
+
const successRate = tools.totalCalls > 0 ? tools.totalSuccess / tools.totalCalls * 100 : 0;
|
|
352077
|
+
const agreementRate = totalDecisions > 0 ? tools.totalDecisions.accept / totalDecisions * 100 : 0;
|
|
352078
|
+
return {
|
|
352079
|
+
totalApiTime,
|
|
352080
|
+
totalToolTime,
|
|
352081
|
+
agentActiveTime,
|
|
352082
|
+
apiTimePercent,
|
|
352083
|
+
toolTimePercent,
|
|
352084
|
+
cacheEfficiency,
|
|
352085
|
+
totalDecisions,
|
|
352086
|
+
successRate,
|
|
352087
|
+
agreementRate,
|
|
352088
|
+
totalCachedTokens,
|
|
352089
|
+
totalPromptTokens,
|
|
352090
|
+
totalLinesAdded: files.totalLinesAdded,
|
|
352091
|
+
totalLinesRemoved: files.totalLinesRemoved
|
|
352092
|
+
};
|
|
352093
|
+
}, "computeSessionStats");
|
|
352094
|
+
|
|
352095
|
+
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
352096
|
+
init_esbuild_shims();
|
|
352097
|
+
|
|
352098
|
+
// packages/cli/src/utils/commands.ts
|
|
352099
|
+
init_esbuild_shims();
|
|
352100
|
+
var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
352101
|
+
const trimmed2 = query.trim();
|
|
352102
|
+
const parts = trimmed2.substring(1).trim().split(/\s+/);
|
|
352103
|
+
const commandPath = parts.filter((p2) => p2);
|
|
352104
|
+
let currentCommands = commands;
|
|
352105
|
+
let commandToExecute;
|
|
352106
|
+
let pathIndex = 0;
|
|
352107
|
+
const canonicalPath = [];
|
|
352108
|
+
for (const part of commandPath) {
|
|
352109
|
+
let foundCommand = currentCommands.find((cmd) => cmd.name === part);
|
|
352110
|
+
if (!foundCommand) {
|
|
352111
|
+
foundCommand = currentCommands.find(
|
|
352112
|
+
(cmd) => cmd.altNames?.includes(part)
|
|
352113
|
+
);
|
|
352114
|
+
}
|
|
352115
|
+
if (foundCommand) {
|
|
352116
|
+
commandToExecute = foundCommand;
|
|
352117
|
+
canonicalPath.push(foundCommand.name);
|
|
352118
|
+
pathIndex++;
|
|
352119
|
+
if (foundCommand.subCommands) {
|
|
352120
|
+
currentCommands = foundCommand.subCommands;
|
|
352121
|
+
} else {
|
|
352122
|
+
break;
|
|
352123
|
+
}
|
|
352124
|
+
} else {
|
|
352125
|
+
break;
|
|
352126
|
+
}
|
|
352127
|
+
}
|
|
352128
|
+
const args = parts.slice(pathIndex).join(" ");
|
|
352129
|
+
return { commandToExecute, args, canonicalPath };
|
|
352130
|
+
}, "parseSlashCommand");
|
|
352131
|
+
|
|
352132
|
+
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
352133
|
+
init_core5();
|
|
352134
|
+
|
|
351764
352135
|
// packages/cli/src/services/CommandService.ts
|
|
351765
352136
|
init_esbuild_shims();
|
|
351766
352137
|
var CommandService = class _CommandService {
|
|
@@ -351844,9 +352215,6 @@ init_esbuild_shims();
|
|
|
351844
352215
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
351845
352216
|
init_esbuild_shims();
|
|
351846
352217
|
|
|
351847
|
-
// packages/cli/src/ui/commands/types.ts
|
|
351848
|
-
init_esbuild_shims();
|
|
351849
|
-
|
|
351850
352218
|
// packages/cli/src/ui/types.ts
|
|
351851
352219
|
init_esbuild_shims();
|
|
351852
352220
|
var import_react26 = __toESM(require_react(), 1);
|
|
@@ -351930,7 +352298,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
351930
352298
|
|
|
351931
352299
|
// packages/cli/src/generated/git-commit.ts
|
|
351932
352300
|
init_esbuild_shims();
|
|
351933
|
-
var GIT_COMMIT_INFO2 = "
|
|
352301
|
+
var GIT_COMMIT_INFO2 = "0d78b913";
|
|
351934
352302
|
|
|
351935
352303
|
// packages/cli/src/utils/systemInfo.ts
|
|
351936
352304
|
async function getNpmVersion() {
|
|
@@ -352345,7 +352713,8 @@ var compressCommand = {
|
|
|
352345
352713
|
kind: "built-in" /* BUILT_IN */,
|
|
352346
352714
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
352347
352715
|
const { ui: ui2 } = context2;
|
|
352348
|
-
|
|
352716
|
+
const executionMode = context2.executionMode ?? "interactive";
|
|
352717
|
+
if (executionMode === "interactive" && ui2.pendingItem) {
|
|
352349
352718
|
ui2.addItem(
|
|
352350
352719
|
{
|
|
352351
352720
|
type: "error" /* ERROR */,
|
|
@@ -352364,11 +352733,72 @@ var compressCommand = {
|
|
|
352364
352733
|
compressionStatus: null
|
|
352365
352734
|
}
|
|
352366
352735
|
};
|
|
352367
|
-
|
|
352368
|
-
|
|
352736
|
+
const config2 = context2.services.config;
|
|
352737
|
+
const geminiClient = config2?.getGeminiClient();
|
|
352738
|
+
if (!config2 || !geminiClient) {
|
|
352739
|
+
return {
|
|
352740
|
+
type: "message",
|
|
352741
|
+
messageType: "error",
|
|
352742
|
+
content: t4("Config not loaded.")
|
|
352743
|
+
};
|
|
352744
|
+
}
|
|
352745
|
+
const doCompress = /* @__PURE__ */ __name(async () => {
|
|
352369
352746
|
const promptId = `compress-${Date.now()}`;
|
|
352370
|
-
|
|
352371
|
-
|
|
352747
|
+
return await geminiClient.tryCompressChat(promptId, true);
|
|
352748
|
+
}, "doCompress");
|
|
352749
|
+
if (executionMode === "acp") {
|
|
352750
|
+
const messages = /* @__PURE__ */ __name(async function* () {
|
|
352751
|
+
try {
|
|
352752
|
+
yield {
|
|
352753
|
+
messageType: "info",
|
|
352754
|
+
content: "Compressing context..."
|
|
352755
|
+
};
|
|
352756
|
+
const compressed = await doCompress();
|
|
352757
|
+
if (!compressed) {
|
|
352758
|
+
yield {
|
|
352759
|
+
messageType: "error",
|
|
352760
|
+
content: t4("Failed to compress chat history.")
|
|
352761
|
+
};
|
|
352762
|
+
return;
|
|
352763
|
+
}
|
|
352764
|
+
yield {
|
|
352765
|
+
messageType: "info",
|
|
352766
|
+
content: `Context compressed (${compressed.originalTokenCount} -> ${compressed.newTokenCount}).`
|
|
352767
|
+
};
|
|
352768
|
+
} catch (e4) {
|
|
352769
|
+
yield {
|
|
352770
|
+
messageType: "error",
|
|
352771
|
+
content: t4("Failed to compress chat history: {{error}}", {
|
|
352772
|
+
error: e4 instanceof Error ? e4.message : String(e4)
|
|
352773
|
+
})
|
|
352774
|
+
};
|
|
352775
|
+
}
|
|
352776
|
+
}, "messages");
|
|
352777
|
+
return { type: "stream_messages", messages: messages() };
|
|
352778
|
+
}
|
|
352779
|
+
try {
|
|
352780
|
+
if (executionMode === "interactive") {
|
|
352781
|
+
ui2.setPendingItem(pendingMessage);
|
|
352782
|
+
}
|
|
352783
|
+
const compressed = await doCompress();
|
|
352784
|
+
if (!compressed) {
|
|
352785
|
+
if (executionMode === "interactive") {
|
|
352786
|
+
ui2.addItem(
|
|
352787
|
+
{
|
|
352788
|
+
type: "error" /* ERROR */,
|
|
352789
|
+
text: t4("Failed to compress chat history.")
|
|
352790
|
+
},
|
|
352791
|
+
Date.now()
|
|
352792
|
+
);
|
|
352793
|
+
return;
|
|
352794
|
+
}
|
|
352795
|
+
return {
|
|
352796
|
+
type: "message",
|
|
352797
|
+
messageType: "error",
|
|
352798
|
+
content: t4("Failed to compress chat history.")
|
|
352799
|
+
};
|
|
352800
|
+
}
|
|
352801
|
+
if (executionMode === "interactive") {
|
|
352372
352802
|
ui2.addItem(
|
|
352373
352803
|
{
|
|
352374
352804
|
type: "compression" /* COMPRESSION */,
|
|
@@ -352381,27 +352811,37 @@ var compressCommand = {
|
|
|
352381
352811
|
},
|
|
352382
352812
|
Date.now()
|
|
352383
352813
|
);
|
|
352384
|
-
|
|
352814
|
+
return;
|
|
352815
|
+
}
|
|
352816
|
+
return {
|
|
352817
|
+
type: "message",
|
|
352818
|
+
messageType: "info",
|
|
352819
|
+
content: `Context compressed (${compressed.originalTokenCount} -> ${compressed.newTokenCount}).`
|
|
352820
|
+
};
|
|
352821
|
+
} catch (e4) {
|
|
352822
|
+
if (executionMode === "interactive") {
|
|
352385
352823
|
ui2.addItem(
|
|
352386
352824
|
{
|
|
352387
352825
|
type: "error" /* ERROR */,
|
|
352388
|
-
text: t4("Failed to compress chat history
|
|
352826
|
+
text: t4("Failed to compress chat history: {{error}}", {
|
|
352827
|
+
error: e4 instanceof Error ? e4.message : String(e4)
|
|
352828
|
+
})
|
|
352389
352829
|
},
|
|
352390
352830
|
Date.now()
|
|
352391
352831
|
);
|
|
352832
|
+
return;
|
|
352392
352833
|
}
|
|
352393
|
-
|
|
352394
|
-
|
|
352395
|
-
|
|
352396
|
-
|
|
352397
|
-
|
|
352398
|
-
|
|
352399
|
-
|
|
352400
|
-
},
|
|
352401
|
-
Date.now()
|
|
352402
|
-
);
|
|
352834
|
+
return {
|
|
352835
|
+
type: "message",
|
|
352836
|
+
messageType: "error",
|
|
352837
|
+
content: t4("Failed to compress chat history: {{error}}", {
|
|
352838
|
+
error: e4 instanceof Error ? e4.message : String(e4)
|
|
352839
|
+
})
|
|
352840
|
+
};
|
|
352403
352841
|
} finally {
|
|
352404
|
-
|
|
352842
|
+
if (executionMode === "interactive") {
|
|
352843
|
+
ui2.setPendingItem(null);
|
|
352844
|
+
}
|
|
352405
352845
|
}
|
|
352406
352846
|
}, "action")
|
|
352407
352847
|
};
|
|
@@ -352455,11 +352895,11 @@ var copyCommand = {
|
|
|
352455
352895
|
|
|
352456
352896
|
// packages/cli/src/ui/commands/createCommand.ts
|
|
352457
352897
|
init_esbuild_shims();
|
|
352458
|
-
import * as
|
|
352459
|
-
import * as
|
|
352898
|
+
import * as fs81 from "fs";
|
|
352899
|
+
import * as path87 from "path";
|
|
352460
352900
|
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
352461
352901
|
var __filename6 = fileURLToPath14(import.meta.url);
|
|
352462
|
-
var __dirname9 =
|
|
352902
|
+
var __dirname9 = path87.dirname(__filename6);
|
|
352463
352903
|
function validateProjectName(name3) {
|
|
352464
352904
|
return /^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(name3);
|
|
352465
352905
|
}
|
|
@@ -352473,20 +352913,20 @@ function getIdlExamplePath() {
|
|
|
352473
352913
|
// 1. npm 发布:
|
|
352474
352914
|
// __dirname 就是 node_modules/@rdmind/rdmind/
|
|
352475
352915
|
// 模板在 node_modules/@rdmind/rdmind/templates/
|
|
352476
|
-
|
|
352916
|
+
path87.join(__dirname9, "templates", "idl-template/wiki/example"),
|
|
352477
352917
|
// 2. 开发环境:相对于工作区根目录的idl-template
|
|
352478
|
-
|
|
352918
|
+
path87.join(
|
|
352479
352919
|
__dirname9,
|
|
352480
352920
|
"..",
|
|
352481
352921
|
"packages/cli/templates/idl-template/wiki/example"
|
|
352482
352922
|
)
|
|
352483
352923
|
];
|
|
352484
352924
|
for (const templatePath of possiblePaths) {
|
|
352485
|
-
if (
|
|
352925
|
+
if (fs81.existsSync(templatePath)) {
|
|
352486
352926
|
return templatePath;
|
|
352487
352927
|
}
|
|
352488
352928
|
}
|
|
352489
|
-
return
|
|
352929
|
+
return path87.join(process.cwd(), "idl-template");
|
|
352490
352930
|
}
|
|
352491
352931
|
__name(getIdlExamplePath, "getIdlExamplePath");
|
|
352492
352932
|
function getTemplatePath() {
|
|
@@ -352494,16 +352934,16 @@ function getTemplatePath() {
|
|
|
352494
352934
|
// 1. npm 安装
|
|
352495
352935
|
// __dirname 就是 node_modules/@rdmind/rdmind/
|
|
352496
352936
|
// 模板在 node_modules/@rdmind/rdmind/template/
|
|
352497
|
-
|
|
352937
|
+
path87.join(__dirname9, "template"),
|
|
352498
352938
|
// 2. 开发环境:
|
|
352499
|
-
|
|
352939
|
+
path87.join(__dirname9, "..", "packages/cli/template")
|
|
352500
352940
|
];
|
|
352501
352941
|
for (const templatePath of possiblePaths) {
|
|
352502
|
-
if (
|
|
352942
|
+
if (fs81.existsSync(templatePath)) {
|
|
352503
352943
|
return templatePath;
|
|
352504
352944
|
}
|
|
352505
352945
|
}
|
|
352506
|
-
return
|
|
352946
|
+
return path87.join(process.cwd(), "sns-demo");
|
|
352507
352947
|
}
|
|
352508
352948
|
__name(getTemplatePath, "getTemplatePath");
|
|
352509
352949
|
function replaceIdlProjectNames(content, oldName, newName) {
|
|
@@ -352547,18 +352987,18 @@ function replaceProjectNames(content, oldName, newName, businessModule) {
|
|
|
352547
352987
|
}
|
|
352548
352988
|
__name(replaceProjectNames, "replaceProjectNames");
|
|
352549
352989
|
async function copyAndReplaceFile(srcFile, destFile, oldName, newName, businessModule, isIdlProject = false) {
|
|
352550
|
-
const destDir =
|
|
352551
|
-
if (!
|
|
352552
|
-
|
|
352990
|
+
const destDir = path87.dirname(destFile);
|
|
352991
|
+
if (!fs81.existsSync(destDir)) {
|
|
352992
|
+
fs81.mkdirSync(destDir, { recursive: true });
|
|
352553
352993
|
}
|
|
352554
|
-
const content =
|
|
352994
|
+
const content = fs81.readFileSync(srcFile, "utf8");
|
|
352555
352995
|
let newContent;
|
|
352556
352996
|
if (isIdlProject) {
|
|
352557
352997
|
newContent = replaceIdlProjectNames(content, oldName, newName);
|
|
352558
352998
|
} else {
|
|
352559
352999
|
newContent = replaceProjectNames(content, oldName, newName, businessModule);
|
|
352560
353000
|
}
|
|
352561
|
-
|
|
353001
|
+
fs81.writeFileSync(destFile, newContent, "utf8");
|
|
352562
353002
|
}
|
|
352563
353003
|
__name(copyAndReplaceFile, "copyAndReplaceFile");
|
|
352564
353004
|
function shouldSkipItem(itemName) {
|
|
@@ -352596,12 +353036,12 @@ function shouldSkipItem(itemName) {
|
|
|
352596
353036
|
}
|
|
352597
353037
|
__name(shouldSkipItem, "shouldSkipItem");
|
|
352598
353038
|
async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModule, isIdlProject = false) {
|
|
352599
|
-
if (!
|
|
352600
|
-
|
|
353039
|
+
if (!fs81.existsSync(destDir)) {
|
|
353040
|
+
fs81.mkdirSync(destDir, { recursive: true });
|
|
352601
353041
|
}
|
|
352602
|
-
const items =
|
|
353042
|
+
const items = fs81.readdirSync(srcDir);
|
|
352603
353043
|
for (const item of items) {
|
|
352604
|
-
const srcPath =
|
|
353044
|
+
const srcPath = path87.join(srcDir, item);
|
|
352605
353045
|
if (shouldSkipItem(item)) {
|
|
352606
353046
|
continue;
|
|
352607
353047
|
}
|
|
@@ -352614,7 +353054,7 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
|
|
|
352614
353054
|
const pathParts = packageDirName.split("-");
|
|
352615
353055
|
const currentDestPath = destDir;
|
|
352616
353056
|
for (let i3 = 0; i3 < pathParts.length; i3++) {
|
|
352617
|
-
const partPath =
|
|
353057
|
+
const partPath = path87.join(
|
|
352618
353058
|
currentDestPath,
|
|
352619
353059
|
...pathParts.slice(0, i3 + 1)
|
|
352620
353060
|
);
|
|
@@ -352628,8 +353068,8 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
|
|
|
352628
353068
|
isIdlProject
|
|
352629
353069
|
);
|
|
352630
353070
|
} else {
|
|
352631
|
-
if (!
|
|
352632
|
-
|
|
353071
|
+
if (!fs81.existsSync(partPath)) {
|
|
353072
|
+
fs81.mkdirSync(partPath, { recursive: true });
|
|
352633
353073
|
}
|
|
352634
353074
|
}
|
|
352635
353075
|
}
|
|
@@ -352646,8 +353086,8 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
|
|
|
352646
353086
|
destItemName = item.replace(/sns-demo/g, newName);
|
|
352647
353087
|
}
|
|
352648
353088
|
}
|
|
352649
|
-
const destPath =
|
|
352650
|
-
const stats =
|
|
353089
|
+
const destPath = path87.join(destDir, destItemName);
|
|
353090
|
+
const stats = fs81.statSync(srcPath);
|
|
352651
353091
|
if (stats.isDirectory()) {
|
|
352652
353092
|
await copyAndReplaceDir(
|
|
352653
353093
|
srcPath,
|
|
@@ -352672,7 +353112,7 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
|
|
|
352672
353112
|
__name(copyAndReplaceDir, "copyAndReplaceDir");
|
|
352673
353113
|
async function createJavaProject(context2, projectName, businessModule) {
|
|
352674
353114
|
const templatePath = getTemplatePath();
|
|
352675
|
-
if (!
|
|
353115
|
+
if (!fs81.existsSync(templatePath)) {
|
|
352676
353116
|
context2.ui.addItem(
|
|
352677
353117
|
{
|
|
352678
353118
|
type: "error" /* ERROR */,
|
|
@@ -352683,8 +353123,8 @@ async function createJavaProject(context2, projectName, businessModule) {
|
|
|
352683
353123
|
);
|
|
352684
353124
|
return;
|
|
352685
353125
|
}
|
|
352686
|
-
const targetPath =
|
|
352687
|
-
if (
|
|
353126
|
+
const targetPath = path87.join(process.cwd(), projectName);
|
|
353127
|
+
if (fs81.existsSync(targetPath)) {
|
|
352688
353128
|
context2.ui.addItem(
|
|
352689
353129
|
{
|
|
352690
353130
|
type: "error" /* ERROR */,
|
|
@@ -352733,9 +353173,9 @@ ${projectName}/
|
|
|
352733
353173
|
Date.now()
|
|
352734
353174
|
);
|
|
352735
353175
|
} catch (error2) {
|
|
352736
|
-
if (
|
|
353176
|
+
if (fs81.existsSync(targetPath)) {
|
|
352737
353177
|
try {
|
|
352738
|
-
|
|
353178
|
+
fs81.rmSync(targetPath, { recursive: true, force: true });
|
|
352739
353179
|
} catch (cleanupError) {
|
|
352740
353180
|
console.warn(
|
|
352741
353181
|
"Warning: Could not clean up failed project creation:",
|
|
@@ -352821,7 +353261,7 @@ var javaFlsCommand = {
|
|
|
352821
353261
|
};
|
|
352822
353262
|
async function createIdlProject(context2, projectName) {
|
|
352823
353263
|
const templatePath = getIdlExamplePath();
|
|
352824
|
-
if (!
|
|
353264
|
+
if (!fs81.existsSync(templatePath)) {
|
|
352825
353265
|
context2.ui.addItem(
|
|
352826
353266
|
{
|
|
352827
353267
|
type: "error" /* ERROR */,
|
|
@@ -352833,8 +353273,8 @@ async function createIdlProject(context2, projectName) {
|
|
|
352833
353273
|
return;
|
|
352834
353274
|
}
|
|
352835
353275
|
const projectDirectoryName = projectName;
|
|
352836
|
-
const targetPath =
|
|
352837
|
-
if (
|
|
353276
|
+
const targetPath = path87.join(process.cwd(), projectDirectoryName);
|
|
353277
|
+
if (fs81.existsSync(targetPath)) {
|
|
352838
353278
|
context2.ui.addItem(
|
|
352839
353279
|
{
|
|
352840
353280
|
type: "error" /* ERROR */,
|
|
@@ -352892,9 +353332,9 @@ ${projectDirectoryName}/
|
|
|
352892
353332
|
Date.now()
|
|
352893
353333
|
);
|
|
352894
353334
|
} catch (error2) {
|
|
352895
|
-
if (
|
|
353335
|
+
if (fs81.existsSync(targetPath)) {
|
|
352896
353336
|
try {
|
|
352897
|
-
|
|
353337
|
+
fs81.rmSync(targetPath, { recursive: true, force: true });
|
|
352898
353338
|
} catch (cleanupError) {
|
|
352899
353339
|
console.warn(
|
|
352900
353340
|
"Warning: Could not clean up failed project creation:",
|
|
@@ -353085,8 +353525,8 @@ var docsCommand = {
|
|
|
353085
353525
|
init_esbuild_shims();
|
|
353086
353526
|
init_core5();
|
|
353087
353527
|
import * as os32 from "node:os";
|
|
353088
|
-
import * as
|
|
353089
|
-
import * as
|
|
353528
|
+
import * as path88 from "node:path";
|
|
353529
|
+
import * as fs82 from "node:fs/promises";
|
|
353090
353530
|
function expandHomeDir(p2) {
|
|
353091
353531
|
if (!p2) {
|
|
353092
353532
|
return "";
|
|
@@ -353097,7 +353537,7 @@ function expandHomeDir(p2) {
|
|
|
353097
353537
|
} else if (p2 === "~" || p2.startsWith("~/")) {
|
|
353098
353538
|
expandedPath = os32.homedir() + p2.substring(1);
|
|
353099
353539
|
}
|
|
353100
|
-
return
|
|
353540
|
+
return path88.normalize(expandedPath);
|
|
353101
353541
|
}
|
|
353102
353542
|
__name(expandHomeDir, "expandHomeDir");
|
|
353103
353543
|
var directoryCommand = {
|
|
@@ -353405,25 +353845,25 @@ async function resolveCompletionPaths(partialPath, baseDir) {
|
|
|
353405
353845
|
resolvedPath = baseDir;
|
|
353406
353846
|
displayPrefix = "";
|
|
353407
353847
|
} else if (partialPath.startsWith("~")) {
|
|
353408
|
-
resolvedPath =
|
|
353848
|
+
resolvedPath = path88.join(os32.homedir(), partialPath.slice(1));
|
|
353409
353849
|
} else {
|
|
353410
|
-
resolvedPath =
|
|
353850
|
+
resolvedPath = path88.isAbsolute(partialPath) ? path88.resolve(partialPath || "/") : path88.resolve(baseDir, partialPath || ".");
|
|
353411
353851
|
}
|
|
353412
353852
|
let targetDir = resolvedPath;
|
|
353413
353853
|
let filterPrefix = "";
|
|
353414
353854
|
if (partialPath && !partialPath.endsWith("/") && !/^\.\/?$/.test(partialPath)) {
|
|
353415
|
-
targetDir =
|
|
353416
|
-
filterPrefix =
|
|
353855
|
+
targetDir = path88.dirname(resolvedPath);
|
|
353856
|
+
filterPrefix = path88.basename(resolvedPath);
|
|
353417
353857
|
}
|
|
353418
|
-
const entries = await
|
|
353858
|
+
const entries = await fs82.readdir(targetDir, { withFileTypes: true });
|
|
353419
353859
|
return entries.filter((entry) => entry.isDirectory()).filter((entry) => !filterPrefix || entry.name.startsWith(filterPrefix)).map((entry) => {
|
|
353420
353860
|
let completionPath;
|
|
353421
353861
|
if (partialPath.endsWith("/")) {
|
|
353422
|
-
completionPath =
|
|
353862
|
+
completionPath = path88.posix.join(displayPrefix, entry.name) + "/";
|
|
353423
353863
|
} else {
|
|
353424
|
-
const prefixDir = displayPrefix.includes("/") ?
|
|
353864
|
+
const prefixDir = displayPrefix.includes("/") ? path88.posix.dirname(displayPrefix) : "";
|
|
353425
353865
|
if (prefixDir && prefixDir !== ".") {
|
|
353426
|
-
completionPath =
|
|
353866
|
+
completionPath = path88.posix.join(prefixDir, entry.name) + "/";
|
|
353427
353867
|
} else {
|
|
353428
353868
|
completionPath = entry.name + "/";
|
|
353429
353869
|
if (displayPrefix && displayPrefix !== "." && !displayPrefix.includes("/")) {
|
|
@@ -353620,7 +354060,7 @@ var helpCommand = {
|
|
|
353620
354060
|
init_esbuild_shims();
|
|
353621
354061
|
init_core5();
|
|
353622
354062
|
init_core5();
|
|
353623
|
-
import
|
|
354063
|
+
import path89 from "node:path";
|
|
353624
354064
|
init_settings();
|
|
353625
354065
|
function getIdeStatusMessage(ideClient) {
|
|
353626
354066
|
const connection = ideClient.getConnectionStatus();
|
|
@@ -353651,13 +354091,13 @@ __name(getIdeStatusMessage, "getIdeStatusMessage");
|
|
|
353651
354091
|
function formatFileList(openFiles) {
|
|
353652
354092
|
const basenameCounts = /* @__PURE__ */ new Map();
|
|
353653
354093
|
for (const file of openFiles) {
|
|
353654
|
-
const basename21 =
|
|
354094
|
+
const basename21 = path89.basename(file.path);
|
|
353655
354095
|
basenameCounts.set(basename21, (basenameCounts.get(basename21) || 0) + 1);
|
|
353656
354096
|
}
|
|
353657
354097
|
const fileList = openFiles.map((file) => {
|
|
353658
|
-
const basename21 =
|
|
354098
|
+
const basename21 = path89.basename(file.path);
|
|
353659
354099
|
const isDuplicate = (basenameCounts.get(basename21) || 0) > 1;
|
|
353660
|
-
const parentDir =
|
|
354100
|
+
const parentDir = path89.basename(path89.dirname(file.path));
|
|
353661
354101
|
const displayName = isDuplicate ? `${basename21} (/${parentDir})` : basename21;
|
|
353662
354102
|
return ` - ${displayName}${file.isActive ? " (active)" : ""}`;
|
|
353663
354103
|
}).join("\n");
|
|
@@ -354637,8 +355077,8 @@ var importCommand = {
|
|
|
354637
355077
|
// packages/cli/src/ui/commands/initCommand.ts
|
|
354638
355078
|
init_esbuild_shims();
|
|
354639
355079
|
init_core5();
|
|
354640
|
-
import * as
|
|
354641
|
-
import * as
|
|
355080
|
+
import * as fs83 from "node:fs";
|
|
355081
|
+
import * as path90 from "node:path";
|
|
354642
355082
|
var import_react27 = __toESM(require_react(), 1);
|
|
354643
355083
|
var initCommand = {
|
|
354644
355084
|
name: "init",
|
|
@@ -354656,11 +355096,11 @@ var initCommand = {
|
|
|
354656
355096
|
}
|
|
354657
355097
|
const targetDir = context2.services.config.getTargetDir();
|
|
354658
355098
|
const contextFileName = getCurrentGeminiMdFilename();
|
|
354659
|
-
const contextFilePath =
|
|
355099
|
+
const contextFilePath = path90.join(targetDir, contextFileName);
|
|
354660
355100
|
try {
|
|
354661
|
-
if (
|
|
355101
|
+
if (fs83.existsSync(contextFilePath)) {
|
|
354662
355102
|
try {
|
|
354663
|
-
const existing =
|
|
355103
|
+
const existing = fs83.readFileSync(contextFilePath, "utf8");
|
|
354664
355104
|
if (existing && existing.trim().length > 0) {
|
|
354665
355105
|
if (!context2.overwriteConfirmed) {
|
|
354666
355106
|
return {
|
|
@@ -354682,7 +355122,7 @@ var initCommand = {
|
|
|
354682
355122
|
}
|
|
354683
355123
|
}
|
|
354684
355124
|
try {
|
|
354685
|
-
|
|
355125
|
+
fs83.writeFileSync(contextFilePath, "", "utf8");
|
|
354686
355126
|
context2.ui.addItem(
|
|
354687
355127
|
{
|
|
354688
355128
|
type: "info",
|
|
@@ -354745,354 +355185,6 @@ Write the complete content to the \`${contextFileName}\` file. The output must b
|
|
|
354745
355185
|
}, "action")
|
|
354746
355186
|
};
|
|
354747
355187
|
|
|
354748
|
-
// packages/cli/src/ui/commands/languageCommand.ts
|
|
354749
|
-
init_esbuild_shims();
|
|
354750
|
-
init_settings();
|
|
354751
|
-
init_core5();
|
|
354752
|
-
import * as fs83 from "node:fs";
|
|
354753
|
-
import * as path90 from "node:path";
|
|
354754
|
-
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
354755
|
-
function generateLlmOutputLanguageRule(language) {
|
|
354756
|
-
return `# \u26A0\uFE0F CRITICAL: ${language} Output Language Rule - HIGHEST PRIORITY \u26A0\uFE0F
|
|
354757
|
-
|
|
354758
|
-
## \u{1F6A8} MANDATORY RULE - NO EXCEPTIONS \u{1F6A8}
|
|
354759
|
-
|
|
354760
|
-
**YOU MUST RESPOND IN ${language.toUpperCase()} FOR EVERY SINGLE OUTPUT, REGARDLESS OF THE USER'S INPUT LANGUAGE.**
|
|
354761
|
-
|
|
354762
|
-
This is a **NON-NEGOTIABLE** requirement. Even if the user writes in English, says "hi", asks a simple question, or explicitly requests another language, **YOU MUST ALWAYS RESPOND IN ${language.toUpperCase()}.**
|
|
354763
|
-
|
|
354764
|
-
## What Must Be in ${language}
|
|
354765
|
-
|
|
354766
|
-
**EVERYTHING** you output: conversation replies, tool call descriptions, success/error messages, generated file content (comments, documentation), and all explanatory text.
|
|
354767
|
-
|
|
354768
|
-
**Tool outputs**: All descriptive text from \`read_file\`, \`write_file\`, \`codebase_search\`, \`run_terminal_cmd\`, \`todo_write\`, \`web_search\`, etc. MUST be in ${language}.
|
|
354769
|
-
|
|
354770
|
-
## Examples
|
|
354771
|
-
|
|
354772
|
-
### \u2705 CORRECT:
|
|
354773
|
-
- User says "hi" \u2192 Respond in ${language} (e.g., "Bonjour" if ${language} is French)
|
|
354774
|
-
- Tool result \u2192 "\u5DF2\u6210\u529F\u8BFB\u53D6\u6587\u4EF6 config.json" (if ${language} is Chinese)
|
|
354775
|
-
- Error \u2192 "\u65E0\u6CD5\u627E\u5230\u6307\u5B9A\u7684\u6587\u4EF6" (if ${language} is Chinese)
|
|
354776
|
-
|
|
354777
|
-
### \u274C WRONG:
|
|
354778
|
-
- User says "hi" \u2192 "Hello" in English
|
|
354779
|
-
- Tool result \u2192 "Successfully read file" in English
|
|
354780
|
-
- Error \u2192 "File not found" in English
|
|
354781
|
-
|
|
354782
|
-
## Notes
|
|
354783
|
-
|
|
354784
|
-
- Code elements (variable/function names, syntax) can remain in English
|
|
354785
|
-
- Comments, documentation, and all other text MUST be in ${language}
|
|
354786
|
-
|
|
354787
|
-
**THIS RULE IS ACTIVE NOW. ALL OUTPUTS MUST BE IN ${language.toUpperCase()}. NO EXCEPTIONS.**
|
|
354788
|
-
`;
|
|
354789
|
-
}
|
|
354790
|
-
__name(generateLlmOutputLanguageRule, "generateLlmOutputLanguageRule");
|
|
354791
|
-
function getLlmOutputLanguageRulePath() {
|
|
354792
|
-
return path90.join(
|
|
354793
|
-
Storage.getGlobalQwenDir(),
|
|
354794
|
-
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
354795
|
-
);
|
|
354796
|
-
}
|
|
354797
|
-
__name(getLlmOutputLanguageRulePath, "getLlmOutputLanguageRulePath");
|
|
354798
|
-
function getCurrentLlmOutputLanguage() {
|
|
354799
|
-
const filePath = getLlmOutputLanguageRulePath();
|
|
354800
|
-
if (fs83.existsSync(filePath)) {
|
|
354801
|
-
try {
|
|
354802
|
-
const content = fs83.readFileSync(filePath, "utf-8");
|
|
354803
|
-
const match2 = content.match(/^#.*?(\w+)\s+Output Language Rule/i);
|
|
354804
|
-
if (match2) {
|
|
354805
|
-
return match2[1];
|
|
354806
|
-
}
|
|
354807
|
-
} catch {
|
|
354808
|
-
}
|
|
354809
|
-
}
|
|
354810
|
-
return null;
|
|
354811
|
-
}
|
|
354812
|
-
__name(getCurrentLlmOutputLanguage, "getCurrentLlmOutputLanguage");
|
|
354813
|
-
async function setUiLanguage(context2, lang) {
|
|
354814
|
-
const { services } = context2;
|
|
354815
|
-
const { settings } = services;
|
|
354816
|
-
if (!services.config) {
|
|
354817
|
-
return {
|
|
354818
|
-
type: "message",
|
|
354819
|
-
messageType: "error",
|
|
354820
|
-
content: t4("Configuration not available.")
|
|
354821
|
-
};
|
|
354822
|
-
}
|
|
354823
|
-
await setLanguageAsync(lang);
|
|
354824
|
-
if (settings && typeof settings.setValue === "function") {
|
|
354825
|
-
try {
|
|
354826
|
-
settings.setValue("User" /* User */, "general.language", lang);
|
|
354827
|
-
} catch (error2) {
|
|
354828
|
-
console.warn("Failed to save language setting:", error2);
|
|
354829
|
-
}
|
|
354830
|
-
}
|
|
354831
|
-
context2.ui.reloadCommands();
|
|
354832
|
-
const langDisplayNames = {
|
|
354833
|
-
zh: "\u4E2D\u6587\uFF08zh-CN\uFF09",
|
|
354834
|
-
en: "English\uFF08en-US\uFF09"
|
|
354835
|
-
};
|
|
354836
|
-
return {
|
|
354837
|
-
type: "message",
|
|
354838
|
-
messageType: "info",
|
|
354839
|
-
content: t4("UI language changed to {{lang}}", {
|
|
354840
|
-
lang: langDisplayNames[lang] || lang
|
|
354841
|
-
})
|
|
354842
|
-
};
|
|
354843
|
-
}
|
|
354844
|
-
__name(setUiLanguage, "setUiLanguage");
|
|
354845
|
-
function generateLlmOutputLanguageRuleFile(language) {
|
|
354846
|
-
try {
|
|
354847
|
-
const filePath = getLlmOutputLanguageRulePath();
|
|
354848
|
-
const content = generateLlmOutputLanguageRule(language);
|
|
354849
|
-
const dir = path90.dirname(filePath);
|
|
354850
|
-
fs83.mkdirSync(dir, { recursive: true });
|
|
354851
|
-
fs83.writeFileSync(filePath, content, "utf-8");
|
|
354852
|
-
return Promise.resolve({
|
|
354853
|
-
type: "message",
|
|
354854
|
-
messageType: "info",
|
|
354855
|
-
content: [
|
|
354856
|
-
t4("LLM output language rule file generated at {{path}}", {
|
|
354857
|
-
path: filePath
|
|
354858
|
-
}),
|
|
354859
|
-
"",
|
|
354860
|
-
t4("Please restart the application for the changes to take effect.")
|
|
354861
|
-
].join("\n")
|
|
354862
|
-
});
|
|
354863
|
-
} catch (error2) {
|
|
354864
|
-
return Promise.resolve({
|
|
354865
|
-
type: "message",
|
|
354866
|
-
messageType: "error",
|
|
354867
|
-
content: t4(
|
|
354868
|
-
"Failed to generate LLM output language rule file: {{error}}",
|
|
354869
|
-
{
|
|
354870
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
354871
|
-
}
|
|
354872
|
-
)
|
|
354873
|
-
});
|
|
354874
|
-
}
|
|
354875
|
-
}
|
|
354876
|
-
__name(generateLlmOutputLanguageRuleFile, "generateLlmOutputLanguageRuleFile");
|
|
354877
|
-
var languageCommand = {
|
|
354878
|
-
name: "language",
|
|
354879
|
-
get description() {
|
|
354880
|
-
return t4("View or change the language setting");
|
|
354881
|
-
},
|
|
354882
|
-
kind: "built-in" /* BUILT_IN */,
|
|
354883
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
354884
|
-
const { services } = context2;
|
|
354885
|
-
if (!services.config) {
|
|
354886
|
-
return {
|
|
354887
|
-
type: "message",
|
|
354888
|
-
messageType: "error",
|
|
354889
|
-
content: t4("Configuration not available.")
|
|
354890
|
-
};
|
|
354891
|
-
}
|
|
354892
|
-
const trimmedArgs = args.trim();
|
|
354893
|
-
if (!trimmedArgs) {
|
|
354894
|
-
const currentUiLang = getCurrentLanguage();
|
|
354895
|
-
const currentLlmLang = getCurrentLlmOutputLanguage();
|
|
354896
|
-
const message = [
|
|
354897
|
-
t4("Current UI language: {{lang}}", { lang: currentUiLang }),
|
|
354898
|
-
currentLlmLang ? t4("Current LLM output language: {{lang}}", { lang: currentLlmLang }) : t4("LLM output language not set"),
|
|
354899
|
-
"",
|
|
354900
|
-
t4("Available subcommands:"),
|
|
354901
|
-
` /language ui [zh-CN|en-US] - ${t4("Set UI language")}`,
|
|
354902
|
-
` /language output <language> - ${t4("Set LLM output language")}`
|
|
354903
|
-
].join("\n");
|
|
354904
|
-
return {
|
|
354905
|
-
type: "message",
|
|
354906
|
-
messageType: "info",
|
|
354907
|
-
content: message
|
|
354908
|
-
};
|
|
354909
|
-
}
|
|
354910
|
-
const parts = trimmedArgs.split(/\s+/);
|
|
354911
|
-
const subcommand = parts[0].toLowerCase();
|
|
354912
|
-
if (subcommand === "ui") {
|
|
354913
|
-
if (parts.length === 1) {
|
|
354914
|
-
return {
|
|
354915
|
-
type: "message",
|
|
354916
|
-
messageType: "info",
|
|
354917
|
-
content: [
|
|
354918
|
-
t4("Set UI language"),
|
|
354919
|
-
"",
|
|
354920
|
-
t4("Usage: /language ui [zh-CN|en-US]"),
|
|
354921
|
-
"",
|
|
354922
|
-
t4("Available options:"),
|
|
354923
|
-
t4(" - zh-CN: Simplified Chinese"),
|
|
354924
|
-
t4(" - en-US: English"),
|
|
354925
|
-
"",
|
|
354926
|
-
t4(
|
|
354927
|
-
"To request additional UI language packs, please open an issue on GitHub."
|
|
354928
|
-
)
|
|
354929
|
-
].join("\n")
|
|
354930
|
-
};
|
|
354931
|
-
}
|
|
354932
|
-
const langArg = parts[1].toLowerCase();
|
|
354933
|
-
let targetLang = null;
|
|
354934
|
-
if (langArg === "en" || langArg === "english" || langArg === "en-us") {
|
|
354935
|
-
targetLang = "en";
|
|
354936
|
-
} else if (langArg === "zh" || langArg === "chinese" || langArg === "\u4E2D\u6587" || langArg === "zh-cn") {
|
|
354937
|
-
targetLang = "zh";
|
|
354938
|
-
} else {
|
|
354939
|
-
return {
|
|
354940
|
-
type: "message",
|
|
354941
|
-
messageType: "error",
|
|
354942
|
-
content: t4("Invalid language. Available: en-US, zh-CN")
|
|
354943
|
-
};
|
|
354944
|
-
}
|
|
354945
|
-
return setUiLanguage(context2, targetLang);
|
|
354946
|
-
} else if (subcommand === "output") {
|
|
354947
|
-
if (parts.length === 1) {
|
|
354948
|
-
return {
|
|
354949
|
-
type: "message",
|
|
354950
|
-
messageType: "info",
|
|
354951
|
-
content: [
|
|
354952
|
-
t4("Set LLM output language"),
|
|
354953
|
-
"",
|
|
354954
|
-
t4("Usage: /language output <language>"),
|
|
354955
|
-
` ${t4("Example: /language output \u4E2D\u6587")}`
|
|
354956
|
-
].join("\n")
|
|
354957
|
-
};
|
|
354958
|
-
}
|
|
354959
|
-
const language = parts.slice(1).join(" ");
|
|
354960
|
-
return generateLlmOutputLanguageRuleFile(language);
|
|
354961
|
-
} else {
|
|
354962
|
-
const langArg = trimmedArgs.toLowerCase();
|
|
354963
|
-
let targetLang = null;
|
|
354964
|
-
if (langArg === "en" || langArg === "english" || langArg === "en-us") {
|
|
354965
|
-
targetLang = "en";
|
|
354966
|
-
} else if (langArg === "zh" || langArg === "chinese" || langArg === "\u4E2D\u6587" || langArg === "zh-cn") {
|
|
354967
|
-
targetLang = "zh";
|
|
354968
|
-
} else {
|
|
354969
|
-
return {
|
|
354970
|
-
type: "message",
|
|
354971
|
-
messageType: "error",
|
|
354972
|
-
content: [
|
|
354973
|
-
t4("Invalid command. Available subcommands:"),
|
|
354974
|
-
" - /language ui [zh-CN|en-US] - " + t4("Set UI language"),
|
|
354975
|
-
" - /language output <language> - " + t4("Set LLM output language")
|
|
354976
|
-
].join("\n")
|
|
354977
|
-
};
|
|
354978
|
-
}
|
|
354979
|
-
return setUiLanguage(context2, targetLang);
|
|
354980
|
-
}
|
|
354981
|
-
}, "action"),
|
|
354982
|
-
subCommands: [
|
|
354983
|
-
{
|
|
354984
|
-
name: "ui",
|
|
354985
|
-
get description() {
|
|
354986
|
-
return t4("Set UI language");
|
|
354987
|
-
},
|
|
354988
|
-
kind: "built-in" /* BUILT_IN */,
|
|
354989
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
354990
|
-
const trimmedArgs = args.trim();
|
|
354991
|
-
if (!trimmedArgs) {
|
|
354992
|
-
return {
|
|
354993
|
-
type: "message",
|
|
354994
|
-
messageType: "info",
|
|
354995
|
-
content: [
|
|
354996
|
-
t4("Set UI language"),
|
|
354997
|
-
"",
|
|
354998
|
-
t4("Usage: /language ui [zh-CN|en-US]"),
|
|
354999
|
-
"",
|
|
355000
|
-
t4("Available options:"),
|
|
355001
|
-
t4(" - zh-CN: Simplified Chinese"),
|
|
355002
|
-
t4(" - en-US: English"),
|
|
355003
|
-
"",
|
|
355004
|
-
t4(
|
|
355005
|
-
"To request additional UI language packs, please open an issue on GitHub."
|
|
355006
|
-
)
|
|
355007
|
-
].join("\n")
|
|
355008
|
-
};
|
|
355009
|
-
}
|
|
355010
|
-
const langArg = trimmedArgs.toLowerCase();
|
|
355011
|
-
let targetLang = null;
|
|
355012
|
-
if (langArg === "en" || langArg === "english" || langArg === "en-us") {
|
|
355013
|
-
targetLang = "en";
|
|
355014
|
-
} else if (langArg === "zh" || langArg === "chinese" || langArg === "\u4E2D\u6587" || langArg === "zh-cn") {
|
|
355015
|
-
targetLang = "zh";
|
|
355016
|
-
} else {
|
|
355017
|
-
return {
|
|
355018
|
-
type: "message",
|
|
355019
|
-
messageType: "error",
|
|
355020
|
-
content: t4("Invalid language. Available: en-US, zh-CN")
|
|
355021
|
-
};
|
|
355022
|
-
}
|
|
355023
|
-
return setUiLanguage(context2, targetLang);
|
|
355024
|
-
}, "action"),
|
|
355025
|
-
subCommands: [
|
|
355026
|
-
{
|
|
355027
|
-
name: "zh-CN",
|
|
355028
|
-
altNames: ["zh", "chinese", "\u4E2D\u6587"],
|
|
355029
|
-
get description() {
|
|
355030
|
-
return t4("Set UI language to Simplified Chinese (zh-CN)");
|
|
355031
|
-
},
|
|
355032
|
-
kind: "built-in" /* BUILT_IN */,
|
|
355033
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
355034
|
-
if (args.trim().length > 0) {
|
|
355035
|
-
return {
|
|
355036
|
-
type: "message",
|
|
355037
|
-
messageType: "error",
|
|
355038
|
-
content: t4(
|
|
355039
|
-
"Language subcommands do not accept additional arguments."
|
|
355040
|
-
)
|
|
355041
|
-
};
|
|
355042
|
-
}
|
|
355043
|
-
return setUiLanguage(context2, "zh");
|
|
355044
|
-
}, "action")
|
|
355045
|
-
},
|
|
355046
|
-
{
|
|
355047
|
-
name: "en-US",
|
|
355048
|
-
altNames: ["en", "english"],
|
|
355049
|
-
get description() {
|
|
355050
|
-
return t4("Set UI language to English (en-US)");
|
|
355051
|
-
},
|
|
355052
|
-
kind: "built-in" /* BUILT_IN */,
|
|
355053
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
355054
|
-
if (args.trim().length > 0) {
|
|
355055
|
-
return {
|
|
355056
|
-
type: "message",
|
|
355057
|
-
messageType: "error",
|
|
355058
|
-
content: t4(
|
|
355059
|
-
"Language subcommands do not accept additional arguments."
|
|
355060
|
-
)
|
|
355061
|
-
};
|
|
355062
|
-
}
|
|
355063
|
-
return setUiLanguage(context2, "en");
|
|
355064
|
-
}, "action")
|
|
355065
|
-
}
|
|
355066
|
-
]
|
|
355067
|
-
},
|
|
355068
|
-
{
|
|
355069
|
-
name: "output",
|
|
355070
|
-
get description() {
|
|
355071
|
-
return t4("Set LLM output language");
|
|
355072
|
-
},
|
|
355073
|
-
kind: "built-in" /* BUILT_IN */,
|
|
355074
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
355075
|
-
const trimmedArgs = args.trim();
|
|
355076
|
-
if (!trimmedArgs) {
|
|
355077
|
-
return {
|
|
355078
|
-
type: "message",
|
|
355079
|
-
messageType: "info",
|
|
355080
|
-
content: [
|
|
355081
|
-
t4("Set LLM output language"),
|
|
355082
|
-
"",
|
|
355083
|
-
t4("Usage: /language output <language>"),
|
|
355084
|
-
` ${t4("Example: /language output \u4E2D\u6587")}`,
|
|
355085
|
-
` ${t4("Example: /language output English")}`,
|
|
355086
|
-
` ${t4("Example: /language output \u65E5\u672C\u8A9E")}`
|
|
355087
|
-
].join("\n")
|
|
355088
|
-
};
|
|
355089
|
-
}
|
|
355090
|
-
return generateLlmOutputLanguageRuleFile(trimmedArgs);
|
|
355091
|
-
}, "action")
|
|
355092
|
-
}
|
|
355093
|
-
]
|
|
355094
|
-
};
|
|
355095
|
-
|
|
355096
355188
|
// packages/cli/src/ui/commands/mcpCommand.ts
|
|
355097
355189
|
init_esbuild_shims();
|
|
355098
355190
|
init_core5();
|
|
@@ -356920,6 +357012,7 @@ var summaryCommand = {
|
|
|
356920
357012
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
356921
357013
|
const { config: config2 } = context2.services;
|
|
356922
357014
|
const { ui: ui2 } = context2;
|
|
357015
|
+
const executionMode = context2.executionMode ?? "interactive";
|
|
356923
357016
|
if (!config2) {
|
|
356924
357017
|
return {
|
|
356925
357018
|
type: "message",
|
|
@@ -356935,7 +357028,7 @@ var summaryCommand = {
|
|
|
356935
357028
|
content: t4("No chat client available to generate summary.")
|
|
356936
357029
|
};
|
|
356937
357030
|
}
|
|
356938
|
-
if (ui2.pendingItem) {
|
|
357031
|
+
if (executionMode === "interactive" && ui2.pendingItem) {
|
|
356939
357032
|
ui2.addItem(
|
|
356940
357033
|
{
|
|
356941
357034
|
type: "error",
|
|
@@ -356953,25 +357046,17 @@ var summaryCommand = {
|
|
|
356953
357046
|
)
|
|
356954
357047
|
};
|
|
356955
357048
|
}
|
|
356956
|
-
|
|
357049
|
+
const getChatHistory = /* @__PURE__ */ __name(() => {
|
|
356957
357050
|
const chat = geminiClient.getChat();
|
|
356958
|
-
|
|
356959
|
-
|
|
356960
|
-
|
|
356961
|
-
|
|
356962
|
-
|
|
356963
|
-
|
|
356964
|
-
|
|
356965
|
-
|
|
356966
|
-
const
|
|
356967
|
-
type: "summary",
|
|
356968
|
-
summary: {
|
|
356969
|
-
isPending: true,
|
|
356970
|
-
stage: "generating"
|
|
356971
|
-
}
|
|
356972
|
-
};
|
|
356973
|
-
ui2.setPendingItem(pendingMessage);
|
|
356974
|
-
const conversationContext = history.map((message) => ({
|
|
357051
|
+
return chat.getHistory();
|
|
357052
|
+
}, "getChatHistory");
|
|
357053
|
+
const validateChatHistory = /* @__PURE__ */ __name((history2) => {
|
|
357054
|
+
if (history2.length <= 2) {
|
|
357055
|
+
throw new Error(t4("No conversation found to summarize."));
|
|
357056
|
+
}
|
|
357057
|
+
}, "validateChatHistory");
|
|
357058
|
+
const generateSummaryMarkdown = /* @__PURE__ */ __name(async (history2) => {
|
|
357059
|
+
const conversationContext = history2.map((message) => ({
|
|
356975
357060
|
role: message.role,
|
|
356976
357061
|
parts: message.parts
|
|
356977
357062
|
}));
|
|
@@ -356995,16 +357080,14 @@ var summaryCommand = {
|
|
|
356995
357080
|
const markdownSummary = parts?.map((part) => part.text).filter((text) => typeof text === "string").join("") || "";
|
|
356996
357081
|
if (!markdownSummary) {
|
|
356997
357082
|
throw new Error(
|
|
356998
|
-
|
|
357083
|
+
t4(
|
|
357084
|
+
"Failed to generate summary - no text content received from LLM response"
|
|
357085
|
+
)
|
|
356999
357086
|
);
|
|
357000
357087
|
}
|
|
357001
|
-
|
|
357002
|
-
|
|
357003
|
-
|
|
357004
|
-
isPending: true,
|
|
357005
|
-
stage: "saving"
|
|
357006
|
-
}
|
|
357007
|
-
});
|
|
357088
|
+
return markdownSummary;
|
|
357089
|
+
}, "generateSummaryMarkdown");
|
|
357090
|
+
const saveSummaryToDisk = /* @__PURE__ */ __name(async (markdownSummary) => {
|
|
357008
357091
|
const projectRoot = config2.getProjectRoot();
|
|
357009
357092
|
const qwenDir = path94.join(projectRoot, ".rdmind");
|
|
357010
357093
|
try {
|
|
@@ -357020,42 +357103,137 @@ var summaryCommand = {
|
|
|
357020
357103
|
**Update time**: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
357021
357104
|
`;
|
|
357022
357105
|
await fsPromises5.writeFile(summaryPath, summaryContent, "utf8");
|
|
357106
|
+
return {
|
|
357107
|
+
filePathForDisplay: ".qwen/PROJECT_SUMMARY.md",
|
|
357108
|
+
fullPath: summaryPath
|
|
357109
|
+
};
|
|
357110
|
+
}, "saveSummaryToDisk");
|
|
357111
|
+
const emitInteractivePending = /* @__PURE__ */ __name((stage) => {
|
|
357112
|
+
if (executionMode !== "interactive") {
|
|
357113
|
+
return;
|
|
357114
|
+
}
|
|
357115
|
+
const pendingMessage = {
|
|
357116
|
+
type: "summary",
|
|
357117
|
+
summary: {
|
|
357118
|
+
isPending: true,
|
|
357119
|
+
stage
|
|
357120
|
+
}
|
|
357121
|
+
};
|
|
357122
|
+
ui2.setPendingItem(pendingMessage);
|
|
357123
|
+
}, "emitInteractivePending");
|
|
357124
|
+
const completeInteractive = /* @__PURE__ */ __name((filePathForDisplay) => {
|
|
357125
|
+
if (executionMode !== "interactive") {
|
|
357126
|
+
return;
|
|
357127
|
+
}
|
|
357023
357128
|
ui2.setPendingItem(null);
|
|
357024
357129
|
const completedSummaryItem = {
|
|
357025
357130
|
type: "summary",
|
|
357026
357131
|
summary: {
|
|
357027
357132
|
isPending: false,
|
|
357028
357133
|
stage: "completed",
|
|
357029
|
-
filePath:
|
|
357134
|
+
filePath: filePathForDisplay
|
|
357030
357135
|
}
|
|
357031
357136
|
};
|
|
357032
357137
|
ui2.addItem(completedSummaryItem, Date.now());
|
|
357033
|
-
|
|
357034
|
-
|
|
357035
|
-
|
|
357036
|
-
|
|
357037
|
-
|
|
357038
|
-
|
|
357039
|
-
|
|
357138
|
+
}, "completeInteractive");
|
|
357139
|
+
const formatErrorMessage = /* @__PURE__ */ __name((error2) => t4("Failed to generate project context summary: {{error}}", {
|
|
357140
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
357141
|
+
}), "formatErrorMessage");
|
|
357142
|
+
const failInteractive = /* @__PURE__ */ __name((error2) => {
|
|
357143
|
+
if (executionMode !== "interactive") {
|
|
357144
|
+
return;
|
|
357145
|
+
}
|
|
357040
357146
|
ui2.setPendingItem(null);
|
|
357041
357147
|
ui2.addItem(
|
|
357042
357148
|
{
|
|
357043
357149
|
type: "error",
|
|
357044
|
-
text: `\u274C ${
|
|
357045
|
-
"Failed to generate project context summary: {{error}}",
|
|
357046
|
-
{
|
|
357047
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
357048
|
-
}
|
|
357049
|
-
)}`
|
|
357150
|
+
text: `\u274C ${formatErrorMessage(error2)}`
|
|
357050
357151
|
},
|
|
357051
357152
|
Date.now()
|
|
357052
357153
|
);
|
|
357154
|
+
}, "failInteractive");
|
|
357155
|
+
const formatSuccessMessage = /* @__PURE__ */ __name((filePathForDisplay) => t4("Saved project summary to {{filePathForDisplay}}.", {
|
|
357156
|
+
filePathForDisplay
|
|
357157
|
+
}), "formatSuccessMessage");
|
|
357158
|
+
const returnNoConversationMessage = /* @__PURE__ */ __name(() => {
|
|
357159
|
+
const msg = t4("No conversation found to summarize.");
|
|
357160
|
+
if (executionMode === "acp") {
|
|
357161
|
+
const messages = /* @__PURE__ */ __name(async function* () {
|
|
357162
|
+
yield {
|
|
357163
|
+
messageType: "info",
|
|
357164
|
+
content: msg
|
|
357165
|
+
};
|
|
357166
|
+
}, "messages");
|
|
357167
|
+
return {
|
|
357168
|
+
type: "stream_messages",
|
|
357169
|
+
messages: messages()
|
|
357170
|
+
};
|
|
357171
|
+
}
|
|
357172
|
+
return {
|
|
357173
|
+
type: "message",
|
|
357174
|
+
messageType: "info",
|
|
357175
|
+
content: msg
|
|
357176
|
+
};
|
|
357177
|
+
}, "returnNoConversationMessage");
|
|
357178
|
+
const executeSummaryGeneration = /* @__PURE__ */ __name(async (history2) => {
|
|
357179
|
+
emitInteractivePending("generating");
|
|
357180
|
+
const markdownSummary = await generateSummaryMarkdown(history2);
|
|
357181
|
+
emitInteractivePending("saving");
|
|
357182
|
+
const { filePathForDisplay } = await saveSummaryToDisk(markdownSummary);
|
|
357183
|
+
completeInteractive(filePathForDisplay);
|
|
357184
|
+
return { markdownSummary, filePathForDisplay };
|
|
357185
|
+
}, "executeSummaryGeneration");
|
|
357186
|
+
const history = getChatHistory();
|
|
357187
|
+
try {
|
|
357188
|
+
validateChatHistory(history);
|
|
357189
|
+
} catch (_error) {
|
|
357190
|
+
return returnNoConversationMessage();
|
|
357191
|
+
}
|
|
357192
|
+
if (executionMode === "acp") {
|
|
357193
|
+
const messages = /* @__PURE__ */ __name(async function* () {
|
|
357194
|
+
try {
|
|
357195
|
+
yield {
|
|
357196
|
+
messageType: "info",
|
|
357197
|
+
content: t4("Generating project summary...")
|
|
357198
|
+
};
|
|
357199
|
+
const { filePathForDisplay } = await executeSummaryGeneration(history);
|
|
357200
|
+
yield {
|
|
357201
|
+
messageType: "info",
|
|
357202
|
+
content: formatSuccessMessage(filePathForDisplay)
|
|
357203
|
+
};
|
|
357204
|
+
} catch (error2) {
|
|
357205
|
+
failInteractive(error2);
|
|
357206
|
+
yield {
|
|
357207
|
+
messageType: "error",
|
|
357208
|
+
content: formatErrorMessage(error2)
|
|
357209
|
+
};
|
|
357210
|
+
}
|
|
357211
|
+
}, "messages");
|
|
357212
|
+
return {
|
|
357213
|
+
type: "stream_messages",
|
|
357214
|
+
messages: messages()
|
|
357215
|
+
};
|
|
357216
|
+
}
|
|
357217
|
+
try {
|
|
357218
|
+
const { filePathForDisplay } = await executeSummaryGeneration(history);
|
|
357219
|
+
if (executionMode === "non_interactive") {
|
|
357220
|
+
return {
|
|
357221
|
+
type: "message",
|
|
357222
|
+
messageType: "info",
|
|
357223
|
+
content: formatSuccessMessage(filePathForDisplay)
|
|
357224
|
+
};
|
|
357225
|
+
}
|
|
357226
|
+
return {
|
|
357227
|
+
type: "message",
|
|
357228
|
+
messageType: "info",
|
|
357229
|
+
content: ""
|
|
357230
|
+
};
|
|
357231
|
+
} catch (error2) {
|
|
357232
|
+
failInteractive(error2);
|
|
357053
357233
|
return {
|
|
357054
357234
|
type: "message",
|
|
357055
357235
|
messageType: "error",
|
|
357056
|
-
content:
|
|
357057
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
357058
|
-
})
|
|
357236
|
+
content: formatErrorMessage(error2)
|
|
357059
357237
|
};
|
|
357060
357238
|
}
|
|
357061
357239
|
}, "action")
|
|
@@ -358468,67 +358646,908 @@ var BuiltinCommandLoader = class {
|
|
|
358468
358646
|
}
|
|
358469
358647
|
};
|
|
358470
358648
|
|
|
358471
|
-
// packages/cli/src/
|
|
358649
|
+
// packages/cli/src/services/FileCommandLoader.ts
|
|
358472
358650
|
init_esbuild_shims();
|
|
358473
|
-
|
|
358474
|
-
|
|
358475
|
-
|
|
358651
|
+
var import_toml = __toESM(require_toml(), 1);
|
|
358652
|
+
init_esm11();
|
|
358653
|
+
init_zod();
|
|
358654
|
+
init_core5();
|
|
358655
|
+
import { promises as fs90 } from "node:fs";
|
|
358656
|
+
import path98 from "node:path";
|
|
358657
|
+
|
|
358658
|
+
// packages/cli/src/services/prompt-processors/argumentProcessor.ts
|
|
358659
|
+
init_esbuild_shims();
|
|
358660
|
+
init_core5();
|
|
358661
|
+
var DefaultArgumentProcessor = class {
|
|
358662
|
+
static {
|
|
358663
|
+
__name(this, "DefaultArgumentProcessor");
|
|
358476
358664
|
}
|
|
358477
|
-
|
|
358665
|
+
async process(prompt, context2) {
|
|
358666
|
+
if (context2.invocation?.args) {
|
|
358667
|
+
return appendToLastTextPart(prompt, context2.invocation.raw);
|
|
358668
|
+
}
|
|
358669
|
+
return prompt;
|
|
358670
|
+
}
|
|
358671
|
+
};
|
|
358672
|
+
|
|
358673
|
+
// packages/cli/src/services/prompt-processors/types.ts
|
|
358674
|
+
init_esbuild_shims();
|
|
358675
|
+
var SHORTHAND_ARGS_PLACEHOLDER = "{{args}}";
|
|
358676
|
+
var SHELL_INJECTION_TRIGGER = "!{";
|
|
358677
|
+
var AT_FILE_INJECTION_TRIGGER = "@{";
|
|
358678
|
+
|
|
358679
|
+
// packages/cli/src/services/prompt-processors/shellProcessor.ts
|
|
358680
|
+
init_esbuild_shims();
|
|
358681
|
+
init_core5();
|
|
358682
|
+
|
|
358683
|
+
// packages/cli/src/services/prompt-processors/injectionParser.ts
|
|
358684
|
+
init_esbuild_shims();
|
|
358685
|
+
function extractInjections(prompt, trigger, contextName) {
|
|
358686
|
+
const injections = [];
|
|
358687
|
+
let index = 0;
|
|
358688
|
+
while (index < prompt.length) {
|
|
358689
|
+
const startIndex = prompt.indexOf(trigger, index);
|
|
358690
|
+
if (startIndex === -1) {
|
|
358691
|
+
break;
|
|
358692
|
+
}
|
|
358693
|
+
let currentIndex = startIndex + trigger.length;
|
|
358694
|
+
let braceCount = 1;
|
|
358695
|
+
let foundEnd = false;
|
|
358696
|
+
while (currentIndex < prompt.length) {
|
|
358697
|
+
const char = prompt[currentIndex];
|
|
358698
|
+
if (char === "{") {
|
|
358699
|
+
braceCount++;
|
|
358700
|
+
} else if (char === "}") {
|
|
358701
|
+
braceCount--;
|
|
358702
|
+
if (braceCount === 0) {
|
|
358703
|
+
const injectionContent = prompt.substring(
|
|
358704
|
+
startIndex + trigger.length,
|
|
358705
|
+
currentIndex
|
|
358706
|
+
);
|
|
358707
|
+
const endIndex = currentIndex + 1;
|
|
358708
|
+
injections.push({
|
|
358709
|
+
content: injectionContent.trim(),
|
|
358710
|
+
startIndex,
|
|
358711
|
+
endIndex
|
|
358712
|
+
});
|
|
358713
|
+
index = endIndex;
|
|
358714
|
+
foundEnd = true;
|
|
358715
|
+
break;
|
|
358716
|
+
}
|
|
358717
|
+
}
|
|
358718
|
+
currentIndex++;
|
|
358719
|
+
}
|
|
358720
|
+
if (!foundEnd) {
|
|
358721
|
+
const contextInfo = contextName ? ` in command '${contextName}'` : "";
|
|
358722
|
+
throw new Error(
|
|
358723
|
+
`Invalid syntax${contextInfo}: Unclosed injection starting at index ${startIndex} ('${trigger}'). Ensure braces are balanced. Paths or commands with unbalanced braces are not supported directly.`
|
|
358724
|
+
);
|
|
358725
|
+
}
|
|
358726
|
+
}
|
|
358727
|
+
return injections;
|
|
358478
358728
|
}
|
|
358479
|
-
__name(
|
|
358480
|
-
|
|
358481
|
-
|
|
358482
|
-
|
|
358729
|
+
__name(extractInjections, "extractInjections");
|
|
358730
|
+
|
|
358731
|
+
// packages/cli/src/services/prompt-processors/shellProcessor.ts
|
|
358732
|
+
var ConfirmationRequiredError = class extends Error {
|
|
358733
|
+
constructor(message, commandsToConfirm) {
|
|
358734
|
+
super(message);
|
|
358735
|
+
this.commandsToConfirm = commandsToConfirm;
|
|
358736
|
+
this.name = "ConfirmationRequiredError";
|
|
358483
358737
|
}
|
|
358484
|
-
|
|
358738
|
+
static {
|
|
358739
|
+
__name(this, "ConfirmationRequiredError");
|
|
358740
|
+
}
|
|
358741
|
+
};
|
|
358742
|
+
var ShellProcessor = class {
|
|
358743
|
+
constructor(commandName) {
|
|
358744
|
+
this.commandName = commandName;
|
|
358745
|
+
}
|
|
358746
|
+
static {
|
|
358747
|
+
__name(this, "ShellProcessor");
|
|
358748
|
+
}
|
|
358749
|
+
async process(prompt, context2) {
|
|
358750
|
+
return flatMapTextParts(
|
|
358751
|
+
prompt,
|
|
358752
|
+
(text) => this.processString(text, context2)
|
|
358753
|
+
);
|
|
358754
|
+
}
|
|
358755
|
+
async processString(prompt, context2) {
|
|
358756
|
+
const userArgsRaw = context2.invocation?.args || "";
|
|
358757
|
+
if (!prompt.includes(SHELL_INJECTION_TRIGGER)) {
|
|
358758
|
+
return [
|
|
358759
|
+
{ text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
|
|
358760
|
+
];
|
|
358761
|
+
}
|
|
358762
|
+
const config2 = context2.services.config;
|
|
358763
|
+
if (!config2) {
|
|
358764
|
+
throw new Error(
|
|
358765
|
+
`Security configuration not loaded. Cannot verify shell command permissions for '${this.commandName}'. Aborting.`
|
|
358766
|
+
);
|
|
358767
|
+
}
|
|
358768
|
+
const { sessionShellAllowlist } = context2.session;
|
|
358769
|
+
const injections = extractInjections(
|
|
358770
|
+
prompt,
|
|
358771
|
+
SHELL_INJECTION_TRIGGER,
|
|
358772
|
+
this.commandName
|
|
358773
|
+
);
|
|
358774
|
+
if (injections.length === 0) {
|
|
358775
|
+
return [
|
|
358776
|
+
{ text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
|
|
358777
|
+
];
|
|
358778
|
+
}
|
|
358779
|
+
const { shell: shell2 } = getShellConfiguration();
|
|
358780
|
+
const userArgsEscaped = escapeShellArg(userArgsRaw, shell2);
|
|
358781
|
+
const resolvedInjections = injections.map(
|
|
358782
|
+
(injection) => {
|
|
358783
|
+
const command2 = injection.content;
|
|
358784
|
+
if (command2 === "") {
|
|
358785
|
+
return { ...injection, resolvedCommand: void 0 };
|
|
358786
|
+
}
|
|
358787
|
+
const resolvedCommand = command2.replaceAll(
|
|
358788
|
+
SHORTHAND_ARGS_PLACEHOLDER,
|
|
358789
|
+
userArgsEscaped
|
|
358790
|
+
);
|
|
358791
|
+
return { ...injection, resolvedCommand };
|
|
358792
|
+
}
|
|
358793
|
+
);
|
|
358794
|
+
const commandsToConfirm = /* @__PURE__ */ new Set();
|
|
358795
|
+
for (const injection of resolvedInjections) {
|
|
358796
|
+
const command2 = injection.resolvedCommand;
|
|
358797
|
+
if (!command2) continue;
|
|
358798
|
+
const { allAllowed, disallowedCommands, blockReason, isHardDenial } = checkCommandPermissions(command2, config2, sessionShellAllowlist);
|
|
358799
|
+
if (!allAllowed) {
|
|
358800
|
+
if (isHardDenial) {
|
|
358801
|
+
throw new Error(
|
|
358802
|
+
`${this.commandName} cannot be run. Blocked command: "${command2}". Reason: ${blockReason || "Blocked by configuration."}`
|
|
358803
|
+
);
|
|
358804
|
+
}
|
|
358805
|
+
if (config2.getApprovalMode() !== "yolo" /* YOLO */) {
|
|
358806
|
+
disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
|
|
358807
|
+
}
|
|
358808
|
+
}
|
|
358809
|
+
}
|
|
358810
|
+
if (commandsToConfirm.size > 0) {
|
|
358811
|
+
throw new ConfirmationRequiredError(
|
|
358812
|
+
"Shell command confirmation required",
|
|
358813
|
+
Array.from(commandsToConfirm)
|
|
358814
|
+
);
|
|
358815
|
+
}
|
|
358816
|
+
let processedPrompt = "";
|
|
358817
|
+
let lastIndex = 0;
|
|
358818
|
+
for (const injection of resolvedInjections) {
|
|
358819
|
+
const segment = prompt.substring(lastIndex, injection.startIndex);
|
|
358820
|
+
processedPrompt += segment.replaceAll(
|
|
358821
|
+
SHORTHAND_ARGS_PLACEHOLDER,
|
|
358822
|
+
userArgsRaw
|
|
358823
|
+
);
|
|
358824
|
+
if (injection.resolvedCommand) {
|
|
358825
|
+
const activeTheme = themeManager.getActiveTheme();
|
|
358826
|
+
const shellExecutionConfig = {
|
|
358827
|
+
...config2.getShellExecutionConfig(),
|
|
358828
|
+
defaultFg: activeTheme.colors.Foreground,
|
|
358829
|
+
defaultBg: activeTheme.colors.Background
|
|
358830
|
+
};
|
|
358831
|
+
const { result } = await ShellExecutionService.execute(
|
|
358832
|
+
injection.resolvedCommand,
|
|
358833
|
+
config2.getTargetDir(),
|
|
358834
|
+
() => {
|
|
358835
|
+
},
|
|
358836
|
+
new AbortController().signal,
|
|
358837
|
+
config2.getShouldUseNodePtyShell(),
|
|
358838
|
+
shellExecutionConfig
|
|
358839
|
+
);
|
|
358840
|
+
const executionResult = await result;
|
|
358841
|
+
if (executionResult.error && !executionResult.aborted) {
|
|
358842
|
+
throw new Error(
|
|
358843
|
+
`Failed to start shell command in '${this.commandName}': ${executionResult.error.message}. Command: ${injection.resolvedCommand}`
|
|
358844
|
+
);
|
|
358845
|
+
}
|
|
358846
|
+
processedPrompt += executionResult.output;
|
|
358847
|
+
if (executionResult.aborted) {
|
|
358848
|
+
processedPrompt += `
|
|
358849
|
+
[Shell command '${injection.resolvedCommand}' aborted]`;
|
|
358850
|
+
} else if (executionResult.exitCode !== 0 && executionResult.exitCode !== null) {
|
|
358851
|
+
processedPrompt += `
|
|
358852
|
+
[Shell command '${injection.resolvedCommand}' exited with code ${executionResult.exitCode}]`;
|
|
358853
|
+
} else if (executionResult.signal !== null) {
|
|
358854
|
+
processedPrompt += `
|
|
358855
|
+
[Shell command '${injection.resolvedCommand}' terminated by signal ${executionResult.signal}]`;
|
|
358856
|
+
}
|
|
358857
|
+
}
|
|
358858
|
+
lastIndex = injection.endIndex;
|
|
358859
|
+
}
|
|
358860
|
+
const finalSegment = prompt.substring(lastIndex);
|
|
358861
|
+
processedPrompt += finalSegment.replaceAll(
|
|
358862
|
+
SHORTHAND_ARGS_PLACEHOLDER,
|
|
358863
|
+
userArgsRaw
|
|
358864
|
+
);
|
|
358865
|
+
return [{ text: processedPrompt }];
|
|
358866
|
+
}
|
|
358867
|
+
};
|
|
358868
|
+
|
|
358869
|
+
// packages/cli/src/services/prompt-processors/atFileProcessor.ts
|
|
358870
|
+
init_esbuild_shims();
|
|
358871
|
+
init_core5();
|
|
358872
|
+
var AtFileProcessor = class {
|
|
358873
|
+
constructor(commandName) {
|
|
358874
|
+
this.commandName = commandName;
|
|
358875
|
+
}
|
|
358876
|
+
static {
|
|
358877
|
+
__name(this, "AtFileProcessor");
|
|
358878
|
+
}
|
|
358879
|
+
async process(input, context2) {
|
|
358880
|
+
const config2 = context2.services.config;
|
|
358881
|
+
if (!config2) {
|
|
358882
|
+
return input;
|
|
358883
|
+
}
|
|
358884
|
+
return flatMapTextParts(input, async (text) => {
|
|
358885
|
+
if (!text.includes(AT_FILE_INJECTION_TRIGGER)) {
|
|
358886
|
+
return [{ text }];
|
|
358887
|
+
}
|
|
358888
|
+
const injections = extractInjections(
|
|
358889
|
+
text,
|
|
358890
|
+
AT_FILE_INJECTION_TRIGGER,
|
|
358891
|
+
this.commandName
|
|
358892
|
+
);
|
|
358893
|
+
if (injections.length === 0) {
|
|
358894
|
+
return [{ text }];
|
|
358895
|
+
}
|
|
358896
|
+
const output = [];
|
|
358897
|
+
let lastIndex = 0;
|
|
358898
|
+
for (const injection of injections) {
|
|
358899
|
+
const prefix = text.substring(lastIndex, injection.startIndex);
|
|
358900
|
+
if (prefix) {
|
|
358901
|
+
output.push({ text: prefix });
|
|
358902
|
+
}
|
|
358903
|
+
const pathStr = injection.content;
|
|
358904
|
+
try {
|
|
358905
|
+
const fileContentParts = await readPathFromWorkspace(pathStr, config2);
|
|
358906
|
+
if (fileContentParts.length === 0) {
|
|
358907
|
+
const uiMessage = `File '@{${pathStr}}' was ignored by .gitignore or .rdmindignore and was not included in the prompt.`;
|
|
358908
|
+
context2.ui.addItem(
|
|
358909
|
+
{ type: "info" /* INFO */, text: uiMessage },
|
|
358910
|
+
Date.now()
|
|
358911
|
+
);
|
|
358912
|
+
}
|
|
358913
|
+
output.push(...fileContentParts);
|
|
358914
|
+
} catch (error2) {
|
|
358915
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
358916
|
+
const uiMessage = `Failed to inject content for '@{${pathStr}}': ${message}`;
|
|
358917
|
+
console.error(
|
|
358918
|
+
`[AtFileProcessor] ${uiMessage}. Leaving placeholder in prompt.`
|
|
358919
|
+
);
|
|
358920
|
+
context2.ui.addItem(
|
|
358921
|
+
{ type: "error" /* ERROR */, text: uiMessage },
|
|
358922
|
+
Date.now()
|
|
358923
|
+
);
|
|
358924
|
+
const placeholder = text.substring(
|
|
358925
|
+
injection.startIndex,
|
|
358926
|
+
injection.endIndex
|
|
358927
|
+
);
|
|
358928
|
+
output.push({ text: placeholder });
|
|
358929
|
+
}
|
|
358930
|
+
lastIndex = injection.endIndex;
|
|
358931
|
+
}
|
|
358932
|
+
const suffix = text.substring(lastIndex);
|
|
358933
|
+
if (suffix) {
|
|
358934
|
+
output.push({ text: suffix });
|
|
358935
|
+
}
|
|
358936
|
+
return output;
|
|
358937
|
+
});
|
|
358938
|
+
}
|
|
358939
|
+
};
|
|
358940
|
+
|
|
358941
|
+
// packages/cli/src/services/FileCommandLoader.ts
|
|
358942
|
+
var TomlCommandDefSchema = external_exports.object({
|
|
358943
|
+
prompt: external_exports.string({
|
|
358944
|
+
required_error: "The 'prompt' field is required.",
|
|
358945
|
+
invalid_type_error: "The 'prompt' field must be a string."
|
|
358946
|
+
}),
|
|
358947
|
+
description: external_exports.string().optional()
|
|
358948
|
+
});
|
|
358949
|
+
var FileCommandLoader = class {
|
|
358950
|
+
constructor(config2) {
|
|
358951
|
+
this.config = config2;
|
|
358952
|
+
this.folderTrustEnabled = !!config2?.getFolderTrustFeature();
|
|
358953
|
+
this.folderTrust = !!config2?.getFolderTrust();
|
|
358954
|
+
this.projectRoot = config2?.getProjectRoot() || process.cwd();
|
|
358955
|
+
}
|
|
358956
|
+
static {
|
|
358957
|
+
__name(this, "FileCommandLoader");
|
|
358958
|
+
}
|
|
358959
|
+
projectRoot;
|
|
358960
|
+
folderTrustEnabled;
|
|
358961
|
+
folderTrust;
|
|
358962
|
+
/**
|
|
358963
|
+
* Loads all commands from user, project, and extension directories.
|
|
358964
|
+
* Returns commands in order: user → project → extensions (alphabetically).
|
|
358965
|
+
*
|
|
358966
|
+
* Order is important for conflict resolution in CommandService:
|
|
358967
|
+
* - User/project commands (without extensionName) use "last wins" strategy
|
|
358968
|
+
* - Extension commands (with extensionName) get renamed if conflicts exist
|
|
358969
|
+
*
|
|
358970
|
+
* @param signal An AbortSignal to cancel the loading process.
|
|
358971
|
+
* @returns A promise that resolves to an array of all loaded SlashCommands.
|
|
358972
|
+
*/
|
|
358973
|
+
async loadCommands(signal) {
|
|
358974
|
+
const allCommands = [];
|
|
358975
|
+
const globOptions = {
|
|
358976
|
+
nodir: true,
|
|
358977
|
+
dot: true,
|
|
358978
|
+
signal,
|
|
358979
|
+
follow: true
|
|
358980
|
+
};
|
|
358981
|
+
const commandDirs = this.getCommandDirectories();
|
|
358982
|
+
for (const dirInfo of commandDirs) {
|
|
358983
|
+
try {
|
|
358984
|
+
const files = await glob("**/*.toml", {
|
|
358985
|
+
...globOptions,
|
|
358986
|
+
cwd: dirInfo.path
|
|
358987
|
+
});
|
|
358988
|
+
if (this.folderTrustEnabled && !this.folderTrust) {
|
|
358989
|
+
return [];
|
|
358990
|
+
}
|
|
358991
|
+
const commandPromises = files.map(
|
|
358992
|
+
(file) => this.parseAndAdaptFile(
|
|
358993
|
+
path98.join(dirInfo.path, file),
|
|
358994
|
+
dirInfo.path,
|
|
358995
|
+
dirInfo.extensionName
|
|
358996
|
+
)
|
|
358997
|
+
);
|
|
358998
|
+
const commands = (await Promise.all(commandPromises)).filter(
|
|
358999
|
+
(cmd) => cmd !== null
|
|
359000
|
+
);
|
|
359001
|
+
allCommands.push(...commands);
|
|
359002
|
+
} catch (error2) {
|
|
359003
|
+
const isEnoent = error2.code === "ENOENT";
|
|
359004
|
+
const isAbortError2 = error2 instanceof Error && error2.name === "AbortError";
|
|
359005
|
+
if (!isEnoent && !isAbortError2) {
|
|
359006
|
+
console.error(
|
|
359007
|
+
`[FileCommandLoader] Error loading commands from ${dirInfo.path}:`,
|
|
359008
|
+
error2
|
|
359009
|
+
);
|
|
359010
|
+
}
|
|
359011
|
+
}
|
|
359012
|
+
}
|
|
359013
|
+
return allCommands;
|
|
359014
|
+
}
|
|
359015
|
+
/**
|
|
359016
|
+
* Get all command directories in order for loading.
|
|
359017
|
+
* User commands → Project commands → Extension commands
|
|
359018
|
+
* This order ensures extension commands can detect all conflicts.
|
|
359019
|
+
*/
|
|
359020
|
+
getCommandDirectories() {
|
|
359021
|
+
const dirs = [];
|
|
359022
|
+
const storage = this.config?.storage ?? new Storage(this.projectRoot);
|
|
359023
|
+
dirs.push({ path: Storage.getUserCommandsDir() });
|
|
359024
|
+
dirs.push({ path: storage.getProjectCommandsDir() });
|
|
359025
|
+
if (this.config) {
|
|
359026
|
+
const activeExtensions = this.config.getExtensions().filter((ext2) => ext2.isActive).sort((a2, b2) => a2.name.localeCompare(b2.name));
|
|
359027
|
+
const extensionCommandDirs = activeExtensions.map((ext2) => ({
|
|
359028
|
+
path: path98.join(ext2.path, "commands"),
|
|
359029
|
+
extensionName: ext2.name
|
|
359030
|
+
}));
|
|
359031
|
+
dirs.push(...extensionCommandDirs);
|
|
359032
|
+
}
|
|
359033
|
+
return dirs;
|
|
359034
|
+
}
|
|
359035
|
+
/**
|
|
359036
|
+
* Parses a single .toml file and transforms it into a SlashCommand object.
|
|
359037
|
+
* @param filePath The absolute path to the .toml file.
|
|
359038
|
+
* @param baseDir The root command directory for name calculation.
|
|
359039
|
+
* @param extensionName Optional extension name to prefix commands with.
|
|
359040
|
+
* @returns A promise resolving to a SlashCommand, or null if the file is invalid.
|
|
359041
|
+
*/
|
|
359042
|
+
async parseAndAdaptFile(filePath, baseDir, extensionName) {
|
|
359043
|
+
let fileContent;
|
|
359044
|
+
try {
|
|
359045
|
+
fileContent = await fs90.readFile(filePath, "utf-8");
|
|
359046
|
+
} catch (error2) {
|
|
359047
|
+
console.error(
|
|
359048
|
+
`[FileCommandLoader] Failed to read file ${filePath}:`,
|
|
359049
|
+
error2 instanceof Error ? error2.message : String(error2)
|
|
359050
|
+
);
|
|
359051
|
+
return null;
|
|
359052
|
+
}
|
|
359053
|
+
let parsed;
|
|
359054
|
+
try {
|
|
359055
|
+
parsed = import_toml.default.parse(fileContent);
|
|
359056
|
+
} catch (error2) {
|
|
359057
|
+
console.error(
|
|
359058
|
+
`[FileCommandLoader] Failed to parse TOML file ${filePath}:`,
|
|
359059
|
+
error2 instanceof Error ? error2.message : String(error2)
|
|
359060
|
+
);
|
|
359061
|
+
return null;
|
|
359062
|
+
}
|
|
359063
|
+
const validationResult = TomlCommandDefSchema.safeParse(parsed);
|
|
359064
|
+
if (!validationResult.success) {
|
|
359065
|
+
console.error(
|
|
359066
|
+
`[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
|
|
359067
|
+
validationResult.error.flatten()
|
|
359068
|
+
);
|
|
359069
|
+
return null;
|
|
359070
|
+
}
|
|
359071
|
+
const validDef = validationResult.data;
|
|
359072
|
+
const relativePathWithExt = path98.relative(baseDir, filePath);
|
|
359073
|
+
const relativePath = relativePathWithExt.substring(
|
|
359074
|
+
0,
|
|
359075
|
+
relativePathWithExt.length - 5
|
|
359076
|
+
// length of '.toml'
|
|
359077
|
+
);
|
|
359078
|
+
const baseCommandName = relativePath.split(path98.sep).map((segment) => segment.replaceAll(":", "_")).join(":");
|
|
359079
|
+
const defaultDescription = `Custom command from ${path98.basename(filePath)}`;
|
|
359080
|
+
let description = validDef.description || defaultDescription;
|
|
359081
|
+
if (extensionName) {
|
|
359082
|
+
description = `[${extensionName}] ${description}`;
|
|
359083
|
+
}
|
|
359084
|
+
const processors = [];
|
|
359085
|
+
const usesArgs = validDef.prompt.includes(SHORTHAND_ARGS_PLACEHOLDER);
|
|
359086
|
+
const usesShellInjection = validDef.prompt.includes(
|
|
359087
|
+
SHELL_INJECTION_TRIGGER
|
|
359088
|
+
);
|
|
359089
|
+
const usesAtFileInjection = validDef.prompt.includes(
|
|
359090
|
+
AT_FILE_INJECTION_TRIGGER
|
|
359091
|
+
);
|
|
359092
|
+
if (usesAtFileInjection) {
|
|
359093
|
+
processors.push(new AtFileProcessor(baseCommandName));
|
|
359094
|
+
}
|
|
359095
|
+
if (usesShellInjection || usesArgs) {
|
|
359096
|
+
processors.push(new ShellProcessor(baseCommandName));
|
|
359097
|
+
}
|
|
359098
|
+
if (!usesArgs) {
|
|
359099
|
+
processors.push(new DefaultArgumentProcessor());
|
|
359100
|
+
}
|
|
359101
|
+
return {
|
|
359102
|
+
name: baseCommandName,
|
|
359103
|
+
description,
|
|
359104
|
+
kind: "file" /* FILE */,
|
|
359105
|
+
extensionName,
|
|
359106
|
+
action: /* @__PURE__ */ __name(async (context2, _args) => {
|
|
359107
|
+
if (!context2.invocation) {
|
|
359108
|
+
console.error(
|
|
359109
|
+
`[FileCommandLoader] Critical error: Command '${baseCommandName}' was executed without invocation context.`
|
|
359110
|
+
);
|
|
359111
|
+
return {
|
|
359112
|
+
type: "submit_prompt",
|
|
359113
|
+
content: [{ text: validDef.prompt }]
|
|
359114
|
+
// Fallback to unprocessed prompt
|
|
359115
|
+
};
|
|
359116
|
+
}
|
|
359117
|
+
try {
|
|
359118
|
+
let processedContent = [
|
|
359119
|
+
{ text: validDef.prompt }
|
|
359120
|
+
];
|
|
359121
|
+
for (const processor of processors) {
|
|
359122
|
+
processedContent = await processor.process(
|
|
359123
|
+
processedContent,
|
|
359124
|
+
context2
|
|
359125
|
+
);
|
|
359126
|
+
}
|
|
359127
|
+
return {
|
|
359128
|
+
type: "submit_prompt",
|
|
359129
|
+
content: processedContent
|
|
359130
|
+
};
|
|
359131
|
+
} catch (e4) {
|
|
359132
|
+
if (e4 instanceof ConfirmationRequiredError) {
|
|
359133
|
+
return {
|
|
359134
|
+
type: "confirm_shell_commands",
|
|
359135
|
+
commandsToConfirm: e4.commandsToConfirm,
|
|
359136
|
+
originalInvocation: {
|
|
359137
|
+
raw: context2.invocation.raw
|
|
359138
|
+
}
|
|
359139
|
+
};
|
|
359140
|
+
}
|
|
359141
|
+
throw e4;
|
|
359142
|
+
}
|
|
359143
|
+
}, "action")
|
|
359144
|
+
};
|
|
359145
|
+
}
|
|
359146
|
+
};
|
|
359147
|
+
|
|
359148
|
+
// packages/cli/src/services/MarkdownCommandLoader.ts
|
|
359149
|
+
init_esbuild_shims();
|
|
359150
|
+
init_esm11();
|
|
359151
|
+
init_zod();
|
|
359152
|
+
import { promises as fs91 } from "node:fs";
|
|
359153
|
+
import path99 from "node:path";
|
|
359154
|
+
var MarkdownCommandDefSchema = external_exports.object({
|
|
359155
|
+
name: external_exports.string(),
|
|
359156
|
+
id: external_exports.string().optional(),
|
|
359157
|
+
category: external_exports.string().optional(),
|
|
359158
|
+
description: external_exports.string()
|
|
359159
|
+
});
|
|
359160
|
+
var MarkdownCommandLoader = class {
|
|
359161
|
+
static {
|
|
359162
|
+
__name(this, "MarkdownCommandLoader");
|
|
359163
|
+
}
|
|
359164
|
+
projectRoot;
|
|
359165
|
+
folderTrustEnabled;
|
|
359166
|
+
folderTrust;
|
|
359167
|
+
constructor(config2) {
|
|
359168
|
+
this.folderTrustEnabled = !!config2?.getFolderTrustFeature();
|
|
359169
|
+
this.folderTrust = !!config2?.getFolderTrust();
|
|
359170
|
+
this.projectRoot = config2?.getProjectRoot() || process.cwd();
|
|
359171
|
+
}
|
|
359172
|
+
/**
|
|
359173
|
+
* Loads all markdown commands from OpenSpec directories.
|
|
359174
|
+
*/
|
|
359175
|
+
async loadCommands(signal) {
|
|
359176
|
+
if (this.folderTrustEnabled && !this.folderTrust) {
|
|
359177
|
+
return [];
|
|
359178
|
+
}
|
|
359179
|
+
const allCommands = [];
|
|
359180
|
+
const globOptions = {
|
|
359181
|
+
nodir: true,
|
|
359182
|
+
dot: true,
|
|
359183
|
+
signal,
|
|
359184
|
+
follow: true
|
|
359185
|
+
};
|
|
359186
|
+
const commandDirs = this.getOpenSpecCommandDirectories();
|
|
359187
|
+
for (const dirPath of commandDirs) {
|
|
359188
|
+
try {
|
|
359189
|
+
const files = await glob("**/*.md", {
|
|
359190
|
+
...globOptions,
|
|
359191
|
+
cwd: dirPath
|
|
359192
|
+
});
|
|
359193
|
+
const commandPromises = files.map(
|
|
359194
|
+
(file) => this.parseAndAdaptFile(path99.join(dirPath, file))
|
|
359195
|
+
);
|
|
359196
|
+
const commands = (await Promise.all(commandPromises)).filter(
|
|
359197
|
+
(cmd) => cmd !== null
|
|
359198
|
+
);
|
|
359199
|
+
allCommands.push(...commands);
|
|
359200
|
+
} catch (error2) {
|
|
359201
|
+
const isEnoent = error2.code === "ENOENT";
|
|
359202
|
+
const isAbortError2 = error2 instanceof Error && error2.name === "AbortError";
|
|
359203
|
+
if (!isEnoent && !isAbortError2) {
|
|
359204
|
+
console.error(
|
|
359205
|
+
`[MarkdownCommandLoader] Error loading commands from ${dirPath}:`,
|
|
359206
|
+
error2
|
|
359207
|
+
);
|
|
359208
|
+
}
|
|
359209
|
+
}
|
|
359210
|
+
}
|
|
359211
|
+
return allCommands;
|
|
359212
|
+
}
|
|
359213
|
+
/**
|
|
359214
|
+
* Get directories containing OpenSpec markdown command files.
|
|
359215
|
+
*/
|
|
359216
|
+
getOpenSpecCommandDirectories() {
|
|
359217
|
+
const rdmindCommandsDir = path99.join(
|
|
359218
|
+
this.projectRoot,
|
|
359219
|
+
".rdmind",
|
|
359220
|
+
"commands"
|
|
359221
|
+
);
|
|
359222
|
+
return [rdmindCommandsDir];
|
|
359223
|
+
}
|
|
359224
|
+
/**
|
|
359225
|
+
* Parses a markdown file with YAML front matter and converts it to a SlashCommand.
|
|
359226
|
+
*/
|
|
359227
|
+
async parseAndAdaptFile(filePath) {
|
|
359228
|
+
let fileContent;
|
|
359229
|
+
try {
|
|
359230
|
+
fileContent = await fs91.readFile(filePath, "utf-8");
|
|
359231
|
+
} catch (error2) {
|
|
359232
|
+
console.error(
|
|
359233
|
+
`[MarkdownCommandLoader] Failed to read file ${filePath}:`,
|
|
359234
|
+
error2 instanceof Error ? error2.message : String(error2)
|
|
359235
|
+
);
|
|
359236
|
+
return null;
|
|
359237
|
+
}
|
|
359238
|
+
const frontMatterResult = this.parseFrontMatter(fileContent);
|
|
359239
|
+
if (!frontMatterResult) {
|
|
359240
|
+
return null;
|
|
359241
|
+
}
|
|
359242
|
+
const { frontMatter, content } = frontMatterResult;
|
|
359243
|
+
const validationResult = MarkdownCommandDefSchema.safeParse(frontMatter);
|
|
359244
|
+
if (!validationResult.success) {
|
|
359245
|
+
console.error(
|
|
359246
|
+
`[MarkdownCommandLoader] Invalid front matter in ${filePath}:`,
|
|
359247
|
+
validationResult.error.flatten()
|
|
359248
|
+
);
|
|
359249
|
+
return null;
|
|
359250
|
+
}
|
|
359251
|
+
const validDef = validationResult.data;
|
|
359252
|
+
const commandName = validDef.name.startsWith("/") ? validDef.name.substring(1) : validDef.name;
|
|
359253
|
+
let description = validDef.description;
|
|
359254
|
+
if (commandName === "openspec-proposal") {
|
|
359255
|
+
description = t4("Scaffold a new OpenSpec change and validate strictly.");
|
|
359256
|
+
} else if (commandName === "openspec-apply") {
|
|
359257
|
+
description = t4(
|
|
359258
|
+
"Implement an approved OpenSpec change and keep tasks in sync."
|
|
359259
|
+
);
|
|
359260
|
+
} else if (commandName === "openspec-archive") {
|
|
359261
|
+
description = t4("Archive a deployed OpenSpec change and update specs.");
|
|
359262
|
+
}
|
|
359263
|
+
return {
|
|
359264
|
+
name: commandName,
|
|
359265
|
+
description,
|
|
359266
|
+
kind: "file" /* FILE */,
|
|
359267
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
359268
|
+
const prompt = content.trim() + (args ? `
|
|
359269
|
+
|
|
359270
|
+
${args}` : "");
|
|
359271
|
+
return {
|
|
359272
|
+
type: "submit_prompt",
|
|
359273
|
+
content: [{ text: prompt }]
|
|
359274
|
+
};
|
|
359275
|
+
}, "action")
|
|
359276
|
+
};
|
|
359277
|
+
}
|
|
359278
|
+
/**
|
|
359279
|
+
* Parses YAML front matter from markdown content.
|
|
359280
|
+
*/
|
|
359281
|
+
parseFrontMatter(content) {
|
|
359282
|
+
const lines = content.split("\n");
|
|
359283
|
+
if (lines[0]?.trim() !== "---") {
|
|
359284
|
+
return null;
|
|
359285
|
+
}
|
|
359286
|
+
let endIndex = -1;
|
|
359287
|
+
for (let i3 = 1; i3 < lines.length; i3++) {
|
|
359288
|
+
if (lines[i3]?.trim() === "---") {
|
|
359289
|
+
endIndex = i3;
|
|
359290
|
+
break;
|
|
359291
|
+
}
|
|
359292
|
+
}
|
|
359293
|
+
if (endIndex === -1) {
|
|
359294
|
+
return null;
|
|
359295
|
+
}
|
|
359296
|
+
const frontMatterLines = lines.slice(1, endIndex);
|
|
359297
|
+
const contentLines = lines.slice(endIndex + 1);
|
|
359298
|
+
try {
|
|
359299
|
+
const frontMatter = {};
|
|
359300
|
+
for (const line of frontMatterLines) {
|
|
359301
|
+
const trimmed2 = line.trim();
|
|
359302
|
+
if (trimmed2 && !trimmed2.startsWith("#")) {
|
|
359303
|
+
const colonIndex = trimmed2.indexOf(":");
|
|
359304
|
+
if (colonIndex > 0) {
|
|
359305
|
+
const key = trimmed2.substring(0, colonIndex).trim();
|
|
359306
|
+
const value = trimmed2.substring(colonIndex + 1).trim();
|
|
359307
|
+
frontMatter[key] = value;
|
|
359308
|
+
}
|
|
359309
|
+
}
|
|
359310
|
+
}
|
|
359311
|
+
return {
|
|
359312
|
+
frontMatter,
|
|
359313
|
+
content: contentLines.join("\n")
|
|
359314
|
+
};
|
|
359315
|
+
} catch (error2) {
|
|
359316
|
+
console.error("Failed to parse front matter:", error2);
|
|
359317
|
+
return null;
|
|
359318
|
+
}
|
|
359319
|
+
}
|
|
359320
|
+
};
|
|
359321
|
+
|
|
359322
|
+
// packages/cli/src/ui/noninteractive/nonInteractiveUi.ts
|
|
359323
|
+
init_esbuild_shims();
|
|
359324
|
+
function createNonInteractiveUI() {
|
|
359325
|
+
return {
|
|
359326
|
+
addItem: /* @__PURE__ */ __name((_item, _timestamp) => 0, "addItem"),
|
|
359327
|
+
clear: /* @__PURE__ */ __name(() => {
|
|
359328
|
+
}, "clear"),
|
|
359329
|
+
setDebugMessage: /* @__PURE__ */ __name((_message) => {
|
|
359330
|
+
}, "setDebugMessage"),
|
|
359331
|
+
loadHistory: /* @__PURE__ */ __name((_newHistory) => {
|
|
359332
|
+
}, "loadHistory"),
|
|
359333
|
+
pendingItem: null,
|
|
359334
|
+
setPendingItem: /* @__PURE__ */ __name((_item) => {
|
|
359335
|
+
}, "setPendingItem"),
|
|
359336
|
+
toggleVimEnabled: /* @__PURE__ */ __name(async () => false, "toggleVimEnabled"),
|
|
359337
|
+
setGeminiMdFileCount: /* @__PURE__ */ __name((_count) => {
|
|
359338
|
+
}, "setGeminiMdFileCount"),
|
|
359339
|
+
reloadCommands: /* @__PURE__ */ __name(() => {
|
|
359340
|
+
}, "reloadCommands"),
|
|
359341
|
+
extensionsUpdateState: /* @__PURE__ */ new Map(),
|
|
359342
|
+
dispatchExtensionStateUpdate: /* @__PURE__ */ __name((_action) => {
|
|
359343
|
+
}, "dispatchExtensionStateUpdate"),
|
|
359344
|
+
addConfirmUpdateExtensionRequest: /* @__PURE__ */ __name((_request) => {
|
|
359345
|
+
}, "addConfirmUpdateExtensionRequest")
|
|
359346
|
+
};
|
|
358485
359347
|
}
|
|
358486
|
-
__name(
|
|
358487
|
-
|
|
358488
|
-
|
|
358489
|
-
|
|
359348
|
+
__name(createNonInteractiveUI, "createNonInteractiveUI");
|
|
359349
|
+
|
|
359350
|
+
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
359351
|
+
var ALLOWED_BUILTIN_COMMANDS_NON_INTERACTIVE = [
|
|
359352
|
+
"init",
|
|
359353
|
+
"summary",
|
|
359354
|
+
"compress"
|
|
359355
|
+
];
|
|
359356
|
+
function handleCommandResult(result) {
|
|
359357
|
+
switch (result.type) {
|
|
359358
|
+
case "submit_prompt":
|
|
359359
|
+
return {
|
|
359360
|
+
type: "submit_prompt",
|
|
359361
|
+
content: result.content
|
|
359362
|
+
};
|
|
359363
|
+
case "message":
|
|
359364
|
+
return {
|
|
359365
|
+
type: "message",
|
|
359366
|
+
messageType: result.messageType,
|
|
359367
|
+
content: result.content
|
|
359368
|
+
};
|
|
359369
|
+
case "stream_messages":
|
|
359370
|
+
return {
|
|
359371
|
+
type: "stream_messages",
|
|
359372
|
+
messages: result.messages
|
|
359373
|
+
};
|
|
359374
|
+
/**
|
|
359375
|
+
* Currently return types below are never generated due to the
|
|
359376
|
+
* whitelist of allowed slash commands in ACP and non-interactive mode.
|
|
359377
|
+
* We'll try to add more supported return types in the future.
|
|
359378
|
+
*/
|
|
359379
|
+
case "tool":
|
|
359380
|
+
return {
|
|
359381
|
+
type: "unsupported",
|
|
359382
|
+
reason: "Tool execution from slash commands is not supported in non-interactive mode.",
|
|
359383
|
+
originalType: "tool"
|
|
359384
|
+
};
|
|
359385
|
+
case "quit":
|
|
359386
|
+
return {
|
|
359387
|
+
type: "unsupported",
|
|
359388
|
+
reason: "Quit command is not supported in non-interactive mode. The process will exit naturally after completion.",
|
|
359389
|
+
originalType: "quit"
|
|
359390
|
+
};
|
|
359391
|
+
case "dialog":
|
|
359392
|
+
return {
|
|
359393
|
+
type: "unsupported",
|
|
359394
|
+
reason: `Dialog '${result.dialog}' cannot be opened in non-interactive mode.`,
|
|
359395
|
+
originalType: "dialog"
|
|
359396
|
+
};
|
|
359397
|
+
case "load_history":
|
|
359398
|
+
return {
|
|
359399
|
+
type: "unsupported",
|
|
359400
|
+
reason: "Loading history is not supported in non-interactive mode. Each invocation starts with a fresh context.",
|
|
359401
|
+
originalType: "load_history"
|
|
359402
|
+
};
|
|
359403
|
+
case "confirm_shell_commands":
|
|
359404
|
+
return {
|
|
359405
|
+
type: "unsupported",
|
|
359406
|
+
reason: "Shell command confirmation is not supported in non-interactive mode. Use YOLO mode or pre-approve commands.",
|
|
359407
|
+
originalType: "confirm_shell_commands"
|
|
359408
|
+
};
|
|
359409
|
+
case "confirm_action":
|
|
359410
|
+
return {
|
|
359411
|
+
type: "unsupported",
|
|
359412
|
+
reason: "Action confirmation is not supported in non-interactive mode. Commands requiring confirmation cannot be executed.",
|
|
359413
|
+
originalType: "confirm_action"
|
|
359414
|
+
};
|
|
359415
|
+
default: {
|
|
359416
|
+
const _exhaustive = result;
|
|
359417
|
+
return {
|
|
359418
|
+
type: "unsupported",
|
|
359419
|
+
reason: `Unknown command result type: ${_exhaustive.type}`,
|
|
359420
|
+
originalType: "unknown"
|
|
359421
|
+
};
|
|
359422
|
+
}
|
|
358490
359423
|
}
|
|
358491
|
-
return metrics2.tokens.cached / metrics2.tokens.prompt * 100;
|
|
358492
359424
|
}
|
|
358493
|
-
__name(
|
|
358494
|
-
|
|
358495
|
-
|
|
358496
|
-
|
|
358497
|
-
|
|
358498
|
-
|
|
359425
|
+
__name(handleCommandResult, "handleCommandResult");
|
|
359426
|
+
function filterCommandsForNonInteractive(commands, allowedBuiltinCommandNames) {
|
|
359427
|
+
return commands.filter((cmd) => {
|
|
359428
|
+
if (cmd.kind === "file" /* FILE */) {
|
|
359429
|
+
return true;
|
|
359430
|
+
}
|
|
359431
|
+
if (cmd.kind === "markdown" /* MARKDOWN */) {
|
|
359432
|
+
return true;
|
|
359433
|
+
}
|
|
359434
|
+
if (cmd.kind === "built-in" /* BUILT_IN */) {
|
|
359435
|
+
return allowedBuiltinCommandNames.has(cmd.name);
|
|
359436
|
+
}
|
|
359437
|
+
return false;
|
|
359438
|
+
});
|
|
359439
|
+
}
|
|
359440
|
+
__name(filterCommandsForNonInteractive, "filterCommandsForNonInteractive");
|
|
359441
|
+
var handleSlashCommand = /* @__PURE__ */ __name(async (rawQuery, abortController, config2, settings, allowedBuiltinCommandNames = [
|
|
359442
|
+
...ALLOWED_BUILTIN_COMMANDS_NON_INTERACTIVE
|
|
359443
|
+
]) => {
|
|
359444
|
+
const trimmed2 = rawQuery.trim();
|
|
359445
|
+
if (!trimmed2.startsWith("/")) {
|
|
359446
|
+
return { type: "no_command" };
|
|
359447
|
+
}
|
|
359448
|
+
const isAcpMode = config2.getExperimentalZedIntegration();
|
|
359449
|
+
const isInteractive = config2.isInteractive();
|
|
359450
|
+
const executionMode = isAcpMode ? "acp" : isInteractive ? "interactive" : "non_interactive";
|
|
359451
|
+
const allowedBuiltinSet = new Set(allowedBuiltinCommandNames ?? []);
|
|
359452
|
+
const allLoaders = [
|
|
359453
|
+
new BuiltinCommandLoader(config2),
|
|
359454
|
+
new FileCommandLoader(config2),
|
|
359455
|
+
new MarkdownCommandLoader(config2)
|
|
359456
|
+
];
|
|
359457
|
+
const commandService = await CommandService.create(
|
|
359458
|
+
allLoaders,
|
|
359459
|
+
abortController.signal
|
|
358499
359460
|
);
|
|
358500
|
-
const
|
|
358501
|
-
const
|
|
358502
|
-
|
|
358503
|
-
|
|
358504
|
-
const totalCachedTokens = Object.values(models).reduce(
|
|
358505
|
-
(acc, model) => acc + model.tokens.cached,
|
|
358506
|
-
0
|
|
359461
|
+
const allCommands = commandService.getCommands();
|
|
359462
|
+
const filteredCommands = filterCommandsForNonInteractive(
|
|
359463
|
+
allCommands,
|
|
359464
|
+
allowedBuiltinSet
|
|
358507
359465
|
);
|
|
358508
|
-
const
|
|
358509
|
-
|
|
358510
|
-
|
|
359466
|
+
const { commandToExecute, args } = parseSlashCommand(
|
|
359467
|
+
rawQuery,
|
|
359468
|
+
filteredCommands
|
|
358511
359469
|
);
|
|
358512
|
-
|
|
358513
|
-
|
|
358514
|
-
|
|
358515
|
-
|
|
358516
|
-
|
|
358517
|
-
|
|
358518
|
-
|
|
358519
|
-
|
|
358520
|
-
|
|
358521
|
-
|
|
358522
|
-
|
|
358523
|
-
|
|
358524
|
-
|
|
358525
|
-
|
|
358526
|
-
|
|
358527
|
-
|
|
358528
|
-
|
|
358529
|
-
|
|
359470
|
+
if (!commandToExecute) {
|
|
359471
|
+
const { commandToExecute: knownCommand } = parseSlashCommand(
|
|
359472
|
+
rawQuery,
|
|
359473
|
+
allCommands
|
|
359474
|
+
);
|
|
359475
|
+
if (knownCommand) {
|
|
359476
|
+
return {
|
|
359477
|
+
type: "unsupported",
|
|
359478
|
+
reason: t4(
|
|
359479
|
+
'The command "/{{command}}" is not supported in non-interactive mode.',
|
|
359480
|
+
{ command: knownCommand.name }
|
|
359481
|
+
),
|
|
359482
|
+
originalType: "filtered_command"
|
|
359483
|
+
};
|
|
359484
|
+
}
|
|
359485
|
+
return { type: "no_command" };
|
|
359486
|
+
}
|
|
359487
|
+
if (!commandToExecute.action) {
|
|
359488
|
+
return { type: "no_command" };
|
|
359489
|
+
}
|
|
359490
|
+
const sessionStats = {
|
|
359491
|
+
sessionId: config2?.getSessionId(),
|
|
359492
|
+
sessionStartTime: /* @__PURE__ */ new Date(),
|
|
359493
|
+
metrics: uiTelemetryService.getMetrics(),
|
|
359494
|
+
lastPromptTokenCount: 0,
|
|
359495
|
+
promptCount: 1
|
|
358530
359496
|
};
|
|
358531
|
-
|
|
359497
|
+
const logger6 = new Logger(config2?.getSessionId() || "", config2?.storage);
|
|
359498
|
+
const context2 = {
|
|
359499
|
+
executionMode,
|
|
359500
|
+
services: {
|
|
359501
|
+
config: config2,
|
|
359502
|
+
settings,
|
|
359503
|
+
git: void 0,
|
|
359504
|
+
logger: logger6
|
|
359505
|
+
},
|
|
359506
|
+
ui: createNonInteractiveUI(),
|
|
359507
|
+
session: {
|
|
359508
|
+
stats: sessionStats,
|
|
359509
|
+
sessionShellAllowlist: /* @__PURE__ */ new Set()
|
|
359510
|
+
},
|
|
359511
|
+
invocation: {
|
|
359512
|
+
raw: trimmed2,
|
|
359513
|
+
name: commandToExecute.name,
|
|
359514
|
+
args
|
|
359515
|
+
}
|
|
359516
|
+
};
|
|
359517
|
+
const result = await commandToExecute.action(context2, args);
|
|
359518
|
+
if (!result) {
|
|
359519
|
+
return {
|
|
359520
|
+
type: "message",
|
|
359521
|
+
messageType: "info",
|
|
359522
|
+
content: "Command executed successfully."
|
|
359523
|
+
};
|
|
359524
|
+
}
|
|
359525
|
+
return handleCommandResult(result);
|
|
359526
|
+
}, "handleSlashCommand");
|
|
359527
|
+
var getAvailableCommands = /* @__PURE__ */ __name(async (config2, abortSignal, allowedBuiltinCommandNames = [
|
|
359528
|
+
...ALLOWED_BUILTIN_COMMANDS_NON_INTERACTIVE
|
|
359529
|
+
]) => {
|
|
359530
|
+
try {
|
|
359531
|
+
const allowedBuiltinSet = new Set(allowedBuiltinCommandNames ?? []);
|
|
359532
|
+
const loaders = [
|
|
359533
|
+
new FileCommandLoader(config2),
|
|
359534
|
+
new MarkdownCommandLoader(config2)
|
|
359535
|
+
];
|
|
359536
|
+
if (allowedBuiltinSet.size > 0) {
|
|
359537
|
+
loaders.push(new BuiltinCommandLoader(config2));
|
|
359538
|
+
}
|
|
359539
|
+
const commandService = await CommandService.create(loaders, abortSignal);
|
|
359540
|
+
const commands = commandService.getCommands();
|
|
359541
|
+
const filteredCommands = filterCommandsForNonInteractive(
|
|
359542
|
+
commands,
|
|
359543
|
+
allowedBuiltinSet
|
|
359544
|
+
);
|
|
359545
|
+
return filteredCommands.filter((cmd) => !cmd.hidden);
|
|
359546
|
+
} catch (error2) {
|
|
359547
|
+
console.error("Error loading available commands:", error2);
|
|
359548
|
+
return [];
|
|
359549
|
+
}
|
|
359550
|
+
}, "getAvailableCommands");
|
|
358532
359551
|
|
|
358533
359552
|
// packages/cli/src/utils/nonInteractiveHelpers.ts
|
|
358534
359553
|
function normalizePartList(parts) {
|
|
@@ -358593,19 +359612,15 @@ function computeUsageFromMetrics(metrics2) {
|
|
|
358593
359612
|
return usage2;
|
|
358594
359613
|
}
|
|
358595
359614
|
__name(computeUsageFromMetrics, "computeUsageFromMetrics");
|
|
358596
|
-
async function loadSlashCommandNames(config2) {
|
|
359615
|
+
async function loadSlashCommandNames(config2, allowedBuiltinCommandNames) {
|
|
358597
359616
|
const controller = new AbortController();
|
|
358598
359617
|
try {
|
|
358599
|
-
const
|
|
358600
|
-
|
|
358601
|
-
controller.signal
|
|
359618
|
+
const commands = await getAvailableCommands(
|
|
359619
|
+
config2,
|
|
359620
|
+
controller.signal,
|
|
359621
|
+
allowedBuiltinCommandNames
|
|
358602
359622
|
);
|
|
358603
|
-
|
|
358604
|
-
const commands = service.getCommands();
|
|
358605
|
-
for (const command2 of commands) {
|
|
358606
|
-
names.add(command2.name);
|
|
358607
|
-
}
|
|
358608
|
-
return Array.from(names).sort();
|
|
359623
|
+
return commands.map((cmd) => cmd.name).sort();
|
|
358609
359624
|
} catch (error2) {
|
|
358610
359625
|
if (config2.getDebugMode()) {
|
|
358611
359626
|
console.error(
|
|
@@ -358619,7 +359634,7 @@ async function loadSlashCommandNames(config2) {
|
|
|
358619
359634
|
}
|
|
358620
359635
|
}
|
|
358621
359636
|
__name(loadSlashCommandNames, "loadSlashCommandNames");
|
|
358622
|
-
async function buildSystemMessage(config2, sessionId, permissionMode) {
|
|
359637
|
+
async function buildSystemMessage(config2, sessionId, permissionMode, allowedBuiltinCommandNames) {
|
|
358623
359638
|
const toolRegistry = config2.getToolRegistry();
|
|
358624
359639
|
const tools = toolRegistry ? toolRegistry.getAllToolNames() : [];
|
|
358625
359640
|
const mcpServers = config2.getMcpServers();
|
|
@@ -358627,7 +359642,10 @@ async function buildSystemMessage(config2, sessionId, permissionMode) {
|
|
|
358627
359642
|
name: name3,
|
|
358628
359643
|
status: getMCPServerStatus(name3)
|
|
358629
359644
|
})) : [];
|
|
358630
|
-
const slashCommands = await loadSlashCommandNames(
|
|
359645
|
+
const slashCommands = await loadSlashCommandNames(
|
|
359646
|
+
config2,
|
|
359647
|
+
allowedBuiltinCommandNames
|
|
359648
|
+
);
|
|
358631
359649
|
let agentNames = [];
|
|
358632
359650
|
try {
|
|
358633
359651
|
const subagentManager = config2.getSubagentManager();
|
|
@@ -359880,866 +360898,6 @@ var StreamJsonOutputAdapter = class extends BaseJsonOutputAdapter {
|
|
|
359880
360898
|
}
|
|
359881
360899
|
};
|
|
359882
360900
|
|
|
359883
|
-
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
359884
|
-
init_esbuild_shims();
|
|
359885
|
-
|
|
359886
|
-
// packages/cli/src/utils/commands.ts
|
|
359887
|
-
init_esbuild_shims();
|
|
359888
|
-
var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
359889
|
-
const trimmed2 = query.trim();
|
|
359890
|
-
const parts = trimmed2.substring(1).trim().split(/\s+/);
|
|
359891
|
-
const commandPath = parts.filter((p2) => p2);
|
|
359892
|
-
let currentCommands = commands;
|
|
359893
|
-
let commandToExecute;
|
|
359894
|
-
let pathIndex = 0;
|
|
359895
|
-
const canonicalPath = [];
|
|
359896
|
-
for (const part of commandPath) {
|
|
359897
|
-
let foundCommand = currentCommands.find((cmd) => cmd.name === part);
|
|
359898
|
-
if (!foundCommand) {
|
|
359899
|
-
foundCommand = currentCommands.find(
|
|
359900
|
-
(cmd) => cmd.altNames?.includes(part)
|
|
359901
|
-
);
|
|
359902
|
-
}
|
|
359903
|
-
if (foundCommand) {
|
|
359904
|
-
commandToExecute = foundCommand;
|
|
359905
|
-
canonicalPath.push(foundCommand.name);
|
|
359906
|
-
pathIndex++;
|
|
359907
|
-
if (foundCommand.subCommands) {
|
|
359908
|
-
currentCommands = foundCommand.subCommands;
|
|
359909
|
-
} else {
|
|
359910
|
-
break;
|
|
359911
|
-
}
|
|
359912
|
-
} else {
|
|
359913
|
-
break;
|
|
359914
|
-
}
|
|
359915
|
-
}
|
|
359916
|
-
const args = parts.slice(pathIndex).join(" ");
|
|
359917
|
-
return { commandToExecute, args, canonicalPath };
|
|
359918
|
-
}, "parseSlashCommand");
|
|
359919
|
-
|
|
359920
|
-
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
359921
|
-
init_core5();
|
|
359922
|
-
|
|
359923
|
-
// packages/cli/src/services/FileCommandLoader.ts
|
|
359924
|
-
init_esbuild_shims();
|
|
359925
|
-
var import_toml = __toESM(require_toml(), 1);
|
|
359926
|
-
init_esm11();
|
|
359927
|
-
init_zod();
|
|
359928
|
-
init_core5();
|
|
359929
|
-
import { promises as fs90 } from "node:fs";
|
|
359930
|
-
import path98 from "node:path";
|
|
359931
|
-
|
|
359932
|
-
// packages/cli/src/services/prompt-processors/argumentProcessor.ts
|
|
359933
|
-
init_esbuild_shims();
|
|
359934
|
-
init_core5();
|
|
359935
|
-
var DefaultArgumentProcessor = class {
|
|
359936
|
-
static {
|
|
359937
|
-
__name(this, "DefaultArgumentProcessor");
|
|
359938
|
-
}
|
|
359939
|
-
async process(prompt, context2) {
|
|
359940
|
-
if (context2.invocation?.args) {
|
|
359941
|
-
return appendToLastTextPart(prompt, context2.invocation.raw);
|
|
359942
|
-
}
|
|
359943
|
-
return prompt;
|
|
359944
|
-
}
|
|
359945
|
-
};
|
|
359946
|
-
|
|
359947
|
-
// packages/cli/src/services/prompt-processors/types.ts
|
|
359948
|
-
init_esbuild_shims();
|
|
359949
|
-
var SHORTHAND_ARGS_PLACEHOLDER = "{{args}}";
|
|
359950
|
-
var SHELL_INJECTION_TRIGGER = "!{";
|
|
359951
|
-
var AT_FILE_INJECTION_TRIGGER = "@{";
|
|
359952
|
-
|
|
359953
|
-
// packages/cli/src/services/prompt-processors/shellProcessor.ts
|
|
359954
|
-
init_esbuild_shims();
|
|
359955
|
-
init_core5();
|
|
359956
|
-
|
|
359957
|
-
// packages/cli/src/services/prompt-processors/injectionParser.ts
|
|
359958
|
-
init_esbuild_shims();
|
|
359959
|
-
function extractInjections(prompt, trigger, contextName) {
|
|
359960
|
-
const injections = [];
|
|
359961
|
-
let index = 0;
|
|
359962
|
-
while (index < prompt.length) {
|
|
359963
|
-
const startIndex = prompt.indexOf(trigger, index);
|
|
359964
|
-
if (startIndex === -1) {
|
|
359965
|
-
break;
|
|
359966
|
-
}
|
|
359967
|
-
let currentIndex = startIndex + trigger.length;
|
|
359968
|
-
let braceCount = 1;
|
|
359969
|
-
let foundEnd = false;
|
|
359970
|
-
while (currentIndex < prompt.length) {
|
|
359971
|
-
const char = prompt[currentIndex];
|
|
359972
|
-
if (char === "{") {
|
|
359973
|
-
braceCount++;
|
|
359974
|
-
} else if (char === "}") {
|
|
359975
|
-
braceCount--;
|
|
359976
|
-
if (braceCount === 0) {
|
|
359977
|
-
const injectionContent = prompt.substring(
|
|
359978
|
-
startIndex + trigger.length,
|
|
359979
|
-
currentIndex
|
|
359980
|
-
);
|
|
359981
|
-
const endIndex = currentIndex + 1;
|
|
359982
|
-
injections.push({
|
|
359983
|
-
content: injectionContent.trim(),
|
|
359984
|
-
startIndex,
|
|
359985
|
-
endIndex
|
|
359986
|
-
});
|
|
359987
|
-
index = endIndex;
|
|
359988
|
-
foundEnd = true;
|
|
359989
|
-
break;
|
|
359990
|
-
}
|
|
359991
|
-
}
|
|
359992
|
-
currentIndex++;
|
|
359993
|
-
}
|
|
359994
|
-
if (!foundEnd) {
|
|
359995
|
-
const contextInfo = contextName ? ` in command '${contextName}'` : "";
|
|
359996
|
-
throw new Error(
|
|
359997
|
-
`Invalid syntax${contextInfo}: Unclosed injection starting at index ${startIndex} ('${trigger}'). Ensure braces are balanced. Paths or commands with unbalanced braces are not supported directly.`
|
|
359998
|
-
);
|
|
359999
|
-
}
|
|
360000
|
-
}
|
|
360001
|
-
return injections;
|
|
360002
|
-
}
|
|
360003
|
-
__name(extractInjections, "extractInjections");
|
|
360004
|
-
|
|
360005
|
-
// packages/cli/src/services/prompt-processors/shellProcessor.ts
|
|
360006
|
-
var ConfirmationRequiredError = class extends Error {
|
|
360007
|
-
constructor(message, commandsToConfirm) {
|
|
360008
|
-
super(message);
|
|
360009
|
-
this.commandsToConfirm = commandsToConfirm;
|
|
360010
|
-
this.name = "ConfirmationRequiredError";
|
|
360011
|
-
}
|
|
360012
|
-
static {
|
|
360013
|
-
__name(this, "ConfirmationRequiredError");
|
|
360014
|
-
}
|
|
360015
|
-
};
|
|
360016
|
-
var ShellProcessor = class {
|
|
360017
|
-
constructor(commandName) {
|
|
360018
|
-
this.commandName = commandName;
|
|
360019
|
-
}
|
|
360020
|
-
static {
|
|
360021
|
-
__name(this, "ShellProcessor");
|
|
360022
|
-
}
|
|
360023
|
-
async process(prompt, context2) {
|
|
360024
|
-
return flatMapTextParts(
|
|
360025
|
-
prompt,
|
|
360026
|
-
(text) => this.processString(text, context2)
|
|
360027
|
-
);
|
|
360028
|
-
}
|
|
360029
|
-
async processString(prompt, context2) {
|
|
360030
|
-
const userArgsRaw = context2.invocation?.args || "";
|
|
360031
|
-
if (!prompt.includes(SHELL_INJECTION_TRIGGER)) {
|
|
360032
|
-
return [
|
|
360033
|
-
{ text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
|
|
360034
|
-
];
|
|
360035
|
-
}
|
|
360036
|
-
const config2 = context2.services.config;
|
|
360037
|
-
if (!config2) {
|
|
360038
|
-
throw new Error(
|
|
360039
|
-
`Security configuration not loaded. Cannot verify shell command permissions for '${this.commandName}'. Aborting.`
|
|
360040
|
-
);
|
|
360041
|
-
}
|
|
360042
|
-
const { sessionShellAllowlist } = context2.session;
|
|
360043
|
-
const injections = extractInjections(
|
|
360044
|
-
prompt,
|
|
360045
|
-
SHELL_INJECTION_TRIGGER,
|
|
360046
|
-
this.commandName
|
|
360047
|
-
);
|
|
360048
|
-
if (injections.length === 0) {
|
|
360049
|
-
return [
|
|
360050
|
-
{ text: prompt.replaceAll(SHORTHAND_ARGS_PLACEHOLDER, userArgsRaw) }
|
|
360051
|
-
];
|
|
360052
|
-
}
|
|
360053
|
-
const { shell: shell2 } = getShellConfiguration();
|
|
360054
|
-
const userArgsEscaped = escapeShellArg(userArgsRaw, shell2);
|
|
360055
|
-
const resolvedInjections = injections.map(
|
|
360056
|
-
(injection) => {
|
|
360057
|
-
const command2 = injection.content;
|
|
360058
|
-
if (command2 === "") {
|
|
360059
|
-
return { ...injection, resolvedCommand: void 0 };
|
|
360060
|
-
}
|
|
360061
|
-
const resolvedCommand = command2.replaceAll(
|
|
360062
|
-
SHORTHAND_ARGS_PLACEHOLDER,
|
|
360063
|
-
userArgsEscaped
|
|
360064
|
-
);
|
|
360065
|
-
return { ...injection, resolvedCommand };
|
|
360066
|
-
}
|
|
360067
|
-
);
|
|
360068
|
-
const commandsToConfirm = /* @__PURE__ */ new Set();
|
|
360069
|
-
for (const injection of resolvedInjections) {
|
|
360070
|
-
const command2 = injection.resolvedCommand;
|
|
360071
|
-
if (!command2) continue;
|
|
360072
|
-
const { allAllowed, disallowedCommands, blockReason, isHardDenial } = checkCommandPermissions(command2, config2, sessionShellAllowlist);
|
|
360073
|
-
if (!allAllowed) {
|
|
360074
|
-
if (isHardDenial) {
|
|
360075
|
-
throw new Error(
|
|
360076
|
-
`${this.commandName} cannot be run. Blocked command: "${command2}". Reason: ${blockReason || "Blocked by configuration."}`
|
|
360077
|
-
);
|
|
360078
|
-
}
|
|
360079
|
-
if (config2.getApprovalMode() !== "yolo" /* YOLO */) {
|
|
360080
|
-
disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
|
|
360081
|
-
}
|
|
360082
|
-
}
|
|
360083
|
-
}
|
|
360084
|
-
if (commandsToConfirm.size > 0) {
|
|
360085
|
-
throw new ConfirmationRequiredError(
|
|
360086
|
-
"Shell command confirmation required",
|
|
360087
|
-
Array.from(commandsToConfirm)
|
|
360088
|
-
);
|
|
360089
|
-
}
|
|
360090
|
-
let processedPrompt = "";
|
|
360091
|
-
let lastIndex = 0;
|
|
360092
|
-
for (const injection of resolvedInjections) {
|
|
360093
|
-
const segment = prompt.substring(lastIndex, injection.startIndex);
|
|
360094
|
-
processedPrompt += segment.replaceAll(
|
|
360095
|
-
SHORTHAND_ARGS_PLACEHOLDER,
|
|
360096
|
-
userArgsRaw
|
|
360097
|
-
);
|
|
360098
|
-
if (injection.resolvedCommand) {
|
|
360099
|
-
const activeTheme = themeManager.getActiveTheme();
|
|
360100
|
-
const shellExecutionConfig = {
|
|
360101
|
-
...config2.getShellExecutionConfig(),
|
|
360102
|
-
defaultFg: activeTheme.colors.Foreground,
|
|
360103
|
-
defaultBg: activeTheme.colors.Background
|
|
360104
|
-
};
|
|
360105
|
-
const { result } = await ShellExecutionService.execute(
|
|
360106
|
-
injection.resolvedCommand,
|
|
360107
|
-
config2.getTargetDir(),
|
|
360108
|
-
() => {
|
|
360109
|
-
},
|
|
360110
|
-
new AbortController().signal,
|
|
360111
|
-
config2.getShouldUseNodePtyShell(),
|
|
360112
|
-
shellExecutionConfig
|
|
360113
|
-
);
|
|
360114
|
-
const executionResult = await result;
|
|
360115
|
-
if (executionResult.error && !executionResult.aborted) {
|
|
360116
|
-
throw new Error(
|
|
360117
|
-
`Failed to start shell command in '${this.commandName}': ${executionResult.error.message}. Command: ${injection.resolvedCommand}`
|
|
360118
|
-
);
|
|
360119
|
-
}
|
|
360120
|
-
processedPrompt += executionResult.output;
|
|
360121
|
-
if (executionResult.aborted) {
|
|
360122
|
-
processedPrompt += `
|
|
360123
|
-
[Shell command '${injection.resolvedCommand}' aborted]`;
|
|
360124
|
-
} else if (executionResult.exitCode !== 0 && executionResult.exitCode !== null) {
|
|
360125
|
-
processedPrompt += `
|
|
360126
|
-
[Shell command '${injection.resolvedCommand}' exited with code ${executionResult.exitCode}]`;
|
|
360127
|
-
} else if (executionResult.signal !== null) {
|
|
360128
|
-
processedPrompt += `
|
|
360129
|
-
[Shell command '${injection.resolvedCommand}' terminated by signal ${executionResult.signal}]`;
|
|
360130
|
-
}
|
|
360131
|
-
}
|
|
360132
|
-
lastIndex = injection.endIndex;
|
|
360133
|
-
}
|
|
360134
|
-
const finalSegment = prompt.substring(lastIndex);
|
|
360135
|
-
processedPrompt += finalSegment.replaceAll(
|
|
360136
|
-
SHORTHAND_ARGS_PLACEHOLDER,
|
|
360137
|
-
userArgsRaw
|
|
360138
|
-
);
|
|
360139
|
-
return [{ text: processedPrompt }];
|
|
360140
|
-
}
|
|
360141
|
-
};
|
|
360142
|
-
|
|
360143
|
-
// packages/cli/src/services/prompt-processors/atFileProcessor.ts
|
|
360144
|
-
init_esbuild_shims();
|
|
360145
|
-
init_core5();
|
|
360146
|
-
var AtFileProcessor = class {
|
|
360147
|
-
constructor(commandName) {
|
|
360148
|
-
this.commandName = commandName;
|
|
360149
|
-
}
|
|
360150
|
-
static {
|
|
360151
|
-
__name(this, "AtFileProcessor");
|
|
360152
|
-
}
|
|
360153
|
-
async process(input, context2) {
|
|
360154
|
-
const config2 = context2.services.config;
|
|
360155
|
-
if (!config2) {
|
|
360156
|
-
return input;
|
|
360157
|
-
}
|
|
360158
|
-
return flatMapTextParts(input, async (text) => {
|
|
360159
|
-
if (!text.includes(AT_FILE_INJECTION_TRIGGER)) {
|
|
360160
|
-
return [{ text }];
|
|
360161
|
-
}
|
|
360162
|
-
const injections = extractInjections(
|
|
360163
|
-
text,
|
|
360164
|
-
AT_FILE_INJECTION_TRIGGER,
|
|
360165
|
-
this.commandName
|
|
360166
|
-
);
|
|
360167
|
-
if (injections.length === 0) {
|
|
360168
|
-
return [{ text }];
|
|
360169
|
-
}
|
|
360170
|
-
const output = [];
|
|
360171
|
-
let lastIndex = 0;
|
|
360172
|
-
for (const injection of injections) {
|
|
360173
|
-
const prefix = text.substring(lastIndex, injection.startIndex);
|
|
360174
|
-
if (prefix) {
|
|
360175
|
-
output.push({ text: prefix });
|
|
360176
|
-
}
|
|
360177
|
-
const pathStr = injection.content;
|
|
360178
|
-
try {
|
|
360179
|
-
const fileContentParts = await readPathFromWorkspace(pathStr, config2);
|
|
360180
|
-
if (fileContentParts.length === 0) {
|
|
360181
|
-
const uiMessage = `File '@{${pathStr}}' was ignored by .gitignore or .rdmindignore and was not included in the prompt.`;
|
|
360182
|
-
context2.ui.addItem(
|
|
360183
|
-
{ type: "info" /* INFO */, text: uiMessage },
|
|
360184
|
-
Date.now()
|
|
360185
|
-
);
|
|
360186
|
-
}
|
|
360187
|
-
output.push(...fileContentParts);
|
|
360188
|
-
} catch (error2) {
|
|
360189
|
-
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
360190
|
-
const uiMessage = `Failed to inject content for '@{${pathStr}}': ${message}`;
|
|
360191
|
-
console.error(
|
|
360192
|
-
`[AtFileProcessor] ${uiMessage}. Leaving placeholder in prompt.`
|
|
360193
|
-
);
|
|
360194
|
-
context2.ui.addItem(
|
|
360195
|
-
{ type: "error" /* ERROR */, text: uiMessage },
|
|
360196
|
-
Date.now()
|
|
360197
|
-
);
|
|
360198
|
-
const placeholder = text.substring(
|
|
360199
|
-
injection.startIndex,
|
|
360200
|
-
injection.endIndex
|
|
360201
|
-
);
|
|
360202
|
-
output.push({ text: placeholder });
|
|
360203
|
-
}
|
|
360204
|
-
lastIndex = injection.endIndex;
|
|
360205
|
-
}
|
|
360206
|
-
const suffix = text.substring(lastIndex);
|
|
360207
|
-
if (suffix) {
|
|
360208
|
-
output.push({ text: suffix });
|
|
360209
|
-
}
|
|
360210
|
-
return output;
|
|
360211
|
-
});
|
|
360212
|
-
}
|
|
360213
|
-
};
|
|
360214
|
-
|
|
360215
|
-
// packages/cli/src/services/FileCommandLoader.ts
|
|
360216
|
-
var TomlCommandDefSchema = external_exports.object({
|
|
360217
|
-
prompt: external_exports.string({
|
|
360218
|
-
required_error: "The 'prompt' field is required.",
|
|
360219
|
-
invalid_type_error: "The 'prompt' field must be a string."
|
|
360220
|
-
}),
|
|
360221
|
-
description: external_exports.string().optional()
|
|
360222
|
-
});
|
|
360223
|
-
var FileCommandLoader = class {
|
|
360224
|
-
constructor(config2) {
|
|
360225
|
-
this.config = config2;
|
|
360226
|
-
this.folderTrustEnabled = !!config2?.getFolderTrustFeature();
|
|
360227
|
-
this.folderTrust = !!config2?.getFolderTrust();
|
|
360228
|
-
this.projectRoot = config2?.getProjectRoot() || process.cwd();
|
|
360229
|
-
}
|
|
360230
|
-
static {
|
|
360231
|
-
__name(this, "FileCommandLoader");
|
|
360232
|
-
}
|
|
360233
|
-
projectRoot;
|
|
360234
|
-
folderTrustEnabled;
|
|
360235
|
-
folderTrust;
|
|
360236
|
-
/**
|
|
360237
|
-
* Loads all commands from user, project, and extension directories.
|
|
360238
|
-
* Returns commands in order: user → project → extensions (alphabetically).
|
|
360239
|
-
*
|
|
360240
|
-
* Order is important for conflict resolution in CommandService:
|
|
360241
|
-
* - User/project commands (without extensionName) use "last wins" strategy
|
|
360242
|
-
* - Extension commands (with extensionName) get renamed if conflicts exist
|
|
360243
|
-
*
|
|
360244
|
-
* @param signal An AbortSignal to cancel the loading process.
|
|
360245
|
-
* @returns A promise that resolves to an array of all loaded SlashCommands.
|
|
360246
|
-
*/
|
|
360247
|
-
async loadCommands(signal) {
|
|
360248
|
-
const allCommands = [];
|
|
360249
|
-
const globOptions = {
|
|
360250
|
-
nodir: true,
|
|
360251
|
-
dot: true,
|
|
360252
|
-
signal,
|
|
360253
|
-
follow: true
|
|
360254
|
-
};
|
|
360255
|
-
const commandDirs = this.getCommandDirectories();
|
|
360256
|
-
for (const dirInfo of commandDirs) {
|
|
360257
|
-
try {
|
|
360258
|
-
const files = await glob("**/*.toml", {
|
|
360259
|
-
...globOptions,
|
|
360260
|
-
cwd: dirInfo.path
|
|
360261
|
-
});
|
|
360262
|
-
if (this.folderTrustEnabled && !this.folderTrust) {
|
|
360263
|
-
return [];
|
|
360264
|
-
}
|
|
360265
|
-
const commandPromises = files.map(
|
|
360266
|
-
(file) => this.parseAndAdaptFile(
|
|
360267
|
-
path98.join(dirInfo.path, file),
|
|
360268
|
-
dirInfo.path,
|
|
360269
|
-
dirInfo.extensionName
|
|
360270
|
-
)
|
|
360271
|
-
);
|
|
360272
|
-
const commands = (await Promise.all(commandPromises)).filter(
|
|
360273
|
-
(cmd) => cmd !== null
|
|
360274
|
-
);
|
|
360275
|
-
allCommands.push(...commands);
|
|
360276
|
-
} catch (error2) {
|
|
360277
|
-
const isEnoent = error2.code === "ENOENT";
|
|
360278
|
-
const isAbortError2 = error2 instanceof Error && error2.name === "AbortError";
|
|
360279
|
-
if (!isEnoent && !isAbortError2) {
|
|
360280
|
-
console.error(
|
|
360281
|
-
`[FileCommandLoader] Error loading commands from ${dirInfo.path}:`,
|
|
360282
|
-
error2
|
|
360283
|
-
);
|
|
360284
|
-
}
|
|
360285
|
-
}
|
|
360286
|
-
}
|
|
360287
|
-
return allCommands;
|
|
360288
|
-
}
|
|
360289
|
-
/**
|
|
360290
|
-
* Get all command directories in order for loading.
|
|
360291
|
-
* User commands → Project commands → Extension commands
|
|
360292
|
-
* This order ensures extension commands can detect all conflicts.
|
|
360293
|
-
*/
|
|
360294
|
-
getCommandDirectories() {
|
|
360295
|
-
const dirs = [];
|
|
360296
|
-
const storage = this.config?.storage ?? new Storage(this.projectRoot);
|
|
360297
|
-
dirs.push({ path: Storage.getUserCommandsDir() });
|
|
360298
|
-
dirs.push({ path: storage.getProjectCommandsDir() });
|
|
360299
|
-
if (this.config) {
|
|
360300
|
-
const activeExtensions = this.config.getExtensions().filter((ext2) => ext2.isActive).sort((a2, b2) => a2.name.localeCompare(b2.name));
|
|
360301
|
-
const extensionCommandDirs = activeExtensions.map((ext2) => ({
|
|
360302
|
-
path: path98.join(ext2.path, "commands"),
|
|
360303
|
-
extensionName: ext2.name
|
|
360304
|
-
}));
|
|
360305
|
-
dirs.push(...extensionCommandDirs);
|
|
360306
|
-
}
|
|
360307
|
-
return dirs;
|
|
360308
|
-
}
|
|
360309
|
-
/**
|
|
360310
|
-
* Parses a single .toml file and transforms it into a SlashCommand object.
|
|
360311
|
-
* @param filePath The absolute path to the .toml file.
|
|
360312
|
-
* @param baseDir The root command directory for name calculation.
|
|
360313
|
-
* @param extensionName Optional extension name to prefix commands with.
|
|
360314
|
-
* @returns A promise resolving to a SlashCommand, or null if the file is invalid.
|
|
360315
|
-
*/
|
|
360316
|
-
async parseAndAdaptFile(filePath, baseDir, extensionName) {
|
|
360317
|
-
let fileContent;
|
|
360318
|
-
try {
|
|
360319
|
-
fileContent = await fs90.readFile(filePath, "utf-8");
|
|
360320
|
-
} catch (error2) {
|
|
360321
|
-
console.error(
|
|
360322
|
-
`[FileCommandLoader] Failed to read file ${filePath}:`,
|
|
360323
|
-
error2 instanceof Error ? error2.message : String(error2)
|
|
360324
|
-
);
|
|
360325
|
-
return null;
|
|
360326
|
-
}
|
|
360327
|
-
let parsed;
|
|
360328
|
-
try {
|
|
360329
|
-
parsed = import_toml.default.parse(fileContent);
|
|
360330
|
-
} catch (error2) {
|
|
360331
|
-
console.error(
|
|
360332
|
-
`[FileCommandLoader] Failed to parse TOML file ${filePath}:`,
|
|
360333
|
-
error2 instanceof Error ? error2.message : String(error2)
|
|
360334
|
-
);
|
|
360335
|
-
return null;
|
|
360336
|
-
}
|
|
360337
|
-
const validationResult = TomlCommandDefSchema.safeParse(parsed);
|
|
360338
|
-
if (!validationResult.success) {
|
|
360339
|
-
console.error(
|
|
360340
|
-
`[FileCommandLoader] Skipping invalid command file: ${filePath}. Validation errors:`,
|
|
360341
|
-
validationResult.error.flatten()
|
|
360342
|
-
);
|
|
360343
|
-
return null;
|
|
360344
|
-
}
|
|
360345
|
-
const validDef = validationResult.data;
|
|
360346
|
-
const relativePathWithExt = path98.relative(baseDir, filePath);
|
|
360347
|
-
const relativePath = relativePathWithExt.substring(
|
|
360348
|
-
0,
|
|
360349
|
-
relativePathWithExt.length - 5
|
|
360350
|
-
// length of '.toml'
|
|
360351
|
-
);
|
|
360352
|
-
const baseCommandName = relativePath.split(path98.sep).map((segment) => segment.replaceAll(":", "_")).join(":");
|
|
360353
|
-
const defaultDescription = `Custom command from ${path98.basename(filePath)}`;
|
|
360354
|
-
let description = validDef.description || defaultDescription;
|
|
360355
|
-
if (extensionName) {
|
|
360356
|
-
description = `[${extensionName}] ${description}`;
|
|
360357
|
-
}
|
|
360358
|
-
const processors = [];
|
|
360359
|
-
const usesArgs = validDef.prompt.includes(SHORTHAND_ARGS_PLACEHOLDER);
|
|
360360
|
-
const usesShellInjection = validDef.prompt.includes(
|
|
360361
|
-
SHELL_INJECTION_TRIGGER
|
|
360362
|
-
);
|
|
360363
|
-
const usesAtFileInjection = validDef.prompt.includes(
|
|
360364
|
-
AT_FILE_INJECTION_TRIGGER
|
|
360365
|
-
);
|
|
360366
|
-
if (usesAtFileInjection) {
|
|
360367
|
-
processors.push(new AtFileProcessor(baseCommandName));
|
|
360368
|
-
}
|
|
360369
|
-
if (usesShellInjection || usesArgs) {
|
|
360370
|
-
processors.push(new ShellProcessor(baseCommandName));
|
|
360371
|
-
}
|
|
360372
|
-
if (!usesArgs) {
|
|
360373
|
-
processors.push(new DefaultArgumentProcessor());
|
|
360374
|
-
}
|
|
360375
|
-
return {
|
|
360376
|
-
name: baseCommandName,
|
|
360377
|
-
description,
|
|
360378
|
-
kind: "file" /* FILE */,
|
|
360379
|
-
extensionName,
|
|
360380
|
-
action: /* @__PURE__ */ __name(async (context2, _args) => {
|
|
360381
|
-
if (!context2.invocation) {
|
|
360382
|
-
console.error(
|
|
360383
|
-
`[FileCommandLoader] Critical error: Command '${baseCommandName}' was executed without invocation context.`
|
|
360384
|
-
);
|
|
360385
|
-
return {
|
|
360386
|
-
type: "submit_prompt",
|
|
360387
|
-
content: [{ text: validDef.prompt }]
|
|
360388
|
-
// Fallback to unprocessed prompt
|
|
360389
|
-
};
|
|
360390
|
-
}
|
|
360391
|
-
try {
|
|
360392
|
-
let processedContent = [
|
|
360393
|
-
{ text: validDef.prompt }
|
|
360394
|
-
];
|
|
360395
|
-
for (const processor of processors) {
|
|
360396
|
-
processedContent = await processor.process(
|
|
360397
|
-
processedContent,
|
|
360398
|
-
context2
|
|
360399
|
-
);
|
|
360400
|
-
}
|
|
360401
|
-
return {
|
|
360402
|
-
type: "submit_prompt",
|
|
360403
|
-
content: processedContent
|
|
360404
|
-
};
|
|
360405
|
-
} catch (e4) {
|
|
360406
|
-
if (e4 instanceof ConfirmationRequiredError) {
|
|
360407
|
-
return {
|
|
360408
|
-
type: "confirm_shell_commands",
|
|
360409
|
-
commandsToConfirm: e4.commandsToConfirm,
|
|
360410
|
-
originalInvocation: {
|
|
360411
|
-
raw: context2.invocation.raw
|
|
360412
|
-
}
|
|
360413
|
-
};
|
|
360414
|
-
}
|
|
360415
|
-
throw e4;
|
|
360416
|
-
}
|
|
360417
|
-
}, "action")
|
|
360418
|
-
};
|
|
360419
|
-
}
|
|
360420
|
-
};
|
|
360421
|
-
|
|
360422
|
-
// packages/cli/src/services/MarkdownCommandLoader.ts
|
|
360423
|
-
init_esbuild_shims();
|
|
360424
|
-
init_esm11();
|
|
360425
|
-
init_zod();
|
|
360426
|
-
import { promises as fs91 } from "node:fs";
|
|
360427
|
-
import path99 from "node:path";
|
|
360428
|
-
var MarkdownCommandDefSchema = external_exports.object({
|
|
360429
|
-
name: external_exports.string(),
|
|
360430
|
-
id: external_exports.string().optional(),
|
|
360431
|
-
category: external_exports.string().optional(),
|
|
360432
|
-
description: external_exports.string()
|
|
360433
|
-
});
|
|
360434
|
-
var MarkdownCommandLoader = class {
|
|
360435
|
-
static {
|
|
360436
|
-
__name(this, "MarkdownCommandLoader");
|
|
360437
|
-
}
|
|
360438
|
-
projectRoot;
|
|
360439
|
-
folderTrustEnabled;
|
|
360440
|
-
folderTrust;
|
|
360441
|
-
constructor(config2) {
|
|
360442
|
-
this.folderTrustEnabled = !!config2?.getFolderTrustFeature();
|
|
360443
|
-
this.folderTrust = !!config2?.getFolderTrust();
|
|
360444
|
-
this.projectRoot = config2?.getProjectRoot() || process.cwd();
|
|
360445
|
-
}
|
|
360446
|
-
/**
|
|
360447
|
-
* Loads all markdown commands from OpenSpec directories.
|
|
360448
|
-
*/
|
|
360449
|
-
async loadCommands(signal) {
|
|
360450
|
-
if (this.folderTrustEnabled && !this.folderTrust) {
|
|
360451
|
-
return [];
|
|
360452
|
-
}
|
|
360453
|
-
const allCommands = [];
|
|
360454
|
-
const globOptions = {
|
|
360455
|
-
nodir: true,
|
|
360456
|
-
dot: true,
|
|
360457
|
-
signal,
|
|
360458
|
-
follow: true
|
|
360459
|
-
};
|
|
360460
|
-
const commandDirs = this.getOpenSpecCommandDirectories();
|
|
360461
|
-
for (const dirPath of commandDirs) {
|
|
360462
|
-
try {
|
|
360463
|
-
const files = await glob("**/*.md", {
|
|
360464
|
-
...globOptions,
|
|
360465
|
-
cwd: dirPath
|
|
360466
|
-
});
|
|
360467
|
-
const commandPromises = files.map(
|
|
360468
|
-
(file) => this.parseAndAdaptFile(path99.join(dirPath, file))
|
|
360469
|
-
);
|
|
360470
|
-
const commands = (await Promise.all(commandPromises)).filter(
|
|
360471
|
-
(cmd) => cmd !== null
|
|
360472
|
-
);
|
|
360473
|
-
allCommands.push(...commands);
|
|
360474
|
-
} catch (error2) {
|
|
360475
|
-
const isEnoent = error2.code === "ENOENT";
|
|
360476
|
-
const isAbortError2 = error2 instanceof Error && error2.name === "AbortError";
|
|
360477
|
-
if (!isEnoent && !isAbortError2) {
|
|
360478
|
-
console.error(
|
|
360479
|
-
`[MarkdownCommandLoader] Error loading commands from ${dirPath}:`,
|
|
360480
|
-
error2
|
|
360481
|
-
);
|
|
360482
|
-
}
|
|
360483
|
-
}
|
|
360484
|
-
}
|
|
360485
|
-
return allCommands;
|
|
360486
|
-
}
|
|
360487
|
-
/**
|
|
360488
|
-
* Get directories containing OpenSpec markdown command files.
|
|
360489
|
-
*/
|
|
360490
|
-
getOpenSpecCommandDirectories() {
|
|
360491
|
-
const rdmindCommandsDir = path99.join(
|
|
360492
|
-
this.projectRoot,
|
|
360493
|
-
".rdmind",
|
|
360494
|
-
"commands"
|
|
360495
|
-
);
|
|
360496
|
-
return [rdmindCommandsDir];
|
|
360497
|
-
}
|
|
360498
|
-
/**
|
|
360499
|
-
* Parses a markdown file with YAML front matter and converts it to a SlashCommand.
|
|
360500
|
-
*/
|
|
360501
|
-
async parseAndAdaptFile(filePath) {
|
|
360502
|
-
let fileContent;
|
|
360503
|
-
try {
|
|
360504
|
-
fileContent = await fs91.readFile(filePath, "utf-8");
|
|
360505
|
-
} catch (error2) {
|
|
360506
|
-
console.error(
|
|
360507
|
-
`[MarkdownCommandLoader] Failed to read file ${filePath}:`,
|
|
360508
|
-
error2 instanceof Error ? error2.message : String(error2)
|
|
360509
|
-
);
|
|
360510
|
-
return null;
|
|
360511
|
-
}
|
|
360512
|
-
const frontMatterResult = this.parseFrontMatter(fileContent);
|
|
360513
|
-
if (!frontMatterResult) {
|
|
360514
|
-
return null;
|
|
360515
|
-
}
|
|
360516
|
-
const { frontMatter, content } = frontMatterResult;
|
|
360517
|
-
const validationResult = MarkdownCommandDefSchema.safeParse(frontMatter);
|
|
360518
|
-
if (!validationResult.success) {
|
|
360519
|
-
console.error(
|
|
360520
|
-
`[MarkdownCommandLoader] Invalid front matter in ${filePath}:`,
|
|
360521
|
-
validationResult.error.flatten()
|
|
360522
|
-
);
|
|
360523
|
-
return null;
|
|
360524
|
-
}
|
|
360525
|
-
const validDef = validationResult.data;
|
|
360526
|
-
const commandName = validDef.name.startsWith("/") ? validDef.name.substring(1) : validDef.name;
|
|
360527
|
-
let description = validDef.description;
|
|
360528
|
-
if (commandName === "openspec-proposal") {
|
|
360529
|
-
description = t4("Scaffold a new OpenSpec change and validate strictly.");
|
|
360530
|
-
} else if (commandName === "openspec-apply") {
|
|
360531
|
-
description = t4(
|
|
360532
|
-
"Implement an approved OpenSpec change and keep tasks in sync."
|
|
360533
|
-
);
|
|
360534
|
-
} else if (commandName === "openspec-archive") {
|
|
360535
|
-
description = t4("Archive a deployed OpenSpec change and update specs.");
|
|
360536
|
-
}
|
|
360537
|
-
return {
|
|
360538
|
-
name: commandName,
|
|
360539
|
-
description,
|
|
360540
|
-
kind: "file" /* FILE */,
|
|
360541
|
-
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
360542
|
-
const prompt = content.trim() + (args ? `
|
|
360543
|
-
|
|
360544
|
-
${args}` : "");
|
|
360545
|
-
return {
|
|
360546
|
-
type: "submit_prompt",
|
|
360547
|
-
content: [{ text: prompt }]
|
|
360548
|
-
};
|
|
360549
|
-
}, "action")
|
|
360550
|
-
};
|
|
360551
|
-
}
|
|
360552
|
-
/**
|
|
360553
|
-
* Parses YAML front matter from markdown content.
|
|
360554
|
-
*/
|
|
360555
|
-
parseFrontMatter(content) {
|
|
360556
|
-
const lines = content.split("\n");
|
|
360557
|
-
if (lines[0]?.trim() !== "---") {
|
|
360558
|
-
return null;
|
|
360559
|
-
}
|
|
360560
|
-
let endIndex = -1;
|
|
360561
|
-
for (let i3 = 1; i3 < lines.length; i3++) {
|
|
360562
|
-
if (lines[i3]?.trim() === "---") {
|
|
360563
|
-
endIndex = i3;
|
|
360564
|
-
break;
|
|
360565
|
-
}
|
|
360566
|
-
}
|
|
360567
|
-
if (endIndex === -1) {
|
|
360568
|
-
return null;
|
|
360569
|
-
}
|
|
360570
|
-
const frontMatterLines = lines.slice(1, endIndex);
|
|
360571
|
-
const contentLines = lines.slice(endIndex + 1);
|
|
360572
|
-
try {
|
|
360573
|
-
const frontMatter = {};
|
|
360574
|
-
for (const line of frontMatterLines) {
|
|
360575
|
-
const trimmed2 = line.trim();
|
|
360576
|
-
if (trimmed2 && !trimmed2.startsWith("#")) {
|
|
360577
|
-
const colonIndex = trimmed2.indexOf(":");
|
|
360578
|
-
if (colonIndex > 0) {
|
|
360579
|
-
const key = trimmed2.substring(0, colonIndex).trim();
|
|
360580
|
-
const value = trimmed2.substring(colonIndex + 1).trim();
|
|
360581
|
-
frontMatter[key] = value;
|
|
360582
|
-
}
|
|
360583
|
-
}
|
|
360584
|
-
}
|
|
360585
|
-
return {
|
|
360586
|
-
frontMatter,
|
|
360587
|
-
content: contentLines.join("\n")
|
|
360588
|
-
};
|
|
360589
|
-
} catch (error2) {
|
|
360590
|
-
console.error("Failed to parse front matter:", error2);
|
|
360591
|
-
return null;
|
|
360592
|
-
}
|
|
360593
|
-
}
|
|
360594
|
-
};
|
|
360595
|
-
|
|
360596
|
-
// packages/cli/src/ui/noninteractive/nonInteractiveUi.ts
|
|
360597
|
-
init_esbuild_shims();
|
|
360598
|
-
function createNonInteractiveUI() {
|
|
360599
|
-
return {
|
|
360600
|
-
addItem: /* @__PURE__ */ __name((_item, _timestamp) => 0, "addItem"),
|
|
360601
|
-
clear: /* @__PURE__ */ __name(() => {
|
|
360602
|
-
}, "clear"),
|
|
360603
|
-
setDebugMessage: /* @__PURE__ */ __name((_message) => {
|
|
360604
|
-
}, "setDebugMessage"),
|
|
360605
|
-
loadHistory: /* @__PURE__ */ __name((_newHistory) => {
|
|
360606
|
-
}, "loadHistory"),
|
|
360607
|
-
pendingItem: null,
|
|
360608
|
-
setPendingItem: /* @__PURE__ */ __name((_item) => {
|
|
360609
|
-
}, "setPendingItem"),
|
|
360610
|
-
toggleVimEnabled: /* @__PURE__ */ __name(async () => false, "toggleVimEnabled"),
|
|
360611
|
-
setGeminiMdFileCount: /* @__PURE__ */ __name((_count) => {
|
|
360612
|
-
}, "setGeminiMdFileCount"),
|
|
360613
|
-
reloadCommands: /* @__PURE__ */ __name(() => {
|
|
360614
|
-
}, "reloadCommands"),
|
|
360615
|
-
extensionsUpdateState: /* @__PURE__ */ new Map(),
|
|
360616
|
-
dispatchExtensionStateUpdate: /* @__PURE__ */ __name((_action) => {
|
|
360617
|
-
}, "dispatchExtensionStateUpdate"),
|
|
360618
|
-
addConfirmUpdateExtensionRequest: /* @__PURE__ */ __name((_request) => {
|
|
360619
|
-
}, "addConfirmUpdateExtensionRequest")
|
|
360620
|
-
};
|
|
360621
|
-
}
|
|
360622
|
-
__name(createNonInteractiveUI, "createNonInteractiveUI");
|
|
360623
|
-
|
|
360624
|
-
// packages/cli/src/nonInteractiveCliCommands.ts
|
|
360625
|
-
function filterCommandsForNonInteractive(commands, allowedBuiltinCommandNames) {
|
|
360626
|
-
return commands.filter((cmd) => {
|
|
360627
|
-
if (cmd.kind === "file" /* FILE */) {
|
|
360628
|
-
return true;
|
|
360629
|
-
}
|
|
360630
|
-
if (cmd.kind === "markdown" /* MARKDOWN */) {
|
|
360631
|
-
return true;
|
|
360632
|
-
}
|
|
360633
|
-
if (cmd.kind === "built-in" /* BUILT_IN */) {
|
|
360634
|
-
return allowedBuiltinCommandNames.has(cmd.name);
|
|
360635
|
-
}
|
|
360636
|
-
return false;
|
|
360637
|
-
});
|
|
360638
|
-
}
|
|
360639
|
-
__name(filterCommandsForNonInteractive, "filterCommandsForNonInteractive");
|
|
360640
|
-
var handleSlashCommand = /* @__PURE__ */ __name(async (rawQuery, abortController, config2, settings, allowedBuiltinCommandNames) => {
|
|
360641
|
-
const trimmed2 = rawQuery.trim();
|
|
360642
|
-
if (!trimmed2.startsWith("/")) {
|
|
360643
|
-
return;
|
|
360644
|
-
}
|
|
360645
|
-
const allowedBuiltinSet = new Set(allowedBuiltinCommandNames ?? []);
|
|
360646
|
-
const loaders = [
|
|
360647
|
-
new FileCommandLoader(config2),
|
|
360648
|
-
new MarkdownCommandLoader(config2)
|
|
360649
|
-
];
|
|
360650
|
-
if (allowedBuiltinSet.size > 0) {
|
|
360651
|
-
loaders.push(new BuiltinCommandLoader(config2));
|
|
360652
|
-
}
|
|
360653
|
-
const commandService = await CommandService.create(
|
|
360654
|
-
loaders,
|
|
360655
|
-
abortController.signal
|
|
360656
|
-
);
|
|
360657
|
-
const commands = commandService.getCommands();
|
|
360658
|
-
const filteredCommands = filterCommandsForNonInteractive(
|
|
360659
|
-
commands,
|
|
360660
|
-
allowedBuiltinSet
|
|
360661
|
-
);
|
|
360662
|
-
const { commandToExecute, args } = parseSlashCommand(
|
|
360663
|
-
rawQuery,
|
|
360664
|
-
filteredCommands
|
|
360665
|
-
);
|
|
360666
|
-
if (commandToExecute) {
|
|
360667
|
-
if (commandToExecute.action) {
|
|
360668
|
-
const sessionStats = {
|
|
360669
|
-
sessionId: config2?.getSessionId(),
|
|
360670
|
-
sessionStartTime: /* @__PURE__ */ new Date(),
|
|
360671
|
-
metrics: uiTelemetryService.getMetrics(),
|
|
360672
|
-
lastPromptTokenCount: 0,
|
|
360673
|
-
promptCount: 1
|
|
360674
|
-
};
|
|
360675
|
-
const logger6 = new Logger(config2?.getSessionId() || "", config2?.storage);
|
|
360676
|
-
const context2 = {
|
|
360677
|
-
services: {
|
|
360678
|
-
config: config2,
|
|
360679
|
-
settings,
|
|
360680
|
-
git: void 0,
|
|
360681
|
-
logger: logger6
|
|
360682
|
-
},
|
|
360683
|
-
ui: createNonInteractiveUI(),
|
|
360684
|
-
session: {
|
|
360685
|
-
stats: sessionStats,
|
|
360686
|
-
sessionShellAllowlist: /* @__PURE__ */ new Set()
|
|
360687
|
-
},
|
|
360688
|
-
invocation: {
|
|
360689
|
-
raw: trimmed2,
|
|
360690
|
-
name: commandToExecute.name,
|
|
360691
|
-
args
|
|
360692
|
-
}
|
|
360693
|
-
};
|
|
360694
|
-
const result = await commandToExecute.action(context2, args);
|
|
360695
|
-
if (result) {
|
|
360696
|
-
switch (result.type) {
|
|
360697
|
-
case "submit_prompt":
|
|
360698
|
-
return result.content;
|
|
360699
|
-
case "message":
|
|
360700
|
-
if (result.messageType === "info") {
|
|
360701
|
-
console.log(result.content);
|
|
360702
|
-
} else {
|
|
360703
|
-
console.error(result.content);
|
|
360704
|
-
}
|
|
360705
|
-
return;
|
|
360706
|
-
case "confirm_shell_commands":
|
|
360707
|
-
throw new FatalInputError(
|
|
360708
|
-
"Exiting due to a confirmation prompt requested by the command."
|
|
360709
|
-
);
|
|
360710
|
-
default:
|
|
360711
|
-
throw new FatalInputError(
|
|
360712
|
-
"Exiting due to command result that is not supported in non-interactive mode."
|
|
360713
|
-
);
|
|
360714
|
-
}
|
|
360715
|
-
}
|
|
360716
|
-
}
|
|
360717
|
-
}
|
|
360718
|
-
return;
|
|
360719
|
-
}, "handleSlashCommand");
|
|
360720
|
-
var getAvailableCommands = /* @__PURE__ */ __name(async (config2, settings, abortSignal, allowedBuiltinCommandNames) => {
|
|
360721
|
-
try {
|
|
360722
|
-
const allowedBuiltinSet = new Set(allowedBuiltinCommandNames ?? []);
|
|
360723
|
-
const loaders = [
|
|
360724
|
-
new FileCommandLoader(config2),
|
|
360725
|
-
new MarkdownCommandLoader(config2)
|
|
360726
|
-
];
|
|
360727
|
-
if (allowedBuiltinSet.size > 0) {
|
|
360728
|
-
loaders.push(new BuiltinCommandLoader(config2));
|
|
360729
|
-
}
|
|
360730
|
-
const commandService = await CommandService.create(loaders, abortSignal);
|
|
360731
|
-
const commands = commandService.getCommands();
|
|
360732
|
-
const filteredCommands = filterCommandsForNonInteractive(
|
|
360733
|
-
commands,
|
|
360734
|
-
allowedBuiltinSet
|
|
360735
|
-
);
|
|
360736
|
-
return filteredCommands.filter((cmd) => !cmd.hidden);
|
|
360737
|
-
} catch (error2) {
|
|
360738
|
-
console.error("Error loading available commands:", error2);
|
|
360739
|
-
return [];
|
|
360740
|
-
}
|
|
360741
|
-
}, "getAvailableCommands");
|
|
360742
|
-
|
|
360743
360901
|
// packages/cli/src/ui/hooks/atCommandProcessor.ts
|
|
360744
360902
|
init_esbuild_shims();
|
|
360745
360903
|
init_core5();
|
|
@@ -361081,6 +361239,36 @@ __name(handleAtCommand, "handleAtCommand");
|
|
|
361081
361239
|
|
|
361082
361240
|
// packages/cli/src/nonInteractiveCli.ts
|
|
361083
361241
|
init_errors7();
|
|
361242
|
+
async function emitNonInteractiveFinalMessage(params) {
|
|
361243
|
+
const { message, isError, adapter, config: config2 } = params;
|
|
361244
|
+
if (!adapter) {
|
|
361245
|
+
const target = isError ? process.stderr : process.stdout;
|
|
361246
|
+
target.write(`${message}
|
|
361247
|
+
`);
|
|
361248
|
+
return;
|
|
361249
|
+
}
|
|
361250
|
+
adapter.startAssistantMessage();
|
|
361251
|
+
adapter.processEvent({
|
|
361252
|
+
type: "content" /* Content */,
|
|
361253
|
+
value: message
|
|
361254
|
+
});
|
|
361255
|
+
adapter.finalizeAssistantMessage();
|
|
361256
|
+
const metrics2 = uiTelemetryService.getMetrics();
|
|
361257
|
+
const usage2 = computeUsageFromMetrics(metrics2);
|
|
361258
|
+
const outputFormat = config2.getOutputFormat();
|
|
361259
|
+
const stats = outputFormat === "json" /* JSON */ ? uiTelemetryService.getMetrics() : void 0;
|
|
361260
|
+
adapter.emitResult({
|
|
361261
|
+
isError,
|
|
361262
|
+
durationMs: Date.now() - params.startTimeMs,
|
|
361263
|
+
apiDurationMs: 0,
|
|
361264
|
+
numTurns: 0,
|
|
361265
|
+
errorMessage: isError ? message : void 0,
|
|
361266
|
+
usage: usage2,
|
|
361267
|
+
stats,
|
|
361268
|
+
summary: message
|
|
361269
|
+
});
|
|
361270
|
+
}
|
|
361271
|
+
__name(emitNonInteractiveFinalMessage, "emitNonInteractiveFinalMessage");
|
|
361084
361272
|
async function runNonInteractive(config2, settings, input, prompt_id, options2 = {}) {
|
|
361085
361273
|
return promptIdContext.run(prompt_id, async () => {
|
|
361086
361274
|
let adapter;
|
|
@@ -361118,6 +361306,14 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361118
361306
|
process.stdout.on("error", stdoutErrorHandler);
|
|
361119
361307
|
process.on("SIGINT", shutdownHandler);
|
|
361120
361308
|
process.on("SIGTERM", shutdownHandler);
|
|
361309
|
+
if (adapter) {
|
|
361310
|
+
const systemMessage = await buildSystemMessage(
|
|
361311
|
+
config2,
|
|
361312
|
+
sessionId,
|
|
361313
|
+
permissionMode
|
|
361314
|
+
);
|
|
361315
|
+
adapter.emitMessage(systemMessage);
|
|
361316
|
+
}
|
|
361121
361317
|
let initialPartList = extractPartsFromUserMessage(
|
|
361122
361318
|
options2.userMessage
|
|
361123
361319
|
);
|
|
@@ -361130,9 +361326,43 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361130
361326
|
config2,
|
|
361131
361327
|
settings
|
|
361132
361328
|
);
|
|
361133
|
-
|
|
361134
|
-
|
|
361135
|
-
|
|
361329
|
+
switch (slashCommandResult.type) {
|
|
361330
|
+
case "submit_prompt":
|
|
361331
|
+
initialPartList = slashCommandResult.content;
|
|
361332
|
+
slashHandled = true;
|
|
361333
|
+
break;
|
|
361334
|
+
case "message": {
|
|
361335
|
+
await emitNonInteractiveFinalMessage({
|
|
361336
|
+
message: slashCommandResult.content,
|
|
361337
|
+
isError: slashCommandResult.messageType === "error",
|
|
361338
|
+
adapter,
|
|
361339
|
+
config: config2,
|
|
361340
|
+
startTimeMs: startTime
|
|
361341
|
+
});
|
|
361342
|
+
return;
|
|
361343
|
+
}
|
|
361344
|
+
case "stream_messages":
|
|
361345
|
+
throw new FatalInputError(
|
|
361346
|
+
"Stream messages mode is not supported in non-interactive CLI"
|
|
361347
|
+
);
|
|
361348
|
+
case "unsupported": {
|
|
361349
|
+
await emitNonInteractiveFinalMessage({
|
|
361350
|
+
message: slashCommandResult.reason,
|
|
361351
|
+
isError: true,
|
|
361352
|
+
adapter,
|
|
361353
|
+
config: config2,
|
|
361354
|
+
startTimeMs: startTime
|
|
361355
|
+
});
|
|
361356
|
+
return;
|
|
361357
|
+
}
|
|
361358
|
+
case "no_command":
|
|
361359
|
+
break;
|
|
361360
|
+
default: {
|
|
361361
|
+
const _exhaustive = slashCommandResult;
|
|
361362
|
+
throw new FatalInputError(
|
|
361363
|
+
`Unhandled slash command result type: ${_exhaustive.type}`
|
|
361364
|
+
);
|
|
361365
|
+
}
|
|
361136
361366
|
}
|
|
361137
361367
|
}
|
|
361138
361368
|
if (!slashHandled) {
|
|
@@ -361158,14 +361388,6 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361158
361388
|
}
|
|
361159
361389
|
const initialParts = normalizePartList(initialPartList);
|
|
361160
361390
|
let currentMessages = [{ role: "user", parts: initialParts }];
|
|
361161
|
-
if (adapter) {
|
|
361162
|
-
const systemMessage = await buildSystemMessage(
|
|
361163
|
-
config2,
|
|
361164
|
-
sessionId,
|
|
361165
|
-
permissionMode
|
|
361166
|
-
);
|
|
361167
|
-
adapter.emitMessage(systemMessage);
|
|
361168
|
-
}
|
|
361169
361391
|
let isFirstTurn = true;
|
|
361170
361392
|
while (true) {
|
|
361171
361393
|
turnCount++;
|
|
@@ -361846,7 +362068,7 @@ var SystemController = class extends BaseController {
|
|
|
361846
362068
|
};
|
|
361847
362069
|
}
|
|
361848
362070
|
/**
|
|
361849
|
-
* Load slash command names using
|
|
362071
|
+
* Load slash command names using getAvailableCommands
|
|
361850
362072
|
*
|
|
361851
362073
|
* @param signal - AbortSignal to respect for cancellation
|
|
361852
362074
|
* @returns Promise resolving to array of slash command names
|
|
@@ -361856,19 +362078,11 @@ var SystemController = class extends BaseController {
|
|
|
361856
362078
|
return [];
|
|
361857
362079
|
}
|
|
361858
362080
|
try {
|
|
361859
|
-
const
|
|
361860
|
-
[new BuiltinCommandLoader(this.context.config)],
|
|
361861
|
-
signal
|
|
361862
|
-
);
|
|
362081
|
+
const commands = await getAvailableCommands(this.context.config, signal);
|
|
361863
362082
|
if (signal.aborted) {
|
|
361864
362083
|
return [];
|
|
361865
362084
|
}
|
|
361866
|
-
|
|
361867
|
-
const commands = service.getCommands();
|
|
361868
|
-
for (const command2 of commands) {
|
|
361869
|
-
names.add(command2.name);
|
|
361870
|
-
}
|
|
361871
|
-
return Array.from(names).sort();
|
|
362085
|
+
return commands.map((cmd) => cmd.name).sort();
|
|
361872
362086
|
} catch (error2) {
|
|
361873
362087
|
if (signal.aborted) {
|
|
361874
362088
|
return [];
|
|
@@ -390236,6 +390450,13 @@ var XHS_SSO_MODELS = [
|
|
|
390236
390450
|
baseUrl: "https://runway.devops.rednote.life/openai/google/v1",
|
|
390237
390451
|
contextWindow: "1M",
|
|
390238
390452
|
description: "Google \u9AD8\u901F\u667A\u80FD\u6A21\u578B(\u601D\u8003\u65F6\u95F4\u957F)"
|
|
390453
|
+
},
|
|
390454
|
+
{
|
|
390455
|
+
id: "glm-4.7",
|
|
390456
|
+
displayName: "glm-4.7",
|
|
390457
|
+
baseUrl: "https://runway.devops.xiaohongshu.com/openai/zhipu/paas/v4/",
|
|
390458
|
+
contextWindow: "200K",
|
|
390459
|
+
description: "\u667A\u8C31\u6700\u65B0\u65D7\u8230\u6A21\u578B\uFF0C\u9762\u5411 Agentic Coding \u573A\u666F\u5F3A\u5316"
|
|
390239
390460
|
}
|
|
390240
390461
|
];
|
|
390241
390462
|
|
|
@@ -396127,6 +396348,11 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings, addIte
|
|
|
396127
396348
|
true
|
|
396128
396349
|
);
|
|
396129
396350
|
}
|
|
396351
|
+
case "stream_messages": {
|
|
396352
|
+
throw new Error(
|
|
396353
|
+
"stream_messages result type is not supported in interactive mode"
|
|
396354
|
+
);
|
|
396355
|
+
}
|
|
396130
396356
|
default: {
|
|
396131
396357
|
const unhandled = result;
|
|
396132
396358
|
throw new Error(
|
|
@@ -398821,10 +399047,13 @@ var WITTY_LOADING_PHRASES = [
|
|
|
398821
399047
|
];
|
|
398822
399048
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
398823
399049
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
398824
|
-
const loadingPhrases = (0, import_react120.useMemo)(
|
|
398825
|
-
(
|
|
398826
|
-
|
|
398827
|
-
|
|
399050
|
+
const loadingPhrases = (0, import_react120.useMemo)(() => {
|
|
399051
|
+
if (customPhrases && customPhrases.length > 0) {
|
|
399052
|
+
return customPhrases;
|
|
399053
|
+
}
|
|
399054
|
+
const translatedPhrases = ta("WITTY_LOADING_PHRASES");
|
|
399055
|
+
return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
|
|
399056
|
+
}, [customPhrases]);
|
|
398828
399057
|
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react120.useState)(
|
|
398829
399058
|
loadingPhrases[0]
|
|
398830
399059
|
);
|
|
@@ -405766,8 +405995,22 @@ var authenticateUpdateSchema = external_exports.object({
|
|
|
405766
405995
|
authUri: external_exports.string()
|
|
405767
405996
|
})
|
|
405768
405997
|
});
|
|
405998
|
+
var acpMetaSchema = external_exports.record(external_exports.unknown()).nullable().optional();
|
|
405999
|
+
var modelIdSchema = external_exports.string();
|
|
406000
|
+
var modelInfoSchema = external_exports.object({
|
|
406001
|
+
_meta: acpMetaSchema,
|
|
406002
|
+
description: external_exports.string().nullable().optional(),
|
|
406003
|
+
modelId: modelIdSchema,
|
|
406004
|
+
name: external_exports.string()
|
|
406005
|
+
});
|
|
406006
|
+
var sessionModelStateSchema = external_exports.object({
|
|
406007
|
+
_meta: acpMetaSchema,
|
|
406008
|
+
availableModels: external_exports.array(modelInfoSchema),
|
|
406009
|
+
currentModelId: modelIdSchema
|
|
406010
|
+
});
|
|
405769
406011
|
var newSessionResponseSchema = external_exports.object({
|
|
405770
|
-
sessionId: external_exports.string()
|
|
406012
|
+
sessionId: external_exports.string(),
|
|
406013
|
+
models: sessionModelStateSchema
|
|
405771
406014
|
});
|
|
405772
406015
|
var loadSessionResponseSchema = external_exports.null();
|
|
405773
406016
|
var sessionListItemSchema = external_exports.object({
|
|
@@ -405981,6 +406224,10 @@ var currentModeUpdateSchema = external_exports.object({
|
|
|
405981
406224
|
sessionUpdate: external_exports.literal("current_mode_update"),
|
|
405982
406225
|
modeId: approvalModeValueSchema
|
|
405983
406226
|
});
|
|
406227
|
+
var currentModelUpdateSchema = external_exports.object({
|
|
406228
|
+
sessionUpdate: external_exports.literal("current_model_update"),
|
|
406229
|
+
model: modelInfoSchema
|
|
406230
|
+
});
|
|
405984
406231
|
var sessionUpdateSchema = external_exports.union([
|
|
405985
406232
|
external_exports.object({
|
|
405986
406233
|
content: contentBlockSchema,
|
|
@@ -406022,6 +406269,7 @@ var sessionUpdateSchema = external_exports.union([
|
|
|
406022
406269
|
sessionUpdate: external_exports.literal("plan")
|
|
406023
406270
|
}),
|
|
406024
406271
|
currentModeUpdateSchema,
|
|
406272
|
+
currentModelUpdateSchema,
|
|
406025
406273
|
availableCommandsUpdateSchema
|
|
406026
406274
|
]);
|
|
406027
406275
|
var agentResponseSchema = external_exports.union([
|
|
@@ -406135,6 +406383,13 @@ var AgentSideConnection = class {
|
|
|
406135
406383
|
params
|
|
406136
406384
|
);
|
|
406137
406385
|
}
|
|
406386
|
+
/**
|
|
406387
|
+
* Sends a custom notification to the client.
|
|
406388
|
+
* Used for extension-specific notifications that are not part of the core ACP protocol.
|
|
406389
|
+
*/
|
|
406390
|
+
async sendCustomNotification(method, params) {
|
|
406391
|
+
return await this.#connection.sendNotification(method, params);
|
|
406392
|
+
}
|
|
406138
406393
|
/**
|
|
406139
406394
|
* Request permission before running a tool
|
|
406140
406395
|
*
|
|
@@ -407131,7 +407386,6 @@ var SubAgentTracker = class {
|
|
|
407131
407386
|
};
|
|
407132
407387
|
|
|
407133
407388
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
407134
|
-
var ALLOWED_BUILTIN_COMMANDS_FOR_ACP = ["init"];
|
|
407135
407389
|
var Session3 = class {
|
|
407136
407390
|
constructor(id, chat, config2, client, settings) {
|
|
407137
407391
|
this.chat = chat;
|
|
@@ -407202,13 +407456,14 @@ var Session3 = class {
|
|
|
407202
407456
|
inputText,
|
|
407203
407457
|
pendingSend,
|
|
407204
407458
|
this.config,
|
|
407205
|
-
this.settings
|
|
407206
|
-
ALLOWED_BUILTIN_COMMANDS_FOR_ACP
|
|
407459
|
+
this.settings
|
|
407207
407460
|
);
|
|
407208
|
-
|
|
407209
|
-
|
|
407210
|
-
|
|
407211
|
-
|
|
407461
|
+
parts = await this.#processSlashCommandResult(
|
|
407462
|
+
slashCommandResult,
|
|
407463
|
+
params.prompt
|
|
407464
|
+
);
|
|
407465
|
+
if (parts === null) {
|
|
407466
|
+
return { stopReason: "end_turn" };
|
|
407212
407467
|
}
|
|
407213
407468
|
} else {
|
|
407214
407469
|
parts = await this.#resolvePrompt(params.prompt, pendingSend.signal);
|
|
@@ -407298,9 +407553,7 @@ var Session3 = class {
|
|
|
407298
407553
|
try {
|
|
407299
407554
|
const slashCommands = await getAvailableCommands(
|
|
407300
407555
|
this.config,
|
|
407301
|
-
|
|
407302
|
-
abortController.signal,
|
|
407303
|
-
ALLOWED_BUILTIN_COMMANDS_FOR_ACP
|
|
407556
|
+
abortController.signal
|
|
407304
407557
|
);
|
|
407305
407558
|
const availableCommands = slashCommands.map(
|
|
407306
407559
|
(cmd) => ({
|
|
@@ -407547,6 +407800,71 @@ var Session3 = class {
|
|
|
407547
407800
|
return errorResponse(error2);
|
|
407548
407801
|
}
|
|
407549
407802
|
}
|
|
407803
|
+
/**
|
|
407804
|
+
* Processes the result of a slash command execution.
|
|
407805
|
+
*
|
|
407806
|
+
* Supported result types in ACP mode:
|
|
407807
|
+
* - submit_prompt: Submits content to the model
|
|
407808
|
+
* - stream_messages: Streams multiple messages to the client (ACP-specific)
|
|
407809
|
+
* - unsupported: Command cannot be executed in ACP mode
|
|
407810
|
+
* - no_command: No command was found, use original prompt
|
|
407811
|
+
*
|
|
407812
|
+
* Note: 'message' type is not supported in ACP mode - commands should use
|
|
407813
|
+
* 'stream_messages' instead for consistent async handling.
|
|
407814
|
+
*
|
|
407815
|
+
* @param result The result from handleSlashCommand
|
|
407816
|
+
* @param originalPrompt The original prompt blocks
|
|
407817
|
+
* @returns Parts to use for the prompt, or null if command was handled without needing model interaction
|
|
407818
|
+
*/
|
|
407819
|
+
async #processSlashCommandResult(result, originalPrompt) {
|
|
407820
|
+
switch (result.type) {
|
|
407821
|
+
case "submit_prompt":
|
|
407822
|
+
return normalizePartList(result.content);
|
|
407823
|
+
case "message": {
|
|
407824
|
+
await this.client.sendCustomNotification("_qwencode/slash_command", {
|
|
407825
|
+
sessionId: this.sessionId,
|
|
407826
|
+
command: originalPrompt.filter((block2) => block2.type === "text").map((block2) => block2.type === "text" ? block2.text : "").join(" "),
|
|
407827
|
+
messageType: result.messageType,
|
|
407828
|
+
message: result.content || ""
|
|
407829
|
+
});
|
|
407830
|
+
if (result.messageType === "error") {
|
|
407831
|
+
throw new Error(result.content || "Slash command failed.");
|
|
407832
|
+
}
|
|
407833
|
+
return null;
|
|
407834
|
+
}
|
|
407835
|
+
case "stream_messages": {
|
|
407836
|
+
const command2 = originalPrompt.filter((block2) => block2.type === "text").map((block2) => block2.type === "text" ? block2.text : "").join(" ");
|
|
407837
|
+
for await (const msg of result.messages) {
|
|
407838
|
+
await this.client.sendCustomNotification("_qwencode/slash_command", {
|
|
407839
|
+
sessionId: this.sessionId,
|
|
407840
|
+
command: command2,
|
|
407841
|
+
messageType: msg.messageType,
|
|
407842
|
+
message: msg.content
|
|
407843
|
+
});
|
|
407844
|
+
if (msg.messageType === "error") {
|
|
407845
|
+
throw new Error(msg.content || "Slash command failed.");
|
|
407846
|
+
}
|
|
407847
|
+
}
|
|
407848
|
+
return null;
|
|
407849
|
+
}
|
|
407850
|
+
case "unsupported": {
|
|
407851
|
+
const unsupportedError = `Slash command not supported in ACP integration: ${result.reason}`;
|
|
407852
|
+
throw new Error(unsupportedError);
|
|
407853
|
+
}
|
|
407854
|
+
case "no_command":
|
|
407855
|
+
return originalPrompt.map((block2) => {
|
|
407856
|
+
if (block2.type === "text") {
|
|
407857
|
+
return { text: block2.text };
|
|
407858
|
+
}
|
|
407859
|
+
throw new Error(`Unsupported block type: ${block2.type}`);
|
|
407860
|
+
});
|
|
407861
|
+
default: {
|
|
407862
|
+
const _exhaustive = result;
|
|
407863
|
+
const unknownError = `Unknown slash command result type: ${_exhaustive.type}`;
|
|
407864
|
+
throw new Error(unknownError);
|
|
407865
|
+
}
|
|
407866
|
+
}
|
|
407867
|
+
}
|
|
407550
407868
|
async #resolvePrompt(message, abortSignal) {
|
|
407551
407869
|
const FILE_URI_SCHEME = "file://";
|
|
407552
407870
|
const embeddedContext = [];
|
|
@@ -407891,7 +408209,7 @@ var GeminiAgent = class {
|
|
|
407891
408209
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
407892
408210
|
description: APPROVAL_MODE_INFO[mode].description
|
|
407893
408211
|
}));
|
|
407894
|
-
const version2 = "0.1.8-alpha.
|
|
408212
|
+
const version2 = "0.1.8-alpha.11";
|
|
407895
408213
|
return {
|
|
407896
408214
|
protocolVersion: PROTOCOL_VERSION,
|
|
407897
408215
|
agentInfo: {
|
|
@@ -407947,8 +408265,25 @@ var GeminiAgent = class {
|
|
|
407947
408265
|
await this.ensureAuthenticated(config2);
|
|
407948
408266
|
this.setupFileSystem(config2);
|
|
407949
408267
|
const session = await this.createAndStoreSession(config2);
|
|
408268
|
+
const configuredModel = (config2.getModel() || this.config.getModel() || "").trim();
|
|
408269
|
+
const modelId = configuredModel || "default";
|
|
408270
|
+
const modelName = configuredModel || modelId;
|
|
407950
408271
|
return {
|
|
407951
|
-
sessionId: session.getId()
|
|
408272
|
+
sessionId: session.getId(),
|
|
408273
|
+
models: {
|
|
408274
|
+
currentModelId: modelId,
|
|
408275
|
+
availableModels: [
|
|
408276
|
+
{
|
|
408277
|
+
modelId,
|
|
408278
|
+
name: modelName,
|
|
408279
|
+
description: null,
|
|
408280
|
+
_meta: {
|
|
408281
|
+
contextLimit: tokenLimit(modelId)
|
|
408282
|
+
}
|
|
408283
|
+
}
|
|
408284
|
+
],
|
|
408285
|
+
_meta: null
|
|
408286
|
+
}
|
|
407952
408287
|
};
|
|
407953
408288
|
}
|
|
407954
408289
|
async newSessionConfig(cwd7, mcpServers, sessionId) {
|
|
@@ -408074,8 +408409,10 @@ var GeminiAgent = class {
|
|
|
408074
408409
|
async createAndStoreSession(config2, conversation) {
|
|
408075
408410
|
const sessionId = config2.getSessionId();
|
|
408076
408411
|
const geminiClient = config2.getGeminiClient();
|
|
408077
|
-
|
|
408078
|
-
|
|
408412
|
+
if (!geminiClient.isInitialized()) {
|
|
408413
|
+
await geminiClient.initialize();
|
|
408414
|
+
}
|
|
408415
|
+
const chat = geminiClient.getChat();
|
|
408079
408416
|
const session = new Session3(
|
|
408080
408417
|
sessionId,
|
|
408081
408418
|
chat,
|
|
@@ -408511,6 +408848,11 @@ main().catch((error2) => {
|
|
|
408511
408848
|
* Copyright 2025 RDMind
|
|
408512
408849
|
* SPDX-License-Identifier: Apache-2.0
|
|
408513
408850
|
*/
|
|
408851
|
+
/**
|
|
408852
|
+
* @license
|
|
408853
|
+
* Copyright 2025 Qwen team
|
|
408854
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
408855
|
+
*/
|
|
408514
408856
|
/*! Bundled license information:
|
|
408515
408857
|
|
|
408516
408858
|
undici/lib/web/fetch/body.js:
|