@epoch-agent/cli 0.8.1 → 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 +133 -33
- 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) {
|
|
@@ -499,6 +499,11 @@ var SECTION_FIELDS = {
|
|
|
499
499
|
compression: {
|
|
500
500
|
enabled: (v) => v === "true" || v === "false",
|
|
501
501
|
threshold: (v) => Number.isFinite(Number(v)) && Number(v) > 0 && Number(v) <= 1
|
|
502
|
+
},
|
|
503
|
+
memory: {
|
|
504
|
+
memoryCharLimit: isPositiveInt,
|
|
505
|
+
userCharLimit: isPositiveInt,
|
|
506
|
+
indexCharLimit: isPositiveInt
|
|
502
507
|
}
|
|
503
508
|
};
|
|
504
509
|
function knownKeys() {
|
|
@@ -2511,16 +2516,14 @@ ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
|
|
|
2511
2516
|
}
|
|
2512
2517
|
console.log("\n" + formatApprovalRequest(req).join("\n"));
|
|
2513
2518
|
if (req.plan) return await askPlan(req.plan);
|
|
2519
|
+
if (req.rememberable === false) {
|
|
2520
|
+
console.log(t17("approval.not_rememberable"));
|
|
2521
|
+
}
|
|
2514
2522
|
const { select: select2 } = await import("@inquirer/prompts");
|
|
2515
2523
|
try {
|
|
2516
2524
|
return await select2({
|
|
2517
2525
|
message: t17("approval.ask"),
|
|
2518
|
-
choices:
|
|
2519
|
-
{ name: t17("tui.approval.allow_once"), value: "allow-once" },
|
|
2520
|
-
{ name: t17("tui.approval.allow_session"), value: "allow-session" },
|
|
2521
|
-
{ name: t17("approval.allow_always_cli"), value: "allow-always" },
|
|
2522
|
-
{ name: t17("tui.approval.deny"), value: "deny" }
|
|
2523
|
-
],
|
|
2526
|
+
choices: approvalChoices(req),
|
|
2524
2527
|
default: "allow-once"
|
|
2525
2528
|
});
|
|
2526
2529
|
} catch {
|
|
@@ -2528,6 +2531,16 @@ ${t17("approval.headless_denied_hint", { tool: req.toolName })}`
|
|
|
2528
2531
|
}
|
|
2529
2532
|
};
|
|
2530
2533
|
}
|
|
2534
|
+
function approvalChoices(req) {
|
|
2535
|
+
return [
|
|
2536
|
+
{ name: t17("tui.approval.allow_once"), value: "allow-once" },
|
|
2537
|
+
...req.rememberable === false ? [] : [
|
|
2538
|
+
{ name: t17("tui.approval.allow_session"), value: "allow-session" },
|
|
2539
|
+
{ name: t17("approval.allow_always_cli"), value: "allow-always" }
|
|
2540
|
+
],
|
|
2541
|
+
{ name: t17("tui.approval.deny"), value: "deny" }
|
|
2542
|
+
];
|
|
2543
|
+
}
|
|
2531
2544
|
async function askPlan(proposal) {
|
|
2532
2545
|
const { input: input2, select: select2 } = await import("@inquirer/prompts");
|
|
2533
2546
|
const choices3 = [
|
|
@@ -2728,6 +2741,9 @@ import { t as t21, trustedImportsPath, trustPath as trustPath2 } from "@epoch-ag
|
|
|
2728
2741
|
// src/trust-prompt.ts
|
|
2729
2742
|
import {
|
|
2730
2743
|
findProjectInstructions,
|
|
2744
|
+
hasExecTierContent,
|
|
2745
|
+
hasReadTierContent,
|
|
2746
|
+
inventoryProjectExtensions,
|
|
2731
2747
|
isNonInteractive as isNonInteractive5,
|
|
2732
2748
|
loadConfig as loadConfig2,
|
|
2733
2749
|
resolveProjectRoot,
|
|
@@ -2740,14 +2756,21 @@ function trustPromptTarget(deps) {
|
|
|
2740
2756
|
const root = resolveProjectRoot(deps.workDir);
|
|
2741
2757
|
if (deps.store.check(root) !== "unknown") return null;
|
|
2742
2758
|
const instructionsPath = findProjectInstructions(root, deps.workDir);
|
|
2743
|
-
|
|
2744
|
-
|
|
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
|
+
};
|
|
2745
2768
|
}
|
|
2746
2769
|
function applyTrustChoice(store, root, choice) {
|
|
2747
2770
|
if (choice.kind === "trust") {
|
|
2748
|
-
store.record(root, "trusted", choice.scope);
|
|
2771
|
+
store.record(root, "trusted", choice.scope, { exec: choice.exec });
|
|
2749
2772
|
const suffix = choice.scope === "directory-tree" ? t20("trust_prompt.granted_tree_suffix") : "";
|
|
2750
|
-
return t20("trust_prompt.granted", { root, suffix });
|
|
2773
|
+
return choice.exec ? t20("trust_prompt.granted_exec", { root, suffix }) : t20("trust_prompt.granted", { root, suffix });
|
|
2751
2774
|
}
|
|
2752
2775
|
if (choice.kind === "never") {
|
|
2753
2776
|
store.record(root, "untrusted", "directory");
|
|
@@ -2756,18 +2779,45 @@ function applyTrustChoice(store, root, choice) {
|
|
|
2756
2779
|
return t20("trust_prompt.skipped");
|
|
2757
2780
|
}
|
|
2758
2781
|
function trustPromptMessage(target) {
|
|
2759
|
-
|
|
2760
|
-
`
|
|
2761
|
-
${t20("trust_prompt.head", { path: target.instructionsPath })}
|
|
2762
|
-
|
|
2763
|
-
""
|
|
2764
|
-
]
|
|
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");
|
|
2765
2809
|
}
|
|
2766
2810
|
function choices() {
|
|
2767
2811
|
return [
|
|
2768
2812
|
{ name: t20("trust_prompt.choice_skip"), value: { kind: "skip" } },
|
|
2769
|
-
{
|
|
2770
|
-
|
|
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
|
+
},
|
|
2771
2821
|
{ name: t20("trust_prompt.choice_never"), value: { kind: "never" } }
|
|
2772
2822
|
];
|
|
2773
2823
|
}
|
|
@@ -2791,6 +2841,10 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2791
2841
|
let choice;
|
|
2792
2842
|
try {
|
|
2793
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
|
+
}
|
|
2794
2848
|
} finally {
|
|
2795
2849
|
(opts.restoreStdin ?? restoreStdinDefault)();
|
|
2796
2850
|
}
|
|
@@ -2806,6 +2860,22 @@ async function maybePromptForTrust(opts = {}) {
|
|
|
2806
2860
|
}
|
|
2807
2861
|
return true;
|
|
2808
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
|
+
}
|
|
2809
2879
|
async function askTrustChoice(_target) {
|
|
2810
2880
|
const { select: select2 } = await import("@inquirer/prompts");
|
|
2811
2881
|
try {
|
|
@@ -2955,6 +3025,18 @@ function createStreamWriter(enabled, sink) {
|
|
|
2955
3025
|
err2(body + (endsNl ? "\n" : ""));
|
|
2956
3026
|
midLive = !endsNl;
|
|
2957
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
|
+
},
|
|
2958
3040
|
end() {
|
|
2959
3041
|
if (!enabled) return;
|
|
2960
3042
|
if (midLive) {
|
|
@@ -3119,8 +3201,11 @@ function collect2(out2, ev, w) {
|
|
|
3119
3201
|
out2.turns = ev.turn;
|
|
3120
3202
|
} else if (ev.type === "usage") {
|
|
3121
3203
|
out2.usage = ev.cumulative;
|
|
3204
|
+
} else if (ev.type === "notice") {
|
|
3205
|
+
w.notice(ev.text);
|
|
3122
3206
|
} else if (ev.type === "error") {
|
|
3123
3207
|
out2.text = t22("run_once.error_prefix", { message: ev.message });
|
|
3208
|
+
w.notice(out2.text);
|
|
3124
3209
|
process.exitCode = EXIT_CODES.FAILURE;
|
|
3125
3210
|
} else if (ev.type === "finish") {
|
|
3126
3211
|
out2.finishReason = ev.reason;
|
|
@@ -4033,7 +4118,7 @@ function applyFix(store, scheduleId, pending) {
|
|
|
4033
4118
|
return added;
|
|
4034
4119
|
}
|
|
4035
4120
|
// src/schedule/view.ts
|
|
4036
|
-
import { nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4121
|
+
import { formatUsd as formatUsd2, nextRunAt, readRecording } from "@epoch-agent/core";
|
|
4037
4122
|
import { t as t32 } from "@epoch-agent/infra";
|
|
4038
4123
|
async function runList() {
|
|
4039
4124
|
const ctx = await openSchedule();
|
|
@@ -4078,7 +4163,7 @@ async function runShow(idOrPrefix) {
|
|
|
4078
4163
|
log9(
|
|
4079
4164
|
` ${t32("schedule.field_limits")}: ` + t32("schedule.limits_value", {
|
|
4080
4165
|
turns: def.maxTurns,
|
|
4081
|
-
budget: def.maxBudgetUsd
|
|
4166
|
+
budget: formatUsd2(def.maxBudgetUsd, 2),
|
|
4082
4167
|
minutes: Math.round(def.timeoutMs / 6e4)
|
|
4083
4168
|
})
|
|
4084
4169
|
);
|
|
@@ -4130,7 +4215,7 @@ function printRun(run) {
|
|
|
4130
4215
|
log9(
|
|
4131
4216
|
` ${formatWhen(run.startedAt)} ${statusLabel(run.status)} ` + t32("schedule.run_meta", {
|
|
4132
4217
|
turns: run.turns,
|
|
4133
|
-
cost: run.costUsd
|
|
4218
|
+
cost: formatUsd2(run.costUsd, 4),
|
|
4134
4219
|
manual: run.manual ? t32("schedule.run_manual") : ""
|
|
4135
4220
|
})
|
|
4136
4221
|
);
|
|
@@ -4620,13 +4705,22 @@ ${t35("cli.doctor.build_failed", {
|
|
|
4620
4705
|
// src/commands/trust.ts
|
|
4621
4706
|
import { existsSync as existsSync8, realpathSync as realpathSync3 } from "fs";
|
|
4622
4707
|
import { resolve as resolve4 } from "path";
|
|
4623
|
-
import {
|
|
4708
|
+
import {
|
|
4709
|
+
hasExecTierContent as hasExecTierContent2,
|
|
4710
|
+
inventoryProjectExtensions as inventoryProjectExtensions2,
|
|
4711
|
+
loadConfig as loadConfig5,
|
|
4712
|
+
TrustManager as TrustManager3
|
|
4713
|
+
} from "@epoch-agent/core";
|
|
4624
4714
|
import { t as t36, trustPath as trustPath3, uiDateLocale as uiDateLocale4 } from "@epoch-agent/infra";
|
|
4625
4715
|
var log11 = (msg) => process.stdout.write(msg + "\n");
|
|
4626
4716
|
var warn3 = (msg) => process.stderr.write(msg + "\n");
|
|
4627
4717
|
function scopeLabel(scope) {
|
|
4628
4718
|
return scope === "directory-tree" ? t36("trust.scope_tree") : t36("trust.scope_dir");
|
|
4629
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
|
+
}
|
|
4630
4724
|
function levelLabel(level) {
|
|
4631
4725
|
switch (level) {
|
|
4632
4726
|
case "trusted":
|
|
@@ -4649,16 +4743,15 @@ function physicalPath(input2) {
|
|
|
4649
4743
|
function registerTrustCommand(program2) {
|
|
4650
4744
|
const cmd = program2.command("trust").description(t36("trust.cmd_root"));
|
|
4651
4745
|
cmd.command("list", { isDefault: true }).description(t36("trust.cmd_list")).action(() => withTrust((tm) => printList3(tm)));
|
|
4652
|
-
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) => {
|
|
4653
4747
|
withTrust((tm) => {
|
|
4654
4748
|
const dir = physicalPath(path ?? process.cwd());
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
);
|
|
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
|
+
}
|
|
4662
4755
|
});
|
|
4663
4756
|
});
|
|
4664
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) => {
|
|
@@ -4697,7 +4790,7 @@ function printList3(tm) {
|
|
|
4697
4790
|
for (const r of records) {
|
|
4698
4791
|
const mark = r.level === "trusted" ? "\u2713" : "\u2717";
|
|
4699
4792
|
const when = r.decidedAt ? new Date(r.decidedAt).toLocaleString(uiDateLocale4()) : t36("trust.when_unknown");
|
|
4700
|
-
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] ${when}`);
|
|
4793
|
+
log11(` ${mark} ${r.path} [${scopeLabel(r.scope)}] [${tierLabel(r)}] ${when}`);
|
|
4701
4794
|
}
|
|
4702
4795
|
const cwd = process.cwd();
|
|
4703
4796
|
log11(
|
|
@@ -4915,7 +5008,7 @@ function fail(message) {
|
|
|
4915
5008
|
process.exit(1);
|
|
4916
5009
|
}
|
|
4917
5010
|
// src/language.ts
|
|
4918
|
-
import { loadConfig as loadConfig6 } from "@epoch-agent/core";
|
|
5011
|
+
import { loadConfig as loadConfig6, setDisplayCurrency } from "@epoch-agent/core";
|
|
4919
5012
|
import { resolveLang, setLang } from "@epoch-agent/infra";
|
|
4920
5013
|
function applyConfiguredLanguage() {
|
|
4921
5014
|
try {
|
|
@@ -4923,8 +5016,15 @@ function applyConfiguredLanguage() {
|
|
|
4923
5016
|
} catch {
|
|
4924
5017
|
}
|
|
4925
5018
|
}
|
|
5019
|
+
function applyConfiguredCurrency() {
|
|
5020
|
+
try {
|
|
5021
|
+
setDisplayCurrency(loadConfig6().display?.currency);
|
|
5022
|
+
} catch {
|
|
5023
|
+
}
|
|
5024
|
+
}
|
|
4926
5025
|
// src/index.ts
|
|
4927
5026
|
applyConfiguredLanguage();
|
|
5027
|
+
applyConfiguredCurrency();
|
|
4928
5028
|
var program = new Command();
|
|
4929
5029
|
program.name("epoch").description(t39("cli.program_description"));
|
|
4930
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",
|