agent-whisker 0.1.0 → 0.2.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 +12 -3
- package/README.zh-CN.md +12 -3
- package/package.json +3 -2
- package/packages/antigravity-plugin/package.json +1 -1
- package/packages/antigravity-plugin/plugin.json +1 -1
- package/packages/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/packages/claude-plugin/.codex-plugin/plugin.json +1 -1
- package/packages/claude-plugin/README.md +11 -1
- package/packages/claude-plugin/README.zh-CN.md +4 -1
- package/packages/claude-plugin/bin/taskstate +145 -4
- package/packages/claude-plugin/hooks/codex.json +8 -8
- package/packages/claude-plugin/package.json +1 -1
- package/packages/cli/README.md +76 -3
- package/packages/cli/README.zh-CN.md +76 -3
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/command.js +20 -3
- package/packages/cli/src/commands/catalog.js +26 -7
- package/packages/cli/src/commands/doctor.js +31 -27
- package/packages/cli/src/commands/exclude.js +156 -0
- package/packages/cli/src/commands/extract.js +4 -2
- package/packages/cli/src/commands/index-command.js +1 -1
- package/packages/cli/src/commands/index.js +4 -0
- package/packages/cli/src/commands/install.js +12 -1
- package/packages/cli/src/commands/nudge.js +39 -37
- package/packages/cli/src/commands/read.js +2 -1
- package/packages/cli/src/commands/search.js +33 -3
- package/packages/cli/src/commands/sessions.js +20 -12
- package/packages/cli/src/commands/status.js +6 -3
- package/packages/cli/src/commands/tui.js +62 -0
- package/packages/cli/src/commands/version.js +4 -4
- package/packages/cli/src/exclusion.js +88 -0
- package/packages/cli/src/install/codex-plugin.js +6 -5
- package/packages/cli/src/install/external.js +48 -37
- package/packages/cli/src/install/handlers.js +4 -3
- package/packages/cli/src/install/mcp.js +3 -3
- package/packages/cli/src/install/steps.js +43 -15
- package/packages/cli/src/install/wrapper.js +28 -5
- package/packages/cli/src/main.js +9 -12
- package/packages/cli/src/node-version.js +25 -0
- package/packages/cli/src/run.js +25 -5
- package/packages/cli/src/tui/app.js +1430 -0
- package/packages/cli/src/tui/data/call.js +83 -0
- package/packages/cli/src/tui/data/poll.js +24 -0
- package/packages/cli/src/tui/glyphs.js +93 -0
- package/packages/cli/src/tui/i18n.js +342 -0
- package/packages/cli/src/tui/model.js +251 -0
- package/packages/cli/src/tui/pages/common.js +71 -0
- package/packages/cli/src/tui/pages/library.js +154 -0
- package/packages/cli/src/tui/pages/sessions.js +96 -0
- package/packages/cli/src/tui/pages/system.js +124 -0
- package/packages/cli/src/tui/pages/tasks.js +297 -0
- package/packages/cli/src/tui/run.js +216 -0
- package/packages/cli/src/tui/term/keys.js +152 -0
- package/packages/cli/src/tui/term/screen.js +88 -0
- package/packages/cli/src/tui/term/term.js +157 -0
- package/packages/cli/src/tui/term/width.js +290 -0
- package/packages/cli/src/tui/ui/widgets.js +247 -0
- package/packages/core/README.md +1 -1
- package/packages/core/README.zh-CN.md +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/src/catalog.js +13 -1
- package/packages/core/src/clairic.js +1 -1
- package/packages/core/src/convert.js +1 -1
- package/packages/core/src/db.js +6 -1
- package/packages/core/src/host.js +104 -0
- package/packages/core/src/index.js +2 -2
- package/packages/core/src/library-read.js +12 -8
- package/packages/core/src/nudge.js +34 -1
- package/packages/core/src/schema.js +17 -0
- package/packages/core/src/sessions-read.js +23 -11
- package/packages/dsh-plugin/package.json +1 -1
- package/packages/herdr-plugin/herdr-plugin.toml +1 -1
- package/packages/herdr-plugin/package.json +1 -1
- package/packages/mcp/README.md +5 -5
- package/packages/mcp/README.zh-CN.md +5 -5
- package/packages/mcp/package.json +1 -1
- package/packages/pi-extension/README.md +1 -1
- package/packages/pi-extension/README.zh-CN.md +1 -1
- package/packages/pi-extension/package.json +1 -1
- package/packages/pi-extension/src/extension.ts +3 -3
- package/packages/service/package.json +1 -1
- package/packages/service/src/index.js +1 -1
- package/packages/service/src/runtime.js +4 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// The interface's only way to data: the CLI's own commands with --json, called in this process through runCli (each
|
|
2
|
+
// call opens the store and closes it before it returns, so an idle interface holds no lock and never blocks `index
|
|
3
|
+
// repair`), and taskstate's --json answers through Host.run. One call at a time (a single-flight queue): node:sqlite
|
|
4
|
+
// is synchronous, so keys pressed meanwhile wait in stdin and are handled in order afterwards. The interface never
|
|
5
|
+
// parses text meant for people: an answer that is not JSON, or JSON of a schema it does not know, is an error.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/** A call's answer: the parsed JSON, or why it failed (the error line's code and message, and the exit code). */
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/** The two kinds of calls; a test replaces either to record or fake them. */
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/** How runCli is reached: passed in by the command, so this file does not import run.ts (which imports the command). */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/** The first `error: <code>: <message>` line of stderr, or Internal with the whole text. */
|
|
25
|
+
function errorOf(stderr , exit ) {
|
|
26
|
+
const match = /^error: ([A-Za-z]+): (.*)$/mu.exec(stderr) ?? /^taskstate: (.*)$/mu.exec(stderr);
|
|
27
|
+
if (match === null) return { ok: false, code: "Internal", message: stderr.trim() || `exit ${exit}`, exit };
|
|
28
|
+
if (match.length === 2) return { ok: false, code: "Taskstate", message: match[1] ?? "", exit };
|
|
29
|
+
return { ok: false, code: match[1] ?? "Internal", message: match[2] ?? "", exit };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The real Runner over host: cli calls run(argv) with a copy of host whose out and err are captured and whose tty is
|
|
34
|
+
* removed (a nested command must never touch the terminal), and --cwd cwd so every call sees the interface's project.
|
|
35
|
+
* taskstate runs `host.execPath <taskstatePath> …` in cwd with a 15-second deadline.
|
|
36
|
+
*/
|
|
37
|
+
export function hostRunner(host , run , taskstatePath , cwd ) {
|
|
38
|
+
let queue = Promise.resolve();
|
|
39
|
+
const single = (fn ) => {
|
|
40
|
+
const next = queue.then(fn, fn);
|
|
41
|
+
queue = next.catch(() => {});
|
|
42
|
+
return next;
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
cli: (argv) =>
|
|
46
|
+
single(async () => {
|
|
47
|
+
const out = [];
|
|
48
|
+
const err = [];
|
|
49
|
+
const { tty: _tty, ...rest } = host;
|
|
50
|
+
const inner = { ...rest, out: (text) => void out.push(text), err: (text) => void err.push(text) };
|
|
51
|
+
const exit = await run([...argv, "--json", "--cwd", cwd], inner);
|
|
52
|
+
// A command may fail and still answer JSON on stdout (doctor exits 1 when a check fails): the answer counts.
|
|
53
|
+
if (exit !== 0 && out.join("").trim() === "") return errorOf(err.join(""), exit);
|
|
54
|
+
return parsed(out.join(""));
|
|
55
|
+
}),
|
|
56
|
+
taskstate: (argv, json) =>
|
|
57
|
+
single(async () => {
|
|
58
|
+
const answer = host.run(host.execPath, [taskstatePath, ...argv, ...(json ? ["--json"] : [])], {
|
|
59
|
+
cwd,
|
|
60
|
+
timeoutMs: 15_000,
|
|
61
|
+
});
|
|
62
|
+
if (answer.code !== 0) return errorOf(answer.stderr, answer.code ?? 1);
|
|
63
|
+
if (!json) return { ok: true, json: null, text: answer.stdout };
|
|
64
|
+
const result = parsed(answer.stdout);
|
|
65
|
+
if (result.ok && (result.json )?.schema !== 1)
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
code: "Schema",
|
|
69
|
+
message: "taskstate answered a schema this interface does not know",
|
|
70
|
+
exit: 1,
|
|
71
|
+
};
|
|
72
|
+
return result;
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parsed(text ) {
|
|
78
|
+
try {
|
|
79
|
+
return { ok: true, json: JSON.parse(text), text };
|
|
80
|
+
} catch {
|
|
81
|
+
return { ok: false, code: "NotJson", message: "the command did not answer JSON", exit: 1 };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The refresh probe: a stamp of what the store's writers and taskstate last touched, computed without opening a
|
|
2
|
+
// database or taking a lock (core's storeStamp lstats five files; taskstate's state.jsonl is statted). The interface
|
|
3
|
+
// compares stamps every POLL_ACTIVE_MS while keys arrive and every POLL_IDLE_MS after IDLE_AFTER_MS without one, and
|
|
4
|
+
// reads the current page again only when the stamp changed.
|
|
5
|
+
import { statSync } from "node:fs";
|
|
6
|
+
import { storeStamp } from "../../../../core/src/index.js";
|
|
7
|
+
|
|
8
|
+
export const POLL_ACTIVE_MS = 2_000;
|
|
9
|
+
export const POLL_IDLE_MS = 10_000;
|
|
10
|
+
export const IDLE_AFTER_MS = 5 * 60_000;
|
|
11
|
+
|
|
12
|
+
/** The stamp of the store at home and taskstate's state file (null when its place is not known yet). */
|
|
13
|
+
export function probeStamp(home , taskstateState ) {
|
|
14
|
+
let tasks = "-";
|
|
15
|
+
if (taskstateState !== null) {
|
|
16
|
+
try {
|
|
17
|
+
const stat = statSync(taskstateState);
|
|
18
|
+
tasks = `${stat.size}:${stat.mtimeMs}`;
|
|
19
|
+
} catch {
|
|
20
|
+
tasks = "-";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return { store: storeStamp(home), tasks };
|
|
24
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// The interface's symbol language, the same as the desktop interface's: shapes carry the meaning, colour only
|
|
2
|
+
// repeats it. ◆ ok/met, ◇ needs review or a missing red baseline, ⊘ void (or kept out), ✕ not met; ◯ open tier
|
|
3
|
+
// (may reach a cloud model), ◎ personal (stays on this machine), ● hidden. Without UTF-8 (or with
|
|
4
|
+
// AGENT_WHISKER_TUI_ASCII=1) each has an ASCII stand-in, and no private-use (Nerd Font) character is ever used.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const UNICODE = {
|
|
34
|
+
met: "◆",
|
|
35
|
+
review: "◇",
|
|
36
|
+
void: "⊘",
|
|
37
|
+
notMet: "✕",
|
|
38
|
+
none: "·",
|
|
39
|
+
open: "◯",
|
|
40
|
+
personal: "◎",
|
|
41
|
+
hidden: "●",
|
|
42
|
+
cursor: "▸",
|
|
43
|
+
hline: "─",
|
|
44
|
+
vline: "│",
|
|
45
|
+
cross: "┬",
|
|
46
|
+
arrow: "──▶",
|
|
47
|
+
quote: "│",
|
|
48
|
+
more: "…",
|
|
49
|
+
ok: "✓",
|
|
50
|
+
fail: "✗",
|
|
51
|
+
busy: "⟳",
|
|
52
|
+
paused: "⏸",
|
|
53
|
+
link: "↔",
|
|
54
|
+
prompt: "❯",
|
|
55
|
+
bar: "▓",
|
|
56
|
+
barEmpty: "░",
|
|
57
|
+
branch: "└",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const ASCII = {
|
|
61
|
+
met: "#",
|
|
62
|
+
review: "-",
|
|
63
|
+
void: "/",
|
|
64
|
+
notMet: "x",
|
|
65
|
+
none: ".",
|
|
66
|
+
open: "o",
|
|
67
|
+
personal: "@",
|
|
68
|
+
hidden: "*",
|
|
69
|
+
cursor: ">",
|
|
70
|
+
hline: "-",
|
|
71
|
+
vline: "|",
|
|
72
|
+
cross: "+",
|
|
73
|
+
arrow: "-->",
|
|
74
|
+
quote: "|",
|
|
75
|
+
more: "...",
|
|
76
|
+
ok: "+",
|
|
77
|
+
fail: "!",
|
|
78
|
+
busy: "~",
|
|
79
|
+
paused: "=",
|
|
80
|
+
link: "<>",
|
|
81
|
+
prompt: ">",
|
|
82
|
+
bar: "#",
|
|
83
|
+
barEmpty: ".",
|
|
84
|
+
branch: "`",
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** ASCII when AGENT_WHISKER_TUI_ASCII is 1 or the locale (LC_ALL, LC_CTYPE, LANG, first set) is not UTF-8. */
|
|
88
|
+
export function glyphsFor(env ) {
|
|
89
|
+
if (env.AGENT_WHISKER_TUI_ASCII === "1") return ASCII;
|
|
90
|
+
const locale = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
91
|
+
if (locale !== "" && !/utf-?8/iu.test(locale)) return ASCII;
|
|
92
|
+
return UNICODE;
|
|
93
|
+
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
// The interface's words in English and Simplified Chinese. The language is AGENT_WHISKER_LANG (en or zh-CN), else
|
|
2
|
+
// the first of LC_ALL, LC_MESSAGES and LANG that is set (zh… gives Chinese), else English. Placeholders {0}, {1}, …
|
|
3
|
+
// are filled in order. Every key has both languages; a test holds the two tables to the same keys.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const EN = {
|
|
8
|
+
appName: "agent-whisker",
|
|
9
|
+
tabTasks: "Tasks",
|
|
10
|
+
tabLibrary: "Library",
|
|
11
|
+
tabSessions: "Sessions",
|
|
12
|
+
tabAgents: "Agents",
|
|
13
|
+
tabDoctor: "Models & doctor",
|
|
14
|
+
tabDoctorShort: "Doctor",
|
|
15
|
+
trySearch: "try search",
|
|
16
|
+
tooSmall: "terminal too small (needs ≥ 40×12)",
|
|
17
|
+
refreshed: "refreshed",
|
|
18
|
+
loading: "loading…",
|
|
19
|
+
running: "running {0}…",
|
|
20
|
+
paused: "store maintenance in progress; refresh paused",
|
|
21
|
+
failed: "failed: {0}",
|
|
22
|
+
more: "more",
|
|
23
|
+
moreAbove: "↑ {0} more",
|
|
24
|
+
moreBelow: "↓ {0} more",
|
|
25
|
+
helpTitle: "Keys on this page",
|
|
26
|
+
helpClose: "Esc closes",
|
|
27
|
+
// keys
|
|
28
|
+
kMove: "move",
|
|
29
|
+
kOpen: "open",
|
|
30
|
+
kBack: "back",
|
|
31
|
+
kPane: "pane",
|
|
32
|
+
kHold: "hand off",
|
|
33
|
+
kPark: "park",
|
|
34
|
+
kClose: "close",
|
|
35
|
+
kSearch: "search",
|
|
36
|
+
kPages: "pages",
|
|
37
|
+
kHelp: "help",
|
|
38
|
+
kQuit: "quit",
|
|
39
|
+
kRefresh: "refresh",
|
|
40
|
+
kHide: "hide",
|
|
41
|
+
kUndo: "undo",
|
|
42
|
+
kExclude: "exclude dir",
|
|
43
|
+
kAdd: "add dir",
|
|
44
|
+
kFacet: "view",
|
|
45
|
+
kRead: "read",
|
|
46
|
+
kJumpTask: "to task",
|
|
47
|
+
kJumpSession: "to session",
|
|
48
|
+
kHarness: "program",
|
|
49
|
+
kRange: "range",
|
|
50
|
+
kDoctor: "run doctor",
|
|
51
|
+
kFilter: "filter",
|
|
52
|
+
kScroll: "scroll",
|
|
53
|
+
kLog: "log",
|
|
54
|
+
// tasks
|
|
55
|
+
tasksNone: "no task recorded yet (agents record them with taskstate)",
|
|
56
|
+
tasksNoTaskstate: "taskstate cannot be read: {0}",
|
|
57
|
+
tasksSummary: "open {0} · parked {1} · closed {2}",
|
|
58
|
+
groupParked: "parked",
|
|
59
|
+
groupClosed: "closed",
|
|
60
|
+
colBaseline: "baseline",
|
|
61
|
+
colEvidence: "evidence",
|
|
62
|
+
colConclusion: "conclusion",
|
|
63
|
+
core: "CORE",
|
|
64
|
+
expSummary: "{0} expectations · {1} with usable evidence · {2} met · {3} gaps",
|
|
65
|
+
redSeen: "{0} failed",
|
|
66
|
+
noRedBaseline: "no red baseline",
|
|
67
|
+
passed: "{0} passed",
|
|
68
|
+
voided: "{0} void",
|
|
69
|
+
failedRun: "{0} failed",
|
|
70
|
+
met: "met",
|
|
71
|
+
notMet: "not met",
|
|
72
|
+
notVerified: "not verified",
|
|
73
|
+
stale: "conclusion stale",
|
|
74
|
+
selfReview: "self-review",
|
|
75
|
+
gapsTitle: "gaps {0} · written by an agent; read before running anything",
|
|
76
|
+
gapCheck: "proposed check (text only, never run): {0}",
|
|
77
|
+
claimsTitle: "claims · the agent's own words, not evidence",
|
|
78
|
+
dirtyNote: "ran with uncommitted changes (a note only; the verdict ignores it)",
|
|
79
|
+
changedNote: "target changed since: {0}",
|
|
80
|
+
failedAgainNote: "the same command failed again: {0}",
|
|
81
|
+
reasonsTitle: "why it cannot be concluded met",
|
|
82
|
+
runsTitle: "runs",
|
|
83
|
+
logTitle: "{0} log (last {1} lines)",
|
|
84
|
+
logMissing: "{0} wrote no output",
|
|
85
|
+
conclusionBy: "{0} · basis {1} · by {2}",
|
|
86
|
+
noConclusion: "no conclusion yet",
|
|
87
|
+
sessionsOfTask: "{0} sessions",
|
|
88
|
+
stateOpen: "open",
|
|
89
|
+
stateParked: "parked",
|
|
90
|
+
stateHeld: "offered for handoff",
|
|
91
|
+
stateClosed: "closed",
|
|
92
|
+
// library
|
|
93
|
+
flowSources: "personal & project docs",
|
|
94
|
+
flowGate: "MCP gate",
|
|
95
|
+
flowVisible: "visible {0}",
|
|
96
|
+
flowHidden: "hidden {0}",
|
|
97
|
+
flowBoundary: "machine boundary",
|
|
98
|
+
flowLocal: "local only {0}",
|
|
99
|
+
flowCloud: "cloud OK {0}",
|
|
100
|
+
flowNote: "personal stays on this machine; agents read through MCP only what is visible here",
|
|
101
|
+
facetAll: "all visible",
|
|
102
|
+
facetPersonal: "personal · local",
|
|
103
|
+
facetOpen: "open · cloud OK",
|
|
104
|
+
facetHidden: "hidden & excluded",
|
|
105
|
+
libNone: "no documents in this view",
|
|
106
|
+
libHiddenTag: "hidden · u undo",
|
|
107
|
+
libExcludedTag: "excluded dir",
|
|
108
|
+
libNotInit: "the library is not set up yet",
|
|
109
|
+
docDetail: "{0} · {1} bytes · {2}",
|
|
110
|
+
tierOpen: "open: agents may send it to a cloud model",
|
|
111
|
+
tierPersonal: "personal: agents may read it, processed only on this machine",
|
|
112
|
+
view: "view {0} · ceiling {1}",
|
|
113
|
+
viewUser: "user",
|
|
114
|
+
// sessions
|
|
115
|
+
sessAll: "all programs",
|
|
116
|
+
sessDays: "{0} days",
|
|
117
|
+
sessAny: "any time",
|
|
118
|
+
sessNone: "no session in this range",
|
|
119
|
+
sessGone: "source gone · kept",
|
|
120
|
+
sessEntries: "{0} entries",
|
|
121
|
+
sessReader: "{0} · {1} entries",
|
|
122
|
+
sessNotSynced: "sessions are not collected yet (agent-whisker sessions sync)",
|
|
123
|
+
// agents and doctor
|
|
124
|
+
agentsTitle: "agent programs · install --dry-run (preview only, nothing is applied)",
|
|
125
|
+
agentsNone: "install preview not available here: {0}",
|
|
126
|
+
agentsLinux: "install sets up macOS and Windows; on Linux register the MCP server by hand",
|
|
127
|
+
doctorTitle: "models and tools",
|
|
128
|
+
decide: "Decide (rerank)",
|
|
129
|
+
extract: "Extract",
|
|
130
|
+
notConfigured: "not configured",
|
|
131
|
+
configured: "configured · {0}",
|
|
132
|
+
tools: "format tools",
|
|
133
|
+
doctorHint: "press D to run doctor (it starts the programs it checks)",
|
|
134
|
+
doctorChecks: "doctor: {0} ok · {1} warn · {2} fail",
|
|
135
|
+
startTitle: "Get started",
|
|
136
|
+
startInit: "set up the data directory: agent-whisker init",
|
|
137
|
+
startLibrary: "add documents: agent-whisker project add, agent-whisker ingest <dir>",
|
|
138
|
+
startInstall: "connect the agent programs: agent-whisker install",
|
|
139
|
+
// search overlay
|
|
140
|
+
searchTitle: "search as an agent sees · ceiling {0} · {1}",
|
|
141
|
+
searchTyping: "while typing: no rerank",
|
|
142
|
+
searchReal: "Enter: the agent's real view (rerank as configured)",
|
|
143
|
+
searchAvoided: "this search's view leaves out {0} hidden and {1} excluded documents",
|
|
144
|
+
searchNone: "no results",
|
|
145
|
+
searchSessions: "sessions",
|
|
146
|
+
searchLibrary: "library",
|
|
147
|
+
// confirmation
|
|
148
|
+
confirmYes: "y/↵ confirm",
|
|
149
|
+
confirmYesOnly: "y confirm (Enter does nothing)",
|
|
150
|
+
confirmNo: "n/Esc cancel",
|
|
151
|
+
confirmTooLong: "the command does not fit this screen; enlarge it to see and confirm all of it",
|
|
152
|
+
confirmToggle: "space toggles",
|
|
153
|
+
confirmChoose: "choose a tier: o open · p personal",
|
|
154
|
+
wHold: "offer {0} for handoff",
|
|
155
|
+
wPark: "park {0}",
|
|
156
|
+
wUnpark: "restore {0} from parked",
|
|
157
|
+
wClose: "close {0} (cannot be undone)",
|
|
158
|
+
wHide: "hide «{0}» from catalog and search",
|
|
159
|
+
wRestore: "restore «{0}» to catalog and search",
|
|
160
|
+
wExclude: "keep {0} out of the library",
|
|
161
|
+
wHideIngested: "also hide the documents already ingested from it",
|
|
162
|
+
wAdd: "add {0} to the library",
|
|
163
|
+
wAddPath: "directory to add: ",
|
|
164
|
+
done: "done: {0}",
|
|
165
|
+
undone: "undone: {0}",
|
|
166
|
+
nothingToUndo: "nothing to undo",
|
|
167
|
+
auditTitle: "agent-whisker tui ran these writes:",
|
|
168
|
+
} ;
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
const ZH = {
|
|
173
|
+
appName: "agent-whisker",
|
|
174
|
+
tabTasks: "任务",
|
|
175
|
+
tabLibrary: "资料",
|
|
176
|
+
tabSessions: "会话",
|
|
177
|
+
tabAgents: "Agent",
|
|
178
|
+
tabDoctor: "模型与诊断",
|
|
179
|
+
tabDoctorShort: "诊断",
|
|
180
|
+
trySearch: "试搜",
|
|
181
|
+
tooSmall: "终端太小(需 ≥ 40×12)",
|
|
182
|
+
refreshed: "已刷新",
|
|
183
|
+
loading: "加载中…",
|
|
184
|
+
running: "正在运行 {0}…",
|
|
185
|
+
paused: "存储维护中,已暂停刷新",
|
|
186
|
+
failed: "失败:{0}",
|
|
187
|
+
more: "更多",
|
|
188
|
+
moreAbove: "↑ 还有 {0} 项",
|
|
189
|
+
moreBelow: "↓ 还有 {0} 项",
|
|
190
|
+
helpTitle: "本页按键",
|
|
191
|
+
helpClose: "Esc 关闭",
|
|
192
|
+
kMove: "移动",
|
|
193
|
+
kOpen: "展开",
|
|
194
|
+
kBack: "返回",
|
|
195
|
+
kPane: "切栏",
|
|
196
|
+
kHold: "交接",
|
|
197
|
+
kPark: "暂挂",
|
|
198
|
+
kClose: "结案",
|
|
199
|
+
kSearch: "试搜",
|
|
200
|
+
kPages: "切页",
|
|
201
|
+
kHelp: "帮助",
|
|
202
|
+
kQuit: "退出",
|
|
203
|
+
kRefresh: "刷新",
|
|
204
|
+
kHide: "隐藏",
|
|
205
|
+
kUndo: "撤销",
|
|
206
|
+
kExclude: "排除目录",
|
|
207
|
+
kAdd: "加入目录",
|
|
208
|
+
kFacet: "切面",
|
|
209
|
+
kRead: "阅读",
|
|
210
|
+
kJumpTask: "跳任务",
|
|
211
|
+
kJumpSession: "跳会话",
|
|
212
|
+
kHarness: "端",
|
|
213
|
+
kRange: "范围",
|
|
214
|
+
kDoctor: "运行诊断",
|
|
215
|
+
kFilter: "筛选",
|
|
216
|
+
kScroll: "滚动",
|
|
217
|
+
kLog: "日志",
|
|
218
|
+
tasksNone: "还没有任务(Agent 用 taskstate 记录)",
|
|
219
|
+
tasksNoTaskstate: "无法读取 taskstate:{0}",
|
|
220
|
+
tasksSummary: "进行中 {0} · 暂挂 {1} · 已结案 {2}",
|
|
221
|
+
groupParked: "暂挂",
|
|
222
|
+
groupClosed: "已结案",
|
|
223
|
+
colBaseline: "基线",
|
|
224
|
+
colEvidence: "证据",
|
|
225
|
+
colConclusion: "结论",
|
|
226
|
+
core: "CORE",
|
|
227
|
+
expSummary: "{0} 条期望 · {1} 条证据有效 · {2} 条达标 · {3} 个缺口",
|
|
228
|
+
redSeen: "{0} 失败",
|
|
229
|
+
noRedBaseline: "缺红灯基线",
|
|
230
|
+
passed: "{0} 通过",
|
|
231
|
+
voided: "{0} 失效",
|
|
232
|
+
failedRun: "{0} 失败",
|
|
233
|
+
met: "达标",
|
|
234
|
+
notMet: "未达标",
|
|
235
|
+
notVerified: "待复核",
|
|
236
|
+
stale: "结论已过期",
|
|
237
|
+
selfReview: "自审",
|
|
238
|
+
gapsTitle: "缺口 {0} · 由 Agent 写入,运行前请先自行阅读",
|
|
239
|
+
gapCheck: "建议命令(仅文本,不会执行):{0}",
|
|
240
|
+
claimsTitle: "Claim · Agent 自述,非证据",
|
|
241
|
+
dirtyNote: "运行时工作区有未提交改动(仅提示,不影响判定)",
|
|
242
|
+
changedNote: "此后目标已改动:{0}",
|
|
243
|
+
failedAgainNote: "同一命令之后又失败:{0}",
|
|
244
|
+
reasonsTitle: "不能判定达标的原因",
|
|
245
|
+
runsTitle: "运行记录",
|
|
246
|
+
logTitle: "{0} 日志(最后 {1} 行)",
|
|
247
|
+
logMissing: "{0} 没有输出",
|
|
248
|
+
conclusionBy: "{0} · 依据 {1} · 写入 {2}",
|
|
249
|
+
noConclusion: "尚无结论",
|
|
250
|
+
sessionsOfTask: "{0} 个会话",
|
|
251
|
+
stateOpen: "进行中",
|
|
252
|
+
stateParked: "暂挂",
|
|
253
|
+
stateHeld: "待交接",
|
|
254
|
+
stateClosed: "已结案",
|
|
255
|
+
flowSources: "个人与项目资料",
|
|
256
|
+
flowGate: "MCP 准入线",
|
|
257
|
+
flowVisible: "可见 {0}",
|
|
258
|
+
flowHidden: "已屏蔽 {0}",
|
|
259
|
+
flowBoundary: "本机边界",
|
|
260
|
+
flowLocal: "仅本机 {0}",
|
|
261
|
+
flowCloud: "云端可用 {0}",
|
|
262
|
+
flowNote: "personal 只在本机处理;Agent 经 MCP 只读到此处可见的资料",
|
|
263
|
+
facetAll: "全部可见",
|
|
264
|
+
facetPersonal: "个人仅本机",
|
|
265
|
+
facetOpen: "云端可用",
|
|
266
|
+
facetHidden: "已屏蔽与不收录",
|
|
267
|
+
libNone: "此视角下没有文档",
|
|
268
|
+
libHiddenTag: "已隐藏·u撤销",
|
|
269
|
+
libExcludedTag: "目录不收录",
|
|
270
|
+
libNotInit: "资料库尚未初始化",
|
|
271
|
+
docDetail: "{0} · {1} 字节 · {2}",
|
|
272
|
+
tierOpen: "open:Agent 可发往云端模型",
|
|
273
|
+
tierPersonal: "personal:Agent 可查,只在本机处理,不出网",
|
|
274
|
+
view: "视角 {0} · 上限 {1}",
|
|
275
|
+
viewUser: "用户",
|
|
276
|
+
sessAll: "全部端",
|
|
277
|
+
sessDays: "{0} 天",
|
|
278
|
+
sessAny: "全部时间",
|
|
279
|
+
sessNone: "此范围内没有会话",
|
|
280
|
+
sessGone: "源已删·留存",
|
|
281
|
+
sessEntries: "{0} 条",
|
|
282
|
+
sessReader: "{0} · {1} 条",
|
|
283
|
+
sessNotSynced: "会话尚未收集(agent-whisker sessions sync)",
|
|
284
|
+
agentsTitle: "Agent 程序 · install --dry-run(只预览,不应用)",
|
|
285
|
+
agentsNone: "此处无法预览 install:{0}",
|
|
286
|
+
agentsLinux: "install 只配置 macOS 与 Windows;Linux 请手动注册 MCP 服务",
|
|
287
|
+
doctorTitle: "模型与工具",
|
|
288
|
+
decide: "Decide(精排)",
|
|
289
|
+
extract: "Extract(抽取)",
|
|
290
|
+
notConfigured: "未配置",
|
|
291
|
+
configured: "已配置 · {0}",
|
|
292
|
+
tools: "格式工具",
|
|
293
|
+
doctorHint: "按 D 运行 doctor(会启动它检查的程序)",
|
|
294
|
+
doctorChecks: "doctor:{0} 正常 · {1} 警告 · {2} 失败",
|
|
295
|
+
startTitle: "开始使用",
|
|
296
|
+
startInit: "建立数据目录:agent-whisker init",
|
|
297
|
+
startLibrary: "加入资料:agent-whisker project add、agent-whisker ingest <dir>",
|
|
298
|
+
startInstall: "接入 Agent 程序:agent-whisker install",
|
|
299
|
+
searchTitle: "以 Agent 视角试搜 · 上限 {0} · {1}",
|
|
300
|
+
searchTyping: "输入时:不精排",
|
|
301
|
+
searchReal: "回车:Agent 的真实视角(按配置精排)",
|
|
302
|
+
searchAvoided: "本次视角避开 {0} 篇已隐藏、{1} 篇排除目录下的文档",
|
|
303
|
+
searchNone: "无结果",
|
|
304
|
+
searchSessions: "会话",
|
|
305
|
+
searchLibrary: "资料",
|
|
306
|
+
confirmYes: "y/↵ 确认",
|
|
307
|
+
confirmYesOnly: "y 确认(回车无效)",
|
|
308
|
+
confirmNo: "n/Esc 取消",
|
|
309
|
+
confirmTooLong: "命令在此屏幕放不下;请放大终端,看到完整命令后再确认",
|
|
310
|
+
confirmToggle: "空格 切换",
|
|
311
|
+
confirmChoose: "选择分级:o open · p personal",
|
|
312
|
+
wHold: "将 {0} 设为待交接",
|
|
313
|
+
wPark: "暂挂 {0}",
|
|
314
|
+
wUnpark: "恢复暂挂的 {0}",
|
|
315
|
+
wClose: "结案 {0}(不可撤销)",
|
|
316
|
+
wHide: "从目录与检索中隐藏「{0}」",
|
|
317
|
+
wRestore: "恢复「{0}」到目录与检索",
|
|
318
|
+
wExclude: "写入 ⊘ 不收录:{0}",
|
|
319
|
+
wHideIngested: "并隐藏该目录下已收录的文档",
|
|
320
|
+
wAdd: "将 {0} 加入资料库",
|
|
321
|
+
wAddPath: "要加入的目录:",
|
|
322
|
+
done: "已完成:{0}",
|
|
323
|
+
undone: "已撤销:{0}",
|
|
324
|
+
nothingToUndo: "没有可撤销的操作",
|
|
325
|
+
auditTitle: "agent-whisker tui 执行了以下写操作:",
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const TABLES = { en: EN, "zh-CN": ZH };
|
|
329
|
+
|
|
330
|
+
/** The language for env, as the file header says. */
|
|
331
|
+
export function langFor(env ) {
|
|
332
|
+
const given = env.AGENT_WHISKER_LANG;
|
|
333
|
+
if (given === "en" || given === "zh-CN") return given;
|
|
334
|
+
const locale = env.LC_ALL || env.LC_MESSAGES || env.LANG || "";
|
|
335
|
+
return /^zh/iu.test(locale) ? "zh-CN" : "en";
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** A translator for lang: t(key, ...values). */
|
|
339
|
+
export function translator(lang ) {
|
|
340
|
+
const table = TABLES[lang];
|
|
341
|
+
return (key, ...values) => table[key].replace(/\{(\d+)\}/gu, (_, n) => String(values[Number(n)] ?? ""));
|
|
342
|
+
}
|