dsh-github-copilot 0.4.0-alpha.109 → 0.4.0-alpha.110

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
@@ -8536,6 +8536,171 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8536
8536
  }, message || (busy ? "Loading subagent settings…" : "")));
8537
8537
  }
8538
8538
  //#endregion
8539
+ //#region lib/types/account-dropdown.js
8540
+ function AccountDropdown(props) {
8541
+ const id = (0, react.useId)();
8542
+ const localTrigger = (0, react.useRef)(null);
8543
+ const trigger = props.triggerRef ?? localTrigger;
8544
+ const menu = (0, react.useRef)(null);
8545
+ const [placement, setPlacement] = (0, react.useState)({
8546
+ left: 12,
8547
+ top: 12,
8548
+ maxHeight: 300
8549
+ });
8550
+ const change = (0, react.useRef)(props.onOpenChange);
8551
+ change.current = props.onOpenChange;
8552
+ (0, react.useLayoutEffect)(() => {
8553
+ if (!props.open) return;
8554
+ menu.current?.showPopover?.();
8555
+ const place = () => {
8556
+ const anchor = trigger.current?.getBoundingClientRect();
8557
+ if (!anchor) return;
8558
+ const width = Math.min(300, window.innerWidth - 24);
8559
+ const height = Math.min(menu.current?.scrollHeight ?? 300, 330);
8560
+ const below = window.innerHeight - anchor.bottom - 20;
8561
+ const above = anchor.top - 20;
8562
+ const upwards = below < height && above > below;
8563
+ const maxHeight = Math.max(60, Math.min(330, upwards ? above : below));
8564
+ setPlacement({
8565
+ left: Math.max(12, Math.min(anchor.right - width, window.innerWidth - width - 12)),
8566
+ top: upwards ? Math.max(12, anchor.top - Math.min(height, maxHeight) - 8) : anchor.bottom + 8,
8567
+ maxHeight
8568
+ });
8569
+ };
8570
+ place();
8571
+ (menu.current?.querySelector("button[aria-pressed=\"true\"]:not(:disabled)") ?? menu.current?.querySelector("button:not(:disabled)"))?.focus();
8572
+ window.addEventListener("resize", place);
8573
+ const scroll = (event) => {
8574
+ if (event.target instanceof Node && menu.current?.contains(event.target)) return;
8575
+ place();
8576
+ };
8577
+ window.addEventListener("scroll", scroll, true);
8578
+ return () => {
8579
+ window.removeEventListener("resize", place);
8580
+ window.removeEventListener("scroll", scroll, true);
8581
+ };
8582
+ }, [props.open, trigger]);
8583
+ (0, react.useEffect)(() => {
8584
+ if (!props.open) return;
8585
+ const outside = (event) => {
8586
+ if (event.target instanceof Node && !menu.current?.contains(event.target) && !trigger.current?.contains(event.target)) change.current(false);
8587
+ };
8588
+ document.addEventListener("pointerdown", outside);
8589
+ return () => document.removeEventListener("pointerdown", outside);
8590
+ }, [props.open, trigger]);
8591
+ return (0, react.createElement)("div", {
8592
+ "data-copilot-account-dropdown": "",
8593
+ style: {
8594
+ position: "relative",
8595
+ minWidth: 0,
8596
+ flexShrink: 0
8597
+ }
8598
+ }, (0, react.createElement)("style", null, `
8599
+ [data-copilot-account-dropdown] > button::after { content: ' ▾'; padding-left: 6px; font-size: 11px }
8600
+ [data-copilot-dropdown-option]::before { content: ''; width: 16px; flex-shrink: 0 }
8601
+ [data-copilot-dropdown-option][aria-pressed=true]::before { content: '✓' }
8602
+ [data-copilot-dropdown-option]:hover { background: var(--dsw-alias-bg-layer-2, ButtonFace) !important }
8603
+ [data-copilot-account-dropdown] button:focus-visible { outline: 2px solid var(--dsw-alias-label-primary, CanvasText); outline-offset: -2px }
8604
+ `), (0, react.createElement)("button", {
8605
+ ref: trigger,
8606
+ type: "button",
8607
+ style: {
8608
+ ...props.triggerStyle,
8609
+ whiteSpace: "nowrap"
8610
+ },
8611
+ disabled: props.disabled,
8612
+ "aria-label": props.label,
8613
+ "aria-expanded": props.open,
8614
+ "aria-controls": props.open ? id : void 0,
8615
+ onClick: () => props.onOpenChange(!props.open)
8616
+ }, props.label), props.open ? (0, react.createElement)("div", {
8617
+ ref: menu,
8618
+ id,
8619
+ popover: "manual",
8620
+ role: "group",
8621
+ "aria-label": props.label,
8622
+ "aria-busy": props.busy,
8623
+ "data-copilot-account-selector": "",
8624
+ style: {
8625
+ position: "fixed",
8626
+ inset: "auto",
8627
+ margin: 0,
8628
+ ...placement,
8629
+ zIndex: 1100,
8630
+ width: 300,
8631
+ maxWidth: "calc(100vw - 24px)",
8632
+ boxSizing: "border-box",
8633
+ overflowY: "auto",
8634
+ padding: 5,
8635
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
8636
+ borderRadius: 10,
8637
+ background: "var(--dsw-specific-menu, Canvas)",
8638
+ color: "var(--dsw-alias-label-primary, CanvasText)",
8639
+ colorScheme: "inherit",
8640
+ font: "inherit",
8641
+ boxShadow: "0 10px 28px color-mix(in srgb, CanvasText 20%, transparent)"
8642
+ },
8643
+ onKeyDown: (event) => {
8644
+ const buttons = Array.from(menu.current?.querySelectorAll("button:not(:disabled)") ?? []);
8645
+ if (event.key === "Escape") {
8646
+ event.preventDefault();
8647
+ event.stopPropagation();
8648
+ props.onOpenChange(false);
8649
+ trigger.current?.focus();
8650
+ } else if ([
8651
+ "ArrowDown",
8652
+ "ArrowUp",
8653
+ "Home",
8654
+ "End"
8655
+ ].includes(event.key)) {
8656
+ event.preventDefault();
8657
+ const current = document.activeElement instanceof HTMLButtonElement ? buttons.indexOf(document.activeElement) : -1;
8658
+ buttons[event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowDown" ? 1 : -1) + buttons.length) % buttons.length]?.focus();
8659
+ } else if (event.key === "Tab") {
8660
+ trigger.current?.focus();
8661
+ props.onOpenChange(false);
8662
+ }
8663
+ }
8664
+ }, (0, react.createElement)("div", {
8665
+ [props.listAttribute]: "",
8666
+ style: {
8667
+ display: "grid",
8668
+ maxHeight: props.maxHeight ?? 240,
8669
+ overflowY: "auto",
8670
+ overscrollBehavior: "contain"
8671
+ }
8672
+ }, ...props.options.map((option) => (0, react.createElement)("button", {
8673
+ key: option.id,
8674
+ type: "button",
8675
+ "data-copilot-dropdown-option": "",
8676
+ "data-copilot-saved-account": option.id,
8677
+ "aria-label": option.label,
8678
+ "aria-pressed": option.selected,
8679
+ disabled: props.busy || option.disabled,
8680
+ style: {
8681
+ font: "inherit",
8682
+ color: "inherit",
8683
+ colorScheme: "inherit",
8684
+ display: "flex",
8685
+ alignItems: "center",
8686
+ gap: 8,
8687
+ border: 0,
8688
+ borderRadius: 5,
8689
+ padding: "10px 8px",
8690
+ minHeight: 42,
8691
+ textAlign: "left",
8692
+ overflowWrap: "anywhere",
8693
+ cursor: "pointer",
8694
+ background: "transparent"
8695
+ },
8696
+ onClick: () => props.onSelect(option.id)
8697
+ }, option.label))), props.footer ? (0, react.createElement)("div", { style: {
8698
+ borderTop: "1px solid var(--dsw-alias-border-main, GrayText)",
8699
+ marginTop: 5,
8700
+ padding: "6px 4px"
8701
+ } }, props.footer) : null) : null);
8702
+ }
8703
+ //#endregion
8539
8704
  //#region lib/types/external-link.js
8540
8705
  /** Use Desktop's public v1 navigation handoff instead of WebView popup creation. */
8541
8706
  function externalLinkTarget() {
@@ -8658,10 +8823,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8658
8823
  identityChecking: "Checking GitHub identity…",
8659
8824
  identityUnavailable: "GitHub account identity unavailable",
8660
8825
  accounts: "Account management",
8661
- searchAccounts: "Search saved GitHub accounts",
8662
- noAccountsMatch: "No saved accounts match this search.",
8663
- switchTo: (account) => `Switch to ${account}`,
8664
- closeAccounts: "Close account list",
8826
+ savedAccounts: "Manage saved authorizations",
8665
8827
  scope: "Global default for new inherited turns. Credits can override this Session’s subsequent turns. Running turns, explicit Session accounts, models and conversation history stay unchanged.",
8666
8828
  remoteUnavailable: "Account management is unavailable in this deployment.",
8667
8829
  readFailed: "Could not read account information. Retry before changing accounts.",
@@ -8722,10 +8884,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8722
8884
  identityChecking: "正在检查 GitHub 身份…",
8723
8885
  identityUnavailable: "GitHub 账号身份暂不可用",
8724
8886
  accounts: "账号管理",
8725
- searchAccounts: "搜索已保存的 GitHub 账号",
8726
- noAccountsMatch: "没有匹配的已保存账号。",
8727
- switchTo: (account) => `切换到 ${account}`,
8728
- closeAccounts: "关闭账号列表",
8887
+ savedAccounts: "管理已保存授权",
8729
8888
  scope: "全局默认账号用于后续继承默认值的新 turn。Credits 可为本 Session 后续 turn 指定账号。正在运行的 turn、Session 已指定账号、模型和对话历史保持不变。",
8730
8889
  remoteUnavailable: "当前部署无法管理账号。",
8731
8890
  readFailed: "无法读取账号信息。更改账号前请重试。",
@@ -8818,7 +8977,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8818
8977
  const [authorizationIntent, setAuthorizationIntent] = (0, react.useState)();
8819
8978
  const [confirmation, setConfirmation] = (0, react.useState)();
8820
8979
  const [accountsOpen, setAccountsOpen] = (0, react.useState)(false);
8821
- const [accountSearch, setAccountSearch] = (0, react.useState)("");
8822
8980
  const lifetime = (0, react.useRef)({
8823
8981
  active: false,
8824
8982
  generation: 0,
@@ -8830,7 +8988,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8830
8988
  (0, react.useEffect)(() => {
8831
8989
  if (!props.expanded) {
8832
8990
  setAccountsOpen(false);
8833
- setAccountSearch("");
8834
8991
  setConfirmation(void 0);
8835
8992
  }
8836
8993
  }, [props.expanded]);
@@ -8982,11 +9139,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8982
9139
  const activeAccount = view?.accounts.find((account) => account.id === view.activeAccountId);
8983
9140
  const selected = confirmation === void 0 ? void 0 : view?.accounts.find((item) => item.id === confirmation.id);
8984
9141
  const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ? `@${selected.identity.login}` : text.savedAuthorization;
8985
- const normalizedSearch = accountSearch.trim().toLocaleLowerCase();
8986
- const savedAccounts = (view?.accounts ?? []).filter((account) => {
8987
- if (!normalizedSearch) return true;
8988
- return `${(account.identityState === "ready" ? account.identity?.login : void 0) ?? ""} ${account.id}`.toLocaleLowerCase().includes(normalizedSearch);
8989
- });
9142
+ const savedAccounts = view?.accounts ?? [];
8990
9143
  const pending = busy || props.authorizationBusy === true || view?.operation !== void 0;
8991
9144
  const authorizationOperation = view?.operation === "authorizing" || view?.operation === "verifying";
8992
9145
  const authorizationStatus = cancelRequested ? text.cancelling : view?.operation === "authorizing" ? authorizationIntent === "add" ? noticeCode === void 0 ? text.addingStarting : text.addingWaiting : authorizationIntent === "reauthorize" ? noticeCode === void 0 ? text.reauthorizingStarting : text.reauthorizingWaiting : noticeCode === void 0 ? text.authorizationStarting : text.authorizationWaiting : view?.operation === "verifying" ? authorizationIntent === "add" ? text.verifyingAdding : authorizationIntent === "reauthorize" ? text.verifyingReauthorizing : text.verifying : view?.operation === "switching" ? text.switchingBusy : void 0;
@@ -9005,7 +9158,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9005
9158
  const accountName = account.identityState === "ready" && account.identity !== void 0 ? `@${account.identity.login}` : text.savedAuthorization;
9006
9159
  return (0, react.createElement)("li", {
9007
9160
  key: account.id,
9008
- "data-copilot-saved-account": account.id,
9009
9161
  style: {
9010
9162
  display: "flex",
9011
9163
  flexWrap: "wrap",
@@ -9017,13 +9169,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9017
9169
  }, (0, react.createElement)("div", { style: {
9018
9170
  minWidth: 0,
9019
9171
  flex: "1 1 140px"
9020
- } }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? accountName : account.configured ? text.identityUnavailableLabel : text.authorizationUnavailable), (0, react.createElement)("p", { style: muted$1 }, account.id === view?.activeAccountId ? text.currentDefault : account.configured ? text.savedAuthorization : text.authorizationUnavailable)), account.id === view?.activeAccountId ? null : control(text.switchTo(accountName), () => {
9021
- if (view?.revision !== void 0) setConfirmation({
9022
- id: account.id,
9023
- revision: view.revision,
9024
- remove: false
9025
- });
9026
- }, pending || view?.switchable !== true || view?.revision === void 0 || !account.configured), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.reauthorize, () => {
9172
+ } }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? accountName : account.configured ? text.identityUnavailableLabel : text.authorizationUnavailable), (0, react.createElement)("p", { style: muted$1 }, account.id === view?.activeAccountId ? text.currentDefault : account.configured ? text.savedAuthorization : text.authorizationUnavailable)), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.reauthorize, () => {
9027
9173
  if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(account.id, view.revision);
9028
9174
  }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
9029
9175
  if (view?.revision !== void 0) setConfirmation({
@@ -9146,50 +9292,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9146
9292
  "data-copilot-current-account": "",
9147
9293
  role: "status",
9148
9294
  "aria-live": "polite"
9149
- }, identity ?? text.identityUnavailableLabel), (0, react.createElement)("p", { style: muted$1 }, text.currentDefault)), control(accountsOpen ? text.closeAccounts : text.switch, () => {
9150
- setAccountsOpen((open) => !open);
9151
- setConfirmation(void 0);
9152
- }, pending || view?.switchable !== true || view?.revision === void 0)), !props.addOnly && accountsOpen ? (0, react.createElement)("div", {
9153
- "data-copilot-account-selector": true,
9154
- style: {
9155
- display: "grid",
9156
- gap: 8
9157
- }
9158
- }, (0, react.createElement)("label", { style: {
9159
- display: "grid",
9160
- gap: 6,
9161
- color: secondary$1,
9162
- fontSize: 13
9163
- } }, text.searchAccounts, (0, react.createElement)("input", {
9164
- type: "search",
9165
- value: accountSearch,
9166
- "data-copilot-account-search": true,
9167
- onChange: (event) => setAccountSearch(event.currentTarget.value),
9168
- style: {
9169
- ...button$1,
9170
- fontSize: 16,
9171
- width: "100%",
9172
- boxSizing: "border-box",
9173
- background: "var(--dsw-alias-bg-layer-1, Canvas)",
9174
- color: "var(--dsw-alias-label-primary, CanvasText)"
9295
+ }, identity ?? text.identityUnavailableLabel), (0, react.createElement)("p", { style: muted$1 }, text.currentDefault)), (0, react.createElement)(AccountDropdown, {
9296
+ label: text.switch,
9297
+ open: accountsOpen,
9298
+ triggerStyle: button$1,
9299
+ disabled: pending || view?.switchable !== true || view?.revision === void 0,
9300
+ busy: pending,
9301
+ onOpenChange: (open) => {
9302
+ setAccountsOpen(open);
9303
+ setConfirmation(void 0);
9175
9304
  },
9176
- placeholder: text.searchAccounts
9177
- })), (0, react.createElement)("ul", {
9178
- "data-copilot-saved-accounts": true,
9179
- style: {
9180
- padding: 0,
9181
- margin: 0,
9182
- listStyle: "none",
9183
- maxHeight: 240,
9184
- overflowY: "auto",
9185
- overscrollBehavior: "contain"
9186
- }
9187
- }, ...savedAccountItems.length === 0 ? [(0, react.createElement)("li", {
9188
- key: "no-matches",
9189
- style: muted$1
9190
- }, text.noAccountsMatch)] : savedAccountItems), authorizationOperation ? null : control(text.add, () => {
9191
- if (props.remote !== void 0) startAdd();
9192
- }, pending || view?.writable !== true || view?.switchable !== true)) : null, props.addOnly || confirmation === void 0 ? null : (0, react.createElement)("div", {
9305
+ options: savedAccounts.map((account) => ({
9306
+ id: account.id,
9307
+ label: account.identityState === "ready" && account.identity ? `@${account.identity.login}` : `${text.savedAuthorization}${account.id === "canonical" ? "" : ` ${savedAccounts.indexOf(account) + 1}`} · ${text.identityUnavailableLabel}`,
9308
+ selected: account.id === view?.activeAccountId,
9309
+ disabled: !account.configured
9310
+ })),
9311
+ onSelect: (id) => {
9312
+ setAccountsOpen(false);
9313
+ if (id !== view?.activeAccountId && view?.revision !== void 0) setConfirmation({
9314
+ id,
9315
+ revision: view.revision,
9316
+ remove: false
9317
+ });
9318
+ },
9319
+ listAttribute: "data-copilot-saved-accounts",
9320
+ footer: authorizationOperation ? null : control(text.add, () => {
9321
+ setAccountsOpen(false);
9322
+ if (props.remote !== void 0) startAdd();
9323
+ }, pending || view?.writable !== true || view?.switchable !== true)
9324
+ })), props.addOnly || confirmation === void 0 ? null : (0, react.createElement)("div", {
9193
9325
  role: "group",
9194
9326
  "aria-label": confirmation.remove ? text.confirmRemoveTitle : text.confirmSwitchTitle,
9195
9327
  style: {
@@ -9217,7 +9349,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9217
9349
  if (managementRemote !== void 0) run(() => managementRemote.refreshIdentity());
9218
9350
  }, pending || props.remote === void 0), activeAccount === void 0 || activeAccount.id === "canonical" ? null : control(text.reauthorize, () => {
9219
9351
  if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(activeAccount.id, view.revision);
9220
- }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0)), props.accountSettings ?? null, props.continuationSettings ?? null));
9352
+ }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0)), props.addOnly || savedAccounts.every((account) => account.id === "canonical" || account.id === view?.activeAccountId) ? null : (0, react.createElement)("details", null, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.savedAccounts), (0, react.createElement)("ul", { style: {
9353
+ listStyle: "none",
9354
+ padding: 0,
9355
+ maxHeight: 240,
9356
+ overflowY: "auto"
9357
+ } }, ...savedAccountItems)), props.accountSettings ?? null, props.continuationSettings ?? null));
9221
9358
  }
9222
9359
  //#endregion
9223
9360
  //#region lib/types/copilot-usage-card.js
@@ -9267,13 +9404,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9267
9404
  originalAuthorization: "Original authorization",
9268
9405
  savedAuthorization: "Saved authorization",
9269
9406
  nextAccount: "Next turn",
9270
- searchAccounts: "Search saved accounts",
9271
- cancel: "Cancel",
9272
- noAccounts: "No matching accounts. Change your search or add an account.",
9273
9407
  savingAccount: "Saving account…",
9274
9408
  manage: "Manage accounts and models",
9275
- confirmingAccount: "Reviewing account switch…",
9276
- navigationUnavailable: "Account and model settings navigation is unavailable in this deployment."
9409
+ confirmingAccount: "Reviewing account switch…"
9277
9410
  },
9278
9411
  zh: {
9279
9412
  credits: "额度",
@@ -9320,13 +9453,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9320
9453
  originalAuthorization: "原始授权",
9321
9454
  savedAuthorization: "已保存授权",
9322
9455
  nextAccount: "下一轮",
9323
- searchAccounts: "搜索已保存账号",
9324
- cancel: "取消",
9325
- noAccounts: "未找到匹配账号,请修改搜索或添加账号。",
9326
9456
  savingAccount: "正在保存账号…",
9327
9457
  manage: "管理账号与模型",
9328
- confirmingAccount: "正在确认账号切换…",
9329
- navigationUnavailable: "当前部署无法导航至账号与模型设置。"
9458
+ confirmingAccount: "正在确认账号切换…"
9330
9459
  }
9331
9460
  };
9332
9461
  const secondary = "var(--dsw-alias-label-secondary, GrayText)";
@@ -9383,7 +9512,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9383
9512
  const [accounts, setAccounts] = (0, react.useState)();
9384
9513
  const [sessionAccount, setSessionAccount] = (0, react.useState)();
9385
9514
  const [choosingAccount, setChoosingAccount] = (0, react.useState)(false);
9386
- const [accountQuery, setAccountQuery] = (0, react.useState)("");
9387
9515
  const [savingAccount, setSavingAccount] = (0, react.useState)(false);
9388
9516
  const [confirmingAccount, setConfirmingAccount] = (0, react.useState)(false);
9389
9517
  const [accountFailed, setAccountFailed] = (0, react.useState)(false);
@@ -9399,7 +9527,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9399
9527
  const panel = (0, react.useRef)(null);
9400
9528
  const closeButton = (0, react.useRef)(null);
9401
9529
  const switchButton = (0, react.useRef)(null);
9402
- const accountSearch = (0, react.useRef)(null);
9403
9530
  const lifecycle = (0, react.useRef)({
9404
9531
  active: false,
9405
9532
  generation: 0,
@@ -9418,12 +9545,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9418
9545
  owner.controller = void 0;
9419
9546
  setOpen(false);
9420
9547
  setChoosingAccount(false);
9421
- setAccountQuery("");
9422
9548
  if (restore) trigger.current?.focus();
9423
9549
  }, []);
9424
9550
  const collapseAccounts = () => {
9425
9551
  setChoosingAccount(false);
9426
- setAccountQuery("");
9427
9552
  switchButton.current?.focus();
9428
9553
  };
9429
9554
  const load = (0, react.useCallback)(async (force) => {
@@ -9492,7 +9617,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9492
9617
  setAccounts(void 0);
9493
9618
  setSessionAccount(void 0);
9494
9619
  setChoosingAccount(false);
9495
- setAccountQuery("");
9496
9620
  setSavingAccount(false);
9497
9621
  setConfirmingAccount(false);
9498
9622
  setAccountFailed(false);
@@ -9588,7 +9712,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9588
9712
  setAccounts(parsed.data.accounts);
9589
9713
  setView(void 0);
9590
9714
  setChoosingAccount(false);
9591
- setAccountQuery("");
9592
9715
  owner.save = void 0;
9593
9716
  setSavingAccount(false);
9594
9717
  await load(false);
@@ -9631,9 +9754,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9631
9754
  window.removeEventListener("scroll", place, true);
9632
9755
  };
9633
9756
  }, [open]);
9634
- (0, react.useEffect)(() => {
9635
- if (open && choosingAccount) accountSearch.current?.focus();
9636
- }, [open, choosingAccount]);
9637
9757
  (0, react.useEffect)(() => {
9638
9758
  if (!open) return;
9639
9759
  const outside = (event) => {
@@ -9698,8 +9818,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9698
9818
  id: account.id,
9699
9819
  label: account.identity ? `@${account.identity.login}` : account.id === "canonical" ? `${t.originalAuthorization} · ${t.identityUnknown}` : `${t.savedAuthorization}${numberedUnknownAccounts.has(account.id) ? ` ${numberedUnknownAccounts.get(account.id)}` : ""} · ${t.identityUnknown}`,
9700
9820
  selected: sessionAccount.source === "session" && sessionAccount.accountId === account.id
9701
- }))].filter((option) => option.label.toLocaleLowerCase(language).includes(accountQuery.trim().toLocaleLowerCase(language))) : [];
9702
- const navigationDiagnostic = props.navigationDiagnostic ?? "COPILOT_ACCOUNT_MANAGEMENT_NAVIGATION_UNAVAILABLE";
9821
+ }))] : [];
9703
9822
  return (0, react.createElement)("span", { style: {
9704
9823
  display: "inline-flex",
9705
9824
  minWidth: 0,
@@ -9786,85 +9905,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9786
9905
  onClick: () => {
9787
9906
  close(true);
9788
9907
  }
9789
- }, "×")), props.sessionAccount === void 0 ? null : (0, react.createElement)("div", { style: separator }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("p", { style: muted }, t.switchScope), (0, react.createElement)("button", {
9790
- ref: switchButton,
9791
- type: "button",
9792
- style: {
9908
+ }, "×")), props.sessionAccount === void 0 ? null : (0, react.createElement)("div", { style: separator }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("p", { style: muted }, t.switchScope), (0, react.createElement)(AccountDropdown, {
9909
+ triggerRef: switchButton,
9910
+ triggerStyle: {
9793
9911
  ...button,
9794
9912
  flexShrink: 0
9795
9913
  },
9914
+ label: t.switchAccount,
9915
+ open: choosingAccount,
9916
+ busy: savingAccount,
9917
+ maxHeight: 220,
9796
9918
  disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 || busy || savingAccount,
9797
- "aria-expanded": choosingAccount,
9798
- "aria-controls": choosingAccount ? `${id}-accounts` : void 0,
9799
- onClick: () => {
9800
- if (choosingAccount) collapseAccounts();
9919
+ onOpenChange: (next) => {
9920
+ if (!next) collapseAccounts();
9801
9921
  else setChoosingAccount(true);
9802
- }
9803
- }, t.switchAccount)), sessionAccount?.runningAccountId === void 0 ? null : (0, react.createElement)("p", { style: muted }, `${t.runningAccount}: ${runningIdentity ?? t.identityUnknown} · ${t.nextAccount}: ${currentIdentity}`), choosingAccount ? (0, react.createElement)("div", {
9804
- id: `${id}-accounts`,
9805
- role: "group",
9806
- "aria-label": t.switchAccount,
9807
- "aria-busy": savingAccount,
9808
- style: {
9809
- display: "grid",
9810
- gap: 8,
9811
- marginTop: 10
9812
- }
9813
- }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("label", {
9814
- htmlFor: `${id}-account-search`,
9815
- style: muted
9816
- }, t.searchAccounts), (0, react.createElement)("button", {
9817
- type: "button",
9818
- style: button,
9819
- disabled: savingAccount,
9820
- onClick: collapseAccounts
9821
- }, t.cancel)), (0, react.createElement)("input", {
9822
- ref: accountSearch,
9823
- id: `${id}-account-search`,
9824
- type: "search",
9825
- "aria-label": t.searchAccounts,
9826
- value: accountQuery,
9827
- disabled: savingAccount,
9828
- onChange: (event) => setAccountQuery(event.currentTarget.value),
9829
- style: {
9830
- ...button,
9831
- cursor: "text",
9832
- width: "100%",
9833
- minWidth: 0,
9834
- boxSizing: "border-box"
9835
- }
9836
- }), sessionAccount === void 0 ? null : (0, react.createElement)("div", {
9837
- "data-copilot-account-options": "",
9838
- style: {
9839
- display: "grid",
9840
- gap: 4,
9841
- maxHeight: 220,
9842
- overflowY: "auto",
9843
- overscrollBehavior: "contain"
9844
- }
9845
- }, ...accountOptions.map((option) => (0, react.createElement)("button", {
9846
- key: option.id ?? "follow-global",
9847
- type: "button",
9848
- disabled: savingAccount,
9849
- style: {
9850
- ...button,
9851
- textAlign: "left",
9852
- border: "none",
9853
- whiteSpace: "normal",
9854
- overflowWrap: "anywhere",
9855
- background: option.selected ? "var(--dsw-alias-bg-layer-2, ButtonFace)" : "transparent"
9856
9922
  },
9857
- "aria-pressed": option.selected,
9858
- onClick: () => {
9859
- chooseAccount(option.id);
9860
- }
9861
- }, option.label))), sessionAccount !== void 0 && accountOptions.length === 0 ? (0, react.createElement)("p", {
9862
- role: "status",
9863
- style: muted
9864
- }, t.noAccounts) : null, savingAccount ? (0, react.createElement)("p", {
9923
+ options: accountOptions.map((option) => ({
9924
+ ...option,
9925
+ id: option.id ?? "follow-global"
9926
+ })),
9927
+ onSelect: (accountId) => {
9928
+ chooseAccount(accountId === "follow-global" ? null : accountId);
9929
+ },
9930
+ listAttribute: "data-copilot-account-options",
9931
+ footer: props.accountActions
9932
+ })), sessionAccount?.runningAccountId === void 0 ? null : (0, react.createElement)("p", { style: muted }, `${t.runningAccount}: ${runningIdentity ?? t.identityUnknown} · ${t.nextAccount}: ${currentIdentity}`), savingAccount ? (0, react.createElement)("p", {
9865
9933
  role: "status",
9866
9934
  style: muted
9867
- }, confirmingAccount ? t.confirmingAccount : t.savingAccount) : null, props.accountActions === void 0 ? null : (0, react.createElement)("div", { style: separator }, props.accountActions)) : null, sessionAccount?.accounts.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, sessionAccount.accounts.diagnostic), accountFailed || accountSaveFailed ? (0, react.createElement)("p", {
9935
+ }, confirmingAccount ? t.confirmingAccount : t.savingAccount) : null, sessionAccount?.accounts.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, sessionAccount.accounts.diagnostic), accountFailed || accountSaveFailed ? (0, react.createElement)("p", {
9868
9936
  role: "alert",
9869
9937
  style: muted
9870
9938
  }, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), props.continuation, view?.state === "stale" ? (0, react.createElement)("p", {
@@ -9933,15 +10001,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9933
10001
  }, t.plan), (0, react.createElement)("details", { style: muted }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, t.manual), (0, react.createElement)("code", { style: {
9934
10002
  userSelect: "all",
9935
10003
  overflowWrap: "anywhere"
9936
- } }, "https://github.com/settings/copilot")), (0, react.createElement)("div", { style: {
10004
+ } }, "https://github.com/settings/copilot")), props.onManage === void 0 ? null : (0, react.createElement)("div", { style: {
9937
10005
  ...separator,
9938
10006
  display: "grid",
9939
10007
  gap: 6
9940
10008
  } }, (0, react.createElement)("button", {
9941
10009
  type: "button",
9942
10010
  role: "link",
9943
- disabled: props.onManage === void 0,
9944
- "aria-describedby": props.onManage === void 0 ? `${id}-navigation` : void 0,
9945
10011
  style: {
9946
10012
  ...button,
9947
10013
  border: "none",
@@ -9949,8 +10015,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9949
10015
  textAlign: "left",
9950
10016
  textDecoration: "underline",
9951
10017
  padding: 0,
9952
- color: props.onManage === void 0 ? secondary : "inherit",
9953
- cursor: props.onManage === void 0 ? "default" : "pointer"
10018
+ color: "inherit",
10019
+ cursor: "pointer"
9954
10020
  },
9955
10021
  onClick: () => {
9956
10022
  if (props.onManage !== void 0) {
@@ -9958,12 +10024,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9958
10024
  props.onManage();
9959
10025
  }
9960
10026
  }
9961
- }, t.manage), props.onManage === void 0 ? (0, react.createElement)("p", {
9962
- id: `${id}-navigation`,
9963
- style: muted
9964
- }, (0, react.createElement)("code", null, navigationDiagnostic), ` · ${t.navigationUnavailable}`) : null)) : null);
10027
+ }, t.manage))) : null);
9965
10028
  }
9966
10029
  //#endregion
10030
+ //#region lib/types/composer-notice-style.js
10031
+ const composerNoticeStyle = {
10032
+ width: "100%",
10033
+ minWidth: 0,
10034
+ maxWidth: "var(--dsh-composer-card-max-width, 100%)",
10035
+ marginInline: "auto",
10036
+ boxSizing: "border-box",
10037
+ fontFamily: "var(--dsw-font-family, inherit)",
10038
+ fontSize: "var(--dsh-content-font-size-secondary, 13px)",
10039
+ fontWeight: 400,
10040
+ lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
10041
+ color: "var(--dsw-alias-label-secondary, GrayText)",
10042
+ overflowWrap: "anywhere"
10043
+ };
10044
+ const composerNoticeSurfaceStyle = {
10045
+ ...composerNoticeStyle,
10046
+ padding: "10px 12px",
10047
+ borderRadius: "var(--dsw-radius-md, 8px)",
10048
+ background: "var(--dsw-alias-interactive-bg-hover, transparent)"
10049
+ };
10050
+ const composerNoticeParagraphStyle = {
10051
+ marginBlock: 8,
10052
+ maxWidth: "38rem"
10053
+ };
10054
+ const composerNoticeButtonStyle = {
10055
+ fontFamily: "inherit",
10056
+ fontSize: "inherit",
10057
+ fontWeight: "inherit",
10058
+ lineHeight: "inherit",
10059
+ color: "var(--dsw-alias-label-primary, CanvasText)",
10060
+ maxWidth: "100%",
10061
+ background: "transparent",
10062
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
10063
+ borderRadius: 6,
10064
+ padding: "6px 10px",
10065
+ cursor: "pointer"
10066
+ };
10067
+ //#endregion
9967
10068
  //#region lib/types/session-continuation-ui.js
9968
10069
  const control = {
9969
10070
  font: "inherit",
@@ -9979,8 +10080,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9979
10080
  fontSize: 13,
9980
10081
  lineHeight: 1.5
9981
10082
  };
9982
- function SessionContinuationCard({ sessionId, remote, locale = "en", running = false, onEnabledChange, expanded = false }) {
10083
+ function SessionContinuationCard({ sessionId, remote, locale = "en", running = false, onEnabledChange, expanded = false, recovery = false, onCancel }) {
9983
10084
  const zh = locale.startsWith("zh");
10085
+ const body = recovery ? composerNoticeParagraphStyle : paragraph;
10086
+ const button = recovery ? composerNoticeButtonStyle : control;
9984
10087
  const [view, setView] = (0, react.useState)();
9985
10088
  const [busy, setBusy] = (0, react.useState)(false);
9986
10089
  const [error, setError] = (0, react.useState)(false);
@@ -10016,16 +10119,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10016
10119
  running,
10017
10120
  reload
10018
10121
  ]);
10019
- const save = async (enabled, next = false) => {
10020
- if (!view || !remote || busy) return;
10122
+ const save = async (enabled) => {
10123
+ if (!view || !remote || busy || recovery && running) return;
10021
10124
  const generation = owner.current;
10022
10125
  setBusy(true);
10023
10126
  setError(false);
10024
10127
  try {
10025
- const result = next ? await remote.authorizeNext?.(sessionId, view.revision, enabled === true) : await remote.set(sessionId, view.revision, enabled);
10128
+ const result = await remote.set(sessionId, view.revision, enabled);
10026
10129
  const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10027
10130
  if (owner.current !== generation) return;
10028
- if (!parsed?.success) {
10131
+ if (!parsed?.success || enabled !== null && parsed.data.enabled !== enabled) {
10029
10132
  setView(void 0);
10030
10133
  setError(true);
10031
10134
  } else setView(parsed.data);
@@ -10038,11 +10141,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10038
10141
  if (owner.current === generation) setBusy(false);
10039
10142
  }
10040
10143
  };
10144
+ const loss = (0, react.createElement)("p", { style: body }, zh ? "每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用。可见消息、工具记录和磁盘历史不变;可能失去隐含细节。不会自动发送或重试。" : "Every new turn omits old encrypted reasoning and embedded summaries, including on the same account. Visible messages, tool records and disk history stay unchanged; implicit details may be lost. No automatic sending or retries.");
10145
+ const unavailable = error ? (0, react.createElement)("p", {
10146
+ role: "alert",
10147
+ style: body
10148
+ }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10149
+ type: "button",
10150
+ style: button,
10151
+ disabled: busy || recovery && running,
10152
+ onClick: () => setReload((value) => value + 1)
10153
+ }, zh ? "重试读取" : "Retry read")) : null;
10154
+ if (recovery) return (0, react.createElement)("div", { "data-copilot-continuation-recovery": "" }, !view && !error ? (0, react.createElement)("p", {
10155
+ role: "status",
10156
+ style: body
10157
+ }, zh ? "正在读取降级续聊策略…" : "Reading continuation policy…") : null, view?.enabled ? (0, react.createElement)("p", {
10158
+ role: "status",
10159
+ style: body
10160
+ }, zh ? "本 Session 已开启降级续聊,请另行使用原生重试。如果仍被拒绝,请查看技术诊断或新建会话;不会重复授权或自动重试。" : "Continuation is already on for this Session; use native Retry separately. If rejection persists, review technical diagnostics or start a new conversation. No repeated authorization or automatic retry.") : view ? (0, react.createElement)("div", null, loss, (0, react.createElement)("p", { style: body }, zh ? "开启后在本 Session 持续生效,跨账号和重启保留,直到关闭。开启即同意上述损失;之后请另行使用原生重试。" : "Enabling applies to this Session across accounts and restarts until disabled. This consents to the loss above; use native Retry separately afterwards."), (0, react.createElement)("button", {
10161
+ type: "button",
10162
+ style: button,
10163
+ disabled: busy || running,
10164
+ onClick: () => void save(true)
10165
+ }, zh ? "开启降级续聊" : "Enable visible-history continuation")) : null, unavailable, (0, react.createElement)("button", {
10166
+ type: "button",
10167
+ style: button,
10168
+ disabled: busy || running,
10169
+ onClick: onCancel
10170
+ }, zh ? "取消" : "Cancel"));
10041
10171
  return (0, react.createElement)("details", {
10042
10172
  open: expanded || void 0,
10043
10173
  "data-copilot-continuation-settings": "",
10044
10174
  style: { fontSize: 13 }
10045
- }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "降级续聊" : "Visible-history continuation", " · ", !view ? zh ? "状态待确认" : "Unknown" : view.enabled ? zh ? "开启" : "On" : view.nextTurnAuthorized ? zh ? "仅下一轮" : "Next turn only" : zh ? "关闭" : "Off"), (0, react.createElement)("p", { style: paragraph }, zh ? "每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用。可见消息、工具记录和磁盘历史不变;可能失去隐含细节。不会自动发送或重试。" : "Every new turn omits old encrypted reasoning and embedded summaries, including on the same account. Visible messages, tool records and disk history stay unchanged; implicit details may be lost. No automatic sending or retries."), (0, react.createElement)("label", { style: {
10175
+ }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "降级续聊" : "Visible-history continuation", " · ", !view ? zh ? "状态待确认" : "Unknown" : view.enabled ? zh ? "开启" : "On" : view.nextTurnAuthorized ? zh ? "仅下一轮" : "Next turn only" : zh ? "关闭" : "Off"), loss, (0, react.createElement)("label", { style: {
10046
10176
  display: "flex",
10047
10177
  gap: 8,
10048
10178
  alignItems: "center",
@@ -10066,29 +10196,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10066
10196
  }, label)))), view?.activeTurnEnabled !== void 0 && view.activeTurnEnabled !== view.enabled ? (0, react.createElement)("p", {
10067
10197
  role: "status",
10068
10198
  style: paragraph
10069
- }, zh ? "当前轮保持原策略,变更从下一轮生效。" : "The active turn keeps its policy; changes apply next turn.") : null, view && !view.enabled ? (0, react.createElement)("div", { style: {
10070
- display: "flex",
10071
- flexWrap: "wrap",
10072
- gap: 8,
10073
- marginTop: 10
10074
- } }, (0, react.createElement)("button", {
10075
- type: "button",
10076
- style: control,
10077
- disabled: busy || !remote?.authorizeNext,
10078
- onClick: () => void save(!view.nextTurnAuthorized, true)
10079
- }, view.nextTurnAuthorized ? zh ? "撤销下一轮授权" : "Revoke next-turn consent" : zh ? "仅下一轮降级" : "Next turn only"), (0, react.createElement)("button", {
10080
- type: "button",
10081
- style: control,
10082
- disabled: busy,
10083
- onClick: () => void save(true)
10084
- }, zh ? "一键持续开启" : "Enable for this Session"), (0, react.createElement)("p", { style: paragraph }, zh ? "点击即同意上述损失。仅下一轮授权在该轮结束或 Host 重启后失效。" : "These actions consent to the loss described above. Next-turn consent expires when that turn ends or the Host restarts.")) : null, error ? (0, react.createElement)("p", {
10085
- role: "alert",
10086
- style: paragraph
10087
- }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10088
- type: "button",
10089
- style: control,
10090
- onClick: () => setReload((value) => value + 1)
10091
- }, zh ? "重试读取" : "Retry read")) : null);
10199
+ }, zh ? "当前轮保持原策略,变更从下一轮生效。" : "The active turn keeps its policy; changes apply next turn.") : null, unavailable);
10092
10200
  }
10093
10201
  function ContinuationDefaultCard({ remote, locale = "en", onSaved }) {
10094
10202
  const zh = locale.startsWith("zh");
@@ -10177,10 +10285,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10177
10285
  setBusy(true);
10178
10286
  setError(false);
10179
10287
  try {
10180
- const result = choice === "session" ? await remote.set(sessionId, consent.view.revision, true) : await remote.authorizeNext?.(sessionId, consent.view.revision, true);
10288
+ const result = await remote.set(sessionId, consent.view.revision, true);
10181
10289
  const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10182
10290
  if (!active.current) return;
10183
- if (!parsed?.success || (choice === "session" ? !parsed.data.enabled : !parsed.data.nextTurnAuthorized)) setError(true);
10291
+ if (!parsed?.success || !parsed.data.enabled) setError(true);
10184
10292
  else done(true);
10185
10293
  } catch {
10186
10294
  if (active.current) setError(true);
@@ -10197,7 +10305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10197
10305
  padding: 10,
10198
10306
  marginBlock: 10
10199
10307
  }
10200
- }, (0, react.createElement)("strong", null, zh ? "此 Session 的降级续聊未开启" : "Continuation is off for this Session"), (0, react.createElement)("p", { style: paragraph }, zh ? "切换账号后,旧加密推理可能被拒绝,但不一定失败。降级每轮省略旧推理及内嵌摘要,保留可见消息与工具记录;可能损失隐含细节。仅下一轮授权在该轮结束或 Host 重启后失效。不会自动重试。" : "After switching, old encrypted reasoning may be rejected; failure is not certain. Continuation omits old reasoning and embedded summaries each turn while keeping visible messages and tools. Implicit details may be lost. Next-turn consent expires when that turn ends or the Host restarts. No automatic retry."), (0, react.createElement)("div", { style: {
10308
+ }, (0, react.createElement)("strong", null, zh ? "此 Session 的降级续聊未开启" : "Continuation is off for this Session"), (0, react.createElement)("p", { style: paragraph }, zh ? "切换账号后,旧加密推理可能被拒绝,但不一定失败。降级每轮省略旧推理及内嵌摘要,保留可见消息与工具记录;可能损失隐含细节。开启后持续生效,直到关闭。不会自动重试。" : "After switching, old encrypted reasoning may be rejected; failure is not certain. Continuation omits old reasoning and embedded summaries each turn while keeping visible messages and tools. Implicit details may be lost. Enabling persists until disabled. No automatic retry."), (0, react.createElement)("div", { style: {
10201
10309
  display: "flex",
10202
10310
  flexWrap: "wrap",
10203
10311
  gap: 8
@@ -10207,11 +10315,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10207
10315
  disabled: busy,
10208
10316
  onClick: () => void choose("session")
10209
10317
  }, zh ? "持续开启并切换" : "Enable for Session and switch"), (0, react.createElement)("button", {
10210
- type: "button",
10211
- style: control,
10212
- disabled: busy || !remote.authorizeNext,
10213
- onClick: () => void choose("next")
10214
- }, zh ? "仅下一轮并切换" : "Next turn only and switch"), (0, react.createElement)("button", {
10215
10318
  type: "button",
10216
10319
  style: control,
10217
10320
  disabled: busy,
@@ -10428,8 +10531,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10428
10531
  remote: addRemote,
10429
10532
  locale: language,
10430
10533
  onChanged: added
10431
- }) : void 0,
10432
- navigationDiagnostic: language.startsWith("zh") ? "当前 Core 未提供公开的 Models 直达导航。请打开设置 → 模型 → GitHub Copilot → 管理;返回后草稿与本 Session 设置不变。" : "This Core has no public Models deep link. Open Settings → Models → GitHub Copilot → Manage; your draft and Session settings remain unchanged."
10534
+ }) : void 0
10433
10535
  });
10434
10536
  }
10435
10537
  /** Public additive dock only; native composer, ContextMeter and other features stay owned by Core. */
@@ -10564,56 +10666,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10564
10666
  reasoningTokens: count.optional()
10565
10667
  });
10566
10668
  //#endregion
10567
- //#region lib/types/composer-notice-style.js
10568
- const composerNoticeStyle = {
10569
- width: "100%",
10570
- minWidth: 0,
10571
- maxWidth: "var(--dsh-composer-card-max-width, 100%)",
10572
- marginInline: "auto",
10573
- boxSizing: "border-box",
10574
- fontFamily: "var(--dsw-font-family, inherit)",
10575
- fontSize: "var(--dsh-content-font-size-secondary, 13px)",
10576
- fontWeight: 400,
10577
- lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
10578
- color: "var(--dsw-alias-label-secondary, GrayText)",
10579
- overflowWrap: "anywhere"
10580
- };
10581
- const composerNoticeSurfaceStyle = {
10582
- ...composerNoticeStyle,
10583
- padding: "10px 12px",
10584
- borderRadius: "var(--dsw-radius-md, 8px)",
10585
- background: "var(--dsw-alias-interactive-bg-hover, transparent)"
10586
- };
10587
- const composerNoticeQuietButtonStyle = {
10588
- fontFamily: "inherit",
10589
- fontSize: "inherit",
10590
- fontWeight: "inherit",
10591
- lineHeight: "inherit",
10592
- color: "inherit",
10593
- background: "transparent",
10594
- border: 0,
10595
- padding: "6px 10px",
10596
- cursor: "pointer",
10597
- maxWidth: "100%"
10598
- };
10599
- const composerNoticeParagraphStyle = {
10600
- marginBlock: 8,
10601
- maxWidth: "38rem"
10602
- };
10603
- const composerNoticeButtonStyle = {
10604
- fontFamily: "inherit",
10605
- fontSize: "inherit",
10606
- fontWeight: "inherit",
10607
- lineHeight: "inherit",
10608
- color: "var(--dsw-alias-label-primary, CanvasText)",
10609
- maxWidth: "100%",
10610
- background: "transparent",
10611
- border: "1px solid var(--dsw-alias-border-main, GrayText)",
10612
- borderRadius: 6,
10613
- padding: "6px 10px",
10614
- cursor: "pointer"
10615
- };
10616
- //#endregion
10617
10669
  //#region lib/types/context-evidence-ui.js
10618
10670
  const slot = "conversation.input.dock";
10619
10671
  const noop$1 = () => {};
@@ -10733,17 +10785,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10733
10785
  }
10734
10786
  function ReplayRecoveryCard({ sessionId, remote, continuation, locale = "en", running = false, refreshKey = "" }) {
10735
10787
  const zh = locale.startsWith("zh");
10736
- const durationName = (0, react.useId)();
10737
10788
  const [view, setView] = (0, react.useState)();
10738
10789
  const [busy, setBusy] = (0, react.useState)(false);
10739
10790
  const [error, setError] = (0, react.useState)(false);
10740
- const [confirm, setConfirm] = (0, react.useState)(false);
10741
- const [duration, setDuration] = (0, react.useState)("next-turn");
10742
10791
  const [dismissed, setDismissed] = (0, react.useState)();
10743
10792
  const [hadEvidence, setHadEvidence] = (0, react.useState)(false);
10744
- const latest = (0, react.useRef)(view);
10745
10793
  const active = (0, react.useRef)(running);
10746
- latest.current = view;
10747
10794
  active.current = running;
10748
10795
  const pending = (0, react.useRef)(false);
10749
10796
  const refreshPending = (0, react.useRef)(false);
@@ -10754,19 +10801,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10754
10801
  mounted.current = false;
10755
10802
  };
10756
10803
  }, []);
10757
- const perform = (0, react.useCallback)(async (authorization) => {
10804
+ const perform = (0, react.useCallback)(async () => {
10758
10805
  if (pending.current) {
10759
- if (authorization === void 0) refreshPending.current = true;
10806
+ refreshPending.current = true;
10760
10807
  return;
10761
10808
  }
10762
10809
  if (active.current) return;
10763
10810
  pending.current = true;
10764
10811
  setBusy(true);
10765
10812
  setError(false);
10766
- setConfirm(false);
10767
10813
  try {
10768
- const current = latest.current;
10769
- const result = authorization === void 0 ? await remote.get(sessionId) : current && current.state !== "unavailable" ? authorization === false ? await remote.setEnabled(sessionId, current.revision, false) : await remote.authorize(sessionId, current.revision, authorization) : void 0;
10814
+ const result = await remote.get(sessionId);
10770
10815
  const parsed = result?.ok ? ReplayRecoveryViewSchema.safeParse(result.value) : void 0;
10771
10816
  if (!mounted.current) return;
10772
10817
  if (parsed?.success) {
@@ -10793,7 +10838,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10793
10838
  }
10794
10839
  }, [remote, sessionId]);
10795
10840
  (0, react.useEffect)(() => {
10796
- setConfirm(false);
10797
10841
  if (!running) perform();
10798
10842
  }, [
10799
10843
  running,
@@ -10810,7 +10854,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10810
10854
  const disabled = busy || running;
10811
10855
  const evidence = view && view.state !== "unavailable" ? view : void 0;
10812
10856
  if (!error && !evidence && !hadEvidence) return null;
10813
- if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
10857
+ if (!error && evidence && dismissed === evidence.revision) return (0, react.createElement)("button", {
10814
10858
  type: "button",
10815
10859
  style: {
10816
10860
  ...button,
@@ -10833,63 +10877,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10833
10877
  color: "var(--dsw-alias-label-primary, CanvasText)",
10834
10878
  fontWeight: 600
10835
10879
  }
10836
- }, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10880
+ }, evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10837
10881
  role: "alert",
10838
10882
  style: composerNoticeParagraphStyle
10839
- }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "授权或失败证据已失效。恢复未启用;没有当前可用的失败证据。" : "Authorization or failure evidence expired. Recovery is off; no current failure evidence is available.") : null, evidence ? (0, react.createElement)("div", null, continuation && evidence.state === "available" ? (0, react.createElement)("div", null, (0, react.createElement)(SessionContinuationCard, {
10883
+ }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "失败证据已失效,没有当前可用的失败诊断。此状态不改变本 Session 的降级续聊策略。" : "Failure evidence expired; no current failure diagnostics are available. This does not change the Session continuation policy.") : null, evidence ? (0, react.createElement)("div", null, (0, react.createElement)(SessionContinuationCard, {
10884
+ key: evidence.revision,
10840
10885
  sessionId,
10841
10886
  remote: continuation,
10842
10887
  locale,
10843
- running,
10844
- expanded: true
10845
- }), (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "授权后请使用原生重试按钮继续。完整账号管理:设置 → 模型 → GitHub Copilot → 管理。" : "After authorization, use the native Retry control. Full account management: Settings → Models → GitHub Copilot → Manage.")) : null, evidence.state === "enabled" ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, evidence.duration === "next-turn" ? zh ? "仅下一轮使用恢复,覆盖该轮的全部步骤与原生重试,轮结束即关闭。" : "Authorized for the next matching turn only, including all its steps and native retries; turns off when that turn ends." : zh ? "本会话继续使用恢复,直到关闭或验证状态失效。" : "Authorized for this session until disabled or validation expires.", " ", zh ? "尚未发送消息。请使用原生发送或重试按钮继续。" : "No message has been sent. Use the native Send or Retry control to continue.") : (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "旧推理状态无法在当前账号或连接下继续使用。可查看有损恢复选项,或新建会话;不会自动重试。" : "Old reasoning cannot be reused with this account or connection. Review recovery options or start a new conversation; nothing is retried automatically."), confirm ? (0, react.createElement)("div", null, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "恢复会跳过已识别的旧项,包括对应隐藏推理状态及项内摘要。磁盘历史、界面可见消息及工具调用保持不变;新推理照常保留。关闭不能撤销已生成的回答。" : "Recovery skips the identified old items, including their hidden reasoning state and item summaries. Stored history, displayed messages and tool calls stay unchanged; new reasoning is retained. Disabling cannot undo generated answers."), (0, react.createElement)("fieldset", {
10846
- disabled,
10847
- style: {
10848
- border: 0,
10849
- padding: 0,
10850
- marginBlock: 12
10851
- }
10852
- }, (0, react.createElement)("legend", null, zh ? "授权范围" : "Authorization duration"), ...["next-turn", "session"].map((value) => (0, react.createElement)("label", {
10853
- key: value,
10854
- style: {
10855
- display: "block",
10856
- paddingBlock: 6
10857
- }
10858
- }, (0, react.createElement)("input", {
10859
- type: "radio",
10860
- name: durationName,
10861
- value,
10862
- checked: duration === value,
10863
- onChange: () => setDuration(value)
10864
- }), " ", value === "next-turn" ? zh ? "仅下一轮使用恢复" : "Next matching turn only" : zh ? "在本会话内继续使用" : "Continue in this session"))), (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "两种授权都只适用于相同模型及验证状态,最长不超过失败证据产生后一小时;Host 重启后失效。不会处理 408、额度或上下文超限。" : "Both options require the same model and validation state, expire within one hour of the failure, and are lost on Host restart. Not a remedy for 408, quota or context limits."), (0, react.createElement)("div", { style: {
10865
- display: "flex",
10866
- flexWrap: "wrap",
10867
- gap: 8
10868
- } }, (0, react.createElement)("button", {
10869
- type: "button",
10870
- style: button,
10871
- disabled,
10872
- onClick: () => void perform(duration)
10873
- }, zh ? "接受损失并授权" : "Accept loss and authorize"), (0, react.createElement)("button", {
10874
- type: "button",
10875
- style: composerNoticeQuietButtonStyle,
10876
- disabled,
10877
- onClick: () => setConfirm(false)
10878
- }, zh ? "取消" : "Cancel"))) : (0, react.createElement)("div", { style: {
10879
- display: "flex",
10880
- flexWrap: "wrap",
10881
- gap: 8
10882
- } }, (0, react.createElement)("button", {
10883
- type: "button",
10884
- style: button,
10885
- disabled,
10886
- onClick: () => evidence.state === "enabled" ? void perform(false) : (setDuration("next-turn"), setConfirm(true))
10887
- }, evidence.state === "enabled" ? zh ? "关闭恢复" : "Disable recovery" : zh ? "查看恢复选项" : "Review recovery options"), evidence.state === "available" ? (0, react.createElement)("button", {
10888
- type: "button",
10889
- style: composerNoticeQuietButtonStyle,
10890
- disabled,
10891
- onClick: () => setDismissed(evidence.revision)
10892
- }, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", {
10888
+ running: running || busy,
10889
+ recovery: true,
10890
+ onCancel: () => setDismissed(evidence.revision)
10891
+ })) : null, running ? (0, react.createElement)("p", {
10893
10892
  role: "status",
10894
10893
  style: composerNoticeParagraphStyle
10895
10894
  }, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("details", { style: { marginTop: 8 } }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "技术详情与状态" : "Technical details and status"), evidence ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? `${evidence.model}:${evidence.itemCount} 条已识别的旧加密推理项;不是已证明无效的项数。` : `${evidence.model}: ${evidence.itemCount} identified old encrypted reasoning items; not a count of proven invalid items.`) : null, (0, react.createElement)("button", {