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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -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$7 = {
5494
+ const contribution$8 = {
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$6 = {
5542
+ const contribution$7 = {
5543
5543
  package: "dsh-github-copilot",
5544
5544
  descriptors: [{
5545
5545
  id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
@@ -5667,7 +5667,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5667
5667
  if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
5668
5668
  }
5669
5669
  });
5670
- const contribution$5 = {
5670
+ const contribution$6 = {
5671
5671
  package: "dsh-github-copilot",
5672
5672
  descriptors: ["get", "refresh"].map((method) => ({
5673
5673
  id: `dsh-github-copilot:githubCopilotUsage.${method}`,
@@ -5809,7 +5809,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5809
5809
  }).strict();
5810
5810
  //#endregion
5811
5811
  //#region lib/types/turn-selection-remote.js
5812
- const contribution$4 = {
5812
+ const contribution$5 = {
5813
5813
  package: "dsh-github-copilot",
5814
5814
  descriptors: [{
5815
5815
  id: "dsh-github-copilot:githubCopilotTurnSelection.get",
@@ -5871,7 +5871,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5871
5871
  lookup: "agent",
5872
5872
  codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5873
5873
  };
5874
- const contribution$3 = {
5874
+ const contribution$4 = {
5875
5875
  package: "dsh-github-copilot",
5876
5876
  descriptors: [
5877
5877
  {
@@ -5979,7 +5979,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5979
5979
  if (row.identity !== void 0 && !row.configured) invalid();
5980
5980
  }
5981
5981
  });
5982
- const contribution$2 = {
5982
+ const contribution$3 = {
5983
5983
  package: "dsh-github-copilot",
5984
5984
  descriptors: [
5985
5985
  "get",
@@ -6032,7 +6032,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6032
6032
  lookup: "agent",
6033
6033
  codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
6034
6034
  };
6035
- const contribution$1 = {
6035
+ const contribution$2 = {
6036
6036
  package: "dsh-github-copilot",
6037
6037
  descriptors: [
6038
6038
  "get",
@@ -6067,6 +6067,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6067
6067
  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)
6068
6068
  }))
6069
6069
  };
6070
+ array(object({
6071
+ sessionId: string().min(1).max(256).refine((value) => !/[\p{Cc}\p{Cf}]/u.test(value)),
6072
+ version: literal(1),
6073
+ consentedAt: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
6074
+ enabled: boolean().optional()
6075
+ }).strict()).max(2048).refine((rows) => new Set(rows.map((row) => row.sessionId)).size === rows.length);
6076
+ array(object({
6077
+ enabled: boolean(),
6078
+ changedAt: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)
6079
+ }).strict()).max(2048).refine((rows) => rows.every((row, index) => index === 0 || row.changedAt > rows[index - 1].changedAt));
6080
+ const ContinuationDefaultViewSchema = object({
6081
+ enabled: boolean(),
6082
+ revision: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)
6083
+ }).strict();
6084
+ const SessionContinuationViewSchema = object({
6085
+ enabled: boolean(),
6086
+ revision: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
6087
+ activeTurnEnabled: boolean().optional(),
6088
+ source: _enum(["default", "session"]).optional(),
6089
+ nextTurnAuthorized: boolean().optional()
6090
+ }).strict();
6091
+ //#endregion
6092
+ //#region lib/types/session-continuation-remote.js
6093
+ const contribution$1 = {
6094
+ package: "dsh-github-copilot",
6095
+ descriptors: [
6096
+ "get",
6097
+ "set",
6098
+ "authorizeNext",
6099
+ "defaults",
6100
+ "setDefault"
6101
+ ].map((method) => ({
6102
+ id: `dsh-github-copilot:githubCopilotSessionContinuation.${method}`,
6103
+ namespace: "githubCopilotSessionContinuation",
6104
+ service: "githubCopilotSessionContinuation",
6105
+ method,
6106
+ invocation: { kind: "direct" },
6107
+ parameters: [...method === "defaults" || method === "setDefault" ? [] : [{
6108
+ name: "agent",
6109
+ wire: "agentId",
6110
+ source: "lookup",
6111
+ lookup: "agent",
6112
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
6113
+ }], ...method === "set" || method === "authorizeNext" || method === "setDefault" ? [{
6114
+ name: "revision",
6115
+ wire: "revision",
6116
+ source: "json",
6117
+ codec: strictRemoteCodec("dsh-github-copilot#SessionContinuationRevision", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
6118
+ }, {
6119
+ name: "enabled",
6120
+ wire: "enabled",
6121
+ source: "json",
6122
+ codec: strictRemoteCodec("dsh-github-copilot#SessionContinuationEnabled", method === "set" ? boolean().nullable() : boolean())
6123
+ }] : []],
6124
+ result: method === "defaults" || method === "setDefault" ? strictRemoteCodec("dsh-github-copilot#ContinuationDefaultView", ContinuationDefaultViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionContinuationView", SessionContinuationViewSchema)
6125
+ }))
6126
+ };
6070
6127
  //#endregion
6071
6128
  //#region lib/types/remote.js
6072
6129
  /**
@@ -6276,6 +6333,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6276
6333
  parameters: [],
6277
6334
  result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
6278
6335
  },
6336
+ ...contribution$8.descriptors,
6279
6337
  ...contribution$7.descriptors,
6280
6338
  ...contribution$6.descriptors,
6281
6339
  ...contribution$5.descriptors,
@@ -8478,6 +8536,171 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8478
8536
  }, message || (busy ? "Loading subagent settings…" : "")));
8479
8537
  }
8480
8538
  //#endregion
8539
+ //#region lib/types/account-dropdown.js
8540
+ function AccountDropdown(props) {
8541
+ const id = (0, react.useId)();
8542
+ const localTrigger = (0, react.useRef)(null);
8543
+ const trigger = props.triggerRef ?? localTrigger;
8544
+ const menu = (0, react.useRef)(null);
8545
+ const [placement, setPlacement] = (0, react.useState)({
8546
+ left: 12,
8547
+ top: 12,
8548
+ maxHeight: 300
8549
+ });
8550
+ const change = (0, react.useRef)(props.onOpenChange);
8551
+ change.current = props.onOpenChange;
8552
+ (0, react.useLayoutEffect)(() => {
8553
+ if (!props.open) return;
8554
+ menu.current?.showPopover?.();
8555
+ const place = () => {
8556
+ const anchor = trigger.current?.getBoundingClientRect();
8557
+ if (!anchor) return;
8558
+ const width = Math.min(300, window.innerWidth - 24);
8559
+ const height = Math.min(menu.current?.scrollHeight ?? 300, 330);
8560
+ const below = window.innerHeight - anchor.bottom - 20;
8561
+ const above = anchor.top - 20;
8562
+ const upwards = below < height && above > below;
8563
+ const maxHeight = Math.max(60, Math.min(330, upwards ? above : below));
8564
+ setPlacement({
8565
+ left: Math.max(12, Math.min(anchor.right - width, window.innerWidth - width - 12)),
8566
+ top: upwards ? Math.max(12, anchor.top - Math.min(height, maxHeight) - 8) : anchor.bottom + 8,
8567
+ maxHeight
8568
+ });
8569
+ };
8570
+ place();
8571
+ (menu.current?.querySelector("button[aria-pressed=\"true\"]:not(:disabled)") ?? menu.current?.querySelector("button:not(:disabled)"))?.focus();
8572
+ window.addEventListener("resize", place);
8573
+ const scroll = (event) => {
8574
+ if (event.target instanceof Node && menu.current?.contains(event.target)) return;
8575
+ place();
8576
+ };
8577
+ window.addEventListener("scroll", scroll, true);
8578
+ return () => {
8579
+ window.removeEventListener("resize", place);
8580
+ window.removeEventListener("scroll", scroll, true);
8581
+ };
8582
+ }, [props.open, trigger]);
8583
+ (0, react.useEffect)(() => {
8584
+ if (!props.open) return;
8585
+ const outside = (event) => {
8586
+ if (event.target instanceof Node && !menu.current?.contains(event.target) && !trigger.current?.contains(event.target)) change.current(false);
8587
+ };
8588
+ document.addEventListener("pointerdown", outside);
8589
+ return () => document.removeEventListener("pointerdown", outside);
8590
+ }, [props.open, trigger]);
8591
+ return (0, react.createElement)("div", {
8592
+ "data-copilot-account-dropdown": "",
8593
+ style: {
8594
+ position: "relative",
8595
+ minWidth: 0,
8596
+ flexShrink: 0
8597
+ }
8598
+ }, (0, react.createElement)("style", null, `
8599
+ [data-copilot-account-dropdown] > button::after { content: ' ▾'; padding-left: 6px; font-size: 11px }
8600
+ [data-copilot-dropdown-option]::before { content: ''; width: 16px; flex-shrink: 0 }
8601
+ [data-copilot-dropdown-option][aria-pressed=true]::before { content: '✓' }
8602
+ [data-copilot-dropdown-option]:hover { background: var(--dsw-alias-bg-layer-2, ButtonFace) !important }
8603
+ [data-copilot-account-dropdown] button:focus-visible { outline: 2px solid var(--dsw-alias-label-primary, CanvasText); outline-offset: -2px }
8604
+ `), (0, react.createElement)("button", {
8605
+ ref: trigger,
8606
+ type: "button",
8607
+ style: {
8608
+ ...props.triggerStyle,
8609
+ whiteSpace: "nowrap"
8610
+ },
8611
+ disabled: props.disabled,
8612
+ "aria-label": props.label,
8613
+ "aria-expanded": props.open,
8614
+ "aria-controls": props.open ? id : void 0,
8615
+ onClick: () => props.onOpenChange(!props.open)
8616
+ }, props.label), props.open ? (0, react.createElement)("div", {
8617
+ ref: menu,
8618
+ id,
8619
+ popover: "manual",
8620
+ role: "group",
8621
+ "aria-label": props.label,
8622
+ "aria-busy": props.busy,
8623
+ "data-copilot-account-selector": "",
8624
+ style: {
8625
+ position: "fixed",
8626
+ inset: "auto",
8627
+ margin: 0,
8628
+ ...placement,
8629
+ zIndex: 1100,
8630
+ width: 300,
8631
+ maxWidth: "calc(100vw - 24px)",
8632
+ boxSizing: "border-box",
8633
+ overflowY: "auto",
8634
+ padding: 5,
8635
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
8636
+ borderRadius: 10,
8637
+ background: "var(--dsw-specific-menu, Canvas)",
8638
+ color: "var(--dsw-alias-label-primary, CanvasText)",
8639
+ colorScheme: "inherit",
8640
+ font: "inherit",
8641
+ boxShadow: "0 10px 28px color-mix(in srgb, CanvasText 20%, transparent)"
8642
+ },
8643
+ onKeyDown: (event) => {
8644
+ const buttons = Array.from(menu.current?.querySelectorAll("button:not(:disabled)") ?? []);
8645
+ if (event.key === "Escape") {
8646
+ event.preventDefault();
8647
+ event.stopPropagation();
8648
+ props.onOpenChange(false);
8649
+ trigger.current?.focus();
8650
+ } else if ([
8651
+ "ArrowDown",
8652
+ "ArrowUp",
8653
+ "Home",
8654
+ "End"
8655
+ ].includes(event.key)) {
8656
+ event.preventDefault();
8657
+ const current = document.activeElement instanceof HTMLButtonElement ? buttons.indexOf(document.activeElement) : -1;
8658
+ buttons[event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowDown" ? 1 : -1) + buttons.length) % buttons.length]?.focus();
8659
+ } else if (event.key === "Tab") {
8660
+ trigger.current?.focus();
8661
+ props.onOpenChange(false);
8662
+ }
8663
+ }
8664
+ }, (0, react.createElement)("div", {
8665
+ [props.listAttribute]: "",
8666
+ style: {
8667
+ display: "grid",
8668
+ maxHeight: props.maxHeight ?? 240,
8669
+ overflowY: "auto",
8670
+ overscrollBehavior: "contain"
8671
+ }
8672
+ }, ...props.options.map((option) => (0, react.createElement)("button", {
8673
+ key: option.id,
8674
+ type: "button",
8675
+ "data-copilot-dropdown-option": "",
8676
+ "data-copilot-saved-account": option.id,
8677
+ "aria-label": option.label,
8678
+ "aria-pressed": option.selected,
8679
+ disabled: props.busy || option.disabled,
8680
+ style: {
8681
+ font: "inherit",
8682
+ color: "inherit",
8683
+ colorScheme: "inherit",
8684
+ display: "flex",
8685
+ alignItems: "center",
8686
+ gap: 8,
8687
+ border: 0,
8688
+ borderRadius: 5,
8689
+ padding: "10px 8px",
8690
+ minHeight: 42,
8691
+ textAlign: "left",
8692
+ overflowWrap: "anywhere",
8693
+ cursor: "pointer",
8694
+ background: "transparent"
8695
+ },
8696
+ onClick: () => props.onSelect(option.id)
8697
+ }, option.label))), props.footer ? (0, react.createElement)("div", { style: {
8698
+ borderTop: "1px solid var(--dsw-alias-border-main, GrayText)",
8699
+ marginTop: 5,
8700
+ padding: "6px 4px"
8701
+ } }, props.footer) : null) : null);
8702
+ }
8703
+ //#endregion
8481
8704
  //#region lib/types/external-link.js
8482
8705
  /** Use Desktop's public v1 navigation handoff instead of WebView popup creation. */
8483
8706
  function externalLinkTarget() {
@@ -8521,6 +8744,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8521
8744
  }
8522
8745
  //#endregion
8523
8746
  //#region lib/types/copilot-accounts-card.js
8747
+ function CopilotAccountAdd(props) {
8748
+ return (0, react.createElement)(CopilotAccountControls, {
8749
+ ...props,
8750
+ addOnly: true,
8751
+ expanded: true
8752
+ });
8753
+ }
8524
8754
  /** Copy owned presentation fields before decoding traced Client values. */
8525
8755
  function accountsViewFrom(value) {
8526
8756
  const record = (input) => {
@@ -8579,7 +8809,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8579
8809
  borderRadius: 8,
8580
8810
  padding: "6px 10px",
8581
8811
  minHeight: 32,
8582
- cursor: "pointer"
8812
+ cursor: "pointer",
8813
+ colorScheme: "inherit"
8583
8814
  };
8584
8815
  const muted$1 = {
8585
8816
  color: secondary$1,
@@ -8591,7 +8822,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8591
8822
  en: {
8592
8823
  identityChecking: "Checking GitHub identity…",
8593
8824
  identityUnavailable: "GitHub account identity unavailable",
8594
- accounts: "GitHub accounts",
8825
+ accounts: "Account management",
8826
+ savedAccounts: "Manage saved authorizations",
8595
8827
  scope: "Global default for new inherited turns. Credits can override this Session’s subsequent turns. Running turns, explicit Session accounts, models and conversation history stay unchanged.",
8596
8828
  remoteUnavailable: "Account management is unavailable in this deployment.",
8597
8829
  readFailed: "Could not read account information. Retry before changing accounts.",
@@ -8645,12 +8877,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8645
8877
  cancelling: "Cancelling…",
8646
8878
  add: "Add GitHub account",
8647
8879
  refresh: "Refresh account information",
8648
- refreshing: "Checking…"
8880
+ refreshing: "Checking…",
8881
+ retry: "Retry"
8649
8882
  },
8650
8883
  zh: {
8651
8884
  identityChecking: "正在检查 GitHub 身份…",
8652
8885
  identityUnavailable: "GitHub 账号身份暂不可用",
8653
- accounts: "GitHub 账号",
8886
+ accounts: "账号管理",
8887
+ savedAccounts: "管理已保存授权",
8654
8888
  scope: "全局默认账号用于后续继承默认值的新 turn。Credits 可为本 Session 后续 turn 指定账号。正在运行的 turn、Session 已指定账号、模型和对话历史保持不变。",
8655
8889
  remoteUnavailable: "当前部署无法管理账号。",
8656
8890
  readFailed: "无法读取账号信息。更改账号前请重试。",
@@ -8704,7 +8938,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8704
8938
  cancelling: "正在取消…",
8705
8939
  add: "添加 GitHub 账号",
8706
8940
  refresh: "刷新账号信息",
8707
- refreshing: "正在检查…"
8941
+ refreshing: "正在检查…",
8942
+ retry: "重试"
8708
8943
  }
8709
8944
  };
8710
8945
  function accountProblemMessage(code, text) {
@@ -8730,6 +8965,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8730
8965
  }
8731
8966
  }
8732
8967
  function CopilotAccountsPanel(props) {
8968
+ return (0, react.createElement)(CopilotAccountControls, props);
8969
+ }
8970
+ function CopilotAccountControls(props) {
8971
+ const managementRemote = props.addOnly ? void 0 : props.remote;
8733
8972
  const [view, setView] = (0, react.useState)();
8734
8973
  const [busy, setBusy] = (0, react.useState)(false);
8735
8974
  const [failed, setFailed] = (0, react.useState)(false);
@@ -8737,13 +8976,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8737
8976
  const [cancelRequested, setCancelRequested] = (0, react.useState)(false);
8738
8977
  const [authorizationIntent, setAuthorizationIntent] = (0, react.useState)();
8739
8978
  const [confirmation, setConfirmation] = (0, react.useState)();
8979
+ const [accountsOpen, setAccountsOpen] = (0, react.useState)(false);
8740
8980
  const lifetime = (0, react.useRef)({
8741
8981
  active: false,
8742
8982
  generation: 0,
8743
8983
  busy: false,
8744
8984
  copyGeneration: 0
8745
8985
  });
8986
+ const refreshed = (0, react.useRef)(props.refreshKey);
8746
8987
  const text = props.locale?.toLowerCase().startsWith("zh") ? accountCopy.zh : accountCopy.en;
8988
+ (0, react.useEffect)(() => {
8989
+ if (!props.expanded) {
8990
+ setAccountsOpen(false);
8991
+ setConfirmation(void 0);
8992
+ }
8993
+ }, [props.expanded]);
8747
8994
  const run = (0, react.useCallback)(async (operation, changed = false, invalidate = changed) => {
8748
8995
  const owner = lifetime.current;
8749
8996
  if (!owner.active || owner.busy) return;
@@ -8789,7 +9036,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8789
9036
  setCopyState("idle");
8790
9037
  setCancelRequested(false);
8791
9038
  setAuthorizationIntent(void 0);
8792
- if (props.remote !== void 0 && !props.authorizationBusy) run(() => props.remote.ensureIdentity());
9039
+ if (props.remote !== void 0 && !props.authorizationBusy) {
9040
+ const remote = props.remote;
9041
+ run(() => managementRemote !== void 0 ? managementRemote.ensureIdentity() : remote.get());
9042
+ }
8793
9043
  return () => {
8794
9044
  owner.active = false;
8795
9045
  owner.generation++;
@@ -8797,14 +9047,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8797
9047
  };
8798
9048
  }, [
8799
9049
  props.remote,
9050
+ managementRemote,
8800
9051
  run,
8801
9052
  props.authorizationBusy,
8802
9053
  props.configured
8803
9054
  ]);
8804
9055
  (0, react.useEffect)(() => {
8805
- if (props.remote === void 0 || props.authorizationBusy || view?.operation !== void 0) return;
9056
+ if (refreshed.current === props.refreshKey || managementRemote === void 0 || busy || props.authorizationBusy) return;
9057
+ refreshed.current = props.refreshKey;
9058
+ setConfirmation(void 0);
9059
+ run(() => managementRemote.get());
9060
+ }, [
9061
+ props.refreshKey,
9062
+ managementRemote,
9063
+ busy,
9064
+ props.authorizationBusy,
9065
+ run
9066
+ ]);
9067
+ (0, react.useEffect)(() => {
9068
+ if (managementRemote === void 0 || props.authorizationBusy || view?.operation !== void 0) return;
8806
9069
  const ensure = () => {
8807
- if (document.visibilityState !== "hidden") run(() => props.remote.ensureIdentity());
9070
+ if (document.visibilityState !== "hidden") run(() => managementRemote.ensureIdentity());
8808
9071
  };
8809
9072
  const timer = window.setInterval(ensure, 6e4);
8810
9073
  document.addEventListener("visibilitychange", ensure);
@@ -8813,7 +9076,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8813
9076
  document.removeEventListener("visibilitychange", ensure);
8814
9077
  };
8815
9078
  }, [
8816
- props.remote,
9079
+ managementRemote,
8817
9080
  props.authorizationBusy,
8818
9081
  view?.operation,
8819
9082
  run
@@ -8867,13 +9130,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8867
9130
  run(() => props.remote.add(), true);
8868
9131
  };
8869
9132
  const startReauthorization = (accountId, revision) => {
9133
+ if (managementRemote === void 0) return;
8870
9134
  setAuthorizationIntent("reauthorize");
8871
9135
  setCancelRequested(false);
8872
- run(() => props.remote.reauthorize(accountId, revision), true);
9136
+ run(() => managementRemote.reauthorize(accountId, revision), true);
8873
9137
  };
8874
9138
  const identity = accountIdentityLabel(view);
9139
+ const activeAccount = view?.accounts.find((account) => account.id === view.activeAccountId);
8875
9140
  const selected = confirmation === void 0 ? void 0 : view?.accounts.find((item) => item.id === confirmation.id);
8876
9141
  const selectedLabel = selected?.identityState === "ready" && selected.identity !== void 0 ? `@${selected.identity.login}` : text.savedAuthorization;
9142
+ const savedAccounts = view?.accounts ?? [];
8877
9143
  const pending = busy || props.authorizationBusy === true || view?.operation !== void 0;
8878
9144
  const authorizationOperation = view?.operation === "authorizing" || view?.operation === "verifying";
8879
9145
  const authorizationStatus = cancelRequested ? text.cancelling : view?.operation === "authorizing" ? authorizationIntent === "add" ? noticeCode === void 0 ? text.addingStarting : text.addingWaiting : authorizationIntent === "reauthorize" ? noticeCode === void 0 ? text.reauthorizingStarting : text.reauthorizingWaiting : noticeCode === void 0 ? text.authorizationStarting : text.authorizationWaiting : view?.operation === "verifying" ? authorizationIntent === "add" ? text.verifyingAdding : authorizationIntent === "reauthorize" ? text.verifyingReauthorizing : text.verifying : view?.operation === "switching" ? text.switchingBusy : void 0;
@@ -8882,11 +9148,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8882
9148
  type: "button",
8883
9149
  style: {
8884
9150
  ...button$1,
8885
- cursor: disabled ? "default" : "pointer"
9151
+ cursor: disabled ? "not-allowed" : "pointer",
9152
+ color: disabled ? "var(--dsw-alias-label-secondary, GrayText)" : "inherit"
8886
9153
  },
8887
9154
  onClick,
8888
9155
  disabled
8889
9156
  }, label);
9157
+ const savedAccountItems = savedAccounts.map((account) => {
9158
+ const accountName = account.identityState === "ready" && account.identity !== void 0 ? `@${account.identity.login}` : text.savedAuthorization;
9159
+ return (0, react.createElement)("li", {
9160
+ key: account.id,
9161
+ style: {
9162
+ display: "flex",
9163
+ flexWrap: "wrap",
9164
+ alignItems: "center",
9165
+ gap: 8,
9166
+ paddingBlock: 10,
9167
+ borderBottom: border$1
9168
+ }
9169
+ }, (0, react.createElement)("div", { style: {
9170
+ minWidth: 0,
9171
+ flex: "1 1 140px"
9172
+ } }, (0, react.createElement)("strong", null, account.identityState === "ready" && account.identity !== void 0 ? accountName : account.configured ? text.identityUnavailableLabel : text.authorizationUnavailable), (0, react.createElement)("p", { style: muted$1 }, account.id === view?.activeAccountId ? text.currentDefault : account.configured ? text.savedAuthorization : text.authorizationUnavailable)), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.reauthorize, () => {
9173
+ if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(account.id, view.revision);
9174
+ }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
9175
+ if (view?.revision !== void 0) setConfirmation({
9176
+ id: account.id,
9177
+ revision: view.revision,
9178
+ remove: true
9179
+ });
9180
+ }, pending || view?.writable !== true || view?.revision === void 0));
9181
+ });
8890
9182
  return (0, react.createElement)("div", {
8891
9183
  "data-copilot-accounts": "",
8892
9184
  "aria-busy": pending,
@@ -8894,16 +9186,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8894
9186
  minWidth: 0,
8895
9187
  overflowWrap: "anywhere"
8896
9188
  }
8897
- }, (0, react.createElement)("p", {
9189
+ }, !props.expanded ? (0, react.createElement)("p", {
8898
9190
  style: muted$1,
8899
9191
  role: "status",
8900
9192
  "aria-live": "polite",
8901
9193
  "data-copilot-current-account": ""
8902
- }, identity ?? (busy ? text.identityChecking : text.identityUnavailable)), !props.expanded ? null : (0, react.createElement)("div", { style: {
8903
- display: "grid",
8904
- gap: 10,
8905
- marginBlock: 12
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", {
9194
+ }, identity ?? (busy ? text.identityChecking : text.identityUnavailable)) : null, !props.expanded ? null : (0, react.createElement)("section", {
9195
+ "data-copilot-account-management": props.addOnly ? void 0 : true,
9196
+ "data-copilot-account-add": props.addOnly ? true : void 0,
9197
+ "aria-label": props.addOnly ? text.add : text.accounts,
9198
+ style: {
9199
+ display: "grid",
9200
+ gap: 10,
9201
+ marginBlock: 12
9202
+ }
9203
+ }, props.addOnly ? null : (0, react.createElement)("h3", { style: {
9204
+ margin: 0,
9205
+ fontSize: 16
9206
+ } }, text.accounts), props.addOnly ? null : (0, react.createElement)("p", { style: muted$1 }, text.scope), props.remote === void 0 ? (0, react.createElement)("p", {
8907
9207
  role: "status",
8908
9208
  style: muted$1
8909
9209
  }, text.remoteUnavailable) : null, failed ? (0, react.createElement)("p", {
@@ -8971,41 +9271,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8971
9271
  color: secondary$1,
8972
9272
  fontSize: 13
8973
9273
  }
8974
- }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.technicalDetails), (0, react.createElement)("code", { style: { overflowWrap: "anywhere" } }, view.diagnostic)), (0, react.createElement)("ul", { style: {
8975
- padding: 0,
8976
- margin: 0,
8977
- listStyle: "none"
8978
- } }, ...(view?.accounts ?? []).map((account) => (0, react.createElement)("li", {
8979
- key: account.id,
9274
+ }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.technicalDetails), (0, react.createElement)("code", { style: { overflowWrap: "anywhere" } }, view.diagnostic)), props.addOnly && !authorizationOperation ? control(text.add, () => {
9275
+ if (props.remote !== void 0) startAdd();
9276
+ }, pending || view?.writable !== true || view?.switchable !== true) : null, props.addOnly && (failed || !pending && view?.switchable === false) ? control(text.retry, () => {
9277
+ if (props.remote !== void 0) run(() => props.remote.get());
9278
+ }, pending || props.remote === void 0) : null, props.addOnly ? null : (0, react.createElement)("div", {
9279
+ "data-copilot-current-account-row": true,
8980
9280
  style: {
8981
9281
  display: "flex",
8982
9282
  flexWrap: "wrap",
8983
9283
  alignItems: "center",
8984
9284
  gap: 8,
8985
- paddingBlock: 10,
9285
+ paddingBlock: 8,
8986
9286
  borderBottom: border$1
8987
9287
  }
8988
9288
  }, (0, react.createElement)("div", { style: {
8989
9289
  minWidth: 0,
8990
9290
  flex: "1 1 180px"
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, () => {
8992
- if (view?.revision !== void 0) setConfirmation({
8993
- id: account.id,
8994
- revision: view.revision,
8995
- remove: false
8996
- });
8997
- }, pending || view?.switchable !== true || view?.revision === void 0 || !account.configured), account.id === "canonical" ? null : control(text.reauthorize, () => {
8998
- if (props.remote !== void 0 && view?.revision !== void 0) {
8999
- const revision = view.revision;
9000
- startReauthorization(account.id, revision);
9001
- }
9002
- }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0), account.id === "canonical" || account.id === view?.activeAccountId ? null : control(text.remove, () => {
9003
- if (view?.revision !== void 0) setConfirmation({
9291
+ } }, (0, react.createElement)("strong", {
9292
+ "data-copilot-current-account": "",
9293
+ role: "status",
9294
+ "aria-live": "polite"
9295
+ }, identity ?? text.identityUnavailableLabel), (0, react.createElement)("p", { style: muted$1 }, text.currentDefault)), (0, react.createElement)(AccountDropdown, {
9296
+ label: text.switch,
9297
+ open: accountsOpen,
9298
+ triggerStyle: button$1,
9299
+ disabled: pending || view?.switchable !== true || view?.revision === void 0,
9300
+ busy: pending,
9301
+ onOpenChange: (open) => {
9302
+ setAccountsOpen(open);
9303
+ setConfirmation(void 0);
9304
+ },
9305
+ options: savedAccounts.map((account) => ({
9004
9306
  id: account.id,
9005
- revision: view.revision,
9006
- remove: true
9007
- });
9008
- }, pending || view?.writable !== true || view?.revision === void 0)))), confirmation === void 0 ? null : (0, react.createElement)("div", {
9307
+ label: account.identityState === "ready" && account.identity ? `@${account.identity.login}` : `${text.savedAuthorization}${account.id === "canonical" ? "" : ` ${savedAccounts.indexOf(account) + 1}`} · ${text.identityUnavailableLabel}`,
9308
+ selected: account.id === view?.activeAccountId,
9309
+ disabled: !account.configured
9310
+ })),
9311
+ onSelect: (id) => {
9312
+ setAccountsOpen(false);
9313
+ if (id !== view?.activeAccountId && view?.revision !== void 0) setConfirmation({
9314
+ id,
9315
+ revision: view.revision,
9316
+ remove: false
9317
+ });
9318
+ },
9319
+ listAttribute: "data-copilot-saved-accounts",
9320
+ footer: authorizationOperation ? null : control(text.add, () => {
9321
+ setAccountsOpen(false);
9322
+ if (props.remote !== void 0) startAdd();
9323
+ }, pending || view?.writable !== true || view?.switchable !== true)
9324
+ })), props.addOnly || confirmation === void 0 ? null : (0, react.createElement)("div", {
9009
9325
  role: "group",
9010
9326
  "aria-label": confirmation.remove ? text.confirmRemoveTitle : text.confirmSwitchTitle,
9011
9327
  style: {
@@ -9024,16 +9340,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9024
9340
  } }, control(confirmation.remove ? text.confirmRemove : text.confirmSwitch, () => {
9025
9341
  const target = confirmation;
9026
9342
  setConfirmation(void 0);
9027
- if (props.remote !== void 0) run(() => target.remove ? props.remote.removeAccount(target.id, target.revision) : props.remote.switchAccount(target.id, target.revision), true);
9028
- }, pending), control(text.cancel, () => setConfirmation(void 0), pending))), (0, react.createElement)("div", { style: {
9343
+ if (managementRemote !== void 0) run(() => target.remove ? managementRemote.removeAccount(target.id, target.revision) : managementRemote.switchAccount(target.id, target.revision), true);
9344
+ }, pending), control(text.cancel, () => setConfirmation(void 0), pending))), props.addOnly ? null : (0, react.createElement)("div", { style: {
9029
9345
  display: "flex",
9030
9346
  flexWrap: "wrap",
9031
9347
  gap: 8
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, () => {
9035
- if (props.remote !== void 0) run(() => props.remote.refreshIdentity());
9036
- }, pending || props.remote === void 0))));
9348
+ } }, control(busy ? text.refreshing : text.refresh, () => {
9349
+ if (managementRemote !== void 0) run(() => managementRemote.refreshIdentity());
9350
+ }, pending || props.remote === void 0), activeAccount === void 0 || activeAccount.id === "canonical" ? null : control(text.reauthorize, () => {
9351
+ if (props.remote !== void 0 && view?.revision !== void 0) startReauthorization(activeAccount.id, view.revision);
9352
+ }, pending || view?.writable !== true || view?.switchable !== true || view?.revision === void 0)), props.addOnly || savedAccounts.every((account) => account.id === "canonical" || account.id === view?.activeAccountId) ? null : (0, react.createElement)("details", null, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, text.savedAccounts), (0, react.createElement)("ul", { style: {
9353
+ listStyle: "none",
9354
+ padding: 0,
9355
+ maxHeight: 240,
9356
+ overflowY: "auto"
9357
+ } }, ...savedAccountItems)), props.accountSettings ?? null, props.continuationSettings ?? null));
9037
9358
  }
9038
9359
  //#endregion
9039
9360
  //#region lib/types/copilot-usage-card.js
@@ -9081,7 +9402,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9081
9402
  runningAccount: "Running turn remains on",
9082
9403
  identityUnknown: "Identity unavailable",
9083
9404
  originalAuthorization: "Original authorization",
9084
- savedAuthorization: "Saved authorization"
9405
+ savedAuthorization: "Saved authorization",
9406
+ nextAccount: "Next turn",
9407
+ savingAccount: "Saving account…",
9408
+ manage: "Manage accounts and models",
9409
+ confirmingAccount: "Reviewing account switch…"
9085
9410
  },
9086
9411
  zh: {
9087
9412
  credits: "额度",
@@ -9126,7 +9451,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9126
9451
  runningAccount: "正在运行的 turn 仍使用",
9127
9452
  identityUnknown: "身份暂不可用",
9128
9453
  originalAuthorization: "原始授权",
9129
- savedAuthorization: "已保存授权"
9454
+ savedAuthorization: "已保存授权",
9455
+ nextAccount: "下一轮",
9456
+ savingAccount: "正在保存账号…",
9457
+ manage: "管理账号与模型",
9458
+ confirmingAccount: "正在确认账号切换…"
9130
9459
  }
9131
9460
  };
9132
9461
  const secondary = "var(--dsw-alias-label-secondary, GrayText)";
@@ -9138,8 +9467,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9138
9467
  border,
9139
9468
  borderRadius: 8,
9140
9469
  background: "var(--dsw-alias-bg-layer-1, Canvas)",
9141
- padding: "5px 9px"
9470
+ padding: "5px 9px",
9471
+ colorScheme: "inherit"
9142
9472
  };
9473
+ const formStyles = `
9474
+ [data-copilot-usage-panel] :is(input, select, textarea, button) { color-scheme: inherit; }
9475
+ [data-copilot-usage-panel] option { background: Canvas; color: CanvasText; }
9476
+ [data-copilot-usage-panel] :is(input, select, textarea, button, a, summary):focus-visible {
9477
+ outline: 2px solid Highlight; outline-offset: 2px;
9478
+ }
9479
+ [data-copilot-usage-panel] :is(input, select, textarea, button):disabled { opacity: 0.65; }
9480
+ `;
9143
9481
  const muted = {
9144
9482
  color: secondary,
9145
9483
  fontSize: 12,
@@ -9175,6 +9513,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9175
9513
  const [sessionAccount, setSessionAccount] = (0, react.useState)();
9176
9514
  const [choosingAccount, setChoosingAccount] = (0, react.useState)(false);
9177
9515
  const [savingAccount, setSavingAccount] = (0, react.useState)(false);
9516
+ const [confirmingAccount, setConfirmingAccount] = (0, react.useState)(false);
9178
9517
  const [accountFailed, setAccountFailed] = (0, react.useState)(false);
9179
9518
  const [accountSaveFailed, setAccountSaveFailed] = (0, react.useState)(false);
9180
9519
  const [busy, setBusy] = (0, react.useState)(false);
@@ -9187,15 +9526,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9187
9526
  const trigger = (0, react.useRef)(null);
9188
9527
  const panel = (0, react.useRef)(null);
9189
9528
  const closeButton = (0, react.useRef)(null);
9529
+ const switchButton = (0, react.useRef)(null);
9190
9530
  const lifecycle = (0, react.useRef)({
9191
9531
  active: false,
9192
9532
  generation: 0,
9193
9533
  busy: false
9194
9534
  });
9195
9535
  const close = (0, react.useCallback)((restore = false) => {
9536
+ const owner = lifecycle.current;
9537
+ if (owner.confirmation !== void 0) {
9538
+ owner.generation++;
9539
+ owner.confirmation = void 0;
9540
+ owner.save = void 0;
9541
+ setConfirmingAccount(false);
9542
+ setSavingAccount(false);
9543
+ }
9544
+ owner.controller?.abort();
9545
+ owner.controller = void 0;
9196
9546
  setOpen(false);
9547
+ setChoosingAccount(false);
9197
9548
  if (restore) trigger.current?.focus();
9198
9549
  }, []);
9550
+ const collapseAccounts = () => {
9551
+ setChoosingAccount(false);
9552
+ switchButton.current?.focus();
9553
+ };
9199
9554
  const load = (0, react.useCallback)(async (force) => {
9200
9555
  const owner = lifecycle.current;
9201
9556
  if (!owner.active || owner.busy || owner.save !== void 0 || accountPresentationChanges.pending() || props.remote === void 0 || document.visibilityState === "hidden") return;
@@ -9263,6 +9618,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9263
9618
  setSessionAccount(void 0);
9264
9619
  setChoosingAccount(false);
9265
9620
  setSavingAccount(false);
9621
+ setConfirmingAccount(false);
9266
9622
  setAccountFailed(false);
9267
9623
  setAccountSaveFailed(false);
9268
9624
  setFailed(false);
@@ -9280,7 +9636,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9280
9636
  owner.generation++;
9281
9637
  owner.busy = false;
9282
9638
  owner.save = void 0;
9639
+ owner.confirmation = void 0;
9640
+ owner.controller?.abort();
9641
+ owner.controller = void 0;
9283
9642
  setSavingAccount(false);
9643
+ setConfirmingAccount(false);
9284
9644
  setAccounts(void 0);
9285
9645
  setSessionAccount(void 0);
9286
9646
  setView(void 0);
@@ -9292,6 +9652,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9292
9652
  owner.active = false;
9293
9653
  owner.generation++;
9294
9654
  owner.busy = false;
9655
+ owner.save = void 0;
9656
+ owner.confirmation = void 0;
9657
+ owner.controller?.abort();
9658
+ owner.controller = void 0;
9295
9659
  if (timer !== void 0) window.clearInterval(timer);
9296
9660
  document.removeEventListener("visibilitychange", visible);
9297
9661
  unsubscribe();
@@ -9299,16 +9663,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9299
9663
  }, [load, props.remote]);
9300
9664
  const chooseAccount = async (accountId) => {
9301
9665
  const owner = lifecycle.current;
9302
- const revision = sessionAccount?.accounts.revision;
9666
+ let revision = sessionAccount?.accounts.revision;
9303
9667
  if (!owner.active || owner.save !== void 0 || props.sessionAccount === void 0 || revision === void 0) return;
9304
9668
  const save = Symbol();
9669
+ const controller = new AbortController();
9305
9670
  owner.save = save;
9671
+ owner.controller = controller;
9306
9672
  const generation = ++owner.generation;
9307
9673
  owner.busy = false;
9308
9674
  setBusy(false);
9309
9675
  setSavingAccount(true);
9310
9676
  setAccountSaveFailed(false);
9311
9677
  try {
9678
+ if (props.beforeAccountChange !== void 0) {
9679
+ owner.confirmation = save;
9680
+ setConfirmingAccount(true);
9681
+ const approved = await props.beforeAccountChange(accountId, controller.signal);
9682
+ if (!owner.active || owner.generation !== generation || owner.save !== save || controller.signal.aborted) return;
9683
+ if (approved !== true) return;
9684
+ const snapshot = await props.sessionAccount.get();
9685
+ if (!owner.active || owner.generation !== generation || owner.save !== save || controller.signal.aborted) return;
9686
+ const selection = snapshot.ok ? SessionAccountViewSchema.safeParse(snapshot.value) : void 0;
9687
+ if (!selection?.success || selection.data.accounts.revision === void 0) {
9688
+ setAccountSaveFailed(true);
9689
+ setView(void 0);
9690
+ setAccounts(void 0);
9691
+ setSessionAccount(void 0);
9692
+ return;
9693
+ }
9694
+ revision = selection.data.accounts.revision;
9695
+ setSessionAccount(selection.data);
9696
+ setAccounts(selection.data.accounts);
9697
+ setView(void 0);
9698
+ owner.confirmation = void 0;
9699
+ setConfirmingAccount(false);
9700
+ }
9312
9701
  const result = await props.sessionAccount.set(accountId, revision);
9313
9702
  if (!owner.active || owner.generation !== generation) return;
9314
9703
  const parsed = result.ok ? SessionAccountViewSchema.safeParse(result.value) : void 0;
@@ -9326,6 +9715,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9326
9715
  owner.save = void 0;
9327
9716
  setSavingAccount(false);
9328
9717
  await load(false);
9718
+ if (owner.active && owner.generation === generation + 1) switchButton.current?.focus();
9329
9719
  } catch {
9330
9720
  if (owner.active && owner.generation === generation) {
9331
9721
  setAccountSaveFailed(true);
@@ -9334,9 +9724,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9334
9724
  setSessionAccount(void 0);
9335
9725
  }
9336
9726
  } finally {
9727
+ if (owner.controller === controller) owner.controller = void 0;
9337
9728
  if (owner.active && owner.save === save) {
9338
9729
  owner.save = void 0;
9730
+ owner.confirmation = void 0;
9339
9731
  setSavingAccount(false);
9732
+ setConfirmingAccount(false);
9340
9733
  }
9341
9734
  }
9342
9735
  };
@@ -9373,7 +9766,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9373
9766
  close(true);
9374
9767
  }
9375
9768
  if (event.key === "Tab" && panel.current?.contains(document.activeElement)) {
9376
- const buttons = Array.from(panel.current.querySelectorAll("button:not(:disabled),a[href],summary"));
9769
+ const buttons = Array.from(panel.current.querySelectorAll("button:not(:disabled),a[href],summary,input:not(:disabled),select:not(:disabled),textarea:not(:disabled)"));
9377
9770
  const target = event.shiftKey ? buttons.at(-1) : buttons[0];
9378
9771
  const edge = event.shiftKey ? buttons[0] : buttons.at(-1);
9379
9772
  if (document.activeElement === edge) {
@@ -9390,7 +9783,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9390
9783
  };
9391
9784
  }, [open, close]);
9392
9785
  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);
9786
+ const unknownSavedAccounts = (open && choosingAccount ? sessionAccount?.accounts.accounts ?? [] : []).filter((account) => account.configured && account.id !== "canonical" && account.identity === void 0);
9394
9787
  const numberedUnknownAccounts = unknownSavedAccounts.length > 1 ? new Map(unknownSavedAccounts.map((account, index) => [account.id, index + 1])) : /* @__PURE__ */ new Map();
9395
9788
  const knownUnits = view?.billing === "credits" || view?.billing === "requests";
9396
9789
  const numbers = available && knownUnits;
@@ -9412,7 +9805,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9412
9805
  ].filter(Boolean).join(" · ")}${used === void 0 && remaining === void 0 ? ` · ${busy ? t.loading : t.unavailable}` : ""}`;
9413
9806
  const observed = available ? dateLabel(view.observedAt, language) : void 0;
9414
9807
  const reset = available && view.resetAt !== void 0 && view.observedAt !== void 0 && view.resetAt > view.observedAt ? dateLabel(view.resetAt, language) : void 0;
9415
- const runningIdentity = sessionAccount?.accounts.accounts.find((account) => account.id === sessionAccount.runningAccountId)?.identity;
9808
+ const currentIdentity = accountIdentityLabel(accounts) ?? t.identityUnavailable;
9809
+ const runningIdentity = sessionAccount?.runningAccountId === void 0 ? void 0 : accountIdentityLabel({
9810
+ ...sessionAccount.accounts,
9811
+ activeAccountId: sessionAccount.runningAccountId
9812
+ });
9813
+ const accountOptions = open && choosingAccount && sessionAccount ? [{
9814
+ id: null,
9815
+ label: t.followGlobal,
9816
+ selected: sessionAccount.source === "global"
9817
+ }, ...sessionAccount.accounts.accounts.filter((account) => account.configured).map((account) => ({
9818
+ id: account.id,
9819
+ label: account.identity ? `@${account.identity.login}` : account.id === "canonical" ? `${t.originalAuthorization} · ${t.identityUnknown}` : `${t.savedAuthorization}${numberedUnknownAccounts.has(account.id) ? ` ${numberedUnknownAccounts.get(account.id)}` : ""} · ${t.identityUnknown}`,
9820
+ selected: sessionAccount.source === "session" && sessionAccount.accountId === account.id
9821
+ }))] : [];
9416
9822
  return (0, react.createElement)("span", { style: {
9417
9823
  display: "inline-flex",
9418
9824
  minWidth: 0,
@@ -9427,7 +9833,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9427
9833
  "aria-expanded": open,
9428
9834
  "aria-controls": open ? id : void 0,
9429
9835
  onClick: () => {
9430
- setOpen((value) => !value);
9836
+ if (open) close();
9837
+ else setOpen(true);
9431
9838
  },
9432
9839
  style: {
9433
9840
  ...button,
@@ -9453,7 +9860,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9453
9860
  "aria-labelledby": `${id}-title`,
9454
9861
  "aria-describedby": `${id}-scope`,
9455
9862
  popover: "manual",
9863
+ "data-copilot-usage-panel": "",
9456
9864
  style: {
9865
+ colorScheme: "light dark",
9457
9866
  position: "fixed",
9458
9867
  inset: "auto",
9459
9868
  margin: 0,
@@ -9476,13 +9885,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9476
9885
  boxShadow: "0 8px 32px color-mix(in srgb, CanvasText 16%, transparent)",
9477
9886
  overflowWrap: "anywhere"
9478
9887
  }
9479
- }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("div", null, (0, react.createElement)("strong", { id: `${id}-title` }, view?.billing === "credits" ? t.title : unit), (0, react.createElement)("p", {
9888
+ }, (0, react.createElement)("style", null, formStyles), (0, react.createElement)("div", { style: row }, (0, react.createElement)("div", null, (0, react.createElement)("strong", { id: `${id}-title` }, view?.billing === "credits" ? t.title : unit), (0, react.createElement)("p", {
9480
9889
  style: {
9481
9890
  ...muted,
9482
9891
  color: "inherit"
9483
9892
  },
9484
9893
  "data-copilot-credits-account": ""
9485
- }, accountIdentityLabel(accounts) ?? t.identityUnavailable), props.sessionAccount === void 0 ? null : (0, react.createElement)("p", {
9894
+ }, currentIdentity), props.sessionAccount === void 0 ? null : (0, react.createElement)("p", {
9486
9895
  style: muted,
9487
9896
  "data-copilot-account-source": ""
9488
9897
  }, sessionAccount === void 0 ? busy ? t.accountLoading : t.accountMissing : sessionAccount.source === "global" ? t.followGlobal : t.sessionSpecified), (0, react.createElement)("p", {
@@ -9496,50 +9905,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9496
9905
  onClick: () => {
9497
9906
  close(true);
9498
9907
  }
9499
- }, "×")), 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", {
9500
- type: "button",
9501
- style: {
9908
+ }, "×")), props.sessionAccount === void 0 ? null : (0, react.createElement)("div", { style: separator }, (0, react.createElement)("div", { style: row }, (0, react.createElement)("p", { style: muted }, t.switchScope), (0, react.createElement)(AccountDropdown, {
9909
+ triggerRef: switchButton,
9910
+ triggerStyle: {
9502
9911
  ...button,
9503
9912
  flexShrink: 0
9504
9913
  },
9914
+ label: t.switchAccount,
9915
+ open: choosingAccount,
9916
+ busy: savingAccount,
9917
+ maxHeight: 220,
9505
9918
  disabled: sessionAccount === void 0 || sessionAccount.accounts.revision === void 0 || busy || savingAccount,
9506
- "aria-expanded": choosingAccount,
9507
- onClick: () => setChoosingAccount((value) => !value)
9508
- }, 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", {
9509
- role: "group",
9510
- "aria-label": t.switchAccount,
9511
- style: {
9512
- display: "grid",
9513
- gap: 6,
9514
- marginTop: 10
9515
- }
9516
- }, (0, react.createElement)("button", {
9517
- type: "button",
9518
- style: {
9519
- ...button,
9520
- textAlign: "left"
9919
+ onOpenChange: (next) => {
9920
+ if (!next) collapseAccounts();
9921
+ else setChoosingAccount(true);
9521
9922
  },
9522
- disabled: savingAccount,
9523
- "aria-pressed": sessionAccount.source === "global",
9524
- onClick: () => {
9525
- chooseAccount(null);
9526
- }
9527
- }, t.followGlobal), ...sessionAccount.accounts.accounts.filter((account) => account.configured).map((account) => (0, react.createElement)("button", {
9528
- key: account.id,
9529
- type: "button",
9530
- style: {
9531
- ...button,
9532
- textAlign: "left"
9923
+ options: accountOptions.map((option) => ({
9924
+ ...option,
9925
+ id: option.id ?? "follow-global"
9926
+ })),
9927
+ onSelect: (accountId) => {
9928
+ chooseAccount(accountId === "follow-global" ? null : accountId);
9533
9929
  },
9534
- disabled: savingAccount,
9535
- "aria-pressed": sessionAccount.source === "session" && sessionAccount.accountId === account.id,
9536
- onClick: () => {
9537
- chooseAccount(account.id);
9538
- }
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", {
9930
+ listAttribute: "data-copilot-account-options",
9931
+ footer: props.accountActions
9932
+ })), sessionAccount?.runningAccountId === void 0 ? null : (0, react.createElement)("p", { style: muted }, `${t.runningAccount}: ${runningIdentity ?? t.identityUnknown} · ${t.nextAccount}: ${currentIdentity}`), savingAccount ? (0, react.createElement)("p", {
9933
+ role: "status",
9934
+ style: muted
9935
+ }, confirmingAccount ? t.confirmingAccount : t.savingAccount) : null, sessionAccount?.accounts.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, sessionAccount.accounts.diagnostic), accountFailed || accountSaveFailed ? (0, react.createElement)("p", {
9540
9936
  role: "alert",
9541
9937
  style: muted
9542
- }, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), view?.state === "stale" ? (0, react.createElement)("p", {
9938
+ }, accountSaveFailed ? t.accountSaveFailed : t.accountMissing) : null), props.continuation, view?.state === "stale" ? (0, react.createElement)("p", {
9543
9939
  role: "status",
9544
9940
  style: muted
9545
9941
  }, t.stale) : null, view?.diagnostic === void 0 ? null : (0, react.createElement)("code", { style: muted }, view.diagnostic), props.remote === void 0 ? (0, react.createElement)("p", {
@@ -9605,7 +10001,414 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9605
10001
  }, t.plan), (0, react.createElement)("details", { style: muted }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, t.manual), (0, react.createElement)("code", { style: {
9606
10002
  userSelect: "all",
9607
10003
  overflowWrap: "anywhere"
9608
- } }, "https://github.com/settings/copilot"))) : null);
10004
+ } }, "https://github.com/settings/copilot")), props.onManage === void 0 ? null : (0, react.createElement)("div", { style: {
10005
+ ...separator,
10006
+ display: "grid",
10007
+ gap: 6
10008
+ } }, (0, react.createElement)("button", {
10009
+ type: "button",
10010
+ role: "link",
10011
+ style: {
10012
+ ...button,
10013
+ border: "none",
10014
+ background: "transparent",
10015
+ textAlign: "left",
10016
+ textDecoration: "underline",
10017
+ padding: 0,
10018
+ color: "inherit",
10019
+ cursor: "pointer"
10020
+ },
10021
+ onClick: () => {
10022
+ if (props.onManage !== void 0) {
10023
+ close();
10024
+ props.onManage();
10025
+ }
10026
+ }
10027
+ }, t.manage))) : null);
10028
+ }
10029
+ //#endregion
10030
+ //#region lib/types/composer-notice-style.js
10031
+ const composerNoticeStyle = {
10032
+ width: "100%",
10033
+ minWidth: 0,
10034
+ maxWidth: "var(--dsh-composer-card-max-width, 100%)",
10035
+ marginInline: "auto",
10036
+ boxSizing: "border-box",
10037
+ fontFamily: "var(--dsw-font-family, inherit)",
10038
+ fontSize: "var(--dsh-content-font-size-secondary, 13px)",
10039
+ fontWeight: 400,
10040
+ lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
10041
+ color: "var(--dsw-alias-label-secondary, GrayText)",
10042
+ overflowWrap: "anywhere"
10043
+ };
10044
+ const composerNoticeSurfaceStyle = {
10045
+ ...composerNoticeStyle,
10046
+ padding: "10px 12px",
10047
+ borderRadius: "var(--dsw-radius-md, 8px)",
10048
+ background: "var(--dsw-alias-interactive-bg-hover, transparent)"
10049
+ };
10050
+ const composerNoticeParagraphStyle = {
10051
+ marginBlock: 8,
10052
+ maxWidth: "38rem"
10053
+ };
10054
+ const composerNoticeButtonStyle = {
10055
+ fontFamily: "inherit",
10056
+ fontSize: "inherit",
10057
+ fontWeight: "inherit",
10058
+ lineHeight: "inherit",
10059
+ color: "var(--dsw-alias-label-primary, CanvasText)",
10060
+ maxWidth: "100%",
10061
+ background: "transparent",
10062
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
10063
+ borderRadius: 6,
10064
+ padding: "6px 10px",
10065
+ cursor: "pointer"
10066
+ };
10067
+ //#endregion
10068
+ //#region lib/types/session-continuation-ui.js
10069
+ const control = {
10070
+ font: "inherit",
10071
+ color: "var(--dsw-alias-label-primary, CanvasText)",
10072
+ background: "var(--dsw-alias-bg-layer-1, Canvas)",
10073
+ colorScheme: "inherit",
10074
+ border: "1px solid var(--dsw-alias-border-main, GrayText)",
10075
+ borderRadius: 6,
10076
+ padding: "6px 10px"
10077
+ };
10078
+ const paragraph = {
10079
+ color: "var(--dsw-alias-label-secondary, GrayText)",
10080
+ fontSize: 13,
10081
+ lineHeight: 1.5
10082
+ };
10083
+ function SessionContinuationCard({ sessionId, remote, locale = "en", running = false, onEnabledChange, expanded = false, recovery = false, onCancel }) {
10084
+ const zh = locale.startsWith("zh");
10085
+ const body = recovery ? composerNoticeParagraphStyle : paragraph;
10086
+ const button = recovery ? composerNoticeButtonStyle : control;
10087
+ const [view, setView] = (0, react.useState)();
10088
+ const [busy, setBusy] = (0, react.useState)(false);
10089
+ const [error, setError] = (0, react.useState)(false);
10090
+ const [reload, setReload] = (0, react.useState)(0);
10091
+ const owner = (0, react.useRef)(0);
10092
+ (0, react.useEffect)(() => {
10093
+ onEnabledChange?.(view?.enabled === true || view?.activeTurnEnabled === true);
10094
+ }, [view, onEnabledChange]);
10095
+ (0, react.useEffect)(() => {
10096
+ const generation = ++owner.current;
10097
+ setView(void 0);
10098
+ setBusy(true);
10099
+ setError(false);
10100
+ (async () => {
10101
+ try {
10102
+ const result = await remote?.get(sessionId);
10103
+ const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10104
+ if (owner.current !== generation) return;
10105
+ if (!parsed?.success) setError(true);
10106
+ else setView(parsed.data);
10107
+ } catch {
10108
+ if (owner.current === generation) setError(true);
10109
+ } finally {
10110
+ if (owner.current === generation) setBusy(false);
10111
+ }
10112
+ })();
10113
+ return () => {
10114
+ owner.current++;
10115
+ };
10116
+ }, [
10117
+ remote,
10118
+ sessionId,
10119
+ running,
10120
+ reload
10121
+ ]);
10122
+ const save = async (enabled) => {
10123
+ if (!view || !remote || busy || recovery && running) return;
10124
+ const generation = owner.current;
10125
+ setBusy(true);
10126
+ setError(false);
10127
+ try {
10128
+ const result = await remote.set(sessionId, view.revision, enabled);
10129
+ const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10130
+ if (owner.current !== generation) return;
10131
+ if (!parsed?.success || enabled !== null && parsed.data.enabled !== enabled) {
10132
+ setView(void 0);
10133
+ setError(true);
10134
+ } else setView(parsed.data);
10135
+ } catch {
10136
+ if (owner.current === generation) {
10137
+ setView(void 0);
10138
+ setError(true);
10139
+ }
10140
+ } finally {
10141
+ if (owner.current === generation) setBusy(false);
10142
+ }
10143
+ };
10144
+ const loss = (0, react.createElement)("p", { style: body }, zh ? "每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用。可见消息、工具记录和磁盘历史不变;可能失去隐含细节。不会自动发送或重试。" : "Every new turn omits old encrypted reasoning and embedded summaries, including on the same account. Visible messages, tool records and disk history stay unchanged; implicit details may be lost. No automatic sending or retries.");
10145
+ const unavailable = error ? (0, react.createElement)("p", {
10146
+ role: "alert",
10147
+ style: body
10148
+ }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10149
+ type: "button",
10150
+ style: button,
10151
+ disabled: busy || recovery && running,
10152
+ onClick: () => setReload((value) => value + 1)
10153
+ }, zh ? "重试读取" : "Retry read")) : null;
10154
+ if (recovery) return (0, react.createElement)("div", { "data-copilot-continuation-recovery": "" }, !view && !error ? (0, react.createElement)("p", {
10155
+ role: "status",
10156
+ style: body
10157
+ }, zh ? "正在读取降级续聊策略…" : "Reading continuation policy…") : null, view?.enabled ? (0, react.createElement)("p", {
10158
+ role: "status",
10159
+ style: body
10160
+ }, zh ? "本 Session 已开启降级续聊,请另行使用原生重试。如果仍被拒绝,请查看技术诊断或新建会话;不会重复授权或自动重试。" : "Continuation is already on for this Session; use native Retry separately. If rejection persists, review technical diagnostics or start a new conversation. No repeated authorization or automatic retry.") : view ? (0, react.createElement)("div", null, loss, (0, react.createElement)("p", { style: body }, zh ? "开启后在本 Session 持续生效,跨账号和重启保留,直到关闭。开启即同意上述损失;之后请另行使用原生重试。" : "Enabling applies to this Session across accounts and restarts until disabled. This consents to the loss above; use native Retry separately afterwards."), (0, react.createElement)("button", {
10161
+ type: "button",
10162
+ style: button,
10163
+ disabled: busy || running,
10164
+ onClick: () => void save(true)
10165
+ }, zh ? "开启降级续聊" : "Enable visible-history continuation")) : null, unavailable, (0, react.createElement)("button", {
10166
+ type: "button",
10167
+ style: button,
10168
+ disabled: busy || running,
10169
+ onClick: onCancel
10170
+ }, zh ? "取消" : "Cancel"));
10171
+ return (0, react.createElement)("details", {
10172
+ open: expanded || void 0,
10173
+ "data-copilot-continuation-settings": "",
10174
+ style: { fontSize: 13 }
10175
+ }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "降级续聊" : "Visible-history continuation", " · ", !view ? zh ? "状态待确认" : "Unknown" : view.enabled ? zh ? "开启" : "On" : view.nextTurnAuthorized ? zh ? "仅下一轮" : "Next turn only" : zh ? "关闭" : "Off"), loss, (0, react.createElement)("label", { style: {
10176
+ display: "flex",
10177
+ gap: 8,
10178
+ alignItems: "center",
10179
+ flexWrap: "wrap"
10180
+ } }, zh ? "本 Session 默认策略" : "Session policy", (0, react.createElement)("select", {
10181
+ style: control,
10182
+ disabled: busy || !view,
10183
+ value: view?.source === "default" ? "default" : view?.enabled ? "on" : "off",
10184
+ onChange: (event) => void save(event.currentTarget.value === "default" ? null : event.currentTarget.value === "on")
10185
+ }, [
10186
+ ["default", zh ? "沿用创建时默认" : "Use creation-time default"],
10187
+ ["on", zh ? "开启" : "On"],
10188
+ ["off", zh ? "关闭" : "Off"]
10189
+ ].map(([value, label]) => (0, react.createElement)("option", {
10190
+ key: value,
10191
+ value,
10192
+ style: {
10193
+ background: "Canvas",
10194
+ color: "CanvasText"
10195
+ }
10196
+ }, label)))), view?.activeTurnEnabled !== void 0 && view.activeTurnEnabled !== view.enabled ? (0, react.createElement)("p", {
10197
+ role: "status",
10198
+ style: paragraph
10199
+ }, zh ? "当前轮保持原策略,变更从下一轮生效。" : "The active turn keeps its policy; changes apply next turn.") : null, unavailable);
10200
+ }
10201
+ function ContinuationDefaultCard({ remote, locale = "en", onSaved }) {
10202
+ const zh = locale.startsWith("zh");
10203
+ const [view, setView] = (0, react.useState)();
10204
+ const [error, setError] = (0, react.useState)(false);
10205
+ const [busy, setBusy] = (0, react.useState)(false);
10206
+ const [reload, setReload] = (0, react.useState)(0);
10207
+ const lifetime = (0, react.useRef)(0);
10208
+ (0, react.useEffect)(() => {
10209
+ const generation = ++lifetime.current;
10210
+ setBusy(true);
10211
+ setError(false);
10212
+ setView(void 0);
10213
+ (async () => {
10214
+ try {
10215
+ const result = await remote?.defaults?.();
10216
+ const parsed = result?.ok ? ContinuationDefaultViewSchema.safeParse(result.value) : void 0;
10217
+ if (generation !== lifetime.current) return;
10218
+ if (parsed?.success) setView(parsed.data);
10219
+ else setError(true);
10220
+ } catch {
10221
+ if (generation === lifetime.current) setError(true);
10222
+ } finally {
10223
+ if (generation === lifetime.current) setBusy(false);
10224
+ }
10225
+ })();
10226
+ return () => {
10227
+ lifetime.current++;
10228
+ };
10229
+ }, [remote, reload]);
10230
+ const save = async (enabled) => {
10231
+ if (!view || !remote?.setDefault || busy) return;
10232
+ const generation = lifetime.current;
10233
+ setBusy(true);
10234
+ setError(false);
10235
+ try {
10236
+ const result = await remote.setDefault(view.revision, enabled);
10237
+ const parsed = result.ok ? ContinuationDefaultViewSchema.safeParse(result.value) : void 0;
10238
+ if (generation !== lifetime.current) return;
10239
+ if (parsed?.success) {
10240
+ setView(parsed.data);
10241
+ onSaved?.();
10242
+ } else {
10243
+ setView(void 0);
10244
+ setError(true);
10245
+ }
10246
+ } catch {
10247
+ if (generation === lifetime.current) {
10248
+ setView(void 0);
10249
+ setError(true);
10250
+ }
10251
+ } finally {
10252
+ if (generation === lifetime.current) setBusy(false);
10253
+ }
10254
+ };
10255
+ return (0, react.createElement)("details", null, (0, react.createElement)("summary", null, zh ? "新 Session 降级默认" : "New Session continuation default"), (0, react.createElement)("label", null, (0, react.createElement)("input", {
10256
+ type: "checkbox",
10257
+ checked: view?.enabled ?? false,
10258
+ disabled: busy || !view,
10259
+ onChange: (event) => void save(event.currentTarget.checked)
10260
+ }), zh ? "新 Session 默认开启降级续聊" : "Enable visible-history continuation for new Sessions"), (0, react.createElement)("p", { style: paragraph }, zh ? "开启即同意新 Session 每轮省略旧加密推理及内嵌摘要,同账号也适用。已有 Session 和继承历史不自动授权,不修改消息或工具记录。" : "Enabling consents to omitting prior encrypted reasoning and embedded summaries each turn, even on the same account. Existing Sessions and seeded histories are not automatically enrolled. Messages and tools are unchanged."), error ? (0, react.createElement)("p", { role: "alert" }, "COPILOT_CONTINUATION_STATUS_UNAVAILABLE", (0, react.createElement)("button", {
10261
+ type: "button",
10262
+ style: control,
10263
+ onClick: () => setReload((value) => value + 1)
10264
+ }, zh ? "重试" : "Retry")) : null);
10265
+ }
10266
+ function SwitchConfirmation({ consent, sessionId, remote, locale, done, cancel }) {
10267
+ const zh = locale.startsWith("zh");
10268
+ const [busy, setBusy] = (0, react.useState)(false);
10269
+ const [error, setError] = (0, react.useState)(false);
10270
+ const active = (0, react.useRef)(true);
10271
+ (0, react.useEffect)(() => {
10272
+ active.current = true;
10273
+ return () => {
10274
+ active.current = false;
10275
+ consent.resolve(false);
10276
+ cancel();
10277
+ };
10278
+ }, [consent]);
10279
+ const choose = async (choice) => {
10280
+ if (busy) return;
10281
+ if (choice === "off") {
10282
+ done(true);
10283
+ return;
10284
+ }
10285
+ setBusy(true);
10286
+ setError(false);
10287
+ try {
10288
+ const result = await remote.set(sessionId, consent.view.revision, true);
10289
+ const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10290
+ if (!active.current) return;
10291
+ if (!parsed?.success || !parsed.data.enabled) setError(true);
10292
+ else done(true);
10293
+ } catch {
10294
+ if (active.current) setError(true);
10295
+ } finally {
10296
+ if (active.current) setBusy(false);
10297
+ }
10298
+ };
10299
+ return (0, react.createElement)("section", {
10300
+ role: "group",
10301
+ "aria-label": zh ? "切换账号前确认" : "Before switching accounts",
10302
+ style: {
10303
+ border: control.border,
10304
+ borderRadius: 6,
10305
+ padding: 10,
10306
+ marginBlock: 10
10307
+ }
10308
+ }, (0, react.createElement)("strong", null, zh ? "此 Session 的降级续聊未开启" : "Continuation is off for this Session"), (0, react.createElement)("p", { style: paragraph }, zh ? "切换账号后,旧加密推理可能被拒绝,但不一定失败。降级每轮省略旧推理及内嵌摘要,保留可见消息与工具记录;可能损失隐含细节。开启后持续生效,直到关闭。不会自动重试。" : "After switching, old encrypted reasoning may be rejected; failure is not certain. Continuation omits old reasoning and embedded summaries each turn while keeping visible messages and tools. Implicit details may be lost. Enabling persists until disabled. No automatic retry."), (0, react.createElement)("div", { style: {
10309
+ display: "flex",
10310
+ flexWrap: "wrap",
10311
+ gap: 8
10312
+ } }, (0, react.createElement)("button", {
10313
+ type: "button",
10314
+ style: control,
10315
+ disabled: busy,
10316
+ onClick: () => void choose("session")
10317
+ }, zh ? "持续开启并切换" : "Enable for Session and switch"), (0, react.createElement)("button", {
10318
+ type: "button",
10319
+ style: control,
10320
+ disabled: busy,
10321
+ onClick: () => void choose("off")
10322
+ }, zh ? "保持关闭并切换" : "Keep off and switch"), (0, react.createElement)("button", {
10323
+ type: "button",
10324
+ style: control,
10325
+ disabled: busy,
10326
+ onClick: () => done(false)
10327
+ }, zh ? "取消" : "Cancel")), error ? (0, react.createElement)("p", {
10328
+ role: "alert",
10329
+ style: paragraph
10330
+ }, zh ? "授权保存未确认,账号未切换。取消后重新读取状态再试。" : "Authorization was not confirmed; account not switched. Cancel and read current status before trying again.") : null);
10331
+ }
10332
+ function useSessionContinuationSwitch({ sessionId, remote, locale = "en", changesAccount, running = false }) {
10333
+ const [consent, setConsent] = (0, react.useState)();
10334
+ const pending = (0, react.useRef)();
10335
+ const generation = (0, react.useRef)(0);
10336
+ (0, react.useEffect)(() => {
10337
+ setConsent(void 0);
10338
+ return () => {
10339
+ generation.current++;
10340
+ pending.current?.resolve(false);
10341
+ pending.current = void 0;
10342
+ };
10343
+ }, [sessionId, remote]);
10344
+ const beforeAccountChange = (0, react.useCallback)(async (accountId, signal) => {
10345
+ const owner = generation.current;
10346
+ if (signal?.aborted) return false;
10347
+ const changed = await changesAccount(accountId);
10348
+ if (owner !== generation.current || signal?.aborted) return false;
10349
+ if (!changed) return true;
10350
+ const result = await remote?.get(sessionId);
10351
+ if (owner !== generation.current || signal?.aborted) return false;
10352
+ const parsed = result?.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
10353
+ if (!parsed?.success) throw new Error("COPILOT_CONTINUATION_STATUS_UNAVAILABLE");
10354
+ if (parsed.data.enabled || parsed.data.nextTurnAuthorized) return true;
10355
+ pending.current?.resolve(false);
10356
+ return new Promise((resolve) => {
10357
+ let settled = false;
10358
+ const next = {
10359
+ view: parsed.data,
10360
+ resolve: (approved) => {
10361
+ if (settled) return;
10362
+ settled = true;
10363
+ signal?.removeEventListener("abort", abort);
10364
+ resolve(approved);
10365
+ }
10366
+ };
10367
+ const abort = () => {
10368
+ next.resolve(false);
10369
+ if (pending.current === next) {
10370
+ pending.current = void 0;
10371
+ setConsent(void 0);
10372
+ }
10373
+ };
10374
+ pending.current = next;
10375
+ signal?.addEventListener("abort", abort, { once: true });
10376
+ if (signal?.aborted) {
10377
+ abort();
10378
+ return;
10379
+ }
10380
+ setConsent(next);
10381
+ });
10382
+ }, [
10383
+ remote,
10384
+ sessionId,
10385
+ changesAccount
10386
+ ]);
10387
+ const done = (approved) => {
10388
+ const current = pending.current;
10389
+ pending.current = void 0;
10390
+ current?.resolve(approved);
10391
+ setConsent(void 0);
10392
+ };
10393
+ return {
10394
+ beforeAccountChange,
10395
+ content: (0, react.createElement)(react.Fragment, null, consent && remote ? (0, react.createElement)(SwitchConfirmation, {
10396
+ key: consent.view.revision,
10397
+ consent,
10398
+ sessionId,
10399
+ remote,
10400
+ locale,
10401
+ done,
10402
+ cancel: () => {
10403
+ if (pending.current === consent) done(false);
10404
+ }
10405
+ }) : null, (0, react.createElement)(SessionContinuationCard, {
10406
+ sessionId,
10407
+ remote,
10408
+ locale,
10409
+ running
10410
+ }))
10411
+ };
9609
10412
  }
9610
10413
  //#endregion
9611
10414
  //#region lib/types/copilot-usage-ui.js
@@ -9624,6 +10427,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9624
10427
  function isSessionRemote(value) {
9625
10428
  return record$2(value) && typeof value.get === "function" && typeof value.set === "function" && typeof value.refreshIdentity === "function" && typeof value.ensureIdentity === "function" && typeof value.usage === "function" && typeof value.refreshUsage === "function";
9626
10429
  }
10430
+ function isContinuationRemote(value) {
10431
+ return record$2(value) && typeof value.get === "function" && typeof value.set === "function" && (value.authorizeNext === void 0 || typeof value.authorizeNext === "function") && (value.defaults === void 0 || typeof value.defaults === "function") && (value.setDefault === void 0 || typeof value.setDefault === "function");
10432
+ }
9627
10433
  function isLocale$2(value) {
9628
10434
  return record$2(value) && typeof value.getLocale === "function" && typeof value.subscribe === "function";
9629
10435
  }
@@ -9644,11 +10450,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9644
10450
  if (!selection(next)) return void 0;
9645
10451
  return next.provider === "github-copilot" || next.provider === "github-copilot-preview" ? next : void 0;
9646
10452
  }
9647
- function Surface$2({ runtime, remote, accountsRemote, sessionRemote, locale, diagnostic }) {
10453
+ function Surface$2({ runtime, remote, accountsRemote, addRemote, sessionRemote, continuationRemote, locale, diagnostic }) {
9648
10454
  const valid = runtime.useSession((session) => record$2(session) && session.sessionId === runtime.sessionId && session.removed === false && session.openState === "open");
9649
10455
  const projection = runtime.useProjection("modelSelection");
10456
+ const running = runtime.useSession((value) => !record$2(value) || value.running !== false);
9650
10457
  const language = (0, react.useSyncExternalStore)(locale === void 0 ? emptySubscribe : (listener) => locale.subscribe(listener), () => locale?.getLocale().active ?? "en", () => "en");
9651
10458
  const current = effectiveCopilot(projection);
10459
+ const changesAccount = (0, react.useCallback)(async (accountId) => {
10460
+ const result = await sessionRemote?.get(runtime.sessionId);
10461
+ const parsed = result?.ok ? SessionAccountViewSchema.safeParse(result.value) : void 0;
10462
+ if (!parsed?.success) throw new Error("COPILOT_SESSION_ACCOUNTS_REMOTE_UNAVAILABLE");
10463
+ return (accountId ?? parsed.data.globalAccountId) !== parsed.data.accountId;
10464
+ }, [sessionRemote, runtime.sessionId]);
10465
+ const continuation = useSessionContinuationSwitch({
10466
+ sessionId: runtime.sessionId,
10467
+ remote: continuationRemote,
10468
+ locale: language,
10469
+ changesAccount,
10470
+ running
10471
+ });
10472
+ const added = (0, react.useCallback)(() => {
10473
+ accountPresentationChanges.begin()();
10474
+ }, []);
9652
10475
  const bound = (0, react.useMemo)(() => {
9653
10476
  if (sessionRemote === void 0) return void 0;
9654
10477
  const id = runtime.sessionId;
@@ -9701,7 +10524,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9701
10524
  remote: current.provider === "github-copilot-preview" ? bound?.usage : remote,
9702
10525
  accountsRemote: current.provider === "github-copilot-preview" ? bound?.identity : accountsRemote,
9703
10526
  sessionAccount: current.provider === "github-copilot-preview" ? bound?.account : void 0,
9704
- locale: language
10527
+ locale: language,
10528
+ continuation: current.provider === "github-copilot-preview" ? continuation.content : void 0,
10529
+ beforeAccountChange: current.provider === "github-copilot-preview" ? continuation.beforeAccountChange : void 0,
10530
+ accountActions: current.provider === "github-copilot-preview" ? (0, react.createElement)(CopilotAccountAdd, {
10531
+ remote: addRemote,
10532
+ locale: language,
10533
+ onChanged: added
10534
+ }) : void 0
9705
10535
  });
9706
10536
  }
9707
10537
  /** Public additive dock only; native composer, ContextMeter and other features stay owned by Core. */
@@ -9722,6 +10552,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9722
10552
  let remote;
9723
10553
  let accountsRemote;
9724
10554
  let sessionRemote;
10555
+ let continuationRemote;
10556
+ let addRemote;
9725
10557
  try {
9726
10558
  const namespaces = ctx.remote;
9727
10559
  const face = record$2(namespaces) ? namespaces.githubCopilotUsage : void 0;
@@ -9730,9 +10562,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9730
10562
  const accounts = record$2(namespaces) ? namespaces.githubCopilotAccounts : void 0;
9731
10563
  if (record$2(accounts) && typeof accounts.get === "function" && typeof accounts.refreshIdentity === "function" && typeof accounts.ensureIdentity === "function") accountsRemote = accounts;
9732
10564
  else diagnostic("COPILOT_ACCOUNTS_REMOTE_UNAVAILABLE");
10565
+ if (record$2(accounts) && typeof accounts.get === "function" && typeof accounts.add === "function" && typeof accounts.cancel === "function") addRemote = accounts;
10566
+ else diagnostic("COPILOT_ACCOUNT_ADD_REMOTE_UNAVAILABLE");
9733
10567
  const session = record$2(namespaces) ? namespaces.githubCopilotSessionAccount : void 0;
9734
10568
  if (isSessionRemote(session)) sessionRemote = session;
9735
10569
  else diagnostic("COPILOT_SESSION_ACCOUNTS_REMOTE_UNAVAILABLE");
10570
+ const continuation = record$2(namespaces) ? namespaces.githubCopilotSessionContinuation : void 0;
10571
+ if (isContinuationRemote(continuation)) continuationRemote = continuation;
10572
+ else diagnostic("COPILOT_CONTINUATION_REMOTE_UNAVAILABLE");
9736
10573
  } catch {
9737
10574
  diagnostic("COPILOT_USAGE_REMOTE_UNAVAILABLE");
9738
10575
  }
@@ -9764,7 +10601,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9764
10601
  runtime: props,
9765
10602
  remote,
9766
10603
  accountsRemote,
10604
+ addRemote,
9767
10605
  sessionRemote,
10606
+ continuationRemote,
9768
10607
  locale,
9769
10608
  diagnostic
9770
10609
  });
@@ -9827,37 +10666,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9827
10666
  reasoningTokens: count.optional()
9828
10667
  });
9829
10668
  //#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
9861
10669
  //#region lib/types/context-evidence-ui.js
9862
10670
  const slot = "conversation.input.dock";
9863
10671
  const noop$1 = () => {};
@@ -9875,7 +10683,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9875
10683
  }
9876
10684
  const copy = {
9877
10685
  en: {
9878
- title: "Context reading unavailable",
10686
+ title: "Context unknown · native 0% is not an empty-context reading",
9879
10687
  explanation: "A failed Copilot attempt reported zero usage. The native 0% is not evidence of an empty context.",
9880
10688
  sample: "Last valid input sample (including cache)",
9881
10689
  historical: "Historical sample, not current occupancy. No percentage is inferred.",
@@ -9884,7 +10692,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9884
10692
  unknown: "Context sampling evidence is incomplete. No current occupancy can be inferred."
9885
10693
  },
9886
10694
  zh: {
9887
- title: "上下文读数暂不可用",
10695
+ title: "上下文未知 · 原生 0% 不代表上下文为空",
9888
10696
  explanation: "失败的 Copilot 请求记录了零用量。原生 0% 不代表上下文为空。",
9889
10697
  sample: "最后有效输入采样(含缓存)",
9890
10698
  historical: "这是历史采样,不是当前占用;不会据此推算百分比。",
@@ -9975,19 +10783,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9975
10783
  function record(value) {
9976
10784
  return value !== null && typeof value === "object" && !Array.isArray(value);
9977
10785
  }
9978
- function ReplayRecoveryCard({ sessionId, remote, locale = "en", running = false, refreshKey = "" }) {
10786
+ function ReplayRecoveryCard({ sessionId, remote, continuation, locale = "en", running = false, refreshKey = "" }) {
9979
10787
  const zh = locale.startsWith("zh");
9980
- const durationName = (0, react.useId)();
9981
10788
  const [view, setView] = (0, react.useState)();
9982
10789
  const [busy, setBusy] = (0, react.useState)(false);
9983
10790
  const [error, setError] = (0, react.useState)(false);
9984
- const [confirm, setConfirm] = (0, react.useState)(false);
9985
- const [duration, setDuration] = (0, react.useState)("next-turn");
9986
10791
  const [dismissed, setDismissed] = (0, react.useState)();
9987
10792
  const [hadEvidence, setHadEvidence] = (0, react.useState)(false);
9988
- const latest = (0, react.useRef)(view);
9989
10793
  const active = (0, react.useRef)(running);
9990
- latest.current = view;
9991
10794
  active.current = running;
9992
10795
  const pending = (0, react.useRef)(false);
9993
10796
  const refreshPending = (0, react.useRef)(false);
@@ -9998,19 +10801,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9998
10801
  mounted.current = false;
9999
10802
  };
10000
10803
  }, []);
10001
- const perform = (0, react.useCallback)(async (authorization) => {
10804
+ const perform = (0, react.useCallback)(async () => {
10002
10805
  if (pending.current) {
10003
- if (authorization === void 0) refreshPending.current = true;
10806
+ refreshPending.current = true;
10004
10807
  return;
10005
10808
  }
10006
10809
  if (active.current) return;
10007
10810
  pending.current = true;
10008
10811
  setBusy(true);
10009
10812
  setError(false);
10010
- setConfirm(false);
10011
10813
  try {
10012
- const current = latest.current;
10013
- const result = authorization === void 0 ? await remote.get(sessionId) : current && current.state !== "unavailable" ? authorization === false ? await remote.setEnabled(sessionId, current.revision, false) : await remote.authorize(sessionId, current.revision, authorization) : void 0;
10814
+ const result = await remote.get(sessionId);
10014
10815
  const parsed = result?.ok ? ReplayRecoveryViewSchema.safeParse(result.value) : void 0;
10015
10816
  if (!mounted.current) return;
10016
10817
  if (parsed?.success) {
@@ -10037,7 +10838,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10037
10838
  }
10038
10839
  }, [remote, sessionId]);
10039
10840
  (0, react.useEffect)(() => {
10040
- setConfirm(false);
10041
10841
  if (!running) perform();
10042
10842
  }, [
10043
10843
  running,
@@ -10054,13 +10854,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10054
10854
  const disabled = busy || running;
10055
10855
  const evidence = view && view.state !== "unavailable" ? view : void 0;
10056
10856
  if (!error && !evidence && !hadEvidence) return null;
10057
- if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
10857
+ if (!error && evidence && dismissed === evidence.revision) return (0, react.createElement)("button", {
10058
10858
  type: "button",
10059
10859
  style: {
10060
10860
  ...button,
10061
10861
  ...composerNoticeStyle,
10062
10862
  width: "auto",
10063
- alignSelf: "flex-start",
10863
+ alignSelf: "center",
10064
10864
  color: button.color
10065
10865
  },
10066
10866
  disabled,
@@ -10070,70 +10870,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10070
10870
  "aria-label": zh ? "回放恢复" : "Replay recovery",
10071
10871
  "data-copilot-composer-notice": "replay",
10072
10872
  "aria-busy": busy,
10073
- style: {
10074
- ...composerNoticeStyle,
10075
- paddingBlock: 8
10076
- }
10873
+ style: composerNoticeSurfaceStyle
10077
10874
  }, (0, react.createElement)("strong", {
10078
10875
  role: "status",
10079
10876
  style: {
10080
10877
  color: "var(--dsw-alias-label-primary, CanvasText)",
10081
10878
  fontWeight: 600
10082
10879
  }
10083
- }, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10880
+ }, evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", {
10084
10881
  role: "alert",
10085
10882
  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", {
10087
- disabled,
10088
- style: {
10089
- border: 0,
10090
- padding: 0,
10091
- marginBlock: 12
10092
- }
10093
- }, (0, react.createElement)("legend", null, zh ? "授权范围" : "Authorization duration"), ...["next-turn", "session"].map((value) => (0, react.createElement)("label", {
10094
- key: value,
10095
- style: {
10096
- display: "block",
10097
- paddingBlock: 6
10098
- }
10099
- }, (0, react.createElement)("input", {
10100
- type: "radio",
10101
- name: durationName,
10102
- value,
10103
- checked: duration === value,
10104
- onChange: () => setDuration(value)
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: {
10106
- display: "flex",
10107
- flexWrap: "wrap",
10108
- gap: 8
10109
- } }, (0, react.createElement)("button", {
10110
- type: "button",
10111
- style: button,
10112
- disabled,
10113
- onClick: () => void perform(duration)
10114
- }, zh ? "接受损失并授权" : "Accept loss and authorize"), (0, react.createElement)("button", {
10115
- type: "button",
10116
- style: button,
10117
- disabled,
10118
- onClick: () => setConfirm(false)
10119
- }, zh ? "取消" : "Cancel"))) : (0, react.createElement)("div", { style: {
10120
- display: "flex",
10121
- flexWrap: "wrap",
10122
- gap: 8
10123
- } }, (0, react.createElement)("button", {
10124
- type: "button",
10125
- style: button,
10126
- disabled,
10127
- onClick: () => evidence.state === "enabled" ? void perform(false) : (setDuration("next-turn"), setConfirm(true))
10128
- }, evidence.state === "enabled" ? zh ? "关闭恢复" : "Disable recovery" : zh ? "查看恢复选项" : "Review recovery options"), evidence.state === "available" ? (0, react.createElement)("button", {
10129
- type: "button",
10130
- style: button,
10131
- disabled,
10132
- onClick: () => setDismissed(evidence.revision)
10133
- }, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", {
10883
+ }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? "失败证据已失效,没有当前可用的失败诊断。此状态不改变本 Session 的降级续聊策略。" : "Failure evidence expired; no current failure diagnostics are available. This does not change the Session continuation policy.") : null, evidence ? (0, react.createElement)("div", null, (0, react.createElement)(SessionContinuationCard, {
10884
+ key: evidence.revision,
10885
+ sessionId,
10886
+ remote: continuation,
10887
+ locale,
10888
+ running: running || busy,
10889
+ recovery: true,
10890
+ onCancel: () => setDismissed(evidence.revision)
10891
+ })) : null, running ? (0, react.createElement)("p", {
10134
10892
  role: "status",
10135
10893
  style: composerNoticeParagraphStyle
10136
- }, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("button", {
10894
+ }, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("details", { style: { marginTop: 8 } }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "技术详情与状态" : "Technical details and status"), evidence ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, zh ? `${evidence.model}:${evidence.itemCount} 条已识别的旧加密推理项;不是已证明无效的项数。` : `${evidence.model}: ${evidence.itemCount} identified old encrypted reasoning items; not a count of proven invalid items.`) : null, (0, react.createElement)("button", {
10137
10895
  type: "button",
10138
10896
  style: {
10139
10897
  ...button,
@@ -10141,7 +10899,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10141
10899
  },
10142
10900
  disabled,
10143
10901
  onClick: () => void perform()
10144
- }, busy ? zh ? "正在读取…" : "Reading…" : zh ? "重新读取状态" : "Read status again"));
10902
+ }, busy ? zh ? "正在读取…" : "Reading…" : zh ? "重新读取状态" : "Read status again")));
10145
10903
  }
10146
10904
  function isSlots(value) {
10147
10905
  return record(value) && typeof value.spec === "function" && typeof value.inject === "function" && typeof value.register === "function";
@@ -10152,7 +10910,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10152
10910
  function isRuntime(value) {
10153
10911
  return record(value) && typeof value.sessionId === "string" && value.sessionId !== "" && typeof value.useSession === "function" && typeof value.useProjection === "function";
10154
10912
  }
10155
- function Surface({ runtime, remote, locale }) {
10913
+ function Surface({ runtime, remote, continuation, locale }) {
10156
10914
  const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
10157
10915
  const selected = runtime.useProjection("modelSelection");
10158
10916
  const running = runtime.useSession((value) => !record(value) || value.running !== false);
@@ -10163,6 +10921,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10163
10921
  key: JSON.stringify([runtime.sessionId, selected.next.model]),
10164
10922
  sessionId: runtime.sessionId,
10165
10923
  remote,
10924
+ continuation,
10166
10925
  locale: language,
10167
10926
  running,
10168
10927
  refreshKey: lastError
@@ -10175,7 +10934,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10175
10934
  return noop;
10176
10935
  }
10177
10936
  const slots = candidate;
10178
- const remote = ctx.remote.githubCopilotReplayRecovery;
10937
+ let faces;
10179
10938
  const language = ctx.get("locale");
10180
10939
  const locale = isLocale(language) ? language : void 0;
10181
10940
  const name = "conversation.input.dock";
@@ -10185,6 +10944,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10185
10944
  ctx.logger.warn("COPILOT_REPLAY_RECOVERY_SLOT_UNAVAILABLE");
10186
10945
  return noop;
10187
10946
  }
10947
+ faces ??= {
10948
+ remote: ctx.remote.githubCopilotReplayRecovery,
10949
+ continuation: ctx.remote.githubCopilotSessionContinuation
10950
+ };
10951
+ const { remote, continuation } = faces;
10188
10952
  return slots.register({
10189
10953
  name,
10190
10954
  id: "github-copilot-replay-recovery",
@@ -10197,6 +10961,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10197
10961
  return (0, react.createElement)(Surface, {
10198
10962
  runtime: props,
10199
10963
  remote,
10964
+ continuation,
10200
10965
  locale
10201
10966
  });
10202
10967
  });
@@ -10209,7 +10974,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10209
10974
  background: "transparent",
10210
10975
  font: "inherit",
10211
10976
  fontSize: "14px",
10212
- border: "1px solid color-mix(in srgb, currentColor 30%, transparent)",
10977
+ border: "1px solid var(--dsw-alias-border-main, ButtonBorder)",
10978
+ colorScheme: "inherit",
10213
10979
  borderRadius: "8px",
10214
10980
  padding: "7px 12px",
10215
10981
  minHeight: "36px"
@@ -10256,6 +11022,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10256
11022
  props.remote
10257
11023
  ]);
10258
11024
  const available = models?.models ?? [];
11025
+ const availabilityKnown = models?.state === "ready";
10259
11026
  const settingsKnown = preferences !== void 0 && preferences.revision !== void 0;
10260
11027
  const excluded = new Set(preferences?.excludedModelIds ?? []);
10261
11028
  const diagnostic = error ?? preferences?.error ?? (preferences === void 0 ? "COPILOT_MODEL_PREFERENCES_UNAVAILABLE" : void 0);
@@ -10264,14 +11031,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10264
11031
  id: model.id,
10265
11032
  name: model.name,
10266
11033
  available: true
10267
- })), ...(preferences?.unavailableExcludedModelIds ?? []).filter((id) => !available.some((model) => model.id === id)).map((id) => ({
11034
+ })), ...Array.from(/* @__PURE__ */ new Set([...preferences?.excludedModelIds ?? [], ...preferences?.unavailableExcludedModelIds ?? []])).filter((id) => !available.some((model) => model.id === id)).map((id) => ({
10268
11035
  id,
10269
11036
  name: id,
10270
11037
  available: false
10271
11038
  }))];
10272
11039
  const needle = query.trim().toLocaleLowerCase();
10273
- const filtered = rows.filter((model) => (filter === "all" || settingsKnown && (filter === "excluded" ? excluded.has(model.id) : !excluded.has(model.id))) && (needle.length === 0 || model.id.toLocaleLowerCase().includes(needle) || model.name.toLocaleLowerCase().includes(needle)));
11040
+ const filtered = rows.filter((model) => (filter === "all" || filter === "enabled" && settingsKnown && !excluded.has(model.id) || filter === "excluded" && settingsKnown && excluded.has(model.id) || filter === "available" && availabilityKnown && model.available || filter === "unavailable" && availabilityKnown && !model.available) && (needle.length === 0 || model.id.toLocaleLowerCase().includes(needle) || model.name.toLocaleLowerCase().includes(needle)));
10274
11041
  const visibleCount = available.filter((model) => !excluded.has(model.id)).length;
11042
+ const unavailableCount = rows.filter((model) => !model.available).length;
10275
11043
  const update = async (modelId, restore = false) => {
10276
11044
  const scope = request.current;
10277
11045
  if (scope.pending || modelId !== void 0 && !writable) return;
@@ -10330,7 +11098,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10330
11098
  return (0, react.createElement)("details", { "data-dsh-github-copilot-model-preferences": true }, (0, react.createElement)("summary", null, settingsKnown ? `Model preferences · ${visibleCount} enabled · ${excluded.size} excluded` : "Model preferences · Read-only"), (0, react.createElement)("p", { style: {
10331
11099
  fontSize: "14px",
10332
11100
  marginBlock: "12px"
10333
- } }, "Excluded models disappear from the managed picker and cannot start a new turn, including Auto. An admitted turn keeps its model. Fixed selections are not changed; select another model before the next turn. Restoring a model does not select it."), diagnostic === void 0 ? null : (0, react.createElement)("div", {
11101
+ } }, "Exclusions are shared across GitHub Copilot accounts; availability below reflects the current account. Newly discovered models are enabled by default. Unavailable saved exclusions are retained and apply again if that model returns. Excluded models disappear from the managed picker and cannot start a new turn, including Auto. An admitted turn keeps its model. Fixed selections are not changed; select another model before the next turn. Restoring a model does not select it."), availabilityKnown ? null : (0, react.createElement)("p", { role: "status" }, "Current account availability unconfirmed. Shown models reflect the last metadata snapshot and saved exclusions, not a current availability check."), diagnostic === void 0 ? null : (0, react.createElement)("div", {
10334
11102
  role: "alert",
10335
11103
  "data-dsh-github-copilot-model-preferences-error": true,
10336
11104
  style: {
@@ -10355,7 +11123,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10355
11123
  fontSize: "16px",
10356
11124
  width: "100%",
10357
11125
  boxSizing: "border-box",
10358
- minWidth: 0
11126
+ minWidth: 0,
11127
+ background: "var(--dsw-alias-bg-layer-1, Canvas)",
11128
+ color: "var(--dsw-alias-label-primary, CanvasText)"
10359
11129
  },
10360
11130
  onChange: (event) => setQuery(event.currentTarget.value),
10361
11131
  placeholder: "Search by name or exact model ID",
@@ -10372,19 +11142,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10372
11142
  }, [
10373
11143
  "all",
10374
11144
  "enabled",
10375
- "excluded"
11145
+ "excluded",
11146
+ "available",
11147
+ "unavailable"
10376
11148
  ].map((value) => (0, react.createElement)("button", {
10377
11149
  key: value,
10378
11150
  type: "button",
10379
11151
  "aria-pressed": filter === value,
10380
- disabled: value !== "all" && !settingsKnown,
11152
+ disabled: (value === "enabled" || value === "excluded") && !settingsKnown || (value === "available" || value === "unavailable") && !availabilityKnown,
10381
11153
  onClick: () => setFilter(value),
10382
11154
  style: {
10383
11155
  ...controlStyle,
10384
11156
  fontWeight: filter === value ? 600 : 400,
10385
11157
  background: filter === value ? "color-mix(in srgb, currentColor 12%, transparent)" : "transparent"
10386
11158
  }
10387
- }, value === "all" ? `All (${rows.length})` : value === "enabled" ? `Enabled (${settingsKnown ? visibleCount : "?"})` : `Excluded (${settingsKnown ? excluded.size : "?"})`))), filtered.length === 0 ? (0, react.createElement)("p", { role: "status" }, rows.length === 0 ? "No account models to display. Use Refresh models to read account metadata." : "No models match this filter or search.") : (0, react.createElement)("ul", {
11159
+ }, value === "all" ? `All (${rows.length})` : value === "enabled" ? `Enabled (${settingsKnown ? visibleCount : "?"})` : value === "excluded" ? `Excluded (${settingsKnown ? excluded.size : "?"})` : value === "available" ? `Available (${availabilityKnown ? available.length : "?"})` : `Unavailable (${availabilityKnown ? unavailableCount : "?"})`))), filtered.length === 0 ? (0, react.createElement)("p", { role: "status" }, rows.length === 0 ? "No account models to display. Use Refresh models to read account metadata." : "No models match this filter or search.") : (0, react.createElement)("ul", {
10388
11160
  "aria-label": "Account models",
10389
11161
  style: {
10390
11162
  listStyle: "none",
@@ -10408,7 +11180,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10408
11180
  minWidth: 0,
10409
11181
  overflowWrap: "anywhere",
10410
11182
  fontSize: "14px"
10411
- } }, (0, react.createElement)("strong", null, model.name), (0, react.createElement)("br"), (0, react.createElement)("code", null, model.id), (0, react.createElement)("span", null, !settingsKnown ? " · Exclusion status unknown" : isExcluded ? " · Excluded" : " · Enabled"), model.available ? null : (0, react.createElement)("span", null, " · Temporarily absent from account metadata"), errorModel === model.id && error !== void 0 ? (0, react.createElement)("span", {
11183
+ } }, (0, react.createElement)("strong", null, model.name), (0, react.createElement)("br"), (0, react.createElement)("code", null, model.id), (0, react.createElement)("span", null, ` · ${!availabilityKnown ? "Current account availability unconfirmed" : model.available ? "Available on current account" : "Currently unavailable on current account; saved exclusion retained"}`), (0, react.createElement)("span", null, ` · ${!settingsKnown ? "Exclusion status unknown" : isExcluded ? "Excluded" : "Enabled"}`), errorModel === model.id && error !== void 0 ? (0, react.createElement)("span", {
10412
11184
  role: "status",
10413
11185
  style: {
10414
11186
  display: "block",
@@ -10419,7 +11191,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10419
11191
  style: {
10420
11192
  ...controlStyle,
10421
11193
  flexShrink: 0,
10422
- cursor: disabled ? "not-allowed" : "pointer"
11194
+ cursor: disabled ? "not-allowed" : "pointer",
11195
+ color: disabled ? "var(--dsw-alias-label-secondary, GrayText)" : "inherit"
10423
11196
  },
10424
11197
  disabled,
10425
11198
  "aria-label": `${isExcluded ? "Restore" : "Exclude"} ${model.name}`,
@@ -11000,8 +11773,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11000
11773
  maxWidth: "100%",
11001
11774
  cursor: "pointer"
11002
11775
  };
11776
+ const modelsControlCss = `
11777
+ [data-dsh-github-copilot-compact-account] :is(input, select, button) {
11778
+ color-scheme: inherit;
11779
+ }
11780
+ [data-dsh-github-copilot-compact-account] :is(input, select) {
11781
+ background: var(--dsw-alias-bg-layer-1, Canvas);
11782
+ color: var(--dsw-alias-label-primary, CanvasText);
11783
+ }
11784
+ [data-dsh-github-copilot-compact-account] option {
11785
+ background: Canvas;
11786
+ color: CanvasText;
11787
+ }
11788
+ [data-dsh-github-copilot-compact-account] :is(input, select, button, summary, a):focus-visible {
11789
+ outline: 2px solid Highlight;
11790
+ outline-offset: 2px;
11791
+ }
11792
+ [data-dsh-github-copilot-compact-account] :is(input, select, button):disabled {
11793
+ color: var(--dsw-alias-label-secondary, GrayText);
11794
+ cursor: not-allowed;
11795
+ }
11796
+ [data-dsh-github-copilot-compact-account] option:disabled {
11797
+ color: GrayText;
11798
+ }
11799
+ [data-dsh-github-copilot-compact-account] [role="alert"] {
11800
+ color: var(--dsw-alias-label-primary, CanvasText);
11801
+ }
11802
+ `;
11003
11803
  function compactErrorMessage(code, milestone) {
11004
- if (code === "COPILOT_MODEL_DISCOVERY_FAILED") return "Could not refresh models. Try again.";
11804
+ if (code === "COPILOT_MODEL_DISCOVERY_FAILED") return "Could not refresh models. Open Manage and choose Retry in Model preferences.";
11005
11805
  if (code === "COPILOT_AUTHORIZATION_BEGIN_FAILED") return `GitHub sign-in did not complete.${milestone === void 0 ? "" : ` Latest observed milestone: ${milestone}.`} Try again. If it continues, share diagnostic code COPILOT_AUTHORIZATION_BEGIN_FAILED with support.`;
11006
11806
  if (code === "COPILOT_ROUTE_REPAIR_FAILED") return "GitHub sign-in completed, but model configuration repair failed. Authentication is retained. Open Manage and choose Repair model configuration. If it continues, share diagnostic code COPILOT_ROUTE_REPAIR_FAILED with support.";
11007
11807
  if (code === "COPILOT_AUTHORIZATION_START_FAILED") return "Could not confirm sign-in. Retry status to check.";
@@ -11017,6 +11817,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11017
11817
  const state = (0, react.useSyncExternalStore)(account.subscribe, account.getSnapshot, account.getSnapshot);
11018
11818
  (0, react.useEffect)(() => props.account === void 0 ? account.attach() : void 0, [account, props.account]);
11019
11819
  const [manageOpen, setManageOpen] = (0, react.useState)(false);
11820
+ const [accountRevisionKey, setAccountRevisionKey] = (0, react.useState)(0);
11821
+ const refreshAccountRevision = () => setAccountRevisionKey((value) => value + 1);
11020
11822
  const managementId = `github-copilot-management-${(0, react.useId)()}`;
11021
11823
  const view = state.view;
11022
11824
  const signedIn = view?.configured === true;
@@ -11037,34 +11839,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11037
11839
  disabled,
11038
11840
  style: {
11039
11841
  ...compactButtonStyle,
11040
- opacity: disabled ? .5 : 1,
11041
- cursor: disabled ? "default" : "pointer"
11842
+ color: disabled ? "var(--dsw-alias-label-secondary, GrayText)" : "inherit",
11843
+ cursor: disabled ? "not-allowed" : "pointer"
11042
11844
  },
11043
11845
  ...extras
11044
11846
  }, label);
11847
+ const accountSettings = (0, react.createElement)("div", { style: {
11848
+ display: "grid",
11849
+ gap: 8
11850
+ } }, routeStatusMessage(view) === void 0 ? null : (0, react.createElement)("p", { role: "status" }, routeStatusMessage(view)), view?.route?.state === "needs-repair" && signedIn ? actionButton("Repair model configuration", account.reconcile, pendingAction) : null, signedIn ? actionButton(state.operation === "signOut" ? "Signing out…" : "Sign out", account.signOut, pendingAction || view?.writable === false) : null, view?.writable === false ? (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Credentials are read-only in this profile.") : null);
11851
+ const continuationSettings = props.continuationSettings ?? (0, react.createElement)(ContinuationDefaultCard, {
11852
+ remote: props.continuationRemote,
11853
+ locale: props.locale,
11854
+ onSaved: refreshAccountRevision
11855
+ });
11045
11856
  return (0, react.createElement)("section", {
11046
11857
  "data-dsh-github-copilot-compact-account": true,
11047
11858
  "data-dsh-github-copilot-embedded": props.embedded === true ? true : void 0,
11048
11859
  "aria-label": props.embedded === true ? "GitHub Copilot account" : void 0,
11049
11860
  style: props.embedded === true ? {
11050
11861
  minWidth: 0,
11051
- marginTop: "8px"
11862
+ marginTop: "8px",
11863
+ colorScheme: "light dark"
11052
11864
  } : {
11053
11865
  minWidth: 0,
11054
11866
  padding: "12px 14px",
11055
11867
  margin: "12px 0",
11056
11868
  borderRadius: "16px",
11057
11869
  border: "1px solid color-mix(in srgb, currentColor 24%, transparent)",
11058
- background: "transparent"
11870
+ background: "transparent",
11871
+ colorScheme: "light dark"
11059
11872
  }
11060
- }, props.accountsRemote === void 0 ? null : (0, react.createElement)(CopilotAccountsPanel, {
11061
- remote: props.accountsRemote,
11062
- expanded: manageOpen,
11063
- onChanged: account.retryStatus,
11064
- authorizationBusy,
11065
- configured: view?.configured,
11066
- locale: props.locale
11067
- }), (0, react.createElement)("div", { style: {
11873
+ }, (0, react.createElement)("style", null, modelsControlCss), (0, react.createElement)("div", { style: {
11068
11874
  display: "flex",
11069
11875
  alignItems: "center",
11070
11876
  flexWrap: "wrap",
@@ -11101,7 +11907,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11101
11907
  gap: "8px",
11102
11908
  marginInlineStart: "auto",
11103
11909
  minWidth: 0
11104
- } }, view === void 0 && !state.checking || state.error === "COPILOT_AUTHORIZATION_STATUS_FAILED" || uncertain ? actionButton("Retry status", account.retryStatus, state.checking || state.operation !== void 0) : null, signedIn && state.error === "COPILOT_MODEL_DISCOVERY_FAILED" ? actionButton("Retry", account.refreshModels, pendingAction, { "data-dsh-github-copilot-retry-models": true }) : null, !signedIn && !authorizing && view !== void 0 ? actionButton("Sign in with GitHub", account.start, pendingAction || view.writable === false, { title: view.writable === false ? "Credentials are read-only" : void 0 }) : null, actionButton("Manage", () => setManageOpen((open) => !open), false, {
11910
+ } }, view === void 0 && !state.checking || state.error === "COPILOT_AUTHORIZATION_STATUS_FAILED" || uncertain ? actionButton("Retry status", account.retryStatus, state.checking || state.operation !== void 0) : null, !signedIn && !authorizing && view !== void 0 ? actionButton("Sign in with GitHub", account.start, pendingAction || view.writable === false, { title: view.writable === false ? "Credentials are read-only" : void 0 }) : null, actionButton("Manage", () => setManageOpen((open) => !open), false, {
11105
11911
  "aria-expanded": manageOpen,
11106
11912
  "aria-controls": managementId
11107
11913
  }))), state.error === void 0 ? null : (0, react.createElement)("p", {
@@ -11128,27 +11934,55 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11128
11934
  copyState: state.copyState,
11129
11935
  onCopy: () => void account.copyCode(),
11130
11936
  buttonStyle: compactButtonStyle
11131
- }), actionButton(state.operation === "cancel" ? "Cancelling…" : "Cancel sign-in", account.cancel, state.operation === "cancel")) : null, manageOpen ? (0, react.createElement)("div", {
11937
+ }), actionButton(state.operation === "cancel" ? "Cancelling…" : "Cancel sign-in", account.cancel, state.operation === "cancel")) : null, (0, react.createElement)("div", {
11132
11938
  id: managementId,
11133
11939
  role: "region",
11134
11940
  "aria-label": "GitHub Copilot account management",
11135
11941
  style: {
11136
11942
  marginTop: "12px",
11137
- paddingTop: "12px",
11138
- borderTop: "1px solid color-mix(in srgb, currentColor 18%, transparent)",
11943
+ paddingTop: manageOpen ? "12px" : 0,
11944
+ borderTop: manageOpen ? "1px solid color-mix(in srgb, currentColor 18%, transparent)" : void 0,
11139
11945
  overflowWrap: "anywhere"
11140
11946
  }
11141
- }, signedIn ? (0, react.createElement)(GitHubCopilotModelPreferencesPanel, {
11947
+ }, props.accountsRemote === void 0 ? null : (0, react.createElement)(CopilotAccountsPanel, {
11948
+ remote: props.accountsRemote,
11949
+ expanded: manageOpen,
11950
+ onChanged: account.retryStatus,
11951
+ refreshKey: accountRevisionKey,
11952
+ authorizationBusy,
11953
+ configured: view?.configured,
11954
+ locale: props.locale,
11955
+ accountSettings,
11956
+ continuationSettings
11957
+ }), manageOpen && props.accountsRemote === void 0 ? (0, react.createElement)("section", { "aria-label": "Account management" }, (0, react.createElement)("h3", { style: {
11958
+ margin: 0,
11959
+ fontSize: 16
11960
+ } }, "Account management"), accountSettings, continuationSettings) : null, manageOpen ? (0, react.createElement)("section", {
11961
+ "data-dsh-github-copilot-model-management": true,
11962
+ "aria-label": "Model preferences",
11963
+ style: {
11964
+ display: "grid",
11965
+ gap: 10,
11966
+ marginTop: 18,
11967
+ paddingTop: 16,
11968
+ borderTop: "1px solid color-mix(in srgb, currentColor 18%, transparent)"
11969
+ }
11970
+ }, (0, react.createElement)("h3", { style: {
11971
+ margin: 0,
11972
+ fontSize: 16
11973
+ } }, "Model preferences"), signedIn ? (0, react.createElement)(GitHubCopilotModelPreferencesPanel, {
11142
11974
  remote: props.remote,
11143
11975
  models,
11144
11976
  preferences: view?.modelPreferences
11145
- }) : null, (0, react.createElement)("details", { style: { marginBlock: "16px" } }, (0, react.createElement)("summary", null, "Discovery details"), (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Signing in here fetches your account models once. Opening this view refreshes missing or stale metadata when needed. No manual model definitions are needed. Refresh models updates account metadata; it does not verify a model call or change your selected model."), models === void 0 ? (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Account model metadata is not available yet.") : (0, react.createElement)(GitHubCopilotAccountModelsSummary, { snapshot: models })), signedIn ? actionButton(refreshing ? "Refreshing models…" : "Refresh models", account.refreshModels, pendingAction, { "data-dsh-github-copilot-refresh-models": true }) : null, routeStatusMessage(view) === void 0 ? null : (0, react.createElement)("p", { role: "status" }, routeStatusMessage(view)), view?.route?.state === "needs-repair" && signedIn ? actionButton("Repair model configuration", account.reconcile, pendingAction) : null, signedIn ? actionButton(state.operation === "signOut" ? "Signing out…" : "Sign out", account.signOut, pendingAction || view?.writable === false) : null, view?.writable === false ? (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Credentials are read-only in this profile.") : null) : null);
11977
+ }) : (0, react.createElement)("p", { role: "status" }, "Sign in to manage model preferences."), (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Discovery details"), (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Signing in here fetches your account models once. Opening this view refreshes missing or stale metadata when needed. No manual model definitions are needed. Refresh models updates account metadata; it does not verify a model call or change your selected model."), models === void 0 ? (0, react.createElement)("p", { style: { fontSize: "13px" } }, "Account model metadata is not available yet.") : (0, react.createElement)(GitHubCopilotAccountModelsSummary, { snapshot: models })), signedIn ? actionButton(refreshing ? "Refreshing models…" : "Refresh models", account.refreshModels, pendingAction, { "data-dsh-github-copilot-refresh-models": true }) : null, signedIn && state.error === "COPILOT_MODEL_DISCOVERY_FAILED" ? actionButton("Retry", account.refreshModels, pendingAction, { "data-dsh-github-copilot-retry-models": true }) : null) : null));
11146
11978
  }
11147
11979
  /** Standalone footer presentation; registered Models seats use the shared surface coordinator. */
11148
11980
  function GitHubCopilotPreviewFooter(props) {
11149
11981
  return (0, react.createElement)("div", { "data-dsh-github-copilot-preview-footer": true }, (0, react.createElement)(GitHubCopilotCompactAccount, {
11150
11982
  remote: props.remote,
11151
11983
  accountsRemote: props.accountsRemote,
11984
+ continuationSettings: props.continuationSettings,
11985
+ continuationRemote: props.continuationRemote,
11152
11986
  locale: props.locale
11153
11987
  }));
11154
11988
  }
@@ -11252,6 +12086,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11252
12086
  return (0, react.createElement)("div", { "data-dsh-github-copilot-account-surface": props.seat.kind }, (0, react.createElement)(GitHubCopilotCompactAccount, {
11253
12087
  remote: props.remote,
11254
12088
  accountsRemote: props.accountsRemote,
12089
+ continuationRemote: props.continuationRemote,
12090
+ continuationSettings: props.continuationSettings,
11255
12091
  account: owner.account,
11256
12092
  embedded,
11257
12093
  locale
@@ -11268,6 +12104,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11268
12104
  const surfaces = createAccountSurfaces();
11269
12105
  const remote = ctx.remote.githubCopilot;
11270
12106
  const accountsRemote = ctx.remote.githubCopilotAccounts;
12107
+ const continuationRemote = ctx.remote.githubCopilotSessionContinuation;
11271
12108
  const localeCandidate = ctx.get("locale");
11272
12109
  const localeReader = isLocaleReader(localeCandidate) ? localeCandidate : void 0;
11273
12110
  const disposeCredentials = ctx.remote.$on("credentials/reference-updated", () => surfaces.invalidate());
@@ -11293,6 +12130,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11293
12130
  seat,
11294
12131
  remote,
11295
12132
  accountsRemote,
12133
+ continuationRemote,
11296
12134
  localeReader
11297
12135
  }));
11298
12136
  disposeFallback = () => {
@@ -11327,6 +12165,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11327
12165
  seat,
11328
12166
  remote,
11329
12167
  accountsRemote,
12168
+ continuationRemote,
11330
12169
  eligible: isGitHubCopilotAccountRow(props),
11331
12170
  localeReader
11332
12171
  });
@@ -11360,6 +12199,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11360
12199
  seat,
11361
12200
  remote,
11362
12201
  accountsRemote,
12202
+ continuationRemote,
11363
12203
  localeReader
11364
12204
  }));
11365
12205
  } catch {
@@ -11519,6 +12359,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11519
12359
  const ui = ctx.inject([
11520
12360
  "remote.githubCopilot",
11521
12361
  "remote.githubCopilotAccounts",
12362
+ "remote.githubCopilotSessionContinuation",
11522
12363
  "slots"
11523
12364
  ], registerUi);
11524
12365
  try {
@@ -11537,10 +12378,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11537
12378
  "remote.githubCopilotUsage",
11538
12379
  "remote.githubCopilotAccounts",
11539
12380
  "remote.githubCopilotSessionAccount",
12381
+ "remote.githubCopilotSessionContinuation",
11540
12382
  "slots"
11541
12383
  ], registerCopilotUsageUi);
11542
12384
  const contextUi = ctx.inject(["slots"], registerContextEvidenceUi);
11543
- const recoveryUi = ctx.inject(["remote.githubCopilotReplayRecovery", "slots"], registerReplayRecoveryUi);
12385
+ const recoveryUi = ctx.inject([
12386
+ "remote.githubCopilotReplayRecovery",
12387
+ "remote.githubCopilotSessionContinuation",
12388
+ "slots"
12389
+ ], registerReplayRecoveryUi);
11544
12390
  const autoUi = ctx.inject([
11545
12391
  "remote.githubCopilotTurnSelection",
11546
12392
  "remote.githubCopilotSessionAccount",