dsh-connect-workbuddy 5.19.1 → 5.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -477,6 +477,34 @@ window.__ModuleLoader__.load({
477
477
  });
478
478
  }
479
479
  /**
480
+ * Build the next `regions` FIELD carrying one region's CN gateway override
481
+ * (issue #220).
482
+ *
483
+ * Same whole-slot merge as every other helper here: only `cnBase` changes, so
484
+ * setting a host cannot drop the model directory, the pool preferences or the
485
+ * switches that share this slot. An empty string is written as-is rather than
486
+ * deleting the key — it means "back to the built-in gateway", which must survive
487
+ * a read-back, and `resolveCnGateway('')` already reads both the same way.
488
+ */
489
+ function nextRegionCnBase(value, region, cnBase) {
490
+ return nextRegionSlots(regionsMapOf(value), region, {
491
+ ...regionSlotOf(value, region),
492
+ cnBase
493
+ });
494
+ }
495
+ /**
496
+ * Read one region's saved CN gateway override, or `''` when it has none.
497
+ *
498
+ * Deliberately tolerant of a non-string: the settings mirror can hold whatever a
499
+ * previous version wrote, and throwing here would take out the whole capabilities
500
+ * panel over one malformed field. A value that is not a string is treated as
501
+ * "not configured", which is exactly how `resolveCnGateway` treats it.
502
+ */
503
+ function regionCnBaseOf(value, region) {
504
+ const raw = regionSlotOf(value, region)["cnBase"];
505
+ return typeof raw === "string" ? raw : "";
506
+ }
507
+ /**
480
508
  * Whether one region's sidebar credit line is shown. Opt-out: only an explicit
481
509
  * `false` hides it, so a config written before this switch existed keeps the
482
510
  * line visible exactly as a fresh install does.
@@ -1296,6 +1324,32 @@ window.__ModuleLoader__.load({
1296
1324
  });
1297
1325
  }
1298
1326
  /**
1327
+ * Write the CN gateway override (issue #220), with the same landed-check as
1328
+ * every other settings write.
1329
+ *
1330
+ * Carries the region's whole slot through untouched — only `cnBase` changes —
1331
+ * so writing a host cannot drop the model directory, the pool preferences or
1332
+ * the switches that live beside it in the same slot.
1333
+ *
1334
+ * Validation is deliberately NOT here: the caller runs `resolveCnGateway` before
1335
+ * calling, because the rejection reason has to be worded for the user ("not a
1336
+ * known CN brand" vs "must be https"), and a bare `WorkBuddySettingsWriteError`
1337
+ * cannot say that. This function's only job is landing the value.
1338
+ *
1339
+ * @param scope - the bound settings scope for this plugin's namespace.
1340
+ * @param region - the region being written (always `cn` today: the international
1341
+ * gateways follow the credential's brand domain and have no counterpart).
1342
+ * @param cnBase - the validated base URL, or `''` to restore the built-in gateway.
1343
+ * @param slot - the region's COMPLETE next slot (caller owns the merge).
1344
+ * @throws {WorkBuddySettingsWriteError} when neither writer persists the value.
1345
+ */
1346
+ async function writeRegionCnBase(scope, region, cnBase, slot) {
1347
+ await writeField(scope, "regions", region, slot, (readBack) => {
1348
+ const stored = readBack;
1349
+ return stored !== null && stored !== void 0 && stored["cnBase"] === cnBase;
1350
+ });
1351
+ }
1352
+ /**
1299
1353
  * Show or hide one region's sidebar credit line, with the same landed-check as
1300
1354
  * every other settings write.
1301
1355
  *
@@ -1420,6 +1474,127 @@ window.__ModuleLoader__.load({
1420
1474
  });
1421
1475
  }
1422
1476
  //#endregion
1477
+ //#region src/cn-gateway.ts
1478
+ /**
1479
+ * The CN region's gateway host, and the ONE place an override is validated.
1480
+ *
1481
+ * ## Why this exists (issue #220)
1482
+ *
1483
+ * The CN chat gateway was the single hard-coded constant
1484
+ * `https://copilot.tencent.com`. In a corporate network that filters on the TLS
1485
+ * ClientHello's SNI, that name is reset before the handshake completes — while
1486
+ * the SAME network lets the WorkBuddy desktop app work, because the app reads a
1487
+ * failover list from its own config and uses `wb.tencentbuddy.com` as well.
1488
+ *
1489
+ * The reporter measured (2026-11-06): `copilot.tencent.com` answers
1490
+ * `ECONNRESET` in <100ms while `wb.tencentbuddy.com` answers a normal
1491
+ * `401 Authorization Required`. This module is what lets such a user point the
1492
+ * plugin at a host their network actually permits.
1493
+ *
1494
+ * ## Why an allowlist, and not "any URL you like"
1495
+ *
1496
+ * The value feeds `Authorization: Bearer <token>` on every CN request, plus the
1497
+ * refresh-token exchange. A free-form base is therefore a **credential
1498
+ * exfiltration primitive**: whoever can edit the settings (a synced profile, a
1499
+ * shared dotfile, a pasted "fix" from a forum post) could redirect a live
1500
+ * WorkBuddy token to a host they run. That is a strictly worse failure than the
1501
+ * timeout it fixes, and it is invisible — the requests would keep succeeding.
1502
+ *
1503
+ * So the override names a HOST from a closed set, never a URL from the open
1504
+ * internet. The set is the CN product's own brand registrable domains, measured
1505
+ * 2026-11-06 to answer the chat, billing, catalog and busy routes identically
1506
+ * (see `docs/CN_GATEWAY_FALLBACK.md`):
1507
+ *
1508
+ * copilot.tencent.com the shipping default
1509
+ * wb.tencentbuddy.com what the desktop app's failover.json lists
1510
+ * www.workbuddy.cn the brand host
1511
+ * www.codebuddy.cn the sibling brand host, also the billing base
1512
+ *
1513
+ * Each is admitted by REGISTRABLE domain, so any subdomain of those brands
1514
+ * qualifies and a lookalike (`wb.tencentbuddy.com.evil.example`) cannot —
1515
+ * the same rule `knownRegionOf` already applies to credential domains.
1516
+ *
1517
+ * ## What an override does NOT change
1518
+ *
1519
+ * `Origin` / `Referer` stay on the billing base (see `originReferer`): they
1520
+ * describe which web app the request comes from, not which socket it reaches.
1521
+ * Rewriting them from the override would make the identity claim disagree with
1522
+ * itself for no benefit — the gateway reads them as "this is the CN web app".
1523
+ *
1524
+ * @module dsh-connect-workbuddy/cn-gateway
1525
+ */
1526
+ /** The CN chat gateway the plugin has always used. */
1527
+ const CN_GATEWAY_DEFAULT = "https://copilot.tencent.com";
1528
+ /**
1529
+ * Hosts an override may name, as registrable domains.
1530
+ *
1531
+ * A closed set is the security boundary described in this module's header. Adding
1532
+ * a host here is a deliberate act that must come with a measurement showing it
1533
+ * answers the CN routes, not with a guess about the brand.
1534
+ */
1535
+ const ALLOWED_CN_DOMAINS = [
1536
+ "copilot.tencent.com",
1537
+ "tencentbuddy.com",
1538
+ "workbuddy.cn",
1539
+ "codebuddy.cn"
1540
+ ];
1541
+ /**
1542
+ * Whether `hostname` belongs to one of the CN brands above.
1543
+ *
1544
+ * Matched on the registrable domain (`host === domain` or `host.endsWith('.' +
1545
+ * domain)`), so `wb.tencentbuddy.com` and `copilot.internal.tencentbuddy.com`
1546
+ * both qualify while `tencentbuddy.com.evil.example` does not.
1547
+ */
1548
+ function isKnownCnHost(hostname) {
1549
+ const lowered = hostname.trim().toLowerCase();
1550
+ if (lowered === "") return false;
1551
+ return ALLOWED_CN_DOMAINS.some((domain) => lowered === domain || lowered.endsWith(`.${domain}`));
1552
+ }
1553
+ /**
1554
+ * Resolve the CN gateway base from an optional user-supplied value.
1555
+ *
1556
+ * An ABSENT or blank value is the normal case and yields the default with
1557
+ * `overridden: false`. A non-blank value must pass every check or the caller
1558
+ * gets `ok: false` and is expected to say so rather than silently falling back:
1559
+ * a user who typed a host and got the default anyway has no way to tell the
1560
+ * setting was ignored, and would keep debugging a network they already fixed.
1561
+ */
1562
+ function resolveCnGateway(value) {
1563
+ const raw = typeof value === "string" ? value.trim() : "";
1564
+ if (raw === "") return {
1565
+ ok: true,
1566
+ base: CN_GATEWAY_DEFAULT,
1567
+ host: "copilot.tencent.com",
1568
+ overridden: false
1569
+ };
1570
+ let parsed;
1571
+ try {
1572
+ parsed = new URL(raw);
1573
+ } catch {
1574
+ return {
1575
+ ok: false,
1576
+ reason: "malformed",
1577
+ value: raw
1578
+ };
1579
+ }
1580
+ if (parsed.protocol !== "https:") return {
1581
+ ok: false,
1582
+ reason: "insecure",
1583
+ value: raw
1584
+ };
1585
+ if (!isKnownCnHost(parsed.hostname)) return {
1586
+ ok: false,
1587
+ reason: "unknown-host",
1588
+ value: raw
1589
+ };
1590
+ return {
1591
+ ok: true,
1592
+ base: `https://${parsed.hostname.toLowerCase()}`,
1593
+ host: parsed.hostname.toLowerCase(),
1594
+ overridden: true
1595
+ };
1596
+ }
1597
+ //#endregion
1423
1598
  //#region src/client/panel-switch.ts
1424
1599
  /**
1425
1600
  * Whether the OPTIONAL sidebar panel is switched on, as the browser half sees
@@ -6289,6 +6464,59 @@ window.__ModuleLoader__.load({
6289
6464
  * of the 16px gap, and the panel's first block (the pool, with its own 16px top
6290
6465
  * padding) added a third layer. */
6291
6466
  .dsm-workbuddy-panel{margin:0}
6467
+ /* THE CAPABILITIES PANEL IS A COLUMN OF GROUPS, not a run of paragraphs.
6468
+ *
6469
+ * Measured before this rule existed: the panel was display:block with
6470
+ * gap:normal, so its six blocks had NO space between them at all and the
6471
+ * rhythm was being improvised by whatever padding each block happened to carry
6472
+ * — ink-to-ink the gaps read 12 / 50 / 2 / 17 / 0 px. The 50px hole sat between
6473
+ * the gateway card and the first switch (the card's own 10px bottom padding plus
6474
+ * .prefs' 2px top), and the 2px squeeze sat between two switch groups that are
6475
+ * different KINDS of setting. Neither number was chosen; both fell out of the
6476
+ * order the blocks happen to be written in.
6477
+ *
6478
+ * One gap now owns the rhythm, and every group drops the ad-hoc padding it used
6479
+ * to fake it. 18px is the same step the rest of this card uses between
6480
+ * distinctly different things, and it is large enough to separate two groups of
6481
+ * switches WITHOUT a divider — which is why the one divider that used to sit
6482
+ * above the first upstream switch was deleted rather than kept: once the panel
6483
+ * owns 18px, a border plus 10px of its own padding became a third spacing
6484
+ * statement in the same 20px of air (measured 69px ink-to-ink against 18px
6485
+ * everywhere else, the single visible hole in the panel). */
6486
+ /* THE ID IS THE HOOK, not a second class name.
6487
+ *
6488
+ * Every panel in this card renders as plain dsm-workbuddy-panel; none of them
6489
+ * carries a per-panel class. A rule written as
6490
+ * .dsm-workbuddy-panel-capabilities{...} therefore matches NOTHING — it parses,
6491
+ * ships, and does nothing at all, which is the worst failure mode available
6492
+ * here because the panel keeps looking slightly wrong and the CSS looks right.
6493
+ * #dsm-workbuddy-panel-capabilities is the attribute that actually exists on
6494
+ * the element. */
6495
+ #dsm-workbuddy-panel-capabilities{display:flex;flex-direction:column;gap:18px}
6496
+ /* THE PANEL MUST STILL BE HIDEABLE (regression fix, 5.20.1).
6497
+ *
6498
+ * An ID selector outranks the UA sheet's [hidden]{display:none} on
6499
+ * specificity (1,0,0 vs 0,1,0), so adding display:flex above made the
6500
+ * capabilities panel IGNORE its own hidden attribute. Result: it painted
6501
+ * permanently and, being later in the DOM, covered the diagnostics and SDK
6502
+ * panels entirely — clicking those tabs appeared to do nothing.
6503
+ *
6504
+ * The measure is simple: a panel that is hidden must never be displayed,
6505
+ * whatever other rules set. Both declarations are needed and neither is
6506
+ * redundant — display:none wins the cascade, and !important is what stops
6507
+ * the same thing recurring the next time someone gives a panel a display value.
6508
+ *
6509
+ * Why the shot tool did not catch it: tools/capabilities-shot.tsx hides the
6510
+ * other panels with display:none!important so the section can be measured in
6511
+ * one screenful. That override masked this exact bug — the harness was fixing
6512
+ * the thing it was supposed to observe. The tool no longer forces display on
6513
+ * the panel, and tests/capabilities-layout.spec.tsx now pins that a hidden
6514
+ * panel stays hidden. */
6515
+ #dsm-workbuddy-panel-capabilities[hidden]{display:none!important}
6516
+ /* The note keeps the panel's gap like every other block: a special-cased
6517
+ tighter gap here would be one more number to decode, and the panel's own
6518
+ rhythm is what this rule exists to establish. */
6519
+ #dsm-workbuddy-panel-capabilities > .dsm-workbuddy-panel-note{margin:0}
6292
6520
  /* DIAGNOSTICS: a two-column fact table rather than prose. Each row is one thing
6293
6521
  * the card actually READ, so a bug report can quote a line instead of
6294
6522
  * paraphrasing the UI. No control lives here on purpose — a diagnostics panel
@@ -6323,20 +6551,73 @@ window.__ModuleLoader__.load({
6323
6551
  * (the dsm-workbuddy-models-summary class) has no side padding, so copying the
6324
6552
  * reference's 2px would leave the two edges 2px apart — a difference too small
6325
6553
  * to name and just big enough to look unaligned. */
6326
- .dsm-workbuddy-prefs{display:flex;flex-direction:column;gap:14px;padding:2px 0 0}
6554
+ .dsm-workbuddy-prefs{display:flex;flex-direction:column;gap:14px;padding:0}
6555
+ /* THE GROUP'S LEAD LINE BELONGS TO THE ROW UNDER IT (5.20.0).
6556
+ *
6557
+ * Every group opens with one sentence saying what the switches beneath it
6558
+ * control. With the group's uniform 14px gap, that sentence sat as far from its
6559
+ * first row as two rows sit from each other — measured 14px on all four groups,
6560
+ * identical to the row-to-row distance — so it read as a paragraph of body text
6561
+ * that happened to precede the list rather than as the list's heading.
6562
+ *
6563
+ * Pulling it 6px closer makes the pair visible as a pair without introducing a
6564
+ * new step: the group's own rows stay 14px apart, the lead sits 8px from its
6565
+ * first row, and the 18px panel gap still separates one group from the next. */
6566
+ .dsm-workbuddy-prefs > .dsm-workbuddy-pref-hint:first-child{margin-bottom:-6px}
6327
6567
  .dsm-workbuddy-pref{display:flex;align-items:flex-start;gap:10px;font-size:13px;line-height:18px;color:var(--dsw-alias-label-secondary,#c6c9d0);cursor:pointer}
6328
6568
  /* The platform's own checkbox, themed only with accent-color. A hand-drawn box
6329
6569
  was tried on this card and reverted: brand-primary resolves to the host's
6330
6570
  CONTRAST colour, so a ticked box painted itself as a heavy black pill — the
6331
6571
  loudest object in a section made of plain 13px text. */
6332
6572
  .dsm-workbuddy-pref input{flex:none;cursor:pointer;accent-color:var(--dsw-alias-brand-primary,#5686fe)}
6573
+ /* ── The CN gateway override (issue #220) ─────────────────────────────────────
6574
+ * One bordered block so it does not read as a fifth switch: every other control
6575
+ * in this section is a checkbox that commits on the click, this one is a text
6576
+ * field that needs an explicit Save. Giving it a card of its own is what says
6577
+ * "this answers a different question".
6578
+ *
6579
+ * The 25px LEFT padding is the same indent .dsm-workbuddy-pref-indent uses
6580
+ * (15px checkbox + 10px row gap): it puts the card's title on the same left edge
6581
+ * as every switch LABEL in the panel below it, measured 318px vs 330px before
6582
+ * this value existed. A bordered box whose text starts 12px left of the text
6583
+ * beside it reads as a misaligned column, not as a card.
6584
+ *
6585
+ * The row wraps, and the input takes the whole width when it does: a host name is
6586
+ * long (https://wb.tencentbuddy.com is 26 characters) and a half-width input in
6587
+ * the panel column would show about eight of them. */
6588
+ .dsm-workbuddy-cnbase{display:flex;flex-direction:column;gap:8px;padding:10px 12px 10px 25px;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:10px;background:var(--dsw-alias-bg-layer-2,#24262c)}
6589
+ /* SAME TYPOGRAPHY AS A SWITCH ROW (13px/18px).
6590
+ *
6591
+ * Measured before this rule: the card's title rendered at 16px while every
6592
+ * switch label in the same panel rendered at 13px. The cause is structural
6593
+ * rather than a wrong number — a switch row gets its 13px from
6594
+ * .dsm-workbuddy-pref, and this row is NOT a .dsm-workbuddy-pref (it stacks
6595
+ * its label above a text field instead of sitting beside a 15px box), so it
6596
+ * inherited the page's 16px instead. One group rendering a size nobody chose is
6597
+ * exactly the kind of defect a screenshot shows and nobody can name. */
6598
+ .dsm-workbuddy-cnbase-row{display:flex;flex-direction:column;gap:8px;font-size:13px;line-height:18px;color:var(--dsw-alias-label-secondary,#c6c9d0)}
6599
+ .dsm-workbuddy-cnbase-input{box-sizing:border-box;width:100%;padding:6px 10px;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:8px;background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:13px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
6600
+ .dsm-workbuddy-cnbase-input:disabled{opacity:.5;cursor:default}
6601
+ .dsm-workbuddy-cnbase-input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}
6602
+ .dsm-workbuddy-cnbase-error{margin:0;font-size:12px;line-height:17px;color:var(--dsw-alias-state-error-primary,#ef4444)}
6603
+ .dsm-workbuddy-cnbase-notice{margin:0;font-size:12px;line-height:17px;color:var(--dsw-alias-state-success-primary,#22a06b)}
6604
+ .dsm-workbuddy-cnbase-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}
6333
6605
  .dsm-workbuddy-pref-check,.dsm-workbuddy-image-tool-check,.dsm-workbuddy-video-tool-check,.dsm-workbuddy-cli-bridge-check,.dsm-workbuddy-sidebar-panel-check,.dsm-workbuddy-upstream-check,.dsm-workbuddy-channel-continue-check{inline-size:15px;block-size:15px;margin:3px 0 0}
6334
6606
  /* The upstream-identity switches are their own group, so they get a divider
6335
6607
  above them instead of relying on spacing alone: they change the request the
6336
6608
  whole plugin sends, not a per-region display choice, and reading them as the
6337
6609
  tail of the preference list would misrepresent what flipping one costs. */
6338
- .dsm-workbuddy-upstream-pref{margin-top:4px}
6339
- .dsm-workbuddy-upstream-pref:first-of-type{border-top:1px solid var(--dsw-alias-bg-layer-3,#2e3034);padding-top:10px}
6610
+ /* The divider above the first upstream switch is GONE as of 5.20.0.
6611
+ *
6612
+ * It was doing double duty: separating "what this tab shows" from "what the
6613
+ * plugin sends" AND propping up a panel that had no gap of its own. Once
6614
+ * #dsm-workbuddy-panel-capabilities owns the rhythm at 18px, the border plus its
6615
+ * 10px padding became a third spacing statement in the same 20px of air —
6616
+ * measured ink-to-ink 69px against 18px everywhere else, i.e. the one visible
6617
+ * hole in the panel. The semantic break it marked is still real, and it is now
6618
+ * expressed the way the rest of the panel expresses it: one group, one gap.
6619
+ * The 4px that remains is optical only, between the group's own rows. */
6620
+ .dsm-workbuddy-upstream-pref{margin-top:0}
6340
6621
  .dsm-workbuddy-pref input:disabled{cursor:default}
6341
6622
  .dsm-workbuddy-pref:has(input:disabled){opacity:.6;cursor:default}
6342
6623
  /* The NAME and what it does are TWO lines, not one wrapped blob: first what the
@@ -6530,9 +6811,12 @@ window.__ModuleLoader__.load({
6530
6811
  /* ISSUE #198 — the model row's controls MUST WRAP.
6531
6812
 
6532
6813
  The row carries four groups on one line: the name, the two checkboxes, the
6533
- context-budget radio group, and the test/measure buttons. The budget group had
6534
- flex:none and the row had no flex-wrap, so on a narrow card (dsh-go on a
6535
- phone, a ~360 px settings panel) the row's intrinsic width exceeded the
6814
+ context-budget control, and the test/measure buttons. (It was a radio GROUP;
6815
+ as of 5.20.2 it is one select, which cannot wrap or clip internally — but the
6816
+ row still has to wrap, because the four groups together are what overflow.)
6817
+ The budget control had flex:none and the row had no flex-wrap, so on a narrow
6818
+ card (dsh-go on a phone, a ~360 px settings panel) the row's intrinsic width
6819
+ exceeded the
6536
6820
  container and the model list's overflow:hidden CLIPPED THE REST — the third
6537
6821
  radio (「模型原生窗口」, e.g. 1M) was neither visible nor clickable, and the
6538
6822
  largest budget a user could pick looked like 500K. A control that is clipped is
@@ -6611,9 +6895,28 @@ window.__ModuleLoader__.load({
6611
6895
  the clipping bug, and flex-wrap is the other half — a 1.048M label is wider
6612
6896
  than 200K. Left-aligning the group under the media query makes the group
6613
6897
  own its line on a phone instead of dangling at the right edge. */
6614
- .dsm-workbuddy-context-budget{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:12px;row-gap:6px;flex:none;margin:0;padding:0;border:0;color:var(--dsw-alias-label-secondary,#c6c9d0);font-size:11px;line-height:16px}
6615
- .dsm-workbuddy-context-budget label{display:inline-flex;align-items:center;gap:4px;cursor:pointer;white-space:nowrap}
6616
- .dsm-workbuddy-context-budget input{margin:0;accent-color:var(--dsw-alias-brand-primary,#5686fe)}
6898
+ /* ONE SELECT, NOT A ROW OF RADIOS.
6899
+ *
6900
+ * It was a wrapping flex row of three radios. In the Settings column (564px,
6901
+ * of which the model row already spends ~300px on the id/speed column) those
6902
+ * three wrapped onto a second line, and a wrapped row of radios reads as three
6903
+ * independent switches rather than as one choice.
6904
+ *
6905
+ * A FIXED min-inline-size keeps the three rows' columns aligned. Without it the
6906
+ * control sizes to its widest option, so a model offering only 192K drew a
6907
+ * 56px control while its neighbours drew 58px and the left edges stepped by 2px
6908
+ * down the list — the same misalignment the wrapped radios had, in miniature.
6909
+ *
6910
+ * Being a <select>, this is now a single fixed-width control that cannot wrap,
6911
+ * and the native dropdown is what the platform draws — so the styling here is
6912
+ * only about the closed state: the same 11px secondary text the radios used, a
6913
+ * chevron the platform provides, and a chevron-affordance gap.
6914
+ *
6915
+ * flex:none matters: the row is a flex line, and a select that grows steals
6916
+ * width from the model name beside it. */
6917
+ .dsm-workbuddy-context-budget{flex:none;margin:0;min-inline-size:58px;padding:2px 4px;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:6px;background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-secondary,#c6c9d0);font-family:inherit;font-size:11px;line-height:16px;cursor:pointer}
6918
+ .dsm-workbuddy-context-budget:disabled{cursor:default;opacity:.6}
6919
+ .dsm-workbuddy-context-budget:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}
6617
6920
  .dsm-workbuddy-model-capability-note{margin:0;color:var(--dsw-alias-label-tertiary,#999);font-size:12px;line-height:18px}
6618
6921
  /* Model probe (test button + result). The result line is its own row under the
6619
6922
  meta line, because a cooldown sentence ("rate limited - the upstream gave no
@@ -7165,7 +7468,7 @@ window.__ModuleLoader__.load({
7165
7468
  wrapped two-tier group reads as a stray fragment under the buttons, and the tier
7166
7469
  the user is trying to find — the native window — is the last label in the group,
7167
7470
  so the line has to start at the left to have room to end at all. */
7168
- @media (max-width:760px){.dsm-workbuddy-context-budget{flex:1 1 100%;justify-content:flex-start}}
7471
+
7169
7472
  /* Pool switch, namespaced under .dsm-workbuddy-pool so it cannot collide with host styles. */
7170
7473
  .dsm-workbuddy-pool .sw{position:relative;display:inline-block;width:38px;height:22px;flex:none;cursor:pointer}
7171
7474
  .dsm-workbuddy-pool .sw input{position:absolute;opacity:0;width:0;height:0}
@@ -8462,6 +8765,15 @@ window.__ModuleLoader__.load({
8462
8765
  const [sidebarPanelOn, setSidebarPanelOn] = (0, react.useState)(void 0);
8463
8766
  const [sidebarPanelBusy, setSidebarPanelBusy] = (0, react.useState)(false);
8464
8767
  /**
8768
+ * The CN gateway editor's draft (issue #220). `undefined` = "not edited", so
8769
+ * the field shows the SAVED value and a background refresh cannot overwrite
8770
+ * what the user is typing — the same rule the model drafts follow.
8771
+ */
8772
+ const [cnBaseDraft, setCnBaseDraft] = (0, react.useState)(void 0);
8773
+ const [cnBaseSaving, setCnBaseSaving] = (0, react.useState)(false);
8774
+ const [cnBaseError, setCnBaseError] = (0, react.useState)(void 0);
8775
+ const [cnBaseNotice, setCnBaseNotice] = (0, react.useState)(void 0);
8776
+ /**
8465
8777
  * The quick-adjust pins of the CLI route (model, effort, region order) made
8466
8778
  * by THIS card instance.
8467
8779
  *
@@ -10122,25 +10434,142 @@ window.__ModuleLoader__.load({
10122
10434
  * NOT gated on the active tab's provider: the row is a property of the whole
10123
10435
  * plugin, not of one region, and a signed-out card can still turn it on.
10124
10436
  */
10125
- const sidebarPanelPreference = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10126
- className: "dsm-workbuddy-pref",
10127
- title: t("row.sidebarPanelHint"),
10128
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10129
- type: "checkbox",
10130
- className: "dsm-workbuddy-sidebar-panel-check",
10131
- checked: sidebarPanelSwitchedOn(),
10132
- disabled: !canWrite || saving || poolBusy || sidebarPanelBusy,
10133
- onChange: (event) => {
10134
- toggleSidebarPanel(event.target.checked);
10437
+ /**
10438
+ * The CN gateway override editor (issue #220).
10439
+ *
10440
+ * A DRAFT + explicit Save, unlike the switches above it: a host name is typed,
10441
+ * so committing per keystroke would write `https://w`, `https://wb`, … — six
10442
+ * settings writes and six `warn` log lines for one word. The switches commit on
10443
+ * the click precisely because a click IS a complete statement; a text field is
10444
+ * not.
10445
+ *
10446
+ * CN only. The international gateways follow the credential's own brand domain
10447
+ * (`workbuddy.ai` / `codebuddy.ai`), where an override against a host of a
10448
+ * DIFFERENT brand is rejected by the upstream — there is no "equivalent host"
10449
+ * to fall back to, so the control is absent on that tab rather than present and
10450
+ * unusable.
10451
+ *
10452
+ * The draft is validated HERE and not by the Host: the Host falls back to the
10453
+ * built-in gateway and logs, which keeps a running process correct but tells a
10454
+ * half-attending user nothing. Refusing the save with the specific rule it
10455
+ * broke ("not https" vs "not a CN brand") is what makes the setting findable.
10456
+ */
10457
+ const cnBaseSaved = regionCnBaseOf(settingsScope?.getSnapshot().value, "cn");
10458
+ const cnBaseDraftValue = cnBaseDraft ?? cnBaseSaved;
10459
+ const cnBaseDirty = cnBaseDraft !== void 0 && cnBaseDraft.trim() !== cnBaseSaved.trim();
10460
+ const cnBasePreview = resolveCnGateway(cnBaseDraftValue);
10461
+ const saveCnBase = async () => {
10462
+ if (settingsScope === void 0 || cnBaseSaving) return;
10463
+ const resolved = cnBasePreview;
10464
+ if (!resolved.ok) {
10465
+ setCnBaseError(resolved.reason === "malformed" ? t("row.cnBaseInvalidMalformed") : resolved.reason === "insecure" ? t("row.cnBaseInvalidInsecure") : t("row.cnBaseInvalidHost"));
10466
+ return;
10467
+ }
10468
+ setCnBaseSaving(true);
10469
+ setCnBaseError(void 0);
10470
+ try {
10471
+ const next = resolved.overridden ? resolved.base : "";
10472
+ await writeRegionCnBase(settingsScope, "cn", next, nextRegionCnBase(settingsScope.getSnapshot().value, "cn", next));
10473
+ if (mounted.current) {
10474
+ setCnBaseDraft(void 0);
10475
+ setCnBaseNotice(t(next === "" ? "row.cnBaseCleared" : "row.cnBaseSaved"));
10135
10476
  }
10136
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10137
- className: "dsm-workbuddy-pref-copy",
10138
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10139
- className: "dsm-workbuddy-pref-label",
10140
- children: t("row.sidebarPanelLabel")
10141
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10142
- className: "dsm-workbuddy-pref-hint",
10143
- children: t("row.sidebarPanelHint")
10477
+ await refreshUsage("cn");
10478
+ } catch (error) {
10479
+ if (mounted.current) setCnBaseError(error instanceof Error ? error.message : t("row.requestFailed"));
10480
+ } finally {
10481
+ if (mounted.current) setCnBaseSaving(false);
10482
+ }
10483
+ };
10484
+ const cnBasePreference = activeRegion !== "cn" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10485
+ className: "dsm-workbuddy-cnbase",
10486
+ title: t("row.cnBaseHint"),
10487
+ children: [
10488
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10489
+ className: "dsm-workbuddy-cnbase-row",
10490
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10491
+ className: "dsm-workbuddy-pref-copy",
10492
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10493
+ className: "dsm-workbuddy-pref-label",
10494
+ children: t("row.cnBaseLabel")
10495
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10496
+ className: "dsm-workbuddy-pref-hint",
10497
+ children: t("row.cnBaseHint")
10498
+ })]
10499
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10500
+ type: "url",
10501
+ className: "dsm-workbuddy-cnbase-input",
10502
+ value: cnBaseDraftValue,
10503
+ placeholder: t("row.cnBasePlaceholder"),
10504
+ disabled: !canWrite || saving || cnBaseSaving,
10505
+ spellCheck: false,
10506
+ autoComplete: "off",
10507
+ onChange: (event) => {
10508
+ setCnBaseDraft(event.target.value);
10509
+ setCnBaseError(void 0);
10510
+ setCnBaseNotice(void 0);
10511
+ }
10512
+ })]
10513
+ }),
10514
+ cnBaseError !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10515
+ className: "dsm-workbuddy-cnbase-error",
10516
+ role: "alert",
10517
+ children: cnBaseError
10518
+ }) : null,
10519
+ cnBaseError === void 0 && cnBaseNotice !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10520
+ className: "dsm-workbuddy-cnbase-notice",
10521
+ role: "status",
10522
+ children: cnBaseNotice
10523
+ }) : null,
10524
+ cnBaseDirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10525
+ className: "dsm-workbuddy-cnbase-actions",
10526
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10527
+ type: "button",
10528
+ className: "dsm-btn dsm-btn-outline",
10529
+ disabled: cnBaseSaving,
10530
+ onClick: () => {
10531
+ setCnBaseDraft(void 0);
10532
+ setCnBaseError(void 0);
10533
+ setCnBaseNotice(void 0);
10534
+ },
10535
+ children: t("row.poolDiscard")
10536
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10537
+ type: "button",
10538
+ className: "dsm-btn dsm-btn-primary",
10539
+ disabled: cnBaseSaving,
10540
+ onClick: () => {
10541
+ saveCnBase();
10542
+ },
10543
+ children: cnBaseSaving ? t("row.poolSaving") : t("row.poolSaved")
10544
+ })]
10545
+ }) : null
10546
+ ]
10547
+ });
10548
+ const sidebarPanelPreference = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10549
+ className: "dsm-workbuddy-prefs",
10550
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10551
+ className: "dsm-workbuddy-pref-hint",
10552
+ children: t("row.sidebarPanelLead")
10553
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10554
+ className: "dsm-workbuddy-pref",
10555
+ title: t("row.sidebarPanelHint"),
10556
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10557
+ type: "checkbox",
10558
+ className: "dsm-workbuddy-sidebar-panel-check",
10559
+ checked: sidebarPanelSwitchedOn(),
10560
+ disabled: !canWrite || saving || poolBusy || sidebarPanelBusy,
10561
+ onChange: (event) => {
10562
+ toggleSidebarPanel(event.target.checked);
10563
+ }
10564
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10565
+ className: "dsm-workbuddy-pref-copy",
10566
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10567
+ className: "dsm-workbuddy-pref-label",
10568
+ children: t("row.sidebarPanelLabel")
10569
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10570
+ className: "dsm-workbuddy-pref-hint",
10571
+ children: t("row.sidebarPanelHint")
10572
+ })]
10144
10573
  })]
10145
10574
  })]
10146
10575
  });
@@ -10364,9 +10793,12 @@ window.__ModuleLoader__.load({
10364
10793
  * to be exactly 3, so an unvalidated free-text field here would be a second way
10365
10794
  * to get it wrong.
10366
10795
  */
10367
- const channelRejectContinuePreference = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10796
+ const channelRejectContinuePreference = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10368
10797
  className: "dsm-workbuddy-prefs",
10369
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10798
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10799
+ className: "dsm-workbuddy-pref-hint",
10800
+ children: t("row.channelRejectHint")
10801
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
10370
10802
  className: "dsm-workbuddy-pref dsm-workbuddy-upstream-pref",
10371
10803
  title: t("row.channelRejectContinueHint"),
10372
10804
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
@@ -10402,11 +10834,15 @@ window.__ModuleLoader__.load({
10402
10834
  }) : null
10403
10835
  ]
10404
10836
  })]
10405
- })
10837
+ })]
10406
10838
  });
10407
10839
  const creditPreferences = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10408
10840
  className: "dsm-workbuddy-prefs",
10409
10841
  children: [
10842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10843
+ className: "dsm-workbuddy-pref-hint",
10844
+ children: t("row.modelToolsHint")
10845
+ }),
10410
10846
  cliBridgePreference,
10411
10847
  cliBridgeSwitchedOn() ? cliBridgePickers : null,
10412
10848
  imageToolPreference,
@@ -10854,43 +11290,28 @@ window.__ModuleLoader__.load({
10854
11290
  }) : null
10855
11291
  ]
10856
11292
  }),
10857
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
11293
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
10858
11294
  className: "dsm-workbuddy-context-budget",
10859
11295
  "aria-label": t("row.contextBudget"),
11296
+ value: String(effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id])),
11297
+ disabled: !canWrite || saving,
11298
+ onChange: (event) => {
11299
+ const picked = Number(event.target.value);
11300
+ setContextBudget(model.id, picked === model.nativeContextWindow ? void 0 : picked);
11301
+ },
10860
11302
  children: [
10861
- model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10862
- type: "radio",
10863
- name: `context-${model.id}`,
10864
- checked: effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id]) === 2e5,
10865
- disabled: !canWrite || saving,
10866
- onChange: () => {
10867
- setContextBudget(model.id, 2e5);
10868
- }
10869
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "200K" })] }) : null,
10870
- model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10871
- type: "radio",
10872
- name: `context-${model.id}`,
10873
- checked: effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id]) === 5e5,
10874
- disabled: !canWrite || saving,
10875
- onChange: () => {
10876
- setContextBudget(model.id, 5e5);
10877
- }
10878
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "500K" })] }) : null,
10879
- model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10880
- type: "radio",
10881
- name: `context-${model.id}`,
10882
- checked: effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id]) === model.nativeContextWindow,
10883
- disabled: !canWrite || saving,
10884
- onChange: () => {
10885
- setContextBudget(model.id, void 0);
10886
- }
10887
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
10888
- type: "radio",
10889
- name: `context-${model.id}`,
10890
- checked: true,
10891
- disabled: true,
10892
- onChange: () => {}
10893
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) })] })
11303
+ model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11304
+ value: 2e5,
11305
+ children: "200K"
11306
+ }) : null,
11307
+ model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11308
+ value: 5e5,
11309
+ children: "500K"
11310
+ }) : null,
11311
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11312
+ value: model.nativeContextWindow,
11313
+ children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown"))
11314
+ })
10894
11315
  ]
10895
11316
  }),
10896
11317
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -11037,6 +11458,7 @@ window.__ModuleLoader__.load({
11037
11458
  className: "dsm-workbuddy-panel-note",
11038
11459
  children: t("row.panelCapabilitiesHint")
11039
11460
  }),
11461
+ cnBasePreference,
11040
11462
  creditPreferences,
11041
11463
  upstreamSwitches,
11042
11464
  channelRejectContinuePreference,
@@ -11072,6 +11494,19 @@ window.__ModuleLoader__.load({
11072
11494
  children: status.domain === void 0 || status.domain === "" ? t("row.modelUnknown") : status.domain
11073
11495
  })]
11074
11496
  }),
11497
+ status.region === "cn" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11498
+ className: "dsm-workbuddy-diag-row",
11499
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11500
+ className: "dsm-workbuddy-diag-label",
11501
+ children: t("row.diagCnBase")
11502
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11503
+ className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-mono",
11504
+ children: (() => {
11505
+ const resolved = resolveCnGateway(regionCnBaseOf(settingsScope?.getSnapshot().value, "cn"));
11506
+ return resolved.ok && resolved.overridden ? resolved.base : t("row.diagCnBaseDefault");
11507
+ })()
11508
+ })]
11509
+ }) : null,
11075
11510
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11076
11511
  className: "dsm-workbuddy-diag-row",
11077
11512
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -13102,7 +13537,7 @@ window.__ModuleLoader__.load({
13102
13537
  "row.panelAccounts": "Accounts",
13103
13538
  "row.panelModels": "Models",
13104
13539
  "row.panelCapabilities": "Capabilities",
13105
- "row.panelCapabilitiesHint": "What the plugin may do on your behalf. Each switch takes effect on the click — there is no Save button in this section.",
13540
+ "row.panelCapabilitiesHint": "What the plugin may do on your behalf. The switches take effect on the click — there is no Save button for them. The one field at the top (the CN gateway) is a draft and saves on its own button, because a half-typed host must never become the live one.",
13106
13541
  "row.panelDiag": "Diagnostics",
13107
13542
  "row.panelAria": "Card sections",
13108
13543
  "row.diagHint": "What this card actually read, so a report can quote it. Nothing here changes a setting.",
@@ -13458,6 +13893,9 @@ window.__ModuleLoader__.load({
13458
13893
  "sdk.dirHint": "Point this at the desktop app's native/turing-sdk folder, not the folder holding WorkBuddy.exe. Saving re-probes immediately; a wrong path turns the state above into \"not found\" with that path shown, never a silent fall back to discovery. WORKBUDDY_TURING_SDK_DIR still wins.",
13459
13894
  "sdk.fallbackLabel": "Fall back to the virtual device when no real one is available",
13460
13895
  "sdk.fallbackHint": "On: when the SDK is unavailable (no desktop app, wrong directory, no token) the plugin sends the salt-derived virtual device pair instead, and the tier shown changes to “Virtual” with it — it never claims to be real. Off: no device header is sent at all, which is what the Real tier did before this switch.",
13896
+ "row.modelToolsHint": "These three decide what the model may DO on this tab: which commands it can run, and whether it can spend credits generating images or video. Each takes effect on the click.",
13897
+ "row.channelRejectHint": "One switch, on its own because it is the only one here that spends a real request every time it fires. Read its description before turning it on.",
13898
+ "row.sidebarPanelLead": "Where the card itself appears. This one only affects navigation — it changes no request and spends nothing.",
13461
13899
  "row.upstreamHint": "These change what the gateway sees, not which provider serves the call. All of them are sampled when the plugin mounts, so reload the plugin (or restart DSH) after changing one.",
13462
13900
  "row.usageIdentityLabel": "Make the usage page record these calls like the official client",
13463
13901
  "row.usageIdentityHint": "Adds the X-IDE-* headers (which fill the 使用端 column, otherwise blank) and sends conversation ids as 32-hex UUIDv7. Display alignment only: the User-Agent and the request body never change. Off by default because the evidence comes from a reporter, not from this plugin.",
@@ -13473,6 +13911,16 @@ window.__ModuleLoader__.load({
13473
13911
  "row.channelRejectContinueText": "Text sent:",
13474
13912
  "row.cliBridgeLabel": "Let the local CodeBuddy CLI do the work",
13475
13913
  "row.cliBridgeHint": "Adds the codebuddy_ask tool and the /codebuddy command. Each call spends CodeBuddy quota. injectResult only affects /codebuddy — its result is injected back into the session, costing one DSH turn when the session is idle; tool calls never read it. Rate-limited: 6 turns per session per hour, 20 per process per hour, one turn at a time. Off by default.",
13914
+ "row.cnBaseLabel": "CN gateway host",
13915
+ "row.cnBaseHint": "Leave empty to use copilot.tencent.com. Set it only if your network resets that host by TLS SNI (connection fails in milliseconds while the WorkBuddy desktop app still works) — the app itself falls back to wb.tencentbuddy.com. Accepted hosts: any subdomain of copilot.tencent.com, tencentbuddy.com, workbuddy.cn or codebuddy.cn, over https. Chat, billing, catalog and check-in all follow it; your account and region do not change.",
13916
+ "row.cnBasePlaceholder": "https://wb.tencentbuddy.com",
13917
+ "row.cnBaseInvalidMalformed": "That is not a full URL. Include https:// and the host, e.g. https://wb.tencentbuddy.com",
13918
+ "row.cnBaseInvalidInsecure": "Only https is accepted — a plaintext host would send your token in the clear.",
13919
+ "row.cnBaseInvalidHost": "That host is not one of the CN brands. Use a subdomain of copilot.tencent.com, tencentbuddy.com, workbuddy.cn or codebuddy.cn.",
13920
+ "row.cnBaseSaved": "CN gateway saved. New requests use it; originals/CORS headers keep naming the CN web app.",
13921
+ "row.cnBaseCleared": "Back to the built-in CN gateway.",
13922
+ "row.diagCnBase": "CN gateway",
13923
+ "row.diagCnBaseDefault": "built-in (copilot.tencent.com)",
13476
13924
  "row.sidebarPanelLabel": "Show WorkBuddy in the sidebar",
13477
13925
  "row.sidebarPanelHint": "Adds a WorkBuddy row to the DSH sidebar that opens this card as a full page. Off by default: the row takes a global sidebar slot shared by every installed plugin, and the Plugins page already reaches the same content. Takes effect on the click — no Save needed — and switching it off while the page is open returns you to the conversation.",
13478
13926
  "row.cliBridgeModelLabel": "CLI model",
@@ -13626,7 +14074,7 @@ window.__ModuleLoader__.load({
13626
14074
  "row.panelAccounts": "账号",
13627
14075
  "row.panelModels": "模型",
13628
14076
  "row.panelCapabilities": "能力",
13629
- "row.panelCapabilitiesHint": "插件可以替你做什么。这些开关点一下立即生效 —— 这一区里没有保存按钮。",
14077
+ "row.panelCapabilitiesHint": "插件可以替你做什么。这些开关点一下立即生效 —— 开关没有保存按钮。顶上那个「CN 网关主机」是草稿,由它自己的按钮保存:一个打到一半的主机名绝不该成为生效值。",
13630
14078
  "row.panelDiag": "诊断",
13631
14079
  "row.panelAria": "卡片分区",
13632
14080
  "row.diagHint": "这张卡片实际读到了什么,方便贴进问题反馈。这里没有任何会改动设置的控件。",
@@ -13982,6 +14430,9 @@ window.__ModuleLoader__.load({
13982
14430
  "sdk.dirHint": "填的是桌面端里 native/turing-sdk 那一层目录,不是 WorkBuddy.exe 所在目录。保存后会立刻重新检测;填错时上面的状态会变成「未找到」并带上这个路径,不会静默回退到自动查找。环境变量 WORKBUDDY_TURING_SDK_DIR 优先级更高。",
13983
14431
  "sdk.fallbackLabel": "取不到真实设备时退回虚拟值",
13984
14432
  "sdk.fallbackHint": "开启时:SDK 不可用(没装桌面端、目录填错、token 取不到)就改发按本机盐派生的虚拟设备对,档位显示也会跟着变成「虚拟值」——不静默冒充。关闭时:一个设备头都不发,那是「真实值」档原本的行为。",
14433
+ "row.modelToolsHint": "这三项决定模型在这个 tab 上能「做」什么:能跑哪些命令,以及能不能花积分生图、生视频。点一下即生效。",
14434
+ "row.channelRejectHint": "单独一项,因为这里是唯一「每触发一次就真花一次请求」的开关。开启前请读完它的说明。",
14435
+ "row.sidebarPanelLead": "卡片本身出现在哪。这一项只管导航,不改任何请求、不花任何额度。",
13985
14436
  "row.upstreamHint": "这一组改的是网关看到什么,不是由哪个 provider 提供服务。四项都在插件挂载时采样,改完需重载插件或重启 DSH。",
13986
14437
  "row.usageIdentityLabel": "让用量页把调用记成官方客户端的样子",
13987
14438
  "row.usageIdentityHint": "补上 X-IDE-* 头(「使用端」那一列就不会空白),并把会话 id 改成 32 位十六进制 UUIDv7。只影响显示:User-Agent 与请求正文永不变。默认关闭——证据来自报告者,本插件未在真机复现。",
@@ -13997,6 +14448,16 @@ window.__ModuleLoader__.load({
13997
14448
  "row.channelRejectContinueText": "发送的文本:",
13998
14449
  "row.cliBridgeLabel": "允许调用本机 CodeBuddy CLI 干活",
13999
14450
  "row.cliBridgeHint": "开启后多出 codebuddy_ask 工具与 /codebuddy 指令;每次调用花 CodeBuddy 配额。injectResult 只影响 /codebuddy:其结果回注会话,会话空闲时多花一次 DSH 回合;工具调用不读它。限流:每会话每小时 6 回合、每进程每小时 20 回合、同时只跑一个回合。默认关闭。",
14451
+ "row.cnBaseLabel": "CN 网关主机",
14452
+ "row.cnBaseHint": "留空即用 copilot.tencent.com。只有当你的网络按 TLS SNI 重置这个域名时才需要填(连接在毫秒级就失败,而同一台机器上的 WorkBuddy 桌面端正常——客户端自己会退回 wb.tencentbuddy.com)。可填 copilot.tencent.com、tencentbuddy.com、workbuddy.cn、codebuddy.cn 任一域名下的子域,且必须是 https。聊天、计费、模型目录、签到都会跟着走;账号与区域不会变。",
14453
+ "row.cnBasePlaceholder": "https://wb.tencentbuddy.com",
14454
+ "row.cnBaseInvalidMalformed": "这不是一个完整 URL。请带上 https:// 与主机名,例如 https://wb.tencentbuddy.com",
14455
+ "row.cnBaseInvalidInsecure": "只接受 https——明文主机会把你的 token 裸发出去。",
14456
+ "row.cnBaseInvalidHost": "这个主机不在 CN 品牌里。请用 copilot.tencent.com、tencentbuddy.com、workbuddy.cn、codebuddy.cn 下的子域。",
14457
+ "row.cnBaseSaved": "CN 网关已保存,新请求即刻使用它;Origin/Referer 仍然自称 CN 网页端。",
14458
+ "row.cnBaseCleared": "已回到内置 CN 网关。",
14459
+ "row.diagCnBase": "CN 网关",
14460
+ "row.diagCnBaseDefault": "内置(copilot.tencent.com)",
14000
14461
  "row.sidebarPanelLabel": "在侧边栏显示 WorkBuddy",
14001
14462
  "row.sidebarPanelHint": "在 DSH 侧边栏加一个 WorkBuddy 行,点开就是这张卡片的整页版。默认关闭:这一行占的是所有插件共用的全局侧边栏座位,而「插件」页本来就能看到同样的内容。点一下即生效,不用保存;页面开着时关掉它,会直接回到对话。",
14002
14463
  "row.cliBridgeModelLabel": "CLI 模型",