mirror of
https://github.com/yexi-by/dsh-unrestricted.git
synced 2026-11-28 02:30:22 +08:00
适配 master 当前提示词组合
This commit is contained in:
1 parent
057e473a6c
commit
fdfecb09fc
18 files changed
+104
-143
No files matched your search
+9
-15
@@ -112,7 +112,7 @@ window.__ModuleLoader__.load({
|
||||
summaryDisabled: "已关闭",
|
||||
summaryLoading: "读取中",
|
||||
summaryUnavailable: "设置不可用",
|
||||
summaryIncompatible: "部分模式不兼容",
|
||||
summaryValidationFailed: "部分模式校验未通过",
|
||||
description: "开启后,各模式的系统提示词整体替换为以当前原版为底稿、融合破限规则的完整版本;关闭即恢复 DSH 原版提示词。从下一次请求和新建子代理开始生效,不改动正在执行的请求、工具定义、权限配置与会话历史。",
|
||||
toggle: "启用破限",
|
||||
scopeNote: "提示词仅由 DSH 生成时才受本插件控制;模型平台或宿主环境中更高优先级的规则不在覆盖范围内。",
|
||||
@@ -125,8 +125,7 @@ window.__ModuleLoader__.load({
|
||||
stateActive: "已生效",
|
||||
stateOff: "已关闭",
|
||||
stateChecking: "校验中",
|
||||
stateIncompatible: "版本不兼容,已保持原版",
|
||||
supported: "锚点校验基线(DSH 更新导致原版提示词变化时,对应模式自动回退原版并在此提示):",
|
||||
stateValidationFailed: "校验未通过,已保持原版",
|
||||
recheck: "重新校验",
|
||||
refresh: "刷新",
|
||||
settingsUnavailable: "当前连接不可写设置(远程浏览器只读)。",
|
||||
@@ -140,7 +139,7 @@ window.__ModuleLoader__.load({
|
||||
summaryDisabled: "Disabled",
|
||||
summaryLoading: "Loading",
|
||||
summaryUnavailable: "Settings unavailable",
|
||||
summaryIncompatible: "Some modes incompatible",
|
||||
summaryValidationFailed: "Some mode checks failed",
|
||||
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.",
|
||||
@@ -153,8 +152,7 @@ window.__ModuleLoader__.load({
|
||||
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):",
|
||||
stateValidationFailed: "Check failed — stock prompt kept",
|
||||
recheck: "Re-check",
|
||||
refresh: "Refresh",
|
||||
settingsUnavailable: "This connection cannot write settings (remote browser is read-only).",
|
||||
@@ -349,7 +347,7 @@ window.__ModuleLoader__.load({
|
||||
background: var(--dsw-alias-state-business-primary);
|
||||
}
|
||||
|
||||
.dsh-unrestricted-dot[data-state='incompatible'] {
|
||||
.dsh-unrestricted-dot[data-state='failed'] {
|
||||
background: var(--dsw-alias-state-error-primary);
|
||||
}
|
||||
|
||||
@@ -435,7 +433,7 @@ window.__ModuleLoader__.load({
|
||||
switch (mode?.state) {
|
||||
case "active": return "stateActive";
|
||||
case "checking": return "stateChecking";
|
||||
case "incompatible": return "stateIncompatible";
|
||||
case "failed": return "stateValidationFailed";
|
||||
default: return "stateOff";
|
||||
}
|
||||
}
|
||||
@@ -448,9 +446,9 @@ window.__ModuleLoader__.load({
|
||||
const { t } = props;
|
||||
const view = props.useView((snapshot) => snapshot);
|
||||
const status = view.status;
|
||||
const hasIncompatibleMode = status !== null && Object.values(status.modes).some((mode) => mode.state === "incompatible");
|
||||
const summaryKey = view.settingsStatus === "loading" ? "summaryLoading" : view.settingsStatus === "unavailable" ? "summaryUnavailable" : hasIncompatibleMode ? "summaryIncompatible" : view.enabled ? "summaryEnabled" : "summaryDisabled";
|
||||
const summaryState = view.settingsStatus === "ready" ? hasIncompatibleMode ? "error" : view.enabled ? "active" : "off" : "pending";
|
||||
const hasFailedMode = status !== null && Object.values(status.modes).some((mode) => mode.state === "failed");
|
||||
const summaryKey = view.settingsStatus === "loading" ? "summaryLoading" : view.settingsStatus === "unavailable" ? "summaryUnavailable" : hasFailedMode ? "summaryValidationFailed" : view.enabled ? "summaryEnabled" : "summaryDisabled";
|
||||
const summaryState = view.settingsStatus === "ready" ? hasFailedMode ? "error" : view.enabled ? "active" : "off" : "pending";
|
||||
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
||||
className: "dsh-unrestricted-card",
|
||||
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
|
||||
@@ -529,10 +527,6 @@ window.__ModuleLoader__.load({
|
||||
className: "dsh-unrestricted-note",
|
||||
children: t("subagentNote")
|
||||
}),
|
||||
status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
||||
className: "dsh-unrestricted-note",
|
||||
children: [t("supported"), ` DSH ${status.supported.version}(${status.supported.commit.slice(0, 7)})。`]
|
||||
}),
|
||||
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
||||
className: "dsh-unrestricted-note",
|
||||
children: t("scopeNote")
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"client.js","names":[],"sources":["../src/client/controller.ts","../src/client/locales.ts","../src/client/styles.ts","../src/client/UnrestrictedCard.tsx","../src/client/index.tsx"],"sourcesContent":["/**\n * Browser-half controller for the unrestricted card: binds the `unrestricted`\n * settings namespace (the toggle) and polls the host half's private RPC for\n * per-preset fusion state. Mirrors the card-controller pattern: the apply\n * closure owns the controller, the slot inject face hands hooks and callbacks\n * to the component.\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\n// Type-only: the ctx.remote Context merge and the forwarded-event key face.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: the ctx.settingsScope Context merge.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** The toggle section stored in the `unrestricted` settings namespace. */\nexport interface UnrestrictedSettings {\n enabled?: boolean\n}\n\n/** Per-preset fusion state reported by the host half. */\nexport interface UnrestrictedModeState {\n state: 'off' | 'checking' | 'active' | 'incompatible'\n issues: string[]\n}\n\n/** Host status endpoint payload. */\nexport interface UnrestrictedStatus {\n enabled: boolean\n modes: Record<string, UnrestrictedModeState>\n supported: { version: string; commit: string }\n}\n\n/** Full view snapshot the card subscribes to. */\nexport interface UnrestrictedViewSnapshot {\n /** Persisted toggle; undefined until the settings scope first syncs. */\n enabled: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Settings scope sync state. */\n settingsStatus: 'loading' | 'ready' | 'unavailable'\n /** Live host status; null until the first RPC answer. */\n status: UnrestrictedStatus | null\n /** Last transport/business failure, if any. */\n message?: string\n}\n\n/** Minimal RPC wire shape (structural copy of the host RpcResult). */\ntype RpcResult<T> = { ok: true; value: T } | { ok: false; error: { code: string; message: string } }\n\n/** Minimal observable contract consumed by the slot renderer's hook binding. */\nexport interface UnrestrictedViewSource {\n getSnapshot(): UnrestrictedViewSnapshot\n subscribe(listener: () => void): () => void\n}\n\n/** Inject face handed to the card at registration. */\nexport interface UnrestrictedCardInjected {\n hooks: {\n /** Reactive card view. */\n view: UnrestrictedViewSource\n }\n /** Persist the toggle. */\n setEnabled: (enabled: boolean) => Promise<void>\n /** Re-run the host-side anchor checks and refresh. */\n recheck: () => Promise<void>\n /** Re-read host status. */\n refresh: () => Promise<void>\n}\n\nconst RPC_CHANNEL = '/dsh-unrestricted'\nconst SETTINGS_NS = 'unrestricted'\n\n/** Human-readable error text for the banner. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/**\n * Create the card controller bound to the calling plugin's context.\n * @param ctx - the browser plugin context (connection + remote + settingsScope injected).\n * @returns the controller whose face() feeds the slot inject share.\n */\nexport function createUnrestrictedController(ctx: Context) {\n const connection = ctx.get('connection') as ConnectionHandle\n const settings = ctx.settingsScope.bind<UnrestrictedSettings>({ namespace: SETTINGS_NS })\n\n let snapshot: UnrestrictedViewSnapshot = {\n enabled: false,\n writable: false,\n settingsStatus: 'loading',\n status: null,\n }\n const listeners = new Set<() => void>()\n\n const view: UnrestrictedViewSource = {\n getSnapshot: () => snapshot,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n\n function publish(): void {\n const settingsSnapshot = settings.getSnapshot()\n snapshot = {\n enabled: settingsSnapshot.value?.enabled === true,\n writable: settingsSnapshot.writable,\n settingsStatus: settingsSnapshot.status,\n status: snapshot.status,\n message: snapshot.message,\n }\n for (const listener of listeners) listener()\n }\n\n async function call<T>(endpoint: string, payload: unknown): Promise<T> {\n const result = await connection.rpc.call(RPC_CHANNEL, endpoint, payload) as RpcResult<T>\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n }\n\n async function refresh(): Promise<void> {\n try {\n const status = await call<UnrestrictedStatus>('status', {})\n snapshot = { ...snapshot, status, message: undefined }\n publish()\n } catch (error) {\n snapshot = { ...snapshot, message: messageOf(error) }\n publish()\n }\n }\n\n async function setEnabled(enabled: boolean): Promise<void> {\n await settings.set('enabled', enabled)\Line truncated
|
||||
{"version":3,"file":"client.js","names":[],"sources":["../src/client/controller.ts","../src/client/locales.ts","../src/client/styles.ts","../src/client/UnrestrictedCard.tsx","../src/client/index.tsx"],"sourcesContent":["/**\n * Browser-half controller for the unrestricted card: binds the `unrestricted`\n * settings namespace (the toggle) and polls the host half's private RPC for\n * per-preset fusion state. Mirrors the card-controller pattern: the apply\n * closure owns the controller, the slot inject face hands hooks and callbacks\n * to the component.\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\n// Type-only: the ctx.remote Context merge and the forwarded-event key face.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: the ctx.settingsScope Context merge.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n\n/** The toggle section stored in the `unrestricted` settings namespace. */\nexport interface UnrestrictedSettings {\n enabled?: boolean\n}\n\n/** Per-preset fusion state reported by the host half. */\nexport interface UnrestrictedModeState {\n state: 'off' | 'checking' | 'active' | 'failed'\n issues: string[]\n}\n\n/** Host status endpoint payload. */\nexport interface UnrestrictedStatus {\n enabled: boolean\n modes: Record<string, UnrestrictedModeState>\n}\n\n/** Full view snapshot the card subscribes to. */\nexport interface UnrestrictedViewSnapshot {\n /** Persisted toggle; undefined until the settings scope first syncs. */\n enabled: boolean\n /** Whether the Host document accepts writes. */\n writable: boolean\n /** Settings scope sync state. */\n settingsStatus: 'loading' | 'ready' | 'unavailable'\n /** Live host status; null until the first RPC answer. */\n status: UnrestrictedStatus | null\n /** Last transport/business failure, if any. */\n message?: string\n}\n\n/** Minimal RPC wire shape (structural copy of the host RpcResult). */\ntype RpcResult<T> = { ok: true; value: T } | { ok: false; error: { code: string; message: string } }\n\n/** Minimal observable contract consumed by the slot renderer's hook binding. */\nexport interface UnrestrictedViewSource {\n getSnapshot(): UnrestrictedViewSnapshot\n subscribe(listener: () => void): () => void\n}\n\n/** Inject face handed to the card at registration. */\nexport interface UnrestrictedCardInjected {\n hooks: {\n /** Reactive card view. */\n view: UnrestrictedViewSource\n }\n /** Persist the toggle. */\n setEnabled: (enabled: boolean) => Promise<void>\n /** Re-run the host-side anchor checks and refresh. */\n recheck: () => Promise<void>\n /** Re-read host status. */\n refresh: () => Promise<void>\n}\n\nconst RPC_CHANNEL = '/dsh-unrestricted'\nconst SETTINGS_NS = 'unrestricted'\n\n/** Human-readable error text for the banner. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/**\n * Create the card controller bound to the calling plugin's context.\n * @param ctx - the browser plugin context (connection + remote + settingsScope injected).\n * @returns the controller whose face() feeds the slot inject share.\n */\nexport function createUnrestrictedController(ctx: Context) {\n const connection = ctx.get('connection') as ConnectionHandle\n const settings = ctx.settingsScope.bind<UnrestrictedSettings>({ namespace: SETTINGS_NS })\n\n let snapshot: UnrestrictedViewSnapshot = {\n enabled: false,\n writable: false,\n settingsStatus: 'loading',\n status: null,\n }\n const listeners = new Set<() => void>()\n\n const view: UnrestrictedViewSource = {\n getSnapshot: () => snapshot,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n\n function publish(): void {\n const settingsSnapshot = settings.getSnapshot()\n snapshot = {\n enabled: settingsSnapshot.value?.enabled === true,\n writable: settingsSnapshot.writable,\n settingsStatus: settingsSnapshot.status,\n status: snapshot.status,\n message: snapshot.message,\n }\n for (const listener of listeners) listener()\n }\n\n async function call<T>(endpoint: string, payload: unknown): Promise<T> {\n const result = await connection.rpc.call(RPC_CHANNEL, endpoint, payload) as RpcResult<T>\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n }\n\n async function refresh(): Promise<void> {\n try {\n const status = await call<UnrestrictedStatus>('status', {})\n snapshot = { ...snapshot, status, message: undefined }\n publish()\n } catch (error) {\n snapshot = { ...snapshot, message: messageOf(error) }\n publish()\n }\n }\n\n async function setEnabled(enabled: boolean): Promise<void> {\n await settings.set('enabled', enabled)\n publish()\n // Give the host settings watcher onLine truncated
|
||||
Reference in new issue
Block a user