@epoch-agent/cli 0.9.0 → 0.10.1
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 +119 -29
- 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) {
|
|
@@ -2573,7 +2573,7 @@ import {
|
|
|
2573
2573
|
matchPreauthorization,
|
|
2574
2574
|
mergeHeadlessPolicy
|
|
2575
2575
|
} from "@epoch-agent/core";
|
|
2576
|
-
import { t as t18 } from "@epoch-agent/infra";
|
|
2576
|
+
import { createStreamDecoder, t as t18 } from "@epoch-agent/infra";
|
|
2577
2577
|
import { APPROVAL_OUTCOMES as APPROVAL_OUTCOMES2, isApprovalOutcome as isApprovalOutcome2 } from "@epoch-agent/protocol";
|
|
2578
2578
|
var APPROVER_TIMEOUT_MS = 6e4;
|
|
2579
2579
|
var MAX_STDOUT_BYTES = 64 * 1024;
|
|
@@ -2640,8 +2640,10 @@ function askExternalApprover(program2, payload, opts = {}) {
|
|
|
2640
2640
|
clearTimeout(timer);
|
|
2641
2641
|
settle(v);
|
|
2642
2642
|
};
|
|
2643
|
+
let decoder = null;
|
|
2643
2644
|
child.stdout?.on("data", (d) => {
|
|
2644
|
-
|
|
2645
|
+
decoder ??= createStreamDecoder();
|
|
2646
|
+
out2 += decoder.write(d);
|
|
2645
2647
|
if (out2.length > MAX_STDOUT_BYTES) {
|
|
2646
2648
|
child.kill("SIGKILL");
|
|
2647
2649
|
done({ ok: false, why: t18("approver.too_much_output", { bytes: MAX_STDOUT_BYTES }) });
|
|
@@ -2651,6 +2653,7 @@ function askExternalApprover(program2, payload, opts = {}) {
|
|
|
2651
2653
|
done({ ok: false, why: t18("approver.spawn_failed", { message: err2.message }) });
|
|
2652
2654
|
});
|
|
2653
2655
|
child.on("close", (code) => {
|
|
2656
|
+
out2 += decoder?.end() ?? "";
|
|
2654
2657
|
if (code !== 0) {
|
|
2655
2658
|
done({ ok: false, why: t18("approver.bad_exit", { code: code ?? -1 }) });
|
|
2656
2659
|
return;
|
|
@@ -2741,6 +2744,9 @@ import { t as t21, trustedImportsPath, trustPath as trustPath2 } from "@epoch-ag
|
|
|
2741
2744
|
// src/trust-prompt.ts
|
|
2742
2745
|
import {
|
|
2743
2746
|
findProjectInstructions,
|
|
2747
|
+
hasExecTierContent,
|
|
2748
|
+
hasReadTierContent,
|
|
2749
|
+
inventoryProjectExtensions,
|
|
2744
2750
|
isNonInteractive as isNonInteractive5,
|
|
2745
2751
|
loadConfig as loadConfig2,
|
|
2746
2752
|
resolveProjectRoot,
|
|
@@ -2753,14 +2759,21 @@ function trustPromptTarget(deps) {
|
|
|
2753
2759
|
const root = resolveProjectRoot(deps.workDir);
|
|
2754
2760
|
if (deps.store.check(root) !== "unknown") return null;
|
|
2755
2761
|
const instructionsPath = findProjectInstructions(root, deps.workDir);
|
|
2756
|
-
|
|
2757
|
-
|
|
2762
|
+
const inventory = inventoryProjectExtensions(root);
|
|
2763
|
+
const hasExec = hasExecTierContent(inventory);
|
|
2764
|
+
if (!instructionsPath && !hasReadTierContent(inventory) && !hasExec) return null;
|
|
2765
|
+
return {
|
|
2766
|
+
root,
|
|
2767
|
+
...instructionsPath ? { instructionsPath } : {},
|
|
2768
|
+
inventory,
|
|
2769
|
+
hasExec
|
|
2770
|
+
};
|
|
2758
2771
|
}
|
|
2759
2772
|
function applyTrustChoice(store, root, choice) {
|
|
2760
2773
|
if (choice.kind === "trust") {
|
|
2761
|
-
store.record(root, "trusted", choice.scope);
|
|
2774
|
+
store.record(root, "trusted", choice.scope, { exec: choice.exec });
|
|
2762
2775
|
const suffix = choice.scope === "directory-tree" ? t20("trust_prompt.granted_tree_suffix") : "";
|
|
2763
|
-
return t20("trust_prompt.granted", { root, suffix });
|
|
2776
|
+
return choice.exec ? t20("trust_prompt.granted_exec", { root, suffix }) : t20("trust_prompt.granted", { root, suffix });
|
|
2764
2777
|
}
|
|
2765
2778
|
if (choice.kind === "never") {
|
|
2766
2779
|
store.record(root, "untrusted", "directory");
|
|
@@ -2769,18 +2782,45 @@ function applyTrustChoice(store, root, choice) {
|
|
|
2769
2782
|
return t20("trust_prompt.skipped");
|
|
2770
2783
|
}
|
|
2771
2784
|
function trustPromptMessage(target) {
|
|
2772
|
-
|
|
2773
|
-
`
|
|
2774
|
-
${t20("trust_prompt.head", { path: target.instructionsPath })}
|
|
2775
|
-
|
|
2776
|
-
""
|
|
2777
|
-
]
|
|
2785
|
+
const lines = [
|
|
2786
|
+
target.instructionsPath ? `
|
|
2787
|
+
${t20("trust_prompt.head", { path: target.instructionsPath })}` : `
|
|
2788
|
+
${t20("trust_prompt.head_dir", { dir: target.root })}`,
|
|
2789
|
+
` ${t20("trust_prompt.why")}`
|
|
2790
|
+
];
|
|
2791
|
+
const inv = target.inventory;
|
|
2792
|
+
const read = [];
|
|
2793
|
+
if (inv.instructionFiles.length > 0) {
|
|
2794
|
+
read.push(t20("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
|
|
2795
|
+
}
|
|
2796
|
+
if (inv.skills > 0) read.push(t20("trust_prompt.item_skills", { n: inv.skills }));
|
|
2797
|
+
if (inv.roles > 0) read.push(t20("trust_prompt.item_roles", { n: inv.roles }));
|
|
2798
|
+
if (inv.commands > 0) read.push(t20("trust_prompt.item_commands", { n: inv.commands }));
|
|
2799
|
+
const sep = t20("trust_prompt.item_sep");
|
|
2800
|
+
if (read.length > 0) lines.push(` ${t20("trust_prompt.tier_read_head")} ${read.join(sep)}`);
|
|
2801
|
+
const exec = [];
|
|
2802
|
+
if (inv.hookFiles.length > 0) {
|
|
2803
|
+
exec.push(t20("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
|
|
2804
|
+
}
|
|
2805
|
+
if (inv.policies > 0) exec.push(t20("trust_prompt.item_policies", { n: inv.policies }));
|
|
2806
|
+
if (inv.settingsFiles.length > 0) {
|
|
2807
|
+
exec.push(t20("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
|
|
2808
|
+
}
|
|
2809
|
+
if (exec.length > 0) lines.push(` ${t20("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
|
|
2810
|
+
lines.push("");
|
|
2811
|
+
return lines.join("\n");
|
|
2778
2812
|
}
|
|
2779
2813
|
function choices() {
|
|
2780
2814
|
return [
|
|
2781
2815
|
{ name: t20("trust_prompt.choice_skip"), value: { kind: "skip" } },
|
|
2782
|
-
{
|
|
2783
|
-
|
|
2816
|
+
{
|
|
2817
|
+
name: t20("trust_prompt.choice_dir"),
|
|
2818
|
+
value: { kind: "trust", scope: "directory", exec: false }
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
name: t20("trust_prompt.choice_tree"),
|
|
2822
|
+
value: { kind: "trust", scope: "directory-tree", exec: false }
|
|
2823
|
+
},
|
|
2784
2824
|
{ name: t20("trust_prompt.choice_never"), value: { kind: "never" } }
|
|
2785
2825
|
];
|
|
2786
2826
|
}
|
|
@@ -2804,6 +2844,10 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2804
2844
|
let choice;
|
|
2805
2845
|
try {
|
|
2806
2846
|
choice = await (opts.ask ?? askTrustChoice)(target);
|
|
2847
|
+
if (choice?.kind === "trust" && target.hasExec) {
|
|
2848
|
+
const exec = await (opts.askExec ?? askExecChoice)(target);
|
|
2849
|
+
choice = { ...choice, exec: exec === true };
|
|
2850
|
+
}
|
|
2807
2851
|
} finally {
|
|
2808
2852
|
(opts.restoreStdin ?? restoreStdinDefault)();
|
|
2809
2853
|
}
|
|
@@ -2819,6 +2863,22 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2819
2863
|
}
|
|
2820
2864
|
return true;
|
|
2821
2865
|
}
|
|
2866
|
+
async function askExecChoice(_target) {
|
|
2867
|
+
const { select: select2 } = await import("@inquirer/prompts");
|
|
2868
|
+
try {
|
|
2869
|
+
const options = [
|
|
2870
|
+
{ name: t20("trust_prompt.exec_choice_no"), value: false },
|
|
2871
|
+
{ name: t20("trust_prompt.exec_choice_yes"), value: true }
|
|
2872
|
+
];
|
|
2873
|
+
return await select2({
|
|
2874
|
+
message: t20("trust_prompt.exec_ask"),
|
|
2875
|
+
choices: options,
|
|
2876
|
+
default: options[0]?.value
|
|
2877
|
+
});
|
|
2878
|
+
} catch {
|
|
2879
|
+
return null;
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2822
2882
|
async function askTrustChoice(_target) {
|
|
2823
2883
|
const { select: select2 } = await import("@inquirer/prompts");
|
|
2824
2884
|
try {
|
|
@@ -2968,6 +3028,18 @@ function createStreamWriter(enabled, sink) {
|
|
|
2968
3028
|
err2(body + (endsNl ? "\n" : ""));
|
|
2969
3029
|
midLive = !endsNl;
|
|
2970
3030
|
},
|
|
3031
|
+
notice(line) {
|
|
3032
|
+
if (!enabled || !line) return;
|
|
3033
|
+
if (midText) {
|
|
3034
|
+
out2("\n");
|
|
3035
|
+
midText = false;
|
|
3036
|
+
}
|
|
3037
|
+
if (midLive) {
|
|
3038
|
+
err2("\n");
|
|
3039
|
+
midLive = false;
|
|
3040
|
+
}
|
|
3041
|
+
err2(line.endsWith("\n") ? line : line + "\n");
|
|
3042
|
+
},
|
|
2971
3043
|
end() {
|
|
2972
3044
|
if (!enabled) return;
|
|
2973
3045
|
if (midLive) {
|
|
@@ -3132,8 +3204,11 @@ function collect2(out2, ev, w) {
|
|
|
3132
3204
|
out2.turns = ev.turn;
|
|
3133
3205
|
} else if (ev.type === "usage") {
|
|
3134
3206
|
out2.usage = ev.cumulative;
|
|
3207
|
+
} else if (ev.type === "notice") {
|
|
3208
|
+
w.notice(ev.text);
|
|
3135
3209
|
} else if (ev.type === "error") {
|
|
3136
3210
|
out2.text = t22("run_once.error_prefix", { message: ev.message });
|
|
3211
|
+
w.notice(out2.text);
|
|
3137
3212
|
process.exitCode = EXIT_CODES.FAILURE;
|
|
3138
3213
|
} else if (ev.type === "finish") {
|
|
3139
3214
|
out2.finishReason = ev.reason;
|
|
@@ -4046,7 +4121,7 @@ function applyFix(store, scheduleId, pending) {
|
|
|
4046
4121
|
return added;
|
|
4047
4122
|
}
|
|
4048
4123
|
// src/schedule/view.ts
|
|
4049
|
-
import { nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4124
|
+
import { formatUsd as formatUsd2, nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4050
4125
|
import { t as t32 } from "@epoch-agent/infra";
|
|
4051
4126
|
async function runList() {
|
|
4052
4127
|
const ctx = await openSchedule();
|
|
@@ -4091,7 +4166,7 @@ async function runShow(idOrPrefix) {
|
|
|
4091
4166
|
log9(
|
|
4092
4167
|
` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
|
|
4093
4168
|
turns: def.maxTurns,
|
|
4094
|
-
budget: def.maxBudgetUsd
|
|
4169
|
+
budget: formatUsd2(def.maxBudgetUsd, 2),
|
|
4095
4170
|
minutes: Math.round(def.timeoutMs / 6e4)
|
|
4096
4171
|
})
|
|
4097
4172
|
);
|
|
@@ -4143,7 +4218,7 @@ function printRun(run) {
|
|
|
4143
4218
|
log9(
|
|
4144
4219
|
` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t32("schedule.run_meta", {
|
|
4145
4220
|
turns: run.turns,
|
|
4146
|
-
cost: run.costUsd
|
|
4221
|
+
cost: formatUsd2(run.costUsd, 4),
|
|
4147
4222
|
manual: run.manual ? t32("schedule.run_manual") : ""
|
|
4148
4223
|
})
|
|
4149
4224
|
);
|
|
@@ -4633,13 +4708,22 @@ ${t35("cli.doctor.build_failed", {
|
|
|
4633
4708
|
// src/commands/trust.ts
|
|
4634
4709
|
import { existsSync as existsSync8, realpathSync as realpathSync3 } from "fs";
|
|
4635
4710
|
import { resolve as resolve4 } from "path";
|
|
4636
|
-
import {
|
|
4711
|
+
import {
|
|
4712
|
+
hasExecTierContent as hasExecTierContent2,
|
|
4713
|
+
inventoryProjectExtensions as inventoryProjectExtensions2,
|
|
4714
|
+
loadConfig as loadConfig5,
|
|
4715
|
+
TrustManager as TrustManager3
|
|
4716
|
+
} from "@epoch-agent/core";
|
|
4637
4717
|
import { t as t36, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
|
|
4638
4718
|
var log11 = (msg) => process.stdout.write(msg + "\n");
|
|
4639
4719
|
var warn3 = (msg) => process.stderr.write(msg + "\n");
|
|
4640
4720
|
function scopeLabel(scope) {
|
|
4641
4721
|
return scope === "directory-tree" ? t36("trust.scope_tree") : t36("trust.scope_dir");
|
|
4642
4722
|
}
|
|
4723
|
+
function tierLabel(record) {
|
|
4724
|
+
if (record.level !== "trusted") return t36("trust.tier_none");
|
|
4725
|
+
return record.exec === true ? t36("trust.tier_exec") : t36("trust.tier_read");
|
|
4726
|
+
}
|
|
4643
4727
|
function levelLabel(level) {
|
|
4644
4728
|
switch (level) {
|
|
4645
4729
|
case "trusted":
|
|
@@ -4662,16 +4746,15 @@ function physicalPath(input2) {
|
|
|
4662
4746
|
function registerTrustCommand(program2) {
|
|
4663
4747
|
const cmd = program2.command("trust").description(t36("trust.cmd_root"));
|
|
4664
4748
|
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) => {
|
|
4749
|
+
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
4750
|
withTrust((tm) => {
|
|
4667
4751
|
const dir = physicalPath(path ?? process.cwd());
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
);
|
|
4752
|
+
const scope = opts.tree ? "directory-tree" : "directory";
|
|
4753
|
+
tm.record(dir, "trusted", scope, { exec: opts.exec === true });
|
|
4754
|
+
log11(`\u2713 ${t36("trust.added", { dir, scope: scopeLabel(scope) })}`);
|
|
4755
|
+
if (!opts.exec && hasExecTierContent2(inventoryProjectExtensions2(dir))) {
|
|
4756
|
+
log11(t36("trust.added_read_only_hint", { dir }));
|
|
4757
|
+
}
|
|
4675
4758
|
});
|
|
4676
4759
|
});
|
|
4677
4760
|
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 +4793,7 @@ function printList3(tm) {
|
|
|
4710
4793
|
for (const r of records) {
|
|
4711
4794
|
const mark = r.level === "trusted" ? "\u2713" : "\u2717";
|
|
4712
4795
|
const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t36("trust.when_unknown");
|
|
4713
|
-
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] ${when}`);
|
|
4796
|
+
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] [${tierLabel(r)}] ${when}`);
|
|
4714
4797
|
}
|
|
4715
4798
|
const cwd = process.cwd();
|
|
4716
4799
|
log11(
|
|
@@ -4928,7 +5011,7 @@ function fail(message) {
|
|
|
4928
5011
|
process.exit(1);
|
|
4929
5012
|
}
|
|
4930
5013
|
// src/language.ts
|
|
4931
|
-
import { loadConfig as loadConfig6 } from "@epoch-agent/core";
|
|
5014
|
+
import { loadConfig as loadConfig6, setDisplayCurrency } from "@epoch-agent/core";
|
|
4932
5015
|
import { resolveLang, setLang } from "@epoch-agent/infra";
|
|
4933
5016
|
function applyConfiguredLanguage() {
|
|
4934
5017
|
try {
|
|
@@ -4936,8 +5019,15 @@ function applyConfiguredLanguage() {
|
|
|
4936
5019
|
} catch {
|
|
4937
5020
|
}
|
|
4938
5021
|
}
|
|
5022
|
+
function applyConfiguredCurrency() {
|
|
5023
|
+
try {
|
|
5024
|
+
setDisplayCurrency(loadConfig6().display?.currency);
|
|
5025
|
+
} catch {
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
4939
5028
|
// src/index.ts
|
|
4940
5029
|
applyConfiguredLanguage();
|
|
5030
|
+
applyConfiguredCurrency();
|
|
4941
5031
|
var program = new Command();
|
|
4942
5032
|
program.name("epoch").description(t39("cli.program_description"));
|
|
4943
5033
|
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.1",
|
|
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.1",
|
|
26
|
+
"@epoch-agent/tui": "^0.10.1",
|
|
27
|
+
"@epoch-agent/runtime": "0.10.1",
|
|
28
|
+
"@epoch-agent/core": "0.10.1",
|
|
29
|
+
"@epoch-agent/server": "0.10.1",
|
|
30
|
+
"@epoch-agent/infra": "0.10.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.1",
|