@chaoset/adaptive-perf 0.7.0 → 0.7.2

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,76 +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
- families: "工具族(高级)",
46
- fieldFamilies: "JSON:{ 族名: { enabled, tools: [工具名], keywords: [触发词] } }。保存后热生效。",
47
- coreTools: "核心工具(永不隐藏)",
48
- fieldCoreTools: "展示用:这些工具不进入任何限制族。未列入任何族的工具也默认保留。",
49
- bootstrapEnabled: "首轮锚定(bootstrap)",
50
- fieldBootstrapEnabled: "请求 #1 只暴露 Minimal 真实工具对并剥离自动注入上下文,首个持久信号(promoteOn)后恢复——让首轮轨迹锚定极简(参照 dsh-anchored-standard 实测:工具 schema + 注入提醒决定轨迹)",
51
- bootstrapRealPair: "挂载真实 Minimal 工具对",
52
- fieldBootstrapRealPair: "把官方 minimal preset 同款插件(持久 PTY bash + str_replace_editor)挂进会话作用域,按名阴影 standard 的 sandboxed bash——schema 与 Minimal 逐字相同才能锚定(issue #11:任何 standard 系 schema 11/11 落入 standard-like);依赖官方插件包,缺失时自动降级",
53
- bootstrapTools: "首轮工具",
54
- fieldBootstrapTools: "请求 #1 可见的工具(真实 Minimal 对:bash, str_replace_editor)。逗号分隔。",
55
- bootstrapPromoteOn: "晋升触发",
56
- fieldBootstrapPromoteOn: "either(默认):首个 tool/call 或 assistant/message 先到者晋升;tool-call / assistant-message 可单独指定",
57
- bootstrapSuppressed: "剥离的注入上下文",
58
- bootstrapDiscovery: "常驻发现工具(晋升后)",
59
- fieldBootstrapSuppressed: "请求 #1 剥离的自动注入 source.kind(技能目录提醒 skill-catalog、AGENTS.md 摘要 agent-instructions);逗号分隔,留空=不剥离",
60
- fieldBootstrapDiscovery: "晋升后常驻目录的发现工具(dev_tool_search 搜索完整目录并按名解锁;skill_search / skill_load 按需加载技能);逗号分隔",
61
- bootstrapMaxTokens: "首轮输出预算封顶(token)",
62
- fieldBootstrapMaxTokens: "请求 #1 的 maxTokens 封顶,晋升后自动剥离;0 = 不封顶(opt-in)",
63
- minimalPromptEnabled: "极简提示词层(语域锚定)",
64
- fieldMinimalPromptEnabled: "把系统提示拉回极简语域:屏蔽全局引导段 + 替换 persona。参考实现的完整锚定条件——仅收窄工具不足以翻转思维链风格(let me → let's/i'll/i need)",
65
- minimalPromptPersona: "persona 文本",
66
- fieldMinimalPromptPersona: "按名替换 deployment:persona;默认与极简模式逐字相同。留空 = 不替换(保留原 persona)",
67
- minimalPromptSuppressSections: "屏蔽全局引导段",
68
- 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"
69
102
  };
70
- const en = {
103
+ var en = {
71
104
  title: "Adaptive performance (adaptive-perf)",
72
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.",
73
106
  unsaved: "Unsaved changes",
74
107
  discard: "Discard",
75
- saving: "Saving",
108
+ saving: "Saving\u2026",
76
109
  save: "Save",
77
110
  saveFailed: "Save failed",
78
111
  saved: "Saved; hot-applied (new sessions take effect immediately)",
@@ -90,15 +123,15 @@ window.__ModuleLoader__.load({
90
123
  escalateOnUnknownTool: "Failure escalation",
91
124
  fieldEscalateOnUnknownTool: "A PTC program calling a hidden tool (UNKNOWN_TOOL) re-enables that family",
92
125
  suppressInjectedContext: "Always suppress injected context",
93
- 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)",
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)",
94
127
  families: "Tool families (advanced)",
95
128
  fieldFamilies: "JSON: { familyId: { enabled, tools: [names], keywords: [triggers] } }. Hot-applied on save.",
96
129
  coreTools: "Core tools (never hidden)",
97
130
  fieldCoreTools: "Informational: these never enter any restriction family. Tools not listed in any family stay visible too.",
98
131
  bootstrapEnabled: "First-request bootstrap",
99
- 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)",
100
133
  bootstrapRealPair: "Mount the real Minimal tool pair",
101
- 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",
102
135
  bootstrapTools: "Bootstrap tools",
103
136
  fieldBootstrapTools: "Tools visible on request #1 (the real Minimal pair: bash, str_replace_editor). Comma-separated.",
104
137
  bootstrapPromoteOn: "Promotion trigger",
@@ -110,26 +143,26 @@ window.__ModuleLoader__.load({
110
143
  bootstrapMaxTokens: "First-request output cap (tokens)",
111
144
  fieldBootstrapMaxTokens: "maxTokens cap for request #1, stripped after promotion; 0 = no cap (opt-in)",
112
145
  minimalPromptEnabled: "Minimal prompt layer (register anchor)",
113
- 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)",
114
147
  minimalPromptPersona: "Persona text",
115
148
  fieldMinimalPromptPersona: "Shadows deployment:persona by name; defaults to the exact minimal-mode text. Empty = keep the original persona",
116
149
  minimalPromptSuppressSections: "Suppress global orientation sections",
117
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)"
118
151
  };
119
-
120
- // ── 表单字段 ─────────────────────────────────────────────────────────
121
152
  function Field(props) {
122
- return react.createElement(
153
+ return React.createElement(
123
154
  "label",
124
155
  { className: "ap_field" },
125
- react.createElement("span", { className: "ap_label" }, props.label),
156
+ React.createElement("span", { className: "ap_label" }, props.label),
126
157
  props.children,
127
- 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
128
159
  );
129
160
  }
130
161
  function TextField(props) {
131
- return react.createElement(Field, { label: props.label, hint: props.hint },
132
- react.createElement("input", {
162
+ return React.createElement(
163
+ Field,
164
+ { label: props.label, hint: props.hint },
165
+ React.createElement("input", {
133
166
  className: "ap_input",
134
167
  value: props.value,
135
168
  onChange: (e) => props.onChange(e.target.value),
@@ -138,8 +171,10 @@ window.__ModuleLoader__.load({
138
171
  );
139
172
  }
140
173
  function BoolField(props) {
141
- return react.createElement(Field, { label: props.label, hint: props.hint },
142
- react.createElement("input", {
174
+ return React.createElement(
175
+ Field,
176
+ { label: props.label, hint: props.hint },
177
+ React.createElement("input", {
143
178
  type: "checkbox",
144
179
  checked: props.value === true,
145
180
  onChange: (e) => props.onChange(e.target.checked),
@@ -157,31 +192,28 @@ window.__ModuleLoader__.load({
157
192
  }
158
193
  for (const [id, fam] of Object.entries(parsed)) {
159
194
  if (fam === null || typeof fam !== "object" || Array.isArray(fam)) {
160
- throw new TypeError("family \"" + id + "\" must be an object");
195
+ throw new TypeError('family "' + id + '" must be an object');
161
196
  }
162
197
  if (fam.enabled !== void 0 && typeof fam.enabled !== "boolean") {
163
- throw new TypeError("family \"" + id + "\".enabled must be a boolean");
198
+ throw new TypeError('family "' + id + '".enabled must be a boolean');
164
199
  }
165
200
  for (const key of ["tools", "keywords"]) {
166
201
  if (fam[key] !== void 0 && !(Array.isArray(fam[key]) && fam[key].every((v) => typeof v === "string"))) {
167
- 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");
168
203
  }
169
204
  }
170
205
  }
171
206
  return parsed;
172
207
  }
173
-
174
- // ── 配置卡片 ─────────────────────────────────────────────────────────
175
208
  function AdaptivePerfCard(props) {
176
209
  const t = props.t;
177
- const [open, setOpen] = react.useState(false);
178
- const [cfg, setCfg] = react.useState(null);
179
- const [draft, setDraft] = react.useState(null);
180
- const [familiesText, setFamiliesText] = react.useState("");
181
- const [saving, setSaving] = react.useState(false);
182
- const [status, setStatus] = react.useState(null);
183
-
184
- 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(() => {
185
217
  let cancelled = false;
186
218
  props.getConfig().then((value) => {
187
219
  if (cancelled) return;
@@ -191,9 +223,10 @@ window.__ModuleLoader__.load({
191
223
  }).catch((error) => {
192
224
  if (!cancelled) setStatus({ kind: "error", text: t("loadFailed") + ": " + (error && error.message || error) });
193
225
  });
194
- return () => { cancelled = true; };
226
+ return () => {
227
+ cancelled = true;
228
+ };
195
229
  }, []);
196
-
197
230
  let familiesInvalid = false;
198
231
  let familiesError = null;
199
232
  if (draft !== null) {
@@ -201,7 +234,7 @@ window.__ModuleLoader__.load({
201
234
  textToFamilies(familiesText);
202
235
  } catch (error) {
203
236
  familiesInvalid = true;
204
- familiesError = error && error.message || String(error);
237
+ familiesError = error?.message ?? String(error);
205
238
  }
206
239
  }
207
240
  const dirty = draft !== null && (JSON.stringify(draft) !== JSON.stringify(cfg) || familiesInvalid === false && familiesToText(draft.families) !== familiesText);
@@ -217,7 +250,7 @@ window.__ModuleLoader__.load({
217
250
  try {
218
251
  next = { ...draft, families: textToFamilies(familiesText) };
219
252
  } catch (error) {
220
- setStatus({ kind: "error", text: t("invalidFamilies") + ": " + (error && error.message || error) });
253
+ setStatus({ kind: "error", text: t("invalidFamilies") + ": " + (error?.message ?? String(error)) });
221
254
  return;
222
255
  }
223
256
  setSaving(true);
@@ -231,11 +264,10 @@ window.__ModuleLoader__.load({
231
264
  setStatus({ kind: "error", text: t("saveFailed") + ": " + (error && error.message || error) });
232
265
  }).finally(() => setSaving(false));
233
266
  };
234
-
235
- return react.createElement(
267
+ return React.createElement(
236
268
  "li",
237
269
  { className: "ap_card", "data-open": open },
238
- react.createElement(
270
+ React.createElement(
239
271
  "button",
240
272
  {
241
273
  className: "ap_header",
@@ -243,140 +275,142 @@ window.__ModuleLoader__.load({
243
275
  onClick: () => setOpen(!open),
244
276
  "aria-expanded": open
245
277
  },
246
- react.createElement("span", { className: "ap_title" }, t("title")),
247
- dirty ? react.createElement("span", { className: "ap_badge" }, t("unsaved")) : null,
248
- 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")
249
281
  ),
250
- open ? react.createElement(
282
+ open ? React.createElement(
251
283
  "div",
252
284
  { className: "ap_body" },
253
- react.createElement("p", { className: "ap_hint" }, t("hint")),
254
- react.createElement(BoolField, {
285
+ React.createElement("p", { className: "ap_hint" }, t("hint")),
286
+ React.createElement(BoolField, {
255
287
  label: t("enabled"),
256
288
  value: draft === null ? true : draft.enabled,
257
289
  disabled: draft === null,
258
290
  onChange: (v) => setDraft({ ...draft, enabled: v })
259
291
  }),
260
- react.createElement(TextField, {
292
+ React.createElement(TextField, {
261
293
  label: t("presets"),
262
294
  hint: t("fieldPresets"),
263
295
  value: draft === null ? "standard, code, cordis" : (draft.presets || []).join(", "),
264
296
  disabled: draft === null,
265
297
  onChange: (v) => setDraft({ ...draft, presets: v.split(/[,,\s]+/).filter((x) => x.length > 0) })
266
298
  }),
267
- react.createElement(BoolField, {
299
+ React.createElement(BoolField, {
268
300
  label: t("suppressRuntimeContext"),
269
301
  hint: t("fieldSuppressRuntimeContext"),
270
302
  value: draft === null ? true : draft.suppressRuntimeContext,
271
303
  disabled: draft === null,
272
304
  onChange: (v) => setDraft({ ...draft, suppressRuntimeContext: v })
273
305
  }),
274
- react.createElement(BoolField, {
306
+ React.createElement(BoolField, {
275
307
  label: t("leanByDefault"),
276
308
  hint: t("fieldLeanByDefault"),
277
309
  value: draft === null ? false : draft.leanByDefault,
278
310
  disabled: draft === null,
279
311
  onChange: (v) => setDraft({ ...draft, leanByDefault: v })
280
312
  }),
281
- react.createElement(BoolField, {
313
+ React.createElement(BoolField, {
282
314
  label: t("escalateOnKeyword"),
283
315
  hint: t("fieldEscalateOnKeyword"),
284
316
  value: draft === null ? true : draft.escalateOnKeyword,
285
317
  disabled: draft === null,
286
318
  onChange: (v) => setDraft({ ...draft, escalateOnKeyword: v })
287
319
  }),
288
- react.createElement(BoolField, {
320
+ React.createElement(BoolField, {
289
321
  label: t("escalateOnUnknownTool"),
290
322
  hint: t("fieldEscalateOnUnknownTool"),
291
323
  value: draft === null ? true : draft.escalateOnUnknownTool,
292
324
  disabled: draft === null,
293
325
  onChange: (v) => setDraft({ ...draft, escalateOnUnknownTool: v })
294
326
  }),
295
- react.createElement(BoolField, {
327
+ React.createElement(BoolField, {
296
328
  label: t("suppressInjectedContext"),
297
329
  hint: t("fieldSuppressInjectedContext"),
298
330
  value: draft === null ? false : draft.suppressInjectedContext,
299
331
  disabled: draft === null,
300
332
  onChange: (v) => setDraft({ ...draft, suppressInjectedContext: v })
301
333
  }),
302
- react.createElement(BoolField, {
334
+ React.createElement(BoolField, {
303
335
  label: t("bootstrapEnabled"),
304
336
  hint: t("fieldBootstrapEnabled"),
305
337
  value: draft === null ? true : !!draft.bootstrap && draft.bootstrap.enabled,
306
338
  disabled: draft === null,
307
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), enabled: v } })
339
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, enabled: v } })
308
340
  }),
309
- react.createElement(BoolField, {
341
+ React.createElement(BoolField, {
310
342
  label: t("bootstrapRealPair"),
311
343
  hint: t("fieldBootstrapRealPair"),
312
344
  value: draft === null ? true : !!draft.bootstrap && draft.bootstrap.realPair,
313
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
314
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), realPair: v } })
345
+ disabled: draft === null || draft.bootstrap && draft.bootstrap.enabled === false,
346
+ onChange: (v) => setDraft({ ...draft, bootstrap: { ...draft.bootstrap || {}, realPair: v } })
315
347
  }),
316
- react.createElement(TextField, {
348
+ React.createElement(TextField, {
317
349
  label: t("bootstrapTools"),
318
350
  hint: t("fieldBootstrapTools"),
319
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.tools) || []).join(", "),
320
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
321
- 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) } })
322
354
  }),
323
- react.createElement(TextField, {
355
+ React.createElement(TextField, {
324
356
  label: t("bootstrapPromoteOn"),
325
357
  hint: t("fieldBootstrapPromoteOn"),
326
- value: draft === null ? "" : (draft.bootstrap && draft.bootstrap.promoteOn) || "either",
327
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
328
- 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" } })
329
361
  }),
330
- react.createElement(TextField, {
362
+ React.createElement(TextField, {
331
363
  label: t("bootstrapSuppressed"),
332
364
  hint: t("fieldBootstrapSuppressed"),
333
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.suppressedContextSources) || []).join(", "),
334
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
335
- 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) } })
336
368
  }),
337
- react.createElement(TextField, {
369
+ React.createElement(TextField, {
338
370
  label: t("bootstrapDiscovery"),
339
371
  hint: t("fieldBootstrapDiscovery"),
340
- value: draft === null ? "" : ((draft.bootstrap && draft.bootstrap.discoveryTools) || []).join(", "),
341
- disabled: draft === null || (draft.bootstrap && draft.bootstrap.enabled === false),
342
- onChange: (v) => setDraft({ ...draft, bootstrap: { ...(draft.bootstrap || {}), discoveryTools: v.split(/[,,\s]+/).filter((x) => x.length > 0) } })
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) } })
343
375
  }),
344
- react.createElement(TextField, {
376
+ React.createElement(TextField, {
345
377
  label: t("bootstrapMaxTokens"),
346
378
  hint: t("fieldBootstrapMaxTokens"),
347
- value: draft === null ? "" : String((draft.bootstrap && draft.bootstrap.maxTokens) || 0),
348
- 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,
349
381
  onChange: (v) => {
350
382
  const n = Number(v.trim());
351
- 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 } });
352
384
  }
353
385
  }),
354
- react.createElement(BoolField, {
386
+ React.createElement(BoolField, {
355
387
  label: t("minimalPromptEnabled"),
356
388
  hint: t("fieldMinimalPromptEnabled"),
357
- value: draft === null ? true : (draft.minimalPrompt && draft.minimalPrompt.enabled === true),
389
+ value: draft === null ? true : draft.minimalPrompt && draft.minimalPrompt.enabled === true,
358
390
  disabled: draft === null,
359
- onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...(draft.minimalPrompt || {}), enabled: v } })
391
+ onChange: (v) => setDraft({ ...draft, minimalPrompt: { ...draft.minimalPrompt || {}, enabled: v } })
360
392
  }),
361
- react.createElement(BoolField, {
393
+ React.createElement(BoolField, {
362
394
  label: t("minimalPromptSuppressSections"),
363
395
  hint: t("fieldMinimalPromptSuppressSections"),
364
- value: draft === null ? true : (draft.minimalPrompt && draft.minimalPrompt.suppressSections === true),
365
- disabled: draft === null || (draft.minimalPrompt && draft.minimalPrompt.enabled === false),
366
- 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 } })
367
399
  }),
368
- react.createElement(TextField, {
400
+ React.createElement(TextField, {
369
401
  label: t("minimalPromptPersona"),
370
402
  hint: t("fieldMinimalPromptPersona"),
371
- value: draft === null ? "" : ((draft.minimalPrompt && draft.minimalPrompt.persona) || ""),
372
- disabled: draft === null || (draft.minimalPrompt && draft.minimalPrompt.enabled === false),
373
- 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 } })
374
406
  }),
375
- react.createElement(Field, {
376
- label: t("families"),
377
- hint: familiesInvalid ? t("invalidFamilies") + (familiesError !== null ? " — " + familiesError : "") : t("fieldFamilies")
378
- },
379
- 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", {
380
414
  className: "ap_textarea",
381
415
  value: familiesText,
382
416
  disabled: draft === null,
@@ -384,26 +418,28 @@ window.__ModuleLoader__.load({
384
418
  onChange: (e) => setFamiliesText(e.target.value)
385
419
  })
386
420
  ),
387
- react.createElement(Field, {
388
- label: t("coreTools"),
389
- hint: t("fieldCoreTools")
390
- },
391
- 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(", "))
392
428
  ),
393
- react.createElement(
429
+ React.createElement(
394
430
  "div",
395
431
  { className: "ap_footer" },
396
- react.createElement(
432
+ React.createElement(
397
433
  "span",
398
434
  { className: "ap_status" + (status !== null && status.kind === "error" ? " ap_error" : ""), role: "status" },
399
435
  status !== null ? status.text : ""
400
436
  ),
401
- react.createElement(
437
+ React.createElement(
402
438
  "button",
403
439
  { className: "ap_discard", type: "button", disabled: saving || draft === null || !dirty, onClick: discard },
404
440
  t("discard")
405
441
  ),
406
- react.createElement(
442
+ React.createElement(
407
443
  "button",
408
444
  { className: "ap_save", type: "button", disabled: saving || draft === null || invalid || !dirty, onClick: save },
409
445
  saving ? t("saving") : t("save")
@@ -412,16 +448,9 @@ window.__ModuleLoader__.load({
412
448
  ) : null
413
449
  );
414
450
  }
415
-
416
- // ── 插件 apply ───────────────────────────────────────────────────────
417
- // DSH 客户端的 remote.<ns> 服务不会自动生成:必须由客户端代码用
418
- // ctx.remote.$mount(contribution) 显式挂载(官方 dsh-api-remotes 即如此)。
419
- // 若只把 remote.adaptivePerfConfig 写进 inject 而不挂载,命名空间永远
420
- // 不存在,客户端插件会一直 pending,web boot 报 "did not activate"。
421
- // 因此本插件先挂载自己的命名空间,再注册设置卡片。
422
- const inject = ["slots", "locale", "remote"];
423
- const passthroughSchema = { parse: (value) => value };
424
- const REMOTE_CONTRIBUTION = {
451
+ var inject = ["slots", "locale", "remote"];
452
+ var passthroughSchema = { parse: (value) => value };
453
+ var REMOTE_CONTRIBUTION = {
425
454
  package: "@chaoset/adaptive-perf",
426
455
  descriptors: [
427
456
  {
@@ -452,9 +481,6 @@ window.__ModuleLoader__.load({
452
481
  async function apply(ctx) {
453
482
  const t = ctx.locale.bind(NS);
454
483
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "adaptive-perf: dictionaries");
455
- // 先挂载命名空间,再用 ctx.get 取回服务:cordis 的属性访问(ctx.remote.X)
456
- // 要求 X 出现在 inject 里,而本插件的命名空间由自己挂载,若写进 inject
457
- // 会和自己等待的服务形成死锁,因此用 ctx.get(对未声明的服务合法)。
458
484
  await ctx.remote.$mount(REMOTE_CONTRIBUTION);
459
485
  const configService = ctx.get("remote.adaptivePerfConfig");
460
486
  if (configService === void 0) throw new Error("adaptive-perf: remote.adaptivePerfConfig did not materialize after mount");
@@ -478,8 +504,6 @@ window.__ModuleLoader__.load({
478
504
  }, AdaptivePerfCard));
479
505
  }
480
506
 
481
- exports.apply = apply;
482
- exports.inject = inject;
483
507
  return module.exports;
484
508
  }
485
509
  });