dsh-github-copilot 0.4.0-alpha.99 → 0.4.0

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.
Files changed (109) hide show
  1. package/AGENTS.md +96 -16
  2. package/CHANGELOG.md +211 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/README.md +106 -18
  5. package/README.zh.md +97 -18
  6. package/deployment-baseline.json +227 -8
  7. package/docs/account-management-experience.md +143 -0
  8. package/docs/auto-high-cost.md +154 -0
  9. package/docs/auto-iteration-review.json +22 -0
  10. package/docs/auto-review-sampling.md +60 -0
  11. package/docs/auto-task-routing.md +8 -6
  12. package/docs/automatic-model-routing.md +33 -5
  13. package/docs/copilot-accounts.md +376 -0
  14. package/docs/copilot-compaction.md +23 -2
  15. package/docs/copilot-usage.md +24 -4
  16. package/docs/evidence-driven-iteration.md +86 -0
  17. package/docs/images/copilot-accounts-credits.png +0 -0
  18. package/docs/images/copilot-accounts.png +0 -0
  19. package/docs/images/copilot-current-provenance.json +39 -0
  20. package/docs/images/copilot-model-preferences.png +0 -0
  21. package/docs/images/copilot-search-routing.png +0 -0
  22. package/docs/images/copilot-session-continuation.png +0 -0
  23. package/docs/manual-compaction-recovery.md +50 -7
  24. package/docs/mockups/copilot-account-dropdown.html +71 -0
  25. package/docs/mockups/copilot-account-management.html +393 -0
  26. package/docs/model-compatibility-acceptance.md +34 -16
  27. package/docs/official-first-020-rc2.md +1 -0
  28. package/docs/plugin-diagnostics.md +452 -0
  29. package/docs/session-continuation.md +141 -0
  30. package/docs/session-search-routing.md +1 -1
  31. package/docs/single-route-migration.md +5 -4
  32. package/lib/client.js +4415 -846
  33. package/lib/client.js.map +1 -1
  34. package/lib/diagnostics-analysis-io.js +78 -0
  35. package/lib/diagnostics-analysis.js +425 -0
  36. package/lib/diagnostics-types-FVf6zjob.js +182 -0
  37. package/lib/index.js +10356 -6020
  38. package/lib/manual-compaction-recovery.js +163 -38
  39. package/lib/remote.js +593 -34
  40. package/lib/routed-web.js +1 -1
  41. package/lib/{search-routing-jzNYveyK.js → search-routing-CV2hs8as.js} +139 -139
  42. package/lib/types/account-dropdown.d.ts +22 -0
  43. package/lib/types/account-model-auth.d.ts +1 -1
  44. package/lib/types/authorization-code-clipboard.d.ts +4 -0
  45. package/lib/types/authorization-controller.d.ts +2 -0
  46. package/lib/types/auto-allocation-card.d.ts +9 -0
  47. package/lib/types/auto-allocation-evidence.d.ts +38 -0
  48. package/lib/types/auto-allocation.d.ts +24 -0
  49. package/lib/types/auto-model-host.d.ts +2 -0
  50. package/lib/types/auto-model-routing.d.ts +6 -2
  51. package/lib/types/auto-review-sampling.d.ts +6 -0
  52. package/lib/types/auto-task-classifier.d.ts +1 -1
  53. package/lib/types/background-compaction.d.ts +2 -2
  54. package/lib/types/client.d.ts +19 -3
  55. package/lib/types/compaction-continuation-ui.d.ts +29 -0
  56. package/lib/types/compaction-continuation.d.ts +48 -0
  57. package/lib/types/compaction-input-estimate.d.ts +24 -0
  58. package/lib/types/compaction-replay.d.ts +18 -0
  59. package/lib/types/composer-notice-style.d.ts +7 -0
  60. package/lib/types/config.d.ts +42 -2
  61. package/lib/types/context-evidence-ui.d.ts +18 -1
  62. package/lib/types/context-evidence.d.ts +152 -4
  63. package/lib/types/copilot-account-presentation.d.ts +7 -0
  64. package/lib/types/copilot-accounts-card.d.ts +43 -0
  65. package/lib/types/copilot-accounts-host.d.ts +93 -0
  66. package/lib/types/copilot-accounts-remote.d.ts +85 -0
  67. package/lib/types/copilot-accounts-types.d.ts +43 -0
  68. package/lib/types/copilot-auth.d.ts +3 -1
  69. package/lib/types/copilot-usage-card.d.ts +23 -0
  70. package/lib/types/copilot-usage-host.d.ts +9 -1
  71. package/lib/types/copilot-usage-remote.d.ts +2 -1
  72. package/lib/types/copilot-usage-types.d.ts +1 -0
  73. package/lib/types/diagnostics-analysis-io.d.ts +23 -0
  74. package/lib/types/diagnostics-analysis.d.ts +295 -0
  75. package/lib/types/diagnostics-card.d.ts +11 -0
  76. package/lib/types/diagnostics-client.d.ts +13 -0
  77. package/lib/types/diagnostics-collector.d.ts +36 -0
  78. package/lib/types/diagnostics-host.d.ts +72 -0
  79. package/lib/types/diagnostics-remote.d.ts +109 -0
  80. package/lib/types/diagnostics-types.d.ts +431 -0
  81. package/lib/types/manual-compaction-recovery.d.ts +18 -3
  82. package/lib/types/model-preferences-card.d.ts +1 -1
  83. package/lib/types/native-settings-style.d.ts +10 -0
  84. package/lib/types/parent-model-follow-card.d.ts +2 -11
  85. package/lib/types/preview-provider.d.ts +4 -0
  86. package/lib/types/preview-route.d.ts +7 -5
  87. package/lib/types/remote.d.ts +9 -6
  88. package/lib/types/replay-recovery-host.d.ts +2 -2
  89. package/lib/types/replay-recovery-ui.d.ts +3 -1
  90. package/lib/types/request-body-evidence.d.ts +3 -1
  91. package/lib/types/responses-replay-compat.d.ts +2 -1
  92. package/lib/types/responses-request-compression.d.ts +33 -0
  93. package/lib/types/session-accounts-controller.d.ts +20 -0
  94. package/lib/types/session-accounts-host.d.ts +33 -0
  95. package/lib/types/session-accounts-remote.d.ts +114 -0
  96. package/lib/types/session-accounts.d.ts +38 -0
  97. package/lib/types/session-continuation-host.d.ts +45 -0
  98. package/lib/types/session-continuation-remote.d.ts +22 -0
  99. package/lib/types/session-continuation-types.d.ts +62 -0
  100. package/lib/types/session-continuation-ui.d.ts +49 -0
  101. package/lib/types/session-continuation.d.ts +14 -0
  102. package/lib/types/turn-request-models.d.ts +55 -0
  103. package/lib/types/turn-selection-card.d.ts +15 -1
  104. package/lib/types/turn-selection-host.d.ts +23 -0
  105. package/lib/types/turn-selection-remote.d.ts +4 -0
  106. package/lib/types/turn-selection.d.ts +19 -4
  107. package/package.json +19 -3
  108. package/scripts/analyze-diagnostics.mjs +91 -0
  109. package/scripts/iteration-review.mjs +53 -0
@@ -0,0 +1,393 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
4
+ <title>Chat → Models · 完整多账号体验 Mock</title>
5
+ <!-- Shared current-account summary; searchable bounded selector only after Switch.
6
+ Chat owns session selection, Models owns global default. All data is synthetic. -->
7
+ <style>
8
+ :root{color-scheme:dark;--bg:#171717;--panel:#252525;--text:#eee;--muted:#bdbdbd;--line:#555;--hover:#353535;--accent:#b9d5ff}
9
+ *{box-sizing:border-box}body{margin:0;padding:24px;background:var(--bg);color:var(--text);font:13px/1.55 system-ui,"Segoe UI",sans-serif}
10
+ button,input,select,textarea{font:inherit;color:inherit}button,select,input{background:transparent;border:1px solid var(--line);border-radius:6px;padding:7px 10px}
11
+ button{cursor:pointer}button:hover{background:var(--hover)}button:disabled{opacity:.5;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
12
+ header{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding-bottom:14px;border-bottom:1px solid var(--line)}header span,p,small{color:var(--muted)}
13
+ nav{display:flex;gap:8px;margin:20px 0}nav button[aria-pressed=true]{background:var(--hover)}main{max-width:952px;margin:auto}
14
+ h1{font-size:22px;margin:0 0 18px}h2{font-size:17px;margin:0}p{margin:6px 0}small{font-size:12px}.row{display:flex;align-items:center;justify-content:space-between;gap:12px}
15
+ .history{height:160px;display:grid;place-content:center;color:var(--muted)}.composer{border:1px solid var(--line);border-radius:12px;padding:12px}textarea{width:100%;min-height:72px;background:none;border:0;resize:vertical}.toolbar{display:flex;justify-content:space-between;color:var(--muted)}
16
+ .dock{display:flex;justify-content:flex-end;margin:8px 0}.quiet{border:0;color:var(--accent)}.account-surface{position:relative;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:16px;width:min(100%,430px);margin-left:auto;box-shadow:0 6px 20px #0003}.models .account-surface{width:100%;margin:0;box-shadow:none}
17
+ .identity{min-width:0}.identity strong{display:block}.identity small{display:block}.account-summary{padding:12px 0}.section{border-top:1px solid var(--line);padding-top:14px;margin-top:10px}
18
+ .selector{border-top:1px solid var(--line);padding-top:12px}.search{width:100%;margin:10px 0}.account-list{max-height:220px;overflow:auto;overscroll-behavior:contain}.account-option{display:flex;justify-content:space-between;align-items:center;gap:12px;border:0;width:100%;text-align:left;padding:9px 8px}.account-option[aria-pressed=true]{background:var(--hover)}.account-option small{display:block}.selected{color:var(--accent);white-space:nowrap}.selector-footer{border-top:1px solid var(--line);padding-top:10px;margin-top:8px}.selector-footer button{width:100%;text-align:left}
19
+ .notice{padding:8px 10px;background:var(--hover);border-radius:6px;margin:10px 0}.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.primary{background:#e4e4e4;color:#171717;border-color:#e4e4e4}.primary:hover{background:white}
20
+ details p{font-size:12px}summary{cursor:pointer}.label{display:block;margin-top:10px}input[type=checkbox]{accent-color:#adcfff}
21
+ .models-list{margin-top:20px;border-top:1px solid var(--line)}.model-row{padding:12px 0;border-bottom:1px solid var(--line)}.simulation{margin:24px auto 0;max-width:952px;border-top:1px dashed var(--line);padding-top:14px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;color:var(--muted);font-size:12px}
22
+ [hidden]{display:none!important}.save-error{color:var(--text)}#status{font-size:12px;min-height:18px}
23
+ @media(max-width:480px){body{padding:14px}.history{height:90px}.account-surface{padding:14px}.row{gap:8px}.row select{max-width:150px}.account-list{max-height:190px}header{gap:6px}}
24
+ @media(prefers-color-scheme:light){:root{color-scheme:light;--bg:#fafafa;--panel:#fff;--text:#222;--muted:#555;--line:#bbb;--hover:#f0f0f0;--accent:#24599b}.primary{background:#303030;color:white;border-color:#303030}.primary:hover{background:#444}}
25
+
26
+ body{background:#191919;padding:24px;color-scheme:dark}
27
+ .app-backdrop{position:fixed;inset:0;z-index:-1;display:grid;grid-template-columns:220px 1fr;opacity:.35;pointer-events:none;color:#bbb}
28
+ .app-sidebar{border-right:1px solid #555;padding:100px 16px 24px}.app-sidebar div{margin:22px 0}.app-chat{padding:100px 60px}
29
+ header{max-width:1100px;margin:0 auto 18px;border:0;padding:0;font-size:12px}
30
+ .settings-shell{display:grid;grid-template-columns:185px minmax(0,1fr);max-width:880px;height:min(820px,calc(100vh - 110px));min-height:480px;margin:auto;border-radius:22px;background:#2a2a2c;box-shadow:0 18px 60px #0006;overflow:hidden;border:1px solid #3b3b3d}
31
+ .settings-nav{padding:24px 12px}.settings-nav strong{display:block;margin:0 12px 22px;font-size:16px}.settings-nav button{display:block;text-align:left;width:100%;margin:6px 0;border:0;padding:10px 12px}.settings-nav .active{background:#444449}
32
+ main{max-width:none;margin:0;padding:20px 24px;overflow:auto;min-width:0;background:#2a2a2c}
33
+ main>nav{display:none}.settings-actions{display:flex;justify-content:flex-end;gap:8px;margin-bottom:16px}.settings-actions button{font-size:12px}
34
+ h1{font-size:17px;margin-bottom:12px}h2{font-size:17px}.intro{margin-bottom:20px}
35
+ .native-provider{display:flex;align-items:center;justify-content:space-between;border:1px solid #48484b;border-radius:12px;padding:13px;margin-top:18px}
36
+ .missing{color:#fb7777;font-size:12px}.native-add{width:100%;border-style:dashed;margin:10px 0 24px;padding:12px}
37
+ .models .account-surface{background:transparent;border-color:#48484b;border-radius:12px;padding:14px}
38
+ .account-summary{padding:14px 0}.account-summary strong{font-size:14px}.section{border-color:#48484b}
39
+ .provider-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:4px 0 14px}.provider-heading span{color:#bdbdbd;font-size:12px}.provider-heading strong{font-size:15px}
40
+ .model-status{border-top:1px solid #48484b;padding-top:14px;margin-top:14px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}.model-status small{font-size:12px}.model-status button{margin-left:auto}
41
+ .manage{margin-top:12px;border-top:1px solid #48484b;padding-top:12px}.manage details{padding:8px 0}.manage summary{font-size:13px}.manage .actions button{font-size:12px}
42
+ .preferences{display:grid;gap:6px;max-height:190px;overflow:auto;margin-top:10px}.preference{display:flex;align-items:center;gap:10px;padding:5px}.preference input{accent-color:#adcfff}
43
+ #policy{margin:12px 0 0}#policy-summary{font-size:13px}#models-list{display:none!important}
44
+ .simulation{max-width:880px;margin:16px auto;background:#191919;border:0}
45
+ .account-list{max-height:210px}#policy-details>p{font-size:12px}
46
+ .management-section+.management-section{border-top:1px solid #48484b;margin-top:20px;padding-top:18px}.management-section h3{font-size:15px;margin:0 0 8px}.compact-identity{color:#bdbdbd;font-size:12px;margin-top:4px}.model-status{border:0;padding:0;margin:0}.provider-heading{margin-bottom:8px}.model-owner{font-size:12px;color:#bdbdbd;margin-bottom:10px}.manage{padding-top:18px;margin-top:16px}.manage .account-summary{padding-top:0}.management-section #policy{padding-top:10px}
47
+ .account-entry{display:flex;align-items:center;gap:6px}.account-entry .account-option{flex:1;min-width:0}.remove-account{border:0;color:#ffb3b3;font-size:12px;flex-shrink:0}.remove-review{padding:12px;background:#353535;border-radius:6px;margin:10px 0}.model-search{width:100%;margin:8px 0}.model-filters{display:flex;gap:6px;flex-wrap:wrap}.model-filters button[aria-pressed=true]{background:#444449}.model-preference{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid #48484b}.model-preference small{display:block}.model-preference strong{font-size:13px}.model-preference button{flex-shrink:0;font-size:12px}
48
+ @media(max-width:620px){body{padding:12px}.settings-shell{grid-template-columns:1fr;height:calc(100vh - 160px);min-height:450px;border-radius:14px}.settings-nav{display:none}main{padding:16px}.settings-actions{margin-bottom:12px}header{flex-direction:column;align-items:flex-start}.simulation{margin-top:12px}.model-status button{margin-left:0}}
49
+
50
+ .settings-shell{position:fixed;z-index:10;left:50%;top:80px;transform:translateX(-50%);width:calc(100% - 40px);max-height:calc(100vh - 110px)}
51
+ .modal-shade{position:fixed;inset:0;background:#0009;z-index:9}
52
+ .settings-actions{position:sticky;top:0;z-index:2;background:#2a2a2c;padding:8px 0;border-bottom:1px solid #48484b}
53
+ select{color-scheme:dark;background:#252525;color:#eee}option{background:#252525;color:#eee}
54
+ .switch-review,.replay-guidance{padding:12px;background:#353535;border:1px solid #555;border-radius:8px;margin:12px 0}
55
+ .switch-review strong,.replay-guidance strong{display:block;margin-bottom:6px}.switch-review button,.replay-guidance button{font-size:12px}
56
+ .chat-host .history{height:auto;min-height:210px;display:flex;flex-direction:column;gap:18px;padding:20px 0;color:#eee}.mock-message{max-width:78%;padding:12px 16px;border-radius:10px;background:#252525}.mock-message.user{align-self:flex-end;background:#303036}.mock-message p{margin:5px 0}.mock-message small{display:block;color:#bdbdbd}.mock-message.failure{max-width:100%;border:1px solid #795454;background:#302727}.mock-message .actions{margin-top:10px}.scenario-heading{color:#bdbdbd;font-size:12px}
57
+ .chat-host{max-width:952px;margin:45px auto 0}.chat-host .history{height:210px}
58
+ .chat-host .account-surface{background:#252525;width:min(100%,430px);max-height:62vh;overflow:auto}
59
+ .chat-host .provider-heading{margin-bottom:0}.chat-host .account-summary{padding:12px 0}
60
+ .chat-host .model-status,.chat-host .compact-identity{display:none}
61
+ .chat-host .manage{border:0;padding:0;margin:0}
62
+ .chat-host #policy{border-top:1px solid #555;margin-top:12px;padding-top:12px}
63
+ .chat-host .preferences{display:none}.manage-link{border-top:1px solid #555;margin-top:12px;padding-top:10px;display:flex;justify-content:flex-end}
64
+ .chat-host .account-surface .management-section h3{display:none}
65
+ .mock-caption{max-width:952px;margin:12px auto;color:#bdbdbd;font-size:12px}
66
+ @media(max-width:620px){.settings-shell{top:72px;width:calc(100% - 24px);height:calc(100vh - 100px)}.chat-host{margin-top:20px}.chat-host .history{height:auto;min-height:100px}}
67
+ </style>
68
+ <div class="app-backdrop"><div class="app-sidebar"><strong>deepseek HARNESS</strong><div>+ New Session</div><div>Plugins</div><div>Automation tasks</div><div>Workspaces</div></div><div class="app-chat">Chat</div></div>
69
+ <header><strong>Chat → Models · 完整多账号体验 Mock</strong><span>参照当前 Desktop Settings;24 个虚构账号,不操作真实账号或设置</span></header>
70
+ <div class="settings-shell"><aside class="settings-nav"><strong>Settings</strong><button>⚙ General</button><button class="active">▤ Models</button><button>Built-in plugins</button><button>Agent presets</button></aside>
71
+ <main><div class="settings-actions"><button disabled>Open configuration file</button><button disabled aria-label="Close Settings">×</button></div>
72
+ <nav aria-label="预览页面"><button id="chat-tab" aria-pressed="true">Chat 页面</button><button id="models-tab" aria-pressed="false">Models 页面</button></nav>
73
+ <div id="chat"><div class="history">聊天区不显示账号列表或续聊设置</div><div class="composer"><textarea aria-label="模拟消息" placeholder="输入消息或任务…(仅模拟)"></textarea><div class="toolbar"><span>+ Full access⌄</span><span>GPT-6.1 Sol⌄ <button disabled aria-label="发送已禁用">↑</button></span></div></div><div class="dock"><button id="credits" class="quiet">Credits · <span id="dock-account"></span> ⌄</button></div></div>
74
+ <div id="models-heading" hidden><h1>Models</h1><p class="intro">Enter your API keys to use models from the following providers.</p>
75
+ <div class="native-provider"><span><strong>DeepSeek</strong> <span class="missing" title="API key missing">●</span></span><button disabled>Edit</button></div><button class="native-add" disabled>+ Add model provider</button></div>
76
+ <div id="surface-holder">
77
+ <section class="account-surface" aria-label="Copilot 账号">
78
+ <div class="provider-heading"><strong>GitHub Copilot</strong><span id="scope">全局默认</span></div>
79
+ <div class="row account-summary"><div class="identity"><strong id="current-name"></strong><small id="current-credit"></small><small id="source"></small></div><button id="switch" aria-expanded="false" aria-controls="selector">Switch</button></div>
80
+ <p id="running" class="notice" hidden></p>
81
+ <div id="selector" class="selector" hidden>
82
+ <div class="row"><strong id="selector-title">切换本 Session 账号</strong><button id="cancel-switch" class="quiet">取消</button></div>
83
+ <input id="search" class="search" type="search" aria-label="搜索账号" placeholder="搜索账号名称或标识">
84
+ <div id="account-list" class="account-list" role="group" aria-label="可选账号"></div>
85
+ <p id="empty" hidden>未找到匹配账号。可修改搜索,或添加新账号。</p>
86
+ <p id="save-error" class="save-error" role="alert" hidden>模拟保存失败,原账号保持不变。<button id="retry" class="quiet">重试</button></p>
87
+ <div class="selector-footer"><button id="add">+ 添加新账号</button></div>
88
+ <div id="add-view" hidden><label class="label" for="new-name">账号显示名称</label><input id="new-name" placeholder="例如:备用工作账号"><p><small>正式功能将在 GitHub 授权完成后添加。这里只模拟,不收集 token 或凭据。</small></p><div class="actions"><button id="finish-add">模拟授权完成</button><button id="cancel-add" class="quiet">取消添加</button></div><p id="add-error" role="alert" hidden>请输入账号显示名称。</p></div>
89
+ </div>
90
+ <p><small>全局默认用于跟随默认的后续轮次。正在运行的轮次和 Session 显式账号不变。</small></p><div class="section" id="policy">
91
+ <details id="policy-details"><summary id="policy-summary">降级续聊 · 关闭</summary>
92
+ <div id="session-policy-view"><div class="row" style="margin-top:12px"><label for="session-policy">本 Session 默认策略</label><select id="session-policy"><option value="follow">沿用创建时默认</option><option value="on">开启</option><option value="off">关闭</option></select></div><p><small>每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用;可见消息、工具记录和磁盘历史不变。</small></p><div id="shortcuts" class="actions"><button id="once">仅下一轮降级</button><button id="enable" class="primary">一键持续开启</button></div><p id="consent"><small>点击即同意上述损失,不自动发送或重试。</small></p><p id="once-state" hidden>已授权仅下一轮降级 <button id="revoke" class="quiet">撤销</button></p></div>
93
+ <div id="global-policy-view" hidden><label class="label"><input id="global-policy" type="checkbox"> 新 Session 默认开启降级续聊</label><p><small>勾选即同意新 Session 每轮不回放旧加密推理及内嵌摘要,同账号也适用。已有 Session 不批量修改。</small></p></div>
94
+ <p><small>可能失去旧推理隐含细节。关闭不恢复已生成回答。不解决额度、408 或上下文超限,也不保证请求成功。</small></p>
95
+ </details>
96
+ </div>
97
+ <div class="model-status"><strong>Models</strong><small>Signed in</small><small>19 models</small><small title="Synthetic timestamp">Updated 1 hour ago</small><button id="manage-toggle" aria-expanded="false">Manage</button></div>
98
+ <div id="manage" class="manage" hidden>
99
+ <details><summary>Model preferences · <span id="enabled-count">7</span> enabled · exclusions</summary><p><small>取消勾选将排除模型,不改写已有 Session 的选择。</small></p><div class="preferences">
100
+ <label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-6.1 Sol</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-6 Sol</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Claude Sonnet</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Claude Opus</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Gemini Pro</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-5.4</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-5.4 mini</label></div></details>
101
+ <details><summary>Discovery details</summary><p><small>模拟:账号模型缓存有效。时间戳、账号及模型均为演示数据,不证明线上可用性。</small></p></details>
102
+ <div class="actions"><button id="refresh-models">Refresh models</button><button id="refresh-identity">Refresh account information</button><button id="reauthorize">Reauthorize</button></div>
103
+ <p><small>以上操作作用于当前默认账号。此 mock 仅模拟状态,不发起授权或网络请求。</small></p></div>
104
+ <p id="status" role="status" aria-live="polite"></p>
105
+ </section>
106
+ </div>
107
+ <div id="models-list" class="models-list" hidden><div class="model-row row"><span>GPT-6.1 Sol</span><small>演示模型 · 可用</small></div><div class="model-row row"><span>Claude Sonnet</span><small>演示模型 · 可用</small></div></div>
108
+ </main></div>
109
+ <aside class="simulation"><span>演示专用:</span><button id="turn">开始模拟轮</button><button id="new-session">模拟新 Session</button><label><input id="fail" type="checkbox">下一次切换保存失败</label><span>不属于正式产品控件。</span></aside>
110
+ <script>
111
+ const $=id=>document.getElementById(id)
112
+ const accounts=Array.from({length:24},(_,i)=>({id:String(i+1),name:i===0?'个人账号':i===1?'工作账号':`备用账号 ${String(i+1).padStart(2,'0')}`,handle:`demo-account-${String(i+1).padStart(2,'0')}`,credits:i===0?'180 / 300':i===1?'420 / 1,000':'未读取额度'}))
113
+ let page='chat',globalAccount='1',sessionAccount=null,globalOn=false,initialOn=false,policy='follow',once=false,active=null,saving=false,target=null
114
+ const effective=()=>sessionAccount??globalAccount
115
+ const on=()=>policy==='follow'?initialOn:policy==='on'
116
+ const find=id=>accounts.find(a=>a.id===id)
117
+ function status(s){$('status').textContent=s}
118
+ function closeSelector(){$('selector').hidden=true;$('switch').setAttribute('aria-expanded','false');$('search').value='';$('add-view').hidden=true;$('switch').focus()}
119
+ function render(){
120
+ const current=find(page==='chat'?effective():globalAccount)
121
+ $('current-name').textContent=current.name
122
+ $('current-credit').textContent=current.credits==='未读取额度'?'额度未读取':current.credits+' Credits 剩余 · 演示账期数据'
123
+ $('source').textContent=page==='models'?'全局默认账号':sessionAccount===null?'跟随全局默认':'本 Session 已指定'
124
+ $('scope').textContent=page==='chat'?'本 Session':'全局默认'
125
+ $('dock-account').textContent=active?find(active.account).name+(active.account!==effective()?' → 下轮 '+find(effective()).name:''):find(effective()).name
126
+ $('running').hidden=page!=='chat'||!active
127
+ $('running').textContent=active?'本轮:'+find(active.account).name+' · '+(active.on?'降级开启':'降级关闭')+';下一轮:'+find(effective()).name+' · '+(on()||once?'降级开启':'降级关闭'):''
128
+ $('policy-summary').textContent=page==='models'?'新 Session 降级默认 · '+(globalOn?'开启':'关闭'):'降级续聊 · '+(on()?'开启':once?'仅下一轮':'关闭')
129
+ $('shortcuts').hidden=on();$('consent').hidden=on();$('once').disabled=once;$('once-state').hidden=!once
130
+ $('turn').textContent=active?'结束模拟轮':'开始模拟轮'
131
+ $('switch').disabled=saving
132
+ $('cancel-switch').disabled=saving;$('add').disabled=saving
133
+ renderList()
134
+ }
135
+ function renderList(){
136
+ const query=$('search').value.trim().toLowerCase(), list=$('account-list');list.replaceChildren()
137
+ const selected=page==='models'?globalAccount:sessionAccount
138
+ const entries=[...(page==='chat'?[{id:'follow',name:'跟随全局默认',handle:'当前默认:'+find(globalAccount).name}]:[]),...accounts].filter(a=>(a.name+' '+a.handle).toLowerCase().includes(query))
139
+ for(const a of entries){
140
+ const button=document.createElement('button');button.className='account-option';button.dataset.account=a.id;button.disabled=saving
141
+ const checked=a.id===(selected??'follow');button.setAttribute('aria-pressed',String(checked))
142
+ const text=document.createElement('span'),name=document.createElement('strong'),sub=document.createElement('small');name.textContent=a.name;sub.textContent=a.handle;text.append(name,sub)
143
+ const marker=document.createElement('span');marker.className='selected';marker.textContent=saving&&target===a.id?'保存中…':checked?'当前':''
144
+ button.append(text,marker);button.onclick=()=>choose(a.id);list.append(button)
145
+ }
146
+ $('empty').hidden=entries.length>0
147
+ }
148
+ async function choose(id){
149
+ if(saving)return;saving=true;target=id;$('save-error').hidden=true;render()
150
+ await new Promise(r=>setTimeout(r,250));saving=false
151
+ if($('fail').checked){$('fail').checked=false;$('save-error').hidden=false;status('保存失败;账号未改变。');render();return}
152
+ if(page==='models')globalAccount=id;else sessionAccount=id==='follow'?null:id
153
+ closeSelector();status(page==='models'?'已模拟设置全局默认;已有 Session 的显式账号不变。':active?'已保存,下一轮生效;当前轮不受影响。':'已保存,下次发送使用所选账号。');render()
154
+ }
155
+ function setPage(next){
156
+ if(saving)return;page=next;closeSelector()
157
+ document.querySelector('.account-surface').hidden=false
158
+ $('chat').hidden=page!=='chat';$('models-heading').hidden=page!=='models';$('models-list').hidden=page!=='models'
159
+ $('surface-holder').className=page==='models'?'models':''
160
+ $('chat-tab').setAttribute('aria-pressed',String(page==='chat'));$('models-tab').setAttribute('aria-pressed',String(page==='models'))
161
+ $('session-policy-view').hidden=page!=='chat';$('global-policy-view').hidden=page!=='models'
162
+ $('selector-title').textContent=page==='chat'?'切换本 Session 账号':'设置全局默认账号';status('');render()
163
+ }
164
+ $('chat-tab').onclick=()=>setPage('chat');$('models-tab').onclick=()=>setPage('models')
165
+ $('switch').onclick=()=>{$('selector').hidden=!$('selector').hidden;$('switch').setAttribute('aria-expanded',String(!$('selector').hidden));if(!$('selector').hidden)$('search').focus();renderList()}
166
+ $('cancel-switch').onclick=closeSelector;$('search').oninput=renderList;$('retry').onclick=()=>choose(target)
167
+ $('credits').onclick=()=>{const surface=document.querySelector('.account-surface');surface.hidden=!surface.hidden}
168
+ $('add').onclick=()=>{$('add-view').hidden=false;$('new-name').focus()}
169
+ $('cancel-add').onclick=()=>{$('add-view').hidden=true}
170
+ $('finish-add').onclick=()=>{const name=$('new-name').value.trim();$('add-error').hidden=!!name;if(!name)return;accounts.push({id:String(accounts.length+1),name,handle:'demo-new-account',credits:'未读取额度'});$('search').value=name;$('add-view').hidden=true;$('new-name').value='';status('已模拟添加账号,尚未切换;请选择该账号使用。');render()}
171
+ $('session-policy').onchange=e=>{policy=e.target.value;if(on())once=false;status(active?'策略已保存,下一轮生效。':'本 Session 策略已模拟保存。');render()}
172
+ $('global-policy').onchange=e=>{globalOn=e.target.checked;status('新 Session 默认已保存;已有 Session 不变。');render()}
173
+ $('once').onclick=()=>{once=true;status('已同意仅下一轮损失,请手动发送或重试。');render()}
174
+ $('revoke').onclick=()=>{once=false;status('已撤销下一轮授权。');render()}
175
+ $('enable').onclick=()=>{policy='on';once=false;$('session-policy').value='on';status('已同意损失并持续开启;可切回关闭。');render()}
176
+ $('turn').onclick=()=>{if(active){active=null;status('模拟轮结束。')}else{active={account:effective(),on:on()||once};once=false;status('模拟轮已开始,未执行任何推理。')}render()}
177
+ $('new-session').onclick=()=>{if(saving)return;active=null;sessionAccount=null;initialOn=globalOn;policy='follow';once=false;$('session-policy').value='follow';setPage('chat');document.querySelector('.account-surface').hidden=false;status('新模拟 Session 继承全局默认。');render()}
178
+ document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!saving)closeSelector()})
179
+
180
+ const manage=$('manage'),surface=document.querySelector('.account-surface')
181
+ const accountSection=document.createElement('section');accountSection.className='management-section';accountSection.setAttribute('aria-label','账号管理')
182
+ accountSection.innerHTML='<h3>账号管理</h3>'
183
+ const accountSummary=surface.querySelector('.account-summary')
184
+ const explanation=$('policy').previousElementSibling
185
+ accountSection.append(accountSummary,$('selector'),explanation,$('policy'))
186
+ const accountActions=document.createElement('div');accountActions.className='actions';accountActions.append($('refresh-identity'),$('reauthorize'));accountSection.append(accountActions)
187
+ const modelSection=document.createElement('section');modelSection.className='management-section';modelSection.setAttribute('aria-label','当前账号的模型')
188
+ modelSection.innerHTML='<h3>模型偏好</h3><p class="model-owner" id="model-owner">适用于所有 Copilot 账号;可用性按当前账号判断。</p>'
189
+ while(manage.firstChild)modelSection.append(manage.firstChild)
190
+ manage.append(accountSection,modelSection)
191
+ const compact=document.createElement('p');compact.className='compact-identity';compact.id='compact-identity';surface.querySelector('.provider-heading').after(compact)
192
+ function updateOwnership(){
193
+ compact.textContent=$('current-name').textContent+' · 全局默认'
194
+ $('model-owner').textContent='偏好适用于所有 Copilot 账号 · 当前可用性:'+$('current-name').textContent+'(模拟)'
195
+ renderPreferences()
196
+ }
197
+ new MutationObserver(updateOwnership).observe($('current-name'),{childList:true})
198
+ $('manage-toggle').onclick=()=>{const open=manage.hidden;manage.hidden=!open;$('manage-toggle').setAttribute('aria-expanded',String(open));if(!open)closeSelector()}
199
+ const preferences=modelSection.querySelector('details')
200
+ preferences.innerHTML='<summary>启用与排除 · 跨账号共享</summary><p><small>新发现模型默认启用;账号缺失模型时保留偏好,恢复可用后沿用原设置。不自动切模型或账号。</small></p><input class="model-search" id="model-search" type="search" aria-label="搜索模型" placeholder="搜索模型名称或 ID"><div class="model-filters" id="model-filters"></div><div class="preferences" id="preference-rows"></div>'
201
+ const models=[
202
+ {id:'gpt-6.1-sol',name:'GPT-6.1 Sol',accounts:['1','2']},
203
+ {id:'gpt-6-sol',name:'GPT-6 Sol',accounts:['1','2']},
204
+ {id:'claude-sonnet',name:'Claude Sonnet',accounts:['1']},
205
+ {id:'claude-opus',name:'Claude Opus',accounts:['2']},
206
+ {id:'gemini-pro',name:'Gemini Pro',accounts:['1','2'],fresh:true},
207
+ {id:'gpt-5.4',name:'GPT-5.4',accounts:['1','2']},
208
+ {id:'gpt-5.4-mini',name:'GPT-5.4 mini',accounts:['1','2']}
209
+ ]
210
+ const excluded=new Set(['gpt-5.4-mini']);let filter='all'
211
+ function renderPreferences(){
212
+ const query=$('model-search').value.trim().toLowerCase(),rows=$('preference-rows');rows.replaceChildren()
213
+ const filters=$('model-filters');filters.replaceChildren()
214
+ for(const [id,name] of [['all','全部'],['available','当前可用'],['excluded','已排除'],['unavailable','当前不可用']]){
215
+ const b=document.createElement('button');b.textContent=name;b.setAttribute('aria-pressed',String(filter===id));b.onclick=()=>{filter=id;renderPreferences()};filters.append(b)
216
+ }
217
+ for(const model of models){
218
+ const available=model.accounts.includes(globalAccount),off=excluded.has(model.id)
219
+ if(!(model.name+' '+model.id).toLowerCase().includes(query)||filter==='available'&&!available||filter==='excluded'&&!off||filter==='unavailable'&&available)continue
220
+ const row=document.createElement('div');row.className='model-preference';row.dataset.model=model.id
221
+ const label=document.createElement('span'),name=document.createElement('strong'),detail=document.createElement('small')
222
+ name.textContent=model.name+(model.fresh?' · 新发现':'')
223
+ detail.textContent=(off?'已排除':'已启用')+' · '+(available?'当前账号可用':'当前账号不可用,偏好保留')
224
+ label.append(name,detail)
225
+ const action=document.createElement('button');action.textContent=off?'恢复':'排除';action.onclick=()=>{off?excluded.delete(model.id):excluded.add(model.id);status('跨账号偏好已模拟保存;不会自动选择模型。');renderPreferences()}
226
+ row.append(label,action);rows.append(row)
227
+ }
228
+ if(!rows.childElementCount){const empty=document.createElement('p');empty.textContent='没有匹配模型。';rows.append(empty)}
229
+ }
230
+ $('model-search').oninput=renderPreferences
231
+ const removal=document.createElement('div');removal.className='remove-review';removal.hidden=true;removal.setAttribute('role','group');removal.setAttribute('aria-label','确认移除账号')
232
+ removal.innerHTML='<strong id="remove-title"></strong><p><small>仅移除本机保存的授权,不撤销 GitHub 端权限,不删除对话,也不清除共享模型偏好。不会自动切换到其他账号。</small></p><div class="actions"><button id="confirm-remove">确认移除</button><button id="cancel-remove">取消</button></div>'
233
+ $('selector').append(removal)
234
+ let removeTarget=null
235
+ const originalRenderList=renderList
236
+ renderList=function(){
237
+ originalRenderList()
238
+ document.querySelectorAll('#account-list .account-option').forEach(button=>{
239
+ const id=button.dataset.account
240
+ if(id==='follow')return
241
+ const wrapper=document.createElement('div');wrapper.className='account-entry'
242
+ button.replaceWith(wrapper);wrapper.append(button)
243
+ const remove=document.createElement('button');remove.className='remove-account';remove.textContent='移除';remove.setAttribute('aria-label','移除 '+find(id).name)
244
+ remove.disabled=saving||id===globalAccount||active?.account===id
245
+ remove.title=id===globalAccount?'请先切换全局默认账号':active?.account===id?'正在使用的账号不可移除':'移除本机保存的授权'
246
+ remove.onclick=()=>{removeTarget=id;$('remove-title').textContent='移除 '+find(id).name+'?';removal.hidden=false}
247
+ wrapper.append(remove)
248
+ })
249
+ }
250
+ $('search').oninput=()=>renderList()
251
+ $('cancel-remove').onclick=()=>{removal.hidden=true;removeTarget=null}
252
+ $('confirm-remove').onclick=()=>{
253
+ if(!removeTarget||removeTarget===globalAccount||active?.account===removeTarget)return
254
+ const id=removeTarget,name=find(id).name,index=accounts.findIndex(a=>a.id===id)
255
+ accounts.splice(index,1);removal.hidden=true;removeTarget=null
256
+ status('已模拟移除 '+name+';共享模型偏好保留。');render()
257
+ }
258
+ $('refresh-models').onclick=()=>status('模拟模型刷新完成;未发起网络请求。')
259
+ $('refresh-identity').onclick=()=>status('模拟账号信息刷新完成;未读取真实账号。')
260
+ $('reauthorize').onclick=()=>status('这里只演示重新授权入口;未打开 GitHub 或修改凭据。')
261
+ setPage('models')
262
+ updateOwnership()
263
+
264
+ const shell=document.querySelector('.settings-shell')
265
+ const shade=document.createElement('div');shade.className='modal-shade';shade.hidden=true;shell.before(shade)
266
+ const chatHost=document.createElement('div');chatHost.className='chat-host';shell.before(chatHost)
267
+ const chatNode=$('chat'),holder=$('surface-holder'),main=document.querySelector('main')
268
+ chatHost.append(chatNode,holder)
269
+ const link=document.createElement('div');link.className='manage-link';link.innerHTML='<button class="quiet" id="full-management">管理账号与模型 →</button>';surface.append(link)
270
+ const accountTitle=accountSection.querySelector('h3')
271
+ const accountActionsForModels=accountActions
272
+ const explanationForModels=explanation
273
+ const originalSetPage=setPage
274
+ function showChat(){
275
+ originalSetPage('chat');shell.hidden=true;shade.hidden=true;chatNode.hidden=false
276
+ chatHost.append(holder);holder.className=''
277
+ manage.hidden=false;accountSection.hidden=false;modelSection.hidden=true
278
+ accountActionsForModels.hidden=true;explanationForModels.hidden=true;accountTitle.hidden=true;link.hidden=false
279
+ compact.hidden=true;$('manage-toggle').hidden=true
280
+ surface.querySelector('.model-status').hidden=true
281
+ surface.hidden=false;render()
282
+ }
283
+ function showModels(){
284
+ closeSelector();originalSetPage('models');chatNode.hidden=false
285
+ main.insertBefore(holder,$('models-list'));holder.className='models'
286
+ shell.hidden=false;shade.hidden=false;manage.hidden=false
287
+ accountActionsForModels.hidden=false;explanationForModels.hidden=false;accountTitle.hidden=false
288
+ modelSection.hidden=false;link.hidden=true;compact.hidden=false
289
+ $('manage-toggle').hidden=false;$('manage-toggle').setAttribute('aria-expanded','true')
290
+ surface.querySelector('.model-status').hidden=false
291
+ $('scope').textContent='全局默认'
292
+ main.scrollTop=0
293
+ $('manage-toggle').focus()
294
+ }
295
+ $('full-management').onclick=showModels
296
+ const closeSettings=document.querySelector('[aria-label="Close Settings"]');closeSettings.disabled=false;closeSettings.onclick=()=>{showChat();$('full-management').focus()}
297
+ $('manage-toggle').onclick=()=>{manage.hidden=!manage.hidden;$('manage-toggle').setAttribute('aria-expanded',String(!manage.hidden));if(manage.hidden)closeSelector()}
298
+ const removeList=renderList
299
+ renderList=function(){removeList();if(page==='chat')document.querySelectorAll('.remove-account').forEach(b=>b.hidden=true);else document.querySelectorAll('.account-entry').forEach(row=>{if(row.querySelector('[data-account]')?.dataset.account===sessionAccount){const button=row.querySelector('.remove-account');button.disabled=true;button.title='此账号被当前 Session 显式绑定,需先解除绑定'}})}
300
+ $('search').oninput=()=>renderList()
301
+ const switchReview=document.createElement('div');switchReview.className='switch-review';switchReview.hidden=true
302
+ switchReview.setAttribute('role','group');switchReview.setAttribute('aria-label','确认关闭降级后切换账号')
303
+ switchReview.innerHTML='<strong>降级续聊已关闭</strong><p id="switch-warning"></p><p><small>旧加密推理可能无法跨账号回放。未发送新请求,不能确认它一定失败;切换不会修改历史。</small></p><div class="actions"><button id="enable-switch" class="primary">开启降级并切换</button><button id="once-switch">仅下一轮降级并切换</button><button id="keep-off-switch">保持关闭并切换</button><button id="cancel-switch-review" class="quiet">取消</button></div>'
304
+ $('selector').append(switchReview)
305
+ let pendingAccount=null
306
+ const originalChoose=choose
307
+ choose=async function(id){
308
+ const resolved=id==='follow'?globalAccount:id
309
+ if(page==='chat'&&!on()&&!once&&resolved!==effective()){
310
+ pendingAccount=id;$('switch-warning').textContent='将从 '+find(effective()).name+' 切换到 '+find(resolved).name+'。'
311
+ switchReview.hidden=false;return
312
+ }
313
+ return originalChoose(id)
314
+ }
315
+ async function applySwitch(mode){
316
+ const id=pendingAccount;if(id===null)return
317
+ switchReview.hidden=true;pendingAccount=null
318
+ if(mode==='on'){policy='on';$('session-policy').value='on'}
319
+ if(mode==='once')once=true
320
+ await originalChoose(id)
321
+ }
322
+ $('enable-switch').onclick=()=>applySwitch('on')
323
+ $('once-switch').onclick=()=>applySwitch('once')
324
+ $('keep-off-switch').onclick=()=>applySwitch('off')
325
+ $('cancel-switch-review').onclick=()=>{switchReview.hidden=true;pendingAccount=null;status('已取消切换,账号及降级策略不变。')}
326
+ const guidance=document.createElement('div');guidance.className='replay-guidance';guidance.hidden=true;guidance.setAttribute('role','alert')
327
+ guidance.innerHTML='<strong>旧推理回放被当前账号拒绝(模拟)</strong><p><small>可见消息与工具记录仍保留。开启降级后不回放旧加密推理及内嵌摘要,可能失去隐含细节。不会自动重试。</small></p><div class="actions"><button id="failure-enable" class="primary">开启本 Session 降级</button><button id="failure-once">仅下一轮降级</button><button id="failure-manage" class="quiet">管理账号与模型 →</button></div><p id="failure-next" hidden>已授权。请手动重试原任务;这里没有发送任何请求。</p>'
328
+ accountSection.append(guidance)
329
+ const failButton=document.createElement('button');failButton.id='simulate-replay-mismatch';failButton.textContent='模拟回放不一致';document.querySelector('.simulation').append(failButton)
330
+ failButton.onclick=()=>{if(!shell.hidden)showChat();surface.hidden=false;guidance.hidden=false;status('模拟供应方已明确拒绝旧回放;未执行真实推理。')}
331
+ const scenario=document.createElement('button');scenario.id='off-scenario';scenario.textContent='体验:降级关闭后 A → B'
332
+ document.querySelector('.simulation').prepend(scenario)
333
+ function startOffScenario(){
334
+ active=null;sessionAccount='1';globalAccount='1';policy='off';once=false
335
+ $('session-policy').value='off';guidance.hidden=true;$('failure-next').hidden=true
336
+ showChat();surface.hidden=false;$('policy-details').open=false
337
+ $('selector').hidden=false;$('switch').setAttribute('aria-expanded','true')
338
+ $('search').value='demo-account-02';renderList()
339
+ choose('2')
340
+ status('演示起点:个人账号 A,降级关闭。你刚选择了工作账号 B;请在确认区选择下一步。')
341
+ renderConversation('switch')
342
+ switchReview.scrollIntoView({block:'nearest'})
343
+ }
344
+ scenario.onclick=startOffScenario
345
+ const originalApplySwitch=applySwitch
346
+ applySwitch=async function(mode){
347
+ await originalApplySwitch(mode)
348
+ if(mode==='off'){
349
+ renderConversation('ready')
350
+ status('已切换到 B,降级仍关闭。下一步可模拟一次发送,观察供应方拒绝旧回放后的引导。')
351
+ sendSimulation.hidden=false
352
+ }else{sendSimulation.hidden=true;renderConversation('authorized');status('已授权降级并切换。可手动发送;这里不会执行真实推理。')}
353
+ }
354
+ const sendSimulation=document.createElement('button');sendSimulation.id='simulate-off-send';sendSimulation.textContent='模拟发送:旧回放被拒绝';sendSimulation.hidden=true
355
+ document.querySelector('.simulation').append(sendSimulation)
356
+ sendSimulation.onclick=()=>{guidance.hidden=false;sendSimulation.hidden=true;renderConversation('failed');status('模拟发送已失败:供应方拒绝旧回放。尚未开启降级,也没有自动重试。');document.querySelector('.history').scrollIntoView({block:'start'})}
357
+ function renderConversation(state){
358
+ const history=chatNode.querySelector('.history')
359
+ history.innerHTML='<div class="scenario-heading">模拟对话 · 账号 A 的历史保留在同一个 Session</div><div class="mock-message user"><small>你 · 之前使用账号 A</small><p>帮我设计一个支持多账号切换的界面。</p></div><div class="mock-message"><small>助手 · 账号 A · 模拟内容</small><p>建议平时只显示当前账号,用 Switch 打开搜索列表。完整管理放在 Models 页面。</p></div>'
360
+ if(state==='switch')history.insertAdjacentHTML('beforeend','<p class="scenario-heading">现在你准备切到账号 B。降级关闭,下方先确认切换;还没有发送下一条消息。</p>')
361
+ else{
362
+ history.insertAdjacentHTML('beforeend','<div class="mock-message user"><small>你 · 准备使用账号 B</small><p>继续刚才的方案,补上删除账号的确认流程。</p></div>')
363
+ if(state==='failed')history.insertAdjacentHTML('beforeend','<div class="mock-message failure" role="alert"><strong>这一轮失败 · 未生成回答(模拟)</strong><p>账号 B 拒绝了账号 A 历史中的旧加密推理。可见对话与工具记录仍然保留。</p><small>COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH</small><div class="actions"><button id="message-enable">开启降级续聊</button><button id="message-once">仅下一轮降级</button></div><p><small>这两个操作只授权,不会自动重发这条消息。</small></p></div>')
364
+ else history.insertAdjacentHTML('beforeend','<p class="scenario-heading">'+(state==='authorized'?'已授权降级。请手动发送上面的后续消息(模拟)。':'已切到账号 B,降级仍关闭。点击下方“模拟发送:旧回放被拒绝”查看失败状态。')+'</p>')
365
+ }
366
+ for(const [id,action] of [['message-enable','failure-enable'],['message-once','failure-once']]){
367
+ const b=document.getElementById(id);if(b)b.onclick=()=>{$(action).click();showRetry()}
368
+ }
369
+ }
370
+ function showRetry(){
371
+ const history=chatNode.querySelector('.history')
372
+ const old=document.getElementById('mock-manual-retry');if(old)return
373
+ const box=document.createElement('div');box.className='notice';box.innerHTML='<p>降级已授权。原失败消息还没有重发。</p><button id="mock-manual-retry">手动重试刚才的消息(模拟)</button>'
374
+ history.append(box)
375
+ $('mock-manual-retry').onclick=()=>{
376
+ box.innerHTML='<p>你手动重试了原消息 · 使用账号 B · 不回放旧加密推理(模拟)</p>'
377
+ history.insertAdjacentHTML('beforeend','<div class="mock-message"><small>助手 · 账号 B · 演示回答,不代表真实供应方验收</small><p>可以继续。删除账号前展示确认说明:只移除本机保存的授权,不删除对话或共享模型偏好;当前默认账号需要先切换。</p></div>')
378
+ guidance.hidden=true;status('模拟重试已完成;未执行真实请求。')
379
+ }
380
+ box.scrollIntoView({block:'nearest'})
381
+ }
382
+ $('failure-enable').onclick=()=>{policy='on';once=false;$('session-policy').value='on';$('failure-next').hidden=false;render();showRetry()}
383
+ $('failure-once').onclick=()=>{once=true;$('failure-next').hidden=false;render();showRetry()}
384
+ $('failure-manage').onclick=showModels
385
+ $('new-session').onclick=()=>{if(saving)return;active=null;sessionAccount=null;initialOn=globalOn;policy='follow';once=false;$('session-policy').value='follow';showChat();status('新模拟 Session 已继承全局默认;未创建真实会话。')}
386
+ $('credits').onclick=()=>{surface.hidden=!surface.hidden}
387
+ document.addEventListener('keydown',event=>{if(event.key==='Escape'&&!saving&&!shell.hidden&&$('selector').hidden){showChat();$('full-management').focus()}})
388
+ globalOn=true;initialOn=true;$('global-policy').checked=true
389
+ showChat()
390
+ status('降级续聊默认开启(模拟)。可展开详情关闭;每轮不回放旧加密推理,同账号也适用。')
391
+ if(new URLSearchParams(location.search).get('scenario')==='off-switch')startOffScenario()
392
+ </script>
393
+ </html>
@@ -14,12 +14,14 @@ Follow the [plugin-only boundary](../AGENTS.md#plugin-only-implementation-bounda
14
14
  4. **One credential lifecycle.** All plugin-owned routes share the canonical Host-only Copilot OAuth record. Model discovery, refresh and in-flight requests remain bound to the same account generation. Account switches, entitlement removal, disposal and stale callbacks must fail closed without copying credentials or changing other providers.
15
15
  5. **Thinking is included.** Preserve public summary deltas and final-only summaries without duplicate text. Validate selected effort and keep native default semantics. Empty or encrypted-only responses must not become fabricated explanations. Native replay, images and file projection retain their owning adapter's behavior; opaque replay is not displayed or rewritten into raw reasoning text.
16
16
  6. **Current pi 0.87.1 compatibility.** The original acceptance target was 0.85.1; official DSH rc.2 now depends on `^0.87.1`. Pin and test the exact published SDK version, not just a GitHub release label. Its Copilot GPT-6 catalog protocol must not override contrary provider endpoint evidence. An updated catalog entry is not sufficient grounds to retire a correction if the protocol/capabilities are still wrong.
17
+ 7. **Do not infer temperature support from reasoning metadata.** No verified supplier contract establishes that `capabilities.supports.thinking` means temperature is unsupported or supported. Automatic reviewer-only omission requires authenticated exact official rc.2 root callback identity through the public service-read/Loader/profile package seams and account-proven managed Responses metadata. Clone before native delegation, preserve concurrent ordinary Chat and reject unqualified identity without broad fallback. Test actual Host startup/disposal and the unchanged native reviewer/LLM/adapter pipeline, with explicit nonzero/no-skip fixture collection. The independent `github-copilot.responsesOmitTemperature` override remains default false; explicit true affects all managed Responses. Preserve frozen options, cancellation, other protocols/providers and canonical ownership. Never use prompt/model/error matching, retry a rejection, rewrite a verdict or change permissions. See [the exact public proof and limitations](./auto-review-sampling.md); previously excluded fixture execution claims stay retracted.
17
18
 
18
19
  ## Regression evidence
19
20
 
20
21
  - Include GPT-6 Astra, Gemini 3.8 Flash and GPT-5.6 Sol Fast metadata fixtures, plus arbitrary unseen IDs on all three supported protocols. The unseen-ID cases must pass without adding those IDs to implementation tables.
21
22
  - Cover missing/conflicting endpoints, missing/invalid limits, duplicate conflicting IDs, explicit denial, stale account snapshots, unsupported reasoning labels, unknown fields and hostile extra getters.
22
23
  - Exercise real published adapter/SDK code against local synthetic HTTP for all supported protocols, including tools, public summaries, two-turn opaque replay, images and interruption/retry paths. Synthetic results are not claims of live account availability.
24
+ - The exact pinned rc.2 source trace must retain the reviewer's frozen `temperature: 0` request with no `purpose`/`sessionId`. Run that unchanged native reviewer through the managed route and real pi-ai serializer: default-off preserves temperature for thinking `true`, `false`, or absent; explicit opt-in omits it for each value without mutating caller input. Cover allow, deny, malformed verdict, HTTP error and cancellation with one wire attempt; only allow may execute the synthetic tool. Qualify the fixture against tagged source and exact published artifacts. Synthetic metadata proves no supplier temperature semantics.
23
25
  - Verify managed request-body timeout guidance only for the observed HTTP `408`, exact `user_request_timeout` code and request-body message. Bound clone reads to 8 KiB/250 ms, retain the original native response, and expose only fixed guidance plus final string-body UTF-8 bytes. Preserve failure code, retry metadata, cancellation, unchanged retry payloads and independent dispatches. Do not reclassify 408 as overflow, invent a safe byte threshold, change client timeouts, refresh OAuth, compact automatically or promise elimination of upstream failures.
24
26
  - Verify byte-aware managed HTTP/SSE liveness through unchanged published and tagged adapters: heartbeat bytes may cross the original semantic deadline before actual output, but endless heartbeat-only output must hit the bounded native deadline. Real header/body stalls retain the original interval and a dispatch-local TIMEOUT; consumer think time, caller/credential cancellation, exact bytes, parser ownership and one native wire attempt remain unchanged. Explicit WebSocket/auto and opt-out retain native-only behavior. Preserve the 20 MiB native image budget by default; explicit smaller budgets must use native offload and retain mapped read-only paths/history, never hidden trimming or a claimed supplier threshold. These synthetic cases do not attest production heartbeat activity or cure HTTP 408.
25
27
  - Run source/test typechecks, complete repository tests, built Host/Client/Remote smoke, archive verification, and relevant unchanged-Core compatibility fixtures. Do not suppress type or test failures to bridge incompatible SDK versions.
@@ -81,17 +83,26 @@ exact verified scope rejection: total items, direct ID fields, reference items,
81
83
  encrypted reasoning items, unrecognized items, `previous_response_id`/`store`
82
84
  state and presence of the two native session/request headers. It observes the
83
85
  final HTTP dispatch, not the earlier SDK payload before caller replacement.
84
- Only fixed labels and counts enter the existing error; no IDs, header values,
85
- message text, arguments, results or opaque bytes are retained. The shared
86
+ Only fixed labels and counts enter the separate `dispatchEvidence` diagnostic
87
+ and Host warning; the main error stays concise and points to explicit recovery
88
+ or a new conversation. No IDs, header values, message text, arguments, results
89
+ or opaque bytes are retained. The shared
86
90
  16 MiB/depth/work diagnostic limits apply; unavailable evidence never becomes
87
- zero counts. Historical errors without this suffix have no such evidence.
91
+ zero counts. Historical errors are not rewritten; absence of captured evidence
92
+ is not zero counts.
88
93
  Structure counts alone do not repair cross-turn scope rejection: zero direct
89
94
  IDs does not prove encrypted replay is portable.
90
95
 
96
+ Switching from account A to B does not make old account/connection-bound
97
+ encrypted reasoning portable. An exact scope rejection is not proof that
98
+ sign-in failed or that a particular encrypted item was rejected. Recovery
99
+ is an explicitly authorized, lossy continuation, not a portability repair.
100
+ Starting a new conversation avoids replaying the old history.
101
+
91
102
  ### Explicit session replay recovery
92
103
 
93
104
  After an exact verified managed Responses scope rejection, **Replay recovery**
94
- in that session's composer automatically offers the failed request's old
105
+ above that session's composer automatically offers the failed request's old
95
106
  encrypted items on opening the eligible session, when its native `running`
96
107
  snapshot settles, or when its `lastAgentError` changes while idle. These public
97
108
  Session snapshot changes trigger read-only Host evidence reads, not model calls,
@@ -99,18 +110,25 @@ history reads, new durable events or polling. Normal sessions show no notice.
99
110
  Dismissal is local to the mounted model/session and evidence revision; a new
100
111
  failure can reappear. Read errors remain distinct from missing evidence.
101
112
 
102
- Choose **Review recovery options**, then **Next matching turn only** (the
103
- default choice) or **Continue in this session**, and **Accept loss and authorize**.
104
- This does not send a message or retry the failed request. Use the native Send or
105
- Retry control separately; the plugin adds no competing sender. Complete native
106
- replay remains the default until explicit consent.
107
-
108
- Next-turn consent is admitted on the next bound, matching-model native request
109
- and covers all steps and native retries of that turn, not just one HTTP attempt.
110
- It is consumed at that turn's `turn/end`, including cancelled/failed turns.
111
- Other models, purposes and unbound requests cannot consume it. Session consent
112
- survives turn endings but shares the same bounded evidence/proof lifetime.
113
- Controls are disabled during a native turn; Host checks remain authoritative.
113
+ Context evidence and recovery use the public full-width
114
+ `conversation.input.dock` with shared native secondary typography for body
115
+ text and controls. They stack above the composer rather than squeezing into
116
+ its non-wrapping statistics row. Native meters, statistics and parent DOM stay
117
+ unchanged; authorization itself still sends no message.
118
+
119
+ The normal Client offers one persistent Session policy. When off, the notice
120
+ explains the loss and offers **Enable visible-history continuation** or Cancel.
121
+ Enabling writes the same revision-checked Session policy used by account controls;
122
+ it persists across accounts/restarts until disabled, without an hourly consent.
123
+ When already on, show status and diagnostic guidance, not another authorization.
124
+ Use native Retry separately. Missing or failed policy reads have an explicit
125
+ diagnostic and Retry read, never a guessed off state or legacy authorization
126
+ fallback. No authorization duration radios or next-turn-only actions are shown.
127
+ Controls are disabled during a native turn.
128
+
129
+ The following temporary recovery mechanism and strict Remotes remain for
130
+ compatibility, not new normal UI authorization. Their one-hour evidence/proof
131
+ lifetime is not the lifetime of the persistent Session policy:
114
132
 
115
133
  This is lossy recovery, not a supplier-scope repair. Only complete normalized
116
134
  encrypted reasoning items whose entire serialized fingerprints match that
@@ -9,6 +9,7 @@ The sole admitted target is official [`dsh-v0.2.0-rc.2`](https://github.com/deep
9
9
  | Surface | Official support / remaining gap | Decision and retirement trigger |
10
10
  |---|---|---|
11
11
  | Native model adapter and SDK | Published [`@deepseek-ai/dsh-llm-pi-ai@0.2.0-rc.2`](https://registry.npmjs.org/@deepseek-ai/dsh-llm-pi-ai/-/dsh-llm-pi-ai-0.2.0-rc.2.tgz) depends on pi-ai `^0.87.1`. The native SDK now passes branded `TranscriptContext` to providers, with prompt and tools folded into system messages. | **Migrate** the plugin-owned provider bridge and estimated admission to exact pi-ai `0.87.1`; count each normalized message as a lower bound even when earlier usage anchors omit changed prefixes. Retain native transport and the same stream object. Retire this bridge only when official account-scoped metadata and admission preserve these contracts. |
12
+ | Native Auto authorization review | rc.2 `classifyRisk` is strictly fail-closed but freezes `temperature: 0` into an unscoped public `ctx.llm.stream` request; pi-ai forwards every defined Responses temperature. No verified supplier contract establishes that `supports.thinking` determines temperature compatibility. | **Retain a default-off explicit plugin override** on the managed account-discovered Responses route: `github-copilot.responsesOmitTemperature` omits temperature from every managed Responses request only when configured true. This can mitigate the reported reviewer error but changes request semantics for all requests on that protocol. Preserve the Core request, parser, cancellation, one attempt and nonmanaged routes. Never auto-enable from metadata; canonical Core-owned routes remain outside scope. Retire when a verified supplier contract or official adapter provides truthful per-request sampling compatibility and exact-source qualification preserves deny/malformed/error/cancel behavior. |
12
13
  | Profile bundle patches | Public `bundlePatchPaths` accepts a bundle's string or ordered array of patches. Signed rc.2 `dsh-web-app` lists five patches, whereas the old plugin preflight accepted only one string. | **Migrate** read-only preflight to the published resolver and compose every patch in order, rejecting malformed manifests and unsupported routing. Retire only after an official installer provides equivalent fail-closed structural admission. |
13
14
  | Models UI, authorization, Remote, Session and search | Published rc.2 package entrypoints and inspected public seams retain the rc.1 forms. The official rc.2 UI-agent-preset removes its `developerTools` injection, which this plugin does not use. | **Retain** the public Host/Client/Remote integrations and their guarded ownership. Retirement requires verified official equivalent behavior plus migration and runtime acceptance; lack of a new public seam is not evidence of complete parity. |
14
15
  | Desktop package graph | Signed descriptor has the current shared peers; pi-ai and Zod are not shared Host packages. The bundled adapter resolves pi-ai 0.87.1 and Zod separately. | **Retain** required Host peers and Client external React; do not copy bundled dependencies or patch Core. Recheck effective profile resolution before Desktop installation because a stale profile-local Host peer may shadow the bundle. |