@rdmind/rdmind 0.1.4-alpha.3 → 0.1.4-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +224 -65
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -37605,7 +37605,12 @@ var require_sign_stream = __commonJS({
|
|
|
37605
37605
|
}
|
|
37606
37606
|
__name(jwsSign, "jwsSign");
|
|
37607
37607
|
function SignStream(opts) {
|
|
37608
|
-
var secret = opts.secret
|
|
37608
|
+
var secret = opts.secret;
|
|
37609
|
+
secret = secret == null ? opts.privateKey : secret;
|
|
37610
|
+
secret = secret == null ? opts.key : secret;
|
|
37611
|
+
if (/^hs/i.test(opts.header.alg) === true && secret == null) {
|
|
37612
|
+
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
37613
|
+
}
|
|
37609
37614
|
var secretStream = new DataStream(secret);
|
|
37610
37615
|
this.readable = true;
|
|
37611
37616
|
this.header = opts.header;
|
|
@@ -37728,7 +37733,12 @@ var require_verify_stream = __commonJS({
|
|
|
37728
37733
|
__name(jwsDecode, "jwsDecode");
|
|
37729
37734
|
function VerifyStream(opts) {
|
|
37730
37735
|
opts = opts || {};
|
|
37731
|
-
var secretOrKey = opts.secret
|
|
37736
|
+
var secretOrKey = opts.secret;
|
|
37737
|
+
secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
|
|
37738
|
+
secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
|
|
37739
|
+
if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
|
|
37740
|
+
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
37741
|
+
}
|
|
37732
37742
|
var secretStream = new DataStream(secretOrKey);
|
|
37733
37743
|
this.readable = true;
|
|
37734
37744
|
this.algorithm = opts.algorithm;
|
|
@@ -89290,6 +89300,8 @@ var init_subagent_statistics = __esm({
|
|
|
89290
89300
|
failedToolCalls = 0;
|
|
89291
89301
|
inputTokens = 0;
|
|
89292
89302
|
outputTokens = 0;
|
|
89303
|
+
thoughtTokens = 0;
|
|
89304
|
+
cachedTokens = 0;
|
|
89293
89305
|
toolUsage = /* @__PURE__ */ new Map();
|
|
89294
89306
|
start(now = Date.now()) {
|
|
89295
89307
|
this.startTimeMs = now;
|
|
@@ -89318,15 +89330,17 @@ var init_subagent_statistics = __esm({
|
|
|
89318
89330
|
tu.averageDurationMs = tu.count > 0 ? tu.totalDurationMs / tu.count : 0;
|
|
89319
89331
|
this.toolUsage.set(name3, tu);
|
|
89320
89332
|
}
|
|
89321
|
-
recordTokens(input, output) {
|
|
89333
|
+
recordTokens(input, output, thought = 0, cached2 = 0) {
|
|
89322
89334
|
this.inputTokens += Math.max(0, input || 0);
|
|
89323
89335
|
this.outputTokens += Math.max(0, output || 0);
|
|
89336
|
+
this.thoughtTokens += Math.max(0, thought || 0);
|
|
89337
|
+
this.cachedTokens += Math.max(0, cached2 || 0);
|
|
89324
89338
|
}
|
|
89325
89339
|
getSummary(now = Date.now()) {
|
|
89326
89340
|
const totalDurationMs = this.startTimeMs ? now - this.startTimeMs : 0;
|
|
89327
89341
|
const totalToolCalls = this.totalToolCalls;
|
|
89328
89342
|
const successRate = totalToolCalls > 0 ? this.successfulToolCalls / totalToolCalls * 100 : 0;
|
|
89329
|
-
const totalTokens = this.inputTokens + this.outputTokens;
|
|
89343
|
+
const totalTokens = this.inputTokens + this.outputTokens + this.thoughtTokens + this.cachedTokens;
|
|
89330
89344
|
const estimatedCost = this.inputTokens * 3e-5 + this.outputTokens * 6e-5;
|
|
89331
89345
|
return {
|
|
89332
89346
|
rounds: this.rounds,
|
|
@@ -89337,6 +89351,8 @@ var init_subagent_statistics = __esm({
|
|
|
89337
89351
|
successRate,
|
|
89338
89352
|
inputTokens: this.inputTokens,
|
|
89339
89353
|
outputTokens: this.outputTokens,
|
|
89354
|
+
thoughtTokens: this.thoughtTokens,
|
|
89355
|
+
cachedTokens: this.cachedTokens,
|
|
89340
89356
|
totalTokens,
|
|
89341
89357
|
estimatedCost,
|
|
89342
89358
|
toolUsage: Array.from(this.toolUsage.values())
|
|
@@ -89351,8 +89367,12 @@ var init_subagent_statistics = __esm({
|
|
|
89351
89367
|
`\u23F1\uFE0F Duration: ${this.fmtDuration(stats.totalDurationMs)} | \u{1F501} Rounds: ${stats.rounds}`
|
|
89352
89368
|
];
|
|
89353
89369
|
if (typeof stats.totalTokens === "number") {
|
|
89370
|
+
const parts = [
|
|
89371
|
+
`in ${stats.inputTokens ?? 0}`,
|
|
89372
|
+
`out ${stats.outputTokens ?? 0}`
|
|
89373
|
+
];
|
|
89354
89374
|
lines.push(
|
|
89355
|
-
`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()}${
|
|
89375
|
+
`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()}${parts.length ? ` (${parts.join(", ")})` : ""}`
|
|
89356
89376
|
);
|
|
89357
89377
|
}
|
|
89358
89378
|
return lines.join("\n");
|
|
@@ -89380,8 +89400,12 @@ var init_subagent_statistics = __esm({
|
|
|
89380
89400
|
`\u{1F527} Tools: ${stats.totalToolCalls} calls, ${sr.toFixed(1)}% success (${stats.successfulToolCalls} ok, ${stats.failedToolCalls} failed)`
|
|
89381
89401
|
);
|
|
89382
89402
|
if (typeof stats.totalTokens === "number") {
|
|
89403
|
+
const parts = [
|
|
89404
|
+
`in ${stats.inputTokens ?? 0}`,
|
|
89405
|
+
`out ${stats.outputTokens ?? 0}`
|
|
89406
|
+
];
|
|
89383
89407
|
lines.push(
|
|
89384
|
-
`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()} (
|
|
89408
|
+
`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()} (${parts.join(", ")})`
|
|
89385
89409
|
);
|
|
89386
89410
|
}
|
|
89387
89411
|
if (stats.toolUsage && stats.toolUsage.length) {
|
|
@@ -147556,6 +147580,7 @@ var init_uiTelemetry = __esm({
|
|
|
147556
147580
|
init_esbuild_shims();
|
|
147557
147581
|
init_constants();
|
|
147558
147582
|
init_tool_call_decision();
|
|
147583
|
+
init_constants();
|
|
147559
147584
|
createInitialModelMetrics = /* @__PURE__ */ __name(() => ({
|
|
147560
147585
|
api: {
|
|
147561
147586
|
totalRequests: 0,
|
|
@@ -160801,7 +160826,7 @@ function createContentGeneratorConfig(config2, authType, generationConfig) {
|
|
|
160801
160826
|
};
|
|
160802
160827
|
}
|
|
160803
160828
|
async function createContentGenerator(config2, gcConfig, isInitialAuth) {
|
|
160804
|
-
const version3 = "0.1.4-alpha.
|
|
160829
|
+
const version3 = "0.1.4-alpha.9";
|
|
160805
160830
|
const userAgent2 = `QwenCode/${version3} (${process.platform}; ${process.arch})`;
|
|
160806
160831
|
const baseHeaders = {
|
|
160807
160832
|
"User-Agent": userAgent2
|
|
@@ -179318,6 +179343,7 @@ var init_subagent_events = __esm({
|
|
|
179318
179343
|
SubAgentEventType2["TOOL_CALL"] = "tool_call";
|
|
179319
179344
|
SubAgentEventType2["TOOL_RESULT"] = "tool_result";
|
|
179320
179345
|
SubAgentEventType2["TOOL_WAITING_APPROVAL"] = "tool_waiting_approval";
|
|
179346
|
+
SubAgentEventType2["USAGE_METADATA"] = "usage_metadata";
|
|
179321
179347
|
SubAgentEventType2["FINISH"] = "finish";
|
|
179322
179348
|
SubAgentEventType2["ERROR"] = "error";
|
|
179323
179349
|
return SubAgentEventType2;
|
|
@@ -179569,6 +179595,7 @@ var init_subagent = __esm({
|
|
|
179569
179595
|
tools: [{ functionDeclarations: toolsList }]
|
|
179570
179596
|
}
|
|
179571
179597
|
};
|
|
179598
|
+
const roundStreamStart = Date.now();
|
|
179572
179599
|
const responseStream = await chat.sendMessageStream(
|
|
179573
179600
|
this.modelConfig.model || this.runtimeContext.getModel() || DEFAULT_QWEN_MODEL,
|
|
179574
179601
|
messageParams,
|
|
@@ -179631,16 +179658,27 @@ var init_subagent = __esm({
|
|
|
179631
179658
|
if (lastUsage) {
|
|
179632
179659
|
const inTok = Number(lastUsage.promptTokenCount || 0);
|
|
179633
179660
|
const outTok = Number(lastUsage.candidatesTokenCount || 0);
|
|
179634
|
-
|
|
179661
|
+
const thoughtTok = Number(lastUsage.thoughtsTokenCount || 0);
|
|
179662
|
+
const cachedTok = Number(lastUsage.cachedContentTokenCount || 0);
|
|
179663
|
+
if (isFinite(inTok) || isFinite(outTok) || isFinite(thoughtTok) || isFinite(cachedTok)) {
|
|
179635
179664
|
this.stats.recordTokens(
|
|
179636
179665
|
isFinite(inTok) ? inTok : 0,
|
|
179637
|
-
isFinite(outTok) ? outTok : 0
|
|
179666
|
+
isFinite(outTok) ? outTok : 0,
|
|
179667
|
+
isFinite(thoughtTok) ? thoughtTok : 0,
|
|
179668
|
+
isFinite(cachedTok) ? cachedTok : 0
|
|
179638
179669
|
);
|
|
179639
179670
|
this.executionStats.inputTokens = (this.executionStats.inputTokens || 0) + (isFinite(inTok) ? inTok : 0);
|
|
179640
179671
|
this.executionStats.outputTokens = (this.executionStats.outputTokens || 0) + (isFinite(outTok) ? outTok : 0);
|
|
179641
|
-
this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0);
|
|
179672
|
+
this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0) + (isFinite(thoughtTok) ? thoughtTok : 0) + (isFinite(cachedTok) ? cachedTok : 0);
|
|
179642
179673
|
this.executionStats.estimatedCost = (this.executionStats.inputTokens || 0) * 3e-5 + (this.executionStats.outputTokens || 0) * 6e-5;
|
|
179643
179674
|
}
|
|
179675
|
+
this.eventEmitter?.emit("usage_metadata" /* USAGE_METADATA */, {
|
|
179676
|
+
subagentId: this.subagentId,
|
|
179677
|
+
round: turnCounter,
|
|
179678
|
+
usage: lastUsage,
|
|
179679
|
+
durationMs: Date.now() - roundStreamStart,
|
|
179680
|
+
timestamp: Date.now()
|
|
179681
|
+
});
|
|
179644
179682
|
}
|
|
179645
179683
|
if (functionCalls.length > 0) {
|
|
179646
179684
|
currentMessages = await this.processFunctionCalls(
|
|
@@ -209082,7 +209120,7 @@ var init_ide_client = __esm({
|
|
|
209082
209120
|
if (this.connectionConfig?.authToken) {
|
|
209083
209121
|
this.authToken = this.connectionConfig.authToken;
|
|
209084
209122
|
}
|
|
209085
|
-
const workspacePath = this.connectionConfig?.workspacePath ?? process.env["
|
|
209123
|
+
const workspacePath = this.connectionConfig?.workspacePath ?? process.env["RDMIND_CODE_IDE_WORKSPACE_PATH"];
|
|
209086
209124
|
const { isValid: isValid2, error: error2 } = _IdeClient.validateWorkspacePath(
|
|
209087
209125
|
workspacePath,
|
|
209088
209126
|
process.cwd()
|
|
@@ -209392,18 +209430,18 @@ var init_ide_client = __esm({
|
|
|
209392
209430
|
return { isValid: true };
|
|
209393
209431
|
}
|
|
209394
209432
|
getPortFromEnv() {
|
|
209395
|
-
const port = process.env["
|
|
209433
|
+
const port = process.env["RDMIND_CODE_IDE_SERVER_PORT"];
|
|
209396
209434
|
if (!port) {
|
|
209397
209435
|
return void 0;
|
|
209398
209436
|
}
|
|
209399
209437
|
return port;
|
|
209400
209438
|
}
|
|
209401
209439
|
getStdioConfigFromEnv() {
|
|
209402
|
-
const command2 = process.env["
|
|
209440
|
+
const command2 = process.env["RDMIND_CODE_IDE_SERVER_STDIO_COMMAND"];
|
|
209403
209441
|
if (!command2) {
|
|
209404
209442
|
return void 0;
|
|
209405
209443
|
}
|
|
209406
|
-
const argsStr = process.env["
|
|
209444
|
+
const argsStr = process.env["RDMIND_CODE_IDE_SERVER_STDIO_ARGS"];
|
|
209407
209445
|
let args = [];
|
|
209408
209446
|
if (argsStr) {
|
|
209409
209447
|
try {
|
|
@@ -209412,11 +209450,11 @@ var init_ide_client = __esm({
|
|
|
209412
209450
|
args = parsedArgs;
|
|
209413
209451
|
} else {
|
|
209414
209452
|
logger.error(
|
|
209415
|
-
"
|
|
209453
|
+
"RDMIND_CODE_IDE_SERVER_STDIO_ARGS must be a JSON array string."
|
|
209416
209454
|
);
|
|
209417
209455
|
}
|
|
209418
209456
|
} catch (e3) {
|
|
209419
|
-
logger.error("Failed to parse
|
|
209457
|
+
logger.error("Failed to parse RDMIND_CODE_IDE_SERVER_STDIO_ARGS:", e3);
|
|
209420
209458
|
}
|
|
209421
209459
|
}
|
|
209422
209460
|
return { command: command2, args };
|
|
@@ -209428,7 +209466,7 @@ var init_ide_client = __esm({
|
|
|
209428
209466
|
try {
|
|
209429
209467
|
const portFile = path38.join(
|
|
209430
209468
|
os20.tmpdir(),
|
|
209431
|
-
`
|
|
209469
|
+
`rdmind-code-ide-server-${this.ideProcessInfo.pid}.json`
|
|
209432
209470
|
);
|
|
209433
209471
|
const portFileContents = await fs35.promises.readFile(portFile, "utf8");
|
|
209434
209472
|
return JSON.parse(portFileContents);
|
|
@@ -209446,7 +209484,7 @@ var init_ide_client = __esm({
|
|
|
209446
209484
|
return void 0;
|
|
209447
209485
|
}
|
|
209448
209486
|
const fileRegex = new RegExp(
|
|
209449
|
-
`^
|
|
209487
|
+
`^rdmind-code-ide-server-${this.ideProcessInfo.pid}-\\d+\\.json$`
|
|
209450
209488
|
);
|
|
209451
209489
|
const matchingFiles = portFiles.filter((file) => fileRegex.test(file)).sort();
|
|
209452
209490
|
if (matchingFiles.length === 0) {
|
|
@@ -235953,8 +235991,8 @@ var init_git_commit = __esm({
|
|
|
235953
235991
|
"packages/core/src/generated/git-commit.ts"() {
|
|
235954
235992
|
"use strict";
|
|
235955
235993
|
init_esbuild_shims();
|
|
235956
|
-
GIT_COMMIT_INFO = "
|
|
235957
|
-
CLI_VERSION = "0.1.4-alpha.
|
|
235994
|
+
GIT_COMMIT_INFO = "a5a74672";
|
|
235995
|
+
CLI_VERSION = "0.1.4-alpha.9";
|
|
235958
235996
|
}
|
|
235959
235997
|
});
|
|
235960
235998
|
|
|
@@ -236890,6 +236928,9 @@ __export(core_exports4, {
|
|
|
236890
236928
|
DeclarativeTool: () => DeclarativeTool,
|
|
236891
236929
|
DiscoveredMCPTool: () => DiscoveredMCPTool,
|
|
236892
236930
|
DiscoveredTool: () => DiscoveredTool,
|
|
236931
|
+
EVENT_API_ERROR: () => EVENT_API_ERROR,
|
|
236932
|
+
EVENT_API_RESPONSE: () => EVENT_API_RESPONSE,
|
|
236933
|
+
EVENT_TOOL_CALL: () => EVENT_TOOL_CALL,
|
|
236893
236934
|
EditTool: () => EditTool,
|
|
236894
236935
|
EndSessionEvent: () => EndSessionEvent,
|
|
236895
236936
|
ExitPlanModeTool: () => ExitPlanModeTool,
|
|
@@ -286479,12 +286520,12 @@ var init_header = __esm({
|
|
|
286479
286520
|
if (!buf || !(buf.length >= off + 512)) {
|
|
286480
286521
|
throw new Error("need 512 bytes for header");
|
|
286481
286522
|
}
|
|
286482
|
-
this.path = decString(buf, off, 100);
|
|
286483
|
-
this.mode = decNumber(buf, off + 100, 8);
|
|
286484
|
-
this.uid = decNumber(buf, off + 108, 8);
|
|
286485
|
-
this.gid = decNumber(buf, off + 116, 8);
|
|
286486
|
-
this.size = decNumber(buf, off + 124, 12);
|
|
286487
|
-
this.mtime = decDate(buf, off + 136, 12);
|
|
286523
|
+
this.path = ex?.path ?? decString(buf, off, 100);
|
|
286524
|
+
this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
|
|
286525
|
+
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
|
|
286526
|
+
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
|
|
286527
|
+
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
|
|
286528
|
+
this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
|
|
286488
286529
|
this.cksum = decNumber(buf, off + 148, 12);
|
|
286489
286530
|
if (gex)
|
|
286490
286531
|
this.#slurp(gex, true);
|
|
@@ -286502,10 +286543,10 @@ var init_header = __esm({
|
|
|
286502
286543
|
}
|
|
286503
286544
|
this.linkpath = decString(buf, off + 157, 100);
|
|
286504
286545
|
if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") {
|
|
286505
|
-
this.uname = decString(buf, off + 265, 32);
|
|
286506
|
-
this.gname = decString(buf, off + 297, 32);
|
|
286507
|
-
this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
|
|
286508
|
-
this.devmin = decNumber(buf, off + 337, 8) ?? 0;
|
|
286546
|
+
this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
|
|
286547
|
+
this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
|
|
286548
|
+
this.devmaj = ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
|
|
286549
|
+
this.devmin = ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
|
|
286509
286550
|
if (buf[off + 475] !== 0) {
|
|
286510
286551
|
const prefix = decString(buf, off + 345, 155);
|
|
286511
286552
|
this.path = prefix + "/" + this.path;
|
|
@@ -286514,8 +286555,8 @@ var init_header = __esm({
|
|
|
286514
286555
|
if (prefix) {
|
|
286515
286556
|
this.path = prefix + "/" + this.path;
|
|
286516
286557
|
}
|
|
286517
|
-
this.atime = decDate(buf, off + 476, 12);
|
|
286518
|
-
this.ctime = decDate(buf, off + 488, 12);
|
|
286558
|
+
this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
|
|
286559
|
+
this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
|
|
286519
286560
|
}
|
|
286520
286561
|
}
|
|
286521
286562
|
let sum = 8 * 32;
|
|
@@ -287510,13 +287551,15 @@ var init_list = __esm({
|
|
|
287510
287551
|
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
287511
287552
|
if (stat7.size < readSize) {
|
|
287512
287553
|
const buf = Buffer.allocUnsafe(stat7.size);
|
|
287513
|
-
fs63.readSync(fd, buf, 0, stat7.size, 0);
|
|
287514
|
-
p.end(buf);
|
|
287554
|
+
const read3 = fs63.readSync(fd, buf, 0, stat7.size, 0);
|
|
287555
|
+
p.end(read3 === buf.byteLength ? buf : buf.subarray(0, read3));
|
|
287515
287556
|
} else {
|
|
287516
287557
|
let pos2 = 0;
|
|
287517
287558
|
const buf = Buffer.allocUnsafe(readSize);
|
|
287518
287559
|
while (pos2 < stat7.size) {
|
|
287519
287560
|
const bytesRead = fs63.readSync(fd, buf, 0, readSize, pos2);
|
|
287561
|
+
if (bytesRead === 0)
|
|
287562
|
+
break;
|
|
287520
287563
|
pos2 += bytesRead;
|
|
287521
287564
|
p.write(buf.subarray(0, bytesRead));
|
|
287522
287565
|
}
|
|
@@ -334029,7 +334072,7 @@ var patchConsole = /* @__PURE__ */ __name((callback) => {
|
|
|
334029
334072
|
var dist_default2 = patchConsole;
|
|
334030
334073
|
|
|
334031
334074
|
// node_modules/ink/build/ink.js
|
|
334032
|
-
var
|
|
334075
|
+
var import_constants21 = __toESM(require_constants11(), 1);
|
|
334033
334076
|
|
|
334034
334077
|
// node_modules/yoga-layout/dist/src/index.js
|
|
334035
334078
|
init_esbuild_shims();
|
|
@@ -336092,7 +336135,7 @@ __name(wrapAnsi, "wrapAnsi");
|
|
|
336092
336135
|
// node_modules/ink/build/reconciler.js
|
|
336093
336136
|
init_esbuild_shims();
|
|
336094
336137
|
var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
336095
|
-
var
|
|
336138
|
+
var import_constants20 = __toESM(require_constants11(), 1);
|
|
336096
336139
|
import process15 from "node:process";
|
|
336097
336140
|
var import_react = __toESM(require_react(), 1);
|
|
336098
336141
|
|
|
@@ -337063,7 +337106,7 @@ var cleanupYogaNode = /* @__PURE__ */ __name((node) => {
|
|
|
337063
337106
|
node?.unsetMeasureFunc();
|
|
337064
337107
|
node?.freeRecursive();
|
|
337065
337108
|
}, "cleanupYogaNode");
|
|
337066
|
-
var currentUpdatePriority =
|
|
337109
|
+
var currentUpdatePriority = import_constants20.NoEventPriority;
|
|
337067
337110
|
var currentRootNode;
|
|
337068
337111
|
var reconciler_default = (0, import_react_reconciler.default)({
|
|
337069
337112
|
getRootHostContext: /* @__PURE__ */ __name(() => ({
|
|
@@ -337220,10 +337263,10 @@ var reconciler_default = (0, import_react_reconciler.default)({
|
|
|
337220
337263
|
},
|
|
337221
337264
|
getCurrentUpdatePriority: /* @__PURE__ */ __name(() => currentUpdatePriority, "getCurrentUpdatePriority"),
|
|
337222
337265
|
resolveUpdatePriority() {
|
|
337223
|
-
if (currentUpdatePriority !==
|
|
337266
|
+
if (currentUpdatePriority !== import_constants20.NoEventPriority) {
|
|
337224
337267
|
return currentUpdatePriority;
|
|
337225
337268
|
}
|
|
337226
|
-
return
|
|
337269
|
+
return import_constants20.DefaultEventPriority;
|
|
337227
337270
|
},
|
|
337228
337271
|
maySuspendCommit() {
|
|
337229
337272
|
return false;
|
|
@@ -339741,7 +339784,7 @@ var Ink = class {
|
|
|
339741
339784
|
this.fullStaticOutput = "";
|
|
339742
339785
|
this.container = reconciler_default.createContainer(
|
|
339743
339786
|
this.rootNode,
|
|
339744
|
-
|
|
339787
|
+
import_constants21.LegacyRoot,
|
|
339745
339788
|
null,
|
|
339746
339789
|
false,
|
|
339747
339790
|
null,
|
|
@@ -346308,7 +346351,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
346308
346351
|
// packages/cli/src/utils/version.ts
|
|
346309
346352
|
async function getCliVersion() {
|
|
346310
346353
|
const pkgJson = await getPackageJson();
|
|
346311
|
-
return "0.1.4-alpha.
|
|
346354
|
+
return "0.1.4-alpha.9";
|
|
346312
346355
|
}
|
|
346313
346356
|
__name(getCliVersion, "getCliVersion");
|
|
346314
346357
|
|
|
@@ -352838,7 +352881,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
352838
352881
|
|
|
352839
352882
|
// packages/cli/src/generated/git-commit.ts
|
|
352840
352883
|
init_esbuild_shims();
|
|
352841
|
-
var GIT_COMMIT_INFO2 = "
|
|
352884
|
+
var GIT_COMMIT_INFO2 = "a5a74672";
|
|
352842
352885
|
|
|
352843
352886
|
// packages/cli/src/utils/systemInfo.ts
|
|
352844
352887
|
async function getNpmVersion() {
|
|
@@ -388422,7 +388465,7 @@ function IdeIntegrationNudge({
|
|
|
388422
388465
|
{ isActive: true }
|
|
388423
388466
|
);
|
|
388424
388467
|
const { displayName: ideName } = ide;
|
|
388425
|
-
const isExtensionPreInstalled = !!process.env["
|
|
388468
|
+
const isExtensionPreInstalled = !!process.env["RDMIND_CODE_IDE_SERVER_PORT"] && !!process.env["RDMIND_CODE_IDE_WORKSPACE_PATH"];
|
|
388426
388469
|
const OPTIONS = [
|
|
388427
388470
|
{
|
|
388428
388471
|
label: "Yes",
|
|
@@ -405708,8 +405751,8 @@ async function start_sandbox(config2, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
405708
405751
|
args.push("--env", `COLORTERM=${process.env["COLORTERM"]}`);
|
|
405709
405752
|
}
|
|
405710
405753
|
for (const envVar of [
|
|
405711
|
-
"
|
|
405712
|
-
"
|
|
405754
|
+
"RDMIND_CODE_IDE_SERVER_PORT",
|
|
405755
|
+
"RDMIND_CODE_IDE_WORKSPACE_PATH",
|
|
405713
405756
|
"TERM_PROGRAM"
|
|
405714
405757
|
]) {
|
|
405715
405758
|
if (process.env[envVar]) {
|
|
@@ -406593,6 +406636,17 @@ var annotationsSchema = external_exports.object({
|
|
|
406593
406636
|
lastModified: external_exports.string().optional().nullable(),
|
|
406594
406637
|
priority: external_exports.number().optional().nullable()
|
|
406595
406638
|
});
|
|
406639
|
+
var usageSchema = external_exports.object({
|
|
406640
|
+
promptTokens: external_exports.number().optional().nullable(),
|
|
406641
|
+
completionTokens: external_exports.number().optional().nullable(),
|
|
406642
|
+
thoughtsTokens: external_exports.number().optional().nullable(),
|
|
406643
|
+
totalTokens: external_exports.number().optional().nullable(),
|
|
406644
|
+
cachedTokens: external_exports.number().optional().nullable()
|
|
406645
|
+
});
|
|
406646
|
+
var sessionUpdateMetaSchema = external_exports.object({
|
|
406647
|
+
usage: usageSchema.optional().nullable(),
|
|
406648
|
+
durationMs: external_exports.number().optional().nullable()
|
|
406649
|
+
});
|
|
406596
406650
|
var requestPermissionResponseSchema = external_exports.object({
|
|
406597
406651
|
outcome: requestPermissionOutcomeSchema
|
|
406598
406652
|
});
|
|
@@ -406748,11 +406802,13 @@ var sessionUpdateSchema = external_exports.union([
|
|
|
406748
406802
|
}),
|
|
406749
406803
|
external_exports.object({
|
|
406750
406804
|
content: contentBlockSchema,
|
|
406751
|
-
sessionUpdate: external_exports.literal("agent_message_chunk")
|
|
406805
|
+
sessionUpdate: external_exports.literal("agent_message_chunk"),
|
|
406806
|
+
_meta: sessionUpdateMetaSchema.optional().nullable()
|
|
406752
406807
|
}),
|
|
406753
406808
|
external_exports.object({
|
|
406754
406809
|
content: contentBlockSchema,
|
|
406755
|
-
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
406810
|
+
sessionUpdate: external_exports.literal("agent_thought_chunk"),
|
|
406811
|
+
_meta: sessionUpdateMetaSchema.optional().nullable()
|
|
406756
406812
|
}),
|
|
406757
406813
|
external_exports.object({
|
|
406758
406814
|
content: external_exports.array(toolCallContentSchema).optional(),
|
|
@@ -407082,6 +407138,15 @@ var AcpFileSystemService = class {
|
|
|
407082
407138
|
line: null,
|
|
407083
407139
|
limit: null
|
|
407084
407140
|
});
|
|
407141
|
+
if (response.content.startsWith("ERROR: ENOENT:")) {
|
|
407142
|
+
const match2 = /^ERROR:\s*ENOENT:\s*(?<path>.*)$/i.exec(response.content);
|
|
407143
|
+
const err = new Error(response.content);
|
|
407144
|
+
err.code = "ENOENT";
|
|
407145
|
+
err.errno = -2;
|
|
407146
|
+
const rawPath = match2?.groups?.["path"]?.trim();
|
|
407147
|
+
err["path"] = rawPath ? rawPath.replace(/^['"]|['"]$/g, "") || filePath : filePath;
|
|
407148
|
+
throw err;
|
|
407149
|
+
}
|
|
407085
407150
|
return response.content;
|
|
407086
407151
|
}
|
|
407087
407152
|
async writeTextFile(filePath, content) {
|
|
@@ -407163,6 +407228,15 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
407163
407228
|
content: { type: "text", text }
|
|
407164
407229
|
});
|
|
407165
407230
|
}
|
|
407231
|
+
/**
|
|
407232
|
+
* Emits an agent thought chunk.
|
|
407233
|
+
*/
|
|
407234
|
+
async emitAgentThought(text) {
|
|
407235
|
+
await this.sendUpdate({
|
|
407236
|
+
sessionUpdate: "agent_thought_chunk",
|
|
407237
|
+
content: { type: "text", text }
|
|
407238
|
+
});
|
|
407239
|
+
}
|
|
407166
407240
|
/**
|
|
407167
407241
|
* Emits an agent message chunk.
|
|
407168
407242
|
*/
|
|
@@ -407173,12 +407247,21 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
407173
407247
|
});
|
|
407174
407248
|
}
|
|
407175
407249
|
/**
|
|
407176
|
-
* Emits
|
|
407250
|
+
* Emits usage metadata.
|
|
407177
407251
|
*/
|
|
407178
|
-
async
|
|
407252
|
+
async emitUsageMetadata(usageMetadata, text = "", durationMs) {
|
|
407253
|
+
const usage2 = {
|
|
407254
|
+
promptTokens: usageMetadata.promptTokenCount,
|
|
407255
|
+
completionTokens: usageMetadata.candidatesTokenCount,
|
|
407256
|
+
thoughtsTokens: usageMetadata.thoughtsTokenCount,
|
|
407257
|
+
totalTokens: usageMetadata.totalTokenCount,
|
|
407258
|
+
cachedTokens: usageMetadata.cachedContentTokenCount
|
|
407259
|
+
};
|
|
407260
|
+
const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
|
|
407179
407261
|
await this.sendUpdate({
|
|
407180
|
-
sessionUpdate: "
|
|
407181
|
-
content: { type: "text", text }
|
|
407262
|
+
sessionUpdate: "agent_message_chunk",
|
|
407263
|
+
content: { type: "text", text },
|
|
407264
|
+
_meta: meta
|
|
407182
407265
|
});
|
|
407183
407266
|
}
|
|
407184
407267
|
/**
|
|
@@ -407295,7 +407378,7 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
407295
407378
|
await this.sendUpdate({
|
|
407296
407379
|
sessionUpdate: "tool_call",
|
|
407297
407380
|
toolCallId: params.callId,
|
|
407298
|
-
status: "
|
|
407381
|
+
status: params.status || "pending",
|
|
407299
407382
|
title,
|
|
407300
407383
|
content: [],
|
|
407301
407384
|
locations,
|
|
@@ -407462,7 +407545,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
407462
407545
|
}
|
|
407463
407546
|
if ("functionResponse" in part && part.functionResponse) {
|
|
407464
407547
|
try {
|
|
407465
|
-
const
|
|
407548
|
+
const resp = part.functionResponse.response;
|
|
407549
|
+
const outputField = resp["output"];
|
|
407550
|
+
const errorField = resp["error"];
|
|
407551
|
+
const responseText = typeof outputField === "string" ? outputField : typeof errorField === "string" ? errorField : JSON.stringify(resp);
|
|
407466
407552
|
result.push({
|
|
407467
407553
|
type: "content",
|
|
407468
407554
|
content: { type: "text", text: responseText }
|
|
@@ -407510,6 +407596,9 @@ var HistoryReplayer = class {
|
|
|
407510
407596
|
if (record2.message) {
|
|
407511
407597
|
await this.replayContent(record2.message, "assistant");
|
|
407512
407598
|
}
|
|
407599
|
+
if (record2.usageMetadata) {
|
|
407600
|
+
await this.replayUsageMetadata(record2.usageMetadata);
|
|
407601
|
+
}
|
|
407513
407602
|
break;
|
|
407514
407603
|
case "tool_result":
|
|
407515
407604
|
await this.replayToolResult(record2);
|
|
@@ -407534,11 +407623,19 @@ var HistoryReplayer = class {
|
|
|
407534
407623
|
await this.toolCallEmitter.emitStart({
|
|
407535
407624
|
toolName: functionName,
|
|
407536
407625
|
callId,
|
|
407537
|
-
args: part.functionCall.args
|
|
407626
|
+
args: part.functionCall.args,
|
|
407627
|
+
status: "in_progress"
|
|
407538
407628
|
});
|
|
407539
407629
|
}
|
|
407540
407630
|
}
|
|
407541
407631
|
}
|
|
407632
|
+
/**
|
|
407633
|
+
* Replays usage metadata.
|
|
407634
|
+
* @param usageMetadata - The usage metadata to replay
|
|
407635
|
+
*/
|
|
407636
|
+
async replayUsageMetadata(usageMetadata) {
|
|
407637
|
+
await this.messageEmitter.emitUsageMetadata(usageMetadata);
|
|
407638
|
+
}
|
|
407542
407639
|
/**
|
|
407543
407640
|
* Replays a tool result record.
|
|
407544
407641
|
*/
|
|
@@ -407559,6 +407656,40 @@ var HistoryReplayer = class {
|
|
|
407559
407656
|
// Note: args aren't stored in tool_result records by default
|
|
407560
407657
|
args: void 0
|
|
407561
407658
|
});
|
|
407659
|
+
const { resultDisplay } = result ?? {};
|
|
407660
|
+
if (!!resultDisplay && typeof resultDisplay === "object" && "type" in resultDisplay && resultDisplay.type === "task_execution") {
|
|
407661
|
+
await this.emitTaskUsageFromResultDisplay(
|
|
407662
|
+
resultDisplay
|
|
407663
|
+
);
|
|
407664
|
+
}
|
|
407665
|
+
}
|
|
407666
|
+
/**
|
|
407667
|
+
* Emits token usage from a TaskResultDisplay execution summary, if present.
|
|
407668
|
+
*/
|
|
407669
|
+
async emitTaskUsageFromResultDisplay(resultDisplay) {
|
|
407670
|
+
const summary = resultDisplay.executionSummary;
|
|
407671
|
+
if (!summary) {
|
|
407672
|
+
return;
|
|
407673
|
+
}
|
|
407674
|
+
const usageMetadata = {};
|
|
407675
|
+
if (Number.isFinite(summary.inputTokens)) {
|
|
407676
|
+
usageMetadata.promptTokenCount = summary.inputTokens;
|
|
407677
|
+
}
|
|
407678
|
+
if (Number.isFinite(summary.outputTokens)) {
|
|
407679
|
+
usageMetadata.candidatesTokenCount = summary.outputTokens;
|
|
407680
|
+
}
|
|
407681
|
+
if (Number.isFinite(summary.thoughtTokens)) {
|
|
407682
|
+
usageMetadata.thoughtsTokenCount = summary.thoughtTokens;
|
|
407683
|
+
}
|
|
407684
|
+
if (Number.isFinite(summary.cachedTokens)) {
|
|
407685
|
+
usageMetadata.cachedContentTokenCount = summary.cachedTokens;
|
|
407686
|
+
}
|
|
407687
|
+
if (Number.isFinite(summary.totalTokens)) {
|
|
407688
|
+
usageMetadata.totalTokenCount = summary.totalTokens;
|
|
407689
|
+
}
|
|
407690
|
+
if (Object.keys(usageMetadata).length > 0) {
|
|
407691
|
+
await this.messageEmitter.emitUsageMetadata(usageMetadata);
|
|
407692
|
+
}
|
|
407562
407693
|
}
|
|
407563
407694
|
/**
|
|
407564
407695
|
* Extracts tool name from a chat record's function response.
|
|
@@ -407596,11 +407727,13 @@ var SubAgentTracker = class {
|
|
|
407596
407727
|
this.ctx = ctx;
|
|
407597
407728
|
this.client = client;
|
|
407598
407729
|
this.toolCallEmitter = new ToolCallEmitter(ctx);
|
|
407730
|
+
this.messageEmitter = new MessageEmitter(ctx);
|
|
407599
407731
|
}
|
|
407600
407732
|
static {
|
|
407601
407733
|
__name(this, "SubAgentTracker");
|
|
407602
407734
|
}
|
|
407603
407735
|
toolCallEmitter;
|
|
407736
|
+
messageEmitter;
|
|
407604
407737
|
toolStates = /* @__PURE__ */ new Map();
|
|
407605
407738
|
/**
|
|
407606
407739
|
* Sets up event listeners for a sub-agent's tool events.
|
|
@@ -407613,14 +407746,17 @@ var SubAgentTracker = class {
|
|
|
407613
407746
|
const onToolCall = this.createToolCallHandler(abortSignal);
|
|
407614
407747
|
const onToolResult = this.createToolResultHandler(abortSignal);
|
|
407615
407748
|
const onApproval = this.createApprovalHandler(abortSignal);
|
|
407749
|
+
const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
|
|
407616
407750
|
eventEmitter.on("tool_call" /* TOOL_CALL */, onToolCall);
|
|
407617
407751
|
eventEmitter.on("tool_result" /* TOOL_RESULT */, onToolResult);
|
|
407618
407752
|
eventEmitter.on("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
|
|
407753
|
+
eventEmitter.on("usage_metadata" /* USAGE_METADATA */, onUsageMetadata);
|
|
407619
407754
|
return [
|
|
407620
407755
|
() => {
|
|
407621
407756
|
eventEmitter.off("tool_call" /* TOOL_CALL */, onToolCall);
|
|
407622
407757
|
eventEmitter.off("tool_result" /* TOOL_RESULT */, onToolResult);
|
|
407623
407758
|
eventEmitter.off("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
|
|
407759
|
+
eventEmitter.off("usage_metadata" /* USAGE_METADATA */, onUsageMetadata);
|
|
407624
407760
|
this.toolStates.clear();
|
|
407625
407761
|
}
|
|
407626
407762
|
];
|
|
@@ -407723,6 +407859,16 @@ var SubAgentTracker = class {
|
|
|
407723
407859
|
}
|
|
407724
407860
|
};
|
|
407725
407861
|
}
|
|
407862
|
+
/**
|
|
407863
|
+
* Creates a handler for usage metadata events.
|
|
407864
|
+
*/
|
|
407865
|
+
createUsageMetadataHandler(abortSignal) {
|
|
407866
|
+
return (...args) => {
|
|
407867
|
+
const event = args[0];
|
|
407868
|
+
if (abortSignal.aborted) return;
|
|
407869
|
+
this.messageEmitter.emitUsageMetadata(event.usage, "", event.durationMs);
|
|
407870
|
+
};
|
|
407871
|
+
}
|
|
407726
407872
|
/**
|
|
407727
407873
|
* Converts confirmation details to permission options for the client.
|
|
407728
407874
|
*/
|
|
@@ -407797,6 +407943,7 @@ var Session3 = class {
|
|
|
407797
407943
|
this.toolCallEmitter = new ToolCallEmitter(this);
|
|
407798
407944
|
this.planEmitter = new PlanEmitter(this);
|
|
407799
407945
|
this.historyReplayer = new HistoryReplayer(this);
|
|
407946
|
+
this.messageEmitter = new MessageEmitter(this);
|
|
407800
407947
|
}
|
|
407801
407948
|
static {
|
|
407802
407949
|
__name(this, "Session");
|
|
@@ -407807,6 +407954,7 @@ var Session3 = class {
|
|
|
407807
407954
|
historyReplayer;
|
|
407808
407955
|
toolCallEmitter;
|
|
407809
407956
|
planEmitter;
|
|
407957
|
+
messageEmitter;
|
|
407810
407958
|
// Implement SessionContext interface
|
|
407811
407959
|
sessionId;
|
|
407812
407960
|
getId() {
|
|
@@ -407873,6 +408021,8 @@ var Session3 = class {
|
|
|
407873
408021
|
return { stopReason: "cancelled" };
|
|
407874
408022
|
}
|
|
407875
408023
|
const functionCalls = [];
|
|
408024
|
+
let usageMetadata = null;
|
|
408025
|
+
const streamStartTime = Date.now();
|
|
407876
408026
|
try {
|
|
407877
408027
|
const responseStream = await chat.sendMessageStream(
|
|
407878
408028
|
this.config.getModel(),
|
|
@@ -407895,16 +408045,16 @@ var Session3 = class {
|
|
|
407895
408045
|
if (!part.text) {
|
|
407896
408046
|
continue;
|
|
407897
408047
|
}
|
|
407898
|
-
|
|
407899
|
-
|
|
407900
|
-
|
|
407901
|
-
|
|
407902
|
-
|
|
407903
|
-
sessionUpdate: part.thought ? "agent_thought_chunk" : "agent_message_chunk",
|
|
407904
|
-
content
|
|
407905
|
-
});
|
|
408048
|
+
this.messageEmitter.emitMessage(
|
|
408049
|
+
part.text,
|
|
408050
|
+
"assistant",
|
|
408051
|
+
part.thought
|
|
408052
|
+
);
|
|
407906
408053
|
}
|
|
407907
408054
|
}
|
|
408055
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
408056
|
+
usageMetadata = resp.value.usageMetadata;
|
|
408057
|
+
}
|
|
407908
408058
|
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
407909
408059
|
functionCalls.push(...resp.value.functionCalls);
|
|
407910
408060
|
}
|
|
@@ -407918,6 +408068,14 @@ var Session3 = class {
|
|
|
407918
408068
|
}
|
|
407919
408069
|
throw error2;
|
|
407920
408070
|
}
|
|
408071
|
+
if (usageMetadata) {
|
|
408072
|
+
const durationMs = Date.now() - streamStartTime;
|
|
408073
|
+
await this.messageEmitter.emitUsageMetadata(
|
|
408074
|
+
usageMetadata,
|
|
408075
|
+
"",
|
|
408076
|
+
durationMs
|
|
408077
|
+
);
|
|
408078
|
+
}
|
|
407921
408079
|
if (functionCalls.length > 0) {
|
|
407922
408080
|
const toolResponseParts = [];
|
|
407923
408081
|
for (const fc of functionCalls) {
|
|
@@ -408056,7 +408214,7 @@ var Session3 = class {
|
|
|
408056
408214
|
abortSignal
|
|
408057
408215
|
);
|
|
408058
408216
|
}
|
|
408059
|
-
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
408217
|
+
const confirmationDetails = this.config.getApprovalMode() !== "yolo" /* YOLO */ ? await invocation.shouldConfirmExecute(abortSignal) : false;
|
|
408060
408218
|
if (confirmationDetails) {
|
|
408061
408219
|
const content = [];
|
|
408062
408220
|
if (confirmationDetails.type === "edit") {
|
|
@@ -408115,7 +408273,8 @@ var Session3 = class {
|
|
|
408115
408273
|
const startParams = {
|
|
408116
408274
|
callId,
|
|
408117
408275
|
toolName: fc.name,
|
|
408118
|
-
args
|
|
408276
|
+
args,
|
|
408277
|
+
status: "in_progress"
|
|
408119
408278
|
};
|
|
408120
408279
|
await this.toolCallEmitter.emitStart(startParams);
|
|
408121
408280
|
}
|
|
@@ -408528,7 +408687,7 @@ var GeminiAgent = class {
|
|
|
408528
408687
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
408529
408688
|
description: APPROVAL_MODE_INFO[mode].description
|
|
408530
408689
|
}));
|
|
408531
|
-
const version3 = "0.1.4-alpha.
|
|
408690
|
+
const version3 = "0.1.4-alpha.9";
|
|
408532
408691
|
return {
|
|
408533
408692
|
protocolVersion: PROTOCOL_VERSION,
|
|
408534
408693
|
agentInfo: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdmind/rdmind",
|
|
3
|
-
"version": "0.1.4-alpha.
|
|
3
|
+
"version": "0.1.4-alpha.9",
|
|
4
4
|
"description": "RDMind - AI-powered coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cli.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"locales"
|
|
21
21
|
],
|
|
22
22
|
"config": {
|
|
23
|
-
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.1.4-alpha.
|
|
23
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.1.4-alpha.9"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|