window.__ModuleLoader__.load({ id: "dsh-unrestricted", factory: (require) => { var module = { exports: {} }; var exports = module.exports; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); let react_jsx_runtime = require("react/jsx-runtime"); //#region src/client/controller.ts const RPC_CHANNEL = "/dsh-unrestricted"; const SETTINGS_NS = "unrestricted"; /** Human-readable error text for the banner. */ function messageOf(error) { return error instanceof Error ? error.message : String(error); } /** * Create the card controller bound to the calling plugin's context. * @param ctx - the browser plugin context (connection + remote + settingsScope injected). * @returns the controller whose face() feeds the slot inject share. */ function createUnrestrictedController(ctx) { const connection = ctx.get("connection"); const settings = ctx.settingsScope.bind({ namespace: SETTINGS_NS }); let snapshot = { enabled: false, writable: false, settingsStatus: "loading", status: null }; const listeners = /* @__PURE__ */ new Set(); const view = { getSnapshot: () => snapshot, subscribe: (listener) => { listeners.add(listener); return () => listeners.delete(listener); } }; function publish() { const settingsSnapshot = settings.getSnapshot(); snapshot = { enabled: settingsSnapshot.value?.enabled === true, writable: settingsSnapshot.writable, settingsStatus: settingsSnapshot.status, status: snapshot.status, message: snapshot.message }; for (const listener of listeners) listener(); } async function call(endpoint, payload) { const result = await connection.rpc.call(RPC_CHANNEL, endpoint, payload); if (!result.ok) throw new Error(result.error.message); return result.value; } async function refresh() { try { const status = await call("status", {}); snapshot = { ...snapshot, status, message: void 0 }; publish(); } catch (error) { snapshot = { ...snapshot, message: messageOf(error) }; publish(); } } async function setEnabled(enabled) { await settings.set("enabled", enabled); publish(); setTimeout(() => void refresh(), 300); } async function recheck() { try { const status = await call("recheck", {}); snapshot = { ...snapshot, status, message: void 0 }; publish(); } catch (error) { snapshot = { ...snapshot, message: messageOf(error) }; publish(); } } ctx.effect(() => settings.subscribe(publish), "dsh-unrestricted: settings mirror"); ctx.effect(() => ctx.remote.$on("settings/document-updated", (namespace) => { if (namespace === void 0 || namespace === SETTINGS_NS) refresh(); }), "dsh-unrestricted: settings invalidations"); publish(); refresh(); return { face: () => ({ hooks: { view }, setEnabled, recheck, refresh }) }; } //#endregion //#region src/client/locales.ts /** Copy dictionaries for the unrestricted settings card. */ /** Simplified Chinese dictionary and key source of truth. */ const zh = { title: "破限模式", summaryEnabled: "已开启", summaryDisabled: "已关闭", summaryLoading: "读取中", summaryUnavailable: "设置不可用", summaryIncompatible: "部分模式不兼容", description: "开启后,各模式的系统提示词整体替换为以当前原版为底稿、融合破限规则的完整版本;关闭即恢复 DSH 原版提示词。从下一次请求和新建子代理开始生效,不改动正在执行的请求、工具定义、权限配置与会话历史。", toggle: "启用破限", scopeNote: "提示词仅由 DSH 生成时才受本插件控制;模型平台或宿主环境中更高优先级的规则不在覆盖范围内。", statusTitle: "各模式状态", modeStandard: "Standard 标准模式", modePtc: "PTC 模式", modeCordis: "Cordis 创造模式", modeMinimal: "Minimal 极简模式", subagentNote: "子代理随所属模式一并生效。", stateActive: "已生效", stateOff: "已关闭", stateChecking: "校验中", stateIncompatible: "版本不兼容,已保持原版", supported: "锚点校验基线(DSH 更新导致原版提示词变化时,对应模式自动回退原版并在此提示):", recheck: "重新校验", refresh: "刷新", settingsUnavailable: "当前连接不可写设置(远程浏览器只读)。", settingsLoading: "正在读取设置…", operationFailed: "操作失败:" }; /** English dictionary checked against the Chinese key set. */ const en = { title: "Unrestricted mode", summaryEnabled: "Enabled", summaryDisabled: "Disabled", summaryLoading: "Loading", summaryUnavailable: "Settings unavailable", summaryIncompatible: "Some modes incompatible", description: "When enabled, each mode's system prompt is replaced wholesale by a fused prompt built on its current original; disabling restores the stock DSH prompt. Applies from the next request and new subagents; in-flight requests, tool definitions, permissions, and session history are never touched.", toggle: "Enable unrestricted mode", scopeNote: "This plugin can only rewrite prompts DSH generates itself; higher-priority rules from the model platform or host environment are out of scope.", statusTitle: "Per-mode status", modeStandard: "Standard", modePtc: "PTC", modeCordis: "Cordis", modeMinimal: "Minimal", subagentNote: "Subagents follow their parent's mode.", stateActive: "Active", stateOff: "Off", stateChecking: "Checking", stateIncompatible: "Incompatible — stock prompt kept", supported: "Anchor-check baseline (when a DSH update changes an original prompt, that mode falls back to the stock prompt and reports here):", recheck: "Re-check", refresh: "Refresh", settingsUnavailable: "This connection cannot write settings (remote browser is read-only).", settingsLoading: "Reading settings…", operationFailed: "Operation failed: " }; /** Dictionary namespace owned by this plugin. */ const NS = "settings.unrestricted"; //#endregion //#region src/client/styles.ts /** * Stylesheet for the unrestricted settings card. One hand-written stylesheet * injected as a single