@epoch-agent/cli 2.7.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 +1027 -893
  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) {
@@ -959,7 +1095,6 @@ import {
959
1095
  addMarketplace,
960
1096
  currentEpochVersion,
961
1097
  installPlugin,
962
- inventoryTotal,
963
1098
  isNonInteractive as isNonInteractive2,
964
1099
  loadPlugins,
965
1100
  packPlugin,
@@ -980,10 +1115,10 @@ import {
980
1115
  marketplacesPath,
981
1116
  pluginsDir,
982
1117
  pluginsStatePath,
983
- t as t8
1118
+ t as t9
984
1119
  } from "@epoch-agent/infra";
985
1120
  import { PLUGIN_CATEGORY_DISPLAY_SEP } from "@epoch-agent/protocol";
986
- var log6 = (msg) => {
1121
+ var log7 = (msg) => {
987
1122
  process.stdout.write(msg + "\n");
988
1123
  };
989
1124
  function locations() {
@@ -994,101 +1129,102 @@ function locations() {
994
1129
  };
995
1130
  }
996
1131
  function registerPluginCommand(program2) {
997
- const cmd = program2.command("plugin").description(t8("plugin.cmd_root"));
1132
+ const cmd = program2.command("plugin").description(t9("plugin.cmd_root"));
998
1133
  registerBasics(cmd);
999
1134
  registerLifecycle(cmd);
1000
1135
  registerMarketplace(cmd);
1001
1136
  }
1002
1137
  function registerBasics(cmd) {
1003
- 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) => {
1004
1139
  printList2(opts.verbose === true);
1005
1140
  });
1006
- 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) => {
1007
1142
  await runInstall(source, opts.yes === true);
1008
1143
  });
1009
- 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) => {
1010
1145
  validateDir(path ?? process.cwd());
1011
1146
  });
1012
- 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) => {
1013
1148
  await packDir(path ?? process.cwd(), opts.out);
1014
1149
  });
1015
1150
  }
1016
1151
  function registerLifecycle(cmd) {
1017
- 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) => {
1018
1153
  const outcome = await uninstallPlugin(name, { statePath: pluginsStatePath(EPOCH_HOME) });
1019
1154
  if (!outcome.ok) throw new CliError(outcome.reason);
1020
- log6(`\u2713 ${outcome.message}`);
1155
+ log7(`\u2713 ${outcome.message}`);
1021
1156
  });
1022
- 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) => {
1023
1158
  await toggle(name, false);
1024
1159
  });
1025
- 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) => {
1026
1161
  await toggle(name, true);
1027
1162
  });
1028
- 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) => {
1029
1164
  await runUpdate(name, opts.yes === true);
1030
1165
  });
1031
1166
  }
1032
1167
  function registerMarketplace(cmd) {
1033
- const market = cmd.command("marketplace").alias("mp").description(t8("plugin.cmd_market"));
1034
- 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) => {
1035
1170
  const outcome = await addMarketplace(source, { statePath: marketplacesPath(EPOCH_HOME) });
1036
1171
  if (!outcome.ok) throw new CliError(outcome.reason);
1037
1172
  const count = outcome.record.catalog.plugins.length;
1038
- log6(`\u2713 ${t8("plugin.market_added", { name: outcome.record.name, count })}`);
1039
- 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"));
1040
1175
  });
1041
- market.command("list", { isDefault: true }).alias("ls").description(t8("plugin.cmd_market_list")).action(printMarketplaces);
1042
- 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) => {
1043
1178
  const outcome = await removeMarketplace(name, { statePath: marketplacesPath(EPOCH_HOME) });
1044
1179
  if (!outcome.ok)
1045
- throw new CliError(outcome.reason ?? t8("plugin.market_remove_failed", { name }));
1046
- 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 })}`);
1047
1182
  });
1048
- 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) => {
1049
1184
  const outcome = await updateMarketplace(name, { statePath: marketplacesPath(EPOCH_HOME) });
1050
1185
  if (!outcome.ok) throw new CliError(outcome.reason);
1051
- log6(
1052
- `\u2713 ${t8("plugin.market_updated", {
1186
+ log7(
1187
+ `\u2713 ${t9("plugin.market_updated", {
1053
1188
  name,
1054
1189
  count: outcome.record.catalog.plugins.length
1055
1190
  })}`
1056
1191
  );
1057
1192
  });
1058
- 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) => {
1059
1194
  printSearch(keyword ?? "");
1060
1195
  });
1061
1196
  }
1062
1197
  function printList2(verbose) {
1063
1198
  const artifacts = loadPlugins({ statePath: pluginsStatePath(EPOCH_HOME) });
1064
1199
  if (artifacts.loaded.length === 0 && artifacts.skipped.length === 0) {
1065
- log6(t8("plugin.none_installed"));
1066
- log6(t8("plugin.none_installed_hint"));
1200
+ log7(t9("plugin.none_installed"));
1201
+ log7(t9("plugin.none_installed_hint"));
1067
1202
  return;
1068
1203
  }
1069
- log6(`${t8("plugin.installed_head", { path: pluginsStatePath(EPOCH_HOME) })}
1204
+ log7(`${t9("plugin.installed_head", { path: pluginsStatePath(EPOCH_HOME) })}
1070
1205
  `);
1071
1206
  for (const plugin of artifacts.loaded) {
1072
- log6(loadedLine(plugin));
1207
+ log7(loadedLine(plugin));
1073
1208
  if (!verbose) continue;
1074
- for (const line of renderInventory(scanPluginDir(plugin.dir, plugin.name))) {
1075
- log6(` ${line}`);
1076
- }
1077
- log6("");
1209
+ const rows = renderInventory(scanPluginDir(plugin.dir, plugin.name));
1210
+ for (const line2 of rows) log7(` ${line2}`);
1211
+ if (rows.length > 0) log7("");
1078
1212
  }
1079
- for (const skipped of artifacts.skipped) log6(skippedLine(skipped));
1080
- if (artifacts.skipped.length > 0) log6(`
1213
+ for (const skipped of artifacts.skipped) log7(skippedLine(skipped));
1214
+ if (artifacts.skipped.length > 0) log7(`
1081
1215
  ${markLegend()}`);
1082
- for (const detail of issueDetails(artifacts.issues)) log6(`
1216
+ for (const detail of issueDetails(artifacts.issues)) log7(`
1083
1217
  \u26A0 ${detail}`);
1084
1218
  }
1085
1219
  function loadedLine(plugin) {
1086
- return ` \u2713 ${plugin.name}@${plugin.version} \u2190 ${plugin.source} ${countsLine(plugin.counts)}`;
1220
+ const head = ` \u2713 ${plugin.name}@${plugin.version} \u2190 ${plugin.source}`;
1221
+ const counts = countsLine(plugin.counts);
1222
+ return counts === "" ? head : `${head} ${counts}`;
1087
1223
  }
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");
@@ -1096,85 +1232,88 @@ function countsLine(counts) {
1096
1232
  add(counts.hooks, "plugin.n_hooks");
1097
1233
  add(counts.denyRules, "plugin.n_deny");
1098
1234
  add(counts.mcpServers, "plugin.n_mcp");
1099
- return parts.length === 0 ? t8("plugin.brings_nothing") : parts.join(" \xB7 ");
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 })}`);
1310
+ }
1311
+ const rows = renderInventory(inventory);
1312
+ if (rows.length > 0) {
1313
+ lines.push("");
1314
+ lines.push(t9("plugin.brings_head_indented"));
1315
+ for (const line2 of rows) lines.push(` ${line2}`);
1174
1316
  }
1175
- lines.push("");
1176
- lines.push(t8("plugin.brings_head_indented"));
1177
- for (const line of renderInventory(inventory)) lines.push(` ${line}`);
1178
1317
  if (preview2.dependencies?.length) {
1179
1318
  lines.push("");
1180
1319
  lines.push(...renderDependencies(preview2.dependencies));
@@ -1183,19 +1322,19 @@ function renderPreview(preview2) {
1183
1322
  return lines;
1184
1323
  }
1185
1324
  function renderDependencies(deps) {
1186
- const lines = [t8("plugin.deps_head_indented")];
1325
+ const lines = [t9("plugin.deps_head_indented")];
1187
1326
  for (const dep of deps) {
1188
1327
  const label = depLabel(dep);
1189
1328
  if (dep.status === "installed") {
1190
- lines.push(` ${t8("plugin.dep_installed", { label })}`);
1329
+ lines.push(` ${t9("plugin.dep_installed", { label })}`);
1191
1330
  continue;
1192
1331
  }
1193
1332
  if (dep.status === "unresolved") {
1194
- lines.push(` ${t8("plugin.dep_unresolved", { label, reason: dep.reason ?? "" })}`);
1333
+ lines.push(` ${t9("plugin.dep_unresolved", { label, reason: dep.reason ?? "" })}`);
1195
1334
  continue;
1196
1335
  }
1197
1336
  lines.push(
1198
- ` ${t8("plugin.dep_plan", {
1337
+ ` ${t9("plugin.dep_plan", {
1199
1338
  label,
1200
1339
  version: dep.manifest?.version ?? "",
1201
1340
  source: dep.source ?? ""
@@ -1203,10 +1342,10 @@ function renderDependencies(deps) {
1203
1342
  );
1204
1343
  if (dep.versionUnmet) {
1205
1344
  const { required, current } = dep.versionUnmet;
1206
- lines.push(` ${t8("plugin.preview_version_unmet", { required, current })}`);
1345
+ lines.push(` ${t9("plugin.preview_version_unmet", { required, current })}`);
1207
1346
  }
1208
1347
  if (dep.inventory) {
1209
- for (const line of renderInventory(dep.inventory)) lines.push(` ${line}`);
1348
+ for (const line2 of renderInventory(dep.inventory)) lines.push(` ${line2}`);
1210
1349
  }
1211
1350
  }
1212
1351
  return lines;
@@ -1214,125 +1353,125 @@ function renderDependencies(deps) {
1214
1353
  function depLabel(dep) {
1215
1354
  const display = dep.displayName;
1216
1355
  if (!display || display === dep.name) return dep.name;
1217
- return t8("plugin.dep_label_named", { display, name: dep.name });
1356
+ return t9("plugin.dep_label_named", { display, name: dep.name });
1218
1357
  }
1219
1358
  function renderInventory(inv) {
1220
1359
  const lines = [];
1221
- if (inventoryTotal(inv) === 0) {
1222
- lines.push(t8("plugin.inventory_empty"));
1223
- }
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}`);
1330
- log6(`
1331
- ${t8("plugin.brings_head")}`);
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}`);
1332
1466
  const inventory = scanPluginDir(dir, manifest.name);
1333
- for (const line of renderInventory(inventory)) log6(` ${line}`);
1467
+ const rows = renderInventory(inventory);
1468
+ if (rows.length > 0) {
1469
+ log7(`
1470
+ ${t9("plugin.brings_head")}`);
1471
+ for (const line2 of rows) log7(` ${line2}`);
1472
+ }
1334
1473
  if (inventory.issues.length > 0) {
1335
- throw new CliError(t8("plugin.inv_issues", { count: inventory.issues.length }));
1474
+ throw new CliError(t9("plugin.inv_issues", { count: inventory.issues.length }));
1336
1475
  }
1337
1476
  }
1338
1477
  async function packDir(dir, out2) {
@@ -1340,48 +1479,48 @@ async function packDir(dir, out2) {
1340
1479
  const planned = planPack(target);
1341
1480
  if (!planned.ok) throw new CliError(planned.reason);
1342
1481
  const plan = planned.plan;
1343
- log6(t8("plugin.pack_head", { name: plan.manifest.name, version: plan.manifest.version }));
1344
- for (const file of plan.files) log6(` ${file.path}`);
1345
- log6(
1346
- 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", {
1347
1486
  count: plan.files.length,
1348
1487
  kb: Math.round(plan.totalBytes / 1024)
1349
1488
  })
1350
1489
  );
1351
1490
  if (plan.suspicious.length > 0) {
1352
- log6(`\u26A0 ${t8("plugin.pack_suspicious", { files: plan.suspicious.join(", ") })}`);
1491
+ log7(`\u26A0 ${t9("plugin.pack_suspicious", { files: plan.suspicious.join(", ") })}`);
1353
1492
  }
1354
1493
  if (plan.skippedLinks.length > 0) {
1355
- log6(`\u26A0 ${t8("plugin.pack_skipped_links", { files: plan.skippedLinks.join(", ") })}`);
1494
+ log7(`\u26A0 ${t9("plugin.pack_skipped_links", { files: plan.skippedLinks.join(", ") })}`);
1356
1495
  }
1357
1496
  const destDir = resolve(out2 ?? dirname(target));
1358
1497
  mkdirSync2(destDir, { recursive: true });
1359
1498
  const packed = await packPlugin(plan, destDir);
1360
1499
  if (!packed.ok) throw new CliError(packed.reason);
1361
- log6(
1362
- `\u2713 ${t8("plugin.pack_ok", {
1500
+ log7(
1501
+ `\u2713 ${t9("plugin.pack_ok", {
1363
1502
  path: packed.archivePath,
1364
1503
  kb: Math.round(packed.bytes / 1024)
1365
1504
  })}`
1366
1505
  );
1367
- log6(t8("plugin.pack_next", { path: packed.archivePath }));
1506
+ log7(t9("plugin.pack_next", { path: packed.archivePath }));
1368
1507
  }
1369
1508
  // src/commands/run.ts
1370
1509
  import { existsSync as existsSync6 } from "fs";
1371
1510
  import { dirname as dirname4, join as join5 } from "path";
1372
1511
  import { fileURLToPath as fileURLToPath3 } from "url";
1373
1512
  import { isNonInteractive as isNonInteractive8, OPERATION_TYPES as OPERATION_TYPES3, PERMISSION_LEVELS as PERMISSION_LEVELS3 } from "@epoch-agent/core";
1374
- import { guardSpawn as guardSpawn3, t as t25 } from "@epoch-agent/infra";
1513
+ import { guardSpawn as guardSpawn3, t as t26 } from "@epoch-agent/infra";
1375
1514
  import { HEADLESS_INPUT_FORMATS as HEADLESS_INPUT_FORMATS2, HEADLESS_OUTPUT_FORMATS as HEADLESS_OUTPUT_FORMATS2 } from "@epoch-agent/protocol";
1376
1515
  // src/headless/session.ts
1377
1516
  import { OPERATION_TYPES } from "@epoch-agent/core";
1378
- import { t as t12 } from "@epoch-agent/infra";
1517
+ import { t as t13 } from "@epoch-agent/infra";
1379
1518
  import { buildRuntime } from "@epoch-agent/runtime";
1380
1519
  // src/commands/run-flags.ts
1381
1520
  import { existsSync as existsSync3 } from "fs";
1382
1521
  import { delimiter, resolve as resolve2 } from "path";
1383
1522
  import { isOperationType, resolveWorkspace } from "@epoch-agent/core";
1384
- import { t as t9 } from "@epoch-agent/infra";
1523
+ import { t as t10 } from "@epoch-agent/infra";
1385
1524
  import {
1386
1525
  HEADLESS_INPUT_FORMATS,
1387
1526
  HEADLESS_OUTPUT_FORMATS,
@@ -1401,14 +1540,14 @@ function parseResumeArg(raw) {
1401
1540
  }
1402
1541
  function assertResumeFlagsExclusive(opts) {
1403
1542
  if (opts.continue === true && opts.resume !== void 0) {
1404
- 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"));
1405
1544
  }
1406
1545
  }
1407
1546
  function applySettingsPath(path) {
1408
1547
  if (!path) return;
1409
1548
  const abs = resolve2(path);
1410
1549
  if (!existsSync3(abs)) {
1411
- 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 }));
1412
1551
  }
1413
1552
  process.env.EPOCH_SETTINGS = abs;
1414
1553
  }
@@ -1419,9 +1558,9 @@ function applyAddDirs(dirs) {
1419
1558
  const fatal = issues.filter((i) => i.kind !== "redundant");
1420
1559
  if (fatal.length > 0) {
1421
1560
  throw new CliError(
1422
- 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(", ") }),
1423
1562
  1,
1424
- fatal.map((i) => i.detail).join(t9("flags.detail_sep"))
1563
+ fatal.map((i) => i.detail).join(t10("flags.detail_sep"))
1425
1564
  );
1426
1565
  }
1427
1566
  process.env.EPOCH_ADD_DIR = abs.join(delimiter);
@@ -1453,17 +1592,17 @@ function resolveOutputFormat(opts) {
1453
1592
  const explicit = opts.outputFormat;
1454
1593
  if (explicit !== void 0 && !isHeadlessOutputFormat(explicit)) {
1455
1594
  throw new CliError(
1456
- t9("flags.output_format_unknown", { value: explicit }),
1595
+ t10("flags.output_format_unknown", { value: explicit }),
1457
1596
  1,
1458
- t9("flags.choices", { choices: HEADLESS_OUTPUT_FORMATS.join(" / ") })
1597
+ t10("flags.choices", { choices: HEADLESS_OUTPUT_FORMATS.join(" / ") })
1459
1598
  );
1460
1599
  }
1461
1600
  if (explicit === void 0) return opts.json === true ? "json" : "text";
1462
1601
  if (opts.json === true && explicit !== "json") {
1463
1602
  throw new CliError(
1464
- t9("flags.json_conflict", { value: explicit }),
1603
+ t10("flags.json_conflict", { value: explicit }),
1465
1604
  1,
1466
- t9("flags.json_conflict_hint")
1605
+ t10("flags.json_conflict_hint")
1467
1606
  );
1468
1607
  }
1469
1608
  return explicit;
@@ -1472,9 +1611,9 @@ function resolveHeadlessFormats(opts) {
1472
1611
  const raw = opts.inputFormat;
1473
1612
  if (raw !== void 0 && !isHeadlessInputFormat(raw)) {
1474
1613
  throw new CliError(
1475
- t9("flags.input_format_unknown", { value: raw }),
1614
+ t10("flags.input_format_unknown", { value: raw }),
1476
1615
  1,
1477
- t9("flags.choices", { choices: HEADLESS_INPUT_FORMATS.join(" / ") })
1616
+ t10("flags.choices", { choices: HEADLESS_INPUT_FORMATS.join(" / ") })
1478
1617
  );
1479
1618
  }
1480
1619
  const input2 = raw ?? "text";
@@ -1484,7 +1623,7 @@ function resolveHeadlessFormats(opts) {
1484
1623
  }
1485
1624
  const output = resolveOutputFormat(opts);
1486
1625
  if (output !== "stream-json") {
1487
- 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"));
1488
1627
  }
1489
1628
  return { input: input2, output };
1490
1629
  }
@@ -1498,9 +1637,9 @@ function resolveApproverProgram(raw) {
1498
1637
  const abs = resolve2(value);
1499
1638
  if (!existsSync3(abs)) {
1500
1639
  throw new CliError(
1501
- t9("flags.prompt_tool_missing", { value }),
1640
+ t10("flags.prompt_tool_missing", { value }),
1502
1641
  1,
1503
- t9("flags.prompt_tool_missing_hint", { abs })
1642
+ t10("flags.prompt_tool_missing_hint", { abs })
1504
1643
  );
1505
1644
  }
1506
1645
  return `"${abs}"`;
@@ -1523,15 +1662,15 @@ function parseNumeric(raw, flag, opts = {}) {
1523
1662
  const tooSmall = opts.allowZero === true ? n < 0 : n <= 0;
1524
1663
  if (raw.trim() === "" || !Number.isFinite(n) || tooSmall || !extra(n)) {
1525
1664
  throw new CliError(
1526
- t9("flags.not_a_number", { flag, raw }),
1665
+ t10("flags.not_a_number", { flag, raw }),
1527
1666
  1,
1528
- 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")
1529
1668
  );
1530
1669
  }
1531
1670
  return n;
1532
1671
  }
1533
1672
  // src/headless/driver.ts
1534
- import { t as t11 } from "@epoch-agent/infra";
1673
+ import { t as t12 } from "@epoch-agent/infra";
1535
1674
  // src/headless/emit.ts
1536
1675
  import {
1537
1676
  HEADLESS_PROTOCOL_VERSION
@@ -1545,7 +1684,7 @@ var HeadlessEmitter = class {
1545
1684
  seq = 0;
1546
1685
  sessionId = "";
1547
1686
  constructor(opts = {}) {
1548
- this.write = opts.write ?? ((line) => void process.stdout.write(line + "\n"));
1687
+ this.write = opts.write ?? ((line2) => void process.stdout.write(line2 + "\n"));
1549
1688
  this.clock = opts.clock ?? Date.now;
1550
1689
  }
1551
1690
  init(info) {
@@ -1648,22 +1787,22 @@ function initInfoOf(runtime, cwd) {
1648
1787
  model: runtime.model?.get().model ?? runtime.config.model ?? "",
1649
1788
  ...provider ? { provider } : {},
1650
1789
  permissionLevel: runtime.permissions.level(),
1651
- tools: runtime.tools.map((t40) => t40.name),
1790
+ tools: runtime.tools.map((t41) => t41.name),
1652
1791
  usageScope: runtime.usageScope,
1653
1792
  diagnostics: runtime.diagnostics
1654
1793
  };
1655
1794
  }
1656
1795
  // src/headless/read.ts
1657
1796
  import { createInterface } from "readline";
1658
- import { t as t10 } from "@epoch-agent/infra";
1797
+ import { t as t11 } from "@epoch-agent/infra";
1659
1798
  import {
1660
1799
  APPROVAL_OUTCOMES,
1661
1800
  HEADLESS_INPUT_EVENT_TYPES,
1662
1801
  isApprovalOutcome,
1663
1802
  isQuestionAnswerMap
1664
1803
  } from "@epoch-agent/protocol";
1665
- function parseInputLine(line) {
1666
- const text = line.trim();
1804
+ function parseInputLine(line2) {
1805
+ const text = line2.trim();
1667
1806
  if (!text) return void 0;
1668
1807
  let raw;
1669
1808
  try {
@@ -1671,17 +1810,17 @@ function parseInputLine(line) {
1671
1810
  } catch (err2) {
1672
1811
  return {
1673
1812
  ok: false,
1674
- 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) })
1675
1814
  };
1676
1815
  }
1677
1816
  if (!isRecord(raw)) {
1678
- 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) }) };
1679
1818
  }
1680
1819
  const type = raw["type"];
1681
1820
  if (typeof type !== "string" || !HEADLESS_INPUT_EVENT_TYPES.has(type)) {
1682
1821
  return {
1683
1822
  ok: false,
1684
- message: t10("headless_input.bad_type", {
1823
+ message: t11("headless_input.bad_type", {
1685
1824
  value: JSON.stringify(type),
1686
1825
  choices: [...HEADLESS_INPUT_EVENT_TYPES].join(" / ")
1687
1826
  })
@@ -1695,15 +1834,15 @@ function parseInputLine(line) {
1695
1834
  function parseUserMessage(raw) {
1696
1835
  const content = raw["content"];
1697
1836
  if (typeof content === "string") {
1698
- 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") };
1699
1838
  return { ok: true, event: { type: "user-message", content } };
1700
1839
  }
1701
1840
  if (!Array.isArray(content) || content.length === 0) {
1702
- return { ok: false, message: t10("headless_input.msg_bad_content") };
1841
+ return { ok: false, message: t11("headless_input.msg_bad_content") };
1703
1842
  }
1704
1843
  const bad = content.findIndex((p) => !isRecord(p) || typeof p["type"] !== "string");
1705
1844
  if (bad >= 0) {
1706
- 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 }) };
1707
1846
  }
1708
1847
  return {
1709
1848
  ok: true,
@@ -1713,13 +1852,13 @@ function parseUserMessage(raw) {
1713
1852
  function parseApprovalResponse(raw) {
1714
1853
  const requestId = raw["requestId"];
1715
1854
  if (typeof requestId !== "string" || !requestId) {
1716
- return { ok: false, message: t10("headless_input.approval_no_id") };
1855
+ return { ok: false, message: t11("headless_input.approval_no_id") };
1717
1856
  }
1718
1857
  const outcome = raw["outcome"];
1719
1858
  if (typeof outcome !== "string" || !isApprovalOutcome(outcome)) {
1720
1859
  return {
1721
1860
  ok: false,
1722
- message: t10("headless_input.approval_bad_outcome", {
1861
+ message: t11("headless_input.approval_bad_outcome", {
1723
1862
  value: JSON.stringify(outcome),
1724
1863
  choices: APPROVAL_OUTCOMES.join(" / ")
1725
1864
  })
@@ -1727,7 +1866,7 @@ function parseApprovalResponse(raw) {
1727
1866
  }
1728
1867
  const note = raw["note"];
1729
1868
  if (note !== void 0 && typeof note !== "string") {
1730
- return { ok: false, message: t10("headless_input.approval_bad_note") };
1869
+ return { ok: false, message: t11("headless_input.approval_bad_note") };
1731
1870
  }
1732
1871
  return {
1733
1872
  ok: true,
@@ -1742,19 +1881,19 @@ function parseApprovalResponse(raw) {
1742
1881
  function parseQuestionResponse(raw) {
1743
1882
  const requestId = raw["requestId"];
1744
1883
  if (typeof requestId !== "string" || !requestId) {
1745
- return { ok: false, message: t10("headless_input.question_no_id") };
1884
+ return { ok: false, message: t11("headless_input.question_no_id") };
1746
1885
  }
1747
1886
  if (!isQuestionAnswerMap(raw["answers"])) {
1748
1887
  return {
1749
1888
  ok: false,
1750
- message: t10("headless_input.question_bad_answers", {
1889
+ message: t11("headless_input.question_bad_answers", {
1751
1890
  json: '{"answers":{},"skipped":true}'
1752
1891
  })
1753
1892
  };
1754
1893
  }
1755
1894
  const skipped = raw["skipped"];
1756
1895
  if (skipped !== void 0 && typeof skipped !== "boolean") {
1757
- return { ok: false, message: t10("headless_input.question_bad_skipped") };
1896
+ return { ok: false, message: t11("headless_input.question_bad_skipped") };
1758
1897
  }
1759
1898
  return {
1760
1899
  ok: true,
@@ -1769,7 +1908,7 @@ function parseQuestionResponse(raw) {
1769
1908
  async function* readInputLines(stream = process.stdin) {
1770
1909
  const rl = createInterface({ input: stream, crlfDelay: Infinity });
1771
1910
  try {
1772
- for await (const line of rl) yield line;
1911
+ for await (const line2 of rl) yield line2;
1773
1912
  } finally {
1774
1913
  rl.close();
1775
1914
  }
@@ -1786,18 +1925,18 @@ function preview(text) {
1786
1925
  // src/headless/driver.ts
1787
1926
  async function driveStreamJson(opts) {
1788
1927
  const { limits } = opts;
1789
- const warn4 = opts.warn ?? ((line) => void process.stderr.write(line + "\n"));
1928
+ const warn4 = opts.warn ?? ((line2) => void process.stderr.write(line2 + "\n"));
1790
1929
  const emitter = new HeadlessEmitter({
1791
1930
  ...opts.write ? { write: opts.write } : {},
1792
1931
  ...opts.clock ? { clock: opts.clock } : {}
1793
1932
  });
1794
1933
  emitter.init(opts.init);
1795
1934
  const state = new DriverState(opts.session, emitter, limits, warn4);
1796
- for await (const line of readInputLines(opts.input ?? process.stdin)) {
1797
- const parsed = parseInputLine(line);
1935
+ for await (const line2 of readInputLines(opts.input ?? process.stdin)) {
1936
+ const parsed = parseInputLine(line2);
1798
1937
  if (parsed === void 0) continue;
1799
1938
  if (!parsed.ok) {
1800
- warn4(t11("headless_driver.bad_input", { message: parsed.message }));
1939
+ warn4(t12("headless_driver.bad_input", { message: parsed.message }));
1801
1940
  state.sawBadInput = true;
1802
1941
  continue;
1803
1942
  }
@@ -1832,7 +1971,7 @@ var DriverState = class {
1832
1971
  }
1833
1972
  if (event.type === "approval-response") {
1834
1973
  if (!this.emitter.respondApproval(event.requestId, event.outcome, event.note)) {
1835
- this.warn(t11("headless_driver.unknown_request", { id: event.requestId }));
1974
+ this.warn(t12("headless_driver.unknown_request", { id: event.requestId }));
1836
1975
  }
1837
1976
  return false;
1838
1977
  }
@@ -1842,7 +1981,7 @@ var DriverState = class {
1842
1981
  ...event.skipped ? { skipped: true } : {}
1843
1982
  };
1844
1983
  if (!this.emitter.respondQuestion(event.requestId, answer)) {
1845
- this.warn(t11("headless_driver.unknown_request", { id: event.requestId }));
1984
+ this.warn(t12("headless_driver.unknown_request", { id: event.requestId }));
1846
1985
  }
1847
1986
  return false;
1848
1987
  }
@@ -1904,11 +2043,11 @@ var DriverState = class {
1904
2043
  reapLostHost() {
1905
2044
  const approvals = this.emitter.abandonApprovals();
1906
2045
  if (approvals > 0) {
1907
- this.warn(t11("headless_driver.abandoned_approvals", { count: approvals }));
2046
+ this.warn(t12("headless_driver.abandoned_approvals", { count: approvals }));
1908
2047
  }
1909
2048
  const questions = this.emitter.abandonQuestions();
1910
2049
  if (questions > 0) {
1911
- this.warn(t11("headless_driver.abandoned_questions", { count: questions }));
2050
+ this.warn(t12("headless_driver.abandoned_questions", { count: questions }));
1912
2051
  }
1913
2052
  this.queue.length = 0;
1914
2053
  this.controller?.abort();
@@ -1933,9 +2072,9 @@ async function runStreamJsonSession(opts) {
1933
2072
  const { policy: headless, invalid } = parseHeadlessFlags(opts);
1934
2073
  if (invalid.length > 0) {
1935
2074
  throw new CliError(
1936
- t12("run_once.err_bad_operation", { values: invalid.join(", ") }),
2075
+ t13("run_once.err_bad_operation", { values: invalid.join(", ") }),
1937
2076
  EXIT_CODES.FAILURE,
1938
- t12("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES.join(" / ") })
2077
+ t13("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES.join(" / ") })
1939
2078
  );
1940
2079
  }
1941
2080
  const limits = parseCallLimits(opts);
@@ -1964,21 +2103,21 @@ function reportDeadRuntime(runtime) {
1964
2103
  const detail = runtime.diagnostics.join("; ");
1965
2104
  emitter.agentEvent({
1966
2105
  type: "error",
1967
- message: detail ? t12("headless_session.no_provider_detail", {
1968
- message: t12("run_once.err_no_provider"),
2106
+ message: detail ? t13("headless_session.no_provider_detail", {
2107
+ message: t13("run_once.err_no_provider"),
1969
2108
  detail
1970
- }) : t12("run_once.err_no_provider")
2109
+ }) : t13("run_once.err_no_provider")
1971
2110
  });
1972
2111
  emitter.result({ ok: false, reason: "error", text: "", turns: 0 });
1973
2112
  return EXIT_CODES.FAILURE;
1974
2113
  }
1975
2114
  function warnInertFlags(opts) {
1976
2115
  if ((opts.allowTool ?? []).length > 0 || (opts.allowOperation ?? []).length > 0) {
1977
- process.stderr.write(`${t12("headless_session.inert_allow")}
2116
+ process.stderr.write(`${t13("headless_session.inert_allow")}
1978
2117
  `);
1979
2118
  }
1980
2119
  if ((opts.image ?? []).length > 0) {
1981
- process.stderr.write(`${t12("headless_session.inert_image")}
2120
+ process.stderr.write(`${t13("headless_session.inert_image")}
1982
2121
  `);
1983
2122
  }
1984
2123
  }
@@ -1988,17 +2127,17 @@ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as rea
1988
2127
  import { get } from "https";
1989
2128
  import { dirname as dirname3, join as join3 } from "path";
1990
2129
  import { fileURLToPath as fileURLToPath2 } from "url";
1991
- import { t as t15 } from "@epoch-agent/infra";
2130
+ import { t as t16 } from "@epoch-agent/infra";
1992
2131
  // src/version.ts
1993
2132
  import { readFileSync as readFileSync2 } from "fs";
1994
2133
  import { dirname as dirname2, join as join2 } from "path";
1995
2134
  import { fileURLToPath } from "url";
1996
- import { t as t14 } from "@epoch-agent/infra";
2135
+ import { t as t15 } from "@epoch-agent/infra";
1997
2136
  // src/installation.ts
1998
2137
  import { execFileSync } from "child_process";
1999
2138
  import { existsSync as existsSync4, realpathSync } from "fs";
2000
2139
  import { join } from "path";
2001
- import { normalizeForMatch, t as t13 } from "@epoch-agent/infra";
2140
+ import { normalizeForMatch, t as t14 } from "@epoch-agent/infra";
2002
2141
  var PATH_RULES = [
2003
2142
  {
2004
2143
  patterns: [
@@ -2012,7 +2151,7 @@ var PATH_RULES = [
2012
2151
  build: () => ({
2013
2152
  packageManager: "npx",
2014
2153
  isGlobal: false,
2015
- note: t13("installation.npx")
2154
+ note: t14("installation.npx")
2016
2155
  })
2017
2156
  },
2018
2157
  {
@@ -2021,7 +2160,7 @@ var PATH_RULES = [
2021
2160
  packageManager: "volta",
2022
2161
  isGlobal: true,
2023
2162
  updateCommand: `volta install ${pkg}@latest`,
2024
- note: t13("installation.volta")
2163
+ note: t14("installation.volta")
2025
2164
  })
2026
2165
  },
2027
2166
  {
@@ -2035,7 +2174,7 @@ var PATH_RULES = [
2035
2174
  packageManager: "pnpm",
2036
2175
  isGlobal: true,
2037
2176
  updateCommand: `pnpm add -g ${pkg}@latest`,
2038
- note: t13("installation.pnpm")
2177
+ note: t14("installation.pnpm")
2039
2178
  })
2040
2179
  },
2041
2180
  {
@@ -2049,7 +2188,7 @@ var PATH_RULES = [
2049
2188
  packageManager: "yarn",
2050
2189
  isGlobal: true,
2051
2190
  updateCommand: `yarn global add ${pkg}@latest`,
2052
- note: t13("installation.yarn")
2191
+ note: t14("installation.yarn")
2053
2192
  })
2054
2193
  },
2055
2194
  {
@@ -2058,7 +2197,7 @@ var PATH_RULES = [
2058
2197
  packageManager: "bun",
2059
2198
  isGlobal: true,
2060
2199
  updateCommand: `bun add -g ${pkg}@latest`,
2061
- note: t13("installation.bun")
2200
+ note: t14("installation.bun")
2062
2201
  })
2063
2202
  }
2064
2203
  ];
@@ -2078,7 +2217,7 @@ function detectHomebrew(realPath, formula) {
2078
2217
  packageManager: "homebrew",
2079
2218
  isGlobal: true,
2080
2219
  updateCommand: `brew upgrade ${formula}`,
2081
- note: t13("installation.homebrew")
2220
+ note: t14("installation.homebrew")
2082
2221
  };
2083
2222
  }
2084
2223
  } catch {
@@ -2103,12 +2242,12 @@ function detectLocalInstall(matchPath, cwd) {
2103
2242
  return {
2104
2243
  packageManager: manager,
2105
2244
  isGlobal: false,
2106
- note: t13("installation.local")
2245
+ note: t14("installation.local")
2107
2246
  };
2108
2247
  }
2109
2248
  function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2110
2249
  if (!cliPath) {
2111
- return { packageManager: "unknown", isGlobal: false, note: t13("installation.unknown") };
2250
+ return { packageManager: "unknown", isGlobal: false, note: t14("installation.unknown") };
2112
2251
  }
2113
2252
  try {
2114
2253
  const realPath = realpathSync(cliPath).replace(/\\/g, "/");
@@ -2121,7 +2260,7 @@ function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2121
2260
  return {
2122
2261
  packageManager: "source",
2123
2262
  isGlobal: false,
2124
- note: t13("installation.source")
2263
+ note: t14("installation.source")
2125
2264
  };
2126
2265
  }
2127
2266
  const brew = detectHomebrew(realPath, packageName.replace(/^@[^/]+\//, ""));
@@ -2132,10 +2271,10 @@ function getInstallationInfo(packageName, cliPath = process.argv[1]) {
2132
2271
  packageManager: "npm",
2133
2272
  isGlobal: true,
2134
2273
  updateCommand: `npm install -g ${packageName}@latest`,
2135
- note: t13("installation.npm")
2274
+ note: t14("installation.npm")
2136
2275
  };
2137
2276
  } catch {
2138
- return { packageManager: "unknown", isGlobal: false, note: t13("installation.unknown") };
2277
+ return { packageManager: "unknown", isGlobal: false, note: t14("installation.unknown") };
2139
2278
  }
2140
2279
  }
2141
2280
  // src/version.ts
@@ -2159,9 +2298,9 @@ function describeVersion(packageName) {
2159
2298
  return [
2160
2299
  VERSION,
2161
2300
  `Node: ${process.version} (${process.platform}/${process.arch})`,
2162
- t14("version.install", {
2301
+ t15("version.install", {
2163
2302
  manager: info.packageManager,
2164
- global: info.isGlobal ? t14("installation.global_suffix") : "",
2303
+ global: info.isGlobal ? t15("installation.global_suffix") : "",
2165
2304
  note: info.note
2166
2305
  })
2167
2306
  ].join("\n");
@@ -2305,7 +2444,7 @@ function readUpdateNotice(options = {}) {
2305
2444
  name,
2306
2445
  current: version,
2307
2446
  latest: cache.latest,
2308
- message: t15("update_check.available", { name, current: version, latest: cache.latest })
2447
+ message: t16("update_check.available", { name, current: version, latest: cache.latest })
2309
2448
  };
2310
2449
  }
2311
2450
  async function refreshUpdateCache(options = {}) {
@@ -2334,7 +2473,7 @@ async function refreshUpdateCache(options = {}) {
2334
2473
  name,
2335
2474
  current: version,
2336
2475
  latest,
2337
- message: t15("update_check.available", { name, current: version, latest })
2476
+ message: t16("update_check.available", { name, current: version, latest })
2338
2477
  };
2339
2478
  }
2340
2479
  function scheduleUpdateCheck(options = {}) {
@@ -2372,7 +2511,7 @@ import { execFile } from "child_process";
2372
2511
  import { randomBytes } from "crypto";
2373
2512
  import { mkdirSync as mkdirSync4 } from "fs";
2374
2513
  import { basename, join as join4, resolve as resolve3 } from "path";
2375
- import { guardSpawn, t as t16, worktreesDir } from "@epoch-agent/infra";
2514
+ import { guardSpawn, t as t17, worktreesDir } from "@epoch-agent/infra";
2376
2515
  var TIMEOUT_MS = 6e4;
2377
2516
  function git(args, cwd) {
2378
2517
  return new Promise((done) => {
@@ -2401,13 +2540,13 @@ function git(args, cwd) {
2401
2540
  });
2402
2541
  }
2403
2542
  function firstLine(text) {
2404
- return text.trim().split("\n")[0]?.trim() ?? t16("git.unknown_reason");
2543
+ return text.trim().split("\n")[0]?.trim() ?? t17("git.unknown_reason");
2405
2544
  }
2406
2545
  async function createWorktree(cwd = process.cwd(), container = worktreesDir()) {
2407
2546
  const repoRoot = await resolveRepoRoot(cwd);
2408
2547
  const head = await git(["rev-parse", "HEAD"], repoRoot);
2409
2548
  if (!head.ok) {
2410
- 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"));
2411
2550
  }
2412
2551
  const baseRef = head.stdout.trim();
2413
2552
  const shortId = randomBytes(3).toString("hex");
@@ -2416,26 +2555,26 @@ async function createWorktree(cwd = process.cwd(), container = worktreesDir()) {
2416
2555
  mkdirSync4(container, { recursive: true });
2417
2556
  const added = await git(["worktree", "add", "-b", branch, path, baseRef], repoRoot);
2418
2557
  if (!added.ok) {
2419
- 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));
2420
2559
  }
2421
2560
  return { repoRoot, path, branch, baseRef };
2422
2561
  }
2423
2562
  async function resolveRepoRoot(cwd) {
2424
2563
  const root = await git(["rev-parse", "--show-toplevel"], cwd);
2425
2564
  if (root.missing) {
2426
- 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"));
2427
2566
  }
2428
2567
  if (!root.ok) {
2429
2568
  throw new CliError(
2430
- t16("worktree.err_not_a_repo"),
2569
+ t17("worktree.err_not_a_repo"),
2431
2570
  1,
2432
- 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) })
2433
2572
  );
2434
2573
  }
2435
2574
  return resolve3(root.stdout.trim());
2436
2575
  }
2437
2576
  function countLines(text) {
2438
- return text.split("\n").filter((line) => line.trim() !== "").length;
2577
+ return text.split("\n").filter((line2) => line2.trim() !== "").length;
2439
2578
  }
2440
2579
  async function inspectWorktree(session) {
2441
2580
  const status = await git(["status", "--porcelain"], session.path);
@@ -2447,16 +2586,16 @@ async function inspectWorktree(session) {
2447
2586
  };
2448
2587
  }
2449
2588
  function worktreeKeepReason(state) {
2450
- if (state.dirty === null || state.ahead === null) return t16("worktree.keep_unknown");
2451
- if (state.dirty > 0) return t16("worktree.keep_dirty", { count: state.dirty });
2452
- 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 });
2453
2592
  return null;
2454
2593
  }
2455
2594
  function worktreeBanner(session) {
2456
- const dir = t16("worktree.banner_dir", { path: session.path });
2457
- 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 });
2458
2597
  return `
2459
- ${t16("worktree.banner")}
2598
+ ${t17("worktree.banner")}
2460
2599
  ${dir}
2461
2600
  ${branch}
2462
2601
  `;
@@ -2468,23 +2607,23 @@ async function finishWorktree(session, opts) {
2468
2607
  if (forced !== null) {
2469
2608
  print(
2470
2609
  `
2471
- ${t16("worktree.kept_forced", { reason: forced })}
2610
+ ${t17("worktree.kept_forced", { reason: forced })}
2472
2611
  ${session.path}
2473
- ${t16("worktree.banner_branch", { branch: session.branch })}`
2612
+ ${t17("worktree.banner_branch", { branch: session.branch })}`
2474
2613
  );
2475
2614
  return;
2476
2615
  }
2477
2616
  const remove = opts.interactive ? await (opts.ask ?? askRemove)(session) : false;
2478
2617
  if (!remove) {
2479
2618
  print(`
2480
- ${t16("worktree.kept", { path: session.path, branch: session.branch })}`);
2619
+ ${t17("worktree.kept", { path: session.path, branch: session.branch })}`);
2481
2620
  return;
2482
2621
  }
2483
2622
  const failure = await removeWorktree(session);
2484
2623
  print(
2485
2624
  failure === null ? `
2486
- ${t16("worktree.removed", { path: session.path, branch: session.branch })}` : `
2487
- ${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 })}
2488
2627
  ${failure}`
2489
2628
  );
2490
2629
  }
@@ -2492,7 +2631,7 @@ async function removeWorktree(session) {
2492
2631
  const removed = await git(["worktree", "remove", session.path], session.repoRoot);
2493
2632
  if (!removed.ok) return firstLine(removed.stderr);
2494
2633
  const branch = await git(["branch", "-D", session.branch], session.repoRoot);
2495
- return branch.ok ? null : t16("worktree.branch_remove_failed", {
2634
+ return branch.ok ? null : t17("worktree.branch_remove_failed", {
2496
2635
  branch: session.branch,
2497
2636
  why: firstLine(branch.stderr)
2498
2637
  });
@@ -2501,7 +2640,7 @@ async function askRemove(session) {
2501
2640
  const { confirm } = await import("@inquirer/prompts");
2502
2641
  try {
2503
2642
  return await confirm({
2504
- message: t16("worktree.ask_remove", { path: session.path }),
2643
+ message: t17("worktree.ask_remove", { path: session.path }),
2505
2644
  default: false
2506
2645
  });
2507
2646
  } catch {
@@ -2510,7 +2649,7 @@ async function askRemove(session) {
2510
2649
  }
2511
2650
  // src/commands/run-once.ts
2512
2651
  import { formatUsd, imageFromPath, OPERATION_TYPES as OPERATION_TYPES2 } from "@epoch-agent/core";
2513
- import { t as t22 } from "@epoch-agent/infra";
2652
+ import { t as t23 } from "@epoch-agent/infra";
2514
2653
  import {
2515
2654
  promptTokens
2516
2655
  } from "@epoch-agent/protocol";
@@ -2519,38 +2658,38 @@ import { buildRuntime as buildRuntime2, listBackgroundTasks } from "@epoch-agent
2519
2658
  import {
2520
2659
  isNonInteractive as isNonInteractive3
2521
2660
  } from "@epoch-agent/core";
2522
- import { t as t17 } from "@epoch-agent/infra";
2661
+ import { t as t18 } from "@epoch-agent/infra";
2523
2662
  function typeLabel(type) {
2524
2663
  switch (type) {
2525
2664
  case "file_read":
2526
- return t17("tui.approval.type_file_read");
2665
+ return t18("tui.approval.type_file_read");
2527
2666
  case "file_write":
2528
- return t17("tui.approval.type_file_write");
2667
+ return t18("tui.approval.type_file_write");
2529
2668
  case "command":
2530
- return t17("tui.approval.type_command");
2669
+ return t18("tui.approval.type_command");
2531
2670
  case "network":
2532
- return t17("tui.approval.type_network");
2671
+ return t18("tui.approval.type_network");
2533
2672
  case "code_exec":
2534
- return t17("tui.approval.type_code_exec");
2673
+ return t18("tui.approval.type_code_exec");
2535
2674
  }
2536
2675
  }
2537
2676
  function formatApprovalRequest(req) {
2538
2677
  if (req.plan) {
2539
2678
  return [
2540
- t17("approval.plan_head"),
2541
- t17("approval.plan_previous_level", { level: req.plan.previousLevel }),
2679
+ t18("approval.plan_head"),
2680
+ t18("approval.plan_previous_level", { level: req.plan.previousLevel }),
2542
2681
  "",
2543
2682
  ...req.plan.markdown.split("\n").map((l) => ` ${l}`)
2544
2683
  ];
2545
2684
  }
2546
2685
  const lines = [
2547
- t17("approval.asks", { tool: req.toolName, what: typeLabel(req.type) }),
2548
- 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") })
2549
2688
  ];
2550
2689
  if (req.detail && req.detail !== req.target) {
2551
- lines.push(t17("approval.detail", { detail: req.detail.slice(0, 300) }));
2690
+ lines.push(t18("approval.detail", { detail: req.detail.slice(0, 300) }));
2552
2691
  }
2553
- if (req.reason) lines.push(t17("approval.reason", { reason: req.reason }));
2692
+ if (req.reason) lines.push(t18("approval.reason", { reason: req.reason }));
2554
2693
  return lines;
2555
2694
  }
2556
2695
  function createInteractiveApproval(opts = {}) {
@@ -2558,27 +2697,27 @@ function createInteractiveApproval(opts = {}) {
2558
2697
  return async (req) => {
2559
2698
  if (!interactive()) {
2560
2699
  if (opts.permission?.()?.isPreauthorized(req.toolName, req.type)) {
2561
- 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 }));
2562
2701
  return "allow-once";
2563
2702
  }
2564
2703
  console.error(
2565
- `${t17("approval.headless_denied", {
2704
+ `${t18("approval.headless_denied", {
2566
2705
  tool: req.toolName,
2567
2706
  target: req.target
2568
2707
  })}
2569
- ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
2708
+ ${t18("approval.headless_denied_hint", { tool: req.toolName })}`
2570
2709
  );
2571
2710
  return "deny";
2572
2711
  }
2573
2712
  console.log("\n" + formatApprovalRequest(req).join("\n"));
2574
2713
  if (req.plan) return await askPlan(req.plan);
2575
2714
  if (req.rememberable === false) {
2576
- console.log(t17("approval.not_rememberable"));
2715
+ console.log(t18("approval.not_rememberable"));
2577
2716
  }
2578
2717
  const { select: select2 } = await import("@inquirer/prompts");
2579
2718
  try {
2580
2719
  return await select2({
2581
- message: t17("approval.ask"),
2720
+ message: t18("approval.ask"),
2582
2721
  choices: approvalChoices(req),
2583
2722
  default: "allow-once"
2584
2723
  });
@@ -2589,12 +2728,12 @@ ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
2589
2728
  }
2590
2729
  function approvalChoices(req) {
2591
2730
  return [
2592
- { name: t17("tui.approval.allow_once"), value: "allow-once" },
2731
+ { name: t18("tui.approval.allow_once"), value: "allow-once" },
2593
2732
  ...req.rememberable === false ? [] : [
2594
- { name: t17("tui.approval.allow_session"), value: "allow-session" },
2595
- { 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" }
2596
2735
  ],
2597
- { name: t17("tui.approval.deny"), value: "deny" }
2736
+ { name: t18("tui.approval.deny"), value: "deny" }
2598
2737
  ];
2599
2738
  }
2600
2739
  async function askPlan(proposal) {
@@ -2602,21 +2741,21 @@ async function askPlan(proposal) {
2602
2741
  const choices3 = [
2603
2742
  ...proposal.canExecute ? [
2604
2743
  {
2605
- name: t17("approval.plan_execute_back", {
2606
- label: t17("approval.plan_execute"),
2744
+ name: t18("approval.plan_execute_back", {
2745
+ label: t18("approval.plan_execute"),
2607
2746
  level: proposal.previousLevel
2608
2747
  }),
2609
2748
  value: "plan-execute"
2610
2749
  }
2611
2750
  ] : [],
2612
- { name: t17("approval.plan_readonly"), value: "plan-readonly" },
2613
- { name: t17("approval.plan_revise"), value: "plan-revise" },
2614
- { 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" }
2615
2754
  ];
2616
2755
  try {
2617
- const outcome = await select2({ message: t17("approval.plan_ask"), choices: choices3 });
2756
+ const outcome = await select2({ message: t18("approval.plan_ask"), choices: choices3 });
2618
2757
  if (outcome !== "plan-revise") return outcome;
2619
- const note = (await input2({ message: t17("approval.plan_revise_ask") })).trim();
2758
+ const note = (await input2({ message: t18("approval.plan_revise_ask") })).trim();
2620
2759
  return note ? { outcome, note } : outcome;
2621
2760
  } catch {
2622
2761
  return "deny";
@@ -2629,7 +2768,7 @@ import {
2629
2768
  matchPreauthorization,
2630
2769
  mergeHeadlessPolicy
2631
2770
  } from "@epoch-agent/core";
2632
- 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";
2633
2772
  import { APPROVAL_OUTCOMES as APPROVAL_OUTCOMES2, isApprovalOutcome as isApprovalOutcome2 } from "@epoch-agent/protocol";
2634
2773
  var APPROVER_TIMEOUT_MS = 6e4;
2635
2774
  var MAX_STDOUT_BYTES = 64 * 1024;
@@ -2639,22 +2778,22 @@ function clip(s) {
2639
2778
  }
2640
2779
  function parseApproverVerdict(stdout) {
2641
2780
  const text = stdout.trim();
2642
- if (!text) return { ok: false, why: t18("approver.no_output") };
2781
+ if (!text) return { ok: false, why: t19("approver.no_output") };
2643
2782
  let raw;
2644
2783
  try {
2645
2784
  raw = JSON.parse(text);
2646
2785
  } catch {
2647
- return { ok: false, why: t18("approver.not_json", { text: clip(text) }) };
2786
+ return { ok: false, why: t19("approver.not_json", { text: clip(text) }) };
2648
2787
  }
2649
2788
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
2650
- return { ok: false, why: t18("approver.not_object", { text: clip(text) }) };
2789
+ return { ok: false, why: t19("approver.not_object", { text: clip(text) }) };
2651
2790
  }
2652
2791
  const rec = raw;
2653
2792
  const outcome = rec["outcome"];
2654
2793
  if (typeof outcome !== "string" || !isApprovalOutcome2(outcome)) {
2655
2794
  return {
2656
2795
  ok: false,
2657
- why: t18("approver.bad_outcome", {
2796
+ why: t19("approver.bad_outcome", {
2658
2797
  value: clip(String(outcome)),
2659
2798
  choices: APPROVAL_OUTCOMES2.join(" / ")
2660
2799
  })
@@ -2689,12 +2828,12 @@ function askExternalApprover(program2, payload, opts = {}) {
2689
2828
  ...opts.cwd ? { cwd: opts.cwd } : {},
2690
2829
  stdio: ["pipe", "pipe", "inherit"]
2691
2830
  }),
2692
- (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 }) })
2693
2832
  );
2694
2833
  if (!child) return;
2695
2834
  const timer = setTimeout(() => {
2696
2835
  child.kill("SIGKILL");
2697
- settle({ ok: false, why: t18("approver.timeout", { ms: timeoutMs }) });
2836
+ settle({ ok: false, why: t19("approver.timeout", { ms: timeoutMs }) });
2698
2837
  }, timeoutMs);
2699
2838
  const done = (v) => {
2700
2839
  clearTimeout(timer);
@@ -2706,16 +2845,16 @@ function askExternalApprover(program2, payload, opts = {}) {
2706
2845
  out2 += decoder.write(d);
2707
2846
  if (out2.length > MAX_STDOUT_BYTES) {
2708
2847
  child.kill("SIGKILL");
2709
- 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 }) });
2710
2849
  }
2711
2850
  });
2712
2851
  child.on("error", (err2) => {
2713
- done({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) });
2852
+ done({ ok: false, why: t19("approver.spawn_failed", { message: err2.message }) });
2714
2853
  });
2715
2854
  child.on("close", (code) => {
2716
2855
  out2 += decoder?.end() ?? "";
2717
2856
  if (code !== 0) {
2718
- done({ ok: false, why: t18("approver.bad_exit", { code: code ?? -1 }) });
2857
+ done({ ok: false, why: t19("approver.bad_exit", { code: code ?? -1 }) });
2719
2858
  return;
2720
2859
  }
2721
2860
  done(parseApproverVerdict(out2));
@@ -2749,7 +2888,7 @@ function createExternalApproval(opts) {
2749
2888
  const hit = req.plan ? null : opts.preauth?.(req) ?? null;
2750
2889
  if (hit) {
2751
2890
  write(
2752
- `${t18("approver.audit_preauth", {
2891
+ `${t19("approver.audit_preauth", {
2753
2892
  tool: req.toolName,
2754
2893
  target: req.target,
2755
2894
  reason: hit
@@ -2761,7 +2900,7 @@ function createExternalApproval(opts) {
2761
2900
  const verdict = await ask(payloadOf(req, cwd, opts.sessionId?.()));
2762
2901
  if (!verdict.ok) {
2763
2902
  write(
2764
- `${t18("approver.audit_rejected", {
2903
+ `${t19("approver.audit_rejected", {
2765
2904
  tool: req.toolName,
2766
2905
  target: req.target,
2767
2906
  why: verdict.why
@@ -2773,7 +2912,7 @@ function createExternalApproval(opts) {
2773
2912
  const { outcome } = verdict.answer;
2774
2913
  const vars = { tool: req.toolName, target: req.target, outcome };
2775
2914
  write(
2776
- `${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)}
2777
2916
  `
2778
2917
  );
2779
2918
  return verdict.answer;
@@ -2781,26 +2920,26 @@ function createExternalApproval(opts) {
2781
2920
  }
2782
2921
  // src/headless/tasks.ts
2783
2922
  import { describeBackgroundTask } from "@epoch-agent/core";
2784
- import { t as t19 } from "@epoch-agent/infra";
2923
+ import { t as t20 } from "@epoch-agent/infra";
2785
2924
  function backgroundTaskSummary(all) {
2786
- const tasks = all.filter((t40) => t40.kind === "command");
2925
+ const tasks = all.filter((t41) => t41.kind === "command");
2787
2926
  if (tasks.length === 0) return "";
2788
- const running = tasks.filter((t40) => t40.status === "running").length;
2789
- const head = running > 0 ? t19("background_tasks.head_running", { total: tasks.length, running }) : t19("background_tasks.head_done", { total: tasks.length });
2790
- 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");
2791
2930
  }
2792
2931
  // src/import-prompt.ts
2793
2932
  import {
2794
2933
  createImportGate,
2795
2934
  ImportTrustStore,
2796
2935
  isNonInteractive as isNonInteractive6,
2797
- loadConfig as loadConfig4,
2936
+ loadConfig as loadConfig5,
2798
2937
  resolveProjectRoot as resolveProjectRoot2,
2799
2938
  scanInstructions,
2800
2939
  setImportGate,
2801
2940
  TrustManager as TrustManager2
2802
2941
  } from "@epoch-agent/core";
2803
- 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";
2804
2943
  // src/trust-prompt.ts
2805
2944
  import {
2806
2945
  findProjectInstructions,
@@ -2808,11 +2947,11 @@ import {
2808
2947
  hasReadTierContent,
2809
2948
  inventoryProjectExtensions,
2810
2949
  isNonInteractive as isNonInteractive5,
2811
- loadConfig as loadConfig3,
2950
+ loadConfig as loadConfig4,
2812
2951
  resolveProjectRoot,
2813
2952
  TrustManager
2814
2953
  } from "@epoch-agent/core";
2815
- import { t as t20, trustPath } from "@epoch-agent/infra";
2954
+ import { t as t21, trustPath } from "@epoch-agent/infra";
2816
2955
  function trustPromptTarget(deps) {
2817
2956
  if (!deps.gateEnabled) return null;
2818
2957
  if (!deps.interactive) return null;
@@ -2832,56 +2971,56 @@ function trustPromptTarget(deps) {
2832
2971
  function applyTrustChoice(store, root, choice) {
2833
2972
  if (choice.kind === "trust") {
2834
2973
  store.record(root, "trusted", choice.scope, { exec: choice.exec });
2835
- const suffix = choice.scope === "directory-tree" ? t20("trust_prompt.granted_tree_suffix") : "";
2836
- 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 });
2837
2976
  }
2838
2977
  if (choice.kind === "never") {
2839
2978
  store.record(root, "untrusted", "directory");
2840
- return t20("trust_prompt.denied", { root });
2979
+ return t21("trust_prompt.denied", { root });
2841
2980
  }
2842
- return t20("trust_prompt.skipped");
2981
+ return t21("trust_prompt.skipped");
2843
2982
  }
2844
2983
  function trustPromptMessage(target) {
2845
2984
  const lines = [
2846
2985
  target.instructionsPath ? `
2847
- ${t20("trust_prompt.head", { path: target.instructionsPath })}` : `
2848
- ${t20("trust_prompt.head_dir", { dir: target.root })}`,
2849
- ` ${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")}`
2850
2989
  ];
2851
2990
  const inv = target.inventory;
2852
2991
  const read = [];
2853
2992
  if (inv.instructionFiles.length > 0) {
2854
- read.push(t20("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
2993
+ read.push(t21("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
2855
2994
  }
2856
- if (inv.skills > 0) read.push(t20("trust_prompt.item_skills", { n: inv.skills }));
2857
- if (inv.roles > 0) read.push(t20("trust_prompt.item_roles", { n: inv.roles }));
2858
- if (inv.commands > 0) read.push(t20("trust_prompt.item_commands", { n: inv.commands }));
2859
- const sep = t20("trust_prompt.item_sep");
2860
- 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)}`);
2861
3000
  const exec = [];
2862
3001
  if (inv.hookFiles.length > 0) {
2863
- exec.push(t20("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
3002
+ exec.push(t21("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
2864
3003
  }
2865
- 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 }));
2866
3005
  if (inv.settingsFiles.length > 0) {
2867
- exec.push(t20("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
3006
+ exec.push(t21("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
2868
3007
  }
2869
- 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)}`);
2870
3009
  lines.push("");
2871
3010
  return lines.join("\n");
2872
3011
  }
2873
3012
  function choices() {
2874
3013
  return [
2875
- { name: t20("trust_prompt.choice_skip"), value: { kind: "skip" } },
3014
+ { name: t21("trust_prompt.choice_skip"), value: { kind: "skip" } },
2876
3015
  {
2877
- name: t20("trust_prompt.choice_dir"),
3016
+ name: t21("trust_prompt.choice_dir"),
2878
3017
  value: { kind: "trust", scope: "directory", exec: false }
2879
3018
  },
2880
3019
  {
2881
- name: t20("trust_prompt.choice_tree"),
3020
+ name: t21("trust_prompt.choice_tree"),
2882
3021
  value: { kind: "trust", scope: "directory-tree", exec: false }
2883
3022
  },
2884
- { name: t20("trust_prompt.choice_never"), value: { kind: "never" } }
3023
+ { name: t21("trust_prompt.choice_never"), value: { kind: "never" } }
2885
3024
  ];
2886
3025
  }
2887
3026
  function restoreStdinDefault() {
@@ -2890,7 +3029,7 @@ function restoreStdinDefault() {
2890
3029
  stdin.resume();
2891
3030
  }
2892
3031
  async function maybePromptForTrust(opts = {}) {
2893
- const config = opts.config ?? loadConfig3();
3032
+ const config = opts.config ?? loadConfig4();
2894
3033
  const store = opts.store ?? new TrustManager(trustPath(config.homeDir));
2895
3034
  const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
2896
3035
  const target = trustPromptTarget({
@@ -2916,7 +3055,7 @@ async function maybePromptForTrust(opts = {}) {
2916
3055
  print(applyTrustChoice(store, target.root, choice));
2917
3056
  } catch (err2) {
2918
3057
  print(
2919
- t20("trust_prompt.write_failed", {
3058
+ t21("trust_prompt.write_failed", {
2920
3059
  message: err2 instanceof Error ? err2.message : String(err2)
2921
3060
  })
2922
3061
  );
@@ -2927,11 +3066,11 @@ async function askExecChoice(_target) {
2927
3066
  const { select: select2 } = await import("@inquirer/prompts");
2928
3067
  try {
2929
3068
  const options = [
2930
- { name: t20("trust_prompt.exec_choice_no"), value: false },
2931
- { 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 }
2932
3071
  ];
2933
3072
  return await select2({
2934
- message: t20("trust_prompt.exec_ask"),
3073
+ message: t21("trust_prompt.exec_ask"),
2935
3074
  choices: options,
2936
3075
  default: options[0]?.value
2937
3076
  });
@@ -2944,7 +3083,7 @@ async function askTrustChoice(_target) {
2944
3083
  try {
2945
3084
  const options = choices();
2946
3085
  return await select2({
2947
- message: t20("trust_prompt.ask"),
3086
+ message: t21("trust_prompt.ask"),
2948
3087
  choices: [...options],
2949
3088
  default: options[0]?.value
2950
3089
  });
@@ -2977,38 +3116,38 @@ function externalImportTargets(deps) {
2977
3116
  function importPromptMessage(target) {
2978
3117
  return [
2979
3118
  `
2980
- ${t21("import_prompt.head", { from: target.from })}`,
3119
+ ${t22("import_prompt.head", { from: target.from })}`,
2981
3120
  ` ${target.path}`,
2982
- ` ${t21("import_prompt.spec", { spec: target.spec })}`,
2983
- ` ${t21("import_prompt.why")}`,
3121
+ ` ${t22("import_prompt.spec", { spec: target.spec })}`,
3122
+ ` ${t22("import_prompt.why")}`,
2984
3123
  ""
2985
3124
  ].join("\n");
2986
3125
  }
2987
3126
  function applyImportChoice(store, target, choice) {
2988
3127
  if (choice.kind === "once") {
2989
3128
  store.allowOnce(target.path);
2990
- return t21("import_prompt.once", { path: target.path });
3129
+ return t22("import_prompt.once", { path: target.path });
2991
3130
  }
2992
3131
  if (choice.kind === "remember") {
2993
3132
  store.remember(target.path);
2994
- return t21("import_prompt.remembered", { path: target.path });
3133
+ return t22("import_prompt.remembered", { path: target.path });
2995
3134
  }
2996
3135
  if (choice.kind === "never") {
2997
3136
  store.denyAll();
2998
- return t21("import_prompt.never");
3137
+ return t22("import_prompt.never");
2999
3138
  }
3000
- return t21("import_prompt.skipped", { path: target.path });
3139
+ return t22("import_prompt.skipped", { path: target.path });
3001
3140
  }
3002
3141
  function choices2() {
3003
3142
  return [
3004
- { name: t21("import_prompt.choice_skip"), value: { kind: "skip" } },
3005
- { name: t21("import_prompt.choice_once"), value: { kind: "once" } },
3006
- { name: t21("import_prompt.choice_remember"), value: { kind: "remember" } },
3007
- { 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" } }
3008
3147
  ];
3009
3148
  }
3010
3149
  async function maybePromptForExternalImports(opts = {}) {
3011
- const config = opts.config ?? loadConfig4();
3150
+ const config = opts.config ?? loadConfig5();
3012
3151
  const store = opts.store ?? new ImportTrustStore(trustedImportsPath(config.homeDir));
3013
3152
  const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
3014
3153
  const targets = externalImportTargets({
@@ -3031,7 +3170,7 @@ async function maybePromptForExternalImports(opts = {}) {
3031
3170
  print(applyImportChoice(store, target, choice));
3032
3171
  } catch (err2) {
3033
3172
  print(
3034
- t21("import_prompt.write_failed", {
3173
+ t22("import_prompt.write_failed", {
3035
3174
  message: err2 instanceof Error ? err2.message : String(err2)
3036
3175
  })
3037
3176
  );
@@ -3049,7 +3188,7 @@ async function askImportChoice(_target) {
3049
3188
  try {
3050
3189
  const options = choices2();
3051
3190
  return await select2({
3052
- message: t21("import_prompt.ask"),
3191
+ message: t22("import_prompt.ask"),
3053
3192
  choices: [...options],
3054
3193
  default: options[0]?.value
3055
3194
  });
@@ -3088,8 +3227,8 @@ function createStreamWriter(enabled, sink) {
3088
3227
  err2(body + (endsNl ? "\n" : ""));
3089
3228
  midLive = !endsNl;
3090
3229
  },
3091
- notice(line) {
3092
- if (!enabled || !line) return;
3230
+ notice(line2) {
3231
+ if (!enabled || !line2) return;
3093
3232
  if (midText) {
3094
3233
  out2("\n");
3095
3234
  midText = false;
@@ -3098,7 +3237,7 @@ function createStreamWriter(enabled, sink) {
3098
3237
  err2("\n");
3099
3238
  midLive = false;
3100
3239
  }
3101
- err2(line.endsWith("\n") ? line : line + "\n");
3240
+ err2(line2.endsWith("\n") ? line2 : line2 + "\n");
3102
3241
  },
3103
3242
  end() {
3104
3243
  if (!enabled) return;
@@ -3138,7 +3277,7 @@ function composeContent(query, images) {
3138
3277
  throw new CliError(
3139
3278
  err2 instanceof Error ? err2.message : String(err2),
3140
3279
  EXIT_CODES.FAILURE,
3141
- t22("run_once.err_image")
3280
+ t23("run_once.err_image")
3142
3281
  );
3143
3282
  }
3144
3283
  }
@@ -3147,9 +3286,9 @@ async function runOnce(query, opts, resumeId) {
3147
3286
  const { policy: headless, invalid } = parseHeadlessFlags(opts);
3148
3287
  if (invalid.length > 0) {
3149
3288
  throw new CliError(
3150
- t22("run_once.err_bad_operation", { values: invalid.join(", ") }),
3289
+ t23("run_once.err_bad_operation", { values: invalid.join(", ") }),
3151
3290
  EXIT_CODES.FAILURE,
3152
- t22("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES2.join(" / ") })
3291
+ t23("run_once.err_bad_operation_hint", { choices: OPERATION_TYPES2.join(" / ") })
3153
3292
  );
3154
3293
  }
3155
3294
  const format = resolveOutputFormat(opts);
@@ -3179,10 +3318,10 @@ async function runOnce(query, opts, resumeId) {
3179
3318
  const detail = runtime.diagnostics.join("\n ");
3180
3319
  await runtime.dispose();
3181
3320
  throw new CliError(
3182
- t22("run_once.err_no_provider"),
3321
+ t23("run_once.err_no_provider"),
3183
3322
  EXIT_CODES.FAILURE,
3184
- detail ? `${t22("run_once.err_no_provider_diag")}
3185
- ${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")
3186
3325
  );
3187
3326
  }
3188
3327
  installShutdown(runtime);
@@ -3191,7 +3330,7 @@ async function runOnce(query, opts, resumeId) {
3191
3330
  if (resumeId) {
3192
3331
  const restored = runtime.session.getHistory().length;
3193
3332
  process.stderr.write(
3194
- `${t22("run_once.resumed", {
3333
+ `${t23("run_once.resumed", {
3195
3334
  id: resumeId.slice(0, SHORT_ID_LEN),
3196
3335
  count: restored
3197
3336
  })}
@@ -3267,7 +3406,7 @@ function collect2(out2, ev, w) {
3267
3406
  } else if (ev.type === "notice") {
3268
3407
  w.notice(ev.text);
3269
3408
  } else if (ev.type === "error") {
3270
- out2.text = t22("run_once.error_prefix", { message: ev.message });
3409
+ out2.text = t23("run_once.error_prefix", { message: ev.message });
3271
3410
  w.notice(out2.text);
3272
3411
  process.exitCode = EXIT_CODES.FAILURE;
3273
3412
  } else if (ev.type === "finish") {
@@ -3303,14 +3442,14 @@ function emitOutcome(out2, opts, format, emitter, tasks = []) {
3303
3442
  return;
3304
3443
  }
3305
3444
  if (out2.reasoning) {
3306
- process.stderr.write(`${t22("run_once.reasoning_head")}
3445
+ process.stderr.write(`${t23("run_once.reasoning_head")}
3307
3446
  ${out2.reasoning}
3308
3447
 
3309
3448
  `);
3310
3449
  }
3311
3450
  if (opts.stream === false && out2.text) process.stdout.write(out2.text + "\n");
3312
3451
  if (out2.aborted) process.stderr.write(`
3313
- ${t22("run_once.aborted")}
3452
+ ${t23("run_once.aborted")}
3314
3453
  `);
3315
3454
  if (taskLines) process.stderr.write(taskLines + "\n");
3316
3455
  const summary = formatSummary(out2.usage, out2.budgetExceeded);
@@ -3327,10 +3466,10 @@ function noteworthy(diagnostics, verbose) {
3327
3466
  }
3328
3467
  function formatSummary(usage, budgetExceeded) {
3329
3468
  if (!usage) return "";
3330
- 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 }) : "";
3331
3470
  const tokens = `${promptTokens(usage)} in${cached} / ${usage.outputTokens} out`;
3332
- const cost = usage.costUsd === void 0 ? t22("run_once.cost_unknown") : formatUsd(usage.costUsd);
3333
- 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") : "";
3334
3473
  return `\u2500 ${tokens} \xB7 ${cost}${stopped}`;
3335
3474
  }
3336
3475
  function reportHeadlessAudit(permission) {
@@ -3339,7 +3478,7 @@ function reportHeadlessAudit(permission) {
3339
3478
  for (const e of audit) {
3340
3479
  const vars = { tool: e.toolName, target: e.target, reason: e.reason };
3341
3480
  process.stderr.write(
3342
- `${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)}
3343
3482
  `
3344
3483
  );
3345
3484
  }
@@ -3348,8 +3487,8 @@ function reportHeadlessAudit(permission) {
3348
3487
  }
3349
3488
  }
3350
3489
  // src/commands/run-overrides.ts
3351
- import { isPermissionLevel as isPermissionLevel2, PERMISSION_LEVELS as PERMISSION_LEVELS2 } from "@epoch-agent/core";
3352
- 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";
3353
3492
  import { parseModelRef as parseModelRef2 } from "@epoch-agent/protocol";
3354
3493
  function applyRunFlags(opts) {
3355
3494
  applySettingsPath(opts.settings);
@@ -3365,23 +3504,24 @@ function applyOverrides(opts) {
3365
3504
  process.env.EPOCH_FALLBACK_MODEL = assertModelName(opts.fallbackModel, "--fallback-model");
3366
3505
  }
3367
3506
  if (opts.permission) {
3368
- if (!isPermissionLevel2(opts.permission)) {
3507
+ const level = resolvePermissionLevel2(opts.permission);
3508
+ if (!level) {
3369
3509
  throw new CliError(
3370
- t23("flags.permission_unknown", { value: opts.permission }),
3510
+ t24("flags.permission_unknown", { value: opts.permission }),
3371
3511
  1,
3372
- t23("flags.choices", { choices: PERMISSION_LEVELS2.join(", ") })
3512
+ t24("flags.choices", { choices: PERMISSION_LEVELS2.join(", ") })
3373
3513
  );
3374
3514
  }
3375
- process.env.EPOCH_PERMISSION = opts.permission;
3515
+ process.env.EPOCH_PERMISSION = level;
3376
3516
  }
3377
3517
  }
3378
3518
  function assertModelName(value, flag) {
3379
3519
  const spec = value.trim();
3380
3520
  if (parseModelRef2(spec)) return spec;
3381
3521
  throw new CliError(
3382
- t23("flags.model_not_a_name", { flag, value }),
3522
+ t24("flags.model_not_a_name", { flag, value }),
3383
3523
  1,
3384
- t23("flags.model_not_a_name_hint", { value: spec })
3524
+ t24("flags.model_not_a_name_hint", { value: spec })
3385
3525
  );
3386
3526
  }
3387
3527
  // src/commands/sessions.ts
@@ -3392,56 +3532,56 @@ import {
3392
3532
  resolveProjectRoot as resolveProjectRoot3,
3393
3533
  SessionManager
3394
3534
  } from "@epoch-agent/core";
3395
- import { dbPath, t as t24, uiDateLocale as uiDateLocale2 } from "@epoch-agent/infra";
3396
- 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");
3397
3537
  var SHORT_ID_LEN2 = 8;
3398
3538
  var PICK_LIMIT = 20;
3399
3539
  var DEFAULT_RETENTION_DAYS = 90;
3400
3540
  var VACUUM_MIN_FREELIST_RATIO = 0.25;
3401
3541
  function whenOf(startedAt) {
3402
- return startedAt ? new Date(startedAt).toLocaleString(uiDateLocale2()) : t24("sessions.when_unknown");
3542
+ return startedAt ? new Date(startedAt).toLocaleString(uiDateLocale2()) : t25("sessions.when_unknown");
3403
3543
  }
3404
3544
  function titleOf(s) {
3405
- return s.title || s.preview || t24("sessions.untitled");
3545
+ return s.title || s.preview || t25("sessions.untitled");
3406
3546
  }
3407
3547
  function registerSessionsCommand(program2) {
3408
- const cmd = program2.command("sessions").alias("session").description(t24("sessions.cmd_root"));
3409
- 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) => {
3410
3550
  withSessions((sm) => {
3411
3551
  const r = sm.list({
3412
3552
  limit: parseInt(opts.limit, 10),
3413
3553
  ...opts.archived ? { archived: true } : {}
3414
3554
  });
3415
3555
  if (r.sessions.length === 0) {
3416
- log7(` ${t24(opts.archived ? "sessions.list_empty_archived" : "sessions.list_empty")}`);
3556
+ log8(` ${t25(opts.archived ? "sessions.list_empty_archived" : "sessions.list_empty")}`);
3417
3557
  return;
3418
3558
  }
3419
3559
  for (const s of r.sessions) {
3420
- 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)}`);
3421
3561
  }
3422
3562
  });
3423
3563
  });
3424
- 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) => {
3425
3565
  const resolved = resolveSessionId(id, { includeArchived: true });
3426
3566
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3427
3567
  withSessions((sm) => sm.archive(resolved.id));
3428
- 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) }));
3429
3569
  });
3430
- 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) => {
3431
3571
  const resolved = resolveSessionId(id, { includeArchived: true });
3432
3572
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3433
3573
  withSessions((sm) => sm.unarchive(resolved.id));
3434
- 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) }));
3435
3575
  });
3436
- 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) => {
3437
3577
  const resolved = resolveSessionId(id, { includeArchived: true });
3438
3578
  if (!resolved.ok) throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3439
3579
  const format = opts.format === "md" ? "markdown" : opts.format === "json" ? "json" : null;
3440
3580
  if (format === null) {
3441
3581
  throw new CliError(
3442
- t24("sessions.err_format", { format: opts.format }),
3582
+ t25("sessions.err_format", { format: opts.format }),
3443
3583
  EXIT_CODES.FAILURE,
3444
- t24("sessions.err_format_hint")
3584
+ t25("sessions.err_format_hint")
3445
3585
  );
3446
3586
  }
3447
3587
  const raw = withSessions((sm) => sm.export(resolved.id, format));
@@ -3451,13 +3591,13 @@ function registerSessionsCommand(program2) {
3451
3591
  return;
3452
3592
  }
3453
3593
  writeFileSync2(file, body.endsWith("\n") ? body : body + "\n", "utf8");
3454
- log7(t24("sessions.export_ok", { file }));
3594
+ log8(t25("sessions.export_ok", { file }));
3455
3595
  });
3456
- 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(
3457
3597
  (opts) => {
3458
3598
  const days = Number(opts.olderThan);
3459
3599
  if (!Number.isFinite(days) || days <= 0) {
3460
- 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);
3461
3601
  }
3462
3602
  const olderThanMs = Date.now() - days * 24 * 60 * 60 * 1e3;
3463
3603
  const select2 = {
@@ -3467,7 +3607,7 @@ function registerSessionsCommand(program2) {
3467
3607
  };
3468
3608
  const sweepOrphans = () => {
3469
3609
  const swept = withSessions((sm) => sm.sweepOrphans({ olderThanMs, now: Date.now() }));
3470
- if (swept > 0) log7(t24("sessions.prune_swept", { count: swept, days }));
3610
+ if (swept > 0) log8(t25("sessions.prune_swept", { count: swept, days }));
3471
3611
  };
3472
3612
  const { victims, openCount } = withSessions((sm) => ({
3473
3613
  victims: sm.pruneCandidates(select2),
@@ -3478,52 +3618,52 @@ function registerSessionsCommand(program2) {
3478
3618
  }));
3479
3619
  const sweepNote = () => {
3480
3620
  if (openCount === 0) return;
3481
- log7(t24("sessions.prune_open_skipped", { count: openCount }));
3482
- 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 }));
3483
3623
  };
3484
3624
  if (victims.length === 0) {
3485
- log7(t24("sessions.prune_none", { days }));
3625
+ log8(t25("sessions.prune_none", { days }));
3486
3626
  sweepNote();
3487
3627
  if (opts.yes) sweepOrphans();
3488
3628
  return;
3489
3629
  }
3490
- log7(t24("sessions.prune_head"));
3630
+ log8(t25("sessions.prune_head"));
3491
3631
  for (const s of victims) {
3492
- 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)}`);
3493
3633
  }
3494
3634
  sweepNote();
3495
3635
  if (!opts.yes) {
3496
- log7(t24("sessions.prune_preview", { count: victims.length, days }));
3636
+ log8(t25("sessions.prune_preview", { count: victims.length, days }));
3497
3637
  return;
3498
3638
  }
3499
3639
  let removed = 0;
3500
3640
  withSessions((sm) => {
3501
3641
  for (const s of victims) if (sm.delete(s.id)) removed++;
3502
3642
  });
3503
- log7(t24("sessions.prune_done", { count: removed }));
3643
+ log8(t25("sessions.prune_done", { count: removed }));
3504
3644
  sweepOrphans();
3505
3645
  if (removed > 0) {
3506
3646
  const ratio = withSessions((sm) => sm.freelistRatio());
3507
3647
  if (ratio > VACUUM_MIN_FREELIST_RATIO) {
3508
3648
  const report = withSessions((sm) => sm.reclaimFts(true));
3509
- if (report.vacuumed) log7(t24("sessions.prune_vacuumed"));
3649
+ if (report.vacuumed) log8(t25("sessions.prune_vacuumed"));
3510
3650
  }
3511
3651
  }
3512
3652
  }
3513
3653
  );
3514
- 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) => {
3515
3655
  const resolved = resolveSessionId(id);
3516
3656
  if (!resolved.ok) {
3517
3657
  throw new CliError(resolved.error, EXIT_CODES.FAILURE);
3518
3658
  }
3519
- await runOnce(query || t24("sessions.default_query"), {}, resolved.id);
3659
+ await runOnce(query || t25("sessions.default_query"), {}, resolved.id);
3520
3660
  });
3521
3661
  }
3522
3662
  function resolveSessionId(input2, opts = {}) {
3523
3663
  return withSessions((sm) => {
3524
3664
  if (!input2) {
3525
3665
  const latest = sm.getLatest()?.meta.id;
3526
- 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") };
3527
3667
  }
3528
3668
  if (sm.get(input2)) return { ok: true, id: input2 };
3529
3669
  const pool = sm.list({ limit: 200 }).sessions;
@@ -3531,11 +3671,11 @@ function resolveSessionId(input2, opts = {}) {
3531
3671
  const candidates = all.filter((s) => s.id.startsWith(input2)).map((s) => s.id);
3532
3672
  if (candidates.length === 1) return { ok: true, id: candidates[0] };
3533
3673
  if (candidates.length === 0) {
3534
- return { ok: false, error: t24("sessions.err_not_found", { input: input2 }) };
3674
+ return { ok: false, error: t25("sessions.err_not_found", { input: input2 }) };
3535
3675
  }
3536
3676
  return {
3537
3677
  ok: false,
3538
- error: t24("sessions.err_ambiguous", { input: input2, count: candidates.length })
3678
+ error: t25("sessions.err_ambiguous", { input: input2, count: candidates.length })
3539
3679
  };
3540
3680
  });
3541
3681
  }
@@ -3546,9 +3686,9 @@ function latestSessionIdForProject(cwd = process.cwd()) {
3546
3686
  async function pickSessionId() {
3547
3687
  if (isNonInteractive7()) {
3548
3688
  throw new CliError(
3549
- t24("sessions.err_needs_id"),
3689
+ t25("sessions.err_needs_id"),
3550
3690
  EXIT_CODES.FAILURE,
3551
- t24("sessions.err_needs_id_hint")
3691
+ t25("sessions.err_needs_id_hint")
3552
3692
  );
3553
3693
  }
3554
3694
  const rows = withSessions(
@@ -3556,22 +3696,22 @@ async function pickSessionId() {
3556
3696
  id: s.id,
3557
3697
  title: titleOf(s),
3558
3698
  when: whenOf(s.startedAt),
3559
- where: s.cwd ?? t24("sessions.cwd_unrecorded"),
3699
+ where: s.cwd ?? t25("sessions.cwd_unrecorded"),
3560
3700
  messageCount: s.messageCount
3561
3701
  }))
3562
3702
  );
3563
3703
  if (rows.length === 0) {
3564
- log7(t24("sessions.pick_empty"));
3704
+ log8(t25("sessions.pick_empty"));
3565
3705
  return void 0;
3566
3706
  }
3567
3707
  const { select: select2 } = await import("@inquirer/prompts");
3568
3708
  try {
3569
3709
  return await select2({
3570
- message: t24("sessions.pick_prompt"),
3710
+ message: t25("sessions.pick_prompt"),
3571
3711
  choices: rows.map((r) => ({
3572
3712
  name: `${r.id.slice(0, SHORT_ID_LEN2)} ${r.when} ${r.title}`,
3573
3713
  value: r.id,
3574
- 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}`
3575
3715
  })),
3576
3716
  pageSize: 12
3577
3717
  });
@@ -3588,27 +3728,27 @@ function withSessions(fn) {
3588
3728
  }
3589
3729
  }
3590
3730
  // src/commands/run.ts
3591
- var log8 = (msg) => {
3731
+ var log9 = (msg) => {
3592
3732
  process.stdout.write(msg + "\n");
3593
3733
  };
3594
3734
  function registerRunCommand(program2) {
3595
- 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(
3596
3736
  "--allow-operation <type>",
3597
- t25("run.opt_allow_operation", { types: OPERATION_TYPES3.join(" / ") }),
3737
+ t26("run.opt_allow_operation", { types: OPERATION_TYPES3.join(" / ") }),
3598
3738
  collect,
3599
3739
  []
3600
- ).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(
3601
3741
  "--permission <level>",
3602
- t25("run.opt_permission", { levels: PERMISSION_LEVELS3.join(" / ") })
3603
- ).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(
3604
3744
  "--output-format <fmt>",
3605
- t25("run.opt_output_format", { formats: HEADLESS_OUTPUT_FORMATS2.join(" / ") })
3745
+ t26("run.opt_output_format", { formats: HEADLESS_OUTPUT_FORMATS2.join(" / ") })
3606
3746
  ).option(
3607
3747
  "--input-format <fmt>",
3608
- t25("run.opt_input_format", { formats: HEADLESS_INPUT_FORMATS2.join(" / ") })
3609
- ).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) => {
3610
3750
  if (opts.version === true) {
3611
- log8(describeVersion(selfPackage().name));
3751
+ log9(describeVersion(selfPackage().name));
3612
3752
  return;
3613
3753
  }
3614
3754
  applyRunFlags(opts);
@@ -3618,30 +3758,30 @@ function registerRunCommand(program2) {
3618
3758
  if (formats.input === "stream-json") {
3619
3759
  if (opts.continue === true || resumeArg.kind !== "off") {
3620
3760
  throw new CliError(
3621
- t25("run.conflict_resume"),
3761
+ t26("run.conflict_resume"),
3622
3762
  EXIT_CODES.FAILURE,
3623
- t25("run.conflict_resume_hint")
3763
+ t26("run.conflict_resume_hint")
3624
3764
  );
3625
3765
  }
3626
3766
  if (opts.worktree === true) {
3627
3767
  throw new CliError(
3628
- t25("run.conflict_worktree"),
3768
+ t26("run.conflict_worktree"),
3629
3769
  EXIT_CODES.FAILURE,
3630
- t25("run.conflict_worktree_hint")
3770
+ t26("run.conflict_worktree_hint")
3631
3771
  );
3632
3772
  }
3633
3773
  if (opts.permissionPromptTool !== void 0) {
3634
3774
  throw new CliError(
3635
- t25("run.conflict_prompt_tool"),
3775
+ t26("run.conflict_prompt_tool"),
3636
3776
  EXIT_CODES.FAILURE,
3637
- t25("run.conflict_prompt_tool_hint")
3777
+ t26("run.conflict_prompt_tool_hint")
3638
3778
  );
3639
3779
  }
3640
3780
  if (!hasUsableModel()) {
3641
3781
  throw new CliError(
3642
- t25("run.no_credentials_stream"),
3782
+ t26("run.no_credentials_stream"),
3643
3783
  EXIT_CODES.FAILURE,
3644
- t25("run.no_credentials_hint")
3784
+ t26("run.no_credentials_hint")
3645
3785
  );
3646
3786
  }
3647
3787
  process.exitCode = await runStreamJsonSession(opts);
@@ -3650,7 +3790,7 @@ function registerRunCommand(program2) {
3650
3790
  const carried = resumeArg.kind === "pick" ? resumeArg.query : void 0;
3651
3791
  const prompt = composePrompt(query ?? carried, await readStdin2());
3652
3792
  if (!hasUsableModel()) {
3653
- log8(t25("run.welcome"));
3793
+ log9(t26("run.welcome"));
3654
3794
  return;
3655
3795
  }
3656
3796
  const resumeId = await resolveResumeTarget(opts, resumeArg);
@@ -3658,9 +3798,9 @@ function registerRunCommand(program2) {
3658
3798
  if (!prompt && (opts.image ?? []).length === 0) {
3659
3799
  if (refuseEmptyQuery(isNonInteractive8(), formats.output)) {
3660
3800
  throw new CliError(
3661
- t25("run.no_query_noninteractive"),
3801
+ t26("run.no_query_noninteractive"),
3662
3802
  EXIT_CODES.FAILURE,
3663
- t25("run.no_query_hint")
3803
+ t26("run.no_query_hint")
3664
3804
  );
3665
3805
  }
3666
3806
  return launchTui(resumeId);
@@ -3685,7 +3825,7 @@ async function resolveResumeTarget(opts, resumeArg) {
3685
3825
  if (opts.continue === true) {
3686
3826
  const latest = latestSessionIdForProject();
3687
3827
  if (!latest) {
3688
- process.stderr.write(`${t25("run.no_history")}
3828
+ process.stderr.write(`${t26("run.no_history")}
3689
3829
  `);
3690
3830
  }
3691
3831
  return latest;
@@ -3696,7 +3836,7 @@ async function resolveResumeTarget(opts, resumeArg) {
3696
3836
  throw new CliError(
3697
3837
  resolved.error,
3698
3838
  EXIT_CODES.FAILURE,
3699
- t25("run.resume_not_id_hint")
3839
+ t26("run.resume_not_id_hint")
3700
3840
  );
3701
3841
  }
3702
3842
  return resolved.id;
@@ -3715,7 +3855,7 @@ function resolveTuiEntry(baseDir, exists = existsSync6) {
3715
3855
  async function launchTui(resumeId) {
3716
3856
  const target = resolveTuiEntry(dirname4(fileURLToPath3(import.meta.url)));
3717
3857
  if (!target) {
3718
- process.stderr.write(`${t25("run.tui_entry_missing")}
3858
+ process.stderr.write(`${t26("run.tui_entry_missing")}
3719
3859
  `);
3720
3860
  process.exitCode = EXIT_CODES.FAILURE;
3721
3861
  return;
@@ -3726,7 +3866,7 @@ async function launchTui(resumeId) {
3726
3866
  const { spawn: spawn3 } = await import("child_process");
3727
3867
  await new Promise((done) => {
3728
3868
  const failToStart = (err2) => {
3729
- process.stderr.write(`${t25("run.tui_spawn_failed", { message: err2.message })}
3869
+ process.stderr.write(`${t26("run.tui_spawn_failed", { message: err2.message })}
3730
3870
  `);
3731
3871
  process.exitCode = EXIT_CODES.FAILURE;
3732
3872
  done();
@@ -3747,25 +3887,27 @@ async function launchTui(resumeId) {
3747
3887
  });
3748
3888
  }
3749
3889
  // src/commands/schedule.ts
3750
- import { t as t33 } from "@epoch-agent/infra";
3890
+ import { t as t34 } from "@epoch-agent/infra";
3751
3891
  // src/schedule/add.ts
3752
3892
  import {
3753
3893
  isValidInterval,
3754
3894
  SCHEDULE_DEFAULTS,
3755
3895
  validateSchedule
3756
3896
  } from "@epoch-agent/core";
3757
- import { automationWorkDir, t as t28 } from "@epoch-agent/infra";
3897
+ import { automationWorkDir, t as t29 } from "@epoch-agent/infra";
3758
3898
  import {
3899
+ approvalPolicyForLevel,
3759
3900
  isOperationType as isOperationType2,
3760
- isPermissionLevel as isPermissionLevel3,
3761
3901
  OPERATION_TYPES as OPERATION_TYPES4,
3762
3902
  parseModelRef as parseModelRef3,
3763
3903
  PERMISSION_LEVELS as PERMISSION_LEVELS4,
3904
+ resolvePermissionLevel as resolvePermissionLevel3,
3905
+ SCHEDULE_DEFAULT_PERMISSION,
3764
3906
  SCHEDULE_INTERVAL_MAX_MINUTES,
3765
3907
  SCHEDULE_INTERVAL_MIN_MINUTES
3766
3908
  } from "@epoch-agent/protocol";
3767
3909
  // src/schedule/labels.ts
3768
- import { t as t26 } from "@epoch-agent/infra";
3910
+ import { t as t27 } from "@epoch-agent/infra";
3769
3911
  import {
3770
3912
  collectPendingApprovals,
3771
3913
  cronTimes
@@ -3775,7 +3917,6 @@ var ISSUE_KEYS = {
3775
3917
  "prompt-empty": "schedule.issue.prompt_empty",
3776
3918
  "permission-unknown": "schedule.issue.permission_unknown",
3777
3919
  "work-dir-missing": "schedule.issue.work_dir_missing",
3778
- "budget-missing": "schedule.issue.budget_missing",
3779
3920
  "max-turns-invalid": "schedule.issue.max_turns_invalid",
3780
3921
  "timeout-invalid": "schedule.issue.timeout_invalid",
3781
3922
  "trigger-time-invalid": "schedule.issue.trigger_time_invalid",
@@ -3819,36 +3960,35 @@ var DRIFT_KEYS = {
3819
3960
  "never-registered": "schedule.drift.never_registered"
3820
3961
  };
3821
3962
  function renderIssues(issues) {
3822
- 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");
3823
3964
  }
3824
3965
  function statusLabel(status) {
3825
3966
  const mark = status === "ok" ? "\u2705" : status === "failed" || status === "denied" ? "\u274C" : "\u26A0\uFE0F";
3826
- return `${mark} ${t26(STATUS_KEYS[status])}`;
3967
+ return `${mark} ${t27(STATUS_KEYS[status])}`;
3827
3968
  }
3828
3969
  function driftLabel(kind) {
3829
- return t26(DRIFT_KEYS[kind]);
3970
+ return t27(DRIFT_KEYS[kind]);
3830
3971
  }
3831
3972
  function describeTrigger(trigger) {
3832
3973
  if (trigger.kind === "interval") {
3833
- 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 });
3834
3975
  }
3835
3976
  if (trigger.kind === "once") {
3836
- return t26("schedule.trigger.once", { date: trigger.date, at: trigger.at });
3977
+ return t27("schedule.trigger.once", { date: trigger.date, at: trigger.at });
3837
3978
  }
3838
3979
  const at = cronTimes(trigger).join("/");
3839
- if (trigger.cycle === "daily") return t26("schedule.trigger.daily", { at });
3980
+ if (trigger.cycle === "daily") return t27("schedule.trigger.daily", { at });
3840
3981
  if (trigger.cycle === "weekly") {
3841
- const days = trigger.weekdays.map((d) => t26(WEEKDAY_KEYS[d])).join("/");
3842
- 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 });
3843
3984
  }
3844
- return t26("schedule.trigger.monthly", { days: trigger.days.join("/"), at });
3985
+ return t27("schedule.trigger.monthly", { days: trigger.days.join("/"), at });
3845
3986
  }
3846
3987
  function permissionLabel(level) {
3847
- if (level === "plan") return t26("schedule.permission.plan");
3848
- if (level === "acceptEdits") return t26("schedule.permission.accept_edits");
3849
- if (level === "bypass") return t26("schedule.permission.bypass");
3850
- if (level === "auto") return t26("schedule.permission.auto");
3851
- 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");
3852
3992
  }
3853
3993
  // src/schedule/shared.ts
3854
3994
  import { realpathSync as realpathSync2 } from "fs";
@@ -3857,8 +3997,8 @@ import {
3857
3997
  ScheduleRegistrar,
3858
3998
  ScheduleStore
3859
3999
  } from "@epoch-agent/core";
3860
- import { dbPath as dbPath2, t as t27, uiDateLocale as uiDateLocale3 } from "@epoch-agent/infra";
3861
- 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}
3862
4002
  `);
3863
4003
  var warn2 = (msg) => void process.stderr.write(`${msg}
3864
4004
  `);
@@ -3886,24 +4026,24 @@ function mustFind(store, idOrPrefix) {
3886
4026
  if (hits.length === 1) return hits[0];
3887
4027
  if (hits.length === 0) {
3888
4028
  throw new CliError(
3889
- t27("schedule.err_not_found", { id: idOrPrefix }),
4029
+ t28("schedule.err_not_found", { id: idOrPrefix }),
3890
4030
  EXIT_CODES.FAILURE,
3891
- t27("schedule.err_not_found_hint")
4031
+ t28("schedule.err_not_found_hint")
3892
4032
  );
3893
4033
  }
3894
4034
  throw new CliError(
3895
- t27("schedule.err_ambiguous", { id: idOrPrefix }),
4035
+ t28("schedule.err_ambiguous", { id: idOrPrefix }),
3896
4036
  EXIT_CODES.FAILURE,
3897
4037
  hits.map((h) => ` ${h.id} ${h.name}`).join("\n")
3898
4038
  );
3899
4039
  }
3900
4040
  function reportRegistration(outcome, fatal) {
3901
4041
  if (outcome.ok) {
3902
- if (outcome.warnings.includes("source")) warn2(t27("schedule.warn_source_entry"));
4042
+ if (outcome.warnings.includes("source")) warn2(t28("schedule.warn_source_entry"));
3903
4043
  return;
3904
4044
  }
3905
- 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");
3906
- 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;
3907
4047
  if (!fatal) {
3908
4048
  warn2(message);
3909
4049
  if (hint) warn2(hint);
@@ -3928,20 +4068,19 @@ async function runAdd(opts) {
3928
4068
  name: input2.name,
3929
4069
  prompt: input2.prompt,
3930
4070
  permission,
3931
- workDir: input2.workDir ?? (permission === "bypass" ? "" : ctx.homeDir),
4071
+ workDir: input2.workDir ?? (approvalPolicyForLevel(permission) === "never" ? "" : ctx.homeDir),
3932
4072
  maxTurns: input2.maxTurns ?? SCHEDULE_DEFAULTS.maxTurns,
3933
- maxBudgetUsd: input2.maxBudgetUsd,
3934
4073
  timeoutMs: input2.timeoutMs ?? SCHEDULE_DEFAULTS.timeoutMs,
3935
4074
  trigger,
3936
4075
  ...input2.startDate !== void 0 ? { startDate: input2.startDate } : {},
3937
4076
  ...input2.endDate !== void 0 ? { endDate: input2.endDate } : {},
3938
4077
  allowRules: input2.allowRules ?? [],
3939
- bypassAcknowledged: filled.iUnderstandBypass === true,
4078
+ bypassAcknowledged: approvalPolicyForLevel(permission) === "never" ? true : filled.iUnderstandBypass === true,
3940
4079
  homeDir: ctx.homeDir
3941
4080
  });
3942
4081
  if (validation.issues.length > 0) {
3943
4082
  throw new CliError(
3944
- t28("schedule.err_invalid"),
4083
+ t29("schedule.err_invalid"),
3945
4084
  EXIT_CODES.FAILURE,
3946
4085
  renderIssues(validation.issues)
3947
4086
  );
@@ -3967,30 +4106,30 @@ async function registerOrRollback(store, def, register) {
3967
4106
  }
3968
4107
  async function fillInteractively(opts) {
3969
4108
  const hasTrigger = Boolean(opts.daily ?? opts.weekly ?? opts.monthly ?? opts.every ?? opts.once);
3970
- const missing = !opts.name || !opts.prompt || !hasTrigger || !opts.budget;
4109
+ const missing = !opts.name || !opts.prompt || !hasTrigger;
3971
4110
  if (!missing) return opts;
3972
4111
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
3973
4112
  throw new CliError(
3974
- t28("schedule.err_missing_flags"),
4113
+ t29("schedule.err_missing_flags"),
3975
4114
  EXIT_CODES.FAILURE,
3976
- t28("schedule.err_missing_flags_hint")
4115
+ t29("schedule.err_missing_flags_hint")
3977
4116
  );
3978
4117
  }
3979
4118
  const { input: input2, select: select2 } = await import("@inquirer/prompts");
3980
4119
  const next = { ...opts };
3981
- next.name ||= await input2({ message: t28("schedule.ask_name") });
3982
- 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") });
3983
4122
  if (!hasTrigger) {
3984
- 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" });
3985
4124
  next.daily = at;
3986
4125
  }
3987
- next.budget ||= await input2({ message: t28("schedule.ask_budget"), default: "0.50" });
3988
4126
  next.permission ||= await select2({
3989
- message: t28("schedule.ask_permission"),
4127
+ message: t29("schedule.ask_permission"),
3990
4128
  choices: [
3991
- { name: t28("schedule.permission.default"), value: "default" },
3992
- { name: t28("schedule.permission.plan"), value: "plan" },
3993
- { 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" }
3994
4133
  ]
3995
4134
  });
3996
4135
  return next;
@@ -3999,8 +4138,8 @@ function parseTrigger(opts) {
3999
4138
  const given = [opts.daily, opts.weekly, opts.monthly, opts.every, opts.once].filter(
4000
4139
  (v) => v !== void 0
4001
4140
  );
4002
- if (given.length === 0) throw new CliError(t28("schedule.err_no_trigger"), EXIT_CODES.FAILURE);
4003
- 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);
4004
4143
  if (opts.daily !== void 0) return { kind: "cron", cycle: "daily", ...cronAt(opts.daily) };
4005
4144
  if (opts.weekly !== void 0) {
4006
4145
  return {
@@ -4021,14 +4160,14 @@ function parseTrigger(opts) {
4021
4160
  if (opts.once !== void 0) {
4022
4161
  const at = requireAt(opts);
4023
4162
  if (at.includes(",")) {
4024
- 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);
4025
4164
  }
4026
4165
  return { kind: "once", date: opts.once, at };
4027
4166
  }
4028
4167
  return { kind: "interval", everyMinutes: parseEvery(opts.every) };
4029
4168
  }
4030
4169
  function requireAt(opts) {
4031
- 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);
4032
4171
  return opts.at;
4033
4172
  }
4034
4173
  function cronAt(raw) {
@@ -4039,7 +4178,7 @@ function parseWeekday(raw) {
4039
4178
  const idx = WEEKDAY_CODES.indexOf(raw.trim().toUpperCase());
4040
4179
  if (idx < 0) {
4041
4180
  throw new CliError(
4042
- t28("schedule.err_weekday", { value: raw }),
4181
+ t29("schedule.err_weekday", { value: raw }),
4043
4182
  EXIT_CODES.FAILURE,
4044
4183
  WEEKDAY_CODES.join(",")
4045
4184
  );
@@ -4051,9 +4190,9 @@ function parseEvery(raw) {
4051
4190
  const minutes = m ? Number(m[1]) * (m[2]?.toLowerCase() === "h" ? 60 : 1) : Number.NaN;
4052
4191
  if (!isValidInterval(minutes)) {
4053
4192
  throw new CliError(
4054
- t28("schedule.err_every", { value: raw }),
4193
+ t29("schedule.err_every", { value: raw }),
4055
4194
  EXIT_CODES.FAILURE,
4056
- t28("schedule.err_every_hint", {
4195
+ t29("schedule.err_every_hint", {
4057
4196
  min: `${SCHEDULE_INTERVAL_MIN_MINUTES}m`,
4058
4197
  max: `${SCHEDULE_INTERVAL_MAX_MINUTES / 60}h`
4059
4198
  })
@@ -4062,22 +4201,23 @@ function parseEvery(raw) {
4062
4201
  return minutes;
4063
4202
  }
4064
4203
  function parsePermission(raw) {
4065
- if (raw === void 0) return "default";
4066
- if (!isPermissionLevel3(raw)) {
4204
+ if (raw === void 0) return SCHEDULE_DEFAULT_PERMISSION;
4205
+ const level = resolvePermissionLevel3(raw);
4206
+ if (!level) {
4067
4207
  throw new CliError(
4068
- t28("schedule.err_permission", { value: raw }),
4208
+ t29("schedule.err_permission", { value: raw }),
4069
4209
  EXIT_CODES.FAILURE,
4070
4210
  PERMISSION_LEVELS4.join(" / ")
4071
4211
  );
4072
4212
  }
4073
- return raw;
4213
+ return level;
4074
4214
  }
4075
4215
  function parseOperations(raw) {
4076
4216
  const out2 = [];
4077
4217
  for (const value of raw ?? []) {
4078
4218
  if (!isOperationType2(value)) {
4079
4219
  throw new CliError(
4080
- t28("schedule.err_operation", { value }),
4220
+ t29("schedule.err_operation", { value }),
4081
4221
  EXIT_CODES.FAILURE,
4082
4222
  OPERATION_TYPES4.join(" / ")
4083
4223
  );
@@ -4087,14 +4227,6 @@ function parseOperations(raw) {
4087
4227
  return out2;
4088
4228
  }
4089
4229
  function buildInput(opts, trigger, permission) {
4090
- const budget = Number(opts.budget);
4091
- if (!Number.isFinite(budget) || budget <= 0) {
4092
- throw new CliError(
4093
- t28("schedule.err_budget", { value: opts.budget ?? "" }),
4094
- EXIT_CODES.FAILURE,
4095
- t28("schedule.err_budget_hint")
4096
- );
4097
- }
4098
4230
  if (opts.model) assertModelRef(opts.model);
4099
4231
  return {
4100
4232
  name: opts.name ?? "",
@@ -4107,7 +4239,6 @@ function buildInput(opts, trigger, permission) {
4107
4239
  allowOperations: parseOperations(opts.allowOperation),
4108
4240
  ...opts.allowRule ? { allowRules: opts.allowRule } : {},
4109
4241
  ...opts.maxTurns ? { maxTurns: Number(opts.maxTurns) } : {},
4110
- maxBudgetUsd: budget,
4111
4242
  ...opts.timeout ? { timeoutMs: Number(opts.timeout) * 6e4 } : {},
4112
4243
  trigger,
4113
4244
  ...opts.start ? { startDate: opts.start } : {},
@@ -4123,67 +4254,68 @@ function createWithWorkDir(store, input2, homeDir) {
4123
4254
  }
4124
4255
  function applyDefaultAllowlist(store, def, opts) {
4125
4256
  const userGave = (opts.allowTool?.length ?? 0) > 0 || (opts.allowOperation?.length ?? 0) > 0 || (opts.allowRule?.length ?? 0) > 0;
4126
- if (userGave || def.permission === "plan" || def.permission === "bypass") return def;
4257
+ if (userGave || def.permission === "plan" || approvalPolicyForLevel(def.permission) === "never")
4258
+ return def;
4127
4259
  return store.update(def.id, {
4128
4260
  allowOperations: ["file_read"],
4129
4261
  allowRules: [`file_write(${def.workDir}/**)`]
4130
4262
  }) ?? def;
4131
4263
  }
4132
4264
  function printSummary(def) {
4133
- log9(t28("schedule.created", { id: def.id, name: def.name }));
4134
- log9("");
4135
- 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) }));
4136
4268
  }
4137
4269
  function assertModelRef(value) {
4138
4270
  if (parseModelRef3(value)) return;
4139
4271
  throw new CliError(
4140
- t28("schedule.err_model_ref", { value }),
4272
+ t29("schedule.err_model_ref", { value }),
4141
4273
  EXIT_CODES.FAILURE,
4142
- t28("schedule.err_model_ref_hint")
4274
+ t29("schedule.err_model_ref_hint")
4143
4275
  );
4144
4276
  }
4145
4277
  // src/schedule/doctor.ts
4146
4278
  import { diagnoseSchedules, pruneSchedules, repairSchedules } from "@epoch-agent/core";
4147
- import { t as t29 } from "@epoch-agent/infra";
4279
+ import { t as t30 } from "@epoch-agent/infra";
4148
4280
  async function runDoctor(opts) {
4149
4281
  const ctx = await openSchedule();
4150
4282
  try {
4151
4283
  const deps = { store: ctx.store, backend: ctx.backend, registrar: ctx.registrar };
4152
4284
  const report = await diagnoseSchedules(deps);
4153
4285
  if (report.unsupported) {
4154
- warn2(t29("schedule.doctor_unsupported"));
4286
+ warn2(t30("schedule.doctor_unsupported"));
4155
4287
  return;
4156
4288
  }
4157
4289
  if (report.drifts.length === 0) {
4158
- log9(t29("schedule.doctor_clean", { n: report.checked }));
4290
+ log10(t30("schedule.doctor_clean", { n: report.checked }));
4159
4291
  return;
4160
4292
  }
4161
- log9(t29("schedule.doctor_found", { n: report.drifts.length }));
4293
+ log10(t30("schedule.doctor_found", { n: report.drifts.length }));
4162
4294
  for (const drift of report.drifts) {
4163
- log9(
4295
+ log10(
4164
4296
  ` \xB7 ${driftLabel(drift.kind)} ${drift.name ?? drift.scheduleId ?? ""} [${drift.osTaskId || "\u2014"}]${drift.detail ? `
4165
4297
  ${drift.detail}` : ""}`
4166
4298
  );
4167
4299
  }
4168
4300
  if (opts.repair !== true && opts.prune !== true) {
4169
- log9("");
4170
- log9(t29("schedule.doctor_hint"));
4301
+ log10("");
4302
+ log10(t30("schedule.doctor_hint"));
4171
4303
  return;
4172
4304
  }
4173
4305
  if (opts.repair === true) {
4174
4306
  for (const outcome of await repairSchedules(report.drifts, deps)) {
4175
4307
  const label = outcome.drift.name ?? outcome.drift.scheduleId ?? "";
4176
- if (outcome.ok) log9(t29("schedule.doctor_repaired", { name: label }));
4308
+ if (outcome.ok) log10(t30("schedule.doctor_repaired", { name: label }));
4177
4309
  else
4178
- warn2(t29("schedule.doctor_repair_failed", { name: label, detail: outcome.detail ?? "" }));
4310
+ warn2(t30("schedule.doctor_repair_failed", { name: label, detail: outcome.detail ?? "" }));
4179
4311
  }
4180
4312
  }
4181
4313
  if (opts.prune === true) {
4182
4314
  for (const outcome of await pruneSchedules(report.drifts, deps)) {
4183
- 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 }));
4184
4316
  else {
4185
4317
  warn2(
4186
- t29("schedule.doctor_prune_failed", {
4318
+ t30("schedule.doctor_prune_failed", {
4187
4319
  id: outcome.drift.osTaskId,
4188
4320
  detail: outcome.detail ?? ""
4189
4321
  })
@@ -4198,15 +4330,15 @@ async function runDoctor(opts) {
4198
4330
  }
4199
4331
  // src/schedule/manage.ts
4200
4332
  import { removeRecordings } from "@epoch-agent/core";
4201
- import { automationLogsDir, t as t30 } from "@epoch-agent/infra";
4333
+ import { automationLogsDir, t as t31 } from "@epoch-agent/infra";
4202
4334
  async function runSetEnabled(idOrPrefix, enabled) {
4203
4335
  const ctx = await openSchedule();
4204
4336
  try {
4205
4337
  const def = mustFind(ctx.store, idOrPrefix);
4206
4338
  const outcome = await ctx.registrar.setEnabled(def, enabled);
4207
4339
  reportRegistration(outcome, false);
4208
- log9(
4209
- 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 })
4210
4342
  );
4211
4343
  } finally {
4212
4344
  ctx.close();
@@ -4219,13 +4351,13 @@ async function runRemove(idOrPrefix) {
4219
4351
  if (def.osTaskId) reportRegistration(await ctx.registrar.unregister(def), false);
4220
4352
  ctx.store.remove(def.id);
4221
4353
  removeRecordings(automationLogsDir(def.id, ctx.homeDir));
4222
- log9(t30("schedule.removed", { name: def.name }));
4354
+ log10(t31("schedule.removed", { name: def.name }));
4223
4355
  } finally {
4224
4356
  ctx.close();
4225
4357
  }
4226
4358
  }
4227
4359
  // src/schedule/run.ts
4228
- import { t as t31 } from "@epoch-agent/infra";
4360
+ import { t as t32 } from "@epoch-agent/infra";
4229
4361
  import { unfixedRules } from "@epoch-agent/protocol";
4230
4362
  import { fireSchedule } from "@epoch-agent/runtime";
4231
4363
  async function runFire(scheduleId, homeDir) {
@@ -4238,9 +4370,9 @@ async function runFire(scheduleId, homeDir) {
4238
4370
  ctx.close();
4239
4371
  }
4240
4372
  if (result.missing) {
4241
- warn2(t31("schedule.fire_missing", { id: scheduleId }));
4373
+ warn2(t32("schedule.fire_missing", { id: scheduleId }));
4242
4374
  } else if (result.disabled) {
4243
- warn2(t31("schedule.fire_disabled", { id: scheduleId }));
4375
+ warn2(t32("schedule.fire_disabled", { id: scheduleId }));
4244
4376
  } else {
4245
4377
  warn2(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4246
4378
  }
@@ -4250,14 +4382,14 @@ async function runManual(idOrPrefix, opts) {
4250
4382
  const ctx = await openSchedule();
4251
4383
  try {
4252
4384
  const def = mustFind(ctx.store, idOrPrefix);
4253
- log9(t31("schedule.run_start", { name: def.name }));
4385
+ log10(t32("schedule.run_start", { name: def.name }));
4254
4386
  const result = await fireSchedule({
4255
4387
  scheduleId: def.id,
4256
4388
  homeDir: ctx.homeDir,
4257
4389
  manual: true,
4258
4390
  registrar: ctx.registrar
4259
4391
  });
4260
- log9(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4392
+ log10(`${statusLabel(result.status)}${result.detail ? ` ${result.detail}` : ""}`);
4261
4393
  const pending = result.run?.pendingApprovals ?? [];
4262
4394
  if (pending.length === 0) {
4263
4395
  process.exitCode = result.exitCode;
@@ -4266,21 +4398,21 @@ async function runManual(idOrPrefix, opts) {
4266
4398
  printPending(pending);
4267
4399
  if (opts.fix === true) {
4268
4400
  const added = applyFix(ctx.store, def.id, pending);
4269
- 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"));
4270
4402
  return;
4271
4403
  }
4272
- log9(t31("schedule.fix_hint", { id: def.id.slice(0, 12) }));
4404
+ log10(t32("schedule.fix_hint", { id: def.id.slice(0, 12) }));
4273
4405
  process.exitCode = result.exitCode;
4274
4406
  } finally {
4275
4407
  ctx.close();
4276
4408
  }
4277
4409
  }
4278
4410
  function printPending(pending) {
4279
- log9("");
4280
- log9(t31("schedule.pending_header", { n: pending.length }));
4411
+ log10("");
4412
+ log10(t32("schedule.pending_header", { n: pending.length }));
4281
4413
  for (const item of pending) {
4282
- log9(` \xB7 ${t31("schedule.pending_line", { tool: item.toolName, target: item.target })}`);
4283
- 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}`);
4284
4416
  }
4285
4417
  }
4286
4418
  function applyFix(store, scheduleId, pending) {
@@ -4292,23 +4424,26 @@ function applyFix(store, scheduleId, pending) {
4292
4424
  }
4293
4425
  // src/schedule/view.ts
4294
4426
  import { formatUsd as formatUsd2, nextRunAt, readRecording } from "@epoch-agent/core";
4295
- 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";
4296
4431
  async function runList() {
4297
4432
  const ctx = await openSchedule();
4298
4433
  try {
4299
4434
  const defs = ctx.store.list();
4300
4435
  if (defs.length === 0) {
4301
- log9(t32("schedule.list_empty"));
4302
- log9(t32("schedule.list_empty_hint"));
4436
+ log10(t33("schedule.list_empty"));
4437
+ log10(t33("schedule.list_empty_hint"));
4303
4438
  return;
4304
4439
  }
4305
- log9(t32("schedule.list_header"));
4440
+ log10(t33("schedule.list_header"));
4306
4441
  for (const def of defs) {
4307
- const next = def.enabled ? formatWhen(nextRunAt(def.trigger, Date.now(), def.startDate, def.endDate) ?? void 0) : t32("schedule.disabled_mark");
4308
- const danger = def.permission === "bypass" ? " \u{1F534}" : "";
4309
- 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(
4310
4445
  ` ${def.id.slice(0, 12)} ${def.name}${danger}
4311
- ${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)}`
4312
4447
  );
4313
4448
  }
4314
4449
  } finally {
@@ -4319,51 +4454,50 @@ async function runShow(idOrPrefix) {
4319
4454
  const ctx = await openSchedule();
4320
4455
  try {
4321
4456
  const def = mustFind(ctx.store, idOrPrefix);
4322
- log9(`${def.name} (${def.id})`);
4323
- log9(` ${t32("schedule.field_enabled")}: ${def.enabled ? t32("schedule.yes") : t32("schedule.no")}`);
4324
- 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)}`);
4325
4460
  if (def.startDate ?? def.endDate) {
4326
- log9(` ${t32("schedule.field_window")}: ${def.startDate ?? "\u2014"} .. ${def.endDate ?? "\u2014"}`);
4461
+ log10(` ${t33("schedule.field_window")}: ${def.startDate ?? "\u2014"} .. ${def.endDate ?? "\u2014"}`);
4327
4462
  }
4328
- log9(
4329
- ` ${t32("schedule.field_next")}: ${formatWhen(
4463
+ log10(
4464
+ ` ${t33("schedule.field_next")}: ${formatWhen(
4330
4465
  nextRunAt(def.trigger, Date.now(), def.startDate, def.endDate) ?? void 0
4331
4466
  )}`
4332
4467
  );
4333
- log9(` ${t32("schedule.field_workdir")}: ${def.workDir}`);
4334
- if (def.model) log9(` ${t32("schedule.field_model")}: ${def.model}`);
4335
- if (def.role) log9(` ${t32("schedule.field_role")}: ${def.role}`);
4336
- log9(` ${t32("schedule.field_permission")}: ${permissionLabel(def.permission)}`);
4337
- log9(
4338
- ` ${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", {
4339
4474
  turns: def.maxTurns,
4340
- budget: formatUsd2(def.maxBudgetUsd, 2),
4341
4475
  minutes: Math.round(def.timeoutMs / 6e4)
4342
4476
  })
4343
4477
  );
4344
- log9(` ${t32("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
4345
- log9(
4346
- ` ${t32("schedule.field_session")}: ` + t32(
4478
+ log10(` ${t33("schedule.field_backend")}: ${def.osBackend} ${def.osTaskId || "\u2014"}`);
4479
+ log10(
4480
+ ` ${t33("schedule.field_session")}: ` + t33(
4347
4481
  def.showInSessionList === true ? "schedule.session_listed" : "schedule.session_discarded"
4348
4482
  )
4349
4483
  );
4350
- log9(` ${t32("schedule.field_prompt")}:`);
4351
- for (const line of def.prompt.split("\n")) log9(` ${line}`);
4352
- log9("");
4484
+ log10(` ${t33("schedule.field_prompt")}:`);
4485
+ for (const line2 of def.prompt.split("\n")) log10(` ${line2}`);
4486
+ log10("");
4353
4487
  printAllowlist(def);
4354
- log9("");
4355
- log9(t32("schedule.field_last_run", { when: formatWhen(def.lastRunAt) }));
4488
+ log10("");
4489
+ log10(t33("schedule.field_last_run", { when: formatWhen(def.lastRunAt) }));
4356
4490
  } finally {
4357
4491
  ctx.close();
4358
4492
  }
4359
4493
  }
4360
4494
  function printAllowlist(def) {
4361
- if (def.permission === "bypass") {
4362
- log9(t32("schedule.allowlist_bypass"));
4495
+ if (approvalPolicyForLevel2(def.permission) === "never") {
4496
+ log10(t33("schedule.allowlist_bypass"));
4363
4497
  return;
4364
4498
  }
4365
4499
  if (def.permission === "plan") {
4366
- log9(t32("schedule.allowlist_readonly"));
4500
+ log10(t33("schedule.allowlist_readonly"));
4367
4501
  return;
4368
4502
  }
4369
4503
  const lines = [
@@ -4371,9 +4505,9 @@ function printAllowlist(def) {
4371
4505
  ...def.allowOperations.map((v) => ` ${v}`),
4372
4506
  ...def.allowRules.map((v) => ` ${v}`)
4373
4507
  ];
4374
- log9(t32("schedule.allowlist_header"));
4375
- log9(lines.length > 0 ? lines.join("\n") : ` ${t32("schedule.allowlist_empty")}`);
4376
- 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"));
4377
4511
  }
4378
4512
  async function runLogs(idOrPrefix, limit, tail) {
4379
4513
  const ctx = await openSchedule();
@@ -4381,7 +4515,7 @@ async function runLogs(idOrPrefix, limit, tail) {
4381
4515
  const def = mustFind(ctx.store, idOrPrefix);
4382
4516
  const runs = ctx.store.listRuns(def.id, limit);
4383
4517
  if (runs.length === 0) {
4384
- log9(t32("schedule.logs_empty"));
4518
+ log10(t33("schedule.logs_empty"));
4385
4519
  return;
4386
4520
  }
4387
4521
  for (const run of runs) printRun(run);
@@ -4391,31 +4525,31 @@ async function runLogs(idOrPrefix, limit, tail) {
4391
4525
  }
4392
4526
  }
4393
4527
  function printRun(run) {
4394
- log9(
4395
- ` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t32("schedule.run_meta", {
4528
+ log10(
4529
+ ` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t33("schedule.run_meta", {
4396
4530
  turns: run.turns,
4397
4531
  cost: formatUsd2(run.costUsd, 4),
4398
- manual: run.manual ? t32("schedule.run_manual") : ""
4532
+ manual: run.manual ? t33("schedule.run_manual") : ""
4399
4533
  })
4400
4534
  );
4401
- if (run.reason) log9(` ${run.reason}`);
4535
+ if (run.reason) log10(` ${run.reason}`);
4402
4536
  for (const pending of run.pendingApprovals) {
4403
- log9(
4404
- ` \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 })}`
4405
4539
  );
4406
4540
  if (pending.suggestedRule) {
4407
- log9(` ${t32("schedule.pending_fix", { rule: pending.suggestedRule })}`);
4541
+ log10(` ${t33("schedule.pending_fix", { rule: pending.suggestedRule })}`);
4408
4542
  }
4409
4543
  }
4410
4544
  }
4411
4545
  function printRecording(run) {
4412
4546
  if (!run.logPath) return;
4413
- log9("");
4414
- log9(t32("schedule.logs_recording", { path: run.logPath }));
4547
+ log10("");
4548
+ log10(t33("schedule.logs_recording", { path: run.logPath }));
4415
4549
  for (const envelope of readRecording(run.logPath)) {
4416
4550
  const event = envelope.event;
4417
4551
  if (event.type === "text-delta" && event.text) process.stdout.write(event.text);
4418
- else if (event.type === "error" && event.message) log9(`
4552
+ else if (event.type === "error" && event.message) log10(`
4419
4553
  [error] ${event.message}`);
4420
4554
  }
4421
4555
  process.stdout.write("\n");
@@ -4423,19 +4557,19 @@ function printRecording(run) {
4423
4557
  // src/commands/schedule.ts
4424
4558
  var DEFAULT_LOG_LIMIT = 10;
4425
4559
  function registerScheduleCommand(program2) {
4426
- const cmd = program2.command("schedule").description(t33("cli.schedule.summary"));
4427
- 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));
4428
- cmd.command("list", { isDefault: true }).description(t33("cli.schedule.list")).action(() => runList());
4429
- cmd.command("show").description(t33("cli.schedule.show")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runShow(id));
4430
- cmd.command("enable").description(t33("cli.schedule.enable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, true));
4431
- cmd.command("disable").description(t33("cli.schedule.disable")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runSetEnabled(id, false));
4432
- cmd.command("rm").alias("remove").description(t33("cli.schedule.rm")).argument("<id>", t33("cli.schedule.arg_id")).action((id) => runRemove(id));
4433
- 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));
4434
- 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(
4435
4569
  (id, opts) => runLogs(id, Number(opts.limit ?? DEFAULT_LOG_LIMIT), opts.tail === true)
4436
4570
  );
4437
- 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));
4438
- 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));
4439
4573
  }
4440
4574
  function collect3(value, previous) {
4441
4575
  return [...previous, value];
@@ -4446,7 +4580,7 @@ import { statfs } from "fs/promises";
4446
4580
  import {
4447
4581
  describeIsolation,
4448
4582
  getConfigIssues,
4449
- loadConfig as loadConfig5,
4583
+ loadConfig as loadConfig6,
4450
4584
  SANDBOX_COVERS,
4451
4585
  SANDBOX_EXCLUDES
4452
4586
  } from "@epoch-agent/core";
@@ -4454,13 +4588,13 @@ import {
4454
4588
  allJobs,
4455
4589
  confine,
4456
4590
  resolveProfile,
4457
- t as t35
4591
+ t as t36
4458
4592
  } from "@epoch-agent/infra";
4459
4593
  import { hasFailure } from "@epoch-agent/protocol";
4460
4594
  // src/statusline.ts
4461
4595
  import { execFile as execFile2 } from "child_process";
4462
4596
  import { sanitizeToolOutput } from "@epoch-agent/core";
4463
- 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";
4464
4598
  var TIMEOUT_MS2 = 2e3;
4465
4599
  var MAX_WIDTH = 60;
4466
4600
  var MAX_BUFFER = 64 * 1024;
@@ -4489,7 +4623,7 @@ function runStatusLineCommand(command, cwd) {
4489
4623
  const killed = err2.killed === true;
4490
4624
  settle({
4491
4625
  text: null,
4492
- error: killed ? t34("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
4626
+ error: killed ? t35("statusline.timeout", { ms: TIMEOUT_MS2 }) : err2.message.trim()
4493
4627
  });
4494
4628
  return;
4495
4629
  }
@@ -4505,12 +4639,12 @@ async function probeStatusLine(config, cwd) {
4505
4639
  if (!command) return null;
4506
4640
  const result = await runStatusLineCommand(command, cwd);
4507
4641
  if (result.text === null) {
4508
- return { command, ok: false, detail: result.error ?? t34("statusline.no_output") };
4642
+ return { command, ok: false, detail: result.error ?? t35("statusline.no_output") };
4509
4643
  }
4510
4644
  return { command, ok: true, detail: result.text };
4511
4645
  }
4512
4646
  // src/commands/status.ts
4513
- var log10 = (msg) => {
4647
+ var log11 = (msg) => {
4514
4648
  process.stdout.write(msg + "\n");
4515
4649
  };
4516
4650
  var STATUS_MARK = {
@@ -4538,10 +4672,10 @@ async function describeDisk(path = ".") {
4538
4672
  }
4539
4673
  }
4540
4674
  function describeConfig() {
4541
- if (!existsSync7(CONFIG_PATH)) return t35("cli.status.config_absent");
4542
- loadConfig5();
4675
+ if (!existsSync7(CONFIG_PATH)) return t36("cli.status.config_absent");
4676
+ loadConfig6();
4543
4677
  const n = getConfigIssues().length;
4544
- 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 });
4545
4679
  }
4546
4680
  async function describeSecretBackend() {
4547
4681
  try {
@@ -4549,18 +4683,18 @@ async function describeSecretBackend() {
4549
4683
  const store = await createSecretStore();
4550
4684
  return store.encrypted ? store.detail : `\u26A0 ${store.detail}`;
4551
4685
  } catch (err2) {
4552
- return t35("cli.status.secret_probe_failed", {
4686
+ return t36("cli.status.secret_probe_failed", {
4553
4687
  message: err2 instanceof Error ? err2.message : String(err2)
4554
4688
  });
4555
4689
  }
4556
4690
  }
4557
4691
  function workspaceLines(rt) {
4558
- const lines = [` ${t35("cli.doctor.workspace_root", { root: rt.workspace.root })}`];
4692
+ const lines = [` ${t36("cli.doctor.workspace_root", { root: rt.workspace.root })}`];
4559
4693
  lines.push(
4560
- ` ${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")}`
4561
4695
  );
4562
4696
  lines.push(
4563
- ` ${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 })}`
4564
4698
  );
4565
4699
  for (const dir of rt.workspace.extra) lines.push(` \xB7 ${dir}`);
4566
4700
  return lines;
@@ -4568,94 +4702,94 @@ function workspaceLines(rt) {
4568
4702
  function sandboxLines(cwd, sandbox) {
4569
4703
  const iso = describeIsolation();
4570
4704
  const lines = [`
4571
- ${t35("cli.doctor.sandbox_head")}`];
4705
+ ${t36("cli.doctor.sandbox_head")}`];
4572
4706
  if (iso.backend === "none") {
4573
4707
  lines.push(` ${STATUS_MARK.skipped} ${iso.detail}`);
4574
4708
  lines.push(
4575
- ` ${STATUS_MARK.warn} ${t35(
4709
+ ` ${STATUS_MARK.warn} ${t36(
4576
4710
  iso.reason === "platform-unsupported" ? "cli.doctor.sandbox_absent_by_design" : "cli.doctor.sandbox_absent_tools"
4577
4711
  )}`
4578
4712
  );
4579
4713
  return lines;
4580
4714
  }
4581
4715
  lines.push(
4582
- ` ${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 })}`
4583
4717
  );
4584
- 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 })}`);
4585
4719
  const probe = (mode) => confine("/bin/sh", ["-c", "true"], { mode, workspaceRoot: cwd, allowNetwork: true });
4586
4720
  for (const mode of ["workspace-write", "read-only"]) {
4587
4721
  const c = probe(mode);
4588
4722
  if (!c.confined) continue;
4589
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_terminal", { mode, enforcement: c.enforcement })}`);
4590
- 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")}`);
4591
4725
  }
4592
4726
  const writable = probe("workspace-write");
4593
4727
  if (writable.confined) {
4594
- lines.push(` \xB7 ${t35("cli.doctor.sandbox_writable")}`);
4728
+ lines.push(` \xB7 ${t36("cli.doctor.sandbox_writable")}`);
4595
4729
  for (const dir of writable.writableDirs) lines.push(` \xB7 ${dir}`);
4596
4730
  }
4597
4731
  lines.push(
4598
- 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")}`
4599
4733
  );
4600
- 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(", ") })}`);
4601
4735
  lines.push(
4602
- 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(", ") })}`
4603
4737
  );
4604
4738
  return lines;
4605
4739
  }
4606
4740
  function ftsLines(health) {
4607
4741
  const lines = [`
4608
- ${t35("cli.doctor.fts_head")}`];
4742
+ ${t36("cli.doctor.fts_head")}`];
4609
4743
  const indexed = health.tables.map((tb) => `${tb.table} ${tb.rows}`).join(" \xB7 ");
4610
- 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 })}`);
4611
4745
  const behind = health.tables.filter((tb) => tb.rows !== health.messages);
4612
4746
  lines.push(
4613
- behind.length === 0 ? ` ${STATUS_MARK.ok} ${t35("cli.doctor.fts_in_sync")}` : (
4614
- ` ${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", {
4615
4749
  tables: behind.map((tb) => `${tb.table} (${tb.rows - health.messages})`).join(", ")
4616
4750
  })}`
4617
4751
  )
4618
4752
  );
4619
4753
  lines.push(
4620
- 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", {
4621
4755
  triggers: health.missingTriggers.join(", ")
4622
4756
  })}`
4623
4757
  );
4624
4758
  for (const tb of health.tables) {
4625
4759
  if (tb.error !== null) {
4626
4760
  lines.push(
4627
- ` ${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 })}`
4628
4762
  );
4629
4763
  }
4630
4764
  if (tb.drift !== null) {
4631
4765
  lines.push(
4632
- ` ${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 })}`
4633
4767
  );
4634
4768
  }
4635
4769
  }
4636
4770
  if (health.tables.some((tb) => !tb.external)) {
4637
- lines.push(` ${STATUS_MARK.warn} ${t35("cli.doctor.fts_legacy_schema")}`);
4771
+ lines.push(` ${STATUS_MARK.warn} ${t36("cli.doctor.fts_legacy_schema")}`);
4638
4772
  }
4639
4773
  if (health.indexBytes !== void 0) {
4640
- 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) })}`);
4641
4775
  }
4642
4776
  if (health.space?.fileBytes !== void 0) {
4643
4777
  lines.push(
4644
- ` \xB7 ${t35("cli.doctor.fts_space", {
4778
+ ` \xB7 ${t36("cli.doctor.fts_space", {
4645
4779
  file: formatBytes(health.space.fileBytes),
4646
4780
  free: formatBytes(health.space.freeBytes)
4647
4781
  })}`
4648
4782
  );
4649
- lines.push(` \xB7 ${t35("cli.doctor.fts_reclaim_hint")}`);
4783
+ lines.push(` \xB7 ${t36("cli.doctor.fts_reclaim_hint")}`);
4650
4784
  }
4651
4785
  return lines;
4652
4786
  }
4653
4787
  function reclaimLines(report) {
4654
4788
  const lines = [`
4655
- ${t35("cli.doctor.reclaim_head")}`];
4789
+ ${t36("cli.doctor.reclaim_head")}`];
4656
4790
  const secs = (ms) => `${(ms / 1e3).toFixed(1)}s`;
4657
4791
  lines.push(
4658
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_optimize", {
4792
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_optimize", {
4659
4793
  before: formatBytes(report.before.freeBytes),
4660
4794
  after: formatBytes(report.afterOptimize.freeBytes),
4661
4795
  ms: secs(report.optimizeMs)
@@ -4663,7 +4797,7 @@ ${t35("cli.doctor.reclaim_head")}`];
4663
4797
  );
4664
4798
  if (report.vacuumed) {
4665
4799
  lines.push(
4666
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_vacuum", {
4800
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_vacuum", {
4667
4801
  before: formatBytes(report.before.pageBytes),
4668
4802
  after: formatBytes(report.after.pageBytes),
4669
4803
  ms: secs(report.vacuumMs)
@@ -4671,14 +4805,14 @@ ${t35("cli.doctor.reclaim_head")}`];
4671
4805
  );
4672
4806
  const saved = report.before.pageBytes - report.after.pageBytes;
4673
4807
  lines.push(
4674
- ` ${STATUS_MARK.ok} ${t35("cli.doctor.reclaim_total", {
4808
+ ` ${STATUS_MARK.ok} ${t36("cli.doctor.reclaim_total", {
4675
4809
  saved: formatBytes(saved),
4676
4810
  pct: `${(saved / Math.max(1, report.before.pageBytes) * 100).toFixed(1)}%`
4677
4811
  })}`
4678
4812
  );
4679
4813
  } else if (report.vacuumError !== null) {
4680
4814
  lines.push(
4681
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.reclaim_vacuum_skipped", {
4815
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.reclaim_vacuum_skipped", {
4682
4816
  detail: report.vacuumError
4683
4817
  })}`
4684
4818
  );
@@ -4698,17 +4832,17 @@ function hookLines(rt) {
4698
4832
  const { sources } = rt.hook;
4699
4833
  if (sources.length === 0) return [];
4700
4834
  const lines = [`
4701
- ${t35("cli.doctor.hook_head")}`];
4835
+ ${t36("cli.doctor.hook_head")}`];
4702
4836
  for (const source of sources) {
4703
- const label = t35(HOOK_SOURCE_LABEL[source.kind]);
4837
+ const label = t36(HOOK_SOURCE_LABEL[source.kind]);
4704
4838
  if (source.skipped) {
4705
4839
  lines.push(` ${STATUS_MARK.skipped} ${label}: ${source.path}`);
4706
- lines.push(` ${t35("cli.doctor.hook_skipped")}`);
4840
+ lines.push(` ${t36("cli.doctor.hook_skipped")}`);
4707
4841
  continue;
4708
4842
  }
4709
4843
  const name = source.plugin === void 0 ? label : `${label} ${source.plugin}`;
4710
4844
  lines.push(
4711
- ` ${STATUS_MARK.ok} ${name}: ${source.path}${t35("cli.doctor.hook_count", {
4845
+ ` ${STATUS_MARK.ok} ${name}: ${source.path}${t36("cli.doctor.hook_count", {
4712
4846
  n: source.count
4713
4847
  })}`
4714
4848
  );
@@ -4722,65 +4856,65 @@ var JOB_KIND_LABEL = {
4722
4856
  };
4723
4857
  function jobLines(jobs) {
4724
4858
  const lines = [`
4725
- ${t35("cli.doctor.jobs_head")}`];
4859
+ ${t36("cli.doctor.jobs_head")}`];
4726
4860
  const running = jobs.filter((job) => job.status === "running");
4727
4861
  if (running.length === 0) {
4728
- lines.push(` ${STATUS_MARK.ok} ${t35("cli.doctor.jobs_none")}`);
4862
+ lines.push(` ${STATUS_MARK.ok} ${t36("cli.doctor.jobs_none")}`);
4729
4863
  return lines;
4730
4864
  }
4731
- 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 })}`);
4732
4866
  for (const job of running) {
4733
4867
  lines.push(
4734
- ` \xB7 ${t35("cli.doctor.jobs_line", {
4735
- kind: t35(JOB_KIND_LABEL[job.kind]),
4868
+ ` \xB7 ${t36("cli.doctor.jobs_line", {
4869
+ kind: t36(JOB_KIND_LABEL[job.kind]),
4736
4870
  id: job.id,
4737
4871
  label: job.label
4738
4872
  })}`
4739
4873
  );
4740
4874
  }
4741
- lines.push(` \xB7 ${t35("cli.doctor.jobs_lifetime")}`);
4875
+ lines.push(` \xB7 ${t36("cli.doctor.jobs_lifetime")}`);
4742
4876
  return lines;
4743
4877
  }
4744
4878
  function terminalLines(result, terminal) {
4745
4879
  const head = `
4746
- ${t35("cli.doctor.terminal_head")}`;
4880
+ ${t36("cli.doctor.terminal_head")}`;
4747
4881
  if (!result.ok) {
4748
4882
  if (result.failure.kind === "no-tty") {
4749
4883
  return [
4750
4884
  head,
4751
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_no_tty")}`,
4752
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`
4885
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_no_tty")}`,
4886
+ ` \xB7 ${t36("cli.doctor.terminal_alternatives")}`
4753
4887
  ];
4754
4888
  }
4755
4889
  return [
4756
4890
  head,
4757
- ` ${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 })}`
4758
4892
  ];
4759
4893
  }
4760
4894
  switch (result.sample.kind) {
4761
4895
  case "shift-enter":
4762
- return [head, ` ${STATUS_MARK.ok} ${t35("cli.doctor.terminal_shift_enter")}`];
4896
+ return [head, ` ${STATUS_MARK.ok} ${t36("cli.doctor.terminal_shift_enter")}`];
4763
4897
  case "enter-only":
4764
4898
  if (terminal?.kind === "apple-terminal") {
4765
4899
  return [
4766
4900
  head,
4767
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_apple")}`,
4768
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`
4901
+ ` ${STATUS_MARK.warn} ${t36("cli.doctor.terminal_apple")}`,
4902
+ ` \xB7 ${t36("cli.doctor.terminal_alternatives")}`
4769
4903
  ];
4770
4904
  }
4771
4905
  return [
4772
4906
  head,
4773
- ` ${STATUS_MARK.warn} ${t35("cli.doctor.terminal_enter_only")}`,
4774
- ` \xB7 ${t35("cli.doctor.terminal_alternatives")}`,
4775
- ` \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")}`
4776
4910
  ];
4777
4911
  case "other":
4778
4912
  return [
4779
4913
  head,
4780
- ` ${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 })}`
4781
4915
  ];
4782
4916
  case "interrupted":
4783
- return [head, ` \xB7 ${t35("cli.doctor.terminal_interrupted")}`];
4917
+ return [head, ` \xB7 ${t36("cli.doctor.terminal_interrupted")}`];
4784
4918
  }
4785
4919
  }
4786
4920
  async function statusLineLines(config, cwd) {
@@ -4788,96 +4922,96 @@ async function statusLineLines(config, cwd) {
4788
4922
  if (!probe) return [];
4789
4923
  return [
4790
4924
  `
4791
- ${t35("cli.doctor.status_line_head")}`,
4792
- ` ${t35("cli.doctor.status_line_command", { command: probe.command })}`,
4793
- ` ${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 })}`
4794
4928
  ];
4795
4929
  }
4796
4930
  function registerStatusCommands(program2) {
4797
- program2.command("status").description(t35("cli.status.cmd_root")).action(async () => {
4798
- log10(
4931
+ program2.command("status").description(t36("cli.status.cmd_root")).action(async () => {
4932
+ log11(
4799
4933
  [
4800
- t35("cli.status.version", { version: VERSION }),
4934
+ t36("cli.status.version", { version: VERSION }),
4801
4935
  `Node: ${process.version} (${process.platform}/${process.arch})`,
4802
- t35("cli.status.home", { path: EPOCH_HOME }),
4936
+ t36("cli.status.home", { path: EPOCH_HOME }),
4803
4937
  `Profile: ${resolveProfile()}`,
4804
- t35("cli.status.credentials", {
4805
- 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")
4806
4940
  }),
4807
- t35("cli.status.secret_backend", { detail: await describeSecretBackend() }),
4941
+ t36("cli.status.secret_backend", { detail: await describeSecretBackend() }),
4808
4942
  `config.yaml: ${describeConfig()}`,
4809
- `.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")}`
4810
4944
  ].join("\n")
4811
4945
  );
4812
4946
  });
4813
- program2.command("doctor").description(t35("cli.doctor.cmd_root")).option("--reclaim", t35("cli.doctor.reclaim_opt")).action(async (opts) => {
4814
- 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 }));
4815
4949
  const avail = await describeDisk();
4816
- if (avail) log10(t35("cli.doctor.disk", { avail }));
4817
- log10(`${hasCredentials() ? "\u2713" : "\u25CB"} ${t35("cli.doctor.credentials")}`);
4818
- 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()) : [];
4819
4953
  const configMark = !existsSync7(CONFIG_PATH) ? "\u25CB" : configIssues.length > 0 ? "\u26A0" : "\u2713";
4820
- log10(`${configMark} config: ${CONFIG_PATH}`);
4954
+ log11(`${configMark} config: ${CONFIG_PATH}`);
4821
4955
  try {
4822
4956
  const { buildRuntime: buildRuntime4 } = await import("@epoch-agent/runtime");
4823
4957
  const rt = await buildRuntime4({ installSignalHandlers: true });
4824
- log10(`
4825
- ${t35("cli.doctor.workspace_head")}`);
4826
- for (const line of workspaceLines(rt)) log10(line);
4827
- for (const line of sandboxLines(rt.workspace.root, rt.config.sandbox)) log10(line);
4828
- for (const line of hookLines(rt)) log10(line);
4829
- 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);
4830
4964
  const { classifyTerminal, probeShiftEnter } = await import("@epoch-agent/tui");
4831
- for (const line of terminalLines(
4832
- 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 }),
4833
4967
  classifyTerminal(process.env)
4834
4968
  ))
4835
- log10(line);
4836
- 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);
4837
4971
  if (rt.sessionStore) {
4838
4972
  try {
4839
- for (const line of ftsLines(rt.sessionStore.ftsHealth())) log10(line);
4973
+ for (const line2 of ftsLines(rt.sessionStore.ftsHealth())) log11(line2);
4840
4974
  } catch (err2) {
4841
- log10(`
4842
- ${t35("cli.doctor.fts_head")}`);
4843
- log10(
4844
- ` ${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", {
4845
4979
  detail: err2 instanceof Error ? err2.message : String(err2)
4846
4980
  })}`
4847
4981
  );
4848
4982
  }
4849
4983
  if (opts.reclaim) {
4850
4984
  try {
4851
- for (const line of reclaimLines(rt.sessionStore.reclaimFts())) log10(line);
4985
+ for (const line2 of reclaimLines(rt.sessionStore.reclaimFts())) log11(line2);
4852
4986
  } catch (err2) {
4853
- log10(`
4854
- ${t35("cli.doctor.reclaim_head")}`);
4855
- log10(
4856
- ` ${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", {
4857
4991
  detail: err2 instanceof Error ? err2.message : String(err2)
4858
4992
  })}`
4859
4993
  );
4860
4994
  }
4861
4995
  }
4862
4996
  }
4863
- log10(`
4864
- ${t35("cli.doctor.modules_head")}`);
4997
+ log11(`
4998
+ ${t36("cli.doctor.modules_head")}`);
4865
4999
  const order = { failed: 0, warn: 1, skipped: 2, ok: 3 };
4866
5000
  const sorted = [...rt.diagnosticList].sort(
4867
5001
  (a, b) => (order[a.status] ?? 9) - (order[b.status] ?? 9)
4868
5002
  );
4869
- 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}`);
4870
5004
  await rt.dispose();
4871
5005
  if (hasFailure(rt.diagnosticList)) {
4872
5006
  const bad = rt.diagnosticList.filter((d) => d.status === "failed").length;
4873
- log10(`
4874
- ${t35("cli.doctor.modules_failed", { count: bad })}`);
5007
+ log11(`
5008
+ ${t36("cli.doctor.modules_failed", { count: bad })}`);
4875
5009
  process.exitCode = EXIT_CODES.FAILURE;
4876
5010
  }
4877
5011
  } catch (err2) {
4878
- log10(
5012
+ log11(
4879
5013
  `
4880
- ${t35("cli.doctor.build_failed", {
5014
+ ${t36("cli.doctor.build_failed", {
4881
5015
  message: err2 instanceof Error ? err2.message : String(err2)
4882
5016
  })}`
4883
5017
  );
@@ -4890,27 +5024,27 @@ import { resolve as resolve4 } from "path";
4890
5024
  import {
4891
5025
  hasExecTierContent as hasExecTierContent2,
4892
5026
  inventoryProjectExtensions as inventoryProjectExtensions2,
4893
- loadConfig as loadConfig6,
5027
+ loadConfig as loadConfig7,
4894
5028
  TrustManager as TrustManager3
4895
5029
  } from "@epoch-agent/core";
4896
- import { t as t36, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
4897
- 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");
4898
5032
  var warn3 = (msg) => process.stderr.write(msg + "\n");
4899
5033
  function scopeLabel(scope) {
4900
- 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");
4901
5035
  }
4902
5036
  function tierLabel(record) {
4903
- if (record.level !== "trusted") return t36("trust.tier_none");
4904
- 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");
4905
5039
  }
4906
5040
  function levelLabel(level) {
4907
5041
  switch (level) {
4908
5042
  case "trusted":
4909
- return t36("trust.level_trusted");
5043
+ return t37("trust.level_trusted");
4910
5044
  case "untrusted":
4911
- return t36("trust.level_untrusted");
5045
+ return t37("trust.level_untrusted");
4912
5046
  case "unknown":
4913
- return t36("trust.level_unknown");
5047
+ return t37("trust.level_unknown");
4914
5048
  }
4915
5049
  }
4916
5050
  function physicalPath(input2) {
@@ -4923,62 +5057,62 @@ function physicalPath(input2) {
4923
5057
  }
4924
5058
  }
4925
5059
  function registerTrustCommand(program2) {
4926
- const cmd = program2.command("trust").description(t36("trust.cmd_root"));
4927
- cmd.command("list", { isDefault: true }).description(t36("trust.cmd_list")).action(() => withTrust((tm) => printList3(tm)));
4928
- 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) => {
4929
5063
  withTrust((tm) => {
4930
5064
  const dir = physicalPath(path ?? process.cwd());
4931
5065
  const scope = opts.tree ? "directory-tree" : "directory";
4932
5066
  tm.record(dir, "trusted", scope, { exec: opts.exec === true });
4933
- log11(`\u2713 ${t36("trust.added", { dir, scope: scopeLabel(scope) })}`);
5067
+ log12(`\u2713 ${t37("trust.added", { dir, scope: scopeLabel(scope) })}`);
4934
5068
  if (!opts.exec && hasExecTierContent2(inventoryProjectExtensions2(dir))) {
4935
- log11(t36("trust.added_read_only_hint", { dir }));
5069
+ log12(t37("trust.added_read_only_hint", { dir }));
4936
5070
  }
4937
5071
  });
4938
5072
  });
4939
- 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) => {
4940
5074
  withTrust((tm) => {
4941
5075
  const dir = physicalPath(path ?? process.cwd());
4942
5076
  tm.record(dir, "untrusted", opts.tree ? "directory-tree" : "directory");
4943
- log11(
4944
- `\u2717 ${t36("trust.denied", {
5077
+ log12(
5078
+ `\u2717 ${t37("trust.denied", {
4945
5079
  dir,
4946
5080
  scope: scopeLabel(opts.tree ? "directory-tree" : "directory")
4947
5081
  })}`
4948
5082
  );
4949
5083
  });
4950
5084
  });
4951
- 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) => {
4952
5086
  withTrust((tm) => {
4953
5087
  const dir = physicalPath(path);
4954
5088
  if (!tm.list().some((r) => resolve4(r.path) === dir)) {
4955
- warn3(t36("trust.no_record", { dir }));
5089
+ warn3(t37("trust.no_record", { dir }));
4956
5090
  process.exit(1);
4957
5091
  }
4958
5092
  tm.revoke(dir);
4959
- log11(t36("trust.removed", { dir, level: levelLabel(tm.check(dir)) }));
5093
+ log12(t37("trust.removed", { dir, level: levelLabel(tm.check(dir)) }));
4960
5094
  });
4961
5095
  });
4962
5096
  }
4963
5097
  function printList3(tm) {
4964
- if (loadConfig6().trust?.enabled === false) {
4965
- warn3(t36("trust.gate_off"));
5098
+ if (loadConfig7().trust?.enabled === false) {
5099
+ warn3(t37("trust.gate_off"));
4966
5100
  }
4967
- log11(t36("trust.list_head", { path: trustPath3(EPOCH_HOME) }));
5101
+ log12(t37("trust.list_head", { path: trustPath3(EPOCH_HOME) }));
4968
5102
  const records = [...tm.list()].sort((a, b) => a.path.localeCompare(b.path));
4969
5103
  if (records.length === 0) {
4970
- log11(t36("trust.list_empty"));
5104
+ log12(t37("trust.list_empty"));
4971
5105
  }
4972
5106
  for (const r of records) {
4973
5107
  const mark = r.level === "trusted" ? "\u2713" : "\u2717";
4974
- const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t36("trust.when_unknown");
4975
- 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}`);
4976
5110
  }
4977
5111
  const cwd = process.cwd();
4978
- log11(
5112
+ log12(
4979
5113
  `
4980
- ${t36("trust.cwd_line", { cwd })}
4981
- ${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)) })}`
4982
5116
  );
4983
5117
  }
4984
5118
  function withTrust(fn) {
@@ -4987,46 +5121,46 @@ function withTrust(fn) {
4987
5121
  try {
4988
5122
  fn(tm);
4989
5123
  } catch (err2) {
4990
- 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) }));
4991
5125
  process.exit(1);
4992
5126
  }
4993
5127
  }
4994
5128
  // src/commands/upgrade.ts
4995
- import { t as t37 } from "@epoch-agent/infra";
4996
- var log12 = (msg) => process.stdout.write(`${msg}
5129
+ import { t as t38 } from "@epoch-agent/infra";
5130
+ var log13 = (msg) => process.stdout.write(`${msg}
4997
5131
  `);
4998
5132
  function registerUpgradeCommand(program2) {
4999
- program2.command("upgrade").description(t37("upgrade.cmd_root")).action(async () => {
5133
+ program2.command("upgrade").description(t38("upgrade.cmd_root")).action(async () => {
5000
5134
  const self = selfPackage();
5001
5135
  const info = getInstallationInfo(self.name);
5002
- log12(t37("upgrade.current", { version: self.version }));
5003
- log12(
5004
- t37("upgrade.installed_via", {
5136
+ log13(t38("upgrade.current", { version: self.version }));
5137
+ log13(
5138
+ t38("upgrade.installed_via", {
5005
5139
  manager: info.packageManager,
5006
- global: info.isGlobal ? t37("installation.global_suffix") : "",
5140
+ global: info.isGlobal ? t38("installation.global_suffix") : "",
5007
5141
  note: info.note
5008
5142
  })
5009
5143
  );
5010
5144
  const notice = isUpdateCheckDisabled() ? readUpdateNotice() : await refreshUpdateCache({ ttlMs: 0 }).catch(() => null);
5011
5145
  if (notice) {
5012
- log12(`
5013
- ${t37("upgrade.available", { current: notice.current, latest: notice.latest })}`);
5014
- } else log12(`
5015
- ${t37("upgrade.none")}`);
5146
+ log13(`
5147
+ ${t38("upgrade.available", { current: notice.current, latest: notice.latest })}`);
5148
+ } else log13(`
5149
+ ${t38("upgrade.none")}`);
5016
5150
  if (info.updateCommand) {
5017
- log12(`
5018
- ${t37("upgrade.how")}
5151
+ log13(`
5152
+ ${t38("upgrade.how")}
5019
5153
  ${info.updateCommand}`);
5020
- log12(`
5021
- ${t37("upgrade.why_manual")}`);
5154
+ log13(`
5155
+ ${t38("upgrade.why_manual")}`);
5022
5156
  }
5023
5157
  });
5024
- 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 () => {
5025
5159
  await refreshUpdateCache().catch(() => null);
5026
5160
  });
5027
5161
  }
5028
5162
  // src/commands/web.ts
5029
- import { t as t38 } from "@epoch-agent/infra";
5163
+ import { t as t39 } from "@epoch-agent/infra";
5030
5164
  import { diagnosticToLine } from "@epoch-agent/protocol";
5031
5165
  import { buildRuntime as buildRuntime3 } from "@epoch-agent/runtime";
5032
5166
  import {
@@ -5074,7 +5208,7 @@ var err = (msg) => {
5074
5208
  `);
5075
5209
  };
5076
5210
  function registerWebCommand(program2) {
5077
- 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) => {
5078
5212
  await runWeb({ ...opts, json: jsonRequested(opts.json, command.parent?.opts()["json"]) });
5079
5213
  });
5080
5214
  }
@@ -5083,7 +5217,7 @@ function jsonRequested(own, fromProgram) {
5083
5217
  }
5084
5218
  async function runWeb(opts) {
5085
5219
  const port = parsePort2(opts.port);
5086
- 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) }));
5087
5221
  const binding = decideBinding({
5088
5222
  ...opts.host === void 0 ? {} : { host: opts.host },
5089
5223
  ...port === void 0 ? {} : { port },
@@ -5097,7 +5231,7 @@ async function runWeb(opts) {
5097
5231
  const { server } = booted;
5098
5232
  const json = opts.json === true;
5099
5233
  const say = json ? err : out;
5100
- 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);
5101
5235
  const lines = announceLines({
5102
5236
  url: server.url,
5103
5237
  host: server.host,
@@ -5108,12 +5242,12 @@ async function runWeb(opts) {
5108
5242
  json
5109
5243
  });
5110
5244
  if (lines.machine) out(lines.machine);
5111
- for (const line of lines.human) say(line);
5245
+ for (const line2 of lines.human) say(line2);
5112
5246
  if (opts.open && !openInBrowser(server.url)) say(browserFailed());
5113
5247
  installShutdown2(server, say);
5114
5248
  }
5115
- var missingWebRoot = () => t38("cli.web.missing_root");
5116
- var browserFailed = () => ` ${t38("cli.web.browser_failed")}`;
5249
+ var missingWebRoot = () => t39("cli.web.missing_root");
5250
+ var browserFailed = () => ` ${t39("cli.web.browser_failed")}`;
5117
5251
  function pluginsOption(plugins) {
5118
5252
  return plugins ? { hostMarketplaces: { sources: [] } } : {};
5119
5253
  }
@@ -5143,17 +5277,17 @@ async function boot(binding, plugins) {
5143
5277
  };
5144
5278
  }
5145
5279
  function noProviderLines(providerDiagnostics) {
5146
- return [` ${t38("cli.web.no_provider_warn")}`, ...providerDiagnostics.map((line) => ` ${line}`)];
5280
+ return [` ${t39("cli.web.no_provider_warn")}`, ...providerDiagnostics.map((line2) => ` ${line2}`)];
5147
5281
  }
5148
5282
  function announceLines(input2) {
5149
5283
  const human = [];
5150
5284
  if (!input2.json) {
5151
5285
  human.push(` Epoch Web http://${input2.host}:${input2.port}`);
5152
- human.push(` ${t38("cli.web.open_this")}
5286
+ human.push(` ${t39("cli.web.open_this")}
5153
5287
  ${input2.url}`);
5154
5288
  }
5155
5289
  if (input2.lanExposed) {
5156
- human.push(` ${t38("cli.web.lan_exposed")}`);
5290
+ human.push(` ${t39("cli.web.lan_exposed")}`);
5157
5291
  }
5158
5292
  if (input2.placeholder) human.push(` \u26A0 ${missingWebRoot()}`);
5159
5293
  if (!input2.json) return { human };
@@ -5171,7 +5305,7 @@ function installShutdown2(server, say) {
5171
5305
  if (shuttingDown) process.exit(1);
5172
5306
  shuttingDown = true;
5173
5307
  say(`
5174
- ${t38("cli.web.shutting_down")}`);
5308
+ ${t39("cli.web.shutting_down")}`);
5175
5309
  server.close().then(
5176
5310
  () => process.exit(0),
5177
5311
  () => process.exit(1)
@@ -5190,17 +5324,17 @@ function fail(message) {
5190
5324
  process.exit(1);
5191
5325
  }
5192
5326
  // src/language.ts
5193
- import { loadConfig as loadConfig7, setDisplayCurrency } from "@epoch-agent/core";
5327
+ import { loadConfig as loadConfig8, setDisplayCurrency } from "@epoch-agent/core";
5194
5328
  import { resolveLang, setLang } from "@epoch-agent/infra";
5195
5329
  function applyConfiguredLanguage() {
5196
5330
  try {
5197
- setLang(resolveLang(loadConfig7().display?.language));
5331
+ setLang(resolveLang(loadConfig8().display?.language));
5198
5332
  } catch {
5199
5333
  }
5200
5334
  }
5201
5335
  function applyConfiguredCurrency() {
5202
5336
  try {
5203
- setDisplayCurrency(loadConfig7().display?.currency);
5337
+ setDisplayCurrency(loadConfig8().display?.currency);
5204
5338
  } catch {
5205
5339
  }
5206
5340
  }
@@ -5208,7 +5342,7 @@ function applyConfiguredCurrency() {
5208
5342
  applyConfiguredLanguage();
5209
5343
  applyConfiguredCurrency();
5210
5344
  var program = new Command();
5211
- program.name("epoch").description(t39("cli.program_description"));
5345
+ program.name("epoch").description(t40("cli.program_description"));
5212
5346
  registerConfigCommand(program);
5213
5347
  registerMcpCommand(program);
5214
5348
  registerModelCommand(program);