pybao-cli 1.3.84 → 1.3.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/REPL-J7EKVUMW.js +47 -0
- package/dist/{acp-2L5UIDYK.js → acp-NMISJFTQ.js} +31 -31
- package/dist/acp-NMISJFTQ.js.map +7 -0
- package/dist/{agentsValidate-G5UPCE23.js → agentsValidate-G7H7CUZU.js} +10 -8
- package/dist/agentsValidate-G7H7CUZU.js.map +7 -0
- package/dist/{ask-NC5FHXVG.js → ask-E7XSHQAN.js} +28 -28
- package/dist/{autoUpdater-4RF2CRK5.js → autoUpdater-EAH2H7AP.js} +3 -3
- package/dist/{chunk-MN5A3I5G.js → chunk-3RXA6IWG.js} +5 -6
- package/dist/chunk-3RXA6IWG.js.map +7 -0
- package/dist/{chunk-7YPF7IZE.js → chunk-4GB3OWJY.js} +37 -11
- package/dist/chunk-4GB3OWJY.js.map +7 -0
- package/dist/{chunk-SB5WQNSQ.js → chunk-6XDESUHK.js} +1 -1
- package/dist/{chunk-PPIHT4XC.js → chunk-7IKX4543.js} +5 -3
- package/dist/chunk-7IKX4543.js.map +7 -0
- package/dist/{chunk-LZHKCLLB.js → chunk-BBZ2VZ5J.js} +3 -3
- package/dist/{chunk-UQHYTY5X.js → chunk-BHBHS3MY.js} +3 -3
- package/dist/{chunk-W2SGOL2K.js → chunk-BPN5QY2K.js} +2 -2
- package/dist/{chunk-7WMAUFRG.js → chunk-EQMKAITH.js} +1 -1
- package/dist/{chunk-6WOCAHEK.js → chunk-F47KO7J2.js} +1 -1
- package/dist/{chunk-SOGXQEV2.js → chunk-GEHCREEY.js} +3 -3
- package/dist/{chunk-PC33U2HP.js → chunk-H6NBGOQG.js} +1 -1
- package/dist/{chunk-PC33U2HP.js.map → chunk-H6NBGOQG.js.map} +1 -1
- package/dist/{chunk-MUQI2KCA.js → chunk-HHTFRFKN.js} +2 -2
- package/dist/{chunk-46KUA6OA.js → chunk-HVMJPWC6.js} +3 -3
- package/dist/{chunk-NEG6NKKM.js → chunk-HWIU6J2T.js} +3 -3
- package/dist/{chunk-42L6OJOC.js → chunk-KEALJIDY.js} +5 -5
- package/dist/{chunk-42L6OJOC.js.map → chunk-KEALJIDY.js.map} +2 -2
- package/dist/{chunk-7HP3UEMN.js → chunk-KTLUYKAC.js} +1 -1
- package/dist/{chunk-WPA4GCGG.js → chunk-KUIDN7FP.js} +181 -74
- package/dist/chunk-KUIDN7FP.js.map +7 -0
- package/dist/{chunk-TACMGUAN.js → chunk-L62OCVZH.js} +20 -20
- package/dist/chunk-L62OCVZH.js.map +7 -0
- package/dist/{chunk-FKAYIROZ.js → chunk-LSJILN2S.js} +19 -15
- package/dist/chunk-LSJILN2S.js.map +7 -0
- package/dist/{chunk-OVROGAUW.js → chunk-MRU4VN5R.js} +7 -5
- package/dist/chunk-MRU4VN5R.js.map +7 -0
- package/dist/{chunk-FJRJWV7O.js → chunk-N6ETO4PE.js} +4 -4
- package/dist/{chunk-YCIGVKJU.js → chunk-Q32HEIH2.js} +4 -4
- package/dist/{chunk-KHMW5FJP.js → chunk-Q7W7PGSO.js} +1 -1
- package/dist/{chunk-C3HV2RX2.js → chunk-SBF7BOS4.js} +3 -3
- package/dist/{chunk-7TIDBKNN.js → chunk-T2HQBH46.js} +3 -3
- package/dist/{chunk-KDKEJCIA.js → chunk-UF2ARFEB.js} +8 -3
- package/dist/chunk-UF2ARFEB.js.map +7 -0
- package/dist/{chunk-GFKRGL22.js → chunk-VAR6IG72.js} +5 -4
- package/dist/chunk-VAR6IG72.js.map +7 -0
- package/dist/{chunk-ZIEALAFY.js → chunk-VBJP55XA.js} +1 -1
- package/dist/{chunk-JJEJMLIT.js → chunk-WCX3ELKY.js} +39 -38
- package/dist/chunk-WCX3ELKY.js.map +7 -0
- package/dist/{chunk-CSRNWBXQ.js → chunk-XD5KXOSG.js} +4 -4
- package/dist/chunk-XD5KXOSG.js.map +7 -0
- package/dist/{cli-MWA546KO.js → cli-VTNXK3N3.js} +87 -87
- package/dist/commands-SNKMFZOR.js +51 -0
- package/dist/{config-JOHT6J75.js → config-FBT5ABGI.js} +4 -4
- package/dist/{context-CPFQPWH5.js → context-WBZK3AZX.js} +5 -5
- package/dist/{customCommands-K5AGAFXB.js → customCommands-IFWVN654.js} +4 -4
- package/dist/{env-CEU3W5ME.js → env-5O5DDVID.js} +14 -4
- package/dist/{file-QZ3DYDGR.js → file-K3P2ZXOY.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-RBX2F2S4.js → llm-XZHOT5QG.js} +29 -29
- package/dist/{llmLazy-BIN2DEC2.js → llmLazy-VVQLL2O4.js} +1 -1
- package/dist/{loader-CV7OJ4NZ.js → loader-JC5XSGNC.js} +4 -4
- package/dist/{lsp-QFZEUOOA.js → lsp-NJNGVY3E.js} +6 -6
- package/dist/{lspAnchor-Q2QPAITR.js → lspAnchor-3AQPL2ZZ.js} +6 -6
- package/dist/{mcp-JM5OIHPD.js → mcp-DTKD53FS.js} +7 -7
- package/dist/{mentionProcessor-4LMVOVGA.js → mentionProcessor-JS7EY2LD.js} +5 -5
- package/dist/{messages-XW74FZX6.js → messages-GQMW2ANU.js} +1 -1
- package/dist/{model-RJINKACR.js → model-VGKT6DJE.js} +5 -5
- package/dist/{openai-66PYA2FX.js → openai-TSJZC7MB.js} +5 -5
- package/dist/{outputStyles-MV6ZVKVT.js → outputStyles-5VLEN2UN.js} +4 -4
- package/dist/{pluginRuntime-BCOVUPBE.js → pluginRuntime-XKPZ3BX4.js} +6 -6
- package/dist/{pluginValidation-3E6ZTNSH.js → pluginValidation-ZHCDH3MZ.js} +6 -6
- package/dist/prompts-MQWEK5T7.js +53 -0
- package/dist/{pybAgentSessionLoad-CKCBOT52.js → pybAgentSessionLoad-5CPNQIXV.js} +4 -4
- package/dist/{pybAgentSessionResume-LDUO3VEW.js → pybAgentSessionResume-VCYFMJCA.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-5XVEA5BE.js → pybAgentStreamJsonSession-DOTUU74W.js} +1 -1
- package/dist/{pybHooks-JTBESPF6.js → pybHooks-W2EX2SUW.js} +4 -4
- package/dist/query-OH75KHOB.js +55 -0
- package/dist/{registry-2K7ZNIJX.js → registry-OUOC3F5A.js} +5 -5
- package/dist/{ripgrep-RJWD3Z7N.js → ripgrep-MEONNP4W.js} +3 -3
- package/dist/{skillMarketplace-ZDWIN663.js → skillMarketplace-34N7IKSR.js} +3 -3
- package/dist/{state-XOHPGE2O.js → state-6NDQ3LIC.js} +2 -2
- package/dist/{theme-B672GYQW.js → theme-7K5257BK.js} +5 -5
- package/dist/{toolPermissionSettings-IGFHXHH7.js → toolPermissionSettings-2QVLET4R.js} +6 -6
- package/dist/tools-6MGNB35T.js +52 -0
- package/dist/{userInput-6CV2RY5H.js → userInput-MF4TLCQC.js} +30 -30
- package/package.json +1 -1
- package/dist/REPL-FGFUX54P.js +0 -47
- package/dist/acp-2L5UIDYK.js.map +0 -7
- package/dist/agentsValidate-G5UPCE23.js.map +0 -7
- package/dist/chunk-7YPF7IZE.js.map +0 -7
- package/dist/chunk-CSRNWBXQ.js.map +0 -7
- package/dist/chunk-FKAYIROZ.js.map +0 -7
- package/dist/chunk-GFKRGL22.js.map +0 -7
- package/dist/chunk-JJEJMLIT.js.map +0 -7
- package/dist/chunk-KDKEJCIA.js.map +0 -7
- package/dist/chunk-MN5A3I5G.js.map +0 -7
- package/dist/chunk-OVROGAUW.js.map +0 -7
- package/dist/chunk-PPIHT4XC.js.map +0 -7
- package/dist/chunk-TACMGUAN.js.map +0 -7
- package/dist/chunk-WPA4GCGG.js.map +0 -7
- package/dist/commands-JMPWEXWX.js +0 -51
- package/dist/prompts-CQXW5O3Z.js +0 -53
- package/dist/query-Z3URPE24.js +0 -55
- package/dist/tools-4SXRMJGJ.js +0 -52
- /package/dist/{REPL-FGFUX54P.js.map → REPL-J7EKVUMW.js.map} +0 -0
- /package/dist/{ask-NC5FHXVG.js.map → ask-E7XSHQAN.js.map} +0 -0
- /package/dist/{autoUpdater-4RF2CRK5.js.map → autoUpdater-EAH2H7AP.js.map} +0 -0
- /package/dist/{chunk-SB5WQNSQ.js.map → chunk-6XDESUHK.js.map} +0 -0
- /package/dist/{chunk-LZHKCLLB.js.map → chunk-BBZ2VZ5J.js.map} +0 -0
- /package/dist/{chunk-UQHYTY5X.js.map → chunk-BHBHS3MY.js.map} +0 -0
- /package/dist/{chunk-W2SGOL2K.js.map → chunk-BPN5QY2K.js.map} +0 -0
- /package/dist/{chunk-7WMAUFRG.js.map → chunk-EQMKAITH.js.map} +0 -0
- /package/dist/{chunk-6WOCAHEK.js.map → chunk-F47KO7J2.js.map} +0 -0
- /package/dist/{chunk-SOGXQEV2.js.map → chunk-GEHCREEY.js.map} +0 -0
- /package/dist/{chunk-MUQI2KCA.js.map → chunk-HHTFRFKN.js.map} +0 -0
- /package/dist/{chunk-46KUA6OA.js.map → chunk-HVMJPWC6.js.map} +0 -0
- /package/dist/{chunk-NEG6NKKM.js.map → chunk-HWIU6J2T.js.map} +0 -0
- /package/dist/{chunk-7HP3UEMN.js.map → chunk-KTLUYKAC.js.map} +0 -0
- /package/dist/{chunk-FJRJWV7O.js.map → chunk-N6ETO4PE.js.map} +0 -0
- /package/dist/{chunk-YCIGVKJU.js.map → chunk-Q32HEIH2.js.map} +0 -0
- /package/dist/{chunk-KHMW5FJP.js.map → chunk-Q7W7PGSO.js.map} +0 -0
- /package/dist/{chunk-C3HV2RX2.js.map → chunk-SBF7BOS4.js.map} +0 -0
- /package/dist/{chunk-7TIDBKNN.js.map → chunk-T2HQBH46.js.map} +0 -0
- /package/dist/{chunk-ZIEALAFY.js.map → chunk-VBJP55XA.js.map} +0 -0
- /package/dist/{cli-MWA546KO.js.map → cli-VTNXK3N3.js.map} +0 -0
- /package/dist/{commands-JMPWEXWX.js.map → commands-SNKMFZOR.js.map} +0 -0
- /package/dist/{config-JOHT6J75.js.map → config-FBT5ABGI.js.map} +0 -0
- /package/dist/{context-CPFQPWH5.js.map → context-WBZK3AZX.js.map} +0 -0
- /package/dist/{customCommands-K5AGAFXB.js.map → customCommands-IFWVN654.js.map} +0 -0
- /package/dist/{env-CEU3W5ME.js.map → env-5O5DDVID.js.map} +0 -0
- /package/dist/{file-QZ3DYDGR.js.map → file-K3P2ZXOY.js.map} +0 -0
- /package/dist/{llm-RBX2F2S4.js.map → llm-XZHOT5QG.js.map} +0 -0
- /package/dist/{llmLazy-BIN2DEC2.js.map → llmLazy-VVQLL2O4.js.map} +0 -0
- /package/dist/{loader-CV7OJ4NZ.js.map → loader-JC5XSGNC.js.map} +0 -0
- /package/dist/{lsp-QFZEUOOA.js.map → lsp-NJNGVY3E.js.map} +0 -0
- /package/dist/{lspAnchor-Q2QPAITR.js.map → lspAnchor-3AQPL2ZZ.js.map} +0 -0
- /package/dist/{mcp-JM5OIHPD.js.map → mcp-DTKD53FS.js.map} +0 -0
- /package/dist/{mentionProcessor-4LMVOVGA.js.map → mentionProcessor-JS7EY2LD.js.map} +0 -0
- /package/dist/{messages-XW74FZX6.js.map → messages-GQMW2ANU.js.map} +0 -0
- /package/dist/{model-RJINKACR.js.map → model-VGKT6DJE.js.map} +0 -0
- /package/dist/{openai-66PYA2FX.js.map → openai-TSJZC7MB.js.map} +0 -0
- /package/dist/{outputStyles-MV6ZVKVT.js.map → outputStyles-5VLEN2UN.js.map} +0 -0
- /package/dist/{pluginRuntime-BCOVUPBE.js.map → pluginRuntime-XKPZ3BX4.js.map} +0 -0
- /package/dist/{pluginValidation-3E6ZTNSH.js.map → pluginValidation-ZHCDH3MZ.js.map} +0 -0
- /package/dist/{prompts-CQXW5O3Z.js.map → prompts-MQWEK5T7.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-CKCBOT52.js.map → pybAgentSessionLoad-5CPNQIXV.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-LDUO3VEW.js.map → pybAgentSessionResume-VCYFMJCA.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-5XVEA5BE.js.map → pybAgentStreamJsonSession-DOTUU74W.js.map} +0 -0
- /package/dist/{pybHooks-JTBESPF6.js.map → pybHooks-W2EX2SUW.js.map} +0 -0
- /package/dist/{query-Z3URPE24.js.map → query-OH75KHOB.js.map} +0 -0
- /package/dist/{registry-2K7ZNIJX.js.map → registry-OUOC3F5A.js.map} +0 -0
- /package/dist/{ripgrep-RJWD3Z7N.js.map → ripgrep-MEONNP4W.js.map} +0 -0
- /package/dist/{skillMarketplace-ZDWIN663.js.map → skillMarketplace-34N7IKSR.js.map} +0 -0
- /package/dist/{state-XOHPGE2O.js.map → state-6NDQ3LIC.js.map} +0 -0
- /package/dist/{theme-B672GYQW.js.map → theme-7K5257BK.js.map} +0 -0
- /package/dist/{toolPermissionSettings-IGFHXHH7.js.map → toolPermissionSettings-2QVLET4R.js.map} +0 -0
- /package/dist/{tools-4SXRMJGJ.js.map → tools-6MGNB35T.js.map} +0 -0
- /package/dist/{userInput-6CV2RY5H.js.map → userInput-MF4TLCQC.js.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __pybCreateRequire } from "node:module";
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
SESSION_ID
|
|
5
|
-
|
|
4
|
+
SESSION_ID,
|
|
5
|
+
resolveXdgCachePath
|
|
6
|
+
} from "./chunk-KUIDN7FP.js";
|
|
6
7
|
|
|
7
8
|
// src/utils/log/debugLogger.ts
|
|
8
9
|
import { existsSync, mkdirSync, appendFileSync } from "fs";
|
|
9
10
|
import { join } from "path";
|
|
10
|
-
import { homedir } from "os";
|
|
11
11
|
import { format } from "node:util";
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
var isDebugMode = () => process.argv.includes("--debug-verbose") || process.argv.includes("--mcp-debug") || process.argv.some(
|
|
@@ -32,12 +32,11 @@ var DEBUG_VERBOSE_TERMINAL_LOG_LEVELS = /* @__PURE__ */ new Set([
|
|
|
32
32
|
]);
|
|
33
33
|
var STARTUP_TIMESTAMP = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
34
34
|
var REQUEST_START_TIME = Date.now();
|
|
35
|
-
var PYB_DIR = join(homedir(), ".pyb");
|
|
36
35
|
function getProjectDir(cwd) {
|
|
37
36
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
38
37
|
}
|
|
39
38
|
var DEBUG_PATHS = {
|
|
40
|
-
base: () => join(
|
|
39
|
+
base: () => resolveXdgCachePath(join("debug", getProjectDir(process.cwd()))),
|
|
41
40
|
detailed: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-detailed.log`),
|
|
42
41
|
flow: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-flow.log`),
|
|
43
42
|
api: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-api.log`),
|
|
@@ -248,7 +247,7 @@ function markPhase(phase, data) {
|
|
|
248
247
|
});
|
|
249
248
|
}
|
|
250
249
|
function logAPIError(context) {
|
|
251
|
-
const errorDir = join(
|
|
250
|
+
const errorDir = resolveXdgCachePath(join("logs", "error", "api"));
|
|
252
251
|
if (!existsSync(errorDir)) {
|
|
253
252
|
try {
|
|
254
253
|
mkdirSync(errorDir, { recursive: true });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils/log/debugLogger.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, mkdirSync, appendFileSync } from 'fs'\nimport { join } from 'path'\nimport { randomUUID } from 'crypto'\nimport { format } from 'node:util'\nimport chalk from 'chalk'\nimport { SESSION_ID } from './index'\nimport type { Message } from '@pyb-types/conversation'\nimport { resolveXdgCachePath } from '@utils/config/env'\n\nexport enum LogLevel {\n TRACE = 'TRACE',\n DEBUG = 'DEBUG',\n INFO = 'INFO',\n WARN = 'WARN',\n ERROR = 'ERROR',\n FLOW = 'FLOW',\n API = 'API',\n STATE = 'STATE',\n REMINDER = 'REMINDER',\n}\n\nconst isDebugMode = () =>\n process.argv.includes('--debug-verbose') ||\n process.argv.includes('--mcp-debug') ||\n process.argv.some(\n arg => arg === '--debug' || arg === '-d' || arg.startsWith('--debug='),\n )\nconst isVerboseMode = () => process.argv.includes('--verbose')\nconst isDebugVerboseMode = () => process.argv.includes('--debug-verbose')\n\nconst TERMINAL_LOG_LEVELS = new Set([\n LogLevel.ERROR,\n LogLevel.WARN,\n LogLevel.INFO,\n LogLevel.REMINDER,\n])\n\nconst DEBUG_VERBOSE_TERMINAL_LOG_LEVELS = new Set([\n LogLevel.ERROR,\n LogLevel.WARN,\n LogLevel.FLOW,\n LogLevel.API,\n LogLevel.STATE,\n LogLevel.INFO,\n LogLevel.REMINDER,\n])\n\nconst USER_FRIENDLY_LEVELS = new Set([\n 'SESSION_START',\n 'QUERY_START',\n 'QUERY_PROGRESS',\n 'QUERY_COMPLETE',\n 'TOOL_EXECUTION',\n 'ERROR_OCCURRED',\n 'PERFORMANCE_SUMMARY',\n])\n\nconst STARTUP_TIMESTAMP = new Date().toISOString().replace(/[:.]/g, '-')\nconst REQUEST_START_TIME = Date.now()\n\nfunction getProjectDir(cwd: string): string {\n return cwd.replace(/[^a-zA-Z0-9]/g, '-')\n}\n\nconst DEBUG_PATHS = {\n base: () =>\n resolveXdgCachePath(join('debug', getProjectDir(process.cwd()))),\n detailed: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-detailed.log`),\n flow: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-flow.log`),\n api: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-api.log`),\n state: () => join(DEBUG_PATHS.base(), `${STARTUP_TIMESTAMP}-state.log`),\n}\n\nfunction ensureDebugDir() {\n const debugDir = DEBUG_PATHS.base()\n if (!existsSync(debugDir)) {\n mkdirSync(debugDir, { recursive: true })\n }\n}\n\ninterface LogEntry {\n timestamp: string\n level: LogLevel\n phase: string\n requestId?: string\n data: any\n elapsed?: number\n}\n\nclass RequestContext {\n public readonly id: string\n public readonly startTime: number\n private phases: Map<string, number> = new Map()\n\n constructor() {\n this.id = randomUUID().slice(0, 8)\n this.startTime = Date.now()\n }\n\n markPhase(phase: string) {\n this.phases.set(phase, Date.now() - this.startTime)\n }\n\n getPhaseTime(phase: string): number {\n return this.phases.get(phase) || 0\n }\n\n getAllPhases(): Record<string, number> {\n return Object.fromEntries(this.phases)\n }\n}\n\nconst activeRequests = new Map<string, RequestContext>()\nlet currentRequest: RequestContext | null = null\n\nfunction terminalLog(...args: unknown[]): void {\n process.stderr.write(`${format(...args)}\\n`)\n}\n\nfunction writeToFile(filePath: string, entry: LogEntry) {\n if (!isDebugMode()) return\n\n try {\n ensureDebugDir()\n const logLine =\n JSON.stringify(\n {\n ...entry,\n sessionId: SESSION_ID,\n pid: process.pid,\n uptime: Date.now() - REQUEST_START_TIME,\n },\n null,\n 2,\n ) + ',\\n'\n\n appendFileSync(filePath, logLine)\n } catch (error) {\n }\n}\n\nconst recentLogs = new Map<string, number>()\nconst LOG_DEDUPE_WINDOW_MS = 5000\n\nfunction getDedupeKey(level: LogLevel, phase: string, data: any): string {\n if (phase.startsWith('CONFIG_')) {\n const file = data?.file || ''\n return `${level}:${phase}:${file}`\n }\n\n return `${level}:${phase}`\n}\n\nfunction shouldLogWithDedupe(\n level: LogLevel,\n phase: string,\n data: any,\n): boolean {\n const key = getDedupeKey(level, phase, data)\n const now = Date.now()\n const lastLogTime = recentLogs.get(key)\n\n if (!lastLogTime || now - lastLogTime > LOG_DEDUPE_WINDOW_MS) {\n recentLogs.set(key, now)\n\n for (const [oldKey, oldTime] of recentLogs.entries()) {\n if (now - oldTime > LOG_DEDUPE_WINDOW_MS) {\n recentLogs.delete(oldKey)\n }\n }\n\n return true\n }\n\n return false\n}\nfunction formatMessages(messages: any): string {\n if (Array.isArray(messages)) {\n const recentMessages = messages.slice(-5)\n return recentMessages\n .map((msg, index) => {\n const role = msg.role || 'unknown'\n let content = ''\n\n if (typeof msg.content === 'string') {\n content =\n msg.content.length > 300\n ? msg.content.substring(0, 300) + '...'\n : msg.content\n } else if (typeof msg.content === 'object') {\n content = '[complex_content]'\n } else {\n content = String(msg.content || '')\n }\n\n const totalIndex = messages.length - recentMessages.length + index\n return `[${totalIndex}] ${chalk.dim(role)}: ${content}`\n })\n .join('\\n ')\n }\n\n if (typeof messages === 'string') {\n try {\n const parsed = JSON.parse(messages)\n if (Array.isArray(parsed)) {\n return formatMessages(parsed)\n }\n } catch {\n }\n }\n\n if (typeof messages === 'string' && messages.length > 200) {\n return messages.substring(0, 200) + '...'\n }\n\n return typeof messages === 'string' ? messages : JSON.stringify(messages)\n}\n\nfunction shouldShowInTerminal(level: LogLevel): boolean {\n if (!isDebugMode()) return false\n\n if (isDebugVerboseMode()) {\n return DEBUG_VERBOSE_TERMINAL_LOG_LEVELS.has(level)\n }\n\n return TERMINAL_LOG_LEVELS.has(level)\n}\n\nfunction logToTerminal(entry: LogEntry) {\n if (!shouldShowInTerminal(entry.level)) return\n\n const { level, phase, data, requestId, elapsed } = entry\n const timestamp = new Date().toISOString().slice(11, 23)\n\n let prefix = ''\n let color = chalk.gray\n\n switch (level) {\n case LogLevel.FLOW:\n prefix = '\uD83D\uDD04'\n color = chalk.cyan\n break\n case LogLevel.API:\n prefix = '\uD83C\uDF10'\n color = chalk.yellow\n break\n case LogLevel.STATE:\n prefix = '\uD83D\uDCCA'\n color = chalk.blue\n break\n case LogLevel.ERROR:\n prefix = '\u274C'\n color = chalk.red\n break\n case LogLevel.WARN:\n prefix = '\u26A0\uFE0F'\n color = chalk.yellow\n break\n case LogLevel.INFO:\n prefix = '\u2139\uFE0F'\n color = chalk.green\n break\n case LogLevel.TRACE:\n prefix = '\uD83D\uDCC8'\n color = chalk.magenta\n break\n default:\n prefix = '\uD83D\uDD0D'\n color = chalk.gray\n }\n\n const reqId = requestId ? chalk.dim(`[${requestId}]`) : ''\n const elapsedStr = elapsed !== undefined ? chalk.dim(`+${elapsed}ms`) : ''\n\n let dataStr = ''\n if (typeof data === 'object' && data !== null) {\n if (data.messages) {\n const formattedMessages = formatMessages(data.messages)\n dataStr = JSON.stringify(\n {\n ...data,\n messages: `\\n ${formattedMessages}`,\n },\n null,\n 2,\n )\n } else {\n dataStr = JSON.stringify(data, null, 2)\n }\n } else {\n dataStr = typeof data === 'string' ? data : JSON.stringify(data)\n }\n\n terminalLog(\n `${color(`[${timestamp}]`)} ${prefix} ${color(phase)} ${reqId} ${dataStr} ${elapsedStr}`,\n )\n}\n\nexport function debugLog(\n level: LogLevel,\n phase: string,\n data: any,\n requestId?: string,\n) {\n if (!isDebugMode()) return\n\n if (!shouldLogWithDedupe(level, phase, data)) {\n return\n }\n\n const entry: LogEntry = {\n timestamp: new Date().toISOString(),\n level,\n phase,\n data,\n requestId: requestId || currentRequest?.id,\n elapsed: currentRequest ? Date.now() - currentRequest.startTime : undefined,\n }\n\n writeToFile(DEBUG_PATHS.detailed(), entry)\n\n switch (level) {\n case LogLevel.FLOW:\n writeToFile(DEBUG_PATHS.flow(), entry)\n break\n case LogLevel.API:\n writeToFile(DEBUG_PATHS.api(), entry)\n break\n case LogLevel.STATE:\n writeToFile(DEBUG_PATHS.state(), entry)\n break\n }\n\n logToTerminal(entry)\n}\n\nexport const debug = {\n flow: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.FLOW, phase, data, requestId),\n\n api: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.API, phase, data, requestId),\n\n state: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.STATE, phase, data, requestId),\n\n info: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.INFO, phase, data, requestId),\n\n warn: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.WARN, phase, data, requestId),\n\n error: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.ERROR, phase, data, requestId),\n\n trace: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.TRACE, phase, data, requestId),\n\n ui: (phase: string, data: any, requestId?: string) =>\n debugLog(LogLevel.STATE, `UI_${phase}`, data, requestId),\n}\n\nexport function startRequest(): RequestContext {\n const ctx = new RequestContext()\n currentRequest = ctx\n activeRequests.set(ctx.id, ctx)\n\n debug.flow('REQUEST_START', {\n requestId: ctx.id,\n activeRequests: activeRequests.size,\n })\n\n return ctx\n}\n\nexport function endRequest(ctx?: RequestContext) {\n const request = ctx || currentRequest\n if (!request) return\n\n debug.flow('REQUEST_END', {\n requestId: request.id,\n totalTime: Date.now() - request.startTime,\n phases: request.getAllPhases(),\n })\n\n activeRequests.delete(request.id)\n if (currentRequest === request) {\n currentRequest = null\n }\n}\n\nexport function getCurrentRequest(): RequestContext | null {\n return currentRequest\n}\n\nexport function markPhase(phase: string, data?: any) {\n if (!currentRequest) return\n\n currentRequest.markPhase(phase)\n debug.flow(`PHASE_${phase.toUpperCase()}`, {\n requestId: currentRequest.id,\n elapsed: currentRequest.getPhaseTime(phase),\n data,\n })\n}\n\nexport function logReminderEvent(\n eventType: string,\n reminderData: any,\n agentId?: string,\n) {\n if (!isDebugMode()) return\n\n debug.info('REMINDER_EVENT_TRIGGERED', {\n eventType,\n agentId: agentId || 'default',\n reminderType: reminderData.type || 'unknown',\n reminderCategory: reminderData.category || 'general',\n reminderPriority: reminderData.priority || 'medium',\n contentLength: reminderData.content ? reminderData.content.length : 0,\n timestamp: Date.now(),\n })\n}\n\nexport function logAPIError(context: {\n model: string\n endpoint: string\n status: number\n error: any\n request?: any\n response?: any\n provider?: string\n}) {\n const errorDir = resolveXdgCachePath(join('logs', 'error', 'api'))\n\n if (!existsSync(errorDir)) {\n try {\n mkdirSync(errorDir, { recursive: true })\n } catch (err) {\n terminalLog('Failed to create error log directory:', err)\n return\n }\n }\n\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-')\n const sanitizedModel = context.model.replace(/[^a-zA-Z0-9-_]/g, '_')\n const filename = `${sanitizedModel}_${timestamp}.log`\n const filepath = join(errorDir, filename)\n\n const fullLogContent = {\n timestamp: new Date().toISOString(),\n sessionId: SESSION_ID,\n requestId: getCurrentRequest()?.id,\n model: context.model,\n provider: context.provider,\n endpoint: context.endpoint,\n status: context.status,\n error: context.error,\n request: context.request,\n response: context.response,\n environment: {\n nodeVersion: process.version,\n platform: process.platform,\n cwd: process.cwd(),\n },\n }\n\n try {\n appendFileSync(filepath, JSON.stringify(fullLogContent, null, 2) + '\\n')\n appendFileSync(filepath, '='.repeat(80) + '\\n\\n')\n } catch (err) {\n terminalLog('Failed to write API error log:', err)\n }\n\n if (isDebugMode()) {\n debug.error('API_ERROR', {\n model: context.model,\n status: context.status,\n error:\n typeof context.error === 'string'\n ? context.error\n : context.error?.message || 'Unknown error',\n endpoint: context.endpoint,\n logFile: filename,\n })\n }\n\n if (isVerboseMode() || isDebugVerboseMode()) {\n terminalLog()\n terminalLog(chalk.red('\u2501'.repeat(60)))\n terminalLog(chalk.red.bold('\u26A0\uFE0F API Error'))\n terminalLog(chalk.red('\u2501'.repeat(60)))\n\n terminalLog(chalk.white(' Model: ') + chalk.yellow(context.model))\n terminalLog(chalk.white(' Status: ') + chalk.red(context.status))\n\n let errorMessage = 'Unknown error'\n if (typeof context.error === 'string') {\n errorMessage = context.error\n } else if (context.error?.message) {\n errorMessage = context.error.message\n } else if (context.error?.error?.message) {\n errorMessage = context.error.error.message\n }\n\n terminalLog(chalk.white(' Error: ') + chalk.red(errorMessage))\n\n if (context.response) {\n terminalLog()\n terminalLog(chalk.gray(' Response:'))\n const responseStr =\n typeof context.response === 'string'\n ? context.response\n : JSON.stringify(context.response, null, 2)\n\n responseStr.split('\\n').forEach(line => {\n terminalLog(chalk.gray(' ' + line))\n })\n }\n\n terminalLog()\n terminalLog(chalk.dim(` \uD83D\uDCC1 Full log: ${filepath}`))\n terminalLog(chalk.red('\u2501'.repeat(60)))\n terminalLog()\n }\n}\n\nexport function logLLMInteraction(context: {\n systemPrompt: string\n messages: any[]\n response: any\n usage?: { inputTokens: number; outputTokens: number }\n timing: { start: number; end: number }\n apiFormat?: 'anthropic' | 'openai'\n}) {\n if (!isDebugMode()) return\n\n const duration = context.timing.end - context.timing.start\n\n terminalLog('\\n' + chalk.blue('\uD83E\uDDE0 LLM CALL DEBUG'))\n terminalLog(chalk.gray('\u2501'.repeat(60)))\n\n terminalLog(chalk.yellow('\uD83D\uDCCA Context Overview:'))\n terminalLog(` Messages Count: ${context.messages.length}`)\n terminalLog(` System Prompt Length: ${context.systemPrompt.length} chars`)\n terminalLog(` Duration: ${duration.toFixed(0)}ms`)\n\n if (context.usage) {\n terminalLog(\n ` Token Usage: ${context.usage.inputTokens} \u2192 ${context.usage.outputTokens}`,\n )\n }\n\n const apiLabel = context.apiFormat\n ? ` (${context.apiFormat.toUpperCase()})`\n : ''\n terminalLog(chalk.cyan(`\\n\uD83D\uDCAC Real API Messages${apiLabel} (last 10):`))\n\n const recentMessages = context.messages.slice(-10)\n recentMessages.forEach((msg, index) => {\n const globalIndex = context.messages.length - recentMessages.length + index\n const roleColor =\n msg.role === 'user'\n ? 'green'\n : msg.role === 'assistant'\n ? 'blue'\n : msg.role === 'system'\n ? 'yellow'\n : 'gray'\n\n let content = ''\n let isReminder = false\n\n if (typeof msg.content === 'string') {\n if (msg.content.includes('<system-reminder>')) {\n isReminder = true\n const reminderContent = msg.content\n .replace(/<\\/?system-reminder>/g, '')\n .trim()\n content = `\uD83D\uDD14 ${reminderContent.length > 800 ? reminderContent.substring(0, 800) + '...' : reminderContent}`\n } else {\n const maxLength =\n msg.role === 'user' ? 1000 : msg.role === 'system' ? 1200 : 800\n content =\n msg.content.length > maxLength\n ? msg.content.substring(0, maxLength) + '...'\n : msg.content\n }\n } else if (Array.isArray(msg.content)) {\n const textBlocks = msg.content.filter(\n (block: any) => block.type === 'text',\n )\n const toolBlocks = msg.content.filter(\n (block: any) => block.type === 'tool_use',\n )\n if (textBlocks.length > 0) {\n const text = textBlocks[0].text || ''\n const maxLength = msg.role === 'assistant' ? 1000 : 800\n content =\n text.length > maxLength ? text.substring(0, maxLength) + '...' : text\n }\n if (toolBlocks.length > 0) {\n content += ` [+ ${toolBlocks.length} tool calls]`\n }\n if (textBlocks.length === 0 && toolBlocks.length === 0) {\n content = `[${msg.content.length} blocks: ${msg.content.map(b => b.type || 'unknown').join(', ')}]`\n }\n } else {\n content = '[complex_content]'\n }\n\n if (isReminder) {\n terminalLog(\n ` [${globalIndex}] ${chalk.magenta('\uD83D\uDD14 REMINDER')}: ${chalk.dim(content)}`,\n )\n } else {\n const roleIcon =\n msg.role === 'user'\n ? '\uD83D\uDC64'\n : msg.role === 'assistant'\n ? '\uD83E\uDD16'\n : msg.role === 'system'\n ? '\u2699\uFE0F'\n : '\uD83D\uDCC4'\n terminalLog(\n ` [${globalIndex}] ${(chalk as any)[roleColor](roleIcon + ' ' + msg.role.toUpperCase())}: ${content}`,\n )\n }\n\n if (msg.role === 'assistant' && Array.isArray(msg.content)) {\n const toolCalls = msg.content.filter(\n (block: any) => block.type === 'tool_use',\n )\n if (toolCalls.length > 0) {\n terminalLog(\n chalk.cyan(\n ` \uD83D\uDD27 \u2192 Tool calls (${toolCalls.length}): ${toolCalls.map((t: any) => t.name).join(', ')}`,\n ),\n )\n toolCalls.forEach((tool: any, idx: number) => {\n const inputStr = JSON.stringify(tool.input || {})\n const maxLength = 200\n const displayInput =\n inputStr.length > maxLength\n ? inputStr.substring(0, maxLength) + '...'\n : inputStr\n terminalLog(\n chalk.dim(` [${idx}] ${tool.name}: ${displayInput}`),\n )\n })\n }\n }\n if (msg.tool_calls && msg.tool_calls.length > 0) {\n terminalLog(\n chalk.cyan(\n ` \uD83D\uDD27 \u2192 Tool calls (${msg.tool_calls.length}): ${msg.tool_calls.map((t: any) => t.function.name).join(', ')}`,\n ),\n )\n msg.tool_calls.forEach((tool: any, idx: number) => {\n const inputStr = tool.function.arguments || '{}'\n const maxLength = 200\n const displayInput =\n inputStr.length > maxLength\n ? inputStr.substring(0, maxLength) + '...'\n : inputStr\n terminalLog(\n chalk.dim(` [${idx}] ${tool.function.name}: ${displayInput}`),\n )\n })\n }\n })\n\n terminalLog(chalk.magenta('\\n\uD83E\uDD16 LLM Response:'))\n\n let responseContent = ''\n let toolCalls: any[] = []\n\n if (Array.isArray(context.response.content)) {\n const textBlocks = context.response.content.filter(\n (block: any) => block.type === 'text',\n )\n responseContent = textBlocks.length > 0 ? textBlocks[0].text || '' : ''\n toolCalls = context.response.content.filter(\n (block: any) => block.type === 'tool_use',\n )\n } else if (typeof context.response.content === 'string') {\n responseContent = context.response.content\n toolCalls = context.response.tool_calls || context.response.toolCalls || []\n } else if (context.response.message?.content) {\n if (Array.isArray(context.response.message.content)) {\n const textBlocks = context.response.message.content.filter(\n (block: any) => block.type === 'text',\n )\n responseContent = textBlocks.length > 0 ? textBlocks[0].text || '' : ''\n toolCalls = context.response.message.content.filter(\n (block: any) => block.type === 'tool_use',\n )\n } else if (typeof context.response.message.content === 'string') {\n responseContent = context.response.message.content\n }\n } else {\n responseContent = JSON.stringify(\n context.response.content || context.response || '',\n )\n }\n\n const maxResponseLength = 1000\n const displayContent =\n responseContent.length > maxResponseLength\n ? responseContent.substring(0, maxResponseLength) + '...'\n : responseContent\n terminalLog(` Content: ${displayContent}`)\n\n if (toolCalls.length > 0) {\n const toolNames = toolCalls.map(\n (t: any) => t.name || t.function?.name || 'unknown',\n )\n terminalLog(\n chalk.cyan(\n ` \uD83D\uDD27 Tool Calls (${toolCalls.length}): ${toolNames.join(', ')}`,\n ),\n )\n toolCalls.forEach((tool: any, index: number) => {\n const toolName = tool.name || tool.function?.name || 'unknown'\n const toolInput = tool.input || tool.function?.arguments || '{}'\n const inputStr =\n typeof toolInput === 'string' ? toolInput : JSON.stringify(toolInput)\n const maxToolInputLength = 300\n const displayInput =\n inputStr.length > maxToolInputLength\n ? inputStr.substring(0, maxToolInputLength) + '...'\n : inputStr\n terminalLog(chalk.dim(` [${index}] ${toolName}: ${displayInput}`))\n })\n }\n\n terminalLog(\n ` Stop Reason: ${context.response.stop_reason || context.response.finish_reason || 'unknown'}`,\n )\n terminalLog(chalk.gray('\u2501'.repeat(60)))\n}\n\nexport function logSystemPromptConstruction(construction: {\n basePrompt: string\n pybContext?: string\n reminders: string[]\n finalPrompt: string\n}) {\n if (!isDebugMode()) return\n\n terminalLog('\\n' + chalk.yellow('\uD83D\uDCDD SYSTEM PROMPT CONSTRUCTION'))\n terminalLog(` Base Prompt: ${construction.basePrompt.length} chars`)\n\n if (construction.pybContext) {\n terminalLog(` + Pyb Context: ${construction.pybContext.length} chars`)\n }\n\n if (construction.reminders.length > 0) {\n terminalLog(\n ` + Dynamic Reminders: ${construction.reminders.length} items`,\n )\n construction.reminders.forEach((reminder, index) => {\n terminalLog(chalk.dim(` [${index}] ${reminder.substring(0, 80)}...`))\n })\n }\n\n terminalLog(` = Final Length: ${construction.finalPrompt.length} chars`)\n}\n\nexport function logContextCompression(compression: {\n beforeMessages: number\n afterMessages: number\n trigger: string\n preservedFiles: string[]\n compressionRatio: number\n}) {\n if (!isDebugMode()) return\n\n terminalLog('\\n' + chalk.red('\uD83D\uDDDC\uFE0F CONTEXT COMPRESSION'))\n terminalLog(` Trigger: ${compression.trigger}`)\n terminalLog(\n ` Messages: ${compression.beforeMessages} \u2192 ${compression.afterMessages}`,\n )\n terminalLog(\n ` Compression Ratio: ${(compression.compressionRatio * 100).toFixed(1)}%`,\n )\n\n if (compression.preservedFiles.length > 0) {\n terminalLog(` Preserved Files: ${compression.preservedFiles.join(', ')}`)\n }\n}\n\nexport function logUserFriendly(type: string, data: any, requestId?: string) {\n if (!isDebugMode()) return\n\n const timestamp = new Date().toLocaleTimeString()\n let message = ''\n let color = chalk.gray\n let icon = '\u2022'\n\n switch (type) {\n case 'SESSION_START':\n icon = '\uD83D\uDE80'\n color = chalk.green\n message = `Session started with ${data.model || 'default model'}`\n break\n case 'QUERY_START':\n icon = '\uD83D\uDCAD'\n color = chalk.blue\n message = `Processing query: \"${data.query?.substring(0, 50)}${data.query?.length > 50 ? '...' : ''}\"`\n break\n case 'QUERY_PROGRESS':\n icon = '\u23F3'\n color = chalk.yellow\n message = `${data.phase} (${data.elapsed}ms)`\n break\n case 'QUERY_COMPLETE':\n icon = '\u2705'\n color = chalk.green\n message = `Query completed in ${data.duration}ms - Cost: $${data.cost} - ${data.tokens} tokens`\n break\n case 'TOOL_EXECUTION':\n icon = '\uD83D\uDD27'\n color = chalk.cyan\n message = `${data.toolName}: ${data.action} ${data.target ? '\u2192 ' + data.target : ''}`\n break\n case 'ERROR_OCCURRED':\n icon = '\u274C'\n color = chalk.red\n message = `${data.error} ${data.context ? '(' + data.context + ')' : ''}`\n break\n case 'PERFORMANCE_SUMMARY':\n icon = '\uD83D\uDCCA'\n color = chalk.magenta\n message = `Session: ${data.queries} queries, $${data.totalCost}, ${data.avgResponseTime}ms avg`\n break\n default:\n message = JSON.stringify(data)\n }\n\n const reqId = requestId ? chalk.dim(`[${requestId.slice(0, 8)}]`) : ''\n terminalLog(`${color(`[${timestamp}]`)} ${icon} ${color(message)} ${reqId}`)\n}\n\nexport function initDebugLogger() {\n if (!isDebugMode()) return\n\n debug.info('DEBUG_LOGGER_INIT', {\n startupTimestamp: STARTUP_TIMESTAMP,\n sessionId: SESSION_ID,\n debugPaths: {\n detailed: DEBUG_PATHS.detailed(),\n flow: DEBUG_PATHS.flow(),\n api: DEBUG_PATHS.api(),\n state: DEBUG_PATHS.state(),\n },\n })\n\n const terminalLevels = isDebugVerboseMode()\n ? Array.from(DEBUG_VERBOSE_TERMINAL_LOG_LEVELS).join(', ')\n : Array.from(TERMINAL_LOG_LEVELS).join(', ')\n\n terminalLog(\n chalk.dim(`[DEBUG] Terminal output filtered to: ${terminalLevels}`),\n )\n terminalLog(\n chalk.dim(`[DEBUG] Complete logs saved to: ${DEBUG_PATHS.base()}`),\n )\n if (!isDebugVerboseMode()) {\n terminalLog(\n chalk.dim(\n `[DEBUG] Use --debug-verbose for detailed system logs (FLOW, API, STATE)`,\n ),\n )\n }\n}\n\ninterface ErrorDiagnosis {\n errorType: string\n category:\n | 'NETWORK'\n | 'API'\n | 'PERMISSION'\n | 'CONFIG'\n | 'SYSTEM'\n | 'USER_INPUT'\n severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'\n description: string\n suggestions: string[]\n debugSteps: string[]\n relatedLogs?: string[]\n}\n\nexport function diagnoseError(error: any, context?: any): ErrorDiagnosis {\n const errorMessage = error instanceof Error ? error.message : String(error)\n const errorStack = error instanceof Error ? error.stack : undefined\n\n if (\n errorMessage.includes('aborted') ||\n errorMessage.includes('AbortController')\n ) {\n return {\n errorType: 'REQUEST_ABORTED',\n category: 'SYSTEM',\n severity: 'MEDIUM',\n description:\n 'Request was aborted, often due to user cancellation or timeout',\n suggestions: [\n '\u68C0\u67E5\u662F\u5426\u6309\u4E0B\u4E86 ESC \u952E\u53D6\u6D88\u8BF7\u6C42',\n '\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u7A33\u5B9A',\n '\u9A8C\u8BC1 AbortController \u72B6\u6001: isActive \u548C signal.aborted \u5E94\u8BE5\u4E00\u81F4',\n '\u67E5\u770B\u662F\u5426\u6709\u91CD\u590D\u7684\u8BF7\u6C42\u5BFC\u81F4\u51B2\u7A81',\n ],\n debugSteps: [\n '\u4F7F\u7528 --debug-verbose \u6A21\u5F0F\u67E5\u770B\u8BE6\u7EC6\u7684\u8BF7\u6C42\u6D41\u7A0B',\n '\u68C0\u67E5 debug \u65E5\u5FD7\u4E2D\u7684 BINARY_FEEDBACK_* \u4E8B\u4EF6',\n '\u9A8C\u8BC1 REQUEST_START \u548C REQUEST_END \u65E5\u5FD7\u914D\u5BF9',\n '\u67E5\u770B QUERY_ABORTED \u4E8B\u4EF6\u7684\u89E6\u53D1\u539F\u56E0',\n ],\n }\n }\n\n if (\n errorMessage.includes('api-key') ||\n errorMessage.includes('authentication') ||\n errorMessage.includes('401')\n ) {\n return {\n errorType: 'API_AUTHENTICATION',\n category: 'API',\n severity: 'HIGH',\n description: 'API authentication failed - invalid or missing API key',\n suggestions: [\n '\u8FD0\u884C /login \u91CD\u65B0\u8BBE\u7F6E API \u5BC6\u94A5',\n '\u68C0\u67E5 ~/.pyb/ \u914D\u7F6E\u6587\u4EF6\u4E2D\u7684 API \u5BC6\u94A5',\n '\u9A8C\u8BC1 API \u5BC6\u94A5\u662F\u5426\u5DF2\u8FC7\u671F\u6216\u88AB\u64A4\u9500',\n '\u786E\u8BA4\u4F7F\u7528\u7684 provider \u8BBE\u7F6E\u6B63\u786E (anthropic/opendev/bigdream)',\n ],\n debugSteps: [\n '\u68C0\u67E5 CONFIG_LOAD \u65E5\u5FD7\u4E2D\u7684 provider \u548C API \u5BC6\u94A5\u72B6\u6001',\n '\u8FD0\u884C pyb doctor \u68C0\u67E5\u7CFB\u7EDF\u5065\u5EB7\u72B6\u6001',\n '\u67E5\u770B API_ERROR \u65E5\u5FD7\u4E86\u89E3\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F',\n '\u4F7F\u7528 pyb config \u547D\u4EE4\u67E5\u770B\u5F53\u524D\u914D\u7F6E',\n ],\n }\n }\n\n if (\n errorMessage.includes('ECONNREFUSED') ||\n errorMessage.includes('ENOTFOUND') ||\n errorMessage.includes('timeout')\n ) {\n return {\n errorType: 'NETWORK_CONNECTION',\n category: 'NETWORK',\n severity: 'HIGH',\n description: 'Network connection failed - unable to reach API endpoint',\n suggestions: [\n '\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38',\n '\u786E\u8BA4\u9632\u706B\u5899\u6CA1\u6709\u963B\u6B62\u76F8\u5173\u7AEF\u53E3',\n '\u68C0\u67E5 proxy \u8BBE\u7F6E\u662F\u5426\u6B63\u786E',\n '\u5C1D\u8BD5\u5207\u6362\u5230\u4E0D\u540C\u7684\u7F51\u7EDC\u73AF\u5883',\n '\u9A8C\u8BC1 baseURL \u914D\u7F6E\u662F\u5426\u6B63\u786E',\n ],\n debugSteps: [\n '\u68C0\u67E5 API_REQUEST_START \u548C\u76F8\u5173\u7F51\u7EDC\u65E5\u5FD7',\n '\u67E5\u770B LLM_REQUEST_ERROR \u4E2D\u7684\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F',\n '\u4F7F\u7528 ping \u6216 curl \u6D4B\u8BD5 API \u7AEF\u70B9\u8FDE\u901A\u6027',\n '\u68C0\u67E5\u4F01\u4E1A\u7F51\u7EDC\u662F\u5426\u9700\u8981\u4EE3\u7406\u8BBE\u7F6E',\n ],\n }\n }\n\n if (\n errorMessage.includes('permission') ||\n errorMessage.includes('EACCES') ||\n errorMessage.includes('denied')\n ) {\n return {\n errorType: 'PERMISSION_DENIED',\n category: 'PERMISSION',\n severity: 'MEDIUM',\n description: 'Permission denied - insufficient access rights',\n suggestions: [\n '\u68C0\u67E5\u6587\u4EF6\u548C\u76EE\u5F55\u7684\u8BFB\u5199\u6743\u9650',\n '\u786E\u8BA4\u5F53\u524D\u7528\u6237\u6709\u8DB3\u591F\u7684\u7CFB\u7EDF\u6743\u9650',\n '\u67E5\u770B\u662F\u5426\u9700\u8981\u7BA1\u7406\u5458\u6743\u9650\u8FD0\u884C',\n '\u68C0\u67E5\u5DE5\u5177\u6743\u9650\u8BBE\u7F6E\u662F\u5426\u6B63\u786E\u914D\u7F6E',\n ],\n debugSteps: [\n '\u67E5\u770B PERMISSION_* \u65E5\u5FD7\u4E86\u89E3\u6743\u9650\u68C0\u67E5\u8FC7\u7A0B',\n '\u68C0\u67E5\u6587\u4EF6\u7CFB\u7EDF\u6743\u9650: ls -la',\n '\u9A8C\u8BC1\u5DE5\u5177\u5BA1\u6279\u72B6\u6001',\n '\u67E5\u770B TOOL_* \u76F8\u5173\u7684\u8C03\u8BD5\u65E5\u5FD7',\n ],\n }\n }\n\n if (\n errorMessage.includes('substring is not a function') ||\n errorMessage.includes('content')\n ) {\n return {\n errorType: 'RESPONSE_FORMAT',\n category: 'API',\n severity: 'MEDIUM',\n description: 'LLM response format mismatch between different providers',\n suggestions: [\n '\u68C0\u67E5\u5F53\u524D\u4F7F\u7528\u7684 provider \u662F\u5426\u4E0E\u671F\u671B\u4E00\u81F4',\n '\u9A8C\u8BC1\u54CD\u5E94\u683C\u5F0F\u5904\u7406\u903B\u8F91',\n '\u786E\u8BA4\u4E0D\u540C provider \u7684\u54CD\u5E94\u683C\u5F0F\u5DEE\u5F02',\n '\u68C0\u67E5\u662F\u5426\u9700\u8981\u66F4\u65B0\u54CD\u5E94\u89E3\u6790\u4EE3\u7801',\n ],\n debugSteps: [\n '\u67E5\u770B LLM_CALL_DEBUG \u4E2D\u7684\u54CD\u5E94\u683C\u5F0F',\n '\u68C0\u67E5 provider \u914D\u7F6E\u548C\u5B9E\u9645\u4F7F\u7528\u7684 API',\n '\u5BF9\u6BD4 Anthropic \u548C OpenAI \u54CD\u5E94\u683C\u5F0F\u5DEE\u5F02',\n '\u9A8C\u8BC1 logLLMInteraction \u51FD\u6570\u7684\u683C\u5F0F\u5904\u7406',\n ],\n }\n }\n\n if (\n errorMessage.includes('too long') ||\n errorMessage.includes('context') ||\n errorMessage.includes('token')\n ) {\n return {\n errorType: 'CONTEXT_OVERFLOW',\n category: 'SYSTEM',\n severity: 'MEDIUM',\n description: 'Context window exceeded - conversation too long',\n suggestions: [\n '\u8FD0\u884C /compact \u624B\u52A8\u538B\u7F29\u5BF9\u8BDD\u5386\u53F2',\n '\u68C0\u67E5\u81EA\u52A8\u538B\u7F29\u8BBE\u7F6E\u662F\u5426\u6B63\u786E\u914D\u7F6E',\n '\u51CF\u5C11\u5355\u6B21\u8F93\u5165\u7684\u5185\u5BB9\u957F\u5EA6',\n '\u6E05\u7406\u4E0D\u5FC5\u8981\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F',\n ],\n debugSteps: [\n '\u67E5\u770B AUTO_COMPACT_* \u65E5\u5FD7\u68C0\u67E5\u538B\u7F29\u89E6\u53D1',\n '\u68C0\u67E5 token \u4F7F\u7528\u91CF\u548C\u9608\u503C',\n '\u67E5\u770B CONTEXT_COMPRESSION \u76F8\u5173\u65E5\u5FD7',\n '\u9A8C\u8BC1\u6A21\u578B\u7684\u6700\u5927 token \u9650\u5236',\n ],\n }\n }\n\n if (\n errorMessage.includes('config') ||\n (errorMessage.includes('undefined') && context?.configRelated)\n ) {\n return {\n errorType: 'CONFIGURATION',\n category: 'CONFIG',\n severity: 'MEDIUM',\n description: 'Configuration error - missing or invalid settings',\n suggestions: [\n '\u8FD0\u884C pyb config \u68C0\u67E5\u914D\u7F6E\u8BBE\u7F6E',\n '\u5220\u9664\u635F\u574F\u7684\u914D\u7F6E\u6587\u4EF6\u91CD\u65B0\u521D\u59CB\u5316',\n '\u68C0\u67E5 JSON \u914D\u7F6E\u6587\u4EF6\u8BED\u6CD5\u662F\u5426\u6B63\u786E',\n '\u9A8C\u8BC1\u73AF\u5883\u53D8\u91CF\u8BBE\u7F6E',\n ],\n debugSteps: [\n '\u67E5\u770B CONFIG_LOAD \u548C CONFIG_SAVE \u65E5\u5FD7',\n '\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84\u548C\u6743\u9650',\n '\u9A8C\u8BC1 JSON \u683C\u5F0F: cat ~/.pyb/config.json | jq',\n '\u67E5\u770B\u914D\u7F6E\u7F13\u5B58\u76F8\u5173\u7684\u8C03\u8BD5\u4FE1\u606F',\n ],\n }\n }\n\n return {\n errorType: 'UNKNOWN',\n category: 'SYSTEM',\n severity: 'MEDIUM',\n description: `Unexpected error: ${errorMessage}`,\n suggestions: [\n '\u91CD\u65B0\u542F\u52A8\u5E94\u7528\u7A0B\u5E8F',\n '\u68C0\u67E5\u7CFB\u7EDF\u8D44\u6E90\u662F\u5426\u5145\u8DB3',\n '\u67E5\u770B\u5B8C\u6574\u7684\u9519\u8BEF\u65E5\u5FD7\u83B7\u53D6\u66F4\u591A\u4FE1\u606F',\n '\u5982\u679C\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u62A5\u544A\u6B64\u9519\u8BEF',\n ],\n debugSteps: [\n '\u4F7F\u7528 --debug-verbose \u83B7\u53D6\u8BE6\u7EC6\u65E5\u5FD7',\n '\u68C0\u67E5 error.log \u4E2D\u7684\u5B8C\u6574\u9519\u8BEF\u4FE1\u606F',\n '\u67E5\u770B\u7CFB\u7EDF\u8D44\u6E90\u4F7F\u7528\u60C5\u51B5',\n '\u6536\u96C6\u91CD\u73B0\u6B65\u9AA4\u548C\u73AF\u5883\u4FE1\u606F',\n ],\n relatedLogs: errorStack ? [errorStack] : undefined,\n }\n}\n\nexport function logErrorWithDiagnosis(\n error: any,\n context?: any,\n requestId?: string,\n) {\n if (!isDebugMode()) return\n\n const diagnosis = diagnoseError(error, context)\n const errorMessage = error instanceof Error ? error.message : String(error)\n\n debug.error(\n 'ERROR_OCCURRED',\n {\n error: errorMessage,\n errorType: diagnosis.errorType,\n category: diagnosis.category,\n severity: diagnosis.severity,\n context,\n },\n requestId,\n )\n\n terminalLog('\\n' + chalk.red('\uD83D\uDEA8 ERROR DIAGNOSIS'))\n terminalLog(chalk.gray('\u2501'.repeat(60)))\n\n terminalLog(chalk.red(`\u274C ${diagnosis.errorType}`))\n terminalLog(\n chalk.dim(\n `Category: ${diagnosis.category} | Severity: ${diagnosis.severity}`,\n ),\n )\n terminalLog(`\\n${diagnosis.description}`)\n\n terminalLog(chalk.yellow('\\n\uD83D\uDCA1 Recovery Suggestions:'))\n diagnosis.suggestions.forEach((suggestion, index) => {\n terminalLog(` ${index + 1}. ${suggestion}`)\n })\n\n terminalLog(chalk.cyan('\\n\uD83D\uDD0D Debug Steps:'))\n diagnosis.debugSteps.forEach((step, index) => {\n terminalLog(` ${index + 1}. ${step}`)\n })\n\n if (diagnosis.relatedLogs && diagnosis.relatedLogs.length > 0) {\n terminalLog(chalk.magenta('\\n\uD83D\uDCCB Related Information:'))\n diagnosis.relatedLogs.forEach((log, index) => {\n const truncatedLog =\n log.length > 200 ? log.substring(0, 200) + '...' : log\n terminalLog(chalk.dim(` ${truncatedLog}`))\n })\n }\n\n const debugPath = DEBUG_PATHS.base()\n terminalLog(chalk.gray(`\\n\uD83D\uDCC1 Complete logs: ${debugPath}`))\n terminalLog(chalk.gray('\u2501'.repeat(60)))\n}\nexport function getDebugInfo() {\n return {\n isDebugMode: isDebugMode(),\n isVerboseMode: isVerboseMode(),\n isDebugVerboseMode: isDebugVerboseMode(),\n startupTimestamp: STARTUP_TIMESTAMP,\n sessionId: SESSION_ID,\n currentRequest: currentRequest?.id,\n activeRequests: Array.from(activeRequests.keys()),\n terminalLogLevels: isDebugVerboseMode()\n ? Array.from(DEBUG_VERBOSE_TERMINAL_LOG_LEVELS)\n : Array.from(TERMINAL_LOG_LEVELS),\n debugPaths: {\n detailed: DEBUG_PATHS.detailed(),\n flow: DEBUG_PATHS.flow(),\n api: DEBUG_PATHS.api(),\n state: DEBUG_PATHS.state(),\n },\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA,SAAS,YAAY,WAAW,sBAAsB;AACtD,SAAS,YAAY;AAErB,SAAS,cAAc;AACvB,OAAO,WAAW;AAiBlB,IAAM,cAAc,MAClB,QAAQ,KAAK,SAAS,iBAAiB,KACvC,QAAQ,KAAK,SAAS,aAAa,KACnC,QAAQ,KAAK;AAAA,EACX,SAAO,QAAQ,aAAa,QAAQ,QAAQ,IAAI,WAAW,UAAU;AACvE;AACF,IAAM,gBAAgB,MAAM,QAAQ,KAAK,SAAS,WAAW;AAC7D,IAAM,qBAAqB,MAAM,QAAQ,KAAK,SAAS,iBAAiB;AAExE,IAAM,sBAAsB,oBAAI,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,oCAAoC,oBAAI,IAAI;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAYD,IAAM,qBAAoB,oBAAI,KAAK,GAAE,YAAY,EAAE,QAAQ,SAAS,GAAG;AACvE,IAAM,qBAAqB,KAAK,IAAI;AAEpC,SAAS,cAAc,KAAq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CAAC;AACtD,cAAU,YAAY,QAAQ,CAAC,KAAK,UAAU;AAC5C,YAAM,eACJ,IAAI,SAAS,MAAM,IAAI,UAAU,GAAG,GAAG,IAAI,QAAQ;AACrD,kBAAY,MAAM,IAAI,MAAM,YAAY,EAAE,CAAC;AAAA,IAC7C,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,YAAY,KAAK;AACnC,cAAY,MAAM,KAAK;AAAA,2BAAuB,SAAS,EAAE,CAAC;AAC1D,cAAY,MAAM,KAAK,SAAI,OAAO,EAAE,CAAC,CAAC;AACxC;",
|
|
6
|
+
"names": ["toolCalls"]
|
|
7
|
+
}
|
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
} from "./chunk-RQVLBMP7.js";
|
|
6
6
|
import {
|
|
7
7
|
debug
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3RXA6IWG.js";
|
|
9
9
|
import {
|
|
10
10
|
getCwd,
|
|
11
11
|
getGlobalConfigFilePath,
|
|
12
|
+
getLegacyGlobalConfigFilePath,
|
|
12
13
|
logError
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KUIDN7FP.js";
|
|
14
15
|
|
|
15
16
|
// src/core/config/schema.ts
|
|
16
17
|
function isAutoUpdaterStatus(value) {
|
|
@@ -92,8 +93,14 @@ var DEFAULT_GLOBAL_CONFIG = {
|
|
|
92
93
|
};
|
|
93
94
|
|
|
94
95
|
// src/core/config/loader.ts
|
|
95
|
-
import {
|
|
96
|
-
|
|
96
|
+
import {
|
|
97
|
+
copyFileSync,
|
|
98
|
+
existsSync,
|
|
99
|
+
mkdirSync,
|
|
100
|
+
readFileSync,
|
|
101
|
+
writeFileSync
|
|
102
|
+
} from "fs";
|
|
103
|
+
import { dirname, join, posix, resolve, win32 } from "path";
|
|
97
104
|
import { cloneDeep, memoize, pick } from "lodash-es";
|
|
98
105
|
import { homedir as homedir2 } from "os";
|
|
99
106
|
import { randomBytes } from "crypto";
|
|
@@ -195,9 +202,23 @@ function findMatchingProjectKey(projects, absolutePath) {
|
|
|
195
202
|
}
|
|
196
203
|
return void 0;
|
|
197
204
|
}
|
|
205
|
+
function resolveGlobalConfigReadPath() {
|
|
206
|
+
const primaryPath = getGlobalConfigFilePath();
|
|
207
|
+
const legacyPath = getLegacyGlobalConfigFilePath();
|
|
208
|
+
if (primaryPath === legacyPath) return primaryPath;
|
|
209
|
+
if (existsSync(primaryPath)) return primaryPath;
|
|
210
|
+
if (!existsSync(legacyPath)) return primaryPath;
|
|
211
|
+
try {
|
|
212
|
+
mkdirSync(dirname(primaryPath), { recursive: true });
|
|
213
|
+
copyFileSync(legacyPath, primaryPath);
|
|
214
|
+
return primaryPath;
|
|
215
|
+
} catch {
|
|
216
|
+
return legacyPath;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
198
219
|
function checkHasTrustDialogAccepted() {
|
|
199
220
|
let currentPath = getCwd();
|
|
200
|
-
const config = getConfig(
|
|
221
|
+
const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG);
|
|
201
222
|
while (true) {
|
|
202
223
|
const projectKey = findMatchingProjectKey(config.projects, currentPath);
|
|
203
224
|
const projectConfig = projectKey ? config.projects?.[projectKey] : void 0;
|
|
@@ -226,11 +247,12 @@ function saveGlobalConfig(config) {
|
|
|
226
247
|
}
|
|
227
248
|
return;
|
|
228
249
|
}
|
|
250
|
+
const readPath = resolveGlobalConfigReadPath();
|
|
229
251
|
saveConfig(
|
|
230
252
|
getGlobalConfigFilePath(),
|
|
231
253
|
{
|
|
232
254
|
...config,
|
|
233
|
-
projects: getConfig(
|
|
255
|
+
projects: getConfig(readPath, DEFAULT_GLOBAL_CONFIG).projects
|
|
234
256
|
},
|
|
235
257
|
DEFAULT_GLOBAL_CONFIG
|
|
236
258
|
);
|
|
@@ -239,7 +261,7 @@ function getGlobalConfig() {
|
|
|
239
261
|
if (process.env.NODE_ENV === "test") {
|
|
240
262
|
return TEST_GLOBAL_CONFIG_FOR_TESTING;
|
|
241
263
|
}
|
|
242
|
-
const config = getConfig(
|
|
264
|
+
const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG);
|
|
243
265
|
return migrateModelProfilesRemoveId(config);
|
|
244
266
|
}
|
|
245
267
|
function normalizeApiKeyForConfig(apiKey) {
|
|
@@ -262,6 +284,10 @@ function saveConfig(file, config, defaultConfig) {
|
|
|
262
284
|
)
|
|
263
285
|
);
|
|
264
286
|
try {
|
|
287
|
+
const dir = dirname(file);
|
|
288
|
+
if (!existsSync(dir)) {
|
|
289
|
+
mkdirSync(dir, { recursive: true });
|
|
290
|
+
}
|
|
265
291
|
writeFileSync(file, JSON.stringify(filteredConfig, null, 2), "utf-8");
|
|
266
292
|
} catch (error) {
|
|
267
293
|
const err = error;
|
|
@@ -279,7 +305,7 @@ var configReadingAllowed = false;
|
|
|
279
305
|
function enableConfigs() {
|
|
280
306
|
configReadingAllowed = true;
|
|
281
307
|
getConfig(
|
|
282
|
-
|
|
308
|
+
resolveGlobalConfigReadPath(),
|
|
283
309
|
DEFAULT_GLOBAL_CONFIG,
|
|
284
310
|
true
|
|
285
311
|
);
|
|
@@ -354,7 +380,7 @@ function getCurrentProjectConfig() {
|
|
|
354
380
|
return TEST_PROJECT_CONFIG_FOR_TESTING;
|
|
355
381
|
}
|
|
356
382
|
const absolutePath = resolve(getCwd());
|
|
357
|
-
const config = getConfig(
|
|
383
|
+
const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG);
|
|
358
384
|
if (!config.projects) {
|
|
359
385
|
return defaultConfigForProject(absolutePath);
|
|
360
386
|
}
|
|
@@ -380,7 +406,7 @@ function saveCurrentProjectConfig(projectConfig) {
|
|
|
380
406
|
}
|
|
381
407
|
return;
|
|
382
408
|
}
|
|
383
|
-
const config = getConfig(
|
|
409
|
+
const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG);
|
|
384
410
|
const resolvedCwd = resolve(getCwd());
|
|
385
411
|
const existingKey = findMatchingProjectKey(config.projects, resolvedCwd);
|
|
386
412
|
const storageKey = existingKey ?? resolvedCwd;
|
|
@@ -662,7 +688,7 @@ function setModelPointer(pointer, modelName) {
|
|
|
662
688
|
}
|
|
663
689
|
};
|
|
664
690
|
saveGlobalConfig(updatedConfig);
|
|
665
|
-
import("./model-
|
|
691
|
+
import("./model-VGKT6DJE.js").then(({ reloadModelManager }) => {
|
|
666
692
|
reloadModelManager();
|
|
667
693
|
});
|
|
668
694
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/config/schema.ts", "../src/core/config/defaults.ts", "../src/core/config/loader.ts", "../src/utils/text/json.ts", "../src/core/config/migrations.ts", "../src/core/config/validator.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ThemeNames } from '@utils/theme'\n\nexport type McpStdioServerConfig = {\n type?: 'stdio'\n command: string\n args: string[]\n env?: Record<string, string>\n}\n\nexport type McpSSEServerConfig = {\n type: 'sse'\n url: string\n headers?: Record<string, string>\n headersHelper?: string\n}\n\nexport type McpHttpServerConfig = {\n type: 'http'\n url: string\n headers?: Record<string, string>\n headersHelper?: string\n}\n\nexport type McpSSEIdeServerConfig = {\n type: 'sse-ide'\n url: string\n ideName: string\n ideRunningInWindows?: boolean\n headers?: Record<string, string>\n headersHelper?: string\n}\n\nexport type McpWsServerConfig = {\n type: 'ws'\n url: string\n}\n\nexport type McpWsIdeServerConfig = {\n type: 'ws-ide'\n url: string\n ideName: string\n authToken?: string\n ideRunningInWindows?: boolean\n}\n\nexport type McpServerConfig =\n | McpStdioServerConfig\n | McpSSEServerConfig\n | McpHttpServerConfig\n | McpSSEIdeServerConfig\n | McpWsServerConfig\n | McpWsIdeServerConfig\n\nexport type ProjectConfig = {\n allowedTools: string[]\n deniedTools?: string[]\n askedTools?: string[]\n context: Record<string, string>\n contextFiles?: string[]\n history: string[]\n dontCrawlDirectory?: boolean\n enableArchitectTool?: boolean\n mcpContextUris: string[]\n mcpServers?: Record<string, McpServerConfig>\n approvedMcprcServers?: string[]\n rejectedMcprcServers?: string[]\n lastAPIDuration?: number\n lastCost?: number\n lastDuration?: number\n lastSessionId?: string\n exampleFiles?: string[]\n exampleFilesGeneratedAt?: number\n hasTrustDialogAccepted?: boolean\n hasCompletedProjectOnboarding?: boolean\n}\n\nexport type AutoUpdaterStatus =\n | 'disabled'\n | 'enabled'\n | 'no_permissions'\n | 'not_configured'\n\nexport function isAutoUpdaterStatus(value: string): value is AutoUpdaterStatus {\n return ['disabled', 'enabled', 'no_permissions', 'not_configured'].includes(\n value as AutoUpdaterStatus,\n )\n}\n\nexport type NotificationChannel =\n | 'iterm2'\n | 'terminal_bell'\n | 'iterm2_with_bell'\n | 'notifications_disabled'\n\nexport type ProviderType =\n | 'anthropic'\n | 'openai'\n | 'mistral'\n | 'deepseek'\n | 'kimi'\n | 'qwen'\n | 'glm'\n | 'minimax'\n | 'baidu-qianfan'\n | 'siliconflow'\n | 'bigdream'\n | 'opendev'\n | 'xai'\n | 'groq'\n | 'gemini'\n | 'ollama'\n | 'azure'\n | 'custom'\n | 'custom-openai'\n | (string & {})\n\nexport type ModelProfile = {\n name: string\n provider: ProviderType\n modelName: string\n baseURL?: string\n apiKey: string\n maxTokens: number\n contextLength: number\n reasoningEffort?: 'low' | 'medium' | 'high' | 'minimal' | string\n isActive: boolean\n createdAt: number\n lastUsed?: number\n isGPT5?: boolean\n validationStatus?: 'valid' | 'needs_repair' | 'auto_repaired'\n lastValidation?: number\n}\n\nexport type ModelPointerType = 'main' | 'task' | 'compact' | 'quick'\n\nexport type ModelPointers = {\n main: string\n task: string\n compact: string\n quick: string\n}\n\nexport type AccountInfo = {\n accountUuid: string\n emailAddress: string\n organizationUuid?: string\n}\n\nexport type GlobalConfig = {\n projects?: Record<string, ProjectConfig>\n numStartups: number\n autoUpdaterStatus?: AutoUpdaterStatus\n userID?: string\n theme: ThemeNames\n hasCompletedOnboarding?: boolean\n lastPlanModeUse?: number\n lastOnboardingVersion?: string\n lastReleaseNotesSeen?: string\n mcpServers?: Record<string, McpServerConfig>\n preferredNotifChannel: NotificationChannel\n verbose: boolean\n customApiKeyResponses?: {\n approved?: string[]\n rejected?: string[]\n }\n primaryProvider?: ProviderType\n maxTokens?: number\n autoCompactThreshold?: number\n hasAcknowledgedCostThreshold?: boolean\n oauthAccount?: AccountInfo\n proxy?: string\n stream?: boolean\n\n modelProfiles?: ModelProfile[]\n modelPointers?: ModelPointers\n defaultModelName?: string\n lastDismissedUpdateVersion?: string\n shiftEnterKeyBindingInstalled?: boolean\n}\n\nexport const GLOBAL_CONFIG_KEYS = [\n 'autoUpdaterStatus',\n 'theme',\n 'hasCompletedOnboarding',\n 'lastOnboardingVersion',\n 'lastReleaseNotesSeen',\n 'verbose',\n 'customApiKeyResponses',\n 'primaryProvider',\n 'preferredNotifChannel',\n 'maxTokens',\n 'autoCompactThreshold',\n 'shiftEnterKeyBindingInstalled',\n] as const\n\nexport type GlobalConfigKey = (typeof GLOBAL_CONFIG_KEYS)[number]\n\nexport function isGlobalConfigKey(key: string): key is GlobalConfigKey {\n return GLOBAL_CONFIG_KEYS.includes(key as GlobalConfigKey)\n}\n\nexport const PROJECT_CONFIG_KEYS = [\n 'dontCrawlDirectory',\n 'enableArchitectTool',\n 'hasTrustDialogAccepted',\n 'hasCompletedProjectOnboarding',\n] as const\n\nexport type ProjectConfigKey = (typeof PROJECT_CONFIG_KEYS)[number]\n\nexport function isProjectConfigKey(key: string): key is ProjectConfigKey {\n return PROJECT_CONFIG_KEYS.includes(key as ProjectConfigKey)\n}\n\nexport type ProjectMcpServerDefinitions = {\n servers: Record<string, McpServerConfig>\n sources: Record<string, '.mcp.json' | '.mcprc'>\n mcpJsonPath: string\n mcprcPath: string\n}\n", "import { homedir } from 'os'\nimport type { GlobalConfig, ProjectConfig, ProviderType } from './schema'\nimport type { ThemeNames } from '@utils/theme'\n\nexport const DEFAULT_PROJECT_CONFIG: ProjectConfig = {\n allowedTools: [],\n deniedTools: [],\n askedTools: [],\n context: {},\n history: [],\n dontCrawlDirectory: false,\n enableArchitectTool: false,\n mcpContextUris: [],\n mcpServers: {},\n approvedMcprcServers: [],\n rejectedMcprcServers: [],\n hasTrustDialogAccepted: false,\n}\n\nexport function defaultConfigForProject(projectPath: string): ProjectConfig {\n const config = { ...DEFAULT_PROJECT_CONFIG }\n if (projectPath === homedir()) {\n config.dontCrawlDirectory = true\n }\n return config\n}\n\nexport const DEFAULT_GLOBAL_CONFIG: GlobalConfig = {\n numStartups: 0,\n autoUpdaterStatus: 'not_configured',\n theme: 'dark' as ThemeNames,\n preferredNotifChannel: 'iterm2',\n verbose: false,\n primaryProvider: 'anthropic' as ProviderType,\n customApiKeyResponses: {\n approved: [],\n rejected: [],\n },\n stream: true,\n\n modelProfiles: [],\n modelPointers: {\n main: '',\n task: '',\n compact: '',\n quick: '',\n },\n lastDismissedUpdateVersion: undefined,\n shiftEnterKeyBindingInstalled: false,\n}\n", "import {\n copyFileSync,\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from 'fs'\nimport { dirname, join, posix, resolve, win32 } from 'path'\nimport { cloneDeep, memoize, pick } from 'lodash-es'\nimport { homedir } from 'os'\nimport { randomBytes } from 'crypto'\nimport {\n getGlobalConfigFilePath,\n getLegacyGlobalConfigFilePath,\n} from '@utils/config/env'\nimport { getCwd } from '@utils/state'\nimport { safeParseJSON } from '@utils/text/json'\nimport { ConfigParseError } from '@utils/text/errors'\nimport { debug as debugLogger } from '@utils/log/debugLogger'\nimport {\n DEFAULT_GLOBAL_CONFIG,\n DEFAULT_PROJECT_CONFIG,\n defaultConfigForProject,\n} from './defaults'\nimport {\n GLOBAL_CONFIG_KEYS,\n PROJECT_CONFIG_KEYS,\n isGlobalConfigKey,\n isAutoUpdaterStatus,\n isProjectConfigKey,\n type GlobalConfig,\n type McpServerConfig,\n type ProjectConfig,\n type ProjectMcpServerDefinitions,\n} from './schema'\nimport { migrateModelProfilesRemoveId } from './migrations'\n\nfunction expandHomeDirForPlatform(\n input: string,\n homeDirPath: string,\n platform: NodeJS.Platform,\n): string {\n const trimmed = input.trim()\n if (!trimmed) return trimmed\n if (trimmed === '~') return homeDirPath\n if (trimmed.startsWith('~/') || trimmed.startsWith('~\\\\')) {\n const rest = trimmed.slice(2)\n return platform === 'win32'\n ? win32.join(homeDirPath, rest)\n : posix.join(homeDirPath, rest)\n }\n return trimmed\n}\n\nexport function normalizeProjectPathForComparison(\n projectPath: string,\n baseDir: string,\n opts?: { platform?: NodeJS.Platform; homeDir?: string },\n): string {\n const platform = opts?.platform ?? process.platform\n const homeDirPath = opts?.homeDir ?? homedir()\n const expanded = expandHomeDirForPlatform(projectPath, homeDirPath, platform)\n if (!expanded) return ''\n\n if (platform === 'win32') {\n const resolved = win32.isAbsolute(expanded)\n ? win32.resolve(expanded)\n : win32.resolve(baseDir, expanded)\n return resolved.toLowerCase()\n }\n\n const resolved = posix.isAbsolute(expanded)\n ? posix.resolve(expanded)\n : posix.resolve(baseDir, expanded)\n return resolved\n}\n\nfunction findMatchingProjectKey(\n projects: Record<string, ProjectConfig> | undefined,\n absolutePath: string,\n): string | undefined {\n if (!projects) return undefined\n if (projects[absolutePath]) return absolutePath\n\n const normalizedTarget = normalizeProjectPathForComparison(\n absolutePath,\n absolutePath,\n )\n\n for (const key of Object.keys(projects)) {\n if (\n normalizeProjectPathForComparison(key, absolutePath) === normalizedTarget\n ) {\n return key\n }\n }\n\n return undefined\n}\n\nfunction resolveGlobalConfigReadPath(): string {\n const primaryPath = getGlobalConfigFilePath()\n const legacyPath = getLegacyGlobalConfigFilePath()\n if (primaryPath === legacyPath) return primaryPath\n if (existsSync(primaryPath)) return primaryPath\n if (!existsSync(legacyPath)) return primaryPath\n try {\n mkdirSync(dirname(primaryPath), { recursive: true })\n copyFileSync(legacyPath, primaryPath)\n return primaryPath\n } catch {\n return legacyPath\n }\n}\n\nexport function checkHasTrustDialogAccepted(): boolean {\n let currentPath = getCwd()\n const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG)\n\n while (true) {\n const projectKey = findMatchingProjectKey(config.projects, currentPath)\n const projectConfig = projectKey ? config.projects?.[projectKey] : undefined\n if (projectConfig?.hasTrustDialogAccepted) {\n return true\n }\n const parentPath = resolve(currentPath, '..')\n if (parentPath === currentPath) {\n break\n }\n currentPath = parentPath\n }\n\n return false\n}\n\nconst TEST_GLOBAL_CONFIG_FOR_TESTING: GlobalConfig = {\n ...DEFAULT_GLOBAL_CONFIG,\n autoUpdaterStatus: 'disabled',\n}\nconst TEST_PROJECT_CONFIG_FOR_TESTING: ProjectConfig = {\n ...DEFAULT_PROJECT_CONFIG,\n}\n\nexport function saveGlobalConfig(config: GlobalConfig): void {\n if (process.env.NODE_ENV === 'test') {\n for (const key in config) {\n TEST_GLOBAL_CONFIG_FOR_TESTING[key] = config[key]\n }\n return\n }\n\n const readPath = resolveGlobalConfigReadPath()\n saveConfig(\n getGlobalConfigFilePath(),\n {\n ...config,\n projects: getConfig(readPath, DEFAULT_GLOBAL_CONFIG).projects,\n },\n DEFAULT_GLOBAL_CONFIG,\n )\n}\n\nexport function getGlobalConfig(): GlobalConfig {\n if (process.env.NODE_ENV === 'test') {\n return TEST_GLOBAL_CONFIG_FOR_TESTING\n }\n const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG)\n return migrateModelProfilesRemoveId(config)\n}\n\nexport function normalizeApiKeyForConfig(apiKey: string): string {\n return apiKey?.slice(-20) ?? ''\n}\n\nexport function getCustomApiKeyStatus(\n truncatedApiKey: string,\n): 'approved' | 'rejected' | 'new' {\n const config = getGlobalConfig()\n if (config.customApiKeyResponses?.approved?.includes(truncatedApiKey)) {\n return 'approved'\n }\n if (config.customApiKeyResponses?.rejected?.includes(truncatedApiKey)) {\n return 'rejected'\n }\n return 'new'\n}\n\nfunction saveConfig<A extends object>(\n file: string,\n config: A,\n defaultConfig: A,\n): void {\n const filteredConfig = Object.fromEntries(\n Object.entries(config).filter(\n ([key, value]) =>\n JSON.stringify(value) !== JSON.stringify(defaultConfig[key as keyof A]),\n ),\n )\n try {\n const dir = dirname(file)\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true })\n }\n writeFileSync(file, JSON.stringify(filteredConfig, null, 2), 'utf-8')\n } catch (error) {\n const err = error as NodeJS.ErrnoException\n if (\n err?.code === 'EACCES' ||\n err?.code === 'EPERM' ||\n err?.code === 'EROFS'\n ) {\n debugLogger.state('CONFIG_SAVE_SKIPPED', {\n file,\n reason: String(err.code),\n })\n return\n }\n throw error\n }\n}\n\nlet configReadingAllowed = false\n\nexport function enableConfigs(): void {\n configReadingAllowed = true\n getConfig(\n resolveGlobalConfigReadPath(),\n DEFAULT_GLOBAL_CONFIG,\n true,\n )\n}\n\nfunction getConfig<A>(\n file: string,\n defaultConfig: A,\n throwOnInvalid?: boolean,\n): A {\n void configReadingAllowed\n\n debugLogger.state('CONFIG_LOAD_START', {\n file,\n fileExists: String(existsSync(file)),\n throwOnInvalid: String(!!throwOnInvalid),\n })\n\n if (!existsSync(file)) {\n debugLogger.state('CONFIG_LOAD_DEFAULT', {\n file,\n reason: 'file_not_exists',\n defaultConfigKeys: Object.keys(defaultConfig as object).join(', '),\n })\n return cloneDeep(defaultConfig)\n }\n\n try {\n const fileContent = readFileSync(file, 'utf-8')\n debugLogger.state('CONFIG_FILE_READ', {\n file,\n contentLength: String(fileContent.length),\n contentPreview:\n fileContent.substring(0, 100) + (fileContent.length > 100 ? '...' : ''),\n })\n\n try {\n const parsedConfig = JSON.parse(fileContent)\n debugLogger.state('CONFIG_JSON_PARSED', {\n file,\n parsedKeys: Object.keys(parsedConfig).join(', '),\n })\n\n const finalConfig = {\n ...cloneDeep(defaultConfig),\n ...parsedConfig,\n }\n\n debugLogger.state('CONFIG_LOAD_SUCCESS', {\n file,\n finalConfigKeys: Object.keys(finalConfig as object).join(', '),\n })\n\n return finalConfig\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error)\n\n debugLogger.error('CONFIG_JSON_PARSE_ERROR', {\n file,\n errorMessage,\n errorType: error instanceof Error ? error.constructor.name : typeof error,\n contentLength: String(fileContent.length),\n })\n\n throw new ConfigParseError(errorMessage, file, defaultConfig)\n }\n } catch (error: unknown) {\n if (error instanceof ConfigParseError && throwOnInvalid) {\n debugLogger.error('CONFIG_PARSE_ERROR_RETHROWN', {\n file,\n throwOnInvalid: String(throwOnInvalid),\n errorMessage: error.message,\n })\n throw error\n }\n\n debugLogger.warn('CONFIG_FALLBACK_TO_DEFAULT', {\n file,\n errorType: error instanceof Error ? error.constructor.name : typeof error,\n errorMessage: error instanceof Error ? error.message : String(error),\n action: 'using_default_config',\n })\n\n return cloneDeep(defaultConfig)\n }\n}\n\nexport function getCurrentProjectConfig(): ProjectConfig {\n if (process.env.NODE_ENV === 'test') {\n return TEST_PROJECT_CONFIG_FOR_TESTING\n }\n\n const absolutePath = resolve(getCwd())\n const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG)\n\n if (!config.projects) {\n return defaultConfigForProject(absolutePath)\n }\n\n const projectKey = findMatchingProjectKey(config.projects, absolutePath)\n const projectConfig =\n projectKey && config.projects[projectKey]\n ? config.projects[projectKey]\n : defaultConfigForProject(absolutePath)\n if (typeof projectConfig.allowedTools === 'string') {\n projectConfig.allowedTools =\n (safeParseJSON(projectConfig.allowedTools) as string[]) ?? []\n }\n if (typeof (projectConfig as any).deniedTools === 'string') {\n ;(projectConfig as any).deniedTools =\n (safeParseJSON((projectConfig as any).deniedTools) as string[]) ?? []\n }\n if (typeof (projectConfig as any).askedTools === 'string') {\n ;(projectConfig as any).askedTools =\n (safeParseJSON((projectConfig as any).askedTools) as string[]) ?? []\n }\n return projectConfig\n}\n\nexport function saveCurrentProjectConfig(projectConfig: ProjectConfig): void {\n if (process.env.NODE_ENV === 'test') {\n for (const key in projectConfig) {\n TEST_PROJECT_CONFIG_FOR_TESTING[key] = projectConfig[key]\n }\n return\n }\n const config = getConfig(resolveGlobalConfigReadPath(), DEFAULT_GLOBAL_CONFIG)\n const resolvedCwd = resolve(getCwd())\n const existingKey = findMatchingProjectKey(config.projects, resolvedCwd)\n const storageKey = existingKey ?? resolvedCwd\n\n saveConfig(\n getGlobalConfigFilePath(),\n {\n ...config,\n projects: {\n ...config.projects,\n [storageKey]: projectConfig,\n },\n },\n DEFAULT_GLOBAL_CONFIG,\n )\n}\n\nexport async function isAutoUpdaterDisabled(): Promise<boolean> {\n const status = getGlobalConfig().autoUpdaterStatus\n return status !== 'enabled'\n}\n\nexport const TEST_MCPRC_CONFIG_FOR_TESTING: Record<string, McpServerConfig> = {}\n\nexport function clearMcprcConfigForTesting(): void {\n if (process.env.NODE_ENV === 'test') {\n Object.keys(TEST_MCPRC_CONFIG_FOR_TESTING).forEach(key => {\n delete TEST_MCPRC_CONFIG_FOR_TESTING[key]\n })\n }\n}\n\nexport function addMcprcServerForTesting(\n name: string,\n server: McpServerConfig,\n): void {\n if (process.env.NODE_ENV === 'test') {\n TEST_MCPRC_CONFIG_FOR_TESTING[name] = server\n }\n}\n\nexport function removeMcprcServerForTesting(name: string): void {\n if (process.env.NODE_ENV === 'test') {\n if (!TEST_MCPRC_CONFIG_FOR_TESTING[name]) {\n throw new Error(`No MCP server found with name: ${name} in .mcprc`)\n }\n delete TEST_MCPRC_CONFIG_FOR_TESTING[name]\n }\n}\n\nexport const getMcprcConfig = memoize(\n (): Record<string, McpServerConfig> => {\n if (process.env.NODE_ENV === 'test') {\n return TEST_MCPRC_CONFIG_FOR_TESTING\n }\n\n const mcprcPath = join(getCwd(), '.mcprc')\n if (!existsSync(mcprcPath)) {\n return {}\n }\n\n try {\n const mcprcContent = readFileSync(mcprcPath, 'utf-8')\n const config = safeParseJSON(mcprcContent)\n if (config && typeof config === 'object') {\n return config as Record<string, McpServerConfig>\n }\n } catch {}\n return {}\n },\n () => {\n const cwd = getCwd()\n const mcprcPath = join(cwd, '.mcprc')\n if (existsSync(mcprcPath)) {\n try {\n const stat = readFileSync(mcprcPath, 'utf-8')\n return `${cwd}:${stat}`\n } catch {\n return cwd\n }\n }\n return cwd\n },\n)\n\nfunction parseMcpServersFromMcpJson(\n value: unknown,\n): Record<string, McpServerConfig> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return {}\n const raw = (value as { mcpServers?: unknown }).mcpServers\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return {}\n return raw as Record<string, McpServerConfig>\n}\n\nfunction parseMcpServersFromMcprc(\n value: unknown,\n): Record<string, McpServerConfig> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return {}\n const maybeNested = (value as { mcpServers?: unknown }).mcpServers\n if (\n maybeNested &&\n typeof maybeNested === 'object' &&\n !Array.isArray(maybeNested)\n ) {\n return maybeNested as Record<string, McpServerConfig>\n }\n return value as Record<string, McpServerConfig>\n}\n\nexport const getProjectMcpServerDefinitions = memoize(\n (): ProjectMcpServerDefinitions => {\n if (process.env.NODE_ENV === 'test') {\n return {\n servers: {},\n sources: {},\n mcpJsonPath: join(getCwd(), '.mcp.json'),\n mcprcPath: join(getCwd(), '.mcprc'),\n }\n }\n\n const cwd = getCwd()\n const mcpJsonPath = join(cwd, '.mcp.json')\n const mcprcPath = join(cwd, '.mcprc')\n\n let mcpJsonServers: Record<string, McpServerConfig> = {}\n let mcprcServers: Record<string, McpServerConfig> = {}\n\n if (existsSync(mcpJsonPath)) {\n try {\n const content = readFileSync(mcpJsonPath, 'utf-8')\n const parsed = safeParseJSON(content)\n mcpJsonServers = parseMcpServersFromMcpJson(parsed)\n } catch {}\n }\n\n if (existsSync(mcprcPath)) {\n try {\n const content = readFileSync(mcprcPath, 'utf-8')\n const parsed = safeParseJSON(content)\n mcprcServers = parseMcpServersFromMcprc(parsed)\n } catch {}\n }\n\n const sources: Record<string, '.mcp.json' | '.mcprc'> = {}\n for (const name of Object.keys(mcpJsonServers)) {\n sources[name] = '.mcp.json'\n }\n for (const name of Object.keys(mcprcServers)) {\n sources[name] = '.mcprc'\n }\n\n return {\n servers: { ...mcpJsonServers, ...mcprcServers },\n sources,\n mcpJsonPath,\n mcprcPath,\n }\n },\n () => {\n const cwd = getCwd()\n const mcpJsonPath = join(cwd, '.mcp.json')\n const mcprcPath = join(cwd, '.mcprc')\n\n const parts: string[] = [cwd]\n\n if (existsSync(mcpJsonPath)) {\n try {\n parts.push('mcp.json')\n parts.push(readFileSync(mcpJsonPath, 'utf-8'))\n } catch {}\n }\n\n if (existsSync(mcprcPath)) {\n try {\n parts.push('mcprc')\n parts.push(readFileSync(mcprcPath, 'utf-8'))\n } catch {}\n }\n\n return parts.join(':')\n },\n)\n\nexport function getOrCreateUserID(): string {\n const config = getGlobalConfig()\n if (config.userID) {\n return config.userID\n }\n\n const userID = randomBytes(32).toString('hex')\n saveGlobalConfig({ ...config, userID })\n return userID\n}\n\nexport function getConfigForCLI(key: string, global: boolean): unknown {\n if (global) {\n if (!isGlobalConfigKey(key)) {\n console.error(\n `Error: '${key}' is not a valid config key. Valid keys are: ${GLOBAL_CONFIG_KEYS.join(', ')}`,\n )\n process.exit(1)\n }\n return getGlobalConfig()[key]\n } else {\n if (!isProjectConfigKey(key)) {\n console.error(\n `Error: '${key}' is not a valid config key. Valid keys are: ${PROJECT_CONFIG_KEYS.join(', ')}`,\n )\n process.exit(1)\n }\n return getCurrentProjectConfig()[key]\n }\n}\n\nexport function setConfigForCLI(\n key: string,\n value: unknown,\n global: boolean,\n): void {\n if (global) {\n if (!isGlobalConfigKey(key)) {\n console.error(\n `Error: Cannot set '${key}'. Only these keys can be modified: ${GLOBAL_CONFIG_KEYS.join(', ')}`,\n )\n process.exit(1)\n }\n\n if (key === 'autoUpdaterStatus' && !isAutoUpdaterStatus(value as string)) {\n console.error(\n `Error: Invalid value for autoUpdaterStatus. Must be one of: disabled, enabled, no_permissions, not_configured`,\n )\n process.exit(1)\n }\n\n const currentConfig = getGlobalConfig()\n saveGlobalConfig({\n ...currentConfig,\n [key]: value,\n })\n } else {\n if (!isProjectConfigKey(key)) {\n console.error(\n `Error: Cannot set '${key}'. Only these keys can be modified: ${PROJECT_CONFIG_KEYS.join(', ')}. Did you mean --global?`,\n )\n process.exit(1)\n }\n const currentConfig = getCurrentProjectConfig()\n saveCurrentProjectConfig({\n ...currentConfig,\n [key]: value,\n })\n }\n setTimeout(() => {\n process.exit(0)\n }, 100)\n}\n\nexport function deleteConfigForCLI(key: string, global: boolean): void {\n if (global) {\n if (!isGlobalConfigKey(key)) {\n console.error(\n `Error: Cannot delete '${key}'. Only these keys can be modified: ${GLOBAL_CONFIG_KEYS.join(', ')}`,\n )\n process.exit(1)\n }\n const currentConfig = getGlobalConfig()\n delete currentConfig[key]\n saveGlobalConfig(currentConfig)\n } else {\n if (!isProjectConfigKey(key)) {\n console.error(\n `Error: Cannot delete '${key}'. Only these keys can be modified: ${PROJECT_CONFIG_KEYS.join(', ')}. Did you mean --global?`,\n )\n process.exit(1)\n }\n const currentConfig = getCurrentProjectConfig()\n delete currentConfig[key]\n saveCurrentProjectConfig(currentConfig)\n }\n}\n\nexport function listConfigForCLI(global: true): GlobalConfig\nexport function listConfigForCLI(global: false): ProjectConfig\nexport function listConfigForCLI(global: boolean): object {\n if (global) {\n const currentConfig = pick(getGlobalConfig(), GLOBAL_CONFIG_KEYS)\n return currentConfig\n } else {\n return pick(getCurrentProjectConfig(), PROJECT_CONFIG_KEYS)\n }\n}\n\nexport function getOpenAIApiKey(): string | undefined {\n return process.env.OPENAI_API_KEY\n}\n\nexport function getAnthropicApiKey(): string {\n return process.env.ANTHROPIC_API_KEY || ''\n}\n", "import { logError } from '@utils/log'\n\nexport function safeParseJSON(json: string | null | undefined): unknown {\n if (!json) {\n return null\n }\n try {\n return JSON.parse(json)\n } catch (e) {\n logError(e)\n return null\n }\n}\n", "import type { GlobalConfig, ModelPointers, ModelProfile } from './schema'\n\nexport function migrateModelProfilesRemoveId(config: GlobalConfig): GlobalConfig {\n if (!config.modelProfiles) return config\n\n const idToModelNameMap = new Map<string, string>()\n const migratedProfiles = config.modelProfiles.map(profile => {\n if ((profile as any).id && profile.modelName) {\n idToModelNameMap.set((profile as any).id, profile.modelName)\n }\n\n const { id, ...profileWithoutId } = profile as any\n return profileWithoutId as ModelProfile\n })\n\n const migratedPointers: ModelPointers = {\n main: '',\n task: '',\n compact: '',\n quick: '',\n }\n\n const rawPointers = config.modelPointers as\n | Record<string, unknown>\n | undefined\n const rawMain = typeof rawPointers?.main === 'string' ? rawPointers.main : ''\n const rawTask = typeof rawPointers?.task === 'string' ? rawPointers.task : ''\n const rawQuick =\n typeof rawPointers?.quick === 'string' ? rawPointers.quick : ''\n const rawCompact =\n typeof rawPointers?.compact === 'string'\n ? rawPointers.compact\n : typeof rawPointers?.reasoning === 'string'\n ? rawPointers.reasoning\n : ''\n\n if (rawMain) migratedPointers.main = idToModelNameMap.get(rawMain) || rawMain\n if (rawTask) migratedPointers.task = idToModelNameMap.get(rawTask) || rawTask\n if (rawCompact)\n migratedPointers.compact = idToModelNameMap.get(rawCompact) || rawCompact\n if (rawQuick)\n migratedPointers.quick = idToModelNameMap.get(rawQuick) || rawQuick\n\n let defaultModelName: string | undefined\n if ((config as any).defaultModelId) {\n defaultModelName =\n idToModelNameMap.get((config as any).defaultModelId) ||\n (config as any).defaultModelId\n } else if ((config as any).defaultModelName) {\n defaultModelName = (config as any).defaultModelName\n }\n\n const migratedConfig = { ...config }\n delete (migratedConfig as any).defaultModelId\n delete (migratedConfig as any).currentSelectedModelId\n delete (migratedConfig as any).mainAgentModelId\n delete (migratedConfig as any).taskToolModelId\n\n return {\n ...migratedConfig,\n modelProfiles: migratedProfiles,\n modelPointers: migratedPointers,\n defaultModelName,\n }\n}\n\n", "import type { ModelPointerType, ModelProfile, ProviderType } from './schema'\nimport { debug as debugLogger } from '@utils/log/debugLogger'\nimport { getGlobalConfig, saveGlobalConfig } from './loader'\n\nexport function setAllPointersToModel(modelName: string): void {\n const config = getGlobalConfig()\n const updatedConfig = {\n ...config,\n modelPointers: {\n main: modelName,\n task: modelName,\n compact: modelName,\n quick: modelName,\n },\n defaultModelName: modelName,\n }\n saveGlobalConfig(updatedConfig)\n}\n\nexport function setModelPointer(\n pointer: ModelPointerType,\n modelName: string,\n): void {\n const config = getGlobalConfig()\n const updatedConfig = {\n ...config,\n modelPointers: {\n ...config.modelPointers,\n [pointer]: modelName,\n },\n }\n saveGlobalConfig(updatedConfig)\n\n import('../../utils/model').then(({ reloadModelManager }) => {\n reloadModelManager()\n })\n}\n\nexport function isGPT5ModelName(modelName: string): boolean {\n if (!modelName || typeof modelName !== 'string') return false\n const lowerName = modelName.toLowerCase()\n return lowerName.startsWith('gpt-5') || lowerName.includes('gpt-5')\n}\n\nexport function validateAndRepairGPT5Profile(\n profile: ModelProfile,\n): ModelProfile {\n const isGPT5 = isGPT5ModelName(profile.modelName)\n const now = Date.now()\n\n const repairedProfile: ModelProfile = { ...profile }\n let wasRepaired = false\n\n if (isGPT5 !== profile.isGPT5) {\n repairedProfile.isGPT5 = isGPT5\n wasRepaired = true\n }\n\n if (isGPT5) {\n\n const validReasoningEfforts = ['minimal', 'low', 'medium', 'high']\n if (\n !profile.reasoningEffort ||\n !validReasoningEfforts.includes(profile.reasoningEffort)\n ) {\n repairedProfile.reasoningEffort = 'medium'\n wasRepaired = true\n debugLogger.state('GPT5_CONFIG_AUTO_REPAIR', {\n model: profile.modelName,\n field: 'reasoningEffort',\n value: 'medium',\n })\n }\n\n if (profile.contextLength < 128000) {\n repairedProfile.contextLength = 128000\n wasRepaired = true\n debugLogger.state('GPT5_CONFIG_AUTO_REPAIR', {\n model: profile.modelName,\n field: 'contextLength',\n value: 128000,\n })\n }\n\n if (profile.maxTokens < 4000) {\n repairedProfile.maxTokens = 8192\n wasRepaired = true\n debugLogger.state('GPT5_CONFIG_AUTO_REPAIR', {\n model: profile.modelName,\n field: 'maxTokens',\n value: 8192,\n })\n }\n\n if (\n profile.provider !== 'openai' &&\n profile.provider !== 'custom-openai' &&\n profile.provider !== 'azure'\n ) {\n debugLogger.warn('GPT5_CONFIG_UNEXPECTED_PROVIDER', {\n model: profile.modelName,\n provider: profile.provider,\n expectedProviders: ['openai', 'custom-openai', 'azure'],\n })\n }\n\n if (profile.modelName.includes('gpt-5') && !profile.baseURL) {\n repairedProfile.baseURL = 'https://api.openai.com/v1'\n wasRepaired = true\n debugLogger.state('GPT5_CONFIG_AUTO_REPAIR', {\n model: profile.modelName,\n field: 'baseURL',\n value: 'https://api.openai.com/v1',\n })\n }\n }\n\n repairedProfile.validationStatus = wasRepaired ? 'auto_repaired' : 'valid'\n repairedProfile.lastValidation = now\n\n if (wasRepaired) {\n debugLogger.info('GPT5_CONFIG_AUTO_REPAIRED', { model: profile.modelName })\n }\n\n return repairedProfile\n}\n\nexport function validateAndRepairAllGPT5Profiles(): {\n repaired: number\n total: number\n} {\n const config = getGlobalConfig()\n if (!config.modelProfiles) {\n return { repaired: 0, total: 0 }\n }\n\n let repairCount = 0\n const repairedProfiles = config.modelProfiles.map(profile => {\n const repairedProfile = validateAndRepairGPT5Profile(profile)\n if (repairedProfile.validationStatus === 'auto_repaired') {\n repairCount++\n }\n return repairedProfile\n })\n\n if (repairCount > 0) {\n const updatedConfig = {\n ...config,\n modelProfiles: repairedProfiles,\n }\n saveGlobalConfig(updatedConfig)\n debugLogger.info('GPT5_CONFIG_AUTO_REPAIR_SUMMARY', {\n repaired: repairCount,\n total: config.modelProfiles.length,\n })\n }\n\n return { repaired: repairCount, total: config.modelProfiles.length }\n}\n\nexport function getGPT5ConfigRecommendations(\n modelName: string,\n): Partial<ModelProfile> {\n if (!isGPT5ModelName(modelName)) {\n return {}\n }\n\n const recommendations: Partial<ModelProfile> = {\n contextLength: 128000,\n maxTokens: 8192,\n reasoningEffort: 'medium',\n isGPT5: true,\n }\n\n if (modelName.includes('gpt-5-mini')) {\n recommendations.maxTokens = 4096\n recommendations.reasoningEffort = 'low'\n } else if (modelName.includes('gpt-5-nano')) {\n recommendations.maxTokens = 2048\n recommendations.reasoningEffort = 'minimal'\n }\n\n return recommendations\n}\n\nexport function createGPT5ModelProfile(\n name: string,\n modelName: string,\n apiKey: string,\n baseURL?: string,\n provider: ProviderType = 'openai',\n): ModelProfile {\n const recommendations = getGPT5ConfigRecommendations(modelName)\n\n const profile: ModelProfile = {\n name,\n provider,\n modelName,\n baseURL: baseURL || 'https://api.openai.com/v1',\n apiKey,\n maxTokens: recommendations.maxTokens || 8192,\n contextLength: recommendations.contextLength || 128000,\n reasoningEffort: recommendations.reasoningEffort || 'medium',\n isActive: true,\n createdAt: Date.now(),\n isGPT5: true,\n validationStatus: 'valid',\n lastValidation: Date.now(),\n }\n\n return profile\n}\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAkFO,SAAS,oBAAoB,OAA2C;AAC7E,SAAO,CAAC,YAAY,WAAW,kBAAkB,gBAAgB,EAAE;AAAA,IACjE;AAAA,EACF;AACF;AA8FO,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,SAAS,kBAAkB,KAAqC;AACrE,SAAO,mBAAmB,SAAS,GAAsB;AAC3D;AAEO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,SAAS,mBAAmB,KAAsC;AACvE,SAAO,oBAAoB,SAAS,GAAuB;AAC7D;;;ACpNA,SAAS,eAAe;AAIjB,IAAM,yBAAwC;AAAA,EACnD,cAAc,CAAC;AAAA,EACf,aAAa,CAAC;AAAA,EACd,YAAY,CAAC;AAAA,EACb,SAAS,CAAC;AAAA,EACV,SAAS,CAAC;AAAA,EACV,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,gBAAgB,CAAC;AAAA,EACjB,YAAY,CAAC;AAAA,EACb,sBAAsB,CAAC;AAAA,EACvB,sBAAsB,CAAC;AAAA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;AAC5B,oBAAgB,kBAAkB;AAAA,EACpC,WAAW,UAAU,SAAS,YAAY,GAAG;AAC3C,oBAAgB,YAAY;AAC5B,oBAAgB,kBAAkB;AAAA,EACpC;AAEA,SAAO;AACT;AAEO,SAAS,uBACd,MACA,WACA,QACA,SACA,WAAyB,UACX;AACd,QAAM,kBAAkB,6BAA6B,SAAS;AAE9D,QAAM,UAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,WAAW;AAAA,IACpB;AAAA,IACA,WAAW,gBAAgB,aAAa;AAAA,IACxC,eAAe,gBAAgB,iBAAiB;AAAA,IAChD,iBAAiB,gBAAgB,mBAAmB;AAAA,IACpD,UAAU;AAAA,IACV,WAAW,KAAK,IAAI;AAAA,IACpB,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,gBAAgB,KAAK,IAAI;AAAA,EAC3B;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["homedir", "homedir", "resolved"]
|
|
7
|
+
}
|
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
getSettingsFileCandidates,
|
|
8
8
|
loadSettingsWithLegacyFallback,
|
|
9
9
|
saveSettingsToPrimaryAndSyncLegacy
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F47KO7J2.js";
|
|
11
11
|
import {
|
|
12
12
|
getSessionPlugins
|
|
13
13
|
} from "./chunk-BJSWTHRM.js";
|
|
14
14
|
import {
|
|
15
|
-
getCwd
|
|
16
|
-
|
|
15
|
+
getCwd,
|
|
16
|
+
getXdgConfigDir
|
|
17
|
+
} from "./chunk-KUIDN7FP.js";
|
|
17
18
|
|
|
18
19
|
// src/services/ui/outputStyles.ts
|
|
19
20
|
import figures from "figures";
|
|
@@ -85,6 +86,7 @@ function getUserConfigBaseDirs() {
|
|
|
85
86
|
return dedupeConfigBases(out);
|
|
86
87
|
}
|
|
87
88
|
return dedupeConfigBases([
|
|
89
|
+
{ claude: getXdgConfigDir(), pyb: getXdgConfigDir() },
|
|
88
90
|
{ claude: join(homedir(), ".claude"), pyb: join(homedir(), ".claude") },
|
|
89
91
|
{ claude: join(homedir(), ".pyb"), pyb: join(homedir(), ".pyb") }
|
|
90
92
|
]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/services/ui/outputStyles.ts", "../src/utils/config/localSettings.ts"],
|
|
4
|
+
"sourcesContent": ["import figures from 'figures'\nimport { memoize } from 'lodash-es'\nimport { existsSync, readdirSync, readFileSync, statSync } from 'fs'\nimport { basename, dirname, join, resolve } from 'path'\nimport { homedir } from 'os'\nimport matter from 'gray-matter'\nimport yaml from 'js-yaml'\nimport { getSessionPlugins } from '@utils/session/sessionPlugins'\nimport { readLocalSettings, updateLocalSettings } from '@utils/config/localSettings'\nimport { getCwd } from '@utils/state'\nimport { isSettingSourceEnabled } from '@utils/config/settingSources'\nimport { getXdgConfigDir } from '@utils/config/env'\n\nexport type OutputStyleSource =\n | 'built-in'\n | 'plugin'\n | 'userSettings'\n | 'projectSettings'\n | 'policySettings'\n\nexport type OutputStyleDefinition = {\n name: string\n description: string\n prompt: string\n source: OutputStyleSource\n keepCodingInstructions?: boolean\n}\n\nexport type OutputStyleMap = Record<string, OutputStyleDefinition | null>\n\nexport const DEFAULT_OUTPUT_STYLE = 'default'\n\nfunction normalizeString(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed ? trimmed : null\n}\n\nfunction getClaudePolicyBaseDir(): string {\n switch (process.platform) {\n case 'darwin':\n return '/Library/Application Support/ClaudeCode'\n case 'win32':\n return existsSync('C:\\\\Program Files\\\\ClaudeCode')\n ? 'C:\\\\Program Files\\\\ClaudeCode'\n : 'C:\\\\ProgramData\\\\ClaudeCode'\n default:\n return '/etc/claude-code'\n }\n}\n\nfunction getUserConfigBaseDirs(): { claude: string; pyb: string }[] {\n const out: { claude: string; pyb: string }[] = []\n\n const hasAnyOverride =\n typeof process.env.CLAUDE_CONFIG_DIR === 'string' ||\n typeof process.env.PYB_CONFIG_DIR === 'string'\n\n const claudeBase = normalizeString(process.env.CLAUDE_CONFIG_DIR)\n const pybBase = normalizeString(process.env.PYB_CONFIG_DIR)\n\n if (claudeBase) out.push({ claude: resolve(claudeBase), pyb: resolve(claudeBase) })\n if (pybBase) out.push({ claude: resolve(pybBase), pyb: resolve(pybBase) })\n\n if (hasAnyOverride) {\n return dedupeConfigBases(out)\n }\n\n return dedupeConfigBases([\n { claude: getXdgConfigDir(), pyb: getXdgConfigDir() },\n { claude: join(homedir(), '.claude'), pyb: join(homedir(), '.claude') },\n { claude: join(homedir(), '.pyb'), pyb: join(homedir(), '.pyb') },\n ])\n}\n\nfunction dedupeConfigBases(\n bases: Array<{ claude: string; pyb: string }>,\n): Array<{ claude: string; pyb: string }> {\n const seen = new Set<string>()\n const out: Array<{ claude: string; pyb: string }> = []\n for (const base of bases) {\n const key = `${base.claude}::${base.pyb}`\n if (seen.has(key)) continue\n seen.add(key)\n out.push(base)\n }\n return out\n}\n\nfunction findProjectSubdirs(subdir: string, cwd: string): string[] {\n const result: string[] = []\n const home = resolve(homedir())\n let current = resolve(cwd)\n\n while (current !== home) {\n const claudeDir = join(current, '.claude', subdir)\n if (existsSync(claudeDir)) result.push(claudeDir)\n\n const pybDir = join(current, '.pyb', subdir)\n if (existsSync(pybDir)) result.push(pybDir)\n\n const parent = dirname(current)\n if (parent === current) break\n current = parent\n }\n\n return result\n}\n\nfunction markdownFirstLineOrHeading(content: string, fallback: string): string {\n const lines = content.split('\\n')\n for (const line of lines) {\n const trimmed = line.trim()\n if (!trimmed) continue\n const heading = trimmed.match(/^#+\\s+(.+)$/)?.[1] ?? trimmed\n return heading.length > 100 ? `${heading.substring(0, 97)}...` : heading\n }\n return fallback\n}\n\nfunction listMarkdownFilesRecursively(rootDir: string): string[] {\n const files: string[] = []\n const visitedDirs = new Set<string>()\n\n const walk = (dirPath: string) => {\n let dirStat: ReturnType<typeof statSync>\n try {\n dirStat = statSync(dirPath)\n } catch {\n return\n }\n if (!dirStat.isDirectory()) return\n\n const dirKey = `${dirStat.dev}:${dirStat.ino}`\n if (visitedDirs.has(dirKey)) return\n visitedDirs.add(dirKey)\n\n let entries: Array<{ name: string; isDirectory(): boolean; isFile(): boolean; isSymbolicLink(): boolean }>\n try {\n entries = readdirSync(dirPath, { withFileTypes: true, encoding: 'utf8' }) as any\n } catch {\n return\n }\n\n for (const entry of entries) {\n const name = String(entry.name ?? '')\n const fullPath = join(dirPath, name)\n\n if (entry.isDirectory()) {\n walk(fullPath)\n continue\n }\n\n if (entry.isFile()) {\n if (name.endsWith('.md')) files.push(fullPath)\n continue\n }\n\n if (entry.isSymbolicLink()) {\n try {\n const st = statSync(fullPath)\n if (st.isDirectory()) {\n walk(fullPath)\n } else if (st.isFile() && name.endsWith('.md')) {\n files.push(fullPath)\n }\n } catch {\n continue\n }\n }\n }\n }\n\n if (!existsSync(rootDir)) return []\n walk(rootDir)\n return files\n}\n\nfunction readMarkdownFile(filePath: string): { frontmatter: any; content: string } | null {\n try {\n const raw = readFileSync(filePath, 'utf8')\n const yamlSchema = (yaml as any).JSON_SCHEMA\n const matterOptions = {\n engines: {\n yaml: {\n parse: (input: string) =>\n yaml.load(input, yamlSchema ? { schema: yamlSchema } : undefined) ??\n {},\n },\n },\n }\n const parsed = matter(raw, matterOptions)\n return { frontmatter: (parsed.data as any) ?? {}, content: String(parsed.content ?? '') }\n } catch {\n return null\n }\n}\n\nfunction inodeKeyForPath(filePath: string): string | null {\n try {\n const st = statSync(filePath)\n if (typeof (st as any).dev === 'number' && typeof (st as any).ino === 'number') {\n return `${(st as any).dev}:${(st as any).ino}`\n }\n return null\n } catch {\n return null\n }\n}\n\nconst INSIGHTS_SECTION = `\n## Insights\nIn order to encourage learning, before and after writing code, always provide brief educational explanations about implementation choices using (with backticks):\n\"\\`${figures.star} Insight \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\`\n[2-3 key educational points]\n\\`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\`\"\n\nThese insights should be included in the conversation, not in the codebase. You should generally focus on interesting insights that are specific to the codebase or the code you just wrote, rather than general programming concepts.`\n\nfunction getBuiltInOutputStyles(): OutputStyleMap {\n return {\n [DEFAULT_OUTPUT_STYLE]: null,\n Explanatory: {\n name: 'Explanatory',\n source: 'built-in',\n description: 'Claude explains its implementation choices and codebase patterns',\n keepCodingInstructions: true,\n prompt: `You are an interactive CLI tool that helps users with software engineering tasks. In addition to software engineering tasks, you should provide educational insights about the codebase along the way.\n\nYou should be clear and educational, providing helpful explanations while remaining focused on the task. Balance educational content with task completion. When providing insights, you may exceed typical length constraints, but remain focused and relevant.\n\n# Explanatory Style Active\n${INSIGHTS_SECTION}`,\n },\n Learning: {\n name: 'Learning',\n source: 'built-in',\n description:\n 'Claude pauses and asks you to write small pieces of code for hands-on practice',\n keepCodingInstructions: true,\n prompt: `You are an interactive CLI tool that helps users with software engineering tasks. In addition to software engineering tasks, you should help users learn more about the codebase through hands-on practice and educational insights.\n\nYou should be collaborative and encouraging. Balance task completion with learning by requesting user input for meaningful design decisions while handling routine implementation yourself. \n\n# Learning Style Active\n## Requesting Human Contributions\nIn order to encourage learning, ask the human to contribute 2-10 line code pieces when generating 20+ lines involving:\n- Design decisions (error handling, data structures)\n- Business logic with multiple valid approaches \n- Key algorithms or interface definitions\n\n**TodoList Integration**: If using a TodoList for the overall task, include a specific todo item like \"Request human input on [specific decision]\" when planning to request human input. This ensures proper task tracking. Note: TodoList is not required for all tasks.\n\nExample TodoList flow:\n \u2713 \"Set up component structure with placeholder for logic\"\n \u2713 \"Request human collaboration on decision logic implementation\"\n \u2713 \"Integrate contribution and complete feature\"\n\n### Request Format\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n**Context:** [what's built and why this decision matters]\n**Your Task:** [specific function/section in file, mention file and TODO(human) but do not include line numbers]\n**Guidance:** [trade-offs and constraints to consider]\n\\`\\`\\`\n\n### Key Guidelines\n- Frame contributions as valuable design decisions, not busy work\n- You must first add a TODO(human) section into the codebase with your editing tools before making the Learn by Doing request \n- Make sure there is one and only one TODO(human) section in the code\n- Don't take any action or output anything after the Learn by Doing request. Wait for human implementation before proceeding.\n\n### Example Requests\n\n**Whole Function Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** I've set up the hint feature UI with a button that triggers the hint system. The infrastructure is ready: when clicked, it calls selectHintCell() to determine which cell to hint, then highlights that cell with a yellow background and shows possible values. The hint system needs to decide which empty cell would be most helpful to reveal to the user.\n\n**Your Task:** In sudoku.js, implement the selectHintCell(board) function. Look for TODO(human). This function should analyze the board and return {row, col} for the best cell to hint, or null if the puzzle is complete.\n\n**Guidance:** Consider multiple strategies: prioritize cells with only one possible value (naked singles), or cells that appear in rows/columns/boxes with many filled cells. You could also consider a balanced approach that helps without making it too easy. The board parameter is a 9x9 array where 0 represents empty cells.\n\\`\\`\\`\n\n**Partial Function Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** I've built a file upload component that validates files before accepting them. The main validation logic is complete, but it needs specific handling for different file type categories in the switch statement.\n\n**Your Task:** In upload.js, inside the validateFile() function's switch statement, implement the 'case \"document\":' branch. Look for TODO(human). This should validate document files (pdf, doc, docx).\n\n**Guidance:** Consider checking file size limits (maybe 10MB for documents?), validating the file extension matches the MIME type, and returning {valid: boolean, error?: string}. The file object has properties: name, size, type.\n\\`\\`\\`\n\n**Debugging Example:**\n\\`\\`\\`\n${figures.bullet} **Learn by Doing**\n\n**Context:** The user reported that number inputs aren't working correctly in the calculator. I've identified the handleInput() function as the likely source, but need to understand what values are being processed.\n\n**Your Task:** In calculator.js, inside the handleInput() function, add 2-3 console.log statements after the TODO(human) comment to help debug why number inputs fail.\n\n**Guidance:** Consider logging: the raw input value, the parsed result, and any validation state. This will help us understand where the conversion breaks.\n\\`\\`\\`\n\n### After Contributions\nShare one insight connecting their code to broader patterns or system effects. Avoid praise or repetition.\n\n## Insights\n${INSIGHTS_SECTION}`,\n },\n }\n}\n\nfunction parseKeepCodingInstructions(value: unknown): boolean | undefined {\n if (value === 'true') return true\n if (value === 'false') return false\n return undefined\n}\n\nfunction parseCustomOutputStyleFile(options: {\n filePath: string\n source: Exclude<OutputStyleSource, 'built-in' | 'plugin'>\n}): OutputStyleDefinition | null {\n const parsed = readMarkdownFile(options.filePath)\n if (!parsed) return null\n\n const base = basename(options.filePath, '.md')\n const name = normalizeString(parsed.frontmatter?.name) ?? base\n const description =\n normalizeString(parsed.frontmatter?.description) ??\n markdownFirstLineOrHeading(parsed.content, `Custom ${base} output style`)\n const keepCodingInstructions = parseKeepCodingInstructions(\n parsed.frontmatter?.['keep-coding-instructions'],\n )\n const prompt = parsed.content.trim()\n\n return {\n name,\n description,\n prompt,\n source: options.source,\n ...(keepCodingInstructions !== undefined ? { keepCodingInstructions } : {}),\n }\n}\n\nfunction parsePluginOutputStyleFile(options: {\n filePath: string\n pluginName: string\n seen: Set<string>\n}): OutputStyleDefinition | null {\n const inodeKey = inodeKeyForPath(options.filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${options.filePath}`\n if (options.seen.has(dedupeKey)) return null\n options.seen.add(dedupeKey)\n\n const parsed = readMarkdownFile(options.filePath)\n if (!parsed) return null\n\n const base = basename(options.filePath, '.md')\n const styleName = normalizeString(parsed.frontmatter?.name) ?? base\n const fullName = `${options.pluginName}:${styleName}`\n const description =\n normalizeString(parsed.frontmatter?.description) ??\n markdownFirstLineOrHeading(\n parsed.content,\n `Output style from ${options.pluginName} plugin`,\n )\n const prompt = parsed.content.trim()\n\n return {\n name: fullName,\n description,\n prompt,\n source: 'plugin',\n }\n}\n\nfunction loadPluginOutputStyles(): OutputStyleDefinition[] {\n const out: OutputStyleDefinition[] = []\n const plugins = getSessionPlugins()\n for (const plugin of plugins) {\n const pluginName = plugin.name\n const seen = new Set<string>()\n for (const dir of plugin.outputStylesDirs ?? []) {\n let st: ReturnType<typeof statSync>\n try {\n st = statSync(dir)\n } catch {\n continue\n }\n if (st.isFile()) {\n if (!dir.endsWith('.md')) continue\n const style = parsePluginOutputStyleFile({\n filePath: dir,\n pluginName,\n seen,\n })\n if (style) out.push(style)\n continue\n }\n\n if (st.isDirectory()) {\n const files = listMarkdownFilesRecursively(dir)\n for (const filePath of files) {\n const style = parsePluginOutputStyleFile({\n filePath,\n pluginName,\n seen,\n })\n if (style) out.push(style)\n }\n }\n }\n }\n return out\n}\n\nfunction loadCustomOutputStyles(options: { cwd: string }): OutputStyleDefinition[] {\n const out: OutputStyleDefinition[] = []\n const seen = new Set<string>()\n\n const policyDir = join(\n getClaudePolicyBaseDir(),\n '.claude',\n 'output-styles',\n )\n for (const filePath of listMarkdownFilesRecursively(policyDir)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'policySettings',\n })\n if (style) out.push(style)\n }\n\n if (isSettingSourceEnabled('userSettings')) {\n const userBases = getUserConfigBaseDirs()\n for (const base of userBases) {\n for (const userBaseDir of new Set([base.claude, base.pyb])) {\n const dirPath = join(userBaseDir, 'output-styles')\n for (const filePath of listMarkdownFilesRecursively(dirPath)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'userSettings',\n })\n if (style) out.push(style)\n }\n }\n }\n }\n\n if (isSettingSourceEnabled('projectSettings')) {\n for (const dirPath of findProjectSubdirs('output-styles', options.cwd)) {\n for (const filePath of listMarkdownFilesRecursively(dirPath)) {\n const inodeKey = inodeKeyForPath(filePath)\n const dedupeKey = inodeKey ? `inode:${inodeKey}` : `path:${filePath}`\n if (seen.has(dedupeKey)) continue\n seen.add(dedupeKey)\n const style = parseCustomOutputStyleFile({\n filePath,\n source: 'projectSettings',\n })\n if (style) out.push(style)\n }\n }\n }\n\n return out\n}\n\nexport const getAvailableOutputStyles = memoize((): OutputStyleMap => {\n const cwd = getCwd()\n const builtIn = getBuiltInOutputStyles()\n const merged: OutputStyleMap = { ...builtIn }\n\n for (const style of loadPluginOutputStyles()) {\n merged[style.name] = style\n }\n\n const custom = loadCustomOutputStyles({ cwd })\n const user = custom.filter(s => s.source === 'userSettings')\n const project = custom.filter(s => s.source === 'projectSettings')\n const policy = custom.filter(s => s.source === 'policySettings')\n\n for (const style of user) merged[style.name] = style\n for (const style of project) merged[style.name] = style\n for (const style of policy) merged[style.name] = style\n\n return merged\n})\n\nexport function clearOutputStyleCache(): void {\n ;(getAvailableOutputStyles as any).cache?.clear?.()\n}\n\nexport function getCurrentOutputStyle(): string {\n if (!isSettingSourceEnabled('localSettings')) return DEFAULT_OUTPUT_STYLE\n\n const settings = readLocalSettings()\n const candidate = normalizeString(settings.outputStyle)\n return candidate ?? DEFAULT_OUTPUT_STYLE\n}\n\nexport function setCurrentOutputStyle(styleName: string): void {\n updateLocalSettings({ outputStyle: styleName })\n}\n\nexport function resolveOutputStyleName(input: string): string | null {\n const raw = normalizeString(input)\n if (!raw) return null\n const styles = getAvailableOutputStyles()\n if (raw in styles) return raw\n const lower = raw.toLowerCase()\n for (const name of Object.keys(styles)) {\n if (name.toLowerCase() === lower) return name\n }\n return null\n}\n\nexport function getCurrentOutputStyleDefinition(): OutputStyleDefinition | null {\n const current = getCurrentOutputStyle()\n const styles = getAvailableOutputStyles()\n return styles[current] ?? null\n}\n\nexport function getOutputStyleSystemPromptAdditions(): string[] {\n const style = getCurrentOutputStyleDefinition()\n if (!style) return []\n const prompt = style.prompt.trim()\n if (!prompt) return []\n return [`\\n# Output Style: ${style.name}\\n${prompt}\\n`]\n}\n", "import { join } from 'path'\nimport { getCwd } from '@utils/state'\nimport {\n getSettingsFileCandidates,\n loadSettingsWithLegacyFallback,\n saveSettingsToPrimaryAndSyncLegacy,\n} from '@utils/config/settingsFiles'\n\nexport type LocalSettings = {\n outputStyle?: unknown\n [key: string]: unknown\n}\n\nexport function getLocalSettingsPath(options?: {\n projectDir?: string\n}): string {\n const projectDir = options?.projectDir ?? getCwd()\n return join(projectDir, '.pyb', 'settings.local.json')\n}\n\nexport function readLocalSettings(options?: {\n projectDir?: string\n}): LocalSettings {\n const projectDir = options?.projectDir ?? getCwd()\n const loaded = loadSettingsWithLegacyFallback({\n destination: 'localSettings',\n projectDir,\n migrateToPrimary: true,\n })\n return (loaded.settings as LocalSettings | null) ?? {}\n}\n\nexport function updateLocalSettings(\n patch: Record<string, unknown>,\n options?: {\n projectDir?: string\n },\n): LocalSettings {\n const projectDir = options?.projectDir ?? getCwd()\n const candidates = getSettingsFileCandidates({\n destination: 'localSettings',\n projectDir,\n })\n const existing =\n (candidates\n ? loadSettingsWithLegacyFallback({\n destination: 'localSettings',\n projectDir,\n migrateToPrimary: true,\n }).settings\n : null) ?? {}\n\n const next = { ...(existing as Record<string, unknown>), ...patch }\n\n if (candidates) {\n saveSettingsToPrimaryAndSyncLegacy({\n destination: 'localSettings',\n projectDir,\n settings: next,\n syncLegacyIfExists: true,\n })\n }\n\n return next as LocalSettings\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA,OAAO,aAAa;AACpB,SAAS,eAAe;AACxB,SAAS,YAAY,aAAa,cAAc,gBAA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AAgC;AAC9C,MAAI,CAAC,uBAAuB,eAAe,EAAG,QAAO;AAErD,QAAM,WAAW,kBAAkB;AACnC,QAAM,YAAY,gBAAgB,SAAS,WAAW;AACtD,SAAO,aAAa;AACtB;AAEO,SAAS,sBAAsB,WAAyB;AAC7D,sBAAoB,EAAE,aAAa,UAAU,CAAC;AAChD;AAEO,SAAS,uBAAuB,OAA8B;AACnE,QAAM,MAAM,gBAAgB,KAAK;AACjC,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,SAAS,yBAAyB;AACxC,MAAI,OAAO,OAAQ,QAAO;AAC1B,QAAM,QAAQ,IAAI,YAAY;AAC9B,aAAW,QAAQ,OAAO,KAAK,MAAM,GAAG;AACtC,QAAI,KAAK,YAAY,MAAM,MAAO,QAAO;AAAA,EAC3C;AACA,SAAO;AACT;AAEO,SAAS,kCAAgE;AAC9E,QAAM,UAAU,sBAAsB;AACtC,QAAM,SAAS,yBAAyB;AACxC,SAAO,OAAO,OAAO,KAAK;AAC5B;AAEO,SAAS,sCAAgD;AAC9D,QAAM,QAAQ,gCAAgC;AAC9C,MAAI,CAAC,MAAO,QAAO,CAAC;AACpB,QAAM,SAAS,MAAM,OAAO,KAAK;AACjC,MAAI,CAAC,OAAQ,QAAO,CAAC;AACrB,SAAO,CAAC;AAAA,kBAAqB,MAAM,IAAI;AAAA,EAAK,MAAM;AAAA,CAAI;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,13 +2,13 @@ import { createRequire as __pybCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
MarketplaceManifestSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VAR6IG72.js";
|
|
6
6
|
import {
|
|
7
7
|
parseFrontmatter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LSJILN2S.js";
|
|
9
9
|
import {
|
|
10
10
|
getCwd
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KUIDN7FP.js";
|
|
12
12
|
|
|
13
13
|
// src/services/plugins/pluginValidation.ts
|
|
14
14
|
import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
PRODUCT_NAME,
|
|
5
5
|
execFileNoThrow,
|
|
6
6
|
logError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KUIDN7FP.js";
|
|
8
8
|
import {
|
|
9
9
|
MACRO
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H6NBGOQG.js";
|
|
11
11
|
|
|
12
12
|
// src/utils/session/autoUpdater.ts
|
|
13
13
|
async function getSemver() {
|
|
@@ -82,7 +82,7 @@ async function checkAndNotifyUpdate() {
|
|
|
82
82
|
const [
|
|
83
83
|
{ isAutoUpdaterDisabled, getGlobalConfig, saveGlobalConfig },
|
|
84
84
|
{ env }
|
|
85
|
-
] = await Promise.all([import("./config-
|
|
85
|
+
] = await Promise.all([import("./config-FBT5ABGI.js"), import("./env-5O5DDVID.js")]);
|
|
86
86
|
if (await isAutoUpdaterDisabled()) return;
|
|
87
87
|
if (await env.getIsDocker()) return;
|
|
88
88
|
if (!await env.hasInternetAccess()) return;
|
|
@@ -2,11 +2,11 @@ import { createRequire as __pybCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
listAllContentFiles
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6XDESUHK.js";
|
|
6
6
|
import {
|
|
7
7
|
getCwd,
|
|
8
8
|
logError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KUIDN7FP.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/fs/file.ts
|
|
12
12
|
import {
|