{
  "version": 3,
  "sources": ["src/infcode/cli/stdio.ts", "src/infcode/cli/commands.ts", "src/index.ts", "src/infcode/metrics/instrument/resource.ts", "src/infcode/metrics/instrument/install.ts"],
  "sourcesContent": [
    "function onStdioError(error: NodeJS.ErrnoException) {\n  // A closed output pipe must not reach a panic handler that logs to the same pipe.\n  if (error.code !== \"EPIPE\") throw error\n}\n\nprocess.stdout.on(\"error\", onStdioError)\nprocess.stderr.on(\"error\", onStdioError)\n",
    "import type { Argv, CommandModule } from \"yargs\"\nimport { withTuiOptions } from \"./tui-options\"\n\ntype Command = Omit<CommandModule<any, any>, \"handler\"> & { handler: (args: any) => void | Promise<void> }\nconst completionLoaders: (() => Promise<Command>)[] = []\n\nexport async function preloadCommandsForCompletion() {\n  await Promise.all(completionLoaders.map((load) => load()))\n}\n\nexport function lazyCommand(metadata: Omit<Command, \"builder\" | \"handler\">, load: () => Promise<Command>): Command {\n  let command: Command | undefined\n  const resolve = async () => (command ??= await load())\n  const wrapper: Command = {\n    ...metadata,\n    async builder(args) {\n      const { builder } = await resolve()\n      return typeof builder === \"function\" ? builder(args) : args.options(builder ?? {})\n    },\n    async handler(args) {\n      await (await resolve()).handler(args)\n    },\n  }\n  completionLoaders.push(async () => {\n    const original = await resolve()\n    // yargs shell completion does not await builders; install the original before registration.\n    wrapper.builder = original.builder\n    return original\n  })\n  return wrapper\n}\n\nexport const AcpCommand = lazyCommand(\n  { command: \"acp\", describe: \"start ACP (Agent Client Protocol) server\" },\n  async () => (await import(\"../../cli/cmd/acp\")).AcpCommand,\n)\nexport const McpCommand = lazyCommand(\n  { command: \"mcp\", describe: \"manage MCP (Model Context Protocol) servers\" },\n  async () => (await import(\"../../cli/cmd/mcp\")).McpCommand,\n)\nexport const TuiThreadCommand = {\n  ...lazyCommand(\n    { command: \"$0 [project]\", describe: \"start infcode tui\" },\n    async () => (await import(\"../../cli/cmd/tui/thread\")).TuiThreadCommand,\n  ),\n  // yargs does not await the default builder when displaying root --help.\n  builder: withTuiOptions,\n}\nexport const AttachCommand = lazyCommand(\n  { command: \"attach <url>\", describe: false },\n  async () => (await import(\"../../cli/cmd/tui/attach\")).AttachCommand,\n)\nexport const RunCommand = lazyCommand(\n  { command: \"run [message..]\", describe: \"run infcode with a message\" },\n  async () => (await import(\"../../cli/cmd/run\")).RunCommand,\n)\nexport const GenerateCommand = lazyCommand(\n  { command: \"generate\" },\n  async () => (await import(\"../../cli/cmd/generate\")).GenerateCommand,\n)\nexport const DebugCommand = lazyCommand(\n  { command: \"debug\", describe: \"debugging and troubleshooting tools\" },\n  async () => (await import(\"../../cli/cmd/debug\")).DebugCommand,\n)\nexport const ProvidersCommand = lazyCommand(\n  { command: \"auth\", aliases: [\"providers\"], describe: \"manage AI providers and credentials\" },\n  async () => (await import(\"../../cli/cmd/providers\")).ProvidersCommand,\n)\nexport const LoginCommand = lazyCommand(\n  { command: \"login\", describe: \"log in to InfCode via browser authorization (public or private deployment)\" },\n  async () => (await import(\"../../cli/cmd/login\")).LoginCommand,\n)\nexport const LogoutCommand = lazyCommand(\n  { command: \"logout\", describe: \"log out of InfCode and clear the local token\" },\n  async () => (await import(\"../../cli/cmd/login\")).LogoutCommand,\n)\nexport const AccountCommand = lazyCommand(\n  { command: \"account [action]\", describe: \"show InfCode account login status\" },\n  async () => (await import(\"../../cli/cmd/login\")).AccountCommand,\n)\nexport const AgentCommand = lazyCommand(\n  { command: \"agent\", describe: \"manage agents\" },\n  async () => (await import(\"../../cli/cmd/agent\")).AgentCommand,\n)\nexport const UpgradeCommand = lazyCommand(\n  { command: \"upgrade [target]\", describe: \"upgrade infcode to the latest or a specific version\" },\n  async () => (await import(\"../../cli/cmd/upgrade\")).UpgradeCommand,\n)\nexport const UninstallCommand = lazyCommand(\n  { command: \"uninstall\", describe: \"uninstall infcode and remove all related files\" },\n  async () => (await import(\"../../cli/cmd/uninstall\")).UninstallCommand,\n)\nexport const ServeCommand = lazyCommand(\n  { command: \"serve\", describe: false },\n  async () => (await import(\"../../cli/cmd/serve\")).ServeCommand,\n)\nexport const ModelsCommand = lazyCommand(\n  { command: \"models [provider]\", describe: \"list all available models\" },\n  async () => (await import(\"../../cli/cmd/models\")).ModelsCommand,\n)\nexport const StatsCommand = lazyCommand(\n  { command: \"stats\", describe: \"show token usage and cost statistics\" },\n  async () => (await import(\"../../cli/cmd/stats\")).StatsCommand,\n)\nexport const ExportCommand = lazyCommand(\n  { command: \"export [sessionID]\", describe: \"export session data as JSON\" },\n  async () => (await import(\"../../cli/cmd/export\")).ExportCommand,\n)\nexport const ImportCommand = lazyCommand(\n  { command: \"import <file>\", describe: \"import session data from JSON file or URL\" },\n  async () => (await import(\"../../cli/cmd/import\")).ImportCommand,\n)\nexport const PrCommand = lazyCommand(\n  { command: \"pr <number>\", describe: false },\n  async () => (await import(\"../../cli/cmd/pr\")).PrCommand,\n)\nexport const SessionCommand = lazyCommand(\n  { command: \"session\", describe: \"manage sessions\" },\n  async () => (await import(\"../../cli/cmd/session\")).SessionCommand,\n)\nexport const RemoteCommand = lazyCommand(\n  { command: \"remote\", describe: false },\n  async () => (await import(\"../../cli/cmd/remote\")).RemoteCommand,\n)\nexport const ConfigCLICommand = lazyCommand(\n  { command: \"config\", describe: \"configuration tools\" },\n  async () => (await import(\"../../cli/cmd/config\")).ConfigCommand,\n)\nexport const PluginCommand = lazyCommand(\n  { command: \"plugin <module>\", aliases: [\"plug\"], describe: false },\n  async () => (await import(\"../../cli/cmd/plug\")).PluginCommand,\n)\nexport const DbCommand = lazyCommand(\n  { command: \"db\", describe: \"database tools\" },\n  async () => (await import(\"../../cli/cmd/db\")).DbCommand,\n)\nexport const DevSetupCommand = lazyCommand(\n  { command: \"dev-setup\", describe: \"install a `infcodedev` shell alias for this checkout\" },\n  async () => (await import(\"../../kilocode/cli/dev-setup\")).DevSetupCommand,\n)\nexport const DevAliasCommand = lazyCommand(\n  { command: \"dev-alias [shell]\", describe: false },\n  async () => (await import(\"../../kilocode/cli/dev-setup\")).DevAliasCommand,\n)\n\nexport function createHelpCommand(root?: () => Argv) {\n  return lazyCommand({ command: \"help [command]\", describe: \"show full CLI reference\" }, async () =>\n    (await import(\"../../kilocode/help-command\")).createHelpCommand(root),\n  )\n}\n",
    "import \"./infcode/cli/stdio\" // infcode_change - handle closed pipes before startup or panic logging\n// infcode_change start - command metadata is light; implementations load only on selection.\nimport {\n  AcpCommand,\n  McpCommand,\n  TuiThreadCommand,\n  AttachCommand,\n  RunCommand,\n  GenerateCommand,\n  DebugCommand,\n  ProvidersCommand,\n  LoginCommand,\n  LogoutCommand,\n  AccountCommand,\n  AgentCommand,\n  UpgradeCommand,\n  UninstallCommand,\n  ServeCommand,\n  ModelsCommand,\n  StatsCommand,\n  ExportCommand,\n  ImportCommand,\n  PrCommand,\n  SessionCommand,\n  RemoteCommand,\n  ConfigCLICommand,\n  PluginCommand,\n  DbCommand,\n  DevSetupCommand,\n  DevAliasCommand,\n  createHelpCommand,\n  preloadCommandsForCompletion,\n} from \"./infcode/cli/commands\"\n// infcode_change end\nimport yargs from \"yargs\"\nimport { hideBin } from \"yargs/helpers\"\nimport * as Log from \"@opencode-ai/core/util/log\"\n// kilocode_change start\n// import { LoginCommand, LogoutCommand, SwitchCommand, OrgsCommand } from \"./cli/cmd/account\"\n// import { ConsoleCommand } from \"./cli/cmd/account\"\n// kilocode_change end\nimport { UI } from \"./cli/ui\"\n// infcode_change start - version constants do not load the installation service.\nimport { InstallationLocal } from \"@opencode-ai/core/installation/version\"\n// infcode_change end\nimport { InstallationBuildKind, InstallationVersion } from \"@opencode-ai/core/installation/version\" // kilocode_change - add InstallationBuildKind\nimport { NamedError } from \"@opencode-ai/core/util/error\"\nimport { FormatError } from \"./cli/error\"\n// import { GithubCommand } from \"./cli/cmd/github\" // kilocode_change\nimport { EOL } from \"os\"\n// import { WebCommand } from \"./cli/cmd/web\" // kilocode_change (Disabled unsupported opencode web UI)\n// kilocode_change start - Import telemetry, instance disposal, and legacy migration\n\n// infcode_change - set feature without importing the gateway implementation.\n// kilocode_change - set feature for tracking. 'serve' is spawned by other services\n// (extension, cloud) which set their own KILOCODE_FEATURE env var. Direct CLI use\n// (any command other than 'serve') is tagged as 'cli'. If 'serve' is spawned without\n// the env var, it gets 'unknown' so the misconfiguration is visible in data.\nif (!process.env.KILOCODE_FEATURE) {\n  const isServe = process.argv.includes(\"serve\")\n  process.env.KILOCODE_FEATURE = isServe ? \"unknown\" : \"cli\"\n}\n\n// infcode_change - the gateway reads this public environment key in the service engine.\n// kilocode_change - set version so kilo-gateway can include it in the editor name header\nif (!process.env.KILOCODE_VERSION) {\n  process.env.KILOCODE_VERSION = InstallationVersion\n}\n// kilocode_change end\nimport { Global } from \"@opencode-ai/core/global\"\nimport { Identity } from \"@kilocode/kilo-telemetry/identity\" // infcode_change\nimport { errorMessage } from \"./util/error\"\nimport { Heap } from \"./cli/heap\"\n// infcode_change start - metrics\nimport { MetricsCrash } from \"@/infcode/metrics/instrument/crash\"\nimport { MetricsResource } from \"@/infcode/metrics/instrument/resource\"\nimport { MetricsInstall } from \"@/infcode/metrics/instrument/install\"\n// infcode_change end\nimport { ensureProcessMetadata } from \"@opencode-ai/core/util/opencode-process\"\nimport { LogArchive } from \"./infcode/logs/archive\" // infcode_change\nimport { setCurrentRun } from \"./infcode/logs/current-run\" // infcode_change\nimport type { LogArchiveApp } from \"./infcode/logs/types\" // infcode_change\nimport fs from \"node:fs\" // infcode_change - panic handler 同步写 crash dump\nimport path from \"node:path\" // infcode_change - panic handler 同步写 crash dump\n\nconst processMetadata = ensureProcessMetadata(\"main\")\n\n// infcode_change start\nfunction logApp(): LogArchiveApp {\n  if (process.env.INFCODE_PLATFORM === \"vscode\") return \"vscode\"\n  if (process.env.INFCODE_PLATFORM === \"ide\") return \"ide\"\n  if (process.env.INFCODE_PLATFORM === \"jetbrains\") return \"jetbrains\"\n  return \"cli\"\n}\n\nfunction logArchiveInput() {\n  return {\n    app: logApp(),\n    root: process.env.INFCODE_LOG_ROOT,\n    // Explicit RUN_ID wins; otherwise Dev All sets INFCODE_LOG_DEBUG_PORT so the\n    // debug CLI joins the same daily run directory as the extension host.\n    id: process.env.INFCODE_LOG_RUN_ID ?? LogArchive.debugSharedRunId(process.env.INFCODE_LOG_DEBUG_PORT ?? \"\"),\n    context: { opencodePid: process.pid },\n  }\n}\n\n// Build-time / introspection-only commands that produce stdout and exit. They\n// must not create a persisted ~/.infcode/logs/<runId> archive dir: e.g. the SDK\n// build runs `kilo generate` during `bun run extension`, which would otherwise\n// leave a stray `-cli` run dir behind every build. These log to stderr instead.\nfunction skipsLogArchive(): boolean {\n  return process.argv.includes(\"generate\")\n}\n\n// infcode_change end\n\n// infcode_change start - panic handler 同步写 crash dump\n// 仅对 JS 层 uncaughtException/unhandledRejection 有效；native SIGABRT/SIGKILL 进程直接终止，\n// JS handler 不会执行，依赖 log.ts 不清空 + server-manager stderr 有界收集补偿。\nconst PANIC_DUMP_MAX_BYTES = 64 * 1024\nconst PANIC_DUMP_MAX_FILES = 5\nconst PANIC_DUMP_MAX_WRITES = 10\nconst LOG_PREFIX = \"[cli:panic]\"\nconst log = Log.create({ service: LOG_PREFIX })\nconst PANIC_TRUNCATED_MARKER = \"\\n[--- panic dump truncated at 64KB ---]\\n\"\nlet panicWriteCount = 0\n// infcode_change - F10: 优先用 LogArchive.create() 产出的 archive.dir，\n// 其次 Log.file() 的目录，最后兜底 Global.Path.log\nlet archiveRunDir: string | null = null\n\nfunction writePanicDump(kind: string, e: unknown): void {\n  // infcode_change - F11: 先自增再尝试，成功与否都计数；超限后静默返回不重复写 stderr\n  if (panicWriteCount >= PANIC_DUMP_MAX_WRITES) return\n  panicWriteCount++\n  if (panicWriteCount === PANIC_DUMP_MAX_WRITES) {\n    log.warn(\"panic dump limit reached; further dumps suppressed\", { limit: PANIC_DUMP_MAX_WRITES })\n  }\n  try {\n    // infcode_change - F5/F10: 优先用 archiveRunDir，其次 Log.file() 推导，最后 Global.Path.log 兜底\n    const logFile = Log.file()\n    const runDir = archiveRunDir ?? (logFile ? path.dirname(logFile) : null) ?? Global.Path.log\n    const ts = new Date().toISOString().replace(/[:.]/g, \"\")\n    const dumpFile = path.join(runDir, `infcode.panic.${ts}.log`)\n    const errObj = e instanceof Error ? e : { name: typeof e, message: errorMessage(e), stack: undefined }\n    const header = [\n      `timestamp: ${new Date().toISOString()}`,\n      `pid: ${process.pid}`,\n      `kind: ${kind}`,\n      `error_type: ${errObj.name}`,\n      `message: ${errObj.message}`,\n      \"\",\n      \"stack:\",\n      errObj.stack ?? \"(no stack)\",\n      \"\",\n    ].join(\"\\n\")\n    let body = header\n    if (Buffer.byteLength(body) > PANIC_DUMP_MAX_BYTES) {\n      const buf = Buffer.from(body)\n      body = buf.subarray(0, PANIC_DUMP_MAX_BYTES).toString() + PANIC_TRUNCATED_MARKER\n    }\n    // 同一毫秒内多次触发追加到同一文件\n    fs.writeFileSync(dumpFile, body, { flag: \"a\" })\n    // 清理多余的 panic 文件（保留最近 5 个）\n    try {\n      const entries = fs.readdirSync(runDir)\n      const panicFiles = entries\n        .filter((name) => name.startsWith(\"infcode.panic.\") && name.endsWith(\".log\"))\n        .sort()\n      if (panicFiles.length > PANIC_DUMP_MAX_FILES) {\n        for (const name of panicFiles.slice(0, panicFiles.length - PANIC_DUMP_MAX_FILES)) {\n          try {\n            fs.unlinkSync(path.join(runDir, name))\n          } catch {}\n        }\n      }\n    } catch {}\n  } catch (writeErr) {\n    try {\n      log.warn(\"panic dump write failed\", { error: JSON.stringify(errorMessage(writeErr)) })\n    } catch {}\n  }\n}\n// infcode_change end\n\nprocess.on(\"unhandledRejection\", (e) => {\n  writePanicDump(\"unhandledRejection\", e) // infcode_change - 同步写 crash dump（排在最前，确保落盘）\n  MetricsCrash.unhandledRejection(e) // infcode_change - metrics\n  Log.Default.error(\"rejection\", {\n    e: errorMessage(e),\n  })\n})\n\nprocess.on(\"uncaughtException\", (e) => {\n  writePanicDump(\"uncaughtException\", e) // infcode_change - 同步写 crash dump（排在最前，确保落盘）\n  MetricsCrash.uncaughtException(e) // infcode_change - metrics\n  Log.Default.error(\"exception\", {\n    e: errorMessage(e),\n  })\n})\n\n// infcode_change start - Browser dev servers outlive the CLI/IDE that requested them.\n// The detached runner must initialize its own archive because it exits before yargs middleware.\nif (process.env.INFCODE_BROWSER_DEV_SERVER_RUNNER) {\n  const level: Log.Level = InstallationLocal ? \"DEBUG\" : \"INFO\"\n  try {\n    const archive = await LogArchive.create({\n      app: logApp(),\n      root: process.env.INFCODE_LOG_ROOT,\n      logLevel: level,\n      context: { opencodePid: process.pid },\n    })\n    archiveRunDir = archive.dir // infcode_change - F10: 供 writePanicDump 优先使用\n    await Log.init({\n      print: false,\n      dev: InstallationLocal,\n      path: archive.files.infcode,\n      level,\n    })\n    LogArchive.cleanupInBackground({ root: process.env.INFCODE_LOG_ROOT })\n    if (archive.manifestWarning) {\n      Log.Default.warn(\"runner log manifest update failed; continuing with existing manifest\", {\n        error: archive.manifestWarning,\n        run_id: archive.id,\n      })\n    }\n  } catch (error) {\n    await Log.init({\n      print: true,\n      dev: InstallationLocal,\n      level,\n    })\n    Log.Default.warn(\"runner log archive unavailable; continuing with stderr only\", {\n      error: errorMessage(error),\n    })\n  }\n\n  try {\n    const { BrowserDevServerRunner } = await import(\"@/infcode/browser/local-service/browser-dev-server-runner\")\n    const input = BrowserDevServerRunner.environmentInput()\n    if (!input) throw new Error(\"Development server runner input is missing\")\n    await BrowserDevServerRunner.run(input)\n    process.exit(0)\n  } catch (error) {\n    Log.Default.error(\"browser development server runner failed\", {\n      error: errorMessage(error),\n    })\n    await Bun.sleep(50)\n    process.exit(1)\n  }\n}\n// infcode_change end\n\nconst args = hideBin(process.argv)\nconst installSnapshot = await MetricsInstall.snapshot() // infcode_change - capture before log archive creates HostData\n\nfunction show(out: string) {\n  const text = out.trimStart()\n  const end = out.endsWith(EOL) ? \"\" : EOL // kilocode_change - keep shell prompt on the next line\n  if (!text.startsWith(\"opencode \")) {\n    process.stderr.write(UI.logo() + EOL + EOL)\n    process.stderr.write(text + end) // kilocode_change\n    return\n  }\n  process.stderr.write(out + end) // kilocode_change\n}\n\n// infcode_change start - loaded only by commands that own server state.\nlet lifecycle: typeof import(\"./infcode/cli/lifecycle\") | undefined\n\n// completion captures synchronous builders when commands are registered.\nconst helpCommand = createHelpCommand(() => cli)\nif (args.includes(\"--get-yargs-completions\")) await preloadCommandsForCompletion()\n// infcode_change end\n\nlet cli = yargs(args) // kilocode_change\n  .parserConfiguration({ \"populate--\": true })\n  .scriptName(\"infcode\") // kilocode_change — infcode_change: rebrand CLI command prefix\n  .wrap(100)\n  .help(\"help\", \"show help\")\n  .alias(\"help\", \"h\")\n  .version(\"version\", \"show version number\", InstallationVersion)\n  .alias(\"version\", \"v\")\n  .option(\"print-logs\", {\n    describe: \"print logs to stderr\",\n    type: \"boolean\",\n  })\n  .option(\"log-level\", {\n    describe: \"log level\",\n    type: \"string\",\n    choices: [\"DEBUG\", \"INFO\", \"WARN\", \"ERROR\"],\n  })\n  .option(\"pure\", {\n    describe: \"run without external plugins\",\n    type: \"boolean\",\n  })\n  .middleware(async (opts) => {\n    if (opts.pure) {\n      process.env.KILO_PURE = \"1\"\n    }\n\n    // infcode_change start\n    const level = (() => {\n      if (opts.logLevel) return opts.logLevel as Log.Level\n      if (InstallationLocal) return \"DEBUG\"\n      return \"INFO\"\n    })()\n\n    // Build-time commands (e.g. `kilo generate`) skip the per-run archive dir so\n    // they don't litter ~/.infcode/logs with stray `-cli` runs on every build.\n    // Their logs fall back to the shared dev/global log file instead.\n    if (skipsLogArchive()) {\n      await Log.init({\n        print: process.argv.includes(\"--print-logs\"),\n        dev: InstallationLocal,\n        level,\n      })\n    } else {\n      // Archive is diagnostics-only: create / per-run Log.init failure must not\n      // block CLI startup. Fall back to stderr-only (print:true, no path) so a\n      // broken global log dir cannot fail startup a second time.\n      const archiveInput = logArchiveInput()\n      try {\n        const archive = await LogArchive.create({ ...archiveInput, logLevel: level })\n        archiveRunDir = archive.dir // infcode_change - F10: 供 writePanicDump 优先使用\n        // infcode_change start - 需求 7135614630 评审返工（O 老师 F1）：serve 主进程同样注册当前 run。\n        // TUI 的 thread 模式由 worker.ts 注册（Server 在 worker 线程）；`infcode serve` 的 Server\n        // 运行在本进程，attach 客户端经 HTTP 提交反馈时由 serve 进程的注册表缺省取值——注册表\n        // 为进程内模块状态，attach 客户端自身的注册不会跨进程生效，不替代服务端目录。\n        setCurrentRun({ runId: archive.id, runDir: archive.dir })\n        // infcode_change end\n        if (archiveInput.app === \"cli\") LogArchive.cleanupInBackground({ root: archiveInput.root })\n\n        try {\n          await Log.init({\n            print: process.argv.includes(\"--print-logs\"),\n            dev: InstallationLocal,\n            path: archive.files.infcode,\n            level,\n          })\n          if (archive.manifestWarning) {\n            Log.Default.warn(\"log manifest update failed; continuing with existing manifest\", {\n              error: archive.manifestWarning,\n              run_id: archive.id,\n            })\n          }\n        } catch (error) {\n          await Log.init({\n            print: true,\n            dev: InstallationLocal,\n            level,\n          })\n          Log.Default.warn(\"log archive file init failed; continuing with stderr only\", {\n            error: errorMessage(error),\n            run_id: archive.id,\n          })\n        }\n      } catch (error) {\n        await Log.init({\n          print: true,\n          dev: InstallationLocal,\n          level,\n        })\n        Log.Default.warn(\"log archive unavailable; continuing with stderr only\", {\n          error: errorMessage(error),\n        })\n      }\n    }\n    // infcode_change end\n\n    Heap.start()\n    MetricsResource.start() // infcode_change - §6.7 opencode 资源自采样\n\n    process.env.AGENT = \"1\"\n    process.env.KILO = \"1\" // kilocode_change\n    process.env.KILO_PID = String(process.pid)\n\n    Log.Default.info(\"opencode\", {\n      version: InstallationVersion,\n      args: process.argv.slice(2),\n      process_role: processMetadata.processRole,\n      run_id: processMetadata.runID,\n    })\n\n    // infcode_change start - legacy UI plugins and feedback keep their original main-thread services.\n    if (process.env.INFCODE_TUI_PREVIEW === \"0\" || (opts._.length > 0 && opts._[0] !== \"attach\")) {\n      lifecycle = await import(\"./infcode/cli/lifecycle\")\n      await lifecycle.initializeCliServices()\n    } else {\n      // Keep client metrics identity; persist before Worker startup to avoid first-run ID races.\n      Identity.setDataPath(Global.Path.data)\n      await Identity.getMachineId()\n    }\n    await MetricsInstall.reportIfCreated(installSnapshot)\n    // infcode_change end\n  })\n  .usage(\"\")\n  .completion(\"completion\", \"generate shell completion script\")\n  .command(AcpCommand)\n  .command(McpCommand)\n  .command(TuiThreadCommand)\n  .command(AttachCommand)\n  .command(RunCommand)\n  .command(GenerateCommand)\n  .command(DebugCommand)\n  // kilocode_change start\n  // .command(LoginCommand)\n  // .command(LogoutCommand)\n  // .command(SwitchCommand)\n  // .command(OrgsCommand)\n  // .command(ConsoleCommand)\n  // kilocode_change end\n  .command(ProvidersCommand)\n  // infcode_change start - terminal auth commands (browser-callback login)\n  .command(LoginCommand)\n  .command(LogoutCommand)\n  .command(AccountCommand)\n  // infcode_change end\n  .command(AgentCommand)\n  .command(UpgradeCommand)\n  .command(UninstallCommand)\n  .command(ServeCommand)\n  // .command(WebCommand) // kilocode_change (Disabled unsupported opencode web UI)\n  .command(ModelsCommand)\n  .command(StatsCommand)\n  .command(ExportCommand)\n  .command(ImportCommand)\n  // .command(GithubCommand) // kilocode_change (Disabled until backend is ready)\n  .command(PrCommand)\n  .command(SessionCommand)\n  .command(RemoteCommand) // kilocode_change\n  .command(ConfigCLICommand) // kilocode_change\n  .command(PluginCommand)\n  .command(DbCommand)\n\n// kilocode_change start - dev-only commands are hidden from release builds\nif (InstallationBuildKind !== \"release\") {\n  cli = cli.command(DevSetupCommand).command(DevAliasCommand)\n}\n// kilocode_change end\n\n// kilocode_change start - registered after initial chain to avoid self-referential type error\ncli = cli.command(helpCommand) // infcode_change\n\ncli = cli\n  // kilocode_change end\n  .fail((msg, err) => {\n    if (\n      msg?.startsWith(\"Unknown argument\") ||\n      msg?.startsWith(\"Not enough non-option arguments\") ||\n      msg?.startsWith(\"Invalid values:\")\n    ) {\n      if (err) throw err\n      cli.showHelp(show)\n    }\n    if (err) throw err\n    process.exit(1)\n  })\n  .strict()\n\ntry {\n  if (args.includes(\"-h\") || args.includes(\"--help\")) {\n    await cli.parse(args, (err: Error | undefined, _argv: unknown, out: string) => {\n      if (err) throw err\n      if (!out) return\n      show(out)\n    })\n  } else {\n    await cli.parse()\n  }\n} catch (e) {\n  MetricsCrash.fatal(e) // infcode_change - metrics\n  let data: Record<string, any> = {}\n  if (e instanceof NamedError) {\n    const obj = e.toObject()\n    Object.assign(data, {\n      ...obj.data,\n    })\n  }\n\n  if (e instanceof Error) {\n    Object.assign(data, {\n      name: e.name,\n      message: e.message,\n      cause: e.cause?.toString(),\n      stack: e.stack,\n    })\n  }\n\n  if (e instanceof ResolveMessage) {\n    Object.assign(data, {\n      name: e.name,\n      message: e.message,\n      code: e.code,\n      specifier: e.specifier,\n      referrer: e.referrer,\n      position: e.position,\n      importKind: e.importKind,\n    })\n  }\n  Log.Default.error(\"fatal\", data)\n  const formatted = FormatError(e)\n  if (formatted) UI.error(formatted)\n  if (formatted === undefined) {\n    UI.error(\"Unexpected error, check log file at \" + Log.file() + \" for more details\" + EOL)\n    process.stderr.write(errorMessage(e) + EOL)\n  }\n  process.exitCode = 1\n} finally {\n  // infcode_change start - clients still own metrics, but only the service engine owns server cleanup.\n  if (lifecycle) {\n    await lifecycle.shutdownCliServices()\n  } else {\n    const { Metrics } = await import(\"./infcode/metrics/metrics\")\n    await Metrics.shutdown()\n  }\n  // infcode_change end\n\n  // Some subprocesses don't react properly to SIGTERM and similar signals.\n  // Most notably, some docker-container-based MCP servers don't handle such signals unless\n  // run using `docker run --init`.\n  // Explicitly exit to avoid any hanging subprocesses.\n  process.exit()\n}\n",
    "// infcode_change - new file（§6.7 opencode 资源自采样）\nimport * as Log from \"@opencode-ai/core/util/log\"\nimport { Metrics } from \"../metrics\"\nimport { MetricsUri } from \"../uris\"\n\nconst LOG_PREFIX = \"[metrics:resource]\"\nconst log = Log.create({ service: LOG_PREFIX })\n\nconst DEFAULT_INTERVAL_MS = 60_000\n\ntype Sampler = {\n  memory: () => NodeJS.MemoryUsage\n  cpu: (previous?: NodeJS.CpuUsage) => NodeJS.CpuUsage\n  now: () => number\n}\n\nconst defaultSampler: Sampler = {\n  memory: () => process.memoryUsage(),\n  cpu: (previous) => process.cpuUsage(previous),\n  now: () => Date.now(),\n}\n\ntype State = {\n  timer: Timer | undefined\n  prevCpu: NodeJS.CpuUsage | undefined\n  prevAt: number | undefined\n  sampler: Sampler\n}\n\nconst state: State = { timer: undefined, prevCpu: undefined, prevAt: undefined, sampler: defaultSampler }\n\n/**\n * 定时把 opencode 进程的 RSS / CPU 作为 gauge 上报（设计 §6.7：精确资源值以 opencode 自报为准）。\n * - 用 `unref()` 定时器，不阻止进程退出；埋点 fire-and-forget，失败只记 debug。\n * - CPU 取区间增量算占比，需要持有上一次 cpuUsage 与时间戳。\n */\nexport namespace MetricsResource {\n  export function start(intervalMs: number = DEFAULT_INTERVAL_MS) {\n    if (state.timer) return\n    state.prevCpu = state.sampler.cpu()\n    state.prevAt = state.sampler.now()\n    const timer = setInterval(() => sample(), intervalMs)\n    timer.unref?.()\n    state.timer = timer\n  }\n\n  export function stop() {\n    if (state.timer) clearInterval(state.timer)\n    state.timer = undefined\n    state.prevCpu = undefined\n    state.prevAt = undefined\n  }\n\n  /** 测试钩子：注入采样源并触发一次采样。 */\n  export function configureForTest(sampler: Partial<Sampler>) {\n    state.sampler = { ...defaultSampler, ...sampler }\n  }\n\n  export function sampleForTest() {\n    sample()\n  }\n\n  export function resetForTest() {\n    stop()\n    state.sampler = defaultSampler\n  }\n}\n\nfunction sample() {\n  try {\n    const mem = state.sampler.memory()\n    Metrics.performance({ uri: MetricsUri.processRss, value: mem.rss, unit: \"bytes\" })\n\n    const now = state.sampler.now()\n    let cpuPercent: number | undefined\n    if (state.prevCpu && state.prevAt !== undefined) {\n      const delta = state.sampler.cpu(state.prevCpu) // user+system 微秒增量\n      const elapsedUs = Math.max(1, (now - state.prevAt) * 1000)\n      cpuPercent = Math.round((((delta.user + delta.system) / elapsedUs) * 100) * 10) / 10\n      Metrics.performance({ uri: MetricsUri.processCpu, value: cpuPercent, unit: \"percent\" })\n    }\n    state.prevCpu = state.sampler.cpu()\n    state.prevAt = now\n    // 便于直接在 infcode.log 里看资源情况（与上报的 gauge 同源）。\n    // debug 级：默认不刷屏，需要逐分钟观察时再开（采样/上报仍按 60s 不变）。\n    log.debug(\"resource sample\", { rssBytes: mem.rss, rssMB: Math.round(mem.rss / 1048576), cpuPercent })\n  } catch (err) {\n    log.debug(\"resource sample failed\", { error: err instanceof Error ? err.message : String(err) })\n  }\n}\n",
    "// infcode_change - new file\nimport fs from \"fs/promises\"\nimport path from \"path\"\nimport * as Log from \"@opencode-ai/core/util/log\"\nimport { AuthStorage } from \"@/infcode/auth/storage\"\nimport { Metrics } from \"@/infcode/metrics/metrics\"\nimport { MetricsUri } from \"@/infcode/metrics/uris\"\n\nconst LOG_PREFIX = \"[metrics:install]\"\nconst log = Log.create({ service: LOG_PREFIX })\n\nexport namespace MetricsInstall {\n  export type Options = {\n    dir?: string\n  }\n\n  export type Snapshot = {\n    dir: string\n    existed: boolean\n  }\n\n  export async function snapshot(input: Options = {}): Promise<Snapshot> {\n    const dir = resolveDir(input)\n    return {\n      dir,\n      existed: await exists(dir),\n    }\n  }\n\n  export function markerPath(input: Options = {}) {\n    return path.join(resolveDir(input), \"metrics\", \"first-install.json\")\n  }\n\n  export async function reportIfCreated(snapshot: Snapshot) {\n    if (snapshot.existed) return\n    if (!(await exists(snapshot.dir))) return\n\n    const marker = markerPath({ dir: snapshot.dir })\n    if (await exists(marker)) return\n\n    const accepted = Metrics.tryRecord({ kind: \"page_view\", uri: MetricsUri.productInstallFirstStart })\n    if (!accepted) return\n\n    await writeMarker(marker)\n  }\n}\n\nfunction resolveDir(input: MetricsInstall.Options) {\n  return AuthStorage.dir(input.dir ? { dir: input.dir } : {})\n}\n\nasync function exists(file: string) {\n  return fs\n    .stat(file)\n    .then(() => true)\n    .catch(() => false)\n}\n\nasync function writeMarker(file: string) {\n  try {\n    await fs.mkdir(path.dirname(file), { recursive: true, mode: 0o700 })\n    await fs.writeFile(\n      file,\n      `${JSON.stringify({\n        schema: 1,\n        uri: MetricsUri.productInstallFirstStart,\n        createdAt: new Date().toISOString(),\n      })}\\n`,\n      { flag: \"wx\", mode: 0o600 },\n    )\n  } catch (err) {\n    if (hasCode(err, \"EEXIST\")) return\n    log.warn(\"failed to write first install marker\", {\n      file,\n      error: err instanceof Error ? err.message : String(err),\n    })\n  }\n}\n\nfunction hasCode(err: unknown, code: string) {\n  return typeof err === \"object\" && err !== null && \"code\" in err && err.code === code\n}\n"
  ],
  "mappings": ";80BAAA,SAAS,CAAY,CAAC,EAA8B,CAElD,GAAI,EAAM,OAAS,QAAS,MAAM,EAGpC,QAAQ,OAAO,GAAG,QAAS,CAAY,EACvC,QAAQ,OAAO,GAAG,QAAS,CAAY,ECFvC,IAAM,EAAgD,CAAC,EAEvD,eAAsB,CAA4B,EAAG,CACnD,MAAM,QAAQ,IAAI,EAAkB,IAAI,CAAC,IAAS,EAAK,CAAC,CAAC,EAGpD,SAAS,CAAW,CAAC,EAAgD,EAAuC,CACjH,IAAI,EACE,EAAU,SAAa,IAAY,MAAM,EAAK,EAC9C,EAAmB,IACpB,OACG,QAAO,CAAC,EAAM,CAClB,IAAQ,WAAY,MAAM,EAAQ,EAClC,OAAO,OAAO,IAAY,WAAa,EAAQ,CAAI,EAAI,EAAK,QAAQ,GAAW,CAAC,CAAC,QAE7E,QAAO,CAAC,EAAM,CAClB,MAAO,MAAM,EAAQ,GAAG,QAAQ,CAAI,EAExC,EAOA,OANA,EAAkB,KAAK,SAAY,CACjC,IAAM,EAAW,MAAM,EAAQ,EAG/B,OADA,EAAQ,QAAU,EAAS,QACpB,EACR,EACM,EAGF,IAAM,EAAa,EACxB,CAAE,QAAS,MAAO,SAAU,0CAA2C,EACvE,UAAa,KAAa,2CAAsB,UAClD,EACa,EAAa,EACxB,CAAE,QAAS,MAAO,SAAU,6CAA8C,EAC1E,UAAa,KAAa,2CAAsB,UAClD,EACa,EAAmB,IAC3B,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