dsh-github-copilot 0.4.0-alpha.106 → 0.4.0-alpha.107

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
@@ -5954,7 +5954,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5954
5954
  userId: number().int().positive().max(Number.MAX_SAFE_INTEGER)
5955
5955
  }).strict().optional()
5956
5956
  }).strict()).max(32),
5957
- operation: _enum(["authorizing", "switching"]).optional(),
5957
+ operation: _enum([
5958
+ "authorizing",
5959
+ "verifying",
5960
+ "switching"
5961
+ ]).optional(),
5958
5962
  notices: array(object({
5959
5963
  message: string().min(1).max(512),
5960
5964
  url: literal("https://github.com/login/device").optional(),
@@ -6694,6 +6698,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6694
6698
  }
6695
6699
  //#endregion
6696
6700
  //#region lib/types/turn-selection-card.js
6701
+ function turnAccountLabel(account, zh) {
6702
+ if (account.state !== "recorded" || account.identity === void 0) return zh ? "身份暂不可用" : "identity unavailable";
6703
+ return `@${account.identity.login}`;
6704
+ }
6697
6705
  function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry, account, accountFailed = false, retryAccount, models, modelsFailed = false, retryModels }) {
6698
6706
  const zh = locale.startsWith("zh");
6699
6707
  const id = (0, react.useId)();
@@ -6787,7 +6795,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6787
6795
  setAccountOpen(true);
6788
6796
  setOpen(true);
6789
6797
  }
6790
- }, accountFailed ? zh ? "账号记录读取失败" : "Account unavailable" : account?.state === "recorded" ? `Account · ${account.identity ? "@" + account.identity.login : account.accountId === "canonical" ? "Canonical" : account.accountId.slice(0, 8)}` : zh ? "Account · 未知" : "Account · unknown"), (0, react.createElement)("span", {
6798
+ }, accountFailed ? zh ? "账号记录读取失败" : "Account unavailable" : account?.state === "recorded" ? `${zh ? "账号" : "Account"} · ${turnAccountLabel(account, zh)}` : zh ? "Account · 未知" : "Account · unknown"), (0, react.createElement)("span", {
6791
6799
  role: readState === "ready" ? void 0 : "status",
6792
6800
  title: readState === "ready" && selection.mode === "unknown" ? zh ? "本轮选择记录未保留;不从当前选择推断历史。" : "No retained selection evidence; the current picker is not historical evidence." : void 0
6793
6801
  }, readState === "loading" ? zh ? "正在读取选择记录…" : "Loading selection…" : readState === "failed" ? zh ? "选择记录读取失败" : "Selection unavailable" : label), readState === "failed" && retry ? (0, react.createElement)("button", {
@@ -6850,7 +6858,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6850
6858
  type: "button",
6851
6859
  style: button,
6852
6860
  onClick: retryModels
6853
- }, zh ? "重试" : "Retry") : null) : null, accountOpen ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, accountFailed ? zh ? "无法读取本轮账号记录,不等同于没有记录。" : "Could not read account evidence; this is not proof of missing evidence." : account?.state === "recorded" ? `${zh ? "账号" : "Account"}: ${account.identity ? "@" + account.identity.login : account.accountId}` : zh ? "本轮没有保留账号证据,不从当前账号选择推断历史。" : "No retained account evidence; the current account selection cannot reconstruct history."), account?.state === "recorded" ? (0, react.createElement)("p", null, account.source === "global" ? zh ? "本轮发送时跟随全局默认,账号已锁定。" : "Inherited the global default at turn admission; account was frozen." : zh ? "本轮使用 Session 指定账号,账号已锁定。" : "Used the Session override; account was frozen.") : null, (0, react.createElement)("p", null, zh ? "这是有原生流返回的请求账号记录,不是单轮费用或子 Agent 的账号汇总。仅保留在 Host 生命周期内;重启后缺失显示未知。" : "Account evidence from a native stream delivery, not turn billing or subagent attribution. Retained for the Host lifetime only; missing evidence after restart is unknown."), accountFailed && retryAccount ? (0, react.createElement)("button", {
6861
+ }, zh ? "重试" : "Retry") : null) : null, accountOpen ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, accountFailed ? zh ? "无法读取本轮账号记录,不等同于没有记录。" : "Could not read account evidence; this is not proof of missing evidence." : account?.state === "recorded" ? `${zh ? "账号" : "Account"}: ${turnAccountLabel(account, zh)}` : zh ? "本轮没有保留账号证据,不从当前账号选择推断历史。" : "No retained account evidence; the current account selection cannot reconstruct history."), account?.state === "recorded" ? (0, react.createElement)("p", null, account.source === "global" ? zh ? "本轮发送时跟随全局默认,账号已锁定。" : "Inherited the global default at turn admission; account was frozen." : zh ? "本轮使用 Session 指定账号,账号已锁定。" : "Used the Session override; account was frozen.") : null, (0, react.createElement)("p", null, zh ? "这是有原生流返回的请求账号记录,不是单轮费用或子 Agent 的账号汇总。仅保留在 Host 生命周期内;重启后缺失显示未知。" : "Account evidence from a native stream delivery, not turn billing or subagent attribution. Retained for the Host lifetime only; missing evidence after restart is unknown."), accountFailed && retryAccount ? (0, react.createElement)("button", {
6854
6862
  type: "button",
6855
6863
  style: button,
6856
6864
  onClick: retryAccount
@@ -8505,6 +8513,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8505
8513
  }
8506
8514
  };
8507
8515
  //#endregion
8516
+ //#region lib/types/authorization-code-clipboard.js
8517
+ async function copyAuthorizationCode(code, clipboard) {
8518
+ const writer = clipboard ?? globalThis.navigator?.clipboard;
8519
+ if (writer === void 0) throw new Error("Clipboard access is unavailable");
8520
+ await writer.writeText(code);
8521
+ }
8522
+ //#endregion
8508
8523
  //#region lib/types/copilot-accounts-card.js
8509
8524
  /** Copy owned presentation fields before decoding traced Client values. */
8510
8525
  function accountsViewFrom(value) {
@@ -8572,16 +8587,163 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8572
8587
  lineHeight: 1.5,
8573
8588
  margin: "6px 0"
8574
8589
  };
8590
+ const accountCopy = {
8591
+ en: {
8592
+ identityChecking: "Checking GitHub identity…",
8593
+ identityUnavailable: "GitHub account identity unavailable",
8594
+ accounts: "GitHub accounts",
8595
+ 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.",
8596
+ remoteUnavailable: "Account management is unavailable in this deployment.",
8597
+ readFailed: "Could not read account information. Retry before changing accounts.",
8598
+ switchUnavailable: "Account switching is temporarily unavailable. Refresh account information and try again. No running work will be cancelled.",
8599
+ routeBlocked: "Account switching is unavailable while a native Copilot route remains configured or selected.",
8600
+ evidenceIncomplete: "Account switching is unavailable because route or activity evidence is incomplete.",
8601
+ authorizationBusy: "Account switching is paused while GitHub authorization is in progress.",
8602
+ verifyingBusy: "Account switching is paused while the authorized account is being verified.",
8603
+ switchingBusy: "An account change is already in progress.",
8604
+ technicalDetails: "Technical details",
8605
+ currentDefault: "Current default",
8606
+ savedAuthorization: "Saved authorization",
8607
+ authorizationUnavailable: "Authorization unavailable",
8608
+ identityUnavailableLabel: "Identity unavailable",
8609
+ switch: "Switch",
8610
+ reauthorize: "Reauthorize",
8611
+ remove: "Remove",
8612
+ confirmRemoveTitle: "Confirm account removal",
8613
+ confirmSwitchTitle: "Confirm account switch",
8614
+ removePrompt: (account) => `Remove the saved authorization for ${account}? This does not revoke access at GitHub or delete conversations.`,
8615
+ switchPrompt: (account) => `Use ${account} for subsequent Copilot work? Existing selected models may be unavailable, and encrypted reasoning from another account may not replay. History will not be modified.`,
8616
+ confirmRemove: "Confirm removal",
8617
+ confirmSwitch: "Confirm switch",
8618
+ cancel: "Cancel",
8619
+ switchFailed: "Could not confirm the account change. Refresh account information before retrying.",
8620
+ authorizationFailed: "GitHub authorization did not complete. Try adding the account again.",
8621
+ authorizationUnavailableError: "GitHub authorization is unavailable in this deployment.",
8622
+ modelsFailed: "Could not verify the account’s available models. Try again.",
8623
+ identityFailed: "Could not verify the GitHub account identity. Try again.",
8624
+ accountFailed: "Could not update GitHub account information. Refresh and try again.",
8625
+ addingStarting: "Adding account…",
8626
+ addingWaiting: "Adding account — waiting for GitHub authorization",
8627
+ reauthorizingStarting: "Reauthorizing account…",
8628
+ reauthorizingWaiting: "Reauthorizing account — waiting for GitHub authorization",
8629
+ authorizationStarting: "GitHub authorization is starting…",
8630
+ authorizationWaiting: "Waiting for GitHub authorization…",
8631
+ verifyingAdding: "GitHub authorization complete — verifying account identity and available models",
8632
+ verifyingReauthorizing: "GitHub authorization complete — verifying the saved account identity and available models",
8633
+ verifying: "GitHub authorization complete — verifying account identity and available models",
8634
+ pendingDefault: "Your current default account will not change.",
8635
+ verificationLink: "Open GitHub verification",
8636
+ manualUrl: "If the browser does not open, copy this address:",
8637
+ codeLabel: "One-time authorization code",
8638
+ copyCode: "Copy authorization code",
8639
+ copyingCode: "Copying…",
8640
+ copiedCodeButton: "Code copied",
8641
+ copiedCode: "Authorization code copied to clipboard.",
8642
+ copyFailed: "Could not copy the code. Select it above and copy it manually.",
8643
+ cancelAdd: "Cancel adding account",
8644
+ cancelReauthorize: "Cancel reauthorization",
8645
+ cancelling: "Cancelling…",
8646
+ add: "Add GitHub account",
8647
+ refresh: "Refresh account information",
8648
+ refreshing: "Checking…"
8649
+ },
8650
+ zh: {
8651
+ identityChecking: "正在检查 GitHub 身份…",
8652
+ identityUnavailable: "GitHub 账号身份暂不可用",
8653
+ accounts: "GitHub 账号",
8654
+ scope: "全局默认账号用于后续继承默认值的新 turn。Credits 可为本 Session 后续 turn 指定账号。正在运行的 turn、Session 已指定账号、模型和对话历史保持不变。",
8655
+ remoteUnavailable: "当前部署无法管理账号。",
8656
+ readFailed: "无法读取账号信息。更改账号前请重试。",
8657
+ switchUnavailable: "暂时无法切换账号。请刷新账号信息后重试;不会取消正在运行的工作。",
8658
+ routeBlocked: "原生 Copilot 路由仍在配置或被选用,因此无法切换账号。",
8659
+ evidenceIncomplete: "路由或活动证据不完整,因此无法切换账号。",
8660
+ authorizationBusy: "GitHub 授权进行期间无法切换账号。",
8661
+ verifyingBusy: "正在验证已授权账号,暂时无法切换。",
8662
+ switchingBusy: "账号更改正在进行中。",
8663
+ technicalDetails: "诊断详情",
8664
+ currentDefault: "当前默认账号",
8665
+ savedAuthorization: "已保存授权",
8666
+ authorizationUnavailable: "授权暂不可用",
8667
+ identityUnavailableLabel: "身份暂不可用",
8668
+ switch: "切换",
8669
+ reauthorize: "重新授权",
8670
+ remove: "移除",
8671
+ confirmRemoveTitle: "确认移除账号",
8672
+ confirmSwitchTitle: "确认切换账号",
8673
+ removePrompt: (account) => `移除 ${account} 的已保存授权?这不会撤销 GitHub 端的访问权限,也不会删除对话。`,
8674
+ switchPrompt: (account) => `后续 Copilot 工作使用 ${account}?该账号可能没有当前已选模型,加密推理内容也可能绑定其他账号。不会修改历史记录。`,
8675
+ confirmRemove: "确认移除",
8676
+ confirmSwitch: "确认切换",
8677
+ cancel: "取消",
8678
+ switchFailed: "无法确认账号更改结果。请刷新账号信息后再试。",
8679
+ authorizationFailed: "GitHub 授权未完成。请重新添加账号。",
8680
+ authorizationUnavailableError: "当前部署无法使用 GitHub 授权。",
8681
+ modelsFailed: "无法验证该账号可用的模型,请重试。",
8682
+ identityFailed: "无法验证 GitHub 账号身份,请重试。",
8683
+ accountFailed: "无法更新 GitHub 账号信息。请刷新后重试。",
8684
+ addingStarting: "正在添加账号…",
8685
+ addingWaiting: "正在添加账号,等待 GitHub 授权",
8686
+ reauthorizingStarting: "正在重新授权账号…",
8687
+ reauthorizingWaiting: "正在重新授权账号,等待 GitHub 授权",
8688
+ authorizationStarting: "正在启动 GitHub 授权…",
8689
+ authorizationWaiting: "等待 GitHub 授权…",
8690
+ verifyingAdding: "GitHub 授权已完成,正在验证账号身份和可用模型",
8691
+ verifyingReauthorizing: "GitHub 授权已完成,正在验证已保存账号的身份和可用模型",
8692
+ verifying: "GitHub 授权已完成,正在验证账号身份和可用模型",
8693
+ pendingDefault: "当前默认账号不会更改。",
8694
+ verificationLink: "打开 GitHub 验证页",
8695
+ manualUrl: "如果浏览器未打开,请复制此网址:",
8696
+ codeLabel: "一次性授权码",
8697
+ copyCode: "复制授权码",
8698
+ copyingCode: "正在复制…",
8699
+ copiedCodeButton: "已复制授权码",
8700
+ copiedCode: "授权码已复制到剪贴板。",
8701
+ copyFailed: "无法复制授权码。请选中上方代码并手动复制。",
8702
+ cancelAdd: "取消添加账号",
8703
+ cancelReauthorize: "取消重新授权",
8704
+ cancelling: "正在取消…",
8705
+ add: "添加 GitHub 账号",
8706
+ refresh: "刷新账号信息",
8707
+ refreshing: "正在检查…"
8708
+ }
8709
+ };
8710
+ function accountProblemMessage(code, text) {
8711
+ switch (code) {
8712
+ case "COPILOT_ACCOUNTS_ROUTE_BLOCKED": return text.routeBlocked;
8713
+ case "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE": return text.evidenceIncomplete;
8714
+ case "COPILOT_ACCOUNTS_BUSY": return text.switchUnavailable;
8715
+ case "COPILOT_ACCOUNTS_AUTH_FAILED": return text.authorizationFailed;
8716
+ case "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE": return text.authorizationUnavailableError;
8717
+ case "COPILOT_ACCOUNTS_MODELS_FAILED": return text.modelsFailed;
8718
+ case "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE":
8719
+ case "COPILOT_ACCOUNTS_IDENTITY_INVALID":
8720
+ case "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT":
8721
+ case "COPILOT_ACCOUNTS_IDENTITY_TLS":
8722
+ case "COPILOT_ACCOUNTS_IDENTITY_NETWORK":
8723
+ case "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED":
8724
+ case "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED":
8725
+ case "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR":
8726
+ case "COPILOT_ACCOUNTS_IDENTITY_CHANGED": return text.identityFailed;
8727
+ case "COPILOT_ACCOUNTS_CONFLICT":
8728
+ case "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN": return text.switchFailed;
8729
+ default: return text.accountFailed;
8730
+ }
8731
+ }
8575
8732
  function CopilotAccountsPanel(props) {
8576
8733
  const [view, setView] = (0, react.useState)();
8577
8734
  const [busy, setBusy] = (0, react.useState)(false);
8578
8735
  const [failed, setFailed] = (0, react.useState)(false);
8736
+ const [copyState, setCopyState] = (0, react.useState)("idle");
8737
+ const [cancelRequested, setCancelRequested] = (0, react.useState)(false);
8738
+ const [authorizationIntent, setAuthorizationIntent] = (0, react.useState)();
8579
8739
  const [confirmation, setConfirmation] = (0, react.useState)();
8580
8740
  const lifetime = (0, react.useRef)({
8581
8741
  active: false,
8582
8742
  generation: 0,
8583
- busy: false
8743
+ busy: false,
8744
+ copyGeneration: 0
8584
8745
  });
8746
+ const text = props.locale?.toLowerCase().startsWith("zh") ? accountCopy.zh : accountCopy.en;
8585
8747
  const run = (0, react.useCallback)(async (operation, changed = false, invalidate = changed) => {
8586
8748
  const owner = lifetime.current;
8587
8749
  if (!owner.active || owner.busy) return;
@@ -8597,11 +8759,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8597
8759
  const next = result.ok ? accountsViewFrom(result.value) : void 0;
8598
8760
  setView(next);
8599
8761
  setFailed(next === void 0);
8762
+ if (next?.operation === void 0) {
8763
+ setAuthorizationIntent(void 0);
8764
+ setCancelRequested(false);
8765
+ }
8600
8766
  if (next !== void 0 && changed && next.operation === void 0) props.onChanged?.();
8601
8767
  } catch {
8602
8768
  if (current()) {
8603
8769
  setView(void 0);
8604
8770
  setFailed(true);
8771
+ setAuthorizationIntent(void 0);
8772
+ setCancelRequested(false);
8605
8773
  }
8606
8774
  } finally {
8607
8775
  if (current()) {
@@ -8618,6 +8786,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8618
8786
  setConfirmation(void 0);
8619
8787
  setBusy(false);
8620
8788
  setFailed(false);
8789
+ setCopyState("idle");
8790
+ setCancelRequested(false);
8791
+ setAuthorizationIntent(void 0);
8621
8792
  if (props.remote !== void 0 && !props.authorizationBusy) run(() => props.remote.ensureIdentity());
8622
8793
  return () => {
8623
8794
  owner.active = false;
@@ -8648,7 +8819,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8648
8819
  run
8649
8820
  ]);
8650
8821
  (0, react.useEffect)(() => {
8651
- if (view?.operation !== "authorizing" || props.remote === void 0) return;
8822
+ if (view?.operation !== "authorizing" && view?.operation !== "verifying" || props.remote === void 0) return;
8652
8823
  const timer = window.setTimeout(() => {
8653
8824
  run(() => props.remote.get(), true, false);
8654
8825
  }, 1500);
@@ -8658,10 +8829,55 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8658
8829
  props.remote,
8659
8830
  run
8660
8831
  ]);
8832
+ const activeNotice = view?.operation === "authorizing" && !cancelRequested ? view.notices.at(-1) : void 0;
8833
+ const noticeCode = activeNotice?.code;
8834
+ (0, react.useEffect)(() => {
8835
+ lifetime.current.copyGeneration++;
8836
+ setCopyState("idle");
8837
+ }, [
8838
+ noticeCode,
8839
+ view?.operation,
8840
+ cancelRequested
8841
+ ]);
8842
+ (0, react.useEffect)(() => () => {
8843
+ lifetime.current.copyGeneration++;
8844
+ }, []);
8845
+ const copyCode = () => {
8846
+ const code = noticeCode;
8847
+ const owner = lifetime.current;
8848
+ if (!owner.active || code === void 0 || copyState === "copying" || cancelRequested) return;
8849
+ const generation = ++owner.copyGeneration;
8850
+ setCopyState("copying");
8851
+ copyAuthorizationCode(code).then(() => {
8852
+ if (owner.active && owner.copyGeneration === generation) setCopyState("copied");
8853
+ }, () => {
8854
+ if (owner.active && owner.copyGeneration === generation) setCopyState("failed");
8855
+ });
8856
+ };
8857
+ const cancelAuthorization = () => {
8858
+ if (props.remote === void 0 || busy) return;
8859
+ lifetime.current.copyGeneration++;
8860
+ setCopyState("idle");
8861
+ setCancelRequested(true);
8862
+ run(() => props.remote.cancel(), true);
8863
+ };
8864
+ const startAdd = () => {
8865
+ setAuthorizationIntent("add");
8866
+ setCancelRequested(false);
8867
+ run(() => props.remote.add(), true);
8868
+ };
8869
+ const startReauthorization = (accountId, revision) => {
8870
+ setAuthorizationIntent("reauthorize");
8871
+ setCancelRequested(false);
8872
+ run(() => props.remote.reauthorize(accountId, revision), true);
8873
+ };
8661
8874
  const identity = accountIdentityLabel(view);
8662
8875
  const selected = confirmation === void 0 ? void 0 : view?.accounts.find((item) => item.id === confirmation.id);
8663
- const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ? `@${selected.identity.login}` : "this account";
8876
+ const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ? `@${selected.identity.login}` : text.savedAuthorization;
8664
8877
  const pending = busy || props.authorizationBusy === true || view?.operation !== void 0;
8878
+ const authorizationOperation = view?.operation === "authorizing" || view?.operation === "verifying";
8879
+ 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;
8880
+ const switchBlocker = view !== void 0 && view.switchable === false ? view.operation === "authorizing" ? text.authorizationBusy : view.operation === "verifying" ? text.verifyingBusy : view.operation === "switching" ? text.switchingBusy : view.diagnostic === "COPILOT_ACCOUNTS_ROUTE_BLOCKED" ? text.routeBlocked : view.diagnostic === "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE" ? text.evidenceIncomplete : view.state === "error" ? void 0 : text.switchUnavailable : void 0;
8665
8881
  const control = (label, onClick, disabled = false) => (0, react.createElement)("button", {
8666
8882
  type: "button",
8667
8883
  style: {
@@ -8673,7 +8889,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8673
8889
  }, label);
8674
8890
  return (0, react.createElement)("div", {
8675
8891
  "data-copilot-accounts": "",
8676
- "aria-busy": busy,
8892
+ "aria-busy": pending,
8677
8893
  style: {
8678
8894
  minWidth: 0,
8679
8895
  overflowWrap: "anywhere"
@@ -8683,20 +8899,79 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8683
8899
  role: "status",
8684
8900
  "aria-live": "polite",
8685
8901
  "data-copilot-current-account": ""
8686
- }, identity ?? (busy ? "Checking GitHub identity…" : "GitHub account identity unavailable")), !props.expanded ? null : (0, react.createElement)("div", { style: {
8902
+ }, identity ?? (busy ? text.identityChecking : text.identityUnavailable)), !props.expanded ? null : (0, react.createElement)("div", { style: {
8687
8903
  display: "grid",
8688
8904
  gap: 10,
8689
8905
  marginBlock: 12
8690
- } }, (0, react.createElement)("strong", null, "GitHub accounts"), (0, react.createElement)("p", { style: muted$1 }, "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."), props.remote === void 0 ? (0, react.createElement)("p", {
8906
+ } }, (0, react.createElement)("strong", null, text.accounts), (0, react.createElement)("p", { style: muted$1 }, text.scope), props.remote === void 0 ? (0, react.createElement)("p", {
8691
8907
  role: "status",
8692
8908
  style: muted$1
8693
- }, "COPILOT_ACCOUNTS_REMOTE_UNAVAILABLE · Account management is unavailable in this deployment.") : null, failed ? (0, react.createElement)("p", {
8909
+ }, text.remoteUnavailable) : null, failed ? (0, react.createElement)("p", {
8694
8910
  role: "alert",
8695
8911
  style: muted$1
8696
- }, "Could not read account information. Retry before changing accounts.") : null, view?.diagnostic === void 0 ? null : (0, react.createElement)("p", {
8912
+ }, text.readFailed) : null, view?.state === "error" && view.operation === void 0 && view.diagnostic !== void 0 ? (0, react.createElement)("p", {
8913
+ role: "alert",
8914
+ style: muted$1
8915
+ }, accountProblemMessage(view.diagnostic, text)) : null, switchBlocker === void 0 ? null : (0, react.createElement)("p", {
8697
8916
  role: "status",
8917
+ "aria-live": "polite",
8698
8918
  style: muted$1
8699
- }, view.diagnostic), view?.switchable === false ? (0, react.createElement)("p", { style: muted$1 }, "Switching is unavailable during account management or unbound preparation, while native Copilot routes remain configured, or when route evidence is incomplete. Account-pinned managed turns can continue. No running work will be cancelled.") : null, (0, react.createElement)("ul", { style: {
8919
+ }, switchBlocker), authorizationStatus === void 0 ? null : (0, react.createElement)("div", {
8920
+ role: "status",
8921
+ "aria-live": "polite",
8922
+ "data-copilot-account-authorization": "",
8923
+ style: {
8924
+ display: "grid",
8925
+ gap: 8
8926
+ }
8927
+ }, (0, react.createElement)("strong", null, authorizationStatus), authorizationOperation ? (0, react.createElement)("p", { style: muted$1 }, text.pendingDefault) : null, activeNotice?.url === void 0 ? null : (0, react.createElement)("a", {
8928
+ href: activeNotice.url,
8929
+ target: externalLinkTarget(),
8930
+ rel: "noreferrer",
8931
+ style: {
8932
+ color: "inherit",
8933
+ width: "fit-content"
8934
+ }
8935
+ }, text.verificationLink), activeNotice?.url === void 0 ? null : (0, react.createElement)("p", { style: {
8936
+ ...muted$1,
8937
+ overflowWrap: "anywhere",
8938
+ userSelect: "all"
8939
+ } }, text.manualUrl, " ", activeNotice.url), activeNotice?.code === void 0 ? null : (0, react.createElement)("div", { style: {
8940
+ display: "flex",
8941
+ flexWrap: "wrap",
8942
+ alignItems: "center",
8943
+ gap: 8
8944
+ } }, (0, react.createElement)("span", { style: {
8945
+ color: secondary$1,
8946
+ fontSize: 13
8947
+ } }, text.codeLabel), (0, react.createElement)("code", {
8948
+ "data-copilot-account-device-code": "",
8949
+ style: {
8950
+ userSelect: "all",
8951
+ overflowWrap: "anywhere",
8952
+ fontSize: 17,
8953
+ fontWeight: 700,
8954
+ letterSpacing: "0.08em"
8955
+ }
8956
+ }, activeNotice.code), control(copyState === "copying" ? text.copyingCode : copyState === "copied" ? text.copiedCodeButton : text.copyCode, copyCode, copyState === "copying" || cancelRequested)), copyState === "copied" ? (0, react.createElement)("p", {
8957
+ role: "status",
8958
+ "aria-live": "polite",
8959
+ style: muted$1
8960
+ }, text.copiedCode) : null, copyState === "failed" ? (0, react.createElement)("p", {
8961
+ role: "alert",
8962
+ "aria-live": "polite",
8963
+ style: muted$1
8964
+ }, text.copyFailed) : null, view?.operation === "authorizing" ? (0, react.createElement)("div", { style: {
8965
+ display: "flex",
8966
+ flexWrap: "wrap",
8967
+ gap: 8
8968
+ } }, control(cancelRequested ? text.cancelling : authorizationIntent === "reauthorize" ? text.cancelReauthorize : text.cancelAdd, cancelAuthorization, busy || cancelRequested)) : null), view?.diagnostic === void 0 ? null : (0, react.createElement)("details", {
8969
+ "data-copilot-account-diagnostic": "",
8970
+ style: {
8971
+ color: secondary$1,
8972
+ fontSize: 13
8973
+ }
8974
+ }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.technicalDetails), (0, react.createElement)("code", { style: { overflowWrap: "anywhere" } }, view.diagnostic)), (0, react.createElement)("ul", { style: {
8700
8975
  padding: 0,
8701
8976
  margin: 0,
8702
8977
  listStyle: "none"
@@ -8713,18 +8988,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8713
8988
  }, (0, react.createElement)("div", { style: {
8714
8989
  minWidth: 0,
8715
8990
  flex: "1 1 180px"
8716
- } }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? `@${account.identity.login}` : "Identity unavailable"), (0, react.createElement)("p", { style: muted$1 }, account.id === view?.activeAccountId ? "Active account" : account.configured ? "Saved authorization" : "Authorization unavailable")), account.id === view?.activeAccountId ? null : control("Switch", () => {
8991
+ } }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? `@${account.identity.login}` : 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.switch, () => {
8717
8992
  if (view?.revision !== void 0) setConfirmation({
8718
8993
  id: account.id,
8719
8994
  revision: view.revision,
8720
8995
  remove: false
8721
8996
  });
8722
- }, pending || view?.switchable !== true || view?.revision === void 0 || !account.configured), account.id === "canonical" ? null : control("Reauthorize", () => {
8997
+ }, pending || view?.switchable !== true || view?.revision === void 0 || !account.configured), account.id === "canonical" ? null : control(text.reauthorize, () => {
8723
8998
  if (props.remote !== void 0 && view?.revision !== void 0) {
8724
8999
  const revision = view.revision;
8725
- run(() => props.remote.reauthorize(account.id, revision), true);
9000
+ startReauthorization(account.id, revision);
8726
9001
  }
8727
- }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control("Remove", () => {
9002
+ }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
8728
9003
  if (view?.revision !== void 0) setConfirmation({
8729
9004
  id: account.id,
8730
9005
  revision: view.revision,
@@ -8732,7 +9007,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8732
9007
  });
8733
9008
  }, pending || view?.writable !== true || view?.revision === void 0)))), confirmation === void 0 ? null : (0, react.createElement)("div", {
8734
9009
  role: "group",
8735
- "aria-label": confirmation.remove ? "Confirm account removal" : "Confirm account switch",
9010
+ "aria-label": confirmation.remove ? text.confirmRemoveTitle : text.confirmSwitchTitle,
8736
9011
  style: {
8737
9012
  border: border$1,
8738
9013
  borderRadius: 8,
@@ -8742,31 +9017,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8742
9017
  ...muted$1,
8743
9018
  color: "inherit",
8744
9019
  marginTop: 0
8745
- } }, confirmation.remove ? `Remove the saved authorization for ${selectedLabel}? This does not revoke access at GitHub or delete conversations.` : `Use ${selectedLabel} for subsequent Copilot work? Existing selected models may be unavailable, and encrypted reasoning from another account may not replay. History will not be modified.`), (0, react.createElement)("div", { style: {
9020
+ } }, confirmation.remove ? text.removePrompt(selectedLabel) : text.switchPrompt(selectedLabel)), (0, react.createElement)("div", { style: {
8746
9021
  display: "flex",
8747
9022
  flexWrap: "wrap",
8748
9023
  gap: 8
8749
- } }, control(confirmation.remove ? "Confirm removal" : "Confirm switch", () => {
9024
+ } }, control(confirmation.remove ? text.confirmRemove : text.confirmSwitch, () => {
8750
9025
  const target = confirmation;
8751
9026
  setConfirmation(void 0);
8752
9027
  if (props.remote !== void 0) run(() => target.remove ? props.remote.removeAccount(target.id, target.revision) : props.remote.switchAccount(target.id, target.revision), true);
8753
- }, pending), control("Cancel", () => setConfirmation(void 0), pending))), ...(view?.notices ?? []).map((notice, index) => (0, react.createElement)("div", {
8754
- key: index,
8755
- style: muted$1
8756
- }, (0, react.createElement)("p", null, notice.message), notice.url === void 0 ? null : (0, react.createElement)("a", {
8757
- href: notice.url,
8758
- target: externalLinkTarget(),
8759
- rel: "noreferrer",
8760
- style: { color: "inherit" }
8761
- }, "Open GitHub verification"), notice.code === void 0 ? null : (0, react.createElement)("p", null, (0, react.createElement)("code", { style: { userSelect: "all" } }, notice.code)), notice.url === void 0 ? null : (0, react.createElement)("p", { style: { userSelect: "all" } }, notice.url))), (0, react.createElement)("div", { style: {
9028
+ }, pending), control(text.cancel, () => setConfirmation(void 0), pending))), (0, react.createElement)("div", { style: {
8762
9029
  display: "flex",
8763
9030
  flexWrap: "wrap",
8764
9031
  gap: 8
8765
- } }, view?.operation === "authorizing" ? control("Cancel account sign-in", () => {
8766
- if (props.remote !== void 0) run(() => props.remote.cancel(), true);
8767
- }, busy) : control("Add GitHub account", () => {
8768
- if (props.remote !== void 0) run(() => props.remote.add(), true);
8769
- }, pending || view?.writable !== true || view?.switchable !== true), control(busy ? "Checking…" : "Refresh account information", () => {
9032
+ } }, authorizationOperation ? null : control(text.add, () => {
9033
+ if (props.remote !== void 0) startAdd();
9034
+ }, pending || view?.writable !== true || view?.switchable !== true), control(busy ? text.refreshing : text.refresh, () => {
8770
9035
  if (props.remote !== void 0) run(() => props.remote.refreshIdentity());
8771
9036
  }, pending || props.remote === void 0))));
8772
9037
  }
@@ -8814,7 +9079,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8814
9079
  accountLoading: "Loading account selection…",
8815
9080
  accountMissing: "Account selection unavailable. Refresh to retry.",
8816
9081
  runningAccount: "Running turn remains on",
8817
- identityUnknown: "Identity unavailable"
9082
+ identityUnknown: "Identity unavailable",
9083
+ originalAuthorization: "Original authorization",
9084
+ savedAuthorization: "Saved authorization"
8818
9085
  },
8819
9086
  zh: {
8820
9087
  credits: "额度",
@@ -8857,7 +9124,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8857
9124
  accountLoading: "正在读取账号选择…",
8858
9125
  accountMissing: "账号选择暂不可用,请刷新重试。",
8859
9126
  runningAccount: "正在运行的 turn 仍使用",
8860
- identityUnknown: "身份暂不可用"
9127
+ identityUnknown: "身份暂不可用",
9128
+ originalAuthorization: "原始授权",
9129
+ savedAuthorization: "已保存授权"
8861
9130
  }
8862
9131
  };
8863
9132
  const secondary = "var(--dsw-alias-label-secondary, GrayText)";
@@ -9121,6 +9390,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9121
9390
  };
9122
9391
  }, [open, close]);
9123
9392
  const available = view?.state === "ready" || view?.state === "stale";
9393
+ const unknownSavedAccounts = (sessionAccount?.accounts.accounts ?? []).filter((account) => account.configured && account.id !== "canonical" && account.identity === void 0);
9394
+ const numberedUnknownAccounts = unknownSavedAccounts.length > 1 ? new Map(unknownSavedAccounts.map((account, index) => [account.id, index + 1])) : /* @__PURE__ */ new Map();
9124
9395
  const knownUnits = view?.billing === "credits" || view?.billing === "requests";
9125
9396
  const numbers = available && knownUnits;
9126
9397
  const used = numbers && amount(view.used) ? view.used : void 0;
@@ -9265,7 +9536,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9265
9536
  onClick: () => {
9266
9537
  chooseAccount(account.id);
9267
9538
  }
9268
- }, account.identity ? `@${account.identity.login}` : `${t.identityUnknown} · ${account.id === "canonical" ? "Canonical" : account.id.slice(0, 8)}`))) : null, sessionAccount?.accounts.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, sessionAccount.accounts.diagnostic), accountFailed || accountSaveFailed ? (0, react.createElement)("p", {
9539
+ }, account.identity ? `@${account.identity.login}` : account.id === "canonical" ? `${t.originalAuthorization} · ${t.identityUnknown}` : `${t.savedAuthorization}${numberedUnknownAccounts.has(account.id) ? ` ${numberedUnknownAccounts.get(account.id)}` : ""} · ${t.identityUnknown}`))) : null, sessionAccount?.accounts.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, sessionAccount.accounts.diagnostic), accountFailed || accountSaveFailed ? (0, react.createElement)("p", {
9269
9540
  role: "alert",
9270
9541
  style: muted
9271
9542
  }, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), view?.state === "stale" ? (0, react.createElement)("p", {
@@ -10123,6 +10394,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10123
10394
  * Browser companion for the Models provider-card slot.
10124
10395
  */
10125
10396
  const inject = ["remote", "slots"];
10397
+ function isLocaleReader(value) {
10398
+ return typeof value === "object" && value !== null && "getLocale" in value && typeof value.getLocale === "function" && "subscribe" in value && typeof value.subscribe === "function";
10399
+ }
10126
10400
  function messageOf(result) {
10127
10401
  return result.ok ? "" : "COPILOT_AUTHORIZATION_REQUEST_FAILED";
10128
10402
  }
@@ -10284,12 +10558,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10284
10558
  textAlign: "center",
10285
10559
  userSelect: "all"
10286
10560
  };
10287
- /** Copy a one-time authorization code through the browser clipboard boundary. */
10288
- async function copyAuthorizationCode(code, clipboard) {
10289
- const writer = clipboard ?? globalThis.navigator?.clipboard;
10290
- if (writer === void 0) throw new Error("Clipboard access is unavailable");
10291
- await writer.writeText(code);
10292
- }
10293
10561
  /** Pure presentation for the in-flight GitHub device-code handoff. */
10294
10562
  function GitHubCopilotAuthorizationNotice(props) {
10295
10563
  const feedback = props.copyState === "copying" ? "Copying code…" : props.copyState === "copied" ? "Code copied to clipboard." : props.copyState === "failed" ? "Copy failed. Select the code and copy it manually." : "";
@@ -10753,7 +11021,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10753
11021
  expanded: manageOpen,
10754
11022
  onChanged: account.retryStatus,
10755
11023
  authorizationBusy,
10756
- configured: view?.configured
11024
+ configured: view?.configured,
11025
+ locale: props.locale
10757
11026
  }), (0, react.createElement)("div", { style: {
10758
11027
  display: "flex",
10759
11028
  alignItems: "center",
@@ -10838,7 +11107,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10838
11107
  function GitHubCopilotPreviewFooter(props) {
10839
11108
  return (0, react.createElement)("div", { "data-dsh-github-copilot-preview-footer": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
10840
11109
  remote: props.remote,
10841
- accountsRemote: props.accountsRemote
11110
+ accountsRemote: props.accountsRemote,
11111
+ locale: props.locale
10842
11112
  }));
10843
11113
  }
10844
11114
  /** Only the mounted canonical row owns embedded controls. Credential presence is not row presence. */
@@ -10926,6 +11196,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10926
11196
  function GitHubCopilotAccountSurface(props) {
10927
11197
  const token = (0, react.useMemo)(() => Symbol("github-copilot-account-surface"), []);
10928
11198
  const owner = (0, react.useSyncExternalStore)(props.surfaces.subscribe, props.surfaces.getSnapshot, props.surfaces.getSnapshot);
11199
+ const subscribeLocale = (0, react.useCallback)((listener) => props.localeReader?.subscribe(listener) ?? (() => {}), [props.localeReader]);
11200
+ const getLocale = (0, react.useCallback)(() => props.localeReader?.getLocale().active ?? "en", [props.localeReader]);
11201
+ const locale = (0, react.useSyncExternalStore)(subscribeLocale, getLocale, () => "en");
10929
11202
  (0, react.useLayoutEffect)(() => props.eligible === false ? void 0 : props.surfaces.mount(props.seat, token, props.remote), [
10930
11203
  props.surfaces,
10931
11204
  props.seat,
@@ -10939,17 +11212,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10939
11212
  remote: props.remote,
10940
11213
  accountsRemote: props.accountsRemote,
10941
11214
  account: owner.account,
10942
- embedded
11215
+ embedded,
11216
+ locale
10943
11217
  }));
10944
11218
  }
10945
11219
  /** Unified fallback when the Models footer extension is absent or incompatible. */
10946
11220
  function GitHubCopilotSettingsSection(props) {
10947
- return (0, react.createElement)("section", { "data-dsh-github-copilot-settings": true }, (0, react.createElement)(GitHubCopilotCompactAccount, { remote: props.remote }));
11221
+ return (0, react.createElement)("section", { "data-dsh-github-copilot-settings": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
11222
+ remote: props.remote,
11223
+ locale: props.locale
11224
+ }));
10948
11225
  }
10949
11226
  function registerUi(ctx) {
10950
11227
  const surfaces = createAccountSurfaces();
10951
11228
  const remote = ctx.remote.githubCopilot;
10952
11229
  const accountsRemote = ctx.remote.githubCopilotAccounts;
11230
+ const localeCandidate = ctx.get("locale");
11231
+ const localeReader = isLocaleReader(localeCandidate) ? localeCandidate : void 0;
10953
11232
  const disposeCredentials = ctx.remote.$on("credentials/reference-updated", () => surfaces.invalidate());
10954
11233
  const disposeReset = ctx.on("connection/reset", () => surfaces.invalidate());
10955
11234
  let active = true;
@@ -10972,7 +11251,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10972
11251
  surfaces,
10973
11252
  seat,
10974
11253
  remote,
10975
- accountsRemote
11254
+ accountsRemote,
11255
+ localeReader
10976
11256
  }));
10977
11257
  disposeFallback = () => {
10978
11258
  surfaces.revoke(seat);
@@ -11006,7 +11286,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11006
11286
  seat,
11007
11287
  remote,
11008
11288
  accountsRemote,
11009
- eligible: isGitHubCopilotAccountRow(props)
11289
+ eligible: isGitHubCopilotAccountRow(props),
11290
+ localeReader
11010
11291
  });
11011
11292
  });
11012
11293
  return () => {
@@ -11037,7 +11318,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11037
11318
  surfaces,
11038
11319
  seat,
11039
11320
  remote,
11040
- accountsRemote
11321
+ accountsRemote,
11322
+ localeReader
11041
11323
  }));
11042
11324
  } catch {
11043
11325
  reportFooterUnavailable();