dsh-github-copilot 0.4.1 → 0.4.2-alpha.11

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 (51) hide show
  1. package/AGENTS.md +42 -6
  2. package/CHANGELOG.md +126 -0
  3. package/README.md +75 -25
  4. package/README.zh.md +55 -20
  5. package/deployment-baseline.json +30 -3
  6. package/docs/auto-high-cost.md +51 -20
  7. package/docs/auto-iteration-review.json +13 -13
  8. package/docs/auto-task-routing.md +118 -19
  9. package/docs/automatic-model-routing.md +2 -1
  10. package/docs/copilot-accounts.md +6 -0
  11. package/docs/copilot-compaction.md +1 -1
  12. package/docs/plugin-diagnostics.md +159 -6
  13. package/lib/client.js +814 -59
  14. package/lib/client.js.map +1 -1
  15. package/lib/diagnostics-analysis.js +4 -2
  16. package/lib/diagnostics-types-qvtuvM5E.js +661 -0
  17. package/lib/index.js +8775 -7934
  18. package/lib/manual-compaction-recovery.js +1 -1
  19. package/lib/remote.js +278 -6
  20. package/lib/routed-web.js +1 -1
  21. package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
  22. package/lib/types/auto-allocation-evidence.d.ts +5 -1
  23. package/lib/types/auto-allocation.d.ts +7 -2
  24. package/lib/types/auto-assessment-evidence.d.ts +65 -0
  25. package/lib/types/auto-model-host.d.ts +1 -0
  26. package/lib/types/auto-model-routing.d.ts +1 -1
  27. package/lib/types/auto-task-assessment.d.ts +4 -2
  28. package/lib/types/auto-task-classifier.d.ts +2 -1
  29. package/lib/types/compaction-continuation.d.ts +1 -1
  30. package/lib/types/config.d.ts +18 -2
  31. package/lib/types/context-evidence.d.ts +4 -4
  32. package/lib/types/copilot-auth.d.ts +2 -1
  33. package/lib/types/copilot-usage-remote.d.ts +1 -1
  34. package/lib/types/diagnostics-analysis.d.ts +3 -2
  35. package/lib/types/diagnostics-card.d.ts +1 -0
  36. package/lib/types/diagnostics-collector.d.ts +14 -0
  37. package/lib/types/diagnostics-host.d.ts +114 -3
  38. package/lib/types/diagnostics-remote.d.ts +11 -9
  39. package/lib/types/diagnostics-types.d.ts +486 -30
  40. package/lib/types/native-settings-style.d.ts +1 -1
  41. package/lib/types/preview-provider.d.ts +8 -2
  42. package/lib/types/preview-route.d.ts +1 -1
  43. package/lib/types/remote.d.ts +1 -1
  44. package/lib/types/request-body-composition.d.ts +17 -0
  45. package/lib/types/request-body-evidence.d.ts +2 -1
  46. package/lib/types/request-diagnostics.d.ts +278 -0
  47. package/lib/types/session-continuation-types.d.ts +2 -2
  48. package/lib/types/turn-selection-host.d.ts +2 -1
  49. package/lib/types/turn-selection.d.ts +39 -2
  50. package/package.json +2 -2
  51. package/lib/diagnostics-types-FVf6zjob.js +0 -182
@@ -1,4 +1,4 @@
1
- # Local diagnostics: account and compaction pilot
1
+ # Local diagnostics: account, compaction, Auto allocation and requests
2
2
 
3
3
  Roadmap: [#347](https://github.com/cloga/dsh-github-copilot/issues/347).
4
4
  Phase 0: [#354](https://github.com/cloga/dsh-github-copilot/issues/354).
@@ -22,16 +22,96 @@ through native path-level Settings CAS and confirm readback. This enables
22
22
  collection **and bounded local aggregate persistence**, not exports or uploads.
23
23
  The normal installation does not change this default-off setting.
24
24
 
25
+ The dedicated Local diagnostics region opens with independently collapsed
26
+ **Auto allocation observations**, **Physical request observations**,
27
+ **Credential change observations**, and **Account and compaction observations**.
28
+ Summaries retain compact status/count information; expanding a group neither
29
+ enables collection nor performs another status/request call. The Auto group contains
30
+ the daily table: UTC date, policy, model,
31
+ decision cohort, opportunities, expected selections, selected counts and no-fit
32
+ decisions. Compare expected and selected counts only within matching cohorts;
33
+ these aggregates do not establish execution, quality or billing. Account and
34
+ compaction summaries, collection controls, and detailed data-scope/limits/JSON
35
+ guidance are in collapsed disclosures. A failed operation remains visible outside
36
+ the collapsed controls; expand Collection controls to find **Read status**.
37
+ No failed operation is automatically replayed.
38
+ Clearing aggregates still requires its separate confirmation.
39
+
25
40
  Use the plugin normally: account selection, Identity/Checking and compaction
26
- will contribute independent Client/Host populations. **Read status** returns a
27
- strict aggregate snapshot; **Review aggregate-only JSON → Prepare current JSON**
41
+ will contribute independent Client/Host populations. Auto model allocation has a
42
+ separate **Enable Auto allocation observation** control and its own hidden,
43
+ volatile `github-copilot.autoAllocationDiagnosticsEnabled` path-level CAS.
44
+ It can be enabled without collecting the other diagnostics. Auto decisions
45
+ contribute daily, profile-local allocation aggregates to the same storage
46
+ domain while this switch is enabled. These contain plugin/policy version, model
47
+ ID, target and selected category, task-demand/assessment-source strata,
48
+ high-cost/continuity flags, effective weight, candidate opportunities,
49
+ conditional expected selections, actual selections and no-fit counts. They do
50
+ not contain Session/turn identifiers, prompts, outcomes, execution or billing
51
+ attribution. Aggregate rows are capped at 1,024, retained for 14 days and
52
+ included in the existing 2 MiB snapshot limit; expired, dropped, truncated,
53
+ saturated and restart evidence remains explicit. There is no per-turn export,
54
+ automatic tuning or upload. The aggregate controls can be paused independently.
55
+ New rows also distinguish fixed assessment outcomes: local-known/local-unknown,
56
+ semantic-known/semantic-unknown, disabled, unavailable, timeout, failed,
57
+ invalid-result and context-omitted. Missing legacy outcomes remain **not recorded**,
58
+ never reconstructed from demand/source. Count decisions using Selected plus
59
+ No-fit, not candidate opportunities (one decision may have many candidates).
60
+ These outcomes explain classifier settlement, not network root cause or model
61
+ execution; no error bodies, signals, prompts or Session/turn IDs are added.
62
+ Classification and the conservative omitted-context guard stay unchanged.
63
+ The separately configured assessment budget defaults to 30 seconds as of alpha.7;
64
+ producer versions separate this trial from the earlier eight-second budget.
65
+ Older strict plugin versions may reject new snapshot fields on
66
+ rollback; do not delete or silently rewrite retained evidence to make them parse.
67
+ The separate **Enable request observations** control uses the hidden volatile
68
+ `github-copilot.requestDiagnosticsEnabled` leaf with path-level CAS and exact
69
+ readback. Existing aggregate consent never enables request observations.
70
+ **Clear local diagnostics** clears all three populations, including request
71
+ observations, without changing the three enabled/paused controls.
72
+
73
+ ### Credential-change decisions (#402)
74
+
75
+ The request-observation consent also covers up to 128 content-free credential
76
+ notification/commit observations for 24 hours within the shared 2 MiB cap.
77
+ This user-requested extension does not add a fourth collection switch or
78
+ automatically enable an existing disabled control. It adds no credential reads:
79
+ fixed reasons are derived only from the refresh checks already required by the
80
+ native credential-store bridge. Reasons distinguish qualified refresh, unknown
81
+ source, account/endpoint/entitlement mismatch, expired result, auth mismatch,
82
+ duplicate notification, missing notification, commit mismatch, failed write and
83
+ conflicting write. Not every failure produces a notification; absent evidence
84
+ does not establish a successful refresh.
85
+
86
+ Each observation counts live managed wires that are preparing, dispatched or
87
+ already aborted and records which wires the existing decision preserves or
88
+ revokes. A qualified notification is provisional; a matching commit observation
89
+ is required to confirm its write. Counts are snapshots, not unique requests,
90
+ Session/turn attribution, native retry counts, supplier receipt or eventual
91
+ success. A random change ID joins at most one notification and one commit;
92
+ it does not join physical request rows or identify an account. Unknown source
93
+ does not prove an external/Core writer. Missing legacy fields remain **not
94
+ recorded**, never reconstructed from today's settings or a historical error.
95
+
96
+ Pending handles are capped at 128; clear/pause/expiry/teardown fence later
97
+ callbacks. Saved pending counts become interrupted-on-reopen without fabricated
98
+ commit rows. No grant values, record keys, identities/hashes, endpoints, raw
99
+ errors or conversation data enter storage/Remotes. The #385 qualification and
100
+ native cancellation/retry behavior are unchanged. Capture failures emit only
101
+ `COPILOT_CREDENTIAL_DIAGNOSTICS_CAPTURE_FAILED`; they do not reject business work.
102
+ The aggregate-only offline analyzer validates but does not analyze these rows,
103
+ retaining its `request-observations-not-analyzed` gap.
104
+
105
+ **Read status** returns a strict snapshot; **Review aggregate-only JSON → Prepare current JSON**
28
106
  prepares a read-only copy for explicit review/sharing, never a download or upload.
107
+ When retained request observations exist, the disclosure is instead named
108
+ **Review local diagnostics JSON** and includes that separately consented scope.
29
109
  The coding session does not automatically gain access to the running Host.
30
110
  Pause preserves retained evidence and closes active observations as interrupted.
31
111
  It remains available for a configured-on collector when storage is unavailable;
32
112
  enabling still requires ready storage.
33
113
  Clear requires a separate confirmation, advances an epoch and removes this
34
- domain's aggregates without changing the enabled setting, accounts or history.
114
+ domain's aggregates and request observations without changing the enabled settings, accounts or history.
35
115
  An uncertain write is not automatically replayed by the UI.
36
116
 
37
117
  ## Storage and limits
@@ -101,7 +181,8 @@ signal evidence; arbitrary native error text cannot establish cancellation.
101
181
 
102
182
  Stock/custom-engine physical summaries, recovery opt-out/native-only summary
103
183
  branches, OAuth Add/reauthorization/removal, quota, ordinary model refresh,
104
- managed chat/search/classifier transport and unwrapped RPCs remain uncovered.
184
+ canonical/custom transport and unwrapped RPCs remain uncovered. Managed native
185
+ adapter HTTP dispatches have only the separately enabled coverage below.
105
186
  Native checkpoint observation is not filesystem durability evidence. Reporting
106
187
  loss, crashes, disabled intervals and paging/coverage gaps must never be treated
107
188
  as zero failures. No automatic daily analysis, issue creation, account/model
@@ -118,6 +199,74 @@ factory in its own isolated realm, sharing the actual public Cordis identity.
118
199
  It does not substitute tagged source for published bytes or attach to a live
119
200
  Client module registry; factory qualification is not Desktop activation proof.
120
201
 
202
+ ## Content-free physical request observations (#392)
203
+
204
+ This independent, default-off pilot observes physical Fetch dispatches composed
205
+ by the plugin-managed native adapter. It does not intercept canonical routes,
206
+ change request bodies, timeout settings, retry decisions or native accounting.
207
+ It retains at most 128 completed observations and 128 live handles for 24 hours
208
+ within the same 2 MiB snapshot ceiling. Expiry, capacity drops and sampled
209
+ pending counts are explicit. Pause settles live observations as interrupted;
210
+ clear fences late completions. Saved pending counts become interrupted-on-reopen
211
+ counts, not fabricated request rows. Abrupt loss can still lose the unflushed
212
+ tail and requests that began since the last saved sample.
213
+
214
+ Rows contain plugin version, request time, bounded model/protocol metadata,
215
+ original JSON and dispatched wire byte counts, encoding, bounded composition
216
+ partitions, local header/elapsed timing, HTTP status and fixed terminal/reason
217
+ categories. Existing public native upload observations add ALPN, local body-write
218
+ timing and writable-buffer bytes only when available. Unsupported/ambiguous
219
+ transport evidence stays explicitly unavailable. Bodies up to 16 MiB retain the
220
+ existing synchronous span validator. Larger JSON bodies, including the reported
221
+ approximately 20.4 MiB class, use a cooperative span scanner up to 32 MiB without
222
+ building a payload object graph or decoding image/replay values. It yields every
223
+ 65,536 scanned characters, checks a two-second monotonic work deadline and caps
224
+ concurrent scans at four. Both paths retain 64-level depth, 65,536-value,
225
+ 131,072-token and 128-serialized-key-character limits. Size, work, time and
226
+ cancellation limits remain named unavailable states without partial totals.
227
+ These are diagnostic work limits, not provider request limits.
228
+
229
+ For opted-in observations, large-body counting starts after Fetch invocation
230
+ and does not delay ordinary native response/stream delivery. A retained row can
231
+ receive its numeric composition after terminal settlement; until then its
232
+ initial `size-limit` remains explicit. Refresh/read/export obtains the currently
233
+ available evidence, not a promise of completion. Pause/re-enable, clear,
234
+ teardown, retention and eviction fence late updates, and the counting work
235
+ retains its source string only for that bounded scan. Actual caller cancellation
236
+ can stop it. Verified-408 guidance may await that same bounded work; without
237
+ request consent only an exact verified failure starts the larger scan.
238
+ Replay validation/recovery keeps its original 16 MiB boundary unchanged.
239
+
240
+ Random stream UUIDs group only dispatches within one native SDK stream.
241
+ `dispatchIndex` is physical Fetch order, **not** Core's retry number or an
242
+ end-to-end Session/turn correlation. No account/Session/turn IDs or hashes,
243
+ URLs, headers, raw errors, prompts, tool parameters/results, attachment or replay
244
+ content, credentials or token accounting are retained. Review timestamps/model
245
+ metadata before explicit sharing; nothing is uploaded automatically.
246
+ Comparing JSON/wire sizes and partitions within a stream can reveal repeated
247
+ large payload sizes or growth, not duplicate contents, a Core retry count,
248
+ delivery to a proxy/supplier or the reason for a rejection. No request hashes
249
+ are collected and no automatic size-based mitigation is introduced.
250
+
251
+ An exact verified HTTP408 `user_request_timeout` is classified as
252
+ `request-body-timeout`; other provider/transport errors remain fixed unknown
253
+ categories. Real caller, branded plugin-owned and byte-idle abort signals retain
254
+ their strict attribution. Missing terminal/`terminated` text is not reinterpreted
255
+ as a signal abort. `stream-done` means native terminal observation, not execution,
256
+ billing or recovery success. Local body-write completion and zero writable buffer
257
+ do **not** prove TCP acknowledgement, proxy forwarding or supplier receipt.
258
+ These observations can distinguish a repeated large-body timeout from an
259
+ actual cancellation; they do not identify the remote fault owner or fix
260
+ HTTP408, EOF, retries or the native context meter.
261
+
262
+ The collapsed **Physical request observations** table exposes latest retained
263
+ timings/status/bytes. Detailed composition, transport evidence and random group
264
+ IDs remain in reviewed JSON. Capture failures log only the fixed
265
+ `COPILOT_REQUEST_DIAGNOSTICS_FAILED` code and never replace the native result.
266
+ Synthetic native-SDK tests exercise HTTP408, missing terminal, real abort,
267
+ concurrent stream isolation and unchanged request/error delivery without network
268
+ or live account use.
269
+
121
270
  ## Explicit offline analysis (#368)
122
271
 
123
272
  The package provides a separate, read-only analyzer for one explicitly selected
@@ -141,7 +290,11 @@ must identify the file and profile. The tool never searches DSH homes,
141
290
  enumerates storage units, opens a storage-domain writer or RPC, reads Settings,
142
291
  credentials or history, or falls back between modes.
143
292
 
144
- Both modes reuse the collector's strict Zod snapshot/view vocabulary. The
293
+ Both modes reuse the collector's strict Zod snapshot/view vocabulary. Request
294
+ observations are validated but deliberately not included in the account/compaction
295
+ aggregate report; `request-observations-not-analyzed` marks their omission.
296
+ Review the source JSON separately for transport investigation; absence of
297
+ aggregate candidates says nothing about request failures. The
145
298
  reader rejects symlinks and non-files, caps input at 8 MiB, opens only for
146
299
  reading, decodes fatal UTF-8, and checks file identity, size and modification
147
300
  metadata before and after reading. These checks bound and detect ordinary