Files
NetMesh/electron/plugins/terminalInterceptorMessages.cjs
zhaolei 3c72efcb7f
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
[Init] Initial commit - NetMesh terminal manager
2026-09-13 18:24:01 +08:00

64 lines
3.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";
const { escapePermissionText } = require("./nativePermissionDecision.cjs");
const MESSAGES = Object.freeze({
en: Object.freeze({
noInterceptor: "No interceptor",
selectTitle: (direction) => `Terminal ${direction} interceptor`,
selectMessage: (direction) => `Multiple plugins can intercept Terminal ${direction} data. Choose one for this session.`,
warningTitle: "Terminal interceptor disabled",
warningMessage: "A Terminal interceptor was disabled for this session.",
warningDetail: "The plugin failed or exceeded its data-path budget.",
}),
"zh-CN": Object.freeze({
noInterceptor: "不使用拦截器",
selectTitle: (direction) => `终端${direction === "input" ? "输入" : "输出"}拦截器`,
selectMessage: (direction) => `多个插件可以拦截终端${direction === "input" ? "输入" : "输出"}数据。请选择本会话使用的插件。`,
warningTitle: "终端拦截器已停用",
warningMessage: "本会话的一个终端拦截器已被停用。",
warningDetail: "插件失败或超过了数据通道预算。",
}),
"zh-TW": Object.freeze({
noInterceptor: "不使用攔截器",
selectTitle: (direction) => `終端${direction === "input" ? "輸入" : "輸出"}攔截器`,
selectMessage: (direction) => `多個外掛程式可以攔截終端${direction === "input" ? "輸入" : "輸出"}資料。請選擇本工作階段使用的外掛程式。`,
warningTitle: "終端攔截器已停用",
warningMessage: "本工作階段的一個終端攔截器已被停用。",
warningDetail: "外掛程式失敗或超過資料通道預算。",
}),
ru: Object.freeze({
noInterceptor: "Без перехватчика",
selectTitle: (direction) => `Перехватчик ${direction === "input" ? "ввода" : "вывода"} терминала`,
selectMessage: (direction) => `Несколько плагинов могут перехватывать ${direction === "input" ? "ввод" : "вывод"} терминала. Выберите один для этого сеанса.`,
warningTitle: "Перехватчик терминала отключён",
warningMessage: "Перехватчик терминала был отключён для этого сеанса.",
warningDetail: "Плагин завершился с ошибкой или превысил бюджет канала данных.",
}),
});
function terminalInterceptorMessages(locale) {
return MESSAGES[locale] ?? MESSAGES[String(locale).split("-")[0]] ?? MESSAGES.en;
}
function terminalInterceptorChoiceLabel(entry) {
const plugin = escapePermissionText(
entry?.pluginDisplayName ?? entry?.pluginId ?? "Plugin",
160,
);
const provider = escapePermissionText(entry?.provider?.label ?? entry?.provider?.id ?? "Provider", 160);
const pluginId = escapePermissionText(entry?.pluginId ?? "unknown-plugin", 128);
const providerId = escapePermissionText(entry?.provider?.id ?? "unknown-provider", 192);
return `${plugin} (${pluginId}): ${provider} (${providerId})`;
}
function terminalInterceptorIdentifier(value) {
return escapePermissionText(value ?? "", 256);
}
module.exports = {
terminalInterceptorChoiceLabel,
terminalInterceptorIdentifier,
terminalInterceptorMessages,
};