@epoch-agent/cli 2.8.0 → 3.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +1015 -884
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // src/index.ts
3
3
  import { Command } from "commander";
4
- import { t as t39 } from "@epoch-agent/infra";
4
+ import { t as t40 } from "@epoch-agent/infra";
5
5
  // src/commands/agents.ts
6
6
  import { AGENT_ROLE_DIAG_MODULE, findRole, roleSourceLabel } from "@epoch-agent/core";
7
7
  import { t as t2, UNLIMITED_TURNS } from "@epoch-agent/infra";
@@ -98,7 +98,7 @@ function renderRoleDetail(role) {
98
98
  const lines = [...renderRole(role), ""];
99
99
  if (role.prompt) {
100
100
  lines.push(` ${t2("agents.prompt_head")}`);
101
- for (const line of role.prompt.split("\n")) lines.push(` ${line}`);
101
+ for (const line2 of role.prompt.split("\n")) lines.push(` ${line2}`);
102
102
  } else {
103
103
  lines.push(` ${t2("agents.prompt_none")}`);
104
104
  }
@@ -115,7 +115,7 @@ function registerAgentsCommand(program2) {
115
115
  log(`${t2("agents.list_head", { count: rt.agentRoles.length })}
116
116
  `);
117
117
  for (const role of rt.agentRoles) {
118
- for (const line of renderRole(role)) log(line);
118
+ for (const line2 of renderRole(role)) log(line2);
119
119
  log("");
120
120
  }
121
121
  const notes = rt.diagnosticList.filter((d) => d.module === AGENT_ROLE_DIAG_MODULE);
@@ -139,7 +139,7 @@ function registerAgentsCommand(program2) {
139
139
  available ? t2("agents.err_available", { names: available }) : t2("agents.err_none_loaded")
140
140
  );
141
141
  }
142
- for (const line of renderRoleDetail(role)) log(line);
142
+ for (const line2 of renderRoleDetail(role)) log(line2);
143
143
  });
144
144
  });
145
145
  }
@@ -450,13 +450,18 @@ function registerComplianceCommand(program2) {
450
450
  }
451
451
  // src/commands/config.ts
452
452
  import { existsSync as existsSync2, readFileSync } from "fs";
453
- import { maskApiKey, t as t5 } from "@epoch-agent/infra";
453
+ import {
454
+ checkConfigValue,
455
+ configKeyByPath,
456
+ writableConfigKeys
457
+ } from "@epoch-agent/core";
458
+ import { maskApiKey, t as t6 } from "@epoch-agent/infra";
454
459
  import {
455
460
  API_KEY_ENV_VARS,
456
461
  isEntrySecretName,
457
- isPermissionLevel,
458
462
  parseModelRef,
459
463
  PERMISSION_LEVELS,
464
+ resolvePermissionLevel,
460
465
  SHELL_KINDS
461
466
  } from "@epoch-agent/protocol";
462
467
  // src/files/config-yaml.ts
@@ -470,69 +475,139 @@ import {
470
475
  unsetSectionField,
471
476
  writeConfigYaml
472
477
  } from "@epoch-agent/infra";
473
- // src/commands/config.ts
478
+ // src/commands/config-list.ts
479
+ import {
480
+ configKeyTable,
481
+ getConfigOrigins,
482
+ loadConfig as loadConfig2
483
+ } from "@epoch-agent/core";
484
+ import { t as t5 } from "@epoch-agent/infra";
474
485
  var log3 = (msg) => {
475
486
  process.stdout.write(msg + "\n");
476
487
  };
477
- function isPositiveNumber(v) {
478
- const n = Number(v);
479
- return Number.isFinite(n) && n > 0;
480
- }
481
- function isPositiveInt(v) {
482
- return isPositiveNumber(v) && Number.isInteger(Number(v));
483
- }
484
- function isTurnLimit(v) {
485
- const n = Number(v);
486
- return Number.isInteger(n) && n >= 0;
487
- }
488
- var BUDGET_FIELDS = {
489
- maxCostUsd: isPositiveNumber,
490
- maxTokens: isPositiveNumber,
491
- warnAtPercent: (v) => isPositiveNumber(v) && Number(v) <= 100,
492
- onUnknownPricing: (v) => v === "block" || v === "warn"
493
- };
494
- var SCALAR_FIELDS = {
495
- maxTurns: isTurnLimit,
496
- contextLength: isPositiveInt,
497
- maxOutputTokens: isPositiveInt
498
- };
499
- var SECTION_FIELDS = {
500
- budget: BUDGET_FIELDS,
501
- compression: {
502
- enabled: (v) => v === "true" || v === "false",
503
- threshold: (v) => Number.isFinite(Number(v)) && Number(v) > 0 && Number(v) <= 1
504
- },
505
- memory: {
506
- memoryCharLimit: isPositiveInt,
507
- userCharLimit: isPositiveInt,
508
- indexCharLimit: isPositiveInt
509
- },
510
- sessions: {
511
- autoPrune: (v) => v === "true" || v === "false",
512
- retentionDays: isPositiveInt,
513
- vacuumAfterPrune: (v) => v === "true" || v === "false"
514
- },
515
- automation: {
516
- keepRuns: isPositiveInt,
517
- maxRecordingMb: isPositiveInt
518
- },
519
- sessionSearch: {
520
- allWorkspaces: (v) => v === "true" || v === "false"
488
+ function registerListCommand(cmd) {
489
+ cmd.command("list").description(t5("cli.config.list")).option("--all", t5("cli.config.opt_all")).option("--section <name>", t5("cli.config.opt_section")).option("--json", t5("cli.config.opt_json")).action((opts, command) => {
490
+ const states = collectStates(opts.section);
491
+ if (jsonWanted(opts, command)) log3(JSON.stringify(renderJson(states, opts)));
492
+ else renderText(states, opts);
493
+ });
494
+ }
495
+ function jsonWanted(opts, command) {
496
+ if (opts.json === true) return true;
497
+ return command.parent?.parent?.opts().json === true;
498
+ }
499
+ function collectStates(section, homeDir) {
500
+ const table = configKeyTable();
501
+ const picked = section === void 0 ? table : table.filter((entry) => inSection(entry, section));
502
+ if (section !== void 0 && picked.length === 0) {
503
+ throw new CliError(
504
+ t5("cli.config.unknown_section", { section }),
505
+ 1,
506
+ t5("cli.config.opt_section")
507
+ );
508
+ }
509
+ const config = loadConfig2(void 0, homeDir === void 0 ? {} : { homeDir });
510
+ const origins = getConfigOrigins();
511
+ return picked.map((entry) => {
512
+ const value = valueAt(config, entry.path);
513
+ const source = sourceOf(origins, entry.path);
514
+ return {
515
+ entry,
516
+ ...value === void 0 ? {} : { value },
517
+ ...source === void 0 ? {} : { source }
518
+ };
519
+ });
520
+ }
521
+ function inSection(entry, section) {
522
+ return entry.path === section || entry.path.startsWith(`${section}.`);
523
+ }
524
+ function valueAt(config, path) {
525
+ let current = config;
526
+ for (const segment of path.split(".")) {
527
+ if (current === null || typeof current !== "object") return void 0;
528
+ current = current[segment];
529
+ }
530
+ return current;
531
+ }
532
+ function sourceOf(origins, path) {
533
+ if (origins.env.has(path)) return "env";
534
+ if (origins.file.has(path)) return "file";
535
+ return void 0;
536
+ }
537
+ function renderJson(states, opts) {
538
+ const rows = states.filter(
539
+ (state) => opts.all === true || opts.section !== void 0 || state.source !== void 0
540
+ );
541
+ return {
542
+ ...opts.section === void 0 ? {} : { section: opts.section },
543
+ total: states.length,
544
+ shown: rows.length,
545
+ keys: rows.map((state) => ({
546
+ path: state.entry.path,
547
+ kind: state.entry.kind,
548
+ write: state.entry.write,
549
+ ...state.source === void 0 ? {} : { source: state.source },
550
+ ...state.value === void 0 ? {} : { value: state.value },
551
+ ...state.entry.builtin === void 0 ? {} : { builtin: state.entry.builtin },
552
+ ...state.entry.choices === void 0 ? {} : { choices: state.entry.choices }
553
+ }))
554
+ };
555
+ }
556
+ function renderText(states, opts) {
557
+ const rows = states.filter(
558
+ (state) => opts.all === true || opts.section !== void 0 || state.source !== void 0
559
+ );
560
+ if (rows.length === 0) {
561
+ log3(t5("cli.config.list_empty", { total: states.length }));
562
+ return;
521
563
  }
564
+ const head = opts.section !== void 0 ? t5("cli.config.list_section_head", { section: opts.section, count: rows.length }) : opts.all === true ? t5("cli.config.list_all_head", { total: rows.length }) : t5("cli.config.list_set_head", { count: rows.length });
565
+ log3(head);
566
+ const width = Math.max(...rows.map((state) => state.entry.path.length));
567
+ for (const state of rows) log3(` ${line(state, width)}`);
568
+ const unset = states.length - rows.length;
569
+ if (opts.all !== true && opts.section === void 0 && unset > 0) {
570
+ log3("");
571
+ log3(t5("cli.config.list_more", { count: unset }));
572
+ }
573
+ if (opts.all === true && rows.length > 20) {
574
+ log3("");
575
+ log3(t5("cli.config.list_truncation_hint", { total: rows.length }));
576
+ }
577
+ }
578
+ function line(state, width) {
579
+ const path = state.entry.path.padEnd(width);
580
+ const value = formatValue(state.value) ?? t5("cli.config.value_unset");
581
+ const notes = [];
582
+ if (state.source !== void 0) notes.push(sourceLabel(state.source));
583
+ notes.push(state.entry.kind);
584
+ if (state.entry.builtin !== void 0) {
585
+ notes.push(t5("cli.config.value_builtin", { value: formatValue(state.entry.builtin) ?? "" }));
586
+ }
587
+ if (state.entry.write !== "scalar") notes.push(t5("cli.config.value_not_settable"));
588
+ return `${path} = ${value.padEnd(16)}(${notes.join(", ")})`;
589
+ }
590
+ function formatValue(value) {
591
+ if (value === void 0) return void 0;
592
+ if (typeof value === "string") return value;
593
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
594
+ const text = JSON.stringify(value);
595
+ return text.length > 40 ? `${text.slice(0, 40)}\u2026` : text;
596
+ }
597
+ function sourceLabel(source) {
598
+ return source === "env" ? t5("cli.config.source_env") : t5("cli.config.source_file");
599
+ }
600
+ // src/commands/config.ts
601
+ var log4 = (msg) => {
602
+ process.stdout.write(msg + "\n");
522
603
  };
523
604
  function knownKeys() {
524
- const nested = Object.entries(SECTION_FIELDS).flatMap(
525
- ([section, fields]) => Object.keys(fields).map((field) => `${section}.${field}`)
526
- );
527
- return [
528
- "model",
529
- "models.utility",
530
- "fallback.model",
531
- "permission",
532
- "shell",
533
- ...Object.keys(SCALAR_FIELDS),
534
- ...nested
535
- ].join(", ");
605
+ const keys = writableConfigKeys().map((entry) => entry.path);
606
+ const lines = [];
607
+ for (let i = 0; i < keys.length; i += 4) {
608
+ lines.push(` ${keys.slice(i, i + 4).join(", ")}`);
609
+ }
610
+ return lines.join("\n");
536
611
  }
537
612
  function maskSecrets(yaml) {
538
613
  return yaml.replace(/^(\s*(?:apiKey|api_key|token|secret)\s*:\s*)(.+)$/gim, (_m, head, raw) => {
@@ -542,88 +617,89 @@ function maskSecrets(yaml) {
542
617
  });
543
618
  }
544
619
  function registerConfigCommand(program2) {
545
- const cmd = program2.command("config").description(t5("cli.config.summary"));
546
- cmd.command("show").description(t5("cli.config.show")).option("--raw", t5("cli.config.opt_raw")).action((opts) => {
620
+ const cmd = program2.command("config").description(t6("cli.config.summary"));
621
+ cmd.command("show").description(t6("cli.config.show")).option("--raw", t6("cli.config.opt_raw")).action((opts) => {
547
622
  if (!existsSync2(CONFIG_PATH)) {
548
- log3(t5("cli.config.not_configured"));
623
+ log4(t6("cli.config.not_configured"));
549
624
  } else {
550
625
  const yaml = readFileSync(CONFIG_PATH, "utf-8").trim();
551
- log3(opts.raw ? yaml : maskSecrets(yaml));
626
+ log4(opts.raw ? yaml : maskSecrets(yaml));
552
627
  }
553
628
  });
554
- cmd.command("path").description(t5("cli.config.path")).action(() => log3(CONFIG_PATH));
555
- cmd.command("get").description(t5("cli.config.get")).argument("<key>", t5("cli.config.keys")).action((key) => {
629
+ cmd.command("path").description(t6("cli.config.path")).action(() => log4(CONFIG_PATH));
630
+ cmd.command("get").description(t6("cli.config.get")).argument("<key>", t6("cli.config.keys")).action((key) => {
556
631
  const value = readKey(readConfigYaml(CONFIG_PATH), key);
557
- if (value === void 0) throw new CliError(t5("cli.config.unset_key", { key }));
558
- log3(value);
632
+ if (value === void 0) throw new CliError(t6("cli.config.unset_key", { key }));
633
+ log4(value);
559
634
  });
560
- cmd.command("set").description(t5("cli.config.set")).argument("<key>", t5("cli.config.keys")).argument("<value>", t5("cli.config.value")).action((key, value) => {
635
+ cmd.command("set").description(t6("cli.config.set")).argument("<key>", t6("cli.config.keys")).argument("<value>", t6("cli.config.value")).action((key, value) => {
561
636
  ensureEpochHome();
562
637
  writeConfigYaml(CONFIG_PATH, applySet(readConfigYaml(CONFIG_PATH), key, value));
563
- log3(`\u2705 ${key} = ${value}`);
638
+ log4(`\u2705 ${key} = ${value}`);
564
639
  });
565
- cmd.command("unset").description(t5("cli.config.unset")).argument("<key>", t5("cli.config.keys_unset")).action((key) => {
640
+ cmd.command("unset").description(t6("cli.config.unset")).argument("<key>", t6("cli.config.keys_unset")).action((key) => {
566
641
  ensureEpochHome();
567
642
  writeConfigYaml(CONFIG_PATH, applyUnset(readConfigYaml(CONFIG_PATH), key));
568
- log3(`\u2705 ${t5("cli.config.removed", { key })}`);
643
+ log4(`\u2705 ${t6("cli.config.removed", { key })}`);
569
644
  });
645
+ registerListCommand(cmd);
570
646
  registerSchemaCommand(cmd);
571
647
  registerSecretCommand(cmd);
572
648
  }
573
649
  function registerSchemaCommand(cmd) {
574
- cmd.command("schema").description(t5("cli.config.schema")).action(async () => {
650
+ cmd.command("schema").description(t6("cli.config.schema")).action(async () => {
575
651
  const { resolveProjectRoot: resolveProjectRoot4 } = await import("@epoch-agent/core");
576
652
  const root = resolveProjectRoot4(process.cwd());
577
653
  const { writeProjectSchemas } = await import("./schema-file-DH6X4N4K.js");
578
654
  const written = await writeProjectSchemas(root);
579
- for (const entry of written) log3(`\u2705 ${entry.path}`);
580
- log3("");
581
- log3(t5("cli.config.schema_paste_hint"));
582
- log3(` { "$schema": "${written[0]?.reference ?? ""}", \u2026 }`);
655
+ for (const entry of written) log4(`\u2705 ${entry.path}`);
656
+ log4("");
657
+ log4(t6("cli.config.schema_paste_hint"));
658
+ log4(` { "$schema": "${written[0]?.reference ?? ""}", \u2026 }`);
583
659
  });
584
660
  }
585
661
  function registerSecretCommand(cmd) {
586
- cmd.command("secret").description(t5("cli.config.secret")).option("--export", t5("cli.config.opt_export")).action(async (opts) => {
662
+ cmd.command("secret").description(t6("cli.config.secret")).option("--export", t6("cli.config.opt_export")).action(async (opts) => {
587
663
  const { ensureSecretsReady } = await import("@epoch-agent/runtime");
588
664
  await ensureSecretsReady();
589
665
  const { getSecretStore } = await import("@epoch-agent/infra");
590
666
  const store = getSecretStore();
591
- if (!store) throw new CliError(t5("cli.config.secret_not_ready"));
667
+ if (!store) throw new CliError(t6("cli.config.secret_not_ready"));
592
668
  if (opts.export) await exportSecrets(store);
593
669
  else await printSecretStatus(store);
594
670
  });
595
671
  }
596
672
  async function printSecretStatus(store) {
597
- log3(
598
- `${store.encrypted ? "\u2713" : "\u26A0"} ${t5("cli.config.secret_backend", {
673
+ log4(
674
+ `${store.encrypted ? "\u2713" : "\u26A0"} ${t6("cli.config.secret_backend", {
599
675
  backend: store.backend,
600
676
  detail: store.detail
601
677
  })}`
602
678
  );
603
679
  const names = (await store.list()).filter(isModelSecret);
604
680
  if (names.length === 0) {
605
- log3(t5("cli.config.secret_empty"));
681
+ log4(t6("cli.config.secret_empty"));
606
682
  return;
607
683
  }
608
- for (const name of names) log3(` ${name}`);
684
+ for (const name of names) log4(` ${name}`);
609
685
  }
610
686
  async function exportSecrets(store) {
611
687
  const { isNonInteractive: isNonInteractive9 } = await import("@epoch-agent/core");
612
688
  if (isNonInteractive9()) {
613
- throw new CliError(t5("cli.config.export_needs_tty"), 1, t5("cli.config.export_needs_tty_hint"));
689
+ throw new CliError(t6("cli.config.export_needs_tty"), 1, t6("cli.config.export_needs_tty_hint"));
614
690
  }
615
691
  const { confirm } = await import("@inquirer/prompts");
616
- log3(t5("cli.config.export_about_to", { path: ENV_PATH }));
617
- if (!await confirm({ message: t5("cli.config.export_confirm"), default: false })) {
618
- log3(t5("cli.config.cancelled"));
692
+ log4(t6("cli.config.export_about_to", { path: ENV_PATH }));
693
+ if (!await confirm({ message: t6("cli.config.export_confirm"), default: false })) {
694
+ log4(t6("cli.config.cancelled"));
619
695
  return;
620
696
  }
621
697
  const again = await confirm({
622
- message: t5("cli.config.export_confirm_again", { path: ENV_PATH }),
698
+ message: t6("cli.config.export_confirm_again", { path: ENV_PATH }),
623
699
  default: false
624
700
  });
625
701
  if (!again) {
626
- log3(t5("cli.config.cancelled"));
702
+ log4(t6("cli.config.cancelled"));
627
703
  return;
628
704
  }
629
705
  ensureEpochHome();
@@ -634,36 +710,37 @@ async function exportSecrets(store) {
634
710
  (await store.list()).filter(isModelSecret)
635
711
  );
636
712
  if (written.length === 0) {
637
- log3(t5("cli.config.export_nothing"));
713
+ log4(t6("cli.config.export_nothing"));
638
714
  return;
639
715
  }
640
- log3(`\u2705 ${t5("cli.config.export_done", { count: written.length, path: ENV_PATH })}`);
641
- log3(t5("cli.config.export_done_note"));
716
+ log4(`\u2705 ${t6("cli.config.export_done", { count: written.length, path: ENV_PATH })}`);
717
+ log4(t6("cli.config.export_done_note"));
642
718
  }
643
719
  function applySet(yaml, key, value) {
644
720
  switch (key) {
645
721
  case "model":
646
722
  assertEntryRef(key, value);
647
723
  return setScalar(yaml, "model", quoteEntryRef(value));
648
- case "permission":
649
- if (!isPermissionLevel(value)) {
724
+ case "permission": {
725
+ const level = resolvePermissionLevel(value);
726
+ if (!level) {
650
727
  throw new CliError(
651
- t5("cli.config.unknown_permission", { value }),
728
+ t6("cli.config.unknown_permission", { value }),
652
729
  1,
653
- t5("cli.config.supported", { list: PERMISSION_LEVELS.join(", ") })
730
+ t6("cli.config.supported", { list: PERMISSION_LEVELS.join(", ") })
654
731
  );
655
732
  }
656
- return setScalar(yaml, "permission", value);
657
- case "shell": {
733
+ return setScalar(yaml, "permission", level);
734
+ }
735
+ case "shell":
658
736
  if (!SHELL_KINDS.includes(value)) {
659
737
  throw new CliError(
660
- t5("cli.config.unknown_shell", { value }),
738
+ t6("cli.config.unknown_shell", { value }),
661
739
  1,
662
- t5("cli.config.supported", { list: SHELL_KINDS.join(", ") })
740
+ t6("cli.config.supported", { list: SHELL_KINDS.join(", ") })
663
741
  );
664
742
  }
665
743
  return setScalar(yaml, "shell", value);
666
- }
667
744
  case "models.utility":
668
745
  case "fallback.model": {
669
746
  assertEntryRef(key, value);
@@ -671,45 +748,104 @@ function applySet(yaml, key, value) {
671
748
  return setSectionField(yaml, section, field, quoteEntryRef(value));
672
749
  }
673
750
  default: {
674
- const scalar = SCALAR_FIELDS[key];
675
- if (scalar) {
676
- if (!scalar(value)) throw new CliError(t5("cli.config.bad_value", { key, value }));
677
- return setScalar(yaml, key, value);
678
- }
679
- const [section, field] = splitSection(key);
680
- const validate = field === void 0 ? void 0 : SECTION_FIELDS[section]?.[field];
681
- if (!validate || field === void 0)
682
- throw new CliError(
683
- t5("cli.config.unknown_key", { key }),
684
- 1,
685
- t5("cli.config.supported", { list: knownKeys() })
686
- );
687
- if (!validate(value)) throw new CliError(t5("cli.config.bad_value", { key, value }));
688
- return setSectionField(yaml, section, field, value);
751
+ const entry = writableEntry(key);
752
+ const check = checkConfigValue(entry, value);
753
+ if (!check.ok) throw badValue(key, value, check.problem);
754
+ return writeEntry(yaml, entry, check.literal);
689
755
  }
690
756
  }
691
757
  }
692
758
  function applyUnset(yaml, key) {
693
- if (key === "model" || key === "permission" || key === "shell") return unsetScalar(yaml, key);
694
- if (SCALAR_FIELDS[key]) return unsetScalar(yaml, key);
695
- if (key === "models.utility") return unsetSectionField(yaml, "models", "utility");
696
- if (key === "fallback.model") return unsetSectionField(yaml, "fallback", "model");
697
- const [section, field] = splitSection(key);
698
- if (field !== void 0 && SECTION_FIELDS[section]?.[field]) {
699
- return unsetSectionField(yaml, section, field);
759
+ switch (key) {
760
+ case "model":
761
+ case "permission":
762
+ case "shell":
763
+ return unsetScalar(yaml, key);
764
+ case "models.utility":
765
+ return unsetSectionField(yaml, "models", "utility");
766
+ case "fallback.model":
767
+ return unsetSectionField(yaml, "fallback", "model");
768
+ default: {
769
+ const entry = writableEntry(key);
770
+ return entry.field === void 0 ? unsetScalar(yaml, entry.path) : unsetSectionField(yaml, sectionOf(entry), entry.field);
771
+ }
772
+ }
773
+ }
774
+ function writableEntry(key) {
775
+ const entry = configKeyByPath(key);
776
+ if (entry === void 0) {
777
+ throw new CliError(
778
+ t6("cli.config.unknown_key", { key }),
779
+ 1,
780
+ t6("cli.config.supported", { list: knownKeys() })
781
+ );
782
+ }
783
+ if (entry.write === "blocked") {
784
+ throw new CliError(
785
+ t6("cli.config.not_a_setting", { key }),
786
+ 1,
787
+ t6("cli.config.not_a_setting_hint")
788
+ );
789
+ }
790
+ if (entry.write === "manual") {
791
+ const message = entry.reason === "nested" ? t6("cli.config.manual_nested", { key }) : t6("cli.config.manual_structured", { key });
792
+ throw new CliError(message, 1, t6("cli.config.manual_only_hint", { path: CONFIG_PATH }));
793
+ }
794
+ return entry;
795
+ }
796
+ function writeEntry(yaml, entry, literal) {
797
+ if (entry.field === void 0) return setScalar(yaml, entry.path, literal);
798
+ return setSectionField(yaml, sectionOf(entry), entry.field, literal);
799
+ }
800
+ function sectionOf(entry) {
801
+ return entry.section ?? entry.path;
802
+ }
803
+ function badValue(key, value, problem) {
804
+ switch (problem.code) {
805
+ case "not-a-kind":
806
+ return new CliError(
807
+ t6("cli.config.bad_value_kind", { key, value, kind: kindLabel(problem.kind) })
808
+ );
809
+ case "not-in-choices":
810
+ return new CliError(
811
+ t6("cli.config.unknown_choice", { key, value }),
812
+ 1,
813
+ t6("cli.config.supported", { list: problem.choices.join(", ") })
814
+ );
815
+ case "below-minimum":
816
+ case "above-maximum":
817
+ return new CliError(
818
+ t6("cli.config.bad_value_range", { key, value, range: rangeText(problem) }),
819
+ 1,
820
+ t6("cli.config.range_hint")
821
+ );
822
+ case "too-short":
823
+ return new CliError(t6("cli.config.bad_value_empty", { key }));
700
824
  }
701
- throw new CliError(t5("cli.config.cannot_unset", { key }), 1, t5("cli.config.can_unset"));
702
825
  }
703
- function splitSection(key) {
704
- const dot = key.indexOf(".");
705
- return dot < 0 ? [key, void 0] : [key.slice(0, dot), key.slice(dot + 1)];
826
+ function kindLabel(kind) {
827
+ switch (kind) {
828
+ case "integer":
829
+ return t6("cli.config.kind_integer");
830
+ case "number":
831
+ return t6("cli.config.kind_number");
832
+ case "boolean":
833
+ return t6("cli.config.kind_boolean");
834
+ default:
835
+ return t6("cli.config.kind_string");
836
+ }
837
+ }
838
+ function rangeText(problem) {
839
+ const below = problem.code === "below-minimum";
840
+ const op = below ? problem.exclusive ? ">" : ">=" : problem.exclusive ? "<" : "<=";
841
+ return `${op} ${problem.bound}`;
706
842
  }
707
843
  function assertEntryRef(key, value) {
708
844
  if (parseModelRef(value)) return;
709
845
  throw new CliError(
710
- t5("cli.config.model_ref_invalid", { key, value }),
846
+ t6("cli.config.model_ref_invalid", { key, value }),
711
847
  1,
712
- t5("cli.config.model_ref_hint")
848
+ t6("cli.config.model_ref_hint")
713
849
  );
714
850
  }
715
851
  function quoteEntryRef(value) {
@@ -719,87 +855,87 @@ function isModelSecret(name) {
719
855
  return isEntrySecretName(name) || API_KEY_ENV_VARS.includes(name);
720
856
  }
721
857
  // src/commands/mcp.ts
722
- import { t as t6, uiDateLocale } from "@epoch-agent/infra";
858
+ import { t as t7, uiDateLocale } from "@epoch-agent/infra";
723
859
  import {
724
860
  listMcpServers,
725
861
  mcpLogin,
726
862
  mcpLogout,
727
863
  probeMcpServer
728
864
  } from "@epoch-agent/runtime";
729
- var log4 = (msg) => process.stdout.write(msg + "\n");
865
+ var log5 = (msg) => process.stdout.write(msg + "\n");
730
866
  var warn = (msg) => process.stderr.write(msg + "\n");
731
867
  function stateLabel(state) {
732
868
  switch (state) {
733
869
  case "not-applicable":
734
- return t6("mcp.state_not_applicable");
870
+ return t7("mcp.state_not_applicable");
735
871
  case "bearer-header":
736
- return t6("mcp.state_bearer");
872
+ return t7("mcp.state_bearer");
737
873
  case "authorized":
738
- return t6("mcp.state_authorized");
874
+ return t7("mcp.state_authorized");
739
875
  case "refreshable":
740
- return t6("mcp.state_refreshable");
876
+ return t7("mcp.state_refreshable");
741
877
  case "logged-out":
742
- return t6("mcp.state_logged_out");
878
+ return t7("mcp.state_logged_out");
743
879
  }
744
880
  }
745
881
  function registerMcpCommand(program2) {
746
- const cmd = program2.command("mcp").description(t6("mcp.cmd_root"));
747
- cmd.command("list", { isDefault: true }).description(t6("mcp.cmd_list")).action(() => guardAsync(() => printList()));
748
- cmd.command("status").description(t6("mcp.cmd_status")).argument("<name>", t6("mcp.arg_name")).action(
882
+ const cmd = program2.command("mcp").description(t7("mcp.cmd_root"));
883
+ cmd.command("list", { isDefault: true }).description(t7("mcp.cmd_list")).action(() => guardAsync(() => printList()));
884
+ cmd.command("status").description(t7("mcp.cmd_status")).argument("<name>", t7("mcp.arg_name")).action(
749
885
  (name) => guardAsync(async () => {
750
- log4(t6("mcp.connecting", { name }));
886
+ log5(t7("mcp.connecting", { name }));
751
887
  const result = await probeMcpServer(name, { homeDir: EPOCH_HOME });
752
888
  if (!result.connected) {
753
889
  warn(
754
- result.error ? t6("mcp.connect_failed_reason", { reason: result.error }) : t6("mcp.connect_failed")
890
+ result.error ? t7("mcp.connect_failed_reason", { reason: result.error }) : t7("mcp.connect_failed")
755
891
  );
756
- if (result.needsLogin) warn(t6("mcp.needs_login", { name }));
892
+ if (result.needsLogin) warn(t7("mcp.needs_login", { name }));
757
893
  process.exit(1);
758
894
  }
759
- log4(`\u2713 ${t6("mcp.connected", { count: result.toolNames.length })}`);
760
- for (const tool of result.toolNames) log4(` ${tool}`);
895
+ log5(`\u2713 ${t7("mcp.connected", { count: result.toolNames.length })}`);
896
+ for (const tool of result.toolNames) log5(` ${tool}`);
761
897
  })
762
898
  );
763
- cmd.command("login").description(t6("mcp.cmd_login")).argument("<name>", t6("mcp.arg_name")).option("--port <port>", t6("mcp.opt_port")).option("--scope <scope>", t6("mcp.opt_scope")).action(
899
+ cmd.command("login").description(t7("mcp.cmd_login")).argument("<name>", t7("mcp.arg_name")).option("--port <port>", t7("mcp.opt_port")).option("--scope <scope>", t7("mcp.opt_scope")).action(
764
900
  (name, opts) => guardAsync(async () => {
765
901
  const port = opts.port === void 0 ? void 0 : parsePort(opts.port);
766
902
  const { refreshedOnly } = await mcpLogin(name, {
767
903
  homeDir: EPOCH_HOME,
768
904
  ...port === void 0 ? {} : { port },
769
905
  ...opts.scope === void 0 ? {} : { scope: opts.scope },
770
- print: log4
906
+ print: log5
771
907
  });
772
- log4(
773
- refreshedOnly ? `\u2713 ${t6("mcp.refreshed", { name })}` : `\u2713 ${t6("mcp.authorized", { name })}`
908
+ log5(
909
+ refreshedOnly ? `\u2713 ${t7("mcp.refreshed", { name })}` : `\u2713 ${t7("mcp.authorized", { name })}`
774
910
  );
775
911
  })
776
912
  );
777
- cmd.command("logout").description(t6("mcp.cmd_logout")).argument("<name>", t6("mcp.arg_name")).action(
913
+ cmd.command("logout").description(t7("mcp.cmd_logout")).argument("<name>", t7("mcp.arg_name")).action(
778
914
  (name) => guardAsync(async () => {
779
915
  const removed = await mcpLogout(name, { homeDir: EPOCH_HOME });
780
- log4(removed ? `\u2713 ${t6("mcp.removed", { name })}` : t6("mcp.nothing_stored", { name }));
916
+ log5(removed ? `\u2713 ${t7("mcp.removed", { name })}` : t7("mcp.nothing_stored", { name }));
781
917
  })
782
918
  );
783
919
  }
784
920
  async function printList() {
785
921
  const { servers, issues, configPath: configPath2 } = await listMcpServers({ homeDir: EPOCH_HOME });
786
922
  for (const issue of issues)
787
- warn(t6("mcp.config_issue", { path: issue.path, message: issue.message }));
788
- log4(t6("mcp.list_head", { path: configPath2 }));
923
+ warn(t7("mcp.config_issue", { path: issue.path, message: issue.message }));
924
+ log5(t7("mcp.list_head", { path: configPath2 }));
789
925
  if (servers.length === 0) {
790
- log4(t6("mcp.list_empty"));
926
+ log5(t7("mcp.list_empty"));
791
927
  return;
792
928
  }
793
- for (const s of servers) log4(` ${describe(s)}`);
929
+ for (const s of servers) log5(` ${describe(s)}`);
794
930
  }
795
931
  function describe(s) {
796
932
  const target = s.config.transport === "stdio" ? s.config.command : s.config.url;
797
933
  const parts = [
798
934
  `${s.config.name} [${s.config.transport}] ${target ?? ""}`,
799
- t6("mcp.auth_line", { state: stateLabel(s.auth.state) })
935
+ t7("mcp.auth_line", { state: stateLabel(s.auth.state) })
800
936
  ];
801
937
  if (s.auth.expiresAt) {
802
- parts[1] += t6("mcp.expires_at", {
938
+ parts[1] += t7("mcp.expires_at", {
803
939
  when: new Date(s.auth.expiresAt).toLocaleString(uiDateLocale())
804
940
  });
805
941
  }
@@ -808,34 +944,34 @@ function describe(s) {
808
944
  function parsePort(raw) {
809
945
  const port = Number(raw);
810
946
  if (!Number.isInteger(port) || port < 1024 || port > 65535) {
811
- throw new Error(t6("mcp.bad_port", { raw }));
947
+ throw new Error(t7("mcp.bad_port", { raw }));
812
948
  }
813
949
  return port;
814
950
  }
815
951
  function guardAsync(fn) {
816
952
  fn().catch((err2) => {
817
- warn(t6("mcp.error", { message: err2 instanceof Error ? err2.message : String(err2) }));
953
+ warn(t7("mcp.error", { message: err2 instanceof Error ? err2.message : String(err2) }));
818
954
  process.exit(1);
819
955
  });
820
956
  }
821
957
  // src/commands/model.ts
822
958
  import { input, password, select } from "@inquirer/prompts";
823
- import { isNonInteractive, loadConfig as loadConfig2 } from "@epoch-agent/core";
824
- import { t as t7 } from "@epoch-agent/infra";
959
+ import { isNonInteractive, loadConfig as loadConfig3 } from "@epoch-agent/core";
960
+ import { t as t8 } from "@epoch-agent/infra";
825
961
  import {
826
962
  entryDisplayName,
827
963
  PROVIDER_INFOS,
828
964
  PROVIDER_TYPES
829
965
  } from "@epoch-agent/protocol";
830
966
  import { buildModelEntriesControl, providerLabel } from "@epoch-agent/runtime";
831
- var log5 = (msg) => process.stdout.write(msg + "\n");
967
+ var log6 = (msg) => process.stdout.write(msg + "\n");
832
968
  var CUSTOM = "__custom__";
833
969
  function registerModelCommand(program2) {
834
- program2.command("model").description(t7("model.cmd_root")).option("-r, --refresh", t7("model.opt_refresh")).action(async (opts) => {
970
+ program2.command("model").description(t8("model.cmd_root")).option("-r, --refresh", t8("model.opt_refresh")).action(async (opts) => {
835
971
  ensureEpochHome();
836
972
  if (opts.refresh) return refreshCache();
837
973
  if (isNonInteractive()) {
838
- throw new CliError(t7("model.needs_tty"), 1, t7("model.needs_tty_hint"));
974
+ throw new CliError(t8("model.needs_tty"), 1, t8("model.needs_tty_hint"));
839
975
  }
840
976
  await runWizard();
841
977
  });
@@ -843,18 +979,18 @@ function registerModelCommand(program2) {
843
979
  async function refreshCache() {
844
980
  const { clearModelCache } = await import("@epoch-agent/core");
845
981
  for (const type of PROVIDER_TYPES) clearModelCache(EPOCH_HOME, type);
846
- log5(t7("model.cache_cleared"));
982
+ log6(t8("model.cache_cleared"));
847
983
  }
848
984
  async function runWizard() {
849
985
  await ensureSecrets();
850
986
  const control = buildModelEntriesControl({
851
987
  homeDir: EPOCH_HOME,
852
- config: () => loadConfig2(),
988
+ config: () => loadConfig3(),
853
989
  onChanged: () => void 0,
854
990
  onRefChanged: () => void 0
855
991
  });
856
992
  const provider = await select({
857
- message: t7("model.pick_provider"),
993
+ message: t8("model.pick_provider"),
858
994
  choices: providerChoices(),
859
995
  pageSize: listPageSize(PROVIDER_INFOS.filter((p) => p.interactive).length)
860
996
  });
@@ -862,24 +998,24 @@ async function runWizard() {
862
998
  const apiKey = await askApiKey(provider);
863
999
  const draft = { provider, ...baseUrl ? { baseUrl } : {} };
864
1000
  const models = await control.discover({ ...draft, model: "" }, apiKey ?? void 0);
865
- log5(models.length > 0 ? t7("model.from_api", { count: models.length }) : t7("model.list_empty"));
1001
+ log6(models.length > 0 ? t8("model.from_api", { count: models.length }) : t8("model.list_empty"));
866
1002
  const model = await pickModel(models);
867
1003
  let saved;
868
1004
  try {
869
1005
  saved = await control.save({ ...draft, model }, apiKey ?? void 0);
870
1006
  } catch (err2) {
871
1007
  throw new CliError(
872
- t7("model.save_failed", { reason: err2 instanceof Error ? err2.message : String(err2) }),
1008
+ t8("model.save_failed", { reason: err2 instanceof Error ? err2.message : String(err2) }),
873
1009
  EXIT_CODES.FAILURE,
874
- t7("model.save_failed_hint")
1010
+ t8("model.save_failed_hint")
875
1011
  );
876
1012
  }
877
1013
  const { entry } = saved;
878
1014
  control.setRef("model", entry.id);
879
- log5(
1015
+ log6(
880
1016
  `
881
- \u2705 ${t7("model.saved", { name: entryDisplayName(entry), id: entry.id })}
882
- ${t7("model.ready")}`
1017
+ \u2705 ${t8("model.saved", { name: entryDisplayName(entry), id: entry.id })}
1018
+ ${t8("model.ready")}`
883
1019
  );
884
1020
  }
885
1021
  async function ensureSecrets() {
@@ -887,7 +1023,7 @@ async function ensureSecrets() {
887
1023
  const { ensureSecretsReady } = await import("@epoch-agent/runtime");
888
1024
  await ensureSecretsReady();
889
1025
  } catch (err2) {
890
- log5(t7("model.secret_init_failed", { reason: describeError(err2) }));
1026
+ log6(t8("model.secret_init_failed", { reason: describeError(err2) }));
891
1027
  }
892
1028
  }
893
1029
  async function askApiKey(provider) {
@@ -895,7 +1031,7 @@ async function askApiKey(provider) {
895
1031
  const optional = provider === "openai-compatible";
896
1032
  for (; ; ) {
897
1033
  const typed = (await password({
898
- message: optional ? t7("model.api_key_optional") : t7("model.api_key"),
1034
+ message: optional ? t8("model.api_key_optional") : t8("model.api_key"),
899
1035
  mask: "*"
900
1036
  })).trim();
901
1037
  if (typed || optional) return typed || null;
@@ -903,10 +1039,10 @@ async function askApiKey(provider) {
903
1039
  }
904
1040
  async function askBaseUrl() {
905
1041
  for (; ; ) {
906
- const answer = (await input({ message: t7("model.ask_base_url"), default: "http://localhost:8080/v1" })).trim();
1042
+ const answer = (await input({ message: t8("model.ask_base_url"), default: "http://localhost:8080/v1" })).trim();
907
1043
  if (!answer) return void 0;
908
1044
  if (isHttpUrl(answer)) return answer;
909
- log5(t7("model.base_url_invalid", { value: answer }));
1045
+ log6(t8("model.base_url_invalid", { value: answer }));
910
1046
  }
911
1047
  }
912
1048
  function isHttpUrl(value) {
@@ -921,14 +1057,14 @@ async function pickModel(models) {
921
1057
  const choices3 = modelChoices(models);
922
1058
  if (choices3.length > 0) {
923
1059
  const picked = await select({
924
- message: t7("model.pick_model"),
1060
+ message: t8("model.pick_model"),
925
1061
  choices: choices3,
926
1062
  pageSize: listPageSize(choices3.length)
927
1063
  });
928
1064
  if (picked !== CUSTOM) return picked;
929
1065
  }
930
1066
  for (; ; ) {
931
- const typed = (await input({ message: t7("model.type_model") })).trim();
1067
+ const typed = (await input({ message: t8("model.type_model") })).trim();
932
1068
  if (typed) return typed;
933
1069
  }
934
1070
  }
@@ -942,7 +1078,7 @@ function modelChoices(models) {
942
1078
  if (models.length === 0) return [];
943
1079
  return [
944
1080
  ...models.map((m) => ({ name: m, value: m })),
945
- { name: t7("model.custom_entry"), value: CUSTOM }
1081
+ { name: t8("model.custom_entry"), value: CUSTOM }
946
1082
  ];
947
1083
  }
948
1084
  function listPageSize(itemCount, rows = process.stdout.rows) {
@@ -979,10 +1115,10 @@ import {
979
1115
  marketplacesPath,
980
1116
  pluginsDir,
981
1117
  pluginsStatePath,
982
- t as t8
1118
+ t as t9
983
1119
  } from "@epoch-agent/infra";
984
1120
  import { PLUGIN_CATEGORY_DISPLAY_SEP } from "@epoch-agent/protocol";
985
- var log6 = (msg) => {
1121
+ var log7 = (msg) => {
986
1122
  process.stdout.write(msg + "\n");
987
1123
  };
988
1124
  function locations() {
@@ -993,91 +1129,91 @@ function locations() {
993
1129
  };
994
1130
  }
995
1131
  function registerPluginCommand(program2) {
996
- const cmd = program2.command("plugin").description(t8("plugin.cmd_root"));
1132
+ const cmd = program2.command("plugin").description(t9("plugin.cmd_root"));
997
1133
  registerBasics(cmd);
998
1134
  registerLifecycle(cmd);
999
1135
  registerMarketplace(cmd);
1000
1136
  }
1001
1137
  function registerBasics(cmd) {
1002
- cmd.command("list", { isDefault: true }).alias("ls").description(t8("plugin.cmd_list")).option("--verbose", t8("plugin.opt_verbose")).action((opts) => {
1138
+ cmd.command("list", { isDefault: true }).alias("ls").description(t9("plugin.cmd_list")).option("--verbose", t9("plugin.opt_verbose")).action((opts) => {
1003
1139
  printList2(opts.verbose === true);
1004
1140
  });
1005
- cmd.command("install").alias("add").description(t8("plugin.cmd_install")).argument("<source>", t8("plugin.arg_source")).option("-y, --yes", t8("plugin.opt_yes_install")).action(async (source, opts) => {
1141
+ cmd.command("install").alias("add").description(t9("plugin.cmd_install")).argument("<source>", t9("plugin.arg_source")).option("-y, --yes", t9("plugin.opt_yes_install")).action(async (source, opts) => {
1006
1142
  await runInstall(source, opts.yes === true);
1007
1143
  });
1008
- cmd.command("validate").description(t8("plugin.cmd_validate")).argument("[path]", t8("plugin.arg_dir")).action((path) => {
1144
+ cmd.command("validate").description(t9("plugin.cmd_validate")).argument("[path]", t9("plugin.arg_dir")).action((path) => {
1009
1145
  validateDir(path ?? process.cwd());
1010
1146
  });
1011
- cmd.command("pack").description(t8("plugin.cmd_pack")).argument("[path]", t8("plugin.arg_dir")).option("--out <dir>", t8("plugin.opt_out")).action(async (path, opts) => {
1147
+ cmd.command("pack").description(t9("plugin.cmd_pack")).argument("[path]", t9("plugin.arg_dir")).option("--out <dir>", t9("plugin.opt_out")).action(async (path, opts) => {
1012
1148
  await packDir(path ?? process.cwd(), opts.out);
1013
1149
  });
1014
1150
  }
1015
1151
  function registerLifecycle(cmd) {
1016
- cmd.command("uninstall").alias("rm").description(t8("plugin.cmd_uninstall")).argument("<name>", t8("plugin.arg_name")).action(async (name) => {
1152
+ cmd.command("uninstall").alias("rm").description(t9("plugin.cmd_uninstall")).argument("<name>", t9("plugin.arg_name")).action(async (name) => {
1017
1153
  const outcome = await uninstallPlugin(name, { statePath: pluginsStatePath(EPOCH_HOME) });
1018
1154
  if (!outcome.ok) throw new CliError(outcome.reason);
1019
- log6(`\u2713 ${outcome.message}`);
1155
+ log7(`\u2713 ${outcome.message}`);
1020
1156
  });
1021
- cmd.command("disable").description(t8("plugin.cmd_disable")).argument("<name>", t8("plugin.arg_name")).action(async (name) => {
1157
+ cmd.command("disable").description(t9("plugin.cmd_disable")).argument("<name>", t9("plugin.arg_name")).action(async (name) => {
1022
1158
  await toggle(name, false);
1023
1159
  });
1024
- cmd.command("enable").description(t8("plugin.cmd_enable")).argument("<name>", t8("plugin.arg_name")).action(async (name) => {
1160
+ cmd.command("enable").description(t9("plugin.cmd_enable")).argument("<name>", t9("plugin.arg_name")).action(async (name) => {
1025
1161
  await toggle(name, true);
1026
1162
  });
1027
- cmd.command("update").description(t8("plugin.cmd_update")).argument("<name>", t8("plugin.arg_name")).option("-y, --yes", t8("plugin.opt_yes")).action(async (name, opts) => {
1163
+ cmd.command("update").description(t9("plugin.cmd_update")).argument("<name>", t9("plugin.arg_name")).option("-y, --yes", t9("plugin.opt_yes")).action(async (name, opts) => {
1028
1164
  await runUpdate(name, opts.yes === true);
1029
1165
  });
1030
1166
  }
1031
1167
  function registerMarketplace(cmd) {
1032
- const market = cmd.command("marketplace").alias("mp").description(t8("plugin.cmd_market"));
1033
- market.command("add").description(t8("plugin.cmd_market_add")).argument("<source>", t8("plugin.arg_market_source")).action(async (source) => {
1168
+ const market = cmd.command("marketplace").alias("mp").description(t9("plugin.cmd_market"));
1169
+ market.command("add").description(t9("plugin.cmd_market_add")).argument("<source>", t9("plugin.arg_market_source")).action(async (source) => {
1034
1170
  const outcome = await addMarketplace(source, { statePath: marketplacesPath(EPOCH_HOME) });
1035
1171
  if (!outcome.ok) throw new CliError(outcome.reason);
1036
1172
  const count = outcome.record.catalog.plugins.length;
1037
- log6(`\u2713 ${t8("plugin.market_added", { name: outcome.record.name, count })}`);
1038
- log6(t8("plugin.market_added_hint"));
1173
+ log7(`\u2713 ${t9("plugin.market_added", { name: outcome.record.name, count })}`);
1174
+ log7(t9("plugin.market_added_hint"));
1039
1175
  });
1040
- market.command("list", { isDefault: true }).alias("ls").description(t8("plugin.cmd_market_list")).action(printMarketplaces);
1041
- market.command("remove").alias("rm").description(t8("plugin.cmd_market_remove")).argument("<name>", t8("plugin.arg_market_name")).action(async (name) => {
1176
+ market.command("list", { isDefault: true }).alias("ls").description(t9("plugin.cmd_market_list")).action(printMarketplaces);
1177
+ market.command("remove").alias("rm").description(t9("plugin.cmd_market_remove")).argument("<name>", t9("plugin.arg_market_name")).action(async (name) => {
1042
1178
  const outcome = await removeMarketplace(name, { statePath: marketplacesPath(EPOCH_HOME) });
1043
1179
  if (!outcome.ok)
1044
- throw new CliError(outcome.reason ?? t8("plugin.market_remove_failed", { name }));
1045
- log6(`\u2713 ${t8("plugin.market_removed", { name })}`);
1180
+ throw new CliError(outcome.reason ?? t9("plugin.market_remove_failed", { name }));
1181
+ log7(`\u2713 ${t9("plugin.market_removed", { name })}`);
1046
1182
  });
1047
- market.command("update").description(t8("plugin.cmd_market_update")).argument("<name>", t8("plugin.arg_market_name")).action(async (name) => {
1183
+ market.command("update").description(t9("plugin.cmd_market_update")).argument("<name>", t9("plugin.arg_market_name")).action(async (name) => {
1048
1184
  const outcome = await updateMarketplace(name, { statePath: marketplacesPath(EPOCH_HOME) });
1049
1185
  if (!outcome.ok) throw new CliError(outcome.reason);
1050
- log6(
1051
- `\u2713 ${t8("plugin.market_updated", {
1186
+ log7(
1187
+ `\u2713 ${t9("plugin.market_updated", {
1052
1188
  name,
1053
1189
  count: outcome.record.catalog.plugins.length
1054
1190
  })}`
1055
1191
  );
1056
1192
  });
1057
- cmd.command("search").description(t8("plugin.cmd_search")).argument("[keyword]", t8("plugin.arg_keyword")).action((keyword) => {
1193
+ cmd.command("search").description(t9("plugin.cmd_search")).argument("[keyword]", t9("plugin.arg_keyword")).action((keyword) => {
1058
1194
  printSearch(keyword ?? "");
1059
1195
  });
1060
1196
  }
1061
1197
  function printList2(verbose) {
1062
1198
  const artifacts = loadPlugins({ statePath: pluginsStatePath(EPOCH_HOME) });
1063
1199
  if (artifacts.loaded.length === 0 && artifacts.skipped.length === 0) {
1064
- log6(t8("plugin.none_installed"));
1065
- log6(t8("plugin.none_installed_hint"));
1200
+ log7(t9("plugin.none_installed"));
1201
+ log7(t9("plugin.none_installed_hint"));
1066
1202
  return;
1067
1203
  }
1068
- log6(`${t8("plugin.installed_head", { path: pluginsStatePath(EPOCH_HOME) })}
1204
+ log7(`${t9("plugin.installed_head", { path: pluginsStatePath(EPOCH_HOME) })}
1069
1205
  `);
1070
1206
  for (const plugin of artifacts.loaded) {
1071
- log6(loadedLine(plugin));
1207
+ log7(loadedLine(plugin));
1072
1208
  if (!verbose) continue;
1073
1209
  const rows = renderInventory(scanPluginDir(plugin.dir, plugin.name));
1074
- for (const line of rows) log6(` ${line}`);
1075
- if (rows.length > 0) log6("");
1210
+ for (const line2 of rows) log7(` ${line2}`);
1211
+ if (rows.length > 0) log7("");
1076
1212
  }
1077
- for (const skipped of artifacts.skipped) log6(skippedLine(skipped));
1078
- if (artifacts.skipped.length > 0) log6(`
1213
+ for (const skipped of artifacts.skipped) log7(skippedLine(skipped));
1214
+ if (artifacts.skipped.length > 0) log7(`
1079
1215
  ${markLegend()}`);
1080
- for (const detail of issueDetails(artifacts.issues)) log6(`
1216
+ for (const detail of issueDetails(artifacts.issues)) log7(`
1081
1217
  \u26A0 ${detail}`);
1082
1218
  }
1083
1219
  function loadedLine(plugin) {
@@ -1088,7 +1224,7 @@ function loadedLine(plugin) {
1088
1224
  function countsLine(counts) {
1089
1225
  const parts = [];
1090
1226
  const add = (n, key) => {
1091
- if (n > 0) parts.push(t8(key, { count: n }));
1227
+ if (n > 0) parts.push(t9(key, { count: n }));
1092
1228
  };
1093
1229
  add(counts.commands, "plugin.n_commands");
1094
1230
  add(counts.roles, "plugin.n_roles");
@@ -1099,84 +1235,84 @@ function countsLine(counts) {
1099
1235
  return parts.length === 0 ? "" : parts.join(" \xB7 ");
1100
1236
  }
1101
1237
  function markLegend() {
1102
- return t8("plugin.mark_legend");
1238
+ return t9("plugin.mark_legend");
1103
1239
  }
1104
1240
  function skippedLine(skipped) {
1105
1241
  return ` ${skipped.disabled ? "\u25CB" : "\u2717"} ${skipped.name} ${skipped.reason}`;
1106
1242
  }
1107
1243
  async function runInstall(input2, yes) {
1108
1244
  if (!yes && isNonInteractive2()) {
1109
- throw new CliError(t8("plugin.install_needs_tty"), 1, t8("plugin.install_needs_tty_hint"));
1245
+ throw new CliError(t9("plugin.install_needs_tty"), 1, t9("plugin.install_needs_tty_hint"));
1110
1246
  }
1111
1247
  const ref = resolveMarketplaceRef(input2, marketplacesPath(EPOCH_HOME));
1112
1248
  if (ref && !ref.ok) throw new CliError(ref.reason);
1113
1249
  const source = ref?.ok ? ref.ref.source : input2;
1114
- if (ref?.ok) log6(`${input2} \u2192 ${source}`);
1250
+ if (ref?.ok) log7(`${input2} \u2192 ${source}`);
1115
1251
  const outcome = await installPlugin(source, {
1116
1252
  ...locations(),
1117
1253
  epochVersion: currentEpochVersion(),
1118
- onProgress: log6,
1254
+ onProgress: log7,
1119
1255
  ...ref?.ok ? { marketplace: ref.ref.marketplace } : {},
1120
1256
  ...yes ? {} : { confirm: askInstall }
1121
1257
  });
1122
1258
  if (!outcome.ok) {
1123
1259
  if (outcome.cancelled) {
1124
- log6(t8("plugin.nothing_installed"));
1260
+ log7(t9("plugin.nothing_installed"));
1125
1261
  return;
1126
1262
  }
1127
- throw new CliError(t8("plugin.install_failed", { source, reason: outcome.reason }));
1263
+ throw new CliError(t9("plugin.install_failed", { source, reason: outcome.reason }));
1128
1264
  }
1129
- log6(
1265
+ log7(
1130
1266
  `
1131
- \u2713 ${t8("plugin.installed", {
1267
+ \u2713 ${t9("plugin.installed", {
1132
1268
  name: outcome.record.name,
1133
1269
  version: outcome.record.version,
1134
1270
  path: outcome.record.path
1135
1271
  })}`
1136
1272
  );
1137
1273
  if (outcome.record.linked) {
1138
- log6(t8("plugin.installed_linked"));
1274
+ log7(t9("plugin.installed_linked"));
1139
1275
  }
1140
- log6(t8("plugin.installed_restart"));
1276
+ log7(t9("plugin.installed_restart"));
1141
1277
  }
1142
1278
  async function runUpdate(name, yes) {
1143
1279
  if (!yes && isNonInteractive2()) {
1144
- throw new CliError(t8("plugin.update_needs_tty"), 1, t8("plugin.update_needs_tty_hint"));
1280
+ throw new CliError(t9("plugin.update_needs_tty"), 1, t9("plugin.update_needs_tty_hint"));
1145
1281
  }
1146
1282
  const outcome = await updatePlugin(name, {
1147
1283
  ...locations(),
1148
1284
  epochVersion: currentEpochVersion(),
1149
- onProgress: log6,
1285
+ onProgress: log7,
1150
1286
  ...yes ? {} : { confirm: askInstall }
1151
1287
  });
1152
1288
  if (!outcome.ok) throw new CliError(outcome.reason);
1153
- log6(
1154
- `\u2713 ${"message" in outcome ? outcome.message : t8("plugin.updated_to", { version: outcome.record.version })}`
1289
+ log7(
1290
+ `\u2713 ${"message" in outcome ? outcome.message : t9("plugin.updated_to", { version: outcome.record.version })}`
1155
1291
  );
1156
1292
  }
1157
1293
  async function askInstall(preview2) {
1158
- for (const line of renderPreview(preview2)) log6(line);
1294
+ for (const line2 of renderPreview(preview2)) log7(line2);
1159
1295
  const { confirm } = await import("@inquirer/prompts");
1160
- return confirm({ message: t8("plugin.confirm_install"), default: false });
1296
+ return confirm({ message: t9("plugin.confirm_install"), default: false });
1161
1297
  }
1162
1298
  function renderPreview(preview2) {
1163
1299
  const { manifest, source, inventory } = preview2;
1164
1300
  const lines = [""];
1165
- lines.push(t8("plugin.will_install", { name: manifest.name, version: manifest.version }));
1301
+ lines.push(t9("plugin.will_install", { name: manifest.name, version: manifest.version }));
1166
1302
  if (manifest.description) lines.push(` ${manifest.description}`);
1167
- lines.push(t8("plugin.preview_source", { raw: source.raw, type: source.type }));
1168
- if (source.sha256) lines.push(t8("plugin.preview_sha", { sha: source.sha256 }));
1169
- if (manifest.author) lines.push(t8("plugin.preview_author", { name: manifest.author.name }));
1170
- if (manifest.homepage) lines.push(t8("plugin.preview_homepage", { url: manifest.homepage }));
1303
+ lines.push(t9("plugin.preview_source", { raw: source.raw, type: source.type }));
1304
+ if (source.sha256) lines.push(t9("plugin.preview_sha", { sha: source.sha256 }));
1305
+ if (manifest.author) lines.push(t9("plugin.preview_author", { name: manifest.author.name }));
1306
+ if (manifest.homepage) lines.push(t9("plugin.preview_homepage", { url: manifest.homepage }));
1171
1307
  if (preview2.versionUnmet) {
1172
1308
  const { required, current } = preview2.versionUnmet;
1173
- lines.push(` ${t8("plugin.preview_version_unmet", { required, current })}`);
1309
+ lines.push(` ${t9("plugin.preview_version_unmet", { required, current })}`);
1174
1310
  }
1175
1311
  const rows = renderInventory(inventory);
1176
1312
  if (rows.length > 0) {
1177
1313
  lines.push("");
1178
- lines.push(t8("plugin.brings_head_indented"));
1179
- for (const line of rows) lines.push(` ${line}`);
1314
+ lines.push(t9("plugin.brings_head_indented"));
1315
+ for (const line2 of rows) lines.push(` ${line2}`);
1180
1316
  }
1181
1317
  if (preview2.dependencies?.length) {
1182
1318
  lines.push("");
@@ -1186,19 +1322,19 @@ function renderPreview(preview2) {
1186
1322
  return lines;
1187
1323
  }
1188
1324
  function renderDependencies(deps) {
1189
- const lines = [t8("plugin.deps_head_indented")];
1325
+ const lines = [t9("plugin.deps_head_indented")];
1190
1326
  for (const dep of deps) {
1191
1327
  const label = depLabel(dep);
1192
1328
  if (dep.status === "installed") {
1193
- lines.push(` ${t8("plugin.dep_installed", { label })}`);
1329
+ lines.push(` ${t9("plugin.dep_installed", { label })}`);
1194
1330
  continue;
1195
1331
  }
1196
1332
  if (dep.status === "unresolved") {
1197
- lines.push(` ${t8("plugin.dep_unresolved", { label, reason: dep.reason ?? "" })}`);
1333
+ lines.push(` ${t9("plugin.dep_unresolved", { label, reason: dep.reason ?? "" })}`);
1198
1334
  continue;
1199
1335
  }
1200
1336
  lines.push(
1201
- ` ${t8("plugin.dep_plan", {
1337
+ ` ${t9("plugin.dep_plan", {
1202
1338
  label,
1203
1339
  version: dep.manifest?.version ?? "",
1204
1340
  source: dep.source ?? ""
@@ -1206,10 +1342,10 @@ function renderDependencies(deps) {
1206
1342
  );
1207
1343
  if (dep.versionUnmet) {
1208
1344
  const { required, current } = dep.versionUnmet;
1209
- lines.push(` ${t8("plugin.preview_version_unmet", { required, current })}`);
1345
+ lines.push(` ${t9("plugin.preview_version_unmet", { required, current })}`);
1210
1346
  }
1211
1347
  if (dep.inventory) {
1212
- for (const line of renderInventory(dep.inventory)) lines.push(` ${line}`);
1348
+ for (const line2 of renderInventory(dep.inventory)) lines.push(` ${line2}`);
1213
1349
  }
1214
1350
  }
1215
1351
  return lines;
@@ -1217,125 +1353,125 @@ function renderDependencies(deps) {
1217
1353
  function depLabel(dep) {
1218
1354
  const display = dep.displayName;
1219
1355
  if (!display || display === dep.name) return dep.name;
1220
- return t8("plugin.dep_label_named", { display, name: dep.name });
1356
+ return t9("plugin.dep_label_named", { display, name: dep.name });
1221
1357
  }
1222
1358
  function renderInventory(inv) {
1223
1359
  const lines = [];
1224
1360
  if (inv.commands.length > 0)
1225
- lines.push(t8("plugin.inv_commands", { count: inv.commands.length, names: list(inv.commands) }));
1361
+ lines.push(t9("plugin.inv_commands", { count: inv.commands.length, names: list(inv.commands) }));
1226
1362
  if (inv.roles.length > 0)
1227
- lines.push(t8("plugin.inv_roles", { count: inv.roles.length, names: list(inv.roles) }));
1363
+ lines.push(t9("plugin.inv_roles", { count: inv.roles.length, names: list(inv.roles) }));
1228
1364
  if (inv.skills.length > 0)
1229
- lines.push(t8("plugin.inv_skills", { count: inv.skills.length, names: list(inv.skills) }));
1365
+ lines.push(t9("plugin.inv_skills", { count: inv.skills.length, names: list(inv.skills) }));
1230
1366
  if (inv.hooks.length > 0) {
1231
- const tally = inv.hooks.map((h) => `${h.type} \xD7 ${h.count}`).join(t8("plugin.inv_join"));
1232
- lines.push(t8("plugin.inv_hooks", { tally }));
1367
+ const tally = inv.hooks.map((h) => `${h.type} \xD7 ${h.count}`).join(t9("plugin.inv_join"));
1368
+ lines.push(t9("plugin.inv_hooks", { tally }));
1233
1369
  }
1234
- if (inv.denyRules > 0) lines.push(t8("plugin.inv_deny", { count: inv.denyRules }));
1370
+ if (inv.denyRules > 0) lines.push(t9("plugin.inv_deny", { count: inv.denyRules }));
1235
1371
  if (inv.mcpServers.length > 0) {
1236
1372
  lines.push(
1237
- t8("plugin.preview_mcp", {
1373
+ t9("plugin.preview_mcp", {
1238
1374
  count: inv.mcpServers.length,
1239
1375
  names: list(inv.mcpServers)
1240
1376
  })
1241
1377
  );
1242
1378
  }
1243
1379
  if (inv.ignoredBuckets.length > 0) {
1244
- lines.push(t8("plugin.inv_ignored", { buckets: inv.ignoredBuckets.join(" / ") }));
1380
+ lines.push(t9("plugin.inv_ignored", { buckets: inv.ignoredBuckets.join(" / ") }));
1245
1381
  }
1246
1382
  if (inv.jsTools) {
1247
- lines.push(t8("plugin.inv_js_tools"));
1383
+ lines.push(t9("plugin.inv_js_tools"));
1248
1384
  }
1249
1385
  for (const detail of issueDetails(inv.issues)) lines.push(`\u26A0 ${detail}`);
1250
1386
  return lines;
1251
1387
  }
1252
1388
  function list(names) {
1253
1389
  const shown = names.slice(0, 8).join(", ");
1254
- return names.length > 8 ? t8("plugin.list_more", { shown, n: names.length - 8 }) : shown;
1390
+ return names.length > 8 ? t9("plugin.list_more", { shown, n: names.length - 8 }) : shown;
1255
1391
  }
1256
1392
  function printMarketplaces() {
1257
1393
  const state = readMarketplaces(marketplacesPath(EPOCH_HOME));
1258
- for (const detail of issueDetails(state.issues)) log6(`\u26A0 ${detail}`);
1394
+ for (const detail of issueDetails(state.issues)) log7(`\u26A0 ${detail}`);
1259
1395
  if (state.records.length === 0) {
1260
- log6(t8("plugin.no_markets"));
1261
- log6(t8("plugin.no_markets_hint"));
1396
+ log7(t9("plugin.no_markets"));
1397
+ log7(t9("plugin.no_markets_hint"));
1262
1398
  return;
1263
1399
  }
1264
- log6(`${t8("plugin.markets_head", { path: marketplacesPath(EPOCH_HOME) })}
1400
+ log7(`${t9("plugin.markets_head", { path: marketplacesPath(EPOCH_HOME) })}
1265
1401
  `);
1266
1402
  for (const record of state.records) {
1267
1403
  const owner = record.catalog.owner ? ` by ${record.catalog.owner.name}` : "";
1268
- log6(
1269
- ` ${record.name} ${t8("plugin.market_plugin_count", {
1404
+ log7(
1405
+ ` ${record.name} ${t9("plugin.market_plugin_count", {
1270
1406
  count: record.catalog.plugins.length
1271
1407
  })} \u2190 ${record.source}${owner}`
1272
1408
  );
1273
- if (record.catalog.description) log6(` ${record.catalog.description}`);
1409
+ if (record.catalog.description) log7(` ${record.catalog.description}`);
1274
1410
  }
1275
1411
  }
1276
1412
  function printSearch(keyword) {
1277
1413
  const statePath = marketplacesPath(EPOCH_HOME);
1278
1414
  if (readMarketplaces(statePath).records.length === 0) {
1279
- log6(t8("plugin.search_no_markets"));
1415
+ log7(t9("plugin.search_no_markets"));
1280
1416
  return;
1281
1417
  }
1282
1418
  const hits = searchMarketplaces(keyword, statePath);
1283
1419
  if (hits.length === 0) {
1284
- log6(keyword ? t8("plugin.search_no_hit", { keyword }) : t8("plugin.search_all_empty"));
1420
+ log7(keyword ? t9("plugin.search_no_hit", { keyword }) : t9("plugin.search_all_empty"));
1285
1421
  return;
1286
1422
  }
1287
- log6(`${t8("plugin.search_count", { n: hits.length })}
1423
+ log7(`${t9("plugin.search_count", { n: hits.length })}
1288
1424
  `);
1289
1425
  for (const hit of hits) {
1290
1426
  const category = hit.entry.category ? ` [${hit.entry.category.join(PLUGIN_CATEGORY_DISPLAY_SEP)}]` : "";
1291
1427
  const shown = hit.entry.displayName ? ` ${hit.entry.displayName}` : "";
1292
1428
  const version = hit.entry.version ? ` ${hit.entry.version}` : "";
1293
- log6(` ${hit.ref}${shown}${version}${category}`);
1294
- if (hit.entry.description) log6(` ${hit.entry.description}`);
1295
- if (hit.entry.author) log6(` ${t8("plugin.search_author", { name: hit.entry.author.name })}`);
1429
+ log7(` ${hit.ref}${shown}${version}${category}`);
1430
+ if (hit.entry.description) log7(` ${hit.entry.description}`);
1431
+ if (hit.entry.author) log7(` ${t9("plugin.search_author", { name: hit.entry.author.name })}`);
1296
1432
  const stats = [];
1297
1433
  const { downloads, likes } = hit.entry;
1298
- if (downloads !== void 0) stats.push(t8("plugin.search_downloads", { count: downloads }));
1299
- if (likes !== void 0) stats.push(t8("plugin.search_likes", { count: likes }));
1300
- if (stats.length > 0) log6(` ${stats.join(" \xB7 ")}`);
1434
+ if (downloads !== void 0) stats.push(t9("plugin.search_downloads", { count: downloads }));
1435
+ if (likes !== void 0) stats.push(t9("plugin.search_likes", { count: likes }));
1436
+ if (stats.length > 0) log7(` ${stats.join(" \xB7 ")}`);
1301
1437
  if (hit.entry.visibility) {
1302
- log6(
1303
- ` ${t8(
1438
+ log7(
1439
+ ` ${t9(
1304
1440
  hit.entry.visibility === "public" ? "plugin.search_public" : "plugin.search_private"
1305
1441
  )}`
1306
1442
  );
1307
1443
  }
1308
1444
  }
1309
- log6(`
1310
- ${t8("plugin.search_install_hint", { ref: hits[0]?.ref ?? t8("plugin.ref_placeholder") })}`);
1445
+ log7(`
1446
+ ${t9("plugin.search_install_hint", { ref: hits[0]?.ref ?? t9("plugin.ref_placeholder") })}`);
1311
1447
  }
1312
1448
  async function toggle(name, enabled) {
1313
1449
  const outcome = await setPluginEnabled(name, enabled, {
1314
1450
  statePath: pluginsStatePath(EPOCH_HOME)
1315
1451
  });
1316
1452
  if (!outcome.ok) throw new CliError(outcome.reason);
1317
- log6(`\u2713 ${outcome.message}`);
1453
+ log7(`\u2713 ${outcome.message}`);
1318
1454
  }
1319
1455
  function validateDir(dir) {
1320
1456
  const read = readPluginManifest(dir);
1321
1457
  if (!read.manifest) {
1322
1458
  const detail = issueDetails(read.issues).map((d) => ` - ${d}`).join("\n");
1323
- throw new CliError(`${t8("plugin.validate_bad", { dir })}
1459
+ throw new CliError(`${t9("plugin.validate_bad", { dir })}
1324
1460
  ${detail}`);
1325
1461
  }
1326
1462
  const manifest = read.manifest;
1327
- log6(`\u2713 ${t8("plugin.validate_ok", { name: manifest.name, version: manifest.version })}`);
1328
- if (manifest.epochVersion) log6(` epochVersion: ${manifest.epochVersion}`);
1329
- for (const detail of issueDetails(read.issues)) log6(`\u26A0 ${detail}`);
1463
+ log7(`\u2713 ${t9("plugin.validate_ok", { name: manifest.name, version: manifest.version })}`);
1464
+ if (manifest.epochVersion) log7(` epochVersion: ${manifest.epochVersion}`);
1465
+ for (const detail of issueDetails(read.issues)) log7(`\u26A0 ${detail}`);
1330
1466
  const inventory = scanPluginDir(dir, manifest.name);
1331
1467
  const rows = renderInventory(inventory);
1332
1468
  if (rows.length > 0) {
1333
- log6(`
1334
- ${t8("plugin.brings_head")}`);
1335
- for (const line of rows) log6(` ${line}`);
1469
+ log7(`
1470
+ ${t9("plugin.brings_head")}`);
1471
+ for (const line2 of rows) log7(` ${line2}`);
1336
1472
  }
1337
1473
  if (inventory.issues.length > 0) {
1338
- throw new CliError(t8("plugin.inv_issues", { count: inventory.issues.length }));
1474
+ throw new CliError(t9("plugin.inv_issues", { count: inventory.issues.length }));
1339
1475
  }
1340
1476
  }
1341
1477
  async function packDir(dir, out2) {
@@ -1343,48 +1479,48 @@ async function packDir(dir, out2) {
1343
1479
  const planned = planPack(target);
1344
1480
  if (!planned.ok) throw new CliError(planned.reason);
1345
1481
  const plan = planned.plan;
1346
- log6(t8("plugin.pack_head", { name: plan.manifest.name, version: plan.manifest.version }));
1347
- for (const file of plan.files) log6(` ${file.path}`);
1348
- log6(
1349
- t8("plugin.pack_tally", {
1482
+ log7(t9("plugin.pack_head", { name: plan.manifest.name, version: plan.manifest.version }));
1483
+ for (const file of plan.files) log7(` ${file.path}`);
1484
+ log7(
1485
+ t9("plugin.pack_tally", {
1350
1486
  count: plan.files.length,
1351
1487
  kb: Math.round(plan.totalBytes / 1024)
1352
1488
  })
1353
1489
  );
1354
1490
  if (plan.suspicious.length > 0) {
1355
- log6(`\u26A0 ${t8("plugin.pack_suspicious", { files: plan.suspicious.join(", ") })}`);
1491
+ log7(`\u26A0 ${t9("plugin.pack_suspicious", { files: plan.suspicious.join(", ") })}`);
1356
1492
  }
1357
1493
  if (plan.skippedLinks.length > 0) {
1358
- log6(`\u26A0 ${t8("plugin.pack_skipped_links", { files: plan.skippedLinks.join(", ") })}`);
1494
+ log7(`\u26A0 ${t9("plugin.pack_skipped_links", { files: plan.skippedLinks.join(", ") })}`);
1359
1495
  }
1360
1496
  const destDir = resolve(out2 ?? dirname(target));
1361
1497
  mkdirSync2(destDir, { recursive: true });
1362
1498
  const packed = await packPlugin(plan, destDir);
1363
1499
  if (!packed.ok) throw new CliError(packed.reason);
1364
- log6(
1365
- `\u2713 ${t8("plugin.pack_ok", {
1500
+ log7(
1501
+ `\u2713 ${t9("plugin.pack_ok", {
1366
1502
  path: packed.archivePath,
1367
1503
  kb: Math.round(packed.bytes / 1024)
1368
1504
  })}`
1369
1505
  );
1370
- log6(t8("plugin.pack_next", { path: packed.archivePath }));
1506
+ log7(t9("plugin.pack_next", { path: packed.archivePath }));
1371
1507
  }
1372
1508
  // src/commands/run.ts
1373
1509
  import { existsSync as existsSync6 } from "fs";
1374
1510
  import { dirname as dirname4, join as join5 } from "path";
1375
1511
  import { fileURLToPath as fileURLToPath3 } from "url";
1376
1512
  import { isNonInteractive as isNonInteractive8, OPERATION_TYPES as OPERATION_TYPES3, PERMISSION_LEVELS as PERMISSION_LEVELS3 } from "@epoch-agent/core";
1377
- import { guardSpawn as guardSpawn3, t as t25 } from "@epoch-agent/infra";
1513
+ import { guardSpawn as guardSpawn3, t as t26 } from "@epoch-agent/infra";
1378
1514
  import { HEADLESS_INPUT_FORMATS as HEADLESS_INPUT_FORMATS2, HEADLESS_OUTPUT_FORMATS as HEADLESS_OUTPUT_FORMATS2 } from "@epoch-agent/protocol";
1379
1515
  // src/headless/session.ts
1380
1516
  import { OPERATION_TYPES } from "@epoch-agent/core";
1381
- import { t as t12 } from "@epoch-agent/infra";
1517
+ import { t as t13 } from "@epoch-agent/infra";
1382
1518
  import { buildRuntime } from "@epoch-agent/runtime";
1383
1519
  // src/commands/run-flags.ts
1384
1520
  import { existsSync as existsSync3 } from "fs";
1385
1521
  import { delimiter, resolve as resolve2 } from "path";
1386
1522
  import { isOperationType, resolveWorkspace } from "@epoch-agent/core";
1387
- import { t as t9 } from "@epoch-agent/infra";
1523
+ import { t as t10 } from "@epoch-agent/infra";
1388
1524
  import {
1389
1525
  HEADLESS_INPUT_FORMATS,
1390
1526
  HEADLESS_OUTPUT_FORMATS,
@@ -1404,14 +1540,14 @@ function parseResumeArg(raw) {
1404
1540
  }
1405
1541
  function assertResumeFlagsExclusive(opts) {
1406
1542
  if (opts.continue === true && opts.resume !== void 0) {
1407
- throw new CliError(t9("flags.resume_conflict"), 1, t9("flags.resume_conflict_hint"));
1543
+ throw new CliError(t10("flags.resume_conflict"), 1, t10("flags.resume_conflict_hint"));
1408
1544
  }
1409
1545
  }
1410
1546
  function applySettingsPath(path) {
1411
1547
  if (!path) return;
1412
1548
  const abs = resolve2(path);
1413
1549
  if (!existsSync3(abs)) {
1414
- throw new CliError(t9("flags.settings_missing", { path }), 1, t9("flags.resolved_to", { abs }));
1550
+ throw new CliError(t10("flags.settings_missing", { path }), 1, t10("flags.resolved_to", { abs }));
1415
1551
  }
1416
1552
  process.env.EPOCH_SETTINGS = abs;
1417
1553
  }
@@ -1422,9 +1558,9 @@ function applyAddDirs(dirs) {
1422
1558
  const fatal = issues.filter((i) => i.kind !== "redundant");
1423
1559
  if (fatal.length > 0) {
1424
1560
  throw new CliError(
1425
- t9("flags.add_dir_unusable", { inputs: fatal.map((i) => i.input).join(", ") }),
1561
+ t10("flags.add_dir_unusable", { inputs: fatal.map((i) => i.input).join(", ") }),
1426
1562
  1,
1427
- fatal.map((i) => i.detail).join(t9("flags.detail_sep"))
1563
+ fatal.map((i) => i.detail).join(t10("flags.detail_sep"))
1428
1564
  );
1429
1565
  }
1430
1566
  process.env.EPOCH_ADD_DIR = abs.join(delimiter);
@@ -1456,17 +1592,17 @@ function resolveOutputFormat(opts) {
1456
1592
  const explicit = opts.outputFormat;
1457
1593
  if (explicit !== void 0 && !isHeadlessOutputFormat(explicit)) {
1458
1594
  throw new CliError(
1459
- t9("flags.output_format_unknown", { value: explicit }),
1595
+ t10("flags.output_format_unknown", { value: explicit }),
1460
1596
  1,
1461
- t9("flags.choices", { choices: HEADLESS_OUTPUT_FORMATS.join(" / ") })
1597
+ t10("flags.choices", { choices: HEADLESS_OUTPUT_FORMATS.join(" / ") })
1462
1598
  );
1463
1599
  }
1464
1600
  if (explicit === void 0) return opts.json === true ? "json" : "text";
1465
1601
  if (opts.json === true && explicit !== "json") {
1466
1602
  throw new CliError(
1467
- t9("flags.json_conflict", { value: explicit }),
1603
+ t10("flags.json_conflict", { value: explicit }),
1468
1604
  1,
1469
- t9("flags.json_conflict_hint")
1605
+ t10("flags.json_conflict_hint")
1470
1606
  );
1471
1607
  }
1472
1608
  return explicit;
@@ -1475,9 +1611,9 @@ function resolveHeadlessFormats(opts) {
1475
1611
  const raw = opts.inputFormat;
1476
1612
  if (raw !== void 0 && !isHeadlessInputFormat(raw)) {
1477
1613
  throw new CliError(
1478
- t9("flags.input_format_unknown", { value: raw }),
1614
+ t10("flags.input_format_unknown", { value: raw }),
1479
1615
  1,
1480
- t9("flags.choices", { choices: HEADLESS_INPUT_FORMATS.join(" / ") })
1616
+ t10("flags.choices", { choices: HEADLESS_INPUT_FORMATS.join(" / ") })
1481
1617
  );
1482
1618
  }
1483
1619
  const input2 = raw ?? "text";
@@ -1487,7 +1623,7 @@ function resolveHeadlessFormats(opts) {
1487
1623
  }
1488
1624
  const output = resolveOutputFormat(opts);
1489
1625
  if (output !== "stream-json") {
1490
- throw new CliError(t9("flags.stream_pair", { output }), 1, t9("flags.stream_pair_hint"));
1626
+ throw new CliError(t10("flags.stream_pair", { output }), 1, t10("flags.stream_pair_hint"));
1491
1627
  }
1492
1628
  return { input: input2, output };
1493
1629
  }
@@ -1501,9 +1637,9 @@ function resolveApproverProgram(raw) {
1501
1637
  const abs = resolve2(value);
1502
1638
  if (!existsSync3(abs)) {
1503
1639
  throw new CliError(
1504
- t9("flags.prompt_tool_missing", { value }),
1640
+ t10("flags.prompt_tool_missing", { value }),
1505
1641
  1,
1506
- t9("flags.prompt_tool_missing_hint", { abs })
1642
+ t10("flags.prompt_tool_missing_hint", { abs })
1507
1643
  );
1508
1644
  }
1509
1645
  return `"${abs}"`;
@@ -1526,15 +1662,15 @@ function parseNumeric(raw, flag, opts = {}) {
1526
1662
  const tooSmall = opts.allowZero === true ? n < 0 : n <= 0;
1527
1663
  if (raw.trim() === "" || !Number.isFinite(n) || tooSmall || !extra(n)) {
1528
1664
  throw new CliError(
1529
- t9("flags.not_a_number", { flag, raw }),
1665
+ t10("flags.not_a_number", { flag, raw }),
1530
1666
  1,
1531
- flag === "--max-turns" ? t9("flags.want_turn_limit") : t9("flags.want_positive")
1667
+ flag === "--max-turns" ? t10("flags.want_turn_limit") : t10("flags.want_positive")
1532
1668
  );
1533
1669
  }
1534
1670
  return n;
1535
1671
  }
1536
1672
  // src/headless/driver.ts
1537
- import { t as t11 } from "@epoch-agent/infra";
1673
+ import { t as t12 } from "@epoch-agent/infra";
1538
1674
  // src/headless/emit.ts
1539
1675
  import {
1540
1676
  HEADLESS_PROTOCOL_VERSION
@@ -1548,7 +1684,7 @@ var HeadlessEmitter = class {
1548
1684
  seq = 0;
1549
1685
  sessionId = "";
1550
1686
  constructor(opts = {}) {
1551
- this.write = opts.write ?? ((line) => void process.stdout.write(line + "\n"));
1687
+ this.write = opts.write ?? ((line2) => void process.stdout.write(line2 + "\n"));
1552
1688
  this.clock = opts.clock ?? Date.now;
1553
1689
  }
1554
1690
  init(info) {
@@ -1651,22 +1787,22 @@ function initInfoOf(runtime, cwd) {
1651
1787
  model: runtime.model?.get().model ?? runtime.config.model ?? "",
1652
1788
  ...provider ? { provider } : {},
1653
1789
  permissionLevel: runtime.permissions.level(),
1654
- tools: runtime.tools.map((t40) => t40.name),
1790
+ tools: runtime.tools.map((t41) => t41.name),
1655
1791
  usageScope: runtime.usageScope,
1656
1792
  diagnostics: runtime.diagnostics
1657
1793
  };
1658
1794
  }
1659
1795
  // src/headless/read.ts
1660
1796
  import { createInterface } from "readline";
1661
- import { t as t10 } from "@epoch-agent/infra";
1797
+ import { t as t11 } from "@epoch-agent/infra";
1662
1798
  import {
1663
1799
  APPROVAL_OUTCOMES,
1664
1800
  HEADLESS_INPUT_EVENT_TYPES,
1665
1801
  isApprovalOutcome,
1666
1802
  isQuestionAnswerMap
1667
1803
  } from "@epoch-agent/protocol";
1668
- function parseInputLine(line) {
1669
- const text = line.trim();
1804
+ function parseInputLine(line2) {
1805
+ const text = line2.trim();
1670
1806
  if (!text) return void 0;
1671
1807
  let raw;
1672
1808
  try {
@@ -1674,17 +1810,17 @@ function parseInputLine(line) {
1674
1810
  } catch (err2) {
1675
1811
  return {
1676
1812
  ok: false,
1677
- message: t10("headless_input.bad_json", { why: describe2(err2), preview: preview(text) })
1813
+ message: t11("headless_input.bad_json", { why: describe2(err2), preview: preview(text) })
1678
1814
  };
1679
1815
  }
1680
1816
  if (!isRecord(raw)) {
1681
- return { ok: false, message: t10("headless_input.not_object", { preview: preview(text) }) };
1817
+ return { ok: false, message: t11("headless_input.not_object", { preview: preview(text) }) };
1682
1818
  }
1683
1819
  const type = raw["type"];
1684
1820
  if (typeof type !== "string" || !HEADLESS_INPUT_EVENT_TYPES.has(type)) {
1685
1821
  return {
1686
1822
  ok: false,
1687
- message: t10("headless_input.bad_type", {
1823
+ message: t11("headless_input.bad_type", {
1688
1824
  value: JSON.stringify(type),
1689
1825
  choices: [...HEADLESS_INPUT_EVENT_TYPES].join(" / ")
1690
1826
  })
@@ -1698,15 +1834,15 @@ function parseInputLine(line) {
1698
1834
  function parseUserMessage(raw) {
1699
1835
  const content = raw["content"];
1700
1836
  if (typeof content === "string") {
1701
- if (!content.trim()) return { ok: false, message: t10("headless_input.msg_empty") };
1837
+ if (!content.trim()) return { ok: false, message: t11("headless_input.msg_empty") };
1702
1838
  return { ok: true, event: { type: "user-message", content } };
1703
1839
  }
1704
1840
  if (!Array.isArray(content) || content.length === 0) {
1705
- return { ok: false, message: t10("headless_input.msg_bad_content") };
1841
+ return { ok: false, message: t11("headless_input.msg_bad_content") };
1706
1842
  }
1707
1843
  const bad = content.findIndex((p) => !isRecord(p) || typeof p["type"] !== "string");
1708
1844
  if (bad >= 0) {
1709
- return { ok: false, message: t10("headless_input.msg_bad_part", { index: bad }) };
1845
+ return { ok: false, message: t11("headless_input.msg_bad_part", { index: bad }) };
1710
1846
  }
1711
1847
  return {
1712
1848
  ok: true,
@@ -1716,13 +1852,13 @@ function parseUserMessage(raw) {
1716
1852
  function parseApprovalResponse(raw) {
1717
1853
  const requestId = raw["requestId"];
1718
1854
  if (typeof requestId !== "string" || !requestId) {
1719
- return { ok: false, message: t10("headless_input.approval_no_id") };
1855
+ return { ok: false, message: t11("headless_input.approval_no_id") };
1720
1856
  }
1721
1857
  const outcome = raw["outcome"];
1722
1858
  if (typeof outcome !== "string" || !isApprovalOutcome(outcome)) {
1723
1859
  return {
1724
1860
  ok: false,
1725
- message: t10("headless_input.approval_bad_outcome", {
1861
+ message: t11("headless_input.approval_bad_outcome", {
1726
1862
  value: JSON.stringify(outcome),
1727
1863
  choices: APPROVAL_OUTCOMES.join(" / ")
1728
1864
  })
@@ -1730,7 +1866,7 @@ function parseApprovalResponse(raw) {
1730
1866
  }
1731
1867
  const note = raw["note"];
1732
1868
  if (note !== void 0 && typeof note !== "string") {
1733
- return { ok: false, message: t10("headless_input.approval_bad_note") };
1869
+ return { ok: false, message: t11("headless_input.approval_bad_note") };
1734
1870
  }
1735
1871
  return {
1736
1872
  ok: true,
@@ -1745,19 +1881,19 @@ function parseApprovalResponse(raw) {
1745
1881
  function parseQuestionResponse(raw) {
1746
1882
  const requestId = raw["requestId"];
1747
1883
  if (typeof requestId !== "string" || !requestId) {
1748
- return { ok: false, message: t10("headless_input.question_no_id") };
1884
+ return { ok: false, message: t11("headless_input.question_no_id") };
1749
1885
  }
1750
1886
  if (!isQuestionAnswerMap(raw["answers"])) {
1751
1887
  return {
1752
1888
  ok: false,
1753
- message: t10("headless_input.question_bad_answers", {
1889
+ message: t11("headless_input.question_bad_answers", {
1754
1890
  json: '{"answers":{},"skipped":true}'
1755
1891
  })
1756
1892
  };
1757
1893
  }
1758
1894
  const skipped = raw["skipped"];
1759
1895
  if (skipped !== void 0 && typeof skipped !== "boolean") {
1760
- return { ok: false, message: t10("headless_input.question_bad_skipped") };
1896
+ return { ok: false, message: t11("headless_input.question_bad_skipped") };
1761
1897
  }
1762
1898
  return {
1763
1899
  ok: true,
@@ -1772,7 +1908,7 @@ function parseQuestionResponse(raw) {
1772
1908
  async function* readInputLines(stream = process.stdin) {
1773
1909
  const rl = createInterface({ input: stream, crlfDelay: Infinity });
1774
1910
  try {
1775
- for await (const line of rl) yield line;
1911
+ for await (const line2 of rl) yield line2;
1776
1912
  } finally {
1777
1913
  rl.close();
1778
1914
  }
@@ -1789,18 +1925,18 @@ function preview(text) {
1789
1925
  // src/headless/driver.ts
1790
1926
  async function driveStreamJson(opts) {
1791
1927
  const { limits } = opts;
1792
- const warn4 = opts.warn ?? ((line) => void process.stderr.write(line + "\n"));
1928
+ const warn4 = opts.warn ?? ((line2) => void process.stderr.write(line2 + "\n"));
1793
1929
  const emitter = new HeadlessEmitter({
1794
1930
  ...opts.write ? { write: opts.write } : {},
1795
1931
  ...opts.clock ? { clock: opts.clock } : {}
1796
1932
  });
1797
1933
  emitter.init(opts.init);
1798
1934
  const state = new DriverState(opts.session, emitter, limits, warn4);
1799
- for await (const line of readInputLines(opts.input ?? process.stdin)) {
1800
- const parsed = parseInputLine(line);
1935
+ for await (const line2 of readInputLines(opts.input ?? process.stdin)) {
1936
+ const parsed = parseInputLine(line2);
1801
1937
  if (parsed === void 0) continue;
1802
1938
  if (!parsed.ok) {
1803
- warn4(t11("headless_driver.bad_input", { message: parsed.message }));
1939
+ warn4(t12("headless_driver.bad_input", { message: parsed.message }));
1804
1940
  state.sawBadInput = true;
1805
1941
  continue;
1806
1942
  }
@@ -1835,7 +1971,7 @@ var DriverState = class {
1835
1971
  }
1836
1972
  if (event.type === "approval-response") {
1837
1973
  if (!this.emitter.respondApproval(event.requestId, event.outcome, event.note)) {
1838
- this.warn(t11("headless_driver.unknown_request", { id: event.requestId }));
1974
+ this.warn(t12("headless_driver.unknown_request", { id: event.requestId }));
1839
1975
  }
1840
1976
  return false;
1841
1977
  }
@@ -1845,7 +1981,7 @@ var DriverState = class {
1845
1981
  ...event.skipped ? { skipped: true } : {}
1846
1982
  };
1847
1983
  if (!this.emitter.respondQuestion(event.requestId, answer)) {
1848
- this.warn(t11("headless_driver.unknown_request", { id: event.requestId }));
1984
+ this.warn(t12("headless_driver.unknown_request", { id: event.requestId }));
1849
1985
  }
1850
1986
  return false;
1851
1987
  }
@@ -1907,11 +2043,11 @@ var DriverState = class {
1907
2043
  reapLostHost() {
1908
2044
  const approvals = this.emitter.abandonApprovals();
1909
2045
  if (approvals > 0) {
1910
- this.warn(t11("headless_driver.abandoned_approvals", { count: approvals }));
2046
+ this.warn(t12("headless_driver.abandoned_approvals", { count: approvals }));
1911
2047
  }
1912
2048
  const questions = this.emitter.abandonQuestions();
1913
2049
  if (questions > 0) {
1914
- this.warn(t11("headless_driver.abandoned_questions", { count: questions }));
2050
+ this.warn(t12("headless_driver.abandoned_questions", { count: questions }));
1915
2051
  }
1916
2052
  this.queue.length = 0;
1917
2053
  this.controller?.abort();
@@ -1936,9 +2072,9 @@ async function runStreamJsonSession(opts) {
1936
2072
  const { policy: headless, invalid } = parseHeadlessFlags(opts);
1937
2073
  if (invalid.length > 0) {
1938
2074
  throw new CliError(
1939
- t12("run_once.err_bad_operation", { values: invalid.join(", ") }),
2075
+ t13("run_once.err_bad_operation", { values: invalid.join(", ") }),
1940
2076
  EXIT_CODES.FAILURE,
1941
- t12("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES.join(" / ") })
2077
+ t13("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES.join(" / ") })
1942
2078
  );
1943
2079
  }
1944
2080
  const limits = parseCallLimits(opts);
@@ -1967,21 +2103,21 @@ function reportDeadRuntime(runtime) {
1967
2103
  const detail = runtime.diagnostics.join("; ");
1968
2104
  emitter.agentEvent({
1969
2105
  type: "error",
1970
- message: detail ? t12("headless_session.no_provider_detail", {
1971
- message: t12("run_once.err_no_provider"),
2106
+ message: detail ? t13("headless_session.no_provider_detail", {
2107
+ message: t13("run_once.err_no_provider"),
1972
2108
  detail
1973
- }) : t12("run_once.err_no_provider")
2109
+ }) : t13("run_once.err_no_provider")
1974
2110
  });
1975
2111
  emitter.result({ ok: false, reason: "error", text: "", turns: 0 });
1976
2112
  return EXIT_CODES.FAILURE;
1977
2113
  }
1978
2114
  function warnInertFlags(opts) {
1979
2115
  if ((opts.allowTool ?? []).length > 0 || (opts.allowOperation ?? []).length > 0) {
1980
- process.stderr.write(`${t12("headless_session.inert_allow")}
2116
+ process.stderr.write(`${t13("headless_session.inert_allow")}
1981
2117
  `);
1982
2118
  }
1983
2119
  if ((opts.image ?? []).length > 0) {
1984
- process.stderr.write(`${t12("headless_session.inert_image")}
2120
+ process.stderr.write(`${t13("headless_session.inert_image")}
1985
2121
  `);
1986
2122
  }
1987
2123
  }
@@ -1991,17 +2127,17 @@ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as rea
1991
2127
  import { get } from "https";
1992
2128
  import { dirname as dirname3, join as join3 } from "path";
1993
2129
  import { fileURLToPath as fileURLToPath2 } from "url";
1994
- import { t as t15 } from "@epoch-agent/infra";
2130
+ import { t as t16 } from "@epoch-agent/infra";
1995
2131
  // src/version.ts
1996
2132
  import { readFileSync as readFileSync2 } from "fs";
1997
2133
  import { dirname as dirname2, join as join2 } from "path";
1998
2134
  import { fileURLToPath } from "url";
1999
- import { t as t14 } from "@epoch-agent/infra";
2135
+ import { t as t15 } from "@epoch-agent/infra";
2000
2136
  // src/installation.ts
2001
2137
  import { execFileSync } from "child_process";
2002
2138
  import { existsSync as existsSync4, realpathSync } from "fs";
2003
2139
  import { join } from "path";
2004
- import { normalizeForMatch, t as t13 } from "@epoch-agent/infra";
2140
+ import { normalizeForMatch, t as t14 } from "@epoch-agent/infra";
2005
2141
  var PATH_RULES = [
2006
2142
  {
2007
2143
  patterns: [
@@ -2015,7 +2151,7 @@ var PATH_RULES = [
2015
2151
  build: () => ({
2016
2152
  packageManager: "npx",
2017
2153
  isGlobal: false,
2018
- note: t13("installation.npx")
2154
+ note: t14("installation.npx")
2019
2155
  })
2020
2156
  },
2021
2157
  {
@@ -2024,7 +2160,7 @@ var PATH_RULES = [
2024
2160
  packageManager: "volta",
2025
2161
  isGlobal: true,
2026
2162
  updateCommand: `volta install ${pkg}@latest`,
2027
- note: t13("installation.volta")
2163
+ note: t14("installation.volta")
2028
2164
  })
2029
2165
  },
2030
2166
  {
@@ -2038,7 +2174,7 @@ var PATH_RULES = [
2038
2174
  packageManager: "pnpm",
2039
2175
  isGlobal: true,
2040
2176
  updateCommand: `pnpm add -g ${pkg}@latest`,
2041
- note: t13("installation.pnpm")
2177
+ note: t14("installation.pnpm")
2042
2178
  })
2043
2179
  },
2044
2180
  {
@@ -2052,7 +2188,7 @@ var PATH_RULES = [
2052
2188
  packageManager: "yarn",
2053
2189
  isGlobal: true,
2054
2190
  updateCommand: `yarn global add ${pkg}@latest`,
2055
- note: t13("installation.yarn")
2191
+ note: t14("installation.yarn")
2056
2192
  })
2057
2193
  },
2058
2194
  {
@@ -2061,7 +2197,7 @@ var PATH_RULES = [
2061
2197
  packageManager: "bun",
2062
2198
  isGlobal: true,
2063
2199
  updateCommand: `bun add -g ${pkg}@latest`,
2064
- note: t13("installation.bun")
2200
+ note: t14("installation.bun")
2065
2201
  })
2066
2202
  }
2067
2203
  ];
@@ -2081,7 +2217,7 @@ function detectHomebrew(realPath, formula) {
2081
2217
  packageManager: "homebrew",
2082
2218
  isGlobal: true,
2083
2219
  updateCommand: `brew upgrade ${formula}`,
2084
- note: t13("installation.homebrew")
2220
+ note: t14("installation.homebrew")
2085
2221
  };
2086
2222
  }
2087
2223
  } catch {
@@ -2106,12 +2242,12 @@ function detectLocalInstall(matchPath, cwd) {
2106
2242
  return {
2107
2243
  packageManager: manager,
2108
2244
  isGlobal: false,
2109
- note: t13("installation.local")
2245
+ note: t14("installation.local")
2110
2246
  };
2111
2247
  }
2112
2248
  function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2113
2249
  if (!cliPath) {
2114
- return { packageManager: "unknown", isGlobal: false, note: t13("installation.unknown") };
2250
+ return { packageManager: "unknown", isGlobal: false, note: t14("installation.unknown") };
2115
2251
  }
2116
2252
  try {
2117
2253
  const realPath = realpathSync(cliPath).replace(/\\/g, "/");
@@ -2124,7 +2260,7 @@ function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2124
2260
  return {
2125
2261
  packageManager: "source",
2126
2262
  isGlobal: false,
2127
- note: t13("installation.source")
2263
+ note: t14("installation.source")
2128
2264
  };
2129
2265
  }
2130
2266
  const brew = detectHomebrew(realPath, packageName.replace(/^@[^/]+\//, ""));
@@ -2135,10 +2271,10 @@ function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2135
2271
  packageManager: "npm",
2136
2272
  isGlobal: true,
2137
2273
  updateCommand: `npm install -g ${packageName}@latest`,
2138
- note: t13("installation.npm")
2274
+ note: t14("installation.npm")
2139
2275
  };
2140
2276
  } catch {
2141
- return { packageManager: "unknown", isGlobal: false, note: t13("installation.unknown") };
2277
+ return { packageManager: "unknown", isGlobal: false, note: t14("installation.unknown") };
2142
2278
  }
2143
2279
  }
2144
2280
  // src/version.ts
@@ -2162,9 +2298,9 @@ function describeVersion(packageName) {
2162
2298
  return [
2163
2299
  VERSION,
2164
2300
  `Node: ${process.version} (${process.platform}/${process.arch})`,
2165
- t14("version.install", {
2301
+ t15("version.install", {
2166
2302
  manager: info.packageManager,
2167
- global: info.isGlobal ? t14("installation.global_suffix") : "",
2303
+ global: info.isGlobal ? t15("installation.global_suffix") : "",
2168
2304
  note: info.note
2169
2305
  })
2170
2306
  ].join("\n");
@@ -2308,7 +2444,7 @@ function readUpdateNotice(options = {}) {
2308
2444
  name,
2309
2445
  current: version,
2310
2446
  latest: cache.latest,
2311
- message: t15("update_check.available", { name, current: version, latest: cache.latest })
2447
+ message: t16("update_check.available", { name, current: version, latest: cache.latest })
2312
2448
  };
2313
2449
  }
2314
2450
  async function refreshUpdateCache(options = {}) {
@@ -2337,7 +2473,7 @@ async function refreshUpdateCache(options = {}) {
2337
2473
  name,
2338
2474
  current: version,
2339
2475
  latest,
2340
- message: t15("update_check.available", { name, current: version, latest })
2476
+ message: t16("update_check.available", { name, current: version, latest })
2341
2477
  };
2342
2478
  }
2343
2479
  function scheduleUpdateCheck(options = {}) {
@@ -2375,7 +2511,7 @@ import { execFile } from "child_process";
2375
2511
  import { randomBytes } from "crypto";
2376
2512
  import { mkdirSync as mkdirSync4 } from "fs";
2377
2513
  import { basename, join as join4, resolve as resolve3 } from "path";
2378
- import { guardSpawn, t as t16, worktreesDir } from "@epoch-agent/infra";
2514
+ import { guardSpawn, t as t17, worktreesDir } from "@epoch-agent/infra";
2379
2515
  var TIMEOUT_MS = 6e4;
2380
2516
  function git(args, cwd) {
2381
2517
  return new Promise((done) => {
@@ -2404,13 +2540,13 @@ function git(args, cwd) {
2404
2540
  });
2405
2541
  }
2406
2542
  function firstLine(text) {
2407
- return text.trim().split("\n")[0]?.trim() ?? t16("git.unknown_reason");
2543
+ return text.trim().split("\n")[0]?.trim() ?? t17("git.unknown_reason");
2408
2544
  }
2409
2545
  async function createWorktree(cwd = process.cwd(), container = worktreesDir()) {
2410
2546
  const repoRoot = await resolveRepoRoot(cwd);
2411
2547
  const head = await git(["rev-parse", "HEAD"], repoRoot);
2412
2548
  if (!head.ok) {
2413
- throw new CliError(t16("worktree.err_no_commit"), 1, t16("worktree.err_no_commit_hint"));
2549
+ throw new CliError(t17("worktree.err_no_commit"), 1, t17("worktree.err_no_commit_hint"));
2414
2550
  }
2415
2551
  const baseRef = head.stdout.trim();
2416
2552
  const shortId = randomBytes(3).toString("hex");
@@ -2419,26 +2555,26 @@ async function createWorktree(cwd = process.cwd(), container = worktreesDir()) {
2419
2555
  mkdirSync4(container, { recursive: true });
2420
2556
  const added = await git(["worktree", "add", "-b", branch, path, baseRef], repoRoot);
2421
2557
  if (!added.ok) {
2422
- throw new CliError(t16("worktree.err_add_failed", { path }), 1, firstLine(added.stderr));
2558
+ throw new CliError(t17("worktree.err_add_failed", { path }), 1, firstLine(added.stderr));
2423
2559
  }
2424
2560
  return { repoRoot, path, branch, baseRef };
2425
2561
  }
2426
2562
  async function resolveRepoRoot(cwd) {
2427
2563
  const root = await git(["rev-parse", "--show-toplevel"], cwd);
2428
2564
  if (root.missing) {
2429
- throw new CliError(t16("worktree.err_git_missing"), 1, t16("worktree.err_git_missing_hint"));
2565
+ throw new CliError(t17("worktree.err_git_missing"), 1, t17("worktree.err_git_missing_hint"));
2430
2566
  }
2431
2567
  if (!root.ok) {
2432
2568
  throw new CliError(
2433
- t16("worktree.err_not_a_repo"),
2569
+ t17("worktree.err_not_a_repo"),
2434
2570
  1,
2435
- t16("worktree.err_not_a_repo_hint", { cwd, why: firstLine(root.stderr) })
2571
+ t17("worktree.err_not_a_repo_hint", { cwd, why: firstLine(root.stderr) })
2436
2572
  );
2437
2573
  }
2438
2574
  return resolve3(root.stdout.trim());
2439
2575
  }
2440
2576
  function countLines(text) {
2441
- return text.split("\n").filter((line) => line.trim() !== "").length;
2577
+ return text.split("\n").filter((line2) => line2.trim() !== "").length;
2442
2578
  }
2443
2579
  async function inspectWorktree(session) {
2444
2580
  const status = await git(["status", "--porcelain"], session.path);
@@ -2450,16 +2586,16 @@ async function inspectWorktree(session) {
2450
2586
  };
2451
2587
  }
2452
2588
  function worktreeKeepReason(state) {
2453
- if (state.dirty === null || state.ahead === null) return t16("worktree.keep_unknown");
2454
- if (state.dirty > 0) return t16("worktree.keep_dirty", { count: state.dirty });
2455
- if (state.ahead > 0) return t16("worktree.keep_ahead", { count: state.ahead });
2589
+ if (state.dirty === null || state.ahead === null) return t17("worktree.keep_unknown");
2590
+ if (state.dirty > 0) return t17("worktree.keep_dirty", { count: state.dirty });
2591
+ if (state.ahead > 0) return t17("worktree.keep_ahead", { count: state.ahead });
2456
2592
  return null;
2457
2593
  }
2458
2594
  function worktreeBanner(session) {
2459
- const dir = t16("worktree.banner_dir", { path: session.path });
2460
- const branch = t16("worktree.banner_branch", { branch: session.branch });
2595
+ const dir = t17("worktree.banner_dir", { path: session.path });
2596
+ const branch = t17("worktree.banner_branch", { branch: session.branch });
2461
2597
  return `
2462
- ${t16("worktree.banner")}
2598
+ ${t17("worktree.banner")}
2463
2599
  ${dir}
2464
2600
  ${branch}
2465
2601
  `;
@@ -2471,23 +2607,23 @@ async function finishWorktree(session, opts) {
2471
2607
  if (forced !== null) {
2472
2608
  print(
2473
2609
  `
2474
- ${t16("worktree.kept_forced", { reason: forced })}
2610
+ ${t17("worktree.kept_forced", { reason: forced })}
2475
2611
  ${session.path}
2476
- ${t16("worktree.banner_branch", { branch: session.branch })}`
2612
+ ${t17("worktree.banner_branch", { branch: session.branch })}`
2477
2613
  );
2478
2614
  return;
2479
2615
  }
2480
2616
  const remove = opts.interactive ? await (opts.ask ?? askRemove)(session) : false;
2481
2617
  if (!remove) {
2482
2618
  print(`
2483
- ${t16("worktree.kept", { path: session.path, branch: session.branch })}`);
2619
+ ${t17("worktree.kept", { path: session.path, branch: session.branch })}`);
2484
2620
  return;
2485
2621
  }
2486
2622
  const failure = await removeWorktree(session);
2487
2623
  print(
2488
2624
  failure === null ? `
2489
- ${t16("worktree.removed", { path: session.path, branch: session.branch })}` : `
2490
- ${t16("worktree.remove_failed", { path: session.path })}
2625
+ ${t17("worktree.removed", { path: session.path, branch: session.branch })}` : `
2626
+ ${t17("worktree.remove_failed", { path: session.path })}
2491
2627
  ${failure}`
2492
2628
  );
2493
2629
  }
@@ -2495,7 +2631,7 @@ async function removeWorktree(session) {
2495
2631
  const removed = await git(["worktree", "remove", session.path], session.repoRoot);
2496
2632
  if (!removed.ok) return firstLine(removed.stderr);
2497
2633
  const branch = await git(["branch", "-D", session.branch], session.repoRoot);
2498
- return branch.ok ? null : t16("worktree.branch_remove_failed", {
2634
+ return branch.ok ? null : t17("worktree.branch_remove_failed", {
2499
2635
  branch: session.branch,
2500
2636
  why: firstLine(branch.stderr)
2501
2637
  });
@@ -2504,7 +2640,7 @@ async function askRemove(session) {
2504
2640
  const { confirm } = await import("@inquirer/prompts");
2505
2641
  try {
2506
2642
  return await confirm({
2507
- message: t16("worktree.ask_remove", { path: session.path }),
2643
+ message: t17("worktree.ask_remove", { path: session.path }),
2508
2644
  default: false
2509
2645
  });
2510
2646
  } catch {
@@ -2513,7 +2649,7 @@ async function askRemove(session) {
2513
2649
  }
2514
2650
  // src/commands/run-once.ts
2515
2651
  import { formatUsd, imageFromPath, OPERATION_TYPES as OPERATION_TYPES2 } from "@epoch-agent/core";
2516
- import { t as t22 } from "@epoch-agent/infra";
2652
+ import { t as t23 } from "@epoch-agent/infra";
2517
2653
  import {
2518
2654
  promptTokens
2519
2655
  } from "@epoch-agent/protocol";
@@ -2522,38 +2658,38 @@ import { buildRuntime as buildRuntime2, listBackgroundTasks } from "@epoch-agent
2522
2658
  import {
2523
2659
  isNonInteractive as isNonInteractive3
2524
2660
  } from "@epoch-agent/core";
2525
- import { t as t17 } from "@epoch-agent/infra";
2661
+ import { t as t18 } from "@epoch-agent/infra";
2526
2662
  function typeLabel(type) {
2527
2663
  switch (type) {
2528
2664
  case "file_read":
2529
- return t17("tui.approval.type_file_read");
2665
+ return t18("tui.approval.type_file_read");
2530
2666
  case "file_write":
2531
- return t17("tui.approval.type_file_write");
2667
+ return t18("tui.approval.type_file_write");
2532
2668
  case "command":
2533
- return t17("tui.approval.type_command");
2669
+ return t18("tui.approval.type_command");
2534
2670
  case "network":
2535
- return t17("tui.approval.type_network");
2671
+ return t18("tui.approval.type_network");
2536
2672
  case "code_exec":
2537
- return t17("tui.approval.type_code_exec");
2673
+ return t18("tui.approval.type_code_exec");
2538
2674
  }
2539
2675
  }
2540
2676
  function formatApprovalRequest(req) {
2541
2677
  if (req.plan) {
2542
2678
  return [
2543
- t17("approval.plan_head"),
2544
- t17("approval.plan_previous_level", { level: req.plan.previousLevel }),
2679
+ t18("approval.plan_head"),
2680
+ t18("approval.plan_previous_level", { level: req.plan.previousLevel }),
2545
2681
  "",
2546
2682
  ...req.plan.markdown.split("\n").map((l) => ` ${l}`)
2547
2683
  ];
2548
2684
  }
2549
2685
  const lines = [
2550
- t17("approval.asks", { tool: req.toolName, what: typeLabel(req.type) }),
2551
- t17("approval.target", { target: req.target || t17("approval.target_none") })
2686
+ t18("approval.asks", { tool: req.toolName, what: typeLabel(req.type) }),
2687
+ t18("approval.target", { target: req.target || t18("approval.target_none") })
2552
2688
  ];
2553
2689
  if (req.detail && req.detail !== req.target) {
2554
- lines.push(t17("approval.detail", { detail: req.detail.slice(0, 300) }));
2690
+ lines.push(t18("approval.detail", { detail: req.detail.slice(0, 300) }));
2555
2691
  }
2556
- if (req.reason) lines.push(t17("approval.reason", { reason: req.reason }));
2692
+ if (req.reason) lines.push(t18("approval.reason", { reason: req.reason }));
2557
2693
  return lines;
2558
2694
  }
2559
2695
  function createInteractiveApproval(opts = {}) {
@@ -2561,27 +2697,27 @@ function createInteractiveApproval(opts = {}) {
2561
2697
  return async (req) => {
2562
2698
  if (!interactive()) {
2563
2699
  if (opts.permission?.()?.isPreauthorized(req.toolName, req.type)) {
2564
- console.error(t17("approval.headless_allowed", { tool: req.toolName, target: req.target }));
2700
+ console.error(t18("approval.headless_allowed", { tool: req.toolName, target: req.target }));
2565
2701
  return "allow-once";
2566
2702
  }
2567
2703
  console.error(
2568
- `${t17("approval.headless_denied", {
2704
+ `${t18("approval.headless_denied", {
2569
2705
  tool: req.toolName,
2570
2706
  target: req.target
2571
2707
  })}
2572
- ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
2708
+ ${t18("approval.headless_denied_hint", { tool: req.toolName })}`
2573
2709
  );
2574
2710
  return "deny";
2575
2711
  }
2576
2712
  console.log("\n" + formatApprovalRequest(req).join("\n"));
2577
2713
  if (req.plan) return await askPlan(req.plan);
2578
2714
  if (req.rememberable === false) {
2579
- console.log(t17("approval.not_rememberable"));
2715
+ console.log(t18("approval.not_rememberable"));
2580
2716
  }
2581
2717
  const { select: select2 } = await import("@inquirer/prompts");
2582
2718
  try {
2583
2719
  return await select2({
2584
- message: t17("approval.ask"),
2720
+ message: t18("approval.ask"),
2585
2721
  choices: approvalChoices(req),
2586
2722
  default: "allow-once"
2587
2723
  });
@@ -2592,12 +2728,12 @@ ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
2592
2728
  }
2593
2729
  function approvalChoices(req) {
2594
2730
  return [
2595
- { name: t17("tui.approval.allow_once"), value: "allow-once" },
2731
+ { name: t18("tui.approval.allow_once"), value: "allow-once" },
2596
2732
  ...req.rememberable === false ? [] : [
2597
- { name: t17("tui.approval.allow_session"), value: "allow-session" },
2598
- { name: t17("approval.allow_always_cli"), value: "allow-always" }
2733
+ { name: t18("tui.approval.allow_session"), value: "allow-session" },
2734
+ { name: t18("approval.allow_always_cli"), value: "allow-always" }
2599
2735
  ],
2600
- { name: t17("tui.approval.deny"), value: "deny" }
2736
+ { name: t18("tui.approval.deny"), value: "deny" }
2601
2737
  ];
2602
2738
  }
2603
2739
  async function askPlan(proposal) {
@@ -2605,21 +2741,21 @@ async function askPlan(proposal) {
2605
2741
  const choices3 = [
2606
2742
  ...proposal.canExecute ? [
2607
2743
  {
2608
- name: t17("approval.plan_execute_back", {
2609
- label: t17("approval.plan_execute"),
2744
+ name: t18("approval.plan_execute_back", {
2745
+ label: t18("approval.plan_execute"),
2610
2746
  level: proposal.previousLevel
2611
2747
  }),
2612
2748
  value: "plan-execute"
2613
2749
  }
2614
2750
  ] : [],
2615
- { name: t17("approval.plan_readonly"), value: "plan-readonly" },
2616
- { name: t17("approval.plan_revise"), value: "plan-revise" },
2617
- { name: t17("approval.deny"), value: "deny" }
2751
+ { name: t18("approval.plan_readonly"), value: "plan-readonly" },
2752
+ { name: t18("approval.plan_revise"), value: "plan-revise" },
2753
+ { name: t18("approval.deny"), value: "deny" }
2618
2754
  ];
2619
2755
  try {
2620
- const outcome = await select2({ message: t17("approval.plan_ask"), choices: choices3 });
2756
+ const outcome = await select2({ message: t18("approval.plan_ask"), choices: choices3 });
2621
2757
  if (outcome !== "plan-revise") return outcome;
2622
- const note = (await input2({ message: t17("approval.plan_revise_ask") })).trim();
2758
+ const note = (await input2({ message: t18("approval.plan_revise_ask") })).trim();
2623
2759
  return note ? { outcome, note } : outcome;
2624
2760
  } catch {
2625
2761
  return "deny";
@@ -2632,7 +2768,7 @@ import {
2632
2768
  matchPreauthorization,
2633
2769
  mergeHeadlessPolicy
2634
2770
  } from "@epoch-agent/core";
2635
- import { createStreamDecoder, guardSpawn as guardSpawn2, t as t18 } from "@epoch-agent/infra";
2771
+ import { createStreamDecoder, guardSpawn as guardSpawn2, t as t19 } from "@epoch-agent/infra";
2636
2772
  import { APPROVAL_OUTCOMES as APPROVAL_OUTCOMES2, isApprovalOutcome as isApprovalOutcome2 } from "@epoch-agent/protocol";
2637
2773
  var APPROVER_TIMEOUT_MS = 6e4;
2638
2774
  var MAX_STDOUT_BYTES = 64 * 1024;
@@ -2642,22 +2778,22 @@ function clip(s) {
2642
2778
  }
2643
2779
  function parseApproverVerdict(stdout) {
2644
2780
  const text = stdout.trim();
2645
- if (!text) return { ok: false, why: t18("approver.no_output") };
2781
+ if (!text) return { ok: false, why: t19("approver.no_output") };
2646
2782
  let raw;
2647
2783
  try {
2648
2784
  raw = JSON.parse(text);
2649
2785
  } catch {
2650
- return { ok: false, why: t18("approver.not_json", { text: clip(text) }) };
2786
+ return { ok: false, why: t19("approver.not_json", { text: clip(text) }) };
2651
2787
  }
2652
2788
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
2653
- return { ok: false, why: t18("approver.not_object", { text: clip(text) }) };
2789
+ return { ok: false, why: t19("approver.not_object", { text: clip(text) }) };
2654
2790
  }
2655
2791
  const rec = raw;
2656
2792
  const outcome = rec["outcome"];
2657
2793
  if (typeof outcome !== "string" || !isApprovalOutcome2(outcome)) {
2658
2794
  return {
2659
2795
  ok: false,
2660
- why: t18("approver.bad_outcome", {
2796
+ why: t19("approver.bad_outcome", {
2661
2797
  value: clip(String(outcome)),
2662
2798
  choices: APPROVAL_OUTCOMES2.join(" / ")
2663
2799
  })
@@ -2692,12 +2828,12 @@ function askExternalApprover(program2, payload, opts = {}) {
2692
2828
  ...opts.cwd ? { cwd: opts.cwd } : {},
2693
2829
  stdio: ["pipe", "pipe", "inherit"]
2694
2830
  }),
2695
- (err2) => settle({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) })
2831
+ (err2) => settle({ ok: false, why: t19("approver.spawn_failed", { message: err2.message }) })
2696
2832
  );
2697
2833
  if (!child) return;
2698
2834
  const timer = setTimeout(() => {
2699
2835
  child.kill("SIGKILL");
2700
- settle({ ok: false, why: t18("approver.timeout", { ms: timeoutMs }) });
2836
+ settle({ ok: false, why: t19("approver.timeout", { ms: timeoutMs }) });
2701
2837
  }, timeoutMs);
2702
2838
  const done = (v) => {
2703
2839
  clearTimeout(timer);
@@ -2709,16 +2845,16 @@ function askExternalApprover(program2, payload, opts = {}) {
2709
2845
  out2 += decoder.write(d);
2710
2846
  if (out2.length > MAX_STDOUT_BYTES) {
2711
2847
  child.kill("SIGKILL");
2712
- done({ ok: false, why: t18("approver.too_much_output", { bytes: MAX_STDOUT_BYTES }) });
2848
+ done({ ok: false, why: t19("approver.too_much_output", { bytes: MAX_STDOUT_BYTES }) });
2713
2849
  }
2714
2850
  });
2715
2851
  child.on("error", (err2) => {
2716
- done({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) });
2852
+ done({ ok: false, why: t19("approver.spawn_failed", { message: err2.message }) });
2717
2853
  });
2718
2854
  child.on("close", (code) => {
2719
2855
  out2 += decoder?.end() ?? "";
2720
2856
  if (code !== 0) {
2721
- done({ ok: false, why: t18("approver.bad_exit", { code: code ?? -1 }) });
2857
+ done({ ok: false, why: t19("approver.bad_exit", { code: code ?? -1 }) });
2722
2858
  return;
2723
2859
  }
2724
2860
  done(parseApproverVerdict(out2));
@@ -2752,7 +2888,7 @@ function createExternalApproval(opts) {
2752
2888
  const hit = req.plan ? null : opts.preauth?.(req) ?? null;
2753
2889
  if (hit) {
2754
2890
  write(
2755
- `${t18("approver.audit_preauth", {
2891
+ `${t19("approver.audit_preauth", {
2756
2892
  tool: req.toolName,
2757
2893
  target: req.target,
2758
2894
  reason: hit
@@ -2764,7 +2900,7 @@ function createExternalApproval(opts) {
2764
2900
  const verdict = await ask(payloadOf(req, cwd, opts.sessionId?.()));
2765
2901
  if (!verdict.ok) {
2766
2902
  write(
2767
- `${t18("approver.audit_rejected", {
2903
+ `${t19("approver.audit_rejected", {
2768
2904
  tool: req.toolName,
2769
2905
  target: req.target,
2770
2906
  why: verdict.why
@@ -2776,7 +2912,7 @@ function createExternalApproval(opts) {
2776
2912
  const { outcome } = verdict.answer;
2777
2913
  const vars = { tool: req.toolName, target: req.target, outcome };
2778
2914
  write(
2779
- `${outcome === "deny" ? t18("approver.audit_denied", vars) : t18("approver.audit_allowed", vars)}
2915
+ `${outcome === "deny" ? t19("approver.audit_denied", vars) : t19("approver.audit_allowed", vars)}
2780
2916
  `
2781
2917
  );
2782
2918
  return verdict.answer;
@@ -2784,26 +2920,26 @@ function createExternalApproval(opts) {
2784
2920
  }
2785
2921
  // src/headless/tasks.ts
2786
2922
  import { describeBackgroundTask } from "@epoch-agent/core";
2787
- import { t as t19 } from "@epoch-agent/infra";
2923
+ import { t as t20 } from "@epoch-agent/infra";
2788
2924
  function backgroundTaskSummary(all) {
2789
- const tasks = all.filter((t40) => t40.kind === "command");
2925
+ const tasks = all.filter((t41) => t41.kind === "command");
2790
2926
  if (tasks.length === 0) return "";
2791
- const running = tasks.filter((t40) => t40.status === "running").length;
2792
- const head = running > 0 ? t19("background_tasks.head_running", { total: tasks.length, running }) : t19("background_tasks.head_done", { total: tasks.length });
2793
- return [head, ...tasks.map((t40) => ` ${describeBackgroundTask(t40)}`)].join("\n");
2927
+ const running = tasks.filter((t41) => t41.status === "running").length;
2928
+ const head = running > 0 ? t20("background_tasks.head_running", { total: tasks.length, running }) : t20("background_tasks.head_done", { total: tasks.length });
2929
+ return [head, ...tasks.map((t41) => ` ${describeBackgroundTask(t41)}`)].join("\n");
2794
2930
  }
2795
2931
  // src/import-prompt.ts
2796
2932
  import {
2797
2933
  createImportGate,
2798
2934
  ImportTrustStore,
2799
2935
  isNonInteractive as isNonInteractive6,
2800
- loadConfig as loadConfig4,
2936
+ loadConfig as loadConfig5,
2801
2937
  resolveProjectRoot as resolveProjectRoot2,
2802
2938
  scanInstructions,
2803
2939
  setImportGate,
2804
2940
  TrustManager as TrustManager2
2805
2941
  } from "@epoch-agent/core";
2806
- import { t as t21, trustedImportsPath, trustPath as trustPath2 } from "@epoch-agent/infra";
2942
+ import { t as t22, trustedImportsPath, trustPath as trustPath2 } from "@epoch-agent/infra";
2807
2943
  // src/trust-prompt.ts
2808
2944
  import {
2809
2945
  findProjectInstructions,
@@ -2811,11 +2947,11 @@ import {
2811
2947
  hasReadTierContent,
2812
2948
  inventoryProjectExtensions,
2813
2949
  isNonInteractive as isNonInteractive5,
2814
- loadConfig as loadConfig3,
2950
+ loadConfig as loadConfig4,
2815
2951
  resolveProjectRoot,
2816
2952
  TrustManager
2817
2953
  } from "@epoch-agent/core";
2818
- import { t as t20, trustPath } from "@epoch-agent/infra";
2954
+ import { t as t21, trustPath } from "@epoch-agent/infra";
2819
2955
  function trustPromptTarget(deps) {
2820
2956
  if (!deps.gateEnabled) return null;
2821
2957
  if (!deps.interactive) return null;
@@ -2835,56 +2971,56 @@ function trustPromptTarget(deps) {
2835
2971
  function applyTrustChoice(store, root, choice) {
2836
2972
  if (choice.kind === "trust") {
2837
2973
  store.record(root, "trusted", choice.scope, { exec: choice.exec });
2838
- const suffix = choice.scope === "directory-tree" ? t20("trust_prompt.granted_tree_suffix") : "";
2839
- return choice.exec ? t20("trust_prompt.granted_exec", { root, suffix }) : t20("trust_prompt.granted", { root, suffix });
2974
+ const suffix = choice.scope === "directory-tree" ? t21("trust_prompt.granted_tree_suffix") : "";
2975
+ return choice.exec ? t21("trust_prompt.granted_exec", { root, suffix }) : t21("trust_prompt.granted", { root, suffix });
2840
2976
  }
2841
2977
  if (choice.kind === "never") {
2842
2978
  store.record(root, "untrusted", "directory");
2843
- return t20("trust_prompt.denied", { root });
2979
+ return t21("trust_prompt.denied", { root });
2844
2980
  }
2845
- return t20("trust_prompt.skipped");
2981
+ return t21("trust_prompt.skipped");
2846
2982
  }
2847
2983
  function trustPromptMessage(target) {
2848
2984
  const lines = [
2849
2985
  target.instructionsPath ? `
2850
- ${t20("trust_prompt.head", { path: target.instructionsPath })}` : `
2851
- ${t20("trust_prompt.head_dir", { dir: target.root })}`,
2852
- ` ${t20("trust_prompt.why")}`
2986
+ ${t21("trust_prompt.head", { path: target.instructionsPath })}` : `
2987
+ ${t21("trust_prompt.head_dir", { dir: target.root })}`,
2988
+ ` ${t21("trust_prompt.why")}`
2853
2989
  ];
2854
2990
  const inv = target.inventory;
2855
2991
  const read = [];
2856
2992
  if (inv.instructionFiles.length > 0) {
2857
- read.push(t20("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
2993
+ read.push(t21("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
2858
2994
  }
2859
- if (inv.skills > 0) read.push(t20("trust_prompt.item_skills", { n: inv.skills }));
2860
- if (inv.roles > 0) read.push(t20("trust_prompt.item_roles", { n: inv.roles }));
2861
- if (inv.commands > 0) read.push(t20("trust_prompt.item_commands", { n: inv.commands }));
2862
- const sep = t20("trust_prompt.item_sep");
2863
- if (read.length > 0) lines.push(` ${t20("trust_prompt.tier_read_head")} ${read.join(sep)}`);
2995
+ if (inv.skills > 0) read.push(t21("trust_prompt.item_skills", { n: inv.skills }));
2996
+ if (inv.roles > 0) read.push(t21("trust_prompt.item_roles", { n: inv.roles }));
2997
+ if (inv.commands > 0) read.push(t21("trust_prompt.item_commands", { n: inv.commands }));
2998
+ const sep = t21("trust_prompt.item_sep");
2999
+ if (read.length > 0) lines.push(` ${t21("trust_prompt.tier_read_head")} ${read.join(sep)}`);
2864
3000
  const exec = [];
2865
3001
  if (inv.hookFiles.length > 0) {
2866
- exec.push(t20("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
3002
+ exec.push(t21("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
2867
3003
  }
2868
- if (inv.policies > 0) exec.push(t20("trust_prompt.item_policies", { n: inv.policies }));
3004
+ if (inv.policies > 0) exec.push(t21("trust_prompt.item_policies", { n: inv.policies }));
2869
3005
  if (inv.settingsFiles.length > 0) {
2870
- exec.push(t20("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
3006
+ exec.push(t21("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
2871
3007
  }
2872
- if (exec.length > 0) lines.push(` ${t20("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
3008
+ if (exec.length > 0) lines.push(` ${t21("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
2873
3009
  lines.push("");
2874
3010
  return lines.join("\n");
2875
3011
  }
2876
3012
  function choices() {
2877
3013
  return [
2878
- { name: t20("trust_prompt.choice_skip"), value: { kind: "skip" } },
3014
+ { name: t21("trust_prompt.choice_skip"), value: { kind: "skip" } },
2879
3015
  {
2880
- name: t20("trust_prompt.choice_dir"),
3016
+ name: t21("trust_prompt.choice_dir"),
2881
3017
  value: { kind: "trust", scope: "directory", exec: false }
2882
3018
  },
2883
3019
  {
2884
- name: t20("trust_prompt.choice_tree"),
3020
+ name: t21("trust_prompt.choice_tree"),
2885
3021
  value: { kind: "trust", scope: "directory-tree", exec: false }
2886
3022
  },
2887
- { name: t20("trust_prompt.choice_never"), value: { kind: "never" } }
3023
+ { name: t21("trust_prompt.choice_never"), value: { kind: "never" } }
2888
3024
  ];
2889
3025
  }
2890
3026
  function restoreStdinDefault() {
@@ -2893,7 +3029,7 @@ function restoreStdinDefault() {
2893
3029
  stdin.resume();
2894
3030
  }
2895
3031
  async function maybePromptForTrust(opts = {}) {
2896
- const config = opts.config ?? loadConfig3();
3032
+ const config = opts.config ?? loadConfig4();
2897
3033
  const store = opts.store ?? new TrustManager(trustPath(config.homeDir));
2898
3034
  const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
2899
3035
  const target = trustPromptTarget({
@@ -2919,7 +3055,7 @@ async function maybePromptForTrust(opts = {}) {
2919
3055
  print(applyTrustChoice(store, target.root, choice));
2920
3056
  } catch (err2) {
2921
3057
  print(
2922
- t20("trust_prompt.write_failed", {
3058
+ t21("trust_prompt.write_failed", {
2923
3059
  message: err2 instanceof Error ? err2.message : String(err2)
2924
3060
  })
2925
3061
  );
@@ -2930,11 +3066,11 @@ async function askExecChoice(_target) {
2930
3066
  const { select: select2 } = await import("@inquirer/prompts");
2931
3067
  try {
2932
3068
  const options = [
2933
- { name: t20("trust_prompt.exec_choice_no"), value: false },
2934
- { name: t20("trust_prompt.exec_choice_yes"), value: true }
3069
+ { name: t21("trust_prompt.exec_choice_no"), value: false },
3070
+ { name: t21("trust_prompt.exec_choice_yes"), value: true }
2935
3071
  ];
2936
3072
  return await select2({
2937
- message: t20("trust_prompt.exec_ask"),
3073
+ message: t21("trust_prompt.exec_ask"),
2938
3074
  choices: options,
2939
3075
  default: options[0]?.value
2940
3076
  });
@@ -2947,7 +3083,7 @@ async function askTrustChoice(_target) {
2947
3083
  try {
2948
3084
  const options = choices();
2949
3085
  return await select2({
2950
- message: t20("trust_prompt.ask"),
3086
+ message: t21("trust_prompt.ask"),
2951
3087
  choices: [...options],
2952
3088
  default: options[0]?.value
2953
3089
  });
@@ -2980,38 +3116,38 @@ function externalImportTargets(deps) {
2980
3116
  function importPromptMessage(target) {
2981
3117
  return [
2982
3118
  `
2983
- ${t21("import_prompt.head", { from: target.from })}`,
3119
+ ${t22("import_prompt.head", { from: target.from })}`,
2984
3120
  ` ${target.path}`,
2985
- ` ${t21("import_prompt.spec", { spec: target.spec })}`,
2986
- ` ${t21("import_prompt.why")}`,
3121
+ ` ${t22("import_prompt.spec", { spec: target.spec })}`,
3122
+ ` ${t22("import_prompt.why")}`,
2987
3123
  ""
2988
3124
  ].join("\n");
2989
3125
  }
2990
3126
  function applyImportChoice(store, target, choice) {
2991
3127
  if (choice.kind === "once") {
2992
3128
  store.allowOnce(target.path);
2993
- return t21("import_prompt.once", { path: target.path });
3129
+ return t22("import_prompt.once", { path: target.path });
2994
3130
  }
2995
3131
  if (choice.kind === "remember") {
2996
3132
  store.remember(target.path);
2997
- return t21("import_prompt.remembered", { path: target.path });
3133
+ return t22("import_prompt.remembered", { path: target.path });
2998
3134
  }
2999
3135
  if (choice.kind === "never") {
3000
3136
  store.denyAll();
3001
- return t21("import_prompt.never");
3137
+ return t22("import_prompt.never");
3002
3138
  }
3003
- return t21("import_prompt.skipped", { path: target.path });
3139
+ return t22("import_prompt.skipped", { path: target.path });
3004
3140
  }
3005
3141
  function choices2() {
3006
3142
  return [
3007
- { name: t21("import_prompt.choice_skip"), value: { kind: "skip" } },
3008
- { name: t21("import_prompt.choice_once"), value: { kind: "once" } },
3009
- { name: t21("import_prompt.choice_remember"), value: { kind: "remember" } },
3010
- { name: t21("import_prompt.choice_never"), value: { kind: "never" } }
3143
+ { name: t22("import_prompt.choice_skip"), value: { kind: "skip" } },
3144
+ { name: t22("import_prompt.choice_once"), value: { kind: "once" } },
3145
+ { name: t22("import_prompt.choice_remember"), value: { kind: "remember" } },
3146
+ { name: t22("import_prompt.choice_never"), value: { kind: "never" } }
3011
3147
  ];
3012
3148
  }
3013
3149
  async function maybePromptForExternalImports(opts = {}) {
3014
- const config = opts.config ?? loadConfig4();
3150
+ const config = opts.config ?? loadConfig5();
3015
3151
  const store = opts.store ?? new ImportTrustStore(trustedImportsPath(config.homeDir));
3016
3152
  const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
3017
3153
  const targets = externalImportTargets({
@@ -3034,7 +3170,7 @@ async function maybePromptForExternalImports(opts = {}) {
3034
3170
  print(applyImportChoice(store, target, choice));
3035
3171
  } catch (err2) {
3036
3172
  print(
3037
- t21("import_prompt.write_failed", {
3173
+ t22("import_prompt.write_failed", {
3038
3174
  message: err2 instanceof Error ? err2.message : String(err2)
3039
3175
  })
3040
3176
  );
@@ -3052,7 +3188,7 @@ async function askImportChoice(_target) {
3052
3188
  try {
3053
3189
  const options = choices2();
3054
3190
  return await select2({
3055
- message: t21("import_prompt.ask"),
3191
+ message: t22("import_prompt.ask"),
3056
3192
  choices: [...options],
3057
3193
  default: options[0]?.value
3058
3194
  });
@@ -3091,8 +3227,8 @@ function createStreamWriter(enabled, sink) {
3091
3227
  err2(body + (endsNl ? "\n" : ""));
3092
3228
  midLive = !endsNl;
3093
3229
  },
3094
- notice(line) {
3095
- if (!enabled || !line) return;
3230
+ notice(line2) {
3231
+ if (!enabled || !line2) return;
3096
3232
  if (midText) {
3097
3233
  out2("\n");
3098
3234
  midText = false;
@@ -3101,7 +3237,7 @@ function createStreamWriter(enabled, sink) {
3101
3237
  err2("\n");
3102
3238
  midLive = false;
3103
3239
  }
3104
- err2(line.endsWith("\n") ? line : line + "\n");
3240
+ err2(line2.endsWith("\n") ? line2 : line2 + "\n");
3105
3241
  },
3106
3242
  end() {
3107
3243
  if (!enabled) return;
@@ -3141,7 +3277,7 @@ function composeContent(query, images) {
3141
3277
  throw new CliError(
3142
3278
  err2 instanceof Error ? err2.message : String(err2),
3143
3279
  EXIT_CODES.FAILURE,
3144
- t22("run_once.err_image")
3280
+ t23("run_once.err_image")
3145
3281
  );
3146
3282
  }
3147
3283
  }
@@ -3150,9 +3286,9 @@ async function runOnce(query, opts, resumeId) {
3150
3286
  const { policy: headless, invalid } = parseHeadlessFlags(opts);
3151
3287
  if (invalid.length > 0) {
3152
3288
  throw new CliError(
3153
- t22("run_once.err_bad_operation", { values: invalid.join(", ") }),
3289
+ t23("run_once.err_bad_operation", { values: invalid.join(", ") }),
3154
3290
  EXIT_CODES.FAILURE,
3155
- t22("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES2.join(" / ") })
3291
+ t23("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES2.join(" / ") })
3156
3292
  );
3157
3293
  }
3158
3294
  const format = resolveOutputFormat(opts);
@@ -3182,10 +3318,10 @@ async function runOnce(query, opts, resumeId) {
3182
3318
  const detail = runtime.diagnostics.join("\n ");
3183
3319
  await runtime.dispose();
3184
3320
  throw new CliError(
3185
- t22("run_once.err_no_provider"),
3321
+ t23("run_once.err_no_provider"),
3186
3322
  EXIT_CODES.FAILURE,
3187
- detail ? `${t22("run_once.err_no_provider_diag")}
3188
- ${detail}` : t22("run_once.err_no_provider_hint")
3323
+ detail ? `${t23("run_once.err_no_provider_diag")}
3324
+ ${detail}` : t23("run_once.err_no_provider_hint")
3189
3325
  );
3190
3326
  }
3191
3327
  installShutdown(runtime);
@@ -3194,7 +3330,7 @@ async function runOnce(query, opts, resumeId) {
3194
3330
  if (resumeId) {
3195
3331
  const restored = runtime.session.getHistory().length;
3196
3332
  process.stderr.write(
3197
- `${t22("run_once.resumed", {
3333
+ `${t23("run_once.resumed", {
3198
3334
  id: resumeId.slice(0, SHORT_ID_LEN),
3199
3335
  count: restored
3200
3336
  })}
@@ -3270,7 +3406,7 @@ function collect2(out2, ev, w) {
3270
3406
  } else if (ev.type === "notice") {
3271
3407
  w.notice(ev.text);
3272
3408
  } else if (ev.type === "error") {
3273
- out2.text = t22("run_once.error_prefix", { message: ev.message });
3409
+ out2.text = t23("run_once.error_prefix", { message: ev.message });
3274
3410
  w.notice(out2.text);
3275
3411
  process.exitCode = EXIT_CODES.FAILURE;
3276
3412
  } else if (ev.type === "finish") {
@@ -3306,14 +3442,14 @@ function emitOutcome(out2, opts, format, emitter, tasks = []) {
3306
3442
  return;
3307
3443
  }
3308
3444
  if (out2.reasoning) {
3309
- process.stderr.write(`${t22("run_once.reasoning_head")}
3445
+ process.stderr.write(`${t23("run_once.reasoning_head")}
3310
3446
  ${out2.reasoning}
3311
3447
 
3312
3448
  `);
3313
3449
  }
3314
3450
  if (opts.stream === false && out2.text) process.stdout.write(out2.text + "\n");
3315
3451
  if (out2.aborted) process.stderr.write(`
3316
- ${t22("run_once.aborted")}
3452
+ ${t23("run_once.aborted")}
3317
3453
  `);
3318
3454
  if (taskLines) process.stderr.write(taskLines + "\n");
3319
3455
  const summary = formatSummary(out2.usage, out2.budgetExceeded);
@@ -3330,10 +3466,10 @@ function noteworthy(diagnostics, verbose) {
3330
3466
  }
3331
3467
  function formatSummary(usage, budgetExceeded) {
3332
3468
  if (!usage) return "";
3333
- const cached = usage.cacheHitTokens ? t22("run_once.cache_hit", { count: usage.cacheHitTokens }) : "";
3469
+ const cached = usage.cacheHitTokens ? t23("run_once.cache_hit", { count: usage.cacheHitTokens }) : "";
3334
3470
  const tokens = `${promptTokens(usage)} in${cached} / ${usage.outputTokens} out`;
3335
- const cost = usage.costUsd === void 0 ? t22("run_once.cost_unknown") : formatUsd(usage.costUsd);
3336
- const stopped = budgetExceeded ? t22("run_once.budget_reached") : "";
3471
+ const cost = usage.costUsd === void 0 ? t23("run_once.cost_unknown") : formatUsd(usage.costUsd);
3472
+ const stopped = budgetExceeded ? t23("run_once.budget_reached") : "";
3337
3473
  return `\u2500 ${tokens} \xB7 ${cost}${stopped}`;
3338
3474
  }
3339
3475
  function reportHeadlessAudit(permission) {
@@ -3342,7 +3478,7 @@ function reportHeadlessAudit(permission) {
3342
3478
  for (const e of audit) {
3343
3479
  const vars = { tool: e.toolName, target: e.target, reason: e.reason };
3344
3480
  process.stderr.write(
3345
- `${e.outcome === "granted" ? t22("run_once.audit_granted", vars) : t22("run_once.audit_denied", vars)}
3481
+ `${e.outcome === "granted" ? t23("run_once.audit_granted", vars) : t23("run_once.audit_denied", vars)}
3346
3482
  `
3347
3483
  );
3348
3484
  }
@@ -3351,8 +3487,8 @@ function reportHeadlessAudit(permission) {
3351
3487
  }
3352
3488
  }
3353
3489
  // src/commands/run-overrides.ts
3354
- import { isPermissionLevel as isPermissionLevel2, PERMISSION_LEVELS as PERMISSION_LEVELS2 } from "@epoch-agent/core";
3355
- import { t as t23 } from "@epoch-agent/infra";
3490
+ import { PERMISSION_LEVELS as PERMISSION_LEVELS2, resolvePermissionLevel as resolvePermissionLevel2 } from "@epoch-agent/core";
3491
+ import { t as t24 } from "@epoch-agent/infra";
3356
3492
  import { parseModelRef as parseModelRef2 } from "@epoch-agent/protocol";
3357
3493
  function applyRunFlags(opts) {
3358
3494
  applySettingsPath(opts.settings);
@@ -3368,23 +3504,24 @@ function applyOverrides(opts) {
3368
3504
  process.env.EPOCH_FALLBACK_MODEL = assertModelName(opts.fallbackModel, "--fallback-model");
3369
3505
  }
3370
3506
  if (opts.permission) {
3371
- if (!isPermissionLevel2(opts.permission)) {
3507
+ const level = resolvePermissionLevel2(opts.permission);
3508
+ if (!level) {
3372
3509
  throw new CliError(
3373
- t23("flags.permission_unknown", { value: opts.permission }),
3510
+ t24("flags.permission_unknown", { value: opts.permission }),
3374
3511
  1,
3375
- t23("flags.choices", { choices: PERMISSION_LEVELS2.join(", ") })
3512
+ t24("flags.choices", { choices: PERMISSION_LEVELS2.join(", ") })
3376
3513
  );
3377
3514
  }
3378
- process.env.EPOCH_PERMISSION = opts.permission;
3515
+ process.env.EPOCH_PERMISSION = level;
3379
3516
  }
3380
3517
  }
3381
3518
  function assertModelName(value, flag) {
3382
3519
  const spec = value.trim();
3383
3520
  if (parseModelRef2(spec)) return spec;
3384
3521
  throw new CliError(
3385
- t23("flags.model_not_a_name", { flag, value }),
3522
+ t24("flags.model_not_a_name", { flag, value }),
3386
3523
  1,
3387
- t23("flags.model_not_a_name_hint", { value: spec })
3524
+ t24("flags.model_not_a_name_hint", { value: spec })
3388
3525
  );
3389
3526
  }
3390
3527
  // src/commands/sessions.ts
@@ -3395,56 +3532,56 @@ import {
3395
3532
  resolveProjectRoot as resolveProjectRoot3,
3396
3533
  SessionManager
3397
3534
  } from "@epoch-agent/core";
3398
- import { dbPath, t as t24, uiDateLocale as uiDateLocale2 } from "@epoch-agent/infra";
3399
- var log7 = (msg) => process.stdout.write(msg + "\n");
3535
+ import { dbPath, t as t25, uiDateLocale as uiDateLocale2 } from "@epoch-agent/infra";
3536
+ var log8 = (msg) => process.stdout.write(msg + "\n");
3400
3537
  var SHORT_ID_LEN2 = 8;
3401
3538
  var PICK_LIMIT = 20;
3402
3539
  var DEFAULT_RETENTION_DAYS = 90;
3403
3540
  var VACUUM_MIN_FREELIST_RATIO = 0.25;
3404
3541
  function whenOf(startedAt) {
3405
- return startedAt ? new Date(startedAt).toLocaleString(uiDateLocale2()) : t24("sessions.when_unknown");
3542
+ return startedAt ? new Date(startedAt).toLocaleString(uiDateLocale2()) : t25("sessions.when_unknown");
3406
3543
  }
3407
3544
  function titleOf(s) {
3408
- return s.title || s.preview || t24("sessions.untitled");
3545
+ return s.title || s.preview || t25("sessions.untitled");
3409
3546
  }
3410
3547
  function registerSessionsCommand(program2) {
3411
- const cmd = program2.command("sessions").alias("session").description(t24("sessions.cmd_root"));
3412
- cmd.command("list").description(t24("sessions.cmd_list")).option("-n, --limit <n>", t24("sessions.opt_limit"), "10").option("-a, --archived", t24("sessions.opt_archived")).action((opts) => {
3548
+ const cmd = program2.command("sessions").alias("session").description(t25("sessions.cmd_root"));
3549
+ cmd.command("list").description(t25("sessions.cmd_list")).option("-n, --limit <n>", t25("sessions.opt_limit"), "10").option("-a, --archived", t25("sessions.opt_archived")).action((opts) => {
3413
3550
  withSessions((sm) => {
3414
3551
  const r = sm.list({
3415
3552
  limit: parseInt(opts.limit, 10),
3416
3553
  ...opts.archived ? { archived: true } : {}
3417
3554
  });
3418
3555
  if (r.sessions.length === 0) {
3419
- log7(` ${t24(opts.archived ? "sessions.list_empty_archived" : "sessions.list_empty")}`);
3556
+ log8(` ${t25(opts.archived ? "sessions.list_empty_archived" : "sessions.list_empty")}`);
3420
3557
  return;
3421
3558
  }
3422
3559
  for (const s of r.sessions) {
3423
- log7(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.startedAt)} ${titleOf(s)}`);
3560
+ log8(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.startedAt)} ${titleOf(s)}`);
3424
3561
  }
3425
3562
  });
3426
3563
  });
3427
- cmd.command("archive").description(t24("sessions.cmd_archive")).argument("<id>", t24("sessions.arg_id")).action((id) => {
3564
+ cmd.command("archive").description(t25("sessions.cmd_archive")).argument("<id>", t25("sessions.arg_id")).action((id) => {
3428
3565
  const resolved = resolveSessionId(id, { includeArchived: true });
3429
3566
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3430
3567
  withSessions((sm) => sm.archive(resolved.id));
3431
- log7(t24("sessions.archived_ok", { id: resolved.id.slice(0, SHORT_ID_LEN2) }));
3568
+ log8(t25("sessions.archived_ok", { id: resolved.id.slice(0, SHORT_ID_LEN2) }));
3432
3569
  });
3433
- cmd.command("unarchive").description(t24("sessions.cmd_unarchive")).argument("<id>", t24("sessions.arg_id")).action((id) => {
3570
+ cmd.command("unarchive").description(t25("sessions.cmd_unarchive")).argument("<id>", t25("sessions.arg_id")).action((id) => {
3434
3571
  const resolved = resolveSessionId(id, { includeArchived: true });
3435
3572
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3436
3573
  withSessions((sm) => sm.unarchive(resolved.id));
3437
- log7(t24("sessions.unarchived_ok", { id: resolved.id.slice(0, SHORT_ID_LEN2) }));
3574
+ log8(t25("sessions.unarchived_ok", { id: resolved.id.slice(0, SHORT_ID_LEN2) }));
3438
3575
  });
3439
- cmd.command("export").description(t24("sessions.cmd_export")).argument("<id>", t24("sessions.arg_id")).argument("[file]", t24("sessions.arg_export_file")).option("-f, --format <fmt>", t24("sessions.opt_format"), "json").option("--redact", t24("sessions.opt_redact")).action((id, file, opts) => {
3576
+ cmd.command("export").description(t25("sessions.cmd_export")).argument("<id>", t25("sessions.arg_id")).argument("[file]", t25("sessions.arg_export_file")).option("-f, --format <fmt>", t25("sessions.opt_format"), "json").option("--redact", t25("sessions.opt_redact")).action((id, file, opts) => {
3440
3577
  const resolved = resolveSessionId(id, { includeArchived: true });
3441
3578
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3442
3579
  const format = opts.format === "md" ? "markdown" : opts.format === "json" ? "json" : null;
3443
3580
  if (format === null) {
3444
3581
  throw new CliError(
3445
- t24("sessions.err_format", { format: opts.format }),
3582
+ t25("sessions.err_format", { format: opts.format }),
3446
3583
  EXIT_CODES.FAILURE,
3447
- t24("sessions.err_format_hint")
3584
+ t25("sessions.err_format_hint")
3448
3585
  );
3449
3586
  }
3450
3587
  const raw = withSessions((sm) => sm.export(resolved.id, format));
@@ -3454,13 +3591,13 @@ function registerSessionsCommand(program2) {
3454
3591
  return;
3455
3592
  }
3456
3593
  writeFileSync2(file, body.endsWith("\n") ? body : body + "\n", "utf8");
3457
- log7(t24("sessions.export_ok", { file }));
3594
+ log8(t25("sessions.export_ok", { file }));
3458
3595
  });
3459
- cmd.command("prune").description(t24("sessions.cmd_prune")).option("--older-than <days>", t24("sessions.opt_older_than"), String(DEFAULT_RETENTION_DAYS)).option("--archived-only", t24("sessions.opt_archived_only")).option("--include-pinned", t24("sessions.opt_include_pinned")).option("--yes", t24("sessions.opt_yes")).action(
3596
+ cmd.command("prune").description(t25("sessions.cmd_prune")).option("--older-than <days>", t25("sessions.opt_older_than"), String(DEFAULT_RETENTION_DAYS)).option("--archived-only", t25("sessions.opt_archived_only")).option("--include-pinned", t25("sessions.opt_include_pinned")).option("--yes", t25("sessions.opt_yes")).action(
3460
3597
  (opts) => {
3461
3598
  const days = Number(opts.olderThan);
3462
3599
  if (!Number.isFinite(days) || days <= 0) {
3463
- throw new CliError(t24("sessions.err_days", { value: opts.olderThan }), EXIT_CODES.FAILURE);
3600
+ throw new CliError(t25("sessions.err_days", { value: opts.olderThan }), EXIT_CODES.FAILURE);
3464
3601
  }
3465
3602
  const olderThanMs = Date.now() - days * 24 * 60 * 60 * 1e3;
3466
3603
  const select2 = {
@@ -3470,7 +3607,7 @@ function registerSessionsCommand(program2) {
3470
3607
  };
3471
3608
  const sweepOrphans = () => {
3472
3609
  const swept = withSessions((sm) => sm.sweepOrphans({ olderThanMs, now: Date.now() }));
3473
- if (swept > 0) log7(t24("sessions.prune_swept", { count: swept, days }));
3610
+ if (swept > 0) log8(t25("sessions.prune_swept", { count: swept, days }));
3474
3611
  };
3475
3612
  const { victims, openCount } = withSessions((sm) => ({
3476
3613
  victims: sm.pruneCandidates(select2),
@@ -3481,52 +3618,52 @@ function registerSessionsCommand(program2) {
3481
3618
  }));
3482
3619
  const sweepNote = () => {
3483
3620
  if (openCount === 0) return;
3484
- log7(t24("sessions.prune_open_skipped", { count: openCount }));
3485
- if (!opts.yes) log7(t24("sessions.prune_sweep_preview", { days }));
3621
+ log8(t25("sessions.prune_open_skipped", { count: openCount }));
3622
+ if (!opts.yes) log8(t25("sessions.prune_sweep_preview", { days }));
3486
3623
  };
3487
3624
  if (victims.length === 0) {
3488
- log7(t24("sessions.prune_none", { days }));
3625
+ log8(t25("sessions.prune_none", { days }));
3489
3626
  sweepNote();
3490
3627
  if (opts.yes) sweepOrphans();
3491
3628
  return;
3492
3629
  }
3493
- log7(t24("sessions.prune_head"));
3630
+ log8(t25("sessions.prune_head"));
3494
3631
  for (const s of victims) {
3495
- log7(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.updatedAt)} ${titleOf(s)}`);
3632
+ log8(` ${s.id.slice(0, SHORT_ID_LEN2)} ${whenOf(s.updatedAt)} ${titleOf(s)}`);
3496
3633
  }
3497
3634
  sweepNote();
3498
3635
  if (!opts.yes) {
3499
- log7(t24("sessions.prune_preview", { count: victims.length, days }));
3636
+ log8(t25("sessions.prune_preview", { count: victims.length, days }));
3500
3637
  return;
3501
3638
  }
3502
3639
  let removed = 0;
3503
3640
  withSessions((sm) => {
3504
3641
  for (const s of victims) if (sm.delete(s.id)) removed++;
3505
3642
  });
3506
- log7(t24("sessions.prune_done", { count: removed }));
3643
+ log8(t25("sessions.prune_done", { count: removed }));
3507
3644
  sweepOrphans();
3508
3645
  if (removed > 0) {
3509
3646
  const ratio = withSessions((sm) => sm.freelistRatio());
3510
3647
  if (ratio > VACUUM_MIN_FREELIST_RATIO) {
3511
3648
  const report = withSessions((sm) => sm.reclaimFts(true));
3512
- if (report.vacuumed) log7(t24("sessions.prune_vacuumed"));
3649
+ if (report.vacuumed) log8(t25("sessions.prune_vacuumed"));
3513
3650
  }
3514
3651
  }
3515
3652
  }
3516
3653
  );
3517
- cmd.command("resume").description(t24("sessions.cmd_resume")).argument("[id]", t24("sessions.arg_id")).argument("[query]", t24("sessions.arg_query")).action(async (id, query) => {
3654
+ cmd.command("resume").description(t25("sessions.cmd_resume")).argument("[id]", t25("sessions.arg_id")).argument("[query]", t25("sessions.arg_query")).action(async (id, query) => {
3518
3655
  const resolved = resolveSessionId(id);
3519
3656
  if (!resolved.ok) {
3520
3657
  throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3521
3658
  }
3522
- await runOnce(query || t24("sessions.default_query"), {}, resolved.id);
3659
+ await runOnce(query || t25("sessions.default_query"), {}, resolved.id);
3523
3660
  });
3524
3661
  }
3525
3662
  function resolveSessionId(input2, opts = {}) {
3526
3663
  return withSessions((sm) => {
3527
3664
  if (!input2) {
3528
3665
  const latest = sm.getLatest()?.meta.id;
3529
- return latest ? { ok: true, id: latest } : { ok: false, error: t24("sessions.err_none") };
3666
+ return latest ? { ok: true, id: latest } : { ok: false, error: t25("sessions.err_none") };
3530
3667
  }
3531
3668
  if (sm.get(input2)) return { ok: true, id: input2 };
3532
3669
  const pool = sm.list({ limit: 200 }).sessions;
@@ -3534,11 +3671,11 @@ function resolveSessionId(input2, opts = {}) {
3534
3671
  const candidates = all.filter((s) => s.id.startsWith(input2)).map((s) => s.id);
3535
3672
  if (candidates.length === 1) return { ok: true, id: candidates[0] };
3536
3673
  if (candidates.length === 0) {
3537
- return { ok: false, error: t24("sessions.err_not_found", { input: input2 }) };
3674
+ return { ok: false, error: t25("sessions.err_not_found", { input: input2 }) };
3538
3675
  }
3539
3676
  return {
3540
3677
  ok: false,
3541
- error: t24("sessions.err_ambiguous", { input: input2, count: candidates.length })
3678
+ error: t25("sessions.err_ambiguous", { input: input2, count: candidates.length })
3542
3679
  };
3543
3680
  });
3544
3681
  }
@@ -3549,9 +3686,9 @@ function latestSessionIdForProject(cwd = process.cwd()) {
3549
3686
  async function pickSessionId() {
3550
3687
  if (isNonInteractive7()) {
3551
3688
  throw new CliError(
3552
- t24("sessions.err_needs_id"),
3689
+ t25("sessions.err_needs_id"),
3553
3690
  EXIT_CODES.FAILURE,
3554
- t24("sessions.err_needs_id_hint")
3691
+ t25("sessions.err_needs_id_hint")
3555
3692
  );
3556
3693
  }
3557
3694
  const rows = withSessions(
@@ -3559,22 +3696,22 @@ async function pickSessionId() {
3559
3696
  id: s.id,
3560
3697
  title: titleOf(s),
3561
3698
  when: whenOf(s.startedAt),
3562
- where: s.cwd ?? t24("sessions.cwd_unrecorded"),
3699
+ where: s.cwd ?? t25("sessions.cwd_unrecorded"),
3563
3700
  messageCount: s.messageCount
3564
3701
  }))
3565
3702
  );
3566
3703
  if (rows.length === 0) {
3567
- log7(t24("sessions.pick_empty"));
3704
+ log8(t25("sessions.pick_empty"));
3568
3705
  return void 0;
3569
3706
  }
3570
3707
  const { select: select2 } = await import("@inquirer/prompts");
3571
3708
  try {
3572
3709
  return await select2({
3573
- message: t24("sessions.pick_prompt"),
3710
+ message: t25("sessions.pick_prompt"),
3574
3711
  choices: rows.map((r) => ({
3575
3712
  name: `${r.id.slice(0, SHORT_ID_LEN2)} ${r.when} ${r.title}`,
3576
3713
  value: r.id,
3577
- description: `${t24("tui.resume.message_count", { n: r.messageCount })} \xB7 ${r.where}`
3714
+ description: `${t25("tui.resume.message_count", { n: r.messageCount })} \xB7 ${r.where}`
3578
3715
  })),
3579
3716
  pageSize: 12
3580
3717
  });
@@ -3591,27 +3728,27 @@ function withSessions(fn) {
3591
3728
  }
3592
3729
  }
3593
3730
  // src/commands/run.ts
3594
- var log8 = (msg) => {
3731
+ var log9 = (msg) => {
3595
3732
  process.stdout.write(msg + "\n");
3596
3733
  };
3597
3734
  function registerRunCommand(program2) {
3598
- program2.argument("[query]", t25("run.arg_query")).option("--allow-tool <name>", t25("run.opt_allow_tool"), collect, []).option(
3735
+ program2.argument("[query]", t26("run.arg_query")).option("--allow-tool <name>", t26("run.opt_allow_tool"), collect, []).option(
3599
3736
  "--allow-operation <type>",
3600
- t25("run.opt_allow_operation", { types: OPERATION_TYPES3.join(" / ") }),
3737
+ t26("run.opt_allow_operation", { types: OPERATION_TYPES3.join(" / ") }),
3601
3738
  collect,
3602
3739
  []
3603
- ).option("-i, --image <path>", t25("run.opt_image"), collect, []).option("-c, --continue", t25("run.opt_continue")).option("-r, --resume [id]", t25("run.opt_resume")).option("-m, --model <name>", t25("run.opt_model")).option("--fallback-model <name>", t25("run.opt_fallback_model")).option(
3740
+ ).option("-i, --image <path>", t26("run.opt_image"), collect, []).option("-c, --continue", t26("run.opt_continue")).option("-r, --resume [id]", t26("run.opt_resume")).option("-m, --model <name>", t26("run.opt_model")).option("--fallback-model <name>", t26("run.opt_fallback_model")).option(
3604
3741
  "--permission <level>",
3605
- t25("run.opt_permission", { levels: PERMISSION_LEVELS3.join(" / ") })
3606
- ).option("--settings <file>", t25("run.opt_settings")).option("--add-dir <dir>", t25("run.opt_add_dir"), collect, []).option("--agent <role>", t25("run.opt_agent")).option("--worktree", t25("run.opt_worktree")).option("--json", t25("run.opt_json")).option(
3742
+ t26("run.opt_permission", { levels: PERMISSION_LEVELS3.join(" / ") })
3743
+ ).option("--settings <file>", t26("run.opt_settings")).option("--add-dir <dir>", t26("run.opt_add_dir"), collect, []).option("--agent <role>", t26("run.opt_agent")).option("--worktree", t26("run.opt_worktree")).option("--json", t26("run.opt_json")).option(
3607
3744
  "--output-format <fmt>",
3608
- t25("run.opt_output_format", { formats: HEADLESS_OUTPUT_FORMATS2.join(" / ") })
3745
+ t26("run.opt_output_format", { formats: HEADLESS_OUTPUT_FORMATS2.join(" / ") })
3609
3746
  ).option(
3610
3747
  "--input-format <fmt>",
3611
- t25("run.opt_input_format", { formats: HEADLESS_INPUT_FORMATS2.join(" / ") })
3612
- ).option("--permission-prompt-tool <program>", t25("run.opt_permission_prompt_tool")).option("--max-turns <n>", t25("run.opt_max_turns")).option("--max-budget-usd <x>", t25("run.opt_max_budget")).option("--no-stream", t25("run.opt_no_stream")).option("-v, --verbose", t25("run.opt_verbose")).option("-V, --version", t25("run.opt_version")).action(async (query, opts) => {
3748
+ t26("run.opt_input_format", { formats: HEADLESS_INPUT_FORMATS2.join(" / ") })
3749
+ ).option("--permission-prompt-tool <program>", t26("run.opt_permission_prompt_tool")).option("--max-turns <n>", t26("run.opt_max_turns")).option("--max-budget-usd <x>", t26("run.opt_max_budget")).option("--no-stream", t26("run.opt_no_stream")).option("-v, --verbose", t26("run.opt_verbose")).option("-V, --version", t26("run.opt_version")).action(async (query, opts) => {
3613
3750
  if (opts.version === true) {
3614
- log8(describeVersion(selfPackage().name));
3751
+ log9(describeVersion(selfPackage().name));
3615
3752
  return;
3616
3753
  }
3617
3754
  applyRunFlags(opts);
@@ -3621,30 +3758,30 @@ function registerRunCommand(program2) {
3621
3758
  if (formats.input === "stream-json") {
3622
3759
  if (opts.continue === true || resumeArg.kind !== "off") {
3623
3760
  throw new CliError(
3624
- t25("run.conflict_resume"),
3761
+ t26("run.conflict_resume"),
3625
3762
  EXIT_CODES.FAILURE,
3626
- t25("run.conflict_resume_hint")
3763
+ t26("run.conflict_resume_hint")
3627
3764
  );
3628
3765
  }
3629
3766
  if (opts.worktree === true) {
3630
3767
  throw new CliError(
3631
- t25("run.conflict_worktree"),
3768
+ t26("run.conflict_worktree"),
3632
3769
  EXIT_CODES.FAILURE,
3633
- t25("run.conflict_worktree_hint")
3770
+ t26("run.conflict_worktree_hint")
3634
3771
  );
3635
3772
  }
3636
3773
  if (opts.permissionPromptTool !== void 0) {
3637
3774
  throw new CliError(
3638
- t25("run.conflict_prompt_tool"),
3775
+ t26("run.conflict_prompt_tool"),
3639
3776
  EXIT_CODES.FAILURE,
3640
- t25("run.conflict_prompt_tool_hint")
3777
+ t26("run.conflict_prompt_tool_hint")
3641
3778
  );
3642
3779
  }
3643
3780
  if (!hasUsableModel()) {
3644
3781
  throw new CliError(
3645
- t25("run.no_credentials_stream"),
3782
+ t26("run.no_credentials_stream"),
3646
3783
  EXIT_CODES.FAILURE,
3647
- t25("run.no_credentials_hint")
3784
+ t26("run.no_credentials_hint")
3648
3785
  );
3649
3786
  }
3650
3787
  process.exitCode = await runStreamJsonSession(opts);
@@ -3653,7 +3790,7 @@ function registerRunCommand(program2) {
3653
3790
  const carried = resumeArg.kind === "pick" ? resumeArg.query : void 0;
3654
3791
  const prompt = composePrompt(query ?? carried, await readStdin2());
3655
3792
  if (!hasUsableModel()) {
3656
- log8(t25("run.welcome"));
3793
+ log9(t26("run.welcome"));
3657
3794
  return;
3658
3795
  }
3659
3796
  const resumeId = await resolveResumeTarget(opts, resumeArg);
@@ -3661,9 +3798,9 @@ function registerRunCommand(program2) {
3661
3798
  if (!prompt && (opts.image ?? []).length === 0) {
3662
3799
  if (refuseEmptyQuery(isNonInteractive8(), formats.output)) {
3663
3800
  throw new CliError(
3664
- t25("run.no_query_noninteractive"),
3801
+ t26("run.no_query_noninteractive"),
3665
3802
  EXIT_CODES.FAILURE,
3666
- t25("run.no_query_hint")
3803
+ t26("run.no_query_hint")
3667
3804
  );
3668
3805
  }
3669
3806
  return launchTui(resumeId);
@@ -3688,7 +3825,7 @@ async function resolveResumeTarget(opts, resumeArg) {
3688
3825
  if (opts.continue === true) {
3689
3826
  const latest = latestSessionIdForProject();
3690
3827
  if (!latest) {
3691
- process.stderr.write(`${t25("run.no_history")}
3828
+ process.stderr.write(`${t26("run.no_history")}
3692
3829
  `);
3693
3830
  }
3694
3831
  return latest;
@@ -3699,7 +3836,7 @@ async function resolveResumeTarget(opts, resumeArg) {
3699
3836
  throw new CliError(
3700
3837
  resolved.error,
3701
3838
  EXIT_CODES.FAILURE,
3702
- t25("run.resume_not_id_hint")
3839
+ t26("run.resume_not_id_hint")
3703
3840
  );
3704
3841
  }
3705
3842
  return resolved.id;
@@ -3718,7 +3855,7 @@ function resolveTuiEntry(baseDir, exists = existsSync6) {
3718
3855
  async function launchTui(resumeId) {
3719
3856
  const target = resolveTuiEntry(dirname4(fileURLToPath3(import.meta.url)));
3720
3857
  if (!target) {
3721
- process.stderr.write(`${t25("run.tui_entry_missing")}
3858
+ process.stderr.write(`${t26("run.tui_entry_missing")}
3722
3859
  `);
3723
3860
  process.exitCode = EXIT_CODES.FAILURE;
3724
3861
  return;
@@ -3729,7 +3866,7 @@ async function launchTui(resumeId) {
3729
3866
  const { spawn: spawn3 } = await import("child_process");
3730
3867
  await new Promise((done) => {
3731
3868
  const failToStart = (err2) => {
3732
- process.stderr.write(`${t25("run.tui_spawn_failed", { message: err2.message })}
3869
+ process.stderr.write(`${t26("run.tui_spawn_failed", { message: err2.message })}
3733
3870
  `);
3734
3871
  process.exitCode = EXIT_CODES.FAILURE;
3735
3872
  done();
@@ -3750,25 +3887,27 @@ async function launchTui(resumeId) {
3750
3887
  });
3751
3888
  }
3752
3889
  // src/commands/schedule.ts
3753
- import { t as t33 } from "@epoch-agent/infra";
3890
+ import { t as t34 } from "@epoch-agent/infra";
3754
3891
  // src/schedule/add.ts
3755
3892
  import {
3756
3893
  isValidInterval,
3757
3894
  SCHEDULE_DEFAULTS,
3758
3895
  validateSchedule
3759
3896
  } from "@epoch-agent/core";
3760
- import { automationWorkDir, t as t28 } from "@epoch-agent/infra";
3897
+ import { automationWorkDir, t as t29 } from "@epoch-agent/infra";
3761
3898
  import {
3899
+ approvalPolicyForLevel,
3762
3900
  isOperationType as isOperationType2,
3763
- isPermissionLevel as isPermissionLevel3,
3764
3901
  OPERATION_TYPES as OPERATION_TYPES4,
3765
3902
  parseModelRef as parseModelRef3,
3766
3903
  PERMISSION_LEVELS as PERMISSION_LEVELS4,
3904
+ resolvePermissionLevel as resolvePermissionLevel3,
3905
+ SCHEDULE_DEFAULT_PERMISSION,
3767
3906
  SCHEDULE_INTERVAL_MAX_MINUTES,
3768
3907
  SCHEDULE_INTERVAL_MIN_MINUTES
3769
3908
  } from "@epoch-agent/protocol";
3770
3909
  // src/schedule/labels.ts
3771
- import { t as t26 } from "@epoch-agent/infra";
3910
+ import { t as t27 } from "@epoch-agent/infra";
3772
3911
  import {
3773
3912
  collectPendingApprovals,
3774
3913
  cronTimes
@@ -3778,7 +3917,6 @@ var ISSUE_KEYS = {
3778
3917
  "prompt-empty": "schedule.issue.prompt_empty",
3779
3918
  "permission-unknown": "schedule.issue.permission_unknown",
3780
3919
  "work-dir-missing": "schedule.issue.work_dir_missing",
3781
- "budget-missing": "schedule.issue.budget_missing",
3782
3920
  "max-turns-invalid": "schedule.issue.max_turns_invalid",
3783
3921
  "timeout-invalid": "schedule.issue.timeout_invalid",
3784
3922
  "trigger-time-invalid": "schedule.issue.trigger_time_invalid",
@@ -3822,36 +3960,35 @@ var DRIFT_KEYS = {
3822
3960
  "never-registered": "schedule.drift.never_registered"
3823
3961
  };
3824
3962
  function renderIssues(issues) {
3825
- return issues.map((i) => ` \xB7 ${t26(ISSUE_KEYS[i.code], { detail: i.detail ?? "" })}`).join("\n");
3963
+ return issues.map((i) => ` \xB7 ${t27(ISSUE_KEYS[i.code], { detail: i.detail ?? "" })}`).join("\n");
3826
3964
  }
3827
3965
  function statusLabel(status) {
3828
3966
  const mark = status === "ok" ? "\u2705" : status === "failed" || status === "denied" ? "\u274C" : "\u26A0\uFE0F";
3829
- return `${mark} ${t26(STATUS_KEYS[status])}`;
3967
+ return `${mark} ${t27(STATUS_KEYS[status])}`;
3830
3968
  }
3831
3969
  function driftLabel(kind) {
3832
- return t26(DRIFT_KEYS[kind]);
3970
+ return t27(DRIFT_KEYS[kind]);
3833
3971
  }
3834
3972
  function describeTrigger(trigger) {
3835
3973
  if (trigger.kind === "interval") {
3836
- return trigger.everyMinutes % 60 === 0 ? t26("schedule.trigger.every_hours", { n: trigger.everyMinutes / 60 }) : t26("schedule.trigger.every_minutes", { n: trigger.everyMinutes });
3974
+ return trigger.everyMinutes % 60 === 0 ? t27("schedule.trigger.every_hours", { n: trigger.everyMinutes / 60 }) : t27("schedule.trigger.every_minutes", { n: trigger.everyMinutes });
3837
3975
  }
3838
3976
  if (trigger.kind === "once") {
3839
- return t26("schedule.trigger.once", { date: trigger.date, at: trigger.at });
3977
+ return t27("schedule.trigger.once", { date: trigger.date, at: trigger.at });
3840
3978
  }
3841
3979
  const at = cronTimes(trigger).join("/");
3842
- if (trigger.cycle === "daily") return t26("schedule.trigger.daily", { at });
3980
+ if (trigger.cycle === "daily") return t27("schedule.trigger.daily", { at });
3843
3981
  if (trigger.cycle === "weekly") {
3844
- const days = trigger.weekdays.map((d) => t26(WEEKDAY_KEYS[d])).join("/");
3845
- return t26("schedule.trigger.weekly", { days, at });
3982
+ const days = trigger.weekdays.map((d) => t27(WEEKDAY_KEYS[d])).join("/");
3983
+ return t27("schedule.trigger.weekly", { days, at });
3846
3984
  }
3847
- return t26("schedule.trigger.monthly", { days: trigger.days.join("/"), at });
3985
+ return t27("schedule.trigger.monthly", { days: trigger.days.join("/"), at });
3848
3986
  }
3849
3987
  function permissionLabel(level) {
3850
- if (level === "plan") return t26("schedule.permission.plan");
3851
- if (level === "acceptEdits") return t26("schedule.permission.accept_edits");
3852
- if (level === "bypass") return t26("schedule.permission.bypass");
3853
- if (level === "auto") return t26("schedule.permission.auto");
3854
- return t26("schedule.permission.default");
3988
+ if (level === "plan") return t27("schedule.permission.plan");
3989
+ if (level === "acceptEdits") return t27("schedule.permission.accept_edits");
3990
+ if (level === "auto") return t27("schedule.permission.auto");
3991
+ return t27("schedule.permission.default");
3855
3992
  }
3856
3993
  // src/schedule/shared.ts
3857
3994
  import { realpathSync as realpathSync2 } from "fs";
@@ -3860,8 +3997,8 @@ import {
3860
3997
  ScheduleRegistrar,
3861
3998
  ScheduleStore
3862
3999
  } from "@epoch-agent/core";
3863
- import { dbPath as dbPath2, t as t27, uiDateLocale as uiDateLocale3 } from "@epoch-agent/infra";
3864
- var log9 = (msg) => void process.stdout.write(`${msg}
4000
+ import { dbPath as dbPath2, t as t28, uiDateLocale as uiDateLocale3 } from "@epoch-agent/infra";
4001
+ var log10 = (msg) => void process.stdout.write(`${msg}
3865
4002
  `);
3866
4003
  var warn2 = (msg) => void process.stderr.write(`${msg}
3867
4004
  `);
@@ -3889,24 +4026,24 @@ function mustFind(store, idOrPrefix) {
3889
4026
  if (hits.length === 1) return hits[0];
3890
4027
  if (hits.length === 0) {
3891
4028
  throw new CliError(
3892
- t27("schedule.err_not_found", { id: idOrPrefix }),
4029
+ t28("schedule.err_not_found", { id: idOrPrefix }),
3893
4030
  EXIT_CODES.FAILURE,
3894
- t27("schedule.err_not_found_hint")
4031
+ t28("schedule.err_not_found_hint")
3895
4032
  );
3896
4033
  }
3897
4034
  throw new CliError(
3898
- t27("schedule.err_ambiguous", { id: idOrPrefix }),
4035
+ t28("schedule.err_ambiguous", { id: idOrPrefix }),
3899
4036
  EXIT_CODES.FAILURE,
3900
4037
  hits.map((h) => ` ${h.id} ${h.name}`).join("\n")
3901
4038
  );
3902
4039
  }
3903
4040
  function reportRegistration(outcome, fatal) {
3904
4041
  if (outcome.ok) {
3905
- if (outcome.warnings.includes("source")) warn2(t27("schedule.warn_source_entry"));
4042
+ if (outcome.warnings.includes("source")) warn2(t28("schedule.warn_source_entry"));
3906
4043
  return;
3907
4044
  }
3908
- const message = outcome.reason === "unsupported-platform" ? t27("schedule.err_platform_unsupported") : outcome.reason === "backend-error" ? t27("schedule.err_backend", { detail: outcome.detail }) : outcome.refusal === "npx" ? t27("schedule.err_npx") : t27("schedule.err_no_host_runner");
3909
- const hint = outcome.reason === "refused" && outcome.refusal === "npx" ? t27("schedule.err_npx_hint") : outcome.reason === "refused" ? t27("schedule.err_no_host_runner_hint") : void 0;
4045
+ const message = outcome.reason === "unsupported-platform" ? t28("schedule.err_platform_unsupported") : outcome.reason === "backend-error" ? t28("schedule.err_backend", { detail: outcome.detail }) : outcome.refusal === "npx" ? t28("schedule.err_npx") : t28("schedule.err_no_host_runner");
4046
+ const hint = outcome.reason === "refused" && outcome.refusal === "npx" ? t28("schedule.err_npx_hint") : outcome.reason === "refused" ? t28("schedule.err_no_host_runner_hint") : void 0;
3910
4047
  if (!fatal) {
3911
4048
  warn2(message);
3912
4049
  if (hint) warn2(hint);
@@ -3931,20 +4068,19 @@ async function runAdd(opts) {
3931
4068
  name: input2.name,
3932
4069
  prompt: input2.prompt,
3933
4070
  permission,
3934
- workDir: input2.workDir ?? (permission === "bypass" ? "" : ctx.homeDir),
4071
+ workDir: input2.workDir ?? (approvalPolicyForLevel(permission) === "never" ? "" : ctx.homeDir),
3935
4072
  maxTurns: input2.maxTurns ?? SCHEDULE_DEFAULTS.maxTurns,
3936
- maxBudgetUsd: input2.maxBudgetUsd,
3937
4073
  timeoutMs: input2.timeoutMs ?? SCHEDULE_DEFAULTS.timeoutMs,
3938
4074
  trigger,
3939
4075
  ...input2.startDate !== void 0 ? { startDate: input2.startDate } : {},
3940
4076
  ...input2.endDate !== void 0 ? { endDate: input2.endDate } : {},
3941
4077
  allowRules: input2.allowRules ?? [],
3942
- bypassAcknowledged: filled.iUnderstandBypass === true,
4078
+ bypassAcknowledged: approvalPolicyForLevel(permission) === "never" ? true : filled.iUnderstandBypass === true,
3943
4079
  homeDir: ctx.homeDir
3944
4080
  });
3945
4081
  if (validation.issues.length > 0) {
3946
4082
  throw new CliError(
3947
- t28("schedule.err_invalid"),
4083
+ t29("schedule.err_invalid"),
3948
4084
  EXIT_CODES.FAILURE,
3949
4085
  renderIssues(validation.issues)
3950
4086
  );
@@ -3970,30 +4106,30 @@ async function registerOrRollback(store, def, register) {
3970
4106
  }
3971
4107
  async function fillInteractively(opts) {
3972
4108
  const hasTrigger = Boolean(opts.daily ?? opts.weekly ?? opts.monthly ?? opts.every ?? opts.once);
3973
- const missing = !opts.name || !opts.prompt || !hasTrigger || !opts.budget;
4109
+ const missing = !opts.name || !opts.prompt || !hasTrigger;
3974
4110
  if (!missing) return opts;
3975
4111
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
3976
4112
  throw new CliError(
3977
- t28("schedule.err_missing_flags"),
4113
+ t29("schedule.err_missing_flags"),
3978
4114
  EXIT_CODES.FAILURE,
3979
- t28("schedule.err_missing_flags_hint")
4115
+ t29("schedule.err_missing_flags_hint")
3980
4116
  );
3981
4117
  }
3982
4118
  const { input: input2, select: select2 } = await import("@inquirer/prompts");
3983
4119
  const next = { ...opts };
3984
- next.name ||= await input2({ message: t28("schedule.ask_name") });
3985
- next.prompt ||= await input2({ message: t28("schedule.ask_prompt") });
4120
+ next.name ||= await input2({ message: t29("schedule.ask_name") });
4121
+ next.prompt ||= await input2({ message: t29("schedule.ask_prompt") });
3986
4122
  if (!hasTrigger) {
3987
- const at = await input2({ message: t28("schedule.ask_at"), default: "09:00" });
4123
+ const at = await input2({ message: t29("schedule.ask_at"), default: "09:00" });
3988
4124
  next.daily = at;
3989
4125
  }
3990
- next.budget ||= await input2({ message: t28("schedule.ask_budget"), default: "0.50" });
3991
4126
  next.permission ||= await select2({
3992
- message: t28("schedule.ask_permission"),
4127
+ message: t29("schedule.ask_permission"),
3993
4128
  choices: [
3994
- { name: t28("schedule.permission.default"), value: "default" },
3995
- { name: t28("schedule.permission.plan"), value: "plan" },
3996
- { name: t28("schedule.permission.accept_edits"), value: "acceptEdits" }
4129
+ { name: t29("schedule.permission.auto"), value: "auto" },
4130
+ { name: t29("schedule.permission.accept_edits"), value: "acceptEdits" },
4131
+ { name: t29("schedule.permission.default"), value: "default" },
4132
+ { name: t29("schedule.permission.plan"), value: "plan" }
3997
4133
  ]
3998
4134
  });
3999
4135
  return next;
@@ -4002,8 +4138,8 @@ function parseTrigger(opts) {
4002
4138
  const given = [opts.daily, opts.weekly, opts.monthly, opts.every, opts.once].filter(
4003
4139
  (v) => v !== void 0
4004
4140
  );
4005
- if (given.length === 0) throw new CliError(t28("schedule.err_no_trigger"), EXIT_CODES.FAILURE);
4006
- if (given.length > 1) throw new CliError(t28("schedule.err_many_triggers"), EXIT_CODES.FAILURE);
4141
+ if (given.length === 0) throw new CliError(t29("schedule.err_no_trigger"), EXIT_CODES.FAILURE);
4142
+ if (given.length > 1) throw new CliError(t29("schedule.err_many_triggers"), EXIT_CODES.FAILURE);
4007
4143
  if (opts.daily !== void 0) return { kind: "cron", cycle: "daily", ...cronAt(opts.daily) };
4008
4144
  if (opts.weekly !== void 0) {
4009
4145
  return {
@@ -4024,14 +4160,14 @@ function parseTrigger(opts) {
4024
4160
  if (opts.once !== void 0) {
4025
4161
  const at = requireAt(opts);
4026
4162
  if (at.includes(",")) {
4027
- throw new CliError(t28("schedule.err_once_single_at", { value: at }), EXIT_CODES.FAILURE);
4163
+ throw new CliError(t29("schedule.err_once_single_at", { value: at }), EXIT_CODES.FAILURE);
4028
4164
  }
4029
4165
  return { kind: "once", date: opts.once, at };
4030
4166
  }
4031
4167
  return { kind: "interval", everyMinutes: parseEvery(opts.every) };
4032
4168
  }
4033
4169
  function requireAt(opts) {
4034
- if (!opts.at) throw new CliError(t28("schedule.err_at_required"), EXIT_CODES.FAILURE);
4170
+ if (!opts.at) throw new CliError(t29("schedule.err_at_required"), EXIT_CODES.FAILURE);
4035
4171
  return opts.at;
4036
4172
  }
4037
4173
  function cronAt(raw) {
@@ -4042,7 +4178,7 @@ function parseWeekday(raw) {
4042
4178
  const idx = WEEKDAY_CODES.indexOf(raw.trim().toUpperCase());
4043
4179
  if (idx < 0) {
4044
4180
  throw new CliError(
4045
- t28("schedule.err_weekday", { value: raw }),
4181
+ t29("schedule.err_weekday", { value: raw }),
4046
4182
  EXIT_CODES.FAILURE,
4047
4183
  WEEKDAY_CODES.join(",")
4048
4184
  );
@@ -4054,9 +4190,9 @@ function parseEvery(raw) {
4054
4190
  const minutes = m ? Number(m[1]) * (m[2]?.toLowerCase() === "h" ? 60 : 1) : Number.NaN;
4055
4191
  if (!isValidInterval(minutes)) {
4056
4192
  throw new CliError(
4057
- t28("schedule.err_every", { value: raw }),
4193
+ t29("schedule.err_every", { value: raw }),
4058
4194
  EXIT_CODES.FAILURE,
4059
- t28("schedule.err_every_hint", {
4195
+ t29("schedule.err_every_hint", {
4060
4196
  min: `${SCHEDULE_INTERVAL_MIN_MINUTES}m`,
4061
4197
  max: `${SCHEDULE_INTERVAL_MAX_MINUTES / 60}h`
4062
4198
  })
@@ -4065,22 +4201,23 @@ function parseEvery(raw) {
4065
4201
  return minutes;
4066
4202
  }
4067
4203
  function parsePermission(raw) {
4068
- if (raw === void 0) return "default";
4069
- if (!isPermissionLevel3(raw)) {
4204
+ if (raw === void 0) return SCHEDULE_DEFAULT_PERMISSION;
4205
+ const level = resolvePermissionLevel3(raw);
4206
+ if (!level) {
4070
4207
  throw new CliError(
4071
- t28("schedule.err_permission", { value: raw }),
4208
+ t29("schedule.err_permission", { value: raw }),
4072
4209
  EXIT_CODES.FAILURE,
4073
4210
  PERMISSION_LEVELS4.join(" / ")
4074
4211
  );
4075
4212
  }
4076
- return raw;
4213
+ return level;
4077
4214
  }
4078
4215
  function parseOperations(raw) {
4079
4216
  const out2 = [];
4080
4217
  for (const value of raw ?? []) {
4081
4218
  if (!isOperationType2(value)) {
4082
4219
  throw new CliError(
4083
- t28("schedule.err_operation", { value }),
4220
+ t29("schedule.err_operation", { value }),
4084
4221
  EXIT_CODES.FAILURE,
4085
4222
  OPERATION_TYPES4.join(" / ")
4086
4223
  );
@@ -4090,14 +4227,6 @@ function parseOperations(raw) {
4090
4227
  return out2;
4091
4228
  }
4092
4229
  function buildInput(opts, trigger, permission) {
4093
- const budget = Number(opts.budget);
4094
- if (!Number.isFinite(budget) || budget <= 0) {
4095
- throw new CliError(
4096
- t28("schedule.err_budget", { value: opts.budget ?? "" }),
4097
- EXIT_CODES.FAILURE,
4098
- t28("schedule.err_budget_hint")
4099
- );
4100
- }
4101
4230
  if (opts.model) assertModelRef(opts.model);
4102
4231
  return {
4103
4232
  name: opts.name ?? "",
@@ -4110,7 +4239,6 @@ function buildInput(opts, trigger, permission) {
4110
4239
  allowOperations: parseOperations(opts.allowOperation),
4111
4240
  ...opts.allowRule ? { allowRules: opts.allowRule } : {},
4112
4241
  ...opts.maxTurns ? { maxTurns: Number(opts.maxTurns) } : {},
4113
- maxBudgetUsd: budget,
4114
4242
  ...opts.timeout ? { timeoutMs: Number(opts.timeout) * 6e4 } : {},
4115
4243
  trigger,
4116
4244
  ...opts.start ? { startDate: opts.start } : {},
@@ -4126,67 +4254,68 @@ function createWithWorkDir(store, input2, homeDir) {
4126
4254
  }
4127
4255
  function applyDefaultAllowlist(store, def, opts) {
4128
4256
  const userGave = (opts.allowTool?.length ?? 0) > 0 || (opts.allowOperation?.length ?? 0) > 0 || (opts.allowRule?.length ?? 0) > 0;
4129
- if (userGave || def.permission === "plan" || def.permission === "bypass") return def;
4257
+ if (userGave || def.permission === "plan" || approvalPolicyForLevel(def.permission) === "never")
4258
+ return def;
4130
4259
  return store.update(def.id, {
4131
4260
  allowOperations: ["file_read"],
4132
4261
  allowRules: [`file_write(${def.workDir}/**)`]
4133
4262
  }) ?? def;
4134
4263
  }
4135
4264
  function printSummary(def) {
4136
- log9(t28("schedule.created", { id: def.id, name: def.name }));
4137
- log9("");
4138
- log9(t28("schedule.created_next", { id: def.id.slice(0, 12) }));
4265
+ log10(t29("schedule.created", { id: def.id, name: def.name }));
4266
+ log10("");
4267
+ log10(t29("schedule.created_next", { id: def.id.slice(0, 12) }));
4139
4268
  }
4140
4269
  function assertModelRef(value) {
4141
4270
  if (parseModelRef3(value)) return;
4142
4271
  throw new CliError(
4143
- t28("schedule.err_model_ref", { value }),
4272
+ t29("schedule.err_model_ref", { value }),
4144
4273
  EXIT_CODES.FAILURE,
4145
- t28("schedule.err_model_ref_hint")
4274
+ t29("schedule.err_model_ref_hint")
4146
4275
  );
4147
4276
  }
4148
4277
  // src/schedule/doctor.ts
4149
4278
  import { diagnoseSchedules, pruneSchedules, repairSchedules } from "@epoch-agent/core";
4150
- import { t as t29 } from "@epoch-agent/infra";
4279
+ import { t as t30 } from "@epoch-agent/infra";
4151
4280
  async function runDoctor(opts) {
4152
4281
  const ctx = await openSchedule();
4153
4282
  try {
4154
4283
  const deps = { store: ctx.store, backend: ctx.backend, registrar: ctx.registrar };
4155
4284
  const report = await diagnoseSchedules(deps);
4156
4285
  if (report.unsupported) {
4157
- warn2(t29("schedule.doctor_unsupported"));
4286
+ warn2(t30("schedule.doctor_unsupported"));
4158
4287
  return;
4159
4288
  }
4160
4289
  if (report.drifts.length === 0) {
4161
- log9(t29("schedule.doctor_clean", { n: report.checked }));
4290
+ log10(t30("schedule.doctor_clean", { n: report.checked }));
4162
4291
  return;
4163
4292
  }
4164
- log9(t29("schedule.doctor_found", { n: report.drifts.length }));
4293
+ log10(t30("schedule.doctor_found", { n: report.drifts.length }));
4165
4294
  for (const drift of report.drifts) {
4166
- log9(
4295
+ log10(
4167
4296
  ` \xB7 ${driftLabel(drift.kind)} ${drift.name ?? drift.scheduleId ?? ""} [${drift.osTaskId || "\u2014"}]${drift.detail ? `
4168
4297
  ${drift.detail}` : ""}`
4169
4298
  );
4170
4299
  }
4171
4300
  if (opts.repair !== true && opts.prune !== true) {
4172
- log9("");
4173
- log9(t29("schedule.doctor_hint"));
4301
+ log10("");
4302
+ log10(t30("schedule.doctor_hint"));
4174
4303
  return;
4175
4304
  }
4176
4305
  if (opts.repair === true) {
4177
4306
  for (const outcome of await repairSchedules(report.drifts, deps)) {
4178
4307
  const label = outcome.drift.name ?? outcome.drift.scheduleId ?? "";
4179
- if (outcome.ok) log9(t29("schedule.doctor_repaired", { name: label }));
4308
+ if (outcome.ok) log10(t30("schedule.doctor_repaired", { name: label }));
4180
4309
  else
4181
- warn2(t29("schedule.doctor_repair_failed", { name: label, detail: outcome.detail ?? "" }));
4310
+ warn2(t30("schedule.doctor_repair_failed", { name: label, detail: outcome.detail ?? "" }));
4182
4311
  }
4183
4312
  }
4184
4313
  if (opts.prune === true) {
4185
4314
  for (const outcome of await pruneSchedules(report.drifts, deps)) {
4186
- if (outcome.ok) log9(t29("schedule.doctor_pruned", { id: outcome.drift.osTaskId }));
4315
+ if (outcome.ok) log10(t30("schedule.doctor_pruned", { id: outcome.drift.osTaskId }));
4187
4316
  else {
4188
4317
  warn2(
4189
- t29("schedule.doctor_prune_failed", {
4318
+ t30("schedule.doctor_prune_failed", {
4190
4319
  id: outcome.drift.osTaskId,
4191
4320
  detail: outcome.detail ?? ""
4192
4321
  })
@@ -4201,15 +4330,15 @@ async function runDoctor(opts) {
4201
4330
  }
4202
4331
  // src/schedule/manage.ts
4203
4332
  import { removeRecordings } from "@epoch-agent/core";
4204
- import { automationLogsDir, t as t30 } from "@epoch-agent/infra";
4333
+ import { automationLogsDir, t as t31 } from "@epoch-agent/infra";
4205
4334
  async function runSetEnabled(idOrPrefix, enabled) {
4206
4335
  const ctx = await openSchedule();
4207
4336
  try {
4208
4337
  const def = mustFind(ctx.store, idOrPrefix);
4209
4338
  const outcome = await ctx.registrar.setEnabled(def, enabled);
4210
4339
  reportRegistration(outcome, false);
4211
- log9(
4212
- enabled ? t30("schedule.enabled_done", { name: def.name }) : t30("schedule.disabled_done", { name: def.name })
4340
+ log10(
4341
+ enabled ? t31("schedule.enabled_done", { name: def.name }) : t31("schedule.disabled_done", { name: def.name })
4213
4342
  );
4214
4343
  } finally {
4215
4344
  ctx.close();
@@ -4222,13 +4351,13 @@ async function runRemove(idOrPrefix) {
4222
4351
  if (def.osTaskId) reportRegistration(await ctx.registrar.unregister(def), false);
4223
4352
  ctx.store.remove(def.id);
4224
4353
  removeRecordings(automationLogsDir(def.id, ctx.homeDir));
4225
- log9(t30("schedule.removed", { name: def.name }));
4354
+ log10(t31("schedule.removed", { name: def.name }));
4226
4355
  } finally {
4227
4356
  ctx.close();
4228
4357
  }
4229
4358
  }
4230
4359
  // src/schedule/run.ts
4231
- import { t as t31 } from "@epoch-agent/infra";
4360
+ import { t as t32 } from "@epoch-agent/infra";
4232
4361
  import { unfixedRules } from "@epoch-agent/protocol";
4233
4362
  import { fireSchedule } from "@epoch-agent/runtime";
4234
4363
  async function runFire(scheduleId, homeDir) {
@@ -4241,9 +4370,9 @@ async function runFire(scheduleId, homeDir) {
4241
4370
  ctx.close();
4242
4371
  }
4243
4372
  if (result.missing) {
4244
- warn2(t31("schedule.fire_missing", { id: scheduleId }));
4373
+ warn2(t32("schedule.fire_missing", { id: scheduleId }));
4245
4374
  } else if (result.disabled) {
4246
- warn2(t31("schedule.fire_disabled", { id: scheduleId }));
4375
+ warn2(t32("schedule.fire_disabled", { id: scheduleId }));
4247
4376
  } else {
4248
4377
  warn2(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4249
4378
  }
@@ -4253,14 +4382,14 @@ async function runManual(idOrPrefix, opts) {
4253
4382
  const ctx = await openSchedule();
4254
4383
  try {
4255
4384
  const def = mustFind(ctx.store, idOrPrefix);
4256
- log9(t31("schedule.run_start", { name: def.name }));
4385
+ log10(t32("schedule.run_start", { name: def.name }));
4257
4386
  const result = await fireSchedule({
4258
4387
  scheduleId: def.id,
4259
4388
  homeDir: ctx.homeDir,
4260
4389
  manual: true,
4261
4390
  registrar: ctx.registrar
4262
4391
  });
4263
- log9(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4392
+ log10(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4264
4393
  const pending = result.run?.pendingApprovals ?? [];
4265
4394
  if (pending.length === 0) {
4266
4395
  process.exitCode = result.exitCode;
@@ -4269,21 +4398,21 @@ async function runManual(idOrPrefix, opts) {
4269
4398
  printPending(pending);
4270
4399
  if (opts.fix === true) {
4271
4400
  const added = applyFix(ctx.store, def.id, pending);
4272
- log9(added.length > 0 ? t31("schedule.fix_done", { n: added.length }) : t31("schedule.fix_none"));
4401
+ log10(added.length > 0 ? t32("schedule.fix_done", { n: added.length }) : t32("schedule.fix_none"));
4273
4402
  return;
4274
4403
  }
4275
- log9(t31("schedule.fix_hint", { id: def.id.slice(0, 12) }));
4404
+ log10(t32("schedule.fix_hint", { id: def.id.slice(0, 12) }));
4276
4405
  process.exitCode = result.exitCode;
4277
4406
  } finally {
4278
4407
  ctx.close();
4279
4408
  }
4280
4409
  }
4281
4410
  function printPending(pending) {
4282
- log9("");
4283
- log9(t31("schedule.pending_header", { n: pending.length }));
4411
+ log10("");
4412
+ log10(t32("schedule.pending_header", { n: pending.length }));
4284
4413
  for (const item of pending) {
4285
- log9(` \xB7 ${t31("schedule.pending_line", { tool: item.toolName, target: item.target })}`);
4286
- if (item.suggestedRule) log9(` \u2192 ${item.suggestedRule}`);
4414
+ log10(` \xB7 ${t32("schedule.pending_line", { tool: item.toolName, target: item.target })}`);
4415
+ if (item.suggestedRule) log10(` \u2192 ${item.suggestedRule}`);
4287
4416
  }
4288
4417
  }
4289
4418
  function applyFix(store, scheduleId, pending) {
@@ -4295,23 +4424,26 @@ function applyFix(store, scheduleId, pending) {
4295
4424
  }
4296
4425
  // src/schedule/view.ts
4297
4426
  import { formatUsd as formatUsd2, nextRunAt, readRecording } from "@epoch-agent/core";
4298
- import { t as t32 } from "@epoch-agent/infra";
4427
+ import { t as t33 } from "@epoch-agent/infra";
4428
+ import {
4429
+ approvalPolicyForLevel as approvalPolicyForLevel2
4430
+ } from "@epoch-agent/protocol";
4299
4431
  async function runList() {
4300
4432
  const ctx = await openSchedule();
4301
4433
  try {
4302
4434
  const defs = ctx.store.list();
4303
4435
  if (defs.length === 0) {
4304
- log9(t32("schedule.list_empty"));
4305
- log9(t32("schedule.list_empty_hint"));
4436
+ log10(t33("schedule.list_empty"));
4437
+ log10(t33("schedule.list_empty_hint"));
4306
4438
  return;
4307
4439
  }
4308
- log9(t32("schedule.list_header"));
4440
+ log10(t33("schedule.list_header"));
4309
4441
  for (const def of defs) {
4310
- const next = def.enabled ? formatWhen(nextRunAt(def.trigger, Date.now(), def.startDate, def.endDate) ?? void 0) : t32("schedule.disabled_mark");
4311
- const danger = def.permission === "bypass" ? " \u{1F534}" : "";
4312
- log9(
4442
+ const next = def.enabled ? formatWhen(nextRunAt(def.trigger, Date.now(), def.startDate, def.endDate) ?? void 0) : t33("schedule.disabled_mark");
4443
+ const danger = approvalPolicyForLevel2(def.permission) === "never" ? " \u{1F534}" : "";
4444
+ log10(
4313
4445
  ` ${def.id.slice(0, 12)} ${def.name}${danger}
4314
- ${describeTrigger(def.trigger)} \xB7 ${t32("schedule.col_next")} ${next} \xB7 ${t32("schedule.col_last")} ${def.lastStatus ? statusLabel(def.lastStatus) : "\u2014"} \xB7 ${permissionLabel(def.permission)}`
4446
+ ${describeTrigger(def.trigger)} \xB7 ${t33("schedule.col_next")} ${next} \xB7 ${t33("schedule.col_last")} ${def.lastStatus ? statusLabel(def.lastStatus) : "\u2014"} \xB7 ${permissionLabel(def.permission)}`
4315
4447
  );
4316
4448
  }
4317
4449
  } finally {
@@ -4322,51 +4454,50 @@ async function runShow(idOrPrefix) {
4322
4454
  const ctx = await openSchedule();
4323
4455
  try {
4324
4456
  const def = mustFind(ctx.store, idOrPrefix);
4325
- log9(`${def.name} (${def.id})`);
4326
- log9(` ${t32("schedule.field_enabled")}: ${def.enabled ? t32("schedule.yes") : t32("schedule.no")}`);
4327
- log9(` ${t32("schedule.field_trigger")}: ${describeTrigger(def.trigger)}`);
4457
+ log10(`${def.name} (${def.id})`);
4458
+ log10(` ${t33("schedule.field_enabled")}: ${def.enabled ? t33("schedule.yes") : t33("schedule.no")}`);
4459
+ log10(` ${t33("schedule.field_trigger")}: ${describeTrigger(def.trigger)}`);
4328
4460
  if (def.startDate ?? def.endDate) {
4329
- log9(` ${t32("schedule.field_window")}: ${def.startDate ?? "\u2014"} .. ${def.endDate ?? "\u2014"}`);
4461
+ log10(` ${t33("schedule.field_window")}: ${def.startDate ?? "\u2014"} .. ${def.endDate ?? "\u2014"}`);
4330
4462
  }
4331
- log9(
4332
- ` ${t32("schedule.field_next")}: ${formatWhen(
4463
+ log10(
4464
+ ` ${t33("schedule.field_next")}: ${formatWhen(
4333
4465
  nextRunAt(def.trigger, Date.now(), def.startDate, def.endDate) ?? void 0
4334
4466
  )}`
4335
4467
  );
4336
- log9(` ${t32("schedule.field_workdir")}: ${def.workDir}`);
4337
- if (def.model) log9(` ${t32("schedule.field_model")}: ${def.model}`);
4338
- if (def.role) log9(` ${t32("schedule.field_role")}: ${def.role}`);
4339
- log9(` ${t32("schedule.field_permission")}: ${permissionLabel(def.permission)}`);
4340
- log9(
4341
- ` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
4468
+ log10(` ${t33("schedule.field_workdir")}: ${def.workDir}`);
4469
+ if (def.model) log10(` ${t33("schedule.field_model")}: ${def.model}`);
4470
+ if (def.role) log10(` ${t33("schedule.field_role")}: ${def.role}`);
4471
+ log10(` ${t33("schedule.field_permission")}: ${permissionLabel(def.permission)}`);
4472
+ log10(
4473
+ ` ${t33("schedule.field_limits")}: ` + t33("schedule.limits_value", {
4342
4474
  turns: def.maxTurns,
4343
- budget: formatUsd2(def.maxBudgetUsd, 2),
4344
4475
  minutes: Math.round(def.timeoutMs / 6e4)
4345
4476
  })
4346
4477
  );
4347
- log9(` ${t32("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
4348
- log9(
4349
- ` ${t32("schedule.field_session")}: ` + t32(
4478
+ log10(` ${t33("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
4479
+ log10(
4480
+ ` ${t33("schedule.field_session")}: ` + t33(
4350
4481
  def.showInSessionList === true ? "schedule.session_listed" : "schedule.session_discarded"
4351
4482
  )
4352
4483
  );
4353
- log9(` ${t32("schedule.field_prompt")}:`);
4354
- for (const line of def.prompt.split("\n")) log9(` ${line}`);
4355
- log9("");
4484
+ log10(` ${t33("schedule.field_prompt")}:`);
4485
+ for (const line2 of def.prompt.split("\n")) log10(` ${line2}`);
4486
+ log10("");
4356
4487
  printAllowlist(def);
4357
- log9("");
4358
- log9(t32("schedule.field_last_run", { when: formatWhen(def.lastRunAt) }));
4488
+ log10("");
4489
+ log10(t33("schedule.field_last_run", { when: formatWhen(def.lastRunAt) }));
4359
4490
  } finally {
4360
4491
  ctx.close();
4361
4492
  }
4362
4493
  }
4363
4494
  function printAllowlist(def) {
4364
- if (def.permission === "bypass") {
4365
- log9(t32("schedule.allowlist_bypass"));
4495
+ if (approvalPolicyForLevel2(def.permission) === "never") {
4496
+ log10(t33("schedule.allowlist_bypass"));
4366
4497
  return;
4367
4498
  }
4368
4499
  if (def.permission === "plan") {
4369
- log9(t32("schedule.allowlist_readonly"));
4500
+ log10(t33("schedule.allowlist_readonly"));
4370
4501
  return;
4371
4502
  }
4372
4503
  const lines = [
@@ -4374,9 +4505,9 @@ function printAllowlist(def) {
4374
4505
  ...def.allowOperations.map((v) => ` ${v}`),
4375
4506
  ...def.allowRules.map((v) => ` ${v}`)
4376
4507
  ];
4377
- log9(t32("schedule.allowlist_header"));
4378
- log9(lines.length > 0 ? lines.join("\n") : ` ${t32("schedule.allowlist_empty")}`);
4379
- log9(t32("schedule.allowlist_scope_note"));
4508
+ log10(t33("schedule.allowlist_header"));
4509
+ log10(lines.length > 0 ? lines.join("\n") : ` ${t33("schedule.allowlist_empty")}`);
4510
+ log10(t33("schedule.allowlist_scope_note"));
4380
4511
  }
4381
4512
  async function runLogs(idOrPrefix, limit, tail) {
4382
4513
  const ctx = await openSchedule();
@@ -4384,7 +4515,7 @@ async function runLogs(idOrPrefix, limit, tail) {
4384
4515
  const def = mustFind(ctx.store, idOrPrefix);
4385
4516
  const runs = ctx.store.listRuns(def.id, limit);
4386
4517
  if (runs.length === 0) {
4387
- log9(t32("schedule.logs_empty"));
4518
+ log10(t33("schedule.logs_empty"));
4388
4519
  return;
4389
4520
  }
4390
4521
  for (const run of runs) printRun(run);
@@ -4394,31 +4525,31 @@ async function runLogs(idOrPrefix, limit, tail) {
4394
4525
  }
4395
4526
  }
4396
4527
  function printRun(run) {
4397
- log9(
4398
- ` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t32("schedule.run_meta", {
4528
+ log10(
4529
+ ` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t33("schedule.run_meta", {
4399
4530
  turns: run.turns,
4400
4531
  cost: formatUsd2(run.costUsd, 4),
4401
- manual: run.manual ? t32("schedule.run_manual") : ""
4532
+ manual: run.manual ? t33("schedule.run_manual") : ""
4402
4533
  })
4403
4534
  );
4404
- if (run.reason) log9(` ${run.reason}`);
4535
+ if (run.reason) log10(` ${run.reason}`);
4405
4536
  for (const pending of run.pendingApprovals) {
4406
- log9(
4407
- ` \u26A0 ${t32("schedule.pending_line", { tool: pending.toolName, target: pending.target })}`
4537
+ log10(
4538
+ ` \u26A0 ${t33("schedule.pending_line", { tool: pending.toolName, target: pending.target })}`
4408
4539
  );
4409
4540
  if (pending.suggestedRule) {
4410
- log9(` ${t32("schedule.pending_fix", { rule: pending.suggestedRule })}`);
4541
+ log10(` ${t33("schedule.pending_fix", { rule: pending.suggestedRule })}`);
4411
4542
  }
4412
4543
  }
4413
4544
  }
4414
4545
  function printRecording(run) {
4415
4546
  if (!run.logPath) return;
4416
- log9("");
4417
- log9(t32("schedule.logs_recording", { path: run.logPath }));
4547
+ log10("");
4548
+ log10(t33("schedule.logs_recording", { path: run.logPath }));
4418
4549
  for (const envelope of readRecording(run.logPath)) {
4419
4550
  const event = envelope.event;
4420
4551
  if (event.type === "text-delta" && event.text) process.stdout.write(event.text);
4421
- else if (event.type === "error" && event.message) log9(`
4552
+ else if (event.type === "error" && event.message) log10(`
4422
4553
  [error] ${event.message}`);
4423
4554
  }
4424
4555
  process.stdout.write("\n");
@@ -4426,19 +4557,19 @@ function printRecording(run) {
4426
4557
  // src/commands/schedule.ts
4427
4558
  var DEFAULT_LOG_LIMIT = 10;
4428
4559
  function registerScheduleCommand(program2) {
4429
- const cmd = program2.command("schedule").description(t33("cli.schedule.summary"));
4430
- cmd.command("add").description(t33("cli.schedule.add")).option("--name <name>", t33("cli.schedule.opt_name")).option("--prompt <text>", t33("cli.schedule.opt_prompt")).option("--daily <HH:mm[,HH:mm]>", t33("cli.schedule.opt_daily")).option("--weekly <days>", t33("cli.schedule.opt_weekly")).option("--monthly <days>", t33("cli.schedule.opt_monthly")).option("--every <interval>", t33("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t33("cli.schedule.opt_once")).option("--at <HH:mm[,HH:mm]>", t33("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t33("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t33("cli.schedule.opt_end")).option("--workdir <dir>", t33("cli.schedule.opt_workdir")).option("--model <model>", t33("cli.schedule.opt_model")).option("--role <name>", t33("cli.schedule.opt_role")).option("--permission <level>", t33("cli.schedule.opt_permission")).option("--allow-tool <name>", t33("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t33("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t33("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t33("cli.schedule.opt_max_turns")).option("--budget <usd>", t33("cli.schedule.opt_budget")).option("--timeout <minutes>", t33("cli.schedule.opt_timeout")).option("--disabled", t33("cli.schedule.opt_disabled")).option("--i-understand-bypass", t33("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
4431
- cmd.command("list", { isDefault: true }).description(t33("cli.schedule.list")).action(() => runList());
4432
- cmd.command("show").description(t33("cli.schedule.show")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runShow(id));
4433
- cmd.command("enable").description(t33("cli.schedule.enable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, true));
4434
- cmd.command("disable").description(t33("cli.schedule.disable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, false));
4435
- cmd.command("rm").alias("remove").description(t33("cli.schedule.rm")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runRemove(id));
4436
- cmd.command("run").description(t33("cli.schedule.run")).argument("<id>", t33("cli.schedule.arg_id")).option("--fix", t33("cli.schedule.opt_fix")).action((id, opts) => runManual(id, opts));
4437
- cmd.command("logs").description(t33("cli.schedule.logs")).argument("<id>", t33("cli.schedule.arg_id")).option("-n, --limit <n>", t33("cli.schedule.opt_limit"), String(DEFAULT_LOG_LIMIT)).option("--tail", t33("cli.schedule.opt_tail")).action(
4560
+ const cmd = program2.command("schedule").description(t34("cli.schedule.summary"));
4561
+ cmd.command("add").description(t34("cli.schedule.add")).option("--name <name>", t34("cli.schedule.opt_name")).option("--prompt <text>", t34("cli.schedule.opt_prompt")).option("--daily <HH:mm[,HH:mm]>", t34("cli.schedule.opt_daily")).option("--weekly <days>", t34("cli.schedule.opt_weekly")).option("--monthly <days>", t34("cli.schedule.opt_monthly")).option("--every <interval>", t34("cli.schedule.opt_every")).option("--once <YYYY-MM-DD>", t34("cli.schedule.opt_once")).option("--at <HH:mm[,HH:mm]>", t34("cli.schedule.opt_at")).option("--start <YYYY-MM-DD>", t34("cli.schedule.opt_start")).option("--end <YYYY-MM-DD>", t34("cli.schedule.opt_end")).option("--workdir <dir>", t34("cli.schedule.opt_workdir")).option("--model <model>", t34("cli.schedule.opt_model")).option("--role <name>", t34("cli.schedule.opt_role")).option("--permission <level>", t34("cli.schedule.opt_permission")).option("--allow-tool <name>", t34("cli.schedule.opt_allow_tool"), collect3, []).option("--allow-operation <type>", t34("cli.schedule.opt_allow_operation"), collect3, []).option("--allow-rule <rule>", t34("cli.schedule.opt_allow_rule"), collect3, []).option("--max-turns <n>", t34("cli.schedule.opt_max_turns")).option("--timeout <minutes>", t34("cli.schedule.opt_timeout")).option("--disabled", t34("cli.schedule.opt_disabled")).option("--i-understand-bypass", t34("cli.schedule.opt_bypass_ack")).action((opts) => runAdd(opts));
4562
+ cmd.command("list", { isDefault: true }).description(t34("cli.schedule.list")).action(() => runList());
4563
+ cmd.command("show").description(t34("cli.schedule.show")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runShow(id));
4564
+ cmd.command("enable").description(t34("cli.schedule.enable")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runSetEnabled(id, true));
4565
+ cmd.command("disable").description(t34("cli.schedule.disable")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runSetEnabled(id, false));
4566
+ cmd.command("rm").alias("remove").description(t34("cli.schedule.rm")).argument("<id>", t34("cli.schedule.arg_id")).action((id) => runRemove(id));
4567
+ cmd.command("run").description(t34("cli.schedule.run")).argument("<id>", t34("cli.schedule.arg_id")).option("--fix", t34("cli.schedule.opt_fix")).action((id, opts) => runManual(id, opts));
4568
+ cmd.command("logs").description(t34("cli.schedule.logs")).argument("<id>", t34("cli.schedule.arg_id")).option("-n, --limit <n>", t34("cli.schedule.opt_limit"), String(DEFAULT_LOG_LIMIT)).option("--tail", t34("cli.schedule.opt_tail")).action(
4438
4569
  (id, opts) => runLogs(id, Number(opts.limit ?? DEFAULT_LOG_LIMIT), opts.tail === true)
4439
4570
  );
4440
- cmd.command("fire").description(t33("cli.schedule.fire")).argument("<id>", t33("cli.schedule.arg_id")).option("--home <dir>", t33("cli.schedule.opt_home")).action((id, opts) => runFire(id, opts.home));
4441
- cmd.command("doctor").description(t33("cli.schedule.doctor")).option("--repair", t33("cli.schedule.opt_repair")).option("--prune", t33("cli.schedule.opt_prune")).action((opts) => runDoctor(opts));
4571
+ cmd.command("fire").description(t34("cli.schedule.fire")).argument("<id>", t34("cli.schedule.arg_id")).option("--home <dir>", t34("cli.schedule.opt_home")).action((id, opts) => runFire(id, opts.home));
4572
+ cmd.command("doctor").description(t34("cli.schedule.doctor")).option("--repair", t34("cli.schedule.opt_repair")).option("--prune", t34("cli.schedule.opt_prune")).action((opts) => runDoctor(opts));
4442
4573
  }
4443
4574
  function collect3(value, previous) {
4444
4575
  return [...previous, value];
@@ -4449,7 +4580,7 @@ import { statfs } from "fs/promises";
4449
4580
  import {
4450
4581
  describeIsolation,
4451
4582
  getConfigIssues,
4452
- loadConfig as loadConfig5,
4583
+ loadConfig as loadConfig6,
4453
4584
  SANDBOX_COVERS,
4454
4585
  SANDBOX_EXCLUDES
4455
4586
  } from "@epoch-agent/core";
@@ -4457,13 +4588,13 @@ import {
4457
4588
  allJobs,
4458
4589
  confine,
4459
4590
  resolveProfile,
4460
- t as t35
4591
+ t as t36
4461
4592
  } from "@epoch-agent/infra";
4462
4593
  import { hasFailure } from "@epoch-agent/protocol";
4463
4594
  // src/statusline.ts
4464
4595
  import { execFile as execFile2 } from "child_process";
4465
4596
  import { sanitizeToolOutput } from "@epoch-agent/core";
4466
- import { guardSpawn as guardSpawn4, shellSpawnArgs, t as t34 } from "@epoch-agent/infra";
4597
+ import { guardSpawn as guardSpawn4, shellSpawnArgs, t as t35 } from "@epoch-agent/infra";
4467
4598
  var TIMEOUT_MS2 = 2e3;
4468
4599
  var MAX_WIDTH = 60;
4469
4600
  var MAX_BUFFER = 64 * 1024;
@@ -4492,7 +4623,7 @@ function runStatusLineCommand(command, cwd) {
4492
4623
  const killed = err2.killed === true;
4493
4624
  settle({
4494
4625
  text: null,
4495
- error: killed ? t34("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
4626
+ error: killed ? t35("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
4496
4627
  });
4497
4628
  return;
4498
4629
  }
@@ -4508,12 +4639,12 @@ async function probeStatusLine(config, cwd) {
4508
4639
  if (!command) return null;
4509
4640
  const result = await runStatusLineCommand(command, cwd);
4510
4641
  if (result.text === null) {
4511
- return { command, ok: false, detail: result.error ?? t34("statusline.no_output") };
4642
+ return { command, ok: false, detail: result.error ?? t35("statusline.no_output") };
4512
4643
  }
4513
4644
  return { command, ok: true, detail: result.text };
4514
4645
  }
4515
4646
  // src/commands/status.ts
4516
- var log10 = (msg) => {
4647
+ var log11 = (msg) => {
4517
4648
  process.stdout.write(msg + "\n");
4518
4649
  };
4519
4650
  var STATUS_MARK = {
@@ -4541,10 +4672,10 @@ async function describeDisk(path = ".") {
4541
4672
  }
4542
4673
  }
4543
4674
  function describeConfig() {
4544
- if (!existsSync7(CONFIG_PATH)) return t35("cli.status.config_absent");
4545
- loadConfig5();
4675
+ if (!existsSync7(CONFIG_PATH)) return t36("cli.status.config_absent");
4676
+ loadConfig6();
4546
4677
  const n = getConfigIssues().length;
4547
- return n === 0 ? t35("cli.status.config_present") : t35("cli.status.config_present_with_issues", { count: n });
4678
+ return n === 0 ? t36("cli.status.config_present") : t36("cli.status.config_present_with_issues", { count: n });
4548
4679
  }
4549
4680
  async function describeSecretBackend() {
4550
4681
  try {
@@ -4552,18 +4683,18 @@ async function describeSecretBackend() {
4552
4683
  const store = await createSecretStore();
4553
4684
  return store.encrypted ? store.detail : `\u26A0 ${store.detail}`;
4554
4685
  } catch (err2) {
4555
- return t35("cli.status.secret_probe_failed", {
4686
+ return t36("cli.status.secret_probe_failed", {
4556
4687
  message: err2 instanceof Error ? err2.message : String(err2)
4557
4688
  });
4558
4689
  }
4559
4690
  }
4560
4691
  function workspaceLines(rt) {
4561
- const lines = [` ${t35("cli.doctor.workspace_root", { root: rt.workspace.root })}`];
4692
+ const lines = [` ${t36("cli.doctor.workspace_root", { root: rt.workspace.root })}`];
4562
4693
  lines.push(
4563
- ` ${rt.trusted ? t35("cli.doctor.workspace_trusted") : t35("cli.doctor.workspace_untrusted")}`
4694
+ ` ${rt.trusted ? t36("cli.doctor.workspace_trusted") : t36("cli.doctor.workspace_untrusted")}`
4564
4695
  );
4565
4696
  lines.push(
4566
- ` ${rt.workspace.extra.length === 0 ? t35("cli.doctor.workspace_no_extra") : t35("cli.doctor.workspace_extra", { count: rt.workspace.extra.length })}`
4697
+ ` ${rt.workspace.extra.length === 0 ? t36("cli.doctor.workspace_no_extra") : t36("cli.doctor.workspace_extra", { count: rt.workspace.extra.length })}`
4567
4698
  );
4568
4699
  for (const dir of rt.workspace.extra) lines.push(` \xB7 ${dir}`);
4569
4700
  return lines;
@@ -4571,94 +4702,94 @@ function workspaceLines(rt) {
4571
4702
  function sandboxLines(cwd, sandbox) {
4572
4703
  const iso = describeIsolation();
4573
4704
  const lines = [`
4574
- ${t35("cli.doctor.sandbox_head")}`];
4705
+ ${t36("cli.doctor.sandbox_head")}`];
4575
4706
  if (iso.backend === "none") {
4576
4707
  lines.push(` ${STATUS_MARK.skipped} ${iso.detail}`);
4577
4708
  lines.push(
4578
- ` ${STATUS_MARK.warn} ${t35(
4709
+ ` ${STATUS_MARK.warn} ${t36(
4579
4710
  iso.reason === "platform-unsupported" ? "cli.doctor.sandbox_absent_by_design" : "cli.doctor.sandbox_absent_tools"
4580
4711
  )}`
4581
4712
  );
4582
4713
  return lines;
4583
4714
  }
4584
4715
  lines.push(
4585
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.sandbox_backend", { backend: iso.backend, platform: iso.platform })}`
4716
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.sandbox_backend", { backend: iso.backend, platform: iso.platform })}`
4586
4717
  );
4587
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_code_exec", { detail: iso.detail })}`);
4718
+ lines.push(` \xB7 ${t36("cli.doctor.sandbox_code_exec", { detail: iso.detail })}`);
4588
4719
  const probe = (mode) => confine("/bin/sh", ["-c", "true"], { mode, workspaceRoot: cwd, allowNetwork: true });
4589
4720
  for (const mode of ["workspace-write", "read-only"]) {
4590
4721
  const c = probe(mode);
4591
4722
  if (!c.confined) continue;
4592
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_terminal", { mode, enforcement: c.enforcement })}`);
4593
- if (c.enforcement === "partial") lines.push(` ${t35("cli.doctor.sandbox_partial_devnull")}`);
4723
+ lines.push(` \xB7 ${t36("cli.doctor.sandbox_terminal", { mode, enforcement: c.enforcement })}`);
4724
+ if (c.enforcement === "partial") lines.push(` ${t36("cli.doctor.sandbox_partial_devnull")}`);
4594
4725
  }
4595
4726
  const writable = probe("workspace-write");
4596
4727
  if (writable.confined) {
4597
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_writable")}`);
4728
+ lines.push(` \xB7 ${t36("cli.doctor.sandbox_writable")}`);
4598
4729
  for (const dir of writable.writableDirs) lines.push(` \xB7 ${dir}`);
4599
4730
  }
4600
4731
  lines.push(
4601
- sandbox?.terminal === false ? ` ${STATUS_MARK.warn} ${t35("cli.doctor.sandbox_switch_off")}` : ` ${STATUS_MARK.ok} ${t35("cli.doctor.sandbox_switch_on")}`
4732
+ sandbox?.terminal === false ? ` ${STATUS_MARK.warn} ${t36("cli.doctor.sandbox_switch_off")}` : ` ${STATUS_MARK.ok} ${t36("cli.doctor.sandbox_switch_on")}`
4602
4733
  );
4603
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_covers", { tools: SANDBOX_COVERS.join(", ") })}`);
4734
+ lines.push(` \xB7 ${t36("cli.doctor.sandbox_covers", { tools: SANDBOX_COVERS.join(", ") })}`);
4604
4735
  lines.push(
4605
- SANDBOX_EXCLUDES.length === 0 ? ` ${STATUS_MARK.ok} ${t35("cli.doctor.sandbox_excludes_none")}` : ` ${STATUS_MARK.warn} ${t35("cli.doctor.sandbox_excludes", { tools: SANDBOX_EXCLUDES.join(", ") })}`
4736
+ SANDBOX_EXCLUDES.length === 0 ? ` ${STATUS_MARK.ok} ${t36("cli.doctor.sandbox_excludes_none")}` : ` ${STATUS_MARK.warn} ${t36("cli.doctor.sandbox_excludes", { tools: SANDBOX_EXCLUDES.join(", ") })}`
4606
4737
  );
4607
4738
  return lines;
4608
4739
  }
4609
4740
  function ftsLines(health) {
4610
4741
  const lines = [`
4611
- ${t35("cli.doctor.fts_head")}`];
4742
+ ${t36("cli.doctor.fts_head")}`];
4612
4743
  const indexed = health.tables.map((tb) => `${tb.table} ${tb.rows}`).join(" \xB7 ");
4613
- lines.push(` \xB7 ${t35("cli.doctor.fts_rows", { messages: health.messages, indexed })}`);
4744
+ lines.push(` \xB7 ${t36("cli.doctor.fts_rows", { messages: health.messages, indexed })}`);
4614
4745
  const behind = health.tables.filter((tb) => tb.rows !== health.messages);
4615
4746
  lines.push(
4616
- behind.length === 0 ? ` ${STATUS_MARK.ok} ${t35("cli.doctor.fts_in_sync")}` : (
4617
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.fts_out_of_sync", {
4747
+ behind.length === 0 ? ` ${STATUS_MARK.ok} ${t36("cli.doctor.fts_in_sync")}` : (
4748
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.fts_out_of_sync", {
4618
4749
  tables: behind.map((tb) => `${tb.table} (${tb.rows - health.messages})`).join(", ")
4619
4750
  })}`
4620
4751
  )
4621
4752
  );
4622
4753
  lines.push(
4623
- health.missingTriggers.length === 0 ? ` ${STATUS_MARK.ok} ${t35("cli.doctor.fts_triggers_ok")}` : ` ${STATUS_MARK.failed} ${t35("cli.doctor.fts_triggers_missing", {
4754
+ health.missingTriggers.length === 0 ? ` ${STATUS_MARK.ok} ${t36("cli.doctor.fts_triggers_ok")}` : ` ${STATUS_MARK.failed} ${t36("cli.doctor.fts_triggers_missing", {
4624
4755
  triggers: health.missingTriggers.join(", ")
4625
4756
  })}`
4626
4757
  );
4627
4758
  for (const tb of health.tables) {
4628
4759
  if (tb.error !== null) {
4629
4760
  lines.push(
4630
- ` ${STATUS_MARK.failed} ${t35("cli.doctor.fts_corrupt", { table: tb.table, detail: tb.error })}`
4761
+ ` ${STATUS_MARK.failed} ${t36("cli.doctor.fts_corrupt", { table: tb.table, detail: tb.error })}`
4631
4762
  );
4632
4763
  }
4633
4764
  if (tb.drift !== null) {
4634
4765
  lines.push(
4635
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.fts_drift", { table: tb.table, detail: tb.drift })}`
4766
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.fts_drift", { table: tb.table, detail: tb.drift })}`
4636
4767
  );
4637
4768
  }
4638
4769
  }
4639
4770
  if (health.tables.some((tb) => !tb.external)) {
4640
- lines.push(` ${STATUS_MARK.warn} ${t35("cli.doctor.fts_legacy_schema")}`);
4771
+ lines.push(` ${STATUS_MARK.warn} ${t36("cli.doctor.fts_legacy_schema")}`);
4641
4772
  }
4642
4773
  if (health.indexBytes !== void 0) {
4643
- lines.push(` \xB7 ${t35("cli.doctor.fts_size", { size: formatBytes(health.indexBytes) })}`);
4774
+ lines.push(` \xB7 ${t36("cli.doctor.fts_size", { size: formatBytes(health.indexBytes) })}`);
4644
4775
  }
4645
4776
  if (health.space?.fileBytes !== void 0) {
4646
4777
  lines.push(
4647
- ` \xB7 ${t35("cli.doctor.fts_space", {
4778
+ ` \xB7 ${t36("cli.doctor.fts_space", {
4648
4779
  file: formatBytes(health.space.fileBytes),
4649
4780
  free: formatBytes(health.space.freeBytes)
4650
4781
  })}`
4651
4782
  );
4652
- lines.push(` \xB7 ${t35("cli.doctor.fts_reclaim_hint")}`);
4783
+ lines.push(` \xB7 ${t36("cli.doctor.fts_reclaim_hint")}`);
4653
4784
  }
4654
4785
  return lines;
4655
4786
  }
4656
4787
  function reclaimLines(report) {
4657
4788
  const lines = [`
4658
- ${t35("cli.doctor.reclaim_head")}`];
4789
+ ${t36("cli.doctor.reclaim_head")}`];
4659
4790
  const secs = (ms) => `${(ms / 1e3).toFixed(1)}s`;
4660
4791
  lines.push(
4661
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_optimize", {
4792
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_optimize", {
4662
4793
  before: formatBytes(report.before.freeBytes),
4663
4794
  after: formatBytes(report.afterOptimize.freeBytes),
4664
4795
  ms: secs(report.optimizeMs)
@@ -4666,7 +4797,7 @@ ${t35("cli.doctor.reclaim_head")}`];
4666
4797
  );
4667
4798
  if (report.vacuumed) {
4668
4799
  lines.push(
4669
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_vacuum", {
4800
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_vacuum", {
4670
4801
  before: formatBytes(report.before.pageBytes),
4671
4802
  after: formatBytes(report.after.pageBytes),
4672
4803
  ms: secs(report.vacuumMs)
@@ -4674,14 +4805,14 @@ ${t35("cli.doctor.reclaim_head")}`];
4674
4805
  );
4675
4806
  const saved = report.before.pageBytes - report.after.pageBytes;
4676
4807
  lines.push(
4677
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_total", {
4808
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_total", {
4678
4809
  saved: formatBytes(saved),
4679
4810
  pct: `${(saved / Math.max(1, report.before.pageBytes) * 100).toFixed(1)}%`
4680
4811
  })}`
4681
4812
  );
4682
4813
  } else if (report.vacuumError !== null) {
4683
4814
  lines.push(
4684
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.reclaim_vacuum_skipped", {
4815
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.reclaim_vacuum_skipped", {
4685
4816
  detail: report.vacuumError
4686
4817
  })}`
4687
4818
  );
@@ -4701,17 +4832,17 @@ function hookLines(rt) {
4701
4832
  const { sources } = rt.hook;
4702
4833
  if (sources.length === 0) return [];
4703
4834
  const lines = [`
4704
- ${t35("cli.doctor.hook_head")}`];
4835
+ ${t36("cli.doctor.hook_head")}`];
4705
4836
  for (const source of sources) {
4706
- const label = t35(HOOK_SOURCE_LABEL[source.kind]);
4837
+ const label = t36(HOOK_SOURCE_LABEL[source.kind]);
4707
4838
  if (source.skipped) {
4708
4839
  lines.push(` ${STATUS_MARK.skipped} ${label}: ${source.path}`);
4709
- lines.push(` ${t35("cli.doctor.hook_skipped")}`);
4840
+ lines.push(` ${t36("cli.doctor.hook_skipped")}`);
4710
4841
  continue;
4711
4842
  }
4712
4843
  const name = source.plugin === void 0 ? label : `${label} ${source.plugin}`;
4713
4844
  lines.push(
4714
- ` ${STATUS_MARK.ok} ${name}: ${source.path}${t35("cli.doctor.hook_count", {
4845
+ ` ${STATUS_MARK.ok} ${name}: ${source.path}${t36("cli.doctor.hook_count", {
4715
4846
  n: source.count
4716
4847
  })}`
4717
4848
  );
@@ -4725,65 +4856,65 @@ var JOB_KIND_LABEL = {
4725
4856
  };
4726
4857
  function jobLines(jobs) {
4727
4858
  const lines = [`
4728
- ${t35("cli.doctor.jobs_head")}`];
4859
+ ${t36("cli.doctor.jobs_head")}`];
4729
4860
  const running = jobs.filter((job) => job.status === "running");
4730
4861
  if (running.length === 0) {
4731
- lines.push(` ${STATUS_MARK.ok} ${t35("cli.doctor.jobs_none")}`);
4862
+ lines.push(` ${STATUS_MARK.ok} ${t36("cli.doctor.jobs_none")}`);
4732
4863
  return lines;
4733
4864
  }
4734
- lines.push(` ${STATUS_MARK.warn} ${t35("cli.doctor.jobs_running", { n: running.length })}`);
4865
+ lines.push(` ${STATUS_MARK.warn} ${t36("cli.doctor.jobs_running", { n: running.length })}`);
4735
4866
  for (const job of running) {
4736
4867
  lines.push(
4737
- ` \xB7 ${t35("cli.doctor.jobs_line", {
4738
- kind: t35(JOB_KIND_LABEL[job.kind]),
4868
+ ` \xB7 ${t36("cli.doctor.jobs_line", {
4869
+ kind: t36(JOB_KIND_LABEL[job.kind]),
4739
4870
  id: job.id,
4740
4871
  label: job.label
4741
4872
  })}`
4742
4873
  );
4743
4874
  }
4744
- lines.push(` \xB7 ${t35("cli.doctor.jobs_lifetime")}`);
4875
+ lines.push(` \xB7 ${t36("cli.doctor.jobs_lifetime")}`);
4745
4876
  return lines;
4746
4877
  }
4747
4878
  function terminalLines(result, terminal) {
4748
4879
  const head = `
4749
- ${t35("cli.doctor.terminal_head")}`;
4880
+ ${t36("cli.doctor.terminal_head")}`;
4750
4881
  if (!result.ok) {
4751
4882
  if (result.failure.kind === "no-tty") {
4752
4883
  return [
4753
4884
  head,
4754
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_no_tty")}`,
4755
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`
4885
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_no_tty")}`,
4886
+ ` \xB7 ${t36("cli.doctor.terminal_alternatives")}`
4756
4887
  ];
4757
4888
  }
4758
4889
  return [
4759
4890
  head,
4760
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_timeout", { n: result.failure.timeoutMs / 1e3 })}`
4891
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_timeout", { n: result.failure.timeoutMs / 1e3 })}`
4761
4892
  ];
4762
4893
  }
4763
4894
  switch (result.sample.kind) {
4764
4895
  case "shift-enter":
4765
- return [head, ` ${STATUS_MARK.ok} ${t35("cli.doctor.terminal_shift_enter")}`];
4896
+ return [head, ` ${STATUS_MARK.ok} ${t36("cli.doctor.terminal_shift_enter")}`];
4766
4897
  case "enter-only":
4767
4898
  if (terminal?.kind === "apple-terminal") {
4768
4899
  return [
4769
4900
  head,
4770
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_apple")}`,
4771
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`
4901
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_apple")}`,
4902
+ ` \xB7 ${t36("cli.doctor.terminal_alternatives")}`
4772
4903
  ];
4773
4904
  }
4774
4905
  return [
4775
4906
  head,
4776
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_enter_only")}`,
4777
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`,
4778
- ` \xB7 ${t35("cli.doctor.terminal_setup_hint")}`
4907
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_enter_only")}`,
4908
+ ` \xB7 ${t36("cli.doctor.terminal_alternatives")}`,
4909
+ ` \xB7 ${t36("cli.doctor.terminal_setup_hint")}`
4779
4910
  ];
4780
4911
  case "other":
4781
4912
  return [
4782
4913
  head,
4783
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_other", { hex: result.sample.hex })}`
4914
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_other", { hex: result.sample.hex })}`
4784
4915
  ];
4785
4916
  case "interrupted":
4786
- return [head, ` \xB7 ${t35("cli.doctor.terminal_interrupted")}`];
4917
+ return [head, ` \xB7 ${t36("cli.doctor.terminal_interrupted")}`];
4787
4918
  }
4788
4919
  }
4789
4920
  async function statusLineLines(config, cwd) {
@@ -4791,96 +4922,96 @@ async function statusLineLines(config, cwd) {
4791
4922
  if (!probe) return [];
4792
4923
  return [
4793
4924
  `
4794
- ${t35("cli.doctor.status_line_head")}`,
4795
- ` ${t35("cli.doctor.status_line_command", { command: probe.command })}`,
4796
- ` ${probe.ok ? t35("cli.doctor.status_line_ok", { detail: probe.detail }) : t35("cli.doctor.status_line_broken", { detail: probe.detail })}`
4925
+ ${t36("cli.doctor.status_line_head")}`,
4926
+ ` ${t36("cli.doctor.status_line_command", { command: probe.command })}`,
4927
+ ` ${probe.ok ? t36("cli.doctor.status_line_ok", { detail: probe.detail }) : t36("cli.doctor.status_line_broken", { detail: probe.detail })}`
4797
4928
  ];
4798
4929
  }
4799
4930
  function registerStatusCommands(program2) {
4800
- program2.command("status").description(t35("cli.status.cmd_root")).action(async () => {
4801
- log10(
4931
+ program2.command("status").description(t36("cli.status.cmd_root")).action(async () => {
4932
+ log11(
4802
4933
  [
4803
- t35("cli.status.version", { version: VERSION }),
4934
+ t36("cli.status.version", { version: VERSION }),
4804
4935
  `Node: ${process.version} (${process.platform}/${process.arch})`,
4805
- t35("cli.status.home", { path: EPOCH_HOME }),
4936
+ t36("cli.status.home", { path: EPOCH_HOME }),
4806
4937
  `Profile: ${resolveProfile()}`,
4807
- t35("cli.status.credentials", {
4808
- state: hasCredentials() ? t35("cli.status.credentials_set") : t35("cli.status.credentials_unset")
4938
+ t36("cli.status.credentials", {
4939
+ state: hasCredentials() ? t36("cli.status.credentials_set") : t36("cli.status.credentials_unset")
4809
4940
  }),
4810
- t35("cli.status.secret_backend", { detail: await describeSecretBackend() }),
4941
+ t36("cli.status.secret_backend", { detail: await describeSecretBackend() }),
4811
4942
  `config.yaml: ${describeConfig()}`,
4812
- `.env: ${existsSync7(ENV_PATH) ? t35("cli.status.env_present") : t35("cli.status.env_absent")}`
4943
+ `.env: ${existsSync7(ENV_PATH) ? t36("cli.status.env_present") : t36("cli.status.env_absent")}`
4813
4944
  ].join("\n")
4814
4945
  );
4815
4946
  });
4816
- program2.command("doctor").description(t35("cli.doctor.cmd_root")).option("--reclaim", t35("cli.doctor.reclaim_opt")).action(async (opts) => {
4817
- log10(t35("cli.doctor.node", { version: process.version }));
4947
+ program2.command("doctor").description(t36("cli.doctor.cmd_root")).option("--reclaim", t36("cli.doctor.reclaim_opt")).action(async (opts) => {
4948
+ log11(t36("cli.doctor.node", { version: process.version }));
4818
4949
  const avail = await describeDisk();
4819
- if (avail) log10(t35("cli.doctor.disk", { avail }));
4820
- log10(`${hasCredentials() ? "\u2713" : "\u25CB"} ${t35("cli.doctor.credentials")}`);
4821
- const configIssues = existsSync7(CONFIG_PATH) ? (loadConfig5(), getConfigIssues()) : [];
4950
+ if (avail) log11(t36("cli.doctor.disk", { avail }));
4951
+ log11(`${hasCredentials() ? "\u2713" : "\u25CB"} ${t36("cli.doctor.credentials")}`);
4952
+ const configIssues = existsSync7(CONFIG_PATH) ? (loadConfig6(), getConfigIssues()) : [];
4822
4953
  const configMark = !existsSync7(CONFIG_PATH) ? "\u25CB" : configIssues.length > 0 ? "\u26A0" : "\u2713";
4823
- log10(`${configMark} config: ${CONFIG_PATH}`);
4954
+ log11(`${configMark} config: ${CONFIG_PATH}`);
4824
4955
  try {
4825
4956
  const { buildRuntime: buildRuntime4 } = await import("@epoch-agent/runtime");
4826
4957
  const rt = await buildRuntime4({ installSignalHandlers: true });
4827
- log10(`
4828
- ${t35("cli.doctor.workspace_head")}`);
4829
- for (const line of workspaceLines(rt)) log10(line);
4830
- for (const line of sandboxLines(rt.workspace.root, rt.config.sandbox)) log10(line);
4831
- for (const line of hookLines(rt)) log10(line);
4832
- for (const line of jobLines(allJobs().map((j) => j.info))) log10(line);
4958
+ log11(`
4959
+ ${t36("cli.doctor.workspace_head")}`);
4960
+ for (const line2 of workspaceLines(rt)) log11(line2);
4961
+ for (const line2 of sandboxLines(rt.workspace.root, rt.config.sandbox)) log11(line2);
4962
+ for (const line2 of hookLines(rt)) log11(line2);
4963
+ for (const line2 of jobLines(allJobs().map((j) => j.info))) log11(line2);
4833
4964
  const { classifyTerminal, probeShiftEnter } = await import("@epoch-agent/tui");
4834
- for (const line of terminalLines(
4835
- await probeShiftEnter({ prompt: t35("cli.doctor.terminal_prompt"), timeoutMs: 8e3 }),
4965
+ for (const line2 of terminalLines(
4966
+ await probeShiftEnter({ prompt: t36("cli.doctor.terminal_prompt"), timeoutMs: 8e3 }),
4836
4967
  classifyTerminal(process.env)
4837
4968
  ))
4838
- log10(line);
4839
- for (const line of await statusLineLines(rt.config, process.cwd())) log10(line);
4969
+ log11(line2);
4970
+ for (const line2 of await statusLineLines(rt.config, process.cwd())) log11(line2);
4840
4971
  if (rt.sessionStore) {
4841
4972
  try {
4842
- for (const line of ftsLines(rt.sessionStore.ftsHealth())) log10(line);
4973
+ for (const line2 of ftsLines(rt.sessionStore.ftsHealth())) log11(line2);
4843
4974
  } catch (err2) {
4844
- log10(`
4845
- ${t35("cli.doctor.fts_head")}`);
4846
- log10(
4847
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.fts_probe_failed", {
4975
+ log11(`
4976
+ ${t36("cli.doctor.fts_head")}`);
4977
+ log11(
4978
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.fts_probe_failed", {
4848
4979
  detail: err2 instanceof Error ? err2.message : String(err2)
4849
4980
  })}`
4850
4981
  );
4851
4982
  }
4852
4983
  if (opts.reclaim) {
4853
4984
  try {
4854
- for (const line of reclaimLines(rt.sessionStore.reclaimFts())) log10(line);
4985
+ for (const line2 of reclaimLines(rt.sessionStore.reclaimFts())) log11(line2);
4855
4986
  } catch (err2) {
4856
- log10(`
4857
- ${t35("cli.doctor.reclaim_head")}`);
4858
- log10(
4859
- ` ${STATUS_MARK.failed} ${t35("cli.doctor.reclaim_failed", {
4987
+ log11(`
4988
+ ${t36("cli.doctor.reclaim_head")}`);
4989
+ log11(
4990
+ ` ${STATUS_MARK.failed} ${t36("cli.doctor.reclaim_failed", {
4860
4991
  detail: err2 instanceof Error ? err2.message : String(err2)
4861
4992
  })}`
4862
4993
  );
4863
4994
  }
4864
4995
  }
4865
4996
  }
4866
- log10(`
4867
- ${t35("cli.doctor.modules_head")}`);
4997
+ log11(`
4998
+ ${t36("cli.doctor.modules_head")}`);
4868
4999
  const order = { failed: 0, warn: 1, skipped: 2, ok: 3 };
4869
5000
  const sorted = [...rt.diagnosticList].sort(
4870
5001
  (a, b) => (order[a.status] ?? 9) - (order[b.status] ?? 9)
4871
5002
  );
4872
- for (const d of sorted) log10(` ${STATUS_MARK[d.status]} ${d.module}: ${d.detail}`);
5003
+ for (const d of sorted) log11(` ${STATUS_MARK[d.status]} ${d.module}: ${d.detail}`);
4873
5004
  await rt.dispose();
4874
5005
  if (hasFailure(rt.diagnosticList)) {
4875
5006
  const bad = rt.diagnosticList.filter((d) => d.status === "failed").length;
4876
- log10(`
4877
- ${t35("cli.doctor.modules_failed", { count: bad })}`);
5007
+ log11(`
5008
+ ${t36("cli.doctor.modules_failed", { count: bad })}`);
4878
5009
  process.exitCode = EXIT_CODES.FAILURE;
4879
5010
  }
4880
5011
  } catch (err2) {
4881
- log10(
5012
+ log11(
4882
5013
  `
4883
- ${t35("cli.doctor.build_failed", {
5014
+ ${t36("cli.doctor.build_failed", {
4884
5015
  message: err2 instanceof Error ? err2.message : String(err2)
4885
5016
  })}`
4886
5017
  );
@@ -4893,27 +5024,27 @@ import { resolve as resolve4 } from "path";
4893
5024
  import {
4894
5025
  hasExecTierContent as hasExecTierContent2,
4895
5026
  inventoryProjectExtensions as inventoryProjectExtensions2,
4896
- loadConfig as loadConfig6,
5027
+ loadConfig as loadConfig7,
4897
5028
  TrustManager as TrustManager3
4898
5029
  } from "@epoch-agent/core";
4899
- import { t as t36, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
4900
- var log11 = (msg) => process.stdout.write(msg + "\n");
5030
+ import { t as t37, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
5031
+ var log12 = (msg) => process.stdout.write(msg + "\n");
4901
5032
  var warn3 = (msg) => process.stderr.write(msg + "\n");
4902
5033
  function scopeLabel(scope) {
4903
- return scope === "directory-tree" ? t36("trust.scope_tree") : t36("trust.scope_dir");
5034
+ return scope === "directory-tree" ? t37("trust.scope_tree") : t37("trust.scope_dir");
4904
5035
  }
4905
5036
  function tierLabel(record) {
4906
- if (record.level !== "trusted") return t36("trust.tier_none");
4907
- return record.exec === true ? t36("trust.tier_exec") : t36("trust.tier_read");
5037
+ if (record.level !== "trusted") return t37("trust.tier_none");
5038
+ return record.exec === true ? t37("trust.tier_exec") : t37("trust.tier_read");
4908
5039
  }
4909
5040
  function levelLabel(level) {
4910
5041
  switch (level) {
4911
5042
  case "trusted":
4912
- return t36("trust.level_trusted");
5043
+ return t37("trust.level_trusted");
4913
5044
  case "untrusted":
4914
- return t36("trust.level_untrusted");
5045
+ return t37("trust.level_untrusted");
4915
5046
  case "unknown":
4916
- return t36("trust.level_unknown");
5047
+ return t37("trust.level_unknown");
4917
5048
  }
4918
5049
  }
4919
5050
  function physicalPath(input2) {
@@ -4926,62 +5057,62 @@ function physicalPath(input2) {
4926
5057
  }
4927
5058
  }
4928
5059
  function registerTrustCommand(program2) {
4929
- const cmd = program2.command("trust").description(t36("trust.cmd_root"));
4930
- cmd.command("list", { isDefault: true }).description(t36("trust.cmd_list")).action(() => withTrust((tm) => printList3(tm)));
4931
- cmd.command("add").description(t36("trust.cmd_add")).argument("[path]", t36("trust.arg_path_default")).option("--tree", t36("trust.opt_tree_add")).option("--exec", t36("trust.opt_exec")).action((path, opts) => {
5060
+ const cmd = program2.command("trust").description(t37("trust.cmd_root"));
5061
+ cmd.command("list", { isDefault: true }).description(t37("trust.cmd_list")).action(() => withTrust((tm) => printList3(tm)));
5062
+ cmd.command("add").description(t37("trust.cmd_add")).argument("[path]", t37("trust.arg_path_default")).option("--tree", t37("trust.opt_tree_add")).option("--exec", t37("trust.opt_exec")).action((path, opts) => {
4932
5063
  withTrust((tm) => {
4933
5064
  const dir = physicalPath(path ?? process.cwd());
4934
5065
  const scope = opts.tree ? "directory-tree" : "directory";
4935
5066
  tm.record(dir, "trusted", scope, { exec: opts.exec === true });
4936
- log11(`\u2713 ${t36("trust.added", { dir, scope: scopeLabel(scope) })}`);
5067
+ log12(`\u2713 ${t37("trust.added", { dir, scope: scopeLabel(scope) })}`);
4937
5068
  if (!opts.exec && hasExecTierContent2(inventoryProjectExtensions2(dir))) {
4938
- log11(t36("trust.added_read_only_hint", { dir }));
5069
+ log12(t37("trust.added_read_only_hint", { dir }));
4939
5070
  }
4940
5071
  });
4941
5072
  });
4942
- cmd.command("deny").description(t36("trust.cmd_deny")).argument("[path]", t36("trust.arg_path_default")).option("--tree", t36("trust.opt_tree_deny")).action((path, opts) => {
5073
+ cmd.command("deny").description(t37("trust.cmd_deny")).argument("[path]", t37("trust.arg_path_default")).option("--tree", t37("trust.opt_tree_deny")).action((path, opts) => {
4943
5074
  withTrust((tm) => {
4944
5075
  const dir = physicalPath(path ?? process.cwd());
4945
5076
  tm.record(dir, "untrusted", opts.tree ? "directory-tree" : "directory");
4946
- log11(
4947
- `\u2717 ${t36("trust.denied", {
5077
+ log12(
5078
+ `\u2717 ${t37("trust.denied", {
4948
5079
  dir,
4949
5080
  scope: scopeLabel(opts.tree ? "directory-tree" : "directory")
4950
5081
  })}`
4951
5082
  );
4952
5083
  });
4953
5084
  });
4954
- cmd.command("remove").alias("rm").description(t36("trust.cmd_remove")).argument("<path>", t36("trust.arg_path")).action((path) => {
5085
+ cmd.command("remove").alias("rm").description(t37("trust.cmd_remove")).argument("<path>", t37("trust.arg_path")).action((path) => {
4955
5086
  withTrust((tm) => {
4956
5087
  const dir = physicalPath(path);
4957
5088
  if (!tm.list().some((r) => resolve4(r.path) === dir)) {
4958
- warn3(t36("trust.no_record", { dir }));
5089
+ warn3(t37("trust.no_record", { dir }));
4959
5090
  process.exit(1);
4960
5091
  }
4961
5092
  tm.revoke(dir);
4962
- log11(t36("trust.removed", { dir, level: levelLabel(tm.check(dir)) }));
5093
+ log12(t37("trust.removed", { dir, level: levelLabel(tm.check(dir)) }));
4963
5094
  });
4964
5095
  });
4965
5096
  }
4966
5097
  function printList3(tm) {
4967
- if (loadConfig6().trust?.enabled === false) {
4968
- warn3(t36("trust.gate_off"));
5098
+ if (loadConfig7().trust?.enabled === false) {
5099
+ warn3(t37("trust.gate_off"));
4969
5100
  }
4970
- log11(t36("trust.list_head", { path: trustPath3(EPOCH_HOME) }));
5101
+ log12(t37("trust.list_head", { path: trustPath3(EPOCH_HOME) }));
4971
5102
  const records = [...tm.list()].sort((a, b) => a.path.localeCompare(b.path));
4972
5103
  if (records.length === 0) {
4973
- log11(t36("trust.list_empty"));
5104
+ log12(t37("trust.list_empty"));
4974
5105
  }
4975
5106
  for (const r of records) {
4976
5107
  const mark = r.level === "trusted" ? "\u2713" : "\u2717";
4977
- const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t36("trust.when_unknown");
4978
- log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] [${tierLabel(r)}] ${when}`);
5108
+ const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t37("trust.when_unknown");
5109
+ log12(` ${mark} ${r.path} [${scopeLabel(r.scope)}] [${tierLabel(r)}] ${when}`);
4979
5110
  }
4980
5111
  const cwd = process.cwd();
4981
- log11(
5112
+ log12(
4982
5113
  `
4983
- ${t36("trust.cwd_line", { cwd })}
4984
- ${t36("trust.cwd_verdict", { level: levelLabel(tm.check(cwd)) })}`
5114
+ ${t37("trust.cwd_line", { cwd })}
5115
+ ${t37("trust.cwd_verdict", { level: levelLabel(tm.check(cwd)) })}`
4985
5116
  );
4986
5117
  }
4987
5118
  function withTrust(fn) {
@@ -4990,46 +5121,46 @@ function withTrust(fn) {
4990
5121
  try {
4991
5122
  fn(tm);
4992
5123
  } catch (err2) {
4993
- warn3(t36("trust.error", { message: err2 instanceof Error ? err2.message : String(err2) }));
5124
+ warn3(t37("trust.error", { message: err2 instanceof Error ? err2.message : String(err2) }));
4994
5125
  process.exit(1);
4995
5126
  }
4996
5127
  }
4997
5128
  // src/commands/upgrade.ts
4998
- import { t as t37 } from "@epoch-agent/infra";
4999
- var log12 = (msg) => process.stdout.write(`${msg}
5129
+ import { t as t38 } from "@epoch-agent/infra";
5130
+ var log13 = (msg) => process.stdout.write(`${msg}
5000
5131
  `);
5001
5132
  function registerUpgradeCommand(program2) {
5002
- program2.command("upgrade").description(t37("upgrade.cmd_root")).action(async () => {
5133
+ program2.command("upgrade").description(t38("upgrade.cmd_root")).action(async () => {
5003
5134
  const self = selfPackage();
5004
5135
  const info = getInstallationInfo(self.name);
5005
- log12(t37("upgrade.current", { version: self.version }));
5006
- log12(
5007
- t37("upgrade.installed_via", {
5136
+ log13(t38("upgrade.current", { version: self.version }));
5137
+ log13(
5138
+ t38("upgrade.installed_via", {
5008
5139
  manager: info.packageManager,
5009
- global: info.isGlobal ? t37("installation.global_suffix") : "",
5140
+ global: info.isGlobal ? t38("installation.global_suffix") : "",
5010
5141
  note: info.note
5011
5142
  })
5012
5143
  );
5013
5144
  const notice = isUpdateCheckDisabled() ? readUpdateNotice() : await refreshUpdateCache({ ttlMs: 0 }).catch(() => null);
5014
5145
  if (notice) {
5015
- log12(`
5016
- ${t37("upgrade.available", { current: notice.current, latest: notice.latest })}`);
5017
- } else log12(`
5018
- ${t37("upgrade.none")}`);
5146
+ log13(`
5147
+ ${t38("upgrade.available", { current: notice.current, latest: notice.latest })}`);
5148
+ } else log13(`
5149
+ ${t38("upgrade.none")}`);
5019
5150
  if (info.updateCommand) {
5020
- log12(`
5021
- ${t37("upgrade.how")}
5151
+ log13(`
5152
+ ${t38("upgrade.how")}
5022
5153
  ${info.updateCommand}`);
5023
- log12(`
5024
- ${t37("upgrade.why_manual")}`);
5154
+ log13(`
5155
+ ${t38("upgrade.why_manual")}`);
5025
5156
  }
5026
5157
  });
5027
- program2.command(UPDATE_CHECK_SUBCOMMAND, { hidden: true }).description(t37("upgrade.cmd_refresh")).action(async () => {
5158
+ program2.command(UPDATE_CHECK_SUBCOMMAND, { hidden: true }).description(t38("upgrade.cmd_refresh")).action(async () => {
5028
5159
  await refreshUpdateCache().catch(() => null);
5029
5160
  });
5030
5161
  }
5031
5162
  // src/commands/web.ts
5032
- import { t as t38 } from "@epoch-agent/infra";
5163
+ import { t as t39 } from "@epoch-agent/infra";
5033
5164
  import { diagnosticToLine } from "@epoch-agent/protocol";
5034
5165
  import { buildRuntime as buildRuntime3 } from "@epoch-agent/runtime";
5035
5166
  import {
@@ -5077,7 +5208,7 @@ var err = (msg) => {
5077
5208
  `);
5078
5209
  };
5079
5210
  function registerWebCommand(program2) {
5080
- program2.command("web").description(t38("cli.web.summary")).option("-p, --port <port>", t38("cli.web.opt_port", { port: DEFAULT_WEB_PORT })).option("--host <host>", t38("cli.web.opt_host", { host: DEFAULT_WEB_HOST })).option("--token <token>", t38("cli.web.opt_token")).option("--no-open", t38("cli.web.opt_no_open")).option("--json", t38("cli.web.opt_json")).option("--plugins", t38("cli.web.opt_plugins")).action(async (opts, command) => {
5211
+ program2.command("web").description(t39("cli.web.summary")).option("-p, --port <port>", t39("cli.web.opt_port", { port: DEFAULT_WEB_PORT })).option("--host <host>", t39("cli.web.opt_host", { host: DEFAULT_WEB_HOST })).option("--token <token>", t39("cli.web.opt_token")).option("--no-open", t39("cli.web.opt_no_open")).option("--json", t39("cli.web.opt_json")).option("--plugins", t39("cli.web.opt_plugins")).action(async (opts, command) => {
5081
5212
  await runWeb({ ...opts, json: jsonRequested(opts.json, command.parent?.opts()["json"]) });
5082
5213
  });
5083
5214
  }
@@ -5086,7 +5217,7 @@ function jsonRequested(own, fromProgram) {
5086
5217
  }
5087
5218
  async function runWeb(opts) {
5088
5219
  const port = parsePort2(opts.port);
5089
- if (port === null) return fail(t38("cli.web.err_port", { value: String(opts.port) }));
5220
+ if (port === null) return fail(t39("cli.web.err_port", { value: String(opts.port) }));
5090
5221
  const binding = decideBinding({
5091
5222
  ...opts.host === void 0 ? {} : { host: opts.host },
5092
5223
  ...port === void 0 ? {} : { port },
@@ -5100,7 +5231,7 @@ async function runWeb(opts) {
5100
5231
  const { server } = booted;
5101
5232
  const json = opts.json === true;
5102
5233
  const say = json ? err : out;
5103
- if (booted.noProvider) for (const line of noProviderLines(booted.providerDiagnostics)) say(line);
5234
+ if (booted.noProvider) for (const line2 of noProviderLines(booted.providerDiagnostics)) say(line2);
5104
5235
  const lines = announceLines({
5105
5236
  url: server.url,
5106
5237
  host: server.host,
@@ -5111,12 +5242,12 @@ async function runWeb(opts) {
5111
5242
  json
5112
5243
  });
5113
5244
  if (lines.machine) out(lines.machine);
5114
- for (const line of lines.human) say(line);
5245
+ for (const line2 of lines.human) say(line2);
5115
5246
  if (opts.open && !openInBrowser(server.url)) say(browserFailed());
5116
5247
  installShutdown2(server, say);
5117
5248
  }
5118
- var missingWebRoot = () => t38("cli.web.missing_root");
5119
- var browserFailed = () => ` ${t38("cli.web.browser_failed")}`;
5249
+ var missingWebRoot = () => t39("cli.web.missing_root");
5250
+ var browserFailed = () => ` ${t39("cli.web.browser_failed")}`;
5120
5251
  function pluginsOption(plugins) {
5121
5252
  return plugins ? { hostMarketplaces: { sources: [] } } : {};
5122
5253
  }
@@ -5146,17 +5277,17 @@ async function boot(binding, plugins) {
5146
5277
  };
5147
5278
  }
5148
5279
  function noProviderLines(providerDiagnostics) {
5149
- return [` ${t38("cli.web.no_provider_warn")}`, ...providerDiagnostics.map((line) => ` ${line}`)];
5280
+ return [` ${t39("cli.web.no_provider_warn")}`, ...providerDiagnostics.map((line2) => ` ${line2}`)];
5150
5281
  }
5151
5282
  function announceLines(input2) {
5152
5283
  const human = [];
5153
5284
  if (!input2.json) {
5154
5285
  human.push(` Epoch Web http://${input2.host}:${input2.port}`);
5155
- human.push(` ${t38("cli.web.open_this")}
5286
+ human.push(` ${t39("cli.web.open_this")}
5156
5287
  ${input2.url}`);
5157
5288
  }
5158
5289
  if (input2.lanExposed) {
5159
- human.push(` ${t38("cli.web.lan_exposed")}`);
5290
+ human.push(` ${t39("cli.web.lan_exposed")}`);
5160
5291
  }
5161
5292
  if (input2.placeholder) human.push(` \u26A0 ${missingWebRoot()}`);
5162
5293
  if (!input2.json) return { human };
@@ -5174,7 +5305,7 @@ function installShutdown2(server, say) {
5174
5305
  if (shuttingDown) process.exit(1);
5175
5306
  shuttingDown = true;
5176
5307
  say(`
5177
- ${t38("cli.web.shutting_down")}`);
5308
+ ${t39("cli.web.shutting_down")}`);
5178
5309
  server.close().then(
5179
5310
  () => process.exit(0),
5180
5311
  () => process.exit(1)
@@ -5193,17 +5324,17 @@ function fail(message) {
5193
5324
  process.exit(1);
5194
5325
  }
5195
5326
  // src/language.ts
5196
- import { loadConfig as loadConfig7, setDisplayCurrency } from "@epoch-agent/core";
5327
+ import { loadConfig as loadConfig8, setDisplayCurrency } from "@epoch-agent/core";
5197
5328
  import { resolveLang, setLang } from "@epoch-agent/infra";
5198
5329
  function applyConfiguredLanguage() {
5199
5330
  try {
5200
- setLang(resolveLang(loadConfig7().display?.language));
5331
+ setLang(resolveLang(loadConfig8().display?.language));
5201
5332
  } catch {
5202
5333
  }
5203
5334
  }
5204
5335
  function applyConfiguredCurrency() {
5205
5336
  try {
5206
- setDisplayCurrency(loadConfig7().display?.currency);
5337
+ setDisplayCurrency(loadConfig8().display?.currency);
5207
5338
  } catch {
5208
5339
  }
5209
5340
  }
@@ -5211,7 +5342,7 @@ function applyConfiguredCurrency() {
5211
5342
  applyConfiguredLanguage();
5212
5343
  applyConfiguredCurrency();
5213
5344
  var program = new Command();
5214
- program.name("epoch").description(t39("cli.program_description"));
5345
+ program.name("epoch").description(t40("cli.program_description"));
5215
5346
  registerConfigCommand(program);
5216
5347
  registerMcpCommand(program);
5217
5348
  registerModelCommand(program);