@epoch-agent/cli 4.1.1 → 6.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.
- package/README.md +11 -18
- package/dist/index.js +386 -539
- package/dist/tui-entry.js +141 -291
- package/package.json +7 -7
package/dist/tui-entry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/tui-entry.ts
|
|
2
2
|
import { capabilityOfRef as capabilityOfRef2, loadKeybindings } from "@epoch-agent/core";
|
|
3
|
-
import { keybindingsPath, t as
|
|
3
|
+
import { keybindingsPath, t as t13 } from "@epoch-agent/infra";
|
|
4
4
|
import { buildRuntime, withModelScope, withToolScope } from "@epoch-agent/runtime";
|
|
5
5
|
import { DEFAULT_KEYBINDINGS, renderApp } from "@epoch-agent/tui";
|
|
6
6
|
// src/errors.ts
|
|
@@ -68,171 +68,24 @@ ${t("errors.cancelled")}
|
|
|
68
68
|
import {
|
|
69
69
|
createImportGate,
|
|
70
70
|
ImportTrustStore,
|
|
71
|
-
isNonInteractive as isNonInteractive2,
|
|
72
|
-
loadConfig as loadConfig2,
|
|
73
|
-
resolveProjectRoot as resolveProjectRoot2,
|
|
74
|
-
scanInstructions,
|
|
75
|
-
setImportGate,
|
|
76
|
-
TrustManager as TrustManager2
|
|
77
|
-
} from "@epoch-agent/core";
|
|
78
|
-
import { t as t3, trustedImportsPath, trustPath as trustPath2 } from "@epoch-agent/infra";
|
|
79
|
-
// src/trust-prompt.ts
|
|
80
|
-
import {
|
|
81
|
-
findProjectInstructions,
|
|
82
|
-
hasExecTierContent,
|
|
83
|
-
hasReadTierContent,
|
|
84
|
-
inventoryProjectExtensions,
|
|
85
71
|
isNonInteractive,
|
|
86
72
|
loadConfig,
|
|
87
73
|
resolveProjectRoot,
|
|
74
|
+
scanInstructions,
|
|
75
|
+
setImportGate,
|
|
88
76
|
TrustManager
|
|
89
77
|
} from "@epoch-agent/core";
|
|
90
|
-
import { t as t2, trustPath } from "@epoch-agent/infra";
|
|
91
|
-
function trustPromptTarget(deps) {
|
|
92
|
-
if (!deps.gateEnabled) return null;
|
|
93
|
-
if (!deps.interactive) return null;
|
|
94
|
-
const root = resolveProjectRoot(deps.workDir);
|
|
95
|
-
if (deps.store.check(root) !== "unknown") return null;
|
|
96
|
-
const instructionsPath = findProjectInstructions(root, deps.workDir);
|
|
97
|
-
const inventory = inventoryProjectExtensions(root);
|
|
98
|
-
const hasExec = hasExecTierContent(inventory);
|
|
99
|
-
if (!instructionsPath && !hasReadTierContent(inventory) && !hasExec) return null;
|
|
100
|
-
return {
|
|
101
|
-
root,
|
|
102
|
-
...instructionsPath ? { instructionsPath } : {},
|
|
103
|
-
inventory,
|
|
104
|
-
hasExec
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function applyTrustChoice(store, root, choice) {
|
|
108
|
-
if (choice.kind === "trust") {
|
|
109
|
-
store.record(root, "trusted", choice.scope, { exec: choice.exec });
|
|
110
|
-
const suffix = choice.scope === "directory-tree" ? t2("trust_prompt.granted_tree_suffix") : "";
|
|
111
|
-
return choice.exec ? t2("trust_prompt.granted_exec", { root, suffix }) : t2("trust_prompt.granted", { root, suffix });
|
|
112
|
-
}
|
|
113
|
-
if (choice.kind === "never") {
|
|
114
|
-
store.record(root, "untrusted", "directory");
|
|
115
|
-
return t2("trust_prompt.denied", { root });
|
|
116
|
-
}
|
|
117
|
-
return t2("trust_prompt.skipped");
|
|
118
|
-
}
|
|
119
|
-
function trustPromptMessage(target) {
|
|
120
|
-
const lines = [
|
|
121
|
-
target.instructionsPath ? `
|
|
122
|
-
${t2("trust_prompt.head", { path: target.instructionsPath })}` : `
|
|
123
|
-
${t2("trust_prompt.head_dir", { dir: target.root })}`,
|
|
124
|
-
` ${t2("trust_prompt.why")}`
|
|
125
|
-
];
|
|
126
|
-
const inv = target.inventory;
|
|
127
|
-
const read = [];
|
|
128
|
-
if (inv.instructionFiles.length > 0) {
|
|
129
|
-
read.push(t2("trust_prompt.item_instructions", { n: inv.instructionFiles.length }));
|
|
130
|
-
}
|
|
131
|
-
if (inv.skills > 0) read.push(t2("trust_prompt.item_skills", { n: inv.skills }));
|
|
132
|
-
if (inv.roles > 0) read.push(t2("trust_prompt.item_roles", { n: inv.roles }));
|
|
133
|
-
if (inv.commands > 0) read.push(t2("trust_prompt.item_commands", { n: inv.commands }));
|
|
134
|
-
const sep = t2("trust_prompt.item_sep");
|
|
135
|
-
if (read.length > 0) lines.push(` ${t2("trust_prompt.tier_read_head")} ${read.join(sep)}`);
|
|
136
|
-
const exec = [];
|
|
137
|
-
if (inv.hookFiles.length > 0) {
|
|
138
|
-
exec.push(t2("trust_prompt.item_hooks", { files: inv.hookFiles.join(", ") }));
|
|
139
|
-
}
|
|
140
|
-
if (inv.policies > 0) exec.push(t2("trust_prompt.item_policies", { n: inv.policies }));
|
|
141
|
-
if (inv.settingsFiles.length > 0) {
|
|
142
|
-
exec.push(t2("trust_prompt.item_settings", { files: inv.settingsFiles.join(", ") }));
|
|
143
|
-
}
|
|
144
|
-
if (exec.length > 0) lines.push(` ${t2("trust_prompt.tier_exec_head")} ${exec.join(sep)}`);
|
|
145
|
-
lines.push("");
|
|
146
|
-
return lines.join("\n");
|
|
147
|
-
}
|
|
148
|
-
function choices() {
|
|
149
|
-
return [
|
|
150
|
-
{ name: t2("trust_prompt.choice_skip"), value: { kind: "skip" } },
|
|
151
|
-
{
|
|
152
|
-
name: t2("trust_prompt.choice_dir"),
|
|
153
|
-
value: { kind: "trust", scope: "directory", exec: false }
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: t2("trust_prompt.choice_tree"),
|
|
157
|
-
value: { kind: "trust", scope: "directory-tree", exec: false }
|
|
158
|
-
},
|
|
159
|
-
{ name: t2("trust_prompt.choice_never"), value: { kind: "never" } }
|
|
160
|
-
];
|
|
161
|
-
}
|
|
78
|
+
import { t as t2, trustedImportsPath, trustPath } from "@epoch-agent/infra";
|
|
162
79
|
function restoreStdinDefault() {
|
|
163
80
|
const stdin = process.stdin;
|
|
164
81
|
if (stdin.isTTY) stdin.setRawMode?.(false);
|
|
165
82
|
stdin.resume();
|
|
166
83
|
}
|
|
167
|
-
async function maybePromptForTrust(opts = {}) {
|
|
168
|
-
const config = opts.config ?? loadConfig();
|
|
169
|
-
const store = opts.store ?? new TrustManager(trustPath(config.homeDir));
|
|
170
|
-
const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
|
|
171
|
-
const target = trustPromptTarget({
|
|
172
|
-
store,
|
|
173
|
-
interactive: (opts.isInteractive ?? (() => !isNonInteractive()))(),
|
|
174
|
-
gateEnabled: config.trust?.enabled !== false,
|
|
175
|
-
workDir: opts.workDir ?? process.cwd()
|
|
176
|
-
});
|
|
177
|
-
if (!target) return true;
|
|
178
|
-
print(trustPromptMessage(target));
|
|
179
|
-
let choice;
|
|
180
|
-
try {
|
|
181
|
-
choice = await (opts.ask ?? askTrustChoice)(target);
|
|
182
|
-
if (choice?.kind === "trust" && target.hasExec) {
|
|
183
|
-
const exec = await (opts.askExec ?? askExecChoice)(target);
|
|
184
|
-
choice = { ...choice, exec: exec === true };
|
|
185
|
-
}
|
|
186
|
-
} finally {
|
|
187
|
-
(opts.restoreStdin ?? restoreStdinDefault)();
|
|
188
|
-
}
|
|
189
|
-
if (choice === null) return false;
|
|
190
|
-
try {
|
|
191
|
-
print(applyTrustChoice(store, target.root, choice));
|
|
192
|
-
} catch (err) {
|
|
193
|
-
print(
|
|
194
|
-
t2("trust_prompt.write_failed", {
|
|
195
|
-
message: err instanceof Error ? err.message : String(err)
|
|
196
|
-
})
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
async function askExecChoice(_target) {
|
|
202
|
-
const { select } = await import("@inquirer/prompts");
|
|
203
|
-
try {
|
|
204
|
-
const options = [
|
|
205
|
-
{ name: t2("trust_prompt.exec_choice_no"), value: false },
|
|
206
|
-
{ name: t2("trust_prompt.exec_choice_yes"), value: true }
|
|
207
|
-
];
|
|
208
|
-
return await select({
|
|
209
|
-
message: t2("trust_prompt.exec_ask"),
|
|
210
|
-
choices: options,
|
|
211
|
-
default: options[0]?.value
|
|
212
|
-
});
|
|
213
|
-
} catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
async function askTrustChoice(_target) {
|
|
218
|
-
const { select } = await import("@inquirer/prompts");
|
|
219
|
-
try {
|
|
220
|
-
const options = choices();
|
|
221
|
-
return await select({
|
|
222
|
-
message: t2("trust_prompt.ask"),
|
|
223
|
-
choices: [...options],
|
|
224
|
-
default: options[0]?.value
|
|
225
|
-
});
|
|
226
|
-
} catch {
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
// src/import-prompt.ts
|
|
231
84
|
function externalImportTargets(deps) {
|
|
232
85
|
if (!deps.gateEnabled) return [];
|
|
233
86
|
if (!deps.interactive) return [];
|
|
234
87
|
if (deps.store.deniedAll) return [];
|
|
235
|
-
const root =
|
|
88
|
+
const root = resolveProjectRoot(deps.workDir);
|
|
236
89
|
if (deps.trust.check(root) !== "trusted") return [];
|
|
237
90
|
const scan = scanInstructions(root, deps.workDir, {
|
|
238
91
|
allowExternal: (p) => deps.store.isAllowed(p)
|
|
@@ -252,44 +105,44 @@ function externalImportTargets(deps) {
|
|
|
252
105
|
function importPromptMessage(target) {
|
|
253
106
|
return [
|
|
254
107
|
`
|
|
255
|
-
${
|
|
108
|
+
${t2("import_prompt.head", { from: target.from })}`,
|
|
256
109
|
` ${target.path}`,
|
|
257
|
-
` ${
|
|
258
|
-
` ${
|
|
110
|
+
` ${t2("import_prompt.spec", { spec: target.spec })}`,
|
|
111
|
+
` ${t2("import_prompt.why")}`,
|
|
259
112
|
""
|
|
260
113
|
].join("\n");
|
|
261
114
|
}
|
|
262
115
|
function applyImportChoice(store, target, choice) {
|
|
263
116
|
if (choice.kind === "once") {
|
|
264
117
|
store.allowOnce(target.path);
|
|
265
|
-
return
|
|
118
|
+
return t2("import_prompt.once", { path: target.path });
|
|
266
119
|
}
|
|
267
120
|
if (choice.kind === "remember") {
|
|
268
121
|
store.remember(target.path);
|
|
269
|
-
return
|
|
122
|
+
return t2("import_prompt.remembered", { path: target.path });
|
|
270
123
|
}
|
|
271
124
|
if (choice.kind === "never") {
|
|
272
125
|
store.denyAll();
|
|
273
|
-
return
|
|
126
|
+
return t2("import_prompt.never");
|
|
274
127
|
}
|
|
275
|
-
return
|
|
128
|
+
return t2("import_prompt.skipped", { path: target.path });
|
|
276
129
|
}
|
|
277
|
-
function
|
|
130
|
+
function choices() {
|
|
278
131
|
return [
|
|
279
|
-
{ name:
|
|
280
|
-
{ name:
|
|
281
|
-
{ name:
|
|
282
|
-
{ name:
|
|
132
|
+
{ name: t2("import_prompt.choice_skip"), value: { kind: "skip" } },
|
|
133
|
+
{ name: t2("import_prompt.choice_once"), value: { kind: "once" } },
|
|
134
|
+
{ name: t2("import_prompt.choice_remember"), value: { kind: "remember" } },
|
|
135
|
+
{ name: t2("import_prompt.choice_never"), value: { kind: "never" } }
|
|
283
136
|
];
|
|
284
137
|
}
|
|
285
138
|
async function maybePromptForExternalImports(opts = {}) {
|
|
286
|
-
const config = opts.config ??
|
|
139
|
+
const config = opts.config ?? loadConfig();
|
|
287
140
|
const store = opts.store ?? new ImportTrustStore(trustedImportsPath(config.homeDir));
|
|
288
141
|
const print = opts.print ?? ((msg) => process.stdout.write(msg + "\n"));
|
|
289
142
|
const targets = externalImportTargets({
|
|
290
143
|
store,
|
|
291
|
-
trust: opts.trust ?? new
|
|
292
|
-
interactive: (opts.isInteractive ?? (() => !
|
|
144
|
+
trust: opts.trust ?? new TrustManager(trustPath(config.homeDir)),
|
|
145
|
+
interactive: (opts.isInteractive ?? (() => !isNonInteractive()))(),
|
|
293
146
|
gateEnabled: config.trust?.enabled !== false,
|
|
294
147
|
workDir: opts.workDir ?? process.cwd()
|
|
295
148
|
});
|
|
@@ -306,7 +159,7 @@ async function maybePromptForExternalImports(opts = {}) {
|
|
|
306
159
|
print(applyImportChoice(store, target, choice));
|
|
307
160
|
} catch (err) {
|
|
308
161
|
print(
|
|
309
|
-
|
|
162
|
+
t2("import_prompt.write_failed", {
|
|
310
163
|
message: err instanceof Error ? err.message : String(err)
|
|
311
164
|
})
|
|
312
165
|
);
|
|
@@ -322,9 +175,9 @@ async function maybePromptForExternalImports(opts = {}) {
|
|
|
322
175
|
async function askImportChoice(_target) {
|
|
323
176
|
const { select } = await import("@inquirer/prompts");
|
|
324
177
|
try {
|
|
325
|
-
const options =
|
|
178
|
+
const options = choices();
|
|
326
179
|
return await select({
|
|
327
|
-
message:
|
|
180
|
+
message: t2("import_prompt.ask"),
|
|
328
181
|
choices: [...options],
|
|
329
182
|
default: options[0]?.value
|
|
330
183
|
});
|
|
@@ -333,7 +186,7 @@ async function askImportChoice(_target) {
|
|
|
333
186
|
}
|
|
334
187
|
}
|
|
335
188
|
// src/keybindings-view.ts
|
|
336
|
-
import { t as
|
|
189
|
+
import { t as t3 } from "@epoch-agent/infra";
|
|
337
190
|
import {
|
|
338
191
|
ACTION_CONTEXTS,
|
|
339
192
|
KEY_ACTIONS,
|
|
@@ -357,17 +210,17 @@ function groupOf(action) {
|
|
|
357
210
|
return ACTION_CONTEXTS[action][0] ?? "global";
|
|
358
211
|
}
|
|
359
212
|
function describeKeybindings(report2) {
|
|
360
|
-
const lines = [
|
|
361
|
-
if (!report2.present) lines.push(
|
|
213
|
+
const lines = [t3("keybindings.list_title", { path: report2.path })];
|
|
214
|
+
if (!report2.present) lines.push(t3("keybindings.list_no_file"));
|
|
362
215
|
const width = Math.max(...KEY_ACTIONS.map((a) => a.length)) + 2;
|
|
363
216
|
const keysWidth = Math.max(
|
|
364
217
|
...KEY_ACTIONS.map((a) => keysTextOf(report2, a).length),
|
|
365
|
-
|
|
218
|
+
t3("keybindings.list_unbound").length
|
|
366
219
|
) + 2;
|
|
367
220
|
for (const context of ["global", "input", "dialog"]) {
|
|
368
221
|
const actions = KEY_ACTIONS.filter((action) => groupOf(action) === context);
|
|
369
222
|
if (actions.length === 0) continue;
|
|
370
|
-
lines.push("",
|
|
223
|
+
lines.push("", t3(CONTEXT_TITLE_KEYS[context]));
|
|
371
224
|
for (const action of actions) {
|
|
372
225
|
lines.push(
|
|
373
226
|
` ${action.padEnd(width)}${keysTextOf(report2, action).padEnd(keysWidth)}${sourceTextOf(report2, action)}`.trimEnd()
|
|
@@ -375,21 +228,21 @@ function describeKeybindings(report2) {
|
|
|
375
228
|
}
|
|
376
229
|
}
|
|
377
230
|
if (report2.rejected.length > 0) {
|
|
378
|
-
lines.push("",
|
|
231
|
+
lines.push("", t3("keybindings.list_rejected_title"));
|
|
379
232
|
for (const item of report2.rejected) {
|
|
380
233
|
lines.push(` ${item.action.padEnd(width)}${rejectText(item)}`);
|
|
381
234
|
}
|
|
382
235
|
}
|
|
383
236
|
lines.push(
|
|
384
237
|
"",
|
|
385
|
-
|
|
386
|
-
|
|
238
|
+
t3("keybindings.list_reserved_note", { keys: RESERVED_CHORDS.join(" \xB7 ") }),
|
|
239
|
+
t3("keybindings.list_sequence_note", { ms: SEQUENCE_WINDOW_MS })
|
|
387
240
|
);
|
|
388
241
|
return lines.join("\n");
|
|
389
242
|
}
|
|
390
243
|
function keysTextOf(report2, action) {
|
|
391
244
|
const bound = report2.bindings[action];
|
|
392
|
-
if (bound.length === 0) return
|
|
245
|
+
if (bound.length === 0) return t3("keybindings.list_unbound");
|
|
393
246
|
return bound.map((b) => sequenceId(b.keys)).join(" \xB7 ");
|
|
394
247
|
}
|
|
395
248
|
function sourceTextOf(report2, action) {
|
|
@@ -397,29 +250,29 @@ function sourceTextOf(report2, action) {
|
|
|
397
250
|
if (bound.length === 0) return "";
|
|
398
251
|
const sources = [...new Set(bound.map((b) => b.source))];
|
|
399
252
|
return sources.map(
|
|
400
|
-
(s) => s === "user" ?
|
|
253
|
+
(s) => s === "user" ? t3("keybindings.list_source_user") : t3("keybindings.list_source_default")
|
|
401
254
|
).join("+");
|
|
402
255
|
}
|
|
403
256
|
function rejectText(item) {
|
|
404
|
-
return
|
|
257
|
+
return t3(REJECT_KEYS[item.reason], { keys: item.keys, winner: item.winner ?? "" });
|
|
405
258
|
}
|
|
406
259
|
// src/language.ts
|
|
407
|
-
import { loadConfig as
|
|
260
|
+
import { loadConfig as loadConfig2, setDisplayCurrency } from "@epoch-agent/core";
|
|
408
261
|
import { resolveLang, setLang } from "@epoch-agent/infra";
|
|
409
262
|
function applyConfiguredLanguage() {
|
|
410
263
|
try {
|
|
411
|
-
setLang(resolveLang(
|
|
264
|
+
setLang(resolveLang(loadConfig2().display?.language));
|
|
412
265
|
} catch {
|
|
413
266
|
}
|
|
414
267
|
}
|
|
415
268
|
function applyConfiguredCurrency() {
|
|
416
269
|
try {
|
|
417
|
-
setDisplayCurrency(
|
|
270
|
+
setDisplayCurrency(loadConfig2().display?.currency);
|
|
418
271
|
} catch {
|
|
419
272
|
}
|
|
420
273
|
}
|
|
421
274
|
// src/schedule/labels.ts
|
|
422
|
-
import { t as
|
|
275
|
+
import { t as t4 } from "@epoch-agent/infra";
|
|
423
276
|
import {
|
|
424
277
|
collectPendingApprovals,
|
|
425
278
|
cronTimes
|
|
@@ -429,7 +282,7 @@ function pendingNotice(defs, runs) {
|
|
|
429
282
|
const first = items[0];
|
|
430
283
|
if (!first) return null;
|
|
431
284
|
const rest = items.length - 1;
|
|
432
|
-
return
|
|
285
|
+
return t4(rest > 0 ? "schedule.startup_pending_more" : "schedule.startup_pending", {
|
|
433
286
|
name: first.scheduleName,
|
|
434
287
|
n: first.approvals.length,
|
|
435
288
|
rest,
|
|
@@ -455,13 +308,13 @@ import {
|
|
|
455
308
|
setPluginEnabled,
|
|
456
309
|
suggestRuleFromApproval
|
|
457
310
|
} from "@epoch-agent/core";
|
|
458
|
-
import { pluginsStatePath as pluginsStatePath2, t as
|
|
311
|
+
import { pluginsStatePath as pluginsStatePath2, t as t10 } from "@epoch-agent/infra";
|
|
459
312
|
import { stripTurnDigest } from "@epoch-agent/protocol";
|
|
460
313
|
import { listBackgroundTasks } from "@epoch-agent/runtime";
|
|
461
314
|
// src/clipboard.ts
|
|
462
315
|
import { execFile } from "child_process";
|
|
463
316
|
import { readImageSize, sniffMediaType } from "@epoch-agent/core";
|
|
464
|
-
import { guardSpawn, t as
|
|
317
|
+
import { guardSpawn, t as t5 } from "@epoch-agent/infra";
|
|
465
318
|
var MAX_BYTES = 32 * 1024 * 1024;
|
|
466
319
|
var TIMEOUT_MS = 5e3;
|
|
467
320
|
var WINDOWS_SCRIPT = [
|
|
@@ -480,7 +333,7 @@ function clipboardImageCandidates(platform = process.platform, env = process.env
|
|
|
480
333
|
command: "osascript",
|
|
481
334
|
args: ["-e", "get the clipboard as \xABclass PNGf\xBB"],
|
|
482
335
|
decode: "applescript-hex",
|
|
483
|
-
install:
|
|
336
|
+
install: t5("clipboard.install_macos")
|
|
484
337
|
}
|
|
485
338
|
];
|
|
486
339
|
}
|
|
@@ -490,20 +343,20 @@ function clipboardImageCandidates(platform = process.platform, env = process.env
|
|
|
490
343
|
command,
|
|
491
344
|
args: flags,
|
|
492
345
|
decode: "base64",
|
|
493
|
-
install:
|
|
346
|
+
install: t5("clipboard.install_windows")
|
|
494
347
|
}));
|
|
495
348
|
}
|
|
496
349
|
const wayland = {
|
|
497
350
|
command: "wl-paste",
|
|
498
351
|
args: ["--no-newline", "--type", "image/png"],
|
|
499
352
|
decode: "raw",
|
|
500
|
-
install:
|
|
353
|
+
install: t5("clipboard.install_wayland")
|
|
501
354
|
};
|
|
502
355
|
const x11 = {
|
|
503
356
|
command: "xclip",
|
|
504
357
|
args: ["-selection", "clipboard", "-t", "image/png", "-o"],
|
|
505
358
|
decode: "raw",
|
|
506
|
-
install:
|
|
359
|
+
install: t5("clipboard.install_x11")
|
|
507
360
|
};
|
|
508
361
|
return env["WAYLAND_DISPLAY"] ? [wayland, x11] : [x11, wayland];
|
|
509
362
|
}
|
|
@@ -559,14 +412,14 @@ async function readClipboardImage(platform = process.platform, env = process.env
|
|
|
559
412
|
const image = decodeImage(bytes);
|
|
560
413
|
if (!image) continue;
|
|
561
414
|
if (image.bytes > MAX_BYTES) {
|
|
562
|
-
throw new Error(
|
|
415
|
+
throw new Error(t5("clipboard.too_large", { mb: Math.round(image.bytes / 1024 / 1024) }));
|
|
563
416
|
}
|
|
564
417
|
return image;
|
|
565
418
|
}
|
|
566
419
|
if (!anyRan) {
|
|
567
420
|
throw new Error(
|
|
568
|
-
|
|
569
|
-
hints: candidates.map((c) => c.install).join(
|
|
421
|
+
t5("clipboard.unreadable", {
|
|
422
|
+
hints: candidates.map((c) => c.install).join(t5("clipboard.hint_sep"))
|
|
570
423
|
})
|
|
571
424
|
);
|
|
572
425
|
}
|
|
@@ -578,7 +431,7 @@ import {
|
|
|
578
431
|
MAX_GOAL_MAX_ROUNDS,
|
|
579
432
|
MAX_OBJECTIVE_CHARS
|
|
580
433
|
} from "@epoch-agent/core";
|
|
581
|
-
import { t as
|
|
434
|
+
import { t as t6 } from "@epoch-agent/infra";
|
|
582
435
|
var PHASE_LABEL_KEYS = {
|
|
583
436
|
active: "goal.phase_active",
|
|
584
437
|
paused: "goal.phase_paused",
|
|
@@ -586,28 +439,28 @@ var PHASE_LABEL_KEYS = {
|
|
|
586
439
|
complete: "goal.phase_complete"
|
|
587
440
|
};
|
|
588
441
|
function phaseLabel(phase) {
|
|
589
|
-
return
|
|
442
|
+
return t6(PHASE_LABEL_KEYS[phase]);
|
|
590
443
|
}
|
|
591
444
|
function usage() {
|
|
592
|
-
return
|
|
445
|
+
return t6("goal.usage", { rounds: DEFAULT_GOAL_MAX_ROUNDS, max: MAX_GOAL_MAX_ROUNDS });
|
|
593
446
|
}
|
|
594
447
|
function extraOf(goal) {
|
|
595
448
|
switch (goal.phase) {
|
|
596
449
|
case "blocked":
|
|
597
|
-
return
|
|
450
|
+
return t6("goal.extra_blocked", {
|
|
598
451
|
code: goal.block?.code ?? "",
|
|
599
452
|
message: goal.block?.message ?? ""
|
|
600
453
|
});
|
|
601
454
|
case "complete":
|
|
602
|
-
return
|
|
455
|
+
return t6("goal.extra_complete", { evidence: goal.completeEvidence ?? "" });
|
|
603
456
|
case "paused":
|
|
604
|
-
return
|
|
457
|
+
return t6("goal.extra_paused");
|
|
605
458
|
case "active":
|
|
606
|
-
return
|
|
459
|
+
return t6("goal.extra_active");
|
|
607
460
|
}
|
|
608
461
|
}
|
|
609
462
|
function describeGoal(goal) {
|
|
610
|
-
return
|
|
463
|
+
return t6("goal.status", {
|
|
611
464
|
objective: goal.objective,
|
|
612
465
|
phase: phaseLabel(goal.phase),
|
|
613
466
|
used: goal.roundsUsed,
|
|
@@ -619,24 +472,24 @@ function refusalText(reason, phase) {
|
|
|
619
472
|
const at = phase ? phaseLabel(phase) : "";
|
|
620
473
|
switch (reason) {
|
|
621
474
|
case "busy":
|
|
622
|
-
return
|
|
475
|
+
return t6("goal.refuse_busy", { phase: at });
|
|
623
476
|
case "no-goal":
|
|
624
|
-
return
|
|
477
|
+
return t6("goal.refuse_no_goal");
|
|
625
478
|
case "empty-objective":
|
|
626
|
-
return
|
|
479
|
+
return t6("goal.refuse_empty_objective");
|
|
627
480
|
case "objective-too-long":
|
|
628
|
-
return
|
|
481
|
+
return t6("goal.refuse_objective_too_long", { max: MAX_OBJECTIVE_CHARS });
|
|
629
482
|
case "bad-budget":
|
|
630
|
-
return
|
|
483
|
+
return t6("goal.refuse_bad_budget", { max: MAX_GOAL_MAX_ROUNDS });
|
|
631
484
|
case "empty-evidence":
|
|
632
|
-
return
|
|
485
|
+
return t6("goal.refuse_empty_evidence");
|
|
633
486
|
case "wrong-phase":
|
|
634
|
-
return
|
|
487
|
+
return t6("goal.refuse_wrong_phase", { phase: at });
|
|
635
488
|
case "unavailable":
|
|
636
|
-
return
|
|
489
|
+
return t6("goal.refuse_unavailable");
|
|
637
490
|
case "bad-block-code":
|
|
638
491
|
case "empty-block-message":
|
|
639
|
-
return
|
|
492
|
+
return t6("goal.refuse_wrong_phase", { phase: at });
|
|
640
493
|
}
|
|
641
494
|
}
|
|
642
495
|
function report(control, outcome, toText) {
|
|
@@ -648,18 +501,18 @@ function buildGoalActions(control) {
|
|
|
648
501
|
return {
|
|
649
502
|
describe: () => {
|
|
650
503
|
const goal = control.current();
|
|
651
|
-
return goal ? describeGoal(goal) :
|
|
504
|
+
return goal ? describeGoal(goal) : t6("goal.none", { usage: usage() });
|
|
652
505
|
},
|
|
653
506
|
usage,
|
|
654
507
|
create: (objective) => report(
|
|
655
508
|
control,
|
|
656
509
|
control.create(objective),
|
|
657
|
-
(goal) =>
|
|
510
|
+
(goal) => t6("goal.created", { objective: goal.objective, max: goal.maxRounds })
|
|
658
511
|
),
|
|
659
512
|
edit: (objective) => report(
|
|
660
513
|
control,
|
|
661
514
|
control.edit(objective),
|
|
662
|
-
(goal) =>
|
|
515
|
+
(goal) => t6("goal.edited", {
|
|
663
516
|
objective: goal.objective,
|
|
664
517
|
used: goal.roundsUsed,
|
|
665
518
|
max: goal.maxRounds
|
|
@@ -669,32 +522,32 @@ function buildGoalActions(control) {
|
|
|
669
522
|
control,
|
|
670
523
|
control.setBudget(rounds),
|
|
671
524
|
(goal) => (
|
|
672
|
-
|
|
525
|
+
t6(goal.phase === "blocked" ? "goal.budget_set_exhausted" : "goal.budget_set", {
|
|
673
526
|
used: goal.roundsUsed,
|
|
674
527
|
max: goal.maxRounds
|
|
675
528
|
})
|
|
676
529
|
)
|
|
677
530
|
),
|
|
678
|
-
pause: () => report(control, control.pause(), () =>
|
|
531
|
+
pause: () => report(control, control.pause(), () => t6("goal.paused")),
|
|
679
532
|
resume: () => report(
|
|
680
533
|
control,
|
|
681
534
|
control.resume(),
|
|
682
|
-
(goal) =>
|
|
535
|
+
(goal) => t6("goal.resumed", { used: goal.roundsUsed, max: goal.maxRounds })
|
|
683
536
|
),
|
|
684
537
|
done: (evidence) => report(
|
|
685
538
|
control,
|
|
686
539
|
control.complete(evidence),
|
|
687
|
-
(goal) =>
|
|
540
|
+
(goal) => t6("goal.completed", { evidence: goal.completeEvidence ?? "" })
|
|
688
541
|
),
|
|
689
542
|
clear: () => {
|
|
690
543
|
const outcome = control.clear();
|
|
691
544
|
if (!outcome.ok) return { ok: false, message: refusalText(outcome.reason) };
|
|
692
|
-
return { ok: true, message:
|
|
545
|
+
return { ok: true, message: t6(outcome.cleared ? "goal.cleared" : "goal.clear_noop") };
|
|
693
546
|
},
|
|
694
547
|
blockedNotice: () => {
|
|
695
548
|
const goal = control.current();
|
|
696
549
|
if (!goal || goal.phase !== "blocked" || !goal.block) return null;
|
|
697
|
-
return
|
|
550
|
+
return t6("goal.startup_blocked", {
|
|
698
551
|
code: goal.block.code,
|
|
699
552
|
message: goal.block.message
|
|
700
553
|
});
|
|
@@ -706,7 +559,7 @@ import { execFile as execFile2 } from "child_process";
|
|
|
706
559
|
import { writeFileSync } from "fs";
|
|
707
560
|
import { isAbsolute, resolve } from "path";
|
|
708
561
|
import { loadPlugins, readPluginRecords, scanPluginDir } from "@epoch-agent/core";
|
|
709
|
-
import { guardSpawn as guardSpawn2, pluginsStatePath, t as
|
|
562
|
+
import { guardSpawn as guardSpawn2, pluginsStatePath, t as t7 } from "@epoch-agent/infra";
|
|
710
563
|
var TIMEOUT_MS2 = 1e4;
|
|
711
564
|
var MAX_BUFFER = 1024 * 1024;
|
|
712
565
|
function run(command, args, cwd) {
|
|
@@ -755,7 +608,7 @@ async function writeClipboardText(text) {
|
|
|
755
608
|
() => execFile2(cmd.command, cmd.args, { timeout: TIMEOUT_MS2, windowsHide: true }, (err) => {
|
|
756
609
|
const e = err;
|
|
757
610
|
if (e?.code === "ENOENT") return resolve_("missing");
|
|
758
|
-
resolve_(err ? err.message ??
|
|
611
|
+
resolve_(err ? err.message ?? t7("host_actions.clipboard_write_failed") : "ok");
|
|
759
612
|
}),
|
|
760
613
|
() => resolve_("missing")
|
|
761
614
|
);
|
|
@@ -766,15 +619,15 @@ async function writeClipboardText(text) {
|
|
|
766
619
|
throw new Error(done);
|
|
767
620
|
}
|
|
768
621
|
throw new Error(
|
|
769
|
-
process.platform === "linux" ?
|
|
622
|
+
process.platform === "linux" ? t7("host_actions.clipboard_missing_linux") : t7("host_actions.clipboard_missing")
|
|
770
623
|
);
|
|
771
624
|
}
|
|
772
625
|
async function gitDiff(cwd) {
|
|
773
626
|
const result = await run("git", ["--no-pager", "diff", "HEAD"], cwd);
|
|
774
|
-
if (result.missing) return { text: "", ok: false, message:
|
|
627
|
+
if (result.missing) return { text: "", ok: false, message: t7("host_actions.git_missing") };
|
|
775
628
|
if (!result.ok) {
|
|
776
|
-
const why = result.stderr.trim().split("\n")[0] ??
|
|
777
|
-
return { text: "", ok: false, message:
|
|
629
|
+
const why = result.stderr.trim().split("\n")[0] ?? t7("git.unknown_reason");
|
|
630
|
+
return { text: "", ok: false, message: t7("host_actions.diff_failed", { why }) };
|
|
778
631
|
}
|
|
779
632
|
return { text: result.stdout, ok: true };
|
|
780
633
|
}
|
|
@@ -786,20 +639,20 @@ async function gitDirty(cwd) {
|
|
|
786
639
|
}
|
|
787
640
|
function renderSessionMarkdown(sessionId, messages, now) {
|
|
788
641
|
const ROLE_LABEL = {
|
|
789
|
-
user:
|
|
790
|
-
assistant:
|
|
791
|
-
tool:
|
|
792
|
-
system:
|
|
642
|
+
user: t7("host_actions.role_user"),
|
|
643
|
+
assistant: t7("host_actions.role_assistant"),
|
|
644
|
+
tool: t7("host_actions.role_tool"),
|
|
645
|
+
system: t7("host_actions.role_system")
|
|
793
646
|
};
|
|
794
647
|
const lines = [
|
|
795
|
-
|
|
648
|
+
t7("host_actions.export_title", { id: sessionId }),
|
|
796
649
|
"",
|
|
797
|
-
|
|
650
|
+
t7("host_actions.export_meta", { when: now.toISOString(), count: messages.length }),
|
|
798
651
|
""
|
|
799
652
|
];
|
|
800
653
|
for (const m of messages) {
|
|
801
654
|
lines.push(`## ${ROLE_LABEL[m.role] ?? m.role}`, "");
|
|
802
|
-
lines.push(m.content.trim() ||
|
|
655
|
+
lines.push(m.content.trim() || t7("host_actions.export_empty"), "");
|
|
803
656
|
}
|
|
804
657
|
return lines.join("\n");
|
|
805
658
|
}
|
|
@@ -834,7 +687,7 @@ function describePlugins(homeDir) {
|
|
|
834
687
|
function contributionLines(dir, name) {
|
|
835
688
|
const inv = scanPluginDir(dir, name);
|
|
836
689
|
const hooks = inv.hooks.reduce((sum, h) => sum + h.count, 0);
|
|
837
|
-
const line = (n, key) => n > 0 ?
|
|
690
|
+
const line = (n, key) => n > 0 ? t7(key, { count: n }) : "";
|
|
838
691
|
const out = [
|
|
839
692
|
line(inv.commands.length, "plugin.line_commands"),
|
|
840
693
|
line(inv.roles.length, "plugin.line_roles"),
|
|
@@ -842,12 +695,12 @@ function contributionLines(dir, name) {
|
|
|
842
695
|
line(inv.denyRules, "plugin.line_deny"),
|
|
843
696
|
line(hooks, "plugin.line_hooks")
|
|
844
697
|
].filter(Boolean);
|
|
845
|
-
return out.length > 0 ? out : [
|
|
698
|
+
return out.length > 0 ? out : [t7("plugin.line_nothing")];
|
|
846
699
|
}
|
|
847
700
|
// src/statusline.ts
|
|
848
701
|
import { execFile as execFile3 } from "child_process";
|
|
849
702
|
import { sanitizeToolOutput } from "@epoch-agent/core";
|
|
850
|
-
import { guardSpawn as guardSpawn3, shellSpawnArgs, t as
|
|
703
|
+
import { guardSpawn as guardSpawn3, shellSpawnArgs, t as t8 } from "@epoch-agent/infra";
|
|
851
704
|
var TIMEOUT_MS3 = 2e3;
|
|
852
705
|
var MAX_WIDTH = 60;
|
|
853
706
|
var DEFAULT_INTERVAL_MS = 5e3;
|
|
@@ -877,7 +730,7 @@ function runStatusLineCommand(command, cwd) {
|
|
|
877
730
|
const killed = err.killed === true;
|
|
878
731
|
settle({
|
|
879
732
|
text: null,
|
|
880
|
-
error: killed ?
|
|
733
|
+
error: killed ? t8("statusline.timeout", { ms: TIMEOUT_MS3 }) : err.message.trim()
|
|
881
734
|
});
|
|
882
735
|
return;
|
|
883
736
|
}
|
|
@@ -917,7 +770,7 @@ function createStatusLine(config, cwd) {
|
|
|
917
770
|
};
|
|
918
771
|
}
|
|
919
772
|
// src/terminal-setup-view.ts
|
|
920
|
-
import { t as
|
|
773
|
+
import { t as t9 } from "@epoch-agent/infra";
|
|
921
774
|
import { classifyTerminal } from "@epoch-agent/tui";
|
|
922
775
|
// src/terminal-setup.ts
|
|
923
776
|
import { execFileSync } from "child_process";
|
|
@@ -1257,7 +1110,7 @@ async function runTerminalSetup(args, opts = {}) {
|
|
|
1257
1110
|
const plan = planForTerminal(terminal, opts);
|
|
1258
1111
|
if (args === "--revert") return revert(plan);
|
|
1259
1112
|
if (args === "--write") return write(plan);
|
|
1260
|
-
if (args !== "") return { ok: false, message:
|
|
1113
|
+
if (args !== "") return { ok: false, message: t9("terminal_setup.usage") };
|
|
1261
1114
|
return planView(plan);
|
|
1262
1115
|
}
|
|
1263
1116
|
function planView(plan) {
|
|
@@ -1266,61 +1119,61 @@ function planView(plan) {
|
|
|
1266
1119
|
return {
|
|
1267
1120
|
ok: true,
|
|
1268
1121
|
message: [
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
plan.fileExists ?
|
|
1272
|
-
|
|
1122
|
+
t9("terminal_setup.vscode_plan_head"),
|
|
1123
|
+
t9("terminal_setup.plan_target", { target: plan.target }),
|
|
1124
|
+
plan.fileExists ? t9("terminal_setup.plan_file_exists") : t9("terminal_setup.plan_file_new"),
|
|
1125
|
+
t9("terminal_setup.plan_add"),
|
|
1273
1126
|
plan.entry,
|
|
1274
|
-
|
|
1127
|
+
t9("terminal_setup.plan_confirm")
|
|
1275
1128
|
].join("\n")
|
|
1276
1129
|
};
|
|
1277
1130
|
case "windows-terminal":
|
|
1278
1131
|
return {
|
|
1279
1132
|
ok: true,
|
|
1280
1133
|
message: [
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
plan.fileExists ?
|
|
1284
|
-
|
|
1134
|
+
t9("terminal_setup.wt_plan_head"),
|
|
1135
|
+
t9("terminal_setup.plan_target", { target: plan.target }),
|
|
1136
|
+
plan.fileExists ? t9("terminal_setup.plan_file_exists") : t9("terminal_setup.plan_file_new"),
|
|
1137
|
+
t9("terminal_setup.plan_add"),
|
|
1285
1138
|
plan.action,
|
|
1286
|
-
|
|
1287
|
-
|
|
1139
|
+
t9("terminal_setup.plan_confirm"),
|
|
1140
|
+
t9("terminal_setup.wt_honest")
|
|
1288
1141
|
].join("\n")
|
|
1289
1142
|
};
|
|
1290
1143
|
case "iterm2":
|
|
1291
1144
|
if (!plan.readable) {
|
|
1292
1145
|
return {
|
|
1293
1146
|
ok: false,
|
|
1294
|
-
message:
|
|
1147
|
+
message: t9("terminal_setup.iterm2_unreadable", { target: plan.target })
|
|
1295
1148
|
};
|
|
1296
1149
|
}
|
|
1297
1150
|
return {
|
|
1298
1151
|
ok: true,
|
|
1299
1152
|
message: [
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1153
|
+
t9("terminal_setup.iterm2_plan_head"),
|
|
1154
|
+
t9("terminal_setup.plan_target", { target: plan.target }),
|
|
1155
|
+
t9("terminal_setup.iterm2_plan_add", { name: plan.bookmarkName }),
|
|
1303
1156
|
plan.entry,
|
|
1304
|
-
|
|
1157
|
+
t9("terminal_setup.plan_confirm")
|
|
1305
1158
|
].join("\n")
|
|
1306
1159
|
};
|
|
1307
1160
|
case "apple-terminal":
|
|
1308
|
-
return { ok: false, message:
|
|
1161
|
+
return { ok: false, message: t9("terminal_setup.apple") };
|
|
1309
1162
|
case "unknown":
|
|
1310
|
-
return { ok: false, message:
|
|
1163
|
+
return { ok: false, message: t9("terminal_setup.unknown", { label: plan.label }) };
|
|
1311
1164
|
}
|
|
1312
1165
|
}
|
|
1313
1166
|
function write(plan) {
|
|
1314
1167
|
switch (plan.kind) {
|
|
1315
1168
|
case "apple-terminal":
|
|
1316
|
-
return { ok: false, message:
|
|
1169
|
+
return { ok: false, message: t9("terminal_setup.apple_write") };
|
|
1317
1170
|
case "unknown":
|
|
1318
|
-
return { ok: false, message:
|
|
1171
|
+
return { ok: false, message: t9("terminal_setup.unknown_write") };
|
|
1319
1172
|
case "iterm2":
|
|
1320
1173
|
if (!plan.readable) {
|
|
1321
1174
|
return {
|
|
1322
1175
|
ok: false,
|
|
1323
|
-
message:
|
|
1176
|
+
message: t9("terminal_setup.iterm2_unreadable", { target: plan.target })
|
|
1324
1177
|
};
|
|
1325
1178
|
}
|
|
1326
1179
|
break;
|
|
@@ -1333,17 +1186,17 @@ function write(plan) {
|
|
|
1333
1186
|
case "backup-failed":
|
|
1334
1187
|
return {
|
|
1335
1188
|
ok: false,
|
|
1336
|
-
message:
|
|
1189
|
+
message: t9("terminal_setup.backup_failed", {
|
|
1337
1190
|
target: plan.target,
|
|
1338
1191
|
detail: result.detail
|
|
1339
1192
|
})
|
|
1340
1193
|
};
|
|
1341
1194
|
case "target-changed":
|
|
1342
|
-
return { ok: false, message:
|
|
1195
|
+
return { ok: false, message: t9("terminal_setup.target_changed", { target: plan.target }) };
|
|
1343
1196
|
case "write-failed":
|
|
1344
1197
|
return {
|
|
1345
1198
|
ok: false,
|
|
1346
|
-
message:
|
|
1199
|
+
message: t9("terminal_setup.write_failed", {
|
|
1347
1200
|
target: plan.target,
|
|
1348
1201
|
detail: result.detail,
|
|
1349
1202
|
backup: result.backupPath
|
|
@@ -1352,40 +1205,40 @@ function write(plan) {
|
|
|
1352
1205
|
case "plutil-failed":
|
|
1353
1206
|
return {
|
|
1354
1207
|
ok: false,
|
|
1355
|
-
message:
|
|
1208
|
+
message: t9("terminal_setup.plutil_failed", {
|
|
1356
1209
|
target: plan.target,
|
|
1357
1210
|
backup: result.backupPath
|
|
1358
1211
|
})
|
|
1359
1212
|
};
|
|
1360
1213
|
case "plist-missing":
|
|
1361
|
-
return { ok: false, message:
|
|
1214
|
+
return { ok: false, message: t9("terminal_setup.plist_missing", { target: plan.target }) };
|
|
1362
1215
|
}
|
|
1363
1216
|
}
|
|
1364
|
-
const reload = plan.kind === "vscode" ?
|
|
1217
|
+
const reload = plan.kind === "vscode" ? t9("terminal_setup.reload_vscode") : plan.kind === "windows-terminal" ? t9("terminal_setup.reload_wt") : t9("terminal_setup.reload_iterm2");
|
|
1365
1218
|
return {
|
|
1366
1219
|
ok: true,
|
|
1367
1220
|
message: [
|
|
1368
|
-
|
|
1221
|
+
t9("terminal_setup.write_done", { target: result.target, backup: result.backupPath }),
|
|
1369
1222
|
reload,
|
|
1370
|
-
|
|
1223
|
+
t9("terminal_setup.write_revert_hint")
|
|
1371
1224
|
].join("\n")
|
|
1372
1225
|
};
|
|
1373
1226
|
}
|
|
1374
1227
|
function revert(plan) {
|
|
1375
1228
|
if (plan.kind === "apple-terminal" || plan.kind === "unknown") {
|
|
1376
|
-
return { ok: false, message:
|
|
1229
|
+
return { ok: false, message: t9("terminal_setup.revert_nowhere") };
|
|
1377
1230
|
}
|
|
1378
1231
|
const result = revertLatest(plan.target);
|
|
1379
1232
|
if (result.ok) {
|
|
1380
1233
|
return result.kind === "restored" ? {
|
|
1381
1234
|
ok: true,
|
|
1382
|
-
message:
|
|
1235
|
+
message: t9("terminal_setup.revert_restored", {
|
|
1383
1236
|
target: result.target,
|
|
1384
1237
|
backup: result.backupPath
|
|
1385
1238
|
})
|
|
1386
1239
|
} : {
|
|
1387
1240
|
ok: true,
|
|
1388
|
-
message:
|
|
1241
|
+
message: t9("terminal_setup.revert_restored_absent", {
|
|
1389
1242
|
target: result.target,
|
|
1390
1243
|
backup: result.backupPath
|
|
1391
1244
|
})
|
|
@@ -1395,20 +1248,20 @@ function revert(plan) {
|
|
|
1395
1248
|
case "no-backup":
|
|
1396
1249
|
return {
|
|
1397
1250
|
ok: false,
|
|
1398
|
-
message:
|
|
1251
|
+
message: t9("terminal_setup.revert_no_backup", { target: result.target })
|
|
1399
1252
|
};
|
|
1400
1253
|
case "nothing-to-do":
|
|
1401
|
-
return { ok: false, message:
|
|
1254
|
+
return { ok: false, message: t9("terminal_setup.revert_nothing", { target: result.target }) };
|
|
1402
1255
|
case "revert-blocked":
|
|
1403
1256
|
return {
|
|
1404
1257
|
ok: false,
|
|
1405
|
-
message:
|
|
1258
|
+
message: t9("terminal_setup.revert_blocked", {
|
|
1406
1259
|
target: result.target,
|
|
1407
1260
|
backup: result.backupPath
|
|
1408
1261
|
})
|
|
1409
1262
|
};
|
|
1410
1263
|
case "restore-failed":
|
|
1411
|
-
return { ok: false, message:
|
|
1264
|
+
return { ok: false, message: t9("terminal_setup.restore_failed", { detail: result.detail }) };
|
|
1412
1265
|
}
|
|
1413
1266
|
}
|
|
1414
1267
|
// src/tui-host.ts
|
|
@@ -1441,10 +1294,10 @@ function toCandidateView(row, now) {
|
|
|
1441
1294
|
id: row.sessionId,
|
|
1442
1295
|
title: row.title,
|
|
1443
1296
|
...row.cwd ? { cwd: row.cwd } : {},
|
|
1444
|
-
hint: row.sameWorkspace ?
|
|
1297
|
+
hint: row.sameWorkspace ? t10("mention.candidate_here", {
|
|
1445
1298
|
when: candidateWhen(row.updatedAt, now),
|
|
1446
1299
|
count: row.messageCount
|
|
1447
|
-
}) :
|
|
1300
|
+
}) : t10("mention.candidate_elsewhere", {
|
|
1448
1301
|
when: candidateWhen(row.updatedAt, now),
|
|
1449
1302
|
count: row.messageCount,
|
|
1450
1303
|
where
|
|
@@ -1499,7 +1352,7 @@ function buildHostActions(runtime, workDir) {
|
|
|
1499
1352
|
listAgentRoles: () => runtime.agentRoles,
|
|
1500
1353
|
listMcpServers: () => runtime.mcpServers.map((s) => ({
|
|
1501
1354
|
name: s.name,
|
|
1502
|
-
status: s.needsLogin ?
|
|
1355
|
+
status: s.needsLogin ? t10("tui_host.mcp_needs_login") : s.connected ? t10("tui_host.mcp_connected") : t10("tui_host.mcp_disconnected"),
|
|
1503
1356
|
toolCount: s.toolCount,
|
|
1504
1357
|
...s.lastError ? { error: s.lastError } : {}
|
|
1505
1358
|
})),
|
|
@@ -1580,10 +1433,10 @@ function buildHostActions(runtime, workDir) {
|
|
|
1580
1433
|
const managed = runtime.permissions.managed();
|
|
1581
1434
|
return {
|
|
1582
1435
|
ok: false,
|
|
1583
|
-
reason:
|
|
1436
|
+
reason: t10("tui_host.bypass_managed", { path: managed.path })
|
|
1584
1437
|
};
|
|
1585
1438
|
}
|
|
1586
|
-
return permission.getLevel() === level ? { ok: true } : { ok: false, reason:
|
|
1439
|
+
return permission.getLevel() === level ? { ok: true } : { ok: false, reason: t10("tui_host.switch_failed", { level }) };
|
|
1587
1440
|
}
|
|
1588
1441
|
} : {},
|
|
1589
1442
|
...goals ? { goals } : {},
|
|
@@ -1592,7 +1445,7 @@ function buildHostActions(runtime, workDir) {
|
|
|
1592
1445
|
planMode: {
|
|
1593
1446
|
active: () => runtime.plan?.active() ?? false,
|
|
1594
1447
|
from: () => runtime.plan?.from() ?? null,
|
|
1595
|
-
enter: () => runtime.plan?.enter() ?? { ok: false, reason:
|
|
1448
|
+
enter: () => runtime.plan?.enter() ?? { ok: false, reason: t10("tui_host.plan_unavailable") },
|
|
1596
1449
|
leave: () => runtime.plan?.leave() ?? null,
|
|
1597
1450
|
approvedPlan: () => runtime.plan?.approvedPlan() ?? null
|
|
1598
1451
|
}
|
|
@@ -1611,12 +1464,12 @@ function displayModelOf(config) {
|
|
|
1611
1464
|
import { readFileSync as readFileSync2 } from "fs";
|
|
1612
1465
|
import { dirname as dirname2, join as join3 } from "path";
|
|
1613
1466
|
import { fileURLToPath } from "url";
|
|
1614
|
-
import { t as
|
|
1467
|
+
import { t as t12 } from "@epoch-agent/infra";
|
|
1615
1468
|
// src/installation.ts
|
|
1616
1469
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
1617
1470
|
import { existsSync as existsSync2, realpathSync } from "fs";
|
|
1618
1471
|
import { join as join2 } from "path";
|
|
1619
|
-
import { normalizeForMatch, t as
|
|
1472
|
+
import { normalizeForMatch, t as t11 } from "@epoch-agent/infra";
|
|
1620
1473
|
// src/version.ts
|
|
1621
1474
|
function readVersion() {
|
|
1622
1475
|
const here = dirname2(fileURLToPath(import.meta.url));
|
|
@@ -1638,9 +1491,6 @@ var PENDING_SCAN_RUNS = 100;
|
|
|
1638
1491
|
async function main() {
|
|
1639
1492
|
applyConfiguredLanguage();
|
|
1640
1493
|
applyConfiguredCurrency();
|
|
1641
|
-
if (!await maybePromptForTrust()) {
|
|
1642
|
-
process.exit(1);
|
|
1643
|
-
}
|
|
1644
1494
|
if (!await maybePromptForExternalImports()) {
|
|
1645
1495
|
process.exit(1);
|
|
1646
1496
|
}
|
|
@@ -1651,7 +1501,7 @@ async function main() {
|
|
|
1651
1501
|
});
|
|
1652
1502
|
const { session, config } = runtime;
|
|
1653
1503
|
if (!session) {
|
|
1654
|
-
process.stderr.write(`${
|
|
1504
|
+
process.stderr.write(`${t13("tui.no_provider")}
|
|
1655
1505
|
${runtime.diagnostics.join("\n")}
|
|
1656
1506
|
`);
|
|
1657
1507
|
process.exit(1);
|
|
@@ -1676,7 +1526,7 @@ ${runtime.diagnostics.join("\n")}
|
|
|
1676
1526
|
const pending = runtime.schedules.storeAvailable ? pendingNotice(runtime.schedules.list(), runtime.schedules.recentRuns(PENDING_SCAN_RUNS)) : null;
|
|
1677
1527
|
const instance = renderApp({
|
|
1678
1528
|
sessionId: session.sessionId,
|
|
1679
|
-
translate: (key, vars) =>
|
|
1529
|
+
translate: (key, vars) => t13(key, vars),
|
|
1680
1530
|
usageScope: runtime.usageScope,
|
|
1681
1531
|
...config.display?.currency ? { currency: config.display.currency } : {},
|
|
1682
1532
|
app: { version: VERSION, cwd: process.cwd() },
|
|
@@ -1687,7 +1537,7 @@ ${runtime.diagnostics.join("\n")}
|
|
|
1687
1537
|
contextLimit,
|
|
1688
1538
|
getUseBackgroundColor: () => false
|
|
1689
1539
|
},
|
|
1690
|
-
welcomeMessage:
|
|
1540
|
+
welcomeMessage: t13("tui_entry.welcome"),
|
|
1691
1541
|
startupNotices: composeStartupNotices({
|
|
1692
1542
|
runtimeDiags: runtime.diagnostics,
|
|
1693
1543
|
keyDiags: keys.diagnostics,
|
|
@@ -1715,7 +1565,7 @@ ${runtime.diagnostics.join("\n")}
|
|
|
1715
1565
|
}
|
|
1716
1566
|
main().catch((err) => {
|
|
1717
1567
|
if (expectedFailureExitCode(err) !== void 0) reportFatal(err);
|
|
1718
|
-
process.stderr.write(`${
|
|
1568
|
+
process.stderr.write(`${t13("run.tui_spawn_failed", { message: String(err) })}
|
|
1719
1569
|
`);
|
|
1720
1570
|
process.exit(1);
|
|
1721
1571
|
});
|