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

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
@@ -7353,35 +7353,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7353
7353
  const [account, setAccount] = react.useState();
7354
7354
  const [accountFailed, setAccountFailed] = react.useState(false);
7355
7355
  const [accountAttempt, setAccountAttempt] = react.useState(0);
7356
- react.useEffect(() => {
7357
- setAccount(void 0);
7358
- setAccountFailed(false);
7359
- if (turn === void 0 || sessionId === void 0 || props.accountRemote === void 0) return;
7360
- let active = true;
7361
- props.accountRemote.turn(sessionId, turn).then((result) => {
7362
- if (!active) return;
7363
- const parsed = result.ok ? TurnAccountViewSchema.safeParse(result.value) : void 0;
7364
- if (parsed?.success) setAccount(parsed.data);
7365
- else {
7366
- setAccountFailed(true);
7367
- props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
7368
- }
7369
- }, () => {
7370
- if (active) {
7371
- setAccountFailed(true);
7372
- props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
7373
- }
7374
- });
7375
- return () => {
7376
- active = false;
7377
- };
7378
- }, [
7379
- props.accountRemote,
7380
- sessionId,
7381
- turn,
7382
- props.diagnostic,
7383
- accountAttempt
7384
- ]);
7385
7356
  react.useEffect(() => {
7386
7357
  setLive({ mode: "unknown" });
7387
7358
  if (turn === void 0 || sessionId === void 0 || props.remote === void 0) {
@@ -7434,6 +7405,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7434
7405
  const native = record$4(props.tail) && record$4(props.tail.data) ? props.tail.data : void 0;
7435
7406
  const nativeCompleted = native?.turn === turn && sequence(native?.seq);
7436
7407
  const completed = evidence?.ended === true || nativeCompleted;
7408
+ react.useEffect(() => {
7409
+ setAccount(void 0);
7410
+ setAccountFailed(false);
7411
+ if (turn === void 0 || sessionId === void 0 || props.accountRemote === void 0) return;
7412
+ let active = true;
7413
+ props.accountRemote.turn(sessionId, turn).then((result) => {
7414
+ if (!active) return;
7415
+ const parsed = result.ok ? TurnAccountViewSchema.safeParse(result.value) : void 0;
7416
+ if (parsed?.success) setAccount(parsed.data);
7417
+ else {
7418
+ setAccountFailed(true);
7419
+ props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
7420
+ }
7421
+ }, () => {
7422
+ if (active) {
7423
+ setAccountFailed(true);
7424
+ props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
7425
+ }
7426
+ });
7427
+ return () => {
7428
+ active = false;
7429
+ };
7430
+ }, [
7431
+ props.accountRemote,
7432
+ sessionId,
7433
+ turn,
7434
+ props.diagnostic,
7435
+ accountAttempt,
7436
+ completed
7437
+ ]);
7437
7438
  const nativeRoutes = nativeCompleted && record$4(native?.tokenUsage) && Array.isArray(native.tokenUsage.routes) ? native.tokenUsage.routes : [];
7438
7439
  const recorded = evidence?.routes.length ? evidence.routes : nativeRoutes.filter((route) => record$4(route) && typeof route.provider === "string" && route.provider.trim() !== "" && typeof route.model === "string" && route.model.trim() !== "");
7439
7440
  const needsRequested = completed && recorded.length === 0;
@@ -8536,6 +8537,171 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8536
8537
  }, message || (busy ? "Loading subagent settings…" : "")));
8537
8538
  }
8538
8539
  //#endregion
8540
+ //#region lib/types/account-dropdown.js
8541
+ function AccountDropdown(props) {
8542
+ const id = (0, react.useId)();
8543
+ const localTrigger = (0, react.useRef)(null);
8544
+ const trigger = props.triggerRef ?? localTrigger;
8545
+ const menu = (0, react.useRef)(null);
8546
+ const [placement, setPlacement] = (0, react.useState)({
8547
+ left: 12,
8548
+ top: 12,
8549
+ maxHeight: 300
8550
+ });
8551
+ const change = (0, react.useRef)(props.onOpenChange);
8552
+ change.current = props.onOpenChange;
8553
+ (0, react.useLayoutEffect)(() => {
8554
+ if (!props.open) return;
8555
+ menu.current?.showPopover?.();
8556
+ const place = () => {
8557
+ const anchor = trigger.current?.getBoundingClientRect();
8558
+ if (!anchor) return;
8559
+ const width = Math.min(300, window.innerWidth - 24);
8560
+ const height = Math.min(menu.current?.scrollHeight ?? 300, 330);
8561
+ const below = window.innerHeight - anchor.bottom - 20;
8562
+ const above = anchor.top - 20;
8563
+ const upwards = below < height && above > below;
8564
+ const maxHeight = Math.max(60, Math.min(330, upwards ? above : below));
8565
+ setPlacement({
8566
+ left: Math.max(12, Math.min(anchor.right - width, window.innerWidth - width - 12)),
8567
+ top: upwards ? Math.max(12, anchor.top - Math.min(height, maxHeight) - 8) : anchor.bottom + 8,
8568
+ maxHeight
8569
+ });
8570
+ };
8571
+ place();
8572
+ (menu.current?.querySelector("button[aria-pressed=\"true\"]:not(:disabled)") ?? menu.current?.querySelector("button:not(:disabled)"))?.focus();
8573
+ window.addEventListener("resize", place);
8574
+ const scroll = (event) => {
8575
+ if (event.target instanceof Node && menu.current?.contains(event.target)) return;
8576
+ place();
8577
+ };
8578
+ window.addEventListener("scroll", scroll, true);
8579
+ return () => {
8580
+ window.removeEventListener("resize", place);
8581
+ window.removeEventListener("scroll", scroll, true);
8582
+ };
8583
+ }, [props.open, trigger]);
8584
+ (0, react.useEffect)(() => {
8585
+ if (!props.open) return;
8586
+ const outside = (event) => {
8587
+ if (event.target instanceof Node && !menu.current?.contains(event.target) && !trigger.current?.contains(event.target)) change.current(false);
8588
+ };
8589
+ document.addEventListener("pointerdown", outside);
8590
+ return () => document.removeEventListener("pointerdown", outside);
8591
+ }, [props.open, trigger]);
8592
+ return (0, react.createElement)("div", {
8593
+ "data-copilot-account-dropdown": "",
8594
+ style: {
8595
+ position: "relative",
8596
+ minWidth: 0,
8597
+ flexShrink: 0
8598
+ }
8599
+ }, (0, react.createElement)("style", null, `
8600
+ [data-copilot-account-dropdown] > button::after { content: ' ▾'; padding-left: 6px; font-size: 11px }
8601
+ [data-copilot-dropdown-option]::before { content: ''; width: 16px; flex-shrink: 0 }
8602
+ [data-copilot-dropdown-option][aria-pressed=true]::before { content: '✓' }
8603
+ [data-copilot-dropdown-option]:hover { background: var(--dsw-alias-bg-layer-2, ButtonFace) !important }
8604
+ [data-copilot-account-dropdown] button:focus-visible { outline: 2px solid var(--dsw-alias-label-primary, CanvasText); outline-offset: -2px }
8605
+ `), (0, react.createElement)("button", {
8606
+ ref: trigger,
8607
+ type: "button",
8608
+ style: {
8609
+ ...props.triggerStyle,
8610
+ whiteSpace: "nowrap"
8611
+ },
8612
+ disabled: props.disabled,
8613
+ "aria-label": props.label,
8614
+ "aria-expanded": props.open,
8615
+ "aria-controls": props.open ? id : void 0,
8616
+ onClick: () => props.onOpenChange(!props.open)
8617
+ }, props.label), props.open ? (0, react.createElement)("div", {
8618
+ ref: menu,
8619
+ id,
8620
+ popover: "manual",
8621
+ role: "group",
8622
+ "aria-label": props.label,
8623
+ "aria-busy": props.busy,
8624
+ "data-copilot-account-selector": "",
8625
+ style: {
8626
+ position: "fixed",
8627
+ inset: "auto",
8628
+ margin: 0,
8629
+ ...placement,
8630
+ zIndex: 1100,
8631
+ width: 300,
8632
+ maxWidth: "calc(100vw - 24px)",
8633
+ boxSizing: "border-box",
8634
+ overflowY: "auto",
8635
+ padding: 5,
8636
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
8637
+ borderRadius: 10,
8638
+ background: "var(--dsw-specific-menu, Canvas)",
8639
+ color: "var(--dsw-alias-label-primary, CanvasText)",
8640
+ colorScheme: "inherit",
8641
+ font: "inherit",
8642
+ boxShadow: "0 10px 28px color-mix(in srgb, CanvasText 20%, transparent)"
8643
+ },
8644
+ onKeyDown: (event) => {
8645
+ const buttons = Array.from(menu.current?.querySelectorAll("button:not(:disabled)") ?? []);
8646
+ if (event.key === "Escape") {
8647
+ event.preventDefault();
8648
+ event.stopPropagation();
8649
+ props.onOpenChange(false);
8650
+ trigger.current?.focus();
8651
+ } else if ([
8652
+ "ArrowDown",
8653
+ "ArrowUp",
8654
+ "Home",
8655
+ "End"
8656
+ ].includes(event.key)) {
8657
+ event.preventDefault();
8658
+ const current = document.activeElement instanceof HTMLButtonElement ? buttons.indexOf(document.activeElement) : -1;
8659
+ buttons[event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowDown" ? 1 : -1) + buttons.length) % buttons.length]?.focus();
8660
+ } else if (event.key === "Tab") {
8661
+ trigger.current?.focus();
8662
+ props.onOpenChange(false);
8663
+ }
8664
+ }
8665
+ }, (0, react.createElement)("div", {
8666
+ [props.listAttribute]: "",
8667
+ style: {
8668
+ display: "grid",
8669
+ maxHeight: props.maxHeight ?? 240,
8670
+ overflowY: "auto",
8671
+ overscrollBehavior: "contain"
8672
+ }
8673
+ }, ...props.options.map((option) => (0, react.createElement)("button", {
8674
+ key: option.id,
8675
+ type: "button",
8676
+ "data-copilot-dropdown-option": "",
8677
+ "data-copilot-saved-account": option.id,
8678
+ "aria-label": option.label,
8679
+ "aria-pressed": option.selected,
8680
+ disabled: props.busy || option.disabled,
8681
+ style: {
8682
+ font: "inherit",
8683
+ color: "inherit",
8684
+ colorScheme: "inherit",
8685
+ display: "flex",
8686
+ alignItems: "center",
8687
+ gap: 8,
8688
+ border: 0,
8689
+ borderRadius: 5,
8690
+ padding: "10px 8px",
8691
+ minHeight: 42,
8692
+ textAlign: "left",
8693
+ overflowWrap: "anywhere",
8694
+ cursor: "pointer",
8695
+ background: "transparent"
8696
+ },
8697
+ onClick: () => props.onSelect(option.id)
8698
+ }, option.label))), props.footer ? (0, react.createElement)("div", { style: {
8699
+ borderTop: "1px solid var(--dsw-alias-border-main, GrayText)",
8700
+ marginTop: 5,
8701
+ padding: "6px 4px"
8702
+ } }, props.footer) : null) : null);
8703
+ }
8704
+ //#endregion
8539
8705
  //#region lib/types/external-link.js
8540
8706
  /** Use Desktop's public v1 navigation handoff instead of WebView popup creation. */
8541
8707
  function externalLinkTarget() {
@@ -8658,10 +8824,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8658
8824
  identityChecking: "Checking GitHub identity…",
8659
8825
  identityUnavailable: "GitHub account identity unavailable",
8660
8826
  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",
8827
+ savedAccounts: "Manage saved authorizations",
8665
8828
  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
8829
  remoteUnavailable: "Account management is unavailable in this deployment.",
8667
8830
  readFailed: "Could not read account information. Retry before changing accounts.",
@@ -8722,10 +8885,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8722
8885
  identityChecking: "正在检查 GitHub 身份…",
8723
8886
  identityUnavailable: "GitHub 账号身份暂不可用",
8724
8887
  accounts: "账号管理",
8725
- searchAccounts: "搜索已保存的 GitHub 账号",
8726
- noAccountsMatch: "没有匹配的已保存账号。",
8727
- switchTo: (account) => `切换到 ${account}`,
8728
- closeAccounts: "关闭账号列表",
8888
+ savedAccounts: "管理已保存授权",
8729
8889
  scope: "全局默认账号用于后续继承默认值的新 turn。Credits 可为本 Session 后续 turn 指定账号。正在运行的 turn、Session 已指定账号、模型和对话历史保持不变。",
8730
8890
  remoteUnavailable: "当前部署无法管理账号。",
8731
8891
  readFailed: "无法读取账号信息。更改账号前请重试。",
@@ -8818,7 +8978,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8818
8978
  const [authorizationIntent, setAuthorizationIntent] = (0, react.useState)();
8819
8979
  const [confirmation, setConfirmation] = (0, react.useState)();
8820
8980
  const [accountsOpen, setAccountsOpen] = (0, react.useState)(false);
8821
- const [accountSearch, setAccountSearch] = (0, react.useState)("");
8822
8981
  const lifetime = (0, react.useRef)({
8823
8982
  active: false,
8824
8983
  generation: 0,
@@ -8830,7 +8989,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8830
8989
  (0, react.useEffect)(() => {
8831
8990
  if (!props.expanded) {
8832
8991
  setAccountsOpen(false);
8833
- setAccountSearch("");
8834
8992
  setConfirmation(void 0);
8835
8993
  }
8836
8994
  }, [props.expanded]);
@@ -8982,11 +9140,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8982
9140
  const activeAccount = view?.accounts.find((account) => account.id === view.activeAccountId);
8983
9141
  const selected = confirmation === void 0 ? void 0 : view?.accounts.find((item) => item.id === confirmation.id);
8984
9142
  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
- });
9143
+ const savedAccounts = view?.accounts ?? [];
8990
9144
  const pending = busy || props.authorizationBusy === true || view?.operation !== void 0;
8991
9145
  const authorizationOperation = view?.operation === "authorizing" || view?.operation === "verifying";
8992
9146
  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 +9159,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9005
9159
  const accountName = account.identityState === "ready" && account.identity !== void 0 ? `@${account.identity.login}` : text.savedAuthorization;
9006
9160
  return (0, react.createElement)("li", {
9007
9161
  key: account.id,
9008
- "data-copilot-saved-account": account.id,
9009
9162
  style: {
9010
9163
  display: "flex",
9011
9164
  flexWrap: "wrap",
@@ -9017,13 +9170,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9017
9170
  }, (0, react.createElement)("div", { style: {
9018
9171
  minWidth: 0,
9019
9172
  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, () => {
9173
+ } }, (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
9174
  if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(account.id, view.revision);
9028
9175
  }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
9029
9176
  if (view?.revision !== void 0) setConfirmation({
@@ -9146,50 +9293,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9146
9293
  "data-copilot-current-account": "",
9147
9294
  role: "status",
9148
9295
  "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)"
9296
+ }, identity ?? text.identityUnavailableLabel), (0, react.createElement)("p", { style: muted$1 }, text.currentDefault)), (0, react.createElement)(AccountDropdown, {
9297
+ label: text.switch,
9298
+ open: accountsOpen,
9299
+ triggerStyle: button$1,
9300
+ disabled: pending || view?.switchable !== true || view?.revision === void 0,
9301
+ busy: pending,
9302
+ onOpenChange: (open) => {
9303
+ setAccountsOpen(open);
9304
+ setConfirmation(void 0);
9175
9305
  },
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", {
9306
+ options: savedAccounts.map((account) => ({
9307
+ id: account.id,
9308
+ label: account.identityState === "ready" && account.identity ? `@${account.identity.login}` : `${text.savedAuthorization}${account.id === "canonical" ? "" : ` ${savedAccounts.indexOf(account) + 1}`} · ${text.identityUnavailableLabel}`,
9309
+ selected: account.id === view?.activeAccountId,
9310
+ disabled: !account.configured
9311
+ })),
9312
+ onSelect: (id) => {
9313
+ setAccountsOpen(false);
9314
+ if (id !== view?.activeAccountId && view?.revision !== void 0) setConfirmation({
9315
+ id,
9316
+ revision: view.revision,
9317
+ remove: false
9318
+ });
9319
+ },
9320
+ listAttribute: "data-copilot-saved-accounts",
9321
+ footer: authorizationOperation ? null : control(text.add, () => {
9322
+ setAccountsOpen(false);
9323
+ if (props.remote !== void 0) startAdd();
9324
+ }, pending || view?.writable !== true || view?.switchable !== true)
9325
+ })), props.addOnly || confirmation === void 0 ? null : (0, react.createElement)("div", {
9193
9326
  role: "group",
9194
9327
  "aria-label": confirmation.remove ? text.confirmRemoveTitle : text.confirmSwitchTitle,
9195
9328
  style: {
@@ -9217,7 +9350,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9217
9350
  if (managementRemote !== void 0) run(() => managementRemote.refreshIdentity());
9218
9351
  }, pending || props.remote === void 0), activeAccount === void 0 || activeAccount.id === "canonical" ? null : control(text.reauthorize, () => {
9219
9352
  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));
9353
+ }, 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: {
9354
+ listStyle: "none",
9355
+ padding: 0,
9356
+ maxHeight: 240,
9357
+ overflowY: "auto"
9358
+ } }, ...savedAccountItems)), props.accountSettings ?? null, props.continuationSettings ?? null));
9221
9359
  }
9222
9360
  //#endregion
9223
9361
  //#region lib/types/copilot-usage-card.js
@@ -9267,13 +9405,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9267
9405
  originalAuthorization: "Original authorization",
9268
9406
  savedAuthorization: "Saved authorization",
9269
9407
  nextAccount: "Next turn",
9270
- searchAccounts: "Search saved accounts",
9271
- cancel: "Cancel",
9272
- noAccounts: "No matching accounts. Change your search or add an account.",
9273
9408
  savingAccount: "Saving account…",
9274
9409
  manage: "Manage accounts and models",
9275
- confirmingAccount: "Reviewing account switch…",
9276
- navigationUnavailable: "Account and model settings navigation is unavailable in this deployment."
9410
+ confirmingAccount: "Reviewing account switch…"
9277
9411
  },
9278
9412
  zh: {
9279
9413
  credits: "额度",
@@ -9320,13 +9454,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9320
9454
  originalAuthorization: "原始授权",
9321
9455
  savedAuthorization: "已保存授权",
9322
9456
  nextAccount: "下一轮",
9323
- searchAccounts: "搜索已保存账号",
9324
- cancel: "取消",
9325
- noAccounts: "未找到匹配账号,请修改搜索或添加账号。",
9326
9457
  savingAccount: "正在保存账号…",
9327
9458
  manage: "管理账号与模型",
9328
- confirmingAccount: "正在确认账号切换…",
9329
- navigationUnavailable: "当前部署无法导航至账号与模型设置。"
9459
+ confirmingAccount: "正在确认账号切换…"
9330
9460
  }
9331
9461
  };
9332
9462
  const secondary = "var(--dsw-alias-label-secondary, GrayText)";
@@ -9383,7 +9513,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9383
9513
  const [accounts, setAccounts] = (0, react.useState)();
9384
9514
  const [sessionAccount, setSessionAccount] = (0, react.useState)();
9385
9515
  const [choosingAccount, setChoosingAccount] = (0, react.useState)(false);
9386
- const [accountQuery, setAccountQuery] = (0, react.useState)("");
9387
9516
  const [savingAccount, setSavingAccount] = (0, react.useState)(false);
9388
9517
  const [confirmingAccount, setConfirmingAccount] = (0, react.useState)(false);
9389
9518
  const [accountFailed, setAccountFailed] = (0, react.useState)(false);
@@ -9399,7 +9528,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9399
9528
  const panel = (0, react.useRef)(null);
9400
9529
  const closeButton = (0, react.useRef)(null);
9401
9530
  const switchButton = (0, react.useRef)(null);
9402
- const accountSearch = (0, react.useRef)(null);
9403
9531
  const lifecycle = (0, react.useRef)({
9404
9532
  active: false,
9405
9533
  generation: 0,
@@ -9418,12 +9546,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9418
9546
  owner.controller = void 0;
9419
9547
  setOpen(false);
9420
9548
  setChoosingAccount(false);
9421
- setAccountQuery("");
9422
9549
  if (restore) trigger.current?.focus();
9423
9550
  }, []);
9424
9551
  const collapseAccounts = () => {
9425
9552
  setChoosingAccount(false);
9426
- setAccountQuery("");
9427
9553
  switchButton.current?.focus();
9428
9554
  };
9429
9555
  const load = (0, react.useCallback)(async (force) => {
@@ -9492,7 +9618,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9492
9618
  setAccounts(void 0);
9493
9619
  setSessionAccount(void 0);
9494
9620
  setChoosingAccount(false);
9495
- setAccountQuery("");
9496
9621
  setSavingAccount(false);
9497
9622
  setConfirmingAccount(false);
9498
9623
  setAccountFailed(false);
@@ -9588,7 +9713,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9588
9713
  setAccounts(parsed.data.accounts);
9589
9714
  setView(void 0);
9590
9715
  setChoosingAccount(false);
9591
- setAccountQuery("");
9592
9716
  owner.save = void 0;
9593
9717
  setSavingAccount(false);
9594
9718
  await load(false);
@@ -9631,9 +9755,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9631
9755
  window.removeEventListener("scroll", place, true);
9632
9756
  };
9633
9757
  }, [open]);
9634
- (0, react.useEffect)(() => {
9635
- if (open && choosingAccount) accountSearch.current?.focus();
9636
- }, [open, choosingAccount]);
9637
9758
  (0, react.useEffect)(() => {
9638
9759
  if (!open) return;
9639
9760
  const outside = (event) => {
@@ -9698,8 +9819,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9698
9819
  id: account.id,
9699
9820
  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
9821
  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";
9822
+ }))] : [];
9703
9823
  return (0, react.createElement)("span", { style: {
9704
9824
  display: "inline-flex",
9705
9825
  minWidth: 0,
@@ -9786,85 +9906,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9786
9906
  onClick: () => {
9787
9907
  close(true);
9788
9908
  }
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: {
9909
+ }, "×")), 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, {
9910
+ triggerRef: switchButton,
9911
+ triggerStyle: {
9793
9912
  ...button,
9794
9913
  flexShrink: 0
9795
9914
  },
9915
+ label: t.switchAccount,
9916
+ open: choosingAccount,
9917
+ busy: savingAccount,
9918
+ maxHeight: 220,
9796
9919
  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();
9920
+ onOpenChange: (next) => {
9921
+ if (!next) collapseAccounts();
9801
9922
  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
9923
  },
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", {
9924
+ options: accountOptions.map((option) => ({
9925
+ ...option,
9926
+ id: option.id ?? "follow-global"
9927
+ })),
9928
+ onSelect: (accountId) => {
9929
+ chooseAccount(accountId === "follow-global" ? null : accountId);
9930
+ },
9931
+ listAttribute: "data-copilot-account-options",
9932
+ footer: props.accountActions
9933
+ })), 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
9934
  role: "status",
9866
9935
  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", {
9936
+ }, 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
9937
  role: "alert",
9869
9938
  style: muted
9870
9939
  }, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), props.continuation, view?.state === "stale" ? (0, react.createElement)("p", {
@@ -9933,15 +10002,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9933
10002
  }, t.plan), (0, react.createElement)("details", { style: muted }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, t.manual), (0, react.createElement)("code", { style: {
9934
10003
  userSelect: "all",
9935
10004
  overflowWrap: "anywhere"
9936
- } }, "https://github.com/settings/copilot")), (0, react.createElement)("div", { style: {
10005
+ } }, "https://github.com/settings/copilot")), props.onManage === void 0 ? null : (0, react.createElement)("div", { style: {
9937
10006
  ...separator,
9938
10007
  display: "grid",
9939
10008
  gap: 6
9940
10009
  } }, (0, react.createElement)("button", {
9941
10010
  type: "button",
9942
10011
  role: "link",
9943
- disabled: props.onManage === void 0,
9944
- "aria-describedby": props.onManage === void 0 ? `${id}-navigation` : void 0,
9945
10012
  style: {
9946
10013
  ...button,
9947
10014
  border: "none",
@@ -9949,8 +10016,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9949
10016
  textAlign: "left",
9950
10017
  textDecoration: "underline",
9951
10018
  padding: 0,
9952
- color: props.onManage === void 0 ? secondary : "inherit",
9953
- cursor: props.onManage === void 0 ? "default" : "pointer"
10019
+ color: "inherit",
10020
+ cursor: "pointer"
9954
10021
  },
9955
10022
  onClick: () => {
9956
10023
  if (props.onManage !== void 0) {
@@ -9958,12 +10025,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9958
10025
  props.onManage();
9959
10026
  }
9960
10027
  }
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);
10028
+ }, t.manage))) : null);
9965
10029
  }
9966
10030
  //#endregion
10031
+ //#region lib/types/composer-notice-style.js
10032
+ const composerNoticeStyle = {
10033
+ width: "100%",
10034
+ minWidth: 0,
10035
+ maxWidth: "var(--dsh-composer-card-max-width, 100%)",
10036
+ marginInline: "auto",
10037
+ boxSizing: "border-box",
10038
+ fontFamily: "var(--dsw-font-family, inherit)",
10039
+ fontSize: "var(--dsh-content-font-size-secondary, 13px)",
10040
+ fontWeight: 400,
10041
+ lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
10042
+ color: "var(--dsw-alias-label-secondary, GrayText)",
10043
+ overflowWrap: "anywhere"
10044
+ };
10045
+ const composerNoticeSurfaceStyle = {
10046
+ ...composerNoticeStyle,
10047
+ padding: "10px 12px",
10048
+ borderRadius: "var(--dsw-radius-md, 8px)",
10049
+ background: "var(--dsw-alias-interactive-bg-hover, transparent)"
10050
+ };
10051
+ const composerNoticeParagraphStyle = {
10052
+ marginBlock: 8,
10053
+ maxWidth: "38rem"
10054
+ };
10055
+ const composerNoticeButtonStyle = {
10056
+ fontFamily: "inherit",
10057
+ fontSize: "inherit",
10058
+ fontWeight: "inherit",
10059
+ lineHeight: "inherit",
10060
+ color: "var(--dsw-alias-label-primary, CanvasText)",
10061
+ maxWidth: "100%",
10062
+ background: "transparent",
10063
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
10064
+ borderRadius: 6,
10065
+ padding: "6px 10px",
10066
+ cursor: "pointer"
10067
+ };
10068
+ //#endregion
9967
10069
  //#region lib/types/session-continuation-ui.js
9968
10070
  const control = {
9969
10071
  font: "inherit",
@@ -9979,8 +10081,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9979
10081
  fontSize: 13,
9980
10082
  lineHeight: 1.5
9981
10083
  };
9982
- function SessionContinuationCard({ sessionId, remote, locale = "en", running = false, onEnabledChange, expanded = false }) {
10084
+ function SessionContinuationCard({ sessionId, remote, locale = "en", running = false, onEnabledChange, expanded = false, recovery = false, onCancel }) {
9983
10085
  const zh = locale.startsWith("zh");
10086
+ const body = recovery ? composerNoticeParagraphStyle : paragraph;
10087
+ const button = recovery ? composerNoticeButtonStyle : control;
9984
10088
  const [view, setView] = (0, react.useState)();
9985
10089
  const [busy, setBusy] = (0, react.useState)(false);
9986
10090
  const [error, setError] = (0, react.useState)(false);
@@ -10016,16 +10120,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10016
10120
  running,
10017
10121
  reload
10018
10122
  ]);
10019
- const save = async (enabled, next = false) => {
10020
- if (!view || !remote || busy) return;
10123
+ const save = async (enabled) => {
10124
+ if (!view || !remote || busy || recovery && running) return;
10021
10125
  const generation = owner.current;
10022
10126
  setBusy(true);
10023
10127
  setError(false);
10024
10128
  try {
10025
- const result = next ? await remote.authorizeNext?.(sessionId, view.revision, enabled === true) : await remote.set(sessionId, view.revision, enabled);
10129
+ const result = await remote.set(sessionId, view.revision, enabled);
10026
10130
  const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10027
10131
  if (owner.current !== generation) return;
10028
- if (!parsed?.success) {
10132
+ if (!parsed?.success || enabled !== null && parsed.data.enabled !== enabled) {
10029
10133
  setView(void 0);
10030
10134
  setError(true);
10031
10135
  } else setView(parsed.data);
@@ -10038,11 +10142,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10038
10142
  if (owner.current === generation) setBusy(false);
10039
10143
  }
10040
10144
  };
10145
+ 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.");
10146
+ const unavailable = error ? (0, react.createElement)("p", {
10147
+ role: "alert",
10148
+ style: body
10149
+ }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10150
+ type: "button",
10151
+ style: button,
10152
+ disabled: busy || recovery && running,
10153
+ onClick: () => setReload((value) => value + 1)
10154
+ }, zh ? "重试读取" : "Retry read")) : null;
10155
+ if (recovery) return (0, react.createElement)("div", { "data-copilot-continuation-recovery": "" }, !view && !error ? (0, react.createElement)("p", {
10156
+ role: "status",
10157
+ style: body
10158
+ }, zh ? "正在读取降级续聊策略…" : "Reading continuation policy…") : null, view?.enabled ? (0, react.createElement)("p", {
10159
+ role: "status",
10160
+ style: body
10161
+ }, 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", {
10162
+ type: "button",
10163
+ style: button,
10164
+ disabled: busy || running,
10165
+ onClick: () => void save(true)
10166
+ }, zh ? "开启降级续聊" : "Enable visible-history continuation")) : null, unavailable, (0, react.createElement)("button", {
10167
+ type: "button",
10168
+ style: button,
10169
+ disabled: busy || running,
10170
+ onClick: onCancel
10171
+ }, zh ? "取消" : "Cancel"));
10041
10172
  return (0, react.createElement)("details", {
10042
10173
  open: expanded || void 0,
10043
10174
  "data-copilot-continuation-settings": "",
10044
10175
  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: {
10176
+ }, (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
10177
  display: "flex",
10047
10178
  gap: 8,
10048
10179
  alignItems: "center",
@@ -10066,29 +10197,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10066
10197
  }, label)))), view?.activeTurnEnabled !== void 0 && view.activeTurnEnabled !== view.enabled ? (0, react.createElement)("p", {
10067
10198
  role: "status",
10068
10199
  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);
10200
+ }, zh ? "当前轮保持原策略,变更从下一轮生效。" : "The active turn keeps its policy; changes apply next turn.") : null, unavailable);
10092
10201
  }
10093
10202
  function ContinuationDefaultCard({ remote, locale = "en", onSaved }) {
10094
10203
  const zh = locale.startsWith("zh");
@@ -10177,10 +10286,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10177
10286
  setBusy(true);
10178
10287
  setError(false);
10179
10288
  try {
10180
- const result = choice === "session" ? await remote.set(sessionId, consent.view.revision, true) : await remote.authorizeNext?.(sessionId, consent.view.revision, true);
10289
+ const result = await remote.set(sessionId, consent.view.revision, true);
10181
10290
  const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10182
10291
  if (!active.current) return;
10183
- if (!parsed?.success || (choice === "session" ? !parsed.data.enabled : !parsed.data.nextTurnAuthorized)) setError(true);
10292
+ if (!parsed?.success || !parsed.data.enabled) setError(true);
10184
10293
  else done(true);
10185
10294
  } catch {
10186
10295
  if (active.current) setError(true);
@@ -10197,7 +10306,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10197
10306
  padding: 10,
10198
10307
  marginBlock: 10
10199
10308
  }
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: {
10309
+ }, (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
10310
  display: "flex",
10202
10311
  flexWrap: "wrap",
10203
10312
  gap: 8
@@ -10207,11 +10316,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10207
10316
  disabled: busy,
10208
10317
  onClick: () => void choose("session")
10209
10318
  }, 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
10319
  type: "button",
10216
10320
  style: control,
10217
10321
  disabled: busy,
@@ -10428,8 +10532,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10428
10532
  remote: addRemote,
10429
10533
  locale: language,
10430
10534
  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."
10535
+ }) : void 0
10433
10536
  });
10434
10537
  }
10435
10538
  /** Public additive dock only; native composer, ContextMeter and other features stay owned by Core. */
@@ -10564,56 +10667,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10564
10667
  reasoningTokens: count.optional()
10565
10668
  });
10566
10669
  //#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
10670
  //#region lib/types/context-evidence-ui.js
10618
10671
  const slot = "conversation.input.dock";
10619
10672
  const noop$1 = () => {};
@@ -10733,17 +10786,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10733
10786
  }
10734
10787
  function ReplayRecoveryCard({ sessionId, remote, continuation, locale = "en", running = false, refreshKey = "" }) {
10735
10788
  const zh = locale.startsWith("zh");
10736
- const durationName = (0, react.useId)();
10737
10789
  const [view, setView] = (0, react.useState)();
10738
10790
  const [busy, setBusy] = (0, react.useState)(false);
10739
10791
  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
10792
  const [dismissed, setDismissed] = (0, react.useState)();
10743
10793
  const [hadEvidence, setHadEvidence] = (0, react.useState)(false);
10744
- const latest = (0, react.useRef)(view);
10745
10794
  const active = (0, react.useRef)(running);
10746
- latest.current = view;
10747
10795
  active.current = running;
10748
10796
  const pending = (0, react.useRef)(false);
10749
10797
  const refreshPending = (0, react.useRef)(false);
@@ -10754,19 +10802,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10754
10802
  mounted.current = false;
10755
10803
  };
10756
10804
  }, []);
10757
- const perform = (0, react.useCallback)(async (authorization) => {
10805
+ const perform = (0, react.useCallback)(async () => {
10758
10806
  if (pending.current) {
10759
- if (authorization === void 0) refreshPending.current = true;
10807
+ refreshPending.current = true;
10760
10808
  return;
10761
10809
  }
10762
10810
  if (active.current) return;
10763
10811
  pending.current = true;
10764
10812
  setBusy(true);
10765
10813
  setError(false);
10766
- setConfirm(false);
10767
10814
  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;
10815
+ const result = await remote.get(sessionId);
10770
10816
  const parsed = result?.ok ? ReplayRecoveryViewSchema.safeParse(result.value) : void 0;
10771
10817
  if (!mounted.current) return;
10772
10818
  if (parsed?.success) {
@@ -10793,7 +10839,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10793
10839
  }
10794
10840
  }, [remote, sessionId]);
10795
10841
  (0, react.useEffect)(() => {
10796
- setConfirm(false);
10797
10842
  if (!running) perform();
10798
10843
  }, [
10799
10844
  running,
@@ -10810,7 +10855,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10810
10855
  const disabled = busy || running;
10811
10856
  const evidence = view && view.state !== "unavailable" ? view : void 0;
10812
10857
  if (!error && !evidence && !hadEvidence) return null;
10813
- if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
10858
+ if (!error && evidence && dismissed === evidence.revision) return (0, react.createElement)("button", {
10814
10859
  type: "button",
10815
10860
  style: {
10816
10861
  ...button,
@@ -10833,63 +10878,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10833
10878
  color: "var(--dsw-alias-label-primary, CanvasText)",
10834
10879
  fontWeight: 600
10835
10880
  }
10836
- }, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10881
+ }, evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10837
10882
  role: "alert",
10838
10883
  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, {
10884
+ }, 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, {
10885
+ key: evidence.revision,
10840
10886
  sessionId,
10841
10887
  remote: continuation,
10842
10888
  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", {
10889
+ running: running || busy,
10890
+ recovery: true,
10891
+ onCancel: () => setDismissed(evidence.revision)
10892
+ })) : null, running ? (0, react.createElement)("p", {
10893
10893
  role: "status",
10894
10894
  style: composerNoticeParagraphStyle
10895
10895
  }, 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", {