dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5

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 (209) hide show
  1. package/AGENTS.md +439 -0
  2. package/CHANGELOG.md +875 -0
  3. package/CONTRIBUTING.md +55 -0
  4. package/LICENSE +21 -0
  5. package/README.md +366 -0
  6. package/README.zh.md +341 -0
  7. package/SECURITY.md +29 -0
  8. package/cordis.patch.yml +16 -0
  9. package/deployment-baseline.json +1580 -0
  10. package/docs/account-management-experience.md +143 -0
  11. package/docs/agent-readiness.md +110 -0
  12. package/docs/auto-high-cost.md +255 -0
  13. package/docs/auto-iteration-review.json +22 -0
  14. package/docs/auto-review-sampling.md +60 -0
  15. package/docs/auto-task-routing.md +341 -0
  16. package/docs/automatic-model-routing.md +236 -0
  17. package/docs/copilot-accounts.md +424 -0
  18. package/docs/copilot-compaction.md +148 -0
  19. package/docs/copilot-usage.md +133 -0
  20. package/docs/dual-model.md +66 -0
  21. package/docs/evidence-driven-iteration.md +86 -0
  22. package/docs/image-input-compatibility.md +64 -0
  23. package/docs/images/copilot-accounts-credits.png +0 -0
  24. package/docs/images/copilot-accounts.png +0 -0
  25. package/docs/images/copilot-current-provenance.json +39 -0
  26. package/docs/images/copilot-model-preferences.png +0 -0
  27. package/docs/images/copilot-search-routing.png +0 -0
  28. package/docs/images/copilot-session-continuation.png +0 -0
  29. package/docs/images/dual-model-desktop.png +0 -0
  30. package/docs/images/dual-model-mobile.png +0 -0
  31. package/docs/images/dual-model-provenance.json +35 -0
  32. package/docs/images/parent-model-follow.png +0 -0
  33. package/docs/manual-compaction-recovery.md +109 -0
  34. package/docs/mockups/copilot-account-dropdown.html +71 -0
  35. package/docs/mockups/copilot-account-management.html +393 -0
  36. package/docs/model-compatibility-acceptance.md +182 -0
  37. package/docs/npm-distribution.md +202 -0
  38. package/docs/official-first-016-alpha2.md +66 -0
  39. package/docs/official-first-020-rc1.md +32 -0
  40. package/docs/official-first-020-rc2.md +17 -0
  41. package/docs/official-first-021-alpha4.md +157 -0
  42. package/docs/official-first-021-alpha5.md +83 -0
  43. package/docs/plugin-diagnostics.md +605 -0
  44. package/docs/session-continuation.md +141 -0
  45. package/docs/session-search-routing.md +133 -0
  46. package/docs/single-route-migration.md +131 -0
  47. package/docs/web-lifecycle-rc2.md +55 -0
  48. package/lib/client.js +13236 -0
  49. package/lib/client.js.map +1 -0
  50. package/lib/copilot-identity-DRZY_d2X.js +15 -0
  51. package/lib/diagnostics-analysis-io.js +78 -0
  52. package/lib/diagnostics-analysis.js +427 -0
  53. package/lib/diagnostics-types-CF-qg8Do.js +708 -0
  54. package/lib/index.js +15661 -0
  55. package/lib/manual-compaction-recovery.js +485 -0
  56. package/lib/remote.js +1507 -0
  57. package/lib/request-budget-DLY_aRq0.js +87 -0
  58. package/lib/routed-web.js +120 -0
  59. package/lib/search-routing-CV2hs8as.js +792 -0
  60. package/lib/types/account-dropdown.d.ts +22 -0
  61. package/lib/types/account-model-auth.d.ts +15 -0
  62. package/lib/types/account-model-catalog.d.ts +70 -0
  63. package/lib/types/account-model-source.d.ts +85 -0
  64. package/lib/types/agent-compaction.d.ts +4 -0
  65. package/lib/types/authorization-code-clipboard.d.ts +4 -0
  66. package/lib/types/authorization-controller.d.ts +121 -0
  67. package/lib/types/auto-allocation-card.d.ts +9 -0
  68. package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
  69. package/lib/types/auto-allocation-evidence.d.ts +44 -0
  70. package/lib/types/auto-allocation.d.ts +47 -0
  71. package/lib/types/auto-assessment-evidence.d.ts +111 -0
  72. package/lib/types/auto-model-host.d.ts +30 -0
  73. package/lib/types/auto-model-intent.d.ts +36 -0
  74. package/lib/types/auto-model-presentation.d.ts +57 -0
  75. package/lib/types/auto-model-routing.d.ts +64 -0
  76. package/lib/types/auto-review-sampling.d.ts +6 -0
  77. package/lib/types/auto-selection-explanation.d.ts +9 -0
  78. package/lib/types/auto-task-assessment.d.ts +49 -0
  79. package/lib/types/auto-task-classifier.d.ts +10 -0
  80. package/lib/types/background-compaction.d.ts +30 -0
  81. package/lib/types/client.d.ts +129 -0
  82. package/lib/types/compact-account.d.ts +42 -0
  83. package/lib/types/compaction-continuation-ui.d.ts +29 -0
  84. package/lib/types/compaction-continuation.d.ts +48 -0
  85. package/lib/types/compaction-input-estimate.d.ts +28 -0
  86. package/lib/types/compaction-pressure.d.ts +23 -0
  87. package/lib/types/compaction-replay.d.ts +18 -0
  88. package/lib/types/compatibility.d.ts +17 -0
  89. package/lib/types/composer-notice-style.d.ts +7 -0
  90. package/lib/types/config.d.ts +141 -0
  91. package/lib/types/content-file.d.ts +10 -0
  92. package/lib/types/context-evidence-ui.d.ts +28 -0
  93. package/lib/types/context-evidence.d.ts +256 -0
  94. package/lib/types/context-usage.d.ts +4 -0
  95. package/lib/types/copilot-account-presentation.d.ts +7 -0
  96. package/lib/types/copilot-accounts-card.d.ts +43 -0
  97. package/lib/types/copilot-accounts-host.d.ts +93 -0
  98. package/lib/types/copilot-accounts-remote.d.ts +85 -0
  99. package/lib/types/copilot-accounts-types.d.ts +43 -0
  100. package/lib/types/copilot-auth.d.ts +31 -0
  101. package/lib/types/copilot-grant.d.ts +11 -0
  102. package/lib/types/copilot-identity.d.ts +11 -0
  103. package/lib/types/copilot-request.d.ts +11 -0
  104. package/lib/types/copilot-stream-liveness.d.ts +23 -0
  105. package/lib/types/copilot-usage-card.d.ts +51 -0
  106. package/lib/types/copilot-usage-host.d.ts +61 -0
  107. package/lib/types/copilot-usage-normalize.d.ts +9 -0
  108. package/lib/types/copilot-usage-remote.d.ts +63 -0
  109. package/lib/types/copilot-usage-types.d.ts +20 -0
  110. package/lib/types/copilot-usage-ui.d.ts +4 -0
  111. package/lib/types/current-provider.d.ts +59 -0
  112. package/lib/types/deepseek-search-fallback.d.ts +11 -0
  113. package/lib/types/diagnostics-analysis-io.d.ts +23 -0
  114. package/lib/types/diagnostics-analysis.d.ts +298 -0
  115. package/lib/types/diagnostics-card.d.ts +12 -0
  116. package/lib/types/diagnostics-client.d.ts +13 -0
  117. package/lib/types/diagnostics-collector.d.ts +50 -0
  118. package/lib/types/diagnostics-host.d.ts +183 -0
  119. package/lib/types/diagnostics-remote.d.ts +113 -0
  120. package/lib/types/diagnostics-types.d.ts +893 -0
  121. package/lib/types/dual-model-host.d.ts +119 -0
  122. package/lib/types/dual-model-remote.d.ts +63 -0
  123. package/lib/types/dual-model-types.d.ts +34 -0
  124. package/lib/types/external-link.d.ts +3 -0
  125. package/lib/types/failure.d.ts +38 -0
  126. package/lib/types/http.d.ts +48 -0
  127. package/lib/types/image-input-admission.d.ts +5 -0
  128. package/lib/types/index.d.ts +39 -0
  129. package/lib/types/manual-compaction-recovery.d.ts +67 -0
  130. package/lib/types/migration-status.d.ts +50 -0
  131. package/lib/types/model-exclusions.d.ts +15 -0
  132. package/lib/types/model-preferences-card.d.ts +9 -0
  133. package/lib/types/model-protocol.d.ts +31 -0
  134. package/lib/types/native-select-style.d.ts +4 -0
  135. package/lib/types/native-settings-style.d.ts +10 -0
  136. package/lib/types/parent-model-follow-card.d.ts +32 -0
  137. package/lib/types/parent-model-follow.d.ts +44 -0
  138. package/lib/types/pi-provider-bridge.d.ts +22 -0
  139. package/lib/types/plan.d.ts +148 -0
  140. package/lib/types/pre-step-pressure.d.ts +8 -0
  141. package/lib/types/preview-provider.d.ts +77 -0
  142. package/lib/types/preview-route.d.ts +76 -0
  143. package/lib/types/probe.d.ts +39 -0
  144. package/lib/types/remote-codec.d.ts +10 -0
  145. package/lib/types/remote.d.ts +202 -0
  146. package/lib/types/replay-recovery-host.d.ts +28 -0
  147. package/lib/types/replay-recovery-remote.d.ts +14 -0
  148. package/lib/types/replay-recovery-types.d.ts +24 -0
  149. package/lib/types/replay-recovery-ui.d.ts +28 -0
  150. package/lib/types/replay-recovery.d.ts +17 -0
  151. package/lib/types/request-body-composition.d.ts +17 -0
  152. package/lib/types/request-body-evidence.d.ts +37 -0
  153. package/lib/types/request-body-timeout-marker.d.ts +2 -0
  154. package/lib/types/request-body-timeout.d.ts +4 -0
  155. package/lib/types/request-budget.d.ts +58 -0
  156. package/lib/types/request-diagnostics.d.ts +278 -0
  157. package/lib/types/request-upload-evidence.d.ts +23 -0
  158. package/lib/types/response-error-body.d.ts +3 -0
  159. package/lib/types/responses-reasoning-text.d.ts +24 -0
  160. package/lib/types/responses-reasoning.d.ts +7 -0
  161. package/lib/types/responses-replay-compat.d.ts +31 -0
  162. package/lib/types/responses-request-compression.d.ts +33 -0
  163. package/lib/types/route-ownership.d.ts +70 -0
  164. package/lib/types/routed-web.d.ts +50 -0
  165. package/lib/types/search-backend.d.ts +16 -0
  166. package/lib/types/search-routing-host.d.ts +19 -0
  167. package/lib/types/search-routing-policy.d.ts +18 -0
  168. package/lib/types/search-routing-remote.d.ts +20 -0
  169. package/lib/types/search-routing.d.ts +43 -0
  170. package/lib/types/search-tool-routing.d.ts +22 -0
  171. package/lib/types/serialize.d.ts +106 -0
  172. package/lib/types/session-accounts-controller.d.ts +20 -0
  173. package/lib/types/session-accounts-host.d.ts +33 -0
  174. package/lib/types/session-accounts-remote.d.ts +114 -0
  175. package/lib/types/session-accounts.d.ts +38 -0
  176. package/lib/types/session-continuation-host.d.ts +45 -0
  177. package/lib/types/session-continuation-remote.d.ts +22 -0
  178. package/lib/types/session-continuation-types.d.ts +62 -0
  179. package/lib/types/session-continuation-ui.d.ts +49 -0
  180. package/lib/types/session-continuation.d.ts +14 -0
  181. package/lib/types/settings-reader.d.ts +16 -0
  182. package/lib/types/sse.d.ts +28 -0
  183. package/lib/types/temporary-models.d.ts +25 -0
  184. package/lib/types/tool-schema-compat.d.ts +17 -0
  185. package/lib/types/traditional-search.d.ts +17 -0
  186. package/lib/types/turn-model-provenance.d.ts +45 -0
  187. package/lib/types/turn-request-models.d.ts +55 -0
  188. package/lib/types/turn-selection-card.d.ts +24 -0
  189. package/lib/types/turn-selection-host.d.ts +35 -0
  190. package/lib/types/turn-selection-remote.d.ts +17 -0
  191. package/lib/types/turn-selection.d.ts +186 -0
  192. package/lib/types/turn-usage-evidence.d.ts +66 -0
  193. package/lib/types/turn-usage-notice.d.ts +7 -0
  194. package/lib/types/types.d.ts +69 -0
  195. package/lib/types/usage.d.ts +26 -0
  196. package/lib/types/watchdog.d.ts +22 -0
  197. package/lib/types/web-delegate.d.ts +12 -0
  198. package/lib/types/web-search-routing-card.d.ts +16 -0
  199. package/lib/types/web-search-routing-config.d.ts +12 -0
  200. package/lib/types/wire-anthropic.d.ts +37 -0
  201. package/lib/types/wire.d.ts +56 -0
  202. package/lib/web-delegate.js +9 -0
  203. package/output/auto-model-mockup/index.html +207 -0
  204. package/package.json +261 -0
  205. package/scripts/analyze-diagnostics.mjs +91 -0
  206. package/scripts/check-search-composition.mjs +191 -0
  207. package/scripts/iteration-review.mjs +53 -0
  208. package/scripts/release-policy.mjs +353 -0
  209. package/scripts/select-core-release.mjs +11 -0
@@ -0,0 +1,133 @@
1
+ # Copilot account usage
2
+
3
+ The optional composer control separates three quantities:
4
+
5
+ | Quantity | Scope | Rule |
6
+ | --- | --- | --- |
7
+ | Context occupancy | Current native request/context window | Remains owned by DSH's native meter. |
8
+ | Account usage and remaining allocation | Authorized GitHub account quota snapshot | Display only validated provider quota data; identify stale snapshots explicitly. Do not claim cross-application aggregation. |
9
+ | Session credits | Complete provider-reported usage attributable to this DSH Session | Not displayed because the supported adapter does not supply it. Do not infer it from tokens, cost estimates or account balance changes. |
10
+
11
+ ## Presentation
12
+
13
+ The control is an additive `conversation.composer.dock` contribution for the current Copilot Session. It does not replace the composer, move native DOM nodes, modify global defaults, switch a model or enroll other Sessions. Native context occupancy and the new account budget are not interchangeable.
14
+
15
+ The compact control shows reported usage and remaining allocation where available. Its details explain the unit, budget, reset timestamp, freshness and unavailable data. Legacy premium requests must never be relabeled AI credits. A pooled organization account can have absolute credits used without a personal denominator; it does not imply unlimited use or expose a knowable organization balance. Percentage-only data must not create falsely precise absolute amounts.
16
+
17
+ The account extension described in [Copilot accounts](./copilot-accounts.md)
18
+ adds a readonly GitHub identity under the details title. Models retains account
19
+ authorization and the global default. Managed Sessions can select an already
20
+ authorized account inside Credits for subsequent turns, or restore global
21
+ inheritance; running turns remain on their frozen account. Identity and quota
22
+ must carry matching Session-account evidence before they are presented together.
23
+ Failure to read identity is not a different account or a zero balance.
24
+
25
+ Detailed amounts are rounded to two decimal places for display; a positive amount below 0.01 is shown as `<0.01`, not zero. GitHub billing remains authoritative. Known individual budgets at 90% used show a low-budget warning, not a spending restriction. The plan link uses the supported Desktop browser handoff with a selectable URL fallback. Details use the browser's native popover top layer when available and a fixed-position fallback otherwise; no additional ReactDOM copy or private Core DOM access is introduced.
26
+
27
+ Provider or Session changes, unmounting and missing supported runtime seams revoke the presentation's ownership. Optional capability failure must not disable sign-in, Models, search or ordinary chat. The installed/loaded Client determines the exact dock placement; the standalone design mockup is not proof of native placement.
28
+
29
+ ## Historical context evidence
30
+
31
+ Official rc.2 can replace the native context-pressure sample with the adapter's all-zero usage on a failed attempt. The message breakdown is a separate heuristic projection, so a native `0%` reading can coexist with substantial message tokens. Neither that zero nor the breakdown proves the current exact occupancy.
32
+
33
+ The managed route preserves native usage chunks immediately, including all-zero samples before error or aborted finishes. Usage is shared accounting evidence, not a context-only signal. The former terminal-zero filter was removed in alpha.87 (#270): dropping a sample to protect context pressure also made Core's whole-turn accounting unavailable. Numeric zero alone cannot distinguish the SDK's default from an explicit supplier report, so the plugin neither deletes it nor certifies it as a billing receipt. Native context pressure may consequently show zero after failure; the separate disclosure explains uncertainty instead of modifying Core's meter. No retry, compaction, trimming or model switch is added.
34
+
35
+ Owned byte-idle and replay errors must also wait until the native terminal chunk before restoring their structured failure. Throwing as soon as the provider observer identifies that error can discard the SDK's preceding usage chunk, including real nonzero prompt usage. Restoring the error must not drop that sample or change the native chunk order. This correction does not manufacture a receipt when the SDK reports only zero.
36
+
37
+ The official rc.2 `contextPressure` projection uses the latest usage from both successful messages and failed attempts. A failed all-zero sample can therefore replace its numerator with zero while earlier cumulative Session tokens remain large. This display projection is separate from `TokenMeter.measure()`: the public request estimator checks a usage anchor against the complete surface estimate and reprices when that anchor is too small. A zero ring does not prove either an empty request or a zero admission estimate. The supported public APIs do not let this plugin replace that native ring; repairing its uncertainty presentation belongs to a separately authorized Core task.
38
+
39
+ The time beside **Retried model request** is the recorded retry backoff, not the duration of the preceding network request. A verified `408 / user_request_timeout` describes a supplier request-body timeout, whereas semantic/byte-idle, transport, rate-limit and local admission errors are distinct. Count failed `assistant/attempt` settlements rather than counting their repeated `llm/retry` diagnoses as additional network attempts. No screenshot with collapsed details or unrelated Session receipt establishes the exact supplier or proxy root cause. Native retry policy is retained; see [request-body timeout guidance](./copilot-compaction.md).
40
+
41
+ The separate, strict `githubCopilotContextEvidence` session projection reads only routing and numeric usage from ordinary durable events. It keeps the last applicable input-plus-cache sample when a failed all-zero attempt is replayed. Model changes, compaction, surface replacement, conflicting source attribution and invalid metadata revoke the sample. It never reads message content or opaque replay, registers under a Core key, changes the native pressure projection, or rewrites durable history.
42
+
43
+ An additive composer disclosure identifies only a concrete failed-zero or invalid-sample incident for the current open Copilot Session. Ordinary request progress, a newly opened step and absence of a fresh sample do not create a warning. Any retained count is explicitly a **historical input sample, not current occupancy**; no capacity or percentage is inferred, and the copy does not assert what the separate native meter currently displays. The native context ring and account Credits control remain separate and unchanged. Missing, malformed or otherwise unknown projection/slot/runtime evidence produces a named diagnostic instead of a success-shaped UI or guessed count.
44
+
45
+ Compaction feedback shares this disclosure without turning sampling absence into a second warning. **Compaction completed** requires a matching native checkpoint and successful end, or the account-bound Host's confirmed native commit. The existing eight-second result can separately report a subsequent request outcome; running, failed, cancelled and unconfirmed compaction outcomes remain distinct. Once that transient result expires, ordinary post-compaction steps stay quiet unless they produce a concrete sampling incident. The native expandable **Context compacted** history row remains unchanged.
46
+
47
+ The independent projection retains only the latest compaction bracket, subsequent ordinary-request evidence and latest sequenced sampling incident. A normal successful settlement after that bracket is reported separately from an applicable input-plus-cache sample. It observes public step/header and same-step source/terminal metadata, including unchanged-header steps and retries; summary output is never a subsequent chat success. Missing usage can coexist with request success without becoming an incident. A failed zero or malformed/conflicting usage sample creates an incident; a later applicable valid sample clears it. Model changes, compaction and surface replacement revoke the old incident rather than allowing it to reappear for another route. A recorded post-compaction count is still historical, not exact current occupancy. No extra test message, automatic retry, content/replay read, durable event or replacement percentage is added. Projection state version 3 requests a native refold, not history conversion.
48
+
49
+ The transient commit/loss status follows the eight-second completion expiry and manual Close rules. Its registration-owned presentation bound moves with the notice into the context UI. A separate bounded Client presentation remembers dismissal by Session and incident sequence across ordinary remounts and Session switches. Dismissal hides only that incident; a newer independent incident can notify, and a later applicable valid sample clears the projection incident. Registration teardown or bounded eviction may discard presentation-only dismissal. Native compaction history remains expandable throughout.
50
+
51
+ Local synthetic tests establish native-stream preservation, historical-fold and presentation behavior only. Exact published-adapter and public-registry acceptance, complete CI, publication and loaded Desktop state must be verified separately. No live provider call or Session restart is needed for these tests.
52
+
53
+ ## Missing completed-turn Usage
54
+
55
+ ### Observed plugin/Core integration gap (#259)
56
+
57
+ One observed completed turn contained 57 successful assistant messages with reported usage and one failed `assistant/attempt` without a usage sample. That attempt recorded the plugin's exact local estimated-input-budget diagnostic: 796299 estimated tokens exceeded a 781113-token input budget, before provider dispatch. Native compaction recovered and the subsequent steps completed. No conversation content, credentials or opaque replay is needed to explain this observation; the exact loaded plugin bytes were not independently attested.
58
+
59
+ Official rc.2 `deriveTurnTokenUsage` requires complete lifecycle and exact usage for every attempt. One attempt without a sample makes its whole-turn result unavailable, so `TurnTailNodeView` omits native Usage. This is Core's existing fail-closed accounting rule triggered by our preventive pressure path, not evidence that all requests had no usage and not a regression in single-model exclusion saves.
60
+
61
+ ### Cancelled and failed terminal samples (#270)
62
+
63
+ Cancellation does not inherently disable official rc.2 turn accounting: a complete lifecycle with a valid sampled aborted attempt remains eligible. Before alpha.87, the managed terminal-zero filter removed such samples. For example, a successful 120-token step followed by a zero-sampled cancelled step retained Session cumulative counts but lost the entire turn total after filtering. The route now forwards native samples unchanged; historical context evidence still treats failed zero as unreliable, independently of accounting.
64
+
65
+ This is not a promise that every cancelled turn has complete or exact supplier usage. Responses may end before the supplier's final receipt and the SDK may emit its initialized zero. Missing lifecycle, unsampled attempts, pre-dispatch budget failures and native/plugin timeout interruption remain distinct limitations. No prior history is rewritten and no missing sample, partial total or billing amount is invented. Existing native usage already emitted before an error must not be removed for context-only diagnostics.
66
+
67
+ ### Plugin-local explanation
68
+
69
+ A plugin-owned public conversation definition retains bounded counts of settlements without reported samples and finish-only attempts with the exact recorded local diagnostic. On a completed Copilot reply whose native tail has no `tokenUsage`, the additive assistant-actions control opens **Turn Usage incomplete** (previously **Turn Usage unavailable**). It uses the incumbent nonmodal popover pattern rather than expanding the native fixed-height footer.
70
+
71
+ The explanation distinguishes recorded local budget blocks, same-settlement request-body timeout diagnoses, other settlements without samples, and missing turn-start/projection evidence. A timeout is recognized only from the shared bounded plugin diagnostic marker on that settlement's unambiguous error finish, never from a neighboring message, generic `408` text or cancellation. The disclosure copies no raw failure text or payload. It retains at most eight timeout details containing only recorded step/event sequence numbers and a recovery boolean, while keeping the full saturating diagnostic count. These are original record coordinates, not invented attempt numbers or navigation links. Unknown coordinates remain unknown. Older count-only projections remain readable; projection state version 2 requests refolding without converting history.
72
+
73
+ A successful retry claim requires strictly increasing event sequences and the same turn/step through the failed `assistant/attempt`, `llm/retry`, matching `llm/retry-started` (same retry ID and ordinal), and an `assistant/message` with an unambiguous successful `stop` finish. Missing, interrupted or mismatched chains remain uncertain. A later arbitrary successful reply or another step is not recovery evidence. This intentionally conservative recognition does not claim that an unrecognized retry failed. Even a confirmed retry cannot fill the failed attempt's usage; the native whole-turn total stays unavailable and billing remains unknown.
74
+
75
+ Generic provider overflow is never labeled pre-dispatch. Invalid reported samples and missing lifecycle boundaries can also make native accounting unavailable; if no cause is established, the explanation remains unknown rather than reimplementing the native validator. Projection and selection Remote failures remain independent, with named diagnostics; Retry only rereads selection evidence, never inference or accounting.
76
+
77
+ The control is historical evidence, not current context occupancy, account credits, dispatch attestation or a supplier receipt. It adds no token sum or fabricated zero usage, changes no native projection key, reads no opaque replay, and rewrites no history. Native complete Usage suppresses the explanation. Ordinary pressure protection, compaction transactions, errors, cancellation and retry remain unchanged. Removing the plugin removes the explanation without a data migration.
78
+
79
+ Synthetic unit/UI tests and exact unchanged Core accounting/registry fixtures prove these boundaries, not live provider receipts or loaded Desktop behavior. A native representation for unbilled pre-dispatch attempts may eventually remove the gap, but would require a separately requested upstream scope; it is not a prerequisite for this plugin-local explanation. Retire the companion diagnostic when native public presentation communicates the same uncertainty and the supported-version acceptance is verified.
80
+
81
+ ## Account data boundary
82
+
83
+ The Host uses the selected account's OAuth grant through public credential APIs,
84
+ with `llm-pi-ai/github-copilot` retained for canonical compatibility. GitHub's
85
+ `copilot_internal/user` endpoint uses the GitHub grant, not a quota-specific
86
+ sign-in or a newly pasted token. Access-token renewal remains owned by pi-ai;
87
+ quota inspection must not introduce a refresh implementation or credential
88
+ persistence. The account-record extension has its own explicit ownership
89
+ contract in [Copilot accounts](./copilot-accounts.md).
90
+
91
+ Quota requests are lazy, single-flight and bounded by timeout, response size and cache/failure policy. Account continuity is checked around asynchronous work and before releasing cached data. Authentication denial, sign-out, account invalidation or disposal must not release a previous account's snapshot. A same-account transient failure may expose a timestamped last-known snapshot, never a current balance. Responses and diagnostics exclude tokens and raw provider bodies. An opaque plugin account identifier may bind a snapshot to readonly identity; it is not a token fingerprint or billing identifier. Requests do not follow redirects with the credential; custom enterprise hosts are not guessed.
92
+
93
+ The plugin's default quota fetch lazily creates one request-scoped Undici agent for `https://api.github.com/copilot_internal/user`. It unions and deduplicates `tls.getCACertificates('default')` (including any configured extra CA certificates) and `tls.getCACertificates('system')`, with `rejectUnauthorized: true`. Node 22.19.0 provides both CA APIs; Undici 6 supports that runtime floor. The agent is reused for refreshes and destroyed on controller disposal. Injected test fetchers bypass the agent. No global dispatcher, environment variable, Desktop trust preference, model/search transport or credential owner is changed.
94
+
95
+ This removes reliance on a Desktop launcher inheriting `NODE_USE_SYSTEM_CA=1` for **quota requests only**. On a machine where Watt Toolkit / Steam++ installs a trusted Windows root, quota worked under a correctly environmented launch, then failed when a recovery launcher omitted the process variable despite its persistence in HKCU; a normal manual relaunch restored quota. That is operational evidence for the launcher-inheritance explanation, not proof that this new plugin build has been installed or loaded. Other Desktop traffic, including sign-in and models, still follows its existing process-level trust configuration. If system CA retrieval or agent creation fails, the quota shows `COPILOT_USAGE_TRUST_UNAVAILABLE` without issuing a request or weakening TLS. Certificate verification failures still show `COPILOT_USAGE_TLS`; other fetch failures remain `COPILOT_USAGE_NETWORK`. No diagnostic alone proves proxy routing, authorization or a live balance. Inspect approved Host trust/proxy settings without disabling TLS validation. When unavailable, details show guidance instead of implying a budget. The popover background is opaque even if the host's menu token contains transparency.
96
+
97
+ The Client receives only the separate strict `githubCopilotUsage` namespace (`get` and `refresh`). Existing authorization and migration methods retain their schemas. Refresh does not change settings, budget, plan, model selection or billing policy. This meter is informational and does not authorize spending or implement a budget enforcement loop.
98
+
99
+ ## Source contracts and limitations
100
+
101
+ GitHub's internal client endpoint is not a stable public third-party REST contract. The existing grant may not be permitted to read it, and its schema may change. Failure must remain visible rather than falling back to an administrator token, another account, a browser token or fabricated numbers.
102
+
103
+ Verified reference sources:
104
+
105
+ - [Official VS Code account snapshot types](https://github.com/microsoft/vscode/blob/44825207bf4389c3bd17c92d3ec28cf784c324cc/src/vs/base/common/defaultAccount.ts).
106
+ - [Official quota normalization and pooled-account semantics](https://github.com/microsoft/vscode/blob/44825207bf4389c3bd17c92d3ec28cf784c324cc/src/vs/workbench/services/chat/common/chatEntitlementService.ts).
107
+ - [Official quota fetch and per-turn credit accounting](https://github.com/microsoft/vscode/blob/44825207bf4389c3bd17c92d3ec28cf784c324cc/extensions/copilot/src/platform/chat/common/chatQuotaServiceImpl.ts).
108
+ - [GitHub's public organization/enterprise usage reporting API](https://docs.github.com/en/rest/copilot/copilot-usage-metrics) and [report fields](https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics). Daily administrator reports are not a live personal balance API.
109
+ - [GitHub's explanation of used credits with no individual budget](https://github.blog/changelog/2026-07-20-copilot-users-can-now-see-ai-credits-used-per-billing-cycle/).
110
+
111
+ The internal client observes per-turn `copilot_usage.total_nano_aiu`, but existence in another client's wire response is not evidence that the supported DSH/pi adapter exposes complete session accounting to plugins. On the exact alpha.2 source, [`mapUsage`](https://github.com/deepseek-ai/deepseek-harness/blob/ddefc45fbc7f8e46dd73185e68295696d1297887/packages/llm/llm-pi-ai/src/stream.ts) maps only token counts and cache counts into the public [`StreamChunk` usage contract](https://github.com/deepseek-ai/deepseek-harness/blob/ddefc45fbc7f8e46dd73185e68295696d1297887/packages/llm/llm/src/types.ts). Opaque replay state is not an accounting escape hatch. Until an unchanged public seam provides attributable, deduplicated receipts for ordinary calls, retries and background activity, per-session credit values are not displayed.
112
+
113
+ Synthetic tests cover parsing, lifecycle, failure states, strict transport and UI. They do not establish production quota permissions, billing latency, live OAuth/model transport, installed Desktop bytes or loaded plugin state. No real account calls are made merely to generate test evidence.
114
+
115
+ ## Current Session and responsive presentation
116
+
117
+ The control uses public `useSession(selector)` for only the current open,
118
+ non-removed Session, with public `useProjection('modelSelection')`. Acceptance
119
+ must include positive rendering on canonical and managed routes, reactive
120
+ provider/Session changes and disposal. A registered or hidden signed-out entry
121
+ alone proves neither rendering nor live account permission.
122
+
123
+ The unavailable Session credits section is omitted rather than permanently displaying a placeholder. Reset metadata is optional and independent from validated quota amounts: missing, malformed, zero or elapsed values are ignored. Select a supplier-reported next reset later than the snapshot observation, preferring the snapshot timestamp before valid UTC account, account or limited-user dates; never invent the next billing date. Invalid optional date metadata does not discard otherwise valid account amounts. The Client also hides reset rows without a known observation time or a later reset.
124
+
125
+ The compact control uses the native secondary font-size and line-height tokens, tertiary text color and pill padding. It stays one line within its allocated width, with ellipsis and a full-label tooltip if a single reading is wider than the available space. The complete reading remains its accessible button text; exact supplied amounts and account-wide scope remain available in the independent details dialog. Loading and unavailable text use the same bounds without extra quota requests.
126
+
127
+ The host owns placement of the existing public dock entries. On a shared-row host, the usage entry follows the native statistics group and can appear immediately after Cache hit; on an older stacked host, it retains that host's placement. The plugin neither relocates native DOM nor overrides native statistics styles, and it does not require a modified Core to activate. A separately authorized Desktop Client layout task owns wrapping and actual assembled native-statistics geometry checks.
128
+
129
+ Official rc.2 retains the shared dock row in [`InputBar.module.css`](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/client/ui-conversation/src/client/skeleton/InputBar.module.css) and intrinsic native statistics group in [`StatsPills.module.css`](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/client/ui-chat/src/client/chat/StatsPills.module.css). Reuse that official presentation primitive rather than inventing another statistics Slot or copying its token calculations. Wide/narrow layout and popup acceptance must use actual native components alongside the released Client; standalone plugin tests or a synthetic sibling label are not proof of native Cache hit alignment.
130
+
131
+ ## Official-first retirement
132
+
133
+ Retain this bounded companion feature only while native DSH lacks equivalent public account-usage presentation for the required scope. Migrate to native functionality once equivalent data semantics, account invalidation, session attribution, accessible presentation and supported-version acceptance are verified. Do not require a Core patch or add a parallel model transport to complete this integration.
@@ -0,0 +1,66 @@
1
+ # Retired Copilot model roles
2
+
3
+ Compatibility guide for existing planner/executor histories. **Model roles**
4
+ and dedicated-root creation are retired; they are not current setup features.
5
+ Use ordinary Sessions and native subagents for new work. The separate
6
+ [Follow parent model](./parent-model-follow.md) policy supports ordinary children
7
+ without restoring role UI or depending on upstream native rules/settings UI.
8
+
9
+ ## Existing histories
10
+
11
+ - Saved `github-copilot-dual-model` settings stay intact but are not writable
12
+ through the retired role Remote. No migration/deletion runs on activation.
13
+ - Existing dedicated roots/children retain captured policy, routes and history.
14
+ Their `copilot_execute` tool is compatibility for existing work, not a way to
15
+ create new roots or enroll ordinary Sessions.
16
+ - Policy restrictions are workflow controls, not a shell-code sandbox.
17
+ Uninstalling the plugin is not a supported conversion to ordinary Sessions.
18
+ - Do not use the ordinary picker to change a dedicated role:
19
+ `DUAL_MODEL_SELECTION_LOCKED` remains. Start an ordinary Session rather than
20
+ stripping policy from history, replaying work or substituting another model.
21
+
22
+ ## Legacy Remotes
23
+
24
+ Three strict descriptors retain their identities:
25
+
26
+ | Method | Current behavior |
27
+ |---|---|
28
+ | `view()` | Read-only `supported: false`, `writable: false`, `DUAL_MODEL_RETIRED`; no account discovery |
29
+ | `save()` | Validates input, then rejects `DUAL_MODEL_RETIRED`; no write |
30
+ | `create()` | Recovers only an already-created root matching original UUID, workspace and revision |
31
+
32
+ Conflicting/uncertain recovery is not evidence of absence or permission to
33
+ retry with another UUID. Exact recovery can complete the original attachment;
34
+ it creates no new root and is not automatic browser replay.
35
+
36
+ Native `subagent/descriptor` v3 is required; the old v1 assumption was a plugin
37
+ bug, not a history migration. Projection `stateVersion: 2` refolds without
38
+ conversion. Unknown/v1/v2, invalid or conflicting descriptors fail closed.
39
+ Never relabel them or fabricate policy provenance. Strict `create()` codec
40
+ factories and the retained `schema` bridge use the same parser.
41
+
42
+ ## Evidence and historical material
43
+
44
+ Client tests prove removed role dependencies/slots alongside preserved account,
45
+ search and usage cleanup. Host/Gateway fixtures prove rejected new roots/writes,
46
+ original-request recovery and historical policy restoration. Synthetic tests
47
+ do not prove a particular Desktop's loaded state or live inference.
48
+
49
+ The [retirement issue](https://github.com/cloga/dsh-github-copilot/issues/158),
50
+ [original design](https://github.com/cloga/dsh-github-copilot/issues/127) and
51
+ [historical official-first review](./official-first-016-alpha2.md) retain context.
52
+ Old role images/provenance under `docs/images` are historical artifacts, not
53
+ current screenshots or installation instructions.
54
+
55
+ ## 中文摘要
56
+
57
+ 模型分工与新建专用根会话已退役;新工作使用普通 Session。独立的父模型跟随
58
+ 开关不恢复旧角色界面,也不依赖上游原生规则 UI。已有专用历史、固定策略和
59
+ 旧设置原样保留;旧 Remote 只读/拒绝保存,仅允许凭完全匹配原请求恢复已有根。
60
+ 不转换历史、不静默换模型、不用新 UUID 绕过未知恢复,也不将卸载当作迁移。
61
+ 发布、安装、加载和真实模型调用须分别验证。
62
+ ## Alpha.25 descriptor and Remote compatibility
63
+
64
+ Retained native child compatibility uses descriptor v3 and strict Remote codecs.
65
+ Unknown/v1/v2 or invalid child descriptors fail closed without relabeling.
66
+ Projection `stateVersion: 2` refolds evidence; it does not convert history.
@@ -0,0 +1,86 @@
1
+ # Evidence-driven iteration
2
+
3
+ Complex features must retain the link between observations, decisions and
4
+ follow-up evaluation. A dashboard alone does not ensure contributors read the
5
+ evidence. Auto is the first required pilot (#332).
6
+
7
+ ## Before implementation
8
+
9
+ Read the last feature review and unresolved follow-up. State whether the
10
+ hypothesis is retained, changed or deferred. Declare policy version, observation
11
+ window, denominator and limitations: `observed`, `not-collected`,
12
+ `insufficient-sample` or `unavailable`. Missing data is not a passing result.
13
+ Define the expected improvement, guardrails and sample sufficiency before
14
+ analysis. Total turns alone are insufficient when candidate opportunities differ.
15
+
16
+ Record alternative validation when live observations are absent. Synthetic
17
+ distribution tests, types and native fixtures do not prove real workload quality,
18
+ billing or live activation. A review is not permission to implement everything
19
+ previously discussed or collect sensitive data.
20
+
21
+ ## Required Auto review
22
+
23
+ `docs/auto-iteration-review.json` is the latest repository-safe decision record.
24
+ The Auto task plan starts by validating and reading it before implementation:
25
+
26
+ ```sh
27
+ node scripts/iteration-review.mjs --report docs/auto-iteration-review.json
28
+ ```
29
+
30
+ The bounded dependency-free command validates structure, not the truth of
31
+ conclusions. It never scans profiles, calls DSH, reads credentials or uploads
32
+ data. Unknown fields are rejected; invalid input is not echoed. Human review is
33
+ still necessary to remove sensitive prose.
34
+
35
+ For routing, assessment, cost weights, continuity or assistance-policy PRs,
36
+ reference the review and its status, policy version, window/sample denominator,
37
+ decision and validation. Name the post-delivery review owner, trigger, metric
38
+ and action. Unrelated changes use N/A. CI checks the report and workflow wiring;
39
+ it cannot prove an author read the data or understood it.
40
+
41
+ ## Measurement contract
42
+
43
+ - Count decisions once per Agent/turn. Tool steps and retries are not new
44
+ decisions. Selected, attempted, delivered, finished, failed, cancelled and
45
+ unknown have different denominators; completion is not task success.
46
+ - For each eligible final-pool candidate capture effective weight, opportunity
47
+ and conditional expected share. Compare summed expected versus actual
48
+ selections, not raw percentages that ignore eligibility.
49
+ - Split category/eligibility changes from within-pool allocation and continuity.
50
+ Keep policy versions and candidate-set changes separate. Stable deterministic
51
+ seeds do not establish independent random trials.
52
+ - Record assessment source/outcome and timing only at observable boundaries;
53
+ adapter-first-text is not HTTP-first-byte.
54
+ - Do not infer credits from tokens, balance deltas or incomplete usage.
55
+ Unknown costs stay unavailable. Cache rates do not prove switching losses.
56
+
57
+ The first high-cost implementation retains bounded, local Host-lifetime
58
+ selection observations. At most 64 live Agent owners and 128 turns per owner
59
+ are retained; summary detail is bounded to 512 model/category/marking/continuity
60
+ strata and explicitly reports truncation. The current Session export includes
61
+ its retained observation timestamps. Restart, disposal and eviction lose
62
+ evidence; there is no complete traffic denominator or durable collector.
63
+ See [high-cost requirements](./auto-high-cost.md).
64
+
65
+ ## Privacy
66
+
67
+ Do not collect prompt/answer/tool content, replay, grants, account names or raw
68
+ Session IDs in reports. Do not write custom durable Core history events or
69
+ modify native Usage. Raw exports stay outside Git. Local read-only exports are
70
+ not automatic uploads; sharing requires approval for the specific data and
71
+ destination. Persistence requires a reviewed public storage seam, retention
72
+ and clearing, not an implicit extension of this pilot.
73
+
74
+ ## Post-delivery evaluation
75
+
76
+ Publication and effectiveness evaluation are separate milestones. Close the
77
+ delivery issue normally, while retaining a linked review task with an owner and
78
+ declared candidate-opportunity sample trigger. Review before the next policy
79
+ change even if that trigger is not met.
80
+
81
+ At review time, check sufficiency first. Record retain/change/defer, expected
82
+ versus observed behavior, regressions and uncertainty. Replace the latest
83
+ review instead of accumulating empty templates. If data remains absent, defer
84
+ explicitly and revise the collection action; never fabricate a favorable result.
85
+ No automatic reminder, paid advisor invocation, upload or self-tuning is
86
+ authorized by this workflow.
@@ -0,0 +1,64 @@
1
+ # Image input compatibility
2
+
3
+ Target: official DSH / Windows Desktop `0.2.0-rc.2`. Plugin-only.
4
+
5
+ ## Current behavior
6
+
7
+ Auto checks actual typed image blocks in **all entered messages**, including
8
+ historical user/tool content after a text-only continuation. It does not inspect
9
+ tool arguments or infer images from filenames/textual offload placeholders.
10
+ Core's `offloaded: true` marker means projected text, not image bytes.
11
+
12
+ The picker advertises aggregate image input only with an eligible account image
13
+ model. Auto filters text-only candidates before task preferences; no eligible
14
+ image model fails explicitly rather than sending content to an unverified route.
15
+
16
+ For fixed and Auto managed calls, the account-bound public `inspectRequest`
17
+ hook checks the native transcript's **projected MIME** before wire dispatch:
18
+
19
+ | Diagnostic | Meaning |
20
+ |---|---|
21
+ | `COPILOT_IMAGE_INPUT_UNSUPPORTED` | Current account model does not admit image input |
22
+ | `COPILOT_IMAGE_MEDIA_TYPE_UNAVAILABLE` | Actual projected MIME evidence is unavailable |
23
+ | `COPILOT_IMAGE_MEDIA_TYPE_UNSUPPORTED` | Explicit account MIME restrictions reject that projection |
24
+
25
+ Omitted account MIME lists preserve existing verified vision behavior but do
26
+ not prove universal format acceptance. The plugin neither invents a list nor
27
+ converts images itself. Native error/finish behavior, historical attachments,
28
+ turn freezing and existing cancellation/retry policy stay unchanged.
29
+
30
+ ## Evidence layers and recovery limits
31
+
32
+ Source filename, durable attachment MIME and outgoing projected MIME are
33
+ different facts. Native rc.2 prepares images through public attachment services
34
+ and may re-encode them. A `.png` display name can belong to durable WebP; that
35
+ alone does not establish what the provider received.
36
+
37
+ Do not exclude a model by name to conceal a format failure. A supplier/model
38
+ card's general vision claim is not GitHub endpoint format proof. Exact-format
39
+ Auto filtering from durable MIME can reject a model whose native projection
40
+ would be accepted; candidate-specific projection would require another public
41
+ contract and reviewed tests.
42
+
43
+ The current fix diagnoses explicit incompatibility, not every provider 400.
44
+ When advertised restrictions and outgoing projection agree but the endpoint
45
+ rejects it, retain the native error. Do not invent capability corrections,
46
+ reselect mid-turn, add a fallback wire or replay the request automatically.
47
+ An explicit smaller [native image budget](./copilot-compaction.md) changes
48
+ outgoing visibility through Core offload; it is not a supplier JSON threshold.
49
+
50
+ ## Verification
51
+
52
+ Historical tool-image continuation first reproduced the old missed-image
53
+ requirement. Regressions now cover all Auto preferences, historical user/tool
54
+ images, no vision candidate and native WebP-to-PNG projection against explicit
55
+ PNG/JPEG restrictions. A mismatch emits native `finish(error)` with zero model
56
+ requests.
57
+
58
+ The [delivery CI](https://github.com/cloga/dsh-github-copilot/actions/runs/36966798814)
59
+ passed exact unchanged rc.2 Windows/Linux source and published-adapter fixtures,
60
+ full verification and archive gates. Local synthetic transport demonstrates
61
+ admission/ownership, not live endpoint acceptance or a particular Desktop's
62
+ loaded version. The original [investigation #236](https://github.com/cloga/dsh-github-copilot/issues/236)
63
+ retains the bounded observation and delivery evidence; old local registry
64
+ failures are not a permanent unsupported/shipping-pending claim.
Binary file
@@ -0,0 +1,39 @@
1
+ {
2
+ "clientVersion": "0.4.0",
3
+ "sourceCommit": "2184b01947967d26a506152ddb48e22b14f6091f",
4
+ "source": "Local pnpm build from this 0.4.0 release-candidate commit; not extracted from published archive bytes. Provenance accompanies packaged image assets.",
5
+ "builtClientSha256": "07d531ba05df433fd287b251f396c72ed38588f32e91a4d3aab1697a077c06fc",
6
+ "continuationComponentBundleSha256": "36c9588371965324fb4e66e044a011cd12a5ba78ee706b8662dad902ded39e48",
7
+ "synthetic": true,
8
+ "fixture": "tests/browser/readme.html",
9
+ "reproduce": "pnpm build; pnpm exec tsdown --config tests/browser/capture-continuation.config.ts; node tests/browser/serve-search-routing.mjs; set PLAYWRIGHT_MODULE to an existing Playwright index.mjs; node tests/browser/capture-readme.mjs <printed-loopback-URL>",
10
+ "components": {
11
+ "copilot-model-preferences.png": "GitHubCopilotCompactAccount",
12
+ "copilot-accounts.png": "GitHubCopilotCompactAccount",
13
+ "copilot-accounts-credits.png": "CopilotUsageCard",
14
+ "copilot-session-continuation.png": "CopilotUsageCard + SessionContinuationCard",
15
+ "copilot-search-routing.png": "CopilotPluginSettingsPage"
16
+ },
17
+ "imageSha256": {
18
+ "copilot-model-preferences.png": "493638f95a9780bf3be4bf706e8f6f8d90b1fa4620e0e9ad5890f88da956e0a1",
19
+ "copilot-accounts.png": "8c19b3b5388c368908b99234aeeb8c077400ddd8dc444c742b25ad83e9b3f028",
20
+ "copilot-accounts-credits.png": "d6255533948cb5cdf664453d7bca4779aa648d7e7634493c2bffc2c01202f336",
21
+ "copilot-session-continuation.png": "0c09c879d750c5b10c11fb59d95017b8baf28819a96d78db7f2c996ad829d21e",
22
+ "copilot-search-routing.png": "993640f3794423a74f9e1a2b78dbc838ac6afeee065c348aff386afb101075f7"
23
+ },
24
+ "capture": {
25
+ "browser": "Microsoft Edge 154.0.4258.62",
26
+ "viewports": [
27
+ 920,
28
+ 375
29
+ ],
30
+ "themes": [
31
+ "dark",
32
+ "light"
33
+ ],
34
+ "horizontalOverflow": false,
35
+ "pageErrors": [],
36
+ "externalRequests": false
37
+ },
38
+ "limits": "Actual current built Client components with synthetic settings, identities, models and quota. SessionContinuationCard is an isolated test-only bundle of the same source component, composed through the real CopilotUsageCard prop; it is not a new package export. No live OAuth, model availability, search, billing, collection, persistence or loaded Desktop proof. Desktop images are committed; narrow/light states were checked for overflow and menu dismissal, not native Desktop integration."
39
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "kind": "built-component-synthetic-fixture",
4
+ "packageVersion": "0.4.0-alpha.20",
5
+ "sourceBranch": "feature/copilot-dual-model",
6
+ "baselineCommit": "f44fd1b15ba93dad3bea0c498648dab3392788d5",
7
+ "component": "src/dual-model-card.ts",
8
+ "fixture": "tests/browser/dual-model.html",
9
+ "server": "tests/browser/serve-dual-model.mjs",
10
+ "clientArtifact": "lib/client.js",
11
+ "clientArtifactSha256": "65fa84f960e9facdc4ca8c72292c2a136c6e9b5bcf22271d899fb10eba5e12ab",
12
+ "browser": "Playwright-managed Microsoft Edge",
13
+ "locale": "zh",
14
+ "productionServices": false,
15
+ "modelCalls": false,
16
+ "accountAndWorkspaceData": "synthetic",
17
+ "images": [
18
+ {
19
+ "path": "docs/images/dual-model-desktop.png",
20
+ "viewport": { "width": 1440, "height": 1000 },
21
+ "theme": "dark",
22
+ "state": "configuration saved; selected workspace; create enabled",
23
+ "sha256": "0911486f93ff120b85c1d7e97c83f35b742cd912b10ab046b05a3be505790107"
24
+ },
25
+ {
26
+ "path": "docs/images/dual-model-mobile.png",
27
+ "viewport": { "width": 390, "height": 1000 },
28
+ "theme": "light",
29
+ "state": "one synthetic session created and opened through fixture callback",
30
+ "sha256": "5e6342c844047e9872f3b48eeaeec72036b1453754b1e7e5011d87f1ec1f6d04"
31
+ }
32
+ ],
33
+ "observations": { "horizontalOverflow": false, "syntheticCreatedSessions": 1 },
34
+ "limits": ["not a production Desktop screenshot", "not a live Copilot model request", "not complete Settings-shell integration proof"]
35
+ }
@@ -0,0 +1,109 @@
1
+ # Oversized compaction recovery
2
+
3
+ Tracking: [#228](https://github.com/cloga/dsh-github-copilot/issues/228), [#330](https://github.com/cloga/dsh-github-copilot/issues/330). Target: unchanged official DSH `0.2.0-rc.2` (`639ed015397290b3745d163aafe02ffee4aa3f84`). This document specifies a **separately selected** Host compaction engine; installing this plugin by itself does not replace a running Core engine. Once selected, automatic segmented recovery defaults on. The historical package export and class name remain compatible.
4
+
5
+ ## Requirements and failure boundary
6
+
7
+ An already oversized, compressible manual summary must be able to make progress without submitting the same over-budget prompt again. The motivating detached session had a roughly 508k estimated summary input versus a roughly 368k hard input budget with 65,536 reserved output tokens. The independent model prompt ceiling, not the output reservation alone, binds. The native one-shot summarizer sends the entire selected balanced span plus a directive, and the managed-route guard correctly refuses that input. The prior Auto meter repair prevents incorrect candidate selection; it does not shorten this summary.
8
+
9
+ Recovery must leave the original Session surface intact until a smaller *complete* checkpoint has been accepted by Core's native transaction. It must retain the system head, tool declarations and chronological content, never split a tool-call/result pair, honor cancellation and source changes, bound all provider calls, and preserve the actual summary route and output cap. If a fixed head or one indivisible unit cannot fit, an intermediate summary is truncated/empty, account proof expires, the history changes, or the call limit is exhausted, fail with a named diagnostic and no replacement. No live inference, credential changes, automatic model switch, history deletion or summary-success claim follows from a local test.
10
+
11
+ ## Composition and algorithm
12
+
13
+ `CopilotManualRecoveryCompactionEngine` is an opt-in alternative to **one** official `BasicCompactionEngine` registration. Operators selecting it must replace (not mount alongside) their existing basic compaction service in the same Host scope; the default plugin registration never changes the service. It subclasses the published engine: Core still owns automatic triggering/retries, manual idle maintenance, a single bracketed durable transaction, balanced range selection, checkpoint framing, source-stability/shrink checks, cancellation, failure classification, flush, and optional native pruning. With an authenticated, current managed Copilot summary model, the same hook handles manual and automatic summaries. All other providers delegate unchanged. A pending model picker is not summary-route evidence: an explicit native summary target wins, then the latest committed header, then Agent options.
14
+
15
+ `automaticRecovery` defaults to `true` in this engine's config. Set it to `false` to retain stock automatic single-summary behavior while keeping manual segmented recovery. Native `auto: false`, `maxOverflowRetries`, thresholds and model policies retain their meaning; no background command or second transaction is launched by automatic recovery. A fitting summary first uses the unchanged native single call. A known oversized input directly enters segmented recovery. Only an actual native `LlmError` with `CONTEXT_WINDOW_EXCEEDED` from that first single summary permits one fallback. Its planning bound halves the partitionable history while retaining the fixed system head/tools and enough space for the largest balanced unit, never exceeding the original bound. If that requires the entire rejected input, fail as indivisible instead of resubmitting it unchanged. A segment failure is never recursively retried. HTTP 408, timeout, auth, quota, network, cancellation, empty or truncated output do not authorize fallback.
16
+
17
+ The plugin's account service supplies a current descriptor and a revocable proof for the explicit initiating Agent, not another Session or today's global account. Each physical summary uses public initiator scoping; no credential discovery or Client credential reads are added. Account/selection changes revoke the proof. The summary budget uses `min(maxInputTokens, contextWindow - configuredOutputCap) - safetyTokens`; an additional 4096-token allowance covers Core's appended directive and estimation variance. Candidates now use the public native `tokenMeter.estimateMessage()` in **token units**, including the system head and prior intermediate checkpoint. Tool-schema and tool-history JSON text are conservatively priced through that same meter, not charged as raw bytes. Estimates must be nonnegative safe integers and summed without overflow; missing/invalid meter evidence fails explicitly. An operation-local cache avoids repeatedly pricing the same immutable message while searching boundaries. No source/provenance or opaque replay is serialized by the planner.
18
+
19
+ Through alpha.14 the content planner still compared UTF-8 bytes directly with a token budget. A long-lived tool call can join many intervening completed steps into one balanced span: a reconstructed production span measured about 1.25 MB but 204,438 native heuristic tokens. Such spans can be falsely rejected by that over-conservative dimensional comparison. This bounded content-free measurement is not a reconstruction of the exact native summary input or proof of live acceptance. Alpha.15 corrects the planning units without breaking tool relations or increasing the native budget. Earlier whole-message planning also incorrectly charged provenance/replay metadata; that separate regression remains covered. Historical failure events are not repaired, and the observed production span has not been replayed through a live corrected summary.
20
+
21
+ This is not provider-exact token accounting or a complete wire-size bound. The original messages, sources and replay are still passed unchanged to the published adapter; existing consent alone controls outgoing replay filtering. The final native managed-route guard prices converted replay, images and the complete request and remains authoritative. A segment that still exceeds that guard fails; it is never recursively retried or rewritten. Excluding metadata from planning neither bypasses admission nor authorizes additional loss.
22
+
23
+ The hook partitions the *original* span only at balanced boundaries, summarizes each part through `super.summarize`, and supplies the previous completed intermediate checkpoint as context for the next call. Thus the last completed summary contains all processed parts in chronological order. The engine allows at most 16 physical summary calls per hook invocation, including any initial capacity failure (the exported helper's hard maximum remains 32). Each carries the native cancellation signal and checks account proof before and after dispatch. The original surface is not modified between calls. Core checks for a smaller replacement and current source after the final result; any failure closes the native marker without a partial summary replacement. Native pruning that already committed remains Core-owned. Native automatic retry/rebuild resumes the task only after a valid durable reduction.
24
+
25
+ Segmented recovery can take longer and incur additional provider charges. A sanitized Host log announces entry and its call bound; the Client keeps native compaction progress and cancellation, not a fabricated per-segment progress bar. The native transaction result remains the success evidence.
26
+
27
+ ## Background command for Desktop
28
+
29
+ With this engine selected and the public `commands` and `jobs` services available in its scope, use:
30
+
31
+ ```text
32
+ /copilot-compact
33
+ /copilot-compact status
34
+ /copilot-compact cancel
35
+ /copilot-compact visible-history
36
+ ```
37
+
38
+ The jobs package is a development-only type dependency: the plugin imports no jobs runtime implementation, and the engine's public declaration does not expose its types. Runtime access is through the optionally injected Host service; no jobs package is bundled, installed as a new peer, or registered by this plugin.
39
+
40
+ The first command acknowledges **job admission**, not a completed summary. The existing native `/compact` command remains unchanged. Desktop rc.2 forwards unary command requests through Node `fetch`; a long synchronous compact can exceed the default 300-second response-header wait and lose its caller connection. The background command returns promptly and transfers work to a Session-owned native job with its own cancellation controller. A later HTTP disconnect does not cancel admitted work.
41
+
42
+ Status and cancellation apply only to the invoking Agent's latest job. Duplicate starts return the current running job rather than starting another transaction. The selected engine still acquires Core's maintenance lock and owns the only native transaction; another active turn or compaction can cause the admitted job to fail. Job status distinguishes running, completed, failed and cancelled work. Failure details are sanitized; consult the native compaction/end record for the underlying summary/transaction diagnostic. Provider timeout, truncation, capacity and account-proof failures remain failures.
43
+
44
+ ### Explicit visible-history summary recovery
45
+
46
+ For a verified `COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH`, repeating the same summary cannot repair supplier-scoped encrypted replay. The existing **Visible-history continuation** Session policy now authorizes managed Responses summaries as well as chat: ordinary `/compact`, `/copilot-compact` and automatic compaction apply it before dispatch, without a failure-first retry or extra command. The active turn retains its captured persistent policy; idle summaries capture the Session policy. Disabled/unknown policy never silently enables loss, and legacy next-turn-only consent does not authorize summaries. Stock and selected recovery engines remain independently owned. An additive composer notice reports filtering and distinguishes native commit, failure and cancellation; exact scope rejection when off offers the same persistent enable control. This is not a capacity/timeout/quota cure or permission to enable an absent engine.
47
+
48
+ For an existing open Session on the managed account-discovered Copilot route,
49
+ the persistent control is in the composer **Credits/usage** popover: expand
50
+ **Visible-history continuation**, review the loss disclosure, then choose
51
+ **On** under **Session policy**. The control is not shown for the
52
+ canonical/native route. Enabling applies to subsequent turns and summaries in
53
+ that Session even when the account does not change; an already admitted turn
54
+ keeps its captured policy. The **New Session continuation default** in Models
55
+ is separate and only determines inheritance for eligible new Sessions. See
56
+ [the synthetic composer capture](./images/copilot-session-continuation.png) and
57
+ [Session continuation](./session-continuation.md) for the complete admission,
58
+ scope and persistence contract.
59
+
60
+ `/copilot-compact visible-history` remains explicit consent for **one lossy manual compaction operation** through the selected engine, without changing the persistent checkbox. Managed Responses summary requests omit historical encrypted reasoning items **and their embedded summaries**, while retaining visible messages, tool calls/results, the system head and native final directive. Hidden reasoning may contain details absent from visible messages. Review this loss before enabling the policy or issuing the one-time command.
61
+
62
+ Consent is local to the native summarizer's exact cancellation signal, Session and summary model, including its bounded segments. It is revoked on completion, failure, cancellation or teardown. No unrelated request, subsequent command or automatic retry inherits it. Unknown or incomplete reasoning fails closed. No replay is decrypted, fabricated or written back; original source events remain unchanged and only Core can commit the final smaller checkpoint. The command adds no retry or model/account switch, and does not repair supplier scope. Missing managed integration or an unsupported summary route fails explicitly.
63
+
64
+ The native planning estimate still includes visible history before outgoing filtering, but not source/replay metadata. Giant indivisible units, fixed prefixes, native admission, bounded-work/call limits, truncation and failure to shrink can still prevent recovery. This command is not guaranteed to rescue every history, and summary calls may incur charges. Installation alone neither selects the engine nor runs this command.
65
+
66
+ The visible-history composer notice keeps running loss disclosure visible. A confirmed native completion is shown for a fixed eight seconds from the first current Client read, not from a rerender or later read. Success may also be closed early; failed/cancelled/unavailable and blocked enable prompts never auto-expire and have a localized, keyboard-accessible **Close**. The existing blocked prompt **Cancel** also hides only the notice. Neither action changes persistent consent, invokes recovery, sends/retries, or changes native outcome evidence/history. A dismissal applies only to the exact Session, operation and status, never a later running/failed state. Expiry/dismissal survives incidental remounts and Session switches in a Client registration-owned FIFO of at most 128 records; teardown clears it, and an evicted record may be shown again. No disk or module-global cache is used. Component timers stop on unmount/Session changes; departed reads cannot start a lifetime or publish stale status. This transient presentation is not proof of the subsequent chat request succeeding.
67
+
68
+ Background status now exposes only allowlisted fixed failure codes through bounded native Error cause chains, including replay-scope rejection; raw exception text, response bodies and history remain excluded. Unknown failures retain `COPILOT_BACKGROUND_COMPACTION_FAILED` with guidance to the native `compaction/end` record. An admission receipt is not success; check status and the native transaction.
69
+
70
+ The plugin collects the job's native settlement with `jobs.wait`, so the ordinary job reporter does not wake the model or resume its Goal. It never calls followup or inject. Explicit cancellation, owner disposal and plugin/Host teardown cancel and drain the producer. Owner teardown can fail native maintenance before the job receives cancellation; that outcome remains failed rather than being relabeled successful or cancelled. Jobs are process-local: status does not survive a Host restart, and the plugin does not silently restart interrupted work. Durable Core compaction events remain the outcome evidence. Merely installing the main plugin does not select this engine or make this command available; missing commands/jobs services leave the background entry unavailable without changing ordinary compaction.
71
+
72
+ **Audit:** each physical call goes through Core's public `llm.stream` seam with its actual route/cap. The final native summary event is intentionally *unmarked* (`llmStreamCall` absent), not a fabricated claim of one call. It records summed provider-reported usage only when **every** underlying call supplied usage; optional counters are included only if present on every call. After a failed initial single call, aggregate usage is omitted because this hook cannot recover that call's complete accounting. The native event format has no per-call array or durable per-call transcript in a single summary event; do not infer individual request accounting from that aggregate. This is a real observability limit of the unchanged public contract.
73
+
74
+ This aggregate is not per-call attribution: it cannot reconstruct which intermediate request used which tokens, identify each physical response, or prove that native call-attribution consumers count every intermediate request. The plugin does not manufacture `llmStreamCall`, response IDs, or individual durable usage records to fill that gap. Reported aggregate provider usage and Core's native call-attribution/accounting are separate evidence layers.
75
+
76
+ ## Native admission and historical usage evidence
77
+
78
+ The exact rc.2 `llm-pi-ai` public adapter converts both plain and replay-backed historical assistant messages with `emptyPiUsage()` and `timestamp: 0` (`replay.ts`); converted user messages, including new intermediate checkpoints, also have timestamp zero (`context.ts`). Therefore creating a checkpoint **does not** invalidate an old SDK usage anchor through a newer timestamp. On this pin, Core does not carry the historical assistant usage into the SDK context in the first place. Recovery neither clears that usage itself nor changes message timestamps, replay state, native conversion, the SDK estimator or the final managed guard. This behavior must be requalified when the Core/pi-ai pin changes.
79
+
80
+ The unchanged-Core fixture exercises the real managed adapter and its `inspectRequest` guard with a synthetic 27-turn history whose latest provider-reported input is 508,198 tokens, plus 3.5 KB of synthetic native provenance/replay padding per assistant. The old whole-message planner exhausted exactly 16 calls on this metadata-heavy fixture without replacement. The content planner first proves stock manual compaction fails the 12,000-token input bound without reaching the synthetic wire, then proves the opt-in engine commits one replacement through bounded calls. The captured SDK estimates include the complete native compaction directive, system policy and tool schemas, not a prompt with its final directive removed. Every dispatched estimate fits the hard limit; the 8,192 output cap is preserved, source events remain byte-identical, and every intermediate wire call observes the original surface generation. Estimator instrumentation calls the original SDK utility without altering its result. The fixture verifies zero carried usage anchors, aggregate usage and the deliberately absent single-call marker. Synthetic scaled-down input limits and transport establish native admission/transaction behavior, not provider-exact capacity or live Copilot success.
81
+
82
+ ## Limitations and operational use
83
+
84
+ This path only helps histories with balanced boundaries and intermediate summaries that fit their model's input and output limits. One giant user/tool result, a huge fixed head/tool schema, an incomplete tool pair, provider truncation, or a final checkpoint that is not smaller remain explicit failures. Intermediate model summaries are lossy in the same sense as ordinary Core compaction; review important context before explicitly invoking manual compaction. The native meter is heuristic, not a supplier tokenizer or proof that a request will fit after conversion; final managed admission remains authoritative. The algorithm does not repair a damaged/unmatched pre-existing compaction bracket.
85
+
86
+ Select the exported `dsh-github-copilot/manual-compaction-recovery` Host class **instead of** the stock basic compaction plugin in a reviewed Host composition. For a composition that normally contains `- name: '@deepseek-ai/dsh-compaction-basic'`, remove that single row and use this row in the same scope:
87
+
88
+ ```yaml
89
+ - name: 'dsh-github-copilot/manual-compaction-recovery'
90
+ config:
91
+ auto: true
92
+ maxTokens: 65536 # example only: preserve the reviewed original cap
93
+ ```
94
+
95
+ Keep the existing BasicCompactionConfig, including any modelPolicies and actual maxTokens; configure a summary route deliberately if the last committed model cannot serve the summary. Do not enable two compaction services or modify a live profile without explicit approval. The normal plugin and all ordinary sessions remain usable without this replacement; the package export alone neither installs it nor changes an existing Session.
96
+
97
+ ### Explicit configuration migration
98
+
99
+ 1. With separately approved profile maintenance, inspect the effective Host composition and the initiating Agent's bound preset. Identify exactly one stock basic engine in the intended scope; an absent or custom engine is not a migration target.
100
+ 2. In the owning configuration, replace only that row's `name` with `dsh-github-copilot/manual-compaction-recovery`. Preserve its id, group, isolation, disabled state and full config, including `auto: false`, retention, caps, retry limits and exact model policies. Keep the native compact command and tool-result pruner. Do not add a second row.
101
+ 3. For a native preset, edit its owned `config.plugins` entry in the native preset editor, preserving the surrounding plugins. Do not replace the whole preset with a stock template. A global engine replacement does not change engines isolated in presets.
102
+ 4. Review the resulting diff and reload only through approved normal Host/preset maintenance. Existing Agents may retain the older preset generation; verify their actual bound service rather than assuming a setting change moved them. Set `automaticRecovery: false` on the replacement to disable only automatic segmentation.
103
+ 5. To roll back, restore that row's stock name and remove only the plugin-owned `automaticRecovery` key. Keep the original native config. Already committed native summaries are not reversed.
104
+
105
+ Do not try to change an existing plugin name with the bundle include patch's `name` field: on rc.2 it is a matching guard, not a replacement. Include patches also do not traverse arbitrary preset `config.plugins`. This release intentionally supplies no automatic live migration, full-preset overwrite, service interception or Core patch. Native isolated-preset fixtures verify the selected replacement, unchanged native config and the disabled/absent/no-retry cases; they are not live deployment receipts.
106
+
107
+ ## Acceptance and retirement
108
+
109
+ Focused tests must exercise oversized balanced histories, native durable replacement and no replacement on cancellation, truncation, stale source or proof, irreducible units and bounded-call exhaustion. Verify the exact published Core source fixture, frozen install, full plugin gate and immutable package smoke before describing a deployable release. CI with synthetic transport proves no live Copilot availability. Retire this companion path only when official compaction safely handles independent prompt ceilings and multi-call/manual recovery with equivalent durable audit, lifecycle and transaction guarantees.