opencode-subagent-magazine 1.4.2 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/clipboard.d.ts +7 -0
- package/dist/clipboard.js +85 -0
- package/dist/i18n.d.ts +75 -0
- package/dist/i18n.js +249 -0
- package/dist/index.js +176 -138
- package/dist/tui.js +564 -172
- package/package.json +2 -1
- package/src/_version.ts +1 -1
- package/src/clipboard.ts +134 -0
- package/src/i18n.ts +261 -0
- package/src/index.tsx +202 -158
package/dist/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "1.
|
|
1
|
+
export declare const PLUGIN_VERSION = "1.5.1";
|
package/dist/_version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION = "1.
|
|
2
|
+
export const PLUGIN_VERSION = "1.5.1";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ClipboardMethod = "pbcopy" | "osascript" | "wl-copy" | "xclip" | "xsel" | "powershell" | "osc52" | "none";
|
|
2
|
+
export interface CopyTextResult {
|
|
3
|
+
copied: boolean;
|
|
4
|
+
method: ClipboardMethod;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function copyText(text: string): Promise<CopyTextResult>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { platform, release } from "node:os";
|
|
3
|
+
function runWithInput(command, args, input) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const child = spawn(command, args, {
|
|
6
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
7
|
+
windowsHide: true,
|
|
8
|
+
});
|
|
9
|
+
child.once("error", reject);
|
|
10
|
+
child.once("close", (code) => {
|
|
11
|
+
if (code === 0)
|
|
12
|
+
resolve();
|
|
13
|
+
else
|
|
14
|
+
reject(new Error(`${command} exited with code ${code}`));
|
|
15
|
+
});
|
|
16
|
+
child.stdin?.end(input);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function writeOsc52(text) {
|
|
20
|
+
if (!process.stdout.isTTY)
|
|
21
|
+
return false;
|
|
22
|
+
const payload = Buffer.from(text, "utf8").toString("base64");
|
|
23
|
+
const sequence = `\x1b]52;c;${payload}\x07`;
|
|
24
|
+
const wrapped = process.env.TMUX || process.env.STY
|
|
25
|
+
? `\x1bPtmux;\x1b${sequence}\x1b\\`
|
|
26
|
+
: sequence;
|
|
27
|
+
process.stdout.write(wrapped);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
async function tryCommand(method, command, args, text) {
|
|
31
|
+
try {
|
|
32
|
+
await runWithInput(command, args, text);
|
|
33
|
+
return { copied: true, method };
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export async function copyText(text) {
|
|
40
|
+
if (!text)
|
|
41
|
+
return { copied: false, method: "none", error: "empty_text" };
|
|
42
|
+
const os = platform();
|
|
43
|
+
const isWsl = release().toLowerCase().includes("microsoft");
|
|
44
|
+
const attempts = [];
|
|
45
|
+
if (os === "darwin") {
|
|
46
|
+
attempts.push(() => tryCommand("pbcopy", "pbcopy", [], text));
|
|
47
|
+
attempts.push(() => tryCommand("osascript", "osascript", ["-e", "set the clipboard to (read (POSIX file \"/dev/stdin\") as text)"], text));
|
|
48
|
+
}
|
|
49
|
+
if (os === "linux" && isWsl) {
|
|
50
|
+
attempts.push(() => tryCommand("powershell", "powershell.exe", [
|
|
51
|
+
"-NonInteractive",
|
|
52
|
+
"-NoProfile",
|
|
53
|
+
"-Command",
|
|
54
|
+
"[Console]::InputEncoding=[Text.Encoding]::UTF8; Set-Clipboard ([Console]::In.ReadToEnd())",
|
|
55
|
+
], text));
|
|
56
|
+
}
|
|
57
|
+
else if (os === "linux") {
|
|
58
|
+
if (process.env.WAYLAND_DISPLAY) {
|
|
59
|
+
attempts.push(() => tryCommand("wl-copy", "wl-copy", [], text));
|
|
60
|
+
}
|
|
61
|
+
attempts.push(() => tryCommand("xclip", "xclip", ["-selection", "clipboard"], text));
|
|
62
|
+
attempts.push(() => tryCommand("xsel", "xsel", ["--clipboard", "--input"], text));
|
|
63
|
+
}
|
|
64
|
+
if (os === "win32") {
|
|
65
|
+
attempts.push(() => tryCommand("powershell", "powershell.exe", [
|
|
66
|
+
"-NonInteractive",
|
|
67
|
+
"-NoProfile",
|
|
68
|
+
"-Command",
|
|
69
|
+
"[Console]::InputEncoding=[Text.Encoding]::UTF8; Set-Clipboard ([Console]::In.ReadToEnd())",
|
|
70
|
+
], text));
|
|
71
|
+
}
|
|
72
|
+
for (const attempt of attempts) {
|
|
73
|
+
const result = await attempt();
|
|
74
|
+
if (result)
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
if (writeOsc52(text))
|
|
79
|
+
return { copied: true, method: "osc52" };
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Continue to the explicit failure result.
|
|
83
|
+
}
|
|
84
|
+
return { copied: false, method: "none", error: "clipboard_unavailable" };
|
|
85
|
+
}
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type LangCode = "zh" | "en" | "ja" | "ko";
|
|
2
|
+
declare const ZH_T: {
|
|
3
|
+
readonly "panel.title": "子代理";
|
|
4
|
+
readonly "status.none": "暂无子代理";
|
|
5
|
+
readonly "agent.label": "代理";
|
|
6
|
+
readonly "status.label": "状态";
|
|
7
|
+
readonly "time.label": "耗时";
|
|
8
|
+
readonly "tokens.label": "上下文";
|
|
9
|
+
readonly "error.label": "错误";
|
|
10
|
+
readonly "model.label": "模型";
|
|
11
|
+
readonly "todo.label": "进度";
|
|
12
|
+
readonly "session.label": "会话 ID";
|
|
13
|
+
readonly "session.toast.copy": "可手动复制上方 ID";
|
|
14
|
+
readonly "session.toast.copied": "会话 ID 已复制";
|
|
15
|
+
readonly "session.toast.copy_failed": "无法访问系统剪贴板,请手动复制上方 ID";
|
|
16
|
+
readonly "open.label": "进入会话";
|
|
17
|
+
readonly "cost.label": "费用";
|
|
18
|
+
readonly "scroll.more": "更多";
|
|
19
|
+
readonly "scroll.top": "回顶";
|
|
20
|
+
readonly "scroll.bottom": "回底";
|
|
21
|
+
readonly "dismiss.label": "标记完成";
|
|
22
|
+
readonly "cancel.label": "取消";
|
|
23
|
+
readonly "status.running": "运行中";
|
|
24
|
+
readonly "status.done": "已完成";
|
|
25
|
+
readonly "status.cancelled": "已取消";
|
|
26
|
+
readonly "status.error": "错误";
|
|
27
|
+
readonly "order.desc": "降序(最新在前)";
|
|
28
|
+
readonly "order.asc": "升序(最早在前)";
|
|
29
|
+
readonly "scroll.wheel": "滚轮翻页";
|
|
30
|
+
readonly "scroll.click": "点击翻页";
|
|
31
|
+
readonly "ttl.label": "清理周期";
|
|
32
|
+
readonly "ttl.3d": "3 天";
|
|
33
|
+
readonly "ttl.7d": "7 天";
|
|
34
|
+
readonly "ttl.14d": "14 天";
|
|
35
|
+
readonly "ttl.30d": "30 天";
|
|
36
|
+
readonly "ttl.unlimited": "无期限";
|
|
37
|
+
readonly "ttl.toast": "清理周期已设为 {n} 天";
|
|
38
|
+
readonly "ttl.toast_unlimited": "清理周期已设为无期限";
|
|
39
|
+
readonly "clear.title": "确认清除";
|
|
40
|
+
readonly "clear.prompt": "确定清除当前会话所有子代理记录?此操作不可撤销。";
|
|
41
|
+
readonly "clear.prompt_running": "当前有 {n} 个运行中的子代理,清除后将不可恢复。确定继续?";
|
|
42
|
+
readonly "clear.done": "已清除 {n} 条子代理记录";
|
|
43
|
+
readonly "clear.empty": "当前会话无子代理记录";
|
|
44
|
+
readonly "cancel.no_session": "子会话 ID 不可用";
|
|
45
|
+
readonly "cancel.not_child": "目标不是子会话";
|
|
46
|
+
readonly "cancel.read_error": "无法读取会话信息";
|
|
47
|
+
readonly "cancel.outside_tree": "目标不在当前监控会话树中";
|
|
48
|
+
readonly "cancel.already_ended": "会话已结束,无需取消";
|
|
49
|
+
readonly "cancel.status_error": "无法查询会话状态";
|
|
50
|
+
readonly "cancel.sent": "已发送取消指令";
|
|
51
|
+
readonly "cancel.failed": "取消失败";
|
|
52
|
+
};
|
|
53
|
+
/** 结构约束:值放宽为 string,键集合来自中文表(新增语言缺 key 会编译报错)。 */
|
|
54
|
+
export type Translation = {
|
|
55
|
+
[K in keyof typeof ZH_T]: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const LANGS: Record<LangCode, Translation>;
|
|
58
|
+
/** 语言元数据:/subagent-lang 选项与自动检测共用。 */
|
|
59
|
+
export declare const LANG_META: {
|
|
60
|
+
code: LangCode;
|
|
61
|
+
label: string;
|
|
62
|
+
}[];
|
|
63
|
+
/**
|
|
64
|
+
* 模板参数替换:`{key}` 占位符统一在此处理。
|
|
65
|
+
* 未提供的参数保留原占位符,避免静默丢失。
|
|
66
|
+
*/
|
|
67
|
+
export declare function applyParams(tpl: string, params?: Record<string, string | number>): string;
|
|
68
|
+
/**
|
|
69
|
+
* 宽松翻译工厂:未知 key 回退为 key 原样(兼容非翻译用途的键名透传)。
|
|
70
|
+
* `getCode` 读取语言信号——在 SolidJS 渲染/memo 上下文中调用时自动建立响应式依赖。
|
|
71
|
+
*/
|
|
72
|
+
export declare function createT(getCode: () => LangCode): (key: string, params?: Record<string, string | number>) => string;
|
|
73
|
+
/** 按系统 locale 自动检测语言(zh → 中文,ja → 日语,ko → 韩语,其余 → 英文)。 */
|
|
74
|
+
export declare function detectLang(): LangCode;
|
|
75
|
+
export {};
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// i18n — centralized translations (aligned with opencode-visual-cache).
|
|
3
|
+
// Add a language by appending a table that satisfies `Translation`; the
|
|
4
|
+
// compiler enforces key completeness.
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
const ZH_T = {
|
|
7
|
+
"panel.title": "子代理",
|
|
8
|
+
"status.none": "暂无子代理",
|
|
9
|
+
"agent.label": "代理",
|
|
10
|
+
"status.label": "状态",
|
|
11
|
+
"time.label": "耗时",
|
|
12
|
+
"tokens.label": "上下文",
|
|
13
|
+
"error.label": "错误",
|
|
14
|
+
"model.label": "模型",
|
|
15
|
+
"todo.label": "进度",
|
|
16
|
+
"session.label": "会话 ID",
|
|
17
|
+
"session.toast.copy": "可手动复制上方 ID",
|
|
18
|
+
"session.toast.copied": "会话 ID 已复制",
|
|
19
|
+
"session.toast.copy_failed": "无法访问系统剪贴板,请手动复制上方 ID",
|
|
20
|
+
"open.label": "进入会话",
|
|
21
|
+
"cost.label": "费用",
|
|
22
|
+
"scroll.more": "更多",
|
|
23
|
+
"scroll.top": "回顶",
|
|
24
|
+
"scroll.bottom": "回底",
|
|
25
|
+
"dismiss.label": "标记完成",
|
|
26
|
+
"cancel.label": "取消",
|
|
27
|
+
"status.running": "运行中",
|
|
28
|
+
"status.done": "已完成",
|
|
29
|
+
"status.cancelled": "已取消",
|
|
30
|
+
"status.error": "错误",
|
|
31
|
+
"order.desc": "降序(最新在前)",
|
|
32
|
+
"order.asc": "升序(最早在前)",
|
|
33
|
+
"scroll.wheel": "滚轮翻页",
|
|
34
|
+
"scroll.click": "点击翻页",
|
|
35
|
+
"ttl.label": "清理周期",
|
|
36
|
+
"ttl.3d": "3 天",
|
|
37
|
+
"ttl.7d": "7 天",
|
|
38
|
+
"ttl.14d": "14 天",
|
|
39
|
+
"ttl.30d": "30 天",
|
|
40
|
+
"ttl.unlimited": "无期限",
|
|
41
|
+
"ttl.toast": "清理周期已设为 {n} 天",
|
|
42
|
+
"ttl.toast_unlimited": "清理周期已设为无期限",
|
|
43
|
+
"clear.title": "确认清除",
|
|
44
|
+
"clear.prompt": "确定清除当前会话所有子代理记录?此操作不可撤销。",
|
|
45
|
+
"clear.prompt_running": "当前有 {n} 个运行中的子代理,清除后将不可恢复。确定继续?",
|
|
46
|
+
"clear.done": "已清除 {n} 条子代理记录",
|
|
47
|
+
"clear.empty": "当前会话无子代理记录",
|
|
48
|
+
"cancel.no_session": "子会话 ID 不可用",
|
|
49
|
+
"cancel.not_child": "目标不是子会话",
|
|
50
|
+
"cancel.read_error": "无法读取会话信息",
|
|
51
|
+
"cancel.outside_tree": "目标不在当前监控会话树中",
|
|
52
|
+
"cancel.already_ended": "会话已结束,无需取消",
|
|
53
|
+
"cancel.status_error": "无法查询会话状态",
|
|
54
|
+
"cancel.sent": "已发送取消指令",
|
|
55
|
+
"cancel.failed": "取消失败",
|
|
56
|
+
};
|
|
57
|
+
const EN_T = {
|
|
58
|
+
"panel.title": "SubAgent",
|
|
59
|
+
"status.none": "No sub-agents yet",
|
|
60
|
+
"agent.label": "agent",
|
|
61
|
+
"status.label": "status",
|
|
62
|
+
"time.label": "time",
|
|
63
|
+
"tokens.label": "tokens",
|
|
64
|
+
"error.label": "error",
|
|
65
|
+
"model.label": "model",
|
|
66
|
+
"todo.label": "todo",
|
|
67
|
+
"session.label": "session ID",
|
|
68
|
+
"session.toast.copy": "Copy the ID above manually",
|
|
69
|
+
"session.toast.copied": "Session ID copied",
|
|
70
|
+
"session.toast.copy_failed": "Cannot access the system clipboard; copy the ID above manually",
|
|
71
|
+
"open.label": "Open session",
|
|
72
|
+
"cost.label": "cost",
|
|
73
|
+
"scroll.more": "more",
|
|
74
|
+
"scroll.top": "Top",
|
|
75
|
+
"scroll.bottom": "Bottom",
|
|
76
|
+
"dismiss.label": "dismiss",
|
|
77
|
+
"cancel.label": "Cancel",
|
|
78
|
+
"status.running": "running",
|
|
79
|
+
"status.done": "done",
|
|
80
|
+
"status.cancelled": "cancelled",
|
|
81
|
+
"status.error": "error",
|
|
82
|
+
"order.desc": "Desc (newest first)",
|
|
83
|
+
"order.asc": "Asc (oldest first)",
|
|
84
|
+
"scroll.wheel": "Wheel Scroll",
|
|
85
|
+
"scroll.click": "Click Scroll",
|
|
86
|
+
"ttl.label": "TTL (Time to Live)",
|
|
87
|
+
"ttl.3d": "3 days",
|
|
88
|
+
"ttl.7d": "7 days",
|
|
89
|
+
"ttl.14d": "14 days",
|
|
90
|
+
"ttl.30d": "30 days",
|
|
91
|
+
"ttl.unlimited": "Never",
|
|
92
|
+
"ttl.toast": "TTL set to {n} days",
|
|
93
|
+
"ttl.toast_unlimited": "TTL set to Never",
|
|
94
|
+
"clear.title": "Confirm",
|
|
95
|
+
"clear.prompt": "Clear all sub-agent records for this session? This cannot be undone.",
|
|
96
|
+
"clear.prompt_running": "{n} sub-agent(s) are still running. Clearing will discard them permanently. Continue?",
|
|
97
|
+
"clear.done": "Cleared {n} sub-agent record(s)",
|
|
98
|
+
"clear.empty": "No sub-agent records in this session",
|
|
99
|
+
"cancel.no_session": "Child session ID is unavailable",
|
|
100
|
+
"cancel.not_child": "Target is not a child session",
|
|
101
|
+
"cancel.read_error": "Cannot read session info",
|
|
102
|
+
"cancel.outside_tree": "Target is outside the monitored session tree",
|
|
103
|
+
"cancel.already_ended": "Session already ended, no need to cancel",
|
|
104
|
+
"cancel.status_error": "Cannot query session status",
|
|
105
|
+
"cancel.sent": "Cancel instruction sent",
|
|
106
|
+
"cancel.failed": "Cancellation failed",
|
|
107
|
+
};
|
|
108
|
+
const JA_T = {
|
|
109
|
+
"panel.title": "サブエージェント",
|
|
110
|
+
"status.none": "サブエージェントなし",
|
|
111
|
+
"agent.label": "エージェント",
|
|
112
|
+
"status.label": "状態",
|
|
113
|
+
"time.label": "時間",
|
|
114
|
+
"tokens.label": "コンテキスト",
|
|
115
|
+
"error.label": "エラー",
|
|
116
|
+
"model.label": "モデル",
|
|
117
|
+
"todo.label": "進捗",
|
|
118
|
+
"session.label": "セッション ID",
|
|
119
|
+
"session.toast.copy": "上の ID を手動でコピーしてください",
|
|
120
|
+
"session.toast.copied": "セッション ID をコピーしました",
|
|
121
|
+
"session.toast.copy_failed": "システムのクリップボードにアクセスできないため、上の ID を手動でコピーしてください",
|
|
122
|
+
"open.label": "セッションを開く",
|
|
123
|
+
"cost.label": "費用",
|
|
124
|
+
"scroll.more": "もっと",
|
|
125
|
+
"scroll.top": "先頭へ",
|
|
126
|
+
"scroll.bottom": "末尾へ",
|
|
127
|
+
"dismiss.label": "完了にする",
|
|
128
|
+
"cancel.label": "キャンセル",
|
|
129
|
+
"status.running": "実行中",
|
|
130
|
+
"status.done": "完了",
|
|
131
|
+
"status.cancelled": "キャンセル済み",
|
|
132
|
+
"status.error": "エラー",
|
|
133
|
+
"order.desc": "降順(新しい順)",
|
|
134
|
+
"order.asc": "昇順(古い順)",
|
|
135
|
+
"scroll.wheel": "ホイールスクロール",
|
|
136
|
+
"scroll.click": "クリックスクロール",
|
|
137
|
+
"ttl.label": "保持期間",
|
|
138
|
+
"ttl.3d": "3 日",
|
|
139
|
+
"ttl.7d": "7 日",
|
|
140
|
+
"ttl.14d": "14 日",
|
|
141
|
+
"ttl.30d": "30 日",
|
|
142
|
+
"ttl.unlimited": "無期限",
|
|
143
|
+
"ttl.toast": "保持期間を {n} 日に設定しました",
|
|
144
|
+
"ttl.toast_unlimited": "保持期間を無期限に設定しました",
|
|
145
|
+
"clear.title": "削除の確認",
|
|
146
|
+
"clear.prompt": "このセッションの全サブエージェント記録を削除しますか?この操作は元に戻せません。",
|
|
147
|
+
"clear.prompt_running": "実行中のサブエージェントが {n} 個あります。削除すると復元できません。続行しますか?",
|
|
148
|
+
"clear.done": "{n} 件のサブエージェント記録を削除しました",
|
|
149
|
+
"clear.empty": "このセッションにサブエージェント記録はありません",
|
|
150
|
+
"cancel.no_session": "子セッション ID が利用できません",
|
|
151
|
+
"cancel.not_child": "対象は子セッションではありません",
|
|
152
|
+
"cancel.read_error": "セッション情報を読み取れません",
|
|
153
|
+
"cancel.outside_tree": "対象は監視対象のセッションツリー外です",
|
|
154
|
+
"cancel.already_ended": "セッションは既に終了しています",
|
|
155
|
+
"cancel.status_error": "セッション状態を照会できません",
|
|
156
|
+
"cancel.sent": "キャンセル指示を送信しました",
|
|
157
|
+
"cancel.failed": "キャンセルに失敗しました",
|
|
158
|
+
};
|
|
159
|
+
const KO_T = {
|
|
160
|
+
"panel.title": "서브 에이전트",
|
|
161
|
+
"status.none": "서브 에이전트 없음",
|
|
162
|
+
"agent.label": "에이전트",
|
|
163
|
+
"status.label": "상태",
|
|
164
|
+
"time.label": "시간",
|
|
165
|
+
"tokens.label": "컨텍스트",
|
|
166
|
+
"error.label": "오류",
|
|
167
|
+
"model.label": "모델",
|
|
168
|
+
"todo.label": "진행도",
|
|
169
|
+
"session.label": "세션 ID",
|
|
170
|
+
"session.toast.copy": "위 ID를 수동으로 복사하세요",
|
|
171
|
+
"session.toast.copied": "세션 ID가 복사되었습니다",
|
|
172
|
+
"session.toast.copy_failed": "시스템 클립보드에 접근할 수 없어 위 ID를 수동으로 복사하세요",
|
|
173
|
+
"open.label": "세션 열기",
|
|
174
|
+
"cost.label": "비용",
|
|
175
|
+
"scroll.more": "더 보기",
|
|
176
|
+
"scroll.top": "맨 위로",
|
|
177
|
+
"scroll.bottom": "맨 아래로",
|
|
178
|
+
"dismiss.label": "완료 표시",
|
|
179
|
+
"cancel.label": "취소",
|
|
180
|
+
"status.running": "실행 중",
|
|
181
|
+
"status.done": "완료",
|
|
182
|
+
"status.cancelled": "취소됨",
|
|
183
|
+
"status.error": "오류",
|
|
184
|
+
"order.desc": "내림차순(최신순)",
|
|
185
|
+
"order.asc": "오름차순(오래된순)",
|
|
186
|
+
"scroll.wheel": "휠 스크롤",
|
|
187
|
+
"scroll.click": "클릭 스크롤",
|
|
188
|
+
"ttl.label": "보존 기간",
|
|
189
|
+
"ttl.3d": "3일",
|
|
190
|
+
"ttl.7d": "7일",
|
|
191
|
+
"ttl.14d": "14일",
|
|
192
|
+
"ttl.30d": "30일",
|
|
193
|
+
"ttl.unlimited": "무기한",
|
|
194
|
+
"ttl.toast": "보존 기간을 {n}일로 설정했습니다",
|
|
195
|
+
"ttl.toast_unlimited": "보존 기간을 무기한으로 설정했습니다",
|
|
196
|
+
"clear.title": "삭제 확인",
|
|
197
|
+
"clear.prompt": "이 세션의 모든 서브 에이전트 기록을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
|
|
198
|
+
"clear.prompt_running": "실행 중인 서브 에이전트가 {n}개 있습니다. 삭제하면 복구할 수 없습니다. 계속하시겠습니까?",
|
|
199
|
+
"clear.done": "서브 에이전트 기록 {n}개를 삭제했습니다",
|
|
200
|
+
"clear.empty": "이 세션에 서브 에이전트 기록이 없습니다",
|
|
201
|
+
"cancel.no_session": "하위 세션 ID를 사용할 수 없습니다",
|
|
202
|
+
"cancel.not_child": "대상이 하위 세션이 아닙니다",
|
|
203
|
+
"cancel.read_error": "세션 정보를 읽을 수 없습니다",
|
|
204
|
+
"cancel.outside_tree": "대상이 모니터링 세션 트리 밖에 있습니다",
|
|
205
|
+
"cancel.already_ended": "세션이 이미 종료되었습니다",
|
|
206
|
+
"cancel.status_error": "세션 상태를 조회할 수 없습니다",
|
|
207
|
+
"cancel.sent": "취소 지시를 보냈습니다",
|
|
208
|
+
"cancel.failed": "취소에 실패했습니다",
|
|
209
|
+
};
|
|
210
|
+
export const LANGS = { zh: ZH_T, en: EN_T, ja: JA_T, ko: KO_T };
|
|
211
|
+
/** 语言元数据:/subagent-lang 选项与自动检测共用。 */
|
|
212
|
+
export const LANG_META = [
|
|
213
|
+
{ code: "zh", label: "中文" },
|
|
214
|
+
{ code: "en", label: "English" },
|
|
215
|
+
{ code: "ja", label: "日本語" },
|
|
216
|
+
{ code: "ko", label: "한국어" },
|
|
217
|
+
];
|
|
218
|
+
/**
|
|
219
|
+
* 模板参数替换:`{key}` 占位符统一在此处理。
|
|
220
|
+
* 未提供的参数保留原占位符,避免静默丢失。
|
|
221
|
+
*/
|
|
222
|
+
export function applyParams(tpl, params) {
|
|
223
|
+
if (!params)
|
|
224
|
+
return tpl;
|
|
225
|
+
return tpl.replace(/\{(\w+)\}/g, (m, k) => k in params ? String(params[k]) : m);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 宽松翻译工厂:未知 key 回退为 key 原样(兼容非翻译用途的键名透传)。
|
|
229
|
+
* `getCode` 读取语言信号——在 SolidJS 渲染/memo 上下文中调用时自动建立响应式依赖。
|
|
230
|
+
*/
|
|
231
|
+
export function createT(getCode) {
|
|
232
|
+
return (key, params) => applyParams(LANGS[getCode()][key] ?? key, params);
|
|
233
|
+
}
|
|
234
|
+
/** 按系统 locale 自动检测语言(zh → 中文,ja → 日语,ko → 韩语,其余 → 英文)。 */
|
|
235
|
+
export function detectLang() {
|
|
236
|
+
try {
|
|
237
|
+
const loc = Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase();
|
|
238
|
+
if (loc.startsWith("zh"))
|
|
239
|
+
return "zh";
|
|
240
|
+
if (loc.startsWith("ja"))
|
|
241
|
+
return "ja";
|
|
242
|
+
if (loc.startsWith("ko"))
|
|
243
|
+
return "ko";
|
|
244
|
+
return "en";
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return "en";
|
|
248
|
+
}
|
|
249
|
+
}
|