@epoch-agent/cli 0.9.0 → 0.10.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.
- package/dist/index.js +114 -27
- package/dist/tui-entry.js +86 -15
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -368,7 +368,7 @@ function buildEngine() {
|
|
|
368
368
|
actions: { ...DEFAULT_COMPLIANCE_SETTINGS.actions, ...config.compliance?.actions }
|
|
369
369
|
};
|
|
370
370
|
const userDir = resolveComplianceDir(config.homeDir);
|
|
371
|
-
const dirs = resolveComplianceDirs({ userDir,
|
|
371
|
+
const dirs = resolveComplianceDirs({ userDir, execTrusted: false });
|
|
372
372
|
const rules = [];
|
|
373
373
|
const exempt = [];
|
|
374
374
|
for (const spec of dirs.dirs) {
|
|
@@ -2741,6 +2741,9 @@ import { t as t21, trustedImportsPath, trustPath as trustPath2 } from "@epoch-ag
|
|
|
2741
2741
|
// src/trust-prompt.ts
|
|
2742
2742
|
import {
|
|
2743
2743
|
findProjectInstructions,
|
|
2744
|
+
hasExecTierContent,
|
|
2745
|
+
hasReadTierContent,
|
|
2746
|
+
inventoryProjectExtensions,
|
|
2744
2747
|
isNonInteractive as isNonInteractive5,
|
|
2745
2748
|
loadConfig as loadConfig2,
|
|
2746
2749
|
resolveProjectRoot,
|
|
@@ -2753,14 +2756,21 @@ function trustPromptTarget(deps) {
|
|
|
2753
2756
|
const root = resolveProjectRoot(deps.workDir);
|
|
2754
2757
|
if (deps.store.check(root) !== "unknown") return null;
|
|
2755
2758
|
const instructionsPath = findProjectInstructions(root, deps.workDir);
|
|
2756
|
-
|
|
2757
|
-
|
|
2759
|
+
const inventory = inventoryProjectExtensions(root);
|
|
2760
|
+
const hasExec = hasExecTierContent(inventory);
|
|
2761
|
+
if (!instructionsPath && !hasReadTierContent(inventory) && !hasExec) return null;
|
|
2762
|
+
return {
|
|
2763
|
+
root,
|
|
2764
|
+
...instructionsPath ? { instructionsPath } : {},
|
|
2765
|
+
inventory,
|
|
2766
|
+
hasExec
|
|
2767
|
+
};
|
|
2758
2768
|
}
|
|
2759
2769
|
function applyTrustChoice(store, root, choice) {
|
|
2760
2770
|
if (choice.kind === "trust") {
|
|
2761
|
-
store.record(root, "trusted", choice.scope);
|
|
2771
|
+
store.record(root, "trusted", choice.scope, { exec: choice.exec });
|
|
2762
2772
|
const suffix = choice.scope === "directory-tree" ? t20("trust_prompt.granted_tree_suffix") : "";
|
|
2763
|
-
return t20("trust_prompt.granted", { root, suffix });
|
|
2773
|
+
return choice.exec ? t20("trust_prompt.granted_exec", { root, suffix }) : t20("trust_prompt.granted", { root, suffix });
|
|
2764
2774
|
}
|
|
2765
2775
|
if (choice.kind === "never") {
|
|
2766
2776
|
store.record(root, "untrusted", "directory");
|
|
@@ -2769,18 +2779,45 @@ function applyTrustChoice(store, root, choice) {
|
|
|
2769
2779
|
return t20("trust_prompt.skipped");
|
|
2770
2780
|
}
|
|
2771
2781
|
function trustPromptMessage(target) {
|
|
2772
|
-
|
|
2773
|
-
`
|
|
2774
|
-
${t20("trust_prompt.head", { path: target.instructionsPath })}
|
|
2775
|
-
|
|
2776
|
-
""
|
|
2777
|
-
]
|
|
2782
|
+
const lines = [
|
|
2783
|
+
target.instructionsPath ? `
|
|
2784
|
+
${t20("trust_prompt.head", { path: target.instructionsPath })}` : `
|
|
2785
|
+
${t20("trust_prompt.head_dir", { dir: target.root })}`,
|
|
2786
|
+
` ${t20("trust_prompt.why")}`
|
|
2787
|
+
];
|
|
2788
|
+
const inv = target.inventory;
|
|
2789
|
+
const read = [];
|
|
2790
|
+
if (inv.instructionFiles.length > 0) {
|
|
2791
|
+
read.push(t20("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
|
|
2792
|
+
}
|
|
2793
|
+
if (inv.skills > 0) read.push(t20("trust_prompt.item_skills", { n: inv.skills }));
|
|
2794
|
+
if (inv.roles > 0) read.push(t20("trust_prompt.item_roles", { n: inv.roles }));
|
|
2795
|
+
if (inv.commands > 0) read.push(t20("trust_prompt.item_commands", { n: inv.commands }));
|
|
2796
|
+
const sep = t20("trust_prompt.item_sep");
|
|
2797
|
+
if (read.length > 0) lines.push(` ${t20("trust_prompt.tier_read_head")} ${read.join(sep)}`);
|
|
2798
|
+
const exec = [];
|
|
2799
|
+
if (inv.hookFiles.length > 0) {
|
|
2800
|
+
exec.push(t20("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
|
|
2801
|
+
}
|
|
2802
|
+
if (inv.policies > 0) exec.push(t20("trust_prompt.item_policies", { n: inv.policies }));
|
|
2803
|
+
if (inv.settingsFiles.length > 0) {
|
|
2804
|
+
exec.push(t20("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
|
|
2805
|
+
}
|
|
2806
|
+
if (exec.length > 0) lines.push(` ${t20("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
|
|
2807
|
+
lines.push("");
|
|
2808
|
+
return lines.join("\n");
|
|
2778
2809
|
}
|
|
2779
2810
|
function choices() {
|
|
2780
2811
|
return [
|
|
2781
2812
|
{ name: t20("trust_prompt.choice_skip"), value: { kind: "skip" } },
|
|
2782
|
-
{
|
|
2783
|
-
|
|
2813
|
+
{
|
|
2814
|
+
name: t20("trust_prompt.choice_dir"),
|
|
2815
|
+
value: { kind: "trust", scope: "directory", exec: false }
|
|
2816
|
+
},
|
|
2817
|
+
{
|
|
2818
|
+
name: t20("trust_prompt.choice_tree"),
|
|
2819
|
+
value: { kind: "trust", scope: "directory-tree", exec: false }
|
|
2820
|
+
},
|
|
2784
2821
|
{ name: t20("trust_prompt.choice_never"), value: { kind: "never" } }
|
|
2785
2822
|
];
|
|
2786
2823
|
}
|
|
@@ -2804,6 +2841,10 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2804
2841
|
let choice;
|
|
2805
2842
|
try {
|
|
2806
2843
|
choice = await (opts.ask ?? askTrustChoice)(target);
|
|
2844
|
+
if (choice?.kind === "trust" && target.hasExec) {
|
|
2845
|
+
const exec = await (opts.askExec ?? askExecChoice)(target);
|
|
2846
|
+
choice = { ...choice, exec: exec === true };
|
|
2847
|
+
}
|
|
2807
2848
|
} finally {
|
|
2808
2849
|
(opts.restoreStdin ?? restoreStdinDefault)();
|
|
2809
2850
|
}
|
|
@@ -2819,6 +2860,22 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2819
2860
|
}
|
|
2820
2861
|
return true;
|
|
2821
2862
|
}
|
|
2863
|
+
async function askExecChoice(_target) {
|
|
2864
|
+
const { select: select2 } = await import("@inquirer/prompts");
|
|
2865
|
+
try {
|
|
2866
|
+
const options = [
|
|
2867
|
+
{ name: t20("trust_prompt.exec_choice_no"), value: false },
|
|
2868
|
+
{ name: t20("trust_prompt.exec_choice_yes"), value: true }
|
|
2869
|
+
];
|
|
2870
|
+
return await select2({
|
|
2871
|
+
message: t20("trust_prompt.exec_ask"),
|
|
2872
|
+
choices: options,
|
|
2873
|
+
default: options[0]?.value
|
|
2874
|
+
});
|
|
2875
|
+
} catch {
|
|
2876
|
+
return null;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2822
2879
|
async function askTrustChoice(_target) {
|
|
2823
2880
|
const { select: select2 } = await import("@inquirer/prompts");
|
|
2824
2881
|
try {
|
|
@@ -2968,6 +3025,18 @@ function createStreamWriter(enabled, sink) {
|
|
|
2968
3025
|
err2(body + (endsNl ? "\n" : ""));
|
|
2969
3026
|
midLive = !endsNl;
|
|
2970
3027
|
},
|
|
3028
|
+
notice(line) {
|
|
3029
|
+
if (!enabled || !line) return;
|
|
3030
|
+
if (midText) {
|
|
3031
|
+
out2("\n");
|
|
3032
|
+
midText = false;
|
|
3033
|
+
}
|
|
3034
|
+
if (midLive) {
|
|
3035
|
+
err2("\n");
|
|
3036
|
+
midLive = false;
|
|
3037
|
+
}
|
|
3038
|
+
err2(line.endsWith("\n") ? line : line + "\n");
|
|
3039
|
+
},
|
|
2971
3040
|
end() {
|
|
2972
3041
|
if (!enabled) return;
|
|
2973
3042
|
if (midLive) {
|
|
@@ -3132,8 +3201,11 @@ function collect2(out2, ev, w) {
|
|
|
3132
3201
|
out2.turns = ev.turn;
|
|
3133
3202
|
} else if (ev.type === "usage") {
|
|
3134
3203
|
out2.usage = ev.cumulative;
|
|
3204
|
+
} else if (ev.type === "notice") {
|
|
3205
|
+
w.notice(ev.text);
|
|
3135
3206
|
} else if (ev.type === "error") {
|
|
3136
3207
|
out2.text = t22("run_once.error_prefix", { message: ev.message });
|
|
3208
|
+
w.notice(out2.text);
|
|
3137
3209
|
process.exitCode = EXIT_CODES.FAILURE;
|
|
3138
3210
|
} else if (ev.type === "finish") {
|
|
3139
3211
|
out2.finishReason = ev.reason;
|
|
@@ -4046,7 +4118,7 @@ function applyFix(store, scheduleId, pending) {
|
|
|
4046
4118
|
return added;
|
|
4047
4119
|
}
|
|
4048
4120
|
// src/schedule/view.ts
|
|
4049
|
-
import { nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4121
|
+
import { formatUsd as formatUsd2, nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4050
4122
|
import { t as t32 } from "@epoch-agent/infra";
|
|
4051
4123
|
async function runList() {
|
|
4052
4124
|
const ctx = await openSchedule();
|
|
@@ -4091,7 +4163,7 @@ async function runShow(idOrPrefix) {
|
|
|
4091
4163
|
log9(
|
|
4092
4164
|
` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
|
|
4093
4165
|
turns: def.maxTurns,
|
|
4094
|
-
budget: def.maxBudgetUsd
|
|
4166
|
+
budget: formatUsd2(def.maxBudgetUsd, 2),
|
|
4095
4167
|
minutes: Math.round(def.timeoutMs / 6e4)
|
|
4096
4168
|
})
|
|
4097
4169
|
);
|
|
@@ -4143,7 +4215,7 @@ function printRun(run) {
|
|
|
4143
4215
|
log9(
|
|
4144
4216
|
` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t32("schedule.run_meta", {
|
|
4145
4217
|
turns: run.turns,
|
|
4146
|
-
cost: run.costUsd
|
|
4218
|
+
cost: formatUsd2(run.costUsd, 4),
|
|
4147
4219
|
manual: run.manual ? t32("schedule.run_manual") : ""
|
|
4148
4220
|
})
|
|
4149
4221
|
);
|
|
@@ -4633,13 +4705,22 @@ ${t35("cli.doctor.build_failed", {
|
|
|
4633
4705
|
// src/commands/trust.ts
|
|
4634
4706
|
import { existsSync as existsSync8, realpathSync as realpathSync3 } from "fs";
|
|
4635
4707
|
import { resolve as resolve4 } from "path";
|
|
4636
|
-
import {
|
|
4708
|
+
import {
|
|
4709
|
+
hasExecTierContent as hasExecTierContent2,
|
|
4710
|
+
inventoryProjectExtensions as inventoryProjectExtensions2,
|
|
4711
|
+
loadConfig as loadConfig5,
|
|
4712
|
+
TrustManager as TrustManager3
|
|
4713
|
+
} from "@epoch-agent/core";
|
|
4637
4714
|
import { t as t36, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
|
|
4638
4715
|
var log11 = (msg) => process.stdout.write(msg + "\n");
|
|
4639
4716
|
var warn3 = (msg) => process.stderr.write(msg + "\n");
|
|
4640
4717
|
function scopeLabel(scope) {
|
|
4641
4718
|
return scope === "directory-tree" ? t36("trust.scope_tree") : t36("trust.scope_dir");
|
|
4642
4719
|
}
|
|
4720
|
+
function tierLabel(record) {
|
|
4721
|
+
if (record.level !== "trusted") return t36("trust.tier_none");
|
|
4722
|
+
return record.exec === true ? t36("trust.tier_exec") : t36("trust.tier_read");
|
|
4723
|
+
}
|
|
4643
4724
|
function levelLabel(level) {
|
|
4644
4725
|
switch (level) {
|
|
4645
4726
|
case "trusted":
|
|
@@ -4662,16 +4743,15 @@ function physicalPath(input2) {
|
|
|
4662
4743
|
function registerTrustCommand(program2) {
|
|
4663
4744
|
const cmd = program2.command("trust").description(t36("trust.cmd_root"));
|
|
4664
4745
|
cmd.command("list", { isDefault: true }).description(t36("trust.cmd_list")).action(() => withTrust((tm) => printList3(tm)));
|
|
4665
|
-
cmd.command("add").description(t36("trust.cmd_add")).argument("[path]", t36("trust.arg_path_default")).option("--tree", t36("trust.opt_tree_add")).action((path, opts) => {
|
|
4746
|
+
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) => {
|
|
4666
4747
|
withTrust((tm) => {
|
|
4667
4748
|
const dir = physicalPath(path ?? process.cwd());
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
);
|
|
4749
|
+
const scope = opts.tree ? "directory-tree" : "directory";
|
|
4750
|
+
tm.record(dir, "trusted", scope, { exec: opts.exec === true });
|
|
4751
|
+
log11(`\u2713 ${t36("trust.added", { dir, scope: scopeLabel(scope) })}`);
|
|
4752
|
+
if (!opts.exec && hasExecTierContent2(inventoryProjectExtensions2(dir))) {
|
|
4753
|
+
log11(t36("trust.added_read_only_hint", { dir }));
|
|
4754
|
+
}
|
|
4675
4755
|
});
|
|
4676
4756
|
});
|
|
4677
4757
|
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) => {
|
|
@@ -4710,7 +4790,7 @@ function printList3(tm) {
|
|
|
4710
4790
|
for (const r of records) {
|
|
4711
4791
|
const mark = r.level === "trusted" ? "\u2713" : "\u2717";
|
|
4712
4792
|
const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t36("trust.when_unknown");
|
|
4713
|
-
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] ${when}`);
|
|
4793
|
+
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] [${tierLabel(r)}] ${when}`);
|
|
4714
4794
|
}
|
|
4715
4795
|
const cwd = process.cwd();
|
|
4716
4796
|
log11(
|
|
@@ -4928,7 +5008,7 @@ function fail(message) {
|
|
|
4928
5008
|
process.exit(1);
|
|
4929
5009
|
}
|
|
4930
5010
|
// src/language.ts
|
|
4931
|
-
import { loadConfig as loadConfig6 } from "@epoch-agent/core";
|
|
5011
|
+
import { loadConfig as loadConfig6, setDisplayCurrency } from "@epoch-agent/core";
|
|
4932
5012
|
import { resolveLang, setLang } from "@epoch-agent/infra";
|
|
4933
5013
|
function applyConfiguredLanguage() {
|
|
4934
5014
|
try {
|
|
@@ -4936,8 +5016,15 @@ function applyConfiguredLanguage() {
|
|
|
4936
5016
|
} catch {
|
|
4937
5017
|
}
|
|
4938
5018
|
}
|
|
5019
|
+
function applyConfiguredCurrency() {
|
|
5020
|
+
try {
|
|
5021
|
+
setDisplayCurrency(loadConfig6().display?.currency);
|
|
5022
|
+
} catch {
|
|
5023
|
+
}
|
|
5024
|
+
}
|
|
4939
5025
|
// src/index.ts
|
|
4940
5026
|
applyConfiguredLanguage();
|
|
5027
|
+
applyConfiguredCurrency();
|
|
4941
5028
|
var program = new Command();
|
|
4942
5029
|
program.name("epoch").description(t39("cli.program_description"));
|
|
4943
5030
|
registerConfigCommand(program);
|
package/dist/tui-entry.js
CHANGED
|
@@ -78,6 +78,9 @@ import { t as t3, trustedImportsPath, trustPath as trustPath2 } from "@epoch-age
|
|
|
78
78
|
// src/trust-prompt.ts
|
|
79
79
|
import {
|
|
80
80
|
findProjectInstructions,
|
|
81
|
+
hasExecTierContent,
|
|
82
|
+
hasReadTierContent,
|
|
83
|
+
inventoryProjectExtensions,
|
|
81
84
|
isNonInteractive,
|
|
82
85
|
loadConfig,
|
|
83
86
|
resolveProjectRoot,
|
|
@@ -90,14 +93,21 @@ function trustPromptTarget(deps) {
|
|
|
90
93
|
const root = resolveProjectRoot(deps.workDir);
|
|
91
94
|
if (deps.store.check(root) !== "unknown") return null;
|
|
92
95
|
const instructionsPath = findProjectInstructions(root, deps.workDir);
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
const inventory = inventoryProjectExtensions(root);
|
|
97
|
+
const hasExec = hasExecTierContent(inventory);
|
|
98
|
+
if (!instructionsPath && !hasReadTierContent(inventory) && !hasExec) return null;
|
|
99
|
+
return {
|
|
100
|
+
root,
|
|
101
|
+
...instructionsPath ? { instructionsPath } : {},
|
|
102
|
+
inventory,
|
|
103
|
+
hasExec
|
|
104
|
+
};
|
|
95
105
|
}
|
|
96
106
|
function applyTrustChoice(store, root, choice) {
|
|
97
107
|
if (choice.kind === "trust") {
|
|
98
|
-
store.record(root, "trusted", choice.scope);
|
|
108
|
+
store.record(root, "trusted", choice.scope, { exec: choice.exec });
|
|
99
109
|
const suffix = choice.scope === "directory-tree" ? t2("trust_prompt.granted_tree_suffix") : "";
|
|
100
|
-
return t2("trust_prompt.granted", { root, suffix });
|
|
110
|
+
return choice.exec ? t2("trust_prompt.granted_exec", { root, suffix }) : t2("trust_prompt.granted", { root, suffix });
|
|
101
111
|
}
|
|
102
112
|
if (choice.kind === "never") {
|
|
103
113
|
store.record(root, "untrusted", "directory");
|
|
@@ -106,18 +116,45 @@ function applyTrustChoice(store, root, choice) {
|
|
|
106
116
|
return t2("trust_prompt.skipped");
|
|
107
117
|
}
|
|
108
118
|
function trustPromptMessage(target) {
|
|
109
|
-
|
|
110
|
-
`
|
|
111
|
-
${t2("trust_prompt.head", { path: target.instructionsPath })}
|
|
112
|
-
|
|
113
|
-
""
|
|
114
|
-
]
|
|
119
|
+
const lines = [
|
|
120
|
+
target.instructionsPath ? `
|
|
121
|
+
${t2("trust_prompt.head", { path: target.instructionsPath })}` : `
|
|
122
|
+
${t2("trust_prompt.head_dir", { dir: target.root })}`,
|
|
123
|
+
` ${t2("trust_prompt.why")}`
|
|
124
|
+
];
|
|
125
|
+
const inv = target.inventory;
|
|
126
|
+
const read = [];
|
|
127
|
+
if (inv.instructionFiles.length > 0) {
|
|
128
|
+
read.push(t2("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
|
|
129
|
+
}
|
|
130
|
+
if (inv.skills > 0) read.push(t2("trust_prompt.item_skills", { n: inv.skills }));
|
|
131
|
+
if (inv.roles > 0) read.push(t2("trust_prompt.item_roles", { n: inv.roles }));
|
|
132
|
+
if (inv.commands > 0) read.push(t2("trust_prompt.item_commands", { n: inv.commands }));
|
|
133
|
+
const sep = t2("trust_prompt.item_sep");
|
|
134
|
+
if (read.length > 0) lines.push(` ${t2("trust_prompt.tier_read_head")} ${read.join(sep)}`);
|
|
135
|
+
const exec = [];
|
|
136
|
+
if (inv.hookFiles.length > 0) {
|
|
137
|
+
exec.push(t2("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
|
|
138
|
+
}
|
|
139
|
+
if (inv.policies > 0) exec.push(t2("trust_prompt.item_policies", { n: inv.policies }));
|
|
140
|
+
if (inv.settingsFiles.length > 0) {
|
|
141
|
+
exec.push(t2("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
|
|
142
|
+
}
|
|
143
|
+
if (exec.length > 0) lines.push(` ${t2("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
|
|
144
|
+
lines.push("");
|
|
145
|
+
return lines.join("\n");
|
|
115
146
|
}
|
|
116
147
|
function choices() {
|
|
117
148
|
return [
|
|
118
149
|
{ name: t2("trust_prompt.choice_skip"), value: { kind: "skip" } },
|
|
119
|
-
{
|
|
120
|
-
|
|
150
|
+
{
|
|
151
|
+
name: t2("trust_prompt.choice_dir"),
|
|
152
|
+
value: { kind: "trust", scope: "directory", exec: false }
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: t2("trust_prompt.choice_tree"),
|
|
156
|
+
value: { kind: "trust", scope: "directory-tree", exec: false }
|
|
157
|
+
},
|
|
121
158
|
{ name: t2("trust_prompt.choice_never"), value: { kind: "never" } }
|
|
122
159
|
];
|
|
123
160
|
}
|
|
@@ -141,6 +178,10 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
141
178
|
let choice;
|
|
142
179
|
try {
|
|
143
180
|
choice = await (opts.ask ?? askTrustChoice)(target);
|
|
181
|
+
if (choice?.kind === "trust" && target.hasExec) {
|
|
182
|
+
const exec = await (opts.askExec ?? askExecChoice)(target);
|
|
183
|
+
choice = { ...choice, exec: exec === true };
|
|
184
|
+
}
|
|
144
185
|
} finally {
|
|
145
186
|
(opts.restoreStdin ?? restoreStdinDefault)();
|
|
146
187
|
}
|
|
@@ -156,6 +197,22 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
156
197
|
}
|
|
157
198
|
return true;
|
|
158
199
|
}
|
|
200
|
+
async function askExecChoice(_target) {
|
|
201
|
+
const { select } = await import("@inquirer/prompts");
|
|
202
|
+
try {
|
|
203
|
+
const options = [
|
|
204
|
+
{ name: t2("trust_prompt.exec_choice_no"), value: false },
|
|
205
|
+
{ name: t2("trust_prompt.exec_choice_yes"), value: true }
|
|
206
|
+
];
|
|
207
|
+
return await select({
|
|
208
|
+
message: t2("trust_prompt.exec_ask"),
|
|
209
|
+
choices: options,
|
|
210
|
+
default: options[0]?.value
|
|
211
|
+
});
|
|
212
|
+
} catch {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
159
216
|
async function askTrustChoice(_target) {
|
|
160
217
|
const { select } = await import("@inquirer/prompts");
|
|
161
218
|
try {
|
|
@@ -346,7 +403,7 @@ function rejectText(item) {
|
|
|
346
403
|
return t4(REJECT_KEYS[item.reason], { keys: item.keys, winner: item.winner ?? "" });
|
|
347
404
|
}
|
|
348
405
|
// src/language.ts
|
|
349
|
-
import { loadConfig as loadConfig3 } from "@epoch-agent/core";
|
|
406
|
+
import { loadConfig as loadConfig3, setDisplayCurrency } from "@epoch-agent/core";
|
|
350
407
|
import { resolveLang, setLang } from "@epoch-agent/infra";
|
|
351
408
|
function applyConfiguredLanguage() {
|
|
352
409
|
try {
|
|
@@ -354,6 +411,12 @@ function applyConfiguredLanguage() {
|
|
|
354
411
|
} catch {
|
|
355
412
|
}
|
|
356
413
|
}
|
|
414
|
+
function applyConfiguredCurrency() {
|
|
415
|
+
try {
|
|
416
|
+
setDisplayCurrency(loadConfig3().display?.currency);
|
|
417
|
+
} catch {
|
|
418
|
+
}
|
|
419
|
+
}
|
|
357
420
|
// src/schedule/labels.ts
|
|
358
421
|
import { t as t5 } from "@epoch-agent/infra";
|
|
359
422
|
import {
|
|
@@ -1384,8 +1447,14 @@ function buildHostActions(runtime, workDir) {
|
|
|
1384
1447
|
readClipboardImage: () => readClipboardImage(),
|
|
1385
1448
|
supportsImages: () => {
|
|
1386
1449
|
try {
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1450
|
+
const sel = model?.get();
|
|
1451
|
+
const id = sel?.model ?? runtime.config.model;
|
|
1452
|
+
const caps = getCapability(
|
|
1453
|
+
id,
|
|
1454
|
+
runtime.config.homeDir,
|
|
1455
|
+
sel?.provider ?? runtime.config.provider.type
|
|
1456
|
+
);
|
|
1457
|
+
return caps.supportsImages || caps.imagesUnknown === true;
|
|
1389
1458
|
} catch {
|
|
1390
1459
|
return false;
|
|
1391
1460
|
}
|
|
@@ -1547,6 +1616,7 @@ var VERSION = readVersion();
|
|
|
1547
1616
|
var PENDING_SCAN_RUNS = 100;
|
|
1548
1617
|
async function main() {
|
|
1549
1618
|
applyConfiguredLanguage();
|
|
1619
|
+
applyConfiguredCurrency();
|
|
1550
1620
|
if (!await maybePromptForTrust()) {
|
|
1551
1621
|
process.exit(1);
|
|
1552
1622
|
}
|
|
@@ -1586,6 +1656,7 @@ ${runtime.diagnostics.join("\n")}
|
|
|
1586
1656
|
sessionId: session.sessionId,
|
|
1587
1657
|
translate: (key, vars) => t14(key, vars),
|
|
1588
1658
|
usageScope: runtime.usageScope,
|
|
1659
|
+
...config.display?.currency ? { currency: config.display.currency } : {},
|
|
1589
1660
|
app: { version: VERSION, cwd: process.cwd() },
|
|
1590
1661
|
config: {
|
|
1591
1662
|
model,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent CLI 入口",
|
|
6
6
|
"repository": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"commander": "^15.0.0",
|
|
23
23
|
"ink": "^7.1.1",
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epoch-agent/
|
|
26
|
-
"@epoch-agent/
|
|
27
|
-
"@epoch-agent/
|
|
28
|
-
"@epoch-agent/
|
|
29
|
-
"@epoch-agent/
|
|
30
|
-
"@epoch-agent/
|
|
25
|
+
"@epoch-agent/protocol": "0.10.0",
|
|
26
|
+
"@epoch-agent/core": "0.10.0",
|
|
27
|
+
"@epoch-agent/runtime": "0.10.0",
|
|
28
|
+
"@epoch-agent/server": "0.10.0",
|
|
29
|
+
"@epoch-agent/infra": "0.10.0",
|
|
30
|
+
"@epoch-agent/tui": "^0.10.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.1",
|