dsh-perm-gate 5.7.2 → 5.7.3

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/lib/client.js CHANGED
@@ -6,7 +6,7 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
- // src/client/locales.ts
9
+ //#region src/client/locales.ts
10
10
  /** `dsh-perm-gate` client dictionaries (zh / en / ja / ko / fr / de / it / ru / es / pt). */
11
11
  /** Dictionary namespace owned by this plugin. */
12
12
  const NS = "dsh-perm-gate";
@@ -2514,7 +2514,8 @@ window.__ModuleLoader__.load({
2514
2514
  "card.scopeUnresolved": " (scope não resolvido — espaço de diagnóstico)"
2515
2515
  }
2516
2516
  };
2517
- // src/client/switch-state.ts
2517
+ //#endregion
2518
+ //#region src/client/switch-state.ts
2518
2519
  /**
2519
2520
  * The optimistic state machine behind the settings card's pill switch and its tier
2520
2521
  * picker, kept out of the components so its three rules are testable without a DOM
@@ -2549,7 +2550,8 @@ window.__ModuleLoader__.load({
2549
2550
  function pendingAfterFailure(_pending) {
2550
2551
  return null;
2551
2552
  }
2552
- // src/deny-defaults.ts
2553
+ //#endregion
2554
+ //#region src/deny-defaults.ts
2553
2555
  /**
2554
2556
  * Preset deny keywords inherited from dsh-approval-gate's `DEFAULT_DENY_KEYWORDS`
2555
2557
  * (the preset blacklist layer of its pipeline). One keyword per entry, matched
@@ -2592,7 +2594,8 @@ window.__ModuleLoader__.load({
2592
2594
  "docker rm",
2593
2595
  "docker system prune"
2594
2596
  ];
2595
- // src/llm-presets.ts
2597
+ //#endregion
2598
+ //#region src/llm-presets.ts
2596
2599
  const LLM_PRESETS = [
2597
2600
  {
2598
2601
  id: "deepseek",
@@ -2613,7 +2616,8 @@ window.__ModuleLoader__.load({
2613
2616
  model: "gpt-4o-mini"
2614
2617
  }
2615
2618
  ];
2616
- // src/preset.ts
2619
+ //#endregion
2620
+ //#region src/preset.ts
2617
2621
  /**
2618
2622
  * Presets in which the gate is active. The plugin ships five 自动审查 tiers of its own
2619
2623
  * (declared in its `cordis.patch.yml`, which is how they reach the composer picker at all):
@@ -2634,7 +2638,8 @@ window.__ModuleLoader__.load({
2634
2638
  "permissive-snet",
2635
2639
  "permissive-yolo"
2636
2640
  ];
2637
- // src/client/sediment.tsx
2641
+ //#endregion
2642
+ //#region src/client/sediment.tsx
2638
2643
  /**
2639
2644
  * Learning-sediment management section — the settings-card face of verdict
2640
2645
  * learning's "沉淀" (the ⑤ card pattern demonstrated by dsh-approval-gate):
@@ -2799,7 +2804,8 @@ window.__ModuleLoader__.load({
2799
2804
  })
2800
2805
  });
2801
2806
  }
2802
- // src/client/guide.tsx
2807
+ //#endregion
2808
+ //#region src/client/guide.tsx
2803
2809
  /**
2804
2810
  * ⚠️ 生成副本 —— 请勿手改。真源:mine-dsh-plugins/_tools/guide-kit/guide.tsx
2805
2811
  * 重新同步:node _tools/guide-kit/sync.mjs
@@ -3142,7 +3148,8 @@ window.__ModuleLoader__.load({
3142
3148
  children: guideLabels().restart
3143
3149
  });
3144
3150
  }
3145
- // src/client/guide-steps.ts
3151
+ //#endregion
3152
+ //#region src/client/guide-steps.ts
3146
3153
  const PERM_GATE_GUIDE_STEPS = {
3147
3154
  zh: [
3148
3155
  {
@@ -3181,7 +3188,218 @@ window.__ModuleLoader__.load({
3181
3188
  }
3182
3189
  ]
3183
3190
  };
3184
- // src/client/card.tsx
3191
+ //#endregion
3192
+ //#region src/client/star-row-copy.ts
3193
+ /**
3194
+ * star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
3195
+ *
3196
+ * 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
3197
+ * 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
3198
+ *
3199
+ * 契约(对齐 panel-star-row spec):
3200
+ * - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
3201
+ * - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
3202
+ * - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
3203
+ * (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
3204
+ * 避免逐仓动字典文件;
3205
+ * - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
3206
+ * - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
3207
+ * (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
3208
+ *
3209
+ * 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
3210
+ */
3211
+ /** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
3212
+ const REPO_URL = "https://github.com/drscrewdriver/dsh-perm-gate";
3213
+ const STAR_NS = "perm-gate";
3214
+ /** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
3215
+ const STAR_COPY = {
3216
+ zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
3217
+ en: { ask: "Finding it handy? A star helps more people discover this tool" },
3218
+ ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
3219
+ ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
3220
+ fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
3221
+ de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
3222
+ it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
3223
+ ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
3224
+ es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
3225
+ pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" }
3226
+ };
3227
+ const STAR_LANGS = [
3228
+ "zh",
3229
+ "en",
3230
+ "ja",
3231
+ "ko",
3232
+ "fr",
3233
+ "de",
3234
+ "it",
3235
+ "ru",
3236
+ "es",
3237
+ "pt"
3238
+ ];
3239
+ /** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
3240
+ const GITHUB_MARK_PATH = "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332 -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
3241
+ const STYLE_ID = "dsh-star-row-style";
3242
+ const STYLE_CSS = [
3243
+ ".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
3244
+ "line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
3245
+ "margin-top:6px;min-width:0;flex-wrap:wrap}",
3246
+ ".dsh-star-row:hover{opacity:1;text-decoration:underline}",
3247
+ ".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
3248
+ ".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}"
3249
+ ].join("");
3250
+ const STAR_CTA = {
3251
+ zh: "留颗 Star",
3252
+ en: "Star",
3253
+ ja: "スター",
3254
+ ko: "스타",
3255
+ fr: "Star",
3256
+ de: "Stern",
3257
+ it: "Stella",
3258
+ ru: "Звезда",
3259
+ es: "Estrella",
3260
+ pt: "Estrela"
3261
+ };
3262
+ /** 隐藏钮的可读名(★ 之外的独立动作,10 语同集)。 */
3263
+ const STAR_HIDE = {
3264
+ zh: "不再提示",
3265
+ en: "Dismiss",
3266
+ ja: "今後表示しない",
3267
+ ko: "다시 보지 않기",
3268
+ fr: "Masquer",
3269
+ de: "Ausblenden",
3270
+ it: "Nascondi",
3271
+ ru: "Скрыть",
3272
+ es: "Ocultar",
3273
+ pt: "Ocultar"
3274
+ };
3275
+ const STAR_S_STYLE_ID = "dsh-star-row-s-style";
3276
+ const STAR_S_STYLE = [
3277
+ ".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
3278
+ "font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
3279
+ "padding-top:8px;border-top:1px solid var(--dsw-alias-border-l2,currentColor)}",
3280
+ ".dsh-star-row-s:hover{opacity:1}",
3281
+ ".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
3282
+ "color:inherit;text-decoration:none}",
3283
+ ".dsh-star-link:hover{text-decoration:underline}",
3284
+ ".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
3285
+ ".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
3286
+ ".dsh-star-cta,.dsh-star-hide{font:inherit;font-size:11px;line-height:1;",
3287
+ "padding:4px 9px;border-radius:999px;border:1px solid currentColor;",
3288
+ "background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.7}",
3289
+ ".dsh-star-hide{padding:4px 7px}",
3290
+ ".dsh-star-cta:hover,.dsh-star-hide:hover{opacity:1}"
3291
+ ].join("");
3292
+ /** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
3293
+ function starLang() {
3294
+ const low = (typeof document !== "undefined" && document.documentElement.lang || "").toLowerCase();
3295
+ for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
3296
+ return "en";
3297
+ }
3298
+ /** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
3299
+ function starDismissed() {
3300
+ try {
3301
+ return localStorage.getItem("dsh.star.perm-gate.dismissed") === "1";
3302
+ } catch {
3303
+ return false;
3304
+ }
3305
+ }
3306
+ /** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
3307
+ function starDismiss() {
3308
+ try {
3309
+ localStorage.setItem("dsh.star.perm-gate.dismissed", "1");
3310
+ } catch {}
3311
+ }
3312
+ /** 一次性注入 S 档样式。 */
3313
+ function injectStarSStyle(d) {
3314
+ if (d.getElementById(STAR_S_STYLE_ID)) return;
3315
+ const style = d.createElement("style");
3316
+ style.id = STAR_S_STYLE_ID;
3317
+ style.textContent = STAR_S_STYLE;
3318
+ d.head.appendChild(style);
3319
+ }
3320
+ /** 打开仓库页:桌面壳里 window.open 可能被拦,锚点 click 才是两条路径都通的写法。 */
3321
+ function openRepo(d) {
3322
+ const a = d.createElement("a");
3323
+ a.href = REPO_URL;
3324
+ a.target = "_blank";
3325
+ a.rel = "noopener noreferrer";
3326
+ a.click();
3327
+ }
3328
+ /** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA | × 隐藏」,非 S 档返回 null 走原路径。 */
3329
+ function extendedStarRow(link, d) {
3330
+ if (starDismissed()) return link;
3331
+ injectStarSStyle(d);
3332
+ link.className = "dsh-star-link";
3333
+ const lang = starLang();
3334
+ const row = d.createElement("div");
3335
+ row.className = "dsh-star-row-s";
3336
+ row.appendChild(link);
3337
+ const ask = d.createElement("span");
3338
+ ask.className = "dsh-star-ask";
3339
+ ask.textContent = STAR_COPY[lang].ask;
3340
+ row.appendChild(ask);
3341
+ const cta = d.createElement("button");
3342
+ cta.type = "button";
3343
+ cta.className = "dsh-star-cta";
3344
+ cta.textContent = "★ " + STAR_CTA[lang];
3345
+ cta.addEventListener("click", (event) => {
3346
+ event.preventDefault();
3347
+ event.stopPropagation();
3348
+ openRepo(d);
3349
+ });
3350
+ row.appendChild(cta);
3351
+ const hide = d.createElement("button");
3352
+ hide.type = "button";
3353
+ hide.className = "dsh-star-hide";
3354
+ hide.textContent = "×";
3355
+ hide.title = STAR_HIDE[lang];
3356
+ hide.setAttribute("aria-label", STAR_HIDE[lang]);
3357
+ hide.addEventListener("click", (event) => {
3358
+ event.preventDefault();
3359
+ event.stopPropagation();
3360
+ starDismiss();
3361
+ if (row.parentNode) {
3362
+ row.parentNode.replaceChild(link, row);
3363
+ link.className = "dsh-star-row";
3364
+ }
3365
+ });
3366
+ row.appendChild(hide);
3367
+ return row;
3368
+ }
3369
+ /** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
3370
+ function mountStarRow(doc) {
3371
+ const d = doc ?? document;
3372
+ if (!d.getElementById(STYLE_ID)) {
3373
+ const tag = d.createElement("style");
3374
+ tag.id = STYLE_ID;
3375
+ tag.textContent = STYLE_CSS;
3376
+ d.head.appendChild(tag);
3377
+ }
3378
+ const match = REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/);
3379
+ const repo = match ? match[1] : "drscrewdriver";
3380
+ const a = d.createElement("a");
3381
+ a.className = "dsh-star-row";
3382
+ a.href = REPO_URL;
3383
+ a.target = "_blank";
3384
+ a.rel = "noreferrer";
3385
+ a.dataset.starNs = STAR_NS;
3386
+ const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
3387
+ svg.setAttribute("viewBox", "0 0 24 24");
3388
+ svg.setAttribute("aria-hidden", "true");
3389
+ const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
3390
+ path.setAttribute("fill", "currentColor");
3391
+ path.setAttribute("d", GITHUB_MARK_PATH);
3392
+ svg.appendChild(path);
3393
+ a.appendChild(svg);
3394
+ const label = d.createElement("span");
3395
+ label.textContent = repo;
3396
+ a.appendChild(label);
3397
+ const row = extendedStarRow(a, d);
3398
+ if (row) return row;
3399
+ return a;
3400
+ }
3401
+ //#endregion
3402
+ //#region src/client/card.tsx
3185
3403
  /**
3186
3404
  * Permissive settings card — the top-level `settings.section` (自动审查门) of dsh-perm-gate.
3187
3405
  *
@@ -4021,1476 +4239,1483 @@ window.__ModuleLoader__.load({
4021
4239
  borderRadius: "12px",
4022
4240
  transition: "border-color 0.16s, background 0.16s"
4023
4241
  },
4024
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4025
- type: "button",
4026
- "aria-expanded": open,
4027
- style: {
4028
- appearance: "none",
4029
- width: "100%",
4030
- font: "inherit",
4031
- color: "inherit",
4032
- textAlign: "left",
4033
- cursor: "pointer",
4034
- background: "none",
4035
- border: 0,
4036
- borderRadius: "12px",
4037
- display: "flex",
4038
- alignItems: "center",
4039
- gap: "12px",
4040
- padding: "14px 16px"
4041
- },
4042
- onClick: () => {
4043
- setOpen((current) => !current);
4044
- },
4045
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4242
+ children: [
4243
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4244
+ type: "button",
4245
+ "aria-expanded": open,
4046
4246
  style: {
4047
- flex: "1 1 0%",
4048
- minWidth: 0
4247
+ appearance: "none",
4248
+ width: "100%",
4249
+ font: "inherit",
4250
+ color: "inherit",
4251
+ textAlign: "left",
4252
+ cursor: "pointer",
4253
+ background: "none",
4254
+ border: 0,
4255
+ borderRadius: "12px",
4256
+ display: "flex",
4257
+ alignItems: "center",
4258
+ gap: "12px",
4259
+ padding: "14px 16px"
4049
4260
  },
4050
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4261
+ onClick: () => {
4262
+ setOpen((current) => !current);
4263
+ },
4264
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4051
4265
  style: {
4052
- fontSize: "14px",
4053
- fontWeight: 600,
4054
- color: "var(--dsw-alias-label-primary)"
4266
+ flex: "1 1 0%",
4267
+ minWidth: 0
4055
4268
  },
4056
- children: t("card.title")
4057
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4269
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4270
+ style: {
4271
+ fontSize: "14px",
4272
+ fontWeight: 600,
4273
+ color: "var(--dsw-alias-label-primary)"
4274
+ },
4275
+ children: t("card.title")
4276
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4277
+ style: {
4278
+ color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
4279
+ fontSize: "13px",
4280
+ lineHeight: 1.5
4281
+ },
4282
+ children: t("card.description")
4283
+ })]
4284
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
4285
+ width: "16",
4286
+ height: "16",
4287
+ viewBox: "0 0 16 16",
4288
+ "aria-hidden": true,
4058
4289
  style: {
4059
4290
  color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
4060
- fontSize: "13px",
4061
- lineHeight: 1.5
4291
+ flex: "0 0 auto",
4292
+ transition: "transform 0.16s",
4293
+ transform: open ? "rotate(180deg)" : "none"
4062
4294
  },
4063
- children: t("card.description")
4064
- })]
4065
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
4066
- width: "16",
4067
- height: "16",
4068
- viewBox: "0 0 16 16",
4069
- "aria-hidden": true,
4070
- style: {
4071
- color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
4072
- flex: "0 0 auto",
4073
- transition: "transform 0.16s",
4074
- transform: open ? "rotate(180deg)" : "none"
4075
- },
4076
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
4077
- d: "M4 6l4 4 4-4",
4078
- fill: "none",
4079
- stroke: "currentColor",
4080
- strokeWidth: "1.5",
4081
- strokeLinecap: "round",
4082
- strokeLinejoin: "round"
4083
- })
4084
- })]
4085
- }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4086
- style: { padding: "12px 16px" },
4087
- children: unavailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4088
- style: {
4089
- fontSize: "13px",
4090
- color: "var(--dsw-alias-label-tertiary)"
4091
- },
4092
- children: t("card.unavailable")
4093
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4094
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: switchCss }),
4095
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4096
- style: { margin: "0 0 10px" },
4097
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuideRestartButton, {
4098
- ns: "perm-gate",
4099
- onOpen: () => {
4100
- setGuideOpen(true);
4101
- }
4295
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
4296
+ d: "M4 6l4 4 4-4",
4297
+ fill: "none",
4298
+ stroke: "currentColor",
4299
+ strokeWidth: "1.5",
4300
+ strokeLinecap: "round",
4301
+ strokeLinejoin: "round"
4102
4302
  })
4103
- }),
4104
- guideOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuidePanel, {
4105
- ns: "perm-gate",
4106
- steps: guideSteps(PERM_GATE_GUIDE_STEPS),
4107
- onClose: () => {
4108
- setGuideOpen(false);
4109
- }
4110
- }) : null,
4111
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4112
- style: rowStyle,
4113
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4114
- htmlFor: "plugin-config-perm-gate-permissive",
4115
- style: labelStyle,
4116
- children: t("card.permissive")
4117
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4118
- id: "plugin-config-perm-gate-permissive",
4119
- checked: effective,
4120
- disabled: readonly,
4121
- onCommit: (next) => scope.set("permissive", next)
4122
- })]
4123
- }),
4124
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4125
- style: hintStyle,
4126
- children: t("card.permissiveHint")
4127
- }),
4128
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4129
- style: hintStyle,
4130
- children: t("card.scopeNote").replace("%scope", gateScope.join(" / "))
4131
- }),
4132
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4303
+ })]
4304
+ }),
4305
+ open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4306
+ style: { padding: "12px 16px" },
4307
+ children: unavailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4133
4308
  style: {
4134
- display: "flex",
4135
- flexDirection: "column",
4136
- gap: "10px",
4137
- marginTop: "12px"
4309
+ fontSize: "13px",
4310
+ color: "var(--dsw-alias-label-tertiary)"
4138
4311
  },
4139
- children: [
4140
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4141
- id: "pg-drawer-unattended",
4142
- title: t("card.unattended"),
4143
- summary: tiersSummary,
4144
- children: [
4145
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4146
- style: hintStyle,
4147
- children: t("card.unattendedHint")
4148
- }),
4149
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4150
- id: "plugin-config-perm-gate-yolo",
4151
- label: t("card.yolo"),
4152
- preset: "permissive-yolo",
4153
- checked: value.yolo === true,
4154
- disabled: readonly,
4155
- hint: t("card.yoloHint"),
4156
- onCommit: (next) => scope.set("yolo", next)
4157
- }),
4158
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4159
- style: rowStyle,
4160
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4161
- htmlFor: "plugin-config-perm-gate-yolo-exempt",
4162
- style: { fontSize: "12px" },
4163
- children: t("card.yoloExempt")
4164
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4165
- id: "plugin-config-perm-gate-yolo-exempt",
4166
- checked: value.yoloWorkspaceExempt === true,
4167
- disabled: readonly,
4168
- onCommit: (next) => scope.set("yoloWorkspaceExempt", next)
4169
- })]
4170
- }),
4171
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4172
- style: hintStyle,
4173
- children: t("card.yoloExemptHint")
4174
- }),
4175
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4176
- id: "plugin-config-perm-gate-safenet-pass",
4177
- label: t("card.mode.pass"),
4178
- preset: "permissive-mech",
4179
- checked: value.safenetPass !== false,
4180
- disabled: readonly,
4181
- hint: t("card.passHint"),
4182
- onCommit: (next) => scope.set("safenetPass", next)
4183
- }),
4184
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4185
- id: "plugin-config-perm-gate-safenet-ask",
4186
- label: t("card.mode.ask"),
4187
- preset: "permissive-snet",
4188
- checked: value.safenetAsk === true,
4189
- disabled: readonly,
4190
- hint: t("card.askHint"),
4191
- onCommit: (next) => scope.set("safenetAsk", next)
4192
- }),
4193
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4194
- style: rowStyle,
4195
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4196
- htmlFor: "plugin-config-perm-gate-rules-fallback",
4197
- style: { fontSize: "12px" },
4198
- children: t("card.rulesFallback")
4199
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4200
- id: "plugin-config-perm-gate-rules-fallback",
4201
- checked: value.rulesFallback === true,
4312
+ children: t("card.unavailable")
4313
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4314
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: switchCss }),
4315
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4316
+ style: { margin: "0 0 10px" },
4317
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuideRestartButton, {
4318
+ ns: "perm-gate",
4319
+ onOpen: () => {
4320
+ setGuideOpen(true);
4321
+ }
4322
+ })
4323
+ }),
4324
+ guideOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GuidePanel, {
4325
+ ns: "perm-gate",
4326
+ steps: guideSteps(PERM_GATE_GUIDE_STEPS),
4327
+ onClose: () => {
4328
+ setGuideOpen(false);
4329
+ }
4330
+ }) : null,
4331
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4332
+ style: rowStyle,
4333
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4334
+ htmlFor: "plugin-config-perm-gate-permissive",
4335
+ style: labelStyle,
4336
+ children: t("card.permissive")
4337
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4338
+ id: "plugin-config-perm-gate-permissive",
4339
+ checked: effective,
4340
+ disabled: readonly,
4341
+ onCommit: (next) => scope.set("permissive", next)
4342
+ })]
4343
+ }),
4344
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4345
+ style: hintStyle,
4346
+ children: t("card.permissiveHint")
4347
+ }),
4348
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4349
+ style: hintStyle,
4350
+ children: t("card.scopeNote").replace("%scope", gateScope.join(" / "))
4351
+ }),
4352
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4353
+ style: {
4354
+ display: "flex",
4355
+ flexDirection: "column",
4356
+ gap: "10px",
4357
+ marginTop: "12px"
4358
+ },
4359
+ children: [
4360
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4361
+ id: "pg-drawer-unattended",
4362
+ title: t("card.unattended"),
4363
+ summary: tiersSummary,
4364
+ children: [
4365
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4366
+ style: hintStyle,
4367
+ children: t("card.unattendedHint")
4368
+ }),
4369
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4370
+ id: "plugin-config-perm-gate-yolo",
4371
+ label: t("card.yolo"),
4372
+ preset: "permissive-yolo",
4373
+ checked: value.yolo === true,
4202
4374
  disabled: readonly,
4203
- onCommit: (next) => scope.set("rulesFallback", next)
4204
- })]
4205
- }),
4206
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4207
- style: hintStyle,
4208
- children: t("card.rulesFallbackHint")
4209
- }),
4210
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4211
- style: rowStyle,
4212
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4213
- htmlFor: "plugin-config-perm-gate-allow-protected-push",
4214
- style: { fontSize: "12px" },
4215
- children: t("card.allowProtectedBranchPush")
4216
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4217
- id: "plugin-config-perm-gate-allow-protected-push",
4218
- checked: value.allowProtectedBranchPush === true,
4375
+ hint: t("card.yoloHint"),
4376
+ onCommit: (next) => scope.set("yolo", next)
4377
+ }),
4378
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4379
+ style: rowStyle,
4380
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4381
+ htmlFor: "plugin-config-perm-gate-yolo-exempt",
4382
+ style: { fontSize: "12px" },
4383
+ children: t("card.yoloExempt")
4384
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4385
+ id: "plugin-config-perm-gate-yolo-exempt",
4386
+ checked: value.yoloWorkspaceExempt === true,
4387
+ disabled: readonly,
4388
+ onCommit: (next) => scope.set("yoloWorkspaceExempt", next)
4389
+ })]
4390
+ }),
4391
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4392
+ style: hintStyle,
4393
+ children: t("card.yoloExemptHint")
4394
+ }),
4395
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4396
+ id: "plugin-config-perm-gate-safenet-pass",
4397
+ label: t("card.mode.pass"),
4398
+ preset: "permissive-mech",
4399
+ checked: value.safenetPass !== false,
4219
4400
  disabled: readonly,
4220
- onCommit: (next) => scope.set("allowProtectedBranchPush", next)
4221
- })]
4222
- }),
4223
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4224
- style: hintStyle,
4225
- children: t("card.allowProtectedBranchPushHint")
4226
- }),
4227
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4228
- style: rowStyle,
4229
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4230
- htmlFor: "plugin-config-perm-gate-script-review",
4231
- style: { fontSize: "12px" },
4232
- children: t("card.scriptReview")
4233
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4234
- id: "plugin-config-perm-gate-script-review",
4235
- checked: value.scriptReview !== false,
4401
+ hint: t("card.passHint"),
4402
+ onCommit: (next) => scope.set("safenetPass", next)
4403
+ }),
4404
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TierRow, {
4405
+ id: "plugin-config-perm-gate-safenet-ask",
4406
+ label: t("card.mode.ask"),
4407
+ preset: "permissive-snet",
4408
+ checked: value.safenetAsk === true,
4236
4409
  disabled: readonly,
4237
- onCommit: (next) => scope.set("scriptReview", next)
4238
- })]
4239
- }),
4240
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4241
- style: hintStyle,
4242
- children: t("card.scriptReviewHint")
4243
- })
4244
- ]
4245
- }),
4246
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4247
- id: "pg-drawer-strategies",
4248
- title: t("card.strategies"),
4249
- summary: strategiesSummary,
4250
- children: [
4251
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4252
- style: rowStyle,
4253
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4254
- htmlFor: "plugin-config-perm-gate-trust",
4255
- style: { fontSize: "12px" },
4256
- children: t("card.strategy.trustAutoAllow")
4257
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4258
- id: "plugin-config-perm-gate-trust",
4259
- checked: strategies.trustAutoAllow ?? true,
4260
- disabled: readonly || !effective,
4261
- onCommit: (next) => scope.set("permissiveStrategies", {
4262
- ...strategies,
4263
- trustAutoAllow: next
4264
- })
4265
- })]
4266
- }),
4267
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4268
- style: rowStyle,
4269
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4270
- htmlFor: "plugin-config-perm-gate-confirm",
4271
- style: { fontSize: "12px" },
4272
- children: t("card.strategy.alwaysConfirm")
4273
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4274
- id: "plugin-config-perm-gate-confirm",
4275
- checked: strategies.alwaysConfirm ?? false,
4276
- disabled: readonly || !effective,
4277
- onCommit: (next) => scope.set("permissiveStrategies", {
4278
- ...strategies,
4279
- alwaysConfirm: next
4280
- })
4281
- })]
4282
- }),
4283
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4284
- style: rowStyle,
4285
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4286
- htmlFor: "plugin-config-perm-gate-llm",
4287
- style: { fontSize: "12px" },
4288
- children: t("card.strategy.llmAssist")
4289
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4290
- id: "plugin-config-perm-gate-llm",
4291
- checked: strategies.llmAssist ?? false,
4292
- disabled: readonly || !effective,
4293
- onCommit: (next) => scope.set("permissiveStrategies", {
4294
- ...strategies,
4295
- llmAssist: next
4296
- })
4297
- })]
4298
- }),
4299
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4300
- style: rowStyle,
4301
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4302
- htmlFor: "plugin-config-perm-gate-escalation",
4303
- style: { fontSize: "12px" },
4304
- children: t("card.strategy.trustEscalation")
4305
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4306
- id: "plugin-config-perm-gate-escalation",
4307
- checked: strategies.trustEscalation ?? true,
4308
- disabled: readonly || !effective,
4309
- onCommit: (next) => scope.set("permissiveStrategies", {
4310
- ...strategies,
4311
- trustEscalation: next
4312
- })
4313
- })]
4314
- }),
4315
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4316
- style: hintStyle,
4317
- children: t("card.strategy.trustEscalationHint")
4318
- }),
4319
- strategies.llmAssist === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4320
- style: sectionStyle,
4321
- children: [
4322
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4323
- style: labelStyle,
4324
- children: t("card.llmReceiver")
4325
- }),
4326
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4327
- style: fieldStyle,
4328
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4329
- style: fieldLabelStyle,
4330
- children: t("card.llmSource")
4331
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4332
- value: value.classifierSource ?? "custom",
4333
- disabled: readonly,
4334
- style: controlStyle,
4335
- onChange: (event) => {
4336
- scope.set("classifierSource", event.currentTarget.value);
4337
- },
4338
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4339
- value: "custom",
4340
- children: t("card.llmSourceCustom")
4341
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4342
- value: "host",
4343
- children: t("card.llmSourceHost")
4344
- })]
4345
- })]
4346
- }),
4347
- (value.classifierSource ?? "custom") === "custom" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4348
- style: fieldStyle,
4349
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4350
- style: fieldLabelStyle,
4351
- children: t("card.llmPreset")
4352
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4353
- value: "",
4354
- disabled: readonly,
4355
- style: controlStyle,
4356
- onChange: (event) => {
4357
- const v = event.currentTarget.value;
4358
- if (v.startsWith("host:")) {
4359
- scope.set("classifierSource", "host");
4360
- scope.set("classifierProvider", v.slice(5));
4361
- return;
4362
- }
4363
- const preset = LLM_PRESETS.find((p) => p.id === v);
4364
- if (preset !== void 0) {
4365
- scope.set("classifierEndpoint", preset.endpoint);
4366
- scope.set("classifierModel", preset.model);
4367
- }
4368
- },
4369
- children: [
4370
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4371
- value: "",
4372
- children: t("card.llmPresetChoose")
4373
- }),
4374
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
4375
- label: t("card.llmPresetPublic"),
4376
- children: LLM_PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4377
- value: preset.id,
4378
- children: preset.label
4379
- }, preset.id))
4380
- }),
4381
- (receiverInfo?.providers ?? []).length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
4382
- label: t("card.llmPresetHost"),
4383
- children: (receiverInfo?.providers ?? []).map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4384
- value: `host:${p.id}`,
4385
- children: `${t("card.llmSourceHost")} · ${p.id}`
4386
- }, `host:${p.id}`))
4387
- }) : null
4388
- ]
4389
- })]
4390
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4391
- style: fieldStyle,
4392
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4393
- style: fieldLabelStyle,
4394
- children: t("card.llmEndpoint")
4395
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4396
- type: "text",
4397
- value: value.classifierEndpoint ?? "",
4398
- disabled: readonly,
4399
- placeholder: "https://api.openai.com/v1",
4400
- style: controlStyle,
4401
- onChange: (event) => {
4402
- scope.set("classifierEndpoint", event.currentTarget.value);
4403
- },
4404
- onBlur: (event) => {
4405
- if (event.currentTarget.value.trim() === "") scope.unset("classifierEndpoint");
4406
- }
4407
- })]
4408
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4410
+ hint: t("card.askHint"),
4411
+ onCommit: (next) => scope.set("safenetAsk", next)
4412
+ }),
4413
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4414
+ style: rowStyle,
4415
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4416
+ htmlFor: "plugin-config-perm-gate-rules-fallback",
4417
+ style: { fontSize: "12px" },
4418
+ children: t("card.rulesFallback")
4419
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4420
+ id: "plugin-config-perm-gate-rules-fallback",
4421
+ checked: value.rulesFallback === true,
4422
+ disabled: readonly,
4423
+ onCommit: (next) => scope.set("rulesFallback", next)
4424
+ })]
4425
+ }),
4426
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4427
+ style: hintStyle,
4428
+ children: t("card.rulesFallbackHint")
4429
+ }),
4430
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4431
+ style: rowStyle,
4432
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4433
+ htmlFor: "plugin-config-perm-gate-allow-protected-push",
4434
+ style: { fontSize: "12px" },
4435
+ children: t("card.allowProtectedBranchPush")
4436
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4437
+ id: "plugin-config-perm-gate-allow-protected-push",
4438
+ checked: value.allowProtectedBranchPush === true,
4439
+ disabled: readonly,
4440
+ onCommit: (next) => scope.set("allowProtectedBranchPush", next)
4441
+ })]
4442
+ }),
4443
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4444
+ style: hintStyle,
4445
+ children: t("card.allowProtectedBranchPushHint")
4446
+ }),
4447
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4448
+ style: rowStyle,
4449
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4450
+ htmlFor: "plugin-config-perm-gate-script-review",
4451
+ style: { fontSize: "12px" },
4452
+ children: t("card.scriptReview")
4453
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4454
+ id: "plugin-config-perm-gate-script-review",
4455
+ checked: value.scriptReview !== false,
4456
+ disabled: readonly,
4457
+ onCommit: (next) => scope.set("scriptReview", next)
4458
+ })]
4459
+ }),
4460
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4461
+ style: hintStyle,
4462
+ children: t("card.scriptReviewHint")
4463
+ })
4464
+ ]
4465
+ }),
4466
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4467
+ id: "pg-drawer-strategies",
4468
+ title: t("card.strategies"),
4469
+ summary: strategiesSummary,
4470
+ children: [
4471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4472
+ style: rowStyle,
4473
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4474
+ htmlFor: "plugin-config-perm-gate-trust",
4475
+ style: { fontSize: "12px" },
4476
+ children: t("card.strategy.trustAutoAllow")
4477
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4478
+ id: "plugin-config-perm-gate-trust",
4479
+ checked: strategies.trustAutoAllow ?? true,
4480
+ disabled: readonly || !effective,
4481
+ onCommit: (next) => scope.set("permissiveStrategies", {
4482
+ ...strategies,
4483
+ trustAutoAllow: next
4484
+ })
4485
+ })]
4486
+ }),
4487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4488
+ style: rowStyle,
4489
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4490
+ htmlFor: "plugin-config-perm-gate-confirm",
4491
+ style: { fontSize: "12px" },
4492
+ children: t("card.strategy.alwaysConfirm")
4493
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4494
+ id: "plugin-config-perm-gate-confirm",
4495
+ checked: strategies.alwaysConfirm ?? false,
4496
+ disabled: readonly || !effective,
4497
+ onCommit: (next) => scope.set("permissiveStrategies", {
4498
+ ...strategies,
4499
+ alwaysConfirm: next
4500
+ })
4501
+ })]
4502
+ }),
4503
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4504
+ style: rowStyle,
4505
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4506
+ htmlFor: "plugin-config-perm-gate-llm",
4507
+ style: { fontSize: "12px" },
4508
+ children: t("card.strategy.llmAssist")
4509
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4510
+ id: "plugin-config-perm-gate-llm",
4511
+ checked: strategies.llmAssist ?? false,
4512
+ disabled: readonly || !effective,
4513
+ onCommit: (next) => scope.set("permissiveStrategies", {
4514
+ ...strategies,
4515
+ llmAssist: next
4516
+ })
4517
+ })]
4518
+ }),
4519
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4520
+ style: rowStyle,
4521
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4522
+ htmlFor: "plugin-config-perm-gate-escalation",
4523
+ style: { fontSize: "12px" },
4524
+ children: t("card.strategy.trustEscalation")
4525
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4526
+ id: "plugin-config-perm-gate-escalation",
4527
+ checked: strategies.trustEscalation ?? true,
4528
+ disabled: readonly || !effective,
4529
+ onCommit: (next) => scope.set("permissiveStrategies", {
4530
+ ...strategies,
4531
+ trustEscalation: next
4532
+ })
4533
+ })]
4534
+ }),
4535
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4536
+ style: hintStyle,
4537
+ children: t("card.strategy.trustEscalationHint")
4538
+ }),
4539
+ strategies.llmAssist === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4540
+ style: sectionStyle,
4541
+ children: [
4409
4542
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4410
- style: hintStyle,
4411
- children: t("card.llmSourceHostHint")
4543
+ style: labelStyle,
4544
+ children: t("card.llmReceiver")
4545
+ }),
4546
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4547
+ style: fieldStyle,
4548
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4549
+ style: fieldLabelStyle,
4550
+ children: t("card.llmSource")
4551
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4552
+ value: value.classifierSource ?? "custom",
4553
+ disabled: readonly,
4554
+ style: controlStyle,
4555
+ onChange: (event) => {
4556
+ scope.set("classifierSource", event.currentTarget.value);
4557
+ },
4558
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4559
+ value: "custom",
4560
+ children: t("card.llmSourceCustom")
4561
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4562
+ value: "host",
4563
+ children: t("card.llmSourceHost")
4564
+ })]
4565
+ })]
4412
4566
  }),
4567
+ (value.classifierSource ?? "custom") === "custom" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4568
+ style: fieldStyle,
4569
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4570
+ style: fieldLabelStyle,
4571
+ children: t("card.llmPreset")
4572
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4573
+ value: "",
4574
+ disabled: readonly,
4575
+ style: controlStyle,
4576
+ onChange: (event) => {
4577
+ const v = event.currentTarget.value;
4578
+ if (v.startsWith("host:")) {
4579
+ scope.set("classifierSource", "host");
4580
+ scope.set("classifierProvider", v.slice(5));
4581
+ return;
4582
+ }
4583
+ const preset = LLM_PRESETS.find((p) => p.id === v);
4584
+ if (preset !== void 0) {
4585
+ scope.set("classifierEndpoint", preset.endpoint);
4586
+ scope.set("classifierModel", preset.model);
4587
+ }
4588
+ },
4589
+ children: [
4590
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4591
+ value: "",
4592
+ children: t("card.llmPresetChoose")
4593
+ }),
4594
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
4595
+ label: t("card.llmPresetPublic"),
4596
+ children: LLM_PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4597
+ value: preset.id,
4598
+ children: preset.label
4599
+ }, preset.id))
4600
+ }),
4601
+ (receiverInfo?.providers ?? []).length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
4602
+ label: t("card.llmPresetHost"),
4603
+ children: (receiverInfo?.providers ?? []).map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4604
+ value: `host:${p.id}`,
4605
+ children: `${t("card.llmSourceHost")} · ${p.id}`
4606
+ }, `host:${p.id}`))
4607
+ }) : null
4608
+ ]
4609
+ })]
4610
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4611
+ style: fieldStyle,
4612
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4613
+ style: fieldLabelStyle,
4614
+ children: t("card.llmEndpoint")
4615
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4616
+ type: "text",
4617
+ value: value.classifierEndpoint ?? "",
4618
+ disabled: readonly,
4619
+ placeholder: "https://api.openai.com/v1",
4620
+ style: controlStyle,
4621
+ onChange: (event) => {
4622
+ scope.set("classifierEndpoint", event.currentTarget.value);
4623
+ },
4624
+ onBlur: (event) => {
4625
+ if (event.currentTarget.value.trim() === "") scope.unset("classifierEndpoint");
4626
+ }
4627
+ })]
4628
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4629
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4630
+ style: hintStyle,
4631
+ children: t("card.llmSourceHostHint")
4632
+ }),
4633
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4634
+ style: fieldStyle,
4635
+ children: [
4636
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4637
+ style: fieldLabelStyle,
4638
+ children: t("card.llmProvider")
4639
+ }),
4640
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4641
+ type: "text",
4642
+ list: "perm-gate-provider-options",
4643
+ value: value.classifierProvider ?? "",
4644
+ disabled: readonly,
4645
+ placeholder: t("card.llmProviderPlaceholder"),
4646
+ style: controlStyle,
4647
+ onChange: (event) => {
4648
+ scope.set("classifierProvider", event.currentTarget.value);
4649
+ },
4650
+ onBlur: (event) => {
4651
+ if (event.currentTarget.value.trim() === "") scope.unset("classifierProvider");
4652
+ }
4653
+ }),
4654
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("datalist", {
4655
+ id: "perm-gate-provider-options",
4656
+ children: (receiverInfo?.providers ?? []).map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
4657
+ value: p.id,
4658
+ children: [p.name, p.error !== void 0 ? ` (${p.error})` : ""]
4659
+ }, p.id))
4660
+ })
4661
+ ]
4662
+ }),
4663
+ receiverInfo?.selection !== null && receiverInfo?.selection !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4664
+ style: hintStyle,
4665
+ children: t("card.llmResolved").replace("%p", receiverInfo.selection.provider).replace("%m", receiverInfo.selection.model)
4666
+ }) : null
4667
+ ] }),
4413
4668
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4414
4669
  style: fieldStyle,
4415
4670
  children: [
4416
4671
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4417
4672
  style: fieldLabelStyle,
4418
- children: t("card.llmProvider")
4673
+ children: t("card.llmModel")
4419
4674
  }),
4420
4675
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4421
4676
  type: "text",
4422
- list: "perm-gate-provider-options",
4423
- value: value.classifierProvider ?? "",
4677
+ list: receiverSource === "host" ? "perm-gate-model-options" : void 0,
4678
+ value: value.classifierModel ?? "",
4424
4679
  disabled: readonly,
4425
- placeholder: t("card.llmProviderPlaceholder"),
4680
+ placeholder: receiverSource === "host" ? t("card.llmModelHostPlaceholder") : "deepseek-chat",
4426
4681
  style: controlStyle,
4427
4682
  onChange: (event) => {
4428
- scope.set("classifierProvider", event.currentTarget.value);
4683
+ scope.set("classifierModel", event.currentTarget.value);
4429
4684
  },
4430
4685
  onBlur: (event) => {
4431
- if (event.currentTarget.value.trim() === "") scope.unset("classifierProvider");
4686
+ if (event.currentTarget.value.trim() === "") scope.unset("classifierModel");
4432
4687
  }
4433
4688
  }),
4434
4689
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("datalist", {
4435
- id: "perm-gate-provider-options",
4436
- children: (receiverInfo?.providers ?? []).map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
4437
- value: p.id,
4438
- children: [p.name, p.error !== void 0 ? ` (${p.error})` : ""]
4439
- }, p.id))
4690
+ id: "perm-gate-model-options",
4691
+ children: (receiverInfo?.providers ?? []).filter((p) => receiverProviderDraft === "" || p.id === receiverProviderDraft).flatMap((p) => p.models).map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4692
+ value: m.id,
4693
+ children: m.name
4694
+ }, `${m.id}`))
4440
4695
  })
4441
4696
  ]
4442
4697
  }),
4443
- receiverInfo?.selection !== null && receiverInfo?.selection !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4444
- style: hintStyle,
4445
- children: t("card.llmResolved").replace("%p", receiverInfo.selection.provider).replace("%m", receiverInfo.selection.model)
4446
- }) : null
4447
- ] }),
4448
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4449
- style: fieldStyle,
4450
- children: [
4451
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4452
- style: fieldLabelStyle,
4453
- children: t("card.llmModel")
4454
- }),
4455
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4456
- type: "text",
4457
- list: receiverSource === "host" ? "perm-gate-model-options" : void 0,
4458
- value: value.classifierModel ?? "",
4459
- disabled: readonly,
4460
- placeholder: receiverSource === "host" ? t("card.llmModelHostPlaceholder") : "deepseek-chat",
4698
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4699
+ style: fieldStyle,
4700
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4701
+ style: fieldLabelStyle,
4702
+ children: t("card.llmEffort")
4703
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4704
+ value: value.classifierEffort ?? "",
4705
+ disabled: readonly || receiverSource !== "host",
4461
4706
  style: controlStyle,
4707
+ title: t("card.llmEffortHint"),
4462
4708
  onChange: (event) => {
4463
- scope.set("classifierModel", event.currentTarget.value);
4709
+ scope.set("classifierEffort", event.currentTarget.value);
4464
4710
  },
4465
- onBlur: (event) => {
4466
- if (event.currentTarget.value.trim() === "") scope.unset("classifierModel");
4467
- }
4468
- }),
4469
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("datalist", {
4470
- id: "perm-gate-model-options",
4471
- children: (receiverInfo?.providers ?? []).filter((p) => receiverProviderDraft === "" || p.id === receiverProviderDraft).flatMap((p) => p.models).map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4472
- value: m.id,
4473
- children: m.name
4474
- }, `${m.id}`))
4475
- })
4476
- ]
4477
- }),
4478
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4479
- style: fieldStyle,
4480
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4481
- style: fieldLabelStyle,
4482
- children: t("card.llmEffort")
4483
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
4484
- value: value.classifierEffort ?? "",
4485
- disabled: readonly || receiverSource !== "host",
4486
- style: controlStyle,
4487
- title: t("card.llmEffortHint"),
4488
- onChange: (event) => {
4489
- scope.set("classifierEffort", event.currentTarget.value);
4490
- },
4711
+ children: [
4712
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4713
+ value: "",
4714
+ children: t("card.llmEffortHost")
4715
+ }),
4716
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4717
+ value: "off",
4718
+ children: "off"
4719
+ }),
4720
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4721
+ value: "low",
4722
+ children: "low"
4723
+ }),
4724
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4725
+ value: "medium",
4726
+ children: "medium"
4727
+ }),
4728
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4729
+ value: "high",
4730
+ children: "high"
4731
+ })
4732
+ ]
4733
+ })]
4734
+ }),
4735
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4736
+ style: fieldStyle,
4491
4737
  children: [
4492
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4493
- value: "",
4494
- children: t("card.llmEffortHost")
4495
- }),
4496
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4497
- value: "off",
4498
- children: "off"
4499
- }),
4500
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4501
- value: "low",
4502
- children: "low"
4738
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4739
+ style: fieldLabelStyle,
4740
+ children: t("card.llmKey")
4503
4741
  }),
4504
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4505
- value: "medium",
4506
- children: "medium"
4742
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4743
+ style: {
4744
+ display: "flex",
4745
+ gap: "6px"
4746
+ },
4747
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4748
+ type: "password",
4749
+ autoComplete: "off",
4750
+ spellCheck: false,
4751
+ value: apiKeyDraft,
4752
+ disabled: readonly,
4753
+ placeholder: hasApiKey ? t("card.llmKeyMasked") : t("card.llmKeyHidden"),
4754
+ style: {
4755
+ ...controlStyle,
4756
+ flex: "1 1 0%"
4757
+ },
4758
+ onChange: (event) => setApiKeyDraft(event.currentTarget.value),
4759
+ onBlur: commitApiKey,
4760
+ onKeyDown: (event) => {
4761
+ if (event.key === "Enter") event.currentTarget.blur();
4762
+ }
4763
+ }), hasApiKey ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4764
+ type: "button",
4765
+ disabled: readonly,
4766
+ onClick: clearApiKey,
4767
+ style: controlStyle,
4768
+ children: t("card.llmKeyClear")
4769
+ }) : null]
4507
4770
  }),
4508
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4509
- value: "high",
4510
- children: "high"
4771
+ hasApiKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4772
+ style: hintStyle,
4773
+ children: t("card.llmKeyOverwrite")
4511
4774
  })
4512
4775
  ]
4513
- })]
4514
- }),
4515
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4516
- style: fieldStyle,
4517
- children: [
4518
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4776
+ }),
4777
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4778
+ style: {
4779
+ display: "flex",
4780
+ alignItems: "center",
4781
+ gap: "8px",
4782
+ marginTop: "4px"
4783
+ },
4784
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4785
+ type: "button",
4786
+ disabled: readonly || healthBusy,
4787
+ onClick: () => {
4788
+ setHealthBusy(true);
4789
+ setHealthResult(null);
4790
+ fetch("/api/dsh-perm-gate/health", {
4791
+ method: "POST",
4792
+ headers: { "content-type": "application/json" },
4793
+ body: "{}"
4794
+ }).then(async (r) => {
4795
+ const text = await r.text();
4796
+ if (r.status === 404) throw new Error(t("card.healthStale"));
4797
+ try {
4798
+ return JSON.parse(text);
4799
+ } catch {
4800
+ throw new Error(text.trim().slice(0, 120) !== "" ? text.trim().slice(0, 120) : `HTTP ${r.status}`);
4801
+ }
4802
+ }).then((res) => {
4803
+ setHealthResult(res.ok === true && typeof res.ms === "number" ? t("card.healthOk").replace("%ms", String(res.ms)) + (typeof res.detail === "string" ? ` · ${res.detail}` : "") : t("card.healthFail") + (res.detail ?? res.error ?? "unknown"));
4804
+ setReceiverNonce((n) => n + 1);
4805
+ }).catch((e) => {
4806
+ setHealthResult(t("card.healthFail") + String(e?.message ?? e));
4807
+ }).finally(() => {
4808
+ setHealthBusy(false);
4809
+ });
4810
+ },
4811
+ style: {
4812
+ ...controlStyle,
4813
+ cursor: readonly || healthBusy ? "default" : "pointer"
4814
+ },
4815
+ children: healthBusy ? t("card.healthRunning") : t("card.healthTest")
4816
+ }), healthResult !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4817
+ style: {
4818
+ fontSize: "12px",
4819
+ lineHeight: "18px",
4820
+ color: "var(--dsw-alias-label-secondary, inherit)",
4821
+ overflowWrap: "anywhere"
4822
+ },
4823
+ children: healthResult
4824
+ })]
4825
+ }),
4826
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4827
+ style: rowStyle,
4828
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4829
+ htmlFor: "plugin-config-perm-gate-risk-learning",
4830
+ style: { fontSize: "12px" },
4831
+ children: t("card.riskLearning")
4832
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4833
+ id: "plugin-config-perm-gate-risk-learning",
4834
+ checked: value.riskLearning ?? false,
4835
+ disabled: readonly || !effective,
4836
+ onCommit: (next) => scope.set("riskLearning", next)
4837
+ })]
4838
+ }),
4839
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4840
+ style: hintStyle,
4841
+ children: t("card.riskLearningHint")
4842
+ }),
4843
+ value.riskLearning === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4844
+ style: fieldStyle,
4845
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4519
4846
  style: fieldLabelStyle,
4520
- children: t("card.llmKey")
4847
+ children: t("card.riskThreshold")
4848
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4849
+ id: "plugin-config-perm-gate-risk-threshold",
4850
+ type: "number",
4851
+ min: 1,
4852
+ max: 10,
4853
+ value: value.riskThreshold ?? 3,
4854
+ disabled: readonly || !effective,
4855
+ style: {
4856
+ ...controlStyle,
4857
+ width: "96px"
4858
+ },
4859
+ onChange: (event) => {
4860
+ const n = Number.parseInt(event.currentTarget.value, 10);
4861
+ if (Number.isFinite(n) && n >= 1 && n <= 10) scope.set("riskThreshold", n);
4862
+ }
4863
+ })]
4864
+ }) : null,
4865
+ value.riskLearning === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4867
+ style: rowStyle,
4868
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4869
+ htmlFor: "plugin-config-perm-gate-risk-sediment",
4870
+ style: { fontSize: "12px" },
4871
+ children: t("card.riskSediment")
4872
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4873
+ id: "plugin-config-perm-gate-risk-sediment",
4874
+ checked: value.riskSediment ?? true,
4875
+ disabled: readonly || !effective,
4876
+ onCommit: (next) => scope.set("riskSediment", next)
4877
+ })]
4878
+ }),
4879
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4880
+ style: hintStyle,
4881
+ children: t("card.riskSedimentHint")
4521
4882
  }),
4522
4883
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4884
+ style: sectionStyle,
4885
+ children: [
4886
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4887
+ style: labelStyle,
4888
+ children: t("card.sediment")
4889
+ }),
4890
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4891
+ style: hintStyle,
4892
+ children: t("card.sedimentHint")
4893
+ }),
4894
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SedimentSection, { t })
4895
+ ]
4896
+ })
4897
+ ] }) : null
4898
+ ]
4899
+ }) : null
4900
+ ]
4901
+ }),
4902
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4903
+ id: "pg-drawer-testing",
4904
+ title: t("card.testing"),
4905
+ onFirstOpen: loadRules,
4906
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4907
+ style: sectionStyle,
4908
+ children: [
4909
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4910
+ style: labelStyle,
4911
+ children: t("card.dryRun")
4912
+ }),
4913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4914
+ style: hintStyle,
4915
+ children: t("card.dryRunHint")
4916
+ }),
4917
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4918
+ style: {
4919
+ display: "flex",
4920
+ flexWrap: "wrap",
4921
+ gap: "8px",
4922
+ alignItems: "flex-end",
4923
+ margin: "6px 0"
4924
+ },
4925
+ children: [
4926
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4523
4927
  style: {
4524
4928
  display: "flex",
4525
- gap: "6px"
4929
+ flexDirection: "column",
4930
+ gap: "4px",
4931
+ flex: "0 0 120px"
4526
4932
  },
4527
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4528
- type: "password",
4529
- autoComplete: "off",
4530
- spellCheck: false,
4531
- value: apiKeyDraft,
4933
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4934
+ style: fieldLabelStyle,
4935
+ children: t("card.dryRunTool")
4936
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4937
+ type: "text",
4938
+ value: dryTool,
4532
4939
  disabled: readonly,
4533
- placeholder: hasApiKey ? t("card.llmKeyMasked") : t("card.llmKeyHidden"),
4534
- style: {
4535
- ...controlStyle,
4536
- flex: "1 1 0%"
4940
+ placeholder: "shell",
4941
+ onChange: (e) => {
4942
+ setDryTool(e.target.value);
4537
4943
  },
4538
- onChange: (event) => setApiKeyDraft(event.currentTarget.value),
4539
- onBlur: commitApiKey,
4540
- onKeyDown: (event) => {
4541
- if (event.key === "Enter") event.currentTarget.blur();
4542
- }
4543
- }), hasApiKey ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4544
- type: "button",
4944
+ onKeyDown: (e) => {
4945
+ if (e.key === "Enter") runDryRunTest();
4946
+ },
4947
+ style: controlStyle
4948
+ })]
4949
+ }),
4950
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4951
+ style: {
4952
+ display: "flex",
4953
+ flexDirection: "column",
4954
+ gap: "4px",
4955
+ flex: "1 1 260px",
4956
+ minWidth: 0
4957
+ },
4958
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4959
+ style: fieldLabelStyle,
4960
+ children: t("card.dryRunCommand")
4961
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4962
+ type: "text",
4963
+ value: dryCommand,
4545
4964
  disabled: readonly,
4546
- onClick: clearApiKey,
4547
- style: controlStyle,
4548
- children: t("card.llmKeyClear")
4549
- }) : null]
4965
+ placeholder: t("card.dryRunCommandPlaceholder"),
4966
+ onChange: (e) => {
4967
+ setDryCommand(e.target.value);
4968
+ },
4969
+ onKeyDown: (e) => {
4970
+ if (e.key === "Enter") runDryRunTest();
4971
+ },
4972
+ style: controlStyle
4973
+ })]
4550
4974
  }),
4551
- hasApiKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4552
- style: hintStyle,
4553
- children: t("card.llmKeyOverwrite")
4975
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4976
+ type: "button",
4977
+ disabled: readonly || dryBusy,
4978
+ onClick: runDryRunTest,
4979
+ style: {
4980
+ ...controlStyle,
4981
+ flex: "0 0 auto",
4982
+ cursor: readonly || dryBusy ? "default" : "pointer"
4983
+ },
4984
+ children: dryBusy ? t("card.dryRunRunning") : t("card.dryRunTest")
4554
4985
  })
4555
4986
  ]
4556
4987
  }),
4988
+ dryError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4989
+ style: {
4990
+ ...hintStyle,
4991
+ color: "var(--dsw-alias-label-error, #c0392b)"
4992
+ },
4993
+ children: [t("card.dryRunFail"), dryError]
4994
+ }),
4995
+ dryReport === null ? dryError === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4996
+ style: hintStyle,
4997
+ children: t("card.dryRunEmpty")
4998
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4999
+ style: {
5000
+ display: "flex",
5001
+ flexDirection: "column",
5002
+ gap: "4px",
5003
+ padding: "8px 10px",
5004
+ borderRadius: "6px",
5005
+ border: "1px solid var(--dsw-alias-border-l2)",
5006
+ background: "var(--dsw-alias-bg-surface, transparent)",
5007
+ fontSize: "12px",
5008
+ lineHeight: "18px"
5009
+ },
5010
+ children: [
5011
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5012
+ style: {
5013
+ display: "flex",
5014
+ alignItems: "center",
5015
+ gap: "8px"
5016
+ },
5017
+ children: [
5018
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5019
+ style: fieldLabelStyle,
5020
+ children: t("card.dryRunVerdict")
5021
+ }),
5022
+ (() => {
5023
+ const verdict = dryReport.verdict ?? "ask";
5024
+ const colour = verdict === "deny" ? "var(--dsw-alias-label-error, #c0392b)" : verdict === "allow" ? "var(--dsw-alias-label-success, #2e7d32)" : "var(--dsw-alias-label-warning, #b26a00)";
5025
+ const text = verdict === "deny" ? t("card.dryRunDeny") : verdict === "allow" ? t("card.dryRunAllow") : t("card.dryRunAsk");
5026
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
5027
+ style: { color: colour },
5028
+ children: text
5029
+ });
5030
+ })(),
5031
+ (dryReport.ruleCount ?? 0) === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5032
+ style: { color: "var(--dsw-alias-label-secondary, inherit)" },
5033
+ children: t("card.dryRunNoRules")
5034
+ })
5035
+ ]
5036
+ }),
5037
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5038
+ style: {
5039
+ display: "flex",
5040
+ gap: "8px",
5041
+ overflowWrap: "anywhere"
5042
+ },
5043
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5044
+ style: fieldLabelStyle,
5045
+ children: t("card.dryRunRule")
5046
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5047
+ style: {
5048
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5049
+ color: "var(--dsw-alias-label-primary)"
5050
+ },
5051
+ children: dryReport.ruleLayer?.ruleIndex === void 0 ? t("card.dryRunRuleNone").replace("%d", dryReport.defaultAction ?? "ask") : `#${dryReport.ruleLayer.ruleIndex} (${dryReport.ruleLayer.action ?? "?"})`
5052
+ })]
5053
+ }),
5054
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5055
+ style: {
5056
+ display: "flex",
5057
+ gap: "8px",
5058
+ overflowWrap: "anywhere"
5059
+ },
5060
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5061
+ style: fieldLabelStyle,
5062
+ children: t("card.dryRunDimensions")
5063
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5064
+ style: {
5065
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5066
+ color: "var(--dsw-alias-label-primary)"
5067
+ },
5068
+ children: (dryReport.ruleLayer?.matchedDimensions ?? []).length === 0 ? "—" : (dryReport.ruleLayer?.matchedDimensions ?? []).join(", ")
5069
+ })]
5070
+ }),
5071
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5072
+ style: {
5073
+ display: "flex",
5074
+ gap: "8px",
5075
+ overflowWrap: "anywhere"
5076
+ },
5077
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5078
+ style: fieldLabelStyle,
5079
+ children: t("card.dryRunReason")
5080
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5081
+ style: { color: "var(--dsw-alias-label-secondary, inherit)" },
5082
+ children: dryReport.reason ?? ""
5083
+ })]
5084
+ }),
5085
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5086
+ style: {
5087
+ ...hintStyle,
5088
+ margin: 0
5089
+ },
5090
+ children: t("card.dryRunNote")
5091
+ })
5092
+ ]
5093
+ })
5094
+ ]
5095
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5096
+ style: sectionStyle,
5097
+ children: [
4557
5098
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4558
5099
  style: {
4559
5100
  display: "flex",
4560
5101
  alignItems: "center",
4561
- gap: "8px",
4562
- marginTop: "4px"
5102
+ justifyContent: "space-between",
5103
+ gap: "8px"
4563
5104
  },
4564
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5105
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5106
+ style: labelStyle,
5107
+ children: t("card.rules")
5108
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4565
5109
  type: "button",
4566
- disabled: readonly || healthBusy,
4567
- onClick: () => {
4568
- setHealthBusy(true);
4569
- setHealthResult(null);
4570
- fetch("/api/dsh-perm-gate/health", {
4571
- method: "POST",
4572
- headers: { "content-type": "application/json" },
4573
- body: "{}"
4574
- }).then(async (r) => {
4575
- const text = await r.text();
4576
- if (r.status === 404) throw new Error(t("card.healthStale"));
4577
- try {
4578
- return JSON.parse(text);
4579
- } catch {
4580
- throw new Error(text.trim().slice(0, 120) !== "" ? text.trim().slice(0, 120) : `HTTP ${r.status}`);
4581
- }
4582
- }).then((res) => {
4583
- setHealthResult(res.ok === true && typeof res.ms === "number" ? t("card.healthOk").replace("%ms", String(res.ms)) + (typeof res.detail === "string" ? ` · ${res.detail}` : "") : t("card.healthFail") + (res.detail ?? res.error ?? "unknown"));
4584
- setReceiverNonce((n) => n + 1);
4585
- }).catch((e) => {
4586
- setHealthResult(t("card.healthFail") + String(e?.message ?? e));
4587
- }).finally(() => {
4588
- setHealthBusy(false);
4589
- });
4590
- },
5110
+ disabled: rulesBusy,
5111
+ onClick: loadRules,
4591
5112
  style: {
4592
5113
  ...controlStyle,
4593
- cursor: readonly || healthBusy ? "default" : "pointer"
4594
- },
4595
- children: healthBusy ? t("card.healthRunning") : t("card.healthTest")
4596
- }), healthResult !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4597
- style: {
4598
- fontSize: "12px",
4599
- lineHeight: "18px",
4600
- color: "var(--dsw-alias-label-secondary, inherit)",
4601
- overflowWrap: "anywhere"
5114
+ flex: "0 0 auto",
5115
+ cursor: rulesBusy ? "default" : "pointer"
4602
5116
  },
4603
- children: healthResult
4604
- })]
4605
- }),
4606
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4607
- style: rowStyle,
4608
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4609
- htmlFor: "plugin-config-perm-gate-risk-learning",
4610
- style: { fontSize: "12px" },
4611
- children: t("card.riskLearning")
4612
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4613
- id: "plugin-config-perm-gate-risk-learning",
4614
- checked: value.riskLearning ?? false,
4615
- disabled: readonly || !effective,
4616
- onCommit: (next) => scope.set("riskLearning", next)
5117
+ children: rulesBusy ? t("card.rulesLoading") : t("card.rulesRefresh")
4617
5118
  })]
4618
5119
  }),
4619
5120
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4620
5121
  style: hintStyle,
4621
- children: t("card.riskLearningHint")
5122
+ children: t("card.rulesHint")
4622
5123
  }),
4623
- value.riskLearning === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4624
- style: fieldStyle,
5124
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5125
+ style: {
5126
+ display: "flex",
5127
+ gap: "8px",
5128
+ overflowWrap: "anywhere",
5129
+ marginTop: "6px"
5130
+ },
4625
5131
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4626
5132
  style: fieldLabelStyle,
4627
- children: t("card.riskThreshold")
4628
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4629
- id: "plugin-config-perm-gate-risk-threshold",
4630
- type: "number",
4631
- min: 1,
4632
- max: 10,
4633
- value: value.riskThreshold ?? 3,
4634
- disabled: readonly || !effective,
5133
+ children: t("card.rulesPath")
5134
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
4635
5135
  style: {
4636
- ...controlStyle,
4637
- width: "96px"
5136
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5137
+ color: "var(--dsw-alias-label-primary)"
4638
5138
  },
4639
- onChange: (event) => {
4640
- const n = Number.parseInt(event.currentTarget.value, 10);
4641
- if (Number.isFinite(n) && n >= 1 && n <= 10) scope.set("riskThreshold", n);
4642
- }
5139
+ children: rulesBody?.path !== void 0 && rulesBody.path !== "" ? rulesBody.path : t("card.rulesNone")
4643
5140
  })]
4644
- }) : null,
4645
- value.riskLearning === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5141
+ }),
5142
+ rulesError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
5143
+ style: {
5144
+ ...hintStyle,
5145
+ color: "var(--dsw-alias-label-error, #c0392b)"
5146
+ },
5147
+ children: [t("card.rulesError"), rulesError]
5148
+ }),
5149
+ rulesBody !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4646
5150
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4647
- style: rowStyle,
4648
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4649
- htmlFor: "plugin-config-perm-gate-risk-sediment",
4650
- style: { fontSize: "12px" },
4651
- children: t("card.riskSediment")
4652
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
4653
- id: "plugin-config-perm-gate-risk-sediment",
4654
- checked: value.riskSediment ?? true,
4655
- disabled: readonly || !effective,
4656
- onCommit: (next) => scope.set("riskSediment", next)
4657
- })]
5151
+ style: {
5152
+ display: "flex",
5153
+ flexWrap: "wrap",
5154
+ gap: "12px",
5155
+ marginTop: "4px"
5156
+ },
5157
+ children: [
5158
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5159
+ style: fieldLabelStyle,
5160
+ children: [t("card.rulesCounts"), " "]
5161
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5162
+ style: {
5163
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5164
+ color: "var(--dsw-alias-label-primary)"
5165
+ },
5166
+ children: `deny ${rulesBody.counts?.deny ?? 0} · allow ${rulesBody.counts?.allow ?? 0} · ask ${rulesBody.counts?.ask ?? 0}`
5167
+ })] }),
5168
+ rulesBody.defaultAction !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5169
+ style: fieldLabelStyle,
5170
+ children: [t("card.rulesDefault"), " "]
5171
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5172
+ style: {
5173
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5174
+ color: "var(--dsw-alias-label-primary)"
5175
+ },
5176
+ children: rulesBody.defaultAction
5177
+ })] }),
5178
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5179
+ style: fieldLabelStyle,
5180
+ children: t("card.rulesStats").replace("%b", String(rulesBody.bytes ?? 0)).replace("%l", String(rulesBody.lines ?? 0))
5181
+ })
5182
+ ]
4658
5183
  }),
4659
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5184
+ rulesBody.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5185
+ style: {
5186
+ ...hintStyle,
5187
+ color: "var(--dsw-alias-label-error, #c0392b)"
5188
+ },
5189
+ children: rulesBody.error
5190
+ }),
5191
+ rulesBody.exists === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4660
5192
  style: hintStyle,
4661
- children: t("card.riskSedimentHint")
5193
+ children: t("card.rulesMissing")
4662
5194
  }),
4663
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4664
- style: sectionStyle,
4665
- children: [
4666
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4667
- style: labelStyle,
4668
- children: t("card.sediment")
4669
- }),
4670
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4671
- style: hintStyle,
4672
- children: t("card.sedimentHint")
4673
- }),
4674
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SedimentSection, { t })
4675
- ]
5195
+ rulesBody.truncated === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5196
+ style: hintStyle,
5197
+ children: t("card.rulesTruncated")
5198
+ }),
5199
+ (rulesBody.raw ?? "") !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
5200
+ style: {
5201
+ margin: "6px 0 0",
5202
+ padding: "8px 10px",
5203
+ maxHeight: "260px",
5204
+ overflow: "auto",
5205
+ borderRadius: "6px",
5206
+ border: "1px solid var(--dsw-alias-border-l2)",
5207
+ background: "var(--dsw-alias-bg-surface, transparent)",
5208
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5209
+ color: "var(--dsw-alias-label-primary)",
5210
+ whiteSpace: "pre"
5211
+ },
5212
+ children: rulesBody.raw
5213
+ }),
5214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5215
+ style: {
5216
+ ...hintStyle,
5217
+ margin: 0
5218
+ },
5219
+ children: t("card.rulesNote")
4676
5220
  })
4677
- ] }) : null
5221
+ ] })
4678
5222
  ]
4679
- }) : null
4680
- ]
4681
- }),
4682
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
4683
- id: "pg-drawer-testing",
4684
- title: t("card.testing"),
4685
- onFirstOpen: loadRules,
4686
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4687
- style: sectionStyle,
5223
+ })]
5224
+ }),
5225
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5226
+ id: "pg-drawer-lists",
5227
+ title: t("card.lists"),
5228
+ summary: listsSummary,
4688
5229
  children: [
4689
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4690
- style: labelStyle,
4691
- children: t("card.dryRun")
4692
- }),
4693
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4694
- style: hintStyle,
4695
- children: t("card.dryRunHint")
4696
- }),
4697
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4698
- style: {
4699
- display: "flex",
4700
- flexWrap: "wrap",
4701
- gap: "8px",
4702
- alignItems: "flex-end",
4703
- margin: "6px 0"
4704
- },
5230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5231
+ style: sectionStyle,
4705
5232
  children: [
4706
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5233
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5234
+ style: labelStyle,
5235
+ children: t("card.allowlist")
5236
+ }),
5237
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5238
+ style: hintStyle,
5239
+ children: t("card.allowlistHint")
5240
+ }),
5241
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5242
+ style: hintStyle,
5243
+ children: t("card.allowlistPresetNote")
5244
+ }),
5245
+ patterns.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5246
+ style: {
5247
+ padding: "6px 0",
5248
+ fontSize: "12px",
5249
+ color: "var(--dsw-alias-label-tertiary)"
5250
+ },
5251
+ children: t("card.allowlistEmpty")
5252
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4707
5253
  style: {
4708
5254
  display: "flex",
4709
5255
  flexDirection: "column",
4710
5256
  gap: "4px",
4711
- flex: "0 0 120px"
5257
+ margin: "6px 0"
4712
5258
  },
4713
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4714
- style: fieldLabelStyle,
4715
- children: t("card.dryRunTool")
4716
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5259
+ children: patterns.map((pattern, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5260
+ style: {
5261
+ display: "flex",
5262
+ alignItems: "center",
5263
+ gap: "8px",
5264
+ padding: "4px 8px",
5265
+ borderRadius: "6px",
5266
+ border: "1px solid var(--dsw-alias-border-l2)",
5267
+ background: "var(--dsw-alias-bg-surface, transparent)"
5268
+ },
5269
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5270
+ style: {
5271
+ flex: "1 1 auto",
5272
+ minWidth: 0,
5273
+ overflowWrap: "anywhere",
5274
+ font: "500 12px/18px var(--ds-font-family-code, monospace)",
5275
+ color: "var(--dsw-alias-label-primary)"
5276
+ },
5277
+ children: pattern
5278
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5279
+ type: "button",
5280
+ "aria-label": t("card.allowlistRemove"),
5281
+ title: t("card.allowlistRemove"),
5282
+ disabled: readonly,
5283
+ onClick: () => {
5284
+ removePattern(index);
5285
+ },
5286
+ style: {
5287
+ flex: "0 0 auto",
5288
+ width: "20px",
5289
+ height: "20px",
5290
+ border: "none",
5291
+ borderRadius: "999px",
5292
+ background: "transparent",
5293
+ color: "var(--dsw-alias-label-tertiary)",
5294
+ cursor: readonly ? "default" : "pointer"
5295
+ },
5296
+ children: "✕"
5297
+ })]
5298
+ }, `${index}:${pattern}`))
5299
+ }),
5300
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5301
+ style: {
5302
+ display: "flex",
5303
+ gap: "6px",
5304
+ marginTop: "6px"
5305
+ },
5306
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4717
5307
  type: "text",
4718
- value: dryTool,
5308
+ value: addDraft,
4719
5309
  disabled: readonly,
4720
- placeholder: "shell",
4721
- onChange: (e) => {
4722
- setDryTool(e.target.value);
5310
+ placeholder: t("card.allowlistPlaceholder"),
5311
+ spellCheck: false,
5312
+ style: {
5313
+ ...controlStyle,
5314
+ flex: "1 1 auto",
5315
+ minWidth: 0
5316
+ },
5317
+ onChange: (event) => {
5318
+ setAddDraft(event.currentTarget.value);
4723
5319
  },
4724
- onKeyDown: (e) => {
4725
- if (e.key === "Enter") runDryRunTest();
5320
+ onKeyDown: (event) => {
5321
+ if (event.key === "Enter") addPattern();
5322
+ }
5323
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5324
+ type: "button",
5325
+ disabled: readonly || addDraft.trim() === "",
5326
+ onClick: addPattern,
5327
+ style: {
5328
+ ...controlStyle,
5329
+ flex: "0 0 auto",
5330
+ cursor: readonly || addDraft.trim() === "" ? "default" : "pointer",
5331
+ opacity: readonly || addDraft.trim() === "" ? .5 : 1
4726
5332
  },
4727
- style: controlStyle
5333
+ children: t("card.allowlistAdd")
4728
5334
  })]
4729
5335
  }),
4730
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5336
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4731
5337
  style: {
4732
5338
  display: "flex",
4733
- flexDirection: "column",
4734
- gap: "4px",
4735
- flex: "1 1 260px",
4736
- minWidth: 0
5339
+ justifyContent: "flex-end",
5340
+ marginTop: "6px"
4737
5341
  },
4738
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4739
- style: fieldLabelStyle,
4740
- children: t("card.dryRunCommand")
4741
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4742
- type: "text",
4743
- value: dryCommand,
4744
- disabled: readonly,
4745
- placeholder: t("card.dryRunCommandPlaceholder"),
4746
- onChange: (e) => {
4747
- setDryCommand(e.target.value);
5342
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5343
+ type: "button",
5344
+ onClick: () => {
5345
+ setBulkOpen((current) => !current);
4748
5346
  },
4749
- onKeyDown: (e) => {
4750
- if (e.key === "Enter") runDryRunTest();
5347
+ style: {
5348
+ ...controlStyle,
5349
+ cursor: "pointer",
5350
+ border: "none",
5351
+ background: "transparent",
5352
+ color: "var(--dsw-alias-label-tertiary)"
4751
5353
  },
4752
- style: controlStyle
4753
- })]
5354
+ children: bulkOpen ? t("card.allowlistBulkHide") : t("card.allowlistBulk")
5355
+ })
4754
5356
  }),
4755
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4756
- type: "button",
4757
- disabled: readonly || dryBusy,
4758
- onClick: runDryRunTest,
5357
+ bulkOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
5358
+ id: "plugin-config-perm-gate-allowlist",
5359
+ value: allowlistShown,
5360
+ disabled: readonly,
5361
+ rows: 6,
5362
+ spellCheck: false,
4759
5363
  style: {
4760
5364
  ...controlStyle,
4761
- flex: "0 0 auto",
4762
- cursor: readonly || dryBusy ? "default" : "pointer"
5365
+ width: "100%",
5366
+ boxSizing: "border-box",
5367
+ resize: "vertical",
5368
+ fontFamily: "var(--ds-font-family-code, monospace)",
5369
+ whiteSpace: "pre"
4763
5370
  },
4764
- children: dryBusy ? t("card.dryRunRunning") : t("card.dryRunTest")
4765
- })
5371
+ onChange: (event) => {
5372
+ setAllowDirty(true);
5373
+ setAllowText(event.currentTarget.value);
5374
+ },
5375
+ onKeyDown: (event) => {
5376
+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) commitAllowlist();
5377
+ }
5378
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5379
+ style: {
5380
+ display: "flex",
5381
+ justifyContent: "flex-end",
5382
+ marginTop: "6px"
5383
+ },
5384
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5385
+ type: "button",
5386
+ disabled: readonly || !allowDirty,
5387
+ onClick: commitAllowlist,
5388
+ style: {
5389
+ ...controlStyle,
5390
+ cursor: readonly || !allowDirty ? "default" : "pointer",
5391
+ opacity: readonly || !allowDirty ? .5 : 1
5392
+ },
5393
+ children: t("card.allowlistSave")
5394
+ })
5395
+ })] }) : null
4766
5396
  ]
4767
5397
  }),
4768
- dryError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4769
- style: {
4770
- ...hintStyle,
4771
- color: "var(--dsw-alias-label-error, #c0392b)"
4772
- },
4773
- children: [t("card.dryRunFail"), dryError]
5398
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5399
+ style: sectionStyle,
5400
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5401
+ label: t("card.autoAllowTools"),
5402
+ hint: t("card.autoAllowToolsHint"),
5403
+ placeholder: t("card.autoAllowToolsPlaceholder"),
5404
+ addLabel: t("card.denylistAdd"),
5405
+ removeLabel: t("card.listRemove"),
5406
+ items: value.autoAllowTools ?? [],
5407
+ locked: readonly,
5408
+ onAdd: (entry) => {
5409
+ scope.set("autoAllowTools", [...value.autoAllowTools ?? [], entry]);
5410
+ },
5411
+ onRemove: (index) => {
5412
+ scope.set("autoAllowTools", (value.autoAllowTools ?? []).filter((_, i) => i !== index));
5413
+ }
5414
+ })
4774
5415
  }),
4775
- dryReport === null ? dryError === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4776
- style: hintStyle,
4777
- children: t("card.dryRunEmpty")
4778
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4779
- style: {
4780
- display: "flex",
4781
- flexDirection: "column",
4782
- gap: "4px",
4783
- padding: "8px 10px",
4784
- borderRadius: "6px",
4785
- border: "1px solid var(--dsw-alias-border-l2)",
4786
- background: "var(--dsw-alias-bg-surface, transparent)",
4787
- fontSize: "12px",
4788
- lineHeight: "18px"
4789
- },
5416
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5417
+ style: sectionStyle,
4790
5418
  children: [
4791
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4792
- style: {
4793
- display: "flex",
4794
- alignItems: "center",
4795
- gap: "8px"
5419
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5420
+ label: t("card.denyKeywordsExtra"),
5421
+ hint: t("card.denyKeywordsExtraHint"),
5422
+ placeholder: t("card.denylistPlaceholder"),
5423
+ addLabel: t("card.denylistAdd"),
5424
+ removeLabel: t("card.listRemove"),
5425
+ items: value.denyKeywordsExtra ?? [],
5426
+ locked: readonly,
5427
+ onAdd: (entry) => {
5428
+ scope.set("denyKeywordsExtra", [...value.denyKeywordsExtra ?? [], entry]);
4796
5429
  },
4797
- children: [
4798
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4799
- style: fieldLabelStyle,
4800
- children: t("card.dryRunVerdict")
4801
- }),
4802
- (() => {
4803
- const verdict = dryReport.verdict ?? "ask";
4804
- const colour = verdict === "deny" ? "var(--dsw-alias-label-error, #c0392b)" : verdict === "allow" ? "var(--dsw-alias-label-success, #2e7d32)" : "var(--dsw-alias-label-warning, #b26a00)";
4805
- const text = verdict === "deny" ? t("card.dryRunDeny") : verdict === "allow" ? t("card.dryRunAllow") : t("card.dryRunAsk");
4806
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
4807
- style: { color: colour },
4808
- children: text
4809
- });
4810
- })(),
4811
- (dryReport.ruleCount ?? 0) === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4812
- style: { color: "var(--dsw-alias-label-secondary, inherit)" },
4813
- children: t("card.dryRunNoRules")
4814
- })
4815
- ]
5430
+ onRemove: (index) => {
5431
+ scope.set("denyKeywordsExtra", (value.denyKeywordsExtra ?? []).filter((_, i) => i !== index));
5432
+ }
4816
5433
  }),
4817
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4818
- style: {
4819
- display: "flex",
4820
- gap: "8px",
4821
- overflowWrap: "anywhere"
5434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "10px" } }),
5435
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5436
+ label: t("card.extraContentArgKeys"),
5437
+ hint: t("card.extraContentArgKeysHint"),
5438
+ placeholder: t("card.extraContentArgKeysPlaceholder"),
5439
+ addLabel: t("card.denylistAdd"),
5440
+ removeLabel: t("card.listRemove"),
5441
+ items: value.extraContentArgKeys ?? [],
5442
+ locked: readonly,
5443
+ onAdd: (entry) => {
5444
+ scope.set("extraContentArgKeys", [...value.extraContentArgKeys ?? [], entry]);
4822
5445
  },
4823
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4824
- style: fieldLabelStyle,
4825
- children: t("card.dryRunRule")
4826
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
4827
- style: {
4828
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4829
- color: "var(--dsw-alias-label-primary)"
4830
- },
4831
- children: dryReport.ruleLayer?.ruleIndex === void 0 ? t("card.dryRunRuleNone").replace("%d", dryReport.defaultAction ?? "ask") : `#${dryReport.ruleLayer.ruleIndex} (${dryReport.ruleLayer.action ?? "?"})`
4832
- })]
5446
+ onRemove: (index) => {
5447
+ scope.set("extraContentArgKeys", (value.extraContentArgKeys ?? []).filter((_, i) => i !== index));
5448
+ }
4833
5449
  }),
4834
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4835
- style: {
4836
- display: "flex",
4837
- gap: "8px",
4838
- overflowWrap: "anywhere"
5450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "10px" } }),
5451
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5452
+ label: t("card.extraOperationArgKeys"),
5453
+ hint: t("card.extraOperationArgKeysHint"),
5454
+ placeholder: t("card.extraContentArgKeysPlaceholder"),
5455
+ addLabel: t("card.denylistAdd"),
5456
+ removeLabel: t("card.listRemove"),
5457
+ items: value.extraOperationArgKeys ?? [],
5458
+ locked: readonly,
5459
+ onAdd: (entry) => {
5460
+ scope.set("extraOperationArgKeys", [...value.extraOperationArgKeys ?? [], entry]);
4839
5461
  },
4840
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4841
- style: fieldLabelStyle,
4842
- children: t("card.dryRunDimensions")
4843
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
4844
- style: {
4845
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4846
- color: "var(--dsw-alias-label-primary)"
4847
- },
4848
- children: (dryReport.ruleLayer?.matchedDimensions ?? []).length === 0 ? "—" : (dryReport.ruleLayer?.matchedDimensions ?? []).join(", ")
4849
- })]
5462
+ onRemove: (index) => {
5463
+ scope.set("extraOperationArgKeys", (value.extraOperationArgKeys ?? []).filter((_, i) => i !== index));
5464
+ }
5465
+ })
5466
+ ]
5467
+ }),
5468
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5469
+ style: sectionStyle,
5470
+ children: [
5471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5472
+ style: labelStyle,
5473
+ children: t("card.denylist")
4850
5474
  }),
4851
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5476
+ style: hintStyle,
5477
+ children: t("card.denylistHint")
5478
+ }),
5479
+ customDeny.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4852
5480
  style: {
4853
- display: "flex",
4854
- gap: "8px",
4855
- overflowWrap: "anywhere"
5481
+ ...labelStyle,
5482
+ fontSize: "12px"
4856
5483
  },
4857
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4858
- style: fieldLabelStyle,
4859
- children: t("card.dryRunReason")
4860
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4861
- style: { color: "var(--dsw-alias-label-secondary, inherit)" },
4862
- children: dryReport.reason ?? ""
4863
- })]
5484
+ children: t("card.denylistCustom")
4864
5485
  }),
4865
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5486
+ customDeny.map((pair) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5487
+ style: { margin: "6px 0" },
5488
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DenyRow, {
5489
+ keyword: pair.keyword,
5490
+ index: pair.index,
5491
+ muted: false,
5492
+ locked: readonly,
5493
+ removeLabel: t("card.denylistRemove"),
5494
+ onRemove: removeDeny
5495
+ })
5496
+ }, `${pair.index}:${pair.keyword}`)),
5497
+ presetDeny.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5498
+ type: "button",
5499
+ "aria-expanded": presetDenyOpen,
5500
+ onClick: () => {
5501
+ setPresetDenyOpen((current) => !current);
5502
+ },
4866
5503
  style: {
4867
- ...hintStyle,
4868
- margin: 0
5504
+ ...drawerHeaderStyle,
5505
+ width: "auto",
5506
+ alignSelf: "flex-start",
5507
+ padding: "6px 4px"
4869
5508
  },
4870
- children: t("card.dryRunNote")
4871
- })
4872
- ]
4873
- })
4874
- ]
4875
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4876
- style: sectionStyle,
4877
- children: [
4878
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4879
- style: {
4880
- display: "flex",
4881
- alignItems: "center",
4882
- justifyContent: "space-between",
4883
- gap: "8px"
4884
- },
4885
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4886
- style: labelStyle,
4887
- children: t("card.rules")
4888
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4889
- type: "button",
4890
- disabled: rulesBusy,
4891
- onClick: loadRules,
4892
- style: {
4893
- ...controlStyle,
4894
- flex: "0 0 auto",
4895
- cursor: rulesBusy ? "default" : "pointer"
4896
- },
4897
- children: rulesBusy ? t("card.rulesLoading") : t("card.rulesRefresh")
4898
- })]
4899
- }),
4900
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4901
- style: hintStyle,
4902
- children: t("card.rulesHint")
4903
- }),
4904
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4905
- style: {
4906
- display: "flex",
4907
- gap: "8px",
4908
- overflowWrap: "anywhere",
4909
- marginTop: "6px"
4910
- },
4911
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4912
- style: fieldLabelStyle,
4913
- children: t("card.rulesPath")
4914
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
4915
- style: {
4916
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4917
- color: "var(--dsw-alias-label-primary)"
4918
- },
4919
- children: rulesBody?.path !== void 0 && rulesBody.path !== "" ? rulesBody.path : t("card.rulesNone")
4920
- })]
4921
- }),
4922
- rulesError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4923
- style: {
4924
- ...hintStyle,
4925
- color: "var(--dsw-alias-label-error, #c0392b)"
4926
- },
4927
- children: [t("card.rulesError"), rulesError]
4928
- }),
4929
- rulesBody !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4930
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4931
- style: {
4932
- display: "flex",
4933
- flexWrap: "wrap",
4934
- gap: "12px",
4935
- marginTop: "4px"
4936
- },
4937
- children: [
4938
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4939
- style: fieldLabelStyle,
4940
- children: [t("card.rulesCounts"), " "]
4941
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
4942
- style: {
4943
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4944
- color: "var(--dsw-alias-label-primary)"
4945
- },
4946
- children: `deny ${rulesBody.counts?.deny ?? 0} · allow ${rulesBody.counts?.allow ?? 0} · ask ${rulesBody.counts?.ask ?? 0}`
4947
- })] }),
4948
- rulesBody.defaultAction !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4949
- style: fieldLabelStyle,
4950
- children: [t("card.rulesDefault"), " "]
4951
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5509
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
5510
+ width: "12",
5511
+ height: "12",
5512
+ viewBox: "0 0 16 16",
5513
+ "aria-hidden": true,
4952
5514
  style: {
4953
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4954
- color: "var(--dsw-alias-label-primary)"
5515
+ color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
5516
+ flex: "0 0 auto",
5517
+ transition: "transform 0.16s",
5518
+ transform: presetDenyOpen ? "rotate(180deg)" : "none"
4955
5519
  },
4956
- children: rulesBody.defaultAction
4957
- })] }),
4958
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4959
- style: fieldLabelStyle,
4960
- children: t("card.rulesStats").replace("%b", String(rulesBody.bytes ?? 0)).replace("%l", String(rulesBody.lines ?? 0))
4961
- })
4962
- ]
4963
- }),
4964
- rulesBody.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4965
- style: {
4966
- ...hintStyle,
4967
- color: "var(--dsw-alias-label-error, #c0392b)"
4968
- },
4969
- children: rulesBody.error
4970
- }),
4971
- rulesBody.exists === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4972
- style: hintStyle,
4973
- children: t("card.rulesMissing")
4974
- }),
4975
- rulesBody.truncated === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4976
- style: hintStyle,
4977
- children: t("card.rulesTruncated")
4978
- }),
4979
- (rulesBody.raw ?? "") !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
4980
- style: {
4981
- margin: "6px 0 0",
4982
- padding: "8px 10px",
4983
- maxHeight: "260px",
4984
- overflow: "auto",
4985
- borderRadius: "6px",
4986
- border: "1px solid var(--dsw-alias-border-l2)",
4987
- background: "var(--dsw-alias-bg-surface, transparent)",
4988
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
4989
- color: "var(--dsw-alias-label-primary)",
4990
- whiteSpace: "pre"
4991
- },
4992
- children: rulesBody.raw
4993
- }),
4994
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4995
- style: {
4996
- ...hintStyle,
4997
- margin: 0
4998
- },
4999
- children: t("card.rulesNote")
5000
- })
5001
- ] })
5002
- ]
5003
- })]
5004
- }),
5005
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5006
- id: "pg-drawer-lists",
5007
- title: t("card.lists"),
5008
- summary: listsSummary,
5009
- children: [
5010
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5011
- style: sectionStyle,
5012
- children: [
5013
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5014
- style: labelStyle,
5015
- children: t("card.allowlist")
5016
- }),
5017
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5018
- style: hintStyle,
5019
- children: t("card.allowlistHint")
5020
- }),
5021
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5022
- style: hintStyle,
5023
- children: t("card.allowlistPresetNote")
5024
- }),
5025
- patterns.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5026
- style: {
5027
- padding: "6px 0",
5028
- fontSize: "12px",
5029
- color: "var(--dsw-alias-label-tertiary)"
5030
- },
5031
- children: t("card.allowlistEmpty")
5032
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5033
- style: {
5034
- display: "flex",
5035
- flexDirection: "column",
5036
- gap: "4px",
5037
- margin: "6px 0"
5038
- },
5039
- children: patterns.map((pattern, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5520
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
5521
+ d: "M4 6l4 4 4-4",
5522
+ fill: "none",
5523
+ stroke: "currentColor",
5524
+ strokeWidth: "1.5",
5525
+ strokeLinecap: "round",
5526
+ strokeLinejoin: "round"
5527
+ })
5528
+ }), t("card.denylistPresetCollapse").replace("%n", String(presetDeny.length))]
5529
+ }), presetDenyOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5040
5530
  style: {
5041
5531
  display: "flex",
5042
- alignItems: "center",
5043
- gap: "8px",
5044
- padding: "4px 8px",
5045
- borderRadius: "6px",
5046
- border: "1px solid var(--dsw-alias-border-l2)",
5047
- background: "var(--dsw-alias-bg-surface, transparent)"
5532
+ flexDirection: "column",
5533
+ gap: "4px",
5534
+ margin: "6px 0"
5048
5535
  },
5049
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
5536
+ children: presetDeny.map((pair) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DenyRow, {
5537
+ keyword: pair.keyword,
5538
+ index: pair.index,
5539
+ muted: true,
5540
+ locked: readonly,
5541
+ removeLabel: t("card.denylistRemove"),
5542
+ onRemove: removeDeny
5543
+ }, `${pair.index}:${pair.keyword}`))
5544
+ }) : null] }),
5545
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5546
+ style: {
5547
+ display: "flex",
5548
+ gap: "6px",
5549
+ marginTop: "6px"
5550
+ },
5551
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5552
+ type: "text",
5553
+ value: denyDraft,
5554
+ disabled: readonly,
5555
+ placeholder: t("card.denylistPlaceholder"),
5556
+ spellCheck: false,
5050
5557
  style: {
5558
+ ...controlStyle,
5051
5559
  flex: "1 1 auto",
5052
- minWidth: 0,
5053
- overflowWrap: "anywhere",
5054
- font: "500 12px/18px var(--ds-font-family-code, monospace)",
5055
- color: "var(--dsw-alias-label-primary)"
5560
+ minWidth: 0
5056
5561
  },
5057
- children: pattern
5562
+ onChange: (event) => {
5563
+ setDenyDraft(event.currentTarget.value);
5564
+ },
5565
+ onKeyDown: (event) => {
5566
+ if (event.key === "Enter") addDeny();
5567
+ }
5058
5568
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5059
5569
  type: "button",
5060
- "aria-label": t("card.allowlistRemove"),
5061
- title: t("card.allowlistRemove"),
5062
- disabled: readonly,
5063
- onClick: () => {
5064
- removePattern(index);
5065
- },
5570
+ disabled: readonly || denyDraft.trim() === "",
5571
+ onClick: addDeny,
5066
5572
  style: {
5573
+ ...controlStyle,
5067
5574
  flex: "0 0 auto",
5068
- width: "20px",
5069
- height: "20px",
5070
- border: "none",
5071
- borderRadius: "999px",
5072
- background: "transparent",
5073
- color: "var(--dsw-alias-label-tertiary)",
5074
- cursor: readonly ? "default" : "pointer"
5575
+ cursor: readonly || denyDraft.trim() === "" ? "default" : "pointer",
5576
+ opacity: readonly || denyDraft.trim() === "" ? .5 : 1
5075
5577
  },
5076
- children: "✕"
5578
+ children: t("card.denylistAdd")
5077
5579
  })]
5078
- }, `${index}:${pattern}`))
5079
- }),
5080
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5081
- style: {
5082
- display: "flex",
5083
- gap: "6px",
5084
- marginTop: "6px"
5085
- },
5086
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5087
- type: "text",
5088
- value: addDraft,
5089
- disabled: readonly,
5090
- placeholder: t("card.allowlistPlaceholder"),
5091
- spellCheck: false,
5092
- style: {
5093
- ...controlStyle,
5094
- flex: "1 1 auto",
5095
- minWidth: 0
5096
- },
5097
- onChange: (event) => {
5098
- setAddDraft(event.currentTarget.value);
5099
- },
5100
- onKeyDown: (event) => {
5101
- if (event.key === "Enter") addPattern();
5102
- }
5103
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5104
- type: "button",
5105
- disabled: readonly || addDraft.trim() === "",
5106
- onClick: addPattern,
5107
- style: {
5108
- ...controlStyle,
5109
- flex: "0 0 auto",
5110
- cursor: readonly || addDraft.trim() === "" ? "default" : "pointer",
5111
- opacity: readonly || addDraft.trim() === "" ? .5 : 1
5112
- },
5113
- children: t("card.allowlistAdd")
5114
- })]
5115
- }),
5116
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5117
- style: {
5118
- display: "flex",
5119
- justifyContent: "flex-end",
5120
- marginTop: "6px"
5121
- },
5122
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5123
- type: "button",
5124
- onClick: () => {
5125
- setBulkOpen((current) => !current);
5126
- },
5127
- style: {
5128
- ...controlStyle,
5129
- cursor: "pointer",
5130
- border: "none",
5131
- background: "transparent",
5132
- color: "var(--dsw-alias-label-tertiary)"
5133
- },
5134
- children: bulkOpen ? t("card.allowlistBulkHide") : t("card.allowlistBulk")
5135
- })
5136
- }),
5137
- bulkOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
5138
- id: "plugin-config-perm-gate-allowlist",
5139
- value: allowlistShown,
5140
- disabled: readonly,
5141
- rows: 6,
5142
- spellCheck: false,
5143
- style: {
5144
- ...controlStyle,
5145
- width: "100%",
5146
- boxSizing: "border-box",
5147
- resize: "vertical",
5148
- fontFamily: "var(--ds-font-family-code, monospace)",
5149
- whiteSpace: "pre"
5150
- },
5151
- onChange: (event) => {
5152
- setAllowDirty(true);
5153
- setAllowText(event.currentTarget.value);
5154
- },
5155
- onKeyDown: (event) => {
5156
- if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) commitAllowlist();
5157
- }
5158
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5159
- style: {
5160
- display: "flex",
5161
- justifyContent: "flex-end",
5162
- marginTop: "6px"
5163
- },
5164
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5165
- type: "button",
5166
- disabled: readonly || !allowDirty,
5167
- onClick: commitAllowlist,
5580
+ }),
5581
+ denyActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5168
5582
  style: {
5169
- ...controlStyle,
5170
- cursor: readonly || !allowDirty ? "default" : "pointer",
5171
- opacity: readonly || !allowDirty ? .5 : 1
5583
+ display: "flex",
5584
+ justifyContent: "flex-end",
5585
+ marginTop: "6px"
5172
5586
  },
5173
- children: t("card.allowlistSave")
5174
- })
5175
- })] }) : null
5176
- ]
5177
- }),
5178
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5587
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5588
+ type: "button",
5589
+ disabled: readonly,
5590
+ onClick: restoreDeny,
5591
+ style: {
5592
+ ...controlStyle,
5593
+ cursor: readonly ? "default" : "pointer",
5594
+ border: "none",
5595
+ background: "transparent",
5596
+ color: "var(--dsw-alias-label-tertiary)"
5597
+ },
5598
+ children: t("card.denylistRestore")
5599
+ })
5600
+ }) : null
5601
+ ]
5602
+ })
5603
+ ]
5604
+ }),
5605
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5606
+ id: "pg-drawer-credentials",
5607
+ title: t("card.credentials"),
5608
+ summary: credSummary,
5609
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5179
5610
  style: sectionStyle,
5180
5611
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5181
- label: t("card.autoAllowTools"),
5182
- hint: t("card.autoAllowToolsHint"),
5183
- placeholder: t("card.autoAllowToolsPlaceholder"),
5612
+ label: t("card.credentialPaths"),
5613
+ hint: t("card.credentialPathsHint"),
5614
+ placeholder: t("card.credentialPathsPlaceholder"),
5184
5615
  addLabel: t("card.denylistAdd"),
5185
5616
  removeLabel: t("card.listRemove"),
5186
- items: value.autoAllowTools ?? [],
5617
+ items: value.credentialPaths ?? [],
5187
5618
  locked: readonly,
5188
5619
  onAdd: (entry) => {
5189
- scope.set("autoAllowTools", [...value.autoAllowTools ?? [], entry]);
5620
+ scope.set("credentialPaths", [...value.credentialPaths ?? [], entry]);
5190
5621
  },
5191
5622
  onRemove: (index) => {
5192
- scope.set("autoAllowTools", (value.autoAllowTools ?? []).filter((_, i) => i !== index));
5623
+ scope.set("credentialPaths", (value.credentialPaths ?? []).filter((_, i) => i !== index));
5193
5624
  }
5194
5625
  })
5195
- }),
5196
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5197
- style: sectionStyle,
5198
- children: [
5199
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5200
- label: t("card.denyKeywordsExtra"),
5201
- hint: t("card.denyKeywordsExtraHint"),
5202
- placeholder: t("card.denylistPlaceholder"),
5203
- addLabel: t("card.denylistAdd"),
5204
- removeLabel: t("card.listRemove"),
5205
- items: value.denyKeywordsExtra ?? [],
5206
- locked: readonly,
5207
- onAdd: (entry) => {
5208
- scope.set("denyKeywordsExtra", [...value.denyKeywordsExtra ?? [], entry]);
5209
- },
5210
- onRemove: (index) => {
5211
- scope.set("denyKeywordsExtra", (value.denyKeywordsExtra ?? []).filter((_, i) => i !== index));
5212
- }
5213
- }),
5214
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "10px" } }),
5215
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5216
- label: t("card.extraContentArgKeys"),
5217
- hint: t("card.extraContentArgKeysHint"),
5218
- placeholder: t("card.extraContentArgKeysPlaceholder"),
5219
- addLabel: t("card.denylistAdd"),
5220
- removeLabel: t("card.listRemove"),
5221
- items: value.extraContentArgKeys ?? [],
5222
- locked: readonly,
5223
- onAdd: (entry) => {
5224
- scope.set("extraContentArgKeys", [...value.extraContentArgKeys ?? [], entry]);
5225
- },
5226
- onRemove: (index) => {
5227
- scope.set("extraContentArgKeys", (value.extraContentArgKeys ?? []).filter((_, i) => i !== index));
5228
- }
5229
- }),
5230
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "10px" } }),
5231
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5232
- label: t("card.extraOperationArgKeys"),
5233
- hint: t("card.extraOperationArgKeysHint"),
5234
- placeholder: t("card.extraContentArgKeysPlaceholder"),
5235
- addLabel: t("card.denylistAdd"),
5236
- removeLabel: t("card.listRemove"),
5237
- items: value.extraOperationArgKeys ?? [],
5238
- locked: readonly,
5239
- onAdd: (entry) => {
5240
- scope.set("extraOperationArgKeys", [...value.extraOperationArgKeys ?? [], entry]);
5241
- },
5242
- onRemove: (index) => {
5243
- scope.set("extraOperationArgKeys", (value.extraOperationArgKeys ?? []).filter((_, i) => i !== index));
5244
- }
5245
- })
5246
- ]
5247
- }),
5248
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5249
- style: sectionStyle,
5250
- children: [
5251
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5252
- style: labelStyle,
5253
- children: t("card.denylist")
5254
- }),
5255
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5256
- style: hintStyle,
5257
- children: t("card.denylistHint")
5258
- }),
5259
- customDeny.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5260
- style: {
5261
- ...labelStyle,
5262
- fontSize: "12px"
5263
- },
5264
- children: t("card.denylistCustom")
5265
- }),
5266
- customDeny.map((pair) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5267
- style: { margin: "6px 0" },
5268
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DenyRow, {
5269
- keyword: pair.keyword,
5270
- index: pair.index,
5271
- muted: false,
5272
- locked: readonly,
5273
- removeLabel: t("card.denylistRemove"),
5274
- onRemove: removeDeny
5275
- })
5276
- }, `${pair.index}:${pair.keyword}`)),
5277
- presetDeny.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5278
- type: "button",
5279
- "aria-expanded": presetDenyOpen,
5280
- onClick: () => {
5281
- setPresetDenyOpen((current) => !current);
5282
- },
5283
- style: {
5284
- ...drawerHeaderStyle,
5285
- width: "auto",
5286
- alignSelf: "flex-start",
5287
- padding: "6px 4px"
5288
- },
5289
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
5290
- width: "12",
5291
- height: "12",
5292
- viewBox: "0 0 16 16",
5293
- "aria-hidden": true,
5294
- style: {
5295
- color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
5296
- flex: "0 0 auto",
5297
- transition: "transform 0.16s",
5298
- transform: presetDenyOpen ? "rotate(180deg)" : "none"
5299
- },
5300
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
5301
- d: "M4 6l4 4 4-4",
5302
- fill: "none",
5303
- stroke: "currentColor",
5304
- strokeWidth: "1.5",
5305
- strokeLinecap: "round",
5306
- strokeLinejoin: "round"
5307
- })
5308
- }), t("card.denylistPresetCollapse").replace("%n", String(presetDeny.length))]
5309
- }), presetDenyOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5310
- style: {
5311
- display: "flex",
5312
- flexDirection: "column",
5313
- gap: "4px",
5314
- margin: "6px 0"
5315
- },
5316
- children: presetDeny.map((pair) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DenyRow, {
5317
- keyword: pair.keyword,
5318
- index: pair.index,
5319
- muted: true,
5320
- locked: readonly,
5321
- removeLabel: t("card.denylistRemove"),
5322
- onRemove: removeDeny
5323
- }, `${pair.index}:${pair.keyword}`))
5324
- }) : null] }),
5325
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5326
- style: {
5327
- display: "flex",
5328
- gap: "6px",
5329
- marginTop: "6px"
5330
- },
5331
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5332
- type: "text",
5333
- value: denyDraft,
5334
- disabled: readonly,
5335
- placeholder: t("card.denylistPlaceholder"),
5336
- spellCheck: false,
5337
- style: {
5338
- ...controlStyle,
5339
- flex: "1 1 auto",
5340
- minWidth: 0
5341
- },
5342
- onChange: (event) => {
5343
- setDenyDraft(event.currentTarget.value);
5344
- },
5345
- onKeyDown: (event) => {
5346
- if (event.key === "Enter") addDeny();
5347
- }
5348
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5349
- type: "button",
5350
- disabled: readonly || denyDraft.trim() === "",
5351
- onClick: addDeny,
5352
- style: {
5353
- ...controlStyle,
5354
- flex: "0 0 auto",
5355
- cursor: readonly || denyDraft.trim() === "" ? "default" : "pointer",
5356
- opacity: readonly || denyDraft.trim() === "" ? .5 : 1
5357
- },
5358
- children: t("card.denylistAdd")
5359
- })]
5360
- }),
5361
- denyActive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5362
- style: {
5363
- display: "flex",
5364
- justifyContent: "flex-end",
5365
- marginTop: "6px"
5366
- },
5367
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5368
- type: "button",
5369
- disabled: readonly,
5370
- onClick: restoreDeny,
5371
- style: {
5372
- ...controlStyle,
5373
- cursor: readonly ? "default" : "pointer",
5374
- border: "none",
5375
- background: "transparent",
5376
- color: "var(--dsw-alias-label-tertiary)"
5377
- },
5378
- children: t("card.denylistRestore")
5379
- })
5380
- }) : null
5381
- ]
5382
- })
5383
- ]
5384
- }),
5385
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5386
- id: "pg-drawer-credentials",
5387
- title: t("card.credentials"),
5388
- summary: credSummary,
5389
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
5390
- style: sectionStyle,
5391
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
5392
- label: t("card.credentialPaths"),
5393
- hint: t("card.credentialPathsHint"),
5394
- placeholder: t("card.credentialPathsPlaceholder"),
5395
- addLabel: t("card.denylistAdd"),
5396
- removeLabel: t("card.listRemove"),
5397
- items: value.credentialPaths ?? [],
5398
- locked: readonly,
5399
- onAdd: (entry) => {
5400
- scope.set("credentialPaths", [...value.credentialPaths ?? [], entry]);
5401
- },
5402
- onRemove: (index) => {
5403
- scope.set("credentialPaths", (value.credentialPaths ?? []).filter((_, i) => i !== index));
5404
- }
5405
- })
5406
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredLadderSection, {
5407
- t,
5408
- readonly,
5409
- onRungs: handleCredRungs
5410
- })]
5411
- }),
5412
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5413
- id: "pg-drawer-network",
5414
- title: t("card.networkOps"),
5415
- summary: networkSummary,
5416
- children: [
5417
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5418
- style: rowStyle,
5419
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5420
- htmlFor: "plugin-config-perm-gate-network-enabled",
5421
- style: { fontSize: "12px" },
5422
- children: t("card.networkEnabled")
5423
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5424
- id: "plugin-config-perm-gate-network-enabled",
5425
- label: t("card.networkEnabled"),
5426
- checked: value.networkEnabled === true,
5427
- disabled: readonly,
5428
- onCommit: (next) => scope.set("networkEnabled", next)
5429
- })]
5430
- }),
5431
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5432
- style: hintStyle,
5433
- children: t("card.networkEnabledHint")
5434
- }),
5435
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5436
- style: hintStyle,
5437
- children: t("card.networkRebindNote")
5438
- }),
5439
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "8px" } }),
5440
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5441
- style: rowStyle,
5442
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5443
- htmlFor: "plugin-config-perm-gate-network-inject-env",
5444
- style: { fontSize: "12px" },
5445
- children: t("card.networkInjectEnv")
5446
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5447
- id: "plugin-config-perm-gate-network-inject-env",
5448
- label: t("card.networkInjectEnv"),
5449
- checked: value.networkInjectEnv !== false,
5450
- disabled: readonly,
5451
- onCommit: (next) => scope.set("networkInjectEnv", next)
5452
- })]
5453
- }),
5454
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5455
- style: hintStyle,
5456
- children: t("card.networkInjectEnvHint")
5457
- }),
5458
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "8px" } }),
5459
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5460
- style: rowStyle,
5461
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5462
- htmlFor: "plugin-config-perm-gate-watch",
5463
- style: { fontSize: "12px" },
5464
- children: t("card.watch")
5465
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5466
- id: "plugin-config-perm-gate-watch",
5467
- label: t("card.watch"),
5468
- checked: value.watch !== false,
5469
- disabled: readonly,
5470
- onCommit: (next) => scope.set("watch", next)
5471
- })]
5472
- }),
5473
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5474
- style: hintStyle,
5475
- children: t("card.watchHint")
5476
- })
5477
- ]
5478
- })
5479
- ]
5480
- }),
5481
- !snapshot.writable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5482
- style: {
5483
- margin: "8px 0 0",
5484
- fontSize: "12px",
5485
- color: "var(--dsw-alias-label-tertiary)"
5486
- },
5487
- children: t("card.readonly")
5488
- })
5489
- ] })
5490
- }) : null]
5626
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CredLadderSection, {
5627
+ t,
5628
+ readonly,
5629
+ onRungs: handleCredRungs
5630
+ })]
5631
+ }),
5632
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DrawerGroup, {
5633
+ id: "pg-drawer-network",
5634
+ title: t("card.networkOps"),
5635
+ summary: networkSummary,
5636
+ children: [
5637
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5638
+ style: rowStyle,
5639
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5640
+ htmlFor: "plugin-config-perm-gate-network-enabled",
5641
+ style: { fontSize: "12px" },
5642
+ children: t("card.networkEnabled")
5643
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5644
+ id: "plugin-config-perm-gate-network-enabled",
5645
+ label: t("card.networkEnabled"),
5646
+ checked: value.networkEnabled === true,
5647
+ disabled: readonly,
5648
+ onCommit: (next) => scope.set("networkEnabled", next)
5649
+ })]
5650
+ }),
5651
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5652
+ style: hintStyle,
5653
+ children: t("card.networkEnabledHint")
5654
+ }),
5655
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5656
+ style: hintStyle,
5657
+ children: t("card.networkRebindNote")
5658
+ }),
5659
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "8px" } }),
5660
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5661
+ style: rowStyle,
5662
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5663
+ htmlFor: "plugin-config-perm-gate-network-inject-env",
5664
+ style: { fontSize: "12px" },
5665
+ children: t("card.networkInjectEnv")
5666
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5667
+ id: "plugin-config-perm-gate-network-inject-env",
5668
+ label: t("card.networkInjectEnv"),
5669
+ checked: value.networkInjectEnv !== false,
5670
+ disabled: readonly,
5671
+ onCommit: (next) => scope.set("networkInjectEnv", next)
5672
+ })]
5673
+ }),
5674
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5675
+ style: hintStyle,
5676
+ children: t("card.networkInjectEnvHint")
5677
+ }),
5678
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "8px" } }),
5679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5680
+ style: rowStyle,
5681
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
5682
+ htmlFor: "plugin-config-perm-gate-watch",
5683
+ style: { fontSize: "12px" },
5684
+ children: t("card.watch")
5685
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PillSwitch, {
5686
+ id: "plugin-config-perm-gate-watch",
5687
+ label: t("card.watch"),
5688
+ checked: value.watch !== false,
5689
+ disabled: readonly,
5690
+ onCommit: (next) => scope.set("watch", next)
5691
+ })]
5692
+ }),
5693
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5694
+ style: hintStyle,
5695
+ children: t("card.watchHint")
5696
+ })
5697
+ ]
5698
+ })
5699
+ ]
5700
+ }),
5701
+ !snapshot.writable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5702
+ style: {
5703
+ margin: "8px 0 0",
5704
+ fontSize: "12px",
5705
+ color: "var(--dsw-alias-label-tertiary)"
5706
+ },
5707
+ children: t("card.readonly")
5708
+ })
5709
+ ] })
5710
+ }) : null,
5711
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { ref: (node) => {
5712
+ if (node && !node.firstChild) node.appendChild(mountStarRow());
5713
+ } })
5714
+ ]
5491
5715
  });
5492
5716
  }
5493
- // src/client/feed.ts
5717
+ //#endregion
5718
+ //#region src/client/feed.ts
5494
5719
  /** Fetch decision events for one session; `since > 0` returns only newer ones. */
5495
5720
  async function fetchEvents(sessionId, since) {
5496
5721
  const query = `/api/dsh-perm-gate/events?sessionId=${encodeURIComponent(sessionId)}${since > 0 ? `&since=${since}` : ""}`;
@@ -5779,7 +6004,8 @@ window.__ModuleLoader__.load({
5779
6004
  };
5780
6005
  }
5781
6006
  }
5782
- // src/client/notice.tsx
6007
+ //#endregion
6008
+ //#region src/client/notice.tsx
5783
6009
  /**
5784
6010
  * Gate decision notice strip — the `conversation.input.dock` face of
5785
6011
  * dsh-perm-gate (a simplified version of the review-feed pattern demonstrated
@@ -5911,7 +6137,8 @@ window.__ModuleLoader__.load({
5911
6137
  ]
5912
6138
  });
5913
6139
  }
5914
- // src/client/history.tsx
6140
+ //#endregion
6141
+ //#region src/client/history.tsx
5915
6142
  /**
5916
6143
  * Approval-history view — the `conversation.view` face of dsh-perm-gate,
5917
6144
  * following the session-scoped review-page pattern demonstrated by
@@ -6651,7 +6878,8 @@ window.__ModuleLoader__.load({
6651
6878
  ]
6652
6879
  });
6653
6880
  }
6654
- // src/client/compat.ts
6881
+ //#endregion
6882
+ //#region src/client/compat.ts
6655
6883
  /**
6656
6884
  * Resolve the plugin's durable settings scope through whichever service this
6657
6885
  * host line carries, then hand it to `onScope` exactly once.
@@ -6670,7 +6898,8 @@ window.__ModuleLoader__.load({
6670
6898
  onScope(settingsScope.bind({ namespace }), "settingsScope");
6671
6899
  });
6672
6900
  }
6673
- // src/client/bridge-scope.ts
6901
+ //#endregion
6902
+ //#region src/client/bridge-scope.ts
6674
6903
  /** 与 server 侧 bridgeRoutesFor(src/bridge.ts)必须逐字符一致。 */
6675
6904
  function bridgeRoutesFor(ns) {
6676
6905
  return {
@@ -6775,7 +7004,8 @@ window.__ModuleLoader__.load({
6775
7004
  this.notify();
6776
7005
  }
6777
7006
  };
6778
- // src/client/index.ts
7007
+ //#endregion
7008
+ //#region src/client/index.ts
6779
7009
  /** The profile entry id of this plugin — the `configForms` key (kept in lockstep with cordis.patch.yml). */
6780
7010
  const PERMISSIVE_NS = "dsh-perm-gate";
6781
7011
  /** Services required by the browser half — generation-neutral only.
@@ -6848,6 +7078,7 @@ window.__ModuleLoader__.load({
6848
7078
  }, PermissiveCard));
6849
7079
  });
6850
7080
  }
7081
+ //#endregion
6851
7082
  exports.apply = apply;
6852
7083
  exports.inject = inject;
6853
7084
  return module.exports;