diff --git a/src/costrict/provider/credentials.ts b/src/costrict/provider/credentials.ts index 6a8544793..5fd7553fe 100644 --- a/src/costrict/provider/credentials.ts +++ b/src/costrict/provider/credentials.ts @@ -1,6 +1,6 @@ /** * CoStrict 凭证管理模块 - * 负责读写 ~/.claude/csc-auth.json + * 负责读写 ~/.costrict/share/auth.json */ import { promises as fs } from 'node:fs' @@ -62,7 +62,7 @@ export async function loadCoStrictCredentials(): Promise { const raw = Number(process.env.CSC_SERVE_INIT_TIMEOUT_MS) return Number.isFinite(raw) && raw > 0 ? raw : 120000 @@ -6,10 +8,18 @@ export const INIT_TIMEOUT_MS = (() => { export function getScriptArgsForChild(): string[] { const argv1 = process.argv[1] if (!argv1) return [] + // If the executable is not bun/node, we're in a compiled standalone binary. + // In compiled mode, argv[1] may be the original entrypoint path (e.g. + // "src/entrypoints/cli.tsx") which looks like a script — prevent that. + const execBase = basename(process.execPath) + if (!/^(bun|node)/i.test(execBase)) return [] // Bun standalone executable embeds a virtual snapshot path like "B:/~BUN/root/cli.js". // This is not a real file on disk — skip it so the child process (the same exe) // is not launched with a bogus script argument. if (argv1.startsWith('B:/~BUN/') || argv1.startsWith('/snapshot/')) return [] + // When running as a compiled standalone binary (./csc), argv[1] is the binary + // itself — same as execPath. Do not treat it as a script file. + if (argv1 === process.execPath) return [] if (argv1.endsWith('.ts') || argv1.endsWith('.tsx') || argv1.includes('/') || argv1.includes('\\')) { return [argv1] } @@ -58,4 +68,4 @@ export function loadChildSpawnPrefix(): { execPath: string; scriptArgs: string[] } catch { return null } -} +} \ No newline at end of file diff --git a/src/services/rawDump/README.md b/src/services/rawDump/README.md index ae990298f..a2c48177d 100644 --- a/src/services/rawDump/README.md +++ b/src/services/rawDump/README.md @@ -406,7 +406,7 @@ export CSC_RAW_DUMP_LOCAL_DIR=/tmp/raw-dump-debug | 运行时 | Effect-TS | Bun + 纯 Node.js API | | 上报模式 | 单条即时上报 | 队列 + batch worker 顺序消费 | | 限流防护 | 无 | 队列 + 单 worker + 重试 + 批次延迟 + 抖动 | -| 凭证路径 | `~/.costrict/credentials.json` | `~/.claude/csc-auth.json` | +| 凭证路径 | `~/.costrict/credentials.json` | `~/.costrict/share/auth.json` | ---