@chaoset/adaptive-perf 0.6.0 → 0.7.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/client/client.cjs CHANGED
@@ -3,82 +3,109 @@ window.__ModuleLoader__.load({
3
3
  factory: (require) => {
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
- let react = require("react");
6
+ "use strict";
7
+ var __create = Object.create;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
7
34
 
8
- // ── 样式(注入 style 标签,模仿官方卡片外观)──────────────────────────
35
+ // client/index.tsx
36
+ var index_exports = {};
37
+ __export(index_exports, {
38
+ apply: () => apply,
39
+ inject: () => inject
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+ var React = __toESM(require("react"), 1);
9
43
  var css = ".ap_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:10px;min-width:0;overflow:hidden}.ap_card[data-open=true]{border-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-shadow-lv1)}.ap_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:10px;align-items:center;gap:12px;padding:12px 14px;display:flex}.ap_header:hover,.ap_card[data-open=true]>.ap_header{background:var(--dsw-alias-interactive-bg-hover)}.ap_title{flex:1;min-width:0;font-size:14px;font-weight:600;line-height:20px}.ap_badge{white-space:nowrap;background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent);color:var(--dsw-alias-state-success-primary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:16px}.ap_body{border-top:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);padding:10px 14px 12px}.ap_field{flex-direction:column;gap:4px;padding:8px 0;display:flex}.ap_label{font-size:12px;font-weight:500;line-height:18px}.ap_input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:32px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:6px;padding:0 10px;font-size:13px;line-height:20px}.ap_textarea{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);font:inherit;color:var(--dsw-alias-label-primary);border-radius:6px;padding:6px 10px;font-size:12px;line-height:18px;resize:vertical;min-height:120px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.ap_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px;line-height:16px}.ap_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:8px 0 2px;display:flex}.ap_save{font:inherit;cursor:pointer;border:1px solid transparent;border-radius:6px;padding:4px 14px;font-size:12px;line-height:18px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.ap_discard{font:inherit;cursor:pointer;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:4px 14px;font-size:12px;line-height:18px;background:0 0;color:inherit}.ap_status{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary);flex:1}.ap_status.ap_error{color:var(--dsw-alias-state-danger-primary)}";
10
44
  var tagId = "@chaoset/adaptive-perf/client.css";
11
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"" + tagId + "\"]") === null) {
12
- var tag = document.createElement("style");
45
+ if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="' + tagId + '"]') === null) {
46
+ tag = document.createElement("style");
13
47
  tag.dataset.plugin = "@chaoset/adaptive-perf";
14
48
  tag.dataset.pluginCss = tagId;
15
49
  tag.textContent = css;
16
50
  document.head.appendChild(tag);
17
51
  }
18
-
19
- // ── 字典 ─────────────────────────────────────────────────────────────
20
- const NS = "settings.plugins.adaptivePerf";
21
- const zh = {
22
- title: "极简性能自适应(adaptive-perf)",
23
- hint: "让标准模式 / PTC 模式达到极简模式级别的高性能:抑制运行时上下文快照,启动即精简工具目录,按需求信号自动放行工具族。",
24
- unsaved: "有未保存的修改",
25
- discard: "放弃修改",
26
- saving: "保存中…",
27
- save: "保存",
28
- saveFailed: "保存失败",
29
- saved: "已保存,热生效(新会话立即生效)",
30
- loadFailed: "读取配置失败",
31
- invalidFamilies: "families 必须是合法 JSON 对象",
32
- enabled: "启用插件",
33
- presets: "目标 preset",
34
- fieldPresets: "逗号分隔的 preset id(如 standard, code)",
35
- suppressRuntimeContext: "抑制运行时上下文快照",
36
- fieldSuppressRuntimeContext: "等同极简模式的 includeRuntimeContext: false,每次请求省掉快照文本(零功能损失)",
37
- leanByDefault: "启动即精简工具目录",
38
- fieldLeanByDefault: "默认隐藏编排类工具族(子代理/工作流/ralph/goal),核心编码工具保留",
39
- escalateOnKeyword: "关键词自动放行",
40
- fieldEscalateOnKeyword: "用户消息命中工具族触发词(如“子代理”)时,该会话放行对应工具族",
41
- escalateOnUnknownTool: "失败自动放行",
42
- fieldEscalateOnUnknownTool: "PTC 程序调用被隐藏工具报 UNKNOWN_TOOL 时自动放行对应族",
43
- suppressInjectedContext: "常驻抑制注入上下文",
44
- fieldSuppressInjectedContext: "整个会话剥离技能目录提醒(skill-catalog)与 AGENTS.md 摘要(agent-instructions),不再在晋升后恢复——替代品是 skill_search/skill_load 按需发现与一次性 instruction-hint(参照 dsh-anchored-standard:注入在场即使后置也扰动轨迹)",
45
- skillDiscovery: "技能按需发现",
46
- fieldSkillDiscovery: "晋升后常驻 skill_search / skill_load 两个小工具,替代 ~9KB 的 <available_skills> 目录注入",
47
- instructionHint: "指令文件一次性提示",
48
- fieldInstructionHint: "晋升后注入一次“指令文件存在,需要时自读”的短提示(探测项目链 AGENTS.md/CLAUDE.md 与 $DSH_HOME/AGENTS.md),替代全文摘要",
49
- families: "工具族(高级)",
50
- fieldFamilies: "JSON:{ 族名: { enabled, tools: [工具名], keywords: [触发词] } }。保存后热生效。",
51
- coreTools: "核心工具(永不隐藏)",
52
- fieldCoreTools: "展示用:这些工具不进入任何限制族。未列入任何族的工具也默认保留。",
53
- bootstrapEnabled: "首轮锚定(bootstrap)",
54
- fieldBootstrapEnabled: "请求 #1 只暴露 Minimal 真实工具对并剥离自动注入上下文,首个持久信号(promoteOn)后恢复——让首轮轨迹锚定极简(参照 dsh-anchored-standard 实测:工具 schema + 注入提醒决定轨迹)",
55
- bootstrapRealPair: "挂载真实 Minimal 工具对",
56
- fieldBootstrapRealPair: "把官方 minimal preset 同款插件(持久 PTY bash + str_replace_editor)挂进会话作用域,按名阴影 standard 的 sandboxed bash——schema 与 Minimal 逐字相同才能锚定(issue #11:任何 standard 系 schema 11/11 落入 standard-like);依赖官方插件包,缺失时自动降级",
57
- bootstrapTools: "首轮工具",
58
- fieldBootstrapTools: "请求 #1 可见的工具(真实 Minimal 对:bash, str_replace_editor)。逗号分隔。",
59
- bootstrapPromoteOn: "晋升触发",
60
- fieldBootstrapPromoteOn: "either(默认):首个 tool/call 或 assistant/message 先到者晋升;tool-call / assistant-message 可单独指定",
61
- bootstrapSuppressed: "剥离的注入上下文",
62
- fieldBootstrapSuppressed: "请求 #1 剥离的自动注入 source.kind(技能目录提醒 skill-catalog、AGENTS.md 摘要 agent-instructions);逗号分隔,留空=不剥离",
63
- bootstrapCompactionTools: "压缩后工作集",
64
- fieldBootstrapCompactionTools: "compaction/end 之后、再次晋升前额外可用的工具(核心工作集)。逗号分隔。",
65
- bootstrapDiscoveryTools: "晋升后常驻发现工具",
66
- fieldBootstrapDiscoveryTools: "晋升后保留在 resident 目录里的按需发现工具(如 dev_tool_search);逗号分隔。",
67
- bootstrapMaxTokens: "首轮输出预算封顶(token)",
68
- fieldBootstrapMaxTokens: "请求 #1 的 maxTokens 封顶,晋升后自动剥离;0 = 不封顶(opt-in)",
69
- minimalPromptEnabled: "极简提示词层(语域锚定)",
70
- fieldMinimalPromptEnabled: "把系统提示拉回极简语域:屏蔽全局引导段 + 替换 persona。参考实现的完整锚定条件——仅收窄工具不足以翻转思维链风格(let me → let's/i'll/i need)",
71
- minimalPromptPersona: "persona 文本",
72
- fieldMinimalPromptPersona: "按名替换 deployment:persona;默认与极简模式逐字相同。留空 = 不替换(保留原 persona)",
73
- minimalPromptSuppressSections: "屏蔽全局引导段",
74
- fieldMinimalPromptSuppressSections: "屏蔽 harness:identity / harness:source / app:web-surface 三个全局段(等同极简 complete persona 的效果;plan-mode 与 PTC 的 SDK 段不受影响)"
52
+ var tag;
53
+ var NS = "settings.plugins.adaptivePerf";
54
+ var zh = {
55
+ title: "\u6781\u7B80\u6027\u80FD\u81EA\u9002\u5E94\uFF08adaptive-perf\uFF09",
56
+ hint: "\u8BA9\u6807\u51C6\u6A21\u5F0F / PTC \u6A21\u5F0F\u8FBE\u5230\u6781\u7B80\u6A21\u5F0F\u7EA7\u522B\u7684\u9AD8\u6027\u80FD\uFF1A\u6291\u5236\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587\u5FEB\u7167\uFF0C\u542F\u52A8\u5373\u7CBE\u7B80\u5DE5\u5177\u76EE\u5F55\uFF0C\u6309\u9700\u6C42\u4FE1\u53F7\u81EA\u52A8\u653E\u884C\u5DE5\u5177\u65CF\u3002",
57
+ unsaved: "\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539",
58
+ discard: "\u653E\u5F03\u4FEE\u6539",
59
+ saving: "\u4FDD\u5B58\u4E2D\u2026",
60
+ save: "\u4FDD\u5B58",
61
+ saveFailed: "\u4FDD\u5B58\u5931\u8D25",
62
+ saved: "\u5DF2\u4FDD\u5B58\uFF0C\u70ED\u751F\u6548\uFF08\u65B0\u4F1A\u8BDD\u7ACB\u5373\u751F\u6548\uFF09",
63
+ loadFailed: "\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25",
64
+ invalidFamilies: "families \u5FC5\u987B\u662F\u5408\u6CD5 JSON \u5BF9\u8C61",
65
+ enabled: "\u542F\u7528\u63D2\u4EF6",
66
+ presets: "\u76EE\u6807 preset",
67
+ fieldPresets: "\u9017\u53F7\u5206\u9694\u7684 preset id\uFF08\u5982 standard, code\uFF09",
68
+ suppressRuntimeContext: "\u6291\u5236\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587\u5FEB\u7167",
69
+ fieldSuppressRuntimeContext: "\u7B49\u540C\u6781\u7B80\u6A21\u5F0F\u7684 includeRuntimeContext: false\uFF0C\u6BCF\u6B21\u8BF7\u6C42\u7701\u6389\u5FEB\u7167\u6587\u672C\uFF08\u96F6\u529F\u80FD\u635F\u5931\uFF09",
70
+ leanByDefault: "\u542F\u52A8\u5373\u7CBE\u7B80\u5DE5\u5177\u76EE\u5F55",
71
+ fieldLeanByDefault: "\u9ED8\u8BA4\u9690\u85CF\u7F16\u6392\u7C7B\u5DE5\u5177\u65CF\uFF08\u5B50\u4EE3\u7406/\u5DE5\u4F5C\u6D41/ralph/goal\uFF09\uFF0C\u6838\u5FC3\u7F16\u7801\u5DE5\u5177\u4FDD\u7559",
72
+ escalateOnKeyword: "\u5173\u952E\u8BCD\u81EA\u52A8\u653E\u884C",
73
+ fieldEscalateOnKeyword: "\u7528\u6237\u6D88\u606F\u547D\u4E2D\u5DE5\u5177\u65CF\u89E6\u53D1\u8BCD\uFF08\u5982\u201C\u5B50\u4EE3\u7406\u201D\uFF09\u65F6\uFF0C\u8BE5\u4F1A\u8BDD\u653E\u884C\u5BF9\u5E94\u5DE5\u5177\u65CF",
74
+ escalateOnUnknownTool: "\u5931\u8D25\u81EA\u52A8\u653E\u884C",
75
+ fieldEscalateOnUnknownTool: "PTC \u7A0B\u5E8F\u8C03\u7528\u88AB\u9690\u85CF\u5DE5\u5177\u62A5 UNKNOWN_TOOL \u65F6\u81EA\u52A8\u653E\u884C\u5BF9\u5E94\u65CF",
76
+ suppressInjectedContext: "\u5E38\u9A7B\u6291\u5236\u6CE8\u5165\u4E0A\u4E0B\u6587",
77
+ fieldSuppressInjectedContext: "\u6574\u4E2A\u4F1A\u8BDD\u5265\u79BB\u6280\u80FD\u76EE\u5F55\u63D0\u9192\uFF08skill-catalog\uFF09\u4E0E AGENTS.md \u6458\u8981\uFF08agent-instructions\uFF09\uFF0C\u4E0D\u518D\u5728\u664B\u5347\u540E\u6062\u590D\u2014\u2014\u66FF\u4EE3\u54C1\u662F skill_search/skill_load \u6309\u9700\u53D1\u73B0\u4E0E\u4E00\u6B21\u6027 instruction-hint\uFF08\u53C2\u7167 dsh-anchored-standard\uFF1A\u6CE8\u5165\u5728\u573A\u5373\u4F7F\u540E\u7F6E\u4E5F\u6270\u52A8\u8F68\u8FF9\uFF09",
78
+ families: "\u5DE5\u5177\u65CF\uFF08\u9AD8\u7EA7\uFF09",
79
+ fieldFamilies: "JSON\uFF1A{ \u65CF\u540D: { enabled, tools: [\u5DE5\u5177\u540D], keywords: [\u89E6\u53D1\u8BCD] } }\u3002\u4FDD\u5B58\u540E\u70ED\u751F\u6548\u3002",
80
+ coreTools: "\u6838\u5FC3\u5DE5\u5177\uFF08\u6C38\u4E0D\u9690\u85CF\uFF09",
81
+ fieldCoreTools: "\u5C55\u793A\u7528\uFF1A\u8FD9\u4E9B\u5DE5\u5177\u4E0D\u8FDB\u5165\u4EFB\u4F55\u9650\u5236\u65CF\u3002\u672A\u5217\u5165\u4EFB\u4F55\u65CF\u7684\u5DE5\u5177\u4E5F\u9ED8\u8BA4\u4FDD\u7559\u3002",
82
+ bootstrapEnabled: "\u9996\u8F6E\u951A\u5B9A\uFF08bootstrap\uFF09",
83
+ fieldBootstrapEnabled: "\u8BF7\u6C42 #1 \u53EA\u66B4\u9732 Minimal \u771F\u5B9E\u5DE5\u5177\u5BF9\u5E76\u5265\u79BB\u81EA\u52A8\u6CE8\u5165\u4E0A\u4E0B\u6587\uFF0C\u9996\u4E2A\u6301\u4E45\u4FE1\u53F7\uFF08promoteOn\uFF09\u540E\u6062\u590D\u2014\u2014\u8BA9\u9996\u8F6E\u8F68\u8FF9\u951A\u5B9A\u6781\u7B80\uFF08\u53C2\u7167 dsh-anchored-standard \u5B9E\u6D4B\uFF1A\u5DE5\u5177 schema + \u6CE8\u5165\u63D0\u9192\u51B3\u5B9A\u8F68\u8FF9\uFF09",
84
+ bootstrapRealPair: "\u6302\u8F7D\u771F\u5B9E Minimal \u5DE5\u5177\u5BF9",
85
+ fieldBootstrapRealPair: "\u628A\u5B98\u65B9 minimal preset \u540C\u6B3E\u63D2\u4EF6\uFF08\u6301\u4E45 PTY bash + str_replace_editor\uFF09\u6302\u8FDB\u4F1A\u8BDD\u4F5C\u7528\u57DF\uFF0C\u6309\u540D\u9634\u5F71 standard \u7684 sandboxed bash\u2014\u2014schema \u4E0E Minimal \u9010\u5B57\u76F8\u540C\u624D\u80FD\u951A\u5B9A\uFF08issue #11\uFF1A\u4EFB\u4F55 standard \u7CFB schema 11/11 \u843D\u5165 standard-like\uFF09\uFF1B\u4F9D\u8D56\u5B98\u65B9\u63D2\u4EF6\u5305\uFF0C\u7F3A\u5931\u65F6\u81EA\u52A8\u964D\u7EA7",
86
+ bootstrapTools: "\u9996\u8F6E\u5DE5\u5177",
87
+ fieldBootstrapTools: "\u8BF7\u6C42 #1 \u53EF\u89C1\u7684\u5DE5\u5177\uFF08\u771F\u5B9E Minimal \u5BF9\uFF1Abash, str_replace_editor\uFF09\u3002\u9017\u53F7\u5206\u9694\u3002",
88
+ bootstrapPromoteOn: "\u664B\u5347\u89E6\u53D1",
89
+ fieldBootstrapPromoteOn: "either\uFF08\u9ED8\u8BA4\uFF09\uFF1A\u9996\u4E2A tool/call \u6216 assistant/message \u5148\u5230\u8005\u664B\u5347\uFF1Btool-call / assistant-message \u53EF\u5355\u72EC\u6307\u5B9A",
90
+ bootstrapSuppressed: "\u5265\u79BB\u7684\u6CE8\u5165\u4E0A\u4E0B\u6587",
91
+ bootstrapDiscovery: "\u5E38\u9A7B\u53D1\u73B0\u5DE5\u5177\uFF08\u664B\u5347\u540E\uFF09",
92
+ fieldBootstrapSuppressed: "\u8BF7\u6C42 #1 \u5265\u79BB\u7684\u81EA\u52A8\u6CE8\u5165 source.kind\uFF08\u6280\u80FD\u76EE\u5F55\u63D0\u9192 skill-catalog\u3001AGENTS.md \u6458\u8981 agent-instructions\uFF09\uFF1B\u9017\u53F7\u5206\u9694\uFF0C\u7559\u7A7A=\u4E0D\u5265\u79BB",
93
+ fieldBootstrapDiscovery: "\u664B\u5347\u540E\u5E38\u9A7B\u76EE\u5F55\u7684\u53D1\u73B0\u5DE5\u5177\uFF08dev_tool_search \u641C\u7D22\u5B8C\u6574\u76EE\u5F55\u5E76\u6309\u540D\u89E3\u9501\uFF1Bskill_search / skill_load \u6309\u9700\u52A0\u8F7D\u6280\u80FD\uFF09\uFF1B\u9017\u53F7\u5206\u9694",
94
+ bootstrapMaxTokens: "\u9996\u8F6E\u8F93\u51FA\u9884\u7B97\u5C01\u9876\uFF08token\uFF09",
95
+ fieldBootstrapMaxTokens: "\u8BF7\u6C42 #1 \u7684 maxTokens \u5C01\u9876\uFF0C\u664B\u5347\u540E\u81EA\u52A8\u5265\u79BB\uFF1B0 = \u4E0D\u5C01\u9876\uFF08opt-in\uFF09",
96
+ minimalPromptEnabled: "\u6781\u7B80\u63D0\u793A\u8BCD\u5C42\uFF08\u8BED\u57DF\u951A\u5B9A\uFF09",
97
+ fieldMinimalPromptEnabled: "\u628A\u7CFB\u7EDF\u63D0\u793A\u62C9\u56DE\u6781\u7B80\u8BED\u57DF\uFF1A\u5C4F\u853D\u5168\u5C40\u5F15\u5BFC\u6BB5 + \u66FF\u6362 persona\u3002\u53C2\u8003\u5B9E\u73B0\u7684\u5B8C\u6574\u951A\u5B9A\u6761\u4EF6\u2014\u2014\u4EC5\u6536\u7A84\u5DE5\u5177\u4E0D\u8DB3\u4EE5\u7FFB\u8F6C\u601D\u7EF4\u94FE\u98CE\u683C\uFF08let me \u2192 let's/i'll/i need\uFF09",
98
+ minimalPromptPersona: "persona \u6587\u672C",
99
+ fieldMinimalPromptPersona: "\u6309\u540D\u66FF\u6362 deployment:persona\uFF1B\u9ED8\u8BA4\u4E0E\u6781\u7B80\u6A21\u5F0F\u9010\u5B57\u76F8\u540C\u3002\u7559\u7A7A = \u4E0D\u66FF\u6362\uFF08\u4FDD\u7559\u539F persona\uFF09",
100
+ minimalPromptSuppressSections: "\u5C4F\u853D\u5168\u5C40\u5F15\u5BFC\u6BB5",
101
+ fieldMinimalPromptSuppressSections: "\u5C4F\u853D harness:identity / harness:source / app:web-surface \u4E09\u4E2A\u5168\u5C40\u6BB5\uFF08\u7B49\u540C\u6781\u7B80 complete persona \u7684\u6548\u679C\uFF1Bplan-mode \u4E0E PTC \u7684 SDK \u6BB5\u4E0D\u53D7\u5F71\u54CD\uFF09"
75
102
  };
76
- const en = {
103
+ var en = {
77
104
  title: "Adaptive performance (adaptive-perf)",
78
105
  hint: "Bring standard / PTC presets to minimal-mode-level performance: suppress the runtime-context snapshot, start with a lean tool catalog, and re-enable tool families on demand.",
79
106
  unsaved: "Unsaved changes",
80
107
  discard: "Discard",
81
- saving: "Saving",
108
+ saving: "Saving\u2026",
82
109
  save: "Save",
83
110
  saveFailed: "Save failed",
84
111
  saved: "Saved; hot-applied (new sessions take effect immediately)",
@@ -96,52 +123,46 @@ window.__ModuleLoader__.load({
96
123
  escalateOnUnknownTool: "Failure escalation",
97
124
  fieldEscalateOnUnknownTool: "A PTC program calling a hidden tool (UNKNOWN_TOOL) re-enables that family",
98
125
  suppressInjectedContext: "Always suppress injected context",
99
- fieldSuppressInjectedContext: "Strip the skill-catalog reminder and the AGENTS.md digest from every request, not just request #1 replaced by on-demand skill_search/skill_load and a one-shot instruction hint (per dsh-anchored-standard: the injections perturb the trajectory even after promotion)",
100
- skillDiscovery: "On-demand skill discovery",
101
- fieldSkillDiscovery: "Keep skill_search / skill_load resident after promotion as the replacement for the ~9KB <available_skills> catalog injection",
102
- instructionHint: "One-shot instruction hint",
103
- fieldInstructionHint: "After promotion, inject ONCE a short hint that instruction files exist and should be read when relevant (probes the project chain AGENTS.md/CLAUDE.md and $DSH_HOME/AGENTS.md), instead of dumping their content",
126
+ fieldSuppressInjectedContext: "Strip the skill-catalog reminder and the AGENTS.md digest from every request, not just request #1 \u2014 replaced by on-demand skill_search/skill_load and a one-shot instruction hint (per dsh-anchored-standard: the injections perturb the trajectory even after promotion)",
104
127
  families: "Tool families (advanced)",
105
128
  fieldFamilies: "JSON: { familyId: { enabled, tools: [names], keywords: [triggers] } }. Hot-applied on save.",
106
129
  coreTools: "Core tools (never hidden)",
107
130
  fieldCoreTools: "Informational: these never enter any restriction family. Tools not listed in any family stay visible too.",
108
131
  bootstrapEnabled: "First-request bootstrap",
109
- fieldBootstrapEnabled: "Request #1 exposes only the real Minimal tool pair and drops auto-injected context; the first durable signal (promoteOn) restores the catalog anchors the first-request trajectory to minimal (per dsh-anchored-standard measurements)",
132
+ fieldBootstrapEnabled: "Request #1 exposes only the real Minimal tool pair and drops auto-injected context; the first durable signal (promoteOn) restores the catalog \u2014 anchors the first-request trajectory to minimal (per dsh-anchored-standard measurements)",
110
133
  bootstrapRealPair: "Mount the real Minimal tool pair",
111
- fieldBootstrapRealPair: "Mount the official minimal-preset plugins (persistent PTY bash + str_replace_editor) into the session scope, shadowing the standard sandboxed bash by name only byte-identical schemas anchor (issue #11: every standard-family schema fell standard-like 11/11); degrades gracefully when the official packages are missing",
134
+ fieldBootstrapRealPair: "Mount the official minimal-preset plugins (persistent PTY bash + str_replace_editor) into the session scope, shadowing the standard sandboxed bash by name \u2014 only byte-identical schemas anchor (issue #11: every standard-family schema fell standard-like 11/11); degrades gracefully when the official packages are missing",
112
135
  bootstrapTools: "Bootstrap tools",
113
136
  fieldBootstrapTools: "Tools visible on request #1 (the real Minimal pair: bash, str_replace_editor). Comma-separated.",
114
137
  bootstrapPromoteOn: "Promotion trigger",
115
138
  fieldBootstrapPromoteOn: "either (default): first tool/call or assistant/message promotes; tool-call / assistant-message select one",
116
139
  bootstrapSuppressed: "Suppressed injected context",
140
+ bootstrapDiscovery: "Resident discovery tools (post-promotion)",
117
141
  fieldBootstrapSuppressed: "Auto-injected source.kinds stripped on request #1 (skill-catalog reminder, agent-instructions digest); comma-separated, empty = strip nothing",
118
- bootstrapCompactionTools: "Post-compaction work set",
119
- fieldBootstrapCompactionTools: "Extra tools available after compaction/end until a new promotion signal (core work set). Comma-separated.",
120
- bootstrapDiscoveryTools: "Resident discovery tools",
121
- fieldBootstrapDiscoveryTools: "On-demand discovery tools kept in the resident catalog after promotion (e.g. dev_tool_search). Comma-separated.",
142
+ fieldBootstrapDiscovery: "Resident discovery tools after promotion (dev_tool_search searches the full catalog and unlocks by name; skill_search / skill_load load skills on demand); comma-separated",
122
143
  bootstrapMaxTokens: "First-request output cap (tokens)",
123
144
  fieldBootstrapMaxTokens: "maxTokens cap for request #1, stripped after promotion; 0 = no cap (opt-in)",
124
145
  minimalPromptEnabled: "Minimal prompt layer (register anchor)",
125
- fieldMinimalPromptEnabled: "Pull the system prompt back to the minimal register: suppress the global orientation sections and replace the persona. The reference's full anchoring condition tool narrowing alone does not flip the thinking style (let me let's/i'll/i need)",
146
+ fieldMinimalPromptEnabled: "Pull the system prompt back to the minimal register: suppress the global orientation sections and replace the persona. The reference's full anchoring condition \u2014 tool narrowing alone does not flip the thinking style (let me \u2192 let's/i'll/i need)",
126
147
  minimalPromptPersona: "Persona text",
127
148
  fieldMinimalPromptPersona: "Shadows deployment:persona by name; defaults to the exact minimal-mode text. Empty = keep the original persona",
128
149
  minimalPromptSuppressSections: "Suppress global orientation sections",
129
150
  fieldMinimalPromptSuppressSections: "Shadow harness:identity / harness:source / app:web-surface to empty (same effect as minimal's complete persona; plan-mode and the PTC SDK sections are unaffected)"
130
151
  };
131
-
132
- // ── 表单字段 ─────────────────────────────────────────────────────────
133
152
  function Field(props) {
134
- return react.createElement(
153
+ return React.createElement(
135
154
  "label",
136
155
  { className: "ap_field" },
137
- react.createElement("span", { className: "ap_label" }, props.label),
156
+ React.createElement("span", { className: "ap_label" }, props.label),
138
157
  props.children,
139
- props.hint !== void 0 ? react.createElement("p", { className: "ap_hint" }, props.hint) : null
158
+ props.hint !== void 0 ? React.createElement("p", { className: "ap_hint" }, props.hint) : null
140
159
  );
141
160
  }
142
161
  function TextField(props) {
143
- return react.createElement(Field, { label: props.label, hint: props.hint },
144
- react.createElement("input", {
162
+ return React.createElement(
163
+ Field,
164
+ { label: props.label, hint: props.hint },
165
+ React.createElement("input", {
145
166
  className: "ap_input",
146
167
  value: props.value,
147
168
  onChange: (e) => props.onChange(e.target.value),
@@ -150,8 +171,10 @@ window.__ModuleLoader__.load({
150
171
  );
151
172
  }
152
173
  function BoolField(props) {
153
- return react.createElement(Field, { label: props.label, hint: props.hint },
154
- react.createElement("input", {
174
+ return React.createElement(
175
+ Field,
176
+ { label: props.label, hint: props.hint },
177
+ React.createElement("input", {
155
178
  type: "checkbox",
156
179
  checked: props.value === true,
157
180
  onChange: (e) => props.onChange(e.target.checked),
@@ -169,31 +192,28 @@ window.__ModuleLoader__.load({
169
192
  }
170
193
  for (const [id, fam] of Object.entries(parsed)) {
171
194
  if (fam === null || typeof fam !== "object" || Array.isArray(fam)) {
172
- throw new TypeError("family \"" + id + "\" must be an object");
195
+ throw new TypeError('family "' + id + '" must be an object');
173
196
  }
174
197
  if (fam.enabled !== void 0 && typeof fam.enabled !== "boolean") {
175
- throw new TypeError("family \"" + id + "\".enabled must be a boolean");
198
+ throw new TypeError('family "' + id + '".enabled must be a boolean');
176
199
  }
177
200
  for (const key of ["tools", "keywords"]) {
178
201
  if (fam[key] !== void 0 && !(Array.isArray(fam[key]) && fam[key].every((v) => typeof v === "string"))) {
179
- throw new TypeError("family \"" + id + "\"." + key + " must be an array of strings");
202
+ throw new TypeError('family "' + id + '".' + key + " must be an array of strings");
180
203
  }
181
204
  }
182
205
  }
183
206
  return parsed;
184
207
  }
185
-
186
- // ── 配置卡片 ─────────────────────────────────────────────────────────
187
208
  function AdaptivePerfCard(props) {
188
209
  const t = props.t;
189
- const [open, setOpen] = react.useState(false);
190
- const [cfg, setCfg] = react.useState(null);
191
- const [draft, setDraft] = react.useState(null);
192
- const [familiesText, setFamiliesText] = react.useState("");
193
- const [saving, setSaving] = react.useState(false);
194
- const [status, setStatus] = react.useState(null);
195
-
196
- react.useEffect(() => {
210
+ const [open, setOpen] = React.useState(false);
211
+ const [cfg, setCfg] = React.useState(null);
212
+ const [draft, setDraft] = React.useState(null);
213
+ const [familiesText, setFamiliesText] = React.useState("");
214
+ const [saving, setSaving] = React.useState(false);
215
+ const [status, setStatus] = React.useState(null);
216
+ React.useEffect(() => {
197
217
  let cancelled = false;
198
218
  props.getConfig().then((value) => {
199
219
  if (cancelled) return;
@@ -203,9 +223,10 @@ window.__ModuleLoader__.load({
203
223
  }).catch((error) => {
204
224
  if (!cancelled) setStatus({ kind: "error", text: t("loadFailed") + ": " + (error && error.message || error) });
205
225
  });
206
- return () => { cancelled = true; };
226
+ return () => {
227
+ cancelled = true;
228
+ };
207
229
  }, []);
208
-
209
230
  let familiesInvalid = false;
210
231
  let familiesError = null;
211
232
  if (draft !== null) {
@@ -213,7 +234,7 @@ window.__ModuleLoader__.load({
213
234
  textToFamilies(familiesText);
214
235
  } catch (error) {
215
236
  familiesInvalid = true;
216
- familiesError = error && error.message || String(error);
237
+ familiesError = error?.message ?? String(error);
217
238
  }
218
239
  }
219
240
  const dirty = draft !== null && (JSON.stringify(draft) !== JSON.stringify(cfg) || familiesInvalid === false && familiesToText(draft.families) !== familiesText);
@@ -229,7 +250,7 @@ window.__ModuleLoader__.load({
229
250
  try {
230
251
  next = { ...draft, families: textToFamilies(familiesText) };
231
252
  } catch (error) {
232
- setStatus({ kind: "error", text: t("invalidFamilies") + ": " + (error && error.message || error) });
253
+ setStatus({ kind: "error", text: t("invalidFamilies") + ": " + (error?.message ?? String(error)) });
233
254
  return;
234
255
  }
235
256
  setSaving(true);
@@ -243,11 +264,10 @@ window.__ModuleLoader__.load({
243
264
  setStatus({ kind: "error", text: t("saveFailed") + ": " + (error && error.message || error) });
244
265
  }).finally(() => setSaving(false));
245
266
  };
246
-
247
- return react.createElement(
267
+ return React.createElement(
248
268
  "li",
249
269
  { className: "ap_card", "data-open": open },
250
- react.createElement(
270
+ React.createElement(
251
271
  "button",
252
272
  {
253
273
  className: "ap_header",
@@ -255,161 +275,142 @@ window.__ModuleLoader__.load({
255
275
  onClick: () => setOpen(!open),
256
276
  "aria-expanded": open
257
277
  },
258
- react.createElement("span", { className: "ap_title" }, t("title")),
259
- dirty ? react.createElement("span", { className: "ap_badge" }, t("unsaved")) : null,
260
- react.createElement("span", null, open ? "" : "")
278
+ React.createElement("span", { className: "ap_title" }, t("title")),
279
+ dirty ? React.createElement("span", { className: "ap_badge" }, t("unsaved")) : null,
280
+ React.createElement("span", null, open ? "\u25B2" : "\u25BC")
261
281
  ),
262
- open ? react.createElement(
282
+ open ? React.createElement(
263
283
  "div",
264
284
  { className: "ap_body" },
265
- react.createElement("p", { className: "ap_hint" }, t("hint")),
266
- react.createElement(BoolField, {
285
+ React.createElement("p", { className: "ap_hint" }, t("hint")),
286
+ React.createElement(BoolField, {
267
287
  label: t("enabled"),
268
- value: draft === null ? false : draft.enabled,
288
+ value: draft === null ? true : draft.enabled,
269
289
  disabled: draft === null,
270
290
  onChange: (v) => setDraft({ ...draft, enabled: v })
271
291
  }),
272
- react.createElement(TextField, {
292
+ React.createElement(TextField, {
273
293
  label: t("presets"),
274
294
  hint: t("fieldPresets"),
275
- value: draft === null ? "" : (draft.presets || []).join(", "),
295
+ value: draft === null ? "standard, code, cordis" : (draft.presets || []).join(", "),
276
296
  disabled: draft === null,
277
297
  onChange: (v) => setDraft({ ...draft, presets: v.split(/[,,\s]+/).filter((x) => x.length > 0) })
278
298
  }),
279
- react.createElement(BoolField, {
299
+ React.createElement(BoolField, {
280
300
  label: t("suppressRuntimeContext"),
281
301
  hint: t("fieldSuppressRuntimeContext"),
282
- value: draft === null ? false : draft.suppressRuntimeContext,
302
+ value: draft === null ? true : draft.suppressRuntimeContext,
283
303
  disabled: draft === null,
284
304
  onChange: (v) => setDraft({ ...draft, suppressRuntimeContext: v })
285
305
  }),
286
- react.createElement(BoolField, {
306
+ React.createElement(BoolField, {
287
307
  label: t("leanByDefault"),
288
308
  hint: t("fieldLeanByDefault"),
289
309
  value: draft === null ? false : draft.leanByDefault,
290
310
  disabled: draft === null,
291
311
  onChange: (v) => setDraft({ ...draft, leanByDefault: v })
292
312
  }),
293
- react.createElement(BoolField, {
313
+ React.createElement(BoolField, {
294
314
  label: t("escalateOnKeyword"),
295
315
  hint: t("fieldEscalateOnKeyword"),
296
- value: draft === null ? false : draft.escalateOnKeyword,
316
+ value: draft === null ? true : draft.escalateOnKeyword,
297
317
  disabled: draft === null,
298
318
  onChange: (v) => setDraft({ ...draft, escalateOnKeyword: v })
299
319
  }),
300
- react.createElement(BoolField, {
320
+ React.createElement(BoolField, {
301
321
  label: t("escalateOnUnknownTool"),
302
322
  hint: t("fieldEscalateOnUnknownTool"),
303
- value: draft === null ? false : draft.escalateOnUnknownTool,
323
+ value: draft === null ? true : draft.escalateOnUnknownTool,
304
324
  disabled: draft === null,
305
325
  onChange: (v) => setDraft({ ...draft, escalateOnUnknownTool: v })
306
326
  }),
307
- react.createElement(BoolField, {
327
+ React.createElement(BoolField, {
308
328
  label: t("suppressInjectedContext"),
309
329
  hint: t("fieldSuppressInjectedContext"),
310
330
  value: draft === null ? false : draft.suppressInjectedContext,
311
331
  disabled: draft === null,
312
332
  onChange: (v) => setDraft({ ...draft, suppressInjectedContext: v })
313
333
  }),
314
- react.createElement(BoolField, {
315
- label: t("skillDiscovery"),
316
- hint: t("fieldSkillDiscovery"),
317
- value: draft === null ? false : draft.skillDiscovery,
318
- disabled: draft === null,
319
- onChange: (v) => setDraft({ ...draft, skillDiscovery: v })
320
- }),
321
- react.createElement(BoolField, {
322
- label: t("instructionHint"),
323
- hint: t("fieldInstructionHint"),
324
- value: draft === null ? false : draft.instructionHint,
325
- disabled: draft === null,
326
- onChange: (v) => setDraft({ ...draft, instructionHint: v })
327
- }),
328
- react.createElement(BoolField, {
334
+ React.createElement(BoolField, {
329
335
  label: t("bootstrapEnabled"),
330
336
  hint: t("fieldBootstrapEnabled"),
331
- value: draft === null ? false : !!draft.bootstrap && draft.bootstrap.enabled,
337
+ value: draft === null ? true : !!draft.bootstrap && draft.bootstrap.enabled,
332
338
  disabled: draft === null,
333
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), enabled: v } })
339
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, enabled: v } })
334
340
  }),
335
- react.createElement(BoolField, {
341
+ React.createElement(BoolField, {
336
342
  label: t("bootstrapRealPair"),
337
343
  hint: t("fieldBootstrapRealPair"),
338
- value: draft === null ? false : !!draft.bootstrap && draft.bootstrap.realPair,
339
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
340
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), realPair: v } })
344
+ value: draft === null ? true : !!draft.bootstrap && draft.bootstrap.realPair,
345
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
346
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, realPair: v } })
341
347
  }),
342
- react.createElement(TextField, {
348
+ React.createElement(TextField, {
343
349
  label: t("bootstrapTools"),
344
350
  hint: t("fieldBootstrapTools"),
345
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.tools) || []).join(", "),
346
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
347
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), tools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
351
+ value: draft === null ? "" : (draft.bootstrap && draft.bootstrap.tools || []).join(", "),
352
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
353
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, tools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
348
354
  }),
349
- react.createElement(TextField, {
355
+ React.createElement(TextField, {
350
356
  label: t("bootstrapPromoteOn"),
351
357
  hint: t("fieldBootstrapPromoteOn"),
352
- value: draft === null ? "" : (draft.bootstrap && draft.bootstrap.promoteOn) || "either",
353
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
354
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), promoteOn: (v.trim() || "either") } })
358
+ value: draft === null ? "" : draft.bootstrap && draft.bootstrap.promoteOn || "either",
359
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
360
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, promoteOn: v.trim() || "either" } })
355
361
  }),
356
- react.createElement(TextField, {
362
+ React.createElement(TextField, {
357
363
  label: t("bootstrapSuppressed"),
358
364
  hint: t("fieldBootstrapSuppressed"),
359
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.suppressedContextSources) || []).join(", "),
360
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
361
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), suppressedContextSources: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
365
+ value: draft === null ? "" : (draft.bootstrap && draft.bootstrap.suppressedContextSources || []).join(", "),
366
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
367
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, suppressedContextSources: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
362
368
  }),
363
- react.createElement(TextField, {
364
- label: t("bootstrapCompactionTools"),
365
- hint: t("fieldBootstrapCompactionTools"),
366
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.compactionTools) || []).join(", "),
367
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
368
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), compactionTools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
369
+ React.createElement(TextField, {
370
+ label: t("bootstrapDiscovery"),
371
+ hint: t("fieldBootstrapDiscovery"),
372
+ value: draft === null ? "" : (draft.bootstrap && draft.bootstrap.discoveryTools || []).join(", "),
373
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
374
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, discoveryTools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
369
375
  }),
370
- react.createElement(TextField, {
371
- label: t("bootstrapDiscoveryTools"),
372
- hint: t("fieldBootstrapDiscoveryTools"),
373
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.discoveryTools) || []).join(", "),
374
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
375
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), discoveryTools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
376
- }),
377
- react.createElement(TextField, {
376
+ React.createElement(TextField, {
378
377
  label: t("bootstrapMaxTokens"),
379
378
  hint: t("fieldBootstrapMaxTokens"),
380
- value: draft === null ? "" : String((draft.bootstrap && draft.bootstrap.maxTokens) || 0),
381
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
379
+ value: draft === null ? "" : String(draft.bootstrap && draft.bootstrap.maxTokens || 0),
380
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
382
381
  onChange: (v) => {
383
382
  const n = Number(v.trim());
384
- setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), maxTokens: Number.isSafeInteger(n) && n > 0 ? n : 0 } });
383
+ setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, maxTokens: Number.isSafeInteger(n) && n > 0 ? n : 0 } });
385
384
  }
386
385
  }),
387
- react.createElement(BoolField, {
386
+ React.createElement(BoolField, {
388
387
  label: t("minimalPromptEnabled"),
389
388
  hint: t("fieldMinimalPromptEnabled"),
390
- value: draft === null ? false : (draft.minimalPrompt && draft.minimalPrompt.enabled === true),
389
+ value: draft === null ? true : draft.minimalPrompt && draft.minimalPrompt.enabled === true,
391
390
  disabled: draft === null,
392
- onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...(draft.minimalPrompt || {}), enabled: v } })
391
+ onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...draft.minimalPrompt || {}, enabled: v } })
393
392
  }),
394
- react.createElement(BoolField, {
393
+ React.createElement(BoolField, {
395
394
  label: t("minimalPromptSuppressSections"),
396
395
  hint: t("fieldMinimalPromptSuppressSections"),
397
- value: draft === null ? false : (draft.minimalPrompt && draft.minimalPrompt.suppressSections === true),
398
- disabled: draft === null || (draft.minimalPrompt && draft.minimalPrompt.enabled === false),
399
- onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...(draft.minimalPrompt || {}), suppressSections: v } })
396
+ value: draft === null ? true : draft.minimalPrompt && draft.minimalPrompt.suppressSections === true,
397
+ disabled: draft === null || draft.minimalPrompt && draft.minimalPrompt.enabled === false,
398
+ onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...draft.minimalPrompt || {}, suppressSections: v } })
400
399
  }),
401
- react.createElement(TextField, {
400
+ React.createElement(TextField, {
402
401
  label: t("minimalPromptPersona"),
403
402
  hint: t("fieldMinimalPromptPersona"),
404
- value: draft === null ? "" : ((draft.minimalPrompt && draft.minimalPrompt.persona) || ""),
405
- disabled: draft === null || (draft.minimalPrompt && draft.minimalPrompt.enabled === false),
406
- onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...(draft.minimalPrompt || {}), persona: v } })
403
+ value: draft === null ? "" : draft.minimalPrompt && draft.minimalPrompt.persona || "",
404
+ disabled: draft === null || draft.minimalPrompt && draft.minimalPrompt.enabled === false,
405
+ onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...draft.minimalPrompt || {}, persona: v } })
407
406
  }),
408
- react.createElement(Field, {
409
- label: t("families"),
410
- hint: familiesInvalid ? t("invalidFamilies") + (familiesError !== null ? " — " + familiesError : "") : t("fieldFamilies")
411
- },
412
- react.createElement("textarea", {
407
+ React.createElement(
408
+ Field,
409
+ {
410
+ label: t("families"),
411
+ hint: familiesInvalid ? t("invalidFamilies") + (familiesError !== null ? " \u2014 " + familiesError : "") : t("fieldFamilies")
412
+ },
413
+ React.createElement("textarea", {
413
414
  className: "ap_textarea",
414
415
  value: familiesText,
415
416
  disabled: draft === null,
@@ -417,26 +418,28 @@ window.__ModuleLoader__.load({
417
418
  onChange: (e) => setFamiliesText(e.target.value)
418
419
  })
419
420
  ),
420
- react.createElement(Field, {
421
- label: t("coreTools"),
422
- hint: t("fieldCoreTools")
423
- },
424
- react.createElement("p", { className: "ap_hint" }, draft === null ? "" : (draft.coreTools || []).join(", "))
421
+ React.createElement(
422
+ Field,
423
+ {
424
+ label: t("coreTools"),
425
+ hint: t("fieldCoreTools")
426
+ },
427
+ React.createElement("p", { className: "ap_hint" }, draft === null ? "" : (draft.coreTools || []).join(", "))
425
428
  ),
426
- react.createElement(
429
+ React.createElement(
427
430
  "div",
428
431
  { className: "ap_footer" },
429
- react.createElement(
432
+ React.createElement(
430
433
  "span",
431
434
  { className: "ap_status" + (status !== null && status.kind === "error" ? " ap_error" : ""), role: "status" },
432
435
  status !== null ? status.text : ""
433
436
  ),
434
- react.createElement(
437
+ React.createElement(
435
438
  "button",
436
439
  { className: "ap_discard", type: "button", disabled: saving || draft === null || !dirty, onClick: discard },
437
440
  t("discard")
438
441
  ),
439
- react.createElement(
442
+ React.createElement(
440
443
  "button",
441
444
  { className: "ap_save", type: "button", disabled: saving || draft === null || invalid || !dirty, onClick: save },
442
445
  saving ? t("saving") : t("save")
@@ -445,16 +448,9 @@ window.__ModuleLoader__.load({
445
448
  ) : null
446
449
  );
447
450
  }
448
-
449
- // ── 插件 apply ───────────────────────────────────────────────────────
450
- // DSH 客户端的 remote.<ns> 服务不会自动生成:必须由客户端代码用
451
- // ctx.remote.$mount(contribution) 显式挂载(官方 dsh-api-remotes 即如此)。
452
- // 若只把 remote.adaptivePerfConfig 写进 inject 而不挂载,命名空间永远
453
- // 不存在,客户端插件会一直 pending,web boot 报 "did not activate"。
454
- // 因此本插件先挂载自己的命名空间,再注册设置卡片。
455
- const inject = ["slots", "locale", "remote"];
456
- const passthroughSchema = { parse: (value) => value };
457
- const REMOTE_CONTRIBUTION = {
451
+ var inject = ["slots", "locale", "remote"];
452
+ var passthroughSchema = { parse: (value) => value };
453
+ var REMOTE_CONTRIBUTION = {
458
454
  package: "@chaoset/adaptive-perf",
459
455
  descriptors: [
460
456
  {
@@ -485,9 +481,6 @@ window.__ModuleLoader__.load({
485
481
  async function apply(ctx) {
486
482
  const t = ctx.locale.bind(NS);
487
483
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "adaptive-perf: dictionaries");
488
- // 先挂载命名空间,再用 ctx.get 取回服务:cordis 的属性访问(ctx.remote.X)
489
- // 要求 X 出现在 inject 里,而本插件的命名空间由自己挂载,若写进 inject
490
- // 会和自己等待的服务形成死锁,因此用 ctx.get(对未声明的服务合法)。
491
484
  await ctx.remote.$mount(REMOTE_CONTRIBUTION);
492
485
  const configService = ctx.get("remote.adaptivePerfConfig");
493
486
  if (configService === void 0) throw new Error("adaptive-perf: remote.adaptivePerfConfig did not materialize after mount");
@@ -511,8 +504,6 @@ window.__ModuleLoader__.load({
511
504
  }, AdaptivePerfCard));
512
505
  }
513
506
 
514
- exports.apply = apply;
515
- exports.inject = inject;
516
507
  return module.exports;
517
508
  }
518
509
  });