dsh-github-copilot 0.4.0-alpha.106 → 0.4.0-alpha.108
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/AGENTS.md +6 -0
- package/CHANGELOG.md +12 -0
- package/README.md +13 -9
- package/README.zh.md +13 -9
- package/deployment-baseline.json +5 -1
- package/docs/copilot-accounts.md +17 -1
- package/docs/model-compatibility-acceptance.md +19 -4
- package/lib/client.js +394 -71
- package/lib/client.js.map +1 -1
- package/lib/index.js +11 -3
- package/lib/remote.js +5 -1
- package/lib/types/authorization-code-clipboard.d.ts +4 -0
- package/lib/types/client.d.ts +11 -3
- package/lib/types/composer-notice-style.d.ts +5 -0
- package/lib/types/copilot-accounts-card.d.ts +1 -0
- package/lib/types/copilot-accounts-remote.d.ts +1 -0
- package/lib/types/copilot-accounts-types.d.ts +1 -1
- package/lib/types/responses-replay-compat.d.ts +1 -0
- package/lib/types/session-accounts-remote.d.ts +1 -0
- package/package.json +1 -1
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([
|
|
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" ?
|
|
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
|
|
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}` :
|
|
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":
|
|
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 ?
|
|
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,
|
|
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
|
-
},
|
|
8909
|
+
}, text.remoteUnavailable) : null, failed ? (0, react.createElement)("p", {
|
|
8694
8910
|
role: "alert",
|
|
8695
8911
|
style: muted$1
|
|
8696
|
-
},
|
|
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
|
-
},
|
|
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}` :
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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 ?
|
|
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 ?
|
|
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 ?
|
|
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(
|
|
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
|
-
} },
|
|
8766
|
-
if (props.remote !== void 0)
|
|
8767
|
-
},
|
|
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.
|
|
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", {
|
|
@@ -9556,8 +9827,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9556
9827
|
reasoningTokens: count.optional()
|
|
9557
9828
|
});
|
|
9558
9829
|
//#endregion
|
|
9830
|
+
//#region lib/types/composer-notice-style.js
|
|
9831
|
+
const composerNoticeStyle = {
|
|
9832
|
+
width: "100%",
|
|
9833
|
+
minWidth: 0,
|
|
9834
|
+
maxWidth: "100%",
|
|
9835
|
+
boxSizing: "border-box",
|
|
9836
|
+
fontFamily: "var(--dsw-font-family, inherit)",
|
|
9837
|
+
fontSize: "var(--dsh-content-font-size-secondary, 13px)",
|
|
9838
|
+
fontWeight: 400,
|
|
9839
|
+
lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
|
|
9840
|
+
color: "var(--dsw-alias-label-secondary, GrayText)",
|
|
9841
|
+
overflowWrap: "anywhere"
|
|
9842
|
+
};
|
|
9843
|
+
const composerNoticeParagraphStyle = {
|
|
9844
|
+
marginBlock: 8,
|
|
9845
|
+
maxWidth: "38rem"
|
|
9846
|
+
};
|
|
9847
|
+
const composerNoticeButtonStyle = {
|
|
9848
|
+
fontFamily: "inherit",
|
|
9849
|
+
fontSize: "inherit",
|
|
9850
|
+
fontWeight: "inherit",
|
|
9851
|
+
lineHeight: "inherit",
|
|
9852
|
+
color: "var(--dsw-alias-label-primary, CanvasText)",
|
|
9853
|
+
maxWidth: "100%",
|
|
9854
|
+
background: "transparent",
|
|
9855
|
+
border: "1px solid var(--dsw-alias-border-main, GrayText)",
|
|
9856
|
+
borderRadius: 6,
|
|
9857
|
+
padding: "6px 10px",
|
|
9858
|
+
cursor: "pointer"
|
|
9859
|
+
};
|
|
9860
|
+
//#endregion
|
|
9559
9861
|
//#region lib/types/context-evidence-ui.js
|
|
9560
|
-
const slot = "conversation.
|
|
9862
|
+
const slot = "conversation.input.dock";
|
|
9561
9863
|
const noop$1 = () => {};
|
|
9562
9864
|
function record$1(value) {
|
|
9563
9865
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -9595,18 +9897,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9595
9897
|
if (evidence !== void 0 && !evidence.invalid) return null;
|
|
9596
9898
|
const text = locale.startsWith("zh") ? copy.zh : copy.en;
|
|
9597
9899
|
const sample = applicable ? evidence?.sample : null;
|
|
9598
|
-
return (0, react.createElement)("details", {
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
} }, (0, react.createElement)("summary", { style: {
|
|
9900
|
+
return (0, react.createElement)("details", {
|
|
9901
|
+
"data-copilot-composer-notice": "context",
|
|
9902
|
+
style: composerNoticeStyle
|
|
9903
|
+
}, (0, react.createElement)("summary", { style: {
|
|
9603
9904
|
cursor: "pointer",
|
|
9604
9905
|
fontFamily: "var(--dsw-font-family, inherit)",
|
|
9605
9906
|
fontSize: "var(--dsh-content-font-size-secondary, 13px)",
|
|
9606
9907
|
fontWeight: 400,
|
|
9607
9908
|
lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
|
|
9608
9909
|
color: "var(--dsw-alias-label-tertiary, GrayText)"
|
|
9609
|
-
} }, text.title), (0, react.createElement)("p", { style:
|
|
9910
|
+
} }, text.title), (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, evidence === void 0 ? text.missing : evidence.reason === "unknown" ? text.unknown : text.explanation), sample ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, `${text.sample}: ${new Intl.NumberFormat(locale.startsWith("zh") ? "zh-CN" : "en-US").format(sample.tokens)} tokens`) : null, evidence === void 0 ? null : (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, sample ? text.historical : text.revoked));
|
|
9610
9911
|
}
|
|
9611
9912
|
function Surface$1({ runtime, locale, diagnostic }) {
|
|
9612
9913
|
const valid = runtime.useSession((value) => record$1(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
|
|
@@ -9749,32 +10050,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9749
10050
|
const timer = setTimeout(() => void perform(), Math.max(0, expiresAt - Date.now()));
|
|
9750
10051
|
return () => clearTimeout(timer);
|
|
9751
10052
|
}, [expiresAt, perform]);
|
|
9752
|
-
const button =
|
|
9753
|
-
font: "inherit",
|
|
9754
|
-
color: "inherit",
|
|
9755
|
-
background: "transparent",
|
|
9756
|
-
border: "1px solid var(--dsw-alias-border-main, GrayText)",
|
|
9757
|
-
borderRadius: 6,
|
|
9758
|
-
padding: "6px 10px"
|
|
9759
|
-
};
|
|
10053
|
+
const button = composerNoticeButtonStyle;
|
|
9760
10054
|
const disabled = busy || running;
|
|
9761
10055
|
const evidence = view && view.state !== "unavailable" ? view : void 0;
|
|
9762
10056
|
if (!error && !evidence && !hadEvidence) return null;
|
|
9763
10057
|
if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
|
|
9764
10058
|
type: "button",
|
|
9765
|
-
style:
|
|
10059
|
+
style: {
|
|
10060
|
+
...button,
|
|
10061
|
+
...composerNoticeStyle,
|
|
10062
|
+
width: "auto",
|
|
10063
|
+
alignSelf: "flex-start",
|
|
10064
|
+
color: button.color
|
|
10065
|
+
},
|
|
9766
10066
|
disabled,
|
|
9767
10067
|
onClick: () => setDismissed(void 0)
|
|
9768
10068
|
}, zh ? "回放恢复 · 查看" : "Replay recovery · Review");
|
|
9769
10069
|
return (0, react.createElement)("section", {
|
|
9770
10070
|
"aria-label": zh ? "回放恢复" : "Replay recovery",
|
|
10071
|
+
"data-copilot-composer-notice": "replay",
|
|
9771
10072
|
"aria-busy": busy,
|
|
9772
10073
|
style: {
|
|
9773
|
-
|
|
9774
|
-
overflowWrap: "anywhere",
|
|
10074
|
+
...composerNoticeStyle,
|
|
9775
10075
|
paddingBlock: 8
|
|
9776
10076
|
}
|
|
9777
|
-
}, (0, react.createElement)("strong", {
|
|
10077
|
+
}, (0, react.createElement)("strong", {
|
|
10078
|
+
role: "status",
|
|
10079
|
+
style: {
|
|
10080
|
+
color: "var(--dsw-alias-label-primary, CanvasText)",
|
|
10081
|
+
fontWeight: 600
|
|
10082
|
+
}
|
|
10083
|
+
}, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
|
|
10084
|
+
role: "alert",
|
|
10085
|
+
style: composerNoticeParagraphStyle
|
|
10086
|
+
}, 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, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? `${evidence.model}:${evidence.itemCount} 条已识别的旧加密推理项。` : `${evidence.model}: ${evidence.itemCount} identified old encrypted reasoning items.`), 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 ? "恢复未启用。确认损失后才能跳过这些旧项;不会自动重试。" : "Recovery is off. Review the loss before skipping these old items; 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", {
|
|
9778
10087
|
disabled,
|
|
9779
10088
|
style: {
|
|
9780
10089
|
border: 0,
|
|
@@ -9793,7 +10102,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9793
10102
|
value,
|
|
9794
10103
|
checked: duration === value,
|
|
9795
10104
|
onChange: () => setDuration(value)
|
|
9796
|
-
}), " ", value === "next-turn" ? zh ? "仅下一轮使用恢复" : "Next matching turn only" : zh ? "在本会话内继续使用" : "Continue in this session"))), (0, react.createElement)("p",
|
|
10105
|
+
}), " ", 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: {
|
|
9797
10106
|
display: "flex",
|
|
9798
10107
|
flexWrap: "wrap",
|
|
9799
10108
|
gap: 8
|
|
@@ -9821,7 +10130,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9821
10130
|
style: button,
|
|
9822
10131
|
disabled,
|
|
9823
10132
|
onClick: () => setDismissed(evidence.revision)
|
|
9824
|
-
}, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", {
|
|
10133
|
+
}, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", {
|
|
10134
|
+
role: "status",
|
|
10135
|
+
style: composerNoticeParagraphStyle
|
|
10136
|
+
}, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("button", {
|
|
9825
10137
|
type: "button",
|
|
9826
10138
|
style: {
|
|
9827
10139
|
...button,
|
|
@@ -9866,7 +10178,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9866
10178
|
const remote = ctx.remote.githubCopilotReplayRecovery;
|
|
9867
10179
|
const language = ctx.get("locale");
|
|
9868
10180
|
const locale = isLocale(language) ? language : void 0;
|
|
9869
|
-
const name = "conversation.
|
|
10181
|
+
const name = "conversation.input.dock";
|
|
9870
10182
|
return slots.inject(name, () => {
|
|
9871
10183
|
const spec = slots.spec(name);
|
|
9872
10184
|
if (spec?.kind !== "list" || spec.scope !== "session") {
|
|
@@ -10123,6 +10435,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10123
10435
|
* Browser companion for the Models provider-card slot.
|
|
10124
10436
|
*/
|
|
10125
10437
|
const inject = ["remote", "slots"];
|
|
10438
|
+
function isLocaleReader(value) {
|
|
10439
|
+
return typeof value === "object" && value !== null && "getLocale" in value && typeof value.getLocale === "function" && "subscribe" in value && typeof value.subscribe === "function";
|
|
10440
|
+
}
|
|
10126
10441
|
function messageOf(result) {
|
|
10127
10442
|
return result.ok ? "" : "COPILOT_AUTHORIZATION_REQUEST_FAILED";
|
|
10128
10443
|
}
|
|
@@ -10284,12 +10599,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10284
10599
|
textAlign: "center",
|
|
10285
10600
|
userSelect: "all"
|
|
10286
10601
|
};
|
|
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
10602
|
/** Pure presentation for the in-flight GitHub device-code handoff. */
|
|
10294
10603
|
function GitHubCopilotAuthorizationNotice(props) {
|
|
10295
10604
|
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 +11062,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10753
11062
|
expanded: manageOpen,
|
|
10754
11063
|
onChanged: account.retryStatus,
|
|
10755
11064
|
authorizationBusy,
|
|
10756
|
-
configured: view?.configured
|
|
11065
|
+
configured: view?.configured,
|
|
11066
|
+
locale: props.locale
|
|
10757
11067
|
}), (0, react.createElement)("div", { style: {
|
|
10758
11068
|
display: "flex",
|
|
10759
11069
|
alignItems: "center",
|
|
@@ -10838,7 +11148,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10838
11148
|
function GitHubCopilotPreviewFooter(props) {
|
|
10839
11149
|
return (0, react.createElement)("div", { "data-dsh-github-copilot-preview-footer": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
|
|
10840
11150
|
remote: props.remote,
|
|
10841
|
-
accountsRemote: props.accountsRemote
|
|
11151
|
+
accountsRemote: props.accountsRemote,
|
|
11152
|
+
locale: props.locale
|
|
10842
11153
|
}));
|
|
10843
11154
|
}
|
|
10844
11155
|
/** Only the mounted canonical row owns embedded controls. Credential presence is not row presence. */
|
|
@@ -10926,6 +11237,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10926
11237
|
function GitHubCopilotAccountSurface(props) {
|
|
10927
11238
|
const token = (0, react.useMemo)(() => Symbol("github-copilot-account-surface"), []);
|
|
10928
11239
|
const owner = (0, react.useSyncExternalStore)(props.surfaces.subscribe, props.surfaces.getSnapshot, props.surfaces.getSnapshot);
|
|
11240
|
+
const subscribeLocale = (0, react.useCallback)((listener) => props.localeReader?.subscribe(listener) ?? (() => {}), [props.localeReader]);
|
|
11241
|
+
const getLocale = (0, react.useCallback)(() => props.localeReader?.getLocale().active ?? "en", [props.localeReader]);
|
|
11242
|
+
const locale = (0, react.useSyncExternalStore)(subscribeLocale, getLocale, () => "en");
|
|
10929
11243
|
(0, react.useLayoutEffect)(() => props.eligible === false ? void 0 : props.surfaces.mount(props.seat, token, props.remote), [
|
|
10930
11244
|
props.surfaces,
|
|
10931
11245
|
props.seat,
|
|
@@ -10939,17 +11253,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10939
11253
|
remote: props.remote,
|
|
10940
11254
|
accountsRemote: props.accountsRemote,
|
|
10941
11255
|
account: owner.account,
|
|
10942
|
-
embedded
|
|
11256
|
+
embedded,
|
|
11257
|
+
locale
|
|
10943
11258
|
}));
|
|
10944
11259
|
}
|
|
10945
11260
|
/** Unified fallback when the Models footer extension is absent or incompatible. */
|
|
10946
11261
|
function GitHubCopilotSettingsSection(props) {
|
|
10947
|
-
return (0, react.createElement)("section", { "data-dsh-github-copilot-settings": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
|
|
11262
|
+
return (0, react.createElement)("section", { "data-dsh-github-copilot-settings": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
|
|
11263
|
+
remote: props.remote,
|
|
11264
|
+
locale: props.locale
|
|
11265
|
+
}));
|
|
10948
11266
|
}
|
|
10949
11267
|
function registerUi(ctx) {
|
|
10950
11268
|
const surfaces = createAccountSurfaces();
|
|
10951
11269
|
const remote = ctx.remote.githubCopilot;
|
|
10952
11270
|
const accountsRemote = ctx.remote.githubCopilotAccounts;
|
|
11271
|
+
const localeCandidate = ctx.get("locale");
|
|
11272
|
+
const localeReader = isLocaleReader(localeCandidate) ? localeCandidate : void 0;
|
|
10953
11273
|
const disposeCredentials = ctx.remote.$on("credentials/reference-updated", () => surfaces.invalidate());
|
|
10954
11274
|
const disposeReset = ctx.on("connection/reset", () => surfaces.invalidate());
|
|
10955
11275
|
let active = true;
|
|
@@ -10972,7 +11292,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10972
11292
|
surfaces,
|
|
10973
11293
|
seat,
|
|
10974
11294
|
remote,
|
|
10975
|
-
accountsRemote
|
|
11295
|
+
accountsRemote,
|
|
11296
|
+
localeReader
|
|
10976
11297
|
}));
|
|
10977
11298
|
disposeFallback = () => {
|
|
10978
11299
|
surfaces.revoke(seat);
|
|
@@ -11006,7 +11327,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11006
11327
|
seat,
|
|
11007
11328
|
remote,
|
|
11008
11329
|
accountsRemote,
|
|
11009
|
-
eligible: isGitHubCopilotAccountRow(props)
|
|
11330
|
+
eligible: isGitHubCopilotAccountRow(props),
|
|
11331
|
+
localeReader
|
|
11010
11332
|
});
|
|
11011
11333
|
});
|
|
11012
11334
|
return () => {
|
|
@@ -11037,7 +11359,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11037
11359
|
surfaces,
|
|
11038
11360
|
seat,
|
|
11039
11361
|
remote,
|
|
11040
|
-
accountsRemote
|
|
11362
|
+
accountsRemote,
|
|
11363
|
+
localeReader
|
|
11041
11364
|
}));
|
|
11042
11365
|
} catch {
|
|
11043
11366
|
reportFooterUnavailable();
|