jinzd-ai-cli 0.4.205 → 0.4.207
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/README.md +1 -1
- package/dist/{batch-RBPABHS7.js → batch-6PORMJWT.js} +2 -2
- package/dist/{chunk-XIYSFN4U.js → chunk-2WV6AGHM.js} +1 -1
- package/dist/{chunk-43H3D2PK.js → chunk-BQIV4ZQT.js} +1 -1
- package/dist/{chunk-JVYH66N2.js → chunk-KJHMRAJU.js} +1 -1
- package/dist/{chunk-ZSC4YLEJ.js → chunk-KOU4KX7J.js} +2 -2
- package/dist/{chunk-UZISJ3KZ.js → chunk-QMXC327F.js} +3 -3
- package/dist/{chunk-3RET7PL7.js → chunk-QNUVZO5X.js} +1 -1
- package/dist/{chunk-43MWRT2C.js → chunk-QQYSZMET.js} +20 -17
- package/dist/{chunk-VOV2PWZU.js → chunk-SFCNFX42.js} +1 -1
- package/dist/{chunk-TZ7SNVSG.js → chunk-TW47X5AO.js} +1 -1
- package/dist/{chunk-SMFRJCXB.js → chunk-XPBEJB27.js} +8 -1
- package/dist/{ci-ABE74AXH.js → ci-AYMV66P3.js} +9 -9
- package/dist/{constants-GMQMJRIO.js → constants-NHGTSHKT.js} +1 -1
- package/dist/{doctor-cli-M5PPO3L3.js → doctor-cli-WKH7T4AW.js} +6 -6
- package/dist/electron-server.js +46 -41
- package/dist/{hub-NCU5JNCK.js → hub-6R3M3NTC.js} +1 -1
- package/dist/index.js +102 -98
- package/dist/{run-tests-ZFAEFEYK.js → run-tests-5F2OBWIK.js} +2 -2
- package/dist/{run-tests-FGRWBNVF.js → run-tests-NBCA4KEG.js} +1 -1
- package/dist/{server-RKP7JRRE.js → server-37EXC4EB.js} +5 -5
- package/dist/{server-ML6ZL3J5.js → server-L2MXWYF7.js} +26 -26
- package/dist/{task-orchestrator-LJP5XZSC.js → task-orchestrator-2DTDVCMR.js} +5 -5
- package/dist/{usage-YX2235W5.js → usage-SZWZFX3T.js} +2 -2
- package/dist/web/client/actions.js +84 -0
- package/dist/web/client/app.js +23 -205
- package/dist/web/client/index.html +27 -42
- package/dist/web/client/sw.js +1 -1
- package/dist/web/client/templates.js +188 -0
- package/package.json +1 -1
package/dist/electron-server.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
VERSION,
|
|
37
37
|
buildUserIdentityPrompt,
|
|
38
38
|
runTestsTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-BQIV4ZQT.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
@@ -623,8 +623,8 @@ var BaseProvider = class {
|
|
|
623
623
|
* 将 Message[] 转换为 OpenAI API 格式的消息数组。
|
|
624
624
|
* content 为 string 时直接传递;为 MessageContentPart[] 时保留数组格式(vision 请求)。
|
|
625
625
|
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
626
|
+
* 基类只提供降级格式:跳过 role='tool' 和带 toolCalls 的 assistant 消息。
|
|
627
|
+
* 需要完整工具历史 roundtrip 的 provider 应覆盖消息构造逻辑,例如 OpenAI-compatible provider。
|
|
628
628
|
*/
|
|
629
629
|
normalizeMessages(messages) {
|
|
630
630
|
return messages.filter((m) => m.role !== "tool" && !m.toolCalls).map((m) => ({ role: m.role, content: m.content }));
|
|
@@ -636,7 +636,14 @@ function isFileWriteTool(name) {
|
|
|
636
636
|
return name === "write_file" || name === "edit_file" || name === "notebook_edit";
|
|
637
637
|
}
|
|
638
638
|
function getDangerLevel(toolName, args) {
|
|
639
|
-
if (toolName.startsWith("mcp__"))
|
|
639
|
+
if (toolName.startsWith("mcp__")) {
|
|
640
|
+
const rawName = toolName.split("__").pop() ?? "";
|
|
641
|
+
const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
|
|
642
|
+
if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
|
|
643
|
+
return "safe";
|
|
644
|
+
}
|
|
645
|
+
return "write";
|
|
646
|
+
}
|
|
640
647
|
if (toolName === "bash") {
|
|
641
648
|
const cmd = String(args["command"] ?? "");
|
|
642
649
|
if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
|
|
@@ -5714,7 +5721,7 @@ ${content}`;
|
|
|
5714
5721
|
};
|
|
5715
5722
|
|
|
5716
5723
|
// src/tools/builtin/write-file.ts
|
|
5717
|
-
import {
|
|
5724
|
+
import { appendFileSync, mkdirSync as mkdirSync4 } from "fs";
|
|
5718
5725
|
import { dirname as dirname3 } from "path";
|
|
5719
5726
|
|
|
5720
5727
|
// src/tools/executor.ts
|
|
@@ -6237,8 +6244,8 @@ var ToolExecutor = class {
|
|
|
6237
6244
|
/** confirm() 的取消回调,由 SIGINT handler 调用 */
|
|
6238
6245
|
cancelConfirmFn = null;
|
|
6239
6246
|
/**
|
|
6240
|
-
* 会话级 auto-approve
|
|
6241
|
-
*
|
|
6247
|
+
* 会话级 auto-approve:跳过 write 确认(仅当前会话有效)。
|
|
6248
|
+
* destructive 操作仍然必须逐次确认。
|
|
6242
6249
|
*/
|
|
6243
6250
|
sessionAutoApprove = false;
|
|
6244
6251
|
/**
|
|
@@ -6322,7 +6329,7 @@ var ToolExecutor = class {
|
|
|
6322
6329
|
}
|
|
6323
6330
|
}
|
|
6324
6331
|
}
|
|
6325
|
-
if (this.sessionAutoApprove && dangerLevel
|
|
6332
|
+
if (this.sessionAutoApprove && dangerLevel === "write") {
|
|
6326
6333
|
this.printToolCall(call);
|
|
6327
6334
|
if (dangerLevel === "write") this.printDiffPreview(call);
|
|
6328
6335
|
console.log(theme.warning(" \u26A1 Auto-approved (session /yolo mode)"));
|
|
@@ -6851,7 +6858,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
6851
6858
|
if (appendMode) {
|
|
6852
6859
|
appendFileSync(filePath, content, encoding);
|
|
6853
6860
|
} else {
|
|
6854
|
-
|
|
6861
|
+
atomicWriteFileSync(filePath, content);
|
|
6855
6862
|
}
|
|
6856
6863
|
const lines = content.split("\n").length;
|
|
6857
6864
|
const mode = appendMode ? "appended" : "written";
|
|
@@ -6867,7 +6874,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
6867
6874
|
};
|
|
6868
6875
|
|
|
6869
6876
|
// src/tools/builtin/edit-file.ts
|
|
6870
|
-
import { readFileSync as readFileSync7,
|
|
6877
|
+
import { readFileSync as readFileSync7, existsSync as existsSync8 } from "fs";
|
|
6871
6878
|
|
|
6872
6879
|
// src/tools/builtin/patch-apply.ts
|
|
6873
6880
|
function parseUnifiedDiff(patch) {
|
|
@@ -7266,7 +7273,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
7266
7273
|
if (res.ok && res.appliedCount > 0 && res.content !== void 0) {
|
|
7267
7274
|
undoStack.push(filePath, `edit_file (patch ${res.appliedCount}/${hunks.length}): ${filePath}`);
|
|
7268
7275
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7269
|
-
|
|
7276
|
+
atomicWriteFileSync(filePath, res.content);
|
|
7270
7277
|
}
|
|
7271
7278
|
return lines.join("\n");
|
|
7272
7279
|
}
|
|
@@ -7300,7 +7307,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
7300
7307
|
if (writeChanges) {
|
|
7301
7308
|
undoStack.push(filePath, `edit_file (batch ${appliedCount}/${edits.length}): ${filePath}`);
|
|
7302
7309
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7303
|
-
|
|
7310
|
+
atomicWriteFileSync(filePath, working);
|
|
7304
7311
|
}
|
|
7305
7312
|
const lines = [];
|
|
7306
7313
|
if (anyFailed && stopOnError) {
|
|
@@ -7338,7 +7345,7 @@ Please read the file first and use exact text.`;
|
|
|
7338
7345
|
const label = res.info?.mode === "ignore_whitespace" ? "edit_file (ws-replace)" : res.info?.mode === "replace_all" ? "edit_file (replace_all)" : "edit_file (replace)";
|
|
7339
7346
|
undoStack.push(filePath, `${label}: ${filePath}`);
|
|
7340
7347
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7341
|
-
|
|
7348
|
+
atomicWriteFileSync(filePath, res.content);
|
|
7342
7349
|
if (res.info?.mode === "replace_all") {
|
|
7343
7350
|
return `Successfully edited ${filePath}${modeLabel}
|
|
7344
7351
|
Replaced: ${res.info.replacedCount} occurrence(s) of ${truncatePreview(oldStr)}
|
|
@@ -7362,7 +7369,7 @@ Please read the file first and use exact text.`;
|
|
|
7362
7369
|
undoStack.push(filePath, `edit_file (insert): ${filePath}`);
|
|
7363
7370
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7364
7371
|
lines.splice(afterLine, 0, content);
|
|
7365
|
-
|
|
7372
|
+
atomicWriteFileSync(filePath, lines.join("\n"));
|
|
7366
7373
|
return `Successfully inserted ${content.split("\n").length} line(s) after line ${afterLine} in ${filePath}`;
|
|
7367
7374
|
}
|
|
7368
7375
|
if (args["delete_from_line"] !== void 0) {
|
|
@@ -7378,7 +7385,7 @@ Please read the file first and use exact text.`;
|
|
|
7378
7385
|
undoStack.push(filePath, `edit_file (delete): ${filePath}`);
|
|
7379
7386
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7380
7387
|
const deleted = lines.splice(fromLine - 1, toLine - fromLine + 1);
|
|
7381
|
-
|
|
7388
|
+
atomicWriteFileSync(filePath, lines.join("\n"));
|
|
7382
7389
|
return `Successfully deleted lines ${fromLine}-${toLine} (${deleted.length} lines) from ${filePath}`;
|
|
7383
7390
|
}
|
|
7384
7391
|
throw new ToolError(
|
|
@@ -8583,7 +8590,7 @@ ${preamble}`;
|
|
|
8583
8590
|
}
|
|
8584
8591
|
|
|
8585
8592
|
// src/tools/builtin/save-last-response.ts
|
|
8586
|
-
import {
|
|
8593
|
+
import { mkdirSync as mkdirSync5, unlinkSync as unlinkSync3, rmdirSync as rmdirSync2 } from "fs";
|
|
8587
8594
|
import { dirname as dirname4 } from "path";
|
|
8588
8595
|
var lastResponseStore = { content: "" };
|
|
8589
8596
|
function cleanupRejectedTeeFile(filePath) {
|
|
@@ -8634,7 +8641,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
8634
8641
|
}
|
|
8635
8642
|
undoStack.push(filePath, `save_last_response: ${filePath}`);
|
|
8636
8643
|
mkdirSync5(dirname4(filePath), { recursive: true });
|
|
8637
|
-
|
|
8644
|
+
atomicWriteFileSync(filePath, content);
|
|
8638
8645
|
const lines = content.split("\n").length;
|
|
8639
8646
|
return `File saved: ${filePath} (${lines} lines, ${content.length} bytes)`;
|
|
8640
8647
|
}
|
|
@@ -11340,7 +11347,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
11340
11347
|
}
|
|
11341
11348
|
}
|
|
11342
11349
|
this.sendToolCallStart(call);
|
|
11343
|
-
if (this.sessionAutoApprove &&
|
|
11350
|
+
if (this.sessionAutoApprove && dangerLevel === "write") {
|
|
11344
11351
|
try {
|
|
11345
11352
|
const rawContent = await runTool(tool, call.arguments, call.name);
|
|
11346
11353
|
const content = truncateOutput(rawContent, call.name);
|
|
@@ -11444,7 +11451,7 @@ import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
|
11444
11451
|
import { join as join12 } from "path";
|
|
11445
11452
|
|
|
11446
11453
|
// src/repl/dev-state.ts
|
|
11447
|
-
import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as
|
|
11454
|
+
import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as writeFileSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync9 } from "fs";
|
|
11448
11455
|
import { join as join11 } from "path";
|
|
11449
11456
|
import { homedir as homedir6 } from "os";
|
|
11450
11457
|
function getDevStatePath() {
|
|
@@ -11722,7 +11729,7 @@ function autoTrimSessionIfNeeded(session, sizeLimit = SESSION_SIZE_LIMIT) {
|
|
|
11722
11729
|
}
|
|
11723
11730
|
|
|
11724
11731
|
// src/web/session-handler.ts
|
|
11725
|
-
import { existsSync as existsSync21, readFileSync as readFileSync14, appendFileSync as appendFileSync3, writeFileSync as
|
|
11732
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, appendFileSync as appendFileSync3, writeFileSync as writeFileSync4, mkdirSync as mkdirSync10, readdirSync as readdirSync9, statSync as statSync8, createWriteStream } from "fs";
|
|
11726
11733
|
import { join as join15, resolve as resolve5, dirname as dirname5 } from "path";
|
|
11727
11734
|
import { execSync as execSync3 } from "child_process";
|
|
11728
11735
|
|
|
@@ -13086,7 +13093,7 @@ Try: /compact to reduce context, /clear to reset, or switch to a larger-context
|
|
|
13086
13093
|
try {
|
|
13087
13094
|
mkdirSync10(dirname5(pendingTeeSave), { recursive: true });
|
|
13088
13095
|
const bodyToSave = stripOuterCodeFence(content);
|
|
13089
|
-
|
|
13096
|
+
atomicWriteFileSync(pendingTeeSave, bodyToSave);
|
|
13090
13097
|
undoStack.push(pendingTeeSave, `save_last_response (deferred): ${pendingTeeSave}`);
|
|
13091
13098
|
const lines = bodyToSave.split("\n").length;
|
|
13092
13099
|
this.send({ type: "info", message: `\u2705 Saved (from reply): ${pendingTeeSave} (${lines} lines, ${bodyToSave.length} chars)` });
|
|
@@ -13261,7 +13268,7 @@ ${summaryContent}`,
|
|
|
13261
13268
|
let summary;
|
|
13262
13269
|
try {
|
|
13263
13270
|
mkdirSync10(dirname5(saveToFile), { recursive: true });
|
|
13264
|
-
fileStream = createWriteStream(saveToFile
|
|
13271
|
+
fileStream = createWriteStream(saveToFile);
|
|
13265
13272
|
const teeSystemPrompt = stripToolCallReminder(systemPrompt ?? "") + CONTENT_ONLY_STREAM_REMINDER;
|
|
13266
13273
|
const teeExtraMessages = extraMessages.length > 0 ? [...extraMessages, { role: "user", content: TEE_FINAL_USER_NUDGE }] : [{ role: "user", content: TEE_FINAL_USER_NUDGE }];
|
|
13267
13274
|
const chatRequest = {
|
|
@@ -13301,7 +13308,7 @@ ${summaryContent}`,
|
|
|
13301
13308
|
fullContent = "";
|
|
13302
13309
|
} else {
|
|
13303
13310
|
if (verdict.kind === "salvaged" || verdict.kind === "fallback") {
|
|
13304
|
-
|
|
13311
|
+
atomicWriteFileSync(saveToFile, verdict.content);
|
|
13305
13312
|
fullContent = verdict.content;
|
|
13306
13313
|
}
|
|
13307
13314
|
summary = verdict.summary;
|
|
@@ -13753,7 +13760,7 @@ ${activated.meta.description || ""}` });
|
|
|
13753
13760
|
this.send({ type: "info", message: "\u{1F512} Auto-approve disabled \u2014 confirmations restored for this session." });
|
|
13754
13761
|
} else {
|
|
13755
13762
|
this.toolExecutor.sessionAutoApprove = true;
|
|
13756
|
-
this.send({ type: "info", message: "\u26A1 YOLO mode ON \u2014
|
|
13763
|
+
this.send({ type: "info", message: "\u26A1 YOLO mode ON \u2014 write tools auto-approved; destructive tools still require confirmation.\nUse /yolo off to re-enable write confirmations." });
|
|
13757
13764
|
}
|
|
13758
13765
|
break;
|
|
13759
13766
|
}
|
|
@@ -14366,7 +14373,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14366
14373
|
case "test": {
|
|
14367
14374
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
14368
14375
|
try {
|
|
14369
|
-
const { executeTests } = await import("./run-tests-
|
|
14376
|
+
const { executeTests } = await import("./run-tests-NBCA4KEG.js");
|
|
14370
14377
|
const argStr = args.join(" ").trim();
|
|
14371
14378
|
let testArgs = {};
|
|
14372
14379
|
if (argStr) {
|
|
@@ -14395,7 +14402,7 @@ Use /init --force to overwrite.` });
|
|
|
14395
14402
|
const projectInfo = this.scanProject(cwd);
|
|
14396
14403
|
const prompt = this.buildInitPrompt(projectInfo, cwd);
|
|
14397
14404
|
const content = await this.chatOnce(prompt, { temperature: 0.3, maxTokens: 4096 });
|
|
14398
|
-
|
|
14405
|
+
writeFileSync4(targetPath, content, "utf-8");
|
|
14399
14406
|
this.send({ type: "info", message: `\u2713 Generated: ${targetPath} (${content.length} chars)
|
|
14400
14407
|
Use /context reload to load it.` });
|
|
14401
14408
|
} catch (err) {
|
|
@@ -14874,7 +14881,7 @@ Add .md files to create commands.` });
|
|
|
14874
14881
|
const configDir = this.config.getConfigDir();
|
|
14875
14882
|
const memPath = join15(configDir, MEMORY_FILE_NAME);
|
|
14876
14883
|
try {
|
|
14877
|
-
|
|
14884
|
+
writeFileSync4(memPath, "", "utf-8");
|
|
14878
14885
|
this.send({ type: "info", message: "\u{1F5D1}\uFE0F Persistent memory cleared." });
|
|
14879
14886
|
} catch (err) {
|
|
14880
14887
|
this.send({ type: "error", message: `Failed to clear memory: ${err.message}` });
|
|
@@ -15350,7 +15357,7 @@ async function setupProxy(configProxy) {
|
|
|
15350
15357
|
}
|
|
15351
15358
|
|
|
15352
15359
|
// src/web/auth.ts
|
|
15353
|
-
import { existsSync as existsSync22, readFileSync as readFileSync15, writeFileSync as
|
|
15360
|
+
import { existsSync as existsSync22, readFileSync as readFileSync15, writeFileSync as writeFileSync5, mkdirSync as mkdirSync11, readdirSync as readdirSync10, copyFileSync } from "fs";
|
|
15354
15361
|
import { join as join16 } from "path";
|
|
15355
15362
|
import { createHmac, randomBytes, timingSafeEqual, pbkdf2Sync } from "crypto";
|
|
15356
15363
|
var USERS_FILE = "users.json";
|
|
@@ -15552,7 +15559,7 @@ var AuthManager = class {
|
|
|
15552
15559
|
if (existsSync22(globalConfig)) {
|
|
15553
15560
|
try {
|
|
15554
15561
|
const content = readFileSync15(globalConfig, "utf-8");
|
|
15555
|
-
|
|
15562
|
+
writeFileSync5(join16(userDir, "config.json"), content, "utf-8");
|
|
15556
15563
|
} catch {
|
|
15557
15564
|
}
|
|
15558
15565
|
}
|
|
@@ -15560,7 +15567,7 @@ var AuthManager = class {
|
|
|
15560
15567
|
if (existsSync22(globalMemory)) {
|
|
15561
15568
|
try {
|
|
15562
15569
|
const content = readFileSync15(globalMemory, "utf-8");
|
|
15563
|
-
|
|
15570
|
+
writeFileSync5(join16(userDir, "memory.md"), content, "utf-8");
|
|
15564
15571
|
} catch {
|
|
15565
15572
|
}
|
|
15566
15573
|
}
|
|
@@ -15724,12 +15731,9 @@ async function startWebServer(options = {}) {
|
|
|
15724
15731
|
"Content-Security-Policy",
|
|
15725
15732
|
[
|
|
15726
15733
|
"default-src 'self'",
|
|
15727
|
-
//
|
|
15728
|
-
//
|
|
15729
|
-
|
|
15730
|
-
// CSP violation in the console). localhost dev/admin tool — the
|
|
15731
|
-
// unsafe-inline XSS surface is acceptable under that threat model.
|
|
15732
|
-
"script-src 'self' 'unsafe-inline'",
|
|
15734
|
+
// Inline event handlers and startup scripts live in app.js, so script
|
|
15735
|
+
// execution stays locked to same-origin files only.
|
|
15736
|
+
"script-src 'self'",
|
|
15733
15737
|
"style-src 'self' 'unsafe-inline'",
|
|
15734
15738
|
"img-src 'self' data: blob:",
|
|
15735
15739
|
"font-src 'self' data:",
|
|
@@ -16089,7 +16093,7 @@ async function startWebServer(options = {}) {
|
|
|
16089
16093
|
handlers.set(tabId, handler);
|
|
16090
16094
|
clearPreAuthTimer();
|
|
16091
16095
|
console.log(` \u2713 User registered & connected: ${username} (tab: ${tabId.slice(0, 12)})`);
|
|
16092
|
-
ws.send(JSON.stringify({ type: "auth_result", success: true,
|
|
16096
|
+
ws.send(JSON.stringify({ type: "auth_result", success: true, username }));
|
|
16093
16097
|
return;
|
|
16094
16098
|
}
|
|
16095
16099
|
if (action === "token") {
|
|
@@ -16105,7 +16109,7 @@ async function startWebServer(options = {}) {
|
|
|
16105
16109
|
handlers.set(tabId, handler);
|
|
16106
16110
|
clearPreAuthTimer();
|
|
16107
16111
|
console.log(` \u2713 Token auth: ${verifiedUser} (tab: ${tabId.slice(0, 12)})`);
|
|
16108
|
-
ws.send(JSON.stringify({ type: "auth_result", success: true,
|
|
16112
|
+
ws.send(JSON.stringify({ type: "auth_result", success: true, username: verifiedUser }));
|
|
16109
16113
|
return;
|
|
16110
16114
|
}
|
|
16111
16115
|
if (action === "login") {
|
|
@@ -16120,7 +16124,7 @@ async function startWebServer(options = {}) {
|
|
|
16120
16124
|
handlers.set(tabId, handler);
|
|
16121
16125
|
clearPreAuthTimer();
|
|
16122
16126
|
console.log(` \u2713 User logged in: ${username} (tab: ${tabId.slice(0, 12)})`);
|
|
16123
|
-
ws.send(JSON.stringify({ type: "auth_result", success: true,
|
|
16127
|
+
ws.send(JSON.stringify({ type: "auth_result", success: true, username }));
|
|
16124
16128
|
return;
|
|
16125
16129
|
}
|
|
16126
16130
|
ws.send(JSON.stringify({ type: "auth_result", success: false, error: "Unknown auth action" }));
|
|
@@ -16146,9 +16150,10 @@ async function startWebServer(options = {}) {
|
|
|
16146
16150
|
});
|
|
16147
16151
|
ws.on("close", () => {
|
|
16148
16152
|
clearPreAuthTimer();
|
|
16149
|
-
|
|
16153
|
+
const wasTracked = handlers.has(tabId);
|
|
16150
16154
|
if (handler) handler.onDisconnect();
|
|
16151
|
-
handlers.delete(tabId);
|
|
16155
|
+
if (wasTracked) handlers.delete(tabId);
|
|
16156
|
+
console.log(` \u2717 Tab disconnected: ${tabId.slice(0, 12)} (total: ${handlers.size})`);
|
|
16152
16157
|
});
|
|
16153
16158
|
ws.on("error", (err) => {
|
|
16154
16159
|
console.error(` WebSocket error: ${err.message}`);
|
|
@@ -154,7 +154,7 @@ ${content}`);
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
157
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
157
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-2DTDVCMR.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|