@kangyishuai/dsh-advisor 0.1.0 → 0.3.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 +65 -37
- package/README.zh-CN.md +49 -27
- package/lib/adoption.js +12 -6
- package/lib/budget.js +100 -0
- package/lib/call.js +8 -3
- package/lib/catalog.js +143 -0
- package/lib/client.js +1790 -343
- package/lib/ledger.js +66 -1
- package/lib/prompt.js +21 -0
- package/lib/route.js +5 -2
- package/lib/service.js +354 -14
- package/lib/settings.js +79 -10
- package/lib/trace.js +31 -0
- package/lib/twopass.js +60 -0
- package/lib/verifier.js +107 -0
- package/locale/en.json +122 -26
- package/locale/zh.json +128 -32
- package/package.json +1 -1
package/lib/settings.js
CHANGED
|
@@ -11,6 +11,9 @@ export const SETTINGS_FILE = "advisor.settings.json";
|
|
|
11
11
|
/** 三种模式:关闭 / 影子(只记账不回灌)/ 顾问(正常徵询)。 */
|
|
12
12
|
export const MODES = Object.freeze(/** @type {const} */ (["off", "shadow", "advisory"]));
|
|
13
13
|
|
|
14
|
+
/** 「记录发送内容」的取值:首尾预览 / 不记录。 */
|
|
15
|
+
export const TRACE_PROMPT_MODES = Object.freeze(/** @type {const} */ (["preview", "off"]));
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* 默认设置:**默认关闭**。一个会花钱、会把会话内容发出去的插件必须显式 opt-in。
|
|
16
19
|
* - provider/model 为空时永不发起调用(对齐 Claude「配置 advisor 才生效」)。
|
|
@@ -35,26 +38,42 @@ export const DEFAULT_SETTINGS = Object.freeze({
|
|
|
35
38
|
dedupe: true,
|
|
36
39
|
sessionCap: 24,
|
|
37
40
|
tiers: Object.freeze({}),
|
|
41
|
+
allowedModels: Object.freeze([]),
|
|
42
|
+
confirmedHosts: Object.freeze([]),
|
|
38
43
|
pairingEnforcement: "warn",
|
|
44
|
+
workspaceMaxCallsPerDay: 200,
|
|
45
|
+
workspaceMaxCostPerDayUsd: 0,
|
|
46
|
+
postAnswer: "off",
|
|
47
|
+
advisorTools: false,
|
|
48
|
+
tracePrompt: "preview",
|
|
39
49
|
timeoutMs: 90000,
|
|
40
50
|
maxInputChars: 60000,
|
|
41
51
|
});
|
|
42
52
|
|
|
43
|
-
/**
|
|
44
|
-
const
|
|
53
|
+
/** 整数类数值字段的夹紧区间。`0` 在预算类字段里表示「不限」。 */
|
|
54
|
+
const INT_LIMITS = Object.freeze({
|
|
45
55
|
maxTokens: [256, 32000],
|
|
46
56
|
maxCallsPerTurn: [0, 8],
|
|
47
57
|
maxCallsPerSession: [0, 1000],
|
|
48
58
|
maxCallsPerHour: [0, 500],
|
|
49
|
-
maxCostPerDayUsd: [0, 10000],
|
|
50
|
-
priceInputPerMTok: [0, 1000],
|
|
51
|
-
priceOutputPerMTok: [0, 1000],
|
|
52
59
|
immuneTurns: [0, 20],
|
|
53
60
|
sessionCap: [0, 200],
|
|
61
|
+
workspaceMaxCallsPerDay: [0, 100000],
|
|
54
62
|
timeoutMs: [5000, 600000],
|
|
55
63
|
maxInputChars: [4000, 400000],
|
|
56
64
|
});
|
|
57
65
|
|
|
66
|
+
/**
|
|
67
|
+
* 金额类字段:区间 + 小数位。预算按分(2 位),单价按万分之一(4 位)。
|
|
68
|
+
* 金额不能走整数夹紧——0.5 会被取整成 1,0.15 会变成 0。
|
|
69
|
+
*/
|
|
70
|
+
const MONEY_LIMITS = Object.freeze({
|
|
71
|
+
maxCostPerDayUsd: { min: 0, max: 10000, digits: 2 },
|
|
72
|
+
workspaceMaxCostPerDayUsd: { min: 0, max: 10000, digits: 2 },
|
|
73
|
+
priceInputPerMTok: { min: 0, max: 1000, digits: 4 },
|
|
74
|
+
priceOutputPerMTok: { min: 0, max: 1000, digits: 4 },
|
|
75
|
+
});
|
|
76
|
+
|
|
58
77
|
/** 字符串字段的最大长度,防止有人在设置里塞进一整段提示词。 */
|
|
59
78
|
const MAX_STRING = 300;
|
|
60
79
|
|
|
@@ -68,19 +87,36 @@ export function settingsPath(home) {
|
|
|
68
87
|
}
|
|
69
88
|
|
|
70
89
|
/**
|
|
71
|
-
*
|
|
90
|
+
* 把数字夹紧到区间并取整(计数字段用)。
|
|
72
91
|
* @param {unknown} value
|
|
73
92
|
* @param {number} fallback
|
|
74
93
|
* @param {number} min
|
|
75
94
|
* @param {number} max
|
|
76
95
|
* @returns {number}
|
|
77
96
|
*/
|
|
78
|
-
function
|
|
97
|
+
function clampInt(value, fallback, min, max) {
|
|
79
98
|
const n = typeof value === "number" ? value : Number(value);
|
|
80
99
|
if (!Number.isFinite(n)) return fallback;
|
|
81
100
|
return Math.min(max, Math.max(min, Math.round(n)));
|
|
82
101
|
}
|
|
83
102
|
|
|
103
|
+
/**
|
|
104
|
+
* 把金额夹紧到区间并按固定小数位收口(金额字段用)。
|
|
105
|
+
* @param {unknown} value
|
|
106
|
+
* @param {number} fallback
|
|
107
|
+
* @param {number} min
|
|
108
|
+
* @param {number} max
|
|
109
|
+
* @param {number} digits
|
|
110
|
+
* @returns {number}
|
|
111
|
+
*/
|
|
112
|
+
function clampMoney(value, fallback, min, max, digits) {
|
|
113
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
114
|
+
if (!Number.isFinite(n)) return fallback;
|
|
115
|
+
const bounded = Math.min(max, Math.max(min, n));
|
|
116
|
+
const factor = 10 ** digits;
|
|
117
|
+
return Math.round(bounded * factor) / factor;
|
|
118
|
+
}
|
|
119
|
+
|
|
84
120
|
/**
|
|
85
121
|
* 夹紧一个可空的数字(`temperature` 用:`null` 表示「不传,让 adapter 决定」)。
|
|
86
122
|
* @param {unknown} value
|
|
@@ -114,6 +150,26 @@ export function normalizeTiers(raw) {
|
|
|
114
150
|
return out;
|
|
115
151
|
}
|
|
116
152
|
|
|
153
|
+
/**
|
|
154
|
+
* 规整字符串数组:去空、去重、截断、限制条数。
|
|
155
|
+
* @param {unknown} raw
|
|
156
|
+
* @param {number} [max]
|
|
157
|
+
* @returns {string[]}
|
|
158
|
+
*/
|
|
159
|
+
export function normalizeStringList(raw, max = 50) {
|
|
160
|
+
if (!Array.isArray(raw)) return [];
|
|
161
|
+
/** @type {string[]} */
|
|
162
|
+
const out = [];
|
|
163
|
+
for (const item of raw) {
|
|
164
|
+
if (typeof item !== "string") continue;
|
|
165
|
+
const value = item.trim().slice(0, MAX_STRING);
|
|
166
|
+
if (value === "" || out.includes(value)) continue;
|
|
167
|
+
out.push(value);
|
|
168
|
+
if (out.length >= max) break;
|
|
169
|
+
}
|
|
170
|
+
return out;
|
|
171
|
+
}
|
|
172
|
+
|
|
117
173
|
/**
|
|
118
174
|
* 把任意输入规整成合法设置:未知键丢弃、类型不符回落默认、数字夹紧、字符串截断。
|
|
119
175
|
* @param {unknown} raw 文件内容或 RPC patch 合并后的值
|
|
@@ -146,12 +202,25 @@ export function normalizeSettings(raw) {
|
|
|
146
202
|
if (typeof input[key] === "boolean") out[key] = input[key];
|
|
147
203
|
}
|
|
148
204
|
|
|
149
|
-
for (const key of /** @type {(keyof typeof
|
|
150
|
-
const [min, max] =
|
|
151
|
-
out[key] =
|
|
205
|
+
for (const key of /** @type {(keyof typeof INT_LIMITS)[]} */ (Object.keys(INT_LIMITS))) {
|
|
206
|
+
const [min, max] = INT_LIMITS[key];
|
|
207
|
+
out[key] = clampInt(input[key], DEFAULT_SETTINGS[key], min, max);
|
|
208
|
+
}
|
|
209
|
+
for (const key of /** @type {(keyof typeof MONEY_LIMITS)[]} */ (Object.keys(MONEY_LIMITS))) {
|
|
210
|
+
const spec = MONEY_LIMITS[key];
|
|
211
|
+
out[key] = clampMoney(input[key], DEFAULT_SETTINGS[key], spec.min, spec.max, spec.digits);
|
|
152
212
|
}
|
|
153
213
|
out.temperature = nullableNumber(input.temperature, 0, 2);
|
|
154
214
|
out.tiers = normalizeTiers(input.tiers);
|
|
215
|
+
out.allowedModels = normalizeStringList(input.allowedModels);
|
|
216
|
+
out.confirmedHosts = normalizeStringList(input.confirmedHosts);
|
|
217
|
+
if (typeof input.postAnswer === "string" && ["off", "card"].includes(input.postAnswer)) {
|
|
218
|
+
out.postAnswer = input.postAnswer;
|
|
219
|
+
}
|
|
220
|
+
if (typeof input.advisorTools === "boolean") out.advisorTools = input.advisorTools;
|
|
221
|
+
if (typeof input.tracePrompt === "string" && TRACE_PROMPT_MODES.includes(input.tracePrompt)) {
|
|
222
|
+
out.tracePrompt = input.tracePrompt;
|
|
223
|
+
}
|
|
155
224
|
|
|
156
225
|
return out;
|
|
157
226
|
}
|
package/lib/trace.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// 「查看发送内容」的预览:只存本次实际发送文本的首尾片段。
|
|
3
|
+
//
|
|
4
|
+
// 为什么不存全文:会话记录本身已经包含对话,再复制一份完整 transcript 会放大隐私面和会话体积。
|
|
5
|
+
// 首尾各 2,000 字符足以确认「发了什么」,又不会把整个工作区上下文写进记录。
|
|
6
|
+
// 预览是在 buildTranscript 之后取的,所以已经是脱敏、按 maxInputChars 截断后的文本。
|
|
7
|
+
|
|
8
|
+
/** 首尾各保留的字符数。 */
|
|
9
|
+
export const TRACE_PREVIEW_EDGE = 2000;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 生成待存的首尾预览。
|
|
13
|
+
* - 总长度不超过 `edge * 2`:原样返回(短会话不需要省略)。
|
|
14
|
+
* - 超过:保留前 `edge` 与后 `edge` 字符,中间用 `…` 标记;`chars` 始终是完整长度。
|
|
15
|
+
* @param {unknown} text
|
|
16
|
+
* @param {number} [edge]
|
|
17
|
+
* @returns {{ preview: string, chars: number, truncated: boolean }}
|
|
18
|
+
*/
|
|
19
|
+
export function buildTracePreview(text, edge = TRACE_PREVIEW_EDGE) {
|
|
20
|
+
const value = String(text ?? "");
|
|
21
|
+
const chars = value.length;
|
|
22
|
+
const limit = Math.max(1, Math.floor(Number.isFinite(edge) ? edge : TRACE_PREVIEW_EDGE));
|
|
23
|
+
if (chars <= limit * 2) {
|
|
24
|
+
return { preview: value, chars, truncated: false };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
preview: `${value.slice(0, limit)}\n\n…\n\n${value.slice(-limit)}`,
|
|
28
|
+
chars,
|
|
29
|
+
truncated: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
package/lib/twopass.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// 两阶段取证的**编排**部分(与宿主解耦,便于单测)。
|
|
3
|
+
//
|
|
4
|
+
// 流程:第一轮建议带 `needs` → 在会话工作目录内取证 → 把证据回灌 → 第二轮复核。
|
|
5
|
+
// 任何一步失败都保留第一轮结论(绝不能因为取证失败而丢掉已经付费拿到的建议)。
|
|
6
|
+
import { buildVerificationBlock, collectEvidence } from "./verifier.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} EvidencePassResult
|
|
10
|
+
* @property {any} advice 最终采用的建议(可能是第二轮,也可能是第一轮)
|
|
11
|
+
* @property {any|null} verification 取证摘要;没触发取证时为 null
|
|
12
|
+
* @property {{ inputTokens: number, outputTokens: number, cacheReadTokens: number, cacheWriteTokens: number, reasoningTokens: number }|null} extraUsage 第二轮新增的 token
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {object} input
|
|
17
|
+
* @param {any} input.advice 第一轮解析后的建议(需含 `needs`)
|
|
18
|
+
* @param {string} input.root 会话工作目录
|
|
19
|
+
* @param {{ advisorTools?: boolean, maxFiles?: number, maxBytes?: number }} [input.settings]
|
|
20
|
+
* @param {(block: string) => Promise<{ ok: boolean, text?: string, usage?: any }>} input.callSecond 发起第二轮调用
|
|
21
|
+
* @param {(raw: string) => { ok: boolean, advice?: any }} input.parseAdvice 重新解析
|
|
22
|
+
* @param {typeof collectEvidence} [input.collect] 取证实现(测试可注入)
|
|
23
|
+
* @returns {Promise<EvidencePassResult>}
|
|
24
|
+
*/
|
|
25
|
+
export async function runEvidencePass(input) {
|
|
26
|
+
const { advice, root, callSecond, parseAdvice } = input;
|
|
27
|
+
const collect = input.collect ?? collectEvidence;
|
|
28
|
+
const needs = Array.isArray(advice?.needs) ? advice.needs : [];
|
|
29
|
+
if (needs.length === 0) {
|
|
30
|
+
return { advice, verification: null, extraUsage: null };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const evidence = await collect({
|
|
34
|
+
root,
|
|
35
|
+
needs,
|
|
36
|
+
maxFiles: Number.isFinite(input.settings?.maxFiles) ? Number(input.settings?.maxFiles) : 5,
|
|
37
|
+
maxBytes: Number.isFinite(input.settings?.maxBytes)
|
|
38
|
+
? Number(input.settings?.maxBytes)
|
|
39
|
+
: undefined,
|
|
40
|
+
});
|
|
41
|
+
/** @type {{ requested: number, read: string[], refused: string[], pass2: boolean }} */
|
|
42
|
+
const verification = {
|
|
43
|
+
requested: needs.length,
|
|
44
|
+
read: evidence.sections.map((section) => section.ref),
|
|
45
|
+
refused: evidence.refused,
|
|
46
|
+
pass2: false,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const block = buildVerificationBlock(evidence);
|
|
50
|
+
if (block === "") return { advice, verification, extraUsage: null };
|
|
51
|
+
|
|
52
|
+
const second = await callSecond(block);
|
|
53
|
+
if (!second?.ok) return { advice, verification, extraUsage: null };
|
|
54
|
+
|
|
55
|
+
const reparsed = parseAdvice(second.text ?? "");
|
|
56
|
+
if (!reparsed?.ok) return { advice, verification, extraUsage: null };
|
|
57
|
+
|
|
58
|
+
verification.pass2 = true;
|
|
59
|
+
return { advice: reparsed.advice, verification, extraUsage: second.usage ?? null };
|
|
60
|
+
}
|
package/lib/verifier.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// 顾问的第二阶段取证:它返回 `needs: [{kind:"file", ref:"path"}]`,我们把文件内容读回来再喂一次,
|
|
3
|
+
// 让它基于**证据**而不是猜测下结论。
|
|
4
|
+
//
|
|
5
|
+
// 为什么不是「给顾问开放工具」:宿主目前的额外调用是单次补全,工具循环需要伪造 assistant/tool 消息,
|
|
6
|
+
// 跨 provider 不可靠;两阶段(请求证据 → 回灌 → 复核)语义等价、协议风险为零。
|
|
7
|
+
//
|
|
8
|
+
// 安全边界(必须全部满足才读):
|
|
9
|
+
// - 路径必须在**会话工作目录**之内(resolve 后做前缀比较,防 `../` 与符号链接逃逸);
|
|
10
|
+
// - 单文件 ≤ 64 KiB,一次最多 5 个文件(避免把顾问调用撑爆);
|
|
11
|
+
// - 只读,不列目录、不执行命令。
|
|
12
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
13
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
14
|
+
|
|
15
|
+
/** 单文件上限。 */
|
|
16
|
+
export const MAX_FILE_BYTES = 64 * 1024;
|
|
17
|
+
/** 一次最多读几个文件。 */
|
|
18
|
+
export const MAX_FILES = 5;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 判断 target 是否在 root 之内(resolve + 相对路径不以 `..` 开头)。
|
|
22
|
+
* @param {string} root
|
|
23
|
+
* @param {string} target
|
|
24
|
+
* @returns {boolean}
|
|
25
|
+
*/
|
|
26
|
+
export function isInside(root, target) {
|
|
27
|
+
if (typeof root !== "string" || root === "") return false;
|
|
28
|
+
const normalizedRoot = resolve(root);
|
|
29
|
+
const normalizedTarget = resolve(normalizedRoot, target);
|
|
30
|
+
const rel = relative(normalizedRoot, normalizedTarget);
|
|
31
|
+
return rel === "" || (!rel.startsWith("..") && !rel.startsWith(`..${sep}`) && !isAbsolute(rel));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 读回顾问要的证据。
|
|
36
|
+
* @param {{ root: string, needs: Array<{ kind: string, ref: string }>, maxFiles?: number, maxBytes?: number }} input
|
|
37
|
+
* @returns {Promise<{ sections: Array<{ ref: string, text: string, ok: boolean }>, refused: string[] }>}
|
|
38
|
+
*/
|
|
39
|
+
export async function collectEvidence(input) {
|
|
40
|
+
const root = typeof input.root === "string" ? input.root : "";
|
|
41
|
+
const maxFiles = Number.isFinite(input.maxFiles) ? Number(input.maxFiles) : MAX_FILES;
|
|
42
|
+
const maxBytes = Number.isFinite(input.maxBytes) ? Number(input.maxBytes) : MAX_FILE_BYTES;
|
|
43
|
+
/** @type {Array<{ ref: string, text: string, ok: boolean }>} */
|
|
44
|
+
const sections = [];
|
|
45
|
+
/** @type {string[]} */
|
|
46
|
+
const refused = [];
|
|
47
|
+
|
|
48
|
+
const needs = Array.isArray(input.needs) ? input.needs : [];
|
|
49
|
+
let used = 0;
|
|
50
|
+
for (const need of needs) {
|
|
51
|
+
if (used >= maxFiles) break;
|
|
52
|
+
const ref = typeof need?.ref === "string" ? need.ref.trim() : "";
|
|
53
|
+
const kind = String(need?.kind ?? "file").toLowerCase();
|
|
54
|
+
if (ref === "") continue;
|
|
55
|
+
if (kind !== "file" && kind !== "path") {
|
|
56
|
+
refused.push(`${ref}(只支持 file/path)`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (!isInside(root, ref)) {
|
|
60
|
+
refused.push(`${ref}(不在会话工作目录内)`);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const realRoot = await realpath(root).catch(() => resolve(root));
|
|
65
|
+
// 只有 realpath 成功时才做符号链接逃逸检查;文件不存在就交给 readFile 报 ENOENT。
|
|
66
|
+
const realTarget = await realpath(resolve(root, ref)).catch(() => null);
|
|
67
|
+
if (realTarget !== null && !isInside(realRoot, realTarget)) {
|
|
68
|
+
refused.push(`${ref}(真实路径逃出工作目录)`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const buffer = await readFile(realTarget ?? resolve(root, ref));
|
|
72
|
+
const clipped = buffer.subarray(0, maxBytes);
|
|
73
|
+
const text = clipped.toString("utf8");
|
|
74
|
+
const note = buffer.length > maxBytes ? `\n…(已截断,原长 ${buffer.length} 字节)` : "";
|
|
75
|
+
sections.push({ ref, text: `${text}${note}`, ok: true });
|
|
76
|
+
used += 1;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
const code = /** @type {any} */ (error)?.code;
|
|
79
|
+
refused.push(`${ref}(读取失败:${code ?? String(error)})`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { sections, refused };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 把取证结果拼成第二轮的用户消息片段。
|
|
87
|
+
* @param {{ sections: Array<{ ref: string, text: string }>, refused: string[] }} evidence
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
export function buildVerificationBlock(evidence) {
|
|
91
|
+
if (evidence.sections.length === 0 && evidence.refused.length === 0) return "";
|
|
92
|
+
const parts = [
|
|
93
|
+
"VERIFICATION PASS. You asked for evidence; here is what the workspace actually contains.",
|
|
94
|
+
"",
|
|
95
|
+
];
|
|
96
|
+
for (const section of evidence.sections) {
|
|
97
|
+
parts.push(`--- ${section.ref} ---`, section.text, "");
|
|
98
|
+
}
|
|
99
|
+
if (evidence.refused.length > 0) {
|
|
100
|
+
parts.push(`Could not read: ${evidence.refused.join("; ")}`, "");
|
|
101
|
+
}
|
|
102
|
+
parts.push(
|
|
103
|
+
"Re-check your previous advice against this evidence. Keep it only if the evidence supports it;",
|
|
104
|
+
"correct anything the files contradict, and lower the severity when you cannot substantiate it.",
|
|
105
|
+
);
|
|
106
|
+
return parts.join("\n");
|
|
107
|
+
}
|
package/locale/en.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"error.unreachable": "Cannot reach the host — try again later or run /advisor doctor",
|
|
26
26
|
"error.malformed": "The host returned an unrecognized result — run /advisor doctor",
|
|
27
27
|
"settings.title": "Advisor",
|
|
28
|
-
"settings.desc": "
|
|
28
|
+
"settings.desc": "The basics work out of the box; advanced knobs stay folded. Saved changes apply to the next consultation.",
|
|
29
29
|
"settings.aria": "Advisor settings",
|
|
30
30
|
"settings.loading": "Reading host settings…",
|
|
31
31
|
"settings.retry": "Retry",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"settings.saved": "Saved",
|
|
36
36
|
"settings.noChanges": "No changes",
|
|
37
37
|
"settings.group.basic": "Basics",
|
|
38
|
-
"settings.group.budget": "Budgets",
|
|
38
|
+
"settings.group.budget": "Budgets & limits",
|
|
39
39
|
"settings.group.privacy": "Privacy",
|
|
40
|
-
"settings.group.advanced": "Advanced
|
|
40
|
+
"settings.group.advanced": "Advanced",
|
|
41
41
|
"settings.mode": "Mode",
|
|
42
42
|
"settings.mode.off": "Off",
|
|
43
43
|
"settings.mode.offHint": "Never consult the advisor and never spend.",
|
|
44
44
|
"settings.mode.shadow": "Shadow",
|
|
45
|
-
"settings.mode.shadowHint": "
|
|
45
|
+
"settings.mode.shadowHint": "Calls the advisor and records it, but never puts advice into the conversation — useful for observing first.",
|
|
46
46
|
"settings.mode.advisory": "Advisory",
|
|
47
|
-
"settings.mode.advisoryHint": "
|
|
47
|
+
"settings.mode.advisoryHint": "Calls the advisor and hands the advice to the model; the model may take it or ignore it.",
|
|
48
48
|
"settings.provider": "Provider",
|
|
49
49
|
"settings.provider.empty": "(none)",
|
|
50
50
|
"settings.provider.declared": "custom",
|
|
@@ -64,32 +64,59 @@
|
|
|
64
64
|
"settings.effort.pickModel": "Pick a model first",
|
|
65
65
|
"settings.effort.count": "The model declares {count} reasoning efforts",
|
|
66
66
|
"settings.effort.stale": "(current value is not declared by the model)",
|
|
67
|
-
"settings.
|
|
68
|
-
"settings.
|
|
69
|
-
"settings.
|
|
70
|
-
"settings.
|
|
71
|
-
"settings.
|
|
72
|
-
"settings.
|
|
67
|
+
"settings.postAnswer": "Auto-review after each turn",
|
|
68
|
+
"settings.postAnswer.off": "Do not run",
|
|
69
|
+
"settings.postAnswer.card": "Record one line",
|
|
70
|
+
"settings.postAnswer.hint": "Runs the advisor once after each answer; records advice only, never inserts it into the conversation. Costs an extra call.",
|
|
71
|
+
"settings.advisorTools": "Let the advisor read files",
|
|
72
|
+
"settings.advisorToolsHint": "Lets the advisor read files in the working directory to verify conclusions (up to 5 files, read-only); costs one extra model call.",
|
|
73
|
+
"settings.budget.maxCallsPerTurn": "Calls per turn",
|
|
74
|
+
"settings.budget.maxCallsPerSession": "Calls per session",
|
|
75
|
+
"settings.budget.maxCallsPerHour": "Calls per hour",
|
|
76
|
+
"settings.budget.maxCostPerDayUsd": "Daily budget",
|
|
77
|
+
"settings.budget.workspaceMaxCallsPerDay": "Workspace calls per day",
|
|
78
|
+
"settings.budget.workspaceMaxCostPerDayUsd": "Workspace daily budget",
|
|
79
|
+
"settings.budget.priceInputPerMTok": "Input price",
|
|
80
|
+
"settings.budget.priceOutputPerMTok": "Output price",
|
|
73
81
|
"settings.budget.range": "default {default} · range {min}–{max}",
|
|
74
82
|
"settings.budget.rangeUnlimited": "default {default} · range {min}–{max} (0 = unlimited)",
|
|
75
83
|
"settings.budget.priceHint": "0 = do not price tokens",
|
|
84
|
+
"settings.budget.workspaceHint": "Workspace-wide: shared across sessions, resets on the local day",
|
|
85
|
+
"settings.budget.poolLine": "Workspace today: {calls} calls · ≈{cost}",
|
|
86
|
+
"settings.budget.priceSource.builtin": "Price source: built-in reference",
|
|
87
|
+
"settings.budget.priceSource.settings": "Price source: yours",
|
|
88
|
+
"settings.budget.priceSource.none": "Price source: not set (tokens only)",
|
|
76
89
|
"settings.scope": "Send scope",
|
|
77
|
-
"settings.scope.off": "
|
|
90
|
+
"settings.scope.off": "None",
|
|
78
91
|
"settings.scope.offHint": "Send no conversation content.",
|
|
79
|
-
"settings.scope.summary": "
|
|
80
|
-
"settings.scope.summaryHint": "
|
|
81
|
-
"settings.scope.full": "
|
|
82
|
-
"settings.scope.fullHint": "
|
|
83
|
-
"settings.privacy.redact": "
|
|
84
|
-
"settings.privacy.redactHint": "
|
|
85
|
-
"settings.privacy.dedupe": "
|
|
86
|
-
"settings.privacy.dedupeHint": "
|
|
87
|
-
"settings.advanced.maxTokens": "Output
|
|
88
|
-
"settings.advanced.temperature": "
|
|
89
|
-
"settings.advanced.temperatureHint": "Empty =
|
|
92
|
+
"settings.scope.summary": "Summary",
|
|
93
|
+
"settings.scope.summaryHint": "Sends a ~300-character conversation summary; no file contents.",
|
|
94
|
+
"settings.scope.full": "Full",
|
|
95
|
+
"settings.scope.fullHint": "Sends the full context, truncated to the input limit.",
|
|
96
|
+
"settings.privacy.redact": "Redact before sending",
|
|
97
|
+
"settings.privacy.redactHint": "Masks common key formats; it cannot guarantee every secret is caught.",
|
|
98
|
+
"settings.privacy.dedupe": "Dedupe in shadow mode",
|
|
99
|
+
"settings.privacy.dedupeHint": "In shadow mode, the same advice is recorded only once.",
|
|
100
|
+
"settings.advanced.maxTokens": "Output limit",
|
|
101
|
+
"settings.advanced.temperature": "Randomness",
|
|
102
|
+
"settings.advanced.temperatureHint": "Empty = let the model decide; range 0–2.",
|
|
90
103
|
"settings.advanced.temperatureEmpty": "not sent",
|
|
91
|
-
"settings.advanced.maxInputChars": "Input
|
|
92
|
-
"settings.advanced.sessionCap": "
|
|
104
|
+
"settings.advanced.maxInputChars": "Input limit",
|
|
105
|
+
"settings.advanced.sessionCap": "Advice items per session",
|
|
106
|
+
"settings.advanced.allowedModels": "Model allowlist",
|
|
107
|
+
"settings.advanced.allowedModelsHint": "Empty = no limit; accepts provider/model or a bare model id",
|
|
108
|
+
"settings.advanced.allowedModelsPlaceholder": "e.g. deepseek/deepseek-chat, gpt-4o",
|
|
109
|
+
"settings.preview": "Send preview",
|
|
110
|
+
"settings.preview.run": "Preview what will be sent",
|
|
111
|
+
"settings.preview.running": "Previewing…",
|
|
112
|
+
"settings.preview.title": "Preview",
|
|
113
|
+
"settings.preview.expand": "Expand",
|
|
114
|
+
"settings.preview.collapse": "Collapse",
|
|
115
|
+
"settings.confirm": "Cross-provider send",
|
|
116
|
+
"settings.confirm.run": "Confirm cross-provider send",
|
|
117
|
+
"settings.confirm.running": "Confirming…",
|
|
118
|
+
"settings.confirm.hint": "Add the current provider to the confirmed list so cross-provider consultations stop being interrupted.",
|
|
119
|
+
"settings.confirm.done": "Confirmed {provider}",
|
|
93
120
|
"settings.status.title": "Status",
|
|
94
121
|
"settings.status.calls": "{count} calls so far",
|
|
95
122
|
"settings.status.tokens": "in {input} / out {output} tokens",
|
|
@@ -111,6 +138,8 @@
|
|
|
111
138
|
"settings.error.doctor": "Diagnostics failed",
|
|
112
139
|
"settings.error.save": "Could not save",
|
|
113
140
|
"settings.error.saveHost": "Could not save: {message}",
|
|
141
|
+
"settings.error.preview": "Preview failed — try again later",
|
|
142
|
+
"settings.error.confirm": "Confirmation failed — try again later",
|
|
114
143
|
"tail.title": "Advisor",
|
|
115
144
|
"tail.severity.nit": "nit",
|
|
116
145
|
"tail.severity.concern": "concern",
|
|
@@ -119,6 +148,73 @@
|
|
|
119
148
|
"tail.empty": "(this advice has no body)",
|
|
120
149
|
"tail.anchors": "Evidence anchors did not match ({checked} checked)",
|
|
121
150
|
"tail.downgraded": "Severity downgraded",
|
|
122
|
-
"tail.aria": "Advisor advice (click to expand or collapse)"
|
|
151
|
+
"tail.aria": "Advisor advice (click to expand or collapse)",
|
|
152
|
+
"settings.off.title": "Advisor is off",
|
|
153
|
+
"settings.off.desc": "It never calls the advisor and never spends.",
|
|
154
|
+
"settings.off.unconfigured": "No advisor model selected yet. Choose “Configure advisor” to pick a provider and model.",
|
|
155
|
+
"settings.off.configured": "Configured: {provider} / {model}. Takes effect when enabled.",
|
|
156
|
+
"settings.off.configure": "Configure advisor",
|
|
157
|
+
"settings.off.collapse": "Hide configuration",
|
|
158
|
+
"settings.dirty": "Unsaved changes",
|
|
159
|
+
"settings.advanced.intro": "Sensible defaults; you normally do not need to change these. Modified items show on the heading.",
|
|
160
|
+
"settings.advanced.defaults": "Defaults",
|
|
161
|
+
"settings.advanced.changed": "{count} changed",
|
|
162
|
+
"settings.advanced.reset": "Reset to defaults",
|
|
163
|
+
"settings.advanced.resetHint": "Only resets advanced fields; mode, provider, model and privacy stay.",
|
|
164
|
+
"settings.advanced.resetDone": "Advanced settings restored to defaults (not saved yet).",
|
|
165
|
+
"settings.advanced.more": "Rarely changed keys such as {fields} can be edited directly in the settings file.",
|
|
166
|
+
"settings.advanced.moreFields": "tiers, pairingEnforcement, timeoutMs, immuneTurns",
|
|
167
|
+
"settings.advanced.copyPath": "Copy path",
|
|
168
|
+
"settings.advanced.copied": "Copied",
|
|
169
|
+
"settings.advanced.copyFailed": "Copy failed — copy it manually.",
|
|
170
|
+
"settings.advanced.pathUnknown": "The host did not return the settings file path.",
|
|
171
|
+
"settings.advanced.dailyBudgetNote": "The daily budget is under Basics; this section has call and workspace-level limits.",
|
|
172
|
+
"settings.group.model": "Advisor model",
|
|
173
|
+
"settings.group.spend": "Budget",
|
|
174
|
+
"settings.group.limits": "Call limits",
|
|
175
|
+
"settings.group.money": "Prices",
|
|
176
|
+
"settings.group.generation": "Generation",
|
|
177
|
+
"settings.group.delivery": "Delivery & behavior",
|
|
178
|
+
"settings.group.more": "More",
|
|
179
|
+
"settings.group.status": "Status & diagnostics",
|
|
180
|
+
"settings.basic.budgetHint": "0 = unlimited; default 0, range 0–10000. Finer limits are under Advanced.",
|
|
181
|
+
"settings.budget.maxCostHint": "Maximum spend per day; 0 = unlimited. Only counted when prices are set.",
|
|
182
|
+
"settings.advanced.maxTokensHint": "Maximum output tokens per answer; higher costs more.",
|
|
183
|
+
"settings.advanced.maxInputCharsHint": "Maximum characters of conversation sent per call; excess in the middle is elided, head and tail kept.",
|
|
184
|
+
"settings.advanced.sessionCapHint": "Maximum advice items shown per session; once reached only blocker items get through.",
|
|
185
|
+
"settings.help.calls": "Above the limit, the consultation is skipped; 0 = unlimited.",
|
|
186
|
+
"settings.help.tech": "Key: {key}",
|
|
187
|
+
"settings.help.open": "Show help for {field}",
|
|
188
|
+
"settings.help.defaultOn": "Default: on",
|
|
189
|
+
"settings.help.defaultOff": "Default: off",
|
|
190
|
+
"settings.help.defaultOffOption": "Default: off",
|
|
191
|
+
"settings.help.defaultEmpty": "Default: no limit",
|
|
192
|
+
"settings.help.defaultNotSent": "Default: not sent (model default)",
|
|
193
|
+
"settings.unit.usd": "USD",
|
|
194
|
+
"settings.unit.usdPerMTok": "USD / 1M tokens",
|
|
195
|
+
"settings.unit.tokens": "tokens",
|
|
196
|
+
"settings.unit.chars": "chars",
|
|
197
|
+
"settings.unit.calls": "calls",
|
|
198
|
+
"settings.unit.items": "items",
|
|
199
|
+
"settings.paths.settings": "Settings file: {path}",
|
|
200
|
+
"settings.paths.ledger": "Ledger: {path}",
|
|
201
|
+
"tail.trace.label": "Consultation",
|
|
202
|
+
"tail.trace.sep": ": ",
|
|
203
|
+
"tail.trace.chars": "{chars} chars",
|
|
204
|
+
"tail.trigger.tool": "model",
|
|
205
|
+
"tail.trigger.shadow": "shadow",
|
|
206
|
+
"tail.trigger.manual": "manual",
|
|
207
|
+
"tail.trigger.other": "other",
|
|
208
|
+
"tail.trigger.postAnswer": "post-answer",
|
|
209
|
+
"settings.tracePrompt": "Keep sent content",
|
|
210
|
+
"settings.tracePrompt.preview": "Head/tail preview",
|
|
211
|
+
"settings.tracePrompt.off": "Do not record",
|
|
212
|
+
"settings.tracePrompt.hint": "Stores the first and last 2,000 characters of the text actually sent (after redaction) in the session record; off stores metadata only. If redaction is off, the preview contains raw text.",
|
|
213
|
+
"settings.help.defaultPreview": "Default: head/tail preview",
|
|
214
|
+
"tail.trace.preview": "View sent content",
|
|
215
|
+
"tail.trace.previewHide": "Hide sent content",
|
|
216
|
+
"tail.trace.previewTruncated": "Sent (redacted; first/last 2,000 of {chars} chars)",
|
|
217
|
+
"tail.trace.previewFull": "Sent (redacted; {chars} chars)",
|
|
218
|
+
"tail.trace.previewNone": "No sent content saved for this record (older record, or disabled in Advanced)."
|
|
123
219
|
}
|
|
124
220
|
}
|