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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/AGENTS.md +96 -16
  2. package/CHANGELOG.md +211 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/README.md +106 -18
  5. package/README.zh.md +97 -18
  6. package/deployment-baseline.json +227 -8
  7. package/docs/account-management-experience.md +143 -0
  8. package/docs/auto-high-cost.md +154 -0
  9. package/docs/auto-iteration-review.json +22 -0
  10. package/docs/auto-review-sampling.md +60 -0
  11. package/docs/auto-task-routing.md +8 -6
  12. package/docs/automatic-model-routing.md +33 -5
  13. package/docs/copilot-accounts.md +376 -0
  14. package/docs/copilot-compaction.md +23 -2
  15. package/docs/copilot-usage.md +24 -4
  16. package/docs/evidence-driven-iteration.md +86 -0
  17. package/docs/images/copilot-accounts-credits.png +0 -0
  18. package/docs/images/copilot-accounts.png +0 -0
  19. package/docs/images/copilot-current-provenance.json +39 -0
  20. package/docs/images/copilot-model-preferences.png +0 -0
  21. package/docs/images/copilot-search-routing.png +0 -0
  22. package/docs/images/copilot-session-continuation.png +0 -0
  23. package/docs/manual-compaction-recovery.md +50 -7
  24. package/docs/mockups/copilot-account-dropdown.html +71 -0
  25. package/docs/mockups/copilot-account-management.html +393 -0
  26. package/docs/model-compatibility-acceptance.md +34 -16
  27. package/docs/official-first-020-rc2.md +1 -0
  28. package/docs/plugin-diagnostics.md +452 -0
  29. package/docs/session-continuation.md +141 -0
  30. package/docs/session-search-routing.md +1 -1
  31. package/docs/single-route-migration.md +5 -4
  32. package/lib/client.js +4415 -846
  33. package/lib/client.js.map +1 -1
  34. package/lib/diagnostics-analysis-io.js +78 -0
  35. package/lib/diagnostics-analysis.js +425 -0
  36. package/lib/diagnostics-types-FVf6zjob.js +182 -0
  37. package/lib/index.js +10356 -6020
  38. package/lib/manual-compaction-recovery.js +163 -38
  39. package/lib/remote.js +593 -34
  40. package/lib/routed-web.js +1 -1
  41. package/lib/{search-routing-jzNYveyK.js → search-routing-CV2hs8as.js} +139 -139
  42. package/lib/types/account-dropdown.d.ts +22 -0
  43. package/lib/types/account-model-auth.d.ts +1 -1
  44. package/lib/types/authorization-code-clipboard.d.ts +4 -0
  45. package/lib/types/authorization-controller.d.ts +2 -0
  46. package/lib/types/auto-allocation-card.d.ts +9 -0
  47. package/lib/types/auto-allocation-evidence.d.ts +38 -0
  48. package/lib/types/auto-allocation.d.ts +24 -0
  49. package/lib/types/auto-model-host.d.ts +2 -0
  50. package/lib/types/auto-model-routing.d.ts +6 -2
  51. package/lib/types/auto-review-sampling.d.ts +6 -0
  52. package/lib/types/auto-task-classifier.d.ts +1 -1
  53. package/lib/types/background-compaction.d.ts +2 -2
  54. package/lib/types/client.d.ts +19 -3
  55. package/lib/types/compaction-continuation-ui.d.ts +29 -0
  56. package/lib/types/compaction-continuation.d.ts +48 -0
  57. package/lib/types/compaction-input-estimate.d.ts +24 -0
  58. package/lib/types/compaction-replay.d.ts +18 -0
  59. package/lib/types/composer-notice-style.d.ts +7 -0
  60. package/lib/types/config.d.ts +42 -2
  61. package/lib/types/context-evidence-ui.d.ts +18 -1
  62. package/lib/types/context-evidence.d.ts +152 -4
  63. package/lib/types/copilot-account-presentation.d.ts +7 -0
  64. package/lib/types/copilot-accounts-card.d.ts +43 -0
  65. package/lib/types/copilot-accounts-host.d.ts +93 -0
  66. package/lib/types/copilot-accounts-remote.d.ts +85 -0
  67. package/lib/types/copilot-accounts-types.d.ts +43 -0
  68. package/lib/types/copilot-auth.d.ts +3 -1
  69. package/lib/types/copilot-usage-card.d.ts +23 -0
  70. package/lib/types/copilot-usage-host.d.ts +9 -1
  71. package/lib/types/copilot-usage-remote.d.ts +2 -1
  72. package/lib/types/copilot-usage-types.d.ts +1 -0
  73. package/lib/types/diagnostics-analysis-io.d.ts +23 -0
  74. package/lib/types/diagnostics-analysis.d.ts +295 -0
  75. package/lib/types/diagnostics-card.d.ts +11 -0
  76. package/lib/types/diagnostics-client.d.ts +13 -0
  77. package/lib/types/diagnostics-collector.d.ts +36 -0
  78. package/lib/types/diagnostics-host.d.ts +72 -0
  79. package/lib/types/diagnostics-remote.d.ts +109 -0
  80. package/lib/types/diagnostics-types.d.ts +431 -0
  81. package/lib/types/manual-compaction-recovery.d.ts +18 -3
  82. package/lib/types/model-preferences-card.d.ts +1 -1
  83. package/lib/types/native-settings-style.d.ts +10 -0
  84. package/lib/types/parent-model-follow-card.d.ts +2 -11
  85. package/lib/types/preview-provider.d.ts +4 -0
  86. package/lib/types/preview-route.d.ts +7 -5
  87. package/lib/types/remote.d.ts +9 -6
  88. package/lib/types/replay-recovery-host.d.ts +2 -2
  89. package/lib/types/replay-recovery-ui.d.ts +3 -1
  90. package/lib/types/request-body-evidence.d.ts +3 -1
  91. package/lib/types/responses-replay-compat.d.ts +2 -1
  92. package/lib/types/responses-request-compression.d.ts +33 -0
  93. package/lib/types/session-accounts-controller.d.ts +20 -0
  94. package/lib/types/session-accounts-host.d.ts +33 -0
  95. package/lib/types/session-accounts-remote.d.ts +114 -0
  96. package/lib/types/session-accounts.d.ts +38 -0
  97. package/lib/types/session-continuation-host.d.ts +45 -0
  98. package/lib/types/session-continuation-remote.d.ts +22 -0
  99. package/lib/types/session-continuation-types.d.ts +62 -0
  100. package/lib/types/session-continuation-ui.d.ts +49 -0
  101. package/lib/types/session-continuation.d.ts +14 -0
  102. package/lib/types/turn-request-models.d.ts +55 -0
  103. package/lib/types/turn-selection-card.d.ts +15 -1
  104. package/lib/types/turn-selection-host.d.ts +23 -0
  105. package/lib/types/turn-selection-remote.d.ts +4 -0
  106. package/lib/types/turn-selection.d.ts +19 -4
  107. package/package.json +19 -3
  108. package/scripts/analyze-diagnostics.mjs +91 -0
  109. package/scripts/iteration-review.mjs +53 -0
@@ -0,0 +1,43 @@
1
+ export declare const COPILOT_ACCOUNT_ID_PATTERN: RegExp;
2
+ export declare const COPILOT_ACCOUNTS_MAX = 32;
3
+ export declare const GITHUB_ACCOUNT_LOGIN_PATTERN: RegExp;
4
+ export declare const COPILOT_ACCOUNTS_DIAGNOSTICS: readonly ["COPILOT_ACCOUNTS_SELECTOR_INVALID", "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE", "COPILOT_ACCOUNTS_SELECTED_MISSING", "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE", "COPILOT_ACCOUNTS_CHANGED", "COPILOT_ACCOUNTS_BUSY", "COPILOT_ACCOUNTS_CONFLICT", "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN", "COPILOT_ACCOUNTS_MODELS_FAILED", "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE", "COPILOT_ACCOUNTS_IDENTITY_INVALID", "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT", "COPILOT_ACCOUNTS_IDENTITY_TLS", "COPILOT_ACCOUNTS_IDENTITY_NETWORK", "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED", "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED", "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR", "COPILOT_ACCOUNTS_IDENTITY_CHANGED", "COPILOT_ACCOUNTS_DUPLICATE", "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED", "COPILOT_ACCOUNTS_ROUTE_BLOCKED", "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE", "COPILOT_ACCOUNTS_LIMIT", "COPILOT_ACCOUNTS_AUTH_FAILED", "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE", "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED", "COPILOT_ACCOUNTS_REMOVE_FAILED", "COPILOT_ACCOUNTS_DISPOSED"];
5
+ export type CopilotAccountsDiagnostic = typeof COPILOT_ACCOUNTS_DIAGNOSTICS[number];
6
+ export interface CopilotAccountIdentity {
7
+ readonly login: string;
8
+ readonly userId: number;
9
+ }
10
+ export interface CopilotAccountView {
11
+ readonly id: string;
12
+ readonly identity?: CopilotAccountIdentity;
13
+ readonly identityState: 'ready' | 'unavailable' | 'unknown';
14
+ readonly configured: boolean;
15
+ }
16
+ export interface CopilotAccountsNotice {
17
+ readonly message: string;
18
+ readonly url?: string;
19
+ readonly code?: string;
20
+ }
21
+ export interface CopilotAccountsView {
22
+ readonly state: 'ready' | 'error';
23
+ readonly activeAccountId: string;
24
+ readonly revision?: number;
25
+ readonly writable: boolean;
26
+ readonly switchable: boolean;
27
+ readonly accounts: readonly CopilotAccountView[];
28
+ readonly operation?: 'authorizing' | 'verifying' | 'switching';
29
+ readonly notices: readonly CopilotAccountsNotice[];
30
+ readonly diagnostic?: CopilotAccountsDiagnostic;
31
+ }
32
+ /** Host-only, immutable addressing. Never serialize this object into a Remote. */
33
+ export interface CopilotAccountBinding {
34
+ readonly accountId: string;
35
+ readonly key: string;
36
+ readonly generation: number;
37
+ assertCurrent(): void;
38
+ }
39
+ export interface CopilotAccountLease {
40
+ readonly binding: CopilotAccountBinding;
41
+ release(): void;
42
+ }
43
+ //# sourceMappingURL=copilot-accounts-types.d.ts.map
@@ -5,9 +5,11 @@
5
5
  import type { Context } from '@deepseek-ai/cordis';
6
6
  import { type CredentialStore } from '@earendil-works/pi-ai';
7
7
  import { GITHUB_COPILOT_PROVIDER_ID, GITHUB_COPILOT_PREVIEW_PROVIDER_ID } from './copilot-identity.ts';
8
+ import type { CopilotAccountBinding } from './copilot-accounts-types.ts';
8
9
  export { normalizeGitHubCopilotOAuthCredential } from './copilot-grant.ts';
10
+ export declare function captureActiveGitHubCopilotBinding(ctx: Context): CopilotAccountBinding | undefined;
9
11
  /** Bind exactly one logical route to the canonical Host-owned credential record. */
10
- export declare function createGitHubCopilotCredentialStore(ctx: Context, logicalProviderId?: typeof GITHUB_COPILOT_PROVIDER_ID | typeof GITHUB_COPILOT_PREVIEW_PROVIDER_ID): CredentialStore;
12
+ export declare function createGitHubCopilotCredentialStore(ctx: Context, logicalProviderId?: typeof GITHUB_COPILOT_PROVIDER_ID | typeof GITHUB_COPILOT_PREVIEW_PROVIDER_ID, binding?: CopilotAccountBinding): CredentialStore;
11
13
  /**
12
14
  * Build one resolver whose pi-ai collection refreshes OAuth credentials inside
13
15
  * the DSH record's serialized modify operation before exposing request auth.
@@ -1,5 +1,7 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { CopilotUsageView } from './copilot-usage-types.ts';
3
+ import type { CopilotAccountsRemote } from './copilot-accounts-card.ts';
4
+ import type { SessionAccountView } from './session-accounts-remote.ts';
3
5
  /** Client-only face: no credentials, provider transport or billing arithmetic. */
4
6
  export interface CopilotUsageRemote {
5
7
  get(): Promise<{
@@ -19,9 +21,30 @@ export interface CopilotUsageRemote {
19
21
  }
20
22
  export interface CopilotUsageCardProps {
21
23
  remote?: CopilotUsageRemote;
24
+ accountsRemote?: Pick<CopilotAccountsRemote, 'get' | 'refreshIdentity' | 'ensureIdentity'>;
22
25
  /** Changes revoke every in-flight read, including switches between Copilot routes. */
23
26
  contextKey: string;
24
27
  locale?: string;
28
+ continuation?: ReactElement;
29
+ onManage?: () => void;
30
+ /** Parent-owned consent; check the request signal after awaits and dismiss on abort. */
31
+ beforeAccountChange?: (accountId: string | null, signal: AbortSignal) => Promise<boolean>;
32
+ sessionAccount?: {
33
+ get(): Promise<{
34
+ ok: true;
35
+ value: SessionAccountView;
36
+ } | {
37
+ ok: false;
38
+ error: unknown;
39
+ }>;
40
+ set(accountId: string | null, revision: number): Promise<{
41
+ ok: true;
42
+ value: SessionAccountView;
43
+ } | {
44
+ ok: false;
45
+ error: unknown;
46
+ }>;
47
+ };
25
48
  }
26
49
  /** Mounted only for a proven effective Copilot selection in the owning Session. */
27
50
  export declare function CopilotUsageCard(props: CopilotUsageCardProps): ReactElement;
@@ -2,8 +2,10 @@ import { Context } from '@deepseek-ai/cordis';
2
2
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import { Agent } from 'undici';
4
4
  import type { CopilotUsageView } from './copilot-usage-types.ts';
5
+ import type { CopilotAccountBinding } from './copilot-accounts-types.ts';
5
6
  export declare const COPILOT_USAGE_ENDPOINT = "https://api.github.com/copilot_internal/user";
6
7
  interface Dependencies {
8
+ readonly accountId?: string;
7
9
  readCredential(): Promise<unknown>;
8
10
  fetch?: typeof globalThis.fetch;
9
11
  now?: () => number;
@@ -44,8 +46,14 @@ declare module '@deepseek-ai/cordis' {
44
46
  }
45
47
  }
46
48
  export default class GitHubCopilotUsageController extends TypertRemoteService {
47
- private readonly source;
49
+ private readonly accountSources;
50
+ private source;
51
+ private accountSignature;
52
+ private sourceInitialized;
48
53
  constructor(ctx: Context);
54
+ forAccount(binding: CopilotAccountBinding, force?: boolean): Promise<CopilotUsageView>;
55
+ private createSource;
56
+ private current;
49
57
  get(): Promise<CopilotUsageView>;
50
58
  refresh(): Promise<CopilotUsageView>;
51
59
  }
@@ -11,11 +11,12 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
11
11
  }
12
12
  }
13
13
  export declare const CopilotUsageViewSchema: z.ZodObject<{
14
+ accountId: z.ZodOptional<z.ZodString>;
14
15
  state: z.ZodEnum<{
15
16
  ready: "ready";
17
+ unavailable: "unavailable";
16
18
  stale: "stale";
17
19
  "signed-out": "signed-out";
18
- unavailable: "unavailable";
19
20
  }>;
20
21
  billing: z.ZodEnum<{
21
22
  unknown: "unknown";
@@ -1,5 +1,6 @@
1
1
  /** Client-safe account snapshot. Amounts are credits or requests, never token estimates. */
2
2
  export interface CopilotUsageView {
3
+ readonly accountId?: string;
3
4
  readonly state: 'ready' | 'stale' | 'unavailable' | 'signed-out';
4
5
  readonly billing: 'credits' | 'requests' | 'unknown';
5
6
  readonly budget: 'individual' | 'pooled' | 'unknown';
@@ -0,0 +1,23 @@
1
+ export declare const DIAGNOSTICS_ANALYSIS_MAX_INPUT_BYTES: number;
2
+ interface FileStat {
3
+ isFile(): boolean;
4
+ isSymbolicLink(): boolean;
5
+ size: number;
6
+ mtimeMs: number;
7
+ dev: number;
8
+ ino: number;
9
+ }
10
+ interface ReadHandle {
11
+ stat(): Promise<FileStat>;
12
+ read(buffer: Buffer, offset: number, length: number, position: number): Promise<{
13
+ bytesRead: number;
14
+ }>;
15
+ close(): Promise<void>;
16
+ }
17
+ export interface DiagnosticsAnalysisFileSystem {
18
+ lstat(path: string): Promise<FileStat>;
19
+ open(path: string, flags: 'r'): Promise<ReadHandle>;
20
+ }
21
+ export declare function readBoundedDiagnosticsFile(filePath: string, io?: DiagnosticsAnalysisFileSystem): Promise<string>;
22
+ export {};
23
+ //# sourceMappingURL=diagnostics-analysis-io.d.ts.map
@@ -0,0 +1,295 @@
1
+ import { z } from 'zod';
2
+ import type { DiagnosticsSnapshot, DiagnosticsView } from './diagnostics-types.ts';
3
+ export declare const DiagnosticsAnalysisReportSchema: z.ZodObject<{
4
+ reportVersion: z.ZodLiteral<1>;
5
+ coverageVersion: z.ZodLiteral<1>;
6
+ interpretation: z.ZodLiteral<"descriptive-observations-only">;
7
+ source: z.ZodEnum<{
8
+ "reviewed-view": "reviewed-view";
9
+ "persisted-snapshot": "persisted-snapshot";
10
+ }>;
11
+ observedAt: z.ZodNumber;
12
+ snapshotAt: z.ZodNumber;
13
+ ageMs: z.ZodNullable<z.ZodNumber>;
14
+ epoch: z.ZodNumber;
15
+ coverageComplete: z.ZodLiteral<false>;
16
+ effectivenessVerified: z.ZodLiteral<false>;
17
+ gaps: z.ZodArray<z.ZodEnum<{
18
+ "clock-discontinuity": "clock-discontinuity";
19
+ "persisted-only": "persisted-only";
20
+ "live-enabled-state-unknown": "live-enabled-state-unknown";
21
+ "live-pending-state-unknown": "live-pending-state-unknown";
22
+ "unflushed-tail-unknown": "unflushed-tail-unknown";
23
+ "stored-pending-is-not-live": "stored-pending-is-not-live";
24
+ "no-retained-operation-observations": "no-retained-operation-observations";
25
+ "account-switch-not-observed": "account-switch-not-observed";
26
+ "compaction-not-observed": "compaction-not-observed";
27
+ "stale-snapshot": "stale-snapshot";
28
+ "expired-in-stored-snapshot": "expired-in-stored-snapshot";
29
+ "host-dropped": "host-dropped";
30
+ "client-dropped": "client-dropped";
31
+ "client-unconfirmed": "client-unconfirmed";
32
+ "retention-or-capacity-eviction": "retention-or-capacity-eviction";
33
+ "collector-saturated": "collector-saturated";
34
+ "interrupted-observations": "interrupted-observations";
35
+ "recorded-pause": "recorded-pause";
36
+ "unpersisted-observations": "unpersisted-observations";
37
+ "collection-paused": "collection-paused";
38
+ "storage-not-ready": "storage-not-ready";
39
+ "analysis-count-overflow": "analysis-count-overflow";
40
+ "no-cross-layer-correlation": "no-cross-layer-correlation";
41
+ "no-unique-impact": "no-unique-impact";
42
+ "hour-boundary-censoring": "hour-boundary-censoring";
43
+ "no-collection-coverage-clock": "no-collection-coverage-clock";
44
+ "no-calibrated-alert-thresholds": "no-calibrated-alert-thresholds";
45
+ "no-baseline-trend": "no-baseline-trend";
46
+ "no-root-cause-proof": "no-root-cause-proof";
47
+ }>>;
48
+ collection: z.ZodObject<{
49
+ enabled: z.ZodNullable<z.ZodBoolean>;
50
+ state: z.ZodNullable<z.ZodEnum<{
51
+ error: "error";
52
+ ready: "ready";
53
+ unavailable: "unavailable";
54
+ loading: "loading";
55
+ }>>;
56
+ diagnostic: z.ZodNullable<z.ZodEnum<{
57
+ none: "none";
58
+ "storage-unavailable": "storage-unavailable";
59
+ "storage-invalid": "storage-invalid";
60
+ "storage-write-failed": "storage-write-failed";
61
+ "profile-unavailable": "profile-unavailable";
62
+ "settings-unavailable": "settings-unavailable";
63
+ "settings-conflict": "settings-conflict";
64
+ "client-report-failed": "client-report-failed";
65
+ "client-report-revoked": "client-report-revoked";
66
+ closed: "closed";
67
+ }>>;
68
+ dirty: z.ZodNullable<z.ZodBoolean>;
69
+ persistedAt: z.ZodNullable<z.ZodNumber>;
70
+ }, z.core.$strict>;
71
+ counters: z.ZodObject<{
72
+ dropped: z.ZodNumber;
73
+ clientDropped: z.ZodNumber;
74
+ clientUnconfirmed: z.ZodNumber;
75
+ evicted: z.ZodNumber;
76
+ saturated: z.ZodNumber;
77
+ interrupted: z.ZodNumber;
78
+ }, z.core.$strict>;
79
+ populations: z.ZodArray<z.ZodObject<{
80
+ version: z.ZodString;
81
+ layer: z.ZodEnum<{
82
+ client: "client";
83
+ host: "host";
84
+ }>;
85
+ operation: z.ZodEnum<{
86
+ compaction: "compaction";
87
+ "account-global-switch": "account-global-switch";
88
+ "account-session-select": "account-session-select";
89
+ "account-session-inherit": "account-session-inherit";
90
+ "identity-read": "identity-read";
91
+ "identity-flight": "identity-flight";
92
+ "compaction-summary": "compaction-summary";
93
+ collection: "collection";
94
+ }>;
95
+ successMeaning: z.ZodEnum<{
96
+ "owner-terminal-observation-only": "owner-terminal-observation-only";
97
+ "matching-checkpoint-and-end-observed": "matching-checkpoint-and-end-observed";
98
+ "summary-call-fulfilled-not-checkpoint-commit": "summary-call-fulfilled-not-checkpoint-commit";
99
+ }>;
100
+ firstHour: z.ZodNumber;
101
+ lastHour: z.ZodNumber;
102
+ started: z.ZodObject<{
103
+ value: z.ZodNullable<z.ZodNumber>;
104
+ overflow: z.ZodBoolean;
105
+ }, z.core.$strict>;
106
+ terminalObservations: z.ZodObject<{
107
+ value: z.ZodNullable<z.ZodNumber>;
108
+ overflow: z.ZodBoolean;
109
+ }, z.core.$strict>;
110
+ outcomes: z.ZodObject<{
111
+ success: z.ZodObject<{
112
+ value: z.ZodNullable<z.ZodNumber>;
113
+ overflow: z.ZodBoolean;
114
+ }, z.core.$strict>;
115
+ 'no-op': z.ZodObject<{
116
+ value: z.ZodNullable<z.ZodNumber>;
117
+ overflow: z.ZodBoolean;
118
+ }, z.core.$strict>;
119
+ cancelled: z.ZodObject<{
120
+ value: z.ZodNullable<z.ZodNumber>;
121
+ overflow: z.ZodBoolean;
122
+ }, z.core.$strict>;
123
+ 'policy-rejected': z.ZodObject<{
124
+ value: z.ZodNullable<z.ZodNumber>;
125
+ overflow: z.ZodBoolean;
126
+ }, z.core.$strict>;
127
+ revoked: z.ZodObject<{
128
+ value: z.ZodNullable<z.ZodNumber>;
129
+ overflow: z.ZodBoolean;
130
+ }, z.core.$strict>;
131
+ 'environment-fault': z.ZodObject<{
132
+ value: z.ZodNullable<z.ZodNumber>;
133
+ overflow: z.ZodBoolean;
134
+ }, z.core.$strict>;
135
+ failed: z.ZodObject<{
136
+ value: z.ZodNullable<z.ZodNumber>;
137
+ overflow: z.ZodBoolean;
138
+ }, z.core.$strict>;
139
+ unknown: z.ZodObject<{
140
+ value: z.ZodNullable<z.ZodNumber>;
141
+ overflow: z.ZodBoolean;
142
+ }, z.core.$strict>;
143
+ interrupted: z.ZodObject<{
144
+ value: z.ZodNullable<z.ZodNumber>;
145
+ overflow: z.ZodBoolean;
146
+ }, z.core.$strict>;
147
+ }, z.core.$strict>;
148
+ terminalLatency: z.ZodArray<z.ZodObject<{
149
+ lowerMs: z.ZodNumber;
150
+ upperExclusiveMs: z.ZodNullable<z.ZodNumber>;
151
+ count: z.ZodObject<{
152
+ value: z.ZodNullable<z.ZodNumber>;
153
+ overflow: z.ZodBoolean;
154
+ }, z.core.$strict>;
155
+ }, z.core.$strict>>;
156
+ stageAgeObservations: z.ZodArray<z.ZodObject<{
157
+ lowerMs: z.ZodNumber;
158
+ upperExclusiveMs: z.ZodNullable<z.ZodNumber>;
159
+ count: z.ZodObject<{
160
+ value: z.ZodNullable<z.ZodNumber>;
161
+ overflow: z.ZodBoolean;
162
+ }, z.core.$strict>;
163
+ }, z.core.$strict>>;
164
+ pendingSamples: z.ZodObject<{
165
+ value: z.ZodNullable<z.ZodNumber>;
166
+ overflow: z.ZodBoolean;
167
+ }, z.core.$strict>;
168
+ pendingSampleAges: z.ZodArray<z.ZodObject<{
169
+ lowerMs: z.ZodNumber;
170
+ upperExclusiveMs: z.ZodNullable<z.ZodNumber>;
171
+ count: z.ZodObject<{
172
+ value: z.ZodNullable<z.ZodNumber>;
173
+ overflow: z.ZodBoolean;
174
+ }, z.core.$strict>;
175
+ }, z.core.$strict>>;
176
+ stageObservations: z.ZodObject<{
177
+ value: z.ZodNullable<z.ZodNumber>;
178
+ overflow: z.ZodBoolean;
179
+ }, z.core.$strict>;
180
+ startsMinusTerminals: z.ZodNull;
181
+ exactOperationFailureRate: z.ZodNull;
182
+ }, z.core.$strict>>;
183
+ pendingAtSnapshot: z.ZodArray<z.ZodObject<{
184
+ version: z.ZodString;
185
+ operation: z.ZodEnum<{
186
+ compaction: "compaction";
187
+ "account-global-switch": "account-global-switch";
188
+ "account-session-select": "account-session-select";
189
+ "account-session-inherit": "account-session-inherit";
190
+ "identity-read": "identity-read";
191
+ "identity-flight": "identity-flight";
192
+ "compaction-summary": "compaction-summary";
193
+ collection: "collection";
194
+ }>;
195
+ stage: z.ZodEnum<{
196
+ ended: "ended";
197
+ admitted: "admitted";
198
+ "rpc-invoked": "rpc-invoked";
199
+ "host-received": "host-received";
200
+ "identity-validation": "identity-validation";
201
+ "model-validation": "model-validation";
202
+ cas: "cas";
203
+ readback: "readback";
204
+ "response-received": "response-received";
205
+ decoded: "decoded";
206
+ "client-settled": "client-settled";
207
+ "summary-attempt": "summary-attempt";
208
+ "checkpoint-committed": "checkpoint-committed";
209
+ "cache-hit": "cache-hit";
210
+ "joined-flight": "joined-flight";
211
+ cooldown: "cooldown";
212
+ dispatched: "dispatched";
213
+ }>;
214
+ bucket: z.ZodNumber;
215
+ count: z.ZodNumber;
216
+ }, z.core.$strict>>;
217
+ investigationCandidates: z.ZodArray<z.ZodObject<{
218
+ fingerprint: z.ZodString;
219
+ category: z.ZodEnum<{
220
+ "recorded-failure": "recorded-failure";
221
+ "unknown-outcome": "unknown-outcome";
222
+ }>;
223
+ layer: z.ZodEnum<{
224
+ client: "client";
225
+ host: "host";
226
+ }>;
227
+ operation: z.ZodEnum<{
228
+ compaction: "compaction";
229
+ "account-global-switch": "account-global-switch";
230
+ "account-session-select": "account-session-select";
231
+ "account-session-inherit": "account-session-inherit";
232
+ "identity-read": "identity-read";
233
+ "identity-flight": "identity-flight";
234
+ "compaction-summary": "compaction-summary";
235
+ collection: "collection";
236
+ }>;
237
+ metric: z.ZodEnum<{
238
+ unknown: "unknown";
239
+ "environment-fault": "environment-fault";
240
+ failed: "failed";
241
+ }>;
242
+ reason: z.ZodEnum<{
243
+ none: "none";
244
+ COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE: "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE";
245
+ COPILOT_ACCOUNTS_CHANGED: "COPILOT_ACCOUNTS_CHANGED";
246
+ COPILOT_ACCOUNTS_BUSY: "COPILOT_ACCOUNTS_BUSY";
247
+ COPILOT_ACCOUNTS_CONFLICT: "COPILOT_ACCOUNTS_CONFLICT";
248
+ COPILOT_ACCOUNTS_COMMIT_UNCERTAIN: "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN";
249
+ COPILOT_ACCOUNTS_MODELS_FAILED: "COPILOT_ACCOUNTS_MODELS_FAILED";
250
+ COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE: "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE";
251
+ COPILOT_ACCOUNTS_IDENTITY_INVALID: "COPILOT_ACCOUNTS_IDENTITY_INVALID";
252
+ COPILOT_ACCOUNTS_IDENTITY_TIMEOUT: "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT";
253
+ COPILOT_ACCOUNTS_IDENTITY_TLS: "COPILOT_ACCOUNTS_IDENTITY_TLS";
254
+ COPILOT_ACCOUNTS_IDENTITY_NETWORK: "COPILOT_ACCOUNTS_IDENTITY_NETWORK";
255
+ COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED: "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED";
256
+ COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED: "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED";
257
+ COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR: "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR";
258
+ unknown: "unknown";
259
+ "rpc-unavailable": "rpc-unavailable";
260
+ "decode-invalid": "decode-invalid";
261
+ COPILOT_SESSION_ACCOUNTS_UNAVAILABLE: "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE";
262
+ COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE: "COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE";
263
+ COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN: "COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN";
264
+ COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH: "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH";
265
+ CONTEXT_WINDOW_EXCEEDED: "CONTEXT_WINDOW_EXCEEDED";
266
+ COPILOT_MANUAL_RECOVERY_FIXED_PREFIX: "COPILOT_MANUAL_RECOVERY_FIXED_PREFIX";
267
+ COPILOT_MANUAL_RECOVERY_INDIVISIBLE: "COPILOT_MANUAL_RECOVERY_INDIVISIBLE";
268
+ COPILOT_MANUAL_RECOVERY_CALL_LIMIT: "COPILOT_MANUAL_RECOVERY_CALL_LIMIT";
269
+ COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY: "COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY";
270
+ COPILOT_MANUAL_RECOVERY_UNBALANCED: "COPILOT_MANUAL_RECOVERY_UNBALANCED";
271
+ }>;
272
+ versions: z.ZodArray<z.ZodString>;
273
+ firstHour: z.ZodNumber;
274
+ lastHour: z.ZodNumber;
275
+ observations: z.ZodObject<{
276
+ value: z.ZodNullable<z.ZodNumber>;
277
+ overflow: z.ZodBoolean;
278
+ }, z.core.$strict>;
279
+ regressionProven: z.ZodLiteral<false>;
280
+ persistentFaultProven: z.ZodLiteral<false>;
281
+ rootCause: z.ZodLiteral<"unknown">;
282
+ }, z.core.$strict>>;
283
+ }, z.core.$strict>;
284
+ export type DiagnosticsAnalysisReport = z.infer<typeof DiagnosticsAnalysisReportSchema>;
285
+ export type DiagnosticsAnalysisSource = 'reviewed-view' | 'persisted-snapshot';
286
+ export declare function diagnosticsUnitName(profileName: string): string;
287
+ export declare function parseReviewedView(text: string): DiagnosticsView;
288
+ export declare function parsePersistedUnit(text: string, expectedUnit: string): DiagnosticsSnapshot;
289
+ export declare function analyzeSnapshot(input: unknown, options: {
290
+ source: DiagnosticsAnalysisSource;
291
+ observedAt: number;
292
+ view?: DiagnosticsView;
293
+ }): DiagnosticsAnalysisReport;
294
+ export declare function analyzeReviewedView(view: DiagnosticsView, observedAt: number): DiagnosticsAnalysisReport;
295
+ //# sourceMappingURL=diagnostics-analysis.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { CSSProperties } from 'react';
3
+ export type DiagnosticsRemote = Context['remote']['githubCopilotDiagnostics'];
4
+ export declare function DiagnosticsCard({ remote }: {
5
+ remote?: DiagnosticsRemote;
6
+ }): import("react").DetailedReactHTMLElement<{
7
+ 'aria-label': string;
8
+ 'data-copilot-native-ui': boolean;
9
+ style: CSSProperties;
10
+ }, HTMLElement>;
11
+ //# sourceMappingURL=diagnostics-card.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { DiagnosticsHandle } from './diagnostics-collector.ts';
3
+ import type { DiagnosticsOperation, DiagnosticsView } from './diagnostics-types.ts';
4
+ export declare function updateDiagnosticsClient(view: DiagnosticsView): void;
5
+ export declare function clientDiagnosticsReportingFailed(): boolean;
6
+ export declare function beginClientDiagnostics(operation: DiagnosticsOperation): DiagnosticsHandle | undefined;
7
+ export declare function createClientDiagnosticsScope(): {
8
+ begin(operation: DiagnosticsOperation): DiagnosticsHandle | undefined;
9
+ close(): void;
10
+ };
11
+ /** Bounded additive reporting, no retry after an uncertain RPC result. */
12
+ export declare function installDiagnosticsClient(ctx: Context): () => Promise<void>;
13
+ //# sourceMappingURL=diagnostics-client.d.ts.map
@@ -0,0 +1,36 @@
1
+ import type { DiagnosticsOperation, DiagnosticsStage, DiagnosticsOutcome, DiagnosticsReason, DiagnosticsRow, DiagnosticsSnapshot } from './diagnostics-types.ts';
2
+ export interface DiagnosticsHandle {
3
+ stage(stage: DiagnosticsStage): void;
4
+ finish(outcome: DiagnosticsOutcome, reason?: DiagnosticsReason): void;
5
+ }
6
+ export declare function emptyDiagnostics(): DiagnosticsSnapshot;
7
+ /** Only fixed dimensions cross this boundary; live handles never leave the owner. */
8
+ export declare class DiagnosticsCollector {
9
+ readonly version: string;
10
+ readonly layer: 'client' | 'host';
11
+ private readonly changed;
12
+ private readonly wall;
13
+ private readonly mono;
14
+ private data;
15
+ private readonly live;
16
+ private enabled;
17
+ private lastWall;
18
+ constructor(version: string, layer: 'client' | 'host', changed?: () => void, wall?: () => number, mono?: () => number);
19
+ restore(snapshot: DiagnosticsSnapshot): void;
20
+ setEnabled(enabled: boolean): void;
21
+ assertCanEnable(): void;
22
+ clear(): void;
23
+ begin(operation: DiagnosticsOperation): DiagnosticsHandle;
24
+ private settle;
25
+ private age;
26
+ private increment;
27
+ private expire;
28
+ private add;
29
+ private oldestIndex;
30
+ snapshot(): DiagnosticsSnapshot;
31
+ close(): void;
32
+ noteDropped(): void;
33
+ noteClientGaps(dropped: number, unconfirmed: number): void;
34
+ mergeClient(rows: readonly DiagnosticsRow[]): void;
35
+ }
36
+ //# sourceMappingURL=diagnostics-collector.d.ts.map
@@ -0,0 +1,72 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
+ import type { DomainGlobalSpec } from '@deepseek-ai/dsh-storage-domain';
4
+ import { DiagnosticsCollector } from './diagnostics-collector.ts';
5
+ import type { DiagnosticsHandle } from './diagnostics-collector.ts';
6
+ import type { DiagnosticsOperation, DiagnosticsView } from './diagnostics-types.ts';
7
+ import type { ClientDiagnosticsBatch } from './diagnostics-remote.ts';
8
+ export declare const diagnosticsDomain: {
9
+ name: string;
10
+ version: number;
11
+ tables: {};
12
+ global: DomainGlobalSpec<{
13
+ schemaVersion: 1;
14
+ coverageVersion: 1;
15
+ epoch: number;
16
+ updatedAt: number;
17
+ rows: {
18
+ hour: number;
19
+ version: string;
20
+ layer: "client" | "host";
21
+ operation: "compaction" | "account-global-switch" | "account-session-select" | "account-session-inherit" | "identity-read" | "identity-flight" | "compaction-summary" | "collection";
22
+ stage: "ended" | "admitted" | "rpc-invoked" | "host-received" | "identity-validation" | "model-validation" | "cas" | "readback" | "response-received" | "decoded" | "client-settled" | "summary-attempt" | "checkpoint-committed" | "cache-hit" | "joined-flight" | "cooldown" | "dispatched";
23
+ metric: "paused" | "unknown" | "started" | "stage" | "success" | "no-op" | "cancelled" | "policy-rejected" | "revoked" | "environment-fault" | "failed" | "interrupted" | "dropped" | "expired" | "clock-discontinuity" | "pending-sample";
24
+ reason: "none" | "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE" | "COPILOT_ACCOUNTS_CHANGED" | "COPILOT_ACCOUNTS_BUSY" | "COPILOT_ACCOUNTS_CONFLICT" | "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN" | "COPILOT_ACCOUNTS_MODELS_FAILED" | "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE" | "COPILOT_ACCOUNTS_IDENTITY_INVALID" | "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT" | "COPILOT_ACCOUNTS_IDENTITY_TLS" | "COPILOT_ACCOUNTS_IDENTITY_NETWORK" | "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED" | "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED" | "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR" | "unknown" | "rpc-unavailable" | "decode-invalid" | "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE" | "COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE" | "COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN" | "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH" | "CONTEXT_WINDOW_EXCEEDED" | "COPILOT_MANUAL_RECOVERY_FIXED_PREFIX" | "COPILOT_MANUAL_RECOVERY_INDIVISIBLE" | "COPILOT_MANUAL_RECOVERY_CALL_LIMIT" | "COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY" | "COPILOT_MANUAL_RECOVERY_UNBALANCED";
25
+ bucket: number;
26
+ count: number;
27
+ }[];
28
+ pending: {
29
+ version: string;
30
+ operation: "compaction" | "account-global-switch" | "account-session-select" | "account-session-inherit" | "identity-read" | "identity-flight" | "compaction-summary" | "collection";
31
+ stage: "ended" | "admitted" | "rpc-invoked" | "host-received" | "identity-validation" | "model-validation" | "cas" | "readback" | "response-received" | "decoded" | "client-settled" | "summary-attempt" | "checkpoint-committed" | "cache-hit" | "joined-flight" | "cooldown" | "dispatched";
32
+ bucket: number;
33
+ count: number;
34
+ }[];
35
+ dropped: number;
36
+ clientDropped: number;
37
+ clientUnconfirmed: number;
38
+ saturated: number;
39
+ evicted: number;
40
+ interrupted: number;
41
+ }>;
42
+ };
43
+ export declare function diagnosticsDomainForProfile(profileId: string): typeof diagnosticsDomain;
44
+ declare module '@deepseek-ai/cordis' {
45
+ interface Context {
46
+ githubCopilotDiagnostics: DiagnosticsController;
47
+ }
48
+ }
49
+ export declare function beginDiagnostics(ctx: Context, operation: DiagnosticsOperation): DiagnosticsHandle | undefined;
50
+ /** Keeps diagnostics durability failures separate from observed business failures. */
51
+ export declare class DiagnosticsController extends TypertRemoteService {
52
+ readonly collector: DiagnosticsCollector;
53
+ private domain;
54
+ private state;
55
+ private problem;
56
+ private enabled;
57
+ private dirty;
58
+ private persistedAt;
59
+ private revision;
60
+ private writing;
61
+ private closed;
62
+ private settingsBusy;
63
+ private readonly brackets;
64
+ constructor(ctx: Context);
65
+ flush(): Promise<void>;
66
+ markCompactionCancelled(session: object): void;
67
+ get(): DiagnosticsView;
68
+ setEnabled(enabled: boolean): Promise<DiagnosticsView>;
69
+ clear(): Promise<DiagnosticsView>;
70
+ recordClient(batch: ClientDiagnosticsBatch): Promise<DiagnosticsView>;
71
+ }
72
+ //# sourceMappingURL=diagnostics-host.d.ts.map