dsh-github-copilot 0.4.0-alpha.102 → 0.4.0-alpha.104
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 +3 -1
- package/CHANGELOG.md +12 -0
- package/README.md +23 -11
- package/README.zh.md +21 -10
- package/deployment-baseline.json +22 -1
- package/docs/copilot-accounts.md +53 -23
- package/docs/copilot-usage.md +5 -3
- package/lib/client.js +322 -30
- package/lib/client.js.map +1 -1
- package/lib/index.js +912 -224
- package/lib/remote.js +67 -10
- package/lib/routed-web.js +1 -1
- package/lib/{search-routing-CqysPLve.js → search-routing-CHyF6TbO.js} +1 -1
- package/lib/types/config.d.ts +7 -2
- package/lib/types/copilot-accounts-host.d.ts +10 -2
- package/lib/types/copilot-usage-card.d.ts +17 -0
- package/lib/types/copilot-usage-host.d.ts +3 -0
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/replay-recovery-host.d.ts +2 -2
- package/lib/types/session-accounts-controller.d.ts +18 -0
- package/lib/types/session-accounts-host.d.ts +32 -0
- package/lib/types/session-accounts-remote.d.ts +106 -0
- package/lib/types/session-accounts.d.ts +36 -0
- package/lib/types/turn-selection-card.d.ts +5 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -5491,7 +5491,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5491
5491
|
expectedRevision: revision$1
|
|
5492
5492
|
}).strict();
|
|
5493
5493
|
const DualModelCreateResultSchema = object({ sessionId: id }).strict();
|
|
5494
|
-
const contribution$
|
|
5494
|
+
const contribution$7 = {
|
|
5495
5495
|
package: "dsh-github-copilot",
|
|
5496
5496
|
descriptors: [
|
|
5497
5497
|
{
|
|
@@ -5539,7 +5539,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5539
5539
|
supported: boolean(),
|
|
5540
5540
|
providers: array(object({ id: string().min(1).max(512) }).strict()).max(512)
|
|
5541
5541
|
}).strict();
|
|
5542
|
-
const contribution$
|
|
5542
|
+
const contribution$6 = {
|
|
5543
5543
|
package: "dsh-github-copilot",
|
|
5544
5544
|
descriptors: [{
|
|
5545
5545
|
id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
|
|
@@ -5661,7 +5661,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5661
5661
|
if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
|
|
5662
5662
|
}
|
|
5663
5663
|
});
|
|
5664
|
-
const contribution$
|
|
5664
|
+
const contribution$5 = {
|
|
5665
5665
|
package: "dsh-github-copilot",
|
|
5666
5666
|
descriptors: ["get", "refresh"].map((method) => ({
|
|
5667
5667
|
id: `dsh-github-copilot:githubCopilotUsage.${method}`,
|
|
@@ -5785,7 +5785,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5785
5785
|
]);
|
|
5786
5786
|
//#endregion
|
|
5787
5787
|
//#region lib/types/turn-selection-remote.js
|
|
5788
|
-
const contribution$
|
|
5788
|
+
const contribution$4 = {
|
|
5789
5789
|
package: "dsh-github-copilot",
|
|
5790
5790
|
descriptors: [{
|
|
5791
5791
|
id: "dsh-github-copilot:githubCopilotTurnSelection.get",
|
|
@@ -5821,14 +5821,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5821
5821
|
}).strict()]);
|
|
5822
5822
|
//#endregion
|
|
5823
5823
|
//#region lib/types/replay-recovery-remote.js
|
|
5824
|
-
const agent = {
|
|
5824
|
+
const agent$1 = {
|
|
5825
5825
|
name: "agent",
|
|
5826
5826
|
wire: "agentId",
|
|
5827
5827
|
source: "lookup",
|
|
5828
5828
|
lookup: "agent",
|
|
5829
5829
|
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
|
|
5830
5830
|
};
|
|
5831
|
-
const contribution$
|
|
5831
|
+
const contribution$3 = {
|
|
5832
5832
|
package: "dsh-github-copilot",
|
|
5833
5833
|
descriptors: [
|
|
5834
5834
|
{
|
|
@@ -5837,7 +5837,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5837
5837
|
service: "githubCopilotReplayRecovery",
|
|
5838
5838
|
method: "get",
|
|
5839
5839
|
invocation: { kind: "direct" },
|
|
5840
|
-
parameters: [agent],
|
|
5840
|
+
parameters: [agent$1],
|
|
5841
5841
|
result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
|
|
5842
5842
|
},
|
|
5843
5843
|
{
|
|
@@ -5847,7 +5847,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5847
5847
|
method: "authorize",
|
|
5848
5848
|
invocation: { kind: "direct" },
|
|
5849
5849
|
parameters: [
|
|
5850
|
-
agent,
|
|
5850
|
+
agent$1,
|
|
5851
5851
|
{
|
|
5852
5852
|
name: "revision",
|
|
5853
5853
|
wire: "revision",
|
|
@@ -5870,7 +5870,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5870
5870
|
method: "setEnabled",
|
|
5871
5871
|
invocation: { kind: "direct" },
|
|
5872
5872
|
parameters: [
|
|
5873
|
-
agent,
|
|
5873
|
+
agent$1,
|
|
5874
5874
|
{
|
|
5875
5875
|
name: "revision",
|
|
5876
5876
|
wire: "revision",
|
|
@@ -5932,7 +5932,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5932
5932
|
if (row.identity !== void 0 && !row.configured) invalid();
|
|
5933
5933
|
}
|
|
5934
5934
|
});
|
|
5935
|
-
const contribution$
|
|
5935
|
+
const contribution$2 = {
|
|
5936
5936
|
package: "dsh-github-copilot",
|
|
5937
5937
|
descriptors: [
|
|
5938
5938
|
"get",
|
|
@@ -5963,6 +5963,62 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5963
5963
|
}))
|
|
5964
5964
|
};
|
|
5965
5965
|
//#endregion
|
|
5966
|
+
//#region lib/types/session-accounts-remote.js
|
|
5967
|
+
const SessionAccountViewSchema = object({
|
|
5968
|
+
source: _enum(["global", "session"]),
|
|
5969
|
+
accountId: CopilotAccountIdSchema,
|
|
5970
|
+
globalAccountId: CopilotAccountIdSchema,
|
|
5971
|
+
runningAccountId: CopilotAccountIdSchema.optional(),
|
|
5972
|
+
accounts: CopilotAccountsViewSchema
|
|
5973
|
+
}).strict().refine((view) => view.accountId === view.accounts.activeAccountId, { message: "Session account identity mismatch" });
|
|
5974
|
+
const TurnAccountViewSchema = discriminatedUnion("state", [object({ state: literal("unknown") }).strict(), object({
|
|
5975
|
+
state: literal("recorded"),
|
|
5976
|
+
accountId: CopilotAccountIdSchema,
|
|
5977
|
+
source: _enum(["global", "session"]),
|
|
5978
|
+
identity: CopilotAccountsViewSchema.shape.accounts.element.shape.identity
|
|
5979
|
+
}).strict()]);
|
|
5980
|
+
const agent = {
|
|
5981
|
+
name: "agent",
|
|
5982
|
+
wire: "agentId",
|
|
5983
|
+
source: "lookup",
|
|
5984
|
+
lookup: "agent",
|
|
5985
|
+
codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
|
|
5986
|
+
};
|
|
5987
|
+
const contribution$1 = {
|
|
5988
|
+
package: "dsh-github-copilot",
|
|
5989
|
+
descriptors: [
|
|
5990
|
+
"get",
|
|
5991
|
+
"set",
|
|
5992
|
+
"refreshIdentity",
|
|
5993
|
+
"usage",
|
|
5994
|
+
"refreshUsage",
|
|
5995
|
+
"turn"
|
|
5996
|
+
].map((method) => ({
|
|
5997
|
+
id: `dsh-github-copilot:githubCopilotSessionAccount.${method}`,
|
|
5998
|
+
namespace: "githubCopilotSessionAccount",
|
|
5999
|
+
service: "githubCopilotSessionAccount",
|
|
6000
|
+
method,
|
|
6001
|
+
invocation: { kind: "direct" },
|
|
6002
|
+
parameters: [agent, ...method === "set" ? [{
|
|
6003
|
+
name: "accountId",
|
|
6004
|
+
wire: "accountId",
|
|
6005
|
+
source: "json",
|
|
6006
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountChoice", CopilotAccountIdSchema.nullable())
|
|
6007
|
+
}, {
|
|
6008
|
+
name: "revision",
|
|
6009
|
+
wire: "revision",
|
|
6010
|
+
source: "json",
|
|
6011
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountRevision", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
6012
|
+
}] : method === "turn" ? [{
|
|
6013
|
+
name: "turn",
|
|
6014
|
+
wire: "turn",
|
|
6015
|
+
source: "json",
|
|
6016
|
+
codec: strictRemoteCodec("dsh-github-copilot#SessionAccountTurn", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
|
|
6017
|
+
}] : []],
|
|
6018
|
+
result: method === "usage" || method === "refreshUsage" ? strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema) : method === "turn" ? strictRemoteCodec("dsh-github-copilot#TurnAccountView", TurnAccountViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionAccountView", SessionAccountViewSchema)
|
|
6019
|
+
}))
|
|
6020
|
+
};
|
|
6021
|
+
//#endregion
|
|
5966
6022
|
//#region lib/types/remote.js
|
|
5967
6023
|
/**
|
|
5968
6024
|
* Client-safe Remote contribution for the plugin-owned authorization bridge.
|
|
@@ -6171,6 +6227,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6171
6227
|
parameters: [],
|
|
6172
6228
|
result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
|
|
6173
6229
|
},
|
|
6230
|
+
...contribution$7.descriptors,
|
|
6174
6231
|
...contribution$6.descriptors,
|
|
6175
6232
|
...contribution$5.descriptors,
|
|
6176
6233
|
...contribution$4.descriptors,
|
|
@@ -6592,10 +6649,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6592
6649
|
}
|
|
6593
6650
|
//#endregion
|
|
6594
6651
|
//#region lib/types/turn-selection-card.js
|
|
6595
|
-
function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry }) {
|
|
6652
|
+
function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry, account, accountFailed = false, retryAccount }) {
|
|
6596
6653
|
const zh = locale.startsWith("zh");
|
|
6597
6654
|
const id = (0, react.useId)();
|
|
6598
6655
|
const [open, setOpen] = (0, react.useState)(false);
|
|
6656
|
+
const [accountOpen, setAccountOpen] = (0, react.useState)(false);
|
|
6599
6657
|
const [position, setPosition] = (0, react.useState)({
|
|
6600
6658
|
left: 12,
|
|
6601
6659
|
top: 12
|
|
@@ -6621,7 +6679,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6621
6679
|
window.removeEventListener("resize", place);
|
|
6622
6680
|
window.removeEventListener("scroll", place, true);
|
|
6623
6681
|
};
|
|
6624
|
-
}, [open]);
|
|
6682
|
+
}, [open, accountOpen]);
|
|
6625
6683
|
(0, react.useEffect)(() => {
|
|
6626
6684
|
if (!open) return;
|
|
6627
6685
|
const outside = (event) => {
|
|
@@ -6663,7 +6721,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6663
6721
|
maxWidth: "100%",
|
|
6664
6722
|
fontSize: "var(--dsh-content-font-size-secondary, 13px)",
|
|
6665
6723
|
color: "var(--dsw-alias-label-tertiary, GrayText)"
|
|
6666
|
-
} }, (0, react.createElement)("
|
|
6724
|
+
} }, account === void 0 && !accountFailed ? null : (0, react.createElement)("button", {
|
|
6725
|
+
ref: accountOpen ? trigger : void 0,
|
|
6726
|
+
type: "button",
|
|
6727
|
+
style: {
|
|
6728
|
+
...button,
|
|
6729
|
+
border: 0,
|
|
6730
|
+
padding: "1px 5px"
|
|
6731
|
+
},
|
|
6732
|
+
"aria-haspopup": "dialog",
|
|
6733
|
+
"aria-expanded": open && accountOpen,
|
|
6734
|
+
onClick: () => {
|
|
6735
|
+
setAccountOpen(true);
|
|
6736
|
+
setOpen(true);
|
|
6737
|
+
}
|
|
6738
|
+
}, 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", {
|
|
6667
6739
|
role: readState === "ready" ? void 0 : "status",
|
|
6668
6740
|
title: readState === "ready" && selection.mode === "unknown" ? zh ? "本轮选择记录未保留;不从当前选择推断历史。" : "No retained selection evidence; the current picker is not historical evidence." : void 0
|
|
6669
6741
|
}, readState === "loading" ? zh ? "正在读取选择记录…" : "Loading selection…" : readState === "failed" ? zh ? "选择记录读取失败" : "Selection unavailable" : label), readState === "failed" && retry ? (0, react.createElement)("button", {
|
|
@@ -6671,7 +6743,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6671
6743
|
style: button,
|
|
6672
6744
|
onClick: retry
|
|
6673
6745
|
}, zh ? "重试" : "Retry") : null, readState === "ready" && (selection.mode === "auto" || incomplete) ? (0, react.createElement)("button", {
|
|
6674
|
-
ref: trigger,
|
|
6746
|
+
ref: accountOpen ? void 0 : trigger,
|
|
6675
6747
|
type: "button",
|
|
6676
6748
|
style: {
|
|
6677
6749
|
...button,
|
|
@@ -6683,13 +6755,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6683
6755
|
"aria-expanded": open,
|
|
6684
6756
|
"aria-controls": open ? id : void 0,
|
|
6685
6757
|
"aria-haspopup": "dialog",
|
|
6686
|
-
onClick: () =>
|
|
6758
|
+
onClick: () => {
|
|
6759
|
+
setAccountOpen(false);
|
|
6760
|
+
setOpen((value) => !value);
|
|
6761
|
+
}
|
|
6687
6762
|
}, "ⓘ") : null, open ? (0, react.createElement)("div", {
|
|
6688
6763
|
ref: panel,
|
|
6689
6764
|
id,
|
|
6690
6765
|
popover: "manual",
|
|
6691
6766
|
role: "dialog",
|
|
6692
|
-
"aria-label": zh ? "本轮选择记录" : "Turn selection evidence",
|
|
6767
|
+
"aria-label": accountOpen ? zh ? "本轮账号" : "Turn account" : zh ? "本轮选择记录" : "Turn selection evidence",
|
|
6693
6768
|
style: {
|
|
6694
6769
|
position: "fixed",
|
|
6695
6770
|
inset: "auto",
|
|
@@ -6709,7 +6784,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6709
6784
|
color: "var(--dsw-alias-label-primary, CanvasText)",
|
|
6710
6785
|
lineHeight: 1.6
|
|
6711
6786
|
}
|
|
6712
|
-
}, (0, react.createElement)("strong", null, zh ? "
|
|
6787
|
+
}, (0, react.createElement)("strong", null, accountOpen ? zh ? "本轮账号" : "Turn account" : zh ? "为什么本轮选择这个模型" : "Why this model was selected"), 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", {
|
|
6788
|
+
type: "button",
|
|
6789
|
+
style: button,
|
|
6790
|
+
onClick: retryAccount
|
|
6791
|
+
}, zh ? "重试" : "Retry") : null) : selection.mode === "auto" ? explanation === void 0 ? (0, react.createElement)("p", null, zh ? "本轮未保留详细选模原因;不使用当前设置反推历史。" : "Detailed selection reasons were not retained for this turn; today’s settings cannot reconstruct them.") : (0, react.createElement)("div", null, (0, react.createElement)("p", null, explanation.conclusion), (0, react.createElement)("p", null, explanation.choice), (0, react.createElement)("details", null, (0, react.createElement)("summary", null, zh ? "查看判断依据" : "Assessment details"), (0, react.createElement)("p", null, explanation.assessment), (0, react.createElement)("p", null, zh ? `${selection.candidateCount} 个合格候选;${selection.fittingCandidateCount ?? "未知"} 个可容纳估算输入。` : `${selection.candidateCount} eligible candidates; ${selection.fittingCandidateCount ?? "unknown"} fit the estimated input.`), explanation.diagnostic ? (0, react.createElement)("p", null, explanation.diagnostic) : null, explanation.semantic ? (0, react.createElement)("p", null, explanation.semantic) : null, (0, react.createElement)("p", null, zh ? "分类来自供应方;不保证实际速度、费用或任务质量。" : "Supplier categories do not guarantee actual speed, cost or task quality."))) : null, !accountOpen && incomplete ? (0, react.createElement)("p", null, zh ? "模型归属不完整:部分尝试或历史未记录模型。原生 Usage 保持不变。" : "Model attribution is incomplete: some attempts or history have no recorded model. Native Usage is unchanged.") : null, accountOpen ? null : (0, react.createElement)("p", null, zh ? "此记录说明选择方式,不证明执行;实际模型以原生 Usage 为准。" : "Selection evidence is not execution proof; see native Usage for recorded models."), (0, react.createElement)("button", {
|
|
6713
6792
|
ref: close,
|
|
6714
6793
|
type: "button",
|
|
6715
6794
|
style: button,
|
|
@@ -7128,6 +7207,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7128
7207
|
const [readAttempt, setReadAttempt] = react.useState(0);
|
|
7129
7208
|
const turn = record$4(props.turn) && sequence(props.turn.turn) ? props.turn.turn : void 0;
|
|
7130
7209
|
const sessionId = typeof props.sessionId === "string" ? props.sessionId : void 0;
|
|
7210
|
+
const [account, setAccount] = react.useState();
|
|
7211
|
+
const [accountFailed, setAccountFailed] = react.useState(false);
|
|
7212
|
+
const [accountAttempt, setAccountAttempt] = react.useState(0);
|
|
7213
|
+
react.useEffect(() => {
|
|
7214
|
+
setAccount(void 0);
|
|
7215
|
+
setAccountFailed(false);
|
|
7216
|
+
if (turn === void 0 || sessionId === void 0 || props.accountRemote === void 0) return;
|
|
7217
|
+
let active = true;
|
|
7218
|
+
props.accountRemote.turn(sessionId, turn).then((result) => {
|
|
7219
|
+
if (!active) return;
|
|
7220
|
+
const parsed = result.ok ? TurnAccountViewSchema.safeParse(result.value) : void 0;
|
|
7221
|
+
if (parsed?.success) setAccount(parsed.data);
|
|
7222
|
+
else {
|
|
7223
|
+
setAccountFailed(true);
|
|
7224
|
+
props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
|
|
7225
|
+
}
|
|
7226
|
+
}, () => {
|
|
7227
|
+
if (active) {
|
|
7228
|
+
setAccountFailed(true);
|
|
7229
|
+
props.diagnostic("COPILOT_TURN_ACCOUNT_READ_FAILED");
|
|
7230
|
+
}
|
|
7231
|
+
});
|
|
7232
|
+
return () => {
|
|
7233
|
+
active = false;
|
|
7234
|
+
};
|
|
7235
|
+
}, [
|
|
7236
|
+
props.accountRemote,
|
|
7237
|
+
sessionId,
|
|
7238
|
+
turn,
|
|
7239
|
+
props.diagnostic,
|
|
7240
|
+
accountAttempt
|
|
7241
|
+
]);
|
|
7131
7242
|
react.useEffect(() => {
|
|
7132
7243
|
setLive({ mode: "unknown" });
|
|
7133
7244
|
if (turn === void 0 || sessionId === void 0 || props.remote === void 0) {
|
|
@@ -7198,6 +7309,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7198
7309
|
locale: language,
|
|
7199
7310
|
incomplete: evidence?.incomplete ?? true,
|
|
7200
7311
|
readState: selection.mode === "unknown" ? readState : "ready",
|
|
7312
|
+
account,
|
|
7313
|
+
accountFailed,
|
|
7314
|
+
retryAccount: () => setAccountAttempt((value) => value + 1),
|
|
7201
7315
|
retry: props.remote === void 0 ? void 0 : () => setReadAttempt((value) => value + 1)
|
|
7202
7316
|
}), usageDiagnostic === void 0 ? null : react.createElement(TurnUsageNotice, {
|
|
7203
7317
|
diagnostic: usageDiagnostic,
|
|
@@ -7253,6 +7367,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7253
7367
|
const slots = slotsCandidate;
|
|
7254
7368
|
const face = record$4(capabilities.remote) ? capabilities.remote.githubCopilotTurnSelection : void 0;
|
|
7255
7369
|
const remote = record$4(face) && typeof face.get === "function" ? face : void 0;
|
|
7370
|
+
const accountFace = record$4(capabilities.remote) ? capabilities.remote.githubCopilotSessionAccount : void 0;
|
|
7371
|
+
const readAccount = record$4(accountFace) ? accountFace.turn : void 0;
|
|
7372
|
+
const accountRemote = typeof readAccount === "function" ? { turn: (agentId, turn) => readAccount(agentId, turn) } : void 0;
|
|
7256
7373
|
const locale = record$4(capabilities.locale) && typeof capabilities.locale.getLocale === "function" && typeof capabilities.locale.subscribe === "function" ? capabilities.locale : void 0;
|
|
7257
7374
|
if (!remote) diagnostic("COPILOT_TURN_SELECTION_REMOTE_UNAVAILABLE");
|
|
7258
7375
|
function Entry(props) {
|
|
@@ -7270,6 +7387,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7270
7387
|
turn,
|
|
7271
7388
|
tail,
|
|
7272
7389
|
remote,
|
|
7390
|
+
accountRemote,
|
|
7273
7391
|
locale,
|
|
7274
7392
|
diagnostic
|
|
7275
7393
|
});
|
|
@@ -8414,7 +8532,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8414
8532
|
display: "grid",
|
|
8415
8533
|
gap: 10,
|
|
8416
8534
|
marginBlock: 12
|
|
8417
|
-
} }, (0, react.createElement)("strong", null, "GitHub accounts"), (0, react.createElement)("p", { style: muted$1 }, "
|
|
8535
|
+
} }, (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", {
|
|
8418
8536
|
role: "status",
|
|
8419
8537
|
style: muted$1
|
|
8420
8538
|
}, "COPILOT_ACCOUNTS_REMOTE_UNAVAILABLE · Account management is unavailable in this deployment.") : null, failed ? (0, react.createElement)("p", {
|
|
@@ -8423,7 +8541,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8423
8541
|
}, "Could not read account information. Retry before changing accounts.") : null, view?.diagnostic === void 0 ? null : (0, react.createElement)("p", {
|
|
8424
8542
|
role: "status",
|
|
8425
8543
|
style: muted$1
|
|
8426
|
-
}, view.diagnostic), view?.switchable === false ? (0, react.createElement)("p", { style: muted$1 }, "Switching is unavailable
|
|
8544
|
+
}, 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: {
|
|
8427
8545
|
padding: 0,
|
|
8428
8546
|
margin: 0,
|
|
8429
8547
|
listStyle: "none"
|
|
@@ -8532,7 +8650,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8532
8650
|
manual: "If the browser does not open, copy this address:",
|
|
8533
8651
|
rounding: "Amounts rounded for display. GitHub billing is authoritative.",
|
|
8534
8652
|
low: "Low remaining budget",
|
|
8535
|
-
missing: "COPILOT_USAGE_REMOTE_UNAVAILABLE · Account usage is unavailable in this deployment."
|
|
8653
|
+
missing: "COPILOT_USAGE_REMOTE_UNAVAILABLE · Account usage is unavailable in this deployment.",
|
|
8654
|
+
switchAccount: "Switch account",
|
|
8655
|
+
followGlobal: "Follow global default",
|
|
8656
|
+
sessionSpecified: "Session override",
|
|
8657
|
+
switchScope: "Applies to this Session’s subsequent turns. Running turns and other Sessions are unchanged.",
|
|
8658
|
+
accountSaveFailed: "Could not save the Session account. Refresh and try again.",
|
|
8659
|
+
accountLoading: "Loading account selection…",
|
|
8660
|
+
accountMissing: "Account selection unavailable. Refresh to retry.",
|
|
8661
|
+
runningAccount: "Running turn remains on",
|
|
8662
|
+
identityUnknown: "Identity unavailable"
|
|
8536
8663
|
},
|
|
8537
8664
|
zh: {
|
|
8538
8665
|
credits: "额度",
|
|
@@ -8566,7 +8693,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8566
8693
|
manual: "若浏览器未打开,请复制此地址:",
|
|
8567
8694
|
rounding: "显示数值经过四舍五入,账单以 GitHub 为准。",
|
|
8568
8695
|
low: "剩余额度较低",
|
|
8569
|
-
missing: "COPILOT_USAGE_REMOTE_UNAVAILABLE · 当前部署无法提供账号用量。"
|
|
8696
|
+
missing: "COPILOT_USAGE_REMOTE_UNAVAILABLE · 当前部署无法提供账号用量。",
|
|
8697
|
+
switchAccount: "切换账号",
|
|
8698
|
+
followGlobal: "跟随全局默认",
|
|
8699
|
+
sessionSpecified: "Session 已指定",
|
|
8700
|
+
switchScope: "用于本 Session 后续 turn,不影响正在运行的 turn 或其他 Session。",
|
|
8701
|
+
accountSaveFailed: "无法保存 Session 账号,请刷新后重试。",
|
|
8702
|
+
accountLoading: "正在读取账号选择…",
|
|
8703
|
+
accountMissing: "账号选择暂不可用,请刷新重试。",
|
|
8704
|
+
runningAccount: "正在运行的 turn 仍使用",
|
|
8705
|
+
identityUnknown: "身份暂不可用"
|
|
8570
8706
|
}
|
|
8571
8707
|
};
|
|
8572
8708
|
const secondary = "var(--dsw-alias-label-secondary, GrayText)";
|
|
@@ -8612,6 +8748,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8612
8748
|
const id = (0, react.useId)();
|
|
8613
8749
|
const [view, setView] = (0, react.useState)();
|
|
8614
8750
|
const [accounts, setAccounts] = (0, react.useState)();
|
|
8751
|
+
const [sessionAccount, setSessionAccount] = (0, react.useState)();
|
|
8752
|
+
const [choosingAccount, setChoosingAccount] = (0, react.useState)(false);
|
|
8753
|
+
const [savingAccount, setSavingAccount] = (0, react.useState)(false);
|
|
8754
|
+
const [accountFailed, setAccountFailed] = (0, react.useState)(false);
|
|
8755
|
+
const [accountSaveFailed, setAccountSaveFailed] = (0, react.useState)(false);
|
|
8615
8756
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
8616
8757
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
8617
8758
|
const [open, setOpen] = (0, react.useState)(false);
|
|
@@ -8634,7 +8775,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8634
8775
|
}, []);
|
|
8635
8776
|
const load = (0, react.useCallback)(async (force) => {
|
|
8636
8777
|
const owner = lifecycle.current;
|
|
8637
|
-
if (!owner.active || owner.busy || accountPresentationChanges.pending() || props.remote === void 0 || document.visibilityState === "hidden") return;
|
|
8778
|
+
if (!owner.active || owner.busy || owner.save !== void 0 || accountPresentationChanges.pending() || props.remote === void 0 || document.visibilityState === "hidden") return;
|
|
8638
8779
|
owner.busy = true;
|
|
8639
8780
|
const generation = ++owner.generation;
|
|
8640
8781
|
const current = () => owner.active && owner.generation === generation;
|
|
@@ -8644,11 +8785,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8644
8785
|
const identityOperation = props.accountsRemote === void 0 ? void 0 : force || !identityRead.current ? props.accountsRemote.refreshIdentity() : props.accountsRemote.get();
|
|
8645
8786
|
identityRead.current = true;
|
|
8646
8787
|
const [result, identityResult] = await Promise.all([force ? props.remote.refresh() : props.remote.get(), identityOperation?.catch(() => void 0)]);
|
|
8788
|
+
const sessionResult = props.sessionAccount === void 0 ? void 0 : await props.sessionAccount.get();
|
|
8647
8789
|
if (!current()) return;
|
|
8790
|
+
const sessionView = sessionResult?.ok ? SessionAccountViewSchema.safeParse(sessionResult.value) : void 0;
|
|
8791
|
+
setSessionAccount(sessionView?.success ? sessionView.data : void 0);
|
|
8792
|
+
setAccountFailed(props.sessionAccount !== void 0 && sessionView?.success !== true);
|
|
8648
8793
|
const identityView = identityResult?.ok === true ? accountsViewFrom(identityResult.value) : void 0;
|
|
8649
8794
|
setAccounts(identityView);
|
|
8650
8795
|
const parsed = result.ok ? CopilotUsageViewSchema.safeParse(result.value) : void 0;
|
|
8651
|
-
if (parsed?.success !== true || props.accountsRemote !== void 0 && (identityView === void 0 || parsed.data.accountId !== identityView.activeAccountId)) {
|
|
8796
|
+
if (parsed?.success !== true || props.accountsRemote !== void 0 && (identityView === void 0 || parsed.data.accountId !== identityView.activeAccountId) || props.sessionAccount !== void 0 && (sessionView?.success !== true || parsed.data.accountId !== sessionView.data.accountId)) {
|
|
8652
8797
|
setView(void 0);
|
|
8653
8798
|
setFailed(true);
|
|
8654
8799
|
} else setView(parsed.data);
|
|
@@ -8656,6 +8801,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8656
8801
|
if (current()) {
|
|
8657
8802
|
setView(void 0);
|
|
8658
8803
|
setAccounts(void 0);
|
|
8804
|
+
setSessionAccount(void 0);
|
|
8805
|
+
setAccountFailed(props.sessionAccount !== void 0);
|
|
8659
8806
|
setFailed(true);
|
|
8660
8807
|
}
|
|
8661
8808
|
} finally {
|
|
@@ -8667,13 +8814,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8667
8814
|
}, [
|
|
8668
8815
|
props.remote,
|
|
8669
8816
|
props.accountsRemote,
|
|
8670
|
-
props.contextKey
|
|
8817
|
+
props.contextKey,
|
|
8818
|
+
props.sessionAccount
|
|
8671
8819
|
]);
|
|
8672
8820
|
(0, react.useEffect)(() => {
|
|
8673
8821
|
const owner = lifecycle.current;
|
|
8674
8822
|
owner.active = true;
|
|
8675
8823
|
setView(void 0);
|
|
8676
8824
|
setAccounts(void 0);
|
|
8825
|
+
setSessionAccount(void 0);
|
|
8826
|
+
setChoosingAccount(false);
|
|
8827
|
+
setSavingAccount(false);
|
|
8828
|
+
setAccountFailed(false);
|
|
8829
|
+
setAccountSaveFailed(false);
|
|
8677
8830
|
identityRead.current = false;
|
|
8678
8831
|
setFailed(false);
|
|
8679
8832
|
setBusy(false);
|
|
@@ -8689,10 +8842,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8689
8842
|
const unsubscribe = accountPresentationChanges.subscribe(() => {
|
|
8690
8843
|
owner.generation++;
|
|
8691
8844
|
owner.busy = false;
|
|
8845
|
+
owner.save = void 0;
|
|
8846
|
+
setSavingAccount(false);
|
|
8692
8847
|
setAccounts(void 0);
|
|
8848
|
+
setSessionAccount(void 0);
|
|
8693
8849
|
setView(void 0);
|
|
8694
8850
|
setBusy(false);
|
|
8695
8851
|
setFailed(false);
|
|
8852
|
+
identityRead.current = false;
|
|
8696
8853
|
if (!accountPresentationChanges.pending()) load(false);
|
|
8697
8854
|
});
|
|
8698
8855
|
return () => {
|
|
@@ -8704,6 +8861,50 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8704
8861
|
unsubscribe();
|
|
8705
8862
|
};
|
|
8706
8863
|
}, [load, props.remote]);
|
|
8864
|
+
const chooseAccount = async (accountId) => {
|
|
8865
|
+
const owner = lifecycle.current;
|
|
8866
|
+
const revision = sessionAccount?.accounts.revision;
|
|
8867
|
+
if (!owner.active || owner.save !== void 0 || props.sessionAccount === void 0 || revision === void 0) return;
|
|
8868
|
+
const save = Symbol();
|
|
8869
|
+
owner.save = save;
|
|
8870
|
+
const generation = ++owner.generation;
|
|
8871
|
+
owner.busy = false;
|
|
8872
|
+
setBusy(false);
|
|
8873
|
+
setSavingAccount(true);
|
|
8874
|
+
setAccountSaveFailed(false);
|
|
8875
|
+
try {
|
|
8876
|
+
const result = await props.sessionAccount.set(accountId, revision);
|
|
8877
|
+
if (!owner.active || owner.generation !== generation) return;
|
|
8878
|
+
const parsed = result.ok ? SessionAccountViewSchema.safeParse(result.value) : void 0;
|
|
8879
|
+
if (!parsed?.success) {
|
|
8880
|
+
setAccountSaveFailed(true);
|
|
8881
|
+
setView(void 0);
|
|
8882
|
+
setAccounts(void 0);
|
|
8883
|
+
setSessionAccount(void 0);
|
|
8884
|
+
return;
|
|
8885
|
+
}
|
|
8886
|
+
setSessionAccount(parsed.data);
|
|
8887
|
+
setAccounts(parsed.data.accounts);
|
|
8888
|
+
setView(void 0);
|
|
8889
|
+
identityRead.current = false;
|
|
8890
|
+
setChoosingAccount(false);
|
|
8891
|
+
owner.save = void 0;
|
|
8892
|
+
setSavingAccount(false);
|
|
8893
|
+
await load(false);
|
|
8894
|
+
} catch {
|
|
8895
|
+
if (owner.active && owner.generation === generation) {
|
|
8896
|
+
setAccountSaveFailed(true);
|
|
8897
|
+
setView(void 0);
|
|
8898
|
+
setAccounts(void 0);
|
|
8899
|
+
setSessionAccount(void 0);
|
|
8900
|
+
}
|
|
8901
|
+
} finally {
|
|
8902
|
+
if (owner.active && owner.save === save) {
|
|
8903
|
+
owner.save = void 0;
|
|
8904
|
+
setSavingAccount(false);
|
|
8905
|
+
}
|
|
8906
|
+
}
|
|
8907
|
+
};
|
|
8707
8908
|
(0, react.useLayoutEffect)(() => {
|
|
8708
8909
|
if (!open) return;
|
|
8709
8910
|
panel.current?.showPopover?.();
|
|
@@ -8774,6 +8975,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8774
8975
|
].filter(Boolean).join(" · ")}${used === void 0 && remaining === void 0 ? ` · ${busy ? t.loading : t.unavailable}` : ""}`;
|
|
8775
8976
|
const observed = available ? dateLabel(view.observedAt, language) : void 0;
|
|
8776
8977
|
const reset = available && view.resetAt !== void 0 && view.observedAt !== void 0 && view.resetAt > view.observedAt ? dateLabel(view.resetAt, language) : void 0;
|
|
8978
|
+
const runningIdentity = sessionAccount?.accounts.accounts.find((account) => account.id === sessionAccount.runningAccountId)?.identity;
|
|
8777
8979
|
return (0, react.createElement)("span", { style: {
|
|
8778
8980
|
display: "inline-flex",
|
|
8779
8981
|
minWidth: 0,
|
|
@@ -8843,7 +9045,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8843
9045
|
color: "inherit"
|
|
8844
9046
|
},
|
|
8845
9047
|
"data-copilot-credits-account": ""
|
|
8846
|
-
}, accountIdentityLabel(accounts) ?? t.identityUnavailable), (0, react.createElement)("p", {
|
|
9048
|
+
}, accountIdentityLabel(accounts) ?? t.identityUnavailable), props.sessionAccount === void 0 ? null : (0, react.createElement)("p", {
|
|
9049
|
+
style: muted,
|
|
9050
|
+
"data-copilot-account-source": ""
|
|
9051
|
+
}, sessionAccount === void 0 ? busy ? t.accountLoading : t.accountMissing : sessionAccount.source === "global" ? t.followGlobal : t.sessionSpecified), (0, react.createElement)("p", {
|
|
8847
9052
|
id: `${id}-scope`,
|
|
8848
9053
|
style: muted
|
|
8849
9054
|
}, t.account)), (0, react.createElement)("button", {
|
|
@@ -8854,7 +9059,50 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8854
9059
|
onClick: () => {
|
|
8855
9060
|
close(true);
|
|
8856
9061
|
}
|
|
8857
|
-
}, "×")),
|
|
9062
|
+
}, "×")), props.sessionAccount === void 0 ? null : (0, react.createElement)("div", { style: separator }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("p", { style: muted }, t.switchScope), (0, react.createElement)("button", {
|
|
9063
|
+
type: "button",
|
|
9064
|
+
style: {
|
|
9065
|
+
...button,
|
|
9066
|
+
flexShrink: 0
|
|
9067
|
+
},
|
|
9068
|
+
disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 || busy || savingAccount,
|
|
9069
|
+
"aria-expanded": choosingAccount,
|
|
9070
|
+
onClick: () => setChoosingAccount((value) => !value)
|
|
9071
|
+
}, t.switchAccount)), sessionAccount?.runningAccountId === void 0 ? null : (0, react.createElement)("p", { style: muted }, `${t.runningAccount}: ${runningIdentity ? "@" + runningIdentity.login : t.identityUnknown}`), choosingAccount && sessionAccount ? (0, react.createElement)("div", {
|
|
9072
|
+
role: "group",
|
|
9073
|
+
"aria-label": t.switchAccount,
|
|
9074
|
+
style: {
|
|
9075
|
+
display: "grid",
|
|
9076
|
+
gap: 6,
|
|
9077
|
+
marginTop: 10
|
|
9078
|
+
}
|
|
9079
|
+
}, (0, react.createElement)("button", {
|
|
9080
|
+
type: "button",
|
|
9081
|
+
style: {
|
|
9082
|
+
...button,
|
|
9083
|
+
textAlign: "left"
|
|
9084
|
+
},
|
|
9085
|
+
disabled: savingAccount,
|
|
9086
|
+
"aria-pressed": sessionAccount.source === "global",
|
|
9087
|
+
onClick: () => {
|
|
9088
|
+
chooseAccount(null);
|
|
9089
|
+
}
|
|
9090
|
+
}, t.followGlobal), ...sessionAccount.accounts.accounts.filter((account) => account.configured).map((account) => (0, react.createElement)("button", {
|
|
9091
|
+
key: account.id,
|
|
9092
|
+
type: "button",
|
|
9093
|
+
style: {
|
|
9094
|
+
...button,
|
|
9095
|
+
textAlign: "left"
|
|
9096
|
+
},
|
|
9097
|
+
disabled: savingAccount,
|
|
9098
|
+
"aria-pressed": sessionAccount.source === "session" && sessionAccount.accountId === account.id,
|
|
9099
|
+
onClick: () => {
|
|
9100
|
+
chooseAccount(account.id);
|
|
9101
|
+
}
|
|
9102
|
+
}, 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", {
|
|
9103
|
+
role: "alert",
|
|
9104
|
+
style: muted
|
|
9105
|
+
}, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), view?.state === "stale" ? (0, react.createElement)("p", {
|
|
8858
9106
|
role: "status",
|
|
8859
9107
|
style: muted
|
|
8860
9108
|
}, t.stale) : null, view?.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, view.diagnostic), props.remote === void 0 ? (0, react.createElement)("p", {
|
|
@@ -8936,6 +9184,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8936
9184
|
function isRemote(value) {
|
|
8937
9185
|
return record$2(value) && typeof value.get === "function" && typeof value.refresh === "function";
|
|
8938
9186
|
}
|
|
9187
|
+
function isSessionRemote(value) {
|
|
9188
|
+
return record$2(value) && typeof value.get === "function" && typeof value.set === "function" && typeof value.refreshIdentity === "function" && typeof value.usage === "function" && typeof value.refreshUsage === "function";
|
|
9189
|
+
}
|
|
8939
9190
|
function isLocale$2(value) {
|
|
8940
9191
|
return record$2(value) && typeof value.getLocale === "function" && typeof value.subscribe === "function";
|
|
8941
9192
|
}
|
|
@@ -8956,11 +9207,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8956
9207
|
if (!selection(next)) return void 0;
|
|
8957
9208
|
return next.provider === "github-copilot" || next.provider === "github-copilot-preview" ? next : void 0;
|
|
8958
9209
|
}
|
|
8959
|
-
function Surface$2({ runtime, remote, accountsRemote, locale, diagnostic }) {
|
|
9210
|
+
function Surface$2({ runtime, remote, accountsRemote, sessionRemote, locale, diagnostic }) {
|
|
8960
9211
|
const valid = runtime.useSession((session) => record$2(session) && session.sessionId === runtime.sessionId && session.removed === false && session.openState === "open");
|
|
8961
9212
|
const projection = runtime.useProjection("modelSelection");
|
|
8962
9213
|
const language = (0, react.useSyncExternalStore)(locale === void 0 ? emptySubscribe : (listener) => locale.subscribe(listener), () => locale?.getLocale().active ?? "en", () => "en");
|
|
8963
9214
|
const current = effectiveCopilot(projection);
|
|
9215
|
+
const bound = (0, react.useMemo)(() => {
|
|
9216
|
+
if (sessionRemote === void 0) return void 0;
|
|
9217
|
+
const id = runtime.sessionId;
|
|
9218
|
+
return {
|
|
9219
|
+
usage: {
|
|
9220
|
+
get: () => sessionRemote.usage(id),
|
|
9221
|
+
refresh: () => sessionRemote.refreshUsage(id)
|
|
9222
|
+
},
|
|
9223
|
+
identity: {
|
|
9224
|
+
get: async () => {
|
|
9225
|
+
const result = await sessionRemote.get(id);
|
|
9226
|
+
return result.ok ? {
|
|
9227
|
+
ok: true,
|
|
9228
|
+
value: result.value.accounts
|
|
9229
|
+
} : result;
|
|
9230
|
+
},
|
|
9231
|
+
refreshIdentity: async () => {
|
|
9232
|
+
const result = await sessionRemote.refreshIdentity(id);
|
|
9233
|
+
return result.ok ? {
|
|
9234
|
+
ok: true,
|
|
9235
|
+
value: result.value.accounts
|
|
9236
|
+
} : result;
|
|
9237
|
+
}
|
|
9238
|
+
},
|
|
9239
|
+
account: {
|
|
9240
|
+
get: () => sessionRemote.get(id),
|
|
9241
|
+
set: (account, revision) => sessionRemote.set(id, account, revision)
|
|
9242
|
+
}
|
|
9243
|
+
};
|
|
9244
|
+
}, [sessionRemote, runtime.sessionId]);
|
|
8964
9245
|
(0, react.useEffect)(() => {
|
|
8965
9246
|
if (projection === void 0) diagnostic("COPILOT_USAGE_MODEL_PROJECTION_UNAVAILABLE");
|
|
8966
9247
|
}, [projection, diagnostic]);
|
|
@@ -8973,8 +9254,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8973
9254
|
return (0, react.createElement)(CopilotUsageCard, {
|
|
8974
9255
|
key: contextKey,
|
|
8975
9256
|
contextKey,
|
|
8976
|
-
remote,
|
|
8977
|
-
accountsRemote,
|
|
9257
|
+
remote: current.provider === "github-copilot-preview" ? bound?.usage : remote,
|
|
9258
|
+
accountsRemote: current.provider === "github-copilot-preview" ? bound?.identity : accountsRemote,
|
|
9259
|
+
sessionAccount: current.provider === "github-copilot-preview" ? bound?.account : void 0,
|
|
8978
9260
|
locale: language
|
|
8979
9261
|
});
|
|
8980
9262
|
}
|
|
@@ -8995,6 +9277,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8995
9277
|
const slots = candidate;
|
|
8996
9278
|
let remote;
|
|
8997
9279
|
let accountsRemote;
|
|
9280
|
+
let sessionRemote;
|
|
8998
9281
|
try {
|
|
8999
9282
|
const namespaces = ctx.remote;
|
|
9000
9283
|
const face = record$2(namespaces) ? namespaces.githubCopilotUsage : void 0;
|
|
@@ -9003,6 +9286,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9003
9286
|
const accounts = record$2(namespaces) ? namespaces.githubCopilotAccounts : void 0;
|
|
9004
9287
|
if (record$2(accounts) && typeof accounts.get === "function" && typeof accounts.refreshIdentity === "function") accountsRemote = accounts;
|
|
9005
9288
|
else diagnostic("COPILOT_ACCOUNTS_REMOTE_UNAVAILABLE");
|
|
9289
|
+
const session = record$2(namespaces) ? namespaces.githubCopilotSessionAccount : void 0;
|
|
9290
|
+
if (isSessionRemote(session)) sessionRemote = session;
|
|
9291
|
+
else diagnostic("COPILOT_SESSION_ACCOUNTS_REMOTE_UNAVAILABLE");
|
|
9006
9292
|
} catch {
|
|
9007
9293
|
diagnostic("COPILOT_USAGE_REMOTE_UNAVAILABLE");
|
|
9008
9294
|
}
|
|
@@ -9034,6 +9320,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9034
9320
|
runtime: props,
|
|
9035
9321
|
remote,
|
|
9036
9322
|
accountsRemote,
|
|
9323
|
+
sessionRemote,
|
|
9037
9324
|
locale,
|
|
9038
9325
|
diagnostic
|
|
9039
9326
|
});
|
|
@@ -10753,11 +11040,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10753
11040
|
const usageUi = ctx.inject([
|
|
10754
11041
|
"remote.githubCopilotUsage",
|
|
10755
11042
|
"remote.githubCopilotAccounts",
|
|
11043
|
+
"remote.githubCopilotSessionAccount",
|
|
10756
11044
|
"slots"
|
|
10757
11045
|
], registerCopilotUsageUi);
|
|
10758
11046
|
const contextUi = ctx.inject(["slots"], registerContextEvidenceUi);
|
|
10759
11047
|
const recoveryUi = ctx.inject(["remote.githubCopilotReplayRecovery", "slots"], registerReplayRecoveryUi);
|
|
10760
|
-
const autoUi = ctx.inject([
|
|
11048
|
+
const autoUi = ctx.inject([
|
|
11049
|
+
"remote.githubCopilotTurnSelection",
|
|
11050
|
+
"remote.githubCopilotSessionAccount",
|
|
11051
|
+
"slots"
|
|
11052
|
+
], (scope) => installAutoModelPresentation({
|
|
10761
11053
|
slots: scope.slots,
|
|
10762
11054
|
remote: scope.remote,
|
|
10763
11055
|
locale: scope.get("locale"),
|