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,341 @@
1
+ # Contextual Auto routing and captured selection reasons
2
+
3
+ Tracking: [#258](https://github.com/cloga/dsh-github-copilot/issues/258) and
4
+ [evidence refinement #262](https://github.com/cloga/dsh-github-copilot/issues/262).
5
+
6
+ **Current contract:** source candidate `0.4.2-alpha.10`, targeting official DSH/Windows
7
+ Desktop `0.2.0-rc.2`. Semantic assessment is enabled by default with bounded
8
+ auxiliary timing/output evidence. Neither publication nor
9
+ these explanations prove the version loaded in a particular Host.
10
+
11
+ ## Using Auto
12
+
13
+ Choose **Auto · Balance**, **Auto · Efficiency**, or **Auto · Intelligence**
14
+ under the managed **GitHub Copilot** provider in DSH's ordinary picker. This is
15
+ the plugin's DSH routing policy, not Copilot App's Auto or GitHub's private
16
+ router. Selecting a real model exits Auto. Every step/retry in an admitted
17
+ turn keeps its chosen model; the next turn can choose differently.
18
+
19
+ Semantic assessment is already enabled for locally unknown tasks. To opt out,
20
+ set `autoSemanticAssessment: false` in the plugin's `github-copilot` settings
21
+ namespace; it is not an extra switch on the Web search card. This changes
22
+ subsequent assessments, not an already-admitted turn. Local known-task rules
23
+ still work when auxiliary inference is disabled.
24
+
25
+ The native plugin configuration exposes these profile-wide settings under
26
+ `github-copilot` (not the Web search routing card):
27
+
28
+ | Setting | Default | Meaning |
29
+ |---|---|---|
30
+ | `autoSemanticAssessmentTimeoutMs` | `30000` | Integer total preparation/response budget from 1000 to 120000 ms. `8000` restores the earlier budget; zero/unlimited is not supported. |
31
+ | `autoSemanticAssessmentModel` | `''` | Empty uses metadata-driven automatic classifier selection. A nonempty value is an exact current-account model ID, not a display name or virtual Auto choice. |
32
+
33
+ For example, keep automatic selection while allowing the new default budget:
34
+
35
+ ```yaml
36
+ github-copilot:
37
+ autoSemanticAssessment: true
38
+ autoSemanticAssessmentTimeoutMs: 30000
39
+ autoSemanticAssessmentModel: ''
40
+ ```
41
+
42
+ These fields require the new plugin release; adding them to an older version
43
+ does not implement the behavior. Changes apply to subsequent assessments,
44
+ not an admitted turn's steps/retries. The 30-second default is a user-approved
45
+ trial, not calibrated latency or proof that past unknown results were timeouts.
46
+ Larger budgets can increase time before the answer begins and auxiliary charges.
47
+ Native Chat/search deadlines and user cancellation are independent.
48
+
49
+ An explicit classifier may use any account-advertised category, but still must
50
+ be an entitled, unexcluded concrete model with text capability, validated protocol
51
+ and the existing input/output headroom. A missing, excluded or unsuitable choice
52
+ produces `COPILOT_AUTO_CLASSIFIER_CONFIGURED_MODEL_UNAVAILABLE`, then the existing
53
+ unknown-demand/unavailable diagnostic; no silent alternate classifier is called.
54
+ Answer selection remains a separate Auto decision. The classifier result does
55
+ not choose its own answer model.
56
+
57
+ Open the reply's selection explanation for the captured decision. Evidence is
58
+ Host-lifetime and bounded; after restart or eviction it can be unavailable.
59
+ Do not infer an old decision from the current picker.
60
+
61
+ | Reading | Meaning |
62
+ |---|---|
63
+ | `uncertain` / unknown demand | The available evidence does not establish task demand; it is not a failed answer or a claim that the conversation is empty. |
64
+ | `insufficient-evidence` | A local rule or classifier could not justify a demand category. Longer context alone does not guarantee classification. |
65
+ | Semantic timeout | No validated result within the captured configured end-to-end budget (30 seconds by default). Demand remains unknown; Efficiency/Balance target Versatile, Intelligence targets Powerful, subject to eligibility and category fallback. |
66
+ | Missing auxiliary milestone | That milestone was not observed before assessment settled, not proof the supplier never sent data. |
67
+ | Selection unknown/unavailable | Captured selection evidence is absent or could not be read, distinct from unknown task demand. |
68
+
69
+ There is no assessment retry or automatic deadline extension. Caller cancellation
70
+ aborts the turn rather than invoking fallback. Auxiliary calls can add latency
71
+ and supplier charges outside native answer Usage.
72
+
73
+ Classifier capability checks accept only explicit account-advertised disable
74
+ labels: `off`, protocol-native `none` for Responses/Completions, or `disabled`
75
+ for Anthropic. No aliases are applied to ordinary Chat model maps. Missing or
76
+ empty effort metadata does not prove absence of reasoning.
77
+
78
+ Strict request-local `semantic.candidateScan` evidence records at most 512
79
+ candidates, eligible counts and first-rejection counts for exclusions, explicit
80
+ ID mismatch, category, text input, unproven disable capability and budget.
81
+ Counts partition the examined pool, not all possible rejection reasons per model.
82
+ No candidate IDs, prompts or raw metadata are retained in these counts.
83
+ `preparationFailure: native-off-unavailable` separates native off preparation
84
+ from no-fit selection. No-fit Host warnings use fixed codes only. These fields
85
+ are ephemeral selection evidence, not a new persisted diagnostic population;
86
+ absent legacy evidence cannot be reconstructed.
87
+
88
+ ## Requirements
89
+
90
+ Auto must explain why the initiating turn chose its actual route, not display a
91
+ generic description of prompt length. Intelligence prioritizes response quality
92
+ but can use a lightweight model for demonstrably simple work. Efficiency favors
93
+ economical capability without knowingly underpowering difficult work. Balance
94
+ trades those priorities. All preferences share the same account model pool.
95
+
96
+ The authenticated account `/models` response supplies `model_picker_category`.
97
+ The October 3, 2026 bounded live probe observed `powerful`, `versatile` and
98
+ `lightweight`; some records lacked the field. This is supplier classification,
99
+ not measured latency, quality, price or health. Official documentation's
100
+ `category` is a different source and must not override live account facts.
101
+ Do not derive category from IDs, names, reasoning effort or context capacity.
102
+
103
+ Hard constraints remain first: entitlement, exclusions, current proof, text/image
104
+ capability and actual image format, estimated input headroom and final native
105
+ admission. No preference overrides these. No new Core owner, adapter, credential
106
+ record, general transport, global model mutation or durable decision event.
107
+
108
+ ## Task assessment
109
+
110
+ Assessment concerns the task in context, not the last sentence's length.
111
+ An isolated greeting may be low demand. A short request to prove a theorem or
112
+ continue an unresolved investigation is not evidence of low demand. Long input
113
+ can be mechanical. Prior assistant/tool work prevents a greeting/continuation
114
+ shortcut from claiming an isolated simple task.
115
+
116
+ Use conservative local assessment first. Unknown is an explicit outcome, never
117
+ silently translated into simple. Semantic assessment is enabled by default for
118
+ locally unknown demand at the user's explicit rollout request (#267), not
119
+ because labeled-corpus calibration has completed. Set
120
+ `github-copilot.autoSemanticAssessment: false` to disable auxiliary inference;
121
+ an existing explicit false remains respected. It must not claim equivalence to
122
+ GitHub's private router or calibrated confidence.
123
+
124
+ Local rules recognize an isolated, explicit JSON-to-CSV/CSV-to-JSON conversion
125
+ or line sort only when the entire request is at most 1600 characters, contains
126
+ one fenced payload and no other work or non-text content. This establishes
127
+ routine, not simple. An exact acknowledgement/continue request can inherit
128
+ explicit difficult-task evidence from the nearest non-continuation user request
129
+ among the preceding twelve user requests. A new task or an expired anchor stops
130
+ inheritance; simple/routine demand is never inherited.
131
+
132
+ `uncertain` remains a valid task result. `insufficient-evidence` means the local
133
+ rules cannot establish demand, not that the conversation has no context.
134
+ Attachments, unfamiliar instructions and genuinely ambiguous continuations can
135
+ still remain unknown. These refinements do not change category preference,
136
+ previous-model eligibility or semantic safeguards.
137
+
138
+ The semantic assessment uses one fixed concrete account candidate through the
139
+ existing managed native adapter, never an Auto ID and never `ctx.llm` routing
140
+ recursion. It has no tools, bounded text-only assessment context, bounded JSON
141
+ output, one deadline, cancellation and no new retry loop. Text from messages is
142
+ untrusted data, not router instructions. Files/images/reasoning/replay bodies
143
+ are not read; limited task text cannot justify downshifting. Assessment input is a separate projection: the actual chat
144
+ messages, system prompt, tools, attachments and history stay untouched.
145
+
146
+ Only locally unknown tasks invoke the enabled assessment. Context packing keeps
147
+ the current and nearest preceding user requests before recent output. An explicit
148
+ continuation also reserves the nearest substantive user anchor among the previous
149
+ twelve user messages and the intervening user chain, then restores chronological
150
+ order. No expired anchor, task summary or semantic task boundary is invented.
151
+ At most twelve complete JSON rows, 1600 text
152
+ characters per row and 8000 serialized characters are retained; JSON escape
153
+ expansion is included in this bound. Any truncation, skipped row or non-text
154
+ content still marks projection omission. A missing current request/continuation
155
+ anchor, a missing reserved user row, truncated reserved task text, or nontext
156
+ content in the reserved user chain separately marks `taskTextLimited` and prevents
157
+ a semantic simple/routine downshift. Incidental assistant/tool/history omissions
158
+ alone no longer force that downgrade. The classifier must still judge whether
159
+ the retained evidence establishes demand; retained text is not semantic
160
+ completeness and missing required details must remain unknown.
161
+
162
+ The instruction requests a schema without a pre-filled unknown answer and
163
+ distinguishes projected data omissions from missing relevant task evidence.
164
+ Unknown is permitted for genuinely indeterminate demand, not required merely
165
+ because a long conversation exceeds the projection bounds. No reasoning/tool
166
+ enablement, second inference, larger context/output budget or full-history
167
+ serialization is introduced.
168
+
169
+ The strict result contains demand (`simple`, `routine`, `complex`, `unknown`)
170
+ and finite evidence signals, not a model ID, raw reasoning or an uncalibrated
171
+ confidence percentage. Invalid/truncated/failed results retain the local
172
+ assessment with an explicit diagnostic. Caller cancellation aborts the turn
173
+ instead of falling back. Credential, metadata and account revocation remain
174
+ fatal through existing lease/admission guards. Extra calls incur supplier
175
+ charges and latency, separate from native chat Usage and without inferred cost.
176
+
177
+ Strict ephemeral explanation evidence optionally records retained row count
178
+ (0–12), the projection omission flag, task-text limitation, fixed continuation
179
+ anchor status and the classifier's decoded demand. No text, attachment values
180
+ or new persistent population is recorded. Legacy absent fields stay absent.
181
+ These fields distinguish a valid classifier `unknown` from plugin-side
182
+ simple/routine blocking; they do not establish accuracy or a live unknown rate.
183
+
184
+ ## Auxiliary latency evidence and bounded output (#272)
185
+
186
+ The assessment has one **configured end-to-end deadline, 30 seconds by default**, including account
187
+ discovery/preparation and the native call. It does not retry on timeout or try a
188
+ second classifier. The response budget is now 128 output tokens, with compact
189
+ demand JSON and at most three fixed signals requested. The strict decoder
190
+ retains its seven-signal compatibility bound; raw explanation, confidence
191
+ percentages and reasoning are not requested. Truncation remains failure, never
192
+ accepted partial JSON.
193
+
194
+ One monotonic deadline is checked after context packing, discovery and native
195
+ preparation, before native request admission, on delivered chunks and before
196
+ accepting a decoded result. A delayed event-loop timer cannot authorize a
197
+ late auxiliary request or result. It can still delay observed settlement:
198
+ this is not a hard real-time guarantee or evidence of a supplier latency cause.
199
+ The owned timer and abort listener are disposed when assessment settles.
200
+
201
+ Among eligible supplier Lightweight text candidates with the existing input
202
+ headroom and explicit reasoning-disable proof, automatic selection prefers
203
+ unmarked cost, then deterministic ID ordering. An explicit exact-ID setting selects only that
204
+ eligible model, without category or cost re-ranking.
205
+ This does not infer speed, health or quality from effort or model names, and
206
+ does not launch a second candidate if native support is absent.
207
+
208
+ Automatic selection is metadata-driven, not an empirical fastest/best model
209
+ search. No additional benchmark requests, adaptive deadlines, per-model health
210
+ ranking, cooldown or cross-turn cache are introduced. Those require separately
211
+ reviewed representative latency/accuracy/cost observations and consent, not a
212
+ guess from model names or a timeout suspicion. Review outcomes under #334 before
213
+ claiming the increased default improves live classification.
214
+
215
+ The classifier is eligible only when current account metadata advertises
216
+ an explicit protocol-compatible disable mode and the isolated, public prepared
217
+ model exposes `off`. It then
218
+ always requests `off`; otherwise assessment fails closed without dispatching
219
+ the classifier. The classifier-only model mapping serializes the native
220
+ disable form supported by the published adapter: Responses
221
+ `reasoning.effort: "none"`, OpenAI-compatible `reasoning_effort: "none"`, or
222
+ Anthropic `thinking.type: "disabled"`. This mapping is not added to shared
223
+ account models, so ordinary Chat behavior remains unchanged.
224
+
225
+ The auxiliary adapter also does not inherit configured Chat reasoning effort:
226
+ its isolated profile omits that default while ordinary Chat retains it. Tools
227
+ and an execution loop are absent. These checks establish the requested wire
228
+ payload in synthetic tests, not that every supplier honors the control
229
+ internally. Models lacking either advertised or native support are not used;
230
+ do not substitute `low` or `minimal`, which can enable reasoning.
231
+
232
+ Tools and an execution loop are absent. Only locally unknown tasks use one
233
+ classifier call per admitted turn; subsequent steps/retries reuse its result.
234
+ Text projection stays bounded to twelve rows, 1600 characters per row and
235
+ 8000 serialized characters; files, images and replay bodies are not included.
236
+ The requested output budget remains 128 tokens. Neither those bounds nor the
237
+ waiting deadline establishes a hard supplier reasoning-token, credit or dollar
238
+ cap. Measure accuracy, elapsed time and auxiliary usage separately before
239
+ reducing context/output or claiming a cheapest/fastest classifier.
240
+
241
+ Captured Host-lifetime selection evidence now includes a bounded public
242
+ classifier ID, configured waiting budget, total monotonic assessment elapsed
243
+ time, adapter-invocation start, first nonempty text time, native stop/non-stop
244
+ finish observation and strict result-validation status. Preparation is included
245
+ in total time; adapter start is **not HTTP dispatch**, first text is **not first
246
+ network byte**, and these milestones cannot distinguish connection, supplier
247
+ queueing or computation. Absence says no milestone was observed before
248
+ settlement, not that the provider never emitted data. Counts are characters,
249
+ not tokens/credits; no prompt, text, replay, credential, error body or hash is
250
+ captured. Late callbacks cannot rewrite a settled decision.
251
+
252
+ The existing strict explicit-Session/turn Remote carries this optional evidence;
253
+ old explanations remain decodable without it. Numeric/model evidence is copied
254
+ and frozen in the bounded store and routing decision, not durably appended or
255
+ reconstructed after restart. The footer says assessment timed out, demand
256
+ remained unknown, and preference policy selected the category as a fallback.
257
+ Progressive details show milestones separately from native answer Usage.
258
+ Continuity copy states the fitting category-pool count and explicitly disclaims
259
+ semantic ranking; all-input-fit counts are not the final category pool.
260
+
261
+ This is instrumentation and bounded output optimization, not a measured latency
262
+ improvement or classifier calibration. No latency-ranked classifier pool,
263
+ cross-turn assessment cache, cooldown, adaptive deadline or extra probe is
264
+ introduced without reviewing real observations. Existing local evidence,
265
+ omitted-context downshift protection, cancellation, account/proof revocation,
266
+ same-turn single-flight, eligibility and category policy remain unchanged.
267
+
268
+ ## Category policy and continuity
269
+
270
+ | Task demand | Efficiency | Balance | Intelligence |
271
+ | --- | --- | --- | --- |
272
+ | Proven simple | Lightweight | Lightweight | Lightweight |
273
+ | Routine | Lightweight | Versatile | Powerful |
274
+ | Complex | Powerful | Powerful | Powerful |
275
+ | Unknown | Versatile | Versatile | Powerful |
276
+
277
+ These are declared routing policies, not benchmark rankings. Efficiency's
278
+ routine lightweight target is an economical approximation, not proof of
279
+ equal output quality. Intelligence never treats short length alone as simple.
280
+
281
+ The target and remaining categories have this declared weight order:
282
+ powerful -> versatile -> lightweight; versatile -> powerful -> lightweight;
283
+ lightweight -> versatile -> powerful. Unclassified candidates retain a small
284
+ explicit opportunity, not fabricated categories. Unknown/new category values
285
+ remain unclassified with a bounded catalog diagnostic.
286
+
287
+ Across every eligible fitting category, use stable positive weighted Session/turn
288
+ allocation. The task/preference matrix is a preferred target, not exclusion.
289
+ Multiply per-model cost/recency weights by category factors 1 / 0.25 / 0.05
290
+ in the existing target/second/third order; unknown category uses 0.02 explicitly.
291
+ These factors are an uncalibrated trial. Ordinary weight 1 has finite
292
+ previous-model multiplier 1.5; high-cost base weight 0.2 decays tenfold to 0.02
293
+ only for the previous model. Every candidate keeps positive opportunity; a lone
294
+ candidate still has share 1. A different model's turn resets the penalty, without
295
+ extra streak state. Cost is independent of task difficulty and supplier
296
+ category; input fit does not prove task success. Non-target selection is
297
+ intentional weighted opportunity, not absence of a target candidate or proof
298
+ of task suitability. Never automatically escalate to establish whether
299
+ another model can solve the task.
300
+ These are reviewed policy parameters, not measured quality or prices. Once
301
+ admitted, all steps/retries share the decision. No supplier cache savings are
302
+ claimed. See [high-cost requirements](./auto-high-cost.md) and
303
+ [evidence-driven iteration](./evidence-driven-iteration.md).
304
+
305
+ If no model fits, preserve the existing largest-admissible-input recovery
306
+ branch and its native compaction diagnostics. Explain that no candidate fits;
307
+ never label this as a successful preference match or silently trim history.
308
+
309
+ ## Explanation contract
310
+
311
+ Capture task source/demand/signals, assessment diagnostic, target/selected
312
+ category, fitting cross-category count, target absence and continuity/tie-break or
313
+ no-fit selection at decision time. Client reads the explicit viewed Session and
314
+ turn through the existing strict Remote. It does not rerun classification or
315
+ consult today's picker. Show a decisive first sentence, bounded supporting
316
+ facts and optional policy detail. Do not repeat the model name or change Usage.
317
+
318
+ Legacy records without detailed evidence show that the reason was not retained.
319
+ Host-lifetime evidence may be lost on restart; do not invent durable history or
320
+ promise cold-history reconstruction.
321
+
322
+ ## Acceptance and rollout
323
+
324
+ Regress category normalization (missing/new/invalid values), short difficult
325
+ tasks, isolated greetings, contextual continuation, long mechanical input,
326
+ category fallback, previous-model eligibility, deterministic tie breaking,
327
+ no-fit recovery, one-call semantic success/invalid/failure/timeout/cancellation,
328
+ omitted context, strict Remote and footer English/Chinese explanations.
329
+
330
+ Retain native gateway, parent following, manual selection, exclusion admission,
331
+ account proof, image admission and compaction fixture coverage. Full protected
332
+ Windows/Linux CI remains mandatory before merge/release. No live inference
333
+ calls are needed for synthetic acceptance.
334
+
335
+ Default enablement is a user-authorized rollout, not an accuracy qualification.
336
+ Evaluate a reviewed labeled corpus for complex-to-simple errors, extra latency,
337
+ token use and stability across languages and prompt injection before claiming
338
+ calibrated performance. Synthetic passing tests are not this evaluation.
339
+ Missing settings adopt the enabled default after upgrade; explicit false is
340
+ not overwritten and no profile migration is performed. Publication does not
341
+ authorize profile installation or restart.
@@ -0,0 +1,236 @@
1
+ # GitHub Copilot Auto routing contracts
2
+
3
+ Target: official DSH / Windows Desktop `0.2.0-rc.2`. Implementation is plugin-only.
4
+ For ordinary use, start with [task assessment and explanations](./auto-task-routing.md)
5
+ and [parent following](./parent-model-follow.md).
6
+
7
+ ## User contract
8
+
9
+ The managed `github-copilot-preview` group provides **Auto · Balance** (`auto`),
10
+ **Auto · Efficiency** and **Auto · Intelligence** in Core's flat picker.
11
+ Only a real model selection exits Auto. Native selection also saves the future
12
+ global default; the plugin does not change that Core behavior.
13
+
14
+ Each admitted Core turn resolves to one real account model. Tool continuations,
15
+ native request retries and compaction retries retain it; a new user or Goal
16
+ turn can choose differently. Transport, replay, native Usage and billing retain
17
+ the actual model identity. Auto never crosses providers/accounts or changes an
18
+ explicit real-model selection.
19
+
20
+ The virtual preference normally remains the Session's pending selection while actual
21
+ request headers record real models. A strict plugin-owned public Session projection
22
+ also retains the latest owner-explicit native `model/selection`: if a virtual
23
+ request header consumes native pending, later concrete headers cannot erase that
24
+ Auto intent. Cold refolding restores intent, not old decisions or reasons.
25
+ Copied fork/child prefixes alone do not establish an owner-explicit choice;
26
+ native pending and the existing parent-following rules remain independent.
27
+ Missing or malformed continuity evidence produces a named diagnostic instead of
28
+ guessing Auto from a real model. A new explicit fixed or other-provider selection
29
+ replaces intent for future turns, even after its native pending is consumed.
30
+ Already admitted Auto turns retain their real route through late picker changes.
31
+ This projection neither writes history/settings nor changes native projection ownership.
32
+ For an otherwise unselected Session that
33
+ inherits default Auto, the first request persists the exact virtual
34
+ `model/selection` intent. A later explicit selection wins. Existing fixed
35
+ Sessions are not converted because the global default changes.
36
+
37
+ ## Eligibility and input fit
38
+
39
+ Current authenticated account metadata establishes entitlement, endpoint,
40
+ context/input/output limits, tool/image support and reasoning capabilities.
41
+ Missing/invalid metadata produces diagnostics, not guessed capabilities.
42
+ Exact exclusions and independent account/proof/cancellation guards apply first.
43
+
44
+ The public native TokenMeter estimates every entered message, including
45
+ reasoning and tool history. Its current-surface measurement is an envelope
46
+ floor, not a substitute for candidate-specific final serialization.
47
+ Missing/invalid measurement fails with
48
+ `COPILOT_AUTO_TOKEN_METER_UNAVAILABLE` /
49
+ `COPILOT_AUTO_TOKEN_ESTIMATE_INVALID`.
50
+
51
+ Candidates fit when estimated input does not exceed the hard budget after
52
+ output reservation and safety allowance. If none fits, choose the largest
53
+ input budget for native recovery and explain whether content is fixed,
54
+ compaction unavailable, already attempted, or eligible. This is not permission
55
+ to dispatch an oversized request. The native managed `inspectRequest` guard
56
+ remains authoritative after final framing/attachment projection.
57
+
58
+ Task preference uses supplier `model_picker_category`, not capacity, model
59
+ names or reasoning effort as quality rankings. [Task policy](./auto-task-routing.md)
60
+ owns the demand matrix, default semantic assessment, category fallback,
61
+ high-cost one-turn recency decay, ordinary finite continuity and stable
62
+ positive-weight cross-category allocation. Every eligible fitting model has
63
+ positive opportunity; the task target biases per-model weights instead of
64
+ hard-filtering other categories. Unknown category stays explicit.
65
+ User-marked high cost is orthogonal to demand and category; see
66
+ [high-cost requirements](./auto-high-cost.md). Future policy changes must read
67
+ the [latest review](./auto-iteration-review.json) before implementation.
68
+
69
+ ## Images, compaction and search
70
+
71
+ Image eligibility includes historical user/tool image blocks in all entered
72
+ messages, not only current user text. Text-only candidates are removed; Auto
73
+ advertises image input only with an eligible image model. Actual fixed/Auto
74
+ dispatch independently checks explicit account MIME restrictions against
75
+ Core's projected image. Missing MIME lists stay unverified.
76
+ [Image admission limits](./image-input-compatibility.md).
77
+
78
+ Auto does not trim history or own compaction transactions. Estimated pressure
79
+ uses the initiating Agent's public bound recovery service and preserves the
80
+ same real model. If the summary input already exceeds every eligible budget,
81
+ stock one-shot compaction cannot rescue it. [Budget admission](./copilot-compaction.md)
82
+ and [manual recovery](./manual-compaction-recovery.md) describe separate paths.
83
+
84
+ Chat Auto does not own independent hosted search. A nonempty `searchModel`
85
+ override remains authoritative; otherwise that provider uses bounded
86
+ account-owned Responses selection and capability proof. Auto-following search
87
+ sees the initiating real request route. No virtual model reaches transport,
88
+ and the final query is not replayed across candidates.
89
+ [Search routing](./session-search-routing.md).
90
+
91
+ ## Attribution and explanation
92
+
93
+ Completed replies show **Auto (preference)** with captured reasons, **Manual**
94
+ only with explicit fixed-selection evidence, or **Selection unknown** when a
95
+ successful read has no record. Failed reads show **Selection unavailable → Retry**.
96
+ Retry rereads the same Session/turn; it never runs inference.
97
+
98
+ The public assistant-actions slot adds the plugin item after native Usage/time.
99
+ It cannot change the native fixed-height parent row and adds no Model details
100
+ or footer button. The existing info dialog is **Turn model and selection evidence**.
101
+ When native Usage lacks complete model routes, model evidence comes first and the
102
+ original selection explanation remains in a collapsed disclosure below:
103
+
104
+ - **Recorded models** lists independent successful same-turn `assistant/message`
105
+ sources, preserving multiple models/providers. Failed attempts, retries and
106
+ paged/missing history retain an explicit incomplete-attribution warning; known
107
+ sources do not prove which models every failed attempt used.
108
+ - **Requested model** is the fallback when no successful source exists. An
109
+ independent public Session projection folds native `turn/start`, `step/start`,
110
+ `request/header`, `step/end` and `turn/end`; only headers inside a recorded open
111
+ step bind to that turn. Native headers have no turn field and are not emitted
112
+ for every unchanged request. Therefore absent headers stay unknown, never
113
+ inherited from an earlier turn or today's `Session.requestHeader()`. Configuration
114
+ proves neither dispatch nor execution, usage or billing.
115
+ - Missing/invalid evidence stays **Unknown**. Requested-model read failures are
116
+ distinct from missing evidence and have same-Session/turn read-only Retry.
117
+ Selection mode and model evidence remain independent.
118
+
119
+ Complete native Usage routes avoid redundant model presentation. A turn without
120
+ a closing message has no assistant-actions anchor; pure failed turns without one
121
+ are not promised an injected entry. Optional conversation projections do not
122
+ control selection mounting. The request projection has its own `stateVersion: 1`,
123
+ retains at most 128 turns and 32 distinct routes per turn (overflow invalidates
124
+ that turn), and stores no message/tool/replay/credential content. Cold folding
125
+ uses existing recorded events only, not custom events or history conversion.
126
+
127
+ The bounded Host store retains 64 Agents and 128 turns per Agent. Disposal,
128
+ eviction and restart lose new records. Compatible historical Auto events remain
129
+ readable; missing historical preference/reasons are not reconstructed.
130
+ New optional `github-copilot/auto-model-decision` events are **not** emitted:
131
+ official rc.2 `Session.append()` has no public ignorable-envelope option.
132
+
133
+ `TurnSelectionController` extends public `TypertRemoteService` with `@Remote get`.
134
+ Client calls carry explicit viewed Session ID and turn, with no automatic
135
+ Client scope projection that would remove the ID. Native Host Agent lookup,
136
+ access checks and strict codecs remain. Additive `requestedModels` preserves the
137
+ existing `get` descriptor and strict selection codec unchanged. Actual Client/Host gateway regressions
138
+ cover reachability, bound contexts and missing/denied identities; mock RPC
139
+ success is not sufficient evidence.
140
+
141
+ Captured evidence includes task/category, eligible/fitting counts,
142
+ fallback/continuity and optional auxiliary milestones. It proves a decision,
143
+ not execution, current occupancy, usage or supplier billing. Native accounting
144
+ remains independent. [Usage limits](./copilot-usage.md).
145
+
146
+ ### Recovering affected histories
147
+
148
+ Only histories containing the old incompatible decision event need this
149
+ compatibility utility. Upgrading prevents new writes but does not repair old logs.
150
+ From a source checkout, use Node 24 LTS and the pinned frozen dependencies:
151
+
152
+ ```powershell
153
+ # Read-only validation; no conversation content is printed.
154
+ node scripts\repair-auto-model-history.mjs 'C:\absolute\path\session.v4.jsonl.zstd'
155
+
156
+ # Optional detached copy in a NEW private directory, never the live source.
157
+ node scripts\repair-auto-model-history.mjs 'C:\absolute\path\session.v4.jsonl.zstd' --write-copy 'C:\private\new-recovery-directory'
158
+ ```
159
+
160
+ The utility validates the entire v4 log with the official rc.2 catalog, marks
161
+ only recognized decision envelopes `ignorable: true`, and preserves all other
162
+ logical fields. Unknown events, malformed relationships, torn tails and inputs
163
+ over 128 MiB fail closed. Copy mode refuses existing destinations and creates a
164
+ byte-exact original, validated copy and SHA-256 receipt; keep both logs private.
165
+
166
+ The corrected writer preserves a separate first zstd header frame for Desktop
167
+ discovery. The original utility combined header/events and could make a copy
168
+ disappear despite logical validation. `reframedHeader: true` reports physical
169
+ repair; zero changed event sequences alone is not readability proof.
170
+
171
+ **Applying a copy requires separate approval and stopped writers.** Recheck the
172
+ live source against `originalSha256`; regenerate if changed. Replace only that
173
+ log, compare `repairedSha256` and reopen with the official reader. Do not replay
174
+ business requests as a test. The utility never installs, restarts, writes the
175
+ source, clears credentials or performs automatic migration.
176
+
177
+ ## Requested parent-to-child selection inheritance
178
+
179
+ The implemented opt-in [profile-wide switch](./parent-model-follow.md) follows
180
+ supported children on each new turn. Fixed parent selection is passed directly;
181
+ Auto passes the exact preference and evaluates the child's own context.
182
+ Child-owned explicit selections and admitted-turn freezing remain authoritative.
183
+ Legacy `parentModelFollow` bindings stay independent.
184
+
185
+ With both policies off, ordinary native children retain Core's creation-time
186
+ route snapshot. Native resolved options/descriptor v3 do not retain whether an
187
+ equal creation route was an explicit override. Enabling the plugin policy
188
+ authorizes replacing that snapshot; it does not reconstruct original intent,
189
+ fabricate descriptor provenance or rewrite Team labels.
190
+
191
+ The original [investigation #229](https://github.com/cloga/dsh-github-copilot/issues/229)
192
+ and [one-switch follow-up #234](https://github.com/cloga/dsh-github-copilot/issues/234)
193
+ record the design history. Upstream native rules/settings UI is separate work,
194
+ not a dependency or claimed shipped feature of this plugin.
195
+
196
+ ## Model exclusions and richer picker boundary
197
+
198
+ **Settings → Models → GitHub Copilot → Manage → Model preferences** offers
199
+ search, All/Enabled/Excluded filters and immediate Exclude/Restore actions.
200
+ Temporarily absent excluded IDs remain restorable. Selected models can also be
201
+ excluded; legacy `lockedModelIds` remains empty.
202
+
203
+ `setModelExcluded(modelId, excluded)` returns a narrow strict preferences result
204
+ after path-level native CAS persistence. It reads no credentials, discovers no
205
+ models and enumerates no Sessions. Unknown settings make rows read-only with
206
+ named diagnostics; status-only Retry cannot imply an empty exclusion set.
207
+ The hidden volatile Config leaf persists through native projection/restart.
208
+
209
+ Directory, Auto pools/modalities, search facts and new-turn admission remove
210
+ exact excluded IDs. An admitted Session/turn/model with the exact native request
211
+ signal may continue steps/retries; `turn/end` clears admission. New turns,
212
+ unbound calls and stale picker rows fail `COPILOT_PREVIEW_MODEL_EXCLUDED`.
213
+ Account/proof/cancellation guards remain revocable. A fixed selection is never
214
+ changed automatically; restore it or select another model before the next turn.
215
+ Zero eligible candidates fails `COPILOT_AUTO_NO_ELIGIBLE_MODEL`.
216
+
217
+ Core owns flat grouping and picker search. The old
218
+ [nested-picker prototype](../output/auto-model-mockup/tiers.html) is historical
219
+ design exploration: its capacity quality scores, nested menu and simulated
220
+ responses are not implementation or model evaluations.
221
+
222
+ ## Public seams and evidence limits
223
+
224
+ `PreviewAdapter.listModels/resolveModel`, `agent/pre-step`, public model-selection
225
+ middleware and `agent/request` compose the real route before request-header
226
+ persistence. Unresolved virtual Auto fails in adapter preparation/streaming.
227
+ Per-Agent/turn caching, native adapter leases, OAuth, replay and cancellation
228
+ keep their existing owners.
229
+
230
+ Required unchanged rc.2 source/published-artifact fixtures on Windows/Linux
231
+ cover eligibility, real headers, durable intent, multi-step/retry freezing,
232
+ images, native compaction, exclusions and gateway access. They do not establish
233
+ live model availability, quality, latency, price, account access or Desktop
234
+ activation. No Core/dependency/private-registry/shared-catalog/history patch is
235
+ permitted. Measured ranking, cross-provider Auto, failure-driven model switching,
236
+ side-effect replay and native picker redesign remain out of scope.